Linux 4.12-rc7 Needed at least rc6 for drm-misc-next-fixes, may as well go to rc7
Unified · Split
| @@ -3811,6 +3811,13 @@ · 3810 unmodified lines | ||
| 3811 | 3811 | expediting. Set to zero to disable automatic |
| 3812 | 3812 | expediting. |
| 3813 | 3813 | |
| 3814 | + stack_guard_gap= [MM] | |
| 3815 | + override the default stack gap protection. The value | |
| 3816 | + is in page units and it defines how many pages prior | |
| 3817 | + to (for stacks growing down) resp. after (for stacks | |
| 3818 | + growing up) the main stack are reserved for no other | |
| 3819 | + mapping. Default value is 256 pages. | |
| 3820 | + | |
| 3814 | 3821 | stacktrace [FTRACE] |
| 3815 | 3822 | Enabled the stack tracer on boot up. |
| 3816 | 3823 | |
| @@ -22,7 +22,8 @@ Required properties : · 21 unmodified lines | ||
| 22 | 22 | - #clock-cells : must contain 1 |
| 23 | 23 | - #reset-cells : must contain 1 |
| 24 | 24 | |
| 25 | −For the PRCM CCUs on H3/A64, one more clock is needed: | |
| 25 | +For the PRCM CCUs on H3/A64, two more clocks are needed: | |
| 26 | +- "pll-periph": the SoC's peripheral PLL from the main CCU | |
| 26 | 27 | - "iosc": the SoC's internal frequency oscillator |
| 27 | 28 | |
| 28 | 29 | Example for generic CCU: |
| @@ -39,8 +40,8 @@ Example for PRCM CCU: · 10 unmodified lines | ||
| 39 | 40 | r_ccu: clock@01f01400 { |
| 40 | 41 | compatible = "allwinner,sun50i-a64-r-ccu"; |
| 41 | 42 | reg = <0x01f01400 0x100>; |
| 42 | − clocks = <&osc24M>, <&osc32k>, <&iosc>; | |
| 43 | − clock-names = "hosc", "losc", "iosc"; | |
| 43 | + clocks = <&osc24M>, <&osc32k>, <&iosc>, <&ccu CLK_PLL_PERIPH0>; | |
| 44 | + clock-names = "hosc", "losc", "iosc", "pll-periph"; | |
| 44 | 45 | #clock-cells = <1>; |
| 45 | 46 | #reset-cells = <1>; |
| 46 | 47 | }; |
| @@ -41,9 +41,9 @@ Required properties: · 40 unmodified lines | ||
| 41 | 41 | Optional properties: |
| 42 | 42 | |
| 43 | 43 | In order to use the GPIO lines in PWM mode, some additional optional |
| 44 | −properties are required. Only Armada 370 and XP support these properties. | |
| 44 | +properties are required. | |
| 45 | 45 | |
| 46 | −- compatible: Must contain "marvell,armada-370-xp-gpio" | |
| 46 | +- compatible: Must contain "marvell,armada-370-gpio" | |
| 47 | 47 | |
| 48 | 48 | - reg: an additional register set is needed, for the GPIO Blink |
| 49 | 49 | Counter on/off registers. |
| @@ -71,7 +71,7 @@ Example: · 21 unmodified lines | ||
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | 73 | gpio1: gpio@18140 { |
| 74 | − compatible = "marvell,armada-370-xp-gpio"; | |
| 74 | + compatible = "marvell,armada-370-gpio"; | |
| 75 | 75 | reg = <0x18140 0x40>, <0x181c8 0x08>; |
| 76 | 76 | reg-names = "gpio", "pwm"; |
| 77 | 77 | ngpios = <17>; |
| @@ -31,7 +31,7 @@ Example: · 30 unmodified lines | ||
| 31 | 31 | compatible = "st,stm32-timers"; |
| 32 | 32 | reg = <0x40010000 0x400>; |
| 33 | 33 | clocks = <&rcc 0 160>; |
| 34 | − clock-names = "clk_int"; | |
| 34 | + clock-names = "int"; | |
| 35 | 35 | |
| 36 | 36 | pwm { |
| 37 | 37 | compatible = "st,stm32-pwm"; |
| @@ -34,7 +34,7 @@ Required properties: · 33 unmodified lines | ||
| 34 | 34 | "brcm,bcm6328-switch" |
| 35 | 35 | "brcm,bcm6368-switch" and the mandatory "brcm,bcm63xx-switch" |
| 36 | 36 | |
| 37 | −See Documentation/devicetree/bindings/dsa/dsa.txt for a list of additional | |
| 37 | +See Documentation/devicetree/bindings/net/dsa/dsa.txt for a list of additional | |
| 38 | 38 | required and optional properties. |
| 39 | 39 | |
| 40 | 40 | Examples: |
| @@ -27,6 +27,7 @@ Optional properties: · 26 unmodified lines | ||
| 27 | 27 | of the device. On many systems this is wired high so the device goes |
| 28 | 28 | out of reset at power-on, but if it is under program control, this |
| 29 | 29 | optional GPIO can wake up in response to it. |
| 30 | +- vdd33a-supply, vddvario-supply : 3.3V analog and IO logic power supplies | |
| 30 | 31 | |
| 31 | 32 | Examples: |
| 32 | 33 | |
| @@ -122,7 +122,7 @@ associated flow of the packet. The hash is either provided by hardware · 121 unmodified lines | ||
| 122 | 122 | or will be computed in the stack. Capable hardware can pass the hash in |
| 123 | 123 | the receive descriptor for the packet; this would usually be the same |
| 124 | 124 | hash used for RSS (e.g. computed Toeplitz hash). The hash is saved in |
| 125 | −skb->rx_hash and can be used elsewhere in the stack as a hash of the | |
| 125 | +skb->hash and can be used elsewhere in the stack as a hash of the | |
| 126 | 126 | packet’s flow. |
| 127 | 127 | |
| 128 | 128 | Each receive hardware queue has an associated list of CPUs to which |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 4 |
| 2 | 2 | PATCHLEVEL = 12 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc5 | |
| 4 | +EXTRAVERSION = -rc7 | |
| 5 | 5 | NAME = Fearless Coyote |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -1437,7 +1437,7 @@ help: · 1429 unmodified lines | ||
| 1437 | 1437 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' |
| 1438 | 1438 | @echo ' make V=2 [targets] 2 => give reason for rebuild of target' |
| 1439 | 1439 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' |
| 1440 | − @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' | |
| 1440 | + @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)' | |
| 1441 | 1441 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' |
| 1442 | 1442 | @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' |
| 1443 | 1443 | @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' |
| @@ -65,7 +65,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 64 unmodified lines | ||
| 65 | 65 | |
| 66 | 66 | vma = find_vma(mm, addr); |
| 67 | 67 | if (TASK_SIZE - len >= addr && |
| 68 | − (!vma || addr + len <= vma->vm_start)) | |
| 68 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 69 | 69 | return addr; |
| 70 | 70 | } |
| 71 | 71 | |
| @@ -220,7 +220,7 @@ · 219 unmodified lines | ||
| 220 | 220 | |
| 221 | 221 | mmc1_pins: pinmux_mmc1_pins { |
| 222 | 222 | pinctrl-single,pins = < |
| 223 | − AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7) /* spi0_cs1.gpio0_6 */ | |
| 223 | + AM33XX_IOPAD(0x96c, PIN_INPUT | MUX_MODE7) /* uart0_rtsn.gpio1_9 */ | |
| 224 | 224 | >; |
| 225 | 225 | }; |
| 226 | 226 | |
| @@ -280,10 +280,6 @@ · 53 unmodified lines | ||
| 280 | 280 | AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE7) /* nKbdReset - gpmc_ad13.gpio1_13 */ |
| 281 | 281 | AM33XX_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE7) /* nDispReset - gpmc_ad14.gpio1_14 */ |
| 282 | 282 | AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE7) /* USB1_enPower - gpmc_a1.gpio1_17 */ |
| 283 | − /* AVR Programming - SPI Bus (bit bang) - Screen and Keyboard */ | |
| 284 | − AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattMOSI spi0_d0.gpio0_3 */ | |
| 285 | − AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattMISO spi0_d1.gpio0_4 */ | |
| 286 | − AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE7) /* Kbd/Disp/BattSCLK spi0_clk.gpio0_2 */ | |
| 287 | 283 | /* PDI Bus - Battery system */ |
| 288 | 284 | AM33XX_IOPAD(0x840, PIN_INPUT_PULLUP | MUX_MODE7) /* nBattReset gpmc_a0.gpio1_16 */ |
| 289 | 285 | AM33XX_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE7) /* BattPDIData gpmc_ad15.gpio1_15 */ |
| @@ -384,7 +380,7 @@ · 94 unmodified lines | ||
| 384 | 380 | pinctrl-names = "default"; |
| 385 | 381 | pinctrl-0 = <&mmc1_pins>; |
| 386 | 382 | bus-width = <4>; |
| 387 | − cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; | |
| 383 | + cd-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; | |
| 388 | 384 | vmmc-supply = <&vmmcsd_fixed>; |
| 389 | 385 | }; |
| 390 | 386 | |
| @@ -558,10 +558,11 @@ · 557 unmodified lines | ||
| 558 | 558 | }; |
| 559 | 559 | |
| 560 | 560 | r_ccu: clock@1f01400 { |
| 561 | − compatible = "allwinner,sun50i-a64-r-ccu"; | |
| 561 | + compatible = "allwinner,sun8i-h3-r-ccu"; | |
| 562 | 562 | reg = <0x01f01400 0x100>; |
| 563 | − clocks = <&osc24M>, <&osc32k>, <&iosc>; | |
| 564 | − clock-names = "hosc", "losc", "iosc"; | |
| 563 | + clocks = <&osc24M>, <&osc32k>, <&iosc>, | |
| 564 | + <&ccu 9>; | |
| 565 | + clock-names = "hosc", "losc", "iosc", "pll-periph"; | |
| 565 | 566 | #clock-cells = <1>; |
| 566 | 567 | #reset-cells = <1>; |
| 567 | 568 | }; |
| @@ -90,7 +90,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 89 unmodified lines | ||
| 90 | 90 | |
| 91 | 91 | vma = find_vma(mm, addr); |
| 92 | 92 | if (TASK_SIZE - len >= addr && |
| 93 | − (!vma || addr + len <= vma->vm_start)) | |
| 93 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 94 | 94 | return addr; |
| 95 | 95 | } |
| 96 | 96 | |
| @@ -141,7 +141,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 44 unmodified lines | ||
| 141 | 141 | addr = PAGE_ALIGN(addr); |
| 142 | 142 | vma = find_vma(mm, addr); |
| 143 | 143 | if (TASK_SIZE - len >= addr && |
| 144 | − (!vma || addr + len <= vma->vm_start)) | |
| 144 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 145 | 145 | return addr; |
| 146 | 146 | } |
| 147 | 147 | |
| @@ -406,8 +406,9 @@ · 405 unmodified lines | ||
| 406 | 406 | r_ccu: clock@1f01400 { |
| 407 | 407 | compatible = "allwinner,sun50i-a64-r-ccu"; |
| 408 | 408 | reg = <0x01f01400 0x100>; |
| 409 | − clocks = <&osc24M>, <&osc32k>, <&iosc>; | |
| 410 | − clock-names = "hosc", "losc", "iosc"; | |
| 409 | + clocks = <&osc24M>, <&osc32k>, <&iosc>, | |
| 410 | + <&ccu 11>; | |
| 411 | + clock-names = "hosc", "losc", "iosc", "pll-periph"; | |
| 411 | 412 | #clock-cells = <1>; |
| 412 | 413 | #reset-cells = <1>; |
| 413 | 414 | }; |
| @@ -40,7 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | * OTHER DEALINGS IN THE SOFTWARE. |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | −#include "sunxi-h3-h5.dtsi" | |
| 43 | +#include <arm/sunxi-h3-h5.dtsi> | |
| 44 | 44 | |
| 45 | 45 | / { |
| 46 | 46 | cpus { |
| @@ -1 +0,0 @@ | ||
| 1 | −../../../../arm/boot/dts/sunxi-h3-h5.dtsi | |
| @@ -221,10 +221,11 @@ void update_vsyscall(struct timekeeper *tk) · 220 unmodified lines | ||
| 221 | 221 | /* tkr_mono.cycle_last == tkr_raw.cycle_last */ |
| 222 | 222 | vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last; |
| 223 | 223 | vdso_data->raw_time_sec = tk->raw_time.tv_sec; |
| 224 | − vdso_data->raw_time_nsec = tk->raw_time.tv_nsec; | |
| 224 | + vdso_data->raw_time_nsec = (tk->raw_time.tv_nsec << | |
| 225 | + tk->tkr_raw.shift) + | |
| 226 | + tk->tkr_raw.xtime_nsec; | |
| 225 | 227 | vdso_data->xtime_clock_sec = tk->xtime_sec; |
| 226 | 228 | vdso_data->xtime_clock_nsec = tk->tkr_mono.xtime_nsec; |
| 227 | − /* tkr_raw.xtime_nsec == 0 */ | |
| 228 | 229 | vdso_data->cs_mono_mult = tk->tkr_mono.mult; |
| 229 | 230 | vdso_data->cs_raw_mult = tk->tkr_raw.mult; |
| 230 | 231 | /* tkr_mono.shift == tkr_raw.shift */ |
| @@ -256,7 +256,6 @@ monotonic_raw: · 255 unmodified lines | ||
| 256 | 256 | seqcnt_check fail=monotonic_raw |
| 257 | 257 | |
| 258 | 258 | /* All computations are done with left-shifted nsecs. */ |
| 259 | − lsl x14, x14, x12 | |
| 260 | 259 | get_nsec_per_sec res=x9 |
| 261 | 260 | lsl x9, x9, x12 |
| 262 | 261 | |
| @@ -36,6 +36,7 @@ int bpf_jit_enable __read_mostly; · 35 unmodified lines | ||
| 36 | 36 | #define TMP_REG_1 (MAX_BPF_JIT_REG + 0) |
| 37 | 37 | #define TMP_REG_2 (MAX_BPF_JIT_REG + 1) |
| 38 | 38 | #define TCALL_CNT (MAX_BPF_JIT_REG + 2) |
| 39 | +#define TMP_REG_3 (MAX_BPF_JIT_REG + 3) | |
| 39 | 40 | |
| 40 | 41 | /* Map BPF registers to A64 registers */ |
| 41 | 42 | static const int bpf2a64[] = { |
| @@ -57,6 +58,7 @@ static const int bpf2a64[] = { · 15 unmodified lines | ||
| 57 | 58 | /* temporary registers for internal BPF JIT */ |
| 58 | 59 | [TMP_REG_1] = A64_R(10), |
| 59 | 60 | [TMP_REG_2] = A64_R(11), |
| 61 | + [TMP_REG_3] = A64_R(12), | |
| 60 | 62 | /* tail_call_cnt */ |
| 61 | 63 | [TCALL_CNT] = A64_R(26), |
| 62 | 64 | /* temporary register for blinding constants */ |
| @@ -319,6 +321,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) · 256 unmodified lines | ||
| 319 | 321 | const u8 src = bpf2a64[insn->src_reg]; |
| 320 | 322 | const u8 tmp = bpf2a64[TMP_REG_1]; |
| 321 | 323 | const u8 tmp2 = bpf2a64[TMP_REG_2]; |
| 324 | + const u8 tmp3 = bpf2a64[TMP_REG_3]; | |
| 322 | 325 | const s16 off = insn->off; |
| 323 | 326 | const s32 imm = insn->imm; |
| 324 | 327 | const int i = insn - ctx->prog->insnsi; |
| @@ -689,10 +692,10 @@ emit_cond_jmp: · 364 unmodified lines | ||
| 689 | 692 | emit(A64_PRFM(tmp, PST, L1, STRM), ctx); |
| 690 | 693 | emit(A64_LDXR(isdw, tmp2, tmp), ctx); |
| 691 | 694 | emit(A64_ADD(isdw, tmp2, tmp2, src), ctx); |
| 692 | − emit(A64_STXR(isdw, tmp2, tmp, tmp2), ctx); | |
| 695 | + emit(A64_STXR(isdw, tmp2, tmp, tmp3), ctx); | |
| 693 | 696 | jmp_offset = -3; |
| 694 | 697 | check_imm19(jmp_offset); |
| 695 | − emit(A64_CBNZ(0, tmp2, jmp_offset), ctx); | |
| 698 | + emit(A64_CBNZ(0, tmp3, jmp_offset), ctx); | |
| 696 | 699 | break; |
| 697 | 700 | |
| 698 | 701 | /* R0 = ntohx(*(size *)(((struct sk_buff *)R6)->data + imm)) */ |
| @@ -75,7 +75,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi · 74 unmodified lines | ||
| 75 | 75 | addr = PAGE_ALIGN(addr); |
| 76 | 76 | vma = find_vma(current->mm, addr); |
| 77 | 77 | if (TASK_SIZE - len >= addr && |
| 78 | − (!vma || addr + len <= vma->vm_start)) | |
| 78 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 79 | 79 | goto success; |
| 80 | 80 | } |
| 81 | 81 | |
| @@ -128,19 +128,19 @@ quiet_cmd_cpp_its_S = ITS $@ · 127 unmodified lines | ||
| 128 | 128 | -DADDR_BITS=$(ADDR_BITS) \ |
| 129 | 129 | -DADDR_CELLS=$(itb_addr_cells) |
| 130 | 130 | |
| 131 | −$(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE | |
| 131 | +$(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE | |
| 132 | 132 | $(call if_changed_dep,cpp_its_S,none,vmlinux.bin) |
| 133 | 133 | |
| 134 | −$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE | |
| 134 | +$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE | |
| 135 | 135 | $(call if_changed_dep,cpp_its_S,gzip,vmlinux.bin.gz) |
| 136 | 136 | |
| 137 | −$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE | |
| 137 | +$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE | |
| 138 | 138 | $(call if_changed_dep,cpp_its_S,bzip2,vmlinux.bin.bz2) |
| 139 | 139 | |
| 140 | −$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE | |
| 140 | +$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE | |
| 141 | 141 | $(call if_changed_dep,cpp_its_S,lzma,vmlinux.bin.lzma) |
| 142 | 142 | |
| 143 | −$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE | |
| 143 | +$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE | |
| 144 | 144 | $(call if_changed_dep,cpp_its_S,lzo,vmlinux.bin.lzo) |
| 145 | 145 | |
| 146 | 146 | quiet_cmd_itb-image = ITB $@ |
| @@ -35,7 +35,12 @@ extern pte_t *pkmap_page_table; · 34 unmodified lines | ||
| 35 | 35 | * easily, subsequent pte tables have to be allocated in one physical |
| 36 | 36 | * chunk of RAM. |
| 37 | 37 | */ |
| 38 | +#ifdef CONFIG_PHYS_ADDR_T_64BIT | |
| 39 | +#define LAST_PKMAP 512 | |
| 40 | +#else | |
| 38 | 41 | #define LAST_PKMAP 1024 |
| 42 | +#endif | |
| 43 | + | |
| 39 | 44 | #define LAST_PKMAP_MASK (LAST_PKMAP-1) |
| 40 | 45 | #define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) |
| 41 | 46 | #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) |
| @@ -43,7 +43,8 @@ typedef union mips_instruction kprobe_opcode_t; · 42 unmodified lines | ||
| 43 | 43 | |
| 44 | 44 | #define flush_insn_slot(p) \ |
| 45 | 45 | do { \ |
| 46 | − flush_icache_range((unsigned long)p->addr, \ | |
| 46 | + if (p->addr) \ | |
| 47 | + flush_icache_range((unsigned long)p->addr, \ | |
| 47 | 48 | (unsigned long)p->addr + \ |
| 48 | 49 | (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \ |
| 49 | 50 | } while (0) |
| @@ -19,6 +19,10 @@ · 18 unmodified lines | ||
| 19 | 19 | #define __ARCH_USE_5LEVEL_HACK |
| 20 | 20 | #include <asm-generic/pgtable-nopmd.h> |
| 21 | 21 | |
| 22 | +#ifdef CONFIG_HIGHMEM | |
| 23 | +#include <asm/highmem.h> | |
| 24 | +#endif | |
| 25 | + | |
| 22 | 26 | extern int temp_tlb_entry; |
| 23 | 27 | |
| 24 | 28 | /* |
| @@ -62,7 +66,8 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, · 37 unmodified lines | ||
| 62 | 66 | |
| 63 | 67 | #define VMALLOC_START MAP_BASE |
| 64 | 68 | |
| 65 | −#define PKMAP_BASE (0xfe000000UL) | |
| 69 | +#define PKMAP_END ((FIXADDR_START) & ~((LAST_PKMAP << PAGE_SHIFT)-1)) | |
| 70 | +#define PKMAP_BASE (PKMAP_END - PAGE_SIZE * LAST_PKMAP) | |
| 66 | 71 | |
| 67 | 72 | #ifdef CONFIG_HIGHMEM |
| 68 | 73 | # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) |
| @@ -804,8 +804,10 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, · 803 unmodified lines | ||
| 804 | 804 | break; |
| 805 | 805 | } |
| 806 | 806 | /* Compact branch: BNEZC || JIALC */ |
| 807 | − if (insn.i_format.rs) | |
| 807 | + if (!insn.i_format.rs) { | |
| 808 | + /* JIALC: set $31/ra */ | |
| 808 | 809 | regs->regs[31] = epc + 4; |
| 810 | + } | |
| 809 | 811 | regs->cp0_epc += 8; |
| 810 | 812 | break; |
| 811 | 813 | #endif |
| @@ -38,20 +38,6 @@ void arch_ftrace_update_code(int command) · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | #endif |
| 40 | 40 | |
| 41 | −/* | |
| 42 | − * Check if the address is in kernel space | |
| 43 | − * | |
| 44 | − * Clone core_kernel_text() from kernel/extable.c, but doesn't call | |
| 45 | − * init_kernel_text() for Ftrace doesn't trace functions in init sections. | |
| 46 | − */ | |
| 47 | −static inline int in_kernel_space(unsigned long ip) | |
| 48 | −{ | |
| 49 | − if (ip >= (unsigned long)_stext && | |
| 50 | − ip <= (unsigned long)_etext) | |
| 51 | − return 1; | |
| 52 | − return 0; | |
| 53 | −} | |
| 54 | − | |
| 55 | 41 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 56 | 42 | |
| 57 | 43 | #define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */ |
| @@ -198,7 +184,7 @@ int ftrace_make_nop(struct module *mod, · 140 unmodified lines | ||
| 198 | 184 | * If ip is in kernel space, no long call, otherwise, long call is |
| 199 | 185 | * needed. |
| 200 | 186 | */ |
| 201 | − new = in_kernel_space(ip) ? INSN_NOP : INSN_B_1F; | |
| 187 | + new = core_kernel_text(ip) ? INSN_NOP : INSN_B_1F; | |
| 202 | 188 | #ifdef CONFIG_64BIT |
| 203 | 189 | return ftrace_modify_code(ip, new); |
| 204 | 190 | #else |
| @@ -218,12 +204,12 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) · 13 unmodified lines | ||
| 218 | 204 | unsigned int new; |
| 219 | 205 | unsigned long ip = rec->ip; |
| 220 | 206 | |
| 221 | − new = in_kernel_space(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0]; | |
| 207 | + new = core_kernel_text(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0]; | |
| 222 | 208 | |
| 223 | 209 | #ifdef CONFIG_64BIT |
| 224 | 210 | return ftrace_modify_code(ip, new); |
| 225 | 211 | #else |
| 226 | − return ftrace_modify_code_2r(ip, new, in_kernel_space(ip) ? | |
| 212 | + return ftrace_modify_code_2r(ip, new, core_kernel_text(ip) ? | |
| 227 | 213 | INSN_NOP : insn_la_mcount[1]); |
| 228 | 214 | #endif |
| 229 | 215 | } |
| @@ -289,7 +275,7 @@ unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long · 59 unmodified lines | ||
| 289 | 275 | * instruction "lui v1, hi_16bit_of_mcount"(offset is 24), but for |
| 290 | 276 | * kernel, move after the instruction "move ra, at"(offset is 16) |
| 291 | 277 | */ |
| 292 | − ip = self_ra - (in_kernel_space(self_ra) ? 16 : 24); | |
| 278 | + ip = self_ra - (core_kernel_text(self_ra) ? 16 : 24); | |
| 293 | 279 | |
| 294 | 280 | /* |
| 295 | 281 | * search the text until finding the non-store instruction or "s{d,w} |
| @@ -394,7 +380,7 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra, · 98 unmodified lines | ||
| 394 | 380 | * entries configured through the tracing/set_graph_function interface. |
| 395 | 381 | */ |
| 396 | 382 | |
| 397 | − insns = in_kernel_space(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1; | |
| 383 | + insns = core_kernel_text(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1; | |
| 398 | 384 | trace.func = self_ra - (MCOUNT_INSN_SIZE * insns); |
| 399 | 385 | |
| 400 | 386 | /* Only trace if the calling function expects to */ |
| @@ -1597,7 +1597,6 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) · 1596 unmodified lines | ||
| 1597 | 1597 | break; |
| 1598 | 1598 | case CPU_P5600: |
| 1599 | 1599 | case CPU_P6600: |
| 1600 | − case CPU_I6400: | |
| 1601 | 1600 | /* 8-bit event numbers */ |
| 1602 | 1601 | raw_id = config & 0x1ff; |
| 1603 | 1602 | base_id = raw_id & 0xff; |
| @@ -1610,6 +1609,11 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) · 6 unmodified lines | ||
| 1610 | 1609 | raw_event.range = P; |
| 1611 | 1610 | #endif |
| 1612 | 1611 | break; |
| 1612 | + case CPU_I6400: | |
| 1613 | + /* 8-bit event numbers */ | |
| 1614 | + base_id = config & 0xff; | |
| 1615 | + raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD; | |
| 1616 | + break; | |
| 1613 | 1617 | case CPU_1004K: |
| 1614 | 1618 | if (IS_BOTH_COUNTERS_1004K_EVENT(base_id)) |
| 1615 | 1619 | raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD; |
| @@ -166,7 +166,11 @@ static int _kvm_mips_host_tlb_inv(unsigned long entryhi) · 165 unmodified lines | ||
| 166 | 166 | int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long va, |
| 167 | 167 | bool user, bool kernel) |
| 168 | 168 | { |
| 169 | − int idx_user, idx_kernel; | |
| 169 | + /* | |
| 170 | + * Initialize idx_user and idx_kernel to workaround bogus | |
| 171 | + * maybe-initialized warning when using GCC 6. | |
| 172 | + */ | |
| 173 | + int idx_user = 0, idx_kernel = 0; | |
| 170 | 174 | unsigned long flags, old_entryhi; |
| 171 | 175 | |
| 172 | 176 | local_irq_save(flags); |
| @@ -93,7 +93,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp, · 92 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | vma = find_vma(mm, addr); |
| 95 | 95 | if (TASK_SIZE - len >= addr && |
| 96 | − (!vma || addr + len <= vma->vm_start)) | |
| 96 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 97 | 97 | return addr; |
| 98 | 98 | } |
| 99 | 99 | |
| @@ -51,15 +51,15 @@ void __init pagetable_init(void) · 50 unmodified lines | ||
| 51 | 51 | /* |
| 52 | 52 | * Fixed mappings: |
| 53 | 53 | */ |
| 54 | − vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; | |
| 55 | − fixrange_init(vaddr, vaddr + FIXADDR_SIZE, pgd_base); | |
| 54 | + vaddr = __fix_to_virt(__end_of_fixed_addresses - 1); | |
| 55 | + fixrange_init(vaddr & PMD_MASK, vaddr + FIXADDR_SIZE, pgd_base); | |
| 56 | 56 | |
| 57 | 57 | #ifdef CONFIG_HIGHMEM |
| 58 | 58 | /* |
| 59 | 59 | * Permanent kmaps: |
| 60 | 60 | */ |
| 61 | 61 | vaddr = PKMAP_BASE; |
| 62 | − fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base); | |
| 62 | + fixrange_init(vaddr & PMD_MASK, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base); | |
| 63 | 63 | |
| 64 | 64 | pgd = swapper_pg_dir + __pgd_offset(vaddr); |
| 65 | 65 | pud = pud_offset(pgd, vaddr); |
| @@ -90,7 +90,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, · 89 unmodified lines | ||
| 90 | 90 | unsigned long len, unsigned long pgoff, unsigned long flags) |
| 91 | 91 | { |
| 92 | 92 | struct mm_struct *mm = current->mm; |
| 93 | − struct vm_area_struct *vma; | |
| 93 | + struct vm_area_struct *vma, *prev; | |
| 94 | 94 | unsigned long task_size = TASK_SIZE; |
| 95 | 95 | int do_color_align, last_mmap; |
| 96 | 96 | struct vm_unmapped_area_info info; |
| @@ -117,9 +117,10 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, · 20 unmodified lines | ||
| 117 | 117 | else |
| 118 | 118 | addr = PAGE_ALIGN(addr); |
| 119 | 119 | |
| 120 | − vma = find_vma(mm, addr); | |
| 120 | + vma = find_vma_prev(mm, addr, &prev); | |
| 121 | 121 | if (task_size - len >= addr && |
| 122 | − (!vma || addr + len <= vma->vm_start)) | |
| 122 | + (!vma || addr + len <= vm_start_gap(vma)) && | |
| 123 | + (!prev || addr >= vm_end_gap(prev))) | |
| 123 | 124 | goto found_addr; |
| 124 | 125 | } |
| 125 | 126 | |
| @@ -143,7 +144,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 17 unmodified lines | ||
| 143 | 144 | const unsigned long len, const unsigned long pgoff, |
| 144 | 145 | const unsigned long flags) |
| 145 | 146 | { |
| 146 | − struct vm_area_struct *vma; | |
| 147 | + struct vm_area_struct *vma, *prev; | |
| 147 | 148 | struct mm_struct *mm = current->mm; |
| 148 | 149 | unsigned long addr = addr0; |
| 149 | 150 | int do_color_align, last_mmap; |
| @@ -177,9 +178,11 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 27 unmodified lines | ||
| 177 | 178 | addr = COLOR_ALIGN(addr, last_mmap, pgoff); |
| 178 | 179 | else |
| 179 | 180 | addr = PAGE_ALIGN(addr); |
| 180 | − vma = find_vma(mm, addr); | |
| 181 | + | |
| 182 | + vma = find_vma_prev(mm, addr, &prev); | |
| 181 | 183 | if (TASK_SIZE - len >= addr && |
| 182 | − (!vma || addr + len <= vma->vm_start)) | |
| 184 | + (!vma || addr + len <= vm_start_gap(vma)) && | |
| 185 | + (!prev || addr >= vm_end_gap(prev))) | |
| 183 | 186 | goto found_addr; |
| 184 | 187 | } |
| 185 | 188 | |
| @@ -104,7 +104,7 @@ · 103 unmodified lines | ||
| 104 | 104 | "1: "PPC_TLNEI" %4,0\n" \ |
| 105 | 105 | _EMIT_BUG_ENTRY \ |
| 106 | 106 | : : "i" (__FILE__), "i" (__LINE__), \ |
| 107 | − "i" (BUGFLAG_TAINT(TAINT_WARN)), \ | |
| 107 | + "i" (BUGFLAG_WARNING|BUGFLAG_TAINT(TAINT_WARN)),\ | |
| 108 | 108 | "i" (sizeof(struct bug_entry)), \ |
| 109 | 109 | "r" (__ret_warn_on)); \ |
| 110 | 110 | } \ |
| @@ -103,6 +103,7 @@ extern int kprobe_exceptions_notify(struct notifier_block *self, · 102 unmodified lines | ||
| 103 | 103 | extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); |
| 104 | 104 | extern int kprobe_handler(struct pt_regs *regs); |
| 105 | 105 | extern int kprobe_post_handler(struct pt_regs *regs); |
| 106 | +extern int is_current_kprobe_addr(unsigned long addr); | |
| 106 | 107 | #ifdef CONFIG_KPROBES_ON_FTRACE |
| 107 | 108 | extern int skip_singlestep(struct kprobe *p, struct pt_regs *regs, |
| 108 | 109 | struct kprobe_ctlblk *kcb); |
| @@ -94,11 +94,13 @@ struct xive_q { · 93 unmodified lines | ||
| 94 | 94 | * store at 0 and some ESBs support doing a trigger via a |
| 95 | 95 | * separate trigger page. |
| 96 | 96 | */ |
| 97 | −#define XIVE_ESB_GET 0x800 | |
| 98 | −#define XIVE_ESB_SET_PQ_00 0xc00 | |
| 99 | −#define XIVE_ESB_SET_PQ_01 0xd00 | |
| 100 | −#define XIVE_ESB_SET_PQ_10 0xe00 | |
| 101 | −#define XIVE_ESB_SET_PQ_11 0xf00 | |
| 97 | +#define XIVE_ESB_STORE_EOI 0x400 /* Store */ | |
| 98 | +#define XIVE_ESB_LOAD_EOI 0x000 /* Load */ | |
| 99 | +#define XIVE_ESB_GET 0x800 /* Load */ | |
| 100 | +#define XIVE_ESB_SET_PQ_00 0xc00 /* Load */ | |
| 101 | +#define XIVE_ESB_SET_PQ_01 0xd00 /* Load */ | |
| 102 | +#define XIVE_ESB_SET_PQ_10 0xe00 /* Load */ | |
| 103 | +#define XIVE_ESB_SET_PQ_11 0xf00 /* Load */ | |
| 102 | 104 | |
| 103 | 105 | #define XIVE_ESB_VAL_P 0x2 |
| 104 | 106 | #define XIVE_ESB_VAL_Q 0x1 |
| @@ -1411,10 +1411,8 @@ USE_TEXT_SECTION() · 1410 unmodified lines | ||
| 1411 | 1411 | .balign IFETCH_ALIGN_BYTES |
| 1412 | 1412 | do_hash_page: |
| 1413 | 1413 | #ifdef CONFIG_PPC_STD_MMU_64 |
| 1414 | − andis. r0,r4,0xa410 /* weird error? */ | |
| 1414 | + andis. r0,r4,0xa450 /* weird error? */ | |
| 1415 | 1415 | bne- handle_page_fault /* if not, try to insert a HPTE */ |
| 1416 | − andis. r0,r4,DSISR_DABRMATCH@h | |
| 1417 | − bne- handle_dabr_fault | |
| 1418 | 1416 | CURRENT_THREAD_INFO(r11, r1) |
| 1419 | 1417 | lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ |
| 1420 | 1418 | andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ |
| @@ -1438,11 +1436,16 @@ do_hash_page: · 17 unmodified lines | ||
| 1438 | 1436 | |
| 1439 | 1437 | /* Error */ |
| 1440 | 1438 | blt- 13f |
| 1439 | + | |
| 1440 | + /* Reload DSISR into r4 for the DABR check below */ | |
| 1441 | + ld r4,_DSISR(r1) | |
| 1441 | 1442 | #endif /* CONFIG_PPC_STD_MMU_64 */ |
| 1442 | 1443 | |
| 1443 | 1444 | /* Here we have a page fault that hash_page can't handle. */ |
| 1444 | 1445 | handle_page_fault: |
| 1445 | −11: ld r4,_DAR(r1) | |
| 1446 | +11: andis. r0,r4,DSISR_DABRMATCH@h | |
| 1447 | + bne- handle_dabr_fault | |
| 1448 | + ld r4,_DAR(r1) | |
| 1446 | 1449 | ld r5,_DSISR(r1) |
| 1447 | 1450 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 1448 | 1451 | bl do_page_fault |
| @@ -43,6 +43,12 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); · 42 unmodified lines | ||
| 43 | 43 | |
| 44 | 44 | struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}}; |
| 45 | 45 | |
| 46 | +int is_current_kprobe_addr(unsigned long addr) | |
| 47 | +{ | |
| 48 | + struct kprobe *p = kprobe_running(); | |
| 49 | + return (p && (unsigned long)p->addr == addr) ? 1 : 0; | |
| 50 | +} | |
| 51 | + | |
| 46 | 52 | bool arch_within_kprobe_blacklist(unsigned long addr) |
| 47 | 53 | { |
| 48 | 54 | return (addr >= (unsigned long)__kprobes_text_start && |
| @@ -617,6 +623,15 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) · 568 unmodified lines | ||
| 617 | 623 | regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); |
| 618 | 624 | #endif |
| 619 | 625 | |
| 626 | + /* | |
| 627 | + * jprobes use jprobe_return() which skips the normal return | |
| 628 | + * path of the function, and this messes up the accounting of the | |
| 629 | + * function graph tracer. | |
| 630 | + * | |
| 631 | + * Pause function graph tracing while performing the jprobe function. | |
| 632 | + */ | |
| 633 | + pause_graph_tracing(); | |
| 634 | + | |
| 620 | 635 | return 1; |
| 621 | 636 | } |
| 622 | 637 | NOKPROBE_SYMBOL(setjmp_pre_handler); |
| @@ -642,6 +657,8 @@ int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) · 19 unmodified lines | ||
| 642 | 657 | * saved regs... |
| 643 | 658 | */ |
| 644 | 659 | memcpy(regs, &kcb->jprobe_saved_regs, sizeof(struct pt_regs)); |
| 660 | + /* It's OK to start function graph tracing again */ | |
| 661 | + unpause_graph_tracing(); | |
| 645 | 662 | preempt_enable_no_resched(); |
| 646 | 663 | return 1; |
| 647 | 664 | } |
| @@ -615,6 +615,24 @@ void __init exc_lvl_early_init(void) · 614 unmodified lines | ||
| 615 | 615 | } |
| 616 | 616 | #endif |
| 617 | 617 | |
| 618 | +/* | |
| 619 | + * Emergency stacks are used for a range of things, from asynchronous | |
| 620 | + * NMIs (system reset, machine check) to synchronous, process context. | |
| 621 | + * We set preempt_count to zero, even though that isn't necessarily correct. To | |
| 622 | + * get the right value we'd need to copy it from the previous thread_info, but | |
| 623 | + * doing that might fault causing more problems. | |
| 624 | + * TODO: what to do with accounting? | |
| 625 | + */ | |
| 626 | +static void emerg_stack_init_thread_info(struct thread_info *ti, int cpu) | |
| 627 | +{ | |
| 628 | + ti->task = NULL; | |
| 629 | + ti->cpu = cpu; | |
| 630 | + ti->preempt_count = 0; | |
| 631 | + ti->local_flags = 0; | |
| 632 | + ti->flags = 0; | |
| 633 | + klp_init_thread_info(ti); | |
| 634 | +} | |
| 635 | + | |
| 618 | 636 | /* |
| 619 | 637 | * Stack space used when we detect a bad kernel stack pointer, and |
| 620 | 638 | * early in SMP boots before relocation is enabled. Exclusive emergency |
| @@ -633,24 +651,31 @@ void __init emergency_stack_init(void) · 12 unmodified lines | ||
| 633 | 651 | * Since we use these as temporary stacks during secondary CPU |
| 634 | 652 | * bringup, we need to get at them in real mode. This means they |
| 635 | 653 | * must also be within the RMO region. |
| 654 | + * | |
| 655 | + * The IRQ stacks allocated elsewhere in this file are zeroed and | |
| 656 | + * initialized in kernel/irq.c. These are initialized here in order | |
| 657 | + * to have emergency stacks available as early as possible. | |
| 636 | 658 | */ |
| 637 | 659 | limit = min(safe_stack_limit(), ppc64_rma_size); |
| 638 | 660 | |
| 639 | 661 | for_each_possible_cpu(i) { |
| 640 | 662 | struct thread_info *ti; |
| 641 | 663 | ti = __va(memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit)); |
| 642 | − klp_init_thread_info(ti); | |
| 664 | + memset(ti, 0, THREAD_SIZE); | |
| 665 | + emerg_stack_init_thread_info(ti, i); | |
| 643 | 666 | paca[i].emergency_sp = (void *)ti + THREAD_SIZE; |
| 644 | 667 | |
| 645 | 668 | #ifdef CONFIG_PPC_BOOK3S_64 |
| 646 | 669 | /* emergency stack for NMI exception handling. */ |
| 647 | 670 | ti = __va(memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit)); |
| 648 | − klp_init_thread_info(ti); | |
| 671 | + memset(ti, 0, THREAD_SIZE); | |
| 672 | + emerg_stack_init_thread_info(ti, i); | |
| 649 | 673 | paca[i].nmi_emergency_sp = (void *)ti + THREAD_SIZE; |
| 650 | 674 | |
| 651 | 675 | /* emergency stack for machine check exception handling. */ |
| 652 | 676 | ti = __va(memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit)); |
| 653 | − klp_init_thread_info(ti); | |
| 677 | + memset(ti, 0, THREAD_SIZE); | |
| 678 | + emerg_stack_init_thread_info(ti, i); | |
| 654 | 679 | paca[i].mc_emergency_sp = (void *)ti + THREAD_SIZE; |
| 655 | 680 | #endif |
| 656 | 681 | } |
| @@ -45,10 +45,14 @@ _GLOBAL(ftrace_caller) · 44 unmodified lines | ||
| 45 | 45 | stdu r1,-SWITCH_FRAME_SIZE(r1) |
| 46 | 46 | |
| 47 | 47 | /* Save all gprs to pt_regs */ |
| 48 | − SAVE_8GPRS(0,r1) | |
| 49 | − SAVE_8GPRS(8,r1) | |
| 50 | − SAVE_8GPRS(16,r1) | |
| 51 | − SAVE_8GPRS(24,r1) | |
| 48 | + SAVE_GPR(0, r1) | |
| 49 | + SAVE_10GPRS(2, r1) | |
| 50 | + SAVE_10GPRS(12, r1) | |
| 51 | + SAVE_10GPRS(22, r1) | |
| 52 | + | |
| 53 | + /* Save previous stack pointer (r1) */ | |
| 54 | + addi r8, r1, SWITCH_FRAME_SIZE | |
| 55 | + std r8, GPR1(r1) | |
| 52 | 56 | |
| 53 | 57 | /* Load special regs for save below */ |
| 54 | 58 | mfmsr r8 |
| @@ -95,18 +99,44 @@ ftrace_call: · 40 unmodified lines | ||
| 95 | 99 | bl ftrace_stub |
| 96 | 100 | nop |
| 97 | 101 | |
| 98 | − /* Load ctr with the possibly modified NIP */ | |
| 99 | − ld r3, _NIP(r1) | |
| 100 | − mtctr r3 | |
| 102 | + /* Load the possibly modified NIP */ | |
| 103 | + ld r15, _NIP(r1) | |
| 104 | + | |
| 101 | 105 | #ifdef CONFIG_LIVEPATCH |
| 102 | − cmpd r14,r3 /* has NIP been altered? */ | |
| 106 | + cmpd r14, r15 /* has NIP been altered? */ | |
| 107 | +#endif | |
| 108 | + | |
| 109 | +#if defined(CONFIG_LIVEPATCH) && defined(CONFIG_KPROBES_ON_FTRACE) | |
| 110 | + /* NIP has not been altered, skip over further checks */ | |
| 111 | + beq 1f | |
| 112 | + | |
| 113 | + /* Check if there is an active kprobe on us */ | |
| 114 | + subi r3, r14, 4 | |
| 115 | + bl is_current_kprobe_addr | |
| 116 | + nop | |
| 117 | + | |
| 118 | + /* | |
| 119 | + * If r3 == 1, then this is a kprobe/jprobe. | |
| 120 | + * else, this is livepatched function. | |
| 121 | + * | |
| 122 | + * The conditional branch for livepatch_handler below will use the | |
| 123 | + * result of this comparison. For kprobe/jprobe, we just need to branch to | |
| 124 | + * the new NIP, not call livepatch_handler. The branch below is bne, so we | |
| 125 | + * want CR0[EQ] to be true if this is a kprobe/jprobe. Which means we want | |
| 126 | + * CR0[EQ] = (r3 == 1). | |
| 127 | + */ | |
| 128 | + cmpdi r3, 1 | |
| 129 | +1: | |
| 103 | 130 | #endif |
| 104 | 131 | |
| 132 | + /* Load CTR with the possibly modified NIP */ | |
| 133 | + mtctr r15 | |
| 134 | + | |
| 105 | 135 | /* Restore gprs */ |
| 106 | − REST_8GPRS(0,r1) | |
| 107 | − REST_8GPRS(8,r1) | |
| 108 | − REST_8GPRS(16,r1) | |
| 109 | − REST_8GPRS(24,r1) | |
| 136 | + REST_GPR(0,r1) | |
| 137 | + REST_10GPRS(2,r1) | |
| 138 | + REST_10GPRS(12,r1) | |
| 139 | + REST_10GPRS(22,r1) | |
| 110 | 140 | |
| 111 | 141 | /* Restore possibly modified LR */ |
| 112 | 142 | ld r0, _LINK(r1) |
| @@ -119,7 +149,10 @@ ftrace_call: · 6 unmodified lines | ||
| 119 | 149 | addi r1, r1, SWITCH_FRAME_SIZE |
| 120 | 150 | |
| 121 | 151 | #ifdef CONFIG_LIVEPATCH |
| 122 | − /* Based on the cmpd above, if the NIP was altered handle livepatch */ | |
| 152 | + /* | |
| 153 | + * Based on the cmpd or cmpdi above, if the NIP was altered and we're | |
| 154 | + * not on a kprobe/jprobe, then handle livepatch. | |
| 155 | + */ | |
| 123 | 156 | bne- livepatch_handler |
| 124 | 157 | #endif |
| 125 | 158 | |
| @@ -1486,6 +1486,14 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, · 1485 unmodified lines | ||
| 1486 | 1486 | r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len); |
| 1487 | 1487 | break; |
| 1488 | 1488 | case KVM_REG_PPC_TB_OFFSET: |
| 1489 | + /* | |
| 1490 | + * POWER9 DD1 has an erratum where writing TBU40 causes | |
| 1491 | + * the timebase to lose ticks. So we don't let the | |
| 1492 | + * timebase offset be changed on P9 DD1. (It is | |
| 1493 | + * initialized to zero.) | |
| 1494 | + */ | |
| 1495 | + if (cpu_has_feature(CPU_FTR_POWER9_DD1)) | |
| 1496 | + break; | |
| 1489 | 1497 | /* round up to multiple of 2^24 */ |
| 1490 | 1498 | vcpu->arch.vcore->tb_offset = |
| 1491 | 1499 | ALIGN(set_reg_val(id, *val), 1UL << 24); |
| @@ -2907,12 +2915,36 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu) · 1415 unmodified lines | ||
| 2907 | 2915 | { |
| 2908 | 2916 | int r; |
| 2909 | 2917 | int srcu_idx; |
| 2918 | + unsigned long ebb_regs[3] = {}; /* shut up GCC */ | |
| 2919 | + unsigned long user_tar = 0; | |
| 2920 | + unsigned int user_vrsave; | |
| 2910 | 2921 | |
| 2911 | 2922 | if (!vcpu->arch.sane) { |
| 2912 | 2923 | run->exit_reason = KVM_EXIT_INTERNAL_ERROR; |
| 2913 | 2924 | return -EINVAL; |
| 2914 | 2925 | } |
| 2915 | 2926 | |
| 2927 | + /* | |
| 2928 | + * Don't allow entry with a suspended transaction, because | |
| 2929 | + * the guest entry/exit code will lose it. | |
| 2930 | + * If the guest has TM enabled, save away their TM-related SPRs | |
| 2931 | + * (they will get restored by the TM unavailable interrupt). | |
| 2932 | + */ | |
| 2933 | +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM | |
| 2934 | + if (cpu_has_feature(CPU_FTR_TM) && current->thread.regs && | |
| 2935 | + (current->thread.regs->msr & MSR_TM)) { | |
| 2936 | + if (MSR_TM_ACTIVE(current->thread.regs->msr)) { | |
| 2937 | + run->exit_reason = KVM_EXIT_FAIL_ENTRY; | |
| 2938 | + run->fail_entry.hardware_entry_failure_reason = 0; | |
| 2939 | + return -EINVAL; | |
| 2940 | + } | |
| 2941 | + current->thread.tm_tfhar = mfspr(SPRN_TFHAR); | |
| 2942 | + current->thread.tm_tfiar = mfspr(SPRN_TFIAR); | |
| 2943 | + current->thread.tm_texasr = mfspr(SPRN_TEXASR); | |
| 2944 | + current->thread.regs->msr &= ~MSR_TM; | |
| 2945 | + } | |
| 2946 | +#endif | |
| 2947 | + | |
| 2916 | 2948 | kvmppc_core_prepare_to_enter(vcpu); |
| 2917 | 2949 | |
| 2918 | 2950 | /* No need to go into the guest when all we'll do is come back out */ |
| @@ -2934,6 +2966,15 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu) · 15 unmodified lines | ||
| 2934 | 2966 | |
| 2935 | 2967 | flush_all_to_thread(current); |
| 2936 | 2968 | |
| 2969 | + /* Save userspace EBB and other register values */ | |
| 2970 | + if (cpu_has_feature(CPU_FTR_ARCH_207S)) { | |
| 2971 | + ebb_regs[0] = mfspr(SPRN_EBBHR); | |
| 2972 | + ebb_regs[1] = mfspr(SPRN_EBBRR); | |
| 2973 | + ebb_regs[2] = mfspr(SPRN_BESCR); | |
| 2974 | + user_tar = mfspr(SPRN_TAR); | |
| 2975 | + } | |
| 2976 | + user_vrsave = mfspr(SPRN_VRSAVE); | |
| 2977 | + | |
| 2937 | 2978 | vcpu->arch.wqp = &vcpu->arch.vcore->wq; |
| 2938 | 2979 | vcpu->arch.pgdir = current->mm->pgd; |
| 2939 | 2980 | vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST; |
| @@ -2960,6 +3001,16 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu) · 20 unmodified lines | ||
| 2960 | 3001 | } |
| 2961 | 3002 | } while (is_kvmppc_resume_guest(r)); |
| 2962 | 3003 | |
| 3004 | + /* Restore userspace EBB and other register values */ | |
| 3005 | + if (cpu_has_feature(CPU_FTR_ARCH_207S)) { | |
| 3006 | + mtspr(SPRN_EBBHR, ebb_regs[0]); | |
| 3007 | + mtspr(SPRN_EBBRR, ebb_regs[1]); | |
| 3008 | + mtspr(SPRN_BESCR, ebb_regs[2]); | |
| 3009 | + mtspr(SPRN_TAR, user_tar); | |
| 3010 | + mtspr(SPRN_FSCR, current->thread.fscr); | |
| 3011 | + } | |
| 3012 | + mtspr(SPRN_VRSAVE, user_vrsave); | |
| 3013 | + | |
| 2963 | 3014 | out: |
| 2964 | 3015 | vcpu->arch.state = KVMPPC_VCPU_NOTREADY; |
| 2965 | 3016 | atomic_dec(&vcpu->kvm->arch.vcpus_running); |
| @@ -121,10 +121,20 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 120 unmodified lines | ||
| 121 | 121 | * Put whatever is in the decrementer into the |
| 122 | 122 | * hypervisor decrementer. |
| 123 | 123 | */ |
| 124 | +BEGIN_FTR_SECTION | |
| 125 | + ld r5, HSTATE_KVM_VCORE(r13) | |
| 126 | + ld r6, VCORE_KVM(r5) | |
| 127 | + ld r9, KVM_HOST_LPCR(r6) | |
| 128 | + andis. r9, r9, LPCR_LD@h | |
| 129 | +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) | |
| 124 | 130 | mfspr r8,SPRN_DEC |
| 125 | 131 | mftb r7 |
| 126 | − mtspr SPRN_HDEC,r8 | |
| 132 | +BEGIN_FTR_SECTION | |
| 133 | + /* On POWER9, don't sign-extend if host LPCR[LD] bit is set */ | |
| 134 | + bne 32f | |
| 135 | +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) | |
| 127 | 136 | extsw r8,r8 |
| 137 | +32: mtspr SPRN_HDEC,r8 | |
| 128 | 138 | add r8,r8,r7 |
| 129 | 139 | std r8,HSTATE_DECEXP(r13) |
| 130 | 140 | |
| @@ -32,12 +32,29 @@ · 31 unmodified lines | ||
| 32 | 32 | #include <asm/opal.h> |
| 33 | 33 | #include <asm/xive-regs.h> |
| 34 | 34 | |
| 35 | +/* Sign-extend HDEC if not on POWER9 */ | |
| 36 | +#define EXTEND_HDEC(reg) \ | |
| 37 | +BEGIN_FTR_SECTION; \ | |
| 38 | + extsw reg, reg; \ | |
| 39 | +END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300) | |
| 40 | + | |
| 35 | 41 | #define VCPU_GPRS_TM(reg) (((reg) * ULONG_SIZE) + VCPU_GPR_TM) |
| 36 | 42 | |
| 37 | 43 | /* Values in HSTATE_NAPPING(r13) */ |
| 38 | 44 | #define NAPPING_CEDE 1 |
| 39 | 45 | #define NAPPING_NOVCPU 2 |
| 40 | 46 | |
| 47 | +/* Stack frame offsets for kvmppc_hv_entry */ | |
| 48 | +#define SFS 144 | |
| 49 | +#define STACK_SLOT_TRAP (SFS-4) | |
| 50 | +#define STACK_SLOT_TID (SFS-16) | |
| 51 | +#define STACK_SLOT_PSSCR (SFS-24) | |
| 52 | +#define STACK_SLOT_PID (SFS-32) | |
| 53 | +#define STACK_SLOT_IAMR (SFS-40) | |
| 54 | +#define STACK_SLOT_CIABR (SFS-48) | |
| 55 | +#define STACK_SLOT_DAWR (SFS-56) | |
| 56 | +#define STACK_SLOT_DAWRX (SFS-64) | |
| 57 | + | |
| 41 | 58 | /* |
| 42 | 59 | * Call kvmppc_hv_entry in real mode. |
| 43 | 60 | * Must be called with interrupts hard-disabled. |
| @@ -214,6 +231,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 170 unmodified lines | ||
| 214 | 231 | kvmppc_primary_no_guest: |
| 215 | 232 | /* We handle this much like a ceded vcpu */ |
| 216 | 233 | /* put the HDEC into the DEC, since HDEC interrupts don't wake us */ |
| 234 | + /* HDEC may be larger than DEC for arch >= v3.00, but since the */ | |
| 235 | + /* HDEC value came from DEC in the first place, it will fit */ | |
| 217 | 236 | mfspr r3, SPRN_HDEC |
| 218 | 237 | mtspr SPRN_DEC, r3 |
| 219 | 238 | /* |
| @@ -295,8 +314,9 @@ kvm_novcpu_wakeup: · 75 unmodified lines | ||
| 295 | 314 | |
| 296 | 315 | /* See if our timeslice has expired (HDEC is negative) */ |
| 297 | 316 | mfspr r0, SPRN_HDEC |
| 317 | + EXTEND_HDEC(r0) | |
| 298 | 318 | li r12, BOOK3S_INTERRUPT_HV_DECREMENTER |
| 299 | − cmpwi r0, 0 | |
| 319 | + cmpdi r0, 0 | |
| 300 | 320 | blt kvm_novcpu_exit |
| 301 | 321 | |
| 302 | 322 | /* Got an IPI but other vcpus aren't yet exiting, must be a latecomer */ |
| @@ -319,10 +339,10 @@ kvm_novcpu_exit: · 16 unmodified lines | ||
| 319 | 339 | bl kvmhv_accumulate_time |
| 320 | 340 | #endif |
| 321 | 341 | 13: mr r3, r12 |
| 322 | − stw r12, 112-4(r1) | |
| 342 | + stw r12, STACK_SLOT_TRAP(r1) | |
| 323 | 343 | bl kvmhv_commence_exit |
| 324 | 344 | nop |
| 325 | − lwz r12, 112-4(r1) | |
| 345 | + lwz r12, STACK_SLOT_TRAP(r1) | |
| 326 | 346 | b kvmhv_switch_to_host |
| 327 | 347 | |
| 328 | 348 | /* |
| @@ -390,8 +410,8 @@ kvm_secondary_got_guest: · 61 unmodified lines | ||
| 390 | 410 | lbz r4, HSTATE_PTID(r13) |
| 391 | 411 | cmpwi r4, 0 |
| 392 | 412 | bne 63f |
| 393 | − lis r6, 0x7fff | |
| 394 | − ori r6, r6, 0xffff | |
| 413 | + LOAD_REG_ADDR(r6, decrementer_max) | |
| 414 | + ld r6, 0(r6) | |
| 395 | 415 | mtspr SPRN_HDEC, r6 |
| 396 | 416 | /* and set per-LPAR registers, if doing dynamic micro-threading */ |
| 397 | 417 | ld r6, HSTATE_SPLIT_MODE(r13) |
| @@ -545,11 +565,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 147 unmodified lines | ||
| 545 | 565 | * * |
| 546 | 566 | *****************************************************************************/ |
| 547 | 567 | |
| 548 | −/* Stack frame offsets */ | |
| 549 | −#define STACK_SLOT_TID (112-16) | |
| 550 | −#define STACK_SLOT_PSSCR (112-24) | |
| 551 | −#define STACK_SLOT_PID (112-32) | |
| 552 | − | |
| 553 | 568 | .global kvmppc_hv_entry |
| 554 | 569 | kvmppc_hv_entry: |
| 555 | 570 | |
| @@ -565,7 +580,7 @@ kvmppc_hv_entry: · 9 unmodified lines | ||
| 565 | 580 | */ |
| 566 | 581 | mflr r0 |
| 567 | 582 | std r0, PPC_LR_STKOFF(r1) |
| 568 | − stdu r1, -112(r1) | |
| 583 | + stdu r1, -SFS(r1) | |
| 569 | 584 | |
| 570 | 585 | /* Save R1 in the PACA */ |
| 571 | 586 | std r1, HSTATE_HOST_R1(r13) |
| @@ -749,10 +764,20 @@ BEGIN_FTR_SECTION · 177 unmodified lines | ||
| 749 | 764 | mfspr r5, SPRN_TIDR |
| 750 | 765 | mfspr r6, SPRN_PSSCR |
| 751 | 766 | mfspr r7, SPRN_PID |
| 767 | + mfspr r8, SPRN_IAMR | |
| 752 | 768 | std r5, STACK_SLOT_TID(r1) |
| 753 | 769 | std r6, STACK_SLOT_PSSCR(r1) |
| 754 | 770 | std r7, STACK_SLOT_PID(r1) |
| 771 | + std r8, STACK_SLOT_IAMR(r1) | |
| 755 | 772 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) |
| 773 | +BEGIN_FTR_SECTION | |
| 774 | + mfspr r5, SPRN_CIABR | |
| 775 | + mfspr r6, SPRN_DAWR | |
| 776 | + mfspr r7, SPRN_DAWRX | |
| 777 | + std r5, STACK_SLOT_CIABR(r1) | |
| 778 | + std r6, STACK_SLOT_DAWR(r1) | |
| 779 | + std r7, STACK_SLOT_DAWRX(r1) | |
| 780 | +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | |
| 756 | 781 | |
| 757 | 782 | BEGIN_FTR_SECTION |
| 758 | 783 | /* Set partition DABR */ |
| @@ -968,7 +993,8 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300) · 209 unmodified lines | ||
| 968 | 993 | |
| 969 | 994 | /* Check if HDEC expires soon */ |
| 970 | 995 | mfspr r3, SPRN_HDEC |
| 971 | − cmpwi r3, 512 /* 1 microsecond */ | |
| 996 | + EXTEND_HDEC(r3) | |
| 997 | + cmpdi r3, 512 /* 1 microsecond */ | |
| 972 | 998 | blt hdec_soon |
| 973 | 999 | |
| 974 | 1000 | #ifdef CONFIG_KVM_XICS |
| @@ -1505,11 +1531,10 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300) · 530 unmodified lines | ||
| 1505 | 1531 | * set by the guest could disrupt the host. |
| 1506 | 1532 | */ |
| 1507 | 1533 | li r0, 0 |
| 1508 | − mtspr SPRN_IAMR, r0 | |
| 1509 | − mtspr SPRN_CIABR, r0 | |
| 1510 | − mtspr SPRN_DAWRX, r0 | |
| 1534 | + mtspr SPRN_PSPB, r0 | |
| 1511 | 1535 | mtspr SPRN_WORT, r0 |
| 1512 | 1536 | BEGIN_FTR_SECTION |
| 1537 | + mtspr SPRN_IAMR, r0 | |
| 1513 | 1538 | mtspr SPRN_TCSCR, r0 |
| 1514 | 1539 | /* Set MMCRS to 1<<31 to freeze and disable the SPMC counters */ |
| 1515 | 1540 | li r0, 1 |
| @@ -1525,6 +1550,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300) · 9 unmodified lines | ||
| 1525 | 1550 | std r6,VCPU_UAMOR(r9) |
| 1526 | 1551 | li r6,0 |
| 1527 | 1552 | mtspr SPRN_AMR,r6 |
| 1553 | + mtspr SPRN_UAMOR, r6 | |
| 1528 | 1554 | |
| 1529 | 1555 | /* Switch DSCR back to host value */ |
| 1530 | 1556 | mfspr r8, SPRN_DSCR |
| @@ -1669,13 +1695,23 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 138 unmodified lines | ||
| 1669 | 1695 | ptesync |
| 1670 | 1696 | |
| 1671 | 1697 | /* Restore host values of some registers */ |
| 1698 | +BEGIN_FTR_SECTION | |
| 1699 | + ld r5, STACK_SLOT_CIABR(r1) | |
| 1700 | + ld r6, STACK_SLOT_DAWR(r1) | |
| 1701 | + ld r7, STACK_SLOT_DAWRX(r1) | |
| 1702 | + mtspr SPRN_CIABR, r5 | |
| 1703 | + mtspr SPRN_DAWR, r6 | |
| 1704 | + mtspr SPRN_DAWRX, r7 | |
| 1705 | +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | |
| 1672 | 1706 | BEGIN_FTR_SECTION |
| 1673 | 1707 | ld r5, STACK_SLOT_TID(r1) |
| 1674 | 1708 | ld r6, STACK_SLOT_PSSCR(r1) |
| 1675 | 1709 | ld r7, STACK_SLOT_PID(r1) |
| 1710 | + ld r8, STACK_SLOT_IAMR(r1) | |
| 1676 | 1711 | mtspr SPRN_TIDR, r5 |
| 1677 | 1712 | mtspr SPRN_PSSCR, r6 |
| 1678 | 1713 | mtspr SPRN_PID, r7 |
| 1714 | + mtspr SPRN_IAMR, r8 | |
| 1679 | 1715 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) |
| 1680 | 1716 | BEGIN_FTR_SECTION |
| 1681 | 1717 | PPC_INVALIDATE_ERAT |
| @@ -1819,8 +1855,8 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX) · 137 unmodified lines | ||
| 1819 | 1855 | li r0, KVM_GUEST_MODE_NONE |
| 1820 | 1856 | stb r0, HSTATE_IN_GUEST(r13) |
| 1821 | 1857 | |
| 1822 | − ld r0, 112+PPC_LR_STKOFF(r1) | |
| 1823 | − addi r1, r1, 112 | |
| 1858 | + ld r0, SFS+PPC_LR_STKOFF(r1) | |
| 1859 | + addi r1, r1, SFS | |
| 1824 | 1860 | mtlr r0 |
| 1825 | 1861 | blr |
| 1826 | 1862 | |
| @@ -2366,12 +2402,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM) · 539 unmodified lines | ||
| 2366 | 2402 | mfspr r3, SPRN_DEC |
| 2367 | 2403 | mfspr r4, SPRN_HDEC |
| 2368 | 2404 | mftb r5 |
| 2369 | − cmpw r3, r4 | |
| 2405 | + extsw r3, r3 | |
| 2406 | + EXTEND_HDEC(r4) | |
| 2407 | + cmpd r3, r4 | |
| 2370 | 2408 | ble 67f |
| 2371 | 2409 | mtspr SPRN_DEC, r4 |
| 2372 | 2410 | 67: |
| 2373 | 2411 | /* save expiry time of guest decrementer */ |
| 2374 | − extsw r3, r3 | |
| 2375 | 2412 | add r3, r3, r5 |
| 2376 | 2413 | ld r4, HSTATE_KVM_VCPU(r13) |
| 2377 | 2414 | ld r5, HSTATE_KVM_VCORE(r13) |
| @@ -69,7 +69,7 @@ static void GLUE(X_PFX,source_eoi)(u32 hw_irq, struct xive_irq_data *xd) · 68 unmodified lines | ||
| 69 | 69 | { |
| 70 | 70 | /* If the XIVE supports the new "store EOI facility, use it */ |
| 71 | 71 | if (xd->flags & XIVE_IRQ_FLAG_STORE_EOI) |
| 72 | − __x_writeq(0, __x_eoi_page(xd)); | |
| 72 | + __x_writeq(0, __x_eoi_page(xd) + XIVE_ESB_STORE_EOI); | |
| 73 | 73 | else if (hw_irq && xd->flags & XIVE_IRQ_FLAG_EOI_FW) { |
| 74 | 74 | opal_int_eoi(hw_irq); |
| 75 | 75 | } else { |
| @@ -89,7 +89,7 @@ static void GLUE(X_PFX,source_eoi)(u32 hw_irq, struct xive_irq_data *xd) · 13 unmodified lines | ||
| 89 | 89 | * properly. |
| 90 | 90 | */ |
| 91 | 91 | if (xd->flags & XIVE_IRQ_FLAG_LSI) |
| 92 | − __x_readq(__x_eoi_page(xd)); | |
| 92 | + __x_readq(__x_eoi_page(xd) + XIVE_ESB_LOAD_EOI); | |
| 93 | 93 | else { |
| 94 | 94 | eoi_val = GLUE(X_PFX,esb_load)(xd, XIVE_ESB_SET_PQ_00); |
| 95 | 95 | |
| @@ -68,7 +68,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 67 unmodified lines | ||
| 68 | 68 | addr = ALIGN(addr, huge_page_size(h)); |
| 69 | 69 | vma = find_vma(mm, addr); |
| 70 | 70 | if (mm->task_size - len >= addr && |
| 71 | − (!vma || addr + len <= vma->vm_start)) | |
| 71 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 72 | 72 | return addr; |
| 73 | 73 | } |
| 74 | 74 | /* |
| @@ -112,7 +112,7 @@ radix__arch_get_unmapped_area(struct file *filp, unsigned long addr, · 111 unmodified lines | ||
| 112 | 112 | addr = PAGE_ALIGN(addr); |
| 113 | 113 | vma = find_vma(mm, addr); |
| 114 | 114 | if (mm->task_size - len >= addr && addr >= mmap_min_addr && |
| 115 | − (!vma || addr + len <= vma->vm_start)) | |
| 115 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 116 | 116 | return addr; |
| 117 | 117 | } |
| 118 | 118 | |
| @@ -157,7 +157,7 @@ radix__arch_get_unmapped_area_topdown(struct file *filp, · 38 unmodified lines | ||
| 157 | 157 | addr = PAGE_ALIGN(addr); |
| 158 | 158 | vma = find_vma(mm, addr); |
| 159 | 159 | if (mm->task_size - len >= addr && addr >= mmap_min_addr && |
| 160 | − (!vma || addr + len <= vma->vm_start)) | |
| 160 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 161 | 161 | return addr; |
| 162 | 162 | } |
| 163 | 163 | |
| @@ -99,7 +99,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr, · 98 unmodified lines | ||
| 99 | 99 | if ((mm->task_size - len) < addr) |
| 100 | 100 | return 0; |
| 101 | 101 | vma = find_vma(mm, addr); |
| 102 | − return (!vma || (addr + len) <= vma->vm_start); | |
| 102 | + return (!vma || (addr + len) <= vm_start_gap(vma)); | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice) |
| @@ -101,5 +101,6 @@ void perf_get_regs_user(struct perf_regs *regs_user, · 100 unmodified lines | ||
| 101 | 101 | struct pt_regs *regs_user_copy) |
| 102 | 102 | { |
| 103 | 103 | regs_user->regs = task_pt_regs(current); |
| 104 | − regs_user->abi = perf_reg_abi(current); | |
| 104 | + regs_user->abi = (regs_user->regs) ? perf_reg_abi(current) : | |
| 105 | + PERF_SAMPLE_REGS_ABI_NONE; | |
| 105 | 106 | } |
| @@ -75,7 +75,8 @@ struct pci_dev *pnv_pci_get_npu_dev(struct pci_dev *gpdev, int index) · 74 unmodified lines | ||
| 75 | 75 | if (WARN_ON(!gpdev)) |
| 76 | 76 | return NULL; |
| 77 | 77 | |
| 78 | − if (WARN_ON(!gpdev->dev.of_node)) | |
| 78 | + /* Not all PCI devices have device-tree nodes */ | |
| 79 | + if (!gpdev->dev.of_node) | |
| 79 | 80 | return NULL; |
| 80 | 81 | |
| 81 | 82 | /* Get assoicated PCI device */ |
| @@ -448,7 +449,7 @@ static int mmio_launch_invalidate(struct npu *npu, unsigned long launch, · 366 unmodified lines | ||
| 448 | 449 | return mmio_atsd_reg; |
| 449 | 450 | } |
| 450 | 451 | |
| 451 | −static int mmio_invalidate_pid(struct npu *npu, unsigned long pid) | |
| 452 | +static int mmio_invalidate_pid(struct npu *npu, unsigned long pid, bool flush) | |
| 452 | 453 | { |
| 453 | 454 | unsigned long launch; |
| 454 | 455 | |
| @@ -464,12 +465,15 @@ static int mmio_invalidate_pid(struct npu *npu, unsigned long pid) · 9 unmodified lines | ||
| 464 | 465 | /* PID */ |
| 465 | 466 | launch |= pid << PPC_BITLSHIFT(38); |
| 466 | 467 | |
| 468 | + /* No flush */ | |
| 469 | + launch |= !flush << PPC_BITLSHIFT(39); | |
| 470 | + | |
| 467 | 471 | /* Invalidating the entire process doesn't use a va */ |
| 468 | 472 | return mmio_launch_invalidate(npu, launch, 0); |
| 469 | 473 | } |
| 470 | 474 | |
| 471 | 475 | static int mmio_invalidate_va(struct npu *npu, unsigned long va, |
| 472 | − unsigned long pid) | |
| 476 | + unsigned long pid, bool flush) | |
| 473 | 477 | { |
| 474 | 478 | unsigned long launch; |
| 475 | 479 | |
| @@ -485,26 +489,60 @@ static int mmio_invalidate_va(struct npu *npu, unsigned long va, · 9 unmodified lines | ||
| 485 | 489 | /* PID */ |
| 486 | 490 | launch |= pid << PPC_BITLSHIFT(38); |
| 487 | 491 | |
| 492 | + /* No flush */ | |
| 493 | + launch |= !flush << PPC_BITLSHIFT(39); | |
| 494 | + | |
| 488 | 495 | return mmio_launch_invalidate(npu, launch, va); |
| 489 | 496 | } |
| 490 | 497 | |
| 491 | 498 | #define mn_to_npu_context(x) container_of(x, struct npu_context, mn) |
| 492 | 499 | |
| 500 | +struct mmio_atsd_reg { | |
| 501 | + struct npu *npu; | |
| 502 | + int reg; | |
| 503 | +}; | |
| 504 | + | |
| 505 | +static void mmio_invalidate_wait( | |
| 506 | + struct mmio_atsd_reg mmio_atsd_reg[NV_MAX_NPUS], bool flush) | |
| 507 | +{ | |
| 508 | + struct npu *npu; | |
| 509 | + int i, reg; | |
| 510 | + | |
| 511 | + /* Wait for all invalidations to complete */ | |
| 512 | + for (i = 0; i <= max_npu2_index; i++) { | |
| 513 | + if (mmio_atsd_reg[i].reg < 0) | |
| 514 | + continue; | |
| 515 | + | |
| 516 | + /* Wait for completion */ | |
| 517 | + npu = mmio_atsd_reg[i].npu; | |
| 518 | + reg = mmio_atsd_reg[i].reg; | |
| 519 | + while (__raw_readq(npu->mmio_atsd_regs[reg] + XTS_ATSD_STAT)) | |
| 520 | + cpu_relax(); | |
| 521 | + | |
| 522 | + put_mmio_atsd_reg(npu, reg); | |
| 523 | + | |
| 524 | + /* | |
| 525 | + * The GPU requires two flush ATSDs to ensure all entries have | |
| 526 | + * been flushed. We use PID 0 as it will never be used for a | |
| 527 | + * process on the GPU. | |
| 528 | + */ | |
| 529 | + if (flush) | |
| 530 | + mmio_invalidate_pid(npu, 0, true); | |
| 531 | + } | |
| 532 | +} | |
| 533 | + | |
| 493 | 534 | /* |
| 494 | 535 | * Invalidate either a single address or an entire PID depending on |
| 495 | 536 | * the value of va. |
| 496 | 537 | */ |
| 497 | 538 | static void mmio_invalidate(struct npu_context *npu_context, int va, |
| 498 | − unsigned long address) | |
| 539 | + unsigned long address, bool flush) | |
| 499 | 540 | { |
| 500 | − int i, j, reg; | |
| 541 | + int i, j; | |
| 501 | 542 | struct npu *npu; |
| 502 | 543 | struct pnv_phb *nphb; |
| 503 | 544 | struct pci_dev *npdev; |
| 504 | − struct { | |
| 505 | − struct npu *npu; | |
| 506 | − int reg; | |
| 507 | − } mmio_atsd_reg[NV_MAX_NPUS]; | |
| 545 | + struct mmio_atsd_reg mmio_atsd_reg[NV_MAX_NPUS]; | |
| 508 | 546 | unsigned long pid = npu_context->mm->context.id; |
| 509 | 547 | |
| 510 | 548 | /* |
| @@ -524,10 +562,11 @@ static void mmio_invalidate(struct npu_context *npu_context, int va, · 13 unmodified lines | ||
| 524 | 562 | |
| 525 | 563 | if (va) |
| 526 | 564 | mmio_atsd_reg[i].reg = |
| 527 | − mmio_invalidate_va(npu, address, pid); | |
| 565 | + mmio_invalidate_va(npu, address, pid, | |
| 566 | + flush); | |
| 528 | 567 | else |
| 529 | 568 | mmio_atsd_reg[i].reg = |
| 530 | − mmio_invalidate_pid(npu, pid); | |
| 569 | + mmio_invalidate_pid(npu, pid, flush); | |
| 531 | 570 | |
| 532 | 571 | /* |
| 533 | 572 | * The NPU hardware forwards the shootdown to all GPUs |
| @@ -543,18 +582,10 @@ static void mmio_invalidate(struct npu_context *npu_context, int va, · 9 unmodified lines | ||
| 543 | 582 | */ |
| 544 | 583 | flush_tlb_mm(npu_context->mm); |
| 545 | 584 | |
| 546 | − /* Wait for all invalidations to complete */ | |
| 547 | − for (i = 0; i <= max_npu2_index; i++) { | |
| 548 | − if (mmio_atsd_reg[i].reg < 0) | |
| 549 | − continue; | |
| 550 | − | |
| 551 | − /* Wait for completion */ | |
| 552 | − npu = mmio_atsd_reg[i].npu; | |
| 553 | − reg = mmio_atsd_reg[i].reg; | |
| 554 | − while (__raw_readq(npu->mmio_atsd_regs[reg] + XTS_ATSD_STAT)) | |
| 555 | − cpu_relax(); | |
| 556 | − put_mmio_atsd_reg(npu, reg); | |
| 557 | − } | |
| 585 | + mmio_invalidate_wait(mmio_atsd_reg, flush); | |
| 586 | + if (flush) | |
| 587 | + /* Wait for the flush to complete */ | |
| 588 | + mmio_invalidate_wait(mmio_atsd_reg, false); | |
| 558 | 589 | } |
| 559 | 590 | |
| 560 | 591 | static void pnv_npu2_mn_release(struct mmu_notifier *mn, |
| @@ -570,7 +601,7 @@ static void pnv_npu2_mn_release(struct mmu_notifier *mn, · 9 unmodified lines | ||
| 570 | 601 | * There should be no more translation requests for this PID, but we |
| 571 | 602 | * need to ensure any entries for it are removed from the TLB. |
| 572 | 603 | */ |
| 573 | − mmio_invalidate(npu_context, 0, 0); | |
| 604 | + mmio_invalidate(npu_context, 0, 0, true); | |
| 574 | 605 | } |
| 575 | 606 | |
| 576 | 607 | static void pnv_npu2_mn_change_pte(struct mmu_notifier *mn, |
| @@ -580,7 +611,7 @@ static void pnv_npu2_mn_change_pte(struct mmu_notifier *mn, · 3 unmodified lines | ||
| 580 | 611 | { |
| 581 | 612 | struct npu_context *npu_context = mn_to_npu_context(mn); |
| 582 | 613 | |
| 583 | − mmio_invalidate(npu_context, 1, address); | |
| 614 | + mmio_invalidate(npu_context, 1, address, true); | |
| 584 | 615 | } |
| 585 | 616 | |
| 586 | 617 | static void pnv_npu2_mn_invalidate_page(struct mmu_notifier *mn, |
| @@ -589,7 +620,7 @@ static void pnv_npu2_mn_invalidate_page(struct mmu_notifier *mn, · 2 unmodified lines | ||
| 589 | 620 | { |
| 590 | 621 | struct npu_context *npu_context = mn_to_npu_context(mn); |
| 591 | 622 | |
| 592 | − mmio_invalidate(npu_context, 1, address); | |
| 623 | + mmio_invalidate(npu_context, 1, address, true); | |
| 593 | 624 | } |
| 594 | 625 | |
| 595 | 626 | static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn, |
| @@ -599,8 +630,11 @@ static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn, · 3 unmodified lines | ||
| 599 | 630 | struct npu_context *npu_context = mn_to_npu_context(mn); |
| 600 | 631 | unsigned long address; |
| 601 | 632 | |
| 602 | − for (address = start; address <= end; address += PAGE_SIZE) | |
| 603 | − mmio_invalidate(npu_context, 1, address); | |
| 633 | + for (address = start; address < end; address += PAGE_SIZE) | |
| 634 | + mmio_invalidate(npu_context, 1, address, false); | |
| 635 | + | |
| 636 | + /* Do the flush only on the final addess == end */ | |
| 637 | + mmio_invalidate(npu_context, 1, address, true); | |
| 604 | 638 | } |
| 605 | 639 | |
| 606 | 640 | static const struct mmu_notifier_ops nv_nmmu_notifier_ops = { |
| @@ -650,8 +684,11 @@ struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, · 43 unmodified lines | ||
| 650 | 684 | /* No nvlink associated with this GPU device */ |
| 651 | 685 | return ERR_PTR(-ENODEV); |
| 652 | 686 | |
| 653 | − if (!mm) { | |
| 654 | − /* kernel thread contexts are not supported */ | |
| 687 | + if (!mm || mm->context.id == 0) { | |
| 688 | + /* | |
| 689 | + * Kernel thread contexts are not supported and context id 0 is | |
| 690 | + * reserved on the GPU. | |
| 691 | + */ | |
| 655 | 692 | return ERR_PTR(-EINVAL); |
| 656 | 693 | } |
| 657 | 694 | |
| @@ -297,7 +297,7 @@ void xive_do_source_eoi(u32 hw_irq, struct xive_irq_data *xd) · 296 unmodified lines | ||
| 297 | 297 | { |
| 298 | 298 | /* If the XIVE supports the new "store EOI facility, use it */ |
| 299 | 299 | if (xd->flags & XIVE_IRQ_FLAG_STORE_EOI) |
| 300 | − out_be64(xd->eoi_mmio, 0); | |
| 300 | + out_be64(xd->eoi_mmio + XIVE_ESB_STORE_EOI, 0); | |
| 301 | 301 | else if (hw_irq && xd->flags & XIVE_IRQ_FLAG_EOI_FW) { |
| 302 | 302 | /* |
| 303 | 303 | * The FW told us to call it. This happens for some |
| @@ -30,6 +30,7 @@ CONFIG_USER_NS=y · 29 unmodified lines | ||
| 30 | 30 | CONFIG_SCHED_AUTOGROUP=y |
| 31 | 31 | CONFIG_BLK_DEV_INITRD=y |
| 32 | 32 | CONFIG_EXPERT=y |
| 33 | +# CONFIG_SYSFS_SYSCALL is not set | |
| 33 | 34 | CONFIG_BPF_SYSCALL=y |
| 34 | 35 | CONFIG_USERFAULTFD=y |
| 35 | 36 | # CONFIG_COMPAT_BRK is not set |
| @@ -44,7 +45,10 @@ CONFIG_MODULE_UNLOAD=y · 8 unmodified lines | ||
| 44 | 45 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 45 | 46 | CONFIG_MODVERSIONS=y |
| 46 | 47 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 48 | +CONFIG_BLK_DEV_INTEGRITY=y | |
| 47 | 49 | CONFIG_BLK_DEV_THROTTLING=y |
| 50 | +CONFIG_BLK_WBT=y | |
| 51 | +CONFIG_BLK_WBT_SQ=y | |
| 48 | 52 | CONFIG_PARTITION_ADVANCED=y |
| 49 | 53 | CONFIG_IBM_PARTITION=y |
| 50 | 54 | CONFIG_BSD_DISKLABEL=y |
| @@ -90,6 +94,8 @@ CONFIG_UNIX=y · 39 unmodified lines | ||
| 90 | 94 | CONFIG_UNIX_DIAG=m |
| 91 | 95 | CONFIG_XFRM_USER=m |
| 92 | 96 | CONFIG_NET_KEY=m |
| 97 | +CONFIG_SMC=m | |
| 98 | +CONFIG_SMC_DIAG=m | |
| 93 | 99 | CONFIG_INET=y |
| 94 | 100 | CONFIG_IP_MULTICAST=y |
| 95 | 101 | CONFIG_IP_ADVANCED_ROUTER=y |
| @@ -359,6 +365,7 @@ CONFIG_NET_ACT_SIMP=m · 263 unmodified lines | ||
| 359 | 365 | CONFIG_NET_ACT_SKBEDIT=m |
| 360 | 366 | CONFIG_NET_ACT_CSUM=m |
| 361 | 367 | CONFIG_DNS_RESOLVER=y |
| 368 | +CONFIG_NETLINK_DIAG=m | |
| 362 | 369 | CONFIG_CGROUP_NET_PRIO=y |
| 363 | 370 | CONFIG_BPF_JIT=y |
| 364 | 371 | CONFIG_NET_PKTGEN=m |
| @@ -367,16 +374,19 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines | ||
| 367 | 374 | CONFIG_DMA_CMA=y |
| 368 | 375 | CONFIG_CMA_SIZE_MBYTES=0 |
| 369 | 376 | CONFIG_CONNECTOR=y |
| 377 | +CONFIG_ZRAM=m | |
| 370 | 378 | CONFIG_BLK_DEV_LOOP=m |
| 371 | 379 | CONFIG_BLK_DEV_CRYPTOLOOP=m |
| 380 | +CONFIG_BLK_DEV_DRBD=m | |
| 372 | 381 | CONFIG_BLK_DEV_NBD=m |
| 373 | 382 | CONFIG_BLK_DEV_OSD=m |
| 374 | 383 | CONFIG_BLK_DEV_RAM=y |
| 375 | 384 | CONFIG_BLK_DEV_RAM_SIZE=32768 |
| 376 | −CONFIG_CDROM_PKTCDVD=m | |
| 377 | −CONFIG_ATA_OVER_ETH=m | |
| 385 | +CONFIG_BLK_DEV_RAM_DAX=y | |
| 378 | 386 | CONFIG_VIRTIO_BLK=y |
| 387 | +CONFIG_BLK_DEV_RBD=m | |
| 379 | 388 | CONFIG_ENCLOSURE_SERVICES=m |
| 389 | +CONFIG_GENWQE=m | |
| 380 | 390 | CONFIG_RAID_ATTRS=m |
| 381 | 391 | CONFIG_SCSI=y |
| 382 | 392 | CONFIG_BLK_DEV_SD=y |
| @@ -442,6 +452,8 @@ CONFIG_NLMON=m · 59 unmodified lines | ||
| 442 | 452 | # CONFIG_NET_VENDOR_INTEL is not set |
| 443 | 453 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 444 | 454 | CONFIG_MLX4_EN=m |
| 455 | +CONFIG_MLX5_CORE=m | |
| 456 | +CONFIG_MLX5_CORE_EN=y | |
| 445 | 457 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 446 | 458 | CONFIG_PPP=m |
| 447 | 459 | CONFIG_PPP_BSDCOMP=m |
| @@ -452,7 +464,6 @@ CONFIG_PPTP=m · 4 unmodified lines | ||
| 452 | 464 | CONFIG_PPPOL2TP=m |
| 453 | 465 | CONFIG_PPP_ASYNC=m |
| 454 | 466 | CONFIG_PPP_SYNC_TTY=m |
| 455 | −# CONFIG_INPUT_MOUSEDEV_PSAUX is not set | |
| 456 | 467 | # CONFIG_INPUT_KEYBOARD is not set |
| 457 | 468 | # CONFIG_INPUT_MOUSE is not set |
| 458 | 469 | # CONFIG_SERIO is not set |
| @@ -471,6 +482,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines | ||
| 471 | 482 | CONFIG_INFINIBAND=m |
| 472 | 483 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 473 | 484 | CONFIG_MLX4_INFINIBAND=m |
| 485 | +CONFIG_MLX5_INFINIBAND=m | |
| 474 | 486 | CONFIG_VIRTIO_BALLOON=m |
| 475 | 487 | CONFIG_EXT4_FS=y |
| 476 | 488 | CONFIG_EXT4_FS_POSIX_ACL=y |
| @@ -487,12 +499,18 @@ CONFIG_XFS_POSIX_ACL=y · 10 unmodified lines | ||
| 487 | 499 | CONFIG_XFS_RT=y |
| 488 | 500 | CONFIG_XFS_DEBUG=y |
| 489 | 501 | CONFIG_GFS2_FS=m |
| 502 | +CONFIG_GFS2_FS_LOCKING_DLM=y | |
| 490 | 503 | CONFIG_OCFS2_FS=m |
| 491 | 504 | CONFIG_BTRFS_FS=y |
| 492 | 505 | CONFIG_BTRFS_FS_POSIX_ACL=y |
| 506 | +CONFIG_BTRFS_DEBUG=y | |
| 493 | 507 | CONFIG_NILFS2_FS=m |
| 508 | +CONFIG_FS_DAX=y | |
| 509 | +CONFIG_EXPORTFS_BLOCK_OPS=y | |
| 494 | 510 | CONFIG_FANOTIFY=y |
| 511 | +CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y | |
| 495 | 512 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| 513 | +CONFIG_QUOTA_DEBUG=y | |
| 496 | 514 | CONFIG_QFMT_V1=m |
| 497 | 515 | CONFIG_QFMT_V2=m |
| 498 | 516 | CONFIG_AUTOFS4_FS=m |
| @@ -558,6 +576,7 @@ CONFIG_HEADERS_CHECK=y · 59 unmodified lines | ||
| 558 | 576 | CONFIG_DEBUG_SECTION_MISMATCH=y |
| 559 | 577 | CONFIG_MAGIC_SYSRQ=y |
| 560 | 578 | CONFIG_DEBUG_PAGEALLOC=y |
| 579 | +CONFIG_DEBUG_RODATA_TEST=y | |
| 561 | 580 | CONFIG_DEBUG_OBJECTS=y |
| 562 | 581 | CONFIG_DEBUG_OBJECTS_SELFTEST=y |
| 563 | 582 | CONFIG_DEBUG_OBJECTS_FREE=y |
| @@ -580,7 +599,6 @@ CONFIG_DETECT_HUNG_TASK=y · 16 unmodified lines | ||
| 580 | 599 | CONFIG_WQ_WATCHDOG=y |
| 581 | 600 | CONFIG_PANIC_ON_OOPS=y |
| 582 | 601 | CONFIG_DEBUG_TIMEKEEPING=y |
| 583 | −CONFIG_TIMER_STATS=y | |
| 584 | 602 | CONFIG_DEBUG_RT_MUTEXES=y |
| 585 | 603 | CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y |
| 586 | 604 | CONFIG_PROVE_LOCKING=y |
| @@ -595,6 +613,7 @@ CONFIG_RCU_TORTURE_TEST=m · 8 unmodified lines | ||
| 595 | 613 | CONFIG_RCU_CPU_STALL_TIMEOUT=300 |
| 596 | 614 | CONFIG_NOTIFIER_ERROR_INJECTION=m |
| 597 | 615 | CONFIG_PM_NOTIFIER_ERROR_INJECT=m |
| 616 | +CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m | |
| 598 | 617 | CONFIG_FAULT_INJECTION=y |
| 599 | 618 | CONFIG_FAILSLAB=y |
| 600 | 619 | CONFIG_FAIL_PAGE_ALLOC=y |
| @@ -616,13 +635,12 @@ CONFIG_HIST_TRIGGERS=y · 15 unmodified lines | ||
| 616 | 635 | CONFIG_TRACE_ENUM_MAP_FILE=y |
| 617 | 636 | CONFIG_LKDTM=m |
| 618 | 637 | CONFIG_TEST_LIST_SORT=y |
| 638 | +CONFIG_TEST_SORT=y | |
| 619 | 639 | CONFIG_KPROBES_SANITY_TEST=y |
| 620 | 640 | CONFIG_RBTREE_TEST=y |
| 621 | 641 | CONFIG_INTERVAL_TREE_TEST=m |
| 622 | 642 | CONFIG_PERCPU_TEST=m |
| 623 | 643 | CONFIG_ATOMIC64_SELFTEST=y |
| 624 | −CONFIG_TEST_STRING_HELPERS=y | |
| 625 | −CONFIG_TEST_KSTRTOX=y | |
| 626 | 644 | CONFIG_DMA_API_DEBUG=y |
| 627 | 645 | CONFIG_TEST_BPF=m |
| 628 | 646 | CONFIG_BUG_ON_DATA_CORRUPTION=y |
| @@ -630,6 +648,7 @@ CONFIG_S390_PTDUMP=y · 1 unmodified line | ||
| 630 | 648 | CONFIG_ENCRYPTED_KEYS=m |
| 631 | 649 | CONFIG_SECURITY=y |
| 632 | 650 | CONFIG_SECURITY_NETWORK=y |
| 651 | +CONFIG_HARDENED_USERCOPY=y | |
| 633 | 652 | CONFIG_SECURITY_SELINUX=y |
| 634 | 653 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 635 | 654 | CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 |
| @@ -640,7 +659,9 @@ CONFIG_CRYPTO_RSA=m · 4 unmodified lines | ||
| 640 | 659 | CONFIG_CRYPTO_DH=m |
| 641 | 660 | CONFIG_CRYPTO_ECDH=m |
| 642 | 661 | CONFIG_CRYPTO_USER=m |
| 662 | +CONFIG_CRYPTO_PCRYPT=m | |
| 643 | 663 | CONFIG_CRYPTO_CRYPTD=m |
| 664 | +CONFIG_CRYPTO_MCRYPTD=m | |
| 644 | 665 | CONFIG_CRYPTO_TEST=m |
| 645 | 666 | CONFIG_CRYPTO_CCM=m |
| 646 | 667 | CONFIG_CRYPTO_GCM=m |
| @@ -648,6 +669,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 1 unmodified line | ||
| 648 | 669 | CONFIG_CRYPTO_LRW=m |
| 649 | 670 | CONFIG_CRYPTO_PCBC=m |
| 650 | 671 | CONFIG_CRYPTO_KEYWRAP=m |
| 672 | +CONFIG_CRYPTO_CMAC=m | |
| 651 | 673 | CONFIG_CRYPTO_XCBC=m |
| 652 | 674 | CONFIG_CRYPTO_VMAC=m |
| 653 | 675 | CONFIG_CRYPTO_CRC32=m |
| @@ -657,8 +679,10 @@ CONFIG_CRYPTO_RMD160=m · 3 unmodified lines | ||
| 657 | 679 | CONFIG_CRYPTO_RMD256=m |
| 658 | 680 | CONFIG_CRYPTO_RMD320=m |
| 659 | 681 | CONFIG_CRYPTO_SHA512=m |
| 682 | +CONFIG_CRYPTO_SHA3=m | |
| 660 | 683 | CONFIG_CRYPTO_TGR192=m |
| 661 | 684 | CONFIG_CRYPTO_WP512=m |
| 685 | +CONFIG_CRYPTO_AES_TI=m | |
| 662 | 686 | CONFIG_CRYPTO_ANUBIS=m |
| 663 | 687 | CONFIG_CRYPTO_BLOWFISH=m |
| 664 | 688 | CONFIG_CRYPTO_CAMELLIA=m |
| @@ -674,6 +698,7 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines | ||
| 674 | 698 | CONFIG_CRYPTO_842=m |
| 675 | 699 | CONFIG_CRYPTO_LZ4=m |
| 676 | 700 | CONFIG_CRYPTO_LZ4HC=m |
| 701 | +CONFIG_CRYPTO_ANSI_CPRNG=m | |
| 677 | 702 | CONFIG_CRYPTO_USER_API_HASH=m |
| 678 | 703 | CONFIG_CRYPTO_USER_API_SKCIPHER=m |
| 679 | 704 | CONFIG_CRYPTO_USER_API_RNG=m |
| @@ -685,6 +710,7 @@ CONFIG_CRYPTO_SHA256_S390=m · 5 unmodified lines | ||
| 685 | 710 | CONFIG_CRYPTO_SHA512_S390=m |
| 686 | 711 | CONFIG_CRYPTO_DES_S390=m |
| 687 | 712 | CONFIG_CRYPTO_AES_S390=m |
| 713 | +CONFIG_CRYPTO_PAES_S390=m | |
| 688 | 714 | CONFIG_CRYPTO_GHASH_S390=m |
| 689 | 715 | CONFIG_CRYPTO_CRC32_S390=y |
| 690 | 716 | CONFIG_ASYMMETRIC_KEY_TYPE=y |
| @@ -692,6 +718,7 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m · 1 unmodified line | ||
| 692 | 718 | CONFIG_X509_CERTIFICATE_PARSER=m |
| 693 | 719 | CONFIG_CRC7=m |
| 694 | 720 | CONFIG_CRC8=m |
| 721 | +CONFIG_RANDOM32_SELFTEST=y | |
| 695 | 722 | CONFIG_CORDIC=m |
| 696 | 723 | CONFIG_CMM=m |
| 697 | 724 | CONFIG_APPLDATA_BASE=y |
| @@ -31,6 +31,7 @@ CONFIG_USER_NS=y · 30 unmodified lines | ||
| 31 | 31 | CONFIG_SCHED_AUTOGROUP=y |
| 32 | 32 | CONFIG_BLK_DEV_INITRD=y |
| 33 | 33 | CONFIG_EXPERT=y |
| 34 | +# CONFIG_SYSFS_SYSCALL is not set | |
| 34 | 35 | CONFIG_BPF_SYSCALL=y |
| 35 | 36 | CONFIG_USERFAULTFD=y |
| 36 | 37 | # CONFIG_COMPAT_BRK is not set |
| @@ -46,7 +47,10 @@ CONFIG_MODULE_UNLOAD=y · 9 unmodified lines | ||
| 46 | 47 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 47 | 48 | CONFIG_MODVERSIONS=y |
| 48 | 49 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 50 | +CONFIG_BLK_DEV_INTEGRITY=y | |
| 49 | 51 | CONFIG_BLK_DEV_THROTTLING=y |
| 52 | +CONFIG_BLK_WBT=y | |
| 53 | +CONFIG_BLK_WBT_SQ=y | |
| 50 | 54 | CONFIG_PARTITION_ADVANCED=y |
| 51 | 55 | CONFIG_IBM_PARTITION=y |
| 52 | 56 | CONFIG_BSD_DISKLABEL=y |
| @@ -88,6 +92,8 @@ CONFIG_UNIX=y · 35 unmodified lines | ||
| 88 | 92 | CONFIG_UNIX_DIAG=m |
| 89 | 93 | CONFIG_XFRM_USER=m |
| 90 | 94 | CONFIG_NET_KEY=m |
| 95 | +CONFIG_SMC=m | |
| 96 | +CONFIG_SMC_DIAG=m | |
| 91 | 97 | CONFIG_INET=y |
| 92 | 98 | CONFIG_IP_MULTICAST=y |
| 93 | 99 | CONFIG_IP_ADVANCED_ROUTER=y |
| @@ -356,6 +362,7 @@ CONFIG_NET_ACT_SIMP=m · 262 unmodified lines | ||
| 356 | 362 | CONFIG_NET_ACT_SKBEDIT=m |
| 357 | 363 | CONFIG_NET_ACT_CSUM=m |
| 358 | 364 | CONFIG_DNS_RESOLVER=y |
| 365 | +CONFIG_NETLINK_DIAG=m | |
| 359 | 366 | CONFIG_CGROUP_NET_PRIO=y |
| 360 | 367 | CONFIG_BPF_JIT=y |
| 361 | 368 | CONFIG_NET_PKTGEN=m |
| @@ -364,16 +371,18 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines | ||
| 364 | 371 | CONFIG_DMA_CMA=y |
| 365 | 372 | CONFIG_CMA_SIZE_MBYTES=0 |
| 366 | 373 | CONFIG_CONNECTOR=y |
| 374 | +CONFIG_ZRAM=m | |
| 367 | 375 | CONFIG_BLK_DEV_LOOP=m |
| 368 | 376 | CONFIG_BLK_DEV_CRYPTOLOOP=m |
| 377 | +CONFIG_BLK_DEV_DRBD=m | |
| 369 | 378 | CONFIG_BLK_DEV_NBD=m |
| 370 | 379 | CONFIG_BLK_DEV_OSD=m |
| 371 | 380 | CONFIG_BLK_DEV_RAM=y |
| 372 | 381 | CONFIG_BLK_DEV_RAM_SIZE=32768 |
| 373 | −CONFIG_CDROM_PKTCDVD=m | |
| 374 | −CONFIG_ATA_OVER_ETH=m | |
| 382 | +CONFIG_BLK_DEV_RAM_DAX=y | |
| 375 | 383 | CONFIG_VIRTIO_BLK=y |
| 376 | 384 | CONFIG_ENCLOSURE_SERVICES=m |
| 385 | +CONFIG_GENWQE=m | |
| 377 | 386 | CONFIG_RAID_ATTRS=m |
| 378 | 387 | CONFIG_SCSI=y |
| 379 | 388 | CONFIG_BLK_DEV_SD=y |
| @@ -439,6 +448,8 @@ CONFIG_NLMON=m · 59 unmodified lines | ||
| 439 | 448 | # CONFIG_NET_VENDOR_INTEL is not set |
| 440 | 449 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 441 | 450 | CONFIG_MLX4_EN=m |
| 451 | +CONFIG_MLX5_CORE=m | |
| 452 | +CONFIG_MLX5_CORE_EN=y | |
| 442 | 453 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 443 | 454 | CONFIG_PPP=m |
| 444 | 455 | CONFIG_PPP_BSDCOMP=m |
| @@ -449,7 +460,6 @@ CONFIG_PPTP=m · 4 unmodified lines | ||
| 449 | 460 | CONFIG_PPPOL2TP=m |
| 450 | 461 | CONFIG_PPP_ASYNC=m |
| 451 | 462 | CONFIG_PPP_SYNC_TTY=m |
| 452 | −# CONFIG_INPUT_MOUSEDEV_PSAUX is not set | |
| 453 | 463 | # CONFIG_INPUT_KEYBOARD is not set |
| 454 | 464 | # CONFIG_INPUT_MOUSE is not set |
| 455 | 465 | # CONFIG_SERIO is not set |
| @@ -468,6 +478,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines | ||
| 468 | 478 | CONFIG_INFINIBAND=m |
| 469 | 479 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 470 | 480 | CONFIG_MLX4_INFINIBAND=m |
| 481 | +CONFIG_MLX5_INFINIBAND=m | |
| 471 | 482 | CONFIG_VIRTIO_BALLOON=m |
| 472 | 483 | CONFIG_EXT4_FS=y |
| 473 | 484 | CONFIG_EXT4_FS_POSIX_ACL=y |
| @@ -483,11 +494,15 @@ CONFIG_XFS_QUOTA=y · 9 unmodified lines | ||
| 483 | 494 | CONFIG_XFS_POSIX_ACL=y |
| 484 | 495 | CONFIG_XFS_RT=y |
| 485 | 496 | CONFIG_GFS2_FS=m |
| 497 | +CONFIG_GFS2_FS_LOCKING_DLM=y | |
| 486 | 498 | CONFIG_OCFS2_FS=m |
| 487 | 499 | CONFIG_BTRFS_FS=y |
| 488 | 500 | CONFIG_BTRFS_FS_POSIX_ACL=y |
| 489 | 501 | CONFIG_NILFS2_FS=m |
| 502 | +CONFIG_FS_DAX=y | |
| 503 | +CONFIG_EXPORTFS_BLOCK_OPS=y | |
| 490 | 504 | CONFIG_FANOTIFY=y |
| 505 | +CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y | |
| 491 | 506 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| 492 | 507 | CONFIG_QFMT_V1=m |
| 493 | 508 | CONFIG_QFMT_V2=m |
| @@ -553,7 +568,6 @@ CONFIG_UNUSED_SYMBOLS=y · 59 unmodified lines | ||
| 553 | 568 | CONFIG_MAGIC_SYSRQ=y |
| 554 | 569 | CONFIG_DEBUG_MEMORY_INIT=y |
| 555 | 570 | CONFIG_PANIC_ON_OOPS=y |
| 556 | −CONFIG_TIMER_STATS=y | |
| 557 | 571 | CONFIG_RCU_TORTURE_TEST=m |
| 558 | 572 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 559 | 573 | CONFIG_LATENCYTOP=y |
| @@ -576,6 +590,7 @@ CONFIG_BIG_KEYS=y · 16 unmodified lines | ||
| 576 | 590 | CONFIG_ENCRYPTED_KEYS=m |
| 577 | 591 | CONFIG_SECURITY=y |
| 578 | 592 | CONFIG_SECURITY_NETWORK=y |
| 593 | +CONFIG_HARDENED_USERCOPY=y | |
| 579 | 594 | CONFIG_SECURITY_SELINUX=y |
| 580 | 595 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 581 | 596 | CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 |
| @@ -599,6 +614,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 17 unmodified lines | ||
| 599 | 614 | CONFIG_CRYPTO_LRW=m |
| 600 | 615 | CONFIG_CRYPTO_PCBC=m |
| 601 | 616 | CONFIG_CRYPTO_KEYWRAP=m |
| 617 | +CONFIG_CRYPTO_CMAC=m | |
| 602 | 618 | CONFIG_CRYPTO_XCBC=m |
| 603 | 619 | CONFIG_CRYPTO_VMAC=m |
| 604 | 620 | CONFIG_CRYPTO_CRC32=m |
| @@ -611,6 +627,7 @@ CONFIG_CRYPTO_SHA512=m · 6 unmodified lines | ||
| 611 | 627 | CONFIG_CRYPTO_SHA3=m |
| 612 | 628 | CONFIG_CRYPTO_TGR192=m |
| 613 | 629 | CONFIG_CRYPTO_WP512=m |
| 630 | +CONFIG_CRYPTO_AES_TI=m | |
| 614 | 631 | CONFIG_CRYPTO_ANUBIS=m |
| 615 | 632 | CONFIG_CRYPTO_BLOWFISH=m |
| 616 | 633 | CONFIG_CRYPTO_CAMELLIA=m |
| @@ -626,16 +643,19 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines | ||
| 626 | 643 | CONFIG_CRYPTO_842=m |
| 627 | 644 | CONFIG_CRYPTO_LZ4=m |
| 628 | 645 | CONFIG_CRYPTO_LZ4HC=m |
| 646 | +CONFIG_CRYPTO_ANSI_CPRNG=m | |
| 629 | 647 | CONFIG_CRYPTO_USER_API_HASH=m |
| 630 | 648 | CONFIG_CRYPTO_USER_API_SKCIPHER=m |
| 631 | 649 | CONFIG_CRYPTO_USER_API_RNG=m |
| 632 | 650 | CONFIG_CRYPTO_USER_API_AEAD=m |
| 633 | 651 | CONFIG_ZCRYPT=m |
| 652 | +CONFIG_PKEY=m | |
| 634 | 653 | CONFIG_CRYPTO_SHA1_S390=m |
| 635 | 654 | CONFIG_CRYPTO_SHA256_S390=m |
| 636 | 655 | CONFIG_CRYPTO_SHA512_S390=m |
| 637 | 656 | CONFIG_CRYPTO_DES_S390=m |
| 638 | 657 | CONFIG_CRYPTO_AES_S390=m |
| 658 | +CONFIG_CRYPTO_PAES_S390=m | |
| 639 | 659 | CONFIG_CRYPTO_GHASH_S390=m |
| 640 | 660 | CONFIG_CRYPTO_CRC32_S390=y |
| 641 | 661 | CONFIG_CRC7=m |
| @@ -31,6 +31,7 @@ CONFIG_USER_NS=y · 30 unmodified lines | ||
| 31 | 31 | CONFIG_SCHED_AUTOGROUP=y |
| 32 | 32 | CONFIG_BLK_DEV_INITRD=y |
| 33 | 33 | CONFIG_EXPERT=y |
| 34 | +# CONFIG_SYSFS_SYSCALL is not set | |
| 34 | 35 | CONFIG_BPF_SYSCALL=y |
| 35 | 36 | CONFIG_USERFAULTFD=y |
| 36 | 37 | # CONFIG_COMPAT_BRK is not set |
| @@ -44,7 +45,10 @@ CONFIG_MODULE_UNLOAD=y · 7 unmodified lines | ||
| 44 | 45 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 45 | 46 | CONFIG_MODVERSIONS=y |
| 46 | 47 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 48 | +CONFIG_BLK_DEV_INTEGRITY=y | |
| 47 | 49 | CONFIG_BLK_DEV_THROTTLING=y |
| 50 | +CONFIG_BLK_WBT=y | |
| 51 | +CONFIG_BLK_WBT_SQ=y | |
| 48 | 52 | CONFIG_PARTITION_ADVANCED=y |
| 49 | 53 | CONFIG_IBM_PARTITION=y |
| 50 | 54 | CONFIG_BSD_DISKLABEL=y |
| @@ -86,6 +90,8 @@ CONFIG_UNIX=y · 35 unmodified lines | ||
| 86 | 90 | CONFIG_UNIX_DIAG=m |
| 87 | 91 | CONFIG_XFRM_USER=m |
| 88 | 92 | CONFIG_NET_KEY=m |
| 93 | +CONFIG_SMC=m | |
| 94 | +CONFIG_SMC_DIAG=m | |
| 89 | 95 | CONFIG_INET=y |
| 90 | 96 | CONFIG_IP_MULTICAST=y |
| 91 | 97 | CONFIG_IP_ADVANCED_ROUTER=y |
| @@ -354,6 +360,7 @@ CONFIG_NET_ACT_SIMP=m · 262 unmodified lines | ||
| 354 | 360 | CONFIG_NET_ACT_SKBEDIT=m |
| 355 | 361 | CONFIG_NET_ACT_CSUM=m |
| 356 | 362 | CONFIG_DNS_RESOLVER=y |
| 363 | +CONFIG_NETLINK_DIAG=m | |
| 357 | 364 | CONFIG_CGROUP_NET_PRIO=y |
| 358 | 365 | CONFIG_BPF_JIT=y |
| 359 | 366 | CONFIG_NET_PKTGEN=m |
| @@ -362,16 +369,18 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines | ||
| 362 | 369 | CONFIG_DMA_CMA=y |
| 363 | 370 | CONFIG_CMA_SIZE_MBYTES=0 |
| 364 | 371 | CONFIG_CONNECTOR=y |
| 372 | +CONFIG_ZRAM=m | |
| 365 | 373 | CONFIG_BLK_DEV_LOOP=m |
| 366 | 374 | CONFIG_BLK_DEV_CRYPTOLOOP=m |
| 375 | +CONFIG_BLK_DEV_DRBD=m | |
| 367 | 376 | CONFIG_BLK_DEV_NBD=m |
| 368 | 377 | CONFIG_BLK_DEV_OSD=m |
| 369 | 378 | CONFIG_BLK_DEV_RAM=y |
| 370 | 379 | CONFIG_BLK_DEV_RAM_SIZE=32768 |
| 371 | −CONFIG_CDROM_PKTCDVD=m | |
| 372 | −CONFIG_ATA_OVER_ETH=m | |
| 380 | +CONFIG_BLK_DEV_RAM_DAX=y | |
| 373 | 381 | CONFIG_VIRTIO_BLK=y |
| 374 | 382 | CONFIG_ENCLOSURE_SERVICES=m |
| 383 | +CONFIG_GENWQE=m | |
| 375 | 384 | CONFIG_RAID_ATTRS=m |
| 376 | 385 | CONFIG_SCSI=y |
| 377 | 386 | CONFIG_BLK_DEV_SD=y |
| @@ -437,6 +446,8 @@ CONFIG_NLMON=m · 59 unmodified lines | ||
| 437 | 446 | # CONFIG_NET_VENDOR_INTEL is not set |
| 438 | 447 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 439 | 448 | CONFIG_MLX4_EN=m |
| 449 | +CONFIG_MLX5_CORE=m | |
| 450 | +CONFIG_MLX5_CORE_EN=y | |
| 440 | 451 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 441 | 452 | CONFIG_PPP=m |
| 442 | 453 | CONFIG_PPP_BSDCOMP=m |
| @@ -447,7 +458,6 @@ CONFIG_PPTP=m · 4 unmodified lines | ||
| 447 | 458 | CONFIG_PPPOL2TP=m |
| 448 | 459 | CONFIG_PPP_ASYNC=m |
| 449 | 460 | CONFIG_PPP_SYNC_TTY=m |
| 450 | −# CONFIG_INPUT_MOUSEDEV_PSAUX is not set | |
| 451 | 461 | # CONFIG_INPUT_KEYBOARD is not set |
| 452 | 462 | # CONFIG_INPUT_MOUSE is not set |
| 453 | 463 | # CONFIG_SERIO is not set |
| @@ -466,6 +476,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines | ||
| 466 | 476 | CONFIG_INFINIBAND=m |
| 467 | 477 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 468 | 478 | CONFIG_MLX4_INFINIBAND=m |
| 479 | +CONFIG_MLX5_INFINIBAND=m | |
| 469 | 480 | CONFIG_VIRTIO_BALLOON=m |
| 470 | 481 | CONFIG_EXT4_FS=y |
| 471 | 482 | CONFIG_EXT4_FS_POSIX_ACL=y |
| @@ -481,11 +492,15 @@ CONFIG_XFS_QUOTA=y · 9 unmodified lines | ||
| 481 | 492 | CONFIG_XFS_POSIX_ACL=y |
| 482 | 493 | CONFIG_XFS_RT=y |
| 483 | 494 | CONFIG_GFS2_FS=m |
| 495 | +CONFIG_GFS2_FS_LOCKING_DLM=y | |
| 484 | 496 | CONFIG_OCFS2_FS=m |
| 485 | 497 | CONFIG_BTRFS_FS=y |
| 486 | 498 | CONFIG_BTRFS_FS_POSIX_ACL=y |
| 487 | 499 | CONFIG_NILFS2_FS=m |
| 500 | +CONFIG_FS_DAX=y | |
| 501 | +CONFIG_EXPORTFS_BLOCK_OPS=y | |
| 488 | 502 | CONFIG_FANOTIFY=y |
| 503 | +CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y | |
| 489 | 504 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| 490 | 505 | CONFIG_QFMT_V1=m |
| 491 | 506 | CONFIG_QFMT_V2=m |
| @@ -551,7 +566,6 @@ CONFIG_UNUSED_SYMBOLS=y · 59 unmodified lines | ||
| 551 | 566 | CONFIG_MAGIC_SYSRQ=y |
| 552 | 567 | CONFIG_DEBUG_MEMORY_INIT=y |
| 553 | 568 | CONFIG_PANIC_ON_OOPS=y |
| 554 | −CONFIG_TIMER_STATS=y | |
| 555 | 569 | CONFIG_RCU_TORTURE_TEST=m |
| 556 | 570 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 557 | 571 | CONFIG_LATENCYTOP=y |
| @@ -574,6 +588,7 @@ CONFIG_BIG_KEYS=y · 16 unmodified lines | ||
| 574 | 588 | CONFIG_ENCRYPTED_KEYS=m |
| 575 | 589 | CONFIG_SECURITY=y |
| 576 | 590 | CONFIG_SECURITY_NETWORK=y |
| 591 | +CONFIG_HARDENED_USERCOPY=y | |
| 577 | 592 | CONFIG_SECURITY_SELINUX=y |
| 578 | 593 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 579 | 594 | CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 |
| @@ -597,6 +612,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 17 unmodified lines | ||
| 597 | 612 | CONFIG_CRYPTO_LRW=m |
| 598 | 613 | CONFIG_CRYPTO_PCBC=m |
| 599 | 614 | CONFIG_CRYPTO_KEYWRAP=m |
| 615 | +CONFIG_CRYPTO_CMAC=m | |
| 600 | 616 | CONFIG_CRYPTO_XCBC=m |
| 601 | 617 | CONFIG_CRYPTO_VMAC=m |
| 602 | 618 | CONFIG_CRYPTO_CRC32=m |
| @@ -609,6 +625,7 @@ CONFIG_CRYPTO_SHA512=m · 6 unmodified lines | ||
| 609 | 625 | CONFIG_CRYPTO_SHA3=m |
| 610 | 626 | CONFIG_CRYPTO_TGR192=m |
| 611 | 627 | CONFIG_CRYPTO_WP512=m |
| 628 | +CONFIG_CRYPTO_AES_TI=m | |
| 612 | 629 | CONFIG_CRYPTO_ANUBIS=m |
| 613 | 630 | CONFIG_CRYPTO_BLOWFISH=m |
| 614 | 631 | CONFIG_CRYPTO_CAMELLIA=m |
| @@ -624,6 +641,7 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines | ||
| 624 | 641 | CONFIG_CRYPTO_842=m |
| 625 | 642 | CONFIG_CRYPTO_LZ4=m |
| 626 | 643 | CONFIG_CRYPTO_LZ4HC=m |
| 644 | +CONFIG_CRYPTO_ANSI_CPRNG=m | |
| 627 | 645 | CONFIG_CRYPTO_USER_API_HASH=m |
| 628 | 646 | CONFIG_CRYPTO_USER_API_SKCIPHER=m |
| 629 | 647 | CONFIG_CRYPTO_USER_API_RNG=m |
| @@ -635,6 +653,7 @@ CONFIG_CRYPTO_SHA256_S390=m · 5 unmodified lines | ||
| 635 | 653 | CONFIG_CRYPTO_SHA512_S390=m |
| 636 | 654 | CONFIG_CRYPTO_DES_S390=m |
| 637 | 655 | CONFIG_CRYPTO_AES_S390=m |
| 656 | +CONFIG_CRYPTO_PAES_S390=m | |
| 638 | 657 | CONFIG_CRYPTO_GHASH_S390=m |
| 639 | 658 | CONFIG_CRYPTO_CRC32_S390=y |
| 640 | 659 | CONFIG_CRC7=m |
| @@ -12,8 +12,10 @@ CONFIG_TUNE_ZEC12=y · 11 unmodified lines | ||
| 12 | 12 | CONFIG_NR_CPUS=2 |
| 13 | 13 | # CONFIG_HOTPLUG_CPU is not set |
| 14 | 14 | CONFIG_HZ_100=y |
| 15 | +# CONFIG_ARCH_RANDOM is not set | |
| 15 | 16 | # CONFIG_COMPACTION is not set |
| 16 | 17 | # CONFIG_MIGRATION is not set |
| 18 | +# CONFIG_BOUNCE is not set | |
| 17 | 19 | # CONFIG_CHECK_STACK is not set |
| 18 | 20 | # CONFIG_CHSC_SCH is not set |
| 19 | 21 | # CONFIG_SCM_BUS is not set |
| @@ -36,11 +38,11 @@ CONFIG_SCSI_CONSTANTS=y · 16 unmodified lines | ||
| 36 | 38 | CONFIG_SCSI_LOGGING=y |
| 37 | 39 | CONFIG_SCSI_FC_ATTRS=y |
| 38 | 40 | CONFIG_ZFCP=y |
| 39 | −# CONFIG_INPUT_MOUSEDEV_PSAUX is not set | |
| 40 | 41 | # CONFIG_INPUT_KEYBOARD is not set |
| 41 | 42 | # CONFIG_INPUT_MOUSE is not set |
| 42 | 43 | # CONFIG_SERIO is not set |
| 43 | 44 | # CONFIG_HVC_IUCV is not set |
| 45 | +# CONFIG_HW_RANDOM_S390 is not set | |
| 44 | 46 | CONFIG_RAW_DRIVER=y |
| 45 | 47 | # CONFIG_SCLP_ASYNC is not set |
| 46 | 48 | # CONFIG_HMC_DRV is not set |
| @@ -54,9 +56,9 @@ CONFIG_RAW_DRIVER=y · 7 unmodified lines | ||
| 54 | 56 | # CONFIG_INOTIFY_USER is not set |
| 55 | 57 | CONFIG_CONFIGFS_FS=y |
| 56 | 58 | # CONFIG_MISC_FILESYSTEMS is not set |
| 59 | +# CONFIG_NETWORK_FILESYSTEMS is not set | |
| 57 | 60 | CONFIG_PRINTK_TIME=y |
| 58 | 61 | CONFIG_DEBUG_INFO=y |
| 59 | −CONFIG_DEBUG_FS=y | |
| 60 | 62 | CONFIG_DEBUG_KERNEL=y |
| 61 | 63 | CONFIG_PANIC_ON_OOPS=y |
| 62 | 64 | # CONFIG_SCHED_DEBUG is not set |
| @@ -28,6 +28,7 @@ CONFIG_NAMESPACES=y · 27 unmodified lines | ||
| 28 | 28 | CONFIG_USER_NS=y |
| 29 | 29 | CONFIG_BLK_DEV_INITRD=y |
| 30 | 30 | CONFIG_EXPERT=y |
| 31 | +# CONFIG_SYSFS_SYSCALL is not set | |
| 31 | 32 | CONFIG_BPF_SYSCALL=y |
| 32 | 33 | CONFIG_USERFAULTFD=y |
| 33 | 34 | # CONFIG_COMPAT_BRK is not set |
| @@ -108,7 +109,6 @@ CONFIG_ZFCP=y · 74 unmodified lines | ||
| 108 | 109 | CONFIG_SCSI_VIRTIO=y |
| 109 | 110 | CONFIG_MD=y |
| 110 | 111 | CONFIG_MD_LINEAR=m |
| 111 | −CONFIG_MD_RAID0=m | |
| 112 | 112 | CONFIG_MD_MULTIPATH=m |
| 113 | 113 | CONFIG_BLK_DEV_DM=y |
| 114 | 114 | CONFIG_DM_CRYPT=m |
| @@ -131,6 +131,7 @@ CONFIG_TUN=m · 16 unmodified lines | ||
| 131 | 131 | CONFIG_VIRTIO_NET=y |
| 132 | 132 | # CONFIG_NET_VENDOR_ALACRITECH is not set |
| 133 | 133 | # CONFIG_NET_VENDOR_SOLARFLARE is not set |
| 134 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 134 | 135 | # CONFIG_INPUT is not set |
| 135 | 136 | # CONFIG_SERIO is not set |
| 136 | 137 | CONFIG_DEVKMEM=y |
| @@ -162,7 +163,6 @@ CONFIG_MAGIC_SYSRQ=y · 25 unmodified lines | ||
| 162 | 163 | CONFIG_DEBUG_PAGEALLOC=y |
| 163 | 164 | CONFIG_DETECT_HUNG_TASK=y |
| 164 | 165 | CONFIG_PANIC_ON_OOPS=y |
| 165 | −CONFIG_TIMER_STATS=y | |
| 166 | 166 | CONFIG_DEBUG_RT_MUTEXES=y |
| 167 | 167 | CONFIG_PROVE_LOCKING=y |
| 168 | 168 | CONFIG_LOCK_STAT=y |
| @@ -172,14 +172,12 @@ CONFIG_DEBUG_LIST=y · 3 unmodified lines | ||
| 172 | 172 | CONFIG_DEBUG_SG=y |
| 173 | 173 | CONFIG_DEBUG_NOTIFIERS=y |
| 174 | 174 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 175 | −CONFIG_RCU_TRACE=y | |
| 176 | 175 | CONFIG_LATENCYTOP=y |
| 177 | 176 | CONFIG_SCHED_TRACER=y |
| 178 | 177 | CONFIG_FTRACE_SYSCALLS=y |
| 179 | 178 | CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y |
| 180 | 179 | CONFIG_STACK_TRACER=y |
| 181 | 180 | CONFIG_BLK_DEV_IO_TRACE=y |
| 182 | −CONFIG_UPROBE_EVENTS=y | |
| 183 | 181 | CONFIG_FUNCTION_PROFILER=y |
| 184 | 182 | CONFIG_TRACE_ENUM_MAP_FILE=y |
| 185 | 183 | CONFIG_KPROBES_SANITY_TEST=y |
| @@ -190,7 +188,6 @@ CONFIG_CRYPTO_CCM=m · 4 unmodified lines | ||
| 190 | 188 | CONFIG_CRYPTO_GCM=m |
| 191 | 189 | CONFIG_CRYPTO_CBC=y |
| 192 | 190 | CONFIG_CRYPTO_CTS=m |
| 193 | −CONFIG_CRYPTO_ECB=m | |
| 194 | 191 | CONFIG_CRYPTO_LRW=m |
| 195 | 192 | CONFIG_CRYPTO_PCBC=m |
| 196 | 193 | CONFIG_CRYPTO_XTS=m |
| @@ -230,6 +227,7 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m · 33 unmodified lines | ||
| 230 | 227 | CONFIG_CRYPTO_USER_API_RNG=m |
| 231 | 228 | CONFIG_ZCRYPT=m |
| 232 | 229 | CONFIG_PKEY=m |
| 230 | +CONFIG_CRYPTO_PAES_S390=m | |
| 233 | 231 | CONFIG_CRYPTO_SHA1_S390=m |
| 234 | 232 | CONFIG_CRYPTO_SHA256_S390=m |
| 235 | 233 | CONFIG_CRYPTO_SHA512_S390=m |
| @@ -231,12 +231,17 @@ ENTRY(sie64a) · 230 unmodified lines | ||
| 231 | 231 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
| 232 | 232 | .Lsie_done: |
| 233 | 233 | # some program checks are suppressing. C code (e.g. do_protection_exception) |
| 234 | −# will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other | |
| 235 | −# instructions between sie64a and .Lsie_done should not cause program | |
| 236 | −# interrupts. So lets use a nop (47 00 00 00) as a landing pad. | |
| 234 | +# will rewind the PSW by the ILC, which is often 4 bytes in case of SIE. There | |
| 235 | +# are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable. | |
| 236 | +# Other instructions between sie64a and .Lsie_done should not cause program | |
| 237 | +# interrupts. So lets use 3 nops as a landing pad for all possible rewinds. | |
| 237 | 238 | # See also .Lcleanup_sie |
| 238 | −.Lrewind_pad: | |
| 239 | − nop 0 | |
| 239 | +.Lrewind_pad6: | |
| 240 | + nopr 7 | |
| 241 | +.Lrewind_pad4: | |
| 242 | + nopr 7 | |
| 243 | +.Lrewind_pad2: | |
| 244 | + nopr 7 | |
| 240 | 245 | .globl sie_exit |
| 241 | 246 | sie_exit: |
| 242 | 247 | lg %r14,__SF_EMPTY+8(%r15) # load guest register save area |
| @@ -249,7 +254,9 @@ sie_exit: · 6 unmodified lines | ||
| 249 | 254 | stg %r14,__SF_EMPTY+16(%r15) # set exit reason code |
| 250 | 255 | j sie_exit |
| 251 | 256 | |
| 252 | − EX_TABLE(.Lrewind_pad,.Lsie_fault) | |
| 257 | + EX_TABLE(.Lrewind_pad6,.Lsie_fault) | |
| 258 | + EX_TABLE(.Lrewind_pad4,.Lsie_fault) | |
| 259 | + EX_TABLE(.Lrewind_pad2,.Lsie_fault) | |
| 253 | 260 | EX_TABLE(sie_exit,.Lsie_fault) |
| 254 | 261 | EXPORT_SYMBOL(sie64a) |
| 255 | 262 | EXPORT_SYMBOL(sie_exit) |
| @@ -977,11 +977,12 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr, · 976 unmodified lines | ||
| 977 | 977 | ptr = asce.origin * 4096; |
| 978 | 978 | if (asce.r) { |
| 979 | 979 | *fake = 1; |
| 980 | + ptr = 0; | |
| 980 | 981 | asce.dt = ASCE_TYPE_REGION1; |
| 981 | 982 | } |
| 982 | 983 | switch (asce.dt) { |
| 983 | 984 | case ASCE_TYPE_REGION1: |
| 984 | − if (vaddr.rfx01 > asce.tl && !asce.r) | |
| 985 | + if (vaddr.rfx01 > asce.tl && !*fake) | |
| 985 | 986 | return PGM_REGION_FIRST_TRANS; |
| 986 | 987 | break; |
| 987 | 988 | case ASCE_TYPE_REGION2: |
| @@ -1009,8 +1010,7 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr, · 21 unmodified lines | ||
| 1009 | 1010 | union region1_table_entry rfte; |
| 1010 | 1011 | |
| 1011 | 1012 | if (*fake) { |
| 1012 | − /* offset in 16EB guest memory block */ | |
| 1013 | − ptr = ptr + ((unsigned long) vaddr.rsx << 53UL); | |
| 1013 | + ptr += (unsigned long) vaddr.rfx << 53; | |
| 1014 | 1014 | rfte.val = ptr; |
| 1015 | 1015 | goto shadow_r2t; |
| 1016 | 1016 | } |
| @@ -1036,8 +1036,7 @@ shadow_r2t: · 19 unmodified lines | ||
| 1036 | 1036 | union region2_table_entry rste; |
| 1037 | 1037 | |
| 1038 | 1038 | if (*fake) { |
| 1039 | − /* offset in 8PB guest memory block */ | |
| 1040 | − ptr = ptr + ((unsigned long) vaddr.rtx << 42UL); | |
| 1039 | + ptr += (unsigned long) vaddr.rsx << 42; | |
| 1041 | 1040 | rste.val = ptr; |
| 1042 | 1041 | goto shadow_r3t; |
| 1043 | 1042 | } |
| @@ -1064,8 +1063,7 @@ shadow_r3t: · 20 unmodified lines | ||
| 1064 | 1063 | union region3_table_entry rtte; |
| 1065 | 1064 | |
| 1066 | 1065 | if (*fake) { |
| 1067 | − /* offset in 4TB guest memory block */ | |
| 1068 | − ptr = ptr + ((unsigned long) vaddr.sx << 31UL); | |
| 1066 | + ptr += (unsigned long) vaddr.rtx << 31; | |
| 1069 | 1067 | rtte.val = ptr; |
| 1070 | 1068 | goto shadow_sgt; |
| 1071 | 1069 | } |
| @@ -1101,8 +1099,7 @@ shadow_sgt: · 29 unmodified lines | ||
| 1101 | 1099 | union segment_table_entry ste; |
| 1102 | 1100 | |
| 1103 | 1101 | if (*fake) { |
| 1104 | − /* offset in 2G guest memory block */ | |
| 1105 | − ptr = ptr + ((unsigned long) vaddr.sx << 20UL); | |
| 1102 | + ptr += (unsigned long) vaddr.sx << 20; | |
| 1106 | 1103 | ste.val = ptr; |
| 1107 | 1104 | goto shadow_pgt; |
| 1108 | 1105 | } |
| @@ -101,7 +101,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 100 unmodified lines | ||
| 101 | 101 | addr = PAGE_ALIGN(addr); |
| 102 | 102 | vma = find_vma(mm, addr); |
| 103 | 103 | if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && |
| 104 | − (!vma || addr + len <= vma->vm_start)) | |
| 104 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 105 | 105 | goto check_asce_limit; |
| 106 | 106 | } |
| 107 | 107 | |
| @@ -151,7 +151,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 43 unmodified lines | ||
| 151 | 151 | addr = PAGE_ALIGN(addr); |
| 152 | 152 | vma = find_vma(mm, addr); |
| 153 | 153 | if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && |
| 154 | − (!vma || addr + len <= vma->vm_start)) | |
| 154 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 155 | 155 | goto check_asce_limit; |
| 156 | 156 | } |
| 157 | 157 | |
| @@ -64,7 +64,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, · 63 unmodified lines | ||
| 64 | 64 | |
| 65 | 65 | vma = find_vma(mm, addr); |
| 66 | 66 | if (TASK_SIZE - len >= addr && |
| 67 | − (!vma || addr + len <= vma->vm_start)) | |
| 67 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 68 | 68 | return addr; |
| 69 | 69 | } |
| 70 | 70 | |
| @@ -114,7 +114,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 43 unmodified lines | ||
| 114 | 114 | |
| 115 | 115 | vma = find_vma(mm, addr); |
| 116 | 116 | if (TASK_SIZE - len >= addr && |
| 117 | − (!vma || addr + len <= vma->vm_start)) | |
| 117 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 118 | 118 | return addr; |
| 119 | 119 | } |
| 120 | 120 | |
| @@ -120,7 +120,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi · 119 unmodified lines | ||
| 120 | 120 | |
| 121 | 121 | vma = find_vma(mm, addr); |
| 122 | 122 | if (task_size - len >= addr && |
| 123 | − (!vma || addr + len <= vma->vm_start)) | |
| 123 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 124 | 124 | return addr; |
| 125 | 125 | } |
| 126 | 126 | |
| @@ -183,7 +183,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 56 unmodified lines | ||
| 183 | 183 | |
| 184 | 184 | vma = find_vma(mm, addr); |
| 185 | 185 | if (task_size - len >= addr && |
| 186 | − (!vma || addr + len <= vma->vm_start)) | |
| 186 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 187 | 187 | return addr; |
| 188 | 188 | } |
| 189 | 189 | |
| @@ -120,7 +120,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 119 unmodified lines | ||
| 120 | 120 | addr = ALIGN(addr, huge_page_size(h)); |
| 121 | 121 | vma = find_vma(mm, addr); |
| 122 | 122 | if (task_size - len >= addr && |
| 123 | − (!vma || addr + len <= vma->vm_start)) | |
| 123 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 124 | 124 | return addr; |
| 125 | 125 | } |
| 126 | 126 | if (mm->get_unmapped_area == arch_get_unmapped_area) |
| @@ -233,7 +233,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 232 unmodified lines | ||
| 233 | 233 | addr = ALIGN(addr, huge_page_size(h)); |
| 234 | 234 | vma = find_vma(mm, addr); |
| 235 | 235 | if (TASK_SIZE - len >= addr && |
| 236 | − (!vma || addr + len <= vma->vm_start)) | |
| 236 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 237 | 237 | return addr; |
| 238 | 238 | } |
| 239 | 239 | if (current->mm->get_unmapped_area == arch_get_unmapped_area) |
| @@ -431,11 +431,11 @@ static __initconst const u64 skl_hw_cache_event_ids · 430 unmodified lines | ||
| 431 | 431 | [ C(DTLB) ] = { |
| 432 | 432 | [ C(OP_READ) ] = { |
| 433 | 433 | [ C(RESULT_ACCESS) ] = 0x81d0, /* MEM_INST_RETIRED.ALL_LOADS */ |
| 434 | − [ C(RESULT_MISS) ] = 0x608, /* DTLB_LOAD_MISSES.WALK_COMPLETED */ | |
| 434 | + [ C(RESULT_MISS) ] = 0xe08, /* DTLB_LOAD_MISSES.WALK_COMPLETED */ | |
| 435 | 435 | }, |
| 436 | 436 | [ C(OP_WRITE) ] = { |
| 437 | 437 | [ C(RESULT_ACCESS) ] = 0x82d0, /* MEM_INST_RETIRED.ALL_STORES */ |
| 438 | − [ C(RESULT_MISS) ] = 0x649, /* DTLB_STORE_MISSES.WALK_COMPLETED */ | |
| 438 | + [ C(RESULT_MISS) ] = 0xe49, /* DTLB_STORE_MISSES.WALK_COMPLETED */ | |
| 439 | 439 | }, |
| 440 | 440 | [ C(OP_PREFETCH) ] = { |
| 441 | 441 | [ C(RESULT_ACCESS) ] = 0x0, |
| @@ -29,6 +29,7 @@ struct pt_regs; · 28 unmodified lines | ||
| 29 | 29 | } while (0) |
| 30 | 30 | |
| 31 | 31 | extern int fixup_exception(struct pt_regs *regs, int trapnr); |
| 32 | +extern int fixup_bug(struct pt_regs *regs, int trapnr); | |
| 32 | 33 | extern bool ex_has_fault_handler(unsigned long ip); |
| 33 | 34 | extern void early_fixup_exception(struct pt_regs *regs, int trapnr); |
| 34 | 35 | |
| @@ -296,6 +296,7 @@ struct x86_emulate_ctxt { · 295 unmodified lines | ||
| 296 | 296 | |
| 297 | 297 | bool perm_ok; /* do not check permissions if true */ |
| 298 | 298 | bool ud; /* inject an #UD if host doesn't support insn */ |
| 299 | + bool tf; /* TF value before instruction (after for syscall/sysret) */ | |
| 299 | 300 | |
| 300 | 301 | bool have_exception; |
| 301 | 302 | struct x86_exception exception; |
| @@ -2,8 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | #define _ASM_X86_MSHYPER_H |
| 3 | 3 | |
| 4 | 4 | #include <linux/types.h> |
| 5 | −#include <linux/interrupt.h> | |
| 6 | −#include <linux/clocksource.h> | |
| 5 | +#include <linux/atomic.h> | |
| 7 | 6 | #include <asm/hyperv.h> |
| 8 | 7 | |
| 9 | 8 | /* |
| @@ -144,7 +144,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 143 unmodified lines | ||
| 144 | 144 | addr = PAGE_ALIGN(addr); |
| 145 | 145 | vma = find_vma(mm, addr); |
| 146 | 146 | if (end - len >= addr && |
| 147 | − (!vma || addr + len <= vma->vm_start)) | |
| 147 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 148 | 148 | return addr; |
| 149 | 149 | } |
| 150 | 150 | |
| @@ -187,7 +187,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 36 unmodified lines | ||
| 187 | 187 | addr = PAGE_ALIGN(addr); |
| 188 | 188 | vma = find_vma(mm, addr); |
| 189 | 189 | if (TASK_SIZE - len >= addr && |
| 190 | − (!vma || addr + len <= vma->vm_start)) | |
| 190 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 191 | 191 | return addr; |
| 192 | 192 | } |
| 193 | 193 | |
| @@ -182,7 +182,7 @@ int is_valid_bugaddr(unsigned long addr) · 181 unmodified lines | ||
| 182 | 182 | return ud == INSN_UD0 || ud == INSN_UD2; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | −static int fixup_bug(struct pt_regs *regs, int trapnr) | |
| 185 | +int fixup_bug(struct pt_regs *regs, int trapnr) | |
| 186 | 186 | { |
| 187 | 187 | if (trapnr != X86_TRAP_UD) |
| 188 | 188 | return 0; |
| @@ -2742,6 +2742,7 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt) · 2741 unmodified lines | ||
| 2742 | 2742 | ctxt->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IF); |
| 2743 | 2743 | } |
| 2744 | 2744 | |
| 2745 | + ctxt->tf = (ctxt->eflags & X86_EFLAGS_TF) != 0; | |
| 2745 | 2746 | return X86EMUL_CONTINUE; |
| 2746 | 2747 | } |
| 2747 | 2748 | |
| @@ -5313,6 +5313,8 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) · 5312 unmodified lines | ||
| 5313 | 5313 | kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); |
| 5314 | 5314 | |
| 5315 | 5315 | ctxt->eflags = kvm_get_rflags(vcpu); |
| 5316 | + ctxt->tf = (ctxt->eflags & X86_EFLAGS_TF) != 0; | |
| 5317 | + | |
| 5316 | 5318 | ctxt->eip = kvm_rip_read(vcpu); |
| 5317 | 5319 | ctxt->mode = (!is_protmode(vcpu)) ? X86EMUL_MODE_REAL : |
| 5318 | 5320 | (ctxt->eflags & X86_EFLAGS_VM) ? X86EMUL_MODE_VM86 : |
| @@ -5528,36 +5530,25 @@ static int kvm_vcpu_check_hw_bp(unsigned long addr, u32 type, u32 dr7, · 209 unmodified lines | ||
| 5528 | 5530 | return dr6; |
| 5529 | 5531 | } |
| 5530 | 5532 | |
| 5531 | −static void kvm_vcpu_check_singlestep(struct kvm_vcpu *vcpu, unsigned long rflags, int *r) | |
| 5533 | +static void kvm_vcpu_do_singlestep(struct kvm_vcpu *vcpu, int *r) | |
| 5532 | 5534 | { |
| 5533 | 5535 | struct kvm_run *kvm_run = vcpu->run; |
| 5534 | 5536 | |
| 5535 | − /* | |
| 5536 | − * rflags is the old, "raw" value of the flags. The new value has | |
| 5537 | − * not been saved yet. | |
| 5538 | − * | |
| 5539 | − * This is correct even for TF set by the guest, because "the | |
| 5540 | − * processor will not generate this exception after the instruction | |
| 5541 | − * that sets the TF flag". | |
| 5542 | − */ | |
| 5543 | − if (unlikely(rflags & X86_EFLAGS_TF)) { | |
| 5544 | − if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) { | |
| 5545 | − kvm_run->debug.arch.dr6 = DR6_BS | DR6_FIXED_1 | | |
| 5546 | − DR6_RTM; | |
| 5547 | − kvm_run->debug.arch.pc = vcpu->arch.singlestep_rip; | |
| 5548 | − kvm_run->debug.arch.exception = DB_VECTOR; | |
| 5549 | − kvm_run->exit_reason = KVM_EXIT_DEBUG; | |
| 5550 | − *r = EMULATE_USER_EXIT; | |
| 5551 | − } else { | |
| 5552 | − /* | |
| 5553 | − * "Certain debug exceptions may clear bit 0-3. The | |
| 5554 | − * remaining contents of the DR6 register are never | |
| 5555 | − * cleared by the processor". | |
| 5556 | − */ | |
| 5557 | − vcpu->arch.dr6 &= ~15; | |
| 5558 | − vcpu->arch.dr6 |= DR6_BS | DR6_RTM; | |
| 5559 | − kvm_queue_exception(vcpu, DB_VECTOR); | |
| 5560 | − } | |
| 5537 | + if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) { | |
| 5538 | + kvm_run->debug.arch.dr6 = DR6_BS | DR6_FIXED_1 | DR6_RTM; | |
| 5539 | + kvm_run->debug.arch.pc = vcpu->arch.singlestep_rip; | |
| 5540 | + kvm_run->debug.arch.exception = DB_VECTOR; | |
| 5541 | + kvm_run->exit_reason = KVM_EXIT_DEBUG; | |
| 5542 | + *r = EMULATE_USER_EXIT; | |
| 5543 | + } else { | |
| 5544 | + /* | |
| 5545 | + * "Certain debug exceptions may clear bit 0-3. The | |
| 5546 | + * remaining contents of the DR6 register are never | |
| 5547 | + * cleared by the processor". | |
| 5548 | + */ | |
| 5549 | + vcpu->arch.dr6 &= ~15; | |
| 5550 | + vcpu->arch.dr6 |= DR6_BS | DR6_RTM; | |
| 5551 | + kvm_queue_exception(vcpu, DB_VECTOR); | |
| 5561 | 5552 | } |
| 5562 | 5553 | } |
| 5563 | 5554 | |
| @@ -5567,7 +5558,17 @@ int kvm_skip_emulated_instruction(struct kvm_vcpu *vcpu) · 3 unmodified lines | ||
| 5567 | 5558 | int r = EMULATE_DONE; |
| 5568 | 5559 | |
| 5569 | 5560 | kvm_x86_ops->skip_emulated_instruction(vcpu); |
| 5570 | − kvm_vcpu_check_singlestep(vcpu, rflags, &r); | |
| 5561 | + | |
| 5562 | + /* | |
| 5563 | + * rflags is the old, "raw" value of the flags. The new value has | |
| 5564 | + * not been saved yet. | |
| 5565 | + * | |
| 5566 | + * This is correct even for TF set by the guest, because "the | |
| 5567 | + * processor will not generate this exception after the instruction | |
| 5568 | + * that sets the TF flag". | |
| 5569 | + */ | |
| 5570 | + if (unlikely(rflags & X86_EFLAGS_TF)) | |
| 5571 | + kvm_vcpu_do_singlestep(vcpu, &r); | |
| 5571 | 5572 | return r == EMULATE_DONE; |
| 5572 | 5573 | } |
| 5573 | 5574 | EXPORT_SYMBOL_GPL(kvm_skip_emulated_instruction); |
| @@ -5726,8 +5727,9 @@ restart: · 152 unmodified lines | ||
| 5726 | 5727 | toggle_interruptibility(vcpu, ctxt->interruptibility); |
| 5727 | 5728 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; |
| 5728 | 5729 | kvm_rip_write(vcpu, ctxt->eip); |
| 5729 | − if (r == EMULATE_DONE) | |
| 5730 | − kvm_vcpu_check_singlestep(vcpu, rflags, &r); | |
| 5730 | + if (r == EMULATE_DONE && | |
| 5731 | + (ctxt->tf || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP))) | |
| 5732 | + kvm_vcpu_do_singlestep(vcpu, &r); | |
| 5731 | 5733 | if (!ctxt->have_exception || |
| 5732 | 5734 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) |
| 5733 | 5735 | __kvm_set_rflags(vcpu, ctxt->eflags); |
| @@ -162,6 +162,9 @@ void __init early_fixup_exception(struct pt_regs *regs, int trapnr) · 161 unmodified lines | ||
| 162 | 162 | if (fixup_exception(regs, trapnr)) |
| 163 | 163 | return; |
| 164 | 164 | |
| 165 | + if (fixup_bug(regs, trapnr)) | |
| 166 | + return; | |
| 167 | + | |
| 165 | 168 | fail: |
| 166 | 169 | early_printk("PANIC: early exception 0x%02x IP %lx:%lx error %lx cr2 0x%lx\n", |
| 167 | 170 | (unsigned)trapnr, (unsigned long)regs->cs, regs->ip, |
| @@ -148,7 +148,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 147 unmodified lines | ||
| 148 | 148 | addr = ALIGN(addr, huge_page_size(h)); |
| 149 | 149 | vma = find_vma(mm, addr); |
| 150 | 150 | if (TASK_SIZE - len >= addr && |
| 151 | − (!vma || addr + len <= vma->vm_start)) | |
| 151 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 152 | 152 | return addr; |
| 153 | 153 | } |
| 154 | 154 | if (mm->get_unmapped_area == arch_get_unmapped_area) |
| @@ -161,16 +161,16 @@ static int page_size_mask; · 160 unmodified lines | ||
| 161 | 161 | |
| 162 | 162 | static void __init probe_page_size_mask(void) |
| 163 | 163 | { |
| 164 | −#if !defined(CONFIG_KMEMCHECK) | |
| 165 | 164 | /* |
| 166 | 165 | * For CONFIG_KMEMCHECK or pagealloc debugging, identity mapping will |
| 167 | 166 | * use small pages. |
| 168 | 167 | * This will simplify cpa(), which otherwise needs to support splitting |
| 169 | 168 | * large pages into small in interrupt context, etc. |
| 170 | 169 | */ |
| 171 | − if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled()) | |
| 170 | + if (boot_cpu_has(X86_FEATURE_PSE) && !debug_pagealloc_enabled() && !IS_ENABLED(CONFIG_KMEMCHECK)) | |
| 172 | 171 | page_size_mask |= 1 << PG_LEVEL_2M; |
| 173 | −#endif | |
| 172 | + else | |
| 173 | + direct_gbpages = 0; | |
| 174 | 174 | |
| 175 | 175 | /* Enable PSE if available */ |
| 176 | 176 | if (boot_cpu_has(X86_FEATURE_PSE)) |
| @@ -29,7 +29,8 @@ static inline void variant_irq_disable(unsigned int irq) { } · 28 unmodified lines | ||
| 29 | 29 | # define PLATFORM_NR_IRQS 0 |
| 30 | 30 | #endif |
| 31 | 31 | #define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS |
| 32 | −#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS) | |
| 32 | +#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS + 1) | |
| 33 | +#define XTENSA_PIC_LINUX_IRQ(hwirq) ((hwirq) + 1) | |
| 33 | 34 | |
| 34 | 35 | #if VARIANT_NR_IRQS == 0 |
| 35 | 36 | static inline void variant_init_irq(void) { } |
| @@ -34,11 +34,6 @@ asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs) · 33 unmodified lines | ||
| 34 | 34 | { |
| 35 | 35 | int irq = irq_find_mapping(NULL, hwirq); |
| 36 | 36 | |
| 37 | − if (hwirq >= NR_IRQS) { | |
| 38 | − printk(KERN_EMERG "%s: cannot handle IRQ %d\n", | |
| 39 | − __func__, hwirq); | |
| 40 | − } | |
| 41 | − | |
| 42 | 37 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
| 43 | 38 | /* Debugging check for stack overflow: is there less than 1KB free? */ |
| 44 | 39 | { |
| @@ -593,8 +593,7 @@ c_show(struct seq_file *f, void *slot) · 592 unmodified lines | ||
| 593 | 593 | (ccount_freq/10000) % 100, |
| 594 | 594 | loops_per_jiffy/(500000/HZ), |
| 595 | 595 | (loops_per_jiffy/(5000/HZ)) % 100); |
| 596 | − | |
| 597 | − seq_printf(f,"flags\t\t: " | |
| 596 | + seq_puts(f, "flags\t\t: " | |
| 598 | 597 | #if XCHAL_HAVE_NMI |
| 599 | 598 | "nmi " |
| 600 | 599 | #endif |
| @@ -88,7 +88,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, · 87 unmodified lines | ||
| 88 | 88 | /* At this point: (!vmm || addr < vmm->vm_end). */ |
| 89 | 89 | if (TASK_SIZE - len < addr) |
| 90 | 90 | return -ENOMEM; |
| 91 | − if (!vmm || addr + len <= vmm->vm_start) | |
| 91 | + if (!vmm || addr + len <= vm_start_gap(vmm)) | |
| 92 | 92 | return addr; |
| 93 | 93 | addr = vmm->vm_end; |
| 94 | 94 | if (flags & MAP_SHARED) |
| @@ -118,7 +118,7 @@ SECTIONS · 117 unmodified lines | ||
| 118 | 118 | SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR) |
| 119 | 119 | SECTION_VECTOR (.UserExceptionVector.literal, USER_VECTOR_VADDR - 4) |
| 120 | 120 | SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR) |
| 121 | − SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 48) | |
| 121 | + SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 20) | |
| 122 | 122 | SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR) |
| 123 | 123 | #endif |
| 124 | 124 | |
| @@ -306,13 +306,13 @@ SECTIONS · 181 unmodified lines | ||
| 306 | 306 | .UserExceptionVector.literal) |
| 307 | 307 | SECTION_VECTOR (_DoubleExceptionVector_literal, |
| 308 | 308 | .DoubleExceptionVector.literal, |
| 309 | − DOUBLEEXC_VECTOR_VADDR - 48, | |
| 309 | + DOUBLEEXC_VECTOR_VADDR - 20, | |
| 310 | 310 | SIZEOF(.UserExceptionVector.text), |
| 311 | 311 | .UserExceptionVector.text) |
| 312 | 312 | SECTION_VECTOR (_DoubleExceptionVector_text, |
| 313 | 313 | .DoubleExceptionVector.text, |
| 314 | 314 | DOUBLEEXC_VECTOR_VADDR, |
| 315 | − 48, | |
| 315 | + 20, | |
| 316 | 316 | .DoubleExceptionVector.literal) |
| 317 | 317 | |
| 318 | 318 | . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; |
| @@ -317,8 +317,7 @@ static int __init simdisk_init(void) · 316 unmodified lines | ||
| 317 | 317 | if (simdisk_count > MAX_SIMDISK_COUNT) |
| 318 | 318 | simdisk_count = MAX_SIMDISK_COUNT; |
| 319 | 319 | |
| 320 | − sddev = kmalloc(simdisk_count * sizeof(struct simdisk), | |
| 321 | − GFP_KERNEL); | |
| 320 | + sddev = kmalloc_array(simdisk_count, sizeof(*sddev), GFP_KERNEL); | |
| 322 | 321 | if (sddev == NULL) |
| 323 | 322 | goto out_unregister; |
| 324 | 323 | |
| @@ -24,16 +24,18 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | /* Interrupt configuration. */ |
| 26 | 26 | |
| 27 | −#define PLATFORM_NR_IRQS 10 | |
| 27 | +#define PLATFORM_NR_IRQS 0 | |
| 28 | 28 | |
| 29 | 29 | /* Default assignment of LX60 devices to external interrupts. */ |
| 30 | 30 | |
| 31 | 31 | #ifdef CONFIG_XTENSA_MX |
| 32 | 32 | #define DUART16552_INTNUM XCHAL_EXTINT3_NUM |
| 33 | 33 | #define OETH_IRQ XCHAL_EXTINT4_NUM |
| 34 | +#define C67X00_IRQ XCHAL_EXTINT8_NUM | |
| 34 | 35 | #else |
| 35 | 36 | #define DUART16552_INTNUM XCHAL_EXTINT0_NUM |
| 36 | 37 | #define OETH_IRQ XCHAL_EXTINT1_NUM |
| 38 | +#define C67X00_IRQ XCHAL_EXTINT5_NUM | |
| 37 | 39 | #endif |
| 38 | 40 | |
| 39 | 41 | /* |
| @@ -63,5 +65,5 @@ · 23 unmodified lines | ||
| 63 | 65 | |
| 64 | 66 | #define C67X00_PADDR (XCHAL_KIO_PADDR + 0x0D0D0000) |
| 65 | 67 | #define C67X00_SIZE 0x10 |
| 66 | −#define C67X00_IRQ 5 | |
| 68 | + | |
| 67 | 69 | #endif /* __XTENSA_XTAVNET_HARDWARE_H */ |
| @@ -175,8 +175,8 @@ static struct resource ethoc_res[] = { · 174 unmodified lines | ||
| 175 | 175 | .flags = IORESOURCE_MEM, |
| 176 | 176 | }, |
| 177 | 177 | [2] = { /* IRQ number */ |
| 178 | − .start = OETH_IRQ, | |
| 179 | − .end = OETH_IRQ, | |
| 178 | + .start = XTENSA_PIC_LINUX_IRQ(OETH_IRQ), | |
| 179 | + .end = XTENSA_PIC_LINUX_IRQ(OETH_IRQ), | |
| 180 | 180 | .flags = IORESOURCE_IRQ, |
| 181 | 181 | }, |
| 182 | 182 | }; |
| @@ -213,8 +213,8 @@ static struct resource c67x00_res[] = { · 30 unmodified lines | ||
| 213 | 213 | .flags = IORESOURCE_MEM, |
| 214 | 214 | }, |
| 215 | 215 | [1] = { /* IRQ number */ |
| 216 | − .start = C67X00_IRQ, | |
| 217 | − .end = C67X00_IRQ, | |
| 216 | + .start = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ), | |
| 217 | + .end = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ), | |
| 218 | 218 | .flags = IORESOURCE_IRQ, |
| 219 | 219 | }, |
| 220 | 220 | }; |
| @@ -247,7 +247,7 @@ static struct resource serial_resource = { · 26 unmodified lines | ||
| 247 | 247 | static struct plat_serial8250_port serial_platform_data[] = { |
| 248 | 248 | [0] = { |
| 249 | 249 | .mapbase = DUART16552_PADDR, |
| 250 | − .irq = DUART16552_INTNUM, | |
| 250 | + .irq = XTENSA_PIC_LINUX_IRQ(DUART16552_INTNUM), | |
| 251 | 251 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 252 | 252 | UPF_IOREMAP, |
| 253 | 253 | .iotype = XCHAL_HAVE_BE ? UPIO_MEM32BE : UPIO_MEM32, |
| @@ -68,6 +68,45 @@ static void blk_mq_sched_assign_ioc(struct request_queue *q, · 67 unmodified lines | ||
| 68 | 68 | __blk_mq_sched_assign_ioc(q, rq, bio, ioc); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | +/* | |
| 72 | + * Mark a hardware queue as needing a restart. For shared queues, maintain | |
| 73 | + * a count of how many hardware queues are marked for restart. | |
| 74 | + */ | |
| 75 | +static void blk_mq_sched_mark_restart_hctx(struct blk_mq_hw_ctx *hctx) | |
| 76 | +{ | |
| 77 | + if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) | |
| 78 | + return; | |
| 79 | + | |
| 80 | + if (hctx->flags & BLK_MQ_F_TAG_SHARED) { | |
| 81 | + struct request_queue *q = hctx->queue; | |
| 82 | + | |
| 83 | + if (!test_and_set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) | |
| 84 | + atomic_inc(&q->shared_hctx_restart); | |
| 85 | + } else | |
| 86 | + set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state); | |
| 87 | +} | |
| 88 | + | |
| 89 | +static bool blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx) | |
| 90 | +{ | |
| 91 | + if (!test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) | |
| 92 | + return false; | |
| 93 | + | |
| 94 | + if (hctx->flags & BLK_MQ_F_TAG_SHARED) { | |
| 95 | + struct request_queue *q = hctx->queue; | |
| 96 | + | |
| 97 | + if (test_and_clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) | |
| 98 | + atomic_dec(&q->shared_hctx_restart); | |
| 99 | + } else | |
| 100 | + clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state); | |
| 101 | + | |
| 102 | + if (blk_mq_hctx_has_pending(hctx)) { | |
| 103 | + blk_mq_run_hw_queue(hctx, true); | |
| 104 | + return true; | |
| 105 | + } | |
| 106 | + | |
| 107 | + return false; | |
| 108 | +} | |
| 109 | + | |
| 71 | 110 | struct request *blk_mq_sched_get_request(struct request_queue *q, |
| 72 | 111 | struct bio *bio, |
| 73 | 112 | unsigned int op, |
| @@ -266,18 +305,6 @@ static bool blk_mq_sched_bypass_insert(struct blk_mq_hw_ctx *hctx, · 192 unmodified lines | ||
| 266 | 305 | return true; |
| 267 | 306 | } |
| 268 | 307 | |
| 269 | −static bool blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx) | |
| 270 | −{ | |
| 271 | − if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) { | |
| 272 | − clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state); | |
| 273 | − if (blk_mq_hctx_has_pending(hctx)) { | |
| 274 | − blk_mq_run_hw_queue(hctx, true); | |
| 275 | − return true; | |
| 276 | − } | |
| 277 | − } | |
| 278 | − return false; | |
| 279 | −} | |
| 280 | − | |
| 281 | 308 | /** |
| 282 | 309 | * list_for_each_entry_rcu_rr - iterate in a round-robin fashion over rcu list |
| 283 | 310 | * @pos: loop cursor. |
| @@ -309,6 +336,13 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *const hctx) · 25 unmodified lines | ||
| 309 | 336 | unsigned int i, j; |
| 310 | 337 | |
| 311 | 338 | if (set->flags & BLK_MQ_F_TAG_SHARED) { |
| 339 | + /* | |
| 340 | + * If this is 0, then we know that no hardware queues | |
| 341 | + * have RESTART marked. We're done. | |
| 342 | + */ | |
| 343 | + if (!atomic_read(&queue->shared_hctx_restart)) | |
| 344 | + return; | |
| 345 | + | |
| 312 | 346 | rcu_read_lock(); |
| 313 | 347 | list_for_each_entry_rcu_rr(q, queue, &set->tag_list, |
| 314 | 348 | tag_set_list) { |
| @@ -115,15 +115,6 @@ static inline bool blk_mq_sched_has_work(struct blk_mq_hw_ctx *hctx) · 114 unmodified lines | ||
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | −/* | |
| 119 | − * Mark a hardware queue as needing a restart. | |
| 120 | − */ | |
| 121 | −static inline void blk_mq_sched_mark_restart_hctx(struct blk_mq_hw_ctx *hctx) | |
| 122 | −{ | |
| 123 | − if (!test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) | |
| 124 | − set_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state); | |
| 125 | −} | |
| 126 | − | |
| 127 | 118 | static inline bool blk_mq_sched_needs_restart(struct blk_mq_hw_ctx *hctx) |
| 128 | 119 | { |
| 129 | 120 | return test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state); |
| @@ -2103,20 +2103,30 @@ static void blk_mq_map_swqueue(struct request_queue *q, · 2102 unmodified lines | ||
| 2103 | 2103 | } |
| 2104 | 2104 | } |
| 2105 | 2105 | |
| 2106 | +/* | |
| 2107 | + * Caller needs to ensure that we're either frozen/quiesced, or that | |
| 2108 | + * the queue isn't live yet. | |
| 2109 | + */ | |
| 2106 | 2110 | static void queue_set_hctx_shared(struct request_queue *q, bool shared) |
| 2107 | 2111 | { |
| 2108 | 2112 | struct blk_mq_hw_ctx *hctx; |
| 2109 | 2113 | int i; |
| 2110 | 2114 | |
| 2111 | 2115 | queue_for_each_hw_ctx(q, hctx, i) { |
| 2112 | − if (shared) | |
| 2116 | + if (shared) { | |
| 2117 | + if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) | |
| 2118 | + atomic_inc(&q->shared_hctx_restart); | |
| 2113 | 2119 | hctx->flags |= BLK_MQ_F_TAG_SHARED; |
| 2114 | − else | |
| 2120 | + } else { | |
| 2121 | + if (test_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state)) | |
| 2122 | + atomic_dec(&q->shared_hctx_restart); | |
| 2115 | 2123 | hctx->flags &= ~BLK_MQ_F_TAG_SHARED; |
| 2124 | + } | |
| 2116 | 2125 | } |
| 2117 | 2126 | } |
| 2118 | 2127 | |
| 2119 | −static void blk_mq_update_tag_set_depth(struct blk_mq_tag_set *set, bool shared) | |
| 2128 | +static void blk_mq_update_tag_set_depth(struct blk_mq_tag_set *set, | |
| 2129 | + bool shared) | |
| 2120 | 2130 | { |
| 2121 | 2131 | struct request_queue *q; |
| 2122 | 2132 | |
| @@ -777,24 +777,25 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head) · 776 unmodified lines | ||
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | /** |
| 780 | − * blk_release_queue: - release a &struct request_queue when it is no longer needed | |
| 781 | − * @kobj: the kobj belonging to the request queue to be released | |
| 780 | + * __blk_release_queue - release a request queue when it is no longer needed | |
| 781 | + * @work: pointer to the release_work member of the request queue to be released | |
| 782 | 782 | * |
| 783 | 783 | * Description: |
| 784 | − * blk_release_queue is the pair to blk_init_queue() or | |
| 785 | − * blk_queue_make_request(). It should be called when a request queue is | |
| 786 | − * being released; typically when a block device is being de-registered. | |
| 787 | − * Currently, its primary task it to free all the &struct request | |
| 788 | − * structures that were allocated to the queue and the queue itself. | |
| 784 | + * blk_release_queue is the counterpart of blk_init_queue(). It should be | |
| 785 | + * called when a request queue is being released; typically when a block | |
| 786 | + * device is being de-registered. Its primary task it to free the queue | |
| 787 | + * itself. | |
| 789 | 788 | * |
| 790 | − * Note: | |
| 789 | + * Notes: | |
| 791 | 790 | * The low level driver must have finished any outstanding requests first |
| 792 | 791 | * via blk_cleanup_queue(). |
| 793 | − **/ | |
| 794 | −static void blk_release_queue(struct kobject *kobj) | |
| 792 | + * | |
| 793 | + * Although blk_release_queue() may be called with preemption disabled, | |
| 794 | + * __blk_release_queue() may sleep. | |
| 795 | + */ | |
| 796 | +static void __blk_release_queue(struct work_struct *work) | |
| 795 | 797 | { |
| 796 | − struct request_queue *q = | |
| 797 | − container_of(kobj, struct request_queue, kobj); | |
| 798 | + struct request_queue *q = container_of(work, typeof(*q), release_work); | |
| 798 | 799 | |
| 799 | 800 | if (test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags)) |
| 800 | 801 | blk_stat_remove_callback(q, q->poll_cb); |
| @@ -834,6 +835,15 @@ static void blk_release_queue(struct kobject *kobj) · 33 unmodified lines | ||
| 834 | 835 | call_rcu(&q->rcu_head, blk_free_queue_rcu); |
| 835 | 836 | } |
| 836 | 837 | |
| 838 | +static void blk_release_queue(struct kobject *kobj) | |
| 839 | +{ | |
| 840 | + struct request_queue *q = | |
| 841 | + container_of(kobj, struct request_queue, kobj); | |
| 842 | + | |
| 843 | + INIT_WORK(&q->release_work, __blk_release_queue); | |
| 844 | + schedule_work(&q->release_work); | |
| 845 | +} | |
| 846 | + | |
| 837 | 847 | static const struct sysfs_ops queue_sysfs_ops = { |
| 838 | 848 | .show = queue_attr_show, |
| 839 | 849 | .store = queue_attr_store, |
| @@ -416,9 +416,18 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc, · 415 unmodified lines | ||
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | − table_desc->validation_count++; | |
| 420 | − if (table_desc->validation_count == 0) { | |
| 421 | − table_desc->validation_count--; | |
| 419 | + if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) { | |
| 420 | + table_desc->validation_count++; | |
| 421 | + | |
| 422 | + /* | |
| 423 | + * Detect validation_count overflows to ensure that the warning | |
| 424 | + * message will only be printed once. | |
| 425 | + */ | |
| 426 | + if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) { | |
| 427 | + ACPI_WARNING((AE_INFO, | |
| 428 | + "Table %p, Validation count overflows\n", | |
| 429 | + table_desc)); | |
| 430 | + } | |
| 422 | 431 | } |
| 423 | 432 | |
| 424 | 433 | *out_table = table_desc->pointer; |
| @@ -445,13 +454,20 @@ void acpi_tb_put_table(struct acpi_table_desc *table_desc) · 20 unmodified lines | ||
| 445 | 454 | |
| 446 | 455 | ACPI_FUNCTION_TRACE(acpi_tb_put_table); |
| 447 | 456 | |
| 448 | − if (table_desc->validation_count == 0) { | |
| 449 | − ACPI_WARNING((AE_INFO, | |
| 450 | − "Table %p, Validation count is zero before decrement\n", | |
| 451 | − table_desc)); | |
| 452 | − return_VOID; | |
| 457 | + if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) { | |
| 458 | + table_desc->validation_count--; | |
| 459 | + | |
| 460 | + /* | |
| 461 | + * Detect validation_count underflows to ensure that the warning | |
| 462 | + * message will only be printed once. | |
| 463 | + */ | |
| 464 | + if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) { | |
| 465 | + ACPI_WARNING((AE_INFO, | |
| 466 | + "Table %p, Validation count underflows\n", | |
| 467 | + table_desc)); | |
| 468 | + return_VOID; | |
| 469 | + } | |
| 453 | 470 | } |
| 454 | − table_desc->validation_count--; | |
| 455 | 471 | |
| 456 | 472 | if (table_desc->validation_count == 0) { |
| 457 | 473 | |
| @@ -474,15 +474,6 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, · 473 unmodified lines | ||
| 474 | 474 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | − /* | |
| 478 | − * The end_tag opcode must be followed by a zero byte. | |
| 479 | − * Although this byte is technically defined to be a checksum, | |
| 480 | − * in practice, all ASL compilers set this byte to zero. | |
| 481 | − */ | |
| 482 | − if (*(aml + 1) != 0) { | |
| 483 | − return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | |
| 484 | − } | |
| 485 | − | |
| 486 | 477 | /* Return the pointer to the end_tag if requested */ |
| 487 | 478 | |
| 488 | 479 | if (!user_function) { |
| @@ -1428,6 +1428,37 @@ static void acpi_init_coherency(struct acpi_device *adev) · 1427 unmodified lines | ||
| 1428 | 1428 | adev->flags.coherent_dma = cca; |
| 1429 | 1429 | } |
| 1430 | 1430 | |
| 1431 | +static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data) | |
| 1432 | +{ | |
| 1433 | + bool *is_spi_i2c_slave_p = data; | |
| 1434 | + | |
| 1435 | + if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) | |
| 1436 | + return 1; | |
| 1437 | + | |
| 1438 | + /* | |
| 1439 | + * devices that are connected to UART still need to be enumerated to | |
| 1440 | + * platform bus | |
| 1441 | + */ | |
| 1442 | + if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART) | |
| 1443 | + *is_spi_i2c_slave_p = true; | |
| 1444 | + | |
| 1445 | + /* no need to do more checking */ | |
| 1446 | + return -1; | |
| 1447 | +} | |
| 1448 | + | |
| 1449 | +static bool acpi_is_spi_i2c_slave(struct acpi_device *device) | |
| 1450 | +{ | |
| 1451 | + struct list_head resource_list; | |
| 1452 | + bool is_spi_i2c_slave = false; | |
| 1453 | + | |
| 1454 | + INIT_LIST_HEAD(&resource_list); | |
| 1455 | + acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave, | |
| 1456 | + &is_spi_i2c_slave); | |
| 1457 | + acpi_dev_free_resource_list(&resource_list); | |
| 1458 | + | |
| 1459 | + return is_spi_i2c_slave; | |
| 1460 | +} | |
| 1461 | + | |
| 1431 | 1462 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, |
| 1432 | 1463 | int type, unsigned long long sta) |
| 1433 | 1464 | { |
| @@ -1443,6 +1474,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, · 9 unmodified lines | ||
| 1443 | 1474 | acpi_bus_get_flags(device); |
| 1444 | 1475 | device->flags.match_driver = false; |
| 1445 | 1476 | device->flags.initialized = true; |
| 1477 | + device->flags.spi_i2c_slave = acpi_is_spi_i2c_slave(device); | |
| 1446 | 1478 | acpi_device_clear_enumerated(device); |
| 1447 | 1479 | device_initialize(&device->dev); |
| 1448 | 1480 | dev_set_uevent_suppress(&device->dev, true); |
| @@ -1727,38 +1759,13 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, · 278 unmodified lines | ||
| 1727 | 1759 | return AE_OK; |
| 1728 | 1760 | } |
| 1729 | 1761 | |
| 1730 | −static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data) | |
| 1731 | −{ | |
| 1732 | − bool *is_spi_i2c_slave_p = data; | |
| 1733 | − | |
| 1734 | − if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) | |
| 1735 | − return 1; | |
| 1736 | − | |
| 1737 | − /* | |
| 1738 | − * devices that are connected to UART still need to be enumerated to | |
| 1739 | − * platform bus | |
| 1740 | − */ | |
| 1741 | − if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART) | |
| 1742 | − *is_spi_i2c_slave_p = true; | |
| 1743 | − | |
| 1744 | − /* no need to do more checking */ | |
| 1745 | − return -1; | |
| 1746 | −} | |
| 1747 | − | |
| 1748 | 1762 | static void acpi_default_enumeration(struct acpi_device *device) |
| 1749 | 1763 | { |
| 1750 | − struct list_head resource_list; | |
| 1751 | − bool is_spi_i2c_slave = false; | |
| 1752 | − | |
| 1753 | 1764 | /* |
| 1754 | 1765 | * Do not enumerate SPI/I2C slaves as they will be enumerated by their |
| 1755 | 1766 | * respective parents. |
| 1756 | 1767 | */ |
| 1757 | − INIT_LIST_HEAD(&resource_list); | |
| 1758 | − acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave, | |
| 1759 | − &is_spi_i2c_slave); | |
| 1760 | − acpi_dev_free_resource_list(&resource_list); | |
| 1761 | − if (!is_spi_i2c_slave) { | |
| 1768 | + if (!device->flags.spi_i2c_slave) { | |
| 1762 | 1769 | acpi_create_platform_device(device, NULL); |
| 1763 | 1770 | acpi_device_set_enumerated(device); |
| 1764 | 1771 | } else { |
| @@ -1854,7 +1861,7 @@ static void acpi_bus_attach(struct acpi_device *device) · 89 unmodified lines | ||
| 1854 | 1861 | return; |
| 1855 | 1862 | |
| 1856 | 1863 | device->flags.match_driver = true; |
| 1857 | − if (ret > 0) { | |
| 1864 | + if (ret > 0 && !device->flags.spi_i2c_slave) { | |
| 1858 | 1865 | acpi_device_set_enumerated(device); |
| 1859 | 1866 | goto ok; |
| 1860 | 1867 | } |
| @@ -1863,10 +1870,10 @@ static void acpi_bus_attach(struct acpi_device *device) · 2 unmodified lines | ||
| 1863 | 1870 | if (ret < 0) |
| 1864 | 1871 | return; |
| 1865 | 1872 | |
| 1866 | − if (device->pnp.type.platform_id) | |
| 1867 | − acpi_default_enumeration(device); | |
| 1868 | − else | |
| 1873 | + if (!device->pnp.type.platform_id && !device->flags.spi_i2c_slave) | |
| 1869 | 1874 | acpi_device_set_enumerated(device); |
| 1875 | + else | |
| 1876 | + acpi_default_enumeration(device); | |
| 1870 | 1877 | |
| 1871 | 1878 | ok: |
| 1872 | 1879 | list_for_each_entry(child, &device->children, node) |
| @@ -609,8 +609,6 @@ int xen_blkif_schedule(void *arg) · 608 unmodified lines | ||
| 609 | 609 | unsigned long timeout; |
| 610 | 610 | int ret; |
| 611 | 611 | |
| 612 | − xen_blkif_get(blkif); | |
| 613 | − | |
| 614 | 612 | set_freezable(); |
| 615 | 613 | while (!kthread_should_stop()) { |
| 616 | 614 | if (try_to_freeze()) |
| @@ -665,7 +663,6 @@ purge_gnt_list: · 48 unmodified lines | ||
| 665 | 663 | print_stats(ring); |
| 666 | 664 | |
| 667 | 665 | ring->xenblkd = NULL; |
| 668 | − xen_blkif_put(blkif); | |
| 669 | 666 | |
| 670 | 667 | return 0; |
| 671 | 668 | } |
| @@ -1436,34 +1433,35 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring, · 764 unmodified lines | ||
| 1436 | 1433 | static void make_response(struct xen_blkif_ring *ring, u64 id, |
| 1437 | 1434 | unsigned short op, int st) |
| 1438 | 1435 | { |
| 1439 | − struct blkif_response resp; | |
| 1436 | + struct blkif_response *resp; | |
| 1440 | 1437 | unsigned long flags; |
| 1441 | 1438 | union blkif_back_rings *blk_rings; |
| 1442 | 1439 | int notify; |
| 1443 | 1440 | |
| 1444 | − resp.id = id; | |
| 1445 | − resp.operation = op; | |
| 1446 | − resp.status = st; | |
| 1447 | − | |
| 1448 | 1441 | spin_lock_irqsave(&ring->blk_ring_lock, flags); |
| 1449 | 1442 | blk_rings = &ring->blk_rings; |
| 1450 | 1443 | /* Place on the response ring for the relevant domain. */ |
| 1451 | 1444 | switch (ring->blkif->blk_protocol) { |
| 1452 | 1445 | case BLKIF_PROTOCOL_NATIVE: |
| 1453 | − memcpy(RING_GET_RESPONSE(&blk_rings->native, blk_rings->native.rsp_prod_pvt), | |
| 1454 | − &resp, sizeof(resp)); | |
| 1446 | + resp = RING_GET_RESPONSE(&blk_rings->native, | |
| 1447 | + blk_rings->native.rsp_prod_pvt); | |
| 1455 | 1448 | break; |
| 1456 | 1449 | case BLKIF_PROTOCOL_X86_32: |
| 1457 | − memcpy(RING_GET_RESPONSE(&blk_rings->x86_32, blk_rings->x86_32.rsp_prod_pvt), | |
| 1458 | − &resp, sizeof(resp)); | |
| 1450 | + resp = RING_GET_RESPONSE(&blk_rings->x86_32, | |
| 1451 | + blk_rings->x86_32.rsp_prod_pvt); | |
| 1459 | 1452 | break; |
| 1460 | 1453 | case BLKIF_PROTOCOL_X86_64: |
| 1461 | − memcpy(RING_GET_RESPONSE(&blk_rings->x86_64, blk_rings->x86_64.rsp_prod_pvt), | |
| 1462 | − &resp, sizeof(resp)); | |
| 1454 | + resp = RING_GET_RESPONSE(&blk_rings->x86_64, | |
| 1455 | + blk_rings->x86_64.rsp_prod_pvt); | |
| 1463 | 1456 | break; |
| 1464 | 1457 | default: |
| 1465 | 1458 | BUG(); |
| 1466 | 1459 | } |
| 1460 | + | |
| 1461 | + resp->id = id; | |
| 1462 | + resp->operation = op; | |
| 1463 | + resp->status = st; | |
| 1464 | + | |
| 1467 | 1465 | blk_rings->common.rsp_prod_pvt++; |
| 1468 | 1466 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify); |
| 1469 | 1467 | spin_unlock_irqrestore(&ring->blk_ring_lock, flags); |
| @@ -75,9 +75,8 @@ extern unsigned int xenblk_max_queues; · 74 unmodified lines | ||
| 75 | 75 | struct blkif_common_request { |
| 76 | 76 | char dummy; |
| 77 | 77 | }; |
| 78 | −struct blkif_common_response { | |
| 79 | − char dummy; | |
| 80 | −}; | |
| 78 | + | |
| 79 | +/* i386 protocol version */ | |
| 81 | 80 | |
| 82 | 81 | struct blkif_x86_32_request_rw { |
| 83 | 82 | uint8_t nr_segments; /* number of segments */ |
| @@ -129,14 +128,6 @@ struct blkif_x86_32_request { · 45 unmodified lines | ||
| 129 | 128 | } u; |
| 130 | 129 | } __attribute__((__packed__)); |
| 131 | 130 | |
| 132 | −/* i386 protocol version */ | |
| 133 | −#pragma pack(push, 4) | |
| 134 | −struct blkif_x86_32_response { | |
| 135 | − uint64_t id; /* copied from request */ | |
| 136 | − uint8_t operation; /* copied from request */ | |
| 137 | − int16_t status; /* BLKIF_RSP_??? */ | |
| 138 | −}; | |
| 139 | −#pragma pack(pop) | |
| 140 | 131 | /* x86_64 protocol version */ |
| 141 | 132 | |
| 142 | 133 | struct blkif_x86_64_request_rw { |
| @@ -193,18 +184,12 @@ struct blkif_x86_64_request { · 50 unmodified lines | ||
| 193 | 184 | } u; |
| 194 | 185 | } __attribute__((__packed__)); |
| 195 | 186 | |
| 196 | −struct blkif_x86_64_response { | |
| 197 | − uint64_t __attribute__((__aligned__(8))) id; | |
| 198 | − uint8_t operation; /* copied from request */ | |
| 199 | − int16_t status; /* BLKIF_RSP_??? */ | |
| 200 | −}; | |
| 201 | − | |
| 202 | 187 | DEFINE_RING_TYPES(blkif_common, struct blkif_common_request, |
| 203 | − struct blkif_common_response); | |
| 188 | + struct blkif_response); | |
| 204 | 189 | DEFINE_RING_TYPES(blkif_x86_32, struct blkif_x86_32_request, |
| 205 | − struct blkif_x86_32_response); | |
| 190 | + struct blkif_response __packed); | |
| 206 | 191 | DEFINE_RING_TYPES(blkif_x86_64, struct blkif_x86_64_request, |
| 207 | − struct blkif_x86_64_response); | |
| 192 | + struct blkif_response); | |
| 208 | 193 | |
| 209 | 194 | union blkif_back_rings { |
| 210 | 195 | struct blkif_back_ring native; |
| @@ -281,6 +266,7 @@ struct xen_blkif_ring { · 70 unmodified lines | ||
| 281 | 266 | |
| 282 | 267 | wait_queue_head_t wq; |
| 283 | 268 | atomic_t inflight; |
| 269 | + bool active; | |
| 284 | 270 | /* One thread per blkif ring. */ |
| 285 | 271 | struct task_struct *xenblkd; |
| 286 | 272 | unsigned int waiting_reqs; |
| @@ -159,7 +159,7 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif) · 158 unmodified lines | ||
| 159 | 159 | init_waitqueue_head(&ring->shutdown_wq); |
| 160 | 160 | ring->blkif = blkif; |
| 161 | 161 | ring->st_print = jiffies; |
| 162 | − xen_blkif_get(blkif); | |
| 162 | + ring->active = true; | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return 0; |
| @@ -249,10 +249,12 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) · 83 unmodified lines | ||
| 249 | 249 | struct xen_blkif_ring *ring = &blkif->rings[r]; |
| 250 | 250 | unsigned int i = 0; |
| 251 | 251 | |
| 252 | + if (!ring->active) | |
| 253 | + continue; | |
| 254 | + | |
| 252 | 255 | if (ring->xenblkd) { |
| 253 | 256 | kthread_stop(ring->xenblkd); |
| 254 | 257 | wake_up(&ring->shutdown_wq); |
| 255 | − ring->xenblkd = NULL; | |
| 256 | 258 | } |
| 257 | 259 | |
| 258 | 260 | /* The above kthread_stop() guarantees that at this point we |
| @@ -296,7 +298,7 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) · 37 unmodified lines | ||
| 296 | 298 | BUG_ON(ring->free_pages_num != 0); |
| 297 | 299 | BUG_ON(ring->persistent_gnt_c != 0); |
| 298 | 300 | WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages)); |
| 299 | − xen_blkif_put(blkif); | |
| 301 | + ring->active = false; | |
| 300 | 302 | } |
| 301 | 303 | blkif->nr_ring_pages = 0; |
| 302 | 304 | /* |
| @@ -312,9 +314,10 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) · 9 unmodified lines | ||
| 312 | 314 | |
| 313 | 315 | static void xen_blkif_free(struct xen_blkif *blkif) |
| 314 | 316 | { |
| 315 | − | |
| 316 | − xen_blkif_disconnect(blkif); | |
| 317 | + WARN_ON(xen_blkif_disconnect(blkif)); | |
| 317 | 318 | xen_vbd_free(&blkif->vbd); |
| 319 | + kfree(blkif->be->mode); | |
| 320 | + kfree(blkif->be); | |
| 318 | 321 | |
| 319 | 322 | /* Make sure everything is drained before shutting down */ |
| 320 | 323 | kmem_cache_free(xen_blkif_cachep, blkif); |
| @@ -511,8 +514,6 @@ static int xen_blkbk_remove(struct xenbus_device *dev) · 190 unmodified lines | ||
| 511 | 514 | xen_blkif_put(be->blkif); |
| 512 | 515 | } |
| 513 | 516 | |
| 514 | − kfree(be->mode); | |
| 515 | − kfree(be); | |
| 516 | 517 | return 0; |
| 517 | 518 | } |
| 518 | 519 | |
| @@ -803,13 +803,13 @@ static int crng_fast_load(const char *cp, size_t len) · 802 unmodified lines | ||
| 803 | 803 | p[crng_init_cnt % CHACHA20_KEY_SIZE] ^= *cp; |
| 804 | 804 | cp++; crng_init_cnt++; len--; |
| 805 | 805 | } |
| 806 | + spin_unlock_irqrestore(&primary_crng.lock, flags); | |
| 806 | 807 | if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) { |
| 807 | 808 | invalidate_batched_entropy(); |
| 808 | 809 | crng_init = 1; |
| 809 | 810 | wake_up_interruptible(&crng_init_wait); |
| 810 | 811 | pr_notice("random: fast init done\n"); |
| 811 | 812 | } |
| 812 | − spin_unlock_irqrestore(&primary_crng.lock, flags); | |
| 813 | 813 | return 1; |
| 814 | 814 | } |
| 815 | 815 | |
| @@ -841,6 +841,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) · 25 unmodified lines | ||
| 841 | 841 | } |
| 842 | 842 | memzero_explicit(&buf, sizeof(buf)); |
| 843 | 843 | crng->init_time = jiffies; |
| 844 | + spin_unlock_irqrestore(&primary_crng.lock, flags); | |
| 844 | 845 | if (crng == &primary_crng && crng_init < 2) { |
| 845 | 846 | invalidate_batched_entropy(); |
| 846 | 847 | crng_init = 2; |
| @@ -848,7 +849,6 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) · 1 unmodified line | ||
| 848 | 849 | wake_up_interruptible(&crng_init_wait); |
| 849 | 850 | pr_notice("random: crng init done\n"); |
| 850 | 851 | } |
| 851 | − spin_unlock_irqrestore(&primary_crng.lock, flags); | |
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | static inline void crng_wait_ready(void) |
| @@ -2041,8 +2041,8 @@ static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64); · 1186 unmodified lines | ||
| 2041 | 2041 | u64 get_random_u64(void) |
| 2042 | 2042 | { |
| 2043 | 2043 | u64 ret; |
| 2044 | − bool use_lock = crng_init < 2; | |
| 2045 | − unsigned long flags; | |
| 2044 | + bool use_lock = READ_ONCE(crng_init) < 2; | |
| 2045 | + unsigned long flags = 0; | |
| 2046 | 2046 | struct batched_entropy *batch; |
| 2047 | 2047 | |
| 2048 | 2048 | #if BITS_PER_LONG == 64 |
| @@ -2073,8 +2073,8 @@ static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32); · 24 unmodified lines | ||
| 2073 | 2073 | u32 get_random_u32(void) |
| 2074 | 2074 | { |
| 2075 | 2075 | u32 ret; |
| 2076 | − bool use_lock = crng_init < 2; | |
| 2077 | − unsigned long flags; | |
| 2076 | + bool use_lock = READ_ONCE(crng_init) < 2; | |
| 2077 | + unsigned long flags = 0; | |
| 2078 | 2078 | struct batched_entropy *batch; |
| 2079 | 2079 | |
| 2080 | 2080 | if (arch_get_random_int(&ret)) |
| @@ -14,6 +14,7 @@ config COMMON_CLK_MESON8B · 13 unmodified lines | ||
| 14 | 14 | config COMMON_CLK_GXBB |
| 15 | 15 | bool |
| 16 | 16 | depends on COMMON_CLK_AMLOGIC |
| 17 | + select RESET_CONTROLLER | |
| 17 | 18 | help |
| 18 | 19 | Support for the clock controller on AmLogic S905 devices, aka gxbb. |
| 19 | 20 | Say Y if you want peripherals and CPU frequency scaling to work. |
| @@ -156,6 +156,7 @@ config SUN8I_R_CCU · 155 unmodified lines | ||
| 156 | 156 | bool "Support for Allwinner SoCs' PRCM CCUs" |
| 157 | 157 | select SUNXI_CCU_DIV |
| 158 | 158 | select SUNXI_CCU_GATE |
| 159 | + select SUNXI_CCU_MP | |
| 159 | 160 | default MACH_SUN8I || (ARCH_SUNXI && ARM64) |
| 160 | 161 | |
| 161 | 162 | endif |
| @@ -31,7 +31,9 @@ · 30 unmodified lines | ||
| 31 | 31 | #define CLK_PLL_VIDEO0_2X 8 |
| 32 | 32 | #define CLK_PLL_VE 9 |
| 33 | 33 | #define CLK_PLL_DDR0 10 |
| 34 | −#define CLK_PLL_PERIPH0 11 | |
| 34 | + | |
| 35 | +/* PLL_PERIPH0 exported for PRCM */ | |
| 36 | + | |
| 35 | 37 | #define CLK_PLL_PERIPH0_2X 12 |
| 36 | 38 | #define CLK_PLL_PERIPH1 13 |
| 37 | 39 | #define CLK_PLL_PERIPH1_2X 14 |
| @@ -243,7 +243,7 @@ static SUNXI_CCU_GATE(ahb_ss_clk, "ahb-ss", "ahb", · 242 unmodified lines | ||
| 243 | 243 | static SUNXI_CCU_GATE(ahb_dma_clk, "ahb-dma", "ahb", |
| 244 | 244 | 0x060, BIT(6), 0); |
| 245 | 245 | static SUNXI_CCU_GATE(ahb_bist_clk, "ahb-bist", "ahb", |
| 246 | − 0x060, BIT(6), 0); | |
| 246 | + 0x060, BIT(7), 0); | |
| 247 | 247 | static SUNXI_CCU_GATE(ahb_mmc0_clk, "ahb-mmc0", "ahb", |
| 248 | 248 | 0x060, BIT(8), 0); |
| 249 | 249 | static SUNXI_CCU_GATE(ahb_mmc1_clk, "ahb-mmc1", "ahb", |
| @@ -556,7 +556,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(lcd0_ch1_clk, "lcd0-ch1", lcd_ch1_parents, · 555 unmodified lines | ||
| 556 | 556 | 0x12c, 0, 4, 24, 3, BIT(31), |
| 557 | 557 | CLK_SET_RATE_PARENT); |
| 558 | 558 | static SUNXI_CCU_M_WITH_MUX_GATE(lcd1_ch1_clk, "lcd1-ch1", lcd_ch1_parents, |
| 559 | − 0x12c, 0, 4, 24, 3, BIT(31), | |
| 559 | + 0x130, 0, 4, 24, 3, BIT(31), | |
| 560 | 560 | CLK_SET_RATE_PARENT); |
| 561 | 561 | |
| 562 | 562 | static const char * const csi_sclk_parents[] = { "pll-video0", "pll-video1", |
| @@ -29,7 +29,9 @@ · 28 unmodified lines | ||
| 29 | 29 | #define CLK_PLL_VIDEO 6 |
| 30 | 30 | #define CLK_PLL_VE 7 |
| 31 | 31 | #define CLK_PLL_DDR 8 |
| 32 | −#define CLK_PLL_PERIPH0 9 | |
| 32 | + | |
| 33 | +/* PLL_PERIPH0 exported for PRCM */ | |
| 34 | + | |
| 33 | 35 | #define CLK_PLL_PERIPH0_2X 10 |
| 34 | 36 | #define CLK_PLL_GPU 11 |
| 35 | 37 | #define CLK_PLL_PERIPH1 12 |
| @@ -537,7 +537,7 @@ static struct ccu_reset_map sun8i_v3s_ccu_resets[] = { · 536 unmodified lines | ||
| 537 | 537 | [RST_BUS_EMAC] = { 0x2c0, BIT(17) }, |
| 538 | 538 | [RST_BUS_HSTIMER] = { 0x2c0, BIT(19) }, |
| 539 | 539 | [RST_BUS_SPI0] = { 0x2c0, BIT(20) }, |
| 540 | − [RST_BUS_OTG] = { 0x2c0, BIT(23) }, | |
| 540 | + [RST_BUS_OTG] = { 0x2c0, BIT(24) }, | |
| 541 | 541 | [RST_BUS_EHCI0] = { 0x2c0, BIT(26) }, |
| 542 | 542 | [RST_BUS_OHCI0] = { 0x2c0, BIT(29) }, |
| 543 | 543 | |
| @@ -1209,9 +1209,9 @@ arch_timer_mem_frame_get_cntfrq(struct arch_timer_mem_frame *frame) · 1208 unmodified lines | ||
| 1209 | 1209 | return 0; |
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | − rate = readl_relaxed(frame + CNTFRQ); | |
| 1212 | + rate = readl_relaxed(base + CNTFRQ); | |
| 1213 | 1213 | |
| 1214 | − iounmap(frame); | |
| 1214 | + iounmap(base); | |
| 1215 | 1215 | |
| 1216 | 1216 | return rate; |
| 1217 | 1217 | } |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/clk.h> |
| 19 | 19 | #include <linux/interrupt.h> |
| 20 | 20 | #include <linux/clockchips.h> |
| 21 | +#include <linux/clocksource.h> | |
| 21 | 22 | #include <linux/of_address.h> |
| 22 | 23 | #include <linux/of_irq.h> |
| 23 | 24 | #include <linux/slab.h> |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #include <linux/clk.h> |
| 14 | 14 | #include <linux/clockchips.h> |
| 15 | +#include <linux/clocksource.h> | |
| 15 | 16 | #include <linux/delay.h> |
| 16 | 17 | #include <linux/interrupt.h> |
| 17 | 18 | #include <linux/irq.h> |
| @@ -185,8 +185,8 @@ static ssize_t store_down_threshold(struct gov_attr_set *attr_set, · 184 unmodified lines | ||
| 185 | 185 | int ret; |
| 186 | 186 | ret = sscanf(buf, "%u", &input); |
| 187 | 187 | |
| 188 | − /* cannot be lower than 11 otherwise freq will not fall */ | |
| 189 | − if (ret != 1 || input < 11 || input > 100 || | |
| 188 | + /* cannot be lower than 1 otherwise freq will not fall */ | |
| 189 | + if (ret != 1 || input < 1 || input > 100 || | |
| 190 | 190 | input >= dbs_data->up_threshold) |
| 191 | 191 | return -EINVAL; |
| 192 | 192 | |
| @@ -180,8 +180,10 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, · 179 unmodified lines | ||
| 180 | 180 | if (!state_node) |
| 181 | 181 | break; |
| 182 | 182 | |
| 183 | − if (!of_device_is_available(state_node)) | |
| 183 | + if (!of_device_is_available(state_node)) { | |
| 184 | + of_node_put(state_node); | |
| 184 | 185 | continue; |
| 186 | + } | |
| 185 | 187 | |
| 186 | 188 | if (!idle_state_valid(state_node, i, cpumask)) { |
| 187 | 189 | pr_warn("%s idle state not valid, bailing out\n", |
| @@ -267,7 +267,11 @@ static int exynos_nocp_probe(struct platform_device *pdev) · 266 unmodified lines | ||
| 267 | 267 | } |
| 268 | 268 | platform_set_drvdata(pdev, nocp); |
| 269 | 269 | |
| 270 | − clk_prepare_enable(nocp->clk); | |
| 270 | + ret = clk_prepare_enable(nocp->clk); | |
| 271 | + if (ret) { | |
| 272 | + dev_err(&pdev->dev, "failed to prepare ppmu clock\n"); | |
| 273 | + return ret; | |
| 274 | + } | |
| 271 | 275 | |
| 272 | 276 | pr_info("exynos-nocp: new NoC Probe device registered: %s\n", |
| 273 | 277 | dev_name(dev)); |
| @@ -44,7 +44,7 @@ struct exynos_ppmu { · 43 unmodified lines | ||
| 44 | 44 | { "ppmu-event2-"#name, PPMU_PMNCNT2 }, \ |
| 45 | 45 | { "ppmu-event3-"#name, PPMU_PMNCNT3 } |
| 46 | 46 | |
| 47 | −struct __exynos_ppmu_events { | |
| 47 | +static struct __exynos_ppmu_events { | |
| 48 | 48 | char *name; |
| 49 | 49 | int id; |
| 50 | 50 | } ppmu_events[] = { |
| @@ -648,7 +648,11 @@ static int exynos_ppmu_probe(struct platform_device *pdev) · 597 unmodified lines | ||
| 648 | 648 | dev_name(&pdev->dev), desc[i].name); |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | − clk_prepare_enable(info->ppmu.clk); | |
| 651 | + ret = clk_prepare_enable(info->ppmu.clk); | |
| 652 | + if (ret) { | |
| 653 | + dev_err(&pdev->dev, "failed to prepare ppmu clock\n"); | |
| 654 | + return ret; | |
| 655 | + } | |
| 652 | 656 | |
| 653 | 657 | return 0; |
| 654 | 658 | } |
| @@ -47,7 +47,7 @@ DEFINE_DMI_ATTR_WITH_SHOW(product_name, 0444, DMI_PRODUCT_NAME); · 46 unmodified lines | ||
| 47 | 47 | DEFINE_DMI_ATTR_WITH_SHOW(product_version, 0444, DMI_PRODUCT_VERSION); |
| 48 | 48 | DEFINE_DMI_ATTR_WITH_SHOW(product_serial, 0400, DMI_PRODUCT_SERIAL); |
| 49 | 49 | DEFINE_DMI_ATTR_WITH_SHOW(product_uuid, 0400, DMI_PRODUCT_UUID); |
| 50 | −DEFINE_DMI_ATTR_WITH_SHOW(product_family, 0400, DMI_PRODUCT_FAMILY); | |
| 50 | +DEFINE_DMI_ATTR_WITH_SHOW(product_family, 0444, DMI_PRODUCT_FAMILY); | |
| 51 | 51 | DEFINE_DMI_ATTR_WITH_SHOW(board_vendor, 0444, DMI_BOARD_VENDOR); |
| 52 | 52 | DEFINE_DMI_ATTR_WITH_SHOW(board_name, 0444, DMI_BOARD_NAME); |
| 53 | 53 | DEFINE_DMI_ATTR_WITH_SHOW(board_version, 0444, DMI_BOARD_VERSION); |
| @@ -192,7 +192,7 @@ static void __init dmi_id_init_attr_table(void) · 138 unmodified lines | ||
| 192 | 192 | ADD_DMI_ATTR(product_version, DMI_PRODUCT_VERSION); |
| 193 | 193 | ADD_DMI_ATTR(product_serial, DMI_PRODUCT_SERIAL); |
| 194 | 194 | ADD_DMI_ATTR(product_uuid, DMI_PRODUCT_UUID); |
| 195 | − ADD_DMI_ATTR(product_family, DMI_PRODUCT_FAMILY); | |
| 195 | + ADD_DMI_ATTR(product_family, DMI_PRODUCT_FAMILY); | |
| 196 | 196 | ADD_DMI_ATTR(board_vendor, DMI_BOARD_VENDOR); |
| 197 | 197 | ADD_DMI_ATTR(board_name, DMI_BOARD_NAME); |
| 198 | 198 | ADD_DMI_ATTR(board_version, DMI_BOARD_VERSION); |
| @@ -144,7 +144,7 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, · 143 unmodified lines | ||
| 144 | 144 | |
| 145 | 145 | buf = dmi_early_remap(dmi_base, orig_dmi_len); |
| 146 | 146 | if (buf == NULL) |
| 147 | − return -1; | |
| 147 | + return -ENOMEM; | |
| 148 | 148 | |
| 149 | 149 | dmi_decode_table(buf, decode, NULL); |
| 150 | 150 | |
| @@ -178,7 +178,7 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · 27 unmodified lines | ||
| 178 | 178 | const char *d = (const char *) dm; |
| 179 | 179 | const char *p; |
| 180 | 180 | |
| 181 | − if (dmi_ident[slot]) | |
| 181 | + if (dmi_ident[slot] || dm->length <= string) | |
| 182 | 182 | return; |
| 183 | 183 | |
| 184 | 184 | p = dmi_string(dm, d[string]); |
| @@ -191,13 +191,14 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · 6 unmodified lines | ||
| 191 | 191 | static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, |
| 192 | 192 | int index) |
| 193 | 193 | { |
| 194 | − const u8 *d = (u8 *) dm + index; | |
| 194 | + const u8 *d; | |
| 195 | 195 | char *s; |
| 196 | 196 | int is_ff = 1, is_00 = 1, i; |
| 197 | 197 | |
| 198 | − if (dmi_ident[slot]) | |
| 198 | + if (dmi_ident[slot] || dm->length <= index + 16) | |
| 199 | 199 | return; |
| 200 | 200 | |
| 201 | + d = (u8 *) dm + index; | |
| 201 | 202 | for (i = 0; i < 16 && (is_ff || is_00); i++) { |
| 202 | 203 | if (d[i] != 0x00) |
| 203 | 204 | is_00 = 0; |
| @@ -228,16 +229,17 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, · 24 unmodified lines | ||
| 228 | 229 | static void __init dmi_save_type(const struct dmi_header *dm, int slot, |
| 229 | 230 | int index) |
| 230 | 231 | { |
| 231 | − const u8 *d = (u8 *) dm + index; | |
| 232 | + const u8 *d; | |
| 232 | 233 | char *s; |
| 233 | 234 | |
| 234 | − if (dmi_ident[slot]) | |
| 235 | + if (dmi_ident[slot] || dm->length <= index) | |
| 235 | 236 | return; |
| 236 | 237 | |
| 237 | 238 | s = dmi_alloc(4); |
| 238 | 239 | if (!s) |
| 239 | 240 | return; |
| 240 | 241 | |
| 242 | + d = (u8 *) dm + index; | |
| 241 | 243 | sprintf(s, "%u", *d & 0x7F); |
| 242 | 244 | dmi_ident[slot] = s; |
| 243 | 245 | } |
| @@ -278,9 +280,13 @@ static void __init dmi_save_devices(const struct dmi_header *dm) · 34 unmodified lines | ||
| 278 | 280 | |
| 279 | 281 | static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm) |
| 280 | 282 | { |
| 281 | − int i, count = *(u8 *)(dm + 1); | |
| 283 | + int i, count; | |
| 282 | 284 | struct dmi_device *dev; |
| 283 | 285 | |
| 286 | + if (dm->length < 0x05) | |
| 287 | + return; | |
| 288 | + | |
| 289 | + count = *(u8 *)(dm + 1); | |
| 284 | 290 | for (i = 1; i <= count; i++) { |
| 285 | 291 | const char *devname = dmi_string(dm, i); |
| 286 | 292 | |
| @@ -353,6 +359,9 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm) · 66 unmodified lines | ||
| 353 | 359 | const char *name; |
| 354 | 360 | const u8 *d = (u8 *)dm; |
| 355 | 361 | |
| 362 | + if (dm->length < 0x0B) | |
| 363 | + return; | |
| 364 | + | |
| 356 | 365 | /* Skip disabled device */ |
| 357 | 366 | if ((d[0x5] & 0x80) == 0) |
| 358 | 367 | return; |
| @@ -387,7 +396,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) · 28 unmodified lines | ||
| 387 | 396 | const char *d = (const char *)dm; |
| 388 | 397 | static int nr; |
| 389 | 398 | |
| 390 | − if (dm->type != DMI_ENTRY_MEM_DEVICE) | |
| 399 | + if (dm->type != DMI_ENTRY_MEM_DEVICE || dm->length < 0x12) | |
| 391 | 400 | return; |
| 392 | 401 | if (nr >= dmi_memdev_nr) { |
| 393 | 402 | pr_warn(FW_BUG "Too many DIMM entries in SMBIOS table\n"); |
| @@ -649,6 +658,21 @@ void __init dmi_scan_machine(void) · 255 unmodified lines | ||
| 649 | 658 | if (p == NULL) |
| 650 | 659 | goto error; |
| 651 | 660 | |
| 661 | + /* | |
| 662 | + * Same logic as above, look for a 64-bit entry point | |
| 663 | + * first, and if not found, fall back to 32-bit entry point. | |
| 664 | + */ | |
| 665 | + memcpy_fromio(buf, p, 16); | |
| 666 | + for (q = p + 16; q < p + 0x10000; q += 16) { | |
| 667 | + memcpy_fromio(buf + 16, q, 16); | |
| 668 | + if (!dmi_smbios3_present(buf)) { | |
| 669 | + dmi_available = 1; | |
| 670 | + dmi_early_unmap(p, 0x10000); | |
| 671 | + goto out; | |
| 672 | + } | |
| 673 | + memcpy(buf, buf + 16, 16); | |
| 674 | + } | |
| 675 | + | |
| 652 | 676 | /* |
| 653 | 677 | * Iterate over all possible DMI header addresses q. |
| 654 | 678 | * Maintain the 32 bytes around q in buf. On the |
| @@ -659,7 +683,7 @@ void __init dmi_scan_machine(void) · 4 unmodified lines | ||
| 659 | 683 | memset(buf, 0, 16); |
| 660 | 684 | for (q = p; q < p + 0x10000; q += 16) { |
| 661 | 685 | memcpy_fromio(buf + 16, q, 16); |
| 662 | − if (!dmi_smbios3_present(buf) || !dmi_present(buf)) { | |
| 686 | + if (!dmi_present(buf)) { | |
| 663 | 687 | dmi_available = 1; |
| 664 | 688 | dmi_early_unmap(p, 0x10000); |
| 665 | 689 | goto out; |
| @@ -993,7 +1017,8 @@ EXPORT_SYMBOL(dmi_get_date); · 327 unmodified lines | ||
| 993 | 1017 | * @decode: Callback function |
| 994 | 1018 | * @private_data: Private data to be passed to the callback function |
| 995 | 1019 | * |
| 996 | − * Returns -1 when the DMI table can't be reached, 0 on success. | |
| 1020 | + * Returns 0 on success, -ENXIO if DMI is not selected or not present, | |
| 1021 | + * or a different negative error code if DMI walking fails. | |
| 997 | 1022 | */ |
| 998 | 1023 | int dmi_walk(void (*decode)(const struct dmi_header *, void *), |
| 999 | 1024 | void *private_data) |
| @@ -1001,11 +1026,11 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *), · 1 unmodified line | ||
| 1001 | 1026 | u8 *buf; |
| 1002 | 1027 | |
| 1003 | 1028 | if (!dmi_available) |
| 1004 | − return -1; | |
| 1029 | + return -ENXIO; | |
| 1005 | 1030 | |
| 1006 | 1031 | buf = dmi_remap(dmi_base, dmi_len); |
| 1007 | 1032 | if (buf == NULL) |
| 1008 | − return -1; | |
| 1033 | + return -ENOMEM; | |
| 1009 | 1034 | |
| 1010 | 1035 | dmi_decode_table(buf, decode, private_data); |
| 1011 | 1036 | |
| @@ -721,7 +721,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev, · 720 unmodified lines | ||
| 721 | 721 | u32 set; |
| 722 | 722 | |
| 723 | 723 | if (!of_device_is_compatible(mvchip->chip.of_node, |
| 724 | − "marvell,armada-370-xp-gpio")) | |
| 724 | + "marvell,armada-370-gpio")) | |
| 725 | 725 | return 0; |
| 726 | 726 | |
| 727 | 727 | if (IS_ERR(mvchip->clk)) |
| @@ -852,7 +852,7 @@ static const struct of_device_id mvebu_gpio_of_match[] = { · 124 unmodified lines | ||
| 852 | 852 | .data = (void *) MVEBU_GPIO_SOC_VARIANT_ARMADAXP, |
| 853 | 853 | }, |
| 854 | 854 | { |
| 855 | − .compatible = "marvell,armada-370-xp-gpio", | |
| 855 | + .compatible = "marvell,armada-370-gpio", | |
| 856 | 856 | .data = (void *) MVEBU_GPIO_SOC_VARIANT_ORION, |
| 857 | 857 | }, |
| 858 | 858 | { |
| @@ -1128,7 +1128,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) · 269 unmodified lines | ||
| 1128 | 1128 | mvchip); |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | − /* Armada 370/XP has simple PWM support for GPIO lines */ | |
| 1131 | + /* Some MVEBU SoCs have simple PWM support for GPIO lines */ | |
| 1132 | 1132 | if (IS_ENABLED(CONFIG_PWM)) |
| 1133 | 1133 | return mvebu_pwm_probe(pdev, mvchip, id); |
| 1134 | 1134 | |
| @@ -693,6 +693,10 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev) · 692 unmodified lines | ||
| 693 | 693 | DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n", |
| 694 | 694 | adev->clock.default_dispclk / 100); |
| 695 | 695 | adev->clock.default_dispclk = 60000; |
| 696 | + } else if (adev->clock.default_dispclk <= 60000) { | |
| 697 | + DRM_INFO("Changing default dispclk from %dMhz to 625Mhz\n", | |
| 698 | + adev->clock.default_dispclk / 100); | |
| 699 | + adev->clock.default_dispclk = 62500; | |
| 696 | 700 | } |
| 697 | 701 | adev->clock.dp_extclk = |
| 698 | 702 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); |
| @@ -475,6 +475,7 @@ static const struct pci_device_id pciidlist[] = { · 474 unmodified lines | ||
| 475 | 475 | {0x1002, 0x6986, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 476 | 476 | {0x1002, 0x6987, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 477 | 477 | {0x1002, 0x6995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 478 | + {0x1002, 0x6997, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, | |
| 478 | 479 | {0x1002, 0x699F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 479 | 480 | /* Vega 10 */ |
| 480 | 481 | {0x1002, 0x6860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10|AMD_EXP_HW_SUPPORT}, |
| @@ -165,7 +165,7 @@ void amdgpu_atombios_crtc_powergate(struct drm_crtc *crtc, int state) · 164 unmodified lines | ||
| 165 | 165 | struct drm_device *dev = crtc->dev; |
| 166 | 166 | struct amdgpu_device *adev = dev->dev_private; |
| 167 | 167 | int index = GetIndexIntoMasterTable(COMMAND, EnableDispPowerGating); |
| 168 | − ENABLE_DISP_POWER_GATING_PARAMETERS_V2_1 args; | |
| 168 | + ENABLE_DISP_POWER_GATING_PS_ALLOCATION args; | |
| 169 | 169 | |
| 170 | 170 | memset(&args, 0, sizeof(args)); |
| 171 | 171 | |
| @@ -178,7 +178,7 @@ void amdgpu_atombios_crtc_powergate(struct drm_crtc *crtc, int state) · 6 unmodified lines | ||
| 178 | 178 | void amdgpu_atombios_crtc_powergate_init(struct amdgpu_device *adev) |
| 179 | 179 | { |
| 180 | 180 | int index = GetIndexIntoMasterTable(COMMAND, EnableDispPowerGating); |
| 181 | − ENABLE_DISP_POWER_GATING_PARAMETERS_V2_1 args; | |
| 181 | + ENABLE_DISP_POWER_GATING_PS_ALLOCATION args; | |
| 182 | 182 | |
| 183 | 183 | memset(&args, 0, sizeof(args)); |
| 184 | 184 | |
| @@ -1207,8 +1207,11 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev, · 1206 unmodified lines | ||
| 1207 | 1207 | u32 tmp, wm_mask, lb_vblank_lead_lines = 0; |
| 1208 | 1208 | |
| 1209 | 1209 | if (amdgpu_crtc->base.enabled && num_heads && mode) { |
| 1210 | − active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; | |
| 1211 | − line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); | |
| 1210 | + active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000, | |
| 1211 | + (u32)mode->clock); | |
| 1212 | + line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000, | |
| 1213 | + (u32)mode->clock); | |
| 1214 | + line_time = min(line_time, (u32)65535); | |
| 1212 | 1215 | |
| 1213 | 1216 | /* watermark for high clocks */ |
| 1214 | 1217 | if (adev->pm.dpm_enabled) { |
| @@ -1176,8 +1176,11 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev, · 1175 unmodified lines | ||
| 1176 | 1176 | u32 tmp, wm_mask, lb_vblank_lead_lines = 0; |
| 1177 | 1177 | |
| 1178 | 1178 | if (amdgpu_crtc->base.enabled && num_heads && mode) { |
| 1179 | − active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; | |
| 1180 | − line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); | |
| 1179 | + active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000, | |
| 1180 | + (u32)mode->clock); | |
| 1181 | + line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000, | |
| 1182 | + (u32)mode->clock); | |
| 1183 | + line_time = min(line_time, (u32)65535); | |
| 1181 | 1184 | |
| 1182 | 1185 | /* watermark for high clocks */ |
| 1183 | 1186 | if (adev->pm.dpm_enabled) { |
| @@ -991,8 +991,11 @@ static void dce_v6_0_program_watermarks(struct amdgpu_device *adev, · 990 unmodified lines | ||
| 991 | 991 | fixed20_12 a, b, c; |
| 992 | 992 | |
| 993 | 993 | if (amdgpu_crtc->base.enabled && num_heads && mode) { |
| 994 | − active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; | |
| 995 | − line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); | |
| 994 | + active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000, | |
| 995 | + (u32)mode->clock); | |
| 996 | + line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000, | |
| 997 | + (u32)mode->clock); | |
| 998 | + line_time = min(line_time, (u32)65535); | |
| 996 | 999 | priority_a_cnt = 0; |
| 997 | 1000 | priority_b_cnt = 0; |
| 998 | 1001 | |
| @@ -1091,8 +1091,11 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev, · 1090 unmodified lines | ||
| 1091 | 1091 | u32 tmp, wm_mask, lb_vblank_lead_lines = 0; |
| 1092 | 1092 | |
| 1093 | 1093 | if (amdgpu_crtc->base.enabled && num_heads && mode) { |
| 1094 | − active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; | |
| 1095 | − line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); | |
| 1094 | + active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000, | |
| 1095 | + (u32)mode->clock); | |
| 1096 | + line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000, | |
| 1097 | + (u32)mode->clock); | |
| 1098 | + line_time = min(line_time, (u32)65535); | |
| 1096 | 1099 | |
| 1097 | 1100 | /* watermark for high clocks */ |
| 1098 | 1101 | if (adev->pm.dpm_enabled) { |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | config DRM_DW_HDMI |
| 2 | 2 | tristate |
| 3 | 3 | select DRM_KMS_HELPER |
| 4 | + select REGMAP_MMIO | |
| 4 | 5 | |
| 5 | 6 | config DRM_DW_HDMI_AHB_AUDIO |
| 6 | 7 | tristate "Synopsys Designware AHB Audio interface" |
| @@ -1293,21 +1293,6 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 1292 unmodified lines | ||
| 1293 | 1293 | if (!connector) |
| 1294 | 1294 | return -ENOENT; |
| 1295 | 1295 | |
| 1296 | − drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | |
| 1297 | − encoder = drm_connector_get_encoder(connector); | |
| 1298 | − if (encoder) | |
| 1299 | − out_resp->encoder_id = encoder->base.id; | |
| 1300 | − else | |
| 1301 | − out_resp->encoder_id = 0; | |
| 1302 | − | |
| 1303 | − ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic, | |
| 1304 | − (uint32_t __user *)(unsigned long)(out_resp->props_ptr), | |
| 1305 | − (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr), | |
| 1306 | − &out_resp->count_props); | |
| 1307 | − drm_modeset_unlock(&dev->mode_config.connection_mutex); | |
| 1308 | − if (ret) | |
| 1309 | − goto out_unref; | |
| 1310 | − | |
| 1311 | 1296 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) |
| 1312 | 1297 | if (connector->encoder_ids[i] != 0) |
| 1313 | 1298 | encoders_count++; |
| @@ -1320,7 +1305,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 6 unmodified lines | ||
| 1320 | 1305 | if (put_user(connector->encoder_ids[i], |
| 1321 | 1306 | encoder_ptr + copied)) { |
| 1322 | 1307 | ret = -EFAULT; |
| 1323 | − goto out_unref; | |
| 1308 | + goto out; | |
| 1324 | 1309 | } |
| 1325 | 1310 | copied++; |
| 1326 | 1311 | } |
| @@ -1364,15 +1349,32 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 37 unmodified lines | ||
| 1364 | 1349 | if (copy_to_user(mode_ptr + copied, |
| 1365 | 1350 | &u_mode, sizeof(u_mode))) { |
| 1366 | 1351 | ret = -EFAULT; |
| 1352 | + mutex_unlock(&dev->mode_config.mutex); | |
| 1353 | + | |
| 1367 | 1354 | goto out; |
| 1368 | 1355 | } |
| 1369 | 1356 | copied++; |
| 1370 | 1357 | } |
| 1371 | 1358 | } |
| 1372 | 1359 | out_resp->count_modes = mode_count; |
| 1373 | −out: | |
| 1374 | 1360 | mutex_unlock(&dev->mode_config.mutex); |
| 1375 | −out_unref: | |
| 1361 | + | |
| 1362 | + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | |
| 1363 | + encoder = drm_connector_get_encoder(connector); | |
| 1364 | + if (encoder) | |
| 1365 | + out_resp->encoder_id = encoder->base.id; | |
| 1366 | + else | |
| 1367 | + out_resp->encoder_id = 0; | |
| 1368 | + | |
| 1369 | + /* Only grab properties after probing, to make sure EDID and other | |
| 1370 | + * properties reflect the latest status. */ | |
| 1371 | + ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic, | |
| 1372 | + (uint32_t __user *)(unsigned long)(out_resp->props_ptr), | |
| 1373 | + (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr), | |
| 1374 | + &out_resp->count_props); | |
| 1375 | + drm_modeset_unlock(&dev->mode_config.connection_mutex); | |
| 1376 | + | |
| 1377 | +out: | |
| 1376 | 1378 | drm_connector_put(connector); |
| 1377 | 1379 | |
| 1378 | 1380 | return ret; |
| @@ -1173,7 +1173,10 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, · 1172 unmodified lines | ||
| 1173 | 1173 | |
| 1174 | 1174 | |
| 1175 | 1175 | if (IS_G200_SE(mdev)) { |
| 1176 | − if (mdev->unique_rev_id >= 0x02) { | |
| 1176 | + if (mdev->unique_rev_id >= 0x04) { | |
| 1177 | + WREG8(MGAREG_CRTCEXT_INDEX, 0x06); | |
| 1178 | + WREG8(MGAREG_CRTCEXT_DATA, 0); | |
| 1179 | + } else if (mdev->unique_rev_id >= 0x02) { | |
| 1177 | 1180 | u8 hi_pri_lvl; |
| 1178 | 1181 | u32 bpp; |
| 1179 | 1182 | u32 mb; |
| @@ -1639,6 +1642,10 @@ static int mga_vga_mode_valid(struct drm_connector *connector, · 459 unmodified lines | ||
| 1639 | 1642 | if (mga_vga_calculate_mode_bandwidth(mode, bpp) |
| 1640 | 1643 | > (30100 * 1024)) |
| 1641 | 1644 | return MODE_BANDWIDTH; |
| 1645 | + } else { | |
| 1646 | + if (mga_vga_calculate_mode_bandwidth(mode, bpp) | |
| 1647 | + > (55000 * 1024)) | |
| 1648 | + return MODE_BANDWIDTH; | |
| 1642 | 1649 | } |
| 1643 | 1650 | } else if (mdev->type == G200_WB) { |
| 1644 | 1651 | if (mode->hdisplay > 1280) |
| @@ -9268,8 +9268,11 @@ static void dce8_program_watermarks(struct radeon_device *rdev, · 9267 unmodified lines | ||
| 9268 | 9268 | u32 tmp, wm_mask; |
| 9269 | 9269 | |
| 9270 | 9270 | if (radeon_crtc->base.enabled && num_heads && mode) { |
| 9271 | − active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; | |
| 9272 | − line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); | |
| 9271 | + active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000, | |
| 9272 | + (u32)mode->clock); | |
| 9273 | + line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000, | |
| 9274 | + (u32)mode->clock); | |
| 9275 | + line_time = min(line_time, (u32)65535); | |
| 9273 | 9276 | |
| 9274 | 9277 | /* watermark for high clocks */ |
| 9275 | 9278 | if ((rdev->pm.pm_method == PM_METHOD_DPM) && |
| @@ -2163,8 +2163,11 @@ static void evergreen_program_watermarks(struct radeon_device *rdev, · 2162 unmodified lines | ||
| 2163 | 2163 | fixed20_12 a, b, c; |
| 2164 | 2164 | |
| 2165 | 2165 | if (radeon_crtc->base.enabled && num_heads && mode) { |
| 2166 | − active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; | |
| 2167 | − line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); | |
| 2166 | + active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000, | |
| 2167 | + (u32)mode->clock); | |
| 2168 | + line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000, | |
| 2169 | + (u32)mode->clock); | |
| 2170 | + line_time = min(line_time, (u32)65535); | |
| 2168 | 2171 | priority_a_cnt = 0; |
| 2169 | 2172 | priority_b_cnt = 0; |
| 2170 | 2173 | dram_channels = evergreen_get_number_of_dram_channels(rdev); |
| @@ -3393,6 +3393,13 @@ void radeon_combios_asic_init(struct drm_device *dev) · 3392 unmodified lines | ||
| 3393 | 3393 | rdev->pdev->subsystem_vendor == 0x103c && |
| 3394 | 3394 | rdev->pdev->subsystem_device == 0x280a) |
| 3395 | 3395 | return; |
| 3396 | + /* quirk for rs4xx Toshiba Sattellite L20-183 latop to make it resume | |
| 3397 | + * - it hangs on resume inside the dynclk 1 table. | |
| 3398 | + */ | |
| 3399 | + if (rdev->family == CHIP_RS400 && | |
| 3400 | + rdev->pdev->subsystem_vendor == 0x1179 && | |
| 3401 | + rdev->pdev->subsystem_device == 0xff31) | |
| 3402 | + return; | |
| 3396 | 3403 | |
| 3397 | 3404 | /* DYN CLK 1 */ |
| 3398 | 3405 | table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); |
| @@ -136,6 +136,10 @@ static struct radeon_px_quirk radeon_px_quirk_list[] = { · 135 unmodified lines | ||
| 136 | 136 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 |
| 137 | 137 | */ |
| 138 | 138 | { PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, |
| 139 | + /* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU | |
| 140 | + * https://bugs.freedesktop.org/show_bug.cgi?id=101491 | |
| 141 | + */ | |
| 142 | + { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, | |
| 139 | 143 | /* macbook pro 8.2 */ |
| 140 | 144 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, |
| 141 | 145 | { 0, 0, 0, 0, 0 }, |
| @@ -621,7 +621,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, · 620 unmodified lines | ||
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /* TODO: is this still necessary on NI+ ? */ |
| 624 | − if ((cmd == 0 || cmd == 1 || cmd == 0x3) && | |
| 624 | + if ((cmd == 0 || cmd == 0x3) && | |
| 625 | 625 | (start >> 28) != (p->rdev->uvd.gpu_addr >> 28)) { |
| 626 | 626 | DRM_ERROR("msg/fb buffer %LX-%LX out of 256MB segment!\n", |
| 627 | 627 | start, end); |
| @@ -2308,8 +2308,11 @@ static void dce6_program_watermarks(struct radeon_device *rdev, · 2307 unmodified lines | ||
| 2308 | 2308 | fixed20_12 a, b, c; |
| 2309 | 2309 | |
| 2310 | 2310 | if (radeon_crtc->base.enabled && num_heads && mode) { |
| 2311 | − active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; | |
| 2312 | − line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); | |
| 2311 | + active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000, | |
| 2312 | + (u32)mode->clock); | |
| 2313 | + line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000, | |
| 2314 | + (u32)mode->clock); | |
| 2315 | + line_time = min(line_time, (u32)65535); | |
| 2313 | 2316 | priority_a_cnt = 0; |
| 2314 | 2317 | priority_b_cnt = 0; |
| 2315 | 2318 | |
| @@ -562,18 +562,6 @@ fail: · 561 unmodified lines | ||
| 562 | 562 | |
| 563 | 563 | |
| 564 | 564 | #ifdef CONFIG_DRM_TEGRA_STAGING |
| 565 | −static struct tegra_drm_context * | |
| 566 | −tegra_drm_file_get_context(struct tegra_drm_file *file, u32 id) | |
| 567 | −{ | |
| 568 | − struct tegra_drm_context *context; | |
| 569 | − | |
| 570 | − mutex_lock(&file->lock); | |
| 571 | − context = idr_find(&file->contexts, id); | |
| 572 | − mutex_unlock(&file->lock); | |
| 573 | − | |
| 574 | − return context; | |
| 575 | −} | |
| 576 | − | |
| 577 | 565 | static int tegra_gem_create(struct drm_device *drm, void *data, |
| 578 | 566 | struct drm_file *file) |
| 579 | 567 | { |
| @@ -662,7 +650,7 @@ static int tegra_client_open(struct tegra_drm_file *fpriv, · 82 unmodified lines | ||
| 662 | 650 | if (err < 0) |
| 663 | 651 | return err; |
| 664 | 652 | |
| 665 | − err = idr_alloc(&fpriv->contexts, context, 0, 0, GFP_KERNEL); | |
| 653 | + err = idr_alloc(&fpriv->contexts, context, 1, 0, GFP_KERNEL); | |
| 666 | 654 | if (err < 0) { |
| 667 | 655 | client->ops->close_channel(context); |
| 668 | 656 | return err; |
| @@ -717,7 +705,7 @@ static int tegra_close_channel(struct drm_device *drm, void *data, · 48 unmodified lines | ||
| 717 | 705 | |
| 718 | 706 | mutex_lock(&fpriv->lock); |
| 719 | 707 | |
| 720 | − context = tegra_drm_file_get_context(fpriv, args->context); | |
| 708 | + context = idr_find(&fpriv->contexts, args->context); | |
| 721 | 709 | if (!context) { |
| 722 | 710 | err = -EINVAL; |
| 723 | 711 | goto unlock; |
| @@ -742,7 +730,7 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data, · 18 unmodified lines | ||
| 742 | 730 | |
| 743 | 731 | mutex_lock(&fpriv->lock); |
| 744 | 732 | |
| 745 | − context = tegra_drm_file_get_context(fpriv, args->context); | |
| 733 | + context = idr_find(&fpriv->contexts, args->context); | |
| 746 | 734 | if (!context) { |
| 747 | 735 | err = -ENODEV; |
| 748 | 736 | goto unlock; |
| @@ -771,7 +759,7 @@ static int tegra_submit(struct drm_device *drm, void *data, · 22 unmodified lines | ||
| 771 | 759 | |
| 772 | 760 | mutex_lock(&fpriv->lock); |
| 773 | 761 | |
| 774 | − context = tegra_drm_file_get_context(fpriv, args->context); | |
| 762 | + context = idr_find(&fpriv->contexts, args->context); | |
| 775 | 763 | if (!context) { |
| 776 | 764 | err = -ENODEV; |
| 777 | 765 | goto unlock; |
| @@ -796,7 +784,7 @@ static int tegra_get_syncpt_base(struct drm_device *drm, void *data, · 18 unmodified lines | ||
| 796 | 784 | |
| 797 | 785 | mutex_lock(&fpriv->lock); |
| 798 | 786 | |
| 799 | − context = tegra_drm_file_get_context(fpriv, args->context); | |
| 787 | + context = idr_find(&fpriv->contexts, args->context); | |
| 800 | 788 | if (!context) { |
| 801 | 789 | err = -ENODEV; |
| 802 | 790 | goto unlock; |
| @@ -172,7 +172,7 @@ static int host1x_probe(struct platform_device *pdev) · 171 unmodified lines | ||
| 172 | 172 | |
| 173 | 173 | host->rst = devm_reset_control_get(&pdev->dev, "host1x"); |
| 174 | 174 | if (IS_ERR(host->rst)) { |
| 175 | − err = PTR_ERR(host->clk); | |
| 175 | + err = PTR_ERR(host->rst); | |
| 176 | 176 | dev_err(&pdev->dev, "failed to get reset: %d\n", err); |
| 177 | 177 | return err; |
| 178 | 178 | } |
| @@ -826,11 +826,35 @@ static int hid_scan_report(struct hid_device *hid) · 825 unmodified lines | ||
| 826 | 826 | * hid-rmi should take care of them, |
| 827 | 827 | * not hid-generic |
| 828 | 828 | */ |
| 829 | − if (IS_ENABLED(CONFIG_HID_RMI)) | |
| 830 | − hid->group = HID_GROUP_RMI; | |
| 829 | + hid->group = HID_GROUP_RMI; | |
| 831 | 830 | break; |
| 832 | 831 | } |
| 833 | 832 | |
| 833 | + /* fall back to generic driver in case specific driver doesn't exist */ | |
| 834 | + switch (hid->group) { | |
| 835 | + case HID_GROUP_MULTITOUCH_WIN_8: | |
| 836 | + /* fall-through */ | |
| 837 | + case HID_GROUP_MULTITOUCH: | |
| 838 | + if (!IS_ENABLED(CONFIG_HID_MULTITOUCH)) | |
| 839 | + hid->group = HID_GROUP_GENERIC; | |
| 840 | + break; | |
| 841 | + case HID_GROUP_SENSOR_HUB: | |
| 842 | + if (!IS_ENABLED(CONFIG_HID_SENSOR_HUB)) | |
| 843 | + hid->group = HID_GROUP_GENERIC; | |
| 844 | + break; | |
| 845 | + case HID_GROUP_RMI: | |
| 846 | + if (!IS_ENABLED(CONFIG_HID_RMI)) | |
| 847 | + hid->group = HID_GROUP_GENERIC; | |
| 848 | + break; | |
| 849 | + case HID_GROUP_WACOM: | |
| 850 | + if (!IS_ENABLED(CONFIG_HID_WACOM)) | |
| 851 | + hid->group = HID_GROUP_GENERIC; | |
| 852 | + break; | |
| 853 | + case HID_GROUP_LOGITECH_DJ_DEVICE: | |
| 854 | + if (!IS_ENABLED(CONFIG_HID_LOGITECH_DJ)) | |
| 855 | + hid->group = HID_GROUP_GENERIC; | |
| 856 | + break; | |
| 857 | + } | |
| 834 | 858 | vfree(parser); |
| 835 | 859 | return 0; |
| 836 | 860 | } |
| @@ -1763,15 +1787,23 @@ EXPORT_SYMBOL_GPL(hid_disconnect); · 926 unmodified lines | ||
| 1763 | 1787 | * used as a driver. See hid_scan_report(). |
| 1764 | 1788 | */ |
| 1765 | 1789 | static const struct hid_device_id hid_have_special_driver[] = { |
| 1790 | +#if IS_ENABLED(CONFIG_HID_A4TECH) | |
| 1766 | 1791 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, |
| 1767 | 1792 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, |
| 1768 | 1793 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, |
| 1794 | +#endif | |
| 1795 | +#if IS_ENABLED(CONFIG_HID_ACCUTOUCH) | |
| 1796 | + { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) }, | |
| 1797 | +#endif | |
| 1798 | +#if IS_ENABLED(CONFIG_HID_ACRUX) | |
| 1769 | 1799 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, |
| 1770 | 1800 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) }, |
| 1801 | +#endif | |
| 1802 | +#if IS_ENABLED(CONFIG_HID_ALPS) | |
| 1771 | 1803 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) }, |
| 1804 | +#endif | |
| 1805 | +#if IS_ENABLED(CONFIG_HID_APPLE) | |
| 1772 | 1806 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, |
| 1773 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | |
| 1774 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, | |
| 1775 | 1807 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, |
| 1776 | 1808 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, |
| 1777 | 1809 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, |
| @@ -1792,11 +1824,6 @@ static const struct hid_device_id hid_have_special_driver[] = { · 14 unmodified lines | ||
| 1792 | 1824 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, |
| 1793 | 1825 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, |
| 1794 | 1826 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, |
| 1795 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, | |
| 1796 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, | |
| 1797 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, | |
| 1798 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | |
| 1799 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, | |
| 1800 | 1827 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, |
| 1801 | 1828 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, |
| 1802 | 1829 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, |
| @@ -1851,62 +1878,100 @@ static const struct hid_device_id hid_have_special_driver[] = { · 48 unmodified lines | ||
| 1851 | 1878 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) }, |
| 1852 | 1879 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
| 1853 | 1880 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
| 1881 | +#endif | |
| 1882 | +#if IS_ENABLED(CONFIG_HID_APPLEIR) | |
| 1883 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, | |
| 1884 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, | |
| 1885 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, | |
| 1886 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | |
| 1887 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, | |
| 1888 | +#endif | |
| 1889 | +#if IS_ENABLED(CONFIG_HID_ASUS) | |
| 1854 | 1890 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD) }, |
| 1855 | 1891 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD) }, |
| 1856 | 1892 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, |
| 1857 | 1893 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) }, |
| 1858 | 1894 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD) }, |
| 1895 | +#endif | |
| 1896 | +#if IS_ENABLED(CONFIG_HID_AUREAL) | |
| 1859 | 1897 | { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, |
| 1898 | +#endif | |
| 1899 | +#if IS_ENABLED(CONFIG_HID_BELKIN) | |
| 1860 | 1900 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, |
| 1901 | + { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | |
| 1902 | +#endif | |
| 1903 | +#if IS_ENABLED(CONFIG_HID_BETOP_FF) | |
| 1861 | 1904 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, |
| 1862 | 1905 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) }, |
| 1863 | 1906 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) }, |
| 1864 | 1907 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) }, |
| 1865 | − { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, | |
| 1866 | − { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, | |
| 1908 | +#endif | |
| 1909 | +#if IS_ENABLED(CONFIG_HID_CHERRY) | |
| 1867 | 1910 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, |
| 1868 | 1911 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, |
| 1912 | +#endif | |
| 1913 | +#if IS_ENABLED(CONFIG_HID_CHICONY) | |
| 1869 | 1914 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
| 1870 | − { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, | |
| 1871 | 1915 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
| 1872 | 1916 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, |
| 1873 | 1917 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, |
| 1918 | + { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) }, | |
| 1919 | +#endif | |
| 1920 | +#if IS_ENABLED(CONFIG_HID_CMEDIA) | |
| 1921 | + { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM6533) }, | |
| 1922 | +#endif | |
| 1923 | +#if IS_ENABLED(CONFIG_HID_CORSAIR) | |
| 1874 | 1924 | { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) }, |
| 1875 | 1925 | { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) }, |
| 1876 | − { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | |
| 1926 | +#endif | |
| 1927 | +#if IS_ENABLED(CONFIG_HID_CP2112) | |
| 1877 | 1928 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, |
| 1929 | +#endif | |
| 1930 | +#if IS_ENABLED(CONFIG_HID_CYPRESS) | |
| 1878 | 1931 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
| 1879 | 1932 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, |
| 1880 | 1933 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, |
| 1881 | 1934 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) }, |
| 1882 | 1935 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, |
| 1883 | − { HID_USB_DEVICE(USB_VENDOR_ID_DELCOM, USB_DEVICE_ID_DELCOM_VISUAL_IND) }, | |
| 1936 | +#endif | |
| 1937 | +#if IS_ENABLED(CONFIG_HID_DRAGONRISE) | |
| 1884 | 1938 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, |
| 1885 | 1939 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, |
| 1886 | −#if IS_ENABLED(CONFIG_HID_MAYFLASH) | |
| 1887 | − { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) }, | |
| 1888 | − { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) }, | |
| 1889 | − { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) }, | |
| 1890 | − { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) }, | |
| 1891 | 1940 | #endif |
| 1892 | − { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) }, | |
| 1893 | − { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) }, | |
| 1941 | +#if IS_ENABLED(CONFIG_HID_ELECOM) | |
| 1894 | 1942 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, |
| 1895 | 1943 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRED) }, |
| 1896 | 1944 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRELESS) }, |
| 1945 | +#endif | |
| 1946 | +#if IS_ENABLED(CONFIG_HID_ELO) | |
| 1897 | 1947 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) }, |
| 1898 | 1948 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) }, |
| 1899 | − { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) }, | |
| 1949 | +#endif | |
| 1950 | +#if IS_ENABLED(CONFIG_HID_EMS_FF) | |
| 1900 | 1951 | { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, |
| 1952 | +#endif | |
| 1953 | +#if IS_ENABLED(CONFIG_HID_EZKEY) | |
| 1901 | 1954 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, |
| 1902 | − { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, | |
| 1903 | − { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, | |
| 1955 | +#endif | |
| 1956 | +#if IS_ENABLED(CONFIG_HID_GEMBIRD) | |
| 1904 | 1957 | { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) }, |
| 1905 | − { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, | |
| 1958 | +#endif | |
| 1959 | +#if IS_ENABLED(CONFIG_HID_GFRM) | |
| 1960 | + { HID_BLUETOOTH_DEVICE(0x58, 0x2000) }, | |
| 1961 | + { HID_BLUETOOTH_DEVICE(0x471, 0x2210) }, | |
| 1962 | +#endif | |
| 1963 | +#if IS_ENABLED(CONFIG_HID_GREENASIA) | |
| 1906 | 1964 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, |
| 1965 | +#endif | |
| 1966 | +#if IS_ENABLED(CONFIG_HID_GT683R) | |
| 1967 | + { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, | |
| 1968 | +#endif | |
| 1969 | +#if IS_ENABLED(CONFIG_HID_GYRATION) | |
| 1907 | 1970 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, |
| 1908 | 1971 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, |
| 1909 | 1972 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, |
| 1973 | +#endif | |
| 1974 | +#if IS_ENABLED(CONFIG_HID_HOLTEK) | |
| 1910 | 1975 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, |
| 1911 | 1976 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, |
| 1912 | 1977 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, |
| @@ -1915,12 +1980,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 2 unmodified lines | ||
| 1915 | 1980 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) }, |
| 1916 | 1981 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, |
| 1917 | 1982 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) }, |
| 1918 | − { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, | |
| 1919 | − { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) }, | |
| 1920 | − { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, | |
| 1983 | +#endif | |
| 1984 | +#if IS_ENABLED(CONFIG_HID_ICADE) | |
| 1921 | 1985 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, |
| 1986 | +#endif | |
| 1987 | +#if IS_ENABLED(CONFIG_HID_KENSINGTON) | |
| 1922 | 1988 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, |
| 1989 | +#endif | |
| 1990 | +#if IS_ENABLED(CONFIG_HID_KEYTOUCH) | |
| 1923 | 1991 | { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, |
| 1992 | +#endif | |
| 1993 | +#if IS_ENABLED(CONFIG_HID_KYE) | |
| 1924 | 1994 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, |
| 1925 | 1995 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) }, |
| 1926 | 1996 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, |
| @@ -1930,21 +2000,29 @@ static const struct hid_device_id hid_have_special_driver[] = { · 3 unmodified lines | ||
| 1930 | 2000 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2) }, |
| 1931 | 2001 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
| 1932 | 2002 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912) }, |
| 1933 | − { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | |
| 2003 | +#endif | |
| 2004 | +#if IS_ENABLED(CONFIG_HID_LCPOWER) | |
| 1934 | 2005 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, |
| 2006 | +#endif | |
| 2007 | +#if IS_ENABLED(CONFIG_HID_LED) | |
| 2008 | + { HID_USB_DEVICE(USB_VENDOR_ID_DELCOM, USB_DEVICE_ID_DELCOM_VISUAL_IND) }, | |
| 2009 | + { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) }, | |
| 2010 | + { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) }, | |
| 2011 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) }, | |
| 2012 | + { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) }, | |
| 2013 | + { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, | |
| 2014 | +#endif | |
| 1935 | 2015 | #if IS_ENABLED(CONFIG_HID_LENOVO) |
| 1936 | 2016 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, |
| 1937 | 2017 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, |
| 1938 | 2018 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, |
| 1939 | 2019 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, |
| 1940 | 2020 | #endif |
| 1941 | − { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) }, | |
| 2021 | +#if IS_ENABLED(CONFIG_HID_LOGITECH) | |
| 1942 | 2022 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, |
| 1943 | 2023 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, |
| 1944 | 2024 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, |
| 1945 | 2025 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, |
| 1946 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, | |
| 1947 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) }, | |
| 1948 | 2026 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, |
| 1949 | 2027 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, |
| 1950 | 2028 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, |
| @@ -1957,7 +2035,6 @@ static const struct hid_device_id hid_have_special_driver[] = { · 6 unmodified lines | ||
| 1957 | 2035 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, |
| 1958 | 2036 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, |
| 1959 | 2037 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL) }, |
| 1960 | − { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) }, | |
| 1961 | 2038 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, |
| 1962 | 2039 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, |
| 1963 | 2040 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, |
| @@ -1969,17 +2046,30 @@ static const struct hid_device_id hid_have_special_driver[] = { · 5 unmodified lines | ||
| 1969 | 2046 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, |
| 1970 | 2047 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, |
| 1971 | 2048 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) }, |
| 1972 | −#if IS_ENABLED(CONFIG_HID_LOGITECH_DJ) | |
| 1973 | − { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, | |
| 1974 | − { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, | |
| 1975 | −#endif | |
| 1976 | 2049 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, |
| 1977 | 2050 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, |
| 1978 | 2051 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, |
| 1979 | 2052 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, |
| 1980 | − { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, | |
| 1981 | − { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, | |
| 1982 | − { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) }, | |
| 2053 | +#endif | |
| 2054 | +#if IS_ENABLED(CONFIG_HID_LOGITECH_HIDPP) | |
| 2055 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) }, | |
| 2056 | + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) }, | |
| 2057 | +#endif | |
| 2058 | +#if IS_ENABLED(CONFIG_HID_LOGITECH_DJ) | |
| 2059 | + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, | |
| 2060 | + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, | |
| 2061 | +#endif | |
| 2062 | +#if IS_ENABLED(CONFIG_HID_MAGICMOUSE) | |
| 2063 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | |
| 2064 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, | |
| 2065 | +#endif | |
| 2066 | +#if IS_ENABLED(CONFIG_HID_MAYFLASH) | |
| 2067 | + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) }, | |
| 2068 | + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) }, | |
| 2069 | + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) }, | |
| 2070 | + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) }, | |
| 2071 | +#endif | |
| 2072 | +#if IS_ENABLED(CONFIG_HID_MICROSOFT) | |
| 1983 | 2073 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, |
| 1984 | 2074 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_KEYBOARD) }, |
| 1985 | 2075 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, |
| @@ -1995,9 +2085,22 @@ static const struct hid_device_id hid_have_special_driver[] = { · 9 unmodified lines | ||
| 1995 | 2085 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_600) }, |
| 1996 | 2086 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1) }, |
| 1997 | 2087 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) }, |
| 2088 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | |
| 2089 | +#endif | |
| 2090 | +#if IS_ENABLED(CONFIG_HID_MONTEREY) | |
| 1998 | 2091 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, |
| 1999 | − { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, | |
| 2092 | +#endif | |
| 2093 | +#if IS_ENABLED(CONFIG_HID_MULTITOUCH) | |
| 2094 | + { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) }, | |
| 2095 | +#endif | |
| 2096 | +#if IS_ENABLED(CONFIG_HID_WIIMOTE) | |
| 2097 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, | |
| 2098 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, | |
| 2099 | +#endif | |
| 2100 | +#if IS_ENABLED(CONFIG_HID_NTI) | |
| 2000 | 2101 | { HID_USB_DEVICE(USB_VENDOR_ID_NTI, USB_DEVICE_ID_USB_SUN) }, |
| 2102 | +#endif | |
| 2103 | +#if IS_ENABLED(CONFIG_HID_NTRIG) | |
| 2001 | 2104 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, |
| 2002 | 2105 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, |
| 2003 | 2106 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) }, |
| @@ -2017,13 +2120,41 @@ static const struct hid_device_id hid_have_special_driver[] = { · 13 unmodified lines | ||
| 2017 | 2120 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) }, |
| 2018 | 2121 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) }, |
| 2019 | 2122 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, |
| 2123 | +#endif | |
| 2124 | +#if IS_ENABLED(CONFIG_HID_ORTEK) | |
| 2020 | 2125 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, |
| 2021 | 2126 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, |
| 2127 | + { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, | |
| 2128 | +#endif | |
| 2129 | +#if IS_ENABLED(CONFIG_HID_PANTHERLORD) | |
| 2130 | + { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, | |
| 2131 | + { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, | |
| 2132 | + { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, | |
| 2133 | + { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, | |
| 2134 | +#endif | |
| 2135 | +#if IS_ENABLED(CONFIG_HID_PENMOUNT) | |
| 2022 | 2136 | { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, |
| 2137 | +#endif | |
| 2138 | +#if IS_ENABLED(CONFIG_HID_PETALYNX) | |
| 2023 | 2139 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, |
| 2140 | +#endif | |
| 2141 | +#if IS_ENABLED(CONFIG_HID_PICOLCD) | |
| 2142 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, | |
| 2143 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, | |
| 2144 | +#endif | |
| 2145 | +#if IS_ENABLED(CONFIG_HID_PLANTRONICS) | |
| 2024 | 2146 | { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, |
| 2147 | +#endif | |
| 2148 | +#if IS_ENABLED(CONFIG_HID_PRIMAX) | |
| 2025 | 2149 | { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, |
| 2026 | − { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) }, | |
| 2150 | +#endif | |
| 2151 | +#if IS_ENABLED(CONFIG_HID_PRODIKEYS) | |
| 2152 | + { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | |
| 2153 | +#endif | |
| 2154 | +#if IS_ENABLED(CONFIG_HID_RMI) | |
| 2155 | + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) }, | |
| 2156 | + { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) }, | |
| 2157 | +#endif | |
| 2027 | 2158 | #if IS_ENABLED(CONFIG_HID_ROCCAT) |
| 2028 | 2159 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, |
| 2029 | 2160 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, |
| @@ -2051,9 +2182,21 @@ static const struct hid_device_id hid_have_special_driver[] = { · 21 unmodified lines | ||
| 2051 | 2182 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5) }, |
| 2052 | 2183 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, |
| 2053 | 2184 | #endif |
| 2185 | +#if IS_ENABLED(CONFIG_HID_SAMSUNG) | |
| 2054 | 2186 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
| 2055 | 2187 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, |
| 2056 | − { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, | |
| 2188 | +#endif | |
| 2189 | +#if IS_ENABLED(CONFIG_HID_SMARTJOYPLUS) | |
| 2190 | + { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) }, | |
| 2191 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, | |
| 2192 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, | |
| 2193 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, | |
| 2194 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, | |
| 2195 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, | |
| 2196 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, | |
| 2197 | +#endif | |
| 2198 | +#if IS_ENABLED(CONFIG_HID_SONY) | |
| 2199 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, | |
| 2057 | 2200 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) }, |
| 2058 | 2201 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) }, |
| 2059 | 2202 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) }, |
| @@ -2072,9 +2215,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 12 unmodified lines | ||
| 2072 | 2215 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
| 2073 | 2216 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) }, |
| 2074 | 2217 | { HID_USB_DEVICE(USB_VENDOR_ID_SINO_LITE, USB_DEVICE_ID_SINO_LITE_CONTROLLER) }, |
| 2218 | +#endif | |
| 2219 | +#if IS_ENABLED(CONFIG_HID_SPEEDLINK) | |
| 2220 | + { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, | |
| 2221 | +#endif | |
| 2222 | +#if IS_ENABLED(CONFIG_HID_STEELSERIES) | |
| 2075 | 2223 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, |
| 2224 | +#endif | |
| 2225 | +#if IS_ENABLED(CONFIG_HID_SUNPLUS) | |
| 2076 | 2226 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
| 2077 | − { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, | |
| 2227 | +#endif | |
| 2228 | +#if IS_ENABLED(CONFIG_HID_THRUSTMASTER) | |
| 2078 | 2229 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, |
| 2079 | 2230 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, |
| 2080 | 2231 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) }, |
| @@ -2083,12 +2234,25 @@ static const struct hid_device_id hid_have_special_driver[] = { · 2 unmodified lines | ||
| 2083 | 2234 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, |
| 2084 | 2235 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, |
| 2085 | 2236 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, |
| 2237 | +#endif | |
| 2238 | +#if IS_ENABLED(CONFIG_HID_TIVO) | |
| 2086 | 2239 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
| 2087 | 2240 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
| 2088 | 2241 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, |
| 2242 | +#endif | |
| 2243 | +#if IS_ENABLED(CONFIG_HID_TOPSEED) | |
| 2244 | + { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, | |
| 2245 | + { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, | |
| 2246 | + { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, | |
| 2089 | 2247 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
| 2090 | 2248 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
| 2249 | +#endif | |
| 2250 | +#if IS_ENABLED(CONFIG_HID_TWINHAN) | |
| 2091 | 2251 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, |
| 2252 | +#endif | |
| 2253 | +#if IS_ENABLED(CONFIG_HID_UCLOGIC) | |
| 2254 | + { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, | |
| 2255 | + { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_HUION_TABLET) }, | |
| 2092 | 2256 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, |
| 2093 | 2257 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, |
| 2094 | 2258 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, |
| @@ -2096,20 +2260,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1 unmodified line | ||
| 2096 | 2260 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) }, |
| 2097 | 2261 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) }, |
| 2098 | 2262 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) }, |
| 2099 | − { HID_USB_DEVICE(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW) }, | |
| 2100 | 2263 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_YIYNOVA_TABLET) }, |
| 2101 | 2264 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UGEE_TABLET_81) }, |
| 2102 | 2265 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UGEE_TABLET_45) }, |
| 2103 | 2266 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_DRAWIMAGE_G3) }, |
| 2104 | − { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610) }, | |
| 2105 | 2267 | { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_TABLET_EX07S) }, |
| 2106 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, | |
| 2107 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, | |
| 2108 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, | |
| 2109 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, | |
| 2110 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, | |
| 2111 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, | |
| 2112 | − { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) }, | |
| 2268 | + { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610) }, | |
| 2269 | +#endif | |
| 2270 | +#if IS_ENABLED(CONFIG_HID_UDRAW_PS3) | |
| 2271 | + { HID_USB_DEVICE(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW) }, | |
| 2272 | +#endif | |
| 2273 | +#if IS_ENABLED(CONFIG_HID_WALTOP) | |
| 2113 | 2274 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, |
| 2114 | 2275 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, |
| 2115 | 2276 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, |
| @@ -2117,19 +2278,18 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1 unmodified line | ||
| 2117 | 2278 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, |
| 2118 | 2279 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, |
| 2119 | 2280 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) }, |
| 2120 | − { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, | |
| 2281 | +#endif | |
| 2282 | +#if IS_ENABLED(CONFIG_HID_XINMO) | |
| 2121 | 2283 | { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) }, |
| 2122 | 2284 | { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_THT_2P_ARCADE) }, |
| 2285 | +#endif | |
| 2286 | +#if IS_ENABLED(CONFIG_HID_ZEROPLUS) | |
| 2123 | 2287 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, |
| 2124 | 2288 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, |
| 2289 | +#endif | |
| 2290 | +#if IS_ENABLED(CONFIG_HID_ZYDACRON) | |
| 2125 | 2291 | { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, |
| 2126 | − | |
| 2127 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | |
| 2128 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, | |
| 2129 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, | |
| 2130 | − { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) }, | |
| 2131 | − { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM6533) }, | |
| 2132 | − { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) }, | |
| 2292 | +#endif | |
| 2133 | 2293 | { } |
| 2134 | 2294 | }; |
| 2135 | 2295 | |
| @@ -319,6 +319,9 @@ · 318 unmodified lines | ||
| 319 | 319 | #define USB_VENDOR_ID_DELCOM 0x0fc5 |
| 320 | 320 | #define USB_DEVICE_ID_DELCOM_VISUAL_IND 0xb080 |
| 321 | 321 | |
| 322 | +#define USB_VENDOR_ID_DELL 0x413c | |
| 323 | +#define USB_DEVICE_ID_DELL_PIXART_USB_OPTICAL_MOUSE 0x301a | |
| 324 | + | |
| 322 | 325 | #define USB_VENDOR_ID_DELORME 0x1163 |
| 323 | 326 | #define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 |
| 324 | 327 | #define USB_DEVICE_ID_DELORME_EM_LT20 0x0200 |
| @@ -349,7 +349,6 @@ static int magicmouse_raw_event(struct hid_device *hdev, · 348 unmodified lines | ||
| 349 | 349 | |
| 350 | 350 | if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { |
| 351 | 351 | magicmouse_emit_buttons(msc, clicks & 3); |
| 352 | − input_mt_report_pointer_emulation(input, true); | |
| 353 | 352 | input_report_rel(input, REL_X, x); |
| 354 | 353 | input_report_rel(input, REL_Y, y); |
| 355 | 354 | } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ |
| @@ -389,16 +388,16 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd · 33 unmodified lines | ||
| 389 | 388 | __clear_bit(BTN_RIGHT, input->keybit); |
| 390 | 389 | __clear_bit(BTN_MIDDLE, input->keybit); |
| 391 | 390 | __set_bit(BTN_MOUSE, input->keybit); |
| 391 | + __set_bit(BTN_TOOL_FINGER, input->keybit); | |
| 392 | + __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); | |
| 393 | + __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); | |
| 394 | + __set_bit(BTN_TOOL_QUADTAP, input->keybit); | |
| 395 | + __set_bit(BTN_TOOL_QUINTTAP, input->keybit); | |
| 396 | + __set_bit(BTN_TOUCH, input->keybit); | |
| 397 | + __set_bit(INPUT_PROP_POINTER, input->propbit); | |
| 392 | 398 | __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); |
| 393 | 399 | } |
| 394 | 400 | |
| 395 | − __set_bit(BTN_TOOL_FINGER, input->keybit); | |
| 396 | − __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); | |
| 397 | − __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); | |
| 398 | − __set_bit(BTN_TOOL_QUADTAP, input->keybit); | |
| 399 | − __set_bit(BTN_TOOL_QUINTTAP, input->keybit); | |
| 400 | − __set_bit(BTN_TOUCH, input->keybit); | |
| 401 | − __set_bit(INPUT_PROP_POINTER, input->propbit); | |
| 402 | 401 | |
| 403 | 402 | __set_bit(EV_ABS, input->evbit); |
| 404 | 403 | |
| @@ -85,6 +85,7 @@ static const struct hid_blacklist { · 84 unmodified lines | ||
| 85 | 85 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, |
| 86 | 86 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, |
| 87 | 87 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET }, |
| 88 | + { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, | |
| 88 | 89 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
| 89 | 90 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, |
| 90 | 91 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT }, |
| @@ -1066,7 +1066,7 @@ static void ssip_pn_setup(struct net_device *dev) · 1065 unmodified lines | ||
| 1066 | 1066 | dev->addr_len = 1; |
| 1067 | 1067 | dev->tx_queue_len = SSIP_TXQUEUE_LEN; |
| 1068 | 1068 | |
| 1069 | − dev->destructor = free_netdev; | |
| 1069 | + dev->needs_free_netdev = true; | |
| 1070 | 1070 | dev->header_ops = &phonet_header_ops; |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| @@ -734,9 +734,9 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx, · 733 unmodified lines | ||
| 734 | 734 | * the first read operation, otherwise the first read cost |
| 735 | 735 | * one extra clock cycle. |
| 736 | 736 | */ |
| 737 | − temp = readb(i2c_imx->base + IMX_I2C_I2CR); | |
| 737 | + temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR); | |
| 738 | 738 | temp |= I2CR_MTX; |
| 739 | − writeb(temp, i2c_imx->base + IMX_I2C_I2CR); | |
| 739 | + imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR); | |
| 740 | 740 | } |
| 741 | 741 | msgs->buf[msgs->len-1] = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2DR); |
| 742 | 742 | |
| @@ -857,9 +857,9 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, bo · 114 unmodified lines | ||
| 857 | 857 | * the first read operation, otherwise the first read cost |
| 858 | 858 | * one extra clock cycle. |
| 859 | 859 | */ |
| 860 | − temp = readb(i2c_imx->base + IMX_I2C_I2CR); | |
| 860 | + temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR); | |
| 861 | 861 | temp |= I2CR_MTX; |
| 862 | − writeb(temp, i2c_imx->base + IMX_I2C_I2CR); | |
| 862 | + imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR); | |
| 863 | 863 | } |
| 864 | 864 | } else if (i == (msgs->len - 2)) { |
| 865 | 865 | dev_dbg(&i2c_imx->adapter.dev, |
| @@ -584,7 +584,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, · 583 unmodified lines | ||
| 584 | 584 | |
| 585 | 585 | /* unmap the data buffer */ |
| 586 | 586 | if (dma_size != 0) |
| 587 | − dma_unmap_single(&adap->dev, dma_addr, dma_size, dma_direction); | |
| 587 | + dma_unmap_single(dev, dma_addr, dma_size, dma_direction); | |
| 588 | 588 | |
| 589 | 589 | if (unlikely(!time_left)) { |
| 590 | 590 | dev_err(dev, "completion wait timed out\n"); |
| @@ -319,7 +319,7 @@ static void rcar_i2c_dma_unmap(struct rcar_i2c_priv *priv) · 318 unmodified lines | ||
| 319 | 319 | rcar_i2c_write(priv, ICFBSCR, TCYC06); |
| 320 | 320 | |
| 321 | 321 | dma_unmap_single(chan->device->dev, sg_dma_address(&priv->sg), |
| 322 | − priv->msg->len, priv->dma_direction); | |
| 322 | + sg_dma_len(&priv->sg), priv->dma_direction); | |
| 323 | 323 | |
| 324 | 324 | priv->dma_direction = DMA_NONE; |
| 325 | 325 | } |
| @@ -468,13 +468,13 @@ static void meson_sar_adc_unlock(struct iio_dev *indio_dev) · 467 unmodified lines | ||
| 468 | 468 | static void meson_sar_adc_clear_fifo(struct iio_dev *indio_dev) |
| 469 | 469 | { |
| 470 | 470 | struct meson_sar_adc_priv *priv = iio_priv(indio_dev); |
| 471 | − int count; | |
| 471 | + unsigned int count, tmp; | |
| 472 | 472 | |
| 473 | 473 | for (count = 0; count < MESON_SAR_ADC_MAX_FIFO_SIZE; count++) { |
| 474 | 474 | if (!meson_sar_adc_get_fifo_count(indio_dev)) |
| 475 | 475 | break; |
| 476 | 476 | |
| 477 | − regmap_read(priv->regmap, MESON_SAR_ADC_FIFO_RD, 0); | |
| 477 | + regmap_read(priv->regmap, MESON_SAR_ADC_FIFO_RD, &tmp); | |
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | |
| @@ -718,9 +718,12 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev) · 717 unmodified lines | ||
| 718 | 718 | adc->dev = dev; |
| 719 | 719 | |
| 720 | 720 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 721 | + if (!iores) | |
| 722 | + return -EINVAL; | |
| 723 | + | |
| 721 | 724 | adc->base = devm_ioremap(dev, iores->start, resource_size(iores)); |
| 722 | − if (IS_ERR(adc->base)) | |
| 723 | − return PTR_ERR(adc->base); | |
| 725 | + if (!adc->base) | |
| 726 | + return -ENOMEM; | |
| 724 | 727 | |
| 725 | 728 | init_completion(&adc->completion); |
| 726 | 729 | spin_lock_init(&adc->lock); |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/sched.h> |
| 15 | 15 | #include <linux/poll.h> |
| 16 | 16 | #include <linux/iio/buffer.h> |
| 17 | +#include <linux/iio/buffer_impl.h> | |
| 17 | 18 | #include <linux/iio/buffer-dma.h> |
| 18 | 19 | #include <linux/dma-mapping.h> |
| 19 | 20 | #include <linux/sizes.h> |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | #include <linux/iio/iio.h> |
| 16 | 16 | #include <linux/iio/buffer.h> |
| 17 | +#include <linux/iio/buffer_impl.h> | |
| 17 | 18 | #include <linux/iio/buffer-dma.h> |
| 18 | 19 | #include <linux/iio/buffer-dmaengine.h> |
| 19 | 20 | |
| @@ -41,6 +41,7 @@ static const int accel_scale[] = {598, 1196, 2392, 4785}; · 40 unmodified lines | ||
| 41 | 41 | static const struct inv_mpu6050_reg_map reg_set_6500 = { |
| 42 | 42 | .sample_rate_div = INV_MPU6050_REG_SAMPLE_RATE_DIV, |
| 43 | 43 | .lpf = INV_MPU6050_REG_CONFIG, |
| 44 | + .accel_lpf = INV_MPU6500_REG_ACCEL_CONFIG_2, | |
| 44 | 45 | .user_ctrl = INV_MPU6050_REG_USER_CTRL, |
| 45 | 46 | .fifo_en = INV_MPU6050_REG_FIFO_EN, |
| 46 | 47 | .gyro_config = INV_MPU6050_REG_GYRO_CONFIG, |
| @@ -210,6 +211,37 @@ int inv_mpu6050_set_power_itg(struct inv_mpu6050_state *st, bool power_on) · 163 unmodified lines | ||
| 210 | 211 | } |
| 211 | 212 | EXPORT_SYMBOL_GPL(inv_mpu6050_set_power_itg); |
| 212 | 213 | |
| 214 | +/** | |
| 215 | + * inv_mpu6050_set_lpf_regs() - set low pass filter registers, chip dependent | |
| 216 | + * | |
| 217 | + * MPU60xx/MPU9150 use only 1 register for accelerometer + gyroscope | |
| 218 | + * MPU6500 and above have a dedicated register for accelerometer | |
| 219 | + */ | |
| 220 | +static int inv_mpu6050_set_lpf_regs(struct inv_mpu6050_state *st, | |
| 221 | + enum inv_mpu6050_filter_e val) | |
| 222 | +{ | |
| 223 | + int result; | |
| 224 | + | |
| 225 | + result = regmap_write(st->map, st->reg->lpf, val); | |
| 226 | + if (result) | |
| 227 | + return result; | |
| 228 | + | |
| 229 | + switch (st->chip_type) { | |
| 230 | + case INV_MPU6050: | |
| 231 | + case INV_MPU6000: | |
| 232 | + case INV_MPU9150: | |
| 233 | + /* old chips, nothing to do */ | |
| 234 | + result = 0; | |
| 235 | + break; | |
| 236 | + default: | |
| 237 | + /* set accel lpf */ | |
| 238 | + result = regmap_write(st->map, st->reg->accel_lpf, val); | |
| 239 | + break; | |
| 240 | + } | |
| 241 | + | |
| 242 | + return result; | |
| 243 | +} | |
| 244 | + | |
| 213 | 245 | /** |
| 214 | 246 | * inv_mpu6050_init_config() - Initialize hardware, disable FIFO. |
| 215 | 247 | * |
| @@ -233,8 +265,7 @@ static int inv_mpu6050_init_config(struct iio_dev *indio_dev) · 17 unmodified lines | ||
| 233 | 265 | if (result) |
| 234 | 266 | return result; |
| 235 | 267 | |
| 236 | − d = INV_MPU6050_FILTER_20HZ; | |
| 237 | − result = regmap_write(st->map, st->reg->lpf, d); | |
| 268 | + result = inv_mpu6050_set_lpf_regs(st, INV_MPU6050_FILTER_20HZ); | |
| 238 | 269 | if (result) |
| 239 | 270 | return result; |
| 240 | 271 | |
| @@ -537,6 +568,8 @@ error_write_raw: · 296 unmodified lines | ||
| 537 | 568 | * would be alising. This function basically search for the |
| 538 | 569 | * correct low pass parameters based on the fifo rate, e.g, |
| 539 | 570 | * sampling frequency. |
| 571 | + * | |
| 572 | + * lpf is set automatically when setting sampling rate to avoid any aliases. | |
| 540 | 573 | */ |
| 541 | 574 | static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate) |
| 542 | 575 | { |
| @@ -552,7 +585,7 @@ static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate) · 9 unmodified lines | ||
| 552 | 585 | while ((h < hz[i]) && (i < ARRAY_SIZE(d) - 1)) |
| 553 | 586 | i++; |
| 554 | 587 | data = d[i]; |
| 555 | − result = regmap_write(st->map, st->reg->lpf, data); | |
| 588 | + result = inv_mpu6050_set_lpf_regs(st, data); | |
| 556 | 589 | if (result) |
| 557 | 590 | return result; |
| 558 | 591 | st->chip_config.lpf = data; |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | * struct inv_mpu6050_reg_map - Notable registers. |
| 29 | 29 | * @sample_rate_div: Divider applied to gyro output rate. |
| 30 | 30 | * @lpf: Configures internal low pass filter. |
| 31 | + * @accel_lpf: Configures accelerometer low pass filter. | |
| 31 | 32 | * @user_ctrl: Enables/resets the FIFO. |
| 32 | 33 | * @fifo_en: Determines which data will appear in FIFO. |
| 33 | 34 | * @gyro_config: gyro config register. |
| @@ -47,6 +48,7 @@ · 13 unmodified lines | ||
| 47 | 48 | struct inv_mpu6050_reg_map { |
| 48 | 49 | u8 sample_rate_div; |
| 49 | 50 | u8 lpf; |
| 51 | + u8 accel_lpf; | |
| 50 | 52 | u8 user_ctrl; |
| 51 | 53 | u8 fifo_en; |
| 52 | 54 | u8 gyro_config; |
| @@ -188,6 +190,7 @@ struct inv_mpu6050_state { · 135 unmodified lines | ||
| 188 | 190 | #define INV_MPU6050_FIFO_THRESHOLD 500 |
| 189 | 191 | |
| 190 | 192 | /* mpu6500 registers */ |
| 193 | +#define INV_MPU6500_REG_ACCEL_CONFIG_2 0x1D | |
| 191 | 194 | #define INV_MPU6500_REG_ACCEL_OFFSET 0x77 |
| 192 | 195 | |
| 193 | 196 | /* delay time in milliseconds */ |
| @@ -449,12 +449,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, · 448 unmodified lines | ||
| 449 | 449 | return ret; |
| 450 | 450 | |
| 451 | 451 | rt = (struct rt6_info *)dst; |
| 452 | − if (ipv6_addr_any(&fl6.saddr)) { | |
| 453 | − ret = ipv6_dev_get_saddr(addr->net, ip6_dst_idev(dst)->dev, | |
| 454 | − &fl6.daddr, 0, &fl6.saddr); | |
| 455 | − if (ret) | |
| 456 | − goto put; | |
| 457 | − | |
| 452 | + if (ipv6_addr_any(&src_in->sin6_addr)) { | |
| 458 | 453 | src_in->sin6_family = AF_INET6; |
| 459 | 454 | src_in->sin6_addr = fl6.saddr; |
| 460 | 455 | } |
| @@ -471,9 +466,6 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, · 10 unmodified lines | ||
| 471 | 466 | |
| 472 | 467 | *pdst = dst; |
| 473 | 468 | return 0; |
| 474 | −put: | |
| 475 | − dst_release(dst); | |
| 476 | − return ret; | |
| 477 | 469 | } |
| 478 | 470 | #else |
| 479 | 471 | static int addr6_resolve(struct sockaddr_in6 *src_in, |
| @@ -56,6 +56,10 @@ · 55 unmodified lines | ||
| 56 | 56 | #define BNXT_RE_MAX_SRQC_COUNT (64 * 1024) |
| 57 | 57 | #define BNXT_RE_MAX_CQ_COUNT (64 * 1024) |
| 58 | 58 | |
| 59 | +#define BNXT_RE_UD_QP_HW_STALL 0x400000 | |
| 60 | + | |
| 61 | +#define BNXT_RE_RQ_WQE_THRESHOLD 32 | |
| 62 | + | |
| 59 | 63 | struct bnxt_re_work { |
| 60 | 64 | struct work_struct work; |
| 61 | 65 | unsigned long event; |
| @@ -61,6 +61,48 @@ · 60 unmodified lines | ||
| 61 | 61 | #include "ib_verbs.h" |
| 62 | 62 | #include <rdma/bnxt_re-abi.h> |
| 63 | 63 | |
| 64 | +static int __from_ib_access_flags(int iflags) | |
| 65 | +{ | |
| 66 | + int qflags = 0; | |
| 67 | + | |
| 68 | + if (iflags & IB_ACCESS_LOCAL_WRITE) | |
| 69 | + qflags |= BNXT_QPLIB_ACCESS_LOCAL_WRITE; | |
| 70 | + if (iflags & IB_ACCESS_REMOTE_READ) | |
| 71 | + qflags |= BNXT_QPLIB_ACCESS_REMOTE_READ; | |
| 72 | + if (iflags & IB_ACCESS_REMOTE_WRITE) | |
| 73 | + qflags |= BNXT_QPLIB_ACCESS_REMOTE_WRITE; | |
| 74 | + if (iflags & IB_ACCESS_REMOTE_ATOMIC) | |
| 75 | + qflags |= BNXT_QPLIB_ACCESS_REMOTE_ATOMIC; | |
| 76 | + if (iflags & IB_ACCESS_MW_BIND) | |
| 77 | + qflags |= BNXT_QPLIB_ACCESS_MW_BIND; | |
| 78 | + if (iflags & IB_ZERO_BASED) | |
| 79 | + qflags |= BNXT_QPLIB_ACCESS_ZERO_BASED; | |
| 80 | + if (iflags & IB_ACCESS_ON_DEMAND) | |
| 81 | + qflags |= BNXT_QPLIB_ACCESS_ON_DEMAND; | |
| 82 | + return qflags; | |
| 83 | +}; | |
| 84 | + | |
| 85 | +static enum ib_access_flags __to_ib_access_flags(int qflags) | |
| 86 | +{ | |
| 87 | + enum ib_access_flags iflags = 0; | |
| 88 | + | |
| 89 | + if (qflags & BNXT_QPLIB_ACCESS_LOCAL_WRITE) | |
| 90 | + iflags |= IB_ACCESS_LOCAL_WRITE; | |
| 91 | + if (qflags & BNXT_QPLIB_ACCESS_REMOTE_WRITE) | |
| 92 | + iflags |= IB_ACCESS_REMOTE_WRITE; | |
| 93 | + if (qflags & BNXT_QPLIB_ACCESS_REMOTE_READ) | |
| 94 | + iflags |= IB_ACCESS_REMOTE_READ; | |
| 95 | + if (qflags & BNXT_QPLIB_ACCESS_REMOTE_ATOMIC) | |
| 96 | + iflags |= IB_ACCESS_REMOTE_ATOMIC; | |
| 97 | + if (qflags & BNXT_QPLIB_ACCESS_MW_BIND) | |
| 98 | + iflags |= IB_ACCESS_MW_BIND; | |
| 99 | + if (qflags & BNXT_QPLIB_ACCESS_ZERO_BASED) | |
| 100 | + iflags |= IB_ZERO_BASED; | |
| 101 | + if (qflags & BNXT_QPLIB_ACCESS_ON_DEMAND) | |
| 102 | + iflags |= IB_ACCESS_ON_DEMAND; | |
| 103 | + return iflags; | |
| 104 | +}; | |
| 105 | + | |
| 64 | 106 | static int bnxt_re_build_sgl(struct ib_sge *ib_sg_list, |
| 65 | 107 | struct bnxt_qplib_sge *sg_list, int num) |
| 66 | 108 | { |
| @@ -149,8 +191,8 @@ int bnxt_re_query_device(struct ib_device *ibdev, · 82 unmodified lines | ||
| 149 | 191 | ib_attr->max_total_mcast_qp_attach = 0; |
| 150 | 192 | ib_attr->max_ah = dev_attr->max_ah; |
| 151 | 193 | |
| 152 | − ib_attr->max_fmr = dev_attr->max_fmr; | |
| 153 | − ib_attr->max_map_per_fmr = 1; /* ? */ | |
| 194 | + ib_attr->max_fmr = 0; | |
| 195 | + ib_attr->max_map_per_fmr = 0; | |
| 154 | 196 | |
| 155 | 197 | ib_attr->max_srq = dev_attr->max_srq; |
| 156 | 198 | ib_attr->max_srq_wr = dev_attr->max_srq_wqes; |
| @@ -410,6 +452,158 @@ enum rdma_link_layer bnxt_re_get_link_layer(struct ib_device *ibdev, · 253 unmodified lines | ||
| 410 | 452 | return IB_LINK_LAYER_ETHERNET; |
| 411 | 453 | } |
| 412 | 454 | |
| 455 | +#define BNXT_RE_FENCE_PBL_SIZE DIV_ROUND_UP(BNXT_RE_FENCE_BYTES, PAGE_SIZE) | |
| 456 | + | |
| 457 | +static void bnxt_re_create_fence_wqe(struct bnxt_re_pd *pd) | |
| 458 | +{ | |
| 459 | + struct bnxt_re_fence_data *fence = &pd->fence; | |
| 460 | + struct ib_mr *ib_mr = &fence->mr->ib_mr; | |
| 461 | + struct bnxt_qplib_swqe *wqe = &fence->bind_wqe; | |
| 462 | + | |
| 463 | + memset(wqe, 0, sizeof(*wqe)); | |
| 464 | + wqe->type = BNXT_QPLIB_SWQE_TYPE_BIND_MW; | |
| 465 | + wqe->wr_id = BNXT_QPLIB_FENCE_WRID; | |
| 466 | + wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP; | |
| 467 | + wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE; | |
| 468 | + wqe->bind.zero_based = false; | |
| 469 | + wqe->bind.parent_l_key = ib_mr->lkey; | |
| 470 | + wqe->bind.va = (u64)(unsigned long)fence->va; | |
| 471 | + wqe->bind.length = fence->size; | |
| 472 | + wqe->bind.access_cntl = __from_ib_access_flags(IB_ACCESS_REMOTE_READ); | |
| 473 | + wqe->bind.mw_type = SQ_BIND_MW_TYPE_TYPE1; | |
| 474 | + | |
| 475 | + /* Save the initial rkey in fence structure for now; | |
| 476 | + * wqe->bind.r_key will be set at (re)bind time. | |
| 477 | + */ | |
| 478 | + fence->bind_rkey = ib_inc_rkey(fence->mw->rkey); | |
| 479 | +} | |
| 480 | + | |
| 481 | +static int bnxt_re_bind_fence_mw(struct bnxt_qplib_qp *qplib_qp) | |
| 482 | +{ | |
| 483 | + struct bnxt_re_qp *qp = container_of(qplib_qp, struct bnxt_re_qp, | |
| 484 | + qplib_qp); | |
| 485 | + struct ib_pd *ib_pd = qp->ib_qp.pd; | |
| 486 | + struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd); | |
| 487 | + struct bnxt_re_fence_data *fence = &pd->fence; | |
| 488 | + struct bnxt_qplib_swqe *fence_wqe = &fence->bind_wqe; | |
| 489 | + struct bnxt_qplib_swqe wqe; | |
| 490 | + int rc; | |
| 491 | + | |
| 492 | + memcpy(&wqe, fence_wqe, sizeof(wqe)); | |
| 493 | + wqe.bind.r_key = fence->bind_rkey; | |
| 494 | + fence->bind_rkey = ib_inc_rkey(fence->bind_rkey); | |
| 495 | + | |
| 496 | + dev_dbg(rdev_to_dev(qp->rdev), | |
| 497 | + "Posting bind fence-WQE: rkey: %#x QP: %d PD: %p\n", | |
| 498 | + wqe.bind.r_key, qp->qplib_qp.id, pd); | |
| 499 | + rc = bnxt_qplib_post_send(&qp->qplib_qp, &wqe); | |
| 500 | + if (rc) { | |
| 501 | + dev_err(rdev_to_dev(qp->rdev), "Failed to bind fence-WQE\n"); | |
| 502 | + return rc; | |
| 503 | + } | |
| 504 | + bnxt_qplib_post_send_db(&qp->qplib_qp); | |
| 505 | + | |
| 506 | + return rc; | |
| 507 | +} | |
| 508 | + | |
| 509 | +static void bnxt_re_destroy_fence_mr(struct bnxt_re_pd *pd) | |
| 510 | +{ | |
| 511 | + struct bnxt_re_fence_data *fence = &pd->fence; | |
| 512 | + struct bnxt_re_dev *rdev = pd->rdev; | |
| 513 | + struct device *dev = &rdev->en_dev->pdev->dev; | |
| 514 | + struct bnxt_re_mr *mr = fence->mr; | |
| 515 | + | |
| 516 | + if (fence->mw) { | |
| 517 | + bnxt_re_dealloc_mw(fence->mw); | |
| 518 | + fence->mw = NULL; | |
| 519 | + } | |
| 520 | + if (mr) { | |
| 521 | + if (mr->ib_mr.rkey) | |
| 522 | + bnxt_qplib_dereg_mrw(&rdev->qplib_res, &mr->qplib_mr, | |
| 523 | + true); | |
| 524 | + if (mr->ib_mr.lkey) | |
| 525 | + bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr); | |
| 526 | + kfree(mr); | |
| 527 | + fence->mr = NULL; | |
| 528 | + } | |
| 529 | + if (fence->dma_addr) { | |
| 530 | + dma_unmap_single(dev, fence->dma_addr, BNXT_RE_FENCE_BYTES, | |
| 531 | + DMA_BIDIRECTIONAL); | |
| 532 | + fence->dma_addr = 0; | |
| 533 | + } | |
| 534 | +} | |
| 535 | + | |
| 536 | +static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd) | |
| 537 | +{ | |
| 538 | + int mr_access_flags = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_MW_BIND; | |
| 539 | + struct bnxt_re_fence_data *fence = &pd->fence; | |
| 540 | + struct bnxt_re_dev *rdev = pd->rdev; | |
| 541 | + struct device *dev = &rdev->en_dev->pdev->dev; | |
| 542 | + struct bnxt_re_mr *mr = NULL; | |
| 543 | + dma_addr_t dma_addr = 0; | |
| 544 | + struct ib_mw *mw; | |
| 545 | + u64 pbl_tbl; | |
| 546 | + int rc; | |
| 547 | + | |
| 548 | + dma_addr = dma_map_single(dev, fence->va, BNXT_RE_FENCE_BYTES, | |
| 549 | + DMA_BIDIRECTIONAL); | |
| 550 | + rc = dma_mapping_error(dev, dma_addr); | |
| 551 | + if (rc) { | |
| 552 | + dev_err(rdev_to_dev(rdev), "Failed to dma-map fence-MR-mem\n"); | |
| 553 | + rc = -EIO; | |
| 554 | + fence->dma_addr = 0; | |
| 555 | + goto fail; | |
| 556 | + } | |
| 557 | + fence->dma_addr = dma_addr; | |
| 558 | + | |
| 559 | + /* Allocate a MR */ | |
| 560 | + mr = kzalloc(sizeof(*mr), GFP_KERNEL); | |
| 561 | + if (!mr) { | |
| 562 | + rc = -ENOMEM; | |
| 563 | + goto fail; | |
| 564 | + } | |
| 565 | + fence->mr = mr; | |
| 566 | + mr->rdev = rdev; | |
| 567 | + mr->qplib_mr.pd = &pd->qplib_pd; | |
| 568 | + mr->qplib_mr.type = CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR; | |
| 569 | + mr->qplib_mr.flags = __from_ib_access_flags(mr_access_flags); | |
| 570 | + rc = bnxt_qplib_alloc_mrw(&rdev->qplib_res, &mr->qplib_mr); | |
| 571 | + if (rc) { | |
| 572 | + dev_err(rdev_to_dev(rdev), "Failed to alloc fence-HW-MR\n"); | |
| 573 | + goto fail; | |
| 574 | + } | |
| 575 | + | |
| 576 | + /* Register MR */ | |
| 577 | + mr->ib_mr.lkey = mr->qplib_mr.lkey; | |
| 578 | + mr->qplib_mr.va = (u64)(unsigned long)fence->va; | |
| 579 | + mr->qplib_mr.total_size = BNXT_RE_FENCE_BYTES; | |
| 580 | + pbl_tbl = dma_addr; | |
| 581 | + rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &mr->qplib_mr, &pbl_tbl, | |
| 582 | + BNXT_RE_FENCE_PBL_SIZE, false); | |
| 583 | + if (rc) { | |
| 584 | + dev_err(rdev_to_dev(rdev), "Failed to register fence-MR\n"); | |
| 585 | + goto fail; | |
| 586 | + } | |
| 587 | + mr->ib_mr.rkey = mr->qplib_mr.rkey; | |
| 588 | + | |
| 589 | + /* Create a fence MW only for kernel consumers */ | |
| 590 | + mw = bnxt_re_alloc_mw(&pd->ib_pd, IB_MW_TYPE_1, NULL); | |
| 591 | + if (!mw) { | |
| 592 | + dev_err(rdev_to_dev(rdev), | |
| 593 | + "Failed to create fence-MW for PD: %p\n", pd); | |
| 594 | + rc = -EINVAL; | |
| 595 | + goto fail; | |
| 596 | + } | |
| 597 | + fence->mw = mw; | |
| 598 | + | |
| 599 | + bnxt_re_create_fence_wqe(pd); | |
| 600 | + return 0; | |
| 601 | + | |
| 602 | +fail: | |
| 603 | + bnxt_re_destroy_fence_mr(pd); | |
| 604 | + return rc; | |
| 605 | +} | |
| 606 | + | |
| 413 | 607 | /* Protection Domains */ |
| 414 | 608 | int bnxt_re_dealloc_pd(struct ib_pd *ib_pd) |
| 415 | 609 | { |
| @@ -417,6 +611,7 @@ int bnxt_re_dealloc_pd(struct ib_pd *ib_pd) · 1 unmodified line | ||
| 417 | 611 | struct bnxt_re_dev *rdev = pd->rdev; |
| 418 | 612 | int rc; |
| 419 | 613 | |
| 614 | + bnxt_re_destroy_fence_mr(pd); | |
| 420 | 615 | if (ib_pd->uobject && pd->dpi.dbr) { |
| 421 | 616 | struct ib_ucontext *ib_uctx = ib_pd->uobject->context; |
| 422 | 617 | struct bnxt_re_ucontext *ucntx; |
| @@ -498,6 +693,10 @@ struct ib_pd *bnxt_re_alloc_pd(struct ib_device *ibdev, · 75 unmodified lines | ||
| 498 | 693 | } |
| 499 | 694 | } |
| 500 | 695 | |
| 696 | + if (!udata) | |
| 697 | + if (bnxt_re_create_fence_mr(pd)) | |
| 698 | + dev_warn(rdev_to_dev(rdev), | |
| 699 | + "Failed to create Fence-MR\n"); | |
| 501 | 700 | return &pd->ib_pd; |
| 502 | 701 | dbfail: |
| 503 | 702 | (void)bnxt_qplib_dealloc_pd(&rdev->qplib_res, &rdev->qplib_res.pd_tbl, |
| @@ -849,12 +1048,16 @@ static struct bnxt_re_qp *bnxt_re_create_shadow_qp · 345 unmodified lines | ||
| 849 | 1048 | /* Shadow QP SQ depth should be same as QP1 RQ depth */ |
| 850 | 1049 | qp->qplib_qp.sq.max_wqe = qp1_qp->rq.max_wqe; |
| 851 | 1050 | qp->qplib_qp.sq.max_sge = 2; |
| 1051 | + /* Q full delta can be 1 since it is internal QP */ | |
| 1052 | + qp->qplib_qp.sq.q_full_delta = 1; | |
| 852 | 1053 | |
| 853 | 1054 | qp->qplib_qp.scq = qp1_qp->scq; |
| 854 | 1055 | qp->qplib_qp.rcq = qp1_qp->rcq; |
| 855 | 1056 | |
| 856 | 1057 | qp->qplib_qp.rq.max_wqe = qp1_qp->rq.max_wqe; |
| 857 | 1058 | qp->qplib_qp.rq.max_sge = qp1_qp->rq.max_sge; |
| 1059 | + /* Q full delta can be 1 since it is internal QP */ | |
| 1060 | + qp->qplib_qp.rq.q_full_delta = 1; | |
| 858 | 1061 | |
| 859 | 1062 | qp->qplib_qp.mtu = qp1_qp->mtu; |
| 860 | 1063 | |
| @@ -917,10 +1120,6 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 56 unmodified lines | ||
| 917 | 1120 | qp->qplib_qp.sig_type = ((qp_init_attr->sq_sig_type == |
| 918 | 1121 | IB_SIGNAL_ALL_WR) ? true : false); |
| 919 | 1122 | |
| 920 | − entries = roundup_pow_of_two(qp_init_attr->cap.max_send_wr + 1); | |
| 921 | − qp->qplib_qp.sq.max_wqe = min_t(u32, entries, | |
| 922 | − dev_attr->max_qp_wqes + 1); | |
| 923 | − | |
| 924 | 1123 | qp->qplib_qp.sq.max_sge = qp_init_attr->cap.max_send_sge; |
| 925 | 1124 | if (qp->qplib_qp.sq.max_sge > dev_attr->max_qp_sges) |
| 926 | 1125 | qp->qplib_qp.sq.max_sge = dev_attr->max_qp_sges; |
| @@ -959,6 +1158,9 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 32 unmodified lines | ||
| 959 | 1158 | qp->qplib_qp.rq.max_wqe = min_t(u32, entries, |
| 960 | 1159 | dev_attr->max_qp_wqes + 1); |
| 961 | 1160 | |
| 1161 | + qp->qplib_qp.rq.q_full_delta = qp->qplib_qp.rq.max_wqe - | |
| 1162 | + qp_init_attr->cap.max_recv_wr; | |
| 1163 | + | |
| 962 | 1164 | qp->qplib_qp.rq.max_sge = qp_init_attr->cap.max_recv_sge; |
| 963 | 1165 | if (qp->qplib_qp.rq.max_sge > dev_attr->max_qp_sges) |
| 964 | 1166 | qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges; |
| @@ -967,6 +1169,12 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 2 unmodified lines | ||
| 967 | 1169 | qp->qplib_qp.mtu = ib_mtu_enum_to_int(iboe_get_mtu(rdev->netdev->mtu)); |
| 968 | 1170 | |
| 969 | 1171 | if (qp_init_attr->qp_type == IB_QPT_GSI) { |
| 1172 | + /* Allocate 1 more than what's provided */ | |
| 1173 | + entries = roundup_pow_of_two(qp_init_attr->cap.max_send_wr + 1); | |
| 1174 | + qp->qplib_qp.sq.max_wqe = min_t(u32, entries, | |
| 1175 | + dev_attr->max_qp_wqes + 1); | |
| 1176 | + qp->qplib_qp.sq.q_full_delta = qp->qplib_qp.sq.max_wqe - | |
| 1177 | + qp_init_attr->cap.max_send_wr; | |
| 970 | 1178 | qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges; |
| 971 | 1179 | if (qp->qplib_qp.rq.max_sge > dev_attr->max_qp_sges) |
| 972 | 1180 | qp->qplib_qp.rq.max_sge = dev_attr->max_qp_sges; |
| @@ -1006,6 +1214,22 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 33 unmodified lines | ||
| 1006 | 1214 | } |
| 1007 | 1215 | |
| 1008 | 1216 | } else { |
| 1217 | + /* Allocate 128 + 1 more than what's provided */ | |
| 1218 | + entries = roundup_pow_of_two(qp_init_attr->cap.max_send_wr + | |
| 1219 | + BNXT_QPLIB_RESERVED_QP_WRS + 1); | |
| 1220 | + qp->qplib_qp.sq.max_wqe = min_t(u32, entries, | |
| 1221 | + dev_attr->max_qp_wqes + | |
| 1222 | + BNXT_QPLIB_RESERVED_QP_WRS + 1); | |
| 1223 | + qp->qplib_qp.sq.q_full_delta = BNXT_QPLIB_RESERVED_QP_WRS + 1; | |
| 1224 | + | |
| 1225 | + /* | |
| 1226 | + * Reserving one slot for Phantom WQE. Application can | |
| 1227 | + * post one extra entry in this case. But allowing this to avoid | |
| 1228 | + * unexpected Queue full condition | |
| 1229 | + */ | |
| 1230 | + | |
| 1231 | + qp->qplib_qp.sq.q_full_delta -= 1; | |
| 1232 | + | |
| 1009 | 1233 | qp->qplib_qp.max_rd_atomic = dev_attr->max_qp_rd_atom; |
| 1010 | 1234 | qp->qplib_qp.max_dest_rd_atomic = dev_attr->max_qp_init_rd_atom; |
| 1011 | 1235 | if (udata) { |
| @@ -1025,6 +1249,7 @@ struct ib_qp *bnxt_re_create_qp(struct ib_pd *ib_pd, · 13 unmodified lines | ||
| 1025 | 1249 | |
| 1026 | 1250 | qp->ib_qp.qp_num = qp->qplib_qp.id; |
| 1027 | 1251 | spin_lock_init(&qp->sq_lock); |
| 1252 | + spin_lock_init(&qp->rq_lock); | |
| 1028 | 1253 | |
| 1029 | 1254 | if (udata) { |
| 1030 | 1255 | struct bnxt_re_qp_resp resp; |
| @@ -1129,48 +1354,6 @@ static enum ib_mtu __to_ib_mtu(u32 mtu) · 98 unmodified lines | ||
| 1129 | 1354 | } |
| 1130 | 1355 | } |
| 1131 | 1356 | |
| 1132 | −static int __from_ib_access_flags(int iflags) | |
| 1133 | −{ | |
| 1134 | − int qflags = 0; | |
| 1135 | − | |
| 1136 | − if (iflags & IB_ACCESS_LOCAL_WRITE) | |
| 1137 | − qflags |= BNXT_QPLIB_ACCESS_LOCAL_WRITE; | |
| 1138 | − if (iflags & IB_ACCESS_REMOTE_READ) | |
| 1139 | − qflags |= BNXT_QPLIB_ACCESS_REMOTE_READ; | |
| 1140 | − if (iflags & IB_ACCESS_REMOTE_WRITE) | |
| 1141 | − qflags |= BNXT_QPLIB_ACCESS_REMOTE_WRITE; | |
| 1142 | − if (iflags & IB_ACCESS_REMOTE_ATOMIC) | |
| 1143 | − qflags |= BNXT_QPLIB_ACCESS_REMOTE_ATOMIC; | |
| 1144 | − if (iflags & IB_ACCESS_MW_BIND) | |
| 1145 | − qflags |= BNXT_QPLIB_ACCESS_MW_BIND; | |
| 1146 | − if (iflags & IB_ZERO_BASED) | |
| 1147 | − qflags |= BNXT_QPLIB_ACCESS_ZERO_BASED; | |
| 1148 | − if (iflags & IB_ACCESS_ON_DEMAND) | |
| 1149 | − qflags |= BNXT_QPLIB_ACCESS_ON_DEMAND; | |
| 1150 | − return qflags; | |
| 1151 | −}; | |
| 1152 | − | |
| 1153 | −static enum ib_access_flags __to_ib_access_flags(int qflags) | |
| 1154 | −{ | |
| 1155 | − enum ib_access_flags iflags = 0; | |
| 1156 | − | |
| 1157 | − if (qflags & BNXT_QPLIB_ACCESS_LOCAL_WRITE) | |
| 1158 | − iflags |= IB_ACCESS_LOCAL_WRITE; | |
| 1159 | − if (qflags & BNXT_QPLIB_ACCESS_REMOTE_WRITE) | |
| 1160 | − iflags |= IB_ACCESS_REMOTE_WRITE; | |
| 1161 | − if (qflags & BNXT_QPLIB_ACCESS_REMOTE_READ) | |
| 1162 | − iflags |= IB_ACCESS_REMOTE_READ; | |
| 1163 | − if (qflags & BNXT_QPLIB_ACCESS_REMOTE_ATOMIC) | |
| 1164 | − iflags |= IB_ACCESS_REMOTE_ATOMIC; | |
| 1165 | − if (qflags & BNXT_QPLIB_ACCESS_MW_BIND) | |
| 1166 | − iflags |= IB_ACCESS_MW_BIND; | |
| 1167 | − if (qflags & BNXT_QPLIB_ACCESS_ZERO_BASED) | |
| 1168 | − iflags |= IB_ZERO_BASED; | |
| 1169 | − if (qflags & BNXT_QPLIB_ACCESS_ON_DEMAND) | |
| 1170 | − iflags |= IB_ACCESS_ON_DEMAND; | |
| 1171 | − return iflags; | |
| 1172 | −}; | |
| 1173 | − | |
| 1174 | 1357 | static int bnxt_re_modify_shadow_qp(struct bnxt_re_dev *rdev, |
| 1175 | 1358 | struct bnxt_re_qp *qp1_qp, |
| 1176 | 1359 | int qp_attr_mask) |
| @@ -1378,11 +1561,21 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, · 201 unmodified lines | ||
| 1378 | 1561 | entries = roundup_pow_of_two(qp_attr->cap.max_send_wr); |
| 1379 | 1562 | qp->qplib_qp.sq.max_wqe = min_t(u32, entries, |
| 1380 | 1563 | dev_attr->max_qp_wqes + 1); |
| 1564 | + qp->qplib_qp.sq.q_full_delta = qp->qplib_qp.sq.max_wqe - | |
| 1565 | + qp_attr->cap.max_send_wr; | |
| 1566 | + /* | |
| 1567 | + * Reserving one slot for Phantom WQE. Some application can | |
| 1568 | + * post one extra entry in this case. Allowing this to avoid | |
| 1569 | + * unexpected Queue full condition | |
| 1570 | + */ | |
| 1571 | + qp->qplib_qp.sq.q_full_delta -= 1; | |
| 1381 | 1572 | qp->qplib_qp.sq.max_sge = qp_attr->cap.max_send_sge; |
| 1382 | 1573 | if (qp->qplib_qp.rq.max_wqe) { |
| 1383 | 1574 | entries = roundup_pow_of_two(qp_attr->cap.max_recv_wr); |
| 1384 | 1575 | qp->qplib_qp.rq.max_wqe = |
| 1385 | 1576 | min_t(u32, entries, dev_attr->max_qp_wqes + 1); |
| 1577 | + qp->qplib_qp.rq.q_full_delta = qp->qplib_qp.rq.max_wqe - | |
| 1578 | + qp_attr->cap.max_recv_wr; | |
| 1386 | 1579 | qp->qplib_qp.rq.max_sge = qp_attr->cap.max_recv_sge; |
| 1387 | 1580 | } else { |
| 1388 | 1581 | /* SRQ was used prior, just ignore the RQ caps */ |
| @@ -1883,6 +2076,22 @@ static int bnxt_re_copy_wr_payload(struct bnxt_re_dev *rdev, · 494 unmodified lines | ||
| 1883 | 2076 | return payload_sz; |
| 1884 | 2077 | } |
| 1885 | 2078 | |
| 2079 | +static void bnxt_ud_qp_hw_stall_workaround(struct bnxt_re_qp *qp) | |
| 2080 | +{ | |
| 2081 | + if ((qp->ib_qp.qp_type == IB_QPT_UD || | |
| 2082 | + qp->ib_qp.qp_type == IB_QPT_GSI || | |
| 2083 | + qp->ib_qp.qp_type == IB_QPT_RAW_ETHERTYPE) && | |
| 2084 | + qp->qplib_qp.wqe_cnt == BNXT_RE_UD_QP_HW_STALL) { | |
| 2085 | + int qp_attr_mask; | |
| 2086 | + struct ib_qp_attr qp_attr; | |
| 2087 | + | |
| 2088 | + qp_attr_mask = IB_QP_STATE; | |
| 2089 | + qp_attr.qp_state = IB_QPS_RTS; | |
| 2090 | + bnxt_re_modify_qp(&qp->ib_qp, &qp_attr, qp_attr_mask, NULL); | |
| 2091 | + qp->qplib_qp.wqe_cnt = 0; | |
| 2092 | + } | |
| 2093 | +} | |
| 2094 | + | |
| 1886 | 2095 | static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev, |
| 1887 | 2096 | struct bnxt_re_qp *qp, |
| 1888 | 2097 | struct ib_send_wr *wr) |
| @@ -1928,6 +2137,7 @@ bad: · 39 unmodified lines | ||
| 1928 | 2137 | wr = wr->next; |
| 1929 | 2138 | } |
| 1930 | 2139 | bnxt_qplib_post_send_db(&qp->qplib_qp); |
| 2140 | + bnxt_ud_qp_hw_stall_workaround(qp); | |
| 1931 | 2141 | spin_unlock_irqrestore(&qp->sq_lock, flags); |
| 1932 | 2142 | return rc; |
| 1933 | 2143 | } |
| @@ -2024,6 +2234,7 @@ bad: · 90 unmodified lines | ||
| 2024 | 2234 | wr = wr->next; |
| 2025 | 2235 | } |
| 2026 | 2236 | bnxt_qplib_post_send_db(&qp->qplib_qp); |
| 2237 | + bnxt_ud_qp_hw_stall_workaround(qp); | |
| 2027 | 2238 | spin_unlock_irqrestore(&qp->sq_lock, flags); |
| 2028 | 2239 | |
| 2029 | 2240 | return rc; |
| @@ -2071,7 +2282,10 @@ int bnxt_re_post_recv(struct ib_qp *ib_qp, struct ib_recv_wr *wr, · 41 unmodified lines | ||
| 2071 | 2282 | struct bnxt_re_qp *qp = container_of(ib_qp, struct bnxt_re_qp, ib_qp); |
| 2072 | 2283 | struct bnxt_qplib_swqe wqe; |
| 2073 | 2284 | int rc = 0, payload_sz = 0; |
| 2285 | + unsigned long flags; | |
| 2286 | + u32 count = 0; | |
| 2074 | 2287 | |
| 2288 | + spin_lock_irqsave(&qp->rq_lock, flags); | |
| 2075 | 2289 | while (wr) { |
| 2076 | 2290 | /* House keeping */ |
| 2077 | 2291 | memset(&wqe, 0, sizeof(wqe)); |
| @@ -2100,9 +2314,21 @@ int bnxt_re_post_recv(struct ib_qp *ib_qp, struct ib_recv_wr *wr, · 22 unmodified lines | ||
| 2100 | 2314 | *bad_wr = wr; |
| 2101 | 2315 | break; |
| 2102 | 2316 | } |
| 2317 | + | |
| 2318 | + /* Ring DB if the RQEs posted reaches a threshold value */ | |
| 2319 | + if (++count >= BNXT_RE_RQ_WQE_THRESHOLD) { | |
| 2320 | + bnxt_qplib_post_recv_db(&qp->qplib_qp); | |
| 2321 | + count = 0; | |
| 2322 | + } | |
| 2323 | + | |
| 2103 | 2324 | wr = wr->next; |
| 2104 | 2325 | } |
| 2105 | − bnxt_qplib_post_recv_db(&qp->qplib_qp); | |
| 2326 | + | |
| 2327 | + if (count) | |
| 2328 | + bnxt_qplib_post_recv_db(&qp->qplib_qp); | |
| 2329 | + | |
| 2330 | + spin_unlock_irqrestore(&qp->rq_lock, flags); | |
| 2331 | + | |
| 2106 | 2332 | return rc; |
| 2107 | 2333 | } |
| 2108 | 2334 | |
| @@ -2643,12 +2869,36 @@ static void bnxt_re_process_res_ud_wc(struct ib_wc *wc, · 534 unmodified lines | ||
| 2643 | 2869 | wc->opcode = IB_WC_RECV_RDMA_WITH_IMM; |
| 2644 | 2870 | } |
| 2645 | 2871 | |
| 2872 | +static int send_phantom_wqe(struct bnxt_re_qp *qp) | |
| 2873 | +{ | |
| 2874 | + struct bnxt_qplib_qp *lib_qp = &qp->qplib_qp; | |
| 2875 | + unsigned long flags; | |
| 2876 | + int rc = 0; | |
| 2877 | + | |
| 2878 | + spin_lock_irqsave(&qp->sq_lock, flags); | |
| 2879 | + | |
| 2880 | + rc = bnxt_re_bind_fence_mw(lib_qp); | |
| 2881 | + if (!rc) { | |
| 2882 | + lib_qp->sq.phantom_wqe_cnt++; | |
| 2883 | + dev_dbg(&lib_qp->sq.hwq.pdev->dev, | |
| 2884 | + "qp %#x sq->prod %#x sw_prod %#x phantom_wqe_cnt %d\n", | |
| 2885 | + lib_qp->id, lib_qp->sq.hwq.prod, | |
| 2886 | + HWQ_CMP(lib_qp->sq.hwq.prod, &lib_qp->sq.hwq), | |
| 2887 | + lib_qp->sq.phantom_wqe_cnt); | |
| 2888 | + } | |
| 2889 | + | |
| 2890 | + spin_unlock_irqrestore(&qp->sq_lock, flags); | |
| 2891 | + return rc; | |
| 2892 | +} | |
| 2893 | + | |
| 2646 | 2894 | int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) |
| 2647 | 2895 | { |
| 2648 | 2896 | struct bnxt_re_cq *cq = container_of(ib_cq, struct bnxt_re_cq, ib_cq); |
| 2649 | 2897 | struct bnxt_re_qp *qp; |
| 2650 | 2898 | struct bnxt_qplib_cqe *cqe; |
| 2651 | 2899 | int i, ncqe, budget; |
| 2900 | + struct bnxt_qplib_q *sq; | |
| 2901 | + struct bnxt_qplib_qp *lib_qp; | |
| 2652 | 2902 | u32 tbl_idx; |
| 2653 | 2903 | struct bnxt_re_sqp_entries *sqp_entry = NULL; |
| 2654 | 2904 | unsigned long flags; |
| @@ -2661,7 +2911,21 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) · 6 unmodified lines | ||
| 2661 | 2911 | } |
| 2662 | 2912 | cqe = &cq->cql[0]; |
| 2663 | 2913 | while (budget) { |
| 2664 | − ncqe = bnxt_qplib_poll_cq(&cq->qplib_cq, cqe, budget); | |
| 2914 | + lib_qp = NULL; | |
| 2915 | + ncqe = bnxt_qplib_poll_cq(&cq->qplib_cq, cqe, budget, &lib_qp); | |
| 2916 | + if (lib_qp) { | |
| 2917 | + sq = &lib_qp->sq; | |
| 2918 | + if (sq->send_phantom) { | |
| 2919 | + qp = container_of(lib_qp, | |
| 2920 | + struct bnxt_re_qp, qplib_qp); | |
| 2921 | + if (send_phantom_wqe(qp) == -ENOMEM) | |
| 2922 | + dev_err(rdev_to_dev(cq->rdev), | |
| 2923 | + "Phantom failed! Scheduled to send again\n"); | |
| 2924 | + else | |
| 2925 | + sq->send_phantom = false; | |
| 2926 | + } | |
| 2927 | + } | |
| 2928 | + | |
| 2665 | 2929 | if (!ncqe) |
| 2666 | 2930 | break; |
| 2667 | 2931 | |
| @@ -2822,6 +3086,12 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr) · 154 unmodified lines | ||
| 2822 | 3086 | struct bnxt_re_dev *rdev = mr->rdev; |
| 2823 | 3087 | int rc; |
| 2824 | 3088 | |
| 3089 | + rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr); | |
| 3090 | + if (rc) { | |
| 3091 | + dev_err(rdev_to_dev(rdev), "Dereg MR failed: %#x\n", rc); | |
| 3092 | + return rc; | |
| 3093 | + } | |
| 3094 | + | |
| 2825 | 3095 | if (mr->npages && mr->pages) { |
| 2826 | 3096 | rc = bnxt_qplib_free_fast_reg_page_list(&rdev->qplib_res, |
| 2827 | 3097 | &mr->qplib_frpl); |
| @@ -2829,8 +3099,6 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr) · 1 unmodified line | ||
| 2829 | 3099 | mr->npages = 0; |
| 2830 | 3100 | mr->pages = NULL; |
| 2831 | 3101 | } |
| 2832 | − rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr); | |
| 2833 | − | |
| 2834 | 3102 | if (!IS_ERR_OR_NULL(mr->ib_umem)) |
| 2835 | 3103 | ib_umem_release(mr->ib_umem); |
| 2836 | 3104 | |
| @@ -2914,97 +3182,52 @@ fail: · 77 unmodified lines | ||
| 2914 | 3182 | return ERR_PTR(rc); |
| 2915 | 3183 | } |
| 2916 | 3184 | |
| 2917 | −/* Fast Memory Regions */ | |
| 2918 | −struct ib_fmr *bnxt_re_alloc_fmr(struct ib_pd *ib_pd, int mr_access_flags, | |
| 2919 | − struct ib_fmr_attr *fmr_attr) | |
| 3185 | +struct ib_mw *bnxt_re_alloc_mw(struct ib_pd *ib_pd, enum ib_mw_type type, | |
| 3186 | + struct ib_udata *udata) | |
| 2920 | 3187 | { |
| 2921 | 3188 | struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd); |
| 2922 | 3189 | struct bnxt_re_dev *rdev = pd->rdev; |
| 2923 | − struct bnxt_re_fmr *fmr; | |
| 3190 | + struct bnxt_re_mw *mw; | |
| 2924 | 3191 | int rc; |
| 2925 | 3192 | |
| 2926 | − if (fmr_attr->max_pages > MAX_PBL_LVL_2_PGS || | |
| 2927 | − fmr_attr->max_maps > rdev->dev_attr.max_map_per_fmr) { | |
| 2928 | − dev_err(rdev_to_dev(rdev), "Allocate FMR exceeded Max limit"); | |
| 3193 | + mw = kzalloc(sizeof(*mw), GFP_KERNEL); | |
| 3194 | + if (!mw) | |
| 2929 | 3195 | return ERR_PTR(-ENOMEM); |
| 2930 | − } | |
| 2931 | − fmr = kzalloc(sizeof(*fmr), GFP_KERNEL); | |
| 2932 | − if (!fmr) | |
| 2933 | − return ERR_PTR(-ENOMEM); | |
| 2934 | − | |
| 2935 | − fmr->rdev = rdev; | |
| 2936 | − fmr->qplib_fmr.pd = &pd->qplib_pd; | |
| 2937 | − fmr->qplib_fmr.type = CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR; | |
| 3196 | + mw->rdev = rdev; | |
| 3197 | + mw->qplib_mw.pd = &pd->qplib_pd; | |
| 2938 | 3198 | |
| 2939 | − rc = bnxt_qplib_alloc_mrw(&rdev->qplib_res, &fmr->qplib_fmr); | |
| 2940 | − if (rc) | |
| 3199 | + mw->qplib_mw.type = (type == IB_MW_TYPE_1 ? | |
| 3200 | + CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1 : | |
| 3201 | + CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B); | |
| 3202 | + rc = bnxt_qplib_alloc_mrw(&rdev->qplib_res, &mw->qplib_mw); | |
| 3203 | + if (rc) { | |
| 3204 | + dev_err(rdev_to_dev(rdev), "Allocate MW failed!"); | |
| 2941 | 3205 | goto fail; |
| 3206 | + } | |
| 3207 | + mw->ib_mw.rkey = mw->qplib_mw.rkey; | |
| 2942 | 3208 | |
| 2943 | − fmr->qplib_fmr.flags = __from_ib_access_flags(mr_access_flags); | |
| 2944 | − fmr->ib_fmr.lkey = fmr->qplib_fmr.lkey; | |
| 2945 | − fmr->ib_fmr.rkey = fmr->ib_fmr.lkey; | |
| 3209 | + atomic_inc(&rdev->mw_count); | |
| 3210 | + return &mw->ib_mw; | |
| 2946 | 3211 | |
| 2947 | − atomic_inc(&rdev->mr_count); | |
| 2948 | − return &fmr->ib_fmr; | |
| 2949 | 3212 | fail: |
| 2950 | − kfree(fmr); | |
| 3213 | + kfree(mw); | |
| 2951 | 3214 | return ERR_PTR(rc); |
| 2952 | 3215 | } |
| 2953 | 3216 | |
| 2954 | −int bnxt_re_map_phys_fmr(struct ib_fmr *ib_fmr, u64 *page_list, int list_len, | |
| 2955 | − u64 iova) | |
| 3217 | +int bnxt_re_dealloc_mw(struct ib_mw *ib_mw) | |
| 2956 | 3218 | { |
| 2957 | − struct bnxt_re_fmr *fmr = container_of(ib_fmr, struct bnxt_re_fmr, | |
| 2958 | − ib_fmr); | |
| 2959 | − struct bnxt_re_dev *rdev = fmr->rdev; | |
| 3219 | + struct bnxt_re_mw *mw = container_of(ib_mw, struct bnxt_re_mw, ib_mw); | |
| 3220 | + struct bnxt_re_dev *rdev = mw->rdev; | |
| 2960 | 3221 | int rc; |
| 2961 | 3222 | |
| 2962 | − fmr->qplib_fmr.va = iova; | |
| 2963 | − fmr->qplib_fmr.total_size = list_len * PAGE_SIZE; | |
| 2964 | − | |
| 2965 | − rc = bnxt_qplib_reg_mr(&rdev->qplib_res, &fmr->qplib_fmr, page_list, | |
| 2966 | − list_len, true); | |
| 2967 | − if (rc) | |
| 2968 | − dev_err(rdev_to_dev(rdev), "Failed to map FMR for lkey = 0x%x!", | |
| 2969 | − fmr->ib_fmr.lkey); | |
| 2970 | − return rc; | |
| 2971 | −} | |
| 2972 | − | |
| 2973 | −int bnxt_re_unmap_fmr(struct list_head *fmr_list) | |
| 2974 | −{ | |
| 2975 | − struct bnxt_re_dev *rdev; | |
| 2976 | − struct bnxt_re_fmr *fmr; | |
| 2977 | − struct ib_fmr *ib_fmr; | |
| 2978 | − int rc = 0; | |
| 2979 | − | |
| 2980 | − /* Validate each FMRs inside the fmr_list */ | |
| 2981 | − list_for_each_entry(ib_fmr, fmr_list, list) { | |
| 2982 | − fmr = container_of(ib_fmr, struct bnxt_re_fmr, ib_fmr); | |
| 2983 | − rdev = fmr->rdev; | |
| 2984 | − | |
| 2985 | − if (rdev) { | |
| 2986 | − rc = bnxt_qplib_dereg_mrw(&rdev->qplib_res, | |
| 2987 | − &fmr->qplib_fmr, true); | |
| 2988 | − if (rc) | |
| 2989 | − break; | |
| 2990 | − } | |
| 3223 | + rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mw->qplib_mw); | |
| 3224 | + if (rc) { | |
| 3225 | + dev_err(rdev_to_dev(rdev), "Free MW failed: %#x\n", rc); | |
| 3226 | + return rc; | |
| 2991 | 3227 | } |
| 2992 | − return rc; | |
| 2993 | −} | |
| 2994 | − | |
| 2995 | −int bnxt_re_dealloc_fmr(struct ib_fmr *ib_fmr) | |
| 2996 | −{ | |
| 2997 | − struct bnxt_re_fmr *fmr = container_of(ib_fmr, struct bnxt_re_fmr, | |
| 2998 | − ib_fmr); | |
| 2999 | − struct bnxt_re_dev *rdev = fmr->rdev; | |
| 3000 | − int rc; | |
| 3001 | 3228 | |
| 3002 | − rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &fmr->qplib_fmr); | |
| 3003 | − if (rc) | |
| 3004 | − dev_err(rdev_to_dev(rdev), "Failed to free FMR"); | |
| 3005 | − | |
| 3006 | − kfree(fmr); | |
| 3007 | − atomic_dec(&rdev->mr_count); | |
| 3229 | + kfree(mw); | |
| 3230 | + atomic_dec(&rdev->mw_count); | |
| 3008 | 3231 | return rc; |
| 3009 | 3232 | } |
| 3010 | 3233 | |
| @@ -44,11 +44,23 @@ struct bnxt_re_gid_ctx { · 43 unmodified lines | ||
| 44 | 44 | u32 refcnt; |
| 45 | 45 | }; |
| 46 | 46 | |
| 47 | +#define BNXT_RE_FENCE_BYTES 64 | |
| 48 | +struct bnxt_re_fence_data { | |
| 49 | + u32 size; | |
| 50 | + u8 va[BNXT_RE_FENCE_BYTES]; | |
| 51 | + dma_addr_t dma_addr; | |
| 52 | + struct bnxt_re_mr *mr; | |
| 53 | + struct ib_mw *mw; | |
| 54 | + struct bnxt_qplib_swqe bind_wqe; | |
| 55 | + u32 bind_rkey; | |
| 56 | +}; | |
| 57 | + | |
| 47 | 58 | struct bnxt_re_pd { |
| 48 | 59 | struct bnxt_re_dev *rdev; |
| 49 | 60 | struct ib_pd ib_pd; |
| 50 | 61 | struct bnxt_qplib_pd qplib_pd; |
| 51 | 62 | struct bnxt_qplib_dpi dpi; |
| 63 | + struct bnxt_re_fence_data fence; | |
| 52 | 64 | }; |
| 53 | 65 | |
| 54 | 66 | struct bnxt_re_ah { |
| @@ -62,6 +74,7 @@ struct bnxt_re_qp { · 7 unmodified lines | ||
| 62 | 74 | struct bnxt_re_dev *rdev; |
| 63 | 75 | struct ib_qp ib_qp; |
| 64 | 76 | spinlock_t sq_lock; /* protect sq */ |
| 77 | + spinlock_t rq_lock; /* protect rq */ | |
| 65 | 78 | struct bnxt_qplib_qp qplib_qp; |
| 66 | 79 | struct ib_umem *sumem; |
| 67 | 80 | struct ib_umem *rumem; |
| @@ -181,12 +194,9 @@ int bnxt_re_map_mr_sg(struct ib_mr *ib_mr, struct scatterlist *sg, int sg_nents, · 113 unmodified lines | ||
| 181 | 194 | struct ib_mr *bnxt_re_alloc_mr(struct ib_pd *ib_pd, enum ib_mr_type mr_type, |
| 182 | 195 | u32 max_num_sg); |
| 183 | 196 | int bnxt_re_dereg_mr(struct ib_mr *mr); |
| 184 | −struct ib_fmr *bnxt_re_alloc_fmr(struct ib_pd *pd, int mr_access_flags, | |
| 185 | − struct ib_fmr_attr *fmr_attr); | |
| 186 | −int bnxt_re_map_phys_fmr(struct ib_fmr *fmr, u64 *page_list, int list_len, | |
| 187 | − u64 iova); | |
| 188 | −int bnxt_re_unmap_fmr(struct list_head *fmr_list); | |
| 189 | −int bnxt_re_dealloc_fmr(struct ib_fmr *fmr); | |
| 197 | +struct ib_mw *bnxt_re_alloc_mw(struct ib_pd *ib_pd, enum ib_mw_type type, | |
| 198 | + struct ib_udata *udata); | |
| 199 | +int bnxt_re_dealloc_mw(struct ib_mw *mw); | |
| 190 | 200 | struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, |
| 191 | 201 | u64 virt_addr, int mr_access_flags, |
| 192 | 202 | struct ib_udata *udata); |
| @@ -507,10 +507,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) · 506 unmodified lines | ||
| 507 | 507 | ibdev->dereg_mr = bnxt_re_dereg_mr; |
| 508 | 508 | ibdev->alloc_mr = bnxt_re_alloc_mr; |
| 509 | 509 | ibdev->map_mr_sg = bnxt_re_map_mr_sg; |
| 510 | − ibdev->alloc_fmr = bnxt_re_alloc_fmr; | |
| 511 | − ibdev->map_phys_fmr = bnxt_re_map_phys_fmr; | |
| 512 | − ibdev->unmap_fmr = bnxt_re_unmap_fmr; | |
| 513 | − ibdev->dealloc_fmr = bnxt_re_dealloc_fmr; | |
| 514 | 510 | |
| 515 | 511 | ibdev->reg_user_mr = bnxt_re_reg_user_mr; |
| 516 | 512 | ibdev->alloc_ucontext = bnxt_re_alloc_ucontext; |
| @@ -284,7 +284,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 283 unmodified lines | ||
| 284 | 284 | { |
| 285 | 285 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 286 | 286 | struct cmdq_create_qp1 req; |
| 287 | − struct creq_create_qp1_resp *resp; | |
| 287 | + struct creq_create_qp1_resp resp; | |
| 288 | 288 | struct bnxt_qplib_pbl *pbl; |
| 289 | 289 | struct bnxt_qplib_q *sq = &qp->sq; |
| 290 | 290 | struct bnxt_qplib_q *rq = &qp->rq; |
| @@ -394,31 +394,12 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 103 unmodified lines | ||
| 394 | 394 | |
| 395 | 395 | req.pd_id = cpu_to_le32(qp->pd->id); |
| 396 | 396 | |
| 397 | − resp = (struct creq_create_qp1_resp *) | |
| 398 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 399 | − NULL, 0); | |
| 400 | − if (!resp) { | |
| 401 | − dev_err(&res->pdev->dev, "QPLIB: FP: CREATE_QP1 send failed"); | |
| 402 | − rc = -EINVAL; | |
| 403 | − goto fail; | |
| 404 | − } | |
| 405 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 406 | − /* Cmd timed out */ | |
| 407 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP1 timed out"); | |
| 408 | − rc = -ETIMEDOUT; | |
| 409 | − goto fail; | |
| 410 | − } | |
| 411 | − if (resp->status || | |
| 412 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 413 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP1 failed "); | |
| 414 | − dev_err(&rcfw->pdev->dev, | |
| 415 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 416 | − resp->status, le16_to_cpu(req.cookie), | |
| 417 | − le16_to_cpu(resp->cookie)); | |
| 418 | − rc = -EINVAL; | |
| 397 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 398 | + (void *)&resp, NULL, 0); | |
| 399 | + if (rc) | |
| 419 | 400 | goto fail; |
| 420 | − } | |
| 421 | − qp->id = le32_to_cpu(resp->xid); | |
| 401 | + | |
| 402 | + qp->id = le32_to_cpu(resp.xid); | |
| 422 | 403 | qp->cur_qp_state = CMDQ_MODIFY_QP_NEW_STATE_RESET; |
| 423 | 404 | sq->flush_in_progress = false; |
| 424 | 405 | rq->flush_in_progress = false; |
| @@ -442,7 +423,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 17 unmodified lines | ||
| 442 | 423 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 443 | 424 | struct sq_send *hw_sq_send_hdr, **hw_sq_send_ptr; |
| 444 | 425 | struct cmdq_create_qp req; |
| 445 | − struct creq_create_qp_resp *resp; | |
| 426 | + struct creq_create_qp_resp resp; | |
| 446 | 427 | struct bnxt_qplib_pbl *pbl; |
| 447 | 428 | struct sq_psn_search **psn_search_ptr; |
| 448 | 429 | unsigned long int psn_search, poff = 0; |
| @@ -627,31 +608,12 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 178 unmodified lines | ||
| 627 | 608 | } |
| 628 | 609 | req.pd_id = cpu_to_le32(qp->pd->id); |
| 629 | 610 | |
| 630 | − resp = (struct creq_create_qp_resp *) | |
| 631 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 632 | − NULL, 0); | |
| 633 | − if (!resp) { | |
| 634 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP send failed"); | |
| 635 | − rc = -EINVAL; | |
| 636 | − goto fail; | |
| 637 | − } | |
| 638 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 639 | − /* Cmd timed out */ | |
| 640 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP timed out"); | |
| 641 | − rc = -ETIMEDOUT; | |
| 642 | − goto fail; | |
| 643 | − } | |
| 644 | − if (resp->status || | |
| 645 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 646 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_QP failed "); | |
| 647 | − dev_err(&rcfw->pdev->dev, | |
| 648 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 649 | − resp->status, le16_to_cpu(req.cookie), | |
| 650 | − le16_to_cpu(resp->cookie)); | |
| 651 | − rc = -EINVAL; | |
| 611 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 612 | + (void *)&resp, NULL, 0); | |
| 613 | + if (rc) | |
| 652 | 614 | goto fail; |
| 653 | − } | |
| 654 | − qp->id = le32_to_cpu(resp->xid); | |
| 615 | + | |
| 616 | + qp->id = le32_to_cpu(resp.xid); | |
| 655 | 617 | qp->cur_qp_state = CMDQ_MODIFY_QP_NEW_STATE_RESET; |
| 656 | 618 | sq->flush_in_progress = false; |
| 657 | 619 | rq->flush_in_progress = false; |
| @@ -769,10 +731,11 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 111 unmodified lines | ||
| 769 | 731 | { |
| 770 | 732 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 771 | 733 | struct cmdq_modify_qp req; |
| 772 | − struct creq_modify_qp_resp *resp; | |
| 734 | + struct creq_modify_qp_resp resp; | |
| 773 | 735 | u16 cmd_flags = 0, pkey; |
| 774 | 736 | u32 temp32[4]; |
| 775 | 737 | u32 bmask; |
| 738 | + int rc; | |
| 776 | 739 | |
| 777 | 740 | RCFW_CMD_PREP(req, MODIFY_QP, cmd_flags); |
| 778 | 741 | |
| @@ -862,27 +825,10 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 83 unmodified lines | ||
| 862 | 825 | |
| 863 | 826 | req.vlan_pcp_vlan_dei_vlan_id = cpu_to_le16(qp->vlan_id); |
| 864 | 827 | |
| 865 | − resp = (struct creq_modify_qp_resp *) | |
| 866 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 867 | − NULL, 0); | |
| 868 | − if (!resp) { | |
| 869 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: MODIFY_QP send failed"); | |
| 870 | − return -EINVAL; | |
| 871 | − } | |
| 872 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 873 | − /* Cmd timed out */ | |
| 874 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: MODIFY_QP timed out"); | |
| 875 | − return -ETIMEDOUT; | |
| 876 | − } | |
| 877 | − if (resp->status || | |
| 878 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 879 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: MODIFY_QP failed "); | |
| 880 | − dev_err(&rcfw->pdev->dev, | |
| 881 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 882 | − resp->status, le16_to_cpu(req.cookie), | |
| 883 | − le16_to_cpu(resp->cookie)); | |
| 884 | − return -EINVAL; | |
| 885 | − } | |
| 828 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 829 | + (void *)&resp, NULL, 0); | |
| 830 | + if (rc) | |
| 831 | + return rc; | |
| 886 | 832 | qp->cur_qp_state = qp->state; |
| 887 | 833 | return 0; |
| 888 | 834 | } |
| @@ -891,37 +837,26 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 2 unmodified lines | ||
| 891 | 837 | { |
| 892 | 838 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 893 | 839 | struct cmdq_query_qp req; |
| 894 | − struct creq_query_qp_resp *resp; | |
| 840 | + struct creq_query_qp_resp resp; | |
| 841 | + struct bnxt_qplib_rcfw_sbuf *sbuf; | |
| 895 | 842 | struct creq_query_qp_resp_sb *sb; |
| 896 | 843 | u16 cmd_flags = 0; |
| 897 | 844 | u32 temp32[4]; |
| 898 | − int i; | |
| 845 | + int i, rc = 0; | |
| 899 | 846 | |
| 900 | 847 | RCFW_CMD_PREP(req, QUERY_QP, cmd_flags); |
| 901 | 848 | |
| 849 | + sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); | |
| 850 | + if (!sbuf) | |
| 851 | + return -ENOMEM; | |
| 852 | + sb = sbuf->sb; | |
| 853 | + | |
| 902 | 854 | req.qp_cid = cpu_to_le32(qp->id); |
| 903 | 855 | req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS; |
| 904 | − resp = (struct creq_query_qp_resp *) | |
| 905 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 906 | − (void **)&sb, 0); | |
| 907 | − if (!resp) { | |
| 908 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: QUERY_QP send failed"); | |
| 909 | − return -EINVAL; | |
| 910 | − } | |
| 911 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 912 | − /* Cmd timed out */ | |
| 913 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: QUERY_QP timed out"); | |
| 914 | − return -ETIMEDOUT; | |
| 915 | − } | |
| 916 | − if (resp->status || | |
| 917 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 918 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: QUERY_QP failed "); | |
| 919 | − dev_err(&rcfw->pdev->dev, | |
| 920 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 921 | − resp->status, le16_to_cpu(req.cookie), | |
| 922 | − le16_to_cpu(resp->cookie)); | |
| 923 | − return -EINVAL; | |
| 924 | − } | |
| 856 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, | |
| 857 | + (void *)sbuf, 0); | |
| 858 | + if (rc) | |
| 859 | + goto bail; | |
| 925 | 860 | /* Extract the context from the side buffer */ |
| 926 | 861 | qp->state = sb->en_sqd_async_notify_state & |
| 927 | 862 | CREQ_QUERY_QP_RESP_SB_STATE_MASK; |
| @@ -976,7 +911,9 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 48 unmodified lines | ||
| 976 | 911 | qp->dest_qpn = le32_to_cpu(sb->dest_qp_id); |
| 977 | 912 | memcpy(qp->smac, sb->src_mac, 6); |
| 978 | 913 | qp->vlan_id = le16_to_cpu(sb->vlan_pcp_vlan_dei_vlan_id); |
| 979 | − return 0; | |
| 914 | +bail: | |
| 915 | + bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf); | |
| 916 | + return rc; | |
| 980 | 917 | } |
| 981 | 918 | |
| 982 | 919 | static void __clean_cq(struct bnxt_qplib_cq *cq, u64 qp) |
| @@ -1021,34 +958,18 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, · 38 unmodified lines | ||
| 1021 | 958 | { |
| 1022 | 959 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 1023 | 960 | struct cmdq_destroy_qp req; |
| 1024 | − struct creq_destroy_qp_resp *resp; | |
| 961 | + struct creq_destroy_qp_resp resp; | |
| 1025 | 962 | unsigned long flags; |
| 1026 | 963 | u16 cmd_flags = 0; |
| 964 | + int rc; | |
| 1027 | 965 | |
| 1028 | 966 | RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags); |
| 1029 | 967 | |
| 1030 | 968 | req.qp_cid = cpu_to_le32(qp->id); |
| 1031 | − resp = (struct creq_destroy_qp_resp *) | |
| 1032 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 1033 | − NULL, 0); | |
| 1034 | − if (!resp) { | |
| 1035 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_QP send failed"); | |
| 1036 | − return -EINVAL; | |
| 1037 | − } | |
| 1038 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 1039 | − /* Cmd timed out */ | |
| 1040 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_QP timed out"); | |
| 1041 | − return -ETIMEDOUT; | |
| 1042 | − } | |
| 1043 | − if (resp->status || | |
| 1044 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 1045 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_QP failed "); | |
| 1046 | − dev_err(&rcfw->pdev->dev, | |
| 1047 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 1048 | − resp->status, le16_to_cpu(req.cookie), | |
| 1049 | − le16_to_cpu(resp->cookie)); | |
| 1050 | − return -EINVAL; | |
| 1051 | − } | |
| 969 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 970 | + (void *)&resp, NULL, 0); | |
| 971 | + if (rc) | |
| 972 | + return rc; | |
| 1052 | 973 | |
| 1053 | 974 | /* Must walk the associated CQs to nullified the QP ptr */ |
| 1054 | 975 | spin_lock_irqsave(&qp->scq->hwq.lock, flags); |
| @@ -1162,8 +1083,12 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp, · 107 unmodified lines | ||
| 1162 | 1083 | rc = -EINVAL; |
| 1163 | 1084 | goto done; |
| 1164 | 1085 | } |
| 1165 | − if (HWQ_CMP((sq->hwq.prod + 1), &sq->hwq) == | |
| 1166 | − HWQ_CMP(sq->hwq.cons, &sq->hwq)) { | |
| 1086 | + | |
| 1087 | + if (bnxt_qplib_queue_full(sq)) { | |
| 1088 | + dev_err(&sq->hwq.pdev->dev, | |
| 1089 | + "QPLIB: prod = %#x cons = %#x qdepth = %#x delta = %#x", | |
| 1090 | + sq->hwq.prod, sq->hwq.cons, sq->hwq.max_elements, | |
| 1091 | + sq->q_full_delta); | |
| 1167 | 1092 | rc = -ENOMEM; |
| 1168 | 1093 | goto done; |
| 1169 | 1094 | } |
| @@ -1373,6 +1298,9 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp, · 203 unmodified lines | ||
| 1373 | 1298 | } |
| 1374 | 1299 | |
| 1375 | 1300 | sq->hwq.prod++; |
| 1301 | + | |
| 1302 | + qp->wqe_cnt++; | |
| 1303 | + | |
| 1376 | 1304 | done: |
| 1377 | 1305 | return rc; |
| 1378 | 1306 | } |
| @@ -1411,8 +1339,7 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp, · 32 unmodified lines | ||
| 1411 | 1339 | rc = -EINVAL; |
| 1412 | 1340 | goto done; |
| 1413 | 1341 | } |
| 1414 | − if (HWQ_CMP((rq->hwq.prod + 1), &rq->hwq) == | |
| 1415 | − HWQ_CMP(rq->hwq.cons, &rq->hwq)) { | |
| 1342 | + if (bnxt_qplib_queue_full(rq)) { | |
| 1416 | 1343 | dev_err(&rq->hwq.pdev->dev, |
| 1417 | 1344 | "QPLIB: FP: QP (0x%x) RQ is full!", qp->id); |
| 1418 | 1345 | rc = -EINVAL; |
| @@ -1483,7 +1410,7 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) · 64 unmodified lines | ||
| 1483 | 1410 | { |
| 1484 | 1411 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 1485 | 1412 | struct cmdq_create_cq req; |
| 1486 | − struct creq_create_cq_resp *resp; | |
| 1413 | + struct creq_create_cq_resp resp; | |
| 1487 | 1414 | struct bnxt_qplib_pbl *pbl; |
| 1488 | 1415 | u16 cmd_flags = 0; |
| 1489 | 1416 | int rc; |
| @@ -1525,30 +1452,12 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) · 35 unmodified lines | ||
| 1525 | 1452 | (cq->cnq_hw_ring_id & CMDQ_CREATE_CQ_CNQ_ID_MASK) << |
| 1526 | 1453 | CMDQ_CREATE_CQ_CNQ_ID_SFT); |
| 1527 | 1454 | |
| 1528 | − resp = (struct creq_create_cq_resp *) | |
| 1529 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 1530 | − NULL, 0); | |
| 1531 | − if (!resp) { | |
| 1532 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_CQ send failed"); | |
| 1533 | − return -EINVAL; | |
| 1534 | − } | |
| 1535 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 1536 | − /* Cmd timed out */ | |
| 1537 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_CQ timed out"); | |
| 1538 | − rc = -ETIMEDOUT; | |
| 1539 | − goto fail; | |
| 1540 | − } | |
| 1541 | − if (resp->status || | |
| 1542 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 1543 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: CREATE_CQ failed "); | |
| 1544 | − dev_err(&rcfw->pdev->dev, | |
| 1545 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 1546 | − resp->status, le16_to_cpu(req.cookie), | |
| 1547 | − le16_to_cpu(resp->cookie)); | |
| 1548 | − rc = -EINVAL; | |
| 1455 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 1456 | + (void *)&resp, NULL, 0); | |
| 1457 | + if (rc) | |
| 1549 | 1458 | goto fail; |
| 1550 | − } | |
| 1551 | − cq->id = le32_to_cpu(resp->xid); | |
| 1459 | + | |
| 1460 | + cq->id = le32_to_cpu(resp.xid); | |
| 1552 | 1461 | cq->dbr_base = res->dpi_tbl.dbr_bar_reg_iomem; |
| 1553 | 1462 | cq->period = BNXT_QPLIB_QUEUE_START_PERIOD; |
| 1554 | 1463 | init_waitqueue_head(&cq->waitq); |
| @@ -1566,33 +1475,17 @@ int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) · 11 unmodified lines | ||
| 1566 | 1475 | { |
| 1567 | 1476 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 1568 | 1477 | struct cmdq_destroy_cq req; |
| 1569 | − struct creq_destroy_cq_resp *resp; | |
| 1478 | + struct creq_destroy_cq_resp resp; | |
| 1570 | 1479 | u16 cmd_flags = 0; |
| 1480 | + int rc; | |
| 1571 | 1481 | |
| 1572 | 1482 | RCFW_CMD_PREP(req, DESTROY_CQ, cmd_flags); |
| 1573 | 1483 | |
| 1574 | 1484 | req.cq_cid = cpu_to_le32(cq->id); |
| 1575 | − resp = (struct creq_destroy_cq_resp *) | |
| 1576 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 1577 | − NULL, 0); | |
| 1578 | − if (!resp) { | |
| 1579 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_CQ send failed"); | |
| 1580 | − return -EINVAL; | |
| 1581 | − } | |
| 1582 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 1583 | − /* Cmd timed out */ | |
| 1584 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_CQ timed out"); | |
| 1585 | − return -ETIMEDOUT; | |
| 1586 | − } | |
| 1587 | − if (resp->status || | |
| 1588 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 1589 | − dev_err(&rcfw->pdev->dev, "QPLIB: FP: DESTROY_CQ failed "); | |
| 1590 | − dev_err(&rcfw->pdev->dev, | |
| 1591 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 1592 | − resp->status, le16_to_cpu(req.cookie), | |
| 1593 | − le16_to_cpu(resp->cookie)); | |
| 1594 | − return -EINVAL; | |
| 1595 | − } | |
| 1485 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 1486 | + (void *)&resp, NULL, 0); | |
| 1487 | + if (rc) | |
| 1488 | + return rc; | |
| 1596 | 1489 | bnxt_qplib_free_hwq(res->pdev, &cq->hwq); |
| 1597 | 1490 | return 0; |
| 1598 | 1491 | } |
| @@ -1664,14 +1557,113 @@ static int __flush_rq(struct bnxt_qplib_q *rq, struct bnxt_qplib_qp *qp, · 65 unmodified lines | ||
| 1664 | 1557 | return rc; |
| 1665 | 1558 | } |
| 1666 | 1559 | |
| 1560 | +/* Note: SQE is valid from sw_sq_cons up to cqe_sq_cons (exclusive) | |
| 1561 | + * CQE is track from sw_cq_cons to max_element but valid only if VALID=1 | |
| 1562 | + */ | |
| 1563 | +static int do_wa9060(struct bnxt_qplib_qp *qp, struct bnxt_qplib_cq *cq, | |
| 1564 | + u32 cq_cons, u32 sw_sq_cons, u32 cqe_sq_cons) | |
| 1565 | +{ | |
| 1566 | + struct bnxt_qplib_q *sq = &qp->sq; | |
| 1567 | + struct bnxt_qplib_swq *swq; | |
| 1568 | + u32 peek_sw_cq_cons, peek_raw_cq_cons, peek_sq_cons_idx; | |
| 1569 | + struct cq_base *peek_hwcqe, **peek_hw_cqe_ptr; | |
| 1570 | + struct cq_req *peek_req_hwcqe; | |
| 1571 | + struct bnxt_qplib_qp *peek_qp; | |
| 1572 | + struct bnxt_qplib_q *peek_sq; | |
| 1573 | + int i, rc = 0; | |
| 1574 | + | |
| 1575 | + /* Normal mode */ | |
| 1576 | + /* Check for the psn_search marking before completing */ | |
| 1577 | + swq = &sq->swq[sw_sq_cons]; | |
| 1578 | + if (swq->psn_search && | |
| 1579 | + le32_to_cpu(swq->psn_search->flags_next_psn) & 0x80000000) { | |
| 1580 | + /* Unmark */ | |
| 1581 | + swq->psn_search->flags_next_psn = cpu_to_le32 | |
| 1582 | + (le32_to_cpu(swq->psn_search->flags_next_psn) | |
| 1583 | + & ~0x80000000); | |
| 1584 | + dev_dbg(&cq->hwq.pdev->dev, | |
| 1585 | + "FP: Process Req cq_cons=0x%x qp=0x%x sq cons sw=0x%x cqe=0x%x marked!\n", | |
| 1586 | + cq_cons, qp->id, sw_sq_cons, cqe_sq_cons); | |
| 1587 | + sq->condition = true; | |
| 1588 | + sq->send_phantom = true; | |
| 1589 | + | |
| 1590 | + /* TODO: Only ARM if the previous SQE is ARMALL */ | |
| 1591 | + bnxt_qplib_arm_cq(cq, DBR_DBR_TYPE_CQ_ARMALL); | |
| 1592 | + | |
| 1593 | + rc = -EAGAIN; | |
| 1594 | + goto out; | |
| 1595 | + } | |
| 1596 | + if (sq->condition) { | |
| 1597 | + /* Peek at the completions */ | |
| 1598 | + peek_raw_cq_cons = cq->hwq.cons; | |
| 1599 | + peek_sw_cq_cons = cq_cons; | |
| 1600 | + i = cq->hwq.max_elements; | |
| 1601 | + while (i--) { | |
| 1602 | + peek_sw_cq_cons = HWQ_CMP((peek_sw_cq_cons), &cq->hwq); | |
| 1603 | + peek_hw_cqe_ptr = (struct cq_base **)cq->hwq.pbl_ptr; | |
| 1604 | + peek_hwcqe = &peek_hw_cqe_ptr[CQE_PG(peek_sw_cq_cons)] | |
| 1605 | + [CQE_IDX(peek_sw_cq_cons)]; | |
| 1606 | + /* If the next hwcqe is VALID */ | |
| 1607 | + if (CQE_CMP_VALID(peek_hwcqe, peek_raw_cq_cons, | |
| 1608 | + cq->hwq.max_elements)) { | |
| 1609 | + /* If the next hwcqe is a REQ */ | |
| 1610 | + if ((peek_hwcqe->cqe_type_toggle & | |
| 1611 | + CQ_BASE_CQE_TYPE_MASK) == | |
| 1612 | + CQ_BASE_CQE_TYPE_REQ) { | |
| 1613 | + peek_req_hwcqe = (struct cq_req *) | |
| 1614 | + peek_hwcqe; | |
| 1615 | + peek_qp = (struct bnxt_qplib_qp *) | |
| 1616 | + ((unsigned long) | |
| 1617 | + le64_to_cpu | |
| 1618 | + (peek_req_hwcqe->qp_handle)); | |
| 1619 | + peek_sq = &peek_qp->sq; | |
| 1620 | + peek_sq_cons_idx = HWQ_CMP(le16_to_cpu( | |
| 1621 | + peek_req_hwcqe->sq_cons_idx) - 1 | |
| 1622 | + , &sq->hwq); | |
| 1623 | + /* If the hwcqe's sq's wr_id matches */ | |
| 1624 | + if (peek_sq == sq && | |
| 1625 | + sq->swq[peek_sq_cons_idx].wr_id == | |
| 1626 | + BNXT_QPLIB_FENCE_WRID) { | |
| 1627 | + /* | |
| 1628 | + * Unbreak only if the phantom | |
| 1629 | + * comes back | |
| 1630 | + */ | |
| 1631 | + dev_dbg(&cq->hwq.pdev->dev, | |
| 1632 | + "FP:Got Phantom CQE"); | |
| 1633 | + sq->condition = false; | |
| 1634 | + sq->single = true; | |
| 1635 | + rc = 0; | |
| 1636 | + goto out; | |
| 1637 | + } | |
| 1638 | + } | |
| 1639 | + /* Valid but not the phantom, so keep looping */ | |
| 1640 | + } else { | |
| 1641 | + /* Not valid yet, just exit and wait */ | |
| 1642 | + rc = -EINVAL; | |
| 1643 | + goto out; | |
| 1644 | + } | |
| 1645 | + peek_sw_cq_cons++; | |
| 1646 | + peek_raw_cq_cons++; | |
| 1647 | + } | |
| 1648 | + dev_err(&cq->hwq.pdev->dev, | |
| 1649 | + "Should not have come here! cq_cons=0x%x qp=0x%x sq cons sw=0x%x hw=0x%x", | |
| 1650 | + cq_cons, qp->id, sw_sq_cons, cqe_sq_cons); | |
| 1651 | + rc = -EINVAL; | |
| 1652 | + } | |
| 1653 | +out: | |
| 1654 | + return rc; | |
| 1655 | +} | |
| 1656 | + | |
| 1667 | 1657 | static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, |
| 1668 | 1658 | struct cq_req *hwcqe, |
| 1669 | − struct bnxt_qplib_cqe **pcqe, int *budget) | |
| 1659 | + struct bnxt_qplib_cqe **pcqe, int *budget, | |
| 1660 | + u32 cq_cons, struct bnxt_qplib_qp **lib_qp) | |
| 1670 | 1661 | { |
| 1671 | 1662 | struct bnxt_qplib_qp *qp; |
| 1672 | 1663 | struct bnxt_qplib_q *sq; |
| 1673 | 1664 | struct bnxt_qplib_cqe *cqe; |
| 1674 | − u32 sw_cons, cqe_cons; | |
| 1665 | + u32 sw_sq_cons, cqe_sq_cons; | |
| 1666 | + struct bnxt_qplib_swq *swq; | |
| 1675 | 1667 | int rc = 0; |
| 1676 | 1668 | |
| 1677 | 1669 | qp = (struct bnxt_qplib_qp *)((unsigned long) |
| @@ -1683,13 +1675,13 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, · 5 unmodified lines | ||
| 1683 | 1675 | } |
| 1684 | 1676 | sq = &qp->sq; |
| 1685 | 1677 | |
| 1686 | − cqe_cons = HWQ_CMP(le16_to_cpu(hwcqe->sq_cons_idx), &sq->hwq); | |
| 1687 | − if (cqe_cons > sq->hwq.max_elements) { | |
| 1678 | + cqe_sq_cons = HWQ_CMP(le16_to_cpu(hwcqe->sq_cons_idx), &sq->hwq); | |
| 1679 | + if (cqe_sq_cons > sq->hwq.max_elements) { | |
| 1688 | 1680 | dev_err(&cq->hwq.pdev->dev, |
| 1689 | 1681 | "QPLIB: FP: CQ Process req reported "); |
| 1690 | 1682 | dev_err(&cq->hwq.pdev->dev, |
| 1691 | 1683 | "QPLIB: sq_cons_idx 0x%x which exceeded max 0x%x", |
| 1692 | − cqe_cons, sq->hwq.max_elements); | |
| 1684 | + cqe_sq_cons, sq->hwq.max_elements); | |
| 1693 | 1685 | return -EINVAL; |
| 1694 | 1686 | } |
| 1695 | 1687 | /* If we were in the middle of flushing the SQ, continue */ |
| @@ -1698,53 +1690,74 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, · 2 unmodified lines | ||
| 1698 | 1690 | |
| 1699 | 1691 | /* Require to walk the sq's swq to fabricate CQEs for all previously |
| 1700 | 1692 | * signaled SWQEs due to CQE aggregation from the current sq cons |
| 1701 | − * to the cqe_cons | |
| 1693 | + * to the cqe_sq_cons | |
| 1702 | 1694 | */ |
| 1703 | 1695 | cqe = *pcqe; |
| 1704 | 1696 | while (*budget) { |
| 1705 | − sw_cons = HWQ_CMP(sq->hwq.cons, &sq->hwq); | |
| 1706 | − if (sw_cons == cqe_cons) | |
| 1697 | + sw_sq_cons = HWQ_CMP(sq->hwq.cons, &sq->hwq); | |
| 1698 | + if (sw_sq_cons == cqe_sq_cons) | |
| 1699 | + /* Done */ | |
| 1707 | 1700 | break; |
| 1701 | + | |
| 1702 | + swq = &sq->swq[sw_sq_cons]; | |
| 1708 | 1703 | memset(cqe, 0, sizeof(*cqe)); |
| 1709 | 1704 | cqe->opcode = CQ_BASE_CQE_TYPE_REQ; |
| 1710 | 1705 | cqe->qp_handle = (u64)(unsigned long)qp; |
| 1711 | 1706 | cqe->src_qp = qp->id; |
| 1712 | − cqe->wr_id = sq->swq[sw_cons].wr_id; | |
| 1713 | − cqe->type = sq->swq[sw_cons].type; | |
| 1707 | + cqe->wr_id = swq->wr_id; | |
| 1708 | + if (cqe->wr_id == BNXT_QPLIB_FENCE_WRID) | |
| 1709 | + goto skip; | |
| 1710 | + cqe->type = swq->type; | |
| 1714 | 1711 | |
| 1715 | 1712 | /* For the last CQE, check for status. For errors, regardless |
| 1716 | 1713 | * of the request being signaled or not, it must complete with |
| 1717 | 1714 | * the hwcqe error status |
| 1718 | 1715 | */ |
| 1719 | − if (HWQ_CMP((sw_cons + 1), &sq->hwq) == cqe_cons && | |
| 1716 | + if (HWQ_CMP((sw_sq_cons + 1), &sq->hwq) == cqe_sq_cons && | |
| 1720 | 1717 | hwcqe->status != CQ_REQ_STATUS_OK) { |
| 1721 | 1718 | cqe->status = hwcqe->status; |
| 1722 | 1719 | dev_err(&cq->hwq.pdev->dev, |
| 1723 | 1720 | "QPLIB: FP: CQ Processed Req "); |
| 1724 | 1721 | dev_err(&cq->hwq.pdev->dev, |
| 1725 | 1722 | "QPLIB: wr_id[%d] = 0x%llx with status 0x%x", |
| 1726 | − sw_cons, cqe->wr_id, cqe->status); | |
| 1723 | + sw_sq_cons, cqe->wr_id, cqe->status); | |
| 1727 | 1724 | cqe++; |
| 1728 | 1725 | (*budget)--; |
| 1729 | 1726 | sq->flush_in_progress = true; |
| 1730 | 1727 | /* Must block new posting of SQ and RQ */ |
| 1731 | 1728 | qp->state = CMDQ_MODIFY_QP_NEW_STATE_ERR; |
| 1729 | + sq->condition = false; | |
| 1730 | + sq->single = false; | |
| 1732 | 1731 | } else { |
| 1733 | − if (sq->swq[sw_cons].flags & | |
| 1734 | − SQ_SEND_FLAGS_SIGNAL_COMP) { | |
| 1732 | + if (swq->flags & SQ_SEND_FLAGS_SIGNAL_COMP) { | |
| 1733 | + /* Before we complete, do WA 9060 */ | |
| 1734 | + if (do_wa9060(qp, cq, cq_cons, sw_sq_cons, | |
| 1735 | + cqe_sq_cons)) { | |
| 1736 | + *lib_qp = qp; | |
| 1737 | + goto out; | |
| 1738 | + } | |
| 1735 | 1739 | cqe->status = CQ_REQ_STATUS_OK; |
| 1736 | 1740 | cqe++; |
| 1737 | 1741 | (*budget)--; |
| 1738 | 1742 | } |
| 1739 | 1743 | } |
| 1744 | +skip: | |
| 1740 | 1745 | sq->hwq.cons++; |
| 1746 | + if (sq->single) | |
| 1747 | + break; | |
| 1741 | 1748 | } |
| 1749 | +out: | |
| 1742 | 1750 | *pcqe = cqe; |
| 1743 | − if (!*budget && HWQ_CMP(sq->hwq.cons, &sq->hwq) != cqe_cons) { | |
| 1751 | + if (HWQ_CMP(sq->hwq.cons, &sq->hwq) != cqe_sq_cons) { | |
| 1744 | 1752 | /* Out of budget */ |
| 1745 | 1753 | rc = -EAGAIN; |
| 1746 | 1754 | goto done; |
| 1747 | 1755 | } |
| 1756 | + /* | |
| 1757 | + * Back to normal completion mode only after it has completed all of | |
| 1758 | + * the WC for this CQE | |
| 1759 | + */ | |
| 1760 | + sq->single = false; | |
| 1748 | 1761 | if (!sq->flush_in_progress) |
| 1749 | 1762 | goto done; |
| 1750 | 1763 | flush: |
| @@ -2074,7 +2087,7 @@ static int bnxt_qplib_cq_process_cutoff(struct bnxt_qplib_cq *cq, · 323 unmodified lines | ||
| 2074 | 2087 | } |
| 2075 | 2088 | |
| 2076 | 2089 | int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, |
| 2077 | − int num_cqes) | |
| 2090 | + int num_cqes, struct bnxt_qplib_qp **lib_qp) | |
| 2078 | 2091 | { |
| 2079 | 2092 | struct cq_base *hw_cqe, **hw_cqe_ptr; |
| 2080 | 2093 | unsigned long flags; |
| @@ -2099,7 +2112,8 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, · 18 unmodified lines | ||
| 2099 | 2112 | case CQ_BASE_CQE_TYPE_REQ: |
| 2100 | 2113 | rc = bnxt_qplib_cq_process_req(cq, |
| 2101 | 2114 | (struct cq_req *)hw_cqe, |
| 2102 | − &cqe, &budget); | |
| 2115 | + &cqe, &budget, | |
| 2116 | + sw_cons, lib_qp); | |
| 2103 | 2117 | break; |
| 2104 | 2118 | case CQ_BASE_CQE_TYPE_RES_RC: |
| 2105 | 2119 | rc = bnxt_qplib_cq_process_res_rc(cq, |
| @@ -88,6 +88,7 @@ struct bnxt_qplib_swq { · 87 unmodified lines | ||
| 88 | 88 | |
| 89 | 89 | struct bnxt_qplib_swqe { |
| 90 | 90 | /* General */ |
| 91 | +#define BNXT_QPLIB_FENCE_WRID 0x46454E43 /* "FENC" */ | |
| 91 | 92 | u64 wr_id; |
| 92 | 93 | u8 reqs_type; |
| 93 | 94 | u8 type; |
| @@ -216,9 +217,16 @@ struct bnxt_qplib_q { · 122 unmodified lines | ||
| 216 | 217 | struct scatterlist *sglist; |
| 217 | 218 | u32 nmap; |
| 218 | 219 | u32 max_wqe; |
| 220 | + u16 q_full_delta; | |
| 219 | 221 | u16 max_sge; |
| 220 | 222 | u32 psn; |
| 221 | 223 | bool flush_in_progress; |
| 224 | + bool condition; | |
| 225 | + bool single; | |
| 226 | + bool send_phantom; | |
| 227 | + u32 phantom_wqe_cnt; | |
| 228 | + u32 phantom_cqe_cnt; | |
| 229 | + u32 next_cq_cons; | |
| 222 | 230 | }; |
| 223 | 231 | |
| 224 | 232 | struct bnxt_qplib_qp { |
| @@ -242,6 +250,7 @@ struct bnxt_qplib_qp { · 17 unmodified lines | ||
| 242 | 250 | u8 timeout; |
| 243 | 251 | u8 retry_cnt; |
| 244 | 252 | u8 rnr_retry; |
| 253 | + u64 wqe_cnt; | |
| 245 | 254 | u32 min_rnr_timer; |
| 246 | 255 | u32 max_rd_atomic; |
| 247 | 256 | u32 max_dest_rd_atomic; |
| @@ -301,6 +310,13 @@ struct bnxt_qplib_qp { · 53 unmodified lines | ||
| 301 | 310 | (!!((hdr)->cqe_type_toggle & CQ_BASE_TOGGLE) == \ |
| 302 | 311 | !((raw_cons) & (cp_bit))) |
| 303 | 312 | |
| 313 | +static inline bool bnxt_qplib_queue_full(struct bnxt_qplib_q *qplib_q) | |
| 314 | +{ | |
| 315 | + return HWQ_CMP((qplib_q->hwq.prod + qplib_q->q_full_delta), | |
| 316 | + &qplib_q->hwq) == HWQ_CMP(qplib_q->hwq.cons, | |
| 317 | + &qplib_q->hwq); | |
| 318 | +} | |
| 319 | + | |
| 304 | 320 | struct bnxt_qplib_cqe { |
| 305 | 321 | u8 status; |
| 306 | 322 | u8 type; |
| @@ -432,7 +448,7 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp, · 125 unmodified lines | ||
| 432 | 448 | int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq); |
| 433 | 449 | int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq); |
| 434 | 450 | int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, |
| 435 | − int num); | |
| 451 | + int num, struct bnxt_qplib_qp **qp); | |
| 436 | 452 | void bnxt_qplib_req_notify_cq(struct bnxt_qplib_cq *cq, u32 arm_type); |
| 437 | 453 | void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq); |
| 438 | 454 | int bnxt_qplib_alloc_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq); |
| @@ -39,72 +39,55 @@ · 38 unmodified lines | ||
| 39 | 39 | #include <linux/spinlock.h> |
| 40 | 40 | #include <linux/pci.h> |
| 41 | 41 | #include <linux/prefetch.h> |
| 42 | +#include <linux/delay.h> | |
| 43 | + | |
| 42 | 44 | #include "roce_hsi.h" |
| 43 | 45 | #include "qplib_res.h" |
| 44 | 46 | #include "qplib_rcfw.h" |
| 45 | 47 | static void bnxt_qplib_service_creq(unsigned long data); |
| 46 | 48 | |
| 47 | 49 | /* Hardware communication channel */ |
| 48 | −int bnxt_qplib_rcfw_wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie) | |
| 50 | +static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie) | |
| 49 | 51 | { |
| 50 | 52 | u16 cbit; |
| 51 | 53 | int rc; |
| 52 | 54 | |
| 53 | − cookie &= RCFW_MAX_COOKIE_VALUE; | |
| 54 | 55 | cbit = cookie % RCFW_MAX_OUTSTANDING_CMD; |
| 55 | − if (!test_bit(cbit, rcfw->cmdq_bitmap)) | |
| 56 | − dev_warn(&rcfw->pdev->dev, | |
| 57 | − "QPLIB: CMD bit %d for cookie 0x%x is not set?", | |
| 58 | − cbit, cookie); | |
| 59 | − | |
| 60 | 56 | rc = wait_event_timeout(rcfw->waitq, |
| 61 | 57 | !test_bit(cbit, rcfw->cmdq_bitmap), |
| 62 | 58 | msecs_to_jiffies(RCFW_CMD_WAIT_TIME_MS)); |
| 63 | − if (!rc) { | |
| 64 | − dev_warn(&rcfw->pdev->dev, | |
| 65 | − "QPLIB: Bono Error: timeout %d msec, msg {0x%x}\n", | |
| 66 | − RCFW_CMD_WAIT_TIME_MS, cookie); | |
| 67 | − } | |
| 68 | − | |
| 69 | − return rc; | |
| 59 | + return rc ? 0 : -ETIMEDOUT; | |
| 70 | 60 | }; |
| 71 | 61 | |
| 72 | −int bnxt_qplib_rcfw_block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie) | |
| 62 | +static int __block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie) | |
| 73 | 63 | { |
| 74 | − u32 count = -1; | |
| 64 | + u32 count = RCFW_BLOCKED_CMD_WAIT_COUNT; | |
| 75 | 65 | u16 cbit; |
| 76 | 66 | |
| 77 | − cookie &= RCFW_MAX_COOKIE_VALUE; | |
| 78 | 67 | cbit = cookie % RCFW_MAX_OUTSTANDING_CMD; |
| 79 | 68 | if (!test_bit(cbit, rcfw->cmdq_bitmap)) |
| 80 | 69 | goto done; |
| 81 | 70 | do { |
| 71 | + mdelay(1); /* 1m sec */ | |
| 82 | 72 | bnxt_qplib_service_creq((unsigned long)rcfw); |
| 83 | 73 | } while (test_bit(cbit, rcfw->cmdq_bitmap) && --count); |
| 84 | 74 | done: |
| 85 | − return count; | |
| 75 | + return count ? 0 : -ETIMEDOUT; | |
| 86 | 76 | }; |
| 87 | 77 | |
| 88 | −void *bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw, | |
| 89 | − struct cmdq_base *req, void **crsbe, | |
| 90 | − u8 is_block) | |
| 78 | +static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct cmdq_base *req, | |
| 79 | + struct creq_base *resp, void *sb, u8 is_block) | |
| 91 | 80 | { |
| 92 | − struct bnxt_qplib_crsq *crsq = &rcfw->crsq; | |
| 93 | 81 | struct bnxt_qplib_cmdqe *cmdqe, **cmdq_ptr; |
| 94 | 82 | struct bnxt_qplib_hwq *cmdq = &rcfw->cmdq; |
| 95 | − struct bnxt_qplib_hwq *crsb = &rcfw->crsb; | |
| 96 | − struct bnxt_qplib_crsqe *crsqe = NULL; | |
| 97 | − struct bnxt_qplib_crsbe **crsb_ptr; | |
| 83 | + struct bnxt_qplib_crsq *crsqe; | |
| 98 | 84 | u32 sw_prod, cmdq_prod; |
| 99 | − u8 retry_cnt = 0xFF; | |
| 100 | − dma_addr_t dma_addr; | |
| 101 | 85 | unsigned long flags; |
| 102 | 86 | u32 size, opcode; |
| 103 | 87 | u16 cookie, cbit; |
| 104 | 88 | int pg, idx; |
| 105 | 89 | u8 *preq; |
| 106 | 90 | |
| 107 | −retry: | |
| 108 | 91 | opcode = req->opcode; |
| 109 | 92 | if (!test_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->flags) && |
| 110 | 93 | (opcode != CMDQ_BASE_OPCODE_QUERY_FUNC && |
| @@ -112,63 +95,50 @@ retry: · 1 unmodified line | ||
| 112 | 95 | dev_err(&rcfw->pdev->dev, |
| 113 | 96 | "QPLIB: RCFW not initialized, reject opcode 0x%x", |
| 114 | 97 | opcode); |
| 115 | − return NULL; | |
| 98 | + return -EINVAL; | |
| 116 | 99 | } |
| 117 | 100 | |
| 118 | 101 | if (test_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->flags) && |
| 119 | 102 | opcode == CMDQ_BASE_OPCODE_INITIALIZE_FW) { |
| 120 | 103 | dev_err(&rcfw->pdev->dev, "QPLIB: RCFW already initialized!"); |
| 121 | − return NULL; | |
| 104 | + return -EINVAL; | |
| 122 | 105 | } |
| 123 | 106 | |
| 124 | 107 | /* Cmdq are in 16-byte units, each request can consume 1 or more |
| 125 | 108 | * cmdqe |
| 126 | 109 | */ |
| 127 | 110 | spin_lock_irqsave(&cmdq->lock, flags); |
| 128 | − if (req->cmd_size > cmdq->max_elements - | |
| 129 | − ((HWQ_CMP(cmdq->prod, cmdq) - HWQ_CMP(cmdq->cons, cmdq)) & | |
| 130 | − (cmdq->max_elements - 1))) { | |
| 111 | + if (req->cmd_size >= HWQ_FREE_SLOTS(cmdq)) { | |
| 131 | 112 | dev_err(&rcfw->pdev->dev, "QPLIB: RCFW: CMDQ is full!"); |
| 132 | 113 | spin_unlock_irqrestore(&cmdq->lock, flags); |
| 133 | − | |
| 134 | − if (!retry_cnt--) | |
| 135 | − return NULL; | |
| 136 | − goto retry; | |
| 114 | + return -EAGAIN; | |
| 137 | 115 | } |
| 138 | 116 | |
| 139 | − retry_cnt = 0xFF; | |
| 140 | 117 | |
| 141 | − cookie = atomic_inc_return(&rcfw->seq_num) & RCFW_MAX_COOKIE_VALUE; | |
| 118 | + cookie = rcfw->seq_num & RCFW_MAX_COOKIE_VALUE; | |
| 142 | 119 | cbit = cookie % RCFW_MAX_OUTSTANDING_CMD; |
| 143 | 120 | if (is_block) |
| 144 | 121 | cookie |= RCFW_CMD_IS_BLOCKING; |
| 122 | + | |
| 123 | + set_bit(cbit, rcfw->cmdq_bitmap); | |
| 145 | 124 | req->cookie = cpu_to_le16(cookie); |
| 146 | − if (test_and_set_bit(cbit, rcfw->cmdq_bitmap)) { | |
| 147 | − dev_err(&rcfw->pdev->dev, | |
| 148 | − "QPLIB: RCFW MAX outstanding cmd reached!"); | |
| 149 | − atomic_dec(&rcfw->seq_num); | |
| 125 | + crsqe = &rcfw->crsqe_tbl[cbit]; | |
| 126 | + if (crsqe->resp) { | |
| 150 | 127 | spin_unlock_irqrestore(&cmdq->lock, flags); |
| 151 | − | |
| 152 | − if (!retry_cnt--) | |
| 153 | − return NULL; | |
| 154 | − goto retry; | |
| 128 | + return -EBUSY; | |
| 155 | 129 | } |
| 156 | − /* Reserve a resp buffer slot if requested */ | |
| 157 | − if (req->resp_size && crsbe) { | |
| 158 | − spin_lock(&crsb->lock); | |
| 159 | − sw_prod = HWQ_CMP(crsb->prod, crsb); | |
| 160 | − crsb_ptr = (struct bnxt_qplib_crsbe **)crsb->pbl_ptr; | |
| 161 | − *crsbe = (void *)&crsb_ptr[get_crsb_pg(sw_prod)] | |
| 162 | − [get_crsb_idx(sw_prod)]; | |
| 163 | − bnxt_qplib_crsb_dma_next(crsb->pbl_dma_ptr, sw_prod, &dma_addr); | |
| 164 | − req->resp_addr = cpu_to_le64(dma_addr); | |
| 165 | − crsb->prod++; | |
| 166 | − spin_unlock(&crsb->lock); | |
| 167 | − | |
| 168 | − req->resp_size = (sizeof(struct bnxt_qplib_crsbe) + | |
| 169 | − BNXT_QPLIB_CMDQE_UNITS - 1) / | |
| 170 | − BNXT_QPLIB_CMDQE_UNITS; | |
| 130 | + memset(resp, 0, sizeof(*resp)); | |
| 131 | + crsqe->resp = (struct creq_qp_event *)resp; | |
| 132 | + crsqe->resp->cookie = req->cookie; | |
| 133 | + crsqe->req_size = req->cmd_size; | |
| 134 | + if (req->resp_size && sb) { | |
| 135 | + struct bnxt_qplib_rcfw_sbuf *sbuf = sb; | |
| 136 | + | |
| 137 | + req->resp_addr = cpu_to_le64(sbuf->dma_addr); | |
| 138 | + req->resp_size = (sbuf->size + BNXT_QPLIB_CMDQE_UNITS - 1) / | |
| 139 | + BNXT_QPLIB_CMDQE_UNITS; | |
| 171 | 140 | } |
| 141 | + | |
| 172 | 142 | cmdq_ptr = (struct bnxt_qplib_cmdqe **)cmdq->pbl_ptr; |
| 173 | 143 | preq = (u8 *)req; |
| 174 | 144 | size = req->cmd_size * BNXT_QPLIB_CMDQE_UNITS; |
| @@ -190,23 +160,24 @@ retry: · 15 unmodified lines | ||
| 190 | 160 | preq += min_t(u32, size, sizeof(*cmdqe)); |
| 191 | 161 | size -= min_t(u32, size, sizeof(*cmdqe)); |
| 192 | 162 | cmdq->prod++; |
| 163 | + rcfw->seq_num++; | |
| 193 | 164 | } while (size > 0); |
| 194 | 165 | |
| 166 | + rcfw->seq_num++; | |
| 167 | + | |
| 195 | 168 | cmdq_prod = cmdq->prod; |
| 196 | 169 | if (rcfw->flags & FIRMWARE_FIRST_FLAG) { |
| 197 | − /* The very first doorbell write is required to set this flag | |
| 198 | − * which prompts the FW to reset its internal pointers | |
| 170 | + /* The very first doorbell write | |
| 171 | + * is required to set this flag | |
| 172 | + * which prompts the FW to reset | |
| 173 | + * its internal pointers | |
| 199 | 174 | */ |
| 200 | 175 | cmdq_prod |= FIRMWARE_FIRST_FLAG; |
| 201 | 176 | rcfw->flags &= ~FIRMWARE_FIRST_FLAG; |
| 202 | 177 | } |
| 203 | − sw_prod = HWQ_CMP(crsq->prod, crsq); | |
| 204 | − crsqe = &crsq->crsq[sw_prod]; | |
| 205 | − memset(crsqe, 0, sizeof(*crsqe)); | |
| 206 | − crsq->prod++; | |
| 207 | − crsqe->req_size = req->cmd_size; | |
| 208 | 178 | |
| 209 | 179 | /* ring CMDQ DB */ |
| 180 | + wmb(); | |
| 210 | 181 | writel(cmdq_prod, rcfw->cmdq_bar_reg_iomem + |
| 211 | 182 | rcfw->cmdq_bar_reg_prod_off); |
| 212 | 183 | writel(RCFW_CMDQ_TRIG_VAL, rcfw->cmdq_bar_reg_iomem + |
| @@ -214,9 +185,56 @@ retry: · 1 unmodified line | ||
| 214 | 185 | done: |
| 215 | 186 | spin_unlock_irqrestore(&cmdq->lock, flags); |
| 216 | 187 | /* Return the CREQ response pointer */ |
| 217 | − return crsqe ? &crsqe->qp_event : NULL; | |
| 188 | + return 0; | |
| 218 | 189 | } |
| 219 | 190 | |
| 191 | +int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw, | |
| 192 | + struct cmdq_base *req, | |
| 193 | + struct creq_base *resp, | |
| 194 | + void *sb, u8 is_block) | |
| 195 | +{ | |
| 196 | + struct creq_qp_event *evnt = (struct creq_qp_event *)resp; | |
| 197 | + u16 cookie; | |
| 198 | + u8 opcode, retry_cnt = 0xFF; | |
| 199 | + int rc = 0; | |
| 200 | + | |
| 201 | + do { | |
| 202 | + opcode = req->opcode; | |
| 203 | + rc = __send_message(rcfw, req, resp, sb, is_block); | |
| 204 | + cookie = le16_to_cpu(req->cookie) & RCFW_MAX_COOKIE_VALUE; | |
| 205 | + if (!rc) | |
| 206 | + break; | |
| 207 | + | |
| 208 | + if (!retry_cnt || (rc != -EAGAIN && rc != -EBUSY)) { | |
| 209 | + /* send failed */ | |
| 210 | + dev_err(&rcfw->pdev->dev, "QPLIB: cmdq[%#x]=%#x send failed", | |
| 211 | + cookie, opcode); | |
| 212 | + return rc; | |
| 213 | + } | |
| 214 | + is_block ? mdelay(1) : usleep_range(500, 1000); | |
| 215 | + | |
| 216 | + } while (retry_cnt--); | |
| 217 | + | |
| 218 | + if (is_block) | |
| 219 | + rc = __block_for_resp(rcfw, cookie); | |
| 220 | + else | |
| 221 | + rc = __wait_for_resp(rcfw, cookie); | |
| 222 | + if (rc) { | |
| 223 | + /* timed out */ | |
| 224 | + dev_err(&rcfw->pdev->dev, "QPLIB: cmdq[%#x]=%#x timedout (%d)msec", | |
| 225 | + cookie, opcode, RCFW_CMD_WAIT_TIME_MS); | |
| 226 | + return rc; | |
| 227 | + } | |
| 228 | + | |
| 229 | + if (evnt->status) { | |
| 230 | + /* failed with status */ | |
| 231 | + dev_err(&rcfw->pdev->dev, "QPLIB: cmdq[%#x]=%#x status %#x", | |
| 232 | + cookie, opcode, evnt->status); | |
| 233 | + rc = -EFAULT; | |
| 234 | + } | |
| 235 | + | |
| 236 | + return rc; | |
| 237 | +} | |
| 220 | 238 | /* Completions */ |
| 221 | 239 | static int bnxt_qplib_process_func_event(struct bnxt_qplib_rcfw *rcfw, |
| 222 | 240 | struct creq_func_event *func_event) |
| @@ -260,12 +278,12 @@ static int bnxt_qplib_process_func_event(struct bnxt_qplib_rcfw *rcfw, · 37 unmodified lines | ||
| 260 | 278 | static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, |
| 261 | 279 | struct creq_qp_event *qp_event) |
| 262 | 280 | { |
| 263 | − struct bnxt_qplib_crsq *crsq = &rcfw->crsq; | |
| 264 | 281 | struct bnxt_qplib_hwq *cmdq = &rcfw->cmdq; |
| 265 | − struct bnxt_qplib_crsqe *crsqe; | |
| 266 | − u16 cbit, cookie, blocked = 0; | |
| 282 | + struct bnxt_qplib_crsq *crsqe; | |
| 267 | 283 | unsigned long flags; |
| 268 | − u32 sw_cons; | |
| 284 | + u16 cbit, blocked = 0; | |
| 285 | + u16 cookie; | |
| 286 | + __le16 mcookie; | |
| 269 | 287 | |
| 270 | 288 | switch (qp_event->event) { |
| 271 | 289 | case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION: |
| @@ -275,24 +293,31 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, · 3 unmodified lines | ||
| 275 | 293 | default: |
| 276 | 294 | /* Command Response */ |
| 277 | 295 | spin_lock_irqsave(&cmdq->lock, flags); |
| 278 | − sw_cons = HWQ_CMP(crsq->cons, crsq); | |
| 279 | − crsqe = &crsq->crsq[sw_cons]; | |
| 280 | − crsq->cons++; | |
| 281 | − memcpy(&crsqe->qp_event, qp_event, sizeof(crsqe->qp_event)); | |
| 282 | − | |
| 283 | − cookie = le16_to_cpu(crsqe->qp_event.cookie); | |
| 296 | + cookie = le16_to_cpu(qp_event->cookie); | |
| 297 | + mcookie = qp_event->cookie; | |
| 284 | 298 | blocked = cookie & RCFW_CMD_IS_BLOCKING; |
| 285 | 299 | cookie &= RCFW_MAX_COOKIE_VALUE; |
| 286 | 300 | cbit = cookie % RCFW_MAX_OUTSTANDING_CMD; |
| 301 | + crsqe = &rcfw->crsqe_tbl[cbit]; | |
| 302 | + if (crsqe->resp && | |
| 303 | + crsqe->resp->cookie == mcookie) { | |
| 304 | + memcpy(crsqe->resp, qp_event, sizeof(*qp_event)); | |
| 305 | + crsqe->resp = NULL; | |
| 306 | + } else { | |
| 307 | + dev_err(&rcfw->pdev->dev, | |
| 308 | + "QPLIB: CMD %s resp->cookie = %#x, evnt->cookie = %#x", | |
| 309 | + crsqe->resp ? "mismatch" : "collision", | |
| 310 | + crsqe->resp ? crsqe->resp->cookie : 0, mcookie); | |
| 311 | + } | |
| 287 | 312 | if (!test_and_clear_bit(cbit, rcfw->cmdq_bitmap)) |
| 288 | 313 | dev_warn(&rcfw->pdev->dev, |
| 289 | 314 | "QPLIB: CMD bit %d was not requested", cbit); |
| 290 | − | |
| 291 | 315 | cmdq->cons += crsqe->req_size; |
| 292 | − spin_unlock_irqrestore(&cmdq->lock, flags); | |
| 316 | + crsqe->req_size = 0; | |
| 317 | + | |
| 293 | 318 | if (!blocked) |
| 294 | 319 | wake_up(&rcfw->waitq); |
| 295 | − break; | |
| 320 | + spin_unlock_irqrestore(&cmdq->lock, flags); | |
| 296 | 321 | } |
| 297 | 322 | return 0; |
| 298 | 323 | } |
| @@ -305,12 +330,12 @@ static void bnxt_qplib_service_creq(unsigned long data) · 6 unmodified lines | ||
| 305 | 330 | struct creq_base *creqe, **creq_ptr; |
| 306 | 331 | u32 sw_cons, raw_cons; |
| 307 | 332 | unsigned long flags; |
| 308 | − u32 type; | |
| 333 | + u32 type, budget = CREQ_ENTRY_POLL_BUDGET; | |
| 309 | 334 | |
| 310 | − /* Service the CREQ until empty */ | |
| 335 | + /* Service the CREQ until budget is over */ | |
| 311 | 336 | spin_lock_irqsave(&creq->lock, flags); |
| 312 | 337 | raw_cons = creq->cons; |
| 313 | − while (1) { | |
| 338 | + while (budget > 0) { | |
| 314 | 339 | sw_cons = HWQ_CMP(raw_cons, creq); |
| 315 | 340 | creq_ptr = (struct creq_base **)creq->pbl_ptr; |
| 316 | 341 | creqe = &creq_ptr[get_creq_pg(sw_cons)][get_creq_idx(sw_cons)]; |
| @@ -320,15 +345,9 @@ static void bnxt_qplib_service_creq(unsigned long data) · 3 unmodified lines | ||
| 320 | 345 | type = creqe->type & CREQ_BASE_TYPE_MASK; |
| 321 | 346 | switch (type) { |
| 322 | 347 | case CREQ_BASE_TYPE_QP_EVENT: |
| 323 | − if (!bnxt_qplib_process_qp_event | |
| 324 | − (rcfw, (struct creq_qp_event *)creqe)) | |
| 325 | − rcfw->creq_qp_event_processed++; | |
| 326 | − else { | |
| 327 | − dev_warn(&rcfw->pdev->dev, "QPLIB: crsqe with"); | |
| 328 | − dev_warn(&rcfw->pdev->dev, | |
| 329 | − "QPLIB: type = 0x%x not handled", | |
| 330 | − type); | |
| 331 | − } | |
| 348 | + bnxt_qplib_process_qp_event | |
| 349 | + (rcfw, (struct creq_qp_event *)creqe); | |
| 350 | + rcfw->creq_qp_event_processed++; | |
| 332 | 351 | break; |
| 333 | 352 | case CREQ_BASE_TYPE_FUNC_EVENT: |
| 334 | 353 | if (!bnxt_qplib_process_func_event |
| @@ -346,7 +365,9 @@ static void bnxt_qplib_service_creq(unsigned long data) · 11 unmodified lines | ||
| 346 | 365 | break; |
| 347 | 366 | } |
| 348 | 367 | raw_cons++; |
| 368 | + budget--; | |
| 349 | 369 | } |
| 370 | + | |
| 350 | 371 | if (creq->cons != raw_cons) { |
| 351 | 372 | creq->cons = raw_cons; |
| 352 | 373 | CREQ_DB_REARM(rcfw->creq_bar_reg_iomem, raw_cons, |
| @@ -375,23 +396,16 @@ static irqreturn_t bnxt_qplib_creq_irq(int irq, void *dev_instance) · 22 unmodified lines | ||
| 375 | 396 | /* RCFW */ |
| 376 | 397 | int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw) |
| 377 | 398 | { |
| 378 | − struct creq_deinitialize_fw_resp *resp; | |
| 379 | 399 | struct cmdq_deinitialize_fw req; |
| 400 | + struct creq_deinitialize_fw_resp resp; | |
| 380 | 401 | u16 cmd_flags = 0; |
| 402 | + int rc; | |
| 381 | 403 | |
| 382 | 404 | RCFW_CMD_PREP(req, DEINITIALIZE_FW, cmd_flags); |
| 383 | − resp = (struct creq_deinitialize_fw_resp *) | |
| 384 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 385 | − NULL, 0); | |
| 386 | − if (!resp) | |
| 387 | − return -EINVAL; | |
| 388 | − | |
| 389 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) | |
| 390 | − return -ETIMEDOUT; | |
| 391 | − | |
| 392 | − if (resp->status || | |
| 393 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) | |
| 394 | − return -EFAULT; | |
| 405 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, | |
| 406 | + NULL, 0); | |
| 407 | + if (rc) | |
| 408 | + return rc; | |
| 395 | 409 | |
| 396 | 410 | clear_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->flags); |
| 397 | 411 | return 0; |
| @@ -417,9 +431,10 @@ static int __get_pbl_pg_idx(struct bnxt_qplib_pbl *pbl) · 19 unmodified lines | ||
| 417 | 431 | int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, |
| 418 | 432 | struct bnxt_qplib_ctx *ctx, int is_virtfn) |
| 419 | 433 | { |
| 420 | − struct creq_initialize_fw_resp *resp; | |
| 421 | 434 | struct cmdq_initialize_fw req; |
| 435 | + struct creq_initialize_fw_resp resp; | |
| 422 | 436 | u16 cmd_flags = 0, level; |
| 437 | + int rc; | |
| 423 | 438 | |
| 424 | 439 | RCFW_CMD_PREP(req, INITIALIZE_FW, cmd_flags); |
| 425 | 440 | |
| @@ -482,37 +497,19 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, · 56 unmodified lines | ||
| 482 | 497 | |
| 483 | 498 | skip_ctx_setup: |
| 484 | 499 | req.stat_ctx_id = cpu_to_le32(ctx->stats.fw_id); |
| 485 | − resp = (struct creq_initialize_fw_resp *) | |
| 486 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 487 | − NULL, 0); | |
| 488 | − if (!resp) { | |
| 489 | − dev_err(&rcfw->pdev->dev, | |
| 490 | − "QPLIB: RCFW: INITIALIZE_FW send failed"); | |
| 491 | − return -EINVAL; | |
| 492 | − } | |
| 493 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 494 | − /* Cmd timed out */ | |
| 495 | − dev_err(&rcfw->pdev->dev, | |
| 496 | − "QPLIB: RCFW: INITIALIZE_FW timed out"); | |
| 497 | − return -ETIMEDOUT; | |
| 498 | − } | |
| 499 | − if (resp->status || | |
| 500 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 501 | − dev_err(&rcfw->pdev->dev, | |
| 502 | − "QPLIB: RCFW: INITIALIZE_FW failed"); | |
| 503 | − return -EINVAL; | |
| 504 | − } | |
| 500 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, | |
| 501 | + NULL, 0); | |
| 502 | + if (rc) | |
| 503 | + return rc; | |
| 505 | 504 | set_bit(FIRMWARE_INITIALIZED_FLAG, &rcfw->flags); |
| 506 | 505 | return 0; |
| 507 | 506 | } |
| 508 | 507 | |
| 509 | 508 | void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw) |
| 510 | 509 | { |
| 511 | − bnxt_qplib_free_hwq(rcfw->pdev, &rcfw->crsb); | |
| 512 | − kfree(rcfw->crsq.crsq); | |
| 510 | + kfree(rcfw->crsqe_tbl); | |
| 513 | 511 | bnxt_qplib_free_hwq(rcfw->pdev, &rcfw->cmdq); |
| 514 | 512 | bnxt_qplib_free_hwq(rcfw->pdev, &rcfw->creq); |
| 515 | − | |
| 516 | 513 | rcfw->pdev = NULL; |
| 517 | 514 | } |
| 518 | 515 | |
| @@ -539,21 +536,11 @@ int bnxt_qplib_alloc_rcfw_channel(struct pci_dev *pdev, · 20 unmodified lines | ||
| 539 | 536 | goto fail; |
| 540 | 537 | } |
| 541 | 538 | |
| 542 | − rcfw->crsq.max_elements = rcfw->cmdq.max_elements; | |
| 543 | − rcfw->crsq.crsq = kcalloc(rcfw->crsq.max_elements, | |
| 544 | − sizeof(*rcfw->crsq.crsq), GFP_KERNEL); | |
| 545 | − if (!rcfw->crsq.crsq) | |
| 539 | + rcfw->crsqe_tbl = kcalloc(rcfw->cmdq.max_elements, | |
| 540 | + sizeof(*rcfw->crsqe_tbl), GFP_KERNEL); | |
| 541 | + if (!rcfw->crsqe_tbl) | |
| 546 | 542 | goto fail; |
| 547 | 543 | |
| 548 | − rcfw->crsb.max_elements = BNXT_QPLIB_CRSBE_MAX_CNT; | |
| 549 | − if (bnxt_qplib_alloc_init_hwq(rcfw->pdev, &rcfw->crsb, NULL, 0, | |
| 550 | − &rcfw->crsb.max_elements, | |
| 551 | − BNXT_QPLIB_CRSBE_UNITS, 0, PAGE_SIZE, | |
| 552 | − HWQ_TYPE_CTX)) { | |
| 553 | − dev_err(&rcfw->pdev->dev, | |
| 554 | − "QPLIB: HW channel CRSB allocation failed"); | |
| 555 | − goto fail; | |
| 556 | − } | |
| 557 | 544 | return 0; |
| 558 | 545 | |
| 559 | 546 | fail: |
| @@ -606,7 +593,7 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, · 46 unmodified lines | ||
| 606 | 593 | int rc; |
| 607 | 594 | |
| 608 | 595 | /* General */ |
| 609 | − atomic_set(&rcfw->seq_num, 0); | |
| 596 | + rcfw->seq_num = 0; | |
| 610 | 597 | rcfw->flags = FIRMWARE_FIRST_FLAG; |
| 611 | 598 | bmap_size = BITS_TO_LONGS(RCFW_MAX_OUTSTANDING_CMD * |
| 612 | 599 | sizeof(unsigned long)); |
| @@ -636,10 +623,6 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, · 23 unmodified lines | ||
| 636 | 623 | |
| 637 | 624 | rcfw->cmdq_bar_reg_trig_off = RCFW_COMM_TRIG_OFFSET; |
| 638 | 625 | |
| 639 | − /* CRSQ */ | |
| 640 | − rcfw->crsq.prod = 0; | |
| 641 | − rcfw->crsq.cons = 0; | |
| 642 | − | |
| 643 | 626 | /* CREQ */ |
| 644 | 627 | rcfw->creq_bar_reg = RCFW_COMM_CONS_PCI_BAR_REGION; |
| 645 | 628 | res_base = pci_resource_start(pdev, rcfw->creq_bar_reg); |
| @@ -692,3 +675,34 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, · 46 unmodified lines | ||
| 692 | 675 | __iowrite32_copy(rcfw->cmdq_bar_reg_iomem, &init, sizeof(init) / 4); |
| 693 | 676 | return 0; |
| 694 | 677 | } |
| 678 | + | |
| 679 | +struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf( | |
| 680 | + struct bnxt_qplib_rcfw *rcfw, | |
| 681 | + u32 size) | |
| 682 | +{ | |
| 683 | + struct bnxt_qplib_rcfw_sbuf *sbuf; | |
| 684 | + | |
| 685 | + sbuf = kzalloc(sizeof(*sbuf), GFP_ATOMIC); | |
| 686 | + if (!sbuf) | |
| 687 | + return NULL; | |
| 688 | + | |
| 689 | + sbuf->size = size; | |
| 690 | + sbuf->sb = dma_zalloc_coherent(&rcfw->pdev->dev, sbuf->size, | |
| 691 | + &sbuf->dma_addr, GFP_ATOMIC); | |
| 692 | + if (!sbuf->sb) | |
| 693 | + goto bail; | |
| 694 | + | |
| 695 | + return sbuf; | |
| 696 | +bail: | |
| 697 | + kfree(sbuf); | |
| 698 | + return NULL; | |
| 699 | +} | |
| 700 | + | |
| 701 | +void bnxt_qplib_rcfw_free_sbuf(struct bnxt_qplib_rcfw *rcfw, | |
| 702 | + struct bnxt_qplib_rcfw_sbuf *sbuf) | |
| 703 | +{ | |
| 704 | + if (sbuf->sb) | |
| 705 | + dma_free_coherent(&rcfw->pdev->dev, sbuf->size, | |
| 706 | + sbuf->sb, sbuf->dma_addr); | |
| 707 | + kfree(sbuf); | |
| 708 | +} | |
| @@ -73,6 +73,7 @@ · 72 unmodified lines | ||
| 73 | 73 | #define RCFW_MAX_OUTSTANDING_CMD BNXT_QPLIB_CMDQE_MAX_CNT |
| 74 | 74 | #define RCFW_MAX_COOKIE_VALUE 0x7FFF |
| 75 | 75 | #define RCFW_CMD_IS_BLOCKING 0x8000 |
| 76 | +#define RCFW_BLOCKED_CMD_WAIT_COUNT 0x4E20 | |
| 76 | 77 | |
| 77 | 78 | /* Cmdq contains a fix number of a 16-Byte slots */ |
| 78 | 79 | struct bnxt_qplib_cmdqe { |
| @@ -94,32 +95,6 @@ struct bnxt_qplib_crsbe { · 15 unmodified lines | ||
| 94 | 95 | u8 data[1024]; |
| 95 | 96 | }; |
| 96 | 97 | |
| 97 | −/* CRSQ SB */ | |
| 98 | −#define BNXT_QPLIB_CRSBE_MAX_CNT 4 | |
| 99 | −#define BNXT_QPLIB_CRSBE_UNITS sizeof(struct bnxt_qplib_crsbe) | |
| 100 | −#define BNXT_QPLIB_CRSBE_CNT_PER_PG (PAGE_SIZE / BNXT_QPLIB_CRSBE_UNITS) | |
| 101 | − | |
| 102 | −#define MAX_CRSB_IDX (BNXT_QPLIB_CRSBE_MAX_CNT - 1) | |
| 103 | −#define MAX_CRSB_IDX_PER_PG (BNXT_QPLIB_CRSBE_CNT_PER_PG - 1) | |
| 104 | − | |
| 105 | −static inline u32 get_crsb_pg(u32 val) | |
| 106 | −{ | |
| 107 | − return (val & ~MAX_CRSB_IDX_PER_PG) / BNXT_QPLIB_CRSBE_CNT_PER_PG; | |
| 108 | −} | |
| 109 | − | |
| 110 | −static inline u32 get_crsb_idx(u32 val) | |
| 111 | −{ | |
| 112 | − return val & MAX_CRSB_IDX_PER_PG; | |
| 113 | −} | |
| 114 | − | |
| 115 | −static inline void bnxt_qplib_crsb_dma_next(dma_addr_t *pg_map_arr, | |
| 116 | − u32 prod, dma_addr_t *dma_addr) | |
| 117 | −{ | |
| 118 | − *dma_addr = pg_map_arr[(prod) / BNXT_QPLIB_CRSBE_CNT_PER_PG]; | |
| 119 | − *dma_addr += ((prod) % BNXT_QPLIB_CRSBE_CNT_PER_PG) * | |
| 120 | − BNXT_QPLIB_CRSBE_UNITS; | |
| 121 | −} | |
| 122 | − | |
| 123 | 98 | /* CREQ */ |
| 124 | 99 | /* Allocate 1 per QP for async error notification for now */ |
| 125 | 100 | #define BNXT_QPLIB_CREQE_MAX_CNT (64 * 1024) |
| @@ -158,17 +133,19 @@ static inline u32 get_creq_idx(u32 val) · 32 unmodified lines | ||
| 158 | 133 | #define CREQ_DB(db, raw_cons, cp_bit) \ |
| 159 | 134 | writel(CREQ_DB_CP_FLAGS | ((raw_cons) & ((cp_bit) - 1)), db) |
| 160 | 135 | |
| 136 | +#define CREQ_ENTRY_POLL_BUDGET 0x100 | |
| 137 | + | |
| 161 | 138 | /* HWQ */ |
| 162 | −struct bnxt_qplib_crsqe { | |
| 163 | − struct creq_qp_event qp_event; | |
| 139 | + | |
| 140 | +struct bnxt_qplib_crsq { | |
| 141 | + struct creq_qp_event *resp; | |
| 164 | 142 | u32 req_size; |
| 165 | 143 | }; |
| 166 | 144 | |
| 167 | −struct bnxt_qplib_crsq { | |
| 168 | − struct bnxt_qplib_crsqe *crsq; | |
| 169 | − u32 prod; | |
| 170 | − u32 cons; | |
| 171 | − u32 max_elements; | |
| 145 | +struct bnxt_qplib_rcfw_sbuf { | |
| 146 | + void *sb; | |
| 147 | + dma_addr_t dma_addr; | |
| 148 | + u32 size; | |
| 172 | 149 | }; |
| 173 | 150 | |
| 174 | 151 | /* RCFW Communication Channels */ |
| @@ -185,7 +162,7 @@ struct bnxt_qplib_rcfw { · 10 unmodified lines | ||
| 185 | 162 | wait_queue_head_t waitq; |
| 186 | 163 | int (*aeq_handler)(struct bnxt_qplib_rcfw *, |
| 187 | 164 | struct creq_func_event *); |
| 188 | − atomic_t seq_num; | |
| 165 | + u32 seq_num; | |
| 189 | 166 | |
| 190 | 167 | /* Bar region info */ |
| 191 | 168 | void __iomem *cmdq_bar_reg_iomem; |
| @@ -203,8 +180,7 @@ struct bnxt_qplib_rcfw { · 11 unmodified lines | ||
| 203 | 180 | |
| 204 | 181 | /* Actual Cmd and Resp Queues */ |
| 205 | 182 | struct bnxt_qplib_hwq cmdq; |
| 206 | − struct bnxt_qplib_crsq crsq; | |
| 207 | − struct bnxt_qplib_hwq crsb; | |
| 183 | + struct bnxt_qplib_crsq *crsqe_tbl; | |
| 208 | 184 | }; |
| 209 | 185 | |
| 210 | 186 | void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw); |
| @@ -219,11 +195,14 @@ int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, · 8 unmodified lines | ||
| 219 | 195 | (struct bnxt_qplib_rcfw *, |
| 220 | 196 | struct creq_func_event *)); |
| 221 | 197 | |
| 222 | −int bnxt_qplib_rcfw_block_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie); | |
| 223 | −int bnxt_qplib_rcfw_wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie); | |
| 224 | −void *bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw, | |
| 225 | − struct cmdq_base *req, void **crsbe, | |
| 226 | − u8 is_block); | |
| 198 | +struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf( | |
| 199 | + struct bnxt_qplib_rcfw *rcfw, | |
| 200 | + u32 size); | |
| 201 | +void bnxt_qplib_rcfw_free_sbuf(struct bnxt_qplib_rcfw *rcfw, | |
| 202 | + struct bnxt_qplib_rcfw_sbuf *sbuf); | |
| 203 | +int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw, | |
| 204 | + struct cmdq_base *req, struct creq_base *resp, | |
| 205 | + void *sbuf, u8 is_block); | |
| 227 | 206 | |
| 228 | 207 | int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw); |
| 229 | 208 | int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, |
| @@ -48,6 +48,10 @@ extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero; · 47 unmodified lines | ||
| 48 | 48 | |
| 49 | 49 | #define HWQ_CMP(idx, hwq) ((idx) & ((hwq)->max_elements - 1)) |
| 50 | 50 | |
| 51 | +#define HWQ_FREE_SLOTS(hwq) (hwq->max_elements - \ | |
| 52 | + ((HWQ_CMP(hwq->prod, hwq)\ | |
| 53 | + - HWQ_CMP(hwq->cons, hwq))\ | |
| 54 | + & (hwq->max_elements - 1))) | |
| 51 | 55 | enum bnxt_qplib_hwq_type { |
| 52 | 56 | HWQ_TYPE_CTX, |
| 53 | 57 | HWQ_TYPE_QUEUE, |
| @@ -55,37 +55,30 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 54 unmodified lines | ||
| 55 | 55 | struct bnxt_qplib_dev_attr *attr) |
| 56 | 56 | { |
| 57 | 57 | struct cmdq_query_func req; |
| 58 | − struct creq_query_func_resp *resp; | |
| 58 | + struct creq_query_func_resp resp; | |
| 59 | + struct bnxt_qplib_rcfw_sbuf *sbuf; | |
| 59 | 60 | struct creq_query_func_resp_sb *sb; |
| 60 | 61 | u16 cmd_flags = 0; |
| 61 | 62 | u32 temp; |
| 62 | 63 | u8 *tqm_alloc; |
| 63 | − int i; | |
| 64 | + int i, rc = 0; | |
| 64 | 65 | |
| 65 | 66 | RCFW_CMD_PREP(req, QUERY_FUNC, cmd_flags); |
| 66 | 67 | |
| 67 | − req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS; | |
| 68 | − resp = (struct creq_query_func_resp *) | |
| 69 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void **)&sb, | |
| 70 | − 0); | |
| 71 | − if (!resp) { | |
| 72 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: QUERY_FUNC send failed"); | |
| 73 | − return -EINVAL; | |
| 74 | − } | |
| 75 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 76 | − /* Cmd timed out */ | |
| 77 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: QUERY_FUNC timed out"); | |
| 78 | − return -ETIMEDOUT; | |
| 79 | − } | |
| 80 | − if (resp->status || | |
| 81 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 82 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: QUERY_FUNC failed "); | |
| 68 | + sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); | |
| 69 | + if (!sbuf) { | |
| 83 | 70 | dev_err(&rcfw->pdev->dev, |
| 84 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 85 | − resp->status, le16_to_cpu(req.cookie), | |
| 86 | − le16_to_cpu(resp->cookie)); | |
| 87 | − return -EINVAL; | |
| 71 | + "QPLIB: SP: QUERY_FUNC alloc side buffer failed"); | |
| 72 | + return -ENOMEM; | |
| 88 | 73 | } |
| 74 | + | |
| 75 | + sb = sbuf->sb; | |
| 76 | + req.resp_size = sizeof(*sb) / BNXT_QPLIB_CMDQE_UNITS; | |
| 77 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, | |
| 78 | + (void *)sbuf, 0); | |
| 79 | + if (rc) | |
| 80 | + goto bail; | |
| 81 | + | |
| 89 | 82 | /* Extract the context from the side buffer */ |
| 90 | 83 | attr->max_qp = le32_to_cpu(sb->max_qp); |
| 91 | 84 | attr->max_qp_rd_atom = |
| @@ -95,6 +88,11 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 3 unmodified lines | ||
| 95 | 88 | sb->max_qp_init_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ? |
| 96 | 89 | BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_init_rd_atom; |
| 97 | 90 | attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr); |
| 91 | + /* | |
| 92 | + * 128 WQEs needs to be reserved for the HW (8916). Prevent | |
| 93 | + * reporting the max number | |
| 94 | + */ | |
| 95 | + attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS; | |
| 98 | 96 | attr->max_qp_sges = sb->max_sge; |
| 99 | 97 | attr->max_cq = le32_to_cpu(sb->max_cq); |
| 100 | 98 | attr->max_cq_wqes = le32_to_cpu(sb->max_cqe); |
| @@ -130,7 +128,10 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 29 unmodified lines | ||
| 130 | 128 | attr->tqm_alloc_reqs[i * 4 + 2] = *(++tqm_alloc); |
| 131 | 129 | attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc); |
| 132 | 130 | } |
| 133 | − return 0; | |
| 131 | + | |
| 132 | +bail: | |
| 133 | + bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf); | |
| 134 | + return rc; | |
| 134 | 135 | } |
| 135 | 136 | |
| 136 | 137 | /* SGID */ |
| @@ -178,8 +179,9 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 41 unmodified lines | ||
| 178 | 179 | /* Remove GID from the SGID table */ |
| 179 | 180 | if (update) { |
| 180 | 181 | struct cmdq_delete_gid req; |
| 181 | − struct creq_delete_gid_resp *resp; | |
| 182 | + struct creq_delete_gid_resp resp; | |
| 182 | 183 | u16 cmd_flags = 0; |
| 184 | + int rc; | |
| 183 | 185 | |
| 184 | 186 | RCFW_CMD_PREP(req, DELETE_GID, cmd_flags); |
| 185 | 187 | if (sgid_tbl->hw_id[index] == 0xFFFF) { |
| @@ -188,31 +190,10 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 2 unmodified lines | ||
| 188 | 190 | return -EINVAL; |
| 189 | 191 | } |
| 190 | 192 | req.gid_index = cpu_to_le16(sgid_tbl->hw_id[index]); |
| 191 | − resp = (struct creq_delete_gid_resp *) | |
| 192 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, NULL, | |
| 193 | − 0); | |
| 194 | − if (!resp) { | |
| 195 | − dev_err(&res->pdev->dev, | |
| 196 | − "QPLIB: SP: DELETE_GID send failed"); | |
| 197 | − return -EINVAL; | |
| 198 | − } | |
| 199 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, | |
| 200 | − le16_to_cpu(req.cookie))) { | |
| 201 | − /* Cmd timed out */ | |
| 202 | − dev_err(&res->pdev->dev, | |
| 203 | − "QPLIB: SP: DELETE_GID timed out"); | |
| 204 | − return -ETIMEDOUT; | |
| 205 | − } | |
| 206 | − if (resp->status || | |
| 207 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 208 | − dev_err(&res->pdev->dev, | |
| 209 | − "QPLIB: SP: DELETE_GID failed "); | |
| 210 | − dev_err(&res->pdev->dev, | |
| 211 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 212 | − resp->status, le16_to_cpu(req.cookie), | |
| 213 | − le16_to_cpu(resp->cookie)); | |
| 214 | − return -EINVAL; | |
| 215 | − } | |
| 193 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 194 | + (void *)&resp, NULL, 0); | |
| 195 | + if (rc) | |
| 196 | + return rc; | |
| 216 | 197 | } |
| 217 | 198 | memcpy(&sgid_tbl->tbl[index], &bnxt_qplib_gid_zero, |
| 218 | 199 | sizeof(bnxt_qplib_gid_zero)); |
| @@ -234,7 +215,7 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 15 unmodified lines | ||
| 234 | 215 | struct bnxt_qplib_res, |
| 235 | 216 | sgid_tbl); |
| 236 | 217 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 237 | − int i, free_idx, rc = 0; | |
| 218 | + int i, free_idx; | |
| 238 | 219 | |
| 239 | 220 | if (!sgid_tbl) { |
| 240 | 221 | dev_err(&res->pdev->dev, "QPLIB: SGID table not allocated"); |
| @@ -266,10 +247,11 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 25 unmodified lines | ||
| 266 | 247 | } |
| 267 | 248 | if (update) { |
| 268 | 249 | struct cmdq_add_gid req; |
| 269 | − struct creq_add_gid_resp *resp; | |
| 250 | + struct creq_add_gid_resp resp; | |
| 270 | 251 | u16 cmd_flags = 0; |
| 271 | 252 | u32 temp32[4]; |
| 272 | 253 | u16 temp16[3]; |
| 254 | + int rc; | |
| 273 | 255 | |
| 274 | 256 | RCFW_CMD_PREP(req, ADD_GID, cmd_flags); |
| 275 | 257 | |
| @@ -290,31 +272,11 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 14 unmodified lines | ||
| 290 | 272 | req.src_mac[1] = cpu_to_be16(temp16[1]); |
| 291 | 273 | req.src_mac[2] = cpu_to_be16(temp16[2]); |
| 292 | 274 | |
| 293 | − resp = (struct creq_add_gid_resp *) | |
| 294 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 295 | − NULL, 0); | |
| 296 | − if (!resp) { | |
| 297 | − dev_err(&res->pdev->dev, | |
| 298 | − "QPLIB: SP: ADD_GID send failed"); | |
| 299 | − return -EINVAL; | |
| 300 | − } | |
| 301 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, | |
| 302 | − le16_to_cpu(req.cookie))) { | |
| 303 | − /* Cmd timed out */ | |
| 304 | − dev_err(&res->pdev->dev, | |
| 305 | − "QPIB: SP: ADD_GID timed out"); | |
| 306 | − return -ETIMEDOUT; | |
| 307 | − } | |
| 308 | − if (resp->status || | |
| 309 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 310 | − dev_err(&res->pdev->dev, "QPLIB: SP: ADD_GID failed "); | |
| 311 | − dev_err(&res->pdev->dev, | |
| 312 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 313 | − resp->status, le16_to_cpu(req.cookie), | |
| 314 | − le16_to_cpu(resp->cookie)); | |
| 315 | − return -EINVAL; | |
| 316 | − } | |
| 317 | − sgid_tbl->hw_id[free_idx] = le32_to_cpu(resp->xid); | |
| 275 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 276 | + (void *)&resp, NULL, 0); | |
| 277 | + if (rc) | |
| 278 | + return rc; | |
| 279 | + sgid_tbl->hw_id[free_idx] = le32_to_cpu(resp.xid); | |
| 318 | 280 | } |
| 319 | 281 | /* Add GID to the sgid_tbl */ |
| 320 | 282 | memcpy(&sgid_tbl->tbl[free_idx], gid, sizeof(*gid)); |
| @@ -325,7 +287,7 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, · 4 unmodified lines | ||
| 325 | 287 | |
| 326 | 288 | *index = free_idx; |
| 327 | 289 | /* unlock */ |
| 328 | − return rc; | |
| 290 | + return 0; | |
| 329 | 291 | } |
| 330 | 292 | |
| 331 | 293 | /* pkeys */ |
| @@ -422,10 +384,11 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah) · 90 unmodified lines | ||
| 422 | 384 | { |
| 423 | 385 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 424 | 386 | struct cmdq_create_ah req; |
| 425 | − struct creq_create_ah_resp *resp; | |
| 387 | + struct creq_create_ah_resp resp; | |
| 426 | 388 | u16 cmd_flags = 0; |
| 427 | 389 | u32 temp32[4]; |
| 428 | 390 | u16 temp16[3]; |
| 391 | + int rc; | |
| 429 | 392 | |
| 430 | 393 | RCFW_CMD_PREP(req, CREATE_AH, cmd_flags); |
| 431 | 394 | |
| @@ -450,28 +413,12 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah) · 18 unmodified lines | ||
| 450 | 413 | req.dest_mac[1] = cpu_to_le16(temp16[1]); |
| 451 | 414 | req.dest_mac[2] = cpu_to_le16(temp16[2]); |
| 452 | 415 | |
| 453 | − resp = (struct creq_create_ah_resp *) | |
| 454 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 455 | − NULL, 1); | |
| 456 | − if (!resp) { | |
| 457 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: CREATE_AH send failed"); | |
| 458 | − return -EINVAL; | |
| 459 | − } | |
| 460 | − if (!bnxt_qplib_rcfw_block_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 461 | − /* Cmd timed out */ | |
| 462 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: CREATE_AH timed out"); | |
| 463 | − return -ETIMEDOUT; | |
| 464 | − } | |
| 465 | − if (resp->status || | |
| 466 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 467 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: CREATE_AH failed "); | |
| 468 | − dev_err(&rcfw->pdev->dev, | |
| 469 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 470 | − resp->status, le16_to_cpu(req.cookie), | |
| 471 | − le16_to_cpu(resp->cookie)); | |
| 472 | − return -EINVAL; | |
| 473 | − } | |
| 474 | − ah->id = le32_to_cpu(resp->xid); | |
| 416 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, | |
| 417 | + NULL, 1); | |
| 418 | + if (rc) | |
| 419 | + return rc; | |
| 420 | + | |
| 421 | + ah->id = le32_to_cpu(resp.xid); | |
| 475 | 422 | return 0; |
| 476 | 423 | } |
| 477 | 424 | |
| @@ -479,35 +426,19 @@ int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah) · 1 unmodified line | ||
| 479 | 426 | { |
| 480 | 427 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 481 | 428 | struct cmdq_destroy_ah req; |
| 482 | − struct creq_destroy_ah_resp *resp; | |
| 429 | + struct creq_destroy_ah_resp resp; | |
| 483 | 430 | u16 cmd_flags = 0; |
| 431 | + int rc; | |
| 484 | 432 | |
| 485 | 433 | /* Clean up the AH table in the device */ |
| 486 | 434 | RCFW_CMD_PREP(req, DESTROY_AH, cmd_flags); |
| 487 | 435 | |
| 488 | 436 | req.ah_cid = cpu_to_le32(ah->id); |
| 489 | 437 | |
| 490 | − resp = (struct creq_destroy_ah_resp *) | |
| 491 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 492 | − NULL, 1); | |
| 493 | − if (!resp) { | |
| 494 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: DESTROY_AH send failed"); | |
| 495 | − return -EINVAL; | |
| 496 | − } | |
| 497 | − if (!bnxt_qplib_rcfw_block_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 498 | − /* Cmd timed out */ | |
| 499 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: DESTROY_AH timed out"); | |
| 500 | − return -ETIMEDOUT; | |
| 501 | − } | |
| 502 | − if (resp->status || | |
| 503 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 504 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: DESTROY_AH failed "); | |
| 505 | − dev_err(&rcfw->pdev->dev, | |
| 506 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 507 | − resp->status, le16_to_cpu(req.cookie), | |
| 508 | − le16_to_cpu(resp->cookie)); | |
| 509 | − return -EINVAL; | |
| 510 | − } | |
| 438 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, | |
| 439 | + NULL, 1); | |
| 440 | + if (rc) | |
| 441 | + return rc; | |
| 511 | 442 | return 0; |
| 512 | 443 | } |
| 513 | 444 | |
| @@ -516,8 +447,9 @@ int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) · 2 unmodified lines | ||
| 516 | 447 | { |
| 517 | 448 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 518 | 449 | struct cmdq_deallocate_key req; |
| 519 | − struct creq_deallocate_key_resp *resp; | |
| 450 | + struct creq_deallocate_key_resp resp; | |
| 520 | 451 | u16 cmd_flags = 0; |
| 452 | + int rc; | |
| 521 | 453 | |
| 522 | 454 | if (mrw->lkey == 0xFFFFFFFF) { |
| 523 | 455 | dev_info(&res->pdev->dev, |
| @@ -536,27 +468,11 @@ int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) · 12 unmodified lines | ||
| 536 | 468 | else |
| 537 | 469 | req.key = cpu_to_le32(mrw->lkey); |
| 538 | 470 | |
| 539 | − resp = (struct creq_deallocate_key_resp *) | |
| 540 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 541 | − NULL, 0); | |
| 542 | − if (!resp) { | |
| 543 | − dev_err(&res->pdev->dev, "QPLIB: SP: FREE_MR send failed"); | |
| 544 | − return -EINVAL; | |
| 545 | − } | |
| 546 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 547 | − /* Cmd timed out */ | |
| 548 | − dev_err(&res->pdev->dev, "QPLIB: SP: FREE_MR timed out"); | |
| 549 | − return -ETIMEDOUT; | |
| 550 | − } | |
| 551 | − if (resp->status || | |
| 552 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 553 | − dev_err(&res->pdev->dev, "QPLIB: SP: FREE_MR failed "); | |
| 554 | − dev_err(&res->pdev->dev, | |
| 555 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 556 | − resp->status, le16_to_cpu(req.cookie), | |
| 557 | − le16_to_cpu(resp->cookie)); | |
| 558 | − return -EINVAL; | |
| 559 | − } | |
| 471 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, | |
| 472 | + NULL, 0); | |
| 473 | + if (rc) | |
| 474 | + return rc; | |
| 475 | + | |
| 560 | 476 | /* Free the qplib's MRW memory */ |
| 561 | 477 | if (mrw->hwq.max_elements) |
| 562 | 478 | bnxt_qplib_free_hwq(res->pdev, &mrw->hwq); |
| @@ -568,9 +484,10 @@ int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) · 5 unmodified lines | ||
| 568 | 484 | { |
| 569 | 485 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 570 | 486 | struct cmdq_allocate_mrw req; |
| 571 | − struct creq_allocate_mrw_resp *resp; | |
| 487 | + struct creq_allocate_mrw_resp resp; | |
| 572 | 488 | u16 cmd_flags = 0; |
| 573 | 489 | unsigned long tmp; |
| 490 | + int rc; | |
| 574 | 491 | |
| 575 | 492 | RCFW_CMD_PREP(req, ALLOCATE_MRW, cmd_flags); |
| 576 | 493 | |
| @@ -584,33 +501,17 @@ int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) · 7 unmodified lines | ||
| 584 | 501 | tmp = (unsigned long)mrw; |
| 585 | 502 | req.mrw_handle = cpu_to_le64(tmp); |
| 586 | 503 | |
| 587 | − resp = (struct creq_allocate_mrw_resp *) | |
| 588 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 589 | − NULL, 0); | |
| 590 | − if (!resp) { | |
| 591 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: ALLOC_MRW send failed"); | |
| 592 | − return -EINVAL; | |
| 593 | − } | |
| 594 | − if (!bnxt_qplib_rcfw_wait_for_resp(rcfw, le16_to_cpu(req.cookie))) { | |
| 595 | − /* Cmd timed out */ | |
| 596 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: ALLOC_MRW timed out"); | |
| 597 | − return -ETIMEDOUT; | |
| 598 | − } | |
| 599 | − if (resp->status || | |
| 600 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 601 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: ALLOC_MRW failed "); | |
| 602 | − dev_err(&rcfw->pdev->dev, | |
| 603 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 604 | − resp->status, le16_to_cpu(req.cookie), | |
| 605 | − le16_to_cpu(resp->cookie)); | |
| 606 | − return -EINVAL; | |
| 607 | − } | |
| 504 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 505 | + (void *)&resp, NULL, 0); | |
| 506 | + if (rc) | |
| 507 | + return rc; | |
| 508 | + | |
| 608 | 509 | if ((mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1) || |
| 609 | 510 | (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A) || |
| 610 | 511 | (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B)) |
| 611 | − mrw->rkey = le32_to_cpu(resp->xid); | |
| 512 | + mrw->rkey = le32_to_cpu(resp.xid); | |
| 612 | 513 | else |
| 613 | − mrw->lkey = le32_to_cpu(resp->xid); | |
| 514 | + mrw->lkey = le32_to_cpu(resp.xid); | |
| 614 | 515 | return 0; |
| 615 | 516 | } |
| 616 | 517 | |
| @@ -619,40 +520,17 @@ int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw, · 2 unmodified lines | ||
| 619 | 520 | { |
| 620 | 521 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 621 | 522 | struct cmdq_deregister_mr req; |
| 622 | − struct creq_deregister_mr_resp *resp; | |
| 523 | + struct creq_deregister_mr_resp resp; | |
| 623 | 524 | u16 cmd_flags = 0; |
| 624 | 525 | int rc; |
| 625 | 526 | |
| 626 | 527 | RCFW_CMD_PREP(req, DEREGISTER_MR, cmd_flags); |
| 627 | 528 | |
| 628 | 529 | req.lkey = cpu_to_le32(mrw->lkey); |
| 629 | − resp = (struct creq_deregister_mr_resp *) | |
| 630 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 631 | − NULL, block); | |
| 632 | − if (!resp) { | |
| 633 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: DEREG_MR send failed"); | |
| 634 | − return -EINVAL; | |
| 635 | − } | |
| 636 | − if (block) | |
| 637 | − rc = bnxt_qplib_rcfw_block_for_resp(rcfw, | |
| 638 | − le16_to_cpu(req.cookie)); | |
| 639 | − else | |
| 640 | − rc = bnxt_qplib_rcfw_wait_for_resp(rcfw, | |
| 641 | − le16_to_cpu(req.cookie)); | |
| 642 | − if (!rc) { | |
| 643 | − /* Cmd timed out */ | |
| 644 | − dev_err(&res->pdev->dev, "QPLIB: SP: DEREG_MR timed out"); | |
| 645 | − return -ETIMEDOUT; | |
| 646 | − } | |
| 647 | − if (resp->status || | |
| 648 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 649 | − dev_err(&rcfw->pdev->dev, "QPLIB: SP: DEREG_MR failed "); | |
| 650 | − dev_err(&rcfw->pdev->dev, | |
| 651 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 652 | − resp->status, le16_to_cpu(req.cookie), | |
| 653 | − le16_to_cpu(resp->cookie)); | |
| 654 | − return -EINVAL; | |
| 655 | − } | |
| 530 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 531 | + (void *)&resp, NULL, block); | |
| 532 | + if (rc) | |
| 533 | + return rc; | |
| 656 | 534 | |
| 657 | 535 | /* Free the qplib's MR memory */ |
| 658 | 536 | if (mrw->hwq.max_elements) { |
| @@ -669,7 +547,7 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr, · 10 unmodified lines | ||
| 669 | 547 | { |
| 670 | 548 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 671 | 549 | struct cmdq_register_mr req; |
| 672 | − struct creq_register_mr_resp *resp; | |
| 550 | + struct creq_register_mr_resp resp; | |
| 673 | 551 | u16 cmd_flags = 0, level; |
| 674 | 552 | int pg_ptrs, pages, i, rc; |
| 675 | 553 | dma_addr_t **pbl_ptr; |
| @@ -730,36 +608,11 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr, · 54 unmodified lines | ||
| 730 | 608 | req.key = cpu_to_le32(mr->lkey); |
| 731 | 609 | req.mr_size = cpu_to_le64(mr->total_size); |
| 732 | 610 | |
| 733 | − resp = (struct creq_register_mr_resp *) | |
| 734 | − bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 735 | − NULL, block); | |
| 736 | − if (!resp) { | |
| 737 | − dev_err(&res->pdev->dev, "SP: REG_MR send failed"); | |
| 738 | − rc = -EINVAL; | |
| 739 | − goto fail; | |
| 740 | − } | |
| 741 | − if (block) | |
| 742 | − rc = bnxt_qplib_rcfw_block_for_resp(rcfw, | |
| 743 | − le16_to_cpu(req.cookie)); | |
| 744 | − else | |
| 745 | − rc = bnxt_qplib_rcfw_wait_for_resp(rcfw, | |
| 746 | − le16_to_cpu(req.cookie)); | |
| 747 | − if (!rc) { | |
| 748 | − /* Cmd timed out */ | |
| 749 | − dev_err(&res->pdev->dev, "SP: REG_MR timed out"); | |
| 750 | − rc = -ETIMEDOUT; | |
| 751 | − goto fail; | |
| 752 | − } | |
| 753 | − if (resp->status || | |
| 754 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 755 | − dev_err(&res->pdev->dev, "QPLIB: SP: REG_MR failed "); | |
| 756 | − dev_err(&res->pdev->dev, | |
| 757 | − "QPLIB: SP: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 758 | − resp->status, le16_to_cpu(req.cookie), | |
| 759 | − le16_to_cpu(resp->cookie)); | |
| 760 | − rc = -EINVAL; | |
| 611 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 612 | + (void *)&resp, NULL, block); | |
| 613 | + if (rc) | |
| 761 | 614 | goto fail; |
| 762 | − } | |
| 615 | + | |
| 763 | 616 | return 0; |
| 764 | 617 | |
| 765 | 618 | fail: |
| @@ -804,35 +657,15 @@ int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids) · 38 unmodified lines | ||
| 804 | 657 | { |
| 805 | 658 | struct bnxt_qplib_rcfw *rcfw = res->rcfw; |
| 806 | 659 | struct cmdq_map_tc_to_cos req; |
| 807 | − struct creq_map_tc_to_cos_resp *resp; | |
| 660 | + struct creq_map_tc_to_cos_resp resp; | |
| 808 | 661 | u16 cmd_flags = 0; |
| 809 | − int tleft; | |
| 662 | + int rc = 0; | |
| 810 | 663 | |
| 811 | 664 | RCFW_CMD_PREP(req, MAP_TC_TO_COS, cmd_flags); |
| 812 | 665 | req.cos0 = cpu_to_le16(cids[0]); |
| 813 | 666 | req.cos1 = cpu_to_le16(cids[1]); |
| 814 | 667 | |
| 815 | − resp = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, NULL, 0); | |
| 816 | − if (!resp) { | |
| 817 | − dev_err(&res->pdev->dev, "QPLIB: SP: MAP_TC2COS send failed"); | |
| 818 | − return -EINVAL; | |
| 819 | − } | |
| 820 | − | |
| 821 | − tleft = bnxt_qplib_rcfw_block_for_resp(rcfw, le16_to_cpu(req.cookie)); | |
| 822 | − if (!tleft) { | |
| 823 | − dev_err(&res->pdev->dev, "QPLIB: SP: MAP_TC2COS timed out"); | |
| 824 | − return -ETIMEDOUT; | |
| 825 | − } | |
| 826 | − | |
| 827 | − if (resp->status || | |
| 828 | − le16_to_cpu(resp->cookie) != le16_to_cpu(req.cookie)) { | |
| 829 | − dev_err(&res->pdev->dev, "QPLIB: SP: MAP_TC2COS failed "); | |
| 830 | − dev_err(&res->pdev->dev, | |
| 831 | − "QPLIB: with status 0x%x cmdq 0x%x resp 0x%x", | |
| 832 | − resp->status, le16_to_cpu(req.cookie), | |
| 833 | − le16_to_cpu(resp->cookie)); | |
| 834 | − return -EINVAL; | |
| 835 | − } | |
| 836 | − | |
| 668 | + rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | |
| 669 | + (void *)&resp, NULL, 0); | |
| 837 | 670 | return 0; |
| 838 | 671 | } |
| @@ -40,6 +40,8 @@ · 39 unmodified lines | ||
| 40 | 40 | #ifndef __BNXT_QPLIB_SP_H__ |
| 41 | 41 | #define __BNXT_QPLIB_SP_H__ |
| 42 | 42 | |
| 43 | +#define BNXT_QPLIB_RESERVED_QP_WRS 128 | |
| 44 | + | |
| 43 | 45 | struct bnxt_qplib_dev_attr { |
| 44 | 46 | char fw_ver[32]; |
| 45 | 47 | u16 max_sgid; |
| @@ -767,7 +767,7 @@ void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, · 766 unmodified lines | ||
| 767 | 767 | kfree(entry); |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | − list_for_each_safe(pos, nxt, &uctx->qpids) { | |
| 770 | + list_for_each_safe(pos, nxt, &uctx->cqids) { | |
| 771 | 771 | entry = list_entry(pos, struct c4iw_qid_list, entry); |
| 772 | 772 | list_del_init(&entry->entry); |
| 773 | 773 | kfree(entry); |
| @@ -880,13 +880,15 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) · 106 unmodified lines | ||
| 880 | 880 | rdev->free_workq = create_singlethread_workqueue("iw_cxgb4_free"); |
| 881 | 881 | if (!rdev->free_workq) { |
| 882 | 882 | err = -ENOMEM; |
| 883 | − goto err_free_status_page; | |
| 883 | + goto err_free_status_page_and_wr_log; | |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | rdev->status_page->db_off = 0; |
| 887 | 887 | |
| 888 | 888 | return 0; |
| 889 | −err_free_status_page: | |
| 889 | +err_free_status_page_and_wr_log: | |
| 890 | + if (c4iw_wr_log && rdev->wr_log) | |
| 891 | + kfree(rdev->wr_log); | |
| 890 | 892 | free_page((unsigned long)rdev->status_page); |
| 891 | 893 | destroy_ocqp_pool: |
| 892 | 894 | c4iw_ocqp_pool_destroy(rdev); |
| @@ -903,9 +905,11 @@ static void c4iw_rdev_close(struct c4iw_rdev *rdev) · 10 unmodified lines | ||
| 903 | 905 | { |
| 904 | 906 | destroy_workqueue(rdev->free_workq); |
| 905 | 907 | kfree(rdev->wr_log); |
| 908 | + c4iw_release_dev_ucontext(rdev, &rdev->uctx); | |
| 906 | 909 | free_page((unsigned long)rdev->status_page); |
| 907 | 910 | c4iw_pblpool_destroy(rdev); |
| 908 | 911 | c4iw_rqtpool_destroy(rdev); |
| 912 | + c4iw_ocqp_pool_destroy(rdev); | |
| 909 | 913 | c4iw_destroy_resource(&rdev->resource); |
| 910 | 914 | } |
| 911 | 915 | |
| @@ -3692,8 +3692,10 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) · 3691 unmodified lines | ||
| 3692 | 3692 | dev->ib_dev.check_mr_status = mlx5_ib_check_mr_status; |
| 3693 | 3693 | dev->ib_dev.get_port_immutable = mlx5_port_immutable; |
| 3694 | 3694 | dev->ib_dev.get_dev_fw_str = get_dev_fw_str; |
| 3695 | − dev->ib_dev.alloc_rdma_netdev = mlx5_ib_alloc_rdma_netdev; | |
| 3696 | − dev->ib_dev.free_rdma_netdev = mlx5_ib_free_rdma_netdev; | |
| 3695 | + if (MLX5_CAP_GEN(mdev, ipoib_enhanced_offloads)) { | |
| 3696 | + dev->ib_dev.alloc_rdma_netdev = mlx5_ib_alloc_rdma_netdev; | |
| 3697 | + dev->ib_dev.free_rdma_netdev = mlx5_ib_free_rdma_netdev; | |
| 3698 | + } | |
| 3697 | 3699 | if (mlx5_core_is_pf(mdev)) { |
| 3698 | 3700 | dev->ib_dev.get_vf_config = mlx5_ib_get_vf_config; |
| 3699 | 3701 | dev->ib_dev.set_vf_link_state = mlx5_ib_set_vf_link_state; |
| @@ -58,7 +58,10 @@ · 57 unmodified lines | ||
| 58 | 58 | #define QEDR_MSG_QP " QP" |
| 59 | 59 | #define QEDR_MSG_GSI " GSI" |
| 60 | 60 | |
| 61 | −#define QEDR_CQ_MAGIC_NUMBER (0x11223344) | |
| 61 | +#define QEDR_CQ_MAGIC_NUMBER (0x11223344) | |
| 62 | + | |
| 63 | +#define FW_PAGE_SIZE (RDMA_RING_PAGE_SIZE) | |
| 64 | +#define FW_PAGE_SHIFT (12) | |
| 62 | 65 | |
| 63 | 66 | struct qedr_dev; |
| 64 | 67 | |
| @@ -653,14 +653,15 @@ static int qedr_prepare_pbl_tbl(struct qedr_dev *dev, · 652 unmodified lines | ||
| 653 | 653 | |
| 654 | 654 | static void qedr_populate_pbls(struct qedr_dev *dev, struct ib_umem *umem, |
| 655 | 655 | struct qedr_pbl *pbl, |
| 656 | − struct qedr_pbl_info *pbl_info) | |
| 656 | + struct qedr_pbl_info *pbl_info, u32 pg_shift) | |
| 657 | 657 | { |
| 658 | 658 | int shift, pg_cnt, pages, pbe_cnt, total_num_pbes = 0; |
| 659 | + u32 fw_pg_cnt, fw_pg_per_umem_pg; | |
| 659 | 660 | struct qedr_pbl *pbl_tbl; |
| 660 | 661 | struct scatterlist *sg; |
| 661 | 662 | struct regpair *pbe; |
| 663 | + u64 pg_addr; | |
| 662 | 664 | int entry; |
| 663 | − u32 addr; | |
| 664 | 665 | |
| 665 | 666 | if (!pbl_info->num_pbes) |
| 666 | 667 | return; |
| @@ -683,29 +684,35 @@ static void qedr_populate_pbls(struct qedr_dev *dev, struct ib_umem *umem, · 16 unmodified lines | ||
| 683 | 684 | |
| 684 | 685 | shift = umem->page_shift; |
| 685 | 686 | |
| 687 | + fw_pg_per_umem_pg = BIT(umem->page_shift - pg_shift); | |
| 688 | + | |
| 686 | 689 | for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { |
| 687 | 690 | pages = sg_dma_len(sg) >> shift; |
| 691 | + pg_addr = sg_dma_address(sg); | |
| 688 | 692 | for (pg_cnt = 0; pg_cnt < pages; pg_cnt++) { |
| 689 | − /* store the page address in pbe */ | |
| 690 | − pbe->lo = cpu_to_le32(sg_dma_address(sg) + | |
| 691 | − (pg_cnt << shift)); | |
| 692 | − addr = upper_32_bits(sg_dma_address(sg) + | |
| 693 | − (pg_cnt << shift)); | |
| 694 | − pbe->hi = cpu_to_le32(addr); | |
| 695 | − pbe_cnt++; | |
| 696 | − total_num_pbes++; | |
| 697 | − pbe++; | |
| 698 | − | |
| 699 | − if (total_num_pbes == pbl_info->num_pbes) | |
| 700 | − return; | |
| 701 | − | |
| 702 | − /* If the given pbl is full storing the pbes, | |
| 703 | − * move to next pbl. | |
| 704 | − */ | |
| 705 | − if (pbe_cnt == (pbl_info->pbl_size / sizeof(u64))) { | |
| 706 | − pbl_tbl++; | |
| 707 | − pbe = (struct regpair *)pbl_tbl->va; | |
| 708 | − pbe_cnt = 0; | |
| 693 | + for (fw_pg_cnt = 0; fw_pg_cnt < fw_pg_per_umem_pg;) { | |
| 694 | + pbe->lo = cpu_to_le32(pg_addr); | |
| 695 | + pbe->hi = cpu_to_le32(upper_32_bits(pg_addr)); | |
| 696 | + | |
| 697 | + pg_addr += BIT(pg_shift); | |
| 698 | + pbe_cnt++; | |
| 699 | + total_num_pbes++; | |
| 700 | + pbe++; | |
| 701 | + | |
| 702 | + if (total_num_pbes == pbl_info->num_pbes) | |
| 703 | + return; | |
| 704 | + | |
| 705 | + /* If the given pbl is full storing the pbes, | |
| 706 | + * move to next pbl. | |
| 707 | + */ | |
| 708 | + if (pbe_cnt == | |
| 709 | + (pbl_info->pbl_size / sizeof(u64))) { | |
| 710 | + pbl_tbl++; | |
| 711 | + pbe = (struct regpair *)pbl_tbl->va; | |
| 712 | + pbe_cnt = 0; | |
| 713 | + } | |
| 714 | + | |
| 715 | + fw_pg_cnt++; | |
| 709 | 716 | } |
| 710 | 717 | } |
| 711 | 718 | } |
| @@ -754,7 +761,7 @@ static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx, · 42 unmodified lines | ||
| 754 | 761 | u64 buf_addr, size_t buf_len, |
| 755 | 762 | int access, int dmasync) |
| 756 | 763 | { |
| 757 | − int page_cnt; | |
| 764 | + u32 fw_pages; | |
| 758 | 765 | int rc; |
| 759 | 766 | |
| 760 | 767 | q->buf_addr = buf_addr; |
| @@ -766,8 +773,10 @@ static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx, · 5 unmodified lines | ||
| 766 | 773 | return PTR_ERR(q->umem); |
| 767 | 774 | } |
| 768 | 775 | |
| 769 | − page_cnt = ib_umem_page_count(q->umem); | |
| 770 | − rc = qedr_prepare_pbl_tbl(dev, &q->pbl_info, page_cnt, 0); | |
| 776 | + fw_pages = ib_umem_page_count(q->umem) << | |
| 777 | + (q->umem->page_shift - FW_PAGE_SHIFT); | |
| 778 | + | |
| 779 | + rc = qedr_prepare_pbl_tbl(dev, &q->pbl_info, fw_pages, 0); | |
| 771 | 780 | if (rc) |
| 772 | 781 | goto err0; |
| 773 | 782 | |
| @@ -777,7 +786,8 @@ static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx, · 3 unmodified lines | ||
| 777 | 786 | goto err0; |
| 778 | 787 | } |
| 779 | 788 | |
| 780 | − qedr_populate_pbls(dev, q->umem, q->pbl_tbl, &q->pbl_info); | |
| 789 | + qedr_populate_pbls(dev, q->umem, q->pbl_tbl, &q->pbl_info, | |
| 790 | + FW_PAGE_SHIFT); | |
| 781 | 791 | |
| 782 | 792 | return 0; |
| 783 | 793 | |
| @@ -2226,7 +2236,7 @@ struct ib_mr *qedr_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len, · 1442 unmodified lines | ||
| 2226 | 2236 | goto err1; |
| 2227 | 2237 | |
| 2228 | 2238 | qedr_populate_pbls(dev, mr->umem, mr->info.pbl_table, |
| 2229 | − &mr->info.pbl_info); | |
| 2239 | + &mr->info.pbl_info, mr->umem->page_shift); | |
| 2230 | 2240 | |
| 2231 | 2241 | rc = dev->ops->rdma_alloc_tid(dev->rdma_ctx, &mr->hw_mr.itid); |
| 2232 | 2242 | if (rc) { |
| @@ -3209,6 +3219,10 @@ static int process_req(struct qedr_dev *dev, struct qedr_qp *qp, · 976 unmodified lines | ||
| 3209 | 3219 | case IB_WC_REG_MR: |
| 3210 | 3220 | qp->wqe_wr_id[qp->sq.cons].mr->info.completed++; |
| 3211 | 3221 | break; |
| 3222 | + case IB_WC_RDMA_READ: | |
| 3223 | + case IB_WC_SEND: | |
| 3224 | + wc->byte_len = qp->wqe_wr_id[qp->sq.cons].bytes_len; | |
| 3225 | + break; | |
| 3212 | 3226 | default: |
| 3213 | 3227 | break; |
| 3214 | 3228 | } |
| @@ -68,6 +68,7 @@ · 67 unmodified lines | ||
| 68 | 68 | static inline u32 rxe_crc32(struct rxe_dev *rxe, |
| 69 | 69 | u32 crc, void *next, size_t len) |
| 70 | 70 | { |
| 71 | + u32 retval; | |
| 71 | 72 | int err; |
| 72 | 73 | |
| 73 | 74 | SHASH_DESC_ON_STACK(shash, rxe->tfm); |
| @@ -81,7 +82,9 @@ static inline u32 rxe_crc32(struct rxe_dev *rxe, · 7 unmodified lines | ||
| 81 | 82 | return crc32_le(crc, next, len); |
| 82 | 83 | } |
| 83 | 84 | |
| 84 | − return *(u32 *)shash_desc_ctx(shash); | |
| 85 | + retval = *(u32 *)shash_desc_ctx(shash); | |
| 86 | + barrier_data(shash_desc_ctx(shash)); | |
| 87 | + return retval; | |
| 85 | 88 | } |
| 86 | 89 | |
| 87 | 90 | int rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu); |
| @@ -740,13 +740,8 @@ static int init_send_wqe(struct rxe_qp *qp, struct ib_send_wr *ibwr, · 739 unmodified lines | ||
| 740 | 740 | |
| 741 | 741 | sge = ibwr->sg_list; |
| 742 | 742 | for (i = 0; i < num_sge; i++, sge++) { |
| 743 | − if (qp->is_user && copy_from_user(p, (__user void *) | |
| 744 | − (uintptr_t)sge->addr, sge->length)) | |
| 745 | − return -EFAULT; | |
| 746 | − | |
| 747 | − else if (!qp->is_user) | |
| 748 | − memcpy(p, (void *)(uintptr_t)sge->addr, | |
| 749 | − sge->length); | |
| 743 | + memcpy(p, (void *)(uintptr_t)sge->addr, | |
| 744 | + sge->length); | |
| 750 | 745 | |
| 751 | 746 | p += sge->length; |
| 752 | 747 | } |
| @@ -863,7 +863,6 @@ dev_stop: · 862 unmodified lines | ||
| 863 | 863 | set_bit(IPOIB_STOP_REAPER, &priv->flags); |
| 864 | 864 | cancel_delayed_work(&priv->ah_reap_task); |
| 865 | 865 | set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); |
| 866 | − napi_enable(&priv->napi); | |
| 867 | 866 | ipoib_ib_dev_stop(dev); |
| 868 | 867 | return -1; |
| 869 | 868 | } |
| @@ -1596,6 +1596,8 @@ static void ipoib_dev_uninit_default(struct net_device *dev) · 1595 unmodified lines | ||
| 1596 | 1596 | |
| 1597 | 1597 | ipoib_transport_dev_cleanup(dev); |
| 1598 | 1598 | |
| 1599 | + netif_napi_del(&priv->napi); | |
| 1600 | + | |
| 1599 | 1601 | ipoib_cm_dev_cleanup(dev); |
| 1600 | 1602 | |
| 1601 | 1603 | kfree(priv->rx_ring); |
| @@ -1649,6 +1651,7 @@ out_rx_ring_cleanup: · 47 unmodified lines | ||
| 1649 | 1651 | kfree(priv->rx_ring); |
| 1650 | 1652 | |
| 1651 | 1653 | out: |
| 1654 | + netif_napi_del(&priv->napi); | |
| 1652 | 1655 | return -ENOMEM; |
| 1653 | 1656 | } |
| 1654 | 1657 | |
| @@ -2237,6 +2240,7 @@ event_failed: · 582 unmodified lines | ||
| 2237 | 2240 | |
| 2238 | 2241 | device_init_failed: |
| 2239 | 2242 | free_netdev(priv->dev); |
| 2243 | + kfree(priv); | |
| 2240 | 2244 | |
| 2241 | 2245 | alloc_mem_failed: |
| 2242 | 2246 | return ERR_PTR(result); |
| @@ -2277,7 +2281,7 @@ static void ipoib_add_one(struct ib_device *device) · 34 unmodified lines | ||
| 2277 | 2281 | |
| 2278 | 2282 | static void ipoib_remove_one(struct ib_device *device, void *client_data) |
| 2279 | 2283 | { |
| 2280 | − struct ipoib_dev_priv *priv, *tmp; | |
| 2284 | + struct ipoib_dev_priv *priv, *tmp, *cpriv, *tcpriv; | |
| 2281 | 2285 | struct list_head *dev_list = client_data; |
| 2282 | 2286 | |
| 2283 | 2287 | if (!dev_list) |
| @@ -2300,7 +2304,14 @@ static void ipoib_remove_one(struct ib_device *device, void *client_data) · 16 unmodified lines | ||
| 2300 | 2304 | flush_workqueue(priv->wq); |
| 2301 | 2305 | |
| 2302 | 2306 | unregister_netdev(priv->dev); |
| 2303 | − free_netdev(priv->dev); | |
| 2307 | + if (device->free_rdma_netdev) | |
| 2308 | + device->free_rdma_netdev(priv->dev); | |
| 2309 | + else | |
| 2310 | + free_netdev(priv->dev); | |
| 2311 | + | |
| 2312 | + list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) | |
| 2313 | + kfree(cpriv); | |
| 2314 | + | |
| 2304 | 2315 | kfree(priv); |
| 2305 | 2316 | } |
| 2306 | 2317 | |
| @@ -133,13 +133,13 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) · 132 unmodified lines | ||
| 133 | 133 | snprintf(intf_name, sizeof intf_name, "%s.%04x", |
| 134 | 134 | ppriv->dev->name, pkey); |
| 135 | 135 | |
| 136 | + if (!rtnl_trylock()) | |
| 137 | + return restart_syscall(); | |
| 138 | + | |
| 136 | 139 | priv = ipoib_intf_alloc(ppriv->ca, ppriv->port, intf_name); |
| 137 | 140 | if (!priv) |
| 138 | 141 | return -ENOMEM; |
| 139 | 142 | |
| 140 | − if (!rtnl_trylock()) | |
| 141 | − return restart_syscall(); | |
| 142 | − | |
| 143 | 143 | down_write(&ppriv->vlan_rwsem); |
| 144 | 144 | |
| 145 | 145 | /* |
| @@ -167,8 +167,10 @@ out: · 21 unmodified lines | ||
| 167 | 167 | |
| 168 | 168 | rtnl_unlock(); |
| 169 | 169 | |
| 170 | − if (result) | |
| 170 | + if (result) { | |
| 171 | 171 | free_netdev(priv->dev); |
| 172 | + kfree(priv); | |
| 173 | + } | |
| 172 | 174 | |
| 173 | 175 | return result; |
| 174 | 176 | } |
| @@ -209,6 +211,7 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) · 34 unmodified lines | ||
| 209 | 211 | |
| 210 | 212 | if (dev) { |
| 211 | 213 | free_netdev(dev); |
| 214 | + kfree(priv); | |
| 212 | 215 | return 0; |
| 213 | 216 | } |
| 214 | 217 | |
| @@ -248,7 +248,8 @@ static struct soc_button_info *soc_button_get_button_info(struct device *dev) · 247 unmodified lines | ||
| 248 | 248 | |
| 249 | 249 | if (!btns_desc) { |
| 250 | 250 | dev_err(dev, "ACPI Button Descriptors not found\n"); |
| 251 | − return ERR_PTR(-ENODEV); | |
| 251 | + button_info = ERR_PTR(-ENODEV); | |
| 252 | + goto out; | |
| 252 | 253 | } |
| 253 | 254 | |
| 254 | 255 | /* The first package describes the collection */ |
| @@ -264,24 +265,31 @@ static struct soc_button_info *soc_button_get_button_info(struct device *dev) · 9 unmodified lines | ||
| 264 | 265 | } |
| 265 | 266 | if (collection_uid == -1) { |
| 266 | 267 | dev_err(dev, "Invalid Button Collection Descriptor\n"); |
| 267 | − return ERR_PTR(-ENODEV); | |
| 268 | + button_info = ERR_PTR(-ENODEV); | |
| 269 | + goto out; | |
| 268 | 270 | } |
| 269 | 271 | |
| 270 | 272 | /* There are package.count - 1 buttons + 1 terminating empty entry */ |
| 271 | 273 | button_info = devm_kcalloc(dev, btns_desc->package.count, |
| 272 | 274 | sizeof(*button_info), GFP_KERNEL); |
| 273 | − if (!button_info) | |
| 274 | − return ERR_PTR(-ENOMEM); | |
| 275 | + if (!button_info) { | |
| 276 | + button_info = ERR_PTR(-ENOMEM); | |
| 277 | + goto out; | |
| 278 | + } | |
| 275 | 279 | |
| 276 | 280 | /* Parse the button descriptors */ |
| 277 | 281 | for (i = 1, btn = 0; i < btns_desc->package.count; i++, btn++) { |
| 278 | 282 | if (soc_button_parse_btn_desc(dev, |
| 279 | 283 | &btns_desc->package.elements[i], |
| 280 | 284 | collection_uid, |
| 281 | − &button_info[btn])) | |
| 282 | − return ERR_PTR(-ENODEV); | |
| 285 | + &button_info[btn])) { | |
| 286 | + button_info = ERR_PTR(-ENODEV); | |
| 287 | + goto out; | |
| 288 | + } | |
| 283 | 289 | } |
| 284 | 290 | |
| 291 | +out: | |
| 292 | + kfree(buf.pointer); | |
| 285 | 293 | return button_info; |
| 286 | 294 | } |
| 287 | 295 | |
| @@ -31,9 +31,6 @@ · 30 unmodified lines | ||
| 31 | 31 | #define F54_GET_REPORT 1 |
| 32 | 32 | #define F54_FORCE_CAL 2 |
| 33 | 33 | |
| 34 | −/* Fixed sizes of reports */ | |
| 35 | −#define F54_QUERY_LEN 27 | |
| 36 | − | |
| 37 | 34 | /* F54 capabilities */ |
| 38 | 35 | #define F54_CAP_BASELINE (1 << 2) |
| 39 | 36 | #define F54_CAP_IMAGE8 (1 << 3) |
| @@ -95,7 +92,6 @@ struct rmi_f54_reports { · 55 unmodified lines | ||
| 95 | 92 | struct f54_data { |
| 96 | 93 | struct rmi_function *fn; |
| 97 | 94 | |
| 98 | − u8 qry[F54_QUERY_LEN]; | |
| 99 | 95 | u8 num_rx_electrodes; |
| 100 | 96 | u8 num_tx_electrodes; |
| 101 | 97 | u8 capabilities; |
| @@ -632,22 +628,23 @@ static int rmi_f54_detect(struct rmi_function *fn) · 530 unmodified lines | ||
| 632 | 628 | { |
| 633 | 629 | int error; |
| 634 | 630 | struct f54_data *f54; |
| 631 | + u8 buf[6]; | |
| 635 | 632 | |
| 636 | 633 | f54 = dev_get_drvdata(&fn->dev); |
| 637 | 634 | |
| 638 | 635 | error = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr, |
| 639 | − &f54->qry, sizeof(f54->qry)); | |
| 636 | + buf, sizeof(buf)); | |
| 640 | 637 | if (error) { |
| 641 | 638 | dev_err(&fn->dev, "%s: Failed to query F54 properties\n", |
| 642 | 639 | __func__); |
| 643 | 640 | return error; |
| 644 | 641 | } |
| 645 | 642 | |
| 646 | − f54->num_rx_electrodes = f54->qry[0]; | |
| 647 | − f54->num_tx_electrodes = f54->qry[1]; | |
| 648 | − f54->capabilities = f54->qry[2]; | |
| 649 | − f54->clock_rate = f54->qry[3] | (f54->qry[4] << 8); | |
| 650 | − f54->family = f54->qry[5]; | |
| 643 | + f54->num_rx_electrodes = buf[0]; | |
| 644 | + f54->num_tx_electrodes = buf[1]; | |
| 645 | + f54->capabilities = buf[2]; | |
| 646 | + f54->clock_rate = buf[3] | (buf[4] << 8); | |
| 647 | + f54->family = buf[5]; | |
| 651 | 648 | |
| 652 | 649 | rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F54 num_rx_electrodes: %d\n", |
| 653 | 650 | f54->num_rx_electrodes); |
| @@ -723,6 +723,13 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { · 722 unmodified lines | ||
| 723 | 723 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"), |
| 724 | 724 | }, |
| 725 | 725 | }, |
| 726 | + { | |
| 727 | + /* Fujitsu UH554 laptop */ | |
| 728 | + .matches = { | |
| 729 | + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | |
| 730 | + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK UH544"), | |
| 731 | + }, | |
| 732 | + }, | |
| 726 | 733 | { } |
| 727 | 734 | }; |
| 728 | 735 | |
| @@ -140,7 +140,7 @@ static inline void gic_map_to_vpe(unsigned int intr, unsigned int vpe) · 139 unmodified lines | ||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | #ifdef CONFIG_CLKSRC_MIPS_GIC |
| 143 | −u64 gic_read_count(void) | |
| 143 | +u64 notrace gic_read_count(void) | |
| 144 | 144 | { |
| 145 | 145 | unsigned int hi, hi2, lo; |
| 146 | 146 | |
| @@ -167,7 +167,7 @@ unsigned int gic_get_count_width(void) · 20 unmodified lines | ||
| 167 | 167 | return bits; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | −void gic_write_compare(u64 cnt) | |
| 170 | +void notrace gic_write_compare(u64 cnt) | |
| 171 | 171 | { |
| 172 | 172 | if (mips_cm_is64) { |
| 173 | 173 | gic_write(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE), cnt); |
| @@ -179,7 +179,7 @@ void gic_write_compare(u64 cnt) · 5 unmodified lines | ||
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | −void gic_write_cpu_compare(u64 cnt, int cpu) | |
| 182 | +void notrace gic_write_cpu_compare(u64 cnt, int cpu) | |
| 183 | 183 | { |
| 184 | 184 | unsigned long flags; |
| 185 | 185 | |
| @@ -142,7 +142,7 @@ static struct irq_chip xtensa_mx_irq_chip = { · 141 unmodified lines | ||
| 142 | 142 | int __init xtensa_mx_init_legacy(struct device_node *interrupt_parent) |
| 143 | 143 | { |
| 144 | 144 | struct irq_domain *root_domain = |
| 145 | − irq_domain_add_legacy(NULL, NR_IRQS, 0, 0, | |
| 145 | + irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0, | |
| 146 | 146 | &xtensa_mx_irq_domain_ops, |
| 147 | 147 | &xtensa_mx_irq_chip); |
| 148 | 148 | irq_set_default_host(root_domain); |
| @@ -89,7 +89,7 @@ static struct irq_chip xtensa_irq_chip = { · 88 unmodified lines | ||
| 89 | 89 | int __init xtensa_pic_init_legacy(struct device_node *interrupt_parent) |
| 90 | 90 | { |
| 91 | 91 | struct irq_domain *root_domain = |
| 92 | − irq_domain_add_legacy(NULL, NR_IRQS, 0, 0, | |
| 92 | + irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0, | |
| 93 | 93 | &xtensa_irq_domain_ops, &xtensa_irq_chip); |
| 94 | 94 | irq_set_default_host(root_domain); |
| 95 | 95 | return 0; |
| @@ -242,7 +242,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg, · 241 unmodified lines | ||
| 242 | 242 | |
| 243 | 243 | spin_lock_irqsave(lock, flags); |
| 244 | 244 | val = bcm6328_led_read(addr); |
| 245 | − val |= (BIT(reg) << (((sel % 4) * 4) + 16)); | |
| 245 | + val |= (BIT(reg % 4) << (((sel % 4) * 4) + 16)); | |
| 246 | 246 | bcm6328_led_write(addr, val); |
| 247 | 247 | spin_unlock_irqrestore(lock, flags); |
| 248 | 248 | } |
| @@ -269,7 +269,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg, · 20 unmodified lines | ||
| 269 | 269 | |
| 270 | 270 | spin_lock_irqsave(lock, flags); |
| 271 | 271 | val = bcm6328_led_read(addr); |
| 272 | − val |= (BIT(reg) << ((sel % 4) * 4)); | |
| 272 | + val |= (BIT(reg % 4) << ((sel % 4) * 4)); | |
| 273 | 273 | bcm6328_led_write(addr, val); |
| 274 | 274 | spin_unlock_irqrestore(lock, flags); |
| 275 | 275 | } |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/sched/loadavg.h> |
| 21 | 21 | #include <linux/leds.h> |
| 22 | 22 | #include <linux/reboot.h> |
| 23 | −#include <linux/suspend.h> | |
| 24 | 23 | #include "../leds.h" |
| 25 | 24 | |
| 26 | 25 | static int panic_heartbeats; |
| @@ -163,30 +162,6 @@ static struct led_trigger heartbeat_led_trigger = { · 136 unmodified lines | ||
| 163 | 162 | .deactivate = heartbeat_trig_deactivate, |
| 164 | 163 | }; |
| 165 | 164 | |
| 166 | −static int heartbeat_pm_notifier(struct notifier_block *nb, | |
| 167 | − unsigned long pm_event, void *unused) | |
| 168 | −{ | |
| 169 | − int rc; | |
| 170 | − | |
| 171 | − switch (pm_event) { | |
| 172 | − case PM_SUSPEND_PREPARE: | |
| 173 | − case PM_HIBERNATION_PREPARE: | |
| 174 | − case PM_RESTORE_PREPARE: | |
| 175 | − led_trigger_unregister(&heartbeat_led_trigger); | |
| 176 | − break; | |
| 177 | − case PM_POST_SUSPEND: | |
| 178 | − case PM_POST_HIBERNATION: | |
| 179 | − case PM_POST_RESTORE: | |
| 180 | − rc = led_trigger_register(&heartbeat_led_trigger); | |
| 181 | − if (rc) | |
| 182 | − pr_err("could not re-register heartbeat trigger\n"); | |
| 183 | − break; | |
| 184 | − default: | |
| 185 | − break; | |
| 186 | − } | |
| 187 | − return NOTIFY_DONE; | |
| 188 | −} | |
| 189 | − | |
| 190 | 165 | static int heartbeat_reboot_notifier(struct notifier_block *nb, |
| 191 | 166 | unsigned long code, void *unused) |
| 192 | 167 | { |
| @@ -201,10 +176,6 @@ static int heartbeat_panic_notifier(struct notifier_block *nb, · 8 unmodified lines | ||
| 201 | 176 | return NOTIFY_DONE; |
| 202 | 177 | } |
| 203 | 178 | |
| 204 | −static struct notifier_block heartbeat_pm_nb = { | |
| 205 | − .notifier_call = heartbeat_pm_notifier, | |
| 206 | −}; | |
| 207 | − | |
| 208 | 179 | static struct notifier_block heartbeat_reboot_nb = { |
| 209 | 180 | .notifier_call = heartbeat_reboot_notifier, |
| 210 | 181 | }; |
| @@ -221,14 +192,12 @@ static int __init heartbeat_trig_init(void) · 10 unmodified lines | ||
| 221 | 192 | atomic_notifier_chain_register(&panic_notifier_list, |
| 222 | 193 | &heartbeat_panic_nb); |
| 223 | 194 | register_reboot_notifier(&heartbeat_reboot_nb); |
| 224 | − register_pm_notifier(&heartbeat_pm_nb); | |
| 225 | 195 | } |
| 226 | 196 | return rc; |
| 227 | 197 | } |
| 228 | 198 | |
| 229 | 199 | static void __exit heartbeat_trig_exit(void) |
| 230 | 200 | { |
| 231 | − unregister_pm_notifier(&heartbeat_pm_nb); | |
| 232 | 201 | unregister_reboot_notifier(&heartbeat_reboot_nb); |
| 233 | 202 | atomic_notifier_chain_unregister(&panic_notifier_list, |
| 234 | 203 | &heartbeat_panic_nb); |
| @@ -1105,10 +1105,13 @@ static void schedule_autocommit(struct dm_integrity_c *ic) · 1104 unmodified lines | ||
| 1105 | 1105 | static void submit_flush_bio(struct dm_integrity_c *ic, struct dm_integrity_io *dio) |
| 1106 | 1106 | { |
| 1107 | 1107 | struct bio *bio; |
| 1108 | − spin_lock_irq(&ic->endio_wait.lock); | |
| 1108 | + unsigned long flags; | |
| 1109 | + | |
| 1110 | + spin_lock_irqsave(&ic->endio_wait.lock, flags); | |
| 1109 | 1111 | bio = dm_bio_from_per_bio_data(dio, sizeof(struct dm_integrity_io)); |
| 1110 | 1112 | bio_list_add(&ic->flush_bio_list, bio); |
| 1111 | − spin_unlock_irq(&ic->endio_wait.lock); | |
| 1113 | + spin_unlock_irqrestore(&ic->endio_wait.lock, flags); | |
| 1114 | + | |
| 1112 | 1115 | queue_work(ic->commit_wq, &ic->commit_work); |
| 1113 | 1116 | } |
| 1114 | 1117 | |
| @@ -3040,6 +3043,11 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) · 1925 unmodified lines | ||
| 3040 | 3043 | ti->error = "The device is too small"; |
| 3041 | 3044 | goto bad; |
| 3042 | 3045 | } |
| 3046 | + if (ti->len > ic->provided_data_sectors) { | |
| 3047 | + r = -EINVAL; | |
| 3048 | + ti->error = "Not enough provided sectors for requested mapping size"; | |
| 3049 | + goto bad; | |
| 3050 | + } | |
| 3043 | 3051 | |
| 3044 | 3052 | if (!buffer_sectors) |
| 3045 | 3053 | buffer_sectors = 1; |
| @@ -317,8 +317,8 @@ static void do_region(int op, int op_flags, unsigned region, · 316 unmodified lines | ||
| 317 | 317 | else if (op == REQ_OP_WRITE_SAME) |
| 318 | 318 | special_cmd_max_sectors = q->limits.max_write_same_sectors; |
| 319 | 319 | if ((op == REQ_OP_DISCARD || op == REQ_OP_WRITE_ZEROES || |
| 320 | − op == REQ_OP_WRITE_SAME) && | |
| 321 | − special_cmd_max_sectors == 0) { | |
| 320 | + op == REQ_OP_WRITE_SAME) && special_cmd_max_sectors == 0) { | |
| 321 | + atomic_inc(&io->count); | |
| 322 | 322 | dec_count(io, region, -EOPNOTSUPP); |
| 323 | 323 | return; |
| 324 | 324 | } |
| @@ -145,6 +145,7 @@ static void dispatch_bios(void *context, struct bio_list *bio_list) · 144 unmodified lines | ||
| 145 | 145 | |
| 146 | 146 | struct dm_raid1_bio_record { |
| 147 | 147 | struct mirror *m; |
| 148 | + /* if details->bi_bdev == NULL, details were not saved */ | |
| 148 | 149 | struct dm_bio_details details; |
| 149 | 150 | region_t write_region; |
| 150 | 151 | }; |
| @@ -1198,6 +1199,8 @@ static int mirror_map(struct dm_target *ti, struct bio *bio) · 1047 unmodified lines | ||
| 1198 | 1199 | struct dm_raid1_bio_record *bio_record = |
| 1199 | 1200 | dm_per_bio_data(bio, sizeof(struct dm_raid1_bio_record)); |
| 1200 | 1201 | |
| 1202 | + bio_record->details.bi_bdev = NULL; | |
| 1203 | + | |
| 1201 | 1204 | if (rw == WRITE) { |
| 1202 | 1205 | /* Save region for mirror_end_io() handler */ |
| 1203 | 1206 | bio_record->write_region = dm_rh_bio_to_region(ms->rh, bio); |
| @@ -1256,12 +1259,22 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) · 52 unmodified lines | ||
| 1256 | 1259 | } |
| 1257 | 1260 | |
| 1258 | 1261 | if (error == -EOPNOTSUPP) |
| 1259 | − return error; | |
| 1262 | + goto out; | |
| 1260 | 1263 | |
| 1261 | 1264 | if ((error == -EWOULDBLOCK) && (bio->bi_opf & REQ_RAHEAD)) |
| 1262 | − return error; | |
| 1265 | + goto out; | |
| 1263 | 1266 | |
| 1264 | 1267 | if (unlikely(error)) { |
| 1268 | + if (!bio_record->details.bi_bdev) { | |
| 1269 | + /* | |
| 1270 | + * There wasn't enough memory to record necessary | |
| 1271 | + * information for a retry or there was no other | |
| 1272 | + * mirror in-sync. | |
| 1273 | + */ | |
| 1274 | + DMERR_LIMIT("Mirror read failed."); | |
| 1275 | + return -EIO; | |
| 1276 | + } | |
| 1277 | + | |
| 1265 | 1278 | m = bio_record->m; |
| 1266 | 1279 | |
| 1267 | 1280 | DMERR("Mirror read failed from %s. Trying alternative device.", |
| @@ -1277,6 +1290,7 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) · 9 unmodified lines | ||
| 1277 | 1290 | bd = &bio_record->details; |
| 1278 | 1291 | |
| 1279 | 1292 | dm_bio_restore(bd, bio); |
| 1293 | + bio_record->details.bi_bdev = NULL; | |
| 1280 | 1294 | bio->bi_error = 0; |
| 1281 | 1295 | |
| 1282 | 1296 | queue_bio(ms, bio, rw); |
| @@ -1285,6 +1299,9 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) · 2 unmodified lines | ||
| 1285 | 1299 | DMERR("All replicated volumes dead, failing I/O"); |
| 1286 | 1300 | } |
| 1287 | 1301 | |
| 1302 | +out: | |
| 1303 | + bio_record->details.bi_bdev = NULL; | |
| 1304 | + | |
| 1288 | 1305 | return error; |
| 1289 | 1306 | } |
| 1290 | 1307 | |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | config MEDIA_CEC_RC |
| 2 | 2 | bool "HDMI CEC RC integration" |
| 3 | 3 | depends on CEC_CORE && RC_CORE |
| 4 | + depends on CEC_CORE=m || RC_CORE=y | |
| 4 | 5 | ---help--- |
| 5 | 6 | Pass on CEC remote control messages to the RC framework. |
| @@ -271,16 +271,10 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh, · 270 unmodified lines | ||
| 271 | 271 | bool block, struct cec_msg __user *parg) |
| 272 | 272 | { |
| 273 | 273 | struct cec_msg msg = {}; |
| 274 | − long err = 0; | |
| 274 | + long err; | |
| 275 | 275 | |
| 276 | 276 | if (copy_from_user(&msg, parg, sizeof(msg))) |
| 277 | 277 | return -EFAULT; |
| 278 | − mutex_lock(&adap->lock); | |
| 279 | − if (!adap->is_configured && fh->mode_follower < CEC_MODE_MONITOR) | |
| 280 | − err = -ENONET; | |
| 281 | − mutex_unlock(&adap->lock); | |
| 282 | − if (err) | |
| 283 | − return err; | |
| 284 | 278 | |
| 285 | 279 | err = cec_receive_msg(fh, &msg, block); |
| 286 | 280 | if (err) |
| @@ -223,7 +223,7 @@ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val) · 222 unmodified lines | ||
| 223 | 223 | static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg, |
| 224 | 224 | u8 mask, u8 val) |
| 225 | 225 | { |
| 226 | − i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2); | |
| 226 | + i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 1) & mask) | val, 1); | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg) |
| @@ -183,9 +183,15 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) · 182 unmodified lines | ||
| 183 | 183 | static unsigned long delt; |
| 184 | 184 | unsigned long deltintr; |
| 185 | 185 | unsigned long flags; |
| 186 | + int counter = 0; | |
| 186 | 187 | int iir, lsr; |
| 187 | 188 | |
| 188 | 189 | while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) { |
| 190 | + if (++counter > 256) { | |
| 191 | + dev_err(&sir_ir_dev->dev, "Trapped in interrupt"); | |
| 192 | + break; | |
| 193 | + } | |
| 194 | + | |
| 189 | 195 | switch (iir & UART_IIR_ID) { /* FIXME toto treba preriedit */ |
| 190 | 196 | case UART_IIR_MSI: |
| 191 | 197 | (void)inb(io + UART_MSR); |
| @@ -336,6 +336,7 @@ static int rain_connect(struct serio *serio, struct serio_driver *drv) · 335 unmodified lines | ||
| 336 | 336 | serio_set_drvdata(serio, rain); |
| 337 | 337 | INIT_WORK(&rain->work, rain_irq_work_handler); |
| 338 | 338 | mutex_init(&rain->write_lock); |
| 339 | + spin_lock_init(&rain->buf_lock); | |
| 339 | 340 | |
| 340 | 341 | err = serio_open(serio, drv); |
| 341 | 342 | if (err) |
| @@ -868,7 +868,7 @@ EXPORT_SYMBOL_GPL(vb2_core_create_bufs); · 867 unmodified lines | ||
| 868 | 868 | |
| 869 | 869 | void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no) |
| 870 | 870 | { |
| 871 | − if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv) | |
| 871 | + if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv) | |
| 872 | 872 | return NULL; |
| 873 | 873 | |
| 874 | 874 | return call_ptr_memop(vb, vaddr, vb->planes[plane_no].mem_priv); |
| @@ -245,8 +245,7 @@ static int arizona_poll_reg(struct arizona *arizona, · 244 unmodified lines | ||
| 245 | 245 | int ret; |
| 246 | 246 | |
| 247 | 247 | ret = regmap_read_poll_timeout(arizona->regmap, |
| 248 | − ARIZONA_INTERRUPT_RAW_STATUS_5, val, | |
| 249 | − ((val & mask) == target), | |
| 248 | + reg, val, ((val & mask) == target), | |
| 250 | 249 | ARIZONA_REG_POLL_DELAY_US, |
| 251 | 250 | timeout_ms * 1000); |
| 252 | 251 | if (ret) |
| @@ -210,6 +210,15 @@ static void meson_mmc_get_transfer_mode(struct mmc_host *mmc, · 209 unmodified lines | ||
| 210 | 210 | int i; |
| 211 | 211 | bool use_desc_chain_mode = true; |
| 212 | 212 | |
| 213 | + /* | |
| 214 | + * Broken SDIO with AP6255-based WiFi on Khadas VIM Pro has been | |
| 215 | + * reported. For some strange reason this occurs in descriptor | |
| 216 | + * chain mode only. So let's fall back to bounce buffer mode | |
| 217 | + * for command SD_IO_RW_EXTENDED. | |
| 218 | + */ | |
| 219 | + if (mrq->cmd->opcode == SD_IO_RW_EXTENDED) | |
| 220 | + return; | |
| 221 | + | |
| 213 | 222 | for_each_sg(data->sg, sg, data->sg_len, i) |
| 214 | 223 | /* check for 8 byte alignment */ |
| 215 | 224 | if (sg->offset & 7) { |
| @@ -90,10 +90,13 @@ enum ad_link_speed_type { · 89 unmodified lines | ||
| 90 | 90 | AD_LINK_SPEED_100MBPS, |
| 91 | 91 | AD_LINK_SPEED_1000MBPS, |
| 92 | 92 | AD_LINK_SPEED_2500MBPS, |
| 93 | + AD_LINK_SPEED_5000MBPS, | |
| 93 | 94 | AD_LINK_SPEED_10000MBPS, |
| 95 | + AD_LINK_SPEED_14000MBPS, | |
| 94 | 96 | AD_LINK_SPEED_20000MBPS, |
| 95 | 97 | AD_LINK_SPEED_25000MBPS, |
| 96 | 98 | AD_LINK_SPEED_40000MBPS, |
| 99 | + AD_LINK_SPEED_50000MBPS, | |
| 97 | 100 | AD_LINK_SPEED_56000MBPS, |
| 98 | 101 | AD_LINK_SPEED_100000MBPS, |
| 99 | 102 | }; |
| @@ -259,10 +262,13 @@ static inline int __check_agg_selection_timer(struct port *port) · 159 unmodified lines | ||
| 259 | 262 | * %AD_LINK_SPEED_100MBPS, |
| 260 | 263 | * %AD_LINK_SPEED_1000MBPS, |
| 261 | 264 | * %AD_LINK_SPEED_2500MBPS, |
| 265 | + * %AD_LINK_SPEED_5000MBPS, | |
| 262 | 266 | * %AD_LINK_SPEED_10000MBPS |
| 267 | + * %AD_LINK_SPEED_14000MBPS, | |
| 263 | 268 | * %AD_LINK_SPEED_20000MBPS |
| 264 | 269 | * %AD_LINK_SPEED_25000MBPS |
| 265 | 270 | * %AD_LINK_SPEED_40000MBPS |
| 271 | + * %AD_LINK_SPEED_50000MBPS | |
| 266 | 272 | * %AD_LINK_SPEED_56000MBPS |
| 267 | 273 | * %AD_LINK_SPEED_100000MBPS |
| 268 | 274 | */ |
| @@ -296,10 +302,18 @@ static u16 __get_link_speed(struct port *port) · 27 unmodified lines | ||
| 296 | 302 | speed = AD_LINK_SPEED_2500MBPS; |
| 297 | 303 | break; |
| 298 | 304 | |
| 305 | + case SPEED_5000: | |
| 306 | + speed = AD_LINK_SPEED_5000MBPS; | |
| 307 | + break; | |
| 308 | + | |
| 299 | 309 | case SPEED_10000: |
| 300 | 310 | speed = AD_LINK_SPEED_10000MBPS; |
| 301 | 311 | break; |
| 302 | 312 | |
| 313 | + case SPEED_14000: | |
| 314 | + speed = AD_LINK_SPEED_14000MBPS; | |
| 315 | + break; | |
| 316 | + | |
| 303 | 317 | case SPEED_20000: |
| 304 | 318 | speed = AD_LINK_SPEED_20000MBPS; |
| 305 | 319 | break; |
| @@ -312,6 +326,10 @@ static u16 __get_link_speed(struct port *port) · 6 unmodified lines | ||
| 312 | 326 | speed = AD_LINK_SPEED_40000MBPS; |
| 313 | 327 | break; |
| 314 | 328 | |
| 329 | + case SPEED_50000: | |
| 330 | + speed = AD_LINK_SPEED_50000MBPS; | |
| 331 | + break; | |
| 332 | + | |
| 315 | 333 | case SPEED_56000: |
| 316 | 334 | speed = AD_LINK_SPEED_56000MBPS; |
| 317 | 335 | break; |
| @@ -707,9 +725,15 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 389 unmodified lines | ||
| 707 | 725 | case AD_LINK_SPEED_2500MBPS: |
| 708 | 726 | bandwidth = nports * 2500; |
| 709 | 727 | break; |
| 728 | + case AD_LINK_SPEED_5000MBPS: | |
| 729 | + bandwidth = nports * 5000; | |
| 730 | + break; | |
| 710 | 731 | case AD_LINK_SPEED_10000MBPS: |
| 711 | 732 | bandwidth = nports * 10000; |
| 712 | 733 | break; |
| 734 | + case AD_LINK_SPEED_14000MBPS: | |
| 735 | + bandwidth = nports * 14000; | |
| 736 | + break; | |
| 713 | 737 | case AD_LINK_SPEED_20000MBPS: |
| 714 | 738 | bandwidth = nports * 20000; |
| 715 | 739 | break; |
| @@ -719,6 +743,9 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 3 unmodified lines | ||
| 719 | 743 | case AD_LINK_SPEED_40000MBPS: |
| 720 | 744 | bandwidth = nports * 40000; |
| 721 | 745 | break; |
| 746 | + case AD_LINK_SPEED_50000MBPS: | |
| 747 | + bandwidth = nports * 50000; | |
| 748 | + break; | |
| 722 | 749 | case AD_LINK_SPEED_56000MBPS: |
| 723 | 750 | bandwidth = nports * 56000; |
| 724 | 751 | break; |
| @@ -4192,7 +4192,6 @@ static void bond_destructor(struct net_device *bond_dev) · 4191 unmodified lines | ||
| 4192 | 4192 | struct bonding *bond = netdev_priv(bond_dev); |
| 4193 | 4193 | if (bond->wq) |
| 4194 | 4194 | destroy_workqueue(bond->wq); |
| 4195 | − free_netdev(bond_dev); | |
| 4196 | 4195 | } |
| 4197 | 4196 | |
| 4198 | 4197 | void bond_setup(struct net_device *bond_dev) |
| @@ -4212,7 +4211,8 @@ void bond_setup(struct net_device *bond_dev) · 13 unmodified lines | ||
| 4212 | 4211 | bond_dev->netdev_ops = &bond_netdev_ops; |
| 4213 | 4212 | bond_dev->ethtool_ops = &bond_ethtool_ops; |
| 4214 | 4213 | |
| 4215 | − bond_dev->destructor = bond_destructor; | |
| 4214 | + bond_dev->needs_free_netdev = true; | |
| 4215 | + bond_dev->priv_destructor = bond_destructor; | |
| 4216 | 4216 | |
| 4217 | 4217 | SET_NETDEV_DEVTYPE(bond_dev, &bond_type); |
| 4218 | 4218 | |
| @@ -4736,7 +4736,7 @@ int bond_create(struct net *net, const char *name) · 517 unmodified lines | ||
| 4736 | 4736 | |
| 4737 | 4737 | rtnl_unlock(); |
| 4738 | 4738 | if (res < 0) |
| 4739 | − bond_destructor(bond_dev); | |
| 4739 | + free_netdev(bond_dev); | |
| 4740 | 4740 | return res; |
| 4741 | 4741 | } |
| 4742 | 4742 | |
| @@ -1121,7 +1121,7 @@ static void cfhsi_setup(struct net_device *dev) · 1120 unmodified lines | ||
| 1121 | 1121 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
| 1122 | 1122 | dev->mtu = CFHSI_MAX_CAIF_FRAME_SZ; |
| 1123 | 1123 | dev->priv_flags |= IFF_NO_QUEUE; |
| 1124 | − dev->destructor = free_netdev; | |
| 1124 | + dev->needs_free_netdev = true; | |
| 1125 | 1125 | dev->netdev_ops = &cfhsi_netdevops; |
| 1126 | 1126 | for (i = 0; i < CFHSI_PRIO_LAST; ++i) |
| 1127 | 1127 | skb_queue_head_init(&cfhsi->qhead[i]); |
| @@ -428,7 +428,7 @@ static void caifdev_setup(struct net_device *dev) · 427 unmodified lines | ||
| 428 | 428 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
| 429 | 429 | dev->mtu = CAIF_MAX_MTU; |
| 430 | 430 | dev->priv_flags |= IFF_NO_QUEUE; |
| 431 | − dev->destructor = free_netdev; | |
| 431 | + dev->needs_free_netdev = true; | |
| 432 | 432 | skb_queue_head_init(&serdev->head); |
| 433 | 433 | serdev->common.link_select = CAIF_LINK_LOW_LATENCY; |
| 434 | 434 | serdev->common.use_frag = true; |
| @@ -712,7 +712,7 @@ static void cfspi_setup(struct net_device *dev) · 711 unmodified lines | ||
| 712 | 712 | dev->flags = IFF_NOARP | IFF_POINTOPOINT; |
| 713 | 713 | dev->priv_flags |= IFF_NO_QUEUE; |
| 714 | 714 | dev->mtu = SPI_MAX_PAYLOAD_SIZE; |
| 715 | − dev->destructor = free_netdev; | |
| 715 | + dev->needs_free_netdev = true; | |
| 716 | 716 | skb_queue_head_init(&cfspi->qhead); |
| 717 | 717 | skb_queue_head_init(&cfspi->chead); |
| 718 | 718 | cfspi->cfdev.link_select = CAIF_LINK_HIGH_BANDW; |
| @@ -617,7 +617,7 @@ static void cfv_netdev_setup(struct net_device *netdev) · 616 unmodified lines | ||
| 617 | 617 | netdev->tx_queue_len = 100; |
| 618 | 618 | netdev->flags = IFF_POINTOPOINT | IFF_NOARP; |
| 619 | 619 | netdev->mtu = CFV_DEF_MTU_SIZE; |
| 620 | − netdev->destructor = free_netdev; | |
| 620 | + netdev->needs_free_netdev = true; | |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /* Create debugfs counters for the device */ |
| @@ -391,6 +391,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, · 390 unmodified lines | ||
| 391 | 391 | can_update_state_error_stats(dev, new_state); |
| 392 | 392 | priv->state = new_state; |
| 393 | 393 | |
| 394 | + if (!cf) | |
| 395 | + return; | |
| 396 | + | |
| 394 | 397 | if (unlikely(new_state == CAN_STATE_BUS_OFF)) { |
| 395 | 398 | cf->can_id |= CAN_ERR_BUSOFF; |
| 396 | 399 | return; |
| @@ -489,7 +489,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv, · 488 unmodified lines | ||
| 489 | 489 | struct pucan_rx_msg *msg_list, int msg_count) |
| 490 | 490 | { |
| 491 | 491 | void *msg_ptr = msg_list; |
| 492 | − int i, msg_size; | |
| 492 | + int i, msg_size = 0; | |
| 493 | 493 | |
| 494 | 494 | for (i = 0; i < msg_count; i++) { |
| 495 | 495 | msg_size = peak_canfd_handle_msg(priv, msg_ptr); |
| @@ -417,7 +417,7 @@ static int slc_open(struct net_device *dev) · 416 unmodified lines | ||
| 417 | 417 | static void slc_free_netdev(struct net_device *dev) |
| 418 | 418 | { |
| 419 | 419 | int i = dev->base_addr; |
| 420 | − free_netdev(dev); | |
| 420 | + | |
| 421 | 421 | slcan_devs[i] = NULL; |
| 422 | 422 | } |
| 423 | 423 | |
| @@ -436,7 +436,8 @@ static const struct net_device_ops slc_netdev_ops = { · 12 unmodified lines | ||
| 436 | 436 | static void slc_setup(struct net_device *dev) |
| 437 | 437 | { |
| 438 | 438 | dev->netdev_ops = &slc_netdev_ops; |
| 439 | − dev->destructor = slc_free_netdev; | |
| 439 | + dev->needs_free_netdev = true; | |
| 440 | + dev->priv_destructor = slc_free_netdev; | |
| 440 | 441 | |
| 441 | 442 | dev->hard_header_len = 0; |
| 442 | 443 | dev->addr_len = 0; |
| @@ -761,8 +762,6 @@ static void __exit slcan_exit(void) · 318 unmodified lines | ||
| 761 | 762 | if (sl->tty) { |
| 762 | 763 | printk(KERN_ERR "%s: tty discipline still running\n", |
| 763 | 764 | dev->name); |
| 764 | − /* Intentionally leak the control block. */ | |
| 765 | − dev->destructor = NULL; | |
| 766 | 765 | } |
| 767 | 766 | |
| 768 | 767 | unregister_netdev(dev); |
| @@ -265,6 +265,8 @@ static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev) · 264 unmodified lines | ||
| 265 | 265 | sizeof(*dm), |
| 266 | 266 | 1000); |
| 267 | 267 | |
| 268 | + kfree(dm); | |
| 269 | + | |
| 268 | 270 | return rc; |
| 269 | 271 | } |
| 270 | 272 | |
| @@ -908,8 +908,6 @@ static int peak_usb_probe(struct usb_interface *intf, · 907 unmodified lines | ||
| 908 | 908 | const struct peak_usb_adapter *peak_usb_adapter = NULL; |
| 909 | 909 | int i, err = -ENOMEM; |
| 910 | 910 | |
| 911 | − usb_dev = interface_to_usbdev(intf); | |
| 912 | − | |
| 913 | 911 | /* get corresponding PCAN-USB adapter */ |
| 914 | 912 | for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++) |
| 915 | 913 | if (peak_usb_adapters_list[i]->device_id == usb_id_product) { |
| @@ -920,7 +918,7 @@ static int peak_usb_probe(struct usb_interface *intf, · 4 unmodified lines | ||
| 920 | 918 | if (!peak_usb_adapter) { |
| 921 | 919 | /* should never come except device_id bad usage in this file */ |
| 922 | 920 | pr_err("%s: didn't find device id. 0x%x in devices list\n", |
| 923 | − PCAN_USB_DRIVER_NAME, usb_dev->descriptor.idProduct); | |
| 921 | + PCAN_USB_DRIVER_NAME, usb_id_product); | |
| 924 | 922 | return -ENODEV; |
| 925 | 923 | } |
| 926 | 924 | |
| @@ -152,7 +152,7 @@ static const struct net_device_ops vcan_netdev_ops = { · 151 unmodified lines | ||
| 152 | 152 | static void vcan_setup(struct net_device *dev) |
| 153 | 153 | { |
| 154 | 154 | dev->type = ARPHRD_CAN; |
| 155 | − dev->mtu = CAN_MTU; | |
| 155 | + dev->mtu = CANFD_MTU; | |
| 156 | 156 | dev->hard_header_len = 0; |
| 157 | 157 | dev->addr_len = 0; |
| 158 | 158 | dev->tx_queue_len = 0; |
| @@ -163,7 +163,7 @@ static void vcan_setup(struct net_device *dev) · 4 unmodified lines | ||
| 163 | 163 | dev->flags |= IFF_ECHO; |
| 164 | 164 | |
| 165 | 165 | dev->netdev_ops = &vcan_netdev_ops; |
| 166 | − dev->destructor = free_netdev; | |
| 166 | + dev->needs_free_netdev = true; | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | static struct rtnl_link_ops vcan_link_ops __read_mostly = { |
| @@ -150,13 +150,13 @@ static const struct net_device_ops vxcan_netdev_ops = { · 149 unmodified lines | ||
| 150 | 150 | static void vxcan_setup(struct net_device *dev) |
| 151 | 151 | { |
| 152 | 152 | dev->type = ARPHRD_CAN; |
| 153 | − dev->mtu = CAN_MTU; | |
| 153 | + dev->mtu = CANFD_MTU; | |
| 154 | 154 | dev->hard_header_len = 0; |
| 155 | 155 | dev->addr_len = 0; |
| 156 | 156 | dev->tx_queue_len = 0; |
| 157 | 157 | dev->flags = (IFF_NOARP|IFF_ECHO); |
| 158 | 158 | dev->netdev_ops = &vxcan_netdev_ops; |
| 159 | − dev->destructor = free_netdev; | |
| 159 | + dev->needs_free_netdev = true; | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /* forward declaration for rtnl_create_link() */ |
| @@ -328,7 +328,6 @@ static void dummy_free_netdev(struct net_device *dev) · 327 unmodified lines | ||
| 328 | 328 | struct dummy_priv *priv = netdev_priv(dev); |
| 329 | 329 | |
| 330 | 330 | kfree(priv->vfinfo); |
| 331 | − free_netdev(dev); | |
| 332 | 331 | } |
| 333 | 332 | |
| 334 | 333 | static void dummy_setup(struct net_device *dev) |
| @@ -338,7 +337,8 @@ static void dummy_setup(struct net_device *dev) · 3 unmodified lines | ||
| 338 | 337 | /* Initialize the device structure. */ |
| 339 | 338 | dev->netdev_ops = &dummy_netdev_ops; |
| 340 | 339 | dev->ethtool_ops = &dummy_ethtool_ops; |
| 341 | − dev->destructor = dummy_free_netdev; | |
| 340 | + dev->needs_free_netdev = true; | |
| 341 | + dev->priv_destructor = dummy_free_netdev; | |
| 342 | 342 | |
| 343 | 343 | /* Fill in device structure with ethernet-generic values. */ |
| 344 | 344 | dev->flags |= IFF_NOARP; |
| @@ -61,6 +61,8 @@ · 60 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | #define ENA_MMIO_READ_TIMEOUT 0xFFFFFFFF |
| 63 | 63 | |
| 64 | +#define ENA_REGS_ADMIN_INTR_MASK 1 | |
| 65 | + | |
| 64 | 66 | /*****************************************************************************/ |
| 65 | 67 | /*****************************************************************************/ |
| 66 | 68 | /*****************************************************************************/ |
| @@ -232,11 +234,9 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queu · 165 unmodified lines | ||
| 232 | 234 | tail_masked = admin_queue->sq.tail & queue_size_mask; |
| 233 | 235 | |
| 234 | 236 | /* In case of queue FULL */ |
| 235 | − cnt = admin_queue->sq.tail - admin_queue->sq.head; | |
| 237 | + cnt = atomic_read(&admin_queue->outstanding_cmds); | |
| 236 | 238 | if (cnt >= admin_queue->q_depth) { |
| 237 | − pr_debug("admin queue is FULL (tail %d head %d depth: %d)\n", | |
| 238 | − admin_queue->sq.tail, admin_queue->sq.head, | |
| 239 | − admin_queue->q_depth); | |
| 239 | + pr_debug("admin queue is full.\n"); | |
| 240 | 240 | admin_queue->stats.out_of_space++; |
| 241 | 241 | return ERR_PTR(-ENOSPC); |
| 242 | 242 | } |
| @@ -508,15 +508,20 @@ static int ena_com_comp_status_to_errno(u8 comp_status) · 265 unmodified lines | ||
| 508 | 508 | static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx, |
| 509 | 509 | struct ena_com_admin_queue *admin_queue) |
| 510 | 510 | { |
| 511 | − unsigned long flags; | |
| 512 | − u32 start_time; | |
| 511 | + unsigned long flags, timeout; | |
| 513 | 512 | int ret; |
| 514 | 513 | |
| 515 | − start_time = ((u32)jiffies_to_usecs(jiffies)); | |
| 514 | + timeout = jiffies + ADMIN_CMD_TIMEOUT_US; | |
| 515 | + | |
| 516 | + while (1) { | |
| 517 | + spin_lock_irqsave(&admin_queue->q_lock, flags); | |
| 518 | + ena_com_handle_admin_completion(admin_queue); | |
| 519 | + spin_unlock_irqrestore(&admin_queue->q_lock, flags); | |
| 520 | + | |
| 521 | + if (comp_ctx->status != ENA_CMD_SUBMITTED) | |
| 522 | + break; | |
| 516 | 523 | |
| 517 | − while (comp_ctx->status == ENA_CMD_SUBMITTED) { | |
| 518 | − if ((((u32)jiffies_to_usecs(jiffies)) - start_time) > | |
| 519 | − ADMIN_CMD_TIMEOUT_US) { | |
| 524 | + if (time_is_before_jiffies(timeout)) { | |
| 520 | 525 | pr_err("Wait for completion (polling) timeout\n"); |
| 521 | 526 | /* ENA didn't have any completion */ |
| 522 | 527 | spin_lock_irqsave(&admin_queue->q_lock, flags); |
| @@ -528,10 +533,6 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c · 5 unmodified lines | ||
| 528 | 533 | goto err; |
| 529 | 534 | } |
| 530 | 535 | |
| 531 | − spin_lock_irqsave(&admin_queue->q_lock, flags); | |
| 532 | − ena_com_handle_admin_completion(admin_queue); | |
| 533 | − spin_unlock_irqrestore(&admin_queue->q_lock, flags); | |
| 534 | − | |
| 535 | 536 | msleep(100); |
| 536 | 537 | } |
| 537 | 538 | |
| @@ -1455,6 +1456,12 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev) · 917 unmodified lines | ||
| 1455 | 1456 | |
| 1456 | 1457 | void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling) |
| 1457 | 1458 | { |
| 1459 | + u32 mask_value = 0; | |
| 1460 | + | |
| 1461 | + if (polling) | |
| 1462 | + mask_value = ENA_REGS_ADMIN_INTR_MASK; | |
| 1463 | + | |
| 1464 | + writel(mask_value, ena_dev->reg_bar + ENA_REGS_INTR_MASK_OFF); | |
| 1458 | 1465 | ena_dev->admin_queue.polling = polling; |
| 1459 | 1466 | } |
| 1460 | 1467 | |
| @@ -80,7 +80,6 @@ static const struct ena_stats ena_stats_tx_strings[] = { · 79 unmodified lines | ||
| 80 | 80 | ENA_STAT_TX_ENTRY(tx_poll), |
| 81 | 81 | ENA_STAT_TX_ENTRY(doorbells), |
| 82 | 82 | ENA_STAT_TX_ENTRY(prepare_ctx_err), |
| 83 | − ENA_STAT_TX_ENTRY(missing_tx_comp), | |
| 84 | 83 | ENA_STAT_TX_ENTRY(bad_req_id), |
| 85 | 84 | }; |
| 86 | 85 | |
| @@ -94,6 +93,7 @@ static const struct ena_stats ena_stats_rx_strings[] = { · 7 unmodified lines | ||
| 94 | 93 | ENA_STAT_RX_ENTRY(dma_mapping_err), |
| 95 | 94 | ENA_STAT_RX_ENTRY(bad_desc_num), |
| 96 | 95 | ENA_STAT_RX_ENTRY(rx_copybreak_pkt), |
| 96 | + ENA_STAT_RX_ENTRY(empty_rx_ring), | |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | 99 | static const struct ena_stats ena_stats_ena_com_strings[] = { |
| @@ -190,6 +190,7 @@ static void ena_init_io_rings(struct ena_adapter *adapter) · 189 unmodified lines | ||
| 190 | 190 | rxr->sgl_size = adapter->max_rx_sgl_size; |
| 191 | 191 | rxr->smoothed_interval = |
| 192 | 192 | ena_com_get_nonadaptive_moderation_interval_rx(ena_dev); |
| 193 | + rxr->empty_rx_queue = 0; | |
| 193 | 194 | } |
| 194 | 195 | } |
| 195 | 196 | |
| @@ -1078,6 +1079,26 @@ inline void ena_adjust_intr_moderation(struct ena_ring *rx_ring, · 882 unmodified lines | ||
| 1078 | 1079 | rx_ring->per_napi_bytes = 0; |
| 1079 | 1080 | } |
| 1080 | 1081 | |
| 1082 | +static inline void ena_unmask_interrupt(struct ena_ring *tx_ring, | |
| 1083 | + struct ena_ring *rx_ring) | |
| 1084 | +{ | |
| 1085 | + struct ena_eth_io_intr_reg intr_reg; | |
| 1086 | + | |
| 1087 | + /* Update intr register: rx intr delay, | |
| 1088 | + * tx intr delay and interrupt unmask | |
| 1089 | + */ | |
| 1090 | + ena_com_update_intr_reg(&intr_reg, | |
| 1091 | + rx_ring->smoothed_interval, | |
| 1092 | + tx_ring->smoothed_interval, | |
| 1093 | + true); | |
| 1094 | + | |
| 1095 | + /* It is a shared MSI-X. | |
| 1096 | + * Tx and Rx CQ have pointer to it. | |
| 1097 | + * So we use one of them to reach the intr reg | |
| 1098 | + */ | |
| 1099 | + ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg); | |
| 1100 | +} | |
| 1101 | + | |
| 1081 | 1102 | static inline void ena_update_ring_numa_node(struct ena_ring *tx_ring, |
| 1082 | 1103 | struct ena_ring *rx_ring) |
| 1083 | 1104 | { |
| @@ -1108,7 +1129,6 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 24 unmodified lines | ||
| 1108 | 1129 | { |
| 1109 | 1130 | struct ena_napi *ena_napi = container_of(napi, struct ena_napi, napi); |
| 1110 | 1131 | struct ena_ring *tx_ring, *rx_ring; |
| 1111 | − struct ena_eth_io_intr_reg intr_reg; | |
| 1112 | 1132 | |
| 1113 | 1133 | u32 tx_work_done; |
| 1114 | 1134 | u32 rx_work_done; |
| @@ -1149,22 +1169,9 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 34 unmodified lines | ||
| 1149 | 1169 | if (ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev)) |
| 1150 | 1170 | ena_adjust_intr_moderation(rx_ring, tx_ring); |
| 1151 | 1171 | |
| 1152 | − /* Update intr register: rx intr delay, | |
| 1153 | − * tx intr delay and interrupt unmask | |
| 1154 | − */ | |
| 1155 | − ena_com_update_intr_reg(&intr_reg, | |
| 1156 | − rx_ring->smoothed_interval, | |
| 1157 | − tx_ring->smoothed_interval, | |
| 1158 | − true); | |
| 1159 | − | |
| 1160 | − /* It is a shared MSI-X. | |
| 1161 | − * Tx and Rx CQ have pointer to it. | |
| 1162 | − * So we use one of them to reach the intr reg | |
| 1163 | − */ | |
| 1164 | − ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg); | |
| 1172 | + ena_unmask_interrupt(tx_ring, rx_ring); | |
| 1165 | 1173 | } |
| 1166 | 1174 | |
| 1167 | − | |
| 1168 | 1175 | ena_update_ring_numa_node(tx_ring, rx_ring); |
| 1169 | 1176 | |
| 1170 | 1177 | ret = rx_work_done; |
| @@ -1485,6 +1492,11 @@ static int ena_up_complete(struct ena_adapter *adapter) · 314 unmodified lines | ||
| 1485 | 1492 | |
| 1486 | 1493 | ena_napi_enable_all(adapter); |
| 1487 | 1494 | |
| 1495 | + /* Enable completion queues interrupt */ | |
| 1496 | + for (i = 0; i < adapter->num_queues; i++) | |
| 1497 | + ena_unmask_interrupt(&adapter->tx_ring[i], | |
| 1498 | + &adapter->rx_ring[i]); | |
| 1499 | + | |
| 1488 | 1500 | /* schedule napi in case we had pending packets |
| 1489 | 1501 | * from the last time we disable napi |
| 1490 | 1502 | */ |
| @@ -1532,6 +1544,7 @@ static int ena_create_io_tx_queue(struct ena_adapter *adapter, int qid) · 41 unmodified lines | ||
| 1532 | 1544 | "Failed to get TX queue handlers. TX queue num %d rc: %d\n", |
| 1533 | 1545 | qid, rc); |
| 1534 | 1546 | ena_com_destroy_io_queue(ena_dev, ena_qid); |
| 1547 | + return rc; | |
| 1535 | 1548 | } |
| 1536 | 1549 | |
| 1537 | 1550 | ena_com_update_numa_node(tx_ring->ena_com_io_cq, ctx.numa_node); |
| @@ -1596,6 +1609,7 @@ static int ena_create_io_rx_queue(struct ena_adapter *adapter, int qid) · 58 unmodified lines | ||
| 1596 | 1609 | "Failed to get RX queue handlers. RX queue num %d rc: %d\n", |
| 1597 | 1610 | qid, rc); |
| 1598 | 1611 | ena_com_destroy_io_queue(ena_dev, ena_qid); |
| 1612 | + return rc; | |
| 1599 | 1613 | } |
| 1600 | 1614 | |
| 1601 | 1615 | ena_com_update_numa_node(rx_ring->ena_com_io_cq, ctx.numa_node); |
| @@ -1981,6 +1995,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) · 379 unmodified lines | ||
| 1981 | 1995 | |
| 1982 | 1996 | tx_info->tx_descs = nb_hw_desc; |
| 1983 | 1997 | tx_info->last_jiffies = jiffies; |
| 1998 | + tx_info->print_once = 0; | |
| 1984 | 1999 | |
| 1985 | 2000 | tx_ring->next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use, |
| 1986 | 2001 | tx_ring->ring_size); |
| @@ -2550,13 +2565,44 @@ err: · 563 unmodified lines | ||
| 2550 | 2565 | "Reset attempt failed. Can not reset the device\n"); |
| 2551 | 2566 | } |
| 2552 | 2567 | |
| 2553 | −static void check_for_missing_tx_completions(struct ena_adapter *adapter) | |
| 2568 | +static int check_missing_comp_in_queue(struct ena_adapter *adapter, | |
| 2569 | + struct ena_ring *tx_ring) | |
| 2554 | 2570 | { |
| 2555 | 2571 | struct ena_tx_buffer *tx_buf; |
| 2556 | 2572 | unsigned long last_jiffies; |
| 2573 | + u32 missed_tx = 0; | |
| 2574 | + int i; | |
| 2575 | + | |
| 2576 | + for (i = 0; i < tx_ring->ring_size; i++) { | |
| 2577 | + tx_buf = &tx_ring->tx_buffer_info[i]; | |
| 2578 | + last_jiffies = tx_buf->last_jiffies; | |
| 2579 | + if (unlikely(last_jiffies && | |
| 2580 | + time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) { | |
| 2581 | + if (!tx_buf->print_once) | |
| 2582 | + netif_notice(adapter, tx_err, adapter->netdev, | |
| 2583 | + "Found a Tx that wasn't completed on time, qid %d, index %d.\n", | |
| 2584 | + tx_ring->qid, i); | |
| 2585 | + | |
| 2586 | + tx_buf->print_once = 1; | |
| 2587 | + missed_tx++; | |
| 2588 | + | |
| 2589 | + if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) { | |
| 2590 | + netif_err(adapter, tx_err, adapter->netdev, | |
| 2591 | + "The number of lost tx completions is above the threshold (%d > %d). Reset the device\n", | |
| 2592 | + missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS); | |
| 2593 | + set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags); | |
| 2594 | + return -EIO; | |
| 2595 | + } | |
| 2596 | + } | |
| 2597 | + } | |
| 2598 | + | |
| 2599 | + return 0; | |
| 2600 | +} | |
| 2601 | + | |
| 2602 | +static void check_for_missing_tx_completions(struct ena_adapter *adapter) | |
| 2603 | +{ | |
| 2557 | 2604 | struct ena_ring *tx_ring; |
| 2558 | − int i, j, budget; | |
| 2559 | − u32 missed_tx; | |
| 2605 | + int i, budget, rc; | |
| 2560 | 2606 | |
| 2561 | 2607 | /* Make sure the driver doesn't turn the device in other process */ |
| 2562 | 2608 | smp_rmb(); |
| @@ -2572,31 +2618,9 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 9 unmodified lines | ||
| 2572 | 2618 | for (i = adapter->last_monitored_tx_qid; i < adapter->num_queues; i++) { |
| 2573 | 2619 | tx_ring = &adapter->tx_ring[i]; |
| 2574 | 2620 | |
| 2575 | − for (j = 0; j < tx_ring->ring_size; j++) { | |
| 2576 | − tx_buf = &tx_ring->tx_buffer_info[j]; | |
| 2577 | − last_jiffies = tx_buf->last_jiffies; | |
| 2578 | − if (unlikely(last_jiffies && time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) { | |
| 2579 | − netif_notice(adapter, tx_err, adapter->netdev, | |
| 2580 | − "Found a Tx that wasn't completed on time, qid %d, index %d.\n", | |
| 2581 | − tx_ring->qid, j); | |
| 2582 | − | |
| 2583 | − u64_stats_update_begin(&tx_ring->syncp); | |
| 2584 | − missed_tx = tx_ring->tx_stats.missing_tx_comp++; | |
| 2585 | − u64_stats_update_end(&tx_ring->syncp); | |
| 2586 | − | |
| 2587 | − /* Clear last jiffies so the lost buffer won't | |
| 2588 | − * be counted twice. | |
| 2589 | − */ | |
| 2590 | − tx_buf->last_jiffies = 0; | |
| 2591 | − | |
| 2592 | − if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) { | |
| 2593 | − netif_err(adapter, tx_err, adapter->netdev, | |
| 2594 | − "The number of lost tx completion is above the threshold (%d > %d). Reset the device\n", | |
| 2595 | − missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS); | |
| 2596 | − set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags); | |
| 2597 | − } | |
| 2598 | − } | |
| 2599 | − } | |
| 2621 | + rc = check_missing_comp_in_queue(adapter, tx_ring); | |
| 2622 | + if (unlikely(rc)) | |
| 2623 | + return; | |
| 2600 | 2624 | |
| 2601 | 2625 | budget--; |
| 2602 | 2626 | if (!budget) |
| @@ -2606,6 +2630,58 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 3 unmodified lines | ||
| 2606 | 2630 | adapter->last_monitored_tx_qid = i % adapter->num_queues; |
| 2607 | 2631 | } |
| 2608 | 2632 | |
| 2633 | +/* trigger napi schedule after 2 consecutive detections */ | |
| 2634 | +#define EMPTY_RX_REFILL 2 | |
| 2635 | +/* For the rare case where the device runs out of Rx descriptors and the | |
| 2636 | + * napi handler failed to refill new Rx descriptors (due to a lack of memory | |
| 2637 | + * for example). | |
| 2638 | + * This case will lead to a deadlock: | |
| 2639 | + * The device won't send interrupts since all the new Rx packets will be dropped | |
| 2640 | + * The napi handler won't allocate new Rx descriptors so the device will be | |
| 2641 | + * able to send new packets. | |
| 2642 | + * | |
| 2643 | + * This scenario can happen when the kernel's vm.min_free_kbytes is too small. | |
| 2644 | + * It is recommended to have at least 512MB, with a minimum of 128MB for | |
| 2645 | + * constrained environment). | |
| 2646 | + * | |
| 2647 | + * When such a situation is detected - Reschedule napi | |
| 2648 | + */ | |
| 2649 | +static void check_for_empty_rx_ring(struct ena_adapter *adapter) | |
| 2650 | +{ | |
| 2651 | + struct ena_ring *rx_ring; | |
| 2652 | + int i, refill_required; | |
| 2653 | + | |
| 2654 | + if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags)) | |
| 2655 | + return; | |
| 2656 | + | |
| 2657 | + if (test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags)) | |
| 2658 | + return; | |
| 2659 | + | |
| 2660 | + for (i = 0; i < adapter->num_queues; i++) { | |
| 2661 | + rx_ring = &adapter->rx_ring[i]; | |
| 2662 | + | |
| 2663 | + refill_required = | |
| 2664 | + ena_com_sq_empty_space(rx_ring->ena_com_io_sq); | |
| 2665 | + if (unlikely(refill_required == (rx_ring->ring_size - 1))) { | |
| 2666 | + rx_ring->empty_rx_queue++; | |
| 2667 | + | |
| 2668 | + if (rx_ring->empty_rx_queue >= EMPTY_RX_REFILL) { | |
| 2669 | + u64_stats_update_begin(&rx_ring->syncp); | |
| 2670 | + rx_ring->rx_stats.empty_rx_ring++; | |
| 2671 | + u64_stats_update_end(&rx_ring->syncp); | |
| 2672 | + | |
| 2673 | + netif_err(adapter, drv, adapter->netdev, | |
| 2674 | + "trigger refill for ring %d\n", i); | |
| 2675 | + | |
| 2676 | + napi_schedule(rx_ring->napi); | |
| 2677 | + rx_ring->empty_rx_queue = 0; | |
| 2678 | + } | |
| 2679 | + } else { | |
| 2680 | + rx_ring->empty_rx_queue = 0; | |
| 2681 | + } | |
| 2682 | + } | |
| 2683 | +} | |
| 2684 | + | |
| 2609 | 2685 | /* Check for keep alive expiration */ |
| 2610 | 2686 | static void check_for_missing_keep_alive(struct ena_adapter *adapter) |
| 2611 | 2687 | { |
| @@ -2660,6 +2736,8 @@ static void ena_timer_service(unsigned long data) · 48 unmodified lines | ||
| 2660 | 2736 | |
| 2661 | 2737 | check_for_missing_tx_completions(adapter); |
| 2662 | 2738 | |
| 2739 | + check_for_empty_rx_ring(adapter); | |
| 2740 | + | |
| 2663 | 2741 | if (debug_area) |
| 2664 | 2742 | ena_dump_stats_to_buf(adapter, debug_area); |
| 2665 | 2743 | |
| @@ -2840,6 +2918,11 @@ static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev) · 174 unmodified lines | ||
| 2840 | 2918 | { |
| 2841 | 2919 | int release_bars; |
| 2842 | 2920 | |
| 2921 | + if (ena_dev->mem_bar) | |
| 2922 | + devm_iounmap(&pdev->dev, ena_dev->mem_bar); | |
| 2923 | + | |
| 2924 | + devm_iounmap(&pdev->dev, ena_dev->reg_bar); | |
| 2925 | + | |
| 2843 | 2926 | release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK; |
| 2844 | 2927 | pci_release_selected_regions(pdev, release_bars); |
| 2845 | 2928 | } |
| @@ -2927,8 +3010,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 81 unmodified lines | ||
| 2927 | 3010 | goto err_free_ena_dev; |
| 2928 | 3011 | } |
| 2929 | 3012 | |
| 2930 | − ena_dev->reg_bar = ioremap(pci_resource_start(pdev, ENA_REG_BAR), | |
| 2931 | − pci_resource_len(pdev, ENA_REG_BAR)); | |
| 3013 | + ena_dev->reg_bar = devm_ioremap(&pdev->dev, | |
| 3014 | + pci_resource_start(pdev, ENA_REG_BAR), | |
| 3015 | + pci_resource_len(pdev, ENA_REG_BAR)); | |
| 2932 | 3016 | if (!ena_dev->reg_bar) { |
| 2933 | 3017 | dev_err(&pdev->dev, "failed to remap regs bar\n"); |
| 2934 | 3018 | rc = -EFAULT; |
| @@ -2948,8 +3032,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 13 unmodified lines | ||
| 2948 | 3032 | ena_set_push_mode(pdev, ena_dev, &get_feat_ctx); |
| 2949 | 3033 | |
| 2950 | 3034 | if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) { |
| 2951 | − ena_dev->mem_bar = ioremap_wc(pci_resource_start(pdev, ENA_MEM_BAR), | |
| 2952 | − pci_resource_len(pdev, ENA_MEM_BAR)); | |
| 3035 | + ena_dev->mem_bar = devm_ioremap_wc(&pdev->dev, | |
| 3036 | + pci_resource_start(pdev, ENA_MEM_BAR), | |
| 3037 | + pci_resource_len(pdev, ENA_MEM_BAR)); | |
| 2953 | 3038 | if (!ena_dev->mem_bar) { |
| 2954 | 3039 | rc = -EFAULT; |
| 2955 | 3040 | goto err_device_destroy; |
| @@ -45,7 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | #define DRV_MODULE_VER_MAJOR 1 |
| 47 | 47 | #define DRV_MODULE_VER_MINOR 1 |
| 48 | −#define DRV_MODULE_VER_SUBMINOR 2 | |
| 48 | +#define DRV_MODULE_VER_SUBMINOR 7 | |
| 49 | 49 | |
| 50 | 50 | #define DRV_MODULE_NAME "ena" |
| 51 | 51 | #ifndef DRV_MODULE_VERSION |
| @@ -146,7 +146,18 @@ struct ena_tx_buffer { · 94 unmodified lines | ||
| 146 | 146 | u32 tx_descs; |
| 147 | 147 | /* num of buffers used by this skb */ |
| 148 | 148 | u32 num_of_bufs; |
| 149 | − /* Save the last jiffies to detect missing tx packets */ | |
| 149 | + | |
| 150 | + /* Used for detect missing tx packets to limit the number of prints */ | |
| 151 | + u32 print_once; | |
| 152 | + /* Save the last jiffies to detect missing tx packets | |
| 153 | + * | |
| 154 | + * sets to non zero value on ena_start_xmit and set to zero on | |
| 155 | + * napi and timer_Service_routine. | |
| 156 | + * | |
| 157 | + * while this value is not protected by lock, | |
| 158 | + * a given packet is not expected to be handled by ena_start_xmit | |
| 159 | + * and by napi/timer_service at the same time. | |
| 160 | + */ | |
| 150 | 161 | unsigned long last_jiffies; |
| 151 | 162 | struct ena_com_buf bufs[ENA_PKT_MAX_BUFS]; |
| 152 | 163 | } ____cacheline_aligned; |
| @@ -170,7 +181,6 @@ struct ena_stats_tx { · 17 unmodified lines | ||
| 170 | 181 | u64 napi_comp; |
| 171 | 182 | u64 tx_poll; |
| 172 | 183 | u64 doorbells; |
| 173 | − u64 missing_tx_comp; | |
| 174 | 184 | u64 bad_req_id; |
| 175 | 185 | }; |
| 176 | 186 | |
| @@ -184,6 +194,7 @@ struct ena_stats_rx { · 7 unmodified lines | ||
| 184 | 194 | u64 dma_mapping_err; |
| 185 | 195 | u64 bad_desc_num; |
| 186 | 196 | u64 rx_copybreak_pkt; |
| 197 | + u64 empty_rx_ring; | |
| 187 | 198 | }; |
| 188 | 199 | |
| 189 | 200 | struct ena_ring { |
| @@ -231,6 +242,7 @@ struct ena_ring { · 41 unmodified lines | ||
| 231 | 242 | struct ena_stats_tx tx_stats; |
| 232 | 243 | struct ena_stats_rx rx_stats; |
| 233 | 244 | }; |
| 245 | + int empty_rx_queue; | |
| 234 | 246 | } ____cacheline_aligned; |
| 235 | 247 | |
| 236 | 248 | struct ena_stats_dev { |
| @@ -193,9 +193,6 @@ int hw_atl_utils_hw_get_regs(struct aq_hw_s *self, · 192 unmodified lines | ||
| 193 | 193 | struct aq_hw_caps_s *aq_hw_caps, |
| 194 | 194 | u32 *regs_buff); |
| 195 | 195 | |
| 196 | −int hw_atl_utils_hw_get_settings(struct aq_hw_s *self, | |
| 197 | − struct ethtool_cmd *cmd); | |
| 198 | − | |
| 199 | 196 | int hw_atl_utils_hw_set_power(struct aq_hw_s *self, |
| 200 | 197 | unsigned int power_state); |
| 201 | 198 | |
| @@ -3883,15 +3883,26 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 3882 unmodified lines | ||
| 3883 | 3883 | /* when transmitting in a vf, start bd must hold the ethertype |
| 3884 | 3884 | * for fw to enforce it |
| 3885 | 3885 | */ |
| 3886 | + u16 vlan_tci = 0; | |
| 3886 | 3887 | #ifndef BNX2X_STOP_ON_ERROR |
| 3887 | − if (IS_VF(bp)) | |
| 3888 | + if (IS_VF(bp)) { | |
| 3888 | 3889 | #endif |
| 3889 | − tx_start_bd->vlan_or_ethertype = | |
| 3890 | − cpu_to_le16(ntohs(eth->h_proto)); | |
| 3890 | + /* Still need to consider inband vlan for enforced */ | |
| 3891 | + if (__vlan_get_tag(skb, &vlan_tci)) { | |
| 3892 | + tx_start_bd->vlan_or_ethertype = | |
| 3893 | + cpu_to_le16(ntohs(eth->h_proto)); | |
| 3894 | + } else { | |
| 3895 | + tx_start_bd->bd_flags.as_bitfield |= | |
| 3896 | + (X_ETH_INBAND_VLAN << | |
| 3897 | + ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT); | |
| 3898 | + tx_start_bd->vlan_or_ethertype = | |
| 3899 | + cpu_to_le16(vlan_tci); | |
| 3900 | + } | |
| 3891 | 3901 | #ifndef BNX2X_STOP_ON_ERROR |
| 3892 | − else | |
| 3902 | + } else { | |
| 3893 | 3903 | /* used by FW for packet accounting */ |
| 3894 | 3904 | tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod); |
| 3905 | + } | |
| 3895 | 3906 | #endif |
| 3896 | 3907 | } |
| 3897 | 3908 | |
| @@ -901,6 +901,8 @@ static void bnx2x_vf_flr(struct bnx2x *bp, struct bnx2x_virtf *vf) · 900 unmodified lines | ||
| 901 | 901 | /* release VF resources */ |
| 902 | 902 | bnx2x_vf_free_resc(bp, vf); |
| 903 | 903 | |
| 904 | + vf->malicious = false; | |
| 905 | + | |
| 904 | 906 | /* re-open the mailbox */ |
| 905 | 907 | bnx2x_vf_enable_mbx(bp, vf->abs_vfid); |
| 906 | 908 | return; |
| @@ -1822,9 +1824,11 @@ get_vf: · 915 unmodified lines | ||
| 1822 | 1824 | vf->abs_vfid, qidx); |
| 1823 | 1825 | bnx2x_vf_handle_rss_update_eqe(bp, vf); |
| 1824 | 1826 | case EVENT_RING_OPCODE_VF_FLR: |
| 1825 | − case EVENT_RING_OPCODE_MALICIOUS_VF: | |
| 1826 | 1827 | /* Do nothing for now */ |
| 1827 | 1828 | return 0; |
| 1829 | + case EVENT_RING_OPCODE_MALICIOUS_VF: | |
| 1830 | + vf->malicious = true; | |
| 1831 | + return 0; | |
| 1828 | 1832 | } |
| 1829 | 1833 | |
| 1830 | 1834 | return 0; |
| @@ -1905,6 +1909,13 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) · 74 unmodified lines | ||
| 1905 | 1909 | continue; |
| 1906 | 1910 | } |
| 1907 | 1911 | |
| 1912 | + if (vf->malicious) { | |
| 1913 | + DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS), | |
| 1914 | + "vf %d malicious so no stats for it\n", | |
| 1915 | + vf->abs_vfid); | |
| 1916 | + continue; | |
| 1917 | + } | |
| 1918 | + | |
| 1908 | 1919 | DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS), |
| 1909 | 1920 | "add addresses for vf %d\n", vf->abs_vfid); |
| 1910 | 1921 | for_each_vfq(vf, j) { |
| @@ -3042,7 +3053,7 @@ void bnx2x_vf_pci_dealloc(struct bnx2x *bp) · 1131 unmodified lines | ||
| 3042 | 3053 | { |
| 3043 | 3054 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, |
| 3044 | 3055 | sizeof(struct bnx2x_vf_mbx_msg)); |
| 3045 | − BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping, | |
| 3056 | + BNX2X_PCI_FREE(bp->pf2vf_bulletin, bp->pf2vf_bulletin_mapping, | |
| 3046 | 3057 | sizeof(union pf_vf_bulletin)); |
| 3047 | 3058 | } |
| 3048 | 3059 | |
| @@ -141,6 +141,7 @@ struct bnx2x_virtf { · 140 unmodified lines | ||
| 141 | 141 | #define VF_RESET 3 /* VF FLR'd, pending cleanup */ |
| 142 | 142 | |
| 143 | 143 | bool flr_clnup_stage; /* true during flr cleanup */ |
| 144 | + bool malicious; /* true if FW indicated so, until FLR */ | |
| 144 | 145 | |
| 145 | 146 | /* dma */ |
| 146 | 147 | dma_addr_t fw_stat_map; |
| @@ -2171,9 +2171,10 @@ static int cxgb_up(struct adapter *adap) · 2170 unmodified lines | ||
| 2171 | 2171 | { |
| 2172 | 2172 | int err; |
| 2173 | 2173 | |
| 2174 | + mutex_lock(&uld_mutex); | |
| 2174 | 2175 | err = setup_sge_queues(adap); |
| 2175 | 2176 | if (err) |
| 2176 | − goto out; | |
| 2177 | + goto rel_lock; | |
| 2177 | 2178 | err = setup_rss(adap); |
| 2178 | 2179 | if (err) |
| 2179 | 2180 | goto freeq; |
| @@ -2197,7 +2198,6 @@ static int cxgb_up(struct adapter *adap) · 17 unmodified lines | ||
| 2197 | 2198 | goto irq_err; |
| 2198 | 2199 | } |
| 2199 | 2200 | |
| 2200 | − mutex_lock(&uld_mutex); | |
| 2201 | 2201 | enable_rx(adap); |
| 2202 | 2202 | t4_sge_start(adap); |
| 2203 | 2203 | t4_intr_enable(adap); |
| @@ -2210,13 +2210,15 @@ static int cxgb_up(struct adapter *adap) · 6 unmodified lines | ||
| 2210 | 2210 | #endif |
| 2211 | 2211 | /* Initialize hash mac addr list*/ |
| 2212 | 2212 | INIT_LIST_HEAD(&adap->mac_hlist); |
| 2213 | − out: | |
| 2214 | 2213 | return err; |
| 2214 | + | |
| 2215 | 2215 | irq_err: |
| 2216 | 2216 | dev_err(adap->pdev_dev, "request_irq failed, err %d\n", err); |
| 2217 | 2217 | freeq: |
| 2218 | 2218 | t4_free_sge_resources(adap); |
| 2219 | − goto out; | |
| 2219 | + rel_lock: | |
| 2220 | + mutex_unlock(&uld_mutex); | |
| 2221 | + return err; | |
| 2220 | 2222 | } |
| 2221 | 2223 | |
| 2222 | 2224 | static void cxgb_down(struct adapter *adapter) |
| @@ -4525,7 +4527,7 @@ static void dummy_setup(struct net_device *dev) · 2302 unmodified lines | ||
| 4525 | 4527 | /* Initialize the device structure. */ |
| 4526 | 4528 | dev->netdev_ops = &cxgb4_mgmt_netdev_ops; |
| 4527 | 4529 | dev->ethtool_ops = &cxgb4_mgmt_ethtool_ops; |
| 4528 | − dev->destructor = free_netdev; | |
| 4530 | + dev->needs_free_netdev = true; | |
| 4529 | 4531 | } |
| 4530 | 4532 | |
| 4531 | 4533 | static int config_mgmt_dev(struct pci_dev *pdev) |
| @@ -2647,7 +2647,7 @@ static int dpaa_eth_probe(struct platform_device *pdev) · 2646 unmodified lines | ||
| 2647 | 2647 | priv->buf_layout[TX].priv_data_size = DPAA_TX_PRIV_DATA_SIZE; /* Tx */ |
| 2648 | 2648 | |
| 2649 | 2649 | /* device used for DMA mapping */ |
| 2650 | − arch_setup_dma_ops(dev, 0, 0, NULL, false); | |
| 2650 | + set_dma_ops(dev, get_dma_ops(&pdev->dev)); | |
| 2651 | 2651 | err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40)); |
| 2652 | 2652 | if (err) { |
| 2653 | 2653 | dev_err(dev, "dma_coerce_mask_and_coherent() failed\n"); |
| @@ -623,6 +623,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id, · 622 unmodified lines | ||
| 623 | 623 | goto no_mem; |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | + set_dma_ops(&pdev->dev, get_dma_ops(priv->dev)); | |
| 627 | + | |
| 626 | 628 | ret = platform_device_add_data(pdev, &data, sizeof(data)); |
| 627 | 629 | if (ret) |
| 628 | 630 | goto err; |
| @@ -288,9 +288,15 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en) · 287 unmodified lines | ||
| 288 | 288 | |
| 289 | 289 | /* Force 1000M Link, Default is 0x0200 */ |
| 290 | 290 | phy_write(phy_dev, 7, 0x20C); |
| 291 | − phy_write(phy_dev, HNS_PHY_PAGE_REG, 0); | |
| 292 | 291 | |
| 293 | − /* Enable PHY loop-back */ | |
| 292 | + /* Powerup Fiber */ | |
| 293 | + phy_write(phy_dev, HNS_PHY_PAGE_REG, 1); | |
| 294 | + val = phy_read(phy_dev, COPPER_CONTROL_REG); | |
| 295 | + val &= ~PHY_POWER_DOWN; | |
| 296 | + phy_write(phy_dev, COPPER_CONTROL_REG, val); | |
| 297 | + | |
| 298 | + /* Enable Phy Loopback */ | |
| 299 | + phy_write(phy_dev, HNS_PHY_PAGE_REG, 0); | |
| 294 | 300 | val = phy_read(phy_dev, COPPER_CONTROL_REG); |
| 295 | 301 | val |= PHY_LOOP_BACK; |
| 296 | 302 | val &= ~PHY_POWER_DOWN; |
| @@ -299,6 +305,12 @@ static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en) · 2 unmodified lines | ||
| 299 | 305 | phy_write(phy_dev, HNS_PHY_PAGE_REG, 0xFA); |
| 300 | 306 | phy_write(phy_dev, 1, 0x400); |
| 301 | 307 | phy_write(phy_dev, 7, 0x200); |
| 308 | + | |
| 309 | + phy_write(phy_dev, HNS_PHY_PAGE_REG, 1); | |
| 310 | + val = phy_read(phy_dev, COPPER_CONTROL_REG); | |
| 311 | + val |= PHY_POWER_DOWN; | |
| 312 | + phy_write(phy_dev, COPPER_CONTROL_REG, val); | |
| 313 | + | |
| 302 | 314 | phy_write(phy_dev, HNS_PHY_PAGE_REG, 0); |
| 303 | 315 | phy_write(phy_dev, 9, 0xF00); |
| 304 | 316 | |
| @@ -343,6 +343,7 @@ static int emac_reset(struct emac_instance *dev) · 342 unmodified lines | ||
| 343 | 343 | { |
| 344 | 344 | struct emac_regs __iomem *p = dev->emacp; |
| 345 | 345 | int n = 20; |
| 346 | + bool __maybe_unused try_internal_clock = false; | |
| 346 | 347 | |
| 347 | 348 | DBG(dev, "reset" NL); |
| 348 | 349 | |
| @@ -355,6 +356,7 @@ static int emac_reset(struct emac_instance *dev) · 6 unmodified lines | ||
| 355 | 356 | } |
| 356 | 357 | |
| 357 | 358 | #ifdef CONFIG_PPC_DCR_NATIVE |
| 359 | +do_retry: | |
| 358 | 360 | /* |
| 359 | 361 | * PPC460EX/GT Embedded Processor Advanced User's Manual |
| 360 | 362 | * section 28.10.1 Mode Register 0 (EMACx_MR0) states: |
| @@ -362,10 +364,19 @@ static int emac_reset(struct emac_instance *dev) · 1 unmodified line | ||
| 362 | 364 | * of the EMAC. If none is present, select the internal clock |
| 363 | 365 | * (SDR0_ETH_CFG[EMACx_PHY_CLK] = 1). |
| 364 | 366 | * After a soft reset, select the external clock. |
| 367 | + * | |
| 368 | + * The AR8035-A PHY Meraki MR24 does not provide a TX Clk if the | |
| 369 | + * ethernet cable is not attached. This causes the reset to timeout | |
| 370 | + * and the PHY detection code in emac_init_phy() is unable to | |
| 371 | + * communicate and detect the AR8035-A PHY. As a result, the emac | |
| 372 | + * driver bails out early and the user has no ethernet. | |
| 373 | + * In order to stay compatible with existing configurations, the | |
| 374 | + * driver will temporarily switch to the internal clock, after | |
| 375 | + * the first reset fails. | |
| 365 | 376 | */ |
| 366 | 377 | if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) { |
| 367 | − if (dev->phy_address == 0xffffffff && | |
| 368 | − dev->phy_map == 0xffffffff) { | |
| 378 | + if (try_internal_clock || (dev->phy_address == 0xffffffff && | |
| 379 | + dev->phy_map == 0xffffffff)) { | |
| 369 | 380 | /* No PHY: select internal loop clock before reset */ |
| 370 | 381 | dcri_clrset(SDR0, SDR0_ETH_CFG, |
| 371 | 382 | 0, SDR0_ETH_CFG_ECS << dev->cell_index); |
| @@ -383,8 +394,15 @@ static int emac_reset(struct emac_instance *dev) · 11 unmodified lines | ||
| 383 | 394 | |
| 384 | 395 | #ifdef CONFIG_PPC_DCR_NATIVE |
| 385 | 396 | if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) { |
| 386 | − if (dev->phy_address == 0xffffffff && | |
| 387 | − dev->phy_map == 0xffffffff) { | |
| 397 | + if (!n && !try_internal_clock) { | |
| 398 | + /* first attempt has timed out. */ | |
| 399 | + n = 20; | |
| 400 | + try_internal_clock = true; | |
| 401 | + goto do_retry; | |
| 402 | + } | |
| 403 | + | |
| 404 | + if (try_internal_clock || (dev->phy_address == 0xffffffff && | |
| 405 | + dev->phy_map == 0xffffffff)) { | |
| 388 | 406 | /* No PHY: restore external clock source after reset */ |
| 389 | 407 | dcri_clrset(SDR0, SDR0_ETH_CFG, |
| 390 | 408 | SDR0_ETH_CFG_ECS << dev->cell_index, 0); |
| @@ -2460,20 +2478,24 @@ static int emac_mii_bus_reset(struct mii_bus *bus) · 2069 unmodified lines | ||
| 2460 | 2478 | return emac_reset(dev); |
| 2461 | 2479 | } |
| 2462 | 2480 | |
| 2481 | +static int emac_mdio_phy_start_aneg(struct mii_phy *phy, | |
| 2482 | + struct phy_device *phy_dev) | |
| 2483 | +{ | |
| 2484 | + phy_dev->autoneg = phy->autoneg; | |
| 2485 | + phy_dev->speed = phy->speed; | |
| 2486 | + phy_dev->duplex = phy->duplex; | |
| 2487 | + phy_dev->advertising = phy->advertising; | |
| 2488 | + return phy_start_aneg(phy_dev); | |
| 2489 | +} | |
| 2490 | + | |
| 2463 | 2491 | static int emac_mdio_setup_aneg(struct mii_phy *phy, u32 advertise) |
| 2464 | 2492 | { |
| 2465 | 2493 | struct net_device *ndev = phy->dev; |
| 2466 | 2494 | struct emac_instance *dev = netdev_priv(ndev); |
| 2467 | 2495 | |
| 2468 | − dev->phy.autoneg = AUTONEG_ENABLE; | |
| 2469 | − dev->phy.speed = SPEED_1000; | |
| 2470 | − dev->phy.duplex = DUPLEX_FULL; | |
| 2471 | − dev->phy.advertising = advertise; | |
| 2472 | 2496 | phy->autoneg = AUTONEG_ENABLE; |
| 2473 | − phy->speed = dev->phy.speed; | |
| 2474 | − phy->duplex = dev->phy.duplex; | |
| 2475 | 2497 | phy->advertising = advertise; |
| 2476 | − return phy_start_aneg(dev->phy_dev); | |
| 2498 | + return emac_mdio_phy_start_aneg(phy, dev->phy_dev); | |
| 2477 | 2499 | } |
| 2478 | 2500 | |
| 2479 | 2501 | static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd) |
| @@ -2481,13 +2503,10 @@ static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd) · 1 unmodified line | ||
| 2481 | 2503 | struct net_device *ndev = phy->dev; |
| 2482 | 2504 | struct emac_instance *dev = netdev_priv(ndev); |
| 2483 | 2505 | |
| 2484 | − dev->phy.autoneg = AUTONEG_DISABLE; | |
| 2485 | − dev->phy.speed = speed; | |
| 2486 | − dev->phy.duplex = fd; | |
| 2487 | 2506 | phy->autoneg = AUTONEG_DISABLE; |
| 2488 | 2507 | phy->speed = speed; |
| 2489 | 2508 | phy->duplex = fd; |
| 2490 | − return phy_start_aneg(dev->phy_dev); | |
| 2509 | + return emac_mdio_phy_start_aneg(phy, dev->phy_dev); | |
| 2491 | 2510 | } |
| 2492 | 2511 | |
| 2493 | 2512 | static int emac_mdio_poll_link(struct mii_phy *phy) |
| @@ -2509,16 +2528,17 @@ static int emac_mdio_read_link(struct mii_phy *phy) · 15 unmodified lines | ||
| 2509 | 2528 | { |
| 2510 | 2529 | struct net_device *ndev = phy->dev; |
| 2511 | 2530 | struct emac_instance *dev = netdev_priv(ndev); |
| 2531 | + struct phy_device *phy_dev = dev->phy_dev; | |
| 2512 | 2532 | int res; |
| 2513 | 2533 | |
| 2514 | − res = phy_read_status(dev->phy_dev); | |
| 2534 | + res = phy_read_status(phy_dev); | |
| 2515 | 2535 | if (res) |
| 2516 | 2536 | return res; |
| 2517 | 2537 | |
| 2518 | − dev->phy.speed = phy->speed; | |
| 2519 | − dev->phy.duplex = phy->duplex; | |
| 2520 | − dev->phy.pause = phy->pause; | |
| 2521 | − dev->phy.asym_pause = phy->asym_pause; | |
| 2538 | + phy->speed = phy_dev->speed; | |
| 2539 | + phy->duplex = phy_dev->duplex; | |
| 2540 | + phy->pause = phy_dev->pause; | |
| 2541 | + phy->asym_pause = phy_dev->asym_pause; | |
| 2522 | 2542 | return 0; |
| 2523 | 2543 | } |
| 2524 | 2544 | |
| @@ -2528,13 +2548,6 @@ static int emac_mdio_init_phy(struct mii_phy *phy) · 3 unmodified lines | ||
| 2528 | 2548 | struct emac_instance *dev = netdev_priv(ndev); |
| 2529 | 2549 | |
| 2530 | 2550 | phy_start(dev->phy_dev); |
| 2531 | − dev->phy.autoneg = phy->autoneg; | |
| 2532 | − dev->phy.speed = phy->speed; | |
| 2533 | − dev->phy.duplex = phy->duplex; | |
| 2534 | − dev->phy.advertising = phy->advertising; | |
| 2535 | − dev->phy.pause = phy->pause; | |
| 2536 | − dev->phy.asym_pause = phy->asym_pause; | |
| 2537 | − | |
| 2538 | 2551 | return phy_init_hw(dev->phy_dev); |
| 2539 | 2552 | } |
| 2540 | 2553 | |
| @@ -1468,6 +1468,11 @@ static void ibmvnic_netpoll_controller(struct net_device *dev) · 1467 unmodified lines | ||
| 1468 | 1468 | } |
| 1469 | 1469 | #endif |
| 1470 | 1470 | |
| 1471 | +static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu) | |
| 1472 | +{ | |
| 1473 | + return -EOPNOTSUPP; | |
| 1474 | +} | |
| 1475 | + | |
| 1471 | 1476 | static const struct net_device_ops ibmvnic_netdev_ops = { |
| 1472 | 1477 | .ndo_open = ibmvnic_open, |
| 1473 | 1478 | .ndo_stop = ibmvnic_close, |
| @@ -1479,6 +1484,7 @@ static const struct net_device_ops ibmvnic_netdev_ops = { · 5 unmodified lines | ||
| 1479 | 1484 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 1480 | 1485 | .ndo_poll_controller = ibmvnic_netpoll_controller, |
| 1481 | 1486 | #endif |
| 1487 | + .ndo_change_mtu = ibmvnic_change_mtu, | |
| 1482 | 1488 | }; |
| 1483 | 1489 | |
| 1484 | 1490 | /* ethtool functions */ |
| @@ -399,6 +399,7 @@ struct i40e_pf { · 398 unmodified lines | ||
| 399 | 399 | #define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1) |
| 400 | 400 | #define I40E_FLAG_MSI_ENABLED BIT_ULL(2) |
| 401 | 401 | #define I40E_FLAG_MSIX_ENABLED BIT_ULL(3) |
| 402 | +#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(4) | |
| 402 | 403 | #define I40E_FLAG_RSS_ENABLED BIT_ULL(6) |
| 403 | 404 | #define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7) |
| 404 | 405 | #define I40E_FLAG_IWARP_ENABLED BIT_ULL(10) |
| @@ -224,7 +224,7 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = { · 223 unmodified lines | ||
| 224 | 224 | I40E_PRIV_FLAG("LinkPolling", I40E_FLAG_LINK_POLLING_ENABLED, 0), |
| 225 | 225 | I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENABLED, 0), |
| 226 | 226 | I40E_PRIV_FLAG("veb-stats", I40E_FLAG_VEB_STATS_ENABLED, 0), |
| 227 | − I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_CAPABLE, 0), | |
| 227 | + I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_ENABLED, 0), | |
| 228 | 228 | I40E_PRIV_FLAG("legacy-rx", I40E_FLAG_LEGACY_RX, 0), |
| 229 | 229 | }; |
| 230 | 230 | |
| @@ -4092,7 +4092,7 @@ flags_complete: · 3861 unmodified lines | ||
| 4092 | 4092 | |
| 4093 | 4093 | /* Only allow ATR evict on hardware that is capable of handling it */ |
| 4094 | 4094 | if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) |
| 4095 | − pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_CAPABLE; | |
| 4095 | + pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_ENABLED; | |
| 4096 | 4096 | |
| 4097 | 4097 | if (changed_flags & I40E_FLAG_TRUE_PROMISC_SUPPORT) { |
| 4098 | 4098 | u16 sw_flags = 0, valid_flags = 0; |
| @@ -8821,11 +8821,12 @@ static int i40e_sw_init(struct i40e_pf *pf) · 8820 unmodified lines | ||
| 8821 | 8821 | (pf->hw.aq.api_min_ver > 4))) { |
| 8822 | 8822 | /* Supported in FW API version higher than 1.4 */ |
| 8823 | 8823 | pf->flags |= I40E_FLAG_GENEVE_OFFLOAD_CAPABLE; |
| 8824 | − pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE; | |
| 8825 | − } else { | |
| 8826 | − pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE; | |
| 8827 | 8824 | } |
| 8828 | 8825 | |
| 8826 | + /* Enable HW ATR eviction if possible */ | |
| 8827 | + if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) | |
| 8828 | + pf->flags |= I40E_FLAG_HW_ATR_EVICT_ENABLED; | |
| 8829 | + | |
| 8829 | 8830 | pf->eeprom_version = 0xDEAD; |
| 8830 | 8831 | pf->lan_veb = I40E_NO_VEB; |
| 8831 | 8832 | pf->lan_vsi = I40E_NO_VSI; |
| @@ -2341,7 +2341,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 2340 unmodified lines | ||
| 2341 | 2341 | /* Due to lack of space, no more new filters can be programmed */ |
| 2342 | 2342 | if (th->syn && (pf->flags & I40E_FLAG_FD_ATR_AUTO_DISABLED)) |
| 2343 | 2343 | return; |
| 2344 | − if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) { | |
| 2344 | + if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED) { | |
| 2345 | 2345 | /* HW ATR eviction will take care of removing filters on FIN |
| 2346 | 2346 | * and RST packets. |
| 2347 | 2347 | */ |
| @@ -2403,7 +2403,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 55 unmodified lines | ||
| 2403 | 2403 | I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) & |
| 2404 | 2404 | I40E_TXD_FLTR_QW1_CNTINDEX_MASK; |
| 2405 | 2405 | |
| 2406 | − if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) | |
| 2406 | + if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED) | |
| 2407 | 2407 | dtype_cmd |= I40E_TXD_FLTR_QW1_ATR_MASK; |
| 2408 | 2408 | |
| 2409 | 2409 | fdir_desc->qindex_flex_ptype_vsi = cpu_to_le32(flex_ptype); |
| @@ -3017,10 +3017,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, · 3016 unmodified lines | ||
| 3017 | 3017 | VLAN_VID_MASK)); |
| 3018 | 3018 | } |
| 3019 | 3019 | |
| 3020 | + spin_unlock_bh(&vsi->mac_filter_hash_lock); | |
| 3020 | 3021 | if (vlan_id || qos) |
| 3021 | 3022 | ret = i40e_vsi_add_pvid(vsi, vlanprio); |
| 3022 | 3023 | else |
| 3023 | 3024 | i40e_vsi_remove_pvid(vsi); |
| 3025 | + spin_lock_bh(&vsi->mac_filter_hash_lock); | |
| 3024 | 3026 | |
| 3025 | 3027 | if (vlan_id) { |
| 3026 | 3028 | dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", |
| @@ -3719,7 +3719,7 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 3718 unmodified lines | ||
| 3719 | 3719 | dma_addr_t *dma_addr, |
| 3720 | 3720 | phys_addr_t *phys_addr) |
| 3721 | 3721 | { |
| 3722 | − int cpu = smp_processor_id(); | |
| 3722 | + int cpu = get_cpu(); | |
| 3723 | 3723 | |
| 3724 | 3724 | *dma_addr = mvpp2_percpu_read(priv, cpu, |
| 3725 | 3725 | MVPP2_BM_PHY_ALLOC_REG(bm_pool->id)); |
| @@ -3740,6 +3740,8 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 14 unmodified lines | ||
| 3740 | 3740 | if (sizeof(phys_addr_t) == 8) |
| 3741 | 3741 | *phys_addr |= (u64)phys_addr_highbits << 32; |
| 3742 | 3742 | } |
| 3743 | + | |
| 3744 | + put_cpu(); | |
| 3743 | 3745 | } |
| 3744 | 3746 | |
| 3745 | 3747 | /* Free all buffers from the pool */ |
| @@ -3920,18 +3922,12 @@ static inline u32 mvpp2_bm_cookie_pool_set(u32 cookie, int pool) · 174 unmodified lines | ||
| 3920 | 3922 | return bm; |
| 3921 | 3923 | } |
| 3922 | 3924 | |
| 3923 | −/* Get pool number from a BM cookie */ | |
| 3924 | −static inline int mvpp2_bm_cookie_pool_get(unsigned long cookie) | |
| 3925 | −{ | |
| 3926 | − return (cookie >> MVPP2_BM_COOKIE_POOL_OFFS) & 0xFF; | |
| 3927 | −} | |
| 3928 | − | |
| 3929 | 3925 | /* Release buffer to BM */ |
| 3930 | 3926 | static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool, |
| 3931 | 3927 | dma_addr_t buf_dma_addr, |
| 3932 | 3928 | phys_addr_t buf_phys_addr) |
| 3933 | 3929 | { |
| 3934 | − int cpu = smp_processor_id(); | |
| 3930 | + int cpu = get_cpu(); | |
| 3935 | 3931 | |
| 3936 | 3932 | if (port->priv->hw_version == MVPP22) { |
| 3937 | 3933 | u32 val = 0; |
| @@ -3958,15 +3954,15 @@ static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool, · 20 unmodified lines | ||
| 3958 | 3954 | MVPP2_BM_VIRT_RLS_REG, buf_phys_addr); |
| 3959 | 3955 | mvpp2_percpu_write(port->priv, cpu, |
| 3960 | 3956 | MVPP2_BM_PHY_RLS_REG(pool), buf_dma_addr); |
| 3957 | + | |
| 3958 | + put_cpu(); | |
| 3961 | 3959 | } |
| 3962 | 3960 | |
| 3963 | 3961 | /* Refill BM pool */ |
| 3964 | −static void mvpp2_pool_refill(struct mvpp2_port *port, u32 bm, | |
| 3962 | +static void mvpp2_pool_refill(struct mvpp2_port *port, int pool, | |
| 3965 | 3963 | dma_addr_t dma_addr, |
| 3966 | 3964 | phys_addr_t phys_addr) |
| 3967 | 3965 | { |
| 3968 | − int pool = mvpp2_bm_cookie_pool_get(bm); | |
| 3969 | − | |
| 3970 | 3966 | mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr); |
| 3971 | 3967 | } |
| 3972 | 3968 | |
| @@ -4186,8 +4182,6 @@ static void mvpp22_port_mii_set(struct mvpp2_port *port) · 213 unmodified lines | ||
| 4186 | 4182 | { |
| 4187 | 4183 | u32 val; |
| 4188 | 4184 | |
| 4189 | − return; | |
| 4190 | − | |
| 4191 | 4185 | /* Only GOP port 0 has an XLG MAC */ |
| 4192 | 4186 | if (port->gop_id == 0) { |
| 4193 | 4187 | val = readl(port->base + MVPP22_XLG_CTRL3_REG); |
| @@ -4515,21 +4509,6 @@ static void mvpp2_rxq_offset_set(struct mvpp2_port *port, · 321 unmodified lines | ||
| 4515 | 4509 | mvpp2_write(port->priv, MVPP2_RXQ_CONFIG_REG(prxq), val); |
| 4516 | 4510 | } |
| 4517 | 4511 | |
| 4518 | −/* Obtain BM cookie information from descriptor */ | |
| 4519 | −static u32 mvpp2_bm_cookie_build(struct mvpp2_port *port, | |
| 4520 | − struct mvpp2_rx_desc *rx_desc) | |
| 4521 | −{ | |
| 4522 | − int cpu = smp_processor_id(); | |
| 4523 | − int pool; | |
| 4524 | − | |
| 4525 | − pool = (mvpp2_rxdesc_status_get(port, rx_desc) & | |
| 4526 | − MVPP2_RXD_BM_POOL_ID_MASK) >> | |
| 4527 | − MVPP2_RXD_BM_POOL_ID_OFFS; | |
| 4528 | − | |
| 4529 | − return ((pool & 0xFF) << MVPP2_BM_COOKIE_POOL_OFFS) | | |
| 4530 | − ((cpu & 0xFF) << MVPP2_BM_COOKIE_CPU_OFFS); | |
| 4531 | −} | |
| 4532 | − | |
| 4533 | 4512 | /* Tx descriptors helper methods */ |
| 4534 | 4513 | |
| 4535 | 4514 | /* Get pointer to next Tx descriptor to be processed (send) by HW */ |
| @@ -4757,7 +4736,7 @@ static void mvpp2_txp_max_tx_size_set(struct mvpp2_port *port) · 221 unmodified lines | ||
| 4757 | 4736 | static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port, |
| 4758 | 4737 | struct mvpp2_rx_queue *rxq) |
| 4759 | 4738 | { |
| 4760 | − int cpu = smp_processor_id(); | |
| 4739 | + int cpu = get_cpu(); | |
| 4761 | 4740 | |
| 4762 | 4741 | if (rxq->pkts_coal > MVPP2_OCCUPIED_THRESH_MASK) |
| 4763 | 4742 | rxq->pkts_coal = MVPP2_OCCUPIED_THRESH_MASK; |
| @@ -4765,6 +4744,8 @@ static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port, · 1 unmodified line | ||
| 4765 | 4744 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id); |
| 4766 | 4745 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_THRESH_REG, |
| 4767 | 4746 | rxq->pkts_coal); |
| 4747 | + | |
| 4748 | + put_cpu(); | |
| 4768 | 4749 | } |
| 4769 | 4750 | |
| 4770 | 4751 | static u32 mvpp2_usec_to_cycles(u32 usec, unsigned long clk_hz) |
| @@ -4945,7 +4926,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 174 unmodified lines | ||
| 4945 | 4926 | mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0); |
| 4946 | 4927 | |
| 4947 | 4928 | /* Set Rx descriptors queue starting address - indirect access */ |
| 4948 | − cpu = smp_processor_id(); | |
| 4929 | + cpu = get_cpu(); | |
| 4949 | 4930 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id); |
| 4950 | 4931 | if (port->priv->hw_version == MVPP21) |
| 4951 | 4932 | rxq_dma = rxq->descs_dma; |
| @@ -4954,6 +4935,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 2 unmodified lines | ||
| 4954 | 4935 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, rxq_dma); |
| 4955 | 4936 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, rxq->size); |
| 4956 | 4937 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_INDEX_REG, 0); |
| 4938 | + put_cpu(); | |
| 4957 | 4939 | |
| 4958 | 4940 | /* Set Offset */ |
| 4959 | 4941 | mvpp2_rxq_offset_set(port, rxq->id, NET_SKB_PAD); |
| @@ -4980,9 +4962,13 @@ static void mvpp2_rxq_drop_pkts(struct mvpp2_port *port, · 20 unmodified lines | ||
| 4980 | 4962 | |
| 4981 | 4963 | for (i = 0; i < rx_received; i++) { |
| 4982 | 4964 | struct mvpp2_rx_desc *rx_desc = mvpp2_rxq_next_desc_get(rxq); |
| 4983 | − u32 bm = mvpp2_bm_cookie_build(port, rx_desc); | |
| 4965 | + u32 status = mvpp2_rxdesc_status_get(port, rx_desc); | |
| 4966 | + int pool; | |
| 4967 | + | |
| 4968 | + pool = (status & MVPP2_RXD_BM_POOL_ID_MASK) >> | |
| 4969 | + MVPP2_RXD_BM_POOL_ID_OFFS; | |
| 4984 | 4970 | |
| 4985 | − mvpp2_pool_refill(port, bm, | |
| 4971 | + mvpp2_pool_refill(port, pool, | |
| 4986 | 4972 | mvpp2_rxdesc_dma_addr_get(port, rx_desc), |
| 4987 | 4973 | mvpp2_rxdesc_cookie_get(port, rx_desc)); |
| 4988 | 4974 | } |
| @@ -5012,10 +4998,11 @@ static void mvpp2_rxq_deinit(struct mvpp2_port *port, · 23 unmodified lines | ||
| 5012 | 4998 | * free descriptor number |
| 5013 | 4999 | */ |
| 5014 | 5000 | mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0); |
| 5015 | − cpu = smp_processor_id(); | |
| 5001 | + cpu = get_cpu(); | |
| 5016 | 5002 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id); |
| 5017 | 5003 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, 0); |
| 5018 | 5004 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, 0); |
| 5005 | + put_cpu(); | |
| 5019 | 5006 | } |
| 5020 | 5007 | |
| 5021 | 5008 | /* Create and initialize a Tx queue */ |
| @@ -5038,7 +5025,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 16 unmodified lines | ||
| 5038 | 5025 | txq->last_desc = txq->size - 1; |
| 5039 | 5026 | |
| 5040 | 5027 | /* Set Tx descriptors queue starting address - indirect access */ |
| 5041 | − cpu = smp_processor_id(); | |
| 5028 | + cpu = get_cpu(); | |
| 5042 | 5029 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id); |
| 5043 | 5030 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG, |
| 5044 | 5031 | txq->descs_dma); |
| @@ -5063,6 +5050,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 18 unmodified lines | ||
| 5063 | 5050 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG, |
| 5064 | 5051 | MVPP2_PREF_BUF_PTR(desc) | MVPP2_PREF_BUF_SIZE_16 | |
| 5065 | 5052 | MVPP2_PREF_BUF_THRESH(desc_per_txq / 2)); |
| 5053 | + put_cpu(); | |
| 5066 | 5054 | |
| 5067 | 5055 | /* WRR / EJP configuration - indirect access */ |
| 5068 | 5056 | tx_port_num = mvpp2_egress_port(port); |
| @@ -5133,10 +5121,11 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, · 64 unmodified lines | ||
| 5133 | 5121 | mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0); |
| 5134 | 5122 | |
| 5135 | 5123 | /* Set Tx descriptors queue starting address and size */ |
| 5136 | − cpu = smp_processor_id(); | |
| 5124 | + cpu = get_cpu(); | |
| 5137 | 5125 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id); |
| 5138 | 5126 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG, 0); |
| 5139 | 5127 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_SIZE_REG, 0); |
| 5128 | + put_cpu(); | |
| 5140 | 5129 | } |
| 5141 | 5130 | |
| 5142 | 5131 | /* Cleanup Tx ports */ |
| @@ -5146,7 +5135,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 3 unmodified lines | ||
| 5146 | 5135 | int delay, pending, cpu; |
| 5147 | 5136 | u32 val; |
| 5148 | 5137 | |
| 5149 | − cpu = smp_processor_id(); | |
| 5138 | + cpu = get_cpu(); | |
| 5150 | 5139 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id); |
| 5151 | 5140 | val = mvpp2_percpu_read(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG); |
| 5152 | 5141 | val |= MVPP2_TXQ_DRAIN_EN_MASK; |
| @@ -5173,6 +5162,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 20 unmodified lines | ||
| 5173 | 5162 | |
| 5174 | 5163 | val &= ~MVPP2_TXQ_DRAIN_EN_MASK; |
| 5175 | 5164 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG, val); |
| 5165 | + put_cpu(); | |
| 5176 | 5166 | |
| 5177 | 5167 | for_each_present_cpu(cpu) { |
| 5178 | 5168 | txq_pcpu = per_cpu_ptr(txq->pcpu, cpu); |
| @@ -5420,7 +5410,7 @@ static void mvpp2_rx_csum(struct mvpp2_port *port, u32 status, · 241 unmodified lines | ||
| 5420 | 5410 | |
| 5421 | 5411 | /* Reuse skb if possible, or allocate a new skb and add it to BM pool */ |
| 5422 | 5412 | static int mvpp2_rx_refill(struct mvpp2_port *port, |
| 5423 | − struct mvpp2_bm_pool *bm_pool, u32 bm) | |
| 5413 | + struct mvpp2_bm_pool *bm_pool, int pool) | |
| 5424 | 5414 | { |
| 5425 | 5415 | dma_addr_t dma_addr; |
| 5426 | 5416 | phys_addr_t phys_addr; |
| @@ -5432,7 +5422,7 @@ static int mvpp2_rx_refill(struct mvpp2_port *port, · 5 unmodified lines | ||
| 5432 | 5422 | if (!buf) |
| 5433 | 5423 | return -ENOMEM; |
| 5434 | 5424 | |
| 5435 | − mvpp2_pool_refill(port, bm, dma_addr, phys_addr); | |
| 5425 | + mvpp2_pool_refill(port, pool, dma_addr, phys_addr); | |
| 5436 | 5426 | |
| 5437 | 5427 | return 0; |
| 5438 | 5428 | } |
| @@ -5490,7 +5480,7 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 51 unmodified lines | ||
| 5490 | 5480 | unsigned int frag_size; |
| 5491 | 5481 | dma_addr_t dma_addr; |
| 5492 | 5482 | phys_addr_t phys_addr; |
| 5493 | − u32 bm, rx_status; | |
| 5483 | + u32 rx_status; | |
| 5494 | 5484 | int pool, rx_bytes, err; |
| 5495 | 5485 | void *data; |
| 5496 | 5486 | |
| @@ -5502,8 +5492,8 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 5 unmodified lines | ||
| 5502 | 5492 | phys_addr = mvpp2_rxdesc_cookie_get(port, rx_desc); |
| 5503 | 5493 | data = (void *)phys_to_virt(phys_addr); |
| 5504 | 5494 | |
| 5505 | − bm = mvpp2_bm_cookie_build(port, rx_desc); | |
| 5506 | − pool = mvpp2_bm_cookie_pool_get(bm); | |
| 5495 | + pool = (rx_status & MVPP2_RXD_BM_POOL_ID_MASK) >> | |
| 5496 | + MVPP2_RXD_BM_POOL_ID_OFFS; | |
| 5507 | 5497 | bm_pool = &port->priv->bm_pools[pool]; |
| 5508 | 5498 | |
| 5509 | 5499 | /* In case of an error, release the requested buffer pointer |
| @@ -5516,7 +5506,7 @@ err_drop_frame: · 6 unmodified lines | ||
| 5516 | 5506 | dev->stats.rx_errors++; |
| 5517 | 5507 | mvpp2_rx_error(port, rx_desc); |
| 5518 | 5508 | /* Return the buffer to the pool */ |
| 5519 | − mvpp2_pool_refill(port, bm, dma_addr, phys_addr); | |
| 5509 | + mvpp2_pool_refill(port, pool, dma_addr, phys_addr); | |
| 5520 | 5510 | continue; |
| 5521 | 5511 | } |
| 5522 | 5512 | |
| @@ -5531,7 +5521,7 @@ err_drop_frame: · 8 unmodified lines | ||
| 5531 | 5521 | goto err_drop_frame; |
| 5532 | 5522 | } |
| 5533 | 5523 | |
| 5534 | − err = mvpp2_rx_refill(port, bm_pool, bm); | |
| 5524 | + err = mvpp2_rx_refill(port, bm_pool, pool); | |
| 5535 | 5525 | if (err) { |
| 5536 | 5526 | netdev_err(port->dev, "failed to refill BM pools\n"); |
| 5537 | 5527 | goto err_drop_frame; |
| @@ -458,13 +458,15 @@ struct mlx5e_mpw_info { · 457 unmodified lines | ||
| 458 | 458 | |
| 459 | 459 | struct mlx5e_rx_am_stats { |
| 460 | 460 | int ppms; /* packets per msec */ |
| 461 | + int bpms; /* bytes per msec */ | |
| 461 | 462 | int epms; /* events per msec */ |
| 462 | 463 | }; |
| 463 | 464 | |
| 464 | 465 | struct mlx5e_rx_am_sample { |
| 465 | − ktime_t time; | |
| 466 | − unsigned int pkt_ctr; | |
| 467 | − u16 event_ctr; | |
| 466 | + ktime_t time; | |
| 467 | + u32 pkt_ctr; | |
| 468 | + u32 byte_ctr; | |
| 469 | + u16 event_ctr; | |
| 468 | 470 | }; |
| 469 | 471 | |
| 470 | 472 | struct mlx5e_rx_am { /* Adaptive Moderation */ |
| @@ -1242,11 +1242,11 @@ static int mlx5e_get_ts_info(struct net_device *dev, · 1241 unmodified lines | ||
| 1242 | 1242 | SOF_TIMESTAMPING_RX_HARDWARE | |
| 1243 | 1243 | SOF_TIMESTAMPING_RAW_HARDWARE; |
| 1244 | 1244 | |
| 1245 | − info->tx_types = (BIT(1) << HWTSTAMP_TX_OFF) | | |
| 1246 | − (BIT(1) << HWTSTAMP_TX_ON); | |
| 1245 | + info->tx_types = BIT(HWTSTAMP_TX_OFF) | | |
| 1246 | + BIT(HWTSTAMP_TX_ON); | |
| 1247 | 1247 | |
| 1248 | − info->rx_filters = (BIT(1) << HWTSTAMP_FILTER_NONE) | | |
| 1249 | − (BIT(1) << HWTSTAMP_FILTER_ALL); | |
| 1248 | + info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) | | |
| 1249 | + BIT(HWTSTAMP_FILTER_ALL); | |
| 1250 | 1250 | |
| 1251 | 1251 | return 0; |
| 1252 | 1252 | } |
| @@ -4241,7 +4241,8 @@ struct net_device *mlx5e_create_netdev(struct mlx5_core_dev *mdev, · 4240 unmodified lines | ||
| 4241 | 4241 | return netdev; |
| 4242 | 4242 | |
| 4243 | 4243 | err_cleanup_nic: |
| 4244 | − profile->cleanup(priv); | |
| 4244 | + if (profile->cleanup) | |
| 4245 | + profile->cleanup(priv); | |
| 4245 | 4246 | free_netdev(netdev); |
| 4246 | 4247 | |
| 4247 | 4248 | return NULL; |
| @@ -791,6 +791,8 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev, · 790 unmodified lines | ||
| 791 | 791 | params->tx_max_inline = mlx5e_get_max_inline_cap(mdev); |
| 792 | 792 | params->num_tc = 1; |
| 793 | 793 | params->lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ; |
| 794 | + | |
| 795 | + mlx5_query_min_inline(mdev, ¶ms->tx_min_inline_mode); | |
| 794 | 796 | } |
| 795 | 797 | |
| 796 | 798 | static void mlx5e_build_rep_netdev(struct net_device *netdev) |
| @@ -183,28 +183,27 @@ static void mlx5e_am_exit_parking(struct mlx5e_rx_am *am) · 182 unmodified lines | ||
| 183 | 183 | mlx5e_am_step(am); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | +#define IS_SIGNIFICANT_DIFF(val, ref) \ | |
| 187 | + (((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */ | |
| 188 | + | |
| 186 | 189 | static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr, |
| 187 | 190 | struct mlx5e_rx_am_stats *prev) |
| 188 | 191 | { |
| 189 | − int diff; | |
| 190 | − | |
| 191 | − if (!prev->ppms) | |
| 192 | − return curr->ppms ? MLX5E_AM_STATS_BETTER : | |
| 192 | + if (!prev->bpms) | |
| 193 | + return curr->bpms ? MLX5E_AM_STATS_BETTER : | |
| 193 | 194 | MLX5E_AM_STATS_SAME; |
| 194 | 195 | |
| 195 | − diff = curr->ppms - prev->ppms; | |
| 196 | − if (((100 * abs(diff)) / prev->ppms) > 10) /* more than 10% diff */ | |
| 197 | − return (diff > 0) ? MLX5E_AM_STATS_BETTER : | |
| 198 | − MLX5E_AM_STATS_WORSE; | |
| 196 | + if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms)) | |
| 197 | + return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER : | |
| 198 | + MLX5E_AM_STATS_WORSE; | |
| 199 | 199 | |
| 200 | − if (!prev->epms) | |
| 201 | − return curr->epms ? MLX5E_AM_STATS_WORSE : | |
| 202 | − MLX5E_AM_STATS_SAME; | |
| 200 | + if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms)) | |
| 201 | + return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER : | |
| 202 | + MLX5E_AM_STATS_WORSE; | |
| 203 | 203 | |
| 204 | − diff = curr->epms - prev->epms; | |
| 205 | − if (((100 * abs(diff)) / prev->epms) > 10) /* more than 10% diff */ | |
| 206 | − return (diff < 0) ? MLX5E_AM_STATS_BETTER : | |
| 207 | − MLX5E_AM_STATS_WORSE; | |
| 204 | + if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms)) | |
| 205 | + return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER : | |
| 206 | + MLX5E_AM_STATS_WORSE; | |
| 208 | 207 | |
| 209 | 208 | return MLX5E_AM_STATS_SAME; |
| 210 | 209 | } |
| @@ -266,10 +265,13 @@ static void mlx5e_am_sample(struct mlx5e_rq *rq, · 55 unmodified lines | ||
| 266 | 265 | { |
| 267 | 266 | s->time = ktime_get(); |
| 268 | 267 | s->pkt_ctr = rq->stats.packets; |
| 268 | + s->byte_ctr = rq->stats.bytes; | |
| 269 | 269 | s->event_ctr = rq->cq.event_ctr; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | #define MLX5E_AM_NEVENTS 64 |
| 273 | +#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) | |
| 274 | +#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1)) | |
| 273 | 275 | |
| 274 | 276 | static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, |
| 275 | 277 | struct mlx5e_rx_am_sample *end, |
| @@ -277,13 +279,17 @@ static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, · 1 unmodified line | ||
| 277 | 279 | { |
| 278 | 280 | /* u32 holds up to 71 minutes, should be enough */ |
| 279 | 281 | u32 delta_us = ktime_us_delta(end->time, start->time); |
| 280 | − unsigned int npkts = end->pkt_ctr - start->pkt_ctr; | |
| 282 | + u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr); | |
| 283 | + u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr, | |
| 284 | + start->byte_ctr); | |
| 281 | 285 | |
| 282 | 286 | if (!delta_us) |
| 283 | 287 | return; |
| 284 | 288 | |
| 285 | − curr_stats->ppms = (npkts * USEC_PER_MSEC) / delta_us; | |
| 286 | − curr_stats->epms = (MLX5E_AM_NEVENTS * USEC_PER_MSEC) / delta_us; | |
| 289 | + curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us); | |
| 290 | + curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us); | |
| 291 | + curr_stats->epms = DIV_ROUND_UP(MLX5E_AM_NEVENTS * USEC_PER_MSEC, | |
| 292 | + delta_us); | |
| 287 | 293 | } |
| 288 | 294 | |
| 289 | 295 | void mlx5e_rx_am_work(struct work_struct *work) |
| @@ -308,7 +314,8 @@ void mlx5e_rx_am(struct mlx5e_rq *rq) · 18 unmodified lines | ||
| 308 | 314 | |
| 309 | 315 | switch (am->state) { |
| 310 | 316 | case MLX5E_AM_MEASURE_IN_PROGRESS: |
| 311 | − nevents = rq->cq.event_ctr - am->start_sample.event_ctr; | |
| 317 | + nevents = BIT_GAP(BITS_PER_TYPE(u16), rq->cq.event_ctr, | |
| 318 | + am->start_sample.event_ctr); | |
| 312 | 319 | if (nevents < MLX5E_AM_NEVENTS) |
| 313 | 320 | break; |
| 314 | 321 | mlx5e_am_sample(rq, &end_sample); |
| @@ -417,20 +417,13 @@ struct mlx5e_stats { · 416 unmodified lines | ||
| 417 | 417 | }; |
| 418 | 418 | |
| 419 | 419 | static const struct counter_desc mlx5e_pme_status_desc[] = { |
| 420 | − { "module_plug", 0 }, | |
| 421 | 420 | { "module_unplug", 8 }, |
| 422 | 421 | }; |
| 423 | 422 | |
| 424 | 423 | static const struct counter_desc mlx5e_pme_error_desc[] = { |
| 425 | − { "module_pwr_budget_exd", 0 }, /* power budget exceed */ | |
| 426 | − { "module_long_range", 8 }, /* long range for non MLNX cable */ | |
| 427 | − { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */ | |
| 428 | − { "module_no_eeprom", 24 }, /* no eeprom/retry time out */ | |
| 429 | − { "module_enforce_part", 32 }, /* enforce part number list */ | |
| 430 | − { "module_unknown_id", 40 }, /* unknown identifier */ | |
| 431 | − { "module_high_temp", 48 }, /* high temperature */ | |
| 424 | + { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */ | |
| 425 | + { "module_high_temp", 48 }, /* high temperature */ | |
| 432 | 426 | { "module_bad_shorted", 56 }, /* bad or shorted cable/module */ |
| 433 | − { "module_unknown_status", 64 }, | |
| 434 | 427 | }; |
| 435 | 428 | |
| 436 | 429 | #endif /* __MLX5_EN_STATS_H__ */ |
| @@ -895,7 +895,6 @@ static struct mlx5_fields fields[] = { · 894 unmodified lines | ||
| 895 | 895 | {MLX5_ACTION_IN_FIELD_OUT_SMAC_15_0, 2, offsetof(struct pedit_headers, eth.h_source[4])}, |
| 896 | 896 | {MLX5_ACTION_IN_FIELD_OUT_ETHERTYPE, 2, offsetof(struct pedit_headers, eth.h_proto)}, |
| 897 | 897 | |
| 898 | − {MLX5_ACTION_IN_FIELD_OUT_IP_DSCP, 1, offsetof(struct pedit_headers, ip4.tos)}, | |
| 899 | 898 | {MLX5_ACTION_IN_FIELD_OUT_IP_TTL, 1, offsetof(struct pedit_headers, ip4.ttl)}, |
| 900 | 899 | {MLX5_ACTION_IN_FIELD_OUT_SIPV4, 4, offsetof(struct pedit_headers, ip4.saddr)}, |
| 901 | 900 | {MLX5_ACTION_IN_FIELD_OUT_DIPV4, 4, offsetof(struct pedit_headers, ip4.daddr)}, |
| @@ -906,21 +906,34 @@ static int esw_inline_mode_to_devlink(u8 mlx5_mode, u8 *mode) · 905 unmodified lines | ||
| 906 | 906 | return 0; |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | −int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode) | |
| 909 | +static int mlx5_devlink_eswitch_check(struct devlink *devlink) | |
| 910 | 910 | { |
| 911 | − struct mlx5_core_dev *dev; | |
| 912 | − u16 cur_mlx5_mode, mlx5_mode = 0; | |
| 911 | + struct mlx5_core_dev *dev = devlink_priv(devlink); | |
| 913 | 912 | |
| 914 | − dev = devlink_priv(devlink); | |
| 913 | + if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH) | |
| 914 | + return -EOPNOTSUPP; | |
| 915 | 915 | |
| 916 | 916 | if (!MLX5_CAP_GEN(dev, vport_group_manager)) |
| 917 | 917 | return -EOPNOTSUPP; |
| 918 | 918 | |
| 919 | − cur_mlx5_mode = dev->priv.eswitch->mode; | |
| 920 | − | |
| 921 | − if (cur_mlx5_mode == SRIOV_NONE) | |
| 919 | + if (dev->priv.eswitch->mode == SRIOV_NONE) | |
| 922 | 920 | return -EOPNOTSUPP; |
| 923 | 921 | |
| 922 | + return 0; | |
| 923 | +} | |
| 924 | + | |
| 925 | +int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode) | |
| 926 | +{ | |
| 927 | + struct mlx5_core_dev *dev = devlink_priv(devlink); | |
| 928 | + u16 cur_mlx5_mode, mlx5_mode = 0; | |
| 929 | + int err; | |
| 930 | + | |
| 931 | + err = mlx5_devlink_eswitch_check(devlink); | |
| 932 | + if (err) | |
| 933 | + return err; | |
| 934 | + | |
| 935 | + cur_mlx5_mode = dev->priv.eswitch->mode; | |
| 936 | + | |
| 924 | 937 | if (esw_mode_from_devlink(mode, &mlx5_mode)) |
| 925 | 938 | return -EINVAL; |
| 926 | 939 | |
| @@ -937,15 +950,12 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode) · 10 unmodified lines | ||
| 937 | 950 | |
| 938 | 951 | int mlx5_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode) |
| 939 | 952 | { |
| 940 | − struct mlx5_core_dev *dev; | |
| 941 | − | |
| 942 | − dev = devlink_priv(devlink); | |
| 943 | − | |
| 944 | − if (!MLX5_CAP_GEN(dev, vport_group_manager)) | |
| 945 | − return -EOPNOTSUPP; | |
| 953 | + struct mlx5_core_dev *dev = devlink_priv(devlink); | |
| 954 | + int err; | |
| 946 | 955 | |
| 947 | − if (dev->priv.eswitch->mode == SRIOV_NONE) | |
| 948 | − return -EOPNOTSUPP; | |
| 956 | + err = mlx5_devlink_eswitch_check(devlink); | |
| 957 | + if (err) | |
| 958 | + return err; | |
| 949 | 959 | |
| 950 | 960 | return esw_mode_to_devlink(dev->priv.eswitch->mode, mode); |
| 951 | 961 | } |
| @@ -954,15 +964,12 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode) · 2 unmodified lines | ||
| 954 | 964 | { |
| 955 | 965 | struct mlx5_core_dev *dev = devlink_priv(devlink); |
| 956 | 966 | struct mlx5_eswitch *esw = dev->priv.eswitch; |
| 957 | − int num_vports = esw->enabled_vports; | |
| 958 | 967 | int err, vport; |
| 959 | 968 | u8 mlx5_mode; |
| 960 | 969 | |
| 961 | − if (!MLX5_CAP_GEN(dev, vport_group_manager)) | |
| 962 | − return -EOPNOTSUPP; | |
| 963 | − | |
| 964 | − if (esw->mode == SRIOV_NONE) | |
| 965 | − return -EOPNOTSUPP; | |
| 970 | + err = mlx5_devlink_eswitch_check(devlink); | |
| 971 | + if (err) | |
| 972 | + return err; | |
| 966 | 973 | |
| 967 | 974 | switch (MLX5_CAP_ETH(dev, wqe_inline_mode)) { |
| 968 | 975 | case MLX5_CAP_INLINE_MODE_NOT_REQUIRED: |
| @@ -985,7 +992,7 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode) · 16 unmodified lines | ||
| 985 | 992 | if (err) |
| 986 | 993 | goto out; |
| 987 | 994 | |
| 988 | − for (vport = 1; vport < num_vports; vport++) { | |
| 995 | + for (vport = 1; vport < esw->enabled_vports; vport++) { | |
| 989 | 996 | err = mlx5_modify_nic_vport_min_inline(dev, vport, mlx5_mode); |
| 990 | 997 | if (err) { |
| 991 | 998 | esw_warn(dev, "Failed to set min inline on vport %d\n", |
| @@ -1010,12 +1017,11 @@ int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode) · 18 unmodified lines | ||
| 1010 | 1017 | { |
| 1011 | 1018 | struct mlx5_core_dev *dev = devlink_priv(devlink); |
| 1012 | 1019 | struct mlx5_eswitch *esw = dev->priv.eswitch; |
| 1020 | + int err; | |
| 1013 | 1021 | |
| 1014 | − if (!MLX5_CAP_GEN(dev, vport_group_manager)) | |
| 1015 | − return -EOPNOTSUPP; | |
| 1016 | − | |
| 1017 | − if (esw->mode == SRIOV_NONE) | |
| 1018 | − return -EOPNOTSUPP; | |
| 1022 | + err = mlx5_devlink_eswitch_check(devlink); | |
| 1023 | + if (err) | |
| 1024 | + return err; | |
| 1019 | 1025 | |
| 1020 | 1026 | return esw_inline_mode_to_devlink(esw->offloads.inline_mode, mode); |
| 1021 | 1027 | } |
| @@ -1062,11 +1068,9 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink, u8 encap) · 40 unmodified lines | ||
| 1062 | 1068 | struct mlx5_eswitch *esw = dev->priv.eswitch; |
| 1063 | 1069 | int err; |
| 1064 | 1070 | |
| 1065 | − if (!MLX5_CAP_GEN(dev, vport_group_manager)) | |
| 1066 | − return -EOPNOTSUPP; | |
| 1067 | − | |
| 1068 | − if (esw->mode == SRIOV_NONE) | |
| 1069 | − return -EOPNOTSUPP; | |
| 1071 | + err = mlx5_devlink_eswitch_check(devlink); | |
| 1072 | + if (err) | |
| 1073 | + return err; | |
| 1070 | 1074 | |
| 1071 | 1075 | if (encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE && |
| 1072 | 1076 | (!MLX5_CAP_ESW_FLOWTABLE_FDB(dev, encap) || |
| @@ -1105,12 +1109,11 @@ int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink, u8 *encap) · 32 unmodified lines | ||
| 1105 | 1109 | { |
| 1106 | 1110 | struct mlx5_core_dev *dev = devlink_priv(devlink); |
| 1107 | 1111 | struct mlx5_eswitch *esw = dev->priv.eswitch; |
| 1112 | + int err; | |
| 1108 | 1113 | |
| 1109 | − if (!MLX5_CAP_GEN(dev, vport_group_manager)) | |
| 1110 | − return -EOPNOTSUPP; | |
| 1111 | − | |
| 1112 | − if (esw->mode == SRIOV_NONE) | |
| 1113 | − return -EOPNOTSUPP; | |
| 1114 | + err = mlx5_devlink_eswitch_check(devlink); | |
| 1115 | + if (err) | |
| 1116 | + return err; | |
| 1114 | 1117 | |
| 1115 | 1118 | *encap = esw->offloads.encap; |
| 1116 | 1119 | return 0; |
| @@ -862,7 +862,7 @@ struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace · 861 unmodified lines | ||
| 862 | 862 | ft_attr.level = level; |
| 863 | 863 | ft_attr.prio = prio; |
| 864 | 864 | |
| 865 | − return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, 0); | |
| 865 | + return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, vport); | |
| 866 | 866 | } |
| 867 | 867 | |
| 868 | 868 | struct mlx5_flow_table* |
| @@ -275,10 +275,8 @@ static void poll_health(unsigned long data) · 274 unmodified lines | ||
| 275 | 275 | struct mlx5_core_health *health = &dev->priv.health; |
| 276 | 276 | u32 count; |
| 277 | 277 | |
| 278 | − if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { | |
| 279 | − mod_timer(&health->timer, get_next_poll_jiffies()); | |
| 280 | − return; | |
| 281 | − } | |
| 278 | + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) | |
| 279 | + goto out; | |
| 282 | 280 | |
| 283 | 281 | count = ioread32be(health->health_counter); |
| 284 | 282 | if (count == health->prev) |
| @@ -290,8 +288,6 @@ static void poll_health(unsigned long data) · 5 unmodified lines | ||
| 290 | 288 | if (health->miss_counter == MAX_MISSES) { |
| 291 | 289 | dev_err(&dev->pdev->dev, "device's health compromised - reached miss count\n"); |
| 292 | 290 | print_health_info(dev); |
| 293 | − } else { | |
| 294 | − mod_timer(&health->timer, get_next_poll_jiffies()); | |
| 295 | 291 | } |
| 296 | 292 | |
| 297 | 293 | if (in_fatal(dev) && !health->sick) { |
| @@ -305,6 +301,9 @@ static void poll_health(unsigned long data) · 7 unmodified lines | ||
| 305 | 301 | "new health works are not permitted at this stage\n"); |
| 306 | 302 | spin_unlock(&health->wq_lock); |
| 307 | 303 | } |
| 304 | + | |
| 305 | +out: | |
| 306 | + mod_timer(&health->timer, get_next_poll_jiffies()); | |
| 308 | 307 | } |
| 309 | 308 | |
| 310 | 309 | void mlx5_start_health_poll(struct mlx5_core_dev *dev) |
| @@ -175,8 +175,9 @@ static struct mlx5_profile profile[] = { · 174 unmodified lines | ||
| 175 | 175 | }, |
| 176 | 176 | }; |
| 177 | 177 | |
| 178 | −#define FW_INIT_TIMEOUT_MILI 2000 | |
| 179 | −#define FW_INIT_WAIT_MS 2 | |
| 178 | +#define FW_INIT_TIMEOUT_MILI 2000 | |
| 179 | +#define FW_INIT_WAIT_MS 2 | |
| 180 | +#define FW_PRE_INIT_TIMEOUT_MILI 10000 | |
| 180 | 181 | |
| 181 | 182 | static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili) |
| 182 | 183 | { |
| @@ -537,8 +538,10 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) · 354 unmodified lines | ||
| 537 | 538 | /* disable cmdif checksum */ |
| 538 | 539 | MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0); |
| 539 | 540 | |
| 540 | − /* If the HCA supports 4K UARs use it */ | |
| 541 | − if (MLX5_CAP_GEN_MAX(dev, uar_4k)) | |
| 541 | + /* Enable 4K UAR only when HCA supports it and page size is bigger | |
| 542 | + * than 4K. | |
| 543 | + */ | |
| 544 | + if (MLX5_CAP_GEN_MAX(dev, uar_4k) && PAGE_SIZE > 4096) | |
| 542 | 545 | MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1); |
| 543 | 546 | |
| 544 | 547 | MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12); |
| @@ -1011,6 +1014,15 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, · 466 unmodified lines | ||
| 1011 | 1014 | */ |
| 1012 | 1015 | dev->state = MLX5_DEVICE_STATE_UP; |
| 1013 | 1016 | |
| 1017 | + /* wait for firmware to accept initialization segments configurations | |
| 1018 | + */ | |
| 1019 | + err = wait_fw_init(dev, FW_PRE_INIT_TIMEOUT_MILI); | |
| 1020 | + if (err) { | |
| 1021 | + dev_err(&dev->pdev->dev, "Firmware over %d MS in pre-initializing state, aborting\n", | |
| 1022 | + FW_PRE_INIT_TIMEOUT_MILI); | |
| 1023 | + goto out; | |
| 1024 | + } | |
| 1025 | + | |
| 1014 | 1026 | err = mlx5_cmd_init(dev); |
| 1015 | 1027 | if (err) { |
| 1016 | 1028 | dev_err(&pdev->dev, "Failed initializing command interface, aborting\n"); |
| @@ -2956,7 +2956,7 @@ static u32 qed_grc_dump_ctx_data(struct qed_hwfn *p_hwfn, · 2955 unmodified lines | ||
| 2956 | 2956 | qed_wr(p_hwfn, |
| 2957 | 2957 | p_ptt, |
| 2958 | 2958 | s_storm_defs[storm_id].cm_ctx_wr_addr, |
| 2959 | − BIT(9) | lid); | |
| 2959 | + (i << 9) | lid); | |
| 2960 | 2960 | *(dump_buf + offset) = qed_rd(p_hwfn, |
| 2961 | 2961 | p_ptt, |
| 2962 | 2962 | rd_reg_addr); |
| @@ -661,8 +661,6 @@ restore_filters: · 660 unmodified lines | ||
| 661 | 661 | up_write(&vf->efx->filter_sem); |
| 662 | 662 | mutex_unlock(&vf->efx->mac_lock); |
| 663 | 663 | |
| 664 | − up_write(&vf->efx->filter_sem); | |
| 665 | − | |
| 666 | 664 | rc2 = efx_net_open(vf->efx->net_dev); |
| 667 | 665 | if (rc2) |
| 668 | 666 | goto reset_nic; |
| @@ -214,13 +214,13 @@ static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p) · 213 unmodified lines | ||
| 214 | 214 | { |
| 215 | 215 | /* Context type from W/B descriptor must be zero */ |
| 216 | 216 | if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE) |
| 217 | − return -EINVAL; | |
| 217 | + return 0; | |
| 218 | 218 | |
| 219 | 219 | /* Tx Timestamp Status is 1 so des0 and des1'll have valid values */ |
| 220 | 220 | if (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS) |
| 221 | − return 0; | |
| 221 | + return 1; | |
| 222 | 222 | |
| 223 | − return 1; | |
| 223 | + return 0; | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | static inline u64 dwmac4_get_timestamp(void *desc, u32 ats) |
| @@ -282,7 +282,10 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) · 55 unmodified lines | ||
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | exit: |
| 285 | − return ret; | |
| 285 | + if (likely(ret == 0)) | |
| 286 | + return 1; | |
| 287 | + | |
| 288 | + return 0; | |
| 286 | 289 | } |
| 287 | 290 | |
| 288 | 291 | static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, |
| @@ -434,14 +434,14 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, · 433 unmodified lines | ||
| 434 | 434 | return; |
| 435 | 435 | |
| 436 | 436 | /* check tx tstamp status */ |
| 437 | − if (!priv->hw->desc->get_tx_timestamp_status(p)) { | |
| 437 | + if (priv->hw->desc->get_tx_timestamp_status(p)) { | |
| 438 | 438 | /* get the valid tstamp */ |
| 439 | 439 | ns = priv->hw->desc->get_timestamp(p, priv->adv_ts); |
| 440 | 440 | |
| 441 | 441 | memset(&shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); |
| 442 | 442 | shhwtstamp.hwtstamp = ns_to_ktime(ns); |
| 443 | 443 | |
| 444 | − netdev_info(priv->dev, "get valid TX hw timestamp %llu\n", ns); | |
| 444 | + netdev_dbg(priv->dev, "get valid TX hw timestamp %llu\n", ns); | |
| 445 | 445 | /* pass tstamp to stack */ |
| 446 | 446 | skb_tstamp_tx(skb, &shhwtstamp); |
| 447 | 447 | } |
| @@ -468,19 +468,19 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, · 20 unmodified lines | ||
| 468 | 468 | return; |
| 469 | 469 | |
| 470 | 470 | /* Check if timestamp is available */ |
| 471 | − if (!priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) { | |
| 471 | + if (priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) { | |
| 472 | 472 | /* For GMAC4, the valid timestamp is from CTX next desc. */ |
| 473 | 473 | if (priv->plat->has_gmac4) |
| 474 | 474 | ns = priv->hw->desc->get_timestamp(np, priv->adv_ts); |
| 475 | 475 | else |
| 476 | 476 | ns = priv->hw->desc->get_timestamp(p, priv->adv_ts); |
| 477 | 477 | |
| 478 | − netdev_info(priv->dev, "get valid RX hw timestamp %llu\n", ns); | |
| 478 | + netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns); | |
| 479 | 479 | shhwtstamp = skb_hwtstamps(skb); |
| 480 | 480 | memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); |
| 481 | 481 | shhwtstamp->hwtstamp = ns_to_ktime(ns); |
| 482 | 482 | } else { |
| 483 | − netdev_err(priv->dev, "cannot get RX hw timestamp\n"); | |
| 483 | + netdev_dbg(priv->dev, "cannot get RX hw timestamp\n"); | |
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
| @@ -546,7 +546,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 59 unmodified lines | ||
| 546 | 546 | /* PTP v1, UDP, any kind of event packet */ |
| 547 | 547 | config.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; |
| 548 | 548 | /* take time stamp for all event messages */ |
| 549 | − snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 549 | + if (priv->plat->has_gmac4) | |
| 550 | + snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1; | |
| 551 | + else | |
| 552 | + snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 550 | 553 | |
| 551 | 554 | ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; |
| 552 | 555 | ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; |
| @@ -578,7 +581,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 25 unmodified lines | ||
| 578 | 581 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; |
| 579 | 582 | ptp_v2 = PTP_TCR_TSVER2ENA; |
| 580 | 583 | /* take time stamp for all event messages */ |
| 581 | − snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 584 | + if (priv->plat->has_gmac4) | |
| 585 | + snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1; | |
| 586 | + else | |
| 587 | + snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 582 | 588 | |
| 583 | 589 | ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; |
| 584 | 590 | ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; |
| @@ -612,7 +618,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 27 unmodified lines | ||
| 612 | 618 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; |
| 613 | 619 | ptp_v2 = PTP_TCR_TSVER2ENA; |
| 614 | 620 | /* take time stamp for all event messages */ |
| 615 | − snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 621 | + if (priv->plat->has_gmac4) | |
| 622 | + snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1; | |
| 623 | + else | |
| 624 | + snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 616 | 625 | |
| 617 | 626 | ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; |
| 618 | 627 | ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; |
| @@ -2822,7 +2831,6 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 2203 unmodified lines | ||
| 2822 | 2831 | |
| 2823 | 2832 | tx_q->tx_skbuff_dma[first_entry].buf = des; |
| 2824 | 2833 | tx_q->tx_skbuff_dma[first_entry].len = skb_headlen(skb); |
| 2825 | − tx_q->tx_skbuff[first_entry] = skb; | |
| 2826 | 2834 | |
| 2827 | 2835 | first->des0 = cpu_to_le32(des); |
| 2828 | 2836 | |
| @@ -2856,6 +2864,14 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 27 unmodified lines | ||
| 2856 | 2864 | |
| 2857 | 2865 | tx_q->tx_skbuff_dma[tx_q->cur_tx].last_segment = true; |
| 2858 | 2866 | |
| 2867 | + /* Only the last descriptor gets to point to the skb. */ | |
| 2868 | + tx_q->tx_skbuff[tx_q->cur_tx] = skb; | |
| 2869 | + | |
| 2870 | + /* We've used all descriptors we need for this skb, however, | |
| 2871 | + * advance cur_tx so that it references a fresh descriptor. | |
| 2872 | + * ndo_start_xmit will fill this descriptor the next time it's | |
| 2873 | + * called and stmmac_tx_clean may clean up to this descriptor. | |
| 2874 | + */ | |
| 2859 | 2875 | tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, DMA_TX_SIZE); |
| 2860 | 2876 | |
| 2861 | 2877 | if (unlikely(stmmac_tx_avail(priv, queue) <= (MAX_SKB_FRAGS + 1))) { |
| @@ -2989,8 +3005,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 127 unmodified lines | ||
| 2989 | 3005 | |
| 2990 | 3006 | first = desc; |
| 2991 | 3007 | |
| 2992 | − tx_q->tx_skbuff[first_entry] = skb; | |
| 2993 | − | |
| 2994 | 3008 | enh_desc = priv->plat->enh_desc; |
| 2995 | 3009 | /* To program the descriptors according to the size of the frame */ |
| 2996 | 3010 | if (enh_desc) |
| @@ -3038,8 +3052,15 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 41 unmodified lines | ||
| 3038 | 3052 | skb->len); |
| 3039 | 3053 | } |
| 3040 | 3054 | |
| 3041 | − entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE); | |
| 3055 | + /* Only the last descriptor gets to point to the skb. */ | |
| 3056 | + tx_q->tx_skbuff[entry] = skb; | |
| 3042 | 3057 | |
| 3058 | + /* We've used all descriptors we need for this skb, however, | |
| 3059 | + * advance cur_tx so that it references a fresh descriptor. | |
| 3060 | + * ndo_start_xmit will fill this descriptor the next time it's | |
| 3061 | + * called and stmmac_tx_clean may clean up to this descriptor. | |
| 3062 | + */ | |
| 3063 | + entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE); | |
| 3043 | 3064 | tx_q->cur_tx = entry; |
| 3044 | 3065 | |
| 3045 | 3066 | if (netif_msg_pktdata(priv)) { |
| @@ -59,7 +59,8 @@ · 58 unmodified lines | ||
| 59 | 59 | /* Enable Snapshot for Messages Relevant to Master */ |
| 60 | 60 | #define PTP_TCR_TSMSTRENA BIT(15) |
| 61 | 61 | /* Select PTP packets for Taking Snapshots */ |
| 62 | −#define PTP_TCR_SNAPTYPSEL_1 GENMASK(17, 16) | |
| 62 | +#define PTP_TCR_SNAPTYPSEL_1 BIT(16) | |
| 63 | +#define PTP_GMAC4_TCR_SNAPTYPSEL_1 GENMASK(17, 16) | |
| 63 | 64 | /* Enable MAC address for PTP Frame Filtering */ |
| 64 | 65 | #define PTP_TCR_TSENMACADDR BIT(18) |
| 65 | 66 | |
| @@ -1007,7 +1007,7 @@ static void geneve_setup(struct net_device *dev) · 1006 unmodified lines | ||
| 1007 | 1007 | |
| 1008 | 1008 | dev->netdev_ops = &geneve_netdev_ops; |
| 1009 | 1009 | dev->ethtool_ops = &geneve_ethtool_ops; |
| 1010 | − dev->destructor = free_netdev; | |
| 1010 | + dev->needs_free_netdev = true; | |
| 1011 | 1011 | |
| 1012 | 1012 | SET_NETDEV_DEVTYPE(dev, &geneve_type); |
| 1013 | 1013 | |
| @@ -611,7 +611,7 @@ static const struct net_device_ops gtp_netdev_ops = { · 610 unmodified lines | ||
| 611 | 611 | static void gtp_link_setup(struct net_device *dev) |
| 612 | 612 | { |
| 613 | 613 | dev->netdev_ops = >p_netdev_ops; |
| 614 | − dev->destructor = free_netdev; | |
| 614 | + dev->needs_free_netdev = true; | |
| 615 | 615 | |
| 616 | 616 | dev->hard_header_len = 0; |
| 617 | 617 | dev->addr_len = 0; |
| @@ -311,7 +311,7 @@ static void sp_setup(struct net_device *dev) · 310 unmodified lines | ||
| 311 | 311 | { |
| 312 | 312 | /* Finish setting up the DEVICE info. */ |
| 313 | 313 | dev->netdev_ops = &sp_netdev_ops; |
| 314 | − dev->destructor = free_netdev; | |
| 314 | + dev->needs_free_netdev = true; | |
| 315 | 315 | dev->mtu = SIXP_MTU; |
| 316 | 316 | dev->hard_header_len = AX25_MAX_HEADER_LEN; |
| 317 | 317 | dev->header_ops = &ax25_header_ops; |
| @@ -476,7 +476,7 @@ static const struct net_device_ops bpq_netdev_ops = { · 475 unmodified lines | ||
| 476 | 476 | static void bpq_setup(struct net_device *dev) |
| 477 | 477 | { |
| 478 | 478 | dev->netdev_ops = &bpq_netdev_ops; |
| 479 | − dev->destructor = free_netdev; | |
| 479 | + dev->needs_free_netdev = true; | |
| 480 | 480 | |
| 481 | 481 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); |
| 482 | 482 | memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); |
| @@ -171,6 +171,8 @@ struct rndis_device { · 170 unmodified lines | ||
| 171 | 171 | spinlock_t request_lock; |
| 172 | 172 | struct list_head req_list; |
| 173 | 173 | |
| 174 | + struct work_struct mcast_work; | |
| 175 | + | |
| 174 | 176 | u8 hw_mac_adr[ETH_ALEN]; |
| 175 | 177 | u8 rss_key[NETVSC_HASH_KEYLEN]; |
| 176 | 178 | u16 ind_table[ITAB_NUM]; |
| @@ -201,6 +203,7 @@ int rndis_filter_open(struct netvsc_device *nvdev); · 24 unmodified lines | ||
| 201 | 203 | int rndis_filter_close(struct netvsc_device *nvdev); |
| 202 | 204 | int rndis_filter_device_add(struct hv_device *dev, |
| 203 | 205 | struct netvsc_device_info *info); |
| 206 | +void rndis_filter_update(struct netvsc_device *nvdev); | |
| 204 | 207 | void rndis_filter_device_remove(struct hv_device *dev, |
| 205 | 208 | struct netvsc_device *nvdev); |
| 206 | 209 | int rndis_filter_set_rss_param(struct rndis_device *rdev, |
| @@ -211,7 +214,6 @@ int rndis_filter_receive(struct net_device *ndev, · 4 unmodified lines | ||
| 211 | 214 | struct vmbus_channel *channel, |
| 212 | 215 | void *data, u32 buflen); |
| 213 | 216 | |
| 214 | −int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter); | |
| 215 | 217 | int rndis_filter_set_device_mac(struct net_device *ndev, char *mac); |
| 216 | 218 | |
| 217 | 219 | void netvsc_switch_datapath(struct net_device *nv_dev, bool vf); |
| @@ -696,7 +698,6 @@ struct net_device_context { · 478 unmodified lines | ||
| 696 | 698 | /* list protection */ |
| 697 | 699 | spinlock_t lock; |
| 698 | 700 | |
| 699 | − struct work_struct work; | |
| 700 | 701 | u32 msg_enable; /* debug level */ |
| 701 | 702 | |
| 702 | 703 | u32 tx_checksum_mask; |
| @@ -56,37 +56,12 @@ static int debug = -1; · 55 unmodified lines | ||
| 56 | 56 | module_param(debug, int, S_IRUGO); |
| 57 | 57 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
| 58 | 58 | |
| 59 | −static void do_set_multicast(struct work_struct *w) | |
| 60 | −{ | |
| 61 | − struct net_device_context *ndevctx = | |
| 62 | − container_of(w, struct net_device_context, work); | |
| 63 | − struct hv_device *device_obj = ndevctx->device_ctx; | |
| 64 | − struct net_device *ndev = hv_get_drvdata(device_obj); | |
| 65 | − struct netvsc_device *nvdev = rcu_dereference(ndevctx->nvdev); | |
| 66 | − struct rndis_device *rdev; | |
| 67 | − | |
| 68 | − if (!nvdev) | |
| 69 | − return; | |
| 70 | − | |
| 71 | − rdev = nvdev->extension; | |
| 72 | − if (rdev == NULL) | |
| 73 | − return; | |
| 74 | − | |
| 75 | − if (ndev->flags & IFF_PROMISC) | |
| 76 | − rndis_filter_set_packet_filter(rdev, | |
| 77 | − NDIS_PACKET_TYPE_PROMISCUOUS); | |
| 78 | − else | |
| 79 | − rndis_filter_set_packet_filter(rdev, | |
| 80 | − NDIS_PACKET_TYPE_BROADCAST | | |
| 81 | − NDIS_PACKET_TYPE_ALL_MULTICAST | | |
| 82 | − NDIS_PACKET_TYPE_DIRECTED); | |
| 83 | −} | |
| 84 | − | |
| 85 | 59 | static void netvsc_set_multicast_list(struct net_device *net) |
| 86 | 60 | { |
| 87 | 61 | struct net_device_context *net_device_ctx = netdev_priv(net); |
| 62 | + struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); | |
| 88 | 63 | |
| 89 | − schedule_work(&net_device_ctx->work); | |
| 64 | + rndis_filter_update(nvdev); | |
| 90 | 65 | } |
| 91 | 66 | |
| 92 | 67 | static int netvsc_open(struct net_device *net) |
| @@ -123,8 +98,6 @@ static int netvsc_close(struct net_device *net) · 30 unmodified lines | ||
| 123 | 98 | |
| 124 | 99 | netif_tx_disable(net); |
| 125 | 100 | |
| 126 | − /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */ | |
| 127 | − cancel_work_sync(&net_device_ctx->work); | |
| 128 | 101 | ret = rndis_filter_close(nvdev); |
| 129 | 102 | if (ret != 0) { |
| 130 | 103 | netdev_err(net, "unable to close device (ret %d).\n", ret); |
| @@ -1028,7 +1001,7 @@ static const struct { · 897 unmodified lines | ||
| 1028 | 1001 | static int netvsc_get_sset_count(struct net_device *dev, int string_set) |
| 1029 | 1002 | { |
| 1030 | 1003 | struct net_device_context *ndc = netdev_priv(dev); |
| 1031 | − struct netvsc_device *nvdev = rcu_dereference(ndc->nvdev); | |
| 1004 | + struct netvsc_device *nvdev = rtnl_dereference(ndc->nvdev); | |
| 1032 | 1005 | |
| 1033 | 1006 | if (!nvdev) |
| 1034 | 1007 | return -ENODEV; |
| @@ -1158,11 +1131,22 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, · 123 unmodified lines | ||
| 1158 | 1131 | } |
| 1159 | 1132 | |
| 1160 | 1133 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 1161 | −static void netvsc_poll_controller(struct net_device *net) | |
| 1134 | +static void netvsc_poll_controller(struct net_device *dev) | |
| 1162 | 1135 | { |
| 1163 | − /* As netvsc_start_xmit() works synchronous we don't have to | |
| 1164 | − * trigger anything here. | |
| 1165 | − */ | |
| 1136 | + struct net_device_context *ndc = netdev_priv(dev); | |
| 1137 | + struct netvsc_device *ndev; | |
| 1138 | + int i; | |
| 1139 | + | |
| 1140 | + rcu_read_lock(); | |
| 1141 | + ndev = rcu_dereference(ndc->nvdev); | |
| 1142 | + if (ndev) { | |
| 1143 | + for (i = 0; i < ndev->num_chn; i++) { | |
| 1144 | + struct netvsc_channel *nvchan = &ndev->chan_table[i]; | |
| 1145 | + | |
| 1146 | + napi_schedule(&nvchan->napi); | |
| 1147 | + } | |
| 1148 | + } | |
| 1149 | + rcu_read_unlock(); | |
| 1166 | 1150 | } |
| 1167 | 1151 | #endif |
| 1168 | 1152 | |
| @@ -1552,7 +1536,6 @@ static int netvsc_probe(struct hv_device *dev, · 383 unmodified lines | ||
| 1552 | 1536 | hv_set_drvdata(dev, net); |
| 1553 | 1537 | |
| 1554 | 1538 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change); |
| 1555 | − INIT_WORK(&net_device_ctx->work, do_set_multicast); | |
| 1556 | 1539 | |
| 1557 | 1540 | spin_lock_init(&net_device_ctx->lock); |
| 1558 | 1541 | INIT_LIST_HEAD(&net_device_ctx->reconfig_events); |
| @@ -1622,7 +1605,6 @@ static int netvsc_remove(struct hv_device *dev) · 63 unmodified lines | ||
| 1622 | 1605 | netif_device_detach(net); |
| 1623 | 1606 | |
| 1624 | 1607 | cancel_delayed_work_sync(&ndev_ctx->dwork); |
| 1625 | − cancel_work_sync(&ndev_ctx->work); | |
| 1626 | 1608 | |
| 1627 | 1609 | /* |
| 1628 | 1610 | * Call to the vsc driver to let it know that the device is being |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | #include "hyperv_net.h" |
| 33 | 33 | |
| 34 | +static void rndis_set_multicast(struct work_struct *w); | |
| 34 | 35 | |
| 35 | 36 | #define RNDIS_EXT_LEN PAGE_SIZE |
| 36 | 37 | struct rndis_request { |
| @@ -76,6 +77,7 @@ static struct rndis_device *get_rndis_device(void) · 39 unmodified lines | ||
| 76 | 77 | spin_lock_init(&device->request_lock); |
| 77 | 78 | |
| 78 | 79 | INIT_LIST_HEAD(&device->req_list); |
| 80 | + INIT_WORK(&device->mcast_work, rndis_set_multicast); | |
| 79 | 81 | |
| 80 | 82 | device->state = RNDIS_DEV_UNINITIALIZED; |
| 81 | 83 | |
| @@ -815,7 +817,8 @@ static int rndis_filter_query_link_speed(struct rndis_device *dev) · 733 unmodified lines | ||
| 815 | 817 | return ret; |
| 816 | 818 | } |
| 817 | 819 | |
| 818 | −int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter) | |
| 820 | +static int rndis_filter_set_packet_filter(struct rndis_device *dev, | |
| 821 | + u32 new_filter) | |
| 819 | 822 | { |
| 820 | 823 | struct rndis_request *request; |
| 821 | 824 | struct rndis_set_request *set; |
| @@ -846,6 +849,28 @@ int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter) · 24 unmodified lines | ||
| 846 | 849 | return ret; |
| 847 | 850 | } |
| 848 | 851 | |
| 852 | +static void rndis_set_multicast(struct work_struct *w) | |
| 853 | +{ | |
| 854 | + struct rndis_device *rdev | |
| 855 | + = container_of(w, struct rndis_device, mcast_work); | |
| 856 | + | |
| 857 | + if (rdev->ndev->flags & IFF_PROMISC) | |
| 858 | + rndis_filter_set_packet_filter(rdev, | |
| 859 | + NDIS_PACKET_TYPE_PROMISCUOUS); | |
| 860 | + else | |
| 861 | + rndis_filter_set_packet_filter(rdev, | |
| 862 | + NDIS_PACKET_TYPE_BROADCAST | | |
| 863 | + NDIS_PACKET_TYPE_ALL_MULTICAST | | |
| 864 | + NDIS_PACKET_TYPE_DIRECTED); | |
| 865 | +} | |
| 866 | + | |
| 867 | +void rndis_filter_update(struct netvsc_device *nvdev) | |
| 868 | +{ | |
| 869 | + struct rndis_device *rdev = nvdev->extension; | |
| 870 | + | |
| 871 | + schedule_work(&rdev->mcast_work); | |
| 872 | +} | |
| 873 | + | |
| 849 | 874 | static int rndis_filter_init_device(struct rndis_device *dev) |
| 850 | 875 | { |
| 851 | 876 | struct rndis_request *request; |
| @@ -973,6 +998,9 @@ static int rndis_filter_close_device(struct rndis_device *dev) · 121 unmodified lines | ||
| 973 | 998 | if (dev->state != RNDIS_DEV_DATAINITIALIZED) |
| 974 | 999 | return 0; |
| 975 | 1000 | |
| 1001 | + /* Make sure rndis_set_multicast doesn't re-enable filter! */ | |
| 1002 | + cancel_work_sync(&dev->mcast_work); | |
| 1003 | + | |
| 976 | 1004 | ret = rndis_filter_set_packet_filter(dev, 0); |
| 977 | 1005 | if (ret == -ENODEV) |
| 978 | 1006 | ret = 0; |
| @@ -207,7 +207,6 @@ static void ifb_dev_free(struct net_device *dev) · 206 unmodified lines | ||
| 207 | 207 | __skb_queue_purge(&txp->tq); |
| 208 | 208 | } |
| 209 | 209 | kfree(dp->tx_private); |
| 210 | − free_netdev(dev); | |
| 211 | 210 | } |
| 212 | 211 | |
| 213 | 212 | static void ifb_setup(struct net_device *dev) |
| @@ -230,7 +229,8 @@ static void ifb_setup(struct net_device *dev) · 16 unmodified lines | ||
| 230 | 229 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 231 | 230 | netif_keep_dst(dev); |
| 232 | 231 | eth_hw_addr_random(dev); |
| 233 | − dev->destructor = ifb_dev_free; | |
| 232 | + dev->needs_free_netdev = true; | |
| 233 | + dev->priv_destructor = ifb_dev_free; | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) |
| @@ -632,7 +632,7 @@ void ipvlan_link_setup(struct net_device *dev) · 631 unmodified lines | ||
| 632 | 632 | dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); |
| 633 | 633 | dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE; |
| 634 | 634 | dev->netdev_ops = &ipvlan_netdev_ops; |
| 635 | − dev->destructor = free_netdev; | |
| 635 | + dev->needs_free_netdev = true; | |
| 636 | 636 | dev->header_ops = &ipvlan_header_ops; |
| 637 | 637 | dev->ethtool_ops = &ipvlan_ethtool_ops; |
| 638 | 638 | } |
| @@ -159,7 +159,6 @@ static void loopback_dev_free(struct net_device *dev) · 158 unmodified lines | ||
| 159 | 159 | { |
| 160 | 160 | dev_net(dev)->loopback_dev = NULL; |
| 161 | 161 | free_percpu(dev->lstats); |
| 162 | − free_netdev(dev); | |
| 163 | 162 | } |
| 164 | 163 | |
| 165 | 164 | static const struct net_device_ops loopback_ops = { |
| @@ -196,7 +195,8 @@ static void loopback_setup(struct net_device *dev) · 30 unmodified lines | ||
| 196 | 195 | dev->ethtool_ops = &loopback_ethtool_ops; |
| 197 | 196 | dev->header_ops = ð_header_ops; |
| 198 | 197 | dev->netdev_ops = &loopback_ops; |
| 199 | − dev->destructor = loopback_dev_free; | |
| 198 | + dev->needs_free_netdev = true; | |
| 199 | + dev->priv_destructor = loopback_dev_free; | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /* Setup and register the loopback device. */ |
| @@ -2996,7 +2996,6 @@ static void macsec_free_netdev(struct net_device *dev) · 2995 unmodified lines | ||
| 2996 | 2996 | free_percpu(macsec->secy.tx_sc.stats); |
| 2997 | 2997 | |
| 2998 | 2998 | dev_put(real_dev); |
| 2999 | − free_netdev(dev); | |
| 3000 | 2999 | } |
| 3001 | 3000 | |
| 3002 | 3001 | static void macsec_setup(struct net_device *dev) |
| @@ -3006,7 +3005,8 @@ static void macsec_setup(struct net_device *dev) · 3 unmodified lines | ||
| 3006 | 3005 | dev->max_mtu = ETH_MAX_MTU; |
| 3007 | 3006 | dev->priv_flags |= IFF_NO_QUEUE; |
| 3008 | 3007 | dev->netdev_ops = &macsec_netdev_ops; |
| 3009 | − dev->destructor = macsec_free_netdev; | |
| 3008 | + dev->needs_free_netdev = true; | |
| 3009 | + dev->priv_destructor = macsec_free_netdev; | |
| 3010 | 3010 | SET_NETDEV_DEVTYPE(dev, &macsec_type); |
| 3011 | 3011 | |
| 3012 | 3012 | eth_zero_addr(dev->broadcast); |
| @@ -1092,7 +1092,7 @@ void macvlan_common_setup(struct net_device *dev) · 1091 unmodified lines | ||
| 1092 | 1092 | netif_keep_dst(dev); |
| 1093 | 1093 | dev->priv_flags |= IFF_UNICAST_FLT; |
| 1094 | 1094 | dev->netdev_ops = &macvlan_netdev_ops; |
| 1095 | − dev->destructor = free_netdev; | |
| 1095 | + dev->needs_free_netdev = true; | |
| 1096 | 1096 | dev->header_ops = &macvlan_hard_header_ops; |
| 1097 | 1097 | dev->ethtool_ops = &macvlan_ethtool_ops; |
| 1098 | 1098 | } |
| @@ -358,7 +358,7 @@ static ssize_t enabled_store(struct config_item *item, · 357 unmodified lines | ||
| 358 | 358 | if (err) |
| 359 | 359 | goto out_unlock; |
| 360 | 360 | |
| 361 | − pr_info("netconsole: network logging started\n"); | |
| 361 | + pr_info("network logging started\n"); | |
| 362 | 362 | } else { /* false */ |
| 363 | 363 | /* We need to disable the netconsole before cleaning it up |
| 364 | 364 | * otherwise we might end up in write_msg() with |
| @@ -113,7 +113,7 @@ static void nlmon_setup(struct net_device *dev) · 112 unmodified lines | ||
| 113 | 113 | |
| 114 | 114 | dev->netdev_ops = &nlmon_ops; |
| 115 | 115 | dev->ethtool_ops = &nlmon_ethtool_ops; |
| 116 | − dev->destructor = free_netdev; | |
| 116 | + dev->needs_free_netdev = true; | |
| 117 | 117 | |
| 118 | 118 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | |
| 119 | 119 | NETIF_F_HIGHDMA | NETIF_F_LLTX; |
| @@ -127,6 +127,7 @@ config MDIO_THUNDER · 126 unmodified lines | ||
| 127 | 127 | tristate "ThunderX SOCs MDIO buses" |
| 128 | 128 | depends on 64BIT |
| 129 | 129 | depends on PCI |
| 130 | + depends on !(MDIO_DEVICE=y && PHYLIB=m) | |
| 130 | 131 | select MDIO_CAVIUM |
| 131 | 132 | help |
| 132 | 133 | This driver supports the MDIO interfaces found on Cavium |
| @@ -54,6 +54,8 @@ static const char *phy_speed_to_str(int speed) · 53 unmodified lines | ||
| 54 | 54 | return "5Gbps"; |
| 55 | 55 | case SPEED_10000: |
| 56 | 56 | return "10Gbps"; |
| 57 | + case SPEED_14000: | |
| 58 | + return "14Gbps"; | |
| 57 | 59 | case SPEED_20000: |
| 58 | 60 | return "20Gbps"; |
| 59 | 61 | case SPEED_25000: |
| @@ -629,7 +629,7 @@ static void sl_uninit(struct net_device *dev) · 628 unmodified lines | ||
| 629 | 629 | static void sl_free_netdev(struct net_device *dev) |
| 630 | 630 | { |
| 631 | 631 | int i = dev->base_addr; |
| 632 | − free_netdev(dev); | |
| 632 | + | |
| 633 | 633 | slip_devs[i] = NULL; |
| 634 | 634 | } |
| 635 | 635 | |
| @@ -651,7 +651,8 @@ static const struct net_device_ops sl_netdev_ops = { · 15 unmodified lines | ||
| 651 | 651 | static void sl_setup(struct net_device *dev) |
| 652 | 652 | { |
| 653 | 653 | dev->netdev_ops = &sl_netdev_ops; |
| 654 | − dev->destructor = sl_free_netdev; | |
| 654 | + dev->needs_free_netdev = true; | |
| 655 | + dev->priv_destructor = sl_free_netdev; | |
| 655 | 656 | |
| 656 | 657 | dev->hard_header_len = 0; |
| 657 | 658 | dev->addr_len = 0; |
| @@ -1369,8 +1370,6 @@ static void __exit slip_exit(void) · 711 unmodified lines | ||
| 1369 | 1370 | if (sl->tty) { |
| 1370 | 1371 | printk(KERN_ERR "%s: tty discipline still running\n", |
| 1371 | 1372 | dev->name); |
| 1372 | − /* Intentionally leak the control block. */ | |
| 1373 | − dev->destructor = NULL; | |
| 1374 | 1373 | } |
| 1375 | 1374 | |
| 1376 | 1375 | unregister_netdev(dev); |
| @@ -1643,7 +1643,6 @@ static void team_destructor(struct net_device *dev) · 1642 unmodified lines | ||
| 1643 | 1643 | struct team *team = netdev_priv(dev); |
| 1644 | 1644 | |
| 1645 | 1645 | free_percpu(team->pcpu_stats); |
| 1646 | − free_netdev(dev); | |
| 1647 | 1646 | } |
| 1648 | 1647 | |
| 1649 | 1648 | static int team_open(struct net_device *dev) |
| @@ -2079,7 +2078,8 @@ static void team_setup(struct net_device *dev) · 429 unmodified lines | ||
| 2079 | 2078 | |
| 2080 | 2079 | dev->netdev_ops = &team_netdev_ops; |
| 2081 | 2080 | dev->ethtool_ops = &team_ethtool_ops; |
| 2082 | − dev->destructor = team_destructor; | |
| 2081 | + dev->needs_free_netdev = true; | |
| 2082 | + dev->priv_destructor = team_destructor; | |
| 2083 | 2083 | dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); |
| 2084 | 2084 | dev->priv_flags |= IFF_NO_QUEUE; |
| 2085 | 2085 | dev->priv_flags |= IFF_TEAM; |
| @@ -1560,7 +1560,6 @@ static void tun_free_netdev(struct net_device *dev) · 1559 unmodified lines | ||
| 1560 | 1560 | free_percpu(tun->pcpu_stats); |
| 1561 | 1561 | tun_flow_uninit(tun); |
| 1562 | 1562 | security_tun_dev_free_security(tun->security); |
| 1563 | − free_netdev(dev); | |
| 1564 | 1563 | } |
| 1565 | 1564 | |
| 1566 | 1565 | static void tun_setup(struct net_device *dev) |
| @@ -1571,7 +1570,8 @@ static void tun_setup(struct net_device *dev) · 4 unmodified lines | ||
| 1571 | 1570 | tun->group = INVALID_GID; |
| 1572 | 1571 | |
| 1573 | 1572 | dev->ethtool_ops = &tun_ethtool_ops; |
| 1574 | − dev->destructor = tun_free_netdev; | |
| 1573 | + dev->needs_free_netdev = true; | |
| 1574 | + dev->priv_destructor = tun_free_netdev; | |
| 1575 | 1575 | /* We prefer our own queue length */ |
| 1576 | 1576 | dev->tx_queue_len = TUN_READQ_SIZE; |
| 1577 | 1577 | } |
| @@ -298,7 +298,7 @@ static void usbpn_setup(struct net_device *dev) · 297 unmodified lines | ||
| 298 | 298 | dev->addr_len = 1; |
| 299 | 299 | dev->tx_queue_len = 3; |
| 300 | 300 | |
| 301 | − dev->destructor = free_netdev; | |
| 301 | + dev->needs_free_netdev = true; | |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /* |
| @@ -123,7 +123,7 @@ static void qmimux_setup(struct net_device *dev) · 122 unmodified lines | ||
| 123 | 123 | dev->addr_len = 0; |
| 124 | 124 | dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; |
| 125 | 125 | dev->netdev_ops = &qmimux_netdev_ops; |
| 126 | − dev->destructor = free_netdev; | |
| 126 | + dev->needs_free_netdev = true; | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | static struct net_device *qmimux_find_dev(struct usbnet *dev, u8 mux_id) |
| @@ -1192,6 +1192,8 @@ static const struct usb_device_id products[] = { · 1062 unmodified lines | ||
| 1192 | 1192 | {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ |
| 1193 | 1193 | {QMI_FIXED_INTF(0x1199, 0x9057, 8)}, |
| 1194 | 1194 | {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ |
| 1195 | + {QMI_FIXED_INTF(0x1199, 0x9063, 8)}, /* Sierra Wireless EM7305 */ | |
| 1196 | + {QMI_FIXED_INTF(0x1199, 0x9063, 10)}, /* Sierra Wireless EM7305 */ | |
| 1195 | 1197 | {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */ |
| 1196 | 1198 | {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */ |
| 1197 | 1199 | {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */ |
| @@ -1206,6 +1208,8 @@ static const struct usb_device_id products[] = { · 8 unmodified lines | ||
| 1206 | 1208 | {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ |
| 1207 | 1209 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
| 1208 | 1210 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ |
| 1211 | + {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */ | |
| 1212 | + {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)}, /* Telewell TW-3G HSPA+ */ | |
| 1209 | 1213 | {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */ |
| 1210 | 1214 | {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */ |
| 1211 | 1215 | {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */ |
| @@ -4368,6 +4368,8 @@ static u8 rtl_get_version(struct usb_interface *intf) · 4367 unmodified lines | ||
| 4368 | 4368 | break; |
| 4369 | 4369 | } |
| 4370 | 4370 | |
| 4371 | + dev_dbg(&intf->dev, "Detected version 0x%04x\n", version); | |
| 4372 | + | |
| 4371 | 4373 | return version; |
| 4372 | 4374 | } |
| 4373 | 4375 | |
| @@ -222,7 +222,6 @@ static int veth_dev_init(struct net_device *dev) · 221 unmodified lines | ||
| 222 | 222 | static void veth_dev_free(struct net_device *dev) |
| 223 | 223 | { |
| 224 | 224 | free_percpu(dev->vstats); |
| 225 | − free_netdev(dev); | |
| 226 | 225 | } |
| 227 | 226 | |
| 228 | 227 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| @@ -317,7 +316,8 @@ static void veth_setup(struct net_device *dev) · 88 unmodified lines | ||
| 317 | 316 | NETIF_F_HW_VLAN_STAG_TX | |
| 318 | 317 | NETIF_F_HW_VLAN_CTAG_RX | |
| 319 | 318 | NETIF_F_HW_VLAN_STAG_RX); |
| 320 | − dev->destructor = veth_dev_free; | |
| 319 | + dev->needs_free_netdev = true; | |
| 320 | + dev->priv_destructor = veth_dev_free; | |
| 321 | 321 | dev->max_mtu = ETH_MAX_MTU; |
| 322 | 322 | |
| 323 | 323 | dev->hw_features = VETH_FEATURES; |
| @@ -36,12 +36,14 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <net/addrconf.h> |
| 37 | 37 | #include <net/l3mdev.h> |
| 38 | 38 | #include <net/fib_rules.h> |
| 39 | +#include <net/netns/generic.h> | |
| 39 | 40 | |
| 40 | 41 | #define DRV_NAME "vrf" |
| 41 | 42 | #define DRV_VERSION "1.0" |
| 42 | 43 | |
| 43 | 44 | #define FIB_RULE_PREF 1000 /* default preference for FIB rules */ |
| 44 | −static bool add_fib_rules = true; | |
| 45 | + | |
| 46 | +static unsigned int vrf_net_id; | |
| 45 | 47 | |
| 46 | 48 | struct net_vrf { |
| 47 | 49 | struct rtable __rcu *rth; |
| @@ -1348,7 +1350,7 @@ static void vrf_setup(struct net_device *dev) · 1300 unmodified lines | ||
| 1348 | 1350 | dev->netdev_ops = &vrf_netdev_ops; |
| 1349 | 1351 | dev->l3mdev_ops = &vrf_l3mdev_ops; |
| 1350 | 1352 | dev->ethtool_ops = &vrf_ethtool_ops; |
| 1351 | − dev->destructor = free_netdev; | |
| 1353 | + dev->needs_free_netdev = true; | |
| 1352 | 1354 | |
| 1353 | 1355 | /* Fill in device structure with ethernet-generic values. */ |
| 1354 | 1356 | eth_hw_addr_random(dev); |
| @@ -1394,6 +1396,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 39 unmodified lines | ||
| 1394 | 1396 | struct nlattr *tb[], struct nlattr *data[]) |
| 1395 | 1397 | { |
| 1396 | 1398 | struct net_vrf *vrf = netdev_priv(dev); |
| 1399 | + bool *add_fib_rules; | |
| 1400 | + struct net *net; | |
| 1397 | 1401 | int err; |
| 1398 | 1402 | |
| 1399 | 1403 | if (!data || !data[IFLA_VRF_TABLE]) |
| @@ -1409,13 +1413,15 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 9 unmodified lines | ||
| 1409 | 1413 | if (err) |
| 1410 | 1414 | goto out; |
| 1411 | 1415 | |
| 1412 | − if (add_fib_rules) { | |
| 1416 | + net = dev_net(dev); | |
| 1417 | + add_fib_rules = net_generic(net, vrf_net_id); | |
| 1418 | + if (*add_fib_rules) { | |
| 1413 | 1419 | err = vrf_add_fib_rules(dev); |
| 1414 | 1420 | if (err) { |
| 1415 | 1421 | unregister_netdevice(dev); |
| 1416 | 1422 | goto out; |
| 1417 | 1423 | } |
| 1418 | − add_fib_rules = false; | |
| 1424 | + *add_fib_rules = false; | |
| 1419 | 1425 | } |
| 1420 | 1426 | |
| 1421 | 1427 | out: |
| @@ -1498,16 +1504,38 @@ static struct notifier_block vrf_notifier_block __read_mostly = { · 76 unmodified lines | ||
| 1498 | 1504 | .notifier_call = vrf_device_event, |
| 1499 | 1505 | }; |
| 1500 | 1506 | |
| 1507 | +/* Initialize per network namespace state */ | |
| 1508 | +static int __net_init vrf_netns_init(struct net *net) | |
| 1509 | +{ | |
| 1510 | + bool *add_fib_rules = net_generic(net, vrf_net_id); | |
| 1511 | + | |
| 1512 | + *add_fib_rules = true; | |
| 1513 | + | |
| 1514 | + return 0; | |
| 1515 | +} | |
| 1516 | + | |
| 1517 | +static struct pernet_operations vrf_net_ops __net_initdata = { | |
| 1518 | + .init = vrf_netns_init, | |
| 1519 | + .id = &vrf_net_id, | |
| 1520 | + .size = sizeof(bool), | |
| 1521 | +}; | |
| 1522 | + | |
| 1501 | 1523 | static int __init vrf_init_module(void) |
| 1502 | 1524 | { |
| 1503 | 1525 | int rc; |
| 1504 | 1526 | |
| 1505 | 1527 | register_netdevice_notifier(&vrf_notifier_block); |
| 1506 | 1528 | |
| 1507 | − rc = rtnl_link_register(&vrf_link_ops); | |
| 1529 | + rc = register_pernet_subsys(&vrf_net_ops); | |
| 1508 | 1530 | if (rc < 0) |
| 1509 | 1531 | goto error; |
| 1510 | 1532 | |
| 1533 | + rc = rtnl_link_register(&vrf_link_ops); | |
| 1534 | + if (rc < 0) { | |
| 1535 | + unregister_pernet_subsys(&vrf_net_ops); | |
| 1536 | + goto error; | |
| 1537 | + } | |
| 1538 | + | |
| 1511 | 1539 | return 0; |
| 1512 | 1540 | |
| 1513 | 1541 | error: |
| @@ -135,7 +135,7 @@ static void vsockmon_setup(struct net_device *dev) · 134 unmodified lines | ||
| 135 | 135 | |
| 136 | 136 | dev->netdev_ops = &vsockmon_ops; |
| 137 | 137 | dev->ethtool_ops = &vsockmon_ethtool_ops; |
| 138 | − dev->destructor = free_netdev; | |
| 138 | + dev->needs_free_netdev = true; | |
| 139 | 139 | |
| 140 | 140 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | |
| 141 | 141 | NETIF_F_HIGHDMA | NETIF_F_LLTX; |
| @@ -2611,7 +2611,7 @@ static void vxlan_setup(struct net_device *dev) · 2610 unmodified lines | ||
| 2611 | 2611 | eth_hw_addr_random(dev); |
| 2612 | 2612 | ether_setup(dev); |
| 2613 | 2613 | |
| 2614 | − dev->destructor = free_netdev; | |
| 2614 | + dev->needs_free_netdev = true; | |
| 2615 | 2615 | SET_NETDEV_DEVTYPE(dev, &vxlan_type); |
| 2616 | 2616 | |
| 2617 | 2617 | dev->features |= NETIF_F_LLTX; |
| @@ -475,7 +475,7 @@ static void dlci_setup(struct net_device *dev) · 474 unmodified lines | ||
| 475 | 475 | dev->flags = 0; |
| 476 | 476 | dev->header_ops = &dlci_header_ops; |
| 477 | 477 | dev->netdev_ops = &dlci_netdev_ops; |
| 478 | − dev->destructor = free_netdev; | |
| 478 | + dev->needs_free_netdev = true; | |
| 479 | 479 | |
| 480 | 480 | dlp->receive = dlci_receive; |
| 481 | 481 | |
| @@ -1106,7 +1106,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) · 1105 unmodified lines | ||
| 1106 | 1106 | return -EIO; |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | − dev->destructor = free_netdev; | |
| 1109 | + dev->needs_free_netdev = true; | |
| 1110 | 1110 | *get_dev_p(pvc, type) = dev; |
| 1111 | 1111 | if (!used) { |
| 1112 | 1112 | state(hdlc)->dce_changed = 1; |
| @@ -306,7 +306,7 @@ static const struct net_device_ops lapbeth_netdev_ops = { · 305 unmodified lines | ||
| 306 | 306 | static void lapbeth_setup(struct net_device *dev) |
| 307 | 307 | { |
| 308 | 308 | dev->netdev_ops = &lapbeth_netdev_ops; |
| 309 | − dev->destructor = free_netdev; | |
| 309 | + dev->needs_free_netdev = true; | |
| 310 | 310 | dev->type = ARPHRD_X25; |
| 311 | 311 | dev->hard_header_len = 3; |
| 312 | 312 | dev->mtu = 1000; |
| @@ -1287,7 +1287,7 @@ void init_netdev(struct net_device *dev) · 1286 unmodified lines | ||
| 1287 | 1287 | struct ath6kl *ar = ath6kl_priv(dev); |
| 1288 | 1288 | |
| 1289 | 1289 | dev->netdev_ops = &ath6kl_netdev_ops; |
| 1290 | − dev->destructor = free_netdev; | |
| 1290 | + dev->needs_free_netdev = true; | |
| 1291 | 1291 | dev->watchdog_timeo = ATH6KL_TX_TIMEOUT; |
| 1292 | 1292 | |
| 1293 | 1293 | dev->needed_headroom = ETH_HLEN; |
| @@ -5225,7 +5225,6 @@ void brcmf_cfg80211_free_netdev(struct net_device *ndev) · 5224 unmodified lines | ||
| 5225 | 5225 | |
| 5226 | 5226 | if (vif) |
| 5227 | 5227 | brcmf_free_vif(vif); |
| 5228 | − free_netdev(ndev); | |
| 5229 | 5228 | } |
| 5230 | 5229 | |
| 5231 | 5230 | static bool brcmf_is_linkup(const struct brcmf_event_msg *e) |
| @@ -624,7 +624,8 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, · 623 unmodified lines | ||
| 624 | 624 | if (!ndev) |
| 625 | 625 | return ERR_PTR(-ENOMEM); |
| 626 | 626 | |
| 627 | − ndev->destructor = brcmf_cfg80211_free_netdev; | |
| 627 | + ndev->needs_free_netdev = true; | |
| 628 | + ndev->priv_destructor = brcmf_cfg80211_free_netdev; | |
| 628 | 629 | ifp = netdev_priv(ndev); |
| 629 | 630 | ifp->ndev = ndev; |
| 630 | 631 | /* store mapping ifidx to bsscfgidx */ |
| @@ -442,7 +442,7 @@ struct brcmf_fw { · 441 unmodified lines | ||
| 442 | 442 | const char *nvram_name; |
| 443 | 443 | u16 domain_nr; |
| 444 | 444 | u16 bus_nr; |
| 445 | − void (*done)(struct device *dev, const struct firmware *fw, | |
| 445 | + void (*done)(struct device *dev, int err, const struct firmware *fw, | |
| 446 | 446 | void *nvram_image, u32 nvram_len); |
| 447 | 447 | }; |
| 448 | 448 | |
| @@ -477,52 +477,51 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) · 28 unmodified lines | ||
| 477 | 477 | if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) |
| 478 | 478 | goto fail; |
| 479 | 479 | |
| 480 | − fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length); | |
| 480 | + fwctx->done(fwctx->dev, 0, fwctx->code, nvram, nvram_length); | |
| 481 | 481 | kfree(fwctx); |
| 482 | 482 | return; |
| 483 | 483 | |
| 484 | 484 | fail: |
| 485 | 485 | brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); |
| 486 | 486 | release_firmware(fwctx->code); |
| 487 | − device_release_driver(fwctx->dev); | |
| 487 | + fwctx->done(fwctx->dev, -ENOENT, NULL, NULL, 0); | |
| 488 | 488 | kfree(fwctx); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx) |
| 492 | 492 | { |
| 493 | 493 | struct brcmf_fw *fwctx = ctx; |
| 494 | − int ret; | |
| 494 | + int ret = 0; | |
| 495 | 495 | |
| 496 | 496 | brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); |
| 497 | − if (!fw) | |
| 497 | + if (!fw) { | |
| 498 | + ret = -ENOENT; | |
| 498 | 499 | goto fail; |
| 499 | − | |
| 500 | − /* only requested code so done here */ | |
| 501 | − if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) { | |
| 502 | − fwctx->done(fwctx->dev, fw, NULL, 0); | |
| 503 | − kfree(fwctx); | |
| 504 | − return; | |
| 505 | 500 | } |
| 501 | + /* only requested code so done here */ | |
| 502 | + if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) | |
| 503 | + goto done; | |
| 504 | + | |
| 506 | 505 | fwctx->code = fw; |
| 507 | 506 | ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name, |
| 508 | 507 | fwctx->dev, GFP_KERNEL, fwctx, |
| 509 | 508 | brcmf_fw_request_nvram_done); |
| 510 | 509 | |
| 511 | − if (!ret) | |
| 512 | − return; | |
| 513 | − | |
| 514 | − brcmf_fw_request_nvram_done(NULL, fwctx); | |
| 510 | + /* pass NULL to nvram callback for bcm47xx fallback */ | |
| 511 | + if (ret) | |
| 512 | + brcmf_fw_request_nvram_done(NULL, fwctx); | |
| 515 | 513 | return; |
| 516 | 514 | |
| 517 | 515 | fail: |
| 518 | 516 | brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); |
| 519 | − device_release_driver(fwctx->dev); | |
| 517 | +done: | |
| 518 | + fwctx->done(fwctx->dev, ret, fw, NULL, 0); | |
| 520 | 519 | kfree(fwctx); |
| 521 | 520 | } |
| 522 | 521 | |
| 523 | 522 | int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, |
| 524 | 523 | const char *code, const char *nvram, |
| 525 | − void (*fw_cb)(struct device *dev, | |
| 524 | + void (*fw_cb)(struct device *dev, int err, | |
| 526 | 525 | const struct firmware *fw, |
| 527 | 526 | void *nvram_image, u32 nvram_len), |
| 528 | 527 | u16 domain_nr, u16 bus_nr) |
| @@ -555,7 +554,7 @@ int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, · 26 unmodified lines | ||
| 555 | 554 | |
| 556 | 555 | int brcmf_fw_get_firmwares(struct device *dev, u16 flags, |
| 557 | 556 | const char *code, const char *nvram, |
| 558 | − void (*fw_cb)(struct device *dev, | |
| 557 | + void (*fw_cb)(struct device *dev, int err, | |
| 559 | 558 | const struct firmware *fw, |
| 560 | 559 | void *nvram_image, u32 nvram_len)) |
| 561 | 560 | { |
| @@ -73,13 +73,13 @@ void brcmf_fw_nvram_free(void *nvram); · 72 unmodified lines | ||
| 73 | 73 | */ |
| 74 | 74 | int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, |
| 75 | 75 | const char *code, const char *nvram, |
| 76 | − void (*fw_cb)(struct device *dev, | |
| 76 | + void (*fw_cb)(struct device *dev, int err, | |
| 77 | 77 | const struct firmware *fw, |
| 78 | 78 | void *nvram_image, u32 nvram_len), |
| 79 | 79 | u16 domain_nr, u16 bus_nr); |
| 80 | 80 | int brcmf_fw_get_firmwares(struct device *dev, u16 flags, |
| 81 | 81 | const char *code, const char *nvram, |
| 82 | − void (*fw_cb)(struct device *dev, | |
| 82 | + void (*fw_cb)(struct device *dev, int err, | |
| 83 | 83 | const struct firmware *fw, |
| 84 | 84 | void *nvram_image, u32 nvram_len)); |
| 85 | 85 | |
| @@ -2145,7 +2145,7 @@ void brcmf_fws_add_interface(struct brcmf_if *ifp) · 2144 unmodified lines | ||
| 2145 | 2145 | struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); |
| 2146 | 2146 | struct brcmf_fws_mac_descriptor *entry; |
| 2147 | 2147 | |
| 2148 | − if (!ifp->ndev || fws->fcmode == BRCMF_FWS_FCMODE_NONE) | |
| 2148 | + if (!ifp->ndev || !brcmf_fws_queue_skbs(fws)) | |
| 2149 | 2149 | return; |
| 2150 | 2150 | |
| 2151 | 2151 | entry = &fws->desc.iface[ifp->ifidx]; |
| @@ -1650,16 +1650,23 @@ static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = { · 1649 unmodified lines | ||
| 1650 | 1650 | .write32 = brcmf_pcie_buscore_write32, |
| 1651 | 1651 | }; |
| 1652 | 1652 | |
| 1653 | −static void brcmf_pcie_setup(struct device *dev, const struct firmware *fw, | |
| 1653 | +static void brcmf_pcie_setup(struct device *dev, int ret, | |
| 1654 | + const struct firmware *fw, | |
| 1654 | 1655 | void *nvram, u32 nvram_len) |
| 1655 | 1656 | { |
| 1656 | − struct brcmf_bus *bus = dev_get_drvdata(dev); | |
| 1657 | − struct brcmf_pciedev *pcie_bus_dev = bus->bus_priv.pcie; | |
| 1658 | − struct brcmf_pciedev_info *devinfo = pcie_bus_dev->devinfo; | |
| 1657 | + struct brcmf_bus *bus; | |
| 1658 | + struct brcmf_pciedev *pcie_bus_dev; | |
| 1659 | + struct brcmf_pciedev_info *devinfo; | |
| 1659 | 1660 | struct brcmf_commonring **flowrings; |
| 1660 | − int ret; | |
| 1661 | 1661 | u32 i; |
| 1662 | 1662 | |
| 1663 | + /* check firmware loading result */ | |
| 1664 | + if (ret) | |
| 1665 | + goto fail; | |
| 1666 | + | |
| 1667 | + bus = dev_get_drvdata(dev); | |
| 1668 | + pcie_bus_dev = bus->bus_priv.pcie; | |
| 1669 | + devinfo = pcie_bus_dev->devinfo; | |
| 1663 | 1670 | brcmf_pcie_attach(devinfo); |
| 1664 | 1671 | |
| 1665 | 1672 | /* Some of the firmwares have the size of the memory of the device |
| @@ -3982,21 +3982,26 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { · 3981 unmodified lines | ||
| 3982 | 3982 | .get_memdump = brcmf_sdio_bus_get_memdump, |
| 3983 | 3983 | }; |
| 3984 | 3984 | |
| 3985 | −static void brcmf_sdio_firmware_callback(struct device *dev, | |
| 3985 | +static void brcmf_sdio_firmware_callback(struct device *dev, int err, | |
| 3986 | 3986 | const struct firmware *code, |
| 3987 | 3987 | void *nvram, u32 nvram_len) |
| 3988 | 3988 | { |
| 3989 | − struct brcmf_bus *bus_if = dev_get_drvdata(dev); | |
| 3990 | − struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; | |
| 3991 | − struct brcmf_sdio *bus = sdiodev->bus; | |
| 3992 | − int err = 0; | |
| 3989 | + struct brcmf_bus *bus_if; | |
| 3990 | + struct brcmf_sdio_dev *sdiodev; | |
| 3991 | + struct brcmf_sdio *bus; | |
| 3993 | 3992 | u8 saveclk; |
| 3994 | 3993 | |
| 3995 | − brcmf_dbg(TRACE, "Enter: dev=%s\n", dev_name(dev)); | |
| 3994 | + brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); | |
| 3995 | + bus_if = dev_get_drvdata(dev); | |
| 3996 | + sdiodev = bus_if->bus_priv.sdio; | |
| 3997 | + if (err) | |
| 3998 | + goto fail; | |
| 3996 | 3999 | |
| 3997 | 4000 | if (!bus_if->drvr) |
| 3998 | 4001 | return; |
| 3999 | 4002 | |
| 4003 | + bus = sdiodev->bus; | |
| 4004 | + | |
| 4000 | 4005 | /* try to download image and nvram to the dongle */ |
| 4001 | 4006 | bus->alp_only = true; |
| 4002 | 4007 | err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len); |
| @@ -4083,6 +4088,7 @@ release: · 80 unmodified lines | ||
| 4083 | 4088 | fail: |
| 4084 | 4089 | brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); |
| 4085 | 4090 | device_release_driver(dev); |
| 4091 | + device_release_driver(&sdiodev->func[2]->dev); | |
| 4086 | 4092 | } |
| 4087 | 4093 | |
| 4088 | 4094 | struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) |
| @@ -1159,17 +1159,18 @@ fail: · 1158 unmodified lines | ||
| 1159 | 1159 | return ret; |
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | −static void brcmf_usb_probe_phase2(struct device *dev, | |
| 1162 | +static void brcmf_usb_probe_phase2(struct device *dev, int ret, | |
| 1163 | 1163 | const struct firmware *fw, |
| 1164 | 1164 | void *nvram, u32 nvlen) |
| 1165 | 1165 | { |
| 1166 | 1166 | struct brcmf_bus *bus = dev_get_drvdata(dev); |
| 1167 | − struct brcmf_usbdev_info *devinfo; | |
| 1168 | − int ret; | |
| 1167 | + struct brcmf_usbdev_info *devinfo = bus->bus_priv.usb->devinfo; | |
| 1168 | + | |
| 1169 | + if (ret) | |
| 1170 | + goto error; | |
| 1169 | 1171 | |
| 1170 | 1172 | brcmf_dbg(USB, "Start fw downloading\n"); |
| 1171 | 1173 | |
| 1172 | − devinfo = bus->bus_priv.usb->devinfo; | |
| 1173 | 1174 | ret = check_file(fw->data); |
| 1174 | 1175 | if (ret < 0) { |
| 1175 | 1176 | brcmf_err("invalid firmware\n"); |
| @@ -73,7 +73,7 @@ struct net_device * hostap_add_interface(struct local_info *local, · 72 unmodified lines | ||
| 73 | 73 | dev->mem_end = mdev->mem_end; |
| 74 | 74 | |
| 75 | 75 | hostap_setup_dev(dev, local, type); |
| 76 | − dev->destructor = free_netdev; | |
| 76 | + dev->needs_free_netdev = true; | |
| 77 | 77 | |
| 78 | 78 | sprintf(dev->name, "%s%s", prefix, name); |
| 79 | 79 | if (!rtnl_locked) |
| @@ -2861,7 +2861,7 @@ static const struct net_device_ops hwsim_netdev_ops = { · 2860 unmodified lines | ||
| 2861 | 2861 | static void hwsim_mon_setup(struct net_device *dev) |
| 2862 | 2862 | { |
| 2863 | 2863 | dev->netdev_ops = &hwsim_netdev_ops; |
| 2864 | − dev->destructor = free_netdev; | |
| 2864 | + dev->needs_free_netdev = true; | |
| 2865 | 2865 | ether_setup(dev); |
| 2866 | 2866 | dev->priv_flags |= IFF_NO_QUEUE; |
| 2867 | 2867 | dev->type = ARPHRD_IEEE80211_RADIOTAP; |
| @@ -1280,7 +1280,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, · 1279 unmodified lines | ||
| 1280 | 1280 | struct net_device *dev) |
| 1281 | 1281 | { |
| 1282 | 1282 | dev->netdev_ops = &mwifiex_netdev_ops; |
| 1283 | − dev->destructor = free_netdev; | |
| 1283 | + dev->needs_free_netdev = true; | |
| 1284 | 1284 | /* Initialize private structure */ |
| 1285 | 1285 | priv->current_key_index = 0; |
| 1286 | 1286 | priv->media_connected = false; |
| @@ -2878,7 +2878,7 @@ static const struct intel_ntb_reg skx_reg = { · 2877 unmodified lines | ||
| 2878 | 2878 | .link_is_up = xeon_link_is_up, |
| 2879 | 2879 | .db_ioread = skx_db_ioread, |
| 2880 | 2880 | .db_iowrite = skx_db_iowrite, |
| 2881 | − .db_size = sizeof(u64), | |
| 2881 | + .db_size = sizeof(u32), | |
| 2882 | 2882 | .ntb_ctl = SKX_NTBCNTL_OFFSET, |
| 2883 | 2883 | .mw_bar = {2, 4}, |
| 2884 | 2884 | }; |
| @@ -177,14 +177,12 @@ struct ntb_transport_qp { · 176 unmodified lines | ||
| 177 | 177 | u64 rx_err_ver; |
| 178 | 178 | u64 rx_memcpy; |
| 179 | 179 | u64 rx_async; |
| 180 | − u64 dma_rx_prep_err; | |
| 181 | 180 | u64 tx_bytes; |
| 182 | 181 | u64 tx_pkts; |
| 183 | 182 | u64 tx_ring_full; |
| 184 | 183 | u64 tx_err_no_buf; |
| 185 | 184 | u64 tx_memcpy; |
| 186 | 185 | u64 tx_async; |
| 187 | − u64 dma_tx_prep_err; | |
| 188 | 186 | }; |
| 189 | 187 | |
| 190 | 188 | struct ntb_transport_mw { |
| @@ -254,8 +252,6 @@ enum { · 63 unmodified lines | ||
| 254 | 252 | #define QP_TO_MW(nt, qp) ((qp) % nt->mw_count) |
| 255 | 253 | #define NTB_QP_DEF_NUM_ENTRIES 100 |
| 256 | 254 | #define NTB_LINK_DOWN_TIMEOUT 10 |
| 257 | −#define DMA_RETRIES 20 | |
| 258 | −#define DMA_OUT_RESOURCE_TO msecs_to_jiffies(50) | |
| 259 | 255 | |
| 260 | 256 | static void ntb_transport_rxc_db(unsigned long data); |
| 261 | 257 | static const struct ntb_ctx_ops ntb_transport_ops; |
| @@ -516,12 +512,6 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf, size_t count, · 254 unmodified lines | ||
| 516 | 512 | out_offset += snprintf(buf + out_offset, out_count - out_offset, |
| 517 | 513 | "free tx - \t%u\n", |
| 518 | 514 | ntb_transport_tx_free_entry(qp)); |
| 519 | − out_offset += snprintf(buf + out_offset, out_count - out_offset, | |
| 520 | − "DMA tx prep err - \t%llu\n", | |
| 521 | − qp->dma_tx_prep_err); | |
| 522 | − out_offset += snprintf(buf + out_offset, out_count - out_offset, | |
| 523 | − "DMA rx prep err - \t%llu\n", | |
| 524 | − qp->dma_rx_prep_err); | |
| 525 | 515 | |
| 526 | 516 | out_offset += snprintf(buf + out_offset, out_count - out_offset, |
| 527 | 517 | "\n"); |
| @@ -623,7 +613,7 @@ static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt, · 95 unmodified lines | ||
| 623 | 613 | if (!mw->virt_addr) |
| 624 | 614 | return -ENOMEM; |
| 625 | 615 | |
| 626 | − if (qp_count % mw_count && mw_num + 1 < qp_count / mw_count) | |
| 616 | + if (mw_num < qp_count % mw_count) | |
| 627 | 617 | num_qps_mw = qp_count / mw_count + 1; |
| 628 | 618 | else |
| 629 | 619 | num_qps_mw = qp_count / mw_count; |
| @@ -768,8 +758,6 @@ static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp) · 138 unmodified lines | ||
| 768 | 758 | qp->tx_err_no_buf = 0; |
| 769 | 759 | qp->tx_memcpy = 0; |
| 770 | 760 | qp->tx_async = 0; |
| 771 | − qp->dma_tx_prep_err = 0; | |
| 772 | − qp->dma_rx_prep_err = 0; | |
| 773 | 761 | } |
| 774 | 762 | |
| 775 | 763 | static void ntb_qp_link_cleanup(struct ntb_transport_qp *qp) |
| @@ -1000,7 +988,7 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, · 224 unmodified lines | ||
| 1000 | 988 | qp->event_handler = NULL; |
| 1001 | 989 | ntb_qp_link_down_reset(qp); |
| 1002 | 990 | |
| 1003 | − if (qp_count % mw_count && mw_num + 1 < qp_count / mw_count) | |
| 991 | + if (mw_num < qp_count % mw_count) | |
| 1004 | 992 | num_qps_mw = qp_count / mw_count + 1; |
| 1005 | 993 | else |
| 1006 | 994 | num_qps_mw = qp_count / mw_count; |
| @@ -1128,8 +1116,8 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev) · 121 unmodified lines | ||
| 1128 | 1116 | qp_count = ilog2(qp_bitmap); |
| 1129 | 1117 | if (max_num_clients && max_num_clients < qp_count) |
| 1130 | 1118 | qp_count = max_num_clients; |
| 1131 | − else if (mw_count < qp_count) | |
| 1132 | − qp_count = mw_count; | |
| 1119 | + else if (nt->mw_count < qp_count) | |
| 1120 | + qp_count = nt->mw_count; | |
| 1133 | 1121 | |
| 1134 | 1122 | qp_bitmap &= BIT_ULL(qp_count) - 1; |
| 1135 | 1123 | |
| @@ -1317,7 +1305,6 @@ static int ntb_async_rx_submit(struct ntb_queue_entry *entry, void *offset) · 181 unmodified lines | ||
| 1317 | 1305 | struct dmaengine_unmap_data *unmap; |
| 1318 | 1306 | dma_cookie_t cookie; |
| 1319 | 1307 | void *buf = entry->buf; |
| 1320 | − int retries = 0; | |
| 1321 | 1308 | |
| 1322 | 1309 | len = entry->len; |
| 1323 | 1310 | device = chan->device; |
| @@ -1346,22 +1333,11 @@ static int ntb_async_rx_submit(struct ntb_queue_entry *entry, void *offset) · 22 unmodified lines | ||
| 1346 | 1333 | |
| 1347 | 1334 | unmap->from_cnt = 1; |
| 1348 | 1335 | |
| 1349 | − for (retries = 0; retries < DMA_RETRIES; retries++) { | |
| 1350 | − txd = device->device_prep_dma_memcpy(chan, | |
| 1351 | − unmap->addr[1], | |
| 1352 | − unmap->addr[0], len, | |
| 1353 | − DMA_PREP_INTERRUPT); | |
| 1354 | − if (txd) | |
| 1355 | − break; | |
| 1356 | − | |
| 1357 | − set_current_state(TASK_INTERRUPTIBLE); | |
| 1358 | − schedule_timeout(DMA_OUT_RESOURCE_TO); | |
| 1359 | − } | |
| 1360 | − | |
| 1361 | − if (!txd) { | |
| 1362 | − qp->dma_rx_prep_err++; | |
| 1336 | + txd = device->device_prep_dma_memcpy(chan, unmap->addr[1], | |
| 1337 | + unmap->addr[0], len, | |
| 1338 | + DMA_PREP_INTERRUPT); | |
| 1339 | + if (!txd) | |
| 1363 | 1340 | goto err_get_unmap; |
| 1364 | − } | |
| 1365 | 1341 | |
| 1366 | 1342 | txd->callback_result = ntb_rx_copy_callback; |
| 1367 | 1343 | txd->callback_param = entry; |
| @@ -1606,7 +1582,6 @@ static int ntb_async_tx_submit(struct ntb_transport_qp *qp, · 238 unmodified lines | ||
| 1606 | 1582 | struct dmaengine_unmap_data *unmap; |
| 1607 | 1583 | dma_addr_t dest; |
| 1608 | 1584 | dma_cookie_t cookie; |
| 1609 | − int retries = 0; | |
| 1610 | 1585 | |
| 1611 | 1586 | device = chan->device; |
| 1612 | 1587 | dest = qp->tx_mw_phys + qp->tx_max_frame * entry->tx_index; |
| @@ -1628,21 +1603,10 @@ static int ntb_async_tx_submit(struct ntb_transport_qp *qp, · 15 unmodified lines | ||
| 1628 | 1603 | |
| 1629 | 1604 | unmap->to_cnt = 1; |
| 1630 | 1605 | |
| 1631 | − for (retries = 0; retries < DMA_RETRIES; retries++) { | |
| 1632 | − txd = device->device_prep_dma_memcpy(chan, dest, | |
| 1633 | − unmap->addr[0], len, | |
| 1634 | − DMA_PREP_INTERRUPT); | |
| 1635 | − if (txd) | |
| 1636 | − break; | |
| 1637 | − | |
| 1638 | − set_current_state(TASK_INTERRUPTIBLE); | |
| 1639 | − schedule_timeout(DMA_OUT_RESOURCE_TO); | |
| 1640 | − } | |
| 1641 | − | |
| 1642 | − if (!txd) { | |
| 1643 | − qp->dma_tx_prep_err++; | |
| 1606 | + txd = device->device_prep_dma_memcpy(chan, dest, unmap->addr[0], len, | |
| 1607 | + DMA_PREP_INTERRUPT); | |
| 1608 | + if (!txd) | |
| 1644 | 1609 | goto err_get_unmap; |
| 1645 | − } | |
| 1646 | 1610 | |
| 1647 | 1611 | txd->callback_result = ntb_tx_copy_callback; |
| 1648 | 1612 | txd->callback_param = entry; |
| @@ -90,11 +90,11 @@ MODULE_PARM_DESC(max_mw_size, "Limit size of large memory windows"); · 89 unmodified lines | ||
| 90 | 90 | |
| 91 | 91 | static unsigned int seg_order = 19; /* 512K */ |
| 92 | 92 | module_param(seg_order, uint, 0644); |
| 93 | −MODULE_PARM_DESC(seg_order, "size order [n^2] of buffer segment for testing"); | |
| 93 | +MODULE_PARM_DESC(seg_order, "size order [2^n] of buffer segment for testing"); | |
| 94 | 94 | |
| 95 | 95 | static unsigned int run_order = 32; /* 4G */ |
| 96 | 96 | module_param(run_order, uint, 0644); |
| 97 | −MODULE_PARM_DESC(run_order, "size order [n^2] of total data to transfer"); | |
| 97 | +MODULE_PARM_DESC(run_order, "size order [2^n] of total data to transfer"); | |
| 98 | 98 | |
| 99 | 99 | static bool use_dma; /* default to 0 */ |
| 100 | 100 | module_param(use_dma, bool, 0644); |
| @@ -896,7 +896,7 @@ int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) · 895 unmodified lines | ||
| 896 | 896 | { |
| 897 | 897 | if (pci_dev_is_disconnected(dev)) { |
| 898 | 898 | *val = ~0; |
| 899 | − return -ENODEV; | |
| 899 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 900 | 900 | } |
| 901 | 901 | return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); |
| 902 | 902 | } |
| @@ -906,7 +906,7 @@ int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) · 3 unmodified lines | ||
| 906 | 906 | { |
| 907 | 907 | if (pci_dev_is_disconnected(dev)) { |
| 908 | 908 | *val = ~0; |
| 909 | − return -ENODEV; | |
| 909 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 910 | 910 | } |
| 911 | 911 | return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); |
| 912 | 912 | } |
| @@ -917,7 +917,7 @@ int pci_read_config_dword(const struct pci_dev *dev, int where, · 4 unmodified lines | ||
| 917 | 917 | { |
| 918 | 918 | if (pci_dev_is_disconnected(dev)) { |
| 919 | 919 | *val = ~0; |
| 920 | − return -ENODEV; | |
| 920 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 921 | 921 | } |
| 922 | 922 | return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); |
| 923 | 923 | } |
| @@ -926,7 +926,7 @@ EXPORT_SYMBOL(pci_read_config_dword); · 2 unmodified lines | ||
| 926 | 926 | int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val) |
| 927 | 927 | { |
| 928 | 928 | if (pci_dev_is_disconnected(dev)) |
| 929 | − return -ENODEV; | |
| 929 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 930 | 930 | return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); |
| 931 | 931 | } |
| 932 | 932 | EXPORT_SYMBOL(pci_write_config_byte); |
| @@ -934,7 +934,7 @@ EXPORT_SYMBOL(pci_write_config_byte); · 1 unmodified line | ||
| 934 | 934 | int pci_write_config_word(const struct pci_dev *dev, int where, u16 val) |
| 935 | 935 | { |
| 936 | 936 | if (pci_dev_is_disconnected(dev)) |
| 937 | − return -ENODEV; | |
| 937 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 938 | 938 | return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); |
| 939 | 939 | } |
| 940 | 940 | EXPORT_SYMBOL(pci_write_config_word); |
| @@ -943,7 +943,7 @@ int pci_write_config_dword(const struct pci_dev *dev, int where, · 2 unmodified lines | ||
| 943 | 943 | u32 val) |
| 944 | 944 | { |
| 945 | 945 | if (pci_dev_is_disconnected(dev)) |
| 946 | − return -ENODEV; | |
| 946 | + return PCIBIOS_DEVICE_NOT_FOUND; | |
| 947 | 947 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
| 948 | 948 | } |
| 949 | 949 | EXPORT_SYMBOL(pci_write_config_dword); |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | config PCI_EPF_TEST |
| 6 | 6 | tristate "PCI Endpoint Test driver" |
| 7 | 7 | depends on PCI_ENDPOINT |
| 8 | + select CRC32 | |
| 8 | 9 | help |
| 9 | 10 | Enable this configuration option to enable the test driver |
| 10 | 11 | for PCI Endpoint. |
| @@ -495,64 +495,54 @@ static struct irq_chip amd_gpio_irqchip = { · 494 unmodified lines | ||
| 495 | 495 | .flags = IRQCHIP_SKIP_SET_WAKE, |
| 496 | 496 | }; |
| 497 | 497 | |
| 498 | −static void amd_gpio_irq_handler(struct irq_desc *desc) | |
| 498 | +#define PIN_IRQ_PENDING (BIT(INTERRUPT_STS_OFF) | BIT(WAKE_STS_OFF)) | |
| 499 | + | |
| 500 | +static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) | |
| 499 | 501 | { |
| 500 | − u32 i; | |
| 501 | − u32 off; | |
| 502 | − u32 reg; | |
| 503 | − u32 pin_reg; | |
| 504 | − u64 reg64; | |
| 505 | − int handled = 0; | |
| 506 | − unsigned int irq; | |
| 502 | + struct amd_gpio *gpio_dev = dev_id; | |
| 503 | + struct gpio_chip *gc = &gpio_dev->gc; | |
| 504 | + irqreturn_t ret = IRQ_NONE; | |
| 505 | + unsigned int i, irqnr; | |
| 507 | 506 | unsigned long flags; |
| 508 | − struct irq_chip *chip = irq_desc_get_chip(desc); | |
| 509 | − struct gpio_chip *gc = irq_desc_get_handler_data(desc); | |
| 510 | − struct amd_gpio *gpio_dev = gpiochip_get_data(gc); | |
| 507 | + u32 *regs, regval; | |
| 508 | + u64 status, mask; | |
| 511 | 509 | |
| 512 | − chained_irq_enter(chip, desc); | |
| 513 | − /*enable GPIO interrupt again*/ | |
| 510 | + /* Read the wake status */ | |
| 514 | 511 | raw_spin_lock_irqsave(&gpio_dev->lock, flags); |
| 515 | − reg = readl(gpio_dev->base + WAKE_INT_STATUS_REG1); | |
| 516 | − reg64 = reg; | |
| 517 | − reg64 = reg64 << 32; | |
| 518 | − | |
| 519 | − reg = readl(gpio_dev->base + WAKE_INT_STATUS_REG0); | |
| 520 | − reg64 |= reg; | |
| 512 | + status = readl(gpio_dev->base + WAKE_INT_STATUS_REG1); | |
| 513 | + status <<= 32; | |
| 514 | + status |= readl(gpio_dev->base + WAKE_INT_STATUS_REG0); | |
| 521 | 515 | raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); |
| 522 | 516 | |
| 523 | − /* | |
| 524 | − * first 46 bits indicates interrupt status. | |
| 525 | − * one bit represents four interrupt sources. | |
| 526 | − */ | |
| 527 | − for (off = 0; off < 46 ; off++) { | |
| 528 | − if (reg64 & BIT(off)) { | |
| 529 | − for (i = 0; i < 4; i++) { | |
| 530 | − pin_reg = readl(gpio_dev->base + | |
| 531 | − (off * 4 + i) * 4); | |
| 532 | − if ((pin_reg & BIT(INTERRUPT_STS_OFF)) || | |
| 533 | − (pin_reg & BIT(WAKE_STS_OFF))) { | |
| 534 | − irq = irq_find_mapping(gc->irqdomain, | |
| 535 | − off * 4 + i); | |
| 536 | − generic_handle_irq(irq); | |
| 537 | − writel(pin_reg, | |
| 538 | − gpio_dev->base | |
| 539 | − + (off * 4 + i) * 4); | |
| 540 | − handled++; | |
| 541 | − } | |
| 542 | − } | |
| 517 | + /* Bit 0-45 contain the relevant status bits */ | |
| 518 | + status &= (1ULL << 46) - 1; | |
| 519 | + regs = gpio_dev->base; | |
| 520 | + for (mask = 1, irqnr = 0; status; mask <<= 1, regs += 4, irqnr += 4) { | |
| 521 | + if (!(status & mask)) | |
| 522 | + continue; | |
| 523 | + status &= ~mask; | |
| 524 | + | |
| 525 | + /* Each status bit covers four pins */ | |
| 526 | + for (i = 0; i < 4; i++) { | |
| 527 | + regval = readl(regs + i); | |
| 528 | + if (!(regval & PIN_IRQ_PENDING)) | |
| 529 | + continue; | |
| 530 | + irq = irq_find_mapping(gc->irqdomain, irqnr + i); | |
| 531 | + generic_handle_irq(irq); | |
| 532 | + /* Clear interrupt */ | |
| 533 | + writel(regval, regs + i); | |
| 534 | + ret = IRQ_HANDLED; | |
| 543 | 535 | } |
| 544 | 536 | } |
| 545 | 537 | |
| 546 | − if (handled == 0) | |
| 547 | − handle_bad_irq(desc); | |
| 548 | − | |
| 538 | + /* Signal EOI to the GPIO unit */ | |
| 549 | 539 | raw_spin_lock_irqsave(&gpio_dev->lock, flags); |
| 550 | − reg = readl(gpio_dev->base + WAKE_INT_MASTER_REG); | |
| 551 | − reg |= EOI_MASK; | |
| 552 | − writel(reg, gpio_dev->base + WAKE_INT_MASTER_REG); | |
| 540 | + regval = readl(gpio_dev->base + WAKE_INT_MASTER_REG); | |
| 541 | + regval |= EOI_MASK; | |
| 542 | + writel(regval, gpio_dev->base + WAKE_INT_MASTER_REG); | |
| 553 | 543 | raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); |
| 554 | 544 | |
| 555 | − chained_irq_exit(chip, desc); | |
| 545 | + return ret; | |
| 556 | 546 | } |
| 557 | 547 | |
| 558 | 548 | static int amd_get_groups_count(struct pinctrl_dev *pctldev) |
| @@ -821,10 +811,11 @@ static int amd_gpio_probe(struct platform_device *pdev) · 262 unmodified lines | ||
| 821 | 811 | goto out2; |
| 822 | 812 | } |
| 823 | 813 | |
| 824 | − gpiochip_set_chained_irqchip(&gpio_dev->gc, | |
| 825 | − &amd_gpio_irqchip, | |
| 826 | − irq_base, | |
| 827 | − amd_gpio_irq_handler); | |
| 814 | + ret = devm_request_irq(&pdev->dev, irq_base, amd_gpio_irq_handler, 0, | |
| 815 | + KBUILD_MODNAME, gpio_dev); | |
| 816 | + if (ret) | |
| 817 | + goto out2; | |
| 818 | + | |
| 828 | 819 | platform_set_drvdata(pdev, gpio_dev); |
| 829 | 820 | |
| 830 | 821 | dev_dbg(&pdev->dev, "amd gpio driver loaded\n"); |
| @@ -798,7 +798,7 @@ static int stm32_pconf_parse_conf(struct pinctrl_dev *pctldev, · 797 unmodified lines | ||
| 798 | 798 | break; |
| 799 | 799 | case PIN_CONFIG_OUTPUT: |
| 800 | 800 | __stm32_gpio_set(bank, offset, arg); |
| 801 | − ret = stm32_pmx_gpio_set_direction(pctldev, NULL, pin, false); | |
| 801 | + ret = stm32_pmx_gpio_set_direction(pctldev, range, pin, false); | |
| 802 | 802 | break; |
| 803 | 803 | default: |
| 804 | 804 | ret = -EINVAL; |
| @@ -97,11 +97,9 @@ · 96 unmodified lines | ||
| 97 | 97 | } \ |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | −#ifdef CONFIG_PM_SLEEP | |
| 101 | 100 | static u8 suspend_prep_ok; |
| 102 | 101 | static u32 suspend_shlw_ctr_temp, suspend_deep_ctr_temp; |
| 103 | 102 | static u64 suspend_shlw_res_temp, suspend_deep_res_temp; |
| 104 | −#endif | |
| 105 | 103 | |
| 106 | 104 | struct telemetry_susp_stats { |
| 107 | 105 | u32 shlw_swake_ctr; |
| @@ -807,7 +805,6 @@ static const struct file_operations telem_ioss_trc_verb_ops = { · 699 unmodified lines | ||
| 807 | 805 | .release = single_release, |
| 808 | 806 | }; |
| 809 | 807 | |
| 810 | −#ifdef CONFIG_PM_SLEEP | |
| 811 | 808 | static int pm_suspend_prep_cb(void) |
| 812 | 809 | { |
| 813 | 810 | struct telemetry_evtlog evtlog[TELEM_MAX_OS_ALLOCATED_EVENTS]; |
| @@ -937,7 +934,6 @@ static int pm_notification(struct notifier_block *this, · 123 unmodified lines | ||
| 937 | 934 | static struct notifier_block pm_notifier = { |
| 938 | 935 | .notifier_call = pm_notification, |
| 939 | 936 | }; |
| 940 | −#endif /* CONFIG_PM_SLEEP */ | |
| 941 | 937 | |
| 942 | 938 | static int __init telemetry_debugfs_init(void) |
| 943 | 939 | { |
| @@ -960,14 +956,13 @@ static int __init telemetry_debugfs_init(void) · 16 unmodified lines | ||
| 960 | 956 | if (err < 0) |
| 961 | 957 | return -EINVAL; |
| 962 | 958 | |
| 963 | − | |
| 964 | −#ifdef CONFIG_PM_SLEEP | |
| 965 | 959 | register_pm_notifier(&pm_notifier); |
| 966 | −#endif /* CONFIG_PM_SLEEP */ | |
| 967 | 960 | |
| 968 | 961 | debugfs_conf->telemetry_dbg_dir = debugfs_create_dir("telemetry", NULL); |
| 969 | − if (!debugfs_conf->telemetry_dbg_dir) | |
| 970 | − return -ENOMEM; | |
| 962 | + if (!debugfs_conf->telemetry_dbg_dir) { | |
| 963 | + err = -ENOMEM; | |
| 964 | + goto out_pm; | |
| 965 | + } | |
| 971 | 966 | |
| 972 | 967 | f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO, |
| 973 | 968 | debugfs_conf->telemetry_dbg_dir, NULL, |
| @@ -1014,6 +1009,8 @@ static int __init telemetry_debugfs_init(void) · 40 unmodified lines | ||
| 1014 | 1009 | out: |
| 1015 | 1010 | debugfs_remove_recursive(debugfs_conf->telemetry_dbg_dir); |
| 1016 | 1011 | debugfs_conf->telemetry_dbg_dir = NULL; |
| 1012 | +out_pm: | |
| 1013 | + unregister_pm_notifier(&pm_notifier); | |
| 1017 | 1014 | |
| 1018 | 1015 | return err; |
| 1019 | 1016 | } |
| @@ -1022,6 +1019,7 @@ static void __exit telemetry_debugfs_exit(void) · 2 unmodified lines | ||
| 1022 | 1019 | { |
| 1023 | 1020 | debugfs_remove_recursive(debugfs_conf->telemetry_dbg_dir); |
| 1024 | 1021 | debugfs_conf->telemetry_dbg_dir = NULL; |
| 1022 | + unregister_pm_notifier(&pm_notifier); | |
| 1025 | 1023 | } |
| 1026 | 1024 | |
| 1027 | 1025 | late_initcall(telemetry_debugfs_init); |
| @@ -70,14 +70,14 @@ static ssize_t name_show(struct kobject *kobj, struct device *dev, char *buf) · 69 unmodified lines | ||
| 70 | 70 | { |
| 71 | 71 | return sprintf(buf, "I/O subchannel (Non-QDIO)\n"); |
| 72 | 72 | } |
| 73 | −MDEV_TYPE_ATTR_RO(name); | |
| 73 | +static MDEV_TYPE_ATTR_RO(name); | |
| 74 | 74 | |
| 75 | 75 | static ssize_t device_api_show(struct kobject *kobj, struct device *dev, |
| 76 | 76 | char *buf) |
| 77 | 77 | { |
| 78 | 78 | return sprintf(buf, "%s\n", VFIO_DEVICE_API_CCW_STRING); |
| 79 | 79 | } |
| 80 | −MDEV_TYPE_ATTR_RO(device_api); | |
| 80 | +static MDEV_TYPE_ATTR_RO(device_api); | |
| 81 | 81 | |
| 82 | 82 | static ssize_t available_instances_show(struct kobject *kobj, |
| 83 | 83 | struct device *dev, char *buf) |
| @@ -86,7 +86,7 @@ static ssize_t available_instances_show(struct kobject *kobj, · 2 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | return sprintf(buf, "%d\n", atomic_read(&private->avail)); |
| 88 | 88 | } |
| 89 | −MDEV_TYPE_ATTR_RO(available_instances); | |
| 89 | +static MDEV_TYPE_ATTR_RO(available_instances); | |
| 90 | 90 | |
| 91 | 91 | static struct attribute *mdev_types_attrs[] = { |
| 92 | 92 | &mdev_type_attr_name.attr, |
| @@ -100,7 +100,7 @@ static struct attribute_group mdev_type_group = { · 7 unmodified lines | ||
| 100 | 100 | .attrs = mdev_types_attrs, |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | −struct attribute_group *mdev_type_groups[] = { | |
| 103 | +static struct attribute_group *mdev_type_groups[] = { | |
| 104 | 104 | &mdev_type_group, |
| 105 | 105 | NULL, |
| 106 | 106 | }; |
| @@ -152,7 +152,7 @@ static int vfio_ccw_mdev_open(struct mdev_device *mdev) · 45 unmodified lines | ||
| 152 | 152 | &events, &private->nb); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | −void vfio_ccw_mdev_release(struct mdev_device *mdev) | |
| 155 | +static void vfio_ccw_mdev_release(struct mdev_device *mdev) | |
| 156 | 156 | { |
| 157 | 157 | struct vfio_ccw_private *private = |
| 158 | 158 | dev_get_drvdata(mdev_parent_dev(mdev)); |
| @@ -233,7 +233,7 @@ static int vfio_ccw_mdev_get_region_info(struct vfio_region_info *info, · 74 unmodified lines | ||
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | −int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info) | |
| 236 | +static int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info) | |
| 237 | 237 | { |
| 238 | 238 | if (info->index != VFIO_CCW_IO_IRQ_INDEX) |
| 239 | 239 | return -EINVAL; |
| @@ -668,10 +668,28 @@ static int ap_device_probe(struct device *dev) · 667 unmodified lines | ||
| 668 | 668 | struct ap_driver *ap_drv = to_ap_drv(dev->driver); |
| 669 | 669 | int rc; |
| 670 | 670 | |
| 671 | + /* Add queue/card to list of active queues/cards */ | |
| 672 | + spin_lock_bh(&ap_list_lock); | |
| 673 | + if (is_card_dev(dev)) | |
| 674 | + list_add(&to_ap_card(dev)->list, &ap_card_list); | |
| 675 | + else | |
| 676 | + list_add(&to_ap_queue(dev)->list, | |
| 677 | + &to_ap_queue(dev)->card->queues); | |
| 678 | + spin_unlock_bh(&ap_list_lock); | |
| 679 | + | |
| 671 | 680 | ap_dev->drv = ap_drv; |
| 672 | 681 | rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; |
| 673 | − if (rc) | |
| 682 | + | |
| 683 | + if (rc) { | |
| 684 | + spin_lock_bh(&ap_list_lock); | |
| 685 | + if (is_card_dev(dev)) | |
| 686 | + list_del_init(&to_ap_card(dev)->list); | |
| 687 | + else | |
| 688 | + list_del_init(&to_ap_queue(dev)->list); | |
| 689 | + spin_unlock_bh(&ap_list_lock); | |
| 674 | 690 | ap_dev->drv = NULL; |
| 691 | + } | |
| 692 | + | |
| 675 | 693 | return rc; |
| 676 | 694 | } |
| 677 | 695 | |
| @@ -680,14 +698,17 @@ static int ap_device_remove(struct device *dev) · 2 unmodified lines | ||
| 680 | 698 | struct ap_device *ap_dev = to_ap_dev(dev); |
| 681 | 699 | struct ap_driver *ap_drv = ap_dev->drv; |
| 682 | 700 | |
| 701 | + if (ap_drv->remove) | |
| 702 | + ap_drv->remove(ap_dev); | |
| 703 | + | |
| 704 | + /* Remove queue/card from list of active queues/cards */ | |
| 683 | 705 | spin_lock_bh(&ap_list_lock); |
| 684 | 706 | if (is_card_dev(dev)) |
| 685 | 707 | list_del_init(&to_ap_card(dev)->list); |
| 686 | 708 | else |
| 687 | 709 | list_del_init(&to_ap_queue(dev)->list); |
| 688 | 710 | spin_unlock_bh(&ap_list_lock); |
| 689 | − if (ap_drv->remove) | |
| 690 | − ap_drv->remove(ap_dev); | |
| 711 | + | |
| 691 | 712 | return 0; |
| 692 | 713 | } |
| 693 | 714 | |
| @@ -1056,10 +1077,6 @@ static void ap_scan_bus(struct work_struct *unused) · 362 unmodified lines | ||
| 1056 | 1077 | } |
| 1057 | 1078 | /* get it and thus adjust reference counter */ |
| 1058 | 1079 | get_device(&ac->ap_dev.device); |
| 1059 | − /* Add card device to card list */ | |
| 1060 | − spin_lock_bh(&ap_list_lock); | |
| 1061 | − list_add(&ac->list, &ap_card_list); | |
| 1062 | − spin_unlock_bh(&ap_list_lock); | |
| 1063 | 1080 | } |
| 1064 | 1081 | /* now create the new queue device */ |
| 1065 | 1082 | aq = ap_queue_create(qid, type); |
| @@ -1070,10 +1087,6 @@ static void ap_scan_bus(struct work_struct *unused) · 4 unmodified lines | ||
| 1070 | 1087 | aq->ap_dev.device.parent = &ac->ap_dev.device; |
| 1071 | 1088 | dev_set_name(&aq->ap_dev.device, |
| 1072 | 1089 | "%02x.%04x", id, dom); |
| 1073 | − /* Add queue device to card queue list */ | |
| 1074 | − spin_lock_bh(&ap_list_lock); | |
| 1075 | − list_add(&aq->list, &ac->queues); | |
| 1076 | − spin_unlock_bh(&ap_list_lock); | |
| 1077 | 1090 | /* Start with a device reset */ |
| 1078 | 1091 | spin_lock_bh(&aq->lock); |
| 1079 | 1092 | ap_wait(ap_sm_event(aq, AP_EVENT_POLL)); |
| @@ -1081,9 +1094,6 @@ static void ap_scan_bus(struct work_struct *unused) · 1 unmodified line | ||
| 1081 | 1094 | /* Register device */ |
| 1082 | 1095 | rc = device_register(&aq->ap_dev.device); |
| 1083 | 1096 | if (rc) { |
| 1084 | − spin_lock_bh(&ap_list_lock); | |
| 1085 | − list_del_init(&aq->list); | |
| 1086 | − spin_unlock_bh(&ap_list_lock); | |
| 1087 | 1097 | put_device(&aq->ap_dev.device); |
| 1088 | 1098 | continue; |
| 1089 | 1099 | } |
| @@ -160,7 +160,14 @@ static struct device_type ap_card_type = { · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | static void ap_card_device_release(struct device *dev) |
| 162 | 162 | { |
| 163 | − kfree(to_ap_card(dev)); | |
| 163 | + struct ap_card *ac = to_ap_card(dev); | |
| 164 | + | |
| 165 | + if (!list_empty(&ac->list)) { | |
| 166 | + spin_lock_bh(&ap_list_lock); | |
| 167 | + list_del_init(&ac->list); | |
| 168 | + spin_unlock_bh(&ap_list_lock); | |
| 169 | + } | |
| 170 | + kfree(ac); | |
| 164 | 171 | } |
| 165 | 172 | |
| 166 | 173 | struct ap_card *ap_card_create(int id, int queue_depth, int device_type, |
| @@ -584,7 +584,14 @@ static struct device_type ap_queue_type = { · 583 unmodified lines | ||
| 584 | 584 | |
| 585 | 585 | static void ap_queue_device_release(struct device *dev) |
| 586 | 586 | { |
| 587 | − kfree(to_ap_queue(dev)); | |
| 587 | + struct ap_queue *aq = to_ap_queue(dev); | |
| 588 | + | |
| 589 | + if (!list_empty(&aq->list)) { | |
| 590 | + spin_lock_bh(&ap_list_lock); | |
| 591 | + list_del_init(&aq->list); | |
| 592 | + spin_unlock_bh(&ap_list_lock); | |
| 593 | + } | |
| 594 | + kfree(aq); | |
| 588 | 595 | } |
| 589 | 596 | |
| 590 | 597 | struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type) |
| @@ -1954,7 +1954,6 @@ static void netiucv_free_netdevice(struct net_device *dev) · 1953 unmodified lines | ||
| 1954 | 1954 | privptr->conn = NULL; privptr->fsm = NULL; |
| 1955 | 1955 | /* privptr gets freed by free_netdev() */ |
| 1956 | 1956 | } |
| 1957 | − free_netdev(dev); | |
| 1958 | 1957 | } |
| 1959 | 1958 | |
| 1960 | 1959 | /** |
| @@ -1972,7 +1971,8 @@ static void netiucv_setup_netdevice(struct net_device *dev) · 11 unmodified lines | ||
| 1972 | 1971 | dev->mtu = NETIUCV_MTU_DEFAULT; |
| 1973 | 1972 | dev->min_mtu = 576; |
| 1974 | 1973 | dev->max_mtu = NETIUCV_MTU_MAX; |
| 1975 | − dev->destructor = netiucv_free_netdevice; | |
| 1974 | + dev->needs_free_netdev = true; | |
| 1975 | + dev->priv_destructor = netiucv_free_netdevice; | |
| 1976 | 1976 | dev->hard_header_len = NETIUCV_HDRLEN; |
| 1977 | 1977 | dev->addr_len = 0; |
| 1978 | 1978 | dev->type = ARPHRD_SLIP; |
| @@ -870,7 +870,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, · 869 unmodified lines | ||
| 870 | 870 | QEDI_ERR(&qedi->dbg_ctx, |
| 871 | 871 | "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x, task=%p\n", |
| 872 | 872 | protoitt, cqe->itid, qedi_conn->iscsi_conn_id, task); |
| 873 | − WARN_ON(1); | |
| 874 | 873 | } |
| 875 | 874 | } |
| 876 | 875 | |
| @@ -1499,11 +1499,9 @@ err_idx: · 1498 unmodified lines | ||
| 1499 | 1499 | |
| 1500 | 1500 | void qedi_clear_task_idx(struct qedi_ctx *qedi, int idx) |
| 1501 | 1501 | { |
| 1502 | − if (!test_and_clear_bit(idx, qedi->task_idx_map)) { | |
| 1502 | + if (!test_and_clear_bit(idx, qedi->task_idx_map)) | |
| 1503 | 1503 | QEDI_ERR(&qedi->dbg_ctx, |
| 1504 | 1504 | "FW task context, already cleared, tid=0x%x\n", idx); |
| 1505 | − WARN_ON(1); | |
| 1506 | − } | |
| 1507 | 1505 | } |
| 1508 | 1506 | |
| 1509 | 1507 | void qedi_update_itt_map(struct qedi_ctx *qedi, u32 tid, u32 proto_itt, |
| @@ -231,16 +231,12 @@ static int ad7152_write_raw_samp_freq(struct device *dev, int val) · 230 unmodified lines | ||
| 231 | 231 | if (i >= ARRAY_SIZE(ad7152_filter_rate_table)) |
| 232 | 232 | i = ARRAY_SIZE(ad7152_filter_rate_table) - 1; |
| 233 | 233 | |
| 234 | − mutex_lock(&chip->state_lock); | |
| 235 | 234 | ret = i2c_smbus_write_byte_data(chip->client, |
| 236 | 235 | AD7152_REG_CFG2, AD7152_CFG2_OSR(i)); |
| 237 | − if (ret < 0) { | |
| 238 | − mutex_unlock(&chip->state_lock); | |
| 236 | + if (ret < 0) | |
| 239 | 237 | return ret; |
| 240 | − } | |
| 241 | 238 | |
| 242 | 239 | chip->filter_rate_setup = i; |
| 243 | − mutex_unlock(&chip->state_lock); | |
| 244 | 240 | |
| 245 | 241 | return ret; |
| 246 | 242 | } |
| @@ -152,7 +152,7 @@ static const struct net_device_ops mon_netdev_ops = { · 151 unmodified lines | ||
| 152 | 152 | static void mon_setup(struct net_device *dev) |
| 153 | 153 | { |
| 154 | 154 | dev->netdev_ops = &mon_netdev_ops; |
| 155 | − dev->destructor = free_netdev; | |
| 155 | + dev->needs_free_netdev = true; | |
| 156 | 156 | ether_setup(dev); |
| 157 | 157 | dev->priv_flags |= IFF_NO_QUEUE; |
| 158 | 158 | dev->type = ARPHRD_IEEE80211; |
| @@ -2667,7 +2667,8 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st · 2666 unmodified lines | ||
| 2667 | 2667 | mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; |
| 2668 | 2668 | strncpy(mon_ndev->name, name, IFNAMSIZ); |
| 2669 | 2669 | mon_ndev->name[IFNAMSIZ - 1] = 0; |
| 2670 | − mon_ndev->destructor = rtw_ndev_destructor; | |
| 2670 | + mon_ndev->needs_free_netdev = true; | |
| 2671 | + mon_ndev->priv_destructor = rtw_ndev_destructor; | |
| 2671 | 2672 | |
| 2672 | 2673 | mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops; |
| 2673 | 2674 | |
| @@ -1207,8 +1207,6 @@ void rtw_ndev_destructor(struct net_device *ndev) · 1206 unmodified lines | ||
| 1207 | 1207 | |
| 1208 | 1208 | if (ndev->ieee80211_ptr) |
| 1209 | 1209 | kfree((u8 *)ndev->ieee80211_ptr); |
| 1210 | − | |
| 1211 | − free_netdev(ndev); | |
| 1212 | 1210 | } |
| 1213 | 1211 | |
| 1214 | 1212 | void rtw_dev_unload(struct adapter *padapter) |
| @@ -160,7 +160,7 @@ static int isFileReadable(char *path) · 159 unmodified lines | ||
| 160 | 160 | oldfs = get_fs(); set_fs(get_ds()); |
| 161 | 161 | |
| 162 | 162 | if (1!=readFile(fp, &buf, 1)) |
| 163 | − ret = PTR_ERR(fp); | |
| 163 | + ret = -EINVAL; | |
| 164 | 164 | |
| 165 | 165 | set_fs(oldfs); |
| 166 | 166 | filp_close(fp, NULL); |
| @@ -1279,6 +1279,18 @@ iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, · 1278 unmodified lines | ||
| 1279 | 1279 | */ |
| 1280 | 1280 | if (dump_payload) |
| 1281 | 1281 | goto after_immediate_data; |
| 1282 | + /* | |
| 1283 | + * Check for underflow case where both EDTL and immediate data payload | |
| 1284 | + * exceeds what is presented by CDB's TRANSFER LENGTH, and what has | |
| 1285 | + * already been set in target_cmd_size_check() as se_cmd->data_length. | |
| 1286 | + * | |
| 1287 | + * For this special case, fail the command and dump the immediate data | |
| 1288 | + * payload. | |
| 1289 | + */ | |
| 1290 | + if (cmd->first_burst_len > cmd->se_cmd.data_length) { | |
| 1291 | + cmd->sense_reason = TCM_INVALID_CDB_FIELD; | |
| 1292 | + goto after_immediate_data; | |
| 1293 | + } | |
| 1282 | 1294 | |
| 1283 | 1295 | immed_ret = iscsit_handle_immediate_data(cmd, hdr, |
| 1284 | 1296 | cmd->first_burst_len); |
| @@ -4423,8 +4435,11 @@ static void iscsit_logout_post_handler_closesession( · 3138 unmodified lines | ||
| 4423 | 4435 | * always sleep waiting for RX/TX thread shutdown to complete |
| 4424 | 4436 | * within iscsit_close_connection(). |
| 4425 | 4437 | */ |
| 4426 | − if (!conn->conn_transport->rdma_shutdown) | |
| 4438 | + if (!conn->conn_transport->rdma_shutdown) { | |
| 4427 | 4439 | sleep = cmpxchg(&conn->tx_thread_active, true, false); |
| 4440 | + if (!sleep) | |
| 4441 | + return; | |
| 4442 | + } | |
| 4428 | 4443 | |
| 4429 | 4444 | atomic_set(&conn->conn_logout_remove, 0); |
| 4430 | 4445 | complete(&conn->conn_logout_comp); |
| @@ -4440,8 +4455,11 @@ static void iscsit_logout_post_handler_samecid( · 9 unmodified lines | ||
| 4440 | 4455 | { |
| 4441 | 4456 | int sleep = 1; |
| 4442 | 4457 | |
| 4443 | − if (!conn->conn_transport->rdma_shutdown) | |
| 4458 | + if (!conn->conn_transport->rdma_shutdown) { | |
| 4444 | 4459 | sleep = cmpxchg(&conn->tx_thread_active, true, false); |
| 4460 | + if (!sleep) | |
| 4461 | + return; | |
| 4462 | + } | |
| 4445 | 4463 | |
| 4446 | 4464 | atomic_set(&conn->conn_logout_remove, 0); |
| 4447 | 4465 | complete(&conn->conn_logout_comp); |
| @@ -136,7 +136,7 @@ int init_se_kmem_caches(void); · 135 unmodified lines | ||
| 136 | 136 | void release_se_kmem_caches(void); |
| 137 | 137 | u32 scsi_get_new_index(scsi_index_t); |
| 138 | 138 | void transport_subsystem_check_init(void); |
| 139 | −void transport_cmd_finish_abort(struct se_cmd *, int); | |
| 139 | +int transport_cmd_finish_abort(struct se_cmd *, int); | |
| 140 | 140 | unsigned char *transport_dump_cmd_direction(struct se_cmd *); |
| 141 | 141 | void transport_dump_dev_state(struct se_device *, char *, int *); |
| 142 | 142 | void transport_dump_dev_info(struct se_device *, struct se_lun *, |
| @@ -75,7 +75,7 @@ void core_tmr_release_req(struct se_tmr_req *tmr) · 74 unmodified lines | ||
| 75 | 75 | kfree(tmr); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | −static void core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas) | |
| 78 | +static int core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas) | |
| 79 | 79 | { |
| 80 | 80 | unsigned long flags; |
| 81 | 81 | bool remove = true, send_tas; |
| @@ -91,7 +91,7 @@ static void core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas) · 9 unmodified lines | ||
| 91 | 91 | transport_send_task_abort(cmd); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | − transport_cmd_finish_abort(cmd, remove); | |
| 94 | + return transport_cmd_finish_abort(cmd, remove); | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | static int target_check_cdb_and_preempt(struct list_head *list, |
| @@ -184,8 +184,8 @@ void core_tmr_abort_task( · 86 unmodified lines | ||
| 184 | 184 | cancel_work_sync(&se_cmd->work); |
| 185 | 185 | transport_wait_for_tasks(se_cmd); |
| 186 | 186 | |
| 187 | − transport_cmd_finish_abort(se_cmd, true); | |
| 188 | − target_put_sess_cmd(se_cmd); | |
| 187 | + if (!transport_cmd_finish_abort(se_cmd, true)) | |
| 188 | + target_put_sess_cmd(se_cmd); | |
| 189 | 189 | |
| 190 | 190 | printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for" |
| 191 | 191 | " ref_tag: %llu\n", ref_tag); |
| @@ -281,8 +281,8 @@ static void core_tmr_drain_tmr_list( · 89 unmodified lines | ||
| 281 | 281 | cancel_work_sync(&cmd->work); |
| 282 | 282 | transport_wait_for_tasks(cmd); |
| 283 | 283 | |
| 284 | − transport_cmd_finish_abort(cmd, 1); | |
| 285 | − target_put_sess_cmd(cmd); | |
| 284 | + if (!transport_cmd_finish_abort(cmd, 1)) | |
| 285 | + target_put_sess_cmd(cmd); | |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| @@ -380,8 +380,8 @@ static void core_tmr_drain_state_list( · 91 unmodified lines | ||
| 380 | 380 | cancel_work_sync(&cmd->work); |
| 381 | 381 | transport_wait_for_tasks(cmd); |
| 382 | 382 | |
| 383 | − core_tmr_handle_tas_abort(cmd, tas); | |
| 384 | − target_put_sess_cmd(cmd); | |
| 383 | + if (!core_tmr_handle_tas_abort(cmd, tas)) | |
| 384 | + target_put_sess_cmd(cmd); | |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
| @@ -651,9 +651,10 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd) · 650 unmodified lines | ||
| 651 | 651 | percpu_ref_put(&lun->lun_ref); |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | −void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) | |
| 654 | +int transport_cmd_finish_abort(struct se_cmd *cmd, int remove) | |
| 655 | 655 | { |
| 656 | 656 | bool ack_kref = (cmd->se_cmd_flags & SCF_ACK_KREF); |
| 657 | + int ret = 0; | |
| 657 | 658 | |
| 658 | 659 | if (cmd->se_cmd_flags & SCF_SE_LUN_CMD) |
| 659 | 660 | transport_lun_remove_cmd(cmd); |
| @@ -665,9 +666,11 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) · 5 unmodified lines | ||
| 665 | 666 | cmd->se_tfo->aborted_task(cmd); |
| 666 | 667 | |
| 667 | 668 | if (transport_cmd_check_stop_to_fabric(cmd)) |
| 668 | − return; | |
| 669 | + return 1; | |
| 669 | 670 | if (remove && ack_kref) |
| 670 | − transport_put_cmd(cmd); | |
| 671 | + ret = transport_put_cmd(cmd); | |
| 672 | + | |
| 673 | + return ret; | |
| 671 | 674 | } |
| 672 | 675 | |
| 673 | 676 | static void target_complete_failure_work(struct work_struct *work) |
| @@ -315,6 +315,9 @@ void usb_remove_function(struct usb_configuration *c, struct usb_function *f) · 314 unmodified lines | ||
| 315 | 315 | list_del(&f->list); |
| 316 | 316 | if (f->unbind) |
| 317 | 317 | f->unbind(c, f); |
| 318 | + | |
| 319 | + if (f->bind_deactivated) | |
| 320 | + usb_function_activate(f); | |
| 318 | 321 | } |
| 319 | 322 | EXPORT_SYMBOL_GPL(usb_remove_function); |
| 320 | 323 | |
| @@ -956,12 +959,8 @@ static void remove_config(struct usb_composite_dev *cdev, · 635 unmodified lines | ||
| 956 | 959 | |
| 957 | 960 | f = list_first_entry(&config->functions, |
| 958 | 961 | struct usb_function, list); |
| 959 | − list_del(&f->list); | |
| 960 | − if (f->unbind) { | |
| 961 | − DBG(cdev, "unbind function '%s'/%p\n", f->name, f); | |
| 962 | − f->unbind(config, f); | |
| 963 | − /* may free memory for "f" */ | |
| 964 | − } | |
| 962 | + | |
| 963 | + usb_remove_function(config, f); | |
| 965 | 964 | } |
| 966 | 965 | list_del(&config->list); |
| 967 | 966 | if (config->unbind) { |
| @@ -281,7 +281,7 @@ static void pn_net_setup(struct net_device *dev) · 280 unmodified lines | ||
| 281 | 281 | dev->tx_queue_len = 1; |
| 282 | 282 | |
| 283 | 283 | dev->netdev_ops = &pn_netdev_ops; |
| 284 | − dev->destructor = free_netdev; | |
| 284 | + dev->needs_free_netdev = true; | |
| 285 | 285 | dev->header_ops = &phonet_header_ops; |
| 286 | 286 | } |
| 287 | 287 | |
| @@ -1183,8 +1183,10 @@ dev_release (struct inode *inode, struct file *fd) · 1182 unmodified lines | ||
| 1183 | 1183 | |
| 1184 | 1184 | /* closing ep0 === shutdown all */ |
| 1185 | 1185 | |
| 1186 | − if (dev->gadget_registered) | |
| 1186 | + if (dev->gadget_registered) { | |
| 1187 | 1187 | usb_gadget_unregister_driver (&gadgetfs_driver); |
| 1188 | + dev->gadget_registered = false; | |
| 1189 | + } | |
| 1188 | 1190 | |
| 1189 | 1191 | /* at this point "good" hardware has disconnected the |
| 1190 | 1192 | * device from USB; the host won't see it any more. |
| @@ -1677,9 +1679,10 @@ static void · 486 unmodified lines | ||
| 1677 | 1679 | gadgetfs_suspend (struct usb_gadget *gadget) |
| 1678 | 1680 | { |
| 1679 | 1681 | struct dev_data *dev = get_gadget_data (gadget); |
| 1682 | + unsigned long flags; | |
| 1680 | 1683 | |
| 1681 | 1684 | INFO (dev, "suspended from state %d\n", dev->state); |
| 1682 | − spin_lock (&dev->lock); | |
| 1685 | + spin_lock_irqsave(&dev->lock, flags); | |
| 1683 | 1686 | switch (dev->state) { |
| 1684 | 1687 | case STATE_DEV_SETUP: // VERY odd... host died?? |
| 1685 | 1688 | case STATE_DEV_CONNECTED: |
| @@ -1690,7 +1693,7 @@ gadgetfs_suspend (struct usb_gadget *gadget) · 4 unmodified lines | ||
| 1690 | 1693 | default: |
| 1691 | 1694 | break; |
| 1692 | 1695 | } |
| 1693 | − spin_unlock (&dev->lock); | |
| 1696 | + spin_unlock_irqrestore(&dev->lock, flags); | |
| 1694 | 1697 | } |
| 1695 | 1698 | |
| 1696 | 1699 | static struct usb_gadget_driver gadgetfs_driver = { |
| @@ -442,23 +442,16 @@ static void set_link_state(struct dummy_hcd *dum_hcd) · 441 unmodified lines | ||
| 442 | 442 | /* Report reset and disconnect events to the driver */ |
| 443 | 443 | if (dum->driver && (disconnect || reset)) { |
| 444 | 444 | stop_activity(dum); |
| 445 | − spin_unlock(&dum->lock); | |
| 446 | 445 | if (reset) |
| 447 | 446 | usb_gadget_udc_reset(&dum->gadget, dum->driver); |
| 448 | 447 | else |
| 449 | 448 | dum->driver->disconnect(&dum->gadget); |
| 450 | − spin_lock(&dum->lock); | |
| 451 | 449 | } |
| 452 | 450 | } else if (dum_hcd->active != dum_hcd->old_active) { |
| 453 | − if (dum_hcd->old_active && dum->driver->suspend) { | |
| 454 | − spin_unlock(&dum->lock); | |
| 451 | + if (dum_hcd->old_active && dum->driver->suspend) | |
| 455 | 452 | dum->driver->suspend(&dum->gadget); |
| 456 | − spin_lock(&dum->lock); | |
| 457 | − } else if (!dum_hcd->old_active && dum->driver->resume) { | |
| 458 | − spin_unlock(&dum->lock); | |
| 453 | + else if (!dum_hcd->old_active && dum->driver->resume) | |
| 459 | 454 | dum->driver->resume(&dum->gadget); |
| 460 | − spin_lock(&dum->lock); | |
| 461 | − } | |
| 462 | 455 | } |
| 463 | 456 | |
| 464 | 457 | dum_hcd->old_status = dum_hcd->port_status; |
| @@ -983,7 +976,9 @@ static int dummy_udc_stop(struct usb_gadget *g) · 518 unmodified lines | ||
| 983 | 976 | struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g); |
| 984 | 977 | struct dummy *dum = dum_hcd->dum; |
| 985 | 978 | |
| 979 | + spin_lock_irq(&dum->lock); | |
| 986 | 980 | dum->driver = NULL; |
| 981 | + spin_unlock_irq(&dum->lock); | |
| 987 | 982 | |
| 988 | 983 | return 0; |
| 989 | 984 | } |
| @@ -2470,11 +2470,8 @@ static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver) · 2469 unmodified lines | ||
| 2470 | 2470 | nuke(&dev->ep[i]); |
| 2471 | 2471 | |
| 2472 | 2472 | /* report disconnect; the driver is already quiesced */ |
| 2473 | − if (driver) { | |
| 2474 | − spin_unlock(&dev->lock); | |
| 2473 | + if (driver) | |
| 2475 | 2474 | driver->disconnect(&dev->gadget); |
| 2476 | − spin_lock(&dev->lock); | |
| 2477 | − } | |
| 2478 | 2475 | |
| 2479 | 2476 | usb_reinit(dev); |
| 2480 | 2477 | } |
| @@ -3348,8 +3345,6 @@ next_endpoints: · 867 unmodified lines | ||
| 3348 | 3345 | BIT(PCI_RETRY_ABORT_INTERRUPT)) |
| 3349 | 3346 | |
| 3350 | 3347 | static void handle_stat1_irqs(struct net2280 *dev, u32 stat) |
| 3351 | −__releases(dev->lock) | |
| 3352 | −__acquires(dev->lock) | |
| 3353 | 3348 | { |
| 3354 | 3349 | struct net2280_ep *ep; |
| 3355 | 3350 | u32 tmp, num, mask, scratch; |
| @@ -3390,14 +3385,12 @@ __acquires(dev->lock) · 34 unmodified lines | ||
| 3390 | 3385 | if (disconnect || reset) { |
| 3391 | 3386 | stop_activity(dev, dev->driver); |
| 3392 | 3387 | ep0_start(dev); |
| 3393 | − spin_unlock(&dev->lock); | |
| 3394 | 3388 | if (reset) |
| 3395 | 3389 | usb_gadget_udc_reset |
| 3396 | 3390 | (&dev->gadget, dev->driver); |
| 3397 | 3391 | else |
| 3398 | 3392 | (dev->driver->disconnect) |
| 3399 | 3393 | (&dev->gadget); |
| 3400 | − spin_lock(&dev->lock); | |
| 3401 | 3394 | return; |
| 3402 | 3395 | } |
| 3403 | 3396 | } |
| @@ -2119,11 +2119,12 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, · 2118 unmodified lines | ||
| 2119 | 2119 | { |
| 2120 | 2120 | u32 temp, port_offset, port_count; |
| 2121 | 2121 | int i; |
| 2122 | − u8 major_revision; | |
| 2122 | + u8 major_revision, minor_revision; | |
| 2123 | 2123 | struct xhci_hub *rhub; |
| 2124 | 2124 | |
| 2125 | 2125 | temp = readl(addr); |
| 2126 | 2126 | major_revision = XHCI_EXT_PORT_MAJOR(temp); |
| 2127 | + minor_revision = XHCI_EXT_PORT_MINOR(temp); | |
| 2127 | 2128 | |
| 2128 | 2129 | if (major_revision == 0x03) { |
| 2129 | 2130 | rhub = &xhci->usb3_rhub; |
| @@ -2137,7 +2138,9 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, · 7 unmodified lines | ||
| 2137 | 2138 | return; |
| 2138 | 2139 | } |
| 2139 | 2140 | rhub->maj_rev = XHCI_EXT_PORT_MAJOR(temp); |
| 2140 | − rhub->min_rev = XHCI_EXT_PORT_MINOR(temp); | |
| 2141 | + | |
| 2142 | + if (rhub->min_rev < minor_revision) | |
| 2143 | + rhub->min_rev = minor_revision; | |
| 2141 | 2144 | |
| 2142 | 2145 | /* Port offset and count in the third dword, see section 7.2 */ |
| 2143 | 2146 | temp = readl(addr + 2); |
| @@ -201,6 +201,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 200 unmodified lines | ||
| 201 | 201 | if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && |
| 202 | 202 | pdev->device == 0x1042) |
| 203 | 203 | xhci->quirks |= XHCI_BROKEN_STREAMS; |
| 204 | + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && | |
| 205 | + pdev->device == 0x1142) | |
| 206 | + xhci->quirks |= XHCI_TRUST_TX_LENGTH; | |
| 204 | 207 | |
| 205 | 208 | if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) |
| 206 | 209 | xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; |
| @@ -1048,7 +1048,7 @@ void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) · 1047 unmodified lines | ||
| 1048 | 1048 | |
| 1049 | 1049 | for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE; |
| 1050 | 1050 | i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) |
| 1051 | − if (PIXEL_CLOCK) | |
| 1051 | + if (PIXEL_CLOCK != 0) | |
| 1052 | 1052 | edt[num++] = block - edid; |
| 1053 | 1053 | |
| 1054 | 1054 | /* Yikes, EDID data is totally useless */ |
| @@ -1646,8 +1646,9 @@ static int ufx_usb_probe(struct usb_interface *interface, · 1645 unmodified lines | ||
| 1646 | 1646 | dev_dbg(dev->gdev, "%s %s - serial #%s\n", |
| 1647 | 1647 | usbdev->manufacturer, usbdev->product, usbdev->serial); |
| 1648 | 1648 | dev_dbg(dev->gdev, "vid_%04x&pid_%04x&rev_%04x driver's ufx_data struct at %p\n", |
| 1649 | − usbdev->descriptor.idVendor, usbdev->descriptor.idProduct, | |
| 1650 | − usbdev->descriptor.bcdDevice, dev); | |
| 1649 | + le16_to_cpu(usbdev->descriptor.idVendor), | |
| 1650 | + le16_to_cpu(usbdev->descriptor.idProduct), | |
| 1651 | + le16_to_cpu(usbdev->descriptor.bcdDevice), dev); | |
| 1651 | 1652 | dev_dbg(dev->gdev, "console enable=%d\n", console); |
| 1652 | 1653 | dev_dbg(dev->gdev, "fb_defio enable=%d\n", fb_defio); |
| 1653 | 1654 | |
| @@ -1105,8 +1105,8 @@ static int dlfb_ops_blank(int blank_mode, struct fb_info *info) · 1104 unmodified lines | ||
| 1105 | 1105 | char *bufptr; |
| 1106 | 1106 | struct urb *urb; |
| 1107 | 1107 | |
| 1108 | − pr_info("/dev/fb%d FB_BLANK mode %d --> %d\n", | |
| 1109 | − info->node, dev->blank_mode, blank_mode); | |
| 1108 | + pr_debug("/dev/fb%d FB_BLANK mode %d --> %d\n", | |
| 1109 | + info->node, dev->blank_mode, blank_mode); | |
| 1110 | 1110 | |
| 1111 | 1111 | if ((dev->blank_mode == FB_BLANK_POWERDOWN) && |
| 1112 | 1112 | (blank_mode != FB_BLANK_POWERDOWN)) { |
| @@ -1613,8 +1613,9 @@ static int dlfb_usb_probe(struct usb_interface *interface, · 500 unmodified lines | ||
| 1613 | 1613 | pr_info("%s %s - serial #%s\n", |
| 1614 | 1614 | usbdev->manufacturer, usbdev->product, usbdev->serial); |
| 1615 | 1615 | pr_info("vid_%04x&pid_%04x&rev_%04x driver's dlfb_data struct at %p\n", |
| 1616 | − usbdev->descriptor.idVendor, usbdev->descriptor.idProduct, | |
| 1617 | − usbdev->descriptor.bcdDevice, dev); | |
| 1616 | + le16_to_cpu(usbdev->descriptor.idVendor), | |
| 1617 | + le16_to_cpu(usbdev->descriptor.idProduct), | |
| 1618 | + le16_to_cpu(usbdev->descriptor.bcdDevice), dev); | |
| 1618 | 1619 | pr_info("console enable=%d\n", console); |
| 1619 | 1620 | pr_info("fb_defio enable=%d\n", fb_defio); |
| 1620 | 1621 | pr_info("shadow enable=%d\n", shadow); |
| @@ -1630,16 +1630,14 @@ static void viafb_init_proc(struct viafb_shared *shared) · 1629 unmodified lines | ||
| 1630 | 1630 | } |
| 1631 | 1631 | static void viafb_remove_proc(struct viafb_shared *shared) |
| 1632 | 1632 | { |
| 1633 | − struct proc_dir_entry *viafb_entry = shared->proc_entry, | |
| 1634 | − *iga1_entry = shared->iga1_proc_entry, | |
| 1635 | − *iga2_entry = shared->iga2_proc_entry; | |
| 1633 | + struct proc_dir_entry *viafb_entry = shared->proc_entry; | |
| 1636 | 1634 | |
| 1637 | 1635 | if (!viafb_entry) |
| 1638 | 1636 | return; |
| 1639 | 1637 | |
| 1640 | − remove_proc_entry("output_devices", iga2_entry); | |
| 1638 | + remove_proc_entry("output_devices", shared->iga2_proc_entry); | |
| 1641 | 1639 | remove_proc_entry("iga2", viafb_entry); |
| 1642 | − remove_proc_entry("output_devices", iga1_entry); | |
| 1640 | + remove_proc_entry("output_devices", shared->iga1_proc_entry); | |
| 1643 | 1641 | remove_proc_entry("iga1", viafb_entry); |
| 1644 | 1642 | remove_proc_entry("supported_output_devices", viafb_entry); |
| 1645 | 1643 | |
| @@ -663,6 +663,12 @@ static int virtballoon_restore(struct virtio_device *vdev) · 662 unmodified lines | ||
| 663 | 663 | } |
| 664 | 664 | #endif |
| 665 | 665 | |
| 666 | +static int virtballoon_validate(struct virtio_device *vdev) | |
| 667 | +{ | |
| 668 | + __virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM); | |
| 669 | + return 0; | |
| 670 | +} | |
| 671 | + | |
| 666 | 672 | static unsigned int features[] = { |
| 667 | 673 | VIRTIO_BALLOON_F_MUST_TELL_HOST, |
| 668 | 674 | VIRTIO_BALLOON_F_STATS_VQ, |
| @@ -675,6 +681,7 @@ static struct virtio_driver virtio_balloon_driver = { · 6 unmodified lines | ||
| 675 | 681 | .driver.name = KBUILD_MODNAME, |
| 676 | 682 | .driver.owner = THIS_MODULE, |
| 677 | 683 | .id_table = id_table, |
| 684 | + .validate = virtballoon_validate, | |
| 678 | 685 | .probe = virtballoon_probe, |
| 679 | 686 | .remove = virtballoon_remove, |
| 680 | 687 | .config_changed = virtballoon_changed, |
| @@ -344,7 +344,7 @@ static int autofs_dev_ioctl_fail(struct file *fp, · 343 unmodified lines | ||
| 344 | 344 | int status; |
| 345 | 345 | |
| 346 | 346 | token = (autofs_wqt_t) param->fail.token; |
| 347 | − status = param->fail.status ? param->fail.status : -ENOENT; | |
| 347 | + status = param->fail.status < 0 ? param->fail.status : -ENOENT; | |
| 348 | 348 | return autofs4_wait_release(sbi, token, status); |
| 349 | 349 | } |
| 350 | 350 | |
| @@ -38,6 +38,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length) · 37 unmodified lines | ||
| 38 | 38 | { |
| 39 | 39 | SHASH_DESC_ON_STACK(shash, tfm); |
| 40 | 40 | u32 *ctx = (u32 *)shash_desc_ctx(shash); |
| 41 | + u32 retval; | |
| 41 | 42 | int err; |
| 42 | 43 | |
| 43 | 44 | shash->tfm = tfm; |
| @@ -47,5 +48,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length) · 3 unmodified lines | ||
| 47 | 48 | err = crypto_shash_update(shash, address, length); |
| 48 | 49 | BUG_ON(err); |
| 49 | 50 | |
| 50 | − return *ctx; | |
| 51 | + retval = *ctx; | |
| 52 | + barrier_data(ctx); | |
| 53 | + return retval; | |
| 51 | 54 | } |
| @@ -131,6 +131,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) · 130 unmodified lines | ||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (new_mode != old_mode) { |
| 134 | + newattrs.ia_ctime = current_time(inode); | |
| 134 | 135 | newattrs.ia_mode = new_mode; |
| 135 | 136 | newattrs.ia_valid = ATTR_MODE; |
| 136 | 137 | ret = __ceph_setattr(inode, &newattrs); |
| @@ -91,6 +91,10 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) · 90 unmodified lines | ||
| 91 | 91 | ceph_mdsc_put_request(req); |
| 92 | 92 | if (!inode) |
| 93 | 93 | return ERR_PTR(-ESTALE); |
| 94 | + if (inode->i_nlink == 0) { | |
| 95 | + iput(inode); | |
| 96 | + return ERR_PTR(-ESTALE); | |
| 97 | + } | |
| 94 | 98 | } |
| 95 | 99 | |
| 96 | 100 | return d_obtain_alias(inode); |
| @@ -2022,7 +2022,6 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 2021 unmodified lines | ||
| 2022 | 2022 | attr->ia_size > inode->i_size) { |
| 2023 | 2023 | i_size_write(inode, attr->ia_size); |
| 2024 | 2024 | inode->i_blocks = calc_inode_blocks(attr->ia_size); |
| 2025 | − inode->i_ctime = attr->ia_ctime; | |
| 2026 | 2025 | ci->i_reported_size = attr->ia_size; |
| 2027 | 2026 | dirtied |= CEPH_CAP_FILE_EXCL; |
| 2028 | 2027 | } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 || |
| @@ -2044,7 +2043,6 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 15 unmodified lines | ||
| 2044 | 2043 | inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, |
| 2045 | 2044 | attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec, |
| 2046 | 2045 | only ? "ctime only" : "ignored"); |
| 2047 | − inode->i_ctime = attr->ia_ctime; | |
| 2048 | 2046 | if (only) { |
| 2049 | 2047 | /* |
| 2050 | 2048 | * if kernel wants to dirty ctime but nothing else, |
| @@ -2067,7 +2065,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 16 unmodified lines | ||
| 2067 | 2065 | if (dirtied) { |
| 2068 | 2066 | inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied, |
| 2069 | 2067 | &prealloc_cf); |
| 2070 | − inode->i_ctime = current_time(inode); | |
| 2068 | + inode->i_ctime = attr->ia_ctime; | |
| 2071 | 2069 | } |
| 2072 | 2070 | |
| 2073 | 2071 | release &= issued; |
| @@ -2085,6 +2083,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) · 11 unmodified lines | ||
| 2085 | 2083 | req->r_inode_drop = release; |
| 2086 | 2084 | req->r_args.setattr.mask = cpu_to_le32(mask); |
| 2087 | 2085 | req->r_num_caps = 1; |
| 2086 | + req->r_stamp = attr->ia_ctime; | |
| 2088 | 2087 | err = ceph_mdsc_do_request(mdsc, NULL, req); |
| 2089 | 2088 | } |
| 2090 | 2089 | dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err, |
| @@ -1687,7 +1687,6 @@ struct ceph_mds_request * · 1686 unmodified lines | ||
| 1687 | 1687 | ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode) |
| 1688 | 1688 | { |
| 1689 | 1689 | struct ceph_mds_request *req = kzalloc(sizeof(*req), GFP_NOFS); |
| 1690 | − struct timespec ts; | |
| 1691 | 1690 | |
| 1692 | 1691 | if (!req) |
| 1693 | 1692 | return ERR_PTR(-ENOMEM); |
| @@ -1706,8 +1705,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode) · 12 unmodified lines | ||
| 1706 | 1705 | init_completion(&req->r_safe_completion); |
| 1707 | 1706 | INIT_LIST_HEAD(&req->r_unsafe_item); |
| 1708 | 1707 | |
| 1709 | − ktime_get_real_ts(&ts); | |
| 1710 | − req->r_stamp = timespec_trunc(ts, mdsc->fsc->sb->s_time_gran); | |
| 1708 | + req->r_stamp = timespec_trunc(current_kernel_time(), mdsc->fsc->sb->s_time_gran); | |
| 1711 | 1709 | |
| 1712 | 1710 | req->r_op = op; |
| 1713 | 1711 | req->r_direct_mode = mode; |
| @@ -3271,7 +3271,7 @@ ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to) · 3270 unmodified lines | ||
| 3271 | 3271 | if (!is_sync_kiocb(iocb)) |
| 3272 | 3272 | ctx->iocb = iocb; |
| 3273 | 3273 | |
| 3274 | − if (to->type & ITER_IOVEC) | |
| 3274 | + if (to->type == ITER_IOVEC) | |
| 3275 | 3275 | ctx->should_dirty = true; |
| 3276 | 3276 | |
| 3277 | 3277 | rc = setup_aio_ctx_iter(ctx, to, READ); |
| @@ -810,7 +810,7 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw) · 809 unmodified lines | ||
| 810 | 810 | |
| 811 | 811 | if (!pages) { |
| 812 | 812 | pages = vmalloc(max_pages * sizeof(struct page *)); |
| 813 | − if (!bv) { | |
| 813 | + if (!pages) { | |
| 814 | 814 | kvfree(bv); |
| 815 | 815 | return -ENOMEM; |
| 816 | 816 | } |
| @@ -849,8 +849,13 @@ cifs_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 848 unmodified lines | ||
| 849 | 849 | struct cifs_fid *fid, __u16 search_flags, |
| 850 | 850 | struct cifs_search_info *srch_inf) |
| 851 | 851 | { |
| 852 | − return CIFSFindFirst(xid, tcon, path, cifs_sb, | |
| 853 | − &fid->netfid, search_flags, srch_inf, true); | |
| 852 | + int rc; | |
| 853 | + | |
| 854 | + rc = CIFSFindFirst(xid, tcon, path, cifs_sb, | |
| 855 | + &fid->netfid, search_flags, srch_inf, true); | |
| 856 | + if (rc) | |
| 857 | + cifs_dbg(FYI, "find first failed=%d\n", rc); | |
| 858 | + return rc; | |
| 854 | 859 | } |
| 855 | 860 | |
| 856 | 861 | static int |
| @@ -982,7 +982,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 981 unmodified lines | ||
| 982 | 982 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); |
| 983 | 983 | kfree(utf16_path); |
| 984 | 984 | if (rc) { |
| 985 | − cifs_dbg(VFS, "open dir failed\n"); | |
| 985 | + cifs_dbg(FYI, "open dir failed rc=%d\n", rc); | |
| 986 | 986 | return rc; |
| 987 | 987 | } |
| 988 | 988 | |
| @@ -992,7 +992,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 3 unmodified lines | ||
| 992 | 992 | rc = SMB2_query_directory(xid, tcon, fid->persistent_fid, |
| 993 | 993 | fid->volatile_fid, 0, srch_inf); |
| 994 | 994 | if (rc) { |
| 995 | − cifs_dbg(VFS, "query directory failed\n"); | |
| 995 | + cifs_dbg(FYI, "query directory failed rc=%d\n", rc); | |
| 996 | 996 | SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid); |
| 997 | 997 | } |
| 998 | 998 | return rc; |
| @@ -1809,7 +1809,8 @@ crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc) · 810 unmodified lines | ||
| 1809 | 1809 | |
| 1810 | 1810 | sg = init_sg(rqst, sign); |
| 1811 | 1811 | if (!sg) { |
| 1812 | − cifs_dbg(VFS, "%s: Failed to init sg %d", __func__, rc); | |
| 1812 | + cifs_dbg(VFS, "%s: Failed to init sg", __func__); | |
| 1813 | + rc = -ENOMEM; | |
| 1813 | 1814 | goto free_req; |
| 1814 | 1815 | } |
| 1815 | 1816 | |
| @@ -1817,6 +1818,7 @@ crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc) · 1 unmodified line | ||
| 1817 | 1818 | iv = kzalloc(iv_len, GFP_KERNEL); |
| 1818 | 1819 | if (!iv) { |
| 1819 | 1820 | cifs_dbg(VFS, "%s: Failed to alloc IV", __func__); |
| 1821 | + rc = -ENOMEM; | |
| 1820 | 1822 | goto free_sg; |
| 1821 | 1823 | } |
| 1822 | 1824 | iv[0] = 3; |
| @@ -188,8 +188,6 @@ static int cifs_creation_time_get(struct dentry *dentry, struct inode *inode, · 187 unmodified lines | ||
| 188 | 188 | pcreatetime = (__u64 *)value; |
| 189 | 189 | *pcreatetime = CIFS_I(inode)->createtime; |
| 190 | 190 | return sizeof(__u64); |
| 191 | − | |
| 192 | − return rc; | |
| 193 | 191 | } |
| 194 | 192 | |
| 195 | 193 | |
| @@ -138,6 +138,14 @@ struct config_item *config_item_get(struct config_item *item) · 137 unmodified lines | ||
| 138 | 138 | } |
| 139 | 139 | EXPORT_SYMBOL(config_item_get); |
| 140 | 140 | |
| 141 | +struct config_item *config_item_get_unless_zero(struct config_item *item) | |
| 142 | +{ | |
| 143 | + if (item && kref_get_unless_zero(&item->ci_kref)) | |
| 144 | + return item; | |
| 145 | + return NULL; | |
| 146 | +} | |
| 147 | +EXPORT_SYMBOL(config_item_get_unless_zero); | |
| 148 | + | |
| 141 | 149 | static void config_item_cleanup(struct config_item *item) |
| 142 | 150 | { |
| 143 | 151 | struct config_item_type *t = item->ci_type; |
| @@ -83,14 +83,13 @@ static int create_link(struct config_item *parent_item, · 82 unmodified lines | ||
| 83 | 83 | ret = -ENOMEM; |
| 84 | 84 | sl = kmalloc(sizeof(struct configfs_symlink), GFP_KERNEL); |
| 85 | 85 | if (sl) { |
| 86 | − sl->sl_target = config_item_get(item); | |
| 87 | 86 | spin_lock(&configfs_dirent_lock); |
| 88 | 87 | if (target_sd->s_type & CONFIGFS_USET_DROPPING) { |
| 89 | 88 | spin_unlock(&configfs_dirent_lock); |
| 90 | − config_item_put(item); | |
| 91 | 89 | kfree(sl); |
| 92 | 90 | return -ENOENT; |
| 93 | 91 | } |
| 92 | + sl->sl_target = config_item_get(item); | |
| 94 | 93 | list_add(&sl->sl_list, &target_sd->s_links); |
| 95 | 94 | spin_unlock(&configfs_dirent_lock); |
| 96 | 95 | ret = configfs_create_link(sl, parent_item->ci_dentry, |
| @@ -859,6 +859,7 @@ int dax_writeback_mapping_range(struct address_space *mapping, · 858 unmodified lines | ||
| 859 | 859 | if (ret < 0) |
| 860 | 860 | goto out; |
| 861 | 861 | } |
| 862 | + start_index = indices[pvec.nr - 1] + 1; | |
| 862 | 863 | } |
| 863 | 864 | out: |
| 864 | 865 | put_dax(dax_dev); |
| @@ -1494,7 +1494,7 @@ static void check_and_drop(void *_data) · 1493 unmodified lines | ||
| 1494 | 1494 | { |
| 1495 | 1495 | struct detach_data *data = _data; |
| 1496 | 1496 | |
| 1497 | − if (!data->mountpoint && !data->select.found) | |
| 1497 | + if (!data->mountpoint && list_empty(&data->select.dispose)) | |
| 1498 | 1498 | __d_drop(data->select.start); |
| 1499 | 1499 | } |
| 1500 | 1500 | |
| @@ -1536,17 +1536,15 @@ void d_invalidate(struct dentry *dentry) · 35 unmodified lines | ||
| 1536 | 1536 | |
| 1537 | 1537 | d_walk(dentry, &data, detach_and_collect, check_and_drop); |
| 1538 | 1538 | |
| 1539 | − if (data.select.found) | |
| 1539 | + if (!list_empty(&data.select.dispose)) | |
| 1540 | 1540 | shrink_dentry_list(&data.select.dispose); |
| 1541 | + else if (!data.mountpoint) | |
| 1542 | + return; | |
| 1541 | 1543 | |
| 1542 | 1544 | if (data.mountpoint) { |
| 1543 | 1545 | detach_mounts(data.mountpoint); |
| 1544 | 1546 | dput(data.mountpoint); |
| 1545 | 1547 | } |
| 1546 | − | |
| 1547 | − if (!data.mountpoint && !data.select.found) | |
| 1548 | − break; | |
| 1549 | − | |
| 1550 | 1548 | cond_resched(); |
| 1551 | 1549 | } |
| 1552 | 1550 | } |
| @@ -220,8 +220,26 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, · 219 unmodified lines | ||
| 220 | 220 | |
| 221 | 221 | if (write) { |
| 222 | 222 | unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; |
| 223 | + unsigned long ptr_size; | |
| 223 | 224 | struct rlimit *rlim; |
| 224 | 225 | |
| 226 | + /* | |
| 227 | + * Since the stack will hold pointers to the strings, we | |
| 228 | + * must account for them as well. | |
| 229 | + * | |
| 230 | + * The size calculation is the entire vma while each arg page is | |
| 231 | + * built, so each time we get here it's calculating how far it | |
| 232 | + * is currently (rather than each call being just the newly | |
| 233 | + * added size from the arg page). As a result, we need to | |
| 234 | + * always add the entire size of the pointers, so that on the | |
| 235 | + * last call to get_arg_page() we'll actually have the entire | |
| 236 | + * correct size. | |
| 237 | + */ | |
| 238 | + ptr_size = (bprm->argc + bprm->envc) * sizeof(void *); | |
| 239 | + if (ptr_size > ULONG_MAX - size) | |
| 240 | + goto fail; | |
| 241 | + size += ptr_size; | |
| 242 | + | |
| 225 | 243 | acct_arg_size(bprm, size / PAGE_SIZE); |
| 226 | 244 | |
| 227 | 245 | /* |
| @@ -239,13 +257,15 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, · 11 unmodified lines | ||
| 239 | 257 | * to work from. |
| 240 | 258 | */ |
| 241 | 259 | rlim = current->signal->rlim; |
| 242 | − if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4) { | |
| 243 | − put_page(page); | |
| 244 | − return NULL; | |
| 245 | − } | |
| 260 | + if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4) | |
| 261 | + goto fail; | |
| 246 | 262 | } |
| 247 | 263 | |
| 248 | 264 | return page; |
| 265 | + | |
| 266 | +fail: | |
| 267 | + put_page(page); | |
| 268 | + return NULL; | |
| 249 | 269 | } |
| 250 | 270 | |
| 251 | 271 | static void put_arg_page(struct page *page) |
| @@ -1078,6 +1078,7 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, · 1077 unmodified lines | ||
| 1078 | 1078 | { |
| 1079 | 1079 | SHASH_DESC_ON_STACK(shash, sbi->s_chksum_driver); |
| 1080 | 1080 | u32 *ctx = (u32 *)shash_desc_ctx(shash); |
| 1081 | + u32 retval; | |
| 1081 | 1082 | int err; |
| 1082 | 1083 | |
| 1083 | 1084 | shash->tfm = sbi->s_chksum_driver; |
| @@ -1087,7 +1088,9 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, · 3 unmodified lines | ||
| 1087 | 1088 | err = crypto_shash_update(shash, address, length); |
| 1088 | 1089 | BUG_ON(err); |
| 1089 | 1090 | |
| 1090 | − return *ctx; | |
| 1091 | + retval = *ctx; | |
| 1092 | + barrier_data(ctx); | |
| 1093 | + return retval; | |
| 1091 | 1094 | } |
| 1092 | 1095 | |
| 1093 | 1096 | static inline bool f2fs_crc_valid(struct f2fs_sb_info *sbi, __u32 blk_crc, |
| @@ -200,7 +200,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · 199 unmodified lines | ||
| 200 | 200 | addr = ALIGN(addr, huge_page_size(h)); |
| 201 | 201 | vma = find_vma(mm, addr); |
| 202 | 202 | if (TASK_SIZE - len >= addr && |
| 203 | − (!vma || addr + len <= vma->vm_start)) | |
| 203 | + (!vma || addr + len <= vm_start_gap(vma))) | |
| 204 | 204 | return addr; |
| 205 | 205 | } |
| 206 | 206 | |
| @@ -3488,6 +3488,8 @@ static int mntns_install(struct nsproxy *nsproxy, struct ns_common *ns) · 3487 unmodified lines | ||
| 3488 | 3488 | return err; |
| 3489 | 3489 | } |
| 3490 | 3490 | |
| 3491 | + put_mnt_ns(old_mnt_ns); | |
| 3492 | + | |
| 3491 | 3493 | /* Update the pwd and root */ |
| 3492 | 3494 | set_fs_pwd(fs, &root); |
| 3493 | 3495 | set_fs_root(fs, &root); |
| @@ -2591,6 +2591,10 @@ void ocfs2_inode_unlock_tracker(struct inode *inode, · 2590 unmodified lines | ||
| 2591 | 2591 | struct ocfs2_lock_res *lockres; |
| 2592 | 2592 | |
| 2593 | 2593 | lockres = &OCFS2_I(inode)->ip_inode_lockres; |
| 2594 | + /* had_lock means that the currect process already takes the cluster | |
| 2595 | + * lock previously. If had_lock is 1, we have nothing to do here, and | |
| 2596 | + * it will get unlocked where we got the lock. | |
| 2597 | + */ | |
| 2594 | 2598 | if (!had_lock) { |
| 2595 | 2599 | ocfs2_remove_holder(lockres, oh); |
| 2596 | 2600 | ocfs2_inode_unlock(inode, ex); |
| @@ -1328,20 +1328,21 @@ static int ocfs2_xattr_get(struct inode *inode, · 1327 unmodified lines | ||
| 1328 | 1328 | void *buffer, |
| 1329 | 1329 | size_t buffer_size) |
| 1330 | 1330 | { |
| 1331 | − int ret; | |
| 1331 | + int ret, had_lock; | |
| 1332 | 1332 | struct buffer_head *di_bh = NULL; |
| 1333 | + struct ocfs2_lock_holder oh; | |
| 1333 | 1334 | |
| 1334 | − ret = ocfs2_inode_lock(inode, &di_bh, 0); | |
| 1335 | − if (ret < 0) { | |
| 1336 | − mlog_errno(ret); | |
| 1337 | − return ret; | |
| 1335 | + had_lock = ocfs2_inode_lock_tracker(inode, &di_bh, 0, &oh); | |
| 1336 | + if (had_lock < 0) { | |
| 1337 | + mlog_errno(had_lock); | |
| 1338 | + return had_lock; | |
| 1338 | 1339 | } |
| 1339 | 1340 | down_read(&OCFS2_I(inode)->ip_xattr_sem); |
| 1340 | 1341 | ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index, |
| 1341 | 1342 | name, buffer, buffer_size); |
| 1342 | 1343 | up_read(&OCFS2_I(inode)->ip_xattr_sem); |
| 1343 | 1344 | |
| 1344 | − ocfs2_inode_unlock(inode, 0); | |
| 1345 | + ocfs2_inode_unlock_tracker(inode, 0, &oh, had_lock); | |
| 1345 | 1346 | |
| 1346 | 1347 | brelse(di_bh); |
| 1347 | 1348 | |
| @@ -3537,11 +3538,12 @@ int ocfs2_xattr_set(struct inode *inode, · 2189 unmodified lines | ||
| 3537 | 3538 | { |
| 3538 | 3539 | struct buffer_head *di_bh = NULL; |
| 3539 | 3540 | struct ocfs2_dinode *di; |
| 3540 | − int ret, credits, ref_meta = 0, ref_credits = 0; | |
| 3541 | + int ret, credits, had_lock, ref_meta = 0, ref_credits = 0; | |
| 3541 | 3542 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 3542 | 3543 | struct inode *tl_inode = osb->osb_tl_inode; |
| 3543 | 3544 | struct ocfs2_xattr_set_ctxt ctxt = { NULL, NULL, NULL, }; |
| 3544 | 3545 | struct ocfs2_refcount_tree *ref_tree = NULL; |
| 3546 | + struct ocfs2_lock_holder oh; | |
| 3545 | 3547 | |
| 3546 | 3548 | struct ocfs2_xattr_info xi = { |
| 3547 | 3549 | .xi_name_index = name_index, |
| @@ -3572,8 +3574,9 @@ int ocfs2_xattr_set(struct inode *inode, · 24 unmodified lines | ||
| 3572 | 3574 | return -ENOMEM; |
| 3573 | 3575 | } |
| 3574 | 3576 | |
| 3575 | − ret = ocfs2_inode_lock(inode, &di_bh, 1); | |
| 3576 | − if (ret < 0) { | |
| 3577 | + had_lock = ocfs2_inode_lock_tracker(inode, &di_bh, 1, &oh); | |
| 3578 | + if (had_lock < 0) { | |
| 3579 | + ret = had_lock; | |
| 3577 | 3580 | mlog_errno(ret); |
| 3578 | 3581 | goto cleanup_nolock; |
| 3579 | 3582 | } |
| @@ -3670,7 +3673,7 @@ cleanup: · 90 unmodified lines | ||
| 3670 | 3673 | if (ret) |
| 3671 | 3674 | mlog_errno(ret); |
| 3672 | 3675 | } |
| 3673 | − ocfs2_inode_unlock(inode, 1); | |
| 3676 | + ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock); | |
| 3674 | 3677 | cleanup_nolock: |
| 3675 | 3678 | brelse(di_bh); |
| 3676 | 3679 | brelse(xbs.xattr_bh); |
| @@ -300,11 +300,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) · 299 unmodified lines | ||
| 300 | 300 | |
| 301 | 301 | /* We don't show the stack guard page in /proc/maps */ |
| 302 | 302 | start = vma->vm_start; |
| 303 | − if (stack_guard_page_start(vma, start)) | |
| 304 | − start += PAGE_SIZE; | |
| 305 | 303 | end = vma->vm_end; |
| 306 | − if (stack_guard_page_end(vma, end)) | |
| 307 | − end -= PAGE_SIZE; | |
| 308 | 304 | |
| 309 | 305 | seq_setwidth(m, 25 + sizeof(void *) * 6 - 1); |
| 310 | 306 | seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ", |
| @@ -1285,7 +1285,7 @@ static size_t compat_writev(struct file *file, · 1284 unmodified lines | ||
| 1285 | 1285 | if (!(file->f_mode & FMODE_CAN_WRITE)) |
| 1286 | 1286 | goto out; |
| 1287 | 1287 | |
| 1288 | − ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, 0); | |
| 1288 | + ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos, flags); | |
| 1289 | 1289 | |
| 1290 | 1290 | out: |
| 1291 | 1291 | if (ret > 0) |
| @@ -400,10 +400,12 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 399 unmodified lines | ||
| 400 | 400 | /* |
| 401 | 401 | * There is not enough space for user on the device |
| 402 | 402 | */ |
| 403 | − if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) { | |
| 404 | − mutex_unlock(&UFS_SB(sb)->s_lock); | |
| 405 | − UFSD("EXIT (FAILED)\n"); | |
| 406 | − return 0; | |
| 403 | + if (unlikely(ufs_freefrags(uspi) <= uspi->s_root_blocks)) { | |
| 404 | + if (!capable(CAP_SYS_RESOURCE)) { | |
| 405 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
| 406 | + UFSD("EXIT (FAILED)\n"); | |
| 407 | + return 0; | |
| 408 | + } | |
| 407 | 409 | } |
| 408 | 410 | |
| 409 | 411 | if (goal >= uspi->s_size) |
| @@ -421,12 +423,12 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 11 unmodified lines | ||
| 421 | 423 | if (result) { |
| 422 | 424 | ufs_clear_frags(inode, result + oldcount, |
| 423 | 425 | newcount - oldcount, locked_page != NULL); |
| 426 | + *err = 0; | |
| 424 | 427 | write_seqlock(&UFS_I(inode)->meta_lock); |
| 425 | 428 | ufs_cpu_to_data_ptr(sb, p, result); |
| 426 | − write_sequnlock(&UFS_I(inode)->meta_lock); | |
| 427 | − *err = 0; | |
| 428 | 429 | UFS_I(inode)->i_lastfrag = |
| 429 | 430 | max(UFS_I(inode)->i_lastfrag, fragment + count); |
| 431 | + write_sequnlock(&UFS_I(inode)->meta_lock); | |
| 430 | 432 | } |
| 431 | 433 | mutex_unlock(&UFS_SB(sb)->s_lock); |
| 432 | 434 | UFSD("EXIT, result %llu\n", (unsigned long long)result); |
| @@ -439,8 +441,10 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 6 unmodified lines | ||
| 439 | 441 | result = ufs_add_fragments(inode, tmp, oldcount, newcount); |
| 440 | 442 | if (result) { |
| 441 | 443 | *err = 0; |
| 444 | + read_seqlock_excl(&UFS_I(inode)->meta_lock); | |
| 442 | 445 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, |
| 443 | 446 | fragment + count); |
| 447 | + read_sequnlock_excl(&UFS_I(inode)->meta_lock); | |
| 444 | 448 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, |
| 445 | 449 | locked_page != NULL); |
| 446 | 450 | mutex_unlock(&UFS_SB(sb)->s_lock); |
| @@ -451,39 +455,29 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 4 unmodified lines | ||
| 451 | 455 | /* |
| 452 | 456 | * allocate new block and move data |
| 453 | 457 | */ |
| 454 | − switch (fs32_to_cpu(sb, usb1->fs_optim)) { | |
| 455 | − case UFS_OPTSPACE: | |
| 458 | + if (fs32_to_cpu(sb, usb1->fs_optim) == UFS_OPTSPACE) { | |
| 456 | 459 | request = newcount; |
| 457 | − if (uspi->s_minfree < 5 || uspi->cs_total.cs_nffree | |
| 458 | − > uspi->s_dsize * uspi->s_minfree / (2 * 100)) | |
| 459 | − break; | |
| 460 | − usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); | |
| 461 | − break; | |
| 462 | − default: | |
| 463 | − usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); | |
| 464 | − | |
| 465 | − case UFS_OPTTIME: | |
| 460 | + if (uspi->cs_total.cs_nffree < uspi->s_space_to_time) | |
| 461 | + usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); | |
| 462 | + } else { | |
| 466 | 463 | request = uspi->s_fpb; |
| 467 | − if (uspi->cs_total.cs_nffree < uspi->s_dsize * | |
| 468 | − (uspi->s_minfree - 2) / 100) | |
| 469 | − break; | |
| 470 | − usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); | |
| 471 | − break; | |
| 464 | + if (uspi->cs_total.cs_nffree > uspi->s_time_to_space) | |
| 465 | + usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTSPACE); | |
| 472 | 466 | } |
| 473 | 467 | result = ufs_alloc_fragments (inode, cgno, goal, request, err); |
| 474 | 468 | if (result) { |
| 475 | 469 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, |
| 476 | 470 | locked_page != NULL); |
| 471 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
| 477 | 472 | ufs_change_blocknr(inode, fragment - oldcount, oldcount, |
| 478 | 473 | uspi->s_sbbase + tmp, |
| 479 | 474 | uspi->s_sbbase + result, locked_page); |
| 475 | + *err = 0; | |
| 480 | 476 | write_seqlock(&UFS_I(inode)->meta_lock); |
| 481 | 477 | ufs_cpu_to_data_ptr(sb, p, result); |
| 482 | − write_sequnlock(&UFS_I(inode)->meta_lock); | |
| 483 | − *err = 0; | |
| 484 | 478 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, |
| 485 | 479 | fragment + count); |
| 486 | − mutex_unlock(&UFS_SB(sb)->s_lock); | |
| 480 | + write_sequnlock(&UFS_I(inode)->meta_lock); | |
| 487 | 481 | if (newcount < request) |
| 488 | 482 | ufs_free_fragments (inode, result + newcount, request - newcount); |
| 489 | 483 | ufs_free_fragments (inode, tmp, oldcount); |
| @@ -401,13 +401,20 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff · 400 unmodified lines | ||
| 401 | 401 | u64 phys64 = 0; |
| 402 | 402 | unsigned frag = fragment & uspi->s_fpbmask; |
| 403 | 403 | |
| 404 | − if (!create) { | |
| 405 | − phys64 = ufs_frag_map(inode, offsets, depth); | |
| 406 | − if (phys64) | |
| 407 | − map_bh(bh_result, sb, phys64 + frag); | |
| 408 | − return 0; | |
| 409 | − } | |
| 404 | + phys64 = ufs_frag_map(inode, offsets, depth); | |
| 405 | + if (!create) | |
| 406 | + goto done; | |
| 410 | 407 | |
| 408 | + if (phys64) { | |
| 409 | + if (fragment >= UFS_NDIR_FRAGMENT) | |
| 410 | + goto done; | |
| 411 | + read_seqlock_excl(&UFS_I(inode)->meta_lock); | |
| 412 | + if (fragment < UFS_I(inode)->i_lastfrag) { | |
| 413 | + read_sequnlock_excl(&UFS_I(inode)->meta_lock); | |
| 414 | + goto done; | |
| 415 | + } | |
| 416 | + read_sequnlock_excl(&UFS_I(inode)->meta_lock); | |
| 417 | + } | |
| 411 | 418 | /* This code entered only while writing ....? */ |
| 412 | 419 | |
| 413 | 420 | mutex_lock(&UFS_I(inode)->truncate_mutex); |
| @@ -451,6 +458,11 @@ out: · 37 unmodified lines | ||
| 451 | 458 | } |
| 452 | 459 | mutex_unlock(&UFS_I(inode)->truncate_mutex); |
| 453 | 460 | return err; |
| 461 | + | |
| 462 | +done: | |
| 463 | + if (phys64) | |
| 464 | + map_bh(bh_result, sb, phys64 + frag); | |
| 465 | + return 0; | |
| 454 | 466 | } |
| 455 | 467 | |
| 456 | 468 | static int ufs_writepage(struct page *page, struct writeback_control *wbc) |
| @@ -554,10 +566,8 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) · 97 unmodified lines | ||
| 554 | 566 | */ |
| 555 | 567 | inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode); |
| 556 | 568 | set_nlink(inode, fs16_to_cpu(sb, ufs_inode->ui_nlink)); |
| 557 | − if (inode->i_nlink == 0) { | |
| 558 | − ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); | |
| 559 | − return -1; | |
| 560 | − } | |
| 569 | + if (inode->i_nlink == 0) | |
| 570 | + return -ESTALE; | |
| 561 | 571 | |
| 562 | 572 | /* |
| 563 | 573 | * Linux now has 32-bit uid and gid, so we can support EFT. |
| @@ -566,9 +576,9 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) · 2 unmodified lines | ||
| 566 | 576 | i_gid_write(inode, ufs_get_inode_gid(sb, ufs_inode)); |
| 567 | 577 | |
| 568 | 578 | inode->i_size = fs64_to_cpu(sb, ufs_inode->ui_size); |
| 569 | − inode->i_atime.tv_sec = fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec); | |
| 570 | − inode->i_ctime.tv_sec = fs32_to_cpu(sb, ufs_inode->ui_ctime.tv_sec); | |
| 571 | − inode->i_mtime.tv_sec = fs32_to_cpu(sb, ufs_inode->ui_mtime.tv_sec); | |
| 579 | + inode->i_atime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec); | |
| 580 | + inode->i_ctime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_ctime.tv_sec); | |
| 581 | + inode->i_mtime.tv_sec = (signed)fs32_to_cpu(sb, ufs_inode->ui_mtime.tv_sec); | |
| 572 | 582 | inode->i_mtime.tv_nsec = 0; |
| 573 | 583 | inode->i_atime.tv_nsec = 0; |
| 574 | 584 | inode->i_ctime.tv_nsec = 0; |
| @@ -602,10 +612,8 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) · 27 unmodified lines | ||
| 602 | 612 | */ |
| 603 | 613 | inode->i_mode = mode = fs16_to_cpu(sb, ufs2_inode->ui_mode); |
| 604 | 614 | set_nlink(inode, fs16_to_cpu(sb, ufs2_inode->ui_nlink)); |
| 605 | − if (inode->i_nlink == 0) { | |
| 606 | − ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); | |
| 607 | − return -1; | |
| 608 | − } | |
| 615 | + if (inode->i_nlink == 0) | |
| 616 | + return -ESTALE; | |
| 609 | 617 | |
| 610 | 618 | /* |
| 611 | 619 | * Linux now has 32-bit uid and gid, so we can support EFT. |
| @@ -645,7 +653,7 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) · 33 unmodified lines | ||
| 645 | 653 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; |
| 646 | 654 | struct buffer_head * bh; |
| 647 | 655 | struct inode *inode; |
| 648 | − int err; | |
| 656 | + int err = -EIO; | |
| 649 | 657 | |
| 650 | 658 | UFSD("ENTER, ino %lu\n", ino); |
| 651 | 659 | |
| @@ -680,9 +688,10 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) · 28 unmodified lines | ||
| 680 | 688 | err = ufs1_read_inode(inode, |
| 681 | 689 | ufs_inode + ufs_inotofsbo(inode->i_ino)); |
| 682 | 690 | } |
| 683 | − | |
| 691 | + brelse(bh); | |
| 684 | 692 | if (err) |
| 685 | 693 | goto bad_inode; |
| 694 | + | |
| 686 | 695 | inode->i_version++; |
| 687 | 696 | ufsi->i_lastfrag = |
| 688 | 697 | (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift; |
| @@ -691,15 +700,13 @@ struct inode *ufs_iget(struct super_block *sb, unsigned long ino) · 2 unmodified lines | ||
| 691 | 700 | |
| 692 | 701 | ufs_set_inode_ops(inode); |
| 693 | 702 | |
| 694 | − brelse(bh); | |
| 695 | − | |
| 696 | 703 | UFSD("EXIT\n"); |
| 697 | 704 | unlock_new_inode(inode); |
| 698 | 705 | return inode; |
| 699 | 706 | |
| 700 | 707 | bad_inode: |
| 701 | 708 | iget_failed(inode); |
| 702 | − return ERR_PTR(-EIO); | |
| 709 | + return ERR_PTR(err); | |
| 703 | 710 | } |
| 704 | 711 | |
| 705 | 712 | static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode) |
| @@ -874,7 +881,6 @@ static inline void free_data(struct to_free *ctx, u64 from, unsigned count) · 168 unmodified lines | ||
| 874 | 881 | ctx->to = from + count; |
| 875 | 882 | } |
| 876 | 883 | |
| 877 | −#define DIRECT_BLOCK ((inode->i_size + uspi->s_bsize - 1) >> uspi->s_bshift) | |
| 878 | 884 | #define DIRECT_FRAGMENT ((inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift) |
| 879 | 885 | |
| 880 | 886 | static void ufs_trunc_direct(struct inode *inode) |
| @@ -1112,19 +1118,24 @@ static void ufs_truncate_blocks(struct inode *inode) · 231 unmodified lines | ||
| 1112 | 1118 | struct super_block *sb = inode->i_sb; |
| 1113 | 1119 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; |
| 1114 | 1120 | unsigned offsets[4]; |
| 1115 | − int depth = ufs_block_to_path(inode, DIRECT_BLOCK, offsets); | |
| 1121 | + int depth; | |
| 1116 | 1122 | int depth2; |
| 1117 | 1123 | unsigned i; |
| 1118 | 1124 | struct ufs_buffer_head *ubh[3]; |
| 1119 | 1125 | void *p; |
| 1120 | 1126 | u64 block; |
| 1121 | 1127 | |
| 1122 | − if (!depth) | |
| 1123 | − return; | |
| 1128 | + if (inode->i_size) { | |
| 1129 | + sector_t last = (inode->i_size - 1) >> uspi->s_bshift; | |
| 1130 | + depth = ufs_block_to_path(inode, last, offsets); | |
| 1131 | + if (!depth) | |
| 1132 | + return; | |
| 1133 | + } else { | |
| 1134 | + depth = 1; | |
| 1135 | + } | |
| 1124 | 1136 | |
| 1125 | − /* find the last non-zero in offsets[] */ | |
| 1126 | 1137 | for (depth2 = depth - 1; depth2; depth2--) |
| 1127 | − if (offsets[depth2]) | |
| 1138 | + if (offsets[depth2] != uspi->s_apb - 1) | |
| 1128 | 1139 | break; |
| 1129 | 1140 | |
| 1130 | 1141 | mutex_lock(&ufsi->truncate_mutex); |
| @@ -1133,9 +1144,8 @@ static void ufs_truncate_blocks(struct inode *inode) · 2 unmodified lines | ||
| 1133 | 1144 | offsets[0] = UFS_IND_BLOCK; |
| 1134 | 1145 | } else { |
| 1135 | 1146 | /* get the blocks that should be partially emptied */ |
| 1136 | − p = ufs_get_direct_data_ptr(uspi, ufsi, offsets[0]); | |
| 1147 | + p = ufs_get_direct_data_ptr(uspi, ufsi, offsets[0]++); | |
| 1137 | 1148 | for (i = 0; i < depth2; i++) { |
| 1138 | − offsets[i]++; /* next branch is fully freed */ | |
| 1139 | 1149 | block = ufs_data_ptr_to_cpu(sb, p); |
| 1140 | 1150 | if (!block) |
| 1141 | 1151 | break; |
| @@ -1146,7 +1156,7 @@ static void ufs_truncate_blocks(struct inode *inode) · 4 unmodified lines | ||
| 1146 | 1156 | write_sequnlock(&ufsi->meta_lock); |
| 1147 | 1157 | break; |
| 1148 | 1158 | } |
| 1149 | − p = ubh_get_data_ptr(uspi, ubh[i], offsets[i + 1]); | |
| 1159 | + p = ubh_get_data_ptr(uspi, ubh[i], offsets[i + 1]++); | |
| 1150 | 1160 | } |
| 1151 | 1161 | while (i--) |
| 1152 | 1162 | free_branch_tail(inode, offsets[i + 1], ubh[i], depth - i - 1); |
| @@ -1161,7 +1171,9 @@ static void ufs_truncate_blocks(struct inode *inode) · 8 unmodified lines | ||
| 1161 | 1171 | free_full_branch(inode, block, i - UFS_IND_BLOCK + 1); |
| 1162 | 1172 | } |
| 1163 | 1173 | } |
| 1174 | + read_seqlock_excl(&ufsi->meta_lock); | |
| 1164 | 1175 | ufsi->i_lastfrag = DIRECT_FRAGMENT; |
| 1176 | + read_sequnlock_excl(&ufsi->meta_lock); | |
| 1165 | 1177 | mark_inode_dirty(inode); |
| 1166 | 1178 | mutex_unlock(&ufsi->truncate_mutex); |
| 1167 | 1179 | } |
| @@ -480,7 +480,7 @@ static void ufs_setup_cstotal(struct super_block *sb) · 479 unmodified lines | ||
| 480 | 480 | usb3 = ubh_get_usb_third(uspi); |
| 481 | 481 | |
| 482 | 482 | if ((mtype == UFS_MOUNT_UFSTYPE_44BSD && |
| 483 | − (usb1->fs_flags & UFS_FLAGS_UPDATED)) || | |
| 483 | + (usb2->fs_un.fs_u2.fs_maxbsize == usb1->fs_bsize)) || | |
| 484 | 484 | mtype == UFS_MOUNT_UFSTYPE_UFS2) { |
| 485 | 485 | /*we have statistic in different place, then usual*/ |
| 486 | 486 | uspi->cs_total.cs_ndir = fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_ndir); |
| @@ -596,9 +596,7 @@ static void ufs_put_cstotal(struct super_block *sb) · 109 unmodified lines | ||
| 596 | 596 | usb2 = ubh_get_usb_second(uspi); |
| 597 | 597 | usb3 = ubh_get_usb_third(uspi); |
| 598 | 598 | |
| 599 | − if ((mtype == UFS_MOUNT_UFSTYPE_44BSD && | |
| 600 | − (usb1->fs_flags & UFS_FLAGS_UPDATED)) || | |
| 601 | − mtype == UFS_MOUNT_UFSTYPE_UFS2) { | |
| 599 | + if (mtype == UFS_MOUNT_UFSTYPE_UFS2) { | |
| 602 | 600 | /*we have statistic in different place, then usual*/ |
| 603 | 601 | usb2->fs_un.fs_u2.cs_ndir = |
| 604 | 602 | cpu_to_fs64(sb, uspi->cs_total.cs_ndir); |
| @@ -608,16 +606,26 @@ static void ufs_put_cstotal(struct super_block *sb) · 3 unmodified lines | ||
| 608 | 606 | cpu_to_fs64(sb, uspi->cs_total.cs_nifree); |
| 609 | 607 | usb3->fs_un1.fs_u2.cs_nffree = |
| 610 | 608 | cpu_to_fs64(sb, uspi->cs_total.cs_nffree); |
| 611 | − } else { | |
| 612 | − usb1->fs_cstotal.cs_ndir = | |
| 613 | − cpu_to_fs32(sb, uspi->cs_total.cs_ndir); | |
| 614 | − usb1->fs_cstotal.cs_nbfree = | |
| 615 | − cpu_to_fs32(sb, uspi->cs_total.cs_nbfree); | |
| 616 | − usb1->fs_cstotal.cs_nifree = | |
| 617 | − cpu_to_fs32(sb, uspi->cs_total.cs_nifree); | |
| 618 | − usb1->fs_cstotal.cs_nffree = | |
| 619 | − cpu_to_fs32(sb, uspi->cs_total.cs_nffree); | |
| 609 | + goto out; | |
| 610 | + } | |
| 611 | + | |
| 612 | + if (mtype == UFS_MOUNT_UFSTYPE_44BSD && | |
| 613 | + (usb2->fs_un.fs_u2.fs_maxbsize == usb1->fs_bsize)) { | |
| 614 | + /* store stats in both old and new places */ | |
| 615 | + usb2->fs_un.fs_u2.cs_ndir = | |
| 616 | + cpu_to_fs64(sb, uspi->cs_total.cs_ndir); | |
| 617 | + usb2->fs_un.fs_u2.cs_nbfree = | |
| 618 | + cpu_to_fs64(sb, uspi->cs_total.cs_nbfree); | |
| 619 | + usb3->fs_un1.fs_u2.cs_nifree = | |
| 620 | + cpu_to_fs64(sb, uspi->cs_total.cs_nifree); | |
| 621 | + usb3->fs_un1.fs_u2.cs_nffree = | |
| 622 | + cpu_to_fs64(sb, uspi->cs_total.cs_nffree); | |
| 620 | 623 | } |
| 624 | + usb1->fs_cstotal.cs_ndir = cpu_to_fs32(sb, uspi->cs_total.cs_ndir); | |
| 625 | + usb1->fs_cstotal.cs_nbfree = cpu_to_fs32(sb, uspi->cs_total.cs_nbfree); | |
| 626 | + usb1->fs_cstotal.cs_nifree = cpu_to_fs32(sb, uspi->cs_total.cs_nifree); | |
| 627 | + usb1->fs_cstotal.cs_nffree = cpu_to_fs32(sb, uspi->cs_total.cs_nffree); | |
| 628 | +out: | |
| 621 | 629 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); |
| 622 | 630 | ufs_print_super_stuff(sb, usb1, usb2, usb3); |
| 623 | 631 | UFSD("EXIT\n"); |
| @@ -996,6 +1004,13 @@ again: · 372 unmodified lines | ||
| 996 | 1004 | flags |= UFS_ST_SUN; |
| 997 | 1005 | } |
| 998 | 1006 | |
| 1007 | + if ((flags & UFS_ST_MASK) == UFS_ST_44BSD && | |
| 1008 | + uspi->s_postblformat == UFS_42POSTBLFMT) { | |
| 1009 | + if (!silent) | |
| 1010 | + pr_err("this is not a 44bsd filesystem"); | |
| 1011 | + goto failed; | |
| 1012 | + } | |
| 1013 | + | |
| 999 | 1014 | /* |
| 1000 | 1015 | * Check ufs magic number |
| 1001 | 1016 | */ |
| @@ -1143,8 +1158,8 @@ magic_found: · 141 unmodified lines | ||
| 1143 | 1158 | uspi->s_cgmask = fs32_to_cpu(sb, usb1->fs_cgmask); |
| 1144 | 1159 | |
| 1145 | 1160 | if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { |
| 1146 | − uspi->s_u2_size = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size); | |
| 1147 | − uspi->s_u2_dsize = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_dsize); | |
| 1161 | + uspi->s_size = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size); | |
| 1162 | + uspi->s_dsize = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_dsize); | |
| 1148 | 1163 | } else { |
| 1149 | 1164 | uspi->s_size = fs32_to_cpu(sb, usb1->fs_size); |
| 1150 | 1165 | uspi->s_dsize = fs32_to_cpu(sb, usb1->fs_dsize); |
| @@ -1193,6 +1208,18 @@ magic_found: · 42 unmodified lines | ||
| 1193 | 1208 | uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff); |
| 1194 | 1209 | uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff); |
| 1195 | 1210 | |
| 1211 | + uspi->s_root_blocks = mul_u64_u32_div(uspi->s_dsize, | |
| 1212 | + uspi->s_minfree, 100); | |
| 1213 | + if (uspi->s_minfree <= 5) { | |
| 1214 | + uspi->s_time_to_space = ~0ULL; | |
| 1215 | + uspi->s_space_to_time = 0; | |
| 1216 | + usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTSPACE); | |
| 1217 | + } else { | |
| 1218 | + uspi->s_time_to_space = (uspi->s_root_blocks / 2) + 1; | |
| 1219 | + uspi->s_space_to_time = mul_u64_u32_div(uspi->s_dsize, | |
| 1220 | + uspi->s_minfree - 2, 100) - 1; | |
| 1221 | + } | |
| 1222 | + | |
| 1196 | 1223 | /* |
| 1197 | 1224 | * Compute another frequently used values |
| 1198 | 1225 | */ |
| @@ -1382,19 +1409,17 @@ static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf) · 183 unmodified lines | ||
| 1382 | 1409 | mutex_lock(&UFS_SB(sb)->s_lock); |
| 1383 | 1410 | usb3 = ubh_get_usb_third(uspi); |
| 1384 | 1411 | |
| 1385 | − if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { | |
| 1412 | + if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) | |
| 1386 | 1413 | buf->f_type = UFS2_MAGIC; |
| 1387 | − buf->f_blocks = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_dsize); | |
| 1388 | − } else { | |
| 1414 | + else | |
| 1389 | 1415 | buf->f_type = UFS_MAGIC; |
| 1390 | − buf->f_blocks = uspi->s_dsize; | |
| 1391 | − } | |
| 1392 | − buf->f_bfree = ufs_blkstofrags(uspi->cs_total.cs_nbfree) + | |
| 1393 | − uspi->cs_total.cs_nffree; | |
| 1416 | + | |
| 1417 | + buf->f_blocks = uspi->s_dsize; | |
| 1418 | + buf->f_bfree = ufs_freefrags(uspi); | |
| 1394 | 1419 | buf->f_ffree = uspi->cs_total.cs_nifree; |
| 1395 | 1420 | buf->f_bsize = sb->s_blocksize; |
| 1396 | − buf->f_bavail = (buf->f_bfree > (((long)buf->f_blocks / 100) * uspi->s_minfree)) | |
| 1397 | − ? (buf->f_bfree - (((long)buf->f_blocks / 100) * uspi->s_minfree)) : 0; | |
| 1421 | + buf->f_bavail = (buf->f_bfree > uspi->s_root_blocks) | |
| 1422 | + ? (buf->f_bfree - uspi->s_root_blocks) : 0; | |
| 1398 | 1423 | buf->f_files = uspi->s_ncg * uspi->s_ipg; |
| 1399 | 1424 | buf->f_namelen = UFS_MAXNAMLEN; |
| 1400 | 1425 | buf->f_fsid.val[0] = (u32)id; |
| @@ -733,10 +733,8 @@ struct ufs_sb_private_info { · 732 unmodified lines | ||
| 733 | 733 | __u32 s_dblkno; /* offset of first data after cg */ |
| 734 | 734 | __u32 s_cgoffset; /* cylinder group offset in cylinder */ |
| 735 | 735 | __u32 s_cgmask; /* used to calc mod fs_ntrak */ |
| 736 | − __u32 s_size; /* number of blocks (fragments) in fs */ | |
| 737 | − __u32 s_dsize; /* number of data blocks in fs */ | |
| 738 | − __u64 s_u2_size; /* ufs2: number of blocks (fragments) in fs */ | |
| 739 | − __u64 s_u2_dsize; /*ufs2: number of data blocks in fs */ | |
| 736 | + __u64 s_size; /* number of blocks (fragments) in fs */ | |
| 737 | + __u64 s_dsize; /* number of data blocks in fs */ | |
| 740 | 738 | __u32 s_ncg; /* number of cylinder groups */ |
| 741 | 739 | __u32 s_bsize; /* size of basic blocks */ |
| 742 | 740 | __u32 s_fsize; /* size of fragments */ |
| @@ -793,6 +791,9 @@ struct ufs_sb_private_info { · 50 unmodified lines | ||
| 793 | 791 | __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */ |
| 794 | 792 | __s32 fs_magic; /* filesystem magic */ |
| 795 | 793 | unsigned int s_dirblksize; |
| 794 | + __u64 s_root_blocks; | |
| 795 | + __u64 s_time_to_space; | |
| 796 | + __u64 s_space_to_time; | |
| 796 | 797 | }; |
| 797 | 798 | |
| 798 | 799 | /* |
| @@ -243,9 +243,8 @@ ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi, dev_t dev · 242 unmodified lines | ||
| 243 | 243 | struct page *ufs_get_locked_page(struct address_space *mapping, |
| 244 | 244 | pgoff_t index) |
| 245 | 245 | { |
| 246 | − struct page *page; | |
| 247 | − | |
| 248 | − page = find_lock_page(mapping, index); | |
| 246 | + struct inode *inode = mapping->host; | |
| 247 | + struct page *page = find_lock_page(mapping, index); | |
| 249 | 248 | if (!page) { |
| 250 | 249 | page = read_mapping_page(mapping, index, NULL); |
| 251 | 250 | |
| @@ -253,7 +252,7 @@ struct page *ufs_get_locked_page(struct address_space *mapping, · 1 unmodified line | ||
| 253 | 252 | printk(KERN_ERR "ufs_change_blocknr: " |
| 254 | 253 | "read_mapping_page error: ino %lu, index: %lu\n", |
| 255 | 254 | mapping->host->i_ino, index); |
| 256 | − goto out; | |
| 255 | + return page; | |
| 257 | 256 | } |
| 258 | 257 | |
| 259 | 258 | lock_page(page); |
| @@ -262,8 +261,7 @@ struct page *ufs_get_locked_page(struct address_space *mapping, · 2 unmodified lines | ||
| 262 | 261 | /* Truncate got there first */ |
| 263 | 262 | unlock_page(page); |
| 264 | 263 | put_page(page); |
| 265 | − page = NULL; | |
| 266 | − goto out; | |
| 264 | + return NULL; | |
| 267 | 265 | } |
| 268 | 266 | |
| 269 | 267 | if (!PageUptodate(page) || PageError(page)) { |
| @@ -272,11 +270,12 @@ struct page *ufs_get_locked_page(struct address_space *mapping, · 2 unmodified lines | ||
| 272 | 270 | |
| 273 | 271 | printk(KERN_ERR "ufs_change_blocknr: " |
| 274 | 272 | "can not read page: ino %lu, index: %lu\n", |
| 275 | − mapping->host->i_ino, index); | |
| 273 | + inode->i_ino, index); | |
| 276 | 274 | |
| 277 | − page = ERR_PTR(-EIO); | |
| 275 | + return ERR_PTR(-EIO); | |
| 278 | 276 | } |
| 279 | 277 | } |
| 280 | −out: | |
| 278 | + if (!page_has_buffers(page)) | |
| 279 | + create_empty_buffers(page, 1 << inode->i_blkbits, 0); | |
| 281 | 280 | return page; |
| 282 | 281 | } |
| @@ -350,16 +350,11 @@ static inline void *ubh_get_data_ptr(struct ufs_sb_private_info *uspi, · 349 unmodified lines | ||
| 350 | 350 | #define ubh_blkmap(ubh,begin,bit) \ |
| 351 | 351 | ((*ubh_get_addr(ubh, (begin) + ((bit) >> 3)) >> ((bit) & 7)) & (0xff >> (UFS_MAXFRAG - uspi->s_fpb))) |
| 352 | 352 | |
| 353 | −/* | |
| 354 | − * Determine the number of available frags given a | |
| 355 | − * percentage to hold in reserve. | |
| 356 | − */ | |
| 357 | 353 | static inline u64 |
| 358 | −ufs_freespace(struct ufs_sb_private_info *uspi, int percentreserved) | |
| 354 | +ufs_freefrags(struct ufs_sb_private_info *uspi) | |
| 359 | 355 | { |
| 360 | 356 | return ufs_blkstofrags(uspi->cs_total.cs_nbfree) + |
| 361 | − uspi->cs_total.cs_nffree - | |
| 362 | − (uspi->s_dsize * (percentreserved) / 100); | |
| 357 | + uspi->cs_total.cs_nffree; | |
| 363 | 358 | } |
| 364 | 359 | |
| 365 | 360 | /* |
| @@ -340,9 +340,28 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason) · 339 unmodified lines | ||
| 340 | 340 | bool must_wait, return_to_userland; |
| 341 | 341 | long blocking_state; |
| 342 | 342 | |
| 343 | − BUG_ON(!rwsem_is_locked(&mm->mmap_sem)); | |
| 344 | − | |
| 345 | 343 | ret = VM_FAULT_SIGBUS; |
| 344 | + | |
| 345 | + /* | |
| 346 | + * We don't do userfault handling for the final child pid update. | |
| 347 | + * | |
| 348 | + * We also don't do userfault handling during | |
| 349 | + * coredumping. hugetlbfs has the special | |
| 350 | + * follow_hugetlb_page() to skip missing pages in the | |
| 351 | + * FOLL_DUMP case, anon memory also checks for FOLL_DUMP with | |
| 352 | + * the no_page_table() helper in follow_page_mask(), but the | |
| 353 | + * shmem_vm_ops->fault method is invoked even during | |
| 354 | + * coredumping without mmap_sem and it ends up here. | |
| 355 | + */ | |
| 356 | + if (current->flags & (PF_EXITING|PF_DUMPCORE)) | |
| 357 | + goto out; | |
| 358 | + | |
| 359 | + /* | |
| 360 | + * Coredumping runs without mmap_sem so we can only check that | |
| 361 | + * the mmap_sem is held, if PF_DUMPCORE was not set. | |
| 362 | + */ | |
| 363 | + WARN_ON_ONCE(!rwsem_is_locked(&mm->mmap_sem)); | |
| 364 | + | |
| 346 | 365 | ctx = vmf->vma->vm_userfaultfd_ctx.ctx; |
| 347 | 366 | if (!ctx) |
| 348 | 367 | goto out; |
| @@ -360,12 +379,6 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason) · 11 unmodified lines | ||
| 360 | 379 | if (unlikely(ACCESS_ONCE(ctx->released))) |
| 361 | 380 | goto out; |
| 362 | 381 | |
| 363 | − /* | |
| 364 | − * We don't do userfault handling for the final child pid update. | |
| 365 | − */ | |
| 366 | − if (current->flags & PF_EXITING) | |
| 367 | − goto out; | |
| 368 | − | |
| 369 | 382 | /* |
| 370 | 383 | * Check that we can return VM_FAULT_RETRY. |
| 371 | 384 | * |
| @@ -1316,9 +1316,12 @@ xfs_vm_bmap( · 1315 unmodified lines | ||
| 1316 | 1316 | * The swap code (ab-)uses ->bmap to get a block mapping and then |
| 1317 | 1317 | * bypasseѕ the file system for actual I/O. We really can't allow |
| 1318 | 1318 | * that on reflinks inodes, so we have to skip out here. And yes, |
| 1319 | − * 0 is the magic code for a bmap error.. | |
| 1319 | + * 0 is the magic code for a bmap error. | |
| 1320 | + * | |
| 1321 | + * Since we don't pass back blockdev info, we can't return bmap | |
| 1322 | + * information for rt files either. | |
| 1320 | 1323 | */ |
| 1321 | − if (xfs_is_reflink_inode(ip)) | |
| 1324 | + if (xfs_is_reflink_inode(ip) || XFS_IS_REALTIME_INODE(ip)) | |
| 1322 | 1325 | return 0; |
| 1323 | 1326 | |
| 1324 | 1327 | filemap_write_and_wait(mapping); |
| @@ -117,7 +117,7 @@ static inline void · 116 unmodified lines | ||
| 117 | 117 | __xfs_buf_ioacct_dec( |
| 118 | 118 | struct xfs_buf *bp) |
| 119 | 119 | { |
| 120 | − ASSERT(spin_is_locked(&bp->b_lock)); | |
| 120 | + lockdep_assert_held(&bp->b_lock); | |
| 121 | 121 | |
| 122 | 122 | if (bp->b_state & XFS_BSTATE_IN_FLIGHT) { |
| 123 | 123 | bp->b_state &= ~XFS_BSTATE_IN_FLIGHT; |
| @@ -66,7 +66,6 @@ xfs_inode_alloc( · 65 unmodified lines | ||
| 66 | 66 | |
| 67 | 67 | XFS_STATS_INC(mp, vn_active); |
| 68 | 68 | ASSERT(atomic_read(&ip->i_pincount) == 0); |
| 69 | − ASSERT(!spin_is_locked(&ip->i_flags_lock)); | |
| 70 | 69 | ASSERT(!xfs_isiflocked(ip)); |
| 71 | 70 | ASSERT(ip->i_ino == 0); |
| 72 | 71 | |
| @@ -190,7 +189,7 @@ xfs_perag_set_reclaim_tag( · 117 unmodified lines | ||
| 190 | 189 | { |
| 191 | 190 | struct xfs_mount *mp = pag->pag_mount; |
| 192 | 191 | |
| 193 | − ASSERT(spin_is_locked(&pag->pag_ici_lock)); | |
| 192 | + lockdep_assert_held(&pag->pag_ici_lock); | |
| 194 | 193 | if (pag->pag_ici_reclaimable++) |
| 195 | 194 | return; |
| 196 | 195 | |
| @@ -212,7 +211,7 @@ xfs_perag_clear_reclaim_tag( · 15 unmodified lines | ||
| 212 | 211 | { |
| 213 | 212 | struct xfs_mount *mp = pag->pag_mount; |
| 214 | 213 | |
| 215 | − ASSERT(spin_is_locked(&pag->pag_ici_lock)); | |
| 214 | + lockdep_assert_held(&pag->pag_ici_lock); | |
| 216 | 215 | if (--pag->pag_ici_reclaimable) |
| 217 | 216 | return; |
| 218 | 217 | |
| @@ -210,7 +210,8 @@ struct acpi_device_flags { · 209 unmodified lines | ||
| 210 | 210 | u32 of_compatible_ok:1; |
| 211 | 211 | u32 coherent_dma:1; |
| 212 | 212 | u32 cca_seen:1; |
| 213 | − u32 reserved:20; | |
| 213 | + u32 spi_i2c_slave:1; | |
| 214 | + u32 reserved:19; | |
| 214 | 215 | }; |
| 215 | 216 | |
| 216 | 217 | /* File System */ |
| @@ -374,6 +374,20 @@ struct acpi_table_desc { · 373 unmodified lines | ||
| 374 | 374 | u16 validation_count; |
| 375 | 375 | }; |
| 376 | 376 | |
| 377 | +/* | |
| 378 | + * Maximum value of the validation_count field in struct acpi_table_desc. | |
| 379 | + * When reached, validation_count cannot be changed any more and the table will | |
| 380 | + * be permanently regarded as validated. | |
| 381 | + * | |
| 382 | + * This is to prevent situations in which unbalanced table get/put operations | |
| 383 | + * may cause premature table unmapping in the OS to happen. | |
| 384 | + * | |
| 385 | + * The maximum validation count can be defined to any value, but should be | |
| 386 | + * greater than the maximum number of OS early stage mapping slots to avoid | |
| 387 | + * leaking early stage table mappings to the late stage. | |
| 388 | + */ | |
| 389 | +#define ACPI_MAX_TABLE_VALIDATIONS ACPI_UINT16_MAX | |
| 390 | + | |
| 377 | 391 | /* Masks for Flags field above */ |
| 378 | 392 | |
| 379 | 393 | #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */ |
| @@ -43,6 +43,8 @@ · 42 unmodified lines | ||
| 43 | 43 | #ifndef _DT_BINDINGS_CLK_SUN50I_A64_H_ |
| 44 | 44 | #define _DT_BINDINGS_CLK_SUN50I_A64_H_ |
| 45 | 45 | |
| 46 | +#define CLK_PLL_PERIPH0 11 | |
| 47 | + | |
| 46 | 48 | #define CLK_BUS_MIPI_DSI 28 |
| 47 | 49 | #define CLK_BUS_CE 29 |
| 48 | 50 | #define CLK_BUS_DMA 30 |
| @@ -43,6 +43,8 @@ · 42 unmodified lines | ||
| 43 | 43 | #ifndef _DT_BINDINGS_CLK_SUN8I_H3_H_ |
| 44 | 44 | #define _DT_BINDINGS_CLK_SUN8I_H3_H_ |
| 45 | 45 | |
| 46 | +#define CLK_PLL_PERIPH0 9 | |
| 47 | + | |
| 46 | 48 | #define CLK_CPUX 14 |
| 47 | 49 | |
| 48 | 50 | #define CLK_BUS_CE 20 |
| @@ -391,6 +391,8 @@ struct request_queue { · 390 unmodified lines | ||
| 391 | 391 | int nr_rqs[2]; /* # allocated [a]sync rqs */ |
| 392 | 392 | int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */ |
| 393 | 393 | |
| 394 | + atomic_t shared_hctx_restart; | |
| 395 | + | |
| 394 | 396 | struct blk_queue_stats *stats; |
| 395 | 397 | struct rq_wb *rq_wb; |
| 396 | 398 | |
| @@ -586,6 +588,8 @@ struct request_queue { · 189 unmodified lines | ||
| 586 | 588 | |
| 587 | 589 | size_t cmd_size; |
| 588 | 590 | void *rq_alloc_data; |
| 591 | + | |
| 592 | + struct work_struct release_work; | |
| 589 | 593 | }; |
| 590 | 594 | |
| 591 | 595 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ |
| @@ -74,7 +74,8 @@ extern void config_item_init_type_name(struct config_item *item, · 73 unmodified lines | ||
| 74 | 74 | const char *name, |
| 75 | 75 | struct config_item_type *type); |
| 76 | 76 | |
| 77 | −extern struct config_item * config_item_get(struct config_item *); | |
| 77 | +extern struct config_item *config_item_get(struct config_item *); | |
| 78 | +extern struct config_item *config_item_get_unless_zero(struct config_item *); | |
| 78 | 79 | extern void config_item_put(struct config_item *); |
| 79 | 80 | |
| 80 | 81 | struct config_item_type { |
| @@ -136,7 +136,7 @@ static inline int dmi_name_in_vendors(const char *s) { return 0; } · 135 unmodified lines | ||
| 136 | 136 | static inline int dmi_name_in_serial(const char *s) { return 0; } |
| 137 | 137 | #define dmi_available 0 |
| 138 | 138 | static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *), |
| 139 | − void *private_data) { return -1; } | |
| 139 | + void *private_data) { return -ENXIO; } | |
| 140 | 140 | static inline bool dmi_match(enum dmi_field f, const char *str) |
| 141 | 141 | { return false; } |
| 142 | 142 | static inline void dmi_memdev_name(u16 handle, const char **bank, |
| @@ -1393,12 +1393,6 @@ int clear_page_dirty_for_io(struct page *page); · 1392 unmodified lines | ||
| 1393 | 1393 | |
| 1394 | 1394 | int get_cmdline(struct task_struct *task, char *buffer, int buflen); |
| 1395 | 1395 | |
| 1396 | −/* Is the vma a continuation of the stack vma above it? */ | |
| 1397 | −static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr) | |
| 1398 | −{ | |
| 1399 | − return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); | |
| 1400 | −} | |
| 1401 | − | |
| 1402 | 1396 | static inline bool vma_is_anonymous(struct vm_area_struct *vma) |
| 1403 | 1397 | { |
| 1404 | 1398 | return !vma->vm_ops; |
| @@ -1414,28 +1408,6 @@ bool vma_is_shmem(struct vm_area_struct *vma); · 9 unmodified lines | ||
| 1414 | 1408 | static inline bool vma_is_shmem(struct vm_area_struct *vma) { return false; } |
| 1415 | 1409 | #endif |
| 1416 | 1410 | |
| 1417 | −static inline int stack_guard_page_start(struct vm_area_struct *vma, | |
| 1418 | − unsigned long addr) | |
| 1419 | −{ | |
| 1420 | − return (vma->vm_flags & VM_GROWSDOWN) && | |
| 1421 | − (vma->vm_start == addr) && | |
| 1422 | − !vma_growsdown(vma->vm_prev, addr); | |
| 1423 | −} | |
| 1424 | − | |
| 1425 | −/* Is the vma a continuation of the stack vma below it? */ | |
| 1426 | −static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr) | |
| 1427 | −{ | |
| 1428 | − return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP); | |
| 1429 | −} | |
| 1430 | − | |
| 1431 | −static inline int stack_guard_page_end(struct vm_area_struct *vma, | |
| 1432 | − unsigned long addr) | |
| 1433 | −{ | |
| 1434 | − return (vma->vm_flags & VM_GROWSUP) && | |
| 1435 | − (vma->vm_end == addr) && | |
| 1436 | − !vma_growsup(vma->vm_next, addr); | |
| 1437 | −} | |
| 1438 | − | |
| 1439 | 1411 | int vma_is_stack_for_current(struct vm_area_struct *vma); |
| 1440 | 1412 | |
| 1441 | 1413 | extern unsigned long move_page_tables(struct vm_area_struct *vma, |
| @@ -2222,6 +2194,7 @@ void page_cache_async_readahead(struct address_space *mapping, · 780 unmodified lines | ||
| 2222 | 2194 | pgoff_t offset, |
| 2223 | 2195 | unsigned long size); |
| 2224 | 2196 | |
| 2197 | +extern unsigned long stack_guard_gap; | |
| 2225 | 2198 | /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ |
| 2226 | 2199 | extern int expand_stack(struct vm_area_struct *vma, unsigned long address); |
| 2227 | 2200 | |
| @@ -2250,6 +2223,30 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m · 22 unmodified lines | ||
| 2250 | 2223 | return vma; |
| 2251 | 2224 | } |
| 2252 | 2225 | |
| 2226 | +static inline unsigned long vm_start_gap(struct vm_area_struct *vma) | |
| 2227 | +{ | |
| 2228 | + unsigned long vm_start = vma->vm_start; | |
| 2229 | + | |
| 2230 | + if (vma->vm_flags & VM_GROWSDOWN) { | |
| 2231 | + vm_start -= stack_guard_gap; | |
| 2232 | + if (vm_start > vma->vm_start) | |
| 2233 | + vm_start = 0; | |
| 2234 | + } | |
| 2235 | + return vm_start; | |
| 2236 | +} | |
| 2237 | + | |
| 2238 | +static inline unsigned long vm_end_gap(struct vm_area_struct *vma) | |
| 2239 | +{ | |
| 2240 | + unsigned long vm_end = vma->vm_end; | |
| 2241 | + | |
| 2242 | + if (vma->vm_flags & VM_GROWSUP) { | |
| 2243 | + vm_end += stack_guard_gap; | |
| 2244 | + if (vm_end < vma->vm_end) | |
| 2245 | + vm_end = -PAGE_SIZE; | |
| 2246 | + } | |
| 2247 | + return vm_end; | |
| 2248 | +} | |
| 2249 | + | |
| 2253 | 2250 | static inline unsigned long vma_pages(struct vm_area_struct *vma) |
| 2254 | 2251 | { |
| 2255 | 2252 | return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
| @@ -914,8 +914,7 @@ struct xfrmdev_ops { · 913 unmodified lines | ||
| 914 | 914 | * |
| 915 | 915 | * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu); |
| 916 | 916 | * Called when a user wants to change the Maximum Transfer Unit |
| 917 | − * of a device. If not defined, any request to change MTU will | |
| 918 | − * will return an error. | |
| 917 | + * of a device. | |
| 919 | 918 | * |
| 920 | 919 | * void (*ndo_tx_timeout)(struct net_device *dev); |
| 921 | 920 | * Callback used when the transmitter has not made any progress |
| @@ -1596,8 +1595,8 @@ enum netdev_priv_flags { · 674 unmodified lines | ||
| 1596 | 1595 | * @rtnl_link_state: This enum represents the phases of creating |
| 1597 | 1596 | * a new link |
| 1598 | 1597 | * |
| 1599 | − * @destructor: Called from unregister, | |
| 1600 | − * can be used to call free_netdev | |
| 1598 | + * @needs_free_netdev: Should unregister perform free_netdev? | |
| 1599 | + * @priv_destructor: Called from unregister | |
| 1601 | 1600 | * @npinfo: XXX: need comments on this one |
| 1602 | 1601 | * @nd_net: Network namespace this network device is inside |
| 1603 | 1602 | * |
| @@ -1858,7 +1857,8 @@ struct net_device { · 254 unmodified lines | ||
| 1858 | 1857 | RTNL_LINK_INITIALIZING, |
| 1859 | 1858 | } rtnl_link_state:16; |
| 1860 | 1859 | |
| 1861 | − void (*destructor)(struct net_device *dev); | |
| 1860 | + bool needs_free_netdev; | |
| 1861 | + void (*priv_destructor)(struct net_device *dev); | |
| 1862 | 1862 | |
| 1863 | 1863 | #ifdef CONFIG_NETPOLL |
| 1864 | 1864 | struct netpoll_info __rcu *npinfo; |
| @@ -4261,6 +4261,11 @@ static inline const char *netdev_name(const struct net_device *dev) · 2396 unmodified lines | ||
| 4261 | 4261 | return dev->name; |
| 4262 | 4262 | } |
| 4263 | 4263 | |
| 4264 | +static inline bool netdev_unregistering(const struct net_device *dev) | |
| 4265 | +{ | |
| 4266 | + return dev->reg_state == NETREG_UNREGISTERING; | |
| 4267 | +} | |
| 4268 | + | |
| 4264 | 4269 | static inline const char *netdev_reg_state(const struct net_device *dev) |
| 4265 | 4270 | { |
| 4266 | 4271 | switch (dev->reg_state) { |
| @@ -84,6 +84,7 @@ struct kmem_cache { · 83 unmodified lines | ||
| 84 | 84 | int red_left_pad; /* Left redzone padding size */ |
| 85 | 85 | #ifdef CONFIG_SYSFS |
| 86 | 86 | struct kobject kobj; /* For sysfs */ |
| 87 | + struct work_struct kobj_remove_work; | |
| 87 | 88 | #endif |
| 88 | 89 | #ifdef CONFIG_MEMCG |
| 89 | 90 | struct memcg_cache_params memcg_params; |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | ||
| 29 | 29 | */ |
| 30 | 30 | struct tk_read_base { |
| 31 | 31 | struct clocksource *clock; |
| 32 | − u64 (*read)(struct clocksource *cs); | |
| 33 | 32 | u64 mask; |
| 34 | 33 | u64 cycle_last; |
| 35 | 34 | u32 mult; |
| @@ -58,7 +57,7 @@ struct tk_read_base { · 22 unmodified lines | ||
| 58 | 57 | * interval. |
| 59 | 58 | * @xtime_remainder: Shifted nano seconds left over when rounding |
| 60 | 59 | * @cycle_interval |
| 61 | − * @raw_interval: Raw nano seconds accumulated per NTP interval. | |
| 60 | + * @raw_interval: Shifted raw nano seconds accumulated per NTP interval. | |
| 62 | 61 | * @ntp_error: Difference between accumulated time and NTP time in ntp |
| 63 | 62 | * shifted nano seconds. |
| 64 | 63 | * @ntp_error_shift: Shift conversion between clock shifted nano seconds and |
| @@ -100,7 +99,7 @@ struct timekeeper { · 35 unmodified lines | ||
| 100 | 99 | u64 cycle_interval; |
| 101 | 100 | u64 xtime_interval; |
| 102 | 101 | s64 xtime_remainder; |
| 103 | − u32 raw_interval; | |
| 102 | + u64 raw_interval; | |
| 104 | 103 | /* The ntp_tick_length() value currently being used. |
| 105 | 104 | * This cached copy ensures we consistently apply the tick |
| 106 | 105 | * length for an entire tick, as ntp_tick_length may change |
| @@ -106,6 +106,16 @@ static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, · 105 unmodified lines | ||
| 106 | 106 | { |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | +static inline void cec_notifier_register(struct cec_notifier *n, | |
| 110 | + struct cec_adapter *adap, | |
| 111 | + void (*callback)(struct cec_adapter *adap, u16 pa)) | |
| 112 | +{ | |
| 113 | +} | |
| 114 | + | |
| 115 | +static inline void cec_notifier_unregister(struct cec_notifier *n) | |
| 116 | +{ | |
| 117 | +} | |
| 118 | + | |
| 109 | 119 | #endif |
| 110 | 120 | |
| 111 | 121 | #endif |
| @@ -206,7 +206,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap) · 205 unmodified lines | ||
| 206 | 206 | #define cec_phys_addr_exp(pa) \ |
| 207 | 207 | ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf |
| 208 | 208 | |
| 209 | −#if IS_ENABLED(CONFIG_CEC_CORE) | |
| 209 | +#if IS_REACHABLE(CONFIG_CEC_CORE) | |
| 210 | 210 | struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, |
| 211 | 211 | void *priv, const char *name, u32 caps, u8 available_las); |
| 212 | 212 | int cec_register_adapter(struct cec_adapter *adap, struct device *parent); |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | struct net; |
| 7 | 7 | |
| 8 | 8 | #ifdef CONFIG_WEXT_CORE |
| 9 | −int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | |
| 9 | +int wext_handle_ioctl(struct net *net, struct iwreq *iwr, unsigned int cmd, | |
| 10 | 10 | void __user *arg); |
| 11 | 11 | int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, |
| 12 | 12 | unsigned long arg); |
| @@ -14,7 +14,7 @@ int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, · 1 unmodified line | ||
| 14 | 14 | struct iw_statistics *get_wireless_stats(struct net_device *dev); |
| 15 | 15 | int call_commit_handler(struct net_device *dev); |
| 16 | 16 | #else |
| 17 | −static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | |
| 17 | +static inline int wext_handle_ioctl(struct net *net, struct iwreq *iwr, unsigned int cmd, | |
| 18 | 18 | void __user *arg) |
| 19 | 19 | { |
| 20 | 20 | return -EINVAL; |
| @@ -1486,8 +1486,10 @@ enum ethtool_link_mode_bit_indices { · 1485 unmodified lines | ||
| 1486 | 1486 | * it was forced up into this mode or autonegotiated. |
| 1487 | 1487 | */ |
| 1488 | 1488 | |
| 1489 | −/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */ | |
| 1490 | −/* Update drivers/net/phy/phy.c:phy_speed_to_str() when adding new values */ | |
| 1489 | +/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. | |
| 1490 | + * Update drivers/net/phy/phy.c:phy_speed_to_str() and | |
| 1491 | + * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values. | |
| 1492 | + */ | |
| 1491 | 1493 | #define SPEED_10 10 |
| 1492 | 1494 | #define SPEED_100 100 |
| 1493 | 1495 | #define SPEED_1000 1000 |
| @@ -343,6 +343,7 @@ enum ovs_key_attr { · 342 unmodified lines | ||
| 343 | 343 | #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) |
| 344 | 344 | |
| 345 | 345 | enum ovs_tunnel_key_attr { |
| 346 | + /* OVS_TUNNEL_KEY_ATTR_NONE, standard nl API requires this attribute! */ | |
| 346 | 347 | OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ |
| 347 | 348 | OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ |
| 348 | 349 | OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ |
| @@ -580,7 +580,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, · 579 unmodified lines | ||
| 580 | 580 | int ret = -ENOMEM, max_order = 0; |
| 581 | 581 | |
| 582 | 582 | if (!has_aux(event)) |
| 583 | − return -ENOTSUPP; | |
| 583 | + return -EOPNOTSUPP; | |
| 584 | 584 | |
| 585 | 585 | if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) { |
| 586 | 586 | /* |
| @@ -1312,8 +1312,10 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) · 1311 unmodified lines | ||
| 1312 | 1312 | ret = __irq_set_trigger(desc, |
| 1313 | 1313 | new->flags & IRQF_TRIGGER_MASK); |
| 1314 | 1314 | |
| 1315 | − if (ret) | |
| 1315 | + if (ret) { | |
| 1316 | + irq_release_resources(desc); | |
| 1316 | 1317 | goto out_mask; |
| 1318 | + } | |
| 1317 | 1319 | } |
| 1318 | 1320 | |
| 1319 | 1321 | desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \ |
| @@ -59,7 +59,11 @@ static void notrace klp_ftrace_handler(unsigned long ip, · 58 unmodified lines | ||
| 59 | 59 | |
| 60 | 60 | ops = container_of(fops, struct klp_ops, fops); |
| 61 | 61 | |
| 62 | − rcu_read_lock(); | |
| 62 | + /* | |
| 63 | + * A variant of synchronize_sched() is used to allow patching functions | |
| 64 | + * where RCU is not watching, see klp_synchronize_transition(). | |
| 65 | + */ | |
| 66 | + preempt_disable_notrace(); | |
| 63 | 67 | |
| 64 | 68 | func = list_first_or_null_rcu(&ops->func_stack, struct klp_func, |
| 65 | 69 | stack_node); |
| @@ -115,7 +119,7 @@ static void notrace klp_ftrace_handler(unsigned long ip, · 49 unmodified lines | ||
| 115 | 119 | |
| 116 | 120 | klp_arch_set_pc(regs, (unsigned long)func->new_func); |
| 117 | 121 | unlock: |
| 118 | − rcu_read_unlock(); | |
| 122 | + preempt_enable_notrace(); | |
| 119 | 123 | } |
| 120 | 124 | |
| 121 | 125 | /* |
| @@ -48,6 +48,28 @@ static void klp_transition_work_fn(struct work_struct *work) · 47 unmodified lines | ||
| 48 | 48 | } |
| 49 | 49 | static DECLARE_DELAYED_WORK(klp_transition_work, klp_transition_work_fn); |
| 50 | 50 | |
| 51 | +/* | |
| 52 | + * This function is just a stub to implement a hard force | |
| 53 | + * of synchronize_sched(). This requires synchronizing | |
| 54 | + * tasks even in userspace and idle. | |
| 55 | + */ | |
| 56 | +static void klp_sync(struct work_struct *work) | |
| 57 | +{ | |
| 58 | +} | |
| 59 | + | |
| 60 | +/* | |
| 61 | + * We allow to patch also functions where RCU is not watching, | |
| 62 | + * e.g. before user_exit(). We can not rely on the RCU infrastructure | |
| 63 | + * to do the synchronization. Instead hard force the sched synchronization. | |
| 64 | + * | |
| 65 | + * This approach allows to use RCU functions for manipulating func_stack | |
| 66 | + * safely. | |
| 67 | + */ | |
| 68 | +static void klp_synchronize_transition(void) | |
| 69 | +{ | |
| 70 | + schedule_on_each_cpu(klp_sync); | |
| 71 | +} | |
| 72 | + | |
| 51 | 73 | /* |
| 52 | 74 | * The transition to the target patch state is complete. Clean up the data |
| 53 | 75 | * structures. |
| @@ -73,7 +95,7 @@ static void klp_complete_transition(void) · 19 unmodified lines | ||
| 73 | 95 | * func->transition gets cleared, the handler may choose a |
| 74 | 96 | * removed function. |
| 75 | 97 | */ |
| 76 | − synchronize_rcu(); | |
| 98 | + klp_synchronize_transition(); | |
| 77 | 99 | } |
| 78 | 100 | |
| 79 | 101 | if (klp_transition_patch->immediate) |
| @@ -92,7 +114,7 @@ static void klp_complete_transition(void) · 12 unmodified lines | ||
| 92 | 114 | |
| 93 | 115 | /* Prevent klp_ftrace_handler() from seeing KLP_UNDEFINED state */ |
| 94 | 116 | if (klp_target_state == KLP_PATCHED) |
| 95 | − synchronize_rcu(); | |
| 117 | + klp_synchronize_transition(); | |
| 96 | 118 | |
| 97 | 119 | read_lock(&tasklist_lock); |
| 98 | 120 | for_each_process_thread(g, task) { |
| @@ -136,7 +158,11 @@ void klp_cancel_transition(void) · 37 unmodified lines | ||
| 136 | 158 | */ |
| 137 | 159 | void klp_update_patch_state(struct task_struct *task) |
| 138 | 160 | { |
| 139 | − rcu_read_lock(); | |
| 161 | + /* | |
| 162 | + * A variant of synchronize_sched() is used to allow patching functions | |
| 163 | + * where RCU is not watching, see klp_synchronize_transition(). | |
| 164 | + */ | |
| 165 | + preempt_disable_notrace(); | |
| 140 | 166 | |
| 141 | 167 | /* |
| 142 | 168 | * This test_and_clear_tsk_thread_flag() call also serves as a read |
| @@ -153,7 +179,7 @@ void klp_update_patch_state(struct task_struct *task) · 10 unmodified lines | ||
| 153 | 179 | if (test_and_clear_tsk_thread_flag(task, TIF_PATCH_PENDING)) |
| 154 | 180 | task->patch_state = READ_ONCE(klp_target_state); |
| 155 | 181 | |
| 156 | − rcu_read_unlock(); | |
| 182 | + preempt_enable_notrace(); | |
| 157 | 183 | } |
| 158 | 184 | |
| 159 | 185 | /* |
| @@ -539,7 +565,7 @@ void klp_reverse_transition(void) · 379 unmodified lines | ||
| 539 | 565 | clear_tsk_thread_flag(idle_task(cpu), TIF_PATCH_PENDING); |
| 540 | 566 | |
| 541 | 567 | /* Let any remaining calls to klp_update_patch_state() complete */ |
| 542 | − synchronize_rcu(); | |
| 568 | + klp_synchronize_transition(); | |
| 543 | 569 | |
| 544 | 570 | klp_start_transition(); |
| 545 | 571 | } |
| @@ -5605,7 +5605,7 @@ void idle_task_exit(void) · 5604 unmodified lines | ||
| 5605 | 5605 | BUG_ON(cpu_online(smp_processor_id())); |
| 5606 | 5606 | |
| 5607 | 5607 | if (mm != &init_mm) { |
| 5608 | − switch_mm_irqs_off(mm, &init_mm, current); | |
| 5608 | + switch_mm(mm, &init_mm, current); | |
| 5609 | 5609 | finish_arch_post_lock_switch(); |
| 5610 | 5610 | } |
| 5611 | 5611 | mmdrop(mm); |
| @@ -101,9 +101,6 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, · 100 unmodified lines | ||
| 101 | 101 | if (sg_policy->next_freq == next_freq) |
| 102 | 102 | return; |
| 103 | 103 | |
| 104 | − if (sg_policy->next_freq > next_freq) | |
| 105 | − next_freq = (sg_policy->next_freq + next_freq) >> 1; | |
| 106 | − | |
| 107 | 104 | sg_policy->next_freq = next_freq; |
| 108 | 105 | sg_policy->last_freq_update_time = time; |
| 109 | 106 | |
| @@ -3563,7 +3563,7 @@ static inline void check_schedstat_required(void) · 3562 unmodified lines | ||
| 3563 | 3563 | trace_sched_stat_runtime_enabled()) { |
| 3564 | 3564 | printk_deferred_once("Scheduler tracepoints stat_sleep, stat_iowait, " |
| 3565 | 3565 | "stat_blocked and stat_runtime require the " |
| 3566 | − "kernel parameter schedstats=enabled or " | |
| 3566 | + "kernel parameter schedstats=enable or " | |
| 3567 | 3567 | "kernel.sched_schedstats=1\n"); |
| 3568 | 3568 | } |
| 3569 | 3569 | #endif |
| @@ -510,7 +510,8 @@ int unhandled_signal(struct task_struct *tsk, int sig) · 509 unmodified lines | ||
| 510 | 510 | return !tsk->ptrace; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | −static void collect_signal(int sig, struct sigpending *list, siginfo_t *info) | |
| 513 | +static void collect_signal(int sig, struct sigpending *list, siginfo_t *info, | |
| 514 | + bool *resched_timer) | |
| 514 | 515 | { |
| 515 | 516 | struct sigqueue *q, *first = NULL; |
| 516 | 517 | |
| @@ -532,6 +533,12 @@ static void collect_signal(int sig, struct sigpending *list, siginfo_t *info) · 15 unmodified lines | ||
| 532 | 533 | still_pending: |
| 533 | 534 | list_del_init(&first->list); |
| 534 | 535 | copy_siginfo(info, &first->info); |
| 536 | + | |
| 537 | + *resched_timer = | |
| 538 | + (first->flags & SIGQUEUE_PREALLOC) && | |
| 539 | + (info->si_code == SI_TIMER) && | |
| 540 | + (info->si_sys_private); | |
| 541 | + | |
| 535 | 542 | __sigqueue_free(first); |
| 536 | 543 | } else { |
| 537 | 544 | /* |
| @@ -548,12 +555,12 @@ still_pending: · 10 unmodified lines | ||
| 548 | 555 | } |
| 549 | 556 | |
| 550 | 557 | static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, |
| 551 | − siginfo_t *info) | |
| 558 | + siginfo_t *info, bool *resched_timer) | |
| 552 | 559 | { |
| 553 | 560 | int sig = next_signal(pending, mask); |
| 554 | 561 | |
| 555 | 562 | if (sig) |
| 556 | − collect_signal(sig, pending, info); | |
| 563 | + collect_signal(sig, pending, info, resched_timer); | |
| 557 | 564 | return sig; |
| 558 | 565 | } |
| 559 | 566 | |
| @@ -565,15 +572,16 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, · 5 unmodified lines | ||
| 565 | 572 | */ |
| 566 | 573 | int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) |
| 567 | 574 | { |
| 575 | + bool resched_timer = false; | |
| 568 | 576 | int signr; |
| 569 | 577 | |
| 570 | 578 | /* We only dequeue private signals from ourselves, we don't let |
| 571 | 579 | * signalfd steal them |
| 572 | 580 | */ |
| 573 | − signr = __dequeue_signal(&tsk->pending, mask, info); | |
| 581 | + signr = __dequeue_signal(&tsk->pending, mask, info, &resched_timer); | |
| 574 | 582 | if (!signr) { |
| 575 | 583 | signr = __dequeue_signal(&tsk->signal->shared_pending, |
| 576 | − mask, info); | |
| 584 | + mask, info, &resched_timer); | |
| 577 | 585 | #ifdef CONFIG_POSIX_TIMERS |
| 578 | 586 | /* |
| 579 | 587 | * itimer signal ? |
| @@ -621,7 +629,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) · 41 unmodified lines | ||
| 621 | 629 | current->jobctl |= JOBCTL_STOP_DEQUEUED; |
| 622 | 630 | } |
| 623 | 631 | #ifdef CONFIG_POSIX_TIMERS |
| 624 | − if ((info->si_code & __SI_MASK) == __SI_TIMER && info->si_sys_private) { | |
| 632 | + if (resched_timer) { | |
| 625 | 633 | /* |
| 626 | 634 | * Release the siglock to ensure proper locking order |
| 627 | 635 | * of timer locks outside of siglocks. Note, we leave |
| @@ -387,7 +387,7 @@ void alarm_start_relative(struct alarm *alarm, ktime_t start) · 386 unmodified lines | ||
| 387 | 387 | { |
| 388 | 388 | struct alarm_base *base = &alarm_bases[alarm->type]; |
| 389 | 389 | |
| 390 | − start = ktime_add(start, base->gettime()); | |
| 390 | + start = ktime_add_safe(start, base->gettime()); | |
| 391 | 391 | alarm_start(alarm, start); |
| 392 | 392 | } |
| 393 | 393 | EXPORT_SYMBOL_GPL(alarm_start_relative); |
| @@ -475,7 +475,7 @@ u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval) · 81 unmodified lines | ||
| 475 | 475 | overrun++; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | − alarm->node.expires = ktime_add(alarm->node.expires, interval); | |
| 478 | + alarm->node.expires = ktime_add_safe(alarm->node.expires, interval); | |
| 479 | 479 | return overrun; |
| 480 | 480 | } |
| 481 | 481 | EXPORT_SYMBOL_GPL(alarm_forward); |
| @@ -660,13 +660,21 @@ static int alarm_timer_set(struct k_itimer *timr, int flags, · 178 unmodified lines | ||
| 660 | 660 | |
| 661 | 661 | /* start the timer */ |
| 662 | 662 | timr->it.alarm.interval = timespec64_to_ktime(new_setting->it_interval); |
| 663 | + | |
| 664 | + /* | |
| 665 | + * Rate limit to the tick as a hot fix to prevent DOS. Will be | |
| 666 | + * mopped up later. | |
| 667 | + */ | |
| 668 | + if (timr->it.alarm.interval < TICK_NSEC) | |
| 669 | + timr->it.alarm.interval = TICK_NSEC; | |
| 670 | + | |
| 663 | 671 | exp = timespec64_to_ktime(new_setting->it_value); |
| 664 | 672 | /* Convert (if necessary) to absolute time */ |
| 665 | 673 | if (flags != TIMER_ABSTIME) { |
| 666 | 674 | ktime_t now; |
| 667 | 675 | |
| 668 | 676 | now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime(); |
| 669 | − exp = ktime_add(now, exp); | |
| 677 | + exp = ktime_add_safe(now, exp); | |
| 670 | 678 | } |
| 671 | 679 | |
| 672 | 680 | alarm_start(&timr->it.alarm.alarmtimer, exp); |
| @@ -37,9 +37,11 @@ static int tick_broadcast_forced; · 36 unmodified lines | ||
| 37 | 37 | static __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(tick_broadcast_lock); |
| 38 | 38 | |
| 39 | 39 | #ifdef CONFIG_TICK_ONESHOT |
| 40 | +static void tick_broadcast_setup_oneshot(struct clock_event_device *bc); | |
| 40 | 41 | static void tick_broadcast_clear_oneshot(int cpu); |
| 41 | 42 | static void tick_resume_broadcast_oneshot(struct clock_event_device *bc); |
| 42 | 43 | #else |
| 44 | +static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } | |
| 43 | 45 | static inline void tick_broadcast_clear_oneshot(int cpu) { } |
| 44 | 46 | static inline void tick_resume_broadcast_oneshot(struct clock_event_device *bc) { } |
| 45 | 47 | #endif |
| @@ -867,7 +869,7 @@ static void tick_broadcast_init_next_event(struct cpumask *mask, · 821 unmodified lines | ||
| 867 | 869 | /** |
| 868 | 870 | * tick_broadcast_setup_oneshot - setup the broadcast device |
| 869 | 871 | */ |
| 870 | −void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |
| 872 | +static void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |
| 871 | 873 | { |
| 872 | 874 | int cpu = smp_processor_id(); |
| 873 | 875 | |
| @@ -126,7 +126,6 @@ static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } · 125 unmodified lines | ||
| 126 | 126 | |
| 127 | 127 | /* Functions related to oneshot broadcasting */ |
| 128 | 128 | #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) |
| 129 | −extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); | |
| 130 | 129 | extern void tick_broadcast_switch_to_oneshot(void); |
| 131 | 130 | extern void tick_shutdown_broadcast_oneshot(unsigned int cpu); |
| 132 | 131 | extern int tick_broadcast_oneshot_active(void); |
| @@ -134,7 +133,6 @@ extern void tick_check_oneshot_broadcast_this_cpu(void); · 1 unmodified line | ||
| 134 | 133 | bool tick_broadcast_oneshot_available(void); |
| 135 | 134 | extern struct cpumask *tick_get_broadcast_oneshot_mask(void); |
| 136 | 135 | #else /* !(BROADCAST && ONESHOT): */ |
| 137 | −static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } | |
| 138 | 136 | static inline void tick_broadcast_switch_to_oneshot(void) { } |
| 139 | 137 | static inline void tick_shutdown_broadcast_oneshot(unsigned int cpu) { } |
| 140 | 138 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
| @@ -118,6 +118,26 @@ static inline void tk_update_sleep_time(struct timekeeper *tk, ktime_t delta) · 117 unmodified lines | ||
| 118 | 118 | tk->offs_boot = ktime_add(tk->offs_boot, delta); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | +/* | |
| 122 | + * tk_clock_read - atomic clocksource read() helper | |
| 123 | + * | |
| 124 | + * This helper is necessary to use in the read paths because, while the | |
| 125 | + * seqlock ensures we don't return a bad value while structures are updated, | |
| 126 | + * it doesn't protect from potential crashes. There is the possibility that | |
| 127 | + * the tkr's clocksource may change between the read reference, and the | |
| 128 | + * clock reference passed to the read function. This can cause crashes if | |
| 129 | + * the wrong clocksource is passed to the wrong read function. | |
| 130 | + * This isn't necessary to use when holding the timekeeper_lock or doing | |
| 131 | + * a read of the fast-timekeeper tkrs (which is protected by its own locking | |
| 132 | + * and update logic). | |
| 133 | + */ | |
| 134 | +static inline u64 tk_clock_read(struct tk_read_base *tkr) | |
| 135 | +{ | |
| 136 | + struct clocksource *clock = READ_ONCE(tkr->clock); | |
| 137 | + | |
| 138 | + return clock->read(clock); | |
| 139 | +} | |
| 140 | + | |
| 121 | 141 | #ifdef CONFIG_DEBUG_TIMEKEEPING |
| 122 | 142 | #define WARNING_FREQ (HZ*300) /* 5 minute rate-limiting */ |
| 123 | 143 | |
| @@ -175,7 +195,7 @@ static inline u64 timekeeping_get_delta(struct tk_read_base *tkr) · 51 unmodified lines | ||
| 175 | 195 | */ |
| 176 | 196 | do { |
| 177 | 197 | seq = read_seqcount_begin(&tk_core.seq); |
| 178 | − now = tkr->read(tkr->clock); | |
| 198 | + now = tk_clock_read(tkr); | |
| 179 | 199 | last = tkr->cycle_last; |
| 180 | 200 | mask = tkr->mask; |
| 181 | 201 | max = tkr->clock->max_cycles; |
| @@ -209,7 +229,7 @@ static inline u64 timekeeping_get_delta(struct tk_read_base *tkr) · 27 unmodified lines | ||
| 209 | 229 | u64 cycle_now, delta; |
| 210 | 230 | |
| 211 | 231 | /* read clocksource */ |
| 212 | − cycle_now = tkr->read(tkr->clock); | |
| 232 | + cycle_now = tk_clock_read(tkr); | |
| 213 | 233 | |
| 214 | 234 | /* calculate the delta since the last update_wall_time */ |
| 215 | 235 | delta = clocksource_delta(cycle_now, tkr->cycle_last, tkr->mask); |
| @@ -238,12 +258,10 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock) · 22 unmodified lines | ||
| 238 | 258 | ++tk->cs_was_changed_seq; |
| 239 | 259 | old_clock = tk->tkr_mono.clock; |
| 240 | 260 | tk->tkr_mono.clock = clock; |
| 241 | − tk->tkr_mono.read = clock->read; | |
| 242 | 261 | tk->tkr_mono.mask = clock->mask; |
| 243 | − tk->tkr_mono.cycle_last = tk->tkr_mono.read(clock); | |
| 262 | + tk->tkr_mono.cycle_last = tk_clock_read(&tk->tkr_mono); | |
| 244 | 263 | |
| 245 | 264 | tk->tkr_raw.clock = clock; |
| 246 | − tk->tkr_raw.read = clock->read; | |
| 247 | 265 | tk->tkr_raw.mask = clock->mask; |
| 248 | 266 | tk->tkr_raw.cycle_last = tk->tkr_mono.cycle_last; |
| 249 | 267 | |
| @@ -262,7 +280,7 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock) · 12 unmodified lines | ||
| 262 | 280 | /* Go back from cycles -> shifted ns */ |
| 263 | 281 | tk->xtime_interval = interval * clock->mult; |
| 264 | 282 | tk->xtime_remainder = ntpinterval - tk->xtime_interval; |
| 265 | − tk->raw_interval = (interval * clock->mult) >> clock->shift; | |
| 283 | + tk->raw_interval = interval * clock->mult; | |
| 266 | 284 | |
| 267 | 285 | /* if changing clocks, convert xtime_nsec shift units */ |
| 268 | 286 | if (old_clock) { |
| @@ -404,7 +422,7 @@ static __always_inline u64 __ktime_get_fast_ns(struct tk_fast *tkf) · 135 unmodified lines | ||
| 404 | 422 | |
| 405 | 423 | now += timekeeping_delta_to_ns(tkr, |
| 406 | 424 | clocksource_delta( |
| 407 | − tkr->read(tkr->clock), | |
| 425 | + tk_clock_read(tkr), | |
| 408 | 426 | tkr->cycle_last, |
| 409 | 427 | tkr->mask)); |
| 410 | 428 | } while (read_seqcount_retry(&tkf->seq, seq)); |
| @@ -461,6 +479,10 @@ static u64 dummy_clock_read(struct clocksource *cs) · 50 unmodified lines | ||
| 461 | 479 | return cycles_at_suspend; |
| 462 | 480 | } |
| 463 | 481 | |
| 482 | +static struct clocksource dummy_clock = { | |
| 483 | + .read = dummy_clock_read, | |
| 484 | +}; | |
| 485 | + | |
| 464 | 486 | /** |
| 465 | 487 | * halt_fast_timekeeper - Prevent fast timekeeper from accessing clocksource. |
| 466 | 488 | * @tk: Timekeeper to snapshot. |
| @@ -477,13 +499,13 @@ static void halt_fast_timekeeper(struct timekeeper *tk) · 10 unmodified lines | ||
| 477 | 499 | struct tk_read_base *tkr = &tk->tkr_mono; |
| 478 | 500 | |
| 479 | 501 | memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); |
| 480 | − cycles_at_suspend = tkr->read(tkr->clock); | |
| 481 | − tkr_dummy.read = dummy_clock_read; | |
| 502 | + cycles_at_suspend = tk_clock_read(tkr); | |
| 503 | + tkr_dummy.clock = &dummy_clock; | |
| 482 | 504 | update_fast_timekeeper(&tkr_dummy, &tk_fast_mono); |
| 483 | 505 | |
| 484 | 506 | tkr = &tk->tkr_raw; |
| 485 | 507 | memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); |
| 486 | − tkr_dummy.read = dummy_clock_read; | |
| 508 | + tkr_dummy.clock = &dummy_clock; | |
| 487 | 509 | update_fast_timekeeper(&tkr_dummy, &tk_fast_raw); |
| 488 | 510 | } |
| 489 | 511 | |
| @@ -649,11 +671,10 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action) · 159 unmodified lines | ||
| 649 | 671 | */ |
| 650 | 672 | static void timekeeping_forward_now(struct timekeeper *tk) |
| 651 | 673 | { |
| 652 | − struct clocksource *clock = tk->tkr_mono.clock; | |
| 653 | 674 | u64 cycle_now, delta; |
| 654 | 675 | u64 nsec; |
| 655 | 676 | |
| 656 | − cycle_now = tk->tkr_mono.read(clock); | |
| 677 | + cycle_now = tk_clock_read(&tk->tkr_mono); | |
| 657 | 678 | delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, tk->tkr_mono.mask); |
| 658 | 679 | tk->tkr_mono.cycle_last = cycle_now; |
| 659 | 680 | tk->tkr_raw.cycle_last = cycle_now; |
| @@ -929,8 +950,7 @@ void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot) · 269 unmodified lines | ||
| 929 | 950 | |
| 930 | 951 | do { |
| 931 | 952 | seq = read_seqcount_begin(&tk_core.seq); |
| 932 | − | |
| 933 | − now = tk->tkr_mono.read(tk->tkr_mono.clock); | |
| 953 | + now = tk_clock_read(&tk->tkr_mono); | |
| 934 | 954 | systime_snapshot->cs_was_changed_seq = tk->cs_was_changed_seq; |
| 935 | 955 | systime_snapshot->clock_was_set_seq = tk->clock_was_set_seq; |
| 936 | 956 | base_real = ktime_add(tk->tkr_mono.base, |
| @@ -1108,7 +1128,7 @@ int get_device_system_crosststamp(int (*get_time_fn) · 171 unmodified lines | ||
| 1108 | 1128 | * Check whether the system counter value provided by the |
| 1109 | 1129 | * device driver is on the current timekeeping interval. |
| 1110 | 1130 | */ |
| 1111 | − now = tk->tkr_mono.read(tk->tkr_mono.clock); | |
| 1131 | + now = tk_clock_read(&tk->tkr_mono); | |
| 1112 | 1132 | interval_start = tk->tkr_mono.cycle_last; |
| 1113 | 1133 | if (!cycle_between(interval_start, cycles, now)) { |
| 1114 | 1134 | clock_was_set_seq = tk->clock_was_set_seq; |
| @@ -1629,7 +1649,7 @@ void timekeeping_resume(void) · 514 unmodified lines | ||
| 1629 | 1649 | * The less preferred source will only be tried if there is no better |
| 1630 | 1650 | * usable source. The rtc part is handled separately in rtc core code. |
| 1631 | 1651 | */ |
| 1632 | − cycle_now = tk->tkr_mono.read(clock); | |
| 1652 | + cycle_now = tk_clock_read(&tk->tkr_mono); | |
| 1633 | 1653 | if ((clock->flags & CLOCK_SOURCE_SUSPEND_NONSTOP) && |
| 1634 | 1654 | cycle_now > tk->tkr_mono.cycle_last) { |
| 1635 | 1655 | u64 nsec, cyc_delta; |
| @@ -1976,7 +1996,7 @@ static u64 logarithmic_accumulation(struct timekeeper *tk, u64 offset, · 340 unmodified lines | ||
| 1976 | 1996 | u32 shift, unsigned int *clock_set) |
| 1977 | 1997 | { |
| 1978 | 1998 | u64 interval = tk->cycle_interval << shift; |
| 1979 | − u64 raw_nsecs; | |
| 1999 | + u64 snsec_per_sec; | |
| 1980 | 2000 | |
| 1981 | 2001 | /* If the offset is smaller than a shifted interval, do nothing */ |
| 1982 | 2002 | if (offset < interval) |
| @@ -1991,14 +2011,15 @@ static u64 logarithmic_accumulation(struct timekeeper *tk, u64 offset, · 8 unmodified lines | ||
| 1991 | 2011 | *clock_set |= accumulate_nsecs_to_secs(tk); |
| 1992 | 2012 | |
| 1993 | 2013 | /* Accumulate raw time */ |
| 1994 | − raw_nsecs = (u64)tk->raw_interval << shift; | |
| 1995 | − raw_nsecs += tk->raw_time.tv_nsec; | |
| 1996 | − if (raw_nsecs >= NSEC_PER_SEC) { | |
| 1997 | − u64 raw_secs = raw_nsecs; | |
| 1998 | − raw_nsecs = do_div(raw_secs, NSEC_PER_SEC); | |
| 1999 | − tk->raw_time.tv_sec += raw_secs; | |
| 2014 | + tk->tkr_raw.xtime_nsec += (u64)tk->raw_time.tv_nsec << tk->tkr_raw.shift; | |
| 2015 | + tk->tkr_raw.xtime_nsec += tk->raw_interval << shift; | |
| 2016 | + snsec_per_sec = (u64)NSEC_PER_SEC << tk->tkr_raw.shift; | |
| 2017 | + while (tk->tkr_raw.xtime_nsec >= snsec_per_sec) { | |
| 2018 | + tk->tkr_raw.xtime_nsec -= snsec_per_sec; | |
| 2019 | + tk->raw_time.tv_sec++; | |
| 2000 | 2020 | } |
| 2001 | − tk->raw_time.tv_nsec = raw_nsecs; | |
| 2021 | + tk->raw_time.tv_nsec = tk->tkr_raw.xtime_nsec >> tk->tkr_raw.shift; | |
| 2022 | + tk->tkr_raw.xtime_nsec -= (u64)tk->raw_time.tv_nsec << tk->tkr_raw.shift; | |
| 2002 | 2023 | |
| 2003 | 2024 | /* Accumulate error between NTP and clock interval */ |
| 2004 | 2025 | tk->ntp_error += tk->ntp_tick << shift; |
| @@ -2030,7 +2051,7 @@ void update_wall_time(void) · 25 unmodified lines | ||
| 2030 | 2051 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET |
| 2031 | 2052 | offset = real_tk->cycle_interval; |
| 2032 | 2053 | #else |
| 2033 | − offset = clocksource_delta(tk->tkr_mono.read(tk->tkr_mono.clock), | |
| 2054 | + offset = clocksource_delta(tk_clock_read(&tk->tkr_mono), | |
| 2034 | 2055 | tk->tkr_mono.cycle_last, tk->tkr_mono.mask); |
| 2035 | 2056 | #endif |
| 2036 | 2057 | |
| @@ -23,14 +23,14 @@ · 22 unmodified lines | ||
| 23 | 23 | * the values[M, M+1, ..., N] into the ints array in get_options. |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | −static int get_range(char **str, int *pint) | |
| 26 | +static int get_range(char **str, int *pint, int n) | |
| 27 | 27 | { |
| 28 | 28 | int x, inc_counter, upper_range; |
| 29 | 29 | |
| 30 | 30 | (*str)++; |
| 31 | 31 | upper_range = simple_strtol((*str), NULL, 0); |
| 32 | 32 | inc_counter = upper_range - *pint; |
| 33 | − for (x = *pint; x < upper_range; x++) | |
| 33 | + for (x = *pint; n && x < upper_range; x++, n--) | |
| 34 | 34 | *pint++ = x; |
| 35 | 35 | return inc_counter; |
| 36 | 36 | } |
| @@ -97,7 +97,7 @@ char *get_options(const char *str, int nints, int *ints) · 60 unmodified lines | ||
| 97 | 97 | break; |
| 98 | 98 | if (res == 3) { |
| 99 | 99 | int range_nums; |
| 100 | − range_nums = get_range((char **)&str, ints + i); | |
| 100 | + range_nums = get_range((char **)&str, ints + i, nints - i); | |
| 101 | 101 | if (range_nums < 0) |
| 102 | 102 | break; |
| 103 | 103 | /* |
| @@ -43,7 +43,7 @@ static struct crypto_shash *tfm; · 42 unmodified lines | ||
| 43 | 43 | u32 crc32c(u32 crc, const void *address, unsigned int length) |
| 44 | 44 | { |
| 45 | 45 | SHASH_DESC_ON_STACK(shash, tfm); |
| 46 | − u32 *ctx = (u32 *)shash_desc_ctx(shash); | |
| 46 | + u32 ret, *ctx = (u32 *)shash_desc_ctx(shash); | |
| 47 | 47 | int err; |
| 48 | 48 | |
| 49 | 49 | shash->tfm = tfm; |
| @@ -53,7 +53,9 @@ u32 crc32c(u32 crc, const void *address, unsigned int length) · 3 unmodified lines | ||
| 53 | 53 | err = crypto_shash_update(shash, address, length); |
| 54 | 54 | BUG_ON(err); |
| 55 | 55 | |
| 56 | − return *ctx; | |
| 56 | + ret = *ctx; | |
| 57 | + barrier_data(ctx); | |
| 58 | + return ret; | |
| 57 | 59 | } |
| 58 | 60 | |
| 59 | 61 | EXPORT_SYMBOL(crc32c); |
| @@ -387,11 +387,6 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, · 386 unmodified lines | ||
| 387 | 387 | /* mlock all present pages, but do not fault in new pages */ |
| 388 | 388 | if ((*flags & (FOLL_POPULATE | FOLL_MLOCK)) == FOLL_MLOCK) |
| 389 | 389 | return -ENOENT; |
| 390 | − /* For mm_populate(), just skip the stack guard page. */ | |
| 391 | − if ((*flags & FOLL_POPULATE) && | |
| 392 | − (stack_guard_page_start(vma, address) || | |
| 393 | − stack_guard_page_end(vma, address + PAGE_SIZE))) | |
| 394 | − return -ENOENT; | |
| 395 | 390 | if (*flags & FOLL_WRITE) |
| 396 | 391 | fault_flags |= FAULT_FLAG_WRITE; |
| 397 | 392 | if (*flags & FOLL_REMOTE) |
| @@ -1426,8 +1426,11 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd) · 1425 unmodified lines | ||
| 1426 | 1426 | */ |
| 1427 | 1427 | if (unlikely(pmd_trans_migrating(*vmf->pmd))) { |
| 1428 | 1428 | page = pmd_page(*vmf->pmd); |
| 1429 | + if (!get_page_unless_zero(page)) | |
| 1430 | + goto out_unlock; | |
| 1429 | 1431 | spin_unlock(vmf->ptl); |
| 1430 | 1432 | wait_on_page_locked(page); |
| 1433 | + put_page(page); | |
| 1431 | 1434 | goto out; |
| 1432 | 1435 | } |
| 1433 | 1436 | |
| @@ -1459,9 +1462,12 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd) · 25 unmodified lines | ||
| 1459 | 1462 | |
| 1460 | 1463 | /* Migration could have started since the pmd_trans_migrating check */ |
| 1461 | 1464 | if (!page_locked) { |
| 1465 | + page_nid = -1; | |
| 1466 | + if (!get_page_unless_zero(page)) | |
| 1467 | + goto out_unlock; | |
| 1462 | 1468 | spin_unlock(vmf->ptl); |
| 1463 | 1469 | wait_on_page_locked(page); |
| 1464 | − page_nid = -1; | |
| 1470 | + put_page(page); | |
| 1465 | 1471 | goto out; |
| 1466 | 1472 | } |
| 1467 | 1473 | |
| @@ -652,7 +652,6 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page, · 651 unmodified lines | ||
| 652 | 652 | spin_unlock(ptl); |
| 653 | 653 | free_page_and_swap_cache(src_page); |
| 654 | 654 | } |
| 655 | − cond_resched(); | |
| 656 | 655 | } |
| 657 | 656 | } |
| 658 | 657 | |
| @@ -1184,7 +1184,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags) · 1183 unmodified lines | ||
| 1184 | 1184 | * page_remove_rmap() in try_to_unmap_one(). So to determine page status |
| 1185 | 1185 | * correctly, we save a copy of the page flags at this time. |
| 1186 | 1186 | */ |
| 1187 | − page_flags = p->flags; | |
| 1187 | + if (PageHuge(p)) | |
| 1188 | + page_flags = hpage->flags; | |
| 1189 | + else | |
| 1190 | + page_flags = p->flags; | |
| 1188 | 1191 | |
| 1189 | 1192 | /* |
| 1190 | 1193 | * unpoison always clear PG_hwpoison inside page lock |
| @@ -2854,40 +2854,6 @@ out_release: · 2853 unmodified lines | ||
| 2854 | 2854 | return ret; |
| 2855 | 2855 | } |
| 2856 | 2856 | |
| 2857 | −/* | |
| 2858 | − * This is like a special single-page "expand_{down|up}wards()", | |
| 2859 | − * except we must first make sure that 'address{-|+}PAGE_SIZE' | |
| 2860 | − * doesn't hit another vma. | |
| 2861 | − */ | |
| 2862 | −static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address) | |
| 2863 | −{ | |
| 2864 | − address &= PAGE_MASK; | |
| 2865 | − if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) { | |
| 2866 | − struct vm_area_struct *prev = vma->vm_prev; | |
| 2867 | − | |
| 2868 | − /* | |
| 2869 | − * Is there a mapping abutting this one below? | |
| 2870 | − * | |
| 2871 | − * That's only ok if it's the same stack mapping | |
| 2872 | − * that has gotten split.. | |
| 2873 | − */ | |
| 2874 | − if (prev && prev->vm_end == address) | |
| 2875 | − return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM; | |
| 2876 | − | |
| 2877 | − return expand_downwards(vma, address - PAGE_SIZE); | |
| 2878 | − } | |
| 2879 | − if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) { | |
| 2880 | − struct vm_area_struct *next = vma->vm_next; | |
| 2881 | − | |
| 2882 | − /* As VM_GROWSDOWN but s/below/above/ */ | |
| 2883 | − if (next && next->vm_start == address + PAGE_SIZE) | |
| 2884 | − return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM; | |
| 2885 | − | |
| 2886 | − return expand_upwards(vma, address + PAGE_SIZE); | |
| 2887 | − } | |
| 2888 | − return 0; | |
| 2889 | −} | |
| 2890 | − | |
| 2891 | 2857 | /* |
| 2892 | 2858 | * We enter with non-exclusive mmap_sem (to exclude vma changes, |
| 2893 | 2859 | * but allow concurrent faults), and pte mapped but not yet locked. |
| @@ -2904,10 +2870,6 @@ static int do_anonymous_page(struct vm_fault *vmf) · 10 unmodified lines | ||
| 2904 | 2870 | if (vma->vm_flags & VM_SHARED) |
| 2905 | 2871 | return VM_FAULT_SIGBUS; |
| 2906 | 2872 | |
| 2907 | − /* Check if we need to add a guard page to the stack */ | |
| 2908 | − if (check_stack_guard_page(vma, vmf->address) < 0) | |
| 2909 | − return VM_FAULT_SIGSEGV; | |
| 2910 | − | |
| 2911 | 2873 | /* |
| 2912 | 2874 | * Use pte_alloc() instead of pte_alloc_map(). We can't run |
| 2913 | 2875 | * pte_offset_map() on pmds where a huge pmd might be created |
| @@ -183,6 +183,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) · 182 unmodified lines | ||
| 183 | 183 | unsigned long retval; |
| 184 | 184 | unsigned long newbrk, oldbrk; |
| 185 | 185 | struct mm_struct *mm = current->mm; |
| 186 | + struct vm_area_struct *next; | |
| 186 | 187 | unsigned long min_brk; |
| 187 | 188 | bool populate; |
| 188 | 189 | LIST_HEAD(uf); |
| @@ -229,7 +230,8 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) · 40 unmodified lines | ||
| 229 | 230 | } |
| 230 | 231 | |
| 231 | 232 | /* Check against existing mmap mappings. */ |
| 232 | − if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE)) | |
| 233 | + next = find_vma(mm, oldbrk); | |
| 234 | + if (next && newbrk + PAGE_SIZE > vm_start_gap(next)) | |
| 233 | 235 | goto out; |
| 234 | 236 | |
| 235 | 237 | /* Ok, looks good - let it rip. */ |
| @@ -253,10 +255,22 @@ out: · 17 unmodified lines | ||
| 253 | 255 | |
| 254 | 256 | static long vma_compute_subtree_gap(struct vm_area_struct *vma) |
| 255 | 257 | { |
| 256 | − unsigned long max, subtree_gap; | |
| 257 | − max = vma->vm_start; | |
| 258 | − if (vma->vm_prev) | |
| 259 | − max -= vma->vm_prev->vm_end; | |
| 258 | + unsigned long max, prev_end, subtree_gap; | |
| 259 | + | |
| 260 | + /* | |
| 261 | + * Note: in the rare case of a VM_GROWSDOWN above a VM_GROWSUP, we | |
| 262 | + * allow two stack_guard_gaps between them here, and when choosing | |
| 263 | + * an unmapped area; whereas when expanding we only require one. | |
| 264 | + * That's a little inconsistent, but keeps the code here simpler. | |
| 265 | + */ | |
| 266 | + max = vm_start_gap(vma); | |
| 267 | + if (vma->vm_prev) { | |
| 268 | + prev_end = vm_end_gap(vma->vm_prev); | |
| 269 | + if (max > prev_end) | |
| 270 | + max -= prev_end; | |
| 271 | + else | |
| 272 | + max = 0; | |
| 273 | + } | |
| 260 | 274 | if (vma->vm_rb.rb_left) { |
| 261 | 275 | subtree_gap = rb_entry(vma->vm_rb.rb_left, |
| 262 | 276 | struct vm_area_struct, vm_rb)->rb_subtree_gap; |
| @@ -352,7 +366,7 @@ static void validate_mm(struct mm_struct *mm) · 89 unmodified lines | ||
| 352 | 366 | anon_vma_unlock_read(anon_vma); |
| 353 | 367 | } |
| 354 | 368 | |
| 355 | − highest_address = vma->vm_end; | |
| 369 | + highest_address = vm_end_gap(vma); | |
| 356 | 370 | vma = vma->vm_next; |
| 357 | 371 | i++; |
| 358 | 372 | } |
| @@ -541,7 +555,7 @@ void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, · 182 unmodified lines | ||
| 541 | 555 | if (vma->vm_next) |
| 542 | 556 | vma_gap_update(vma->vm_next); |
| 543 | 557 | else |
| 544 | − mm->highest_vm_end = vma->vm_end; | |
| 558 | + mm->highest_vm_end = vm_end_gap(vma); | |
| 545 | 559 | |
| 546 | 560 | /* |
| 547 | 561 | * vma->vm_prev wasn't known when we followed the rbtree to find the |
| @@ -856,7 +870,7 @@ again: · 308 unmodified lines | ||
| 856 | 870 | vma_gap_update(vma); |
| 857 | 871 | if (end_changed) { |
| 858 | 872 | if (!next) |
| 859 | − mm->highest_vm_end = end; | |
| 873 | + mm->highest_vm_end = vm_end_gap(vma); | |
| 860 | 874 | else if (!adjust_next) |
| 861 | 875 | vma_gap_update(next); |
| 862 | 876 | } |
| @@ -941,7 +955,7 @@ again: · 78 unmodified lines | ||
| 941 | 955 | * mm->highest_vm_end doesn't need any update |
| 942 | 956 | * in remove_next == 1 case. |
| 943 | 957 | */ |
| 944 | − VM_WARN_ON(mm->highest_vm_end != end); | |
| 958 | + VM_WARN_ON(mm->highest_vm_end != vm_end_gap(vma)); | |
| 945 | 959 | } |
| 946 | 960 | } |
| 947 | 961 | if (insert && file) |
| @@ -1787,7 +1801,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) · 839 unmodified lines | ||
| 1787 | 1801 | |
| 1788 | 1802 | while (true) { |
| 1789 | 1803 | /* Visit left subtree if it looks promising */ |
| 1790 | − gap_end = vma->vm_start; | |
| 1804 | + gap_end = vm_start_gap(vma); | |
| 1791 | 1805 | if (gap_end >= low_limit && vma->vm_rb.rb_left) { |
| 1792 | 1806 | struct vm_area_struct *left = |
| 1793 | 1807 | rb_entry(vma->vm_rb.rb_left, |
| @@ -1798,12 +1812,13 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) · 4 unmodified lines | ||
| 1798 | 1812 | } |
| 1799 | 1813 | } |
| 1800 | 1814 | |
| 1801 | − gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; | |
| 1815 | + gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0; | |
| 1802 | 1816 | check_current: |
| 1803 | 1817 | /* Check if current node has a suitable gap */ |
| 1804 | 1818 | if (gap_start > high_limit) |
| 1805 | 1819 | return -ENOMEM; |
| 1806 | − if (gap_end >= low_limit && gap_end - gap_start >= length) | |
| 1820 | + if (gap_end >= low_limit && | |
| 1821 | + gap_end > gap_start && gap_end - gap_start >= length) | |
| 1807 | 1822 | goto found; |
| 1808 | 1823 | |
| 1809 | 1824 | /* Visit right subtree if it looks promising */ |
| @@ -1825,8 +1840,8 @@ check_current: · 15 unmodified lines | ||
| 1825 | 1840 | vma = rb_entry(rb_parent(prev), |
| 1826 | 1841 | struct vm_area_struct, vm_rb); |
| 1827 | 1842 | if (prev == vma->vm_rb.rb_left) { |
| 1828 | − gap_start = vma->vm_prev->vm_end; | |
| 1829 | − gap_end = vma->vm_start; | |
| 1843 | + gap_start = vm_end_gap(vma->vm_prev); | |
| 1844 | + gap_end = vm_start_gap(vma); | |
| 1830 | 1845 | goto check_current; |
| 1831 | 1846 | } |
| 1832 | 1847 | } |
| @@ -1890,7 +1905,7 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) · 57 unmodified lines | ||
| 1890 | 1905 | |
| 1891 | 1906 | while (true) { |
| 1892 | 1907 | /* Visit right subtree if it looks promising */ |
| 1893 | − gap_start = vma->vm_prev ? vma->vm_prev->vm_end : 0; | |
| 1908 | + gap_start = vma->vm_prev ? vm_end_gap(vma->vm_prev) : 0; | |
| 1894 | 1909 | if (gap_start <= high_limit && vma->vm_rb.rb_right) { |
| 1895 | 1910 | struct vm_area_struct *right = |
| 1896 | 1911 | rb_entry(vma->vm_rb.rb_right, |
| @@ -1903,10 +1918,11 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) · 6 unmodified lines | ||
| 1903 | 1918 | |
| 1904 | 1919 | check_current: |
| 1905 | 1920 | /* Check if current node has a suitable gap */ |
| 1906 | − gap_end = vma->vm_start; | |
| 1921 | + gap_end = vm_start_gap(vma); | |
| 1907 | 1922 | if (gap_end < low_limit) |
| 1908 | 1923 | return -ENOMEM; |
| 1909 | − if (gap_start <= high_limit && gap_end - gap_start >= length) | |
| 1924 | + if (gap_start <= high_limit && | |
| 1925 | + gap_end > gap_start && gap_end - gap_start >= length) | |
| 1910 | 1926 | goto found; |
| 1911 | 1927 | |
| 1912 | 1928 | /* Visit left subtree if it looks promising */ |
| @@ -1929,7 +1945,7 @@ check_current: · 16 unmodified lines | ||
| 1929 | 1945 | struct vm_area_struct, vm_rb); |
| 1930 | 1946 | if (prev == vma->vm_rb.rb_right) { |
| 1931 | 1947 | gap_start = vma->vm_prev ? |
| 1932 | − vma->vm_prev->vm_end : 0; | |
| 1948 | + vm_end_gap(vma->vm_prev) : 0; | |
| 1933 | 1949 | goto check_current; |
| 1934 | 1950 | } |
| 1935 | 1951 | } |
| @@ -1967,7 +1983,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 31 unmodified lines | ||
| 1967 | 1983 | unsigned long len, unsigned long pgoff, unsigned long flags) |
| 1968 | 1984 | { |
| 1969 | 1985 | struct mm_struct *mm = current->mm; |
| 1970 | − struct vm_area_struct *vma; | |
| 1986 | + struct vm_area_struct *vma, *prev; | |
| 1971 | 1987 | struct vm_unmapped_area_info info; |
| 1972 | 1988 | |
| 1973 | 1989 | if (len > TASK_SIZE - mmap_min_addr) |
| @@ -1978,9 +1994,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 4 unmodified lines | ||
| 1978 | 1994 | |
| 1979 | 1995 | if (addr) { |
| 1980 | 1996 | addr = PAGE_ALIGN(addr); |
| 1981 | − vma = find_vma(mm, addr); | |
| 1997 | + vma = find_vma_prev(mm, addr, &prev); | |
| 1982 | 1998 | if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && |
| 1983 | − (!vma || addr + len <= vma->vm_start)) | |
| 1999 | + (!vma || addr + len <= vm_start_gap(vma)) && | |
| 2000 | + (!prev || addr >= vm_end_gap(prev))) | |
| 1984 | 2001 | return addr; |
| 1985 | 2002 | } |
| 1986 | 2003 | |
| @@ -2003,7 +2020,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 16 unmodified lines | ||
| 2003 | 2020 | const unsigned long len, const unsigned long pgoff, |
| 2004 | 2021 | const unsigned long flags) |
| 2005 | 2022 | { |
| 2006 | − struct vm_area_struct *vma; | |
| 2023 | + struct vm_area_struct *vma, *prev; | |
| 2007 | 2024 | struct mm_struct *mm = current->mm; |
| 2008 | 2025 | unsigned long addr = addr0; |
| 2009 | 2026 | struct vm_unmapped_area_info info; |
| @@ -2018,9 +2035,10 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, · 8 unmodified lines | ||
| 2018 | 2035 | /* requesting a specific address */ |
| 2019 | 2036 | if (addr) { |
| 2020 | 2037 | addr = PAGE_ALIGN(addr); |
| 2021 | − vma = find_vma(mm, addr); | |
| 2038 | + vma = find_vma_prev(mm, addr, &prev); | |
| 2022 | 2039 | if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && |
| 2023 | − (!vma || addr + len <= vma->vm_start)) | |
| 2040 | + (!vma || addr + len <= vm_start_gap(vma)) && | |
| 2041 | + (!prev || addr >= vm_end_gap(prev))) | |
| 2024 | 2042 | return addr; |
| 2025 | 2043 | } |
| 2026 | 2044 | |
| @@ -2155,21 +2173,19 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr, · 128 unmodified lines | ||
| 2155 | 2173 | * update accounting. This is shared with both the |
| 2156 | 2174 | * grow-up and grow-down cases. |
| 2157 | 2175 | */ |
| 2158 | −static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow) | |
| 2176 | +static int acct_stack_growth(struct vm_area_struct *vma, | |
| 2177 | + unsigned long size, unsigned long grow) | |
| 2159 | 2178 | { |
| 2160 | 2179 | struct mm_struct *mm = vma->vm_mm; |
| 2161 | 2180 | struct rlimit *rlim = current->signal->rlim; |
| 2162 | − unsigned long new_start, actual_size; | |
| 2181 | + unsigned long new_start; | |
| 2163 | 2182 | |
| 2164 | 2183 | /* address space limit tests */ |
| 2165 | 2184 | if (!may_expand_vm(mm, vma->vm_flags, grow)) |
| 2166 | 2185 | return -ENOMEM; |
| 2167 | 2186 | |
| 2168 | 2187 | /* Stack limit test */ |
| 2169 | − actual_size = size; | |
| 2170 | − if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN))) | |
| 2171 | − actual_size -= PAGE_SIZE; | |
| 2172 | − if (actual_size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) | |
| 2188 | + if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur)) | |
| 2173 | 2189 | return -ENOMEM; |
| 2174 | 2190 | |
| 2175 | 2191 | /* mlock limit tests */ |
| @@ -2207,16 +2223,32 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns · 31 unmodified lines | ||
| 2207 | 2223 | int expand_upwards(struct vm_area_struct *vma, unsigned long address) |
| 2208 | 2224 | { |
| 2209 | 2225 | struct mm_struct *mm = vma->vm_mm; |
| 2226 | + struct vm_area_struct *next; | |
| 2227 | + unsigned long gap_addr; | |
| 2210 | 2228 | int error = 0; |
| 2211 | 2229 | |
| 2212 | 2230 | if (!(vma->vm_flags & VM_GROWSUP)) |
| 2213 | 2231 | return -EFAULT; |
| 2214 | 2232 | |
| 2215 | − /* Guard against wrapping around to address 0. */ | |
| 2216 | − if (address < PAGE_ALIGN(address+4)) | |
| 2217 | − address = PAGE_ALIGN(address+4); | |
| 2218 | − else | |
| 2233 | + /* Guard against exceeding limits of the address space. */ | |
| 2234 | + address &= PAGE_MASK; | |
| 2235 | + if (address >= TASK_SIZE) | |
| 2219 | 2236 | return -ENOMEM; |
| 2237 | + address += PAGE_SIZE; | |
| 2238 | + | |
| 2239 | + /* Enforce stack_guard_gap */ | |
| 2240 | + gap_addr = address + stack_guard_gap; | |
| 2241 | + | |
| 2242 | + /* Guard against overflow */ | |
| 2243 | + if (gap_addr < address || gap_addr > TASK_SIZE) | |
| 2244 | + gap_addr = TASK_SIZE; | |
| 2245 | + | |
| 2246 | + next = vma->vm_next; | |
| 2247 | + if (next && next->vm_start < gap_addr) { | |
| 2248 | + if (!(next->vm_flags & VM_GROWSUP)) | |
| 2249 | + return -ENOMEM; | |
| 2250 | + /* Check that both stack segments have the same anon_vma? */ | |
| 2251 | + } | |
| 2220 | 2252 | |
| 2221 | 2253 | /* We must make sure the anon_vma is allocated. */ |
| 2222 | 2254 | if (unlikely(anon_vma_prepare(vma))) |
| @@ -2261,7 +2293,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) · 38 unmodified lines | ||
| 2261 | 2293 | if (vma->vm_next) |
| 2262 | 2294 | vma_gap_update(vma->vm_next); |
| 2263 | 2295 | else |
| 2264 | − mm->highest_vm_end = address; | |
| 2296 | + mm->highest_vm_end = vm_end_gap(vma); | |
| 2265 | 2297 | spin_unlock(&mm->page_table_lock); |
| 2266 | 2298 | |
| 2267 | 2299 | perf_event_mmap(vma); |
| @@ -2282,6 +2314,8 @@ int expand_downwards(struct vm_area_struct *vma, · 14 unmodified lines | ||
| 2282 | 2314 | unsigned long address) |
| 2283 | 2315 | { |
| 2284 | 2316 | struct mm_struct *mm = vma->vm_mm; |
| 2317 | + struct vm_area_struct *prev; | |
| 2318 | + unsigned long gap_addr; | |
| 2285 | 2319 | int error; |
| 2286 | 2320 | |
| 2287 | 2321 | address &= PAGE_MASK; |
| @@ -2289,6 +2323,17 @@ int expand_downwards(struct vm_area_struct *vma, · 1 unmodified line | ||
| 2289 | 2323 | if (error) |
| 2290 | 2324 | return error; |
| 2291 | 2325 | |
| 2326 | + /* Enforce stack_guard_gap */ | |
| 2327 | + gap_addr = address - stack_guard_gap; | |
| 2328 | + if (gap_addr > address) | |
| 2329 | + return -ENOMEM; | |
| 2330 | + prev = vma->vm_prev; | |
| 2331 | + if (prev && prev->vm_end > gap_addr) { | |
| 2332 | + if (!(prev->vm_flags & VM_GROWSDOWN)) | |
| 2333 | + return -ENOMEM; | |
| 2334 | + /* Check that both stack segments have the same anon_vma? */ | |
| 2335 | + } | |
| 2336 | + | |
| 2292 | 2337 | /* We must make sure the anon_vma is allocated. */ |
| 2293 | 2338 | if (unlikely(anon_vma_prepare(vma))) |
| 2294 | 2339 | return -ENOMEM; |
| @@ -2343,28 +2388,25 @@ int expand_downwards(struct vm_area_struct *vma, · 48 unmodified lines | ||
| 2343 | 2388 | return error; |
| 2344 | 2389 | } |
| 2345 | 2390 | |
| 2346 | −/* | |
| 2347 | − * Note how expand_stack() refuses to expand the stack all the way to | |
| 2348 | − * abut the next virtual mapping, *unless* that mapping itself is also | |
| 2349 | − * a stack mapping. We want to leave room for a guard page, after all | |
| 2350 | − * (the guard page itself is not added here, that is done by the | |
| 2351 | − * actual page faulting logic) | |
| 2352 | − * | |
| 2353 | − * This matches the behavior of the guard page logic (see mm/memory.c: | |
| 2354 | − * check_stack_guard_page()), which only allows the guard page to be | |
| 2355 | − * removed under these circumstances. | |
| 2356 | − */ | |
| 2391 | +/* enforced gap between the expanding stack and other mappings. */ | |
| 2392 | +unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT; | |
| 2393 | + | |
| 2394 | +static int __init cmdline_parse_stack_guard_gap(char *p) | |
| 2395 | +{ | |
| 2396 | + unsigned long val; | |
| 2397 | + char *endptr; | |
| 2398 | + | |
| 2399 | + val = simple_strtoul(p, &endptr, 10); | |
| 2400 | + if (!*endptr) | |
| 2401 | + stack_guard_gap = val << PAGE_SHIFT; | |
| 2402 | + | |
| 2403 | + return 0; | |
| 2404 | +} | |
| 2405 | +__setup("stack_guard_gap=", cmdline_parse_stack_guard_gap); | |
| 2406 | + | |
| 2357 | 2407 | #ifdef CONFIG_STACK_GROWSUP |
| 2358 | 2408 | int expand_stack(struct vm_area_struct *vma, unsigned long address) |
| 2359 | 2409 | { |
| 2360 | − struct vm_area_struct *next; | |
| 2361 | − | |
| 2362 | − address &= PAGE_MASK; | |
| 2363 | − next = vma->vm_next; | |
| 2364 | − if (next && next->vm_start == address + PAGE_SIZE) { | |
| 2365 | − if (!(next->vm_flags & VM_GROWSUP)) | |
| 2366 | − return -ENOMEM; | |
| 2367 | − } | |
| 2368 | 2410 | return expand_upwards(vma, address); |
| 2369 | 2411 | } |
| 2370 | 2412 | |
| @@ -2386,14 +2428,6 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) · 15 unmodified lines | ||
| 2386 | 2428 | #else |
| 2387 | 2429 | int expand_stack(struct vm_area_struct *vma, unsigned long address) |
| 2388 | 2430 | { |
| 2389 | − struct vm_area_struct *prev; | |
| 2390 | − | |
| 2391 | − address &= PAGE_MASK; | |
| 2392 | − prev = vma->vm_prev; | |
| 2393 | − if (prev && prev->vm_end == address) { | |
| 2394 | − if (!(prev->vm_flags & VM_GROWSDOWN)) | |
| 2395 | − return -ENOMEM; | |
| 2396 | − } | |
| 2397 | 2431 | return expand_downwards(vma, address); |
| 2398 | 2432 | } |
| 2399 | 2433 | |
| @@ -2491,7 +2525,7 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, · 91 unmodified lines | ||
| 2491 | 2525 | vma->vm_prev = prev; |
| 2492 | 2526 | vma_gap_update(vma); |
| 2493 | 2527 | } else |
| 2494 | − mm->highest_vm_end = prev ? prev->vm_end : 0; | |
| 2528 | + mm->highest_vm_end = prev ? vm_end_gap(prev) : 0; | |
| 2495 | 2529 | tail_vma->vm_next = NULL; |
| 2496 | 2530 | |
| 2497 | 2531 | /* Kill the cache */ |
| @@ -5625,6 +5625,28 @@ static char *create_unique_id(struct kmem_cache *s) · 5624 unmodified lines | ||
| 5625 | 5625 | return name; |
| 5626 | 5626 | } |
| 5627 | 5627 | |
| 5628 | +static void sysfs_slab_remove_workfn(struct work_struct *work) | |
| 5629 | +{ | |
| 5630 | + struct kmem_cache *s = | |
| 5631 | + container_of(work, struct kmem_cache, kobj_remove_work); | |
| 5632 | + | |
| 5633 | + if (!s->kobj.state_in_sysfs) | |
| 5634 | + /* | |
| 5635 | + * For a memcg cache, this may be called during | |
| 5636 | + * deactivation and again on shutdown. Remove only once. | |
| 5637 | + * A cache is never shut down before deactivation is | |
| 5638 | + * complete, so no need to worry about synchronization. | |
| 5639 | + */ | |
| 5640 | + return; | |
| 5641 | + | |
| 5642 | +#ifdef CONFIG_MEMCG | |
| 5643 | + kset_unregister(s->memcg_kset); | |
| 5644 | +#endif | |
| 5645 | + kobject_uevent(&s->kobj, KOBJ_REMOVE); | |
| 5646 | + kobject_del(&s->kobj); | |
| 5647 | + kobject_put(&s->kobj); | |
| 5648 | +} | |
| 5649 | + | |
| 5628 | 5650 | static int sysfs_slab_add(struct kmem_cache *s) |
| 5629 | 5651 | { |
| 5630 | 5652 | int err; |
| @@ -5632,6 +5654,8 @@ static int sysfs_slab_add(struct kmem_cache *s) · 1 unmodified line | ||
| 5632 | 5654 | struct kset *kset = cache_kset(s); |
| 5633 | 5655 | int unmergeable = slab_unmergeable(s); |
| 5634 | 5656 | |
| 5657 | + INIT_WORK(&s->kobj_remove_work, sysfs_slab_remove_workfn); | |
| 5658 | + | |
| 5635 | 5659 | if (!kset) { |
| 5636 | 5660 | kobject_init(&s->kobj, &slab_ktype); |
| 5637 | 5661 | return 0; |
| @@ -5695,20 +5719,8 @@ static void sysfs_slab_remove(struct kmem_cache *s) · 57 unmodified lines | ||
| 5695 | 5719 | */ |
| 5696 | 5720 | return; |
| 5697 | 5721 | |
| 5698 | − if (!s->kobj.state_in_sysfs) | |
| 5699 | − /* | |
| 5700 | − * For a memcg cache, this may be called during | |
| 5701 | − * deactivation and again on shutdown. Remove only once. | |
| 5702 | − * A cache is never shut down before deactivation is | |
| 5703 | − * complete, so no need to worry about synchronization. | |
| 5704 | − */ | |
| 5705 | − return; | |
| 5706 | − | |
| 5707 | −#ifdef CONFIG_MEMCG | |
| 5708 | − kset_unregister(s->memcg_kset); | |
| 5709 | −#endif | |
| 5710 | − kobject_uevent(&s->kobj, KOBJ_REMOVE); | |
| 5711 | − kobject_del(&s->kobj); | |
| 5722 | + kobject_get(&s->kobj); | |
| 5723 | + schedule_work(&s->kobj_remove_work); | |
| 5712 | 5724 | } |
| 5713 | 5725 | |
| 5714 | 5726 | void sysfs_slab_release(struct kmem_cache *s) |
| @@ -48,6 +48,9 @@ static int swap_cgroup_prepare(int type) · 47 unmodified lines | ||
| 48 | 48 | if (!page) |
| 49 | 49 | goto not_enough_page; |
| 50 | 50 | ctrl->map[idx] = page; |
| 51 | + | |
| 52 | + if (!(idx % SWAP_CLUSTER_MAX)) | |
| 53 | + cond_resched(); | |
| 51 | 54 | } |
| 52 | 55 | return 0; |
| 53 | 56 | not_enough_page: |
| @@ -287,10 +287,21 @@ struct page *vmalloc_to_page(const void *vmalloc_addr) · 286 unmodified lines | ||
| 287 | 287 | if (p4d_none(*p4d)) |
| 288 | 288 | return NULL; |
| 289 | 289 | pud = pud_offset(p4d, addr); |
| 290 | − if (pud_none(*pud)) | |
| 290 | + | |
| 291 | + /* | |
| 292 | + * Don't dereference bad PUD or PMD (below) entries. This will also | |
| 293 | + * identify huge mappings, which we may encounter on architectures | |
| 294 | + * that define CONFIG_HAVE_ARCH_HUGE_VMAP=y. Such regions will be | |
| 295 | + * identified as vmalloc addresses by is_vmalloc_addr(), but are | |
| 296 | + * not [unambiguously] associated with a struct page, so there is | |
| 297 | + * no correct value to return for them. | |
| 298 | + */ | |
| 299 | + WARN_ON_ONCE(pud_bad(*pud)); | |
| 300 | + if (pud_none(*pud) || pud_bad(*pud)) | |
| 291 | 301 | return NULL; |
| 292 | 302 | pmd = pmd_offset(pud, addr); |
| 293 | − if (pmd_none(*pmd)) | |
| 303 | + WARN_ON_ONCE(pmd_bad(*pmd)); | |
| 304 | + if (pmd_none(*pmd) || pmd_bad(*pmd)) | |
| 294 | 305 | return NULL; |
| 295 | 306 | |
| 296 | 307 | ptep = pte_offset_map(pmd, addr); |
| @@ -115,9 +115,9 @@ static enum vmpressure_levels vmpressure_calc_level(unsigned long scanned, · 114 unmodified lines | ||
| 115 | 115 | unsigned long pressure = 0; |
| 116 | 116 | |
| 117 | 117 | /* |
| 118 | − * reclaimed can be greater than scanned in cases | |
| 119 | − * like THP, where the scanned is 1 and reclaimed | |
| 120 | − * could be 512 | |
| 118 | + * reclaimed can be greater than scanned for things such as reclaimed | |
| 119 | + * slab pages. shrink_node() just adds reclaimed pages without a | |
| 120 | + * related increment to scanned pages. | |
| 121 | 121 | */ |
| 122 | 122 | if (reclaimed >= scanned) |
| 123 | 123 | goto out; |
| @@ -277,7 +277,8 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id) · 276 unmodified lines | ||
| 277 | 277 | return 0; |
| 278 | 278 | |
| 279 | 279 | out_free_newdev: |
| 280 | − free_netdev(new_dev); | |
| 280 | + if (new_dev->reg_state == NETREG_UNINITIALIZED) | |
| 281 | + free_netdev(new_dev); | |
| 281 | 282 | return err; |
| 282 | 283 | } |
| 283 | 284 | |
| @@ -813,7 +813,6 @@ static void vlan_dev_free(struct net_device *dev) · 812 unmodified lines | ||
| 813 | 813 | |
| 814 | 814 | free_percpu(vlan->vlan_pcpu_stats); |
| 815 | 815 | vlan->vlan_pcpu_stats = NULL; |
| 816 | − free_netdev(dev); | |
| 817 | 816 | } |
| 818 | 817 | |
| 819 | 818 | void vlan_setup(struct net_device *dev) |
| @@ -826,7 +825,8 @@ void vlan_setup(struct net_device *dev) · 6 unmodified lines | ||
| 826 | 825 | netif_keep_dst(dev); |
| 827 | 826 | |
| 828 | 827 | dev->netdev_ops = &vlan_netdev_ops; |
| 829 | − dev->destructor = vlan_dev_free; | |
| 828 | + dev->needs_free_netdev = true; | |
| 829 | + dev->priv_destructor = vlan_dev_free; | |
| 830 | 830 | dev->ethtool_ops = &vlan_ethtool_ops; |
| 831 | 831 | |
| 832 | 832 | dev->min_mtu = 0; |
| @@ -1064,8 +1064,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, · 1063 unmodified lines | ||
| 1064 | 1064 | |
| 1065 | 1065 | skb_new->protocol = eth_type_trans(skb_new, soft_iface); |
| 1066 | 1066 | |
| 1067 | − soft_iface->stats.rx_packets++; | |
| 1068 | − soft_iface->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size; | |
| 1067 | + batadv_inc_counter(bat_priv, BATADV_CNT_RX); | |
| 1068 | + batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, | |
| 1069 | + skb->len + ETH_HLEN + hdr_size); | |
| 1069 | 1070 | |
| 1070 | 1071 | netif_rx(skb_new); |
| 1071 | 1072 | batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n"); |
| @@ -987,7 +987,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 986 unmodified lines | ||
| 987 | 987 | batadv_dbg(BATADV_DBG_BLA, bat_priv, |
| 988 | 988 | "recv_unicast_packet(): Dropped unicast pkt received from another backbone gw %pM.\n", |
| 989 | 989 | orig_addr_gw); |
| 990 | − return NET_RX_DROP; | |
| 990 | + goto free_skb; | |
| 991 | 991 | } |
| 992 | 992 | } |
| 993 | 993 | |
| @@ -1034,8 +1034,6 @@ static void batadv_softif_free(struct net_device *dev) · 1033 unmodified lines | ||
| 1034 | 1034 | * netdev and its private data (bat_priv) |
| 1035 | 1035 | */ |
| 1036 | 1036 | rcu_barrier(); |
| 1037 | − | |
| 1038 | − free_netdev(dev); | |
| 1039 | 1037 | } |
| 1040 | 1038 | |
| 1041 | 1039 | /** |
| @@ -1047,7 +1045,8 @@ static void batadv_softif_init_early(struct net_device *dev) · 5 unmodified lines | ||
| 1047 | 1045 | ether_setup(dev); |
| 1048 | 1046 | |
| 1049 | 1047 | dev->netdev_ops = &batadv_netdev_ops; |
| 1050 | − dev->destructor = batadv_softif_free; | |
| 1048 | + dev->needs_free_netdev = true; | |
| 1049 | + dev->priv_destructor = batadv_softif_free; | |
| 1051 | 1050 | dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL; |
| 1052 | 1051 | dev->priv_flags |= IFF_NO_QUEUE; |
| 1053 | 1052 | |
| @@ -598,7 +598,7 @@ static void netdev_setup(struct net_device *dev) · 597 unmodified lines | ||
| 598 | 598 | |
| 599 | 599 | dev->netdev_ops = &netdev_ops; |
| 600 | 600 | dev->header_ops = &header_ops; |
| 601 | − dev->destructor = free_netdev; | |
| 601 | + dev->needs_free_netdev = true; | |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | static struct device_type bt_type = { |
| @@ -379,7 +379,7 @@ void br_dev_setup(struct net_device *dev) · 378 unmodified lines | ||
| 379 | 379 | ether_setup(dev); |
| 380 | 380 | |
| 381 | 381 | dev->netdev_ops = &br_netdev_ops; |
| 382 | − dev->destructor = free_netdev; | |
| 382 | + dev->needs_free_netdev = true; | |
| 383 | 383 | dev->ethtool_ops = &br_ethtool_ops; |
| 384 | 384 | SET_NETDEV_DEVTYPE(dev, &br_type); |
| 385 | 385 | dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE; |
| @@ -754,6 +754,10 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, · 753 unmodified lines | ||
| 754 | 754 | |
| 755 | 755 | lock_sock(sk); |
| 756 | 756 | |
| 757 | + err = -EINVAL; | |
| 758 | + if (addr_len < offsetofend(struct sockaddr, sa_family)) | |
| 759 | + goto out; | |
| 760 | + | |
| 757 | 761 | err = -EAFNOSUPPORT; |
| 758 | 762 | if (uaddr->sa_family != AF_CAIF) |
| 759 | 763 | goto out; |
| @@ -81,11 +81,7 @@ static struct cfpkt *cfpkt_create_pfx(u16 len, u16 pfx) · 80 unmodified lines | ||
| 81 | 81 | { |
| 82 | 82 | struct sk_buff *skb; |
| 83 | 83 | |
| 84 | − if (likely(in_interrupt())) | |
| 85 | − skb = alloc_skb(len + pfx, GFP_ATOMIC); | |
| 86 | − else | |
| 87 | − skb = alloc_skb(len + pfx, GFP_KERNEL); | |
| 88 | − | |
| 84 | + skb = alloc_skb(len + pfx, GFP_ATOMIC); | |
| 89 | 85 | if (unlikely(skb == NULL)) |
| 90 | 86 | return NULL; |
| 91 | 87 | |
| @@ -392,14 +392,14 @@ static void chnl_net_destructor(struct net_device *dev) · 391 unmodified lines | ||
| 392 | 392 | { |
| 393 | 393 | struct chnl_net *priv = netdev_priv(dev); |
| 394 | 394 | caif_free_client(&priv->chnl); |
| 395 | − free_netdev(dev); | |
| 396 | 395 | } |
| 397 | 396 | |
| 398 | 397 | static void ipcaif_net_setup(struct net_device *dev) |
| 399 | 398 | { |
| 400 | 399 | struct chnl_net *priv; |
| 401 | 400 | dev->netdev_ops = &netdev_ops; |
| 402 | − dev->destructor = chnl_net_destructor; | |
| 401 | + dev->needs_free_netdev = true; | |
| 402 | + dev->priv_destructor = chnl_net_destructor; | |
| 403 | 403 | dev->flags |= IFF_NOARP; |
| 404 | 404 | dev->flags |= IFF_POINTOPOINT; |
| 405 | 405 | dev->mtu = GPRS_PDP_MTU; |
| @@ -872,8 +872,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg, · 871 unmodified lines | ||
| 872 | 872 | |
| 873 | 873 | static int can_pernet_init(struct net *net) |
| 874 | 874 | { |
| 875 | − net->can.can_rcvlists_lock = | |
| 876 | − __SPIN_LOCK_UNLOCKED(net->can.can_rcvlists_lock); | |
| 875 | + spin_lock_init(&net->can.can_rcvlists_lock); | |
| 877 | 876 | net->can.can_rx_alldev_list = |
| 878 | 877 | kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL); |
| 879 | 878 | |
| @@ -1253,8 +1253,9 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) · 1252 unmodified lines | ||
| 1253 | 1253 | if (!new_ifalias) |
| 1254 | 1254 | return -ENOMEM; |
| 1255 | 1255 | dev->ifalias = new_ifalias; |
| 1256 | + memcpy(dev->ifalias, alias, len); | |
| 1257 | + dev->ifalias[len] = 0; | |
| 1256 | 1258 | |
| 1257 | − strlcpy(dev->ifalias, alias, len+1); | |
| 1258 | 1259 | return len; |
| 1259 | 1260 | } |
| 1260 | 1261 | |
| @@ -4948,6 +4949,19 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb) · 3687 unmodified lines | ||
| 4948 | 4949 | } |
| 4949 | 4950 | EXPORT_SYMBOL(__skb_gro_checksum_complete); |
| 4950 | 4951 | |
| 4952 | +static void net_rps_send_ipi(struct softnet_data *remsd) | |
| 4953 | +{ | |
| 4954 | +#ifdef CONFIG_RPS | |
| 4955 | + while (remsd) { | |
| 4956 | + struct softnet_data *next = remsd->rps_ipi_next; | |
| 4957 | + | |
| 4958 | + if (cpu_online(remsd->cpu)) | |
| 4959 | + smp_call_function_single_async(remsd->cpu, &remsd->csd); | |
| 4960 | + remsd = next; | |
| 4961 | + } | |
| 4962 | +#endif | |
| 4963 | +} | |
| 4964 | + | |
| 4951 | 4965 | /* |
| 4952 | 4966 | * net_rps_action_and_irq_enable sends any pending IPI's for rps. |
| 4953 | 4967 | * Note: called with local irq disabled, but exits with local irq enabled. |
| @@ -4963,14 +4977,7 @@ static void net_rps_action_and_irq_enable(struct softnet_data *sd) · 9 unmodified lines | ||
| 4963 | 4977 | local_irq_enable(); |
| 4964 | 4978 | |
| 4965 | 4979 | /* Send pending IPI's to kick RPS processing on remote cpus. */ |
| 4966 | − while (remsd) { | |
| 4967 | − struct softnet_data *next = remsd->rps_ipi_next; | |
| 4968 | − | |
| 4969 | − if (cpu_online(remsd->cpu)) | |
| 4970 | − smp_call_function_single_async(remsd->cpu, | |
| 4971 | − &remsd->csd); | |
| 4972 | − remsd = next; | |
| 4973 | − } | |
| 4980 | + net_rps_send_ipi(remsd); | |
| 4974 | 4981 | } else |
| 4975 | 4982 | #endif |
| 4976 | 4983 | local_irq_enable(); |
| @@ -5199,8 +5206,6 @@ static void busy_poll_stop(struct napi_struct *napi, void *have_poll_lock) · 222 unmodified lines | ||
| 5199 | 5206 | if (rc == BUSY_POLL_BUDGET) |
| 5200 | 5207 | __napi_schedule(napi); |
| 5201 | 5208 | local_bh_enable(); |
| 5202 | − if (local_softirq_pending()) | |
| 5203 | − do_softirq(); | |
| 5204 | 5209 | } |
| 5205 | 5210 | |
| 5206 | 5211 | void napi_busy_loop(unsigned int napi_id, |
| @@ -7501,6 +7506,8 @@ out: · 2294 unmodified lines | ||
| 7501 | 7506 | err_uninit: |
| 7502 | 7507 | if (dev->netdev_ops->ndo_uninit) |
| 7503 | 7508 | dev->netdev_ops->ndo_uninit(dev); |
| 7509 | + if (dev->priv_destructor) | |
| 7510 | + dev->priv_destructor(dev); | |
| 7504 | 7511 | goto out; |
| 7505 | 7512 | } |
| 7506 | 7513 | EXPORT_SYMBOL(register_netdevice); |
| @@ -7708,8 +7715,10 @@ void netdev_run_todo(void) · 201 unmodified lines | ||
| 7708 | 7715 | WARN_ON(rcu_access_pointer(dev->ip6_ptr)); |
| 7709 | 7716 | WARN_ON(dev->dn_ptr); |
| 7710 | 7717 | |
| 7711 | − if (dev->destructor) | |
| 7712 | − dev->destructor(dev); | |
| 7718 | + if (dev->priv_destructor) | |
| 7719 | + dev->priv_destructor(dev); | |
| 7720 | + if (dev->needs_free_netdev) | |
| 7721 | + free_netdev(dev); | |
| 7713 | 7722 | |
| 7714 | 7723 | /* Report a network device has been unregistered */ |
| 7715 | 7724 | rtnl_lock(); |
| @@ -8192,7 +8201,7 @@ static int dev_cpu_dead(unsigned int oldcpu) · 476 unmodified lines | ||
| 8192 | 8201 | struct sk_buff **list_skb; |
| 8193 | 8202 | struct sk_buff *skb; |
| 8194 | 8203 | unsigned int cpu; |
| 8195 | − struct softnet_data *sd, *oldsd; | |
| 8204 | + struct softnet_data *sd, *oldsd, *remsd = NULL; | |
| 8196 | 8205 | |
| 8197 | 8206 | local_irq_disable(); |
| 8198 | 8207 | cpu = smp_processor_id(); |
| @@ -8233,6 +8242,13 @@ static int dev_cpu_dead(unsigned int oldcpu) · 34 unmodified lines | ||
| 8233 | 8242 | raise_softirq_irqoff(NET_TX_SOFTIRQ); |
| 8234 | 8243 | local_irq_enable(); |
| 8235 | 8244 | |
| 8245 | +#ifdef CONFIG_RPS | |
| 8246 | + remsd = oldsd->rps_ipi_list; | |
| 8247 | + oldsd->rps_ipi_list = NULL; | |
| 8248 | +#endif | |
| 8249 | + /* send out pending IPI's on offline CPU */ | |
| 8250 | + net_rps_send_ipi(remsd); | |
| 8251 | + | |
| 8236 | 8252 | /* Process offline CPU's input_pkt_queue */ |
| 8237 | 8253 | while ((skb = __skb_dequeue(&oldsd->process_queue))) { |
| 8238 | 8254 | netif_rx_ni(skb); |
| @@ -410,6 +410,22 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) · 409 unmodified lines | ||
| 410 | 410 | if (cmd == SIOCGIFNAME) |
| 411 | 411 | return dev_ifname(net, (struct ifreq __user *)arg); |
| 412 | 412 | |
| 413 | + /* | |
| 414 | + * Take care of Wireless Extensions. Unfortunately struct iwreq | |
| 415 | + * isn't a proper subset of struct ifreq (it's 8 byte shorter) | |
| 416 | + * so we need to treat it specially, otherwise applications may | |
| 417 | + * fault if the struct they're passing happens to land at the | |
| 418 | + * end of a mapped page. | |
| 419 | + */ | |
| 420 | + if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { | |
| 421 | + struct iwreq iwr; | |
| 422 | + | |
| 423 | + if (copy_from_user(&iwr, arg, sizeof(iwr))) | |
| 424 | + return -EFAULT; | |
| 425 | + | |
| 426 | + return wext_handle_ioctl(net, &iwr, cmd, arg); | |
| 427 | + } | |
| 428 | + | |
| 413 | 429 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) |
| 414 | 430 | return -EFAULT; |
| 415 | 431 | |
| @@ -559,9 +575,6 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) · 143 unmodified lines | ||
| 559 | 575 | ret = -EFAULT; |
| 560 | 576 | return ret; |
| 561 | 577 | } |
| 562 | − /* Take care of Wireless Extensions */ | |
| 563 | − if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) | |
| 564 | − return wext_handle_ioctl(net, &ifr, cmd, arg); | |
| 565 | 578 | return -ENOTTY; |
| 566 | 579 | } |
| 567 | 580 | } |
| @@ -469,6 +469,20 @@ static int dst_dev_event(struct notifier_block *this, unsigned long event, · 468 unmodified lines | ||
| 469 | 469 | spin_lock_bh(&dst_garbage.lock); |
| 470 | 470 | dst = dst_garbage.list; |
| 471 | 471 | dst_garbage.list = NULL; |
| 472 | + /* The code in dst_ifdown places a hold on the loopback device. | |
| 473 | + * If the gc entry processing is set to expire after a lengthy | |
| 474 | + * interval, this hold can cause netdev_wait_allrefs() to hang | |
| 475 | + * out and wait for a long time -- until the the loopback | |
| 476 | + * interface is released. If we're really unlucky, it'll emit | |
| 477 | + * pr_emerg messages to console too. Reset the interval here, | |
| 478 | + * so dst cleanups occur in a more timely fashion. | |
| 479 | + */ | |
| 480 | + if (dst_garbage.timer_inc > DST_GC_INC) { | |
| 481 | + dst_garbage.timer_inc = DST_GC_INC; | |
| 482 | + dst_garbage.timer_expires = DST_GC_MIN; | |
| 483 | + mod_delayed_work(system_wq, &dst_gc_work, | |
| 484 | + dst_garbage.timer_expires); | |
| 485 | + } | |
| 472 | 486 | spin_unlock_bh(&dst_garbage.lock); |
| 473 | 487 | |
| 474 | 488 | if (last) |
| @@ -568,7 +568,7 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, · 567 unmodified lines | ||
| 568 | 568 | struct net *net = sock_net(skb->sk); |
| 569 | 569 | struct fib_rule_hdr *frh = nlmsg_data(nlh); |
| 570 | 570 | struct fib_rules_ops *ops = NULL; |
| 571 | − struct fib_rule *rule, *tmp; | |
| 571 | + struct fib_rule *rule, *r; | |
| 572 | 572 | struct nlattr *tb[FRA_MAX+1]; |
| 573 | 573 | struct fib_kuid_range range; |
| 574 | 574 | int err = -EINVAL; |
| @@ -668,16 +668,23 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, · 93 unmodified lines | ||
| 668 | 668 | |
| 669 | 669 | /* |
| 670 | 670 | * Check if this rule is a target to any of them. If so, |
| 671 | + * adjust to the next one with the same preference or | |
| 671 | 672 | * disable them. As this operation is eventually very |
| 672 | − * expensive, it is only performed if goto rules have | |
| 673 | − * actually been added. | |
| 673 | + * expensive, it is only performed if goto rules, except | |
| 674 | + * current if it is goto rule, have actually been added. | |
| 674 | 675 | */ |
| 675 | 676 | if (ops->nr_goto_rules > 0) { |
| 676 | − list_for_each_entry(tmp, &ops->rules_list, list) { | |
| 677 | − if (rtnl_dereference(tmp->ctarget) == rule) { | |
| 678 | − RCU_INIT_POINTER(tmp->ctarget, NULL); | |
| 677 | + struct fib_rule *n; | |
| 678 | + | |
| 679 | + n = list_next_entry(rule, list); | |
| 680 | + if (&n->list == &ops->rules_list || n->pref != rule->pref) | |
| 681 | + n = NULL; | |
| 682 | + list_for_each_entry(r, &ops->rules_list, list) { | |
| 683 | + if (rtnl_dereference(r->ctarget) != rule) | |
| 684 | + continue; | |
| 685 | + rcu_assign_pointer(r->ctarget, n); | |
| 686 | + if (!n) | |
| 679 | 687 | ops->unresolved_rules++; |
| 680 | − } | |
| 681 | 688 | } |
| 682 | 689 | } |
| 683 | 690 | |
| @@ -931,6 +931,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, · 930 unmodified lines | ||
| 931 | 931 | + nla_total_size(1) /* IFLA_LINKMODE */ |
| 932 | 932 | + nla_total_size(4) /* IFLA_CARRIER_CHANGES */ |
| 933 | 933 | + nla_total_size(4) /* IFLA_LINK_NETNSID */ |
| 934 | + + nla_total_size(4) /* IFLA_GROUP */ | |
| 934 | 935 | + nla_total_size(ext_filter_mask |
| 935 | 936 | & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */ |
| 936 | 937 | + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */ |
| @@ -1124,6 +1125,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 187 unmodified lines | ||
| 1124 | 1125 | struct ifla_vf_mac vf_mac; |
| 1125 | 1126 | struct ifla_vf_info ivi; |
| 1126 | 1127 | |
| 1128 | + memset(&ivi, 0, sizeof(ivi)); | |
| 1129 | + | |
| 1127 | 1130 | /* Not all SR-IOV capable drivers support the |
| 1128 | 1131 | * spoofcheck and "RSS query enable" query. Preset to |
| 1129 | 1132 | * -1 so the user space tool can detect that the driver |
| @@ -1132,7 +1135,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 2 unmodified lines | ||
| 1132 | 1135 | ivi.spoofchk = -1; |
| 1133 | 1136 | ivi.rss_query_en = -1; |
| 1134 | 1137 | ivi.trusted = -1; |
| 1135 | − memset(ivi.mac, 0, sizeof(ivi.mac)); | |
| 1136 | 1138 | /* The default value for VF link state is "auto" |
| 1137 | 1139 | * IFLA_VF_LINK_STATE_AUTO which equals zero |
| 1138 | 1140 | */ |
| @@ -1467,6 +1469,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = { · 328 unmodified lines | ||
| 1467 | 1469 | [IFLA_LINK_NETNSID] = { .type = NLA_S32 }, |
| 1468 | 1470 | [IFLA_PROTO_DOWN] = { .type = NLA_U8 }, |
| 1469 | 1471 | [IFLA_XDP] = { .type = NLA_NESTED }, |
| 1472 | + [IFLA_GROUP] = { .type = NLA_U32 }, | |
| 1470 | 1473 | }; |
| 1471 | 1474 | |
| 1472 | 1475 | static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { |
| @@ -188,12 +188,6 @@ static inline void dnrt_free(struct dn_route *rt) · 187 unmodified lines | ||
| 188 | 188 | call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | −static inline void dnrt_drop(struct dn_route *rt) | |
| 192 | −{ | |
| 193 | − dst_release(&rt->dst); | |
| 194 | − call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); | |
| 195 | −} | |
| 196 | − | |
| 197 | 191 | static void dn_dst_check_expire(unsigned long dummy) |
| 198 | 192 | { |
| 199 | 193 | int i; |
| @@ -248,7 +242,7 @@ static int dn_dst_gc(struct dst_ops *ops) · 48 unmodified lines | ||
| 248 | 242 | } |
| 249 | 243 | *rtp = rt->dst.dn_next; |
| 250 | 244 | rt->dst.dn_next = NULL; |
| 251 | − dnrt_drop(rt); | |
| 245 | + dnrt_free(rt); | |
| 252 | 246 | break; |
| 253 | 247 | } |
| 254 | 248 | spin_unlock_bh(&dn_rt_hash_table[i].lock); |
| @@ -350,7 +344,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_rou · 95 unmodified lines | ||
| 350 | 344 | dst_use(&rth->dst, now); |
| 351 | 345 | spin_unlock_bh(&dn_rt_hash_table[hash].lock); |
| 352 | 346 | |
| 353 | − dnrt_drop(rt); | |
| 347 | + dst_free(&rt->dst); | |
| 354 | 348 | *rp = rth; |
| 355 | 349 | return 0; |
| 356 | 350 | } |
| @@ -380,7 +374,7 @@ static void dn_run_flush(unsigned long dummy) · 23 unmodified lines | ||
| 380 | 374 | for(; rt; rt = next) { |
| 381 | 375 | next = rcu_dereference_raw(rt->dst.dn_next); |
| 382 | 376 | RCU_INIT_POINTER(rt->dst.dn_next, NULL); |
| 383 | − dst_free((struct dst_entry *)rt); | |
| 377 | + dnrt_free(rt); | |
| 384 | 378 | } |
| 385 | 379 | |
| 386 | 380 | nothing_to_declare: |
| @@ -1187,7 +1181,7 @@ make_route: · 800 unmodified lines | ||
| 1187 | 1181 | if (dev_out->flags & IFF_LOOPBACK) |
| 1188 | 1182 | flags |= RTCF_LOCAL; |
| 1189 | 1183 | |
| 1190 | − rt = dst_alloc(&dn_dst_ops, dev_out, 1, DST_OBSOLETE_NONE, DST_HOST); | |
| 1184 | + rt = dst_alloc(&dn_dst_ops, dev_out, 0, DST_OBSOLETE_NONE, DST_HOST); | |
| 1191 | 1185 | if (rt == NULL) |
| 1192 | 1186 | goto e_nobufs; |
| 1193 | 1187 | |
| @@ -102,7 +102,9 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) · 101 unmodified lines | ||
| 102 | 102 | { |
| 103 | 103 | struct nlmsghdr *nlh = nlmsg_hdr(skb); |
| 104 | 104 | |
| 105 | − if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | |
| 105 | + if (skb->len < sizeof(*nlh) || | |
| 106 | + nlh->nlmsg_len < sizeof(*nlh) || | |
| 107 | + skb->len < nlh->nlmsg_len) | |
| 106 | 108 | return; |
| 107 | 109 | |
| 108 | 110 | if (!netlink_capable(skb, CAP_NET_ADMIN)) |
| @@ -378,7 +378,6 @@ static void hsr_dev_destroy(struct net_device *hsr_dev) · 377 unmodified lines | ||
| 378 | 378 | del_timer_sync(&hsr->announce_timer); |
| 379 | 379 | |
| 380 | 380 | synchronize_rcu(); |
| 381 | − free_netdev(hsr_dev); | |
| 382 | 381 | } |
| 383 | 382 | |
| 384 | 383 | static const struct net_device_ops hsr_device_ops = { |
| @@ -404,7 +403,8 @@ void hsr_dev_setup(struct net_device *dev) · 19 unmodified lines | ||
| 404 | 403 | SET_NETDEV_DEVTYPE(dev, &hsr_type); |
| 405 | 404 | dev->priv_flags |= IFF_NO_QUEUE; |
| 406 | 405 | |
| 407 | − dev->destructor = hsr_dev_destroy; | |
| 406 | + dev->needs_free_netdev = true; | |
| 407 | + dev->priv_destructor = hsr_dev_destroy; | |
| 408 | 408 | |
| 409 | 409 | dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | |
| 410 | 410 | NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | |
| @@ -324,8 +324,7 @@ static int hsr_fill_frame_info(struct hsr_frame_info *frame, · 323 unmodified lines | ||
| 324 | 324 | unsigned long irqflags; |
| 325 | 325 | |
| 326 | 326 | frame->is_supervision = is_supervision_frame(port->hsr, skb); |
| 327 | − frame->node_src = hsr_get_node(&port->hsr->node_db, skb, | |
| 328 | − frame->is_supervision); | |
| 327 | + frame->node_src = hsr_get_node(port, skb, frame->is_supervision); | |
| 329 | 328 | if (frame->node_src == NULL) |
| 330 | 329 | return -1; /* Unknown node and !is_supervision, or no mem */ |
| 331 | 330 | |
| @@ -158,9 +158,10 @@ struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], · 157 unmodified lines | ||
| 158 | 158 | |
| 159 | 159 | /* Get the hsr_node from which 'skb' was sent. |
| 160 | 160 | */ |
| 161 | −struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, | |
| 161 | +struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, | |
| 162 | 162 | bool is_sup) |
| 163 | 163 | { |
| 164 | + struct list_head *node_db = &port->hsr->node_db; | |
| 164 | 165 | struct hsr_node *node; |
| 165 | 166 | struct ethhdr *ethhdr; |
| 166 | 167 | u16 seq_out; |
| @@ -186,7 +187,11 @@ struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, · 19 unmodified lines | ||
| 186 | 187 | */ |
| 187 | 188 | seq_out = hsr_get_skb_sequence_nr(skb) - 1; |
| 188 | 189 | } else { |
| 189 | − WARN_ONCE(1, "%s: Non-HSR frame\n", __func__); | |
| 190 | + /* this is called also for frames from master port and | |
| 191 | + * so warn only for non master ports | |
| 192 | + */ | |
| 193 | + if (port->type != HSR_PT_MASTER) | |
| 194 | + WARN_ONCE(1, "%s: Non-HSR frame\n", __func__); | |
| 190 | 195 | seq_out = HSR_SEQNR_START; |
| 191 | 196 | } |
| 192 | 197 | |
| @@ -18,7 +18,7 @@ struct hsr_node; · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], |
| 20 | 20 | u16 seq_out); |
| 21 | −struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, | |
| 21 | +struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, | |
| 22 | 22 | bool is_sup); |
| 23 | 23 | void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr, |
| 24 | 24 | struct hsr_port *port); |
| @@ -107,7 +107,7 @@ static void lowpan_setup(struct net_device *ldev) · 106 unmodified lines | ||
| 107 | 107 | |
| 108 | 108 | ldev->netdev_ops = &lowpan_netdev_ops; |
| 109 | 109 | ldev->header_ops = &lowpan_header_ops; |
| 110 | − ldev->destructor = free_netdev; | |
| 110 | + ldev->needs_free_netdev = true; | |
| 111 | 111 | ldev->features |= NETIF_F_NETNS_LOCAL; |
| 112 | 112 | } |
| 113 | 113 | |
| @@ -657,8 +657,12 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) · 656 unmodified lines | ||
| 657 | 657 | /* Needed by both icmp_global_allow and icmp_xmit_lock */ |
| 658 | 658 | local_bh_disable(); |
| 659 | 659 | |
| 660 | − /* Check global sysctl_icmp_msgs_per_sec ratelimit */ | |
| 661 | − if (!icmpv4_global_allow(net, type, code)) | |
| 660 | + /* Check global sysctl_icmp_msgs_per_sec ratelimit, unless | |
| 661 | + * incoming dev is loopback. If outgoing dev change to not be | |
| 662 | + * loopback, then peer ratelimit still work (in icmpv4_xrlim_allow) | |
| 663 | + */ | |
| 664 | + if (!(skb_in->dev && (skb_in->dev->flags&IFF_LOOPBACK)) && | |
| 665 | + !icmpv4_global_allow(net, type, code)) | |
| 662 | 666 | goto out_bh_enable; |
| 663 | 667 | |
| 664 | 668 | sk = icmp_xmit_lock(net); |
| @@ -1112,6 +1112,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im) · 1111 unmodified lines | ||
| 1112 | 1112 | pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); |
| 1113 | 1113 | if (!pmc) |
| 1114 | 1114 | return; |
| 1115 | + spin_lock_init(&pmc->lock); | |
| 1115 | 1116 | spin_lock_bh(&im->lock); |
| 1116 | 1117 | pmc->interface = im->interface; |
| 1117 | 1118 | in_dev_hold(in_dev); |
| @@ -2071,21 +2072,26 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, · 953 unmodified lines | ||
| 2071 | 2072 | |
| 2072 | 2073 | static void ip_mc_clear_src(struct ip_mc_list *pmc) |
| 2073 | 2074 | { |
| 2074 | − struct ip_sf_list *psf, *nextpsf; | |
| 2075 | + struct ip_sf_list *psf, *nextpsf, *tomb, *sources; | |
| 2075 | 2076 | |
| 2076 | − for (psf = pmc->tomb; psf; psf = nextpsf) { | |
| 2077 | + spin_lock_bh(&pmc->lock); | |
| 2078 | + tomb = pmc->tomb; | |
| 2079 | + pmc->tomb = NULL; | |
| 2080 | + sources = pmc->sources; | |
| 2081 | + pmc->sources = NULL; | |
| 2082 | + pmc->sfmode = MCAST_EXCLUDE; | |
| 2083 | + pmc->sfcount[MCAST_INCLUDE] = 0; | |
| 2084 | + pmc->sfcount[MCAST_EXCLUDE] = 1; | |
| 2085 | + spin_unlock_bh(&pmc->lock); | |
| 2086 | + | |
| 2087 | + for (psf = tomb; psf; psf = nextpsf) { | |
| 2077 | 2088 | nextpsf = psf->sf_next; |
| 2078 | 2089 | kfree(psf); |
| 2079 | 2090 | } |
| 2080 | − pmc->tomb = NULL; | |
| 2081 | − for (psf = pmc->sources; psf; psf = nextpsf) { | |
| 2091 | + for (psf = sources; psf; psf = nextpsf) { | |
| 2082 | 2092 | nextpsf = psf->sf_next; |
| 2083 | 2093 | kfree(psf); |
| 2084 | 2094 | } |
| 2085 | − pmc->sources = NULL; | |
| 2086 | − pmc->sfmode = MCAST_EXCLUDE; | |
| 2087 | − pmc->sfcount[MCAST_INCLUDE] = 0; | |
| 2088 | − pmc->sfcount[MCAST_EXCLUDE] = 1; | |
| 2089 | 2095 | } |
| 2090 | 2096 | |
| 2091 | 2097 | /* Join a multicast group |
| @@ -446,6 +446,8 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, · 445 unmodified lines | ||
| 446 | 446 | return 0; |
| 447 | 447 | |
| 448 | 448 | drop: |
| 449 | + if (tun_dst) | |
| 450 | + dst_release((struct dst_entry *)tun_dst); | |
| 449 | 451 | kfree_skb(skb); |
| 450 | 452 | return 0; |
| 451 | 453 | } |
| @@ -967,7 +969,6 @@ static void ip_tunnel_dev_free(struct net_device *dev) · 515 unmodified lines | ||
| 967 | 969 | gro_cells_destroy(&tunnel->gro_cells); |
| 968 | 970 | dst_cache_destroy(&tunnel->dst_cache); |
| 969 | 971 | free_percpu(dev->tstats); |
| 970 | − free_netdev(dev); | |
| 971 | 972 | } |
| 972 | 973 | |
| 973 | 974 | void ip_tunnel_dellink(struct net_device *dev, struct list_head *head) |
| @@ -1155,7 +1156,8 @@ int ip_tunnel_init(struct net_device *dev) · 181 unmodified lines | ||
| 1155 | 1156 | struct iphdr *iph = &tunnel->parms.iph; |
| 1156 | 1157 | int err; |
| 1157 | 1158 | |
| 1158 | − dev->destructor = ip_tunnel_dev_free; | |
| 1159 | + dev->needs_free_netdev = true; | |
| 1160 | + dev->priv_destructor = ip_tunnel_dev_free; | |
| 1159 | 1161 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
| 1160 | 1162 | if (!dev->tstats) |
| 1161 | 1163 | return -ENOMEM; |
| @@ -101,8 +101,8 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id); · 100 unmodified lines | ||
| 101 | 101 | static void ipmr_free_table(struct mr_table *mrt); |
| 102 | 102 | |
| 103 | 103 | static void ip_mr_forward(struct net *net, struct mr_table *mrt, |
| 104 | − struct sk_buff *skb, struct mfc_cache *cache, | |
| 105 | − int local); | |
| 104 | + struct net_device *dev, struct sk_buff *skb, | |
| 105 | + struct mfc_cache *cache, int local); | |
| 106 | 106 | static int ipmr_cache_report(struct mr_table *mrt, |
| 107 | 107 | struct sk_buff *pkt, vifi_t vifi, int assert); |
| 108 | 108 | static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, |
| @@ -501,7 +501,7 @@ static void reg_vif_setup(struct net_device *dev) · 392 unmodified lines | ||
| 501 | 501 | dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - 8; |
| 502 | 502 | dev->flags = IFF_NOARP; |
| 503 | 503 | dev->netdev_ops = ®_vif_netdev_ops; |
| 504 | − dev->destructor = free_netdev; | |
| 504 | + dev->needs_free_netdev = true; | |
| 505 | 505 | dev->features |= NETIF_F_NETNS_LOCAL; |
| 506 | 506 | } |
| 507 | 507 | |
| @@ -988,7 +988,7 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, · 480 unmodified lines | ||
| 988 | 988 | |
| 989 | 989 | rtnl_unicast(skb, net, NETLINK_CB(skb).portid); |
| 990 | 990 | } else { |
| 991 | − ip_mr_forward(net, mrt, skb, c, 0); | |
| 991 | + ip_mr_forward(net, mrt, skb->dev, skb, c, 0); | |
| 992 | 992 | } |
| 993 | 993 | } |
| 994 | 994 | } |
| @@ -1073,7 +1073,7 @@ static int ipmr_cache_report(struct mr_table *mrt, · 78 unmodified lines | ||
| 1073 | 1073 | |
| 1074 | 1074 | /* Queue a packet for resolution. It gets locked cache entry! */ |
| 1075 | 1075 | static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, |
| 1076 | − struct sk_buff *skb) | |
| 1076 | + struct sk_buff *skb, struct net_device *dev) | |
| 1077 | 1077 | { |
| 1078 | 1078 | const struct iphdr *iph = ip_hdr(skb); |
| 1079 | 1079 | struct mfc_cache *c; |
| @@ -1130,6 +1130,10 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, · 50 unmodified lines | ||
| 1130 | 1130 | kfree_skb(skb); |
| 1131 | 1131 | err = -ENOBUFS; |
| 1132 | 1132 | } else { |
| 1133 | + if (dev) { | |
| 1134 | + skb->dev = dev; | |
| 1135 | + skb->skb_iif = dev->ifindex; | |
| 1136 | + } | |
| 1133 | 1137 | skb_queue_tail(&c->mfc_un.unres.unresolved, skb); |
| 1134 | 1138 | err = 0; |
| 1135 | 1139 | } |
| @@ -1828,10 +1832,10 @@ static int ipmr_find_vif(struct mr_table *mrt, struct net_device *dev) · 692 unmodified lines | ||
| 1828 | 1832 | |
| 1829 | 1833 | /* "local" means that we should preserve one skb (for local delivery) */ |
| 1830 | 1834 | static void ip_mr_forward(struct net *net, struct mr_table *mrt, |
| 1831 | − struct sk_buff *skb, struct mfc_cache *cache, | |
| 1832 | − int local) | |
| 1835 | + struct net_device *dev, struct sk_buff *skb, | |
| 1836 | + struct mfc_cache *cache, int local) | |
| 1833 | 1837 | { |
| 1834 | − int true_vifi = ipmr_find_vif(mrt, skb->dev); | |
| 1838 | + int true_vifi = ipmr_find_vif(mrt, dev); | |
| 1835 | 1839 | int psend = -1; |
| 1836 | 1840 | int vif, ct; |
| 1837 | 1841 | |
| @@ -1853,13 +1857,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, · 15 unmodified lines | ||
| 1853 | 1857 | } |
| 1854 | 1858 | |
| 1855 | 1859 | /* Wrong interface: drop packet and (maybe) send PIM assert. */ |
| 1856 | − if (mrt->vif_table[vif].dev != skb->dev) { | |
| 1857 | − struct net_device *mdev; | |
| 1858 | − | |
| 1859 | − mdev = l3mdev_master_dev_rcu(mrt->vif_table[vif].dev); | |
| 1860 | − if (mdev == skb->dev) | |
| 1861 | − goto forward; | |
| 1862 | − | |
| 1860 | + if (mrt->vif_table[vif].dev != dev) { | |
| 1863 | 1861 | if (rt_is_output_route(skb_rtable(skb))) { |
| 1864 | 1862 | /* It is our own packet, looped back. |
| 1865 | 1863 | * Very complicated situation... |
| @@ -2053,7 +2051,7 @@ int ip_mr_input(struct sk_buff *skb) · 187 unmodified lines | ||
| 2053 | 2051 | read_lock(&mrt_lock); |
| 2054 | 2052 | vif = ipmr_find_vif(mrt, dev); |
| 2055 | 2053 | if (vif >= 0) { |
| 2056 | − int err2 = ipmr_cache_unresolved(mrt, vif, skb); | |
| 2054 | + int err2 = ipmr_cache_unresolved(mrt, vif, skb, dev); | |
| 2057 | 2055 | read_unlock(&mrt_lock); |
| 2058 | 2056 | |
| 2059 | 2057 | return err2; |
| @@ -2064,7 +2062,7 @@ int ip_mr_input(struct sk_buff *skb) · 4 unmodified lines | ||
| 2064 | 2062 | } |
| 2065 | 2063 | |
| 2066 | 2064 | read_lock(&mrt_lock); |
| 2067 | − ip_mr_forward(net, mrt, skb, cache, local); | |
| 2065 | + ip_mr_forward(net, mrt, dev, skb, cache, local); | |
| 2068 | 2066 | read_unlock(&mrt_lock); |
| 2069 | 2067 | |
| 2070 | 2068 | if (local) |
| @@ -2238,7 +2236,7 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb, · 167 unmodified lines | ||
| 2238 | 2236 | iph->saddr = saddr; |
| 2239 | 2237 | iph->daddr = daddr; |
| 2240 | 2238 | iph->version = 0; |
| 2241 | − err = ipmr_cache_unresolved(mrt, vif, skb2); | |
| 2239 | + err = ipmr_cache_unresolved(mrt, vif, skb2, dev); | |
| 2242 | 2240 | read_unlock(&mrt_lock); |
| 2243 | 2241 | rcu_read_unlock(); |
| 2244 | 2242 | return err; |
| @@ -332,9 +332,9 @@ static void addrconf_mod_rs_timer(struct inet6_dev *idev, · 331 unmodified lines | ||
| 332 | 332 | static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp, |
| 333 | 333 | unsigned long delay) |
| 334 | 334 | { |
| 335 | − if (!delayed_work_pending(&ifp->dad_work)) | |
| 336 | − in6_ifa_hold(ifp); | |
| 337 | − mod_delayed_work(addrconf_wq, &ifp->dad_work, delay); | |
| 335 | + in6_ifa_hold(ifp); | |
| 336 | + if (mod_delayed_work(addrconf_wq, &ifp->dad_work, delay)) | |
| 337 | + in6_ifa_put(ifp); | |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | static int snmp6_alloc_dev(struct inet6_dev *idev) |
| @@ -32,7 +32,6 @@ struct fib6_rule { · 31 unmodified lines | ||
| 32 | 32 | struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, |
| 33 | 33 | int flags, pol_lookup_t lookup) |
| 34 | 34 | { |
| 35 | − struct rt6_info *rt; | |
| 36 | 35 | struct fib_lookup_arg arg = { |
| 37 | 36 | .lookup_ptr = lookup, |
| 38 | 37 | .flags = FIB_LOOKUP_NOREF, |
| @@ -44,21 +43,11 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, · 5 unmodified lines | ||
| 44 | 43 | fib_rules_lookup(net->ipv6.fib6_rules_ops, |
| 45 | 44 | flowi6_to_flowi(fl6), flags, &arg); |
| 46 | 45 | |
| 47 | − rt = arg.result; | |
| 46 | + if (arg.result) | |
| 47 | + return arg.result; | |
| 48 | 48 | |
| 49 | − if (!rt) { | |
| 50 | − dst_hold(&net->ipv6.ip6_null_entry->dst); | |
| 51 | − return &net->ipv6.ip6_null_entry->dst; | |
| 52 | − } | |
| 53 | − | |
| 54 | − if (rt->rt6i_flags & RTF_REJECT && | |
| 55 | − rt->dst.error == -EAGAIN) { | |
| 56 | − ip6_rt_put(rt); | |
| 57 | − rt = net->ipv6.ip6_null_entry; | |
| 58 | − dst_hold(&rt->dst); | |
| 59 | − } | |
| 60 | − | |
| 61 | − return &rt->dst; | |
| 49 | + dst_hold(&net->ipv6.ip6_null_entry->dst); | |
| 50 | + return &net->ipv6.ip6_null_entry->dst; | |
| 62 | 51 | } |
| 63 | 52 | |
| 64 | 53 | static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, |
| @@ -121,7 +110,8 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, · 56 unmodified lines | ||
| 121 | 110 | flp6->saddr = saddr; |
| 122 | 111 | } |
| 123 | 112 | err = rt->dst.error; |
| 124 | − goto out; | |
| 113 | + if (err != -EAGAIN) | |
| 114 | + goto out; | |
| 125 | 115 | } |
| 126 | 116 | again: |
| 127 | 117 | ip6_rt_put(rt); |
| @@ -491,7 +491,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, · 490 unmodified lines | ||
| 491 | 491 | local_bh_disable(); |
| 492 | 492 | |
| 493 | 493 | /* Check global sysctl_icmp_msgs_per_sec ratelimit */ |
| 494 | − if (!icmpv6_global_allow(type)) | |
| 494 | + if (!(skb->dev->flags&IFF_LOOPBACK) && !icmpv6_global_allow(type)) | |
| 495 | 495 | goto out_bh_enable; |
| 496 | 496 | |
| 497 | 497 | mip6_addr_swap(skb); |
| @@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) · 61 unmodified lines | ||
| 62 | 62 | { |
| 63 | 63 | u32 *v = (u32 *)loc.v32; |
| 64 | 64 | |
| 65 | + __ila_hash_secret_init(); | |
| 65 | 66 | return jhash_2words(v[0], v[1], hashrnd); |
| 66 | 67 | } |
| 67 | 68 | |
| @@ -289,8 +289,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, · 288 unmodified lines | ||
| 289 | 289 | struct rt6_info *rt; |
| 290 | 290 | |
| 291 | 291 | rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, flags); |
| 292 | − if (rt->rt6i_flags & RTF_REJECT && | |
| 293 | − rt->dst.error == -EAGAIN) { | |
| 292 | + if (rt->dst.error == -EAGAIN) { | |
| 294 | 293 | ip6_rt_put(rt); |
| 295 | 294 | rt = net->ipv6.ip6_null_entry; |
| 296 | 295 | dst_hold(&rt->dst); |
| @@ -991,13 +991,13 @@ static void ip6gre_dev_free(struct net_device *dev) · 990 unmodified lines | ||
| 991 | 991 | |
| 992 | 992 | dst_cache_destroy(&t->dst_cache); |
| 993 | 993 | free_percpu(dev->tstats); |
| 994 | − free_netdev(dev); | |
| 995 | 994 | } |
| 996 | 995 | |
| 997 | 996 | static void ip6gre_tunnel_setup(struct net_device *dev) |
| 998 | 997 | { |
| 999 | 998 | dev->netdev_ops = &ip6gre_netdev_ops; |
| 1000 | − dev->destructor = ip6gre_dev_free; | |
| 999 | + dev->needs_free_netdev = true; | |
| 1000 | + dev->priv_destructor = ip6gre_dev_free; | |
| 1001 | 1001 | |
| 1002 | 1002 | dev->type = ARPHRD_IP6GRE; |
| 1003 | 1003 | |
| @@ -1148,7 +1148,7 @@ static int __net_init ip6gre_init_net(struct net *net) · 144 unmodified lines | ||
| 1148 | 1148 | return 0; |
| 1149 | 1149 | |
| 1150 | 1150 | err_reg_dev: |
| 1151 | − ip6gre_dev_free(ign->fb_tunnel_dev); | |
| 1151 | + free_netdev(ign->fb_tunnel_dev); | |
| 1152 | 1152 | err_alloc_dev: |
| 1153 | 1153 | return err; |
| 1154 | 1154 | } |
| @@ -1300,7 +1300,8 @@ static void ip6gre_tap_setup(struct net_device *dev) · 145 unmodified lines | ||
| 1300 | 1300 | ether_setup(dev); |
| 1301 | 1301 | |
| 1302 | 1302 | dev->netdev_ops = &ip6gre_tap_netdev_ops; |
| 1303 | − dev->destructor = ip6gre_dev_free; | |
| 1303 | + dev->needs_free_netdev = true; | |
| 1304 | + dev->priv_destructor = ip6gre_dev_free; | |
| 1304 | 1305 | |
| 1305 | 1306 | dev->features |= NETIF_F_NETNS_LOCAL; |
| 1306 | 1307 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| @@ -254,7 +254,6 @@ static void ip6_dev_free(struct net_device *dev) · 253 unmodified lines | ||
| 254 | 254 | gro_cells_destroy(&t->gro_cells); |
| 255 | 255 | dst_cache_destroy(&t->dst_cache); |
| 256 | 256 | free_percpu(dev->tstats); |
| 257 | − free_netdev(dev); | |
| 258 | 257 | } |
| 259 | 258 | |
| 260 | 259 | static int ip6_tnl_create2(struct net_device *dev) |
| @@ -322,7 +321,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) · 61 unmodified lines | ||
| 322 | 321 | return t; |
| 323 | 322 | |
| 324 | 323 | failed_free: |
| 325 | − ip6_dev_free(dev); | |
| 324 | + free_netdev(dev); | |
| 326 | 325 | failed: |
| 327 | 326 | return ERR_PTR(err); |
| 328 | 327 | } |
| @@ -859,6 +858,8 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, · 530 unmodified lines | ||
| 859 | 858 | return 0; |
| 860 | 859 | |
| 861 | 860 | drop: |
| 861 | + if (tun_dst) | |
| 862 | + dst_release((struct dst_entry *)tun_dst); | |
| 862 | 863 | kfree_skb(skb); |
| 863 | 864 | return 0; |
| 864 | 865 | } |
| @@ -1247,7 +1248,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) · 382 unmodified lines | ||
| 1247 | 1248 | fl6.flowi6_proto = IPPROTO_IPIP; |
| 1248 | 1249 | fl6.daddr = key->u.ipv6.dst; |
| 1249 | 1250 | fl6.flowlabel = key->label; |
| 1250 | − dsfield = ip6_tclass(key->label); | |
| 1251 | + dsfield = key->tos; | |
| 1251 | 1252 | } else { |
| 1252 | 1253 | if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) |
| 1253 | 1254 | encap_limit = t->parms.encap_limit; |
| @@ -1318,7 +1319,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) · 64 unmodified lines | ||
| 1318 | 1319 | fl6.flowi6_proto = IPPROTO_IPV6; |
| 1319 | 1320 | fl6.daddr = key->u.ipv6.dst; |
| 1320 | 1321 | fl6.flowlabel = key->label; |
| 1321 | − dsfield = ip6_tclass(key->label); | |
| 1322 | + dsfield = key->tos; | |
| 1322 | 1323 | } else { |
| 1323 | 1324 | offset = ip6_tnl_parse_tlv_enc_lim(skb, skb_network_header(skb)); |
| 1324 | 1325 | /* ip6_tnl_parse_tlv_enc_lim() might have reallocated skb->head */ |
| @@ -1777,7 +1778,8 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { · 452 unmodified lines | ||
| 1777 | 1778 | static void ip6_tnl_dev_setup(struct net_device *dev) |
| 1778 | 1779 | { |
| 1779 | 1780 | dev->netdev_ops = &ip6_tnl_netdev_ops; |
| 1780 | − dev->destructor = ip6_dev_free; | |
| 1781 | + dev->needs_free_netdev = true; | |
| 1782 | + dev->priv_destructor = ip6_dev_free; | |
| 1781 | 1783 | |
| 1782 | 1784 | dev->type = ARPHRD_TUNNEL6; |
| 1783 | 1785 | dev->flags |= IFF_NOARP; |
| @@ -2224,7 +2226,7 @@ static int __net_init ip6_tnl_init_net(struct net *net) · 440 unmodified lines | ||
| 2224 | 2226 | return 0; |
| 2225 | 2227 | |
| 2226 | 2228 | err_register: |
| 2227 | − ip6_dev_free(ip6n->fb_tnl_dev); | |
| 2229 | + free_netdev(ip6n->fb_tnl_dev); | |
| 2228 | 2230 | err_alloc_dev: |
| 2229 | 2231 | return err; |
| 2230 | 2232 | } |
| @@ -180,7 +180,6 @@ vti6_tnl_unlink(struct vti6_net *ip6n, struct ip6_tnl *t) · 179 unmodified lines | ||
| 180 | 180 | static void vti6_dev_free(struct net_device *dev) |
| 181 | 181 | { |
| 182 | 182 | free_percpu(dev->tstats); |
| 183 | − free_netdev(dev); | |
| 184 | 183 | } |
| 185 | 184 | |
| 186 | 185 | static int vti6_tnl_create2(struct net_device *dev) |
| @@ -235,7 +234,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p · 48 unmodified lines | ||
| 235 | 234 | return t; |
| 236 | 235 | |
| 237 | 236 | failed_free: |
| 238 | − vti6_dev_free(dev); | |
| 237 | + free_netdev(dev); | |
| 239 | 238 | failed: |
| 240 | 239 | return NULL; |
| 241 | 240 | } |
| @@ -842,7 +841,8 @@ static const struct net_device_ops vti6_netdev_ops = { · 600 unmodified lines | ||
| 842 | 841 | static void vti6_dev_setup(struct net_device *dev) |
| 843 | 842 | { |
| 844 | 843 | dev->netdev_ops = &vti6_netdev_ops; |
| 845 | − dev->destructor = vti6_dev_free; | |
| 844 | + dev->needs_free_netdev = true; | |
| 845 | + dev->priv_destructor = vti6_dev_free; | |
| 846 | 846 | |
| 847 | 847 | dev->type = ARPHRD_TUNNEL6; |
| 848 | 848 | dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr); |
| @@ -1100,7 +1100,7 @@ static int __net_init vti6_init_net(struct net *net) · 251 unmodified lines | ||
| 1100 | 1100 | return 0; |
| 1101 | 1101 | |
| 1102 | 1102 | err_register: |
| 1103 | − vti6_dev_free(ip6n->fb_tnl_dev); | |
| 1103 | + free_netdev(ip6n->fb_tnl_dev); | |
| 1104 | 1104 | err_alloc_dev: |
| 1105 | 1105 | return err; |
| 1106 | 1106 | } |
| @@ -733,7 +733,7 @@ static void reg_vif_setup(struct net_device *dev) · 732 unmodified lines | ||
| 733 | 733 | dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8; |
| 734 | 734 | dev->flags = IFF_NOARP; |
| 735 | 735 | dev->netdev_ops = ®_vif_netdev_ops; |
| 736 | − dev->destructor = free_netdev; | |
| 736 | + dev->needs_free_netdev = true; | |
| 737 | 737 | dev->features |= NETIF_F_NETNS_LOCAL; |
| 738 | 738 | } |
| 739 | 739 | |
| @@ -219,7 +219,7 @@ static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu *mib, · 218 unmodified lines | ||
| 219 | 219 | u64 buff64[SNMP_MIB_MAX]; |
| 220 | 220 | int i; |
| 221 | 221 | |
| 222 | − memset(buff64, 0, sizeof(unsigned long) * SNMP_MIB_MAX); | |
| 222 | + memset(buff64, 0, sizeof(u64) * SNMP_MIB_MAX); | |
| 223 | 223 | |
| 224 | 224 | snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff); |
| 225 | 225 | for (i = 0; itemlist[i].name; i++) |
| @@ -2804,6 +2804,7 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) · 2803 unmodified lines | ||
| 2804 | 2804 | if ((rt->dst.dev == dev || !dev) && |
| 2805 | 2805 | rt != adn->net->ipv6.ip6_null_entry && |
| 2806 | 2806 | (rt->rt6i_nsiblings == 0 || |
| 2807 | + (dev && netdev_unregistering(dev)) || | |
| 2807 | 2808 | !rt->rt6i_idev->cnf.ignore_routes_with_linkdown)) |
| 2808 | 2809 | return -1; |
| 2809 | 2810 | |
| @@ -265,7 +265,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, · 264 unmodified lines | ||
| 265 | 265 | return nt; |
| 266 | 266 | |
| 267 | 267 | failed_free: |
| 268 | − ipip6_dev_free(dev); | |
| 268 | + free_netdev(dev); | |
| 269 | 269 | failed: |
| 270 | 270 | return NULL; |
| 271 | 271 | } |
| @@ -1336,7 +1336,6 @@ static void ipip6_dev_free(struct net_device *dev) · 1064 unmodified lines | ||
| 1336 | 1336 | |
| 1337 | 1337 | dst_cache_destroy(&tunnel->dst_cache); |
| 1338 | 1338 | free_percpu(dev->tstats); |
| 1339 | − free_netdev(dev); | |
| 1340 | 1339 | } |
| 1341 | 1340 | |
| 1342 | 1341 | #define SIT_FEATURES (NETIF_F_SG | \ |
| @@ -1351,7 +1350,8 @@ static void ipip6_tunnel_setup(struct net_device *dev) · 8 unmodified lines | ||
| 1351 | 1350 | int t_hlen = tunnel->hlen + sizeof(struct iphdr); |
| 1352 | 1351 | |
| 1353 | 1352 | dev->netdev_ops = &ipip6_netdev_ops; |
| 1354 | − dev->destructor = ipip6_dev_free; | |
| 1353 | + dev->needs_free_netdev = true; | |
| 1354 | + dev->priv_destructor = ipip6_dev_free; | |
| 1355 | 1355 | |
| 1356 | 1356 | dev->type = ARPHRD_SIT; |
| 1357 | 1357 | dev->hard_header_len = LL_MAX_HEADER + t_hlen; |
| @@ -65,7 +65,7 @@ static void irlan_eth_setup(struct net_device *dev) · 64 unmodified lines | ||
| 65 | 65 | ether_setup(dev); |
| 66 | 66 | |
| 67 | 67 | dev->netdev_ops = &irlan_eth_netdev_ops; |
| 68 | − dev->destructor = free_netdev; | |
| 68 | + dev->needs_free_netdev = true; | |
| 69 | 69 | dev->min_mtu = 0; |
| 70 | 70 | dev->max_mtu = ETH_MAX_MTU; |
| 71 | 71 | |
| @@ -114,12 +114,13 @@ static void l2tp_eth_get_stats64(struct net_device *dev, · 113 unmodified lines | ||
| 114 | 114 | { |
| 115 | 115 | struct l2tp_eth *priv = netdev_priv(dev); |
| 116 | 116 | |
| 117 | − stats->tx_bytes = atomic_long_read(&priv->tx_bytes); | |
| 118 | − stats->tx_packets = atomic_long_read(&priv->tx_packets); | |
| 119 | − stats->tx_dropped = atomic_long_read(&priv->tx_dropped); | |
| 120 | − stats->rx_bytes = atomic_long_read(&priv->rx_bytes); | |
| 121 | − stats->rx_packets = atomic_long_read(&priv->rx_packets); | |
| 122 | − stats->rx_errors = atomic_long_read(&priv->rx_errors); | |
| 117 | + stats->tx_bytes = (unsigned long) atomic_long_read(&priv->tx_bytes); | |
| 118 | + stats->tx_packets = (unsigned long) atomic_long_read(&priv->tx_packets); | |
| 119 | + stats->tx_dropped = (unsigned long) atomic_long_read(&priv->tx_dropped); | |
| 120 | + stats->rx_bytes = (unsigned long) atomic_long_read(&priv->rx_bytes); | |
| 121 | + stats->rx_packets = (unsigned long) atomic_long_read(&priv->rx_packets); | |
| 122 | + stats->rx_errors = (unsigned long) atomic_long_read(&priv->rx_errors); | |
| 123 | + | |
| 123 | 124 | } |
| 124 | 125 | |
| 125 | 126 | static const struct net_device_ops l2tp_eth_netdev_ops = { |
| @@ -141,7 +142,7 @@ static void l2tp_eth_dev_setup(struct net_device *dev) · 15 unmodified lines | ||
| 141 | 142 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 142 | 143 | dev->features |= NETIF_F_LLTX; |
| 143 | 144 | dev->netdev_ops = &l2tp_eth_netdev_ops; |
| 144 | − dev->destructor = free_netdev; | |
| 145 | + dev->needs_free_netdev = true; | |
| 145 | 146 | } |
| 146 | 147 | |
| 147 | 148 | static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len) |
| @@ -902,6 +902,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 901 unmodified lines | ||
| 902 | 902 | default: |
| 903 | 903 | return -EINVAL; |
| 904 | 904 | } |
| 905 | + sdata->u.ap.req_smps = sdata->smps_mode; | |
| 906 | + | |
| 905 | 907 | sdata->needed_rx_chains = sdata->local->rx_chains; |
| 906 | 908 | |
| 907 | 909 | sdata->vif.bss_conf.beacon_int = params->beacon_interval; |
| @@ -1531,7 +1531,7 @@ ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) · 1530 unmodified lines | ||
| 1531 | 1531 | return true; |
| 1532 | 1532 | /* can't handle non-legacy preamble yet */ |
| 1533 | 1533 | if (status->flag & RX_FLAG_MACTIME_PLCP_START && |
| 1534 | − status->encoding != RX_ENC_LEGACY) | |
| 1534 | + status->encoding == RX_ENC_LEGACY) | |
| 1535 | 1535 | return true; |
| 1536 | 1536 | return false; |
| 1537 | 1537 | } |
| @@ -1213,7 +1213,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = { · 1212 unmodified lines | ||
| 1213 | 1213 | static void ieee80211_if_free(struct net_device *dev) |
| 1214 | 1214 | { |
| 1215 | 1215 | free_percpu(dev->tstats); |
| 1216 | − free_netdev(dev); | |
| 1217 | 1216 | } |
| 1218 | 1217 | |
| 1219 | 1218 | static void ieee80211_if_setup(struct net_device *dev) |
| @@ -1221,7 +1220,8 @@ static void ieee80211_if_setup(struct net_device *dev) · 1 unmodified line | ||
| 1221 | 1220 | ether_setup(dev); |
| 1222 | 1221 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 1223 | 1222 | dev->netdev_ops = &ieee80211_dataif_ops; |
| 1224 | − dev->destructor = ieee80211_if_free; | |
| 1223 | + dev->needs_free_netdev = true; | |
| 1224 | + dev->priv_destructor = ieee80211_if_free; | |
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | static void ieee80211_if_setup_no_queue(struct net_device *dev) |
| @@ -1816,6 +1816,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 588 unmodified lines | ||
| 1816 | 1816 | ret = dev_alloc_name(ndev, ndev->name); |
| 1817 | 1817 | if (ret < 0) { |
| 1818 | 1818 | ieee80211_if_free(ndev); |
| 1819 | + free_netdev(ndev); | |
| 1819 | 1820 | return ret; |
| 1820 | 1821 | } |
| 1821 | 1822 | |
| @@ -1905,7 +1906,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 83 unmodified lines | ||
| 1905 | 1906 | |
| 1906 | 1907 | ret = register_netdevice(ndev); |
| 1907 | 1908 | if (ret) { |
| 1908 | − ieee80211_if_free(ndev); | |
| 1909 | + free_netdev(ndev); | |
| 1909 | 1910 | return ret; |
| 1910 | 1911 | } |
| 1911 | 1912 | } |
| @@ -601,7 +601,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 600 unmodified lines | ||
| 601 | 601 | struct ieee80211_supported_band *sband; |
| 602 | 602 | struct ieee80211_chanctx_conf *chanctx_conf; |
| 603 | 603 | struct ieee80211_channel *chan; |
| 604 | − u32 rate_flags, rates = 0; | |
| 604 | + u32 rates = 0; | |
| 605 | 605 | |
| 606 | 606 | sdata_assert_lock(sdata); |
| 607 | 607 | |
| @@ -612,7 +612,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 4 unmodified lines | ||
| 612 | 612 | return; |
| 613 | 613 | } |
| 614 | 614 | chan = chanctx_conf->def.chan; |
| 615 | − rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def); | |
| 616 | 615 | rcu_read_unlock(); |
| 617 | 616 | sband = local->hw.wiphy->bands[chan->band]; |
| 618 | 617 | shift = ieee80211_vif_get_shift(&sdata->vif); |
| @@ -636,9 +635,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 17 unmodified lines | ||
| 636 | 635 | */ |
| 637 | 636 | rates_len = 0; |
| 638 | 637 | for (i = 0; i < sband->n_bitrates; i++) { |
| 639 | − if ((rate_flags & sband->bitrates[i].flags) | |
| 640 | − != rate_flags) | |
| 641 | − continue; | |
| 642 | 638 | rates |= BIT(i); |
| 643 | 639 | rates_len++; |
| 644 | 640 | } |
| @@ -2818,7 +2814,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 2173 unmodified lines | ||
| 2818 | 2814 | u32 *rates, u32 *basic_rates, |
| 2819 | 2815 | bool *have_higher_than_11mbit, |
| 2820 | 2816 | int *min_rate, int *min_rate_index, |
| 2821 | − int shift, u32 rate_flags) | |
| 2817 | + int shift) | |
| 2822 | 2818 | { |
| 2823 | 2819 | int i, j; |
| 2824 | 2820 | |
| @@ -2846,8 +2842,6 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 21 unmodified lines | ||
| 2846 | 2842 | int brate; |
| 2847 | 2843 | |
| 2848 | 2844 | br = &sband->bitrates[j]; |
| 2849 | − if ((rate_flags & br->flags) != rate_flags) | |
| 2850 | − continue; | |
| 2851 | 2845 | |
| 2852 | 2846 | brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); |
| 2853 | 2847 | if (brate == rate) { |
| @@ -4398,40 +4392,32 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 1544 unmodified lines | ||
| 4398 | 4392 | return -ENOMEM; |
| 4399 | 4393 | } |
| 4400 | 4394 | |
| 4401 | − if (new_sta || override) { | |
| 4402 | − err = ieee80211_prep_channel(sdata, cbss); | |
| 4403 | − if (err) { | |
| 4404 | − if (new_sta) | |
| 4405 | − sta_info_free(local, new_sta); | |
| 4406 | − return -EINVAL; | |
| 4407 | − } | |
| 4408 | − } | |
| 4409 | − | |
| 4395 | + /* | |
| 4396 | + * Set up the information for the new channel before setting the | |
| 4397 | + * new channel. We can't - completely race-free - change the basic | |
| 4398 | + * rates bitmap and the channel (sband) that it refers to, but if | |
| 4399 | + * we set it up before we at least avoid calling into the driver's | |
| 4400 | + * bss_info_changed() method with invalid information (since we do | |
| 4401 | + * call that from changing the channel - only for IDLE and perhaps | |
| 4402 | + * some others, but ...). | |
| 4403 | + * | |
| 4404 | + * So to avoid that, just set up all the new information before the | |
| 4405 | + * channel, but tell the driver to apply it only afterwards, since | |
| 4406 | + * it might need the new channel for that. | |
| 4407 | + */ | |
| 4410 | 4408 | if (new_sta) { |
| 4411 | 4409 | u32 rates = 0, basic_rates = 0; |
| 4412 | 4410 | bool have_higher_than_11mbit; |
| 4413 | 4411 | int min_rate = INT_MAX, min_rate_index = -1; |
| 4414 | − struct ieee80211_chanctx_conf *chanctx_conf; | |
| 4415 | 4412 | const struct cfg80211_bss_ies *ies; |
| 4416 | 4413 | int shift = ieee80211_vif_get_shift(&sdata->vif); |
| 4417 | − u32 rate_flags; | |
| 4418 | − | |
| 4419 | − rcu_read_lock(); | |
| 4420 | − chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | |
| 4421 | − if (WARN_ON(!chanctx_conf)) { | |
| 4422 | − rcu_read_unlock(); | |
| 4423 | − sta_info_free(local, new_sta); | |
| 4424 | − return -EINVAL; | |
| 4425 | − } | |
| 4426 | − rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def); | |
| 4427 | − rcu_read_unlock(); | |
| 4428 | 4414 | |
| 4429 | 4415 | ieee80211_get_rates(sband, bss->supp_rates, |
| 4430 | 4416 | bss->supp_rates_len, |
| 4431 | 4417 | &rates, &basic_rates, |
| 4432 | 4418 | &have_higher_than_11mbit, |
| 4433 | 4419 | &min_rate, &min_rate_index, |
| 4434 | − shift, rate_flags); | |
| 4420 | + shift); | |
| 4435 | 4421 | |
| 4436 | 4422 | /* |
| 4437 | 4423 | * This used to be a workaround for basic rates missing |
| @@ -4489,8 +4475,22 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 51 unmodified lines | ||
| 4489 | 4475 | sdata->vif.bss_conf.sync_dtim_count = 0; |
| 4490 | 4476 | } |
| 4491 | 4477 | rcu_read_unlock(); |
| 4478 | + } | |
| 4492 | 4479 | |
| 4493 | − /* tell driver about BSSID, basic rates and timing */ | |
| 4480 | + if (new_sta || override) { | |
| 4481 | + err = ieee80211_prep_channel(sdata, cbss); | |
| 4482 | + if (err) { | |
| 4483 | + if (new_sta) | |
| 4484 | + sta_info_free(local, new_sta); | |
| 4485 | + return -EINVAL; | |
| 4486 | + } | |
| 4487 | + } | |
| 4488 | + | |
| 4489 | + if (new_sta) { | |
| 4490 | + /* | |
| 4491 | + * tell driver about BSSID, basic rates and timing | |
| 4492 | + * this was set up above, before setting the channel | |
| 4493 | + */ | |
| 4494 | 4494 | ieee80211_bss_info_change_notify(sdata, |
| 4495 | 4495 | BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES | |
| 4496 | 4496 | BSS_CHANGED_BEACON_INT); |
| @@ -1613,12 +1613,16 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) · 1612 unmodified lines | ||
| 1613 | 1613 | */ |
| 1614 | 1614 | if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) && |
| 1615 | 1615 | !ieee80211_has_morefrags(hdr->frame_control) && |
| 1616 | + !ieee80211_is_back_req(hdr->frame_control) && | |
| 1616 | 1617 | !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && |
| 1617 | 1618 | (rx->sdata->vif.type == NL80211_IFTYPE_AP || |
| 1618 | 1619 | rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && |
| 1619 | − /* PM bit is only checked in frames where it isn't reserved, | |
| 1620 | + /* | |
| 1621 | + * PM bit is only checked in frames where it isn't reserved, | |
| 1620 | 1622 | * in AP mode it's reserved in non-bufferable management frames |
| 1621 | 1623 | * (cf. IEEE 802.11-2012 8.2.4.1.7 Power Management field) |
| 1624 | + * BAR frames should be ignored as specified in | |
| 1625 | + * IEEE 802.11-2012 10.2.1.2. | |
| 1622 | 1626 | */ |
| 1623 | 1627 | (!ieee80211_is_mgmt(hdr->frame_control) || |
| 1624 | 1628 | ieee80211_is_bufferable_mmpdu(hdr->frame_control))) { |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <asm/unaligned.h> |
| 18 | 18 | #include <net/mac80211.h> |
| 19 | 19 | #include <crypto/aes.h> |
| 20 | +#include <crypto/algapi.h> | |
| 20 | 21 | |
| 21 | 22 | #include "ieee80211_i.h" |
| 22 | 23 | #include "michael.h" |
| @@ -153,7 +154,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) · 130 unmodified lines | ||
| 153 | 154 | data_len = skb->len - hdrlen - MICHAEL_MIC_LEN; |
| 154 | 155 | key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY]; |
| 155 | 156 | michael_mic(key, hdr, data, data_len, mic); |
| 156 | − if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0) | |
| 157 | + if (crypto_memneq(mic, data + data_len, MICHAEL_MIC_LEN)) | |
| 157 | 158 | goto mic_fail; |
| 158 | 159 | |
| 159 | 160 | /* remove Michael MIC from payload */ |
| @@ -1048,7 +1049,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) · 888 unmodified lines | ||
| 1048 | 1049 | bip_aad(skb, aad); |
| 1049 | 1050 | ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad, |
| 1050 | 1051 | skb->data + 24, skb->len - 24, mic); |
| 1051 | − if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | |
| 1052 | + if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { | |
| 1052 | 1053 | key->u.aes_cmac.icverrors++; |
| 1053 | 1054 | return RX_DROP_UNUSABLE; |
| 1054 | 1055 | } |
| @@ -1098,7 +1099,7 @@ ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx) · 43 unmodified lines | ||
| 1098 | 1099 | bip_aad(skb, aad); |
| 1099 | 1100 | ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad, |
| 1100 | 1101 | skb->data + 24, skb->len - 24, mic); |
| 1101 | − if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | |
| 1102 | + if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { | |
| 1102 | 1103 | key->u.aes_cmac.icverrors++; |
| 1103 | 1104 | return RX_DROP_UNUSABLE; |
| 1104 | 1105 | } |
| @@ -1202,7 +1203,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx) · 97 unmodified lines | ||
| 1202 | 1203 | if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce, |
| 1203 | 1204 | skb->data + 24, skb->len - 24, |
| 1204 | 1205 | mic) < 0 || |
| 1205 | − memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | |
| 1206 | + crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { | |
| 1206 | 1207 | key->u.aes_gmac.icverrors++; |
| 1207 | 1208 | return RX_DROP_UNUSABLE; |
| 1208 | 1209 | } |
| @@ -526,8 +526,6 @@ static void mac802154_wpan_free(struct net_device *dev) · 525 unmodified lines | ||
| 526 | 526 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
| 527 | 527 | |
| 528 | 528 | mac802154_llsec_destroy(&sdata->sec); |
| 529 | − | |
| 530 | − free_netdev(dev); | |
| 531 | 529 | } |
| 532 | 530 | |
| 533 | 531 | static void ieee802154_if_setup(struct net_device *dev) |
| @@ -593,7 +591,8 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 59 unmodified lines | ||
| 593 | 591 | sdata->dev->dev_addr); |
| 594 | 592 | |
| 595 | 593 | sdata->dev->header_ops = &mac802154_header_ops; |
| 596 | − sdata->dev->destructor = mac802154_wpan_free; | |
| 594 | + sdata->dev->needs_free_netdev = true; | |
| 595 | + sdata->dev->priv_destructor = mac802154_wpan_free; | |
| 597 | 596 | sdata->dev->netdev_ops = &mac802154_wpan_ops; |
| 598 | 597 | sdata->dev->ml_priv = &mac802154_mlme_wpan; |
| 599 | 598 | wpan_dev->promiscuous_mode = false; |
| @@ -608,7 +607,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 8 unmodified lines | ||
| 608 | 607 | |
| 609 | 608 | break; |
| 610 | 609 | case NL802154_IFTYPE_MONITOR: |
| 611 | − sdata->dev->destructor = free_netdev; | |
| 610 | + sdata->dev->needs_free_netdev = true; | |
| 612 | 611 | sdata->dev->netdev_ops = &mac802154_monitor_ops; |
| 613 | 612 | wpan_dev->promiscuous_mode = true; |
| 614 | 613 | break; |
| @@ -94,7 +94,6 @@ static void internal_dev_destructor(struct net_device *dev) · 93 unmodified lines | ||
| 94 | 94 | struct vport *vport = ovs_internal_dev_get_vport(dev); |
| 95 | 95 | |
| 96 | 96 | ovs_vport_free(vport); |
| 97 | − free_netdev(dev); | |
| 98 | 97 | } |
| 99 | 98 | |
| 100 | 99 | static void |
| @@ -156,7 +155,8 @@ static void do_setup(struct net_device *netdev) · 55 unmodified lines | ||
| 156 | 155 | netdev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 157 | 156 | netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH | |
| 158 | 157 | IFF_PHONY_HEADROOM | IFF_NO_QUEUE; |
| 159 | − netdev->destructor = internal_dev_destructor; | |
| 158 | + netdev->needs_free_netdev = true; | |
| 159 | + netdev->priv_destructor = internal_dev_destructor; | |
| 160 | 160 | netdev->ethtool_ops = &internal_dev_ethtool_ops; |
| 161 | 161 | netdev->rtnl_link_ops = &internal_dev_link_ops; |
| 162 | 162 | |
| @@ -236,7 +236,7 @@ static void gprs_setup(struct net_device *dev) · 235 unmodified lines | ||
| 236 | 236 | dev->tx_queue_len = 10; |
| 237 | 237 | |
| 238 | 238 | dev->netdev_ops = &gprs_netdev_ops; |
| 239 | − dev->destructor = free_netdev; | |
| 239 | + dev->needs_free_netdev = true; | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /* |
| @@ -217,7 +217,7 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, · 216 unmodified lines | ||
| 217 | 217 | unsigned int *_toklen) |
| 218 | 218 | { |
| 219 | 219 | const __be32 *xdr = *_xdr; |
| 220 | − unsigned int toklen = *_toklen, n_parts, loop, tmp; | |
| 220 | + unsigned int toklen = *_toklen, n_parts, loop, tmp, paddedlen; | |
| 221 | 221 | |
| 222 | 222 | /* there must be at least one name, and at least #names+1 length |
| 223 | 223 | * words */ |
| @@ -247,16 +247,16 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, · 23 unmodified lines | ||
| 247 | 247 | toklen -= 4; |
| 248 | 248 | if (tmp <= 0 || tmp > AFSTOKEN_STRING_MAX) |
| 249 | 249 | return -EINVAL; |
| 250 | − if (tmp > toklen) | |
| 250 | + paddedlen = (tmp + 3) & ~3; | |
| 251 | + if (paddedlen > toklen) | |
| 251 | 252 | return -EINVAL; |
| 252 | 253 | princ->name_parts[loop] = kmalloc(tmp + 1, GFP_KERNEL); |
| 253 | 254 | if (!princ->name_parts[loop]) |
| 254 | 255 | return -ENOMEM; |
| 255 | 256 | memcpy(princ->name_parts[loop], xdr, tmp); |
| 256 | 257 | princ->name_parts[loop][tmp] = 0; |
| 257 | − tmp = (tmp + 3) & ~3; | |
| 258 | − toklen -= tmp; | |
| 259 | − xdr += tmp >> 2; | |
| 258 | + toklen -= paddedlen; | |
| 259 | + xdr += paddedlen >> 2; | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (toklen < 4) |
| @@ -265,16 +265,16 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, · 2 unmodified lines | ||
| 265 | 265 | toklen -= 4; |
| 266 | 266 | if (tmp <= 0 || tmp > AFSTOKEN_K5_REALM_MAX) |
| 267 | 267 | return -EINVAL; |
| 268 | − if (tmp > toklen) | |
| 268 | + paddedlen = (tmp + 3) & ~3; | |
| 269 | + if (paddedlen > toklen) | |
| 269 | 270 | return -EINVAL; |
| 270 | 271 | princ->realm = kmalloc(tmp + 1, GFP_KERNEL); |
| 271 | 272 | if (!princ->realm) |
| 272 | 273 | return -ENOMEM; |
| 273 | 274 | memcpy(princ->realm, xdr, tmp); |
| 274 | 275 | princ->realm[tmp] = 0; |
| 275 | − tmp = (tmp + 3) & ~3; | |
| 276 | − toklen -= tmp; | |
| 277 | − xdr += tmp >> 2; | |
| 276 | + toklen -= paddedlen; | |
| 277 | + xdr += paddedlen >> 2; | |
| 278 | 278 | |
| 279 | 279 | _debug("%s/...@%s", princ->name_parts[0], princ->realm); |
| 280 | 280 | |
| @@ -293,7 +293,7 @@ static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td, · 12 unmodified lines | ||
| 293 | 293 | unsigned int *_toklen) |
| 294 | 294 | { |
| 295 | 295 | const __be32 *xdr = *_xdr; |
| 296 | − unsigned int toklen = *_toklen, len; | |
| 296 | + unsigned int toklen = *_toklen, len, paddedlen; | |
| 297 | 297 | |
| 298 | 298 | /* there must be at least one tag and one length word */ |
| 299 | 299 | if (toklen <= 8) |
| @@ -307,15 +307,17 @@ static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td, · 7 unmodified lines | ||
| 307 | 307 | toklen -= 8; |
| 308 | 308 | if (len > max_data_size) |
| 309 | 309 | return -EINVAL; |
| 310 | + paddedlen = (len + 3) & ~3; | |
| 311 | + if (paddedlen > toklen) | |
| 312 | + return -EINVAL; | |
| 310 | 313 | td->data_len = len; |
| 311 | 314 | |
| 312 | 315 | if (len > 0) { |
| 313 | 316 | td->data = kmemdup(xdr, len, GFP_KERNEL); |
| 314 | 317 | if (!td->data) |
| 315 | 318 | return -ENOMEM; |
| 316 | − len = (len + 3) & ~3; | |
| 317 | − toklen -= len; | |
| 318 | − xdr += len >> 2; | |
| 319 | + toklen -= paddedlen; | |
| 320 | + xdr += paddedlen >> 2; | |
| 319 | 321 | } |
| 320 | 322 | |
| 321 | 323 | _debug("tag %x len %x", td->tag, td->data_len); |
| @@ -387,7 +389,7 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, · 65 unmodified lines | ||
| 387 | 389 | const __be32 **_xdr, unsigned int *_toklen) |
| 388 | 390 | { |
| 389 | 391 | const __be32 *xdr = *_xdr; |
| 390 | − unsigned int toklen = *_toklen, len; | |
| 392 | + unsigned int toklen = *_toklen, len, paddedlen; | |
| 391 | 393 | |
| 392 | 394 | /* there must be at least one length word */ |
| 393 | 395 | if (toklen <= 4) |
| @@ -399,6 +401,9 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, · 5 unmodified lines | ||
| 399 | 401 | toklen -= 4; |
| 400 | 402 | if (len > AFSTOKEN_K5_TIX_MAX) |
| 401 | 403 | return -EINVAL; |
| 404 | + paddedlen = (len + 3) & ~3; | |
| 405 | + if (paddedlen > toklen) | |
| 406 | + return -EINVAL; | |
| 402 | 407 | *_tktlen = len; |
| 403 | 408 | |
| 404 | 409 | _debug("ticket len %u", len); |
| @@ -407,9 +412,8 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, · 2 unmodified lines | ||
| 407 | 412 | *_ticket = kmemdup(xdr, len, GFP_KERNEL); |
| 408 | 413 | if (!*_ticket) |
| 409 | 414 | return -ENOMEM; |
| 410 | − len = (len + 3) & ~3; | |
| 411 | − toklen -= len; | |
| 412 | − xdr += len >> 2; | |
| 415 | + toklen -= paddedlen; | |
| 416 | + xdr += paddedlen >> 2; | |
| 413 | 417 | } |
| 414 | 418 | |
| 415 | 419 | *_xdr = xdr; |
| @@ -552,7 +556,7 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) · 136 unmodified lines | ||
| 552 | 556 | { |
| 553 | 557 | const __be32 *xdr = prep->data, *token; |
| 554 | 558 | const char *cp; |
| 555 | − unsigned int len, tmp, loop, ntoken, toklen, sec_ix; | |
| 559 | + unsigned int len, paddedlen, loop, ntoken, toklen, sec_ix; | |
| 556 | 560 | size_t datalen = prep->datalen; |
| 557 | 561 | int ret; |
| 558 | 562 | |
| @@ -578,22 +582,21 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) · 19 unmodified lines | ||
| 578 | 582 | if (len < 1 || len > AFSTOKEN_CELL_MAX) |
| 579 | 583 | goto not_xdr; |
| 580 | 584 | datalen -= 4; |
| 581 | − tmp = (len + 3) & ~3; | |
| 582 | − if (tmp > datalen) | |
| 585 | + paddedlen = (len + 3) & ~3; | |
| 586 | + if (paddedlen > datalen) | |
| 583 | 587 | goto not_xdr; |
| 584 | 588 | |
| 585 | 589 | cp = (const char *) xdr; |
| 586 | 590 | for (loop = 0; loop < len; loop++) |
| 587 | 591 | if (!isprint(cp[loop])) |
| 588 | 592 | goto not_xdr; |
| 589 | − if (len < tmp) | |
| 590 | − for (; loop < tmp; loop++) | |
| 591 | − if (cp[loop]) | |
| 592 | − goto not_xdr; | |
| 593 | + for (; loop < paddedlen; loop++) | |
| 594 | + if (cp[loop]) | |
| 595 | + goto not_xdr; | |
| 593 | 596 | _debug("cellname: [%u/%u] '%*.*s'", |
| 594 | − len, tmp, len, len, (const char *) xdr); | |
| 595 | − datalen -= tmp; | |
| 596 | − xdr += tmp >> 2; | |
| 597 | + len, paddedlen, len, len, (const char *) xdr); | |
| 598 | + datalen -= paddedlen; | |
| 599 | + xdr += paddedlen >> 2; | |
| 597 | 600 | |
| 598 | 601 | /* get the token count */ |
| 599 | 602 | if (datalen < 12) |
| @@ -614,10 +617,11 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) · 14 unmodified lines | ||
| 614 | 617 | sec_ix = ntohl(*xdr); |
| 615 | 618 | datalen -= 4; |
| 616 | 619 | _debug("token: [%x/%zx] %x", toklen, datalen, sec_ix); |
| 617 | − if (toklen < 20 || toklen > datalen) | |
| 620 | + paddedlen = (toklen + 3) & ~3; | |
| 621 | + if (toklen < 20 || toklen > datalen || paddedlen > datalen) | |
| 618 | 622 | goto not_xdr; |
| 619 | − datalen -= (toklen + 3) & ~3; | |
| 620 | − xdr += (toklen + 3) >> 2; | |
| 623 | + datalen -= paddedlen; | |
| 624 | + xdr += paddedlen >> 2; | |
| 621 | 625 | |
| 622 | 626 | } while (--loop > 0); |
| 623 | 627 | |
| @@ -94,8 +94,10 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, · 93 unmodified lines | ||
| 94 | 94 | k++; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | − if (n) | |
| 97 | + if (n) { | |
| 98 | + err = -EINVAL; | |
| 98 | 99 | goto err_out; |
| 100 | + } | |
| 99 | 101 | |
| 100 | 102 | return keys_ex; |
| 101 | 103 | |
| @@ -132,21 +132,21 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 131 unmodified lines | ||
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | − spin_lock_bh(&police->tcf_lock); | |
| 136 | 135 | if (est) { |
| 137 | 136 | err = gen_replace_estimator(&police->tcf_bstats, NULL, |
| 138 | 137 | &police->tcf_rate_est, |
| 139 | 138 | &police->tcf_lock, |
| 140 | 139 | NULL, est); |
| 141 | 140 | if (err) |
| 142 | − goto failure_unlock; | |
| 141 | + goto failure; | |
| 143 | 142 | } else if (tb[TCA_POLICE_AVRATE] && |
| 144 | 143 | (ret == ACT_P_CREATED || |
| 145 | 144 | !gen_estimator_active(&police->tcf_rate_est))) { |
| 146 | 145 | err = -EINVAL; |
| 147 | − goto failure_unlock; | |
| 146 | + goto failure; | |
| 148 | 147 | } |
| 149 | 148 | |
| 149 | + spin_lock_bh(&police->tcf_lock); | |
| 150 | 150 | /* No failure allowed after this point */ |
| 151 | 151 | police->tcfp_mtu = parm->mtu; |
| 152 | 152 | if (police->tcfp_mtu == 0) { |
| @@ -192,8 +192,6 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 39 unmodified lines | ||
| 192 | 192 | |
| 193 | 193 | return ret; |
| 194 | 194 | |
| 195 | −failure_unlock: | |
| 196 | − spin_unlock_bh(&police->tcf_lock); | |
| 197 | 195 | failure: |
| 198 | 196 | qdisc_put_rtab(P_tab); |
| 199 | 197 | qdisc_put_rtab(R_tab); |
| @@ -275,6 +275,7 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) · 274 unmodified lines | ||
| 275 | 275 | if (sctp_sk(sk)->bind_hash) |
| 276 | 276 | sctp_put_port(sk); |
| 277 | 277 | |
| 278 | + sctp_sk(sk)->ep = NULL; | |
| 278 | 279 | sock_put(sk); |
| 279 | 280 | } |
| 280 | 281 | |
| @@ -278,7 +278,6 @@ out: · 277 unmodified lines | ||
| 278 | 278 | |
| 279 | 279 | static int sctp_sock_dump(struct sock *sk, void *p) |
| 280 | 280 | { |
| 281 | − struct sctp_endpoint *ep = sctp_sk(sk)->ep; | |
| 282 | 281 | struct sctp_comm_param *commp = p; |
| 283 | 282 | struct sk_buff *skb = commp->skb; |
| 284 | 283 | struct netlink_callback *cb = commp->cb; |
| @@ -287,7 +286,9 @@ static int sctp_sock_dump(struct sock *sk, void *p) · 2 unmodified lines | ||
| 287 | 286 | int err = 0; |
| 288 | 287 | |
| 289 | 288 | lock_sock(sk); |
| 290 | − list_for_each_entry(assoc, &ep->asocs, asocs) { | |
| 289 | + if (!sctp_sk(sk)->ep) | |
| 290 | + goto release; | |
| 291 | + list_for_each_entry(assoc, &sctp_sk(sk)->ep->asocs, asocs) { | |
| 291 | 292 | if (cb->args[4] < cb->args[1]) |
| 292 | 293 | goto next; |
| 293 | 294 | |
| @@ -4622,13 +4622,13 @@ int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), · 4621 unmodified lines | ||
| 4622 | 4622 | |
| 4623 | 4623 | for (head = sctp_ep_hashtable; hash < sctp_ep_hashsize; |
| 4624 | 4624 | hash++, head++) { |
| 4625 | − read_lock(&head->lock); | |
| 4625 | + read_lock_bh(&head->lock); | |
| 4626 | 4626 | sctp_for_each_hentry(epb, &head->chain) { |
| 4627 | 4627 | err = cb(sctp_ep(epb), p); |
| 4628 | 4628 | if (err) |
| 4629 | 4629 | break; |
| 4630 | 4630 | } |
| 4631 | − read_unlock(&head->lock); | |
| 4631 | + read_unlock_bh(&head->lock); | |
| 4632 | 4632 | } |
| 4633 | 4633 | |
| 4634 | 4634 | return err; |
| @@ -4666,9 +4666,8 @@ int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *), · 31 unmodified lines | ||
| 4666 | 4666 | if (err) |
| 4667 | 4667 | return err; |
| 4668 | 4668 | |
| 4669 | − sctp_transport_get_idx(net, &hti, pos); | |
| 4670 | − obj = sctp_transport_get_next(net, &hti); | |
| 4671 | − for (; obj && !IS_ERR(obj); obj = sctp_transport_get_next(net, &hti)) { | |
| 4669 | + obj = sctp_transport_get_idx(net, &hti, pos + 1); | |
| 4670 | + for (; !IS_ERR_OR_NULL(obj); obj = sctp_transport_get_next(net, &hti)) { | |
| 4672 | 4671 | struct sctp_transport *transport = obj; |
| 4673 | 4672 | |
| 4674 | 4673 | if (!sctp_transport_hold(transport)) |
| @@ -508,7 +508,7 @@ bool tipc_msg_reverse(u32 own_node, struct sk_buff **skb, int err) · 507 unmodified lines | ||
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | if (skb_cloned(_skb) && |
| 511 | − pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_KERNEL)) | |
| 511 | + pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC)) | |
| 512 | 512 | goto exit; |
| 513 | 513 | |
| 514 | 514 | /* Now reverse the concerned fields */ |
| @@ -999,7 +999,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 998 unmodified lines | ||
| 999 | 999 | struct path path = { }; |
| 1000 | 1000 | |
| 1001 | 1001 | err = -EINVAL; |
| 1002 | − if (sunaddr->sun_family != AF_UNIX) | |
| 1002 | + if (addr_len < offsetofend(struct sockaddr_un, sun_family) || | |
| 1003 | + sunaddr->sun_family != AF_UNIX) | |
| 1003 | 1004 | goto out; |
| 1004 | 1005 | |
| 1005 | 1006 | if (addr_len == sizeof(short)) { |
| @@ -1110,6 +1111,10 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, · 104 unmodified lines | ||
| 1110 | 1111 | unsigned int hash; |
| 1111 | 1112 | int err; |
| 1112 | 1113 | |
| 1114 | + err = -EINVAL; | |
| 1115 | + if (alen < offsetofend(struct sockaddr, sa_family)) | |
| 1116 | + goto out; | |
| 1117 | + | |
| 1113 | 1118 | if (addr->sa_family != AF_UNSPEC) { |
| 1114 | 1119 | err = unix_mkname(sunaddr, alen, &hash); |
| 1115 | 1120 | if (err < 0) |
| @@ -914,13 +914,12 @@ int call_commit_handler(struct net_device *dev) · 913 unmodified lines | ||
| 914 | 914 | * Main IOCTl dispatcher. |
| 915 | 915 | * Check the type of IOCTL and call the appropriate wrapper... |
| 916 | 916 | */ |
| 917 | −static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, | |
| 917 | +static int wireless_process_ioctl(struct net *net, struct iwreq *iwr, | |
| 918 | 918 | unsigned int cmd, |
| 919 | 919 | struct iw_request_info *info, |
| 920 | 920 | wext_ioctl_func standard, |
| 921 | 921 | wext_ioctl_func private) |
| 922 | 922 | { |
| 923 | − struct iwreq *iwr = (struct iwreq *) ifr; | |
| 924 | 923 | struct net_device *dev; |
| 925 | 924 | iw_handler handler; |
| 926 | 925 | |
| @@ -928,7 +927,7 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, · 1 unmodified line | ||
| 928 | 927 | * The copy_to/from_user() of ifr is also dealt with in there */ |
| 929 | 928 | |
| 930 | 929 | /* Make sure the device exist */ |
| 931 | − if ((dev = __dev_get_by_name(net, ifr->ifr_name)) == NULL) | |
| 930 | + if ((dev = __dev_get_by_name(net, iwr->ifr_name)) == NULL) | |
| 932 | 931 | return -ENODEV; |
| 933 | 932 | |
| 934 | 933 | /* A bunch of special cases, then the generic case... |
| @@ -957,9 +956,6 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, · 22 unmodified lines | ||
| 957 | 956 | else if (private) |
| 958 | 957 | return private(dev, iwr, cmd, info, handler); |
| 959 | 958 | } |
| 960 | − /* Old driver API : call driver ioctl handler */ | |
| 961 | − if (dev->netdev_ops->ndo_do_ioctl) | |
| 962 | − return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); | |
| 963 | 959 | return -EOPNOTSUPP; |
| 964 | 960 | } |
| 965 | 961 | |
| @@ -977,7 +973,7 @@ static int wext_permission_check(unsigned int cmd) · 11 unmodified lines | ||
| 977 | 973 | } |
| 978 | 974 | |
| 979 | 975 | /* entry point from dev ioctl */ |
| 980 | −static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, | |
| 976 | +static int wext_ioctl_dispatch(struct net *net, struct iwreq *iwr, | |
| 981 | 977 | unsigned int cmd, struct iw_request_info *info, |
| 982 | 978 | wext_ioctl_func standard, |
| 983 | 979 | wext_ioctl_func private) |
| @@ -987,9 +983,9 @@ static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, · 3 unmodified lines | ||
| 987 | 983 | if (ret) |
| 988 | 984 | return ret; |
| 989 | 985 | |
| 990 | − dev_load(net, ifr->ifr_name); | |
| 986 | + dev_load(net, iwr->ifr_name); | |
| 991 | 987 | rtnl_lock(); |
| 992 | − ret = wireless_process_ioctl(net, ifr, cmd, info, standard, private); | |
| 988 | + ret = wireless_process_ioctl(net, iwr, cmd, info, standard, private); | |
| 993 | 989 | rtnl_unlock(); |
| 994 | 990 | |
| 995 | 991 | return ret; |
| @@ -1039,18 +1035,18 @@ static int ioctl_standard_call(struct net_device * dev, · 43 unmodified lines | ||
| 1039 | 1035 | } |
| 1040 | 1036 | |
| 1041 | 1037 | |
| 1042 | −int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | |
| 1038 | +int wext_handle_ioctl(struct net *net, struct iwreq *iwr, unsigned int cmd, | |
| 1043 | 1039 | void __user *arg) |
| 1044 | 1040 | { |
| 1045 | 1041 | struct iw_request_info info = { .cmd = cmd, .flags = 0 }; |
| 1046 | 1042 | int ret; |
| 1047 | 1043 | |
| 1048 | − ret = wext_ioctl_dispatch(net, ifr, cmd, &info, | |
| 1044 | + ret = wext_ioctl_dispatch(net, iwr, cmd, &info, | |
| 1049 | 1045 | ioctl_standard_call, |
| 1050 | 1046 | ioctl_private_call); |
| 1051 | 1047 | if (ret >= 0 && |
| 1052 | 1048 | IW_IS_GET(cmd) && |
| 1053 | − copy_to_user(arg, ifr, sizeof(struct iwreq))) | |
| 1049 | + copy_to_user(arg, iwr, sizeof(struct iwreq))) | |
| 1054 | 1050 | return -EFAULT; |
| 1055 | 1051 | |
| 1056 | 1052 | return ret; |
| @@ -1107,7 +1103,7 @@ int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, · 50 unmodified lines | ||
| 1107 | 1103 | info.cmd = cmd; |
| 1108 | 1104 | info.flags = IW_REQUEST_FLAG_COMPAT; |
| 1109 | 1105 | |
| 1110 | − ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info, | |
| 1106 | + ret = wext_ioctl_dispatch(net, &iwr, cmd, &info, | |
| 1111 | 1107 | compat_standard_call, |
| 1112 | 1108 | compat_private_call); |
| 1113 | 1109 | |
| @@ -14,7 +14,15 @@ __headers: · 13 unmodified lines | ||
| 14 | 14 | include scripts/Kbuild.include |
| 15 | 15 | |
| 16 | 16 | srcdir := $(srctree)/$(obj) |
| 17 | −subdirs := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.)) | |
| 17 | + | |
| 18 | +# When make is run under a fakechroot environment, the function | |
| 19 | +# $(wildcard $(srcdir)/*/.) doesn't only return directories, but also regular | |
| 20 | +# files. So, we are using a combination of sort/dir/wildcard which works | |
| 21 | +# with fakechroot. | |
| 22 | +subdirs := $(patsubst $(srcdir)/%/,%,\ | |
| 23 | + $(filter-out $(srcdir)/,\ | |
| 24 | + $(sort $(dir $(wildcard $(srcdir)/*/))))) | |
| 25 | + | |
| 18 | 26 | # caller may set destination dir (when installing to asm/) |
| 19 | 27 | _dst := $(if $(dst),$(dst),$(obj)) |
| 20 | 28 | |
| @@ -75,7 +75,7 @@ struct string_list *copy_list_range(struct string_list *start, · 74 unmodified lines | ||
| 75 | 75 | int yylex(void); |
| 76 | 76 | int yyparse(void); |
| 77 | 77 | |
| 78 | −void error_with_pos(const char *, ...); | |
| 78 | +void error_with_pos(const char *, ...) __attribute__ ((format(printf, 1, 2))); | |
| 79 | 79 | |
| 80 | 80 | /*----------------------------------------------------------------------*/ |
| 81 | 81 | #define xmalloc(size) ({ void *__ptr = malloc(size); \ |
| @@ -196,7 +196,7 @@ clean-files += config.pot linux.pot · 195 unmodified lines | ||
| 196 | 196 | |
| 197 | 197 | # Check that we have the required ncurses stuff installed for lxdialog (menuconfig) |
| 198 | 198 | PHONY += $(obj)/dochecklxdialog |
| 199 | −$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog | |
| 199 | +$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog | |
| 200 | 200 | $(obj)/dochecklxdialog: |
| 201 | 201 | $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf) |
| 202 | 202 | |
| @@ -271,7 +271,7 @@ static struct mitem k_menu_items[MAX_MENU_ITEMS]; · 270 unmodified lines | ||
| 271 | 271 | static int items_num; |
| 272 | 272 | static int global_exit; |
| 273 | 273 | /* the currently selected button */ |
| 274 | −const char *current_instructions = menu_instructions; | |
| 274 | +static const char *current_instructions = menu_instructions; | |
| 275 | 275 | |
| 276 | 276 | static char *dialog_input_result; |
| 277 | 277 | static int dialog_input_result_len; |
| @@ -305,7 +305,7 @@ struct function_keys { · 27 unmodified lines | ||
| 305 | 305 | }; |
| 306 | 306 | |
| 307 | 307 | static const int function_keys_num = 9; |
| 308 | −struct function_keys function_keys[] = { | |
| 308 | +static struct function_keys function_keys[] = { | |
| 309 | 309 | { |
| 310 | 310 | .key_str = "F1", |
| 311 | 311 | .func = "Help", |
| @@ -508,7 +508,7 @@ static int get_mext_match(const char *match_str, match_f flag) · 196 unmodified lines | ||
| 508 | 508 | index = (index + items_num) % items_num; |
| 509 | 509 | while (true) { |
| 510 | 510 | char *str = k_menu_items[index].str; |
| 511 | − if (strcasestr(str, match_str) != 0) | |
| 511 | + if (strcasestr(str, match_str) != NULL) | |
| 512 | 512 | return index; |
| 513 | 513 | if (flag == FIND_NEXT_MATCH_UP || |
| 514 | 514 | flag == MATCH_TINKER_PATTERN_UP) |
| @@ -1067,7 +1067,7 @@ static int do_match(int key, struct match_state *state, int *ans) · 552 unmodified lines | ||
| 1067 | 1067 | |
| 1068 | 1068 | static void conf(struct menu *menu) |
| 1069 | 1069 | { |
| 1070 | − struct menu *submenu = 0; | |
| 1070 | + struct menu *submenu = NULL; | |
| 1071 | 1071 | const char *prompt = menu_get_prompt(menu); |
| 1072 | 1072 | struct symbol *sym; |
| 1073 | 1073 | int res; |
| @@ -1234,7 +1234,7 @@ static void show_help(struct menu *menu) · 160 unmodified lines | ||
| 1234 | 1234 | static void conf_choice(struct menu *menu) |
| 1235 | 1235 | { |
| 1236 | 1236 | const char *prompt = _(menu_get_prompt(menu)); |
| 1237 | − struct menu *child = 0; | |
| 1237 | + struct menu *child = NULL; | |
| 1238 | 1238 | struct symbol *active; |
| 1239 | 1239 | int selected_index = 0; |
| 1240 | 1240 | int last_top_row = 0; |
| @@ -1456,7 +1456,7 @@ static void conf_save(void) · 215 unmodified lines | ||
| 1456 | 1456 | } |
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | −void setup_windows(void) | |
| 1459 | +static void setup_windows(void) | |
| 1460 | 1460 | { |
| 1461 | 1461 | int lines, columns; |
| 1462 | 1462 | |
| @@ -129,7 +129,7 @@ static void no_colors_theme(void) · 128 unmodified lines | ||
| 129 | 129 | mkattrn(FUNCTION_TEXT, A_REVERSE); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | −void set_colors() | |
| 132 | +void set_colors(void) | |
| 133 | 133 | { |
| 134 | 134 | start_color(); |
| 135 | 135 | use_default_colors(); |
| @@ -192,7 +192,7 @@ const char *get_line(const char *text, int line_no) · 56 unmodified lines | ||
| 192 | 192 | int lines = 0; |
| 193 | 193 | |
| 194 | 194 | if (!text) |
| 195 | − return 0; | |
| 195 | + return NULL; | |
| 196 | 196 | |
| 197 | 197 | for (i = 0; text[i] != '\0' && lines < line_no; i++) |
| 198 | 198 | if (text[i] == '\n') |
| @@ -106,6 +106,7 @@ all_compiled_sources() · 105 unmodified lines | ||
| 106 | 106 | case "$i" in |
| 107 | 107 | *.[cS]) |
| 108 | 108 | j=${i/\.[cS]/\.o} |
| 109 | + j="${j#$tree}" | |
| 109 | 110 | if [ -e $j ]; then |
| 110 | 111 | echo $i |
| 111 | 112 | fi |
| @@ -1106,10 +1106,8 @@ static int selinux_parse_opts_str(char *options, · 1105 unmodified lines | ||
| 1106 | 1106 | |
| 1107 | 1107 | opts->mnt_opts_flags = kcalloc(NUM_SEL_MNT_OPTS, sizeof(int), |
| 1108 | 1108 | GFP_KERNEL); |
| 1109 | − if (!opts->mnt_opts_flags) { | |
| 1110 | − kfree(opts->mnt_opts); | |
| 1109 | + if (!opts->mnt_opts_flags) | |
| 1111 | 1110 | goto out_err; |
| 1112 | − } | |
| 1113 | 1111 | |
| 1114 | 1112 | if (fscontext) { |
| 1115 | 1113 | opts->mnt_opts[num_mnt_opts] = fscontext; |
| @@ -1132,6 +1130,7 @@ static int selinux_parse_opts_str(char *options, · 16 unmodified lines | ||
| 1132 | 1130 | return 0; |
| 1133 | 1131 | |
| 1134 | 1132 | out_err: |
| 1133 | + security_free_mnt_opts(opts); | |
| 1135 | 1134 | kfree(context); |
| 1136 | 1135 | kfree(defcontext); |
| 1137 | 1136 | kfree(fscontext); |
| @@ -2492,7 +2492,7 @@ static int pcm_chmap_ctl_get(struct snd_kcontrol *kcontrol, · 2491 unmodified lines | ||
| 2492 | 2492 | struct snd_pcm_substream *substream; |
| 2493 | 2493 | const struct snd_pcm_chmap_elem *map; |
| 2494 | 2494 | |
| 2495 | − if (snd_BUG_ON(!info->chmap)) | |
| 2495 | + if (!info->chmap) | |
| 2496 | 2496 | return -EINVAL; |
| 2497 | 2497 | substream = snd_pcm_chmap_substream(info, idx); |
| 2498 | 2498 | if (!substream) |
| @@ -2524,7 +2524,7 @@ static int pcm_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, · 25 unmodified lines | ||
| 2524 | 2524 | unsigned int __user *dst; |
| 2525 | 2525 | int c, count = 0; |
| 2526 | 2526 | |
| 2527 | − if (snd_BUG_ON(!info->chmap)) | |
| 2527 | + if (!info->chmap) | |
| 2528 | 2528 | return -EINVAL; |
| 2529 | 2529 | if (size < 8) |
| 2530 | 2530 | return -ENOMEM; |
| @@ -682,7 +682,9 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, · 681 unmodified lines | ||
| 682 | 682 | cycle = increment_cycle_count(cycle, 1); |
| 683 | 683 | if (s->handle_packet(s, 0, cycle, i) < 0) { |
| 684 | 684 | s->packet_index = -1; |
| 685 | − amdtp_stream_pcm_abort(s); | |
| 685 | + if (in_interrupt()) | |
| 686 | + amdtp_stream_pcm_abort(s); | |
| 687 | + WRITE_ONCE(s->pcm_buffer_pointer, SNDRV_PCM_POS_XRUN); | |
| 686 | 688 | return; |
| 687 | 689 | } |
| 688 | 690 | } |
| @@ -734,7 +736,9 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp, · 45 unmodified lines | ||
| 734 | 736 | /* Queueing error or detecting invalid payload. */ |
| 735 | 737 | if (i < packets) { |
| 736 | 738 | s->packet_index = -1; |
| 737 | − amdtp_stream_pcm_abort(s); | |
| 739 | + if (in_interrupt()) | |
| 740 | + amdtp_stream_pcm_abort(s); | |
| 741 | + WRITE_ONCE(s->pcm_buffer_pointer, SNDRV_PCM_POS_XRUN); | |
| 738 | 742 | return; |
| 739 | 743 | } |
| 740 | 744 | |
| @@ -135,7 +135,7 @@ struct amdtp_stream { · 134 unmodified lines | ||
| 135 | 135 | /* For a PCM substream processing. */ |
| 136 | 136 | struct snd_pcm_substream *pcm; |
| 137 | 137 | struct tasklet_struct period_tasklet; |
| 138 | − unsigned int pcm_buffer_pointer; | |
| 138 | + snd_pcm_uframes_t pcm_buffer_pointer; | |
| 139 | 139 | unsigned int pcm_period_pointer; |
| 140 | 140 | |
| 141 | 141 | /* To wait for first packet. */ |
| @@ -370,10 +370,12 @@ enum { · 369 unmodified lines | ||
| 370 | 370 | #define IS_KBL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d71) |
| 371 | 371 | #define IS_KBL_H(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa2f0) |
| 372 | 372 | #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) |
| 373 | +#define IS_BXT_T(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x1a98) | |
| 373 | 374 | #define IS_GLK(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x3198) |
| 374 | −#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci)) || \ | |
| 375 | − IS_KBL(pci) || IS_KBL_LP(pci) || IS_KBL_H(pci) || \ | |
| 376 | − IS_GLK(pci) | |
| 375 | +#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) | |
| 376 | +#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci) || \ | |
| 377 | + IS_BXT_T(pci) || IS_KBL(pci) || IS_KBL_LP(pci) || \ | |
| 378 | + IS_KBL_H(pci) || IS_GLK(pci) || IS_CFL(pci)) | |
| 377 | 379 | |
| 378 | 380 | static char *driver_short_names[] = { |
| 379 | 381 | [AZX_DRIVER_ICH] = "HDA Intel", |
| @@ -2378,6 +2380,9 @@ static const struct pci_device_id azx_ids[] = { · 1998 unmodified lines | ||
| 2378 | 2380 | /* Kabylake-H */ |
| 2379 | 2381 | { PCI_DEVICE(0x8086, 0xa2f0), |
| 2380 | 2382 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE }, |
| 2383 | + /* Coffelake */ | |
| 2384 | + { PCI_DEVICE(0x8086, 0xa348), | |
| 2385 | + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE}, | |
| 2381 | 2386 | /* Broxton-P(Apollolake) */ |
| 2382 | 2387 | { PCI_DEVICE(0x8086, 0x5a98), |
| 2383 | 2388 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_BROXTON }, |
| @@ -192,7 +192,8 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func, · 191 unmodified lines | ||
| 192 | 192 | "complete_and_exit", |
| 193 | 193 | "kvm_spurious_fault", |
| 194 | 194 | "__reiserfs_panic", |
| 195 | − "lbug_with_loc" | |
| 195 | + "lbug_with_loc", | |
| 196 | + "fortify_panic", | |
| 196 | 197 | }; |
| 197 | 198 | |
| 198 | 199 | if (func->bind == STB_WEAK) |
| @@ -19,18 +19,18 @@ CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | include $(srctree)/tools/scripts/Makefile.arch |
| 21 | 21 | |
| 22 | −$(call detected_var,ARCH) | |
| 22 | +$(call detected_var,SRCARCH) | |
| 23 | 23 | |
| 24 | 24 | NO_PERF_REGS := 1 |
| 25 | 25 | |
| 26 | 26 | # Additional ARCH settings for ppc |
| 27 | −ifeq ($(ARCH),powerpc) | |
| 27 | +ifeq ($(SRCARCH),powerpc) | |
| 28 | 28 | NO_PERF_REGS := 0 |
| 29 | 29 | LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 |
| 30 | 30 | endif |
| 31 | 31 | |
| 32 | 32 | # Additional ARCH settings for x86 |
| 33 | −ifeq ($(ARCH),x86) | |
| 33 | +ifeq ($(SRCARCH),x86) | |
| 34 | 34 | $(call detected,CONFIG_X86) |
| 35 | 35 | ifeq (${IS_64_BIT}, 1) |
| 36 | 36 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated |
| @@ -43,12 +43,12 @@ ifeq ($(ARCH),x86) · 6 unmodified lines | ||
| 43 | 43 | NO_PERF_REGS := 0 |
| 44 | 44 | endif |
| 45 | 45 | |
| 46 | −ifeq ($(ARCH),arm) | |
| 46 | +ifeq ($(SRCARCH),arm) | |
| 47 | 47 | NO_PERF_REGS := 0 |
| 48 | 48 | LIBUNWIND_LIBS = -lunwind -lunwind-arm |
| 49 | 49 | endif |
| 50 | 50 | |
| 51 | −ifeq ($(ARCH),arm64) | |
| 51 | +ifeq ($(SRCARCH),arm64) | |
| 52 | 52 | NO_PERF_REGS := 0 |
| 53 | 53 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 |
| 54 | 54 | endif |
| @@ -61,7 +61,7 @@ endif · 6 unmodified lines | ||
| 61 | 61 | # Disable it on all other architectures in case libdw unwind |
| 62 | 62 | # support is detected in system. Add supported architectures |
| 63 | 63 | # to the check. |
| 64 | −ifneq ($(ARCH),$(filter $(ARCH),x86 arm)) | |
| 64 | +ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm)) | |
| 65 | 65 | NO_LIBDW_DWARF_UNWIND := 1 |
| 66 | 66 | endif |
| 67 | 67 | |
| @@ -115,9 +115,9 @@ endif · 47 unmodified lines | ||
| 115 | 115 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) |
| 116 | 116 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf |
| 117 | 117 | |
| 118 | −FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi | |
| 118 | +FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi | |
| 119 | 119 | # include ARCH specific config |
| 120 | −-include $(src-perf)/arch/$(ARCH)/Makefile | |
| 120 | +-include $(src-perf)/arch/$(SRCARCH)/Makefile | |
| 121 | 121 | |
| 122 | 122 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
| 123 | 123 | CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
| @@ -228,12 +228,12 @@ ifeq ($(DEBUG),0) · 104 unmodified lines | ||
| 228 | 228 | endif |
| 229 | 229 | |
| 230 | 230 | INC_FLAGS += -I$(src-perf)/util/include |
| 231 | −INC_FLAGS += -I$(src-perf)/arch/$(ARCH)/include | |
| 231 | +INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include | |
| 232 | 232 | INC_FLAGS += -I$(srctree)/tools/include/uapi |
| 233 | 233 | INC_FLAGS += -I$(srctree)/tools/include/ |
| 234 | −INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/uapi | |
| 235 | −INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/ | |
| 236 | −INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/ | |
| 234 | +INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi | |
| 235 | +INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/ | |
| 236 | +INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/ | |
| 237 | 237 | |
| 238 | 238 | # $(obj-perf) for generated common-cmds.h |
| 239 | 239 | # $(obj-perf)/util for generated bison/flex headers |
| @@ -355,7 +355,7 @@ ifndef NO_LIBELF · 115 unmodified lines | ||
| 355 | 355 | |
| 356 | 356 | ifndef NO_DWARF |
| 357 | 357 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) |
| 358 | − msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); | |
| 358 | + msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled); | |
| 359 | 359 | NO_DWARF := 1 |
| 360 | 360 | else |
| 361 | 361 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) |
| @@ -380,7 +380,7 @@ ifndef NO_LIBELF · 18 unmodified lines | ||
| 380 | 380 | CFLAGS += -DHAVE_BPF_PROLOGUE |
| 381 | 381 | $(call detected,CONFIG_BPF_PROLOGUE) |
| 382 | 382 | else |
| 383 | − msg := $(warning BPF prologue is not supported by architecture $(ARCH), missing regs_query_register_offset()); | |
| 383 | + msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset()); | |
| 384 | 384 | endif |
| 385 | 385 | else |
| 386 | 386 | msg := $(warning DWARF support is off, BPF prologue is disabled); |
| @@ -406,7 +406,7 @@ ifdef PERF_HAVE_JITDUMP · 19 unmodified lines | ||
| 406 | 406 | endif |
| 407 | 407 | endif |
| 408 | 408 | |
| 409 | −ifeq ($(ARCH),powerpc) | |
| 409 | +ifeq ($(SRCARCH),powerpc) | |
| 410 | 410 | ifndef NO_DWARF |
| 411 | 411 | CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX |
| 412 | 412 | endif |
| @@ -487,7 +487,7 @@ else · 74 unmodified lines | ||
| 487 | 487 | endif |
| 488 | 488 | |
| 489 | 489 | ifndef NO_LOCAL_LIBUNWIND |
| 490 | − ifeq ($(ARCH),$(filter $(ARCH),arm arm64)) | |
| 490 | + ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64)) | |
| 491 | 491 | $(call feature_check,libunwind-debug-frame) |
| 492 | 492 | ifneq ($(feature-libunwind-debug-frame), 1) |
| 493 | 493 | msg := $(warning No debug_frame support found in libunwind); |
| @@ -740,7 +740,7 @@ ifeq (${IS_64_BIT}, 1) · 246 unmodified lines | ||
| 740 | 740 | NO_PERF_READ_VDSO32 := 1 |
| 741 | 741 | endif |
| 742 | 742 | endif |
| 743 | − ifneq ($(ARCH), x86) | |
| 743 | + ifneq ($(SRCARCH), x86) | |
| 744 | 744 | NO_PERF_READ_VDSOX32 := 1 |
| 745 | 745 | endif |
| 746 | 746 | ifndef NO_PERF_READ_VDSOX32 |
| @@ -769,7 +769,7 @@ ifdef LIBBABELTRACE · 22 unmodified lines | ||
| 769 | 769 | endif |
| 770 | 770 | |
| 771 | 771 | ifndef NO_AUXTRACE |
| 772 | − ifeq ($(ARCH),x86) | |
| 772 | + ifeq ($(SRCARCH),x86) | |
| 773 | 773 | ifeq ($(feature-get_cpuid), 0) |
| 774 | 774 | msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); |
| 775 | 775 | NO_AUXTRACE := 1 |
| @@ -872,7 +872,7 @@ sysconfdir = $(prefix)/etc · 96 unmodified lines | ||
| 872 | 872 | ETC_PERFCONFIG = etc/perfconfig |
| 873 | 873 | endif |
| 874 | 874 | ifndef lib |
| 875 | −ifeq ($(ARCH)$(IS_64_BIT), x861) | |
| 875 | +ifeq ($(SRCARCH)$(IS_64_BIT), x861) | |
| 876 | 876 | lib = lib64 |
| 877 | 877 | else |
| 878 | 878 | lib = lib |
| @@ -226,7 +226,7 @@ endif · 225 unmodified lines | ||
| 226 | 226 | |
| 227 | 227 | ifeq ($(config),0) |
| 228 | 228 | include $(srctree)/tools/scripts/Makefile.arch |
| 229 | −-include arch/$(ARCH)/Makefile | |
| 229 | +-include arch/$(SRCARCH)/Makefile | |
| 230 | 230 | endif |
| 231 | 231 | |
| 232 | 232 | # The FEATURE_DUMP_EXPORT holds location of the actual |
| @@ -1,2 +1,2 @@ | ||
| 1 | 1 | libperf-y += common.o |
| 2 | −libperf-y += $(ARCH)/ | |
| 2 | +libperf-y += $(SRCARCH)/ | |
| @@ -2,7 +2,7 @@ hostprogs := jevents · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | jevents-y += json.o jsmn.o jevents.o |
| 4 | 4 | pmu-events-y += pmu-events.o |
| 5 | −JDIR = pmu-events/arch/$(ARCH) | |
| 5 | +JDIR = pmu-events/arch/$(SRCARCH) | |
| 6 | 6 | JSON = $(shell [ -d $(JDIR) ] && \ |
| 7 | 7 | find $(JDIR) -name '*.json' -o -name 'mapfile.csv') |
| 8 | 8 | # |
| @@ -10,4 +10,4 @@ JSON = $(shell [ -d $(JDIR) ] && \ · 1 unmodified line | ||
| 10 | 10 | # directory and create tables in pmu-events.c. |
| 11 | 11 | # |
| 12 | 12 | $(OUTPUT)pmu-events/pmu-events.c: $(JSON) $(JEVENTS) |
| 13 | − $(Q)$(call echo-cmd,gen)$(JEVENTS) $(ARCH) pmu-events/arch $(OUTPUT)pmu-events/pmu-events.c $(V) | |
| 13 | + $(Q)$(call echo-cmd,gen)$(JEVENTS) $(SRCARCH) pmu-events/arch $(OUTPUT)pmu-events/pmu-events.c $(V) | |
| @@ -75,7 +75,7 @@ $(OUTPUT)tests/llvm-src-relocation.c: tests/bpf-script-test-relocation.c tests/B · 74 unmodified lines | ||
| 75 | 75 | $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@ |
| 76 | 76 | $(Q)echo ';' >> $@ |
| 77 | 77 | |
| 78 | −ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64 powerpc)) | |
| 78 | +ifeq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc)) | |
| 79 | 79 | perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o |
| 80 | 80 | endif |
| 81 | 81 | |
| @@ -83,7 +83,7 @@ int test__task_exit(int subtest __maybe_unused) · 82 unmodified lines | ||
| 83 | 83 | |
| 84 | 84 | evsel = perf_evlist__first(evlist); |
| 85 | 85 | evsel->attr.task = 1; |
| 86 | − evsel->attr.sample_freq = 0; | |
| 86 | + evsel->attr.sample_freq = 1; | |
| 87 | 87 | evsel->attr.inherit = 0; |
| 88 | 88 | evsel->attr.watermark = 0; |
| 89 | 89 | evsel->attr.wakeup_events = 1; |
| @@ -273,8 +273,20 @@ struct perf_evsel *perf_evsel__new_cycles(void) · 272 unmodified lines | ||
| 273 | 273 | struct perf_evsel *evsel; |
| 274 | 274 | |
| 275 | 275 | event_attr_init(&attr); |
| 276 | + /* | |
| 277 | + * Unnamed union member, not supported as struct member named | |
| 278 | + * initializer in older compilers such as gcc 4.4.7 | |
| 279 | + * | |
| 280 | + * Just for probing the precise_ip: | |
| 281 | + */ | |
| 282 | + attr.sample_period = 1; | |
| 276 | 283 | |
| 277 | 284 | perf_event_attr__set_max_precise_ip(&attr); |
| 285 | + /* | |
| 286 | + * Now let the usual logic to set up the perf_event_attr defaults | |
| 287 | + * to kick in when we return and before perf_evsel__open() is called. | |
| 288 | + */ | |
| 289 | + attr.sample_period = 0; | |
| 278 | 290 | |
| 279 | 291 | evsel = perf_evsel__new(&attr); |
| 280 | 292 | if (evsel == NULL) |
| @@ -841,7 +841,7 @@ static int write_group_desc(int fd, struct perf_header *h __maybe_unused, · 840 unmodified lines | ||
| 841 | 841 | |
| 842 | 842 | /* |
| 843 | 843 | * default get_cpuid(): nothing gets recorded |
| 844 | − * actual implementation must be in arch/$(ARCH)/util/header.c | |
| 844 | + * actual implementation must be in arch/$(SRCARCH)/util/header.c | |
| 845 | 845 | */ |
| 846 | 846 | int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused) |
| 847 | 847 | { |
| @@ -619,7 +619,7 @@ static int post_process_probe_trace_point(struct probe_trace_point *tp, · 618 unmodified lines | ||
| 619 | 619 | struct map *map, unsigned long offs) |
| 620 | 620 | { |
| 621 | 621 | struct symbol *sym; |
| 622 | − u64 addr = tp->address + tp->offset - offs; | |
| 622 | + u64 addr = tp->address - offs; | |
| 623 | 623 | |
| 624 | 624 | sym = map__find_symbol(map, addr); |
| 625 | 625 | if (!sym) |
| @@ -178,6 +178,14 @@ frame_callback(Dwfl_Frame *state, void *arg) · 177 unmodified lines | ||
| 178 | 178 | Dwarf_Addr pc; |
| 179 | 179 | bool isactivation; |
| 180 | 180 | |
| 181 | + if (!dwfl_frame_pc(state, &pc, NULL)) { | |
| 182 | + pr_err("%s", dwfl_errmsg(-1)); | |
| 183 | + return DWARF_CB_ABORT; | |
| 184 | + } | |
| 185 | + | |
| 186 | + // report the module before we query for isactivation | |
| 187 | + report_module(pc, ui); | |
| 188 | + | |
| 181 | 189 | if (!dwfl_frame_pc(state, &pc, &isactivation)) { |
| 182 | 190 | pr_err("%s", dwfl_errmsg(-1)); |
| 183 | 191 | return DWARF_CB_ABORT; |
| @@ -1,23 +1,42 @@ | ||
| 1 | 1 | #ifndef __BPF_ENDIAN__ |
| 2 | 2 | #define __BPF_ENDIAN__ |
| 3 | 3 | |
| 4 | −#include <asm/byteorder.h> | |
| 4 | +#include <linux/swab.h> | |
| 5 | 5 | |
| 6 | −#if __BYTE_ORDER == __LITTLE_ENDIAN | |
| 7 | −# define __bpf_ntohs(x) __builtin_bswap16(x) | |
| 8 | −# define __bpf_htons(x) __builtin_bswap16(x) | |
| 9 | −#elif __BYTE_ORDER == __BIG_ENDIAN | |
| 10 | −# define __bpf_ntohs(x) (x) | |
| 11 | −# define __bpf_htons(x) (x) | |
| 6 | +/* LLVM's BPF target selects the endianness of the CPU | |
| 7 | + * it compiles on, or the user specifies (bpfel/bpfeb), | |
| 8 | + * respectively. The used __BYTE_ORDER__ is defined by | |
| 9 | + * the compiler, we cannot rely on __BYTE_ORDER from | |
| 10 | + * libc headers, since it doesn't reflect the actual | |
| 11 | + * requested byte order. | |
| 12 | + * | |
| 13 | + * Note, LLVM's BPF target has different __builtin_bswapX() | |
| 14 | + * semantics. It does map to BPF_ALU | BPF_END | BPF_TO_BE | |
| 15 | + * in bpfel and bpfeb case, which means below, that we map | |
| 16 | + * to cpu_to_be16(). We could use it unconditionally in BPF | |
| 17 | + * case, but better not rely on it, so that this header here | |
| 18 | + * can be used from application and BPF program side, which | |
| 19 | + * use different targets. | |
| 20 | + */ | |
| 21 | +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | |
| 22 | +# define __bpf_ntohs(x) __builtin_bswap16(x) | |
| 23 | +# define __bpf_htons(x) __builtin_bswap16(x) | |
| 24 | +# define __bpf_constant_ntohs(x) ___constant_swab16(x) | |
| 25 | +# define __bpf_constant_htons(x) ___constant_swab16(x) | |
| 26 | +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | |
| 27 | +# define __bpf_ntohs(x) (x) | |
| 28 | +# define __bpf_htons(x) (x) | |
| 29 | +# define __bpf_constant_ntohs(x) (x) | |
| 30 | +# define __bpf_constant_htons(x) (x) | |
| 12 | 31 | #else |
| 13 | −# error "Fix your __BYTE_ORDER?!" | |
| 32 | +# error "Fix your compiler's __BYTE_ORDER__?!" | |
| 14 | 33 | #endif |
| 15 | 34 | |
| 16 | 35 | #define bpf_htons(x) \ |
| 17 | 36 | (__builtin_constant_p(x) ? \ |
| 18 | − __constant_htons(x) : __bpf_htons(x)) | |
| 37 | + __bpf_constant_htons(x) : __bpf_htons(x)) | |
| 19 | 38 | #define bpf_ntohs(x) \ |
| 20 | 39 | (__builtin_constant_p(x) ? \ |
| 21 | − __constant_ntohs(x) : __bpf_ntohs(x)) | |
| 40 | + __bpf_constant_ntohs(x) : __bpf_ntohs(x)) | |
| 22 | 41 | |
| 23 | −#endif | |
| 42 | +#endif /* __BPF_ENDIAN__ */ | |
| @@ -305,7 +305,7 @@ function perf_test() · 304 unmodified lines | ||
| 305 | 305 | echo "Running remote perf test $WITH DMA" |
| 306 | 306 | write_file "" $REMOTE_PERF/run |
| 307 | 307 | echo -n " " |
| 308 | − read_file $LOCAL_PERF/run | |
| 308 | + read_file $REMOTE_PERF/run | |
| 309 | 309 | echo " Passed" |
| 310 | 310 | |
| 311 | 311 | _modprobe -r ntb_perf |