This merges '5b726e06d6e8309e5c9ef4109a32caf27c71dfc8' into drm-next Just to resolve some merges to make Daniel's life easier.
Unified · Split
| @@ -22,8 +22,7 @@ Required properties: · 21 unmodified lines | |||
| 22 | Optional properties: | 22 | Optional properties: |
| 23 | - ti,hwmods: Name of the hwmods associated to the eDMA CC | 23 | - ti,hwmods: Name of the hwmods associated to the eDMA CC |
| 24 | - ti,edma-memcpy-channels: List of channels allocated to be used for memcpy, iow | 24 | - ti,edma-memcpy-channels: List of channels allocated to be used for memcpy, iow |
| 25 | these channels will be SW triggered channels. The list must | 25 | these channels will be SW triggered channels. See example. |
| 26 | contain 16 bits numbers, see example. | ||
| 27 | - ti,edma-reserved-slot-ranges: PaRAM slot ranges which should not be used by | 26 | - ti,edma-reserved-slot-ranges: PaRAM slot ranges which should not be used by |
| 28 | the driver, they are allocated to be used by for example the | 27 | the driver, they are allocated to be used by for example the |
| 29 | DSP. See example. | 28 | DSP. See example. |
| @@ -56,10 +55,9 @@ edma: edma@49000000 { · 26 unmodified lines | |||
| 56 | ti,tptcs = <&edma_tptc0 7>, <&edma_tptc1 7>, <&edma_tptc2 0>; | 55 | ti,tptcs = <&edma_tptc0 7>, <&edma_tptc1 7>, <&edma_tptc2 0>; |
| 57 | 56 | ||
| 58 | /* Channel 20 and 21 is allocated for memcpy */ | 57 | /* Channel 20 and 21 is allocated for memcpy */ |
| 59 | ti,edma-memcpy-channels = /bits/ 16 <20 21>; | 58 | ti,edma-memcpy-channels = <20 21>; |
| 60 | /* The following PaRAM slots are reserved: 35-45 and 100-110 */ | 59 | /* The following PaRAM slots are reserved: 35-44 and 100-109 */ |
| 61 | ti,edma-reserved-slot-ranges = /bits/ 16 <35 10>, | 60 | ti,edma-reserved-slot-ranges = <35 10>, <100 10>; |
| 62 | /bits/ 16 <100 10>; | ||
| 63 | }; | 61 | }; |
| 64 | 62 | ||
| 65 | edma_tptc0: tptc@49800000 { | 63 | edma_tptc0: tptc@49800000 { |
| @@ -11,6 +11,10 @@ Required properties: · 10 unmodified lines | |||
| 11 | 0 = active high | 11 | 0 = active high |
| 12 | 1 = active low | 12 | 1 = active low |
| 13 | 13 | ||
| 14 | Optional properties: | ||
| 15 | - little-endian : GPIO registers are used as little endian. If not | ||
| 16 | present registers are used as big endian by default. | ||
| 17 | |||
| 14 | Example: | 18 | Example: |
| 15 | 19 | ||
| 16 | gpio0: gpio@1100 { | 20 | gpio0: gpio@1100 { |
| @@ -12,7 +12,7 @@ Each key is represented as a sub-node of "allwinner,sun4i-a10-lradc-keys": · 11 unmodified lines | |||
| 12 | Required subnode-properties: | 12 | Required subnode-properties: |
| 13 | - label: Descriptive name of the key. | 13 | - label: Descriptive name of the key. |
| 14 | - linux,code: Keycode to emit. | 14 | - linux,code: Keycode to emit. |
| 15 | - channel: Channel this key is attached to, mut be 0 or 1. | 15 | - channel: Channel this key is attached to, must be 0 or 1. |
| 16 | - voltage: Voltage in µV at lradc input when this key is pressed. | 16 | - voltage: Voltage in µV at lradc input when this key is pressed. |
| 17 | 17 | ||
| 18 | Example: | 18 | Example: |
| @@ -6,7 +6,9 @@ used for what purposes, but which don't use an on-flash partition table such · 5 unmodified lines | |||
| 6 | as RedBoot. | 6 | as RedBoot. |
| 7 | 7 | ||
| 8 | The partition table should be a subnode of the mtd node and should be named | 8 | The partition table should be a subnode of the mtd node and should be named |
| 9 | 'partitions'. Partitions are defined in subnodes of the partitions node. | 9 | 'partitions'. This node should have the following property: |
| 10 | - compatible : (required) must be "fixed-partitions" | ||
| 11 | Partitions are then defined in subnodes of the partitions node. | ||
| 10 | 12 | ||
| 11 | For backwards compatibility partitions as direct subnodes of the mtd device are | 13 | For backwards compatibility partitions as direct subnodes of the mtd device are |
| 12 | supported. This use is discouraged. | 14 | supported. This use is discouraged. |
| @@ -36,6 +38,7 @@ Examples: · 23 unmodified lines | |||
| 36 | 38 | ||
| 37 | flash@0 { | 39 | flash@0 { |
| 38 | partitions { | 40 | partitions { |
| 41 | compatible = "fixed-partitions"; | ||
| 39 | #address-cells = <1>; | 42 | #address-cells = <1>; |
| 40 | #size-cells = <1>; | 43 | #size-cells = <1>; |
| 41 | 44 | ||
| @@ -53,6 +56,7 @@ flash@0 { · 11 unmodified lines | |||
| 53 | 56 | ||
| 54 | flash@1 { | 57 | flash@1 { |
| 55 | partitions { | 58 | partitions { |
| 59 | compatible = "fixed-partitions"; | ||
| 56 | #address-cells = <1>; | 60 | #address-cells = <1>; |
| 57 | #size-cells = <2>; | 61 | #size-cells = <2>; |
| 58 | 62 | ||
| @@ -66,6 +70,7 @@ flash@1 { · 7 unmodified lines | |||
| 66 | 70 | ||
| 67 | flash@2 { | 71 | flash@2 { |
| 68 | partitions { | 72 | partitions { |
| 73 | compatible = "fixed-partitions"; | ||
| 69 | #address-cells = <2>; | 74 | #address-cells = <2>; |
| 70 | #size-cells = <2>; | 75 | #size-cells = <2>; |
| 71 | 76 | ||
| @@ -181,17 +181,3 @@ For general information, go to the Intel support website at: · 180 unmodified lines | |||
| 181 | If an issue is identified with the released source code on the supported | 181 | If an issue is identified with the released source code on the supported |
| 182 | kernel with a supported adapter, email the specific information related to the | 182 | kernel with a supported adapter, email the specific information related to the |
| 183 | issue to e1000-devel@lists.sourceforge.net. | 183 | issue to e1000-devel@lists.sourceforge.net. |
| 184 | |||
| 185 | |||
| 186 | License | ||
| 187 | ======= | ||
| 188 | |||
| 189 | This software program is released under the terms of a license agreement | ||
| 190 | between you ('Licensee') and Intel. Do not use or load this software or any | ||
| 191 | associated materials (collectively, the 'Software') until you have carefully | ||
| 192 | read the full terms and conditions of the file COPYING located in this software | ||
| 193 | package. By loading or using the Software, you agree to the terms of this | ||
| 194 | Agreement. If you do not agree with the terms of this Agreement, do not install | ||
| 195 | or use the Software. | ||
| 196 | |||
| 197 | * Other names and brands may be claimed as the property of others. | ||
| @@ -2975,6 +2975,7 @@ F: kernel/cpuset.c · 2974 unmodified lines | |||
| 2975 | CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) | 2975 | CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) |
| 2976 | M: Johannes Weiner <hannes@cmpxchg.org> | 2976 | M: Johannes Weiner <hannes@cmpxchg.org> |
| 2977 | M: Michal Hocko <mhocko@kernel.org> | 2977 | M: Michal Hocko <mhocko@kernel.org> |
| 2978 | M: Vladimir Davydov <vdavydov@virtuozzo.com> | ||
| 2978 | L: cgroups@vger.kernel.org | 2979 | L: cgroups@vger.kernel.org |
| 2979 | L: linux-mm@kvack.org | 2980 | L: linux-mm@kvack.org |
| 2980 | S: Maintained | 2981 | S: Maintained |
| @@ -5586,7 +5587,7 @@ R: Jesse Brandeburg <jesse.brandeburg@intel.com> · 2605 unmodified lines | |||
| 5586 | R: Shannon Nelson <shannon.nelson@intel.com> | 5587 | R: Shannon Nelson <shannon.nelson@intel.com> |
| 5587 | R: Carolyn Wyborny <carolyn.wyborny@intel.com> | 5588 | R: Carolyn Wyborny <carolyn.wyborny@intel.com> |
| 5588 | R: Don Skidmore <donald.c.skidmore@intel.com> | 5589 | R: Don Skidmore <donald.c.skidmore@intel.com> |
| 5589 | R: Matthew Vick <matthew.vick@intel.com> | 5590 | R: Bruce Allan <bruce.w.allan@intel.com> |
| 5590 | R: John Ronciak <john.ronciak@intel.com> | 5591 | R: John Ronciak <john.ronciak@intel.com> |
| 5591 | R: Mitch Williams <mitch.a.williams@intel.com> | 5592 | R: Mitch Williams <mitch.a.williams@intel.com> |
| 5592 | L: intel-wired-lan@lists.osuosl.org | 5593 | L: intel-wired-lan@lists.osuosl.org |
| @@ -8295,7 +8296,7 @@ F: include/linux/delayacct.h · 2702 unmodified lines | |||
| 8295 | F: kernel/delayacct.c | 8296 | F: kernel/delayacct.c |
| 8296 | 8297 | ||
| 8297 | PERFORMANCE EVENTS SUBSYSTEM | 8298 | PERFORMANCE EVENTS SUBSYSTEM |
| 8298 | M: Peter Zijlstra <a.p.zijlstra@chello.nl> | 8299 | M: Peter Zijlstra <peterz@infradead.org> |
| 8299 | M: Ingo Molnar <mingo@redhat.com> | 8300 | M: Ingo Molnar <mingo@redhat.com> |
| 8300 | M: Arnaldo Carvalho de Melo <acme@kernel.org> | 8301 | M: Arnaldo Carvalho de Melo <acme@kernel.org> |
| 8301 | L: linux-kernel@vger.kernel.org | 8302 | L: linux-kernel@vger.kernel.org |
| @@ -8388,6 +8389,14 @@ L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) · 86 unmodified lines | |||
| 8388 | S: Maintained | 8389 | S: Maintained |
| 8389 | F: drivers/pinctrl/samsung/ | 8390 | F: drivers/pinctrl/samsung/ |
| 8390 | 8391 | ||
| 8392 | PIN CONTROLLER - SINGLE | ||
| 8393 | M: Tony Lindgren <tony@atomide.com> | ||
| 8394 | M: Haojian Zhuang <haojian.zhuang@linaro.org> | ||
| 8395 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
| 8396 | L: linux-omap@vger.kernel.org | ||
| 8397 | S: Maintained | ||
| 8398 | F: drivers/pinctrl/pinctrl-single.c | ||
| 8399 | |||
| 8391 | PIN CONTROLLER - ST SPEAR | 8400 | PIN CONTROLLER - ST SPEAR |
| 8392 | M: Viresh Kumar <vireshk@kernel.org> | 8401 | M: Viresh Kumar <vireshk@kernel.org> |
| 8393 | L: spear-devel@list.st.com | 8402 | L: spear-devel@list.st.com |
| @@ -8954,6 +8963,13 @@ F: drivers/rpmsg/ · 560 unmodified lines | |||
| 8954 | F: Documentation/rpmsg.txt | 8963 | F: Documentation/rpmsg.txt |
| 8955 | F: include/linux/rpmsg.h | 8964 | F: include/linux/rpmsg.h |
| 8956 | 8965 | ||
| 8966 | RENESAS ETHERNET DRIVERS | ||
| 8967 | R: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | ||
| 8968 | L: netdev@vger.kernel.org | ||
| 8969 | L: linux-sh@vger.kernel.org | ||
| 8970 | F: drivers/net/ethernet/renesas/ | ||
| 8971 | F: include/linux/sh_eth.h | ||
| 8972 | |||
| 8957 | RESET CONTROLLER FRAMEWORK | 8973 | RESET CONTROLLER FRAMEWORK |
| 8958 | M: Philipp Zabel <p.zabel@pengutronix.de> | 8974 | M: Philipp Zabel <p.zabel@pengutronix.de> |
| 8959 | S: Maintained | 8975 | S: Maintained |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 4 | 1 | VERSION = 4 |
| 2 | PATCHLEVEL = 4 | 2 | PATCHLEVEL = 4 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc6 |
| 5 | NAME = Blurry Fish Butt | 5 | NAME = Blurry Fish Butt |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
| @@ -445,6 +445,7 @@ config LINUX_LINK_BASE · 444 unmodified lines | |||
| 445 | However some customers have peripherals mapped at this addr, so | 445 | However some customers have peripherals mapped at this addr, so |
| 446 | Linux needs to be scooted a bit. | 446 | Linux needs to be scooted a bit. |
| 447 | If you don't know what the above means, leave this setting alone. | 447 | If you don't know what the above means, leave this setting alone. |
| 448 | This needs to match memory start address specified in Device Tree | ||
| 448 | 449 | ||
| 449 | config HIGHMEM | 450 | config HIGHMEM |
| 450 | bool "High Memory Support" | 451 | bool "High Memory Support" |
| @@ -46,6 +46,7 @@ · 45 unmodified lines | |||
| 46 | snps,pbl = < 32 >; | 46 | snps,pbl = < 32 >; |
| 47 | clocks = <&apbclk>; | 47 | clocks = <&apbclk>; |
| 48 | clock-names = "stmmaceth"; | 48 | clock-names = "stmmaceth"; |
| 49 | max-speed = <100>; | ||
| 49 | }; | 50 | }; |
| 50 | 51 | ||
| 51 | ehci@0x40000 { | 52 | ehci@0x40000 { |
| @@ -17,7 +17,8 @@ · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | memory { | 18 | memory { |
| 19 | device_type = "memory"; | 19 | device_type = "memory"; |
| 20 | reg = <0x0 0x80000000 0x0 0x40000000 /* 1 GB low mem */ | 20 | /* CONFIG_LINUX_LINK_BASE needs to match low mem start */ |
| 21 | reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MB low mem */ | ||
| 21 | 0x1 0x00000000 0x0 0x40000000>; /* 1 GB highmem */ | 22 | 0x1 0x00000000 0x0 0x40000000>; /* 1 GB highmem */ |
| 22 | }; | 23 | }; |
| 23 | 24 | ||
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | * @dt_compat: Array of device tree 'compatible' strings | 23 | * @dt_compat: Array of device tree 'compatible' strings |
| 24 | * (XXX: although only 1st entry is looked at) | 24 | * (XXX: although only 1st entry is looked at) |
| 25 | * @init_early: Very early callback [called from setup_arch()] | 25 | * @init_early: Very early callback [called from setup_arch()] |
| 26 | * @init_cpu_smp: for each CPU as it is coming up (SMP as well as UP) | 26 | * @init_per_cpu: for each CPU as it is coming up (SMP as well as UP) |
| 27 | * [(M):init_IRQ(), (o):start_kernel_secondary()] | 27 | * [(M):init_IRQ(), (o):start_kernel_secondary()] |
| 28 | * @init_machine: arch initcall level callback (e.g. populate static | 28 | * @init_machine: arch initcall level callback (e.g. populate static |
| 29 | * platform devices or parse Devicetree) | 29 | * platform devices or parse Devicetree) |
| @@ -35,7 +35,7 @@ struct machine_desc { · 5 unmodified lines | |||
| 35 | const char **dt_compat; | 35 | const char **dt_compat; |
| 36 | void (*init_early)(void); | 36 | void (*init_early)(void); |
| 37 | #ifdef CONFIG_SMP | 37 | #ifdef CONFIG_SMP |
| 38 | void (*init_cpu_smp)(unsigned int); | 38 | void (*init_per_cpu)(unsigned int); |
| 39 | #endif | 39 | #endif |
| 40 | void (*init_machine)(void); | 40 | void (*init_machine)(void); |
| 41 | void (*init_late)(void); | 41 | void (*init_late)(void); |
| @@ -48,7 +48,7 @@ extern int smp_ipi_irq_setup(int cpu, int irq); · 47 unmodified lines | |||
| 48 | * @init_early_smp: A SMP specific h/w block can init itself | 48 | * @init_early_smp: A SMP specific h/w block can init itself |
| 49 | * Could be common across platforms so not covered by | 49 | * Could be common across platforms so not covered by |
| 50 | * mach_desc->init_early() | 50 | * mach_desc->init_early() |
| 51 | * @init_irq_cpu: Called for each core so SMP h/w block driver can do | 51 | * @init_per_cpu: Called for each core so SMP h/w block driver can do |
| 52 | * any needed setup per cpu (e.g. IPI request) | 52 | * any needed setup per cpu (e.g. IPI request) |
| 53 | * @cpu_kick: For Master to kickstart a cpu (optionally at a PC) | 53 | * @cpu_kick: For Master to kickstart a cpu (optionally at a PC) |
| 54 | * @ipi_send: To send IPI to a @cpu | 54 | * @ipi_send: To send IPI to a @cpu |
| @@ -57,7 +57,7 @@ extern int smp_ipi_irq_setup(int cpu, int irq); · 2 unmodified lines | |||
| 57 | struct plat_smp_ops { | 57 | struct plat_smp_ops { |
| 58 | const char *info; | 58 | const char *info; |
| 59 | void (*init_early_smp)(void); | 59 | void (*init_early_smp)(void); |
| 60 | void (*init_irq_cpu)(int cpu); | 60 | void (*init_per_cpu)(int cpu); |
| 61 | void (*cpu_kick)(int cpu, unsigned long pc); | 61 | void (*cpu_kick)(int cpu, unsigned long pc); |
| 62 | void (*ipi_send)(int cpu); | 62 | void (*ipi_send)(int cpu); |
| 63 | void (*ipi_clear)(int irq); | 63 | void (*ipi_clear)(int irq); |
| @@ -112,7 +112,6 @@ struct unwind_frame_info { · 111 unmodified lines | |||
| 112 | 112 | ||
| 113 | extern int arc_unwind(struct unwind_frame_info *frame); | 113 | extern int arc_unwind(struct unwind_frame_info *frame); |
| 114 | extern void arc_unwind_init(void); | 114 | extern void arc_unwind_init(void); |
| 115 | extern void arc_unwind_setup(void); | ||
| 116 | extern void *unwind_add_table(struct module *module, const void *table_start, | 115 | extern void *unwind_add_table(struct module *module, const void *table_start, |
| 117 | unsigned long table_size); | 116 | unsigned long table_size); |
| 118 | extern void unwind_remove_table(void *handle, int init_only); | 117 | extern void unwind_remove_table(void *handle, int init_only); |
| @@ -152,9 +151,6 @@ static inline void arc_unwind_init(void) · 33 unmodified lines | |||
| 152 | { | 151 | { |
| 153 | } | 152 | } |
| 154 | 153 | ||
| 155 | static inline void arc_unwind_setup(void) | ||
| 156 | { | ||
| 157 | } | ||
| 158 | #define unwind_add_table(a, b, c) | 154 | #define unwind_add_table(a, b, c) |
| 159 | #define unwind_remove_table(a, b) | 155 | #define unwind_remove_table(a, b) |
| 160 | 156 | ||
| @@ -106,10 +106,21 @@ static struct irq_chip arcv2_irq_chip = { · 105 unmodified lines | |||
| 106 | static int arcv2_irq_map(struct irq_domain *d, unsigned int irq, | 106 | static int arcv2_irq_map(struct irq_domain *d, unsigned int irq, |
| 107 | irq_hw_number_t hw) | 107 | irq_hw_number_t hw) |
| 108 | { | 108 | { |
| 109 | if (irq == TIMER0_IRQ || irq == IPI_IRQ) | 109 | /* |
| 110 | * core intc IRQs [16, 23]: | ||
| 111 | * Statically assigned always private-per-core (Timers, WDT, IPI, PCT) | ||
| 112 | */ | ||
| 113 | if (hw < 24) { | ||
| 114 | /* | ||
| 115 | * A subsequent request_percpu_irq() fails if percpu_devid is | ||
| 116 | * not set. That in turns sets NOAUTOEN, meaning each core needs | ||
| 117 | * to call enable_percpu_irq() | ||
| 118 | */ | ||
| 119 | irq_set_percpu_devid(irq); | ||
| 110 | irq_set_chip_and_handler(irq, &arcv2_irq_chip, handle_percpu_irq); | 120 | irq_set_chip_and_handler(irq, &arcv2_irq_chip, handle_percpu_irq); |
| 111 | else | 121 | } else { |
| 112 | irq_set_chip_and_handler(irq, &arcv2_irq_chip, handle_level_irq); | 122 | irq_set_chip_and_handler(irq, &arcv2_irq_chip, handle_level_irq); |
| 123 | } | ||
| 113 | 124 | ||
| 114 | return 0; | 125 | return 0; |
| 115 | } | 126 | } |
| @@ -29,11 +29,11 @@ void __init init_IRQ(void) · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | #ifdef CONFIG_SMP | 30 | #ifdef CONFIG_SMP |
| 31 | /* a SMP H/w block could do IPI IRQ request here */ | 31 | /* a SMP H/w block could do IPI IRQ request here */ |
| 32 | if (plat_smp_ops.init_irq_cpu) | 32 | if (plat_smp_ops.init_per_cpu) |
| 33 | plat_smp_ops.init_irq_cpu(smp_processor_id()); | 33 | plat_smp_ops.init_per_cpu(smp_processor_id()); |
| 34 | 34 | ||
| 35 | if (machine_desc->init_cpu_smp) | 35 | if (machine_desc->init_per_cpu) |
| 36 | machine_desc->init_cpu_smp(smp_processor_id()); | 36 | machine_desc->init_per_cpu(smp_processor_id()); |
| 37 | #endif | 37 | #endif |
| 38 | } | 38 | } |
| 39 | 39 | ||
| @@ -51,6 +51,18 @@ void arch_do_IRQ(unsigned int irq, struct pt_regs *regs) · 11 unmodified lines | |||
| 51 | set_irq_regs(old_regs); | 51 | set_irq_regs(old_regs); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | /* | ||
| 55 | * API called for requesting percpu interrupts - called by each CPU | ||
| 56 | * - For boot CPU, actually request the IRQ with genirq core + enables | ||
| 57 | * - For subsequent callers only enable called locally | ||
| 58 | * | ||
| 59 | * Relies on being called by boot cpu first (i.e. request called ahead) of | ||
| 60 | * any enable as expected by genirq. Hence Suitable only for TIMER, IPI | ||
| 61 | * which are guaranteed to be setup on boot core first. | ||
| 62 | * Late probed peripherals such as perf can't use this as there no guarantee | ||
| 63 | * of being called on boot CPU first. | ||
| 64 | */ | ||
| 65 | |||
| 54 | void arc_request_percpu_irq(int irq, int cpu, | 66 | void arc_request_percpu_irq(int irq, int cpu, |
| 55 | irqreturn_t (*isr)(int irq, void *dev), | 67 | irqreturn_t (*isr)(int irq, void *dev), |
| 56 | const char *irq_nm, | 68 | const char *irq_nm, |
| @@ -60,14 +72,17 @@ void arc_request_percpu_irq(int irq, int cpu, · 3 unmodified lines | |||
| 60 | if (!cpu) { | 72 | if (!cpu) { |
| 61 | int rc; | 73 | int rc; |
| 62 | 74 | ||
| 75 | #ifdef CONFIG_ISA_ARCOMPACT | ||
| 63 | /* | 76 | /* |
| 64 | * These 2 calls are essential to making percpu IRQ APIs work | 77 | * A subsequent request_percpu_irq() fails if percpu_devid is |
| 65 | * Ideally these details could be hidden in irq chip map function | 78 | * not set. That in turns sets NOAUTOEN, meaning each core needs |
| 66 | * but the issue is IPIs IRQs being static (non-DT) and platform | 79 | * to call enable_percpu_irq() |
| 67 | * specific, so we can't identify them there. | 80 | * |
| 81 | * For ARCv2, this is done in irq map function since we know | ||
| 82 | * which irqs are strictly per cpu | ||
| 68 | */ | 83 | */ |
| 69 | irq_set_percpu_devid(irq); | 84 | irq_set_percpu_devid(irq); |
| 70 | irq_modify_status(irq, IRQ_NOAUTOEN, 0); /* @irq, @clr, @set */ | 85 | #endif |
| 71 | 86 | ||
| 72 | rc = request_percpu_irq(irq, isr, irq_nm, percpu_dev); | 87 | rc = request_percpu_irq(irq, isr, irq_nm, percpu_dev); |
| 73 | if (rc) | 88 | if (rc) |
| @@ -132,7 +132,7 @@ static void mcip_probe_n_setup(void) · 131 unmodified lines | |||
| 132 | struct plat_smp_ops plat_smp_ops = { | 132 | struct plat_smp_ops plat_smp_ops = { |
| 133 | .info = smp_cpuinfo_buf, | 133 | .info = smp_cpuinfo_buf, |
| 134 | .init_early_smp = mcip_probe_n_setup, | 134 | .init_early_smp = mcip_probe_n_setup, |
| 135 | .init_irq_cpu = mcip_setup_per_cpu, | 135 | .init_per_cpu = mcip_setup_per_cpu, |
| 136 | .ipi_send = mcip_ipi_send, | 136 | .ipi_send = mcip_ipi_send, |
| 137 | .ipi_clear = mcip_ipi_clear, | 137 | .ipi_clear = mcip_ipi_clear, |
| 138 | }; | 138 | }; |
| @@ -428,12 +428,11 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) · 427 unmodified lines | |||
| 428 | 428 | ||
| 429 | #endif /* CONFIG_ISA_ARCV2 */ | 429 | #endif /* CONFIG_ISA_ARCV2 */ |
| 430 | 430 | ||
| 431 | void arc_cpu_pmu_irq_init(void) | 431 | static void arc_cpu_pmu_irq_init(void *data) |
| 432 | { | 432 | { |
| 433 | struct arc_pmu_cpu *pmu_cpu = this_cpu_ptr(&arc_pmu_cpu); | 433 | int irq = *(int *)data; |
| 434 | 434 | ||
| 435 | arc_request_percpu_irq(arc_pmu->irq, smp_processor_id(), arc_pmu_intr, | 435 | enable_percpu_irq(irq, IRQ_TYPE_NONE); |
| 436 | "ARC perf counters", pmu_cpu); | ||
| 437 | 436 | ||
| 438 | /* Clear all pending interrupt flags */ | 437 | /* Clear all pending interrupt flags */ |
| 439 | write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff); | 438 | write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff); |
| @@ -515,7 +514,6 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 75 unmodified lines | |||
| 515 | 514 | ||
| 516 | if (has_interrupts) { | 515 | if (has_interrupts) { |
| 517 | int irq = platform_get_irq(pdev, 0); | 516 | int irq = platform_get_irq(pdev, 0); |
| 518 | unsigned long flags; | ||
| 519 | 517 | ||
| 520 | if (irq < 0) { | 518 | if (irq < 0) { |
| 521 | pr_err("Cannot get IRQ number for the platform\n"); | 519 | pr_err("Cannot get IRQ number for the platform\n"); |
| @@ -524,24 +522,12 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 524 | 522 | ||
| 525 | arc_pmu->irq = irq; | 523 | arc_pmu->irq = irq; |
| 526 | 524 | ||
| 527 | /* | 525 | /* intc map function ensures irq_set_percpu_devid() called */ |
| 528 | * arc_cpu_pmu_irq_init() needs to be called on all cores for | 526 | request_percpu_irq(irq, arc_pmu_intr, "ARC perf counters", |
| 529 | * their respective local PMU. | 527 | this_cpu_ptr(&arc_pmu_cpu)); |
| 530 | * However we use opencoded on_each_cpu() to ensure it is called | 528 | |
| 531 | * on core0 first, so that arc_request_percpu_irq() sets up | 529 | on_each_cpu(arc_cpu_pmu_irq_init, &irq, 1); |
| 532 | * AUTOEN etc. Otherwise enable_percpu_irq() fails to enable | 530 | |
| 533 | * perf IRQ on non master cores. | ||
| 534 | * see arc_request_percpu_irq() | ||
| 535 | */ | ||
| 536 | preempt_disable(); | ||
| 537 | local_irq_save(flags); | ||
| 538 | arc_cpu_pmu_irq_init(); | ||
| 539 | local_irq_restore(flags); | ||
| 540 | smp_call_function((smp_call_func_t)arc_cpu_pmu_irq_init, 0, 1); | ||
| 541 | preempt_enable(); | ||
| 542 | |||
| 543 | /* Clean all pending interrupt flags */ | ||
| 544 | write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff); | ||
| 545 | } else | 531 | } else |
| 546 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; | 532 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; |
| 547 | 533 | ||
| @@ -429,7 +429,6 @@ void __init setup_arch(char **cmdline_p) · 428 unmodified lines | |||
| 429 | #endif | 429 | #endif |
| 430 | 430 | ||
| 431 | arc_unwind_init(); | 431 | arc_unwind_init(); |
| 432 | arc_unwind_setup(); | ||
| 433 | } | 432 | } |
| 434 | 433 | ||
| 435 | static int __init customize_machine(void) | 434 | static int __init customize_machine(void) |
| @@ -132,11 +132,11 @@ void start_kernel_secondary(void) · 131 unmodified lines | |||
| 132 | pr_info("## CPU%u LIVE ##: Executing Code...\n", cpu); | 132 | pr_info("## CPU%u LIVE ##: Executing Code...\n", cpu); |
| 133 | 133 | ||
| 134 | /* Some SMP H/w setup - for each cpu */ | 134 | /* Some SMP H/w setup - for each cpu */ |
| 135 | if (plat_smp_ops.init_irq_cpu) | 135 | if (plat_smp_ops.init_per_cpu) |
| 136 | plat_smp_ops.init_irq_cpu(cpu); | 136 | plat_smp_ops.init_per_cpu(cpu); |
| 137 | 137 | ||
| 138 | if (machine_desc->init_cpu_smp) | 138 | if (machine_desc->init_per_cpu) |
| 139 | machine_desc->init_cpu_smp(cpu); | 139 | machine_desc->init_per_cpu(cpu); |
| 140 | 140 | ||
| 141 | arc_local_timer_setup(); | 141 | arc_local_timer_setup(); |
| 142 | 142 | ||
| @@ -170,6 +170,23 @@ static struct unwind_table *find_table(unsigned long pc) · 169 unmodified lines | |||
| 170 | 170 | ||
| 171 | static unsigned long read_pointer(const u8 **pLoc, | 171 | static unsigned long read_pointer(const u8 **pLoc, |
| 172 | const void *end, signed ptrType); | 172 | const void *end, signed ptrType); |
| 173 | static void init_unwind_hdr(struct unwind_table *table, | ||
| 174 | void *(*alloc) (unsigned long)); | ||
| 175 | |||
| 176 | /* | ||
| 177 | * wrappers for header alloc (vs. calling one vs. other at call site) | ||
| 178 | * to elide section mismatches warnings | ||
| 179 | */ | ||
| 180 | static void *__init unw_hdr_alloc_early(unsigned long sz) | ||
| 181 | { | ||
| 182 | return __alloc_bootmem_nopanic(sz, sizeof(unsigned int), | ||
| 183 | MAX_DMA_ADDRESS); | ||
| 184 | } | ||
| 185 | |||
| 186 | static void *unw_hdr_alloc(unsigned long sz) | ||
| 187 | { | ||
| 188 | return kmalloc(sz, GFP_KERNEL); | ||
| 189 | } | ||
| 173 | 190 | ||
| 174 | static void init_unwind_table(struct unwind_table *table, const char *name, | 191 | static void init_unwind_table(struct unwind_table *table, const char *name, |
| 175 | const void *core_start, unsigned long core_size, | 192 | const void *core_start, unsigned long core_size, |
| @@ -209,6 +226,8 @@ void __init arc_unwind_init(void) · 33 unmodified lines | |||
| 209 | __start_unwind, __end_unwind - __start_unwind, | 226 | __start_unwind, __end_unwind - __start_unwind, |
| 210 | NULL, 0); | 227 | NULL, 0); |
| 211 | /*__start_unwind_hdr, __end_unwind_hdr - __start_unwind_hdr);*/ | 228 | /*__start_unwind_hdr, __end_unwind_hdr - __start_unwind_hdr);*/ |
| 229 | |||
| 230 | init_unwind_hdr(&root_table, unw_hdr_alloc_early); | ||
| 212 | } | 231 | } |
| 213 | 232 | ||
| 214 | static const u32 bad_cie, not_fde; | 233 | static const u32 bad_cie, not_fde; |
| @@ -241,8 +260,8 @@ static void swap_eh_frame_hdr_table_entries(void *p1, void *p2, int size) · 26 unmodified lines | |||
| 241 | e2->fde = v; | 260 | e2->fde = v; |
| 242 | } | 261 | } |
| 243 | 262 | ||
| 244 | static void __init setup_unwind_table(struct unwind_table *table, | 263 | static void init_unwind_hdr(struct unwind_table *table, |
| 245 | void *(*alloc) (unsigned long)) | 264 | void *(*alloc) (unsigned long)) |
| 246 | { | 265 | { |
| 247 | const u8 *ptr; | 266 | const u8 *ptr; |
| 248 | unsigned long tableSize = table->size, hdrSize; | 267 | unsigned long tableSize = table->size, hdrSize; |
| @@ -274,13 +293,13 @@ static void __init setup_unwind_table(struct unwind_table *table, · 25 unmodified lines | |||
| 274 | const u32 *cie = cie_for_fde(fde, table); | 293 | const u32 *cie = cie_for_fde(fde, table); |
| 275 | signed ptrType; | 294 | signed ptrType; |
| 276 | 295 | ||
| 277 | if (cie == ¬_fde) | 296 | if (cie == ¬_fde) /* only process FDE here */ |
| 278 | continue; | 297 | continue; |
| 279 | if (cie == NULL || cie == &bad_cie) | 298 | if (cie == NULL || cie == &bad_cie) |
| 280 | return; | 299 | continue; /* say FDE->CIE.version != 1 */ |
| 281 | ptrType = fde_pointer_type(cie); | 300 | ptrType = fde_pointer_type(cie); |
| 282 | if (ptrType < 0) | 301 | if (ptrType < 0) |
| 283 | return; | 302 | continue; |
| 284 | 303 | ||
| 285 | ptr = (const u8 *)(fde + 2); | 304 | ptr = (const u8 *)(fde + 2); |
| 286 | if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde, | 305 | if (!read_pointer(&ptr, (const u8 *)(fde + 1) + *fde, |
| @@ -300,9 +319,11 @@ static void __init setup_unwind_table(struct unwind_table *table, · 13 unmodified lines | |||
| 300 | 319 | ||
| 301 | hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int) | 320 | hdrSize = 4 + sizeof(unsigned long) + sizeof(unsigned int) |
| 302 | + 2 * n * sizeof(unsigned long); | 321 | + 2 * n * sizeof(unsigned long); |
| 322 | |||
| 303 | header = alloc(hdrSize); | 323 | header = alloc(hdrSize); |
| 304 | if (!header) | 324 | if (!header) |
| 305 | return; | 325 | return; |
| 326 | |||
| 306 | header->version = 1; | 327 | header->version = 1; |
| 307 | header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native; | 328 | header->eh_frame_ptr_enc = DW_EH_PE_abs | DW_EH_PE_native; |
| 308 | header->fde_count_enc = DW_EH_PE_abs | DW_EH_PE_data4; | 329 | header->fde_count_enc = DW_EH_PE_abs | DW_EH_PE_data4; |
| @@ -322,6 +343,10 @@ static void __init setup_unwind_table(struct unwind_table *table, · 13 unmodified lines | |||
| 322 | 343 | ||
| 323 | if (fde[1] == 0xffffffff) | 344 | if (fde[1] == 0xffffffff) |
| 324 | continue; /* this is a CIE */ | 345 | continue; /* this is a CIE */ |
| 346 | |||
| 347 | if (*(u8 *)(cie + 2) != 1) | ||
| 348 | continue; /* FDE->CIE.version not supported */ | ||
| 349 | |||
| 325 | ptr = (const u8 *)(fde + 2); | 350 | ptr = (const u8 *)(fde + 2); |
| 326 | header->table[n].start = read_pointer(&ptr, | 351 | header->table[n].start = read_pointer(&ptr, |
| 327 | (const u8 *)(fde + 1) + | 352 | (const u8 *)(fde + 1) + |
| @@ -342,18 +367,6 @@ static void __init setup_unwind_table(struct unwind_table *table, · 14 unmodified lines | |||
| 342 | table->header = (const void *)header; | 367 | table->header = (const void *)header; |
| 343 | } | 368 | } |
| 344 | 369 | ||
| 345 | static void *__init balloc(unsigned long sz) | ||
| 346 | { | ||
| 347 | return __alloc_bootmem_nopanic(sz, | ||
| 348 | sizeof(unsigned int), | ||
| 349 | __pa(MAX_DMA_ADDRESS)); | ||
| 350 | } | ||
| 351 | |||
| 352 | void __init arc_unwind_setup(void) | ||
| 353 | { | ||
| 354 | setup_unwind_table(&root_table, balloc); | ||
| 355 | } | ||
| 356 | |||
| 357 | #ifdef CONFIG_MODULES | 370 | #ifdef CONFIG_MODULES |
| 358 | 371 | ||
| 359 | static struct unwind_table *last_table; | 372 | static struct unwind_table *last_table; |
| @@ -377,6 +390,8 @@ void *unwind_add_table(struct module *module, const void *table_start, · 17 unmodified lines | |||
| 377 | table_start, table_size, | 390 | table_start, table_size, |
| 378 | NULL, 0); | 391 | NULL, 0); |
| 379 | 392 | ||
| 393 | init_unwind_hdr(table, unw_hdr_alloc); | ||
| 394 | |||
| 380 | #ifdef UNWIND_DEBUG | 395 | #ifdef UNWIND_DEBUG |
| 381 | unw_debug("Table added for [%s] %lx %lx\n", | 396 | unw_debug("Table added for [%s] %lx %lx\n", |
| 382 | module->name, table->core.pc, table->core.range); | 397 | module->name, table->core.pc, table->core.range); |
| @@ -439,6 +454,7 @@ void unwind_remove_table(void *handle, int init_only) · 56 unmodified lines | |||
| 439 | info.init_only = init_only; | 454 | info.init_only = init_only; |
| 440 | 455 | ||
| 441 | unlink_table(&info); /* XXX: SMP */ | 456 | unlink_table(&info); /* XXX: SMP */ |
| 457 | kfree(table->header); | ||
| 442 | kfree(table); | 458 | kfree(table); |
| 443 | } | 459 | } |
| 444 | 460 | ||
| @@ -507,7 +523,8 @@ static const u32 *cie_for_fde(const u32 *fde, const struct unwind_table *table) · 62 unmodified lines | |||
| 507 | 523 | ||
| 508 | if (*cie <= sizeof(*cie) + 4 || *cie >= fde[1] - sizeof(*fde) | 524 | if (*cie <= sizeof(*cie) + 4 || *cie >= fde[1] - sizeof(*fde) |
| 509 | || (*cie & (sizeof(*cie) - 1)) | 525 | || (*cie & (sizeof(*cie) - 1)) |
| 510 | || (cie[1] != 0xffffffff)) | 526 | || (cie[1] != 0xffffffff) |
| 527 | || ( *(u8 *)(cie + 2) != 1)) /* version 1 supported */ | ||
| 511 | return NULL; /* this is not a (valid) CIE */ | 528 | return NULL; /* this is not a (valid) CIE */ |
| 512 | return cie; | 529 | return cie; |
| 513 | } | 530 | } |
| @@ -51,7 +51,9 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) · 50 unmodified lines | |||
| 51 | int in_use = 0; | 51 | int in_use = 0; |
| 52 | 52 | ||
| 53 | if (!low_mem_sz) { | 53 | if (!low_mem_sz) { |
| 54 | BUG_ON(base != low_mem_start); | 54 | if (base != low_mem_start) |
| 55 | panic("CONFIG_LINUX_LINK_BASE != DT memory { }"); | ||
| 56 | |||
| 55 | low_mem_sz = size; | 57 | low_mem_sz = size; |
| 56 | in_use = 1; | 58 | in_use = 1; |
| 57 | } else { | 59 | } else { |
| @@ -74,7 +74,7 @@ · 73 unmodified lines | |||
| 74 | reg = <0x48240200 0x100>; | 74 | reg = <0x48240200 0x100>; |
| 75 | interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>; | 75 | interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>; |
| 76 | interrupt-parent = <&gic>; | 76 | interrupt-parent = <&gic>; |
| 77 | clocks = <&dpll_mpu_m2_ck>; | 77 | clocks = <&mpu_periphclk>; |
| 78 | }; | 78 | }; |
| 79 | 79 | ||
| 80 | local_timer: timer@48240600 { | 80 | local_timer: timer@48240600 { |
| @@ -82,7 +82,7 @@ · 1 unmodified line | |||
| 82 | reg = <0x48240600 0x100>; | 82 | reg = <0x48240600 0x100>; |
| 83 | interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>; | 83 | interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>; |
| 84 | interrupt-parent = <&gic>; | 84 | interrupt-parent = <&gic>; |
| 85 | clocks = <&dpll_mpu_m2_ck>; | 85 | clocks = <&mpu_periphclk>; |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | l2-cache-controller@48242000 { | 88 | l2-cache-controller@48242000 { |
| @@ -259,6 +259,14 @@ · 258 unmodified lines | |||
| 259 | ti,invert-autoidle-bit; | 259 | ti,invert-autoidle-bit; |
| 260 | }; | 260 | }; |
| 261 | 261 | ||
| 262 | mpu_periphclk: mpu_periphclk { | ||
| 263 | #clock-cells = <0>; | ||
| 264 | compatible = "fixed-factor-clock"; | ||
| 265 | clocks = <&dpll_mpu_m2_ck>; | ||
| 266 | clock-mult = <1>; | ||
| 267 | clock-div = <2>; | ||
| 268 | }; | ||
| 269 | |||
| 262 | dpll_ddr_ck: dpll_ddr_ck { | 270 | dpll_ddr_ck: dpll_ddr_ck { |
| 263 | #clock-cells = <0>; | 271 | #clock-cells = <0>; |
| 264 | compatible = "ti,am3-dpll-clock"; | 272 | compatible = "ti,am3-dpll-clock"; |
| @@ -184,6 +184,7 @@ · 183 unmodified lines | |||
| 184 | regulator-name = "VDD_SDHC_1V8"; | 184 | regulator-name = "VDD_SDHC_1V8"; |
| 185 | regulator-min-microvolt = <1800000>; | 185 | regulator-min-microvolt = <1800000>; |
| 186 | regulator-max-microvolt = <1800000>; | 186 | regulator-max-microvolt = <1800000>; |
| 187 | regulator-always-on; | ||
| 187 | }; | 188 | }; |
| 188 | }; | 189 | }; |
| 189 | }; | 190 | }; |
| @@ -118,7 +118,8 @@ · 117 unmodified lines | |||
| 118 | sdhci0: sdhci@ab0000 { | 118 | sdhci0: sdhci@ab0000 { |
| 119 | compatible = "mrvl,pxav3-mmc"; | 119 | compatible = "mrvl,pxav3-mmc"; |
| 120 | reg = <0xab0000 0x200>; | 120 | reg = <0xab0000 0x200>; |
| 121 | clocks = <&chip_clk CLKID_SDIO1XIN>; | 121 | clocks = <&chip_clk CLKID_SDIO1XIN>, <&chip_clk CLKID_SDIO>; |
| 122 | clock-names = "io", "core"; | ||
| 122 | interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; | 123 | interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; |
| 123 | status = "disabled"; | 124 | status = "disabled"; |
| 124 | }; | 125 | }; |
| @@ -126,7 +127,8 @@ · 1 unmodified line | |||
| 126 | sdhci1: sdhci@ab0800 { | 127 | sdhci1: sdhci@ab0800 { |
| 127 | compatible = "mrvl,pxav3-mmc"; | 128 | compatible = "mrvl,pxav3-mmc"; |
| 128 | reg = <0xab0800 0x200>; | 129 | reg = <0xab0800 0x200>; |
| 129 | clocks = <&chip_clk CLKID_SDIO1XIN>; | 130 | clocks = <&chip_clk CLKID_SDIO1XIN>, <&chip_clk CLKID_SDIO>; |
| 131 | clock-names = "io", "core"; | ||
| 130 | interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; | 132 | interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; |
| 131 | status = "disabled"; | 133 | status = "disabled"; |
| 132 | }; | 134 | }; |
| @@ -135,7 +137,7 @@ · 2 unmodified lines | |||
| 135 | compatible = "mrvl,pxav3-mmc"; | 137 | compatible = "mrvl,pxav3-mmc"; |
| 136 | reg = <0xab1000 0x200>; | 138 | reg = <0xab1000 0x200>; |
| 137 | interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; | 139 | interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; |
| 138 | clocks = <&chip_clk CLKID_NFC_ECC>, <&chip_clk CLKID_NFC>; | 140 | clocks = <&chip_clk CLKID_NFC_ECC>, <&chip_clk CLKID_SDIO>; |
| 139 | clock-names = "io", "core"; | 141 | clock-names = "io", "core"; |
| 140 | status = "disabled"; | 142 | status = "disabled"; |
| 141 | }; | 143 | }; |
| @@ -218,6 +218,7 @@ · 217 unmodified lines | |||
| 218 | reg = <0x480c8000 0x2000>; | 218 | reg = <0x480c8000 0x2000>; |
| 219 | interrupts = <77>; | 219 | interrupts = <77>; |
| 220 | ti,hwmods = "mailbox"; | 220 | ti,hwmods = "mailbox"; |
| 221 | #mbox-cells = <1>; | ||
| 221 | ti,mbox-num-users = <4>; | 222 | ti,mbox-num-users = <4>; |
| 222 | ti,mbox-num-fifos = <12>; | 223 | ti,mbox-num-fifos = <12>; |
| 223 | mbox_dsp: mbox_dsp { | 224 | mbox_dsp: mbox_dsp { |
| @@ -279,8 +280,11 @@ · 55 unmodified lines | |||
| 279 | ti,spi-num-cs = <4>; | 280 | ti,spi-num-cs = <4>; |
| 280 | ti,hwmods = "mcspi1"; | 281 | ti,hwmods = "mcspi1"; |
| 281 | dmas = <&edma 16 &edma 17 | 282 | dmas = <&edma 16 &edma 17 |
| 282 | &edma 18 &edma 19>; | 283 | &edma 18 &edma 19 |
| 283 | dma-names = "tx0", "rx0", "tx1", "rx1"; | 284 | &edma 20 &edma 21 |
| 285 | &edma 22 &edma 23>; | ||
| 286 | dma-names = "tx0", "rx0", "tx1", "rx1", | ||
| 287 | "tx2", "rx2", "tx3", "rx3"; | ||
| 284 | }; | 288 | }; |
| 285 | 289 | ||
| 286 | mmc1: mmc@48060000 { | 290 | mmc1: mmc@48060000 { |
| @@ -18,8 +18,3 @@ · 17 unmodified lines | |||
| 18 | reg = <0x80000000 0x10000000>; | 18 | reg = <0x80000000 0x10000000>; |
| 19 | }; | 19 | }; |
| 20 | }; | 20 | }; |
| 21 | |||
| 22 | &L2 { | ||
| 23 | arm,data-latency = <2 1 2>; | ||
| 24 | arm,tag-latency = <3 2 3>; | ||
| 25 | }; | ||
| @@ -19,7 +19,7 @@ · 18 unmodified lines | |||
| 19 | reg = <0x40006000 0x1000>; | 19 | reg = <0x40006000 0x1000>; |
| 20 | cache-unified; | 20 | cache-unified; |
| 21 | cache-level = <2>; | 21 | cache-level = <2>; |
| 22 | arm,data-latency = <1 1 1>; | 22 | arm,data-latency = <3 3 3>; |
| 23 | arm,tag-latency = <2 2 2>; | 23 | arm,tag-latency = <2 2 2>; |
| 24 | }; | 24 | }; |
| 25 | }; | 25 | }; |
| @@ -178,8 +178,10 @@ · 177 unmodified lines | |||
| 178 | compatible = "fsl,vf610-sai"; | 178 | compatible = "fsl,vf610-sai"; |
| 179 | reg = <0x40031000 0x1000>; | 179 | reg = <0x40031000 0x1000>; |
| 180 | interrupts = <86 IRQ_TYPE_LEVEL_HIGH>; | 180 | interrupts = <86 IRQ_TYPE_LEVEL_HIGH>; |
| 181 | clocks = <&clks VF610_CLK_SAI2>; | 181 | clocks = <&clks VF610_CLK_SAI2>, |
| 182 | clock-names = "sai"; | 182 | <&clks VF610_CLK_SAI2_DIV>, |
| 183 | <&clks 0>, <&clks 0>; | ||
| 184 | clock-names = "bus", "mclk1", "mclk2", "mclk3"; | ||
| 183 | dma-names = "tx", "rx"; | 185 | dma-names = "tx", "rx"; |
| 184 | dmas = <&edma0 0 21>, | 186 | dmas = <&edma0 0 21>, |
| 185 | <&edma0 0 20>; | 187 | <&edma0 0 20>; |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #ifndef __ASSEMBLY__ | 21 | #ifndef __ASSEMBLY__ |
| 22 | 22 | ||
| 23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
| 24 | #include <asm/barrier.h> | ||
| 24 | 25 | ||
| 25 | #define __ACCESS_CP15(CRn, Op1, CRm, Op2) p15, Op1, %0, CRn, CRm, Op2 | 26 | #define __ACCESS_CP15(CRn, Op1, CRm, Op2) p15, Op1, %0, CRn, CRm, Op2 |
| 26 | #define __ACCESS_CP15_64(Op1, CRm) p15, Op1, %Q0, %R0, CRm | 27 | #define __ACCESS_CP15_64(Op1, CRm) p15, Op1, %Q0, %R0, CRm |
| @@ -510,10 +510,14 @@ __copy_to_user_std(void __user *to, const void *from, unsigned long n); · 509 unmodified lines | |||
| 510 | static inline unsigned long __must_check | 510 | static inline unsigned long __must_check |
| 511 | __copy_to_user(void __user *to, const void *from, unsigned long n) | 511 | __copy_to_user(void __user *to, const void *from, unsigned long n) |
| 512 | { | 512 | { |
| 513 | #ifndef CONFIG_UACCESS_WITH_MEMCPY | ||
| 513 | unsigned int __ua_flags = uaccess_save_and_enable(); | 514 | unsigned int __ua_flags = uaccess_save_and_enable(); |
| 514 | n = arm_copy_to_user(to, from, n); | 515 | n = arm_copy_to_user(to, from, n); |
| 515 | uaccess_restore(__ua_flags); | 516 | uaccess_restore(__ua_flags); |
| 516 | return n; | 517 | return n; |
| 518 | #else | ||
| 519 | return arm_copy_to_user(to, from, n); | ||
| 520 | #endif | ||
| 517 | } | 521 | } |
| 518 | 522 | ||
| 519 | extern unsigned long __must_check | 523 | extern unsigned long __must_check |
| @@ -95,6 +95,22 @@ void __show_regs(struct pt_regs *regs) · 94 unmodified lines | |||
| 95 | { | 95 | { |
| 96 | unsigned long flags; | 96 | unsigned long flags; |
| 97 | char buf[64]; | 97 | char buf[64]; |
| 98 | #ifndef CONFIG_CPU_V7M | ||
| 99 | unsigned int domain; | ||
| 100 | #ifdef CONFIG_CPU_SW_DOMAIN_PAN | ||
| 101 | /* | ||
| 102 | * Get the domain register for the parent context. In user | ||
| 103 | * mode, we don't save the DACR, so lets use what it should | ||
| 104 | * be. For other modes, we place it after the pt_regs struct. | ||
| 105 | */ | ||
| 106 | if (user_mode(regs)) | ||
| 107 | domain = DACR_UACCESS_ENABLE; | ||
| 108 | else | ||
| 109 | domain = *(unsigned int *)(regs + 1); | ||
| 110 | #else | ||
| 111 | domain = get_domain(); | ||
| 112 | #endif | ||
| 113 | #endif | ||
| 98 | 114 | ||
| 99 | show_regs_print_info(KERN_DEFAULT); | 115 | show_regs_print_info(KERN_DEFAULT); |
| 100 | 116 | ||
| @@ -123,21 +139,8 @@ void __show_regs(struct pt_regs *regs) · 22 unmodified lines | |||
| 123 | 139 | ||
| 124 | #ifndef CONFIG_CPU_V7M | 140 | #ifndef CONFIG_CPU_V7M |
| 125 | { | 141 | { |
| 126 | unsigned int domain = get_domain(); | ||
| 127 | const char *segment; | 142 | const char *segment; |
| 128 | 143 | ||
| 129 | #ifdef CONFIG_CPU_SW_DOMAIN_PAN | ||
| 130 | /* | ||
| 131 | * Get the domain register for the parent context. In user | ||
| 132 | * mode, we don't save the DACR, so lets use what it should | ||
| 133 | * be. For other modes, we place it after the pt_regs struct. | ||
| 134 | */ | ||
| 135 | if (user_mode(regs)) | ||
| 136 | domain = DACR_UACCESS_ENABLE; | ||
| 137 | else | ||
| 138 | domain = *(unsigned int *)(regs + 1); | ||
| 139 | #endif | ||
| 140 | |||
| 141 | if ((domain & domain_mask(DOMAIN_USER)) == | 144 | if ((domain & domain_mask(DOMAIN_USER)) == |
| 142 | domain_val(DOMAIN_USER, DOMAIN_NOACCESS)) | 145 | domain_val(DOMAIN_USER, DOMAIN_NOACCESS)) |
| 143 | segment = "none"; | 146 | segment = "none"; |
| @@ -163,11 +166,11 @@ void __show_regs(struct pt_regs *regs) · 19 unmodified lines | |||
| 163 | buf[0] = '\0'; | 166 | buf[0] = '\0'; |
| 164 | #ifdef CONFIG_CPU_CP15_MMU | 167 | #ifdef CONFIG_CPU_CP15_MMU |
| 165 | { | 168 | { |
| 166 | unsigned int transbase, dac = get_domain(); | 169 | unsigned int transbase; |
| 167 | asm("mrc p15, 0, %0, c2, c0\n\t" | 170 | asm("mrc p15, 0, %0, c2, c0\n\t" |
| 168 | : "=r" (transbase)); | 171 | : "=r" (transbase)); |
| 169 | snprintf(buf, sizeof(buf), " Table: %08x DAC: %08x", | 172 | snprintf(buf, sizeof(buf), " Table: %08x DAC: %08x", |
| 170 | transbase, dac); | 173 | transbase, domain); |
| 171 | } | 174 | } |
| 172 | #endif | 175 | #endif |
| 173 | asm("mrc p15, 0, %0, c1, c0\n" : "=r" (ctrl)); | 176 | asm("mrc p15, 0, %0, c1, c0\n" : "=r" (ctrl)); |
| @@ -36,10 +36,10 @@ · 35 unmodified lines | |||
| 36 | */ | 36 | */ |
| 37 | #define __user_swpX_asm(data, addr, res, temp, B) \ | 37 | #define __user_swpX_asm(data, addr, res, temp, B) \ |
| 38 | __asm__ __volatile__( \ | 38 | __asm__ __volatile__( \ |
| 39 | " mov %2, %1\n" \ | 39 | "0: ldrex"B" %2, [%3]\n" \ |
| 40 | "0: ldrex"B" %1, [%3]\n" \ | 40 | "1: strex"B" %0, %1, [%3]\n" \ |
| 41 | "1: strex"B" %0, %2, [%3]\n" \ | ||
| 42 | " cmp %0, #0\n" \ | 41 | " cmp %0, #0\n" \ |
| 42 | " moveq %1, %2\n" \ | ||
| 43 | " movne %0, %4\n" \ | 43 | " movne %0, %4\n" \ |
| 44 | "2:\n" \ | 44 | "2:\n" \ |
| 45 | " .section .text.fixup,\"ax\"\n" \ | 45 | " .section .text.fixup,\"ax\"\n" \ |
| @@ -88,6 +88,7 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) · 87 unmodified lines | |||
| 88 | static unsigned long noinline | 88 | static unsigned long noinline |
| 89 | __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) | 89 | __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) |
| 90 | { | 90 | { |
| 91 | unsigned long ua_flags; | ||
| 91 | int atomic; | 92 | int atomic; |
| 92 | 93 | ||
| 93 | if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { | 94 | if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { |
| @@ -118,7 +119,9 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) · 24 unmodified lines | |||
| 118 | if (tocopy > n) | 119 | if (tocopy > n) |
| 119 | tocopy = n; | 120 | tocopy = n; |
| 120 | 121 | ||
| 122 | ua_flags = uaccess_save_and_enable(); | ||
| 121 | memcpy((void *)to, from, tocopy); | 123 | memcpy((void *)to, from, tocopy); |
| 124 | uaccess_restore(ua_flags); | ||
| 122 | to += tocopy; | 125 | to += tocopy; |
| 123 | from += tocopy; | 126 | from += tocopy; |
| 124 | n -= tocopy; | 127 | n -= tocopy; |
| @@ -145,14 +148,21 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) · 20 unmodified lines | |||
| 145 | * With frame pointer disabled, tail call optimization kicks in | 148 | * With frame pointer disabled, tail call optimization kicks in |
| 146 | * as well making this test almost invisible. | 149 | * as well making this test almost invisible. |
| 147 | */ | 150 | */ |
| 148 | if (n < 64) | 151 | if (n < 64) { |
| 149 | return __copy_to_user_std(to, from, n); | 152 | unsigned long ua_flags = uaccess_save_and_enable(); |
| 150 | return __copy_to_user_memcpy(to, from, n); | 153 | n = __copy_to_user_std(to, from, n); |
| 154 | uaccess_restore(ua_flags); | ||
| 155 | } else { | ||
| 156 | n = __copy_to_user_memcpy(to, from, n); | ||
| 157 | } | ||
| 158 | return n; | ||
| 151 | } | 159 | } |
| 152 | 160 | ||
| 153 | static unsigned long noinline | 161 | static unsigned long noinline |
| 154 | __clear_user_memset(void __user *addr, unsigned long n) | 162 | __clear_user_memset(void __user *addr, unsigned long n) |
| 155 | { | 163 | { |
| 164 | unsigned long ua_flags; | ||
| 165 | |||
| 156 | if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { | 166 | if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { |
| 157 | memset((void *)addr, 0, n); | 167 | memset((void *)addr, 0, n); |
| 158 | return 0; | 168 | return 0; |
| @@ -175,7 +185,9 @@ __clear_user_memset(void __user *addr, unsigned long n) · 16 unmodified lines | |||
| 175 | if (tocopy > n) | 185 | if (tocopy > n) |
| 176 | tocopy = n; | 186 | tocopy = n; |
| 177 | 187 | ||
| 188 | ua_flags = uaccess_save_and_enable(); | ||
| 178 | memset((void *)addr, 0, tocopy); | 189 | memset((void *)addr, 0, tocopy); |
| 190 | uaccess_restore(ua_flags); | ||
| 179 | addr += tocopy; | 191 | addr += tocopy; |
| 180 | n -= tocopy; | 192 | n -= tocopy; |
| 181 | 193 | ||
| @@ -193,9 +205,14 @@ out: · 11 unmodified lines | |||
| 193 | unsigned long arm_clear_user(void __user *addr, unsigned long n) | 205 | unsigned long arm_clear_user(void __user *addr, unsigned long n) |
| 194 | { | 206 | { |
| 195 | /* See rational for this in __copy_to_user() above. */ | 207 | /* See rational for this in __copy_to_user() above. */ |
| 196 | if (n < 64) | 208 | if (n < 64) { |
| 197 | return __clear_user_std(addr, n); | 209 | unsigned long ua_flags = uaccess_save_and_enable(); |
| 198 | return __clear_user_memset(addr, n); | 210 | n = __clear_user_std(addr, n); |
| 211 | uaccess_restore(ua_flags); | ||
| 212 | } else { | ||
| 213 | n = __clear_user_memset(addr, n); | ||
| 214 | } | ||
| 215 | return n; | ||
| 199 | } | 216 | } |
| 200 | 217 | ||
| 201 | #if 0 | 218 | #if 0 |
| @@ -4,7 +4,6 @@ menuconfig ARCH_AT91 · 3 unmodified lines | |||
| 4 | select ARCH_REQUIRE_GPIOLIB | 4 | select ARCH_REQUIRE_GPIOLIB |
| 5 | select COMMON_CLK_AT91 | 5 | select COMMON_CLK_AT91 |
| 6 | select PINCTRL | 6 | select PINCTRL |
| 7 | select PINCTRL_AT91 | ||
| 8 | select SOC_BUS | 7 | select SOC_BUS |
| 9 | 8 | ||
| 10 | if ARCH_AT91 | 9 | if ARCH_AT91 |
| @@ -17,6 +16,7 @@ config SOC_SAMA5D2 · 6 unmodified lines | |||
| 17 | select HAVE_AT91_USB_CLK | 16 | select HAVE_AT91_USB_CLK |
| 18 | select HAVE_AT91_H32MX | 17 | select HAVE_AT91_H32MX |
| 19 | select HAVE_AT91_GENERATED_CLK | 18 | select HAVE_AT91_GENERATED_CLK |
| 19 | select PINCTRL_AT91PIO4 | ||
| 20 | help | 20 | help |
| 21 | Select this if ou are using one of Atmel's SAMA5D2 family SoC. | 21 | Select this if ou are using one of Atmel's SAMA5D2 family SoC. |
| 22 | 22 | ||
| @@ -27,6 +27,7 @@ config SOC_SAMA5D3 · 4 unmodified lines | |||
| 27 | select HAVE_AT91_UTMI | 27 | select HAVE_AT91_UTMI |
| 28 | select HAVE_AT91_SMD | 28 | select HAVE_AT91_SMD |
| 29 | select HAVE_AT91_USB_CLK | 29 | select HAVE_AT91_USB_CLK |
| 30 | select PINCTRL_AT91 | ||
| 30 | help | 31 | help |
| 31 | Select this if you are using one of Atmel's SAMA5D3 family SoC. | 32 | Select this if you are using one of Atmel's SAMA5D3 family SoC. |
| 32 | This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36. | 33 | This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36. |
| @@ -40,6 +41,7 @@ config SOC_SAMA5D4 · 7 unmodified lines | |||
| 40 | select HAVE_AT91_SMD | 41 | select HAVE_AT91_SMD |
| 41 | select HAVE_AT91_USB_CLK | 42 | select HAVE_AT91_USB_CLK |
| 42 | select HAVE_AT91_H32MX | 43 | select HAVE_AT91_H32MX |
| 44 | select PINCTRL_AT91 | ||
| 43 | help | 45 | help |
| 44 | Select this if you are using one of Atmel's SAMA5D4 family SoC. | 46 | Select this if you are using one of Atmel's SAMA5D4 family SoC. |
| 45 | 47 | ||
| @@ -50,6 +52,7 @@ config SOC_AT91RM9200 · 4 unmodified lines | |||
| 50 | select CPU_ARM920T | 52 | select CPU_ARM920T |
| 51 | select HAVE_AT91_USB_CLK | 53 | select HAVE_AT91_USB_CLK |
| 52 | select MIGHT_HAVE_PCI | 54 | select MIGHT_HAVE_PCI |
| 55 | select PINCTRL_AT91 | ||
| 53 | select SOC_SAM_V4_V5 | 56 | select SOC_SAM_V4_V5 |
| 54 | select SRAM if PM | 57 | select SRAM if PM |
| 55 | help | 58 | help |
| @@ -65,6 +68,7 @@ config SOC_AT91SAM9 · 9 unmodified lines | |||
| 65 | select HAVE_AT91_UTMI | 68 | select HAVE_AT91_UTMI |
| 66 | select HAVE_FB_ATMEL | 69 | select HAVE_FB_ATMEL |
| 67 | select MEMORY | 70 | select MEMORY |
| 71 | select PINCTRL_AT91 | ||
| 68 | select SOC_SAM_V4_V5 | 72 | select SOC_SAM_V4_V5 |
| 69 | select SRAM if PM | 73 | select SRAM if PM |
| 70 | help | 74 | help |
| @@ -41,8 +41,10 @@ · 40 unmodified lines | |||
| 41 | * implementation should be moved down into the pinctrl driver and get | 41 | * implementation should be moved down into the pinctrl driver and get |
| 42 | * called as part of the generic suspend/resume path. | 42 | * called as part of the generic suspend/resume path. |
| 43 | */ | 43 | */ |
| 44 | #ifdef CONFIG_PINCTRL_AT91 | ||
| 44 | extern void at91_pinctrl_gpio_suspend(void); | 45 | extern void at91_pinctrl_gpio_suspend(void); |
| 45 | extern void at91_pinctrl_gpio_resume(void); | 46 | extern void at91_pinctrl_gpio_resume(void); |
| 47 | #endif | ||
| 46 | 48 | ||
| 47 | static struct { | 49 | static struct { |
| 48 | unsigned long uhp_udp_mask; | 50 | unsigned long uhp_udp_mask; |
| @@ -151,8 +153,9 @@ static void at91_pm_suspend(suspend_state_t state) · 102 unmodified lines | |||
| 151 | 153 | ||
| 152 | static int at91_pm_enter(suspend_state_t state) | 154 | static int at91_pm_enter(suspend_state_t state) |
| 153 | { | 155 | { |
| 156 | #ifdef CONFIG_PINCTRL_AT91 | ||
| 154 | at91_pinctrl_gpio_suspend(); | 157 | at91_pinctrl_gpio_suspend(); |
| 155 | 158 | #endif | |
| 156 | switch (state) { | 159 | switch (state) { |
| 157 | /* | 160 | /* |
| 158 | * Suspend-to-RAM is like STANDBY plus slow clock mode, so | 161 | * Suspend-to-RAM is like STANDBY plus slow clock mode, so |
| @@ -192,7 +195,9 @@ static int at91_pm_enter(suspend_state_t state) · 33 unmodified lines | |||
| 192 | error: | 195 | error: |
| 193 | target_state = PM_SUSPEND_ON; | 196 | target_state = PM_SUSPEND_ON; |
| 194 | 197 | ||
| 198 | #ifdef CONFIG_PINCTRL_AT91 | ||
| 195 | at91_pinctrl_gpio_resume(); | 199 | at91_pinctrl_gpio_resume(); |
| 200 | #endif | ||
| 196 | return 0; | 201 | return 0; |
| 197 | } | 202 | } |
| 198 | 203 | ||
| @@ -748,8 +748,12 @@ static void exynos5_powerdown_conf(enum sys_powerdown mode) · 747 unmodified lines | |||
| 748 | void exynos_sys_powerdown_conf(enum sys_powerdown mode) | 748 | void exynos_sys_powerdown_conf(enum sys_powerdown mode) |
| 749 | { | 749 | { |
| 750 | unsigned int i; | 750 | unsigned int i; |
| 751 | const struct exynos_pmu_data *pmu_data; | ||
| 752 | |||
| 753 | if (!pmu_context) | ||
| 754 | return; | ||
| 751 | 755 | ||
| 752 | const struct exynos_pmu_data *pmu_data = pmu_context->pmu_data; | 756 | pmu_data = pmu_context->pmu_data; |
| 753 | 757 | ||
| 754 | if (pmu_data->powerdown_conf) | 758 | if (pmu_data->powerdown_conf) |
| 755 | pmu_data->powerdown_conf(mode); | 759 | pmu_data->powerdown_conf(mode); |
| @@ -143,7 +143,7 @@ static inline void __indirect_writesl(volatile void __iomem *bus_addr, · 142 unmodified lines | |||
| 143 | writel(*vaddr++, bus_addr); | 143 | writel(*vaddr++, bus_addr); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | static inline unsigned char __indirect_readb(const volatile void __iomem *p) | 146 | static inline u8 __indirect_readb(const volatile void __iomem *p) |
| 147 | { | 147 | { |
| 148 | u32 addr = (u32)p; | 148 | u32 addr = (u32)p; |
| 149 | u32 n, byte_enables, data; | 149 | u32 n, byte_enables, data; |
| @@ -166,7 +166,7 @@ static inline void __indirect_readsb(const volatile void __iomem *bus_addr, · 16 unmodified lines | |||
| 166 | *vaddr++ = readb(bus_addr); | 166 | *vaddr++ = readb(bus_addr); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | static inline unsigned short __indirect_readw(const volatile void __iomem *p) | 169 | static inline u16 __indirect_readw(const volatile void __iomem *p) |
| 170 | { | 170 | { |
| 171 | u32 addr = (u32)p; | 171 | u32 addr = (u32)p; |
| 172 | u32 n, byte_enables, data; | 172 | u32 n, byte_enables, data; |
| @@ -189,7 +189,7 @@ static inline void __indirect_readsw(const volatile void __iomem *bus_addr, · 16 unmodified lines | |||
| 189 | *vaddr++ = readw(bus_addr); | 189 | *vaddr++ = readw(bus_addr); |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | static inline unsigned long __indirect_readl(const volatile void __iomem *p) | 192 | static inline u32 __indirect_readl(const volatile void __iomem *p) |
| 193 | { | 193 | { |
| 194 | u32 addr = (__force u32)p; | 194 | u32 addr = (__force u32)p; |
| 195 | u32 data; | 195 | u32 data; |
| @@ -350,7 +350,7 @@ static inline void insl(u32 io_addr, void *p, u32 count) · 154 unmodified lines | |||
| 350 | ((unsigned long)p <= (PIO_MASK + PIO_OFFSET))) | 350 | ((unsigned long)p <= (PIO_MASK + PIO_OFFSET))) |
| 351 | 351 | ||
| 352 | #define ioread8(p) ioread8(p) | 352 | #define ioread8(p) ioread8(p) |
| 353 | static inline unsigned int ioread8(const void __iomem *addr) | 353 | static inline u8 ioread8(const void __iomem *addr) |
| 354 | { | 354 | { |
| 355 | unsigned long port = (unsigned long __force)addr; | 355 | unsigned long port = (unsigned long __force)addr; |
| 356 | if (__is_io_address(port)) | 356 | if (__is_io_address(port)) |
| @@ -378,7 +378,7 @@ static inline void ioread8_rep(const void __iomem *addr, void *vaddr, u32 count) · 21 unmodified lines | |||
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | #define ioread16(p) ioread16(p) | 380 | #define ioread16(p) ioread16(p) |
| 381 | static inline unsigned int ioread16(const void __iomem *addr) | 381 | static inline u16 ioread16(const void __iomem *addr) |
| 382 | { | 382 | { |
| 383 | unsigned long port = (unsigned long __force)addr; | 383 | unsigned long port = (unsigned long __force)addr; |
| 384 | if (__is_io_address(port)) | 384 | if (__is_io_address(port)) |
| @@ -407,7 +407,7 @@ static inline void ioread16_rep(const void __iomem *addr, void *vaddr, · 22 unmodified lines | |||
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | #define ioread32(p) ioread32(p) | 409 | #define ioread32(p) ioread32(p) |
| 410 | static inline unsigned int ioread32(const void __iomem *addr) | 410 | static inline u32 ioread32(const void __iomem *addr) |
| 411 | { | 411 | { |
| 412 | unsigned long port = (unsigned long __force)addr; | 412 | unsigned long port = (unsigned long __force)addr; |
| 413 | if (__is_io_address(port)) | 413 | if (__is_io_address(port)) |
| @@ -121,6 +121,7 @@ config ARCH_OMAP2PLUS_TYPICAL · 120 unmodified lines | |||
| 121 | select NEON if CPU_V7 | 121 | select NEON if CPU_V7 |
| 122 | select PM | 122 | select PM |
| 123 | select REGULATOR | 123 | select REGULATOR |
| 124 | select REGULATOR_FIXED_VOLTAGE | ||
| 124 | select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4 | 125 | select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4 |
| 125 | select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4 | 126 | select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4 |
| 126 | select VFP | 127 | select VFP |
| @@ -201,7 +202,6 @@ config MACH_OMAP3_PANDORA · 74 unmodified lines | |||
| 201 | depends on ARCH_OMAP3 | 202 | depends on ARCH_OMAP3 |
| 202 | default y | 203 | default y |
| 203 | select OMAP_PACKAGE_CBB | 204 | select OMAP_PACKAGE_CBB |
| 204 | select REGULATOR_FIXED_VOLTAGE if REGULATOR | ||
| 205 | 205 | ||
| 206 | config MACH_NOKIA_N810 | 206 | config MACH_NOKIA_N810 |
| 207 | bool | 207 | bool |
| @@ -889,6 +889,7 @@ static void __init e680_init(void) · 888 unmodified lines | |||
| 889 | 889 | ||
| 890 | pxa_set_keypad_info(&e680_keypad_platform_data); | 890 | pxa_set_keypad_info(&e680_keypad_platform_data); |
| 891 | 891 | ||
| 892 | pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); | ||
| 892 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); | 893 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
| 893 | platform_add_devices(ARRAY_AND_SIZE(e680_devices)); | 894 | platform_add_devices(ARRAY_AND_SIZE(e680_devices)); |
| 894 | } | 895 | } |
| @@ -956,6 +957,7 @@ static void __init a1200_init(void) · 61 unmodified lines | |||
| 956 | 957 | ||
| 957 | pxa_set_keypad_info(&a1200_keypad_platform_data); | 958 | pxa_set_keypad_info(&a1200_keypad_platform_data); |
| 958 | 959 | ||
| 960 | pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); | ||
| 959 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); | 961 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
| 960 | platform_add_devices(ARRAY_AND_SIZE(a1200_devices)); | 962 | platform_add_devices(ARRAY_AND_SIZE(a1200_devices)); |
| 961 | } | 963 | } |
| @@ -1148,6 +1150,7 @@ static void __init a910_init(void) · 186 unmodified lines | |||
| 1148 | platform_device_register(&a910_camera); | 1150 | platform_device_register(&a910_camera); |
| 1149 | } | 1151 | } |
| 1150 | 1152 | ||
| 1153 | pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); | ||
| 1151 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); | 1154 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
| 1152 | platform_add_devices(ARRAY_AND_SIZE(a910_devices)); | 1155 | platform_add_devices(ARRAY_AND_SIZE(a910_devices)); |
| 1153 | } | 1156 | } |
| @@ -1215,6 +1218,7 @@ static void __init e6_init(void) · 61 unmodified lines | |||
| 1215 | 1218 | ||
| 1216 | pxa_set_keypad_info(&e6_keypad_platform_data); | 1219 | pxa_set_keypad_info(&e6_keypad_platform_data); |
| 1217 | 1220 | ||
| 1221 | pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); | ||
| 1218 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); | 1222 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
| 1219 | platform_add_devices(ARRAY_AND_SIZE(e6_devices)); | 1223 | platform_add_devices(ARRAY_AND_SIZE(e6_devices)); |
| 1220 | } | 1224 | } |
| @@ -1256,6 +1260,7 @@ static void __init e2_init(void) · 35 unmodified lines | |||
| 1256 | 1260 | ||
| 1257 | pxa_set_keypad_info(&e2_keypad_platform_data); | 1261 | pxa_set_keypad_info(&e2_keypad_platform_data); |
| 1258 | 1262 | ||
| 1263 | pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); | ||
| 1259 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); | 1264 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
| 1260 | platform_add_devices(ARRAY_AND_SIZE(e2_devices)); | 1265 | platform_add_devices(ARRAY_AND_SIZE(e2_devices)); |
| 1261 | } | 1266 | } |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | #include <plat/cpu.h> | 20 | #include <plat/cpu.h> |
| 21 | #include <plat/cpu-freq-core.h> | 21 | #include <plat/cpu-freq-core.h> |
| 22 | 22 | ||
| 23 | static struct cpufreq_frequency_table s3c2440_plls_12[] __initdata = { | 23 | static struct cpufreq_frequency_table s3c2440_plls_12[] = { |
| 24 | { .frequency = 75000000, .driver_data = PLLVAL(0x75, 3, 3), }, /* FVco 600.000000 */ | 24 | { .frequency = 75000000, .driver_data = PLLVAL(0x75, 3, 3), }, /* FVco 600.000000 */ |
| 25 | { .frequency = 80000000, .driver_data = PLLVAL(0x98, 4, 3), }, /* FVco 640.000000 */ | 25 | { .frequency = 80000000, .driver_data = PLLVAL(0x98, 4, 3), }, /* FVco 640.000000 */ |
| 26 | { .frequency = 90000000, .driver_data = PLLVAL(0x70, 2, 3), }, /* FVco 720.000000 */ | 26 | { .frequency = 90000000, .driver_data = PLLVAL(0x70, 2, 3), }, /* FVco 720.000000 */ |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | #include <plat/cpu.h> | 20 | #include <plat/cpu.h> |
| 21 | #include <plat/cpu-freq-core.h> | 21 | #include <plat/cpu-freq-core.h> |
| 22 | 22 | ||
| 23 | static struct cpufreq_frequency_table s3c2440_plls_169344[] __initdata = { | 23 | static struct cpufreq_frequency_table s3c2440_plls_169344[] = { |
| 24 | { .frequency = 78019200, .driver_data = PLLVAL(121, 5, 3), }, /* FVco 624.153600 */ | 24 | { .frequency = 78019200, .driver_data = PLLVAL(121, 5, 3), }, /* FVco 624.153600 */ |
| 25 | { .frequency = 84067200, .driver_data = PLLVAL(131, 5, 3), }, /* FVco 672.537600 */ | 25 | { .frequency = 84067200, .driver_data = PLLVAL(131, 5, 3), }, /* FVco 672.537600 */ |
| 26 | { .frequency = 90115200, .driver_data = PLLVAL(141, 5, 3), }, /* FVco 720.921600 */ | 26 | { .frequency = 90115200, .driver_data = PLLVAL(141, 5, 3), }, /* FVco 720.921600 */ |
| @@ -165,13 +165,28 @@ static void flush_context(unsigned int cpu) · 164 unmodified lines | |||
| 165 | __flush_icache_all(); | 165 | __flush_icache_all(); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | static int is_reserved_asid(u64 asid) | 168 | static bool check_update_reserved_asid(u64 asid, u64 newasid) |
| 169 | { | 169 | { |
| 170 | int cpu; | 170 | int cpu; |
| 171 | for_each_possible_cpu(cpu) | 171 | bool hit = false; |
| 172 | if (per_cpu(reserved_asids, cpu) == asid) | 172 | |
| 173 | return 1; | 173 | /* |
| 174 | return 0; | 174 | * Iterate over the set of reserved ASIDs looking for a match. |
| 175 | * If we find one, then we can update our mm to use newasid | ||
| 176 | * (i.e. the same ASID in the current generation) but we can't | ||
| 177 | * exit the loop early, since we need to ensure that all copies | ||
| 178 | * of the old ASID are updated to reflect the mm. Failure to do | ||
| 179 | * so could result in us missing the reserved ASID in a future | ||
| 180 | * generation. | ||
| 181 | */ | ||
| 182 | for_each_possible_cpu(cpu) { | ||
| 183 | if (per_cpu(reserved_asids, cpu) == asid) { | ||
| 184 | hit = true; | ||
| 185 | per_cpu(reserved_asids, cpu) = newasid; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 189 | return hit; | ||
| 175 | } | 190 | } |
| 176 | 191 | ||
| 177 | static u64 new_context(struct mm_struct *mm, unsigned int cpu) | 192 | static u64 new_context(struct mm_struct *mm, unsigned int cpu) |
| @@ -181,12 +196,14 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) · 3 unmodified lines | |||
| 181 | u64 generation = atomic64_read(&asid_generation); | 196 | u64 generation = atomic64_read(&asid_generation); |
| 182 | 197 | ||
| 183 | if (asid != 0) { | 198 | if (asid != 0) { |
| 199 | u64 newasid = generation | (asid & ~ASID_MASK); | ||
| 200 | |||
| 184 | /* | 201 | /* |
| 185 | * If our current ASID was active during a rollover, we | 202 | * If our current ASID was active during a rollover, we |
| 186 | * can continue to use it and this was just a false alarm. | 203 | * can continue to use it and this was just a false alarm. |
| 187 | */ | 204 | */ |
| 188 | if (is_reserved_asid(asid)) | 205 | if (check_update_reserved_asid(asid, newasid)) |
| 189 | return generation | (asid & ~ASID_MASK); | 206 | return newasid; |
| 190 | 207 | ||
| 191 | /* | 208 | /* |
| 192 | * We had a valid ASID in a previous life, so try to re-use | 209 | * We had a valid ASID in a previous life, so try to re-use |
| @@ -194,7 +211,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) · 1 unmodified line | |||
| 194 | */ | 211 | */ |
| 195 | asid &= ~ASID_MASK; | 212 | asid &= ~ASID_MASK; |
| 196 | if (!__test_and_set_bit(asid, asid_map)) | 213 | if (!__test_and_set_bit(asid, asid_map)) |
| 197 | goto bump_gen; | 214 | return newasid; |
| 198 | } | 215 | } |
| 199 | 216 | ||
| 200 | /* | 217 | /* |
| @@ -216,11 +233,8 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) · 15 unmodified lines | |||
| 216 | 233 | ||
| 217 | __set_bit(asid, asid_map); | 234 | __set_bit(asid, asid_map); |
| 218 | cur_idx = asid; | 235 | cur_idx = asid; |
| 219 | |||
| 220 | bump_gen: | ||
| 221 | asid |= generation; | ||
| 222 | cpumask_clear(mm_cpumask(mm)); | 236 | cpumask_clear(mm_cpumask(mm)); |
| 223 | return asid; | 237 | return asid | generation; |
| 224 | } | 238 | } |
| 225 | 239 | ||
| 226 | void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) | 240 | void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) |
| @@ -1521,7 +1521,7 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg, · 1520 unmodified lines | |||
| 1521 | return -ENOMEM; | 1521 | return -ENOMEM; |
| 1522 | 1522 | ||
| 1523 | for (count = 0, s = sg; count < (size >> PAGE_SHIFT); s = sg_next(s)) { | 1523 | for (count = 0, s = sg; count < (size >> PAGE_SHIFT); s = sg_next(s)) { |
| 1524 | phys_addr_t phys = sg_phys(s) & PAGE_MASK; | 1524 | phys_addr_t phys = page_to_phys(sg_page(s)); |
| 1525 | unsigned int len = PAGE_ALIGN(s->offset + s->length); | 1525 | unsigned int len = PAGE_ALIGN(s->offset + s->length); |
| 1526 | 1526 | ||
| 1527 | if (!is_coherent && | 1527 | if (!is_coherent && |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | #include <linux/memblock.h> | 22 | #include <linux/memblock.h> |
| 23 | #include <linux/dma-contiguous.h> | 23 | #include <linux/dma-contiguous.h> |
| 24 | #include <linux/sizes.h> | 24 | #include <linux/sizes.h> |
| 25 | #include <linux/stop_machine.h> | ||
| 25 | 26 | ||
| 26 | #include <asm/cp15.h> | 27 | #include <asm/cp15.h> |
| 27 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
| @@ -627,12 +628,10 @@ static struct section_perm ro_perms[] = { · 599 unmodified lines | |||
| 627 | * safe to be called with preemption disabled, as under stop_machine(). | 628 | * safe to be called with preemption disabled, as under stop_machine(). |
| 628 | */ | 629 | */ |
| 629 | static inline void section_update(unsigned long addr, pmdval_t mask, | 630 | static inline void section_update(unsigned long addr, pmdval_t mask, |
| 630 | pmdval_t prot) | 631 | pmdval_t prot, struct mm_struct *mm) |
| 631 | { | 632 | { |
| 632 | struct mm_struct *mm; | ||
| 633 | pmd_t *pmd; | 633 | pmd_t *pmd; |
| 634 | 634 | ||
| 635 | mm = current->active_mm; | ||
| 636 | pmd = pmd_offset(pud_offset(pgd_offset(mm, addr), addr), addr); | 635 | pmd = pmd_offset(pud_offset(pgd_offset(mm, addr), addr), addr); |
| 637 | 636 | ||
| 638 | #ifdef CONFIG_ARM_LPAE | 637 | #ifdef CONFIG_ARM_LPAE |
| @@ -656,49 +655,82 @@ static inline bool arch_has_strict_perms(void) · 17 unmodified lines | |||
| 656 | return !!(get_cr() & CR_XP); | 655 | return !!(get_cr() & CR_XP); |
| 657 | } | 656 | } |
| 658 | 657 | ||
| 659 | #define set_section_perms(perms, field) { \ | 658 | void set_section_perms(struct section_perm *perms, int n, bool set, |
| 660 | size_t i; \ | 659 | struct mm_struct *mm) |
| 661 | unsigned long addr; \ | 660 | { |
| 662 | \ | 661 | size_t i; |
| 663 | if (!arch_has_strict_perms()) \ | 662 | unsigned long addr; |
| 664 | return; \ | 663 | |
| 665 | \ | 664 | if (!arch_has_strict_perms()) |
| 666 | for (i = 0; i < ARRAY_SIZE(perms); i++) { \ | 665 | return; |
| 667 | if (!IS_ALIGNED(perms[i].start, SECTION_SIZE) || \ | 666 | |
| 668 | !IS_ALIGNED(perms[i].end, SECTION_SIZE)) { \ | 667 | for (i = 0; i < n; i++) { |
| 669 | pr_err("BUG: section %lx-%lx not aligned to %lx\n", \ | 668 | if (!IS_ALIGNED(perms[i].start, SECTION_SIZE) || |
| 670 | perms[i].start, perms[i].end, \ | 669 | !IS_ALIGNED(perms[i].end, SECTION_SIZE)) { |
| 671 | SECTION_SIZE); \ | 670 | pr_err("BUG: section %lx-%lx not aligned to %lx\n", |
| 672 | continue; \ | 671 | perms[i].start, perms[i].end, |
| 673 | } \ | 672 | SECTION_SIZE); |
| 674 | \ | 673 | continue; |
| 675 | for (addr = perms[i].start; \ | 674 | } |
| 676 | addr < perms[i].end; \ | 675 | |
| 677 | addr += SECTION_SIZE) \ | 676 | for (addr = perms[i].start; |
| 678 | section_update(addr, perms[i].mask, \ | 677 | addr < perms[i].end; |
| 679 | perms[i].field); \ | 678 | addr += SECTION_SIZE) |
| 680 | } \ | 679 | section_update(addr, perms[i].mask, |
| 680 | set ? perms[i].prot : perms[i].clear, mm); | ||
| 681 | } | ||
| 682 | |||
| 681 | } | 683 | } |
| 682 | 684 | ||
| 683 | static inline void fix_kernmem_perms(void) | 685 | static void update_sections_early(struct section_perm perms[], int n) |
| 684 | { | 686 | { |
| 685 | set_section_perms(nx_perms, prot); | 687 | struct task_struct *t, *s; |
| 688 | |||
| 689 | read_lock(&tasklist_lock); | ||
| 690 | for_each_process(t) { | ||
| 691 | if (t->flags & PF_KTHREAD) | ||
| 692 | continue; | ||
| 693 | for_each_thread(t, s) | ||
| 694 | set_section_perms(perms, n, true, s->mm); | ||
| 695 | } | ||
| 696 | read_unlock(&tasklist_lock); | ||
| 697 | set_section_perms(perms, n, true, current->active_mm); | ||
| 698 | set_section_perms(perms, n, true, &init_mm); | ||
| 699 | } | ||
| 700 | |||
| 701 | int __fix_kernmem_perms(void *unused) | ||
| 702 | { | ||
| 703 | update_sections_early(nx_perms, ARRAY_SIZE(nx_perms)); | ||
| 704 | return 0; | ||
| 705 | } | ||
| 706 | |||
| 707 | void fix_kernmem_perms(void) | ||
| 708 | { | ||
| 709 | stop_machine(__fix_kernmem_perms, NULL, NULL); | ||
| 686 | } | 710 | } |
| 687 | 711 | ||
| 688 | #ifdef CONFIG_DEBUG_RODATA | 712 | #ifdef CONFIG_DEBUG_RODATA |
| 713 | int __mark_rodata_ro(void *unused) | ||
| 714 | { | ||
| 715 | update_sections_early(ro_perms, ARRAY_SIZE(ro_perms)); | ||
| 716 | return 0; | ||
| 717 | } | ||
| 718 | |||
| 689 | void mark_rodata_ro(void) | 719 | void mark_rodata_ro(void) |
| 690 | { | 720 | { |
| 691 | set_section_perms(ro_perms, prot); | 721 | stop_machine(__mark_rodata_ro, NULL, NULL); |
| 692 | } | 722 | } |
| 693 | 723 | ||
| 694 | void set_kernel_text_rw(void) | 724 | void set_kernel_text_rw(void) |
| 695 | { | 725 | { |
| 696 | set_section_perms(ro_perms, clear); | 726 | set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), false, |
| 727 | current->active_mm); | ||
| 697 | } | 728 | } |
| 698 | 729 | ||
| 699 | void set_kernel_text_ro(void) | 730 | void set_kernel_text_ro(void) |
| 700 | { | 731 | { |
| 701 | set_section_perms(ro_perms, prot); | 732 | set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true, |
| 733 | current->active_mm); | ||
| 702 | } | 734 | } |
| 703 | #endif /* CONFIG_DEBUG_RODATA */ | 735 | #endif /* CONFIG_DEBUG_RODATA */ |
| 704 | 736 | ||
| @@ -95,7 +95,7 @@ ENDPROC(cpu_v7_dcache_clean_area) · 94 unmodified lines | |||
| 95 | .equ cpu_v7_suspend_size, 4 * 9 | 95 | .equ cpu_v7_suspend_size, 4 * 9 |
| 96 | #ifdef CONFIG_ARM_CPU_SUSPEND | 96 | #ifdef CONFIG_ARM_CPU_SUSPEND |
| 97 | ENTRY(cpu_v7_do_suspend) | 97 | ENTRY(cpu_v7_do_suspend) |
| 98 | stmfd sp!, {r4 - r10, lr} | 98 | stmfd sp!, {r4 - r11, lr} |
| 99 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID | 99 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID |
| 100 | mrc p15, 0, r5, c13, c0, 3 @ User r/o thread ID | 100 | mrc p15, 0, r5, c13, c0, 3 @ User r/o thread ID |
| 101 | stmia r0!, {r4 - r5} | 101 | stmia r0!, {r4 - r5} |
| @@ -112,7 +112,7 @@ ENTRY(cpu_v7_do_suspend) · 10 unmodified lines | |||
| 112 | mrc p15, 0, r9, c1, c0, 1 @ Auxiliary control register | 112 | mrc p15, 0, r9, c1, c0, 1 @ Auxiliary control register |
| 113 | mrc p15, 0, r10, c1, c0, 2 @ Co-processor access control | 113 | mrc p15, 0, r10, c1, c0, 2 @ Co-processor access control |
| 114 | stmia r0, {r5 - r11} | 114 | stmia r0, {r5 - r11} |
| 115 | ldmfd sp!, {r4 - r10, pc} | 115 | ldmfd sp!, {r4 - r11, pc} |
| 116 | ENDPROC(cpu_v7_do_suspend) | 116 | ENDPROC(cpu_v7_do_suspend) |
| 117 | 117 | ||
| 118 | ENTRY(cpu_v7_do_resume) | 118 | ENTRY(cpu_v7_do_resume) |
| @@ -269,6 +269,7 @@ · 268 unmodified lines | |||
| 269 | clock-frequency = <0>; /* Updated by bootloader */ | 269 | clock-frequency = <0>; /* Updated by bootloader */ |
| 270 | voltage-ranges = <1800 1800 3300 3300>; | 270 | voltage-ranges = <1800 1800 3300 3300>; |
| 271 | sdhci,auto-cmd12; | 271 | sdhci,auto-cmd12; |
| 272 | little-endian; | ||
| 272 | bus-width = <4>; | 273 | bus-width = <4>; |
| 273 | }; | 274 | }; |
| 274 | 275 | ||
| @@ -277,6 +278,7 @@ · 2 unmodified lines | |||
| 277 | reg = <0x0 0x2300000 0x0 0x10000>; | 278 | reg = <0x0 0x2300000 0x0 0x10000>; |
| 278 | interrupts = <0 36 0x4>; /* Level high type */ | 279 | interrupts = <0 36 0x4>; /* Level high type */ |
| 279 | gpio-controller; | 280 | gpio-controller; |
| 281 | little-endian; | ||
| 280 | #gpio-cells = <2>; | 282 | #gpio-cells = <2>; |
| 281 | interrupt-controller; | 283 | interrupt-controller; |
| 282 | #interrupt-cells = <2>; | 284 | #interrupt-cells = <2>; |
| @@ -287,6 +289,7 @@ · 4 unmodified lines | |||
| 287 | reg = <0x0 0x2310000 0x0 0x10000>; | 289 | reg = <0x0 0x2310000 0x0 0x10000>; |
| 288 | interrupts = <0 36 0x4>; /* Level high type */ | 290 | interrupts = <0 36 0x4>; /* Level high type */ |
| 289 | gpio-controller; | 291 | gpio-controller; |
| 292 | little-endian; | ||
| 290 | #gpio-cells = <2>; | 293 | #gpio-cells = <2>; |
| 291 | interrupt-controller; | 294 | interrupt-controller; |
| 292 | #interrupt-cells = <2>; | 295 | #interrupt-cells = <2>; |
| @@ -297,6 +300,7 @@ · 4 unmodified lines | |||
| 297 | reg = <0x0 0x2320000 0x0 0x10000>; | 300 | reg = <0x0 0x2320000 0x0 0x10000>; |
| 298 | interrupts = <0 37 0x4>; /* Level high type */ | 301 | interrupts = <0 37 0x4>; /* Level high type */ |
| 299 | gpio-controller; | 302 | gpio-controller; |
| 303 | little-endian; | ||
| 300 | #gpio-cells = <2>; | 304 | #gpio-cells = <2>; |
| 301 | interrupt-controller; | 305 | interrupt-controller; |
| 302 | #interrupt-cells = <2>; | 306 | #interrupt-cells = <2>; |
| @@ -307,6 +311,7 @@ · 4 unmodified lines | |||
| 307 | reg = <0x0 0x2330000 0x0 0x10000>; | 311 | reg = <0x0 0x2330000 0x0 0x10000>; |
| 308 | interrupts = <0 37 0x4>; /* Level high type */ | 312 | interrupts = <0 37 0x4>; /* Level high type */ |
| 309 | gpio-controller; | 313 | gpio-controller; |
| 314 | little-endian; | ||
| 310 | #gpio-cells = <2>; | 315 | #gpio-cells = <2>; |
| 311 | interrupt-controller; | 316 | interrupt-controller; |
| 312 | #interrupt-cells = <2>; | 317 | #interrupt-cells = <2>; |
| @@ -77,6 +77,7 @@ · 76 unmodified lines | |||
| 77 | #ifndef __ASSEMBLY__ | 77 | #ifndef __ASSEMBLY__ |
| 78 | 78 | ||
| 79 | #include <linux/stringify.h> | 79 | #include <linux/stringify.h> |
| 80 | #include <asm/barrier.h> | ||
| 80 | 81 | ||
| 81 | /* | 82 | /* |
| 82 | * Low-level accessors | 83 | * Low-level accessors |
| @@ -276,10 +276,14 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, · 275 unmodified lines | |||
| 276 | * hardware updates of the pte (ptep_set_access_flags safely changes | 276 | * hardware updates of the pte (ptep_set_access_flags safely changes |
| 277 | * valid ptes without going through an invalid entry). | 277 | * valid ptes without going through an invalid entry). |
| 278 | */ | 278 | */ |
| 279 | if (IS_ENABLED(CONFIG_DEBUG_VM) && IS_ENABLED(CONFIG_ARM64_HW_AFDBM) && | 279 | if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM) && |
| 280 | pte_valid(*ptep)) { | 280 | pte_valid(*ptep) && pte_valid(pte)) { |
| 281 | BUG_ON(!pte_young(pte)); | 281 | VM_WARN_ONCE(!pte_young(pte), |
| 282 | BUG_ON(pte_write(*ptep) && !pte_dirty(pte)); | 282 | "%s: racy access flag clearing: 0x%016llx -> 0x%016llx", |
| 283 | __func__, pte_val(*ptep), pte_val(pte)); | ||
| 284 | VM_WARN_ONCE(pte_write(*ptep) && !pte_dirty(pte), | ||
| 285 | "%s: racy dirty state clearing: 0x%016llx -> 0x%016llx", | ||
| 286 | __func__, pte_val(*ptep), pte_val(pte)); | ||
| 283 | } | 287 | } |
| 284 | 288 | ||
| 285 | set_pte(ptep, pte); | 289 | set_pte(ptep, pte); |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <asm-generic/vmlinux.lds.h> | 7 | #include <asm-generic/vmlinux.lds.h> |
| 8 | #include <asm/cache.h> | ||
| 8 | #include <asm/kernel-pgtable.h> | 9 | #include <asm/kernel-pgtable.h> |
| 9 | #include <asm/thread_info.h> | 10 | #include <asm/thread_info.h> |
| 10 | #include <asm/memory.h> | 11 | #include <asm/memory.h> |
| @@ -140,7 +141,7 @@ SECTIONS · 129 unmodified lines | |||
| 140 | ARM_EXIT_KEEP(EXIT_DATA) | 141 | ARM_EXIT_KEEP(EXIT_DATA) |
| 141 | } | 142 | } |
| 142 | 143 | ||
| 143 | PERCPU_SECTION(64) | 144 | PERCPU_SECTION(L1_CACHE_BYTES) |
| 144 | 145 | ||
| 145 | . = ALIGN(PAGE_SIZE); | 146 | . = ALIGN(PAGE_SIZE); |
| 146 | __init_end = .; | 147 | __init_end = .; |
| @@ -158,7 +159,7 @@ SECTIONS · 11 unmodified lines | |||
| 158 | . = ALIGN(PAGE_SIZE); | 159 | . = ALIGN(PAGE_SIZE); |
| 159 | _data = .; | 160 | _data = .; |
| 160 | _sdata = .; | 161 | _sdata = .; |
| 161 | RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE) | 162 | RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) |
| 162 | PECOFF_EDATA_PADDING | 163 | PECOFF_EDATA_PADDING |
| 163 | _edata = .; | 164 | _edata = .; |
| 164 | 165 | ||
| @@ -14,7 +14,7 @@ · 13 unmodified lines | |||
| 14 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 14 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 15 | * Copyright (C) 2009 Jaswinder Singh Rajput | 15 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 16 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 16 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 17 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 17 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 18 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 18 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 19 | * | 19 | * |
| 20 | * ppc: | 20 | * ppc: |
| @@ -11,7 +11,7 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | #define NR_syscalls 322 /* length of syscall table */ | 14 | #define NR_syscalls 323 /* length of syscall table */ |
| 15 | 15 | ||
| 16 | /* | 16 | /* |
| 17 | * The following defines stop scripts/checksyscalls.sh from complaining about | 17 | * The following defines stop scripts/checksyscalls.sh from complaining about |
| @@ -335,5 +335,6 @@ · 334 unmodified lines | |||
| 335 | #define __NR_userfaultfd 1343 | 335 | #define __NR_userfaultfd 1343 |
| 336 | #define __NR_membarrier 1344 | 336 | #define __NR_membarrier 1344 |
| 337 | #define __NR_kcmp 1345 | 337 | #define __NR_kcmp 1345 |
| 338 | #define __NR_mlock2 1346 | ||
| 338 | 339 | ||
| 339 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ | 340 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ |
| @@ -1771,5 +1771,6 @@ sys_call_table: · 1770 unmodified lines | |||
| 1771 | data8 sys_userfaultfd | 1771 | data8 sys_userfaultfd |
| 1772 | data8 sys_membarrier | 1772 | data8 sys_membarrier |
| 1773 | data8 sys_kcmp // 1345 | 1773 | data8 sys_kcmp // 1345 |
| 1774 | data8 sys_mlock2 | ||
| 1774 | 1775 | ||
| 1775 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls | 1776 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls |
| @@ -61,7 +61,8 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, · 60 unmodified lines | |||
| 61 | /* FIXME this part of code is untested */ | 61 | /* FIXME this part of code is untested */ |
| 62 | for_each_sg(sgl, sg, nents, i) { | 62 | for_each_sg(sgl, sg, nents, i) { |
| 63 | sg->dma_address = sg_phys(sg); | 63 | sg->dma_address = sg_phys(sg); |
| 64 | __dma_sync(sg_phys(sg), sg->length, direction); | 64 | __dma_sync(page_to_phys(sg_page(sg)) + sg->offset, |
| 65 | sg->length, direction); | ||
| 65 | } | 66 | } |
| 66 | 67 | ||
| 67 | return nents; | 68 | return nents; |
| @@ -145,7 +145,7 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size, · 144 unmodified lines | |||
| 145 | 145 | ||
| 146 | gfp = massage_gfp_flags(dev, gfp); | 146 | gfp = massage_gfp_flags(dev, gfp); |
| 147 | 147 | ||
| 148 | if (IS_ENABLED(CONFIG_DMA_CMA) && !(gfp & GFP_ATOMIC)) | 148 | if (IS_ENABLED(CONFIG_DMA_CMA) && gfpflags_allow_blocking(gfp)) |
| 149 | page = dma_alloc_from_contiguous(dev, | 149 | page = dma_alloc_from_contiguous(dev, |
| 150 | count, get_order(size)); | 150 | count, get_order(size)); |
| 151 | if (!page) | 151 | if (!page) |
| @@ -372,7 +372,8 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; } · 371 unmodified lines | |||
| 372 | */ | 372 | */ |
| 373 | #ifdef CONFIG_HUGETLB_PAGE | 373 | #ifdef CONFIG_HUGETLB_PAGE |
| 374 | #define pte_huge(pte) (pte_val(pte) & _PAGE_HUGE) | 374 | #define pte_huge(pte) (pte_val(pte) & _PAGE_HUGE) |
| 375 | #define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_HUGE)) | 375 | #define pte_mkhuge(pte) (__pte(pte_val(pte) | \ |
| 376 | (parisc_requires_coherency() ? 0 : _PAGE_HUGE))) | ||
| 376 | #else | 377 | #else |
| 377 | #define pte_huge(pte) (0) | 378 | #define pte_huge(pte) (0) |
| 378 | #define pte_mkhuge(pte) (pte) | 379 | #define pte_mkhuge(pte) (pte) |
| @@ -360,8 +360,9 @@ · 359 unmodified lines | |||
| 360 | #define __NR_execveat (__NR_Linux + 342) | 360 | #define __NR_execveat (__NR_Linux + 342) |
| 361 | #define __NR_membarrier (__NR_Linux + 343) | 361 | #define __NR_membarrier (__NR_Linux + 343) |
| 362 | #define __NR_userfaultfd (__NR_Linux + 344) | 362 | #define __NR_userfaultfd (__NR_Linux + 344) |
| 363 | #define __NR_mlock2 (__NR_Linux + 345) | ||
| 363 | 364 | ||
| 364 | #define __NR_Linux_syscalls (__NR_userfaultfd + 1) | 365 | #define __NR_Linux_syscalls (__NR_mlock2 + 1) |
| 365 | 366 | ||
| 366 | 367 | ||
| 367 | #define __IGNORE_select /* newselect */ | 368 | #define __IGNORE_select /* newselect */ |
| @@ -171,24 +171,6 @@ void pcibios_set_master(struct pci_dev *dev) · 170 unmodified lines | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | 173 | ||
| 174 | void __init pcibios_init_bus(struct pci_bus *bus) | ||
| 175 | { | ||
| 176 | struct pci_dev *dev = bus->self; | ||
| 177 | unsigned short bridge_ctl; | ||
| 178 | |||
| 179 | /* We deal only with pci controllers and pci-pci bridges. */ | ||
| 180 | if (!dev || (dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) | ||
| 181 | return; | ||
| 182 | |||
| 183 | /* PCI-PCI bridge - set the cache line and default latency | ||
| 184 | (32) for primary and secondary buses. */ | ||
| 185 | pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, 32); | ||
| 186 | |||
| 187 | pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &bridge_ctl); | ||
| 188 | bridge_ctl |= PCI_BRIDGE_CTL_PARITY | PCI_BRIDGE_CTL_SERR; | ||
| 189 | pci_write_config_word(dev, PCI_BRIDGE_CONTROL, bridge_ctl); | ||
| 190 | } | ||
| 191 | |||
| 192 | /* | 174 | /* |
| 193 | * pcibios align resources() is called every time generic PCI code | 175 | * pcibios align resources() is called every time generic PCI code |
| 194 | * wants to generate a new address. The process of looking for | 176 | * wants to generate a new address. The process of looking for |
| @@ -440,6 +440,7 @@ · 439 unmodified lines | |||
| 440 | ENTRY_COMP(execveat) | 440 | ENTRY_COMP(execveat) |
| 441 | ENTRY_SAME(membarrier) | 441 | ENTRY_SAME(membarrier) |
| 442 | ENTRY_SAME(userfaultfd) | 442 | ENTRY_SAME(userfaultfd) |
| 443 | ENTRY_SAME(mlock2) /* 345 */ | ||
| 443 | 444 | ||
| 444 | 445 | ||
| 445 | .ifne (. - 90b) - (__NR_Linux_syscalls * (91b - 90b)) | 446 | .ifne (. - 90b) - (__NR_Linux_syscalls * (91b - 90b)) |
| @@ -227,23 +227,15 @@ · 226 unmodified lines | |||
| 227 | reg = <0x520 0x20>; | 227 | reg = <0x520 0x20>; |
| 228 | 228 | ||
| 229 | phy0: ethernet-phy@1f { | 229 | phy0: ethernet-phy@1f { |
| 230 | interrupt-parent = <&mpic>; | ||
| 231 | interrupts = <10 1>; | ||
| 232 | reg = <0x1f>; | 230 | reg = <0x1f>; |
| 233 | }; | 231 | }; |
| 234 | phy1: ethernet-phy@0 { | 232 | phy1: ethernet-phy@0 { |
| 235 | interrupt-parent = <&mpic>; | ||
| 236 | interrupts = <10 1>; | ||
| 237 | reg = <0>; | 233 | reg = <0>; |
| 238 | }; | 234 | }; |
| 239 | phy2: ethernet-phy@1 { | 235 | phy2: ethernet-phy@1 { |
| 240 | interrupt-parent = <&mpic>; | ||
| 241 | interrupts = <10 1>; | ||
| 242 | reg = <1>; | 236 | reg = <1>; |
| 243 | }; | 237 | }; |
| 244 | phy3: ethernet-phy@2 { | 238 | phy3: ethernet-phy@2 { |
| 245 | interrupt-parent = <&mpic>; | ||
| 246 | interrupts = <10 1>; | ||
| 247 | reg = <2>; | 239 | reg = <2>; |
| 248 | }; | 240 | }; |
| 249 | tbi0: tbi-phy@11 { | 241 | tbi0: tbi-phy@11 { |
| @@ -370,16 +370,16 @@ COMPAT_SYS(execveat) · 369 unmodified lines | |||
| 370 | PPC64ONLY(switch_endian) | 370 | PPC64ONLY(switch_endian) |
| 371 | SYSCALL_SPU(userfaultfd) | 371 | SYSCALL_SPU(userfaultfd) |
| 372 | SYSCALL_SPU(membarrier) | 372 | SYSCALL_SPU(membarrier) |
| 373 | SYSCALL(semop) | 373 | SYSCALL(ni_syscall) |
| 374 | SYSCALL(semget) | 374 | SYSCALL(ni_syscall) |
| 375 | COMPAT_SYS(semctl) | 375 | SYSCALL(ni_syscall) |
| 376 | COMPAT_SYS(semtimedop) | 376 | SYSCALL(ni_syscall) |
| 377 | COMPAT_SYS(msgsnd) | 377 | SYSCALL(ni_syscall) |
| 378 | COMPAT_SYS(msgrcv) | 378 | SYSCALL(ni_syscall) |
| 379 | SYSCALL(msgget) | 379 | SYSCALL(ni_syscall) |
| 380 | COMPAT_SYS(msgctl) | 380 | SYSCALL(ni_syscall) |
| 381 | COMPAT_SYS(shmat) | 381 | SYSCALL(ni_syscall) |
| 382 | SYSCALL(shmdt) | 382 | SYSCALL(ni_syscall) |
| 383 | SYSCALL(shmget) | 383 | SYSCALL(ni_syscall) |
| 384 | COMPAT_SYS(shmctl) | 384 | SYSCALL(ni_syscall) |
| 385 | SYSCALL(mlock2) | 385 | SYSCALL(mlock2) |
| @@ -388,18 +388,6 @@ · 387 unmodified lines | |||
| 388 | #define __NR_switch_endian 363 | 388 | #define __NR_switch_endian 363 |
| 389 | #define __NR_userfaultfd 364 | 389 | #define __NR_userfaultfd 364 |
| 390 | #define __NR_membarrier 365 | 390 | #define __NR_membarrier 365 |
| 391 | #define __NR_semop 366 | ||
| 392 | #define __NR_semget 367 | ||
| 393 | #define __NR_semctl 368 | ||
| 394 | #define __NR_semtimedop 369 | ||
| 395 | #define __NR_msgsnd 370 | ||
| 396 | #define __NR_msgrcv 371 | ||
| 397 | #define __NR_msgget 372 | ||
| 398 | #define __NR_msgctl 373 | ||
| 399 | #define __NR_shmat 374 | ||
| 400 | #define __NR_shmdt 375 | ||
| 401 | #define __NR_shmget 376 | ||
| 402 | #define __NR_shmctl 377 | ||
| 403 | #define __NR_mlock2 378 | 391 | #define __NR_mlock2 378 |
| 404 | 392 | ||
| 405 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ | 393 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ |
| @@ -590,16 +590,10 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus) · 589 unmodified lines | |||
| 590 | eeh_ops->configure_bridge(pe); | 590 | eeh_ops->configure_bridge(pe); |
| 591 | eeh_pe_restore_bars(pe); | 591 | eeh_pe_restore_bars(pe); |
| 592 | 592 | ||
| 593 | /* | 593 | /* Clear frozen state */ |
| 594 | * If it's PHB PE, the frozen state on all available PEs should have | 594 | rc = eeh_clear_pe_frozen_state(pe, false); |
| 595 | * been cleared by the PHB reset. Otherwise, we unfreeze the PE and its | 595 | if (rc) |
| 596 | * child PEs because they might be in frozen state. | 596 | return rc; |
| 597 | */ | ||
| 598 | if (!(pe->type & EEH_PE_PHB)) { | ||
| 599 | rc = eeh_clear_pe_frozen_state(pe, false); | ||
| 600 | if (rc) | ||
| 601 | return rc; | ||
| 602 | } | ||
| 603 | 597 | ||
| 604 | /* Give the system 5 seconds to finish running the user-space | 598 | /* Give the system 5 seconds to finish running the user-space |
| 605 | * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, | 599 | * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, |
| @@ -224,6 +224,12 @@ static void kvmppc_core_vcpu_put_hv(struct kvm_vcpu *vcpu) · 223 unmodified lines | |||
| 224 | 224 | ||
| 225 | static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr) | 225 | static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr) |
| 226 | { | 226 | { |
| 227 | /* | ||
| 228 | * Check for illegal transactional state bit combination | ||
| 229 | * and if we find it, force the TS field to a safe state. | ||
| 230 | */ | ||
| 231 | if ((msr & MSR_TS_MASK) == MSR_TS_MASK) | ||
| 232 | msr &= ~MSR_TS_MASK; | ||
| 227 | vcpu->arch.shregs.msr = msr; | 233 | vcpu->arch.shregs.msr = msr; |
| 228 | kvmppc_end_cede(vcpu); | 234 | kvmppc_end_cede(vcpu); |
| 229 | } | 235 | } |
| @@ -43,11 +43,34 @@ static unsigned int opal_irq_count; · 42 unmodified lines | |||
| 43 | static unsigned int *opal_irqs; | 43 | static unsigned int *opal_irqs; |
| 44 | 44 | ||
| 45 | static void opal_handle_irq_work(struct irq_work *work); | 45 | static void opal_handle_irq_work(struct irq_work *work); |
| 46 | static __be64 last_outstanding_events; | 46 | static u64 last_outstanding_events; |
| 47 | static struct irq_work opal_event_irq_work = { | 47 | static struct irq_work opal_event_irq_work = { |
| 48 | .func = opal_handle_irq_work, | 48 | .func = opal_handle_irq_work, |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | void opal_handle_events(uint64_t events) | ||
| 52 | { | ||
| 53 | int virq, hwirq = 0; | ||
| 54 | u64 mask = opal_event_irqchip.mask; | ||
| 55 | |||
| 56 | if (!in_irq() && (events & mask)) { | ||
| 57 | last_outstanding_events = events; | ||
| 58 | irq_work_queue(&opal_event_irq_work); | ||
| 59 | return; | ||
| 60 | } | ||
| 61 | |||
| 62 | while (events & mask) { | ||
| 63 | hwirq = fls64(events) - 1; | ||
| 64 | if (BIT_ULL(hwirq) & mask) { | ||
| 65 | virq = irq_find_mapping(opal_event_irqchip.domain, | ||
| 66 | hwirq); | ||
| 67 | if (virq) | ||
| 68 | generic_handle_irq(virq); | ||
| 69 | } | ||
| 70 | events &= ~BIT_ULL(hwirq); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 51 | static void opal_event_mask(struct irq_data *d) | 74 | static void opal_event_mask(struct irq_data *d) |
| 52 | { | 75 | { |
| 53 | clear_bit(d->hwirq, &opal_event_irqchip.mask); | 76 | clear_bit(d->hwirq, &opal_event_irqchip.mask); |
| @@ -55,9 +78,21 @@ static void opal_event_mask(struct irq_data *d) · 1 unmodified line | |||
| 55 | 78 | ||
| 56 | static void opal_event_unmask(struct irq_data *d) | 79 | static void opal_event_unmask(struct irq_data *d) |
| 57 | { | 80 | { |
| 81 | __be64 events; | ||
| 82 | |||
| 58 | set_bit(d->hwirq, &opal_event_irqchip.mask); | 83 | set_bit(d->hwirq, &opal_event_irqchip.mask); |
| 59 | 84 | ||
| 60 | opal_poll_events(&last_outstanding_events); | 85 | opal_poll_events(&events); |
| 86 | last_outstanding_events = be64_to_cpu(events); | ||
| 87 | |||
| 88 | /* | ||
| 89 | * We can't just handle the events now with opal_handle_events(). | ||
| 90 | * If we did we would deadlock when opal_event_unmask() is called from | ||
| 91 | * handle_level_irq() with the irq descriptor lock held, because | ||
| 92 | * calling opal_handle_events() would call generic_handle_irq() and | ||
| 93 | * then handle_level_irq() which would try to take the descriptor lock | ||
| 94 | * again. Instead queue the events for later. | ||
| 95 | */ | ||
| 61 | if (last_outstanding_events & opal_event_irqchip.mask) | 96 | if (last_outstanding_events & opal_event_irqchip.mask) |
| 62 | /* Need to retrigger the interrupt */ | 97 | /* Need to retrigger the interrupt */ |
| 63 | irq_work_queue(&opal_event_irq_work); | 98 | irq_work_queue(&opal_event_irq_work); |
| @@ -96,29 +131,6 @@ static int opal_event_map(struct irq_domain *d, unsigned int irq, · 32 unmodified lines | |||
| 96 | return 0; | 131 | return 0; |
| 97 | } | 132 | } |
| 98 | 133 | ||
| 99 | void opal_handle_events(uint64_t events) | ||
| 100 | { | ||
| 101 | int virq, hwirq = 0; | ||
| 102 | u64 mask = opal_event_irqchip.mask; | ||
| 103 | |||
| 104 | if (!in_irq() && (events & mask)) { | ||
| 105 | last_outstanding_events = events; | ||
| 106 | irq_work_queue(&opal_event_irq_work); | ||
| 107 | return; | ||
| 108 | } | ||
| 109 | |||
| 110 | while (events & mask) { | ||
| 111 | hwirq = fls64(events) - 1; | ||
| 112 | if (BIT_ULL(hwirq) & mask) { | ||
| 113 | virq = irq_find_mapping(opal_event_irqchip.domain, | ||
| 114 | hwirq); | ||
| 115 | if (virq) | ||
| 116 | generic_handle_irq(virq); | ||
| 117 | } | ||
| 118 | events &= ~BIT_ULL(hwirq); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 | static irqreturn_t opal_interrupt(int irq, void *data) | 134 | static irqreturn_t opal_interrupt(int irq, void *data) |
| 123 | { | 135 | { |
| 124 | __be64 events; | 136 | __be64 events; |
| @@ -131,7 +143,7 @@ static irqreturn_t opal_interrupt(int irq, void *data) · 6 unmodified lines | |||
| 131 | 143 | ||
| 132 | static void opal_handle_irq_work(struct irq_work *work) | 144 | static void opal_handle_irq_work(struct irq_work *work) |
| 133 | { | 145 | { |
| 134 | opal_handle_events(be64_to_cpu(last_outstanding_events)); | 146 | opal_handle_events(last_outstanding_events); |
| 135 | } | 147 | } |
| 136 | 148 | ||
| 137 | static int opal_event_match(struct irq_domain *h, struct device_node *node, | 149 | static int opal_event_match(struct irq_domain *h, struct device_node *node, |
| @@ -278,7 +278,7 @@ static void opal_handle_message(void) · 277 unmodified lines | |||
| 278 | 278 | ||
| 279 | /* Sanity check */ | 279 | /* Sanity check */ |
| 280 | if (type >= OPAL_MSG_TYPE_MAX) { | 280 | if (type >= OPAL_MSG_TYPE_MAX) { |
| 281 | pr_warning("%s: Unknown message type: %u\n", __func__, type); | 281 | pr_warn_once("%s: Unknown message type: %u\n", __func__, type); |
| 282 | return; | 282 | return; |
| 283 | } | 283 | } |
| 284 | opal_message_do_notify(type, (void *)&msg); | 284 | opal_message_do_notify(type, (void *)&msg); |
| @@ -1920,16 +1920,23 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr) · 1919 unmodified lines | |||
| 1920 | } | 1920 | } |
| 1921 | if (separator) | 1921 | if (separator) |
| 1922 | ptr += sprintf(ptr, "%c", separator); | 1922 | ptr += sprintf(ptr, "%c", separator); |
| 1923 | /* | ||
| 1924 | * Use four '%' characters below because of the | ||
| 1925 | * following two conversions: | ||
| 1926 | * | ||
| 1927 | * 1) sprintf: %%%%r -> %%r | ||
| 1928 | * 2) printk : %%r -> %r | ||
| 1929 | */ | ||
| 1923 | if (operand->flags & OPERAND_GPR) | 1930 | if (operand->flags & OPERAND_GPR) |
| 1924 | ptr += sprintf(ptr, "%%r%i", value); | 1931 | ptr += sprintf(ptr, "%%%%r%i", value); |
| 1925 | else if (operand->flags & OPERAND_FPR) | 1932 | else if (operand->flags & OPERAND_FPR) |
| 1926 | ptr += sprintf(ptr, "%%f%i", value); | 1933 | ptr += sprintf(ptr, "%%%%f%i", value); |
| 1927 | else if (operand->flags & OPERAND_AR) | 1934 | else if (operand->flags & OPERAND_AR) |
| 1928 | ptr += sprintf(ptr, "%%a%i", value); | 1935 | ptr += sprintf(ptr, "%%%%a%i", value); |
| 1929 | else if (operand->flags & OPERAND_CR) | 1936 | else if (operand->flags & OPERAND_CR) |
| 1930 | ptr += sprintf(ptr, "%%c%i", value); | 1937 | ptr += sprintf(ptr, "%%%%c%i", value); |
| 1931 | else if (operand->flags & OPERAND_VR) | 1938 | else if (operand->flags & OPERAND_VR) |
| 1932 | ptr += sprintf(ptr, "%%v%i", value); | 1939 | ptr += sprintf(ptr, "%%%%v%i", value); |
| 1933 | else if (operand->flags & OPERAND_PCREL) | 1940 | else if (operand->flags & OPERAND_PCREL) |
| 1934 | ptr += sprintf(ptr, "%lx", (signed int) value | 1941 | ptr += sprintf(ptr, "%lx", (signed int) value |
| 1935 | + addr); | 1942 | + addr); |
| @@ -278,7 +278,7 @@ · 277 unmodified lines | |||
| 278 | #define __NR_fsetxattr 256 | 278 | #define __NR_fsetxattr 256 |
| 279 | #define __NR_getxattr 257 | 279 | #define __NR_getxattr 257 |
| 280 | #define __NR_lgetxattr 258 | 280 | #define __NR_lgetxattr 258 |
| 281 | #define __NR_fgetxattr 269 | 281 | #define __NR_fgetxattr 259 |
| 282 | #define __NR_listxattr 260 | 282 | #define __NR_listxattr 260 |
| 283 | #define __NR_llistxattr 261 | 283 | #define __NR_llistxattr 261 |
| 284 | #define __NR_flistxattr 262 | 284 | #define __NR_flistxattr 262 |
| @@ -10,7 +10,7 @@ · 9 unmodified lines | |||
| 10 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 10 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 11 | * Copyright (C) 2009 Jaswinder Singh Rajput | 11 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 12 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 12 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 13 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 13 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 14 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 14 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 15 | * | 15 | * |
| 16 | * ppc: | 16 | * ppc: |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 9 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 10 | * Copyright (C) 2009 Jaswinder Singh Rajput | 10 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 11 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 11 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 12 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 12 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <linux/perf_event.h> | 15 | #include <linux/perf_event.h> |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 21 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 22 | * Copyright (C) 2009 Jaswinder Singh Rajput | 22 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 23 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 23 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 24 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 24 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 25 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 25 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 26 | * Copyright (C) 2009 Google, Inc., Stephane Eranian | 26 | * Copyright (C) 2009 Google, Inc., Stephane Eranian |
| 27 | */ | 27 | */ |
| @@ -131,7 +131,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT) · 130 unmodified lines | |||
| 131 | # The wrappers will select whether using "malloc" or the kernel allocator. | 131 | # The wrappers will select whether using "malloc" or the kernel allocator. |
| 132 | LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc | 132 | LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc |
| 133 | 133 | ||
| 134 | LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) -lrt | 134 | LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) |
| 135 | 135 | ||
| 136 | # Used by link-vmlinux.sh which has special support for um link | 136 | # Used by link-vmlinux.sh which has special support for um link |
| 137 | export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) | 137 | export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) |
| @@ -249,21 +249,23 @@ void close_addr(unsigned char *addr, unsigned char *netmask, void *arg) · 248 unmodified lines | |||
| 249 | 249 | ||
| 250 | char *split_if_spec(char *str, ...) | 250 | char *split_if_spec(char *str, ...) |
| 251 | { | 251 | { |
| 252 | char **arg, *end; | 252 | char **arg, *end, *ret = NULL; |
| 253 | va_list ap; | 253 | va_list ap; |
| 254 | 254 | ||
| 255 | va_start(ap, str); | 255 | va_start(ap, str); |
| 256 | while ((arg = va_arg(ap, char **)) != NULL) { | 256 | while ((arg = va_arg(ap, char **)) != NULL) { |
| 257 | if (*str == '\0') | 257 | if (*str == '\0') |
| 258 | return NULL; | 258 | goto out; |
| 259 | end = strchr(str, ','); | 259 | end = strchr(str, ','); |
| 260 | if (end != str) | 260 | if (end != str) |
| 261 | *arg = str; | 261 | *arg = str; |
| 262 | if (end == NULL) | 262 | if (end == NULL) |
| 263 | return NULL; | 263 | goto out; |
| 264 | *end++ = '\0'; | 264 | *end++ = '\0'; |
| 265 | str = end; | 265 | str = end; |
| 266 | } | 266 | } |
| 267 | ret = str; | ||
| 268 | out: | ||
| 267 | va_end(ap); | 269 | va_end(ap); |
| 268 | return str; | 270 | return ret; |
| 269 | } | 271 | } |
| @@ -69,7 +69,7 @@ void do_signal(struct pt_regs *regs) · 68 unmodified lines | |||
| 69 | struct ksignal ksig; | 69 | struct ksignal ksig; |
| 70 | int handled_sig = 0; | 70 | int handled_sig = 0; |
| 71 | 71 | ||
| 72 | while (get_signal(&ksig)) { | 72 | if (get_signal(&ksig)) { |
| 73 | handled_sig = 1; | 73 | handled_sig = 1; |
| 74 | /* Whee! Actually deliver the signal. */ | 74 | /* Whee! Actually deliver the signal. */ |
| 75 | handle_signal(&ksig, regs); | 75 | handle_signal(&ksig, regs); |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2009 Jaswinder Singh Rajput | 6 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 7 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 7 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 8 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 9 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 9 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 10 | * Copyright (C) 2009 Google, Inc., Stephane Eranian | 10 | * Copyright (C) 2009 Google, Inc., Stephane Eranian |
| 11 | * | 11 | * |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2009 Jaswinder Singh Rajput | 6 | * Copyright (C) 2009 Jaswinder Singh Rajput |
| 7 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | 7 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter |
| 8 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra |
| 9 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | 9 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> |
| 10 | * Copyright (C) 2009 Google, Inc., Stephane Eranian | 10 | * Copyright (C) 2009 Google, Inc., Stephane Eranian |
| 11 | * | 11 | * |
| @@ -387,7 +387,7 @@ struct cpu_hw_events { · 375 unmodified lines | |||
| 387 | /* Check flags and event code/umask, and set the HSW N/A flag */ | 387 | /* Check flags and event code/umask, and set the HSW N/A flag */ |
| 388 | #define INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(code, n) \ | 388 | #define INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA(code, n) \ |
| 389 | __EVENT_CONSTRAINT(code, n, \ | 389 | __EVENT_CONSTRAINT(code, n, \ |
| 390 | INTEL_ARCH_EVENT_MASK|INTEL_ARCH_EVENT_MASK, \ | 390 | INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \ |
| 391 | HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_NA_HSW) | 391 | HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_NA_HSW) |
| 392 | 392 | ||
| 393 | 393 | ||
| @@ -627,6 +627,7 @@ struct x86_perf_task_context { · 233 unmodified lines | |||
| 627 | u64 lbr_from[MAX_LBR_ENTRIES]; | 627 | u64 lbr_from[MAX_LBR_ENTRIES]; |
| 628 | u64 lbr_to[MAX_LBR_ENTRIES]; | 628 | u64 lbr_to[MAX_LBR_ENTRIES]; |
| 629 | u64 lbr_info[MAX_LBR_ENTRIES]; | 629 | u64 lbr_info[MAX_LBR_ENTRIES]; |
| 630 | int tos; | ||
| 630 | int lbr_callstack_users; | 631 | int lbr_callstack_users; |
| 631 | int lbr_stack_state; | 632 | int lbr_stack_state; |
| 632 | }; | 633 | }; |
| @@ -232,7 +232,7 @@ static struct event_constraint intel_hsw_event_constraints[] = { · 231 unmodified lines | |||
| 232 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 232 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
| 233 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 233 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
| 234 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ | 234 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ |
| 235 | INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.* */ | 235 | INTEL_UEVENT_CONSTRAINT(0x148, 0x4), /* L1D_PEND_MISS.PENDING */ |
| 236 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ | 236 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ |
| 237 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ | 237 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ |
| 238 | /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ | 238 | /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ |
| @@ -298,7 +298,7 @@ static bool __match_event(struct perf_event *a, struct perf_event *b) · 297 unmodified lines | |||
| 298 | static inline struct perf_cgroup *event_to_cgroup(struct perf_event *event) | 298 | static inline struct perf_cgroup *event_to_cgroup(struct perf_event *event) |
| 299 | { | 299 | { |
| 300 | if (event->attach_state & PERF_ATTACH_TASK) | 300 | if (event->attach_state & PERF_ATTACH_TASK) |
| 301 | return perf_cgroup_from_task(event->hw.target); | 301 | return perf_cgroup_from_task(event->hw.target, event->ctx); |
| 302 | 302 | ||
| 303 | return event->cgrp; | 303 | return event->cgrp; |
| 304 | } | 304 | } |
| @@ -239,7 +239,7 @@ static void __intel_pmu_lbr_restore(struct x86_perf_task_context *task_ctx) · 238 unmodified lines | |||
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | mask = x86_pmu.lbr_nr - 1; | 241 | mask = x86_pmu.lbr_nr - 1; |
| 242 | tos = intel_pmu_lbr_tos(); | 242 | tos = task_ctx->tos; |
| 243 | for (i = 0; i < tos; i++) { | 243 | for (i = 0; i < tos; i++) { |
| 244 | lbr_idx = (tos - i) & mask; | 244 | lbr_idx = (tos - i) & mask; |
| 245 | wrmsrl(x86_pmu.lbr_from + lbr_idx, task_ctx->lbr_from[i]); | 245 | wrmsrl(x86_pmu.lbr_from + lbr_idx, task_ctx->lbr_from[i]); |
| @@ -247,6 +247,7 @@ static void __intel_pmu_lbr_restore(struct x86_perf_task_context *task_ctx) · 1 unmodified line | |||
| 247 | if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) | 247 | if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) |
| 248 | wrmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); | 248 | wrmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); |
| 249 | } | 249 | } |
| 250 | wrmsrl(x86_pmu.lbr_tos, tos); | ||
| 250 | task_ctx->lbr_stack_state = LBR_NONE; | 251 | task_ctx->lbr_stack_state = LBR_NONE; |
| 251 | } | 252 | } |
| 252 | 253 | ||
| @@ -270,6 +271,7 @@ static void __intel_pmu_lbr_save(struct x86_perf_task_context *task_ctx) · 17 unmodified lines | |||
| 270 | if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) | 271 | if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) |
| 271 | rdmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); | 272 | rdmsrl(MSR_LBR_INFO_0 + lbr_idx, task_ctx->lbr_info[i]); |
| 272 | } | 273 | } |
| 274 | task_ctx->tos = tos; | ||
| 273 | task_ctx->lbr_stack_state = LBR_VALID; | 275 | task_ctx->lbr_stack_state = LBR_VALID; |
| 274 | } | 276 | } |
| 275 | 277 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * x86 specific code for irq_work | 2 | * x86 specific code for irq_work |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
| @@ -38,6 +38,14 @@ static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu) · 37 unmodified lines | |||
| 38 | return best && (best->ecx & bit(X86_FEATURE_XSAVE)); | 38 | return best && (best->ecx & bit(X86_FEATURE_XSAVE)); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | static inline bool guest_cpuid_has_mtrr(struct kvm_vcpu *vcpu) | ||
| 42 | { | ||
| 43 | struct kvm_cpuid_entry2 *best; | ||
| 44 | |||
| 45 | best = kvm_find_cpuid_entry(vcpu, 1, 0); | ||
| 46 | return best && (best->edx & bit(X86_FEATURE_MTRR)); | ||
| 47 | } | ||
| 48 | |||
| 41 | static inline bool guest_cpuid_has_tsc_adjust(struct kvm_vcpu *vcpu) | 49 | static inline bool guest_cpuid_has_tsc_adjust(struct kvm_vcpu *vcpu) |
| 42 | { | 50 | { |
| 43 | struct kvm_cpuid_entry2 *best; | 51 | struct kvm_cpuid_entry2 *best; |
| @@ -120,14 +120,22 @@ static u8 mtrr_default_type(struct kvm_mtrr *mtrr_state) · 119 unmodified lines | |||
| 120 | return mtrr_state->deftype & IA32_MTRR_DEF_TYPE_TYPE_MASK; | 120 | return mtrr_state->deftype & IA32_MTRR_DEF_TYPE_TYPE_MASK; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | static u8 mtrr_disabled_type(void) | 123 | static u8 mtrr_disabled_type(struct kvm_vcpu *vcpu) |
| 124 | { | 124 | { |
| 125 | /* | 125 | /* |
| 126 | * Intel SDM 11.11.2.2: all MTRRs are disabled when | 126 | * Intel SDM 11.11.2.2: all MTRRs are disabled when |
| 127 | * IA32_MTRR_DEF_TYPE.E bit is cleared, and the UC | 127 | * IA32_MTRR_DEF_TYPE.E bit is cleared, and the UC |
| 128 | * memory type is applied to all of physical memory. | 128 | * memory type is applied to all of physical memory. |
| 129 | * | ||
| 130 | * However, virtual machines can be run with CPUID such that | ||
| 131 | * there are no MTRRs. In that case, the firmware will never | ||
| 132 | * enable MTRRs and it is obviously undesirable to run the | ||
| 133 | * guest entirely with UC memory and we use WB. | ||
| 129 | */ | 134 | */ |
| 130 | return MTRR_TYPE_UNCACHABLE; | 135 | if (guest_cpuid_has_mtrr(vcpu)) |
| 136 | return MTRR_TYPE_UNCACHABLE; | ||
| 137 | else | ||
| 138 | return MTRR_TYPE_WRBACK; | ||
| 131 | } | 139 | } |
| 132 | 140 | ||
| 133 | /* | 141 | /* |
| @@ -267,7 +275,7 @@ static int fixed_mtrr_addr_to_seg(u64 addr) · 133 unmodified lines | |||
| 267 | 275 | ||
| 268 | for (seg = 0; seg < seg_num; seg++) { | 276 | for (seg = 0; seg < seg_num; seg++) { |
| 269 | mtrr_seg = &fixed_seg_table[seg]; | 277 | mtrr_seg = &fixed_seg_table[seg]; |
| 270 | if (mtrr_seg->start >= addr && addr < mtrr_seg->end) | 278 | if (mtrr_seg->start <= addr && addr < mtrr_seg->end) |
| 271 | return seg; | 279 | return seg; |
| 272 | } | 280 | } |
| 273 | 281 | ||
| @@ -300,7 +308,6 @@ static void var_mtrr_range(struct kvm_mtrr_range *range, u64 *start, u64 *end) · 26 unmodified lines | |||
| 300 | *start = range->base & PAGE_MASK; | 308 | *start = range->base & PAGE_MASK; |
| 301 | 309 | ||
| 302 | mask = range->mask & PAGE_MASK; | 310 | mask = range->mask & PAGE_MASK; |
| 303 | mask |= ~0ULL << boot_cpu_data.x86_phys_bits; | ||
| 304 | 311 | ||
| 305 | /* This cannot overflow because writing to the reserved bits of | 312 | /* This cannot overflow because writing to the reserved bits of |
| 306 | * variable MTRRs causes a #GP. | 313 | * variable MTRRs causes a #GP. |
| @@ -356,10 +363,14 @@ static void set_var_mtrr_msr(struct kvm_vcpu *vcpu, u32 msr, u64 data) · 49 unmodified lines | |||
| 356 | if (var_mtrr_range_is_valid(cur)) | 363 | if (var_mtrr_range_is_valid(cur)) |
| 357 | list_del(&mtrr_state->var_ranges[index].node); | 364 | list_del(&mtrr_state->var_ranges[index].node); |
| 358 | 365 | ||
| 366 | /* Extend the mask with all 1 bits to the left, since those | ||
| 367 | * bits must implicitly be 0. The bits are then cleared | ||
| 368 | * when reading them. | ||
| 369 | */ | ||
| 359 | if (!is_mtrr_mask) | 370 | if (!is_mtrr_mask) |
| 360 | cur->base = data; | 371 | cur->base = data; |
| 361 | else | 372 | else |
| 362 | cur->mask = data; | 373 | cur->mask = data | (-1LL << cpuid_maxphyaddr(vcpu)); |
| 363 | 374 | ||
| 364 | /* add it to the list if it's enabled. */ | 375 | /* add it to the list if it's enabled. */ |
| 365 | if (var_mtrr_range_is_valid(cur)) { | 376 | if (var_mtrr_range_is_valid(cur)) { |
| @@ -426,6 +437,8 @@ int kvm_mtrr_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) · 60 unmodified lines | |||
| 426 | *pdata = vcpu->arch.mtrr_state.var_ranges[index].base; | 437 | *pdata = vcpu->arch.mtrr_state.var_ranges[index].base; |
| 427 | else | 438 | else |
| 428 | *pdata = vcpu->arch.mtrr_state.var_ranges[index].mask; | 439 | *pdata = vcpu->arch.mtrr_state.var_ranges[index].mask; |
| 440 | |||
| 441 | *pdata &= (1ULL << cpuid_maxphyaddr(vcpu)) - 1; | ||
| 429 | } | 442 | } |
| 430 | 443 | ||
| 431 | return 0; | 444 | return 0; |
| @@ -670,7 +683,7 @@ u8 kvm_mtrr_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) · 238 unmodified lines | |||
| 670 | } | 683 | } |
| 671 | 684 | ||
| 672 | if (iter.mtrr_disabled) | 685 | if (iter.mtrr_disabled) |
| 673 | return mtrr_disabled_type(); | 686 | return mtrr_disabled_type(vcpu); |
| 674 | 687 | ||
| 675 | /* not contained in any MTRRs. */ | 688 | /* not contained in any MTRRs. */ |
| 676 | if (type == -1) | 689 | if (type == -1) |
| @@ -3422,6 +3422,8 @@ static int handle_exit(struct kvm_vcpu *vcpu) · 3421 unmodified lines | |||
| 3422 | struct kvm_run *kvm_run = vcpu->run; | 3422 | struct kvm_run *kvm_run = vcpu->run; |
| 3423 | u32 exit_code = svm->vmcb->control.exit_code; | 3423 | u32 exit_code = svm->vmcb->control.exit_code; |
| 3424 | 3424 | ||
| 3425 | trace_kvm_exit(exit_code, vcpu, KVM_ISA_SVM); | ||
| 3426 | |||
| 3425 | if (!is_cr_intercept(svm, INTERCEPT_CR0_WRITE)) | 3427 | if (!is_cr_intercept(svm, INTERCEPT_CR0_WRITE)) |
| 3426 | vcpu->arch.cr0 = svm->vmcb->save.cr0; | 3428 | vcpu->arch.cr0 = svm->vmcb->save.cr0; |
| 3427 | if (npt_enabled) | 3429 | if (npt_enabled) |
| @@ -3892,8 +3894,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) · 464 unmodified lines | |||
| 3892 | vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp; | 3894 | vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp; |
| 3893 | vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; | 3895 | vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; |
| 3894 | 3896 | ||
| 3895 | trace_kvm_exit(svm->vmcb->control.exit_code, vcpu, KVM_ISA_SVM); | ||
| 3896 | |||
| 3897 | if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) | 3897 | if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) |
| 3898 | kvm_before_handle_nmi(&svm->vcpu); | 3898 | kvm_before_handle_nmi(&svm->vcpu); |
| 3899 | 3899 | ||
| @@ -2803,7 +2803,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 2802 unmodified lines | |||
| 2803 | msr_info->data = vcpu->arch.ia32_xss; | 2803 | msr_info->data = vcpu->arch.ia32_xss; |
| 2804 | break; | 2804 | break; |
| 2805 | case MSR_TSC_AUX: | 2805 | case MSR_TSC_AUX: |
| 2806 | if (!guest_cpuid_has_rdtscp(vcpu)) | 2806 | if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated) |
| 2807 | return 1; | 2807 | return 1; |
| 2808 | /* Otherwise falls through */ | 2808 | /* Otherwise falls through */ |
| 2809 | default: | 2809 | default: |
| @@ -2909,7 +2909,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 99 unmodified lines | |||
| 2909 | clear_atomic_switch_msr(vmx, MSR_IA32_XSS); | 2909 | clear_atomic_switch_msr(vmx, MSR_IA32_XSS); |
| 2910 | break; | 2910 | break; |
| 2911 | case MSR_TSC_AUX: | 2911 | case MSR_TSC_AUX: |
| 2912 | if (!guest_cpuid_has_rdtscp(vcpu)) | 2912 | if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated) |
| 2913 | return 1; | 2913 | return 1; |
| 2914 | /* Check reserved bit, higher 32 bits should be zero */ | 2914 | /* Check reserved bit, higher 32 bits should be zero */ |
| 2915 | if ((data >> 32) != 0) | 2915 | if ((data >> 32) != 0) |
| @@ -8042,6 +8042,8 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu) · 5126 unmodified lines | |||
| 8042 | u32 exit_reason = vmx->exit_reason; | 8042 | u32 exit_reason = vmx->exit_reason; |
| 8043 | u32 vectoring_info = vmx->idt_vectoring_info; | 8043 | u32 vectoring_info = vmx->idt_vectoring_info; |
| 8044 | 8044 | ||
| 8045 | trace_kvm_exit(exit_reason, vcpu, KVM_ISA_VMX); | ||
| 8046 | |||
| 8045 | /* | 8047 | /* |
| 8046 | * Flush logged GPAs PML buffer, this will make dirty_bitmap more | 8048 | * Flush logged GPAs PML buffer, this will make dirty_bitmap more |
| 8047 | * updated. Another good is, in kvm_vm_ioctl_get_dirty_log, before | 8049 | * updated. Another good is, in kvm_vm_ioctl_get_dirty_log, before |
| @@ -8668,7 +8670,6 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) · 620 unmodified lines | |||
| 8668 | vmx->loaded_vmcs->launched = 1; | 8670 | vmx->loaded_vmcs->launched = 1; |
| 8669 | 8671 | ||
| 8670 | vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); | 8672 | vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); |
| 8671 | trace_kvm_exit(vmx->exit_reason, vcpu, KVM_ISA_VMX); | ||
| 8672 | 8673 | ||
| 8673 | /* | 8674 | /* |
| 8674 | * the KVM_REQ_EVENT optimization bit is only on for one entry, and if | 8675 | * the KVM_REQ_EVENT optimization bit is only on for one entry, and if |
| @@ -3572,9 +3572,11 @@ static int kvm_vm_ioctl_get_pit(struct kvm *kvm, struct kvm_pit_state *ps) · 3571 unmodified lines | |||
| 3572 | 3572 | ||
| 3573 | static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps) | 3573 | static int kvm_vm_ioctl_set_pit(struct kvm *kvm, struct kvm_pit_state *ps) |
| 3574 | { | 3574 | { |
| 3575 | int i; | ||
| 3575 | mutex_lock(&kvm->arch.vpit->pit_state.lock); | 3576 | mutex_lock(&kvm->arch.vpit->pit_state.lock); |
| 3576 | memcpy(&kvm->arch.vpit->pit_state, ps, sizeof(struct kvm_pit_state)); | 3577 | memcpy(&kvm->arch.vpit->pit_state, ps, sizeof(struct kvm_pit_state)); |
| 3577 | kvm_pit_load_count(kvm, 0, ps->channels[0].count, 0); | 3578 | for (i = 0; i < 3; i++) |
| 3579 | kvm_pit_load_count(kvm, i, ps->channels[i].count, 0); | ||
| 3578 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); | 3580 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); |
| 3579 | return 0; | 3581 | return 0; |
| 3580 | } | 3582 | } |
| @@ -3593,6 +3595,7 @@ static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) · 12 unmodified lines | |||
| 3593 | static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) | 3595 | static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) |
| 3594 | { | 3596 | { |
| 3595 | int start = 0; | 3597 | int start = 0; |
| 3598 | int i; | ||
| 3596 | u32 prev_legacy, cur_legacy; | 3599 | u32 prev_legacy, cur_legacy; |
| 3597 | mutex_lock(&kvm->arch.vpit->pit_state.lock); | 3600 | mutex_lock(&kvm->arch.vpit->pit_state.lock); |
| 3598 | prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY; | 3601 | prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY; |
| @@ -3602,7 +3605,8 @@ static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) · 3 unmodified lines | |||
| 3602 | memcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels, | 3605 | memcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels, |
| 3603 | sizeof(kvm->arch.vpit->pit_state.channels)); | 3606 | sizeof(kvm->arch.vpit->pit_state.channels)); |
| 3604 | kvm->arch.vpit->pit_state.flags = ps->flags; | 3607 | kvm->arch.vpit->pit_state.flags = ps->flags; |
| 3605 | kvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start); | 3608 | for (i = 0; i < 3; i++) |
| 3609 | kvm_pit_load_count(kvm, i, kvm->arch.vpit->pit_state.channels[i].count, start); | ||
| 3606 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); | 3610 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); |
| 3607 | return 0; | 3611 | return 0; |
| 3608 | } | 3612 | } |
| @@ -6515,6 +6519,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 2906 unmodified lines | |||
| 6515 | if (req_immediate_exit) | 6519 | if (req_immediate_exit) |
| 6516 | smp_send_reschedule(vcpu->cpu); | 6520 | smp_send_reschedule(vcpu->cpu); |
| 6517 | 6521 | ||
| 6522 | trace_kvm_entry(vcpu->vcpu_id); | ||
| 6523 | wait_lapic_expire(vcpu); | ||
| 6518 | __kvm_guest_enter(); | 6524 | __kvm_guest_enter(); |
| 6519 | 6525 | ||
| 6520 | if (unlikely(vcpu->arch.switch_db_regs)) { | 6526 | if (unlikely(vcpu->arch.switch_db_regs)) { |
| @@ -6527,8 +6533,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 6 unmodified lines | |||
| 6527 | vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD; | 6533 | vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD; |
| 6528 | } | 6534 | } |
| 6529 | 6535 | ||
| 6530 | trace_kvm_entry(vcpu->vcpu_id); | ||
| 6531 | wait_lapic_expire(vcpu); | ||
| 6532 | kvm_x86_ops->run(vcpu); | 6536 | kvm_x86_ops->run(vcpu); |
| 6533 | 6537 | ||
| 6534 | /* | 6538 | /* |
| @@ -89,7 +89,7 @@ static struct addr_marker address_markers[] = { · 88 unmodified lines | |||
| 89 | { 0/* VMALLOC_START */, "vmalloc() Area" }, | 89 | { 0/* VMALLOC_START */, "vmalloc() Area" }, |
| 90 | { 0/*VMALLOC_END*/, "vmalloc() End" }, | 90 | { 0/*VMALLOC_END*/, "vmalloc() End" }, |
| 91 | # ifdef CONFIG_HIGHMEM | 91 | # ifdef CONFIG_HIGHMEM |
| 92 | { 0/*PKMAP_BASE*/, "Persisent kmap() Area" }, | 92 | { 0/*PKMAP_BASE*/, "Persistent kmap() Area" }, |
| 93 | # endif | 93 | # endif |
| 94 | { 0/*FIXADDR_START*/, "Fixmap Area" }, | 94 | { 0/*FIXADDR_START*/, "Fixmap Area" }, |
| 95 | #endif | 95 | #endif |
| @@ -211,7 +211,7 @@ static int copy_sc_from_user(struct pt_regs *regs, · 210 unmodified lines | |||
| 211 | if (err) | 211 | if (err) |
| 212 | return 1; | 212 | return 1; |
| 213 | 213 | ||
| 214 | err = convert_fxsr_from_user(&fpx, sc.fpstate); | 214 | err = convert_fxsr_from_user(&fpx, (void *)sc.fpstate); |
| 215 | if (err) | 215 | if (err) |
| 216 | return 1; | 216 | return 1; |
| 217 | 217 | ||
| @@ -227,7 +227,7 @@ static int copy_sc_from_user(struct pt_regs *regs, · 9 unmodified lines | |||
| 227 | { | 227 | { |
| 228 | struct user_i387_struct fp; | 228 | struct user_i387_struct fp; |
| 229 | 229 | ||
| 230 | err = copy_from_user(&fp, sc.fpstate, | 230 | err = copy_from_user(&fp, (void *)sc.fpstate, |
| 231 | sizeof(struct user_i387_struct)); | 231 | sizeof(struct user_i387_struct)); |
| 232 | if (err) | 232 | if (err) |
| 233 | return 1; | 233 | return 1; |
| @@ -291,7 +291,7 @@ static int copy_sc_to_user(struct sigcontext __user *to, · 57 unmodified lines | |||
| 291 | #endif | 291 | #endif |
| 292 | #undef PUTREG | 292 | #undef PUTREG |
| 293 | sc.oldmask = mask; | 293 | sc.oldmask = mask; |
| 294 | sc.fpstate = to_fp; | 294 | sc.fpstate = (unsigned long)to_fp; |
| 295 | 295 | ||
| 296 | err = copy_to_user(to, &sc, sizeof(struct sigcontext)); | 296 | err = copy_to_user(to, &sc, sizeof(struct sigcontext)); |
| 297 | if (err) | 297 | if (err) |
| @@ -468,12 +468,10 @@ long sys_sigreturn(void) · 170 unmodified lines | |||
| 468 | struct sigframe __user *frame = (struct sigframe __user *)(sp - 8); | 468 | struct sigframe __user *frame = (struct sigframe __user *)(sp - 8); |
| 469 | sigset_t set; | 469 | sigset_t set; |
| 470 | struct sigcontext __user *sc = &frame->sc; | 470 | struct sigcontext __user *sc = &frame->sc; |
| 471 | unsigned long __user *oldmask = &sc->oldmask; | ||
| 472 | unsigned long __user *extramask = frame->extramask; | ||
| 473 | int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long); | 471 | int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long); |
| 474 | 472 | ||
| 475 | if (copy_from_user(&set.sig[0], oldmask, sizeof(set.sig[0])) || | 473 | if (copy_from_user(&set.sig[0], &sc->oldmask, sizeof(set.sig[0])) || |
| 476 | copy_from_user(&set.sig[1], extramask, sig_size)) | 474 | copy_from_user(&set.sig[1], frame->extramask, sig_size)) |
| 477 | goto segfault; | 475 | goto segfault; |
| 478 | 476 | ||
| 479 | set_current_blocked(&set); | 477 | set_current_blocked(&set); |
| @@ -505,6 +503,7 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig, · 25 unmodified lines | |||
| 505 | { | 503 | { |
| 506 | struct rt_sigframe __user *frame; | 504 | struct rt_sigframe __user *frame; |
| 507 | int err = 0, sig = ksig->sig; | 505 | int err = 0, sig = ksig->sig; |
| 506 | unsigned long fp_to; | ||
| 508 | 507 | ||
| 509 | frame = (struct rt_sigframe __user *) | 508 | frame = (struct rt_sigframe __user *) |
| 510 | round_down(stack_top - sizeof(struct rt_sigframe), 16); | 509 | round_down(stack_top - sizeof(struct rt_sigframe), 16); |
| @@ -526,7 +525,10 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig, · 15 unmodified lines | |||
| 526 | err |= __save_altstack(&frame->uc.uc_stack, PT_REGS_SP(regs)); | 525 | err |= __save_altstack(&frame->uc.uc_stack, PT_REGS_SP(regs)); |
| 527 | err |= copy_sc_to_user(&frame->uc.uc_mcontext, &frame->fpstate, regs, | 526 | err |= copy_sc_to_user(&frame->uc.uc_mcontext, &frame->fpstate, regs, |
| 528 | set->sig[0]); | 527 | set->sig[0]); |
| 529 | err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate); | 528 | |
| 529 | fp_to = (unsigned long)&frame->fpstate; | ||
| 530 | |||
| 531 | err |= __put_user(fp_to, &frame->uc.uc_mcontext.fpstate); | ||
| 530 | if (sizeof(*set) == 16) { | 532 | if (sizeof(*set) == 16) { |
| 531 | err |= __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); | 533 | err |= __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); |
| 532 | err |= __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); | 534 | err |= __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); |
| @@ -2495,14 +2495,9 @@ void __init xen_init_mmu_ops(void) · 2494 unmodified lines | |||
| 2495 | { | 2495 | { |
| 2496 | x86_init.paging.pagetable_init = xen_pagetable_init; | 2496 | x86_init.paging.pagetable_init = xen_pagetable_init; |
| 2497 | 2497 | ||
| 2498 | /* Optimization - we can use the HVM one but it has no idea which | 2498 | if (xen_feature(XENFEAT_auto_translated_physmap)) |
| 2499 | * VCPUs are descheduled - which means that it will needlessly IPI | ||
| 2500 | * them. Xen knows so let it do the job. | ||
| 2501 | */ | ||
| 2502 | if (xen_feature(XENFEAT_auto_translated_physmap)) { | ||
| 2503 | pv_mmu_ops.flush_tlb_others = xen_flush_tlb_others; | ||
| 2504 | return; | 2499 | return; |
| 2505 | } | 2500 | |
| 2506 | pv_mmu_ops = xen_mmu_ops; | 2501 | pv_mmu_ops = xen_mmu_ops; |
| 2507 | 2502 | ||
| 2508 | memset(dummy_mapping, 0xff, PAGE_SIZE); | 2503 | memset(dummy_mapping, 0xff, PAGE_SIZE); |
| @@ -68,26 +68,16 @@ static void xen_pv_post_suspend(int suspend_cancelled) · 67 unmodified lines | |||
| 68 | 68 | ||
| 69 | void xen_arch_pre_suspend(void) | 69 | void xen_arch_pre_suspend(void) |
| 70 | { | 70 | { |
| 71 | int cpu; | ||
| 72 | |||
| 73 | for_each_online_cpu(cpu) | ||
| 74 | xen_pmu_finish(cpu); | ||
| 75 | |||
| 76 | if (xen_pv_domain()) | 71 | if (xen_pv_domain()) |
| 77 | xen_pv_pre_suspend(); | 72 | xen_pv_pre_suspend(); |
| 78 | } | 73 | } |
| 79 | 74 | ||
| 80 | void xen_arch_post_suspend(int cancelled) | 75 | void xen_arch_post_suspend(int cancelled) |
| 81 | { | 76 | { |
| 82 | int cpu; | ||
| 83 | |||
| 84 | if (xen_pv_domain()) | 77 | if (xen_pv_domain()) |
| 85 | xen_pv_post_suspend(cancelled); | 78 | xen_pv_post_suspend(cancelled); |
| 86 | else | 79 | else |
| 87 | xen_hvm_post_suspend(cancelled); | 80 | xen_hvm_post_suspend(cancelled); |
| 88 | |||
| 89 | for_each_online_cpu(cpu) | ||
| 90 | xen_pmu_init(cpu); | ||
| 91 | } | 81 | } |
| 92 | 82 | ||
| 93 | static void xen_vcpu_notify_restore(void *data) | 83 | static void xen_vcpu_notify_restore(void *data) |
| @@ -106,10 +96,20 @@ static void xen_vcpu_notify_suspend(void *data) · 12 unmodified lines | |||
| 106 | 96 | ||
| 107 | void xen_arch_resume(void) | 97 | void xen_arch_resume(void) |
| 108 | { | 98 | { |
| 99 | int cpu; | ||
| 100 | |||
| 109 | on_each_cpu(xen_vcpu_notify_restore, NULL, 1); | 101 | on_each_cpu(xen_vcpu_notify_restore, NULL, 1); |
| 102 | |||
| 103 | for_each_online_cpu(cpu) | ||
| 104 | xen_pmu_init(cpu); | ||
| 110 | } | 105 | } |
| 111 | 106 | ||
| 112 | void xen_arch_suspend(void) | 107 | void xen_arch_suspend(void) |
| 113 | { | 108 | { |
| 109 | int cpu; | ||
| 110 | |||
| 111 | for_each_online_cpu(cpu) | ||
| 112 | xen_pmu_finish(cpu); | ||
| 113 | |||
| 114 | on_each_cpu(xen_vcpu_notify_suspend, NULL, 1); | 114 | on_each_cpu(xen_vcpu_notify_suspend, NULL, 1); |
| 115 | } | 115 | } |
| @@ -1127,15 +1127,15 @@ void blkcg_exit_queue(struct request_queue *q) · 1126 unmodified lines | |||
| 1127 | * of the main cic data structures. For now we allow a task to change | 1127 | * of the main cic data structures. For now we allow a task to change |
| 1128 | * its cgroup only if it's the only owner of its ioc. | 1128 | * its cgroup only if it's the only owner of its ioc. |
| 1129 | */ | 1129 | */ |
| 1130 | static int blkcg_can_attach(struct cgroup_subsys_state *css, | 1130 | static int blkcg_can_attach(struct cgroup_taskset *tset) |
| 1131 | struct cgroup_taskset *tset) | ||
| 1132 | { | 1131 | { |
| 1133 | struct task_struct *task; | 1132 | struct task_struct *task; |
| 1133 | struct cgroup_subsys_state *dst_css; | ||
| 1134 | struct io_context *ioc; | 1134 | struct io_context *ioc; |
| 1135 | int ret = 0; | 1135 | int ret = 0; |
| 1136 | 1136 | ||
| 1137 | /* task_lock() is needed to avoid races with exit_io_context() */ | 1137 | /* task_lock() is needed to avoid races with exit_io_context() */ |
| 1138 | cgroup_taskset_for_each(task, tset) { | 1138 | cgroup_taskset_for_each(task, dst_css, tset) { |
| 1139 | task_lock(task); | 1139 | task_lock(task); |
| 1140 | ioc = task->io_context; | 1140 | ioc = task->io_context; |
| 1141 | if (ioc && atomic_read(&ioc->nr_tasks) > 1) | 1141 | if (ioc && atomic_read(&ioc->nr_tasks) > 1) |
| @@ -1689,8 +1689,6 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio) · 1688 unmodified lines | |||
| 1689 | struct request *req; | 1689 | struct request *req; |
| 1690 | unsigned int request_count = 0; | 1690 | unsigned int request_count = 0; |
| 1691 | 1691 | ||
| 1692 | blk_queue_split(q, &bio, q->bio_split); | ||
| 1693 | |||
| 1694 | /* | 1692 | /* |
| 1695 | * low level driver can indicate that it wants pages above a | 1693 | * low level driver can indicate that it wants pages above a |
| 1696 | * certain limit bounced to low memory (ie for highmem, or even | 1694 | * certain limit bounced to low memory (ie for highmem, or even |
| @@ -1698,6 +1696,8 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio) · 1 unmodified line | |||
| 1698 | */ | 1696 | */ |
| 1699 | blk_queue_bounce(q, &bio); | 1697 | blk_queue_bounce(q, &bio); |
| 1700 | 1698 | ||
| 1699 | blk_queue_split(q, &bio, q->bio_split); | ||
| 1700 | |||
| 1701 | if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) { | 1701 | if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) { |
| 1702 | bio->bi_error = -EIO; | 1702 | bio->bi_error = -EIO; |
| 1703 | bio_endio(bio); | 1703 | bio_endio(bio); |
| @@ -3405,6 +3405,9 @@ int blk_pre_runtime_suspend(struct request_queue *q) · 1701 unmodified lines | |||
| 3405 | { | 3405 | { |
| 3406 | int ret = 0; | 3406 | int ret = 0; |
| 3407 | 3407 | ||
| 3408 | if (!q->dev) | ||
| 3409 | return ret; | ||
| 3410 | |||
| 3408 | spin_lock_irq(q->queue_lock); | 3411 | spin_lock_irq(q->queue_lock); |
| 3409 | if (q->nr_pending) { | 3412 | if (q->nr_pending) { |
| 3410 | ret = -EBUSY; | 3413 | ret = -EBUSY; |
| @@ -3432,6 +3435,9 @@ EXPORT_SYMBOL(blk_pre_runtime_suspend); · 21 unmodified lines | |||
| 3432 | */ | 3435 | */ |
| 3433 | void blk_post_runtime_suspend(struct request_queue *q, int err) | 3436 | void blk_post_runtime_suspend(struct request_queue *q, int err) |
| 3434 | { | 3437 | { |
| 3438 | if (!q->dev) | ||
| 3439 | return; | ||
| 3440 | |||
| 3435 | spin_lock_irq(q->queue_lock); | 3441 | spin_lock_irq(q->queue_lock); |
| 3436 | if (!err) { | 3442 | if (!err) { |
| 3437 | q->rpm_status = RPM_SUSPENDED; | 3443 | q->rpm_status = RPM_SUSPENDED; |
| @@ -3456,6 +3462,9 @@ EXPORT_SYMBOL(blk_post_runtime_suspend); · 18 unmodified lines | |||
| 3456 | */ | 3462 | */ |
| 3457 | void blk_pre_runtime_resume(struct request_queue *q) | 3463 | void blk_pre_runtime_resume(struct request_queue *q) |
| 3458 | { | 3464 | { |
| 3465 | if (!q->dev) | ||
| 3466 | return; | ||
| 3467 | |||
| 3459 | spin_lock_irq(q->queue_lock); | 3468 | spin_lock_irq(q->queue_lock); |
| 3460 | q->rpm_status = RPM_RESUMING; | 3469 | q->rpm_status = RPM_RESUMING; |
| 3461 | spin_unlock_irq(q->queue_lock); | 3470 | spin_unlock_irq(q->queue_lock); |
| @@ -3478,6 +3487,9 @@ EXPORT_SYMBOL(blk_pre_runtime_resume); · 16 unmodified lines | |||
| 3478 | */ | 3487 | */ |
| 3479 | void blk_post_runtime_resume(struct request_queue *q, int err) | 3488 | void blk_post_runtime_resume(struct request_queue *q, int err) |
| 3480 | { | 3489 | { |
| 3490 | if (!q->dev) | ||
| 3491 | return; | ||
| 3492 | |||
| 3481 | spin_lock_irq(q->queue_lock); | 3493 | spin_lock_irq(q->queue_lock); |
| 3482 | if (!err) { | 3494 | if (!err) { |
| 3483 | q->rpm_status = RPM_ACTIVE; | 3495 | q->rpm_status = RPM_ACTIVE; |
| @@ -277,12 +277,12 @@ static int ablkcipher_walk_first(struct ablkcipher_request *req, · 276 unmodified lines | |||
| 277 | if (WARN_ON_ONCE(in_irq())) | 277 | if (WARN_ON_ONCE(in_irq())) |
| 278 | return -EDEADLK; | 278 | return -EDEADLK; |
| 279 | 279 | ||
| 280 | walk->iv = req->info; | ||
| 280 | walk->nbytes = walk->total; | 281 | walk->nbytes = walk->total; |
| 281 | if (unlikely(!walk->total)) | 282 | if (unlikely(!walk->total)) |
| 282 | return 0; | 283 | return 0; |
| 283 | 284 | ||
| 284 | walk->iv_buffer = NULL; | 285 | walk->iv_buffer = NULL; |
| 285 | walk->iv = req->info; | ||
| 286 | if (unlikely(((unsigned long)walk->iv & alignmask))) { | 286 | if (unlikely(((unsigned long)walk->iv & alignmask))) { |
| 287 | int err = ablkcipher_copy_iv(walk, tfm, alignmask); | 287 | int err = ablkcipher_copy_iv(walk, tfm, alignmask); |
| 288 | 288 | ||
| @@ -326,12 +326,12 @@ static int blkcipher_walk_first(struct blkcipher_desc *desc, · 325 unmodified lines | |||
| 326 | if (WARN_ON_ONCE(in_irq())) | 326 | if (WARN_ON_ONCE(in_irq())) |
| 327 | return -EDEADLK; | 327 | return -EDEADLK; |
| 328 | 328 | ||
| 329 | walk->iv = desc->info; | ||
| 329 | walk->nbytes = walk->total; | 330 | walk->nbytes = walk->total; |
| 330 | if (unlikely(!walk->total)) | 331 | if (unlikely(!walk->total)) |
| 331 | return 0; | 332 | return 0; |
| 332 | 333 | ||
| 333 | walk->buffer = NULL; | 334 | walk->buffer = NULL; |
| 334 | walk->iv = desc->info; | ||
| 335 | if (unlikely(((unsigned long)walk->iv & walk->alignmask))) { | 335 | if (unlikely(((unsigned long)walk->iv & walk->alignmask))) { |
| 336 | int err = blkcipher_copy_iv(walk); | 336 | int err = blkcipher_copy_iv(walk); |
| 337 | if (err) | 337 | if (err) |
| @@ -1810,7 +1810,7 @@ static void acpi_nfit_notify(struct acpi_device *adev, u32 event) · 1809 unmodified lines | |||
| 1810 | if (!dev->driver) { | 1810 | if (!dev->driver) { |
| 1811 | /* dev->driver may be null if we're being removed */ | 1811 | /* dev->driver may be null if we're being removed */ |
| 1812 | dev_dbg(dev, "%s: no driver found for dev\n", __func__); | 1812 | dev_dbg(dev, "%s: no driver found for dev\n", __func__); |
| 1813 | return; | 1813 | goto out_unlock; |
| 1814 | } | 1814 | } |
| 1815 | 1815 | ||
| 1816 | if (!acpi_desc) { | 1816 | if (!acpi_desc) { |
| @@ -314,16 +314,6 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 313 unmodified lines | |||
| 314 | { PCI_VDEVICE(INTEL, 0x1f37), board_ahci_avn }, /* Avoton RAID */ | 314 | { PCI_VDEVICE(INTEL, 0x1f37), board_ahci_avn }, /* Avoton RAID */ |
| 315 | { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci_avn }, /* Avoton RAID */ | 315 | { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci_avn }, /* Avoton RAID */ |
| 316 | { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci_avn }, /* Avoton RAID */ | 316 | { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci_avn }, /* Avoton RAID */ |
| 317 | { PCI_VDEVICE(INTEL, 0xa182), board_ahci }, /* Lewisburg AHCI*/ | ||
| 318 | { PCI_VDEVICE(INTEL, 0xa202), board_ahci }, /* Lewisburg AHCI*/ | ||
| 319 | { PCI_VDEVICE(INTEL, 0xa184), board_ahci }, /* Lewisburg RAID*/ | ||
| 320 | { PCI_VDEVICE(INTEL, 0xa204), board_ahci }, /* Lewisburg RAID*/ | ||
| 321 | { PCI_VDEVICE(INTEL, 0xa186), board_ahci }, /* Lewisburg RAID*/ | ||
| 322 | { PCI_VDEVICE(INTEL, 0xa206), board_ahci }, /* Lewisburg RAID*/ | ||
| 323 | { PCI_VDEVICE(INTEL, 0x2822), board_ahci }, /* Lewisburg RAID*/ | ||
| 324 | { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* Lewisburg RAID*/ | ||
| 325 | { PCI_VDEVICE(INTEL, 0xa18e), board_ahci }, /* Lewisburg RAID*/ | ||
| 326 | { PCI_VDEVICE(INTEL, 0xa20e), board_ahci }, /* Lewisburg RAID*/ | ||
| 327 | { PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Wellsburg RAID */ | 317 | { PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Wellsburg RAID */ |
| 328 | { PCI_VDEVICE(INTEL, 0x2827), board_ahci }, /* Wellsburg RAID */ | 318 | { PCI_VDEVICE(INTEL, 0x2827), board_ahci }, /* Wellsburg RAID */ |
| 329 | { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ | 319 | { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ |
| @@ -350,10 +340,22 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 20 unmodified lines | |||
| 350 | { PCI_VDEVICE(INTEL, 0x9d03), board_ahci }, /* Sunrise Point-LP AHCI */ | 340 | { PCI_VDEVICE(INTEL, 0x9d03), board_ahci }, /* Sunrise Point-LP AHCI */ |
| 351 | { PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */ | 341 | { PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */ |
| 352 | { PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */ | 342 | { PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */ |
| 343 | { PCI_VDEVICE(INTEL, 0xa102), board_ahci }, /* Sunrise Point-H AHCI */ | ||
| 353 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ | 344 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ |
| 354 | { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ | 345 | { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ |
| 346 | { PCI_VDEVICE(INTEL, 0xa106), board_ahci }, /* Sunrise Point-H RAID */ | ||
| 355 | { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ | 347 | { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ |
| 356 | { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ | 348 | { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ |
| 349 | { PCI_VDEVICE(INTEL, 0x2822), board_ahci }, /* Lewisburg RAID*/ | ||
| 350 | { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* Lewisburg RAID*/ | ||
| 351 | { PCI_VDEVICE(INTEL, 0xa182), board_ahci }, /* Lewisburg AHCI*/ | ||
| 352 | { PCI_VDEVICE(INTEL, 0xa184), board_ahci }, /* Lewisburg RAID*/ | ||
| 353 | { PCI_VDEVICE(INTEL, 0xa186), board_ahci }, /* Lewisburg RAID*/ | ||
| 354 | { PCI_VDEVICE(INTEL, 0xa18e), board_ahci }, /* Lewisburg RAID*/ | ||
| 355 | { PCI_VDEVICE(INTEL, 0xa202), board_ahci }, /* Lewisburg AHCI*/ | ||
| 356 | { PCI_VDEVICE(INTEL, 0xa204), board_ahci }, /* Lewisburg RAID*/ | ||
| 357 | { PCI_VDEVICE(INTEL, 0xa206), board_ahci }, /* Lewisburg RAID*/ | ||
| 358 | { PCI_VDEVICE(INTEL, 0xa20e), board_ahci }, /* Lewisburg RAID*/ | ||
| 357 | 359 | ||
| 358 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 360 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
| 359 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 361 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| @@ -62,6 +62,7 @@ static void ahci_mvebu_regret_option(struct ahci_host_priv *hpriv) · 61 unmodified lines | |||
| 62 | writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA); | 62 | writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | #ifdef CONFIG_PM_SLEEP | ||
| 65 | static int ahci_mvebu_suspend(struct platform_device *pdev, pm_message_t state) | 66 | static int ahci_mvebu_suspend(struct platform_device *pdev, pm_message_t state) |
| 66 | { | 67 | { |
| 67 | return ahci_platform_suspend_host(&pdev->dev); | 68 | return ahci_platform_suspend_host(&pdev->dev); |
| @@ -81,6 +82,10 @@ static int ahci_mvebu_resume(struct platform_device *pdev) · 13 unmodified lines | |||
| 81 | 82 | ||
| 82 | return ahci_platform_resume_host(&pdev->dev); | 83 | return ahci_platform_resume_host(&pdev->dev); |
| 83 | } | 84 | } |
| 85 | #else | ||
| 86 | #define ahci_mvebu_suspend NULL | ||
| 87 | #define ahci_mvebu_resume NULL | ||
| 88 | #endif | ||
| 84 | 89 | ||
| 85 | static const struct ata_port_info ahci_mvebu_port_info = { | 90 | static const struct ata_port_info ahci_mvebu_port_info = { |
| 86 | .flags = AHCI_FLAG_COMMON, | 91 | .flags = AHCI_FLAG_COMMON, |
| @@ -1273,6 +1273,15 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, · 1272 unmodified lines | |||
| 1273 | ata_tf_to_fis(tf, pmp, is_cmd, fis); | 1273 | ata_tf_to_fis(tf, pmp, is_cmd, fis); |
| 1274 | ahci_fill_cmd_slot(pp, 0, cmd_fis_len | flags | (pmp << 12)); | 1274 | ahci_fill_cmd_slot(pp, 0, cmd_fis_len | flags | (pmp << 12)); |
| 1275 | 1275 | ||
| 1276 | /* set port value for softreset of Port Multiplier */ | ||
| 1277 | if (pp->fbs_enabled && pp->fbs_last_dev != pmp) { | ||
| 1278 | tmp = readl(port_mmio + PORT_FBS); | ||
| 1279 | tmp &= ~(PORT_FBS_DEV_MASK | PORT_FBS_DEC); | ||
| 1280 | tmp |= pmp << PORT_FBS_DEV_OFFSET; | ||
| 1281 | writel(tmp, port_mmio + PORT_FBS); | ||
| 1282 | pp->fbs_last_dev = pmp; | ||
| 1283 | } | ||
| 1284 | |||
| 1276 | /* issue & wait */ | 1285 | /* issue & wait */ |
| 1277 | writel(1, port_mmio + PORT_CMD_ISSUE); | 1286 | writel(1, port_mmio + PORT_CMD_ISSUE); |
| 1278 | 1287 | ||
| @@ -1505,12 +1505,20 @@ static const char *ata_err_string(unsigned int err_mask) · 1504 unmodified lines | |||
| 1505 | unsigned int ata_read_log_page(struct ata_device *dev, u8 log, | 1505 | unsigned int ata_read_log_page(struct ata_device *dev, u8 log, |
| 1506 | u8 page, void *buf, unsigned int sectors) | 1506 | u8 page, void *buf, unsigned int sectors) |
| 1507 | { | 1507 | { |
| 1508 | unsigned long ap_flags = dev->link->ap->flags; | ||
| 1508 | struct ata_taskfile tf; | 1509 | struct ata_taskfile tf; |
| 1509 | unsigned int err_mask; | 1510 | unsigned int err_mask; |
| 1510 | bool dma = false; | 1511 | bool dma = false; |
| 1511 | 1512 | ||
| 1512 | DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page); | 1513 | DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page); |
| 1513 | 1514 | ||
| 1515 | /* | ||
| 1516 | * Return error without actually issuing the command on controllers | ||
| 1517 | * which e.g. lockup on a read log page. | ||
| 1518 | */ | ||
| 1519 | if (ap_flags & ATA_FLAG_NO_LOG_PAGE) | ||
| 1520 | return AC_ERR_DEV; | ||
| 1521 | |||
| 1514 | retry: | 1522 | retry: |
| 1515 | ata_tf_init(dev, &tf); | 1523 | ata_tf_init(dev, &tf); |
| 1516 | if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id) && | 1524 | if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id) && |
| @@ -45,7 +45,8 @@ enum { · 44 unmodified lines | |||
| 45 | SATA_FSL_MAX_PRD_DIRECT = 16, /* Direct PRDT entries */ | 45 | SATA_FSL_MAX_PRD_DIRECT = 16, /* Direct PRDT entries */ |
| 46 | 46 | ||
| 47 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | | 47 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | |
| 48 | ATA_FLAG_PMP | ATA_FLAG_NCQ | ATA_FLAG_AN), | 48 | ATA_FLAG_PMP | ATA_FLAG_NCQ | |
| 49 | ATA_FLAG_AN | ATA_FLAG_NO_LOG_PAGE), | ||
| 49 | 50 | ||
| 50 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, | 51 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, |
| 51 | SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ | 52 | SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ |
| @@ -630,6 +630,9 @@ static void sil_dev_config(struct ata_device *dev) · 629 unmodified lines | |||
| 630 | unsigned int n, quirks = 0; | 630 | unsigned int n, quirks = 0; |
| 631 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; | 631 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; |
| 632 | 632 | ||
| 633 | /* This controller doesn't support trim */ | ||
| 634 | dev->horkage |= ATA_HORKAGE_NOTRIM; | ||
| 635 | |||
| 633 | ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); | 636 | ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); |
| 634 | 637 | ||
| 635 | for (n = 0; sil_blacklist[n].product; n++) | 638 | for (n = 0; sil_blacklist[n].product; n++) |
| @@ -303,6 +303,10 @@ static int memory_subsys_offline(struct device *dev) · 302 unmodified lines | |||
| 303 | if (mem->state == MEM_OFFLINE) | 303 | if (mem->state == MEM_OFFLINE) |
| 304 | return 0; | 304 | return 0; |
| 305 | 305 | ||
| 306 | /* Can't offline block with non-present sections */ | ||
| 307 | if (mem->section_count != sections_per_block) | ||
| 308 | return -EINVAL; | ||
| 309 | |||
| 306 | return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE); | 310 | return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE); |
| 307 | } | 311 | } |
| 308 | 312 | ||
| @@ -390,6 +390,7 @@ static int pm_genpd_runtime_suspend(struct device *dev) · 389 unmodified lines | |||
| 390 | struct generic_pm_domain *genpd; | 390 | struct generic_pm_domain *genpd; |
| 391 | bool (*stop_ok)(struct device *__dev); | 391 | bool (*stop_ok)(struct device *__dev); |
| 392 | struct gpd_timing_data *td = &dev_gpd_data(dev)->td; | 392 | struct gpd_timing_data *td = &dev_gpd_data(dev)->td; |
| 393 | bool runtime_pm = pm_runtime_enabled(dev); | ||
| 393 | ktime_t time_start; | 394 | ktime_t time_start; |
| 394 | s64 elapsed_ns; | 395 | s64 elapsed_ns; |
| 395 | int ret; | 396 | int ret; |
| @@ -400,12 +401,19 @@ static int pm_genpd_runtime_suspend(struct device *dev) · 4 unmodified lines | |||
| 400 | if (IS_ERR(genpd)) | 401 | if (IS_ERR(genpd)) |
| 401 | return -EINVAL; | 402 | return -EINVAL; |
| 402 | 403 | ||
| 404 | /* | ||
| 405 | * A runtime PM centric subsystem/driver may re-use the runtime PM | ||
| 406 | * callbacks for other purposes than runtime PM. In those scenarios | ||
| 407 | * runtime PM is disabled. Under these circumstances, we shall skip | ||
| 408 | * validating/measuring the PM QoS latency. | ||
| 409 | */ | ||
| 403 | stop_ok = genpd->gov ? genpd->gov->stop_ok : NULL; | 410 | stop_ok = genpd->gov ? genpd->gov->stop_ok : NULL; |
| 404 | if (stop_ok && !stop_ok(dev)) | 411 | if (runtime_pm && stop_ok && !stop_ok(dev)) |
| 405 | return -EBUSY; | 412 | return -EBUSY; |
| 406 | 413 | ||
| 407 | /* Measure suspend latency. */ | 414 | /* Measure suspend latency. */ |
| 408 | time_start = ktime_get(); | 415 | if (runtime_pm) |
| 416 | time_start = ktime_get(); | ||
| 409 | 417 | ||
| 410 | ret = genpd_save_dev(genpd, dev); | 418 | ret = genpd_save_dev(genpd, dev); |
| 411 | if (ret) | 419 | if (ret) |
| @@ -418,13 +426,15 @@ static int pm_genpd_runtime_suspend(struct device *dev) · 6 unmodified lines | |||
| 418 | } | 426 | } |
| 419 | 427 | ||
| 420 | /* Update suspend latency value if the measured time exceeds it. */ | 428 | /* Update suspend latency value if the measured time exceeds it. */ |
| 421 | elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); | 429 | if (runtime_pm) { |
| 422 | if (elapsed_ns > td->suspend_latency_ns) { | 430 | elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); |
| 423 | td->suspend_latency_ns = elapsed_ns; | 431 | if (elapsed_ns > td->suspend_latency_ns) { |
| 424 | dev_dbg(dev, "suspend latency exceeded, %lld ns\n", | 432 | td->suspend_latency_ns = elapsed_ns; |
| 425 | elapsed_ns); | 433 | dev_dbg(dev, "suspend latency exceeded, %lld ns\n", |
| 426 | genpd->max_off_time_changed = true; | 434 | elapsed_ns); |
| 427 | td->constraint_changed = true; | 435 | genpd->max_off_time_changed = true; |
| 436 | td->constraint_changed = true; | ||
| 437 | } | ||
| 428 | } | 438 | } |
| 429 | 439 | ||
| 430 | /* | 440 | /* |
| @@ -453,6 +463,7 @@ static int pm_genpd_runtime_resume(struct device *dev) · 22 unmodified lines | |||
| 453 | { | 463 | { |
| 454 | struct generic_pm_domain *genpd; | 464 | struct generic_pm_domain *genpd; |
| 455 | struct gpd_timing_data *td = &dev_gpd_data(dev)->td; | 465 | struct gpd_timing_data *td = &dev_gpd_data(dev)->td; |
| 466 | bool runtime_pm = pm_runtime_enabled(dev); | ||
| 456 | ktime_t time_start; | 467 | ktime_t time_start; |
| 457 | s64 elapsed_ns; | 468 | s64 elapsed_ns; |
| 458 | int ret; | 469 | int ret; |
| @@ -479,14 +490,14 @@ static int pm_genpd_runtime_resume(struct device *dev) · 20 unmodified lines | |||
| 479 | 490 | ||
| 480 | out: | 491 | out: |
| 481 | /* Measure resume latency. */ | 492 | /* Measure resume latency. */ |
| 482 | if (timed) | 493 | if (timed && runtime_pm) |
| 483 | time_start = ktime_get(); | 494 | time_start = ktime_get(); |
| 484 | 495 | ||
| 485 | genpd_start_dev(genpd, dev); | 496 | genpd_start_dev(genpd, dev); |
| 486 | genpd_restore_dev(genpd, dev); | 497 | genpd_restore_dev(genpd, dev); |
| 487 | 498 | ||
| 488 | /* Update resume latency value if the measured time exceeds it. */ | 499 | /* Update resume latency value if the measured time exceeds it. */ |
| 489 | if (timed) { | 500 | if (timed && runtime_pm) { |
| 490 | elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); | 501 | elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); |
| 491 | if (elapsed_ns > td->resume_latency_ns) { | 502 | if (elapsed_ns > td->resume_latency_ns) { |
| 492 | td->resume_latency_ns = elapsed_ns; | 503 | td->resume_latency_ns = elapsed_ns; |
| @@ -219,6 +219,9 @@ static void end_cmd(struct nullb_cmd *cmd) · 218 unmodified lines | |||
| 219 | { | 219 | { |
| 220 | struct request_queue *q = NULL; | 220 | struct request_queue *q = NULL; |
| 221 | 221 | ||
| 222 | if (cmd->rq) | ||
| 223 | q = cmd->rq->q; | ||
| 224 | |||
| 222 | switch (queue_mode) { | 225 | switch (queue_mode) { |
| 223 | case NULL_Q_MQ: | 226 | case NULL_Q_MQ: |
| 224 | blk_mq_end_request(cmd->rq, 0); | 227 | blk_mq_end_request(cmd->rq, 0); |
| @@ -232,9 +235,6 @@ static void end_cmd(struct nullb_cmd *cmd) · 7 unmodified lines | |||
| 232 | goto free_cmd; | 235 | goto free_cmd; |
| 233 | } | 236 | } |
| 234 | 237 | ||
| 235 | if (cmd->rq) | ||
| 236 | q = cmd->rq->q; | ||
| 237 | |||
| 238 | /* Restart queue if needed, as we are freeing a tag */ | 238 | /* Restart queue if needed, as we are freeing a tag */ |
| 239 | if (q && !q->mq_ops && blk_queue_stopped(q)) { | 239 | if (q && !q->mq_ops && blk_queue_stopped(q)) { |
| 240 | unsigned long flags; | 240 | unsigned long flags; |
| @@ -444,8 +444,9 @@ static void null_lnvm_end_io(struct request *rq, int error) · 203 unmodified lines | |||
| 444 | blk_put_request(rq); | 444 | blk_put_request(rq); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | static int null_lnvm_submit_io(struct request_queue *q, struct nvm_rq *rqd) | 447 | static int null_lnvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd) |
| 448 | { | 448 | { |
| 449 | struct request_queue *q = dev->q; | ||
| 449 | struct request *rq; | 450 | struct request *rq; |
| 450 | struct bio *bio = rqd->bio; | 451 | struct bio *bio = rqd->bio; |
| 451 | 452 | ||
| @@ -470,7 +471,7 @@ static int null_lnvm_submit_io(struct request_queue *q, struct nvm_rq *rqd) · 18 unmodified lines | |||
| 470 | return 0; | 471 | return 0; |
| 471 | } | 472 | } |
| 472 | 473 | ||
| 473 | static int null_lnvm_id(struct request_queue *q, struct nvm_id *id) | 474 | static int null_lnvm_id(struct nvm_dev *dev, struct nvm_id *id) |
| 474 | { | 475 | { |
| 475 | sector_t size = gb * 1024 * 1024 * 1024ULL; | 476 | sector_t size = gb * 1024 * 1024 * 1024ULL; |
| 476 | sector_t blksize; | 477 | sector_t blksize; |
| @@ -523,7 +524,7 @@ static int null_lnvm_id(struct request_queue *q, struct nvm_id *id) · 46 unmodified lines | |||
| 523 | return 0; | 524 | return 0; |
| 524 | } | 525 | } |
| 525 | 526 | ||
| 526 | static void *null_lnvm_create_dma_pool(struct request_queue *q, char *name) | 527 | static void *null_lnvm_create_dma_pool(struct nvm_dev *dev, char *name) |
| 527 | { | 528 | { |
| 528 | mempool_t *virtmem_pool; | 529 | mempool_t *virtmem_pool; |
| 529 | 530 | ||
| @@ -541,7 +542,7 @@ static void null_lnvm_destroy_dma_pool(void *pool) · 11 unmodified lines | |||
| 541 | mempool_destroy(pool); | 542 | mempool_destroy(pool); |
| 542 | } | 543 | } |
| 543 | 544 | ||
| 544 | static void *null_lnvm_dev_dma_alloc(struct request_queue *q, void *pool, | 545 | static void *null_lnvm_dev_dma_alloc(struct nvm_dev *dev, void *pool, |
| 545 | gfp_t mem_flags, dma_addr_t *dma_handler) | 546 | gfp_t mem_flags, dma_addr_t *dma_handler) |
| 546 | { | 547 | { |
| 547 | return mempool_alloc(pool, mem_flags); | 548 | return mempool_alloc(pool, mem_flags); |
| @@ -765,7 +766,9 @@ out: · 217 unmodified lines | |||
| 765 | 766 | ||
| 766 | static int __init null_init(void) | 767 | static int __init null_init(void) |
| 767 | { | 768 | { |
| 769 | int ret = 0; | ||
| 768 | unsigned int i; | 770 | unsigned int i; |
| 771 | struct nullb *nullb; | ||
| 769 | 772 | ||
| 770 | if (bs > PAGE_SIZE) { | 773 | if (bs > PAGE_SIZE) { |
| 771 | pr_warn("null_blk: invalid block size\n"); | 774 | pr_warn("null_blk: invalid block size\n"); |
| @@ -807,22 +810,29 @@ static int __init null_init(void) · 35 unmodified lines | |||
| 807 | 0, 0, NULL); | 810 | 0, 0, NULL); |
| 808 | if (!ppa_cache) { | 811 | if (!ppa_cache) { |
| 809 | pr_err("null_blk: unable to create ppa cache\n"); | 812 | pr_err("null_blk: unable to create ppa cache\n"); |
| 810 | return -ENOMEM; | 813 | ret = -ENOMEM; |
| 814 | goto err_ppa; | ||
| 811 | } | 815 | } |
| 812 | } | 816 | } |
| 813 | 817 | ||
| 814 | for (i = 0; i < nr_devices; i++) { | 818 | for (i = 0; i < nr_devices; i++) { |
| 815 | if (null_add_dev()) { | 819 | ret = null_add_dev(); |
| 816 | unregister_blkdev(null_major, "nullb"); | 820 | if (ret) |
| 817 | goto err_ppa; | 821 | goto err_dev; |
| 818 | } | ||
| 819 | } | 822 | } |
| 820 | 823 | ||
| 821 | pr_info("null: module loaded\n"); | 824 | pr_info("null: module loaded\n"); |
| 822 | return 0; | 825 | return 0; |
| 823 | err_ppa: | 826 | |
| 827 | err_dev: | ||
| 828 | while (!list_empty(&nullb_list)) { | ||
| 829 | nullb = list_entry(nullb_list.next, struct nullb, list); | ||
| 830 | null_del_dev(nullb); | ||
| 831 | } | ||
| 824 | kmem_cache_destroy(ppa_cache); | 832 | kmem_cache_destroy(ppa_cache); |
| 825 | return -EINVAL; | 833 | err_ppa: |
| 834 | unregister_blkdev(null_major, "nullb"); | ||
| 835 | return ret; | ||
| 826 | } | 836 | } |
| 827 | 837 | ||
| 828 | static void __exit null_exit(void) | 838 | static void __exit null_exit(void) |
| @@ -950,6 +950,8 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req, · 949 unmodified lines | |||
| 950 | goto unmap; | 950 | goto unmap; |
| 951 | 951 | ||
| 952 | for (n = 0, i = 0; n < nseg; n++) { | 952 | for (n = 0, i = 0; n < nseg; n++) { |
| 953 | uint8_t first_sect, last_sect; | ||
| 954 | |||
| 953 | if ((n % SEGS_PER_INDIRECT_FRAME) == 0) { | 955 | if ((n % SEGS_PER_INDIRECT_FRAME) == 0) { |
| 954 | /* Map indirect segments */ | 956 | /* Map indirect segments */ |
| 955 | if (segments) | 957 | if (segments) |
| @@ -957,15 +959,18 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req, · 1 unmodified line | |||
| 957 | segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page); | 959 | segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page); |
| 958 | } | 960 | } |
| 959 | i = n % SEGS_PER_INDIRECT_FRAME; | 961 | i = n % SEGS_PER_INDIRECT_FRAME; |
| 962 | |||
| 960 | pending_req->segments[n]->gref = segments[i].gref; | 963 | pending_req->segments[n]->gref = segments[i].gref; |
| 961 | seg[n].nsec = segments[i].last_sect - | 964 | |
| 962 | segments[i].first_sect + 1; | 965 | first_sect = READ_ONCE(segments[i].first_sect); |
| 963 | seg[n].offset = (segments[i].first_sect << 9); | 966 | last_sect = READ_ONCE(segments[i].last_sect); |
| 964 | if ((segments[i].last_sect >= (XEN_PAGE_SIZE >> 9)) || | 967 | if (last_sect >= (XEN_PAGE_SIZE >> 9) || last_sect < first_sect) { |
| 965 | (segments[i].last_sect < segments[i].first_sect)) { | ||
| 966 | rc = -EINVAL; | 968 | rc = -EINVAL; |
| 967 | goto unmap; | 969 | goto unmap; |
| 968 | } | 970 | } |
| 971 | |||
| 972 | seg[n].nsec = last_sect - first_sect + 1; | ||
| 973 | seg[n].offset = first_sect << 9; | ||
| 969 | preq->nr_sects += seg[n].nsec; | 974 | preq->nr_sects += seg[n].nsec; |
| 970 | } | 975 | } |
| 971 | 976 | ||
| @@ -408,8 +408,8 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst, · 407 unmodified lines | |||
| 408 | struct blkif_x86_32_request *src) | 408 | struct blkif_x86_32_request *src) |
| 409 | { | 409 | { |
| 410 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j; | 410 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j; |
| 411 | dst->operation = src->operation; | 411 | dst->operation = READ_ONCE(src->operation); |
| 412 | switch (src->operation) { | 412 | switch (dst->operation) { |
| 413 | case BLKIF_OP_READ: | 413 | case BLKIF_OP_READ: |
| 414 | case BLKIF_OP_WRITE: | 414 | case BLKIF_OP_WRITE: |
| 415 | case BLKIF_OP_WRITE_BARRIER: | 415 | case BLKIF_OP_WRITE_BARRIER: |
| @@ -456,8 +456,8 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst, · 40 unmodified lines | |||
| 456 | struct blkif_x86_64_request *src) | 456 | struct blkif_x86_64_request *src) |
| 457 | { | 457 | { |
| 458 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j; | 458 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST, j; |
| 459 | dst->operation = src->operation; | 459 | dst->operation = READ_ONCE(src->operation); |
| 460 | switch (src->operation) { | 460 | switch (dst->operation) { |
| 461 | case BLKIF_OP_READ: | 461 | case BLKIF_OP_READ: |
| 462 | case BLKIF_OP_WRITE: | 462 | case BLKIF_OP_WRITE: |
| 463 | case BLKIF_OP_WRITE_BARRIER: | 463 | case BLKIF_OP_WRITE_BARRIER: |
| @@ -1230,14 +1230,14 @@ static int smi_start_processing(void *send_info, · 1229 unmodified lines | |||
| 1230 | 1230 | ||
| 1231 | new_smi->intf = intf; | 1231 | new_smi->intf = intf; |
| 1232 | 1232 | ||
| 1233 | /* Try to claim any interrupts. */ | ||
| 1234 | if (new_smi->irq_setup) | ||
| 1235 | new_smi->irq_setup(new_smi); | ||
| 1236 | |||
| 1237 | /* Set up the timer that drives the interface. */ | 1233 | /* Set up the timer that drives the interface. */ |
| 1238 | setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); | 1234 | setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); |
| 1239 | smi_mod_timer(new_smi, jiffies + SI_TIMEOUT_JIFFIES); | 1235 | smi_mod_timer(new_smi, jiffies + SI_TIMEOUT_JIFFIES); |
| 1240 | 1236 | ||
| 1237 | /* Try to claim any interrupts. */ | ||
| 1238 | if (new_smi->irq_setup) | ||
| 1239 | new_smi->irq_setup(new_smi); | ||
| 1240 | |||
| 1241 | /* | 1241 | /* |
| 1242 | * Check if the user forcefully enabled the daemon. | 1242 | * Check if the user forcefully enabled the daemon. |
| 1243 | */ | 1243 | */ |
| @@ -209,6 +209,8 @@ EXPORT_SYMBOL_GPL(clk_register_gpio_mux); · 208 unmodified lines | |||
| 209 | 209 | ||
| 210 | struct clk_gpio_delayed_register_data { | 210 | struct clk_gpio_delayed_register_data { |
| 211 | const char *gpio_name; | 211 | const char *gpio_name; |
| 212 | int num_parents; | ||
| 213 | const char **parent_names; | ||
| 212 | struct device_node *node; | 214 | struct device_node *node; |
| 213 | struct mutex lock; | 215 | struct mutex lock; |
| 214 | struct clk *clk; | 216 | struct clk *clk; |
| @@ -222,8 +224,6 @@ static struct clk *of_clk_gpio_delayed_register_get( · 7 unmodified lines | |||
| 222 | { | 224 | { |
| 223 | struct clk_gpio_delayed_register_data *data = _data; | 225 | struct clk_gpio_delayed_register_data *data = _data; |
| 224 | struct clk *clk; | 226 | struct clk *clk; |
| 225 | const char **parent_names; | ||
| 226 | int i, num_parents; | ||
| 227 | int gpio; | 227 | int gpio; |
| 228 | enum of_gpio_flags of_flags; | 228 | enum of_gpio_flags of_flags; |
| 229 | 229 | ||
| @@ -248,26 +248,14 @@ static struct clk *of_clk_gpio_delayed_register_get( · 18 unmodified lines | |||
| 248 | return ERR_PTR(gpio); | 248 | return ERR_PTR(gpio); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | num_parents = of_clk_get_parent_count(data->node); | 251 | clk = data->clk_register_get(data->node->name, data->parent_names, |
| 252 | 252 | data->num_parents, gpio, of_flags & OF_GPIO_ACTIVE_LOW); | |
| 253 | parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL); | ||
| 254 | if (!parent_names) { | ||
| 255 | clk = ERR_PTR(-ENOMEM); | ||
| 256 | goto out; | ||
| 257 | } | ||
| 258 | |||
| 259 | for (i = 0; i < num_parents; i++) | ||
| 260 | parent_names[i] = of_clk_get_parent_name(data->node, i); | ||
| 261 | |||
| 262 | clk = data->clk_register_get(data->node->name, parent_names, | ||
| 263 | num_parents, gpio, of_flags & OF_GPIO_ACTIVE_LOW); | ||
| 264 | if (IS_ERR(clk)) | 253 | if (IS_ERR(clk)) |
| 265 | goto out; | 254 | goto out; |
| 266 | 255 | ||
| 267 | data->clk = clk; | 256 | data->clk = clk; |
| 268 | out: | 257 | out: |
| 269 | mutex_unlock(&data->lock); | 258 | mutex_unlock(&data->lock); |
| 270 | kfree(parent_names); | ||
| 271 | 259 | ||
| 272 | return clk; | 260 | return clk; |
| 273 | } | 261 | } |
| @@ -296,11 +284,24 @@ static void __init of_gpio_clk_setup(struct device_node *node, · 22 unmodified lines | |||
| 296 | unsigned gpio, bool active_low)) | 284 | unsigned gpio, bool active_low)) |
| 297 | { | 285 | { |
| 298 | struct clk_gpio_delayed_register_data *data; | 286 | struct clk_gpio_delayed_register_data *data; |
| 287 | const char **parent_names; | ||
| 288 | int i, num_parents; | ||
| 299 | 289 | ||
| 300 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 290 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
| 301 | if (!data) | 291 | if (!data) |
| 302 | return; | 292 | return; |
| 303 | 293 | ||
| 294 | num_parents = of_clk_get_parent_count(node); | ||
| 295 | |||
| 296 | parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL); | ||
| 297 | if (!parent_names) | ||
| 298 | return; | ||
| 299 | |||
| 300 | for (i = 0; i < num_parents; i++) | ||
| 301 | parent_names[i] = of_clk_get_parent_name(node, i); | ||
| 302 | |||
| 303 | data->num_parents = num_parents; | ||
| 304 | data->parent_names = parent_names; | ||
| 304 | data->node = node; | 305 | data->node = node; |
| 305 | data->gpio_name = gpio_name; | 306 | data->gpio_name = gpio_name; |
| 306 | data->clk_register_get = clk_register_get; | 307 | data->clk_register_get = clk_register_get; |
| @@ -778,8 +778,10 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx) · 777 unmodified lines | |||
| 778 | */ | 778 | */ |
| 779 | clksel = (cg_in(cg, hwc->reg) & CLKSEL_MASK) >> CLKSEL_SHIFT; | 779 | clksel = (cg_in(cg, hwc->reg) & CLKSEL_MASK) >> CLKSEL_SHIFT; |
| 780 | div = get_pll_div(cg, hwc, clksel); | 780 | div = get_pll_div(cg, hwc, clksel); |
| 781 | if (!div) | 781 | if (!div) { |
| 782 | kfree(hwc); | ||
| 782 | return NULL; | 783 | return NULL; |
| 784 | } | ||
| 783 | 785 | ||
| 784 | pct80_rate = clk_get_rate(div->clk); | 786 | pct80_rate = clk_get_rate(div->clk); |
| 785 | pct80_rate *= 8; | 787 | pct80_rate *= 8; |
| @@ -292,6 +292,7 @@ static int scpi_clocks_probe(struct platform_device *pdev) · 291 unmodified lines | |||
| 292 | ret = scpi_clk_add(dev, child, match); | 292 | ret = scpi_clk_add(dev, child, match); |
| 293 | if (ret) { | 293 | if (ret) { |
| 294 | scpi_clocks_remove(pdev); | 294 | scpi_clocks_remove(pdev); |
| 295 | of_node_put(child); | ||
| 295 | return ret; | 296 | return ret; |
| 296 | } | 297 | } |
| 297 | } | 298 | } |
| @@ -52,7 +52,7 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw, · 51 unmodified lines | |||
| 52 | unsigned long parent_rate) | 52 | unsigned long parent_rate) |
| 53 | { | 53 | { |
| 54 | struct clk_pllv1 *pll = to_clk_pllv1(hw); | 54 | struct clk_pllv1 *pll = to_clk_pllv1(hw); |
| 55 | long long ll; | 55 | unsigned long long ull; |
| 56 | int mfn_abs; | 56 | int mfn_abs; |
| 57 | unsigned int mfi, mfn, mfd, pd; | 57 | unsigned int mfi, mfn, mfd, pd; |
| 58 | u32 reg; | 58 | u32 reg; |
| @@ -94,16 +94,16 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw, · 35 unmodified lines | |||
| 94 | rate = parent_rate * 2; | 94 | rate = parent_rate * 2; |
| 95 | rate /= pd + 1; | 95 | rate /= pd + 1; |
| 96 | 96 | ||
| 97 | ll = (unsigned long long)rate * mfn_abs; | 97 | ull = (unsigned long long)rate * mfn_abs; |
| 98 | 98 | ||
| 99 | do_div(ll, mfd + 1); | 99 | do_div(ull, mfd + 1); |
| 100 | 100 | ||
| 101 | if (mfn_is_negative(pll, mfn)) | 101 | if (mfn_is_negative(pll, mfn)) |
| 102 | ll = -ll; | 102 | ull = (rate * mfi) - ull; |
| 103 | else | ||
| 104 | ull = (rate * mfi) + ull; | ||
| 103 | 105 | ||
| 104 | ll = (rate * mfi) + ll; | 106 | return ull; |
| 105 | |||
| 106 | return ll; | ||
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | static struct clk_ops clk_pllv1_ops = { | 109 | static struct clk_ops clk_pllv1_ops = { |
| @@ -79,7 +79,7 @@ static unsigned long __clk_pllv2_recalc_rate(unsigned long parent_rate, · 78 unmodified lines | |||
| 79 | { | 79 | { |
| 80 | long mfi, mfn, mfd, pdf, ref_clk; | 80 | long mfi, mfn, mfd, pdf, ref_clk; |
| 81 | unsigned long dbl; | 81 | unsigned long dbl; |
| 82 | s64 temp; | 82 | u64 temp; |
| 83 | 83 | ||
| 84 | dbl = dp_ctl & MXC_PLL_DP_CTL_DPDCK0_2_EN; | 84 | dbl = dp_ctl & MXC_PLL_DP_CTL_DPDCK0_2_EN; |
| 85 | 85 | ||
| @@ -98,8 +98,9 @@ static unsigned long __clk_pllv2_recalc_rate(unsigned long parent_rate, · 12 unmodified lines | |||
| 98 | temp = (u64) ref_clk * abs(mfn); | 98 | temp = (u64) ref_clk * abs(mfn); |
| 99 | do_div(temp, mfd + 1); | 99 | do_div(temp, mfd + 1); |
| 100 | if (mfn < 0) | 100 | if (mfn < 0) |
| 101 | temp = -temp; | 101 | temp = (ref_clk * mfi) - temp; |
| 102 | temp = (ref_clk * mfi) + temp; | 102 | else |
| 103 | temp = (ref_clk * mfi) + temp; | ||
| 103 | 104 | ||
| 104 | return temp; | 105 | return temp; |
| 105 | } | 106 | } |
| @@ -126,7 +127,7 @@ static int __clk_pllv2_set_rate(unsigned long rate, unsigned long parent_rate, · 20 unmodified lines | |||
| 126 | { | 127 | { |
| 127 | u32 reg; | 128 | u32 reg; |
| 128 | long mfi, pdf, mfn, mfd = 999999; | 129 | long mfi, pdf, mfn, mfd = 999999; |
| 129 | s64 temp64; | 130 | u64 temp64; |
| 130 | unsigned long quad_parent_rate; | 131 | unsigned long quad_parent_rate; |
| 131 | 132 | ||
| 132 | quad_parent_rate = 4 * parent_rate; | 133 | quad_parent_rate = 4 * parent_rate; |
| @@ -335,22 +335,22 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) · 334 unmodified lines | |||
| 335 | clk[VF610_CLK_SAI0_SEL] = imx_clk_mux("sai0_sel", CCM_CSCMR1, 0, 2, sai_sels, 4); | 335 | clk[VF610_CLK_SAI0_SEL] = imx_clk_mux("sai0_sel", CCM_CSCMR1, 0, 2, sai_sels, 4); |
| 336 | clk[VF610_CLK_SAI0_EN] = imx_clk_gate("sai0_en", "sai0_sel", CCM_CSCDR1, 16); | 336 | clk[VF610_CLK_SAI0_EN] = imx_clk_gate("sai0_en", "sai0_sel", CCM_CSCDR1, 16); |
| 337 | clk[VF610_CLK_SAI0_DIV] = imx_clk_divider("sai0_div", "sai0_en", CCM_CSCDR1, 0, 4); | 337 | clk[VF610_CLK_SAI0_DIV] = imx_clk_divider("sai0_div", "sai0_en", CCM_CSCDR1, 0, 4); |
| 338 | clk[VF610_CLK_SAI0] = imx_clk_gate2("sai0", "sai0_div", CCM_CCGR0, CCM_CCGRx_CGn(15)); | 338 | clk[VF610_CLK_SAI0] = imx_clk_gate2("sai0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(15)); |
| 339 | 339 | ||
| 340 | clk[VF610_CLK_SAI1_SEL] = imx_clk_mux("sai1_sel", CCM_CSCMR1, 2, 2, sai_sels, 4); | 340 | clk[VF610_CLK_SAI1_SEL] = imx_clk_mux("sai1_sel", CCM_CSCMR1, 2, 2, sai_sels, 4); |
| 341 | clk[VF610_CLK_SAI1_EN] = imx_clk_gate("sai1_en", "sai1_sel", CCM_CSCDR1, 17); | 341 | clk[VF610_CLK_SAI1_EN] = imx_clk_gate("sai1_en", "sai1_sel", CCM_CSCDR1, 17); |
| 342 | clk[VF610_CLK_SAI1_DIV] = imx_clk_divider("sai1_div", "sai1_en", CCM_CSCDR1, 4, 4); | 342 | clk[VF610_CLK_SAI1_DIV] = imx_clk_divider("sai1_div", "sai1_en", CCM_CSCDR1, 4, 4); |
| 343 | clk[VF610_CLK_SAI1] = imx_clk_gate2("sai1", "sai1_div", CCM_CCGR1, CCM_CCGRx_CGn(0)); | 343 | clk[VF610_CLK_SAI1] = imx_clk_gate2("sai1", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(0)); |
| 344 | 344 | ||
| 345 | clk[VF610_CLK_SAI2_SEL] = imx_clk_mux("sai2_sel", CCM_CSCMR1, 4, 2, sai_sels, 4); | 345 | clk[VF610_CLK_SAI2_SEL] = imx_clk_mux("sai2_sel", CCM_CSCMR1, 4, 2, sai_sels, 4); |
| 346 | clk[VF610_CLK_SAI2_EN] = imx_clk_gate("sai2_en", "sai2_sel", CCM_CSCDR1, 18); | 346 | clk[VF610_CLK_SAI2_EN] = imx_clk_gate("sai2_en", "sai2_sel", CCM_CSCDR1, 18); |
| 347 | clk[VF610_CLK_SAI2_DIV] = imx_clk_divider("sai2_div", "sai2_en", CCM_CSCDR1, 8, 4); | 347 | clk[VF610_CLK_SAI2_DIV] = imx_clk_divider("sai2_div", "sai2_en", CCM_CSCDR1, 8, 4); |
| 348 | clk[VF610_CLK_SAI2] = imx_clk_gate2("sai2", "sai2_div", CCM_CCGR1, CCM_CCGRx_CGn(1)); | 348 | clk[VF610_CLK_SAI2] = imx_clk_gate2("sai2", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(1)); |
| 349 | 349 | ||
| 350 | clk[VF610_CLK_SAI3_SEL] = imx_clk_mux("sai3_sel", CCM_CSCMR1, 6, 2, sai_sels, 4); | 350 | clk[VF610_CLK_SAI3_SEL] = imx_clk_mux("sai3_sel", CCM_CSCMR1, 6, 2, sai_sels, 4); |
| 351 | clk[VF610_CLK_SAI3_EN] = imx_clk_gate("sai3_en", "sai3_sel", CCM_CSCDR1, 19); | 351 | clk[VF610_CLK_SAI3_EN] = imx_clk_gate("sai3_en", "sai3_sel", CCM_CSCDR1, 19); |
| 352 | clk[VF610_CLK_SAI3_DIV] = imx_clk_divider("sai3_div", "sai3_en", CCM_CSCDR1, 12, 4); | 352 | clk[VF610_CLK_SAI3_DIV] = imx_clk_divider("sai3_div", "sai3_en", CCM_CSCDR1, 12, 4); |
| 353 | clk[VF610_CLK_SAI3] = imx_clk_gate2("sai3", "sai3_div", CCM_CCGR1, CCM_CCGRx_CGn(2)); | 353 | clk[VF610_CLK_SAI3] = imx_clk_gate2("sai3", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(2)); |
| 354 | 354 | ||
| 355 | clk[VF610_CLK_NFC_SEL] = imx_clk_mux("nfc_sel", CCM_CSCMR1, 12, 2, nfc_sels, 4); | 355 | clk[VF610_CLK_NFC_SEL] = imx_clk_mux("nfc_sel", CCM_CSCMR1, 12, 2, nfc_sels, 4); |
| 356 | clk[VF610_CLK_NFC_EN] = imx_clk_gate("nfc_en", "nfc_sel", CCM_CSCDR2, 9); | 356 | clk[VF610_CLK_NFC_EN] = imx_clk_gate("nfc_en", "nfc_sel", CCM_CSCDR2, 9); |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | |||
| 9 | * warranty of any kind, whether express or implied. | 9 | * warranty of any kind, whether express or implied. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/clk.h> | ||
| 12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 14 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | |||
| 9 | * warranty of any kind, whether express or implied. | 9 | * warranty of any kind, whether express or implied. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/clk.h> | ||
| 12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 14 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | |||
| 9 | * warranty of any kind, whether express or implied. | 9 | * warranty of any kind, whether express or implied. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/clk.h> | ||
| 12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 14 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| @@ -41,15 +41,10 @@ · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | #define SUN4I_PLL2_OUTPUTS 4 | 42 | #define SUN4I_PLL2_OUTPUTS 4 |
| 43 | 43 | ||
| 44 | struct sun4i_pll2_data { | ||
| 45 | u32 post_div_offset; | ||
| 46 | u32 pre_div_flags; | ||
| 47 | }; | ||
| 48 | |||
| 49 | static DEFINE_SPINLOCK(sun4i_a10_pll2_lock); | 44 | static DEFINE_SPINLOCK(sun4i_a10_pll2_lock); |
| 50 | 45 | ||
| 51 | static void __init sun4i_pll2_setup(struct device_node *node, | 46 | static void __init sun4i_pll2_setup(struct device_node *node, |
| 52 | struct sun4i_pll2_data *data) | 47 | int post_div_offset) |
| 53 | { | 48 | { |
| 54 | const char *clk_name = node->name, *parent; | 49 | const char *clk_name = node->name, *parent; |
| 55 | struct clk **clks, *base_clk, *prediv_clk; | 50 | struct clk **clks, *base_clk, *prediv_clk; |
| @@ -76,7 +71,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, · 20 unmodified lines | |||
| 76 | parent, 0, reg, | 71 | parent, 0, reg, |
| 77 | SUN4I_PLL2_PRE_DIV_SHIFT, | 72 | SUN4I_PLL2_PRE_DIV_SHIFT, |
| 78 | SUN4I_PLL2_PRE_DIV_WIDTH, | 73 | SUN4I_PLL2_PRE_DIV_WIDTH, |
| 79 | data->pre_div_flags, | 74 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, |
| 80 | &sun4i_a10_pll2_lock); | 75 | &sun4i_a10_pll2_lock); |
| 81 | if (!prediv_clk) { | 76 | if (!prediv_clk) { |
| 82 | pr_err("Couldn't register the prediv clock\n"); | 77 | pr_err("Couldn't register the prediv clock\n"); |
| @@ -127,7 +122,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, · 44 unmodified lines | |||
| 127 | */ | 122 | */ |
| 128 | val = readl(reg); | 123 | val = readl(reg); |
| 129 | val &= ~(SUN4I_PLL2_POST_DIV_MASK << SUN4I_PLL2_POST_DIV_SHIFT); | 124 | val &= ~(SUN4I_PLL2_POST_DIV_MASK << SUN4I_PLL2_POST_DIV_SHIFT); |
| 130 | val |= (SUN4I_PLL2_POST_DIV_VALUE - data->post_div_offset) << SUN4I_PLL2_POST_DIV_SHIFT; | 125 | val |= (SUN4I_PLL2_POST_DIV_VALUE - post_div_offset) << SUN4I_PLL2_POST_DIV_SHIFT; |
| 131 | writel(val, reg); | 126 | writel(val, reg); |
| 132 | 127 | ||
| 133 | of_property_read_string_index(node, "clock-output-names", | 128 | of_property_read_string_index(node, "clock-output-names", |
| @@ -191,25 +186,17 @@ err_unmap: · 57 unmodified lines | |||
| 191 | iounmap(reg); | 186 | iounmap(reg); |
| 192 | } | 187 | } |
| 193 | 188 | ||
| 194 | static struct sun4i_pll2_data sun4i_a10_pll2_data = { | ||
| 195 | .pre_div_flags = CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, | ||
| 196 | }; | ||
| 197 | |||
| 198 | static void __init sun4i_a10_pll2_setup(struct device_node *node) | 189 | static void __init sun4i_a10_pll2_setup(struct device_node *node) |
| 199 | { | 190 | { |
| 200 | sun4i_pll2_setup(node, &sun4i_a10_pll2_data); | 191 | sun4i_pll2_setup(node, 0); |
| 201 | } | 192 | } |
| 202 | 193 | ||
| 203 | CLK_OF_DECLARE(sun4i_a10_pll2, "allwinner,sun4i-a10-pll2-clk", | 194 | CLK_OF_DECLARE(sun4i_a10_pll2, "allwinner,sun4i-a10-pll2-clk", |
| 204 | sun4i_a10_pll2_setup); | 195 | sun4i_a10_pll2_setup); |
| 205 | 196 | ||
| 206 | static struct sun4i_pll2_data sun5i_a13_pll2_data = { | ||
| 207 | .post_div_offset = 1, | ||
| 208 | }; | ||
| 209 | |||
| 210 | static void __init sun5i_a13_pll2_setup(struct device_node *node) | 197 | static void __init sun5i_a13_pll2_setup(struct device_node *node) |
| 211 | { | 198 | { |
| 212 | sun4i_pll2_setup(node, &sun5i_a13_pll2_data); | 199 | sun4i_pll2_setup(node, 1); |
| 213 | } | 200 | } |
| 214 | 201 | ||
| 215 | CLK_OF_DECLARE(sun5i_a13_pll2, "allwinner,sun5i-a13-pll2-clk", | 202 | CLK_OF_DECLARE(sun5i_a13_pll2, "allwinner,sun5i-a13-pll2-clk", |
| @@ -20,6 +20,8 @@ static struct ti_dt_clk dm816x_clks[] = { · 19 unmodified lines | |||
| 20 | DT_CLK(NULL, "sys_clkin", "sys_clkin_ck"), | 20 | DT_CLK(NULL, "sys_clkin", "sys_clkin_ck"), |
| 21 | DT_CLK(NULL, "timer_sys_ck", "sys_clkin_ck"), | 21 | DT_CLK(NULL, "timer_sys_ck", "sys_clkin_ck"), |
| 22 | DT_CLK(NULL, "sys_32k_ck", "sys_32k_ck"), | 22 | DT_CLK(NULL, "sys_32k_ck", "sys_32k_ck"), |
| 23 | DT_CLK(NULL, "timer_32k_ck", "sysclk18_ck"), | ||
| 24 | DT_CLK(NULL, "timer_ext_ck", "tclkin_ck"), | ||
| 23 | DT_CLK(NULL, "mpu_ck", "mpu_ck"), | 25 | DT_CLK(NULL, "mpu_ck", "mpu_ck"), |
| 24 | DT_CLK(NULL, "timer1_fck", "timer1_fck"), | 26 | DT_CLK(NULL, "timer1_fck", "timer1_fck"), |
| 25 | DT_CLK(NULL, "timer2_fck", "timer2_fck"), | 27 | DT_CLK(NULL, "timer2_fck", "timer2_fck"), |
| @@ -240,7 +240,7 @@ u8 omap2_init_dpll_parent(struct clk_hw *hw) · 239 unmodified lines | |||
| 240 | */ | 240 | */ |
| 241 | unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk) | 241 | unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk) |
| 242 | { | 242 | { |
| 243 | long long dpll_clk; | 243 | u64 dpll_clk; |
| 244 | u32 dpll_mult, dpll_div, v; | 244 | u32 dpll_mult, dpll_div, v; |
| 245 | struct dpll_data *dd; | 245 | struct dpll_data *dd; |
| 246 | 246 | ||
| @@ -262,7 +262,7 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk) · 15 unmodified lines | |||
| 262 | dpll_div = v & dd->div1_mask; | 262 | dpll_div = v & dd->div1_mask; |
| 263 | dpll_div >>= __ffs(dd->div1_mask); | 263 | dpll_div >>= __ffs(dd->div1_mask); |
| 264 | 264 | ||
| 265 | dpll_clk = (long long)clk_get_rate(dd->clk_ref) * dpll_mult; | 265 | dpll_clk = (u64)clk_get_rate(dd->clk_ref) * dpll_mult; |
| 266 | do_div(dpll_clk, dpll_div + 1); | 266 | do_div(dpll_clk, dpll_div + 1); |
| 267 | 267 | ||
| 268 | return dpll_clk; | 268 | return dpll_clk; |
| @@ -214,7 +214,6 @@ static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, · 213 unmodified lines | |||
| 214 | { | 214 | { |
| 215 | struct clk_divider *divider; | 215 | struct clk_divider *divider; |
| 216 | unsigned int div, value; | 216 | unsigned int div, value; |
| 217 | unsigned long flags = 0; | ||
| 218 | u32 val; | 217 | u32 val; |
| 219 | 218 | ||
| 220 | if (!hw || !rate) | 219 | if (!hw || !rate) |
| @@ -228,9 +227,6 @@ static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, · 7 unmodified lines | |||
| 228 | if (value > div_mask(divider)) | 227 | if (value > div_mask(divider)) |
| 229 | value = div_mask(divider); | 228 | value = div_mask(divider); |
| 230 | 229 | ||
| 231 | if (divider->lock) | ||
| 232 | spin_lock_irqsave(divider->lock, flags); | ||
| 233 | |||
| 234 | if (divider->flags & CLK_DIVIDER_HIWORD_MASK) { | 230 | if (divider->flags & CLK_DIVIDER_HIWORD_MASK) { |
| 235 | val = div_mask(divider) << (divider->shift + 16); | 231 | val = div_mask(divider) << (divider->shift + 16); |
| 236 | } else { | 232 | } else { |
| @@ -240,9 +236,6 @@ static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, · 3 unmodified lines | |||
| 240 | val |= value << divider->shift; | 236 | val |= value << divider->shift; |
| 241 | ti_clk_ll_ops->clk_writel(val, divider->reg); | 237 | ti_clk_ll_ops->clk_writel(val, divider->reg); |
| 242 | 238 | ||
| 243 | if (divider->lock) | ||
| 244 | spin_unlock_irqrestore(divider->lock, flags); | ||
| 245 | |||
| 246 | return 0; | 239 | return 0; |
| 247 | } | 240 | } |
| 248 | 241 | ||
| @@ -256,8 +249,7 @@ static struct clk *_register_divider(struct device *dev, const char *name, · 7 unmodified lines | |||
| 256 | const char *parent_name, | 249 | const char *parent_name, |
| 257 | unsigned long flags, void __iomem *reg, | 250 | unsigned long flags, void __iomem *reg, |
| 258 | u8 shift, u8 width, u8 clk_divider_flags, | 251 | u8 shift, u8 width, u8 clk_divider_flags, |
| 259 | const struct clk_div_table *table, | 252 | const struct clk_div_table *table) |
| 260 | spinlock_t *lock) | ||
| 261 | { | 253 | { |
| 262 | struct clk_divider *div; | 254 | struct clk_divider *div; |
| 263 | struct clk *clk; | 255 | struct clk *clk; |
| @@ -288,7 +280,6 @@ static struct clk *_register_divider(struct device *dev, const char *name, · 24 unmodified lines | |||
| 288 | div->shift = shift; | 280 | div->shift = shift; |
| 289 | div->width = width; | 281 | div->width = width; |
| 290 | div->flags = clk_divider_flags; | 282 | div->flags = clk_divider_flags; |
| 291 | div->lock = lock; | ||
| 292 | div->hw.init = &init; | 283 | div->hw.init = &init; |
| 293 | div->table = table; | 284 | div->table = table; |
| 294 | 285 | ||
| @@ -421,7 +412,7 @@ struct clk *ti_clk_register_divider(struct ti_clk *setup) · 126 unmodified lines | |||
| 421 | 412 | ||
| 422 | clk = _register_divider(NULL, setup->name, div->parent, | 413 | clk = _register_divider(NULL, setup->name, div->parent, |
| 423 | flags, (void __iomem *)reg, div->bit_shift, | 414 | flags, (void __iomem *)reg, div->bit_shift, |
| 424 | width, div_flags, table, NULL); | 415 | width, div_flags, table); |
| 425 | 416 | ||
| 426 | if (IS_ERR(clk)) | 417 | if (IS_ERR(clk)) |
| 427 | kfree(table); | 418 | kfree(table); |
| @@ -584,8 +575,7 @@ static void __init of_ti_divider_clk_setup(struct device_node *node) · 156 unmodified lines | |||
| 584 | goto cleanup; | 575 | goto cleanup; |
| 585 | 576 | ||
| 586 | clk = _register_divider(NULL, node->name, parent_name, flags, reg, | 577 | clk = _register_divider(NULL, node->name, parent_name, flags, reg, |
| 587 | shift, width, clk_divider_flags, table, | 578 | shift, width, clk_divider_flags, table); |
| 588 | NULL); | ||
| 589 | 579 | ||
| 590 | if (!IS_ERR(clk)) { | 580 | if (!IS_ERR(clk)) { |
| 591 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | 581 | of_clk_add_provider(node, of_clk_src_simple_get, clk); |
| @@ -168,7 +168,7 @@ static unsigned long ti_fapll_recalc_rate(struct clk_hw *hw, · 167 unmodified lines | |||
| 168 | { | 168 | { |
| 169 | struct fapll_data *fd = to_fapll(hw); | 169 | struct fapll_data *fd = to_fapll(hw); |
| 170 | u32 fapll_n, fapll_p, v; | 170 | u32 fapll_n, fapll_p, v; |
| 171 | long long rate; | 171 | u64 rate; |
| 172 | 172 | ||
| 173 | if (ti_fapll_clock_is_bypass(fd)) | 173 | if (ti_fapll_clock_is_bypass(fd)) |
| 174 | return parent_rate; | 174 | return parent_rate; |
| @@ -314,7 +314,7 @@ static unsigned long ti_fapll_synth_recalc_rate(struct clk_hw *hw, · 139 unmodified lines | |||
| 314 | { | 314 | { |
| 315 | struct fapll_synth *synth = to_synth(hw); | 315 | struct fapll_synth *synth = to_synth(hw); |
| 316 | u32 synth_div_m; | 316 | u32 synth_div_m; |
| 317 | long long rate; | 317 | u64 rate; |
| 318 | 318 | ||
| 319 | /* The audio_pll_clk1 is hardwired to produce 32.768KiHz clock */ | 319 | /* The audio_pll_clk1 is hardwired to produce 32.768KiHz clock */ |
| 320 | if (!synth->div) | 320 | if (!synth->div) |
| @@ -69,7 +69,6 @@ static int ti_clk_mux_set_parent(struct clk_hw *hw, u8 index) · 68 unmodified lines | |||
| 69 | { | 69 | { |
| 70 | struct clk_mux *mux = to_clk_mux(hw); | 70 | struct clk_mux *mux = to_clk_mux(hw); |
| 71 | u32 val; | 71 | u32 val; |
| 72 | unsigned long flags = 0; | ||
| 73 | 72 | ||
| 74 | if (mux->table) { | 73 | if (mux->table) { |
| 75 | index = mux->table[index]; | 74 | index = mux->table[index]; |
| @@ -81,9 +80,6 @@ static int ti_clk_mux_set_parent(struct clk_hw *hw, u8 index) · 5 unmodified lines | |||
| 81 | index++; | 80 | index++; |
| 82 | } | 81 | } |
| 83 | 82 | ||
| 84 | if (mux->lock) | ||
| 85 | spin_lock_irqsave(mux->lock, flags); | ||
| 86 | |||
| 87 | if (mux->flags & CLK_MUX_HIWORD_MASK) { | 83 | if (mux->flags & CLK_MUX_HIWORD_MASK) { |
| 88 | val = mux->mask << (mux->shift + 16); | 84 | val = mux->mask << (mux->shift + 16); |
| 89 | } else { | 85 | } else { |
| @@ -93,9 +89,6 @@ static int ti_clk_mux_set_parent(struct clk_hw *hw, u8 index) · 3 unmodified lines | |||
| 93 | val |= index << mux->shift; | 89 | val |= index << mux->shift; |
| 94 | ti_clk_ll_ops->clk_writel(val, mux->reg); | 90 | ti_clk_ll_ops->clk_writel(val, mux->reg); |
| 95 | 91 | ||
| 96 | if (mux->lock) | ||
| 97 | spin_unlock_irqrestore(mux->lock, flags); | ||
| 98 | |||
| 99 | return 0; | 92 | return 0; |
| 100 | } | 93 | } |
| 101 | 94 | ||
| @@ -109,7 +102,7 @@ static struct clk *_register_mux(struct device *dev, const char *name, · 7 unmodified lines | |||
| 109 | const char **parent_names, u8 num_parents, | 102 | const char **parent_names, u8 num_parents, |
| 110 | unsigned long flags, void __iomem *reg, | 103 | unsigned long flags, void __iomem *reg, |
| 111 | u8 shift, u32 mask, u8 clk_mux_flags, | 104 | u8 shift, u32 mask, u8 clk_mux_flags, |
| 112 | u32 *table, spinlock_t *lock) | 105 | u32 *table) |
| 113 | { | 106 | { |
| 114 | struct clk_mux *mux; | 107 | struct clk_mux *mux; |
| 115 | struct clk *clk; | 108 | struct clk *clk; |
| @@ -133,7 +126,6 @@ static struct clk *_register_mux(struct device *dev, const char *name, · 17 unmodified lines | |||
| 133 | mux->shift = shift; | 126 | mux->shift = shift; |
| 134 | mux->mask = mask; | 127 | mux->mask = mask; |
| 135 | mux->flags = clk_mux_flags; | 128 | mux->flags = clk_mux_flags; |
| 136 | mux->lock = lock; | ||
| 137 | mux->table = table; | 129 | mux->table = table; |
| 138 | mux->hw.init = &init; | 130 | mux->hw.init = &init; |
| 139 | 131 | ||
| @@ -175,7 +167,7 @@ struct clk *ti_clk_register_mux(struct ti_clk *setup) · 35 unmodified lines | |||
| 175 | 167 | ||
| 176 | return _register_mux(NULL, setup->name, mux->parents, mux->num_parents, | 168 | return _register_mux(NULL, setup->name, mux->parents, mux->num_parents, |
| 177 | flags, (void __iomem *)reg, mux->bit_shift, mask, | 169 | flags, (void __iomem *)reg, mux->bit_shift, mask, |
| 178 | mux_flags, NULL, NULL); | 170 | mux_flags, NULL); |
| 179 | } | 171 | } |
| 180 | 172 | ||
| 181 | /** | 173 | /** |
| @@ -227,8 +219,7 @@ static void of_mux_clk_setup(struct device_node *node) · 45 unmodified lines | |||
| 227 | mask = (1 << fls(mask)) - 1; | 219 | mask = (1 << fls(mask)) - 1; |
| 228 | 220 | ||
| 229 | clk = _register_mux(NULL, node->name, parent_names, num_parents, | 221 | clk = _register_mux(NULL, node->name, parent_names, num_parents, |
| 230 | flags, reg, shift, mask, clk_mux_flags, NULL, | 222 | flags, reg, shift, mask, clk_mux_flags, NULL); |
| 231 | NULL); | ||
| 232 | 223 | ||
| 233 | if (!IS_ERR(clk)) | 224 | if (!IS_ERR(clk)) |
| 234 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | 225 | of_clk_add_provider(node, of_clk_src_simple_get, clk); |
| @@ -55,7 +55,7 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name, · 54 unmodified lines | |||
| 55 | { | 55 | { |
| 56 | struct clocksource_mmio *cs; | 56 | struct clocksource_mmio *cs; |
| 57 | 57 | ||
| 58 | if (bits > 32 || bits < 16) | 58 | if (bits > 64 || bits < 16) |
| 59 | return -EINVAL; | 59 | return -EINVAL; |
| 60 | 60 | ||
| 61 | cs = kzalloc(sizeof(struct clocksource_mmio), GFP_KERNEL); | 61 | cs = kzalloc(sizeof(struct clocksource_mmio), GFP_KERNEL); |
| @@ -226,7 +226,7 @@ config ARM_TEGRA20_CPUFREQ · 225 unmodified lines | |||
| 226 | 226 | ||
| 227 | config ARM_TEGRA124_CPUFREQ | 227 | config ARM_TEGRA124_CPUFREQ |
| 228 | tristate "Tegra124 CPUFreq support" | 228 | tristate "Tegra124 CPUFreq support" |
| 229 | depends on ARCH_TEGRA && CPUFREQ_DT | 229 | depends on ARCH_TEGRA && CPUFREQ_DT && REGULATOR |
| 230 | default y | 230 | default y |
| 231 | help | 231 | help |
| 232 | This adds the CPUFreq driver support for Tegra124 SOCs. | 232 | This adds the CPUFreq driver support for Tegra124 SOCs. |
| @@ -1123,7 +1123,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 1122 unmodified lines | |||
| 1123 | limits->max_sysfs_pct); | 1123 | limits->max_sysfs_pct); |
| 1124 | limits->max_perf_pct = max(limits->min_policy_pct, | 1124 | limits->max_perf_pct = max(limits->min_policy_pct, |
| 1125 | limits->max_perf_pct); | 1125 | limits->max_perf_pct); |
| 1126 | limits->max_perf = round_up(limits->max_perf, 8); | 1126 | limits->max_perf = round_up(limits->max_perf, FRAC_BITS); |
| 1127 | 1127 | ||
| 1128 | /* Make sure min_perf_pct <= max_perf_pct */ | 1128 | /* Make sure min_perf_pct <= max_perf_pct */ |
| 1129 | limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct); | 1129 | limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct); |
| @@ -648,7 +648,7 @@ late_initcall(s3c_cpufreq_initcall); · 647 unmodified lines | |||
| 648 | * | 648 | * |
| 649 | * Register the given set of PLLs with the system. | 649 | * Register the given set of PLLs with the system. |
| 650 | */ | 650 | */ |
| 651 | int __init s3c_plltab_register(struct cpufreq_frequency_table *plls, | 651 | int s3c_plltab_register(struct cpufreq_frequency_table *plls, |
| 652 | unsigned int plls_no) | 652 | unsigned int plls_no) |
| 653 | { | 653 | { |
| 654 | struct cpufreq_frequency_table *vals; | 654 | struct cpufreq_frequency_table *vals; |
| @@ -156,7 +156,7 @@ · 155 unmodified lines | |||
| 156 | #define AT_XDMAC_CC_WRIP (0x1 << 23) /* Write in Progress (read only) */ | 156 | #define AT_XDMAC_CC_WRIP (0x1 << 23) /* Write in Progress (read only) */ |
| 157 | #define AT_XDMAC_CC_WRIP_DONE (0x0 << 23) | 157 | #define AT_XDMAC_CC_WRIP_DONE (0x0 << 23) |
| 158 | #define AT_XDMAC_CC_WRIP_IN_PROGRESS (0x1 << 23) | 158 | #define AT_XDMAC_CC_WRIP_IN_PROGRESS (0x1 << 23) |
| 159 | #define AT_XDMAC_CC_PERID(i) (0x7f & (h) << 24) /* Channel Peripheral Identifier */ | 159 | #define AT_XDMAC_CC_PERID(i) (0x7f & (i) << 24) /* Channel Peripheral Identifier */ |
| 160 | #define AT_XDMAC_CDS_MSP 0x2C /* Channel Data Stride Memory Set Pattern */ | 160 | #define AT_XDMAC_CDS_MSP 0x2C /* Channel Data Stride Memory Set Pattern */ |
| 161 | #define AT_XDMAC_CSUS 0x30 /* Channel Source Microblock Stride */ | 161 | #define AT_XDMAC_CSUS 0x30 /* Channel Source Microblock Stride */ |
| 162 | #define AT_XDMAC_CDUS 0x34 /* Channel Destination Microblock Stride */ | 162 | #define AT_XDMAC_CDUS 0x34 /* Channel Destination Microblock Stride */ |
| @@ -965,7 +965,9 @@ at_xdmac_prep_interleaved(struct dma_chan *chan, · 802 unmodified lines | |||
| 965 | NULL, | 965 | NULL, |
| 966 | src_addr, dst_addr, | 966 | src_addr, dst_addr, |
| 967 | xt, xt->sgl); | 967 | xt, xt->sgl); |
| 968 | for (i = 0; i < xt->numf; i++) | 968 | |
| 969 | /* Length of the block is (BLEN+1) microblocks. */ | ||
| 970 | for (i = 0; i < xt->numf - 1; i++) | ||
| 969 | at_xdmac_increment_block_count(chan, first); | 971 | at_xdmac_increment_block_count(chan, first); |
| 970 | 972 | ||
| 971 | dev_dbg(chan2dev(chan), "%s: add desc 0x%p to descs_list 0x%p\n", | 973 | dev_dbg(chan2dev(chan), "%s: add desc 0x%p to descs_list 0x%p\n", |
| @@ -1086,6 +1088,7 @@ at_xdmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, · 114 unmodified lines | |||
| 1086 | /* Check remaining length and change data width if needed. */ | 1088 | /* Check remaining length and change data width if needed. */ |
| 1087 | dwidth = at_xdmac_align_width(chan, | 1089 | dwidth = at_xdmac_align_width(chan, |
| 1088 | src_addr | dst_addr | xfer_size); | 1090 | src_addr | dst_addr | xfer_size); |
| 1091 | chan_cc &= ~AT_XDMAC_CC_DWIDTH_MASK; | ||
| 1089 | chan_cc |= AT_XDMAC_CC_DWIDTH(dwidth); | 1092 | chan_cc |= AT_XDMAC_CC_DWIDTH(dwidth); |
| 1090 | 1093 | ||
| 1091 | ublen = xfer_size >> dwidth; | 1094 | ublen = xfer_size >> dwidth; |
| @@ -1333,7 +1336,7 @@ at_xdmac_prep_dma_memset_sg(struct dma_chan *chan, struct scatterlist *sgl, · 241 unmodified lines | |||
| 1333 | * since we don't care about the stride anymore. | 1336 | * since we don't care about the stride anymore. |
| 1334 | */ | 1337 | */ |
| 1335 | if ((i == (sg_len - 1)) && | 1338 | if ((i == (sg_len - 1)) && |
| 1336 | sg_dma_len(ppsg) == sg_dma_len(psg)) { | 1339 | sg_dma_len(psg) == sg_dma_len(sg)) { |
| 1337 | dev_dbg(chan2dev(chan), | 1340 | dev_dbg(chan2dev(chan), |
| 1338 | "%s: desc 0x%p can be merged with desc 0x%p\n", | 1341 | "%s: desc 0x%p can be merged with desc 0x%p\n", |
| 1339 | __func__, desc, pdesc); | 1342 | __func__, desc, pdesc); |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | |||
| 31 | */ | 31 | */ |
| 32 | #include <linux/dmaengine.h> | 32 | #include <linux/dmaengine.h> |
| 33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
| 34 | #include <linux/dmapool.h> | ||
| 34 | #include <linux/err.h> | 35 | #include <linux/err.h> |
| 35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
| 36 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
| @@ -62,6 +63,11 @@ struct bcm2835_dma_cb { · 25 unmodified lines | |||
| 62 | uint32_t pad[2]; | 63 | uint32_t pad[2]; |
| 63 | }; | 64 | }; |
| 64 | 65 | ||
| 66 | struct bcm2835_cb_entry { | ||
| 67 | struct bcm2835_dma_cb *cb; | ||
| 68 | dma_addr_t paddr; | ||
| 69 | }; | ||
| 70 | |||
| 65 | struct bcm2835_chan { | 71 | struct bcm2835_chan { |
| 66 | struct virt_dma_chan vc; | 72 | struct virt_dma_chan vc; |
| 67 | struct list_head node; | 73 | struct list_head node; |
| @@ -72,18 +78,18 @@ struct bcm2835_chan { · 4 unmodified lines | |||
| 72 | 78 | ||
| 73 | int ch; | 79 | int ch; |
| 74 | struct bcm2835_desc *desc; | 80 | struct bcm2835_desc *desc; |
| 81 | struct dma_pool *cb_pool; | ||
| 75 | 82 | ||
| 76 | void __iomem *chan_base; | 83 | void __iomem *chan_base; |
| 77 | int irq_number; | 84 | int irq_number; |
| 78 | }; | 85 | }; |
| 79 | 86 | ||
| 80 | struct bcm2835_desc { | 87 | struct bcm2835_desc { |
| 88 | struct bcm2835_chan *c; | ||
| 81 | struct virt_dma_desc vd; | 89 | struct virt_dma_desc vd; |
| 82 | enum dma_transfer_direction dir; | 90 | enum dma_transfer_direction dir; |
| 83 | 91 | ||
| 84 | unsigned int control_block_size; | 92 | struct bcm2835_cb_entry *cb_list; |
| 85 | struct bcm2835_dma_cb *control_block_base; | ||
| 86 | dma_addr_t control_block_base_phys; | ||
| 87 | 93 | ||
| 88 | unsigned int frames; | 94 | unsigned int frames; |
| 89 | size_t size; | 95 | size_t size; |
| @@ -143,10 +149,13 @@ static inline struct bcm2835_desc *to_bcm2835_dma_desc( · 53 unmodified lines | |||
| 143 | static void bcm2835_dma_desc_free(struct virt_dma_desc *vd) | 149 | static void bcm2835_dma_desc_free(struct virt_dma_desc *vd) |
| 144 | { | 150 | { |
| 145 | struct bcm2835_desc *desc = container_of(vd, struct bcm2835_desc, vd); | 151 | struct bcm2835_desc *desc = container_of(vd, struct bcm2835_desc, vd); |
| 146 | dma_free_coherent(desc->vd.tx.chan->device->dev, | 152 | int i; |
| 147 | desc->control_block_size, | 153 | |
| 148 | desc->control_block_base, | 154 | for (i = 0; i < desc->frames; i++) |
| 149 | desc->control_block_base_phys); | 155 | dma_pool_free(desc->c->cb_pool, desc->cb_list[i].cb, |
| 156 | desc->cb_list[i].paddr); | ||
| 157 | |||
| 158 | kfree(desc->cb_list); | ||
| 150 | kfree(desc); | 159 | kfree(desc); |
| 151 | } | 160 | } |
| 152 | 161 | ||
| @@ -199,7 +208,7 @@ static void bcm2835_dma_start_desc(struct bcm2835_chan *c) · 46 unmodified lines | |||
| 199 | 208 | ||
| 200 | c->desc = d = to_bcm2835_dma_desc(&vd->tx); | 209 | c->desc = d = to_bcm2835_dma_desc(&vd->tx); |
| 201 | 210 | ||
| 202 | writel(d->control_block_base_phys, c->chan_base + BCM2835_DMA_ADDR); | 211 | writel(d->cb_list[0].paddr, c->chan_base + BCM2835_DMA_ADDR); |
| 203 | writel(BCM2835_DMA_ACTIVE, c->chan_base + BCM2835_DMA_CS); | 212 | writel(BCM2835_DMA_ACTIVE, c->chan_base + BCM2835_DMA_CS); |
| 204 | } | 213 | } |
| 205 | 214 | ||
| @@ -232,9 +241,16 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) · 26 unmodified lines | |||
| 232 | static int bcm2835_dma_alloc_chan_resources(struct dma_chan *chan) | 241 | static int bcm2835_dma_alloc_chan_resources(struct dma_chan *chan) |
| 233 | { | 242 | { |
| 234 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); | 243 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); |
| 244 | struct device *dev = c->vc.chan.device->dev; | ||
| 245 | |||
| 246 | dev_dbg(dev, "Allocating DMA channel %d\n", c->ch); | ||
| 235 | 247 | ||
| 236 | dev_dbg(c->vc.chan.device->dev, | 248 | c->cb_pool = dma_pool_create(dev_name(dev), dev, |
| 237 | "Allocating DMA channel %d\n", c->ch); | 249 | sizeof(struct bcm2835_dma_cb), 0, 0); |
| 250 | if (!c->cb_pool) { | ||
| 251 | dev_err(dev, "unable to allocate descriptor pool\n"); | ||
| 252 | return -ENOMEM; | ||
| 253 | } | ||
| 238 | 254 | ||
| 239 | return request_irq(c->irq_number, | 255 | return request_irq(c->irq_number, |
| 240 | bcm2835_dma_callback, 0, "DMA IRQ", c); | 256 | bcm2835_dma_callback, 0, "DMA IRQ", c); |
| @@ -246,6 +262,7 @@ static void bcm2835_dma_free_chan_resources(struct dma_chan *chan) · 5 unmodified lines | |||
| 246 | 262 | ||
| 247 | vchan_free_chan_resources(&c->vc); | 263 | vchan_free_chan_resources(&c->vc); |
| 248 | free_irq(c->irq_number, c); | 264 | free_irq(c->irq_number, c); |
| 265 | dma_pool_destroy(c->cb_pool); | ||
| 249 | 266 | ||
| 250 | dev_dbg(c->vc.chan.device->dev, "Freeing DMA channel %u\n", c->ch); | 267 | dev_dbg(c->vc.chan.device->dev, "Freeing DMA channel %u\n", c->ch); |
| 251 | } | 268 | } |
| @@ -261,8 +278,7 @@ static size_t bcm2835_dma_desc_size_pos(struct bcm2835_desc *d, dma_addr_t addr) · 9 unmodified lines | |||
| 261 | size_t size; | 278 | size_t size; |
| 262 | 279 | ||
| 263 | for (size = i = 0; i < d->frames; i++) { | 280 | for (size = i = 0; i < d->frames; i++) { |
| 264 | struct bcm2835_dma_cb *control_block = | 281 | struct bcm2835_dma_cb *control_block = d->cb_list[i].cb; |
| 265 | &d->control_block_base[i]; | ||
| 266 | size_t this_size = control_block->length; | 282 | size_t this_size = control_block->length; |
| 267 | dma_addr_t dma; | 283 | dma_addr_t dma; |
| 268 | 284 | ||
| @@ -343,6 +359,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( · 74 unmodified lines | |||
| 343 | dma_addr_t dev_addr; | 359 | dma_addr_t dev_addr; |
| 344 | unsigned int es, sync_type; | 360 | unsigned int es, sync_type; |
| 345 | unsigned int frame; | 361 | unsigned int frame; |
| 362 | int i; | ||
| 346 | 363 | ||
| 347 | /* Grab configuration */ | 364 | /* Grab configuration */ |
| 348 | if (!is_slave_direction(direction)) { | 365 | if (!is_slave_direction(direction)) { |
| @@ -374,27 +391,31 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( · 25 unmodified lines | |||
| 374 | if (!d) | 391 | if (!d) |
| 375 | return NULL; | 392 | return NULL; |
| 376 | 393 | ||
| 394 | d->c = c; | ||
| 377 | d->dir = direction; | 395 | d->dir = direction; |
| 378 | d->frames = buf_len / period_len; | 396 | d->frames = buf_len / period_len; |
| 379 | 397 | ||
| 380 | /* Allocate memory for control blocks */ | 398 | d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL); |
| 381 | d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb); | 399 | if (!d->cb_list) { |
| 382 | d->control_block_base = dma_zalloc_coherent(chan->device->dev, | ||
| 383 | d->control_block_size, &d->control_block_base_phys, | ||
| 384 | GFP_NOWAIT); | ||
| 385 | |||
| 386 | if (!d->control_block_base) { | ||
| 387 | kfree(d); | 400 | kfree(d); |
| 388 | return NULL; | 401 | return NULL; |
| 389 | } | 402 | } |
| 403 | /* Allocate memory for control blocks */ | ||
| 404 | for (i = 0; i < d->frames; i++) { | ||
| 405 | struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; | ||
| 406 | |||
| 407 | cb_entry->cb = dma_pool_zalloc(c->cb_pool, GFP_ATOMIC, | ||
| 408 | &cb_entry->paddr); | ||
| 409 | if (!cb_entry->cb) | ||
| 410 | goto error_cb; | ||
| 411 | } | ||
| 390 | 412 | ||
| 391 | /* | 413 | /* |
| 392 | * Iterate over all frames, create a control block | 414 | * Iterate over all frames, create a control block |
| 393 | * for each frame and link them together. | 415 | * for each frame and link them together. |
| 394 | */ | 416 | */ |
| 395 | for (frame = 0; frame < d->frames; frame++) { | 417 | for (frame = 0; frame < d->frames; frame++) { |
| 396 | struct bcm2835_dma_cb *control_block = | 418 | struct bcm2835_dma_cb *control_block = d->cb_list[frame].cb; |
| 397 | &d->control_block_base[frame]; | ||
| 398 | 419 | ||
| 399 | /* Setup adresses */ | 420 | /* Setup adresses */ |
| 400 | if (d->dir == DMA_DEV_TO_MEM) { | 421 | if (d->dir == DMA_DEV_TO_MEM) { |
| @@ -428,12 +449,21 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( · 27 unmodified lines | |||
| 428 | * This DMA engine driver currently only supports cyclic DMA. | 449 | * This DMA engine driver currently only supports cyclic DMA. |
| 429 | * Therefore, wrap around at number of frames. | 450 | * Therefore, wrap around at number of frames. |
| 430 | */ | 451 | */ |
| 431 | control_block->next = d->control_block_base_phys + | 452 | control_block->next = d->cb_list[((frame + 1) % d->frames)].paddr; |
| 432 | sizeof(struct bcm2835_dma_cb) | ||
| 433 | * ((frame + 1) % d->frames); | ||
| 434 | } | 453 | } |
| 435 | 454 | ||
| 436 | return vchan_tx_prep(&c->vc, &d->vd, flags); | 455 | return vchan_tx_prep(&c->vc, &d->vd, flags); |
| 456 | error_cb: | ||
| 457 | i--; | ||
| 458 | for (; i >= 0; i--) { | ||
| 459 | struct bcm2835_cb_entry *cb_entry = &d->cb_list[i]; | ||
| 460 | |||
| 461 | dma_pool_free(c->cb_pool, cb_entry->cb, cb_entry->paddr); | ||
| 462 | } | ||
| 463 | |||
| 464 | kfree(d->cb_list); | ||
| 465 | kfree(d); | ||
| 466 | return NULL; | ||
| 437 | } | 467 | } |
| 438 | 468 | ||
| 439 | static int bcm2835_dma_slave_config(struct dma_chan *chan, | 469 | static int bcm2835_dma_slave_config(struct dma_chan *chan, |
| @@ -1752,16 +1752,14 @@ static enum dma_status edma_tx_status(struct dma_chan *chan, · 1751 unmodified lines | |||
| 1752 | return ret; | 1752 | return ret; |
| 1753 | } | 1753 | } |
| 1754 | 1754 | ||
| 1755 | static bool edma_is_memcpy_channel(int ch_num, u16 *memcpy_channels) | 1755 | static bool edma_is_memcpy_channel(int ch_num, s32 *memcpy_channels) |
| 1756 | { | 1756 | { |
| 1757 | s16 *memcpy_ch = memcpy_channels; | ||
| 1758 | |||
| 1759 | if (!memcpy_channels) | 1757 | if (!memcpy_channels) |
| 1760 | return false; | 1758 | return false; |
| 1761 | while (*memcpy_ch != -1) { | 1759 | while (*memcpy_channels != -1) { |
| 1762 | if (*memcpy_ch == ch_num) | 1760 | if (*memcpy_channels == ch_num) |
| 1763 | return true; | 1761 | return true; |
| 1764 | memcpy_ch++; | 1762 | memcpy_channels++; |
| 1765 | } | 1763 | } |
| 1766 | return false; | 1764 | return false; |
| 1767 | } | 1765 | } |
| @@ -1775,7 +1773,7 @@ static void edma_dma_init(struct edma_cc *ecc, bool legacy_mode) · 7 unmodified lines | |||
| 1775 | { | 1773 | { |
| 1776 | struct dma_device *s_ddev = &ecc->dma_slave; | 1774 | struct dma_device *s_ddev = &ecc->dma_slave; |
| 1777 | struct dma_device *m_ddev = NULL; | 1775 | struct dma_device *m_ddev = NULL; |
| 1778 | s16 *memcpy_channels = ecc->info->memcpy_channels; | 1776 | s32 *memcpy_channels = ecc->info->memcpy_channels; |
| 1779 | int i, j; | 1777 | int i, j; |
| 1780 | 1778 | ||
| 1781 | dma_cap_zero(s_ddev->cap_mask); | 1779 | dma_cap_zero(s_ddev->cap_mask); |
| @@ -1996,16 +1994,16 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev, · 214 unmodified lines | |||
| 1996 | prop = of_find_property(dev->of_node, "ti,edma-memcpy-channels", &sz); | 1994 | prop = of_find_property(dev->of_node, "ti,edma-memcpy-channels", &sz); |
| 1997 | if (prop) { | 1995 | if (prop) { |
| 1998 | const char pname[] = "ti,edma-memcpy-channels"; | 1996 | const char pname[] = "ti,edma-memcpy-channels"; |
| 1999 | size_t nelm = sz / sizeof(s16); | 1997 | size_t nelm = sz / sizeof(s32); |
| 2000 | s16 *memcpy_ch; | 1998 | s32 *memcpy_ch; |
| 2001 | 1999 | ||
| 2002 | memcpy_ch = devm_kcalloc(dev, nelm + 1, sizeof(s16), | 2000 | memcpy_ch = devm_kcalloc(dev, nelm + 1, sizeof(s32), |
| 2003 | GFP_KERNEL); | 2001 | GFP_KERNEL); |
| 2004 | if (!memcpy_ch) | 2002 | if (!memcpy_ch) |
| 2005 | return ERR_PTR(-ENOMEM); | 2003 | return ERR_PTR(-ENOMEM); |
| 2006 | 2004 | ||
| 2007 | ret = of_property_read_u16_array(dev->of_node, pname, | 2005 | ret = of_property_read_u32_array(dev->of_node, pname, |
| 2008 | (u16 *)memcpy_ch, nelm); | 2006 | (u32 *)memcpy_ch, nelm); |
| 2009 | if (ret) | 2007 | if (ret) |
| 2010 | return ERR_PTR(ret); | 2008 | return ERR_PTR(ret); |
| 2011 | 2009 | ||
| @@ -2017,31 +2015,50 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev, · 5 unmodified lines | |||
| 2017 | &sz); | 2015 | &sz); |
| 2018 | if (prop) { | 2016 | if (prop) { |
| 2019 | const char pname[] = "ti,edma-reserved-slot-ranges"; | 2017 | const char pname[] = "ti,edma-reserved-slot-ranges"; |
| 2018 | u32 (*tmp)[2]; | ||
| 2020 | s16 (*rsv_slots)[2]; | 2019 | s16 (*rsv_slots)[2]; |
| 2021 | size_t nelm = sz / sizeof(*rsv_slots); | 2020 | size_t nelm = sz / sizeof(*tmp); |
| 2022 | struct edma_rsv_info *rsv_info; | 2021 | struct edma_rsv_info *rsv_info; |
| 2022 | int i; | ||
| 2023 | 2023 | ||
| 2024 | if (!nelm) | 2024 | if (!nelm) |
| 2025 | return info; | 2025 | return info; |
| 2026 | 2026 | ||
| 2027 | tmp = kcalloc(nelm, sizeof(*tmp), GFP_KERNEL); | ||
| 2028 | if (!tmp) | ||
| 2029 | return ERR_PTR(-ENOMEM); | ||
| 2030 | |||
| 2027 | rsv_info = devm_kzalloc(dev, sizeof(*rsv_info), GFP_KERNEL); | 2031 | rsv_info = devm_kzalloc(dev, sizeof(*rsv_info), GFP_KERNEL); |
| 2028 | if (!rsv_info) | 2032 | if (!rsv_info) { |
| 2033 | kfree(tmp); | ||
| 2029 | return ERR_PTR(-ENOMEM); | 2034 | return ERR_PTR(-ENOMEM); |
| 2035 | } | ||
| 2030 | 2036 | ||
| 2031 | rsv_slots = devm_kcalloc(dev, nelm + 1, sizeof(*rsv_slots), | 2037 | rsv_slots = devm_kcalloc(dev, nelm + 1, sizeof(*rsv_slots), |
| 2032 | GFP_KERNEL); | 2038 | GFP_KERNEL); |
| 2033 | if (!rsv_slots) | 2039 | if (!rsv_slots) { |
| 2040 | kfree(tmp); | ||
| 2034 | return ERR_PTR(-ENOMEM); | 2041 | return ERR_PTR(-ENOMEM); |
| 2042 | } | ||
| 2035 | 2043 | ||
| 2036 | ret = of_property_read_u16_array(dev->of_node, pname, | 2044 | ret = of_property_read_u32_array(dev->of_node, pname, |
| 2037 | (u16 *)rsv_slots, nelm * 2); | 2045 | (u32 *)tmp, nelm * 2); |
| 2038 | if (ret) | 2046 | if (ret) { |
| 2047 | kfree(tmp); | ||
| 2039 | return ERR_PTR(ret); | 2048 | return ERR_PTR(ret); |
| 2049 | } | ||
| 2040 | 2050 | ||
| 2051 | for (i = 0; i < nelm; i++) { | ||
| 2052 | rsv_slots[i][0] = tmp[i][0]; | ||
| 2053 | rsv_slots[i][1] = tmp[i][1]; | ||
| 2054 | } | ||
| 2041 | rsv_slots[nelm][0] = -1; | 2055 | rsv_slots[nelm][0] = -1; |
| 2042 | rsv_slots[nelm][1] = -1; | 2056 | rsv_slots[nelm][1] = -1; |
| 2057 | |||
| 2043 | info->rsv = rsv_info; | 2058 | info->rsv = rsv_info; |
| 2044 | info->rsv->rsv_slots = (const s16 (*)[2])rsv_slots; | 2059 | info->rsv->rsv_slots = (const s16 (*)[2])rsv_slots; |
| 2060 | |||
| 2061 | kfree(tmp); | ||
| 2045 | } | 2062 | } |
| 2046 | 2063 | ||
| 2047 | return info; | 2064 | return info; |
| @@ -317,6 +317,7 @@ mic_dma_prep_memcpy_lock(struct dma_chan *ch, dma_addr_t dma_dest, · 316 unmodified lines | |||
| 317 | struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); | 317 | struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); |
| 318 | struct device *dev = mic_dma_ch_to_device(mic_ch); | 318 | struct device *dev = mic_dma_ch_to_device(mic_ch); |
| 319 | int result; | 319 | int result; |
| 320 | struct dma_async_tx_descriptor *tx = NULL; | ||
| 320 | 321 | ||
| 321 | if (!len && !flags) | 322 | if (!len && !flags) |
| 322 | return NULL; | 323 | return NULL; |
| @@ -324,10 +325,13 @@ mic_dma_prep_memcpy_lock(struct dma_chan *ch, dma_addr_t dma_dest, · 1 unmodified line | |||
| 324 | spin_lock(&mic_ch->prep_lock); | 325 | spin_lock(&mic_ch->prep_lock); |
| 325 | result = mic_dma_do_dma(mic_ch, flags, dma_src, dma_dest, len); | 326 | result = mic_dma_do_dma(mic_ch, flags, dma_src, dma_dest, len); |
| 326 | if (result >= 0) | 327 | if (result >= 0) |
| 327 | return allocate_tx(mic_ch); | 328 | tx = allocate_tx(mic_ch); |
| 328 | dev_err(dev, "Error enqueueing dma, error=%d\n", result); | 329 | |
| 330 | if (!tx) | ||
| 331 | dev_err(dev, "Error enqueueing dma, error=%d\n", result); | ||
| 332 | |||
| 329 | spin_unlock(&mic_ch->prep_lock); | 333 | spin_unlock(&mic_ch->prep_lock); |
| 330 | return NULL; | 334 | return tx; |
| 331 | } | 335 | } |
| 332 | 336 | ||
| 333 | static struct dma_async_tx_descriptor * | 337 | static struct dma_async_tx_descriptor * |
| @@ -335,13 +339,14 @@ mic_dma_prep_interrupt_lock(struct dma_chan *ch, unsigned long flags) · 1 unmodified line | |||
| 335 | { | 339 | { |
| 336 | struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); | 340 | struct mic_dma_chan *mic_ch = to_mic_dma_chan(ch); |
| 337 | int ret; | 341 | int ret; |
| 342 | struct dma_async_tx_descriptor *tx = NULL; | ||
| 338 | 343 | ||
| 339 | spin_lock(&mic_ch->prep_lock); | 344 | spin_lock(&mic_ch->prep_lock); |
| 340 | ret = mic_dma_do_dma(mic_ch, flags, 0, 0, 0); | 345 | ret = mic_dma_do_dma(mic_ch, flags, 0, 0, 0); |
| 341 | if (!ret) | 346 | if (!ret) |
| 342 | return allocate_tx(mic_ch); | 347 | tx = allocate_tx(mic_ch); |
| 343 | spin_unlock(&mic_ch->prep_lock); | 348 | spin_unlock(&mic_ch->prep_lock); |
| 344 | return NULL; | 349 | return tx; |
| 345 | } | 350 | } |
| 346 | 351 | ||
| 347 | /* Return the status of the transaction */ | 352 | /* Return the status of the transaction */ |
| @@ -122,12 +122,10 @@ int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags, · 121 unmodified lines | |||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | ret = fpga_mgr_buf_load(mgr, flags, fw->data, fw->size); | 124 | ret = fpga_mgr_buf_load(mgr, flags, fw->data, fw->size); |
| 125 | if (ret) | ||
| 126 | return ret; | ||
| 127 | 125 | ||
| 128 | release_firmware(fw); | 126 | release_firmware(fw); |
| 129 | 127 | ||
| 130 | return 0; | 128 | return ret; |
| 131 | } | 129 | } |
| 132 | EXPORT_SYMBOL_GPL(fpga_mgr_firmware_load); | 130 | EXPORT_SYMBOL_GPL(fpga_mgr_firmware_load); |
| 133 | 131 | ||
| @@ -256,7 +254,6 @@ int fpga_mgr_register(struct device *dev, const char *name, · 122 unmodified lines | |||
| 256 | void *priv) | 254 | void *priv) |
| 257 | { | 255 | { |
| 258 | struct fpga_manager *mgr; | 256 | struct fpga_manager *mgr; |
| 259 | const char *dt_label; | ||
| 260 | int id, ret; | 257 | int id, ret; |
| 261 | 258 | ||
| 262 | if (!mops || !mops->write_init || !mops->write || | 259 | if (!mops || !mops->write_init || !mops->write || |
| @@ -300,11 +297,9 @@ int fpga_mgr_register(struct device *dev, const char *name, · 37 unmodified lines | |||
| 300 | mgr->dev.id = id; | 297 | mgr->dev.id = id; |
| 301 | dev_set_drvdata(dev, mgr); | 298 | dev_set_drvdata(dev, mgr); |
| 302 | 299 | ||
| 303 | dt_label = of_get_property(mgr->dev.of_node, "label", NULL); | 300 | ret = dev_set_name(&mgr->dev, "fpga%d", id); |
| 304 | if (dt_label) | 301 | if (ret) |
| 305 | ret = dev_set_name(&mgr->dev, "%s", dt_label); | 302 | goto error_device; |
| 306 | else | ||
| 307 | ret = dev_set_name(&mgr->dev, "fpga%d", id); | ||
| 308 | 303 | ||
| 309 | ret = device_add(&mgr->dev); | 304 | ret = device_add(&mgr->dev); |
| 310 | if (ret) | 305 | if (ret) |
| @@ -113,7 +113,7 @@ static int ar934x_gpio_direction_output(struct gpio_chip *chip, unsigned offset, · 112 unmodified lines | |||
| 113 | __raw_writel(BIT(offset), ctrl->base + AR71XX_GPIO_REG_CLEAR); | 113 | __raw_writel(BIT(offset), ctrl->base + AR71XX_GPIO_REG_CLEAR); |
| 114 | 114 | ||
| 115 | __raw_writel( | 115 | __raw_writel( |
| 116 | __raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) & BIT(offset), | 116 | __raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) & ~BIT(offset), |
| 117 | ctrl->base + AR71XX_GPIO_REG_OE); | 117 | ctrl->base + AR71XX_GPIO_REG_OE); |
| 118 | 118 | ||
| 119 | spin_unlock_irqrestore(&ctrl->lock, flags); | 119 | spin_unlock_irqrestore(&ctrl->lock, flags); |
| @@ -141,9 +141,9 @@ static int bgpio_get_set(struct gpio_chip *gc, unsigned int gpio) · 140 unmodified lines | |||
| 141 | unsigned long pinmask = bgc->pin2mask(bgc, gpio); | 141 | unsigned long pinmask = bgc->pin2mask(bgc, gpio); |
| 142 | 142 | ||
| 143 | if (bgc->dir & pinmask) | 143 | if (bgc->dir & pinmask) |
| 144 | return bgc->read_reg(bgc->reg_set) & pinmask; | 144 | return !!(bgc->read_reg(bgc->reg_set) & pinmask); |
| 145 | else | 145 | else |
| 146 | return bgc->read_reg(bgc->reg_dat) & pinmask; | 146 | return !!(bgc->read_reg(bgc->reg_dat) & pinmask); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | static int bgpio_get(struct gpio_chip *gc, unsigned int gpio) | 149 | static int bgpio_get(struct gpio_chip *gc, unsigned int gpio) |
| @@ -1279,7 +1279,13 @@ static int _gpiod_get_raw_value(const struct gpio_desc *desc) · 1278 unmodified lines | |||
| 1279 | chip = desc->chip; | 1279 | chip = desc->chip; |
| 1280 | offset = gpio_chip_hwgpio(desc); | 1280 | offset = gpio_chip_hwgpio(desc); |
| 1281 | value = chip->get ? chip->get(chip, offset) : -EIO; | 1281 | value = chip->get ? chip->get(chip, offset) : -EIO; |
| 1282 | value = value < 0 ? value : !!value; | 1282 | /* |
| 1283 | * FIXME: fix all drivers to clamp to [0,1] or return negative, | ||
| 1284 | * then change this to: | ||
| 1285 | * value = value < 0 ? value : !!value; | ||
| 1286 | * so we can properly propagate error codes. | ||
| 1287 | */ | ||
| 1288 | value = !!value; | ||
| 1283 | trace_gpio_value(desc_to_gpio(desc), 1, value); | 1289 | trace_gpio_value(desc_to_gpio(desc), 1, value); |
| 1284 | return value; | 1290 | return value; |
| 1285 | } | 1291 | } |
| @@ -1266,7 +1266,8 @@ struct amdgpu_cs_parser { · 1265 unmodified lines | |||
| 1266 | struct ww_acquire_ctx ticket; | 1266 | struct ww_acquire_ctx ticket; |
| 1267 | 1267 | ||
| 1268 | /* user fence */ | 1268 | /* user fence */ |
| 1269 | struct amdgpu_user_fence uf; | 1269 | struct amdgpu_user_fence uf; |
| 1270 | struct amdgpu_bo_list_entry uf_entry; | ||
| 1270 | }; | 1271 | }; |
| 1271 | 1272 | ||
| 1272 | struct amdgpu_job { | 1273 | struct amdgpu_job { |
| @@ -127,6 +127,37 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · 126 unmodified lines | |||
| 127 | return 0; | 127 | return 0; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, | ||
| 131 | struct drm_amdgpu_cs_chunk_fence *fence_data) | ||
| 132 | { | ||
| 133 | struct drm_gem_object *gobj; | ||
| 134 | uint32_t handle; | ||
| 135 | |||
| 136 | handle = fence_data->handle; | ||
| 137 | gobj = drm_gem_object_lookup(p->adev->ddev, p->filp, | ||
| 138 | fence_data->handle); | ||
| 139 | if (gobj == NULL) | ||
| 140 | return -EINVAL; | ||
| 141 | |||
| 142 | p->uf.bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj)); | ||
| 143 | p->uf.offset = fence_data->offset; | ||
| 144 | |||
| 145 | if (amdgpu_ttm_tt_has_userptr(p->uf.bo->tbo.ttm)) { | ||
| 146 | drm_gem_object_unreference_unlocked(gobj); | ||
| 147 | return -EINVAL; | ||
| 148 | } | ||
| 149 | |||
| 150 | p->uf_entry.robj = amdgpu_bo_ref(p->uf.bo); | ||
| 151 | p->uf_entry.prefered_domains = AMDGPU_GEM_DOMAIN_GTT; | ||
| 152 | p->uf_entry.allowed_domains = AMDGPU_GEM_DOMAIN_GTT; | ||
| 153 | p->uf_entry.priority = 0; | ||
| 154 | p->uf_entry.tv.bo = &p->uf_entry.robj->tbo; | ||
| 155 | p->uf_entry.tv.shared = true; | ||
| 156 | |||
| 157 | drm_gem_object_unreference_unlocked(gobj); | ||
| 158 | return 0; | ||
| 159 | } | ||
| 160 | |||
| 130 | int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) | 161 | int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) |
| 131 | { | 162 | { |
| 132 | union drm_amdgpu_cs *cs = data; | 163 | union drm_amdgpu_cs *cs = data; |
| @@ -207,28 +238,15 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) · 74 unmodified lines | |||
| 207 | 238 | ||
| 208 | case AMDGPU_CHUNK_ID_FENCE: | 239 | case AMDGPU_CHUNK_ID_FENCE: |
| 209 | size = sizeof(struct drm_amdgpu_cs_chunk_fence); | 240 | size = sizeof(struct drm_amdgpu_cs_chunk_fence); |
| 210 | if (p->chunks[i].length_dw * sizeof(uint32_t) >= size) { | 241 | if (p->chunks[i].length_dw * sizeof(uint32_t) < size) { |
| 211 | uint32_t handle; | ||
| 212 | struct drm_gem_object *gobj; | ||
| 213 | struct drm_amdgpu_cs_chunk_fence *fence_data; | ||
| 214 | |||
| 215 | fence_data = (void *)p->chunks[i].kdata; | ||
| 216 | handle = fence_data->handle; | ||
| 217 | gobj = drm_gem_object_lookup(p->adev->ddev, | ||
| 218 | p->filp, handle); | ||
| 219 | if (gobj == NULL) { | ||
| 220 | ret = -EINVAL; | ||
| 221 | goto free_partial_kdata; | ||
| 222 | } | ||
| 223 | |||
| 224 | p->uf.bo = gem_to_amdgpu_bo(gobj); | ||
| 225 | amdgpu_bo_ref(p->uf.bo); | ||
| 226 | drm_gem_object_unreference_unlocked(gobj); | ||
| 227 | p->uf.offset = fence_data->offset; | ||
| 228 | } else { | ||
| 229 | ret = -EINVAL; | 242 | ret = -EINVAL; |
| 230 | goto free_partial_kdata; | 243 | goto free_partial_kdata; |
| 231 | } | 244 | } |
| 245 | |||
| 246 | ret = amdgpu_cs_user_fence_chunk(p, (void *)p->chunks[i].kdata); | ||
| 247 | if (ret) | ||
| 248 | goto free_partial_kdata; | ||
| 249 | |||
| 232 | break; | 250 | break; |
| 233 | 251 | ||
| 234 | case AMDGPU_CHUNK_ID_DEPENDENCIES: | 252 | case AMDGPU_CHUNK_ID_DEPENDENCIES: |
| @@ -391,6 +409,9 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p) · 156 unmodified lines | |||
| 391 | INIT_LIST_HEAD(&duplicates); | 409 | INIT_LIST_HEAD(&duplicates); |
| 392 | amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd); | 410 | amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd); |
| 393 | 411 | ||
| 412 | if (p->uf.bo) | ||
| 413 | list_add(&p->uf_entry.tv.head, &p->validated); | ||
| 414 | |||
| 394 | if (need_mmap_lock) | 415 | if (need_mmap_lock) |
| 395 | down_read(¤t->mm->mmap_sem); | 416 | down_read(¤t->mm->mmap_sem); |
| 396 | 417 | ||
| @@ -488,8 +509,8 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bo · 91 unmodified lines | |||
| 488 | for (i = 0; i < parser->num_ibs; i++) | 509 | for (i = 0; i < parser->num_ibs; i++) |
| 489 | amdgpu_ib_free(parser->adev, &parser->ibs[i]); | 510 | amdgpu_ib_free(parser->adev, &parser->ibs[i]); |
| 490 | kfree(parser->ibs); | 511 | kfree(parser->ibs); |
| 491 | if (parser->uf.bo) | 512 | amdgpu_bo_unref(&parser->uf.bo); |
| 492 | amdgpu_bo_unref(&parser->uf.bo); | 513 | amdgpu_bo_unref(&parser->uf_entry.robj); |
| 493 | } | 514 | } |
| 494 | 515 | ||
| 495 | static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p, | 516 | static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p, |
| @@ -476,6 +476,14 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, · 475 unmodified lines | |||
| 476 | if (domain == AMDGPU_GEM_DOMAIN_CPU) | 476 | if (domain == AMDGPU_GEM_DOMAIN_CPU) |
| 477 | goto error_unreserve; | 477 | goto error_unreserve; |
| 478 | } | 478 | } |
| 479 | list_for_each_entry(entry, &duplicates, head) { | ||
| 480 | domain = amdgpu_mem_type_to_domain(entry->bo->mem.mem_type); | ||
| 481 | /* if anything is swapped out don't swap it in here, | ||
| 482 | just abort and wait for the next CS */ | ||
| 483 | if (domain == AMDGPU_GEM_DOMAIN_CPU) | ||
| 484 | goto error_unreserve; | ||
| 485 | } | ||
| 486 | |||
| 479 | r = amdgpu_vm_update_page_directory(adev, bo_va->vm); | 487 | r = amdgpu_vm_update_page_directory(adev, bo_va->vm); |
| 480 | if (r) | 488 | if (r) |
| 481 | goto error_unreserve; | 489 | goto error_unreserve; |
| @@ -55,6 +55,9 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc, · 54 unmodified lines | |||
| 55 | { | 55 | { |
| 56 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); | 56 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
| 57 | 57 | ||
| 58 | if (!state->enable) | ||
| 59 | return 0; | ||
| 60 | |||
| 58 | if (exynos_crtc->ops->atomic_check) | 61 | if (exynos_crtc->ops->atomic_check) |
| 59 | return exynos_crtc->ops->atomic_check(exynos_crtc, state); | 62 | return exynos_crtc->ops->atomic_check(exynos_crtc, state); |
| 60 | 63 | ||
| @@ -14059,6 +14059,7 @@ intel_check_cursor_plane(struct drm_plane *plane, · 14058 unmodified lines | |||
| 14059 | struct drm_crtc *crtc = crtc_state->base.crtc; | 14059 | struct drm_crtc *crtc = crtc_state->base.crtc; |
| 14060 | struct drm_framebuffer *fb = state->base.fb; | 14060 | struct drm_framebuffer *fb = state->base.fb; |
| 14061 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); | 14061 | struct drm_i915_gem_object *obj = intel_fb_obj(fb); |
| 14062 | enum pipe pipe = to_intel_plane(plane)->pipe; | ||
| 14062 | unsigned stride; | 14063 | unsigned stride; |
| 14063 | int ret; | 14064 | int ret; |
| 14064 | 14065 | ||
| @@ -14092,6 +14093,22 @@ intel_check_cursor_plane(struct drm_plane *plane, · 27 unmodified lines | |||
| 14092 | return -EINVAL; | 14093 | return -EINVAL; |
| 14093 | } | 14094 | } |
| 14094 | 14095 | ||
| 14096 | /* | ||
| 14097 | * There's something wrong with the cursor on CHV pipe C. | ||
| 14098 | * If it straddles the left edge of the screen then | ||
| 14099 | * moving it away from the edge or disabling it often | ||
| 14100 | * results in a pipe underrun, and often that can lead to | ||
| 14101 | * dead pipe (constant underrun reported, and it scans | ||
| 14102 | * out just a solid color). To recover from that, the | ||
| 14103 | * display power well must be turned off and on again. | ||
| 14104 | * Refuse the put the cursor into that compromised position. | ||
| 14105 | */ | ||
| 14106 | if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C && | ||
| 14107 | state->visible && state->base.crtc_x < 0) { | ||
| 14108 | DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n"); | ||
| 14109 | return -EINVAL; | ||
| 14110 | } | ||
| 14111 | |||
| 14095 | return 0; | 14112 | return 0; |
| 14096 | } | 14113 | } |
| 14097 | 14114 | ||
| @@ -14124,7 +14141,8 @@ intel_commit_cursor_plane(struct drm_plane *plane, · 26 unmodified lines | |||
| 14124 | 14141 | ||
| 14125 | intel_crtc->cursor_addr = addr; | 14142 | intel_crtc->cursor_addr = addr; |
| 14126 | 14143 | ||
| 14127 | intel_crtc_update_cursor(crtc, state->visible); | 14144 | if (crtc->state->active) |
| 14145 | intel_crtc_update_cursor(crtc, state->visible); | ||
| 14128 | } | 14146 | } |
| 14129 | 14147 | ||
| 14130 | static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, | 14148 | static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, |
| @@ -1385,17 +1385,18 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) · 1384 unmodified lines | |||
| 1385 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); | 1385 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
| 1386 | struct drm_i915_private *dev_priv = to_i915(connector->dev); | 1386 | struct drm_i915_private *dev_priv = to_i915(connector->dev); |
| 1387 | bool live_status = false; | 1387 | bool live_status = false; |
| 1388 | unsigned int retry = 3; | 1388 | unsigned int try; |
| 1389 | 1389 | ||
| 1390 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", | 1390 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", |
| 1391 | connector->base.id, connector->name); | 1391 | connector->base.id, connector->name); |
| 1392 | 1392 | ||
| 1393 | intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS); | 1393 | intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS); |
| 1394 | 1394 | ||
| 1395 | while (!live_status && --retry) { | 1395 | for (try = 0; !live_status && try < 4; try++) { |
| 1396 | if (try) | ||
| 1397 | msleep(10); | ||
| 1396 | live_status = intel_digital_port_connected(dev_priv, | 1398 | live_status = intel_digital_port_connected(dev_priv, |
| 1397 | hdmi_to_dig_port(intel_hdmi)); | 1399 | hdmi_to_dig_port(intel_hdmi)); |
| 1398 | msleep(10); | ||
| 1399 | } | 1400 | } |
| 1400 | 1401 | ||
| 1401 | if (!live_status) | 1402 | if (!live_status) |
| @@ -4713,9 +4713,8 @@ static void gen9_enable_rc6(struct drm_device *dev) · 4712 unmodified lines | |||
| 4713 | * 3b: Enable Coarse Power Gating only when RC6 is enabled. | 4713 | * 3b: Enable Coarse Power Gating only when RC6 is enabled. |
| 4714 | * WaRsDisableCoarsePowerGating:skl,bxt - Render/Media PG need to be disabled with RC6. | 4714 | * WaRsDisableCoarsePowerGating:skl,bxt - Render/Media PG need to be disabled with RC6. |
| 4715 | */ | 4715 | */ |
| 4716 | if (IS_BXT_REVID(dev, 0, BXT_REVID_A1) || | 4716 | if ((IS_BROXTON(dev) && (INTEL_REVID(dev) < BXT_REVID_B0)) || |
| 4717 | ((IS_SKL_GT3(dev) || IS_SKL_GT4(dev)) && | 4717 | ((IS_SKL_GT3(dev) || IS_SKL_GT4(dev)) && (INTEL_REVID(dev) <= SKL_REVID_F0))) |
| 4718 | IS_SKL_REVID(dev, 0, SKL_REVID_F0))) | ||
| 4719 | I915_WRITE(GEN9_PG_ENABLE, 0); | 4718 | I915_WRITE(GEN9_PG_ENABLE, 0); |
| 4720 | else | 4719 | else |
| 4721 | I915_WRITE(GEN9_PG_ENABLE, (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? | 4720 | I915_WRITE(GEN9_PG_ENABLE, (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? |
| @@ -159,7 +159,6 @@ struct nvkm_device_func { · 158 unmodified lines | |||
| 159 | struct nvkm_device_quirk { | 159 | struct nvkm_device_quirk { |
| 160 | u8 tv_pin_mask; | 160 | u8 tv_pin_mask; |
| 161 | u8 tv_gpio; | 161 | u8 tv_gpio; |
| 162 | bool War00C800_0; | ||
| 163 | }; | 162 | }; |
| 164 | 163 | ||
| 165 | struct nvkm_device_chip { | 164 | struct nvkm_device_chip { |
| @@ -258,12 +258,6 @@ nvkm_device_pci_10de_0df4[] = { · 257 unmodified lines | |||
| 258 | {} | 258 | {} |
| 259 | }; | 259 | }; |
| 260 | 260 | ||
| 261 | static const struct nvkm_device_pci_vendor | ||
| 262 | nvkm_device_pci_10de_0fcd[] = { | ||
| 263 | { 0x17aa, 0x3801, NULL, { .War00C800_0 = true } }, /* Lenovo Y510P */ | ||
| 264 | {} | ||
| 265 | }; | ||
| 266 | |||
| 267 | static const struct nvkm_device_pci_vendor | 261 | static const struct nvkm_device_pci_vendor |
| 268 | nvkm_device_pci_10de_0fd2[] = { | 262 | nvkm_device_pci_10de_0fd2[] = { |
| 269 | { 0x1028, 0x0595, "GeForce GT 640M LE" }, | 263 | { 0x1028, 0x0595, "GeForce GT 640M LE" }, |
| @@ -278,12 +272,6 @@ nvkm_device_pci_10de_0fe3[] = { · 8 unmodified lines | |||
| 278 | {} | 272 | {} |
| 279 | }; | 273 | }; |
| 280 | 274 | ||
| 281 | static const struct nvkm_device_pci_vendor | ||
| 282 | nvkm_device_pci_10de_0fe4[] = { | ||
| 283 | { 0x144d, 0xc740, NULL, { .War00C800_0 = true } }, | ||
| 284 | {} | ||
| 285 | }; | ||
| 286 | |||
| 287 | static const struct nvkm_device_pci_vendor | 275 | static const struct nvkm_device_pci_vendor |
| 288 | nvkm_device_pci_10de_104b[] = { | 276 | nvkm_device_pci_10de_104b[] = { |
| 289 | { 0x1043, 0x844c, "GeForce GT 625" }, | 277 | { 0x1043, 0x844c, "GeForce GT 625" }, |
| @@ -690,13 +678,6 @@ nvkm_device_pci_10de_1189[] = { · 400 unmodified lines | |||
| 690 | static const struct nvkm_device_pci_vendor | 678 | static const struct nvkm_device_pci_vendor |
| 691 | nvkm_device_pci_10de_1199[] = { | 679 | nvkm_device_pci_10de_1199[] = { |
| 692 | { 0x1458, 0xd001, "GeForce GTX 760" }, | 680 | { 0x1458, 0xd001, "GeForce GTX 760" }, |
| 693 | { 0x1462, 0x1106, "GeForce GTX 780M", { .War00C800_0 = true } }, /* Medion Erazer X7827 */ | ||
| 694 | {} | ||
| 695 | }; | ||
| 696 | |||
| 697 | static const struct nvkm_device_pci_vendor | ||
| 698 | nvkm_device_pci_10de_11e0[] = { | ||
| 699 | { 0x1558, 0x5106, NULL, { .War00C800_0 = true } }, | ||
| 700 | {} | 681 | {} |
| 701 | }; | 682 | }; |
| 702 | 683 | ||
| @@ -706,14 +687,6 @@ nvkm_device_pci_10de_11e3[] = { · 3 unmodified lines | |||
| 706 | {} | 687 | {} |
| 707 | }; | 688 | }; |
| 708 | 689 | ||
| 709 | static const struct nvkm_device_pci_vendor | ||
| 710 | nvkm_device_pci_10de_11fc[] = { | ||
| 711 | { 0x1179, 0x0001, NULL, { .War00C800_0 = true } }, /* Toshiba Tecra W50 */ | ||
| 712 | { 0x17aa, 0x2211, NULL, { .War00C800_0 = true } }, /* Lenovo W541 */ | ||
| 713 | { 0x17aa, 0x221e, NULL, { .War00C800_0 = true } }, /* Lenovo W541 */ | ||
| 714 | {} | ||
| 715 | }; | ||
| 716 | |||
| 717 | static const struct nvkm_device_pci_vendor | 690 | static const struct nvkm_device_pci_vendor |
| 718 | nvkm_device_pci_10de_1247[] = { | 691 | nvkm_device_pci_10de_1247[] = { |
| 719 | { 0x1043, 0x212a, "GeForce GT 635M" }, | 692 | { 0x1043, 0x212a, "GeForce GT 635M" }, |
| @@ -1368,7 +1341,7 @@ nvkm_device_pci_10de[] = { · 648 unmodified lines | |||
| 1368 | { 0x0fc6, "GeForce GTX 650" }, | 1341 | { 0x0fc6, "GeForce GTX 650" }, |
| 1369 | { 0x0fc8, "GeForce GT 740" }, | 1342 | { 0x0fc8, "GeForce GT 740" }, |
| 1370 | { 0x0fc9, "GeForce GT 730" }, | 1343 | { 0x0fc9, "GeForce GT 730" }, |
| 1371 | { 0x0fcd, "GeForce GT 755M", nvkm_device_pci_10de_0fcd }, | 1344 | { 0x0fcd, "GeForce GT 755M" }, |
| 1372 | { 0x0fce, "GeForce GT 640M LE" }, | 1345 | { 0x0fce, "GeForce GT 640M LE" }, |
| 1373 | { 0x0fd1, "GeForce GT 650M" }, | 1346 | { 0x0fd1, "GeForce GT 650M" }, |
| 1374 | { 0x0fd2, "GeForce GT 640M", nvkm_device_pci_10de_0fd2 }, | 1347 | { 0x0fd2, "GeForce GT 640M", nvkm_device_pci_10de_0fd2 }, |
| @@ -1382,7 +1355,7 @@ nvkm_device_pci_10de[] = { · 7 unmodified lines | |||
| 1382 | { 0x0fe1, "GeForce GT 730M" }, | 1355 | { 0x0fe1, "GeForce GT 730M" }, |
| 1383 | { 0x0fe2, "GeForce GT 745M" }, | 1356 | { 0x0fe2, "GeForce GT 745M" }, |
| 1384 | { 0x0fe3, "GeForce GT 745M", nvkm_device_pci_10de_0fe3 }, | 1357 | { 0x0fe3, "GeForce GT 745M", nvkm_device_pci_10de_0fe3 }, |
| 1385 | { 0x0fe4, "GeForce GT 750M", nvkm_device_pci_10de_0fe4 }, | 1358 | { 0x0fe4, "GeForce GT 750M" }, |
| 1386 | { 0x0fe9, "GeForce GT 750M" }, | 1359 | { 0x0fe9, "GeForce GT 750M" }, |
| 1387 | { 0x0fea, "GeForce GT 755M" }, | 1360 | { 0x0fea, "GeForce GT 755M" }, |
| 1388 | { 0x0fec, "GeForce 710A" }, | 1361 | { 0x0fec, "GeForce 710A" }, |
| @@ -1497,12 +1470,12 @@ nvkm_device_pci_10de[] = { · 108 unmodified lines | |||
| 1497 | { 0x11c6, "GeForce GTX 650 Ti" }, | 1470 | { 0x11c6, "GeForce GTX 650 Ti" }, |
| 1498 | { 0x11c8, "GeForce GTX 650" }, | 1471 | { 0x11c8, "GeForce GTX 650" }, |
| 1499 | { 0x11cb, "GeForce GT 740" }, | 1472 | { 0x11cb, "GeForce GT 740" }, |
| 1500 | { 0x11e0, "GeForce GTX 770M", nvkm_device_pci_10de_11e0 }, | 1473 | { 0x11e0, "GeForce GTX 770M" }, |
| 1501 | { 0x11e1, "GeForce GTX 765M" }, | 1474 | { 0x11e1, "GeForce GTX 765M" }, |
| 1502 | { 0x11e2, "GeForce GTX 765M" }, | 1475 | { 0x11e2, "GeForce GTX 765M" }, |
| 1503 | { 0x11e3, "GeForce GTX 760M", nvkm_device_pci_10de_11e3 }, | 1476 | { 0x11e3, "GeForce GTX 760M", nvkm_device_pci_10de_11e3 }, |
| 1504 | { 0x11fa, "Quadro K4000" }, | 1477 | { 0x11fa, "Quadro K4000" }, |
| 1505 | { 0x11fc, "Quadro K2100M", nvkm_device_pci_10de_11fc }, | 1478 | { 0x11fc, "Quadro K2100M" }, |
| 1506 | { 0x1200, "GeForce GTX 560 Ti" }, | 1479 | { 0x1200, "GeForce GTX 560 Ti" }, |
| 1507 | { 0x1201, "GeForce GTX 560" }, | 1480 | { 0x1201, "GeForce GTX 560" }, |
| 1508 | { 0x1203, "GeForce GTX 460 SE v2" }, | 1481 | { 0x1203, "GeForce GTX 460 SE v2" }, |
| @@ -83,6 +83,7 @@ nvbios_fan_parse(struct nvkm_bios *bios, struct nvbios_therm_fan *fan) · 82 unmodified lines | |||
| 83 | fan->type = NVBIOS_THERM_FAN_UNK; | 83 | fan->type = NVBIOS_THERM_FAN_UNK; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | fan->fan_mode = NVBIOS_THERM_FAN_LINEAR; | ||
| 86 | fan->min_duty = nvbios_rd08(bios, data + 0x02); | 87 | fan->min_duty = nvbios_rd08(bios, data + 0x02); |
| 87 | fan->max_duty = nvbios_rd08(bios, data + 0x03); | 88 | fan->max_duty = nvbios_rd08(bios, data + 0x03); |
| 88 | 89 | ||
| @@ -81,9 +81,7 @@ gk104_pmu_pgob(struct nvkm_pmu *pmu, bool enable) · 80 unmodified lines | |||
| 81 | nvkm_mask(device, 0x000200, 0x00001000, 0x00001000); | 81 | nvkm_mask(device, 0x000200, 0x00001000, 0x00001000); |
| 82 | nvkm_rd32(device, 0x000200); | 82 | nvkm_rd32(device, 0x000200); |
| 83 | 83 | ||
| 84 | if ( nvkm_boolopt(device->cfgopt, "War00C800_0", | 84 | if (nvkm_boolopt(device->cfgopt, "War00C800_0", true)) { |
| 85 | device->quirk ? device->quirk->War00C800_0 : false)) { | ||
| 86 | nvkm_info(&pmu->subdev, "hw bug workaround enabled\n"); | ||
| 87 | switch (device->chipset) { | 85 | switch (device->chipset) { |
| 88 | case 0xe4: | 86 | case 0xe4: |
| 89 | magic(device, 0x04000000); | 87 | magic(device, 0x04000000); |
| @@ -112,11 +112,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, · 111 unmodified lines | |||
| 112 | dma_addr_t paddr; | 112 | dma_addr_t paddr; |
| 113 | int ret; | 113 | int ret; |
| 114 | 114 | ||
| 115 | /* only doing ARGB32 since this is what is needed to alpha-blend | ||
| 116 | * with video overlays: | ||
| 117 | */ | ||
| 118 | sizes->surface_bpp = 32; | 115 | sizes->surface_bpp = 32; |
| 119 | sizes->surface_depth = 32; | 116 | sizes->surface_depth = 24; |
| 120 | 117 | ||
| 121 | DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width, | 118 | DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width, |
| 122 | sizes->surface_height, sizes->surface_bpp, | 119 | sizes->surface_height, sizes->surface_bpp, |
| @@ -4173,11 +4173,7 @@ void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) · 4172 unmodified lines | |||
| 4173 | control |= ib->length_dw | (vm_id << 24); | 4173 | control |= ib->length_dw | (vm_id << 24); |
| 4174 | 4174 | ||
| 4175 | radeon_ring_write(ring, header); | 4175 | radeon_ring_write(ring, header); |
| 4176 | radeon_ring_write(ring, | 4176 | radeon_ring_write(ring, (ib->gpu_addr & 0xFFFFFFFC)); |
| 4177 | #ifdef __BIG_ENDIAN | ||
| 4178 | (2 << 0) | | ||
| 4179 | #endif | ||
| 4180 | (ib->gpu_addr & 0xFFFFFFFC)); | ||
| 4181 | radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF); | 4177 | radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF); |
| 4182 | radeon_ring_write(ring, control); | 4178 | radeon_ring_write(ring, control); |
| 4183 | } | 4179 | } |
| @@ -361,31 +361,31 @@ int radeon_vce_get_create_msg(struct radeon_device *rdev, int ring, · 360 unmodified lines | |||
| 361 | 361 | ||
| 362 | /* stitch together an VCE create msg */ | 362 | /* stitch together an VCE create msg */ |
| 363 | ib.length_dw = 0; | 363 | ib.length_dw = 0; |
| 364 | ib.ptr[ib.length_dw++] = 0x0000000c; /* len */ | 364 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x0000000c); /* len */ |
| 365 | ib.ptr[ib.length_dw++] = 0x00000001; /* session cmd */ | 365 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001); /* session cmd */ |
| 366 | ib.ptr[ib.length_dw++] = handle; | 366 | ib.ptr[ib.length_dw++] = cpu_to_le32(handle); |
| 367 | 367 | ||
| 368 | ib.ptr[ib.length_dw++] = 0x00000030; /* len */ | 368 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000030); /* len */ |
| 369 | ib.ptr[ib.length_dw++] = 0x01000001; /* create cmd */ | 369 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x01000001); /* create cmd */ |
| 370 | ib.ptr[ib.length_dw++] = 0x00000000; | 370 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000000); |
| 371 | ib.ptr[ib.length_dw++] = 0x00000042; | 371 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000042); |
| 372 | ib.ptr[ib.length_dw++] = 0x0000000a; | 372 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x0000000a); |
| 373 | ib.ptr[ib.length_dw++] = 0x00000001; | 373 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001); |
| 374 | ib.ptr[ib.length_dw++] = 0x00000080; | 374 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000080); |
| 375 | ib.ptr[ib.length_dw++] = 0x00000060; | 375 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000060); |
| 376 | ib.ptr[ib.length_dw++] = 0x00000100; | 376 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000100); |
| 377 | ib.ptr[ib.length_dw++] = 0x00000100; | 377 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000100); |
| 378 | ib.ptr[ib.length_dw++] = 0x0000000c; | 378 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x0000000c); |
| 379 | ib.ptr[ib.length_dw++] = 0x00000000; | 379 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000000); |
| 380 | 380 | ||
| 381 | ib.ptr[ib.length_dw++] = 0x00000014; /* len */ | 381 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000014); /* len */ |
| 382 | ib.ptr[ib.length_dw++] = 0x05000005; /* feedback buffer */ | 382 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x05000005); /* feedback buffer */ |
| 383 | ib.ptr[ib.length_dw++] = upper_32_bits(dummy); | 383 | ib.ptr[ib.length_dw++] = cpu_to_le32(upper_32_bits(dummy)); |
| 384 | ib.ptr[ib.length_dw++] = dummy; | 384 | ib.ptr[ib.length_dw++] = cpu_to_le32(dummy); |
| 385 | ib.ptr[ib.length_dw++] = 0x00000001; | 385 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001); |
| 386 | 386 | ||
| 387 | for (i = ib.length_dw; i < ib_size_dw; ++i) | 387 | for (i = ib.length_dw; i < ib_size_dw; ++i) |
| 388 | ib.ptr[i] = 0x0; | 388 | ib.ptr[i] = cpu_to_le32(0x0); |
| 389 | 389 | ||
| 390 | r = radeon_ib_schedule(rdev, &ib, NULL, false); | 390 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
| 391 | if (r) { | 391 | if (r) { |
| @@ -428,21 +428,21 @@ int radeon_vce_get_destroy_msg(struct radeon_device *rdev, int ring, · 36 unmodified lines | |||
| 428 | 428 | ||
| 429 | /* stitch together an VCE destroy msg */ | 429 | /* stitch together an VCE destroy msg */ |
| 430 | ib.length_dw = 0; | 430 | ib.length_dw = 0; |
| 431 | ib.ptr[ib.length_dw++] = 0x0000000c; /* len */ | 431 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x0000000c); /* len */ |
| 432 | ib.ptr[ib.length_dw++] = 0x00000001; /* session cmd */ | 432 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001); /* session cmd */ |
| 433 | ib.ptr[ib.length_dw++] = handle; | 433 | ib.ptr[ib.length_dw++] = cpu_to_le32(handle); |
| 434 | 434 | ||
| 435 | ib.ptr[ib.length_dw++] = 0x00000014; /* len */ | 435 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000014); /* len */ |
| 436 | ib.ptr[ib.length_dw++] = 0x05000005; /* feedback buffer */ | 436 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x05000005); /* feedback buffer */ |
| 437 | ib.ptr[ib.length_dw++] = upper_32_bits(dummy); | 437 | ib.ptr[ib.length_dw++] = cpu_to_le32(upper_32_bits(dummy)); |
| 438 | ib.ptr[ib.length_dw++] = dummy; | 438 | ib.ptr[ib.length_dw++] = cpu_to_le32(dummy); |
| 439 | ib.ptr[ib.length_dw++] = 0x00000001; | 439 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001); |
| 440 | 440 | ||
| 441 | ib.ptr[ib.length_dw++] = 0x00000008; /* len */ | 441 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000008); /* len */ |
| 442 | ib.ptr[ib.length_dw++] = 0x02000001; /* destroy cmd */ | 442 | ib.ptr[ib.length_dw++] = cpu_to_le32(0x02000001); /* destroy cmd */ |
| 443 | 443 | ||
| 444 | for (i = ib.length_dw; i < ib_size_dw; ++i) | 444 | for (i = ib.length_dw; i < ib_size_dw; ++i) |
| 445 | ib.ptr[i] = 0x0; | 445 | ib.ptr[i] = cpu_to_le32(0x0); |
| 446 | 446 | ||
| 447 | r = radeon_ib_schedule(rdev, &ib, NULL, false); | 447 | r = radeon_ib_schedule(rdev, &ib, NULL, false); |
| 448 | if (r) { | 448 | if (r) { |
| @@ -699,12 +699,12 @@ bool radeon_vce_semaphore_emit(struct radeon_device *rdev, · 250 unmodified lines | |||
| 699 | { | 699 | { |
| 700 | uint64_t addr = semaphore->gpu_addr; | 700 | uint64_t addr = semaphore->gpu_addr; |
| 701 | 701 | ||
| 702 | radeon_ring_write(ring, VCE_CMD_SEMAPHORE); | 702 | radeon_ring_write(ring, cpu_to_le32(VCE_CMD_SEMAPHORE)); |
| 703 | radeon_ring_write(ring, (addr >> 3) & 0x000FFFFF); | 703 | radeon_ring_write(ring, cpu_to_le32((addr >> 3) & 0x000FFFFF)); |
| 704 | radeon_ring_write(ring, (addr >> 23) & 0x000FFFFF); | 704 | radeon_ring_write(ring, cpu_to_le32((addr >> 23) & 0x000FFFFF)); |
| 705 | radeon_ring_write(ring, 0x01003000 | (emit_wait ? 1 : 0)); | 705 | radeon_ring_write(ring, cpu_to_le32(0x01003000 | (emit_wait ? 1 : 0))); |
| 706 | if (!emit_wait) | 706 | if (!emit_wait) |
| 707 | radeon_ring_write(ring, VCE_CMD_END); | 707 | radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END)); |
| 708 | 708 | ||
| 709 | return true; | 709 | return true; |
| 710 | } | 710 | } |
| @@ -719,10 +719,10 @@ bool radeon_vce_semaphore_emit(struct radeon_device *rdev, · 8 unmodified lines | |||
| 719 | void radeon_vce_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) | 719 | void radeon_vce_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) |
| 720 | { | 720 | { |
| 721 | struct radeon_ring *ring = &rdev->ring[ib->ring]; | 721 | struct radeon_ring *ring = &rdev->ring[ib->ring]; |
| 722 | radeon_ring_write(ring, VCE_CMD_IB); | 722 | radeon_ring_write(ring, cpu_to_le32(VCE_CMD_IB)); |
| 723 | radeon_ring_write(ring, ib->gpu_addr); | 723 | radeon_ring_write(ring, cpu_to_le32(ib->gpu_addr)); |
| 724 | radeon_ring_write(ring, upper_32_bits(ib->gpu_addr)); | 724 | radeon_ring_write(ring, cpu_to_le32(upper_32_bits(ib->gpu_addr))); |
| 725 | radeon_ring_write(ring, ib->length_dw); | 725 | radeon_ring_write(ring, cpu_to_le32(ib->length_dw)); |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | /** | 728 | /** |
| @@ -738,12 +738,12 @@ void radeon_vce_fence_emit(struct radeon_device *rdev, · 9 unmodified lines | |||
| 738 | struct radeon_ring *ring = &rdev->ring[fence->ring]; | 738 | struct radeon_ring *ring = &rdev->ring[fence->ring]; |
| 739 | uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr; | 739 | uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr; |
| 740 | 740 | ||
| 741 | radeon_ring_write(ring, VCE_CMD_FENCE); | 741 | radeon_ring_write(ring, cpu_to_le32(VCE_CMD_FENCE)); |
| 742 | radeon_ring_write(ring, addr); | 742 | radeon_ring_write(ring, cpu_to_le32(addr)); |
| 743 | radeon_ring_write(ring, upper_32_bits(addr)); | 743 | radeon_ring_write(ring, cpu_to_le32(upper_32_bits(addr))); |
| 744 | radeon_ring_write(ring, fence->seq); | 744 | radeon_ring_write(ring, cpu_to_le32(fence->seq)); |
| 745 | radeon_ring_write(ring, VCE_CMD_TRAP); | 745 | radeon_ring_write(ring, cpu_to_le32(VCE_CMD_TRAP)); |
| 746 | radeon_ring_write(ring, VCE_CMD_END); | 746 | radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END)); |
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | /** | 749 | /** |
| @@ -765,7 +765,7 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · 15 unmodified lines | |||
| 765 | ring->idx, r); | 765 | ring->idx, r); |
| 766 | return r; | 766 | return r; |
| 767 | } | 767 | } |
| 768 | radeon_ring_write(ring, VCE_CMD_END); | 768 | radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END)); |
| 769 | radeon_ring_unlock_commit(rdev, ring, false); | 769 | radeon_ring_unlock_commit(rdev, ring, false); |
| 770 | 770 | ||
| 771 | for (i = 0; i < rdev->usec_timeout; i++) { | 771 | for (i = 0; i < rdev->usec_timeout; i++) { |
| @@ -180,7 +180,7 @@ int ttm_write_lock(struct ttm_lock *lock, bool interruptible) · 179 unmodified lines | |||
| 180 | spin_unlock(&lock->lock); | 180 | spin_unlock(&lock->lock); |
| 181 | } | 181 | } |
| 182 | } else | 182 | } else |
| 183 | wait_event(lock->queue, __ttm_read_lock(lock)); | 183 | wait_event(lock->queue, __ttm_write_lock(lock)); |
| 184 | 184 | ||
| 185 | return ret; | 185 | return ret; |
| 186 | } | 186 | } |
| @@ -1233,6 +1233,7 @@ static void vmw_master_drop(struct drm_device *dev, · 1232 unmodified lines | |||
| 1233 | 1233 | ||
| 1234 | vmw_fp->locked_master = drm_master_get(file_priv->master); | 1234 | vmw_fp->locked_master = drm_master_get(file_priv->master); |
| 1235 | ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile); | 1235 | ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile); |
| 1236 | vmw_kms_legacy_hotspot_clear(dev_priv); | ||
| 1236 | if (unlikely((ret != 0))) { | 1237 | if (unlikely((ret != 0))) { |
| 1237 | DRM_ERROR("Unable to lock TTM at VT switch.\n"); | 1238 | DRM_ERROR("Unable to lock TTM at VT switch.\n"); |
| 1238 | drm_master_put(&vmw_fp->locked_master); | 1239 | drm_master_put(&vmw_fp->locked_master); |
| @@ -925,6 +925,7 @@ int vmw_kms_present(struct vmw_private *dev_priv, · 924 unmodified lines | |||
| 925 | uint32_t num_clips); | 925 | uint32_t num_clips); |
| 926 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | 926 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, |
| 927 | struct drm_file *file_priv); | 927 | struct drm_file *file_priv); |
| 928 | void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv); | ||
| 928 | 929 | ||
| 929 | int vmw_dumb_create(struct drm_file *file_priv, | 930 | int vmw_dumb_create(struct drm_file *file_priv, |
| 930 | struct drm_device *dev, | 931 | struct drm_device *dev, |
| @@ -390,7 +390,7 @@ void *vmw_fifo_reserve_dx(struct vmw_private *dev_priv, uint32_t bytes, · 389 unmodified lines | |||
| 390 | else if (ctx_id == SVGA3D_INVALID_ID) | 390 | else if (ctx_id == SVGA3D_INVALID_ID) |
| 391 | ret = vmw_local_fifo_reserve(dev_priv, bytes); | 391 | ret = vmw_local_fifo_reserve(dev_priv, bytes); |
| 392 | else { | 392 | else { |
| 393 | WARN_ON("Command buffer has not been allocated.\n"); | 393 | WARN(1, "Command buffer has not been allocated.\n"); |
| 394 | ret = NULL; | 394 | ret = NULL; |
| 395 | } | 395 | } |
| 396 | if (IS_ERR_OR_NULL(ret)) { | 396 | if (IS_ERR_OR_NULL(ret)) { |
| @@ -133,13 +133,19 @@ void vmw_cursor_update_position(struct vmw_private *dev_priv, · 132 unmodified lines | |||
| 133 | vmw_mmio_write(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT); | 133 | vmw_mmio_write(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | 136 | |
| 137 | uint32_t handle, uint32_t width, uint32_t height) | 137 | /* |
| 138 | * vmw_du_crtc_cursor_set2 - Driver cursor_set2 callback. | ||
| 139 | */ | ||
| 140 | int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, | ||
| 141 | uint32_t handle, uint32_t width, uint32_t height, | ||
| 142 | int32_t hot_x, int32_t hot_y) | ||
| 138 | { | 143 | { |
| 139 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); | 144 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); |
| 140 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); | 145 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); |
| 141 | struct vmw_surface *surface = NULL; | 146 | struct vmw_surface *surface = NULL; |
| 142 | struct vmw_dma_buffer *dmabuf = NULL; | 147 | struct vmw_dma_buffer *dmabuf = NULL; |
| 148 | s32 hotspot_x, hotspot_y; | ||
| 143 | int ret; | 149 | int ret; |
| 144 | 150 | ||
| 145 | /* | 151 | /* |
| @@ -151,6 +157,8 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, · 5 unmodified lines | |||
| 151 | */ | 157 | */ |
| 152 | drm_modeset_unlock_crtc(crtc); | 158 | drm_modeset_unlock_crtc(crtc); |
| 153 | drm_modeset_lock_all(dev_priv->dev); | 159 | drm_modeset_lock_all(dev_priv->dev); |
| 160 | hotspot_x = hot_x + du->hotspot_x; | ||
| 161 | hotspot_y = hot_y + du->hotspot_y; | ||
| 154 | 162 | ||
| 155 | /* A lot of the code assumes this */ | 163 | /* A lot of the code assumes this */ |
| 156 | if (handle && (width != 64 || height != 64)) { | 164 | if (handle && (width != 64 || height != 64)) { |
| @@ -187,31 +195,34 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, · 30 unmodified lines | |||
| 187 | vmw_dmabuf_unreference(&du->cursor_dmabuf); | 195 | vmw_dmabuf_unreference(&du->cursor_dmabuf); |
| 188 | 196 | ||
| 189 | /* setup new image */ | 197 | /* setup new image */ |
| 198 | ret = 0; | ||
| 190 | if (surface) { | 199 | if (surface) { |
| 191 | /* vmw_user_surface_lookup takes one reference */ | 200 | /* vmw_user_surface_lookup takes one reference */ |
| 192 | du->cursor_surface = surface; | 201 | du->cursor_surface = surface; |
| 193 | 202 | ||
| 194 | du->cursor_surface->snooper.crtc = crtc; | 203 | du->cursor_surface->snooper.crtc = crtc; |
| 195 | du->cursor_age = du->cursor_surface->snooper.age; | 204 | du->cursor_age = du->cursor_surface->snooper.age; |
| 196 | vmw_cursor_update_image(dev_priv, surface->snooper.image, | 205 | ret = vmw_cursor_update_image(dev_priv, surface->snooper.image, |
| 197 | 64, 64, du->hotspot_x, du->hotspot_y); | 206 | 64, 64, hotspot_x, hotspot_y); |
| 198 | } else if (dmabuf) { | 207 | } else if (dmabuf) { |
| 199 | /* vmw_user_surface_lookup takes one reference */ | 208 | /* vmw_user_surface_lookup takes one reference */ |
| 200 | du->cursor_dmabuf = dmabuf; | 209 | du->cursor_dmabuf = dmabuf; |
| 201 | 210 | ||
| 202 | ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, width, height, | 211 | ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, width, height, |
| 203 | du->hotspot_x, du->hotspot_y); | 212 | hotspot_x, hotspot_y); |
| 204 | } else { | 213 | } else { |
| 205 | vmw_cursor_update_position(dev_priv, false, 0, 0); | 214 | vmw_cursor_update_position(dev_priv, false, 0, 0); |
| 206 | ret = 0; | ||
| 207 | goto out; | 215 | goto out; |
| 208 | } | 216 | } |
| 209 | 217 | ||
| 210 | vmw_cursor_update_position(dev_priv, true, | 218 | if (!ret) { |
| 211 | du->cursor_x + du->hotspot_x, | 219 | vmw_cursor_update_position(dev_priv, true, |
| 212 | du->cursor_y + du->hotspot_y); | 220 | du->cursor_x + hotspot_x, |
| 221 | du->cursor_y + hotspot_y); | ||
| 222 | du->core_hotspot_x = hot_x; | ||
| 223 | du->core_hotspot_y = hot_y; | ||
| 224 | } | ||
| 213 | 225 | ||
| 214 | ret = 0; | ||
| 215 | out: | 226 | out: |
| 216 | drm_modeset_unlock_all(dev_priv->dev); | 227 | drm_modeset_unlock_all(dev_priv->dev); |
| 217 | drm_modeset_lock_crtc(crtc, crtc->cursor); | 228 | drm_modeset_lock_crtc(crtc, crtc->cursor); |
| @@ -239,8 +250,10 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) · 21 unmodified lines | |||
| 239 | drm_modeset_lock_all(dev_priv->dev); | 250 | drm_modeset_lock_all(dev_priv->dev); |
| 240 | 251 | ||
| 241 | vmw_cursor_update_position(dev_priv, shown, | 252 | vmw_cursor_update_position(dev_priv, shown, |
| 242 | du->cursor_x + du->hotspot_x, | 253 | du->cursor_x + du->hotspot_x + |
| 243 | du->cursor_y + du->hotspot_y); | 254 | du->core_hotspot_x, |
| 255 | du->cursor_y + du->hotspot_y + | ||
| 256 | du->core_hotspot_y); | ||
| 244 | 257 | ||
| 245 | drm_modeset_unlock_all(dev_priv->dev); | 258 | drm_modeset_unlock_all(dev_priv->dev); |
| 246 | drm_modeset_lock_crtc(crtc, crtc->cursor); | 259 | drm_modeset_lock_crtc(crtc, crtc->cursor); |
| @@ -334,6 +347,29 @@ err_unreserve: · 87 unmodified lines | |||
| 334 | ttm_bo_unreserve(bo); | 347 | ttm_bo_unreserve(bo); |
| 335 | } | 348 | } |
| 336 | 349 | ||
| 350 | /** | ||
| 351 | * vmw_kms_legacy_hotspot_clear - Clear legacy hotspots | ||
| 352 | * | ||
| 353 | * @dev_priv: Pointer to the device private struct. | ||
| 354 | * | ||
| 355 | * Clears all legacy hotspots. | ||
| 356 | */ | ||
| 357 | void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv) | ||
| 358 | { | ||
| 359 | struct drm_device *dev = dev_priv->dev; | ||
| 360 | struct vmw_display_unit *du; | ||
| 361 | struct drm_crtc *crtc; | ||
| 362 | |||
| 363 | drm_modeset_lock_all(dev); | ||
| 364 | drm_for_each_crtc(crtc, dev) { | ||
| 365 | du = vmw_crtc_to_du(crtc); | ||
| 366 | |||
| 367 | du->hotspot_x = 0; | ||
| 368 | du->hotspot_y = 0; | ||
| 369 | } | ||
| 370 | drm_modeset_unlock_all(dev); | ||
| 371 | } | ||
| 372 | |||
| 337 | void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv) | 373 | void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv) |
| 338 | { | 374 | { |
| 339 | struct drm_device *dev = dev_priv->dev; | 375 | struct drm_device *dev = dev_priv->dev; |
| @@ -351,7 +387,9 @@ void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv) · 11 unmodified lines | |||
| 351 | du->cursor_age = du->cursor_surface->snooper.age; | 387 | du->cursor_age = du->cursor_surface->snooper.age; |
| 352 | vmw_cursor_update_image(dev_priv, | 388 | vmw_cursor_update_image(dev_priv, |
| 353 | du->cursor_surface->snooper.image, | 389 | du->cursor_surface->snooper.image, |
| 354 | 64, 64, du->hotspot_x, du->hotspot_y); | 390 | 64, 64, |
| 391 | du->hotspot_x + du->core_hotspot_x, | ||
| 392 | du->hotspot_y + du->core_hotspot_y); | ||
| 355 | } | 393 | } |
| 356 | 394 | ||
| 357 | mutex_unlock(&dev->mode_config.mutex); | 395 | mutex_unlock(&dev->mode_config.mutex); |
| @@ -159,6 +159,8 @@ struct vmw_display_unit { · 158 unmodified lines | |||
| 159 | 159 | ||
| 160 | int hotspot_x; | 160 | int hotspot_x; |
| 161 | int hotspot_y; | 161 | int hotspot_y; |
| 162 | s32 core_hotspot_x; | ||
| 163 | s32 core_hotspot_y; | ||
| 162 | 164 | ||
| 163 | unsigned unit; | 165 | unsigned unit; |
| 164 | 166 | ||
| @@ -193,8 +195,9 @@ void vmw_du_crtc_restore(struct drm_crtc *crtc); · 28 unmodified lines | |||
| 193 | void vmw_du_crtc_gamma_set(struct drm_crtc *crtc, | 195 | void vmw_du_crtc_gamma_set(struct drm_crtc *crtc, |
| 194 | u16 *r, u16 *g, u16 *b, | 196 | u16 *r, u16 *g, u16 *b, |
| 195 | uint32_t start, uint32_t size); | 197 | uint32_t start, uint32_t size); |
| 196 | int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | 198 | int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, |
| 197 | uint32_t handle, uint32_t width, uint32_t height); | 199 | uint32_t handle, uint32_t width, uint32_t height, |
| 200 | int32_t hot_x, int32_t hot_y); | ||
| 198 | int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); | 201 | int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); |
| 199 | int vmw_du_connector_dpms(struct drm_connector *connector, int mode); | 202 | int vmw_du_connector_dpms(struct drm_connector *connector, int mode); |
| 200 | void vmw_du_connector_save(struct drm_connector *connector); | 203 | void vmw_du_connector_save(struct drm_connector *connector); |
| @@ -295,7 +295,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set) · 294 unmodified lines | |||
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | static const struct drm_crtc_funcs vmw_legacy_crtc_funcs = { | 297 | static const struct drm_crtc_funcs vmw_legacy_crtc_funcs = { |
| 298 | .cursor_set = vmw_du_crtc_cursor_set, | 298 | .cursor_set2 = vmw_du_crtc_cursor_set2, |
| 299 | .cursor_move = vmw_du_crtc_cursor_move, | 299 | .cursor_move = vmw_du_crtc_cursor_move, |
| 300 | .gamma_set = vmw_du_crtc_gamma_set, | 300 | .gamma_set = vmw_du_crtc_gamma_set, |
| 301 | .destroy = vmw_ldu_crtc_destroy, | 301 | .destroy = vmw_ldu_crtc_destroy, |
| @@ -531,7 +531,7 @@ out_no_fence: · 530 unmodified lines | |||
| 531 | } | 531 | } |
| 532 | 532 | ||
| 533 | static const struct drm_crtc_funcs vmw_screen_object_crtc_funcs = { | 533 | static const struct drm_crtc_funcs vmw_screen_object_crtc_funcs = { |
| 534 | .cursor_set = vmw_du_crtc_cursor_set, | 534 | .cursor_set2 = vmw_du_crtc_cursor_set2, |
| 535 | .cursor_move = vmw_du_crtc_cursor_move, | 535 | .cursor_move = vmw_du_crtc_cursor_move, |
| 536 | .gamma_set = vmw_du_crtc_gamma_set, | 536 | .gamma_set = vmw_du_crtc_gamma_set, |
| 537 | .destroy = vmw_sou_crtc_destroy, | 537 | .destroy = vmw_sou_crtc_destroy, |
| @@ -1041,7 +1041,7 @@ out_finish: · 1040 unmodified lines | |||
| 1041 | * Screen Target CRTC dispatch table | 1041 | * Screen Target CRTC dispatch table |
| 1042 | */ | 1042 | */ |
| 1043 | static const struct drm_crtc_funcs vmw_stdu_crtc_funcs = { | 1043 | static const struct drm_crtc_funcs vmw_stdu_crtc_funcs = { |
| 1044 | .cursor_set = vmw_du_crtc_cursor_set, | 1044 | .cursor_set2 = vmw_du_crtc_cursor_set2, |
| 1045 | .cursor_move = vmw_du_crtc_cursor_move, | 1045 | .cursor_move = vmw_du_crtc_cursor_move, |
| 1046 | .gamma_set = vmw_du_crtc_gamma_set, | 1046 | .gamma_set = vmw_du_crtc_gamma_set, |
| 1047 | .destroy = vmw_stdu_crtc_destroy, | 1047 | .destroy = vmw_stdu_crtc_destroy, |
| @@ -395,8 +395,10 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible) · 394 unmodified lines | |||
| 395 | set_current_state(interruptible ? | 395 | set_current_state(interruptible ? |
| 396 | TASK_INTERRUPTIBLE : | 396 | TASK_INTERRUPTIBLE : |
| 397 | TASK_UNINTERRUPTIBLE); | 397 | TASK_UNINTERRUPTIBLE); |
| 398 | if (signal_pending(current)) { | 398 | if (interruptible && signal_pending(current)) { |
| 399 | rc = -EINTR; | 399 | __set_current_state(TASK_RUNNING); |
| 400 | remove_wait_queue(&vga_wait_queue, &wait); | ||
| 401 | rc = -ERESTARTSYS; | ||
| 400 | break; | 402 | break; |
| 401 | } | 403 | } |
| 402 | schedule(); | 404 | schedule(); |
| @@ -316,11 +316,6 @@ · 315 unmodified lines | |||
| 316 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 | 316 | #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 |
| 317 | 317 | ||
| 318 | #define USB_VENDOR_ID_ELAN 0x04f3 | 318 | #define USB_VENDOR_ID_ELAN 0x04f3 |
| 319 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 | ||
| 320 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b | ||
| 321 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 | ||
| 322 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c 0x010c | ||
| 323 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f | ||
| 324 | 319 | ||
| 325 | #define USB_VENDOR_ID_ELECOM 0x056e | 320 | #define USB_VENDOR_ID_ELECOM 0x056e |
| 326 | #define USB_DEVICE_ID_ELECOM_BM084 0x0061 | 321 | #define USB_DEVICE_ID_ELECOM_BM084 0x0061 |
| @@ -72,11 +72,7 @@ static const struct hid_blacklist { · 71 unmodified lines | |||
| 72 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, | 72 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, |
| 73 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 73 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
| 74 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, | 74 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, |
| 75 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, | 75 | { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL }, |
| 76 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, | ||
| 77 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, | ||
| 78 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL }, | ||
| 79 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, | ||
| 80 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 76 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
| 81 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | 77 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, |
| 82 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 78 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
| @@ -340,7 +336,8 @@ static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor, · 257 unmodified lines | |||
| 340 | 336 | ||
| 341 | for (; hid_blacklist[n].idVendor; n++) | 337 | for (; hid_blacklist[n].idVendor; n++) |
| 342 | if (hid_blacklist[n].idVendor == idVendor && | 338 | if (hid_blacklist[n].idVendor == idVendor && |
| 343 | hid_blacklist[n].idProduct == idProduct) | 339 | (hid_blacklist[n].idProduct == (__u16) HID_ANY_ID || |
| 340 | hid_blacklist[n].idProduct == idProduct)) | ||
| 344 | bl_entry = &hid_blacklist[n]; | 341 | bl_entry = &hid_blacklist[n]; |
| 345 | 342 | ||
| 346 | if (bl_entry != NULL) | 343 | if (bl_entry != NULL) |
| @@ -1217,6 +1217,7 @@ config SENSORS_PWM_FAN · 1216 unmodified lines | |||
| 1217 | config SENSORS_SHT15 | 1217 | config SENSORS_SHT15 |
| 1218 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." | 1218 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." |
| 1219 | depends on GPIOLIB || COMPILE_TEST | 1219 | depends on GPIOLIB || COMPILE_TEST |
| 1220 | select BITREVERSE | ||
| 1220 | help | 1221 | help |
| 1221 | If you say yes here you get support for the Sensiron SHT10, SHT11, | 1222 | If you say yes here you get support for the Sensiron SHT10, SHT11, |
| 1222 | SHT15, SHT71, SHT75 humidity and temperature sensors. | 1223 | SHT15, SHT71, SHT75 humidity and temperature sensors. |
| @@ -58,6 +58,7 @@ struct tmp102 { · 57 unmodified lines | |||
| 58 | u16 config_orig; | 58 | u16 config_orig; |
| 59 | unsigned long last_update; | 59 | unsigned long last_update; |
| 60 | int temp[3]; | 60 | int temp[3]; |
| 61 | bool first_time; | ||
| 61 | }; | 62 | }; |
| 62 | 63 | ||
| 63 | /* convert left adjusted 13-bit TMP102 register value to milliCelsius */ | 64 | /* convert left adjusted 13-bit TMP102 register value to milliCelsius */ |
| @@ -93,6 +94,7 @@ static struct tmp102 *tmp102_update_device(struct device *dev) · 29 unmodified lines | |||
| 93 | tmp102->temp[i] = tmp102_reg_to_mC(status); | 94 | tmp102->temp[i] = tmp102_reg_to_mC(status); |
| 94 | } | 95 | } |
| 95 | tmp102->last_update = jiffies; | 96 | tmp102->last_update = jiffies; |
| 97 | tmp102->first_time = false; | ||
| 96 | } | 98 | } |
| 97 | mutex_unlock(&tmp102->lock); | 99 | mutex_unlock(&tmp102->lock); |
| 98 | return tmp102; | 100 | return tmp102; |
| @@ -102,6 +104,12 @@ static int tmp102_read_temp(void *dev, int *temp) · 3 unmodified lines | |||
| 102 | { | 104 | { |
| 103 | struct tmp102 *tmp102 = tmp102_update_device(dev); | 105 | struct tmp102 *tmp102 = tmp102_update_device(dev); |
| 104 | 106 | ||
| 107 | /* Is it too early even to return a conversion? */ | ||
| 108 | if (tmp102->first_time) { | ||
| 109 | dev_dbg(dev, "%s: Conversion not ready yet..\n", __func__); | ||
| 110 | return -EAGAIN; | ||
| 111 | } | ||
| 112 | |||
| 105 | *temp = tmp102->temp[0]; | 113 | *temp = tmp102->temp[0]; |
| 106 | 114 | ||
| 107 | return 0; | 115 | return 0; |
| @@ -114,6 +122,10 @@ static ssize_t tmp102_show_temp(struct device *dev, · 6 unmodified lines | |||
| 114 | struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); | 122 | struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); |
| 115 | struct tmp102 *tmp102 = tmp102_update_device(dev); | 123 | struct tmp102 *tmp102 = tmp102_update_device(dev); |
| 116 | 124 | ||
| 125 | /* Is it too early even to return a read? */ | ||
| 126 | if (tmp102->first_time) | ||
| 127 | return -EAGAIN; | ||
| 128 | |||
| 117 | return sprintf(buf, "%d\n", tmp102->temp[sda->index]); | 129 | return sprintf(buf, "%d\n", tmp102->temp[sda->index]); |
| 118 | } | 130 | } |
| 119 | 131 | ||
| @@ -207,7 +219,9 @@ static int tmp102_probe(struct i2c_client *client, · 87 unmodified lines | |||
| 207 | status = -ENODEV; | 219 | status = -ENODEV; |
| 208 | goto fail_restore_config; | 220 | goto fail_restore_config; |
| 209 | } | 221 | } |
| 210 | tmp102->last_update = jiffies - HZ; | 222 | tmp102->last_update = jiffies; |
| 223 | /* Mark that we are not ready with data until conversion is complete */ | ||
| 224 | tmp102->first_time = true; | ||
| 211 | mutex_init(&tmp102->lock); | 225 | mutex_init(&tmp102->lock); |
| 212 | 226 | ||
| 213 | hwmon_dev = hwmon_device_register_with_groups(dev, client->name, | 227 | hwmon_dev = hwmon_device_register_with_groups(dev, client->name, |
| @@ -202,8 +202,15 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) · 201 unmodified lines | |||
| 202 | * d is always 6 on Keystone I2C controller | 202 | * d is always 6 on Keystone I2C controller |
| 203 | */ | 203 | */ |
| 204 | 204 | ||
| 205 | /* get minimum of 7 MHz clock, but max of 12 MHz */ | 205 | /* |
| 206 | psc = (input_clock / 7000000) - 1; | 206 | * Both Davinci and current Keystone User Guides recommend a value |
| 207 | * between 7MHz and 12MHz. In reality 7MHz module clock doesn't | ||
| 208 | * always produce enough margin between SDA and SCL transitions. | ||
| 209 | * Measurements show that the higher the module clock is, the | ||
| 210 | * bigger is the margin, providing more reliable communication. | ||
| 211 | * So we better target for 12MHz. | ||
| 212 | */ | ||
| 213 | psc = (input_clock / 12000000) - 1; | ||
| 207 | if ((input_clock / (psc + 1)) > 12000000) | 214 | if ((input_clock / (psc + 1)) > 12000000) |
| 208 | psc++; /* better to run under spec than over */ | 215 | psc++; /* better to run under spec than over */ |
| 209 | d = (psc >= 2) ? 5 : 7 - psc; | 216 | d = (psc >= 2) ? 5 : 7 - psc; |
| @@ -813,6 +813,12 @@ static irqreturn_t i2c_dw_isr(int this_irq, void *dev_id) · 812 unmodified lines | |||
| 813 | tx_aborted: | 813 | tx_aborted: |
| 814 | if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err) | 814 | if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err) |
| 815 | complete(&dev->cmd_complete); | 815 | complete(&dev->cmd_complete); |
| 816 | else if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) { | ||
| 817 | /* workaround to trigger pending interrupt */ | ||
| 818 | stat = dw_readl(dev, DW_IC_INTR_MASK); | ||
| 819 | i2c_dw_disable_int(dev); | ||
| 820 | dw_writel(dev, stat, DW_IC_INTR_MASK); | ||
| 821 | } | ||
| 816 | 822 | ||
| 817 | return IRQ_HANDLED; | 823 | return IRQ_HANDLED; |
| 818 | } | 824 | } |
| @@ -111,6 +111,7 @@ struct dw_i2c_dev { · 110 unmodified lines | |||
| 111 | 111 | ||
| 112 | #define ACCESS_SWAP 0x00000001 | 112 | #define ACCESS_SWAP 0x00000001 |
| 113 | #define ACCESS_16BIT 0x00000002 | 113 | #define ACCESS_16BIT 0x00000002 |
| 114 | #define ACCESS_INTR_MASK 0x00000004 | ||
| 114 | 115 | ||
| 115 | extern int i2c_dw_init(struct dw_i2c_dev *dev); | 116 | extern int i2c_dw_init(struct dw_i2c_dev *dev); |
| 116 | extern void i2c_dw_disable(struct dw_i2c_dev *dev); | 117 | extern void i2c_dw_disable(struct dw_i2c_dev *dev); |
| @@ -93,6 +93,7 @@ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[], · 92 unmodified lines | |||
| 93 | static int dw_i2c_acpi_configure(struct platform_device *pdev) | 93 | static int dw_i2c_acpi_configure(struct platform_device *pdev) |
| 94 | { | 94 | { |
| 95 | struct dw_i2c_dev *dev = platform_get_drvdata(pdev); | 95 | struct dw_i2c_dev *dev = platform_get_drvdata(pdev); |
| 96 | const struct acpi_device_id *id; | ||
| 96 | 97 | ||
| 97 | dev->adapter.nr = -1; | 98 | dev->adapter.nr = -1; |
| 98 | dev->tx_fifo_depth = 32; | 99 | dev->tx_fifo_depth = 32; |
| @@ -106,6 +107,10 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev) · 7 unmodified lines | |||
| 106 | dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt, | 107 | dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt, |
| 107 | &dev->sda_hold_time); | 108 | &dev->sda_hold_time); |
| 108 | 109 | ||
| 110 | id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev); | ||
| 111 | if (id && id->driver_data) | ||
| 112 | dev->accessor_flags |= (u32)id->driver_data; | ||
| 113 | |||
| 109 | return 0; | 114 | return 0; |
| 110 | } | 115 | } |
| 111 | 116 | ||
| @@ -116,7 +121,7 @@ static const struct acpi_device_id dw_i2c_acpi_match[] = { · 4 unmodified lines | |||
| 116 | { "INT3433", 0 }, | 121 | { "INT3433", 0 }, |
| 117 | { "80860F41", 0 }, | 122 | { "80860F41", 0 }, |
| 118 | { "808622C1", 0 }, | 123 | { "808622C1", 0 }, |
| 119 | { "AMD0010", 0 }, | 124 | { "AMD0010", ACCESS_INTR_MASK }, |
| 120 | { } | 125 | { } |
| 121 | }; | 126 | }; |
| 122 | MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); | 127 | MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); |
| @@ -240,12 +245,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) · 117 unmodified lines | |||
| 240 | } | 245 | } |
| 241 | 246 | ||
| 242 | r = i2c_dw_probe(dev); | 247 | r = i2c_dw_probe(dev); |
| 243 | if (r) { | 248 | if (r && !dev->pm_runtime_disabled) |
| 244 | pm_runtime_disable(&pdev->dev); | 249 | pm_runtime_disable(&pdev->dev); |
| 245 | return r; | ||
| 246 | } | ||
| 247 | 250 | ||
| 248 | return 0; | 251 | return r; |
| 249 | } | 252 | } |
| 250 | 253 | ||
| 251 | static int dw_i2c_plat_remove(struct platform_device *pdev) | 254 | static int dw_i2c_plat_remove(struct platform_device *pdev) |
| @@ -260,7 +263,8 @@ static int dw_i2c_plat_remove(struct platform_device *pdev) · 8 unmodified lines | |||
| 260 | 263 | ||
| 261 | pm_runtime_dont_use_autosuspend(&pdev->dev); | 264 | pm_runtime_dont_use_autosuspend(&pdev->dev); |
| 262 | pm_runtime_put_sync(&pdev->dev); | 265 | pm_runtime_put_sync(&pdev->dev); |
| 263 | pm_runtime_disable(&pdev->dev); | 266 | if (!dev->pm_runtime_disabled) |
| 267 | pm_runtime_disable(&pdev->dev); | ||
| 264 | 268 | ||
| 265 | return 0; | 269 | return 0; |
| 266 | } | 270 | } |
| @@ -1119,6 +1119,8 @@ static int i2c_imx_probe(struct platform_device *pdev) · 1118 unmodified lines | |||
| 1119 | i2c_imx, IMX_I2C_I2CR); | 1119 | i2c_imx, IMX_I2C_I2CR); |
| 1120 | imx_i2c_write_reg(i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx, IMX_I2C_I2SR); | 1120 | imx_i2c_write_reg(i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx, IMX_I2C_I2SR); |
| 1121 | 1121 | ||
| 1122 | i2c_imx_init_recovery_info(i2c_imx, pdev); | ||
| 1123 | |||
| 1122 | /* Add I2C adapter */ | 1124 | /* Add I2C adapter */ |
| 1123 | ret = i2c_add_numbered_adapter(&i2c_imx->adapter); | 1125 | ret = i2c_add_numbered_adapter(&i2c_imx->adapter); |
| 1124 | if (ret < 0) { | 1126 | if (ret < 0) { |
| @@ -1126,8 +1128,6 @@ static int i2c_imx_probe(struct platform_device *pdev) · 1 unmodified line | |||
| 1126 | goto clk_disable; | 1128 | goto clk_disable; |
| 1127 | } | 1129 | } |
| 1128 | 1130 | ||
| 1129 | i2c_imx_init_recovery_info(i2c_imx, pdev); | ||
| 1130 | |||
| 1131 | /* Set up platform driver data */ | 1131 | /* Set up platform driver data */ |
| 1132 | platform_set_drvdata(pdev, i2c_imx); | 1132 | platform_set_drvdata(pdev, i2c_imx); |
| 1133 | clk_disable_unprepare(i2c_imx->clk); | 1133 | clk_disable_unprepare(i2c_imx->clk); |
| @@ -146,6 +146,8 @@ struct mv64xxx_i2c_data { · 145 unmodified lines | |||
| 146 | bool errata_delay; | 146 | bool errata_delay; |
| 147 | struct reset_control *rstc; | 147 | struct reset_control *rstc; |
| 148 | bool irq_clear_inverted; | 148 | bool irq_clear_inverted; |
| 149 | /* Clk div is 2 to the power n, not 2 to the power n + 1 */ | ||
| 150 | bool clk_n_base_0; | ||
| 149 | }; | 151 | }; |
| 150 | 152 | ||
| 151 | static struct mv64xxx_i2c_regs mv64xxx_i2c_regs_mv64xxx = { | 153 | static struct mv64xxx_i2c_regs mv64xxx_i2c_regs_mv64xxx = { |
| @@ -757,25 +759,29 @@ MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table); · 605 unmodified lines | |||
| 757 | #ifdef CONFIG_OF | 759 | #ifdef CONFIG_OF |
| 758 | #ifdef CONFIG_HAVE_CLK | 760 | #ifdef CONFIG_HAVE_CLK |
| 759 | static int | 761 | static int |
| 760 | mv64xxx_calc_freq(const int tclk, const int n, const int m) | 762 | mv64xxx_calc_freq(struct mv64xxx_i2c_data *drv_data, |
| 763 | const int tclk, const int n, const int m) | ||
| 761 | { | 764 | { |
| 762 | return tclk / (10 * (m + 1) * (2 << n)); | 765 | if (drv_data->clk_n_base_0) |
| 766 | return tclk / (10 * (m + 1) * (1 << n)); | ||
| 767 | else | ||
| 768 | return tclk / (10 * (m + 1) * (2 << n)); | ||
| 763 | } | 769 | } |
| 764 | 770 | ||
| 765 | static bool | 771 | static bool |
| 766 | mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n, | 772 | mv64xxx_find_baud_factors(struct mv64xxx_i2c_data *drv_data, |
| 767 | u32 *best_m) | 773 | const u32 req_freq, const u32 tclk) |
| 768 | { | 774 | { |
| 769 | int freq, delta, best_delta = INT_MAX; | 775 | int freq, delta, best_delta = INT_MAX; |
| 770 | int m, n; | 776 | int m, n; |
| 771 | 777 | ||
| 772 | for (n = 0; n <= 7; n++) | 778 | for (n = 0; n <= 7; n++) |
| 773 | for (m = 0; m <= 15; m++) { | 779 | for (m = 0; m <= 15; m++) { |
| 774 | freq = mv64xxx_calc_freq(tclk, n, m); | 780 | freq = mv64xxx_calc_freq(drv_data, tclk, n, m); |
| 775 | delta = req_freq - freq; | 781 | delta = req_freq - freq; |
| 776 | if (delta >= 0 && delta < best_delta) { | 782 | if (delta >= 0 && delta < best_delta) { |
| 777 | *best_m = m; | 783 | drv_data->freq_m = m; |
| 778 | *best_n = n; | 784 | drv_data->freq_n = n; |
| 779 | best_delta = delta; | 785 | best_delta = delta; |
| 780 | } | 786 | } |
| 781 | if (best_delta == 0) | 787 | if (best_delta == 0) |
| @@ -813,8 +819,11 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, · 31 unmodified lines | |||
| 813 | if (of_property_read_u32(np, "clock-frequency", &bus_freq)) | 819 | if (of_property_read_u32(np, "clock-frequency", &bus_freq)) |
| 814 | bus_freq = 100000; /* 100kHz by default */ | 820 | bus_freq = 100000; /* 100kHz by default */ |
| 815 | 821 | ||
| 816 | if (!mv64xxx_find_baud_factors(bus_freq, tclk, | 822 | if (of_device_is_compatible(np, "allwinner,sun4i-a10-i2c") || |
| 817 | &drv_data->freq_n, &drv_data->freq_m)) { | 823 | of_device_is_compatible(np, "allwinner,sun6i-a31-i2c")) |
| 824 | drv_data->clk_n_base_0 = true; | ||
| 825 | |||
| 826 | if (!mv64xxx_find_baud_factors(drv_data, bus_freq, tclk)) { | ||
| 818 | rc = -EINVAL; | 827 | rc = -EINVAL; |
| 819 | goto out; | 828 | goto out; |
| 820 | } | 829 | } |
| @@ -576,7 +576,7 @@ static int rcar_reg_slave(struct i2c_client *slave) · 575 unmodified lines | |||
| 576 | if (slave->flags & I2C_CLIENT_TEN) | 576 | if (slave->flags & I2C_CLIENT_TEN) |
| 577 | return -EAFNOSUPPORT; | 577 | return -EAFNOSUPPORT; |
| 578 | 578 | ||
| 579 | pm_runtime_forbid(rcar_i2c_priv_to_dev(priv)); | 579 | pm_runtime_get_sync(rcar_i2c_priv_to_dev(priv)); |
| 580 | 580 | ||
| 581 | priv->slave = slave; | 581 | priv->slave = slave; |
| 582 | rcar_i2c_write(priv, ICSAR, slave->addr); | 582 | rcar_i2c_write(priv, ICSAR, slave->addr); |
| @@ -598,7 +598,7 @@ static int rcar_unreg_slave(struct i2c_client *slave) · 15 unmodified lines | |||
| 598 | 598 | ||
| 599 | priv->slave = NULL; | 599 | priv->slave = NULL; |
| 600 | 600 | ||
| 601 | pm_runtime_allow(rcar_i2c_priv_to_dev(priv)); | 601 | pm_runtime_put(rcar_i2c_priv_to_dev(priv)); |
| 602 | 602 | ||
| 603 | return 0; | 603 | return 0; |
| 604 | } | 604 | } |
| @@ -908,7 +908,7 @@ static int rk3x_i2c_probe(struct platform_device *pdev) · 907 unmodified lines | |||
| 908 | &i2c->scl_fall_ns)) | 908 | &i2c->scl_fall_ns)) |
| 909 | i2c->scl_fall_ns = 300; | 909 | i2c->scl_fall_ns = 300; |
| 910 | if (of_property_read_u32(pdev->dev.of_node, "i2c-sda-falling-time-ns", | 910 | if (of_property_read_u32(pdev->dev.of_node, "i2c-sda-falling-time-ns", |
| 911 | &i2c->scl_fall_ns)) | 911 | &i2c->sda_fall_ns)) |
| 912 | i2c->sda_fall_ns = i2c->scl_fall_ns; | 912 | i2c->sda_fall_ns = i2c->scl_fall_ns; |
| 913 | 913 | ||
| 914 | strlcpy(i2c->adap.name, "rk3x-i2c", sizeof(i2c->adap.name)); | 914 | strlcpy(i2c->adap.name, "rk3x-i2c", sizeof(i2c->adap.name)); |
| @@ -822,7 +822,7 @@ static int st_i2c_probe(struct platform_device *pdev) · 821 unmodified lines | |||
| 822 | 822 | ||
| 823 | adap = &i2c_dev->adap; | 823 | adap = &i2c_dev->adap; |
| 824 | i2c_set_adapdata(adap, i2c_dev); | 824 | i2c_set_adapdata(adap, i2c_dev); |
| 825 | snprintf(adap->name, sizeof(adap->name), "ST I2C(0x%pa)", &res->start); | 825 | snprintf(adap->name, sizeof(adap->name), "ST I2C(%pa)", &res->start); |
| 826 | adap->owner = THIS_MODULE; | 826 | adap->owner = THIS_MODULE; |
| 827 | adap->timeout = 2 * HZ; | 827 | adap->timeout = 2 * HZ; |
| 828 | adap->retries = 0; | 828 | adap->retries = 0; |
| @@ -839,8 +839,10 @@ static int vadc_get_dt_data(struct vadc_priv *vadc, struct device_node *node) · 838 unmodified lines | |||
| 839 | 839 | ||
| 840 | for_each_available_child_of_node(node, child) { | 840 | for_each_available_child_of_node(node, child) { |
| 841 | ret = vadc_get_dt_channel_data(vadc->dev, &prop, child); | 841 | ret = vadc_get_dt_channel_data(vadc->dev, &prop, child); |
| 842 | if (ret) | 842 | if (ret) { |
| 843 | of_node_put(child); | ||
| 843 | return ret; | 844 | return ret; |
| 845 | } | ||
| 844 | 846 | ||
| 845 | vadc->chan_props[index] = prop; | 847 | vadc->chan_props[index] = prop; |
| 846 | 848 | ||
| @@ -302,7 +302,7 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev, · 301 unmodified lines | |||
| 302 | if (trialmask == NULL) | 302 | if (trialmask == NULL) |
| 303 | return -ENOMEM; | 303 | return -ENOMEM; |
| 304 | if (!indio_dev->masklength) { | 304 | if (!indio_dev->masklength) { |
| 305 | WARN_ON("Trying to set scanmask prior to registering buffer\n"); | 305 | WARN(1, "Trying to set scanmask prior to registering buffer\n"); |
| 306 | goto err_invalid_mask; | 306 | goto err_invalid_mask; |
| 307 | } | 307 | } |
| 308 | bitmap_copy(trialmask, buffer->scan_mask, indio_dev->masklength); | 308 | bitmap_copy(trialmask, buffer->scan_mask, indio_dev->masklength); |
| @@ -655,7 +655,7 @@ int __iio_device_attr_init(struct device_attribute *dev_attr, · 654 unmodified lines | |||
| 655 | break; | 655 | break; |
| 656 | case IIO_SEPARATE: | 656 | case IIO_SEPARATE: |
| 657 | if (!chan->indexed) { | 657 | if (!chan->indexed) { |
| 658 | WARN_ON("Differential channels must be indexed\n"); | 658 | WARN(1, "Differential channels must be indexed\n"); |
| 659 | ret = -EINVAL; | 659 | ret = -EINVAL; |
| 660 | goto error_free_full_postfix; | 660 | goto error_free_full_postfix; |
| 661 | } | 661 | } |
| @@ -453,6 +453,7 @@ static int apds9960_set_power_state(struct apds9960_data *data, bool on) · 452 unmodified lines | |||
| 453 | usleep_range(data->als_adc_int_us, | 453 | usleep_range(data->als_adc_int_us, |
| 454 | APDS9960_MAX_INT_TIME_IN_US); | 454 | APDS9960_MAX_INT_TIME_IN_US); |
| 455 | } else { | 455 | } else { |
| 456 | pm_runtime_mark_last_busy(dev); | ||
| 456 | ret = pm_runtime_put_autosuspend(dev); | 457 | ret = pm_runtime_put_autosuspend(dev); |
| 457 | } | 458 | } |
| 458 | 459 | ||
| @@ -130,10 +130,10 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg) · 129 unmodified lines | |||
| 130 | if (ret < 0) | 130 | if (ret < 0) |
| 131 | break; | 131 | break; |
| 132 | 132 | ||
| 133 | /* return 0 since laser is likely pointed out of range */ | 133 | /* return -EINVAL since laser is likely pointed out of range */ |
| 134 | if (ret & LIDAR_REG_STATUS_INVALID) { | 134 | if (ret & LIDAR_REG_STATUS_INVALID) { |
| 135 | *reg = 0; | 135 | *reg = 0; |
| 136 | ret = 0; | 136 | ret = -EINVAL; |
| 137 | break; | 137 | break; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| @@ -197,7 +197,7 @@ static irqreturn_t lidar_trigger_handler(int irq, void *private) · 57 unmodified lines | |||
| 197 | if (!ret) { | 197 | if (!ret) { |
| 198 | iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, | 198 | iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, |
| 199 | iio_get_time_ns()); | 199 | iio_get_time_ns()); |
| 200 | } else { | 200 | } else if (ret != -EINVAL) { |
| 201 | dev_err(&data->client->dev, "cannot read LIDAR measurement"); | 201 | dev_err(&data->client->dev, "cannot read LIDAR measurement"); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| @@ -1126,10 +1126,7 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev, · 1125 unmodified lines | |||
| 1126 | 1126 | ||
| 1127 | rcu_read_lock(); | 1127 | rcu_read_lock(); |
| 1128 | err = fib_lookup(dev_net(net_dev), &fl4, &res, 0); | 1128 | err = fib_lookup(dev_net(net_dev), &fl4, &res, 0); |
| 1129 | if (err) | 1129 | ret = err == 0 && FIB_RES_DEV(res) == net_dev; |
| 1130 | return false; | ||
| 1131 | |||
| 1132 | ret = FIB_RES_DEV(res) == net_dev; | ||
| 1133 | rcu_read_unlock(); | 1130 | rcu_read_unlock(); |
| 1134 | 1131 | ||
| 1135 | return ret; | 1132 | return ret; |
| @@ -1811,6 +1811,11 @@ static int validate_mad(const struct ib_mad_hdr *mad_hdr, · 1810 unmodified lines | |||
| 1811 | if (qp_num == 0) | 1811 | if (qp_num == 0) |
| 1812 | valid = 1; | 1812 | valid = 1; |
| 1813 | } else { | 1813 | } else { |
| 1814 | /* CM attributes other than ClassPortInfo only use Send method */ | ||
| 1815 | if ((mad_hdr->mgmt_class == IB_MGMT_CLASS_CM) && | ||
| 1816 | (mad_hdr->attr_id != IB_MGMT_CLASSPORTINFO_ATTR_ID) && | ||
| 1817 | (mad_hdr->method != IB_MGMT_METHOD_SEND)) | ||
| 1818 | goto out; | ||
| 1814 | /* Filter GSI packets sent to QP0 */ | 1819 | /* Filter GSI packets sent to QP0 */ |
| 1815 | if (qp_num != 0) | 1820 | if (qp_num != 0) |
| 1816 | valid = 1; | 1821 | valid = 1; |
| @@ -512,7 +512,7 @@ static int ib_nl_get_path_rec_attrs_len(ib_sa_comp_mask comp_mask) · 511 unmodified lines | |||
| 512 | return len; | 512 | return len; |
| 513 | } | 513 | } |
| 514 | 514 | ||
| 515 | static int ib_nl_send_msg(struct ib_sa_query *query) | 515 | static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask) |
| 516 | { | 516 | { |
| 517 | struct sk_buff *skb = NULL; | 517 | struct sk_buff *skb = NULL; |
| 518 | struct nlmsghdr *nlh; | 518 | struct nlmsghdr *nlh; |
| @@ -526,7 +526,7 @@ static int ib_nl_send_msg(struct ib_sa_query *query) · 7 unmodified lines | |||
| 526 | if (len <= 0) | 526 | if (len <= 0) |
| 527 | return -EMSGSIZE; | 527 | return -EMSGSIZE; |
| 528 | 528 | ||
| 529 | skb = nlmsg_new(len, GFP_KERNEL); | 529 | skb = nlmsg_new(len, gfp_mask); |
| 530 | if (!skb) | 530 | if (!skb) |
| 531 | return -ENOMEM; | 531 | return -ENOMEM; |
| 532 | 532 | ||
| @@ -544,7 +544,7 @@ static int ib_nl_send_msg(struct ib_sa_query *query) · 11 unmodified lines | |||
| 544 | /* Repair the nlmsg header length */ | 544 | /* Repair the nlmsg header length */ |
| 545 | nlmsg_end(skb, nlh); | 545 | nlmsg_end(skb, nlh); |
| 546 | 546 | ||
| 547 | ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_LS, GFP_KERNEL); | 547 | ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_LS, gfp_mask); |
| 548 | if (!ret) | 548 | if (!ret) |
| 549 | ret = len; | 549 | ret = len; |
| 550 | else | 550 | else |
| @@ -553,7 +553,7 @@ static int ib_nl_send_msg(struct ib_sa_query *query) · 2 unmodified lines | |||
| 553 | return ret; | 553 | return ret; |
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | static int ib_nl_make_request(struct ib_sa_query *query) | 556 | static int ib_nl_make_request(struct ib_sa_query *query, gfp_t gfp_mask) |
| 557 | { | 557 | { |
| 558 | unsigned long flags; | 558 | unsigned long flags; |
| 559 | unsigned long delay; | 559 | unsigned long delay; |
| @@ -562,25 +562,27 @@ static int ib_nl_make_request(struct ib_sa_query *query) · 2 unmodified lines | |||
| 562 | INIT_LIST_HEAD(&query->list); | 562 | INIT_LIST_HEAD(&query->list); |
| 563 | query->seq = (u32)atomic_inc_return(&ib_nl_sa_request_seq); | 563 | query->seq = (u32)atomic_inc_return(&ib_nl_sa_request_seq); |
| 564 | 564 | ||
| 565 | /* Put the request on the list first.*/ | ||
| 565 | spin_lock_irqsave(&ib_nl_request_lock, flags); | 566 | spin_lock_irqsave(&ib_nl_request_lock, flags); |
| 566 | ret = ib_nl_send_msg(query); | ||
| 567 | if (ret <= 0) { | ||
| 568 | ret = -EIO; | ||
| 569 | goto request_out; | ||
| 570 | } else { | ||
| 571 | ret = 0; | ||
| 572 | } | ||
| 573 | |||
| 574 | delay = msecs_to_jiffies(sa_local_svc_timeout_ms); | 567 | delay = msecs_to_jiffies(sa_local_svc_timeout_ms); |
| 575 | query->timeout = delay + jiffies; | 568 | query->timeout = delay + jiffies; |
| 576 | list_add_tail(&query->list, &ib_nl_request_list); | 569 | list_add_tail(&query->list, &ib_nl_request_list); |
| 577 | /* Start the timeout if this is the only request */ | 570 | /* Start the timeout if this is the only request */ |
| 578 | if (ib_nl_request_list.next == &query->list) | 571 | if (ib_nl_request_list.next == &query->list) |
| 579 | queue_delayed_work(ib_nl_wq, &ib_nl_timed_work, delay); | 572 | queue_delayed_work(ib_nl_wq, &ib_nl_timed_work, delay); |
| 580 | |||
| 581 | request_out: | ||
| 582 | spin_unlock_irqrestore(&ib_nl_request_lock, flags); | 573 | spin_unlock_irqrestore(&ib_nl_request_lock, flags); |
| 583 | 574 | ||
| 575 | ret = ib_nl_send_msg(query, gfp_mask); | ||
| 576 | if (ret <= 0) { | ||
| 577 | ret = -EIO; | ||
| 578 | /* Remove the request */ | ||
| 579 | spin_lock_irqsave(&ib_nl_request_lock, flags); | ||
| 580 | list_del(&query->list); | ||
| 581 | spin_unlock_irqrestore(&ib_nl_request_lock, flags); | ||
| 582 | } else { | ||
| 583 | ret = 0; | ||
| 584 | } | ||
| 585 | |||
| 584 | return ret; | 586 | return ret; |
| 585 | } | 587 | } |
| 586 | 588 | ||
| @@ -1108,7 +1110,7 @@ static int send_mad(struct ib_sa_query *query, int timeout_ms, gfp_t gfp_mask) · 521 unmodified lines | |||
| 1108 | 1110 | ||
| 1109 | if (query->flags & IB_SA_ENABLE_LOCAL_SERVICE) { | 1111 | if (query->flags & IB_SA_ENABLE_LOCAL_SERVICE) { |
| 1110 | if (!ibnl_chk_listeners(RDMA_NL_GROUP_LS)) { | 1112 | if (!ibnl_chk_listeners(RDMA_NL_GROUP_LS)) { |
| 1111 | if (!ib_nl_make_request(query)) | 1113 | if (!ib_nl_make_request(query, gfp_mask)) |
| 1112 | return id; | 1114 | return id; |
| 1113 | } | 1115 | } |
| 1114 | ib_sa_disable_local_svc(query); | 1116 | ib_sa_disable_local_svc(query); |
| @@ -62,9 +62,11 @@ static struct uverbs_lock_class rule_lock_class = { .name = "RULE-uobj" }; · 61 unmodified lines | |||
| 62 | * The ib_uobject locking scheme is as follows: | 62 | * The ib_uobject locking scheme is as follows: |
| 63 | * | 63 | * |
| 64 | * - ib_uverbs_idr_lock protects the uverbs idrs themselves, so it | 64 | * - ib_uverbs_idr_lock protects the uverbs idrs themselves, so it |
| 65 | * needs to be held during all idr operations. When an object is | 65 | * needs to be held during all idr write operations. When an object is |
| 66 | * looked up, a reference must be taken on the object's kref before | 66 | * looked up, a reference must be taken on the object's kref before |
| 67 | * dropping this lock. | 67 | * dropping this lock. For read operations, the rcu_read_lock() |
| 68 | * and rcu_write_lock() but similarly the kref reference is grabbed | ||
| 69 | * before the rcu_read_unlock(). | ||
| 68 | * | 70 | * |
| 69 | * - Each object also has an rwsem. This rwsem must be held for | 71 | * - Each object also has an rwsem. This rwsem must be held for |
| 70 | * reading while an operation that uses the object is performed. | 72 | * reading while an operation that uses the object is performed. |
| @@ -96,7 +98,7 @@ static void init_uobj(struct ib_uobject *uobj, u64 user_handle, · 25 unmodified lines | |||
| 96 | 98 | ||
| 97 | static void release_uobj(struct kref *kref) | 99 | static void release_uobj(struct kref *kref) |
| 98 | { | 100 | { |
| 99 | kfree(container_of(kref, struct ib_uobject, ref)); | 101 | kfree_rcu(container_of(kref, struct ib_uobject, ref), rcu); |
| 100 | } | 102 | } |
| 101 | 103 | ||
| 102 | static void put_uobj(struct ib_uobject *uobj) | 104 | static void put_uobj(struct ib_uobject *uobj) |
| @@ -145,7 +147,7 @@ static struct ib_uobject *__idr_get_uobj(struct idr *idr, int id, · 42 unmodified lines | |||
| 145 | { | 147 | { |
| 146 | struct ib_uobject *uobj; | 148 | struct ib_uobject *uobj; |
| 147 | 149 | ||
| 148 | spin_lock(&ib_uverbs_idr_lock); | 150 | rcu_read_lock(); |
| 149 | uobj = idr_find(idr, id); | 151 | uobj = idr_find(idr, id); |
| 150 | if (uobj) { | 152 | if (uobj) { |
| 151 | if (uobj->context == context) | 153 | if (uobj->context == context) |
| @@ -153,7 +155,7 @@ static struct ib_uobject *__idr_get_uobj(struct idr *idr, int id, · 1 unmodified line | |||
| 153 | else | 155 | else |
| 154 | uobj = NULL; | 156 | uobj = NULL; |
| 155 | } | 157 | } |
| 156 | spin_unlock(&ib_uverbs_idr_lock); | 158 | rcu_read_unlock(); |
| 157 | 159 | ||
| 158 | return uobj; | 160 | return uobj; |
| 159 | } | 161 | } |
| @@ -2446,6 +2448,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, · 2286 unmodified lines | |||
| 2446 | int i, sg_ind; | 2448 | int i, sg_ind; |
| 2447 | int is_ud; | 2449 | int is_ud; |
| 2448 | ssize_t ret = -EINVAL; | 2450 | ssize_t ret = -EINVAL; |
| 2451 | size_t next_size; | ||
| 2449 | 2452 | ||
| 2450 | if (copy_from_user(&cmd, buf, sizeof cmd)) | 2453 | if (copy_from_user(&cmd, buf, sizeof cmd)) |
| 2451 | return -EFAULT; | 2454 | return -EFAULT; |
| @@ -2490,7 +2493,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, · 38 unmodified lines | |||
| 2490 | goto out_put; | 2493 | goto out_put; |
| 2491 | } | 2494 | } |
| 2492 | 2495 | ||
| 2493 | ud = alloc_wr(sizeof(*ud), user_wr->num_sge); | 2496 | next_size = sizeof(*ud); |
| 2497 | ud = alloc_wr(next_size, user_wr->num_sge); | ||
| 2494 | if (!ud) { | 2498 | if (!ud) { |
| 2495 | ret = -ENOMEM; | 2499 | ret = -ENOMEM; |
| 2496 | goto out_put; | 2500 | goto out_put; |
| @@ -2511,7 +2515,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, · 14 unmodified lines | |||
| 2511 | user_wr->opcode == IB_WR_RDMA_READ) { | 2515 | user_wr->opcode == IB_WR_RDMA_READ) { |
| 2512 | struct ib_rdma_wr *rdma; | 2516 | struct ib_rdma_wr *rdma; |
| 2513 | 2517 | ||
| 2514 | rdma = alloc_wr(sizeof(*rdma), user_wr->num_sge); | 2518 | next_size = sizeof(*rdma); |
| 2519 | rdma = alloc_wr(next_size, user_wr->num_sge); | ||
| 2515 | if (!rdma) { | 2520 | if (!rdma) { |
| 2516 | ret = -ENOMEM; | 2521 | ret = -ENOMEM; |
| 2517 | goto out_put; | 2522 | goto out_put; |
| @@ -2525,7 +2530,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, · 7 unmodified lines | |||
| 2525 | user_wr->opcode == IB_WR_ATOMIC_FETCH_AND_ADD) { | 2530 | user_wr->opcode == IB_WR_ATOMIC_FETCH_AND_ADD) { |
| 2526 | struct ib_atomic_wr *atomic; | 2531 | struct ib_atomic_wr *atomic; |
| 2527 | 2532 | ||
| 2528 | atomic = alloc_wr(sizeof(*atomic), user_wr->num_sge); | 2533 | next_size = sizeof(*atomic); |
| 2534 | atomic = alloc_wr(next_size, user_wr->num_sge); | ||
| 2529 | if (!atomic) { | 2535 | if (!atomic) { |
| 2530 | ret = -ENOMEM; | 2536 | ret = -ENOMEM; |
| 2531 | goto out_put; | 2537 | goto out_put; |
| @@ -2540,7 +2546,8 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, · 8 unmodified lines | |||
| 2540 | } else if (user_wr->opcode == IB_WR_SEND || | 2546 | } else if (user_wr->opcode == IB_WR_SEND || |
| 2541 | user_wr->opcode == IB_WR_SEND_WITH_IMM || | 2547 | user_wr->opcode == IB_WR_SEND_WITH_IMM || |
| 2542 | user_wr->opcode == IB_WR_SEND_WITH_INV) { | 2548 | user_wr->opcode == IB_WR_SEND_WITH_INV) { |
| 2543 | next = alloc_wr(sizeof(*next), user_wr->num_sge); | 2549 | next_size = sizeof(*next); |
| 2550 | next = alloc_wr(next_size, user_wr->num_sge); | ||
| 2544 | if (!next) { | 2551 | if (!next) { |
| 2545 | ret = -ENOMEM; | 2552 | ret = -ENOMEM; |
| 2546 | goto out_put; | 2553 | goto out_put; |
| @@ -2572,7 +2579,7 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, · 25 unmodified lines | |||
| 2572 | 2579 | ||
| 2573 | if (next->num_sge) { | 2580 | if (next->num_sge) { |
| 2574 | next->sg_list = (void *) next + | 2581 | next->sg_list = (void *) next + |
| 2575 | ALIGN(sizeof *next, sizeof (struct ib_sge)); | 2582 | ALIGN(next_size, sizeof(struct ib_sge)); |
| 2576 | if (copy_from_user(next->sg_list, | 2583 | if (copy_from_user(next->sg_list, |
| 2577 | buf + sizeof cmd + | 2584 | buf + sizeof cmd + |
| 2578 | cmd.wr_count * cmd.wqe_size + | 2585 | cmd.wr_count * cmd.wqe_size + |
| @@ -1516,7 +1516,7 @@ EXPORT_SYMBOL(ib_map_mr_sg); · 1515 unmodified lines | |||
| 1516 | * @sg_nents: number of entries in sg | 1516 | * @sg_nents: number of entries in sg |
| 1517 | * @set_page: driver page assignment function pointer | 1517 | * @set_page: driver page assignment function pointer |
| 1518 | * | 1518 | * |
| 1519 | * Core service helper for drivers to covert the largest | 1519 | * Core service helper for drivers to convert the largest |
| 1520 | * prefix of given sg list to a page vector. The sg list | 1520 | * prefix of given sg list to a page vector. The sg list |
| 1521 | * prefix converted is the prefix that meet the requirements | 1521 | * prefix converted is the prefix that meet the requirements |
| 1522 | * of ib_map_mr_sg. | 1522 | * of ib_map_mr_sg. |
| @@ -1533,7 +1533,7 @@ int ib_sg_to_pages(struct ib_mr *mr, · 10 unmodified lines | |||
| 1533 | u64 last_end_dma_addr = 0, last_page_addr = 0; | 1533 | u64 last_end_dma_addr = 0, last_page_addr = 0; |
| 1534 | unsigned int last_page_off = 0; | 1534 | unsigned int last_page_off = 0; |
| 1535 | u64 page_mask = ~((u64)mr->page_size - 1); | 1535 | u64 page_mask = ~((u64)mr->page_size - 1); |
| 1536 | int i; | 1536 | int i, ret; |
| 1537 | 1537 | ||
| 1538 | mr->iova = sg_dma_address(&sgl[0]); | 1538 | mr->iova = sg_dma_address(&sgl[0]); |
| 1539 | mr->length = 0; | 1539 | mr->length = 0; |
| @@ -1544,27 +1544,29 @@ int ib_sg_to_pages(struct ib_mr *mr, · 4 unmodified lines | |||
| 1544 | u64 end_dma_addr = dma_addr + dma_len; | 1544 | u64 end_dma_addr = dma_addr + dma_len; |
| 1545 | u64 page_addr = dma_addr & page_mask; | 1545 | u64 page_addr = dma_addr & page_mask; |
| 1546 | 1546 | ||
| 1547 | if (i && page_addr != dma_addr) { | 1547 | /* |
| 1548 | if (last_end_dma_addr != dma_addr) { | 1548 | * For the second and later elements, check whether either the |
| 1549 | /* gap */ | 1549 | * end of element i-1 or the start of element i is not aligned |
| 1550 | goto done; | 1550 | * on a page boundary. |
| 1551 | 1551 | */ | |
| 1552 | } else if (last_page_off + dma_len <= mr->page_size) { | 1552 | if (i && (last_page_off != 0 || page_addr != dma_addr)) { |
| 1553 | /* chunk this fragment with the last */ | 1553 | /* Stop mapping if there is a gap. */ |
| 1554 | mr->length += dma_len; | 1554 | if (last_end_dma_addr != dma_addr) |
| 1555 | last_end_dma_addr += dma_len; | 1555 | break; |
| 1556 | last_page_off += dma_len; | 1556 | |
| 1557 | continue; | 1557 | /* |
| 1558 | } else { | 1558 | * Coalesce this element with the last. If it is small |
| 1559 | /* map starting from the next page */ | 1559 | * enough just update mr->length. Otherwise start |
| 1560 | page_addr = last_page_addr + mr->page_size; | 1560 | * mapping from the next page. |
| 1561 | dma_len -= mr->page_size - last_page_off; | 1561 | */ |
| 1562 | } | 1562 | goto next_page; |
| 1563 | } | 1563 | } |
| 1564 | 1564 | ||
| 1565 | do { | 1565 | do { |
| 1566 | if (unlikely(set_page(mr, page_addr))) | 1566 | ret = set_page(mr, page_addr); |
| 1567 | goto done; | 1567 | if (unlikely(ret < 0)) |
| 1568 | return i ? : ret; | ||
| 1569 | next_page: | ||
| 1568 | page_addr += mr->page_size; | 1570 | page_addr += mr->page_size; |
| 1569 | } while (page_addr < end_dma_addr); | 1571 | } while (page_addr < end_dma_addr); |
| 1570 | 1572 | ||
| @@ -1574,7 +1576,6 @@ int ib_sg_to_pages(struct ib_mr *mr, · 3 unmodified lines | |||
| 1574 | last_page_off = end_dma_addr & ~page_mask; | 1576 | last_page_off = end_dma_addr & ~page_mask; |
| 1575 | } | 1577 | } |
| 1576 | 1578 | ||
| 1577 | done: | ||
| 1578 | return i; | 1579 | return i; |
| 1579 | } | 1580 | } |
| 1580 | EXPORT_SYMBOL(ib_sg_to_pages); | 1581 | EXPORT_SYMBOL(ib_sg_to_pages); |
| @@ -456,7 +456,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, · 455 unmodified lines | |||
| 456 | props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; | 456 | props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; |
| 457 | props->max_sge = min(dev->dev->caps.max_sq_sg, | 457 | props->max_sge = min(dev->dev->caps.max_sq_sg, |
| 458 | dev->dev->caps.max_rq_sg); | 458 | dev->dev->caps.max_rq_sg); |
| 459 | props->max_sge_rd = props->max_sge; | 459 | props->max_sge_rd = MLX4_MAX_SGE_RD; |
| 460 | props->max_cq = dev->dev->quotas.cq; | 460 | props->max_cq = dev->dev->quotas.cq; |
| 461 | props->max_cqe = dev->dev->caps.max_cqes; | 461 | props->max_cqe = dev->dev->caps.max_cqes; |
| 462 | props->max_mr = dev->dev->quotas.mpt; | 462 | props->max_mr = dev->dev->quotas.mpt; |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | #include <linux/log2.h> | 34 | #include <linux/log2.h> |
| 35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
| 36 | #include <linux/netdevice.h> | 36 | #include <linux/netdevice.h> |
| 37 | #include <linux/vmalloc.h> | ||
| 37 | 38 | ||
| 38 | #include <rdma/ib_cache.h> | 39 | #include <rdma/ib_cache.h> |
| 39 | #include <rdma/ib_pack.h> | 40 | #include <rdma/ib_pack.h> |
| @@ -795,8 +796,14 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, · 755 unmodified lines | |||
| 795 | if (err) | 796 | if (err) |
| 796 | goto err_mtt; | 797 | goto err_mtt; |
| 797 | 798 | ||
| 798 | qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof (u64), gfp); | 799 | qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64), gfp); |
| 799 | qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof (u64), gfp); | 800 | if (!qp->sq.wrid) |
| 801 | qp->sq.wrid = __vmalloc(qp->sq.wqe_cnt * sizeof(u64), | ||
| 802 | gfp, PAGE_KERNEL); | ||
| 803 | qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64), gfp); | ||
| 804 | if (!qp->rq.wrid) | ||
| 805 | qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64), | ||
| 806 | gfp, PAGE_KERNEL); | ||
| 800 | if (!qp->sq.wrid || !qp->rq.wrid) { | 807 | if (!qp->sq.wrid || !qp->rq.wrid) { |
| 801 | err = -ENOMEM; | 808 | err = -ENOMEM; |
| 802 | goto err_wrid; | 809 | goto err_wrid; |
| @@ -886,8 +893,8 @@ err_wrid: · 83 unmodified lines | |||
| 886 | if (qp_has_rq(init_attr)) | 893 | if (qp_has_rq(init_attr)) |
| 887 | mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), &qp->db); | 894 | mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), &qp->db); |
| 888 | } else { | 895 | } else { |
| 889 | kfree(qp->sq.wrid); | 896 | kvfree(qp->sq.wrid); |
| 890 | kfree(qp->rq.wrid); | 897 | kvfree(qp->rq.wrid); |
| 891 | } | 898 | } |
| 892 | 899 | ||
| 893 | err_mtt: | 900 | err_mtt: |
| @@ -1062,8 +1069,8 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, · 168 unmodified lines | |||
| 1062 | &qp->db); | 1069 | &qp->db); |
| 1063 | ib_umem_release(qp->umem); | 1070 | ib_umem_release(qp->umem); |
| 1064 | } else { | 1071 | } else { |
| 1065 | kfree(qp->sq.wrid); | 1072 | kvfree(qp->sq.wrid); |
| 1066 | kfree(qp->rq.wrid); | 1073 | kvfree(qp->rq.wrid); |
| 1067 | if (qp->mlx4_ib_qp_type & (MLX4_IB_QPT_PROXY_SMI_OWNER | | 1074 | if (qp->mlx4_ib_qp_type & (MLX4_IB_QPT_PROXY_SMI_OWNER | |
| 1068 | MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI)) | 1075 | MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI)) |
| 1069 | free_proxy_bufs(&dev->ib_dev, qp); | 1076 | free_proxy_bufs(&dev->ib_dev, qp); |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | #include <linux/mlx4/qp.h> | 34 | #include <linux/mlx4/qp.h> |
| 35 | #include <linux/mlx4/srq.h> | 35 | #include <linux/mlx4/srq.h> |
| 36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
| 37 | #include <linux/vmalloc.h> | ||
| 37 | 38 | ||
| 38 | #include "mlx4_ib.h" | 39 | #include "mlx4_ib.h" |
| 39 | #include "user.h" | 40 | #include "user.h" |
| @@ -172,8 +173,12 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, · 132 unmodified lines | |||
| 172 | 173 | ||
| 173 | srq->wrid = kmalloc(srq->msrq.max * sizeof (u64), GFP_KERNEL); | 174 | srq->wrid = kmalloc(srq->msrq.max * sizeof (u64), GFP_KERNEL); |
| 174 | if (!srq->wrid) { | 175 | if (!srq->wrid) { |
| 175 | err = -ENOMEM; | 176 | srq->wrid = __vmalloc(srq->msrq.max * sizeof(u64), |
| 176 | goto err_mtt; | 177 | GFP_KERNEL, PAGE_KERNEL); |
| 178 | if (!srq->wrid) { | ||
| 179 | err = -ENOMEM; | ||
| 180 | goto err_mtt; | ||
| 181 | } | ||
| 177 | } | 182 | } |
| 178 | } | 183 | } |
| 179 | 184 | ||
| @@ -204,7 +209,7 @@ err_wrid: · 24 unmodified lines | |||
| 204 | if (pd->uobject) | 209 | if (pd->uobject) |
| 205 | mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), &srq->db); | 210 | mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), &srq->db); |
| 206 | else | 211 | else |
| 207 | kfree(srq->wrid); | 212 | kvfree(srq->wrid); |
| 208 | 213 | ||
| 209 | err_mtt: | 214 | err_mtt: |
| 210 | mlx4_mtt_cleanup(dev->dev, &srq->mtt); | 215 | mlx4_mtt_cleanup(dev->dev, &srq->mtt); |
| @@ -381,7 +381,19 @@ static void __cache_work_func(struct mlx5_cache_ent *ent) · 380 unmodified lines | |||
| 381 | } | 381 | } |
| 382 | } | 382 | } |
| 383 | } else if (ent->cur > 2 * ent->limit) { | 383 | } else if (ent->cur > 2 * ent->limit) { |
| 384 | if (!someone_adding(cache) && | 384 | /* |
| 385 | * The remove_keys() logic is performed as garbage collection | ||
| 386 | * task. Such task is intended to be run when no other active | ||
| 387 | * processes are running. | ||
| 388 | * | ||
| 389 | * The need_resched() will return TRUE if there are user tasks | ||
| 390 | * to be activated in near future. | ||
| 391 | * | ||
| 392 | * In such case, we don't execute remove_keys() and postpone | ||
| 393 | * the garbage collection work to try to run in next cycle, | ||
| 394 | * in order to free CPU resources to other tasks. | ||
| 395 | */ | ||
| 396 | if (!need_resched() && !someone_adding(cache) && | ||
| 385 | time_after(jiffies, cache->last_add + 300 * HZ)) { | 397 | time_after(jiffies, cache->last_add + 300 * HZ)) { |
| 386 | remove_keys(dev, i, 1); | 398 | remove_keys(dev, i, 1); |
| 387 | if (ent->cur > ent->limit) | 399 | if (ent->cur > ent->limit) |
| @@ -292,7 +292,7 @@ int qib_refresh_qsfp_cache(struct qib_pportdata *ppd, struct qib_qsfp_cache *cp) · 291 unmodified lines | |||
| 292 | qib_dev_porterr(ppd->dd, ppd->port, | 292 | qib_dev_porterr(ppd->dd, ppd->port, |
| 293 | "QSFP byte0 is 0x%02X, S/B 0x0C/D\n", peek[0]); | 293 | "QSFP byte0 is 0x%02X, S/B 0x0C/D\n", peek[0]); |
| 294 | 294 | ||
| 295 | if ((peek[2] & 2) == 0) { | 295 | if ((peek[2] & 4) == 0) { |
| 296 | /* | 296 | /* |
| 297 | * If cable is paged, rather than "flat memory", we need to | 297 | * If cable is paged, rather than "flat memory", we need to |
| 298 | * set the page to zero, Even if it already appears to be zero. | 298 | * set the page to zero, Even if it already appears to be zero. |
| @@ -538,7 +538,7 @@ int qib_qsfp_dump(struct qib_pportdata *ppd, char *buf, int len) · 239 unmodified lines | |||
| 538 | sofar += scnprintf(buf + sofar, len - sofar, "Date:%.*s\n", | 538 | sofar += scnprintf(buf + sofar, len - sofar, "Date:%.*s\n", |
| 539 | QSFP_DATE_LEN, cd.date); | 539 | QSFP_DATE_LEN, cd.date); |
| 540 | sofar += scnprintf(buf + sofar, len - sofar, "Lot:%.*s\n", | 540 | sofar += scnprintf(buf + sofar, len - sofar, "Lot:%.*s\n", |
| 541 | QSFP_LOT_LEN, cd.date); | 541 | QSFP_LOT_LEN, cd.lot); |
| 542 | 542 | ||
| 543 | while (bidx < QSFP_DEFAULT_HDR_CNT) { | 543 | while (bidx < QSFP_DEFAULT_HDR_CNT) { |
| 544 | int iidx; | 544 | int iidx; |
| @@ -329,9 +329,9 @@ struct qib_sge { · 328 unmodified lines | |||
| 329 | struct qib_mr { | 329 | struct qib_mr { |
| 330 | struct ib_mr ibmr; | 330 | struct ib_mr ibmr; |
| 331 | struct ib_umem *umem; | 331 | struct ib_umem *umem; |
| 332 | struct qib_mregion mr; /* must be last */ | ||
| 333 | u64 *pages; | 332 | u64 *pages; |
| 334 | u32 npages; | 333 | u32 npages; |
| 334 | struct qib_mregion mr; /* must be last */ | ||
| 335 | }; | 335 | }; |
| 336 | 336 | ||
| 337 | /* | 337 | /* |
| @@ -1293,7 +1293,7 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task, · 1292 unmodified lines | |||
| 1293 | if (mr_status.fail_status & IB_MR_CHECK_SIG_STATUS) { | 1293 | if (mr_status.fail_status & IB_MR_CHECK_SIG_STATUS) { |
| 1294 | sector_t sector_off = mr_status.sig_err.sig_err_offset; | 1294 | sector_t sector_off = mr_status.sig_err.sig_err_offset; |
| 1295 | 1295 | ||
| 1296 | do_div(sector_off, sector_size + 8); | 1296 | sector_div(sector_off, sector_size + 8); |
| 1297 | *sector = scsi_get_lba(iser_task->sc) + sector_off; | 1297 | *sector = scsi_get_lba(iser_task->sc) + sector_off; |
| 1298 | 1298 | ||
| 1299 | pr_err("PI error found type %d at sector %llx " | 1299 | pr_err("PI error found type %d at sector %llx " |
| @@ -157,16 +157,9 @@ isert_create_qp(struct isert_conn *isert_conn, · 156 unmodified lines | |||
| 157 | attr.recv_cq = comp->cq; | 157 | attr.recv_cq = comp->cq; |
| 158 | attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS; | 158 | attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS; |
| 159 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; | 159 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; |
| 160 | /* | 160 | attr.cap.max_send_sge = device->dev_attr.max_sge; |
| 161 | * FIXME: Use devattr.max_sge - 2 for max_send_sge as | 161 | isert_conn->max_sge = min(device->dev_attr.max_sge, |
| 162 | * work-around for RDMA_READs with ConnectX-2. | 162 | device->dev_attr.max_sge_rd); |
| 163 | * | ||
| 164 | * Also, still make sure to have at least two SGEs for | ||
| 165 | * outgoing control PDU responses. | ||
| 166 | */ | ||
| 167 | attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2); | ||
| 168 | isert_conn->max_sge = attr.cap.max_send_sge; | ||
| 169 | |||
| 170 | attr.cap.max_recv_sge = 1; | 163 | attr.cap.max_recv_sge = 1; |
| 171 | attr.sq_sig_type = IB_SIGNAL_REQ_WR; | 164 | attr.sq_sig_type = IB_SIGNAL_REQ_WR; |
| 172 | attr.qp_type = IB_QPT_RC; | 165 | attr.qp_type = IB_QPT_RC; |
| @@ -488,7 +488,7 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch) · 487 unmodified lines | |||
| 488 | struct ib_qp *qp; | 488 | struct ib_qp *qp; |
| 489 | struct ib_fmr_pool *fmr_pool = NULL; | 489 | struct ib_fmr_pool *fmr_pool = NULL; |
| 490 | struct srp_fr_pool *fr_pool = NULL; | 490 | struct srp_fr_pool *fr_pool = NULL; |
| 491 | const int m = 1 + dev->use_fast_reg; | 491 | const int m = dev->use_fast_reg ? 3 : 1; |
| 492 | struct ib_cq_init_attr cq_attr = {}; | 492 | struct ib_cq_init_attr cq_attr = {}; |
| 493 | int ret; | 493 | int ret; |
| 494 | 494 | ||
| @@ -994,16 +994,16 @@ static int srp_connect_ch(struct srp_rdma_ch *ch, bool multich) · 499 unmodified lines | |||
| 994 | 994 | ||
| 995 | ret = srp_lookup_path(ch); | 995 | ret = srp_lookup_path(ch); |
| 996 | if (ret) | 996 | if (ret) |
| 997 | return ret; | 997 | goto out; |
| 998 | 998 | ||
| 999 | while (1) { | 999 | while (1) { |
| 1000 | init_completion(&ch->done); | 1000 | init_completion(&ch->done); |
| 1001 | ret = srp_send_req(ch, multich); | 1001 | ret = srp_send_req(ch, multich); |
| 1002 | if (ret) | 1002 | if (ret) |
| 1003 | return ret; | 1003 | goto out; |
| 1004 | ret = wait_for_completion_interruptible(&ch->done); | 1004 | ret = wait_for_completion_interruptible(&ch->done); |
| 1005 | if (ret < 0) | 1005 | if (ret < 0) |
| 1006 | return ret; | 1006 | goto out; |
| 1007 | 1007 | ||
| 1008 | /* | 1008 | /* |
| 1009 | * The CM event handling code will set status to | 1009 | * The CM event handling code will set status to |
| @@ -1011,15 +1011,16 @@ static int srp_connect_ch(struct srp_rdma_ch *ch, bool multich) · 1 unmodified line | |||
| 1011 | * back, or SRP_DLID_REDIRECT if we get a lid/qp | 1011 | * back, or SRP_DLID_REDIRECT if we get a lid/qp |
| 1012 | * redirect REJ back. | 1012 | * redirect REJ back. |
| 1013 | */ | 1013 | */ |
| 1014 | switch (ch->status) { | 1014 | ret = ch->status; |
| 1015 | switch (ret) { | ||
| 1015 | case 0: | 1016 | case 0: |
| 1016 | ch->connected = true; | 1017 | ch->connected = true; |
| 1017 | return 0; | 1018 | goto out; |
| 1018 | 1019 | ||
| 1019 | case SRP_PORT_REDIRECT: | 1020 | case SRP_PORT_REDIRECT: |
| 1020 | ret = srp_lookup_path(ch); | 1021 | ret = srp_lookup_path(ch); |
| 1021 | if (ret) | 1022 | if (ret) |
| 1022 | return ret; | 1023 | goto out; |
| 1023 | break; | 1024 | break; |
| 1024 | 1025 | ||
| 1025 | case SRP_DLID_REDIRECT: | 1026 | case SRP_DLID_REDIRECT: |
| @@ -1028,13 +1029,16 @@ static int srp_connect_ch(struct srp_rdma_ch *ch, bool multich) · 2 unmodified lines | |||
| 1028 | case SRP_STALE_CONN: | 1029 | case SRP_STALE_CONN: |
| 1029 | shost_printk(KERN_ERR, target->scsi_host, PFX | 1030 | shost_printk(KERN_ERR, target->scsi_host, PFX |
| 1030 | "giving up on stale connection\n"); | 1031 | "giving up on stale connection\n"); |
| 1031 | ch->status = -ECONNRESET; | 1032 | ret = -ECONNRESET; |
| 1032 | return ch->status; | 1033 | goto out; |
| 1033 | 1034 | ||
| 1034 | default: | 1035 | default: |
| 1035 | return ch->status; | 1036 | goto out; |
| 1036 | } | 1037 | } |
| 1037 | } | 1038 | } |
| 1039 | |||
| 1040 | out: | ||
| 1041 | return ret <= 0 ? ret : -ENODEV; | ||
| 1038 | } | 1042 | } |
| 1039 | 1043 | ||
| 1040 | static int srp_inv_rkey(struct srp_rdma_ch *ch, u32 rkey) | 1044 | static int srp_inv_rkey(struct srp_rdma_ch *ch, u32 rkey) |
| @@ -1309,7 +1313,7 @@ reset_state: · 268 unmodified lines | |||
| 1309 | } | 1313 | } |
| 1310 | 1314 | ||
| 1311 | static int srp_map_finish_fr(struct srp_map_state *state, | 1315 | static int srp_map_finish_fr(struct srp_map_state *state, |
| 1312 | struct srp_rdma_ch *ch) | 1316 | struct srp_rdma_ch *ch, int sg_nents) |
| 1313 | { | 1317 | { |
| 1314 | struct srp_target_port *target = ch->target; | 1318 | struct srp_target_port *target = ch->target; |
| 1315 | struct srp_device *dev = target->srp_host->srp_dev; | 1319 | struct srp_device *dev = target->srp_host->srp_dev; |
| @@ -1324,10 +1328,10 @@ static int srp_map_finish_fr(struct srp_map_state *state, · 8 unmodified lines | |||
| 1324 | 1328 | ||
| 1325 | WARN_ON_ONCE(!dev->use_fast_reg); | 1329 | WARN_ON_ONCE(!dev->use_fast_reg); |
| 1326 | 1330 | ||
| 1327 | if (state->sg_nents == 0) | 1331 | if (sg_nents == 0) |
| 1328 | return 0; | 1332 | return 0; |
| 1329 | 1333 | ||
| 1330 | if (state->sg_nents == 1 && target->global_mr) { | 1334 | if (sg_nents == 1 && target->global_mr) { |
| 1331 | srp_map_desc(state, sg_dma_address(state->sg), | 1335 | srp_map_desc(state, sg_dma_address(state->sg), |
| 1332 | sg_dma_len(state->sg), | 1336 | sg_dma_len(state->sg), |
| 1333 | target->global_mr->rkey); | 1337 | target->global_mr->rkey); |
| @@ -1341,8 +1345,7 @@ static int srp_map_finish_fr(struct srp_map_state *state, · 7 unmodified lines | |||
| 1341 | rkey = ib_inc_rkey(desc->mr->rkey); | 1345 | rkey = ib_inc_rkey(desc->mr->rkey); |
| 1342 | ib_update_fast_reg_key(desc->mr, rkey); | 1346 | ib_update_fast_reg_key(desc->mr, rkey); |
| 1343 | 1347 | ||
| 1344 | n = ib_map_mr_sg(desc->mr, state->sg, state->sg_nents, | 1348 | n = ib_map_mr_sg(desc->mr, state->sg, sg_nents, dev->mr_page_size); |
| 1345 | dev->mr_page_size); | ||
| 1346 | if (unlikely(n < 0)) | 1349 | if (unlikely(n < 0)) |
| 1347 | return n; | 1350 | return n; |
| 1348 | 1351 | ||
| @@ -1448,16 +1451,15 @@ static int srp_map_sg_fr(struct srp_map_state *state, struct srp_rdma_ch *ch, · 99 unmodified lines | |||
| 1448 | state->fr.next = req->fr_list; | 1451 | state->fr.next = req->fr_list; |
| 1449 | state->fr.end = req->fr_list + ch->target->cmd_sg_cnt; | 1452 | state->fr.end = req->fr_list + ch->target->cmd_sg_cnt; |
| 1450 | state->sg = scat; | 1453 | state->sg = scat; |
| 1451 | state->sg_nents = scsi_sg_count(req->scmnd); | ||
| 1452 | 1454 | ||
| 1453 | while (state->sg_nents) { | 1455 | while (count) { |
| 1454 | int i, n; | 1456 | int i, n; |
| 1455 | 1457 | ||
| 1456 | n = srp_map_finish_fr(state, ch); | 1458 | n = srp_map_finish_fr(state, ch, count); |
| 1457 | if (unlikely(n < 0)) | 1459 | if (unlikely(n < 0)) |
| 1458 | return n; | 1460 | return n; |
| 1459 | 1461 | ||
| 1460 | state->sg_nents -= n; | 1462 | count -= n; |
| 1461 | for (i = 0; i < n; i++) | 1463 | for (i = 0; i < n; i++) |
| 1462 | state->sg = sg_next(state->sg); | 1464 | state->sg = sg_next(state->sg); |
| 1463 | } | 1465 | } |
| @@ -1517,10 +1519,12 @@ static int srp_map_idb(struct srp_rdma_ch *ch, struct srp_request *req, · 53 unmodified lines | |||
| 1517 | 1519 | ||
| 1518 | if (dev->use_fast_reg) { | 1520 | if (dev->use_fast_reg) { |
| 1519 | state.sg = idb_sg; | 1521 | state.sg = idb_sg; |
| 1520 | state.sg_nents = 1; | ||
| 1521 | sg_set_buf(idb_sg, req->indirect_desc, idb_len); | 1522 | sg_set_buf(idb_sg, req->indirect_desc, idb_len); |
| 1522 | idb_sg->dma_address = req->indirect_dma_addr; /* hack! */ | 1523 | idb_sg->dma_address = req->indirect_dma_addr; /* hack! */ |
| 1523 | ret = srp_map_finish_fr(&state, ch); | 1524 | #ifdef CONFIG_NEED_SG_DMA_LENGTH |
| 1525 | idb_sg->dma_length = idb_sg->length; /* hack^2 */ | ||
| 1526 | #endif | ||
| 1527 | ret = srp_map_finish_fr(&state, ch, 1); | ||
| 1524 | if (ret < 0) | 1528 | if (ret < 0) |
| 1525 | return ret; | 1529 | return ret; |
| 1526 | } else if (dev->use_fmr) { | 1530 | } else if (dev->use_fmr) { |
| @@ -1655,7 +1659,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, · 128 unmodified lines | |||
| 1655 | return ret; | 1659 | return ret; |
| 1656 | req->nmdesc++; | 1660 | req->nmdesc++; |
| 1657 | } else { | 1661 | } else { |
| 1658 | idb_rkey = target->global_mr->rkey; | 1662 | idb_rkey = cpu_to_be32(target->global_mr->rkey); |
| 1659 | } | 1663 | } |
| 1660 | 1664 | ||
| 1661 | indirect_hdr->table_desc.va = cpu_to_be64(req->indirect_dma_addr); | 1665 | indirect_hdr->table_desc.va = cpu_to_be64(req->indirect_dma_addr); |
| @@ -300,10 +300,7 @@ struct srp_map_state { · 299 unmodified lines | |||
| 300 | dma_addr_t base_dma_addr; | 300 | dma_addr_t base_dma_addr; |
| 301 | u32 dma_len; | 301 | u32 dma_len; |
| 302 | u32 total_len; | 302 | u32 total_len; |
| 303 | union { | 303 | unsigned int npages; |
| 304 | unsigned int npages; | ||
| 305 | int sg_nents; | ||
| 306 | }; | ||
| 307 | unsigned int nmdesc; | 304 | unsigned int nmdesc; |
| 308 | unsigned int ndesc; | 305 | unsigned int ndesc; |
| 309 | }; | 306 | }; |
| @@ -592,6 +592,7 @@ static void db9_attach(struct parport *pp) · 591 unmodified lines | |||
| 592 | return; | 592 | return; |
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | memset(&db9_parport_cb, 0, sizeof(db9_parport_cb)); | ||
| 595 | db9_parport_cb.flags = PARPORT_FLAG_EXCL; | 596 | db9_parport_cb.flags = PARPORT_FLAG_EXCL; |
| 596 | 597 | ||
| 597 | pd = parport_register_dev_model(pp, "db9", &db9_parport_cb, port_idx); | 598 | pd = parport_register_dev_model(pp, "db9", &db9_parport_cb, port_idx); |
| @@ -951,6 +951,7 @@ static void gc_attach(struct parport *pp) · 950 unmodified lines | |||
| 951 | pads = gc_cfg[port_idx].args + 1; | 951 | pads = gc_cfg[port_idx].args + 1; |
| 952 | n_pads = gc_cfg[port_idx].nargs - 1; | 952 | n_pads = gc_cfg[port_idx].nargs - 1; |
| 953 | 953 | ||
| 954 | memset(&gc_parport_cb, 0, sizeof(gc_parport_cb)); | ||
| 954 | gc_parport_cb.flags = PARPORT_FLAG_EXCL; | 955 | gc_parport_cb.flags = PARPORT_FLAG_EXCL; |
| 955 | 956 | ||
| 956 | pd = parport_register_dev_model(pp, "gamecon", &gc_parport_cb, | 957 | pd = parport_register_dev_model(pp, "gamecon", &gc_parport_cb, |
| @@ -181,6 +181,7 @@ static void tgfx_attach(struct parport *pp) · 180 unmodified lines | |||
| 181 | n_buttons = tgfx_cfg[port_idx].args + 1; | 181 | n_buttons = tgfx_cfg[port_idx].args + 1; |
| 182 | n_devs = tgfx_cfg[port_idx].nargs - 1; | 182 | n_devs = tgfx_cfg[port_idx].nargs - 1; |
| 183 | 183 | ||
| 184 | memset(&tgfx_parport_cb, 0, sizeof(tgfx_parport_cb)); | ||
| 184 | tgfx_parport_cb.flags = PARPORT_FLAG_EXCL; | 185 | tgfx_parport_cb.flags = PARPORT_FLAG_EXCL; |
| 185 | 186 | ||
| 186 | pd = parport_register_dev_model(pp, "turbografx", &tgfx_parport_cb, | 187 | pd = parport_register_dev_model(pp, "turbografx", &tgfx_parport_cb, |
| @@ -218,6 +218,7 @@ static void walkera0701_attach(struct parport *pp) · 217 unmodified lines | |||
| 218 | 218 | ||
| 219 | w->parport = pp; | 219 | w->parport = pp; |
| 220 | 220 | ||
| 221 | memset(&walkera0701_parport_cb, 0, sizeof(walkera0701_parport_cb)); | ||
| 221 | walkera0701_parport_cb.flags = PARPORT_FLAG_EXCL; | 222 | walkera0701_parport_cb.flags = PARPORT_FLAG_EXCL; |
| 222 | walkera0701_parport_cb.irq_func = walkera0701_irq_handler; | 223 | walkera0701_parport_cb.irq_func = walkera0701_irq_handler; |
| 223 | walkera0701_parport_cb.private = w; | 224 | walkera0701_parport_cb.private = w; |
| @@ -97,8 +97,7 @@ static void arizona_haptics_work(struct work_struct *work) · 96 unmodified lines | |||
| 97 | 97 | ||
| 98 | ret = regmap_update_bits(arizona->regmap, | 98 | ret = regmap_update_bits(arizona->regmap, |
| 99 | ARIZONA_HAPTICS_CONTROL_1, | 99 | ARIZONA_HAPTICS_CONTROL_1, |
| 100 | ARIZONA_HAP_CTRL_MASK, | 100 | ARIZONA_HAP_CTRL_MASK, 0); |
| 101 | 1 << ARIZONA_HAP_CTRL_SHIFT); | ||
| 102 | if (ret != 0) { | 101 | if (ret != 0) { |
| 103 | dev_err(arizona->dev, "Failed to stop haptics: %d\n", | 102 | dev_err(arizona->dev, "Failed to stop haptics: %d\n", |
| 104 | ret); | 103 | ret); |
| @@ -41,6 +41,7 @@ · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | #define DRIVER_NAME "elan_i2c" | 42 | #define DRIVER_NAME "elan_i2c" |
| 43 | #define ELAN_DRIVER_VERSION "1.6.1" | 43 | #define ELAN_DRIVER_VERSION "1.6.1" |
| 44 | #define ELAN_VENDOR_ID 0x04f3 | ||
| 44 | #define ETP_MAX_PRESSURE 255 | 45 | #define ETP_MAX_PRESSURE 255 |
| 45 | #define ETP_FWIDTH_REDUCE 90 | 46 | #define ETP_FWIDTH_REDUCE 90 |
| 46 | #define ETP_FINGER_WIDTH 15 | 47 | #define ETP_FINGER_WIDTH 15 |
| @@ -914,6 +915,8 @@ static int elan_setup_input_device(struct elan_tp_data *data) · 867 unmodified lines | |||
| 914 | 915 | ||
| 915 | input->name = "Elan Touchpad"; | 916 | input->name = "Elan Touchpad"; |
| 916 | input->id.bustype = BUS_I2C; | 917 | input->id.bustype = BUS_I2C; |
| 918 | input->id.vendor = ELAN_VENDOR_ID; | ||
| 919 | input->id.product = data->product_id; | ||
| 917 | input_set_drvdata(input, data); | 920 | input_set_drvdata(input, data); |
| 918 | 921 | ||
| 919 | error = input_mt_init_slots(input, ETP_MAX_FINGERS, | 922 | error = input_mt_init_slots(input, ETP_MAX_FINGERS, |
| @@ -145,6 +145,7 @@ static int parkbd_getport(struct parport *pp) · 144 unmodified lines | |||
| 145 | { | 145 | { |
| 146 | struct pardev_cb parkbd_parport_cb; | 146 | struct pardev_cb parkbd_parport_cb; |
| 147 | 147 | ||
| 148 | memset(&parkbd_parport_cb, 0, sizeof(parkbd_parport_cb)); | ||
| 148 | parkbd_parport_cb.irq_func = parkbd_interrupt; | 149 | parkbd_parport_cb.irq_func = parkbd_interrupt; |
| 149 | parkbd_parport_cb.flags = PARPORT_FLAG_EXCL; | 150 | parkbd_parport_cb.flags = PARPORT_FLAG_EXCL; |
| 150 | 151 | ||
| @@ -1819,6 +1819,14 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) · 1818 unmodified lines | |||
| 1819 | input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); | 1819 | input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); |
| 1820 | input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); | 1820 | input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); |
| 1821 | 1821 | ||
| 1822 | /* Verify that a device really has an endpoint */ | ||
| 1823 | if (intf->altsetting[0].desc.bNumEndpoints < 1) { | ||
| 1824 | dev_err(&intf->dev, | ||
| 1825 | "interface has %d endpoints, but must have minimum 1\n", | ||
| 1826 | intf->altsetting[0].desc.bNumEndpoints); | ||
| 1827 | err = -EINVAL; | ||
| 1828 | goto fail3; | ||
| 1829 | } | ||
| 1822 | endpoint = &intf->altsetting[0].endpoint[0].desc; | 1830 | endpoint = &intf->altsetting[0].endpoint[0].desc; |
| 1823 | 1831 | ||
| 1824 | /* Go set up our URB, which is called when the tablet receives | 1832 | /* Go set up our URB, which is called when the tablet receives |
| @@ -1861,6 +1869,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) · 36 unmodified lines | |||
| 1861 | if (i == ARRAY_SIZE(speeds)) { | 1869 | if (i == ARRAY_SIZE(speeds)) { |
| 1862 | dev_info(&intf->dev, | 1870 | dev_info(&intf->dev, |
| 1863 | "Aiptek tried all speeds, no sane response\n"); | 1871 | "Aiptek tried all speeds, no sane response\n"); |
| 1872 | err = -EINVAL; | ||
| 1864 | goto fail3; | 1873 | goto fail3; |
| 1865 | } | 1874 | } |
| 1866 | 1875 | ||
| @@ -2487,6 +2487,31 @@ static struct mxt_acpi_platform_data samus_platform_data[] = { · 2486 unmodified lines | |||
| 2487 | { } | 2487 | { } |
| 2488 | }; | 2488 | }; |
| 2489 | 2489 | ||
| 2490 | static unsigned int chromebook_tp_buttons[] = { | ||
| 2491 | KEY_RESERVED, | ||
| 2492 | KEY_RESERVED, | ||
| 2493 | KEY_RESERVED, | ||
| 2494 | KEY_RESERVED, | ||
| 2495 | KEY_RESERVED, | ||
| 2496 | BTN_LEFT | ||
| 2497 | }; | ||
| 2498 | |||
| 2499 | static struct mxt_acpi_platform_data chromebook_platform_data[] = { | ||
| 2500 | { | ||
| 2501 | /* Touchpad */ | ||
| 2502 | .hid = "ATML0000", | ||
| 2503 | .pdata = { | ||
| 2504 | .t19_num_keys = ARRAY_SIZE(chromebook_tp_buttons), | ||
| 2505 | .t19_keymap = chromebook_tp_buttons, | ||
| 2506 | }, | ||
| 2507 | }, | ||
| 2508 | { | ||
| 2509 | /* Touchscreen */ | ||
| 2510 | .hid = "ATML0001", | ||
| 2511 | }, | ||
| 2512 | { } | ||
| 2513 | }; | ||
| 2514 | |||
| 2490 | static const struct dmi_system_id mxt_dmi_table[] = { | 2515 | static const struct dmi_system_id mxt_dmi_table[] = { |
| 2491 | { | 2516 | { |
| 2492 | /* 2015 Google Pixel */ | 2517 | /* 2015 Google Pixel */ |
| @@ -2497,6 +2522,14 @@ static const struct dmi_system_id mxt_dmi_table[] = { · 4 unmodified lines | |||
| 2497 | }, | 2522 | }, |
| 2498 | .driver_data = samus_platform_data, | 2523 | .driver_data = samus_platform_data, |
| 2499 | }, | 2524 | }, |
| 2525 | { | ||
| 2526 | /* Other Google Chromebooks */ | ||
| 2527 | .ident = "Chromebook", | ||
| 2528 | .matches = { | ||
| 2529 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), | ||
| 2530 | }, | ||
| 2531 | .driver_data = chromebook_platform_data, | ||
| 2532 | }, | ||
| 2500 | { } | 2533 | { } |
| 2501 | }; | 2534 | }; |
| 2502 | 2535 | ||
| @@ -2701,6 +2734,7 @@ static const struct i2c_device_id mxt_id[] = { · 198 unmodified lines | |||
| 2701 | { "qt602240_ts", 0 }, | 2734 | { "qt602240_ts", 0 }, |
| 2702 | { "atmel_mxt_ts", 0 }, | 2735 | { "atmel_mxt_ts", 0 }, |
| 2703 | { "atmel_mxt_tp", 0 }, | 2736 | { "atmel_mxt_tp", 0 }, |
| 2737 | { "maxtouch", 0 }, | ||
| 2704 | { "mXT224", 0 }, | 2738 | { "mXT224", 0 }, |
| 2705 | { } | 2739 | { } |
| 2706 | }; | 2740 | }; |
| @@ -1316,7 +1316,13 @@ static int __maybe_unused elants_i2c_suspend(struct device *dev) · 1315 unmodified lines | |||
| 1316 | 1316 | ||
| 1317 | disable_irq(client->irq); | 1317 | disable_irq(client->irq); |
| 1318 | 1318 | ||
| 1319 | if (device_may_wakeup(dev) || ts->keep_power_in_suspend) { | 1319 | if (device_may_wakeup(dev)) { |
| 1320 | /* | ||
| 1321 | * The device will automatically enter idle mode | ||
| 1322 | * that has reduced power consumption. | ||
| 1323 | */ | ||
| 1324 | ts->wake_irq_enabled = (enable_irq_wake(client->irq) == 0); | ||
| 1325 | } else if (ts->keep_power_in_suspend) { | ||
| 1320 | for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) { | 1326 | for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) { |
| 1321 | error = elants_i2c_send(client, set_sleep_cmd, | 1327 | error = elants_i2c_send(client, set_sleep_cmd, |
| 1322 | sizeof(set_sleep_cmd)); | 1328 | sizeof(set_sleep_cmd)); |
| @@ -1326,10 +1332,6 @@ static int __maybe_unused elants_i2c_suspend(struct device *dev) · 3 unmodified lines | |||
| 1326 | dev_err(&client->dev, | 1332 | dev_err(&client->dev, |
| 1327 | "suspend command failed: %d\n", error); | 1333 | "suspend command failed: %d\n", error); |
| 1328 | } | 1334 | } |
| 1329 | |||
| 1330 | if (device_may_wakeup(dev)) | ||
| 1331 | ts->wake_irq_enabled = | ||
| 1332 | (enable_irq_wake(client->irq) == 0); | ||
| 1333 | } else { | 1335 | } else { |
| 1334 | elants_i2c_power_off(ts); | 1336 | elants_i2c_power_off(ts); |
| 1335 | } | 1337 | } |
| @@ -1345,10 +1347,11 @@ static int __maybe_unused elants_i2c_resume(struct device *dev) · 9 unmodified lines | |||
| 1345 | int retry_cnt; | 1347 | int retry_cnt; |
| 1346 | int error; | 1348 | int error; |
| 1347 | 1349 | ||
| 1348 | if (device_may_wakeup(dev) && ts->wake_irq_enabled) | 1350 | if (device_may_wakeup(dev)) { |
| 1349 | disable_irq_wake(client->irq); | 1351 | if (ts->wake_irq_enabled) |
| 1350 | 1352 | disable_irq_wake(client->irq); | |
| 1351 | if (ts->keep_power_in_suspend) { | 1353 | elants_i2c_sw_reset(client); |
| 1354 | } else if (ts->keep_power_in_suspend) { | ||
| 1352 | for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) { | 1355 | for (retry_cnt = 0; retry_cnt < MAX_RETRIES; retry_cnt++) { |
| 1353 | error = elants_i2c_send(client, set_active_cmd, | 1356 | error = elants_i2c_send(client, set_active_cmd, |
| 1354 | sizeof(set_active_cmd)); | 1357 | sizeof(set_active_cmd)); |
| @@ -494,6 +494,22 @@ static void handle_fault_error(struct fault *fault) · 493 unmodified lines | |||
| 494 | } | 494 | } |
| 495 | } | 495 | } |
| 496 | 496 | ||
| 497 | static bool access_error(struct vm_area_struct *vma, struct fault *fault) | ||
| 498 | { | ||
| 499 | unsigned long requested = 0; | ||
| 500 | |||
| 501 | if (fault->flags & PPR_FAULT_EXEC) | ||
| 502 | requested |= VM_EXEC; | ||
| 503 | |||
| 504 | if (fault->flags & PPR_FAULT_READ) | ||
| 505 | requested |= VM_READ; | ||
| 506 | |||
| 507 | if (fault->flags & PPR_FAULT_WRITE) | ||
| 508 | requested |= VM_WRITE; | ||
| 509 | |||
| 510 | return (requested & ~vma->vm_flags) != 0; | ||
| 511 | } | ||
| 512 | |||
| 497 | static void do_fault(struct work_struct *work) | 513 | static void do_fault(struct work_struct *work) |
| 498 | { | 514 | { |
| 499 | struct fault *fault = container_of(work, struct fault, work); | 515 | struct fault *fault = container_of(work, struct fault, work); |
| @@ -516,8 +532,8 @@ static void do_fault(struct work_struct *work) · 16 unmodified lines | |||
| 516 | goto out; | 532 | goto out; |
| 517 | } | 533 | } |
| 518 | 534 | ||
| 519 | if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) { | 535 | /* Check if we have the right permissions on the vma */ |
| 520 | /* handle_mm_fault would BUG_ON() */ | 536 | if (access_error(vma, fault)) { |
| 521 | up_read(&mm->mmap_sem); | 537 | up_read(&mm->mmap_sem); |
| 522 | handle_fault_error(fault); | 538 | handle_fault_error(fault); |
| 523 | goto out; | 539 | goto out; |
| @@ -2159,7 +2159,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, · 2158 unmodified lines | |||
| 2159 | sg_res = aligned_nrpages(sg->offset, sg->length); | 2159 | sg_res = aligned_nrpages(sg->offset, sg->length); |
| 2160 | sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; | 2160 | sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; |
| 2161 | sg->dma_length = sg->length; | 2161 | sg->dma_length = sg->length; |
| 2162 | pteval = (sg_phys(sg) & PAGE_MASK) | prot; | 2162 | pteval = page_to_phys(sg_page(sg)) | prot; |
| 2163 | phys_pfn = pteval >> VTD_PAGE_SHIFT; | 2163 | phys_pfn = pteval >> VTD_PAGE_SHIFT; |
| 2164 | } | 2164 | } |
| 2165 | 2165 | ||
| @@ -3704,7 +3704,7 @@ static int intel_nontranslate_map_sg(struct device *hddev, · 1538 unmodified lines | |||
| 3704 | 3704 | ||
| 3705 | for_each_sg(sglist, sg, nelems, i) { | 3705 | for_each_sg(sglist, sg, nelems, i) { |
| 3706 | BUG_ON(!sg_page(sg)); | 3706 | BUG_ON(!sg_page(sg)); |
| 3707 | sg->dma_address = sg_phys(sg); | 3707 | sg->dma_address = page_to_phys(sg_page(sg)) + sg->offset; |
| 3708 | sg->dma_length = sg->length; | 3708 | sg->dma_length = sg->length; |
| 3709 | } | 3709 | } |
| 3710 | return nelems; | 3710 | return nelems; |
| @@ -484,6 +484,23 @@ struct page_req_dsc { · 483 unmodified lines | |||
| 484 | }; | 484 | }; |
| 485 | 485 | ||
| 486 | #define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x10) | 486 | #define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x10) |
| 487 | |||
| 488 | static bool access_error(struct vm_area_struct *vma, struct page_req_dsc *req) | ||
| 489 | { | ||
| 490 | unsigned long requested = 0; | ||
| 491 | |||
| 492 | if (req->exe_req) | ||
| 493 | requested |= VM_EXEC; | ||
| 494 | |||
| 495 | if (req->rd_req) | ||
| 496 | requested |= VM_READ; | ||
| 497 | |||
| 498 | if (req->wr_req) | ||
| 499 | requested |= VM_WRITE; | ||
| 500 | |||
| 501 | return (requested & ~vma->vm_flags) != 0; | ||
| 502 | } | ||
| 503 | |||
| 487 | static irqreturn_t prq_event_thread(int irq, void *d) | 504 | static irqreturn_t prq_event_thread(int irq, void *d) |
| 488 | { | 505 | { |
| 489 | struct intel_iommu *iommu = d; | 506 | struct intel_iommu *iommu = d; |
| @@ -539,6 +556,9 @@ static irqreturn_t prq_event_thread(int irq, void *d) · 49 unmodified lines | |||
| 539 | if (!vma || address < vma->vm_start) | 556 | if (!vma || address < vma->vm_start) |
| 540 | goto invalid; | 557 | goto invalid; |
| 541 | 558 | ||
| 559 | if (access_error(vma, req)) | ||
| 560 | goto invalid; | ||
| 561 | |||
| 542 | ret = handle_mm_fault(svm->mm, vma, address, | 562 | ret = handle_mm_fault(svm->mm, vma, address, |
| 543 | req->wr_req ? FAULT_FLAG_WRITE : 0); | 563 | req->wr_req ? FAULT_FLAG_WRITE : 0); |
| 544 | if (ret & VM_FAULT_ERROR) | 564 | if (ret & VM_FAULT_ERROR) |
| @@ -1430,7 +1430,7 @@ size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova, · 1429 unmodified lines | |||
| 1430 | min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap); | 1430 | min_pagesz = 1 << __ffs(domain->ops->pgsize_bitmap); |
| 1431 | 1431 | ||
| 1432 | for_each_sg(sg, s, nents, i) { | 1432 | for_each_sg(sg, s, nents, i) { |
| 1433 | phys_addr_t phys = sg_phys(s); | 1433 | phys_addr_t phys = page_to_phys(sg_page(s)) + s->offset; |
| 1434 | 1434 | ||
| 1435 | /* | 1435 | /* |
| 1436 | * We are mapping on IOMMU page boundaries, so offset within | 1436 | * We are mapping on IOMMU page boundaries, so offset within |
| @@ -210,7 +210,12 @@ int __init fpga_irq_of_init(struct device_node *node, · 209 unmodified lines | |||
| 210 | parent_irq = -1; | 210 | parent_irq = -1; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | #ifdef CONFIG_ARCH_VERSATILE | ||
| 214 | fpga_irq_init(base, node->name, IRQ_SIC_START, parent_irq, valid_mask, | ||
| 215 | node); | ||
| 216 | #else | ||
| 213 | fpga_irq_init(base, node->name, 0, parent_irq, valid_mask, node); | 217 | fpga_irq_init(base, node->name, 0, parent_irq, valid_mask, node); |
| 218 | #endif | ||
| 214 | 219 | ||
| 215 | writel(clear_mask, base + IRQ_ENABLE_CLEAR); | 220 | writel(clear_mask, base + IRQ_ENABLE_CLEAR); |
| 216 | writel(clear_mask, base + FIQ_ENABLE_CLEAR); | 221 | writel(clear_mask, base + FIQ_ENABLE_CLEAR); |
| @@ -67,8 +67,7 @@ static int write_modem(struct cardstate *cs) · 66 unmodified lines | |||
| 67 | struct sk_buff *skb = bcs->tx_skb; | 67 | struct sk_buff *skb = bcs->tx_skb; |
| 68 | int sent = -EOPNOTSUPP; | 68 | int sent = -EOPNOTSUPP; |
| 69 | 69 | ||
| 70 | if (!tty || !tty->driver || !skb) | 70 | WARN_ON(!tty || !tty->ops || !skb); |
| 71 | return -EINVAL; | ||
| 72 | 71 | ||
| 73 | if (!skb->len) { | 72 | if (!skb->len) { |
| 74 | dev_kfree_skb_any(skb); | 73 | dev_kfree_skb_any(skb); |
| @@ -109,8 +108,7 @@ static int send_cb(struct cardstate *cs) · 34 unmodified lines | |||
| 109 | unsigned long flags; | 108 | unsigned long flags; |
| 110 | int sent = 0; | 109 | int sent = 0; |
| 111 | 110 | ||
| 112 | if (!tty || !tty->driver) | 111 | WARN_ON(!tty || !tty->ops); |
| 113 | return -EFAULT; | ||
| 114 | 112 | ||
| 115 | cb = cs->cmdbuf; | 113 | cb = cs->cmdbuf; |
| 116 | if (!cb) | 114 | if (!cb) |
| @@ -370,19 +368,18 @@ static void gigaset_freecshw(struct cardstate *cs) · 253 unmodified lines | |||
| 370 | tasklet_kill(&cs->write_tasklet); | 368 | tasklet_kill(&cs->write_tasklet); |
| 371 | if (!cs->hw.ser) | 369 | if (!cs->hw.ser) |
| 372 | return; | 370 | return; |
| 373 | dev_set_drvdata(&cs->hw.ser->dev.dev, NULL); | ||
| 374 | platform_device_unregister(&cs->hw.ser->dev); | 371 | platform_device_unregister(&cs->hw.ser->dev); |
| 375 | kfree(cs->hw.ser); | ||
| 376 | cs->hw.ser = NULL; | ||
| 377 | } | 372 | } |
| 378 | 373 | ||
| 379 | static void gigaset_device_release(struct device *dev) | 374 | static void gigaset_device_release(struct device *dev) |
| 380 | { | 375 | { |
| 381 | struct platform_device *pdev = to_platform_device(dev); | 376 | struct cardstate *cs = dev_get_drvdata(dev); |
| 382 | 377 | ||
| 383 | /* adapted from platform_device_release() in drivers/base/platform.c */ | 378 | if (!cs) |
| 384 | kfree(dev->platform_data); | 379 | return; |
| 385 | kfree(pdev->resource); | 380 | dev_set_drvdata(dev, NULL); |
| 381 | kfree(cs->hw.ser); | ||
| 382 | cs->hw.ser = NULL; | ||
| 386 | } | 383 | } |
| 387 | 384 | ||
| 388 | /* | 385 | /* |
| @@ -432,7 +429,9 @@ static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, · 43 unmodified lines | |||
| 432 | struct tty_struct *tty = cs->hw.ser->tty; | 429 | struct tty_struct *tty = cs->hw.ser->tty; |
| 433 | unsigned int set, clear; | 430 | unsigned int set, clear; |
| 434 | 431 | ||
| 435 | if (!tty || !tty->driver || !tty->ops->tiocmset) | 432 | WARN_ON(!tty || !tty->ops); |
| 433 | /* tiocmset is an optional tty driver method */ | ||
| 434 | if (!tty->ops->tiocmset) | ||
| 436 | return -EINVAL; | 435 | return -EINVAL; |
| 437 | set = new_state & ~old_state; | 436 | set = new_state & ~old_state; |
| 438 | clear = old_state & ~new_state; | 437 | clear = old_state & ~new_state; |
| @@ -1170,7 +1170,7 @@ mISDNipac_irq(struct ipac_hw *ipac, int maxloop) · 1169 unmodified lines | |||
| 1170 | 1170 | ||
| 1171 | if (ipac->type & IPAC_TYPE_IPACX) { | 1171 | if (ipac->type & IPAC_TYPE_IPACX) { |
| 1172 | ista = ReadIPAC(ipac, ISACX_ISTA); | 1172 | ista = ReadIPAC(ipac, ISACX_ISTA); |
| 1173 | while (ista && cnt--) { | 1173 | while (ista && --cnt) { |
| 1174 | pr_debug("%s: ISTA %02x\n", ipac->name, ista); | 1174 | pr_debug("%s: ISTA %02x\n", ipac->name, ista); |
| 1175 | if (ista & IPACX__ICA) | 1175 | if (ista & IPACX__ICA) |
| 1176 | ipac_irq(&ipac->hscx[0], ista); | 1176 | ipac_irq(&ipac->hscx[0], ista); |
| @@ -1182,7 +1182,7 @@ mISDNipac_irq(struct ipac_hw *ipac, int maxloop) · 5 unmodified lines | |||
| 1182 | } | 1182 | } |
| 1183 | } else if (ipac->type & IPAC_TYPE_IPAC) { | 1183 | } else if (ipac->type & IPAC_TYPE_IPAC) { |
| 1184 | ista = ReadIPAC(ipac, IPAC_ISTA); | 1184 | ista = ReadIPAC(ipac, IPAC_ISTA); |
| 1185 | while (ista && cnt--) { | 1185 | while (ista && --cnt) { |
| 1186 | pr_debug("%s: ISTA %02x\n", ipac->name, ista); | 1186 | pr_debug("%s: ISTA %02x\n", ipac->name, ista); |
| 1187 | if (ista & (IPAC__ICD | IPAC__EXD)) { | 1187 | if (ista & (IPAC__ICD | IPAC__EXD)) { |
| 1188 | istad = ReadISAC(isac, ISAC_ISTA); | 1188 | istad = ReadISAC(isac, ISAC_ISTA); |
| @@ -1200,7 +1200,7 @@ mISDNipac_irq(struct ipac_hw *ipac, int maxloop) · 11 unmodified lines | |||
| 1200 | ista = ReadIPAC(ipac, IPAC_ISTA); | 1200 | ista = ReadIPAC(ipac, IPAC_ISTA); |
| 1201 | } | 1201 | } |
| 1202 | } else if (ipac->type & IPAC_TYPE_HSCX) { | 1202 | } else if (ipac->type & IPAC_TYPE_HSCX) { |
| 1203 | while (cnt) { | 1203 | while (--cnt) { |
| 1204 | ista = ReadIPAC(ipac, IPAC_ISTAB + ipac->hscx[1].off); | 1204 | ista = ReadIPAC(ipac, IPAC_ISTAB + ipac->hscx[1].off); |
| 1205 | pr_debug("%s: B2 ISTA %02x\n", ipac->name, ista); | 1205 | pr_debug("%s: B2 ISTA %02x\n", ipac->name, ista); |
| 1206 | if (ista) | 1206 | if (ista) |
| @@ -1211,7 +1211,6 @@ mISDNipac_irq(struct ipac_hw *ipac, int maxloop) · 4 unmodified lines | |||
| 1211 | mISDNisac_irq(isac, istad); | 1211 | mISDNisac_irq(isac, istad); |
| 1212 | if (0 == (ista | istad)) | 1212 | if (0 == (ista | istad)) |
| 1213 | break; | 1213 | break; |
| 1214 | cnt--; | ||
| 1215 | } | 1214 | } |
| 1216 | } | 1215 | } |
| 1217 | if (cnt > maxloop) /* only for ISAC/HSCX without PCI IRQ test */ | 1216 | if (cnt > maxloop) /* only for ISAC/HSCX without PCI IRQ test */ |
| @@ -18,6 +18,7 @@ if NVM · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | config NVM_DEBUG | 19 | config NVM_DEBUG |
| 20 | bool "Open-Channel SSD debugging support" | 20 | bool "Open-Channel SSD debugging support" |
| 21 | default n | ||
| 21 | ---help--- | 22 | ---help--- |
| 22 | Exposes a debug management interface to create/remove targets at: | 23 | Exposes a debug management interface to create/remove targets at: |
| 23 | 24 | ||
| @@ -74,7 +74,7 @@ EXPORT_SYMBOL(nvm_unregister_target); · 73 unmodified lines | |||
| 74 | void *nvm_dev_dma_alloc(struct nvm_dev *dev, gfp_t mem_flags, | 74 | void *nvm_dev_dma_alloc(struct nvm_dev *dev, gfp_t mem_flags, |
| 75 | dma_addr_t *dma_handler) | 75 | dma_addr_t *dma_handler) |
| 76 | { | 76 | { |
| 77 | return dev->ops->dev_dma_alloc(dev->q, dev->ppalist_pool, mem_flags, | 77 | return dev->ops->dev_dma_alloc(dev, dev->ppalist_pool, mem_flags, |
| 78 | dma_handler); | 78 | dma_handler); |
| 79 | } | 79 | } |
| 80 | EXPORT_SYMBOL(nvm_dev_dma_alloc); | 80 | EXPORT_SYMBOL(nvm_dev_dma_alloc); |
| @@ -97,15 +97,47 @@ static struct nvmm_type *nvm_find_mgr_type(const char *name) · 16 unmodified lines | |||
| 97 | return NULL; | 97 | return NULL; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | struct nvmm_type *nvm_init_mgr(struct nvm_dev *dev) | ||
| 101 | { | ||
| 102 | struct nvmm_type *mt; | ||
| 103 | int ret; | ||
| 104 | |||
| 105 | lockdep_assert_held(&nvm_lock); | ||
| 106 | |||
| 107 | list_for_each_entry(mt, &nvm_mgrs, list) { | ||
| 108 | ret = mt->register_mgr(dev); | ||
| 109 | if (ret < 0) { | ||
| 110 | pr_err("nvm: media mgr failed to init (%d) on dev %s\n", | ||
| 111 | ret, dev->name); | ||
| 112 | return NULL; /* initialization failed */ | ||
| 113 | } else if (ret > 0) | ||
| 114 | return mt; | ||
| 115 | } | ||
| 116 | |||
| 117 | return NULL; | ||
| 118 | } | ||
| 119 | |||
| 100 | int nvm_register_mgr(struct nvmm_type *mt) | 120 | int nvm_register_mgr(struct nvmm_type *mt) |
| 101 | { | 121 | { |
| 122 | struct nvm_dev *dev; | ||
| 102 | int ret = 0; | 123 | int ret = 0; |
| 103 | 124 | ||
| 104 | down_write(&nvm_lock); | 125 | down_write(&nvm_lock); |
| 105 | if (nvm_find_mgr_type(mt->name)) | 126 | if (nvm_find_mgr_type(mt->name)) { |
| 106 | ret = -EEXIST; | 127 | ret = -EEXIST; |
| 107 | else | 128 | goto finish; |
| 129 | } else { | ||
| 108 | list_add(&mt->list, &nvm_mgrs); | 130 | list_add(&mt->list, &nvm_mgrs); |
| 131 | } | ||
| 132 | |||
| 133 | /* try to register media mgr if any device have none configured */ | ||
| 134 | list_for_each_entry(dev, &nvm_devices, devices) { | ||
| 135 | if (dev->mt) | ||
| 136 | continue; | ||
| 137 | |||
| 138 | dev->mt = nvm_init_mgr(dev); | ||
| 139 | } | ||
| 140 | finish: | ||
| 109 | up_write(&nvm_lock); | 141 | up_write(&nvm_lock); |
| 110 | 142 | ||
| 111 | return ret; | 143 | return ret; |
| @@ -123,26 +155,6 @@ void nvm_unregister_mgr(struct nvmm_type *mt) · 11 unmodified lines | |||
| 123 | } | 155 | } |
| 124 | EXPORT_SYMBOL(nvm_unregister_mgr); | 156 | EXPORT_SYMBOL(nvm_unregister_mgr); |
| 125 | 157 | ||
| 126 | /* register with device with a supported manager */ | ||
| 127 | static int register_mgr(struct nvm_dev *dev) | ||
| 128 | { | ||
| 129 | struct nvmm_type *mt; | ||
| 130 | int ret = 0; | ||
| 131 | |||
| 132 | list_for_each_entry(mt, &nvm_mgrs, list) { | ||
| 133 | ret = mt->register_mgr(dev); | ||
| 134 | if (ret > 0) { | ||
| 135 | dev->mt = mt; | ||
| 136 | break; /* successfully initialized */ | ||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | if (!ret) | ||
| 141 | pr_info("nvm: no compatible nvm manager found.\n"); | ||
| 142 | |||
| 143 | return ret; | ||
| 144 | } | ||
| 145 | |||
| 146 | static struct nvm_dev *nvm_find_nvm_dev(const char *name) | 158 | static struct nvm_dev *nvm_find_nvm_dev(const char *name) |
| 147 | { | 159 | { |
| 148 | struct nvm_dev *dev; | 160 | struct nvm_dev *dev; |
| @@ -246,7 +258,7 @@ static int nvm_init(struct nvm_dev *dev) · 97 unmodified lines | |||
| 246 | if (!dev->q || !dev->ops) | 258 | if (!dev->q || !dev->ops) |
| 247 | return ret; | 259 | return ret; |
| 248 | 260 | ||
| 249 | if (dev->ops->identity(dev->q, &dev->identity)) { | 261 | if (dev->ops->identity(dev, &dev->identity)) { |
| 250 | pr_err("nvm: device could not be identified\n"); | 262 | pr_err("nvm: device could not be identified\n"); |
| 251 | goto err; | 263 | goto err; |
| 252 | } | 264 | } |
| @@ -271,14 +283,6 @@ static int nvm_init(struct nvm_dev *dev) · 18 unmodified lines | |||
| 271 | goto err; | 283 | goto err; |
| 272 | } | 284 | } |
| 273 | 285 | ||
| 274 | down_write(&nvm_lock); | ||
| 275 | ret = register_mgr(dev); | ||
| 276 | up_write(&nvm_lock); | ||
| 277 | if (ret < 0) | ||
| 278 | goto err; | ||
| 279 | if (!ret) | ||
| 280 | return 0; | ||
| 281 | |||
| 282 | pr_info("nvm: registered %s [%u/%u/%u/%u/%u/%u]\n", | 286 | pr_info("nvm: registered %s [%u/%u/%u/%u/%u/%u]\n", |
| 283 | dev->name, dev->sec_per_pg, dev->nr_planes, | 287 | dev->name, dev->sec_per_pg, dev->nr_planes, |
| 284 | dev->pgs_per_blk, dev->blks_per_lun, dev->nr_luns, | 288 | dev->pgs_per_blk, dev->blks_per_lun, dev->nr_luns, |
| @@ -326,8 +330,7 @@ int nvm_register(struct request_queue *q, char *disk_name, · 41 unmodified lines | |||
| 326 | } | 330 | } |
| 327 | 331 | ||
| 328 | if (dev->ops->max_phys_sect > 1) { | 332 | if (dev->ops->max_phys_sect > 1) { |
| 329 | dev->ppalist_pool = dev->ops->create_dma_pool(dev->q, | 333 | dev->ppalist_pool = dev->ops->create_dma_pool(dev, "ppalist"); |
| 330 | "ppalist"); | ||
| 331 | if (!dev->ppalist_pool) { | 334 | if (!dev->ppalist_pool) { |
| 332 | pr_err("nvm: could not create ppa pool\n"); | 335 | pr_err("nvm: could not create ppa pool\n"); |
| 333 | ret = -ENOMEM; | 336 | ret = -ENOMEM; |
| @@ -335,7 +338,9 @@ int nvm_register(struct request_queue *q, char *disk_name, · 1 unmodified line | |||
| 335 | } | 338 | } |
| 336 | } | 339 | } |
| 337 | 340 | ||
| 341 | /* register device with a supported media manager */ | ||
| 338 | down_write(&nvm_lock); | 342 | down_write(&nvm_lock); |
| 343 | dev->mt = nvm_init_mgr(dev); | ||
| 339 | list_add(&dev->devices, &nvm_devices); | 344 | list_add(&dev->devices, &nvm_devices); |
| 340 | up_write(&nvm_lock); | 345 | up_write(&nvm_lock); |
| 341 | 346 | ||
| @@ -380,19 +385,13 @@ static int nvm_create_target(struct nvm_dev *dev, · 38 unmodified lines | |||
| 380 | struct nvm_tgt_type *tt; | 385 | struct nvm_tgt_type *tt; |
| 381 | struct nvm_target *t; | 386 | struct nvm_target *t; |
| 382 | void *targetdata; | 387 | void *targetdata; |
| 383 | int ret = 0; | ||
| 384 | 388 | ||
| 385 | down_write(&nvm_lock); | ||
| 386 | if (!dev->mt) { | 389 | if (!dev->mt) { |
| 387 | ret = register_mgr(dev); | 390 | pr_info("nvm: device has no media manager registered.\n"); |
| 388 | if (!ret) | 391 | return -ENODEV; |
| 389 | ret = -ENODEV; | ||
| 390 | if (ret < 0) { | ||
| 391 | up_write(&nvm_lock); | ||
| 392 | return ret; | ||
| 393 | } | ||
| 394 | } | 392 | } |
| 395 | 393 | ||
| 394 | down_write(&nvm_lock); | ||
| 396 | tt = nvm_find_target_type(create->tgttype); | 395 | tt = nvm_find_target_type(create->tgttype); |
| 397 | if (!tt) { | 396 | if (!tt) { |
| 398 | pr_err("nvm: target type %s not found\n", create->tgttype); | 397 | pr_err("nvm: target type %s not found\n", create->tgttype); |
| @@ -195,7 +195,7 @@ static int gennvm_blocks_init(struct nvm_dev *dev, struct gen_nvm *gn) · 194 unmodified lines | |||
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | if (dev->ops->get_l2p_tbl) { | 197 | if (dev->ops->get_l2p_tbl) { |
| 198 | ret = dev->ops->get_l2p_tbl(dev->q, 0, dev->total_pages, | 198 | ret = dev->ops->get_l2p_tbl(dev, 0, dev->total_pages, |
| 199 | gennvm_block_map, dev); | 199 | gennvm_block_map, dev); |
| 200 | if (ret) { | 200 | if (ret) { |
| 201 | pr_err("gennvm: could not read L2P table.\n"); | 201 | pr_err("gennvm: could not read L2P table.\n"); |
| @@ -219,6 +219,9 @@ static int gennvm_register(struct nvm_dev *dev) · 17 unmodified lines | |||
| 219 | struct gen_nvm *gn; | 219 | struct gen_nvm *gn; |
| 220 | int ret; | 220 | int ret; |
| 221 | 221 | ||
| 222 | if (!try_module_get(THIS_MODULE)) | ||
| 223 | return -ENODEV; | ||
| 224 | |||
| 222 | gn = kzalloc(sizeof(struct gen_nvm), GFP_KERNEL); | 225 | gn = kzalloc(sizeof(struct gen_nvm), GFP_KERNEL); |
| 223 | if (!gn) | 226 | if (!gn) |
| 224 | return -ENOMEM; | 227 | return -ENOMEM; |
| @@ -242,12 +245,14 @@ static int gennvm_register(struct nvm_dev *dev) · 17 unmodified lines | |||
| 242 | return 1; | 245 | return 1; |
| 243 | err: | 246 | err: |
| 244 | gennvm_free(dev); | 247 | gennvm_free(dev); |
| 248 | module_put(THIS_MODULE); | ||
| 245 | return ret; | 249 | return ret; |
| 246 | } | 250 | } |
| 247 | 251 | ||
| 248 | static void gennvm_unregister(struct nvm_dev *dev) | 252 | static void gennvm_unregister(struct nvm_dev *dev) |
| 249 | { | 253 | { |
| 250 | gennvm_free(dev); | 254 | gennvm_free(dev); |
| 255 | module_put(THIS_MODULE); | ||
| 251 | } | 256 | } |
| 252 | 257 | ||
| 253 | static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev, | 258 | static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev, |
| @@ -262,14 +267,11 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev, · 8 unmodified lines | |||
| 262 | if (list_empty(&lun->free_list)) { | 267 | if (list_empty(&lun->free_list)) { |
| 263 | pr_err_ratelimited("gennvm: lun %u have no free pages available", | 268 | pr_err_ratelimited("gennvm: lun %u have no free pages available", |
| 264 | lun->vlun.id); | 269 | lun->vlun.id); |
| 265 | spin_unlock(&vlun->lock); | ||
| 266 | goto out; | 270 | goto out; |
| 267 | } | 271 | } |
| 268 | 272 | ||
| 269 | while (!is_gc && lun->vlun.nr_free_blocks < lun->reserved_blocks) { | 273 | if (!is_gc && lun->vlun.nr_free_blocks < lun->reserved_blocks) |
| 270 | spin_unlock(&vlun->lock); | ||
| 271 | goto out; | 274 | goto out; |
| 272 | } | ||
| 273 | 275 | ||
| 274 | blk = list_first_entry(&lun->free_list, struct nvm_block, list); | 276 | blk = list_first_entry(&lun->free_list, struct nvm_block, list); |
| 275 | list_move_tail(&blk->list, &lun->used_list); | 277 | list_move_tail(&blk->list, &lun->used_list); |
| @@ -278,8 +280,8 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev, · 2 unmodified lines | |||
| 278 | lun->vlun.nr_free_blocks--; | 280 | lun->vlun.nr_free_blocks--; |
| 279 | lun->vlun.nr_inuse_blocks++; | 281 | lun->vlun.nr_inuse_blocks++; |
| 280 | 282 | ||
| 281 | spin_unlock(&vlun->lock); | ||
| 282 | out: | 283 | out: |
| 284 | spin_unlock(&vlun->lock); | ||
| 283 | return blk; | 285 | return blk; |
| 284 | } | 286 | } |
| 285 | 287 | ||
| @@ -349,7 +351,7 @@ static int gennvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd) · 63 unmodified lines | |||
| 349 | gennvm_generic_to_addr_mode(dev, rqd); | 351 | gennvm_generic_to_addr_mode(dev, rqd); |
| 350 | 352 | ||
| 351 | rqd->dev = dev; | 353 | rqd->dev = dev; |
| 352 | return dev->ops->submit_io(dev->q, rqd); | 354 | return dev->ops->submit_io(dev, rqd); |
| 353 | } | 355 | } |
| 354 | 356 | ||
| 355 | static void gennvm_blk_set_type(struct nvm_dev *dev, struct ppa_addr *ppa, | 357 | static void gennvm_blk_set_type(struct nvm_dev *dev, struct ppa_addr *ppa, |
| @@ -385,7 +387,7 @@ static void gennvm_mark_blk_bad(struct nvm_dev *dev, struct nvm_rq *rqd) · 29 unmodified lines | |||
| 385 | if (!dev->ops->set_bb_tbl) | 387 | if (!dev->ops->set_bb_tbl) |
| 386 | return; | 388 | return; |
| 387 | 389 | ||
| 388 | if (dev->ops->set_bb_tbl(dev->q, rqd, 1)) | 390 | if (dev->ops->set_bb_tbl(dev, rqd, 1)) |
| 389 | return; | 391 | return; |
| 390 | 392 | ||
| 391 | gennvm_addr_to_generic_mode(dev, rqd); | 393 | gennvm_addr_to_generic_mode(dev, rqd); |
| @@ -453,7 +455,7 @@ static int gennvm_erase_blk(struct nvm_dev *dev, struct nvm_block *blk, · 61 unmodified lines | |||
| 453 | 455 | ||
| 454 | gennvm_generic_to_addr_mode(dev, &rqd); | 456 | gennvm_generic_to_addr_mode(dev, &rqd); |
| 455 | 457 | ||
| 456 | ret = dev->ops->erase_block(dev->q, &rqd); | 458 | ret = dev->ops->erase_block(dev, &rqd); |
| 457 | 459 | ||
| 458 | if (plane_cnt) | 460 | if (plane_cnt) |
| 459 | nvm_dev_dma_free(dev, rqd.ppa_list, rqd.dma_ppa_list); | 461 | nvm_dev_dma_free(dev, rqd.ppa_list, rqd.dma_ppa_list); |
| @@ -182,7 +182,7 @@ static struct rrpc_block *rrpc_get_blk(struct rrpc *rrpc, struct rrpc_lun *rlun, · 181 unmodified lines | |||
| 182 | struct nvm_block *blk; | 182 | struct nvm_block *blk; |
| 183 | struct rrpc_block *rblk; | 183 | struct rrpc_block *rblk; |
| 184 | 184 | ||
| 185 | blk = nvm_get_blk(rrpc->dev, rlun->parent, 0); | 185 | blk = nvm_get_blk(rrpc->dev, rlun->parent, flags); |
| 186 | if (!blk) | 186 | if (!blk) |
| 187 | return NULL; | 187 | return NULL; |
| 188 | 188 | ||
| @@ -202,6 +202,20 @@ static void rrpc_put_blk(struct rrpc *rrpc, struct rrpc_block *rblk) · 13 unmodified lines | |||
| 202 | nvm_put_blk(rrpc->dev, rblk->parent); | 202 | nvm_put_blk(rrpc->dev, rblk->parent); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | static void rrpc_put_blks(struct rrpc *rrpc) | ||
| 206 | { | ||
| 207 | struct rrpc_lun *rlun; | ||
| 208 | int i; | ||
| 209 | |||
| 210 | for (i = 0; i < rrpc->nr_luns; i++) { | ||
| 211 | rlun = &rrpc->luns[i]; | ||
| 212 | if (rlun->cur) | ||
| 213 | rrpc_put_blk(rrpc, rlun->cur); | ||
| 214 | if (rlun->gc_cur) | ||
| 215 | rrpc_put_blk(rrpc, rlun->gc_cur); | ||
| 216 | } | ||
| 217 | } | ||
| 218 | |||
| 205 | static struct rrpc_lun *get_next_lun(struct rrpc *rrpc) | 219 | static struct rrpc_lun *get_next_lun(struct rrpc *rrpc) |
| 206 | { | 220 | { |
| 207 | int next = atomic_inc_return(&rrpc->next_lun); | 221 | int next = atomic_inc_return(&rrpc->next_lun); |
| @@ -1002,7 +1016,7 @@ static int rrpc_map_init(struct rrpc *rrpc) · 794 unmodified lines | |||
| 1002 | return 0; | 1016 | return 0; |
| 1003 | 1017 | ||
| 1004 | /* Bring up the mapping table from device */ | 1018 | /* Bring up the mapping table from device */ |
| 1005 | ret = dev->ops->get_l2p_tbl(dev->q, 0, dev->total_pages, | 1019 | ret = dev->ops->get_l2p_tbl(dev, 0, dev->total_pages, |
| 1006 | rrpc_l2p_update, rrpc); | 1020 | rrpc_l2p_update, rrpc); |
| 1007 | if (ret) { | 1021 | if (ret) { |
| 1008 | pr_err("nvm: rrpc: could not read L2P table.\n"); | 1022 | pr_err("nvm: rrpc: could not read L2P table.\n"); |
| @@ -1224,18 +1238,21 @@ static int rrpc_luns_configure(struct rrpc *rrpc) · 215 unmodified lines | |||
| 1224 | 1238 | ||
| 1225 | rblk = rrpc_get_blk(rrpc, rlun, 0); | 1239 | rblk = rrpc_get_blk(rrpc, rlun, 0); |
| 1226 | if (!rblk) | 1240 | if (!rblk) |
| 1227 | return -EINVAL; | 1241 | goto err; |
| 1228 | 1242 | ||
| 1229 | rrpc_set_lun_cur(rlun, rblk); | 1243 | rrpc_set_lun_cur(rlun, rblk); |
| 1230 | 1244 | ||
| 1231 | /* Emergency gc block */ | 1245 | /* Emergency gc block */ |
| 1232 | rblk = rrpc_get_blk(rrpc, rlun, 1); | 1246 | rblk = rrpc_get_blk(rrpc, rlun, 1); |
| 1233 | if (!rblk) | 1247 | if (!rblk) |
| 1234 | return -EINVAL; | 1248 | goto err; |
| 1235 | rlun->gc_cur = rblk; | 1249 | rlun->gc_cur = rblk; |
| 1236 | } | 1250 | } |
| 1237 | 1251 | ||
| 1238 | return 0; | 1252 | return 0; |
| 1253 | err: | ||
| 1254 | rrpc_put_blks(rrpc); | ||
| 1255 | return -EINVAL; | ||
| 1239 | } | 1256 | } |
| 1240 | 1257 | ||
| 1241 | static struct nvm_tgt_type tt_rrpc; | 1258 | static struct nvm_tgt_type tt_rrpc; |
| @@ -1206,6 +1206,12 @@ static int __reserve_metadata_snap(struct dm_pool_metadata *pmd) · 1205 unmodified lines | |||
| 1206 | struct dm_block *copy, *sblock; | 1206 | struct dm_block *copy, *sblock; |
| 1207 | dm_block_t held_root; | 1207 | dm_block_t held_root; |
| 1208 | 1208 | ||
| 1209 | /* | ||
| 1210 | * We commit to ensure the btree roots which we increment in a | ||
| 1211 | * moment are up to date. | ||
| 1212 | */ | ||
| 1213 | __commit_transaction(pmd); | ||
| 1214 | |||
| 1209 | /* | 1215 | /* |
| 1210 | * Copy the superblock. | 1216 | * Copy the superblock. |
| 1211 | */ | 1217 | */ |
| @@ -1538,7 +1544,7 @@ static int __remove(struct dm_thin_device *td, dm_block_t block) · 326 unmodified lines | |||
| 1538 | static int __remove_range(struct dm_thin_device *td, dm_block_t begin, dm_block_t end) | 1544 | static int __remove_range(struct dm_thin_device *td, dm_block_t begin, dm_block_t end) |
| 1539 | { | 1545 | { |
| 1540 | int r; | 1546 | int r; |
| 1541 | unsigned count; | 1547 | unsigned count, total_count = 0; |
| 1542 | struct dm_pool_metadata *pmd = td->pmd; | 1548 | struct dm_pool_metadata *pmd = td->pmd; |
| 1543 | dm_block_t keys[1] = { td->id }; | 1549 | dm_block_t keys[1] = { td->id }; |
| 1544 | __le64 value; | 1550 | __le64 value; |
| @@ -1561,11 +1567,29 @@ static int __remove_range(struct dm_thin_device *td, dm_block_t begin, dm_block_ · 16 unmodified lines | |||
| 1561 | if (r) | 1567 | if (r) |
| 1562 | return r; | 1568 | return r; |
| 1563 | 1569 | ||
| 1564 | r = dm_btree_remove_leaves(&pmd->bl_info, mapping_root, &begin, end, &mapping_root, &count); | 1570 | /* |
| 1565 | if (r) | 1571 | * Remove leaves stops at the first unmapped entry, so we have to |
| 1566 | return r; | 1572 | * loop round finding mapped ranges. |
| 1573 | */ | ||
| 1574 | while (begin < end) { | ||
| 1575 | r = dm_btree_lookup_next(&pmd->bl_info, mapping_root, &begin, &begin, &value); | ||
| 1576 | if (r == -ENODATA) | ||
| 1577 | break; | ||
| 1578 | |||
| 1579 | if (r) | ||
| 1580 | return r; | ||
| 1581 | |||
| 1582 | if (begin >= end) | ||
| 1583 | break; | ||
| 1584 | |||
| 1585 | r = dm_btree_remove_leaves(&pmd->bl_info, mapping_root, &begin, end, &mapping_root, &count); | ||
| 1586 | if (r) | ||
| 1587 | return r; | ||
| 1588 | |||
| 1589 | total_count += count; | ||
| 1590 | } | ||
| 1567 | 1591 | ||
| 1568 | td->mapped_blocks -= count; | 1592 | td->mapped_blocks -= total_count; |
| 1569 | td->changed = 1; | 1593 | td->changed = 1; |
| 1570 | 1594 | ||
| 1571 | /* | 1595 | /* |
| @@ -314,8 +314,8 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio) · 313 unmodified lines | |||
| 314 | */ | 314 | */ |
| 315 | void mddev_suspend(struct mddev *mddev) | 315 | void mddev_suspend(struct mddev *mddev) |
| 316 | { | 316 | { |
| 317 | BUG_ON(mddev->suspended); | 317 | if (mddev->suspended++) |
| 318 | mddev->suspended = 1; | 318 | return; |
| 319 | synchronize_rcu(); | 319 | synchronize_rcu(); |
| 320 | wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0); | 320 | wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0); |
| 321 | mddev->pers->quiesce(mddev, 1); | 321 | mddev->pers->quiesce(mddev, 1); |
| @@ -326,7 +326,8 @@ EXPORT_SYMBOL_GPL(mddev_suspend); · 4 unmodified lines | |||
| 326 | 326 | ||
| 327 | void mddev_resume(struct mddev *mddev) | 327 | void mddev_resume(struct mddev *mddev) |
| 328 | { | 328 | { |
| 329 | mddev->suspended = 0; | 329 | if (--mddev->suspended) |
| 330 | return; | ||
| 330 | wake_up(&mddev->sb_wait); | 331 | wake_up(&mddev->sb_wait); |
| 331 | mddev->pers->quiesce(mddev, 0); | 332 | mddev->pers->quiesce(mddev, 0); |
| 332 | 333 | ||
| @@ -1652,7 +1653,7 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) · 1319 unmodified lines | |||
| 1652 | rdev->journal_tail = le64_to_cpu(sb->journal_tail); | 1653 | rdev->journal_tail = le64_to_cpu(sb->journal_tail); |
| 1653 | if (mddev->recovery_cp == MaxSector) | 1654 | if (mddev->recovery_cp == MaxSector) |
| 1654 | set_bit(MD_JOURNAL_CLEAN, &mddev->flags); | 1655 | set_bit(MD_JOURNAL_CLEAN, &mddev->flags); |
| 1655 | rdev->raid_disk = mddev->raid_disks; | 1656 | rdev->raid_disk = 0; |
| 1656 | break; | 1657 | break; |
| 1657 | default: | 1658 | default: |
| 1658 | rdev->saved_raid_disk = role; | 1659 | rdev->saved_raid_disk = role; |
| @@ -2773,6 +2774,7 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len) · 1114 unmodified lines | |||
| 2773 | /* Activating a spare .. or possibly reactivating | 2774 | /* Activating a spare .. or possibly reactivating |
| 2774 | * if we ever get bitmaps working here. | 2775 | * if we ever get bitmaps working here. |
| 2775 | */ | 2776 | */ |
| 2777 | int err; | ||
| 2776 | 2778 | ||
| 2777 | if (rdev->raid_disk != -1) | 2779 | if (rdev->raid_disk != -1) |
| 2778 | return -EBUSY; | 2780 | return -EBUSY; |
| @@ -2794,9 +2796,15 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len) · 15 unmodified lines | |||
| 2794 | rdev->saved_raid_disk = -1; | 2796 | rdev->saved_raid_disk = -1; |
| 2795 | clear_bit(In_sync, &rdev->flags); | 2797 | clear_bit(In_sync, &rdev->flags); |
| 2796 | clear_bit(Bitmap_sync, &rdev->flags); | 2798 | clear_bit(Bitmap_sync, &rdev->flags); |
| 2797 | remove_and_add_spares(rdev->mddev, rdev); | 2799 | err = rdev->mddev->pers-> |
| 2798 | if (rdev->raid_disk == -1) | 2800 | hot_add_disk(rdev->mddev, rdev); |
| 2799 | return -EBUSY; | 2801 | if (err) { |
| 2802 | rdev->raid_disk = -1; | ||
| 2803 | return err; | ||
| 2804 | } else | ||
| 2805 | sysfs_notify_dirent_safe(rdev->sysfs_state); | ||
| 2806 | if (sysfs_link_rdev(rdev->mddev, rdev)) | ||
| 2807 | /* failure here is OK */; | ||
| 2800 | /* don't wakeup anyone, leave that to userspace. */ | 2808 | /* don't wakeup anyone, leave that to userspace. */ |
| 2801 | } else { | 2809 | } else { |
| 2802 | if (slot >= rdev->mddev->raid_disks && | 2810 | if (slot >= rdev->mddev->raid_disks && |
| @@ -566,7 +566,9 @@ static inline char * mdname (struct mddev * mddev) · 565 unmodified lines | |||
| 566 | static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) | 566 | static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) |
| 567 | { | 567 | { |
| 568 | char nm[20]; | 568 | char nm[20]; |
| 569 | if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { | 569 | if (!test_bit(Replacement, &rdev->flags) && |
| 570 | !test_bit(Journal, &rdev->flags) && | ||
| 571 | mddev->kobj.sd) { | ||
| 570 | sprintf(nm, "rd%d", rdev->raid_disk); | 572 | sprintf(nm, "rd%d", rdev->raid_disk); |
| 571 | return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); | 573 | return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); |
| 572 | } else | 574 | } else |
| @@ -576,7 +578,9 @@ static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) · 3 unmodified lines | |||
| 576 | static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) | 578 | static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) |
| 577 | { | 579 | { |
| 578 | char nm[20]; | 580 | char nm[20]; |
| 579 | if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { | 581 | if (!test_bit(Replacement, &rdev->flags) && |
| 582 | !test_bit(Journal, &rdev->flags) && | ||
| 583 | mddev->kobj.sd) { | ||
| 580 | sprintf(nm, "rd%d", rdev->raid_disk); | 584 | sprintf(nm, "rd%d", rdev->raid_disk); |
| 581 | sysfs_remove_link(&mddev->kobj, nm); | 585 | sysfs_remove_link(&mddev->kobj, nm); |
| 582 | } | 586 | } |
| @@ -63,6 +63,11 @@ int lower_bound(struct btree_node *n, uint64_t key) · 62 unmodified lines | |||
| 63 | return bsearch(n, key, 0); | 63 | return bsearch(n, key, 0); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | static int upper_bound(struct btree_node *n, uint64_t key) | ||
| 67 | { | ||
| 68 | return bsearch(n, key, 1); | ||
| 69 | } | ||
| 70 | |||
| 66 | void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, | 71 | void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
| 67 | struct dm_btree_value_type *vt) | 72 | struct dm_btree_value_type *vt) |
| 68 | { | 73 | { |
| @@ -252,6 +257,16 @@ static void pop_frame(struct del_stack *s) · 183 unmodified lines | |||
| 252 | dm_tm_unlock(s->tm, f->b); | 257 | dm_tm_unlock(s->tm, f->b); |
| 253 | } | 258 | } |
| 254 | 259 | ||
| 260 | static void unlock_all_frames(struct del_stack *s) | ||
| 261 | { | ||
| 262 | struct frame *f; | ||
| 263 | |||
| 264 | while (unprocessed_frames(s)) { | ||
| 265 | f = s->spine + s->top--; | ||
| 266 | dm_tm_unlock(s->tm, f->b); | ||
| 267 | } | ||
| 268 | } | ||
| 269 | |||
| 255 | int dm_btree_del(struct dm_btree_info *info, dm_block_t root) | 270 | int dm_btree_del(struct dm_btree_info *info, dm_block_t root) |
| 256 | { | 271 | { |
| 257 | int r; | 272 | int r; |
| @@ -308,9 +323,13 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root) · 50 unmodified lines | |||
| 308 | pop_frame(s); | 323 | pop_frame(s); |
| 309 | } | 324 | } |
| 310 | } | 325 | } |
| 311 | |||
| 312 | out: | 326 | out: |
| 327 | if (r) { | ||
| 328 | /* cleanup all frames of del_stack */ | ||
| 329 | unlock_all_frames(s); | ||
| 330 | } | ||
| 313 | kfree(s); | 331 | kfree(s); |
| 332 | |||
| 314 | return r; | 333 | return r; |
| 315 | } | 334 | } |
| 316 | EXPORT_SYMBOL_GPL(dm_btree_del); | 335 | EXPORT_SYMBOL_GPL(dm_btree_del); |
| @@ -392,6 +411,82 @@ int dm_btree_lookup(struct dm_btree_info *info, dm_block_t root, · 75 unmodified lines | |||
| 392 | } | 411 | } |
| 393 | EXPORT_SYMBOL_GPL(dm_btree_lookup); | 412 | EXPORT_SYMBOL_GPL(dm_btree_lookup); |
| 394 | 413 | ||
| 414 | static int dm_btree_lookup_next_single(struct dm_btree_info *info, dm_block_t root, | ||
| 415 | uint64_t key, uint64_t *rkey, void *value_le) | ||
| 416 | { | ||
| 417 | int r, i; | ||
| 418 | uint32_t flags, nr_entries; | ||
| 419 | struct dm_block *node; | ||
| 420 | struct btree_node *n; | ||
| 421 | |||
| 422 | r = bn_read_lock(info, root, &node); | ||
| 423 | if (r) | ||
| 424 | return r; | ||
| 425 | |||
| 426 | n = dm_block_data(node); | ||
| 427 | flags = le32_to_cpu(n->header.flags); | ||
| 428 | nr_entries = le32_to_cpu(n->header.nr_entries); | ||
| 429 | |||
| 430 | if (flags & INTERNAL_NODE) { | ||
| 431 | i = lower_bound(n, key); | ||
| 432 | if (i < 0 || i >= nr_entries) { | ||
| 433 | r = -ENODATA; | ||
| 434 | goto out; | ||
| 435 | } | ||
| 436 | |||
| 437 | r = dm_btree_lookup_next_single(info, value64(n, i), key, rkey, value_le); | ||
| 438 | if (r == -ENODATA && i < (nr_entries - 1)) { | ||
| 439 | i++; | ||
| 440 | r = dm_btree_lookup_next_single(info, value64(n, i), key, rkey, value_le); | ||
| 441 | } | ||
| 442 | |||
| 443 | } else { | ||
| 444 | i = upper_bound(n, key); | ||
| 445 | if (i < 0 || i >= nr_entries) { | ||
| 446 | r = -ENODATA; | ||
| 447 | goto out; | ||
| 448 | } | ||
| 449 | |||
| 450 | *rkey = le64_to_cpu(n->keys[i]); | ||
| 451 | memcpy(value_le, value_ptr(n, i), info->value_type.size); | ||
| 452 | } | ||
| 453 | out: | ||
| 454 | dm_tm_unlock(info->tm, node); | ||
| 455 | return r; | ||
| 456 | } | ||
| 457 | |||
| 458 | int dm_btree_lookup_next(struct dm_btree_info *info, dm_block_t root, | ||
| 459 | uint64_t *keys, uint64_t *rkey, void *value_le) | ||
| 460 | { | ||
| 461 | unsigned level; | ||
| 462 | int r = -ENODATA; | ||
| 463 | __le64 internal_value_le; | ||
| 464 | struct ro_spine spine; | ||
| 465 | |||
| 466 | init_ro_spine(&spine, info); | ||
| 467 | for (level = 0; level < info->levels - 1u; level++) { | ||
| 468 | r = btree_lookup_raw(&spine, root, keys[level], | ||
| 469 | lower_bound, rkey, | ||
| 470 | &internal_value_le, sizeof(uint64_t)); | ||
| 471 | if (r) | ||
| 472 | goto out; | ||
| 473 | |||
| 474 | if (*rkey != keys[level]) { | ||
| 475 | r = -ENODATA; | ||
| 476 | goto out; | ||
| 477 | } | ||
| 478 | |||
| 479 | root = le64_to_cpu(internal_value_le); | ||
| 480 | } | ||
| 481 | |||
| 482 | r = dm_btree_lookup_next_single(info, root, keys[level], rkey, value_le); | ||
| 483 | out: | ||
| 484 | exit_ro_spine(&spine); | ||
| 485 | return r; | ||
| 486 | } | ||
| 487 | |||
| 488 | EXPORT_SYMBOL_GPL(dm_btree_lookup_next); | ||
| 489 | |||
| 395 | /* | 490 | /* |
| 396 | * Splits a node by creating a sibling node and shifting half the nodes | 491 | * Splits a node by creating a sibling node and shifting half the nodes |
| 397 | * contents across. Assumes there is a parent node, and it has room for | 492 | * contents across. Assumes there is a parent node, and it has room for |
| @@ -473,8 +568,10 @@ static int btree_split_sibling(struct shadow_spine *s, unsigned parent_index, · 75 unmodified lines | |||
| 473 | 568 | ||
| 474 | r = insert_at(sizeof(__le64), pn, parent_index + 1, | 569 | r = insert_at(sizeof(__le64), pn, parent_index + 1, |
| 475 | le64_to_cpu(rn->keys[0]), &location); | 570 | le64_to_cpu(rn->keys[0]), &location); |
| 476 | if (r) | 571 | if (r) { |
| 572 | unlock_block(s->info, right); | ||
| 477 | return r; | 573 | return r; |
| 574 | } | ||
| 478 | 575 | ||
| 479 | if (key < le64_to_cpu(rn->keys[0])) { | 576 | if (key < le64_to_cpu(rn->keys[0])) { |
| 480 | unlock_block(s->info, right); | 577 | unlock_block(s->info, right); |
| @@ -109,6 +109,13 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root); · 108 unmodified lines | |||
| 109 | int dm_btree_lookup(struct dm_btree_info *info, dm_block_t root, | 109 | int dm_btree_lookup(struct dm_btree_info *info, dm_block_t root, |
| 110 | uint64_t *keys, void *value_le); | 110 | uint64_t *keys, void *value_le); |
| 111 | 111 | ||
| 112 | /* | ||
| 113 | * Tries to find the first key where the bottom level key is >= to that | ||
| 114 | * given. Useful for skipping empty sections of the btree. | ||
| 115 | */ | ||
| 116 | int dm_btree_lookup_next(struct dm_btree_info *info, dm_block_t root, | ||
| 117 | uint64_t *keys, uint64_t *rkey, void *value_le); | ||
| 118 | |||
| 112 | /* | 119 | /* |
| 113 | * Insertion (or overwrite an existing value). O(ln(n)) | 120 | * Insertion (or overwrite an existing value). O(ln(n)) |
| 114 | */ | 121 | */ |
| @@ -135,9 +142,10 @@ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, · 20 unmodified lines | |||
| 135 | uint64_t *keys, dm_block_t *new_root); | 142 | uint64_t *keys, dm_block_t *new_root); |
| 136 | 143 | ||
| 137 | /* | 144 | /* |
| 138 | * Removes values between 'keys' and keys2, where keys2 is keys with the | 145 | * Removes a _contiguous_ run of values starting from 'keys' and not |
| 139 | * final key replaced with 'end_key'. 'end_key' is the one-past-the-end | 146 | * reaching keys2 (where keys2 is keys with the final key replaced with |
| 140 | * value. 'keys' may be altered. | 147 | * 'end_key'). 'end_key' is the one-past-the-end value. 'keys' may be |
| 148 | * altered. | ||
| 141 | */ | 149 | */ |
| 142 | int dm_btree_remove_leaves(struct dm_btree_info *info, dm_block_t root, | 150 | int dm_btree_remove_leaves(struct dm_btree_info *info, dm_block_t root, |
| 143 | uint64_t *keys, uint64_t end_key, | 151 | uint64_t *keys, uint64_t end_key, |
| @@ -136,7 +136,7 @@ static int brb_push(struct bop_ring_buffer *brb, · 135 unmodified lines | |||
| 136 | return 0; | 136 | return 0; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | static int brb_pop(struct bop_ring_buffer *brb, struct block_op *result) | 139 | static int brb_peek(struct bop_ring_buffer *brb, struct block_op *result) |
| 140 | { | 140 | { |
| 141 | struct block_op *bop; | 141 | struct block_op *bop; |
| 142 | 142 | ||
| @@ -147,6 +147,17 @@ static int brb_pop(struct bop_ring_buffer *brb, struct block_op *result) · 4 unmodified lines | |||
| 147 | result->type = bop->type; | 147 | result->type = bop->type; |
| 148 | result->block = bop->block; | 148 | result->block = bop->block; |
| 149 | 149 | ||
| 150 | return 0; | ||
| 151 | } | ||
| 152 | |||
| 153 | static int brb_pop(struct bop_ring_buffer *brb) | ||
| 154 | { | ||
| 155 | struct block_op *bop; | ||
| 156 | |||
| 157 | if (brb_empty(brb)) | ||
| 158 | return -ENODATA; | ||
| 159 | |||
| 160 | bop = brb->bops + brb->begin; | ||
| 150 | brb->begin = brb_next(brb, brb->begin); | 161 | brb->begin = brb_next(brb, brb->begin); |
| 151 | 162 | ||
| 152 | return 0; | 163 | return 0; |
| @@ -211,7 +222,7 @@ static int apply_bops(struct sm_metadata *smm) · 58 unmodified lines | |||
| 211 | while (!brb_empty(&smm->uncommitted)) { | 222 | while (!brb_empty(&smm->uncommitted)) { |
| 212 | struct block_op bop; | 223 | struct block_op bop; |
| 213 | 224 | ||
| 214 | r = brb_pop(&smm->uncommitted, &bop); | 225 | r = brb_peek(&smm->uncommitted, &bop); |
| 215 | if (r) { | 226 | if (r) { |
| 216 | DMERR("bug in bop ring buffer"); | 227 | DMERR("bug in bop ring buffer"); |
| 217 | break; | 228 | break; |
| @@ -220,6 +231,8 @@ static int apply_bops(struct sm_metadata *smm) · 2 unmodified lines | |||
| 220 | r = commit_bop(smm, &bop); | 231 | r = commit_bop(smm, &bop); |
| 221 | if (r) | 232 | if (r) |
| 222 | break; | 233 | break; |
| 234 | |||
| 235 | brb_pop(&smm->uncommitted); | ||
| 223 | } | 236 | } |
| 224 | 237 | ||
| 225 | return r; | 238 | return r; |
| @@ -683,7 +696,6 @@ static struct dm_space_map bootstrap_ops = { · 457 unmodified lines | |||
| 683 | static int sm_metadata_extend(struct dm_space_map *sm, dm_block_t extra_blocks) | 696 | static int sm_metadata_extend(struct dm_space_map *sm, dm_block_t extra_blocks) |
| 684 | { | 697 | { |
| 685 | int r, i; | 698 | int r, i; |
| 686 | enum allocation_event ev; | ||
| 687 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); | 699 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); |
| 688 | dm_block_t old_len = smm->ll.nr_blocks; | 700 | dm_block_t old_len = smm->ll.nr_blocks; |
| 689 | 701 | ||
| @@ -705,11 +717,12 @@ static int sm_metadata_extend(struct dm_space_map *sm, dm_block_t extra_blocks) · 15 unmodified lines | |||
| 705 | * allocate any new blocks. | 717 | * allocate any new blocks. |
| 706 | */ | 718 | */ |
| 707 | do { | 719 | do { |
| 708 | for (i = old_len; !r && i < smm->begin; i++) { | 720 | for (i = old_len; !r && i < smm->begin; i++) |
| 709 | r = sm_ll_inc(&smm->ll, i, &ev); | 721 | r = add_bop(smm, BOP_INC, i); |
| 710 | if (r) | 722 | |
| 711 | goto out; | 723 | if (r) |
| 712 | } | 724 | goto out; |
| 725 | |||
| 713 | old_len = smm->begin; | 726 | old_len = smm->begin; |
| 714 | 727 | ||
| 715 | r = apply_bops(smm); | 728 | r = apply_bops(smm); |
| @@ -754,7 +767,6 @@ int dm_sm_metadata_create(struct dm_space_map *sm, · 38 unmodified lines | |||
| 754 | { | 767 | { |
| 755 | int r; | 768 | int r; |
| 756 | dm_block_t i; | 769 | dm_block_t i; |
| 757 | enum allocation_event ev; | ||
| 758 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); | 770 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); |
| 759 | 771 | ||
| 760 | smm->begin = superblock + 1; | 772 | smm->begin = superblock + 1; |
| @@ -782,7 +794,7 @@ int dm_sm_metadata_create(struct dm_space_map *sm, · 21 unmodified lines | |||
| 782 | * allocated blocks that they were built from. | 794 | * allocated blocks that they were built from. |
| 783 | */ | 795 | */ |
| 784 | for (i = superblock; !r && i < smm->begin; i++) | 796 | for (i = superblock; !r && i < smm->begin; i++) |
| 785 | r = sm_ll_inc(&smm->ll, i, &ev); | 797 | r = add_bop(smm, BOP_INC, i); |
| 786 | 798 | ||
| 787 | if (r) | 799 | if (r) |
| 788 | return r; | 800 | return r; |
| @@ -1946,6 +1946,8 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) · 1945 unmodified lines | |||
| 1946 | 1946 | ||
| 1947 | first = i; | 1947 | first = i; |
| 1948 | fbio = r10_bio->devs[i].bio; | 1948 | fbio = r10_bio->devs[i].bio; |
| 1949 | fbio->bi_iter.bi_size = r10_bio->sectors << 9; | ||
| 1950 | fbio->bi_iter.bi_idx = 0; | ||
| 1949 | 1951 | ||
| 1950 | vcnt = (r10_bio->sectors + (PAGE_SIZE >> 9) - 1) >> (PAGE_SHIFT - 9); | 1952 | vcnt = (r10_bio->sectors + (PAGE_SIZE >> 9) - 1) >> (PAGE_SHIFT - 9); |
| 1951 | /* now find blocks with errors */ | 1953 | /* now find blocks with errors */ |
| @@ -1989,7 +1991,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) · 37 unmodified lines | |||
| 1989 | bio_reset(tbio); | 1991 | bio_reset(tbio); |
| 1990 | 1992 | ||
| 1991 | tbio->bi_vcnt = vcnt; | 1993 | tbio->bi_vcnt = vcnt; |
| 1992 | tbio->bi_iter.bi_size = r10_bio->sectors << 9; | 1994 | tbio->bi_iter.bi_size = fbio->bi_iter.bi_size; |
| 1993 | tbio->bi_rw = WRITE; | 1995 | tbio->bi_rw = WRITE; |
| 1994 | tbio->bi_private = r10_bio; | 1996 | tbio->bi_private = r10_bio; |
| 1995 | tbio->bi_iter.bi_sector = r10_bio->devs[i].addr; | 1997 | tbio->bi_iter.bi_sector = r10_bio->devs[i].addr; |
| @@ -805,11 +805,11 @@ static void ivtv_init_struct2(struct ivtv *itv) · 804 unmodified lines | |||
| 805 | { | 805 | { |
| 806 | int i; | 806 | int i; |
| 807 | 807 | ||
| 808 | for (i = 0; i < IVTV_CARD_MAX_VIDEO_INPUTS - 1; i++) | 808 | for (i = 0; i < IVTV_CARD_MAX_VIDEO_INPUTS; i++) |
| 809 | if (itv->card->video_inputs[i].video_type == 0) | 809 | if (itv->card->video_inputs[i].video_type == 0) |
| 810 | break; | 810 | break; |
| 811 | itv->nof_inputs = i; | 811 | itv->nof_inputs = i; |
| 812 | for (i = 0; i < IVTV_CARD_MAX_AUDIO_INPUTS - 1; i++) | 812 | for (i = 0; i < IVTV_CARD_MAX_AUDIO_INPUTS; i++) |
| 813 | if (itv->card->audio_inputs[i].audio_type == 0) | 813 | if (itv->card->audio_inputs[i].audio_type == 0) |
| 814 | break; | 814 | break; |
| 815 | itv->nof_audio_inputs = i; | 815 | itv->nof_audio_inputs = i; |
| @@ -134,7 +134,7 @@ struct airspy { · 133 unmodified lines | |||
| 134 | int urbs_submitted; | 134 | int urbs_submitted; |
| 135 | 135 | ||
| 136 | /* USB control message buffer */ | 136 | /* USB control message buffer */ |
| 137 | #define BUF_SIZE 24 | 137 | #define BUF_SIZE 128 |
| 138 | u8 buf[BUF_SIZE]; | 138 | u8 buf[BUF_SIZE]; |
| 139 | 139 | ||
| 140 | /* Current configuration */ | 140 | /* Current configuration */ |
| @@ -24,6 +24,15 @@ · 23 unmodified lines | |||
| 24 | #include <media/videobuf2-v4l2.h> | 24 | #include <media/videobuf2-v4l2.h> |
| 25 | #include <media/videobuf2-vmalloc.h> | 25 | #include <media/videobuf2-vmalloc.h> |
| 26 | 26 | ||
| 27 | /* | ||
| 28 | * Used Avago MGA-81563 RF amplifier could be destroyed pretty easily with too | ||
| 29 | * strong signal or transmitting to bad antenna. | ||
| 30 | * Set RF gain control to 'grabbed' state by default for sure. | ||
| 31 | */ | ||
| 32 | static bool hackrf_enable_rf_gain_ctrl; | ||
| 33 | module_param_named(enable_rf_gain_ctrl, hackrf_enable_rf_gain_ctrl, bool, 0644); | ||
| 34 | MODULE_PARM_DESC(enable_rf_gain_ctrl, "enable RX/TX RF amplifier control (warn: could damage amplifier)"); | ||
| 35 | |||
| 27 | /* HackRF USB API commands (from HackRF Library) */ | 36 | /* HackRF USB API commands (from HackRF Library) */ |
| 28 | enum { | 37 | enum { |
| 29 | CMD_SET_TRANSCEIVER_MODE = 0x01, | 38 | CMD_SET_TRANSCEIVER_MODE = 0x01, |
| @@ -1451,6 +1460,7 @@ static int hackrf_probe(struct usb_interface *intf, · 1421 unmodified lines | |||
| 1451 | dev_err(dev->dev, "Could not initialize controls\n"); | 1460 | dev_err(dev->dev, "Could not initialize controls\n"); |
| 1452 | goto err_v4l2_ctrl_handler_free_rx; | 1461 | goto err_v4l2_ctrl_handler_free_rx; |
| 1453 | } | 1462 | } |
| 1463 | v4l2_ctrl_grab(dev->rx_rf_gain, !hackrf_enable_rf_gain_ctrl); | ||
| 1454 | v4l2_ctrl_handler_setup(&dev->rx_ctrl_handler); | 1464 | v4l2_ctrl_handler_setup(&dev->rx_ctrl_handler); |
| 1455 | 1465 | ||
| 1456 | /* Register controls for transmitter */ | 1466 | /* Register controls for transmitter */ |
| @@ -1471,6 +1481,7 @@ static int hackrf_probe(struct usb_interface *intf, · 14 unmodified lines | |||
| 1471 | dev_err(dev->dev, "Could not initialize controls\n"); | 1481 | dev_err(dev->dev, "Could not initialize controls\n"); |
| 1472 | goto err_v4l2_ctrl_handler_free_tx; | 1482 | goto err_v4l2_ctrl_handler_free_tx; |
| 1473 | } | 1483 | } |
| 1484 | v4l2_ctrl_grab(dev->tx_rf_gain, !hackrf_enable_rf_gain_ctrl); | ||
| 1474 | v4l2_ctrl_handler_setup(&dev->tx_ctrl_handler); | 1485 | v4l2_ctrl_handler_setup(&dev->tx_ctrl_handler); |
| 1475 | 1486 | ||
| 1476 | /* Register the v4l2_device structure */ | 1487 | /* Register the v4l2_device structure */ |
| @@ -1530,7 +1541,7 @@ err_v4l2_ctrl_handler_free_rx: · 53 unmodified lines | |||
| 1530 | err_kfree: | 1541 | err_kfree: |
| 1531 | kfree(dev); | 1542 | kfree(dev); |
| 1532 | err: | 1543 | err: |
| 1533 | dev_dbg(dev->dev, "failed=%d\n", ret); | 1544 | dev_dbg(&intf->dev, "failed=%d\n", ret); |
| 1534 | return ret; | 1545 | return ret; |
| 1535 | } | 1546 | } |
| 1536 | 1547 | ||
| @@ -497,6 +497,7 @@ static u64 calculate_sr(struct cxl_context *ctx) · 496 unmodified lines | |||
| 497 | { | 497 | { |
| 498 | u64 sr = 0; | 498 | u64 sr = 0; |
| 499 | 499 | ||
| 500 | set_endian(sr); | ||
| 500 | if (ctx->master) | 501 | if (ctx->master) |
| 501 | sr |= CXL_PSL_SR_An_MP; | 502 | sr |= CXL_PSL_SR_An_MP; |
| 502 | if (mfspr(SPRN_LPCR) & LPCR_TC) | 503 | if (mfspr(SPRN_LPCR) & LPCR_TC) |
| @@ -506,7 +507,6 @@ static u64 calculate_sr(struct cxl_context *ctx) · 3 unmodified lines | |||
| 506 | sr |= CXL_PSL_SR_An_HV; | 507 | sr |= CXL_PSL_SR_An_HV; |
| 507 | } else { | 508 | } else { |
| 508 | sr |= CXL_PSL_SR_An_PR | CXL_PSL_SR_An_R; | 509 | sr |= CXL_PSL_SR_An_PR | CXL_PSL_SR_An_R; |
| 509 | set_endian(sr); | ||
| 510 | sr &= ~(CXL_PSL_SR_An_HV); | 510 | sr &= ~(CXL_PSL_SR_An_HV); |
| 511 | if (!test_tsk_thread_flag(current, TIF_32BIT)) | 511 | if (!test_tsk_thread_flag(current, TIF_32BIT)) |
| 512 | sr |= CXL_PSL_SR_An_SF; | 512 | sr |= CXL_PSL_SR_An_SF; |
| @@ -46,10 +46,18 @@ static int parse_ofpart_partitions(struct mtd_info *master, · 45 unmodified lines | |||
| 46 | 46 | ||
| 47 | ofpart_node = of_get_child_by_name(mtd_node, "partitions"); | 47 | ofpart_node = of_get_child_by_name(mtd_node, "partitions"); |
| 48 | if (!ofpart_node) { | 48 | if (!ofpart_node) { |
| 49 | pr_warn("%s: 'partitions' subnode not found on %s. Trying to parse direct subnodes as partitions.\n", | 49 | /* |
| 50 | master->name, mtd_node->full_name); | 50 | * We might get here even when ofpart isn't used at all (e.g., |
| 51 | * when using another parser), so don't be louder than | ||
| 52 | * KERN_DEBUG | ||
| 53 | */ | ||
| 54 | pr_debug("%s: 'partitions' subnode not found on %s. Trying to parse direct subnodes as partitions.\n", | ||
| 55 | master->name, mtd_node->full_name); | ||
| 51 | ofpart_node = mtd_node; | 56 | ofpart_node = mtd_node; |
| 52 | dedicated = false; | 57 | dedicated = false; |
| 58 | } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) { | ||
| 59 | /* The 'partitions' subnode might be used by another parser */ | ||
| 60 | return 0; | ||
| 53 | } | 61 | } |
| 54 | 62 | ||
| 55 | /* First count the subnodes */ | 63 | /* First count the subnodes */ |
| @@ -1849,7 +1849,7 @@ static int xgbe_exit(struct xgbe_prv_data *pdata) · 1848 unmodified lines | |||
| 1849 | usleep_range(10, 15); | 1849 | usleep_range(10, 15); |
| 1850 | 1850 | ||
| 1851 | /* Poll Until Poll Condition */ | 1851 | /* Poll Until Poll Condition */ |
| 1852 | while (count-- && XGMAC_IOREAD_BITS(pdata, DMA_MR, SWR)) | 1852 | while (--count && XGMAC_IOREAD_BITS(pdata, DMA_MR, SWR)) |
| 1853 | usleep_range(500, 600); | 1853 | usleep_range(500, 600); |
| 1854 | 1854 | ||
| 1855 | if (!count) | 1855 | if (!count) |
| @@ -1873,7 +1873,7 @@ static int xgbe_flush_tx_queues(struct xgbe_prv_data *pdata) · 17 unmodified lines | |||
| 1873 | /* Poll Until Poll Condition */ | 1873 | /* Poll Until Poll Condition */ |
| 1874 | for (i = 0; i < pdata->tx_q_count; i++) { | 1874 | for (i = 0; i < pdata->tx_q_count; i++) { |
| 1875 | count = 2000; | 1875 | count = 2000; |
| 1876 | while (count-- && XGMAC_MTL_IOREAD_BITS(pdata, i, | 1876 | while (--count && XGMAC_MTL_IOREAD_BITS(pdata, i, |
| 1877 | MTL_Q_TQOMR, FTQ)) | 1877 | MTL_Q_TQOMR, FTQ)) |
| 1878 | usleep_range(500, 600); | 1878 | usleep_range(500, 600); |
| 1879 | 1879 | ||
| @@ -289,6 +289,7 @@ static int xgene_enet_setup_tx_desc(struct xgene_enet_desc_ring *tx_ring, · 288 unmodified lines | |||
| 289 | struct sk_buff *skb) | 289 | struct sk_buff *skb) |
| 290 | { | 290 | { |
| 291 | struct device *dev = ndev_to_dev(tx_ring->ndev); | 291 | struct device *dev = ndev_to_dev(tx_ring->ndev); |
| 292 | struct xgene_enet_pdata *pdata = netdev_priv(tx_ring->ndev); | ||
| 292 | struct xgene_enet_raw_desc *raw_desc; | 293 | struct xgene_enet_raw_desc *raw_desc; |
| 293 | __le64 *exp_desc = NULL, *exp_bufs = NULL; | 294 | __le64 *exp_desc = NULL, *exp_bufs = NULL; |
| 294 | dma_addr_t dma_addr, pbuf_addr, *frag_dma_addr; | 295 | dma_addr_t dma_addr, pbuf_addr, *frag_dma_addr; |
| @@ -419,6 +420,7 @@ out: · 124 unmodified lines | |||
| 419 | raw_desc->m0 = cpu_to_le64(SET_VAL(LL, ll) | SET_VAL(NV, nv) | | 420 | raw_desc->m0 = cpu_to_le64(SET_VAL(LL, ll) | SET_VAL(NV, nv) | |
| 420 | SET_VAL(USERINFO, tx_ring->tail)); | 421 | SET_VAL(USERINFO, tx_ring->tail)); |
| 421 | tx_ring->cp_ring->cp_skb[tx_ring->tail] = skb; | 422 | tx_ring->cp_ring->cp_skb[tx_ring->tail] = skb; |
| 423 | pdata->tx_level += count; | ||
| 422 | tx_ring->tail = tail; | 424 | tx_ring->tail = tail; |
| 423 | 425 | ||
| 424 | return count; | 426 | return count; |
| @@ -429,14 +431,13 @@ static netdev_tx_t xgene_enet_start_xmit(struct sk_buff *skb, · 4 unmodified lines | |||
| 429 | { | 431 | { |
| 430 | struct xgene_enet_pdata *pdata = netdev_priv(ndev); | 432 | struct xgene_enet_pdata *pdata = netdev_priv(ndev); |
| 431 | struct xgene_enet_desc_ring *tx_ring = pdata->tx_ring; | 433 | struct xgene_enet_desc_ring *tx_ring = pdata->tx_ring; |
| 432 | struct xgene_enet_desc_ring *cp_ring = tx_ring->cp_ring; | 434 | u32 tx_level = pdata->tx_level; |
| 433 | u32 tx_level, cq_level; | ||
| 434 | int count; | 435 | int count; |
| 435 | 436 | ||
| 436 | tx_level = pdata->ring_ops->len(tx_ring); | 437 | if (tx_level < pdata->txc_level) |
| 437 | cq_level = pdata->ring_ops->len(cp_ring); | 438 | tx_level += ((typeof(pdata->tx_level))~0U); |
| 438 | if (unlikely(tx_level > pdata->tx_qcnt_hi || | 439 | |
| 439 | cq_level > pdata->cp_qcnt_hi)) { | 440 | if ((tx_level - pdata->txc_level) > pdata->tx_qcnt_hi) { |
| 440 | netif_stop_queue(ndev); | 441 | netif_stop_queue(ndev); |
| 441 | return NETDEV_TX_BUSY; | 442 | return NETDEV_TX_BUSY; |
| 442 | } | 443 | } |
| @@ -539,10 +540,13 @@ static int xgene_enet_process_ring(struct xgene_enet_desc_ring *ring, · 96 unmodified lines | |||
| 539 | struct xgene_enet_raw_desc *raw_desc, *exp_desc; | 540 | struct xgene_enet_raw_desc *raw_desc, *exp_desc; |
| 540 | u16 head = ring->head; | 541 | u16 head = ring->head; |
| 541 | u16 slots = ring->slots - 1; | 542 | u16 slots = ring->slots - 1; |
| 542 | int ret, count = 0, processed = 0; | 543 | int ret, desc_count, count = 0, processed = 0; |
| 544 | bool is_completion; | ||
| 543 | 545 | ||
| 544 | do { | 546 | do { |
| 545 | raw_desc = &ring->raw_desc[head]; | 547 | raw_desc = &ring->raw_desc[head]; |
| 548 | desc_count = 0; | ||
| 549 | is_completion = false; | ||
| 546 | exp_desc = NULL; | 550 | exp_desc = NULL; |
| 547 | if (unlikely(xgene_enet_is_desc_slot_empty(raw_desc))) | 551 | if (unlikely(xgene_enet_is_desc_slot_empty(raw_desc))) |
| 548 | break; | 552 | break; |
| @@ -559,18 +563,24 @@ static int xgene_enet_process_ring(struct xgene_enet_desc_ring *ring, · 10 unmodified lines | |||
| 559 | } | 563 | } |
| 560 | dma_rmb(); | 564 | dma_rmb(); |
| 561 | count++; | 565 | count++; |
| 566 | desc_count++; | ||
| 562 | } | 567 | } |
| 563 | if (is_rx_desc(raw_desc)) | 568 | if (is_rx_desc(raw_desc)) { |
| 564 | ret = xgene_enet_rx_frame(ring, raw_desc); | 569 | ret = xgene_enet_rx_frame(ring, raw_desc); |
| 565 | else | 570 | } else { |
| 566 | ret = xgene_enet_tx_completion(ring, raw_desc); | 571 | ret = xgene_enet_tx_completion(ring, raw_desc); |
| 572 | is_completion = true; | ||
| 573 | } | ||
| 567 | xgene_enet_mark_desc_slot_empty(raw_desc); | 574 | xgene_enet_mark_desc_slot_empty(raw_desc); |
| 568 | if (exp_desc) | 575 | if (exp_desc) |
| 569 | xgene_enet_mark_desc_slot_empty(exp_desc); | 576 | xgene_enet_mark_desc_slot_empty(exp_desc); |
| 570 | 577 | ||
| 571 | head = (head + 1) & slots; | 578 | head = (head + 1) & slots; |
| 572 | count++; | 579 | count++; |
| 580 | desc_count++; | ||
| 573 | processed++; | 581 | processed++; |
| 582 | if (is_completion) | ||
| 583 | pdata->txc_level += desc_count; | ||
| 574 | 584 | ||
| 575 | if (ret) | 585 | if (ret) |
| 576 | break; | 586 | break; |
| @@ -580,10 +590,8 @@ static int xgene_enet_process_ring(struct xgene_enet_desc_ring *ring, · 3 unmodified lines | |||
| 580 | pdata->ring_ops->wr_cmd(ring, -count); | 590 | pdata->ring_ops->wr_cmd(ring, -count); |
| 581 | ring->head = head; | 591 | ring->head = head; |
| 582 | 592 | ||
| 583 | if (netif_queue_stopped(ring->ndev)) { | 593 | if (netif_queue_stopped(ring->ndev)) |
| 584 | if (pdata->ring_ops->len(ring) < pdata->cp_qcnt_low) | 594 | netif_start_queue(ring->ndev); |
| 585 | netif_wake_queue(ring->ndev); | ||
| 586 | } | ||
| 587 | } | 595 | } |
| 588 | 596 | ||
| 589 | return processed; | 597 | return processed; |
| @@ -1033,9 +1041,7 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev) · 443 unmodified lines | |||
| 1033 | pdata->tx_ring->cp_ring = cp_ring; | 1041 | pdata->tx_ring->cp_ring = cp_ring; |
| 1034 | pdata->tx_ring->dst_ring_num = xgene_enet_dst_ring_num(cp_ring); | 1042 | pdata->tx_ring->dst_ring_num = xgene_enet_dst_ring_num(cp_ring); |
| 1035 | 1043 | ||
| 1036 | pdata->tx_qcnt_hi = pdata->tx_ring->slots / 2; | 1044 | pdata->tx_qcnt_hi = pdata->tx_ring->slots - 128; |
| 1037 | pdata->cp_qcnt_hi = pdata->rx_ring->slots / 2; | ||
| 1038 | pdata->cp_qcnt_low = pdata->cp_qcnt_hi / 2; | ||
| 1039 | 1045 | ||
| 1040 | return 0; | 1046 | return 0; |
| 1041 | 1047 | ||
| @@ -155,11 +155,11 @@ struct xgene_enet_pdata { · 154 unmodified lines | |||
| 155 | enum xgene_enet_id enet_id; | 155 | enum xgene_enet_id enet_id; |
| 156 | struct xgene_enet_desc_ring *tx_ring; | 156 | struct xgene_enet_desc_ring *tx_ring; |
| 157 | struct xgene_enet_desc_ring *rx_ring; | 157 | struct xgene_enet_desc_ring *rx_ring; |
| 158 | u16 tx_level; | ||
| 159 | u16 txc_level; | ||
| 158 | char *dev_name; | 160 | char *dev_name; |
| 159 | u32 rx_buff_cnt; | 161 | u32 rx_buff_cnt; |
| 160 | u32 tx_qcnt_hi; | 162 | u32 tx_qcnt_hi; |
| 161 | u32 cp_qcnt_hi; | ||
| 162 | u32 cp_qcnt_low; | ||
| 163 | u32 rx_irq; | 163 | u32 rx_irq; |
| 164 | u32 txc_irq; | 164 | u32 txc_irq; |
| 165 | u8 cq_cnt; | 165 | u8 cq_cnt; |
| @@ -1016,13 +1016,12 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter) · 1015 unmodified lines | |||
| 1016 | sizeof(struct atl1c_recv_ret_status) * rx_desc_count + | 1016 | sizeof(struct atl1c_recv_ret_status) * rx_desc_count + |
| 1017 | 8 * 4; | 1017 | 8 * 4; |
| 1018 | 1018 | ||
| 1019 | ring_header->desc = pci_alloc_consistent(pdev, ring_header->size, | 1019 | ring_header->desc = dma_zalloc_coherent(&pdev->dev, ring_header->size, |
| 1020 | &ring_header->dma); | 1020 | &ring_header->dma, GFP_KERNEL); |
| 1021 | if (unlikely(!ring_header->desc)) { | 1021 | if (unlikely(!ring_header->desc)) { |
| 1022 | dev_err(&pdev->dev, "pci_alloc_consistend failed\n"); | 1022 | dev_err(&pdev->dev, "could not get memory for DMA buffer\n"); |
| 1023 | goto err_nomem; | 1023 | goto err_nomem; |
| 1024 | } | 1024 | } |
| 1025 | memset(ring_header->desc, 0, ring_header->size); | ||
| 1026 | /* init TPD ring */ | 1025 | /* init TPD ring */ |
| 1027 | 1026 | ||
| 1028 | tpd_ring[0].dma = roundup(ring_header->dma, 8); | 1027 | tpd_ring[0].dma = roundup(ring_header->dma, 8); |
| @@ -13,6 +13,7 @@ if NET_VENDOR_AURORA · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | config AURORA_NB8800 | 14 | config AURORA_NB8800 |
| 15 | tristate "Aurora AU-NB8800 support" | 15 | tristate "Aurora AU-NB8800 support" |
| 16 | depends on HAS_DMA | ||
| 16 | select PHYLIB | 17 | select PHYLIB |
| 17 | help | 18 | help |
| 18 | Support for the AU-NB8800 gigabit Ethernet controller. | 19 | Support for the AU-NB8800 gigabit Ethernet controller. |
| @@ -2693,17 +2693,16 @@ static int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp) · 2692 unmodified lines | |||
| 2693 | req.ver_upd = DRV_VER_UPD; | 2693 | req.ver_upd = DRV_VER_UPD; |
| 2694 | 2694 | ||
| 2695 | if (BNXT_PF(bp)) { | 2695 | if (BNXT_PF(bp)) { |
| 2696 | unsigned long vf_req_snif_bmap[4]; | 2696 | DECLARE_BITMAP(vf_req_snif_bmap, 256); |
| 2697 | u32 *data = (u32 *)vf_req_snif_bmap; | 2697 | u32 *data = (u32 *)vf_req_snif_bmap; |
| 2698 | 2698 | ||
| 2699 | memset(vf_req_snif_bmap, 0, 32); | 2699 | memset(vf_req_snif_bmap, 0, sizeof(vf_req_snif_bmap)); |
| 2700 | for (i = 0; i < ARRAY_SIZE(bnxt_vf_req_snif); i++) | 2700 | for (i = 0; i < ARRAY_SIZE(bnxt_vf_req_snif); i++) |
| 2701 | __set_bit(bnxt_vf_req_snif[i], vf_req_snif_bmap); | 2701 | __set_bit(bnxt_vf_req_snif[i], vf_req_snif_bmap); |
| 2702 | 2702 | ||
| 2703 | for (i = 0; i < 8; i++) { | 2703 | for (i = 0; i < 8; i++) |
| 2704 | req.vf_req_fwd[i] = cpu_to_le32(*data); | 2704 | req.vf_req_fwd[i] = cpu_to_le32(data[i]); |
| 2705 | data++; | 2705 | |
| 2706 | } | ||
| 2707 | req.enables |= | 2706 | req.enables |= |
| 2708 | cpu_to_le32(FUNC_DRV_RGTR_REQ_ENABLES_VF_REQ_FWD); | 2707 | cpu_to_le32(FUNC_DRV_RGTR_REQ_ENABLES_VF_REQ_FWD); |
| 2709 | } | 2708 | } |
| @@ -4603,7 +4602,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) · 1893 unmodified lines | |||
| 4603 | bp->nge_port_cnt = 1; | 4602 | bp->nge_port_cnt = 1; |
| 4604 | } | 4603 | } |
| 4605 | 4604 | ||
| 4606 | bp->state = BNXT_STATE_OPEN; | 4605 | set_bit(BNXT_STATE_OPEN, &bp->state); |
| 4607 | bnxt_enable_int(bp); | 4606 | bnxt_enable_int(bp); |
| 4608 | /* Enable TX queues */ | 4607 | /* Enable TX queues */ |
| 4609 | bnxt_tx_enable(bp); | 4608 | bnxt_tx_enable(bp); |
| @@ -4679,8 +4678,10 @@ int bnxt_close_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) · 69 unmodified lines | |||
| 4679 | /* Change device state to avoid TX queue wake up's */ | 4678 | /* Change device state to avoid TX queue wake up's */ |
| 4680 | bnxt_tx_disable(bp); | 4679 | bnxt_tx_disable(bp); |
| 4681 | 4680 | ||
| 4682 | bp->state = BNXT_STATE_CLOSED; | 4681 | clear_bit(BNXT_STATE_OPEN, &bp->state); |
| 4683 | cancel_work_sync(&bp->sp_task); | 4682 | smp_mb__after_atomic(); |
| 4683 | while (test_bit(BNXT_STATE_IN_SP_TASK, &bp->state)) | ||
| 4684 | msleep(20); | ||
| 4684 | 4685 | ||
| 4685 | /* Flush rings before disabling interrupts */ | 4686 | /* Flush rings before disabling interrupts */ |
| 4686 | bnxt_shutdown_nic(bp, irq_re_init); | 4687 | bnxt_shutdown_nic(bp, irq_re_init); |
| @@ -5030,8 +5031,10 @@ static void bnxt_dbg_dump_states(struct bnxt *bp) · 343 unmodified lines | |||
| 5030 | static void bnxt_reset_task(struct bnxt *bp) | 5031 | static void bnxt_reset_task(struct bnxt *bp) |
| 5031 | { | 5032 | { |
| 5032 | bnxt_dbg_dump_states(bp); | 5033 | bnxt_dbg_dump_states(bp); |
| 5033 | if (netif_running(bp->dev)) | 5034 | if (netif_running(bp->dev)) { |
| 5034 | bnxt_tx_disable(bp); /* prevent tx timout again */ | 5035 | bnxt_close_nic(bp, false, false); |
| 5036 | bnxt_open_nic(bp, false, false); | ||
| 5037 | } | ||
| 5035 | } | 5038 | } |
| 5036 | 5039 | ||
| 5037 | static void bnxt_tx_timeout(struct net_device *dev) | 5040 | static void bnxt_tx_timeout(struct net_device *dev) |
| @@ -5081,8 +5084,12 @@ static void bnxt_sp_task(struct work_struct *work) · 43 unmodified lines | |||
| 5081 | struct bnxt *bp = container_of(work, struct bnxt, sp_task); | 5084 | struct bnxt *bp = container_of(work, struct bnxt, sp_task); |
| 5082 | int rc; | 5085 | int rc; |
| 5083 | 5086 | ||
| 5084 | if (bp->state != BNXT_STATE_OPEN) | 5087 | set_bit(BNXT_STATE_IN_SP_TASK, &bp->state); |
| 5088 | smp_mb__after_atomic(); | ||
| 5089 | if (!test_bit(BNXT_STATE_OPEN, &bp->state)) { | ||
| 5090 | clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state); | ||
| 5085 | return; | 5091 | return; |
| 5092 | } | ||
| 5086 | 5093 | ||
| 5087 | if (test_and_clear_bit(BNXT_RX_MASK_SP_EVENT, &bp->sp_event)) | 5094 | if (test_and_clear_bit(BNXT_RX_MASK_SP_EVENT, &bp->sp_event)) |
| 5088 | bnxt_cfg_rx_mode(bp); | 5095 | bnxt_cfg_rx_mode(bp); |
| @@ -5106,8 +5113,19 @@ static void bnxt_sp_task(struct work_struct *work) · 17 unmodified lines | |||
| 5106 | bnxt_hwrm_tunnel_dst_port_free( | 5113 | bnxt_hwrm_tunnel_dst_port_free( |
| 5107 | bp, TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN); | 5114 | bp, TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN); |
| 5108 | } | 5115 | } |
| 5109 | if (test_and_clear_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event)) | 5116 | if (test_and_clear_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event)) { |
| 5117 | /* bnxt_reset_task() calls bnxt_close_nic() which waits | ||
| 5118 | * for BNXT_STATE_IN_SP_TASK to clear. | ||
| 5119 | */ | ||
| 5120 | clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state); | ||
| 5121 | rtnl_lock(); | ||
| 5110 | bnxt_reset_task(bp); | 5122 | bnxt_reset_task(bp); |
| 5123 | set_bit(BNXT_STATE_IN_SP_TASK, &bp->state); | ||
| 5124 | rtnl_unlock(); | ||
| 5125 | } | ||
| 5126 | |||
| 5127 | smp_mb__before_atomic(); | ||
| 5128 | clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state); | ||
| 5111 | } | 5129 | } |
| 5112 | 5130 | ||
| 5113 | static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev) | 5131 | static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev) |
| @@ -5186,7 +5204,7 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev) · 72 unmodified lines | |||
| 5186 | bp->timer.function = bnxt_timer; | 5204 | bp->timer.function = bnxt_timer; |
| 5187 | bp->current_interval = BNXT_TIMER_INTERVAL; | 5205 | bp->current_interval = BNXT_TIMER_INTERVAL; |
| 5188 | 5206 | ||
| 5189 | bp->state = BNXT_STATE_CLOSED; | 5207 | clear_bit(BNXT_STATE_OPEN, &bp->state); |
| 5190 | 5208 | ||
| 5191 | return 0; | 5209 | return 0; |
| 5192 | 5210 | ||
| @@ -925,9 +925,9 @@ struct bnxt { · 924 unmodified lines | |||
| 925 | 925 | ||
| 926 | struct timer_list timer; | 926 | struct timer_list timer; |
| 927 | 927 | ||
| 928 | int state; | 928 | unsigned long state; |
| 929 | #define BNXT_STATE_CLOSED 0 | 929 | #define BNXT_STATE_OPEN 0 |
| 930 | #define BNXT_STATE_OPEN 1 | 930 | #define BNXT_STATE_IN_SP_TASK 1 |
| 931 | 931 | ||
| 932 | struct bnxt_irq *irq_tbl; | 932 | struct bnxt_irq *irq_tbl; |
| 933 | u8 mac_addr[ETH_ALEN]; | 933 | u8 mac_addr[ETH_ALEN]; |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | #ifdef CONFIG_BNXT_SRIOV | 21 | #ifdef CONFIG_BNXT_SRIOV |
| 22 | static int bnxt_vf_ndo_prep(struct bnxt *bp, int vf_id) | 22 | static int bnxt_vf_ndo_prep(struct bnxt *bp, int vf_id) |
| 23 | { | 23 | { |
| 24 | if (bp->state != BNXT_STATE_OPEN) { | 24 | if (!test_bit(BNXT_STATE_OPEN, &bp->state)) { |
| 25 | netdev_err(bp->dev, "vf ndo called though PF is down\n"); | 25 | netdev_err(bp->dev, "vf ndo called though PF is down\n"); |
| 26 | return -EINVAL; | 26 | return -EINVAL; |
| 27 | } | 27 | } |
| @@ -37,7 +37,6 @@ struct nicpf { · 36 unmodified lines | |||
| 37 | #define NIC_GET_BGX_FROM_VF_LMAC_MAP(map) ((map >> 4) & 0xF) | 37 | #define NIC_GET_BGX_FROM_VF_LMAC_MAP(map) ((map >> 4) & 0xF) |
| 38 | #define NIC_GET_LMAC_FROM_VF_LMAC_MAP(map) (map & 0xF) | 38 | #define NIC_GET_LMAC_FROM_VF_LMAC_MAP(map) (map & 0xF) |
| 39 | u8 vf_lmac_map[MAX_LMAC]; | 39 | u8 vf_lmac_map[MAX_LMAC]; |
| 40 | u8 lmac_cnt; | ||
| 41 | struct delayed_work dwork; | 40 | struct delayed_work dwork; |
| 42 | struct workqueue_struct *check_link; | 41 | struct workqueue_struct *check_link; |
| 43 | u8 link[MAX_LMAC]; | 42 | u8 link[MAX_LMAC]; |
| @@ -280,7 +279,6 @@ static void nic_set_lmac_vf_mapping(struct nicpf *nic) · 236 unmodified lines | |||
| 280 | u64 lmac_credit; | 279 | u64 lmac_credit; |
| 281 | 280 | ||
| 282 | nic->num_vf_en = 0; | 281 | nic->num_vf_en = 0; |
| 283 | nic->lmac_cnt = 0; | ||
| 284 | 282 | ||
| 285 | for (bgx = 0; bgx < NIC_MAX_BGX; bgx++) { | 283 | for (bgx = 0; bgx < NIC_MAX_BGX; bgx++) { |
| 286 | if (!(bgx_map & (1 << bgx))) | 284 | if (!(bgx_map & (1 << bgx))) |
| @@ -290,7 +288,6 @@ static void nic_set_lmac_vf_mapping(struct nicpf *nic) · 3 unmodified lines | |||
| 290 | nic->vf_lmac_map[next_bgx_lmac++] = | 288 | nic->vf_lmac_map[next_bgx_lmac++] = |
| 291 | NIC_SET_VF_LMAC_MAP(bgx, lmac); | 289 | NIC_SET_VF_LMAC_MAP(bgx, lmac); |
| 292 | nic->num_vf_en += lmac_cnt; | 290 | nic->num_vf_en += lmac_cnt; |
| 293 | nic->lmac_cnt += lmac_cnt; | ||
| 294 | 291 | ||
| 295 | /* Program LMAC credits */ | 292 | /* Program LMAC credits */ |
| 296 | lmac_credit = (1ull << 1); /* channel credit enable */ | 293 | lmac_credit = (1ull << 1); /* channel credit enable */ |
| @@ -618,6 +615,21 @@ static int nic_config_loopback(struct nicpf *nic, struct set_loopback *lbk) · 321 unmodified lines | |||
| 618 | return 0; | 615 | return 0; |
| 619 | } | 616 | } |
| 620 | 617 | ||
| 618 | static void nic_enable_vf(struct nicpf *nic, int vf, bool enable) | ||
| 619 | { | ||
| 620 | int bgx, lmac; | ||
| 621 | |||
| 622 | nic->vf_enabled[vf] = enable; | ||
| 623 | |||
| 624 | if (vf >= nic->num_vf_en) | ||
| 625 | return; | ||
| 626 | |||
| 627 | bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); | ||
| 628 | lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); | ||
| 629 | |||
| 630 | bgx_lmac_rx_tx_enable(nic->node, bgx, lmac, enable); | ||
| 631 | } | ||
| 632 | |||
| 621 | /* Interrupt handler to handle mailbox messages from VFs */ | 633 | /* Interrupt handler to handle mailbox messages from VFs */ |
| 622 | static void nic_handle_mbx_intr(struct nicpf *nic, int vf) | 634 | static void nic_handle_mbx_intr(struct nicpf *nic, int vf) |
| 623 | { | 635 | { |
| @@ -717,29 +729,14 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf) · 93 unmodified lines | |||
| 717 | break; | 729 | break; |
| 718 | case NIC_MBOX_MSG_CFG_DONE: | 730 | case NIC_MBOX_MSG_CFG_DONE: |
| 719 | /* Last message of VF config msg sequence */ | 731 | /* Last message of VF config msg sequence */ |
| 720 | nic->vf_enabled[vf] = true; | 732 | nic_enable_vf(nic, vf, true); |
| 721 | if (vf >= nic->lmac_cnt) | ||
| 722 | goto unlock; | ||
| 723 | |||
| 724 | bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); | ||
| 725 | lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); | ||
| 726 | |||
| 727 | bgx_lmac_rx_tx_enable(nic->node, bgx, lmac, true); | ||
| 728 | goto unlock; | 733 | goto unlock; |
| 729 | case NIC_MBOX_MSG_SHUTDOWN: | 734 | case NIC_MBOX_MSG_SHUTDOWN: |
| 730 | /* First msg in VF teardown sequence */ | 735 | /* First msg in VF teardown sequence */ |
| 731 | nic->vf_enabled[vf] = false; | ||
| 732 | if (vf >= nic->num_vf_en) | 736 | if (vf >= nic->num_vf_en) |
| 733 | nic->sqs_used[vf - nic->num_vf_en] = false; | 737 | nic->sqs_used[vf - nic->num_vf_en] = false; |
| 734 | nic->pqs_vf[vf] = 0; | 738 | nic->pqs_vf[vf] = 0; |
| 735 | 739 | nic_enable_vf(nic, vf, false); | |
| 736 | if (vf >= nic->lmac_cnt) | ||
| 737 | break; | ||
| 738 | |||
| 739 | bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); | ||
| 740 | lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); | ||
| 741 | |||
| 742 | bgx_lmac_rx_tx_enable(nic->node, bgx, lmac, false); | ||
| 743 | break; | 740 | break; |
| 744 | case NIC_MBOX_MSG_ALLOC_SQS: | 741 | case NIC_MBOX_MSG_ALLOC_SQS: |
| 745 | nic_alloc_sqs(nic, &mbx.sqs_alloc); | 742 | nic_alloc_sqs(nic, &mbx.sqs_alloc); |
| @@ -958,7 +955,7 @@ static void nic_poll_for_link(struct work_struct *work) · 212 unmodified lines | |||
| 958 | 955 | ||
| 959 | mbx.link_status.msg = NIC_MBOX_MSG_BGX_LINK_CHANGE; | 956 | mbx.link_status.msg = NIC_MBOX_MSG_BGX_LINK_CHANGE; |
| 960 | 957 | ||
| 961 | for (vf = 0; vf < nic->lmac_cnt; vf++) { | 958 | for (vf = 0; vf < nic->num_vf_en; vf++) { |
| 962 | /* Poll only if VF is UP */ | 959 | /* Poll only if VF is UP */ |
| 963 | if (!nic->vf_enabled[vf]) | 960 | if (!nic->vf_enabled[vf]) |
| 964 | continue; | 961 | continue; |
| @@ -48,21 +48,15 @@ static void nps_enet_read_rx_fifo(struct net_device *ndev, · 47 unmodified lines | |||
| 48 | *reg = nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF); | 48 | *reg = nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF); |
| 49 | else { /* !dst_is_aligned */ | 49 | else { /* !dst_is_aligned */ |
| 50 | for (i = 0; i < len; i++, reg++) { | 50 | for (i = 0; i < len; i++, reg++) { |
| 51 | u32 buf = | 51 | u32 buf = nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF); |
| 52 | nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF); | 52 | put_unaligned(buf, reg); |
| 53 | |||
| 54 | /* to accommodate word-unaligned address of "reg" | ||
| 55 | * we have to do memcpy_toio() instead of simple "=". | ||
| 56 | */ | ||
| 57 | memcpy_toio((void __iomem *)reg, &buf, sizeof(buf)); | ||
| 58 | } | 53 | } |
| 59 | } | 54 | } |
| 60 | 55 | ||
| 61 | /* copy last bytes (if any) */ | 56 | /* copy last bytes (if any) */ |
| 62 | if (last) { | 57 | if (last) { |
| 63 | u32 buf = nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF); | 58 | u32 buf = nps_enet_reg_get(priv, NPS_ENET_REG_RX_BUF); |
| 64 | 59 | memcpy((u8*)reg, &buf, last); | |
| 65 | memcpy_toio((void __iomem *)reg, &buf, last); | ||
| 66 | } | 60 | } |
| 67 | } | 61 | } |
| 68 | 62 | ||
| @@ -367,7 +361,7 @@ static void nps_enet_send_frame(struct net_device *ndev, · 298 unmodified lines | |||
| 367 | struct nps_enet_tx_ctl tx_ctrl; | 361 | struct nps_enet_tx_ctl tx_ctrl; |
| 368 | short length = skb->len; | 362 | short length = skb->len; |
| 369 | u32 i, len = DIV_ROUND_UP(length, sizeof(u32)); | 363 | u32 i, len = DIV_ROUND_UP(length, sizeof(u32)); |
| 370 | u32 *src = (u32 *)virt_to_phys(skb->data); | 364 | u32 *src = (void *)skb->data; |
| 371 | bool src_is_aligned = IS_ALIGNED((unsigned long)src, sizeof(u32)); | 365 | bool src_is_aligned = IS_ALIGNED((unsigned long)src, sizeof(u32)); |
| 372 | 366 | ||
| 373 | tx_ctrl.value = 0; | 367 | tx_ctrl.value = 0; |
| @@ -375,17 +369,11 @@ static void nps_enet_send_frame(struct net_device *ndev, · 1 unmodified line | |||
| 375 | if (src_is_aligned) | 369 | if (src_is_aligned) |
| 376 | for (i = 0; i < len; i++, src++) | 370 | for (i = 0; i < len; i++, src++) |
| 377 | nps_enet_reg_set(priv, NPS_ENET_REG_TX_BUF, *src); | 371 | nps_enet_reg_set(priv, NPS_ENET_REG_TX_BUF, *src); |
| 378 | else { /* !src_is_aligned */ | 372 | else /* !src_is_aligned */ |
| 379 | for (i = 0; i < len; i++, src++) { | 373 | for (i = 0; i < len; i++, src++) |
| 380 | u32 buf; | 374 | nps_enet_reg_set(priv, NPS_ENET_REG_TX_BUF, |
| 381 | 375 | get_unaligned(src)); | |
| 382 | /* to accommodate word-unaligned address of "src" | 376 | |
| 383 | * we have to do memcpy_fromio() instead of simple "=" | ||
| 384 | */ | ||
| 385 | memcpy_fromio(&buf, (void __iomem *)src, sizeof(buf)); | ||
| 386 | nps_enet_reg_set(priv, NPS_ENET_REG_TX_BUF, buf); | ||
| 387 | } | ||
| 388 | } | ||
| 389 | /* Write the length of the Frame */ | 377 | /* Write the length of the Frame */ |
| 390 | tx_ctrl.nt = length; | 378 | tx_ctrl.nt = length; |
| 391 | 379 | ||
| @@ -552,7 +552,7 @@ static void tx_restart(struct net_device *dev) · 551 unmodified lines | |||
| 552 | cbd_t __iomem *prev_bd; | 552 | cbd_t __iomem *prev_bd; |
| 553 | cbd_t __iomem *last_tx_bd; | 553 | cbd_t __iomem *last_tx_bd; |
| 554 | 554 | ||
| 555 | last_tx_bd = fep->tx_bd_base + (fpi->tx_ring * sizeof(cbd_t)); | 555 | last_tx_bd = fep->tx_bd_base + ((fpi->tx_ring - 1) * sizeof(cbd_t)); |
| 556 | 556 | ||
| 557 | /* get the current bd held in TBPTR and scan back from this point */ | 557 | /* get the current bd held in TBPTR and scan back from this point */ |
| 558 | recheck_bd = curr_tbptr = (cbd_t __iomem *) | 558 | recheck_bd = curr_tbptr = (cbd_t __iomem *) |
| @@ -464,7 +464,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) · 463 unmodified lines | |||
| 464 | * address). Print error message but continue anyway. | 464 | * address). Print error message but continue anyway. |
| 465 | */ | 465 | */ |
| 466 | if ((void *)tbipa > priv->map + resource_size(&res) - 4) | 466 | if ((void *)tbipa > priv->map + resource_size(&res) - 4) |
| 467 | dev_err(&pdev->dev, "invalid register map (should be at least 0x%04x to contain TBI address)\n", | 467 | dev_err(&pdev->dev, "invalid register map (should be at least 0x%04zx to contain TBI address)\n", |
| 468 | ((void *)tbipa - priv->map) + 4); | 468 | ((void *)tbipa - priv->map) + 4); |
| 469 | 469 | ||
| 470 | iowrite32be(be32_to_cpup(prop), tbipa); | 470 | iowrite32be(be32_to_cpup(prop), tbipa); |
| @@ -894,7 +894,8 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) · 893 unmodified lines | |||
| 894 | FSL_GIANFAR_DEV_HAS_VLAN | | 894 | FSL_GIANFAR_DEV_HAS_VLAN | |
| 895 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | | 895 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | |
| 896 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH | | 896 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH | |
| 897 | FSL_GIANFAR_DEV_HAS_TIMER; | 897 | FSL_GIANFAR_DEV_HAS_TIMER | |
| 898 | FSL_GIANFAR_DEV_HAS_RX_FILER; | ||
| 898 | 899 | ||
| 899 | err = of_property_read_string(np, "phy-connection-type", &ctype); | 900 | err = of_property_read_string(np, "phy-connection-type", &ctype); |
| 900 | 901 | ||
| @@ -1396,8 +1397,9 @@ static int gfar_probe(struct platform_device *ofdev) · 495 unmodified lines | |||
| 1396 | priv->rx_queue[i]->rxic = DEFAULT_RXIC; | 1397 | priv->rx_queue[i]->rxic = DEFAULT_RXIC; |
| 1397 | } | 1398 | } |
| 1398 | 1399 | ||
| 1399 | /* always enable rx filer */ | 1400 | /* Always enable rx filer if available */ |
| 1400 | priv->rx_filer_enable = 1; | 1401 | priv->rx_filer_enable = |
| 1402 | (priv->device_flags & FSL_GIANFAR_DEV_HAS_RX_FILER) ? 1 : 0; | ||
| 1401 | /* Enable most messages by default */ | 1403 | /* Enable most messages by default */ |
| 1402 | priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; | 1404 | priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; |
| 1403 | /* use pritority h/w tx queue scheduling for single queue devices */ | 1405 | /* use pritority h/w tx queue scheduling for single queue devices */ |
| @@ -923,6 +923,7 @@ struct gfar { · 922 unmodified lines | |||
| 923 | #define FSL_GIANFAR_DEV_HAS_BUF_STASHING 0x00000400 | 923 | #define FSL_GIANFAR_DEV_HAS_BUF_STASHING 0x00000400 |
| 924 | #define FSL_GIANFAR_DEV_HAS_TIMER 0x00000800 | 924 | #define FSL_GIANFAR_DEV_HAS_TIMER 0x00000800 |
| 925 | #define FSL_GIANFAR_DEV_HAS_WAKE_ON_FILER 0x00001000 | 925 | #define FSL_GIANFAR_DEV_HAS_WAKE_ON_FILER 0x00001000 |
| 926 | #define FSL_GIANFAR_DEV_HAS_RX_FILER 0x00002000 | ||
| 926 | 927 | ||
| 927 | #if (MAXGROUPS == 2) | 928 | #if (MAXGROUPS == 2) |
| 928 | #define DEFAULT_MAPPING 0xAA | 929 | #define DEFAULT_MAPPING 0xAA |
| @@ -1259,12 +1259,8 @@ int hns_dsaf_set_mac_uc_entry( · 1258 unmodified lines | |||
| 1259 | if (MAC_IS_ALL_ZEROS(mac_entry->addr) || | 1259 | if (MAC_IS_ALL_ZEROS(mac_entry->addr) || |
| 1260 | MAC_IS_BROADCAST(mac_entry->addr) || | 1260 | MAC_IS_BROADCAST(mac_entry->addr) || |
| 1261 | MAC_IS_MULTICAST(mac_entry->addr)) { | 1261 | MAC_IS_MULTICAST(mac_entry->addr)) { |
| 1262 | dev_err(dsaf_dev->dev, | 1262 | dev_err(dsaf_dev->dev, "set_uc %s Mac %pM err!\n", |
| 1263 | "set_uc %s Mac %02x:%02x:%02x:%02x:%02x:%02x err!\n", | 1263 | dsaf_dev->ae_dev.name, mac_entry->addr); |
| 1264 | dsaf_dev->ae_dev.name, mac_entry->addr[0], | ||
| 1265 | mac_entry->addr[1], mac_entry->addr[2], | ||
| 1266 | mac_entry->addr[3], mac_entry->addr[4], | ||
| 1267 | mac_entry->addr[5]); | ||
| 1268 | return -EINVAL; | 1264 | return -EINVAL; |
| 1269 | } | 1265 | } |
| 1270 | 1266 | ||
| @@ -1331,12 +1327,8 @@ int hns_dsaf_set_mac_mc_entry( · 60 unmodified lines | |||
| 1331 | 1327 | ||
| 1332 | /* mac addr check */ | 1328 | /* mac addr check */ |
| 1333 | if (MAC_IS_ALL_ZEROS(mac_entry->addr)) { | 1329 | if (MAC_IS_ALL_ZEROS(mac_entry->addr)) { |
| 1334 | dev_err(dsaf_dev->dev, | 1330 | dev_err(dsaf_dev->dev, "set uc %s Mac %pM err!\n", |
| 1335 | "set uc %s Mac %02x:%02x:%02x:%02x:%02x:%02x err!\n", | 1331 | dsaf_dev->ae_dev.name, mac_entry->addr); |
| 1336 | dsaf_dev->ae_dev.name, mac_entry->addr[0], | ||
| 1337 | mac_entry->addr[1], mac_entry->addr[2], | ||
| 1338 | mac_entry->addr[3], | ||
| 1339 | mac_entry->addr[4], mac_entry->addr[5]); | ||
| 1340 | return -EINVAL; | 1332 | return -EINVAL; |
| 1341 | } | 1333 | } |
| 1342 | 1334 | ||
| @@ -1410,11 +1402,8 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev, · 67 unmodified lines | |||
| 1410 | 1402 | ||
| 1411 | /*chechk mac addr */ | 1403 | /*chechk mac addr */ |
| 1412 | if (MAC_IS_ALL_ZEROS(mac_entry->addr)) { | 1404 | if (MAC_IS_ALL_ZEROS(mac_entry->addr)) { |
| 1413 | dev_err(dsaf_dev->dev, | 1405 | dev_err(dsaf_dev->dev, "set_entry failed,addr %pM!\n", |
| 1414 | "set_entry failed,addr %02x:%02x:%02x:%02x:%02x:%02x!\n", | 1406 | mac_entry->addr); |
| 1415 | mac_entry->addr[0], mac_entry->addr[1], | ||
| 1416 | mac_entry->addr[2], mac_entry->addr[3], | ||
| 1417 | mac_entry->addr[4], mac_entry->addr[5]); | ||
| 1418 | return -EINVAL; | 1407 | return -EINVAL; |
| 1419 | } | 1408 | } |
| 1420 | 1409 | ||
| @@ -1497,9 +1486,8 @@ int hns_dsaf_del_mac_entry(struct dsaf_device *dsaf_dev, u16 vlan_id, · 76 unmodified lines | |||
| 1497 | 1486 | ||
| 1498 | /*check mac addr */ | 1487 | /*check mac addr */ |
| 1499 | if (MAC_IS_ALL_ZEROS(addr) || MAC_IS_BROADCAST(addr)) { | 1488 | if (MAC_IS_ALL_ZEROS(addr) || MAC_IS_BROADCAST(addr)) { |
| 1500 | dev_err(dsaf_dev->dev, | 1489 | dev_err(dsaf_dev->dev, "del_entry failed,addr %pM!\n", |
| 1501 | "del_entry failed,addr %02x:%02x:%02x:%02x:%02x:%02x!\n", | 1490 | addr); |
| 1502 | addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); | ||
| 1503 | return -EINVAL; | 1491 | return -EINVAL; |
| 1504 | } | 1492 | } |
| 1505 | 1493 | ||
| @@ -1563,11 +1551,8 @@ int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev, · 57 unmodified lines | |||
| 1563 | 1551 | ||
| 1564 | /*check mac addr */ | 1552 | /*check mac addr */ |
| 1565 | if (MAC_IS_ALL_ZEROS(mac_entry->addr)) { | 1553 | if (MAC_IS_ALL_ZEROS(mac_entry->addr)) { |
| 1566 | dev_err(dsaf_dev->dev, | 1554 | dev_err(dsaf_dev->dev, "del_port failed, addr %pM!\n", |
| 1567 | "del_port failed, addr %02x:%02x:%02x:%02x:%02x:%02x!\n", | 1555 | mac_entry->addr); |
| 1568 | mac_entry->addr[0], mac_entry->addr[1], | ||
| 1569 | mac_entry->addr[2], mac_entry->addr[3], | ||
| 1570 | mac_entry->addr[4], mac_entry->addr[5]); | ||
| 1571 | return -EINVAL; | 1556 | return -EINVAL; |
| 1572 | } | 1557 | } |
| 1573 | 1558 | ||
| @@ -1644,11 +1629,8 @@ int hns_dsaf_get_mac_uc_entry(struct dsaf_device *dsaf_dev, · 70 unmodified lines | |||
| 1644 | /* check macaddr */ | 1629 | /* check macaddr */ |
| 1645 | if (MAC_IS_ALL_ZEROS(mac_entry->addr) || | 1630 | if (MAC_IS_ALL_ZEROS(mac_entry->addr) || |
| 1646 | MAC_IS_BROADCAST(mac_entry->addr)) { | 1631 | MAC_IS_BROADCAST(mac_entry->addr)) { |
| 1647 | dev_err(dsaf_dev->dev, | 1632 | dev_err(dsaf_dev->dev, "get_entry failed,addr %pM\n", |
| 1648 | "get_entry failed,addr %02x:%02x:%02x:%02x:%02x:%02x\n", | 1633 | mac_entry->addr); |
| 1649 | mac_entry->addr[0], mac_entry->addr[1], | ||
| 1650 | mac_entry->addr[2], mac_entry->addr[3], | ||
| 1651 | mac_entry->addr[4], mac_entry->addr[5]); | ||
| 1652 | return -EINVAL; | 1634 | return -EINVAL; |
| 1653 | } | 1635 | } |
| 1654 | 1636 | ||
| @@ -1695,11 +1677,8 @@ int hns_dsaf_get_mac_mc_entry(struct dsaf_device *dsaf_dev, · 40 unmodified lines | |||
| 1695 | /*check mac addr */ | 1677 | /*check mac addr */ |
| 1696 | if (MAC_IS_ALL_ZEROS(mac_entry->addr) || | 1678 | if (MAC_IS_ALL_ZEROS(mac_entry->addr) || |
| 1697 | MAC_IS_BROADCAST(mac_entry->addr)) { | 1679 | MAC_IS_BROADCAST(mac_entry->addr)) { |
| 1698 | dev_err(dsaf_dev->dev, | 1680 | dev_err(dsaf_dev->dev, "get_entry failed,addr %pM\n", |
| 1699 | "get_entry failed,addr %02x:%02x:%02x:%02x:%02x:%02x\n", | 1681 | mac_entry->addr); |
| 1700 | mac_entry->addr[0], mac_entry->addr[1], | ||
| 1701 | mac_entry->addr[2], mac_entry->addr[3], | ||
| 1702 | mac_entry->addr[4], mac_entry->addr[5]); | ||
| 1703 | return -EINVAL; | 1682 | return -EINVAL; |
| 1704 | } | 1683 | } |
| 1705 | 1684 | ||
| @@ -898,7 +898,7 @@ · 897 unmodified lines | |||
| 898 | #define XGMAC_PAUSE_CTL_RSP_MODE_B 2 | 898 | #define XGMAC_PAUSE_CTL_RSP_MODE_B 2 |
| 899 | #define XGMAC_PAUSE_CTL_TX_XOFF_B 3 | 899 | #define XGMAC_PAUSE_CTL_TX_XOFF_B 3 |
| 900 | 900 | ||
| 901 | static inline void dsaf_write_reg(void *base, u32 reg, u32 value) | 901 | static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value) |
| 902 | { | 902 | { |
| 903 | u8 __iomem *reg_addr = ACCESS_ONCE(base); | 903 | u8 __iomem *reg_addr = ACCESS_ONCE(base); |
| 904 | 904 | ||
| @@ -908,7 +908,7 @@ static inline void dsaf_write_reg(void *base, u32 reg, u32 value) · 3 unmodified lines | |||
| 908 | #define dsaf_write_dev(a, reg, value) \ | 908 | #define dsaf_write_dev(a, reg, value) \ |
| 909 | dsaf_write_reg((a)->io_base, (reg), (value)) | 909 | dsaf_write_reg((a)->io_base, (reg), (value)) |
| 910 | 910 | ||
| 911 | static inline u32 dsaf_read_reg(u8 *base, u32 reg) | 911 | static inline u32 dsaf_read_reg(u8 __iomem *base, u32 reg) |
| 912 | { | 912 | { |
| 913 | u8 __iomem *reg_addr = ACCESS_ONCE(base); | 913 | u8 __iomem *reg_addr = ACCESS_ONCE(base); |
| 914 | 914 | ||
| @@ -927,8 +927,8 @@ static inline u32 dsaf_read_reg(u8 *base, u32 reg) · 12 unmodified lines | |||
| 927 | #define dsaf_set_bit(origin, shift, val) \ | 927 | #define dsaf_set_bit(origin, shift, val) \ |
| 928 | dsaf_set_field((origin), (1ull << (shift)), (shift), (val)) | 928 | dsaf_set_field((origin), (1ull << (shift)), (shift), (val)) |
| 929 | 929 | ||
| 930 | static inline void dsaf_set_reg_field(void *base, u32 reg, u32 mask, u32 shift, | 930 | static inline void dsaf_set_reg_field(void __iomem *base, u32 reg, u32 mask, |
| 931 | u32 val) | 931 | u32 shift, u32 val) |
| 932 | { | 932 | { |
| 933 | u32 origin = dsaf_read_reg(base, reg); | 933 | u32 origin = dsaf_read_reg(base, reg); |
| 934 | 934 | ||
| @@ -947,7 +947,8 @@ static inline void dsaf_set_reg_field(void *base, u32 reg, u32 mask, u32 shift, · 12 unmodified lines | |||
| 947 | #define dsaf_get_bit(origin, shift) \ | 947 | #define dsaf_get_bit(origin, shift) \ |
| 948 | dsaf_get_field((origin), (1ull << (shift)), (shift)) | 948 | dsaf_get_field((origin), (1ull << (shift)), (shift)) |
| 949 | 949 | ||
| 950 | static inline u32 dsaf_get_reg_field(void *base, u32 reg, u32 mask, u32 shift) | 950 | static inline u32 dsaf_get_reg_field(void __iomem *base, u32 reg, u32 mask, |
| 951 | u32 shift) | ||
| 951 | { | 952 | { |
| 952 | u32 origin; | 953 | u32 origin; |
| 953 | 954 | ||
| @@ -567,10 +567,6 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw) · 566 unmodified lines | |||
| 567 | goto init_adminq_exit; | 567 | goto init_adminq_exit; |
| 568 | } | 568 | } |
| 569 | 569 | ||
| 570 | /* initialize locks */ | ||
| 571 | mutex_init(&hw->aq.asq_mutex); | ||
| 572 | mutex_init(&hw->aq.arq_mutex); | ||
| 573 | |||
| 574 | /* Set up register offsets */ | 570 | /* Set up register offsets */ |
| 575 | i40e_adminq_init_regs(hw); | 571 | i40e_adminq_init_regs(hw); |
| 576 | 572 | ||
| @@ -664,8 +660,6 @@ i40e_status i40e_shutdown_adminq(struct i40e_hw *hw) · 87 unmodified lines | |||
| 664 | i40e_shutdown_asq(hw); | 660 | i40e_shutdown_asq(hw); |
| 665 | i40e_shutdown_arq(hw); | 661 | i40e_shutdown_arq(hw); |
| 666 | 662 | ||
| 667 | /* destroy the locks */ | ||
| 668 | |||
| 669 | if (hw->nvm_buff.va) | 663 | if (hw->nvm_buff.va) |
| 670 | i40e_free_virt_mem(hw, &hw->nvm_buff); | 664 | i40e_free_virt_mem(hw, &hw->nvm_buff); |
| 671 | 665 | ||
| @@ -10295,6 +10295,12 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 10294 unmodified lines | |||
| 10295 | /* set up a default setting for link flow control */ | 10295 | /* set up a default setting for link flow control */ |
| 10296 | pf->hw.fc.requested_mode = I40E_FC_NONE; | 10296 | pf->hw.fc.requested_mode = I40E_FC_NONE; |
| 10297 | 10297 | ||
| 10298 | /* set up the locks for the AQ, do this only once in probe | ||
| 10299 | * and destroy them only once in remove | ||
| 10300 | */ | ||
| 10301 | mutex_init(&hw->aq.asq_mutex); | ||
| 10302 | mutex_init(&hw->aq.arq_mutex); | ||
| 10303 | |||
| 10298 | err = i40e_init_adminq(hw); | 10304 | err = i40e_init_adminq(hw); |
| 10299 | 10305 | ||
| 10300 | /* provide nvm, fw, api versions */ | 10306 | /* provide nvm, fw, api versions */ |
| @@ -10697,7 +10703,6 @@ static void i40e_remove(struct pci_dev *pdev) · 396 unmodified lines | |||
| 10697 | set_bit(__I40E_DOWN, &pf->state); | 10703 | set_bit(__I40E_DOWN, &pf->state); |
| 10698 | del_timer_sync(&pf->service_timer); | 10704 | del_timer_sync(&pf->service_timer); |
| 10699 | cancel_work_sync(&pf->service_task); | 10705 | cancel_work_sync(&pf->service_task); |
| 10700 | i40e_fdir_teardown(pf); | ||
| 10701 | 10706 | ||
| 10702 | if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { | 10707 | if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { |
| 10703 | i40e_free_vfs(pf); | 10708 | i40e_free_vfs(pf); |
| @@ -10740,6 +10745,10 @@ static void i40e_remove(struct pci_dev *pdev) · 36 unmodified lines | |||
| 10740 | "Failed to destroy the Admin Queue resources: %d\n", | 10745 | "Failed to destroy the Admin Queue resources: %d\n", |
| 10741 | ret_code); | 10746 | ret_code); |
| 10742 | 10747 | ||
| 10748 | /* destroy the locks only once, here */ | ||
| 10749 | mutex_destroy(&hw->aq.arq_mutex); | ||
| 10750 | mutex_destroy(&hw->aq.asq_mutex); | ||
| 10751 | |||
| 10743 | /* Clear all dynamic memory lists of rings, q_vectors, and VSIs */ | 10752 | /* Clear all dynamic memory lists of rings, q_vectors, and VSIs */ |
| 10744 | i40e_clear_interrupt_scheme(pf); | 10753 | i40e_clear_interrupt_scheme(pf); |
| 10745 | for (i = 0; i < pf->num_alloc_vsi; i++) { | 10754 | for (i = 0; i < pf->num_alloc_vsi; i++) { |
| @@ -551,10 +551,6 @@ i40e_status i40evf_init_adminq(struct i40e_hw *hw) · 550 unmodified lines | |||
| 551 | goto init_adminq_exit; | 551 | goto init_adminq_exit; |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | /* initialize locks */ | ||
| 555 | mutex_init(&hw->aq.asq_mutex); | ||
| 556 | mutex_init(&hw->aq.arq_mutex); | ||
| 557 | |||
| 558 | /* Set up register offsets */ | 554 | /* Set up register offsets */ |
| 559 | i40e_adminq_init_regs(hw); | 555 | i40e_adminq_init_regs(hw); |
| 560 | 556 | ||
| @@ -596,8 +592,6 @@ i40e_status i40evf_shutdown_adminq(struct i40e_hw *hw) · 35 unmodified lines | |||
| 596 | i40e_shutdown_asq(hw); | 592 | i40e_shutdown_asq(hw); |
| 597 | i40e_shutdown_arq(hw); | 593 | i40e_shutdown_arq(hw); |
| 598 | 594 | ||
| 599 | /* destroy the locks */ | ||
| 600 | |||
| 601 | if (hw->nvm_buff.va) | 595 | if (hw->nvm_buff.va) |
| 602 | i40e_free_virt_mem(hw, &hw->nvm_buff); | 596 | i40e_free_virt_mem(hw, &hw->nvm_buff); |
| 603 | 597 | ||
| @@ -2476,6 +2476,12 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 2475 unmodified lines | |||
| 2476 | hw->bus.device = PCI_SLOT(pdev->devfn); | 2476 | hw->bus.device = PCI_SLOT(pdev->devfn); |
| 2477 | hw->bus.func = PCI_FUNC(pdev->devfn); | 2477 | hw->bus.func = PCI_FUNC(pdev->devfn); |
| 2478 | 2478 | ||
| 2479 | /* set up the locks for the AQ, do this only once in probe | ||
| 2480 | * and destroy them only once in remove | ||
| 2481 | */ | ||
| 2482 | mutex_init(&hw->aq.asq_mutex); | ||
| 2483 | mutex_init(&hw->aq.arq_mutex); | ||
| 2484 | |||
| 2479 | INIT_LIST_HEAD(&adapter->mac_filter_list); | 2485 | INIT_LIST_HEAD(&adapter->mac_filter_list); |
| 2480 | INIT_LIST_HEAD(&adapter->vlan_filter_list); | 2486 | INIT_LIST_HEAD(&adapter->vlan_filter_list); |
| 2481 | 2487 | ||
| @@ -2629,6 +2635,10 @@ static void i40evf_remove(struct pci_dev *pdev) · 147 unmodified lines | |||
| 2629 | if (hw->aq.asq.count) | 2635 | if (hw->aq.asq.count) |
| 2630 | i40evf_shutdown_adminq(hw); | 2636 | i40evf_shutdown_adminq(hw); |
| 2631 | 2637 | ||
| 2638 | /* destroy the locks only once, here */ | ||
| 2639 | mutex_destroy(&hw->aq.arq_mutex); | ||
| 2640 | mutex_destroy(&hw->aq.asq_mutex); | ||
| 2641 | |||
| 2632 | iounmap(hw->hw_addr); | 2642 | iounmap(hw->hw_addr); |
| 2633 | pci_release_regions(pdev); | 2643 | pci_release_regions(pdev); |
| 2634 | 2644 | ||
| @@ -7920,6 +7920,9 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) · 7919 unmodified lines | |||
| 7920 | */ | 7920 | */ |
| 7921 | if (netif_running(dev)) | 7921 | if (netif_running(dev)) |
| 7922 | ixgbe_close(dev); | 7922 | ixgbe_close(dev); |
| 7923 | else | ||
| 7924 | ixgbe_reset(adapter); | ||
| 7925 | |||
| 7923 | ixgbe_clear_interrupt_scheme(adapter); | 7926 | ixgbe_clear_interrupt_scheme(adapter); |
| 7924 | 7927 | ||
| 7925 | #ifdef CONFIG_IXGBE_DCB | 7928 | #ifdef CONFIG_IXGBE_DCB |
| @@ -3413,16 +3413,23 @@ static void mvpp2_bm_pool_bufsize_set(struct mvpp2 *priv, · 3412 unmodified lines | |||
| 3413 | } | 3413 | } |
| 3414 | 3414 | ||
| 3415 | /* Free all buffers from the pool */ | 3415 | /* Free all buffers from the pool */ |
| 3416 | static void mvpp2_bm_bufs_free(struct mvpp2 *priv, struct mvpp2_bm_pool *bm_pool) | 3416 | static void mvpp2_bm_bufs_free(struct device *dev, struct mvpp2 *priv, |
| 3417 | struct mvpp2_bm_pool *bm_pool) | ||
| 3417 | { | 3418 | { |
| 3418 | int i; | 3419 | int i; |
| 3419 | 3420 | ||
| 3420 | for (i = 0; i < bm_pool->buf_num; i++) { | 3421 | for (i = 0; i < bm_pool->buf_num; i++) { |
| 3422 | dma_addr_t buf_phys_addr; | ||
| 3421 | u32 vaddr; | 3423 | u32 vaddr; |
| 3422 | 3424 | ||
| 3423 | /* Get buffer virtual address (indirect access) */ | 3425 | /* Get buffer virtual address (indirect access) */ |
| 3424 | mvpp2_read(priv, MVPP2_BM_PHY_ALLOC_REG(bm_pool->id)); | 3426 | buf_phys_addr = mvpp2_read(priv, |
| 3427 | MVPP2_BM_PHY_ALLOC_REG(bm_pool->id)); | ||
| 3425 | vaddr = mvpp2_read(priv, MVPP2_BM_VIRT_ALLOC_REG); | 3428 | vaddr = mvpp2_read(priv, MVPP2_BM_VIRT_ALLOC_REG); |
| 3429 | |||
| 3430 | dma_unmap_single(dev, buf_phys_addr, | ||
| 3431 | bm_pool->buf_size, DMA_FROM_DEVICE); | ||
| 3432 | |||
| 3426 | if (!vaddr) | 3433 | if (!vaddr) |
| 3427 | break; | 3434 | break; |
| 3428 | dev_kfree_skb_any((struct sk_buff *)vaddr); | 3435 | dev_kfree_skb_any((struct sk_buff *)vaddr); |
| @@ -3439,7 +3446,7 @@ static int mvpp2_bm_pool_destroy(struct platform_device *pdev, · 10 unmodified lines | |||
| 3439 | { | 3446 | { |
| 3440 | u32 val; | 3447 | u32 val; |
| 3441 | 3448 | ||
| 3442 | mvpp2_bm_bufs_free(priv, bm_pool); | 3449 | mvpp2_bm_bufs_free(&pdev->dev, priv, bm_pool); |
| 3443 | if (bm_pool->buf_num) { | 3450 | if (bm_pool->buf_num) { |
| 3444 | WARN(1, "cannot free all buffers in pool %d\n", bm_pool->id); | 3451 | WARN(1, "cannot free all buffers in pool %d\n", bm_pool->id); |
| 3445 | return 0; | 3452 | return 0; |
| @@ -3692,7 +3699,8 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, · 246 unmodified lines | |||
| 3692 | MVPP2_BM_LONG_BUF_NUM : | 3699 | MVPP2_BM_LONG_BUF_NUM : |
| 3693 | MVPP2_BM_SHORT_BUF_NUM; | 3700 | MVPP2_BM_SHORT_BUF_NUM; |
| 3694 | else | 3701 | else |
| 3695 | mvpp2_bm_bufs_free(port->priv, new_pool); | 3702 | mvpp2_bm_bufs_free(port->dev->dev.parent, |
| 3703 | port->priv, new_pool); | ||
| 3696 | 3704 | ||
| 3697 | new_pool->pkt_size = pkt_size; | 3705 | new_pool->pkt_size = pkt_size; |
| 3698 | 3706 | ||
| @@ -3756,7 +3764,7 @@ static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu) · 57 unmodified lines | |||
| 3756 | int pkt_size = MVPP2_RX_PKT_SIZE(mtu); | 3764 | int pkt_size = MVPP2_RX_PKT_SIZE(mtu); |
| 3757 | 3765 | ||
| 3758 | /* Update BM pool with new buffer size */ | 3766 | /* Update BM pool with new buffer size */ |
| 3759 | mvpp2_bm_bufs_free(port->priv, port_pool); | 3767 | mvpp2_bm_bufs_free(dev->dev.parent, port->priv, port_pool); |
| 3760 | if (port_pool->buf_num) { | 3768 | if (port_pool->buf_num) { |
| 3761 | WARN(1, "cannot free all buffers in pool %d\n", port_pool->id); | 3769 | WARN(1, "cannot free all buffers in pool %d\n", port_pool->id); |
| 3762 | return -EIO; | 3770 | return -EIO; |
| @@ -4401,11 +4409,10 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port, · 638 unmodified lines | |||
| 4401 | 4409 | ||
| 4402 | mvpp2_txq_inc_get(txq_pcpu); | 4410 | mvpp2_txq_inc_get(txq_pcpu); |
| 4403 | 4411 | ||
| 4404 | if (!skb) | ||
| 4405 | continue; | ||
| 4406 | |||
| 4407 | dma_unmap_single(port->dev->dev.parent, buf_phys_addr, | 4412 | dma_unmap_single(port->dev->dev.parent, buf_phys_addr, |
| 4408 | skb_headlen(skb), DMA_TO_DEVICE); | 4413 | skb_headlen(skb), DMA_TO_DEVICE); |
| 4414 | if (!skb) | ||
| 4415 | continue; | ||
| 4409 | dev_kfree_skb_any(skb); | 4416 | dev_kfree_skb_any(skb); |
| 4410 | } | 4417 | } |
| 4411 | } | 4418 | } |
| @@ -5092,7 +5099,8 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 680 unmodified lines | |||
| 5092 | struct mvpp2_rx_queue *rxq) | 5099 | struct mvpp2_rx_queue *rxq) |
| 5093 | { | 5100 | { |
| 5094 | struct net_device *dev = port->dev; | 5101 | struct net_device *dev = port->dev; |
| 5095 | int rx_received, rx_filled, i; | 5102 | int rx_received; |
| 5103 | int rx_done = 0; | ||
| 5096 | u32 rcvd_pkts = 0; | 5104 | u32 rcvd_pkts = 0; |
| 5097 | u32 rcvd_bytes = 0; | 5105 | u32 rcvd_bytes = 0; |
| 5098 | 5106 | ||
| @@ -5101,17 +5109,18 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 2 unmodified lines | |||
| 5101 | if (rx_todo > rx_received) | 5109 | if (rx_todo > rx_received) |
| 5102 | rx_todo = rx_received; | 5110 | rx_todo = rx_received; |
| 5103 | 5111 | ||
| 5104 | rx_filled = 0; | 5112 | while (rx_done < rx_todo) { |
| 5105 | for (i = 0; i < rx_todo; i++) { | ||
| 5106 | struct mvpp2_rx_desc *rx_desc = mvpp2_rxq_next_desc_get(rxq); | 5113 | struct mvpp2_rx_desc *rx_desc = mvpp2_rxq_next_desc_get(rxq); |
| 5107 | struct mvpp2_bm_pool *bm_pool; | 5114 | struct mvpp2_bm_pool *bm_pool; |
| 5108 | struct sk_buff *skb; | 5115 | struct sk_buff *skb; |
| 5116 | dma_addr_t phys_addr; | ||
| 5109 | u32 bm, rx_status; | 5117 | u32 bm, rx_status; |
| 5110 | int pool, rx_bytes, err; | 5118 | int pool, rx_bytes, err; |
| 5111 | 5119 | ||
| 5112 | rx_filled++; | 5120 | rx_done++; |
| 5113 | rx_status = rx_desc->status; | 5121 | rx_status = rx_desc->status; |
| 5114 | rx_bytes = rx_desc->data_size - MVPP2_MH_SIZE; | 5122 | rx_bytes = rx_desc->data_size - MVPP2_MH_SIZE; |
| 5123 | phys_addr = rx_desc->buf_phys_addr; | ||
| 5115 | 5124 | ||
| 5116 | bm = mvpp2_bm_cookie_build(rx_desc); | 5125 | bm = mvpp2_bm_cookie_build(rx_desc); |
| 5117 | pool = mvpp2_bm_cookie_pool_get(bm); | 5126 | pool = mvpp2_bm_cookie_pool_get(bm); |
| @@ -5128,8 +5137,10 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 10 unmodified lines | |||
| 5128 | * comprised by the RX descriptor. | 5137 | * comprised by the RX descriptor. |
| 5129 | */ | 5138 | */ |
| 5130 | if (rx_status & MVPP2_RXD_ERR_SUMMARY) { | 5139 | if (rx_status & MVPP2_RXD_ERR_SUMMARY) { |
| 5140 | err_drop_frame: | ||
| 5131 | dev->stats.rx_errors++; | 5141 | dev->stats.rx_errors++; |
| 5132 | mvpp2_rx_error(port, rx_desc); | 5142 | mvpp2_rx_error(port, rx_desc); |
| 5143 | /* Return the buffer to the pool */ | ||
| 5133 | mvpp2_pool_refill(port, bm, rx_desc->buf_phys_addr, | 5144 | mvpp2_pool_refill(port, bm, rx_desc->buf_phys_addr, |
| 5134 | rx_desc->buf_cookie); | 5145 | rx_desc->buf_cookie); |
| 5135 | continue; | 5146 | continue; |
| @@ -5137,6 +5148,15 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 1 unmodified line | |||
| 5137 | 5148 | ||
| 5138 | skb = (struct sk_buff *)rx_desc->buf_cookie; | 5149 | skb = (struct sk_buff *)rx_desc->buf_cookie; |
| 5139 | 5150 | ||
| 5151 | err = mvpp2_rx_refill(port, bm_pool, bm, 0); | ||
| 5152 | if (err) { | ||
| 5153 | netdev_err(port->dev, "failed to refill BM pools\n"); | ||
| 5154 | goto err_drop_frame; | ||
| 5155 | } | ||
| 5156 | |||
| 5157 | dma_unmap_single(dev->dev.parent, phys_addr, | ||
| 5158 | bm_pool->buf_size, DMA_FROM_DEVICE); | ||
| 5159 | |||
| 5140 | rcvd_pkts++; | 5160 | rcvd_pkts++; |
| 5141 | rcvd_bytes += rx_bytes; | 5161 | rcvd_bytes += rx_bytes; |
| 5142 | atomic_inc(&bm_pool->in_use); | 5162 | atomic_inc(&bm_pool->in_use); |
| @@ -5147,12 +5167,6 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 4 unmodified lines | |||
| 5147 | mvpp2_rx_csum(port, rx_status, skb); | 5167 | mvpp2_rx_csum(port, rx_status, skb); |
| 5148 | 5168 | ||
| 5149 | napi_gro_receive(&port->napi, skb); | 5169 | napi_gro_receive(&port->napi, skb); |
| 5150 | |||
| 5151 | err = mvpp2_rx_refill(port, bm_pool, bm, 0); | ||
| 5152 | if (err) { | ||
| 5153 | netdev_err(port->dev, "failed to refill BM pools\n"); | ||
| 5154 | rx_filled--; | ||
| 5155 | } | ||
| 5156 | } | 5170 | } |
| 5157 | 5171 | ||
| 5158 | if (rcvd_pkts) { | 5172 | if (rcvd_pkts) { |
| @@ -5166,7 +5180,7 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 7 unmodified lines | |||
| 5166 | 5180 | ||
| 5167 | /* Update Rx queue management counters */ | 5181 | /* Update Rx queue management counters */ |
| 5168 | wmb(); | 5182 | wmb(); |
| 5169 | mvpp2_rxq_status_update(port, rxq->id, rx_todo, rx_filled); | 5183 | mvpp2_rxq_status_update(port, rxq->id, rx_done, rx_done); |
| 5170 | 5184 | ||
| 5171 | return rx_todo; | 5185 | return rx_todo; |
| 5172 | } | 5186 | } |
| @@ -1010,7 +1010,7 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave, · 1009 unmodified lines | |||
| 1010 | if (!(smp->mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED && | 1010 | if (!(smp->mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED && |
| 1011 | smp->method == IB_MGMT_METHOD_GET) || network_view) { | 1011 | smp->method == IB_MGMT_METHOD_GET) || network_view) { |
| 1012 | mlx4_err(dev, "Unprivileged slave %d is trying to execute a Subnet MGMT MAD, class 0x%x, method 0x%x, view=%s for attr 0x%x. Rejecting\n", | 1012 | mlx4_err(dev, "Unprivileged slave %d is trying to execute a Subnet MGMT MAD, class 0x%x, method 0x%x, view=%s for attr 0x%x. Rejecting\n", |
| 1013 | slave, smp->method, smp->mgmt_class, | 1013 | slave, smp->mgmt_class, smp->method, |
| 1014 | network_view ? "Network" : "Host", | 1014 | network_view ? "Network" : "Host", |
| 1015 | be16_to_cpu(smp->attr_id)); | 1015 | be16_to_cpu(smp->attr_id)); |
| 1016 | return -EPERM; | 1016 | return -EPERM; |
| @@ -4306,9 +4306,10 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, · 4305 unmodified lines | |||
| 4306 | return -EOPNOTSUPP; | 4306 | return -EOPNOTSUPP; |
| 4307 | 4307 | ||
| 4308 | ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf; | 4308 | ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf; |
| 4309 | ctrl->port = mlx4_slave_convert_port(dev, slave, ctrl->port); | 4309 | err = mlx4_slave_convert_port(dev, slave, ctrl->port); |
| 4310 | if (ctrl->port <= 0) | 4310 | if (err <= 0) |
| 4311 | return -EINVAL; | 4311 | return -EINVAL; |
| 4312 | ctrl->port = err; | ||
| 4312 | qpn = be32_to_cpu(ctrl->qpn) & 0xffffff; | 4313 | qpn = be32_to_cpu(ctrl->qpn) & 0xffffff; |
| 4313 | err = get_res(dev, slave, qpn, RES_QP, &rqp); | 4314 | err = get_res(dev, slave, qpn, RES_QP, &rqp); |
| 4314 | if (err) { | 4315 | if (err) { |
| @@ -299,6 +299,7 @@ struct qed_hwfn { · 298 unmodified lines | |||
| 299 | 299 | ||
| 300 | /* Flag indicating whether interrupts are enabled or not*/ | 300 | /* Flag indicating whether interrupts are enabled or not*/ |
| 301 | bool b_int_enabled; | 301 | bool b_int_enabled; |
| 302 | bool b_int_requested; | ||
| 302 | 303 | ||
| 303 | struct qed_mcp_info *mcp_info; | 304 | struct qed_mcp_info *mcp_info; |
| 304 | 305 | ||
| @@ -491,6 +492,8 @@ u32 qed_unzip_data(struct qed_hwfn *p_hwfn, · 186 unmodified lines | |||
| 491 | u32 input_len, u8 *input_buf, | 492 | u32 input_len, u8 *input_buf, |
| 492 | u32 max_size, u8 *unzip_buf); | 493 | u32 max_size, u8 *unzip_buf); |
| 493 | 494 | ||
| 495 | int qed_slowpath_irq_req(struct qed_hwfn *hwfn); | ||
| 496 | |||
| 494 | #define QED_ETH_INTERFACE_VERSION 300 | 497 | #define QED_ETH_INTERFACE_VERSION 300 |
| 495 | 498 | ||
| 496 | #endif /* _QED_H */ | 499 | #endif /* _QED_H */ |
| @@ -1385,52 +1385,63 @@ err0: · 1384 unmodified lines | |||
| 1385 | return rc; | 1385 | return rc; |
| 1386 | } | 1386 | } |
| 1387 | 1387 | ||
| 1388 | static u32 qed_hw_bar_size(struct qed_dev *cdev, | 1388 | static u32 qed_hw_bar_size(struct qed_hwfn *p_hwfn, |
| 1389 | u8 bar_id) | 1389 | u8 bar_id) |
| 1390 | { | 1390 | { |
| 1391 | u32 size = pci_resource_len(cdev->pdev, (bar_id > 0) ? 2 : 0); | 1391 | u32 bar_reg = (bar_id == 0 ? PGLUE_B_REG_PF_BAR0_SIZE |
| 1392 | : PGLUE_B_REG_PF_BAR1_SIZE); | ||
| 1393 | u32 val = qed_rd(p_hwfn, p_hwfn->p_main_ptt, bar_reg); | ||
| 1392 | 1394 | ||
| 1393 | return size / cdev->num_hwfns; | 1395 | /* Get the BAR size(in KB) from hardware given val */ |
| 1396 | return 1 << (val + 15); | ||
| 1394 | } | 1397 | } |
| 1395 | 1398 | ||
| 1396 | int qed_hw_prepare(struct qed_dev *cdev, | 1399 | int qed_hw_prepare(struct qed_dev *cdev, |
| 1397 | int personality) | 1400 | int personality) |
| 1398 | { | 1401 | { |
| 1399 | int rc, i; | 1402 | struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); |
| 1403 | int rc; | ||
| 1400 | 1404 | ||
| 1401 | /* Store the precompiled init data ptrs */ | 1405 | /* Store the precompiled init data ptrs */ |
| 1402 | qed_init_iro_array(cdev); | 1406 | qed_init_iro_array(cdev); |
| 1403 | 1407 | ||
| 1404 | /* Initialize the first hwfn - will learn number of hwfns */ | 1408 | /* Initialize the first hwfn - will learn number of hwfns */ |
| 1405 | rc = qed_hw_prepare_single(&cdev->hwfns[0], cdev->regview, | 1409 | rc = qed_hw_prepare_single(p_hwfn, |
| 1410 | cdev->regview, | ||
| 1406 | cdev->doorbells, personality); | 1411 | cdev->doorbells, personality); |
| 1407 | if (rc) | 1412 | if (rc) |
| 1408 | return rc; | 1413 | return rc; |
| 1409 | 1414 | ||
| 1410 | personality = cdev->hwfns[0].hw_info.personality; | 1415 | personality = p_hwfn->hw_info.personality; |
| 1411 | 1416 | ||
| 1412 | /* Initialize the rest of the hwfns */ | 1417 | /* Initialize the rest of the hwfns */ |
| 1413 | for (i = 1; i < cdev->num_hwfns; i++) { | 1418 | if (cdev->num_hwfns > 1) { |
| 1414 | void __iomem *p_regview, *p_doorbell; | 1419 | void __iomem *p_regview, *p_doorbell; |
| 1420 | u8 __iomem *addr; | ||
| 1421 | |||
| 1422 | /* adjust bar offset for second engine */ | ||
| 1423 | addr = cdev->regview + qed_hw_bar_size(p_hwfn, 0) / 2; | ||
| 1424 | p_regview = addr; | ||
| 1415 | 1425 | ||
| 1416 | p_regview = cdev->regview + | 1426 | /* adjust doorbell bar offset for second engine */ |
| 1417 | i * qed_hw_bar_size(cdev, 0); | 1427 | addr = cdev->doorbells + qed_hw_bar_size(p_hwfn, 1) / 2; |
| 1418 | p_doorbell = cdev->doorbells + | 1428 | p_doorbell = addr; |
| 1419 | i * qed_hw_bar_size(cdev, 1); | 1429 | |
| 1420 | rc = qed_hw_prepare_single(&cdev->hwfns[i], p_regview, | 1430 | /* prepare second hw function */ |
| 1431 | rc = qed_hw_prepare_single(&cdev->hwfns[1], p_regview, | ||
| 1421 | p_doorbell, personality); | 1432 | p_doorbell, personality); |
| 1433 | |||
| 1434 | /* in case of error, need to free the previously | ||
| 1435 | * initiliazed hwfn 0. | ||
| 1436 | */ | ||
| 1422 | if (rc) { | 1437 | if (rc) { |
| 1423 | /* Cleanup previously initialized hwfns */ | 1438 | qed_init_free(p_hwfn); |
| 1424 | while (--i >= 0) { | 1439 | qed_mcp_free(p_hwfn); |
| 1425 | qed_init_free(&cdev->hwfns[i]); | 1440 | qed_hw_hwfn_free(p_hwfn); |
| 1426 | qed_mcp_free(&cdev->hwfns[i]); | ||
| 1427 | qed_hw_hwfn_free(&cdev->hwfns[i]); | ||
| 1428 | } | ||
| 1429 | return rc; | ||
| 1430 | } | 1441 | } |
| 1431 | } | 1442 | } |
| 1432 | 1443 | ||
| 1433 | return 0; | 1444 | return rc; |
| 1434 | } | 1445 | } |
| 1435 | 1446 | ||
| 1436 | void qed_hw_remove(struct qed_dev *cdev) | 1447 | void qed_hw_remove(struct qed_dev *cdev) |
| @@ -783,22 +783,16 @@ void qed_int_igu_enable_int(struct qed_hwfn *p_hwfn, · 782 unmodified lines | |||
| 783 | qed_wr(p_hwfn, p_ptt, IGU_REG_PF_CONFIGURATION, igu_pf_conf); | 783 | qed_wr(p_hwfn, p_ptt, IGU_REG_PF_CONFIGURATION, igu_pf_conf); |
| 784 | } | 784 | } |
| 785 | 785 | ||
| 786 | void qed_int_igu_enable(struct qed_hwfn *p_hwfn, | 786 | int qed_int_igu_enable(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, |
| 787 | struct qed_ptt *p_ptt, | 787 | enum qed_int_mode int_mode) |
| 788 | enum qed_int_mode int_mode) | ||
| 789 | { | 788 | { |
| 790 | int i; | 789 | int rc, i; |
| 791 | |||
| 792 | p_hwfn->b_int_enabled = 1; | ||
| 793 | 790 | ||
| 794 | /* Mask non-link attentions */ | 791 | /* Mask non-link attentions */ |
| 795 | for (i = 0; i < 9; i++) | 792 | for (i = 0; i < 9; i++) |
| 796 | qed_wr(p_hwfn, p_ptt, | 793 | qed_wr(p_hwfn, p_ptt, |
| 797 | MISC_REG_AEU_ENABLE1_IGU_OUT_0 + (i << 2), 0); | 794 | MISC_REG_AEU_ENABLE1_IGU_OUT_0 + (i << 2), 0); |
| 798 | 795 | ||
| 799 | /* Enable interrupt Generation */ | ||
| 800 | qed_int_igu_enable_int(p_hwfn, p_ptt, int_mode); | ||
| 801 | |||
| 802 | /* Configure AEU signal change to produce attentions for link */ | 796 | /* Configure AEU signal change to produce attentions for link */ |
| 803 | qed_wr(p_hwfn, p_ptt, IGU_REG_LEADING_EDGE_LATCH, 0xfff); | 797 | qed_wr(p_hwfn, p_ptt, IGU_REG_LEADING_EDGE_LATCH, 0xfff); |
| 804 | qed_wr(p_hwfn, p_ptt, IGU_REG_TRAILING_EDGE_LATCH, 0xfff); | 798 | qed_wr(p_hwfn, p_ptt, IGU_REG_TRAILING_EDGE_LATCH, 0xfff); |
| @@ -808,6 +802,19 @@ void qed_int_igu_enable(struct qed_hwfn *p_hwfn, · 3 unmodified lines | |||
| 808 | 802 | ||
| 809 | /* Unmask AEU signals toward IGU */ | 803 | /* Unmask AEU signals toward IGU */ |
| 810 | qed_wr(p_hwfn, p_ptt, MISC_REG_AEU_MASK_ATTN_IGU, 0xff); | 804 | qed_wr(p_hwfn, p_ptt, MISC_REG_AEU_MASK_ATTN_IGU, 0xff); |
| 805 | if ((int_mode != QED_INT_MODE_INTA) || IS_LEAD_HWFN(p_hwfn)) { | ||
| 806 | rc = qed_slowpath_irq_req(p_hwfn); | ||
| 807 | if (rc != 0) { | ||
| 808 | DP_NOTICE(p_hwfn, "Slowpath IRQ request failed\n"); | ||
| 809 | return -EINVAL; | ||
| 810 | } | ||
| 811 | p_hwfn->b_int_requested = true; | ||
| 812 | } | ||
| 813 | /* Enable interrupt Generation */ | ||
| 814 | qed_int_igu_enable_int(p_hwfn, p_ptt, int_mode); | ||
| 815 | p_hwfn->b_int_enabled = 1; | ||
| 816 | |||
| 817 | return rc; | ||
| 811 | } | 818 | } |
| 812 | 819 | ||
| 813 | void qed_int_igu_disable_int(struct qed_hwfn *p_hwfn, | 820 | void qed_int_igu_disable_int(struct qed_hwfn *p_hwfn, |
| @@ -1127,3 +1134,11 @@ int qed_int_get_num_sbs(struct qed_hwfn *p_hwfn, · 313 unmodified lines | |||
| 1127 | 1134 | ||
| 1128 | return info->igu_sb_cnt; | 1135 | return info->igu_sb_cnt; |
| 1129 | } | 1136 | } |
| 1137 | |||
| 1138 | void qed_int_disable_post_isr_release(struct qed_dev *cdev) | ||
| 1139 | { | ||
| 1140 | int i; | ||
| 1141 | |||
| 1142 | for_each_hwfn(cdev, i) | ||
| 1143 | cdev->hwfns[i].b_int_requested = false; | ||
| 1144 | } | ||
| @@ -169,10 +169,14 @@ int qed_int_get_num_sbs(struct qed_hwfn *p_hwfn, · 168 unmodified lines | |||
| 169 | int *p_iov_blks); | 169 | int *p_iov_blks); |
| 170 | 170 | ||
| 171 | /** | 171 | /** |
| 172 | * @file | 172 | * @brief qed_int_disable_post_isr_release - performs the cleanup post ISR |
| 173 | * release. The API need to be called after releasing all slowpath IRQs | ||
| 174 | * of the device. | ||
| 175 | * | ||
| 176 | * @param cdev | ||
| 173 | * | 177 | * |
| 174 | * @brief Interrupt handler | ||
| 175 | */ | 178 | */ |
| 179 | void qed_int_disable_post_isr_release(struct qed_dev *cdev); | ||
| 176 | 180 | ||
| 177 | #define QED_CAU_DEF_RX_TIMER_RES 0 | 181 | #define QED_CAU_DEF_RX_TIMER_RES 0 |
| 178 | #define QED_CAU_DEF_TX_TIMER_RES 0 | 182 | #define QED_CAU_DEF_TX_TIMER_RES 0 |
| @@ -366,10 +370,11 @@ void qed_int_setup(struct qed_hwfn *p_hwfn, · 187 unmodified lines | |||
| 366 | * @param p_hwfn | 370 | * @param p_hwfn |
| 367 | * @param p_ptt | 371 | * @param p_ptt |
| 368 | * @param int_mode | 372 | * @param int_mode |
| 373 | * | ||
| 374 | * @return int | ||
| 369 | */ | 375 | */ |
| 370 | void qed_int_igu_enable(struct qed_hwfn *p_hwfn, | 376 | int qed_int_igu_enable(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, |
| 371 | struct qed_ptt *p_ptt, | 377 | enum qed_int_mode int_mode); |
| 372 | enum qed_int_mode int_mode); | ||
| 373 | 378 | ||
| 374 | /** | 379 | /** |
| 375 | * @brief - Initialize CAU status block entry | 380 | * @brief - Initialize CAU status block entry |
| @@ -476,41 +476,22 @@ static irqreturn_t qed_single_int(int irq, void *dev_instance) · 475 unmodified lines | |||
| 476 | return rc; | 476 | return rc; |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | static int qed_slowpath_irq_req(struct qed_dev *cdev) | 479 | int qed_slowpath_irq_req(struct qed_hwfn *hwfn) |
| 480 | { | 480 | { |
| 481 | int i = 0, rc = 0; | 481 | struct qed_dev *cdev = hwfn->cdev; |
| 482 | int rc = 0; | ||
| 483 | u8 id; | ||
| 482 | 484 | ||
| 483 | if (cdev->int_params.out.int_mode == QED_INT_MODE_MSIX) { | 485 | if (cdev->int_params.out.int_mode == QED_INT_MODE_MSIX) { |
| 484 | /* Request all the slowpath MSI-X vectors */ | 486 | id = hwfn->my_id; |
| 485 | for (i = 0; i < cdev->num_hwfns; i++) { | 487 | snprintf(hwfn->name, NAME_SIZE, "sp-%d-%02x:%02x.%02x", |
| 486 | snprintf(cdev->hwfns[i].name, NAME_SIZE, | 488 | id, cdev->pdev->bus->number, |
| 487 | "sp-%d-%02x:%02x.%02x", | 489 | PCI_SLOT(cdev->pdev->devfn), hwfn->abs_pf_id); |
| 488 | i, cdev->pdev->bus->number, | 490 | rc = request_irq(cdev->int_params.msix_table[id].vector, |
| 489 | PCI_SLOT(cdev->pdev->devfn), | 491 | qed_msix_sp_int, 0, hwfn->name, hwfn->sp_dpc); |
| 490 | cdev->hwfns[i].abs_pf_id); | 492 | if (!rc) |
| 491 | 493 | DP_VERBOSE(hwfn, (NETIF_MSG_INTR | QED_MSG_SP), | |
| 492 | rc = request_irq(cdev->int_params.msix_table[i].vector, | ||
| 493 | qed_msix_sp_int, 0, | ||
| 494 | cdev->hwfns[i].name, | ||
| 495 | cdev->hwfns[i].sp_dpc); | ||
| 496 | if (rc) | ||
| 497 | break; | ||
| 498 | |||
| 499 | DP_VERBOSE(&cdev->hwfns[i], | ||
| 500 | (NETIF_MSG_INTR | QED_MSG_SP), | ||
| 501 | "Requested slowpath MSI-X\n"); | 494 | "Requested slowpath MSI-X\n"); |
| 502 | } | ||
| 503 | |||
| 504 | if (i != cdev->num_hwfns) { | ||
| 505 | /* Free already request MSI-X vectors */ | ||
| 506 | for (i--; i >= 0; i--) { | ||
| 507 | unsigned int vec = | ||
| 508 | cdev->int_params.msix_table[i].vector; | ||
| 509 | synchronize_irq(vec); | ||
| 510 | free_irq(cdev->int_params.msix_table[i].vector, | ||
| 511 | cdev->hwfns[i].sp_dpc); | ||
| 512 | } | ||
| 513 | } | ||
| 514 | } else { | 495 | } else { |
| 515 | unsigned long flags = 0; | 496 | unsigned long flags = 0; |
| 516 | 497 | ||
| @@ -534,13 +515,17 @@ static void qed_slowpath_irq_free(struct qed_dev *cdev) · 17 unmodified lines | |||
| 534 | 515 | ||
| 535 | if (cdev->int_params.out.int_mode == QED_INT_MODE_MSIX) { | 516 | if (cdev->int_params.out.int_mode == QED_INT_MODE_MSIX) { |
| 536 | for_each_hwfn(cdev, i) { | 517 | for_each_hwfn(cdev, i) { |
| 518 | if (!cdev->hwfns[i].b_int_requested) | ||
| 519 | break; | ||
| 537 | synchronize_irq(cdev->int_params.msix_table[i].vector); | 520 | synchronize_irq(cdev->int_params.msix_table[i].vector); |
| 538 | free_irq(cdev->int_params.msix_table[i].vector, | 521 | free_irq(cdev->int_params.msix_table[i].vector, |
| 539 | cdev->hwfns[i].sp_dpc); | 522 | cdev->hwfns[i].sp_dpc); |
| 540 | } | 523 | } |
| 541 | } else { | 524 | } else { |
| 542 | free_irq(cdev->pdev->irq, cdev); | 525 | if (QED_LEADING_HWFN(cdev)->b_int_requested) |
| 526 | free_irq(cdev->pdev->irq, cdev); | ||
| 543 | } | 527 | } |
| 528 | qed_int_disable_post_isr_release(cdev); | ||
| 544 | } | 529 | } |
| 545 | 530 | ||
| 546 | static int qed_nic_stop(struct qed_dev *cdev) | 531 | static int qed_nic_stop(struct qed_dev *cdev) |
| @@ -765,16 +750,11 @@ static int qed_slowpath_start(struct qed_dev *cdev, · 218 unmodified lines | |||
| 765 | if (rc) | 750 | if (rc) |
| 766 | goto err1; | 751 | goto err1; |
| 767 | 752 | ||
| 768 | /* Request the slowpath IRQ */ | ||
| 769 | rc = qed_slowpath_irq_req(cdev); | ||
| 770 | if (rc) | ||
| 771 | goto err2; | ||
| 772 | |||
| 773 | /* Allocate stream for unzipping */ | 753 | /* Allocate stream for unzipping */ |
| 774 | rc = qed_alloc_stream_mem(cdev); | 754 | rc = qed_alloc_stream_mem(cdev); |
| 775 | if (rc) { | 755 | if (rc) { |
| 776 | DP_NOTICE(cdev, "Failed to allocate stream memory\n"); | 756 | DP_NOTICE(cdev, "Failed to allocate stream memory\n"); |
| 777 | goto err3; | 757 | goto err2; |
| 778 | } | 758 | } |
| 779 | 759 | ||
| 780 | /* Start the slowpath */ | 760 | /* Start the slowpath */ |
| @@ -363,4 +363,8 @@ · 362 unmodified lines | |||
| 363 | 0x7 << 0) | 363 | 0x7 << 0) |
| 364 | #define MCP_REG_NVM_CFG4_FLASH_SIZE_SHIFT \ | 364 | #define MCP_REG_NVM_CFG4_FLASH_SIZE_SHIFT \ |
| 365 | 0 | 365 | 0 |
| 366 | #define PGLUE_B_REG_PF_BAR0_SIZE \ | ||
| 367 | 0x2aae60UL | ||
| 368 | #define PGLUE_B_REG_PF_BAR1_SIZE \ | ||
| 369 | 0x2aae64UL | ||
| 366 | #endif | 370 | #endif |
| @@ -124,8 +124,12 @@ struct qed_spq { · 123 unmodified lines | |||
| 124 | dma_addr_t p_phys; | 124 | dma_addr_t p_phys; |
| 125 | struct qed_spq_entry *p_virt; | 125 | struct qed_spq_entry *p_virt; |
| 126 | 126 | ||
| 127 | /* Used as index for completions (returns on EQ by FW) */ | 127 | #define SPQ_RING_SIZE \ |
| 128 | u16 echo_idx; | 128 | (CORE_SPQE_PAGE_SIZE_BYTES / sizeof(struct slow_path_element)) |
| 129 | |||
| 130 | /* Bitmap for handling out-of-order completions */ | ||
| 131 | DECLARE_BITMAP(p_comp_bitmap, SPQ_RING_SIZE); | ||
| 132 | u8 comp_bitmap_idx; | ||
| 129 | 133 | ||
| 130 | /* Statistics */ | 134 | /* Statistics */ |
| 131 | u32 unlimited_pending_count; | 135 | u32 unlimited_pending_count; |
| @@ -112,8 +112,6 @@ static int · 111 unmodified lines | |||
| 112 | qed_spq_fill_entry(struct qed_hwfn *p_hwfn, | 112 | qed_spq_fill_entry(struct qed_hwfn *p_hwfn, |
| 113 | struct qed_spq_entry *p_ent) | 113 | struct qed_spq_entry *p_ent) |
| 114 | { | 114 | { |
| 115 | p_ent->elem.hdr.echo = 0; | ||
| 116 | p_hwfn->p_spq->echo_idx++; | ||
| 117 | p_ent->flags = 0; | 115 | p_ent->flags = 0; |
| 118 | 116 | ||
| 119 | switch (p_ent->comp_mode) { | 117 | switch (p_ent->comp_mode) { |
| @@ -195,10 +193,12 @@ static int qed_spq_hw_post(struct qed_hwfn *p_hwfn, · 75 unmodified lines | |||
| 195 | struct qed_spq *p_spq, | 193 | struct qed_spq *p_spq, |
| 196 | struct qed_spq_entry *p_ent) | 194 | struct qed_spq_entry *p_ent) |
| 197 | { | 195 | { |
| 198 | struct qed_chain *p_chain = &p_hwfn->p_spq->chain; | 196 | struct qed_chain *p_chain = &p_hwfn->p_spq->chain; |
| 197 | u16 echo = qed_chain_get_prod_idx(p_chain); | ||
| 199 | struct slow_path_element *elem; | 198 | struct slow_path_element *elem; |
| 200 | struct core_db_data db; | 199 | struct core_db_data db; |
| 201 | 200 | ||
| 201 | p_ent->elem.hdr.echo = cpu_to_le16(echo); | ||
| 202 | elem = qed_chain_produce(p_chain); | 202 | elem = qed_chain_produce(p_chain); |
| 203 | if (!elem) { | 203 | if (!elem) { |
| 204 | DP_NOTICE(p_hwfn, "Failed to produce from SPQ chain\n"); | 204 | DP_NOTICE(p_hwfn, "Failed to produce from SPQ chain\n"); |
| @@ -437,7 +437,9 @@ void qed_spq_setup(struct qed_hwfn *p_hwfn) · 232 unmodified lines | |||
| 437 | p_spq->comp_count = 0; | 437 | p_spq->comp_count = 0; |
| 438 | p_spq->comp_sent_count = 0; | 438 | p_spq->comp_sent_count = 0; |
| 439 | p_spq->unlimited_pending_count = 0; | 439 | p_spq->unlimited_pending_count = 0; |
| 440 | p_spq->echo_idx = 0; | 440 | |
| 441 | bitmap_zero(p_spq->p_comp_bitmap, SPQ_RING_SIZE); | ||
| 442 | p_spq->comp_bitmap_idx = 0; | ||
| 441 | 443 | ||
| 442 | /* SPQ cid, cannot fail */ | 444 | /* SPQ cid, cannot fail */ |
| 443 | qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_CORE, &p_spq->cid); | 445 | qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_CORE, &p_spq->cid); |
| @@ -582,26 +584,32 @@ qed_spq_add_entry(struct qed_hwfn *p_hwfn, · 138 unmodified lines | |||
| 582 | struct qed_spq *p_spq = p_hwfn->p_spq; | 584 | struct qed_spq *p_spq = p_hwfn->p_spq; |
| 583 | 585 | ||
| 584 | if (p_ent->queue == &p_spq->unlimited_pending) { | 586 | if (p_ent->queue == &p_spq->unlimited_pending) { |
| 585 | struct qed_spq_entry *p_en2; | ||
| 586 | 587 | ||
| 587 | if (list_empty(&p_spq->free_pool)) { | 588 | if (list_empty(&p_spq->free_pool)) { |
| 588 | list_add_tail(&p_ent->list, &p_spq->unlimited_pending); | 589 | list_add_tail(&p_ent->list, &p_spq->unlimited_pending); |
| 589 | p_spq->unlimited_pending_count++; | 590 | p_spq->unlimited_pending_count++; |
| 590 | 591 | ||
| 591 | return 0; | 592 | return 0; |
| 592 | } | 593 | } else { |
| 594 | struct qed_spq_entry *p_en2; | ||
| 593 | 595 | ||
| 594 | p_en2 = list_first_entry(&p_spq->free_pool, | 596 | p_en2 = list_first_entry(&p_spq->free_pool, |
| 595 | struct qed_spq_entry, | 597 | struct qed_spq_entry, |
| 596 | list); | 598 | list); |
| 597 | list_del(&p_en2->list); | 599 | list_del(&p_en2->list); |
| 600 | |||
| 601 | /* Copy the ring element physical pointer to the new | ||
| 602 | * entry, since we are about to override the entire ring | ||
| 603 | * entry and don't want to lose the pointer. | ||
| 604 | */ | ||
| 605 | p_ent->elem.data_ptr = p_en2->elem.data_ptr; | ||
| 598 | 606 | ||
| 599 | /* Strcut assignment */ | 607 | *p_en2 = *p_ent; |
| 600 | *p_en2 = *p_ent; | ||
| 601 | 608 | ||
| 602 | kfree(p_ent); | 609 | kfree(p_ent); |
| 603 | 610 | ||
| 604 | p_ent = p_en2; | 611 | p_ent = p_en2; |
| 612 | } | ||
| 605 | } | 613 | } |
| 606 | 614 | ||
| 607 | /* entry is to be placed in 'pending' queue */ | 615 | /* entry is to be placed in 'pending' queue */ |
| @@ -777,13 +785,38 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, · 169 unmodified lines | |||
| 777 | list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, | 785 | list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, |
| 778 | list) { | 786 | list) { |
| 779 | if (p_ent->elem.hdr.echo == echo) { | 787 | if (p_ent->elem.hdr.echo == echo) { |
| 788 | u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE; | ||
| 789 | |||
| 780 | list_del(&p_ent->list); | 790 | list_del(&p_ent->list); |
| 781 | 791 | ||
| 782 | qed_chain_return_produced(&p_spq->chain); | 792 | /* Avoid overriding of SPQ entries when getting |
| 793 | * out-of-order completions, by marking the completions | ||
| 794 | * in a bitmap and increasing the chain consumer only | ||
| 795 | * for the first successive completed entries. | ||
| 796 | */ | ||
| 797 | bitmap_set(p_spq->p_comp_bitmap, pos, SPQ_RING_SIZE); | ||
| 798 | |||
| 799 | while (test_bit(p_spq->comp_bitmap_idx, | ||
| 800 | p_spq->p_comp_bitmap)) { | ||
| 801 | bitmap_clear(p_spq->p_comp_bitmap, | ||
| 802 | p_spq->comp_bitmap_idx, | ||
| 803 | SPQ_RING_SIZE); | ||
| 804 | p_spq->comp_bitmap_idx++; | ||
| 805 | qed_chain_return_produced(&p_spq->chain); | ||
| 806 | } | ||
| 807 | |||
| 783 | p_spq->comp_count++; | 808 | p_spq->comp_count++; |
| 784 | found = p_ent; | 809 | found = p_ent; |
| 785 | break; | 810 | break; |
| 786 | } | 811 | } |
| 812 | |||
| 813 | /* This is relatively uncommon - depends on scenarios | ||
| 814 | * which have mutliple per-PF sent ramrods. | ||
| 815 | */ | ||
| 816 | DP_VERBOSE(p_hwfn, QED_MSG_SPQ, | ||
| 817 | "Got completion for echo %04x - doesn't match echo %04x in completion pending list\n", | ||
| 818 | le16_to_cpu(echo), | ||
| 819 | le16_to_cpu(p_ent->elem.hdr.echo)); | ||
| 787 | } | 820 | } |
| 788 | 821 | ||
| 789 | /* Release lock before callback, as callback may post | 822 | /* Release lock before callback, as callback may post |
| @@ -246,7 +246,8 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *adapter) · 245 unmodified lines | |||
| 246 | u32 state; | 246 | u32 state; |
| 247 | 247 | ||
| 248 | state = QLCRDX(ahw, QLC_83XX_VNIC_STATE); | 248 | state = QLCRDX(ahw, QLC_83XX_VNIC_STATE); |
| 249 | while (state != QLCNIC_DEV_NPAR_OPER && idc->vnic_wait_limit--) { | 249 | while (state != QLCNIC_DEV_NPAR_OPER && idc->vnic_wait_limit) { |
| 250 | idc->vnic_wait_limit--; | ||
| 250 | msleep(1000); | 251 | msleep(1000); |
| 251 | state = QLCRDX(ahw, QLC_83XX_VNIC_STATE); | 252 | state = QLCRDX(ahw, QLC_83XX_VNIC_STATE); |
| 252 | } | 253 | } |
| @@ -4211,8 +4211,9 @@ static int ql_change_rx_buffers(struct ql_adapter *qdev) · 4210 unmodified lines | |||
| 4211 | 4211 | ||
| 4212 | /* Wait for an outstanding reset to complete. */ | 4212 | /* Wait for an outstanding reset to complete. */ |
| 4213 | if (!test_bit(QL_ADAPTER_UP, &qdev->flags)) { | 4213 | if (!test_bit(QL_ADAPTER_UP, &qdev->flags)) { |
| 4214 | int i = 3; | 4214 | int i = 4; |
| 4215 | while (i-- && !test_bit(QL_ADAPTER_UP, &qdev->flags)) { | 4215 | |
| 4216 | while (--i && !test_bit(QL_ADAPTER_UP, &qdev->flags)) { | ||
| 4216 | netif_err(qdev, ifup, qdev->ndev, | 4217 | netif_err(qdev, ifup, qdev->ndev, |
| 4217 | "Waiting for adapter UP...\n"); | 4218 | "Waiting for adapter UP...\n"); |
| 4218 | ssleep(1); | 4219 | ssleep(1); |
| @@ -736,9 +736,8 @@ qcaspi_netdev_tx_timeout(struct net_device *dev) · 735 unmodified lines | |||
| 736 | netdev_info(qca->net_dev, "Transmit timeout at %ld, latency %ld\n", | 736 | netdev_info(qca->net_dev, "Transmit timeout at %ld, latency %ld\n", |
| 737 | jiffies, jiffies - dev->trans_start); | 737 | jiffies, jiffies - dev->trans_start); |
| 738 | qca->net_dev->stats.tx_errors++; | 738 | qca->net_dev->stats.tx_errors++; |
| 739 | /* wake the queue if there is room */ | 739 | /* Trigger tx queue flush and QCA7000 reset */ |
| 740 | if (qcaspi_tx_ring_has_space(&qca->txr)) | 740 | qca->sync = QCASPI_SYNC_UNKNOWN; |
| 741 | netif_wake_queue(dev); | ||
| 742 | } | 741 | } |
| 743 | 742 | ||
| 744 | static int | 743 | static int |
| @@ -905,6 +905,9 @@ static int ravb_phy_init(struct net_device *ndev) · 904 unmodified lines | |||
| 905 | netdev_info(ndev, "limited PHY to 100Mbit/s\n"); | 905 | netdev_info(ndev, "limited PHY to 100Mbit/s\n"); |
| 906 | } | 906 | } |
| 907 | 907 | ||
| 908 | /* 10BASE is not supported */ | ||
| 909 | phydev->supported &= ~PHY_10BT_FEATURES; | ||
| 910 | |||
| 908 | netdev_info(ndev, "attached PHY %d (IRQ %d) to driver %s\n", | 911 | netdev_info(ndev, "attached PHY %d (IRQ %d) to driver %s\n", |
| 909 | phydev->addr, phydev->irq, phydev->drv->name); | 912 | phydev->addr, phydev->irq, phydev->drv->name); |
| 910 | 913 | ||
| @@ -1037,7 +1040,7 @@ static const char ravb_gstrings_stats[][ETH_GSTRING_LEN] = { · 126 unmodified lines | |||
| 1037 | "rx_queue_1_mcast_packets", | 1040 | "rx_queue_1_mcast_packets", |
| 1038 | "rx_queue_1_errors", | 1041 | "rx_queue_1_errors", |
| 1039 | "rx_queue_1_crc_errors", | 1042 | "rx_queue_1_crc_errors", |
| 1040 | "rx_queue_1_frame_errors_", | 1043 | "rx_queue_1_frame_errors", |
| 1041 | "rx_queue_1_length_errors", | 1044 | "rx_queue_1_length_errors", |
| 1042 | "rx_queue_1_missed_errors", | 1045 | "rx_queue_1_missed_errors", |
| 1043 | "rx_queue_1_over_errors", | 1046 | "rx_queue_1_over_errors", |
| @@ -52,6 +52,8 @@ · 51 unmodified lines | |||
| 52 | NETIF_MSG_RX_ERR| \ | 52 | NETIF_MSG_RX_ERR| \ |
| 53 | NETIF_MSG_TX_ERR) | 53 | NETIF_MSG_TX_ERR) |
| 54 | 54 | ||
| 55 | #define SH_ETH_OFFSET_INVALID ((u16)~0) | ||
| 56 | |||
| 55 | #define SH_ETH_OFFSET_DEFAULTS \ | 57 | #define SH_ETH_OFFSET_DEFAULTS \ |
| 56 | [0 ... SH_ETH_MAX_REGISTER_OFFSET - 1] = SH_ETH_OFFSET_INVALID | 58 | [0 ... SH_ETH_MAX_REGISTER_OFFSET - 1] = SH_ETH_OFFSET_INVALID |
| 57 | 59 | ||
| @@ -404,6 +406,28 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = { · 346 unmodified lines | |||
| 404 | static void sh_eth_rcv_snd_disable(struct net_device *ndev); | 406 | static void sh_eth_rcv_snd_disable(struct net_device *ndev); |
| 405 | static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev); | 407 | static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev); |
| 406 | 408 | ||
| 409 | static void sh_eth_write(struct net_device *ndev, u32 data, int enum_index) | ||
| 410 | { | ||
| 411 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
| 412 | u16 offset = mdp->reg_offset[enum_index]; | ||
| 413 | |||
| 414 | if (WARN_ON(offset == SH_ETH_OFFSET_INVALID)) | ||
| 415 | return; | ||
| 416 | |||
| 417 | iowrite32(data, mdp->addr + offset); | ||
| 418 | } | ||
| 419 | |||
| 420 | static u32 sh_eth_read(struct net_device *ndev, int enum_index) | ||
| 421 | { | ||
| 422 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
| 423 | u16 offset = mdp->reg_offset[enum_index]; | ||
| 424 | |||
| 425 | if (WARN_ON(offset == SH_ETH_OFFSET_INVALID)) | ||
| 426 | return ~0U; | ||
| 427 | |||
| 428 | return ioread32(mdp->addr + offset); | ||
| 429 | } | ||
| 430 | |||
| 407 | static bool sh_eth_is_gether(struct sh_eth_private *mdp) | 431 | static bool sh_eth_is_gether(struct sh_eth_private *mdp) |
| 408 | { | 432 | { |
| 409 | return mdp->reg_offset == sh_eth_offset_gigabit; | 433 | return mdp->reg_offset == sh_eth_offset_gigabit; |
| @@ -1172,7 +1196,7 @@ static void sh_eth_ring_format(struct net_device *ndev) · 762 unmodified lines | |||
| 1172 | break; | 1196 | break; |
| 1173 | } | 1197 | } |
| 1174 | mdp->rx_skbuff[i] = skb; | 1198 | mdp->rx_skbuff[i] = skb; |
| 1175 | rxdesc->addr = dma_addr; | 1199 | rxdesc->addr = cpu_to_edmac(mdp, dma_addr); |
| 1176 | rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP); | 1200 | rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP); |
| 1177 | 1201 | ||
| 1178 | /* Rx descriptor address set */ | 1202 | /* Rx descriptor address set */ |
| @@ -1403,7 +1427,8 @@ static int sh_eth_txfree(struct net_device *ndev) · 224 unmodified lines | |||
| 1403 | entry, edmac_to_cpu(mdp, txdesc->status)); | 1427 | entry, edmac_to_cpu(mdp, txdesc->status)); |
| 1404 | /* Free the original skb. */ | 1428 | /* Free the original skb. */ |
| 1405 | if (mdp->tx_skbuff[entry]) { | 1429 | if (mdp->tx_skbuff[entry]) { |
| 1406 | dma_unmap_single(&ndev->dev, txdesc->addr, | 1430 | dma_unmap_single(&ndev->dev, |
| 1431 | edmac_to_cpu(mdp, txdesc->addr), | ||
| 1407 | txdesc->buffer_length, DMA_TO_DEVICE); | 1432 | txdesc->buffer_length, DMA_TO_DEVICE); |
| 1408 | dev_kfree_skb_irq(mdp->tx_skbuff[entry]); | 1433 | dev_kfree_skb_irq(mdp->tx_skbuff[entry]); |
| 1409 | mdp->tx_skbuff[entry] = NULL; | 1434 | mdp->tx_skbuff[entry] = NULL; |
| @@ -1462,6 +1487,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) · 52 unmodified lines | |||
| 1462 | if (mdp->cd->shift_rd0) | 1487 | if (mdp->cd->shift_rd0) |
| 1463 | desc_status >>= 16; | 1488 | desc_status >>= 16; |
| 1464 | 1489 | ||
| 1490 | skb = mdp->rx_skbuff[entry]; | ||
| 1465 | if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 | | 1491 | if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 | |
| 1466 | RD_RFS5 | RD_RFS6 | RD_RFS10)) { | 1492 | RD_RFS5 | RD_RFS6 | RD_RFS10)) { |
| 1467 | ndev->stats.rx_errors++; | 1493 | ndev->stats.rx_errors++; |
| @@ -1477,16 +1503,16 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) · 9 unmodified lines | |||
| 1477 | ndev->stats.rx_missed_errors++; | 1503 | ndev->stats.rx_missed_errors++; |
| 1478 | if (desc_status & RD_RFS10) | 1504 | if (desc_status & RD_RFS10) |
| 1479 | ndev->stats.rx_over_errors++; | 1505 | ndev->stats.rx_over_errors++; |
| 1480 | } else { | 1506 | } else if (skb) { |
| 1507 | dma_addr = edmac_to_cpu(mdp, rxdesc->addr); | ||
| 1481 | if (!mdp->cd->hw_swap) | 1508 | if (!mdp->cd->hw_swap) |
| 1482 | sh_eth_soft_swap( | 1509 | sh_eth_soft_swap( |
| 1483 | phys_to_virt(ALIGN(rxdesc->addr, 4)), | 1510 | phys_to_virt(ALIGN(dma_addr, 4)), |
| 1484 | pkt_len + 2); | 1511 | pkt_len + 2); |
| 1485 | skb = mdp->rx_skbuff[entry]; | ||
| 1486 | mdp->rx_skbuff[entry] = NULL; | 1512 | mdp->rx_skbuff[entry] = NULL; |
| 1487 | if (mdp->cd->rpadir) | 1513 | if (mdp->cd->rpadir) |
| 1488 | skb_reserve(skb, NET_IP_ALIGN); | 1514 | skb_reserve(skb, NET_IP_ALIGN); |
| 1489 | dma_unmap_single(&ndev->dev, rxdesc->addr, | 1515 | dma_unmap_single(&ndev->dev, dma_addr, |
| 1490 | ALIGN(mdp->rx_buf_sz, 32), | 1516 | ALIGN(mdp->rx_buf_sz, 32), |
| 1491 | DMA_FROM_DEVICE); | 1517 | DMA_FROM_DEVICE); |
| 1492 | skb_put(skb, pkt_len); | 1518 | skb_put(skb, pkt_len); |
| @@ -1523,7 +1549,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) · 30 unmodified lines | |||
| 1523 | mdp->rx_skbuff[entry] = skb; | 1549 | mdp->rx_skbuff[entry] = skb; |
| 1524 | 1550 | ||
| 1525 | skb_checksum_none_assert(skb); | 1551 | skb_checksum_none_assert(skb); |
| 1526 | rxdesc->addr = dma_addr; | 1552 | rxdesc->addr = cpu_to_edmac(mdp, dma_addr); |
| 1527 | } | 1553 | } |
| 1528 | dma_wmb(); /* RACT bit must be set after all the above writes */ | 1554 | dma_wmb(); /* RACT bit must be set after all the above writes */ |
| 1529 | if (entry >= mdp->num_rx_ring - 1) | 1555 | if (entry >= mdp->num_rx_ring - 1) |
| @@ -2331,8 +2357,8 @@ static void sh_eth_tx_timeout(struct net_device *ndev) · 801 unmodified lines | |||
| 2331 | /* Free all the skbuffs in the Rx queue. */ | 2357 | /* Free all the skbuffs in the Rx queue. */ |
| 2332 | for (i = 0; i < mdp->num_rx_ring; i++) { | 2358 | for (i = 0; i < mdp->num_rx_ring; i++) { |
| 2333 | rxdesc = &mdp->rx_ring[i]; | 2359 | rxdesc = &mdp->rx_ring[i]; |
| 2334 | rxdesc->status = 0; | 2360 | rxdesc->status = cpu_to_edmac(mdp, 0); |
| 2335 | rxdesc->addr = 0xBADF00D0; | 2361 | rxdesc->addr = cpu_to_edmac(mdp, 0xBADF00D0); |
| 2336 | dev_kfree_skb(mdp->rx_skbuff[i]); | 2362 | dev_kfree_skb(mdp->rx_skbuff[i]); |
| 2337 | mdp->rx_skbuff[i] = NULL; | 2363 | mdp->rx_skbuff[i] = NULL; |
| 2338 | } | 2364 | } |
| @@ -2350,6 +2376,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 11 unmodified lines | |||
| 2350 | { | 2376 | { |
| 2351 | struct sh_eth_private *mdp = netdev_priv(ndev); | 2377 | struct sh_eth_private *mdp = netdev_priv(ndev); |
| 2352 | struct sh_eth_txdesc *txdesc; | 2378 | struct sh_eth_txdesc *txdesc; |
| 2379 | dma_addr_t dma_addr; | ||
| 2353 | u32 entry; | 2380 | u32 entry; |
| 2354 | unsigned long flags; | 2381 | unsigned long flags; |
| 2355 | 2382 | ||
| @@ -2372,14 +2399,14 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 16 unmodified lines | |||
| 2372 | txdesc = &mdp->tx_ring[entry]; | 2399 | txdesc = &mdp->tx_ring[entry]; |
| 2373 | /* soft swap. */ | 2400 | /* soft swap. */ |
| 2374 | if (!mdp->cd->hw_swap) | 2401 | if (!mdp->cd->hw_swap) |
| 2375 | sh_eth_soft_swap(phys_to_virt(ALIGN(txdesc->addr, 4)), | 2402 | sh_eth_soft_swap(PTR_ALIGN(skb->data, 4), skb->len + 2); |
| 2376 | skb->len + 2); | 2403 | dma_addr = dma_map_single(&ndev->dev, skb->data, skb->len, |
| 2377 | txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len, | 2404 | DMA_TO_DEVICE); |
| 2378 | DMA_TO_DEVICE); | 2405 | if (dma_mapping_error(&ndev->dev, dma_addr)) { |
| 2379 | if (dma_mapping_error(&ndev->dev, txdesc->addr)) { | ||
| 2380 | kfree_skb(skb); | 2406 | kfree_skb(skb); |
| 2381 | return NETDEV_TX_OK; | 2407 | return NETDEV_TX_OK; |
| 2382 | } | 2408 | } |
| 2409 | txdesc->addr = cpu_to_edmac(mdp, dma_addr); | ||
| 2383 | txdesc->buffer_length = skb->len; | 2410 | txdesc->buffer_length = skb->len; |
| 2384 | 2411 | ||
| 2385 | dma_wmb(); /* TACT bit must be set after all the above writes */ | 2412 | dma_wmb(); /* TACT bit must be set after all the above writes */ |
| @@ -546,31 +546,6 @@ static inline void sh_eth_soft_swap(char *src, int len) · 545 unmodified lines | |||
| 546 | #endif | 546 | #endif |
| 547 | } | 547 | } |
| 548 | 548 | ||
| 549 | #define SH_ETH_OFFSET_INVALID ((u16) ~0) | ||
| 550 | |||
| 551 | static inline void sh_eth_write(struct net_device *ndev, u32 data, | ||
| 552 | int enum_index) | ||
| 553 | { | ||
| 554 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
| 555 | u16 offset = mdp->reg_offset[enum_index]; | ||
| 556 | |||
| 557 | if (WARN_ON(offset == SH_ETH_OFFSET_INVALID)) | ||
| 558 | return; | ||
| 559 | |||
| 560 | iowrite32(data, mdp->addr + offset); | ||
| 561 | } | ||
| 562 | |||
| 563 | static inline u32 sh_eth_read(struct net_device *ndev, int enum_index) | ||
| 564 | { | ||
| 565 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
| 566 | u16 offset = mdp->reg_offset[enum_index]; | ||
| 567 | |||
| 568 | if (WARN_ON(offset == SH_ETH_OFFSET_INVALID)) | ||
| 569 | return ~0U; | ||
| 570 | |||
| 571 | return ioread32(mdp->addr + offset); | ||
| 572 | } | ||
| 573 | |||
| 574 | static inline void *sh_eth_tsu_get_offset(struct sh_eth_private *mdp, | 549 | static inline void *sh_eth_tsu_get_offset(struct sh_eth_private *mdp, |
| 575 | int enum_index) | 550 | int enum_index) |
| 576 | { | 551 | { |
| @@ -3299,7 +3299,8 @@ static int efx_ef10_filter_remove_internal(struct efx_nic *efx, · 3298 unmodified lines | |||
| 3299 | 3299 | ||
| 3300 | new_spec.priority = EFX_FILTER_PRI_AUTO; | 3300 | new_spec.priority = EFX_FILTER_PRI_AUTO; |
| 3301 | new_spec.flags = (EFX_FILTER_FLAG_RX | | 3301 | new_spec.flags = (EFX_FILTER_FLAG_RX | |
| 3302 | EFX_FILTER_FLAG_RX_RSS); | 3302 | (efx_rss_enabled(efx) ? |
| 3303 | EFX_FILTER_FLAG_RX_RSS : 0)); | ||
| 3303 | new_spec.dmaq_id = 0; | 3304 | new_spec.dmaq_id = 0; |
| 3304 | new_spec.rss_context = EFX_FILTER_RSS_CONTEXT_DEFAULT; | 3305 | new_spec.rss_context = EFX_FILTER_RSS_CONTEXT_DEFAULT; |
| 3305 | rc = efx_ef10_filter_push(efx, &new_spec, | 3306 | rc = efx_ef10_filter_push(efx, &new_spec, |
| @@ -3921,6 +3922,7 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx, · 615 unmodified lines | |||
| 3921 | { | 3922 | { |
| 3922 | struct efx_ef10_filter_table *table = efx->filter_state; | 3923 | struct efx_ef10_filter_table *table = efx->filter_state; |
| 3923 | struct efx_ef10_dev_addr *addr_list; | 3924 | struct efx_ef10_dev_addr *addr_list; |
| 3925 | enum efx_filter_flags filter_flags; | ||
| 3924 | struct efx_filter_spec spec; | 3926 | struct efx_filter_spec spec; |
| 3925 | u8 baddr[ETH_ALEN]; | 3927 | u8 baddr[ETH_ALEN]; |
| 3926 | unsigned int i, j; | 3928 | unsigned int i, j; |
| @@ -3935,11 +3937,11 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx, · 8 unmodified lines | |||
| 3935 | addr_count = table->dev_uc_count; | 3937 | addr_count = table->dev_uc_count; |
| 3936 | } | 3938 | } |
| 3937 | 3939 | ||
| 3940 | filter_flags = efx_rss_enabled(efx) ? EFX_FILTER_FLAG_RX_RSS : 0; | ||
| 3941 | |||
| 3938 | /* Insert/renew filters */ | 3942 | /* Insert/renew filters */ |
| 3939 | for (i = 0; i < addr_count; i++) { | 3943 | for (i = 0; i < addr_count; i++) { |
| 3940 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, | 3944 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, 0); |
| 3941 | EFX_FILTER_FLAG_RX_RSS, | ||
| 3942 | 0); | ||
| 3943 | efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, | 3945 | efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, |
| 3944 | addr_list[i].addr); | 3946 | addr_list[i].addr); |
| 3945 | rc = efx_ef10_filter_insert(efx, &spec, true); | 3947 | rc = efx_ef10_filter_insert(efx, &spec, true); |
| @@ -3968,9 +3970,7 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx, · 22 unmodified lines | |||
| 3968 | 3970 | ||
| 3969 | if (multicast && rollback) { | 3971 | if (multicast && rollback) { |
| 3970 | /* Also need an Ethernet broadcast filter */ | 3972 | /* Also need an Ethernet broadcast filter */ |
| 3971 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, | 3973 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, 0); |
| 3972 | EFX_FILTER_FLAG_RX_RSS, | ||
| 3973 | 0); | ||
| 3974 | eth_broadcast_addr(baddr); | 3974 | eth_broadcast_addr(baddr); |
| 3975 | efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, baddr); | 3975 | efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, baddr); |
| 3976 | rc = efx_ef10_filter_insert(efx, &spec, true); | 3976 | rc = efx_ef10_filter_insert(efx, &spec, true); |
| @@ -4000,13 +4000,14 @@ static int efx_ef10_filter_insert_def(struct efx_nic *efx, bool multicast, · 23 unmodified lines | |||
| 4000 | { | 4000 | { |
| 4001 | struct efx_ef10_filter_table *table = efx->filter_state; | 4001 | struct efx_ef10_filter_table *table = efx->filter_state; |
| 4002 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | 4002 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
| 4003 | enum efx_filter_flags filter_flags; | ||
| 4003 | struct efx_filter_spec spec; | 4004 | struct efx_filter_spec spec; |
| 4004 | u8 baddr[ETH_ALEN]; | 4005 | u8 baddr[ETH_ALEN]; |
| 4005 | int rc; | 4006 | int rc; |
| 4006 | 4007 | ||
| 4007 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, | 4008 | filter_flags = efx_rss_enabled(efx) ? EFX_FILTER_FLAG_RX_RSS : 0; |
| 4008 | EFX_FILTER_FLAG_RX_RSS, | 4009 | |
| 4009 | 0); | 4010 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, 0); |
| 4010 | 4011 | ||
| 4011 | if (multicast) | 4012 | if (multicast) |
| 4012 | efx_filter_set_mc_def(&spec); | 4013 | efx_filter_set_mc_def(&spec); |
| @@ -4023,8 +4024,7 @@ static int efx_ef10_filter_insert_def(struct efx_nic *efx, bool multicast, · 10 unmodified lines | |||
| 4023 | if (!nic_data->workaround_26807) { | 4024 | if (!nic_data->workaround_26807) { |
| 4024 | /* Also need an Ethernet broadcast filter */ | 4025 | /* Also need an Ethernet broadcast filter */ |
| 4025 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, | 4026 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_AUTO, |
| 4026 | EFX_FILTER_FLAG_RX_RSS, | 4027 | filter_flags, 0); |
| 4027 | 0); | ||
| 4028 | eth_broadcast_addr(baddr); | 4028 | eth_broadcast_addr(baddr); |
| 4029 | efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, | 4029 | efx_filter_set_eth_local(&spec, EFX_FILTER_VID_UNSPEC, |
| 4030 | baddr); | 4030 | baddr); |
| @@ -76,6 +76,11 @@ void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue); · 75 unmodified lines | |||
| 76 | #define EFX_TXQ_MAX_ENT(efx) (EFX_WORKAROUND_35388(efx) ? \ | 76 | #define EFX_TXQ_MAX_ENT(efx) (EFX_WORKAROUND_35388(efx) ? \ |
| 77 | EFX_MAX_DMAQ_SIZE / 2 : EFX_MAX_DMAQ_SIZE) | 77 | EFX_MAX_DMAQ_SIZE / 2 : EFX_MAX_DMAQ_SIZE) |
| 78 | 78 | ||
| 79 | static inline bool efx_rss_enabled(struct efx_nic *efx) | ||
| 80 | { | ||
| 81 | return efx->rss_spread > 1; | ||
| 82 | } | ||
| 83 | |||
| 79 | /* Filters */ | 84 | /* Filters */ |
| 80 | 85 | ||
| 81 | void efx_mac_reconfigure(struct efx_nic *efx); | 86 | void efx_mac_reconfigure(struct efx_nic *efx); |
| @@ -2242,7 +2242,7 @@ efx_farch_filter_init_rx_auto(struct efx_nic *efx, · 2241 unmodified lines | |||
| 2242 | */ | 2242 | */ |
| 2243 | spec->priority = EFX_FILTER_PRI_AUTO; | 2243 | spec->priority = EFX_FILTER_PRI_AUTO; |
| 2244 | spec->flags = (EFX_FILTER_FLAG_RX | | 2244 | spec->flags = (EFX_FILTER_FLAG_RX | |
| 2245 | (efx->n_rx_channels > 1 ? EFX_FILTER_FLAG_RX_RSS : 0) | | 2245 | (efx_rss_enabled(efx) ? EFX_FILTER_FLAG_RX_RSS : 0) | |
| 2246 | (efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0)); | 2246 | (efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0)); |
| 2247 | spec->dmaq_id = 0; | 2247 | spec->dmaq_id = 0; |
| 2248 | } | 2248 | } |
| @@ -418,7 +418,7 @@ static void txc_reset_logic_mmd(struct efx_nic *efx, int mmd) · 417 unmodified lines | |||
| 418 | 418 | ||
| 419 | val |= (1 << TXC_GLCMD_LMTSWRST_LBN); | 419 | val |= (1 << TXC_GLCMD_LMTSWRST_LBN); |
| 420 | efx_mdio_write(efx, mmd, TXC_GLRGS_GLCMD, val); | 420 | efx_mdio_write(efx, mmd, TXC_GLRGS_GLCMD, val); |
| 421 | while (tries--) { | 421 | while (--tries) { |
| 422 | val = efx_mdio_read(efx, mmd, TXC_GLRGS_GLCMD); | 422 | val = efx_mdio_read(efx, mmd, TXC_GLRGS_GLCMD); |
| 423 | if (!(val & (1 << TXC_GLCMD_LMTSWRST_LBN))) | 423 | if (!(val & (1 << TXC_GLCMD_LMTSWRST_LBN))) |
| 424 | break; | 424 | break; |
| @@ -153,7 +153,11 @@ static int sun7i_gmac_probe(struct platform_device *pdev) · 152 unmodified lines | |||
| 153 | if (ret) | 153 | if (ret) |
| 154 | return ret; | 154 | return ret; |
| 155 | 155 | ||
| 156 | return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); | 156 | ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
| 157 | if (ret) | ||
| 158 | sun7i_gmac_exit(pdev, plat_dat->bsp_priv); | ||
| 159 | |||
| 160 | return ret; | ||
| 157 | } | 161 | } |
| 158 | 162 | ||
| 159 | static const struct of_device_id sun7i_dwmac_match[] = { | 163 | static const struct of_device_id sun7i_dwmac_match[] = { |
| @@ -3046,8 +3046,6 @@ int stmmac_suspend(struct net_device *ndev) · 3045 unmodified lines | |||
| 3046 | priv->hw->dma->stop_tx(priv->ioaddr); | 3046 | priv->hw->dma->stop_tx(priv->ioaddr); |
| 3047 | priv->hw->dma->stop_rx(priv->ioaddr); | 3047 | priv->hw->dma->stop_rx(priv->ioaddr); |
| 3048 | 3048 | ||
| 3049 | stmmac_clear_descriptors(priv); | ||
| 3050 | |||
| 3051 | /* Enable Power down mode by programming the PMT regs */ | 3049 | /* Enable Power down mode by programming the PMT regs */ |
| 3052 | if (device_may_wakeup(priv->device)) { | 3050 | if (device_may_wakeup(priv->device)) { |
| 3053 | priv->hw->mac->pmt(priv->hw, priv->wolopts); | 3051 | priv->hw->mac->pmt(priv->hw, priv->wolopts); |
| @@ -3105,7 +3103,12 @@ int stmmac_resume(struct net_device *ndev) · 51 unmodified lines | |||
| 3105 | 3103 | ||
| 3106 | netif_device_attach(ndev); | 3104 | netif_device_attach(ndev); |
| 3107 | 3105 | ||
| 3108 | init_dma_desc_rings(ndev, GFP_ATOMIC); | 3106 | priv->cur_rx = 0; |
| 3107 | priv->dirty_rx = 0; | ||
| 3108 | priv->dirty_tx = 0; | ||
| 3109 | priv->cur_tx = 0; | ||
| 3110 | stmmac_clear_descriptors(priv); | ||
| 3111 | |||
| 3109 | stmmac_hw_setup(ndev, false); | 3112 | stmmac_hw_setup(ndev, false); |
| 3110 | stmmac_init_tx_coalesce(priv); | 3113 | stmmac_init_tx_coalesce(priv); |
| 3111 | stmmac_set_rx_mode(ndev); | 3114 | stmmac_set_rx_mode(ndev); |
| @@ -967,8 +967,6 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 966 unmodified lines | |||
| 967 | err = udp_tunnel6_xmit_skb(dst, gs6->sock->sk, skb, dev, | 967 | err = udp_tunnel6_xmit_skb(dst, gs6->sock->sk, skb, dev, |
| 968 | &fl6.saddr, &fl6.daddr, prio, ttl, | 968 | &fl6.saddr, &fl6.daddr, prio, ttl, |
| 969 | sport, geneve->dst_port, !udp_csum); | 969 | sport, geneve->dst_port, !udp_csum); |
| 970 | |||
| 971 | iptunnel_xmit_stats(err, &dev->stats, dev->tstats); | ||
| 972 | return NETDEV_TX_OK; | 970 | return NETDEV_TX_OK; |
| 973 | 971 | ||
| 974 | tx_error: | 972 | tx_error: |
| @@ -149,9 +149,14 @@ int mdio_mux_init(struct device *dev, · 148 unmodified lines | |||
| 149 | } | 149 | } |
| 150 | cb->bus_number = v; | 150 | cb->bus_number = v; |
| 151 | cb->parent = pb; | 151 | cb->parent = pb; |
| 152 | |||
| 152 | cb->mii_bus = mdiobus_alloc(); | 153 | cb->mii_bus = mdiobus_alloc(); |
| 154 | if (!cb->mii_bus) { | ||
| 155 | ret_val = -ENOMEM; | ||
| 156 | of_node_put(child_bus_node); | ||
| 157 | break; | ||
| 158 | } | ||
| 153 | cb->mii_bus->priv = cb; | 159 | cb->mii_bus->priv = cb; |
| 154 | |||
| 155 | cb->mii_bus->irq = cb->phy_irq; | 160 | cb->mii_bus->irq = cb->phy_irq; |
| 156 | cb->mii_bus->name = "mdio_mux"; | 161 | cb->mii_bus->name = "mdio_mux"; |
| 157 | snprintf(cb->mii_bus->id, MII_BUS_ID_SIZE, "%x.%x", | 162 | snprintf(cb->mii_bus->id, MII_BUS_ID_SIZE, "%x.%x", |
| @@ -339,9 +339,18 @@ static int ksz9021_config_init(struct phy_device *phydev) · 338 unmodified lines | |||
| 339 | { | 339 | { |
| 340 | const struct device *dev = &phydev->dev; | 340 | const struct device *dev = &phydev->dev; |
| 341 | const struct device_node *of_node = dev->of_node; | 341 | const struct device_node *of_node = dev->of_node; |
| 342 | const struct device *dev_walker; | ||
| 342 | 343 | ||
| 343 | if (!of_node && dev->parent->of_node) | 344 | /* The Micrel driver has a deprecated option to place phy OF |
| 344 | of_node = dev->parent->of_node; | 345 | * properties in the MAC node. Walk up the tree of devices to |
| 346 | * find a device with an OF node. | ||
| 347 | */ | ||
| 348 | dev_walker = &phydev->dev; | ||
| 349 | do { | ||
| 350 | of_node = dev_walker->of_node; | ||
| 351 | dev_walker = dev_walker->parent; | ||
| 352 | |||
| 353 | } while (!of_node && dev_walker); | ||
| 345 | 354 | ||
| 346 | if (of_node) { | 355 | if (of_node) { |
| 347 | ksz9021_load_values_from_of(phydev, of_node, | 356 | ksz9021_load_values_from_of(phydev, of_node, |
| @@ -568,6 +568,9 @@ static int pppoe_create(struct net *net, struct socket *sock, int kern) · 567 unmodified lines | |||
| 568 | sk->sk_family = PF_PPPOX; | 568 | sk->sk_family = PF_PPPOX; |
| 569 | sk->sk_protocol = PX_PROTO_OE; | 569 | sk->sk_protocol = PX_PROTO_OE; |
| 570 | 570 | ||
| 571 | INIT_WORK(&pppox_sk(sk)->proto.pppoe.padt_work, | ||
| 572 | pppoe_unbind_sock_work); | ||
| 573 | |||
| 571 | return 0; | 574 | return 0; |
| 572 | } | 575 | } |
| 573 | 576 | ||
| @@ -632,8 +635,6 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, · 58 unmodified lines | |||
| 632 | 635 | ||
| 633 | lock_sock(sk); | 636 | lock_sock(sk); |
| 634 | 637 | ||
| 635 | INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work); | ||
| 636 | |||
| 637 | error = -EINVAL; | 638 | error = -EINVAL; |
| 638 | if (sp->sa_protocol != PX_PROTO_OE) | 639 | if (sp->sa_protocol != PX_PROTO_OE) |
| 639 | goto end; | 640 | goto end; |
| @@ -663,8 +664,13 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, · 23 unmodified lines | |||
| 663 | po->pppoe_dev = NULL; | 664 | po->pppoe_dev = NULL; |
| 664 | } | 665 | } |
| 665 | 666 | ||
| 666 | memset(sk_pppox(po) + 1, 0, | 667 | po->pppoe_ifindex = 0; |
| 667 | sizeof(struct pppox_sock) - sizeof(struct sock)); | 668 | memset(&po->pppoe_pa, 0, sizeof(po->pppoe_pa)); |
| 669 | memset(&po->pppoe_relay, 0, sizeof(po->pppoe_relay)); | ||
| 670 | memset(&po->chan, 0, sizeof(po->chan)); | ||
| 671 | po->next = NULL; | ||
| 672 | po->num = 0; | ||
| 673 | |||
| 668 | sk->sk_state = PPPOX_NONE; | 674 | sk->sk_state = PPPOX_NONE; |
| 669 | } | 675 | } |
| 670 | 676 | ||
| @@ -419,6 +419,9 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr, · 418 unmodified lines | |||
| 419 | struct pptp_opt *opt = &po->proto.pptp; | 419 | struct pptp_opt *opt = &po->proto.pptp; |
| 420 | int error = 0; | 420 | int error = 0; |
| 421 | 421 | ||
| 422 | if (sockaddr_len < sizeof(struct sockaddr_pppox)) | ||
| 423 | return -EINVAL; | ||
| 424 | |||
| 422 | lock_sock(sk); | 425 | lock_sock(sk); |
| 423 | 426 | ||
| 424 | opt->src_addr = sp->sa_addr.pptp; | 427 | opt->src_addr = sp->sa_addr.pptp; |
| @@ -440,6 +443,9 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr, · 15 unmodified lines | |||
| 440 | struct flowi4 fl4; | 443 | struct flowi4 fl4; |
| 441 | int error = 0; | 444 | int error = 0; |
| 442 | 445 | ||
| 446 | if (sockaddr_len < sizeof(struct sockaddr_pppox)) | ||
| 447 | return -EINVAL; | ||
| 448 | |||
| 443 | if (sp->sa_protocol != PX_PROTO_PPTP) | 449 | if (sp->sa_protocol != PX_PROTO_PPTP) |
| 444 | return -EINVAL; | 450 | return -EINVAL; |
| 445 | 451 | ||
| @@ -158,7 +158,7 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf) · 157 unmodified lines | |||
| 158 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | 158 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) |
| 159 | goto err; | 159 | goto err; |
| 160 | 160 | ||
| 161 | ret = cdc_ncm_bind_common(dev, intf, data_altsetting, 0); | 161 | ret = cdc_ncm_bind_common(dev, intf, data_altsetting, dev->driver_info->data); |
| 162 | if (ret) | 162 | if (ret) |
| 163 | goto err; | 163 | goto err; |
| 164 | 164 | ||
| @@ -582,6 +582,26 @@ static const struct driver_info cdc_mbim_info_zlp = { · 417 unmodified lines | |||
| 582 | .tx_fixup = cdc_mbim_tx_fixup, | 582 | .tx_fixup = cdc_mbim_tx_fixup, |
| 583 | }; | 583 | }; |
| 584 | 584 | ||
| 585 | /* The spefication explicitly allows NDPs to be placed anywhere in the | ||
| 586 | * frame, but some devices fail unless the NDP is placed after the IP | ||
| 587 | * packets. Using the CDC_NCM_FLAG_NDP_TO_END flags to force this | ||
| 588 | * behaviour. | ||
| 589 | * | ||
| 590 | * Note: The current implementation of this feature restricts each NTB | ||
| 591 | * to a single NDP, implying that multiplexed sessions cannot share an | ||
| 592 | * NTB. This might affect performace for multiplexed sessions. | ||
| 593 | */ | ||
| 594 | static const struct driver_info cdc_mbim_info_ndp_to_end = { | ||
| 595 | .description = "CDC MBIM", | ||
| 596 | .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN, | ||
| 597 | .bind = cdc_mbim_bind, | ||
| 598 | .unbind = cdc_mbim_unbind, | ||
| 599 | .manage_power = cdc_mbim_manage_power, | ||
| 600 | .rx_fixup = cdc_mbim_rx_fixup, | ||
| 601 | .tx_fixup = cdc_mbim_tx_fixup, | ||
| 602 | .data = CDC_NCM_FLAG_NDP_TO_END, | ||
| 603 | }; | ||
| 604 | |||
| 585 | static const struct usb_device_id mbim_devs[] = { | 605 | static const struct usb_device_id mbim_devs[] = { |
| 586 | /* This duplicate NCM entry is intentional. MBIM devices can | 606 | /* This duplicate NCM entry is intentional. MBIM devices can |
| 587 | * be disguised as NCM by default, and this is necessary to | 607 | * be disguised as NCM by default, and this is necessary to |
| @@ -597,6 +617,10 @@ static const struct usb_device_id mbim_devs[] = { · 9 unmodified lines | |||
| 597 | { USB_VENDOR_AND_INTERFACE_INFO(0x0bdb, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | 617 | { USB_VENDOR_AND_INTERFACE_INFO(0x0bdb, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), |
| 598 | .driver_info = (unsigned long)&cdc_mbim_info, | 618 | .driver_info = (unsigned long)&cdc_mbim_info, |
| 599 | }, | 619 | }, |
| 620 | /* Huawei E3372 fails unless NDP comes after the IP packets */ | ||
| 621 | { USB_DEVICE_AND_INTERFACE_INFO(0x12d1, 0x157d, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | ||
| 622 | .driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end, | ||
| 623 | }, | ||
| 600 | /* default entry */ | 624 | /* default entry */ |
| 601 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | 625 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), |
| 602 | .driver_info = (unsigned long)&cdc_mbim_info_zlp, | 626 | .driver_info = (unsigned long)&cdc_mbim_info_zlp, |
| @@ -955,10 +955,18 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_ · 954 unmodified lines | |||
| 955 | * NTH16 header as we would normally do. NDP isn't written to the SKB yet, and | 955 | * NTH16 header as we would normally do. NDP isn't written to the SKB yet, and |
| 956 | * the wNdpIndex field in the header is actually not consistent with reality. It will be later. | 956 | * the wNdpIndex field in the header is actually not consistent with reality. It will be later. |
| 957 | */ | 957 | */ |
| 958 | if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) | 958 | if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { |
| 959 | if (ctx->delayed_ndp16->dwSignature == sign) | 959 | if (ctx->delayed_ndp16->dwSignature == sign) |
| 960 | return ctx->delayed_ndp16; | 960 | return ctx->delayed_ndp16; |
| 961 | 961 | ||
| 962 | /* We can only push a single NDP to the end. Return | ||
| 963 | * NULL to send what we've already got and queue this | ||
| 964 | * skb for later. | ||
| 965 | */ | ||
| 966 | else if (ctx->delayed_ndp16->dwSignature) | ||
| 967 | return NULL; | ||
| 968 | } | ||
| 969 | |||
| 962 | /* follow the chain of NDPs, looking for a match */ | 970 | /* follow the chain of NDPs, looking for a match */ |
| 963 | while (ndpoffset) { | 971 | while (ndpoffset) { |
| 964 | ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset); | 972 | ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset); |
| @@ -3067,17 +3067,6 @@ static int rtl8152_open(struct net_device *netdev) · 3066 unmodified lines | |||
| 3067 | 3067 | ||
| 3068 | mutex_lock(&tp->control); | 3068 | mutex_lock(&tp->control); |
| 3069 | 3069 | ||
| 3070 | /* The WORK_ENABLE may be set when autoresume occurs */ | ||
| 3071 | if (test_bit(WORK_ENABLE, &tp->flags)) { | ||
| 3072 | clear_bit(WORK_ENABLE, &tp->flags); | ||
| 3073 | usb_kill_urb(tp->intr_urb); | ||
| 3074 | cancel_delayed_work_sync(&tp->schedule); | ||
| 3075 | |||
| 3076 | /* disable the tx/rx, if the workqueue has enabled them. */ | ||
| 3077 | if (netif_carrier_ok(netdev)) | ||
| 3078 | tp->rtl_ops.disable(tp); | ||
| 3079 | } | ||
| 3080 | |||
| 3081 | tp->rtl_ops.up(tp); | 3070 | tp->rtl_ops.up(tp); |
| 3082 | 3071 | ||
| 3083 | rtl8152_set_speed(tp, AUTONEG_ENABLE, | 3072 | rtl8152_set_speed(tp, AUTONEG_ENABLE, |
| @@ -3124,12 +3113,6 @@ static int rtl8152_close(struct net_device *netdev) · 40 unmodified lines | |||
| 3124 | } else { | 3113 | } else { |
| 3125 | mutex_lock(&tp->control); | 3114 | mutex_lock(&tp->control); |
| 3126 | 3115 | ||
| 3127 | /* The autosuspend may have been enabled and wouldn't | ||
| 3128 | * be disable when autoresume occurs, because the | ||
| 3129 | * netif_running() would be false. | ||
| 3130 | */ | ||
| 3131 | rtl_runtime_suspend_enable(tp, false); | ||
| 3132 | |||
| 3133 | tp->rtl_ops.down(tp); | 3116 | tp->rtl_ops.down(tp); |
| 3134 | 3117 | ||
| 3135 | mutex_unlock(&tp->control); | 3118 | mutex_unlock(&tp->control); |
| @@ -3512,7 +3495,7 @@ static int rtl8152_resume(struct usb_interface *intf) · 376 unmodified lines | |||
| 3512 | netif_device_attach(tp->netdev); | 3495 | netif_device_attach(tp->netdev); |
| 3513 | } | 3496 | } |
| 3514 | 3497 | ||
| 3515 | if (netif_running(tp->netdev)) { | 3498 | if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) { |
| 3516 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3499 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
| 3517 | rtl_runtime_suspend_enable(tp, false); | 3500 | rtl_runtime_suspend_enable(tp, false); |
| 3518 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3501 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
| @@ -3532,6 +3515,8 @@ static int rtl8152_resume(struct usb_interface *intf) · 13 unmodified lines | |||
| 3532 | } | 3515 | } |
| 3533 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3516 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
| 3534 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3517 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
| 3518 | if (tp->netdev->flags & IFF_UP) | ||
| 3519 | rtl_runtime_suspend_enable(tp, false); | ||
| 3535 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3520 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
| 3536 | } | 3521 | } |
| 3537 | 3522 | ||
| @@ -140,6 +140,12 @@ struct virtnet_info { · 139 unmodified lines | |||
| 140 | 140 | ||
| 141 | /* CPU hot plug notifier */ | 141 | /* CPU hot plug notifier */ |
| 142 | struct notifier_block nb; | 142 | struct notifier_block nb; |
| 143 | |||
| 144 | /* Control VQ buffers: protected by the rtnl lock */ | ||
| 145 | struct virtio_net_ctrl_hdr ctrl_hdr; | ||
| 146 | virtio_net_ctrl_ack ctrl_status; | ||
| 147 | u8 ctrl_promisc; | ||
| 148 | u8 ctrl_allmulti; | ||
| 143 | }; | 149 | }; |
| 144 | 150 | ||
| 145 | struct padded_vnet_hdr { | 151 | struct padded_vnet_hdr { |
| @@ -976,31 +982,30 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, · 830 unmodified lines | |||
| 976 | struct scatterlist *out) | 982 | struct scatterlist *out) |
| 977 | { | 983 | { |
| 978 | struct scatterlist *sgs[4], hdr, stat; | 984 | struct scatterlist *sgs[4], hdr, stat; |
| 979 | struct virtio_net_ctrl_hdr ctrl; | ||
| 980 | virtio_net_ctrl_ack status = ~0; | ||
| 981 | unsigned out_num = 0, tmp; | 985 | unsigned out_num = 0, tmp; |
| 982 | 986 | ||
| 983 | /* Caller should know better */ | 987 | /* Caller should know better */ |
| 984 | BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); | 988 | BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); |
| 985 | 989 | ||
| 986 | ctrl.class = class; | 990 | vi->ctrl_status = ~0; |
| 987 | ctrl.cmd = cmd; | 991 | vi->ctrl_hdr.class = class; |
| 992 | vi->ctrl_hdr.cmd = cmd; | ||
| 988 | /* Add header */ | 993 | /* Add header */ |
| 989 | sg_init_one(&hdr, &ctrl, sizeof(ctrl)); | 994 | sg_init_one(&hdr, &vi->ctrl_hdr, sizeof(vi->ctrl_hdr)); |
| 990 | sgs[out_num++] = &hdr; | 995 | sgs[out_num++] = &hdr; |
| 991 | 996 | ||
| 992 | if (out) | 997 | if (out) |
| 993 | sgs[out_num++] = out; | 998 | sgs[out_num++] = out; |
| 994 | 999 | ||
| 995 | /* Add return status. */ | 1000 | /* Add return status. */ |
| 996 | sg_init_one(&stat, &status, sizeof(status)); | 1001 | sg_init_one(&stat, &vi->ctrl_status, sizeof(vi->ctrl_status)); |
| 997 | sgs[out_num] = &stat; | 1002 | sgs[out_num] = &stat; |
| 998 | 1003 | ||
| 999 | BUG_ON(out_num + 1 > ARRAY_SIZE(sgs)); | 1004 | BUG_ON(out_num + 1 > ARRAY_SIZE(sgs)); |
| 1000 | virtqueue_add_sgs(vi->cvq, sgs, out_num, 1, vi, GFP_ATOMIC); | 1005 | virtqueue_add_sgs(vi->cvq, sgs, out_num, 1, vi, GFP_ATOMIC); |
| 1001 | 1006 | ||
| 1002 | if (unlikely(!virtqueue_kick(vi->cvq))) | 1007 | if (unlikely(!virtqueue_kick(vi->cvq))) |
| 1003 | return status == VIRTIO_NET_OK; | 1008 | return vi->ctrl_status == VIRTIO_NET_OK; |
| 1004 | 1009 | ||
| 1005 | /* Spin for a response, the kick causes an ioport write, trapping | 1010 | /* Spin for a response, the kick causes an ioport write, trapping |
| 1006 | * into the hypervisor, so the request should be handled immediately. | 1011 | * into the hypervisor, so the request should be handled immediately. |
| @@ -1009,7 +1014,7 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, · 2 unmodified lines | |||
| 1009 | !virtqueue_is_broken(vi->cvq)) | 1014 | !virtqueue_is_broken(vi->cvq)) |
| 1010 | cpu_relax(); | 1015 | cpu_relax(); |
| 1011 | 1016 | ||
| 1012 | return status == VIRTIO_NET_OK; | 1017 | return vi->ctrl_status == VIRTIO_NET_OK; |
| 1013 | } | 1018 | } |
| 1014 | 1019 | ||
| 1015 | static int virtnet_set_mac_address(struct net_device *dev, void *p) | 1020 | static int virtnet_set_mac_address(struct net_device *dev, void *p) |
| @@ -1151,7 +1156,6 @@ static void virtnet_set_rx_mode(struct net_device *dev) · 135 unmodified lines | |||
| 1151 | { | 1156 | { |
| 1152 | struct virtnet_info *vi = netdev_priv(dev); | 1157 | struct virtnet_info *vi = netdev_priv(dev); |
| 1153 | struct scatterlist sg[2]; | 1158 | struct scatterlist sg[2]; |
| 1154 | u8 promisc, allmulti; | ||
| 1155 | struct virtio_net_ctrl_mac *mac_data; | 1159 | struct virtio_net_ctrl_mac *mac_data; |
| 1156 | struct netdev_hw_addr *ha; | 1160 | struct netdev_hw_addr *ha; |
| 1157 | int uc_count; | 1161 | int uc_count; |
| @@ -1163,22 +1167,22 @@ static void virtnet_set_rx_mode(struct net_device *dev) · 5 unmodified lines | |||
| 1163 | if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX)) | 1167 | if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX)) |
| 1164 | return; | 1168 | return; |
| 1165 | 1169 | ||
| 1166 | promisc = ((dev->flags & IFF_PROMISC) != 0); | 1170 | vi->ctrl_promisc = ((dev->flags & IFF_PROMISC) != 0); |
| 1167 | allmulti = ((dev->flags & IFF_ALLMULTI) != 0); | 1171 | vi->ctrl_allmulti = ((dev->flags & IFF_ALLMULTI) != 0); |
| 1168 | 1172 | ||
| 1169 | sg_init_one(sg, &promisc, sizeof(promisc)); | 1173 | sg_init_one(sg, &vi->ctrl_promisc, sizeof(vi->ctrl_promisc)); |
| 1170 | 1174 | ||
| 1171 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, | 1175 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, |
| 1172 | VIRTIO_NET_CTRL_RX_PROMISC, sg)) | 1176 | VIRTIO_NET_CTRL_RX_PROMISC, sg)) |
| 1173 | dev_warn(&dev->dev, "Failed to %sable promisc mode.\n", | 1177 | dev_warn(&dev->dev, "Failed to %sable promisc mode.\n", |
| 1174 | promisc ? "en" : "dis"); | 1178 | vi->ctrl_promisc ? "en" : "dis"); |
| 1175 | 1179 | ||
| 1176 | sg_init_one(sg, &allmulti, sizeof(allmulti)); | 1180 | sg_init_one(sg, &vi->ctrl_allmulti, sizeof(vi->ctrl_allmulti)); |
| 1177 | 1181 | ||
| 1178 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, | 1182 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, |
| 1179 | VIRTIO_NET_CTRL_RX_ALLMULTI, sg)) | 1183 | VIRTIO_NET_CTRL_RX_ALLMULTI, sg)) |
| 1180 | dev_warn(&dev->dev, "Failed to %sable allmulti mode.\n", | 1184 | dev_warn(&dev->dev, "Failed to %sable allmulti mode.\n", |
| 1181 | allmulti ? "en" : "dis"); | 1185 | vi->ctrl_allmulti ? "en" : "dis"); |
| 1182 | 1186 | ||
| 1183 | uc_count = netdev_uc_count(dev); | 1187 | uc_count = netdev_uc_count(dev); |
| 1184 | mc_count = netdev_mc_count(dev); | 1188 | mc_count = netdev_mc_count(dev); |
| @@ -1158,7 +1158,6 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, · 1157 unmodified lines | |||
| 1158 | struct pcpu_sw_netstats *stats; | 1158 | struct pcpu_sw_netstats *stats; |
| 1159 | union vxlan_addr saddr; | 1159 | union vxlan_addr saddr; |
| 1160 | int err = 0; | 1160 | int err = 0; |
| 1161 | union vxlan_addr *remote_ip; | ||
| 1162 | 1161 | ||
| 1163 | /* For flow based devices, map all packets to VNI 0 */ | 1162 | /* For flow based devices, map all packets to VNI 0 */ |
| 1164 | if (vs->flags & VXLAN_F_COLLECT_METADATA) | 1163 | if (vs->flags & VXLAN_F_COLLECT_METADATA) |
| @@ -1169,7 +1168,6 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, · 4 unmodified lines | |||
| 1169 | if (!vxlan) | 1168 | if (!vxlan) |
| 1170 | goto drop; | 1169 | goto drop; |
| 1171 | 1170 | ||
| 1172 | remote_ip = &vxlan->default_dst.remote_ip; | ||
| 1173 | skb_reset_mac_header(skb); | 1171 | skb_reset_mac_header(skb); |
| 1174 | skb_scrub_packet(skb, !net_eq(vxlan->net, dev_net(vxlan->dev))); | 1172 | skb_scrub_packet(skb, !net_eq(vxlan->net, dev_net(vxlan->dev))); |
| 1175 | skb->protocol = eth_type_trans(skb, vxlan->dev); | 1173 | skb->protocol = eth_type_trans(skb, vxlan->dev); |
| @@ -1179,8 +1177,8 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, · 3 unmodified lines | |||
| 1179 | if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr)) | 1177 | if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr)) |
| 1180 | goto drop; | 1178 | goto drop; |
| 1181 | 1179 | ||
| 1182 | /* Re-examine inner Ethernet packet */ | 1180 | /* Get data from the outer IP header */ |
| 1183 | if (remote_ip->sa.sa_family == AF_INET) { | 1181 | if (vxlan_get_sk_family(vs) == AF_INET) { |
| 1184 | oip = ip_hdr(skb); | 1182 | oip = ip_hdr(skb); |
| 1185 | saddr.sin.sin_addr.s_addr = oip->saddr; | 1183 | saddr.sin.sin_addr.s_addr = oip->saddr; |
| 1186 | saddr.sa.sa_family = AF_INET; | 1184 | saddr.sa.sa_family = AF_INET; |
| @@ -1848,6 +1846,34 @@ static int vxlan_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *sk · 661 unmodified lines | |||
| 1848 | !(vxflags & VXLAN_F_UDP_CSUM)); | 1846 | !(vxflags & VXLAN_F_UDP_CSUM)); |
| 1849 | } | 1847 | } |
| 1850 | 1848 | ||
| 1849 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 1850 | static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan, | ||
| 1851 | struct sk_buff *skb, int oif, | ||
| 1852 | const struct in6_addr *daddr, | ||
| 1853 | struct in6_addr *saddr) | ||
| 1854 | { | ||
| 1855 | struct dst_entry *ndst; | ||
| 1856 | struct flowi6 fl6; | ||
| 1857 | int err; | ||
| 1858 | |||
| 1859 | memset(&fl6, 0, sizeof(fl6)); | ||
| 1860 | fl6.flowi6_oif = oif; | ||
| 1861 | fl6.daddr = *daddr; | ||
| 1862 | fl6.saddr = vxlan->cfg.saddr.sin6.sin6_addr; | ||
| 1863 | fl6.flowi6_mark = skb->mark; | ||
| 1864 | fl6.flowi6_proto = IPPROTO_UDP; | ||
| 1865 | |||
| 1866 | err = ipv6_stub->ipv6_dst_lookup(vxlan->net, | ||
| 1867 | vxlan->vn6_sock->sock->sk, | ||
| 1868 | &ndst, &fl6); | ||
| 1869 | if (err < 0) | ||
| 1870 | return ERR_PTR(err); | ||
| 1871 | |||
| 1872 | *saddr = fl6.saddr; | ||
| 1873 | return ndst; | ||
| 1874 | } | ||
| 1875 | #endif | ||
| 1876 | |||
| 1851 | /* Bypass encapsulation if the destination is local */ | 1877 | /* Bypass encapsulation if the destination is local */ |
| 1852 | static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, | 1878 | static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, |
| 1853 | struct vxlan_dev *dst_vxlan) | 1879 | struct vxlan_dev *dst_vxlan) |
| @@ -2035,21 +2061,17 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, · 181 unmodified lines | |||
| 2035 | #if IS_ENABLED(CONFIG_IPV6) | 2061 | #if IS_ENABLED(CONFIG_IPV6) |
| 2036 | } else { | 2062 | } else { |
| 2037 | struct dst_entry *ndst; | 2063 | struct dst_entry *ndst; |
| 2038 | struct flowi6 fl6; | 2064 | struct in6_addr saddr; |
| 2039 | u32 rt6i_flags; | 2065 | u32 rt6i_flags; |
| 2040 | 2066 | ||
| 2041 | if (!vxlan->vn6_sock) | 2067 | if (!vxlan->vn6_sock) |
| 2042 | goto drop; | 2068 | goto drop; |
| 2043 | sk = vxlan->vn6_sock->sock->sk; | 2069 | sk = vxlan->vn6_sock->sock->sk; |
| 2044 | 2070 | ||
| 2045 | memset(&fl6, 0, sizeof(fl6)); | 2071 | ndst = vxlan6_get_route(vxlan, skb, |
| 2046 | fl6.flowi6_oif = rdst ? rdst->remote_ifindex : 0; | 2072 | rdst ? rdst->remote_ifindex : 0, |
| 2047 | fl6.daddr = dst->sin6.sin6_addr; | 2073 | &dst->sin6.sin6_addr, &saddr); |
| 2048 | fl6.saddr = vxlan->cfg.saddr.sin6.sin6_addr; | 2074 | if (IS_ERR(ndst)) { |
| 2049 | fl6.flowi6_mark = skb->mark; | ||
| 2050 | fl6.flowi6_proto = IPPROTO_UDP; | ||
| 2051 | |||
| 2052 | if (ipv6_stub->ipv6_dst_lookup(vxlan->net, sk, &ndst, &fl6)) { | ||
| 2053 | netdev_dbg(dev, "no route to %pI6\n", | 2075 | netdev_dbg(dev, "no route to %pI6\n", |
| 2054 | &dst->sin6.sin6_addr); | 2076 | &dst->sin6.sin6_addr); |
| 2055 | dev->stats.tx_carrier_errors++; | 2077 | dev->stats.tx_carrier_errors++; |
| @@ -2081,7 +2103,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, · 25 unmodified lines | |||
| 2081 | } | 2103 | } |
| 2082 | 2104 | ||
| 2083 | ttl = ttl ? : ip6_dst_hoplimit(ndst); | 2105 | ttl = ttl ? : ip6_dst_hoplimit(ndst); |
| 2084 | err = vxlan6_xmit_skb(ndst, sk, skb, dev, &fl6.saddr, &fl6.daddr, | 2106 | err = vxlan6_xmit_skb(ndst, sk, skb, dev, &saddr, &dst->sin6.sin6_addr, |
| 2085 | 0, ttl, src_port, dst_port, htonl(vni << 8), md, | 2107 | 0, ttl, src_port, dst_port, htonl(vni << 8), md, |
| 2086 | !net_eq(vxlan->net, dev_net(vxlan->dev)), | 2108 | !net_eq(vxlan->net, dev_net(vxlan->dev)), |
| 2087 | flags); | 2109 | flags); |
| @@ -2395,9 +2417,30 @@ static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) · 307 unmodified lines | |||
| 2395 | vxlan->cfg.port_max, true); | 2417 | vxlan->cfg.port_max, true); |
| 2396 | dport = info->key.tp_dst ? : vxlan->cfg.dst_port; | 2418 | dport = info->key.tp_dst ? : vxlan->cfg.dst_port; |
| 2397 | 2419 | ||
| 2398 | if (ip_tunnel_info_af(info) == AF_INET) | 2420 | if (ip_tunnel_info_af(info) == AF_INET) { |
| 2421 | if (!vxlan->vn4_sock) | ||
| 2422 | return -EINVAL; | ||
| 2399 | return egress_ipv4_tun_info(dev, skb, info, sport, dport); | 2423 | return egress_ipv4_tun_info(dev, skb, info, sport, dport); |
| 2400 | return -EINVAL; | 2424 | } else { |
| 2425 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 2426 | struct dst_entry *ndst; | ||
| 2427 | |||
| 2428 | if (!vxlan->vn6_sock) | ||
| 2429 | return -EINVAL; | ||
| 2430 | ndst = vxlan6_get_route(vxlan, skb, 0, | ||
| 2431 | &info->key.u.ipv6.dst, | ||
| 2432 | &info->key.u.ipv6.src); | ||
| 2433 | if (IS_ERR(ndst)) | ||
| 2434 | return PTR_ERR(ndst); | ||
| 2435 | dst_release(ndst); | ||
| 2436 | |||
| 2437 | info->key.tp_src = sport; | ||
| 2438 | info->key.tp_dst = dport; | ||
| 2439 | #else /* !CONFIG_IPV6 */ | ||
| 2440 | return -EPFNOSUPPORT; | ||
| 2441 | #endif | ||
| 2442 | } | ||
| 2443 | return 0; | ||
| 2401 | } | 2444 | } |
| 2402 | 2445 | ||
| 2403 | static const struct net_device_ops vxlan_netdev_ops = { | 2446 | static const struct net_device_ops vxlan_netdev_ops = { |
| @@ -258,18 +258,18 @@ static struct xenvif_rx_meta *get_next_rx_buffer(struct xenvif_queue *queue, · 257 unmodified lines | |||
| 258 | struct netrx_pending_operations *npo) | 258 | struct netrx_pending_operations *npo) |
| 259 | { | 259 | { |
| 260 | struct xenvif_rx_meta *meta; | 260 | struct xenvif_rx_meta *meta; |
| 261 | struct xen_netif_rx_request *req; | 261 | struct xen_netif_rx_request req; |
| 262 | 262 | ||
| 263 | req = RING_GET_REQUEST(&queue->rx, queue->rx.req_cons++); | 263 | RING_COPY_REQUEST(&queue->rx, queue->rx.req_cons++, &req); |
| 264 | 264 | ||
| 265 | meta = npo->meta + npo->meta_prod++; | 265 | meta = npo->meta + npo->meta_prod++; |
| 266 | meta->gso_type = XEN_NETIF_GSO_TYPE_NONE; | 266 | meta->gso_type = XEN_NETIF_GSO_TYPE_NONE; |
| 267 | meta->gso_size = 0; | 267 | meta->gso_size = 0; |
| 268 | meta->size = 0; | 268 | meta->size = 0; |
| 269 | meta->id = req->id; | 269 | meta->id = req.id; |
| 270 | 270 | ||
| 271 | npo->copy_off = 0; | 271 | npo->copy_off = 0; |
| 272 | npo->copy_gref = req->gref; | 272 | npo->copy_gref = req.gref; |
| 273 | 273 | ||
| 274 | return meta; | 274 | return meta; |
| 275 | } | 275 | } |
| @@ -424,7 +424,7 @@ static int xenvif_gop_skb(struct sk_buff *skb, · 148 unmodified lines | |||
| 424 | struct xenvif *vif = netdev_priv(skb->dev); | 424 | struct xenvif *vif = netdev_priv(skb->dev); |
| 425 | int nr_frags = skb_shinfo(skb)->nr_frags; | 425 | int nr_frags = skb_shinfo(skb)->nr_frags; |
| 426 | int i; | 426 | int i; |
| 427 | struct xen_netif_rx_request *req; | 427 | struct xen_netif_rx_request req; |
| 428 | struct xenvif_rx_meta *meta; | 428 | struct xenvif_rx_meta *meta; |
| 429 | unsigned char *data; | 429 | unsigned char *data; |
| 430 | int head = 1; | 430 | int head = 1; |
| @@ -443,15 +443,15 @@ static int xenvif_gop_skb(struct sk_buff *skb, · 12 unmodified lines | |||
| 443 | 443 | ||
| 444 | /* Set up a GSO prefix descriptor, if necessary */ | 444 | /* Set up a GSO prefix descriptor, if necessary */ |
| 445 | if ((1 << gso_type) & vif->gso_prefix_mask) { | 445 | if ((1 << gso_type) & vif->gso_prefix_mask) { |
| 446 | req = RING_GET_REQUEST(&queue->rx, queue->rx.req_cons++); | 446 | RING_COPY_REQUEST(&queue->rx, queue->rx.req_cons++, &req); |
| 447 | meta = npo->meta + npo->meta_prod++; | 447 | meta = npo->meta + npo->meta_prod++; |
| 448 | meta->gso_type = gso_type; | 448 | meta->gso_type = gso_type; |
| 449 | meta->gso_size = skb_shinfo(skb)->gso_size; | 449 | meta->gso_size = skb_shinfo(skb)->gso_size; |
| 450 | meta->size = 0; | 450 | meta->size = 0; |
| 451 | meta->id = req->id; | 451 | meta->id = req.id; |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | req = RING_GET_REQUEST(&queue->rx, queue->rx.req_cons++); | 454 | RING_COPY_REQUEST(&queue->rx, queue->rx.req_cons++, &req); |
| 455 | meta = npo->meta + npo->meta_prod++; | 455 | meta = npo->meta + npo->meta_prod++; |
| 456 | 456 | ||
| 457 | if ((1 << gso_type) & vif->gso_mask) { | 457 | if ((1 << gso_type) & vif->gso_mask) { |
| @@ -463,9 +463,9 @@ static int xenvif_gop_skb(struct sk_buff *skb, · 5 unmodified lines | |||
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | meta->size = 0; | 465 | meta->size = 0; |
| 466 | meta->id = req->id; | 466 | meta->id = req.id; |
| 467 | npo->copy_off = 0; | 467 | npo->copy_off = 0; |
| 468 | npo->copy_gref = req->gref; | 468 | npo->copy_gref = req.gref; |
| 469 | 469 | ||
| 470 | data = skb->data; | 470 | data = skb->data; |
| 471 | while (data < skb_tail_pointer(skb)) { | 471 | while (data < skb_tail_pointer(skb)) { |
| @@ -679,9 +679,7 @@ static void tx_add_credit(struct xenvif_queue *queue) · 207 unmodified lines | |||
| 679 | * Allow a burst big enough to transmit a jumbo packet of up to 128kB. | 679 | * Allow a burst big enough to transmit a jumbo packet of up to 128kB. |
| 680 | * Otherwise the interface can seize up due to insufficient credit. | 680 | * Otherwise the interface can seize up due to insufficient credit. |
| 681 | */ | 681 | */ |
| 682 | max_burst = RING_GET_REQUEST(&queue->tx, queue->tx.req_cons)->size; | 682 | max_burst = max(131072UL, queue->credit_bytes); |
| 683 | max_burst = min(max_burst, 131072UL); | ||
| 684 | max_burst = max(max_burst, queue->credit_bytes); | ||
| 685 | 683 | ||
| 686 | /* Take care that adding a new chunk of credit doesn't wrap to zero. */ | 684 | /* Take care that adding a new chunk of credit doesn't wrap to zero. */ |
| 687 | max_credit = queue->remaining_credit + queue->credit_bytes; | 685 | max_credit = queue->remaining_credit + queue->credit_bytes; |
| @@ -711,7 +709,7 @@ static void xenvif_tx_err(struct xenvif_queue *queue, · 23 unmodified lines | |||
| 711 | spin_unlock_irqrestore(&queue->response_lock, flags); | 709 | spin_unlock_irqrestore(&queue->response_lock, flags); |
| 712 | if (cons == end) | 710 | if (cons == end) |
| 713 | break; | 711 | break; |
| 714 | txp = RING_GET_REQUEST(&queue->tx, cons++); | 712 | RING_COPY_REQUEST(&queue->tx, cons++, txp); |
| 715 | } while (1); | 713 | } while (1); |
| 716 | queue->tx.req_cons = cons; | 714 | queue->tx.req_cons = cons; |
| 717 | } | 715 | } |
| @@ -778,8 +776,7 @@ static int xenvif_count_requests(struct xenvif_queue *queue, · 60 unmodified lines | |||
| 778 | if (drop_err) | 776 | if (drop_err) |
| 779 | txp = &dropped_tx; | 777 | txp = &dropped_tx; |
| 780 | 778 | ||
| 781 | memcpy(txp, RING_GET_REQUEST(&queue->tx, cons + slots), | 779 | RING_COPY_REQUEST(&queue->tx, cons + slots, txp); |
| 782 | sizeof(*txp)); | ||
| 783 | 780 | ||
| 784 | /* If the guest submitted a frame >= 64 KiB then | 781 | /* If the guest submitted a frame >= 64 KiB then |
| 785 | * first->size overflowed and following slots will | 782 | * first->size overflowed and following slots will |
| @@ -1112,8 +1109,7 @@ static int xenvif_get_extras(struct xenvif_queue *queue, · 326 unmodified lines | |||
| 1112 | return -EBADR; | 1109 | return -EBADR; |
| 1113 | } | 1110 | } |
| 1114 | 1111 | ||
| 1115 | memcpy(&extra, RING_GET_REQUEST(&queue->tx, cons), | 1112 | RING_COPY_REQUEST(&queue->tx, cons, &extra); |
| 1116 | sizeof(extra)); | ||
| 1117 | if (unlikely(!extra.type || | 1113 | if (unlikely(!extra.type || |
| 1118 | extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) { | 1114 | extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) { |
| 1119 | queue->tx.req_cons = ++cons; | 1115 | queue->tx.req_cons = ++cons; |
| @@ -1322,7 +1318,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 202 unmodified lines | |||
| 1322 | 1318 | ||
| 1323 | idx = queue->tx.req_cons; | 1319 | idx = queue->tx.req_cons; |
| 1324 | rmb(); /* Ensure that we see the request before we copy it. */ | 1320 | rmb(); /* Ensure that we see the request before we copy it. */ |
| 1325 | memcpy(&txreq, RING_GET_REQUEST(&queue->tx, idx), sizeof(txreq)); | 1321 | RING_COPY_REQUEST(&queue->tx, idx, &txreq); |
| 1326 | 1322 | ||
| 1327 | /* Credit-based scheduling. */ | 1323 | /* Credit-based scheduling. */ |
| 1328 | if (txreq.size > queue->remaining_credit && | 1324 | if (txreq.size > queue->remaining_credit && |
| @@ -271,9 +271,9 @@ static int init_grps(struct nvm_id *nvm_id, struct nvme_nvm_id *nvme_nvm_id) · 270 unmodified lines | |||
| 271 | return 0; | 271 | return 0; |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | static int nvme_nvm_identity(struct request_queue *q, struct nvm_id *nvm_id) | 274 | static int nvme_nvm_identity(struct nvm_dev *nvmdev, struct nvm_id *nvm_id) |
| 275 | { | 275 | { |
| 276 | struct nvme_ns *ns = q->queuedata; | 276 | struct nvme_ns *ns = nvmdev->q->queuedata; |
| 277 | struct nvme_dev *dev = ns->dev; | 277 | struct nvme_dev *dev = ns->dev; |
| 278 | struct nvme_nvm_id *nvme_nvm_id; | 278 | struct nvme_nvm_id *nvme_nvm_id; |
| 279 | struct nvme_nvm_command c = {}; | 279 | struct nvme_nvm_command c = {}; |
| @@ -308,10 +308,10 @@ out: · 28 unmodified lines | |||
| 308 | return ret; | 308 | return ret; |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | static int nvme_nvm_get_l2p_tbl(struct request_queue *q, u64 slba, u32 nlb, | 311 | static int nvme_nvm_get_l2p_tbl(struct nvm_dev *nvmdev, u64 slba, u32 nlb, |
| 312 | nvm_l2p_update_fn *update_l2p, void *priv) | 312 | nvm_l2p_update_fn *update_l2p, void *priv) |
| 313 | { | 313 | { |
| 314 | struct nvme_ns *ns = q->queuedata; | 314 | struct nvme_ns *ns = nvmdev->q->queuedata; |
| 315 | struct nvme_dev *dev = ns->dev; | 315 | struct nvme_dev *dev = ns->dev; |
| 316 | struct nvme_nvm_command c = {}; | 316 | struct nvme_nvm_command c = {}; |
| 317 | u32 len = queue_max_hw_sectors(dev->admin_q) << 9; | 317 | u32 len = queue_max_hw_sectors(dev->admin_q) << 9; |
| @@ -415,10 +415,10 @@ out: · 97 unmodified lines | |||
| 415 | return ret; | 415 | return ret; |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | static int nvme_nvm_set_bb_tbl(struct request_queue *q, struct nvm_rq *rqd, | 418 | static int nvme_nvm_set_bb_tbl(struct nvm_dev *nvmdev, struct nvm_rq *rqd, |
| 419 | int type) | 419 | int type) |
| 420 | { | 420 | { |
| 421 | struct nvme_ns *ns = q->queuedata; | 421 | struct nvme_ns *ns = nvmdev->q->queuedata; |
| 422 | struct nvme_dev *dev = ns->dev; | 422 | struct nvme_dev *dev = ns->dev; |
| 423 | struct nvme_nvm_command c = {}; | 423 | struct nvme_nvm_command c = {}; |
| 424 | int ret = 0; | 424 | int ret = 0; |
| @@ -455,7 +455,7 @@ static void nvme_nvm_end_io(struct request *rq, int error) · 30 unmodified lines | |||
| 455 | struct nvm_rq *rqd = rq->end_io_data; | 455 | struct nvm_rq *rqd = rq->end_io_data; |
| 456 | struct nvm_dev *dev = rqd->dev; | 456 | struct nvm_dev *dev = rqd->dev; |
| 457 | 457 | ||
| 458 | if (dev->mt->end_io(rqd, error)) | 458 | if (dev->mt && dev->mt->end_io(rqd, error)) |
| 459 | pr_err("nvme: err status: %x result: %lx\n", | 459 | pr_err("nvme: err status: %x result: %lx\n", |
| 460 | rq->errors, (unsigned long)rq->special); | 460 | rq->errors, (unsigned long)rq->special); |
| 461 | 461 | ||
| @@ -463,8 +463,9 @@ static void nvme_nvm_end_io(struct request *rq, int error) · 1 unmodified line | |||
| 463 | blk_mq_free_request(rq); | 463 | blk_mq_free_request(rq); |
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | static int nvme_nvm_submit_io(struct request_queue *q, struct nvm_rq *rqd) | 466 | static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd) |
| 467 | { | 467 | { |
| 468 | struct request_queue *q = dev->q; | ||
| 468 | struct nvme_ns *ns = q->queuedata; | 469 | struct nvme_ns *ns = q->queuedata; |
| 469 | struct request *rq; | 470 | struct request *rq; |
| 470 | struct bio *bio = rqd->bio; | 471 | struct bio *bio = rqd->bio; |
| @@ -502,8 +503,9 @@ static int nvme_nvm_submit_io(struct request_queue *q, struct nvm_rq *rqd) · 31 unmodified lines | |||
| 502 | return 0; | 503 | return 0; |
| 503 | } | 504 | } |
| 504 | 505 | ||
| 505 | static int nvme_nvm_erase_block(struct request_queue *q, struct nvm_rq *rqd) | 506 | static int nvme_nvm_erase_block(struct nvm_dev *dev, struct nvm_rq *rqd) |
| 506 | { | 507 | { |
| 508 | struct request_queue *q = dev->q; | ||
| 507 | struct nvme_ns *ns = q->queuedata; | 509 | struct nvme_ns *ns = q->queuedata; |
| 508 | struct nvme_nvm_command c = {}; | 510 | struct nvme_nvm_command c = {}; |
| 509 | 511 | ||
| @@ -515,9 +517,9 @@ static int nvme_nvm_erase_block(struct request_queue *q, struct nvm_rq *rqd) · 5 unmodified lines | |||
| 515 | return nvme_submit_sync_cmd(q, (struct nvme_command *)&c, NULL, 0); | 517 | return nvme_submit_sync_cmd(q, (struct nvme_command *)&c, NULL, 0); |
| 516 | } | 518 | } |
| 517 | 519 | ||
| 518 | static void *nvme_nvm_create_dma_pool(struct request_queue *q, char *name) | 520 | static void *nvme_nvm_create_dma_pool(struct nvm_dev *nvmdev, char *name) |
| 519 | { | 521 | { |
| 520 | struct nvme_ns *ns = q->queuedata; | 522 | struct nvme_ns *ns = nvmdev->q->queuedata; |
| 521 | struct nvme_dev *dev = ns->dev; | 523 | struct nvme_dev *dev = ns->dev; |
| 522 | 524 | ||
| 523 | return dma_pool_create(name, dev->dev, PAGE_SIZE, PAGE_SIZE, 0); | 525 | return dma_pool_create(name, dev->dev, PAGE_SIZE, PAGE_SIZE, 0); |
| @@ -530,7 +532,7 @@ static void nvme_nvm_destroy_dma_pool(void *pool) · 6 unmodified lines | |||
| 530 | dma_pool_destroy(dma_pool); | 532 | dma_pool_destroy(dma_pool); |
| 531 | } | 533 | } |
| 532 | 534 | ||
| 533 | static void *nvme_nvm_dev_dma_alloc(struct request_queue *q, void *pool, | 535 | static void *nvme_nvm_dev_dma_alloc(struct nvm_dev *dev, void *pool, |
| 534 | gfp_t mem_flags, dma_addr_t *dma_handler) | 536 | gfp_t mem_flags, dma_addr_t *dma_handler) |
| 535 | { | 537 | { |
| 536 | return dma_pool_alloc(pool, mem_flags, dma_handler); | 538 | return dma_pool_alloc(pool, mem_flags, dma_handler); |
| @@ -2540,8 +2540,17 @@ static void nvme_ns_remove(struct nvme_ns *ns) · 2539 unmodified lines | |||
| 2540 | { | 2540 | { |
| 2541 | bool kill = nvme_io_incapable(ns->dev) && !blk_queue_dying(ns->queue); | 2541 | bool kill = nvme_io_incapable(ns->dev) && !blk_queue_dying(ns->queue); |
| 2542 | 2542 | ||
| 2543 | if (kill) | 2543 | if (kill) { |
| 2544 | blk_set_queue_dying(ns->queue); | 2544 | blk_set_queue_dying(ns->queue); |
| 2545 | |||
| 2546 | /* | ||
| 2547 | * The controller was shutdown first if we got here through | ||
| 2548 | * device removal. The shutdown may requeue outstanding | ||
| 2549 | * requests. These need to be aborted immediately so | ||
| 2550 | * del_gendisk doesn't block indefinitely for their completion. | ||
| 2551 | */ | ||
| 2552 | blk_mq_abort_requeue_list(ns->queue); | ||
| 2553 | } | ||
| 2545 | if (ns->disk->flags & GENHD_FL_UP) | 2554 | if (ns->disk->flags & GENHD_FL_UP) |
| 2546 | del_gendisk(ns->disk); | 2555 | del_gendisk(ns->disk); |
| 2547 | if (kill || !blk_queue_dying(ns->queue)) { | 2556 | if (kill || !blk_queue_dying(ns->queue)) { |
| @@ -2977,6 +2986,15 @@ static void nvme_dev_remove(struct nvme_dev *dev) · 429 unmodified lines | |||
| 2977 | { | 2986 | { |
| 2978 | struct nvme_ns *ns, *next; | 2987 | struct nvme_ns *ns, *next; |
| 2979 | 2988 | ||
| 2989 | if (nvme_io_incapable(dev)) { | ||
| 2990 | /* | ||
| 2991 | * If the device is not capable of IO (surprise hot-removal, | ||
| 2992 | * for example), we need to quiesce prior to deleting the | ||
| 2993 | * namespaces. This will end outstanding requests and prevent | ||
| 2994 | * attempts to sync dirty data. | ||
| 2995 | */ | ||
| 2996 | nvme_dev_shutdown(dev); | ||
| 2997 | } | ||
| 2980 | list_for_each_entry_safe(ns, next, &dev->namespaces, list) | 2998 | list_for_each_entry_safe(ns, next, &dev->namespaces, list) |
| 2981 | nvme_ns_remove(ns); | 2999 | nvme_ns_remove(ns); |
| 2982 | } | 3000 | } |
| @@ -485,9 +485,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, · 484 unmodified lines | |||
| 485 | int rone; | 485 | int rone; |
| 486 | u64 offset = OF_BAD_ADDR; | 486 | u64 offset = OF_BAD_ADDR; |
| 487 | 487 | ||
| 488 | /* Normally, an absence of a "ranges" property means we are | 488 | /* |
| 489 | * Normally, an absence of a "ranges" property means we are | ||
| 489 | * crossing a non-translatable boundary, and thus the addresses | 490 | * crossing a non-translatable boundary, and thus the addresses |
| 490 | * below the current not cannot be converted to CPU physical ones. | 491 | * below the current cannot be converted to CPU physical ones. |
| 491 | * Unfortunately, while this is very clear in the spec, it's not | 492 | * Unfortunately, while this is very clear in the spec, it's not |
| 492 | * what Apple understood, and they do have things like /uni-n or | 493 | * what Apple understood, and they do have things like /uni-n or |
| 493 | * /ht nodes with no "ranges" property and a lot of perfectly | 494 | * /ht nodes with no "ranges" property and a lot of perfectly |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
| 14 | #include <linux/initrd.h> | 14 | #include <linux/initrd.h> |
| 15 | #include <linux/memblock.h> | 15 | #include <linux/memblock.h> |
| 16 | #include <linux/mutex.h> | ||
| 16 | #include <linux/of.h> | 17 | #include <linux/of.h> |
| 17 | #include <linux/of_fdt.h> | 18 | #include <linux/of_fdt.h> |
| 18 | #include <linux/of_reserved_mem.h> | 19 | #include <linux/of_reserved_mem.h> |
| @@ -436,6 +437,8 @@ static void *kernel_tree_alloc(u64 size, u64 align) · 417 unmodified lines | |||
| 436 | return kzalloc(size, GFP_KERNEL); | 437 | return kzalloc(size, GFP_KERNEL); |
| 437 | } | 438 | } |
| 438 | 439 | ||
| 440 | static DEFINE_MUTEX(of_fdt_unflatten_mutex); | ||
| 441 | |||
| 439 | /** | 442 | /** |
| 440 | * of_fdt_unflatten_tree - create tree of device_nodes from flat blob | 443 | * of_fdt_unflatten_tree - create tree of device_nodes from flat blob |
| 441 | * | 444 | * |
| @@ -447,7 +450,9 @@ static void *kernel_tree_alloc(u64 size, u64 align) · 5 unmodified lines | |||
| 447 | void of_fdt_unflatten_tree(const unsigned long *blob, | 450 | void of_fdt_unflatten_tree(const unsigned long *blob, |
| 448 | struct device_node **mynodes) | 451 | struct device_node **mynodes) |
| 449 | { | 452 | { |
| 453 | mutex_lock(&of_fdt_unflatten_mutex); | ||
| 450 | __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc); | 454 | __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc); |
| 455 | mutex_unlock(&of_fdt_unflatten_mutex); | ||
| 451 | } | 456 | } |
| 452 | EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree); | 457 | EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree); |
| 453 | 458 | ||
| @@ -1041,7 +1046,7 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) · 587 unmodified lines | |||
| 1041 | int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base, | 1046 | int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base, |
| 1042 | phys_addr_t size, bool nomap) | 1047 | phys_addr_t size, bool nomap) |
| 1043 | { | 1048 | { |
| 1044 | pr_err("Reserved memory not supported, ignoring range 0x%pa - 0x%pa%s\n", | 1049 | pr_err("Reserved memory not supported, ignoring range %pa - %pa%s\n", |
| 1045 | &base, &size, nomap ? " (nomap)" : ""); | 1050 | &base, &size, nomap ? " (nomap)" : ""); |
| 1046 | return -ENOSYS; | 1051 | return -ENOSYS; |
| 1047 | } | 1052 | } |
| @@ -53,7 +53,7 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); · 52 unmodified lines | |||
| 53 | * Returns a pointer to the interrupt parent node, or NULL if the interrupt | 53 | * Returns a pointer to the interrupt parent node, or NULL if the interrupt |
| 54 | * parent could not be determined. | 54 | * parent could not be determined. |
| 55 | */ | 55 | */ |
| 56 | static struct device_node *of_irq_find_parent(struct device_node *child) | 56 | struct device_node *of_irq_find_parent(struct device_node *child) |
| 57 | { | 57 | { |
| 58 | struct device_node *p; | 58 | struct device_node *p; |
| 59 | const __be32 *parp; | 59 | const __be32 *parp; |
| @@ -77,6 +77,7 @@ static struct device_node *of_irq_find_parent(struct device_node *child) · 17 unmodified lines | |||
| 77 | 77 | ||
| 78 | return p; | 78 | return p; |
| 79 | } | 79 | } |
| 80 | EXPORT_SYMBOL_GPL(of_irq_find_parent); | ||
| 80 | 81 | ||
| 81 | /** | 82 | /** |
| 82 | * of_irq_parse_raw - Low level interrupt tree parsing | 83 | * of_irq_parse_raw - Low level interrupt tree parsing |
| @@ -206,7 +206,13 @@ static int __init __rmem_cmp(const void *a, const void *b) · 205 unmodified lines | |||
| 206 | { | 206 | { |
| 207 | const struct reserved_mem *ra = a, *rb = b; | 207 | const struct reserved_mem *ra = a, *rb = b; |
| 208 | 208 | ||
| 209 | return ra->base - rb->base; | 209 | if (ra->base < rb->base) |
| 210 | return -1; | ||
| 211 | |||
| 212 | if (ra->base > rb->base) | ||
| 213 | return 1; | ||
| 214 | |||
| 215 | return 0; | ||
| 210 | } | 216 | } |
| 211 | 217 | ||
| 212 | static void __init __rmem_check_for_overlap(void) | 218 | static void __init __rmem_check_for_overlap(void) |
| @@ -104,7 +104,11 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev, · 103 unmodified lines | |||
| 104 | struct scatterlist *contig_sg; /* contig chunk head */ | 104 | struct scatterlist *contig_sg; /* contig chunk head */ |
| 105 | unsigned long dma_offset, dma_len; /* start/len of DMA stream */ | 105 | unsigned long dma_offset, dma_len; /* start/len of DMA stream */ |
| 106 | unsigned int n_mappings = 0; | 106 | unsigned int n_mappings = 0; |
| 107 | unsigned int max_seg_size = dma_get_max_seg_size(dev); | 107 | unsigned int max_seg_size = min(dma_get_max_seg_size(dev), |
| 108 | (unsigned)DMA_CHUNK_SIZE); | ||
| 109 | unsigned int max_seg_boundary = dma_get_seg_boundary(dev) + 1; | ||
| 110 | if (max_seg_boundary) /* check if the addition above didn't overflow */ | ||
| 111 | max_seg_size = min(max_seg_size, max_seg_boundary); | ||
| 108 | 112 | ||
| 109 | while (nents > 0) { | 113 | while (nents > 0) { |
| 110 | 114 | ||
| @@ -138,14 +142,11 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev, · 27 unmodified lines | |||
| 138 | 142 | ||
| 139 | /* | 143 | /* |
| 140 | ** First make sure current dma stream won't | 144 | ** First make sure current dma stream won't |
| 141 | ** exceed DMA_CHUNK_SIZE if we coalesce the | 145 | ** exceed max_seg_size if we coalesce the |
| 142 | ** next entry. | 146 | ** next entry. |
| 143 | */ | 147 | */ |
| 144 | if(unlikely(ALIGN(dma_len + dma_offset + startsg->length, | 148 | if (unlikely(ALIGN(dma_len + dma_offset + startsg->length, IOVP_SIZE) > |
| 145 | IOVP_SIZE) > DMA_CHUNK_SIZE)) | 149 | max_seg_size)) |
| 146 | break; | ||
| 147 | |||
| 148 | if (startsg->length + dma_len > max_seg_size) | ||
| 149 | break; | 150 | break; |
| 150 | 151 | ||
| 151 | /* | 152 | /* |
| @@ -55,8 +55,10 @@ · 54 unmodified lines | |||
| 55 | #define TLP_CFG_DW2(bus, devfn, offset) \ | 55 | #define TLP_CFG_DW2(bus, devfn, offset) \ |
| 56 | (((bus) << 24) | ((devfn) << 16) | (offset)) | 56 | (((bus) << 24) | ((devfn) << 16) | (offset)) |
| 57 | #define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn)) | 57 | #define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn)) |
| 58 | #define TLP_COMP_STATUS(s) (((s) >> 12) & 7) | ||
| 58 | #define TLP_HDR_SIZE 3 | 59 | #define TLP_HDR_SIZE 3 |
| 59 | #define TLP_LOOP 500 | 60 | #define TLP_LOOP 500 |
| 61 | #define RP_DEVFN 0 | ||
| 60 | 62 | ||
| 61 | #define INTX_NUM 4 | 63 | #define INTX_NUM 4 |
| 62 | 64 | ||
| @@ -166,34 +168,41 @@ static bool altera_pcie_valid_config(struct altera_pcie *pcie, · 103 unmodified lines | |||
| 166 | 168 | ||
| 167 | static int tlp_read_packet(struct altera_pcie *pcie, u32 *value) | 169 | static int tlp_read_packet(struct altera_pcie *pcie, u32 *value) |
| 168 | { | 170 | { |
| 169 | u8 loop; | 171 | int i; |
| 170 | bool sop = 0; | 172 | bool sop = 0; |
| 171 | u32 ctrl; | 173 | u32 ctrl; |
| 172 | u32 reg0, reg1; | 174 | u32 reg0, reg1; |
| 175 | u32 comp_status = 1; | ||
| 173 | 176 | ||
| 174 | /* | 177 | /* |
| 175 | * Minimum 2 loops to read TLP headers and 1 loop to read data | 178 | * Minimum 2 loops to read TLP headers and 1 loop to read data |
| 176 | * payload. | 179 | * payload. |
| 177 | */ | 180 | */ |
| 178 | for (loop = 0; loop < TLP_LOOP; loop++) { | 181 | for (i = 0; i < TLP_LOOP; i++) { |
| 179 | ctrl = cra_readl(pcie, RP_RXCPL_STATUS); | 182 | ctrl = cra_readl(pcie, RP_RXCPL_STATUS); |
| 180 | if ((ctrl & RP_RXCPL_SOP) || (ctrl & RP_RXCPL_EOP) || sop) { | 183 | if ((ctrl & RP_RXCPL_SOP) || (ctrl & RP_RXCPL_EOP) || sop) { |
| 181 | reg0 = cra_readl(pcie, RP_RXCPL_REG0); | 184 | reg0 = cra_readl(pcie, RP_RXCPL_REG0); |
| 182 | reg1 = cra_readl(pcie, RP_RXCPL_REG1); | 185 | reg1 = cra_readl(pcie, RP_RXCPL_REG1); |
| 183 | 186 | ||
| 184 | if (ctrl & RP_RXCPL_SOP) | 187 | if (ctrl & RP_RXCPL_SOP) { |
| 185 | sop = true; | 188 | sop = true; |
| 189 | comp_status = TLP_COMP_STATUS(reg1); | ||
| 190 | } | ||
| 186 | 191 | ||
| 187 | if (ctrl & RP_RXCPL_EOP) { | 192 | if (ctrl & RP_RXCPL_EOP) { |
| 193 | if (comp_status) | ||
| 194 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
| 195 | |||
| 188 | if (value) | 196 | if (value) |
| 189 | *value = reg0; | 197 | *value = reg0; |
| 198 | |||
| 190 | return PCIBIOS_SUCCESSFUL; | 199 | return PCIBIOS_SUCCESSFUL; |
| 191 | } | 200 | } |
| 192 | } | 201 | } |
| 193 | udelay(5); | 202 | udelay(5); |
| 194 | } | 203 | } |
| 195 | 204 | ||
| 196 | return -ENOENT; | 205 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 197 | } | 206 | } |
| 198 | 207 | ||
| 199 | static void tlp_write_packet(struct altera_pcie *pcie, u32 *headers, | 208 | static void tlp_write_packet(struct altera_pcie *pcie, u32 *headers, |
| @@ -233,7 +242,7 @@ static int tlp_cfg_dword_read(struct altera_pcie *pcie, u8 bus, u32 devfn, · 33 unmodified lines | |||
| 233 | else | 242 | else |
| 234 | headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1); | 243 | headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1); |
| 235 | 244 | ||
| 236 | headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn), | 245 | headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN), |
| 237 | TLP_READ_TAG, byte_en); | 246 | TLP_READ_TAG, byte_en); |
| 238 | headers[2] = TLP_CFG_DW2(bus, devfn, where); | 247 | headers[2] = TLP_CFG_DW2(bus, devfn, where); |
| 239 | 248 | ||
| @@ -253,7 +262,7 @@ static int tlp_cfg_dword_write(struct altera_pcie *pcie, u8 bus, u32 devfn, · 13 unmodified lines | |||
| 253 | else | 262 | else |
| 254 | headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR1); | 263 | headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR1); |
| 255 | 264 | ||
| 256 | headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn), | 265 | headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN), |
| 257 | TLP_WRITE_TAG, byte_en); | 266 | TLP_WRITE_TAG, byte_en); |
| 258 | headers[2] = TLP_CFG_DW2(bus, devfn, where); | 267 | headers[2] = TLP_CFG_DW2(bus, devfn, where); |
| 259 | 268 | ||
| @@ -458,7 +467,7 @@ static int altera_pcie_init_irq_domain(struct altera_pcie *pcie) · 198 unmodified lines | |||
| 458 | struct device_node *node = dev->of_node; | 467 | struct device_node *node = dev->of_node; |
| 459 | 468 | ||
| 460 | /* Setup INTx */ | 469 | /* Setup INTx */ |
| 461 | pcie->irq_domain = irq_domain_add_linear(node, INTX_NUM, | 470 | pcie->irq_domain = irq_domain_add_linear(node, INTX_NUM + 1, |
| 462 | &intx_domain_ops, pcie); | 471 | &intx_domain_ops, pcie); |
| 463 | if (!pcie->irq_domain) { | 472 | if (!pcie->irq_domain) { |
| 464 | dev_err(dev, "Failed to get a INTx IRQ domain\n"); | 473 | dev_err(dev, "Failed to get a INTx IRQ domain\n"); |
| @@ -54,7 +54,7 @@ static int pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) · 53 unmodified lines | |||
| 54 | struct irq_domain *domain; | 54 | struct irq_domain *domain; |
| 55 | 55 | ||
| 56 | domain = pci_msi_get_domain(dev); | 56 | domain = pci_msi_get_domain(dev); |
| 57 | if (domain) | 57 | if (domain && irq_domain_is_hierarchy(domain)) |
| 58 | return pci_msi_domain_alloc_irqs(domain, dev, nvec, type); | 58 | return pci_msi_domain_alloc_irqs(domain, dev, nvec, type); |
| 59 | 59 | ||
| 60 | return arch_setup_msi_irqs(dev, nvec, type); | 60 | return arch_setup_msi_irqs(dev, nvec, type); |
| @@ -65,7 +65,7 @@ static void pci_msi_teardown_msi_irqs(struct pci_dev *dev) · 4 unmodified lines | |||
| 65 | struct irq_domain *domain; | 65 | struct irq_domain *domain; |
| 66 | 66 | ||
| 67 | domain = pci_msi_get_domain(dev); | 67 | domain = pci_msi_get_domain(dev); |
| 68 | if (domain) | 68 | if (domain && irq_domain_is_hierarchy(domain)) |
| 69 | pci_msi_domain_free_irqs(domain, dev); | 69 | pci_msi_domain_free_irqs(domain, dev); |
| 70 | else | 70 | else |
| 71 | arch_teardown_msi_irqs(dev); | 71 | arch_teardown_msi_irqs(dev); |
| @@ -233,6 +233,7 @@ config PHY_SUN9I_USB · 232 unmodified lines | |||
| 233 | tristate "Allwinner sun9i SoC USB PHY driver" | 233 | tristate "Allwinner sun9i SoC USB PHY driver" |
| 234 | depends on ARCH_SUNXI && HAS_IOMEM && OF | 234 | depends on ARCH_SUNXI && HAS_IOMEM && OF |
| 235 | depends on RESET_CONTROLLER | 235 | depends on RESET_CONTROLLER |
| 236 | depends on USB_COMMON | ||
| 236 | select GENERIC_PHY | 237 | select GENERIC_PHY |
| 237 | help | 238 | help |
| 238 | Enable this to support the transceiver that is part of Allwinner | 239 | Enable this to support the transceiver that is part of Allwinner |
| @@ -128,6 +128,7 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev) · 127 unmodified lines | |||
| 128 | struct phy_provider *provider; | 128 | struct phy_provider *provider; |
| 129 | struct resource *res; | 129 | struct resource *res; |
| 130 | unsigned cnt = 0; | 130 | unsigned cnt = 0; |
| 131 | int ret; | ||
| 131 | 132 | ||
| 132 | if (of_get_child_count(node) == 0) { | 133 | if (of_get_child_count(node) == 0) { |
| 133 | dev_err(dev, "PHY no child node\n"); | 134 | dev_err(dev, "PHY no child node\n"); |
| @@ -154,24 +155,28 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev) · 20 unmodified lines | |||
| 154 | if (of_property_read_u32(child, "reg", &id)) { | 155 | if (of_property_read_u32(child, "reg", &id)) { |
| 155 | dev_err(dev, "missing reg property for %s\n", | 156 | dev_err(dev, "missing reg property for %s\n", |
| 156 | child->name); | 157 | child->name); |
| 157 | return -EINVAL; | 158 | ret = -EINVAL; |
| 159 | goto put_child; | ||
| 158 | } | 160 | } |
| 159 | 161 | ||
| 160 | if (id >= MAX_NUM_PHYS) { | 162 | if (id >= MAX_NUM_PHYS) { |
| 161 | dev_err(dev, "invalid PHY id: %u\n", id); | 163 | dev_err(dev, "invalid PHY id: %u\n", id); |
| 162 | return -EINVAL; | 164 | ret = -EINVAL; |
| 165 | goto put_child; | ||
| 163 | } | 166 | } |
| 164 | 167 | ||
| 165 | if (core->phys[id].phy) { | 168 | if (core->phys[id].phy) { |
| 166 | dev_err(dev, "duplicated PHY id: %u\n", id); | 169 | dev_err(dev, "duplicated PHY id: %u\n", id); |
| 167 | return -EINVAL; | 170 | ret = -EINVAL; |
| 171 | goto put_child; | ||
| 168 | } | 172 | } |
| 169 | 173 | ||
| 170 | p = &core->phys[id]; | 174 | p = &core->phys[id]; |
| 171 | p->phy = devm_phy_create(dev, child, &cygnus_pcie_phy_ops); | 175 | p->phy = devm_phy_create(dev, child, &cygnus_pcie_phy_ops); |
| 172 | if (IS_ERR(p->phy)) { | 176 | if (IS_ERR(p->phy)) { |
| 173 | dev_err(dev, "failed to create PHY\n"); | 177 | dev_err(dev, "failed to create PHY\n"); |
| 174 | return PTR_ERR(p->phy); | 178 | ret = PTR_ERR(p->phy); |
| 179 | goto put_child; | ||
| 175 | } | 180 | } |
| 176 | 181 | ||
| 177 | p->core = core; | 182 | p->core = core; |
| @@ -191,6 +196,9 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev) · 13 unmodified lines | |||
| 191 | dev_dbg(dev, "registered %u PCIe PHY(s)\n", cnt); | 196 | dev_dbg(dev, "registered %u PCIe PHY(s)\n", cnt); |
| 192 | 197 | ||
| 193 | return 0; | 198 | return 0; |
| 199 | put_child: | ||
| 200 | of_node_put(child); | ||
| 201 | return ret; | ||
| 194 | } | 202 | } |
| 195 | 203 | ||
| 196 | static const struct of_device_id cygnus_pcie_phy_match_table[] = { | 204 | static const struct of_device_id cygnus_pcie_phy_match_table[] = { |
| @@ -195,7 +195,7 @@ static int phy_berlin_sata_probe(struct platform_device *pdev) · 194 unmodified lines | |||
| 195 | struct phy_provider *phy_provider; | 195 | struct phy_provider *phy_provider; |
| 196 | struct phy_berlin_priv *priv; | 196 | struct phy_berlin_priv *priv; |
| 197 | struct resource *res; | 197 | struct resource *res; |
| 198 | int i = 0; | 198 | int ret, i = 0; |
| 199 | u32 phy_id; | 199 | u32 phy_id; |
| 200 | 200 | ||
| 201 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | 201 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
| @@ -237,22 +237,27 @@ static int phy_berlin_sata_probe(struct platform_device *pdev) · 35 unmodified lines | |||
| 237 | if (of_property_read_u32(child, "reg", &phy_id)) { | 237 | if (of_property_read_u32(child, "reg", &phy_id)) { |
| 238 | dev_err(dev, "missing reg property in node %s\n", | 238 | dev_err(dev, "missing reg property in node %s\n", |
| 239 | child->name); | 239 | child->name); |
| 240 | return -EINVAL; | 240 | ret = -EINVAL; |
| 241 | goto put_child; | ||
| 241 | } | 242 | } |
| 242 | 243 | ||
| 243 | if (phy_id >= ARRAY_SIZE(phy_berlin_power_down_bits)) { | 244 | if (phy_id >= ARRAY_SIZE(phy_berlin_power_down_bits)) { |
| 244 | dev_err(dev, "invalid reg in node %s\n", child->name); | 245 | dev_err(dev, "invalid reg in node %s\n", child->name); |
| 245 | return -EINVAL; | 246 | ret = -EINVAL; |
| 247 | goto put_child; | ||
| 246 | } | 248 | } |
| 247 | 249 | ||
| 248 | phy_desc = devm_kzalloc(dev, sizeof(*phy_desc), GFP_KERNEL); | 250 | phy_desc = devm_kzalloc(dev, sizeof(*phy_desc), GFP_KERNEL); |
| 249 | if (!phy_desc) | 251 | if (!phy_desc) { |
| 250 | return -ENOMEM; | 252 | ret = -ENOMEM; |
| 253 | goto put_child; | ||
| 254 | } | ||
| 251 | 255 | ||
| 252 | phy = devm_phy_create(dev, NULL, &phy_berlin_sata_ops); | 256 | phy = devm_phy_create(dev, NULL, &phy_berlin_sata_ops); |
| 253 | if (IS_ERR(phy)) { | 257 | if (IS_ERR(phy)) { |
| 254 | dev_err(dev, "failed to create PHY %d\n", phy_id); | 258 | dev_err(dev, "failed to create PHY %d\n", phy_id); |
| 255 | return PTR_ERR(phy); | 259 | ret = PTR_ERR(phy); |
| 260 | goto put_child; | ||
| 256 | } | 261 | } |
| 257 | 262 | ||
| 258 | phy_desc->phy = phy; | 263 | phy_desc->phy = phy; |
| @@ -269,6 +274,9 @@ static int phy_berlin_sata_probe(struct platform_device *pdev) · 10 unmodified lines | |||
| 269 | phy_provider = | 274 | phy_provider = |
| 270 | devm_of_phy_provider_register(dev, phy_berlin_sata_phy_xlate); | 275 | devm_of_phy_provider_register(dev, phy_berlin_sata_phy_xlate); |
| 271 | return PTR_ERR_OR_ZERO(phy_provider); | 276 | return PTR_ERR_OR_ZERO(phy_provider); |
| 277 | put_child: | ||
| 278 | of_node_put(child); | ||
| 279 | return ret; | ||
| 272 | } | 280 | } |
| 273 | 281 | ||
| 274 | static const struct of_device_id phy_berlin_sata_of_match[] = { | 282 | static const struct of_device_id phy_berlin_sata_of_match[] = { |
| @@ -140,7 +140,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) · 139 unmodified lines | |||
| 140 | struct brcm_sata_phy *priv; | 140 | struct brcm_sata_phy *priv; |
| 141 | struct resource *res; | 141 | struct resource *res; |
| 142 | struct phy_provider *provider; | 142 | struct phy_provider *provider; |
| 143 | int count = 0; | 143 | int ret, count = 0; |
| 144 | 144 | ||
| 145 | if (of_get_child_count(dn) == 0) | 145 | if (of_get_child_count(dn) == 0) |
| 146 | return -ENODEV; | 146 | return -ENODEV; |
| @@ -163,16 +163,19 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) · 16 unmodified lines | |||
| 163 | if (of_property_read_u32(child, "reg", &id)) { | 163 | if (of_property_read_u32(child, "reg", &id)) { |
| 164 | dev_err(dev, "missing reg property in node %s\n", | 164 | dev_err(dev, "missing reg property in node %s\n", |
| 165 | child->name); | 165 | child->name); |
| 166 | return -EINVAL; | 166 | ret = -EINVAL; |
| 167 | goto put_child; | ||
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | if (id >= MAX_PORTS) { | 170 | if (id >= MAX_PORTS) { |
| 170 | dev_err(dev, "invalid reg: %u\n", id); | 171 | dev_err(dev, "invalid reg: %u\n", id); |
| 171 | return -EINVAL; | 172 | ret = -EINVAL; |
| 173 | goto put_child; | ||
| 172 | } | 174 | } |
| 173 | if (priv->phys[id].phy) { | 175 | if (priv->phys[id].phy) { |
| 174 | dev_err(dev, "already registered port %u\n", id); | 176 | dev_err(dev, "already registered port %u\n", id); |
| 175 | return -EINVAL; | 177 | ret = -EINVAL; |
| 178 | goto put_child; | ||
| 176 | } | 179 | } |
| 177 | 180 | ||
| 178 | port = &priv->phys[id]; | 181 | port = &priv->phys[id]; |
| @@ -182,7 +185,8 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 182 | port->ssc_en = of_property_read_bool(child, "brcm,enable-ssc"); | 185 | port->ssc_en = of_property_read_bool(child, "brcm,enable-ssc"); |
| 183 | if (IS_ERR(port->phy)) { | 186 | if (IS_ERR(port->phy)) { |
| 184 | dev_err(dev, "failed to create PHY\n"); | 187 | dev_err(dev, "failed to create PHY\n"); |
| 185 | return PTR_ERR(port->phy); | 188 | ret = PTR_ERR(port->phy); |
| 189 | goto put_child; | ||
| 186 | } | 190 | } |
| 187 | 191 | ||
| 188 | phy_set_drvdata(port->phy, port); | 192 | phy_set_drvdata(port->phy, port); |
| @@ -198,6 +202,9 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) · 9 unmodified lines | |||
| 198 | dev_info(dev, "registered %d port(s)\n", count); | 202 | dev_info(dev, "registered %d port(s)\n", count); |
| 199 | 203 | ||
| 200 | return 0; | 204 | return 0; |
| 205 | put_child: | ||
| 206 | of_node_put(child); | ||
| 207 | return ret; | ||
| 201 | } | 208 | } |
| 202 | 209 | ||
| 203 | static struct platform_driver brcm_sata_phy_driver = { | 210 | static struct platform_driver brcm_sata_phy_driver = { |
| @@ -636,8 +636,9 @@ EXPORT_SYMBOL_GPL(devm_of_phy_get); · 635 unmodified lines | |||
| 636 | * @np: node containing the phy | 636 | * @np: node containing the phy |
| 637 | * @index: index of the phy | 637 | * @index: index of the phy |
| 638 | * | 638 | * |
| 639 | * Gets the phy using _of_phy_get(), and associates a device with it using | 639 | * Gets the phy using _of_phy_get(), then gets a refcount to it, |
| 640 | * devres. On driver detach, release function is invoked on the devres data, | 640 | * and associates a device with it using devres. On driver detach, |
| 641 | * release function is invoked on the devres data, | ||
| 641 | * then, devres data is freed. | 642 | * then, devres data is freed. |
| 642 | * | 643 | * |
| 643 | */ | 644 | */ |
| @@ -651,13 +652,21 @@ struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, · 7 unmodified lines | |||
| 651 | return ERR_PTR(-ENOMEM); | 652 | return ERR_PTR(-ENOMEM); |
| 652 | 653 | ||
| 653 | phy = _of_phy_get(np, index); | 654 | phy = _of_phy_get(np, index); |
| 654 | if (!IS_ERR(phy)) { | 655 | if (IS_ERR(phy)) { |
| 655 | *ptr = phy; | ||
| 656 | devres_add(dev, ptr); | ||
| 657 | } else { | ||
| 658 | devres_free(ptr); | 656 | devres_free(ptr); |
| 657 | return phy; | ||
| 659 | } | 658 | } |
| 660 | 659 | ||
| 660 | if (!try_module_get(phy->ops->owner)) { | ||
| 661 | devres_free(ptr); | ||
| 662 | return ERR_PTR(-EPROBE_DEFER); | ||
| 663 | } | ||
| 664 | |||
| 665 | get_device(&phy->dev); | ||
| 666 | |||
| 667 | *ptr = phy; | ||
| 668 | devres_add(dev, ptr); | ||
| 669 | |||
| 661 | return phy; | 670 | return phy; |
| 662 | } | 671 | } |
| 663 | EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index); | 672 | EXPORT_SYMBOL_GPL(devm_of_phy_get_by_index); |
| @@ -1226,15 +1226,18 @@ static int miphy28lp_probe(struct platform_device *pdev) · 1225 unmodified lines | |||
| 1226 | 1226 | ||
| 1227 | miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy), | 1227 | miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy), |
| 1228 | GFP_KERNEL); | 1228 | GFP_KERNEL); |
| 1229 | if (!miphy_phy) | 1229 | if (!miphy_phy) { |
| 1230 | return -ENOMEM; | 1230 | ret = -ENOMEM; |
| 1231 | goto put_child; | ||
| 1232 | } | ||
| 1231 | 1233 | ||
| 1232 | miphy_dev->phys[port] = miphy_phy; | 1234 | miphy_dev->phys[port] = miphy_phy; |
| 1233 | 1235 | ||
| 1234 | phy = devm_phy_create(&pdev->dev, child, &miphy28lp_ops); | 1236 | phy = devm_phy_create(&pdev->dev, child, &miphy28lp_ops); |
| 1235 | if (IS_ERR(phy)) { | 1237 | if (IS_ERR(phy)) { |
| 1236 | dev_err(&pdev->dev, "failed to create PHY\n"); | 1238 | dev_err(&pdev->dev, "failed to create PHY\n"); |
| 1237 | return PTR_ERR(phy); | 1239 | ret = PTR_ERR(phy); |
| 1240 | goto put_child; | ||
| 1238 | } | 1241 | } |
| 1239 | 1242 | ||
| 1240 | miphy_dev->phys[port]->phy = phy; | 1243 | miphy_dev->phys[port]->phy = phy; |
| @@ -1242,11 +1245,11 @@ static int miphy28lp_probe(struct platform_device *pdev) · 1 unmodified line | |||
| 1242 | 1245 | ||
| 1243 | ret = miphy28lp_of_probe(child, miphy_phy); | 1246 | ret = miphy28lp_of_probe(child, miphy_phy); |
| 1244 | if (ret) | 1247 | if (ret) |
| 1245 | return ret; | 1248 | goto put_child; |
| 1246 | 1249 | ||
| 1247 | ret = miphy28lp_probe_resets(child, miphy_dev->phys[port]); | 1250 | ret = miphy28lp_probe_resets(child, miphy_dev->phys[port]); |
| 1248 | if (ret) | 1251 | if (ret) |
| 1249 | return ret; | 1252 | goto put_child; |
| 1250 | 1253 | ||
| 1251 | phy_set_drvdata(phy, miphy_dev->phys[port]); | 1254 | phy_set_drvdata(phy, miphy_dev->phys[port]); |
| 1252 | port++; | 1255 | port++; |
| @@ -1255,6 +1258,9 @@ static int miphy28lp_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 1255 | 1258 | ||
| 1256 | provider = devm_of_phy_provider_register(&pdev->dev, miphy28lp_xlate); | 1259 | provider = devm_of_phy_provider_register(&pdev->dev, miphy28lp_xlate); |
| 1257 | return PTR_ERR_OR_ZERO(provider); | 1260 | return PTR_ERR_OR_ZERO(provider); |
| 1261 | put_child: | ||
| 1262 | of_node_put(child); | ||
| 1263 | return ret; | ||
| 1258 | } | 1264 | } |
| 1259 | 1265 | ||
| 1260 | static const struct of_device_id miphy28lp_of_match[] = { | 1266 | static const struct of_device_id miphy28lp_of_match[] = { |
| @@ -566,22 +566,25 @@ static int miphy365x_probe(struct platform_device *pdev) · 565 unmodified lines | |||
| 566 | 566 | ||
| 567 | miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy), | 567 | miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy), |
| 568 | GFP_KERNEL); | 568 | GFP_KERNEL); |
| 569 | if (!miphy_phy) | 569 | if (!miphy_phy) { |
| 570 | return -ENOMEM; | 570 | ret = -ENOMEM; |
| 571 | goto put_child; | ||
| 572 | } | ||
| 571 | 573 | ||
| 572 | miphy_dev->phys[port] = miphy_phy; | 574 | miphy_dev->phys[port] = miphy_phy; |
| 573 | 575 | ||
| 574 | phy = devm_phy_create(&pdev->dev, child, &miphy365x_ops); | 576 | phy = devm_phy_create(&pdev->dev, child, &miphy365x_ops); |
| 575 | if (IS_ERR(phy)) { | 577 | if (IS_ERR(phy)) { |
| 576 | dev_err(&pdev->dev, "failed to create PHY\n"); | 578 | dev_err(&pdev->dev, "failed to create PHY\n"); |
| 577 | return PTR_ERR(phy); | 579 | ret = PTR_ERR(phy); |
| 580 | goto put_child; | ||
| 578 | } | 581 | } |
| 579 | 582 | ||
| 580 | miphy_dev->phys[port]->phy = phy; | 583 | miphy_dev->phys[port]->phy = phy; |
| 581 | 584 | ||
| 582 | ret = miphy365x_of_probe(child, miphy_phy); | 585 | ret = miphy365x_of_probe(child, miphy_phy); |
| 583 | if (ret) | 586 | if (ret) |
| 584 | return ret; | 587 | goto put_child; |
| 585 | 588 | ||
| 586 | phy_set_drvdata(phy, miphy_dev->phys[port]); | 589 | phy_set_drvdata(phy, miphy_dev->phys[port]); |
| 587 | 590 | ||
| @@ -591,12 +594,15 @@ static int miphy365x_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 591 | &miphy_phy->ctrlreg); | 594 | &miphy_phy->ctrlreg); |
| 592 | if (ret) { | 595 | if (ret) { |
| 593 | dev_err(&pdev->dev, "No sysconfig offset found\n"); | 596 | dev_err(&pdev->dev, "No sysconfig offset found\n"); |
| 594 | return ret; | 597 | goto put_child; |
| 595 | } | 598 | } |
| 596 | } | 599 | } |
| 597 | 600 | ||
| 598 | provider = devm_of_phy_provider_register(&pdev->dev, miphy365x_xlate); | 601 | provider = devm_of_phy_provider_register(&pdev->dev, miphy365x_xlate); |
| 599 | return PTR_ERR_OR_ZERO(provider); | 602 | return PTR_ERR_OR_ZERO(provider); |
| 603 | put_child: | ||
| 604 | of_node_put(child); | ||
| 605 | return ret; | ||
| 600 | } | 606 | } |
| 601 | 607 | ||
| 602 | static const struct of_device_id miphy365x_of_match[] = { | 608 | static const struct of_device_id miphy365x_of_match[] = { |
| @@ -415,7 +415,7 @@ static int mt65xx_u3phy_probe(struct platform_device *pdev) · 414 unmodified lines | |||
| 415 | struct resource *sif_res; | 415 | struct resource *sif_res; |
| 416 | struct mt65xx_u3phy *u3phy; | 416 | struct mt65xx_u3phy *u3phy; |
| 417 | struct resource res; | 417 | struct resource res; |
| 418 | int port; | 418 | int port, retval; |
| 419 | 419 | ||
| 420 | u3phy = devm_kzalloc(dev, sizeof(*u3phy), GFP_KERNEL); | 420 | u3phy = devm_kzalloc(dev, sizeof(*u3phy), GFP_KERNEL); |
| 421 | if (!u3phy) | 421 | if (!u3phy) |
| @@ -447,31 +447,34 @@ static int mt65xx_u3phy_probe(struct platform_device *pdev) · 25 unmodified lines | |||
| 447 | for_each_child_of_node(np, child_np) { | 447 | for_each_child_of_node(np, child_np) { |
| 448 | struct mt65xx_phy_instance *instance; | 448 | struct mt65xx_phy_instance *instance; |
| 449 | struct phy *phy; | 449 | struct phy *phy; |
| 450 | int retval; | ||
| 451 | 450 | ||
| 452 | instance = devm_kzalloc(dev, sizeof(*instance), GFP_KERNEL); | 451 | instance = devm_kzalloc(dev, sizeof(*instance), GFP_KERNEL); |
| 453 | if (!instance) | 452 | if (!instance) { |
| 454 | return -ENOMEM; | 453 | retval = -ENOMEM; |
| 454 | goto put_child; | ||
| 455 | } | ||
| 455 | 456 | ||
| 456 | u3phy->phys[port] = instance; | 457 | u3phy->phys[port] = instance; |
| 457 | 458 | ||
| 458 | phy = devm_phy_create(dev, child_np, &mt65xx_u3phy_ops); | 459 | phy = devm_phy_create(dev, child_np, &mt65xx_u3phy_ops); |
| 459 | if (IS_ERR(phy)) { | 460 | if (IS_ERR(phy)) { |
| 460 | dev_err(dev, "failed to create phy\n"); | 461 | dev_err(dev, "failed to create phy\n"); |
| 461 | return PTR_ERR(phy); | 462 | retval = PTR_ERR(phy); |
| 463 | goto put_child; | ||
| 462 | } | 464 | } |
| 463 | 465 | ||
| 464 | retval = of_address_to_resource(child_np, 0, &res); | 466 | retval = of_address_to_resource(child_np, 0, &res); |
| 465 | if (retval) { | 467 | if (retval) { |
| 466 | dev_err(dev, "failed to get address resource(id-%d)\n", | 468 | dev_err(dev, "failed to get address resource(id-%d)\n", |
| 467 | port); | 469 | port); |
| 468 | return retval; | 470 | goto put_child; |
| 469 | } | 471 | } |
| 470 | 472 | ||
| 471 | instance->port_base = devm_ioremap_resource(&phy->dev, &res); | 473 | instance->port_base = devm_ioremap_resource(&phy->dev, &res); |
| 472 | if (IS_ERR(instance->port_base)) { | 474 | if (IS_ERR(instance->port_base)) { |
| 473 | dev_err(dev, "failed to remap phy regs\n"); | 475 | dev_err(dev, "failed to remap phy regs\n"); |
| 474 | return PTR_ERR(instance->port_base); | 476 | retval = PTR_ERR(instance->port_base); |
| 477 | goto put_child; | ||
| 475 | } | 478 | } |
| 476 | 479 | ||
| 477 | instance->phy = phy; | 480 | instance->phy = phy; |
| @@ -483,6 +486,9 @@ static int mt65xx_u3phy_probe(struct platform_device *pdev) · 5 unmodified lines | |||
| 483 | provider = devm_of_phy_provider_register(dev, mt65xx_phy_xlate); | 486 | provider = devm_of_phy_provider_register(dev, mt65xx_phy_xlate); |
| 484 | 487 | ||
| 485 | return PTR_ERR_OR_ZERO(provider); | 488 | return PTR_ERR_OR_ZERO(provider); |
| 489 | put_child: | ||
| 490 | of_node_put(child_np); | ||
| 491 | return retval; | ||
| 486 | } | 492 | } |
| 487 | 493 | ||
| 488 | static const struct of_device_id mt65xx_u3phy_id_table[] = { | 494 | static const struct of_device_id mt65xx_u3phy_id_table[] = { |
| @@ -108,13 +108,16 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev) · 107 unmodified lines | |||
| 108 | 108 | ||
| 109 | for_each_available_child_of_node(dev->of_node, child) { | 109 | for_each_available_child_of_node(dev->of_node, child) { |
| 110 | rk_phy = devm_kzalloc(dev, sizeof(*rk_phy), GFP_KERNEL); | 110 | rk_phy = devm_kzalloc(dev, sizeof(*rk_phy), GFP_KERNEL); |
| 111 | if (!rk_phy) | 111 | if (!rk_phy) { |
| 112 | return -ENOMEM; | 112 | err = -ENOMEM; |
| 113 | goto put_child; | ||
| 114 | } | ||
| 113 | 115 | ||
| 114 | if (of_property_read_u32(child, "reg", ®_offset)) { | 116 | if (of_property_read_u32(child, "reg", ®_offset)) { |
| 115 | dev_err(dev, "missing reg property in node %s\n", | 117 | dev_err(dev, "missing reg property in node %s\n", |
| 116 | child->name); | 118 | child->name); |
| 117 | return -EINVAL; | 119 | err = -EINVAL; |
| 120 | goto put_child; | ||
| 118 | } | 121 | } |
| 119 | 122 | ||
| 120 | rk_phy->reg_offset = reg_offset; | 123 | rk_phy->reg_offset = reg_offset; |
| @@ -127,18 +130,22 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev) · 6 unmodified lines | |||
| 127 | rk_phy->phy = devm_phy_create(dev, child, &ops); | 130 | rk_phy->phy = devm_phy_create(dev, child, &ops); |
| 128 | if (IS_ERR(rk_phy->phy)) { | 131 | if (IS_ERR(rk_phy->phy)) { |
| 129 | dev_err(dev, "failed to create PHY\n"); | 132 | dev_err(dev, "failed to create PHY\n"); |
| 130 | return PTR_ERR(rk_phy->phy); | 133 | err = PTR_ERR(rk_phy->phy); |
| 134 | goto put_child; | ||
| 131 | } | 135 | } |
| 132 | phy_set_drvdata(rk_phy->phy, rk_phy); | 136 | phy_set_drvdata(rk_phy->phy, rk_phy); |
| 133 | 137 | ||
| 134 | /* only power up usb phy when it use, so disable it when init*/ | 138 | /* only power up usb phy when it use, so disable it when init*/ |
| 135 | err = rockchip_usb_phy_power(rk_phy, 1); | 139 | err = rockchip_usb_phy_power(rk_phy, 1); |
| 136 | if (err) | 140 | if (err) |
| 137 | return err; | 141 | goto put_child; |
| 138 | } | 142 | } |
| 139 | 143 | ||
| 140 | phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); | 144 | phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); |
| 141 | return PTR_ERR_OR_ZERO(phy_provider); | 145 | return PTR_ERR_OR_ZERO(phy_provider); |
| 146 | put_child: | ||
| 147 | of_node_put(child); | ||
| 148 | return err; | ||
| 142 | } | 149 | } |
| 143 | 150 | ||
| 144 | static const struct of_device_id rockchip_usb_phy_dt_ids[] = { | 151 | static const struct of_device_id rockchip_usb_phy_dt_ids[] = { |
| @@ -342,12 +342,6 @@ static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset) · 341 unmodified lines | |||
| 342 | return bcm2835_gpio_get_bit(pc, GPLEV0, offset); | 342 | return bcm2835_gpio_get_bit(pc, GPLEV0, offset); |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | static int bcm2835_gpio_direction_output(struct gpio_chip *chip, | ||
| 346 | unsigned offset, int value) | ||
| 347 | { | ||
| 348 | return pinctrl_gpio_direction_output(chip->base + offset); | ||
| 349 | } | ||
| 350 | |||
| 351 | static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 345 | static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
| 352 | { | 346 | { |
| 353 | struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); | 347 | struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); |
| @@ -355,6 +349,13 @@ static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · 1 unmodified line | |||
| 355 | bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset); | 349 | bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset); |
| 356 | } | 350 | } |
| 357 | 351 | ||
| 352 | static int bcm2835_gpio_direction_output(struct gpio_chip *chip, | ||
| 353 | unsigned offset, int value) | ||
| 354 | { | ||
| 355 | bcm2835_gpio_set(chip, offset, value); | ||
| 356 | return pinctrl_gpio_direction_output(chip->base + offset); | ||
| 357 | } | ||
| 358 | |||
| 358 | static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 359 | static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
| 359 | { | 360 | { |
| 360 | struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); | 361 | struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); |
| @@ -299,7 +299,7 @@ static const struct pinctrl_pin_desc vf610_pinctrl_pads[] = { · 298 unmodified lines | |||
| 299 | static struct imx_pinctrl_soc_info vf610_pinctrl_info = { | 299 | static struct imx_pinctrl_soc_info vf610_pinctrl_info = { |
| 300 | .pins = vf610_pinctrl_pads, | 300 | .pins = vf610_pinctrl_pads, |
| 301 | .npins = ARRAY_SIZE(vf610_pinctrl_pads), | 301 | .npins = ARRAY_SIZE(vf610_pinctrl_pads), |
| 302 | .flags = SHARE_MUX_CONF_REG, | 302 | .flags = SHARE_MUX_CONF_REG | ZERO_OFFSET_VALID, |
| 303 | }; | 303 | }; |
| 304 | 304 | ||
| 305 | static const struct of_device_id vf610_pinctrl_of_match[] = { | 305 | static const struct of_device_id vf610_pinctrl_of_match[] = { |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | .padcfglock_offset = BXT_PADCFGLOCK, \ | 28 | .padcfglock_offset = BXT_PADCFGLOCK, \ |
| 29 | .hostown_offset = BXT_HOSTSW_OWN, \ | 29 | .hostown_offset = BXT_HOSTSW_OWN, \ |
| 30 | .ie_offset = BXT_GPI_IE, \ | 30 | .ie_offset = BXT_GPI_IE, \ |
| 31 | .gpp_size = 32, \ | ||
| 31 | .pin_base = (s), \ | 32 | .pin_base = (s), \ |
| 32 | .npins = ((e) - (s) + 1), \ | 33 | .npins = ((e) - (s) + 1), \ |
| 33 | } | 34 | } |
| @@ -25,9 +25,6 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | #include "pinctrl-intel.h" | 26 | #include "pinctrl-intel.h" |
| 27 | 27 | ||
| 28 | /* Maximum number of pads in each group */ | ||
| 29 | #define NPADS_IN_GPP 24 | ||
| 30 | |||
| 31 | /* Offset from regs */ | 28 | /* Offset from regs */ |
| 32 | #define PADBAR 0x00c | 29 | #define PADBAR 0x00c |
| 33 | #define GPI_IS 0x100 | 30 | #define GPI_IS 0x100 |
| @@ -37,6 +34,7 @@ · 3 unmodified lines | |||
| 37 | #define PADOWN_BITS 4 | 34 | #define PADOWN_BITS 4 |
| 38 | #define PADOWN_SHIFT(p) ((p) % 8 * PADOWN_BITS) | 35 | #define PADOWN_SHIFT(p) ((p) % 8 * PADOWN_BITS) |
| 39 | #define PADOWN_MASK(p) (0xf << PADOWN_SHIFT(p)) | 36 | #define PADOWN_MASK(p) (0xf << PADOWN_SHIFT(p)) |
| 37 | #define PADOWN_GPP(p) ((p) / 8) | ||
| 40 | 38 | ||
| 41 | /* Offset from pad_regs */ | 39 | /* Offset from pad_regs */ |
| 42 | #define PADCFG0 0x000 | 40 | #define PADCFG0 0x000 |
| @@ -142,7 +140,7 @@ static void __iomem *intel_get_padcfg(struct intel_pinctrl *pctrl, unsigned pin, · 99 unmodified lines | |||
| 142 | static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin) | 140 | static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin) |
| 143 | { | 141 | { |
| 144 | const struct intel_community *community; | 142 | const struct intel_community *community; |
| 145 | unsigned padno, gpp, gpp_offset, offset; | 143 | unsigned padno, gpp, offset, group; |
| 146 | void __iomem *padown; | 144 | void __iomem *padown; |
| 147 | 145 | ||
| 148 | community = intel_get_community(pctrl, pin); | 146 | community = intel_get_community(pctrl, pin); |
| @@ -152,9 +150,9 @@ static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin) · 3 unmodified lines | |||
| 152 | return true; | 150 | return true; |
| 153 | 151 | ||
| 154 | padno = pin_to_padno(community, pin); | 152 | padno = pin_to_padno(community, pin); |
| 155 | gpp = padno / NPADS_IN_GPP; | 153 | group = padno / community->gpp_size; |
| 156 | gpp_offset = padno % NPADS_IN_GPP; | 154 | gpp = PADOWN_GPP(padno % community->gpp_size); |
| 157 | offset = community->padown_offset + gpp * 16 + (gpp_offset / 8) * 4; | 155 | offset = community->padown_offset + 0x10 * group + gpp * 4; |
| 158 | padown = community->regs + offset; | 156 | padown = community->regs + offset; |
| 159 | 157 | ||
| 160 | return !(readl(padown) & PADOWN_MASK(padno)); | 158 | return !(readl(padown) & PADOWN_MASK(padno)); |
| @@ -173,11 +171,11 @@ static bool intel_pad_acpi_mode(struct intel_pinctrl *pctrl, unsigned pin) · 12 unmodified lines | |||
| 173 | return false; | 171 | return false; |
| 174 | 172 | ||
| 175 | padno = pin_to_padno(community, pin); | 173 | padno = pin_to_padno(community, pin); |
| 176 | gpp = padno / NPADS_IN_GPP; | 174 | gpp = padno / community->gpp_size; |
| 177 | offset = community->hostown_offset + gpp * 4; | 175 | offset = community->hostown_offset + gpp * 4; |
| 178 | hostown = community->regs + offset; | 176 | hostown = community->regs + offset; |
| 179 | 177 | ||
| 180 | return !(readl(hostown) & BIT(padno % NPADS_IN_GPP)); | 178 | return !(readl(hostown) & BIT(padno % community->gpp_size)); |
| 181 | } | 179 | } |
| 182 | 180 | ||
| 183 | static bool intel_pad_locked(struct intel_pinctrl *pctrl, unsigned pin) | 181 | static bool intel_pad_locked(struct intel_pinctrl *pctrl, unsigned pin) |
| @@ -193,7 +191,7 @@ static bool intel_pad_locked(struct intel_pinctrl *pctrl, unsigned pin) · 9 unmodified lines | |||
| 193 | return false; | 191 | return false; |
| 194 | 192 | ||
| 195 | padno = pin_to_padno(community, pin); | 193 | padno = pin_to_padno(community, pin); |
| 196 | gpp = padno / NPADS_IN_GPP; | 194 | gpp = padno / community->gpp_size; |
| 197 | 195 | ||
| 198 | /* | 196 | /* |
| 199 | * If PADCFGLOCK and PADCFGLOCKTX bits are both clear for this pad, | 197 | * If PADCFGLOCK and PADCFGLOCKTX bits are both clear for this pad, |
| @@ -202,12 +200,12 @@ static bool intel_pad_locked(struct intel_pinctrl *pctrl, unsigned pin) · 2 unmodified lines | |||
| 202 | */ | 200 | */ |
| 203 | offset = community->padcfglock_offset + gpp * 8; | 201 | offset = community->padcfglock_offset + gpp * 8; |
| 204 | value = readl(community->regs + offset); | 202 | value = readl(community->regs + offset); |
| 205 | if (value & BIT(pin % NPADS_IN_GPP)) | 203 | if (value & BIT(pin % community->gpp_size)) |
| 206 | return true; | 204 | return true; |
| 207 | 205 | ||
| 208 | offset = community->padcfglock_offset + 4 + gpp * 8; | 206 | offset = community->padcfglock_offset + 4 + gpp * 8; |
| 209 | value = readl(community->regs + offset); | 207 | value = readl(community->regs + offset); |
| 210 | if (value & BIT(pin % NPADS_IN_GPP)) | 208 | if (value & BIT(pin % community->gpp_size)) |
| 211 | return true; | 209 | return true; |
| 212 | 210 | ||
| 213 | return false; | 211 | return false; |
| @@ -663,8 +661,8 @@ static void intel_gpio_irq_ack(struct irq_data *d) · 449 unmodified lines | |||
| 663 | community = intel_get_community(pctrl, pin); | 661 | community = intel_get_community(pctrl, pin); |
| 664 | if (community) { | 662 | if (community) { |
| 665 | unsigned padno = pin_to_padno(community, pin); | 663 | unsigned padno = pin_to_padno(community, pin); |
| 666 | unsigned gpp_offset = padno % NPADS_IN_GPP; | 664 | unsigned gpp_offset = padno % community->gpp_size; |
| 667 | unsigned gpp = padno / NPADS_IN_GPP; | 665 | unsigned gpp = padno / community->gpp_size; |
| 668 | 666 | ||
| 669 | writel(BIT(gpp_offset), community->regs + GPI_IS + gpp * 4); | 667 | writel(BIT(gpp_offset), community->regs + GPI_IS + gpp * 4); |
| 670 | } | 668 | } |
| @@ -685,8 +683,8 @@ static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) · 14 unmodified lines | |||
| 685 | community = intel_get_community(pctrl, pin); | 683 | community = intel_get_community(pctrl, pin); |
| 686 | if (community) { | 684 | if (community) { |
| 687 | unsigned padno = pin_to_padno(community, pin); | 685 | unsigned padno = pin_to_padno(community, pin); |
| 688 | unsigned gpp_offset = padno % NPADS_IN_GPP; | 686 | unsigned gpp_offset = padno % community->gpp_size; |
| 689 | unsigned gpp = padno / NPADS_IN_GPP; | 687 | unsigned gpp = padno / community->gpp_size; |
| 690 | void __iomem *reg; | 688 | void __iomem *reg; |
| 691 | u32 value; | 689 | u32 value; |
| 692 | 690 | ||
| @@ -780,8 +778,8 @@ static int intel_gpio_irq_wake(struct irq_data *d, unsigned int on) · 87 unmodified lines | |||
| 780 | return -EINVAL; | 778 | return -EINVAL; |
| 781 | 779 | ||
| 782 | padno = pin_to_padno(community, pin); | 780 | padno = pin_to_padno(community, pin); |
| 783 | gpp = padno / NPADS_IN_GPP; | 781 | gpp = padno / community->gpp_size; |
| 784 | gpp_offset = padno % NPADS_IN_GPP; | 782 | gpp_offset = padno % community->gpp_size; |
| 785 | 783 | ||
| 786 | /* Clear the existing wake status */ | 784 | /* Clear the existing wake status */ |
| 787 | writel(BIT(gpp_offset), community->regs + GPI_GPE_STS + gpp * 4); | 785 | writel(BIT(gpp_offset), community->regs + GPI_GPE_STS + gpp * 4); |
| @@ -819,14 +817,14 @@ static irqreturn_t intel_gpio_community_irq_handler(struct intel_pinctrl *pctrl, · 31 unmodified lines | |||
| 819 | /* Only interrupts that are enabled */ | 817 | /* Only interrupts that are enabled */ |
| 820 | pending &= enabled; | 818 | pending &= enabled; |
| 821 | 819 | ||
| 822 | for_each_set_bit(gpp_offset, &pending, NPADS_IN_GPP) { | 820 | for_each_set_bit(gpp_offset, &pending, community->gpp_size) { |
| 823 | unsigned padno, irq; | 821 | unsigned padno, irq; |
| 824 | 822 | ||
| 825 | /* | 823 | /* |
| 826 | * The last group in community can have less pins | 824 | * The last group in community can have less pins |
| 827 | * than NPADS_IN_GPP. | 825 | * than NPADS_IN_GPP. |
| 828 | */ | 826 | */ |
| 829 | padno = gpp_offset + gpp * NPADS_IN_GPP; | 827 | padno = gpp_offset + gpp * community->gpp_size; |
| 830 | if (padno >= community->npins) | 828 | if (padno >= community->npins) |
| 831 | break; | 829 | break; |
| 832 | 830 | ||
| @@ -1002,7 +1000,8 @@ int intel_pinctrl_probe(struct platform_device *pdev, · 169 unmodified lines | |||
| 1002 | 1000 | ||
| 1003 | community->regs = regs; | 1001 | community->regs = regs; |
| 1004 | community->pad_regs = regs + padbar; | 1002 | community->pad_regs = regs + padbar; |
| 1005 | community->ngpps = DIV_ROUND_UP(community->npins, NPADS_IN_GPP); | 1003 | community->ngpps = DIV_ROUND_UP(community->npins, |
| 1004 | community->gpp_size); | ||
| 1006 | } | 1005 | } |
| 1007 | 1006 | ||
| 1008 | irq = platform_get_irq(pdev, 0); | 1007 | irq = platform_get_irq(pdev, 0); |
| @@ -55,6 +55,8 @@ struct intel_function { · 54 unmodified lines | |||
| 55 | * ACPI). | 55 | * ACPI). |
| 56 | * @ie_offset: Register offset of GPI_IE from @regs. | 56 | * @ie_offset: Register offset of GPI_IE from @regs. |
| 57 | * @pin_base: Starting pin of pins in this community | 57 | * @pin_base: Starting pin of pins in this community |
| 58 | * @gpp_size: Maximum number of pads in each group, such as PADCFGLOCK, | ||
| 59 | * HOSTSW_OWN, GPI_IS, GPI_IE, etc. | ||
| 58 | * @npins: Number of pins in this community | 60 | * @npins: Number of pins in this community |
| 59 | * @regs: Community specific common registers (reserved for core driver) | 61 | * @regs: Community specific common registers (reserved for core driver) |
| 60 | * @pad_regs: Community specific pad registers (reserved for core driver) | 62 | * @pad_regs: Community specific pad registers (reserved for core driver) |
| @@ -68,6 +70,7 @@ struct intel_community { · 7 unmodified lines | |||
| 68 | unsigned hostown_offset; | 70 | unsigned hostown_offset; |
| 69 | unsigned ie_offset; | 71 | unsigned ie_offset; |
| 70 | unsigned pin_base; | 72 | unsigned pin_base; |
| 73 | unsigned gpp_size; | ||
| 71 | size_t npins; | 74 | size_t npins; |
| 72 | void __iomem *regs; | 75 | void __iomem *regs; |
| 73 | void __iomem *pad_regs; | 76 | void __iomem *pad_regs; |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | |||
| 30 | .padcfglock_offset = SPT_PADCFGLOCK, \ | 30 | .padcfglock_offset = SPT_PADCFGLOCK, \ |
| 31 | .hostown_offset = SPT_HOSTSW_OWN, \ | 31 | .hostown_offset = SPT_HOSTSW_OWN, \ |
| 32 | .ie_offset = SPT_GPI_IE, \ | 32 | .ie_offset = SPT_GPI_IE, \ |
| 33 | .gpp_size = 24, \ | ||
| 33 | .pin_base = (s), \ | 34 | .pin_base = (s), \ |
| 34 | .npins = ((e) - (s) + 1), \ | 35 | .npins = ((e) - (s) + 1), \ |
| 35 | } | 36 | } |
| @@ -1341,10 +1341,13 @@ static int rapl_detect_domains(struct rapl_package *rp, int cpu) · 1340 unmodified lines | |||
| 1341 | 1341 | ||
| 1342 | for (rd = rp->domains; rd < rp->domains + rp->nr_domains; rd++) { | 1342 | for (rd = rp->domains; rd < rp->domains + rp->nr_domains; rd++) { |
| 1343 | /* check if the domain is locked by BIOS */ | 1343 | /* check if the domain is locked by BIOS */ |
| 1344 | if (rapl_read_data_raw(rd, FW_LOCK, false, &locked)) { | 1344 | ret = rapl_read_data_raw(rd, FW_LOCK, false, &locked); |
| 1345 | if (ret) | ||
| 1346 | return ret; | ||
| 1347 | if (locked) { | ||
| 1345 | pr_info("RAPL package %d domain %s locked by BIOS\n", | 1348 | pr_info("RAPL package %d domain %s locked by BIOS\n", |
| 1346 | rp->id, rd->name); | 1349 | rp->id, rd->name); |
| 1347 | rd->state |= DOMAIN_STATE_BIOS_LOCKED; | 1350 | rd->state |= DOMAIN_STATE_BIOS_LOCKED; |
| 1348 | } | 1351 | } |
| 1349 | } | 1352 | } |
| 1350 | 1353 | ||
| @@ -483,24 +483,23 @@ static int da9063_rtc_probe(struct platform_device *pdev) · 482 unmodified lines | |||
| 483 | 483 | ||
| 484 | platform_set_drvdata(pdev, rtc); | 484 | platform_set_drvdata(pdev, rtc); |
| 485 | 485 | ||
| 486 | rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, DA9063_DRVNAME_RTC, | ||
| 487 | &da9063_rtc_ops, THIS_MODULE); | ||
| 488 | if (IS_ERR(rtc->rtc_dev)) | ||
| 489 | return PTR_ERR(rtc->rtc_dev); | ||
| 490 | |||
| 491 | da9063_data_to_tm(data, &rtc->alarm_time, rtc); | ||
| 492 | rtc->rtc_sync = false; | ||
| 493 | |||
| 486 | irq_alarm = platform_get_irq_byname(pdev, "ALARM"); | 494 | irq_alarm = platform_get_irq_byname(pdev, "ALARM"); |
| 487 | ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL, | 495 | ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL, |
| 488 | da9063_alarm_event, | 496 | da9063_alarm_event, |
| 489 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, | 497 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, |
| 490 | "ALARM", rtc); | 498 | "ALARM", rtc); |
| 491 | if (ret) { | 499 | if (ret) |
| 492 | dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n", | 500 | dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n", |
| 493 | irq_alarm, ret); | 501 | irq_alarm, ret); |
| 494 | return ret; | ||
| 495 | } | ||
| 496 | |||
| 497 | rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, DA9063_DRVNAME_RTC, | ||
| 498 | &da9063_rtc_ops, THIS_MODULE); | ||
| 499 | if (IS_ERR(rtc->rtc_dev)) | ||
| 500 | return PTR_ERR(rtc->rtc_dev); | ||
| 501 | 502 | ||
| 502 | da9063_data_to_tm(data, &rtc->alarm_time, rtc); | ||
| 503 | rtc->rtc_sync = false; | ||
| 504 | return ret; | 503 | return ret; |
| 505 | } | 504 | } |
| 506 | 505 | ||
| @@ -56,6 +56,42 @@ struct rk808_rtc { · 55 unmodified lines | |||
| 56 | int irq; | 56 | int irq; |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | /* | ||
| 60 | * The Rockchip calendar used by the RK808 counts November with 31 days. We use | ||
| 61 | * these translation functions to convert its dates to/from the Gregorian | ||
| 62 | * calendar used by the rest of the world. We arbitrarily define Jan 1st, 2016 | ||
| 63 | * as the day when both calendars were in sync, and treat all other dates | ||
| 64 | * relative to that. | ||
| 65 | * NOTE: Other system software (e.g. firmware) that reads the same hardware must | ||
| 66 | * implement this exact same conversion algorithm, with the same anchor date. | ||
| 67 | */ | ||
| 68 | static time64_t nov2dec_transitions(struct rtc_time *tm) | ||
| 69 | { | ||
| 70 | return (tm->tm_year + 1900) - 2016 + (tm->tm_mon + 1 > 11 ? 1 : 0); | ||
| 71 | } | ||
| 72 | |||
| 73 | static void rockchip_to_gregorian(struct rtc_time *tm) | ||
| 74 | { | ||
| 75 | /* If it's Nov 31st, rtc_tm_to_time64() will count that like Dec 1st */ | ||
| 76 | time64_t time = rtc_tm_to_time64(tm); | ||
| 77 | rtc_time64_to_tm(time + nov2dec_transitions(tm) * 86400, tm); | ||
| 78 | } | ||
| 79 | |||
| 80 | static void gregorian_to_rockchip(struct rtc_time *tm) | ||
| 81 | { | ||
| 82 | time64_t extra_days = nov2dec_transitions(tm); | ||
| 83 | time64_t time = rtc_tm_to_time64(tm); | ||
| 84 | rtc_time64_to_tm(time - extra_days * 86400, tm); | ||
| 85 | |||
| 86 | /* Compensate if we went back over Nov 31st (will work up to 2381) */ | ||
| 87 | if (nov2dec_transitions(tm) < extra_days) { | ||
| 88 | if (tm->tm_mon + 1 == 11) | ||
| 89 | tm->tm_mday++; /* This may result in 31! */ | ||
| 90 | else | ||
| 91 | rtc_time64_to_tm(time - (extra_days - 1) * 86400, tm); | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 59 | /* Read current time and date in RTC */ | 95 | /* Read current time and date in RTC */ |
| 60 | static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm) | 96 | static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm) |
| 61 | { | 97 | { |
| @@ -101,9 +137,10 @@ static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm) · 39 unmodified lines | |||
| 101 | tm->tm_mon = (bcd2bin(rtc_data[4] & MONTHS_REG_MSK)) - 1; | 137 | tm->tm_mon = (bcd2bin(rtc_data[4] & MONTHS_REG_MSK)) - 1; |
| 102 | tm->tm_year = (bcd2bin(rtc_data[5] & YEARS_REG_MSK)) + 100; | 138 | tm->tm_year = (bcd2bin(rtc_data[5] & YEARS_REG_MSK)) + 100; |
| 103 | tm->tm_wday = bcd2bin(rtc_data[6] & WEEKS_REG_MSK); | 139 | tm->tm_wday = bcd2bin(rtc_data[6] & WEEKS_REG_MSK); |
| 140 | rockchip_to_gregorian(tm); | ||
| 104 | dev_dbg(dev, "RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n", | 141 | dev_dbg(dev, "RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n", |
| 105 | 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, | 142 | 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, |
| 106 | tm->tm_wday, tm->tm_hour , tm->tm_min, tm->tm_sec); | 143 | tm->tm_wday, tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 107 | 144 | ||
| 108 | return ret; | 145 | return ret; |
| 109 | } | 146 | } |
| @@ -116,6 +153,10 @@ static int rk808_rtc_set_time(struct device *dev, struct rtc_time *tm) · 6 unmodified lines | |||
| 116 | u8 rtc_data[NUM_TIME_REGS]; | 153 | u8 rtc_data[NUM_TIME_REGS]; |
| 117 | int ret; | 154 | int ret; |
| 118 | 155 | ||
| 156 | dev_dbg(dev, "set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n", | ||
| 157 | 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, | ||
| 158 | tm->tm_wday, tm->tm_hour, tm->tm_min, tm->tm_sec); | ||
| 159 | gregorian_to_rockchip(tm); | ||
| 119 | rtc_data[0] = bin2bcd(tm->tm_sec); | 160 | rtc_data[0] = bin2bcd(tm->tm_sec); |
| 120 | rtc_data[1] = bin2bcd(tm->tm_min); | 161 | rtc_data[1] = bin2bcd(tm->tm_min); |
| 121 | rtc_data[2] = bin2bcd(tm->tm_hour); | 162 | rtc_data[2] = bin2bcd(tm->tm_hour); |
| @@ -123,9 +164,6 @@ static int rk808_rtc_set_time(struct device *dev, struct rtc_time *tm) · 1 unmodified line | |||
| 123 | rtc_data[4] = bin2bcd(tm->tm_mon + 1); | 164 | rtc_data[4] = bin2bcd(tm->tm_mon + 1); |
| 124 | rtc_data[5] = bin2bcd(tm->tm_year - 100); | 165 | rtc_data[5] = bin2bcd(tm->tm_year - 100); |
| 125 | rtc_data[6] = bin2bcd(tm->tm_wday); | 166 | rtc_data[6] = bin2bcd(tm->tm_wday); |
| 126 | dev_dbg(dev, "set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n", | ||
| 127 | 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, | ||
| 128 | tm->tm_wday, tm->tm_hour , tm->tm_min, tm->tm_sec); | ||
| 129 | 167 | ||
| 130 | /* Stop RTC while updating the RTC registers */ | 168 | /* Stop RTC while updating the RTC registers */ |
| 131 | ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG, | 169 | ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG, |
| @@ -170,6 +208,7 @@ static int rk808_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) · 38 unmodified lines | |||
| 170 | alrm->time.tm_mday = bcd2bin(alrm_data[3] & DAYS_REG_MSK); | 208 | alrm->time.tm_mday = bcd2bin(alrm_data[3] & DAYS_REG_MSK); |
| 171 | alrm->time.tm_mon = (bcd2bin(alrm_data[4] & MONTHS_REG_MSK)) - 1; | 209 | alrm->time.tm_mon = (bcd2bin(alrm_data[4] & MONTHS_REG_MSK)) - 1; |
| 172 | alrm->time.tm_year = (bcd2bin(alrm_data[5] & YEARS_REG_MSK)) + 100; | 210 | alrm->time.tm_year = (bcd2bin(alrm_data[5] & YEARS_REG_MSK)) + 100; |
| 211 | rockchip_to_gregorian(&alrm->time); | ||
| 173 | 212 | ||
| 174 | ret = regmap_read(rk808->regmap, RK808_RTC_INT_REG, &int_reg); | 213 | ret = regmap_read(rk808->regmap, RK808_RTC_INT_REG, &int_reg); |
| 175 | if (ret) { | 214 | if (ret) { |
| @@ -227,6 +266,7 @@ static int rk808_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) · 51 unmodified lines | |||
| 227 | alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour, | 266 | alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour, |
| 228 | alrm->time.tm_min, alrm->time.tm_sec); | 267 | alrm->time.tm_min, alrm->time.tm_sec); |
| 229 | 268 | ||
| 269 | gregorian_to_rockchip(&alrm->time); | ||
| 230 | alrm_data[0] = bin2bcd(alrm->time.tm_sec); | 270 | alrm_data[0] = bin2bcd(alrm->time.tm_sec); |
| 231 | alrm_data[1] = bin2bcd(alrm->time.tm_min); | 271 | alrm_data[1] = bin2bcd(alrm->time.tm_min); |
| 232 | alrm_data[2] = bin2bcd(alrm->time.tm_hour); | 272 | alrm_data[2] = bin2bcd(alrm->time.tm_hour); |
| @@ -599,8 +599,10 @@ static enum ap_wait ap_sm_read(struct ap_device *ap_dev) · 598 unmodified lines | |||
| 599 | status = ap_sm_recv(ap_dev); | 599 | status = ap_sm_recv(ap_dev); |
| 600 | switch (status.response_code) { | 600 | switch (status.response_code) { |
| 601 | case AP_RESPONSE_NORMAL: | 601 | case AP_RESPONSE_NORMAL: |
| 602 | if (ap_dev->queue_count > 0) | 602 | if (ap_dev->queue_count > 0) { |
| 603 | ap_dev->state = AP_STATE_WORKING; | ||
| 603 | return AP_WAIT_AGAIN; | 604 | return AP_WAIT_AGAIN; |
| 605 | } | ||
| 604 | ap_dev->state = AP_STATE_IDLE; | 606 | ap_dev->state = AP_STATE_IDLE; |
| 605 | return AP_WAIT_NONE; | 607 | return AP_WAIT_NONE; |
| 606 | case AP_RESPONSE_NO_PENDING_REPLY: | 608 | case AP_RESPONSE_NO_PENDING_REPLY: |
| @@ -984,6 +984,36 @@ static struct virtqueue *virtio_ccw_vq_by_ind(struct virtio_ccw_device *vcdev, · 983 unmodified lines | |||
| 984 | return vq; | 984 | return vq; |
| 985 | } | 985 | } |
| 986 | 986 | ||
| 987 | static void virtio_ccw_check_activity(struct virtio_ccw_device *vcdev, | ||
| 988 | __u32 activity) | ||
| 989 | { | ||
| 990 | if (vcdev->curr_io & activity) { | ||
| 991 | switch (activity) { | ||
| 992 | case VIRTIO_CCW_DOING_READ_FEAT: | ||
| 993 | case VIRTIO_CCW_DOING_WRITE_FEAT: | ||
| 994 | case VIRTIO_CCW_DOING_READ_CONFIG: | ||
| 995 | case VIRTIO_CCW_DOING_WRITE_CONFIG: | ||
| 996 | case VIRTIO_CCW_DOING_WRITE_STATUS: | ||
| 997 | case VIRTIO_CCW_DOING_SET_VQ: | ||
| 998 | case VIRTIO_CCW_DOING_SET_IND: | ||
| 999 | case VIRTIO_CCW_DOING_SET_CONF_IND: | ||
| 1000 | case VIRTIO_CCW_DOING_RESET: | ||
| 1001 | case VIRTIO_CCW_DOING_READ_VQ_CONF: | ||
| 1002 | case VIRTIO_CCW_DOING_SET_IND_ADAPTER: | ||
| 1003 | case VIRTIO_CCW_DOING_SET_VIRTIO_REV: | ||
| 1004 | vcdev->curr_io &= ~activity; | ||
| 1005 | wake_up(&vcdev->wait_q); | ||
| 1006 | break; | ||
| 1007 | default: | ||
| 1008 | /* don't know what to do... */ | ||
| 1009 | dev_warn(&vcdev->cdev->dev, | ||
| 1010 | "Suspicious activity '%08x'\n", activity); | ||
| 1011 | WARN_ON(1); | ||
| 1012 | break; | ||
| 1013 | } | ||
| 1014 | } | ||
| 1015 | } | ||
| 1016 | |||
| 987 | static void virtio_ccw_int_handler(struct ccw_device *cdev, | 1017 | static void virtio_ccw_int_handler(struct ccw_device *cdev, |
| 988 | unsigned long intparm, | 1018 | unsigned long intparm, |
| 989 | struct irb *irb) | 1019 | struct irb *irb) |
| @@ -995,6 +1025,12 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev, · 5 unmodified lines | |||
| 995 | 1025 | ||
| 996 | if (!vcdev) | 1026 | if (!vcdev) |
| 997 | return; | 1027 | return; |
| 1028 | if (IS_ERR(irb)) { | ||
| 1029 | vcdev->err = PTR_ERR(irb); | ||
| 1030 | virtio_ccw_check_activity(vcdev, activity); | ||
| 1031 | /* Don't poke around indicators, something's wrong. */ | ||
| 1032 | return; | ||
| 1033 | } | ||
| 998 | /* Check if it's a notification from the host. */ | 1034 | /* Check if it's a notification from the host. */ |
| 999 | if ((intparm == 0) && | 1035 | if ((intparm == 0) && |
| 1000 | (scsw_stctl(&irb->scsw) == | 1036 | (scsw_stctl(&irb->scsw) == |
| @@ -1010,31 +1046,7 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev, · 9 unmodified lines | |||
| 1010 | /* Map everything else to -EIO. */ | 1046 | /* Map everything else to -EIO. */ |
| 1011 | vcdev->err = -EIO; | 1047 | vcdev->err = -EIO; |
| 1012 | } | 1048 | } |
| 1013 | if (vcdev->curr_io & activity) { | 1049 | virtio_ccw_check_activity(vcdev, activity); |
| 1014 | switch (activity) { | ||
| 1015 | case VIRTIO_CCW_DOING_READ_FEAT: | ||
| 1016 | case VIRTIO_CCW_DOING_WRITE_FEAT: | ||
| 1017 | case VIRTIO_CCW_DOING_READ_CONFIG: | ||
| 1018 | case VIRTIO_CCW_DOING_WRITE_CONFIG: | ||
| 1019 | case VIRTIO_CCW_DOING_WRITE_STATUS: | ||
| 1020 | case VIRTIO_CCW_DOING_SET_VQ: | ||
| 1021 | case VIRTIO_CCW_DOING_SET_IND: | ||
| 1022 | case VIRTIO_CCW_DOING_SET_CONF_IND: | ||
| 1023 | case VIRTIO_CCW_DOING_RESET: | ||
| 1024 | case VIRTIO_CCW_DOING_READ_VQ_CONF: | ||
| 1025 | case VIRTIO_CCW_DOING_SET_IND_ADAPTER: | ||
| 1026 | case VIRTIO_CCW_DOING_SET_VIRTIO_REV: | ||
| 1027 | vcdev->curr_io &= ~activity; | ||
| 1028 | wake_up(&vcdev->wait_q); | ||
| 1029 | break; | ||
| 1030 | default: | ||
| 1031 | /* don't know what to do... */ | ||
| 1032 | dev_warn(&cdev->dev, "Suspicious activity '%08x'\n", | ||
| 1033 | activity); | ||
| 1034 | WARN_ON(1); | ||
| 1035 | break; | ||
| 1036 | } | ||
| 1037 | } | ||
| 1038 | for_each_set_bit(i, &vcdev->indicators, | 1050 | for_each_set_bit(i, &vcdev->indicators, |
| 1039 | sizeof(vcdev->indicators) * BITS_PER_BYTE) { | 1051 | sizeof(vcdev->indicators) * BITS_PER_BYTE) { |
| 1040 | /* The bit clear must happen before the vring kick. */ | 1052 | /* The bit clear must happen before the vring kick. */ |
| @@ -219,13 +219,13 @@ static int sdev_runtime_suspend(struct device *dev) · 218 unmodified lines | |||
| 219 | struct scsi_device *sdev = to_scsi_device(dev); | 219 | struct scsi_device *sdev = to_scsi_device(dev); |
| 220 | int err = 0; | 220 | int err = 0; |
| 221 | 221 | ||
| 222 | if (pm && pm->runtime_suspend) { | 222 | err = blk_pre_runtime_suspend(sdev->request_queue); |
| 223 | err = blk_pre_runtime_suspend(sdev->request_queue); | 223 | if (err) |
| 224 | if (err) | 224 | return err; |
| 225 | return err; | 225 | if (pm && pm->runtime_suspend) |
| 226 | err = pm->runtime_suspend(dev); | 226 | err = pm->runtime_suspend(dev); |
| 227 | blk_post_runtime_suspend(sdev->request_queue, err); | 227 | blk_post_runtime_suspend(sdev->request_queue, err); |
| 228 | } | 228 | |
| 229 | return err; | 229 | return err; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| @@ -248,11 +248,11 @@ static int sdev_runtime_resume(struct device *dev) · 16 unmodified lines | |||
| 248 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 248 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
| 249 | int err = 0; | 249 | int err = 0; |
| 250 | 250 | ||
| 251 | if (pm && pm->runtime_resume) { | 251 | blk_pre_runtime_resume(sdev->request_queue); |
| 252 | blk_pre_runtime_resume(sdev->request_queue); | 252 | if (pm && pm->runtime_resume) |
| 253 | err = pm->runtime_resume(dev); | 253 | err = pm->runtime_resume(dev); |
| 254 | blk_post_runtime_resume(sdev->request_queue, err); | 254 | blk_post_runtime_resume(sdev->request_queue, err); |
| 255 | } | 255 | |
| 256 | return err; | 256 | return err; |
| 257 | } | 257 | } |
| 258 | 258 | ||
| @@ -84,6 +84,7 @@ static void init_device_slot_control(unsigned char *dest_desc, · 83 unmodified lines | |||
| 84 | static int ses_recv_diag(struct scsi_device *sdev, int page_code, | 84 | static int ses_recv_diag(struct scsi_device *sdev, int page_code, |
| 85 | void *buf, int bufflen) | 85 | void *buf, int bufflen) |
| 86 | { | 86 | { |
| 87 | int ret; | ||
| 87 | unsigned char cmd[] = { | 88 | unsigned char cmd[] = { |
| 88 | RECEIVE_DIAGNOSTIC, | 89 | RECEIVE_DIAGNOSTIC, |
| 89 | 1, /* Set PCV bit */ | 90 | 1, /* Set PCV bit */ |
| @@ -92,9 +93,26 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, · 2 unmodified lines | |||
| 92 | bufflen & 0xff, | 93 | bufflen & 0xff, |
| 93 | 0 | 94 | 0 |
| 94 | }; | 95 | }; |
| 96 | unsigned char recv_page_code; | ||
| 95 | 97 | ||
| 96 | return scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, | 98 | ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, |
| 97 | NULL, SES_TIMEOUT, SES_RETRIES, NULL); | 99 | NULL, SES_TIMEOUT, SES_RETRIES, NULL); |
| 100 | if (unlikely(!ret)) | ||
| 101 | return ret; | ||
| 102 | |||
| 103 | recv_page_code = ((unsigned char *)buf)[0]; | ||
| 104 | |||
| 105 | if (likely(recv_page_code == page_code)) | ||
| 106 | return ret; | ||
| 107 | |||
| 108 | /* successful diagnostic but wrong page code. This happens to some | ||
| 109 | * USB devices, just print a message and pretend there was an error */ | ||
| 110 | |||
| 111 | sdev_printk(KERN_ERR, sdev, | ||
| 112 | "Wrong diagnostic page; asked for %d got %u\n", | ||
| 113 | page_code, recv_page_code); | ||
| 114 | |||
| 115 | return -EINVAL; | ||
| 98 | } | 116 | } |
| 99 | 117 | ||
| 100 | static int ses_send_diag(struct scsi_device *sdev, int page_code, | 118 | static int ses_send_diag(struct scsi_device *sdev, int page_code, |
| @@ -541,7 +559,15 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, · 440 unmodified lines | |||
| 541 | if (desc_ptr) | 559 | if (desc_ptr) |
| 542 | desc_ptr += len; | 560 | desc_ptr += len; |
| 543 | 561 | ||
| 544 | if (addl_desc_ptr) | 562 | if (addl_desc_ptr && |
| 563 | /* only find additional descriptions for specific devices */ | ||
| 564 | (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE || | ||
| 565 | type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE || | ||
| 566 | type_ptr[0] == ENCLOSURE_COMPONENT_SAS_EXPANDER || | ||
| 567 | /* these elements are optional */ | ||
| 568 | type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_TARGET_PORT || | ||
| 569 | type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT || | ||
| 570 | type_ptr[0] == ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS)) | ||
| 545 | addl_desc_ptr += addl_desc_ptr[1] + 2; | 571 | addl_desc_ptr += addl_desc_ptr[1] + 2; |
| 546 | 572 | ||
| 547 | } | 573 | } |
| @@ -167,7 +167,7 @@ static inline int is_double_byte_mode(struct fsl_dspi *dspi) · 166 unmodified lines | |||
| 167 | { | 167 | { |
| 168 | unsigned int val; | 168 | unsigned int val; |
| 169 | 169 | ||
| 170 | regmap_read(dspi->regmap, SPI_CTAR(dspi->cs), &val); | 170 | regmap_read(dspi->regmap, SPI_CTAR(0), &val); |
| 171 | 171 | ||
| 172 | return ((val & SPI_FRAME_BITS_MASK) == SPI_FRAME_BITS(8)) ? 0 : 1; | 172 | return ((val & SPI_FRAME_BITS_MASK) == SPI_FRAME_BITS(8)) ? 0 : 1; |
| 173 | } | 173 | } |
| @@ -257,7 +257,7 @@ static u32 dspi_data_to_pushr(struct fsl_dspi *dspi, int tx_word) · 83 unmodified lines | |||
| 257 | 257 | ||
| 258 | return SPI_PUSHR_TXDATA(d16) | | 258 | return SPI_PUSHR_TXDATA(d16) | |
| 259 | SPI_PUSHR_PCS(dspi->cs) | | 259 | SPI_PUSHR_PCS(dspi->cs) | |
| 260 | SPI_PUSHR_CTAS(dspi->cs) | | 260 | SPI_PUSHR_CTAS(0) | |
| 261 | SPI_PUSHR_CONT; | 261 | SPI_PUSHR_CONT; |
| 262 | } | 262 | } |
| 263 | 263 | ||
| @@ -290,7 +290,7 @@ static int dspi_eoq_write(struct fsl_dspi *dspi) · 26 unmodified lines | |||
| 290 | */ | 290 | */ |
| 291 | if (tx_word && (dspi->len == 1)) { | 291 | if (tx_word && (dspi->len == 1)) { |
| 292 | dspi->dataflags |= TRAN_STATE_WORD_ODD_NUM; | 292 | dspi->dataflags |= TRAN_STATE_WORD_ODD_NUM; |
| 293 | regmap_update_bits(dspi->regmap, SPI_CTAR(dspi->cs), | 293 | regmap_update_bits(dspi->regmap, SPI_CTAR(0), |
| 294 | SPI_FRAME_BITS_MASK, SPI_FRAME_BITS(8)); | 294 | SPI_FRAME_BITS_MASK, SPI_FRAME_BITS(8)); |
| 295 | tx_word = 0; | 295 | tx_word = 0; |
| 296 | } | 296 | } |
| @@ -339,7 +339,7 @@ static int dspi_tcfq_write(struct fsl_dspi *dspi) · 42 unmodified lines | |||
| 339 | 339 | ||
| 340 | if (tx_word && (dspi->len == 1)) { | 340 | if (tx_word && (dspi->len == 1)) { |
| 341 | dspi->dataflags |= TRAN_STATE_WORD_ODD_NUM; | 341 | dspi->dataflags |= TRAN_STATE_WORD_ODD_NUM; |
| 342 | regmap_update_bits(dspi->regmap, SPI_CTAR(dspi->cs), | 342 | regmap_update_bits(dspi->regmap, SPI_CTAR(0), |
| 343 | SPI_FRAME_BITS_MASK, SPI_FRAME_BITS(8)); | 343 | SPI_FRAME_BITS_MASK, SPI_FRAME_BITS(8)); |
| 344 | tx_word = 0; | 344 | tx_word = 0; |
| 345 | } | 345 | } |
| @@ -407,7 +407,7 @@ static int dspi_transfer_one_message(struct spi_master *master, · 61 unmodified lines | |||
| 407 | regmap_update_bits(dspi->regmap, SPI_MCR, | 407 | regmap_update_bits(dspi->regmap, SPI_MCR, |
| 408 | SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, | 408 | SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, |
| 409 | SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); | 409 | SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); |
| 410 | regmap_write(dspi->regmap, SPI_CTAR(dspi->cs), | 410 | regmap_write(dspi->regmap, SPI_CTAR(0), |
| 411 | dspi->cur_chip->ctar_val); | 411 | dspi->cur_chip->ctar_val); |
| 412 | 412 | ||
| 413 | trans_mode = dspi->devtype_data->trans_mode; | 413 | trans_mode = dspi->devtype_data->trans_mode; |
| @@ -566,7 +566,7 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) · 152 unmodified lines | |||
| 566 | if (!dspi->len) { | 566 | if (!dspi->len) { |
| 567 | if (dspi->dataflags & TRAN_STATE_WORD_ODD_NUM) { | 567 | if (dspi->dataflags & TRAN_STATE_WORD_ODD_NUM) { |
| 568 | regmap_update_bits(dspi->regmap, | 568 | regmap_update_bits(dspi->regmap, |
| 569 | SPI_CTAR(dspi->cs), | 569 | SPI_CTAR(0), |
| 570 | SPI_FRAME_BITS_MASK, | 570 | SPI_FRAME_BITS_MASK, |
| 571 | SPI_FRAME_BITS(16)); | 571 | SPI_FRAME_BITS(16)); |
| 572 | dspi->dataflags &= ~TRAN_STATE_WORD_ODD_NUM; | 572 | dspi->dataflags &= ~TRAN_STATE_WORD_ODD_NUM; |
| @@ -1705,7 +1705,7 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size) · 1704 unmodified lines | |||
| 1705 | master->bus_num = -1; | 1705 | master->bus_num = -1; |
| 1706 | master->num_chipselect = 1; | 1706 | master->num_chipselect = 1; |
| 1707 | master->dev.class = &spi_master_class; | 1707 | master->dev.class = &spi_master_class; |
| 1708 | master->dev.parent = get_device(dev); | 1708 | master->dev.parent = dev; |
| 1709 | spi_master_set_devdata(master, &master[1]); | 1709 | spi_master_set_devdata(master, &master[1]); |
| 1710 | 1710 | ||
| 1711 | return master; | 1711 | return master; |
| @@ -651,11 +651,11 @@ static int spidev_release(struct inode *inode, struct file *filp) · 650 unmodified lines | |||
| 651 | kfree(spidev->rx_buffer); | 651 | kfree(spidev->rx_buffer); |
| 652 | spidev->rx_buffer = NULL; | 652 | spidev->rx_buffer = NULL; |
| 653 | 653 | ||
| 654 | spin_lock_irq(&spidev->spi_lock); | ||
| 654 | if (spidev->spi) | 655 | if (spidev->spi) |
| 655 | spidev->speed_hz = spidev->spi->max_speed_hz; | 656 | spidev->speed_hz = spidev->spi->max_speed_hz; |
| 656 | 657 | ||
| 657 | /* ... after we unbound from the underlying device? */ | 658 | /* ... after we unbound from the underlying device? */ |
| 658 | spin_lock_irq(&spidev->spi_lock); | ||
| 659 | dofree = (spidev->spi == NULL); | 659 | dofree = (spidev->spi == NULL); |
| 660 | spin_unlock_irq(&spidev->spi_lock); | 660 | spin_unlock_irq(&spidev->spi_lock); |
| 661 | 661 | ||
| @@ -81,7 +81,7 @@ static int ion_chunk_heap_allocate(struct ion_heap *heap, · 80 unmodified lines | |||
| 81 | err: | 81 | err: |
| 82 | sg = table->sgl; | 82 | sg = table->sgl; |
| 83 | for (i -= 1; i >= 0; i--) { | 83 | for (i -= 1; i >= 0; i--) { |
| 84 | gen_pool_free(chunk_heap->pool, sg_phys(sg) & PAGE_MASK, | 84 | gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)), |
| 85 | sg->length); | 85 | sg->length); |
| 86 | sg = sg_next(sg); | 86 | sg = sg_next(sg); |
| 87 | } | 87 | } |
| @@ -109,7 +109,7 @@ static void ion_chunk_heap_free(struct ion_buffer *buffer) · 21 unmodified lines | |||
| 109 | DMA_BIDIRECTIONAL); | 109 | DMA_BIDIRECTIONAL); |
| 110 | 110 | ||
| 111 | for_each_sg(table->sgl, sg, table->nents, i) { | 111 | for_each_sg(table->sgl, sg, table->nents, i) { |
| 112 | gen_pool_free(chunk_heap->pool, sg_phys(sg) & PAGE_MASK, | 112 | gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)), |
| 113 | sg->length); | 113 | sg->length); |
| 114 | } | 114 | } |
| 115 | chunk_heap->allocated -= allocated_size; | 115 | chunk_heap->allocated -= allocated_size; |
| @@ -159,7 +159,7 @@ static irqreturn_t iio_simple_dummy_get_timestamp(int irq, void *private) · 158 unmodified lines | |||
| 159 | struct iio_dummy_state *st = iio_priv(indio_dev); | 159 | struct iio_dummy_state *st = iio_priv(indio_dev); |
| 160 | 160 | ||
| 161 | st->event_timestamp = iio_get_time_ns(); | 161 | st->event_timestamp = iio_get_time_ns(); |
| 162 | return IRQ_HANDLED; | 162 | return IRQ_WAKE_THREAD; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | /** | 165 | /** |
| @@ -1270,6 +1270,7 @@ static int · 1269 unmodified lines | |||
| 1270 | echo_copyout_lsm(struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) | 1270 | echo_copyout_lsm(struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) |
| 1271 | { | 1271 | { |
| 1272 | struct lov_stripe_md *ulsm = _ulsm; | 1272 | struct lov_stripe_md *ulsm = _ulsm; |
| 1273 | struct lov_oinfo **p; | ||
| 1273 | int nob, i; | 1274 | int nob, i; |
| 1274 | 1275 | ||
| 1275 | nob = offsetof(struct lov_stripe_md, lsm_oinfo[lsm->lsm_stripe_count]); | 1276 | nob = offsetof(struct lov_stripe_md, lsm_oinfo[lsm->lsm_stripe_count]); |
| @@ -1279,9 +1280,10 @@ echo_copyout_lsm(struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) · 3 unmodified lines | |||
| 1279 | if (copy_to_user(ulsm, lsm, sizeof(*ulsm))) | 1280 | if (copy_to_user(ulsm, lsm, sizeof(*ulsm))) |
| 1280 | return -EFAULT; | 1281 | return -EFAULT; |
| 1281 | 1282 | ||
| 1282 | for (i = 0; i < lsm->lsm_stripe_count; i++) { | 1283 | for (i = 0, p = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, p++) { |
| 1283 | if (copy_to_user(ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i], | 1284 | struct lov_oinfo __user *up; |
| 1284 | sizeof(lsm->lsm_oinfo[0]))) | 1285 | if (get_user(up, ulsm->lsm_oinfo + i) || |
| 1286 | copy_to_user(up, *p, sizeof(struct lov_oinfo))) | ||
| 1285 | return -EFAULT; | 1287 | return -EFAULT; |
| 1286 | } | 1288 | } |
| 1287 | return 0; | 1289 | return 0; |
| @@ -1289,9 +1291,10 @@ echo_copyout_lsm(struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob) · 1 unmodified line | |||
| 1289 | 1291 | ||
| 1290 | static int | 1292 | static int |
| 1291 | echo_copyin_lsm(struct echo_device *ed, struct lov_stripe_md *lsm, | 1293 | echo_copyin_lsm(struct echo_device *ed, struct lov_stripe_md *lsm, |
| 1292 | void *ulsm, int ulsm_nob) | 1294 | struct lov_stripe_md __user *ulsm, int ulsm_nob) |
| 1293 | { | 1295 | { |
| 1294 | struct echo_client_obd *ec = ed->ed_ec; | 1296 | struct echo_client_obd *ec = ed->ed_ec; |
| 1297 | struct lov_oinfo **p; | ||
| 1295 | int i; | 1298 | int i; |
| 1296 | 1299 | ||
| 1297 | if (ulsm_nob < sizeof(*lsm)) | 1300 | if (ulsm_nob < sizeof(*lsm)) |
| @@ -1306,11 +1309,10 @@ echo_copyin_lsm(struct echo_device *ed, struct lov_stripe_md *lsm, · 8 unmodified lines | |||
| 1306 | ((__u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count > ~0UL)) | 1309 | ((__u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count > ~0UL)) |
| 1307 | return -EINVAL; | 1310 | return -EINVAL; |
| 1308 | 1311 | ||
| 1309 | for (i = 0; i < lsm->lsm_stripe_count; i++) { | 1312 | for (i = 0, p = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, p++) { |
| 1310 | if (copy_from_user(lsm->lsm_oinfo[i], | 1313 | struct lov_oinfo __user *up; |
| 1311 | ((struct lov_stripe_md *)ulsm)-> \ | 1314 | if (get_user(up, ulsm->lsm_oinfo + i) || |
| 1312 | lsm_oinfo[i], | 1315 | copy_from_user(*p, up, sizeof(struct lov_oinfo))) |
| 1313 | sizeof(lsm->lsm_oinfo[0]))) | ||
| 1314 | return -EFAULT; | 1316 | return -EFAULT; |
| 1315 | } | 1317 | } |
| 1316 | return 0; | 1318 | return 0; |
| @@ -2054,13 +2054,13 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, · 2053 unmodified lines | |||
| 2054 | size_t eol; | 2054 | size_t eol; |
| 2055 | size_t tail; | 2055 | size_t tail; |
| 2056 | int ret, found = 0; | 2056 | int ret, found = 0; |
| 2057 | bool eof_push = 0; | ||
| 2058 | 2057 | ||
| 2059 | /* N.B. avoid overrun if nr == 0 */ | 2058 | /* N.B. avoid overrun if nr == 0 */ |
| 2060 | n = min(*nr, smp_load_acquire(&ldata->canon_head) - ldata->read_tail); | 2059 | if (!*nr) |
| 2061 | if (!n) | ||
| 2062 | return 0; | 2060 | return 0; |
| 2063 | 2061 | ||
| 2062 | n = min(*nr + 1, smp_load_acquire(&ldata->canon_head) - ldata->read_tail); | ||
| 2063 | |||
| 2064 | tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); | 2064 | tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); |
| 2065 | size = min_t(size_t, tail + n, N_TTY_BUF_SIZE); | 2065 | size = min_t(size_t, tail + n, N_TTY_BUF_SIZE); |
| 2066 | 2066 | ||
| @@ -2081,12 +2081,11 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, · 14 unmodified lines | |||
| 2081 | n = eol - tail; | 2081 | n = eol - tail; |
| 2082 | if (n > N_TTY_BUF_SIZE) | 2082 | if (n > N_TTY_BUF_SIZE) |
| 2083 | n += N_TTY_BUF_SIZE; | 2083 | n += N_TTY_BUF_SIZE; |
| 2084 | n += found; | 2084 | c = n + found; |
| 2085 | c = n; | ||
| 2086 | 2085 | ||
| 2087 | if (found && !ldata->push && read_buf(ldata, eol) == __DISABLED_CHAR) { | 2086 | if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) { |
| 2088 | n--; | 2087 | c = min(*nr, c); |
| 2089 | eof_push = !n && ldata->read_tail != ldata->line_start; | 2088 | n = c; |
| 2090 | } | 2089 | } |
| 2091 | 2090 | ||
| 2092 | n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu size:%zu more:%zu\n", | 2091 | n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu size:%zu more:%zu\n", |
| @@ -2116,7 +2115,7 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, · 23 unmodified lines | |||
| 2116 | ldata->push = 0; | 2115 | ldata->push = 0; |
| 2117 | tty_audit_push(tty); | 2116 | tty_audit_push(tty); |
| 2118 | } | 2117 | } |
| 2119 | return eof_push ? -EAGAIN : 0; | 2118 | return 0; |
| 2120 | } | 2119 | } |
| 2121 | 2120 | ||
| 2122 | extern ssize_t redirected_tty_write(struct file *, const char __user *, | 2121 | extern ssize_t redirected_tty_write(struct file *, const char __user *, |
| @@ -2273,10 +2272,7 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, · 150 unmodified lines | |||
| 2273 | 2272 | ||
| 2274 | if (ldata->icanon && !L_EXTPROC(tty)) { | 2273 | if (ldata->icanon && !L_EXTPROC(tty)) { |
| 2275 | retval = canon_copy_from_read_buf(tty, &b, &nr); | 2274 | retval = canon_copy_from_read_buf(tty, &b, &nr); |
| 2276 | if (retval == -EAGAIN) { | 2275 | if (retval) |
| 2277 | retval = 0; | ||
| 2278 | continue; | ||
| 2279 | } else if (retval) | ||
| 2280 | break; | 2276 | break; |
| 2281 | } else { | 2277 | } else { |
| 2282 | int uncopied; | 2278 | int uncopied; |
| @@ -115,12 +115,16 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value) · 114 unmodified lines | |||
| 115 | */ | 115 | */ |
| 116 | static int uniphier_serial_dl_read(struct uart_8250_port *up) | 116 | static int uniphier_serial_dl_read(struct uart_8250_port *up) |
| 117 | { | 117 | { |
| 118 | return readl(up->port.membase + UNIPHIER_UART_DLR); | 118 | int offset = UNIPHIER_UART_DLR << up->port.regshift; |
| 119 | |||
| 120 | return readl(up->port.membase + offset); | ||
| 119 | } | 121 | } |
| 120 | 122 | ||
| 121 | static void uniphier_serial_dl_write(struct uart_8250_port *up, int value) | 123 | static void uniphier_serial_dl_write(struct uart_8250_port *up, int value) |
| 122 | { | 124 | { |
| 123 | writel(value, up->port.membase + UNIPHIER_UART_DLR); | 125 | int offset = UNIPHIER_UART_DLR << up->port.regshift; |
| 126 | |||
| 127 | writel(value, up->port.membase + offset); | ||
| 124 | } | 128 | } |
| 125 | 129 | ||
| 126 | static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port, | 130 | static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port, |
| @@ -115,6 +115,7 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match) · 114 unmodified lines | |||
| 115 | if (buf && !parse_options(&early_console_dev, buf)) | 115 | if (buf && !parse_options(&early_console_dev, buf)) |
| 116 | buf = NULL; | 116 | buf = NULL; |
| 117 | 117 | ||
| 118 | spin_lock_init(&port->lock); | ||
| 118 | port->uartclk = BASE_BAUD * 16; | 119 | port->uartclk = BASE_BAUD * 16; |
| 119 | if (port->mapbase) | 120 | if (port->mapbase) |
| 120 | port->membase = earlycon_map(port->mapbase, 64); | 121 | port->membase = earlycon_map(port->mapbase, 64); |
| @@ -202,6 +203,7 @@ int __init of_setup_earlycon(unsigned long addr, · 81 unmodified lines | |||
| 202 | int err; | 203 | int err; |
| 203 | struct uart_port *port = &early_console_dev.port; | 204 | struct uart_port *port = &early_console_dev.port; |
| 204 | 205 | ||
| 206 | spin_lock_init(&port->lock); | ||
| 205 | port->iotype = UPIO_MEM; | 207 | port->iotype = UPIO_MEM; |
| 206 | port->mapbase = addr; | 208 | port->mapbase = addr; |
| 207 | port->uartclk = BASE_BAUD * 16; | 209 | port->uartclk = BASE_BAUD * 16; |
| @@ -1437,7 +1437,7 @@ static void sci_request_dma(struct uart_port *port) · 1436 unmodified lines | |||
| 1437 | sg_init_table(sg, 1); | 1437 | sg_init_table(sg, 1); |
| 1438 | s->rx_buf[i] = buf; | 1438 | s->rx_buf[i] = buf; |
| 1439 | sg_dma_address(sg) = dma; | 1439 | sg_dma_address(sg) = dma; |
| 1440 | sg->length = s->buf_len_rx; | 1440 | sg_dma_len(sg) = s->buf_len_rx; |
| 1441 | 1441 | ||
| 1442 | buf += s->buf_len_rx; | 1442 | buf += s->buf_len_rx; |
| 1443 | dma += s->buf_len_rx; | 1443 | dma += s->buf_len_rx; |
| @@ -450,7 +450,7 @@ receive_buf(struct tty_struct *tty, struct tty_buffer *head, int count) · 449 unmodified lines | |||
| 450 | count = disc->ops->receive_buf2(tty, p, f, count); | 450 | count = disc->ops->receive_buf2(tty, p, f, count); |
| 451 | else { | 451 | else { |
| 452 | count = min_t(int, count, tty->receive_room); | 452 | count = min_t(int, count, tty->receive_room); |
| 453 | if (count) | 453 | if (count && disc->ops->receive_buf) |
| 454 | disc->ops->receive_buf(tty, p, f, count); | 454 | disc->ops->receive_buf(tty, p, f, count); |
| 455 | } | 455 | } |
| 456 | return count; | 456 | return count; |
| @@ -1838,6 +1838,11 @@ static const struct usb_device_id acm_ids[] = { · 1837 unmodified lines | |||
| 1838 | }, | 1838 | }, |
| 1839 | #endif | 1839 | #endif |
| 1840 | 1840 | ||
| 1841 | /* Exclude Infineon Flash Loader utility */ | ||
| 1842 | { USB_DEVICE(0x058b, 0x0041), | ||
| 1843 | .driver_info = IGNORE_DEVICE, | ||
| 1844 | }, | ||
| 1845 | |||
| 1841 | /* control interfaces without any protocol set */ | 1846 | /* control interfaces without any protocol set */ |
| 1842 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, | 1847 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
| 1843 | USB_CDC_PROTO_NONE) }, | 1848 | USB_CDC_PROTO_NONE) }, |
| @@ -115,7 +115,8 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, · 114 unmodified lines | |||
| 115 | USB_SS_MULT(desc->bmAttributes) > 3) { | 115 | USB_SS_MULT(desc->bmAttributes) > 3) { |
| 116 | dev_warn(ddev, "Isoc endpoint has Mult of %d in " | 116 | dev_warn(ddev, "Isoc endpoint has Mult of %d in " |
| 117 | "config %d interface %d altsetting %d ep %d: " | 117 | "config %d interface %d altsetting %d ep %d: " |
| 118 | "setting to 3\n", desc->bmAttributes + 1, | 118 | "setting to 3\n", |
| 119 | USB_SS_MULT(desc->bmAttributes), | ||
| 119 | cfgno, inum, asnum, ep->desc.bEndpointAddress); | 120 | cfgno, inum, asnum, ep->desc.bEndpointAddress); |
| 120 | ep->ss_ep_comp.bmAttributes = 2; | 121 | ep->ss_ep_comp.bmAttributes = 2; |
| 121 | } | 122 | } |
| @@ -124,6 +124,10 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev) · 123 unmodified lines | |||
| 124 | 124 | ||
| 125 | int usb_device_supports_lpm(struct usb_device *udev) | 125 | int usb_device_supports_lpm(struct usb_device *udev) |
| 126 | { | 126 | { |
| 127 | /* Some devices have trouble with LPM */ | ||
| 128 | if (udev->quirks & USB_QUIRK_NO_LPM) | ||
| 129 | return 0; | ||
| 130 | |||
| 127 | /* USB 2.1 (and greater) devices indicate LPM support through | 131 | /* USB 2.1 (and greater) devices indicate LPM support through |
| 128 | * their USB 2.0 Extended Capabilities BOS descriptor. | 132 | * their USB 2.0 Extended Capabilities BOS descriptor. |
| 129 | */ | 133 | */ |
| @@ -1031,10 +1035,20 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · 901 unmodified lines | |||
| 1031 | unsigned delay; | 1035 | unsigned delay; |
| 1032 | 1036 | ||
| 1033 | /* Continue a partial initialization */ | 1037 | /* Continue a partial initialization */ |
| 1034 | if (type == HUB_INIT2) | 1038 | if (type == HUB_INIT2 || type == HUB_INIT3) { |
| 1035 | goto init2; | 1039 | device_lock(hub->intfdev); |
| 1036 | if (type == HUB_INIT3) | 1040 | |
| 1041 | /* Was the hub disconnected while we were waiting? */ | ||
| 1042 | if (hub->disconnected) { | ||
| 1043 | device_unlock(hub->intfdev); | ||
| 1044 | kref_put(&hub->kref, hub_release); | ||
| 1045 | return; | ||
| 1046 | } | ||
| 1047 | if (type == HUB_INIT2) | ||
| 1048 | goto init2; | ||
| 1037 | goto init3; | 1049 | goto init3; |
| 1050 | } | ||
| 1051 | kref_get(&hub->kref); | ||
| 1038 | 1052 | ||
| 1039 | /* The superspeed hub except for root hub has to use Hub Depth | 1053 | /* The superspeed hub except for root hub has to use Hub Depth |
| 1040 | * value as an offset into the route string to locate the bits | 1054 | * value as an offset into the route string to locate the bits |
| @@ -1232,6 +1246,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · 191 unmodified lines | |||
| 1232 | queue_delayed_work(system_power_efficient_wq, | 1246 | queue_delayed_work(system_power_efficient_wq, |
| 1233 | &hub->init_work, | 1247 | &hub->init_work, |
| 1234 | msecs_to_jiffies(delay)); | 1248 | msecs_to_jiffies(delay)); |
| 1249 | device_unlock(hub->intfdev); | ||
| 1235 | return; /* Continues at init3: below */ | 1250 | return; /* Continues at init3: below */ |
| 1236 | } else { | 1251 | } else { |
| 1237 | msleep(delay); | 1252 | msleep(delay); |
| @@ -1253,6 +1268,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · 15 unmodified lines | |||
| 1253 | /* Allow autosuspend if it was suppressed */ | 1268 | /* Allow autosuspend if it was suppressed */ |
| 1254 | if (type <= HUB_INIT3) | 1269 | if (type <= HUB_INIT3) |
| 1255 | usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); | 1270 | usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); |
| 1271 | |||
| 1272 | if (type == HUB_INIT2 || type == HUB_INIT3) | ||
| 1273 | device_unlock(hub->intfdev); | ||
| 1274 | |||
| 1275 | kref_put(&hub->kref, hub_release); | ||
| 1256 | } | 1276 | } |
| 1257 | 1277 | ||
| 1258 | /* Implement the continuations for the delays above */ | 1278 | /* Implement the continuations for the delays above */ |
| @@ -4512,6 +4532,8 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1, · 3253 unmodified lines | |||
| 4512 | goto fail; | 4532 | goto fail; |
| 4513 | } | 4533 | } |
| 4514 | 4534 | ||
| 4535 | usb_detect_quirks(udev); | ||
| 4536 | |||
| 4515 | if (udev->wusb == 0 && le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0201) { | 4537 | if (udev->wusb == 0 && le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0201) { |
| 4516 | retval = usb_get_bos_descriptor(udev); | 4538 | retval = usb_get_bos_descriptor(udev); |
| 4517 | if (!retval) { | 4539 | if (!retval) { |
| @@ -4710,7 +4732,6 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, · 192 unmodified lines | |||
| 4710 | if (status < 0) | 4732 | if (status < 0) |
| 4711 | goto loop; | 4733 | goto loop; |
| 4712 | 4734 | ||
| 4713 | usb_detect_quirks(udev); | ||
| 4714 | if (udev->quirks & USB_QUIRK_DELAY_INIT) | 4735 | if (udev->quirks & USB_QUIRK_DELAY_INIT) |
| 4715 | msleep(1000); | 4736 | msleep(1000); |
| 4716 | 4737 | ||
| @@ -5326,9 +5347,6 @@ static int usb_reset_and_verify_device(struct usb_device *udev) · 609 unmodified lines | |||
| 5326 | if (udev->usb2_hw_lpm_enabled == 1) | 5347 | if (udev->usb2_hw_lpm_enabled == 1) |
| 5327 | usb_set_usb2_hardware_lpm(udev, 0); | 5348 | usb_set_usb2_hardware_lpm(udev, 0); |
| 5328 | 5349 | ||
| 5329 | bos = udev->bos; | ||
| 5330 | udev->bos = NULL; | ||
| 5331 | |||
| 5332 | /* Disable LPM and LTM while we reset the device and reinstall the alt | 5350 | /* Disable LPM and LTM while we reset the device and reinstall the alt |
| 5333 | * settings. Device-initiated LPM settings, and system exit latency | 5351 | * settings. Device-initiated LPM settings, and system exit latency |
| 5334 | * settings are cleared when the device is reset, so we have to set | 5352 | * settings are cleared when the device is reset, so we have to set |
| @@ -5337,15 +5355,18 @@ static int usb_reset_and_verify_device(struct usb_device *udev) · 2 unmodified lines | |||
| 5337 | ret = usb_unlocked_disable_lpm(udev); | 5355 | ret = usb_unlocked_disable_lpm(udev); |
| 5338 | if (ret) { | 5356 | if (ret) { |
| 5339 | dev_err(&udev->dev, "%s Failed to disable LPM\n.", __func__); | 5357 | dev_err(&udev->dev, "%s Failed to disable LPM\n.", __func__); |
| 5340 | goto re_enumerate; | 5358 | goto re_enumerate_no_bos; |
| 5341 | } | 5359 | } |
| 5342 | ret = usb_disable_ltm(udev); | 5360 | ret = usb_disable_ltm(udev); |
| 5343 | if (ret) { | 5361 | if (ret) { |
| 5344 | dev_err(&udev->dev, "%s Failed to disable LTM\n.", | 5362 | dev_err(&udev->dev, "%s Failed to disable LTM\n.", |
| 5345 | __func__); | 5363 | __func__); |
| 5346 | goto re_enumerate; | 5364 | goto re_enumerate_no_bos; |
| 5347 | } | 5365 | } |
| 5348 | 5366 | ||
| 5367 | bos = udev->bos; | ||
| 5368 | udev->bos = NULL; | ||
| 5369 | |||
| 5349 | for (i = 0; i < SET_CONFIG_TRIES; ++i) { | 5370 | for (i = 0; i < SET_CONFIG_TRIES; ++i) { |
| 5350 | 5371 | ||
| 5351 | /* ep0 maxpacket size may change; let the HCD know about it. | 5372 | /* ep0 maxpacket size may change; let the HCD know about it. |
| @@ -5442,10 +5463,11 @@ done: · 90 unmodified lines | |||
| 5442 | return 0; | 5463 | return 0; |
| 5443 | 5464 | ||
| 5444 | re_enumerate: | 5465 | re_enumerate: |
| 5445 | /* LPM state doesn't matter when we're about to destroy the device. */ | ||
| 5446 | hub_port_logical_disconnect(parent_hub, port1); | ||
| 5447 | usb_release_bos_descriptor(udev); | 5466 | usb_release_bos_descriptor(udev); |
| 5448 | udev->bos = bos; | 5467 | udev->bos = bos; |
| 5468 | re_enumerate_no_bos: | ||
| 5469 | /* LPM state doesn't matter when we're about to destroy the device. */ | ||
| 5470 | hub_port_logical_disconnect(parent_hub, port1); | ||
| 5449 | return -ENODEV; | 5471 | return -ENODEV; |
| 5450 | } | 5472 | } |
| 5451 | 5473 | ||
| @@ -206,7 +206,7 @@ static int link_peers(struct usb_port *left, struct usb_port *right) · 205 unmodified lines | |||
| 206 | else | 206 | else |
| 207 | method = "default"; | 207 | method = "default"; |
| 208 | 208 | ||
| 209 | pr_warn("usb: failed to peer %s and %s by %s (%s:%s) (%s:%s)\n", | 209 | pr_debug("usb: failed to peer %s and %s by %s (%s:%s) (%s:%s)\n", |
| 210 | dev_name(&left->dev), dev_name(&right->dev), method, | 210 | dev_name(&left->dev), dev_name(&right->dev), method, |
| 211 | dev_name(&left->dev), | 211 | dev_name(&left->dev), |
| 212 | lpeer ? dev_name(&lpeer->dev) : "none", | 212 | lpeer ? dev_name(&lpeer->dev) : "none", |
| @@ -265,7 +265,7 @@ static void link_peers_report(struct usb_port *left, struct usb_port *right) · 52 unmodified lines | |||
| 265 | if (rc == 0) { | 265 | if (rc == 0) { |
| 266 | dev_dbg(&left->dev, "peered to %s\n", dev_name(&right->dev)); | 266 | dev_dbg(&left->dev, "peered to %s\n", dev_name(&right->dev)); |
| 267 | } else { | 267 | } else { |
| 268 | dev_warn(&left->dev, "failed to peer to %s (%d)\n", | 268 | dev_dbg(&left->dev, "failed to peer to %s (%d)\n", |
| 269 | dev_name(&right->dev), rc); | 269 | dev_name(&right->dev), rc); |
| 270 | pr_warn_once("usb: port power management may be unreliable\n"); | 270 | pr_warn_once("usb: port power management may be unreliable\n"); |
| 271 | usb_port_block_power_off = 1; | 271 | usb_port_block_power_off = 1; |
| @@ -125,6 +125,9 @@ static const struct usb_device_id usb_quirk_list[] = { · 124 unmodified lines | |||
| 125 | { USB_DEVICE(0x04f3, 0x016f), .driver_info = | 125 | { USB_DEVICE(0x04f3, 0x016f), .driver_info = |
| 126 | USB_QUIRK_DEVICE_QUALIFIER }, | 126 | USB_QUIRK_DEVICE_QUALIFIER }, |
| 127 | 127 | ||
| 128 | { USB_DEVICE(0x04f3, 0x21b8), .driver_info = | ||
| 129 | USB_QUIRK_DEVICE_QUALIFIER }, | ||
| 130 | |||
| 128 | /* Roland SC-8820 */ | 131 | /* Roland SC-8820 */ |
| 129 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, | 132 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 130 | 133 | ||
| @@ -199,6 +202,12 @@ static const struct usb_device_id usb_quirk_list[] = { · 68 unmodified lines | |||
| 199 | { USB_DEVICE(0x1a0a, 0x0200), .driver_info = | 202 | { USB_DEVICE(0x1a0a, 0x0200), .driver_info = |
| 200 | USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, | 203 | USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
| 201 | 204 | ||
| 205 | /* Blackmagic Design Intensity Shuttle */ | ||
| 206 | { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM }, | ||
| 207 | |||
| 208 | /* Blackmagic Design UltraStudio SDI */ | ||
| 209 | { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, | ||
| 210 | |||
| 202 | { } /* terminating entry must be last */ | 211 | { } /* terminating entry must be last */ |
| 203 | }; | 212 | }; |
| 204 | 213 | ||
| @@ -125,9 +125,11 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) · 124 unmodified lines | |||
| 125 | if (ret) | 125 | if (ret) |
| 126 | return ret; | 126 | return ret; |
| 127 | 127 | ||
| 128 | ret = clk_prepare_enable(hsotg->clk); | 128 | if (hsotg->clk) { |
| 129 | if (ret) | 129 | ret = clk_prepare_enable(hsotg->clk); |
| 130 | return ret; | 130 | if (ret) |
| 131 | return ret; | ||
| 132 | } | ||
| 131 | 133 | ||
| 132 | if (hsotg->uphy) | 134 | if (hsotg->uphy) |
| 133 | ret = usb_phy_init(hsotg->uphy); | 135 | ret = usb_phy_init(hsotg->uphy); |
| @@ -175,7 +177,8 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) · 41 unmodified lines | |||
| 175 | if (ret) | 177 | if (ret) |
| 176 | return ret; | 178 | return ret; |
| 177 | 179 | ||
| 178 | clk_disable_unprepare(hsotg->clk); | 180 | if (hsotg->clk) |
| 181 | clk_disable_unprepare(hsotg->clk); | ||
| 179 | 182 | ||
| 180 | ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), | 183 | ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), |
| 181 | hsotg->supplies); | 184 | hsotg->supplies); |
| @@ -212,14 +215,41 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) · 30 unmodified lines | |||
| 212 | */ | 215 | */ |
| 213 | hsotg->phy = devm_phy_get(hsotg->dev, "usb2-phy"); | 216 | hsotg->phy = devm_phy_get(hsotg->dev, "usb2-phy"); |
| 214 | if (IS_ERR(hsotg->phy)) { | 217 | if (IS_ERR(hsotg->phy)) { |
| 215 | hsotg->phy = NULL; | 218 | ret = PTR_ERR(hsotg->phy); |
| 219 | switch (ret) { | ||
| 220 | case -ENODEV: | ||
| 221 | case -ENOSYS: | ||
| 222 | hsotg->phy = NULL; | ||
| 223 | break; | ||
| 224 | case -EPROBE_DEFER: | ||
| 225 | return ret; | ||
| 226 | default: | ||
| 227 | dev_err(hsotg->dev, "error getting phy %d\n", ret); | ||
| 228 | return ret; | ||
| 229 | } | ||
| 230 | } | ||
| 231 | |||
| 232 | if (!hsotg->phy) { | ||
| 216 | hsotg->uphy = devm_usb_get_phy(hsotg->dev, USB_PHY_TYPE_USB2); | 233 | hsotg->uphy = devm_usb_get_phy(hsotg->dev, USB_PHY_TYPE_USB2); |
| 217 | if (IS_ERR(hsotg->uphy)) | 234 | if (IS_ERR(hsotg->uphy)) { |
| 218 | hsotg->uphy = NULL; | 235 | ret = PTR_ERR(hsotg->uphy); |
| 219 | else | 236 | switch (ret) { |
| 220 | hsotg->plat = dev_get_platdata(hsotg->dev); | 237 | case -ENODEV: |
| 238 | case -ENXIO: | ||
| 239 | hsotg->uphy = NULL; | ||
| 240 | break; | ||
| 241 | case -EPROBE_DEFER: | ||
| 242 | return ret; | ||
| 243 | default: | ||
| 244 | dev_err(hsotg->dev, "error getting usb phy %d\n", | ||
| 245 | ret); | ||
| 246 | return ret; | ||
| 247 | } | ||
| 248 | } | ||
| 221 | } | 249 | } |
| 222 | 250 | ||
| 251 | hsotg->plat = dev_get_platdata(hsotg->dev); | ||
| 252 | |||
| 223 | if (hsotg->phy) { | 253 | if (hsotg->phy) { |
| 224 | /* | 254 | /* |
| 225 | * If using the generic PHY framework, check if the PHY bus | 255 | * If using the generic PHY framework, check if the PHY bus |
| @@ -229,11 +259,6 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) · 3 unmodified lines | |||
| 229 | hsotg->phyif = GUSBCFG_PHYIF8; | 259 | hsotg->phyif = GUSBCFG_PHYIF8; |
| 230 | } | 260 | } |
| 231 | 261 | ||
| 232 | if (!hsotg->phy && !hsotg->uphy && !hsotg->plat) { | ||
| 233 | dev_err(hsotg->dev, "no platform data or transceiver defined\n"); | ||
| 234 | return -EPROBE_DEFER; | ||
| 235 | } | ||
| 236 | |||
| 237 | /* Clock */ | 262 | /* Clock */ |
| 238 | hsotg->clk = devm_clk_get(hsotg->dev, "otg"); | 263 | hsotg->clk = devm_clk_get(hsotg->dev, "otg"); |
| 239 | if (IS_ERR(hsotg->clk)) { | 264 | if (IS_ERR(hsotg->clk)) { |
| @@ -342,20 +367,6 @@ static int dwc2_driver_probe(struct platform_device *dev) · 102 unmodified lines | |||
| 342 | if (retval) | 367 | if (retval) |
| 343 | return retval; | 368 | return retval; |
| 344 | 369 | ||
| 345 | irq = platform_get_irq(dev, 0); | ||
| 346 | if (irq < 0) { | ||
| 347 | dev_err(&dev->dev, "missing IRQ resource\n"); | ||
| 348 | return irq; | ||
| 349 | } | ||
| 350 | |||
| 351 | dev_dbg(hsotg->dev, "registering common handler for irq%d\n", | ||
| 352 | irq); | ||
| 353 | retval = devm_request_irq(hsotg->dev, irq, | ||
| 354 | dwc2_handle_common_intr, IRQF_SHARED, | ||
| 355 | dev_name(hsotg->dev), hsotg); | ||
| 356 | if (retval) | ||
| 357 | return retval; | ||
| 358 | |||
| 359 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 370 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
| 360 | hsotg->regs = devm_ioremap_resource(&dev->dev, res); | 371 | hsotg->regs = devm_ioremap_resource(&dev->dev, res); |
| 361 | if (IS_ERR(hsotg->regs)) | 372 | if (IS_ERR(hsotg->regs)) |
| @@ -390,6 +401,20 @@ static int dwc2_driver_probe(struct platform_device *dev) · 28 unmodified lines | |||
| 390 | 401 | ||
| 391 | dwc2_set_all_params(hsotg->core_params, -1); | 402 | dwc2_set_all_params(hsotg->core_params, -1); |
| 392 | 403 | ||
| 404 | irq = platform_get_irq(dev, 0); | ||
| 405 | if (irq < 0) { | ||
| 406 | dev_err(&dev->dev, "missing IRQ resource\n"); | ||
| 407 | return irq; | ||
| 408 | } | ||
| 409 | |||
| 410 | dev_dbg(hsotg->dev, "registering common handler for irq%d\n", | ||
| 411 | irq); | ||
| 412 | retval = devm_request_irq(hsotg->dev, irq, | ||
| 413 | dwc2_handle_common_intr, IRQF_SHARED, | ||
| 414 | dev_name(hsotg->dev), hsotg); | ||
| 415 | if (retval) | ||
| 416 | return retval; | ||
| 417 | |||
| 393 | retval = dwc2_lowlevel_hw_enable(hsotg); | 418 | retval = dwc2_lowlevel_hw_enable(hsotg); |
| 394 | if (retval) | 419 | if (retval) |
| 395 | return retval; | 420 | return retval; |
| @@ -1078,6 +1078,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) · 1077 unmodified lines | |||
| 1078 | * little bit faster. | 1078 | * little bit faster. |
| 1079 | */ | 1079 | */ |
| 1080 | if (!usb_endpoint_xfer_isoc(dep->endpoint.desc) && | 1080 | if (!usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
| 1081 | !usb_endpoint_xfer_int(dep->endpoint.desc) && | ||
| 1081 | !(dep->flags & DWC3_EP_BUSY)) { | 1082 | !(dep->flags & DWC3_EP_BUSY)) { |
| 1082 | ret = __dwc3_gadget_kick_transfer(dep, 0, true); | 1083 | ret = __dwc3_gadget_kick_transfer(dep, 0, true); |
| 1083 | goto out; | 1084 | goto out; |
| @@ -423,7 +423,7 @@ static ssize_t __ffs_ep0_read_events(struct ffs_data *ffs, char __user *buf, · 422 unmodified lines | |||
| 423 | spin_unlock_irq(&ffs->ev.waitq.lock); | 423 | spin_unlock_irq(&ffs->ev.waitq.lock); |
| 424 | mutex_unlock(&ffs->mutex); | 424 | mutex_unlock(&ffs->mutex); |
| 425 | 425 | ||
| 426 | return unlikely(__copy_to_user(buf, events, size)) ? -EFAULT : size; | 426 | return unlikely(copy_to_user(buf, events, size)) ? -EFAULT : size; |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | static ssize_t ffs_ep0_read(struct file *file, char __user *buf, | 429 | static ssize_t ffs_ep0_read(struct file *file, char __user *buf, |
| @@ -513,7 +513,7 @@ static ssize_t ffs_ep0_read(struct file *file, char __user *buf, · 83 unmodified lines | |||
| 513 | 513 | ||
| 514 | /* unlocks spinlock */ | 514 | /* unlocks spinlock */ |
| 515 | ret = __ffs_ep0_queue_wait(ffs, data, len); | 515 | ret = __ffs_ep0_queue_wait(ffs, data, len); |
| 516 | if (likely(ret > 0) && unlikely(__copy_to_user(buf, data, len))) | 516 | if (likely(ret > 0) && unlikely(copy_to_user(buf, data, len))) |
| 517 | ret = -EFAULT; | 517 | ret = -EFAULT; |
| 518 | goto done_mutex; | 518 | goto done_mutex; |
| 519 | 519 | ||
| @@ -3493,7 +3493,7 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len) · 2973 unmodified lines | |||
| 3493 | if (unlikely(!data)) | 3493 | if (unlikely(!data)) |
| 3494 | return ERR_PTR(-ENOMEM); | 3494 | return ERR_PTR(-ENOMEM); |
| 3495 | 3495 | ||
| 3496 | if (unlikely(__copy_from_user(data, buf, len))) { | 3496 | if (unlikely(copy_from_user(data, buf, len))) { |
| 3497 | kfree(data); | 3497 | kfree(data); |
| 3498 | return ERR_PTR(-EFAULT); | 3498 | return ERR_PTR(-EFAULT); |
| 3499 | } | 3499 | } |
| @@ -370,6 +370,7 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt) · 369 unmodified lines | |||
| 370 | if (err) { | 370 | if (err) { |
| 371 | ERROR(midi, "%s queue req: %d\n", | 371 | ERROR(midi, "%s queue req: %d\n", |
| 372 | midi->out_ep->name, err); | 372 | midi->out_ep->name, err); |
| 373 | free_ep_req(midi->out_ep, req); | ||
| 373 | } | 374 | } |
| 374 | } | 375 | } |
| 375 | 376 | ||
| @@ -545,7 +546,7 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req) · 169 unmodified lines | |||
| 545 | } | 546 | } |
| 546 | } | 547 | } |
| 547 | 548 | ||
| 548 | if (req->length > 0) { | 549 | if (req->length > 0 && ep->enabled) { |
| 549 | int err; | 550 | int err; |
| 550 | 551 | ||
| 551 | err = usb_ep_queue(ep, req, GFP_ATOMIC); | 552 | err = usb_ep_queue(ep, req, GFP_ATOMIC); |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | #define UVC_ATTR(prefix, cname, aname) \ | 20 | #define UVC_ATTR(prefix, cname, aname) \ |
| 21 | static struct configfs_attribute prefix##attr_##cname = { \ | 21 | static struct configfs_attribute prefix##attr_##cname = { \ |
| 22 | .ca_name = __stringify(aname), \ | 22 | .ca_name = __stringify(aname), \ |
| 23 | .ca_mode = S_IRUGO, \ | 23 | .ca_mode = S_IRUGO | S_IWUGO, \ |
| 24 | .ca_owner = THIS_MODULE, \ | 24 | .ca_owner = THIS_MODULE, \ |
| 25 | .show = prefix##cname##_show, \ | 25 | .show = prefix##cname##_show, \ |
| 26 | .store = prefix##cname##_store, \ | 26 | .store = prefix##cname##_store, \ |
| @@ -2536,6 +2536,9 @@ static int pxa_udc_suspend(struct platform_device *_dev, pm_message_t state) · 2535 unmodified lines | |||
| 2536 | udc->pullup_resume = udc->pullup_on; | 2536 | udc->pullup_resume = udc->pullup_on; |
| 2537 | dplus_pullup(udc, 0); | 2537 | dplus_pullup(udc, 0); |
| 2538 | 2538 | ||
| 2539 | if (udc->driver) | ||
| 2540 | udc->driver->disconnect(&udc->gadget); | ||
| 2541 | |||
| 2539 | return 0; | 2542 | return 0; |
| 2540 | } | 2543 | } |
| 2541 | 2544 | ||
| @@ -473,6 +473,8 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) · 472 unmodified lines | |||
| 473 | if (!pdata) | 473 | if (!pdata) |
| 474 | return -ENOMEM; | 474 | return -ENOMEM; |
| 475 | 475 | ||
| 476 | pdev->dev.platform_data = pdata; | ||
| 477 | |||
| 476 | if (!of_property_read_u32(np, "num-ports", &ports)) | 478 | if (!of_property_read_u32(np, "num-ports", &ports)) |
| 477 | pdata->ports = ports; | 479 | pdata->ports = ports; |
| 478 | 480 | ||
| @@ -483,6 +485,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) · 4 unmodified lines | |||
| 483 | */ | 485 | */ |
| 484 | if (i >= pdata->ports) { | 486 | if (i >= pdata->ports) { |
| 485 | pdata->vbus_pin[i] = -EINVAL; | 487 | pdata->vbus_pin[i] = -EINVAL; |
| 488 | pdata->overcurrent_pin[i] = -EINVAL; | ||
| 486 | continue; | 489 | continue; |
| 487 | } | 490 | } |
| 488 | 491 | ||
| @@ -513,10 +516,8 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) · 24 unmodified lines | |||
| 513 | } | 516 | } |
| 514 | 517 | ||
| 515 | at91_for_each_port(i) { | 518 | at91_for_each_port(i) { |
| 516 | if (i >= pdata->ports) { | 519 | if (i >= pdata->ports) |
| 517 | pdata->overcurrent_pin[i] = -EINVAL; | 520 | break; |
| 518 | continue; | ||
| 519 | } | ||
| 520 | 521 | ||
| 521 | pdata->overcurrent_pin[i] = | 522 | pdata->overcurrent_pin[i] = |
| 522 | of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags); | 523 | of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags); |
| @@ -552,8 +553,6 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) · 29 unmodified lines | |||
| 552 | } | 553 | } |
| 553 | } | 554 | } |
| 554 | 555 | ||
| 555 | pdev->dev.platform_data = pdata; | ||
| 556 | |||
| 557 | device_init_wakeup(&pdev->dev, 1); | 556 | device_init_wakeup(&pdev->dev, 1); |
| 558 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | 557 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); |
| 559 | } | 558 | } |
| @@ -377,6 +377,10 @@ static int qset_fill_page_list(struct whc *whc, struct whc_std *std, gfp_t mem_f · 376 unmodified lines | |||
| 377 | if (std->pl_virt == NULL) | 377 | if (std->pl_virt == NULL) |
| 378 | return -ENOMEM; | 378 | return -ENOMEM; |
| 379 | std->dma_addr = dma_map_single(whc->wusbhc.dev, std->pl_virt, pl_len, DMA_TO_DEVICE); | 379 | std->dma_addr = dma_map_single(whc->wusbhc.dev, std->pl_virt, pl_len, DMA_TO_DEVICE); |
| 380 | if (dma_mapping_error(whc->wusbhc.dev, std->dma_addr)) { | ||
| 381 | kfree(std->pl_virt); | ||
| 382 | return -EFAULT; | ||
| 383 | } | ||
| 380 | 384 | ||
| 381 | for (p = 0; p < std->num_pointers; p++) { | 385 | for (p = 0; p < std->num_pointers; p++) { |
| 382 | std->pl_virt[p].buf_ptr = cpu_to_le64(dma_addr); | 386 | std->pl_virt[p].buf_ptr = cpu_to_le64(dma_addr); |
| @@ -733,8 +733,30 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, · 732 unmodified lines | |||
| 733 | if ((raw_port_status & PORT_RESET) || | 733 | if ((raw_port_status & PORT_RESET) || |
| 734 | !(raw_port_status & PORT_PE)) | 734 | !(raw_port_status & PORT_PE)) |
| 735 | return 0xffffffff; | 735 | return 0xffffffff; |
| 736 | if (time_after_eq(jiffies, | 736 | /* did port event handler already start resume timing? */ |
| 737 | bus_state->resume_done[wIndex])) { | 737 | if (!bus_state->resume_done[wIndex]) { |
| 738 | /* If not, maybe we are in a host initated resume? */ | ||
| 739 | if (test_bit(wIndex, &bus_state->resuming_ports)) { | ||
| 740 | /* Host initated resume doesn't time the resume | ||
| 741 | * signalling using resume_done[]. | ||
| 742 | * It manually sets RESUME state, sleeps 20ms | ||
| 743 | * and sets U0 state. This should probably be | ||
| 744 | * changed, but not right now. | ||
| 745 | */ | ||
| 746 | } else { | ||
| 747 | /* port resume was discovered now and here, | ||
| 748 | * start resume timing | ||
| 749 | */ | ||
| 750 | unsigned long timeout = jiffies + | ||
| 751 | msecs_to_jiffies(USB_RESUME_TIMEOUT); | ||
| 752 | |||
| 753 | set_bit(wIndex, &bus_state->resuming_ports); | ||
| 754 | bus_state->resume_done[wIndex] = timeout; | ||
| 755 | mod_timer(&hcd->rh_timer, timeout); | ||
| 756 | } | ||
| 757 | /* Has resume been signalled for USB_RESUME_TIME yet? */ | ||
| 758 | } else if (time_after_eq(jiffies, | ||
| 759 | bus_state->resume_done[wIndex])) { | ||
| 738 | int time_left; | 760 | int time_left; |
| 739 | 761 | ||
| 740 | xhci_dbg(xhci, "Resume USB2 port %d\n", | 762 | xhci_dbg(xhci, "Resume USB2 port %d\n", |
| @@ -775,13 +797,26 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, · 34 unmodified lines | |||
| 775 | } else { | 797 | } else { |
| 776 | /* | 798 | /* |
| 777 | * The resume has been signaling for less than | 799 | * The resume has been signaling for less than |
| 778 | * 20ms. Report the port status as SUSPEND, | 800 | * USB_RESUME_TIME. Report the port status as SUSPEND, |
| 779 | * let the usbcore check port status again | 801 | * let the usbcore check port status again and clear |
| 780 | * and clear resume signaling later. | 802 | * resume signaling later. |
| 781 | */ | 803 | */ |
| 782 | status |= USB_PORT_STAT_SUSPEND; | 804 | status |= USB_PORT_STAT_SUSPEND; |
| 783 | } | 805 | } |
| 784 | } | 806 | } |
| 807 | /* | ||
| 808 | * Clear stale usb2 resume signalling variables in case port changed | ||
| 809 | * state during resume signalling. For example on error | ||
| 810 | */ | ||
| 811 | if ((bus_state->resume_done[wIndex] || | ||
| 812 | test_bit(wIndex, &bus_state->resuming_ports)) && | ||
| 813 | (raw_port_status & PORT_PLS_MASK) != XDEV_U3 && | ||
| 814 | (raw_port_status & PORT_PLS_MASK) != XDEV_RESUME) { | ||
| 815 | bus_state->resume_done[wIndex] = 0; | ||
| 816 | clear_bit(wIndex, &bus_state->resuming_ports); | ||
| 817 | } | ||
| 818 | |||
| 819 | |||
| 785 | if ((raw_port_status & PORT_PLS_MASK) == XDEV_U0 && | 820 | if ((raw_port_status & PORT_PLS_MASK) == XDEV_U0 && |
| 786 | (raw_port_status & PORT_POWER)) { | 821 | (raw_port_status & PORT_POWER)) { |
| 787 | if (bus_state->suspended_ports & (1 << wIndex)) { | 822 | if (bus_state->suspended_ports & (1 << wIndex)) { |
| @@ -1115,6 +1150,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, · 327 unmodified lines | |||
| 1115 | if ((temp & PORT_PE) == 0) | 1150 | if ((temp & PORT_PE) == 0) |
| 1116 | goto error; | 1151 | goto error; |
| 1117 | 1152 | ||
| 1153 | set_bit(wIndex, &bus_state->resuming_ports); | ||
| 1118 | xhci_set_link_state(xhci, port_array, wIndex, | 1154 | xhci_set_link_state(xhci, port_array, wIndex, |
| 1119 | XDEV_RESUME); | 1155 | XDEV_RESUME); |
| 1120 | spin_unlock_irqrestore(&xhci->lock, flags); | 1156 | spin_unlock_irqrestore(&xhci->lock, flags); |
| @@ -1122,6 +1158,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, · 1 unmodified line | |||
| 1122 | spin_lock_irqsave(&xhci->lock, flags); | 1158 | spin_lock_irqsave(&xhci->lock, flags); |
| 1123 | xhci_set_link_state(xhci, port_array, wIndex, | 1159 | xhci_set_link_state(xhci, port_array, wIndex, |
| 1124 | XDEV_U0); | 1160 | XDEV_U0); |
| 1161 | clear_bit(wIndex, &bus_state->resuming_ports); | ||
| 1125 | } | 1162 | } |
| 1126 | bus_state->port_c_suspend |= 1 << wIndex; | 1163 | bus_state->port_c_suspend |= 1 << wIndex; |
| 1127 | 1164 | ||
| @@ -188,10 +188,14 @@ static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) · 187 unmodified lines | |||
| 188 | 0xb7, 0x0c, 0x34, 0xac, 0x01, 0xe9, 0xbf, 0x45, | 188 | 0xb7, 0x0c, 0x34, 0xac, 0x01, 0xe9, 0xbf, 0x45, |
| 189 | 0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23, | 189 | 0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23, |
| 190 | }; | 190 | }; |
| 191 | acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), intel_dsm_uuid, 3, 1, NULL); | 191 | union acpi_object *obj; |
| 192 | |||
| 193 | obj = acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), intel_dsm_uuid, 3, 1, | ||
| 194 | NULL); | ||
| 195 | ACPI_FREE(obj); | ||
| 192 | } | 196 | } |
| 193 | #else | 197 | #else |
| 194 | static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { } | 198 | static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { } |
| 195 | #endif /* CONFIG_ACPI */ | 199 | #endif /* CONFIG_ACPI */ |
| 196 | 200 | ||
| 197 | /* called during probe() after chip reset completes */ | 201 | /* called during probe() after chip reset completes */ |
| @@ -1583,7 +1583,8 @@ static void handle_port_status(struct xhci_hcd *xhci, · 1582 unmodified lines | |||
| 1583 | */ | 1583 | */ |
| 1584 | bogus_port_status = true; | 1584 | bogus_port_status = true; |
| 1585 | goto cleanup; | 1585 | goto cleanup; |
| 1586 | } else { | 1586 | } else if (!test_bit(faked_port_index, |
| 1587 | &bus_state->resuming_ports)) { | ||
| 1587 | xhci_dbg(xhci, "resume HS port %d\n", port_id); | 1588 | xhci_dbg(xhci, "resume HS port %d\n", port_id); |
| 1588 | bus_state->resume_done[faked_port_index] = jiffies + | 1589 | bus_state->resume_done[faked_port_index] = jiffies + |
| 1589 | msecs_to_jiffies(USB_RESUME_TIMEOUT); | 1590 | msecs_to_jiffies(USB_RESUME_TIMEOUT); |
| @@ -4778,8 +4778,16 @@ int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, · 4777 unmodified lines | |||
| 4778 | ctrl_ctx->add_flags |= cpu_to_le32(SLOT_FLAG); | 4778 | ctrl_ctx->add_flags |= cpu_to_le32(SLOT_FLAG); |
| 4779 | slot_ctx = xhci_get_slot_ctx(xhci, config_cmd->in_ctx); | 4779 | slot_ctx = xhci_get_slot_ctx(xhci, config_cmd->in_ctx); |
| 4780 | slot_ctx->dev_info |= cpu_to_le32(DEV_HUB); | 4780 | slot_ctx->dev_info |= cpu_to_le32(DEV_HUB); |
| 4781 | /* | ||
| 4782 | * refer to section 6.2.2: MTT should be 0 for full speed hub, | ||
| 4783 | * but it may be already set to 1 when setup an xHCI virtual | ||
| 4784 | * device, so clear it anyway. | ||
| 4785 | */ | ||
| 4781 | if (tt->multi) | 4786 | if (tt->multi) |
| 4782 | slot_ctx->dev_info |= cpu_to_le32(DEV_MTT); | 4787 | slot_ctx->dev_info |= cpu_to_le32(DEV_MTT); |
| 4788 | else if (hdev->speed == USB_SPEED_FULL) | ||
| 4789 | slot_ctx->dev_info &= cpu_to_le32(~DEV_MTT); | ||
| 4790 | |||
| 4783 | if (xhci->hci_version > 0x95) { | 4791 | if (xhci->hci_version > 0x95) { |
| 4784 | xhci_dbg(xhci, "xHCI version %x needs hub " | 4792 | xhci_dbg(xhci, "xHCI version %x needs hub " |
| 4785 | "TT think time and number of ports\n", | 4793 | "TT think time and number of ports\n", |
| @@ -159,7 +159,7 @@ config USB_TI_CPPI_DMA · 158 unmodified lines | |||
| 159 | 159 | ||
| 160 | config USB_TI_CPPI41_DMA | 160 | config USB_TI_CPPI41_DMA |
| 161 | bool 'TI CPPI 4.1 (AM335x)' | 161 | bool 'TI CPPI 4.1 (AM335x)' |
| 162 | depends on ARCH_OMAP | 162 | depends on ARCH_OMAP && DMADEVICES |
| 163 | select TI_CPPI41 | 163 | select TI_CPPI41 |
| 164 | 164 | ||
| 165 | config USB_TUSB_OMAP_DMA | 165 | config USB_TUSB_OMAP_DMA |
| @@ -2017,7 +2017,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) · 2016 unmodified lines | |||
| 2017 | /* We need musb_read/write functions initialized for PM */ | 2017 | /* We need musb_read/write functions initialized for PM */ |
| 2018 | pm_runtime_use_autosuspend(musb->controller); | 2018 | pm_runtime_use_autosuspend(musb->controller); |
| 2019 | pm_runtime_set_autosuspend_delay(musb->controller, 200); | 2019 | pm_runtime_set_autosuspend_delay(musb->controller, 200); |
| 2020 | pm_runtime_irq_safe(musb->controller); | ||
| 2021 | pm_runtime_enable(musb->controller); | 2020 | pm_runtime_enable(musb->controller); |
| 2022 | 2021 | ||
| 2023 | /* The musb_platform_init() call: | 2022 | /* The musb_platform_init() call: |
| @@ -2095,6 +2094,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) · 71 unmodified lines | |||
| 2095 | #ifndef CONFIG_MUSB_PIO_ONLY | 2094 | #ifndef CONFIG_MUSB_PIO_ONLY |
| 2096 | if (!musb->ops->dma_init || !musb->ops->dma_exit) { | 2095 | if (!musb->ops->dma_init || !musb->ops->dma_exit) { |
| 2097 | dev_err(dev, "DMA controller not set\n"); | 2096 | dev_err(dev, "DMA controller not set\n"); |
| 2097 | status = -ENODEV; | ||
| 2098 | goto fail2; | 2098 | goto fail2; |
| 2099 | } | 2099 | } |
| 2100 | musb_dma_controller_create = musb->ops->dma_init; | 2100 | musb_dma_controller_create = musb->ops->dma_init; |
| @@ -2218,6 +2218,12 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) · 117 unmodified lines | |||
| 2218 | 2218 | ||
| 2219 | pm_runtime_put(musb->controller); | 2219 | pm_runtime_put(musb->controller); |
| 2220 | 2220 | ||
| 2221 | /* | ||
| 2222 | * For why this is currently needed, see commit 3e43a0725637 | ||
| 2223 | * ("usb: musb: core: add pm_runtime_irq_safe()") | ||
| 2224 | */ | ||
| 2225 | pm_runtime_irq_safe(musb->controller); | ||
| 2226 | |||
| 2221 | return 0; | 2227 | return 0; |
| 2222 | 2228 | ||
| 2223 | fail5: | 2229 | fail5: |
| @@ -1506,7 +1506,6 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) · 1505 unmodified lines | |||
| 1506 | { | 1506 | { |
| 1507 | struct msm_otg_platform_data *pdata; | 1507 | struct msm_otg_platform_data *pdata; |
| 1508 | struct extcon_dev *ext_id, *ext_vbus; | 1508 | struct extcon_dev *ext_id, *ext_vbus; |
| 1509 | const struct of_device_id *id; | ||
| 1510 | struct device_node *node = pdev->dev.of_node; | 1509 | struct device_node *node = pdev->dev.of_node; |
| 1511 | struct property *prop; | 1510 | struct property *prop; |
| 1512 | int len, ret, words; | 1511 | int len, ret, words; |
| @@ -1518,8 +1517,9 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) · 5 unmodified lines | |||
| 1518 | 1517 | ||
| 1519 | motg->pdata = pdata; | 1518 | motg->pdata = pdata; |
| 1520 | 1519 | ||
| 1521 | id = of_match_device(msm_otg_dt_match, &pdev->dev); | 1520 | pdata->phy_type = (enum msm_usb_phy_type)of_device_get_match_data(&pdev->dev); |
| 1522 | pdata->phy_type = (enum msm_usb_phy_type) id->data; | 1521 | if (!pdata->phy_type) |
| 1522 | return 1; | ||
| 1523 | 1523 | ||
| 1524 | motg->link_rst = devm_reset_control_get(&pdev->dev, "link"); | 1524 | motg->link_rst = devm_reset_control_get(&pdev->dev, "link"); |
| 1525 | if (IS_ERR(motg->link_rst)) | 1525 | if (IS_ERR(motg->link_rst)) |
| @@ -143,12 +143,17 @@ static const struct mxs_phy_data imx6sx_phy_data = { · 142 unmodified lines | |||
| 143 | .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, | 143 | .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, |
| 144 | }; | 144 | }; |
| 145 | 145 | ||
| 146 | static const struct mxs_phy_data imx6ul_phy_data = { | ||
| 147 | .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, | ||
| 148 | }; | ||
| 149 | |||
| 146 | static const struct of_device_id mxs_phy_dt_ids[] = { | 150 | static const struct of_device_id mxs_phy_dt_ids[] = { |
| 147 | { .compatible = "fsl,imx6sx-usbphy", .data = &imx6sx_phy_data, }, | 151 | { .compatible = "fsl,imx6sx-usbphy", .data = &imx6sx_phy_data, }, |
| 148 | { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, | 152 | { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, |
| 149 | { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, | 153 | { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, |
| 150 | { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, | 154 | { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, |
| 151 | { .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, }, | 155 | { .compatible = "fsl,vf610-usbphy", .data = &vf610_phy_data, }, |
| 156 | { .compatible = "fsl,imx6ul-usbphy", .data = &imx6ul_phy_data, }, | ||
| 152 | { /* sentinel */ } | 157 | { /* sentinel */ } |
| 153 | }; | 158 | }; |
| 154 | MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); | 159 | MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); |
| @@ -131,7 +131,8 @@ static void __usbhsg_queue_pop(struct usbhsg_uep *uep, · 130 unmodified lines | |||
| 131 | struct device *dev = usbhsg_gpriv_to_dev(gpriv); | 131 | struct device *dev = usbhsg_gpriv_to_dev(gpriv); |
| 132 | struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); | 132 | struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); |
| 133 | 133 | ||
| 134 | dev_dbg(dev, "pipe %d : queue pop\n", usbhs_pipe_number(pipe)); | 134 | if (pipe) |
| 135 | dev_dbg(dev, "pipe %d : queue pop\n", usbhs_pipe_number(pipe)); | ||
| 135 | 136 | ||
| 136 | ureq->req.status = status; | 137 | ureq->req.status = status; |
| 137 | spin_unlock(usbhs_priv_to_lock(priv)); | 138 | spin_unlock(usbhs_priv_to_lock(priv)); |
| @@ -685,7 +686,13 @@ static int usbhsg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) · 547 unmodified lines | |||
| 685 | struct usbhsg_request *ureq = usbhsg_req_to_ureq(req); | 686 | struct usbhsg_request *ureq = usbhsg_req_to_ureq(req); |
| 686 | struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); | 687 | struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); |
| 687 | 688 | ||
| 688 | usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq)); | 689 | if (pipe) |
| 690 | usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq)); | ||
| 691 | |||
| 692 | /* | ||
| 693 | * To dequeue a request, this driver should call the usbhsg_queue_pop() | ||
| 694 | * even if the pipe is NULL. | ||
| 695 | */ | ||
| 689 | usbhsg_queue_pop(uep, ureq, -ECONNRESET); | 696 | usbhsg_queue_pop(uep, ureq, -ECONNRESET); |
| 690 | 697 | ||
| 691 | return 0; | 698 | return 0; |
| @@ -132,7 +132,6 @@ static const struct usb_device_id id_table[] = { · 131 unmodified lines | |||
| 132 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 132 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
| 133 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ | 133 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
| 134 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ | 134 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ |
| 135 | { USB_DEVICE(0x10C4, 0xEA80) }, /* Silicon Labs factory default */ | ||
| 136 | { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ | 135 | { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ |
| 137 | { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ | 136 | { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ |
| 138 | { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */ | 137 | { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */ |
| @@ -531,7 +531,8 @@ static int ipaq_open(struct tty_struct *tty, · 530 unmodified lines | |||
| 531 | * through. Since this has a reasonably high failure rate, we retry | 531 | * through. Since this has a reasonably high failure rate, we retry |
| 532 | * several times. | 532 | * several times. |
| 533 | */ | 533 | */ |
| 534 | while (retries--) { | 534 | while (retries) { |
| 535 | retries--; | ||
| 535 | result = usb_control_msg(serial->dev, | 536 | result = usb_control_msg(serial->dev, |
| 536 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, | 537 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, |
| 537 | 0x1, 0, NULL, 0, 100); | 538 | 0x1, 0, NULL, 0, 100); |
| @@ -53,6 +53,7 @@ DEVICE(funsoft, FUNSOFT_IDS); · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | /* Infineon Flashloader driver */ | 54 | /* Infineon Flashloader driver */ |
| 55 | #define FLASHLOADER_IDS() \ | 55 | #define FLASHLOADER_IDS() \ |
| 56 | { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \ | ||
| 56 | { USB_DEVICE(0x8087, 0x0716) } | 57 | { USB_DEVICE(0x8087, 0x0716) } |
| 57 | DEVICE(flashloader, FLASHLOADER_IDS); | 58 | DEVICE(flashloader, FLASHLOADER_IDS); |
| 58 | 59 | ||
| @@ -796,6 +796,10 @@ static int uas_slave_configure(struct scsi_device *sdev) · 795 unmodified lines | |||
| 796 | if (devinfo->flags & US_FL_NO_REPORT_OPCODES) | 796 | if (devinfo->flags & US_FL_NO_REPORT_OPCODES) |
| 797 | sdev->no_report_opcodes = 1; | 797 | sdev->no_report_opcodes = 1; |
| 798 | 798 | ||
| 799 | /* A few buggy USB-ATA bridges don't understand FUA */ | ||
| 800 | if (devinfo->flags & US_FL_BROKEN_FUA) | ||
| 801 | sdev->broken_fua = 1; | ||
| 802 | |||
| 799 | scsi_change_queue_depth(sdev, devinfo->qdepth - 2); | 803 | scsi_change_queue_depth(sdev, devinfo->qdepth - 2); |
| 800 | return 0; | 804 | return 0; |
| 801 | } | 805 | } |
| @@ -1987,7 +1987,7 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, · 1986 unmodified lines | |||
| 1987 | US_FL_IGNORE_RESIDUE ), | 1987 | US_FL_IGNORE_RESIDUE ), |
| 1988 | 1988 | ||
| 1989 | /* Reported by Michael Büsch <m@bues.ch> */ | 1989 | /* Reported by Michael Büsch <m@bues.ch> */ |
| 1990 | UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114, | 1990 | UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0116, |
| 1991 | "JMicron", | 1991 | "JMicron", |
| 1992 | "USB to ATA/ATAPI Bridge", | 1992 | "USB to ATA/ATAPI Bridge", |
| 1993 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1993 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| @@ -132,7 +132,7 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, · 131 unmodified lines | |||
| 132 | "JMicron", | 132 | "JMicron", |
| 133 | "JMS567", | 133 | "JMS567", |
| 134 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 134 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| 135 | US_FL_NO_REPORT_OPCODES), | 135 | US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES), |
| 136 | 136 | ||
| 137 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | 137 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ |
| 138 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | 138 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, |
| @@ -31,21 +31,6 @@ menuconfig VFIO · 30 unmodified lines | |||
| 31 | 31 | ||
| 32 | If you don't know what to do here, say N. | 32 | If you don't know what to do here, say N. |
| 33 | 33 | ||
| 34 | menuconfig VFIO_NOIOMMU | ||
| 35 | bool "VFIO No-IOMMU support" | ||
| 36 | depends on VFIO | ||
| 37 | help | ||
| 38 | VFIO is built on the ability to isolate devices using the IOMMU. | ||
| 39 | Only with an IOMMU can userspace access to DMA capable devices be | ||
| 40 | considered secure. VFIO No-IOMMU mode enables IOMMU groups for | ||
| 41 | devices without IOMMU backing for the purpose of re-using the VFIO | ||
| 42 | infrastructure in a non-secure mode. Use of this mode will result | ||
| 43 | in an unsupportable kernel and will therefore taint the kernel. | ||
| 44 | Device assignment to virtual machines is also not possible with | ||
| 45 | this mode since there is no IOMMU to provide DMA translation. | ||
| 46 | |||
| 47 | If you don't know what to do here, say N. | ||
| 48 | |||
| 49 | source "drivers/vfio/pci/Kconfig" | 34 | source "drivers/vfio/pci/Kconfig" |
| 50 | source "drivers/vfio/platform/Kconfig" | 35 | source "drivers/vfio/platform/Kconfig" |
| 51 | source "virt/lib/Kconfig" | 36 | source "virt/lib/Kconfig" |
| @@ -940,13 +940,13 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 939 unmodified lines | |||
| 940 | if (pdev->hdr_type != PCI_HEADER_TYPE_NORMAL) | 940 | if (pdev->hdr_type != PCI_HEADER_TYPE_NORMAL) |
| 941 | return -EINVAL; | 941 | return -EINVAL; |
| 942 | 942 | ||
| 943 | group = vfio_iommu_group_get(&pdev->dev); | 943 | group = iommu_group_get(&pdev->dev); |
| 944 | if (!group) | 944 | if (!group) |
| 945 | return -EINVAL; | 945 | return -EINVAL; |
| 946 | 946 | ||
| 947 | vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); | 947 | vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); |
| 948 | if (!vdev) { | 948 | if (!vdev) { |
| 949 | vfio_iommu_group_put(group, &pdev->dev); | 949 | iommu_group_put(group); |
| 950 | return -ENOMEM; | 950 | return -ENOMEM; |
| 951 | } | 951 | } |
| 952 | 952 | ||
| @@ -957,7 +957,7 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 4 unmodified lines | |||
| 957 | 957 | ||
| 958 | ret = vfio_add_group_dev(&pdev->dev, &vfio_pci_ops, vdev); | 958 | ret = vfio_add_group_dev(&pdev->dev, &vfio_pci_ops, vdev); |
| 959 | if (ret) { | 959 | if (ret) { |
| 960 | vfio_iommu_group_put(group, &pdev->dev); | 960 | iommu_group_put(group); |
| 961 | kfree(vdev); | 961 | kfree(vdev); |
| 962 | return ret; | 962 | return ret; |
| 963 | } | 963 | } |
| @@ -993,7 +993,7 @@ static void vfio_pci_remove(struct pci_dev *pdev) · 29 unmodified lines | |||
| 993 | if (!vdev) | 993 | if (!vdev) |
| 994 | return; | 994 | return; |
| 995 | 995 | ||
| 996 | vfio_iommu_group_put(pdev->dev.iommu_group, &pdev->dev); | 996 | iommu_group_put(pdev->dev.iommu_group); |
| 997 | kfree(vdev); | 997 | kfree(vdev); |
| 998 | 998 | ||
| 999 | if (vfio_pci_is_vga(pdev)) { | 999 | if (vfio_pci_is_vga(pdev)) { |
| @@ -1035,7 +1035,7 @@ static pci_ers_result_t vfio_pci_aer_err_detected(struct pci_dev *pdev, · 35 unmodified lines | |||
| 1035 | return PCI_ERS_RESULT_CAN_RECOVER; | 1035 | return PCI_ERS_RESULT_CAN_RECOVER; |
| 1036 | } | 1036 | } |
| 1037 | 1037 | ||
| 1038 | static struct pci_error_handlers vfio_err_handlers = { | 1038 | static const struct pci_error_handlers vfio_err_handlers = { |
| 1039 | .error_detected = vfio_pci_aer_err_detected, | 1039 | .error_detected = vfio_pci_aer_err_detected, |
| 1040 | }; | 1040 | }; |
| 1041 | 1041 | ||
| @@ -92,7 +92,6 @@ static struct platform_driver vfio_platform_driver = { · 91 unmodified lines | |||
| 92 | .remove = vfio_platform_remove, | 92 | .remove = vfio_platform_remove, |
| 93 | .driver = { | 93 | .driver = { |
| 94 | .name = "vfio-platform", | 94 | .name = "vfio-platform", |
| 95 | .owner = THIS_MODULE, | ||
| 96 | }, | 95 | }, |
| 97 | }; | 96 | }; |
| 98 | 97 | ||
| @@ -51,13 +51,10 @@ static vfio_platform_reset_fn_t vfio_platform_lookup_reset(const char *compat, · 50 unmodified lines | |||
| 51 | 51 | ||
| 52 | static void vfio_platform_get_reset(struct vfio_platform_device *vdev) | 52 | static void vfio_platform_get_reset(struct vfio_platform_device *vdev) |
| 53 | { | 53 | { |
| 54 | char modname[256]; | ||
| 55 | |||
| 56 | vdev->reset = vfio_platform_lookup_reset(vdev->compat, | 54 | vdev->reset = vfio_platform_lookup_reset(vdev->compat, |
| 57 | &vdev->reset_module); | 55 | &vdev->reset_module); |
| 58 | if (!vdev->reset) { | 56 | if (!vdev->reset) { |
| 59 | snprintf(modname, 256, "vfio-reset:%s", vdev->compat); | 57 | request_module("vfio-reset:%s", vdev->compat); |
| 60 | request_module(modname); | ||
| 61 | vdev->reset = vfio_platform_lookup_reset(vdev->compat, | 58 | vdev->reset = vfio_platform_lookup_reset(vdev->compat, |
| 62 | &vdev->reset_module); | 59 | &vdev->reset_module); |
| 63 | } | 60 | } |
| @@ -62,7 +62,6 @@ struct vfio_container { · 61 unmodified lines | |||
| 62 | struct rw_semaphore group_lock; | 62 | struct rw_semaphore group_lock; |
| 63 | struct vfio_iommu_driver *iommu_driver; | 63 | struct vfio_iommu_driver *iommu_driver; |
| 64 | void *iommu_data; | 64 | void *iommu_data; |
| 65 | bool noiommu; | ||
| 66 | }; | 65 | }; |
| 67 | 66 | ||
| 68 | struct vfio_unbound_dev { | 67 | struct vfio_unbound_dev { |
| @@ -85,7 +84,6 @@ struct vfio_group { · 16 unmodified lines | |||
| 85 | struct list_head unbound_list; | 84 | struct list_head unbound_list; |
| 86 | struct mutex unbound_lock; | 85 | struct mutex unbound_lock; |
| 87 | atomic_t opened; | 86 | atomic_t opened; |
| 88 | bool noiommu; | ||
| 89 | }; | 87 | }; |
| 90 | 88 | ||
| 91 | struct vfio_device { | 89 | struct vfio_device { |
| @@ -97,147 +95,6 @@ struct vfio_device { · 5 unmodified lines | |||
| 97 | void *device_data; | 95 | void *device_data; |
| 98 | }; | 96 | }; |
| 99 | 97 | ||
| 100 | #ifdef CONFIG_VFIO_NOIOMMU | ||
| 101 | static bool noiommu __read_mostly; | ||
| 102 | module_param_named(enable_unsafe_noiommu_support, | ||
| 103 | noiommu, bool, S_IRUGO | S_IWUSR); | ||
| 104 | MODULE_PARM_DESC(enable_unsafe_noiommu_mode, "Enable UNSAFE, no-IOMMU mode. This mode provides no device isolation, no DMA translation, no host kernel protection, cannot be used for device assignment to virtual machines, requires RAWIO permissions, and will taint the kernel. If you do not know what this is for, step away. (default: false)"); | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* | ||
| 108 | * vfio_iommu_group_{get,put} are only intended for VFIO bus driver probe | ||
| 109 | * and remove functions, any use cases other than acquiring the first | ||
| 110 | * reference for the purpose of calling vfio_add_group_dev() or removing | ||
| 111 | * that symmetric reference after vfio_del_group_dev() should use the raw | ||
| 112 | * iommu_group_{get,put} functions. In particular, vfio_iommu_group_put() | ||
| 113 | * removes the device from the dummy group and cannot be nested. | ||
| 114 | */ | ||
| 115 | struct iommu_group *vfio_iommu_group_get(struct device *dev) | ||
| 116 | { | ||
| 117 | struct iommu_group *group; | ||
| 118 | int __maybe_unused ret; | ||
| 119 | |||
| 120 | group = iommu_group_get(dev); | ||
| 121 | |||
| 122 | #ifdef CONFIG_VFIO_NOIOMMU | ||
| 123 | /* | ||
| 124 | * With noiommu enabled, an IOMMU group will be created for a device | ||
| 125 | * that doesn't already have one and doesn't have an iommu_ops on their | ||
| 126 | * bus. We use iommu_present() again in the main code to detect these | ||
| 127 | * fake groups. | ||
| 128 | */ | ||
| 129 | if (group || !noiommu || iommu_present(dev->bus)) | ||
| 130 | return group; | ||
| 131 | |||
| 132 | group = iommu_group_alloc(); | ||
| 133 | if (IS_ERR(group)) | ||
| 134 | return NULL; | ||
| 135 | |||
| 136 | iommu_group_set_name(group, "vfio-noiommu"); | ||
| 137 | ret = iommu_group_add_device(group, dev); | ||
| 138 | iommu_group_put(group); | ||
| 139 | if (ret) | ||
| 140 | return NULL; | ||
| 141 | |||
| 142 | /* | ||
| 143 | * Where to taint? At this point we've added an IOMMU group for a | ||
| 144 | * device that is not backed by iommu_ops, therefore any iommu_ | ||
| 145 | * callback using iommu_ops can legitimately Oops. So, while we may | ||
| 146 | * be about to give a DMA capable device to a user without IOMMU | ||
| 147 | * protection, which is clearly taint-worthy, let's go ahead and do | ||
| 148 | * it here. | ||
| 149 | */ | ||
| 150 | add_taint(TAINT_USER, LOCKDEP_STILL_OK); | ||
| 151 | dev_warn(dev, "Adding kernel taint for vfio-noiommu group on device\n"); | ||
| 152 | #endif | ||
| 153 | |||
| 154 | return group; | ||
| 155 | } | ||
| 156 | EXPORT_SYMBOL_GPL(vfio_iommu_group_get); | ||
| 157 | |||
| 158 | void vfio_iommu_group_put(struct iommu_group *group, struct device *dev) | ||
| 159 | { | ||
| 160 | #ifdef CONFIG_VFIO_NOIOMMU | ||
| 161 | if (!iommu_present(dev->bus)) | ||
| 162 | iommu_group_remove_device(dev); | ||
| 163 | #endif | ||
| 164 | |||
| 165 | iommu_group_put(group); | ||
| 166 | } | ||
| 167 | EXPORT_SYMBOL_GPL(vfio_iommu_group_put); | ||
| 168 | |||
| 169 | #ifdef CONFIG_VFIO_NOIOMMU | ||
| 170 | static void *vfio_noiommu_open(unsigned long arg) | ||
| 171 | { | ||
| 172 | if (arg != VFIO_NOIOMMU_IOMMU) | ||
| 173 | return ERR_PTR(-EINVAL); | ||
| 174 | if (!capable(CAP_SYS_RAWIO)) | ||
| 175 | return ERR_PTR(-EPERM); | ||
| 176 | |||
| 177 | return NULL; | ||
| 178 | } | ||
| 179 | |||
| 180 | static void vfio_noiommu_release(void *iommu_data) | ||
| 181 | { | ||
| 182 | } | ||
| 183 | |||
| 184 | static long vfio_noiommu_ioctl(void *iommu_data, | ||
| 185 | unsigned int cmd, unsigned long arg) | ||
| 186 | { | ||
| 187 | if (cmd == VFIO_CHECK_EXTENSION) | ||
| 188 | return arg == VFIO_NOIOMMU_IOMMU ? 1 : 0; | ||
| 189 | |||
| 190 | return -ENOTTY; | ||
| 191 | } | ||
| 192 | |||
| 193 | static int vfio_iommu_present(struct device *dev, void *unused) | ||
| 194 | { | ||
| 195 | return iommu_present(dev->bus) ? 1 : 0; | ||
| 196 | } | ||
| 197 | |||
| 198 | static int vfio_noiommu_attach_group(void *iommu_data, | ||
| 199 | struct iommu_group *iommu_group) | ||
| 200 | { | ||
| 201 | return iommu_group_for_each_dev(iommu_group, NULL, | ||
| 202 | vfio_iommu_present) ? -EINVAL : 0; | ||
| 203 | } | ||
| 204 | |||
| 205 | static void vfio_noiommu_detach_group(void *iommu_data, | ||
| 206 | struct iommu_group *iommu_group) | ||
| 207 | { | ||
| 208 | } | ||
| 209 | |||
| 210 | static struct vfio_iommu_driver_ops vfio_noiommu_ops = { | ||
| 211 | .name = "vfio-noiommu", | ||
| 212 | .owner = THIS_MODULE, | ||
| 213 | .open = vfio_noiommu_open, | ||
| 214 | .release = vfio_noiommu_release, | ||
| 215 | .ioctl = vfio_noiommu_ioctl, | ||
| 216 | .attach_group = vfio_noiommu_attach_group, | ||
| 217 | .detach_group = vfio_noiommu_detach_group, | ||
| 218 | }; | ||
| 219 | |||
| 220 | static struct vfio_iommu_driver vfio_noiommu_driver = { | ||
| 221 | .ops = &vfio_noiommu_ops, | ||
| 222 | }; | ||
| 223 | |||
| 224 | /* | ||
| 225 | * Wrap IOMMU drivers, the noiommu driver is the one and only driver for | ||
| 226 | * noiommu groups (and thus containers) and not available for normal groups. | ||
| 227 | */ | ||
| 228 | #define vfio_for_each_iommu_driver(con, pos) \ | ||
| 229 | for (pos = con->noiommu ? &vfio_noiommu_driver : \ | ||
| 230 | list_first_entry(&vfio.iommu_drivers_list, \ | ||
| 231 | struct vfio_iommu_driver, vfio_next); \ | ||
| 232 | (con->noiommu ? pos != NULL : \ | ||
| 233 | &pos->vfio_next != &vfio.iommu_drivers_list); \ | ||
| 234 | pos = con->noiommu ? NULL : list_next_entry(pos, vfio_next)) | ||
| 235 | #else | ||
| 236 | #define vfio_for_each_iommu_driver(con, pos) \ | ||
| 237 | list_for_each_entry(pos, &vfio.iommu_drivers_list, vfio_next) | ||
| 238 | #endif | ||
| 239 | |||
| 240 | |||
| 241 | /** | 98 | /** |
| 242 | * IOMMU driver registration | 99 | * IOMMU driver registration |
| 243 | */ | 100 | */ |
| @@ -342,8 +199,7 @@ static void vfio_group_unlock_and_free(struct vfio_group *group) · 98 unmodified lines | |||
| 342 | /** | 199 | /** |
| 343 | * Group objects - create, release, get, put, search | 200 | * Group objects - create, release, get, put, search |
| 344 | */ | 201 | */ |
| 345 | static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group, | 202 | static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group) |
| 346 | bool noiommu) | ||
| 347 | { | 203 | { |
| 348 | struct vfio_group *group, *tmp; | 204 | struct vfio_group *group, *tmp; |
| 349 | struct device *dev; | 205 | struct device *dev; |
| @@ -361,7 +217,6 @@ static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group, · 11 unmodified lines | |||
| 361 | atomic_set(&group->container_users, 0); | 217 | atomic_set(&group->container_users, 0); |
| 362 | atomic_set(&group->opened, 0); | 218 | atomic_set(&group->opened, 0); |
| 363 | group->iommu_group = iommu_group; | 219 | group->iommu_group = iommu_group; |
| 364 | group->noiommu = noiommu; | ||
| 365 | 220 | ||
| 366 | group->nb.notifier_call = vfio_iommu_group_notifier; | 221 | group->nb.notifier_call = vfio_iommu_group_notifier; |
| 367 | 222 | ||
| @@ -397,8 +252,7 @@ static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group, · 29 unmodified lines | |||
| 397 | 252 | ||
| 398 | dev = device_create(vfio.class, NULL, | 253 | dev = device_create(vfio.class, NULL, |
| 399 | MKDEV(MAJOR(vfio.group_devt), minor), | 254 | MKDEV(MAJOR(vfio.group_devt), minor), |
| 400 | group, "%s%d", noiommu ? "noiommu-" : "", | 255 | group, "%d", iommu_group_id(iommu_group)); |
| 401 | iommu_group_id(iommu_group)); | ||
| 402 | if (IS_ERR(dev)) { | 256 | if (IS_ERR(dev)) { |
| 403 | vfio_free_group_minor(minor); | 257 | vfio_free_group_minor(minor); |
| 404 | vfio_group_unlock_and_free(group); | 258 | vfio_group_unlock_and_free(group); |
| @@ -682,7 +536,7 @@ static int vfio_group_nb_add_dev(struct vfio_group *group, struct device *dev) · 277 unmodified lines | |||
| 682 | return 0; | 536 | return 0; |
| 683 | 537 | ||
| 684 | /* TODO Prevent device auto probing */ | 538 | /* TODO Prevent device auto probing */ |
| 685 | WARN("Device %s added to live group %d!\n", dev_name(dev), | 539 | WARN(1, "Device %s added to live group %d!\n", dev_name(dev), |
| 686 | iommu_group_id(group->iommu_group)); | 540 | iommu_group_id(group->iommu_group)); |
| 687 | 541 | ||
| 688 | return 0; | 542 | return 0; |
| @@ -786,8 +640,7 @@ int vfio_add_group_dev(struct device *dev, · 97 unmodified lines | |||
| 786 | 640 | ||
| 787 | group = vfio_group_get_from_iommu(iommu_group); | 641 | group = vfio_group_get_from_iommu(iommu_group); |
| 788 | if (!group) { | 642 | if (!group) { |
| 789 | group = vfio_create_group(iommu_group, | 643 | group = vfio_create_group(iommu_group); |
| 790 | !iommu_present(dev->bus)); | ||
| 791 | if (IS_ERR(group)) { | 644 | if (IS_ERR(group)) { |
| 792 | iommu_group_put(iommu_group); | 645 | iommu_group_put(iommu_group); |
| 793 | return PTR_ERR(group); | 646 | return PTR_ERR(group); |
| @@ -999,7 +852,8 @@ static long vfio_ioctl_check_extension(struct vfio_container *container, · 205 unmodified lines | |||
| 999 | */ | 852 | */ |
| 1000 | if (!driver) { | 853 | if (!driver) { |
| 1001 | mutex_lock(&vfio.iommu_drivers_lock); | 854 | mutex_lock(&vfio.iommu_drivers_lock); |
| 1002 | vfio_for_each_iommu_driver(container, driver) { | 855 | list_for_each_entry(driver, &vfio.iommu_drivers_list, |
| 856 | vfio_next) { | ||
| 1003 | if (!try_module_get(driver->ops->owner)) | 857 | if (!try_module_get(driver->ops->owner)) |
| 1004 | continue; | 858 | continue; |
| 1005 | 859 | ||
| @@ -1068,7 +922,7 @@ static long vfio_ioctl_set_iommu(struct vfio_container *container, · 62 unmodified lines | |||
| 1068 | } | 922 | } |
| 1069 | 923 | ||
| 1070 | mutex_lock(&vfio.iommu_drivers_lock); | 924 | mutex_lock(&vfio.iommu_drivers_lock); |
| 1071 | vfio_for_each_iommu_driver(container, driver) { | 925 | list_for_each_entry(driver, &vfio.iommu_drivers_list, vfio_next) { |
| 1072 | void *data; | 926 | void *data; |
| 1073 | 927 | ||
| 1074 | if (!try_module_get(driver->ops->owner)) | 928 | if (!try_module_get(driver->ops->owner)) |
| @@ -1333,9 +1187,6 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd) · 258 unmodified lines | |||
| 1333 | if (atomic_read(&group->container_users)) | 1187 | if (atomic_read(&group->container_users)) |
| 1334 | return -EINVAL; | 1188 | return -EINVAL; |
| 1335 | 1189 | ||
| 1336 | if (group->noiommu && !capable(CAP_SYS_RAWIO)) | ||
| 1337 | return -EPERM; | ||
| 1338 | |||
| 1339 | f = fdget(container_fd); | 1190 | f = fdget(container_fd); |
| 1340 | if (!f.file) | 1191 | if (!f.file) |
| 1341 | return -EBADF; | 1192 | return -EBADF; |
| @@ -1351,13 +1202,6 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd) · 9 unmodified lines | |||
| 1351 | 1202 | ||
| 1352 | down_write(&container->group_lock); | 1203 | down_write(&container->group_lock); |
| 1353 | 1204 | ||
| 1354 | /* Real groups and fake groups cannot mix */ | ||
| 1355 | if (!list_empty(&container->group_list) && | ||
| 1356 | container->noiommu != group->noiommu) { | ||
| 1357 | ret = -EPERM; | ||
| 1358 | goto unlock_out; | ||
| 1359 | } | ||
| 1360 | |||
| 1361 | driver = container->iommu_driver; | 1205 | driver = container->iommu_driver; |
| 1362 | if (driver) { | 1206 | if (driver) { |
| 1363 | ret = driver->ops->attach_group(container->iommu_data, | 1207 | ret = driver->ops->attach_group(container->iommu_data, |
| @@ -1367,7 +1211,6 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd) · 3 unmodified lines | |||
| 1367 | } | 1211 | } |
| 1368 | 1212 | ||
| 1369 | group->container = container; | 1213 | group->container = container; |
| 1370 | container->noiommu = group->noiommu; | ||
| 1371 | list_add(&group->container_next, &container->group_list); | 1214 | list_add(&group->container_next, &container->group_list); |
| 1372 | 1215 | ||
| 1373 | /* Get a reference on the container and mark a user within the group */ | 1216 | /* Get a reference on the container and mark a user within the group */ |
| @@ -1398,9 +1241,6 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf) · 24 unmodified lines | |||
| 1398 | !group->container->iommu_driver || !vfio_group_viable(group)) | 1241 | !group->container->iommu_driver || !vfio_group_viable(group)) |
| 1399 | return -EINVAL; | 1242 | return -EINVAL; |
| 1400 | 1243 | ||
| 1401 | if (group->noiommu && !capable(CAP_SYS_RAWIO)) | ||
| 1402 | return -EPERM; | ||
| 1403 | |||
| 1404 | device = vfio_device_get_from_name(group, buf); | 1244 | device = vfio_device_get_from_name(group, buf); |
| 1405 | if (!device) | 1245 | if (!device) |
| 1406 | return -ENODEV; | 1246 | return -ENODEV; |
| @@ -1443,10 +1283,6 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf) · 36 unmodified lines | |||
| 1443 | 1283 | ||
| 1444 | fd_install(ret, filep); | 1284 | fd_install(ret, filep); |
| 1445 | 1285 | ||
| 1446 | if (group->noiommu) | ||
| 1447 | dev_warn(device->dev, "vfio-noiommu device opened by user " | ||
| 1448 | "(%s:%d)\n", current->comm, task_pid_nr(current)); | ||
| 1449 | |||
| 1450 | return ret; | 1286 | return ret; |
| 1451 | } | 1287 | } |
| 1452 | 1288 | ||
| @@ -1535,11 +1371,6 @@ static int vfio_group_fops_open(struct inode *inode, struct file *filep) · 82 unmodified lines | |||
| 1535 | if (!group) | 1371 | if (!group) |
| 1536 | return -ENODEV; | 1372 | return -ENODEV; |
| 1537 | 1373 | ||
| 1538 | if (group->noiommu && !capable(CAP_SYS_RAWIO)) { | ||
| 1539 | vfio_group_put(group); | ||
| 1540 | return -EPERM; | ||
| 1541 | } | ||
| 1542 | |||
| 1543 | /* Do we need multiple instances of the group open? Seems not. */ | 1374 | /* Do we need multiple instances of the group open? Seems not. */ |
| 1544 | opened = atomic_cmpxchg(&group->opened, 0, 1); | 1375 | opened = atomic_cmpxchg(&group->opened, 0, 1); |
| 1545 | if (opened) { | 1376 | if (opened) { |
| @@ -1702,11 +1533,6 @@ struct vfio_group *vfio_group_get_external_user(struct file *filep) · 156 unmodified lines | |||
| 1702 | if (!atomic_inc_not_zero(&group->container_users)) | 1533 | if (!atomic_inc_not_zero(&group->container_users)) |
| 1703 | return ERR_PTR(-EINVAL); | 1534 | return ERR_PTR(-EINVAL); |
| 1704 | 1535 | ||
| 1705 | if (group->noiommu) { | ||
| 1706 | atomic_dec(&group->container_users); | ||
| 1707 | return ERR_PTR(-EPERM); | ||
| 1708 | } | ||
| 1709 | |||
| 1710 | if (!group->container->iommu_driver || | 1536 | if (!group->container->iommu_driver || |
| 1711 | !vfio_group_viable(group)) { | 1537 | !vfio_group_viable(group)) { |
| 1712 | atomic_dec(&group->container_users); | 1538 | atomic_dec(&group->container_users); |
| @@ -819,7 +819,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) · 818 unmodified lines | |||
| 819 | BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); | 819 | BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); |
| 820 | if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || | 820 | if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || |
| 821 | (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || | 821 | (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || |
| 822 | (a.log_guest_addr & (sizeof(u64) - 1))) { | 822 | (a.log_guest_addr & (VRING_USED_ALIGN_SIZE - 1))) { |
| 823 | r = -EINVAL; | 823 | r = -EINVAL; |
| 824 | break; | 824 | break; |
| 825 | } | 825 | } |
| @@ -1369,7 +1369,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq, · 543 unmodified lines | |||
| 1369 | /* Grab the next descriptor number they're advertising, and increment | 1369 | /* Grab the next descriptor number they're advertising, and increment |
| 1370 | * the index we've seen. */ | 1370 | * the index we've seen. */ |
| 1371 | if (unlikely(__get_user(ring_head, | 1371 | if (unlikely(__get_user(ring_head, |
| 1372 | &vq->avail->ring[last_avail_idx % vq->num]))) { | 1372 | &vq->avail->ring[last_avail_idx & (vq->num - 1)]))) { |
| 1373 | vq_err(vq, "Failed to read head: idx %d address %p\n", | 1373 | vq_err(vq, "Failed to read head: idx %d address %p\n", |
| 1374 | last_avail_idx, | 1374 | last_avail_idx, |
| 1375 | &vq->avail->ring[last_avail_idx % vq->num]); | 1375 | &vq->avail->ring[last_avail_idx % vq->num]); |
| @@ -1489,7 +1489,7 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq, · 113 unmodified lines | |||
| 1489 | u16 old, new; | 1489 | u16 old, new; |
| 1490 | int start; | 1490 | int start; |
| 1491 | 1491 | ||
| 1492 | start = vq->last_used_idx % vq->num; | 1492 | start = vq->last_used_idx & (vq->num - 1); |
| 1493 | used = vq->used->ring + start; | 1493 | used = vq->used->ring + start; |
| 1494 | if (count == 1) { | 1494 | if (count == 1) { |
| 1495 | if (__put_user(heads[0].id, &used->id)) { | 1495 | if (__put_user(heads[0].id, &used->id)) { |
| @@ -1531,7 +1531,7 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads, · 35 unmodified lines | |||
| 1531 | { | 1531 | { |
| 1532 | int start, n, r; | 1532 | int start, n, r; |
| 1533 | 1533 | ||
| 1534 | start = vq->last_used_idx % vq->num; | 1534 | start = vq->last_used_idx & (vq->num - 1); |
| 1535 | n = vq->num - start; | 1535 | n = vq->num - start; |
| 1536 | if (n < count) { | 1536 | if (n < count) { |
| 1537 | r = __vhost_add_used_n(vq, heads, n); | 1537 | r = __vhost_add_used_n(vq, heads, n); |
| @@ -479,7 +479,10 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s) · 478 unmodified lines | |||
| 479 | port = FSL_DIU_PORT_DLVDS; | 479 | port = FSL_DIU_PORT_DLVDS; |
| 480 | } | 480 | } |
| 481 | 481 | ||
| 482 | return diu_ops.valid_monitor_port(port); | 482 | if (diu_ops.valid_monitor_port) |
| 483 | port = diu_ops.valid_monitor_port(port); | ||
| 484 | |||
| 485 | return port; | ||
| 483 | } | 486 | } |
| 484 | 487 | ||
| 485 | /* | 488 | /* |
| @@ -1915,6 +1918,14 @@ static int __init fsl_diu_init(void) · 1429 unmodified lines | |||
| 1915 | #else | 1918 | #else |
| 1916 | monitor_port = fsl_diu_name_to_port(monitor_string); | 1919 | monitor_port = fsl_diu_name_to_port(monitor_string); |
| 1917 | #endif | 1920 | #endif |
| 1921 | |||
| 1922 | /* | ||
| 1923 | * Must to verify set_pixel_clock. If not implement on platform, | ||
| 1924 | * then that means that there is no platform support for the DIU. | ||
| 1925 | */ | ||
| 1926 | if (!diu_ops.set_pixel_clock) | ||
| 1927 | return -ENODEV; | ||
| 1928 | |||
| 1918 | pr_info("Freescale Display Interface Unit (DIU) framebuffer driver\n"); | 1929 | pr_info("Freescale Display Interface Unit (DIU) framebuffer driver\n"); |
| 1919 | 1930 | ||
| 1920 | #ifdef CONFIG_NOT_COHERENT_CACHE | 1931 | #ifdef CONFIG_NOT_COHERENT_CACHE |
| @@ -275,6 +275,12 @@ const struct omap_video_timings omap_dss_pal_timings = { · 274 unmodified lines | |||
| 275 | .vbp = 41, | 275 | .vbp = 41, |
| 276 | 276 | ||
| 277 | .interlace = true, | 277 | .interlace = true, |
| 278 | |||
| 279 | .hsync_level = OMAPDSS_SIG_ACTIVE_LOW, | ||
| 280 | .vsync_level = OMAPDSS_SIG_ACTIVE_LOW, | ||
| 281 | .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE, | ||
| 282 | .de_level = OMAPDSS_SIG_ACTIVE_HIGH, | ||
| 283 | .sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE, | ||
| 278 | }; | 284 | }; |
| 279 | EXPORT_SYMBOL(omap_dss_pal_timings); | 285 | EXPORT_SYMBOL(omap_dss_pal_timings); |
| 280 | 286 | ||
| @@ -290,6 +296,12 @@ const struct omap_video_timings omap_dss_ntsc_timings = { · 9 unmodified lines | |||
| 290 | .vbp = 31, | 296 | .vbp = 31, |
| 291 | 297 | ||
| 292 | .interlace = true, | 298 | .interlace = true, |
| 299 | |||
| 300 | .hsync_level = OMAPDSS_SIG_ACTIVE_LOW, | ||
| 301 | .vsync_level = OMAPDSS_SIG_ACTIVE_LOW, | ||
| 302 | .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE, | ||
| 303 | .de_level = OMAPDSS_SIG_ACTIVE_HIGH, | ||
| 304 | .sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE, | ||
| 293 | }; | 305 | }; |
| 294 | EXPORT_SYMBOL(omap_dss_ntsc_timings); | 306 | EXPORT_SYMBOL(omap_dss_ntsc_timings); |
| 295 | 307 | ||
| @@ -412,6 +412,7 @@ static int virtio_init(void) · 411 unmodified lines | |||
| 412 | static void __exit virtio_exit(void) | 412 | static void __exit virtio_exit(void) |
| 413 | { | 413 | { |
| 414 | bus_unregister(&virtio_bus); | 414 | bus_unregister(&virtio_bus); |
| 415 | ida_destroy(&virtio_index_ida); | ||
| 415 | } | 416 | } |
| 416 | core_initcall(virtio_init); | 417 | core_initcall(virtio_init); |
| 417 | module_exit(virtio_exit); | 418 | module_exit(virtio_exit); |
| @@ -80,6 +80,12 @@ struct vring_virtqueue { · 79 unmodified lines | |||
| 80 | /* Last used index we've seen. */ | 80 | /* Last used index we've seen. */ |
| 81 | u16 last_used_idx; | 81 | u16 last_used_idx; |
| 82 | 82 | ||
| 83 | /* Last written value to avail->flags */ | ||
| 84 | u16 avail_flags_shadow; | ||
| 85 | |||
| 86 | /* Last written value to avail->idx in guest byte order */ | ||
| 87 | u16 avail_idx_shadow; | ||
| 88 | |||
| 83 | /* How to notify other side. FIXME: commonalize hcalls! */ | 89 | /* How to notify other side. FIXME: commonalize hcalls! */ |
| 84 | bool (*notify)(struct virtqueue *vq); | 90 | bool (*notify)(struct virtqueue *vq); |
| 85 | 91 | ||
| @@ -109,7 +115,7 @@ static struct vring_desc *alloc_indirect(struct virtqueue *_vq, · 23 unmodified lines | |||
| 109 | * otherwise virt_to_phys will give us bogus addresses in the | 115 | * otherwise virt_to_phys will give us bogus addresses in the |
| 110 | * virtqueue. | 116 | * virtqueue. |
| 111 | */ | 117 | */ |
| 112 | gfp &= ~(__GFP_HIGHMEM | __GFP_HIGH); | 118 | gfp &= ~__GFP_HIGHMEM; |
| 113 | 119 | ||
| 114 | desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp); | 120 | desc = kmalloc(total_sg * sizeof(struct vring_desc), gfp); |
| 115 | if (!desc) | 121 | if (!desc) |
| @@ -235,13 +241,14 @@ static inline int virtqueue_add(struct virtqueue *_vq, · 119 unmodified lines | |||
| 235 | 241 | ||
| 236 | /* Put entry in available array (but don't update avail->idx until they | 242 | /* Put entry in available array (but don't update avail->idx until they |
| 237 | * do sync). */ | 243 | * do sync). */ |
| 238 | avail = virtio16_to_cpu(_vq->vdev, vq->vring.avail->idx) & (vq->vring.num - 1); | 244 | avail = vq->avail_idx_shadow & (vq->vring.num - 1); |
| 239 | vq->vring.avail->ring[avail] = cpu_to_virtio16(_vq->vdev, head); | 245 | vq->vring.avail->ring[avail] = cpu_to_virtio16(_vq->vdev, head); |
| 240 | 246 | ||
| 241 | /* Descriptors and available array need to be set before we expose the | 247 | /* Descriptors and available array need to be set before we expose the |
| 242 | * new available array entries. */ | 248 | * new available array entries. */ |
| 243 | virtio_wmb(vq->weak_barriers); | 249 | virtio_wmb(vq->weak_barriers); |
| 244 | vq->vring.avail->idx = cpu_to_virtio16(_vq->vdev, virtio16_to_cpu(_vq->vdev, vq->vring.avail->idx) + 1); | 250 | vq->avail_idx_shadow++; |
| 251 | vq->vring.avail->idx = cpu_to_virtio16(_vq->vdev, vq->avail_idx_shadow); | ||
| 245 | vq->num_added++; | 252 | vq->num_added++; |
| 246 | 253 | ||
| 247 | pr_debug("Added buffer head %i to %p\n", head, vq); | 254 | pr_debug("Added buffer head %i to %p\n", head, vq); |
| @@ -354,8 +361,8 @@ bool virtqueue_kick_prepare(struct virtqueue *_vq) · 106 unmodified lines | |||
| 354 | * event. */ | 361 | * event. */ |
| 355 | virtio_mb(vq->weak_barriers); | 362 | virtio_mb(vq->weak_barriers); |
| 356 | 363 | ||
| 357 | old = virtio16_to_cpu(_vq->vdev, vq->vring.avail->idx) - vq->num_added; | 364 | old = vq->avail_idx_shadow - vq->num_added; |
| 358 | new = virtio16_to_cpu(_vq->vdev, vq->vring.avail->idx); | 365 | new = vq->avail_idx_shadow; |
| 359 | vq->num_added = 0; | 366 | vq->num_added = 0; |
| 360 | 367 | ||
| 361 | #ifdef DEBUG | 368 | #ifdef DEBUG |
| @@ -510,7 +517,7 @@ void *virtqueue_get_buf(struct virtqueue *_vq, unsigned int *len) · 148 unmodified lines | |||
| 510 | /* If we expect an interrupt for the next entry, tell host | 517 | /* If we expect an interrupt for the next entry, tell host |
| 511 | * by writing event index and flush out the write before | 518 | * by writing event index and flush out the write before |
| 512 | * the read in the next get_buf call. */ | 519 | * the read in the next get_buf call. */ |
| 513 | if (!(vq->vring.avail->flags & cpu_to_virtio16(_vq->vdev, VRING_AVAIL_F_NO_INTERRUPT))) { | 520 | if (!(vq->avail_flags_shadow & VRING_AVAIL_F_NO_INTERRUPT)) { |
| 514 | vring_used_event(&vq->vring) = cpu_to_virtio16(_vq->vdev, vq->last_used_idx); | 521 | vring_used_event(&vq->vring) = cpu_to_virtio16(_vq->vdev, vq->last_used_idx); |
| 515 | virtio_mb(vq->weak_barriers); | 522 | virtio_mb(vq->weak_barriers); |
| 516 | } | 523 | } |
| @@ -537,7 +544,11 @@ void virtqueue_disable_cb(struct virtqueue *_vq) · 20 unmodified lines | |||
| 537 | { | 544 | { |
| 538 | struct vring_virtqueue *vq = to_vvq(_vq); | 545 | struct vring_virtqueue *vq = to_vvq(_vq); |
| 539 | 546 | ||
| 540 | vq->vring.avail->flags |= cpu_to_virtio16(_vq->vdev, VRING_AVAIL_F_NO_INTERRUPT); | 547 | if (!(vq->avail_flags_shadow & VRING_AVAIL_F_NO_INTERRUPT)) { |
| 548 | vq->avail_flags_shadow |= VRING_AVAIL_F_NO_INTERRUPT; | ||
| 549 | vq->vring.avail->flags = cpu_to_virtio16(_vq->vdev, vq->avail_flags_shadow); | ||
| 550 | } | ||
| 551 | |||
| 541 | } | 552 | } |
| 542 | EXPORT_SYMBOL_GPL(virtqueue_disable_cb); | 553 | EXPORT_SYMBOL_GPL(virtqueue_disable_cb); |
| 543 | 554 | ||
| @@ -565,7 +576,10 @@ unsigned virtqueue_enable_cb_prepare(struct virtqueue *_vq) · 21 unmodified lines | |||
| 565 | /* Depending on the VIRTIO_RING_F_EVENT_IDX feature, we need to | 576 | /* Depending on the VIRTIO_RING_F_EVENT_IDX feature, we need to |
| 566 | * either clear the flags bit or point the event index at the next | 577 | * either clear the flags bit or point the event index at the next |
| 567 | * entry. Always do both to keep code simple. */ | 578 | * entry. Always do both to keep code simple. */ |
| 568 | vq->vring.avail->flags &= cpu_to_virtio16(_vq->vdev, ~VRING_AVAIL_F_NO_INTERRUPT); | 579 | if (vq->avail_flags_shadow & VRING_AVAIL_F_NO_INTERRUPT) { |
| 580 | vq->avail_flags_shadow &= ~VRING_AVAIL_F_NO_INTERRUPT; | ||
| 581 | vq->vring.avail->flags = cpu_to_virtio16(_vq->vdev, vq->avail_flags_shadow); | ||
| 582 | } | ||
| 569 | vring_used_event(&vq->vring) = cpu_to_virtio16(_vq->vdev, last_used_idx = vq->last_used_idx); | 583 | vring_used_event(&vq->vring) = cpu_to_virtio16(_vq->vdev, last_used_idx = vq->last_used_idx); |
| 570 | END_USE(vq); | 584 | END_USE(vq); |
| 571 | return last_used_idx; | 585 | return last_used_idx; |
| @@ -633,9 +647,12 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *_vq) · 61 unmodified lines | |||
| 633 | /* Depending on the VIRTIO_RING_F_USED_EVENT_IDX feature, we need to | 647 | /* Depending on the VIRTIO_RING_F_USED_EVENT_IDX feature, we need to |
| 634 | * either clear the flags bit or point the event index at the next | 648 | * either clear the flags bit or point the event index at the next |
| 635 | * entry. Always do both to keep code simple. */ | 649 | * entry. Always do both to keep code simple. */ |
| 636 | vq->vring.avail->flags &= cpu_to_virtio16(_vq->vdev, ~VRING_AVAIL_F_NO_INTERRUPT); | 650 | if (vq->avail_flags_shadow & VRING_AVAIL_F_NO_INTERRUPT) { |
| 651 | vq->avail_flags_shadow &= ~VRING_AVAIL_F_NO_INTERRUPT; | ||
| 652 | vq->vring.avail->flags = cpu_to_virtio16(_vq->vdev, vq->avail_flags_shadow); | ||
| 653 | } | ||
| 637 | /* TODO: tune this threshold */ | 654 | /* TODO: tune this threshold */ |
| 638 | bufs = (u16)(virtio16_to_cpu(_vq->vdev, vq->vring.avail->idx) - vq->last_used_idx) * 3 / 4; | 655 | bufs = (u16)(vq->avail_idx_shadow - vq->last_used_idx) * 3 / 4; |
| 639 | vring_used_event(&vq->vring) = cpu_to_virtio16(_vq->vdev, vq->last_used_idx + bufs); | 656 | vring_used_event(&vq->vring) = cpu_to_virtio16(_vq->vdev, vq->last_used_idx + bufs); |
| 640 | virtio_mb(vq->weak_barriers); | 657 | virtio_mb(vq->weak_barriers); |
| 641 | if (unlikely((u16)(virtio16_to_cpu(_vq->vdev, vq->vring.used->idx) - vq->last_used_idx) > bufs)) { | 658 | if (unlikely((u16)(virtio16_to_cpu(_vq->vdev, vq->vring.used->idx) - vq->last_used_idx) > bufs)) { |
| @@ -670,7 +687,8 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq) · 28 unmodified lines | |||
| 670 | /* detach_buf clears data, so grab it now. */ | 687 | /* detach_buf clears data, so grab it now. */ |
| 671 | buf = vq->data[i]; | 688 | buf = vq->data[i]; |
| 672 | detach_buf(vq, i); | 689 | detach_buf(vq, i); |
| 673 | vq->vring.avail->idx = cpu_to_virtio16(_vq->vdev, virtio16_to_cpu(_vq->vdev, vq->vring.avail->idx) - 1); | 690 | vq->avail_idx_shadow--; |
| 691 | vq->vring.avail->idx = cpu_to_virtio16(_vq->vdev, vq->avail_idx_shadow); | ||
| 674 | END_USE(vq); | 692 | END_USE(vq); |
| 675 | return buf; | 693 | return buf; |
| 676 | } | 694 | } |
| @@ -735,6 +753,8 @@ struct virtqueue *vring_new_virtqueue(unsigned int index, · 58 unmodified lines | |||
| 735 | vq->weak_barriers = weak_barriers; | 753 | vq->weak_barriers = weak_barriers; |
| 736 | vq->broken = false; | 754 | vq->broken = false; |
| 737 | vq->last_used_idx = 0; | 755 | vq->last_used_idx = 0; |
| 756 | vq->avail_flags_shadow = 0; | ||
| 757 | vq->avail_idx_shadow = 0; | ||
| 738 | vq->num_added = 0; | 758 | vq->num_added = 0; |
| 739 | list_add_tail(&vq->vq.list, &vdev->vqs); | 759 | list_add_tail(&vq->vq.list, &vdev->vqs); |
| 740 | #ifdef DEBUG | 760 | #ifdef DEBUG |
| @@ -746,8 +766,10 @@ struct virtqueue *vring_new_virtqueue(unsigned int index, · 5 unmodified lines | |||
| 746 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); | 766 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); |
| 747 | 767 | ||
| 748 | /* No callback? Tell other side not to bother us. */ | 768 | /* No callback? Tell other side not to bother us. */ |
| 749 | if (!callback) | 769 | if (!callback) { |
| 750 | vq->vring.avail->flags |= cpu_to_virtio16(vdev, VRING_AVAIL_F_NO_INTERRUPT); | 770 | vq->avail_flags_shadow |= VRING_AVAIL_F_NO_INTERRUPT; |
| 771 | vq->vring.avail->flags = cpu_to_virtio16(vdev, vq->avail_flags_shadow); | ||
| 772 | } | ||
| 751 | 773 | ||
| 752 | /* Put everything in free lists. */ | 774 | /* Put everything in free lists. */ |
| 753 | vq->free_head = 0; | 775 | vq->free_head = 0; |
| @@ -281,7 +281,8 @@ static void handle_irq_for_port(unsigned port) · 280 unmodified lines | |||
| 281 | 281 | ||
| 282 | static void consume_one_event(unsigned cpu, | 282 | static void consume_one_event(unsigned cpu, |
| 283 | struct evtchn_fifo_control_block *control_block, | 283 | struct evtchn_fifo_control_block *control_block, |
| 284 | unsigned priority, unsigned long *ready) | 284 | unsigned priority, unsigned long *ready, |
| 285 | bool drop) | ||
| 285 | { | 286 | { |
| 286 | struct evtchn_fifo_queue *q = &per_cpu(cpu_queue, cpu); | 287 | struct evtchn_fifo_queue *q = &per_cpu(cpu_queue, cpu); |
| 287 | uint32_t head; | 288 | uint32_t head; |
| @@ -313,13 +314,17 @@ static void consume_one_event(unsigned cpu, · 25 unmodified lines | |||
| 313 | if (head == 0) | 314 | if (head == 0) |
| 314 | clear_bit(priority, ready); | 315 | clear_bit(priority, ready); |
| 315 | 316 | ||
| 316 | if (evtchn_fifo_is_pending(port) && !evtchn_fifo_is_masked(port)) | 317 | if (evtchn_fifo_is_pending(port) && !evtchn_fifo_is_masked(port)) { |
| 317 | handle_irq_for_port(port); | 318 | if (unlikely(drop)) |
| 319 | pr_warn("Dropping pending event for port %u\n", port); | ||
| 320 | else | ||
| 321 | handle_irq_for_port(port); | ||
| 322 | } | ||
| 318 | 323 | ||
| 319 | q->head[priority] = head; | 324 | q->head[priority] = head; |
| 320 | } | 325 | } |
| 321 | 326 | ||
| 322 | static void evtchn_fifo_handle_events(unsigned cpu) | 327 | static void __evtchn_fifo_handle_events(unsigned cpu, bool drop) |
| 323 | { | 328 | { |
| 324 | struct evtchn_fifo_control_block *control_block; | 329 | struct evtchn_fifo_control_block *control_block; |
| 325 | unsigned long ready; | 330 | unsigned long ready; |
| @@ -331,11 +336,16 @@ static void evtchn_fifo_handle_events(unsigned cpu) · 5 unmodified lines | |||
| 331 | 336 | ||
| 332 | while (ready) { | 337 | while (ready) { |
| 333 | q = find_first_bit(&ready, EVTCHN_FIFO_MAX_QUEUES); | 338 | q = find_first_bit(&ready, EVTCHN_FIFO_MAX_QUEUES); |
| 334 | consume_one_event(cpu, control_block, q, &ready); | 339 | consume_one_event(cpu, control_block, q, &ready, drop); |
| 335 | ready |= xchg(&control_block->ready, 0); | 340 | ready |= xchg(&control_block->ready, 0); |
| 336 | } | 341 | } |
| 337 | } | 342 | } |
| 338 | 343 | ||
| 344 | static void evtchn_fifo_handle_events(unsigned cpu) | ||
| 345 | { | ||
| 346 | __evtchn_fifo_handle_events(cpu, false); | ||
| 347 | } | ||
| 348 | |||
| 339 | static void evtchn_fifo_resume(void) | 349 | static void evtchn_fifo_resume(void) |
| 340 | { | 350 | { |
| 341 | unsigned cpu; | 351 | unsigned cpu; |
| @@ -420,6 +430,9 @@ static int evtchn_fifo_cpu_notification(struct notifier_block *self, · 78 unmodified lines | |||
| 420 | if (!per_cpu(cpu_control_block, cpu)) | 430 | if (!per_cpu(cpu_control_block, cpu)) |
| 421 | ret = evtchn_fifo_alloc_control_block(cpu); | 431 | ret = evtchn_fifo_alloc_control_block(cpu); |
| 422 | break; | 432 | break; |
| 433 | case CPU_DEAD: | ||
| 434 | __evtchn_fifo_handle_events(cpu, true); | ||
| 435 | break; | ||
| 423 | default: | 436 | default: |
| 424 | break; | 437 | break; |
| 425 | } | 438 | } |
| @@ -37,6 +37,7 @@ struct xen_pcibk_device { · 36 unmodified lines | |||
| 37 | struct xen_pci_sharedinfo *sh_info; | 37 | struct xen_pci_sharedinfo *sh_info; |
| 38 | unsigned long flags; | 38 | unsigned long flags; |
| 39 | struct work_struct op_work; | 39 | struct work_struct op_work; |
| 40 | struct xen_pci_op op; | ||
| 40 | }; | 41 | }; |
| 41 | 42 | ||
| 42 | struct xen_pcibk_dev_data { | 43 | struct xen_pcibk_dev_data { |
| @@ -70,6 +70,13 @@ static void xen_pcibk_control_isr(struct pci_dev *dev, int reset) · 69 unmodified lines | |||
| 70 | enable ? "enable" : "disable"); | 70 | enable ? "enable" : "disable"); |
| 71 | 71 | ||
| 72 | if (enable) { | 72 | if (enable) { |
| 73 | /* | ||
| 74 | * The MSI or MSI-X should not have an IRQ handler. Otherwise | ||
| 75 | * if the guest terminates we BUG_ON in free_msi_irqs. | ||
| 76 | */ | ||
| 77 | if (dev->msi_enabled || dev->msix_enabled) | ||
| 78 | goto out; | ||
| 79 | |||
| 73 | rc = request_irq(dev_data->irq, | 80 | rc = request_irq(dev_data->irq, |
| 74 | xen_pcibk_guest_interrupt, IRQF_SHARED, | 81 | xen_pcibk_guest_interrupt, IRQF_SHARED, |
| 75 | dev_data->irq_name, dev); | 82 | dev_data->irq_name, dev); |
| @@ -144,7 +151,12 @@ int xen_pcibk_enable_msi(struct xen_pcibk_device *pdev, · 68 unmodified lines | |||
| 144 | if (unlikely(verbose_request)) | 151 | if (unlikely(verbose_request)) |
| 145 | printk(KERN_DEBUG DRV_NAME ": %s: enable MSI\n", pci_name(dev)); | 152 | printk(KERN_DEBUG DRV_NAME ": %s: enable MSI\n", pci_name(dev)); |
| 146 | 153 | ||
| 147 | status = pci_enable_msi(dev); | 154 | if (dev->msi_enabled) |
| 155 | status = -EALREADY; | ||
| 156 | else if (dev->msix_enabled) | ||
| 157 | status = -ENXIO; | ||
| 158 | else | ||
| 159 | status = pci_enable_msi(dev); | ||
| 148 | 160 | ||
| 149 | if (status) { | 161 | if (status) { |
| 150 | pr_warn_ratelimited("%s: error enabling MSI for guest %u: err %d\n", | 162 | pr_warn_ratelimited("%s: error enabling MSI for guest %u: err %d\n", |
| @@ -173,20 +185,23 @@ static · 22 unmodified lines | |||
| 173 | int xen_pcibk_disable_msi(struct xen_pcibk_device *pdev, | 185 | int xen_pcibk_disable_msi(struct xen_pcibk_device *pdev, |
| 174 | struct pci_dev *dev, struct xen_pci_op *op) | 186 | struct pci_dev *dev, struct xen_pci_op *op) |
| 175 | { | 187 | { |
| 176 | struct xen_pcibk_dev_data *dev_data; | ||
| 177 | |||
| 178 | if (unlikely(verbose_request)) | 188 | if (unlikely(verbose_request)) |
| 179 | printk(KERN_DEBUG DRV_NAME ": %s: disable MSI\n", | 189 | printk(KERN_DEBUG DRV_NAME ": %s: disable MSI\n", |
| 180 | pci_name(dev)); | 190 | pci_name(dev)); |
| 181 | pci_disable_msi(dev); | ||
| 182 | 191 | ||
| 192 | if (dev->msi_enabled) { | ||
| 193 | struct xen_pcibk_dev_data *dev_data; | ||
| 194 | |||
| 195 | pci_disable_msi(dev); | ||
| 196 | |||
| 197 | dev_data = pci_get_drvdata(dev); | ||
| 198 | if (dev_data) | ||
| 199 | dev_data->ack_intr = 1; | ||
| 200 | } | ||
| 183 | op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0; | 201 | op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0; |
| 184 | if (unlikely(verbose_request)) | 202 | if (unlikely(verbose_request)) |
| 185 | printk(KERN_DEBUG DRV_NAME ": %s: MSI: %d\n", pci_name(dev), | 203 | printk(KERN_DEBUG DRV_NAME ": %s: MSI: %d\n", pci_name(dev), |
| 186 | op->value); | 204 | op->value); |
| 187 | dev_data = pci_get_drvdata(dev); | ||
| 188 | if (dev_data) | ||
| 189 | dev_data->ack_intr = 1; | ||
| 190 | return 0; | 205 | return 0; |
| 191 | } | 206 | } |
| 192 | 207 | ||
| @@ -197,13 +212,26 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev, · 4 unmodified lines | |||
| 197 | struct xen_pcibk_dev_data *dev_data; | 212 | struct xen_pcibk_dev_data *dev_data; |
| 198 | int i, result; | 213 | int i, result; |
| 199 | struct msix_entry *entries; | 214 | struct msix_entry *entries; |
| 215 | u16 cmd; | ||
| 200 | 216 | ||
| 201 | if (unlikely(verbose_request)) | 217 | if (unlikely(verbose_request)) |
| 202 | printk(KERN_DEBUG DRV_NAME ": %s: enable MSI-X\n", | 218 | printk(KERN_DEBUG DRV_NAME ": %s: enable MSI-X\n", |
| 203 | pci_name(dev)); | 219 | pci_name(dev)); |
| 220 | |||
| 204 | if (op->value > SH_INFO_MAX_VEC) | 221 | if (op->value > SH_INFO_MAX_VEC) |
| 205 | return -EINVAL; | 222 | return -EINVAL; |
| 206 | 223 | ||
| 224 | if (dev->msix_enabled) | ||
| 225 | return -EALREADY; | ||
| 226 | |||
| 227 | /* | ||
| 228 | * PCI_COMMAND_MEMORY must be enabled, otherwise we may not be able | ||
| 229 | * to access the BARs where the MSI-X entries reside. | ||
| 230 | */ | ||
| 231 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
| 232 | if (dev->msi_enabled || !(cmd & PCI_COMMAND_MEMORY)) | ||
| 233 | return -ENXIO; | ||
| 234 | |||
| 207 | entries = kmalloc(op->value * sizeof(*entries), GFP_KERNEL); | 235 | entries = kmalloc(op->value * sizeof(*entries), GFP_KERNEL); |
| 208 | if (entries == NULL) | 236 | if (entries == NULL) |
| 209 | return -ENOMEM; | 237 | return -ENOMEM; |
| @@ -245,23 +273,27 @@ static · 35 unmodified lines | |||
| 245 | int xen_pcibk_disable_msix(struct xen_pcibk_device *pdev, | 273 | int xen_pcibk_disable_msix(struct xen_pcibk_device *pdev, |
| 246 | struct pci_dev *dev, struct xen_pci_op *op) | 274 | struct pci_dev *dev, struct xen_pci_op *op) |
| 247 | { | 275 | { |
| 248 | struct xen_pcibk_dev_data *dev_data; | ||
| 249 | if (unlikely(verbose_request)) | 276 | if (unlikely(verbose_request)) |
| 250 | printk(KERN_DEBUG DRV_NAME ": %s: disable MSI-X\n", | 277 | printk(KERN_DEBUG DRV_NAME ": %s: disable MSI-X\n", |
| 251 | pci_name(dev)); | 278 | pci_name(dev)); |
| 252 | pci_disable_msix(dev); | ||
| 253 | 279 | ||
| 280 | if (dev->msix_enabled) { | ||
| 281 | struct xen_pcibk_dev_data *dev_data; | ||
| 282 | |||
| 283 | pci_disable_msix(dev); | ||
| 284 | |||
| 285 | dev_data = pci_get_drvdata(dev); | ||
| 286 | if (dev_data) | ||
| 287 | dev_data->ack_intr = 1; | ||
| 288 | } | ||
| 254 | /* | 289 | /* |
| 255 | * SR-IOV devices (which don't have any legacy IRQ) have | 290 | * SR-IOV devices (which don't have any legacy IRQ) have |
| 256 | * an undefined IRQ value of zero. | 291 | * an undefined IRQ value of zero. |
| 257 | */ | 292 | */ |
| 258 | op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0; | 293 | op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0; |
| 259 | if (unlikely(verbose_request)) | 294 | if (unlikely(verbose_request)) |
| 260 | printk(KERN_DEBUG DRV_NAME ": %s: MSI-X: %d\n", pci_name(dev), | 295 | printk(KERN_DEBUG DRV_NAME ": %s: MSI-X: %d\n", |
| 261 | op->value); | 296 | pci_name(dev), op->value); |
| 262 | dev_data = pci_get_drvdata(dev); | ||
| 263 | if (dev_data) | ||
| 264 | dev_data->ack_intr = 1; | ||
| 265 | return 0; | 297 | return 0; |
| 266 | } | 298 | } |
| 267 | #endif | 299 | #endif |
| @@ -298,9 +330,11 @@ void xen_pcibk_do_op(struct work_struct *data) · 30 unmodified lines | |||
| 298 | container_of(data, struct xen_pcibk_device, op_work); | 330 | container_of(data, struct xen_pcibk_device, op_work); |
| 299 | struct pci_dev *dev; | 331 | struct pci_dev *dev; |
| 300 | struct xen_pcibk_dev_data *dev_data = NULL; | 332 | struct xen_pcibk_dev_data *dev_data = NULL; |
| 301 | struct xen_pci_op *op = &pdev->sh_info->op; | 333 | struct xen_pci_op *op = &pdev->op; |
| 302 | int test_intx = 0; | 334 | int test_intx = 0; |
| 303 | 335 | ||
| 336 | *op = pdev->sh_info->op; | ||
| 337 | barrier(); | ||
| 304 | dev = xen_pcibk_get_pci_dev(pdev, op->domain, op->bus, op->devfn); | 338 | dev = xen_pcibk_get_pci_dev(pdev, op->domain, op->bus, op->devfn); |
| 305 | 339 | ||
| 306 | if (dev == NULL) | 340 | if (dev == NULL) |
| @@ -342,6 +376,17 @@ void xen_pcibk_do_op(struct work_struct *data) · 35 unmodified lines | |||
| 342 | if ((dev_data->enable_intx != test_intx)) | 376 | if ((dev_data->enable_intx != test_intx)) |
| 343 | xen_pcibk_control_isr(dev, 0 /* no reset */); | 377 | xen_pcibk_control_isr(dev, 0 /* no reset */); |
| 344 | } | 378 | } |
| 379 | pdev->sh_info->op.err = op->err; | ||
| 380 | pdev->sh_info->op.value = op->value; | ||
| 381 | #ifdef CONFIG_PCI_MSI | ||
| 382 | if (op->cmd == XEN_PCI_OP_enable_msix && op->err == 0) { | ||
| 383 | unsigned int i; | ||
| 384 | |||
| 385 | for (i = 0; i < op->value; i++) | ||
| 386 | pdev->sh_info->op.msix_entries[i].vector = | ||
| 387 | op->msix_entries[i].vector; | ||
| 388 | } | ||
| 389 | #endif | ||
| 345 | /* Tell the driver domain that we're done. */ | 390 | /* Tell the driver domain that we're done. */ |
| 346 | wmb(); | 391 | wmb(); |
| 347 | clear_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags); | 392 | clear_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags); |
| @@ -44,7 +44,6 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev) · 43 unmodified lines | |||
| 44 | dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev); | 44 | dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev); |
| 45 | 45 | ||
| 46 | pdev->xdev = xdev; | 46 | pdev->xdev = xdev; |
| 47 | dev_set_drvdata(&xdev->dev, pdev); | ||
| 48 | 47 | ||
| 49 | mutex_init(&pdev->dev_lock); | 48 | mutex_init(&pdev->dev_lock); |
| 50 | 49 | ||
| @@ -58,6 +57,9 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev) · 7 unmodified lines | |||
| 58 | kfree(pdev); | 57 | kfree(pdev); |
| 59 | pdev = NULL; | 58 | pdev = NULL; |
| 60 | } | 59 | } |
| 60 | |||
| 61 | dev_set_drvdata(&xdev->dev, pdev); | ||
| 62 | |||
| 61 | out: | 63 | out: |
| 62 | return pdev; | 64 | return pdev; |
| 63 | } | 65 | } |
| @@ -726,7 +726,7 @@ static int scsiback_do_cmd_fn(struct vscsibk_info *info) · 725 unmodified lines | |||
| 726 | if (!pending_req) | 726 | if (!pending_req) |
| 727 | return 1; | 727 | return 1; |
| 728 | 728 | ||
| 729 | ring_req = *RING_GET_REQUEST(ring, rc); | 729 | RING_COPY_REQUEST(ring, rc, &ring_req); |
| 730 | ring->req_cons = ++rc; | 730 | ring->req_cons = ++rc; |
| 731 | 731 | ||
| 732 | err = prepare_pending_reqs(info, &ring_req, pending_req); | 732 | err = prepare_pending_reqs(info, &ring_req, pending_req); |
| @@ -451,9 +451,9 @@ void v9fs_evict_inode(struct inode *inode) · 450 unmodified lines | |||
| 451 | { | 451 | { |
| 452 | struct v9fs_inode *v9inode = V9FS_I(inode); | 452 | struct v9fs_inode *v9inode = V9FS_I(inode); |
| 453 | 453 | ||
| 454 | truncate_inode_pages_final(inode->i_mapping); | 454 | truncate_inode_pages_final(&inode->i_data); |
| 455 | clear_inode(inode); | 455 | clear_inode(inode); |
| 456 | filemap_fdatawrite(inode->i_mapping); | 456 | filemap_fdatawrite(&inode->i_data); |
| 457 | 457 | ||
| 458 | v9fs_cache_inode_put_cookie(inode); | 458 | v9fs_cache_inode_put_cookie(inode); |
| 459 | /* clunk the fid stashed in writeback_fid */ | 459 | /* clunk the fid stashed in writeback_fid */ |
| @@ -1523,11 +1523,14 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part) · 1522 unmodified lines | |||
| 1523 | WARN_ON_ONCE(bdev->bd_holders); | 1523 | WARN_ON_ONCE(bdev->bd_holders); |
| 1524 | sync_blockdev(bdev); | 1524 | sync_blockdev(bdev); |
| 1525 | kill_bdev(bdev); | 1525 | kill_bdev(bdev); |
| 1526 | |||
| 1527 | bdev_write_inode(bdev); | ||
| 1526 | /* | 1528 | /* |
| 1527 | * ->release can cause the queue to disappear, so flush all | 1529 | * Detaching bdev inode from its wb in __destroy_inode() |
| 1528 | * dirty data before. | 1530 | * is too late: the queue which embeds its bdi (along with |
| 1531 | * root wb) can be gone as soon as we put_disk() below. | ||
| 1529 | */ | 1532 | */ |
| 1530 | bdev_write_inode(bdev); | 1533 | inode_detach_wb(bdev->bd_inode); |
| 1531 | } | 1534 | } |
| 1532 | if (bdev->bd_contains == bdev) { | 1535 | if (bdev->bd_contains == bdev) { |
| 1533 | if (disk->fops->release) | 1536 | if (disk->fops->release) |
| @@ -10480,11 +10480,15 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) · 10479 unmodified lines | |||
| 10480 | * until transaction commit to do the actual discard. | 10480 | * until transaction commit to do the actual discard. |
| 10481 | */ | 10481 | */ |
| 10482 | if (trimming) { | 10482 | if (trimming) { |
| 10483 | WARN_ON(!list_empty(&block_group->bg_list)); | 10483 | spin_lock(&fs_info->unused_bgs_lock); |
| 10484 | spin_lock(&trans->transaction->deleted_bgs_lock); | 10484 | /* |
| 10485 | * A concurrent scrub might have added us to the list | ||
| 10486 | * fs_info->unused_bgs, so use a list_move operation | ||
| 10487 | * to add the block group to the deleted_bgs list. | ||
| 10488 | */ | ||
| 10485 | list_move(&block_group->bg_list, | 10489 | list_move(&block_group->bg_list, |
| 10486 | &trans->transaction->deleted_bgs); | 10490 | &trans->transaction->deleted_bgs); |
| 10487 | spin_unlock(&trans->transaction->deleted_bgs_lock); | 10491 | spin_unlock(&fs_info->unused_bgs_lock); |
| 10488 | btrfs_get_block_group(block_group); | 10492 | btrfs_get_block_group(block_group); |
| 10489 | } | 10493 | } |
| 10490 | end_trans: | 10494 | end_trans: |
| @@ -1291,7 +1291,8 @@ out: · 1290 unmodified lines | |||
| 1291 | * on error we return an unlocked page and the error value | 1291 | * on error we return an unlocked page and the error value |
| 1292 | * on success we return a locked page and 0 | 1292 | * on success we return a locked page and 0 |
| 1293 | */ | 1293 | */ |
| 1294 | static int prepare_uptodate_page(struct page *page, u64 pos, | 1294 | static int prepare_uptodate_page(struct inode *inode, |
| 1295 | struct page *page, u64 pos, | ||
| 1295 | bool force_uptodate) | 1296 | bool force_uptodate) |
| 1296 | { | 1297 | { |
| 1297 | int ret = 0; | 1298 | int ret = 0; |
| @@ -1306,6 +1307,10 @@ static int prepare_uptodate_page(struct page *page, u64 pos, · 8 unmodified lines | |||
| 1306 | unlock_page(page); | 1307 | unlock_page(page); |
| 1307 | return -EIO; | 1308 | return -EIO; |
| 1308 | } | 1309 | } |
| 1310 | if (page->mapping != inode->i_mapping) { | ||
| 1311 | unlock_page(page); | ||
| 1312 | return -EAGAIN; | ||
| 1313 | } | ||
| 1309 | } | 1314 | } |
| 1310 | return 0; | 1315 | return 0; |
| 1311 | } | 1316 | } |
| @@ -1324,6 +1329,7 @@ static noinline int prepare_pages(struct inode *inode, struct page **pages, · 12 unmodified lines | |||
| 1324 | int faili; | 1329 | int faili; |
| 1325 | 1330 | ||
| 1326 | for (i = 0; i < num_pages; i++) { | 1331 | for (i = 0; i < num_pages; i++) { |
| 1332 | again: | ||
| 1327 | pages[i] = find_or_create_page(inode->i_mapping, index + i, | 1333 | pages[i] = find_or_create_page(inode->i_mapping, index + i, |
| 1328 | mask | __GFP_WRITE); | 1334 | mask | __GFP_WRITE); |
| 1329 | if (!pages[i]) { | 1335 | if (!pages[i]) { |
| @@ -1333,13 +1339,17 @@ static noinline int prepare_pages(struct inode *inode, struct page **pages, · 3 unmodified lines | |||
| 1333 | } | 1339 | } |
| 1334 | 1340 | ||
| 1335 | if (i == 0) | 1341 | if (i == 0) |
| 1336 | err = prepare_uptodate_page(pages[i], pos, | 1342 | err = prepare_uptodate_page(inode, pages[i], pos, |
| 1337 | force_uptodate); | 1343 | force_uptodate); |
| 1338 | if (i == num_pages - 1) | 1344 | if (!err && i == num_pages - 1) |
| 1339 | err = prepare_uptodate_page(pages[i], | 1345 | err = prepare_uptodate_page(inode, pages[i], |
| 1340 | pos + write_bytes, false); | 1346 | pos + write_bytes, false); |
| 1341 | if (err) { | 1347 | if (err) { |
| 1342 | page_cache_release(pages[i]); | 1348 | page_cache_release(pages[i]); |
| 1349 | if (err == -EAGAIN) { | ||
| 1350 | err = 0; | ||
| 1351 | goto again; | ||
| 1352 | } | ||
| 1343 | faili = i - 1; | 1353 | faili = i - 1; |
| 1344 | goto fail; | 1354 | goto fail; |
| 1345 | } | 1355 | } |
| @@ -891,7 +891,7 @@ out: · 890 unmodified lines | |||
| 891 | spin_unlock(&block_group->lock); | 891 | spin_unlock(&block_group->lock); |
| 892 | ret = 0; | 892 | ret = 0; |
| 893 | 893 | ||
| 894 | btrfs_warn(fs_info, "failed to load free space cache for block group %llu, rebuild it now", | 894 | btrfs_warn(fs_info, "failed to load free space cache for block group %llu, rebuilding it now", |
| 895 | block_group->key.objectid); | 895 | block_group->key.objectid); |
| 896 | } | 896 | } |
| 897 | 897 | ||
| @@ -2972,7 +2972,7 @@ setup_cluster_bitmap(struct btrfs_block_group_cache *block_group, · 2074 unmodified lines | |||
| 2972 | u64 cont1_bytes, u64 min_bytes) | 2972 | u64 cont1_bytes, u64 min_bytes) |
| 2973 | { | 2973 | { |
| 2974 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; | 2974 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; |
| 2975 | struct btrfs_free_space *entry; | 2975 | struct btrfs_free_space *entry = NULL; |
| 2976 | int ret = -ENOSPC; | 2976 | int ret = -ENOSPC; |
| 2977 | u64 bitmap_offset = offset_to_bitmap(ctl, offset); | 2977 | u64 bitmap_offset = offset_to_bitmap(ctl, offset); |
| 2978 | 2978 | ||
| @@ -2983,8 +2983,10 @@ setup_cluster_bitmap(struct btrfs_block_group_cache *block_group, · 4 unmodified lines | |||
| 2983 | * The bitmap that covers offset won't be in the list unless offset | 2983 | * The bitmap that covers offset won't be in the list unless offset |
| 2984 | * is just its start offset. | 2984 | * is just its start offset. |
| 2985 | */ | 2985 | */ |
| 2986 | entry = list_first_entry(bitmaps, struct btrfs_free_space, list); | 2986 | if (!list_empty(bitmaps)) |
| 2987 | if (entry->offset != bitmap_offset) { | 2987 | entry = list_first_entry(bitmaps, struct btrfs_free_space, list); |
| 2988 | |||
| 2989 | if (!entry || entry->offset != bitmap_offset) { | ||
| 2988 | entry = tree_search_offset(ctl, bitmap_offset, 1, 0); | 2990 | entry = tree_search_offset(ctl, bitmap_offset, 1, 0); |
| 2989 | if (entry && list_empty(&entry->list)) | 2991 | if (entry && list_empty(&entry->list)) |
| 2990 | list_add(&entry->list, bitmaps); | 2992 | list_add(&entry->list, bitmaps); |
| @@ -274,7 +274,6 @@ loop: · 273 unmodified lines | |||
| 274 | cur_trans->num_dirty_bgs = 0; | 274 | cur_trans->num_dirty_bgs = 0; |
| 275 | spin_lock_init(&cur_trans->dirty_bgs_lock); | 275 | spin_lock_init(&cur_trans->dirty_bgs_lock); |
| 276 | INIT_LIST_HEAD(&cur_trans->deleted_bgs); | 276 | INIT_LIST_HEAD(&cur_trans->deleted_bgs); |
| 277 | spin_lock_init(&cur_trans->deleted_bgs_lock); | ||
| 278 | spin_lock_init(&cur_trans->dropped_roots_lock); | 277 | spin_lock_init(&cur_trans->dropped_roots_lock); |
| 279 | list_add_tail(&cur_trans->list, &fs_info->trans_list); | 278 | list_add_tail(&cur_trans->list, &fs_info->trans_list); |
| 280 | extent_io_tree_init(&cur_trans->dirty_pages, | 279 | extent_io_tree_init(&cur_trans->dirty_pages, |
| @@ -77,8 +77,8 @@ struct btrfs_transaction { · 76 unmodified lines | |||
| 77 | */ | 77 | */ |
| 78 | struct mutex cache_write_mutex; | 78 | struct mutex cache_write_mutex; |
| 79 | spinlock_t dirty_bgs_lock; | 79 | spinlock_t dirty_bgs_lock; |
| 80 | /* Protected by spin lock fs_info->unused_bgs_lock. */ | ||
| 80 | struct list_head deleted_bgs; | 81 | struct list_head deleted_bgs; |
| 81 | spinlock_t deleted_bgs_lock; | ||
| 82 | spinlock_t dropped_roots_lock; | 82 | spinlock_t dropped_roots_lock; |
| 83 | struct btrfs_delayed_ref_root delayed_refs; | 83 | struct btrfs_delayed_ref_root delayed_refs; |
| 84 | int aborted; | 84 | int aborted; |
| @@ -3548,12 +3548,11 @@ again: · 3547 unmodified lines | |||
| 3548 | 3548 | ||
| 3549 | ret = btrfs_force_chunk_alloc(trans, chunk_root, | 3549 | ret = btrfs_force_chunk_alloc(trans, chunk_root, |
| 3550 | BTRFS_BLOCK_GROUP_DATA); | 3550 | BTRFS_BLOCK_GROUP_DATA); |
| 3551 | btrfs_end_transaction(trans, chunk_root); | ||
| 3551 | if (ret < 0) { | 3552 | if (ret < 0) { |
| 3552 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); | 3553 | mutex_unlock(&fs_info->delete_unused_bgs_mutex); |
| 3553 | goto error; | 3554 | goto error; |
| 3554 | } | 3555 | } |
| 3555 | |||
| 3556 | btrfs_end_transaction(trans, chunk_root); | ||
| 3557 | chunk_reserved = 1; | 3556 | chunk_reserved = 1; |
| 3558 | } | 3557 | } |
| 3559 | 3558 | ||
| @@ -1831,11 +1831,11 @@ cifs_invalidate_mapping(struct inode *inode) · 1830 unmodified lines | |||
| 1831 | * @word: long word containing the bit lock | 1831 | * @word: long word containing the bit lock |
| 1832 | */ | 1832 | */ |
| 1833 | static int | 1833 | static int |
| 1834 | cifs_wait_bit_killable(struct wait_bit_key *key) | 1834 | cifs_wait_bit_killable(struct wait_bit_key *key, int mode) |
| 1835 | { | 1835 | { |
| 1836 | if (fatal_signal_pending(current)) | ||
| 1837 | return -ERESTARTSYS; | ||
| 1838 | freezable_schedule_unsafe(); | 1836 | freezable_schedule_unsafe(); |
| 1837 | if (signal_pending_state(mode, current)) | ||
| 1838 | return -ERESTARTSYS; | ||
| 1839 | return 0; | 1839 | return 0; |
| 1840 | } | 1840 | } |
| 1841 | 1841 | ||
| @@ -1175,6 +1175,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, · 1174 unmodified lines | |||
| 1175 | if (dio->flags & DIO_LOCKING) | 1175 | if (dio->flags & DIO_LOCKING) |
| 1176 | mutex_unlock(&inode->i_mutex); | 1176 | mutex_unlock(&inode->i_mutex); |
| 1177 | kmem_cache_free(dio_cache, dio); | 1177 | kmem_cache_free(dio_cache, dio); |
| 1178 | retval = 0; | ||
| 1178 | goto out; | 1179 | goto out; |
| 1179 | } | 1180 | } |
| 1180 | 1181 | ||
| @@ -592,10 +592,7 @@ static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate) · 591 unmodified lines | |||
| 592 | } | 592 | } |
| 593 | unlock_page(page); | 593 | unlock_page(page); |
| 594 | } | 594 | } |
| 595 | if (PageDirty(page) || PageWriteback(page)) | 595 | *uptodate = PageUptodate(page); |
| 596 | *uptodate = true; | ||
| 597 | else | ||
| 598 | *uptodate = PageUptodate(page); | ||
| 599 | EXOFS_DBGMSG2("index=0x%lx uptodate=%d\n", index, *uptodate); | 596 | EXOFS_DBGMSG2("index=0x%lx uptodate=%d\n", index, *uptodate); |
| 600 | return page; | 597 | return page; |
| 601 | } else { | 598 | } else { |
| @@ -389,7 +389,7 @@ int ext4_encrypted_zeroout(struct inode *inode, struct ext4_extent *ex) · 388 unmodified lines | |||
| 389 | struct ext4_crypto_ctx *ctx; | 389 | struct ext4_crypto_ctx *ctx; |
| 390 | struct page *ciphertext_page = NULL; | 390 | struct page *ciphertext_page = NULL; |
| 391 | struct bio *bio; | 391 | struct bio *bio; |
| 392 | ext4_lblk_t lblk = ex->ee_block; | 392 | ext4_lblk_t lblk = le32_to_cpu(ex->ee_block); |
| 393 | ext4_fsblk_t pblk = ext4_ext_pblock(ex); | 393 | ext4_fsblk_t pblk = ext4_ext_pblock(ex); |
| 394 | unsigned int len = ext4_ext_get_actual_len(ex); | 394 | unsigned int len = ext4_ext_get_actual_len(ex); |
| 395 | int ret, err = 0; | 395 | int ret, err = 0; |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | |||
| 26 | #include <linux/seqlock.h> | 26 | #include <linux/seqlock.h> |
| 27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 28 | #include <linux/timer.h> | 28 | #include <linux/timer.h> |
| 29 | #include <linux/version.h> | ||
| 29 | #include <linux/wait.h> | 30 | #include <linux/wait.h> |
| 30 | #include <linux/blockgroup_lock.h> | 31 | #include <linux/blockgroup_lock.h> |
| 31 | #include <linux/percpu_counter.h> | 32 | #include <linux/percpu_counter.h> |
| @@ -727,19 +728,55 @@ struct move_extent { · 695 unmodified lines | |||
| 727 | <= (EXT4_GOOD_OLD_INODE_SIZE + \ | 728 | <= (EXT4_GOOD_OLD_INODE_SIZE + \ |
| 728 | (einode)->i_extra_isize)) \ | 729 | (einode)->i_extra_isize)) \ |
| 729 | 730 | ||
| 731 | /* | ||
| 732 | * We use an encoding that preserves the times for extra epoch "00": | ||
| 733 | * | ||
| 734 | * extra msb of adjust for signed | ||
| 735 | * epoch 32-bit 32-bit tv_sec to | ||
| 736 | * bits time decoded 64-bit tv_sec 64-bit tv_sec valid time range | ||
| 737 | * 0 0 1 -0x80000000..-0x00000001 0x000000000 1901-12-13..1969-12-31 | ||
| 738 | * 0 0 0 0x000000000..0x07fffffff 0x000000000 1970-01-01..2038-01-19 | ||
| 739 | * 0 1 1 0x080000000..0x0ffffffff 0x100000000 2038-01-19..2106-02-07 | ||
| 740 | * 0 1 0 0x100000000..0x17fffffff 0x100000000 2106-02-07..2174-02-25 | ||
| 741 | * 1 0 1 0x180000000..0x1ffffffff 0x200000000 2174-02-25..2242-03-16 | ||
| 742 | * 1 0 0 0x200000000..0x27fffffff 0x200000000 2242-03-16..2310-04-04 | ||
| 743 | * 1 1 1 0x280000000..0x2ffffffff 0x300000000 2310-04-04..2378-04-22 | ||
| 744 | * 1 1 0 0x300000000..0x37fffffff 0x300000000 2378-04-22..2446-05-10 | ||
| 745 | * | ||
| 746 | * Note that previous versions of the kernel on 64-bit systems would | ||
| 747 | * incorrectly use extra epoch bits 1,1 for dates between 1901 and | ||
| 748 | * 1970. e2fsck will correct this, assuming that it is run on the | ||
| 749 | * affected filesystem before 2242. | ||
| 750 | */ | ||
| 751 | |||
| 730 | static inline __le32 ext4_encode_extra_time(struct timespec *time) | 752 | static inline __le32 ext4_encode_extra_time(struct timespec *time) |
| 731 | { | 753 | { |
| 732 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? | 754 | u32 extra = sizeof(time->tv_sec) > 4 ? |
| 733 | (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) | | 755 | ((time->tv_sec - (s32)time->tv_sec) >> 32) & EXT4_EPOCH_MASK : 0; |
| 734 | ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK)); | 756 | return cpu_to_le32(extra | (time->tv_nsec << EXT4_EPOCH_BITS)); |
| 735 | } | 757 | } |
| 736 | 758 | ||
| 737 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) | 759 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) |
| 738 | { | 760 | { |
| 739 | if (sizeof(time->tv_sec) > 4) | 761 | if (unlikely(sizeof(time->tv_sec) > 4 && |
| 740 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) | 762 | (extra & cpu_to_le32(EXT4_EPOCH_MASK)))) { |
| 741 | << 32; | 763 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) |
| 742 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; | 764 | /* Handle legacy encoding of pre-1970 dates with epoch |
| 765 | * bits 1,1. We assume that by kernel version 4.20, | ||
| 766 | * everyone will have run fsck over the affected | ||
| 767 | * filesystems to correct the problem. (This | ||
| 768 | * backwards compatibility may be removed before this | ||
| 769 | * time, at the discretion of the ext4 developers.) | ||
| 770 | */ | ||
| 771 | u64 extra_bits = le32_to_cpu(extra) & EXT4_EPOCH_MASK; | ||
| 772 | if (extra_bits == 3 && ((time->tv_sec) & 0x80000000) != 0) | ||
| 773 | extra_bits = 0; | ||
| 774 | time->tv_sec += extra_bits << 32; | ||
| 775 | #else | ||
| 776 | time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32; | ||
| 777 | #endif | ||
| 778 | } | ||
| 779 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; | ||
| 743 | } | 780 | } |
| 744 | 781 | ||
| 745 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ | 782 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ |
| @@ -52,7 +52,7 @@ static const char *ext4_encrypted_follow_link(struct dentry *dentry, void **cook · 51 unmodified lines | |||
| 52 | /* Symlink is encrypted */ | 52 | /* Symlink is encrypted */ |
| 53 | sd = (struct ext4_encrypted_symlink_data *)caddr; | 53 | sd = (struct ext4_encrypted_symlink_data *)caddr; |
| 54 | cstr.name = sd->encrypted_path; | 54 | cstr.name = sd->encrypted_path; |
| 55 | cstr.len = le32_to_cpu(sd->len); | 55 | cstr.len = le16_to_cpu(sd->len); |
| 56 | if ((cstr.len + | 56 | if ((cstr.len + |
| 57 | sizeof(struct ext4_encrypted_symlink_data) - 1) > | 57 | sizeof(struct ext4_encrypted_symlink_data) - 1) > |
| 58 | max_size) { | 58 | max_size) { |
| @@ -358,7 +358,7 @@ static int name##_open(struct inode *inode, struct file *file) \ · 357 unmodified lines | |||
| 358 | return single_open(file, ext4_seq_##name##_show, PDE_DATA(inode)); \ | 358 | return single_open(file, ext4_seq_##name##_show, PDE_DATA(inode)); \ |
| 359 | } \ | 359 | } \ |
| 360 | \ | 360 | \ |
| 361 | const struct file_operations ext4_seq_##name##_fops = { \ | 361 | static const struct file_operations ext4_seq_##name##_fops = { \ |
| 362 | .owner = THIS_MODULE, \ | 362 | .owner = THIS_MODULE, \ |
| 363 | .open = name##_open, \ | 363 | .open = name##_open, \ |
| 364 | .read = seq_read, \ | 364 | .read = seq_read, \ |
| @@ -549,6 +549,8 @@ static int cuse_channel_release(struct inode *inode, struct file *file) · 548 unmodified lines | |||
| 549 | unregister_chrdev_region(cc->cdev->dev, 1); | 549 | unregister_chrdev_region(cc->cdev->dev, 1); |
| 550 | cdev_del(cc->cdev); | 550 | cdev_del(cc->cdev); |
| 551 | } | 551 | } |
| 552 | /* Base reference is now owned by "fud" */ | ||
| 553 | fuse_conn_put(&cc->fc); | ||
| 552 | 554 | ||
| 553 | rc = fuse_dev_release(inode, file); /* puts the base reference */ | 555 | rc = fuse_dev_release(inode, file); /* puts the base reference */ |
| 554 | 556 | ||
| @@ -1049,6 +1049,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, · 1048 unmodified lines | |||
| 1049 | tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes); | 1049 | tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes); |
| 1050 | flush_dcache_page(page); | 1050 | flush_dcache_page(page); |
| 1051 | 1051 | ||
| 1052 | iov_iter_advance(ii, tmp); | ||
| 1052 | if (!tmp) { | 1053 | if (!tmp) { |
| 1053 | unlock_page(page); | 1054 | unlock_page(page); |
| 1054 | page_cache_release(page); | 1055 | page_cache_release(page); |
| @@ -1061,7 +1062,6 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, · 6 unmodified lines | |||
| 1061 | req->page_descs[req->num_pages].length = tmp; | 1062 | req->page_descs[req->num_pages].length = tmp; |
| 1062 | req->num_pages++; | 1063 | req->num_pages++; |
| 1063 | 1064 | ||
| 1064 | iov_iter_advance(ii, tmp); | ||
| 1065 | count += tmp; | 1065 | count += tmp; |
| 1066 | pos += tmp; | 1066 | pos += tmp; |
| 1067 | offset += tmp; | 1067 | offset += tmp; |
| @@ -1009,7 +1009,8 @@ out: · 1008 unmodified lines | |||
| 1009 | } | 1009 | } |
| 1010 | 1010 | ||
| 1011 | /* Fast check whether buffer is already attached to the required transaction */ | 1011 | /* Fast check whether buffer is already attached to the required transaction */ |
| 1012 | static bool jbd2_write_access_granted(handle_t *handle, struct buffer_head *bh) | 1012 | static bool jbd2_write_access_granted(handle_t *handle, struct buffer_head *bh, |
| 1013 | bool undo) | ||
| 1013 | { | 1014 | { |
| 1014 | struct journal_head *jh; | 1015 | struct journal_head *jh; |
| 1015 | bool ret = false; | 1016 | bool ret = false; |
| @@ -1036,6 +1037,9 @@ static bool jbd2_write_access_granted(handle_t *handle, struct buffer_head *bh) · 20 unmodified lines | |||
| 1036 | jh = READ_ONCE(bh->b_private); | 1037 | jh = READ_ONCE(bh->b_private); |
| 1037 | if (!jh) | 1038 | if (!jh) |
| 1038 | goto out; | 1039 | goto out; |
| 1040 | /* For undo access buffer must have data copied */ | ||
| 1041 | if (undo && !jh->b_committed_data) | ||
| 1042 | goto out; | ||
| 1039 | if (jh->b_transaction != handle->h_transaction && | 1043 | if (jh->b_transaction != handle->h_transaction && |
| 1040 | jh->b_next_transaction != handle->h_transaction) | 1044 | jh->b_next_transaction != handle->h_transaction) |
| 1041 | goto out; | 1045 | goto out; |
| @@ -1073,7 +1077,7 @@ int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh) · 31 unmodified lines | |||
| 1073 | struct journal_head *jh; | 1077 | struct journal_head *jh; |
| 1074 | int rc; | 1078 | int rc; |
| 1075 | 1079 | ||
| 1076 | if (jbd2_write_access_granted(handle, bh)) | 1080 | if (jbd2_write_access_granted(handle, bh, false)) |
| 1077 | return 0; | 1081 | return 0; |
| 1078 | 1082 | ||
| 1079 | jh = jbd2_journal_add_journal_head(bh); | 1083 | jh = jbd2_journal_add_journal_head(bh); |
| @@ -1210,7 +1214,7 @@ int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh) · 130 unmodified lines | |||
| 1210 | char *committed_data = NULL; | 1214 | char *committed_data = NULL; |
| 1211 | 1215 | ||
| 1212 | JBUFFER_TRACE(jh, "entry"); | 1216 | JBUFFER_TRACE(jh, "entry"); |
| 1213 | if (jbd2_write_access_granted(handle, bh)) | 1217 | if (jbd2_write_access_granted(handle, bh, true)) |
| 1214 | return 0; | 1218 | return 0; |
| 1215 | 1219 | ||
| 1216 | jh = jbd2_journal_add_journal_head(bh); | 1220 | jh = jbd2_journal_add_journal_head(bh); |
| @@ -2152,6 +2156,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, · 935 unmodified lines | |||
| 2152 | 2156 | ||
| 2153 | if (!buffer_dirty(bh)) { | 2157 | if (!buffer_dirty(bh)) { |
| 2154 | /* bdflush has written it. We can drop it now */ | 2158 | /* bdflush has written it. We can drop it now */ |
| 2159 | __jbd2_journal_remove_checkpoint(jh); | ||
| 2155 | goto zap_buffer; | 2160 | goto zap_buffer; |
| 2156 | } | 2161 | } |
| 2157 | 2162 | ||
| @@ -2181,6 +2186,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, · 23 unmodified lines | |||
| 2181 | /* The orphan record's transaction has | 2186 | /* The orphan record's transaction has |
| 2182 | * committed. We can cleanse this buffer */ | 2187 | * committed. We can cleanse this buffer */ |
| 2183 | clear_buffer_jbddirty(bh); | 2188 | clear_buffer_jbddirty(bh); |
| 2189 | __jbd2_journal_remove_checkpoint(jh); | ||
| 2184 | goto zap_buffer; | 2190 | goto zap_buffer; |
| 2185 | } | 2191 | } |
| 2186 | } | 2192 | } |
| @@ -78,8 +78,7 @@ static __be32 *read_buf(struct xdr_stream *xdr, int nbytes) · 77 unmodified lines | |||
| 78 | 78 | ||
| 79 | p = xdr_inline_decode(xdr, nbytes); | 79 | p = xdr_inline_decode(xdr, nbytes); |
| 80 | if (unlikely(p == NULL)) | 80 | if (unlikely(p == NULL)) |
| 81 | printk(KERN_WARNING "NFS: NFSv4 callback reply buffer overflowed " | 81 | printk(KERN_WARNING "NFS: NFSv4 callback reply buffer overflowed!\n"); |
| 82 | "or truncated request.\n"); | ||
| 83 | return p; | 82 | return p; |
| 84 | } | 83 | } |
| 85 | 84 | ||
| @@ -890,7 +889,6 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r · 804 unmodified lines | |||
| 890 | struct cb_compound_hdr_arg hdr_arg = { 0 }; | 889 | struct cb_compound_hdr_arg hdr_arg = { 0 }; |
| 891 | struct cb_compound_hdr_res hdr_res = { NULL }; | 890 | struct cb_compound_hdr_res hdr_res = { NULL }; |
| 892 | struct xdr_stream xdr_in, xdr_out; | 891 | struct xdr_stream xdr_in, xdr_out; |
| 893 | struct xdr_buf *rq_arg = &rqstp->rq_arg; | ||
| 894 | __be32 *p, status; | 892 | __be32 *p, status; |
| 895 | struct cb_process_state cps = { | 893 | struct cb_process_state cps = { |
| 896 | .drc_status = 0, | 894 | .drc_status = 0, |
| @@ -902,8 +900,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r · 5 unmodified lines | |||
| 902 | 900 | ||
| 903 | dprintk("%s: start\n", __func__); | 901 | dprintk("%s: start\n", __func__); |
| 904 | 902 | ||
| 905 | rq_arg->len = rq_arg->head[0].iov_len + rq_arg->page_len; | 903 | xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); |
| 906 | xdr_init_decode(&xdr_in, rq_arg, rq_arg->head[0].iov_base); | ||
| 907 | 904 | ||
| 908 | p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); | 905 | p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); |
| 909 | xdr_init_encode(&xdr_out, &rqstp->rq_res, p); | 906 | xdr_init_encode(&xdr_out, &rqstp->rq_res, p); |
| @@ -75,11 +75,11 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr) · 74 unmodified lines | |||
| 75 | * nfs_wait_bit_killable - helper for functions that are sleeping on bit locks | 75 | * nfs_wait_bit_killable - helper for functions that are sleeping on bit locks |
| 76 | * @word: long word containing the bit lock | 76 | * @word: long word containing the bit lock |
| 77 | */ | 77 | */ |
| 78 | int nfs_wait_bit_killable(struct wait_bit_key *key) | 78 | int nfs_wait_bit_killable(struct wait_bit_key *key, int mode) |
| 79 | { | 79 | { |
| 80 | if (fatal_signal_pending(current)) | ||
| 81 | return -ERESTARTSYS; | ||
| 82 | freezable_schedule_unsafe(); | 80 | freezable_schedule_unsafe(); |
| 81 | if (signal_pending_state(mode, current)) | ||
| 82 | return -ERESTARTSYS; | ||
| 83 | return 0; | 83 | return 0; |
| 84 | } | 84 | } |
| 85 | EXPORT_SYMBOL_GPL(nfs_wait_bit_killable); | 85 | EXPORT_SYMBOL_GPL(nfs_wait_bit_killable); |
| @@ -379,7 +379,7 @@ extern int nfs_drop_inode(struct inode *); · 378 unmodified lines | |||
| 379 | extern void nfs_clear_inode(struct inode *); | 379 | extern void nfs_clear_inode(struct inode *); |
| 380 | extern void nfs_evict_inode(struct inode *); | 380 | extern void nfs_evict_inode(struct inode *); |
| 381 | void nfs_zap_acl_cache(struct inode *inode); | 381 | void nfs_zap_acl_cache(struct inode *inode); |
| 382 | extern int nfs_wait_bit_killable(struct wait_bit_key *key); | 382 | extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode); |
| 383 | 383 | ||
| 384 | /* super.c */ | 384 | /* super.c */ |
| 385 | extern const struct super_operations nfs_sops; | 385 | extern const struct super_operations nfs_sops; |
| @@ -476,10 +476,7 @@ static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate) · 475 unmodified lines | |||
| 476 | } | 476 | } |
| 477 | unlock_page(page); | 477 | unlock_page(page); |
| 478 | } | 478 | } |
| 479 | if (PageDirty(page) || PageWriteback(page)) | 479 | *uptodate = PageUptodate(page); |
| 480 | *uptodate = true; | ||
| 481 | else | ||
| 482 | *uptodate = PageUptodate(page); | ||
| 483 | dprintk("%s: index=0x%lx uptodate=%d\n", __func__, index, *uptodate); | 480 | dprintk("%s: index=0x%lx uptodate=%d\n", __func__, index, *uptodate); |
| 484 | return page; | 481 | return page; |
| 485 | } | 482 | } |
| @@ -129,7 +129,7 @@ __nfs_iocounter_wait(struct nfs_io_counter *c) · 128 unmodified lines | |||
| 129 | set_bit(NFS_IO_INPROGRESS, &c->flags); | 129 | set_bit(NFS_IO_INPROGRESS, &c->flags); |
| 130 | if (atomic_read(&c->io_count) == 0) | 130 | if (atomic_read(&c->io_count) == 0) |
| 131 | break; | 131 | break; |
| 132 | ret = nfs_wait_bit_killable(&q.key); | 132 | ret = nfs_wait_bit_killable(&q.key, TASK_KILLABLE); |
| 133 | } while (atomic_read(&c->io_count) != 0 && !ret); | 133 | } while (atomic_read(&c->io_count) != 0 && !ret); |
| 134 | finish_wait(wq, &q.wait); | 134 | finish_wait(wq, &q.wait); |
| 135 | return ret; | 135 | return ret; |
| @@ -1466,11 +1466,11 @@ static bool pnfs_within_mdsthreshold(struct nfs_open_context *ctx, · 1465 unmodified lines | |||
| 1466 | } | 1466 | } |
| 1467 | 1467 | ||
| 1468 | /* stop waiting if someone clears NFS_LAYOUT_RETRY_LAYOUTGET bit. */ | 1468 | /* stop waiting if someone clears NFS_LAYOUT_RETRY_LAYOUTGET bit. */ |
| 1469 | static int pnfs_layoutget_retry_bit_wait(struct wait_bit_key *key) | 1469 | static int pnfs_layoutget_retry_bit_wait(struct wait_bit_key *key, int mode) |
| 1470 | { | 1470 | { |
| 1471 | if (!test_bit(NFS_LAYOUT_RETRY_LAYOUTGET, key->flags)) | 1471 | if (!test_bit(NFS_LAYOUT_RETRY_LAYOUTGET, key->flags)) |
| 1472 | return 1; | 1472 | return 1; |
| 1473 | return nfs_wait_bit_killable(key); | 1473 | return nfs_wait_bit_killable(key, mode); |
| 1474 | } | 1474 | } |
| 1475 | 1475 | ||
| 1476 | static bool pnfs_prepare_to_retry_layoutget(struct pnfs_layout_hdr *lo) | 1476 | static bool pnfs_prepare_to_retry_layoutget(struct pnfs_layout_hdr *lo) |
| @@ -616,6 +616,7 @@ nfsd4_cb_layout_prepare(struct nfsd4_callback *cb) · 615 unmodified lines | |||
| 616 | 616 | ||
| 617 | mutex_lock(&ls->ls_mutex); | 617 | mutex_lock(&ls->ls_mutex); |
| 618 | nfs4_inc_and_copy_stateid(&ls->ls_recall_sid, &ls->ls_stid); | 618 | nfs4_inc_and_copy_stateid(&ls->ls_recall_sid, &ls->ls_stid); |
| 619 | mutex_unlock(&ls->ls_mutex); | ||
| 619 | } | 620 | } |
| 620 | 621 | ||
| 621 | static int | 622 | static int |
| @@ -659,7 +660,6 @@ nfsd4_cb_layout_release(struct nfsd4_callback *cb) · 37 unmodified lines | |||
| 659 | 660 | ||
| 660 | trace_layout_recall_release(&ls->ls_stid.sc_stateid); | 661 | trace_layout_recall_release(&ls->ls_stid.sc_stateid); |
| 661 | 662 | ||
| 662 | mutex_unlock(&ls->ls_mutex); | ||
| 663 | nfsd4_return_all_layouts(ls, &reaplist); | 663 | nfsd4_return_all_layouts(ls, &reaplist); |
| 664 | nfsd4_free_layouts(&reaplist); | 664 | nfsd4_free_layouts(&reaplist); |
| 665 | nfs4_put_stid(&ls->ls_stid); | 665 | nfs4_put_stid(&ls->ls_stid); |
| @@ -367,13 +367,11 @@ static int ocfs2_mknod(struct inode *dir, · 366 unmodified lines | |||
| 367 | goto leave; | 367 | goto leave; |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | status = posix_acl_create(dir, &mode, &default_acl, &acl); | 370 | status = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); |
| 371 | if (status) { | 371 | if (status) { |
| 372 | mlog_errno(status); | 372 | mlog_errno(status); |
| 373 | goto leave; | 373 | goto leave; |
| 374 | } | 374 | } |
| 375 | /* update inode->i_mode after mask with "umask". */ | ||
| 376 | inode->i_mode = mode; | ||
| 377 | 375 | ||
| 378 | handle = ocfs2_start_trans(osb, ocfs2_mknod_credits(osb->sb, | 376 | handle = ocfs2_start_trans(osb, ocfs2_mknod_credits(osb->sb, |
| 379 | S_ISDIR(mode), | 377 | S_ISDIR(mode), |
| @@ -2494,6 +2494,7 @@ static ssize_t proc_coredump_filter_write(struct file *file, · 2493 unmodified lines | |||
| 2494 | mm = get_task_mm(task); | 2494 | mm = get_task_mm(task); |
| 2495 | if (!mm) | 2495 | if (!mm) |
| 2496 | goto out_no_mm; | 2496 | goto out_no_mm; |
| 2497 | ret = 0; | ||
| 2497 | 2498 | ||
| 2498 | for (i = 0, mask = 1; i < MMF_DUMP_FILTER_BITS; i++, mask <<= 1) { | 2499 | for (i = 0, mask = 1; i < MMF_DUMP_FILTER_BITS; i++, mask <<= 1) { |
| 2499 | if (val & mask) | 2500 | if (val & mask) |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Copyright 2001 Red Hat, Inc. | 5 | * Copyright 2001 Red Hat, Inc. |
| 6 | * Based on code from mm/memory.c Copyright Linus Torvalds and others. | 6 | * Based on code from mm/memory.c Copyright Linus Torvalds and others. |
| 7 | * | 7 | * |
| 8 | * Copyright 2011 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright 2011 Red Hat, Inc., Peter Zijlstra |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or | 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public License | 11 | * modify it under the terms of the GNU General Public License |
| @@ -107,7 +107,7 @@ static inline __u64 ror64(__u64 word, unsigned int shift) · 106 unmodified lines | |||
| 107 | */ | 107 | */ |
| 108 | static inline __u32 rol32(__u32 word, unsigned int shift) | 108 | static inline __u32 rol32(__u32 word, unsigned int shift) |
| 109 | { | 109 | { |
| 110 | return (word << shift) | (word >> (32 - shift)); | 110 | return (word << shift) | (word >> ((-shift) & 31)); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | /** | 113 | /** |
| @@ -90,7 +90,6 @@ enum { · 89 unmodified lines | |||
| 90 | */ | 90 | */ |
| 91 | struct cgroup_file { | 91 | struct cgroup_file { |
| 92 | /* do not access any fields from outside cgroup core */ | 92 | /* do not access any fields from outside cgroup core */ |
| 93 | struct list_head node; /* anchored at css->files */ | ||
| 94 | struct kernfs_node *kn; | 93 | struct kernfs_node *kn; |
| 95 | }; | 94 | }; |
| 96 | 95 | ||
| @@ -134,9 +133,6 @@ struct cgroup_subsys_state { · 37 unmodified lines | |||
| 134 | */ | 133 | */ |
| 135 | u64 serial_nr; | 134 | u64 serial_nr; |
| 136 | 135 | ||
| 137 | /* all cgroup_files associated with this css */ | ||
| 138 | struct list_head files; | ||
| 139 | |||
| 140 | /* percpu_ref killing and RCU release */ | 136 | /* percpu_ref killing and RCU release */ |
| 141 | struct rcu_head rcu_head; | 137 | struct rcu_head rcu_head; |
| 142 | struct work_struct destroy_work; | 138 | struct work_struct destroy_work; |
| @@ -426,12 +422,9 @@ struct cgroup_subsys { · 283 unmodified lines | |||
| 426 | void (*css_reset)(struct cgroup_subsys_state *css); | 422 | void (*css_reset)(struct cgroup_subsys_state *css); |
| 427 | void (*css_e_css_changed)(struct cgroup_subsys_state *css); | 423 | void (*css_e_css_changed)(struct cgroup_subsys_state *css); |
| 428 | 424 | ||
| 429 | int (*can_attach)(struct cgroup_subsys_state *css, | 425 | int (*can_attach)(struct cgroup_taskset *tset); |
| 430 | struct cgroup_taskset *tset); | 426 | void (*cancel_attach)(struct cgroup_taskset *tset); |
| 431 | void (*cancel_attach)(struct cgroup_subsys_state *css, | 427 | void (*attach)(struct cgroup_taskset *tset); |
| 432 | struct cgroup_taskset *tset); | ||
| 433 | void (*attach)(struct cgroup_subsys_state *css, | ||
| 434 | struct cgroup_taskset *tset); | ||
| 435 | int (*can_fork)(struct task_struct *task, void **priv_p); | 428 | int (*can_fork)(struct task_struct *task, void **priv_p); |
| 436 | void (*cancel_fork)(struct task_struct *task, void *priv); | 429 | void (*cancel_fork)(struct task_struct *task, void *priv); |
| 437 | void (*fork)(struct task_struct *task, void *priv); | 430 | void (*fork)(struct task_struct *task, void *priv); |
| @@ -88,6 +88,7 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); · 87 unmodified lines | |||
| 88 | int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); | 88 | int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
| 89 | int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); | 89 | int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
| 90 | int cgroup_rm_cftypes(struct cftype *cfts); | 90 | int cgroup_rm_cftypes(struct cftype *cfts); |
| 91 | void cgroup_file_notify(struct cgroup_file *cfile); | ||
| 91 | 92 | ||
| 92 | char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); | 93 | char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); |
| 93 | int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry); | 94 | int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry); |
| @@ -119,8 +120,10 @@ struct cgroup_subsys_state *css_rightmost_descendant(struct cgroup_subsys_state · 25 unmodified lines | |||
| 119 | struct cgroup_subsys_state *css_next_descendant_post(struct cgroup_subsys_state *pos, | 120 | struct cgroup_subsys_state *css_next_descendant_post(struct cgroup_subsys_state *pos, |
| 120 | struct cgroup_subsys_state *css); | 121 | struct cgroup_subsys_state *css); |
| 121 | 122 | ||
| 122 | struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); | 123 | struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset, |
| 123 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); | 124 | struct cgroup_subsys_state **dst_cssp); |
| 125 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset, | ||
| 126 | struct cgroup_subsys_state **dst_cssp); | ||
| 124 | 127 | ||
| 125 | void css_task_iter_start(struct cgroup_subsys_state *css, | 128 | void css_task_iter_start(struct cgroup_subsys_state *css, |
| 126 | struct css_task_iter *it); | 129 | struct css_task_iter *it); |
| @@ -235,30 +238,39 @@ void css_task_iter_end(struct css_task_iter *it); · 108 unmodified lines | |||
| 235 | /** | 238 | /** |
| 236 | * cgroup_taskset_for_each - iterate cgroup_taskset | 239 | * cgroup_taskset_for_each - iterate cgroup_taskset |
| 237 | * @task: the loop cursor | 240 | * @task: the loop cursor |
| 241 | * @dst_css: the destination css | ||
| 238 | * @tset: taskset to iterate | 242 | * @tset: taskset to iterate |
| 239 | * | 243 | * |
| 240 | * @tset may contain multiple tasks and they may belong to multiple | 244 | * @tset may contain multiple tasks and they may belong to multiple |
| 241 | * processes. When there are multiple tasks in @tset, if a task of a | 245 | * processes. |
| 242 | * process is in @tset, all tasks of the process are in @tset. Also, all | 246 | * |
| 243 | * are guaranteed to share the same source and destination csses. | 247 | * On the v2 hierarchy, there may be tasks from multiple processes and they |
| 248 | * may not share the source or destination csses. | ||
| 249 | * | ||
| 250 | * On traditional hierarchies, when there are multiple tasks in @tset, if a | ||
| 251 | * task of a process is in @tset, all tasks of the process are in @tset. | ||
| 252 | * Also, all are guaranteed to share the same source and destination csses. | ||
| 244 | * | 253 | * |
| 245 | * Iteration is not in any specific order. | 254 | * Iteration is not in any specific order. |
| 246 | */ | 255 | */ |
| 247 | #define cgroup_taskset_for_each(task, tset) \ | 256 | #define cgroup_taskset_for_each(task, dst_css, tset) \ |
| 248 | for ((task) = cgroup_taskset_first((tset)); (task); \ | 257 | for ((task) = cgroup_taskset_first((tset), &(dst_css)); \ |
| 249 | (task) = cgroup_taskset_next((tset))) | 258 | (task); \ |
| 259 | (task) = cgroup_taskset_next((tset), &(dst_css))) | ||
| 250 | 260 | ||
| 251 | /** | 261 | /** |
| 252 | * cgroup_taskset_for_each_leader - iterate group leaders in a cgroup_taskset | 262 | * cgroup_taskset_for_each_leader - iterate group leaders in a cgroup_taskset |
| 253 | * @leader: the loop cursor | 263 | * @leader: the loop cursor |
| 264 | * @dst_css: the destination css | ||
| 254 | * @tset: takset to iterate | 265 | * @tset: takset to iterate |
| 255 | * | 266 | * |
| 256 | * Iterate threadgroup leaders of @tset. For single-task migrations, @tset | 267 | * Iterate threadgroup leaders of @tset. For single-task migrations, @tset |
| 257 | * may not contain any. | 268 | * may not contain any. |
| 258 | */ | 269 | */ |
| 259 | #define cgroup_taskset_for_each_leader(leader, tset) \ | 270 | #define cgroup_taskset_for_each_leader(leader, dst_css, tset) \ |
| 260 | for ((leader) = cgroup_taskset_first((tset)); (leader); \ | 271 | for ((leader) = cgroup_taskset_first((tset), &(dst_css)); \ |
| 261 | (leader) = cgroup_taskset_next((tset))) \ | 272 | (leader); \ |
| 273 | (leader) = cgroup_taskset_next((tset), &(dst_css))) \ | ||
| 262 | if ((leader) != (leader)->group_leader) \ | 274 | if ((leader) != (leader)->group_leader) \ |
| 263 | ; \ | 275 | ; \ |
| 264 | else | 276 | else |
| @@ -516,19 +528,6 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp) · 251 unmodified lines | |||
| 516 | pr_cont_kernfs_path(cgrp->kn); | 528 | pr_cont_kernfs_path(cgrp->kn); |
| 517 | } | 529 | } |
| 518 | 530 | ||
| 519 | /** | ||
| 520 | * cgroup_file_notify - generate a file modified event for a cgroup_file | ||
| 521 | * @cfile: target cgroup_file | ||
| 522 | * | ||
| 523 | * @cfile must have been obtained by setting cftype->file_offset. | ||
| 524 | */ | ||
| 525 | static inline void cgroup_file_notify(struct cgroup_file *cfile) | ||
| 526 | { | ||
| 527 | /* might not have been created due to one of the CFTYPE selector flags */ | ||
| 528 | if (cfile->kn) | ||
| 529 | kernfs_notify(cfile->kn); | ||
| 530 | } | ||
| 531 | |||
| 532 | #else /* !CONFIG_CGROUPS */ | 531 | #else /* !CONFIG_CGROUPS */ |
| 533 | 532 | ||
| 534 | struct cgroup_subsys_state; | 533 | struct cgroup_subsys_state; |
| @@ -29,7 +29,11 @@ · 28 unmodified lines | |||
| 29 | /* A few generic types ... taken from ses-2 */ | 29 | /* A few generic types ... taken from ses-2 */ |
| 30 | enum enclosure_component_type { | 30 | enum enclosure_component_type { |
| 31 | ENCLOSURE_COMPONENT_DEVICE = 0x01, | 31 | ENCLOSURE_COMPONENT_DEVICE = 0x01, |
| 32 | ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS = 0x07, | ||
| 33 | ENCLOSURE_COMPONENT_SCSI_TARGET_PORT = 0x14, | ||
| 34 | ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT = 0x15, | ||
| 32 | ENCLOSURE_COMPONENT_ARRAY_DEVICE = 0x17, | 35 | ENCLOSURE_COMPONENT_ARRAY_DEVICE = 0x17, |
| 36 | ENCLOSURE_COMPONENT_SAS_EXPANDER = 0x18, | ||
| 33 | }; | 37 | }; |
| 34 | 38 | ||
| 35 | /* ses-2 common element status */ | 39 | /* ses-2 common element status */ |
| @@ -330,6 +330,7 @@ struct rdists { · 329 unmodified lines | |||
| 330 | }; | 330 | }; |
| 331 | 331 | ||
| 332 | struct irq_domain; | 332 | struct irq_domain; |
| 333 | struct device_node; | ||
| 333 | int its_cpu_init(void); | 334 | int its_cpu_init(void); |
| 334 | int its_init(struct device_node *node, struct rdists *rdists, | 335 | int its_init(struct device_node *node, struct rdists *rdists, |
| 335 | struct irq_domain *domain); | 336 | struct irq_domain *domain); |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Jump label support | 5 | * Jump label support |
| 6 | * | 6 | * |
| 7 | * Copyright (C) 2009-2012 Jason Baron <jbaron@redhat.com> | 7 | * Copyright (C) 2009-2012 Jason Baron <jbaron@redhat.com> |
| 8 | * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra |
| 9 | * | 9 | * |
| 10 | * DEPRECATED API: | 10 | * DEPRECATED API: |
| 11 | * | 11 | * |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | #ifdef CONFIG_DEBUG_KMEMLEAK | 26 | #ifdef CONFIG_DEBUG_KMEMLEAK |
| 27 | 27 | ||
| 28 | extern void kmemleak_init(void) __ref; | 28 | extern void kmemleak_init(void) __init; |
| 29 | extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, | 29 | extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, |
| 30 | gfp_t gfp) __ref; | 30 | gfp_t gfp) __ref; |
| 31 | extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size, | 31 | extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size, |
| @@ -210,6 +210,7 @@ enum { · 209 unmodified lines | |||
| 210 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ | 210 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ |
| 211 | /* (doesn't imply presence) */ | 211 | /* (doesn't imply presence) */ |
| 212 | ATA_FLAG_SATA = (1 << 1), | 212 | ATA_FLAG_SATA = (1 << 1), |
| 213 | ATA_FLAG_NO_LOG_PAGE = (1 << 5), /* do not issue log page read */ | ||
| 213 | ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */ | 214 | ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */ |
| 214 | ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */ | 215 | ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */ |
| 215 | ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */ | 216 | ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */ |
| @@ -50,9 +50,16 @@ enum { · 49 unmodified lines | |||
| 50 | NVM_IO_DUAL_ACCESS = 0x1, | 50 | NVM_IO_DUAL_ACCESS = 0x1, |
| 51 | NVM_IO_QUAD_ACCESS = 0x2, | 51 | NVM_IO_QUAD_ACCESS = 0x2, |
| 52 | 52 | ||
| 53 | /* NAND Access Modes */ | ||
| 53 | NVM_IO_SUSPEND = 0x80, | 54 | NVM_IO_SUSPEND = 0x80, |
| 54 | NVM_IO_SLC_MODE = 0x100, | 55 | NVM_IO_SLC_MODE = 0x100, |
| 55 | NVM_IO_SCRAMBLE_DISABLE = 0x200, | 56 | NVM_IO_SCRAMBLE_DISABLE = 0x200, |
| 57 | |||
| 58 | /* Block Types */ | ||
| 59 | NVM_BLK_T_FREE = 0x0, | ||
| 60 | NVM_BLK_T_BAD = 0x1, | ||
| 61 | NVM_BLK_T_DEV = 0x2, | ||
| 62 | NVM_BLK_T_HOST = 0x4, | ||
| 56 | }; | 63 | }; |
| 57 | 64 | ||
| 58 | struct nvm_id_group { | 65 | struct nvm_id_group { |
| @@ -176,17 +183,17 @@ struct nvm_block; · 117 unmodified lines | |||
| 176 | 183 | ||
| 177 | typedef int (nvm_l2p_update_fn)(u64, u32, __le64 *, void *); | 184 | typedef int (nvm_l2p_update_fn)(u64, u32, __le64 *, void *); |
| 178 | typedef int (nvm_bb_update_fn)(struct ppa_addr, int, u8 *, void *); | 185 | typedef int (nvm_bb_update_fn)(struct ppa_addr, int, u8 *, void *); |
| 179 | typedef int (nvm_id_fn)(struct request_queue *, struct nvm_id *); | 186 | typedef int (nvm_id_fn)(struct nvm_dev *, struct nvm_id *); |
| 180 | typedef int (nvm_get_l2p_tbl_fn)(struct request_queue *, u64, u32, | 187 | typedef int (nvm_get_l2p_tbl_fn)(struct nvm_dev *, u64, u32, |
| 181 | nvm_l2p_update_fn *, void *); | 188 | nvm_l2p_update_fn *, void *); |
| 182 | typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, int, | 189 | typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, int, |
| 183 | nvm_bb_update_fn *, void *); | 190 | nvm_bb_update_fn *, void *); |
| 184 | typedef int (nvm_op_set_bb_fn)(struct request_queue *, struct nvm_rq *, int); | 191 | typedef int (nvm_op_set_bb_fn)(struct nvm_dev *, struct nvm_rq *, int); |
| 185 | typedef int (nvm_submit_io_fn)(struct request_queue *, struct nvm_rq *); | 192 | typedef int (nvm_submit_io_fn)(struct nvm_dev *, struct nvm_rq *); |
| 186 | typedef int (nvm_erase_blk_fn)(struct request_queue *, struct nvm_rq *); | 193 | typedef int (nvm_erase_blk_fn)(struct nvm_dev *, struct nvm_rq *); |
| 187 | typedef void *(nvm_create_dma_pool_fn)(struct request_queue *, char *); | 194 | typedef void *(nvm_create_dma_pool_fn)(struct nvm_dev *, char *); |
| 188 | typedef void (nvm_destroy_dma_pool_fn)(void *); | 195 | typedef void (nvm_destroy_dma_pool_fn)(void *); |
| 189 | typedef void *(nvm_dev_dma_alloc_fn)(struct request_queue *, void *, gfp_t, | 196 | typedef void *(nvm_dev_dma_alloc_fn)(struct nvm_dev *, void *, gfp_t, |
| 190 | dma_addr_t *); | 197 | dma_addr_t *); |
| 191 | typedef void (nvm_dev_dma_free_fn)(void *, void*, dma_addr_t); | 198 | typedef void (nvm_dev_dma_free_fn)(void *, void*, dma_addr_t); |
| 192 | 199 | ||
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | * Runtime locking correctness validator | 2 | * Runtime locking correctness validator |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 4 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 6 | * | 6 | * |
| 7 | * see Documentation/locking/lockdep-design.txt for more details. | 7 | * see Documentation/locking/lockdep-design.txt for more details. |
| 8 | */ | 8 | */ |
| @@ -426,6 +426,17 @@ enum { · 425 unmodified lines | |||
| 426 | MLX4_MAX_FAST_REG_PAGES = 511, | 426 | MLX4_MAX_FAST_REG_PAGES = 511, |
| 427 | }; | 427 | }; |
| 428 | 428 | ||
| 429 | enum { | ||
| 430 | /* | ||
| 431 | * Max wqe size for rdma read is 512 bytes, so this | ||
| 432 | * limits our max_sge_rd as the wqe needs to fit: | ||
| 433 | * - ctrl segment (16 bytes) | ||
| 434 | * - rdma segment (16 bytes) | ||
| 435 | * - scatter elements (16 bytes each) | ||
| 436 | */ | ||
| 437 | MLX4_MAX_SGE_RD = (512 - 16 - 16) / 16 | ||
| 438 | }; | ||
| 439 | |||
| 429 | enum { | 440 | enum { |
| 430 | MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, | 441 | MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, |
| 431 | MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, | 442 | MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, |
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef LINUX_MM_DEBUG_H | 1 | #ifndef LINUX_MM_DEBUG_H |
| 2 | #define LINUX_MM_DEBUG_H 1 | 2 | #define LINUX_MM_DEBUG_H 1 |
| 3 | 3 | ||
| 4 | #include <linux/bug.h> | ||
| 4 | #include <linux/stringify.h> | 5 | #include <linux/stringify.h> |
| 5 | 6 | ||
| 6 | struct page; | 7 | struct page; |
| @@ -2084,7 +2084,7 @@ struct pcpu_sw_netstats { · 2083 unmodified lines | |||
| 2084 | }) | 2084 | }) |
| 2085 | 2085 | ||
| 2086 | #define netdev_alloc_pcpu_stats(type) \ | 2086 | #define netdev_alloc_pcpu_stats(type) \ |
| 2087 | __netdev_alloc_pcpu_stats(type, GFP_KERNEL); | 2087 | __netdev_alloc_pcpu_stats(type, GFP_KERNEL) |
| 2088 | 2088 | ||
| 2089 | #include <linux/notifier.h> | 2089 | #include <linux/notifier.h> |
| 2090 | 2090 | ||
| @@ -14,7 +14,7 @@ struct nfnl_callback { · 13 unmodified lines | |||
| 14 | int (*call_rcu)(struct sock *nl, struct sk_buff *skb, | 14 | int (*call_rcu)(struct sock *nl, struct sk_buff *skb, |
| 15 | const struct nlmsghdr *nlh, | 15 | const struct nlmsghdr *nlh, |
| 16 | const struct nlattr * const cda[]); | 16 | const struct nlattr * const cda[]); |
| 17 | int (*call_batch)(struct sock *nl, struct sk_buff *skb, | 17 | int (*call_batch)(struct net *net, struct sock *nl, struct sk_buff *skb, |
| 18 | const struct nlmsghdr *nlh, | 18 | const struct nlmsghdr *nlh, |
| 19 | const struct nlattr * const cda[]); | 19 | const struct nlattr * const cda[]); |
| 20 | const struct nla_policy *policy; /* netlink attribute policy */ | 20 | const struct nla_policy *policy; /* netlink attribute policy */ |
| @@ -46,12 +46,14 @@ extern int of_irq_get(struct device_node *dev, int index); · 45 unmodified lines | |||
| 46 | extern int of_irq_get_byname(struct device_node *dev, const char *name); | 46 | extern int of_irq_get_byname(struct device_node *dev, const char *name); |
| 47 | extern int of_irq_to_resource_table(struct device_node *dev, | 47 | extern int of_irq_to_resource_table(struct device_node *dev, |
| 48 | struct resource *res, int nr_irqs); | 48 | struct resource *res, int nr_irqs); |
| 49 | extern struct device_node *of_irq_find_parent(struct device_node *child); | ||
| 49 | extern struct irq_domain *of_msi_get_domain(struct device *dev, | 50 | extern struct irq_domain *of_msi_get_domain(struct device *dev, |
| 50 | struct device_node *np, | 51 | struct device_node *np, |
| 51 | enum irq_domain_bus_token token); | 52 | enum irq_domain_bus_token token); |
| 52 | extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev, | 53 | extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev, |
| 53 | u32 rid); | 54 | u32 rid); |
| 54 | extern void of_msi_configure(struct device *dev, struct device_node *np); | 55 | extern void of_msi_configure(struct device *dev, struct device_node *np); |
| 56 | u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in); | ||
| 55 | #else | 57 | #else |
| 56 | static inline int of_irq_count(struct device_node *dev) | 58 | static inline int of_irq_count(struct device_node *dev) |
| 57 | { | 59 | { |
| @@ -70,6 +72,11 @@ static inline int of_irq_to_resource_table(struct device_node *dev, · 12 unmodified lines | |||
| 70 | { | 72 | { |
| 71 | return 0; | 73 | return 0; |
| 72 | } | 74 | } |
| 75 | static inline void *of_irq_find_parent(struct device_node *child) | ||
| 76 | { | ||
| 77 | return NULL; | ||
| 78 | } | ||
| 79 | |||
| 73 | static inline struct irq_domain *of_msi_get_domain(struct device *dev, | 80 | static inline struct irq_domain *of_msi_get_domain(struct device *dev, |
| 74 | struct device_node *np, | 81 | struct device_node *np, |
| 75 | enum irq_domain_bus_token token) | 82 | enum irq_domain_bus_token token) |
| @@ -84,6 +91,11 @@ static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev · 8 unmodified lines | |||
| 84 | static inline void of_msi_configure(struct device *dev, struct device_node *np) | 91 | static inline void of_msi_configure(struct device *dev, struct device_node *np) |
| 85 | { | 92 | { |
| 86 | } | 93 | } |
| 94 | static inline u32 of_msi_map_rid(struct device *dev, | ||
| 95 | struct device_node *msi_np, u32 rid_in) | ||
| 96 | { | ||
| 97 | return rid_in; | ||
| 98 | } | ||
| 87 | #endif | 99 | #endif |
| 88 | 100 | ||
| 89 | #if defined(CONFIG_OF_IRQ) || defined(CONFIG_SPARC) | 101 | #if defined(CONFIG_OF_IRQ) || defined(CONFIG_SPARC) |
| @@ -93,7 +105,6 @@ static inline void of_msi_configure(struct device *dev, struct device_node *np) · 3 unmodified lines | |||
| 93 | * so declare it here regardless of the CONFIG_OF_IRQ setting. | 105 | * so declare it here regardless of the CONFIG_OF_IRQ setting. |
| 94 | */ | 106 | */ |
| 95 | extern unsigned int irq_of_parse_and_map(struct device_node *node, int index); | 107 | extern unsigned int irq_of_parse_and_map(struct device_node *node, int index); |
| 96 | u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in); | ||
| 97 | 108 | ||
| 98 | #else /* !CONFIG_OF && !CONFIG_SPARC */ | 109 | #else /* !CONFIG_OF && !CONFIG_SPARC */ |
| 99 | static inline unsigned int irq_of_parse_and_map(struct device_node *dev, | 110 | static inline unsigned int irq_of_parse_and_map(struct device_node *dev, |
| @@ -101,12 +112,6 @@ static inline unsigned int irq_of_parse_and_map(struct device_node *dev, · 1 unmodified line | |||
| 101 | { | 112 | { |
| 102 | return 0; | 113 | return 0; |
| 103 | } | 114 | } |
| 104 | |||
| 105 | static inline u32 of_msi_map_rid(struct device *dev, | ||
| 106 | struct device_node *msi_np, u32 rid_in) | ||
| 107 | { | ||
| 108 | return rid_in; | ||
| 109 | } | ||
| 110 | #endif /* !CONFIG_OF */ | 115 | #endif /* !CONFIG_OF */ |
| 111 | 116 | ||
| 112 | #endif /* __OF_IRQ_H */ | 117 | #endif /* __OF_IRQ_H */ |
| @@ -697,9 +697,11 @@ struct perf_cgroup { · 696 unmodified lines | |||
| 697 | * if there is no cgroup event for the current CPU context. | 697 | * if there is no cgroup event for the current CPU context. |
| 698 | */ | 698 | */ |
| 699 | static inline struct perf_cgroup * | 699 | static inline struct perf_cgroup * |
| 700 | perf_cgroup_from_task(struct task_struct *task) | 700 | perf_cgroup_from_task(struct task_struct *task, struct perf_event_context *ctx) |
| 701 | { | 701 | { |
| 702 | return container_of(task_css(task, perf_event_cgrp_id), | 702 | return container_of(task_css_check(task, perf_event_cgrp_id, |
| 703 | ctx ? lockdep_is_held(&ctx->lock) | ||
| 704 | : true), | ||
| 703 | struct perf_cgroup, css); | 705 | struct perf_cgroup, css); |
| 704 | } | 706 | } |
| 705 | #endif /* CONFIG_CGROUP_PERF */ | 707 | #endif /* CONFIG_CGROUP_PERF */ |
| @@ -72,7 +72,7 @@ struct edma_soc_info { · 71 unmodified lines | |||
| 72 | struct edma_rsv_info *rsv; | 72 | struct edma_rsv_info *rsv; |
| 73 | 73 | ||
| 74 | /* List of channels allocated for memcpy, terminated with -1 */ | 74 | /* List of channels allocated for memcpy, terminated with -1 */ |
| 75 | s16 *memcpy_channels; | 75 | s32 *memcpy_channels; |
| 76 | 76 | ||
| 77 | s8 (*queue_priority_mapping)[2]; | 77 | s8 (*queue_priority_mapping)[2]; |
| 78 | const s16 (*xbar_chans)[2]; | 78 | const s16 (*xbar_chans)[2]; |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * FLoating proportions | 2 | * FLoating proportions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 5 | * | 5 | * |
| 6 | * This file contains the public data structure and API definitions. | 6 | * This file contains the public data structure and API definitions. |
| 7 | */ | 7 | */ |
| @@ -9,6 +9,8 @@ · 8 unmodified lines | |||
| 9 | #ifndef __COMMON_HSI__ | 9 | #ifndef __COMMON_HSI__ |
| 10 | #define __COMMON_HSI__ | 10 | #define __COMMON_HSI__ |
| 11 | 11 | ||
| 12 | #define CORE_SPQE_PAGE_SIZE_BYTES 4096 | ||
| 13 | |||
| 12 | #define FW_MAJOR_VERSION 8 | 14 | #define FW_MAJOR_VERSION 8 |
| 13 | #define FW_MINOR_VERSION 4 | 15 | #define FW_MINOR_VERSION 4 |
| 14 | #define FW_REVISION_VERSION 2 | 16 | #define FW_REVISION_VERSION 2 |
| @@ -111,7 +111,8 @@ static inline u16 qed_chain_get_elem_left(struct qed_chain *p_chain) · 110 unmodified lines | |||
| 111 | used = ((u32)0x10000u + (u32)(p_chain->prod_idx)) - | 111 | used = ((u32)0x10000u + (u32)(p_chain->prod_idx)) - |
| 112 | (u32)p_chain->cons_idx; | 112 | (u32)p_chain->cons_idx; |
| 113 | if (p_chain->mode == QED_CHAIN_MODE_NEXT_PTR) | 113 | if (p_chain->mode == QED_CHAIN_MODE_NEXT_PTR) |
| 114 | used -= (used / p_chain->elem_per_page); | 114 | used -= p_chain->prod_idx / p_chain->elem_per_page - |
| 115 | p_chain->cons_idx / p_chain->elem_per_page; | ||
| 115 | 116 | ||
| 116 | return p_chain->capacity - used; | 117 | return p_chain->capacity - used; |
| 117 | } | 118 | } |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | #include <linux/atomic.h> | 20 | #include <linux/atomic.h> |
| 21 | #include <linux/compiler.h> | 21 | #include <linux/compiler.h> |
| 22 | #include <linux/err.h> | ||
| 22 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
| 23 | #include <linux/jhash.h> | 24 | #include <linux/jhash.h> |
| 24 | #include <linux/list_nulls.h> | 25 | #include <linux/list_nulls.h> |
| @@ -339,10 +340,11 @@ static inline int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, · 314 unmodified lines | |||
| 339 | int rhashtable_init(struct rhashtable *ht, | 340 | int rhashtable_init(struct rhashtable *ht, |
| 340 | const struct rhashtable_params *params); | 341 | const struct rhashtable_params *params); |
| 341 | 342 | ||
| 342 | int rhashtable_insert_slow(struct rhashtable *ht, const void *key, | 343 | struct bucket_table *rhashtable_insert_slow(struct rhashtable *ht, |
| 343 | struct rhash_head *obj, | 344 | const void *key, |
| 344 | struct bucket_table *old_tbl); | 345 | struct rhash_head *obj, |
| 345 | int rhashtable_insert_rehash(struct rhashtable *ht); | 346 | struct bucket_table *old_tbl); |
| 347 | int rhashtable_insert_rehash(struct rhashtable *ht, struct bucket_table *tbl); | ||
| 346 | 348 | ||
| 347 | int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter); | 349 | int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter); |
| 348 | void rhashtable_walk_exit(struct rhashtable_iter *iter); | 350 | void rhashtable_walk_exit(struct rhashtable_iter *iter); |
| @@ -598,9 +600,11 @@ restart: · 249 unmodified lines | |||
| 598 | 600 | ||
| 599 | new_tbl = rht_dereference_rcu(tbl->future_tbl, ht); | 601 | new_tbl = rht_dereference_rcu(tbl->future_tbl, ht); |
| 600 | if (unlikely(new_tbl)) { | 602 | if (unlikely(new_tbl)) { |
| 601 | err = rhashtable_insert_slow(ht, key, obj, new_tbl); | 603 | tbl = rhashtable_insert_slow(ht, key, obj, new_tbl); |
| 602 | if (err == -EAGAIN) | 604 | if (!IS_ERR_OR_NULL(tbl)) |
| 603 | goto slow_path; | 605 | goto slow_path; |
| 606 | |||
| 607 | err = PTR_ERR(tbl); | ||
| 604 | goto out; | 608 | goto out; |
| 605 | } | 609 | } |
| 606 | 610 | ||
| @@ -611,7 +615,7 @@ restart: · 4 unmodified lines | |||
| 611 | if (unlikely(rht_grow_above_100(ht, tbl))) { | 615 | if (unlikely(rht_grow_above_100(ht, tbl))) { |
| 612 | slow_path: | 616 | slow_path: |
| 613 | spin_unlock_bh(lock); | 617 | spin_unlock_bh(lock); |
| 614 | err = rhashtable_insert_rehash(ht); | 618 | err = rhashtable_insert_rehash(ht, tbl); |
| 615 | rcu_read_unlock(); | 619 | rcu_read_unlock(); |
| 616 | if (err) | 620 | if (err) |
| 617 | return err; | 621 | return err; |
| @@ -99,7 +99,7 @@ static inline int try_stop_cpus(const struct cpumask *cpumask, · 98 unmodified lines | |||
| 99 | * grabbing every spinlock (and more). So the "read" side to such a | 99 | * grabbing every spinlock (and more). So the "read" side to such a |
| 100 | * lock is anything which disables preemption. | 100 | * lock is anything which disables preemption. |
| 101 | */ | 101 | */ |
| 102 | #if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) | 102 | #if defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU) |
| 103 | 103 | ||
| 104 | /** | 104 | /** |
| 105 | * stop_machine: freeze the machine on all CPUs and run this function | 105 | * stop_machine: freeze the machine on all CPUs and run this function |
| @@ -118,7 +118,7 @@ int stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus); · 12 unmodified lines | |||
| 118 | 118 | ||
| 119 | int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, | 119 | int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, |
| 120 | const struct cpumask *cpus); | 120 | const struct cpumask *cpus); |
| 121 | #else /* CONFIG_STOP_MACHINE && CONFIG_SMP */ | 121 | #else /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */ |
| 122 | 122 | ||
| 123 | static inline int stop_machine(cpu_stop_fn_t fn, void *data, | 123 | static inline int stop_machine(cpu_stop_fn_t fn, void *data, |
| 124 | const struct cpumask *cpus) | 124 | const struct cpumask *cpus) |
| @@ -137,5 +137,5 @@ static inline int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, · 12 unmodified lines | |||
| 137 | return stop_machine(fn, data, cpus); | 137 | return stop_machine(fn, data, cpus); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | #endif /* CONFIG_STOP_MACHINE && CONFIG_SMP */ | 140 | #endif /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */ |
| 141 | #endif /* _LINUX_STOP_MACHINE */ | 141 | #endif /* _LINUX_STOP_MACHINE */ |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | * Authors: | 21 | * Authors: |
| 22 | * Srikar Dronamraju | 22 | * Srikar Dronamraju |
| 23 | * Jim Keniston | 23 | * Jim Keniston |
| 24 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 24 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
| @@ -47,4 +47,7 @@ · 46 unmodified lines | |||
| 47 | /* device generates spurious wakeup, ignore remote wakeup capability */ | 47 | /* device generates spurious wakeup, ignore remote wakeup capability */ |
| 48 | #define USB_QUIRK_IGNORE_REMOTE_WAKEUP BIT(9) | 48 | #define USB_QUIRK_IGNORE_REMOTE_WAKEUP BIT(9) |
| 49 | 49 | ||
| 50 | /* device can't handle Link Power Management */ | ||
| 51 | #define USB_QUIRK_NO_LPM BIT(10) | ||
| 52 | |||
| 50 | #endif /* __LINUX_USB_QUIRKS_H */ | 53 | #endif /* __LINUX_USB_QUIRKS_H */ |
| @@ -44,9 +44,6 @@ struct vfio_device_ops { · 43 unmodified lines | |||
| 44 | void (*request)(void *device_data, unsigned int count); | 44 | void (*request)(void *device_data, unsigned int count); |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | extern struct iommu_group *vfio_iommu_group_get(struct device *dev); | ||
| 48 | extern void vfio_iommu_group_put(struct iommu_group *group, struct device *dev); | ||
| 49 | |||
| 50 | extern int vfio_add_group_dev(struct device *dev, | 47 | extern int vfio_add_group_dev(struct device *dev, |
| 51 | const struct vfio_device_ops *ops, | 48 | const struct vfio_device_ops *ops, |
| 52 | void *device_data); | 49 | void *device_data); |
| @@ -145,7 +145,7 @@ __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old) · 144 unmodified lines | |||
| 145 | list_del(&old->task_list); | 145 | list_del(&old->task_list); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | typedef int wait_bit_action_f(struct wait_bit_key *); | 148 | typedef int wait_bit_action_f(struct wait_bit_key *, int mode); |
| 149 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | 149 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
| 150 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); | 150 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); |
| 151 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | 151 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
| @@ -960,10 +960,10 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); · 808 unmodified lines | |||
| 960 | } while (0) | 960 | } while (0) |
| 961 | 961 | ||
| 962 | 962 | ||
| 963 | extern int bit_wait(struct wait_bit_key *); | 963 | extern int bit_wait(struct wait_bit_key *, int); |
| 964 | extern int bit_wait_io(struct wait_bit_key *); | 964 | extern int bit_wait_io(struct wait_bit_key *, int); |
| 965 | extern int bit_wait_timeout(struct wait_bit_key *); | 965 | extern int bit_wait_timeout(struct wait_bit_key *, int); |
| 966 | extern int bit_wait_io_timeout(struct wait_bit_key *); | 966 | extern int bit_wait_io_timeout(struct wait_bit_key *, int); |
| 967 | 967 | ||
| 968 | /** | 968 | /** |
| 969 | * wait_on_bit - wait for a bit to be cleared | 969 | * wait_on_bit - wait for a bit to be cleared |
| @@ -322,6 +322,39 @@ static inline void skb_dst_force(struct sk_buff *skb) · 321 unmodified lines | |||
| 322 | } | 322 | } |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | /** | ||
| 326 | * dst_hold_safe - Take a reference on a dst if possible | ||
| 327 | * @dst: pointer to dst entry | ||
| 328 | * | ||
| 329 | * This helper returns false if it could not safely | ||
| 330 | * take a reference on a dst. | ||
| 331 | */ | ||
| 332 | static inline bool dst_hold_safe(struct dst_entry *dst) | ||
| 333 | { | ||
| 334 | if (dst->flags & DST_NOCACHE) | ||
| 335 | return atomic_inc_not_zero(&dst->__refcnt); | ||
| 336 | dst_hold(dst); | ||
| 337 | return true; | ||
| 338 | } | ||
| 339 | |||
| 340 | /** | ||
| 341 | * skb_dst_force_safe - makes sure skb dst is refcounted | ||
| 342 | * @skb: buffer | ||
| 343 | * | ||
| 344 | * If dst is not yet refcounted and not destroyed, grab a ref on it. | ||
| 345 | */ | ||
| 346 | static inline void skb_dst_force_safe(struct sk_buff *skb) | ||
| 347 | { | ||
| 348 | if (skb_dst_is_noref(skb)) { | ||
| 349 | struct dst_entry *dst = skb_dst(skb); | ||
| 350 | |||
| 351 | if (!dst_hold_safe(dst)) | ||
| 352 | dst = NULL; | ||
| 353 | |||
| 354 | skb->_skb_refdst = (unsigned long)dst; | ||
| 355 | } | ||
| 356 | } | ||
| 357 | |||
| 325 | 358 | ||
| 326 | /** | 359 | /** |
| 327 | * __skb_tunnel_rx - prepare skb for rx reinsert | 360 | * __skb_tunnel_rx - prepare skb for rx reinsert |
| @@ -210,18 +210,37 @@ struct inet_sock { · 209 unmodified lines | |||
| 210 | #define IP_CMSG_ORIGDSTADDR BIT(6) | 210 | #define IP_CMSG_ORIGDSTADDR BIT(6) |
| 211 | #define IP_CMSG_CHECKSUM BIT(7) | 211 | #define IP_CMSG_CHECKSUM BIT(7) |
| 212 | 212 | ||
| 213 | /* SYNACK messages might be attached to request sockets. | 213 | /** |
| 214 | * sk_to_full_sk - Access to a full socket | ||
| 215 | * @sk: pointer to a socket | ||
| 216 | * | ||
| 217 | * SYNACK messages might be attached to request sockets. | ||
| 214 | * Some places want to reach the listener in this case. | 218 | * Some places want to reach the listener in this case. |
| 215 | */ | 219 | */ |
| 216 | static inline struct sock *skb_to_full_sk(const struct sk_buff *skb) | 220 | static inline struct sock *sk_to_full_sk(struct sock *sk) |
| 217 | { | 221 | { |
| 218 | struct sock *sk = skb->sk; | 222 | #ifdef CONFIG_INET |
| 219 | |||
| 220 | if (sk && sk->sk_state == TCP_NEW_SYN_RECV) | 223 | if (sk && sk->sk_state == TCP_NEW_SYN_RECV) |
| 221 | sk = inet_reqsk(sk)->rsk_listener; | 224 | sk = inet_reqsk(sk)->rsk_listener; |
| 225 | #endif | ||
| 226 | return sk; | ||
| 227 | } | ||
| 228 | |||
| 229 | /* sk_to_full_sk() variant with a const argument */ | ||
| 230 | static inline const struct sock *sk_const_to_full_sk(const struct sock *sk) | ||
| 231 | { | ||
| 232 | #ifdef CONFIG_INET | ||
| 233 | if (sk && sk->sk_state == TCP_NEW_SYN_RECV) | ||
| 234 | sk = ((const struct request_sock *)sk)->rsk_listener; | ||
| 235 | #endif | ||
| 222 | return sk; | 236 | return sk; |
| 223 | } | 237 | } |
| 224 | 238 | ||
| 239 | static inline struct sock *skb_to_full_sk(const struct sk_buff *skb) | ||
| 240 | { | ||
| 241 | return sk_to_full_sk(skb->sk); | ||
| 242 | } | ||
| 243 | |||
| 225 | static inline struct inet_sock *inet_sk(const struct sock *sk) | 244 | static inline struct inet_sock *inet_sk(const struct sock *sk) |
| 226 | { | 245 | { |
| 227 | return (struct inet_sock *)sk; | 246 | return (struct inet_sock *)sk; |
| @@ -78,6 +78,7 @@ void inet_initpeers(void) __init; · 77 unmodified lines | |||
| 78 | static inline void inetpeer_set_addr_v4(struct inetpeer_addr *iaddr, __be32 ip) | 78 | static inline void inetpeer_set_addr_v4(struct inetpeer_addr *iaddr, __be32 ip) |
| 79 | { | 79 | { |
| 80 | iaddr->a4.addr = ip; | 80 | iaddr->a4.addr = ip; |
| 81 | iaddr->a4.vif = 0; | ||
| 81 | iaddr->family = AF_INET; | 82 | iaddr->family = AF_INET; |
| 82 | } | 83 | } |
| 83 | 84 | ||
| @@ -1493,7 +1493,8 @@ struct sctp_association { · 1492 unmodified lines | |||
| 1493 | * : SACK's are not delayed (see Section 6). | 1493 | * : SACK's are not delayed (see Section 6). |
| 1494 | */ | 1494 | */ |
| 1495 | __u8 sack_needed:1, /* Do we need to sack the peer? */ | 1495 | __u8 sack_needed:1, /* Do we need to sack the peer? */ |
| 1496 | sack_generation:1; | 1496 | sack_generation:1, |
| 1497 | zero_window_announced:1; | ||
| 1497 | __u32 sack_cnt; | 1498 | __u32 sack_cnt; |
| 1498 | 1499 | ||
| 1499 | __u32 adaptation_ind; /* Adaptation Code point. */ | 1500 | __u32 adaptation_ind; /* Adaptation Code point. */ |
| @@ -388,7 +388,7 @@ struct sock { · 387 unmodified lines | |||
| 388 | struct socket_wq *sk_wq_raw; | 388 | struct socket_wq *sk_wq_raw; |
| 389 | }; | 389 | }; |
| 390 | #ifdef CONFIG_XFRM | 390 | #ifdef CONFIG_XFRM |
| 391 | struct xfrm_policy *sk_policy[2]; | 391 | struct xfrm_policy __rcu *sk_policy[2]; |
| 392 | #endif | 392 | #endif |
| 393 | struct dst_entry *sk_rx_dst; | 393 | struct dst_entry *sk_rx_dst; |
| 394 | struct dst_entry __rcu *sk_dst_cache; | 394 | struct dst_entry __rcu *sk_dst_cache; |
| @@ -404,6 +404,7 @@ struct sock { · 9 unmodified lines | |||
| 404 | sk_userlocks : 4, | 404 | sk_userlocks : 4, |
| 405 | sk_protocol : 8, | 405 | sk_protocol : 8, |
| 406 | sk_type : 16; | 406 | sk_type : 16; |
| 407 | #define SK_PROTOCOL_MAX U8_MAX | ||
| 407 | kmemcheck_bitfield_end(flags); | 408 | kmemcheck_bitfield_end(flags); |
| 408 | int sk_wmem_queued; | 409 | int sk_wmem_queued; |
| 409 | gfp_t sk_allocation; | 410 | gfp_t sk_allocation; |
| @@ -740,6 +741,8 @@ enum sock_flags { · 330 unmodified lines | |||
| 740 | SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */ | 741 | SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */ |
| 741 | }; | 742 | }; |
| 742 | 743 | ||
| 744 | #define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE)) | ||
| 745 | |||
| 743 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) | 746 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) |
| 744 | { | 747 | { |
| 745 | nsk->sk_flags = osk->sk_flags; | 748 | nsk->sk_flags = osk->sk_flags; |
| @@ -814,7 +817,7 @@ void sk_stream_write_space(struct sock *sk); · 68 unmodified lines | |||
| 814 | static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) | 817 | static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) |
| 815 | { | 818 | { |
| 816 | /* dont let skb dst not refcounted, we are going to leave rcu lock */ | 819 | /* dont let skb dst not refcounted, we are going to leave rcu lock */ |
| 817 | skb_dst_force(skb); | 820 | skb_dst_force_safe(skb); |
| 818 | 821 | ||
| 819 | if (!sk->sk_backlog.tail) | 822 | if (!sk->sk_backlog.tail) |
| 820 | sk->sk_backlog.head = skb; | 823 | sk->sk_backlog.head = skb; |
| @@ -79,7 +79,7 @@ struct vxlanhdr { · 78 unmodified lines | |||
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | /* VXLAN header flags. */ | 81 | /* VXLAN header flags. */ |
| 82 | #define VXLAN_HF_RCO BIT(24) | 82 | #define VXLAN_HF_RCO BIT(21) |
| 83 | #define VXLAN_HF_VNI BIT(27) | 83 | #define VXLAN_HF_VNI BIT(27) |
| 84 | #define VXLAN_HF_GBP BIT(31) | 84 | #define VXLAN_HF_GBP BIT(31) |
| 85 | 85 | ||
| @@ -548,6 +548,7 @@ struct xfrm_policy { · 547 unmodified lines | |||
| 548 | u16 family; | 548 | u16 family; |
| 549 | struct xfrm_sec_ctx *security; | 549 | struct xfrm_sec_ctx *security; |
| 550 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; | 550 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; |
| 551 | struct rcu_head rcu; | ||
| 551 | }; | 552 | }; |
| 552 | 553 | ||
| 553 | static inline struct net *xp_net(const struct xfrm_policy *xp) | 554 | static inline struct net *xp_net(const struct xfrm_policy *xp) |
| @@ -1141,12 +1142,14 @@ static inline int xfrm6_route_forward(struct sk_buff *skb) · 587 unmodified lines | |||
| 1141 | return xfrm_route_forward(skb, AF_INET6); | 1142 | return xfrm_route_forward(skb, AF_INET6); |
| 1142 | } | 1143 | } |
| 1143 | 1144 | ||
| 1144 | int __xfrm_sk_clone_policy(struct sock *sk); | 1145 | int __xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk); |
| 1145 | 1146 | ||
| 1146 | static inline int xfrm_sk_clone_policy(struct sock *sk) | 1147 | static inline int xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk) |
| 1147 | { | 1148 | { |
| 1148 | if (unlikely(sk->sk_policy[0] || sk->sk_policy[1])) | 1149 | sk->sk_policy[0] = NULL; |
| 1149 | return __xfrm_sk_clone_policy(sk); | 1150 | sk->sk_policy[1] = NULL; |
| 1151 | if (unlikely(osk->sk_policy[0] || osk->sk_policy[1])) | ||
| 1152 | return __xfrm_sk_clone_policy(sk, osk); | ||
| 1150 | return 0; | 1153 | return 0; |
| 1151 | } | 1154 | } |
| 1152 | 1155 | ||
| @@ -1154,12 +1157,16 @@ int xfrm_policy_delete(struct xfrm_policy *pol, int dir); · 1 unmodified line | |||
| 1154 | 1157 | ||
| 1155 | static inline void xfrm_sk_free_policy(struct sock *sk) | 1158 | static inline void xfrm_sk_free_policy(struct sock *sk) |
| 1156 | { | 1159 | { |
| 1157 | if (unlikely(sk->sk_policy[0] != NULL)) { | 1160 | struct xfrm_policy *pol; |
| 1158 | xfrm_policy_delete(sk->sk_policy[0], XFRM_POLICY_MAX); | 1161 | |
| 1162 | pol = rcu_dereference_protected(sk->sk_policy[0], 1); | ||
| 1163 | if (unlikely(pol != NULL)) { | ||
| 1164 | xfrm_policy_delete(pol, XFRM_POLICY_MAX); | ||
| 1159 | sk->sk_policy[0] = NULL; | 1165 | sk->sk_policy[0] = NULL; |
| 1160 | } | 1166 | } |
| 1161 | if (unlikely(sk->sk_policy[1] != NULL)) { | 1167 | pol = rcu_dereference_protected(sk->sk_policy[1], 1); |
| 1162 | xfrm_policy_delete(sk->sk_policy[1], XFRM_POLICY_MAX+1); | 1168 | if (unlikely(pol != NULL)) { |
| 1169 | xfrm_policy_delete(pol, XFRM_POLICY_MAX+1); | ||
| 1163 | sk->sk_policy[1] = NULL; | 1170 | sk->sk_policy[1] = NULL; |
| 1164 | } | 1171 | } |
| 1165 | } | 1172 | } |
| @@ -1169,7 +1176,7 @@ void xfrm_garbage_collect(struct net *net); · 3 unmodified lines | |||
| 1169 | #else | 1176 | #else |
| 1170 | 1177 | ||
| 1171 | static inline void xfrm_sk_free_policy(struct sock *sk) {} | 1178 | static inline void xfrm_sk_free_policy(struct sock *sk) {} |
| 1172 | static inline int xfrm_sk_clone_policy(struct sock *sk) { return 0; } | 1179 | static inline int xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk) { return 0; } |
| 1173 | static inline int xfrm6_route_forward(struct sk_buff *skb) { return 1; } | 1180 | static inline int xfrm6_route_forward(struct sk_buff *skb) { return 1; } |
| 1174 | static inline int xfrm4_route_forward(struct sk_buff *skb) { return 1; } | 1181 | static inline int xfrm4_route_forward(struct sk_buff *skb) { return 1; } |
| 1175 | static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *skb) | 1182 | static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *skb) |
| @@ -237,6 +237,8 @@ struct ib_vendor_mad { · 236 unmodified lines | |||
| 237 | u8 data[IB_MGMT_VENDOR_DATA]; | 237 | u8 data[IB_MGMT_VENDOR_DATA]; |
| 238 | }; | 238 | }; |
| 239 | 239 | ||
| 240 | #define IB_MGMT_CLASSPORTINFO_ATTR_ID cpu_to_be16(0x0001) | ||
| 241 | |||
| 240 | struct ib_class_port_info { | 242 | struct ib_class_port_info { |
| 241 | u8 base_version; | 243 | u8 base_version; |
| 242 | u8 class_version; | 244 | u8 class_version; |
| @@ -1271,6 +1271,7 @@ struct ib_uobject { · 1270 unmodified lines | |||
| 1271 | int id; /* index into kernel idr */ | 1271 | int id; /* index into kernel idr */ |
| 1272 | struct kref ref; | 1272 | struct kref ref; |
| 1273 | struct rw_semaphore mutex; /* protects .live */ | 1273 | struct rw_semaphore mutex; /* protects .live */ |
| 1274 | struct rcu_head rcu; /* kfree_rcu() overhead */ | ||
| 1274 | int live; | 1275 | int live; |
| 1275 | }; | 1276 | }; |
| 1276 | 1277 | ||
| @@ -93,6 +93,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; · 92 unmodified lines | |||
| 93 | #define AZX_REG_HSW_EM4 0x100c | 93 | #define AZX_REG_HSW_EM4 0x100c |
| 94 | #define AZX_REG_HSW_EM5 0x1010 | 94 | #define AZX_REG_HSW_EM5 0x1010 |
| 95 | 95 | ||
| 96 | /* Skylake/Broxton display HD-A controller Extended Mode registers */ | ||
| 97 | #define AZX_REG_SKL_EM4L 0x1040 | ||
| 98 | |||
| 96 | /* PCI space */ | 99 | /* PCI space */ |
| 97 | #define AZX_PCIREG_TCSEL 0x44 | 100 | #define AZX_PCIREG_TCSEL 0x44 |
| 98 | 101 | ||
| @@ -186,6 +186,7 @@ header-y += if_tunnel.h · 185 unmodified lines | |||
| 186 | header-y += if_vlan.h | 186 | header-y += if_vlan.h |
| 187 | header-y += if_x25.h | 187 | header-y += if_x25.h |
| 188 | header-y += igmp.h | 188 | header-y += igmp.h |
| 189 | header-y += ila.h | ||
| 189 | header-y += in6.h | 190 | header-y += in6.h |
| 190 | header-y += inet_diag.h | 191 | header-y += inet_diag.h |
| 191 | header-y += in.h | 192 | header-y += in.h |
| @@ -628,7 +628,7 @@ struct ovs_action_hash { · 627 unmodified lines | |||
| 628 | * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the | 628 | * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the |
| 629 | * mask, the corresponding bit in the value is copied to the connection | 629 | * mask, the corresponding bit in the value is copied to the connection |
| 630 | * tracking mark field in the connection. | 630 | * tracking mark field in the connection. |
| 631 | * @OVS_CT_ATTR_LABEL: %OVS_CT_LABELS_LEN value followed by %OVS_CT_LABELS_LEN | 631 | * @OVS_CT_ATTR_LABELS: %OVS_CT_LABELS_LEN value followed by %OVS_CT_LABELS_LEN |
| 632 | * mask. For each bit set in the mask, the corresponding bit in the value is | 632 | * mask. For each bit set in the mask, the corresponding bit in the value is |
| 633 | * copied to the connection tracking label field in the connection. | 633 | * copied to the connection tracking label field in the connection. |
| 634 | * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG. | 634 | * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG. |
| @@ -38,13 +38,6 @@ · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | #define VFIO_SPAPR_TCE_v2_IOMMU 7 | 39 | #define VFIO_SPAPR_TCE_v2_IOMMU 7 |
| 40 | 40 | ||
| 41 | /* | ||
| 42 | * The No-IOMMU IOMMU offers no translation or isolation for devices and | ||
| 43 | * supports no ioctls outside of VFIO_CHECK_EXTENSION. Use of VFIO's No-IOMMU | ||
| 44 | * code will taint the host kernel and should be used with extreme caution. | ||
| 45 | */ | ||
| 46 | #define VFIO_NOIOMMU_IOMMU 8 | ||
| 47 | |||
| 48 | /* | 41 | /* |
| 49 | * The IOCTL interface is designed for extensibility by embedding the | 42 | * The IOCTL interface is designed for extensibility by embedding the |
| 50 | * structure length (argsz) and flags into structures passed between | 43 | * structure length (argsz) and flags into structures passed between |
| @@ -181,6 +181,20 @@ struct __name##_back_ring { \ · 180 unmodified lines | |||
| 181 | #define RING_GET_REQUEST(_r, _idx) \ | 181 | #define RING_GET_REQUEST(_r, _idx) \ |
| 182 | (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req)) | 182 | (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req)) |
| 183 | 183 | ||
| 184 | /* | ||
| 185 | * Get a local copy of a request. | ||
| 186 | * | ||
| 187 | * Use this in preference to RING_GET_REQUEST() so all processing is | ||
| 188 | * done on a local copy that cannot be modified by the other end. | ||
| 189 | * | ||
| 190 | * Note that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 may cause this | ||
| 191 | * to be ineffective where _req is a struct which consists of only bitfields. | ||
| 192 | */ | ||
| 193 | #define RING_COPY_REQUEST(_r, _idx, _req) do { \ | ||
| 194 | /* Use volatile to force the copy into _req. */ \ | ||
| 195 | *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \ | ||
| 196 | } while (0) | ||
| 197 | |||
| 184 | #define RING_GET_RESPONSE(_r, _idx) \ | 198 | #define RING_GET_RESPONSE(_r, _idx) \ |
| 185 | (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp)) | 199 | (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp)) |
| 186 | 200 | ||
| @@ -2030,13 +2030,6 @@ config INIT_ALL_POSSIBLE · 2029 unmodified lines | |||
| 2030 | it was better to provide this option than to break all the archs | 2030 | it was better to provide this option than to break all the archs |
| 2031 | and have several arch maintainers pursuing me down dark alleys. | 2031 | and have several arch maintainers pursuing me down dark alleys. |
| 2032 | 2032 | ||
| 2033 | config STOP_MACHINE | ||
| 2034 | bool | ||
| 2035 | default y | ||
| 2036 | depends on (SMP && MODULE_UNLOAD) || HOTPLUG_CPU | ||
| 2037 | help | ||
| 2038 | Need stop_machine() primitive. | ||
| 2039 | |||
| 2040 | source "block/Kconfig" | 2033 | source "block/Kconfig" |
| 2041 | 2034 | ||
| 2042 | config PREEMPT_NOTIFIERS | 2035 | config PREEMPT_NOTIFIERS |
| @@ -97,6 +97,12 @@ static DEFINE_SPINLOCK(css_set_lock); · 96 unmodified lines | |||
| 97 | */ | 97 | */ |
| 98 | static DEFINE_SPINLOCK(cgroup_idr_lock); | 98 | static DEFINE_SPINLOCK(cgroup_idr_lock); |
| 99 | 99 | ||
| 100 | /* | ||
| 101 | * Protects cgroup_file->kn for !self csses. It synchronizes notifications | ||
| 102 | * against file removal/re-creation across css hiding. | ||
| 103 | */ | ||
| 104 | static DEFINE_SPINLOCK(cgroup_file_kn_lock); | ||
| 105 | |||
| 100 | /* | 106 | /* |
| 101 | * Protects cgroup_subsys->release_agent_path. Modifying it also requires | 107 | * Protects cgroup_subsys->release_agent_path. Modifying it also requires |
| 102 | * cgroup_mutex. Reading requires either cgroup_mutex or this spinlock. | 108 | * cgroup_mutex. Reading requires either cgroup_mutex or this spinlock. |
| @@ -754,9 +760,11 @@ static void put_css_set_locked(struct css_set *cset) · 651 unmodified lines | |||
| 754 | if (!atomic_dec_and_test(&cset->refcount)) | 760 | if (!atomic_dec_and_test(&cset->refcount)) |
| 755 | return; | 761 | return; |
| 756 | 762 | ||
| 757 | /* This css_set is dead. unlink it and release cgroup refcounts */ | 763 | /* This css_set is dead. unlink it and release cgroup and css refs */ |
| 758 | for_each_subsys(ss, ssid) | 764 | for_each_subsys(ss, ssid) { |
| 759 | list_del(&cset->e_cset_node[ssid]); | 765 | list_del(&cset->e_cset_node[ssid]); |
| 766 | css_put(cset->subsys[ssid]); | ||
| 767 | } | ||
| 760 | hash_del(&cset->hlist); | 768 | hash_del(&cset->hlist); |
| 761 | css_set_count--; | 769 | css_set_count--; |
| 762 | 770 | ||
| @@ -1056,9 +1064,13 @@ static struct css_set *find_css_set(struct css_set *old_cset, · 293 unmodified lines | |||
| 1056 | key = css_set_hash(cset->subsys); | 1064 | key = css_set_hash(cset->subsys); |
| 1057 | hash_add(css_set_table, &cset->hlist, key); | 1065 | hash_add(css_set_table, &cset->hlist, key); |
| 1058 | 1066 | ||
| 1059 | for_each_subsys(ss, ssid) | 1067 | for_each_subsys(ss, ssid) { |
| 1068 | struct cgroup_subsys_state *css = cset->subsys[ssid]; | ||
| 1069 | |||
| 1060 | list_add_tail(&cset->e_cset_node[ssid], | 1070 | list_add_tail(&cset->e_cset_node[ssid], |
| 1061 | &cset->subsys[ssid]->cgroup->e_csets[ssid]); | 1071 | &css->cgroup->e_csets[ssid]); |
| 1072 | css_get(css); | ||
| 1073 | } | ||
| 1062 | 1074 | ||
| 1063 | spin_unlock_bh(&css_set_lock); | 1075 | spin_unlock_bh(&css_set_lock); |
| 1064 | 1076 | ||
| @@ -1393,6 +1405,16 @@ static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) · 328 unmodified lines | |||
| 1393 | char name[CGROUP_FILE_NAME_MAX]; | 1405 | char name[CGROUP_FILE_NAME_MAX]; |
| 1394 | 1406 | ||
| 1395 | lockdep_assert_held(&cgroup_mutex); | 1407 | lockdep_assert_held(&cgroup_mutex); |
| 1408 | |||
| 1409 | if (cft->file_offset) { | ||
| 1410 | struct cgroup_subsys_state *css = cgroup_css(cgrp, cft->ss); | ||
| 1411 | struct cgroup_file *cfile = (void *)css + cft->file_offset; | ||
| 1412 | |||
| 1413 | spin_lock_irq(&cgroup_file_kn_lock); | ||
| 1414 | cfile->kn = NULL; | ||
| 1415 | spin_unlock_irq(&cgroup_file_kn_lock); | ||
| 1416 | } | ||
| 1417 | |||
| 1396 | kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name)); | 1418 | kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name)); |
| 1397 | } | 1419 | } |
| 1398 | 1420 | ||
| @@ -1856,7 +1878,6 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp) · 457 unmodified lines | |||
| 1856 | 1878 | ||
| 1857 | INIT_LIST_HEAD(&cgrp->self.sibling); | 1879 | INIT_LIST_HEAD(&cgrp->self.sibling); |
| 1858 | INIT_LIST_HEAD(&cgrp->self.children); | 1880 | INIT_LIST_HEAD(&cgrp->self.children); |
| 1859 | INIT_LIST_HEAD(&cgrp->self.files); | ||
| 1860 | INIT_LIST_HEAD(&cgrp->cset_links); | 1881 | INIT_LIST_HEAD(&cgrp->cset_links); |
| 1861 | INIT_LIST_HEAD(&cgrp->pidlists); | 1882 | INIT_LIST_HEAD(&cgrp->pidlists); |
| 1862 | mutex_init(&cgrp->pidlist_mutex); | 1883 | mutex_init(&cgrp->pidlist_mutex); |
| @@ -2216,6 +2237,9 @@ struct cgroup_taskset { · 353 unmodified lines | |||
| 2216 | struct list_head src_csets; | 2237 | struct list_head src_csets; |
| 2217 | struct list_head dst_csets; | 2238 | struct list_head dst_csets; |
| 2218 | 2239 | ||
| 2240 | /* the subsys currently being processed */ | ||
| 2241 | int ssid; | ||
| 2242 | |||
| 2219 | /* | 2243 | /* |
| 2220 | * Fields for cgroup_taskset_*() iteration. | 2244 | * Fields for cgroup_taskset_*() iteration. |
| 2221 | * | 2245 | * |
| @@ -2278,25 +2302,29 @@ static void cgroup_taskset_add(struct task_struct *task, · 56 unmodified lines | |||
| 2278 | /** | 2302 | /** |
| 2279 | * cgroup_taskset_first - reset taskset and return the first task | 2303 | * cgroup_taskset_first - reset taskset and return the first task |
| 2280 | * @tset: taskset of interest | 2304 | * @tset: taskset of interest |
| 2305 | * @dst_cssp: output variable for the destination css | ||
| 2281 | * | 2306 | * |
| 2282 | * @tset iteration is initialized and the first task is returned. | 2307 | * @tset iteration is initialized and the first task is returned. |
| 2283 | */ | 2308 | */ |
| 2284 | struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset) | 2309 | struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset, |
| 2310 | struct cgroup_subsys_state **dst_cssp) | ||
| 2285 | { | 2311 | { |
| 2286 | tset->cur_cset = list_first_entry(tset->csets, struct css_set, mg_node); | 2312 | tset->cur_cset = list_first_entry(tset->csets, struct css_set, mg_node); |
| 2287 | tset->cur_task = NULL; | 2313 | tset->cur_task = NULL; |
| 2288 | 2314 | ||
| 2289 | return cgroup_taskset_next(tset); | 2315 | return cgroup_taskset_next(tset, dst_cssp); |
| 2290 | } | 2316 | } |
| 2291 | 2317 | ||
| 2292 | /** | 2318 | /** |
| 2293 | * cgroup_taskset_next - iterate to the next task in taskset | 2319 | * cgroup_taskset_next - iterate to the next task in taskset |
| 2294 | * @tset: taskset of interest | 2320 | * @tset: taskset of interest |
| 2321 | * @dst_cssp: output variable for the destination css | ||
| 2295 | * | 2322 | * |
| 2296 | * Return the next task in @tset. Iteration must have been initialized | 2323 | * Return the next task in @tset. Iteration must have been initialized |
| 2297 | * with cgroup_taskset_first(). | 2324 | * with cgroup_taskset_first(). |
| 2298 | */ | 2325 | */ |
| 2299 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset) | 2326 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset, |
| 2327 | struct cgroup_subsys_state **dst_cssp) | ||
| 2300 | { | 2328 | { |
| 2301 | struct css_set *cset = tset->cur_cset; | 2329 | struct css_set *cset = tset->cur_cset; |
| 2302 | struct task_struct *task = tset->cur_task; | 2330 | struct task_struct *task = tset->cur_task; |
| @@ -2311,6 +2339,18 @@ struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset) · 8 unmodified lines | |||
| 2311 | if (&task->cg_list != &cset->mg_tasks) { | 2339 | if (&task->cg_list != &cset->mg_tasks) { |
| 2312 | tset->cur_cset = cset; | 2340 | tset->cur_cset = cset; |
| 2313 | tset->cur_task = task; | 2341 | tset->cur_task = task; |
| 2342 | |||
| 2343 | /* | ||
| 2344 | * This function may be called both before and | ||
| 2345 | * after cgroup_taskset_migrate(). The two cases | ||
| 2346 | * can be distinguished by looking at whether @cset | ||
| 2347 | * has its ->mg_dst_cset set. | ||
| 2348 | */ | ||
| 2349 | if (cset->mg_dst_cset) | ||
| 2350 | *dst_cssp = cset->mg_dst_cset->subsys[tset->ssid]; | ||
| 2351 | else | ||
| 2352 | *dst_cssp = cset->subsys[tset->ssid]; | ||
| 2353 | |||
| 2314 | return task; | 2354 | return task; |
| 2315 | } | 2355 | } |
| 2316 | 2356 | ||
| @@ -2346,7 +2386,8 @@ static int cgroup_taskset_migrate(struct cgroup_taskset *tset, · 29 unmodified lines | |||
| 2346 | /* check that we can legitimately attach to the cgroup */ | 2386 | /* check that we can legitimately attach to the cgroup */ |
| 2347 | for_each_e_css(css, i, dst_cgrp) { | 2387 | for_each_e_css(css, i, dst_cgrp) { |
| 2348 | if (css->ss->can_attach) { | 2388 | if (css->ss->can_attach) { |
| 2349 | ret = css->ss->can_attach(css, tset); | 2389 | tset->ssid = i; |
| 2390 | ret = css->ss->can_attach(tset); | ||
| 2350 | if (ret) { | 2391 | if (ret) { |
| 2351 | failed_css = css; | 2392 | failed_css = css; |
| 2352 | goto out_cancel_attach; | 2393 | goto out_cancel_attach; |
| @@ -2379,9 +2420,12 @@ static int cgroup_taskset_migrate(struct cgroup_taskset *tset, · 26 unmodified lines | |||
| 2379 | */ | 2420 | */ |
| 2380 | tset->csets = &tset->dst_csets; | 2421 | tset->csets = &tset->dst_csets; |
| 2381 | 2422 | ||
| 2382 | for_each_e_css(css, i, dst_cgrp) | 2423 | for_each_e_css(css, i, dst_cgrp) { |
| 2383 | if (css->ss->attach) | 2424 | if (css->ss->attach) { |
| 2384 | css->ss->attach(css, tset); | 2425 | tset->ssid = i; |
| 2426 | css->ss->attach(tset); | ||
| 2427 | } | ||
| 2428 | } | ||
| 2385 | 2429 | ||
| 2386 | ret = 0; | 2430 | ret = 0; |
| 2387 | goto out_release_tset; | 2431 | goto out_release_tset; |
| @@ -2390,8 +2434,10 @@ out_cancel_attach: · 2 unmodified lines | |||
| 2390 | for_each_e_css(css, i, dst_cgrp) { | 2434 | for_each_e_css(css, i, dst_cgrp) { |
| 2391 | if (css == failed_css) | 2435 | if (css == failed_css) |
| 2392 | break; | 2436 | break; |
| 2393 | if (css->ss->cancel_attach) | 2437 | if (css->ss->cancel_attach) { |
| 2394 | css->ss->cancel_attach(css, tset); | 2438 | tset->ssid = i; |
| 2439 | css->ss->cancel_attach(tset); | ||
| 2440 | } | ||
| 2395 | } | 2441 | } |
| 2396 | out_release_tset: | 2442 | out_release_tset: |
| 2397 | spin_lock_bh(&css_set_lock); | 2443 | spin_lock_bh(&css_set_lock); |
| @@ -3313,9 +3359,9 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp, · 915 unmodified lines | |||
| 3313 | if (cft->file_offset) { | 3359 | if (cft->file_offset) { |
| 3314 | struct cgroup_file *cfile = (void *)css + cft->file_offset; | 3360 | struct cgroup_file *cfile = (void *)css + cft->file_offset; |
| 3315 | 3361 | ||
| 3316 | kernfs_get(kn); | 3362 | spin_lock_irq(&cgroup_file_kn_lock); |
| 3317 | cfile->kn = kn; | 3363 | cfile->kn = kn; |
| 3318 | list_add(&cfile->node, &css->files); | 3364 | spin_unlock_irq(&cgroup_file_kn_lock); |
| 3319 | } | 3365 | } |
| 3320 | 3366 | ||
| 3321 | return 0; | 3367 | return 0; |
| @@ -3552,6 +3598,22 @@ int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts) · 230 unmodified lines | |||
| 3552 | return cgroup_add_cftypes(ss, cfts); | 3598 | return cgroup_add_cftypes(ss, cfts); |
| 3553 | } | 3599 | } |
| 3554 | 3600 | ||
| 3601 | /** | ||
| 3602 | * cgroup_file_notify - generate a file modified event for a cgroup_file | ||
| 3603 | * @cfile: target cgroup_file | ||
| 3604 | * | ||
| 3605 | * @cfile must have been obtained by setting cftype->file_offset. | ||
| 3606 | */ | ||
| 3607 | void cgroup_file_notify(struct cgroup_file *cfile) | ||
| 3608 | { | ||
| 3609 | unsigned long flags; | ||
| 3610 | |||
| 3611 | spin_lock_irqsave(&cgroup_file_kn_lock, flags); | ||
| 3612 | if (cfile->kn) | ||
| 3613 | kernfs_notify(cfile->kn); | ||
| 3614 | spin_unlock_irqrestore(&cgroup_file_kn_lock, flags); | ||
| 3615 | } | ||
| 3616 | |||
| 3555 | /** | 3617 | /** |
| 3556 | * cgroup_task_count - count the number of tasks in a cgroup. | 3618 | * cgroup_task_count - count the number of tasks in a cgroup. |
| 3557 | * @cgrp: the cgroup in question | 3619 | * @cgrp: the cgroup in question |
| @@ -4613,13 +4675,9 @@ static void css_free_work_fn(struct work_struct *work) · 1055 unmodified lines | |||
| 4613 | container_of(work, struct cgroup_subsys_state, destroy_work); | 4675 | container_of(work, struct cgroup_subsys_state, destroy_work); |
| 4614 | struct cgroup_subsys *ss = css->ss; | 4676 | struct cgroup_subsys *ss = css->ss; |
| 4615 | struct cgroup *cgrp = css->cgroup; | 4677 | struct cgroup *cgrp = css->cgroup; |
| 4616 | struct cgroup_file *cfile; | ||
| 4617 | 4678 | ||
| 4618 | percpu_ref_exit(&css->refcnt); | 4679 | percpu_ref_exit(&css->refcnt); |
| 4619 | 4680 | ||
| 4620 | list_for_each_entry(cfile, &css->files, node) | ||
| 4621 | kernfs_put(cfile->kn); | ||
| 4622 | |||
| 4623 | if (ss) { | 4681 | if (ss) { |
| 4624 | /* css free path */ | 4682 | /* css free path */ |
| 4625 | int id = css->id; | 4683 | int id = css->id; |
| @@ -4724,7 +4782,6 @@ static void init_and_link_css(struct cgroup_subsys_state *css, · 98 unmodified lines | |||
| 4724 | css->ss = ss; | 4782 | css->ss = ss; |
| 4725 | INIT_LIST_HEAD(&css->sibling); | 4783 | INIT_LIST_HEAD(&css->sibling); |
| 4726 | INIT_LIST_HEAD(&css->children); | 4784 | INIT_LIST_HEAD(&css->children); |
| 4727 | INIT_LIST_HEAD(&css->files); | ||
| 4728 | css->serial_nr = css_serial_nr_next++; | 4785 | css->serial_nr = css_serial_nr_next++; |
| 4729 | 4786 | ||
| 4730 | if (cgroup_parent(cgrp)) { | 4787 | if (cgroup_parent(cgrp)) { |
| @@ -155,12 +155,10 @@ static void freezer_css_free(struct cgroup_subsys_state *css) · 154 unmodified lines | |||
| 155 | * @freezer->lock. freezer_attach() makes the new tasks conform to the | 155 | * @freezer->lock. freezer_attach() makes the new tasks conform to the |
| 156 | * current state and all following state changes can see the new tasks. | 156 | * current state and all following state changes can see the new tasks. |
| 157 | */ | 157 | */ |
| 158 | static void freezer_attach(struct cgroup_subsys_state *new_css, | 158 | static void freezer_attach(struct cgroup_taskset *tset) |
| 159 | struct cgroup_taskset *tset) | ||
| 160 | { | 159 | { |
| 161 | struct freezer *freezer = css_freezer(new_css); | ||
| 162 | struct task_struct *task; | 160 | struct task_struct *task; |
| 163 | bool clear_frozen = false; | 161 | struct cgroup_subsys_state *new_css; |
| 164 | 162 | ||
| 165 | mutex_lock(&freezer_mutex); | 163 | mutex_lock(&freezer_mutex); |
| 166 | 164 | ||
| @@ -174,22 +172,21 @@ static void freezer_attach(struct cgroup_subsys_state *new_css, · 7 unmodified lines | |||
| 174 | * current state before executing the following - !frozen tasks may | 172 | * current state before executing the following - !frozen tasks may |
| 175 | * be visible in a FROZEN cgroup and frozen tasks in a THAWED one. | 173 | * be visible in a FROZEN cgroup and frozen tasks in a THAWED one. |
| 176 | */ | 174 | */ |
| 177 | cgroup_taskset_for_each(task, tset) { | 175 | cgroup_taskset_for_each(task, new_css, tset) { |
| 176 | struct freezer *freezer = css_freezer(new_css); | ||
| 177 | |||
| 178 | if (!(freezer->state & CGROUP_FREEZING)) { | 178 | if (!(freezer->state & CGROUP_FREEZING)) { |
| 179 | __thaw_task(task); | 179 | __thaw_task(task); |
| 180 | } else { | 180 | } else { |
| 181 | freeze_task(task); | 181 | freeze_task(task); |
| 182 | freezer->state &= ~CGROUP_FROZEN; | 182 | /* clear FROZEN and propagate upwards */ |
| 183 | clear_frozen = true; | 183 | while (freezer && (freezer->state & CGROUP_FROZEN)) { |
| 184 | freezer->state &= ~CGROUP_FROZEN; | ||
| 185 | freezer = parent_freezer(freezer); | ||
| 186 | } | ||
| 184 | } | 187 | } |
| 185 | } | 188 | } |
| 186 | 189 | ||
| 187 | /* propagate FROZEN clearing upwards */ | ||
| 188 | while (clear_frozen && (freezer = parent_freezer(freezer))) { | ||
| 189 | freezer->state &= ~CGROUP_FROZEN; | ||
| 190 | clear_frozen = freezer->state & CGROUP_FREEZING; | ||
| 191 | } | ||
| 192 | |||
| 193 | mutex_unlock(&freezer_mutex); | 190 | mutex_unlock(&freezer_mutex); |
| 194 | } | 191 | } |
| 195 | 192 | ||
| @@ -106,7 +106,7 @@ static void pids_uncharge(struct pids_cgroup *pids, int num) · 105 unmodified lines | |||
| 106 | { | 106 | { |
| 107 | struct pids_cgroup *p; | 107 | struct pids_cgroup *p; |
| 108 | 108 | ||
| 109 | for (p = pids; p; p = parent_pids(p)) | 109 | for (p = pids; parent_pids(p); p = parent_pids(p)) |
| 110 | pids_cancel(p, num); | 110 | pids_cancel(p, num); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| @@ -123,7 +123,7 @@ static void pids_charge(struct pids_cgroup *pids, int num) · 10 unmodified lines | |||
| 123 | { | 123 | { |
| 124 | struct pids_cgroup *p; | 124 | struct pids_cgroup *p; |
| 125 | 125 | ||
| 126 | for (p = pids; p; p = parent_pids(p)) | 126 | for (p = pids; parent_pids(p); p = parent_pids(p)) |
| 127 | atomic64_add(num, &p->counter); | 127 | atomic64_add(num, &p->counter); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| @@ -140,7 +140,7 @@ static int pids_try_charge(struct pids_cgroup *pids, int num) · 10 unmodified lines | |||
| 140 | { | 140 | { |
| 141 | struct pids_cgroup *p, *q; | 141 | struct pids_cgroup *p, *q; |
| 142 | 142 | ||
| 143 | for (p = pids; p; p = parent_pids(p)) { | 143 | for (p = pids; parent_pids(p); p = parent_pids(p)) { |
| 144 | int64_t new = atomic64_add_return(num, &p->counter); | 144 | int64_t new = atomic64_add_return(num, &p->counter); |
| 145 | 145 | ||
| 146 | /* | 146 | /* |
| @@ -162,13 +162,13 @@ revert: · 15 unmodified lines | |||
| 162 | return -EAGAIN; | 162 | return -EAGAIN; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | static int pids_can_attach(struct cgroup_subsys_state *css, | 165 | static int pids_can_attach(struct cgroup_taskset *tset) |
| 166 | struct cgroup_taskset *tset) | ||
| 167 | { | 166 | { |
| 168 | struct pids_cgroup *pids = css_pids(css); | ||
| 169 | struct task_struct *task; | 167 | struct task_struct *task; |
| 168 | struct cgroup_subsys_state *dst_css; | ||
| 170 | 169 | ||
| 171 | cgroup_taskset_for_each(task, tset) { | 170 | cgroup_taskset_for_each(task, dst_css, tset) { |
| 171 | struct pids_cgroup *pids = css_pids(dst_css); | ||
| 172 | struct cgroup_subsys_state *old_css; | 172 | struct cgroup_subsys_state *old_css; |
| 173 | struct pids_cgroup *old_pids; | 173 | struct pids_cgroup *old_pids; |
| 174 | 174 | ||
| @@ -187,13 +187,13 @@ static int pids_can_attach(struct cgroup_subsys_state *css, · 12 unmodified lines | |||
| 187 | return 0; | 187 | return 0; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | static void pids_cancel_attach(struct cgroup_subsys_state *css, | 190 | static void pids_cancel_attach(struct cgroup_taskset *tset) |
| 191 | struct cgroup_taskset *tset) | ||
| 192 | { | 191 | { |
| 193 | struct pids_cgroup *pids = css_pids(css); | ||
| 194 | struct task_struct *task; | 192 | struct task_struct *task; |
| 193 | struct cgroup_subsys_state *dst_css; | ||
| 195 | 194 | ||
| 196 | cgroup_taskset_for_each(task, tset) { | 195 | cgroup_taskset_for_each(task, dst_css, tset) { |
| 196 | struct pids_cgroup *pids = css_pids(dst_css); | ||
| 197 | struct cgroup_subsys_state *old_css; | 197 | struct cgroup_subsys_state *old_css; |
| 198 | struct pids_cgroup *old_pids; | 198 | struct pids_cgroup *old_pids; |
| 199 | 199 | ||
| @@ -205,65 +205,28 @@ static void pids_cancel_attach(struct cgroup_subsys_state *css, · 5 unmodified lines | |||
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | /* | ||
| 209 | * task_css_check(true) in pids_can_fork() and pids_cancel_fork() relies | ||
| 210 | * on threadgroup_change_begin() held by the copy_process(). | ||
| 211 | */ | ||
| 208 | static int pids_can_fork(struct task_struct *task, void **priv_p) | 212 | static int pids_can_fork(struct task_struct *task, void **priv_p) |
| 209 | { | 213 | { |
| 210 | struct cgroup_subsys_state *css; | 214 | struct cgroup_subsys_state *css; |
| 211 | struct pids_cgroup *pids; | 215 | struct pids_cgroup *pids; |
| 212 | int err; | ||
| 213 | 216 | ||
| 214 | /* | 217 | css = task_css_check(current, pids_cgrp_id, true); |
| 215 | * Use the "current" task_css for the pids subsystem as the tentative | ||
| 216 | * css. It is possible we will charge the wrong hierarchy, in which | ||
| 217 | * case we will forcefully revert/reapply the charge on the right | ||
| 218 | * hierarchy after it is committed to the task proper. | ||
| 219 | */ | ||
| 220 | css = task_get_css(current, pids_cgrp_id); | ||
| 221 | pids = css_pids(css); | 218 | pids = css_pids(css); |
| 222 | 219 | return pids_try_charge(pids, 1); | |
| 223 | err = pids_try_charge(pids, 1); | ||
| 224 | if (err) | ||
| 225 | goto err_css_put; | ||
| 226 | |||
| 227 | *priv_p = css; | ||
| 228 | return 0; | ||
| 229 | |||
| 230 | err_css_put: | ||
| 231 | css_put(css); | ||
| 232 | return err; | ||
| 233 | } | 220 | } |
| 234 | 221 | ||
| 235 | static void pids_cancel_fork(struct task_struct *task, void *priv) | 222 | static void pids_cancel_fork(struct task_struct *task, void *priv) |
| 236 | { | ||
| 237 | struct cgroup_subsys_state *css = priv; | ||
| 238 | struct pids_cgroup *pids = css_pids(css); | ||
| 239 | |||
| 240 | pids_uncharge(pids, 1); | ||
| 241 | css_put(css); | ||
| 242 | } | ||
| 243 | |||
| 244 | static void pids_fork(struct task_struct *task, void *priv) | ||
| 245 | { | 223 | { |
| 246 | struct cgroup_subsys_state *css; | 224 | struct cgroup_subsys_state *css; |
| 247 | struct cgroup_subsys_state *old_css = priv; | ||
| 248 | struct pids_cgroup *pids; | 225 | struct pids_cgroup *pids; |
| 249 | struct pids_cgroup *old_pids = css_pids(old_css); | ||
| 250 | 226 | ||
| 251 | css = task_get_css(task, pids_cgrp_id); | 227 | css = task_css_check(current, pids_cgrp_id, true); |
| 252 | pids = css_pids(css); | 228 | pids = css_pids(css); |
| 253 | 229 | pids_uncharge(pids, 1); | |
| 254 | /* | ||
| 255 | * If the association has changed, we have to revert and reapply the | ||
| 256 | * charge/uncharge on the wrong hierarchy to the current one. Since | ||
| 257 | * the association can only change due to an organisation event, its | ||
| 258 | * okay for us to ignore the limit in this case. | ||
| 259 | */ | ||
| 260 | if (pids != old_pids) { | ||
| 261 | pids_uncharge(old_pids, 1); | ||
| 262 | pids_charge(pids, 1); | ||
| 263 | } | ||
| 264 | |||
| 265 | css_put(css); | ||
| 266 | css_put(old_css); | ||
| 267 | } | 230 | } |
| 268 | 231 | ||
| 269 | static void pids_free(struct task_struct *task) | 232 | static void pids_free(struct task_struct *task) |
| @@ -335,6 +298,7 @@ static struct cftype pids_files[] = { · 65 unmodified lines | |||
| 335 | { | 298 | { |
| 336 | .name = "current", | 299 | .name = "current", |
| 337 | .read_s64 = pids_current_read, | 300 | .read_s64 = pids_current_read, |
| 301 | .flags = CFTYPE_NOT_ON_ROOT, | ||
| 338 | }, | 302 | }, |
| 339 | { } /* terminate */ | 303 | { } /* terminate */ |
| 340 | }; | 304 | }; |
| @@ -346,7 +310,6 @@ struct cgroup_subsys pids_cgrp_subsys = { · 5 unmodified lines | |||
| 346 | .cancel_attach = pids_cancel_attach, | 310 | .cancel_attach = pids_cancel_attach, |
| 347 | .can_fork = pids_can_fork, | 311 | .can_fork = pids_can_fork, |
| 348 | .cancel_fork = pids_cancel_fork, | 312 | .cancel_fork = pids_cancel_fork, |
| 349 | .fork = pids_fork, | ||
| 350 | .free = pids_free, | 313 | .free = pids_free, |
| 351 | .legacy_cftypes = pids_files, | 314 | .legacy_cftypes = pids_files, |
| 352 | .dfl_cftypes = pids_files, | 315 | .dfl_cftypes = pids_files, |
| @@ -1429,15 +1429,16 @@ static int fmeter_getrate(struct fmeter *fmp) · 1428 unmodified lines | |||
| 1429 | static struct cpuset *cpuset_attach_old_cs; | 1429 | static struct cpuset *cpuset_attach_old_cs; |
| 1430 | 1430 | ||
| 1431 | /* Called by cgroups to determine if a cpuset is usable; cpuset_mutex held */ | 1431 | /* Called by cgroups to determine if a cpuset is usable; cpuset_mutex held */ |
| 1432 | static int cpuset_can_attach(struct cgroup_subsys_state *css, | 1432 | static int cpuset_can_attach(struct cgroup_taskset *tset) |
| 1433 | struct cgroup_taskset *tset) | ||
| 1434 | { | 1433 | { |
| 1435 | struct cpuset *cs = css_cs(css); | 1434 | struct cgroup_subsys_state *css; |
| 1435 | struct cpuset *cs; | ||
| 1436 | struct task_struct *task; | 1436 | struct task_struct *task; |
| 1437 | int ret; | 1437 | int ret; |
| 1438 | 1438 | ||
| 1439 | /* used later by cpuset_attach() */ | 1439 | /* used later by cpuset_attach() */ |
| 1440 | cpuset_attach_old_cs = task_cs(cgroup_taskset_first(tset)); | 1440 | cpuset_attach_old_cs = task_cs(cgroup_taskset_first(tset, &css)); |
| 1441 | cs = css_cs(css); | ||
| 1441 | 1442 | ||
| 1442 | mutex_lock(&cpuset_mutex); | 1443 | mutex_lock(&cpuset_mutex); |
| 1443 | 1444 | ||
| @@ -1447,7 +1448,7 @@ static int cpuset_can_attach(struct cgroup_subsys_state *css, · 3 unmodified lines | |||
| 1447 | (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))) | 1448 | (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))) |
| 1448 | goto out_unlock; | 1449 | goto out_unlock; |
| 1449 | 1450 | ||
| 1450 | cgroup_taskset_for_each(task, tset) { | 1451 | cgroup_taskset_for_each(task, css, tset) { |
| 1451 | ret = task_can_attach(task, cs->cpus_allowed); | 1452 | ret = task_can_attach(task, cs->cpus_allowed); |
| 1452 | if (ret) | 1453 | if (ret) |
| 1453 | goto out_unlock; | 1454 | goto out_unlock; |
| @@ -1467,9 +1468,14 @@ out_unlock: · 13 unmodified lines | |||
| 1467 | return ret; | 1468 | return ret; |
| 1468 | } | 1469 | } |
| 1469 | 1470 | ||
| 1470 | static void cpuset_cancel_attach(struct cgroup_subsys_state *css, | 1471 | static void cpuset_cancel_attach(struct cgroup_taskset *tset) |
| 1471 | struct cgroup_taskset *tset) | ||
| 1472 | { | 1472 | { |
| 1473 | struct cgroup_subsys_state *css; | ||
| 1474 | struct cpuset *cs; | ||
| 1475 | |||
| 1476 | cgroup_taskset_first(tset, &css); | ||
| 1477 | cs = css_cs(css); | ||
| 1478 | |||
| 1473 | mutex_lock(&cpuset_mutex); | 1479 | mutex_lock(&cpuset_mutex); |
| 1474 | css_cs(css)->attach_in_progress--; | 1480 | css_cs(css)->attach_in_progress--; |
| 1475 | mutex_unlock(&cpuset_mutex); | 1481 | mutex_unlock(&cpuset_mutex); |
| @@ -1482,16 +1488,19 @@ static void cpuset_cancel_attach(struct cgroup_subsys_state *css, · 6 unmodified lines | |||
| 1482 | */ | 1488 | */ |
| 1483 | static cpumask_var_t cpus_attach; | 1489 | static cpumask_var_t cpus_attach; |
| 1484 | 1490 | ||
| 1485 | static void cpuset_attach(struct cgroup_subsys_state *css, | 1491 | static void cpuset_attach(struct cgroup_taskset *tset) |
| 1486 | struct cgroup_taskset *tset) | ||
| 1487 | { | 1492 | { |
| 1488 | /* static buf protected by cpuset_mutex */ | 1493 | /* static buf protected by cpuset_mutex */ |
| 1489 | static nodemask_t cpuset_attach_nodemask_to; | 1494 | static nodemask_t cpuset_attach_nodemask_to; |
| 1490 | struct task_struct *task; | 1495 | struct task_struct *task; |
| 1491 | struct task_struct *leader; | 1496 | struct task_struct *leader; |
| 1492 | struct cpuset *cs = css_cs(css); | 1497 | struct cgroup_subsys_state *css; |
| 1498 | struct cpuset *cs; | ||
| 1493 | struct cpuset *oldcs = cpuset_attach_old_cs; | 1499 | struct cpuset *oldcs = cpuset_attach_old_cs; |
| 1494 | 1500 | ||
| 1501 | cgroup_taskset_first(tset, &css); | ||
| 1502 | cs = css_cs(css); | ||
| 1503 | |||
| 1495 | mutex_lock(&cpuset_mutex); | 1504 | mutex_lock(&cpuset_mutex); |
| 1496 | 1505 | ||
| 1497 | /* prepare for attach */ | 1506 | /* prepare for attach */ |
| @@ -1502,7 +1511,7 @@ static void cpuset_attach(struct cgroup_subsys_state *css, · 4 unmodified lines | |||
| 1502 | 1511 | ||
| 1503 | guarantee_online_mems(cs, &cpuset_attach_nodemask_to); | 1512 | guarantee_online_mems(cs, &cpuset_attach_nodemask_to); |
| 1504 | 1513 | ||
| 1505 | cgroup_taskset_for_each(task, tset) { | 1514 | cgroup_taskset_for_each(task, css, tset) { |
| 1506 | /* | 1515 | /* |
| 1507 | * can_attach beforehand should guarantee that this doesn't | 1516 | * can_attach beforehand should guarantee that this doesn't |
| 1508 | * fail. TODO: have a better way to handle failure here | 1517 | * fail. TODO: have a better way to handle failure here |
| @@ -1518,7 +1527,7 @@ static void cpuset_attach(struct cgroup_subsys_state *css, · 9 unmodified lines | |||
| 1518 | * sleep and should be moved outside migration path proper. | 1527 | * sleep and should be moved outside migration path proper. |
| 1519 | */ | 1528 | */ |
| 1520 | cpuset_attach_nodemask_to = cs->effective_mems; | 1529 | cpuset_attach_nodemask_to = cs->effective_mems; |
| 1521 | cgroup_taskset_for_each_leader(leader, tset) { | 1530 | cgroup_taskset_for_each_leader(leader, css, tset) { |
| 1522 | struct mm_struct *mm = get_task_mm(leader); | 1531 | struct mm_struct *mm = get_task_mm(leader); |
| 1523 | 1532 | ||
| 1524 | if (mm) { | 1533 | if (mm) { |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> | 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> |
| 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra |
| 7 | * Copyright � 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> | 7 | * Copyright � 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> |
| 8 | * | 8 | * |
| 9 | * For licensing details see kernel-base/COPYING | 9 | * For licensing details see kernel-base/COPYING |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> | 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> |
| 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra |
| 7 | * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> | 7 | * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> |
| 8 | * | 8 | * |
| 9 | * For licensing details see kernel-base/COPYING | 9 | * For licensing details see kernel-base/COPYING |
| @@ -435,7 +435,7 @@ static inline void update_cgrp_time_from_event(struct perf_event *event) · 425 unmodified lines | |||
| 435 | if (!is_cgroup_event(event)) | 435 | if (!is_cgroup_event(event)) |
| 436 | return; | 436 | return; |
| 437 | 437 | ||
| 438 | cgrp = perf_cgroup_from_task(current); | 438 | cgrp = perf_cgroup_from_task(current, event->ctx); |
| 439 | /* | 439 | /* |
| 440 | * Do not update time when cgroup is not active | 440 | * Do not update time when cgroup is not active |
| 441 | */ | 441 | */ |
| @@ -458,7 +458,7 @@ perf_cgroup_set_timestamp(struct task_struct *task, · 16 unmodified lines | |||
| 458 | if (!task || !ctx->nr_cgroups) | 458 | if (!task || !ctx->nr_cgroups) |
| 459 | return; | 459 | return; |
| 460 | 460 | ||
| 461 | cgrp = perf_cgroup_from_task(task); | 461 | cgrp = perf_cgroup_from_task(task, ctx); |
| 462 | info = this_cpu_ptr(cgrp->info); | 462 | info = this_cpu_ptr(cgrp->info); |
| 463 | info->timestamp = ctx->timestamp; | 463 | info->timestamp = ctx->timestamp; |
| 464 | } | 464 | } |
| @@ -489,7 +489,6 @@ static void perf_cgroup_switch(struct task_struct *task, int mode) · 24 unmodified lines | |||
| 489 | * we reschedule only in the presence of cgroup | 489 | * we reschedule only in the presence of cgroup |
| 490 | * constrained events. | 490 | * constrained events. |
| 491 | */ | 491 | */ |
| 492 | rcu_read_lock(); | ||
| 493 | 492 | ||
| 494 | list_for_each_entry_rcu(pmu, &pmus, entry) { | 493 | list_for_each_entry_rcu(pmu, &pmus, entry) { |
| 495 | cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); | 494 | cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); |
| @@ -522,8 +521,10 @@ static void perf_cgroup_switch(struct task_struct *task, int mode) · 26 unmodified lines | |||
| 522 | * set cgrp before ctxsw in to allow | 521 | * set cgrp before ctxsw in to allow |
| 523 | * event_filter_match() to not have to pass | 522 | * event_filter_match() to not have to pass |
| 524 | * task around | 523 | * task around |
| 524 | * we pass the cpuctx->ctx to perf_cgroup_from_task() | ||
| 525 | * because cgorup events are only per-cpu | ||
| 525 | */ | 526 | */ |
| 526 | cpuctx->cgrp = perf_cgroup_from_task(task); | 527 | cpuctx->cgrp = perf_cgroup_from_task(task, &cpuctx->ctx); |
| 527 | cpu_ctx_sched_in(cpuctx, EVENT_ALL, task); | 528 | cpu_ctx_sched_in(cpuctx, EVENT_ALL, task); |
| 528 | } | 529 | } |
| 529 | perf_pmu_enable(cpuctx->ctx.pmu); | 530 | perf_pmu_enable(cpuctx->ctx.pmu); |
| @@ -531,8 +532,6 @@ static void perf_cgroup_switch(struct task_struct *task, int mode) · 1 unmodified line | |||
| 531 | } | 532 | } |
| 532 | } | 533 | } |
| 533 | 534 | ||
| 534 | rcu_read_unlock(); | ||
| 535 | |||
| 536 | local_irq_restore(flags); | 535 | local_irq_restore(flags); |
| 537 | } | 536 | } |
| 538 | 537 | ||
| @@ -542,17 +541,20 @@ static inline void perf_cgroup_sched_out(struct task_struct *task, · 3 unmodified lines | |||
| 542 | struct perf_cgroup *cgrp1; | 541 | struct perf_cgroup *cgrp1; |
| 543 | struct perf_cgroup *cgrp2 = NULL; | 542 | struct perf_cgroup *cgrp2 = NULL; |
| 544 | 543 | ||
| 544 | rcu_read_lock(); | ||
| 545 | /* | 545 | /* |
| 546 | * we come here when we know perf_cgroup_events > 0 | 546 | * we come here when we know perf_cgroup_events > 0 |
| 547 | * we do not need to pass the ctx here because we know | ||
| 548 | * we are holding the rcu lock | ||
| 547 | */ | 549 | */ |
| 548 | cgrp1 = perf_cgroup_from_task(task); | 550 | cgrp1 = perf_cgroup_from_task(task, NULL); |
| 549 | 551 | ||
| 550 | /* | 552 | /* |
| 551 | * next is NULL when called from perf_event_enable_on_exec() | 553 | * next is NULL when called from perf_event_enable_on_exec() |
| 552 | * that will systematically cause a cgroup_switch() | 554 | * that will systematically cause a cgroup_switch() |
| 553 | */ | 555 | */ |
| 554 | if (next) | 556 | if (next) |
| 555 | cgrp2 = perf_cgroup_from_task(next); | 557 | cgrp2 = perf_cgroup_from_task(next, NULL); |
| 556 | 558 | ||
| 557 | /* | 559 | /* |
| 558 | * only schedule out current cgroup events if we know | 560 | * only schedule out current cgroup events if we know |
| @@ -561,6 +563,8 @@ static inline void perf_cgroup_sched_out(struct task_struct *task, · 2 unmodified lines | |||
| 561 | */ | 563 | */ |
| 562 | if (cgrp1 != cgrp2) | 564 | if (cgrp1 != cgrp2) |
| 563 | perf_cgroup_switch(task, PERF_CGROUP_SWOUT); | 565 | perf_cgroup_switch(task, PERF_CGROUP_SWOUT); |
| 566 | |||
| 567 | rcu_read_unlock(); | ||
| 564 | } | 568 | } |
| 565 | 569 | ||
| 566 | static inline void perf_cgroup_sched_in(struct task_struct *prev, | 570 | static inline void perf_cgroup_sched_in(struct task_struct *prev, |
| @@ -569,13 +573,16 @@ static inline void perf_cgroup_sched_in(struct task_struct *prev, · 2 unmodified lines | |||
| 569 | struct perf_cgroup *cgrp1; | 573 | struct perf_cgroup *cgrp1; |
| 570 | struct perf_cgroup *cgrp2 = NULL; | 574 | struct perf_cgroup *cgrp2 = NULL; |
| 571 | 575 | ||
| 576 | rcu_read_lock(); | ||
| 572 | /* | 577 | /* |
| 573 | * we come here when we know perf_cgroup_events > 0 | 578 | * we come here when we know perf_cgroup_events > 0 |
| 579 | * we do not need to pass the ctx here because we know | ||
| 580 | * we are holding the rcu lock | ||
| 574 | */ | 581 | */ |
| 575 | cgrp1 = perf_cgroup_from_task(task); | 582 | cgrp1 = perf_cgroup_from_task(task, NULL); |
| 576 | 583 | ||
| 577 | /* prev can never be NULL */ | 584 | /* prev can never be NULL */ |
| 578 | cgrp2 = perf_cgroup_from_task(prev); | 585 | cgrp2 = perf_cgroup_from_task(prev, NULL); |
| 579 | 586 | ||
| 580 | /* | 587 | /* |
| 581 | * only need to schedule in cgroup events if we are changing | 588 | * only need to schedule in cgroup events if we are changing |
| @@ -584,6 +591,8 @@ static inline void perf_cgroup_sched_in(struct task_struct *prev, · 2 unmodified lines | |||
| 584 | */ | 591 | */ |
| 585 | if (cgrp1 != cgrp2) | 592 | if (cgrp1 != cgrp2) |
| 586 | perf_cgroup_switch(task, PERF_CGROUP_SWIN); | 593 | perf_cgroup_switch(task, PERF_CGROUP_SWIN); |
| 594 | |||
| 595 | rcu_read_unlock(); | ||
| 587 | } | 596 | } |
| 588 | 597 | ||
| 589 | static inline int perf_cgroup_connect(int fd, struct perf_event *event, | 598 | static inline int perf_cgroup_connect(int fd, struct perf_event *event, |
| @@ -4216,7 +4225,14 @@ retry: · 3626 unmodified lines | |||
| 4216 | goto retry; | 4225 | goto retry; |
| 4217 | } | 4226 | } |
| 4218 | 4227 | ||
| 4219 | __perf_event_period(&pe); | 4228 | if (event->attr.freq) { |
| 4229 | event->attr.sample_freq = value; | ||
| 4230 | } else { | ||
| 4231 | event->attr.sample_period = value; | ||
| 4232 | event->hw.sample_period = value; | ||
| 4233 | } | ||
| 4234 | |||
| 4235 | local64_set(&event->hw.period_left, 0); | ||
| 4220 | raw_spin_unlock_irq(&ctx->lock); | 4236 | raw_spin_unlock_irq(&ctx->lock); |
| 4221 | 4237 | ||
| 4222 | return 0; | 4238 | return 0; |
| @@ -5666,6 +5682,17 @@ perf_event_aux_ctx(struct perf_event_context *ctx, · 1443 unmodified lines | |||
| 5666 | } | 5682 | } |
| 5667 | } | 5683 | } |
| 5668 | 5684 | ||
| 5685 | static void | ||
| 5686 | perf_event_aux_task_ctx(perf_event_aux_output_cb output, void *data, | ||
| 5687 | struct perf_event_context *task_ctx) | ||
| 5688 | { | ||
| 5689 | rcu_read_lock(); | ||
| 5690 | preempt_disable(); | ||
| 5691 | perf_event_aux_ctx(task_ctx, output, data); | ||
| 5692 | preempt_enable(); | ||
| 5693 | rcu_read_unlock(); | ||
| 5694 | } | ||
| 5695 | |||
| 5669 | static void | 5696 | static void |
| 5670 | perf_event_aux(perf_event_aux_output_cb output, void *data, | 5697 | perf_event_aux(perf_event_aux_output_cb output, void *data, |
| 5671 | struct perf_event_context *task_ctx) | 5698 | struct perf_event_context *task_ctx) |
| @@ -5675,14 +5702,23 @@ perf_event_aux(perf_event_aux_output_cb output, void *data, · 3 unmodified lines | |||
| 5675 | struct pmu *pmu; | 5702 | struct pmu *pmu; |
| 5676 | int ctxn; | 5703 | int ctxn; |
| 5677 | 5704 | ||
| 5705 | /* | ||
| 5706 | * If we have task_ctx != NULL we only notify | ||
| 5707 | * the task context itself. The task_ctx is set | ||
| 5708 | * only for EXIT events before releasing task | ||
| 5709 | * context. | ||
| 5710 | */ | ||
| 5711 | if (task_ctx) { | ||
| 5712 | perf_event_aux_task_ctx(output, data, task_ctx); | ||
| 5713 | return; | ||
| 5714 | } | ||
| 5715 | |||
| 5678 | rcu_read_lock(); | 5716 | rcu_read_lock(); |
| 5679 | list_for_each_entry_rcu(pmu, &pmus, entry) { | 5717 | list_for_each_entry_rcu(pmu, &pmus, entry) { |
| 5680 | cpuctx = get_cpu_ptr(pmu->pmu_cpu_context); | 5718 | cpuctx = get_cpu_ptr(pmu->pmu_cpu_context); |
| 5681 | if (cpuctx->unique_pmu != pmu) | 5719 | if (cpuctx->unique_pmu != pmu) |
| 5682 | goto next; | 5720 | goto next; |
| 5683 | perf_event_aux_ctx(&cpuctx->ctx, output, data); | 5721 | perf_event_aux_ctx(&cpuctx->ctx, output, data); |
| 5684 | if (task_ctx) | ||
| 5685 | goto next; | ||
| 5686 | ctxn = pmu->task_ctx_nr; | 5722 | ctxn = pmu->task_ctx_nr; |
| 5687 | if (ctxn < 0) | 5723 | if (ctxn < 0) |
| 5688 | goto next; | 5724 | goto next; |
| @@ -5692,12 +5728,6 @@ perf_event_aux(perf_event_aux_output_cb output, void *data, · 3 unmodified lines | |||
| 5692 | next: | 5728 | next: |
| 5693 | put_cpu_ptr(pmu->pmu_cpu_context); | 5729 | put_cpu_ptr(pmu->pmu_cpu_context); |
| 5694 | } | 5730 | } |
| 5695 | |||
| 5696 | if (task_ctx) { | ||
| 5697 | preempt_disable(); | ||
| 5698 | perf_event_aux_ctx(task_ctx, output, data); | ||
| 5699 | preempt_enable(); | ||
| 5700 | } | ||
| 5701 | rcu_read_unlock(); | 5731 | rcu_read_unlock(); |
| 5702 | } | 5732 | } |
| 5703 | 5733 | ||
| @@ -8787,10 +8817,8 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn) · 3083 unmodified lines | |||
| 8787 | struct perf_event_context *child_ctx, *clone_ctx = NULL; | 8817 | struct perf_event_context *child_ctx, *clone_ctx = NULL; |
| 8788 | unsigned long flags; | 8818 | unsigned long flags; |
| 8789 | 8819 | ||
| 8790 | if (likely(!child->perf_event_ctxp[ctxn])) { | 8820 | if (likely(!child->perf_event_ctxp[ctxn])) |
| 8791 | perf_event_task(child, NULL, 0); | ||
| 8792 | return; | 8821 | return; |
| 8793 | } | ||
| 8794 | 8822 | ||
| 8795 | local_irq_save(flags); | 8823 | local_irq_save(flags); |
| 8796 | /* | 8824 | /* |
| @@ -8874,6 +8902,14 @@ void perf_event_exit_task(struct task_struct *child) · 77 unmodified lines | |||
| 8874 | 8902 | ||
| 8875 | for_each_task_context_nr(ctxn) | 8903 | for_each_task_context_nr(ctxn) |
| 8876 | perf_event_exit_task_context(child, ctxn); | 8904 | perf_event_exit_task_context(child, ctxn); |
| 8905 | |||
| 8906 | /* | ||
| 8907 | * The perf_event_exit_task_context calls perf_event_task | ||
| 8908 | * with child's task_ctx, which generates EXIT events for | ||
| 8909 | * child contexts and sets child->perf_event_ctxp[] to NULL. | ||
| 8910 | * At this point we need to send EXIT events to cpu contexts. | ||
| 8911 | */ | ||
| 8912 | perf_event_task(child, NULL, 0); | ||
| 8877 | } | 8913 | } |
| 8878 | 8914 | ||
| 8879 | static void perf_free_event(struct perf_event *event, | 8915 | static void perf_free_event(struct perf_event *event, |
| @@ -9452,16 +9488,18 @@ static void perf_cgroup_css_free(struct cgroup_subsys_state *css) · 572 unmodified lines | |||
| 9452 | static int __perf_cgroup_move(void *info) | 9488 | static int __perf_cgroup_move(void *info) |
| 9453 | { | 9489 | { |
| 9454 | struct task_struct *task = info; | 9490 | struct task_struct *task = info; |
| 9491 | rcu_read_lock(); | ||
| 9455 | perf_cgroup_switch(task, PERF_CGROUP_SWOUT | PERF_CGROUP_SWIN); | 9492 | perf_cgroup_switch(task, PERF_CGROUP_SWOUT | PERF_CGROUP_SWIN); |
| 9493 | rcu_read_unlock(); | ||
| 9456 | return 0; | 9494 | return 0; |
| 9457 | } | 9495 | } |
| 9458 | 9496 | ||
| 9459 | static void perf_cgroup_attach(struct cgroup_subsys_state *css, | 9497 | static void perf_cgroup_attach(struct cgroup_taskset *tset) |
| 9460 | struct cgroup_taskset *tset) | ||
| 9461 | { | 9498 | { |
| 9462 | struct task_struct *task; | 9499 | struct task_struct *task; |
| 9500 | struct cgroup_subsys_state *css; | ||
| 9463 | 9501 | ||
| 9464 | cgroup_taskset_for_each(task, tset) | 9502 | cgroup_taskset_for_each(task, css, tset) |
| 9465 | task_function_call(task, __perf_cgroup_move, task); | 9503 | task_function_call(task, __perf_cgroup_move, task); |
| 9466 | } | 9504 | } |
| 9467 | 9505 | ||
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> | 4 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> |
| 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar | 5 | * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar |
| 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 6 | * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra |
| 7 | * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> | 7 | * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> |
| 8 | * | 8 | * |
| 9 | * For licensing details see kernel-base/COPYING | 9 | * For licensing details see kernel-base/COPYING |
| @@ -19,7 +19,7 @@ · 18 unmodified lines | |||
| 19 | * Authors: | 19 | * Authors: |
| 20 | * Srikar Dronamraju | 20 | * Srikar Dronamraju |
| 21 | * Jim Keniston | 21 | * Jim Keniston |
| 22 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 22 | * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| @@ -1368,8 +1368,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, · 1367 unmodified lines | |||
| 1368 | p->real_start_time = ktime_get_boot_ns(); | 1368 | p->real_start_time = ktime_get_boot_ns(); |
| 1369 | p->io_context = NULL; | 1369 | p->io_context = NULL; |
| 1370 | p->audit_context = NULL; | 1370 | p->audit_context = NULL; |
| 1371 | if (clone_flags & CLONE_THREAD) | 1371 | threadgroup_change_begin(current); |
| 1372 | threadgroup_change_begin(current); | ||
| 1373 | cgroup_fork(p); | 1372 | cgroup_fork(p); |
| 1374 | #ifdef CONFIG_NUMA | 1373 | #ifdef CONFIG_NUMA |
| 1375 | p->mempolicy = mpol_dup(p->mempolicy); | 1374 | p->mempolicy = mpol_dup(p->mempolicy); |
| @@ -1610,8 +1609,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, · 234 unmodified lines | |||
| 1610 | 1609 | ||
| 1611 | proc_fork_connector(p); | 1610 | proc_fork_connector(p); |
| 1612 | cgroup_post_fork(p, cgrp_ss_priv); | 1611 | cgroup_post_fork(p, cgrp_ss_priv); |
| 1613 | if (clone_flags & CLONE_THREAD) | 1612 | threadgroup_change_end(current); |
| 1614 | threadgroup_change_end(current); | ||
| 1615 | perf_event_fork(p); | 1613 | perf_event_fork(p); |
| 1616 | 1614 | ||
| 1617 | trace_task_newtask(p, clone_flags); | 1615 | trace_task_newtask(p, clone_flags); |
| @@ -1652,8 +1650,7 @@ bad_fork_cleanup_policy: · 34 unmodified lines | |||
| 1652 | mpol_put(p->mempolicy); | 1650 | mpol_put(p->mempolicy); |
| 1653 | bad_fork_cleanup_threadgroup_lock: | 1651 | bad_fork_cleanup_threadgroup_lock: |
| 1654 | #endif | 1652 | #endif |
| 1655 | if (clone_flags & CLONE_THREAD) | 1653 | threadgroup_change_end(current); |
| 1656 | threadgroup_change_end(current); | ||
| 1657 | delayacct_tsk_free(p); | 1654 | delayacct_tsk_free(p); |
| 1658 | bad_fork_cleanup_count: | 1655 | bad_fork_cleanup_count: |
| 1659 | atomic_dec(&p->cred->user->processes); | 1656 | atomic_dec(&p->cred->user->processes); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 2 | * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra |
| 3 | * | 3 | * |
| 4 | * Provides a framework for enqueueing and running callbacks from hardirq | 4 | * Provides a framework for enqueueing and running callbacks from hardirq |
| 5 | * context. The enqueueing is NMI-safe. | 5 | * context. The enqueueing is NMI-safe. |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | * jump label support | 2 | * jump label support |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009 Jason Baron <jbaron@redhat.com> | 4 | * Copyright (C) 2009 Jason Baron <jbaron@redhat.com> |
| 5 | * Copyright (C) 2011 Peter Zijlstra <pzijlstr@redhat.com> | 5 | * Copyright (C) 2011 Peter Zijlstra |
| 6 | * | 6 | * |
| 7 | */ | 7 | */ |
| 8 | #include <linux/memory.h> | 8 | #include <linux/memory.h> |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | * Started by Ingo Molnar: | 6 | * Started by Ingo Molnar: |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 10 | * | 10 | * |
| 11 | * this code maps all the lock dependencies as they occur in a live kernel | 11 | * this code maps all the lock dependencies as they occur in a live kernel |
| 12 | * and will warn about the following classes of locking bugs: | 12 | * and will warn about the following classes of locking bugs: |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | * Started by Ingo Molnar: | 6 | * Started by Ingo Molnar: |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 8 | * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
| 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 9 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 10 | * | 10 | * |
| 11 | * Code for /proc/lockdep and /proc/lockdep_stats: | 11 | * Code for /proc/lockdep and /proc/lockdep_stats: |
| 12 | * | 12 | * |
| @@ -93,10 +93,12 @@ bool osq_lock(struct optimistic_spin_queue *lock) · 92 unmodified lines | |||
| 93 | node->cpu = curr; | 93 | node->cpu = curr; |
| 94 | 94 | ||
| 95 | /* | 95 | /* |
| 96 | * ACQUIRE semantics, pairs with corresponding RELEASE | 96 | * We need both ACQUIRE (pairs with corresponding RELEASE in |
| 97 | * in unlock() uncontended, or fastpath. | 97 | * unlock() uncontended, or fastpath) and RELEASE (to publish |
| 98 | * the node fields we just initialised) semantics when updating | ||
| 99 | * the lock tail. | ||
| 98 | */ | 100 | */ |
| 99 | old = atomic_xchg_acquire(&lock->tail, curr); | 101 | old = atomic_xchg(&lock->tail, curr); |
| 100 | if (old == OSQ_UNLOCKED_VAL) | 102 | if (old == OSQ_UNLOCKED_VAL) |
| 101 | return true; | 103 | return true; |
| 102 | 104 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * sched_clock for unstable cpu clocks | 2 | * sched_clock for unstable cpu clocks |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2008 Red Hat, Inc., Peter Zijlstra |
| 5 | * | 5 | * |
| 6 | * Updates and enhancements: | 6 | * Updates and enhancements: |
| 7 | * Copyright (C) 2008 Red Hat, Inc. Steven Rostedt <srostedt@redhat.com> | 7 | * Copyright (C) 2008 Red Hat, Inc. Steven Rostedt <srostedt@redhat.com> |
| @@ -8241,12 +8241,12 @@ static void cpu_cgroup_fork(struct task_struct *task, void *private) · 8240 unmodified lines | |||
| 8241 | sched_move_task(task); | 8241 | sched_move_task(task); |
| 8242 | } | 8242 | } |
| 8243 | 8243 | ||
| 8244 | static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, | 8244 | static int cpu_cgroup_can_attach(struct cgroup_taskset *tset) |
| 8245 | struct cgroup_taskset *tset) | ||
| 8246 | { | 8245 | { |
| 8247 | struct task_struct *task; | 8246 | struct task_struct *task; |
| 8247 | struct cgroup_subsys_state *css; | ||
| 8248 | 8248 | ||
| 8249 | cgroup_taskset_for_each(task, tset) { | 8249 | cgroup_taskset_for_each(task, css, tset) { |
| 8250 | #ifdef CONFIG_RT_GROUP_SCHED | 8250 | #ifdef CONFIG_RT_GROUP_SCHED |
| 8251 | if (!sched_rt_can_attach(css_tg(css), task)) | 8251 | if (!sched_rt_can_attach(css_tg(css), task)) |
| 8252 | return -EINVAL; | 8252 | return -EINVAL; |
| @@ -8259,12 +8259,12 @@ static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, · 6 unmodified lines | |||
| 8259 | return 0; | 8259 | return 0; |
| 8260 | } | 8260 | } |
| 8261 | 8261 | ||
| 8262 | static void cpu_cgroup_attach(struct cgroup_subsys_state *css, | 8262 | static void cpu_cgroup_attach(struct cgroup_taskset *tset) |
| 8263 | struct cgroup_taskset *tset) | ||
| 8264 | { | 8263 | { |
| 8265 | struct task_struct *task; | 8264 | struct task_struct *task; |
| 8265 | struct cgroup_subsys_state *css; | ||
| 8266 | 8266 | ||
| 8267 | cgroup_taskset_for_each(task, tset) | 8267 | cgroup_taskset_for_each(task, css, tset) |
| 8268 | sched_move_task(task); | 8268 | sched_move_task(task); |
| 8269 | } | 8269 | } |
| 8270 | 8270 | ||
| @@ -17,7 +17,7 @@ · 16 unmodified lines | |||
| 17 | * Copyright (C) 2007, Thomas Gleixner <tglx@linutronix.de> | 17 | * Copyright (C) 2007, Thomas Gleixner <tglx@linutronix.de> |
| 18 | * | 18 | * |
| 19 | * Adaptive scheduling granularity, math enhancements by Peter Zijlstra | 19 | * Adaptive scheduling granularity, math enhancements by Peter Zijlstra |
| 20 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 20 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | #include <linux/latencytop.h> | 23 | #include <linux/latencytop.h> |
| @@ -392,7 +392,7 @@ __wait_on_bit(wait_queue_head_t *wq, struct wait_bit_queue *q, · 391 unmodified lines | |||
| 392 | do { | 392 | do { |
| 393 | prepare_to_wait(wq, &q->wait, mode); | 393 | prepare_to_wait(wq, &q->wait, mode); |
| 394 | if (test_bit(q->key.bit_nr, q->key.flags)) | 394 | if (test_bit(q->key.bit_nr, q->key.flags)) |
| 395 | ret = (*action)(&q->key); | 395 | ret = (*action)(&q->key, mode); |
| 396 | } while (test_bit(q->key.bit_nr, q->key.flags) && !ret); | 396 | } while (test_bit(q->key.bit_nr, q->key.flags) && !ret); |
| 397 | finish_wait(wq, &q->wait); | 397 | finish_wait(wq, &q->wait); |
| 398 | return ret; | 398 | return ret; |
| @@ -431,7 +431,7 @@ __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, · 32 unmodified lines | |||
| 431 | prepare_to_wait_exclusive(wq, &q->wait, mode); | 431 | prepare_to_wait_exclusive(wq, &q->wait, mode); |
| 432 | if (!test_bit(q->key.bit_nr, q->key.flags)) | 432 | if (!test_bit(q->key.bit_nr, q->key.flags)) |
| 433 | continue; | 433 | continue; |
| 434 | ret = action(&q->key); | 434 | ret = action(&q->key, mode); |
| 435 | if (!ret) | 435 | if (!ret) |
| 436 | continue; | 436 | continue; |
| 437 | abort_exclusive_wait(wq, &q->wait, mode, &q->key); | 437 | abort_exclusive_wait(wq, &q->wait, mode, &q->key); |
| @@ -581,43 +581,43 @@ void wake_up_atomic_t(atomic_t *p) · 143 unmodified lines | |||
| 581 | } | 581 | } |
| 582 | EXPORT_SYMBOL(wake_up_atomic_t); | 582 | EXPORT_SYMBOL(wake_up_atomic_t); |
| 583 | 583 | ||
| 584 | __sched int bit_wait(struct wait_bit_key *word) | 584 | __sched int bit_wait(struct wait_bit_key *word, int mode) |
| 585 | { | 585 | { |
| 586 | schedule(); | 586 | schedule(); |
| 587 | if (signal_pending(current)) | 587 | if (signal_pending_state(mode, current)) |
| 588 | return -EINTR; | 588 | return -EINTR; |
| 589 | return 0; | 589 | return 0; |
| 590 | } | 590 | } |
| 591 | EXPORT_SYMBOL(bit_wait); | 591 | EXPORT_SYMBOL(bit_wait); |
| 592 | 592 | ||
| 593 | __sched int bit_wait_io(struct wait_bit_key *word) | 593 | __sched int bit_wait_io(struct wait_bit_key *word, int mode) |
| 594 | { | 594 | { |
| 595 | io_schedule(); | 595 | io_schedule(); |
| 596 | if (signal_pending(current)) | 596 | if (signal_pending_state(mode, current)) |
| 597 | return -EINTR; | 597 | return -EINTR; |
| 598 | return 0; | 598 | return 0; |
| 599 | } | 599 | } |
| 600 | EXPORT_SYMBOL(bit_wait_io); | 600 | EXPORT_SYMBOL(bit_wait_io); |
| 601 | 601 | ||
| 602 | __sched int bit_wait_timeout(struct wait_bit_key *word) | 602 | __sched int bit_wait_timeout(struct wait_bit_key *word, int mode) |
| 603 | { | 603 | { |
| 604 | unsigned long now = READ_ONCE(jiffies); | 604 | unsigned long now = READ_ONCE(jiffies); |
| 605 | if (time_after_eq(now, word->timeout)) | 605 | if (time_after_eq(now, word->timeout)) |
| 606 | return -EAGAIN; | 606 | return -EAGAIN; |
| 607 | schedule_timeout(word->timeout - now); | 607 | schedule_timeout(word->timeout - now); |
| 608 | if (signal_pending(current)) | 608 | if (signal_pending_state(mode, current)) |
| 609 | return -EINTR; | 609 | return -EINTR; |
| 610 | return 0; | 610 | return 0; |
| 611 | } | 611 | } |
| 612 | EXPORT_SYMBOL_GPL(bit_wait_timeout); | 612 | EXPORT_SYMBOL_GPL(bit_wait_timeout); |
| 613 | 613 | ||
| 614 | __sched int bit_wait_io_timeout(struct wait_bit_key *word) | 614 | __sched int bit_wait_io_timeout(struct wait_bit_key *word, int mode) |
| 615 | { | 615 | { |
| 616 | unsigned long now = READ_ONCE(jiffies); | 616 | unsigned long now = READ_ONCE(jiffies); |
| 617 | if (time_after_eq(now, word->timeout)) | 617 | if (time_after_eq(now, word->timeout)) |
| 618 | return -EAGAIN; | 618 | return -EAGAIN; |
| 619 | io_schedule_timeout(word->timeout - now); | 619 | io_schedule_timeout(word->timeout - now); |
| 620 | if (signal_pending(current)) | 620 | if (signal_pending_state(mode, current)) |
| 621 | return -EINTR; | 621 | return -EINTR; |
| 622 | return 0; | 622 | return 0; |
| 623 | } | 623 | } |
| @@ -531,7 +531,7 @@ static int __init cpu_stop_init(void) · 530 unmodified lines | |||
| 531 | } | 531 | } |
| 532 | early_initcall(cpu_stop_init); | 532 | early_initcall(cpu_stop_init); |
| 533 | 533 | ||
| 534 | #ifdef CONFIG_STOP_MACHINE | 534 | #if defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU) |
| 535 | 535 | ||
| 536 | static int __stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus) | 536 | static int __stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus) |
| 537 | { | 537 | { |
| @@ -631,4 +631,4 @@ int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, · 93 unmodified lines | |||
| 631 | return ret ?: done.ret; | 631 | return ret ?: done.ret; |
| 632 | } | 632 | } |
| 633 | 633 | ||
| 634 | #endif /* CONFIG_STOP_MACHINE */ | 634 | #endif /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */ |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * trace event based perf event profiling/tracing | 2 | * trace event based perf event profiling/tracing |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009 Red Hat Inc, Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2009 Red Hat Inc, Peter Zijlstra |
| 5 | * Copyright (C) 2009-2010 Frederic Weisbecker <fweisbec@gmail.com> | 5 | * Copyright (C) 2009-2010 Frederic Weisbecker <fweisbec@gmail.com> |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * | 5 | * |
| 6 | * Copyright (c) 2007-2008 Joern Engel <joern@logfs.org> | 6 | * Copyright (c) 2007-2008 Joern Engel <joern@logfs.org> |
| 7 | * Bits and pieces stolen from Peter Zijlstra's code, which is | 7 | * Bits and pieces stolen from Peter Zijlstra's code, which is |
| 8 | * Copyright 2007, Red Hat Inc. Peter Zijlstra <pzijlstr@redhat.com> | 8 | * Copyright 2007, Red Hat Inc. Peter Zijlstra |
| 9 | * GPLv2 | 9 | * GPLv2 |
| 10 | * | 10 | * |
| 11 | * see http://programming.kicks-ass.net/kernel-patches/vma_lookup/btree.patch | 11 | * see http://programming.kicks-ass.net/kernel-patches/vma_lookup/btree.patch |
| @@ -1464,7 +1464,7 @@ void debug_dma_alloc_coherent(struct device *dev, size_t size, · 1463 unmodified lines | |||
| 1464 | entry->type = dma_debug_coherent; | 1464 | entry->type = dma_debug_coherent; |
| 1465 | entry->dev = dev; | 1465 | entry->dev = dev; |
| 1466 | entry->pfn = page_to_pfn(virt_to_page(virt)); | 1466 | entry->pfn = page_to_pfn(virt_to_page(virt)); |
| 1467 | entry->offset = (size_t) virt & PAGE_MASK; | 1467 | entry->offset = (size_t) virt & ~PAGE_MASK; |
| 1468 | entry->size = size; | 1468 | entry->size = size; |
| 1469 | entry->dev_addr = dma_addr; | 1469 | entry->dev_addr = dma_addr; |
| 1470 | entry->direction = DMA_BIDIRECTIONAL; | 1470 | entry->direction = DMA_BIDIRECTIONAL; |
| @@ -1480,7 +1480,7 @@ void debug_dma_free_coherent(struct device *dev, size_t size, · 9 unmodified lines | |||
| 1480 | .type = dma_debug_coherent, | 1480 | .type = dma_debug_coherent, |
| 1481 | .dev = dev, | 1481 | .dev = dev, |
| 1482 | .pfn = page_to_pfn(virt_to_page(virt)), | 1482 | .pfn = page_to_pfn(virt_to_page(virt)), |
| 1483 | .offset = (size_t) virt & PAGE_MASK, | 1483 | .offset = (size_t) virt & ~PAGE_MASK, |
| 1484 | .dev_addr = addr, | 1484 | .dev_addr = addr, |
| 1485 | .size = size, | 1485 | .size = size, |
| 1486 | .direction = DMA_BIDIRECTIONAL, | 1486 | .direction = DMA_BIDIRECTIONAL, |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Floating proportions | 2 | * Floating proportions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 4 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 5 | * | 5 | * |
| 6 | * Description: | 6 | * Description: |
| 7 | * | 7 | * |
| @@ -389,33 +389,31 @@ static bool rhashtable_check_elasticity(struct rhashtable *ht, · 388 unmodified lines | |||
| 389 | return false; | 389 | return false; |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | int rhashtable_insert_rehash(struct rhashtable *ht) | 392 | int rhashtable_insert_rehash(struct rhashtable *ht, |
| 393 | struct bucket_table *tbl) | ||
| 393 | { | 394 | { |
| 394 | struct bucket_table *old_tbl; | 395 | struct bucket_table *old_tbl; |
| 395 | struct bucket_table *new_tbl; | 396 | struct bucket_table *new_tbl; |
| 396 | struct bucket_table *tbl; | ||
| 397 | unsigned int size; | 397 | unsigned int size; |
| 398 | int err; | 398 | int err; |
| 399 | 399 | ||
| 400 | old_tbl = rht_dereference_rcu(ht->tbl, ht); | 400 | old_tbl = rht_dereference_rcu(ht->tbl, ht); |
| 401 | tbl = rhashtable_last_table(ht, old_tbl); | ||
| 402 | 401 | ||
| 403 | size = tbl->size; | 402 | size = tbl->size; |
| 404 | 403 | ||
| 404 | err = -EBUSY; | ||
| 405 | |||
| 405 | if (rht_grow_above_75(ht, tbl)) | 406 | if (rht_grow_above_75(ht, tbl)) |
| 406 | size *= 2; | 407 | size *= 2; |
| 407 | /* Do not schedule more than one rehash */ | 408 | /* Do not schedule more than one rehash */ |
| 408 | else if (old_tbl != tbl) | 409 | else if (old_tbl != tbl) |
| 409 | return -EBUSY; | 410 | goto fail; |
| 411 | |||
| 412 | err = -ENOMEM; | ||
| 410 | 413 | ||
| 411 | new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC); | 414 | new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC); |
| 412 | if (new_tbl == NULL) { | 415 | if (new_tbl == NULL) |
| 413 | /* Schedule async resize/rehash to try allocation | 416 | goto fail; |
| 414 | * non-atomic context. | ||
| 415 | */ | ||
| 416 | schedule_work(&ht->run_work); | ||
| 417 | return -ENOMEM; | ||
| 418 | } | ||
| 419 | 417 | ||
| 420 | err = rhashtable_rehash_attach(ht, tbl, new_tbl); | 418 | err = rhashtable_rehash_attach(ht, tbl, new_tbl); |
| 421 | if (err) { | 419 | if (err) { |
| @@ -426,12 +424,24 @@ int rhashtable_insert_rehash(struct rhashtable *ht) · 4 unmodified lines | |||
| 426 | schedule_work(&ht->run_work); | 424 | schedule_work(&ht->run_work); |
| 427 | 425 | ||
| 428 | return err; | 426 | return err; |
| 427 | |||
| 428 | fail: | ||
| 429 | /* Do not fail the insert if someone else did a rehash. */ | ||
| 430 | if (likely(rcu_dereference_raw(tbl->future_tbl))) | ||
| 431 | return 0; | ||
| 432 | |||
| 433 | /* Schedule async rehash to retry allocation in process context. */ | ||
| 434 | if (err == -ENOMEM) | ||
| 435 | schedule_work(&ht->run_work); | ||
| 436 | |||
| 437 | return err; | ||
| 429 | } | 438 | } |
| 430 | EXPORT_SYMBOL_GPL(rhashtable_insert_rehash); | 439 | EXPORT_SYMBOL_GPL(rhashtable_insert_rehash); |
| 431 | 440 | ||
| 432 | int rhashtable_insert_slow(struct rhashtable *ht, const void *key, | 441 | struct bucket_table *rhashtable_insert_slow(struct rhashtable *ht, |
| 433 | struct rhash_head *obj, | 442 | const void *key, |
| 434 | struct bucket_table *tbl) | 443 | struct rhash_head *obj, |
| 444 | struct bucket_table *tbl) | ||
| 435 | { | 445 | { |
| 436 | struct rhash_head *head; | 446 | struct rhash_head *head; |
| 437 | unsigned int hash; | 447 | unsigned int hash; |
| @@ -467,7 +477,12 @@ int rhashtable_insert_slow(struct rhashtable *ht, const void *key, · 29 unmodified lines | |||
| 467 | exit: | 477 | exit: |
| 468 | spin_unlock(rht_bucket_lock(tbl, hash)); | 478 | spin_unlock(rht_bucket_lock(tbl, hash)); |
| 469 | 479 | ||
| 470 | return err; | 480 | if (err == 0) |
| 481 | return NULL; | ||
| 482 | else if (err == -EAGAIN) | ||
| 483 | return tbl; | ||
| 484 | else | ||
| 485 | return ERR_PTR(err); | ||
| 471 | } | 486 | } |
| 472 | EXPORT_SYMBOL_GPL(rhashtable_insert_slow); | 487 | EXPORT_SYMBOL_GPL(rhashtable_insert_slow); |
| 473 | 488 | ||
| @@ -503,10 +518,10 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter) · 29 unmodified lines | |||
| 503 | if (!iter->walker) | 518 | if (!iter->walker) |
| 504 | return -ENOMEM; | 519 | return -ENOMEM; |
| 505 | 520 | ||
| 506 | mutex_lock(&ht->mutex); | 521 | spin_lock(&ht->lock); |
| 507 | iter->walker->tbl = rht_dereference(ht->tbl, ht); | 522 | iter->walker->tbl = rht_dereference(ht->tbl, ht); |
| 508 | list_add(&iter->walker->list, &iter->walker->tbl->walkers); | 523 | list_add(&iter->walker->list, &iter->walker->tbl->walkers); |
| 509 | mutex_unlock(&ht->mutex); | 524 | spin_unlock(&ht->lock); |
| 510 | 525 | ||
| 511 | return 0; | 526 | return 0; |
| 512 | } | 527 | } |
| @@ -520,10 +535,10 @@ EXPORT_SYMBOL_GPL(rhashtable_walk_init); · 7 unmodified lines | |||
| 520 | */ | 535 | */ |
| 521 | void rhashtable_walk_exit(struct rhashtable_iter *iter) | 536 | void rhashtable_walk_exit(struct rhashtable_iter *iter) |
| 522 | { | 537 | { |
| 523 | mutex_lock(&iter->ht->mutex); | 538 | spin_lock(&iter->ht->lock); |
| 524 | if (iter->walker->tbl) | 539 | if (iter->walker->tbl) |
| 525 | list_del(&iter->walker->list); | 540 | list_del(&iter->walker->list); |
| 526 | mutex_unlock(&iter->ht->mutex); | 541 | spin_unlock(&iter->ht->lock); |
| 527 | kfree(iter->walker); | 542 | kfree(iter->walker); |
| 528 | } | 543 | } |
| 529 | EXPORT_SYMBOL_GPL(rhashtable_walk_exit); | 544 | EXPORT_SYMBOL_GPL(rhashtable_walk_exit); |
| @@ -547,14 +562,12 @@ int rhashtable_walk_start(struct rhashtable_iter *iter) · 17 unmodified lines | |||
| 547 | { | 562 | { |
| 548 | struct rhashtable *ht = iter->ht; | 563 | struct rhashtable *ht = iter->ht; |
| 549 | 564 | ||
| 550 | mutex_lock(&ht->mutex); | 565 | rcu_read_lock(); |
| 551 | 566 | ||
| 567 | spin_lock(&ht->lock); | ||
| 552 | if (iter->walker->tbl) | 568 | if (iter->walker->tbl) |
| 553 | list_del(&iter->walker->list); | 569 | list_del(&iter->walker->list); |
| 554 | 570 | spin_unlock(&ht->lock); | |
| 555 | rcu_read_lock(); | ||
| 556 | |||
| 557 | mutex_unlock(&ht->mutex); | ||
| 558 | 571 | ||
| 559 | if (!iter->walker->tbl) { | 572 | if (!iter->walker->tbl) { |
| 560 | iter->walker->tbl = rht_dereference_rcu(ht->tbl, ht); | 573 | iter->walker->tbl = rht_dereference_rcu(ht->tbl, ht); |
| @@ -723,9 +736,6 @@ int rhashtable_init(struct rhashtable *ht, · 162 unmodified lines | |||
| 723 | if (params->nulls_base && params->nulls_base < (1U << RHT_BASE_SHIFT)) | 736 | if (params->nulls_base && params->nulls_base < (1U << RHT_BASE_SHIFT)) |
| 724 | return -EINVAL; | 737 | return -EINVAL; |
| 725 | 738 | ||
| 726 | if (params->nelem_hint) | ||
| 727 | size = rounded_hashtable_size(params); | ||
| 728 | |||
| 729 | memset(ht, 0, sizeof(*ht)); | 739 | memset(ht, 0, sizeof(*ht)); |
| 730 | mutex_init(&ht->mutex); | 740 | mutex_init(&ht->mutex); |
| 731 | spin_lock_init(&ht->lock); | 741 | spin_lock_init(&ht->lock); |
| @@ -745,6 +755,9 @@ int rhashtable_init(struct rhashtable *ht, · 13 unmodified lines | |||
| 745 | 755 | ||
| 746 | ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE); | 756 | ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE); |
| 747 | 757 | ||
| 758 | if (params->nelem_hint) | ||
| 759 | size = rounded_hashtable_size(&ht->p); | ||
| 760 | |||
| 748 | /* The maximum (not average) chain length grows with the | 761 | /* The maximum (not average) chain length grows with the |
| 749 | * size of the hash table, at a rate of (log N)/(log log N). | 762 | * size of the hash table, at a rate of (log N)/(log log N). |
| 750 | * The value of 16 is selected so that even if the hash | 763 | * The value of 16 is selected so that even if the hash |
| @@ -957,8 +957,9 @@ EXPORT_SYMBOL(congestion_wait); · 956 unmodified lines | |||
| 957 | * jiffies for either a BDI to exit congestion of the given @sync queue | 957 | * jiffies for either a BDI to exit congestion of the given @sync queue |
| 958 | * or a write to complete. | 958 | * or a write to complete. |
| 959 | * | 959 | * |
| 960 | * In the absence of zone congestion, cond_resched() is called to yield | 960 | * In the absence of zone congestion, a short sleep or a cond_resched is |
| 961 | * the processor if necessary but otherwise does not sleep. | 961 | * performed to yield the processor and to allow other subsystems to make |
| 962 | * a forward progress. | ||
| 962 | * | 963 | * |
| 963 | * The return value is 0 if the sleep is for the full timeout. Otherwise, | 964 | * The return value is 0 if the sleep is for the full timeout. Otherwise, |
| 964 | * it is the number of jiffies that were still remaining when the function | 965 | * it is the number of jiffies that were still remaining when the function |
| @@ -978,7 +979,19 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout) · 13 unmodified lines | |||
| 978 | */ | 979 | */ |
| 979 | if (atomic_read(&nr_wb_congested[sync]) == 0 || | 980 | if (atomic_read(&nr_wb_congested[sync]) == 0 || |
| 980 | !test_bit(ZONE_CONGESTED, &zone->flags)) { | 981 | !test_bit(ZONE_CONGESTED, &zone->flags)) { |
| 981 | cond_resched(); | 982 | |
| 983 | /* | ||
| 984 | * Memory allocation/reclaim might be called from a WQ | ||
| 985 | * context and the current implementation of the WQ | ||
| 986 | * concurrency control doesn't recognize that a particular | ||
| 987 | * WQ is congested if the worker thread is looping without | ||
| 988 | * ever sleeping. Therefore we have to do a short sleep | ||
| 989 | * here rather than calling cond_resched(). | ||
| 990 | */ | ||
| 991 | if (current->flags & PF_WQ_WORKER) | ||
| 992 | schedule_timeout(1); | ||
| 993 | else | ||
| 994 | cond_resched(); | ||
| 982 | 995 | ||
| 983 | /* In case we scheduled, work out time remaining */ | 996 | /* In case we scheduled, work out time remaining */ |
| 984 | ret = timeout - (jiffies - start); | 997 | ret = timeout - (jiffies - start); |
| @@ -372,8 +372,10 @@ retry_locked: · 371 unmodified lines | |||
| 372 | spin_unlock(&resv->lock); | 372 | spin_unlock(&resv->lock); |
| 373 | 373 | ||
| 374 | trg = kmalloc(sizeof(*trg), GFP_KERNEL); | 374 | trg = kmalloc(sizeof(*trg), GFP_KERNEL); |
| 375 | if (!trg) | 375 | if (!trg) { |
| 376 | kfree(nrg); | ||
| 376 | return -ENOMEM; | 377 | return -ENOMEM; |
| 378 | } | ||
| 377 | 379 | ||
| 378 | spin_lock(&resv->lock); | 380 | spin_lock(&resv->lock); |
| 379 | list_add(&trg->link, &resv->region_cache); | 381 | list_add(&trg->link, &resv->region_cache); |
| @@ -483,8 +485,16 @@ static long region_del(struct resv_map *resv, long f, long t) · 103 unmodified lines | |||
| 483 | retry: | 485 | retry: |
| 484 | spin_lock(&resv->lock); | 486 | spin_lock(&resv->lock); |
| 485 | list_for_each_entry_safe(rg, trg, head, link) { | 487 | list_for_each_entry_safe(rg, trg, head, link) { |
| 486 | if (rg->to <= f) | 488 | /* |
| 489 | * Skip regions before the range to be deleted. file_region | ||
| 490 | * ranges are normally of the form [from, to). However, there | ||
| 491 | * may be a "placeholder" entry in the map which is of the form | ||
| 492 | * (from, to) with from == to. Check for placeholder entries | ||
| 493 | * at the beginning of the range to be deleted. | ||
| 494 | */ | ||
| 495 | if (rg->to <= f && (rg->to != rg->from || rg->to != f)) | ||
| 487 | continue; | 496 | continue; |
| 497 | |||
| 488 | if (rg->from >= t) | 498 | if (rg->from >= t) |
| 489 | break; | 499 | break; |
| 490 | 500 | ||
| @@ -1886,7 +1896,10 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, · 1395 unmodified lines | |||
| 1886 | page = __alloc_buddy_huge_page_with_mpol(h, vma, addr); | 1896 | page = __alloc_buddy_huge_page_with_mpol(h, vma, addr); |
| 1887 | if (!page) | 1897 | if (!page) |
| 1888 | goto out_uncharge_cgroup; | 1898 | goto out_uncharge_cgroup; |
| 1889 | 1899 | if (!avoid_reserve && vma_has_reserves(vma, gbl_chg)) { | |
| 1900 | SetPagePrivate(page); | ||
| 1901 | h->resv_huge_pages--; | ||
| 1902 | } | ||
| 1890 | spin_lock(&hugetlb_lock); | 1903 | spin_lock(&hugetlb_lock); |
| 1891 | list_move(&page->lru, &h->hugepage_activelist); | 1904 | list_move(&page->lru, &h->hugepage_activelist); |
| 1892 | /* Fall through */ | 1905 | /* Fall through */ |
| @@ -3693,12 +3706,12 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, · 1800 unmodified lines | |||
| 3693 | } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) | 3706 | } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) |
| 3694 | return VM_FAULT_HWPOISON_LARGE | | 3707 | return VM_FAULT_HWPOISON_LARGE | |
| 3695 | VM_FAULT_SET_HINDEX(hstate_index(h)); | 3708 | VM_FAULT_SET_HINDEX(hstate_index(h)); |
| 3709 | } else { | ||
| 3710 | ptep = huge_pte_alloc(mm, address, huge_page_size(h)); | ||
| 3711 | if (!ptep) | ||
| 3712 | return VM_FAULT_OOM; | ||
| 3696 | } | 3713 | } |
| 3697 | 3714 | ||
| 3698 | ptep = huge_pte_alloc(mm, address, huge_page_size(h)); | ||
| 3699 | if (!ptep) | ||
| 3700 | return VM_FAULT_OOM; | ||
| 3701 | |||
| 3702 | mapping = vma->vm_file->f_mapping; | 3715 | mapping = vma->vm_file->f_mapping; |
| 3703 | idx = vma_hugecache_offset(h, vma, address); | 3716 | idx = vma_hugecache_offset(h, vma, address); |
| 3704 | 3717 | ||
| @@ -2128,7 +2128,7 @@ done_restock: · 2127 unmodified lines | |||
| 2128 | */ | 2128 | */ |
| 2129 | do { | 2129 | do { |
| 2130 | if (page_counter_read(&memcg->memory) > memcg->high) { | 2130 | if (page_counter_read(&memcg->memory) > memcg->high) { |
| 2131 | current->memcg_nr_pages_over_high += nr_pages; | 2131 | current->memcg_nr_pages_over_high += batch; |
| 2132 | set_notify_resume(current); | 2132 | set_notify_resume(current); |
| 2133 | break; | 2133 | break; |
| 2134 | } | 2134 | } |
| @@ -4779,23 +4779,18 @@ static void mem_cgroup_clear_mc(void) · 2644 unmodified lines | |||
| 4779 | spin_unlock(&mc.lock); | 4779 | spin_unlock(&mc.lock); |
| 4780 | } | 4780 | } |
| 4781 | 4781 | ||
| 4782 | static int mem_cgroup_can_attach(struct cgroup_subsys_state *css, | 4782 | static int mem_cgroup_can_attach(struct cgroup_taskset *tset) |
| 4783 | struct cgroup_taskset *tset) | ||
| 4784 | { | 4783 | { |
| 4785 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 4784 | struct cgroup_subsys_state *css; |
| 4785 | struct mem_cgroup *memcg; | ||
| 4786 | struct mem_cgroup *from; | 4786 | struct mem_cgroup *from; |
| 4787 | struct task_struct *leader, *p; | 4787 | struct task_struct *leader, *p; |
| 4788 | struct mm_struct *mm; | 4788 | struct mm_struct *mm; |
| 4789 | unsigned long move_flags; | 4789 | unsigned long move_flags; |
| 4790 | int ret = 0; | 4790 | int ret = 0; |
| 4791 | 4791 | ||
| 4792 | /* | 4792 | /* charge immigration isn't supported on the default hierarchy */ |
| 4793 | * We are now commited to this value whatever it is. Changes in this | 4793 | if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) |
| 4794 | * tunable will only affect upcoming migrations, not the current one. | ||
| 4795 | * So we need to save it, and keep it going. | ||
| 4796 | */ | ||
| 4797 | move_flags = READ_ONCE(memcg->move_charge_at_immigrate); | ||
| 4798 | if (!move_flags) | ||
| 4799 | return 0; | 4794 | return 0; |
| 4800 | 4795 | ||
| 4801 | /* | 4796 | /* |
| @@ -4805,13 +4800,23 @@ static int mem_cgroup_can_attach(struct cgroup_subsys_state *css, · 3 unmodified lines | |||
| 4805 | * multiple. | 4800 | * multiple. |
| 4806 | */ | 4801 | */ |
| 4807 | p = NULL; | 4802 | p = NULL; |
| 4808 | cgroup_taskset_for_each_leader(leader, tset) { | 4803 | cgroup_taskset_for_each_leader(leader, css, tset) { |
| 4809 | WARN_ON_ONCE(p); | 4804 | WARN_ON_ONCE(p); |
| 4810 | p = leader; | 4805 | p = leader; |
| 4806 | memcg = mem_cgroup_from_css(css); | ||
| 4811 | } | 4807 | } |
| 4812 | if (!p) | 4808 | if (!p) |
| 4813 | return 0; | 4809 | return 0; |
| 4814 | 4810 | ||
| 4811 | /* | ||
| 4812 | * We are now commited to this value whatever it is. Changes in this | ||
| 4813 | * tunable will only affect upcoming migrations, not the current one. | ||
| 4814 | * So we need to save it, and keep it going. | ||
| 4815 | */ | ||
| 4816 | move_flags = READ_ONCE(memcg->move_charge_at_immigrate); | ||
| 4817 | if (!move_flags) | ||
| 4818 | return 0; | ||
| 4819 | |||
| 4815 | from = mem_cgroup_from_task(p); | 4820 | from = mem_cgroup_from_task(p); |
| 4816 | 4821 | ||
| 4817 | VM_BUG_ON(from == memcg); | 4822 | VM_BUG_ON(from == memcg); |
| @@ -4842,8 +4847,7 @@ static int mem_cgroup_can_attach(struct cgroup_subsys_state *css, · 24 unmodified lines | |||
| 4842 | return ret; | 4847 | return ret; |
| 4843 | } | 4848 | } |
| 4844 | 4849 | ||
| 4845 | static void mem_cgroup_cancel_attach(struct cgroup_subsys_state *css, | 4850 | static void mem_cgroup_cancel_attach(struct cgroup_taskset *tset) |
| 4846 | struct cgroup_taskset *tset) | ||
| 4847 | { | 4851 | { |
| 4848 | if (mc.to) | 4852 | if (mc.to) |
| 4849 | mem_cgroup_clear_mc(); | 4853 | mem_cgroup_clear_mc(); |
| @@ -4985,10 +4989,10 @@ retry: · 135 unmodified lines | |||
| 4985 | atomic_dec(&mc.from->moving_account); | 4989 | atomic_dec(&mc.from->moving_account); |
| 4986 | } | 4990 | } |
| 4987 | 4991 | ||
| 4988 | static void mem_cgroup_move_task(struct cgroup_subsys_state *css, | 4992 | static void mem_cgroup_move_task(struct cgroup_taskset *tset) |
| 4989 | struct cgroup_taskset *tset) | ||
| 4990 | { | 4993 | { |
| 4991 | struct task_struct *p = cgroup_taskset_first(tset); | 4994 | struct cgroup_subsys_state *css; |
| 4995 | struct task_struct *p = cgroup_taskset_first(tset, &css); | ||
| 4992 | struct mm_struct *mm = get_task_mm(p); | 4996 | struct mm_struct *mm = get_task_mm(p); |
| 4993 | 4997 | ||
| 4994 | if (mm) { | 4998 | if (mm) { |
| @@ -5000,17 +5004,14 @@ static void mem_cgroup_move_task(struct cgroup_subsys_state *css, · 5 unmodified lines | |||
| 5000 | mem_cgroup_clear_mc(); | 5004 | mem_cgroup_clear_mc(); |
| 5001 | } | 5005 | } |
| 5002 | #else /* !CONFIG_MMU */ | 5006 | #else /* !CONFIG_MMU */ |
| 5003 | static int mem_cgroup_can_attach(struct cgroup_subsys_state *css, | 5007 | static int mem_cgroup_can_attach(struct cgroup_taskset *tset) |
| 5004 | struct cgroup_taskset *tset) | ||
| 5005 | { | 5008 | { |
| 5006 | return 0; | 5009 | return 0; |
| 5007 | } | 5010 | } |
| 5008 | static void mem_cgroup_cancel_attach(struct cgroup_subsys_state *css, | 5011 | static void mem_cgroup_cancel_attach(struct cgroup_taskset *tset) |
| 5009 | struct cgroup_taskset *tset) | ||
| 5010 | { | 5012 | { |
| 5011 | } | 5013 | } |
| 5012 | static void mem_cgroup_move_task(struct cgroup_subsys_state *css, | 5014 | static void mem_cgroup_move_task(struct cgroup_taskset *tset) |
| 5013 | struct cgroup_taskset *tset) | ||
| 5014 | { | 5015 | { |
| 5015 | } | 5016 | } |
| 5016 | #endif | 5017 | #endif |
| @@ -5511,11 +5512,11 @@ void mem_cgroup_uncharge_list(struct list_head *page_list) · 494 unmodified lines | |||
| 5511 | * mem_cgroup_replace_page - migrate a charge to another page | 5512 | * mem_cgroup_replace_page - migrate a charge to another page |
| 5512 | * @oldpage: currently charged page | 5513 | * @oldpage: currently charged page |
| 5513 | * @newpage: page to transfer the charge to | 5514 | * @newpage: page to transfer the charge to |
| 5514 | * @lrucare: either or both pages might be on the LRU already | ||
| 5515 | * | 5515 | * |
| 5516 | * Migrate the charge from @oldpage to @newpage. | 5516 | * Migrate the charge from @oldpage to @newpage. |
| 5517 | * | 5517 | * |
| 5518 | * Both pages must be locked, @newpage->mapping must be set up. | 5518 | * Both pages must be locked, @newpage->mapping must be set up. |
| 5519 | * Either or both pages might be on the LRU already. | ||
| 5519 | */ | 5520 | */ |
| 5520 | void mem_cgroup_replace_page(struct page *oldpage, struct page *newpage) | 5521 | void mem_cgroup_replace_page(struct page *oldpage, struct page *newpage) |
| 5521 | { | 5522 | { |
| @@ -608,6 +608,8 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p, · 607 unmodified lines | |||
| 608 | continue; | 608 | continue; |
| 609 | if (unlikely(p->flags & PF_KTHREAD)) | 609 | if (unlikely(p->flags & PF_KTHREAD)) |
| 610 | continue; | 610 | continue; |
| 611 | if (is_global_init(p)) | ||
| 612 | continue; | ||
| 611 | if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) | 613 | if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) |
| 612 | continue; | 614 | continue; |
| 613 | 615 | ||
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | * mm/page-writeback.c | 2 | * mm/page-writeback.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2002, Linus Torvalds. | 4 | * Copyright (C) 2002, Linus Torvalds. |
| 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | 5 | * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra |
| 6 | * | 6 | * |
| 7 | * Contains functions related to writing back dirty pages at the | 7 | * Contains functions related to writing back dirty pages at the |
| 8 | * address_space level. | 8 | * address_space level. |
| @@ -3647,8 +3647,9 @@ static void show_migration_types(unsigned char type) · 3646 unmodified lines | |||
| 3647 | { | 3647 | { |
| 3648 | static const char types[MIGRATE_TYPES] = { | 3648 | static const char types[MIGRATE_TYPES] = { |
| 3649 | [MIGRATE_UNMOVABLE] = 'U', | 3649 | [MIGRATE_UNMOVABLE] = 'U', |
| 3650 | [MIGRATE_RECLAIMABLE] = 'E', | ||
| 3651 | [MIGRATE_MOVABLE] = 'M', | 3650 | [MIGRATE_MOVABLE] = 'M', |
| 3651 | [MIGRATE_RECLAIMABLE] = 'E', | ||
| 3652 | [MIGRATE_HIGHATOMIC] = 'H', | ||
| 3652 | #ifdef CONFIG_CMA | 3653 | #ifdef CONFIG_CMA |
| 3653 | [MIGRATE_CMA] = 'C', | 3654 | [MIGRATE_CMA] = 'C', |
| 3654 | #endif | 3655 | #endif |
| @@ -843,14 +843,14 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc) · 842 unmodified lines | |||
| 843 | list_add_tail(&info->swaplist, &shmem_swaplist); | 843 | list_add_tail(&info->swaplist, &shmem_swaplist); |
| 844 | 844 | ||
| 845 | if (add_to_swap_cache(page, swap, GFP_ATOMIC) == 0) { | 845 | if (add_to_swap_cache(page, swap, GFP_ATOMIC) == 0) { |
| 846 | swap_shmem_alloc(swap); | ||
| 847 | shmem_delete_from_page_cache(page, swp_to_radix_entry(swap)); | ||
| 848 | |||
| 849 | spin_lock(&info->lock); | 846 | spin_lock(&info->lock); |
| 850 | info->swapped++; | ||
| 851 | shmem_recalc_inode(inode); | 847 | shmem_recalc_inode(inode); |
| 848 | info->swapped++; | ||
| 852 | spin_unlock(&info->lock); | 849 | spin_unlock(&info->lock); |
| 853 | 850 | ||
| 851 | swap_shmem_alloc(swap); | ||
| 852 | shmem_delete_from_page_cache(page, swp_to_radix_entry(swap)); | ||
| 853 | |||
| 854 | mutex_unlock(&shmem_swaplist_mutex); | 854 | mutex_unlock(&shmem_swaplist_mutex); |
| 855 | BUG_ON(page_mapped(page)); | 855 | BUG_ON(page_mapped(page)); |
| 856 | swap_writepage(page, wbc); | 856 | swap_writepage(page, wbc); |
| @@ -1078,7 +1078,7 @@ repeat: · 221 unmodified lines | |||
| 1078 | if (sgp != SGP_WRITE && sgp != SGP_FALLOC && | 1078 | if (sgp != SGP_WRITE && sgp != SGP_FALLOC && |
| 1079 | ((loff_t)index << PAGE_CACHE_SHIFT) >= i_size_read(inode)) { | 1079 | ((loff_t)index << PAGE_CACHE_SHIFT) >= i_size_read(inode)) { |
| 1080 | error = -EINVAL; | 1080 | error = -EINVAL; |
| 1081 | goto failed; | 1081 | goto unlock; |
| 1082 | } | 1082 | } |
| 1083 | 1083 | ||
| 1084 | if (page && sgp == SGP_WRITE) | 1084 | if (page && sgp == SGP_WRITE) |
| @@ -1246,11 +1246,15 @@ clear: · 161 unmodified lines | |||
| 1246 | /* Perhaps the file has been truncated since we checked */ | 1246 | /* Perhaps the file has been truncated since we checked */ |
| 1247 | if (sgp != SGP_WRITE && sgp != SGP_FALLOC && | 1247 | if (sgp != SGP_WRITE && sgp != SGP_FALLOC && |
| 1248 | ((loff_t)index << PAGE_CACHE_SHIFT) >= i_size_read(inode)) { | 1248 | ((loff_t)index << PAGE_CACHE_SHIFT) >= i_size_read(inode)) { |
| 1249 | if (alloced) { | ||
| 1250 | ClearPageDirty(page); | ||
| 1251 | delete_from_page_cache(page); | ||
| 1252 | spin_lock(&info->lock); | ||
| 1253 | shmem_recalc_inode(inode); | ||
| 1254 | spin_unlock(&info->lock); | ||
| 1255 | } | ||
| 1249 | error = -EINVAL; | 1256 | error = -EINVAL; |
| 1250 | if (alloced) | 1257 | goto unlock; |
| 1251 | goto trunc; | ||
| 1252 | else | ||
| 1253 | goto failed; | ||
| 1254 | } | 1258 | } |
| 1255 | *pagep = page; | 1259 | *pagep = page; |
| 1256 | return 0; | 1260 | return 0; |
| @@ -1258,23 +1262,13 @@ clear: · 1 unmodified line | |||
| 1258 | /* | 1262 | /* |
| 1259 | * Error recovery. | 1263 | * Error recovery. |
| 1260 | */ | 1264 | */ |
| 1261 | trunc: | ||
| 1262 | info = SHMEM_I(inode); | ||
| 1263 | ClearPageDirty(page); | ||
| 1264 | delete_from_page_cache(page); | ||
| 1265 | spin_lock(&info->lock); | ||
| 1266 | info->alloced--; | ||
| 1267 | inode->i_blocks -= BLOCKS_PER_PAGE; | ||
| 1268 | spin_unlock(&info->lock); | ||
| 1269 | decused: | 1265 | decused: |
| 1270 | sbinfo = SHMEM_SB(inode->i_sb); | ||
| 1271 | if (sbinfo->max_blocks) | 1266 | if (sbinfo->max_blocks) |
| 1272 | percpu_counter_add(&sbinfo->used_blocks, -1); | 1267 | percpu_counter_add(&sbinfo->used_blocks, -1); |
| 1273 | unacct: | 1268 | unacct: |
| 1274 | shmem_unacct_blocks(info->flags, 1); | 1269 | shmem_unacct_blocks(info->flags, 1); |
| 1275 | failed: | 1270 | failed: |
| 1276 | if (swap.val && error != -EINVAL && | 1271 | if (swap.val && !shmem_confirm_swap(mapping, index, swap)) |
| 1277 | !shmem_confirm_swap(mapping, index, swap)) | ||
| 1278 | error = -EEXIST; | 1272 | error = -EEXIST; |
| 1279 | unlock: | 1273 | unlock: |
| 1280 | if (page) { | 1274 | if (page) { |
| @@ -921,8 +921,8 @@ static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat, · 920 unmodified lines | |||
| 921 | #ifdef CONFIG_PROC_FS | 921 | #ifdef CONFIG_PROC_FS |
| 922 | static char * const migratetype_names[MIGRATE_TYPES] = { | 922 | static char * const migratetype_names[MIGRATE_TYPES] = { |
| 923 | "Unmovable", | 923 | "Unmovable", |
| 924 | "Reclaimable", | ||
| 925 | "Movable", | 924 | "Movable", |
| 925 | "Reclaimable", | ||
| 926 | "HighAtomic", | 926 | "HighAtomic", |
| 927 | #ifdef CONFIG_CMA | 927 | #ifdef CONFIG_CMA |
| 928 | "CMA", | 928 | "CMA", |
| @@ -1379,6 +1379,7 @@ static const struct file_operations proc_vmstat_file_operations = { · 450 unmodified lines | |||
| 1379 | #endif /* CONFIG_PROC_FS */ | 1379 | #endif /* CONFIG_PROC_FS */ |
| 1380 | 1380 | ||
| 1381 | #ifdef CONFIG_SMP | 1381 | #ifdef CONFIG_SMP |
| 1382 | static struct workqueue_struct *vmstat_wq; | ||
| 1382 | static DEFINE_PER_CPU(struct delayed_work, vmstat_work); | 1383 | static DEFINE_PER_CPU(struct delayed_work, vmstat_work); |
| 1383 | int sysctl_stat_interval __read_mostly = HZ; | 1384 | int sysctl_stat_interval __read_mostly = HZ; |
| 1384 | static cpumask_var_t cpu_stat_off; | 1385 | static cpumask_var_t cpu_stat_off; |
| @@ -1391,7 +1392,7 @@ static void vmstat_update(struct work_struct *w) · 6 unmodified lines | |||
| 1391 | * to occur in the future. Keep on running the | 1392 | * to occur in the future. Keep on running the |
| 1392 | * update worker thread. | 1393 | * update worker thread. |
| 1393 | */ | 1394 | */ |
| 1394 | schedule_delayed_work_on(smp_processor_id(), | 1395 | queue_delayed_work_on(smp_processor_id(), vmstat_wq, |
| 1395 | this_cpu_ptr(&vmstat_work), | 1396 | this_cpu_ptr(&vmstat_work), |
| 1396 | round_jiffies_relative(sysctl_stat_interval)); | 1397 | round_jiffies_relative(sysctl_stat_interval)); |
| 1397 | } else { | 1398 | } else { |
| @@ -1460,7 +1461,7 @@ static void vmstat_shepherd(struct work_struct *w) · 62 unmodified lines | |||
| 1460 | if (need_update(cpu) && | 1461 | if (need_update(cpu) && |
| 1461 | cpumask_test_and_clear_cpu(cpu, cpu_stat_off)) | 1462 | cpumask_test_and_clear_cpu(cpu, cpu_stat_off)) |
| 1462 | 1463 | ||
| 1463 | schedule_delayed_work_on(cpu, | 1464 | queue_delayed_work_on(cpu, vmstat_wq, |
| 1464 | &per_cpu(vmstat_work, cpu), 0); | 1465 | &per_cpu(vmstat_work, cpu), 0); |
| 1465 | 1466 | ||
| 1466 | put_online_cpus(); | 1467 | put_online_cpus(); |
| @@ -1549,6 +1550,7 @@ static int __init setup_vmstat(void) · 82 unmodified lines | |||
| 1549 | 1550 | ||
| 1550 | start_shepherd_timer(); | 1551 | start_shepherd_timer(); |
| 1551 | cpu_notifier_register_done(); | 1552 | cpu_notifier_register_done(); |
| 1553 | vmstat_wq = alloc_workqueue("vmstat", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0); | ||
| 1552 | #endif | 1554 | #endif |
| 1553 | #ifdef CONFIG_PROC_FS | 1555 | #ifdef CONFIG_PROC_FS |
| 1554 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); | 1556 | proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); |
| @@ -541,6 +541,7 @@ static struct zswap_pool *zswap_pool_last_get(void) · 540 unmodified lines | |||
| 541 | return last; | 541 | return last; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | /* type and compressor must be null-terminated */ | ||
| 544 | static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor) | 545 | static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor) |
| 545 | { | 546 | { |
| 546 | struct zswap_pool *pool; | 547 | struct zswap_pool *pool; |
| @@ -548,10 +549,9 @@ static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor) · 1 unmodified line | |||
| 548 | assert_spin_locked(&zswap_pools_lock); | 549 | assert_spin_locked(&zswap_pools_lock); |
| 549 | 550 | ||
| 550 | list_for_each_entry_rcu(pool, &zswap_pools, list) { | 551 | list_for_each_entry_rcu(pool, &zswap_pools, list) { |
| 551 | if (strncmp(pool->tfm_name, compressor, sizeof(pool->tfm_name))) | 552 | if (strcmp(pool->tfm_name, compressor)) |
| 552 | continue; | 553 | continue; |
| 553 | if (strncmp(zpool_get_type(pool->zpool), type, | 554 | if (strcmp(zpool_get_type(pool->zpool), type)) |
| 554 | sizeof(zswap_zpool_type))) | ||
| 555 | continue; | 555 | continue; |
| 556 | /* if we can't get it, it's about to be destroyed */ | 556 | /* if we can't get it, it's about to be destroyed */ |
| 557 | if (!zswap_pool_get(pool)) | 557 | if (!zswap_pool_get(pool)) |
| @@ -805,6 +805,9 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol, · 804 unmodified lines | |||
| 805 | struct sock *sk; | 805 | struct sock *sk; |
| 806 | ax25_cb *ax25; | 806 | ax25_cb *ax25; |
| 807 | 807 | ||
| 808 | if (protocol < 0 || protocol > SK_PROTOCOL_MAX) | ||
| 809 | return -EINVAL; | ||
| 810 | |||
| 808 | if (!net_eq(net, &init_net)) | 811 | if (!net_eq(net, &init_net)) |
| 809 | return -EAFNOSUPPORT; | 812 | return -EAFNOSUPPORT; |
| 810 | 813 | ||
| @@ -566,6 +566,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) · 565 unmodified lines | |||
| 566 | int select; | 566 | int select; |
| 567 | batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key; | 567 | batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key; |
| 568 | struct batadv_dat_candidate *res; | 568 | struct batadv_dat_candidate *res; |
| 569 | struct batadv_dat_entry dat; | ||
| 569 | 570 | ||
| 570 | if (!bat_priv->orig_hash) | 571 | if (!bat_priv->orig_hash) |
| 571 | return NULL; | 572 | return NULL; |
| @@ -575,7 +576,9 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) · 3 unmodified lines | |||
| 575 | if (!res) | 576 | if (!res) |
| 576 | return NULL; | 577 | return NULL; |
| 577 | 578 | ||
| 578 | ip_key = (batadv_dat_addr_t)batadv_hash_dat(&ip_dst, | 579 | dat.ip = ip_dst; |
| 580 | dat.vid = 0; | ||
| 581 | ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat, | ||
| 579 | BATADV_DAT_ADDR_MAX); | 582 | BATADV_DAT_ADDR_MAX); |
| 580 | 583 | ||
| 581 | batadv_dbg(BATADV_DBG_DAT, bat_priv, | 584 | batadv_dbg(BATADV_DBG_DAT, bat_priv, |
| @@ -836,6 +836,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 835 unmodified lines | |||
| 836 | u8 *orig_addr; | 836 | u8 *orig_addr; |
| 837 | struct batadv_orig_node *orig_node = NULL; | 837 | struct batadv_orig_node *orig_node = NULL; |
| 838 | int check, hdr_size = sizeof(*unicast_packet); | 838 | int check, hdr_size = sizeof(*unicast_packet); |
| 839 | enum batadv_subtype subtype; | ||
| 839 | bool is4addr; | 840 | bool is4addr; |
| 840 | 841 | ||
| 841 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | 842 | unicast_packet = (struct batadv_unicast_packet *)skb->data; |
| @@ -863,10 +864,20 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 21 unmodified lines | |||
| 863 | /* packet for me */ | 864 | /* packet for me */ |
| 864 | if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { | 865 | if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { |
| 865 | if (is4addr) { | 866 | if (is4addr) { |
| 866 | batadv_dat_inc_counter(bat_priv, | 867 | subtype = unicast_4addr_packet->subtype; |
| 867 | unicast_4addr_packet->subtype); | 868 | batadv_dat_inc_counter(bat_priv, subtype); |
| 868 | orig_addr = unicast_4addr_packet->src; | 869 | |
| 869 | orig_node = batadv_orig_hash_find(bat_priv, orig_addr); | 870 | /* Only payload data should be considered for speedy |
| 871 | * join. For example, DAT also uses unicast 4addr | ||
| 872 | * types, but those packets should not be considered | ||
| 873 | * for speedy join, since the clients do not actually | ||
| 874 | * reside at the sending originator. | ||
| 875 | */ | ||
| 876 | if (subtype == BATADV_P_DATA) { | ||
| 877 | orig_addr = unicast_4addr_packet->src; | ||
| 878 | orig_node = batadv_orig_hash_find(bat_priv, | ||
| 879 | orig_addr); | ||
| 880 | } | ||
| 870 | } | 881 | } |
| 871 | 882 | ||
| 872 | if (batadv_dat_snoop_incoming_arp_request(bat_priv, skb, | 883 | if (batadv_dat_snoop_incoming_arp_request(bat_priv, skb, |
| @@ -68,13 +68,15 @@ static void batadv_tt_global_del(struct batadv_priv *bat_priv, · 67 unmodified lines | |||
| 68 | unsigned short vid, const char *message, | 68 | unsigned short vid, const char *message, |
| 69 | bool roaming); | 69 | bool roaming); |
| 70 | 70 | ||
| 71 | /* returns 1 if they are the same mac addr */ | 71 | /* returns 1 if they are the same mac addr and vid */ |
| 72 | static int batadv_compare_tt(const struct hlist_node *node, const void *data2) | 72 | static int batadv_compare_tt(const struct hlist_node *node, const void *data2) |
| 73 | { | 73 | { |
| 74 | const void *data1 = container_of(node, struct batadv_tt_common_entry, | 74 | const void *data1 = container_of(node, struct batadv_tt_common_entry, |
| 75 | hash_entry); | 75 | hash_entry); |
| 76 | const struct batadv_tt_common_entry *tt1 = data1; | ||
| 77 | const struct batadv_tt_common_entry *tt2 = data2; | ||
| 76 | 78 | ||
| 77 | return batadv_compare_eth(data1, data2); | 79 | return (tt1->vid == tt2->vid) && batadv_compare_eth(data1, data2); |
| 78 | } | 80 | } |
| 79 | 81 | ||
| 80 | /** | 82 | /** |
| @@ -1427,9 +1429,15 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv, · 1346 unmodified lines | |||
| 1427 | } | 1429 | } |
| 1428 | 1430 | ||
| 1429 | /* if the client was temporary added before receiving the first | 1431 | /* if the client was temporary added before receiving the first |
| 1430 | * OGM announcing it, we have to clear the TEMP flag | 1432 | * OGM announcing it, we have to clear the TEMP flag. Also, |
| 1433 | * remove the previous temporary orig node and re-add it | ||
| 1434 | * if required. If the orig entry changed, the new one which | ||
| 1435 | * is a non-temporary entry is preferred. | ||
| 1431 | */ | 1436 | */ |
| 1432 | common->flags &= ~BATADV_TT_CLIENT_TEMP; | 1437 | if (common->flags & BATADV_TT_CLIENT_TEMP) { |
| 1438 | batadv_tt_global_del_orig_list(tt_global_entry); | ||
| 1439 | common->flags &= ~BATADV_TT_CLIENT_TEMP; | ||
| 1440 | } | ||
| 1433 | 1441 | ||
| 1434 | /* the change can carry possible "attribute" flags like the | 1442 | /* the change can carry possible "attribute" flags like the |
| 1435 | * TT_CLIENT_WIFI, therefore they have to be copied in the | 1443 | * TT_CLIENT_WIFI, therefore they have to be copied in the |
| @@ -526,6 +526,9 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, · 525 unmodified lines | |||
| 526 | if (!addr || addr->sa_family != AF_BLUETOOTH) | 526 | if (!addr || addr->sa_family != AF_BLUETOOTH) |
| 527 | return -EINVAL; | 527 | return -EINVAL; |
| 528 | 528 | ||
| 529 | if (addr_len < sizeof(struct sockaddr_sco)) | ||
| 530 | return -EINVAL; | ||
| 531 | |||
| 529 | lock_sock(sk); | 532 | lock_sock(sk); |
| 530 | 533 | ||
| 531 | if (sk->sk_state != BT_OPEN) { | 534 | if (sk->sk_state != BT_OPEN) { |
| @@ -81,9 +81,11 @@ static void update_classid(struct cgroup_subsys_state *css, void *v) · 80 unmodified lines | |||
| 81 | css_task_iter_end(&it); | 81 | css_task_iter_end(&it); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | static void cgrp_attach(struct cgroup_subsys_state *css, | 84 | static void cgrp_attach(struct cgroup_taskset *tset) |
| 85 | struct cgroup_taskset *tset) | ||
| 86 | { | 85 | { |
| 86 | struct cgroup_subsys_state *css; | ||
| 87 | |||
| 88 | cgroup_taskset_first(tset, &css); | ||
| 87 | update_classid(css, | 89 | update_classid(css, |
| 88 | (void *)(unsigned long)css_cls_state(css)->classid); | 90 | (void *)(unsigned long)css_cls_state(css)->classid); |
| 89 | } | 91 | } |
| @@ -218,13 +218,14 @@ static int update_netprio(const void *v, struct file *file, unsigned n) · 217 unmodified lines | |||
| 218 | return 0; | 218 | return 0; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | static void net_prio_attach(struct cgroup_subsys_state *css, | 221 | static void net_prio_attach(struct cgroup_taskset *tset) |
| 222 | struct cgroup_taskset *tset) | ||
| 223 | { | 222 | { |
| 224 | struct task_struct *p; | 223 | struct task_struct *p; |
| 225 | void *v = (void *)(unsigned long)css->cgroup->id; | 224 | struct cgroup_subsys_state *css; |
| 225 | |||
| 226 | cgroup_taskset_for_each(p, css, tset) { | ||
| 227 | void *v = (void *)(unsigned long)css->cgroup->id; | ||
| 226 | 228 | ||
| 227 | cgroup_taskset_for_each(p, tset) { | ||
| 228 | task_lock(p); | 229 | task_lock(p); |
| 229 | iterate_fd(p->files, 0, update_netprio, v); | 230 | iterate_fd(p->files, 0, update_netprio, v); |
| 230 | task_unlock(p); | 231 | task_unlock(p); |
| @@ -3643,7 +3643,8 @@ static void __skb_complete_tx_timestamp(struct sk_buff *skb, · 3642 unmodified lines | |||
| 3643 | serr->ee.ee_info = tstype; | 3643 | serr->ee.ee_info = tstype; |
| 3644 | if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) { | 3644 | if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) { |
| 3645 | serr->ee.ee_data = skb_shinfo(skb)->tskey; | 3645 | serr->ee.ee_data = skb_shinfo(skb)->tskey; |
| 3646 | if (sk->sk_protocol == IPPROTO_TCP) | 3646 | if (sk->sk_protocol == IPPROTO_TCP && |
| 3647 | sk->sk_type == SOCK_STREAM) | ||
| 3647 | serr->ee.ee_data -= sk->sk_tskey; | 3648 | serr->ee.ee_data -= sk->sk_tskey; |
| 3648 | } | 3649 | } |
| 3649 | 3650 | ||
| @@ -4268,7 +4269,7 @@ static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb) · 618 unmodified lines | |||
| 4268 | return NULL; | 4269 | return NULL; |
| 4269 | } | 4270 | } |
| 4270 | 4271 | ||
| 4271 | memmove(skb->data - ETH_HLEN, skb->data - skb->mac_len, | 4272 | memmove(skb->data - ETH_HLEN, skb->data - skb->mac_len - VLAN_HLEN, |
| 4272 | 2 * ETH_ALEN); | 4273 | 2 * ETH_ALEN); |
| 4273 | skb->mac_header += VLAN_HLEN; | 4274 | skb->mac_header += VLAN_HLEN; |
| 4274 | return skb; | 4275 | return skb; |
| @@ -433,8 +433,6 @@ static bool sock_needs_netstamp(const struct sock *sk) · 432 unmodified lines | |||
| 433 | } | 433 | } |
| 434 | } | 434 | } |
| 435 | 435 | ||
| 436 | #define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE)) | ||
| 437 | |||
| 438 | static void sock_disable_timestamp(struct sock *sk, unsigned long flags) | 436 | static void sock_disable_timestamp(struct sock *sk, unsigned long flags) |
| 439 | { | 437 | { |
| 440 | if (sk->sk_flags & flags) { | 438 | if (sk->sk_flags & flags) { |
| @@ -874,7 +872,8 @@ set_rcvbuf: · 433 unmodified lines | |||
| 874 | 872 | ||
| 875 | if (val & SOF_TIMESTAMPING_OPT_ID && | 873 | if (val & SOF_TIMESTAMPING_OPT_ID && |
| 876 | !(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)) { | 874 | !(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)) { |
| 877 | if (sk->sk_protocol == IPPROTO_TCP) { | 875 | if (sk->sk_protocol == IPPROTO_TCP && |
| 876 | sk->sk_type == SOCK_STREAM) { | ||
| 878 | if (sk->sk_state != TCP_ESTABLISHED) { | 877 | if (sk->sk_state != TCP_ESTABLISHED) { |
| 879 | ret = -EINVAL; | 878 | ret = -EINVAL; |
| 880 | break; | 879 | break; |
| @@ -1552,7 +1551,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) · 671 unmodified lines | |||
| 1552 | */ | 1551 | */ |
| 1553 | is_charged = sk_filter_charge(newsk, filter); | 1552 | is_charged = sk_filter_charge(newsk, filter); |
| 1554 | 1553 | ||
| 1555 | if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk))) { | 1554 | if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) { |
| 1556 | /* It is still raw copy of parent, so invalidate | 1555 | /* It is still raw copy of parent, so invalidate |
| 1557 | * destructor and make plain sk_free() */ | 1556 | * destructor and make plain sk_free() */ |
| 1558 | newsk->sk_destruct = NULL; | 1557 | newsk->sk_destruct = NULL; |
| @@ -678,6 +678,9 @@ static int dn_create(struct net *net, struct socket *sock, int protocol, · 677 unmodified lines | |||
| 678 | { | 678 | { |
| 679 | struct sock *sk; | 679 | struct sock *sk; |
| 680 | 680 | ||
| 681 | if (protocol < 0 || protocol > SK_PROTOCOL_MAX) | ||
| 682 | return -EINVAL; | ||
| 683 | |||
| 681 | if (!net_eq(net, &init_net)) | 684 | if (!net_eq(net, &init_net)) |
| 682 | return -EAFNOSUPPORT; | 685 | return -EAFNOSUPPORT; |
| 683 | 686 | ||
| @@ -257,6 +257,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, · 256 unmodified lines | |||
| 257 | int try_loading_module = 0; | 257 | int try_loading_module = 0; |
| 258 | int err; | 258 | int err; |
| 259 | 259 | ||
| 260 | if (protocol < 0 || protocol >= IPPROTO_MAX) | ||
| 261 | return -EINVAL; | ||
| 262 | |||
| 260 | sock->state = SS_UNCONNECTED; | 263 | sock->state = SS_UNCONNECTED; |
| 261 | 264 | ||
| 262 | /* Look for the requested type/protocol pair. */ | 265 | /* Look for the requested type/protocol pair. */ |
| @@ -1155,6 +1155,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, · 1154 unmodified lines | |||
| 1155 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 1155 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
| 1156 | { | 1156 | { |
| 1157 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); | 1157 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
| 1158 | struct netdev_notifier_changeupper_info *info; | ||
| 1158 | struct in_device *in_dev; | 1159 | struct in_device *in_dev; |
| 1159 | struct net *net = dev_net(dev); | 1160 | struct net *net = dev_net(dev); |
| 1160 | unsigned int flags; | 1161 | unsigned int flags; |
| @@ -1193,6 +1194,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo · 32 unmodified lines | |||
| 1193 | case NETDEV_CHANGEMTU: | 1194 | case NETDEV_CHANGEMTU: |
| 1194 | rt_cache_flush(net); | 1195 | rt_cache_flush(net); |
| 1195 | break; | 1196 | break; |
| 1197 | case NETDEV_CHANGEUPPER: | ||
| 1198 | info = ptr; | ||
| 1199 | /* flush all routes if dev is linked to or unlinked from | ||
| 1200 | * an L3 master device (e.g., VRF) | ||
| 1201 | */ | ||
| 1202 | if (info->upper_dev && netif_is_l3_master(info->upper_dev)) | ||
| 1203 | fib_disable_ip(dev, NETDEV_DOWN, true); | ||
| 1204 | break; | ||
| 1196 | } | 1205 | } |
| 1197 | return NOTIFY_DONE; | 1206 | return NOTIFY_DONE; |
| 1198 | } | 1207 | } |
| @@ -24,6 +24,7 @@ struct fou { · 23 unmodified lines | |||
| 24 | u16 type; | 24 | u16 type; |
| 25 | struct udp_offload udp_offloads; | 25 | struct udp_offload udp_offloads; |
| 26 | struct list_head list; | 26 | struct list_head list; |
| 27 | struct rcu_head rcu; | ||
| 27 | }; | 28 | }; |
| 28 | 29 | ||
| 29 | #define FOU_F_REMCSUM_NOPARTIAL BIT(0) | 30 | #define FOU_F_REMCSUM_NOPARTIAL BIT(0) |
| @@ -417,7 +418,7 @@ static void fou_release(struct fou *fou) · 387 unmodified lines | |||
| 417 | list_del(&fou->list); | 418 | list_del(&fou->list); |
| 418 | udp_tunnel_sock_release(sock); | 419 | udp_tunnel_sock_release(sock); |
| 419 | 420 | ||
| 420 | kfree(fou); | 421 | kfree_rcu(fou, rcu); |
| 421 | } | 422 | } |
| 422 | 423 | ||
| 423 | static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg) | 424 | static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg) |
| @@ -60,6 +60,7 @@ config NFT_REJECT_IPV4 · 59 unmodified lines | |||
| 60 | 60 | ||
| 61 | config NFT_DUP_IPV4 | 61 | config NFT_DUP_IPV4 |
| 62 | tristate "IPv4 nf_tables packet duplication support" | 62 | tristate "IPv4 nf_tables packet duplication support" |
| 63 | depends on !NF_CONNTRACK || NF_CONNTRACK | ||
| 63 | select NF_DUP_IPV4 | 64 | select NF_DUP_IPV4 |
| 64 | help | 65 | help |
| 65 | This module enables IPv4 packet duplication support for nf_tables. | 66 | This module enables IPv4 packet duplication support for nf_tables. |
| @@ -1493,7 +1493,7 @@ bool tcp_prequeue(struct sock *sk, struct sk_buff *skb) · 1492 unmodified lines | |||
| 1493 | if (likely(sk->sk_rx_dst)) | 1493 | if (likely(sk->sk_rx_dst)) |
| 1494 | skb_dst_drop(skb); | 1494 | skb_dst_drop(skb); |
| 1495 | else | 1495 | else |
| 1496 | skb_dst_force(skb); | 1496 | skb_dst_force_safe(skb); |
| 1497 | 1497 | ||
| 1498 | __skb_queue_tail(&tp->ucopy.prequeue, skb); | 1498 | __skb_queue_tail(&tp->ucopy.prequeue, skb); |
| 1499 | tp->ucopy.memory += skb->truesize; | 1499 | tp->ucopy.memory += skb->truesize; |
| @@ -1721,8 +1721,7 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) · 221 unmodified lines | |||
| 1721 | { | 1721 | { |
| 1722 | struct dst_entry *dst = skb_dst(skb); | 1722 | struct dst_entry *dst = skb_dst(skb); |
| 1723 | 1723 | ||
| 1724 | if (dst) { | 1724 | if (dst && dst_hold_safe(dst)) { |
| 1725 | dst_hold(dst); | ||
| 1726 | sk->sk_rx_dst = dst; | 1725 | sk->sk_rx_dst = dst; |
| 1727 | inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; | 1726 | inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; |
| 1728 | } | 1727 | } |
| @@ -3150,7 +3150,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) · 3149 unmodified lines | |||
| 3150 | { | 3150 | { |
| 3151 | struct tcp_sock *tp = tcp_sk(sk); | 3151 | struct tcp_sock *tp = tcp_sk(sk); |
| 3152 | struct tcp_fastopen_request *fo = tp->fastopen_req; | 3152 | struct tcp_fastopen_request *fo = tp->fastopen_req; |
| 3153 | int syn_loss = 0, space, err = 0, copied; | 3153 | int syn_loss = 0, space, err = 0; |
| 3154 | unsigned long last_syn_loss = 0; | 3154 | unsigned long last_syn_loss = 0; |
| 3155 | struct sk_buff *syn_data; | 3155 | struct sk_buff *syn_data; |
| 3156 | 3156 | ||
| @@ -3188,17 +3188,18 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) · 31 unmodified lines | |||
| 3188 | goto fallback; | 3188 | goto fallback; |
| 3189 | syn_data->ip_summed = CHECKSUM_PARTIAL; | 3189 | syn_data->ip_summed = CHECKSUM_PARTIAL; |
| 3190 | memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)); | 3190 | memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)); |
| 3191 | copied = copy_from_iter(skb_put(syn_data, space), space, | 3191 | if (space) { |
| 3192 | &fo->data->msg_iter); | 3192 | int copied = copy_from_iter(skb_put(syn_data, space), space, |
| 3193 | if (unlikely(!copied)) { | 3193 | &fo->data->msg_iter); |
| 3194 | kfree_skb(syn_data); | 3194 | if (unlikely(!copied)) { |
| 3195 | goto fallback; | 3195 | kfree_skb(syn_data); |
| 3196 | } | 3196 | goto fallback; |
| 3197 | if (copied != space) { | 3197 | } |
| 3198 | skb_trim(syn_data, copied); | 3198 | if (copied != space) { |
| 3199 | space = copied; | 3199 | skb_trim(syn_data, copied); |
| 3200 | space = copied; | ||
| 3201 | } | ||
| 3200 | } | 3202 | } |
| 3201 | |||
| 3202 | /* No more data pending in inet_wait_for_connect() */ | 3203 | /* No more data pending in inet_wait_for_connect() */ |
| 3203 | if (space == fo->size) | 3204 | if (space == fo->size) |
| 3204 | fo->data = NULL; | 3205 | fo->data = NULL; |
| @@ -350,6 +350,12 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) · 349 unmodified lines | |||
| 350 | setup_timer(&ndev->rs_timer, addrconf_rs_timer, | 350 | setup_timer(&ndev->rs_timer, addrconf_rs_timer, |
| 351 | (unsigned long)ndev); | 351 | (unsigned long)ndev); |
| 352 | memcpy(&ndev->cnf, dev_net(dev)->ipv6.devconf_dflt, sizeof(ndev->cnf)); | 352 | memcpy(&ndev->cnf, dev_net(dev)->ipv6.devconf_dflt, sizeof(ndev->cnf)); |
| 353 | |||
| 354 | if (ndev->cnf.stable_secret.initialized) | ||
| 355 | ndev->addr_gen_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY; | ||
| 356 | else | ||
| 357 | ndev->addr_gen_mode = IN6_ADDR_GEN_MODE_EUI64; | ||
| 358 | |||
| 353 | ndev->cnf.mtu6 = dev->mtu; | 359 | ndev->cnf.mtu6 = dev->mtu; |
| 354 | ndev->cnf.sysctl = NULL; | 360 | ndev->cnf.sysctl = NULL; |
| 355 | ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl); | 361 | ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl); |
| @@ -2455,7 +2461,7 @@ ok: · 2099 unmodified lines | |||
| 2455 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD | 2461 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD |
| 2456 | if (in6_dev->cnf.optimistic_dad && | 2462 | if (in6_dev->cnf.optimistic_dad && |
| 2457 | !net->ipv6.devconf_all->forwarding && sllao) | 2463 | !net->ipv6.devconf_all->forwarding && sllao) |
| 2458 | addr_flags = IFA_F_OPTIMISTIC; | 2464 | addr_flags |= IFA_F_OPTIMISTIC; |
| 2459 | #endif | 2465 | #endif |
| 2460 | 2466 | ||
| 2461 | /* Do not allow to create too much of autoconfigured | 2467 | /* Do not allow to create too much of autoconfigured |
| @@ -109,6 +109,9 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, · 108 unmodified lines | |||
| 109 | int try_loading_module = 0; | 109 | int try_loading_module = 0; |
| 110 | int err; | 110 | int err; |
| 111 | 111 | ||
| 112 | if (protocol < 0 || protocol >= IPPROTO_MAX) | ||
| 113 | return -EINVAL; | ||
| 114 | |||
| 112 | /* Look for the requested type/protocol pair. */ | 115 | /* Look for the requested type/protocol pair. */ |
| 113 | lookup_protocol: | 116 | lookup_protocol: |
| 114 | err = -ESOCKTNOSUPPORT; | 117 | err = -ESOCKTNOSUPPORT; |
| @@ -1571,13 +1571,11 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[], · 1570 unmodified lines | |||
| 1571 | return -EEXIST; | 1571 | return -EEXIST; |
| 1572 | } else { | 1572 | } else { |
| 1573 | t = nt; | 1573 | t = nt; |
| 1574 | |||
| 1575 | ip6gre_tunnel_unlink(ign, t); | ||
| 1576 | ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]); | ||
| 1577 | ip6gre_tunnel_link(ign, t); | ||
| 1578 | netdev_state_change(dev); | ||
| 1579 | } | 1574 | } |
| 1580 | 1575 | ||
| 1576 | ip6gre_tunnel_unlink(ign, t); | ||
| 1577 | ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]); | ||
| 1578 | ip6gre_tunnel_link(ign, t); | ||
| 1581 | return 0; | 1579 | return 0; |
| 1582 | } | 1580 | } |
| 1583 | 1581 | ||
| @@ -49,6 +49,7 @@ config NFT_REJECT_IPV6 · 48 unmodified lines | |||
| 49 | 49 | ||
| 50 | config NFT_DUP_IPV6 | 50 | config NFT_DUP_IPV6 |
| 51 | tristate "IPv6 nf_tables packet duplication support" | 51 | tristate "IPv6 nf_tables packet duplication support" |
| 52 | depends on !NF_CONNTRACK || NF_CONNTRACK | ||
| 52 | select NF_DUP_IPV6 | 53 | select NF_DUP_IPV6 |
| 53 | help | 54 | help |
| 54 | This module enables IPv6 packet duplication support for nf_tables. | 55 | This module enables IPv6 packet duplication support for nf_tables. |
| @@ -93,10 +93,9 @@ static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) · 92 unmodified lines | |||
| 93 | { | 93 | { |
| 94 | struct dst_entry *dst = skb_dst(skb); | 94 | struct dst_entry *dst = skb_dst(skb); |
| 95 | 95 | ||
| 96 | if (dst) { | 96 | if (dst && dst_hold_safe(dst)) { |
| 97 | const struct rt6_info *rt = (const struct rt6_info *)dst; | 97 | const struct rt6_info *rt = (const struct rt6_info *)dst; |
| 98 | 98 | ||
| 99 | dst_hold(dst); | ||
| 100 | sk->sk_rx_dst = dst; | 99 | sk->sk_rx_dst = dst; |
| 101 | inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; | 100 | inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; |
| 102 | inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt); | 101 | inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt); |
| @@ -1086,6 +1086,9 @@ static int irda_create(struct net *net, struct socket *sock, int protocol, · 1085 unmodified lines | |||
| 1086 | struct sock *sk; | 1086 | struct sock *sk; |
| 1087 | struct irda_sock *self; | 1087 | struct irda_sock *self; |
| 1088 | 1088 | ||
| 1089 | if (protocol < 0 || protocol > SK_PROTOCOL_MAX) | ||
| 1090 | return -EINVAL; | ||
| 1091 | |||
| 1089 | if (net != &init_net) | 1092 | if (net != &init_net) |
| 1090 | return -EAFNOSUPPORT; | 1093 | return -EAFNOSUPPORT; |
| 1091 | 1094 | ||
| @@ -1169,8 +1169,7 @@ static int sta_apply_parameters(struct ieee80211_local *local, · 1168 unmodified lines | |||
| 1169 | * rc isn't initialized here yet, so ignore it | 1169 | * rc isn't initialized here yet, so ignore it |
| 1170 | */ | 1170 | */ |
| 1171 | __ieee80211_vht_handle_opmode(sdata, sta, | 1171 | __ieee80211_vht_handle_opmode(sdata, sta, |
| 1172 | params->opmode_notif, | 1172 | params->opmode_notif, band); |
| 1173 | band, false); | ||
| 1174 | } | 1173 | } |
| 1175 | 1174 | ||
| 1176 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 1175 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
| @@ -1709,10 +1709,10 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); · 1708 unmodified lines | |||
| 1709 | void ieee80211_sta_set_rx_nss(struct sta_info *sta); | 1709 | void ieee80211_sta_set_rx_nss(struct sta_info *sta); |
| 1710 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 1710 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
| 1711 | struct sta_info *sta, u8 opmode, | 1711 | struct sta_info *sta, u8 opmode, |
| 1712 | enum ieee80211_band band, bool nss_only); | 1712 | enum ieee80211_band band); |
| 1713 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 1713 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
| 1714 | struct sta_info *sta, u8 opmode, | 1714 | struct sta_info *sta, u8 opmode, |
| 1715 | enum ieee80211_band band, bool nss_only); | 1715 | enum ieee80211_band band); |
| 1716 | void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, | 1716 | void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, |
| 1717 | struct ieee80211_sta_vht_cap *vht_cap); | 1717 | struct ieee80211_sta_vht_cap *vht_cap); |
| 1718 | void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, | 1718 | void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, |
| @@ -1379,21 +1379,26 @@ static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, · 1378 unmodified lines | |||
| 1379 | */ | 1379 | */ |
| 1380 | if (has_80211h_pwr && | 1380 | if (has_80211h_pwr && |
| 1381 | (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) { | 1381 | (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) { |
| 1382 | new_ap_level = pwr_level_80211h; | ||
| 1383 | |||
| 1384 | if (sdata->ap_power_level == new_ap_level) | ||
| 1385 | return 0; | ||
| 1386 | |||
| 1382 | sdata_dbg(sdata, | 1387 | sdata_dbg(sdata, |
| 1383 | "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", | 1388 | "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", |
| 1384 | pwr_level_80211h, chan_pwr, pwr_reduction_80211h, | 1389 | pwr_level_80211h, chan_pwr, pwr_reduction_80211h, |
| 1385 | sdata->u.mgd.bssid); | 1390 | sdata->u.mgd.bssid); |
| 1386 | new_ap_level = pwr_level_80211h; | ||
| 1387 | } else { /* has_cisco_pwr is always true here. */ | 1391 | } else { /* has_cisco_pwr is always true here. */ |
| 1392 | new_ap_level = pwr_level_cisco; | ||
| 1393 | |||
| 1394 | if (sdata->ap_power_level == new_ap_level) | ||
| 1395 | return 0; | ||
| 1396 | |||
| 1388 | sdata_dbg(sdata, | 1397 | sdata_dbg(sdata, |
| 1389 | "Limiting TX power to %d dBm as advertised by %pM\n", | 1398 | "Limiting TX power to %d dBm as advertised by %pM\n", |
| 1390 | pwr_level_cisco, sdata->u.mgd.bssid); | 1399 | pwr_level_cisco, sdata->u.mgd.bssid); |
| 1391 | new_ap_level = pwr_level_cisco; | ||
| 1392 | } | 1400 | } |
| 1393 | 1401 | ||
| 1394 | if (sdata->ap_power_level == new_ap_level) | ||
| 1395 | return 0; | ||
| 1396 | |||
| 1397 | sdata->ap_power_level = new_ap_level; | 1402 | sdata->ap_power_level = new_ap_level; |
| 1398 | if (__ieee80211_recalc_txpower(sdata)) | 1403 | if (__ieee80211_recalc_txpower(sdata)) |
| 1399 | return BSS_CHANGED_TXPOWER; | 1404 | return BSS_CHANGED_TXPOWER; |
| @@ -3575,7 +3580,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, · 2175 unmodified lines | |||
| 3575 | 3580 | ||
| 3576 | if (sta && elems.opmode_notif) | 3581 | if (sta && elems.opmode_notif) |
| 3577 | ieee80211_vht_handle_opmode(sdata, sta, *elems.opmode_notif, | 3582 | ieee80211_vht_handle_opmode(sdata, sta, *elems.opmode_notif, |
| 3578 | rx_status->band, true); | 3583 | rx_status->band); |
| 3579 | mutex_unlock(&local->sta_mtx); | 3584 | mutex_unlock(&local->sta_mtx); |
| 3580 | 3585 | ||
| 3581 | changed |= ieee80211_handle_pwr_constr(sdata, chan, mgmt, | 3586 | changed |= ieee80211_handle_pwr_constr(sdata, chan, mgmt, |
| @@ -2736,8 +2736,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) · 2735 unmodified lines | |||
| 2736 | opmode = mgmt->u.action.u.vht_opmode_notif.operating_mode; | 2736 | opmode = mgmt->u.action.u.vht_opmode_notif.operating_mode; |
| 2737 | 2737 | ||
| 2738 | ieee80211_vht_handle_opmode(rx->sdata, rx->sta, | 2738 | ieee80211_vht_handle_opmode(rx->sdata, rx->sta, |
| 2739 | opmode, status->band, | 2739 | opmode, status->band); |
| 2740 | false); | ||
| 2741 | goto handled; | 2740 | goto handled; |
| 2742 | } | 2741 | } |
| 2743 | default: | 2742 | default: |
| @@ -1641,6 +1641,29 @@ void ieee80211_stop_device(struct ieee80211_local *local) · 1640 unmodified lines | |||
| 1641 | drv_stop(local); | 1641 | drv_stop(local); |
| 1642 | } | 1642 | } |
| 1643 | 1643 | ||
| 1644 | static void ieee80211_flush_completed_scan(struct ieee80211_local *local, | ||
| 1645 | bool aborted) | ||
| 1646 | { | ||
| 1647 | /* It's possible that we don't handle the scan completion in | ||
| 1648 | * time during suspend, so if it's still marked as completed | ||
| 1649 | * here, queue the work and flush it to clean things up. | ||
| 1650 | * Instead of calling the worker function directly here, we | ||
| 1651 | * really queue it to avoid potential races with other flows | ||
| 1652 | * scheduling the same work. | ||
| 1653 | */ | ||
| 1654 | if (test_bit(SCAN_COMPLETED, &local->scanning)) { | ||
| 1655 | /* If coming from reconfiguration failure, abort the scan so | ||
| 1656 | * we don't attempt to continue a partial HW scan - which is | ||
| 1657 | * possible otherwise if (e.g.) the 2.4 GHz portion was the | ||
| 1658 | * completed scan, and a 5 GHz portion is still pending. | ||
| 1659 | */ | ||
| 1660 | if (aborted) | ||
| 1661 | set_bit(SCAN_ABORTED, &local->scanning); | ||
| 1662 | ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); | ||
| 1663 | flush_delayed_work(&local->scan_work); | ||
| 1664 | } | ||
| 1665 | } | ||
| 1666 | |||
| 1644 | static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) | 1667 | static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) |
| 1645 | { | 1668 | { |
| 1646 | struct ieee80211_sub_if_data *sdata; | 1669 | struct ieee80211_sub_if_data *sdata; |
| @@ -1660,6 +1683,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) · 13 unmodified lines | |||
| 1660 | local->suspended = false; | 1683 | local->suspended = false; |
| 1661 | local->in_reconfig = false; | 1684 | local->in_reconfig = false; |
| 1662 | 1685 | ||
| 1686 | ieee80211_flush_completed_scan(local, true); | ||
| 1687 | |||
| 1663 | /* scheduled scan clearly can't be running any more, but tell | 1688 | /* scheduled scan clearly can't be running any more, but tell |
| 1664 | * cfg80211 and clear local state | 1689 | * cfg80211 and clear local state |
| 1665 | */ | 1690 | */ |
| @@ -1698,6 +1723,27 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local, · 32 unmodified lines | |||
| 1698 | mutex_unlock(&local->chanctx_mtx); | 1723 | mutex_unlock(&local->chanctx_mtx); |
| 1699 | } | 1724 | } |
| 1700 | 1725 | ||
| 1726 | static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata) | ||
| 1727 | { | ||
| 1728 | struct ieee80211_local *local = sdata->local; | ||
| 1729 | struct sta_info *sta; | ||
| 1730 | |||
| 1731 | /* add STAs back */ | ||
| 1732 | mutex_lock(&local->sta_mtx); | ||
| 1733 | list_for_each_entry(sta, &local->sta_list, list) { | ||
| 1734 | enum ieee80211_sta_state state; | ||
| 1735 | |||
| 1736 | if (!sta->uploaded || sta->sdata != sdata) | ||
| 1737 | continue; | ||
| 1738 | |||
| 1739 | for (state = IEEE80211_STA_NOTEXIST; | ||
| 1740 | state < sta->sta_state; state++) | ||
| 1741 | WARN_ON(drv_sta_state(local, sta->sdata, sta, state, | ||
| 1742 | state + 1)); | ||
| 1743 | } | ||
| 1744 | mutex_unlock(&local->sta_mtx); | ||
| 1745 | } | ||
| 1746 | |||
| 1701 | int ieee80211_reconfig(struct ieee80211_local *local) | 1747 | int ieee80211_reconfig(struct ieee80211_local *local) |
| 1702 | { | 1748 | { |
| 1703 | struct ieee80211_hw *hw = &local->hw; | 1749 | struct ieee80211_hw *hw = &local->hw; |
| @@ -1833,50 +1879,11 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 129 unmodified lines | |||
| 1833 | WARN_ON(drv_add_chanctx(local, ctx)); | 1879 | WARN_ON(drv_add_chanctx(local, ctx)); |
| 1834 | mutex_unlock(&local->chanctx_mtx); | 1880 | mutex_unlock(&local->chanctx_mtx); |
| 1835 | 1881 | ||
| 1836 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
| 1837 | if (!ieee80211_sdata_running(sdata)) | ||
| 1838 | continue; | ||
| 1839 | ieee80211_assign_chanctx(local, sdata); | ||
| 1840 | } | ||
| 1841 | |||
| 1842 | sdata = rtnl_dereference(local->monitor_sdata); | 1882 | sdata = rtnl_dereference(local->monitor_sdata); |
| 1843 | if (sdata && ieee80211_sdata_running(sdata)) | 1883 | if (sdata && ieee80211_sdata_running(sdata)) |
| 1844 | ieee80211_assign_chanctx(local, sdata); | 1884 | ieee80211_assign_chanctx(local, sdata); |
| 1845 | } | 1885 | } |
| 1846 | 1886 | ||
| 1847 | /* add STAs back */ | ||
| 1848 | mutex_lock(&local->sta_mtx); | ||
| 1849 | list_for_each_entry(sta, &local->sta_list, list) { | ||
| 1850 | enum ieee80211_sta_state state; | ||
| 1851 | |||
| 1852 | if (!sta->uploaded) | ||
| 1853 | continue; | ||
| 1854 | |||
| 1855 | /* AP-mode stations will be added later */ | ||
| 1856 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP) | ||
| 1857 | continue; | ||
| 1858 | |||
| 1859 | for (state = IEEE80211_STA_NOTEXIST; | ||
| 1860 | state < sta->sta_state; state++) | ||
| 1861 | WARN_ON(drv_sta_state(local, sta->sdata, sta, state, | ||
| 1862 | state + 1)); | ||
| 1863 | } | ||
| 1864 | mutex_unlock(&local->sta_mtx); | ||
| 1865 | |||
| 1866 | /* reconfigure tx conf */ | ||
| 1867 | if (hw->queues >= IEEE80211_NUM_ACS) { | ||
| 1868 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
| 1869 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN || | ||
| 1870 | sdata->vif.type == NL80211_IFTYPE_MONITOR || | ||
| 1871 | !ieee80211_sdata_running(sdata)) | ||
| 1872 | continue; | ||
| 1873 | |||
| 1874 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | ||
| 1875 | drv_conf_tx(local, sdata, i, | ||
| 1876 | &sdata->tx_conf[i]); | ||
| 1877 | } | ||
| 1878 | } | ||
| 1879 | |||
| 1880 | /* reconfigure hardware */ | 1887 | /* reconfigure hardware */ |
| 1881 | ieee80211_hw_config(local, ~0); | 1888 | ieee80211_hw_config(local, ~0); |
| 1882 | 1889 | ||
| @@ -1889,6 +1896,22 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 6 unmodified lines | |||
| 1889 | if (!ieee80211_sdata_running(sdata)) | 1896 | if (!ieee80211_sdata_running(sdata)) |
| 1890 | continue; | 1897 | continue; |
| 1891 | 1898 | ||
| 1899 | ieee80211_assign_chanctx(local, sdata); | ||
| 1900 | |||
| 1901 | switch (sdata->vif.type) { | ||
| 1902 | case NL80211_IFTYPE_AP_VLAN: | ||
| 1903 | case NL80211_IFTYPE_MONITOR: | ||
| 1904 | break; | ||
| 1905 | default: | ||
| 1906 | ieee80211_reconfig_stations(sdata); | ||
| 1907 | /* fall through */ | ||
| 1908 | case NL80211_IFTYPE_AP: /* AP stations are handled later */ | ||
| 1909 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | ||
| 1910 | drv_conf_tx(local, sdata, i, | ||
| 1911 | &sdata->tx_conf[i]); | ||
| 1912 | break; | ||
| 1913 | } | ||
| 1914 | |||
| 1892 | /* common change flags for all interface types */ | 1915 | /* common change flags for all interface types */ |
| 1893 | changed = BSS_CHANGED_ERP_CTS_PROT | | 1916 | changed = BSS_CHANGED_ERP_CTS_PROT | |
| 1894 | BSS_CHANGED_ERP_PREAMBLE | | 1917 | BSS_CHANGED_ERP_PREAMBLE | |
| @@ -2074,17 +2097,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 179 unmodified lines | |||
| 2074 | mb(); | 2097 | mb(); |
| 2075 | local->resuming = false; | 2098 | local->resuming = false; |
| 2076 | 2099 | ||
| 2077 | /* It's possible that we don't handle the scan completion in | 2100 | ieee80211_flush_completed_scan(local, false); |
| 2078 | * time during suspend, so if it's still marked as completed | ||
| 2079 | * here, queue the work and flush it to clean things up. | ||
| 2080 | * Instead of calling the worker function directly here, we | ||
| 2081 | * really queue it to avoid potential races with other flows | ||
| 2082 | * scheduling the same work. | ||
| 2083 | */ | ||
| 2084 | if (test_bit(SCAN_COMPLETED, &local->scanning)) { | ||
| 2085 | ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); | ||
| 2086 | flush_delayed_work(&local->scan_work); | ||
| 2087 | } | ||
| 2088 | 2101 | ||
| 2089 | if (local->open_count && !reconfig_due_to_wowlan) | 2102 | if (local->open_count && !reconfig_due_to_wowlan) |
| 2090 | drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); | 2103 | drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); |
| @@ -378,7 +378,7 @@ void ieee80211_sta_set_rx_nss(struct sta_info *sta) · 377 unmodified lines | |||
| 378 | 378 | ||
| 379 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 379 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
| 380 | struct sta_info *sta, u8 opmode, | 380 | struct sta_info *sta, u8 opmode, |
| 381 | enum ieee80211_band band, bool nss_only) | 381 | enum ieee80211_band band) |
| 382 | { | 382 | { |
| 383 | struct ieee80211_local *local = sdata->local; | 383 | struct ieee80211_local *local = sdata->local; |
| 384 | struct ieee80211_supported_band *sband; | 384 | struct ieee80211_supported_band *sband; |
| @@ -401,9 +401,6 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, · 16 unmodified lines | |||
| 401 | changed |= IEEE80211_RC_NSS_CHANGED; | 401 | changed |= IEEE80211_RC_NSS_CHANGED; |
| 402 | } | 402 | } |
| 403 | 403 | ||
| 404 | if (nss_only) | ||
| 405 | return changed; | ||
| 406 | |||
| 407 | switch (opmode & IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK) { | 404 | switch (opmode & IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK) { |
| 408 | case IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ: | 405 | case IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ: |
| 409 | sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_20; | 406 | sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_20; |
| @@ -430,13 +427,12 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, · 20 unmodified lines | |||
| 430 | 427 | ||
| 431 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 428 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
| 432 | struct sta_info *sta, u8 opmode, | 429 | struct sta_info *sta, u8 opmode, |
| 433 | enum ieee80211_band band, bool nss_only) | 430 | enum ieee80211_band band) |
| 434 | { | 431 | { |
| 435 | struct ieee80211_local *local = sdata->local; | 432 | struct ieee80211_local *local = sdata->local; |
| 436 | struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; | 433 | struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; |
| 437 | 434 | ||
| 438 | u32 changed = __ieee80211_vht_handle_opmode(sdata, sta, opmode, | 435 | u32 changed = __ieee80211_vht_handle_opmode(sdata, sta, opmode, band); |
| 439 | band, nss_only); | ||
| 440 | 436 | ||
| 441 | if (changed > 0) | 437 | if (changed > 0) |
| 442 | rate_control_rate_update(local, sband, sta, changed); | 438 | rate_control_rate_update(local, sband, sta, changed); |
| @@ -27,6 +27,8 @@ · 26 unmodified lines | |||
| 27 | */ | 27 | */ |
| 28 | #define MAX_MP_SELECT_LABELS 4 | 28 | #define MAX_MP_SELECT_LABELS 4 |
| 29 | 29 | ||
| 30 | #define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1) | ||
| 31 | |||
| 30 | static int zero = 0; | 32 | static int zero = 0; |
| 31 | static int label_limit = (1 << 20) - 1; | 33 | static int label_limit = (1 << 20) - 1; |
| 32 | 34 | ||
| @@ -317,7 +319,13 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev, · 284 unmodified lines | |||
| 317 | } | 319 | } |
| 318 | } | 320 | } |
| 319 | 321 | ||
| 320 | err = neigh_xmit(nh->nh_via_table, out_dev, mpls_nh_via(rt, nh), skb); | 322 | /* If via wasn't specified then send out using device address */ |
| 323 | if (nh->nh_via_table == MPLS_NEIGH_TABLE_UNSPEC) | ||
| 324 | err = neigh_xmit(NEIGH_LINK_TABLE, out_dev, | ||
| 325 | out_dev->dev_addr, skb); | ||
| 326 | else | ||
| 327 | err = neigh_xmit(nh->nh_via_table, out_dev, | ||
| 328 | mpls_nh_via(rt, nh), skb); | ||
| 321 | if (err) | 329 | if (err) |
| 322 | net_dbg_ratelimited("%s: packet transmission failed: %d\n", | 330 | net_dbg_ratelimited("%s: packet transmission failed: %d\n", |
| 323 | __func__, err); | 331 | __func__, err); |
| @@ -534,6 +542,10 @@ static int mpls_nh_assign_dev(struct net *net, struct mpls_route *rt, · 210 unmodified lines | |||
| 534 | if (!mpls_dev_get(dev)) | 542 | if (!mpls_dev_get(dev)) |
| 535 | goto errout; | 543 | goto errout; |
| 536 | 544 | ||
| 545 | if ((nh->nh_via_table == NEIGH_LINK_TABLE) && | ||
| 546 | (dev->addr_len != nh->nh_via_alen)) | ||
| 547 | goto errout; | ||
| 548 | |||
| 537 | RCU_INIT_POINTER(nh->nh_dev, dev); | 549 | RCU_INIT_POINTER(nh->nh_dev, dev); |
| 538 | 550 | ||
| 539 | return 0; | 551 | return 0; |
| @@ -592,10 +604,14 @@ static int mpls_nh_build(struct net *net, struct mpls_route *rt, · 52 unmodified lines | |||
| 592 | goto errout; | 604 | goto errout; |
| 593 | } | 605 | } |
| 594 | 606 | ||
| 595 | err = nla_get_via(via, &nh->nh_via_alen, &nh->nh_via_table, | 607 | if (via) { |
| 596 | __mpls_nh_via(rt, nh)); | 608 | err = nla_get_via(via, &nh->nh_via_alen, &nh->nh_via_table, |
| 597 | if (err) | 609 | __mpls_nh_via(rt, nh)); |
| 598 | goto errout; | 610 | if (err) |
| 611 | goto errout; | ||
| 612 | } else { | ||
| 613 | nh->nh_via_table = MPLS_NEIGH_TABLE_UNSPEC; | ||
| 614 | } | ||
| 599 | 615 | ||
| 600 | err = mpls_nh_assign_dev(net, rt, nh, oif); | 616 | err = mpls_nh_assign_dev(net, rt, nh, oif); |
| 601 | if (err) | 617 | if (err) |
| @@ -677,9 +693,6 @@ static int mpls_nh_build_multi(struct mpls_route_config *cfg, · 75 unmodified lines | |||
| 677 | nla_newdst = nla_find(attrs, attrlen, RTA_NEWDST); | 693 | nla_newdst = nla_find(attrs, attrlen, RTA_NEWDST); |
| 678 | } | 694 | } |
| 679 | 695 | ||
| 680 | if (!nla_via) | ||
| 681 | goto errout; | ||
| 682 | |||
| 683 | err = mpls_nh_build(cfg->rc_nlinfo.nl_net, rt, nh, | 696 | err = mpls_nh_build(cfg->rc_nlinfo.nl_net, rt, nh, |
| 684 | rtnh->rtnh_ifindex, nla_via, | 697 | rtnh->rtnh_ifindex, nla_via, |
| 685 | nla_newdst); | 698 | nla_newdst); |
| @@ -1118,6 +1131,7 @@ static int rtm_to_route_config(struct sk_buff *skb, struct nlmsghdr *nlh, · 432 unmodified lines | |||
| 1118 | 1131 | ||
| 1119 | cfg->rc_label = LABEL_NOT_SPECIFIED; | 1132 | cfg->rc_label = LABEL_NOT_SPECIFIED; |
| 1120 | cfg->rc_protocol = rtm->rtm_protocol; | 1133 | cfg->rc_protocol = rtm->rtm_protocol; |
| 1134 | cfg->rc_via_table = MPLS_NEIGH_TABLE_UNSPEC; | ||
| 1121 | cfg->rc_nlflags = nlh->nlmsg_flags; | 1135 | cfg->rc_nlflags = nlh->nlmsg_flags; |
| 1122 | cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; | 1136 | cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; |
| 1123 | cfg->rc_nlinfo.nlh = nlh; | 1137 | cfg->rc_nlinfo.nlh = nlh; |
| @@ -1231,7 +1245,8 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, · 107 unmodified lines | |||
| 1231 | nla_put_labels(skb, RTA_NEWDST, nh->nh_labels, | 1245 | nla_put_labels(skb, RTA_NEWDST, nh->nh_labels, |
| 1232 | nh->nh_label)) | 1246 | nh->nh_label)) |
| 1233 | goto nla_put_failure; | 1247 | goto nla_put_failure; |
| 1234 | if (nla_put_via(skb, nh->nh_via_table, mpls_nh_via(rt, nh), | 1248 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC && |
| 1249 | nla_put_via(skb, nh->nh_via_table, mpls_nh_via(rt, nh), | ||
| 1235 | nh->nh_via_alen)) | 1250 | nh->nh_via_alen)) |
| 1236 | goto nla_put_failure; | 1251 | goto nla_put_failure; |
| 1237 | dev = rtnl_dereference(nh->nh_dev); | 1252 | dev = rtnl_dereference(nh->nh_dev); |
| @@ -1257,7 +1272,8 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, · 19 unmodified lines | |||
| 1257 | nh->nh_labels, | 1272 | nh->nh_labels, |
| 1258 | nh->nh_label)) | 1273 | nh->nh_label)) |
| 1259 | goto nla_put_failure; | 1274 | goto nla_put_failure; |
| 1260 | if (nla_put_via(skb, nh->nh_via_table, | 1275 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC && |
| 1276 | nla_put_via(skb, nh->nh_via_table, | ||
| 1261 | mpls_nh_via(rt, nh), | 1277 | mpls_nh_via(rt, nh), |
| 1262 | nh->nh_via_alen)) | 1278 | nh->nh_via_alen)) |
| 1263 | goto nla_put_failure; | 1279 | goto nla_put_failure; |
| @@ -1319,7 +1335,8 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) · 55 unmodified lines | |||
| 1319 | 1335 | ||
| 1320 | if (nh->nh_dev) | 1336 | if (nh->nh_dev) |
| 1321 | payload += nla_total_size(4); /* RTA_OIF */ | 1337 | payload += nla_total_size(4); /* RTA_OIF */ |
| 1322 | payload += nla_total_size(2 + nh->nh_via_alen); /* RTA_VIA */ | 1338 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC) /* RTA_VIA */ |
| 1339 | payload += nla_total_size(2 + nh->nh_via_alen); | ||
| 1323 | if (nh->nh_labels) /* RTA_NEWDST */ | 1340 | if (nh->nh_labels) /* RTA_NEWDST */ |
| 1324 | payload += nla_total_size(nh->nh_labels * 4); | 1341 | payload += nla_total_size(nh->nh_labels * 4); |
| 1325 | } else { | 1342 | } else { |
| @@ -1328,7 +1345,9 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) · 2 unmodified lines | |||
| 1328 | 1345 | ||
| 1329 | for_nexthops(rt) { | 1346 | for_nexthops(rt) { |
| 1330 | nhsize += nla_total_size(sizeof(struct rtnexthop)); | 1347 | nhsize += nla_total_size(sizeof(struct rtnexthop)); |
| 1331 | nhsize += nla_total_size(2 + nh->nh_via_alen); | 1348 | /* RTA_VIA */ |
| 1349 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC) | ||
| 1350 | nhsize += nla_total_size(2 + nh->nh_via_alen); | ||
| 1332 | if (nh->nh_labels) | 1351 | if (nh->nh_labels) |
| 1333 | nhsize += nla_total_size(nh->nh_labels * 4); | 1352 | nhsize += nla_total_size(nh->nh_labels * 4); |
| 1334 | } endfor_nexthops(rt); | 1353 | } endfor_nexthops(rt); |
| @@ -54,10 +54,10 @@ int mpls_output(struct net *net, struct sock *sk, struct sk_buff *skb) · 53 unmodified lines | |||
| 54 | unsigned int ttl; | 54 | unsigned int ttl; |
| 55 | 55 | ||
| 56 | /* Obtain the ttl */ | 56 | /* Obtain the ttl */ |
| 57 | if (skb->protocol == htons(ETH_P_IP)) { | 57 | if (dst->ops->family == AF_INET) { |
| 58 | ttl = ip_hdr(skb)->ttl; | 58 | ttl = ip_hdr(skb)->ttl; |
| 59 | rt = (struct rtable *)dst; | 59 | rt = (struct rtable *)dst; |
| 60 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 60 | } else if (dst->ops->family == AF_INET6) { |
| 61 | ttl = ipv6_hdr(skb)->hop_limit; | 61 | ttl = ipv6_hdr(skb)->hop_limit; |
| 62 | rt6 = (struct rt6_info *)dst; | 62 | rt6 = (struct rt6_info *)dst; |
| 63 | } else { | 63 | } else { |
| @@ -89,6 +89,7 @@ nf_tables_afinfo_lookup(struct net *net, int family, bool autoload) · 88 unmodified lines | |||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | static void nft_ctx_init(struct nft_ctx *ctx, | 91 | static void nft_ctx_init(struct nft_ctx *ctx, |
| 92 | struct net *net, | ||
| 92 | const struct sk_buff *skb, | 93 | const struct sk_buff *skb, |
| 93 | const struct nlmsghdr *nlh, | 94 | const struct nlmsghdr *nlh, |
| 94 | struct nft_af_info *afi, | 95 | struct nft_af_info *afi, |
| @@ -96,7 +97,7 @@ static void nft_ctx_init(struct nft_ctx *ctx, · 1 unmodified line | |||
| 96 | struct nft_chain *chain, | 97 | struct nft_chain *chain, |
| 97 | const struct nlattr * const *nla) | 98 | const struct nlattr * const *nla) |
| 98 | { | 99 | { |
| 99 | ctx->net = sock_net(skb->sk); | 100 | ctx->net = net; |
| 100 | ctx->afi = afi; | 101 | ctx->afi = afi; |
| 101 | ctx->table = table; | 102 | ctx->table = table; |
| 102 | ctx->chain = chain; | 103 | ctx->chain = chain; |
| @@ -672,15 +673,14 @@ err: · 569 unmodified lines | |||
| 672 | return ret; | 673 | return ret; |
| 673 | } | 674 | } |
| 674 | 675 | ||
| 675 | static int nf_tables_newtable(struct sock *nlsk, struct sk_buff *skb, | 676 | static int nf_tables_newtable(struct net *net, struct sock *nlsk, |
| 676 | const struct nlmsghdr *nlh, | 677 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 677 | const struct nlattr * const nla[]) | 678 | const struct nlattr * const nla[]) |
| 678 | { | 679 | { |
| 679 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 680 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| 680 | const struct nlattr *name; | 681 | const struct nlattr *name; |
| 681 | struct nft_af_info *afi; | 682 | struct nft_af_info *afi; |
| 682 | struct nft_table *table; | 683 | struct nft_table *table; |
| 683 | struct net *net = sock_net(skb->sk); | ||
| 684 | int family = nfmsg->nfgen_family; | 684 | int family = nfmsg->nfgen_family; |
| 685 | u32 flags = 0; | 685 | u32 flags = 0; |
| 686 | struct nft_ctx ctx; | 686 | struct nft_ctx ctx; |
| @@ -706,7 +706,7 @@ static int nf_tables_newtable(struct sock *nlsk, struct sk_buff *skb, · 19 unmodified lines | |||
| 706 | if (nlh->nlmsg_flags & NLM_F_REPLACE) | 706 | if (nlh->nlmsg_flags & NLM_F_REPLACE) |
| 707 | return -EOPNOTSUPP; | 707 | return -EOPNOTSUPP; |
| 708 | 708 | ||
| 709 | nft_ctx_init(&ctx, skb, nlh, afi, table, NULL, nla); | 709 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); |
| 710 | return nf_tables_updtable(&ctx); | 710 | return nf_tables_updtable(&ctx); |
| 711 | } | 711 | } |
| 712 | 712 | ||
| @@ -730,7 +730,7 @@ static int nf_tables_newtable(struct sock *nlsk, struct sk_buff *skb, · 17 unmodified lines | |||
| 730 | INIT_LIST_HEAD(&table->sets); | 730 | INIT_LIST_HEAD(&table->sets); |
| 731 | table->flags = flags; | 731 | table->flags = flags; |
| 732 | 732 | ||
| 733 | nft_ctx_init(&ctx, skb, nlh, afi, table, NULL, nla); | 733 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); |
| 734 | err = nft_trans_table_add(&ctx, NFT_MSG_NEWTABLE); | 734 | err = nft_trans_table_add(&ctx, NFT_MSG_NEWTABLE); |
| 735 | if (err < 0) | 735 | if (err < 0) |
| 736 | goto err3; | 736 | goto err3; |
| @@ -810,18 +810,17 @@ out: · 73 unmodified lines | |||
| 810 | return err; | 810 | return err; |
| 811 | } | 811 | } |
| 812 | 812 | ||
| 813 | static int nf_tables_deltable(struct sock *nlsk, struct sk_buff *skb, | 813 | static int nf_tables_deltable(struct net *net, struct sock *nlsk, |
| 814 | const struct nlmsghdr *nlh, | 814 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 815 | const struct nlattr * const nla[]) | 815 | const struct nlattr * const nla[]) |
| 816 | { | 816 | { |
| 817 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 817 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| 818 | struct nft_af_info *afi; | 818 | struct nft_af_info *afi; |
| 819 | struct nft_table *table; | 819 | struct nft_table *table; |
| 820 | struct net *net = sock_net(skb->sk); | ||
| 821 | int family = nfmsg->nfgen_family; | 820 | int family = nfmsg->nfgen_family; |
| 822 | struct nft_ctx ctx; | 821 | struct nft_ctx ctx; |
| 823 | 822 | ||
| 824 | nft_ctx_init(&ctx, skb, nlh, NULL, NULL, NULL, nla); | 823 | nft_ctx_init(&ctx, net, skb, nlh, NULL, NULL, NULL, nla); |
| 825 | if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL) | 824 | if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL) |
| 826 | return nft_flush(&ctx, family); | 825 | return nft_flush(&ctx, family); |
| 827 | 826 | ||
| @@ -1221,8 +1220,8 @@ static void nf_tables_chain_destroy(struct nft_chain *chain) · 393 unmodified lines | |||
| 1221 | } | 1220 | } |
| 1222 | } | 1221 | } |
| 1223 | 1222 | ||
| 1224 | static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | 1223 | static int nf_tables_newchain(struct net *net, struct sock *nlsk, |
| 1225 | const struct nlmsghdr *nlh, | 1224 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 1226 | const struct nlattr * const nla[]) | 1225 | const struct nlattr * const nla[]) |
| 1227 | { | 1226 | { |
| 1228 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 1227 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| @@ -1232,7 +1231,6 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, · 3 unmodified lines | |||
| 1232 | struct nft_chain *chain; | 1231 | struct nft_chain *chain; |
| 1233 | struct nft_base_chain *basechain = NULL; | 1232 | struct nft_base_chain *basechain = NULL; |
| 1234 | struct nlattr *ha[NFTA_HOOK_MAX + 1]; | 1233 | struct nlattr *ha[NFTA_HOOK_MAX + 1]; |
| 1235 | struct net *net = sock_net(skb->sk); | ||
| 1236 | int family = nfmsg->nfgen_family; | 1234 | int family = nfmsg->nfgen_family; |
| 1237 | struct net_device *dev = NULL; | 1235 | struct net_device *dev = NULL; |
| 1238 | u8 policy = NF_ACCEPT; | 1236 | u8 policy = NF_ACCEPT; |
| @@ -1313,7 +1311,7 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, · 74 unmodified lines | |||
| 1313 | return PTR_ERR(stats); | 1311 | return PTR_ERR(stats); |
| 1314 | } | 1312 | } |
| 1315 | 1313 | ||
| 1316 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 1314 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
| 1317 | trans = nft_trans_alloc(&ctx, NFT_MSG_NEWCHAIN, | 1315 | trans = nft_trans_alloc(&ctx, NFT_MSG_NEWCHAIN, |
| 1318 | sizeof(struct nft_trans_chain)); | 1316 | sizeof(struct nft_trans_chain)); |
| 1319 | if (trans == NULL) { | 1317 | if (trans == NULL) { |
| @@ -1461,7 +1459,7 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, · 141 unmodified lines | |||
| 1461 | if (err < 0) | 1459 | if (err < 0) |
| 1462 | goto err1; | 1460 | goto err1; |
| 1463 | 1461 | ||
| 1464 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 1462 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
| 1465 | err = nft_trans_chain_add(&ctx, NFT_MSG_NEWCHAIN); | 1463 | err = nft_trans_chain_add(&ctx, NFT_MSG_NEWCHAIN); |
| 1466 | if (err < 0) | 1464 | if (err < 0) |
| 1467 | goto err2; | 1465 | goto err2; |
| @@ -1476,15 +1474,14 @@ err1: · 8 unmodified lines | |||
| 1476 | return err; | 1474 | return err; |
| 1477 | } | 1475 | } |
| 1478 | 1476 | ||
| 1479 | static int nf_tables_delchain(struct sock *nlsk, struct sk_buff *skb, | 1477 | static int nf_tables_delchain(struct net *net, struct sock *nlsk, |
| 1480 | const struct nlmsghdr *nlh, | 1478 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 1481 | const struct nlattr * const nla[]) | 1479 | const struct nlattr * const nla[]) |
| 1482 | { | 1480 | { |
| 1483 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 1481 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| 1484 | struct nft_af_info *afi; | 1482 | struct nft_af_info *afi; |
| 1485 | struct nft_table *table; | 1483 | struct nft_table *table; |
| 1486 | struct nft_chain *chain; | 1484 | struct nft_chain *chain; |
| 1487 | struct net *net = sock_net(skb->sk); | ||
| 1488 | int family = nfmsg->nfgen_family; | 1485 | int family = nfmsg->nfgen_family; |
| 1489 | struct nft_ctx ctx; | 1486 | struct nft_ctx ctx; |
| 1490 | 1487 | ||
| @@ -1506,7 +1503,7 @@ static int nf_tables_delchain(struct sock *nlsk, struct sk_buff *skb, · 15 unmodified lines | |||
| 1506 | if (chain->use > 0) | 1503 | if (chain->use > 0) |
| 1507 | return -EBUSY; | 1504 | return -EBUSY; |
| 1508 | 1505 | ||
| 1509 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 1506 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
| 1510 | 1507 | ||
| 1511 | return nft_delchain(&ctx); | 1508 | return nft_delchain(&ctx); |
| 1512 | } | 1509 | } |
| @@ -2010,13 +2007,12 @@ static void nf_tables_rule_destroy(const struct nft_ctx *ctx, · 497 unmodified lines | |||
| 2010 | 2007 | ||
| 2011 | static struct nft_expr_info *info; | 2008 | static struct nft_expr_info *info; |
| 2012 | 2009 | ||
| 2013 | static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | 2010 | static int nf_tables_newrule(struct net *net, struct sock *nlsk, |
| 2014 | const struct nlmsghdr *nlh, | 2011 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 2015 | const struct nlattr * const nla[]) | 2012 | const struct nlattr * const nla[]) |
| 2016 | { | 2013 | { |
| 2017 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2014 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| 2018 | struct nft_af_info *afi; | 2015 | struct nft_af_info *afi; |
| 2019 | struct net *net = sock_net(skb->sk); | ||
| 2020 | struct nft_table *table; | 2016 | struct nft_table *table; |
| 2021 | struct nft_chain *chain; | 2017 | struct nft_chain *chain; |
| 2022 | struct nft_rule *rule, *old_rule = NULL; | 2018 | struct nft_rule *rule, *old_rule = NULL; |
| @@ -2075,7 +2071,7 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, · 52 unmodified lines | |||
| 2075 | return PTR_ERR(old_rule); | 2071 | return PTR_ERR(old_rule); |
| 2076 | } | 2072 | } |
| 2077 | 2073 | ||
| 2078 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 2074 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
| 2079 | 2075 | ||
| 2080 | n = 0; | 2076 | n = 0; |
| 2081 | size = 0; | 2077 | size = 0; |
| @@ -2176,13 +2172,12 @@ err1: · 94 unmodified lines | |||
| 2176 | return err; | 2172 | return err; |
| 2177 | } | 2173 | } |
| 2178 | 2174 | ||
| 2179 | static int nf_tables_delrule(struct sock *nlsk, struct sk_buff *skb, | 2175 | static int nf_tables_delrule(struct net *net, struct sock *nlsk, |
| 2180 | const struct nlmsghdr *nlh, | 2176 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 2181 | const struct nlattr * const nla[]) | 2177 | const struct nlattr * const nla[]) |
| 2182 | { | 2178 | { |
| 2183 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2179 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| 2184 | struct nft_af_info *afi; | 2180 | struct nft_af_info *afi; |
| 2185 | struct net *net = sock_net(skb->sk); | ||
| 2186 | struct nft_table *table; | 2181 | struct nft_table *table; |
| 2187 | struct nft_chain *chain = NULL; | 2182 | struct nft_chain *chain = NULL; |
| 2188 | struct nft_rule *rule; | 2183 | struct nft_rule *rule; |
| @@ -2205,7 +2200,7 @@ static int nf_tables_delrule(struct sock *nlsk, struct sk_buff *skb, · 16 unmodified lines | |||
| 2205 | return PTR_ERR(chain); | 2200 | return PTR_ERR(chain); |
| 2206 | } | 2201 | } |
| 2207 | 2202 | ||
| 2208 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 2203 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
| 2209 | 2204 | ||
| 2210 | if (chain) { | 2205 | if (chain) { |
| 2211 | if (nla[NFTA_RULE_HANDLE]) { | 2206 | if (nla[NFTA_RULE_HANDLE]) { |
| @@ -2344,12 +2339,11 @@ static const struct nla_policy nft_set_desc_policy[NFTA_SET_DESC_MAX + 1] = { · 132 unmodified lines | |||
| 2344 | [NFTA_SET_DESC_SIZE] = { .type = NLA_U32 }, | 2339 | [NFTA_SET_DESC_SIZE] = { .type = NLA_U32 }, |
| 2345 | }; | 2340 | }; |
| 2346 | 2341 | ||
| 2347 | static int nft_ctx_init_from_setattr(struct nft_ctx *ctx, | 2342 | static int nft_ctx_init_from_setattr(struct nft_ctx *ctx, struct net *net, |
| 2348 | const struct sk_buff *skb, | 2343 | const struct sk_buff *skb, |
| 2349 | const struct nlmsghdr *nlh, | 2344 | const struct nlmsghdr *nlh, |
| 2350 | const struct nlattr * const nla[]) | 2345 | const struct nlattr * const nla[]) |
| 2351 | { | 2346 | { |
| 2352 | struct net *net = sock_net(skb->sk); | ||
| 2353 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2347 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| 2354 | struct nft_af_info *afi = NULL; | 2348 | struct nft_af_info *afi = NULL; |
| 2355 | struct nft_table *table = NULL; | 2349 | struct nft_table *table = NULL; |
| @@ -2371,7 +2365,7 @@ static int nft_ctx_init_from_setattr(struct nft_ctx *ctx, · 15 unmodified lines | |||
| 2371 | return -ENOENT; | 2365 | return -ENOENT; |
| 2372 | } | 2366 | } |
| 2373 | 2367 | ||
| 2374 | nft_ctx_init(ctx, skb, nlh, afi, table, NULL, nla); | 2368 | nft_ctx_init(ctx, net, skb, nlh, afi, table, NULL, nla); |
| 2375 | return 0; | 2369 | return 0; |
| 2376 | } | 2370 | } |
| 2377 | 2371 | ||
| @@ -2623,6 +2617,7 @@ static int nf_tables_getset(struct sock *nlsk, struct sk_buff *skb, · 245 unmodified lines | |||
| 2623 | const struct nlmsghdr *nlh, | 2617 | const struct nlmsghdr *nlh, |
| 2624 | const struct nlattr * const nla[]) | 2618 | const struct nlattr * const nla[]) |
| 2625 | { | 2619 | { |
| 2620 | struct net *net = sock_net(skb->sk); | ||
| 2626 | const struct nft_set *set; | 2621 | const struct nft_set *set; |
| 2627 | struct nft_ctx ctx; | 2622 | struct nft_ctx ctx; |
| 2628 | struct sk_buff *skb2; | 2623 | struct sk_buff *skb2; |
| @@ -2630,7 +2625,7 @@ static int nf_tables_getset(struct sock *nlsk, struct sk_buff *skb, · 1 unmodified line | |||
| 2630 | int err; | 2625 | int err; |
| 2631 | 2626 | ||
| 2632 | /* Verify existence before starting dump */ | 2627 | /* Verify existence before starting dump */ |
| 2633 | err = nft_ctx_init_from_setattr(&ctx, skb, nlh, nla); | 2628 | err = nft_ctx_init_from_setattr(&ctx, net, skb, nlh, nla); |
| 2634 | if (err < 0) | 2629 | if (err < 0) |
| 2635 | return err; | 2630 | return err; |
| 2636 | 2631 | ||
| @@ -2693,14 +2688,13 @@ static int nf_tables_set_desc_parse(const struct nft_ctx *ctx, · 56 unmodified lines | |||
| 2693 | return 0; | 2688 | return 0; |
| 2694 | } | 2689 | } |
| 2695 | 2690 | ||
| 2696 | static int nf_tables_newset(struct sock *nlsk, struct sk_buff *skb, | 2691 | static int nf_tables_newset(struct net *net, struct sock *nlsk, |
| 2697 | const struct nlmsghdr *nlh, | 2692 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 2698 | const struct nlattr * const nla[]) | 2693 | const struct nlattr * const nla[]) |
| 2699 | { | 2694 | { |
| 2700 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2695 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| 2701 | const struct nft_set_ops *ops; | 2696 | const struct nft_set_ops *ops; |
| 2702 | struct nft_af_info *afi; | 2697 | struct nft_af_info *afi; |
| 2703 | struct net *net = sock_net(skb->sk); | ||
| 2704 | struct nft_table *table; | 2698 | struct nft_table *table; |
| 2705 | struct nft_set *set; | 2699 | struct nft_set *set; |
| 2706 | struct nft_ctx ctx; | 2700 | struct nft_ctx ctx; |
| @@ -2798,7 +2792,7 @@ static int nf_tables_newset(struct sock *nlsk, struct sk_buff *skb, · 91 unmodified lines | |||
| 2798 | if (IS_ERR(table)) | 2792 | if (IS_ERR(table)) |
| 2799 | return PTR_ERR(table); | 2793 | return PTR_ERR(table); |
| 2800 | 2794 | ||
| 2801 | nft_ctx_init(&ctx, skb, nlh, afi, table, NULL, nla); | 2795 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); |
| 2802 | 2796 | ||
| 2803 | set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME]); | 2797 | set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME]); |
| 2804 | if (IS_ERR(set)) { | 2798 | if (IS_ERR(set)) { |
| @@ -2882,8 +2876,8 @@ static void nf_tables_set_destroy(const struct nft_ctx *ctx, struct nft_set *set · 77 unmodified lines | |||
| 2882 | nft_set_destroy(set); | 2876 | nft_set_destroy(set); |
| 2883 | } | 2877 | } |
| 2884 | 2878 | ||
| 2885 | static int nf_tables_delset(struct sock *nlsk, struct sk_buff *skb, | 2879 | static int nf_tables_delset(struct net *net, struct sock *nlsk, |
| 2886 | const struct nlmsghdr *nlh, | 2880 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 2887 | const struct nlattr * const nla[]) | 2881 | const struct nlattr * const nla[]) |
| 2888 | { | 2882 | { |
| 2889 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2883 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| @@ -2896,7 +2890,7 @@ static int nf_tables_delset(struct sock *nlsk, struct sk_buff *skb, · 6 unmodified lines | |||
| 2896 | if (nla[NFTA_SET_TABLE] == NULL) | 2890 | if (nla[NFTA_SET_TABLE] == NULL) |
| 2897 | return -EINVAL; | 2891 | return -EINVAL; |
| 2898 | 2892 | ||
| 2899 | err = nft_ctx_init_from_setattr(&ctx, skb, nlh, nla); | 2893 | err = nft_ctx_init_from_setattr(&ctx, net, skb, nlh, nla); |
| 2900 | if (err < 0) | 2894 | if (err < 0) |
| 2901 | return err; | 2895 | return err; |
| 2902 | 2896 | ||
| @@ -3024,7 +3018,7 @@ static const struct nla_policy nft_set_elem_list_policy[NFTA_SET_ELEM_LIST_MAX + · 121 unmodified lines | |||
| 3024 | [NFTA_SET_ELEM_LIST_SET_ID] = { .type = NLA_U32 }, | 3018 | [NFTA_SET_ELEM_LIST_SET_ID] = { .type = NLA_U32 }, |
| 3025 | }; | 3019 | }; |
| 3026 | 3020 | ||
| 3027 | static int nft_ctx_init_from_elemattr(struct nft_ctx *ctx, | 3021 | static int nft_ctx_init_from_elemattr(struct nft_ctx *ctx, struct net *net, |
| 3028 | const struct sk_buff *skb, | 3022 | const struct sk_buff *skb, |
| 3029 | const struct nlmsghdr *nlh, | 3023 | const struct nlmsghdr *nlh, |
| 3030 | const struct nlattr * const nla[], | 3024 | const struct nlattr * const nla[], |
| @@ -3033,7 +3027,6 @@ static int nft_ctx_init_from_elemattr(struct nft_ctx *ctx, · 2 unmodified lines | |||
| 3033 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 3027 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
| 3034 | struct nft_af_info *afi; | 3028 | struct nft_af_info *afi; |
| 3035 | struct nft_table *table; | 3029 | struct nft_table *table; |
| 3036 | struct net *net = sock_net(skb->sk); | ||
| 3037 | 3030 | ||
| 3038 | afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, false); | 3031 | afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, false); |
| 3039 | if (IS_ERR(afi)) | 3032 | if (IS_ERR(afi)) |
| @@ -3045,7 +3038,7 @@ static int nft_ctx_init_from_elemattr(struct nft_ctx *ctx, · 5 unmodified lines | |||
| 3045 | if (!trans && (table->flags & NFT_TABLE_INACTIVE)) | 3038 | if (!trans && (table->flags & NFT_TABLE_INACTIVE)) |
| 3046 | return -ENOENT; | 3039 | return -ENOENT; |
| 3047 | 3040 | ||
| 3048 | nft_ctx_init(ctx, skb, nlh, afi, table, NULL, nla); | 3041 | nft_ctx_init(ctx, net, skb, nlh, afi, table, NULL, nla); |
| 3049 | return 0; | 3042 | return 0; |
| 3050 | } | 3043 | } |
| 3051 | 3044 | ||
| @@ -3135,6 +3128,7 @@ static int nf_tables_dump_setelem(const struct nft_ctx *ctx, · 83 unmodified lines | |||
| 3135 | 3128 | ||
| 3136 | static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) | 3129 | static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) |
| 3137 | { | 3130 | { |
| 3131 | struct net *net = sock_net(skb->sk); | ||
| 3138 | const struct nft_set *set; | 3132 | const struct nft_set *set; |
| 3139 | struct nft_set_dump_args args; | 3133 | struct nft_set_dump_args args; |
| 3140 | struct nft_ctx ctx; | 3134 | struct nft_ctx ctx; |
| @@ -3150,8 +3144,8 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) · 9 unmodified lines | |||
| 3150 | if (err < 0) | 3144 | if (err < 0) |
| 3151 | return err; | 3145 | return err; |
| 3152 | 3146 | ||
| 3153 | err = nft_ctx_init_from_elemattr(&ctx, cb->skb, cb->nlh, (void *)nla, | 3147 | err = nft_ctx_init_from_elemattr(&ctx, net, cb->skb, cb->nlh, |
| 3154 | false); | 3148 | (void *)nla, false); |
| 3155 | if (err < 0) | 3149 | if (err < 0) |
| 3156 | return err; | 3150 | return err; |
| 3157 | 3151 | ||
| @@ -3212,11 +3206,12 @@ static int nf_tables_getsetelem(struct sock *nlsk, struct sk_buff *skb, · 54 unmodified lines | |||
| 3212 | const struct nlmsghdr *nlh, | 3206 | const struct nlmsghdr *nlh, |
| 3213 | const struct nlattr * const nla[]) | 3207 | const struct nlattr * const nla[]) |
| 3214 | { | 3208 | { |
| 3209 | struct net *net = sock_net(skb->sk); | ||
| 3215 | const struct nft_set *set; | 3210 | const struct nft_set *set; |
| 3216 | struct nft_ctx ctx; | 3211 | struct nft_ctx ctx; |
| 3217 | int err; | 3212 | int err; |
| 3218 | 3213 | ||
| 3219 | err = nft_ctx_init_from_elemattr(&ctx, skb, nlh, nla, false); | 3214 | err = nft_ctx_init_from_elemattr(&ctx, net, skb, nlh, nla, false); |
| 3220 | if (err < 0) | 3215 | if (err < 0) |
| 3221 | return err; | 3216 | return err; |
| 3222 | 3217 | ||
| @@ -3528,11 +3523,10 @@ err1: · 305 unmodified lines | |||
| 3528 | return err; | 3523 | return err; |
| 3529 | } | 3524 | } |
| 3530 | 3525 | ||
| 3531 | static int nf_tables_newsetelem(struct sock *nlsk, struct sk_buff *skb, | 3526 | static int nf_tables_newsetelem(struct net *net, struct sock *nlsk, |
| 3532 | const struct nlmsghdr *nlh, | 3527 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 3533 | const struct nlattr * const nla[]) | 3528 | const struct nlattr * const nla[]) |
| 3534 | { | 3529 | { |
| 3535 | struct net *net = sock_net(skb->sk); | ||
| 3536 | const struct nlattr *attr; | 3530 | const struct nlattr *attr; |
| 3537 | struct nft_set *set; | 3531 | struct nft_set *set; |
| 3538 | struct nft_ctx ctx; | 3532 | struct nft_ctx ctx; |
| @@ -3541,7 +3535,7 @@ static int nf_tables_newsetelem(struct sock *nlsk, struct sk_buff *skb, · 2 unmodified lines | |||
| 3541 | if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) | 3535 | if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) |
| 3542 | return -EINVAL; | 3536 | return -EINVAL; |
| 3543 | 3537 | ||
| 3544 | err = nft_ctx_init_from_elemattr(&ctx, skb, nlh, nla, true); | 3538 | err = nft_ctx_init_from_elemattr(&ctx, net, skb, nlh, nla, true); |
| 3545 | if (err < 0) | 3539 | if (err < 0) |
| 3546 | return err; | 3540 | return err; |
| 3547 | 3541 | ||
| @@ -3623,8 +3617,8 @@ err1: · 75 unmodified lines | |||
| 3623 | return err; | 3617 | return err; |
| 3624 | } | 3618 | } |
| 3625 | 3619 | ||
| 3626 | static int nf_tables_delsetelem(struct sock *nlsk, struct sk_buff *skb, | 3620 | static int nf_tables_delsetelem(struct net *net, struct sock *nlsk, |
| 3627 | const struct nlmsghdr *nlh, | 3621 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 3628 | const struct nlattr * const nla[]) | 3622 | const struct nlattr * const nla[]) |
| 3629 | { | 3623 | { |
| 3630 | const struct nlattr *attr; | 3624 | const struct nlattr *attr; |
| @@ -3635,7 +3629,7 @@ static int nf_tables_delsetelem(struct sock *nlsk, struct sk_buff *skb, · 4 unmodified lines | |||
| 3635 | if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) | 3629 | if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) |
| 3636 | return -EINVAL; | 3630 | return -EINVAL; |
| 3637 | 3631 | ||
| 3638 | err = nft_ctx_init_from_elemattr(&ctx, skb, nlh, nla, false); | 3632 | err = nft_ctx_init_from_elemattr(&ctx, net, skb, nlh, nla, false); |
| 3639 | if (err < 0) | 3633 | if (err < 0) |
| 3640 | return err; | 3634 | return err; |
| 3641 | 3635 | ||
| @@ -4030,7 +4024,8 @@ static int nf_tables_abort(struct sk_buff *skb) · 388 unmodified lines | |||
| 4030 | struct nft_trans *trans, *next; | 4024 | struct nft_trans *trans, *next; |
| 4031 | struct nft_trans_elem *te; | 4025 | struct nft_trans_elem *te; |
| 4032 | 4026 | ||
| 4033 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { | 4027 | list_for_each_entry_safe_reverse(trans, next, &net->nft.commit_list, |
| 4028 | list) { | ||
| 4034 | switch (trans->msg_type) { | 4029 | switch (trans->msg_type) { |
| 4035 | case NFT_MSG_NEWTABLE: | 4030 | case NFT_MSG_NEWTABLE: |
| 4036 | if (nft_trans_table_update(trans)) { | 4031 | if (nft_trans_table_update(trans)) { |
| @@ -295,8 +295,6 @@ replay: · 294 unmodified lines | |||
| 295 | if (!skb) | 295 | if (!skb) |
| 296 | return netlink_ack(oskb, nlh, -ENOMEM); | 296 | return netlink_ack(oskb, nlh, -ENOMEM); |
| 297 | 297 | ||
| 298 | skb->sk = oskb->sk; | ||
| 299 | |||
| 300 | nfnl_lock(subsys_id); | 298 | nfnl_lock(subsys_id); |
| 301 | ss = rcu_dereference_protected(table[subsys_id].subsys, | 299 | ss = rcu_dereference_protected(table[subsys_id].subsys, |
| 302 | lockdep_is_held(&table[subsys_id].mutex)); | 300 | lockdep_is_held(&table[subsys_id].mutex)); |
| @@ -381,7 +379,7 @@ replay: · 78 unmodified lines | |||
| 381 | goto ack; | 379 | goto ack; |
| 382 | 380 | ||
| 383 | if (nc->call_batch) { | 381 | if (nc->call_batch) { |
| 384 | err = nc->call_batch(net->nfnl, skb, nlh, | 382 | err = nc->call_batch(net, net->nfnl, skb, nlh, |
| 385 | (const struct nlattr **)cda); | 383 | (const struct nlattr **)cda); |
| 386 | } | 384 | } |
| 387 | 385 | ||
| @@ -365,8 +365,9 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, · 364 unmodified lines | |||
| 365 | break; | 365 | break; |
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | nfnl_ct = rcu_dereference(nfnl_ct_hook); | ||
| 369 | |||
| 368 | if (queue->flags & NFQA_CFG_F_CONNTRACK) { | 370 | if (queue->flags & NFQA_CFG_F_CONNTRACK) { |
| 369 | nfnl_ct = rcu_dereference(nfnl_ct_hook); | ||
| 370 | if (nfnl_ct != NULL) { | 371 | if (nfnl_ct != NULL) { |
| 371 | ct = nfnl_ct->get_ct(entskb, &ctinfo); | 372 | ct = nfnl_ct->get_ct(entskb, &ctinfo); |
| 372 | if (ct != NULL) | 373 | if (ct != NULL) |
| @@ -1064,9 +1065,10 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb, · 691 unmodified lines | |||
| 1064 | if (entry == NULL) | 1065 | if (entry == NULL) |
| 1065 | return -ENOENT; | 1066 | return -ENOENT; |
| 1066 | 1067 | ||
| 1068 | /* rcu lock already held from nfnl->call_rcu. */ | ||
| 1069 | nfnl_ct = rcu_dereference(nfnl_ct_hook); | ||
| 1070 | |||
| 1067 | if (nfqa[NFQA_CT]) { | 1071 | if (nfqa[NFQA_CT]) { |
| 1068 | /* rcu lock already held from nfnl->call_rcu. */ | ||
| 1069 | nfnl_ct = rcu_dereference(nfnl_ct_hook); | ||
| 1070 | if (nfnl_ct != NULL) | 1072 | if (nfnl_ct != NULL) |
| 1071 | ct = nfqnl_ct_parse(nfnl_ct, nlh, nfqa, entry, &ctinfo); | 1073 | ct = nfqnl_ct_parse(nfnl_ct, nlh, nfqa, entry, &ctinfo); |
| 1072 | } | 1074 | } |
| @@ -1417,6 +1419,7 @@ static int __init nfnetlink_queue_init(void) · 344 unmodified lines | |||
| 1417 | 1419 | ||
| 1418 | cleanup_netlink_notifier: | 1420 | cleanup_netlink_notifier: |
| 1419 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); | 1421 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
| 1422 | unregister_pernet_subsys(&nfnl_queue_net_ops); | ||
| 1420 | out: | 1423 | out: |
| 1421 | return status; | 1424 | return status; |
| 1422 | } | 1425 | } |
| @@ -53,6 +53,8 @@ struct ovs_conntrack_info { · 52 unmodified lines | |||
| 53 | struct md_labels labels; | 53 | struct md_labels labels; |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info); | ||
| 57 | |||
| 56 | static u16 key_to_nfproto(const struct sw_flow_key *key) | 58 | static u16 key_to_nfproto(const struct sw_flow_key *key) |
| 57 | { | 59 | { |
| 58 | switch (ntohs(key->eth.type)) { | 60 | switch (ntohs(key->eth.type)) { |
| @@ -141,6 +143,7 @@ static void __ovs_ct_update_key(struct sw_flow_key *key, u8 state, · 82 unmodified lines | |||
| 141 | * previously sent the packet to conntrack via the ct action. | 143 | * previously sent the packet to conntrack via the ct action. |
| 142 | */ | 144 | */ |
| 143 | static void ovs_ct_update_key(const struct sk_buff *skb, | 145 | static void ovs_ct_update_key(const struct sk_buff *skb, |
| 146 | const struct ovs_conntrack_info *info, | ||
| 144 | struct sw_flow_key *key, bool post_ct) | 147 | struct sw_flow_key *key, bool post_ct) |
| 145 | { | 148 | { |
| 146 | const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt; | 149 | const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt; |
| @@ -158,13 +161,15 @@ static void ovs_ct_update_key(const struct sk_buff *skb, · 11 unmodified lines | |||
| 158 | zone = nf_ct_zone(ct); | 161 | zone = nf_ct_zone(ct); |
| 159 | } else if (post_ct) { | 162 | } else if (post_ct) { |
| 160 | state = OVS_CS_F_TRACKED | OVS_CS_F_INVALID; | 163 | state = OVS_CS_F_TRACKED | OVS_CS_F_INVALID; |
| 164 | if (info) | ||
| 165 | zone = &info->zone; | ||
| 161 | } | 166 | } |
| 162 | __ovs_ct_update_key(key, state, zone, ct); | 167 | __ovs_ct_update_key(key, state, zone, ct); |
| 163 | } | 168 | } |
| 164 | 169 | ||
| 165 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key) | 170 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key) |
| 166 | { | 171 | { |
| 167 | ovs_ct_update_key(skb, key, false); | 172 | ovs_ct_update_key(skb, NULL, key, false); |
| 168 | } | 173 | } |
| 169 | 174 | ||
| 170 | int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb) | 175 | int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb) |
| @@ -418,7 +423,7 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key, · 247 unmodified lines | |||
| 418 | } | 423 | } |
| 419 | } | 424 | } |
| 420 | 425 | ||
| 421 | ovs_ct_update_key(skb, key, true); | 426 | ovs_ct_update_key(skb, info, key, true); |
| 422 | 427 | ||
| 423 | return 0; | 428 | return 0; |
| 424 | } | 429 | } |
| @@ -708,7 +713,7 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, · 283 unmodified lines | |||
| 708 | nf_conntrack_get(&ct_info.ct->ct_general); | 713 | nf_conntrack_get(&ct_info.ct->ct_general); |
| 709 | return 0; | 714 | return 0; |
| 710 | err_free_ct: | 715 | err_free_ct: |
| 711 | nf_conntrack_free(ct_info.ct); | 716 | __ovs_ct_free_action(&ct_info); |
| 712 | return err; | 717 | return err; |
| 713 | } | 718 | } |
| 714 | 719 | ||
| @@ -750,6 +755,11 @@ void ovs_ct_free_action(const struct nlattr *a) · 35 unmodified lines | |||
| 750 | { | 755 | { |
| 751 | struct ovs_conntrack_info *ct_info = nla_data(a); | 756 | struct ovs_conntrack_info *ct_info = nla_data(a); |
| 752 | 757 | ||
| 758 | __ovs_ct_free_action(ct_info); | ||
| 759 | } | ||
| 760 | |||
| 761 | static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info) | ||
| 762 | { | ||
| 753 | if (ct_info->helper) | 763 | if (ct_info->helper) |
| 754 | module_put(ct_info->helper->me); | 764 | module_put(ct_info->helper->me); |
| 755 | if (ct_info->ct) | 765 | if (ct_info->ct) |
| @@ -49,7 +49,6 @@ · 48 unmodified lines | |||
| 49 | struct rfkill { | 49 | struct rfkill { |
| 50 | spinlock_t lock; | 50 | spinlock_t lock; |
| 51 | 51 | ||
| 52 | const char *name; | ||
| 53 | enum rfkill_type type; | 52 | enum rfkill_type type; |
| 54 | 53 | ||
| 55 | unsigned long state; | 54 | unsigned long state; |
| @@ -73,6 +72,7 @@ struct rfkill { · 17 unmodified lines | |||
| 73 | struct delayed_work poll_work; | 72 | struct delayed_work poll_work; |
| 74 | struct work_struct uevent_work; | 73 | struct work_struct uevent_work; |
| 75 | struct work_struct sync_work; | 74 | struct work_struct sync_work; |
| 75 | char name[]; | ||
| 76 | }; | 76 | }; |
| 77 | #define to_rfkill(d) container_of(d, struct rfkill, dev) | 77 | #define to_rfkill(d) container_of(d, struct rfkill, dev) |
| 78 | 78 | ||
| @@ -876,14 +876,14 @@ struct rfkill * __must_check rfkill_alloc(const char *name, · 797 unmodified lines | |||
| 876 | if (WARN_ON(type == RFKILL_TYPE_ALL || type >= NUM_RFKILL_TYPES)) | 876 | if (WARN_ON(type == RFKILL_TYPE_ALL || type >= NUM_RFKILL_TYPES)) |
| 877 | return NULL; | 877 | return NULL; |
| 878 | 878 | ||
| 879 | rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL); | 879 | rfkill = kzalloc(sizeof(*rfkill) + strlen(name) + 1, GFP_KERNEL); |
| 880 | if (!rfkill) | 880 | if (!rfkill) |
| 881 | return NULL; | 881 | return NULL; |
| 882 | 882 | ||
| 883 | spin_lock_init(&rfkill->lock); | 883 | spin_lock_init(&rfkill->lock); |
| 884 | INIT_LIST_HEAD(&rfkill->node); | 884 | INIT_LIST_HEAD(&rfkill->node); |
| 885 | rfkill->type = type; | 885 | rfkill->type = type; |
| 886 | rfkill->name = name; | 886 | strcpy(rfkill->name, name); |
| 887 | rfkill->ops = ops; | 887 | rfkill->ops = ops; |
| 888 | rfkill->data = ops_data; | 888 | rfkill->data = ops_data; |
| 889 | 889 | ||
| @@ -950,7 +950,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, · 949 unmodified lines | |||
| 950 | } | 950 | } |
| 951 | lockdep_set_class(qdisc_lock(sch), &qdisc_tx_lock); | 951 | lockdep_set_class(qdisc_lock(sch), &qdisc_tx_lock); |
| 952 | if (!netif_is_multiqueue(dev)) | 952 | if (!netif_is_multiqueue(dev)) |
| 953 | sch->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT; | 953 | sch->flags |= TCQ_F_ONETXQUEUE; |
| 954 | } | 954 | } |
| 955 | 955 | ||
| 956 | sch->handle = handle; | 956 | sch->handle = handle; |
| @@ -323,14 +323,13 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, · 322 unmodified lines | |||
| 323 | } | 323 | } |
| 324 | } | 324 | } |
| 325 | } | 325 | } |
| 326 | rcu_read_unlock(); | ||
| 327 | |||
| 328 | if (baddr) { | 326 | if (baddr) { |
| 329 | fl6->saddr = baddr->v6.sin6_addr; | 327 | fl6->saddr = baddr->v6.sin6_addr; |
| 330 | fl6->fl6_sport = baddr->v6.sin6_port; | 328 | fl6->fl6_sport = baddr->v6.sin6_port; |
| 331 | final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); | 329 | final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); |
| 332 | dst = ip6_dst_lookup_flow(sk, fl6, final_p); | 330 | dst = ip6_dst_lookup_flow(sk, fl6, final_p); |
| 333 | } | 331 | } |
| 332 | rcu_read_unlock(); | ||
| 334 | 333 | ||
| 335 | out: | 334 | out: |
| 336 | if (!IS_ERR_OR_NULL(dst)) { | 335 | if (!IS_ERR_OR_NULL(dst)) { |
| @@ -642,6 +641,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, · 305 unmodified lines | |||
| 642 | struct sock *newsk; | 641 | struct sock *newsk; |
| 643 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); | 642 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); |
| 644 | struct sctp6_sock *newsctp6sk; | 643 | struct sctp6_sock *newsctp6sk; |
| 644 | struct ipv6_txoptions *opt; | ||
| 645 | 645 | ||
| 646 | newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot, 0); | 646 | newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot, 0); |
| 647 | if (!newsk) | 647 | if (!newsk) |
| @@ -661,6 +661,13 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, · 13 unmodified lines | |||
| 661 | 661 | ||
| 662 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 662 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
| 663 | 663 | ||
| 664 | rcu_read_lock(); | ||
| 665 | opt = rcu_dereference(np->opt); | ||
| 666 | if (opt) | ||
| 667 | opt = ipv6_dup_options(newsk, opt); | ||
| 668 | RCU_INIT_POINTER(newnp->opt, opt); | ||
| 669 | rcu_read_unlock(); | ||
| 670 | |||
| 664 | /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname() | 671 | /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname() |
| 665 | * and getpeername(). | 672 | * and getpeername(). |
| 666 | */ | 673 | */ |
| @@ -324,6 +324,7 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk) · 323 unmodified lines | |||
| 324 | sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) : | 324 | sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) : |
| 325 | "illegal chunk"); | 325 | "illegal chunk"); |
| 326 | 326 | ||
| 327 | sctp_chunk_hold(chunk); | ||
| 327 | sctp_outq_tail_data(q, chunk); | 328 | sctp_outq_tail_data(q, chunk); |
| 328 | if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) | 329 | if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) |
| 329 | SCTP_INC_STATS(net, SCTP_MIB_OUTUNORDERCHUNKS); | 330 | SCTP_INC_STATS(net, SCTP_MIB_OUTUNORDERCHUNKS); |
| @@ -1251,6 +1252,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk) · 921 unmodified lines | |||
| 1251 | */ | 1252 | */ |
| 1252 | 1253 | ||
| 1253 | sack_a_rwnd = ntohl(sack->a_rwnd); | 1254 | sack_a_rwnd = ntohl(sack->a_rwnd); |
| 1255 | asoc->peer.zero_window_announced = !sack_a_rwnd; | ||
| 1254 | outstanding = q->outstanding_bytes; | 1256 | outstanding = q->outstanding_bytes; |
| 1255 | 1257 | ||
| 1256 | if (outstanding < sack_a_rwnd) | 1258 | if (outstanding < sack_a_rwnd) |
| @@ -1652,7 +1652,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, · 1651 unmodified lines | |||
| 1652 | 1652 | ||
| 1653 | /* Set an expiration time for the cookie. */ | 1653 | /* Set an expiration time for the cookie. */ |
| 1654 | cookie->c.expiration = ktime_add(asoc->cookie_life, | 1654 | cookie->c.expiration = ktime_add(asoc->cookie_life, |
| 1655 | ktime_get()); | 1655 | ktime_get_real()); |
| 1656 | 1656 | ||
| 1657 | /* Copy the peer's init packet. */ | 1657 | /* Copy the peer's init packet. */ |
| 1658 | memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr, | 1658 | memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr, |
| @@ -1780,7 +1780,7 @@ no_hmac: · 121 unmodified lines | |||
| 1780 | if (sock_flag(ep->base.sk, SOCK_TIMESTAMP)) | 1780 | if (sock_flag(ep->base.sk, SOCK_TIMESTAMP)) |
| 1781 | kt = skb_get_ktime(skb); | 1781 | kt = skb_get_ktime(skb); |
| 1782 | else | 1782 | else |
| 1783 | kt = ktime_get(); | 1783 | kt = ktime_get_real(); |
| 1784 | 1784 | ||
| 1785 | if (!asoc && ktime_before(bear_cookie->expiration, kt)) { | 1785 | if (!asoc && ktime_before(bear_cookie->expiration, kt)) { |
| 1786 | /* | 1786 | /* |
| @@ -5412,7 +5412,8 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(struct net *net, · 5411 unmodified lines | |||
| 5412 | SCTP_INC_STATS(net, SCTP_MIB_T3_RTX_EXPIREDS); | 5412 | SCTP_INC_STATS(net, SCTP_MIB_T3_RTX_EXPIREDS); |
| 5413 | 5413 | ||
| 5414 | if (asoc->overall_error_count >= asoc->max_retrans) { | 5414 | if (asoc->overall_error_count >= asoc->max_retrans) { |
| 5415 | if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING) { | 5415 | if (asoc->peer.zero_window_announced && |
| 5416 | asoc->state == SCTP_STATE_SHUTDOWN_PENDING) { | ||
| 5416 | /* | 5417 | /* |
| 5417 | * We are here likely because the receiver had its rwnd | 5418 | * We are here likely because the receiver had its rwnd |
| 5418 | * closed for a while and we have not been able to | 5419 | * closed for a while and we have not been able to |
| @@ -1952,8 +1952,6 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) · 1951 unmodified lines | |||
| 1952 | 1952 | ||
| 1953 | /* Now send the (possibly) fragmented message. */ | 1953 | /* Now send the (possibly) fragmented message. */ |
| 1954 | list_for_each_entry(chunk, &datamsg->chunks, frag_list) { | 1954 | list_for_each_entry(chunk, &datamsg->chunks, frag_list) { |
| 1955 | sctp_chunk_hold(chunk); | ||
| 1956 | |||
| 1957 | /* Do accounting for the write space. */ | 1955 | /* Do accounting for the write space. */ |
| 1958 | sctp_set_owner_w(chunk); | 1956 | sctp_set_owner_w(chunk); |
| 1959 | 1957 | ||
| @@ -1966,15 +1964,13 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) · 6 unmodified lines | |||
| 1966 | * breaks. | 1964 | * breaks. |
| 1967 | */ | 1965 | */ |
| 1968 | err = sctp_primitive_SEND(net, asoc, datamsg); | 1966 | err = sctp_primitive_SEND(net, asoc, datamsg); |
| 1967 | sctp_datamsg_put(datamsg); | ||
| 1969 | /* Did the lower layer accept the chunk? */ | 1968 | /* Did the lower layer accept the chunk? */ |
| 1970 | if (err) { | 1969 | if (err) |
| 1971 | sctp_datamsg_free(datamsg); | ||
| 1972 | goto out_free; | 1970 | goto out_free; |
| 1973 | } | ||
| 1974 | 1971 | ||
| 1975 | pr_debug("%s: we sent primitively\n", __func__); | 1972 | pr_debug("%s: we sent primitively\n", __func__); |
| 1976 | 1973 | ||
| 1977 | sctp_datamsg_put(datamsg); | ||
| 1978 | err = msg_len; | 1974 | err = msg_len; |
| 1979 | 1975 | ||
| 1980 | if (unlikely(wait_connect)) { | 1976 | if (unlikely(wait_connect)) { |
| @@ -7167,6 +7163,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, · 5186 unmodified lines | |||
| 7167 | newsk->sk_type = sk->sk_type; | 7163 | newsk->sk_type = sk->sk_type; |
| 7168 | newsk->sk_bound_dev_if = sk->sk_bound_dev_if; | 7164 | newsk->sk_bound_dev_if = sk->sk_bound_dev_if; |
| 7169 | newsk->sk_flags = sk->sk_flags; | 7165 | newsk->sk_flags = sk->sk_flags; |
| 7166 | newsk->sk_tsflags = sk->sk_tsflags; | ||
| 7170 | newsk->sk_no_check_tx = sk->sk_no_check_tx; | 7167 | newsk->sk_no_check_tx = sk->sk_no_check_tx; |
| 7171 | newsk->sk_no_check_rx = sk->sk_no_check_rx; | 7168 | newsk->sk_no_check_rx = sk->sk_no_check_rx; |
| 7172 | newsk->sk_reuse = sk->sk_reuse; | 7169 | newsk->sk_reuse = sk->sk_reuse; |
| @@ -7199,6 +7196,9 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, · 26 unmodified lines | |||
| 7199 | newinet->mc_ttl = 1; | 7196 | newinet->mc_ttl = 1; |
| 7200 | newinet->mc_index = 0; | 7197 | newinet->mc_index = 0; |
| 7201 | newinet->mc_list = NULL; | 7198 | newinet->mc_list = NULL; |
| 7199 | |||
| 7200 | if (newsk->sk_flags & SK_FLAGS_TIMESTAMP) | ||
| 7201 | net_enable_timestamp(); | ||
| 7202 | } | 7202 | } |
| 7203 | 7203 | ||
| 7204 | static inline void sctp_copy_descendant(struct sock *sk_to, | 7204 | static inline void sctp_copy_descendant(struct sock *sk_to, |
| @@ -1695,6 +1695,7 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, · 1694 unmodified lines | |||
| 1695 | msg.msg_name = addr ? (struct sockaddr *)&address : NULL; | 1695 | msg.msg_name = addr ? (struct sockaddr *)&address : NULL; |
| 1696 | /* We assume all kernel code knows the size of sockaddr_storage */ | 1696 | /* We assume all kernel code knows the size of sockaddr_storage */ |
| 1697 | msg.msg_namelen = 0; | 1697 | msg.msg_namelen = 0; |
| 1698 | msg.msg_iocb = NULL; | ||
| 1698 | if (sock->file->f_flags & O_NONBLOCK) | 1699 | if (sock->file->f_flags & O_NONBLOCK) |
| 1699 | flags |= MSG_DONTWAIT; | 1700 | flags |= MSG_DONTWAIT; |
| 1700 | err = sock_recvmsg(sock, &msg, iov_iter_count(&msg.msg_iter), flags); | 1701 | err = sock_recvmsg(sock, &msg, iov_iter_count(&msg.msg_iter), flags); |
| @@ -353,20 +353,12 @@ void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied) · 352 unmodified lines | |||
| 353 | { | 353 | { |
| 354 | struct rpc_xprt *xprt = req->rq_xprt; | 354 | struct rpc_xprt *xprt = req->rq_xprt; |
| 355 | struct svc_serv *bc_serv = xprt->bc_serv; | 355 | struct svc_serv *bc_serv = xprt->bc_serv; |
| 356 | struct xdr_buf *rq_rcv_buf = &req->rq_rcv_buf; | ||
| 357 | 356 | ||
| 358 | spin_lock(&xprt->bc_pa_lock); | 357 | spin_lock(&xprt->bc_pa_lock); |
| 359 | list_del(&req->rq_bc_pa_list); | 358 | list_del(&req->rq_bc_pa_list); |
| 360 | xprt_dec_alloc_count(xprt, 1); | 359 | xprt_dec_alloc_count(xprt, 1); |
| 361 | spin_unlock(&xprt->bc_pa_lock); | 360 | spin_unlock(&xprt->bc_pa_lock); |
| 362 | 361 | ||
| 363 | if (copied <= rq_rcv_buf->head[0].iov_len) { | ||
| 364 | rq_rcv_buf->head[0].iov_len = copied; | ||
| 365 | rq_rcv_buf->page_len = 0; | ||
| 366 | } else { | ||
| 367 | rq_rcv_buf->page_len = copied - rq_rcv_buf->head[0].iov_len; | ||
| 368 | } | ||
| 369 | |||
| 370 | req->rq_private_buf.len = copied; | 362 | req->rq_private_buf.len = copied; |
| 371 | set_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); | 363 | set_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); |
| 372 | 364 | ||
| @@ -250,11 +250,11 @@ void rpc_destroy_wait_queue(struct rpc_wait_queue *queue) · 249 unmodified lines | |||
| 250 | } | 250 | } |
| 251 | EXPORT_SYMBOL_GPL(rpc_destroy_wait_queue); | 251 | EXPORT_SYMBOL_GPL(rpc_destroy_wait_queue); |
| 252 | 252 | ||
| 253 | static int rpc_wait_bit_killable(struct wait_bit_key *key) | 253 | static int rpc_wait_bit_killable(struct wait_bit_key *key, int mode) |
| 254 | { | 254 | { |
| 255 | if (fatal_signal_pending(current)) | ||
| 256 | return -ERESTARTSYS; | ||
| 257 | freezable_schedule_unsafe(); | 255 | freezable_schedule_unsafe(); |
| 256 | if (signal_pending_state(mode, current)) | ||
| 257 | return -ERESTARTSYS; | ||
| 258 | return 0; | 258 | return 0; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| @@ -1363,7 +1363,19 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req, · 1362 unmodified lines | |||
| 1363 | memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen); | 1363 | memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen); |
| 1364 | memcpy(&rqstp->rq_arg, &req->rq_rcv_buf, sizeof(rqstp->rq_arg)); | 1364 | memcpy(&rqstp->rq_arg, &req->rq_rcv_buf, sizeof(rqstp->rq_arg)); |
| 1365 | memcpy(&rqstp->rq_res, &req->rq_snd_buf, sizeof(rqstp->rq_res)); | 1365 | memcpy(&rqstp->rq_res, &req->rq_snd_buf, sizeof(rqstp->rq_res)); |
| 1366 | |||
| 1367 | /* Adjust the argument buffer length */ | ||
| 1366 | rqstp->rq_arg.len = req->rq_private_buf.len; | 1368 | rqstp->rq_arg.len = req->rq_private_buf.len; |
| 1369 | if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len) { | ||
| 1370 | rqstp->rq_arg.head[0].iov_len = rqstp->rq_arg.len; | ||
| 1371 | rqstp->rq_arg.page_len = 0; | ||
| 1372 | } else if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len + | ||
| 1373 | rqstp->rq_arg.page_len) | ||
| 1374 | rqstp->rq_arg.page_len = rqstp->rq_arg.len - | ||
| 1375 | rqstp->rq_arg.head[0].iov_len; | ||
| 1376 | else | ||
| 1377 | rqstp->rq_arg.len = rqstp->rq_arg.head[0].iov_len + | ||
| 1378 | rqstp->rq_arg.page_len; | ||
| 1367 | 1379 | ||
| 1368 | /* reset result send buffer "put" position */ | 1380 | /* reset result send buffer "put" position */ |
| 1369 | resv->iov_len = 0; | 1381 | resv->iov_len = 0; |
| @@ -2256,14 +2256,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state) · 2255 unmodified lines | |||
| 2256 | /* Lock the socket to prevent queue disordering | 2256 | /* Lock the socket to prevent queue disordering |
| 2257 | * while sleeps in memcpy_tomsg | 2257 | * while sleeps in memcpy_tomsg |
| 2258 | */ | 2258 | */ |
| 2259 | err = mutex_lock_interruptible(&u->readlock); | 2259 | mutex_lock(&u->readlock); |
| 2260 | if (unlikely(err)) { | ||
| 2261 | /* recvmsg() in non blocking mode is supposed to return -EAGAIN | ||
| 2262 | * sk_rcvtimeo is not honored by mutex_lock_interruptible() | ||
| 2263 | */ | ||
| 2264 | err = noblock ? -EAGAIN : -ERESTARTSYS; | ||
| 2265 | goto out; | ||
| 2266 | } | ||
| 2267 | 2260 | ||
| 2268 | if (flags & MSG_PEEK) | 2261 | if (flags & MSG_PEEK) |
| 2269 | skip = sk_peek_offset(sk, flags); | 2262 | skip = sk_peek_offset(sk, flags); |
| @@ -2307,12 +2300,12 @@ again: · 37 unmodified lines | |||
| 2307 | timeo = unix_stream_data_wait(sk, timeo, last, | 2300 | timeo = unix_stream_data_wait(sk, timeo, last, |
| 2308 | last_len); | 2301 | last_len); |
| 2309 | 2302 | ||
| 2310 | if (signal_pending(current) || | 2303 | if (signal_pending(current)) { |
| 2311 | mutex_lock_interruptible(&u->readlock)) { | ||
| 2312 | err = sock_intr_errno(timeo); | 2304 | err = sock_intr_errno(timeo); |
| 2313 | goto out; | 2305 | goto out; |
| 2314 | } | 2306 | } |
| 2315 | 2307 | ||
| 2308 | mutex_lock(&u->readlock); | ||
| 2316 | continue; | 2309 | continue; |
| 2317 | unlock: | 2310 | unlock: |
| 2318 | unix_state_unlock(sk); | 2311 | unix_state_unlock(sk); |
| @@ -7941,8 +7941,10 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) · 7940 unmodified lines | |||
| 7941 | if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) { | 7941 | if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) { |
| 7942 | if (!(rdev->wiphy.features & | 7942 | if (!(rdev->wiphy.features & |
| 7943 | NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) || | 7943 | NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) || |
| 7944 | !(rdev->wiphy.features & NL80211_FEATURE_QUIET)) | 7944 | !(rdev->wiphy.features & NL80211_FEATURE_QUIET)) { |
| 7945 | kzfree(connkeys); | ||
| 7945 | return -EINVAL; | 7946 | return -EINVAL; |
| 7947 | } | ||
| 7946 | connect.flags |= ASSOC_REQ_USE_RRM; | 7948 | connect.flags |= ASSOC_REQ_USE_RRM; |
| 7947 | } | 7949 | } |
| 7948 | 7950 | ||
| @@ -9503,6 +9505,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) · 1554 unmodified lines | |||
| 9503 | if (new_triggers.tcp && new_triggers.tcp->sock) | 9505 | if (new_triggers.tcp && new_triggers.tcp->sock) |
| 9504 | sock_release(new_triggers.tcp->sock); | 9506 | sock_release(new_triggers.tcp->sock); |
| 9505 | kfree(new_triggers.tcp); | 9507 | kfree(new_triggers.tcp); |
| 9508 | kfree(new_triggers.nd_config); | ||
| 9506 | return err; | 9509 | return err; |
| 9507 | } | 9510 | } |
| 9508 | #endif | 9511 | #endif |
| @@ -3029,6 +3029,7 @@ int set_regdom(const struct ieee80211_regdomain *rd, · 3028 unmodified lines | |||
| 3029 | break; | 3029 | break; |
| 3030 | default: | 3030 | default: |
| 3031 | WARN(1, "invalid initiator %d\n", lr->initiator); | 3031 | WARN(1, "invalid initiator %d\n", lr->initiator); |
| 3032 | kfree(rd); | ||
| 3032 | return -EINVAL; | 3033 | return -EINVAL; |
| 3033 | } | 3034 | } |
| 3034 | 3035 | ||
| @@ -3221,8 +3222,10 @@ int __init regulatory_init(void) · 186 unmodified lines | |||
| 3221 | /* We always try to get an update for the static regdomain */ | 3222 | /* We always try to get an update for the static regdomain */ |
| 3222 | err = regulatory_hint_core(cfg80211_world_regdom->alpha2); | 3223 | err = regulatory_hint_core(cfg80211_world_regdom->alpha2); |
| 3223 | if (err) { | 3224 | if (err) { |
| 3224 | if (err == -ENOMEM) | 3225 | if (err == -ENOMEM) { |
| 3226 | platform_device_unregister(reg_pdev); | ||
| 3225 | return err; | 3227 | return err; |
| 3228 | } | ||
| 3226 | /* | 3229 | /* |
| 3227 | * N.B. kobject_uevent_env() can fail mainly for when we're out | 3230 | * N.B. kobject_uevent_env() can fail mainly for when we're out |
| 3228 | * memory which is handled and propagated appropriately above | 3231 | * memory which is handled and propagated appropriately above |
| @@ -303,6 +303,14 @@ struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp) · 302 unmodified lines | |||
| 303 | } | 303 | } |
| 304 | EXPORT_SYMBOL(xfrm_policy_alloc); | 304 | EXPORT_SYMBOL(xfrm_policy_alloc); |
| 305 | 305 | ||
| 306 | static void xfrm_policy_destroy_rcu(struct rcu_head *head) | ||
| 307 | { | ||
| 308 | struct xfrm_policy *policy = container_of(head, struct xfrm_policy, rcu); | ||
| 309 | |||
| 310 | security_xfrm_policy_free(policy->security); | ||
| 311 | kfree(policy); | ||
| 312 | } | ||
| 313 | |||
| 306 | /* Destroy xfrm_policy: descendant resources must be released to this moment. */ | 314 | /* Destroy xfrm_policy: descendant resources must be released to this moment. */ |
| 307 | 315 | ||
| 308 | void xfrm_policy_destroy(struct xfrm_policy *policy) | 316 | void xfrm_policy_destroy(struct xfrm_policy *policy) |
| @@ -312,8 +320,7 @@ void xfrm_policy_destroy(struct xfrm_policy *policy) · 3 unmodified lines | |||
| 312 | if (del_timer(&policy->timer) || del_timer(&policy->polq.hold_timer)) | 320 | if (del_timer(&policy->timer) || del_timer(&policy->polq.hold_timer)) |
| 313 | BUG(); | 321 | BUG(); |
| 314 | 322 | ||
| 315 | security_xfrm_policy_free(policy->security); | 323 | call_rcu(&policy->rcu, xfrm_policy_destroy_rcu); |
| 316 | kfree(policy); | ||
| 317 | } | 324 | } |
| 318 | EXPORT_SYMBOL(xfrm_policy_destroy); | 325 | EXPORT_SYMBOL(xfrm_policy_destroy); |
| 319 | 326 | ||
| @@ -1214,8 +1221,10 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir, · 894 unmodified lines | |||
| 1214 | struct xfrm_policy *pol; | 1221 | struct xfrm_policy *pol; |
| 1215 | struct net *net = sock_net(sk); | 1222 | struct net *net = sock_net(sk); |
| 1216 | 1223 | ||
| 1224 | rcu_read_lock(); | ||
| 1217 | read_lock_bh(&net->xfrm.xfrm_policy_lock); | 1225 | read_lock_bh(&net->xfrm.xfrm_policy_lock); |
| 1218 | if ((pol = sk->sk_policy[dir]) != NULL) { | 1226 | pol = rcu_dereference(sk->sk_policy[dir]); |
| 1227 | if (pol != NULL) { | ||
| 1219 | bool match = xfrm_selector_match(&pol->selector, fl, | 1228 | bool match = xfrm_selector_match(&pol->selector, fl, |
| 1220 | sk->sk_family); | 1229 | sk->sk_family); |
| 1221 | int err = 0; | 1230 | int err = 0; |
| @@ -1239,6 +1248,7 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir, · 17 unmodified lines | |||
| 1239 | } | 1248 | } |
| 1240 | out: | 1249 | out: |
| 1241 | read_unlock_bh(&net->xfrm.xfrm_policy_lock); | 1250 | read_unlock_bh(&net->xfrm.xfrm_policy_lock); |
| 1251 | rcu_read_unlock(); | ||
| 1242 | return pol; | 1252 | return pol; |
| 1243 | } | 1253 | } |
| 1244 | 1254 | ||
| @@ -1307,13 +1317,14 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol) · 62 unmodified lines | |||
| 1307 | #endif | 1317 | #endif |
| 1308 | 1318 | ||
| 1309 | write_lock_bh(&net->xfrm.xfrm_policy_lock); | 1319 | write_lock_bh(&net->xfrm.xfrm_policy_lock); |
| 1310 | old_pol = sk->sk_policy[dir]; | 1320 | old_pol = rcu_dereference_protected(sk->sk_policy[dir], |
| 1311 | sk->sk_policy[dir] = pol; | 1321 | lockdep_is_held(&net->xfrm.xfrm_policy_lock)); |
| 1312 | if (pol) { | 1322 | if (pol) { |
| 1313 | pol->curlft.add_time = get_seconds(); | 1323 | pol->curlft.add_time = get_seconds(); |
| 1314 | pol->index = xfrm_gen_index(net, XFRM_POLICY_MAX+dir, 0); | 1324 | pol->index = xfrm_gen_index(net, XFRM_POLICY_MAX+dir, 0); |
| 1315 | xfrm_sk_policy_link(pol, dir); | 1325 | xfrm_sk_policy_link(pol, dir); |
| 1316 | } | 1326 | } |
| 1327 | rcu_assign_pointer(sk->sk_policy[dir], pol); | ||
| 1317 | if (old_pol) { | 1328 | if (old_pol) { |
| 1318 | if (pol) | 1329 | if (pol) |
| 1319 | xfrm_policy_requeue(old_pol, pol); | 1330 | xfrm_policy_requeue(old_pol, pol); |
| @@ -1361,17 +1372,26 @@ static struct xfrm_policy *clone_policy(const struct xfrm_policy *old, int dir) · 41 unmodified lines | |||
| 1361 | return newp; | 1372 | return newp; |
| 1362 | } | 1373 | } |
| 1363 | 1374 | ||
| 1364 | int __xfrm_sk_clone_policy(struct sock *sk) | 1375 | int __xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk) |
| 1365 | { | 1376 | { |
| 1366 | struct xfrm_policy *p0 = sk->sk_policy[0], | 1377 | const struct xfrm_policy *p; |
| 1367 | *p1 = sk->sk_policy[1]; | 1378 | struct xfrm_policy *np; |
| 1379 | int i, ret = 0; | ||
| 1368 | 1380 | ||
| 1369 | sk->sk_policy[0] = sk->sk_policy[1] = NULL; | 1381 | rcu_read_lock(); |
| 1370 | if (p0 && (sk->sk_policy[0] = clone_policy(p0, 0)) == NULL) | 1382 | for (i = 0; i < 2; i++) { |
| 1371 | return -ENOMEM; | 1383 | p = rcu_dereference(osk->sk_policy[i]); |
| 1372 | if (p1 && (sk->sk_policy[1] = clone_policy(p1, 1)) == NULL) | 1384 | if (p) { |
| 1373 | return -ENOMEM; | 1385 | np = clone_policy(p, i); |
| 1374 | return 0; | 1386 | if (unlikely(!np)) { |
| 1387 | ret = -ENOMEM; | ||
| 1388 | break; | ||
| 1389 | } | ||
| 1390 | rcu_assign_pointer(sk->sk_policy[i], np); | ||
| 1391 | } | ||
| 1392 | } | ||
| 1393 | rcu_read_unlock(); | ||
| 1394 | return ret; | ||
| 1375 | } | 1395 | } |
| 1376 | 1396 | ||
| 1377 | static int | 1397 | static int |
| @@ -2198,6 +2218,7 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, · 820 unmodified lines | |||
| 2198 | xdst = NULL; | 2218 | xdst = NULL; |
| 2199 | route = NULL; | 2219 | route = NULL; |
| 2200 | 2220 | ||
| 2221 | sk = sk_const_to_full_sk(sk); | ||
| 2201 | if (sk && sk->sk_policy[XFRM_POLICY_OUT]) { | 2222 | if (sk && sk->sk_policy[XFRM_POLICY_OUT]) { |
| 2202 | num_pols = 1; | 2223 | num_pols = 1; |
| 2203 | pols[0] = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl); | 2224 | pols[0] = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl); |
| @@ -2477,6 +2498,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, · 273 unmodified lines | |||
| 2477 | } | 2498 | } |
| 2478 | 2499 | ||
| 2479 | pol = NULL; | 2500 | pol = NULL; |
| 2501 | sk = sk_to_full_sk(sk); | ||
| 2480 | if (sk && sk->sk_policy[dir]) { | 2502 | if (sk && sk->sk_policy[dir]) { |
| 2481 | pol = xfrm_sk_policy_lookup(sk, dir, &fl); | 2503 | pol = xfrm_sk_policy_lookup(sk, dir, &fl); |
| 2482 | if (IS_ERR(pol)) { | 2504 | if (IS_ERR(pol)) { |
| @@ -62,7 +62,7 @@ vmlinux_link() · 61 unmodified lines | |||
| 62 | -Wl,--start-group \ | 62 | -Wl,--start-group \ |
| 63 | ${KBUILD_VMLINUX_MAIN} \ | 63 | ${KBUILD_VMLINUX_MAIN} \ |
| 64 | -Wl,--end-group \ | 64 | -Wl,--end-group \ |
| 65 | -lutil ${1} | 65 | -lutil -lrt ${1} |
| 66 | rm -f linux | 66 | rm -f linux |
| 67 | fi | 67 | fi |
| 68 | } | 68 | } |
| @@ -355,6 +355,8 @@ enum { · 354 unmodified lines | |||
| 355 | ((pci)->device == 0x0d0c) || \ | 355 | ((pci)->device == 0x0d0c) || \ |
| 356 | ((pci)->device == 0x160c)) | 356 | ((pci)->device == 0x160c)) |
| 357 | 357 | ||
| 358 | #define IS_BROXTON(pci) ((pci)->device == 0x5a98) | ||
| 359 | |||
| 358 | static char *driver_short_names[] = { | 360 | static char *driver_short_names[] = { |
| 359 | [AZX_DRIVER_ICH] = "HDA Intel", | 361 | [AZX_DRIVER_ICH] = "HDA Intel", |
| 360 | [AZX_DRIVER_PCH] = "HDA Intel PCH", | 362 | [AZX_DRIVER_PCH] = "HDA Intel PCH", |
| @@ -506,15 +508,36 @@ static void azx_init_pci(struct azx *chip) · 145 unmodified lines | |||
| 506 | } | 508 | } |
| 507 | } | 509 | } |
| 508 | 510 | ||
| 511 | /* | ||
| 512 | * In BXT-P A0, HD-Audio DMA requests is later than expected, | ||
| 513 | * and makes an audio stream sensitive to system latencies when | ||
| 514 | * 24/32 bits are playing. | ||
| 515 | * Adjusting threshold of DMA fifo to force the DMA request | ||
| 516 | * sooner to improve latency tolerance at the expense of power. | ||
| 517 | */ | ||
| 518 | static void bxt_reduce_dma_latency(struct azx *chip) | ||
| 519 | { | ||
| 520 | u32 val; | ||
| 521 | |||
| 522 | val = azx_readl(chip, SKL_EM4L); | ||
| 523 | val &= (0x3 << 20); | ||
| 524 | azx_writel(chip, SKL_EM4L, val); | ||
| 525 | } | ||
| 526 | |||
| 509 | static void hda_intel_init_chip(struct azx *chip, bool full_reset) | 527 | static void hda_intel_init_chip(struct azx *chip, bool full_reset) |
| 510 | { | 528 | { |
| 511 | struct hdac_bus *bus = azx_bus(chip); | 529 | struct hdac_bus *bus = azx_bus(chip); |
| 530 | struct pci_dev *pci = chip->pci; | ||
| 512 | 531 | ||
| 513 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 532 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
| 514 | snd_hdac_set_codec_wakeup(bus, true); | 533 | snd_hdac_set_codec_wakeup(bus, true); |
| 515 | azx_init_chip(chip, full_reset); | 534 | azx_init_chip(chip, full_reset); |
| 516 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 535 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
| 517 | snd_hdac_set_codec_wakeup(bus, false); | 536 | snd_hdac_set_codec_wakeup(bus, false); |
| 537 | |||
| 538 | /* reduce dma latency to avoid noise */ | ||
| 539 | if (IS_BROXTON(pci)) | ||
| 540 | bxt_reduce_dma_latency(chip); | ||
| 518 | } | 541 | } |
| 519 | 542 | ||
| 520 | /* calculate runtime delay from LPIB */ | 543 | /* calculate runtime delay from LPIB */ |
| @@ -778,7 +778,8 @@ static const struct hda_pintbl alienware_pincfgs[] = { · 777 unmodified lines | |||
| 778 | }; | 778 | }; |
| 779 | 779 | ||
| 780 | static const struct snd_pci_quirk ca0132_quirks[] = { | 780 | static const struct snd_pci_quirk ca0132_quirks[] = { |
| 781 | SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15", QUIRK_ALIENWARE), | 781 | SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE), |
| 782 | SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE), | ||
| 782 | {} | 783 | {} |
| 783 | }; | 784 | }; |
| 784 | 785 | ||
| @@ -111,6 +111,7 @@ struct alc_spec { · 110 unmodified lines | |||
| 111 | void (*power_hook)(struct hda_codec *codec); | 111 | void (*power_hook)(struct hda_codec *codec); |
| 112 | #endif | 112 | #endif |
| 113 | void (*shutup)(struct hda_codec *codec); | 113 | void (*shutup)(struct hda_codec *codec); |
| 114 | void (*reboot_notify)(struct hda_codec *codec); | ||
| 114 | 115 | ||
| 115 | int init_amp; | 116 | int init_amp; |
| 116 | int codec_variant; /* flag for other variants */ | 117 | int codec_variant; /* flag for other variants */ |
| @@ -773,6 +774,25 @@ static inline void alc_shutup(struct hda_codec *codec) · 656 unmodified lines | |||
| 773 | snd_hda_shutup_pins(codec); | 774 | snd_hda_shutup_pins(codec); |
| 774 | } | 775 | } |
| 775 | 776 | ||
| 777 | static void alc_reboot_notify(struct hda_codec *codec) | ||
| 778 | { | ||
| 779 | struct alc_spec *spec = codec->spec; | ||
| 780 | |||
| 781 | if (spec && spec->reboot_notify) | ||
| 782 | spec->reboot_notify(codec); | ||
| 783 | else | ||
| 784 | alc_shutup(codec); | ||
| 785 | } | ||
| 786 | |||
| 787 | /* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */ | ||
| 788 | static void alc_d3_at_reboot(struct hda_codec *codec) | ||
| 789 | { | ||
| 790 | snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); | ||
| 791 | snd_hda_codec_write(codec, codec->core.afg, 0, | ||
| 792 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | ||
| 793 | msleep(10); | ||
| 794 | } | ||
| 795 | |||
| 776 | #define alc_free snd_hda_gen_free | 796 | #define alc_free snd_hda_gen_free |
| 777 | 797 | ||
| 778 | #ifdef CONFIG_PM | 798 | #ifdef CONFIG_PM |
| @@ -818,7 +838,7 @@ static const struct hda_codec_ops alc_patch_ops = { · 39 unmodified lines | |||
| 818 | .suspend = alc_suspend, | 838 | .suspend = alc_suspend, |
| 819 | .check_power_status = snd_hda_gen_check_power_status, | 839 | .check_power_status = snd_hda_gen_check_power_status, |
| 820 | #endif | 840 | #endif |
| 821 | .reboot_notify = alc_shutup, | 841 | .reboot_notify = alc_reboot_notify, |
| 822 | }; | 842 | }; |
| 823 | 843 | ||
| 824 | 844 | ||
| @@ -4198,6 +4218,8 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec, · 3373 unmodified lines | |||
| 4198 | struct alc_spec *spec = codec->spec; | 4218 | struct alc_spec *spec = codec->spec; |
| 4199 | 4219 | ||
| 4200 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | 4220 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
| 4221 | spec->shutup = alc_no_shutup; /* reduce click noise */ | ||
| 4222 | spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */ | ||
| 4201 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; | 4223 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; |
| 4202 | codec->power_save_node = 0; /* avoid click noises */ | 4224 | codec->power_save_node = 0; /* avoid click noises */ |
| 4203 | snd_hda_apply_pincfgs(codec, pincfgs); | 4225 | snd_hda_apply_pincfgs(codec, pincfgs); |
| @@ -4578,6 +4600,7 @@ enum { · 374 unmodified lines | |||
| 4578 | ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC, | 4600 | ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC, |
| 4579 | ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, | 4601 | ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 4580 | ALC292_FIXUP_TPT440_DOCK, | 4602 | ALC292_FIXUP_TPT440_DOCK, |
| 4603 | ALC292_FIXUP_TPT440, | ||
| 4581 | ALC283_FIXUP_BXBT2807_MIC, | 4604 | ALC283_FIXUP_BXBT2807_MIC, |
| 4582 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, | 4605 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, |
| 4583 | ALC282_FIXUP_ASPIRE_V5_PINS, | 4606 | ALC282_FIXUP_ASPIRE_V5_PINS, |
| @@ -4593,9 +4616,11 @@ enum { · 9 unmodified lines | |||
| 4593 | ALC288_FIXUP_DISABLE_AAMIX, | 4616 | ALC288_FIXUP_DISABLE_AAMIX, |
| 4594 | ALC292_FIXUP_DELL_E7X, | 4617 | ALC292_FIXUP_DELL_E7X, |
| 4595 | ALC292_FIXUP_DISABLE_AAMIX, | 4618 | ALC292_FIXUP_DISABLE_AAMIX, |
| 4619 | ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, | ||
| 4596 | ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, | 4620 | ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 4597 | ALC275_FIXUP_DELL_XPS, | 4621 | ALC275_FIXUP_DELL_XPS, |
| 4598 | ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, | 4622 | ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, |
| 4623 | ALC293_FIXUP_LENOVO_SPK_NOISE, | ||
| 4599 | }; | 4624 | }; |
| 4600 | 4625 | ||
| 4601 | static const struct hda_fixup alc269_fixups[] = { | 4626 | static const struct hda_fixup alc269_fixups[] = { |
| @@ -5050,6 +5075,12 @@ static const struct hda_fixup alc269_fixups[] = { · 448 unmodified lines | |||
| 5050 | .chained = true, | 5075 | .chained = true, |
| 5051 | .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST | 5076 | .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST |
| 5052 | }, | 5077 | }, |
| 5078 | [ALC292_FIXUP_TPT440] = { | ||
| 5079 | .type = HDA_FIXUP_FUNC, | ||
| 5080 | .v.func = alc_fixup_disable_aamix, | ||
| 5081 | .chained = true, | ||
| 5082 | .chain_id = ALC292_FIXUP_TPT440_DOCK, | ||
| 5083 | }, | ||
| 5053 | [ALC283_FIXUP_BXBT2807_MIC] = { | 5084 | [ALC283_FIXUP_BXBT2807_MIC] = { |
| 5054 | .type = HDA_FIXUP_PINS, | 5085 | .type = HDA_FIXUP_PINS, |
| 5055 | .v.pins = (const struct hda_pintbl[]) { | 5086 | .v.pins = (const struct hda_pintbl[]) { |
| @@ -5149,6 +5180,12 @@ static const struct hda_fixup alc269_fixups[] = { · 93 unmodified lines | |||
| 5149 | .chained = true, | 5180 | .chained = true, |
| 5150 | .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE | 5181 | .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE |
| 5151 | }, | 5182 | }, |
| 5183 | [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = { | ||
| 5184 | .type = HDA_FIXUP_FUNC, | ||
| 5185 | .v.func = alc_fixup_disable_aamix, | ||
| 5186 | .chained = true, | ||
| 5187 | .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE | ||
| 5188 | }, | ||
| 5152 | [ALC292_FIXUP_DELL_E7X] = { | 5189 | [ALC292_FIXUP_DELL_E7X] = { |
| 5153 | .type = HDA_FIXUP_FUNC, | 5190 | .type = HDA_FIXUP_FUNC, |
| 5154 | .v.func = alc_fixup_dell_xps13, | 5191 | .v.func = alc_fixup_dell_xps13, |
| @@ -5187,6 +5224,12 @@ static const struct hda_fixup alc269_fixups[] = { · 32 unmodified lines | |||
| 5187 | .chained = true, | 5224 | .chained = true, |
| 5188 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | 5225 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE |
| 5189 | }, | 5226 | }, |
| 5227 | [ALC293_FIXUP_LENOVO_SPK_NOISE] = { | ||
| 5228 | .type = HDA_FIXUP_FUNC, | ||
| 5229 | .v.func = alc_fixup_disable_aamix, | ||
| 5230 | .chained = true, | ||
| 5231 | .chain_id = ALC269_FIXUP_THINKPAD_ACPI | ||
| 5232 | }, | ||
| 5190 | }; | 5233 | }; |
| 5191 | 5234 | ||
| 5192 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 5235 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
| @@ -5221,11 +5264,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 28 unmodified lines | |||
| 5221 | SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), | 5264 | SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5222 | SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 5265 | SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5223 | SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 5266 | SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5224 | SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC292_FIXUP_DISABLE_AAMIX), | 5267 | SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
| 5225 | SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC292_FIXUP_DISABLE_AAMIX), | 5268 | SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
| 5226 | SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX), | 5269 | SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
| 5227 | SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC292_FIXUP_DISABLE_AAMIX), | 5270 | SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
| 5228 | SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC292_FIXUP_DISABLE_AAMIX), | 5271 | SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
| 5229 | SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 5272 | SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
| 5230 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 5273 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5231 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 5274 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| @@ -5325,15 +5368,17 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 93 unmodified lines | |||
| 5325 | SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), | 5368 | SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), |
| 5326 | SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), | 5369 | SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), |
| 5327 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), | 5370 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), |
| 5328 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), | 5371 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440), |
| 5329 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), | 5372 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), |
| 5330 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), | 5373 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), |
| 5331 | SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK), | 5374 | SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK), |
| 5332 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), | 5375 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), |
| 5333 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK), | 5376 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK), |
| 5334 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5377 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 5378 | SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK), | ||
| 5335 | SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK), | 5379 | SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK), |
| 5336 | SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK), | 5380 | SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK), |
| 5381 | SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE), | ||
| 5337 | SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), | 5382 | SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), |
| 5338 | SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), | 5383 | SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), |
| 5339 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5384 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| @@ -5343,6 +5388,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 3 unmodified lines | |||
| 5343 | SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK), | 5388 | SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK), |
| 5344 | SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), | 5389 | SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), |
| 5345 | SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK), | 5390 | SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK), |
| 5391 | SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE), | ||
| 5346 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5392 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 5347 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), | 5393 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
| 5348 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), | 5394 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
| @@ -5423,6 +5469,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { · 74 unmodified lines | |||
| 5423 | {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, | 5469 | {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, |
| 5424 | {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, | 5470 | {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, |
| 5425 | {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"}, | 5471 | {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"}, |
| 5472 | {.id = ALC292_FIXUP_TPT440, .name = "tpt440"}, | ||
| 5426 | {} | 5473 | {} |
| 5427 | }; | 5474 | }; |
| 5428 | 5475 | ||
| @@ -6409,6 +6456,7 @@ static const struct hda_fixup alc662_fixups[] = { · 980 unmodified lines | |||
| 6409 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { | 6456 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
| 6410 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), | 6457 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), |
| 6411 | SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC), | 6458 | SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC), |
| 6459 | SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC), | ||
| 6412 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), | 6460 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
| 6413 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), | 6461 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
| 6414 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), | 6462 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
| @@ -741,10 +741,11 @@ snd_rme96_playback_setrate(struct rme96 *rme96, · 740 unmodified lines | |||
| 741 | { | 741 | { |
| 742 | /* change to/from double-speed: reset the DAC (if available) */ | 742 | /* change to/from double-speed: reset the DAC (if available) */ |
| 743 | snd_rme96_reset_dac(rme96); | 743 | snd_rme96_reset_dac(rme96); |
| 744 | return 1; /* need to restore volume */ | ||
| 744 | } else { | 745 | } else { |
| 745 | writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER); | 746 | writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER); |
| 747 | return 0; | ||
| 746 | } | 748 | } |
| 747 | return 0; | ||
| 748 | } | 749 | } |
| 749 | 750 | ||
| 750 | static int | 751 | static int |
| @@ -980,6 +981,7 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream, · 229 unmodified lines | |||
| 980 | struct rme96 *rme96 = snd_pcm_substream_chip(substream); | 981 | struct rme96 *rme96 = snd_pcm_substream_chip(substream); |
| 981 | struct snd_pcm_runtime *runtime = substream->runtime; | 982 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 982 | int err, rate, dummy; | 983 | int err, rate, dummy; |
| 984 | bool apply_dac_volume = false; | ||
| 983 | 985 | ||
| 984 | runtime->dma_area = (void __force *)(rme96->iobase + | 986 | runtime->dma_area = (void __force *)(rme96->iobase + |
| 985 | RME96_IO_PLAY_BUFFER); | 987 | RME96_IO_PLAY_BUFFER); |
| @@ -993,24 +995,26 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream, · 7 unmodified lines | |||
| 993 | { | 995 | { |
| 994 | /* slave clock */ | 996 | /* slave clock */ |
| 995 | if ((int)params_rate(params) != rate) { | 997 | if ((int)params_rate(params) != rate) { |
| 996 | spin_unlock_irq(&rme96->lock); | 998 | err = -EIO; |
| 997 | return -EIO; | 999 | goto error; |
| 998 | } | 1000 | } |
| 999 | } else if ((err = snd_rme96_playback_setrate(rme96, params_rate(params))) < 0) { | 1001 | } else { |
| 1000 | spin_unlock_irq(&rme96->lock); | 1002 | err = snd_rme96_playback_setrate(rme96, params_rate(params)); |
| 1001 | return err; | 1003 | if (err < 0) |
| 1002 | } | 1004 | goto error; |
| 1003 | if ((err = snd_rme96_playback_setformat(rme96, params_format(params))) < 0) { | 1005 | apply_dac_volume = err > 0; /* need to restore volume later? */ |
| 1004 | spin_unlock_irq(&rme96->lock); | ||
| 1005 | return err; | ||
| 1006 | } | 1006 | } |
| 1007 | |||
| 1008 | err = snd_rme96_playback_setformat(rme96, params_format(params)); | ||
| 1009 | if (err < 0) | ||
| 1010 | goto error; | ||
| 1007 | snd_rme96_setframelog(rme96, params_channels(params), 1); | 1011 | snd_rme96_setframelog(rme96, params_channels(params), 1); |
| 1008 | if (rme96->capture_periodsize != 0) { | 1012 | if (rme96->capture_periodsize != 0) { |
| 1009 | if (params_period_size(params) << rme96->playback_frlog != | 1013 | if (params_period_size(params) << rme96->playback_frlog != |
| 1010 | rme96->capture_periodsize) | 1014 | rme96->capture_periodsize) |
| 1011 | { | 1015 | { |
| 1012 | spin_unlock_irq(&rme96->lock); | 1016 | err = -EBUSY; |
| 1013 | return -EBUSY; | 1017 | goto error; |
| 1014 | } | 1018 | } |
| 1015 | } | 1019 | } |
| 1016 | rme96->playback_periodsize = | 1020 | rme96->playback_periodsize = |
| @@ -1021,9 +1025,16 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream, · 4 unmodified lines | |||
| 1021 | rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP); | 1025 | rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP); |
| 1022 | writel(rme96->wcreg |= rme96->wcreg_spdif_stream, rme96->iobase + RME96_IO_CONTROL_REGISTER); | 1026 | writel(rme96->wcreg |= rme96->wcreg_spdif_stream, rme96->iobase + RME96_IO_CONTROL_REGISTER); |
| 1023 | } | 1027 | } |
| 1028 | |||
| 1029 | err = 0; | ||
| 1030 | error: | ||
| 1024 | spin_unlock_irq(&rme96->lock); | 1031 | spin_unlock_irq(&rme96->lock); |
| 1025 | 1032 | if (apply_dac_volume) { | |
| 1026 | return 0; | 1033 | usleep_range(3000, 10000); |
| 1034 | snd_rme96_apply_dac_volume(rme96); | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | return err; | ||
| 1027 | } | 1038 | } |
| 1028 | 1039 | ||
| 1029 | static int | 1040 | static int |
| @@ -1354,6 +1354,8 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, · 1353 unmodified lines | |||
| 1354 | } | 1354 | } |
| 1355 | } | 1355 | } |
| 1356 | 1356 | ||
| 1357 | snd_usb_mixer_fu_apply_quirk(state->mixer, cval, unitid, kctl); | ||
| 1358 | |||
| 1357 | range = (cval->max - cval->min) / cval->res; | 1359 | range = (cval->max - cval->min) / cval->res; |
| 1358 | /* | 1360 | /* |
| 1359 | * Are there devices with volume range more than 255? I use a bit more | 1361 | * Are there devices with volume range more than 255? I use a bit more |
| @@ -348,13 +348,6 @@ static struct usbmix_name_map bose_companion5_map[] = { · 347 unmodified lines | |||
| 348 | { 0 } /* terminator */ | 348 | { 0 } /* terminator */ |
| 349 | }; | 349 | }; |
| 350 | 350 | ||
| 351 | /* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */ | ||
| 352 | static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000}; | ||
| 353 | static struct usbmix_name_map dragonfly_1_2_map[] = { | ||
| 354 | { 7, NULL, .dB = &dragonfly_1_2_dB }, | ||
| 355 | { 0 } /* terminator */ | ||
| 356 | }; | ||
| 357 | |||
| 358 | /* | 351 | /* |
| 359 | * Control map entries | 352 | * Control map entries |
| 360 | */ | 353 | */ |
| @@ -470,11 +463,6 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { · 109 unmodified lines | |||
| 470 | .id = USB_ID(0x05a7, 0x1020), | 463 | .id = USB_ID(0x05a7, 0x1020), |
| 471 | .map = bose_companion5_map, | 464 | .map = bose_companion5_map, |
| 472 | }, | 465 | }, |
| 473 | { | ||
| 474 | /* Dragonfly DAC 1.2 */ | ||
| 475 | .id = USB_ID(0x21b4, 0x0081), | ||
| 476 | .map = dragonfly_1_2_map, | ||
| 477 | }, | ||
| 478 | { 0 } /* terminator */ | 466 | { 0 } /* terminator */ |
| 479 | }; | 467 | }; |
| 480 | 468 | ||
| @@ -37,6 +37,7 @@ · 36 unmodified lines | |||
| 37 | #include <sound/control.h> | 37 | #include <sound/control.h> |
| 38 | #include <sound/hwdep.h> | 38 | #include <sound/hwdep.h> |
| 39 | #include <sound/info.h> | 39 | #include <sound/info.h> |
| 40 | #include <sound/tlv.h> | ||
| 40 | 41 | ||
| 41 | #include "usbaudio.h" | 42 | #include "usbaudio.h" |
| 42 | #include "mixer.h" | 43 | #include "mixer.h" |
| @@ -1825,3 +1826,39 @@ void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, · 1782 unmodified lines | |||
| 1825 | } | 1826 | } |
| 1826 | } | 1827 | } |
| 1827 | 1828 | ||
| 1829 | static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer, | ||
| 1830 | struct snd_kcontrol *kctl) | ||
| 1831 | { | ||
| 1832 | /* Approximation using 10 ranges based on output measurement on hw v1.2. | ||
| 1833 | * This seems close to the cubic mapping e.g. alsamixer uses. */ | ||
| 1834 | static const DECLARE_TLV_DB_RANGE(scale, | ||
| 1835 | 0, 1, TLV_DB_MINMAX_ITEM(-5300, -4970), | ||
| 1836 | 2, 5, TLV_DB_MINMAX_ITEM(-4710, -4160), | ||
| 1837 | 6, 7, TLV_DB_MINMAX_ITEM(-3884, -3710), | ||
| 1838 | 8, 14, TLV_DB_MINMAX_ITEM(-3443, -2560), | ||
| 1839 | 15, 16, TLV_DB_MINMAX_ITEM(-2475, -2324), | ||
| 1840 | 17, 19, TLV_DB_MINMAX_ITEM(-2228, -2031), | ||
| 1841 | 20, 26, TLV_DB_MINMAX_ITEM(-1910, -1393), | ||
| 1842 | 27, 31, TLV_DB_MINMAX_ITEM(-1322, -1032), | ||
| 1843 | 32, 40, TLV_DB_MINMAX_ITEM(-968, -490), | ||
| 1844 | 41, 50, TLV_DB_MINMAX_ITEM(-441, 0), | ||
| 1845 | ); | ||
| 1846 | |||
| 1847 | usb_audio_info(mixer->chip, "applying DragonFly dB scale quirk\n"); | ||
| 1848 | kctl->tlv.p = scale; | ||
| 1849 | kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; | ||
| 1850 | kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; | ||
| 1851 | } | ||
| 1852 | |||
| 1853 | void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer, | ||
| 1854 | struct usb_mixer_elem_info *cval, int unitid, | ||
| 1855 | struct snd_kcontrol *kctl) | ||
| 1856 | { | ||
| 1857 | switch (mixer->chip->usb_id) { | ||
| 1858 | case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */ | ||
| 1859 | if (unitid == 7 && cval->min == 0 && cval->max == 50) | ||
| 1860 | snd_dragonfly_quirk_db_scale(mixer, kctl); | ||
| 1861 | break; | ||
| 1862 | } | ||
| 1863 | } | ||
| 1864 | |||
| @@ -9,5 +9,9 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, · 8 unmodified lines | |||
| 9 | void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, | 9 | void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, |
| 10 | int unitid); | 10 | int unitid); |
| 11 | 11 | ||
| 12 | void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer, | ||
| 13 | struct usb_mixer_elem_info *cval, int unitid, | ||
| 14 | struct snd_kcontrol *kctl); | ||
| 15 | |||
| 12 | #endif /* SND_USB_MIXER_QUIRKS_H */ | 16 | #endif /* SND_USB_MIXER_QUIRKS_H */ |
| 13 | 17 | ||
| @@ -1125,6 +1125,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) · 1124 unmodified lines | |||
| 1125 | case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ | 1125 | case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ |
| 1126 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ | 1126 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ |
| 1127 | case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ | 1127 | case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ |
| 1128 | case USB_ID(0x21B4, 0x0081): /* AudioQuest DragonFly */ | ||
| 1128 | return true; | 1129 | return true; |
| 1129 | } | 1130 | } |
| 1130 | return false; | 1131 | return false; |
| @@ -110,4 +110,10 @@ static inline void free_page(unsigned long addr) · 109 unmodified lines | |||
| 110 | (void) (&_min1 == &_min2); \ | 110 | (void) (&_min1 == &_min2); \ |
| 111 | _min1 < _min2 ? _min1 : _min2; }) | 111 | _min1 < _min2 ? _min1 : _min2; }) |
| 112 | 112 | ||
| 113 | /* TODO: empty stubs for now. Broken but enough for virtio_ring.c */ | ||
| 114 | #define list_add_tail(a, b) do {} while (0) | ||
| 115 | #define list_del(a) do {} while (0) | ||
| 116 | #define list_for_each_entry(a, b, c) while (0) | ||
| 117 | /* end of stubs */ | ||
| 118 | |||
| 113 | #endif /* KERNEL_H */ | 119 | #endif /* KERNEL_H */ |
| @@ -3,12 +3,6 @@ · 2 unmodified lines | |||
| 3 | #include <linux/scatterlist.h> | 3 | #include <linux/scatterlist.h> |
| 4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
| 5 | 5 | ||
| 6 | /* TODO: empty stubs for now. Broken but enough for virtio_ring.c */ | ||
| 7 | #define list_add_tail(a, b) do {} while (0) | ||
| 8 | #define list_del(a) do {} while (0) | ||
| 9 | #define list_for_each_entry(a, b, c) while (0) | ||
| 10 | /* end of stubs */ | ||
| 11 | |||
| 12 | struct virtio_device { | 6 | struct virtio_device { |
| 13 | void *dev; | 7 | void *dev; |
| 14 | u64 features; | 8 | u64 features; |
| @@ -40,33 +40,39 @@ static inline void __virtio_clear_bit(struct virtio_device *vdev, · 39 unmodified lines | |||
| 40 | #define virtio_has_feature(dev, feature) \ | 40 | #define virtio_has_feature(dev, feature) \ |
| 41 | (__virtio_test_bit((dev), feature)) | 41 | (__virtio_test_bit((dev), feature)) |
| 42 | 42 | ||
| 43 | static inline bool virtio_is_little_endian(struct virtio_device *vdev) | ||
| 44 | { | ||
| 45 | return virtio_has_feature(vdev, VIRTIO_F_VERSION_1) || | ||
| 46 | virtio_legacy_is_little_endian(); | ||
| 47 | } | ||
| 48 | |||
| 49 | /* Memory accessors */ | ||
| 43 | static inline u16 virtio16_to_cpu(struct virtio_device *vdev, __virtio16 val) | 50 | static inline u16 virtio16_to_cpu(struct virtio_device *vdev, __virtio16 val) |
| 44 | { | 51 | { |
| 45 | return __virtio16_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 52 | return __virtio16_to_cpu(virtio_is_little_endian(vdev), val); |
| 46 | } | 53 | } |
| 47 | 54 | ||
| 48 | static inline __virtio16 cpu_to_virtio16(struct virtio_device *vdev, u16 val) | 55 | static inline __virtio16 cpu_to_virtio16(struct virtio_device *vdev, u16 val) |
| 49 | { | 56 | { |
| 50 | return __cpu_to_virtio16(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 57 | return __cpu_to_virtio16(virtio_is_little_endian(vdev), val); |
| 51 | } | 58 | } |
| 52 | 59 | ||
| 53 | static inline u32 virtio32_to_cpu(struct virtio_device *vdev, __virtio32 val) | 60 | static inline u32 virtio32_to_cpu(struct virtio_device *vdev, __virtio32 val) |
| 54 | { | 61 | { |
| 55 | return __virtio32_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 62 | return __virtio32_to_cpu(virtio_is_little_endian(vdev), val); |
| 56 | } | 63 | } |
| 57 | 64 | ||
| 58 | static inline __virtio32 cpu_to_virtio32(struct virtio_device *vdev, u32 val) | 65 | static inline __virtio32 cpu_to_virtio32(struct virtio_device *vdev, u32 val) |
| 59 | { | 66 | { |
| 60 | return __cpu_to_virtio32(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 67 | return __cpu_to_virtio32(virtio_is_little_endian(vdev), val); |
| 61 | } | 68 | } |
| 62 | 69 | ||
| 63 | static inline u64 virtio64_to_cpu(struct virtio_device *vdev, __virtio64 val) | 70 | static inline u64 virtio64_to_cpu(struct virtio_device *vdev, __virtio64 val) |
| 64 | { | 71 | { |
| 65 | return __virtio64_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 72 | return __virtio64_to_cpu(virtio_is_little_endian(vdev), val); |
| 66 | } | 73 | } |
| 67 | 74 | ||
| 68 | static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val) | 75 | static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val) |
| 69 | { | 76 | { |
| 70 | return __cpu_to_virtio64(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); | 77 | return __cpu_to_virtio64(virtio_is_little_endian(vdev), val); |
| 71 | } | 78 | } |
| 72 | |||
| @@ -1114,7 +1114,7 @@ bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, struct irq_phys_map *map) · 1113 unmodified lines | |||
| 1114 | return true; | 1114 | return true; |
| 1115 | } | 1115 | } |
| 1116 | 1116 | ||
| 1117 | return dist_active_irq(vcpu); | 1117 | return vgic_irq_is_active(vcpu, map->virt_irq); |
| 1118 | } | 1118 | } |
| 1119 | 1119 | ||
| 1120 | /* | 1120 | /* |