Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge 4.8-rc7 into usb-next

We want/need the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+2486 -1584
+1 -1
Documentation/devicetree/bindings/mmc/sdhci-st.txt
··· 10 10 subsystem (mmcss) inside the FlashSS (available in STiH407 SoC 11 11 family). 12 12 13 - - clock-names: Should be "mmc". 13 + - clock-names: Should be "mmc" and "icn". (NB: The latter is not compulsory) 14 14 See: Documentation/devicetree/bindings/resource-names.txt 15 15 - clocks: Phandle to the clock. 16 16 See: Documentation/devicetree/bindings/clock/clock-bindings.txt
+3 -2
MAINTAINERS
··· 1625 1625 ARM/SAMSUNG EXYNOS ARM ARCHITECTURES 1626 1626 M: Kukjin Kim <kgene@kernel.org> 1627 1627 M: Krzysztof Kozlowski <krzk@kernel.org> 1628 + R: Javier Martinez Canillas <javier@osg.samsung.com> 1628 1629 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1629 1630 L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) 1630 1631 S: Maintained ··· 2486 2485 BONDING DRIVER 2487 2486 M: Jay Vosburgh <j.vosburgh@gmail.com> 2488 2487 M: Veaceslav Falico <vfalico@gmail.com> 2489 - M: Andy Gospodarek <gospo@cumulusnetworks.com> 2488 + M: Andy Gospodarek <andy@greyhouse.net> 2490 2489 L: netdev@vger.kernel.org 2491 2490 W: http://sourceforge.net/projects/bonding/ 2492 2491 S: Supported ··· 3270 3269 F: drivers/net/wan/cosa* 3271 3270 3272 3271 CPMAC ETHERNET DRIVER 3273 - M: Florian Fainelli <florian@openwrt.org> 3272 + M: Florian Fainelli <f.fainelli@gmail.com> 3274 3273 L: netdev@vger.kernel.org 3275 3274 S: Maintained 3276 3275 F: drivers/net/ethernet/ti/cpmac.c
+1 -1
Makefile
··· 1 1 VERSION = 4 2 2 PATCHLEVEL = 8 3 3 SUBLEVEL = 0 4 - EXTRAVERSION = -rc6 4 + EXTRAVERSION = -rc7 5 5 NAME = Psychotic Stoned Sheep 6 6 7 7 # *DOCUMENTATION*
+8 -11
arch/alpha/include/asm/uaccess.h
··· 371 371 return __cu_len; 372 372 } 373 373 374 - extern inline long 375 - __copy_tofrom_user(void *to, const void *from, long len, const void __user *validate) 376 - { 377 - if (__access_ok((unsigned long)validate, len, get_fs())) 378 - len = __copy_tofrom_user_nocheck(to, from, len); 379 - return len; 380 - } 381 - 382 374 #define __copy_to_user(to, from, n) \ 383 375 ({ \ 384 376 __chk_user_ptr(to); \ ··· 385 393 #define __copy_to_user_inatomic __copy_to_user 386 394 #define __copy_from_user_inatomic __copy_from_user 387 395 388 - 389 396 extern inline long 390 397 copy_to_user(void __user *to, const void *from, long n) 391 398 { 392 - return __copy_tofrom_user((__force void *)to, from, n, to); 399 + if (likely(__access_ok((unsigned long)to, n, get_fs()))) 400 + n = __copy_tofrom_user_nocheck((__force void *)to, from, n); 401 + return n; 393 402 } 394 403 395 404 extern inline long 396 405 copy_from_user(void *to, const void __user *from, long n) 397 406 { 398 - return __copy_tofrom_user(to, (__force void *)from, n, from); 407 + if (likely(__access_ok((unsigned long)from, n, get_fs()))) 408 + n = __copy_tofrom_user_nocheck(to, (__force void *)from, n); 409 + else 410 + memset(to, 0, n); 411 + return n; 399 412 } 400 413 401 414 extern void __do_clear_user(void);
+9 -2
arch/arc/include/asm/uaccess.h
··· 83 83 "2: ;nop\n" \ 84 84 " .section .fixup, \"ax\"\n" \ 85 85 " .align 4\n" \ 86 - "3: mov %0, %3\n" \ 86 + "3: # return -EFAULT\n" \ 87 + " mov %0, %3\n" \ 88 + " # zero out dst ptr\n" \ 89 + " mov %1, 0\n" \ 87 90 " j 2b\n" \ 88 91 " .previous\n" \ 89 92 " .section __ex_table, \"a\"\n" \ ··· 104 101 "2: ;nop\n" \ 105 102 " .section .fixup, \"ax\"\n" \ 106 103 " .align 4\n" \ 107 - "3: mov %0, %3\n" \ 104 + "3: # return -EFAULT\n" \ 105 + " mov %0, %3\n" \ 106 + " # zero out dst ptr\n" \ 107 + " mov %1, 0\n" \ 108 + " mov %R1, 0\n" \ 108 109 " j 2b\n" \ 109 110 " .previous\n" \ 110 111 " .section __ex_table, \"a\"\n" \
+1
arch/arm/boot/dts/bcm2835-rpi.dtsi
··· 2 2 3 3 / { 4 4 memory { 5 + device_type = "memory"; 5 6 reg = <0 0x10000000>; 6 7 }; 7 8
+2 -1
arch/arm/boot/dts/bcm283x.dtsi
··· 2 2 #include <dt-bindings/clock/bcm2835.h> 3 3 #include <dt-bindings/clock/bcm2835-aux.h> 4 4 #include <dt-bindings/gpio/gpio.h> 5 - #include "skeleton.dtsi" 6 5 7 6 /* This include file covers the common peripherals and configuration between 8 7 * bcm2835 and bcm2836 implementations, leaving the CPU configuration to ··· 12 13 compatible = "brcm,bcm2835"; 13 14 model = "BCM2835"; 14 15 interrupt-parent = <&intc>; 16 + #address-cells = <1>; 17 + #size-cells = <1>; 15 18 16 19 chosen { 17 20 bootargs = "earlyprintk console=ttyAMA0";
+6 -4
arch/arm/boot/dts/stih407-family.dtsi
··· 550 550 interrupt-names = "mmcirq"; 551 551 pinctrl-names = "default"; 552 552 pinctrl-0 = <&pinctrl_mmc0>; 553 - clock-names = "mmc"; 554 - clocks = <&clk_s_c0_flexgen CLK_MMC_0>; 553 + clock-names = "mmc", "icn"; 554 + clocks = <&clk_s_c0_flexgen CLK_MMC_0>, 555 + <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; 555 556 bus-width = <8>; 556 557 non-removable; 557 558 }; ··· 566 565 interrupt-names = "mmcirq"; 567 566 pinctrl-names = "default"; 568 567 pinctrl-0 = <&pinctrl_sd1>; 569 - clock-names = "mmc"; 570 - clocks = <&clk_s_c0_flexgen CLK_MMC_1>; 568 + clock-names = "mmc", "icn"; 569 + clocks = <&clk_s_c0_flexgen CLK_MMC_1>, 570 + <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; 571 571 resets = <&softreset STIH407_MMC1_SOFTRESET>; 572 572 bus-width = <4>; 573 573 };
+8 -4
arch/arm/boot/dts/stih410.dtsi
··· 41 41 compatible = "st,st-ohci-300x"; 42 42 reg = <0x9a03c00 0x100>; 43 43 interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; 44 - clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; 44 + clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, 45 + <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; 45 46 resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, 46 47 <&softreset STIH407_USB2_PORT0_SOFTRESET>; 47 48 reset-names = "power", "softreset"; ··· 58 57 interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; 59 58 pinctrl-names = "default"; 60 59 pinctrl-0 = <&pinctrl_usb0>; 61 - clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; 60 + clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, 61 + <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; 62 62 resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, 63 63 <&softreset STIH407_USB2_PORT0_SOFTRESET>; 64 64 reset-names = "power", "softreset"; ··· 73 71 compatible = "st,st-ohci-300x"; 74 72 reg = <0x9a83c00 0x100>; 75 73 interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; 76 - clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; 74 + clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, 75 + <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; 77 76 resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, 78 77 <&softreset STIH407_USB2_PORT1_SOFTRESET>; 79 78 reset-names = "power", "softreset"; ··· 90 87 interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; 91 88 pinctrl-names = "default"; 92 89 pinctrl-0 = <&pinctrl_usb1>; 93 - clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; 90 + clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, 91 + <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; 94 92 resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, 95 93 <&softreset STIH407_USB2_PORT1_SOFTRESET>; 96 94 reset-names = "power", "softreset";
+2 -3
arch/arm/common/locomo.c
··· 140 140 141 141 static void locomo_handler(struct irq_desc *desc) 142 142 { 143 - struct locomo *lchip = irq_desc_get_chip_data(desc); 143 + struct locomo *lchip = irq_desc_get_handler_data(desc); 144 144 int req, i; 145 145 146 146 /* Acknowledge the parent IRQ */ ··· 200 200 * Install handler for IRQ_LOCOMO_HW. 201 201 */ 202 202 irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); 203 - irq_set_chip_data(lchip->irq, lchip); 204 - irq_set_chained_handler(lchip->irq, locomo_handler); 203 + irq_set_chained_handler_and_data(lchip->irq, locomo_handler, lchip); 205 204 206 205 /* Install handlers for IRQ_LOCOMO_* */ 207 206 for ( ; irq <= lchip->irq_base + 3; irq++) {
+19 -13
arch/arm/common/sa1111.c
··· 472 472 * specifies that S0ReadyInt and S1ReadyInt should be '1'. 473 473 */ 474 474 sa1111_writel(0, irqbase + SA1111_INTPOL0); 475 - sa1111_writel(SA1111_IRQMASK_HI(IRQ_S0_READY_NINT) | 476 - SA1111_IRQMASK_HI(IRQ_S1_READY_NINT), 475 + sa1111_writel(BIT(IRQ_S0_READY_NINT & 31) | 476 + BIT(IRQ_S1_READY_NINT & 31), 477 477 irqbase + SA1111_INTPOL1); 478 478 479 479 /* clear all IRQs */ ··· 754 754 if (sachip->irq != NO_IRQ) { 755 755 ret = sa1111_setup_irq(sachip, pd->irq_base); 756 756 if (ret) 757 - goto err_unmap; 757 + goto err_clk; 758 758 } 759 759 760 760 #ifdef CONFIG_ARCH_SA1100 ··· 799 799 800 800 return 0; 801 801 802 + err_clk: 803 + clk_disable(sachip->clk); 802 804 err_unmap: 803 805 iounmap(sachip->base); 804 806 err_clk_unprep: ··· 871 869 872 870 #ifdef CONFIG_PM 873 871 874 - static int sa1111_suspend(struct platform_device *dev, pm_message_t state) 872 + static int sa1111_suspend_noirq(struct device *dev) 875 873 { 876 - struct sa1111 *sachip = platform_get_drvdata(dev); 874 + struct sa1111 *sachip = dev_get_drvdata(dev); 877 875 struct sa1111_save_data *save; 878 876 unsigned long flags; 879 877 unsigned int val; ··· 936 934 * restored by their respective drivers, and must be called 937 935 * via LDM after this function. 938 936 */ 939 - static int sa1111_resume(struct platform_device *dev) 937 + static int sa1111_resume_noirq(struct device *dev) 940 938 { 941 - struct sa1111 *sachip = platform_get_drvdata(dev); 939 + struct sa1111 *sachip = dev_get_drvdata(dev); 942 940 struct sa1111_save_data *save; 943 941 unsigned long flags, id; 944 942 void __iomem *base; ··· 954 952 id = sa1111_readl(sachip->base + SA1111_SKID); 955 953 if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { 956 954 __sa1111_remove(sachip); 957 - platform_set_drvdata(dev, NULL); 955 + dev_set_drvdata(dev, NULL); 958 956 kfree(save); 959 957 return 0; 960 958 } ··· 1005 1003 } 1006 1004 1007 1005 #else 1008 - #define sa1111_suspend NULL 1009 - #define sa1111_resume NULL 1006 + #define sa1111_suspend_noirq NULL 1007 + #define sa1111_resume_noirq NULL 1010 1008 #endif 1011 1009 1012 1010 static int sa1111_probe(struct platform_device *pdev) ··· 1019 1017 return -EINVAL; 1020 1018 irq = platform_get_irq(pdev, 0); 1021 1019 if (irq < 0) 1022 - return -ENXIO; 1020 + return irq; 1023 1021 1024 1022 return __sa1111_probe(&pdev->dev, mem, irq); 1025 1023 } ··· 1040 1038 return 0; 1041 1039 } 1042 1040 1041 + static struct dev_pm_ops sa1111_pm_ops = { 1042 + .suspend_noirq = sa1111_suspend_noirq, 1043 + .resume_noirq = sa1111_resume_noirq, 1044 + }; 1045 + 1043 1046 /* 1044 1047 * Not sure if this should be on the system bus or not yet. 1045 1048 * We really want some way to register a system device at ··· 1057 1050 static struct platform_driver sa1111_device_driver = { 1058 1051 .probe = sa1111_probe, 1059 1052 .remove = sa1111_remove, 1060 - .suspend = sa1111_suspend, 1061 - .resume = sa1111_resume, 1062 1053 .driver = { 1063 1054 .name = "sa1111", 1055 + .pm = &sa1111_pm_ops, 1064 1056 }, 1065 1057 }; 1066 1058
+1
arch/arm/configs/keystone_defconfig
··· 161 161 CONFIG_USB_XHCI_HCD=y 162 162 CONFIG_USB_STORAGE=y 163 163 CONFIG_USB_DWC3=y 164 + CONFIG_NOP_USB_XCEIV=y 164 165 CONFIG_KEYSTONE_USB_PHY=y 165 166 CONFIG_NEW_LEDS=y 166 167 CONFIG_LEDS_CLASS=y
+1 -1
arch/arm/configs/multi_v7_defconfig
··· 781 781 CONFIG_DMA_BCM2835=y 782 782 CONFIG_DMA_OMAP=y 783 783 CONFIG_QCOM_BAM_DMA=y 784 - CONFIG_XILINX_VDMA=y 784 + CONFIG_XILINX_DMA=y 785 785 CONFIG_DMA_SUN6I=y 786 786 CONFIG_STAGING=y 787 787 CONFIG_SENSORS_ISL29018=y
+1
arch/arm/include/asm/pgtable-2level-hwdef.h
··· 47 47 #define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) 48 48 #define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE) 49 49 #define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) 50 + #define PMD_SECT_CACHE_MASK (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) 50 51 #define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2)) 51 52 52 53 /*
+1
arch/arm/include/asm/pgtable-3level-hwdef.h
··· 62 62 #define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */ 63 63 #define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */ 64 64 #define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */ 65 + #define PMD_SECT_CACHE_MASK (_AT(pmdval_t, 7) << 2) 65 66 66 67 /* 67 68 * + Level 3 descriptor (PTE)
-2
arch/arm/kvm/arm.c
··· 158 158 { 159 159 int i; 160 160 161 - kvm_free_stage2_pgd(kvm); 162 - 163 161 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 164 162 if (kvm->vcpus[i]) { 165 163 kvm_arch_vcpu_free(kvm->vcpus[i]);
+3 -1
arch/arm/kvm/mmu.c
··· 1714 1714 kern_hyp_va(PAGE_OFFSET), kern_hyp_va(~0UL)); 1715 1715 1716 1716 if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && 1717 - hyp_idmap_start < kern_hyp_va(~0UL)) { 1717 + hyp_idmap_start < kern_hyp_va(~0UL) && 1718 + hyp_idmap_start != (unsigned long)__hyp_idmap_text_start) { 1718 1719 /* 1719 1720 * The idmap page is intersecting with the VA space, 1720 1721 * it is not safe to continue further. ··· 1894 1893 1895 1894 void kvm_arch_flush_shadow_all(struct kvm *kvm) 1896 1895 { 1896 + kvm_free_stage2_pgd(kvm); 1897 1897 } 1898 1898 1899 1899 void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
+6
arch/arm/mach-exynos/suspend.c
··· 255 255 return -ENOMEM; 256 256 } 257 257 258 + /* 259 + * Clear the OF_POPULATED flag set in of_irq_init so that 260 + * later the Exynos PMU platform device won't be skipped. 261 + */ 262 + of_node_clear_flag(node, OF_POPULATED); 263 + 258 264 return 0; 259 265 } 260 266
+14
arch/arm/mach-pxa/lubbock.c
··· 137 137 // no D+ pullup; lubbock can't connect/disconnect in software 138 138 }; 139 139 140 + static void lubbock_init_pcmcia(void) 141 + { 142 + struct clk *clk; 143 + 144 + /* Add an alias for the SA1111 PCMCIA clock */ 145 + clk = clk_get_sys("pxa2xx-pcmcia", NULL); 146 + if (!IS_ERR(clk)) { 147 + clkdev_create(clk, NULL, "1800"); 148 + clk_put(clk); 149 + } 150 + } 151 + 140 152 static struct resource sa1111_resources[] = { 141 153 [0] = { 142 154 .start = 0x10000000, ··· 478 466 pxa_set_ffuart_info(NULL); 479 467 pxa_set_btuart_info(NULL); 480 468 pxa_set_stuart_info(NULL); 469 + 470 + lubbock_init_pcmcia(); 481 471 482 472 clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); 483 473 pxa_set_udc_info(&udc_info);
+26 -36
arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
··· 41 41 42 42 #define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */ 43 43 44 + /* start of DA9210 System Control and Event Registers */ 45 + #define DA9210_REG_MASK_A 0x54 46 + 44 47 static void __iomem *irqc; 45 48 46 - static const u8 da9063_mask_regs[] = { 47 - DA9063_REG_IRQ_MASK_A, 48 - DA9063_REG_IRQ_MASK_B, 49 - DA9063_REG_IRQ_MASK_C, 50 - DA9063_REG_IRQ_MASK_D, 49 + /* first byte sets the memory pointer, following are consecutive reg values */ 50 + static u8 da9063_irq_clr[] = { DA9063_REG_IRQ_MASK_A, 0xff, 0xff, 0xff, 0xff }; 51 + static u8 da9210_irq_clr[] = { DA9210_REG_MASK_A, 0xff, 0xff }; 52 + 53 + static struct i2c_msg da9xxx_msgs[2] = { 54 + { 55 + .addr = 0x58, 56 + .len = ARRAY_SIZE(da9063_irq_clr), 57 + .buf = da9063_irq_clr, 58 + }, { 59 + .addr = 0x68, 60 + .len = ARRAY_SIZE(da9210_irq_clr), 61 + .buf = da9210_irq_clr, 62 + }, 51 63 }; 52 - 53 - /* DA9210 System Control and Event Registers */ 54 - #define DA9210_REG_MASK_A 0x54 55 - #define DA9210_REG_MASK_B 0x55 56 - 57 - static const u8 da9210_mask_regs[] = { 58 - DA9210_REG_MASK_A, 59 - DA9210_REG_MASK_B, 60 - }; 61 - 62 - static void da9xxx_mask_irqs(struct i2c_client *client, const u8 regs[], 63 - unsigned int nregs) 64 - { 65 - unsigned int i; 66 - 67 - dev_info(&client->dev, "Masking %s interrupt sources\n", client->name); 68 - 69 - for (i = 0; i < nregs; i++) { 70 - int error = i2c_smbus_write_byte_data(client, regs[i], ~0); 71 - if (error) { 72 - dev_err(&client->dev, "i2c error %d\n", error); 73 - return; 74 - } 75 - } 76 - } 77 64 78 65 static int regulator_quirk_notify(struct notifier_block *nb, 79 66 unsigned long action, void *data) ··· 80 93 client = to_i2c_client(dev); 81 94 dev_dbg(dev, "Detected %s\n", client->name); 82 95 83 - if ((client->addr == 0x58 && !strcmp(client->name, "da9063"))) 84 - da9xxx_mask_irqs(client, da9063_mask_regs, 85 - ARRAY_SIZE(da9063_mask_regs)); 86 - else if (client->addr == 0x68 && !strcmp(client->name, "da9210")) 87 - da9xxx_mask_irqs(client, da9210_mask_regs, 88 - ARRAY_SIZE(da9210_mask_regs)); 96 + if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) || 97 + (client->addr == 0x68 && !strcmp(client->name, "da9210"))) { 98 + int ret; 99 + 100 + dev_info(&client->dev, "clearing da9063/da9210 interrupts\n"); 101 + ret = i2c_transfer(client->adapter, da9xxx_msgs, ARRAY_SIZE(da9xxx_msgs)); 102 + if (ret != ARRAY_SIZE(da9xxx_msgs)) 103 + dev_err(&client->dev, "i2c error %d\n", ret); 104 + } 89 105 90 106 mon = ioread32(irqc + IRQC_MONITOR); 91 107 if (mon & REGULATOR_IRQ_MASK)
+1 -1
arch/arm/mm/mmu.c
··· 137 137 138 138 initial_pmd_value = pmd; 139 139 140 - pmd &= PMD_SECT_TEX(1) | PMD_SECT_BUFFERABLE | PMD_SECT_CACHEABLE; 140 + pmd &= PMD_SECT_CACHE_MASK; 141 141 142 142 for (i = 0; i < ARRAY_SIZE(cache_policies); i++) 143 143 if (cache_policies[i].pmd == pmd) {
+3 -4
arch/arm/xen/enlighten.c
··· 170 170 pr_info("Xen: initializing cpu%d\n", cpu); 171 171 vcpup = per_cpu_ptr(xen_vcpu_info, cpu); 172 172 173 - /* Direct vCPU id mapping for ARM guests. */ 174 - per_cpu(xen_vcpu_id, cpu) = cpu; 175 - 176 173 info.mfn = virt_to_gfn(vcpup); 177 174 info.offset = xen_offset_in_page(vcpup); 178 175 ··· 327 330 { 328 331 struct xen_add_to_physmap xatp; 329 332 struct shared_info *shared_info_page = NULL; 333 + int cpu; 330 334 331 335 if (!xen_domain()) 332 336 return 0; ··· 378 380 return -ENOMEM; 379 381 380 382 /* Direct vCPU id mapping for ARM guests. */ 381 - per_cpu(xen_vcpu_id, 0) = 0; 383 + for_each_possible_cpu(cpu) 384 + per_cpu(xen_vcpu_id, cpu) = cpu; 382 385 383 386 xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); 384 387 if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn,
+4 -4
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
··· 255 255 /* Local timer */ 256 256 timer { 257 257 compatible = "arm,armv8-timer"; 258 - interrupts = <1 13 0xf01>, 259 - <1 14 0xf01>, 260 - <1 11 0xf01>, 261 - <1 10 0xf01>; 258 + interrupts = <1 13 0xf08>, 259 + <1 14 0xf08>, 260 + <1 11 0xf08>, 261 + <1 10 0xf08>; 262 262 }; 263 263 264 264 timer0: timer0@ffc03000 {
+4 -4
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
··· 102 102 timer { 103 103 compatible = "arm,armv8-timer"; 104 104 interrupts = <GIC_PPI 13 105 - (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, 105 + (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, 106 106 <GIC_PPI 14 107 - (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, 107 + (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, 108 108 <GIC_PPI 11 109 - (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, 109 + (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, 110 110 <GIC_PPI 10 111 - (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>; 111 + (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>; 112 112 }; 113 113 114 114 xtal: xtal-clk {
+4 -4
arch/arm64/boot/dts/apm/apm-storm.dtsi
··· 110 110 111 111 timer { 112 112 compatible = "arm,armv8-timer"; 113 - interrupts = <1 0 0xff01>, /* Secure Phys IRQ */ 114 - <1 13 0xff01>, /* Non-secure Phys IRQ */ 115 - <1 14 0xff01>, /* Virt IRQ */ 116 - <1 15 0xff01>; /* Hyp IRQ */ 113 + interrupts = <1 0 0xff08>, /* Secure Phys IRQ */ 114 + <1 13 0xff08>, /* Non-secure Phys IRQ */ 115 + <1 14 0xff08>, /* Virt IRQ */ 116 + <1 15 0xff08>; /* Hyp IRQ */ 117 117 clock-frequency = <50000000>; 118 118 }; 119 119
+2 -2
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
··· 1 1 /dts-v1/; 2 2 #include "bcm2837.dtsi" 3 - #include "../../../../arm/boot/dts/bcm2835-rpi.dtsi" 4 - #include "../../../../arm/boot/dts/bcm283x-rpi-smsc9514.dtsi" 3 + #include "bcm2835-rpi.dtsi" 4 + #include "bcm283x-rpi-smsc9514.dtsi" 5 5 6 6 / { 7 7 compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
+1 -1
arch/arm64/boot/dts/broadcom/bcm2837.dtsi
··· 1 - #include "../../../../arm/boot/dts/bcm283x.dtsi" 1 + #include "bcm283x.dtsi" 2 2 3 3 / { 4 4 compatible = "brcm,bcm2836";
+4 -4
arch/arm64/boot/dts/broadcom/ns2.dtsi
··· 88 88 timer { 89 89 compatible = "arm,armv8-timer"; 90 90 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | 91 - IRQ_TYPE_EDGE_RISING)>, 91 + IRQ_TYPE_LEVEL_LOW)>, 92 92 <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | 93 - IRQ_TYPE_EDGE_RISING)>, 93 + IRQ_TYPE_LEVEL_LOW)>, 94 94 <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | 95 - IRQ_TYPE_EDGE_RISING)>, 95 + IRQ_TYPE_LEVEL_LOW)>, 96 96 <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | 97 - IRQ_TYPE_EDGE_RISING)>; 97 + IRQ_TYPE_LEVEL_LOW)>; 98 98 }; 99 99 100 100 pmu {
+4 -4
arch/arm64/boot/dts/cavium/thunder-88xx.dtsi
··· 354 354 355 355 timer { 356 356 compatible = "arm,armv8-timer"; 357 - interrupts = <1 13 0xff01>, 358 - <1 14 0xff01>, 359 - <1 11 0xff01>, 360 - <1 10 0xff01>; 357 + interrupts = <1 13 4>, 358 + <1 14 4>, 359 + <1 11 4>, 360 + <1 10 4>; 361 361 }; 362 362 363 363 pmu {
+4 -4
arch/arm64/boot/dts/exynos/exynos7.dtsi
··· 473 473 474 474 timer { 475 475 compatible = "arm,armv8-timer"; 476 - interrupts = <1 13 0xff01>, 477 - <1 14 0xff01>, 478 - <1 11 0xff01>, 479 - <1 10 0xff01>; 476 + interrupts = <1 13 0xff08>, 477 + <1 14 0xff08>, 478 + <1 11 0xff08>, 479 + <1 10 0xff08>; 480 480 }; 481 481 482 482 pmu_system_controller: system-controller@105c0000 {
+4 -4
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
··· 119 119 120 120 timer { 121 121 compatible = "arm,armv8-timer"; 122 - interrupts = <1 13 0x1>, /* Physical Secure PPI */ 123 - <1 14 0x1>, /* Physical Non-Secure PPI */ 124 - <1 11 0x1>, /* Virtual PPI */ 125 - <1 10 0x1>; /* Hypervisor PPI */ 122 + interrupts = <1 13 0xf08>, /* Physical Secure PPI */ 123 + <1 14 0xf08>, /* Physical Non-Secure PPI */ 124 + <1 11 0xf08>, /* Virtual PPI */ 125 + <1 10 0xf08>; /* Hypervisor PPI */ 126 126 }; 127 127 128 128 pmu {
+4 -4
arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi
··· 191 191 192 192 timer { 193 193 compatible = "arm,armv8-timer"; 194 - interrupts = <1 13 0x8>, /* Physical Secure PPI, active-low */ 195 - <1 14 0x8>, /* Physical Non-Secure PPI, active-low */ 196 - <1 11 0x8>, /* Virtual PPI, active-low */ 197 - <1 10 0x8>; /* Hypervisor PPI, active-low */ 194 + interrupts = <1 13 4>, /* Physical Secure PPI, active-low */ 195 + <1 14 4>, /* Physical Non-Secure PPI, active-low */ 196 + <1 11 4>, /* Virtual PPI, active-low */ 197 + <1 10 4>; /* Hypervisor PPI, active-low */ 198 198 }; 199 199 200 200 pmu {
+4 -4
arch/arm64/boot/dts/marvell/armada-ap806.dtsi
··· 122 122 123 123 timer { 124 124 compatible = "arm,armv8-timer"; 125 - interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, 126 - <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, 127 - <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, 128 - <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; 125 + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 126 + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 127 + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 128 + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 129 129 }; 130 130 131 131 odmi: odmi@300000 {
+4 -4
arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi
··· 129 129 130 130 timer { 131 131 compatible = "arm,armv8-timer"; 132 - interrupts = <1 13 0xf01>, 133 - <1 14 0xf01>, 134 - <1 11 0xf01>, 135 - <1 10 0xf01>; 132 + interrupts = <1 13 4>, 133 + <1 14 4>, 134 + <1 11 4>, 135 + <1 10 4>; 136 136 }; 137 137 138 138 soc {
+4 -4
arch/arm64/boot/dts/xilinx/zynqmp.dtsi
··· 65 65 timer { 66 66 compatible = "arm,armv8-timer"; 67 67 interrupt-parent = <&gic>; 68 - interrupts = <1 13 0xf01>, 69 - <1 14 0xf01>, 70 - <1 11 0xf01>, 71 - <1 10 0xf01>; 68 + interrupts = <1 13 0xf08>, 69 + <1 14 0xf08>, 70 + <1 11 0xf08>, 71 + <1 10 0xf08>; 72 72 }; 73 73 74 74 amba_apu {
+10 -1
arch/avr32/include/asm/uaccess.h
··· 74 74 75 75 extern __kernel_size_t copy_to_user(void __user *to, const void *from, 76 76 __kernel_size_t n); 77 - extern __kernel_size_t copy_from_user(void *to, const void __user *from, 77 + extern __kernel_size_t ___copy_from_user(void *to, const void __user *from, 78 78 __kernel_size_t n); 79 79 80 80 static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, ··· 87 87 __kernel_size_t n) 88 88 { 89 89 return __copy_user(to, (const void __force *)from, n); 90 + } 91 + static inline __kernel_size_t copy_from_user(void *to, 92 + const void __user *from, 93 + __kernel_size_t n) 94 + { 95 + size_t res = ___copy_from_user(to, from, n); 96 + if (unlikely(res)) 97 + memset(to + (n - res), 0, res); 98 + return res; 90 99 } 91 100 92 101 #define __copy_to_user_inatomic __copy_to_user
+1 -1
arch/avr32/kernel/avr32_ksyms.c
··· 36 36 /* 37 37 * Userspace access stuff. 38 38 */ 39 - EXPORT_SYMBOL(copy_from_user); 39 + EXPORT_SYMBOL(___copy_from_user); 40 40 EXPORT_SYMBOL(copy_to_user); 41 41 EXPORT_SYMBOL(__copy_user); 42 42 EXPORT_SYMBOL(strncpy_from_user);
+4 -4
arch/avr32/lib/copy_user.S
··· 23 23 */ 24 24 .text 25 25 .align 1 26 - .global copy_from_user 27 - .type copy_from_user, @function 28 - copy_from_user: 26 + .global ___copy_from_user 27 + .type ___copy_from_user, @function 28 + ___copy_from_user: 29 29 branch_if_kernel r8, __copy_user 30 30 ret_if_privileged r8, r11, r10, r10 31 31 rjmp __copy_user 32 - .size copy_from_user, . - copy_from_user 32 + .size ___copy_from_user, . - ___copy_from_user 33 33 34 34 .global copy_to_user 35 35 .type copy_to_user, @function
+5 -4
arch/blackfin/include/asm/uaccess.h
··· 171 171 static inline unsigned long __must_check 172 172 copy_from_user(void *to, const void __user *from, unsigned long n) 173 173 { 174 - if (access_ok(VERIFY_READ, from, n)) 174 + if (likely(access_ok(VERIFY_READ, from, n))) { 175 175 memcpy(to, (const void __force *)from, n); 176 - else 177 - return n; 178 - return 0; 176 + return 0; 177 + } 178 + memset(to, 0, n); 179 + return n; 179 180 } 180 181 181 182 static inline unsigned long __must_check
+32 -39
arch/cris/include/asm/uaccess.h
··· 194 194 extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); 195 195 extern unsigned long __do_clear_user(void __user *to, unsigned long n); 196 196 197 - static inline unsigned long 198 - __generic_copy_to_user(void __user *to, const void *from, unsigned long n) 199 - { 200 - if (access_ok(VERIFY_WRITE, to, n)) 201 - return __copy_user(to, from, n); 202 - return n; 203 - } 204 - 205 - static inline unsigned long 206 - __generic_copy_from_user(void *to, const void __user *from, unsigned long n) 207 - { 208 - if (access_ok(VERIFY_READ, from, n)) 209 - return __copy_user_zeroing(to, from, n); 210 - return n; 211 - } 212 - 213 - static inline unsigned long 214 - __generic_clear_user(void __user *to, unsigned long n) 215 - { 216 - if (access_ok(VERIFY_WRITE, to, n)) 217 - return __do_clear_user(to, n); 218 - return n; 219 - } 220 - 221 197 static inline long 222 198 __strncpy_from_user(char *dst, const char __user *src, long count) 223 199 { ··· 258 282 else if (n == 24) 259 283 __asm_copy_from_user_24(to, from, ret); 260 284 else 261 - ret = __generic_copy_from_user(to, from, n); 285 + ret = __copy_user_zeroing(to, from, n); 262 286 263 287 return ret; 264 288 } ··· 309 333 else if (n == 24) 310 334 __asm_copy_to_user_24(to, from, ret); 311 335 else 312 - ret = __generic_copy_to_user(to, from, n); 336 + ret = __copy_user(to, from, n); 313 337 314 338 return ret; 315 339 } ··· 342 366 else if (n == 24) 343 367 __asm_clear_24(to, ret); 344 368 else 345 - ret = __generic_clear_user(to, n); 369 + ret = __do_clear_user(to, n); 346 370 347 371 return ret; 348 372 } 349 373 350 374 351 - #define clear_user(to, n) \ 352 - (__builtin_constant_p(n) ? \ 353 - __constant_clear_user(to, n) : \ 354 - __generic_clear_user(to, n)) 375 + static inline size_t clear_user(void __user *to, size_t n) 376 + { 377 + if (unlikely(!access_ok(VERIFY_WRITE, to, n))) 378 + return n; 379 + if (__builtin_constant_p(n)) 380 + return __constant_clear_user(to, n); 381 + else 382 + return __do_clear_user(to, n); 383 + } 355 384 356 - #define copy_from_user(to, from, n) \ 357 - (__builtin_constant_p(n) ? \ 358 - __constant_copy_from_user(to, from, n) : \ 359 - __generic_copy_from_user(to, from, n)) 385 + static inline size_t copy_from_user(void *to, const void __user *from, size_t n) 386 + { 387 + if (unlikely(!access_ok(VERIFY_READ, from, n))) { 388 + memset(to, 0, n); 389 + return n; 390 + } 391 + if (__builtin_constant_p(n)) 392 + return __constant_copy_from_user(to, from, n); 393 + else 394 + return __copy_user_zeroing(to, from, n); 395 + } 360 396 361 - #define copy_to_user(to, from, n) \ 362 - (__builtin_constant_p(n) ? \ 363 - __constant_copy_to_user(to, from, n) : \ 364 - __generic_copy_to_user(to, from, n)) 397 + static inline size_t copy_to_user(void __user *to, const void *from, size_t n) 398 + { 399 + if (unlikely(!access_ok(VERIFY_WRITE, to, n))) 400 + return n; 401 + if (__builtin_constant_p(n)) 402 + return __constant_copy_to_user(to, from, n); 403 + else 404 + return __copy_user(to, from, n); 405 + } 365 406 366 407 /* We let the __ versions of copy_from/to_user inline, because they're often 367 408 * used in fast paths and have only a small space overhead.
+9 -3
arch/frv/include/asm/uaccess.h
··· 263 263 extern long __memset_user(void *dst, unsigned long count); 264 264 extern long __memcpy_user(void *dst, const void *src, unsigned long count); 265 265 266 - #define clear_user(dst,count) __memset_user(____force(dst), (count)) 266 + #define __clear_user(dst,count) __memset_user(____force(dst), (count)) 267 267 #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) 268 268 #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) 269 269 270 270 #else 271 271 272 - #define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) 272 + #define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) 273 273 #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) 274 274 #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) 275 275 276 276 #endif 277 277 278 - #define __clear_user clear_user 278 + static inline unsigned long __must_check 279 + clear_user(void __user *to, unsigned long n) 280 + { 281 + if (likely(__access_ok(to, n))) 282 + n = __clear_user(to, n); 283 + return n; 284 + } 279 285 280 286 static inline unsigned long __must_check 281 287 __copy_to_user(void __user *to, const void *from, unsigned long n)
+2 -1
arch/hexagon/include/asm/uaccess.h
··· 103 103 { 104 104 long res = __strnlen_user(src, n); 105 105 106 - /* return from strnlen can't be zero -- that would be rubbish. */ 106 + if (unlikely(!res)) 107 + return -EFAULT; 107 108 108 109 if (res > n) { 109 110 copy_from_user(dst, src, n);
+10 -13
arch/ia64/include/asm/uaccess.h
··· 269 269 __cu_len; \ 270 270 }) 271 271 272 - #define copy_from_user(to, from, n) \ 273 - ({ \ 274 - void *__cu_to = (to); \ 275 - const void __user *__cu_from = (from); \ 276 - long __cu_len = (n); \ 277 - \ 278 - __chk_user_ptr(__cu_from); \ 279 - if (__access_ok(__cu_from, __cu_len, get_fs())) { \ 280 - check_object_size(__cu_to, __cu_len, false); \ 281 - __cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len); \ 282 - } \ 283 - __cu_len; \ 284 - }) 272 + static inline unsigned long 273 + copy_from_user(void *to, const void __user *from, unsigned long n) 274 + { 275 + check_object_size(to, n, false); 276 + if (likely(__access_ok(from, n, get_fs()))) 277 + n = __copy_user((__force void __user *) to, from, n); 278 + else 279 + memset(to, 0, n); 280 + return n; 281 + } 285 282 286 283 #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) 287 284
+1 -1
arch/m32r/include/asm/uaccess.h
··· 219 219 #define __get_user_nocheck(x, ptr, size) \ 220 220 ({ \ 221 221 long __gu_err = 0; \ 222 - unsigned long __gu_val; \ 222 + unsigned long __gu_val = 0; \ 223 223 might_fault(); \ 224 224 __get_user_size(__gu_val, (ptr), (size), __gu_err); \ 225 225 (x) = (__force __typeof__(*(ptr)))__gu_val; \
+2 -1
arch/metag/include/asm/uaccess.h
··· 204 204 static inline unsigned long 205 205 copy_from_user(void *to, const void __user *from, unsigned long n) 206 206 { 207 - if (access_ok(VERIFY_READ, from, n)) 207 + if (likely(access_ok(VERIFY_READ, from, n))) 208 208 return __copy_user_zeroing(to, from, n); 209 + memset(to, 0, n); 209 210 return n; 210 211 } 211 212
+7 -4
arch/microblaze/include/asm/uaccess.h
··· 227 227 228 228 #define __get_user(x, ptr) \ 229 229 ({ \ 230 - unsigned long __gu_val; \ 230 + unsigned long __gu_val = 0; \ 231 231 /*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \ 232 232 long __gu_err; \ 233 233 switch (sizeof(*(ptr))) { \ ··· 373 373 static inline long copy_from_user(void *to, 374 374 const void __user *from, unsigned long n) 375 375 { 376 + unsigned long res = n; 376 377 might_fault(); 377 - if (access_ok(VERIFY_READ, from, n)) 378 - return __copy_from_user(to, from, n); 379 - return n; 378 + if (likely(access_ok(VERIFY_READ, from, n))) 379 + res = __copy_from_user(to, from, n); 380 + if (unlikely(res)) 381 + memset(to + (n - res), 0, res); 382 + return res; 380 383 } 381 384 382 385 #define __copy_to_user(to, from, n) \
+3
arch/mips/include/asm/uaccess.h
··· 14 14 #include <linux/kernel.h> 15 15 #include <linux/errno.h> 16 16 #include <linux/thread_info.h> 17 + #include <linux/string.h> 17 18 #include <asm/asm-eva.h> 18 19 19 20 /* ··· 1171 1170 __cu_len = __invoke_copy_from_user(__cu_to, \ 1172 1171 __cu_from, \ 1173 1172 __cu_len); \ 1173 + } else { \ 1174 + memset(__cu_to, 0, __cu_len); \ 1174 1175 } \ 1175 1176 } \ 1176 1177 __cu_len; \
+1
arch/mn10300/include/asm/uaccess.h
··· 166 166 "2:\n" \ 167 167 " .section .fixup,\"ax\"\n" \ 168 168 "3:\n\t" \ 169 + " mov 0,%1\n" \ 169 170 " mov %3,%0\n" \ 170 171 " jmp 2b\n" \ 171 172 " .previous\n" \
+3 -1
arch/mn10300/lib/usercopy.c
··· 9 9 * as published by the Free Software Foundation; either version 10 10 * 2 of the Licence, or (at your option) any later version. 11 11 */ 12 - #include <asm/uaccess.h> 12 + #include <linux/uaccess.h> 13 13 14 14 unsigned long 15 15 __generic_copy_to_user(void *to, const void *from, unsigned long n) ··· 24 24 { 25 25 if (access_ok(VERIFY_READ, from, n)) 26 26 __copy_user_zeroing(to, from, n); 27 + else 28 + memset(to, 0, n); 27 29 return n; 28 30 } 29 31
+8 -5
arch/nios2/include/asm/uaccess.h
··· 102 102 static inline long copy_from_user(void *to, const void __user *from, 103 103 unsigned long n) 104 104 { 105 - if (!access_ok(VERIFY_READ, from, n)) 106 - return n; 107 - return __copy_from_user(to, from, n); 105 + unsigned long res = n; 106 + if (access_ok(VERIFY_READ, from, n)) 107 + res = __copy_from_user(to, from, n); 108 + if (unlikely(res)) 109 + memset(to + (n - res), 0, res); 110 + return res; 108 111 } 109 112 110 113 static inline long copy_to_user(void __user *to, const void *from, ··· 142 139 143 140 #define __get_user_unknown(val, size, ptr, err) do { \ 144 141 err = 0; \ 145 - if (copy_from_user(&(val), ptr, size)) { \ 142 + if (__copy_from_user(&(val), ptr, size)) { \ 146 143 err = -EFAULT; \ 147 144 } \ 148 145 } while (0) ··· 169 166 ({ \ 170 167 long __gu_err = -EFAULT; \ 171 168 const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ 172 - unsigned long __gu_val; \ 169 + unsigned long __gu_val = 0; \ 173 170 __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ 174 171 (x) = (__force __typeof__(x))__gu_val; \ 175 172 __gu_err; \
+10 -23
arch/openrisc/include/asm/uaccess.h
··· 273 273 static inline unsigned long 274 274 copy_from_user(void *to, const void *from, unsigned long n) 275 275 { 276 - unsigned long over; 276 + unsigned long res = n; 277 277 278 - if (access_ok(VERIFY_READ, from, n)) 279 - return __copy_tofrom_user(to, from, n); 280 - if ((unsigned long)from < TASK_SIZE) { 281 - over = (unsigned long)from + n - TASK_SIZE; 282 - return __copy_tofrom_user(to, from, n - over) + over; 283 - } 284 - return n; 278 + if (likely(access_ok(VERIFY_READ, from, n))) 279 + res = __copy_tofrom_user(to, from, n); 280 + if (unlikely(res)) 281 + memset(to + (n - res), 0, res); 282 + return res; 285 283 } 286 284 287 285 static inline unsigned long 288 286 copy_to_user(void *to, const void *from, unsigned long n) 289 287 { 290 - unsigned long over; 291 - 292 - if (access_ok(VERIFY_WRITE, to, n)) 293 - return __copy_tofrom_user(to, from, n); 294 - if ((unsigned long)to < TASK_SIZE) { 295 - over = (unsigned long)to + n - TASK_SIZE; 296 - return __copy_tofrom_user(to, from, n - over) + over; 297 - } 288 + if (likely(access_ok(VERIFY_WRITE, to, n))) 289 + n = __copy_tofrom_user(to, from, n); 298 290 return n; 299 291 } 300 292 ··· 295 303 static inline __must_check unsigned long 296 304 clear_user(void *addr, unsigned long size) 297 305 { 298 - 299 - if (access_ok(VERIFY_WRITE, addr, size)) 300 - return __clear_user(addr, size); 301 - if ((unsigned long)addr < TASK_SIZE) { 302 - unsigned long over = (unsigned long)addr + size - TASK_SIZE; 303 - return __clear_user(addr, size - over) + over; 304 - } 306 + if (likely(access_ok(VERIFY_WRITE, addr, size))) 307 + size = __clear_user(addr, size); 305 308 return size; 306 309 } 307 310
+4 -1
arch/parisc/include/asm/uaccess.h
··· 10 10 #include <asm-generic/uaccess-unaligned.h> 11 11 12 12 #include <linux/bug.h> 13 + #include <linux/string.h> 13 14 14 15 #define VERIFY_READ 0 15 16 #define VERIFY_WRITE 1 ··· 222 221 unsigned long n) 223 222 { 224 223 int sz = __compiletime_object_size(to); 225 - int ret = -EFAULT; 224 + unsigned long ret = n; 226 225 227 226 if (likely(sz == -1 || sz >= n)) 228 227 ret = __copy_from_user(to, from, n); ··· 231 230 else 232 231 __bad_copy_user(); 233 232 233 + if (unlikely(ret)) 234 + memset(to + (n - ret), 0, ret); 234 235 return ret; 235 236 } 236 237
+1 -1
arch/powerpc/include/asm/cpu_has_feature.h
··· 15 15 #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS 16 16 #include <linux/jump_label.h> 17 17 18 - #define NUM_CPU_FTR_KEYS 64 18 + #define NUM_CPU_FTR_KEYS BITS_PER_LONG 19 19 20 20 extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS]; 21 21
+2 -21
arch/powerpc/include/asm/uaccess.h
··· 308 308 static inline unsigned long copy_from_user(void *to, 309 309 const void __user *from, unsigned long n) 310 310 { 311 - unsigned long over; 312 - 313 - if (access_ok(VERIFY_READ, from, n)) { 311 + if (likely(access_ok(VERIFY_READ, from, n))) { 314 312 check_object_size(to, n, false); 315 313 return __copy_tofrom_user((__force void __user *)to, from, n); 316 314 } 317 - if ((unsigned long)from < TASK_SIZE) { 318 - over = (unsigned long)from + n - TASK_SIZE; 319 - check_object_size(to, n - over, false); 320 - return __copy_tofrom_user((__force void __user *)to, from, 321 - n - over) + over; 322 - } 315 + memset(to, 0, n); 323 316 return n; 324 317 } 325 318 326 319 static inline unsigned long copy_to_user(void __user *to, 327 320 const void *from, unsigned long n) 328 321 { 329 - unsigned long over; 330 - 331 322 if (access_ok(VERIFY_WRITE, to, n)) { 332 323 check_object_size(from, n, true); 333 324 return __copy_tofrom_user(to, (__force void __user *)from, n); 334 - } 335 - if ((unsigned long)to < TASK_SIZE) { 336 - over = (unsigned long)to + n - TASK_SIZE; 337 - check_object_size(from, n - over, true); 338 - return __copy_tofrom_user(to, (__force void __user *)from, 339 - n - over) + over; 340 325 } 341 326 return n; 342 327 } ··· 419 434 might_fault(); 420 435 if (likely(access_ok(VERIFY_WRITE, addr, size))) 421 436 return __clear_user(addr, size); 422 - if ((unsigned long)addr < TASK_SIZE) { 423 - unsigned long over = (unsigned long)addr + size - TASK_SIZE; 424 - return __clear_user(addr, size - over) + over; 425 - } 426 437 return size; 427 438 } 428 439
+5 -5
arch/powerpc/kernel/idle_book3s.S
··· 411 411 * 412 412 * r13 - PACA 413 413 * cr3 - gt if waking up with partial/complete hypervisor state loss 414 - * cr4 - eq if waking up from complete hypervisor state loss. 414 + * cr4 - gt or eq if waking up from complete hypervisor state loss. 415 415 */ 416 416 _GLOBAL(pnv_wakeup_tb_loss) 417 417 ld r1,PACAR1(r13) ··· 453 453 * At this stage 454 454 * cr2 - eq if first thread to wakeup in core 455 455 * cr3- gt if waking up with partial/complete hypervisor state loss 456 - * cr4 - eq if waking up from complete hypervisor state loss. 456 + * cr4 - gt or eq if waking up from complete hypervisor state loss. 457 457 */ 458 458 459 459 ori r15,r15,PNV_CORE_IDLE_LOCK_BIT ··· 481 481 * If waking up from sleep, subcore state is not lost. Hence 482 482 * skip subcore state restore 483 483 */ 484 - bne cr4,subcore_state_restored 484 + blt cr4,subcore_state_restored 485 485 486 486 /* Restore per-subcore state */ 487 487 ld r4,_SDR1(r1) ··· 526 526 * If waking up from sleep, per core state is not lost, skip to 527 527 * clear_lock. 528 528 */ 529 - bne cr4,clear_lock 529 + blt cr4,clear_lock 530 530 531 531 /* 532 532 * First thread in the core to wake up and its waking up with ··· 557 557 * If waking up from sleep, hypervisor state is not lost. Hence 558 558 * skip hypervisor state restore. 559 559 */ 560 - bne cr4,hypervisor_state_restored 560 + blt cr4,hypervisor_state_restored 561 561 562 562 /* Waking up from winkle */ 563 563
+23 -3
arch/powerpc/platforms/powernv/pci-ioda.c
··· 2217 2217 2218 2218 pnv_pci_link_table_and_group(phb->hose->node, num, 2219 2219 tbl, &pe->table_group); 2220 - pnv_pci_phb3_tce_invalidate_pe(pe); 2220 + pnv_pci_ioda2_tce_invalidate_pe(pe); 2221 2221 2222 2222 return 0; 2223 2223 } ··· 2355 2355 if (ret) 2356 2356 pe_warn(pe, "Unmapping failed, ret = %ld\n", ret); 2357 2357 else 2358 - pnv_pci_phb3_tce_invalidate_pe(pe); 2358 + pnv_pci_ioda2_tce_invalidate_pe(pe); 2359 2359 2360 2360 pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); 2361 2361 ··· 3426 3426 } 3427 3427 } 3428 3428 3429 - pnv_ioda_free_pe(pe); 3429 + /* 3430 + * The PE for root bus can be removed because of hotplug in EEH 3431 + * recovery for fenced PHB error. We need to mark the PE dead so 3432 + * that it can be populated again in PCI hot add path. The PE 3433 + * shouldn't be destroyed as it's the global reserved resource. 3434 + */ 3435 + if (phb->ioda.root_pe_populated && 3436 + phb->ioda.root_pe_idx == pe->pe_number) 3437 + phb->ioda.root_pe_populated = false; 3438 + else 3439 + pnv_ioda_free_pe(pe); 3430 3440 } 3431 3441 3432 3442 static void pnv_pci_release_device(struct pci_dev *pdev) ··· 3452 3442 if (!pdn || pdn->pe_number == IODA_INVALID_PE) 3453 3443 return; 3454 3444 3445 + /* 3446 + * PCI hotplug can happen as part of EEH error recovery. The @pdn 3447 + * isn't removed and added afterwards in this scenario. We should 3448 + * set the PE number in @pdn to an invalid one. Otherwise, the PE's 3449 + * device count is decreased on removing devices while failing to 3450 + * be increased on adding devices. It leads to unbalanced PE's device 3451 + * count and eventually make normal PCI hotplug path broken. 3452 + */ 3455 3453 pe = &phb->ioda.pe_array[pdn->pe_number]; 3454 + pdn->pe_number = IODA_INVALID_PE; 3455 + 3456 3456 WARN_ON(--pe->device_count < 0); 3457 3457 if (pe->device_count == 0) 3458 3458 pnv_ioda_release_pe(pe);
+4 -4
arch/s390/include/asm/uaccess.h
··· 266 266 __chk_user_ptr(ptr); \ 267 267 switch (sizeof(*(ptr))) { \ 268 268 case 1: { \ 269 - unsigned char __x; \ 269 + unsigned char __x = 0; \ 270 270 __gu_err = __get_user_fn(&__x, ptr, \ 271 271 sizeof(*(ptr))); \ 272 272 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 273 273 break; \ 274 274 }; \ 275 275 case 2: { \ 276 - unsigned short __x; \ 276 + unsigned short __x = 0; \ 277 277 __gu_err = __get_user_fn(&__x, ptr, \ 278 278 sizeof(*(ptr))); \ 279 279 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 280 280 break; \ 281 281 }; \ 282 282 case 4: { \ 283 - unsigned int __x; \ 283 + unsigned int __x = 0; \ 284 284 __gu_err = __get_user_fn(&__x, ptr, \ 285 285 sizeof(*(ptr))); \ 286 286 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 287 287 break; \ 288 288 }; \ 289 289 case 8: { \ 290 - unsigned long long __x; \ 290 + unsigned long long __x = 0; \ 291 291 __gu_err = __get_user_fn(&__x, ptr, \ 292 292 sizeof(*(ptr))); \ 293 293 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
+6 -4
arch/s390/kvm/kvm-s390.c
··· 2231 2231 return -EINVAL; 2232 2232 current->thread.fpu.fpc = fpu->fpc; 2233 2233 if (MACHINE_HAS_VX) 2234 - convert_fp_to_vx(current->thread.fpu.vxrs, (freg_t *)fpu->fprs); 2234 + convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs, 2235 + (freg_t *) fpu->fprs); 2235 2236 else 2236 - memcpy(current->thread.fpu.fprs, &fpu->fprs, sizeof(fpu->fprs)); 2237 + memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs)); 2237 2238 return 0; 2238 2239 } 2239 2240 ··· 2243 2242 /* make sure we have the latest values */ 2244 2243 save_fpu_regs(); 2245 2244 if (MACHINE_HAS_VX) 2246 - convert_vx_to_fp((freg_t *)fpu->fprs, current->thread.fpu.vxrs); 2245 + convert_vx_to_fp((freg_t *) fpu->fprs, 2246 + (__vector128 *) vcpu->run->s.regs.vrs); 2247 2247 else 2248 - memcpy(fpu->fprs, current->thread.fpu.fprs, sizeof(fpu->fprs)); 2248 + memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs)); 2249 2249 fpu->fpc = current->thread.fpu.fpc; 2250 2250 return 0; 2251 2251 }
+1 -1
arch/s390/kvm/vsie.c
··· 584 584 /* Validity 0x0044 will be checked by SIE */ 585 585 if (rc) 586 586 goto unpin; 587 - scb_s->gvrd = hpa; 587 + scb_s->riccbd = hpa; 588 588 } 589 589 return 0; 590 590 unpin:
+24 -22
arch/score/include/asm/uaccess.h
··· 163 163 __get_user_asm(val, "lw", ptr); \ 164 164 break; \ 165 165 case 8: \ 166 - if ((copy_from_user((void *)&val, ptr, 8)) == 0) \ 166 + if (__copy_from_user((void *)&val, ptr, 8) == 0) \ 167 167 __gu_err = 0; \ 168 168 else \ 169 169 __gu_err = -EFAULT; \ ··· 188 188 \ 189 189 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ 190 190 __get_user_common((x), size, __gu_ptr); \ 191 + else \ 192 + (x) = 0; \ 191 193 \ 192 194 __gu_err; \ 193 195 }) ··· 203 201 "2:\n" \ 204 202 ".section .fixup,\"ax\"\n" \ 205 203 "3:li %0, %4\n" \ 204 + "li %1, 0\n" \ 206 205 "j 2b\n" \ 207 206 ".previous\n" \ 208 207 ".section __ex_table,\"a\"\n" \ ··· 301 298 static inline unsigned long 302 299 copy_from_user(void *to, const void *from, unsigned long len) 303 300 { 304 - unsigned long over; 301 + unsigned long res = len; 305 302 306 - if (access_ok(VERIFY_READ, from, len)) 307 - return __copy_tofrom_user(to, from, len); 303 + if (likely(access_ok(VERIFY_READ, from, len))) 304 + res = __copy_tofrom_user(to, from, len); 308 305 309 - if ((unsigned long)from < TASK_SIZE) { 310 - over = (unsigned long)from + len - TASK_SIZE; 311 - return __copy_tofrom_user(to, from, len - over) + over; 312 - } 313 - return len; 306 + if (unlikely(res)) 307 + memset(to + (len - res), 0, res); 308 + 309 + return res; 314 310 } 315 311 316 312 static inline unsigned long 317 313 copy_to_user(void *to, const void *from, unsigned long len) 318 314 { 319 - unsigned long over; 315 + if (likely(access_ok(VERIFY_WRITE, to, len))) 316 + len = __copy_tofrom_user(to, from, len); 320 317 321 - if (access_ok(VERIFY_WRITE, to, len)) 322 - return __copy_tofrom_user(to, from, len); 323 - 324 - if ((unsigned long)to < TASK_SIZE) { 325 - over = (unsigned long)to + len - TASK_SIZE; 326 - return __copy_tofrom_user(to, from, len - over) + over; 327 - } 328 318 return len; 329 319 } 330 320 331 - #define __copy_from_user(to, from, len) \ 332 - __copy_tofrom_user((to), (from), (len)) 321 + static inline unsigned long 322 + __copy_from_user(void *to, const void *from, unsigned long len) 323 + { 324 + unsigned long left = __copy_tofrom_user(to, from, len); 325 + if (unlikely(left)) 326 + memset(to + (len - left), 0, left); 327 + return left; 328 + } 333 329 334 330 #define __copy_to_user(to, from, len) \ 335 331 __copy_tofrom_user((to), (from), (len)) ··· 342 340 static inline unsigned long 343 341 __copy_from_user_inatomic(void *to, const void *from, unsigned long len) 344 342 { 345 - return __copy_from_user(to, from, len); 343 + return __copy_tofrom_user(to, from, len); 346 344 } 347 345 348 - #define __copy_in_user(to, from, len) __copy_from_user(to, from, len) 346 + #define __copy_in_user(to, from, len) __copy_tofrom_user(to, from, len) 349 347 350 348 static inline unsigned long 351 349 copy_in_user(void *to, const void *from, unsigned long len) 352 350 { 353 351 if (access_ok(VERIFY_READ, from, len) && 354 352 access_ok(VERFITY_WRITE, to, len)) 355 - return copy_from_user(to, from, len); 353 + return __copy_tofrom_user(to, from, len); 356 354 } 357 355 358 356 /*
+4 -1
arch/sh/include/asm/uaccess.h
··· 151 151 __kernel_size_t __copy_size = (__kernel_size_t) n; 152 152 153 153 if (__copy_size && __access_ok(__copy_from, __copy_size)) 154 - return __copy_user(to, from, __copy_size); 154 + __copy_size = __copy_user(to, from, __copy_size); 155 + 156 + if (unlikely(__copy_size)) 157 + memset(to + (n - __copy_size), 0, __copy_size); 155 158 156 159 return __copy_size; 157 160 }
+1
arch/sh/include/asm/uaccess_64.h
··· 24 24 #define __get_user_size(x,ptr,size,retval) \ 25 25 do { \ 26 26 retval = 0; \ 27 + x = 0; \ 27 28 switch (size) { \ 28 29 case 1: \ 29 30 retval = __get_user_asm_b((void *)&x, \
+3 -1
arch/sparc/include/asm/uaccess_32.h
··· 266 266 if (n && __access_ok((unsigned long) from, n)) { 267 267 check_object_size(to, n, false); 268 268 return __copy_user((__force void __user *) to, from, n); 269 - } else 269 + } else { 270 + memset(to, 0, n); 270 271 return n; 272 + } 271 273 } 272 274 273 275 static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
+68 -64
arch/x86/boot/compressed/eboot.c
··· 1004 1004 return status; 1005 1005 } 1006 1006 1007 + struct exit_boot_struct { 1008 + struct boot_params *boot_params; 1009 + struct efi_info *efi; 1010 + struct setup_data *e820ext; 1011 + __u32 e820ext_size; 1012 + bool is64; 1013 + }; 1014 + 1015 + static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, 1016 + struct efi_boot_memmap *map, 1017 + void *priv) 1018 + { 1019 + static bool first = true; 1020 + const char *signature; 1021 + __u32 nr_desc; 1022 + efi_status_t status; 1023 + struct exit_boot_struct *p = priv; 1024 + 1025 + if (first) { 1026 + nr_desc = *map->buff_size / *map->desc_size; 1027 + if (nr_desc > ARRAY_SIZE(p->boot_params->e820_map)) { 1028 + u32 nr_e820ext = nr_desc - 1029 + ARRAY_SIZE(p->boot_params->e820_map); 1030 + 1031 + status = alloc_e820ext(nr_e820ext, &p->e820ext, 1032 + &p->e820ext_size); 1033 + if (status != EFI_SUCCESS) 1034 + return status; 1035 + } 1036 + first = false; 1037 + } 1038 + 1039 + signature = p->is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE; 1040 + memcpy(&p->efi->efi_loader_signature, signature, sizeof(__u32)); 1041 + 1042 + p->efi->efi_systab = (unsigned long)sys_table_arg; 1043 + p->efi->efi_memdesc_size = *map->desc_size; 1044 + p->efi->efi_memdesc_version = *map->desc_ver; 1045 + p->efi->efi_memmap = (unsigned long)*map->map; 1046 + p->efi->efi_memmap_size = *map->map_size; 1047 + 1048 + #ifdef CONFIG_X86_64 1049 + p->efi->efi_systab_hi = (unsigned long)sys_table_arg >> 32; 1050 + p->efi->efi_memmap_hi = (unsigned long)*map->map >> 32; 1051 + #endif 1052 + 1053 + return EFI_SUCCESS; 1054 + } 1055 + 1007 1056 static efi_status_t exit_boot(struct boot_params *boot_params, 1008 1057 void *handle, bool is64) 1009 1058 { 1010 - struct efi_info *efi = &boot_params->efi_info; 1011 - unsigned long map_sz, key, desc_size; 1059 + unsigned long map_sz, key, desc_size, buff_size; 1012 1060 efi_memory_desc_t *mem_map; 1013 1061 struct setup_data *e820ext; 1014 - const char *signature; 1015 1062 __u32 e820ext_size; 1016 - __u32 nr_desc, prev_nr_desc; 1017 1063 efi_status_t status; 1018 1064 __u32 desc_version; 1019 - bool called_exit = false; 1020 - u8 nr_entries; 1021 - int i; 1065 + struct efi_boot_memmap map; 1066 + struct exit_boot_struct priv; 1022 1067 1023 - nr_desc = 0; 1024 - e820ext = NULL; 1025 - e820ext_size = 0; 1068 + map.map = &mem_map; 1069 + map.map_size = &map_sz; 1070 + map.desc_size = &desc_size; 1071 + map.desc_ver = &desc_version; 1072 + map.key_ptr = &key; 1073 + map.buff_size = &buff_size; 1074 + priv.boot_params = boot_params; 1075 + priv.efi = &boot_params->efi_info; 1076 + priv.e820ext = NULL; 1077 + priv.e820ext_size = 0; 1078 + priv.is64 = is64; 1026 1079 1027 - get_map: 1028 - status = efi_get_memory_map(sys_table, &mem_map, &map_sz, &desc_size, 1029 - &desc_version, &key); 1030 - 1080 + /* Might as well exit boot services now */ 1081 + status = efi_exit_boot_services(sys_table, handle, &map, &priv, 1082 + exit_boot_func); 1031 1083 if (status != EFI_SUCCESS) 1032 1084 return status; 1033 1085 1034 - prev_nr_desc = nr_desc; 1035 - nr_desc = map_sz / desc_size; 1036 - if (nr_desc > prev_nr_desc && 1037 - nr_desc > ARRAY_SIZE(boot_params->e820_map)) { 1038 - u32 nr_e820ext = nr_desc - ARRAY_SIZE(boot_params->e820_map); 1039 - 1040 - status = alloc_e820ext(nr_e820ext, &e820ext, &e820ext_size); 1041 - if (status != EFI_SUCCESS) 1042 - goto free_mem_map; 1043 - 1044 - efi_call_early(free_pool, mem_map); 1045 - goto get_map; /* Allocated memory, get map again */ 1046 - } 1047 - 1048 - signature = is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE; 1049 - memcpy(&efi->efi_loader_signature, signature, sizeof(__u32)); 1050 - 1051 - efi->efi_systab = (unsigned long)sys_table; 1052 - efi->efi_memdesc_size = desc_size; 1053 - efi->efi_memdesc_version = desc_version; 1054 - efi->efi_memmap = (unsigned long)mem_map; 1055 - efi->efi_memmap_size = map_sz; 1056 - 1057 - #ifdef CONFIG_X86_64 1058 - efi->efi_systab_hi = (unsigned long)sys_table >> 32; 1059 - efi->efi_memmap_hi = (unsigned long)mem_map >> 32; 1060 - #endif 1061 - 1062 - /* Might as well exit boot services now */ 1063 - status = efi_call_early(exit_boot_services, handle, key); 1064 - if (status != EFI_SUCCESS) { 1065 - /* 1066 - * ExitBootServices() will fail if any of the event 1067 - * handlers change the memory map. In which case, we 1068 - * must be prepared to retry, but only once so that 1069 - * we're guaranteed to exit on repeated failures instead 1070 - * of spinning forever. 1071 - */ 1072 - if (called_exit) 1073 - goto free_mem_map; 1074 - 1075 - called_exit = true; 1076 - efi_call_early(free_pool, mem_map); 1077 - goto get_map; 1078 - } 1079 - 1086 + e820ext = priv.e820ext; 1087 + e820ext_size = priv.e820ext_size; 1080 1088 /* Historic? */ 1081 1089 boot_params->alt_mem_k = 32 * 1024; 1082 1090 ··· 1093 1085 return status; 1094 1086 1095 1087 return EFI_SUCCESS; 1096 - 1097 - free_mem_map: 1098 - efi_call_early(free_pool, mem_map); 1099 - return status; 1100 1088 } 1101 1089 1102 1090 /*
+2 -2
arch/x86/events/amd/core.c
··· 119 119 { 120 120 [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, 121 121 [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, 122 - [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, 123 - [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, 122 + [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, 123 + [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, 124 124 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, 125 125 [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, 126 126 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */
+18 -4
arch/x86/events/amd/uncore.c
··· 29 29 30 30 #define COUNTER_SHIFT 16 31 31 32 + static HLIST_HEAD(uncore_unused_list); 33 + 32 34 struct amd_uncore { 33 35 int id; 34 36 int refcnt; ··· 41 39 cpumask_t *active_mask; 42 40 struct pmu *pmu; 43 41 struct perf_event *events[MAX_COUNTERS]; 44 - struct amd_uncore *free_when_cpu_online; 42 + struct hlist_node node; 45 43 }; 46 44 47 45 static struct amd_uncore * __percpu *amd_uncore_nb; ··· 308 306 uncore_nb->msr_base = MSR_F15H_NB_PERF_CTL; 309 307 uncore_nb->active_mask = &amd_nb_active_mask; 310 308 uncore_nb->pmu = &amd_nb_pmu; 309 + uncore_nb->id = -1; 311 310 *per_cpu_ptr(amd_uncore_nb, cpu) = uncore_nb; 312 311 } 313 312 ··· 322 319 uncore_l2->msr_base = MSR_F16H_L2I_PERF_CTL; 323 320 uncore_l2->active_mask = &amd_l2_active_mask; 324 321 uncore_l2->pmu = &amd_l2_pmu; 322 + uncore_l2->id = -1; 325 323 *per_cpu_ptr(amd_uncore_l2, cpu) = uncore_l2; 326 324 } 327 325 ··· 352 348 continue; 353 349 354 350 if (this->id == that->id) { 355 - that->free_when_cpu_online = this; 351 + hlist_add_head(&this->node, &uncore_unused_list); 356 352 this = that; 357 353 break; 358 354 } ··· 392 388 return 0; 393 389 } 394 390 391 + static void uncore_clean_online(void) 392 + { 393 + struct amd_uncore *uncore; 394 + struct hlist_node *n; 395 + 396 + hlist_for_each_entry_safe(uncore, n, &uncore_unused_list, node) { 397 + hlist_del(&uncore->node); 398 + kfree(uncore); 399 + } 400 + } 401 + 395 402 static void uncore_online(unsigned int cpu, 396 403 struct amd_uncore * __percpu *uncores) 397 404 { 398 405 struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); 399 406 400 - kfree(uncore->free_when_cpu_online); 401 - uncore->free_when_cpu_online = NULL; 407 + uncore_clean_online(); 402 408 403 409 if (cpu == uncore->cpu) 404 410 cpumask_set_cpu(cpu, uncore->active_mask);
+94 -29
arch/x86/events/intel/bts.c
··· 31 31 struct bts_ctx { 32 32 struct perf_output_handle handle; 33 33 struct debug_store ds_back; 34 - int started; 34 + int state; 35 + }; 36 + 37 + /* BTS context states: */ 38 + enum { 39 + /* no ongoing AUX transactions */ 40 + BTS_STATE_STOPPED = 0, 41 + /* AUX transaction is on, BTS tracing is disabled */ 42 + BTS_STATE_INACTIVE, 43 + /* AUX transaction is on, BTS tracing is running */ 44 + BTS_STATE_ACTIVE, 35 45 }; 36 46 37 47 static DEFINE_PER_CPU(struct bts_ctx, bts_ctx); ··· 214 204 static int 215 205 bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle); 216 206 207 + /* 208 + * Ordering PMU callbacks wrt themselves and the PMI is done by means 209 + * of bts::state, which: 210 + * - is set when bts::handle::event is valid, that is, between 211 + * perf_aux_output_begin() and perf_aux_output_end(); 212 + * - is zero otherwise; 213 + * - is ordered against bts::handle::event with a compiler barrier. 214 + */ 215 + 217 216 static void __bts_event_start(struct perf_event *event) 218 217 { 219 218 struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); ··· 240 221 241 222 /* 242 223 * local barrier to make sure that ds configuration made it 243 - * before we enable BTS 224 + * before we enable BTS and bts::state goes ACTIVE 244 225 */ 245 226 wmb(); 227 + 228 + /* INACTIVE/STOPPED -> ACTIVE */ 229 + WRITE_ONCE(bts->state, BTS_STATE_ACTIVE); 246 230 247 231 intel_pmu_enable_bts(config); 248 232 ··· 273 251 274 252 __bts_event_start(event); 275 253 276 - /* PMI handler: this counter is running and likely generating PMIs */ 277 - ACCESS_ONCE(bts->started) = 1; 278 - 279 254 return; 280 255 281 256 fail_end_stop: ··· 282 263 event->hw.state = PERF_HES_STOPPED; 283 264 } 284 265 285 - static void __bts_event_stop(struct perf_event *event) 266 + static void __bts_event_stop(struct perf_event *event, int state) 286 267 { 268 + struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); 269 + 270 + /* ACTIVE -> INACTIVE(PMI)/STOPPED(->stop()) */ 271 + WRITE_ONCE(bts->state, state); 272 + 287 273 /* 288 274 * No extra synchronization is mandated by the documentation to have 289 275 * BTS data stores globally visible. 290 276 */ 291 277 intel_pmu_disable_bts(); 292 - 293 - if (event->hw.state & PERF_HES_STOPPED) 294 - return; 295 - 296 - ACCESS_ONCE(event->hw.state) |= PERF_HES_STOPPED; 297 278 } 298 279 299 280 static void bts_event_stop(struct perf_event *event, int flags) 300 281 { 301 282 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); 302 283 struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); 303 - struct bts_buffer *buf = perf_get_aux(&bts->handle); 284 + struct bts_buffer *buf = NULL; 285 + int state = READ_ONCE(bts->state); 304 286 305 - /* PMI handler: don't restart this counter */ 306 - ACCESS_ONCE(bts->started) = 0; 287 + if (state == BTS_STATE_ACTIVE) 288 + __bts_event_stop(event, BTS_STATE_STOPPED); 307 289 308 - __bts_event_stop(event); 290 + if (state != BTS_STATE_STOPPED) 291 + buf = perf_get_aux(&bts->handle); 292 + 293 + event->hw.state |= PERF_HES_STOPPED; 309 294 310 295 if (flags & PERF_EF_UPDATE) { 311 296 bts_update(bts); ··· 319 296 bts->handle.head = 320 297 local_xchg(&buf->data_size, 321 298 buf->nr_pages << PAGE_SHIFT); 299 + 322 300 perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), 323 301 !!local_xchg(&buf->lost, 0)); 324 302 } ··· 334 310 void intel_bts_enable_local(void) 335 311 { 336 312 struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); 313 + int state = READ_ONCE(bts->state); 337 314 338 - if (bts->handle.event && bts->started) 315 + /* 316 + * Here we transition from INACTIVE to ACTIVE; 317 + * if we instead are STOPPED from the interrupt handler, 318 + * stay that way. Can't be ACTIVE here though. 319 + */ 320 + if (WARN_ON_ONCE(state == BTS_STATE_ACTIVE)) 321 + return; 322 + 323 + if (state == BTS_STATE_STOPPED) 324 + return; 325 + 326 + if (bts->handle.event) 339 327 __bts_event_start(bts->handle.event); 340 328 } 341 329 ··· 355 319 { 356 320 struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); 357 321 322 + /* 323 + * Here we transition from ACTIVE to INACTIVE; 324 + * do nothing for STOPPED or INACTIVE. 325 + */ 326 + if (READ_ONCE(bts->state) != BTS_STATE_ACTIVE) 327 + return; 328 + 358 329 if (bts->handle.event) 359 - __bts_event_stop(bts->handle.event); 330 + __bts_event_stop(bts->handle.event, BTS_STATE_INACTIVE); 360 331 } 361 332 362 333 static int ··· 378 335 return 0; 379 336 380 337 head = handle->head & ((buf->nr_pages << PAGE_SHIFT) - 1); 381 - if (WARN_ON_ONCE(head != local_read(&buf->head))) 382 - return -EINVAL; 383 338 384 339 phys = &buf->buf[buf->cur_buf]; 385 340 space = phys->offset + phys->displacement + phys->size - head; ··· 444 403 445 404 int intel_bts_interrupt(void) 446 405 { 406 + struct debug_store *ds = this_cpu_ptr(&cpu_hw_events)->ds; 447 407 struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); 448 408 struct perf_event *event = bts->handle.event; 449 409 struct bts_buffer *buf; 450 410 s64 old_head; 451 - int err; 411 + int err = -ENOSPC, handled = 0; 452 412 453 - if (!event || !bts->started) 454 - return 0; 413 + /* 414 + * The only surefire way of knowing if this NMI is ours is by checking 415 + * the write ptr against the PMI threshold. 416 + */ 417 + if (ds->bts_index >= ds->bts_interrupt_threshold) 418 + handled = 1; 419 + 420 + /* 421 + * this is wrapped in intel_bts_enable_local/intel_bts_disable_local, 422 + * so we can only be INACTIVE or STOPPED 423 + */ 424 + if (READ_ONCE(bts->state) == BTS_STATE_STOPPED) 425 + return handled; 455 426 456 427 buf = perf_get_aux(&bts->handle); 428 + if (!buf) 429 + return handled; 430 + 457 431 /* 458 432 * Skip snapshot counters: they don't use the interrupt, but 459 433 * there's no other way of telling, because the pointer will 460 434 * keep moving 461 435 */ 462 - if (!buf || buf->snapshot) 436 + if (buf->snapshot) 463 437 return 0; 464 438 465 439 old_head = local_read(&buf->head); ··· 482 426 483 427 /* no new data */ 484 428 if (old_head == local_read(&buf->head)) 485 - return 0; 429 + return handled; 486 430 487 431 perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), 488 432 !!local_xchg(&buf->lost, 0)); 489 433 490 434 buf = perf_aux_output_begin(&bts->handle, event); 491 - if (!buf) 492 - return 1; 435 + if (buf) 436 + err = bts_buffer_reset(buf, &bts->handle); 493 437 494 - err = bts_buffer_reset(buf, &bts->handle); 495 - if (err) 496 - perf_aux_output_end(&bts->handle, 0, false); 438 + if (err) { 439 + WRITE_ONCE(bts->state, BTS_STATE_STOPPED); 440 + 441 + if (buf) { 442 + /* 443 + * BTS_STATE_STOPPED should be visible before 444 + * cleared handle::event 445 + */ 446 + barrier(); 447 + perf_aux_output_end(&bts->handle, 0, false); 448 + } 449 + } 497 450 498 451 return 1; 499 452 }
+8 -7
arch/x86/events/intel/core.c
··· 1730 1730 * disabled state if called consecutively. 1731 1731 * 1732 1732 * During consecutive calls, the same disable value will be written to related 1733 - * registers, so the PMU state remains unchanged. hw.state in 1734 - * intel_bts_disable_local will remain PERF_HES_STOPPED too in consecutive 1735 - * calls. 1733 + * registers, so the PMU state remains unchanged. 1734 + * 1735 + * intel_bts events don't coexist with intel PMU's BTS events because of 1736 + * x86_add_exclusive(x86_lbr_exclusive_lbr); there's no need to keep them 1737 + * disabled around intel PMU's event batching etc, only inside the PMI handler. 1736 1738 */ 1737 1739 static void __intel_pmu_disable_all(void) 1738 1740 { ··· 1744 1742 1745 1743 if (test_bit(INTEL_PMC_IDX_FIXED_BTS, cpuc->active_mask)) 1746 1744 intel_pmu_disable_bts(); 1747 - else 1748 - intel_bts_disable_local(); 1749 1745 1750 1746 intel_pmu_pebs_disable_all(); 1751 1747 } ··· 1771 1771 return; 1772 1772 1773 1773 intel_pmu_enable_bts(event->hw.config); 1774 - } else 1775 - intel_bts_enable_local(); 1774 + } 1776 1775 } 1777 1776 1778 1777 static void intel_pmu_enable_all(int added) ··· 2072 2073 */ 2073 2074 if (!x86_pmu.late_ack) 2074 2075 apic_write(APIC_LVTPC, APIC_DM_NMI); 2076 + intel_bts_disable_local(); 2075 2077 __intel_pmu_disable_all(); 2076 2078 handled = intel_pmu_drain_bts_buffer(); 2077 2079 handled += intel_bts_interrupt(); ··· 2172 2172 /* Only restore PMU state when it's active. See x86_pmu_disable(). */ 2173 2173 if (cpuc->enabled) 2174 2174 __intel_pmu_enable_all(0, true); 2175 + intel_bts_enable_local(); 2175 2176 2176 2177 /* 2177 2178 * Only unmask the NMI after the overflow counters
+9
arch/x86/events/intel/cqm.c
··· 458 458 static void init_mbm_sample(u32 rmid, u32 evt_type); 459 459 static void __intel_mbm_event_count(void *info); 460 460 461 + static bool is_cqm_event(int e) 462 + { 463 + return (e == QOS_L3_OCCUP_EVENT_ID); 464 + } 465 + 461 466 static bool is_mbm_event(int e) 462 467 { 463 468 return (e >= QOS_MBM_TOTAL_EVENT_ID && e <= QOS_MBM_LOCAL_EVENT_ID); ··· 1369 1364 1370 1365 if ((event->attr.config < QOS_L3_OCCUP_EVENT_ID) || 1371 1366 (event->attr.config > QOS_MBM_LOCAL_EVENT_ID)) 1367 + return -EINVAL; 1368 + 1369 + if ((is_cqm_event(event->attr.config) && !cqm_enabled) || 1370 + (is_mbm_event(event->attr.config) && !mbm_enabled)) 1372 1371 return -EINVAL; 1373 1372 1374 1373 /* unsupported modes and filters */
+11 -8
arch/x86/events/intel/ds.c
··· 1274 1274 struct pebs_record_nhm *p = at; 1275 1275 u64 pebs_status; 1276 1276 1277 - /* PEBS v3 has accurate status bits */ 1277 + pebs_status = p->status & cpuc->pebs_enabled; 1278 + pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; 1279 + 1280 + /* PEBS v3 has more accurate status bits */ 1278 1281 if (x86_pmu.intel_cap.pebs_format >= 3) { 1279 - for_each_set_bit(bit, (unsigned long *)&p->status, 1280 - MAX_PEBS_EVENTS) 1282 + for_each_set_bit(bit, (unsigned long *)&pebs_status, 1283 + x86_pmu.max_pebs_events) 1281 1284 counts[bit]++; 1282 1285 1283 1286 continue; 1284 1287 } 1285 - 1286 - pebs_status = p->status & cpuc->pebs_enabled; 1287 - pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; 1288 1288 1289 1289 /* 1290 1290 * On some CPUs the PEBS status can be zero when PEBS is ··· 1333 1333 continue; 1334 1334 1335 1335 event = cpuc->events[bit]; 1336 - WARN_ON_ONCE(!event); 1337 - WARN_ON_ONCE(!event->attr.precise_ip); 1336 + if (WARN_ON_ONCE(!event)) 1337 + continue; 1338 + 1339 + if (WARN_ON_ONCE(!event->attr.precise_ip)) 1340 + continue; 1338 1341 1339 1342 /* log dropped samples number */ 1340 1343 if (error[bit])
+14 -4
arch/x86/events/intel/pt.c
··· 1074 1074 event->hw.addr_filters = NULL; 1075 1075 } 1076 1076 1077 + static inline bool valid_kernel_ip(unsigned long ip) 1078 + { 1079 + return virt_addr_valid(ip) && kernel_ip(ip); 1080 + } 1081 + 1077 1082 static int pt_event_addr_filters_validate(struct list_head *filters) 1078 1083 { 1079 1084 struct perf_addr_filter *filter; ··· 1086 1081 1087 1082 list_for_each_entry(filter, filters, entry) { 1088 1083 /* PT doesn't support single address triggers */ 1089 - if (!filter->range) 1084 + if (!filter->range || !filter->size) 1090 1085 return -EOPNOTSUPP; 1091 1086 1092 - if (!filter->inode && !kernel_ip(filter->offset)) 1093 - return -EINVAL; 1087 + if (!filter->inode) { 1088 + if (!valid_kernel_ip(filter->offset)) 1089 + return -EINVAL; 1090 + 1091 + if (!valid_kernel_ip(filter->offset + filter->size)) 1092 + return -EINVAL; 1093 + } 1094 1094 1095 1095 if (++range > pt_cap_get(PT_CAP_num_address_ranges)) 1096 1096 return -EOPNOTSUPP; ··· 1121 1111 } else { 1122 1112 /* apply the offset */ 1123 1113 msr_a = filter->offset + offs[range]; 1124 - msr_b = filter->size + msr_a; 1114 + msr_b = filter->size + msr_a - 1; 1125 1115 } 1126 1116 1127 1117 filters->filter[range].msr_a = msr_a;
+5 -1
arch/x86/include/asm/uaccess.h
··· 433 433 #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ 434 434 asm volatile("1: mov"itype" %1,%"rtype"0\n" \ 435 435 "2:\n" \ 436 - _ASM_EXTABLE_EX(1b, 2b) \ 436 + ".section .fixup,\"ax\"\n" \ 437 + "3:xor"itype" %"rtype"0,%"rtype"0\n" \ 438 + " jmp 2b\n" \ 439 + ".previous\n" \ 440 + _ASM_EXTABLE_EX(1b, 3b) \ 437 441 : ltype(x) : "m" (__m(addr))) 438 442 439 443 #define __put_user_nocheck(x, ptr, size) \
+3 -1
arch/x86/kernel/apic/apic.c
··· 2093 2093 return -EINVAL; 2094 2094 } 2095 2095 2096 - num_processors++; 2097 2096 if (apicid == boot_cpu_physical_apicid) { 2098 2097 /* 2099 2098 * x86_bios_cpu_apicid is required to have processors listed ··· 2115 2116 2116 2117 pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", 2117 2118 thiscpu, apicid); 2119 + 2118 2120 disabled_cpus++; 2119 2121 return -ENOSPC; 2120 2122 } 2123 + 2124 + num_processors++; 2121 2125 2122 2126 /* 2123 2127 * Validate version
+10 -3
arch/x86/kernel/cpu/microcode/amd.c
··· 54 54 */ 55 55 static u8 *container; 56 56 static size_t container_size; 57 + static bool ucode_builtin; 57 58 58 59 static u32 ucode_new_rev; 59 60 static u8 amd_ucode_patch[PATCH_MAX_SIZE]; ··· 282 281 void __init load_ucode_amd_bsp(unsigned int family) 283 282 { 284 283 struct cpio_data cp; 284 + bool *builtin; 285 285 void **data; 286 286 size_t *size; 287 287 288 288 #ifdef CONFIG_X86_32 289 289 data = (void **)__pa_nodebug(&ucode_cpio.data); 290 290 size = (size_t *)__pa_nodebug(&ucode_cpio.size); 291 + builtin = (bool *)__pa_nodebug(&ucode_builtin); 291 292 #else 292 293 data = &ucode_cpio.data; 293 294 size = &ucode_cpio.size; 295 + builtin = &ucode_builtin; 294 296 #endif 295 297 296 - if (!load_builtin_amd_microcode(&cp, family)) 298 + *builtin = load_builtin_amd_microcode(&cp, family); 299 + if (!*builtin) 297 300 cp = find_ucode_in_initrd(); 298 301 299 302 if (!(cp.data && cp.size)) ··· 378 373 return; 379 374 380 375 /* Add CONFIG_RANDOMIZE_MEMORY offset. */ 381 - cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; 376 + if (!ucode_builtin) 377 + cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; 382 378 383 379 eax = cpuid_eax(0x00000001); 384 380 eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ); ··· 445 439 container = cont_va; 446 440 447 441 /* Add CONFIG_RANDOMIZE_MEMORY offset. */ 448 - container += PAGE_OFFSET - __PAGE_OFFSET_BASE; 442 + if (!ucode_builtin) 443 + container += PAGE_OFFSET - __PAGE_OFFSET_BASE; 449 444 450 445 eax = cpuid_eax(0x00000001); 451 446 eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
+1
arch/x86/kernel/kvmclock.c
··· 289 289 put_cpu(); 290 290 291 291 x86_platform.calibrate_tsc = kvm_get_tsc_khz; 292 + x86_platform.calibrate_cpu = kvm_get_tsc_khz; 292 293 x86_platform.get_wallclock = kvm_get_wallclock; 293 294 x86_platform.set_wallclock = kvm_set_wallclock; 294 295 #ifdef CONFIG_X86_LOCAL_APIC
+5 -3
arch/x86/kvm/ioapic.c
··· 109 109 { 110 110 bool new_val, old_val; 111 111 struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; 112 + struct dest_map *dest_map = &ioapic->rtc_status.dest_map; 112 113 union kvm_ioapic_redirect_entry *e; 113 114 114 115 e = &ioapic->redirtbl[RTC_GSI]; ··· 118 117 return; 119 118 120 119 new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); 121 - old_val = test_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); 120 + old_val = test_bit(vcpu->vcpu_id, dest_map->map); 122 121 123 122 if (new_val == old_val) 124 123 return; 125 124 126 125 if (new_val) { 127 - __set_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); 126 + __set_bit(vcpu->vcpu_id, dest_map->map); 127 + dest_map->vectors[vcpu->vcpu_id] = e->fields.vector; 128 128 ioapic->rtc_status.pending_eoi++; 129 129 } else { 130 - __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); 130 + __clear_bit(vcpu->vcpu_id, dest_map->map); 131 131 ioapic->rtc_status.pending_eoi--; 132 132 rtc_status_pending_eoi_check_valid(ioapic); 133 133 }
+2 -2
arch/x86/kvm/pmu_amd.c
··· 23 23 static struct kvm_event_hw_type_mapping amd_event_mapping[] = { 24 24 [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, 25 25 [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, 26 - [2] = { 0x80, 0x00, PERF_COUNT_HW_CACHE_REFERENCES }, 27 - [3] = { 0x81, 0x00, PERF_COUNT_HW_CACHE_MISSES }, 26 + [2] = { 0x7d, 0x07, PERF_COUNT_HW_CACHE_REFERENCES }, 27 + [3] = { 0x7e, 0x07, PERF_COUNT_HW_CACHE_MISSES }, 28 28 [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, 29 29 [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, 30 30 [6] = { 0xd0, 0x00, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND },
+4 -4
arch/x86/kvm/x86.c
··· 2743 2743 if (tsc_delta < 0) 2744 2744 mark_tsc_unstable("KVM discovered backwards TSC"); 2745 2745 2746 - if (kvm_lapic_hv_timer_in_use(vcpu) && 2747 - kvm_x86_ops->set_hv_timer(vcpu, 2748 - kvm_get_lapic_tscdeadline_msr(vcpu))) 2749 - kvm_lapic_switch_to_sw_timer(vcpu); 2750 2746 if (check_tsc_unstable()) { 2751 2747 u64 offset = kvm_compute_tsc_offset(vcpu, 2752 2748 vcpu->arch.last_guest_tsc); 2753 2749 kvm_x86_ops->write_tsc_offset(vcpu, offset); 2754 2750 vcpu->arch.tsc_catchup = 1; 2755 2751 } 2752 + if (kvm_lapic_hv_timer_in_use(vcpu) && 2753 + kvm_x86_ops->set_hv_timer(vcpu, 2754 + kvm_get_lapic_tscdeadline_msr(vcpu))) 2755 + kvm_lapic_switch_to_sw_timer(vcpu); 2756 2756 /* 2757 2757 * On a host with synchronized TSC, there is no need to update 2758 2758 * kvmclock on vcpu->cpu migration
+13 -7
arch/x86/pci/fixup.c
··· 553 553 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone); 554 554 555 555 /* 556 - * Broadwell EP Home Agent BARs erroneously return non-zero values when read. 556 + * Device [8086:2fc0] 557 + * Erratum HSE43 558 + * CONFIG_TDP_NOMINAL CSR Implemented at Incorrect Offset 559 + * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v3-spec-update.html 557 560 * 558 - * See http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html 559 - * entry BDF2. 561 + * Devices [8086:6f60,6fa0,6fc0] 562 + * Erratum BDF2 563 + * PCI BARs in the Home Agent Will Return Non-Zero Values During Enumeration 564 + * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html 560 565 */ 561 - static void pci_bdwep_bar(struct pci_dev *dev) 566 + static void pci_invalid_bar(struct pci_dev *dev) 562 567 { 563 568 dev->non_compliant_bars = 1; 564 569 } 565 - DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_bdwep_bar); 566 - DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_bdwep_bar); 567 - DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_bdwep_bar); 570 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2fc0, pci_invalid_bar); 571 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_invalid_bar); 572 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_invalid_bar); 573 + DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_invalid_bar);
+7 -2
crypto/cryptd.c
··· 631 631 632 632 static int cryptd_hash_import(struct ahash_request *req, const void *in) 633 633 { 634 - struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); 634 + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 635 + struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm); 636 + struct shash_desc *desc = cryptd_shash_desc(req); 635 637 636 - return crypto_shash_import(&rctx->desc, in); 638 + desc->tfm = ctx->child; 639 + desc->flags = req->base.flags; 640 + 641 + return crypto_shash_import(desc, in); 637 642 } 638 643 639 644 static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
+2 -2
drivers/base/power/runtime.c
··· 419 419 struct device *parent = NULL; 420 420 int retval; 421 421 422 - trace_rpm_suspend(dev, rpmflags); 422 + trace_rpm_suspend_rcuidle(dev, rpmflags); 423 423 424 424 repeat: 425 425 retval = rpm_check_suspend_allowed(dev); ··· 549 549 } 550 550 551 551 out: 552 - trace_rpm_return_int(dev, _THIS_IP_, retval); 552 + trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); 553 553 554 554 return retval; 555 555
+8 -8
drivers/clk/sunxi-ng/ccu-sun8i-h3.c
··· 783 783 [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, 784 784 [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, 785 785 786 - [RST_BUS_I2C0] = { 0x2d4, BIT(0) }, 787 - [RST_BUS_I2C1] = { 0x2d4, BIT(1) }, 788 - [RST_BUS_I2C2] = { 0x2d4, BIT(2) }, 789 - [RST_BUS_UART0] = { 0x2d4, BIT(16) }, 790 - [RST_BUS_UART1] = { 0x2d4, BIT(17) }, 791 - [RST_BUS_UART2] = { 0x2d4, BIT(18) }, 792 - [RST_BUS_UART3] = { 0x2d4, BIT(19) }, 793 - [RST_BUS_SCR] = { 0x2d4, BIT(20) }, 786 + [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, 787 + [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, 788 + [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, 789 + [RST_BUS_UART0] = { 0x2d8, BIT(16) }, 790 + [RST_BUS_UART1] = { 0x2d8, BIT(17) }, 791 + [RST_BUS_UART2] = { 0x2d8, BIT(18) }, 792 + [RST_BUS_UART3] = { 0x2d8, BIT(19) }, 793 + [RST_BUS_SCR] = { 0x2d8, BIT(20) }, 794 794 }; 795 795 796 796 static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = {
+3 -3
drivers/clk/sunxi-ng/ccu_nk.c
··· 14 14 #include "ccu_gate.h" 15 15 #include "ccu_nk.h" 16 16 17 - void ccu_nk_find_best(unsigned long parent, unsigned long rate, 18 - unsigned int max_n, unsigned int max_k, 19 - unsigned int *n, unsigned int *k) 17 + static void ccu_nk_find_best(unsigned long parent, unsigned long rate, 18 + unsigned int max_n, unsigned int max_k, 19 + unsigned int *n, unsigned int *k) 20 20 { 21 21 unsigned long best_rate = 0; 22 22 unsigned int best_k = 0, best_n = 0;
+2 -2
drivers/clk/sunxi/clk-a10-pll2.c
··· 73 73 SUN4I_PLL2_PRE_DIV_WIDTH, 74 74 CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, 75 75 &sun4i_a10_pll2_lock); 76 - if (!prediv_clk) { 76 + if (IS_ERR(prediv_clk)) { 77 77 pr_err("Couldn't register the prediv clock\n"); 78 78 goto err_free_array; 79 79 } ··· 106 106 &mult->hw, &clk_multiplier_ops, 107 107 &gate->hw, &clk_gate_ops, 108 108 CLK_SET_RATE_PARENT); 109 - if (!base_clk) { 109 + if (IS_ERR(base_clk)) { 110 110 pr_err("Couldn't register the base multiplier clock\n"); 111 111 goto err_free_multiplier; 112 112 }
+1 -1
drivers/clk/sunxi/clk-sun8i-mbus.c
··· 48 48 return; 49 49 50 50 reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 51 - if (!reg) { 51 + if (IS_ERR(reg)) { 52 52 pr_err("Could not get registers for sun8i-mbus-clk\n"); 53 53 goto err_free_parents; 54 54 }
+5 -2
drivers/firmware/efi/efi.c
··· 657 657 } 658 658 659 659 if (subnode) { 660 - node = of_get_flat_dt_subnode_by_name(node, subnode); 661 - if (node < 0) 660 + int err = of_get_flat_dt_subnode_by_name(node, subnode); 661 + 662 + if (err < 0) 662 663 return 0; 664 + 665 + node = err; 663 666 } 664 667 665 668 return __find_uefi_params(node, info, dt_params[i].params);
+139 -30
drivers/firmware/efi/libstub/efi-stub-helper.c
··· 41 41 #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE 42 42 #endif 43 43 44 + #define EFI_MMAP_NR_SLACK_SLOTS 8 45 + 44 46 struct file_info { 45 47 efi_file_handle_t *handle; 46 48 u64 size; ··· 65 63 } 66 64 } 67 65 66 + static inline bool mmap_has_headroom(unsigned long buff_size, 67 + unsigned long map_size, 68 + unsigned long desc_size) 69 + { 70 + unsigned long slack = buff_size - map_size; 71 + 72 + return slack / desc_size >= EFI_MMAP_NR_SLACK_SLOTS; 73 + } 74 + 68 75 efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, 69 - efi_memory_desc_t **map, 70 - unsigned long *map_size, 71 - unsigned long *desc_size, 72 - u32 *desc_ver, 73 - unsigned long *key_ptr) 76 + struct efi_boot_memmap *map) 74 77 { 75 78 efi_memory_desc_t *m = NULL; 76 79 efi_status_t status; 77 80 unsigned long key; 78 81 u32 desc_version; 79 82 80 - *map_size = sizeof(*m) * 32; 83 + *map->desc_size = sizeof(*m); 84 + *map->map_size = *map->desc_size * 32; 85 + *map->buff_size = *map->map_size; 81 86 again: 82 - /* 83 - * Add an additional efi_memory_desc_t because we're doing an 84 - * allocation which may be in a new descriptor region. 85 - */ 86 - *map_size += sizeof(*m); 87 87 status = efi_call_early(allocate_pool, EFI_LOADER_DATA, 88 - *map_size, (void **)&m); 88 + *map->map_size, (void **)&m); 89 89 if (status != EFI_SUCCESS) 90 90 goto fail; 91 91 92 - *desc_size = 0; 92 + *map->desc_size = 0; 93 93 key = 0; 94 - status = efi_call_early(get_memory_map, map_size, m, 95 - &key, desc_size, &desc_version); 96 - if (status == EFI_BUFFER_TOO_SMALL) { 94 + status = efi_call_early(get_memory_map, map->map_size, m, 95 + &key, map->desc_size, &desc_version); 96 + if (status == EFI_BUFFER_TOO_SMALL || 97 + !mmap_has_headroom(*map->buff_size, *map->map_size, 98 + *map->desc_size)) { 97 99 efi_call_early(free_pool, m); 100 + /* 101 + * Make sure there is some entries of headroom so that the 102 + * buffer can be reused for a new map after allocations are 103 + * no longer permitted. Its unlikely that the map will grow to 104 + * exceed this headroom once we are ready to trigger 105 + * ExitBootServices() 106 + */ 107 + *map->map_size += *map->desc_size * EFI_MMAP_NR_SLACK_SLOTS; 108 + *map->buff_size = *map->map_size; 98 109 goto again; 99 110 } 100 111 101 112 if (status != EFI_SUCCESS) 102 113 efi_call_early(free_pool, m); 103 114 104 - if (key_ptr && status == EFI_SUCCESS) 105 - *key_ptr = key; 106 - if (desc_ver && status == EFI_SUCCESS) 107 - *desc_ver = desc_version; 115 + if (map->key_ptr && status == EFI_SUCCESS) 116 + *map->key_ptr = key; 117 + if (map->desc_ver && status == EFI_SUCCESS) 118 + *map->desc_ver = desc_version; 108 119 109 120 fail: 110 - *map = m; 121 + *map->map = m; 111 122 return status; 112 123 } 113 124 ··· 128 113 unsigned long get_dram_base(efi_system_table_t *sys_table_arg) 129 114 { 130 115 efi_status_t status; 131 - unsigned long map_size; 116 + unsigned long map_size, buff_size; 132 117 unsigned long membase = EFI_ERROR; 133 118 struct efi_memory_map map; 134 119 efi_memory_desc_t *md; 120 + struct efi_boot_memmap boot_map; 135 121 136 - status = efi_get_memory_map(sys_table_arg, (efi_memory_desc_t **)&map.map, 137 - &map_size, &map.desc_size, NULL, NULL); 122 + boot_map.map = (efi_memory_desc_t **)&map.map; 123 + boot_map.map_size = &map_size; 124 + boot_map.desc_size = &map.desc_size; 125 + boot_map.desc_ver = NULL; 126 + boot_map.key_ptr = NULL; 127 + boot_map.buff_size = &buff_size; 128 + 129 + status = efi_get_memory_map(sys_table_arg, &boot_map); 138 130 if (status != EFI_SUCCESS) 139 131 return membase; 140 132 ··· 166 144 unsigned long size, unsigned long align, 167 145 unsigned long *addr, unsigned long max) 168 146 { 169 - unsigned long map_size, desc_size; 147 + unsigned long map_size, desc_size, buff_size; 170 148 efi_memory_desc_t *map; 171 149 efi_status_t status; 172 150 unsigned long nr_pages; 173 151 u64 max_addr = 0; 174 152 int i; 153 + struct efi_boot_memmap boot_map; 175 154 176 - status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size, 177 - NULL, NULL); 155 + boot_map.map = &map; 156 + boot_map.map_size = &map_size; 157 + boot_map.desc_size = &desc_size; 158 + boot_map.desc_ver = NULL; 159 + boot_map.key_ptr = NULL; 160 + boot_map.buff_size = &buff_size; 161 + 162 + status = efi_get_memory_map(sys_table_arg, &boot_map); 178 163 if (status != EFI_SUCCESS) 179 164 goto fail; 180 165 ··· 259 230 unsigned long size, unsigned long align, 260 231 unsigned long *addr) 261 232 { 262 - unsigned long map_size, desc_size; 233 + unsigned long map_size, desc_size, buff_size; 263 234 efi_memory_desc_t *map; 264 235 efi_status_t status; 265 236 unsigned long nr_pages; 266 237 int i; 238 + struct efi_boot_memmap boot_map; 267 239 268 - status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size, 269 - NULL, NULL); 240 + boot_map.map = &map; 241 + boot_map.map_size = &map_size; 242 + boot_map.desc_size = &desc_size; 243 + boot_map.desc_ver = NULL; 244 + boot_map.key_ptr = NULL; 245 + boot_map.buff_size = &buff_size; 246 + 247 + status = efi_get_memory_map(sys_table_arg, &boot_map); 270 248 if (status != EFI_SUCCESS) 271 249 goto fail; 272 250 ··· 739 703 740 704 *cmd_line_len = options_bytes; 741 705 return (char *)cmdline_addr; 706 + } 707 + 708 + /* 709 + * Handle calling ExitBootServices according to the requirements set out by the 710 + * spec. Obtains the current memory map, and returns that info after calling 711 + * ExitBootServices. The client must specify a function to perform any 712 + * processing of the memory map data prior to ExitBootServices. A client 713 + * specific structure may be passed to the function via priv. The client 714 + * function may be called multiple times. 715 + */ 716 + efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table_arg, 717 + void *handle, 718 + struct efi_boot_memmap *map, 719 + void *priv, 720 + efi_exit_boot_map_processing priv_func) 721 + { 722 + efi_status_t status; 723 + 724 + status = efi_get_memory_map(sys_table_arg, map); 725 + 726 + if (status != EFI_SUCCESS) 727 + goto fail; 728 + 729 + status = priv_func(sys_table_arg, map, priv); 730 + if (status != EFI_SUCCESS) 731 + goto free_map; 732 + 733 + status = efi_call_early(exit_boot_services, handle, *map->key_ptr); 734 + 735 + if (status == EFI_INVALID_PARAMETER) { 736 + /* 737 + * The memory map changed between efi_get_memory_map() and 738 + * exit_boot_services(). Per the UEFI Spec v2.6, Section 6.4: 739 + * EFI_BOOT_SERVICES.ExitBootServices we need to get the 740 + * updated map, and try again. The spec implies one retry 741 + * should be sufficent, which is confirmed against the EDK2 742 + * implementation. Per the spec, we can only invoke 743 + * get_memory_map() and exit_boot_services() - we cannot alloc 744 + * so efi_get_memory_map() cannot be used, and we must reuse 745 + * the buffer. For all practical purposes, the headroom in the 746 + * buffer should account for any changes in the map so the call 747 + * to get_memory_map() is expected to succeed here. 748 + */ 749 + *map->map_size = *map->buff_size; 750 + status = efi_call_early(get_memory_map, 751 + map->map_size, 752 + *map->map, 753 + map->key_ptr, 754 + map->desc_size, 755 + map->desc_ver); 756 + 757 + /* exit_boot_services() was called, thus cannot free */ 758 + if (status != EFI_SUCCESS) 759 + goto fail; 760 + 761 + status = priv_func(sys_table_arg, map, priv); 762 + /* exit_boot_services() was called, thus cannot free */ 763 + if (status != EFI_SUCCESS) 764 + goto fail; 765 + 766 + status = efi_call_early(exit_boot_services, handle, *map->key_ptr); 767 + } 768 + 769 + /* exit_boot_services() was called, thus cannot free */ 770 + if (status != EFI_SUCCESS) 771 + goto fail; 772 + 773 + return EFI_SUCCESS; 774 + 775 + free_map: 776 + efi_call_early(free_pool, *map->map); 777 + fail: 778 + return status; 742 779 }
+39 -15
drivers/firmware/efi/libstub/fdt.c
··· 152 152 #define EFI_FDT_ALIGN EFI_PAGE_SIZE 153 153 #endif 154 154 155 + struct exit_boot_struct { 156 + efi_memory_desc_t *runtime_map; 157 + int *runtime_entry_count; 158 + }; 159 + 160 + static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, 161 + struct efi_boot_memmap *map, 162 + void *priv) 163 + { 164 + struct exit_boot_struct *p = priv; 165 + /* 166 + * Update the memory map with virtual addresses. The function will also 167 + * populate @runtime_map with copies of just the EFI_MEMORY_RUNTIME 168 + * entries so that we can pass it straight to SetVirtualAddressMap() 169 + */ 170 + efi_get_virtmap(*map->map, *map->map_size, *map->desc_size, 171 + p->runtime_map, p->runtime_entry_count); 172 + 173 + return EFI_SUCCESS; 174 + } 175 + 155 176 /* 156 177 * Allocate memory for a new FDT, then add EFI, commandline, and 157 178 * initrd related fields to the FDT. This routine increases the ··· 196 175 unsigned long fdt_addr, 197 176 unsigned long fdt_size) 198 177 { 199 - unsigned long map_size, desc_size; 178 + unsigned long map_size, desc_size, buff_size; 200 179 u32 desc_ver; 201 180 unsigned long mmap_key; 202 181 efi_memory_desc_t *memory_map, *runtime_map; 203 182 unsigned long new_fdt_size; 204 183 efi_status_t status; 205 184 int runtime_entry_count = 0; 185 + struct efi_boot_memmap map; 186 + struct exit_boot_struct priv; 187 + 188 + map.map = &runtime_map; 189 + map.map_size = &map_size; 190 + map.desc_size = &desc_size; 191 + map.desc_ver = &desc_ver; 192 + map.key_ptr = &mmap_key; 193 + map.buff_size = &buff_size; 206 194 207 195 /* 208 196 * Get a copy of the current memory map that we will use to prepare ··· 219 189 * subsequent allocations adding entries, since they could not affect 220 190 * the number of EFI_MEMORY_RUNTIME regions. 221 191 */ 222 - status = efi_get_memory_map(sys_table, &runtime_map, &map_size, 223 - &desc_size, &desc_ver, &mmap_key); 192 + status = efi_get_memory_map(sys_table, &map); 224 193 if (status != EFI_SUCCESS) { 225 194 pr_efi_err(sys_table, "Unable to retrieve UEFI memory map.\n"); 226 195 return status; ··· 228 199 pr_efi(sys_table, 229 200 "Exiting boot services and installing virtual address map...\n"); 230 201 202 + map.map = &memory_map; 231 203 /* 232 204 * Estimate size of new FDT, and allocate memory for it. We 233 205 * will allocate a bigger buffer if this ends up being too ··· 248 218 * we can get the memory map key needed for 249 219 * exit_boot_services(). 250 220 */ 251 - status = efi_get_memory_map(sys_table, &memory_map, &map_size, 252 - &desc_size, &desc_ver, &mmap_key); 221 + status = efi_get_memory_map(sys_table, &map); 253 222 if (status != EFI_SUCCESS) 254 223 goto fail_free_new_fdt; 255 224 ··· 279 250 } 280 251 } 281 252 282 - /* 283 - * Update the memory map with virtual addresses. The function will also 284 - * populate @runtime_map with copies of just the EFI_MEMORY_RUNTIME 285 - * entries so that we can pass it straight into SetVirtualAddressMap() 286 - */ 287 - efi_get_virtmap(memory_map, map_size, desc_size, runtime_map, 288 - &runtime_entry_count); 289 - 290 - /* Now we are ready to exit_boot_services.*/ 291 - status = sys_table->boottime->exit_boot_services(handle, mmap_key); 253 + sys_table->boottime->free_pool(memory_map); 254 + priv.runtime_map = runtime_map; 255 + priv.runtime_entry_count = &runtime_entry_count; 256 + status = efi_exit_boot_services(sys_table, handle, &map, &priv, 257 + exit_boot_func); 292 258 293 259 if (status == EFI_SUCCESS) { 294 260 efi_set_virtual_address_map_t *svam;
+10 -2
drivers/firmware/efi/libstub/random.c
··· 73 73 unsigned long random_seed) 74 74 { 75 75 unsigned long map_size, desc_size, total_slots = 0, target_slot; 76 + unsigned long buff_size; 76 77 efi_status_t status; 77 78 efi_memory_desc_t *memory_map; 78 79 int map_offset; 80 + struct efi_boot_memmap map; 79 81 80 - status = efi_get_memory_map(sys_table_arg, &memory_map, &map_size, 81 - &desc_size, NULL, NULL); 82 + map.map = &memory_map; 83 + map.map_size = &map_size; 84 + map.desc_size = &desc_size; 85 + map.desc_ver = NULL; 86 + map.key_ptr = NULL; 87 + map.buff_size = &buff_size; 88 + 89 + status = efi_get_memory_map(sys_table_arg, &map); 82 90 if (status != EFI_SUCCESS) 83 91 return status; 84 92
+1 -1
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
··· 387 387 atmel_hlcdc_crtc_finish_page_flip(drm_crtc_to_atmel_hlcdc_crtc(c)); 388 388 } 389 389 390 - void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) 390 + static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) 391 391 { 392 392 struct atmel_hlcdc_crtc_state *state; 393 393
+5 -5
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
··· 320 320 u32 *coeff_tab = heo_upscaling_ycoef; 321 321 u32 max_memsize; 322 322 323 - if (state->crtc_w < state->src_w) 323 + if (state->crtc_h < state->src_h) 324 324 coeff_tab = heo_downscaling_ycoef; 325 325 for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++) 326 326 atmel_hlcdc_layer_update_cfg(&plane->layer, 327 327 33 + i, 328 328 0xffffffff, 329 329 coeff_tab[i]); 330 - factor = ((8 * 256 * state->src_w) - (256 * 4)) / 331 - state->crtc_w; 330 + factor = ((8 * 256 * state->src_h) - (256 * 4)) / 331 + state->crtc_h; 332 332 factor++; 333 - max_memsize = ((factor * state->crtc_w) + (256 * 4)) / 333 + max_memsize = ((factor * state->crtc_h) + (256 * 4)) / 334 334 2048; 335 - if (max_memsize > state->src_w) 335 + if (max_memsize > state->src_h) 336 336 factor--; 337 337 factor_reg |= (factor << 16) | 0x80000000; 338 338 }
+5
drivers/gpu/drm/i915/i915_drv.c
··· 1281 1281 1282 1282 intel_runtime_pm_enable(dev_priv); 1283 1283 1284 + /* Everything is in place, we can now relax! */ 1285 + DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n", 1286 + driver.name, driver.major, driver.minor, driver.patchlevel, 1287 + driver.date, pci_name(pdev), dev_priv->drm.primary->index); 1288 + 1284 1289 intel_runtime_pm_put(dev_priv); 1285 1290 1286 1291 return 0;
+6 -3
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 122 122 has_full_48bit_ppgtt = 123 123 IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9; 124 124 125 - if (intel_vgpu_active(dev_priv)) 126 - has_full_ppgtt = false; /* emulation is too hard */ 125 + if (intel_vgpu_active(dev_priv)) { 126 + /* emulation is too hard */ 127 + has_full_ppgtt = false; 128 + has_full_48bit_ppgtt = false; 129 + } 127 130 128 131 if (!has_aliasing_ppgtt) 129 132 return 0; ··· 161 158 return 0; 162 159 } 163 160 164 - if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists) 161 + if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt) 165 162 return has_full_48bit_ppgtt ? 3 : 2; 166 163 else 167 164 return has_aliasing_ppgtt ? 1 : 0;
-3
drivers/gpu/drm/i915/i915_vgpu.c
··· 65 65 66 66 BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE); 67 67 68 - if (!IS_HASWELL(dev_priv)) 69 - return; 70 - 71 68 magic = __raw_i915_read64(dev_priv, vgtif_reg(magic)); 72 69 if (magic != VGT_MAGIC) 73 70 return;
-1
drivers/gpu/drm/i915/intel_dvo.c
··· 554 554 return; 555 555 } 556 556 557 - drm_encoder_cleanup(&intel_encoder->base); 558 557 kfree(intel_dvo); 559 558 kfree(intel_connector); 560 559 }
+27
drivers/gpu/drm/i915/intel_opregion.c
··· 1047 1047 return err; 1048 1048 } 1049 1049 1050 + static int intel_use_opregion_panel_type_callback(const struct dmi_system_id *id) 1051 + { 1052 + DRM_INFO("Using panel type from OpRegion on %s\n", id->ident); 1053 + return 1; 1054 + } 1055 + 1056 + static const struct dmi_system_id intel_use_opregion_panel_type[] = { 1057 + { 1058 + .callback = intel_use_opregion_panel_type_callback, 1059 + .ident = "Conrac GmbH IX45GM2", 1060 + .matches = {DMI_MATCH(DMI_SYS_VENDOR, "Conrac GmbH"), 1061 + DMI_MATCH(DMI_PRODUCT_NAME, "IX45GM2"), 1062 + }, 1063 + }, 1064 + { } 1065 + }; 1066 + 1050 1067 int 1051 1068 intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) 1052 1069 { ··· 1086 1069 /* fall back to VBT panel type? */ 1087 1070 if (ret == 0x0) { 1088 1071 DRM_DEBUG_KMS("No panel type in OpRegion\n"); 1072 + return -ENODEV; 1073 + } 1074 + 1075 + /* 1076 + * So far we know that some machined must use it, others must not use it. 1077 + * There doesn't seem to be any way to determine which way to go, except 1078 + * via a quirk list :( 1079 + */ 1080 + if (!dmi_check_system(intel_use_opregion_panel_type)) { 1081 + DRM_DEBUG_KMS("Ignoring OpRegion panel type (%d)\n", ret - 1); 1089 1082 return -ENODEV; 1090 1083 } 1091 1084
+1
drivers/gpu/drm/i915/intel_pm.c
··· 7859 7859 case GEN6_PCODE_ILLEGAL_CMD: 7860 7860 return -ENXIO; 7861 7861 case GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: 7862 + case GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: 7862 7863 return -EOVERFLOW; 7863 7864 case GEN6_PCODE_TIMEOUT: 7864 7865 return -ETIMEDOUT;
+7 -7
drivers/gpu/drm/i915/intel_psr.c
··· 255 255 struct drm_i915_private *dev_priv = to_i915(dev); 256 256 257 257 uint32_t max_sleep_time = 0x1f; 258 - /* Lately it was identified that depending on panel idle frame count 259 - * calculated at HW can be off by 1. So let's use what came 260 - * from VBT + 1. 261 - * There are also other cases where panel demands at least 4 262 - * but VBT is not being set. To cover these 2 cases lets use 263 - * at least 5 when VBT isn't set to be on the safest side. 258 + /* 259 + * Let's respect VBT in case VBT asks a higher idle_frame value. 260 + * Let's use 6 as the minimum to cover all known cases including 261 + * the off-by-one issue that HW has in some cases. Also there are 262 + * cases where sink should be able to train 263 + * with the 5 or 6 idle patterns. 264 264 */ 265 - uint32_t idle_frames = dev_priv->vbt.psr.idle_frames + 1; 265 + uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames); 266 266 uint32_t val = EDP_PSR_ENABLE; 267 267 268 268 val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
+1 -1
drivers/gpu/drm/vc4/vc4_bo.c
··· 144 144 return &vc4->bo_cache.size_list[page_index]; 145 145 } 146 146 147 - void vc4_bo_cache_purge(struct drm_device *dev) 147 + static void vc4_bo_cache_purge(struct drm_device *dev) 148 148 { 149 149 struct vc4_dev *vc4 = to_vc4_dev(dev); 150 150
+8 -2
drivers/gpu/drm/vc4/vc4_validate_shaders.c
··· 309 309 * of uniforms on each side. However, this scheme is easy to 310 310 * validate so it's all we allow for now. 311 311 */ 312 - 313 - if (QPU_GET_FIELD(inst, QPU_SIG) != QPU_SIG_NONE) { 312 + switch (QPU_GET_FIELD(inst, QPU_SIG)) { 313 + case QPU_SIG_NONE: 314 + case QPU_SIG_SCOREBOARD_UNLOCK: 315 + case QPU_SIG_COLOR_LOAD: 316 + case QPU_SIG_LOAD_TMU0: 317 + case QPU_SIG_LOAD_TMU1: 318 + break; 319 + default: 314 320 DRM_ERROR("uniforms address change must be " 315 321 "normal math\n"); 316 322 return false;
+5 -1
drivers/infiniband/hw/cxgb4/cm.c
··· 333 333 334 334 spin_lock_irqsave(&ep->com.dev->lock, flags); 335 335 _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); 336 + if (idr_is_empty(&ep->com.dev->hwtid_idr)) 337 + wake_up(&ep->com.dev->wait); 336 338 spin_unlock_irqrestore(&ep->com.dev->lock, flags); 337 339 } 338 340 ··· 2119 2117 } 2120 2118 ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, 2121 2119 n, pdev, rt_tos2priority(tos)); 2122 - if (!ep->l2t) 2120 + if (!ep->l2t) { 2121 + dev_put(pdev); 2123 2122 goto out; 2123 + } 2124 2124 ep->mtu = pdev->mtu; 2125 2125 ep->tx_chan = cxgb4_port_chan(pdev); 2126 2126 ep->smac_idx = cxgb4_tp_smt_idx(adapter_type,
+5
drivers/infiniband/hw/cxgb4/device.c
··· 872 872 static void c4iw_dealloc(struct uld_ctx *ctx) 873 873 { 874 874 c4iw_rdev_close(&ctx->dev->rdev); 875 + WARN_ON_ONCE(!idr_is_empty(&ctx->dev->cqidr)); 875 876 idr_destroy(&ctx->dev->cqidr); 877 + WARN_ON_ONCE(!idr_is_empty(&ctx->dev->qpidr)); 876 878 idr_destroy(&ctx->dev->qpidr); 879 + WARN_ON_ONCE(!idr_is_empty(&ctx->dev->mmidr)); 877 880 idr_destroy(&ctx->dev->mmidr); 881 + wait_event(ctx->dev->wait, idr_is_empty(&ctx->dev->hwtid_idr)); 878 882 idr_destroy(&ctx->dev->hwtid_idr); 879 883 idr_destroy(&ctx->dev->stid_idr); 880 884 idr_destroy(&ctx->dev->atid_idr); ··· 996 992 mutex_init(&devp->rdev.stats.lock); 997 993 mutex_init(&devp->db_mutex); 998 994 INIT_LIST_HEAD(&devp->db_fc_list); 995 + init_waitqueue_head(&devp->wait); 999 996 devp->avail_ird = devp->rdev.lldi.max_ird_adapter; 1000 997 1001 998 if (c4iw_debugfs_root) {
+1
drivers/infiniband/hw/cxgb4/iw_cxgb4.h
··· 263 263 struct idr stid_idr; 264 264 struct list_head db_fc_list; 265 265 u32 avail_ird; 266 + wait_queue_head_t wait; 266 267 }; 267 268 268 269 static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev)
+23
drivers/infiniband/hw/mlx4/mad.c
··· 1128 1128 1129 1129 /* Generate GUID changed event */ 1130 1130 if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK) { 1131 + if (mlx4_is_master(dev->dev)) { 1132 + union ib_gid gid; 1133 + int err = 0; 1134 + 1135 + if (!eqe->event.port_mgmt_change.params.port_info.gid_prefix) 1136 + err = __mlx4_ib_query_gid(&dev->ib_dev, port, 0, &gid, 1); 1137 + else 1138 + gid.global.subnet_prefix = 1139 + eqe->event.port_mgmt_change.params.port_info.gid_prefix; 1140 + if (err) { 1141 + pr_warn("Could not change QP1 subnet prefix for port %d: query_gid error (%d)\n", 1142 + port, err); 1143 + } else { 1144 + pr_debug("Changing QP1 subnet prefix for port %d. old=0x%llx. new=0x%llx\n", 1145 + port, 1146 + (u64)atomic64_read(&dev->sriov.demux[port - 1].subnet_prefix), 1147 + be64_to_cpu(gid.global.subnet_prefix)); 1148 + atomic64_set(&dev->sriov.demux[port - 1].subnet_prefix, 1149 + be64_to_cpu(gid.global.subnet_prefix)); 1150 + } 1151 + } 1131 1152 mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE); 1132 1153 /*if master, notify all slaves*/ 1133 1154 if (mlx4_is_master(dev->dev)) ··· 2223 2202 if (err) 2224 2203 goto demux_err; 2225 2204 dev->sriov.demux[i].guid_cache[0] = gid.global.interface_id; 2205 + atomic64_set(&dev->sriov.demux[i].subnet_prefix, 2206 + be64_to_cpu(gid.global.subnet_prefix)); 2226 2207 err = alloc_pv_object(dev, mlx4_master_func_num(dev->dev), i + 1, 2227 2208 &dev->sriov.sqps[i]); 2228 2209 if (err)
+3
drivers/infiniband/hw/mlx4/main.c
··· 2202 2202 bool per_port = !!(ibdev->dev->caps.flags2 & 2203 2203 MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT); 2204 2204 2205 + if (mlx4_is_slave(ibdev->dev)) 2206 + return 0; 2207 + 2205 2208 for (i = 0; i < MLX4_DIAG_COUNTERS_TYPES; i++) { 2206 2209 /* i == 1 means we are building port counters */ 2207 2210 if (i && !per_port)
+7 -7
drivers/infiniband/hw/mlx4/mcg.c
··· 489 489 if (!group->members[i]) 490 490 leave_state |= (1 << i); 491 491 492 - return leave_state & (group->rec.scope_join_state & 7); 492 + return leave_state & (group->rec.scope_join_state & 0xf); 493 493 } 494 494 495 495 static int join_group(struct mcast_group *group, int slave, u8 join_mask) ··· 564 564 } else 565 565 mcg_warn_group(group, "DRIVER BUG\n"); 566 566 } else if (group->state == MCAST_LEAVE_SENT) { 567 - if (group->rec.scope_join_state & 7) 568 - group->rec.scope_join_state &= 0xf8; 567 + if (group->rec.scope_join_state & 0xf) 568 + group->rec.scope_join_state &= 0xf0; 569 569 group->state = MCAST_IDLE; 570 570 mutex_unlock(&group->lock); 571 571 if (release_group(group, 1)) ··· 605 605 static int handle_join_req(struct mcast_group *group, u8 join_mask, 606 606 struct mcast_req *req) 607 607 { 608 - u8 group_join_state = group->rec.scope_join_state & 7; 608 + u8 group_join_state = group->rec.scope_join_state & 0xf; 609 609 int ref = 0; 610 610 u16 status; 611 611 struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; ··· 690 690 u8 cur_join_state; 691 691 692 692 resp_join_state = ((struct ib_sa_mcmember_data *) 693 - group->response_sa_mad.data)->scope_join_state & 7; 694 - cur_join_state = group->rec.scope_join_state & 7; 693 + group->response_sa_mad.data)->scope_join_state & 0xf; 694 + cur_join_state = group->rec.scope_join_state & 0xf; 695 695 696 696 if (method == IB_MGMT_METHOD_GET_RESP) { 697 697 /* successfull join */ ··· 710 710 req = list_first_entry(&group->pending_list, struct mcast_req, 711 711 group_list); 712 712 sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; 713 - req_join_state = sa_data->scope_join_state & 0x7; 713 + req_join_state = sa_data->scope_join_state & 0xf; 714 714 715 715 /* For a leave request, we will immediately answer the VF, and 716 716 * update our internal counters. The actual leave will be sent
+1 -1
drivers/infiniband/hw/mlx4/mlx4_ib.h
··· 448 448 struct workqueue_struct *wq; 449 449 struct workqueue_struct *ud_wq; 450 450 spinlock_t ud_lock; 451 - __be64 subnet_prefix; 451 + atomic64_t subnet_prefix; 452 452 __be64 guid_cache[128]; 453 453 struct mlx4_ib_dev *dev; 454 454 /* the following lock protects both mcg_table and mcg_mgid0_list */
+20 -17
drivers/infiniband/hw/mlx4/qp.c
··· 2493 2493 sqp->ud_header.grh.flow_label = 2494 2494 ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff); 2495 2495 sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit; 2496 - if (is_eth) 2496 + if (is_eth) { 2497 2497 memcpy(sqp->ud_header.grh.source_gid.raw, sgid.raw, 16); 2498 - else { 2499 - if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { 2500 - /* When multi-function is enabled, the ib_core gid 2501 - * indexes don't necessarily match the hw ones, so 2502 - * we must use our own cache */ 2503 - sqp->ud_header.grh.source_gid.global.subnet_prefix = 2504 - to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. 2505 - subnet_prefix; 2506 - sqp->ud_header.grh.source_gid.global.interface_id = 2507 - to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. 2508 - guid_cache[ah->av.ib.gid_index]; 2509 - } else 2510 - ib_get_cached_gid(ib_dev, 2511 - be32_to_cpu(ah->av.ib.port_pd) >> 24, 2512 - ah->av.ib.gid_index, 2513 - &sqp->ud_header.grh.source_gid, NULL); 2498 + } else { 2499 + if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { 2500 + /* When multi-function is enabled, the ib_core gid 2501 + * indexes don't necessarily match the hw ones, so 2502 + * we must use our own cache 2503 + */ 2504 + sqp->ud_header.grh.source_gid.global.subnet_prefix = 2505 + cpu_to_be64(atomic64_read(&(to_mdev(ib_dev)->sriov. 2506 + demux[sqp->qp.port - 1]. 2507 + subnet_prefix))); 2508 + sqp->ud_header.grh.source_gid.global.interface_id = 2509 + to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. 2510 + guid_cache[ah->av.ib.gid_index]; 2511 + } else { 2512 + ib_get_cached_gid(ib_dev, 2513 + be32_to_cpu(ah->av.ib.port_pd) >> 24, 2514 + ah->av.ib.gid_index, 2515 + &sqp->ud_header.grh.source_gid, NULL); 2516 + } 2514 2517 } 2515 2518 memcpy(sqp->ud_header.grh.destination_gid.raw, 2516 2519 ah->av.ib.dgid, 16);
+10 -1
drivers/infiniband/hw/mlx5/main.c
··· 288 288 289 289 static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) 290 290 { 291 - return !MLX5_CAP_GEN(dev->mdev, ib_virt); 291 + if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB) 292 + return !MLX5_CAP_GEN(dev->mdev, ib_virt); 293 + return 0; 292 294 } 293 295 294 296 enum { ··· 1429 1427 ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_v, 1430 1428 dmac_47_16), 1431 1429 ib_spec->eth.val.dst_mac); 1430 + 1431 + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_c, 1432 + smac_47_16), 1433 + ib_spec->eth.mask.src_mac); 1434 + ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_v, 1435 + smac_47_16), 1436 + ib_spec->eth.val.src_mac); 1432 1437 1433 1438 if (ib_spec->eth.mask.vlan_tag) { 1434 1439 MLX5_SET(fte_match_set_lyr_2_4, outer_headers_c,
+1 -1
drivers/infiniband/sw/rdmavt/mr.c
··· 294 294 { 295 295 rvt_deinit_mregion(&mr->mr); 296 296 rvt_free_lkey(&mr->mr); 297 - vfree(mr); 297 + kfree(mr); 298 298 } 299 299 300 300 /**
+22 -3
drivers/infiniband/sw/rxe/rxe.c
··· 362 362 return err; 363 363 } 364 364 365 - err = rxe_net_init(); 365 + err = rxe_net_ipv4_init(); 366 366 if (err) { 367 - pr_err("rxe: unable to init\n"); 367 + pr_err("rxe: unable to init ipv4 tunnel\n"); 368 368 rxe_cache_exit(); 369 - return err; 369 + goto exit; 370 370 } 371 + 372 + err = rxe_net_ipv6_init(); 373 + if (err) { 374 + pr_err("rxe: unable to init ipv6 tunnel\n"); 375 + rxe_cache_exit(); 376 + goto exit; 377 + } 378 + 379 + err = register_netdevice_notifier(&rxe_net_notifier); 380 + if (err) { 381 + pr_err("rxe: Failed to rigister netdev notifier\n"); 382 + goto exit; 383 + } 384 + 371 385 pr_info("rxe: loaded\n"); 372 386 373 387 return 0; 388 + 389 + exit: 390 + rxe_release_udp_tunnel(recv_sockets.sk4); 391 + rxe_release_udp_tunnel(recv_sockets.sk6); 392 + return err; 374 393 } 375 394 376 395 static void __exit rxe_module_exit(void)
+13
drivers/infiniband/sw/rxe/rxe_comp.c
··· 689 689 qp->req.need_retry = 1; 690 690 rxe_run_task(&qp->req.task, 1); 691 691 } 692 + 693 + if (pkt) { 694 + rxe_drop_ref(pkt->qp); 695 + kfree_skb(skb); 696 + } 697 + 692 698 goto exit; 699 + 693 700 } else { 694 701 wqe->status = IB_WC_RETRY_EXC_ERR; 695 702 state = COMPST_ERROR; ··· 723 716 case COMPST_ERROR: 724 717 do_complete(qp, wqe); 725 718 rxe_qp_error(qp); 719 + 720 + if (pkt) { 721 + rxe_drop_ref(pkt->qp); 722 + kfree_skb(skb); 723 + } 724 + 726 725 goto exit; 727 726 } 728 727 }
+26 -31
drivers/infiniband/sw/rxe/rxe_net.c
··· 275 275 return sock; 276 276 } 277 277 278 - static void rxe_release_udp_tunnel(struct socket *sk) 278 + void rxe_release_udp_tunnel(struct socket *sk) 279 279 { 280 - udp_tunnel_sock_release(sk); 280 + if (sk) 281 + udp_tunnel_sock_release(sk); 281 282 } 282 283 283 284 static void prepare_udp_hdr(struct sk_buff *skb, __be16 src_port, ··· 659 658 return NOTIFY_OK; 660 659 } 661 660 662 - static struct notifier_block rxe_net_notifier = { 661 + struct notifier_block rxe_net_notifier = { 663 662 .notifier_call = rxe_notify, 664 663 }; 665 664 666 - int rxe_net_init(void) 665 + int rxe_net_ipv4_init(void) 667 666 { 668 - int err; 667 + spin_lock_init(&dev_list_lock); 668 + 669 + recv_sockets.sk4 = rxe_setup_udp_tunnel(&init_net, 670 + htons(ROCE_V2_UDP_DPORT), false); 671 + if (IS_ERR(recv_sockets.sk4)) { 672 + recv_sockets.sk4 = NULL; 673 + pr_err("rxe: Failed to create IPv4 UDP tunnel\n"); 674 + return -1; 675 + } 676 + 677 + return 0; 678 + } 679 + 680 + int rxe_net_ipv6_init(void) 681 + { 682 + #if IS_ENABLED(CONFIG_IPV6) 669 683 670 684 spin_lock_init(&dev_list_lock); 671 685 672 686 recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net, 673 - htons(ROCE_V2_UDP_DPORT), true); 687 + htons(ROCE_V2_UDP_DPORT), true); 674 688 if (IS_ERR(recv_sockets.sk6)) { 675 689 recv_sockets.sk6 = NULL; 676 690 pr_err("rxe: Failed to create IPv6 UDP tunnel\n"); 677 691 return -1; 678 692 } 679 - 680 - recv_sockets.sk4 = rxe_setup_udp_tunnel(&init_net, 681 - htons(ROCE_V2_UDP_DPORT), false); 682 - if (IS_ERR(recv_sockets.sk4)) { 683 - rxe_release_udp_tunnel(recv_sockets.sk6); 684 - recv_sockets.sk4 = NULL; 685 - recv_sockets.sk6 = NULL; 686 - pr_err("rxe: Failed to create IPv4 UDP tunnel\n"); 687 - return -1; 688 - } 689 - 690 - err = register_netdevice_notifier(&rxe_net_notifier); 691 - if (err) { 692 - rxe_release_udp_tunnel(recv_sockets.sk6); 693 - rxe_release_udp_tunnel(recv_sockets.sk4); 694 - pr_err("rxe: Failed to rigister netdev notifier\n"); 695 - } 696 - 697 - return err; 693 + #endif 694 + return 0; 698 695 } 699 696 700 697 void rxe_net_exit(void) 701 698 { 702 - if (recv_sockets.sk6) 703 - rxe_release_udp_tunnel(recv_sockets.sk6); 704 - 705 - if (recv_sockets.sk4) 706 - rxe_release_udp_tunnel(recv_sockets.sk4); 707 - 699 + rxe_release_udp_tunnel(recv_sockets.sk6); 700 + rxe_release_udp_tunnel(recv_sockets.sk4); 708 701 unregister_netdevice_notifier(&rxe_net_notifier); 709 702 }
+4 -1
drivers/infiniband/sw/rxe/rxe_net.h
··· 44 44 }; 45 45 46 46 extern struct rxe_recv_sockets recv_sockets; 47 + extern struct notifier_block rxe_net_notifier; 48 + void rxe_release_udp_tunnel(struct socket *sk); 47 49 48 50 struct rxe_dev *rxe_net_add(struct net_device *ndev); 49 51 50 - int rxe_net_init(void); 52 + int rxe_net_ipv4_init(void); 53 + int rxe_net_ipv6_init(void); 51 54 void rxe_net_exit(void); 52 55 53 56 #endif /* RXE_NET_H */
+1 -1
drivers/infiniband/sw/rxe/rxe_recv.c
··· 312 312 * make a copy of the skb to post to the next qp 313 313 */ 314 314 skb_copy = (mce->qp_list.next != &mcg->qp_list) ? 315 - skb_clone(skb, GFP_KERNEL) : NULL; 315 + skb_clone(skb, GFP_ATOMIC) : NULL; 316 316 317 317 pkt->qp = qp; 318 318 rxe_add_ref(qp);
+44 -13
drivers/infiniband/sw/rxe/rxe_req.c
··· 511 511 } 512 512 513 513 static void update_wqe_state(struct rxe_qp *qp, 514 - struct rxe_send_wqe *wqe, 515 - struct rxe_pkt_info *pkt, 516 - enum wqe_state *prev_state) 514 + struct rxe_send_wqe *wqe, 515 + struct rxe_pkt_info *pkt) 517 516 { 518 - enum wqe_state prev_state_ = wqe->state; 519 - 520 517 if (pkt->mask & RXE_END_MASK) { 521 518 if (qp_type(qp) == IB_QPT_RC) 522 519 wqe->state = wqe_state_pending; 523 520 } else { 524 521 wqe->state = wqe_state_processing; 525 522 } 526 - 527 - *prev_state = prev_state_; 528 523 } 529 524 530 - static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, 531 - struct rxe_pkt_info *pkt, int payload) 525 + static void update_wqe_psn(struct rxe_qp *qp, 526 + struct rxe_send_wqe *wqe, 527 + struct rxe_pkt_info *pkt, 528 + int payload) 532 529 { 533 530 /* number of packets left to send including current one */ 534 531 int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu; ··· 543 546 qp->req.psn = (wqe->first_psn + num_pkt) & BTH_PSN_MASK; 544 547 else 545 548 qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK; 549 + } 546 550 551 + static void save_state(struct rxe_send_wqe *wqe, 552 + struct rxe_qp *qp, 553 + struct rxe_send_wqe *rollback_wqe, 554 + struct rxe_qp *rollback_qp) 555 + { 556 + rollback_wqe->state = wqe->state; 557 + rollback_wqe->first_psn = wqe->first_psn; 558 + rollback_wqe->last_psn = wqe->last_psn; 559 + rollback_qp->req.psn = qp->req.psn; 560 + } 561 + 562 + static void rollback_state(struct rxe_send_wqe *wqe, 563 + struct rxe_qp *qp, 564 + struct rxe_send_wqe *rollback_wqe, 565 + struct rxe_qp *rollback_qp) 566 + { 567 + wqe->state = rollback_wqe->state; 568 + wqe->first_psn = rollback_wqe->first_psn; 569 + wqe->last_psn = rollback_wqe->last_psn; 570 + qp->req.psn = rollback_qp->req.psn; 571 + } 572 + 573 + static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, 574 + struct rxe_pkt_info *pkt, int payload) 575 + { 547 576 qp->req.opcode = pkt->opcode; 548 - 549 577 550 578 if (pkt->mask & RXE_END_MASK) 551 579 qp->req.wqe_index = next_index(qp->sq.queue, qp->req.wqe_index); ··· 593 571 int mtu; 594 572 int opcode; 595 573 int ret; 596 - enum wqe_state prev_state; 574 + struct rxe_qp rollback_qp; 575 + struct rxe_send_wqe rollback_wqe; 597 576 598 577 next_wqe: 599 578 if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) ··· 711 688 goto err; 712 689 } 713 690 714 - update_wqe_state(qp, wqe, &pkt, &prev_state); 691 + /* 692 + * To prevent a race on wqe access between requester and completer, 693 + * wqe members state and psn need to be set before calling 694 + * rxe_xmit_packet(). 695 + * Otherwise, completer might initiate an unjustified retry flow. 696 + */ 697 + save_state(wqe, qp, &rollback_wqe, &rollback_qp); 698 + update_wqe_state(qp, wqe, &pkt); 699 + update_wqe_psn(qp, wqe, &pkt, payload); 715 700 ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); 716 701 if (ret) { 717 702 qp->need_req_skb = 1; 718 703 kfree_skb(skb); 719 704 720 - wqe->state = prev_state; 705 + rollback_state(wqe, qp, &rollback_wqe, &rollback_qp); 721 706 722 707 if (ret == -EAGAIN) { 723 708 rxe_run_task(&qp->req.task, 1);
+6 -5
drivers/infiniband/sw/rxe/rxe_resp.c
··· 972 972 free_rd_atomic_resource(qp, res); 973 973 rxe_advance_resp_resource(qp); 974 974 975 + memcpy(SKB_TO_PKT(skb), &ack_pkt, sizeof(skb->cb)); 976 + 975 977 res->type = RXE_ATOMIC_MASK; 976 978 res->atomic.skb = skb; 977 - res->first_psn = qp->resp.psn; 978 - res->last_psn = qp->resp.psn; 979 - res->cur_psn = qp->resp.psn; 979 + res->first_psn = ack_pkt.psn; 980 + res->last_psn = ack_pkt.psn; 981 + res->cur_psn = ack_pkt.psn; 980 982 981 983 rc = rxe_xmit_packet(rxe, qp, &ack_pkt, skb_copy); 982 984 if (rc) { ··· 1118 1116 rc = RESPST_CLEANUP; 1119 1117 goto out; 1120 1118 } 1121 - bth_set_psn(SKB_TO_PKT(skb_copy), 1122 - qp->resp.psn - 1); 1119 + 1123 1120 /* Resend the result. */ 1124 1121 rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, 1125 1122 pkt, skb_copy);
+9
drivers/infiniband/ulp/ipoib/ipoib_ib.c
··· 1161 1161 } 1162 1162 1163 1163 if (level == IPOIB_FLUSH_LIGHT) { 1164 + int oper_up; 1164 1165 ipoib_mark_paths_invalid(dev); 1166 + /* Set IPoIB operation as down to prevent races between: 1167 + * the flush flow which leaves MCG and on the fly joins 1168 + * which can happen during that time. mcast restart task 1169 + * should deal with join requests we missed. 1170 + */ 1171 + oper_up = test_and_clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags); 1165 1172 ipoib_mcast_dev_flush(dev); 1173 + if (oper_up) 1174 + set_bit(IPOIB_FLAG_OPER_UP, &priv->flags); 1166 1175 ipoib_flush_ah(dev); 1167 1176 } 1168 1177
+3 -2
drivers/irqchip/irq-atmel-aic.c
··· 176 176 { 177 177 struct irq_domain_chip_generic *dgc = d->gc; 178 178 struct irq_chip_generic *gc; 179 + unsigned long flags; 179 180 unsigned smr; 180 181 int idx; 181 182 int ret; ··· 195 194 196 195 gc = dgc->gc[idx]; 197 196 198 - irq_gc_lock(gc); 197 + irq_gc_lock_irqsave(gc, flags); 199 198 smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); 200 199 aic_common_set_priority(intspec[2], &smr); 201 200 irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); 202 - irq_gc_unlock(gc); 201 + irq_gc_unlock_irqrestore(gc, flags); 203 202 204 203 return ret; 205 204 }
+3 -2
drivers/irqchip/irq-atmel-aic5.c
··· 258 258 unsigned int *out_type) 259 259 { 260 260 struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); 261 + unsigned long flags; 261 262 unsigned smr; 262 263 int ret; 263 264 ··· 270 269 if (ret) 271 270 return ret; 272 271 273 - irq_gc_lock(bgc); 272 + irq_gc_lock_irqsave(bgc, flags); 274 273 irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); 275 274 smr = irq_reg_readl(bgc, AT91_AIC5_SMR); 276 275 aic_common_set_priority(intspec[2], &smr); 277 276 irq_reg_writel(bgc, smr, AT91_AIC5_SMR); 278 - irq_gc_unlock(bgc); 277 + irq_gc_unlock_irqrestore(bgc, flags); 279 278 280 279 return ret; 281 280 }
+4 -8
drivers/md/md.c
··· 7610 7610 7611 7611 int md_setup_cluster(struct mddev *mddev, int nodes) 7612 7612 { 7613 - int err; 7614 - 7615 - err = request_module("md-cluster"); 7616 - if (err) { 7617 - pr_err("md-cluster module not found.\n"); 7618 - return -ENOENT; 7619 - } 7620 - 7613 + if (!md_cluster_ops) 7614 + request_module("md-cluster"); 7621 7615 spin_lock(&pers_lock); 7616 + /* ensure module won't be unloaded */ 7622 7617 if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { 7618 + pr_err("can't find md-cluster module or get it's reference.\n"); 7623 7619 spin_unlock(&pers_lock); 7624 7620 return -ENOENT; 7625 7621 }
+15 -31
drivers/md/raid5-cache.c
··· 96 96 spinlock_t no_space_stripes_lock; 97 97 98 98 bool need_cache_flush; 99 - bool in_teardown; 100 99 }; 101 100 102 101 /* ··· 703 704 704 705 mddev = log->rdev->mddev; 705 706 /* 706 - * This is to avoid a deadlock. r5l_quiesce holds reconfig_mutex and 707 - * wait for this thread to finish. This thread waits for 708 - * MD_CHANGE_PENDING clear, which is supposed to be done in 709 - * md_check_recovery(). md_check_recovery() tries to get 710 - * reconfig_mutex. Since r5l_quiesce already holds the mutex, 711 - * md_check_recovery() fails, so the PENDING never get cleared. The 712 - * in_teardown check workaround this issue. 707 + * Discard could zero data, so before discard we must make sure 708 + * superblock is updated to new log tail. Updating superblock (either 709 + * directly call md_update_sb() or depend on md thread) must hold 710 + * reconfig mutex. On the other hand, raid5_quiesce is called with 711 + * reconfig_mutex hold. The first step of raid5_quiesce() is waitting 712 + * for all IO finish, hence waitting for reclaim thread, while reclaim 713 + * thread is calling this function and waitting for reconfig mutex. So 714 + * there is a deadlock. We workaround this issue with a trylock. 715 + * FIXME: we could miss discard if we can't take reconfig mutex 713 716 */ 714 - if (!log->in_teardown) { 715 - set_mask_bits(&mddev->flags, 0, 716 - BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); 717 - md_wakeup_thread(mddev->thread); 718 - wait_event(mddev->sb_wait, 719 - !test_bit(MD_CHANGE_PENDING, &mddev->flags) || 720 - log->in_teardown); 721 - /* 722 - * r5l_quiesce could run after in_teardown check and hold 723 - * mutex first. Superblock might get updated twice. 724 - */ 725 - if (log->in_teardown) 726 - md_update_sb(mddev, 1); 727 - } else { 728 - WARN_ON(!mddev_is_locked(mddev)); 729 - md_update_sb(mddev, 1); 730 - } 717 + set_mask_bits(&mddev->flags, 0, 718 + BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); 719 + if (!mddev_trylock(mddev)) 720 + return; 721 + md_update_sb(mddev, 1); 722 + mddev_unlock(mddev); 731 723 732 724 /* discard IO error really doesn't matter, ignore it */ 733 725 if (log->last_checkpoint < end) { ··· 817 827 if (!log || state == 2) 818 828 return; 819 829 if (state == 0) { 820 - log->in_teardown = 0; 821 830 /* 822 831 * This is a special case for hotadd. In suspend, the array has 823 832 * no journal. In resume, journal is initialized as well as the ··· 827 838 log->reclaim_thread = md_register_thread(r5l_reclaim_thread, 828 839 log->rdev->mddev, "reclaim"); 829 840 } else if (state == 1) { 830 - /* 831 - * at this point all stripes are finished, so io_unit is at 832 - * least in STRIPE_END state 833 - */ 834 - log->in_teardown = 1; 835 841 /* make sure r5l_write_super_and_discard_space exits */ 836 842 mddev = log->rdev->mddev; 837 843 wake_up(&mddev->sb_wait);
+12 -2
drivers/md/raid5.c
··· 2423 2423 } 2424 2424 } 2425 2425 rdev_dec_pending(rdev, conf->mddev); 2426 + bio_reset(bi); 2426 2427 clear_bit(R5_LOCKED, &sh->dev[i].flags); 2427 2428 set_bit(STRIPE_HANDLE, &sh->state); 2428 2429 raid5_release_stripe(sh); 2429 - bio_reset(bi); 2430 2430 } 2431 2431 2432 2432 static void raid5_end_write_request(struct bio *bi) ··· 2498 2498 if (sh->batch_head && bi->bi_error && !replacement) 2499 2499 set_bit(STRIPE_BATCH_ERR, &sh->batch_head->state); 2500 2500 2501 + bio_reset(bi); 2501 2502 if (!test_and_clear_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags)) 2502 2503 clear_bit(R5_LOCKED, &sh->dev[i].flags); 2503 2504 set_bit(STRIPE_HANDLE, &sh->state); ··· 2506 2505 2507 2506 if (sh->batch_head && sh != sh->batch_head) 2508 2507 raid5_release_stripe(sh->batch_head); 2509 - bio_reset(bi); 2510 2508 } 2511 2509 2512 2510 static void raid5_build_block(struct stripe_head *sh, int i, int previous) ··· 6639 6639 } 6640 6640 6641 6641 conf->min_nr_stripes = NR_STRIPES; 6642 + if (mddev->reshape_position != MaxSector) { 6643 + int stripes = max_t(int, 6644 + ((mddev->chunk_sectors << 9) / STRIPE_SIZE) * 4, 6645 + ((mddev->new_chunk_sectors << 9) / STRIPE_SIZE) * 4); 6646 + conf->min_nr_stripes = max(NR_STRIPES, stripes); 6647 + if (conf->min_nr_stripes != NR_STRIPES) 6648 + printk(KERN_INFO 6649 + "md/raid:%s: force stripe size %d for reshape\n", 6650 + mdname(mddev), conf->min_nr_stripes); 6651 + } 6642 6652 memory = conf->min_nr_stripes * (sizeof(struct stripe_head) + 6643 6653 max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; 6644 6654 atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS);
+10 -8
drivers/mmc/host/omap.c
··· 1016 1016 1017 1017 /* Only reconfigure if we have a different burst size */ 1018 1018 if (*bp != burst) { 1019 - struct dma_slave_config cfg; 1020 - 1021 - cfg.src_addr = host->phys_base + OMAP_MMC_REG(host, DATA); 1022 - cfg.dst_addr = host->phys_base + OMAP_MMC_REG(host, DATA); 1023 - cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; 1024 - cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; 1025 - cfg.src_maxburst = burst; 1026 - cfg.dst_maxburst = burst; 1019 + struct dma_slave_config cfg = { 1020 + .src_addr = host->phys_base + 1021 + OMAP_MMC_REG(host, DATA), 1022 + .dst_addr = host->phys_base + 1023 + OMAP_MMC_REG(host, DATA), 1024 + .src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, 1025 + .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, 1026 + .src_maxburst = burst, 1027 + .dst_maxburst = burst, 1028 + }; 1027 1029 1028 1030 if (dmaengine_slave_config(c, &cfg)) 1029 1031 goto use_pio;
+8 -8
drivers/mmc/host/omap_hsmmc.c
··· 1409 1409 static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, 1410 1410 struct mmc_request *req) 1411 1411 { 1412 - struct dma_slave_config cfg; 1413 1412 struct dma_async_tx_descriptor *tx; 1414 1413 int ret = 0, i; 1415 1414 struct mmc_data *data = req->data; 1416 1415 struct dma_chan *chan; 1416 + struct dma_slave_config cfg = { 1417 + .src_addr = host->mapbase + OMAP_HSMMC_DATA, 1418 + .dst_addr = host->mapbase + OMAP_HSMMC_DATA, 1419 + .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 1420 + .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 1421 + .src_maxburst = data->blksz / 4, 1422 + .dst_maxburst = data->blksz / 4, 1423 + }; 1417 1424 1418 1425 /* Sanity check: all the SG entries must be aligned by block size. */ 1419 1426 for (i = 0; i < data->sg_len; i++) { ··· 1439 1432 BUG_ON(host->dma_ch != -1); 1440 1433 1441 1434 chan = omap_hsmmc_get_dma_chan(host, data); 1442 - 1443 - cfg.src_addr = host->mapbase + OMAP_HSMMC_DATA; 1444 - cfg.dst_addr = host->mapbase + OMAP_HSMMC_DATA; 1445 - cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 1446 - cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 1447 - cfg.src_maxburst = data->blksz / 4; 1448 - cfg.dst_maxburst = data->blksz / 4; 1449 1435 1450 1436 ret = dmaengine_slave_config(chan, &cfg); 1451 1437 if (ret)
+14 -1
drivers/mmc/host/sdhci-st.c
··· 28 28 29 29 struct st_mmc_platform_data { 30 30 struct reset_control *rstc; 31 + struct clk *icnclk; 31 32 void __iomem *top_ioaddr; 32 33 }; 33 34 ··· 354 353 struct sdhci_host *host; 355 354 struct st_mmc_platform_data *pdata; 356 355 struct sdhci_pltfm_host *pltfm_host; 357 - struct clk *clk; 356 + struct clk *clk, *icnclk; 358 357 int ret = 0; 359 358 u16 host_version; 360 359 struct resource *res; ··· 365 364 dev_err(&pdev->dev, "Peripheral clk not found\n"); 366 365 return PTR_ERR(clk); 367 366 } 367 + 368 + /* ICN clock isn't compulsory, but use it if it's provided. */ 369 + icnclk = devm_clk_get(&pdev->dev, "icn"); 370 + if (IS_ERR(icnclk)) 371 + icnclk = NULL; 368 372 369 373 rstc = devm_reset_control_get(&pdev->dev, NULL); 370 374 if (IS_ERR(rstc)) ··· 395 389 } 396 390 397 391 clk_prepare_enable(clk); 392 + clk_prepare_enable(icnclk); 398 393 399 394 /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */ 400 395 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, ··· 407 400 } 408 401 409 402 pltfm_host->clk = clk; 403 + pdata->icnclk = icnclk; 410 404 411 405 /* Configure the Arasan HC inside the flashSS */ 412 406 st_mmcss_cconfig(np, host); ··· 430 422 return 0; 431 423 432 424 err_out: 425 + clk_disable_unprepare(icnclk); 433 426 clk_disable_unprepare(clk); 434 427 err_of: 435 428 sdhci_pltfm_free(pdev); ··· 450 441 int ret; 451 442 452 443 ret = sdhci_pltfm_unregister(pdev); 444 + 445 + clk_disable_unprepare(pdata->icnclk); 453 446 454 447 if (rstc) 455 448 reset_control_assert(rstc); ··· 473 462 if (pdata->rstc) 474 463 reset_control_assert(pdata->rstc); 475 464 465 + clk_disable_unprepare(pdata->icnclk); 476 466 clk_disable_unprepare(pltfm_host->clk); 477 467 out: 478 468 return ret; ··· 487 475 struct device_node *np = dev->of_node; 488 476 489 477 clk_prepare_enable(pltfm_host->clk); 478 + clk_prepare_enable(pdata->icnclk); 490 479 491 480 if (pdata->rstc) 492 481 reset_control_deassert(pdata->rstc);
+4 -3
drivers/net/bonding/bond_main.c
··· 1341 1341 slave_dev->name); 1342 1342 } 1343 1343 1344 - /* already enslaved */ 1345 - if (slave_dev->flags & IFF_SLAVE) { 1346 - netdev_dbg(bond_dev, "Error: Device was already enslaved\n"); 1344 + /* already in-use? */ 1345 + if (netdev_is_rx_handler_busy(slave_dev)) { 1346 + netdev_err(bond_dev, 1347 + "Error: Device is in use and cannot be enslaved\n"); 1347 1348 return -EBUSY; 1348 1349 } 1349 1350
+15 -4
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 772 772 (bp->common.bc_ver & 0xff00) >> 8, 773 773 (bp->common.bc_ver & 0xff)); 774 774 775 + if (pci_channel_offline(bp->pdev)) { 776 + BNX2X_ERR("Cannot dump MCP info while in PCI error\n"); 777 + return; 778 + } 779 + 775 780 val = REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER); 776 781 if (val == REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER)) 777 782 BNX2X_ERR("%s" "MCP PC at 0x%x\n", lvl, val); ··· 9420 9415 /* Release IRQs */ 9421 9416 bnx2x_free_irq(bp); 9422 9417 9423 - /* Reset the chip */ 9424 - rc = bnx2x_reset_hw(bp, reset_code); 9425 - if (rc) 9426 - BNX2X_ERR("HW_RESET failed\n"); 9418 + /* Reset the chip, unless PCI function is offline. If we reach this 9419 + * point following a PCI error handling, it means device is really 9420 + * in a bad state and we're about to remove it, so reset the chip 9421 + * is not a good idea. 9422 + */ 9423 + if (!pci_channel_offline(bp->pdev)) { 9424 + rc = bnx2x_reset_hw(bp, reset_code); 9425 + if (rc) 9426 + BNX2X_ERR("HW_RESET failed\n"); 9427 + } 9427 9428 9428 9429 /* Report UNLOAD_DONE to MCP */ 9429 9430 bnx2x_send_unload_done(bp, keep_link);
+2 -2
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 353 353 push_len = (length + sizeof(*tx_push) + 7) / 8; 354 354 if (push_len > 16) { 355 355 __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 16); 356 - __iowrite64_copy(txr->tx_doorbell + 4, tx_push_buf + 1, 357 - push_len - 16); 356 + __iowrite32_copy(txr->tx_doorbell + 4, tx_push_buf + 1, 357 + (push_len - 16) << 1); 358 358 } else { 359 359 __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 360 360 push_len);
+1 -10
drivers/net/ethernet/broadcom/tg3.c
··· 14012 14012 if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) || 14013 14013 (!ec->rx_coalesce_usecs) || 14014 14014 (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) || 14015 + (!ec->tx_coalesce_usecs) || 14015 14016 (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) || 14016 14017 (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) || 14017 14018 (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) || ··· 14021 14020 (ec->tx_max_coalesced_frames_irq > MAX_TXCOAL_MAXF_INT) || 14022 14021 (ec->stats_block_coalesce_usecs > max_stat_coal_ticks) || 14023 14022 (ec->stats_block_coalesce_usecs < min_stat_coal_ticks)) 14024 - return -EINVAL; 14025 - 14026 - /* No rx interrupts will be generated if both are zero */ 14027 - if ((ec->rx_coalesce_usecs == 0) && 14028 - (ec->rx_max_coalesced_frames == 0)) 14029 - return -EINVAL; 14030 - 14031 - /* No tx interrupts will be generated if both are zero */ 14032 - if ((ec->tx_coalesce_usecs == 0) && 14033 - (ec->tx_max_coalesced_frames == 0)) 14034 14023 return -EINVAL; 14035 14024 14036 14025 /* Only copy relevant parameters, ignore all others. */
+23
drivers/net/ethernet/cadence/macb.c
··· 1323 1323 return 0; 1324 1324 } 1325 1325 1326 + static inline int macb_clear_csum(struct sk_buff *skb) 1327 + { 1328 + /* no change for packets without checksum offloading */ 1329 + if (skb->ip_summed != CHECKSUM_PARTIAL) 1330 + return 0; 1331 + 1332 + /* make sure we can modify the header */ 1333 + if (unlikely(skb_cow_head(skb, 0))) 1334 + return -1; 1335 + 1336 + /* initialize checksum field 1337 + * This is required - at least for Zynq, which otherwise calculates 1338 + * wrong UDP header checksums for UDP packets with UDP data len <=2 1339 + */ 1340 + *(__sum16 *)(skb_checksum_start(skb) + skb->csum_offset) = 0; 1341 + return 0; 1342 + } 1343 + 1326 1344 static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) 1327 1345 { 1328 1346 u16 queue_index = skb_get_queue_mapping(skb); ··· 1378 1360 netdev_dbg(bp->dev, "tx_head = %u, tx_tail = %u\n", 1379 1361 queue->tx_head, queue->tx_tail); 1380 1362 return NETDEV_TX_BUSY; 1363 + } 1364 + 1365 + if (macb_clear_csum(skb)) { 1366 + dev_kfree_skb_any(skb); 1367 + return NETDEV_TX_OK; 1381 1368 } 1382 1369 1383 1370 /* Map socket buffer for DMA transfer */
+1
drivers/net/ethernet/cavium/thunder/nic.h
··· 279 279 u8 sqs_id; 280 280 bool sqs_mode; 281 281 bool hw_tso; 282 + bool t88; 282 283 283 284 /* Receive buffer alloc */ 284 285 u32 rb_page_offset;
+8 -3
drivers/net/ethernet/cavium/thunder/nic_main.c
··· 251 251 int lmac; 252 252 u64 lmac_cfg; 253 253 254 - /* Max value that can be set is 60 */ 255 - if (size > 60) 256 - size = 60; 254 + /* There is a issue in HW where-in while sending GSO sized 255 + * pkts as part of TSO, if pkt len falls below this size 256 + * NIC will zero PAD packet and also updates IP total length. 257 + * Hence set this value to lessthan min pkt size of MAC+IP+TCP 258 + * headers, BGX will do the padding to transmit 64 byte pkt. 259 + */ 260 + if (size > 52) 261 + size = 52; 257 262 258 263 for (lmac = 0; lmac < (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX); lmac++) { 259 264 lmac_cfg = nic_reg_read(nic, NIC_PF_LMAC_0_7_CFG | (lmac << 3));
+15 -5
drivers/net/ethernet/cavium/thunder/nicvf_main.c
··· 513 513 struct nicvf *nic = netdev_priv(netdev); 514 514 struct snd_queue *sq; 515 515 struct sq_hdr_subdesc *hdr; 516 + struct sq_hdr_subdesc *tso_sqe; 516 517 517 518 sq = &nic->qs->sq[cqe_tx->sq_idx]; 518 519 ··· 528 527 529 528 nicvf_check_cqe_tx_errs(nic, cq, cqe_tx); 530 529 skb = (struct sk_buff *)sq->skbuff[cqe_tx->sqe_ptr]; 531 - /* For TSO offloaded packets only one SQE will have a valid SKB */ 532 530 if (skb) { 531 + /* Check for dummy descriptor used for HW TSO offload on 88xx */ 532 + if (hdr->dont_send) { 533 + /* Get actual TSO descriptors and free them */ 534 + tso_sqe = 535 + (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, hdr->rsvd2); 536 + nicvf_put_sq_desc(sq, tso_sqe->subdesc_cnt + 1); 537 + } 533 538 nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); 534 539 prefetch(skb); 535 540 dev_consume_skb_any(skb); 536 541 sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL; 537 542 } else { 538 - /* In case of HW TSO, HW sends a CQE for each segment of a TSO 539 - * packet instead of a single CQE for the whole TSO packet 540 - * transmitted. Each of this CQE points to the same SQE, so 541 - * avoid freeing same SQE multiple times. 543 + /* In case of SW TSO on 88xx, only last segment will have 544 + * a SKB attached, so just free SQEs here. 542 545 */ 543 546 if (!nic->hw_tso) 544 547 nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); ··· 1507 1502 struct net_device *netdev; 1508 1503 struct nicvf *nic; 1509 1504 int err, qcount; 1505 + u16 sdevid; 1510 1506 1511 1507 err = pci_enable_device(pdev); 1512 1508 if (err) { ··· 1580 1574 1581 1575 if (!pass1_silicon(nic->pdev)) 1582 1576 nic->hw_tso = true; 1577 + 1578 + pci_read_config_word(nic->pdev, PCI_SUBSYSTEM_ID, &sdevid); 1579 + if (sdevid == 0xA134) 1580 + nic->t88 = true; 1583 1581 1584 1582 /* Check if this VF is in QS only mode */ 1585 1583 if (nic->sqs_mode)
+57 -7
drivers/net/ethernet/cavium/thunder/nicvf_queues.c
··· 938 938 return num_edescs + sh->gso_segs; 939 939 } 940 940 941 + #define POST_CQE_DESC_COUNT 2 942 + 941 943 /* Get the number of SQ descriptors needed to xmit this skb */ 942 944 static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) 943 945 { ··· 949 947 subdesc_cnt = nicvf_tso_count_subdescs(skb); 950 948 return subdesc_cnt; 951 949 } 950 + 951 + /* Dummy descriptors to get TSO pkt completion notification */ 952 + if (nic->t88 && nic->hw_tso && skb_shinfo(skb)->gso_size) 953 + subdesc_cnt += POST_CQE_DESC_COUNT; 952 954 953 955 if (skb_shinfo(skb)->nr_frags) 954 956 subdesc_cnt += skb_shinfo(skb)->nr_frags; ··· 971 965 struct sq_hdr_subdesc *hdr; 972 966 973 967 hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); 974 - sq->skbuff[qentry] = (u64)skb; 975 - 976 968 memset(hdr, 0, SND_QUEUE_DESC_SIZE); 977 969 hdr->subdesc_type = SQ_DESC_TYPE_HEADER; 978 - /* Enable notification via CQE after processing SQE */ 979 - hdr->post_cqe = 1; 980 - /* No of subdescriptors following this */ 981 - hdr->subdesc_cnt = subdesc_cnt; 970 + 971 + if (nic->t88 && nic->hw_tso && skb_shinfo(skb)->gso_size) { 972 + /* post_cqe = 0, to avoid HW posting a CQE for every TSO 973 + * segment transmitted on 88xx. 974 + */ 975 + hdr->subdesc_cnt = subdesc_cnt - POST_CQE_DESC_COUNT; 976 + } else { 977 + sq->skbuff[qentry] = (u64)skb; 978 + /* Enable notification via CQE after processing SQE */ 979 + hdr->post_cqe = 1; 980 + /* No of subdescriptors following this */ 981 + hdr->subdesc_cnt = subdesc_cnt; 982 + } 982 983 hdr->tot_len = len; 983 984 984 985 /* Offload checksum calculation to HW */ ··· 1034 1021 gather->ld_type = NIC_SEND_LD_TYPE_E_LDD; 1035 1022 gather->size = size; 1036 1023 gather->addr = data; 1024 + } 1025 + 1026 + /* Add HDR + IMMEDIATE subdescriptors right after descriptors of a TSO 1027 + * packet so that a CQE is posted as a notifation for transmission of 1028 + * TSO packet. 1029 + */ 1030 + static inline void nicvf_sq_add_cqe_subdesc(struct snd_queue *sq, int qentry, 1031 + int tso_sqe, struct sk_buff *skb) 1032 + { 1033 + struct sq_imm_subdesc *imm; 1034 + struct sq_hdr_subdesc *hdr; 1035 + 1036 + sq->skbuff[qentry] = (u64)skb; 1037 + 1038 + hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); 1039 + memset(hdr, 0, SND_QUEUE_DESC_SIZE); 1040 + hdr->subdesc_type = SQ_DESC_TYPE_HEADER; 1041 + /* Enable notification via CQE after processing SQE */ 1042 + hdr->post_cqe = 1; 1043 + /* There is no packet to transmit here */ 1044 + hdr->dont_send = 1; 1045 + hdr->subdesc_cnt = POST_CQE_DESC_COUNT - 1; 1046 + hdr->tot_len = 1; 1047 + /* Actual TSO header SQE index, needed for cleanup */ 1048 + hdr->rsvd2 = tso_sqe; 1049 + 1050 + qentry = nicvf_get_nxt_sqentry(sq, qentry); 1051 + imm = (struct sq_imm_subdesc *)GET_SQ_DESC(sq, qentry); 1052 + memset(imm, 0, SND_QUEUE_DESC_SIZE); 1053 + imm->subdesc_type = SQ_DESC_TYPE_IMMEDIATE; 1054 + imm->len = 1; 1037 1055 } 1038 1056 1039 1057 /* Segment a TSO packet into 'gso_size' segments and append ··· 1140 1096 int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) 1141 1097 { 1142 1098 int i, size; 1143 - int subdesc_cnt; 1099 + int subdesc_cnt, tso_sqe = 0; 1144 1100 int sq_num, qentry; 1145 1101 struct queue_set *qs; 1146 1102 struct snd_queue *sq; ··· 1175 1131 /* Add SQ header subdesc */ 1176 1132 nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1, 1177 1133 skb, skb->len); 1134 + tso_sqe = qentry; 1178 1135 1179 1136 /* Add SQ gather subdescs */ 1180 1137 qentry = nicvf_get_nxt_sqentry(sq, qentry); ··· 1199 1154 } 1200 1155 1201 1156 doorbell: 1157 + if (nic->t88 && skb_shinfo(skb)->gso_size) { 1158 + qentry = nicvf_get_nxt_sqentry(sq, qentry); 1159 + nicvf_sq_add_cqe_subdesc(sq, qentry, tso_sqe, skb); 1160 + } 1161 + 1202 1162 /* make sure all memory stores are done before ringing doorbell */ 1203 1163 smp_wmb(); 1204 1164
+11 -4
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 5113 5113 DCB_CAP_DCBX_VER_IEEE; 5114 5114 5115 5115 pf->flags |= I40E_FLAG_DCB_CAPABLE; 5116 - /* Enable DCB tagging only when more than one TC */ 5116 + /* Enable DCB tagging only when more than one TC 5117 + * or explicitly disable if only one TC 5118 + */ 5117 5119 if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1) 5118 5120 pf->flags |= I40E_FLAG_DCB_ENABLED; 5121 + else 5122 + pf->flags &= ~I40E_FLAG_DCB_ENABLED; 5119 5123 dev_dbg(&pf->pdev->dev, 5120 5124 "DCBX offload is supported for this PF.\n"); 5121 5125 } ··· 5720 5716 u8 type; 5721 5717 5722 5718 /* Not DCB capable or capability disabled */ 5723 - if (!(pf->flags & I40E_FLAG_DCB_CAPABLE)) 5719 + if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) 5724 5720 return ret; 5725 5721 5726 5722 /* Ignore if event is not for Nearest Bridge */ ··· 7900 7896 #endif 7901 7897 I40E_FLAG_RSS_ENABLED | 7902 7898 I40E_FLAG_DCB_CAPABLE | 7899 + I40E_FLAG_DCB_ENABLED | 7903 7900 I40E_FLAG_SRIOV_ENABLED | 7904 7901 I40E_FLAG_FD_SB_ENABLED | 7905 7902 I40E_FLAG_FD_ATR_ENABLED | ··· 10507 10502 I40E_FLAG_FD_SB_ENABLED | 10508 10503 I40E_FLAG_FD_ATR_ENABLED | 10509 10504 I40E_FLAG_DCB_CAPABLE | 10505 + I40E_FLAG_DCB_ENABLED | 10510 10506 I40E_FLAG_SRIOV_ENABLED | 10511 10507 I40E_FLAG_VMDQ_ENABLED); 10512 10508 } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | ··· 10531 10525 /* Not enough queues for all TCs */ 10532 10526 if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && 10533 10527 (queues_left < I40E_MAX_TRAFFIC_CLASS)) { 10534 - pf->flags &= ~I40E_FLAG_DCB_CAPABLE; 10528 + pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | 10529 + I40E_FLAG_DCB_ENABLED); 10535 10530 dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); 10536 10531 } 10537 10532 pf->num_lan_qps = max_t(int, pf->rss_size_max, ··· 10929 10922 err = i40e_init_pf_dcb(pf); 10930 10923 if (err) { 10931 10924 dev_info(&pdev->dev, "DCB init failed %d, disabled\n", err); 10932 - pf->flags &= ~I40E_FLAG_DCB_CAPABLE; 10925 + pf->flags &= ~(I40E_FLAG_DCB_CAPABLE & I40E_FLAG_DCB_ENABLED); 10933 10926 /* Continue without DCB enabled */ 10934 10927 } 10935 10928 #endif /* CONFIG_I40E_DCB */
+42 -40
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 50 50 MTK_ETHTOOL_STAT(rx_flow_control_packets), 51 51 }; 52 52 53 + static const char * const mtk_clks_source_name[] = { 54 + "ethif", "esw", "gp1", "gp2" 55 + }; 56 + 53 57 void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) 54 58 { 55 59 __raw_writel(val, eth->base + reg); ··· 295 291 static int mtk_mdio_init(struct mtk_eth *eth) 296 292 { 297 293 struct device_node *mii_np; 298 - int err; 294 + int ret; 299 295 300 296 mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); 301 297 if (!mii_np) { ··· 304 300 } 305 301 306 302 if (!of_device_is_available(mii_np)) { 307 - err = 0; 303 + ret = -ENODEV; 308 304 goto err_put_node; 309 305 } 310 306 311 - eth->mii_bus = mdiobus_alloc(); 307 + eth->mii_bus = devm_mdiobus_alloc(eth->dev); 312 308 if (!eth->mii_bus) { 313 - err = -ENOMEM; 309 + ret = -ENOMEM; 314 310 goto err_put_node; 315 311 } 316 312 ··· 321 317 eth->mii_bus->parent = eth->dev; 322 318 323 319 snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name); 324 - err = of_mdiobus_register(eth->mii_bus, mii_np); 325 - if (err) 326 - goto err_free_bus; 327 - 328 - return 0; 329 - 330 - err_free_bus: 331 - mdiobus_free(eth->mii_bus); 320 + ret = of_mdiobus_register(eth->mii_bus, mii_np); 332 321 333 322 err_put_node: 334 323 of_node_put(mii_np); 335 - eth->mii_bus = NULL; 336 - return err; 324 + return ret; 337 325 } 338 326 339 327 static void mtk_mdio_cleanup(struct mtk_eth *eth) ··· 334 338 return; 335 339 336 340 mdiobus_unregister(eth->mii_bus); 337 - of_node_put(eth->mii_bus->dev.of_node); 338 - mdiobus_free(eth->mii_bus); 339 341 } 340 342 341 343 static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) ··· 582 588 dma_addr_t mapped_addr; 583 589 unsigned int nr_frags; 584 590 int i, n_desc = 1; 585 - u32 txd4 = 0; 591 + u32 txd4 = 0, fport; 586 592 587 593 itxd = ring->next_free; 588 594 if (itxd == ring->last_free) 589 595 return -ENOMEM; 590 596 591 597 /* set the forward port */ 592 - txd4 |= (mac->id + 1) << TX_DMA_FPORT_SHIFT; 598 + fport = (mac->id + 1) << TX_DMA_FPORT_SHIFT; 599 + txd4 |= fport; 593 600 594 601 tx_buf = mtk_desc_to_tx_buf(ring, itxd); 595 602 memset(tx_buf, 0, sizeof(*tx_buf)); ··· 648 653 WRITE_ONCE(txd->txd3, (TX_DMA_SWC | 649 654 TX_DMA_PLEN0(frag_map_size) | 650 655 last_frag * TX_DMA_LS0)); 651 - WRITE_ONCE(txd->txd4, 0); 656 + WRITE_ONCE(txd->txd4, fport); 652 657 653 658 tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; 654 659 tx_buf = mtk_desc_to_tx_buf(ring, txd); ··· 860 865 /* receive data */ 861 866 skb = build_skb(data, ring->frag_size); 862 867 if (unlikely(!skb)) { 863 - put_page(virt_to_head_page(new_data)); 868 + skb_free_frag(new_data); 864 869 netdev->stats.rx_dropped++; 865 870 goto release_desc; 866 871 } ··· 1501 1506 struct mtk_eth *eth = mac->hw; 1502 1507 1503 1508 phy_disconnect(mac->phy_dev); 1504 - mtk_mdio_cleanup(eth); 1505 1509 mtk_irq_disable(eth, ~0); 1506 - free_irq(eth->irq[1], dev); 1507 - free_irq(eth->irq[2], dev); 1508 1510 } 1509 1511 1510 1512 static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ··· 1805 1813 if (!eth) 1806 1814 return -ENOMEM; 1807 1815 1816 + eth->dev = &pdev->dev; 1808 1817 eth->base = devm_ioremap_resource(&pdev->dev, res); 1809 1818 if (IS_ERR(eth->base)) 1810 1819 return PTR_ERR(eth->base); ··· 1840 1847 return -ENXIO; 1841 1848 } 1842 1849 } 1850 + for (i = 0; i < ARRAY_SIZE(eth->clks); i++) { 1851 + eth->clks[i] = devm_clk_get(eth->dev, 1852 + mtk_clks_source_name[i]); 1853 + if (IS_ERR(eth->clks[i])) { 1854 + if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) 1855 + return -EPROBE_DEFER; 1856 + return -ENODEV; 1857 + } 1858 + } 1843 1859 1844 - eth->clk_ethif = devm_clk_get(&pdev->dev, "ethif"); 1845 - eth->clk_esw = devm_clk_get(&pdev->dev, "esw"); 1846 - eth->clk_gp1 = devm_clk_get(&pdev->dev, "gp1"); 1847 - eth->clk_gp2 = devm_clk_get(&pdev->dev, "gp2"); 1848 - if (IS_ERR(eth->clk_esw) || IS_ERR(eth->clk_gp1) || 1849 - IS_ERR(eth->clk_gp2) || IS_ERR(eth->clk_ethif)) 1850 - return -ENODEV; 1860 + clk_prepare_enable(eth->clks[MTK_CLK_ETHIF]); 1861 + clk_prepare_enable(eth->clks[MTK_CLK_ESW]); 1862 + clk_prepare_enable(eth->clks[MTK_CLK_GP1]); 1863 + clk_prepare_enable(eth->clks[MTK_CLK_GP2]); 1851 1864 1852 - clk_prepare_enable(eth->clk_ethif); 1853 - clk_prepare_enable(eth->clk_esw); 1854 - clk_prepare_enable(eth->clk_gp1); 1855 - clk_prepare_enable(eth->clk_gp2); 1856 - 1857 - eth->dev = &pdev->dev; 1858 1865 eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); 1859 1866 INIT_WORK(&eth->pending_work, mtk_pending_work); 1860 1867 ··· 1896 1903 static int mtk_remove(struct platform_device *pdev) 1897 1904 { 1898 1905 struct mtk_eth *eth = platform_get_drvdata(pdev); 1906 + int i; 1899 1907 1900 - clk_disable_unprepare(eth->clk_ethif); 1901 - clk_disable_unprepare(eth->clk_esw); 1902 - clk_disable_unprepare(eth->clk_gp1); 1903 - clk_disable_unprepare(eth->clk_gp2); 1908 + /* stop all devices to make sure that dma is properly shut down */ 1909 + for (i = 0; i < MTK_MAC_COUNT; i++) { 1910 + if (!eth->netdev[i]) 1911 + continue; 1912 + mtk_stop(eth->netdev[i]); 1913 + } 1914 + 1915 + clk_disable_unprepare(eth->clks[MTK_CLK_ETHIF]); 1916 + clk_disable_unprepare(eth->clks[MTK_CLK_ESW]); 1917 + clk_disable_unprepare(eth->clks[MTK_CLK_GP1]); 1918 + clk_disable_unprepare(eth->clks[MTK_CLK_GP2]); 1904 1919 1905 1920 netif_napi_del(&eth->tx_napi); 1906 1921 netif_napi_del(&eth->rx_napi); 1907 1922 mtk_cleanup(eth); 1923 + mtk_mdio_cleanup(eth); 1908 1924 platform_set_drvdata(pdev, NULL); 1909 1925 1910 1926 return 0;
+14 -8
drivers/net/ethernet/mediatek/mtk_eth_soc.h
··· 290 290 MTK_TX_FLAGS_PAGE0 = 0x02, 291 291 }; 292 292 293 + /* This enum allows us to identify how the clock is defined on the array of the 294 + * clock in the order 295 + */ 296 + enum mtk_clks_map { 297 + MTK_CLK_ETHIF, 298 + MTK_CLK_ESW, 299 + MTK_CLK_GP1, 300 + MTK_CLK_GP2, 301 + MTK_CLK_MAX 302 + }; 303 + 293 304 /* struct mtk_tx_buf - This struct holds the pointers to the memory pointed at 294 305 * by the TX descriptor s 295 306 * @skb: The SKB pointer of the packet being sent ··· 381 370 * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring 382 371 * @phy_scratch_ring: physical address of scratch_ring 383 372 * @scratch_head: The scratch memory that scratch_ring points to. 384 - * @clk_ethif: The ethif clock 385 - * @clk_esw: The switch clock 386 - * @clk_gp1: The gmac1 clock 387 - * @clk_gp2: The gmac2 clock 373 + * @clks: clock array for all clocks required 388 374 * @mii_bus: If there is a bus we need to create an instance for it 389 375 * @pending_work: The workqueue used to reset the dma ring 390 376 */ ··· 408 400 struct mtk_tx_dma *scratch_ring; 409 401 dma_addr_t phy_scratch_ring; 410 402 void *scratch_head; 411 - struct clk *clk_ethif; 412 - struct clk *clk_esw; 413 - struct clk *clk_gp1; 414 - struct clk *clk_gp2; 403 + struct clk *clks[MTK_CLK_MAX]; 404 + 415 405 struct mii_bus *mii_bus; 416 406 struct work_struct pending_work; 417 407 };
+30 -27
drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
··· 94 94 *cap = true; 95 95 break; 96 96 case DCB_CAP_ATTR_DCBX: 97 - *cap = priv->cee_params.dcbx_cap; 97 + *cap = priv->dcbx_cap; 98 98 break; 99 99 case DCB_CAP_ATTR_PFC_TCS: 100 100 *cap = 1 << mlx4_max_tc(priv->mdev->dev); ··· 111 111 { 112 112 struct mlx4_en_priv *priv = netdev_priv(netdev); 113 113 114 - return priv->cee_params.dcb_cfg.pfc_state; 114 + return priv->cee_config.pfc_state; 115 115 } 116 116 117 117 static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state) 118 118 { 119 119 struct mlx4_en_priv *priv = netdev_priv(netdev); 120 120 121 - priv->cee_params.dcb_cfg.pfc_state = state; 121 + priv->cee_config.pfc_state = state; 122 122 } 123 123 124 124 static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, ··· 126 126 { 127 127 struct mlx4_en_priv *priv = netdev_priv(netdev); 128 128 129 - *setting = priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc; 129 + *setting = priv->cee_config.dcb_pfc[priority]; 130 130 } 131 131 132 132 static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, ··· 134 134 { 135 135 struct mlx4_en_priv *priv = netdev_priv(netdev); 136 136 137 - priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc = setting; 138 - priv->cee_params.dcb_cfg.pfc_state = true; 137 + priv->cee_config.dcb_pfc[priority] = setting; 138 + priv->cee_config.pfc_state = true; 139 139 } 140 140 141 141 static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) ··· 157 157 { 158 158 struct mlx4_en_priv *priv = netdev_priv(netdev); 159 159 struct mlx4_en_dev *mdev = priv->mdev; 160 - struct mlx4_en_cee_config *dcb_cfg = &priv->cee_params.dcb_cfg; 161 - int err = 0; 162 160 163 - if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 164 - return -EINVAL; 161 + if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 162 + return 1; 165 163 166 - if (dcb_cfg->pfc_state) { 164 + if (priv->cee_config.pfc_state) { 167 165 int tc; 168 166 169 167 priv->prof->rx_pause = 0; ··· 169 171 for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { 170 172 u8 tc_mask = 1 << tc; 171 173 172 - switch (dcb_cfg->tc_config[tc].dcb_pfc) { 174 + switch (priv->cee_config.dcb_pfc[tc]) { 173 175 case pfc_disabled: 174 176 priv->prof->tx_ppp &= ~tc_mask; 175 177 priv->prof->rx_ppp &= ~tc_mask; ··· 197 199 en_dbg(DRV, priv, "Set pfc off\n"); 198 200 } 199 201 200 - err = mlx4_SET_PORT_general(mdev->dev, priv->port, 201 - priv->rx_skb_size + ETH_FCS_LEN, 202 - priv->prof->tx_pause, 203 - priv->prof->tx_ppp, 204 - priv->prof->rx_pause, 205 - priv->prof->rx_ppp); 206 - if (err) 202 + if (mlx4_SET_PORT_general(mdev->dev, priv->port, 203 + priv->rx_skb_size + ETH_FCS_LEN, 204 + priv->prof->tx_pause, 205 + priv->prof->tx_ppp, 206 + priv->prof->rx_pause, 207 + priv->prof->rx_ppp)) { 207 208 en_err(priv, "Failed setting pause params\n"); 208 - return err; 209 + return 1; 210 + } 211 + 212 + return 0; 209 213 } 210 214 211 215 static u8 mlx4_en_dcbnl_get_state(struct net_device *dev) ··· 225 225 struct mlx4_en_priv *priv = netdev_priv(dev); 226 226 int num_tcs = 0; 227 227 228 - if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 228 + if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 229 229 return 1; 230 230 231 231 if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED)) ··· 238 238 priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; 239 239 } 240 240 241 - return mlx4_en_setup_tc(dev, num_tcs); 241 + if (mlx4_en_setup_tc(dev, num_tcs)) 242 + return 1; 243 + 244 + return 0; 242 245 } 243 246 244 247 /* On success returns a non-zero 802.1p user priority bitmap ··· 255 252 .selector = idtype, 256 253 .protocol = id, 257 254 }; 258 - if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 255 + if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 259 256 return 0; 260 257 261 258 return dcb_getapp(netdev, &app); ··· 267 264 struct mlx4_en_priv *priv = netdev_priv(netdev); 268 265 struct dcb_app app; 269 266 270 - if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 267 + if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) 271 268 return -EINVAL; 272 269 273 270 memset(&app, 0, sizeof(struct dcb_app)); ··· 436 433 { 437 434 struct mlx4_en_priv *priv = netdev_priv(dev); 438 435 439 - return priv->cee_params.dcbx_cap; 436 + return priv->dcbx_cap; 440 437 } 441 438 442 439 static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) ··· 445 442 struct ieee_ets ets = {0}; 446 443 struct ieee_pfc pfc = {0}; 447 444 448 - if (mode == priv->cee_params.dcbx_cap) 445 + if (mode == priv->dcbx_cap) 449 446 return 0; 450 447 451 448 if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || ··· 454 451 !(mode & DCB_CAP_DCBX_HOST)) 455 452 goto err; 456 453 457 - priv->cee_params.dcbx_cap = mode; 454 + priv->dcbx_cap = mode; 458 455 459 456 ets.ets_cap = IEEE_8021QAZ_MAX_TCS; 460 457 pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS;
+8 -13
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
··· 71 71 #ifdef CONFIG_MLX4_EN_DCB 72 72 if (!mlx4_is_slave(priv->mdev->dev)) { 73 73 if (up) { 74 - priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; 74 + if (priv->dcbx_cap) 75 + priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; 75 76 } else { 76 77 priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; 77 - priv->cee_params.dcb_cfg.pfc_state = false; 78 + priv->cee_config.pfc_state = false; 78 79 } 79 80 } 80 81 #endif /* CONFIG_MLX4_EN_DCB */ ··· 3049 3048 struct mlx4_en_priv *priv; 3050 3049 int i; 3051 3050 int err; 3052 - #ifdef CONFIG_MLX4_EN_DCB 3053 - struct tc_configuration *tc; 3054 - #endif 3055 3051 3056 3052 dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), 3057 3053 MAX_TX_RINGS, MAX_RX_RINGS); ··· 3115 3117 priv->msg_enable = MLX4_EN_MSG_LEVEL; 3116 3118 #ifdef CONFIG_MLX4_EN_DCB 3117 3119 if (!mlx4_is_slave(priv->mdev->dev)) { 3118 - priv->cee_params.dcbx_cap = DCB_CAP_DCBX_VER_CEE | 3119 - DCB_CAP_DCBX_HOST | 3120 - DCB_CAP_DCBX_VER_IEEE; 3120 + priv->dcbx_cap = DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_HOST | 3121 + DCB_CAP_DCBX_VER_IEEE; 3121 3122 priv->flags |= MLX4_EN_DCB_ENABLED; 3122 - priv->cee_params.dcb_cfg.pfc_state = false; 3123 + priv->cee_config.pfc_state = false; 3123 3124 3124 - for (i = 0; i < MLX4_EN_NUM_UP; i++) { 3125 - tc = &priv->cee_params.dcb_cfg.tc_config[i]; 3126 - tc->dcb_pfc = pfc_disabled; 3127 - } 3125 + for (i = 0; i < MLX4_EN_NUM_UP; i++) 3126 + priv->cee_config.dcb_pfc[i] = pfc_disabled; 3128 3127 3129 3128 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) { 3130 3129 dev->dcbnl_ops = &mlx4_en_dcbnl_ops;
+7 -5
drivers/net/ethernet/mellanox/mlx4/en_tx.c
··· 818 818 real_size = get_real_size(skb, shinfo, dev, &lso_header_size, 819 819 &inline_ok, &fragptr); 820 820 if (unlikely(!real_size)) 821 - goto tx_drop; 821 + goto tx_drop_count; 822 822 823 823 /* Align descriptor to TXBB size */ 824 824 desc_size = ALIGN(real_size, TXBB_SIZE); ··· 826 826 if (unlikely(nr_txbb > MAX_DESC_TXBBS)) { 827 827 if (netif_msg_tx_err(priv)) 828 828 en_warn(priv, "Oversized header or SG list\n"); 829 - goto tx_drop; 829 + goto tx_drop_count; 830 830 } 831 831 832 832 bf_ok = ring->bf_enabled; ··· 1071 1071 PCI_DMA_TODEVICE); 1072 1072 } 1073 1073 1074 + tx_drop_count: 1075 + ring->tx_dropped++; 1074 1076 tx_drop: 1075 1077 dev_kfree_skb_any(skb); 1076 - ring->tx_dropped++; 1077 1078 return NETDEV_TX_OK; 1078 1079 } 1079 1080 ··· 1107 1106 goto tx_drop; 1108 1107 1109 1108 if (mlx4_en_is_tx_ring_full(ring)) 1110 - goto tx_drop; 1109 + goto tx_drop_count; 1111 1110 1112 1111 /* fetch ring->cons far ahead before needing it to avoid stall */ 1113 1112 ring_cons = READ_ONCE(ring->cons); ··· 1177 1176 1178 1177 return NETDEV_TX_OK; 1179 1178 1180 - tx_drop: 1179 + tx_drop_count: 1181 1180 ring->tx_dropped++; 1181 + tx_drop: 1182 1182 return NETDEV_TX_BUSY; 1183 1183 }
+3 -12
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
··· 482 482 pfc_enabled_rx 483 483 }; 484 484 485 - struct tc_configuration { 486 - enum dcb_pfc_type dcb_pfc; 487 - }; 488 - 489 485 struct mlx4_en_cee_config { 490 486 bool pfc_state; 491 - struct tc_configuration tc_config[MLX4_EN_NUM_UP]; 487 + enum dcb_pfc_type dcb_pfc[MLX4_EN_NUM_UP]; 492 488 }; 493 - 494 - struct mlx4_en_cee_params { 495 - u8 dcbx_cap; 496 - struct mlx4_en_cee_config dcb_cfg; 497 - }; 498 - 499 489 #endif 500 490 501 491 struct ethtool_flow_id { ··· 614 624 struct ieee_ets ets; 615 625 u16 maxrate[IEEE_8021QAZ_MAX_TCS]; 616 626 enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS]; 617 - struct mlx4_en_cee_params cee_params; 627 + struct mlx4_en_cee_config cee_config; 628 + u8 dcbx_cap; 618 629 #endif 619 630 #ifdef CONFIG_RFS_ACCEL 620 631 spinlock_t filters_lock;
+2 -2
drivers/net/ethernet/mellanox/mlx4/port.c
··· 52 52 53 53 #define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2 54 54 #define MLX4_IGNORE_FCS_MASK 0x1 55 - #define MLNX4_TX_MAX_NUMBER 8 55 + #define MLX4_TC_MAX_NUMBER 8 56 56 57 57 void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) 58 58 { ··· 2022 2022 u8 num_tc = dev->caps.max_tc_eth; 2023 2023 2024 2024 if (!num_tc) 2025 - num_tc = MLNX4_TX_MAX_NUMBER; 2025 + num_tc = MLX4_TC_MAX_NUMBER; 2026 2026 2027 2027 return num_tc; 2028 2028 }
+5 -3
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 331 331 if (mlx5e_query_global_pause_combined(priv)) { 332 332 for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { 333 333 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0], 334 - pport_per_prio_pfc_stats_desc, 0); 334 + pport_per_prio_pfc_stats_desc, i); 335 335 } 336 336 } 337 337 ··· 659 659 static void ptys2ethtool_supported_link(unsigned long *supported_modes, 660 660 u32 eth_proto_cap) 661 661 { 662 + unsigned long proto_cap = eth_proto_cap; 662 663 int proto; 663 664 664 - for_each_set_bit(proto, (unsigned long *)&eth_proto_cap, MLX5E_LINK_MODES_NUMBER) 665 + for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER) 665 666 bitmap_or(supported_modes, supported_modes, 666 667 ptys2ethtool_table[proto].supported, 667 668 __ETHTOOL_LINK_MODE_MASK_NBITS); ··· 671 670 static void ptys2ethtool_adver_link(unsigned long *advertising_modes, 672 671 u32 eth_proto_cap) 673 672 { 673 + unsigned long proto_cap = eth_proto_cap; 674 674 int proto; 675 675 676 - for_each_set_bit(proto, (unsigned long *)&eth_proto_cap, MLX5E_LINK_MODES_NUMBER) 676 + for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER) 677 677 bitmap_or(advertising_modes, advertising_modes, 678 678 ptys2ethtool_table[proto].advertised, 679 679 __ETHTOOL_LINK_MODE_MASK_NBITS);
+15 -7
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
··· 637 637 static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe, 638 638 u32 cqe_bcnt) 639 639 { 640 - struct ethhdr *eth = (struct ethhdr *)(skb->data); 641 - struct iphdr *ipv4 = (struct iphdr *)(skb->data + ETH_HLEN); 642 - struct ipv6hdr *ipv6 = (struct ipv6hdr *)(skb->data + ETH_HLEN); 640 + struct ethhdr *eth = (struct ethhdr *)(skb->data); 641 + struct iphdr *ipv4; 642 + struct ipv6hdr *ipv6; 643 643 struct tcphdr *tcp; 644 + int network_depth = 0; 645 + __be16 proto; 646 + u16 tot_len; 644 647 645 648 u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); 646 649 int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || 647 650 (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); 648 651 649 - u16 tot_len = cqe_bcnt - ETH_HLEN; 652 + skb->mac_len = ETH_HLEN; 653 + proto = __vlan_get_protocol(skb, eth->h_proto, &network_depth); 650 654 651 - if (eth->h_proto == htons(ETH_P_IP)) { 652 - tcp = (struct tcphdr *)(skb->data + ETH_HLEN + 655 + ipv4 = (struct iphdr *)(skb->data + network_depth); 656 + ipv6 = (struct ipv6hdr *)(skb->data + network_depth); 657 + tot_len = cqe_bcnt - network_depth; 658 + 659 + if (proto == htons(ETH_P_IP)) { 660 + tcp = (struct tcphdr *)(skb->data + network_depth + 653 661 sizeof(struct iphdr)); 654 662 ipv6 = NULL; 655 663 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; 656 664 } else { 657 - tcp = (struct tcphdr *)(skb->data + ETH_HLEN + 665 + tcp = (struct tcphdr *)(skb->data + network_depth + 658 666 sizeof(struct ipv6hdr)); 659 667 ipv4 = NULL; 660 668 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
··· 356 356 sq->stats.stopped++; 357 357 } 358 358 359 + sq->stats.xmit_more += skb->xmit_more; 359 360 if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) { 360 361 int bf_sz = 0; 361 362 ··· 376 375 377 376 sq->stats.packets++; 378 377 sq->stats.bytes += num_bytes; 379 - sq->stats.xmit_more += skb->xmit_more; 380 378 return NETDEV_TX_OK; 381 379 382 380 dma_unmap_wqe_err:
+19 -9
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 56 56 #include <generated/utsrelease.h> 57 57 #include <net/pkt_cls.h> 58 58 #include <net/tc_act/tc_mirred.h> 59 + #include <net/netevent.h> 59 60 60 61 #include "spectrum.h" 61 62 #include "core.h" ··· 2106 2105 dev->netdev_ops = &mlxsw_sp_port_netdev_ops; 2107 2106 dev->ethtool_ops = &mlxsw_sp_port_ethtool_ops; 2108 2107 2108 + err = mlxsw_sp_port_swid_set(mlxsw_sp_port, 0); 2109 + if (err) { 2110 + dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", 2111 + mlxsw_sp_port->local_port); 2112 + goto err_port_swid_set; 2113 + } 2114 + 2109 2115 err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port); 2110 2116 if (err) { 2111 2117 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n", ··· 2136 2128 dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set system port mapping\n", 2137 2129 mlxsw_sp_port->local_port); 2138 2130 goto err_port_system_port_mapping_set; 2139 - } 2140 - 2141 - err = mlxsw_sp_port_swid_set(mlxsw_sp_port, 0); 2142 - if (err) { 2143 - dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", 2144 - mlxsw_sp_port->local_port); 2145 - goto err_port_swid_set; 2146 2131 } 2147 2132 2148 2133 err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port, width); ··· 2219 2218 err_port_admin_status_set: 2220 2219 err_port_mtu_set: 2221 2220 err_port_speed_by_width_set: 2222 - mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT); 2223 - err_port_swid_set: 2224 2221 err_port_system_port_mapping_set: 2225 2222 err_dev_addr_init: 2223 + mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT); 2224 + err_port_swid_set: 2226 2225 free_percpu(mlxsw_sp_port->pcpu_stats); 2227 2226 err_alloc_stats: 2228 2227 kfree(mlxsw_sp_port->untagged_vlans); ··· 4542 4541 .priority = 10, /* Must be called before FIB notifier block */ 4543 4542 }; 4544 4543 4544 + static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { 4545 + .notifier_call = mlxsw_sp_router_netevent_event, 4546 + }; 4547 + 4545 4548 static int __init mlxsw_sp_module_init(void) 4546 4549 { 4547 4550 int err; 4548 4551 4549 4552 register_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4550 4553 register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4554 + register_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4555 + 4551 4556 err = mlxsw_core_driver_register(&mlxsw_sp_driver); 4552 4557 if (err) 4553 4558 goto err_core_driver_register; 4554 4559 return 0; 4555 4560 4556 4561 err_core_driver_register: 4562 + unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4563 + unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4557 4564 unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4558 4565 return err; 4559 4566 } ··· 4569 4560 static void __exit mlxsw_sp_module_exit(void) 4570 4561 { 4571 4562 mlxsw_core_driver_unregister(&mlxsw_sp_driver); 4563 + unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); 4572 4564 unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); 4573 4565 unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); 4574 4566 }
+2
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
··· 587 587 struct neighbour *n); 588 588 void mlxsw_sp_router_neigh_destroy(struct net_device *dev, 589 589 struct neighbour *n); 590 + int mlxsw_sp_router_netevent_event(struct notifier_block *unused, 591 + unsigned long event, void *ptr); 590 592 591 593 int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count); 592 594 void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index);
+113 -65
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 107 107 } 108 108 109 109 struct mlxsw_sp_fib_key { 110 + struct net_device *dev; 110 111 unsigned char addr[sizeof(struct in6_addr)]; 111 112 unsigned char prefix_len; 112 113 }; ··· 124 123 struct rhash_head ht_node; 125 124 struct mlxsw_sp_fib_key key; 126 125 enum mlxsw_sp_fib_entry_type type; 127 - u8 added:1; 126 + unsigned int ref_count; 128 127 u16 rif; /* used for action local */ 129 128 struct mlxsw_sp_vr *vr; 130 129 struct list_head nexthop_group_node; ··· 172 171 173 172 static struct mlxsw_sp_fib_entry * 174 173 mlxsw_sp_fib_entry_create(struct mlxsw_sp_fib *fib, const void *addr, 175 - size_t addr_len, unsigned char prefix_len) 174 + size_t addr_len, unsigned char prefix_len, 175 + struct net_device *dev) 176 176 { 177 177 struct mlxsw_sp_fib_entry *fib_entry; 178 178 179 179 fib_entry = kzalloc(sizeof(*fib_entry), GFP_KERNEL); 180 180 if (!fib_entry) 181 181 return NULL; 182 + fib_entry->key.dev = dev; 182 183 memcpy(fib_entry->key.addr, addr, addr_len); 183 184 fib_entry->key.prefix_len = prefix_len; 184 185 return fib_entry; ··· 193 190 194 191 static struct mlxsw_sp_fib_entry * 195 192 mlxsw_sp_fib_entry_lookup(struct mlxsw_sp_fib *fib, const void *addr, 196 - size_t addr_len, unsigned char prefix_len) 193 + size_t addr_len, unsigned char prefix_len, 194 + struct net_device *dev) 197 195 { 198 - struct mlxsw_sp_fib_key key = {{ 0 } }; 196 + struct mlxsw_sp_fib_key key; 199 197 198 + memset(&key, 0, sizeof(key)); 199 + key.dev = dev; 200 200 memcpy(key.addr, addr, addr_len); 201 201 key.prefix_len = prefix_len; 202 202 return rhashtable_lookup_fast(&fib->ht, &key, mlxsw_sp_fib_ht_params); ··· 944 938 mlxsw_sp_port_dev_put(mlxsw_sp_port); 945 939 } 946 940 947 - static int mlxsw_sp_router_netevent_event(struct notifier_block *unused, 948 - unsigned long event, void *ptr) 941 + int mlxsw_sp_router_netevent_event(struct notifier_block *unused, 942 + unsigned long event, void *ptr) 949 943 { 950 944 struct mlxsw_sp_neigh_entry *neigh_entry; 951 945 struct mlxsw_sp_port *mlxsw_sp_port; ··· 1015 1009 return NOTIFY_DONE; 1016 1010 } 1017 1011 1018 - static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { 1019 - .notifier_call = mlxsw_sp_router_netevent_event, 1020 - }; 1021 - 1022 1012 static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) 1023 1013 { 1024 1014 int err; ··· 1029 1027 */ 1030 1028 mlxsw_sp_router_neighs_update_interval_init(mlxsw_sp); 1031 1029 1032 - err = register_netevent_notifier(&mlxsw_sp_router_netevent_nb); 1033 - if (err) 1034 - goto err_register_netevent_notifier; 1035 - 1036 1030 /* Create the delayed works for the activity_update */ 1037 1031 INIT_DELAYED_WORK(&mlxsw_sp->router.neighs_update.dw, 1038 1032 mlxsw_sp_router_neighs_update_work); ··· 1037 1039 mlxsw_core_schedule_dw(&mlxsw_sp->router.neighs_update.dw, 0); 1038 1040 mlxsw_core_schedule_dw(&mlxsw_sp->router.nexthop_probe_dw, 0); 1039 1041 return 0; 1040 - 1041 - err_register_netevent_notifier: 1042 - rhashtable_destroy(&mlxsw_sp->router.neigh_ht); 1043 - return err; 1044 1042 } 1045 1043 1046 1044 static void mlxsw_sp_neigh_fini(struct mlxsw_sp *mlxsw_sp) 1047 1045 { 1048 1046 cancel_delayed_work_sync(&mlxsw_sp->router.neighs_update.dw); 1049 1047 cancel_delayed_work_sync(&mlxsw_sp->router.nexthop_probe_dw); 1050 - unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); 1051 1048 rhashtable_destroy(&mlxsw_sp->router.neigh_ht); 1052 1049 } 1053 1050 ··· 1517 1524 return err; 1518 1525 mlxsw_sp_lpm_init(mlxsw_sp); 1519 1526 mlxsw_sp_vrs_init(mlxsw_sp); 1520 - return mlxsw_sp_neigh_init(mlxsw_sp); 1527 + err = mlxsw_sp_neigh_init(mlxsw_sp); 1528 + if (err) 1529 + goto err_neigh_init; 1530 + return 0; 1531 + 1532 + err_neigh_init: 1533 + __mlxsw_sp_router_fini(mlxsw_sp); 1534 + return err; 1521 1535 } 1522 1536 1523 1537 void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp) ··· 1626 1626 static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, 1627 1627 struct mlxsw_sp_fib_entry *fib_entry) 1628 1628 { 1629 - enum mlxsw_reg_ralue_op op; 1630 - 1631 - op = !fib_entry->added ? MLXSW_REG_RALUE_OP_WRITE_WRITE : 1632 - MLXSW_REG_RALUE_OP_WRITE_UPDATE; 1633 - return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, op); 1629 + return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, 1630 + MLXSW_REG_RALUE_OP_WRITE_WRITE); 1634 1631 } 1635 1632 1636 1633 static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp, ··· 1692 1695 mlxsw_sp_nexthop_group_put(mlxsw_sp, fib_entry); 1693 1696 } 1694 1697 1698 + static struct mlxsw_sp_fib_entry * 1699 + mlxsw_sp_fib_entry_get(struct mlxsw_sp *mlxsw_sp, 1700 + const struct switchdev_obj_ipv4_fib *fib4) 1701 + { 1702 + struct mlxsw_sp_fib_entry *fib_entry; 1703 + struct fib_info *fi = fib4->fi; 1704 + struct mlxsw_sp_vr *vr; 1705 + int err; 1706 + 1707 + vr = mlxsw_sp_vr_get(mlxsw_sp, fib4->dst_len, fib4->tb_id, 1708 + MLXSW_SP_L3_PROTO_IPV4); 1709 + if (IS_ERR(vr)) 1710 + return ERR_CAST(vr); 1711 + 1712 + fib_entry = mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, 1713 + sizeof(fib4->dst), 1714 + fib4->dst_len, fi->fib_dev); 1715 + if (fib_entry) { 1716 + /* Already exists, just take a reference */ 1717 + fib_entry->ref_count++; 1718 + return fib_entry; 1719 + } 1720 + fib_entry = mlxsw_sp_fib_entry_create(vr->fib, &fib4->dst, 1721 + sizeof(fib4->dst), 1722 + fib4->dst_len, fi->fib_dev); 1723 + if (!fib_entry) { 1724 + err = -ENOMEM; 1725 + goto err_fib_entry_create; 1726 + } 1727 + fib_entry->vr = vr; 1728 + fib_entry->ref_count = 1; 1729 + 1730 + err = mlxsw_sp_router_fib4_entry_init(mlxsw_sp, fib4, fib_entry); 1731 + if (err) 1732 + goto err_fib4_entry_init; 1733 + 1734 + return fib_entry; 1735 + 1736 + err_fib4_entry_init: 1737 + mlxsw_sp_fib_entry_destroy(fib_entry); 1738 + err_fib_entry_create: 1739 + mlxsw_sp_vr_put(mlxsw_sp, vr); 1740 + 1741 + return ERR_PTR(err); 1742 + } 1743 + 1744 + static struct mlxsw_sp_fib_entry * 1745 + mlxsw_sp_fib_entry_find(struct mlxsw_sp *mlxsw_sp, 1746 + const struct switchdev_obj_ipv4_fib *fib4) 1747 + { 1748 + struct mlxsw_sp_vr *vr; 1749 + 1750 + vr = mlxsw_sp_vr_find(mlxsw_sp, fib4->tb_id, MLXSW_SP_L3_PROTO_IPV4); 1751 + if (!vr) 1752 + return NULL; 1753 + 1754 + return mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, 1755 + sizeof(fib4->dst), fib4->dst_len, 1756 + fib4->fi->fib_dev); 1757 + } 1758 + 1759 + void mlxsw_sp_fib_entry_put(struct mlxsw_sp *mlxsw_sp, 1760 + struct mlxsw_sp_fib_entry *fib_entry) 1761 + { 1762 + struct mlxsw_sp_vr *vr = fib_entry->vr; 1763 + 1764 + if (--fib_entry->ref_count == 0) { 1765 + mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); 1766 + mlxsw_sp_fib_entry_destroy(fib_entry); 1767 + } 1768 + mlxsw_sp_vr_put(mlxsw_sp, vr); 1769 + } 1770 + 1695 1771 static int 1696 1772 mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, 1697 1773 const struct switchdev_obj_ipv4_fib *fib4, ··· 1773 1703 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 1774 1704 struct mlxsw_sp_router_fib4_add_info *info; 1775 1705 struct mlxsw_sp_fib_entry *fib_entry; 1776 - struct mlxsw_sp_vr *vr; 1777 1706 int err; 1778 1707 1779 - vr = mlxsw_sp_vr_get(mlxsw_sp, fib4->dst_len, fib4->tb_id, 1780 - MLXSW_SP_L3_PROTO_IPV4); 1781 - if (IS_ERR(vr)) 1782 - return PTR_ERR(vr); 1783 - 1784 - fib_entry = mlxsw_sp_fib_entry_create(vr->fib, &fib4->dst, 1785 - sizeof(fib4->dst), fib4->dst_len); 1786 - if (!fib_entry) { 1787 - err = -ENOMEM; 1788 - goto err_fib_entry_create; 1789 - } 1790 - fib_entry->vr = vr; 1791 - 1792 - err = mlxsw_sp_router_fib4_entry_init(mlxsw_sp, fib4, fib_entry); 1793 - if (err) 1794 - goto err_fib4_entry_init; 1708 + fib_entry = mlxsw_sp_fib_entry_get(mlxsw_sp, fib4); 1709 + if (IS_ERR(fib_entry)) 1710 + return PTR_ERR(fib_entry); 1795 1711 1796 1712 info = kmalloc(sizeof(*info), GFP_KERNEL); 1797 1713 if (!info) { ··· 1792 1736 return 0; 1793 1737 1794 1738 err_alloc_info: 1795 - mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); 1796 - err_fib4_entry_init: 1797 - mlxsw_sp_fib_entry_destroy(fib_entry); 1798 - err_fib_entry_create: 1799 - mlxsw_sp_vr_put(mlxsw_sp, vr); 1739 + mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); 1800 1740 return err; 1801 1741 } 1802 1742 ··· 1811 1759 fib_entry = info->fib_entry; 1812 1760 kfree(info); 1813 1761 1762 + if (fib_entry->ref_count != 1) 1763 + return 0; 1764 + 1814 1765 vr = fib_entry->vr; 1815 - err = mlxsw_sp_fib_entry_insert(fib_entry->vr->fib, fib_entry); 1766 + err = mlxsw_sp_fib_entry_insert(vr->fib, fib_entry); 1816 1767 if (err) 1817 1768 goto err_fib_entry_insert; 1818 - err = mlxsw_sp_fib_entry_update(mlxsw_sp, fib_entry); 1769 + err = mlxsw_sp_fib_entry_update(mlxsw_sp_port->mlxsw_sp, fib_entry); 1819 1770 if (err) 1820 1771 goto err_fib_entry_add; 1821 1772 return 0; ··· 1826 1771 err_fib_entry_add: 1827 1772 mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); 1828 1773 err_fib_entry_insert: 1829 - mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); 1830 - mlxsw_sp_fib_entry_destroy(fib_entry); 1831 - mlxsw_sp_vr_put(mlxsw_sp, vr); 1774 + mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); 1832 1775 return err; 1833 1776 } 1834 1777 ··· 1846 1793 { 1847 1794 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 1848 1795 struct mlxsw_sp_fib_entry *fib_entry; 1849 - struct mlxsw_sp_vr *vr; 1850 1796 1851 - vr = mlxsw_sp_vr_find(mlxsw_sp, fib4->tb_id, MLXSW_SP_L3_PROTO_IPV4); 1852 - if (!vr) { 1853 - dev_warn(mlxsw_sp->bus_info->dev, "Failed to find virtual router for FIB4 entry being removed.\n"); 1854 - return -ENOENT; 1855 - } 1856 - fib_entry = mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, 1857 - sizeof(fib4->dst), fib4->dst_len); 1797 + fib_entry = mlxsw_sp_fib_entry_find(mlxsw_sp, fib4); 1858 1798 if (!fib_entry) { 1859 1799 dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n"); 1860 1800 return -ENOENT; 1861 1801 } 1862 - mlxsw_sp_fib_entry_del(mlxsw_sp_port->mlxsw_sp, fib_entry); 1863 - mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); 1864 - mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); 1865 - mlxsw_sp_fib_entry_destroy(fib_entry); 1866 - mlxsw_sp_vr_put(mlxsw_sp, vr); 1802 + 1803 + if (fib_entry->ref_count == 1) { 1804 + mlxsw_sp_fib_entry_del(mlxsw_sp, fib_entry); 1805 + mlxsw_sp_fib_entry_remove(fib_entry->vr->fib, fib_entry); 1806 + } 1807 + 1808 + mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); 1867 1809 return 0; 1868 1810 }
+12 -16
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
··· 167 167 } 168 168 169 169 static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, 170 - u16 idx_begin, u16 idx_end, bool set, 171 - bool only_uc) 170 + u16 idx_begin, u16 idx_end, bool uc_set, 171 + bool bm_set) 172 172 { 173 173 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; 174 174 u16 local_port = mlxsw_sp_port->local_port; ··· 187 187 return -ENOMEM; 188 188 189 189 mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, 190 - table_type, range, local_port, set); 190 + table_type, range, local_port, uc_set); 191 191 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); 192 192 if (err) 193 - goto buffer_out; 194 - 195 - /* Flooding control allows one to decide whether a given port will 196 - * flood unicast traffic for which there is no FDB entry. 197 - */ 198 - if (only_uc) 199 193 goto buffer_out; 200 194 201 195 mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin, 202 - table_type, range, local_port, set); 196 + table_type, range, local_port, bm_set); 203 197 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); 204 198 if (err) 205 199 goto err_flood_bm_set; 206 - else 207 - goto buffer_out; 200 + 201 + goto buffer_out; 208 202 209 203 err_flood_bm_set: 210 204 mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, 211 - table_type, range, local_port, !set); 205 + table_type, range, local_port, !uc_set); 212 206 mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); 213 207 buffer_out: 214 208 kfree(sftr_pl); ··· 251 257 * the start of the vFIDs range. 252 258 */ 253 259 vfid = mlxsw_sp_fid_to_vfid(fid); 254 - return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, 255 - false); 260 + return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, set); 256 261 } 257 262 258 263 static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, ··· 453 460 { 454 461 struct mlxsw_sp_fid *f; 455 462 463 + if (test_bit(fid, mlxsw_sp_port->active_vlans)) 464 + return 0; 465 + 456 466 f = mlxsw_sp_fid_find(mlxsw_sp_port->mlxsw_sp, fid); 457 467 if (!f) { 458 468 f = mlxsw_sp_fid_create(mlxsw_sp_port->mlxsw_sp, fid); ··· 513 517 } 514 518 515 519 err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end, 516 - true, false); 520 + mlxsw_sp_port->uc_flood, true); 517 521 if (err) 518 522 goto err_port_flood_set; 519 523
-5
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
··· 41 41 * Chris Telfer <chris.telfer@netronome.com> 42 42 */ 43 43 44 - #include <linux/version.h> 45 44 #include <linux/module.h> 46 45 #include <linux/kernel.h> 47 46 #include <linux/init.h> ··· 1439 1440 skb_put(skb, data_len - meta_len); 1440 1441 1441 1442 nfp_net_set_hash(nn->netdev, skb, rxd); 1442 - 1443 - /* Pad small frames to minimum */ 1444 - if (skb_put_padto(skb, 60)) 1445 - break; 1446 1443 1447 1444 /* Stats update */ 1448 1445 u64_stats_update_begin(&r_vec->rx_sync);
-1
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
··· 40 40 * Brad Petrus <brad.petrus@netronome.com> 41 41 */ 42 42 43 - #include <linux/version.h> 44 43 #include <linux/kernel.h> 45 44 #include <linux/netdevice.h> 46 45 #include <linux/etherdevice.h>
+2 -5
drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c
··· 38 38 * Rolf Neugebauer <rolf.neugebauer@netronome.com> 39 39 */ 40 40 41 - #include <linux/version.h> 42 41 #include <linux/module.h> 43 42 #include <linux/kernel.h> 44 43 #include <linux/init.h> ··· 133 134 } 134 135 135 136 nfp_net_get_fw_version(&fw_ver, ctrl_bar); 136 - if (fw_ver.class != NFP_NET_CFG_VERSION_CLASS_GENERIC) { 137 + if (fw_ver.resv || fw_ver.class != NFP_NET_CFG_VERSION_CLASS_GENERIC) { 137 138 dev_err(&pdev->dev, "Unknown Firmware ABI %d.%d.%d.%d\n", 138 139 fw_ver.resv, fw_ver.class, fw_ver.major, fw_ver.minor); 139 140 err = -EINVAL; ··· 141 142 } 142 143 143 144 /* Determine stride */ 144 - if (nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 0) || 145 - nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 1) || 146 - nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0x12, 0x48)) { 145 + if (nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 1)) { 147 146 stride = 2; 148 147 tx_bar_no = NFP_NET_Q0_BAR; 149 148 rx_bar_no = NFP_NET_Q1_BAR;
+17 -3
drivers/net/ethernet/qlogic/qed/qed_dcbx.c
··· 19 19 #include "qed_dcbx.h" 20 20 #include "qed_hsi.h" 21 21 #include "qed_sp.h" 22 + #include "qed_sriov.h" 22 23 #ifdef CONFIG_DCB 23 24 #include <linux/qed/qed_eth_if.h> 24 25 #endif ··· 946 945 struct qed_ptt *p_ptt; 947 946 int rc; 948 947 948 + if (IS_VF(p_hwfn->cdev)) 949 + return -EINVAL; 950 + 949 951 p_ptt = qed_ptt_acquire(p_hwfn); 950 952 if (!p_ptt) 951 953 return -EBUSY; ··· 988 984 if (p_params->pfc.prio[i]) 989 985 pfc_map |= BIT(i); 990 986 987 + *pfc &= ~DCBX_PFC_PRI_EN_BITMAP_MASK; 991 988 *pfc |= (pfc_map << DCBX_PFC_PRI_EN_BITMAP_SHIFT); 992 989 993 990 DP_VERBOSE(p_hwfn, QED_MSG_DCB, "pfc = 0x%x\n", *pfc); ··· 1063 1058 1064 1059 for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) { 1065 1060 entry = &p_app->app_pri_tbl[i].entry; 1061 + *entry = 0; 1066 1062 if (ieee) { 1067 - *entry &= ~DCBX_APP_SF_IEEE_MASK; 1063 + *entry &= ~(DCBX_APP_SF_IEEE_MASK | DCBX_APP_SF_MASK); 1068 1064 switch (p_params->app_entry[i].sf_ieee) { 1069 1065 case QED_DCBX_SF_IEEE_ETHTYPE: 1070 1066 *entry |= ((u32)DCBX_APP_SF_IEEE_ETHTYPE << 1071 1067 DCBX_APP_SF_IEEE_SHIFT); 1068 + *entry |= ((u32)DCBX_APP_SF_ETHTYPE << 1069 + DCBX_APP_SF_SHIFT); 1072 1070 break; 1073 1071 case QED_DCBX_SF_IEEE_TCP_PORT: 1074 1072 *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_PORT << 1075 1073 DCBX_APP_SF_IEEE_SHIFT); 1074 + *entry |= ((u32)DCBX_APP_SF_PORT << 1075 + DCBX_APP_SF_SHIFT); 1076 1076 break; 1077 1077 case QED_DCBX_SF_IEEE_UDP_PORT: 1078 1078 *entry |= ((u32)DCBX_APP_SF_IEEE_UDP_PORT << 1079 1079 DCBX_APP_SF_IEEE_SHIFT); 1080 + *entry |= ((u32)DCBX_APP_SF_PORT << 1081 + DCBX_APP_SF_SHIFT); 1080 1082 break; 1081 1083 case QED_DCBX_SF_IEEE_TCP_UDP_PORT: 1082 1084 *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_UDP_PORT << 1083 1085 DCBX_APP_SF_IEEE_SHIFT); 1086 + *entry |= ((u32)DCBX_APP_SF_PORT << 1087 + DCBX_APP_SF_SHIFT); 1084 1088 break; 1085 1089 } 1086 1090 } else { ··· 1189 1175 return 0; 1190 1176 } 1191 1177 1192 - dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_KERNEL); 1178 + dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_KERNEL); 1193 1179 if (!dcbx_info) { 1194 1180 DP_ERR(p_hwfn, "Failed to allocate struct qed_dcbx_info\n"); 1195 1181 return -ENOMEM; ··· 1226 1212 { 1227 1213 struct qed_dcbx_get *dcbx_info; 1228 1214 1229 - dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_KERNEL); 1215 + dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_KERNEL); 1230 1216 if (!dcbx_info) { 1231 1217 DP_ERR(hwfn->cdev, "Failed to allocate memory for dcbx_info\n"); 1232 1218 return NULL;
+2 -1
drivers/net/ethernet/qlogic/qede/qede_main.c
··· 2520 2520 edev->ops->register_ops(cdev, &qede_ll_ops, edev); 2521 2521 2522 2522 #ifdef CONFIG_DCB 2523 - qede_set_dcbnl_ops(edev->ndev); 2523 + if (!IS_VF(edev)) 2524 + qede_set_dcbnl_ops(edev->ndev); 2524 2525 #endif 2525 2526 2526 2527 INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task);
+7
drivers/net/ethernet/renesas/sh_eth.c
··· 201 201 202 202 [ARSTR] = 0x0000, 203 203 [TSU_CTRST] = 0x0004, 204 + [TSU_FWSLC] = 0x0038, 204 205 [TSU_VTAG0] = 0x0058, 205 206 [TSU_ADSBSY] = 0x0060, 206 207 [TSU_TEN] = 0x0064, 208 + [TSU_POST1] = 0x0070, 209 + [TSU_POST2] = 0x0074, 210 + [TSU_POST3] = 0x0078, 211 + [TSU_POST4] = 0x007c, 207 212 [TSU_ADRH0] = 0x0100, 208 213 209 214 [TXNLCR0] = 0x0080, ··· 2791 2786 { 2792 2787 if (sh_eth_is_rz_fast_ether(mdp)) { 2793 2788 sh_eth_tsu_write(mdp, 0, TSU_TEN); /* Disable all CAM entry */ 2789 + sh_eth_tsu_write(mdp, TSU_FWSLC_POSTENU | TSU_FWSLC_POSTENL, 2790 + TSU_FWSLC); /* Enable POST registers */ 2794 2791 return; 2795 2792 } 2796 2793
+2
drivers/net/ethernet/smsc/smc91x.h
··· 470 470 #endif 471 471 472 472 #if ! SMC_CAN_USE_8BIT 473 + #undef SMC_inb 473 474 #define SMC_inb(ioaddr, reg) ({ BUG(); 0; }) 475 + #undef SMC_outb 474 476 #define SMC_outb(x, ioaddr, reg) BUG() 475 477 #define SMC_insb(a, r, p, l) BUG() 476 478 #define SMC_outsb(a, r, p, l) BUG()
+110 -115
drivers/net/ethernet/smsc/smsc911x.c
··· 1099 1099 goto err_out_free_bus_2; 1100 1100 } 1101 1101 1102 - if (smsc911x_mii_probe(dev) < 0) { 1103 - SMSC_WARN(pdata, probe, "Error registering mii bus"); 1104 - goto err_out_unregister_bus_3; 1105 - } 1106 - 1107 1102 return 0; 1108 1103 1109 - err_out_unregister_bus_3: 1110 - mdiobus_unregister(pdata->mii_bus); 1111 1104 err_out_free_bus_2: 1112 1105 mdiobus_free(pdata->mii_bus); 1113 1106 err_out_1: ··· 1507 1514 smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); 1508 1515 } 1509 1516 1517 + static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id) 1518 + { 1519 + struct net_device *dev = dev_id; 1520 + struct smsc911x_data *pdata = netdev_priv(dev); 1521 + u32 intsts = smsc911x_reg_read(pdata, INT_STS); 1522 + u32 inten = smsc911x_reg_read(pdata, INT_EN); 1523 + int serviced = IRQ_NONE; 1524 + u32 temp; 1525 + 1526 + if (unlikely(intsts & inten & INT_STS_SW_INT_)) { 1527 + temp = smsc911x_reg_read(pdata, INT_EN); 1528 + temp &= (~INT_EN_SW_INT_EN_); 1529 + smsc911x_reg_write(pdata, INT_EN, temp); 1530 + smsc911x_reg_write(pdata, INT_STS, INT_STS_SW_INT_); 1531 + pdata->software_irq_signal = 1; 1532 + smp_wmb(); 1533 + serviced = IRQ_HANDLED; 1534 + } 1535 + 1536 + if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) { 1537 + /* Called when there is a multicast update scheduled and 1538 + * it is now safe to complete the update */ 1539 + SMSC_TRACE(pdata, intr, "RX Stop interrupt"); 1540 + smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_); 1541 + if (pdata->multicast_update_pending) 1542 + smsc911x_rx_multicast_update_workaround(pdata); 1543 + serviced = IRQ_HANDLED; 1544 + } 1545 + 1546 + if (intsts & inten & INT_STS_TDFA_) { 1547 + temp = smsc911x_reg_read(pdata, FIFO_INT); 1548 + temp |= FIFO_INT_TX_AVAIL_LEVEL_; 1549 + smsc911x_reg_write(pdata, FIFO_INT, temp); 1550 + smsc911x_reg_write(pdata, INT_STS, INT_STS_TDFA_); 1551 + netif_wake_queue(dev); 1552 + serviced = IRQ_HANDLED; 1553 + } 1554 + 1555 + if (unlikely(intsts & inten & INT_STS_RXE_)) { 1556 + SMSC_TRACE(pdata, intr, "RX Error interrupt"); 1557 + smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_); 1558 + serviced = IRQ_HANDLED; 1559 + } 1560 + 1561 + if (likely(intsts & inten & INT_STS_RSFL_)) { 1562 + if (likely(napi_schedule_prep(&pdata->napi))) { 1563 + /* Disable Rx interrupts */ 1564 + temp = smsc911x_reg_read(pdata, INT_EN); 1565 + temp &= (~INT_EN_RSFL_EN_); 1566 + smsc911x_reg_write(pdata, INT_EN, temp); 1567 + /* Schedule a NAPI poll */ 1568 + __napi_schedule(&pdata->napi); 1569 + } else { 1570 + SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed"); 1571 + } 1572 + serviced = IRQ_HANDLED; 1573 + } 1574 + 1575 + return serviced; 1576 + } 1577 + 1510 1578 static int smsc911x_open(struct net_device *dev) 1511 1579 { 1512 1580 struct smsc911x_data *pdata = netdev_priv(dev); 1513 1581 unsigned int timeout; 1514 1582 unsigned int temp; 1515 1583 unsigned int intcfg; 1584 + int retval; 1585 + int irq_flags; 1516 1586 1517 - /* if the phy is not yet registered, retry later*/ 1587 + /* find and start the given phy */ 1518 1588 if (!dev->phydev) { 1519 - SMSC_WARN(pdata, hw, "phy_dev is NULL"); 1520 - return -EAGAIN; 1589 + retval = smsc911x_mii_probe(dev); 1590 + if (retval < 0) { 1591 + SMSC_WARN(pdata, probe, "Error starting phy"); 1592 + goto out; 1593 + } 1521 1594 } 1522 1595 1523 1596 /* Reset the LAN911x */ 1524 - if (smsc911x_soft_reset(pdata)) { 1597 + retval = smsc911x_soft_reset(pdata); 1598 + if (retval) { 1525 1599 SMSC_WARN(pdata, hw, "soft reset failed"); 1526 - return -EIO; 1600 + goto mii_free_out; 1527 1601 } 1528 1602 1529 1603 smsc911x_reg_write(pdata, HW_CFG, 0x00050000); ··· 1646 1586 pdata->software_irq_signal = 0; 1647 1587 smp_wmb(); 1648 1588 1589 + irq_flags = irq_get_trigger_type(dev->irq); 1590 + retval = request_irq(dev->irq, smsc911x_irqhandler, 1591 + irq_flags | IRQF_SHARED, dev->name, dev); 1592 + if (retval) { 1593 + SMSC_WARN(pdata, probe, 1594 + "Unable to claim requested irq: %d", dev->irq); 1595 + goto mii_free_out; 1596 + } 1597 + 1649 1598 temp = smsc911x_reg_read(pdata, INT_EN); 1650 1599 temp |= INT_EN_SW_INT_EN_; 1651 1600 smsc911x_reg_write(pdata, INT_EN, temp); ··· 1669 1600 if (!pdata->software_irq_signal) { 1670 1601 netdev_warn(dev, "ISR failed signaling test (IRQ %d)\n", 1671 1602 dev->irq); 1672 - return -ENODEV; 1603 + retval = -ENODEV; 1604 + goto irq_stop_out; 1673 1605 } 1674 1606 SMSC_TRACE(pdata, ifup, "IRQ handler passed test using IRQ %d", 1675 1607 dev->irq); ··· 1716 1646 1717 1647 netif_start_queue(dev); 1718 1648 return 0; 1649 + 1650 + irq_stop_out: 1651 + free_irq(dev->irq, dev); 1652 + mii_free_out: 1653 + phy_disconnect(dev->phydev); 1654 + dev->phydev = NULL; 1655 + out: 1656 + return retval; 1719 1657 } 1720 1658 1721 1659 /* Entry point for stopping the interface */ ··· 1745 1667 dev->stats.rx_dropped += smsc911x_reg_read(pdata, RX_DROP); 1746 1668 smsc911x_tx_update_txcounters(dev); 1747 1669 1670 + free_irq(dev->irq, dev); 1671 + 1748 1672 /* Bring the PHY down */ 1749 - if (dev->phydev) 1673 + if (dev->phydev) { 1750 1674 phy_stop(dev->phydev); 1675 + phy_disconnect(dev->phydev); 1676 + dev->phydev = NULL; 1677 + } 1678 + netif_carrier_off(dev); 1751 1679 1752 1680 SMSC_TRACE(pdata, ifdown, "Interface stopped"); 1753 1681 return 0; ··· 1893 1809 } 1894 1810 1895 1811 spin_unlock_irqrestore(&pdata->mac_lock, flags); 1896 - } 1897 - 1898 - static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id) 1899 - { 1900 - struct net_device *dev = dev_id; 1901 - struct smsc911x_data *pdata = netdev_priv(dev); 1902 - u32 intsts = smsc911x_reg_read(pdata, INT_STS); 1903 - u32 inten = smsc911x_reg_read(pdata, INT_EN); 1904 - int serviced = IRQ_NONE; 1905 - u32 temp; 1906 - 1907 - if (unlikely(intsts & inten & INT_STS_SW_INT_)) { 1908 - temp = smsc911x_reg_read(pdata, INT_EN); 1909 - temp &= (~INT_EN_SW_INT_EN_); 1910 - smsc911x_reg_write(pdata, INT_EN, temp); 1911 - smsc911x_reg_write(pdata, INT_STS, INT_STS_SW_INT_); 1912 - pdata->software_irq_signal = 1; 1913 - smp_wmb(); 1914 - serviced = IRQ_HANDLED; 1915 - } 1916 - 1917 - if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) { 1918 - /* Called when there is a multicast update scheduled and 1919 - * it is now safe to complete the update */ 1920 - SMSC_TRACE(pdata, intr, "RX Stop interrupt"); 1921 - smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_); 1922 - if (pdata->multicast_update_pending) 1923 - smsc911x_rx_multicast_update_workaround(pdata); 1924 - serviced = IRQ_HANDLED; 1925 - } 1926 - 1927 - if (intsts & inten & INT_STS_TDFA_) { 1928 - temp = smsc911x_reg_read(pdata, FIFO_INT); 1929 - temp |= FIFO_INT_TX_AVAIL_LEVEL_; 1930 - smsc911x_reg_write(pdata, FIFO_INT, temp); 1931 - smsc911x_reg_write(pdata, INT_STS, INT_STS_TDFA_); 1932 - netif_wake_queue(dev); 1933 - serviced = IRQ_HANDLED; 1934 - } 1935 - 1936 - if (unlikely(intsts & inten & INT_STS_RXE_)) { 1937 - SMSC_TRACE(pdata, intr, "RX Error interrupt"); 1938 - smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_); 1939 - serviced = IRQ_HANDLED; 1940 - } 1941 - 1942 - if (likely(intsts & inten & INT_STS_RSFL_)) { 1943 - if (likely(napi_schedule_prep(&pdata->napi))) { 1944 - /* Disable Rx interrupts */ 1945 - temp = smsc911x_reg_read(pdata, INT_EN); 1946 - temp &= (~INT_EN_RSFL_EN_); 1947 - smsc911x_reg_write(pdata, INT_EN, temp); 1948 - /* Schedule a NAPI poll */ 1949 - __napi_schedule(&pdata->napi); 1950 - } else { 1951 - SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed"); 1952 - } 1953 - serviced = IRQ_HANDLED; 1954 - } 1955 - 1956 - return serviced; 1957 1812 } 1958 1813 1959 1814 #ifdef CONFIG_NET_POLL_CONTROLLER ··· 2314 2291 pdata = netdev_priv(dev); 2315 2292 BUG_ON(!pdata); 2316 2293 BUG_ON(!pdata->ioaddr); 2317 - BUG_ON(!dev->phydev); 2294 + WARN_ON(dev->phydev); 2318 2295 2319 2296 SMSC_TRACE(pdata, ifdown, "Stopping driver"); 2320 2297 2321 - phy_disconnect(dev->phydev); 2322 2298 mdiobus_unregister(pdata->mii_bus); 2323 2299 mdiobus_free(pdata->mii_bus); 2324 2300 2325 2301 unregister_netdev(dev); 2326 - free_irq(dev->irq, dev); 2327 2302 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 2328 2303 "smsc911x-memory"); 2329 2304 if (!res) ··· 2406 2385 struct smsc911x_data *pdata; 2407 2386 struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev); 2408 2387 struct resource *res; 2409 - unsigned int intcfg = 0; 2410 - int res_size, irq, irq_flags; 2388 + int res_size, irq; 2411 2389 int retval; 2412 2390 2413 2391 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, ··· 2445 2425 2446 2426 pdata = netdev_priv(dev); 2447 2427 dev->irq = irq; 2448 - irq_flags = irq_get_trigger_type(irq); 2449 2428 pdata->ioaddr = ioremap_nocache(res->start, res_size); 2450 2429 2451 2430 pdata->dev = dev; ··· 2491 2472 if (retval < 0) 2492 2473 goto out_disable_resources; 2493 2474 2494 - /* configure irq polarity and type before connecting isr */ 2495 - if (pdata->config.irq_polarity == SMSC911X_IRQ_POLARITY_ACTIVE_HIGH) 2496 - intcfg |= INT_CFG_IRQ_POL_; 2497 - 2498 - if (pdata->config.irq_type == SMSC911X_IRQ_TYPE_PUSH_PULL) 2499 - intcfg |= INT_CFG_IRQ_TYPE_; 2500 - 2501 - smsc911x_reg_write(pdata, INT_CFG, intcfg); 2502 - 2503 - /* Ensure interrupts are globally disabled before connecting ISR */ 2504 - smsc911x_disable_irq_chip(dev); 2505 - 2506 - retval = request_irq(dev->irq, smsc911x_irqhandler, 2507 - irq_flags | IRQF_SHARED, dev->name, dev); 2508 - if (retval) { 2509 - SMSC_WARN(pdata, probe, 2510 - "Unable to claim requested irq: %d", dev->irq); 2511 - goto out_disable_resources; 2512 - } 2513 - 2514 2475 netif_carrier_off(dev); 2515 - 2516 - retval = register_netdev(dev); 2517 - if (retval) { 2518 - SMSC_WARN(pdata, probe, "Error %i registering device", retval); 2519 - goto out_free_irq; 2520 - } else { 2521 - SMSC_TRACE(pdata, probe, 2522 - "Network interface: \"%s\"", dev->name); 2523 - } 2524 2476 2525 2477 retval = smsc911x_mii_init(pdev, dev); 2526 2478 if (retval) { 2527 2479 SMSC_WARN(pdata, probe, "Error %i initialising mii", retval); 2528 - goto out_unregister_netdev_5; 2480 + goto out_disable_resources; 2481 + } 2482 + 2483 + retval = register_netdev(dev); 2484 + if (retval) { 2485 + SMSC_WARN(pdata, probe, "Error %i registering device", retval); 2486 + goto out_disable_resources; 2487 + } else { 2488 + SMSC_TRACE(pdata, probe, 2489 + "Network interface: \"%s\"", dev->name); 2529 2490 } 2530 2491 2531 2492 spin_lock_irq(&pdata->mac_lock); ··· 2543 2544 2544 2545 return 0; 2545 2546 2546 - out_unregister_netdev_5: 2547 - unregister_netdev(dev); 2548 - out_free_irq: 2549 - free_irq(dev->irq, dev); 2550 2547 out_disable_resources: 2551 2548 pm_runtime_put(&pdev->dev); 2552 2549 pm_runtime_disable(&pdev->dev);
+18 -20
drivers/net/ethernet/synopsys/dwc_eth_qos.c
··· 1246 1246 lp->mii_bus->read = &dwceqos_mdio_read; 1247 1247 lp->mii_bus->write = &dwceqos_mdio_write; 1248 1248 lp->mii_bus->priv = lp; 1249 - lp->mii_bus->parent = &lp->ndev->dev; 1249 + lp->mii_bus->parent = &lp->pdev->dev; 1250 1250 1251 1251 of_address_to_resource(lp->pdev->dev.of_node, 0, &res); 1252 1252 snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%.8llx", ··· 2853 2853 2854 2854 ndev->features = ndev->hw_features; 2855 2855 2856 - netif_napi_add(ndev, &lp->napi, dwceqos_rx_poll, NAPI_POLL_WEIGHT); 2857 - 2858 - ret = register_netdev(ndev); 2859 - if (ret) { 2860 - dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); 2861 - goto err_out_clk_dis_aper; 2862 - } 2863 - 2864 2856 lp->phy_ref_clk = devm_clk_get(&pdev->dev, "phy_ref_clk"); 2865 2857 if (IS_ERR(lp->phy_ref_clk)) { 2866 2858 dev_err(&pdev->dev, "phy_ref_clk clock not found.\n"); 2867 2859 ret = PTR_ERR(lp->phy_ref_clk); 2868 - goto err_out_unregister_netdev; 2860 + goto err_out_clk_dis_aper; 2869 2861 } 2870 2862 2871 2863 ret = clk_prepare_enable(lp->phy_ref_clk); 2872 2864 if (ret) { 2873 2865 dev_err(&pdev->dev, "Unable to enable device clock.\n"); 2874 - goto err_out_unregister_netdev; 2866 + goto err_out_clk_dis_aper; 2875 2867 } 2876 2868 2877 2869 lp->phy_node = of_parse_phandle(lp->pdev->dev.of_node, ··· 2872 2880 ret = of_phy_register_fixed_link(lp->pdev->dev.of_node); 2873 2881 if (ret < 0) { 2874 2882 dev_err(&pdev->dev, "invalid fixed-link"); 2875 - goto err_out_unregister_clk_notifier; 2883 + goto err_out_clk_dis_phy; 2876 2884 } 2877 2885 2878 2886 lp->phy_node = of_node_get(lp->pdev->dev.of_node); ··· 2881 2889 ret = of_get_phy_mode(lp->pdev->dev.of_node); 2882 2890 if (ret < 0) { 2883 2891 dev_err(&lp->pdev->dev, "error in getting phy i/f\n"); 2884 - goto err_out_unregister_clk_notifier; 2892 + goto err_out_clk_dis_phy; 2885 2893 } 2886 2894 2887 2895 lp->phy_interface = ret; ··· 2889 2897 ret = dwceqos_mii_init(lp); 2890 2898 if (ret) { 2891 2899 dev_err(&lp->pdev->dev, "error in dwceqos_mii_init\n"); 2892 - goto err_out_unregister_clk_notifier; 2900 + goto err_out_clk_dis_phy; 2893 2901 } 2894 2902 2895 2903 ret = dwceqos_mii_probe(ndev); 2896 2904 if (ret != 0) { 2897 2905 netdev_err(ndev, "mii_probe fail.\n"); 2898 2906 ret = -ENXIO; 2899 - goto err_out_unregister_clk_notifier; 2907 + goto err_out_clk_dis_phy; 2900 2908 } 2901 2909 2902 2910 dwceqos_set_umac_addr(lp, lp->ndev->dev_addr, 0); ··· 2914 2922 if (ret) { 2915 2923 dev_err(&lp->pdev->dev, "Unable to retrieve DT, error %d\n", 2916 2924 ret); 2917 - goto err_out_unregister_clk_notifier; 2925 + goto err_out_clk_dis_phy; 2918 2926 } 2919 2927 dev_info(&lp->pdev->dev, "pdev->id %d, baseaddr 0x%08lx, irq %d\n", 2920 2928 pdev->id, ndev->base_addr, ndev->irq); ··· 2924 2932 if (ret) { 2925 2933 dev_err(&lp->pdev->dev, "Unable to request IRQ %d, error %d\n", 2926 2934 ndev->irq, ret); 2927 - goto err_out_unregister_clk_notifier; 2935 + goto err_out_clk_dis_phy; 2928 2936 } 2929 2937 2930 2938 if (netif_msg_probe(lp)) 2931 2939 netdev_dbg(ndev, "net_local@%p\n", lp); 2932 2940 2941 + netif_napi_add(ndev, &lp->napi, dwceqos_rx_poll, NAPI_POLL_WEIGHT); 2942 + 2943 + ret = register_netdev(ndev); 2944 + if (ret) { 2945 + dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); 2946 + goto err_out_clk_dis_phy; 2947 + } 2948 + 2933 2949 return 0; 2934 2950 2935 - err_out_unregister_clk_notifier: 2951 + err_out_clk_dis_phy: 2936 2952 clk_disable_unprepare(lp->phy_ref_clk); 2937 - err_out_unregister_netdev: 2938 - unregister_netdev(ndev); 2939 2953 err_out_clk_dis_aper: 2940 2954 clk_disable_unprepare(lp->apb_pclk); 2941 2955 err_out_free_netdev:
+1
drivers/net/phy/Kconfig
··· 303 303 304 304 config MDIO_XGENE 305 305 tristate "APM X-Gene SoC MDIO bus controller" 306 + depends on ARCH_XGENE || COMPILE_TEST 306 307 help 307 308 This module provides a driver for the MDIO busses found in the 308 309 APM X-Gene SoC's.
+12 -26
drivers/net/vxlan.c
··· 2782 2782 struct net_device *lowerdev = NULL; 2783 2783 2784 2784 if (conf->flags & VXLAN_F_GPE) { 2785 - if (conf->flags & ~VXLAN_F_ALLOWED_GPE) 2786 - return -EINVAL; 2787 2785 /* For now, allow GPE only together with COLLECT_METADATA. 2788 2786 * This can be relaxed later; in such case, the other side 2789 2787 * of the PtP link will have to be provided. 2790 2788 */ 2791 - if (!(conf->flags & VXLAN_F_COLLECT_METADATA)) 2789 + if ((conf->flags & ~VXLAN_F_ALLOWED_GPE) || 2790 + !(conf->flags & VXLAN_F_COLLECT_METADATA)) { 2791 + pr_info("unsupported combination of extensions\n"); 2792 2792 return -EINVAL; 2793 + } 2793 2794 2794 2795 vxlan_raw_setup(dev); 2795 2796 } else { ··· 2843 2842 dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); 2844 2843 2845 2844 needed_headroom = lowerdev->hard_header_len; 2845 + } else if (vxlan_addr_multicast(&dst->remote_ip)) { 2846 + pr_info("multicast destination requires interface to be specified\n"); 2847 + return -EINVAL; 2846 2848 } 2847 2849 2848 2850 if (conf->mtu) { ··· 2878 2874 tmp->cfg.saddr.sa.sa_family == AF_INET6) == use_ipv6 && 2879 2875 tmp->cfg.dst_port == vxlan->cfg.dst_port && 2880 2876 (tmp->flags & VXLAN_F_RCV_FLAGS) == 2881 - (vxlan->flags & VXLAN_F_RCV_FLAGS)) 2882 - return -EEXIST; 2877 + (vxlan->flags & VXLAN_F_RCV_FLAGS)) { 2878 + pr_info("duplicate VNI %u\n", be32_to_cpu(conf->vni)); 2879 + return -EEXIST; 2880 + } 2883 2881 } 2884 2882 2885 2883 dev->ethtool_ops = &vxlan_ethtool_ops; ··· 2915 2909 struct nlattr *tb[], struct nlattr *data[]) 2916 2910 { 2917 2911 struct vxlan_config conf; 2918 - int err; 2919 2912 2920 2913 memset(&conf, 0, sizeof(conf)); 2921 2914 ··· 3023 3018 if (tb[IFLA_MTU]) 3024 3019 conf.mtu = nla_get_u32(tb[IFLA_MTU]); 3025 3020 3026 - err = vxlan_dev_configure(src_net, dev, &conf); 3027 - switch (err) { 3028 - case -ENODEV: 3029 - pr_info("ifindex %d does not exist\n", conf.remote_ifindex); 3030 - break; 3031 - 3032 - case -EPERM: 3033 - pr_info("IPv6 is disabled via sysctl\n"); 3034 - break; 3035 - 3036 - case -EEXIST: 3037 - pr_info("duplicate VNI %u\n", be32_to_cpu(conf.vni)); 3038 - break; 3039 - 3040 - case -EINVAL: 3041 - pr_info("unsupported combination of extensions\n"); 3042 - break; 3043 - } 3044 - 3045 - return err; 3021 + return vxlan_dev_configure(src_net, dev, &conf); 3046 3022 } 3047 3023 3048 3024 static void vxlan_dellink(struct net_device *dev, struct list_head *head)
+5 -5
drivers/net/wireless/ath/ath10k/htt_rx.c
··· 1525 1525 static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) 1526 1526 { 1527 1527 struct ath10k *ar = htt->ar; 1528 - static struct ieee80211_rx_status rx_status; 1528 + struct ieee80211_rx_status *rx_status = &htt->rx_status; 1529 1529 struct sk_buff_head amsdu; 1530 1530 int ret; 1531 1531 ··· 1549 1549 return ret; 1550 1550 } 1551 1551 1552 - ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff); 1552 + ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff); 1553 1553 ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0); 1554 - ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status); 1555 - ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status); 1556 - ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status); 1554 + ath10k_htt_rx_h_filter(ar, &amsdu, rx_status); 1555 + ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status); 1556 + ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status); 1557 1557 1558 1558 return 0; 1559 1559 }
-1
drivers/net/wireless/ath/ath10k/pci.c
··· 3162 3162 pci_hard_reset = ath10k_pci_qca988x_chip_reset; 3163 3163 break; 3164 3164 case QCA9887_1_0_DEVICE_ID: 3165 - dev_warn(&pdev->dev, "QCA9887 support is still experimental, there are likely bugs. You have been warned.\n"); 3166 3165 hw_rev = ATH10K_HW_QCA9887; 3167 3166 pci_ps = false; 3168 3167 pci_soft_reset = ath10k_pci_warm_reset;
+2 -2
drivers/net/wireless/ath/ath9k/hw.c
··· 2482 2482 return -EINVAL; 2483 2483 } 2484 2484 2485 + ath9k_gpio_cap_init(ah); 2486 + 2485 2487 if (AR_SREV_9485(ah) || 2486 2488 AR_SREV_9285(ah) || 2487 2489 AR_SREV_9330(ah) || ··· 2532 2530 pCap->hw_caps |= ATH9K_HW_CAP_HT; 2533 2531 else 2534 2532 pCap->hw_caps &= ~ATH9K_HW_CAP_HT; 2535 - 2536 - ath9k_gpio_cap_init(ah); 2537 2533 2538 2534 if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah)) 2539 2535 pCap->rts_aggr_limit = ATH_AMPDU_LIMIT_MAX;
+12 -6
drivers/net/wireless/ath/ath9k/main.c
··· 718 718 if (!ath_complete_reset(sc, false)) 719 719 ah->reset_power_on = false; 720 720 721 - if (ah->led_pin >= 0) 721 + if (ah->led_pin >= 0) { 722 722 ath9k_hw_set_gpio(ah, ah->led_pin, 723 723 (ah->config.led_active_high) ? 1 : 0); 724 + ath9k_hw_gpio_request_out(ah, ah->led_pin, NULL, 725 + AR_GPIO_OUTPUT_MUX_AS_OUTPUT); 726 + } 724 727 725 728 /* 726 729 * Reset key cache to sane defaults (all entries cleared) instead of ··· 867 864 868 865 spin_lock_bh(&sc->sc_pcu_lock); 869 866 870 - if (ah->led_pin >= 0) 867 + if (ah->led_pin >= 0) { 871 868 ath9k_hw_set_gpio(ah, ah->led_pin, 872 869 (ah->config.led_active_high) ? 0 : 1); 870 + ath9k_hw_gpio_request_in(ah, ah->led_pin, NULL); 871 + } 873 872 874 873 ath_prepare_reset(sc); 875 874 ··· 1159 1154 bool changed = (iter_data.primary_sta != ctx->primary_sta); 1160 1155 1161 1156 if (iter_data.primary_sta) { 1157 + iter_data.primary_beacon_vif = iter_data.primary_sta; 1162 1158 iter_data.beacons = true; 1163 1159 ath9k_set_assoc_state(sc, iter_data.primary_sta, 1164 1160 changed); ··· 1569 1563 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1570 1564 int ret = 0; 1571 1565 1572 - if (old_state == IEEE80211_STA_AUTH && 1573 - new_state == IEEE80211_STA_ASSOC) { 1566 + if (old_state == IEEE80211_STA_NOTEXIST && 1567 + new_state == IEEE80211_STA_NONE) { 1574 1568 ret = ath9k_sta_add(hw, vif, sta); 1575 1569 ath_dbg(common, CONFIG, 1576 1570 "Add station: %pM\n", sta->addr); 1577 - } else if (old_state == IEEE80211_STA_ASSOC && 1578 - new_state == IEEE80211_STA_AUTH) { 1571 + } else if (old_state == IEEE80211_STA_NONE && 1572 + new_state == IEEE80211_STA_NOTEXIST) { 1579 1573 ret = ath9k_sta_remove(hw, vif, sta); 1580 1574 ath_dbg(common, CONFIG, 1581 1575 "Remove station: %pM\n", sta->addr);
+14 -14
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
··· 4527 4527 (u8 *)&settings->beacon.head[ie_offset], 4528 4528 settings->beacon.head_len - ie_offset, 4529 4529 WLAN_EID_SSID); 4530 - if (!ssid_ie) 4530 + if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN) 4531 4531 return -EINVAL; 4532 4532 4533 4533 memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); ··· 5635 5635 ifevent->action, ifevent->flags, ifevent->ifidx, 5636 5636 ifevent->bsscfgidx); 5637 5637 5638 - mutex_lock(&event->vif_event_lock); 5638 + spin_lock(&event->vif_event_lock); 5639 5639 event->action = ifevent->action; 5640 5640 vif = event->vif; 5641 5641 ··· 5643 5643 case BRCMF_E_IF_ADD: 5644 5644 /* waiting process may have timed out */ 5645 5645 if (!cfg->vif_event.vif) { 5646 - mutex_unlock(&event->vif_event_lock); 5646 + spin_unlock(&event->vif_event_lock); 5647 5647 return -EBADF; 5648 5648 } 5649 5649 ··· 5654 5654 ifp->ndev->ieee80211_ptr = &vif->wdev; 5655 5655 SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); 5656 5656 } 5657 - mutex_unlock(&event->vif_event_lock); 5657 + spin_unlock(&event->vif_event_lock); 5658 5658 wake_up(&event->vif_wq); 5659 5659 return 0; 5660 5660 5661 5661 case BRCMF_E_IF_DEL: 5662 - mutex_unlock(&event->vif_event_lock); 5662 + spin_unlock(&event->vif_event_lock); 5663 5663 /* event may not be upon user request */ 5664 5664 if (brcmf_cfg80211_vif_event_armed(cfg)) 5665 5665 wake_up(&event->vif_wq); 5666 5666 return 0; 5667 5667 5668 5668 case BRCMF_E_IF_CHANGE: 5669 - mutex_unlock(&event->vif_event_lock); 5669 + spin_unlock(&event->vif_event_lock); 5670 5670 wake_up(&event->vif_wq); 5671 5671 return 0; 5672 5672 5673 5673 default: 5674 - mutex_unlock(&event->vif_event_lock); 5674 + spin_unlock(&event->vif_event_lock); 5675 5675 break; 5676 5676 } 5677 5677 return -EINVAL; ··· 5792 5792 static void init_vif_event(struct brcmf_cfg80211_vif_event *event) 5793 5793 { 5794 5794 init_waitqueue_head(&event->vif_wq); 5795 - mutex_init(&event->vif_event_lock); 5795 + spin_lock_init(&event->vif_event_lock); 5796 5796 } 5797 5797 5798 5798 static s32 brcmf_dongle_roam(struct brcmf_if *ifp) ··· 6691 6691 { 6692 6692 u8 evt_action; 6693 6693 6694 - mutex_lock(&event->vif_event_lock); 6694 + spin_lock(&event->vif_event_lock); 6695 6695 evt_action = event->action; 6696 - mutex_unlock(&event->vif_event_lock); 6696 + spin_unlock(&event->vif_event_lock); 6697 6697 return evt_action == action; 6698 6698 } 6699 6699 ··· 6702 6702 { 6703 6703 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; 6704 6704 6705 - mutex_lock(&event->vif_event_lock); 6705 + spin_lock(&event->vif_event_lock); 6706 6706 event->vif = vif; 6707 6707 event->action = 0; 6708 - mutex_unlock(&event->vif_event_lock); 6708 + spin_unlock(&event->vif_event_lock); 6709 6709 } 6710 6710 6711 6711 bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) ··· 6713 6713 struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; 6714 6714 bool armed; 6715 6715 6716 - mutex_lock(&event->vif_event_lock); 6716 + spin_lock(&event->vif_event_lock); 6717 6717 armed = event->vif != NULL; 6718 - mutex_unlock(&event->vif_event_lock); 6718 + spin_unlock(&event->vif_event_lock); 6719 6719 6720 6720 return armed; 6721 6721 }
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
··· 227 227 */ 228 228 struct brcmf_cfg80211_vif_event { 229 229 wait_queue_head_t vif_wq; 230 - struct mutex vif_event_lock; 230 + spinlock_t vif_event_lock; 231 231 u8 action; 232 232 struct brcmf_cfg80211_vif *vif; 233 233 };
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
··· 743 743 * serious troublesome side effects. The p2p module will clean 744 744 * up the ifp if needed. 745 745 */ 746 - brcmf_p2p_ifp_removed(ifp); 746 + brcmf_p2p_ifp_removed(ifp, rtnl_locked); 747 747 kfree(ifp); 748 748 } 749 749 }
+5 -3
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
··· 2297 2297 return err; 2298 2298 } 2299 2299 2300 - void brcmf_p2p_ifp_removed(struct brcmf_if *ifp) 2300 + void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked) 2301 2301 { 2302 2302 struct brcmf_cfg80211_info *cfg; 2303 2303 struct brcmf_cfg80211_vif *vif; ··· 2306 2306 vif = ifp->vif; 2307 2307 cfg = wdev_to_cfg(&vif->wdev); 2308 2308 cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; 2309 - rtnl_lock(); 2309 + if (!rtnl_locked) 2310 + rtnl_lock(); 2310 2311 cfg80211_unregister_wdev(&vif->wdev); 2311 - rtnl_unlock(); 2312 + if (!rtnl_locked) 2313 + rtnl_unlock(); 2312 2314 brcmf_free_vif(vif); 2313 2315 } 2314 2316
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
··· 155 155 int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev); 156 156 int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, 157 157 enum brcmf_fil_p2p_if_types if_type); 158 - void brcmf_p2p_ifp_removed(struct brcmf_if *ifp); 158 + void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked); 159 159 int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); 160 160 void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); 161 161 int brcmf_p2p_scan_prep(struct wiphy *wiphy,
+2 -1
drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
··· 960 960 } 961 961 962 962 mvm->fw_dbg_conf = conf_id; 963 - return ret; 963 + 964 + return 0; 964 965 }
+2 -1
drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h
··· 105 105 { 106 106 u32 trig_vif = le32_to_cpu(trig->vif_type); 107 107 108 - return trig_vif == IWL_FW_DBG_CONF_VIF_ANY || vif->type == trig_vif; 108 + return trig_vif == IWL_FW_DBG_CONF_VIF_ANY || 109 + ieee80211_vif_type_p2p(vif) == trig_vif; 109 110 } 110 111 111 112 static inline bool
+1
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 624 624 hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | 625 625 NL80211_FEATURE_LOW_PRIORITY_SCAN | 626 626 NL80211_FEATURE_P2P_GO_OPPPS | 627 + NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | 627 628 NL80211_FEATURE_DYNAMIC_SMPS | 628 629 NL80211_FEATURE_STATIC_SMPS | 629 630 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION;
+2
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 467 467 static inline struct iwl_mvm_vif * 468 468 iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) 469 469 { 470 + if (!vif) 471 + return NULL; 470 472 return (void *)vif->drv_priv; 471 473 } 472 474
+2 -1
drivers/net/wireless/marvell/mwifiex/11n_aggr.c
··· 205 205 206 206 do { 207 207 /* Check if AMSDU can accommodate this MSDU */ 208 - if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN)) 208 + if ((skb_aggr->len + skb_src->len + LLC_SNAP_LEN) > 209 + adapter->tx_buf_size) 209 210 break; 210 211 211 212 skb_src = skb_dequeue(&pra_list->skb_head);
+8 -1
drivers/nvme/host/pci.c
··· 1693 1693 nvme_suspend_queue(dev->queues[i]); 1694 1694 1695 1695 if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { 1696 - nvme_suspend_queue(dev->queues[0]); 1696 + /* A device might become IO incapable very soon during 1697 + * probe, before the admin queue is configured. Thus, 1698 + * queue_count can be 0 here. 1699 + */ 1700 + if (dev->queue_count) 1701 + nvme_suspend_queue(dev->queues[0]); 1697 1702 } else { 1698 1703 nvme_disable_io_queues(dev); 1699 1704 nvme_disable_admin_queue(dev, shutdown); ··· 2116 2111 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ 2117 2112 .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, 2118 2113 { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ 2114 + .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, 2115 + { PCI_DEVICE(0x1c5f, 0x0540), /* Memblaze Pblaze4 adapter */ 2119 2116 .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, 2120 2117 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, 2121 2118 { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) },
+71 -73
drivers/nvme/host/rdma.c
··· 82 82 83 83 enum nvme_rdma_queue_flags { 84 84 NVME_RDMA_Q_CONNECTED = (1 << 0), 85 + NVME_RDMA_IB_QUEUE_ALLOCATED = (1 << 1), 86 + NVME_RDMA_Q_DELETING = (1 << 2), 85 87 }; 86 88 87 89 struct nvme_rdma_queue { ··· 293 291 if (IS_ERR(req->mr)) { 294 292 ret = PTR_ERR(req->mr); 295 293 req->mr = NULL; 294 + goto out; 296 295 } 297 296 298 297 req->mr->need_inval = false; ··· 483 480 484 481 static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) 485 482 { 486 - struct nvme_rdma_device *dev = queue->device; 487 - struct ib_device *ibdev = dev->dev; 483 + struct nvme_rdma_device *dev; 484 + struct ib_device *ibdev; 488 485 486 + if (!test_and_clear_bit(NVME_RDMA_IB_QUEUE_ALLOCATED, &queue->flags)) 487 + return; 488 + 489 + dev = queue->device; 490 + ibdev = dev->dev; 489 491 rdma_destroy_qp(queue->cm_id); 490 492 ib_free_cq(queue->ib_cq); 491 493 ··· 541 533 ret = -ENOMEM; 542 534 goto out_destroy_qp; 543 535 } 536 + set_bit(NVME_RDMA_IB_QUEUE_ALLOCATED, &queue->flags); 544 537 545 538 return 0; 546 539 ··· 561 552 562 553 queue = &ctrl->queues[idx]; 563 554 queue->ctrl = ctrl; 555 + queue->flags = 0; 564 556 init_completion(&queue->cm_done); 565 557 566 558 if (idx > 0) ··· 600 590 return 0; 601 591 602 592 out_destroy_cm_id: 593 + nvme_rdma_destroy_queue_ib(queue); 603 594 rdma_destroy_id(queue->cm_id); 604 595 return ret; 605 596 } ··· 619 608 620 609 static void nvme_rdma_stop_and_free_queue(struct nvme_rdma_queue *queue) 621 610 { 622 - if (!test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) 611 + if (test_and_set_bit(NVME_RDMA_Q_DELETING, &queue->flags)) 623 612 return; 624 613 nvme_rdma_stop_queue(queue); 625 614 nvme_rdma_free_queue(queue); ··· 663 652 return 0; 664 653 665 654 out_free_queues: 666 - for (; i >= 1; i--) 655 + for (i--; i >= 1; i--) 667 656 nvme_rdma_stop_and_free_queue(&ctrl->queues[i]); 668 657 669 658 return ret; ··· 772 761 { 773 762 struct nvme_rdma_ctrl *ctrl = container_of(work, 774 763 struct nvme_rdma_ctrl, err_work); 764 + int i; 775 765 776 766 nvme_stop_keep_alive(&ctrl->ctrl); 767 + 768 + for (i = 0; i < ctrl->queue_count; i++) 769 + clear_bit(NVME_RDMA_Q_CONNECTED, &ctrl->queues[i].flags); 770 + 777 771 if (ctrl->queue_count > 1) 778 772 nvme_stop_queues(&ctrl->ctrl); 779 773 blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); ··· 1321 1305 return ret; 1322 1306 } 1323 1307 1324 - /** 1325 - * nvme_rdma_device_unplug() - Handle RDMA device unplug 1326 - * @queue: Queue that owns the cm_id that caught the event 1327 - * 1328 - * DEVICE_REMOVAL event notifies us that the RDMA device is about 1329 - * to unplug so we should take care of destroying our RDMA resources. 1330 - * This event will be generated for each allocated cm_id. 1331 - * 1332 - * In our case, the RDMA resources are managed per controller and not 1333 - * only per queue. So the way we handle this is we trigger an implicit 1334 - * controller deletion upon the first DEVICE_REMOVAL event we see, and 1335 - * hold the event inflight until the controller deletion is completed. 1336 - * 1337 - * One exception that we need to handle is the destruction of the cm_id 1338 - * that caught the event. Since we hold the callout until the controller 1339 - * deletion is completed, we'll deadlock if the controller deletion will 1340 - * call rdma_destroy_id on this queue's cm_id. Thus, we claim ownership 1341 - * of destroying this queue before-hand, destroy the queue resources, 1342 - * then queue the controller deletion which won't destroy this queue and 1343 - * we destroy the cm_id implicitely by returning a non-zero rc to the callout. 1344 - */ 1345 - static int nvme_rdma_device_unplug(struct nvme_rdma_queue *queue) 1346 - { 1347 - struct nvme_rdma_ctrl *ctrl = queue->ctrl; 1348 - int ret = 0; 1349 - 1350 - /* Own the controller deletion */ 1351 - if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING)) 1352 - return 0; 1353 - 1354 - dev_warn(ctrl->ctrl.device, 1355 - "Got rdma device removal event, deleting ctrl\n"); 1356 - 1357 - /* Get rid of reconnect work if its running */ 1358 - cancel_delayed_work_sync(&ctrl->reconnect_work); 1359 - 1360 - /* Disable the queue so ctrl delete won't free it */ 1361 - if (test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) { 1362 - /* Free this queue ourselves */ 1363 - nvme_rdma_stop_queue(queue); 1364 - nvme_rdma_destroy_queue_ib(queue); 1365 - 1366 - /* Return non-zero so the cm_id will destroy implicitly */ 1367 - ret = 1; 1368 - } 1369 - 1370 - /* Queue controller deletion */ 1371 - queue_work(nvme_rdma_wq, &ctrl->delete_work); 1372 - flush_work(&ctrl->delete_work); 1373 - return ret; 1374 - } 1375 - 1376 1308 static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, 1377 1309 struct rdma_cm_event *ev) 1378 1310 { ··· 1362 1398 nvme_rdma_error_recovery(queue->ctrl); 1363 1399 break; 1364 1400 case RDMA_CM_EVENT_DEVICE_REMOVAL: 1365 - /* return 1 means impliciy CM ID destroy */ 1366 - return nvme_rdma_device_unplug(queue); 1401 + /* device removal is handled via the ib_client API */ 1402 + break; 1367 1403 default: 1368 1404 dev_err(queue->ctrl->ctrl.device, 1369 1405 "Unexpected RDMA CM event (%d)\n", ev->event); ··· 1664 1700 static int nvme_rdma_del_ctrl(struct nvme_ctrl *nctrl) 1665 1701 { 1666 1702 struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); 1667 - int ret; 1703 + int ret = 0; 1668 1704 1705 + /* 1706 + * Keep a reference until all work is flushed since 1707 + * __nvme_rdma_del_ctrl can free the ctrl mem 1708 + */ 1709 + if (!kref_get_unless_zero(&ctrl->ctrl.kref)) 1710 + return -EBUSY; 1669 1711 ret = __nvme_rdma_del_ctrl(ctrl); 1670 - if (ret) 1671 - return ret; 1672 - 1673 - flush_work(&ctrl->delete_work); 1674 - 1675 - return 0; 1712 + if (!ret) 1713 + flush_work(&ctrl->delete_work); 1714 + nvme_put_ctrl(&ctrl->ctrl); 1715 + return ret; 1676 1716 } 1677 1717 1678 1718 static void nvme_rdma_remove_ctrl_work(struct work_struct *work) ··· 1973 2005 .create_ctrl = nvme_rdma_create_ctrl, 1974 2006 }; 1975 2007 2008 + static void nvme_rdma_add_one(struct ib_device *ib_device) 2009 + { 2010 + } 2011 + 2012 + static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data) 2013 + { 2014 + struct nvme_rdma_ctrl *ctrl; 2015 + 2016 + /* Delete all controllers using this device */ 2017 + mutex_lock(&nvme_rdma_ctrl_mutex); 2018 + list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) { 2019 + if (ctrl->device->dev != ib_device) 2020 + continue; 2021 + dev_info(ctrl->ctrl.device, 2022 + "Removing ctrl: NQN \"%s\", addr %pISp\n", 2023 + ctrl->ctrl.opts->subsysnqn, &ctrl->addr); 2024 + __nvme_rdma_del_ctrl(ctrl); 2025 + } 2026 + mutex_unlock(&nvme_rdma_ctrl_mutex); 2027 + 2028 + flush_workqueue(nvme_rdma_wq); 2029 + } 2030 + 2031 + static struct ib_client nvme_rdma_ib_client = { 2032 + .name = "nvme_rdma", 2033 + .add = nvme_rdma_add_one, 2034 + .remove = nvme_rdma_remove_one 2035 + }; 2036 + 1976 2037 static int __init nvme_rdma_init_module(void) 1977 2038 { 2039 + int ret; 2040 + 1978 2041 nvme_rdma_wq = create_workqueue("nvme_rdma_wq"); 1979 2042 if (!nvme_rdma_wq) 1980 2043 return -ENOMEM; 2044 + 2045 + ret = ib_register_client(&nvme_rdma_ib_client); 2046 + if (ret) { 2047 + destroy_workqueue(nvme_rdma_wq); 2048 + return ret; 2049 + } 1981 2050 1982 2051 nvmf_register_transport(&nvme_rdma_transport); 1983 2052 return 0; ··· 2022 2017 2023 2018 static void __exit nvme_rdma_cleanup_module(void) 2024 2019 { 2025 - struct nvme_rdma_ctrl *ctrl; 2026 - 2027 2020 nvmf_unregister_transport(&nvme_rdma_transport); 2028 - 2029 - mutex_lock(&nvme_rdma_ctrl_mutex); 2030 - list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) 2031 - __nvme_rdma_del_ctrl(ctrl); 2032 - mutex_unlock(&nvme_rdma_ctrl_mutex); 2033 - 2021 + ib_unregister_client(&nvme_rdma_ib_client); 2034 2022 destroy_workqueue(nvme_rdma_wq); 2035 2023 } 2036 2024
+1 -2
drivers/pci/remove.c
··· 40 40 list_del(&dev->bus_list); 41 41 up_write(&pci_bus_sem); 42 42 43 + pci_bridge_d3_device_removed(dev); 43 44 pci_free_resources(dev); 44 45 put_device(&dev->dev); 45 46 } ··· 96 95 pci_remove_bus(bus); 97 96 dev->subordinate = NULL; 98 97 } 99 - 100 - pci_bridge_d3_device_removed(dev); 101 98 102 99 pci_destroy_dev(dev); 103 100 }
+7 -5
drivers/pcmcia/ds.c
··· 977 977 978 978 /************************ runtime PM support ***************************/ 979 979 980 - static int pcmcia_dev_suspend(struct device *dev, pm_message_t state); 980 + static int pcmcia_dev_suspend(struct device *dev); 981 981 static int pcmcia_dev_resume(struct device *dev); 982 982 983 983 static int runtime_suspend(struct device *dev) ··· 985 985 int rc; 986 986 987 987 device_lock(dev); 988 - rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND); 988 + rc = pcmcia_dev_suspend(dev); 989 989 device_unlock(dev); 990 990 return rc; 991 991 } ··· 1135 1135 1136 1136 /* PM support, also needed for reset */ 1137 1137 1138 - static int pcmcia_dev_suspend(struct device *dev, pm_message_t state) 1138 + static int pcmcia_dev_suspend(struct device *dev) 1139 1139 { 1140 1140 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1141 1141 struct pcmcia_driver *p_drv = NULL; ··· 1410 1410 .remove_dev = &pcmcia_bus_remove_socket, 1411 1411 }; 1412 1412 1413 + static const struct dev_pm_ops pcmcia_bus_pm_ops = { 1414 + SET_SYSTEM_SLEEP_PM_OPS(pcmcia_dev_suspend, pcmcia_dev_resume) 1415 + }; 1413 1416 1414 1417 struct bus_type pcmcia_bus_type = { 1415 1418 .name = "pcmcia", ··· 1421 1418 .dev_groups = pcmcia_dev_groups, 1422 1419 .probe = pcmcia_device_probe, 1423 1420 .remove = pcmcia_device_remove, 1424 - .suspend = pcmcia_dev_suspend, 1425 - .resume = pcmcia_dev_resume, 1421 + .pm = &pcmcia_bus_pm_ops, 1426 1422 }; 1427 1423 1428 1424
+5 -4
drivers/pcmcia/pxa2xx_base.c
··· 214 214 } 215 215 #endif 216 216 217 - void pxa2xx_configure_sockets(struct device *dev) 217 + void pxa2xx_configure_sockets(struct device *dev, struct pcmcia_low_level *ops) 218 218 { 219 - struct pcmcia_low_level *ops = dev->platform_data; 220 219 /* 221 220 * We have at least one socket, so set MECR:CIT 222 221 * (Card Is There) ··· 321 322 goto err1; 322 323 } 323 324 324 - pxa2xx_configure_sockets(&dev->dev); 325 + pxa2xx_configure_sockets(&dev->dev, ops); 325 326 dev_set_drvdata(&dev->dev, sinfo); 326 327 327 328 return 0; ··· 347 348 348 349 static int pxa2xx_drv_pcmcia_resume(struct device *dev) 349 350 { 350 - pxa2xx_configure_sockets(dev); 351 + struct pcmcia_low_level *ops = (struct pcmcia_low_level *)dev->platform_data; 352 + 353 + pxa2xx_configure_sockets(dev, ops); 351 354 return 0; 352 355 } 353 356
+1 -1
drivers/pcmcia/pxa2xx_base.h
··· 1 1 int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); 2 2 void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); 3 - void pxa2xx_configure_sockets(struct device *dev); 3 + void pxa2xx_configure_sockets(struct device *dev, struct pcmcia_low_level *ops); 4 4
+7 -13
drivers/pcmcia/sa1111_badge4.c
··· 134 134 135 135 int pcmcia_badge4_init(struct sa1111_dev *dev) 136 136 { 137 - int ret = -ENODEV; 137 + printk(KERN_INFO 138 + "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", 139 + __func__, 140 + badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); 138 141 139 - if (machine_is_badge4()) { 140 - printk(KERN_INFO 141 - "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", 142 - __func__, 143 - badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); 144 - 145 - sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); 146 - ret = sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, 147 - sa11xx_drv_pcmcia_add_one); 148 - } 149 - 150 - return ret; 142 + sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); 143 + return sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, 144 + sa11xx_drv_pcmcia_add_one); 151 145 } 152 146 153 147 static int __init pcmv_setup(char *s)
+17 -5
drivers/pcmcia/sa1111_generic.c
··· 18 18 19 19 #include <mach/hardware.h> 20 20 #include <asm/hardware/sa1111.h> 21 + #include <asm/mach-types.h> 21 22 #include <asm/irq.h> 22 23 23 24 #include "sa1111_generic.h" ··· 204 203 sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR); 205 204 sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR); 206 205 206 + ret = -ENODEV; 207 207 #ifdef CONFIG_SA1100_BADGE4 208 - pcmcia_badge4_init(dev); 208 + if (machine_is_badge4()) 209 + ret = pcmcia_badge4_init(dev); 209 210 #endif 210 211 #ifdef CONFIG_SA1100_JORNADA720 211 - pcmcia_jornada720_init(dev); 212 + if (machine_is_jornada720()) 213 + ret = pcmcia_jornada720_init(dev); 212 214 #endif 213 215 #ifdef CONFIG_ARCH_LUBBOCK 214 - pcmcia_lubbock_init(dev); 216 + if (machine_is_lubbock()) 217 + ret = pcmcia_lubbock_init(dev); 215 218 #endif 216 219 #ifdef CONFIG_ASSABET_NEPONSET 217 - pcmcia_neponset_init(dev); 220 + if (machine_is_assabet()) 221 + ret = pcmcia_neponset_init(dev); 218 222 #endif 219 - return 0; 223 + 224 + if (ret) { 225 + release_mem_region(dev->res.start, 512); 226 + sa1111_disable_device(dev); 227 + } 228 + 229 + return ret; 220 230 } 221 231 222 232 static int pcmcia_remove(struct sa1111_dev *dev)
+10 -15
drivers/pcmcia/sa1111_jornada720.c
··· 94 94 95 95 int pcmcia_jornada720_init(struct sa1111_dev *sadev) 96 96 { 97 - int ret = -ENODEV; 97 + unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; 98 98 99 - if (machine_is_jornada720()) { 100 - unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; 99 + /* Fixme: why messing around with SA11x0's GPIO1? */ 100 + GRER |= 0x00000002; 101 101 102 - GRER |= 0x00000002; 102 + /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ 103 + sa1111_set_io_dir(sadev, pin, 0, 0); 104 + sa1111_set_io(sadev, pin, 0); 105 + sa1111_set_sleep_io(sadev, pin, 0); 103 106 104 - /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ 105 - sa1111_set_io_dir(sadev, pin, 0, 0); 106 - sa1111_set_io(sadev, pin, 0); 107 - sa1111_set_sleep_io(sadev, pin, 0); 108 - 109 - sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); 110 - ret = sa1111_pcmcia_add(sadev, &jornada720_pcmcia_ops, 111 - sa11xx_drv_pcmcia_add_one); 112 - } 113 - 114 - return ret; 107 + sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); 108 + return sa1111_pcmcia_add(sadev, &jornada720_pcmcia_ops, 109 + sa11xx_drv_pcmcia_add_one); 115 110 }
+13 -19
drivers/pcmcia/sa1111_lubbock.c
··· 210 210 211 211 int pcmcia_lubbock_init(struct sa1111_dev *sadev) 212 212 { 213 - int ret = -ENODEV; 213 + /* 214 + * Set GPIO_A<3:0> to be outputs for the MAX1600, 215 + * and switch to standby mode. 216 + */ 217 + sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); 218 + sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 219 + sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 214 220 215 - if (machine_is_lubbock()) { 216 - /* 217 - * Set GPIO_A<3:0> to be outputs for the MAX1600, 218 - * and switch to standby mode. 219 - */ 220 - sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); 221 - sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 222 - sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 221 + /* Set CF Socket 1 power to standby mode. */ 222 + lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); 223 223 224 - /* Set CF Socket 1 power to standby mode. */ 225 - lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); 226 - 227 - pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); 228 - pxa2xx_configure_sockets(&sadev->dev); 229 - ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, 230 - pxa2xx_drv_pcmcia_add_one); 231 - } 232 - 233 - return ret; 224 + pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); 225 + pxa2xx_configure_sockets(&sadev->dev, &lubbock_pcmcia_ops); 226 + return sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, 227 + pxa2xx_drv_pcmcia_add_one); 234 228 } 235 229 236 230 MODULE_LICENSE("GPL");
+10 -16
drivers/pcmcia/sa1111_neponset.c
··· 110 110 111 111 int pcmcia_neponset_init(struct sa1111_dev *sadev) 112 112 { 113 - int ret = -ENODEV; 114 - 115 - if (machine_is_assabet()) { 116 - /* 117 - * Set GPIO_A<3:0> to be outputs for the MAX1600, 118 - * and switch to standby mode. 119 - */ 120 - sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); 121 - sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 122 - sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 123 - sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); 124 - ret = sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, 125 - sa11xx_drv_pcmcia_add_one); 126 - } 127 - 128 - return ret; 113 + /* 114 + * Set GPIO_A<3:0> to be outputs for the MAX1600, 115 + * and switch to standby mode. 116 + */ 117 + sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); 118 + sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 119 + sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 120 + sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); 121 + return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, 122 + sa11xx_drv_pcmcia_add_one); 129 123 }
+4 -4
drivers/pcmcia/sa11xx_base.c
··· 144 144 sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) 145 145 { 146 146 struct soc_pcmcia_timing timing; 147 - unsigned int clock = clk_get_rate(skt->clk); 147 + unsigned int clock = clk_get_rate(skt->clk) / 1000; 148 148 unsigned long mecr = MECR; 149 149 char *p = buf; 150 150 151 151 soc_common_pcmcia_get_timing(skt, &timing); 152 152 153 - p+=sprintf(p, "I/O : %u (%u)\n", timing.io, 153 + p+=sprintf(p, "I/O : %uns (%uns)\n", timing.io, 154 154 sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr))); 155 155 156 - p+=sprintf(p, "attribute: %u (%u)\n", timing.attr, 156 + p+=sprintf(p, "attribute: %uns (%uns)\n", timing.attr, 157 157 sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr))); 158 158 159 - p+=sprintf(p, "common : %u (%u)\n", timing.mem, 159 + p+=sprintf(p, "common : %uns (%uns)\n", timing.mem, 160 160 sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr))); 161 161 162 162 return p - buf;
+1 -1
drivers/pcmcia/soc_common.c
··· 235 235 stat |= skt->cs_state.Vcc ? SS_POWERON : 0; 236 236 237 237 if (skt->cs_state.flags & SS_IOCARD) 238 - stat |= state.bvd1 ? SS_STSCHG : 0; 238 + stat |= state.bvd1 ? 0 : SS_STSCHG; 239 239 else { 240 240 if (state.bvd1 == 0) 241 241 stat |= SS_BATDEAD;
+17 -11
drivers/usb/core/config.c
··· 240 240 memcpy(&endpoint->desc, d, n); 241 241 INIT_LIST_HEAD(&endpoint->urb_list); 242 242 243 - /* Fix up bInterval values outside the legal range. Use 32 ms if no 244 - * proper value can be guessed. */ 243 + /* 244 + * Fix up bInterval values outside the legal range. 245 + * Use 10 or 8 ms if no proper value can be guessed. 246 + */ 245 247 i = 0; /* i = min, j = max, n = default */ 246 248 j = 255; 247 249 if (usb_endpoint_xfer_int(d)) { ··· 252 250 case USB_SPEED_SUPER_PLUS: 253 251 case USB_SPEED_SUPER: 254 252 case USB_SPEED_HIGH: 255 - /* Many device manufacturers are using full-speed 253 + /* 254 + * Many device manufacturers are using full-speed 256 255 * bInterval values in high-speed interrupt endpoint 257 - * descriptors. Try to fix those and fall back to a 258 - * 32 ms default value otherwise. */ 256 + * descriptors. Try to fix those and fall back to an 257 + * 8-ms default value otherwise. 258 + */ 259 259 n = fls(d->bInterval*8); 260 260 if (n == 0) 261 - n = 9; /* 32 ms = 2^(9-1) uframes */ 261 + n = 7; /* 8 ms = 2^(7-1) uframes */ 262 262 j = 16; 263 263 264 264 /* ··· 275 271 } 276 272 break; 277 273 default: /* USB_SPEED_FULL or _LOW */ 278 - /* For low-speed, 10 ms is the official minimum. 274 + /* 275 + * For low-speed, 10 ms is the official minimum. 279 276 * But some "overclocked" devices might want faster 280 - * polling so we'll allow it. */ 281 - n = 32; 277 + * polling so we'll allow it. 278 + */ 279 + n = 10; 282 280 break; 283 281 } 284 282 } else if (usb_endpoint_xfer_isoc(d)) { ··· 288 282 j = 16; 289 283 switch (to_usb_device(ddev)->speed) { 290 284 case USB_SPEED_HIGH: 291 - n = 9; /* 32 ms = 2^(9-1) uframes */ 285 + n = 7; /* 8 ms = 2^(7-1) uframes */ 292 286 break; 293 287 default: /* USB_SPEED_FULL */ 294 - n = 6; /* 32 ms = 2^(6-1) frames */ 288 + n = 4; /* 8 ms = 2^(4-1) frames */ 295 289 break; 296 290 } 297 291 }
+1 -1
drivers/usb/musb/Kconfig
··· 87 87 config USB_MUSB_TUSB6010 88 88 tristate "TUSB6010" 89 89 depends on HAS_IOMEM 90 - depends on ARCH_OMAP2PLUS || COMPILE_TEST 90 + depends on (ARCH_OMAP2PLUS || COMPILE_TEST) && !BLACKFIN 91 91 depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules 92 92 93 93 config USB_MUSB_OMAP2PLUS
+2 -1
drivers/usb/serial/usb-serial-simple.c
··· 54 54 /* Infineon Flashloader driver */ 55 55 #define FLASHLOADER_IDS() \ 56 56 { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \ 57 - { USB_DEVICE(0x8087, 0x0716) } 57 + { USB_DEVICE(0x8087, 0x0716) }, \ 58 + { USB_DEVICE(0x8087, 0x0801) } 58 59 DEVICE(flashloader, FLASHLOADER_IDS); 59 60 60 61 /* Google Serial USB SubClass */
+6 -1
fs/aio.c
··· 239 239 static const struct dentry_operations ops = { 240 240 .d_dname = simple_dname, 241 241 }; 242 - return mount_pseudo(fs_type, "aio:", NULL, &ops, AIO_RING_MAGIC); 242 + struct dentry *root = mount_pseudo(fs_type, "aio:", NULL, &ops, 243 + AIO_RING_MAGIC); 244 + 245 + if (!IS_ERR(root)) 246 + root->d_sb->s_iflags |= SB_I_NOEXEC; 247 + return root; 243 248 } 244 249 245 250 /* aio_setup
+12 -17
fs/cifs/cifsfs.c
··· 609 609 char *s, *p; 610 610 char sep; 611 611 612 + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) 613 + return dget(sb->s_root); 614 + 612 615 full_path = cifs_build_path_to_root(vol, cifs_sb, 613 616 cifs_sb_master_tcon(cifs_sb)); 614 617 if (full_path == NULL) ··· 689 686 cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); 690 687 if (cifs_sb->mountdata == NULL) { 691 688 root = ERR_PTR(-ENOMEM); 692 - goto out_cifs_sb; 689 + goto out_free; 693 690 } 694 691 695 - if (volume_info->prepath) { 696 - cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL); 697 - if (cifs_sb->prepath == NULL) { 698 - root = ERR_PTR(-ENOMEM); 699 - goto out_cifs_sb; 700 - } 692 + rc = cifs_setup_cifs_sb(volume_info, cifs_sb); 693 + if (rc) { 694 + root = ERR_PTR(rc); 695 + goto out_free; 701 696 } 702 - 703 - cifs_setup_cifs_sb(volume_info, cifs_sb); 704 697 705 698 rc = cifs_mount(cifs_sb, volume_info); 706 699 if (rc) { ··· 704 705 cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", 705 706 rc); 706 707 root = ERR_PTR(rc); 707 - goto out_mountdata; 708 + goto out_free; 708 709 } 709 710 710 711 mnt_data.vol = volume_info; ··· 734 735 sb->s_flags |= MS_ACTIVE; 735 736 } 736 737 737 - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) 738 - root = dget(sb->s_root); 739 - else 740 - root = cifs_get_root(volume_info, sb); 741 - 738 + root = cifs_get_root(volume_info, sb); 742 739 if (IS_ERR(root)) 743 740 goto out_super; 744 741 ··· 747 752 cifs_cleanup_volume_info(volume_info); 748 753 return root; 749 754 750 - out_mountdata: 755 + out_free: 756 + kfree(cifs_sb->prepath); 751 757 kfree(cifs_sb->mountdata); 752 - out_cifs_sb: 753 758 kfree(cifs_sb); 754 759 out_nls: 755 760 unload_nls(volume_info->local_nls);
+1 -1
fs/cifs/cifsproto.h
··· 184 184 unsigned int to_read); 185 185 extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, 186 186 struct page *page, unsigned int to_read); 187 - extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 187 + extern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 188 188 struct cifs_sb_info *cifs_sb); 189 189 extern int cifs_match_super(struct super_block *, void *); 190 190 extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info);
+29 -2
fs/cifs/connect.c
··· 2781 2781 return 1; 2782 2782 } 2783 2783 2784 + static int 2785 + match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data) 2786 + { 2787 + struct cifs_sb_info *old = CIFS_SB(sb); 2788 + struct cifs_sb_info *new = mnt_data->cifs_sb; 2789 + 2790 + if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) { 2791 + if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)) 2792 + return 0; 2793 + /* The prepath should be null terminated strings */ 2794 + if (strcmp(new->prepath, old->prepath)) 2795 + return 0; 2796 + 2797 + return 1; 2798 + } 2799 + return 0; 2800 + } 2801 + 2784 2802 int 2785 2803 cifs_match_super(struct super_block *sb, void *data) 2786 2804 { ··· 2826 2808 2827 2809 if (!match_server(tcp_srv, volume_info) || 2828 2810 !match_session(ses, volume_info) || 2829 - !match_tcon(tcon, volume_info->UNC)) { 2811 + !match_tcon(tcon, volume_info->UNC) || 2812 + !match_prepath(sb, mnt_data)) { 2830 2813 rc = 0; 2831 2814 goto out; 2832 2815 } ··· 3241 3222 } 3242 3223 } 3243 3224 3244 - void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 3225 + int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 3245 3226 struct cifs_sb_info *cifs_sb) 3246 3227 { 3247 3228 INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); ··· 3335 3316 3336 3317 if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) 3337 3318 cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); 3319 + 3320 + if (pvolume_info->prepath) { 3321 + cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL); 3322 + if (cifs_sb->prepath == NULL) 3323 + return -ENOMEM; 3324 + } 3325 + 3326 + return 0; 3338 3327 } 3339 3328 3340 3329 static void
+5 -1
fs/ioctl.c
··· 568 568 return thaw_super(sb); 569 569 } 570 570 571 - static long ioctl_file_dedupe_range(struct file *file, void __user *arg) 571 + static int ioctl_file_dedupe_range(struct file *file, void __user *arg) 572 572 { 573 573 struct file_dedupe_range __user *argp = arg; 574 574 struct file_dedupe_range *same = NULL; ··· 582 582 } 583 583 584 584 size = offsetof(struct file_dedupe_range __user, info[count]); 585 + if (size > PAGE_SIZE) { 586 + ret = -ENOMEM; 587 + goto out; 588 + } 585 589 586 590 same = memdup_user(argp, size); 587 591 if (IS_ERR(same)) {
+4 -1
fs/nfs/file.c
··· 657 657 if (result <= 0) 658 658 goto out; 659 659 660 - written = generic_write_sync(iocb, result); 660 + result = generic_write_sync(iocb, result); 661 + if (result < 0) 662 + goto out; 663 + written = result; 661 664 iocb->ki_pos += written; 662 665 663 666 /* Return error values */
+16 -5
fs/nfs/nfs4proc.c
··· 7570 7570 status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); 7571 7571 trace_nfs4_create_session(clp, status); 7572 7572 7573 + switch (status) { 7574 + case -NFS4ERR_STALE_CLIENTID: 7575 + case -NFS4ERR_DELAY: 7576 + case -ETIMEDOUT: 7577 + case -EACCES: 7578 + case -EAGAIN: 7579 + goto out; 7580 + }; 7581 + 7582 + clp->cl_seqid++; 7573 7583 if (!status) { 7574 7584 /* Verify the session's negotiated channel_attrs values */ 7575 7585 status = nfs4_verify_channel_attrs(&args, &res); 7576 7586 /* Increment the clientid slot sequence id */ 7577 - if (clp->cl_seqid == res.seqid) 7578 - clp->cl_seqid++; 7579 7587 if (status) 7580 7588 goto out; 7581 7589 nfs4_update_session(session, &res); ··· 8198 8190 8199 8191 dprintk("--> %s\n", __func__); 8200 8192 spin_lock(&lo->plh_inode->i_lock); 8201 - pnfs_mark_matching_lsegs_invalid(lo, &freeme, &lrp->args.range, 8202 - be32_to_cpu(lrp->args.stateid.seqid)); 8203 - if (lrp->res.lrs_present && pnfs_layout_is_valid(lo)) 8193 + if (lrp->res.lrs_present) { 8194 + pnfs_mark_matching_lsegs_invalid(lo, &freeme, 8195 + &lrp->args.range, 8196 + be32_to_cpu(lrp->args.stateid.seqid)); 8204 8197 pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); 8198 + } else 8199 + pnfs_mark_layout_stateid_invalid(lo, &freeme); 8205 8200 pnfs_clear_layoutreturn_waitbit(lo); 8206 8201 spin_unlock(&lo->plh_inode->i_lock); 8207 8202 nfs4_sequence_free_slot(&lrp->res.seq_res);
+24 -18
fs/nfs/pnfs.c
··· 365 365 /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */ 366 366 atomic_dec(&lo->plh_refcount); 367 367 if (list_empty(&lo->plh_segs)) { 368 - set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); 368 + if (atomic_read(&lo->plh_outstanding) == 0) 369 + set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); 369 370 clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); 370 371 } 371 372 rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); ··· 769 768 pnfs_destroy_layouts_byclid(clp, false); 770 769 } 771 770 771 + static void 772 + pnfs_clear_layoutreturn_info(struct pnfs_layout_hdr *lo) 773 + { 774 + lo->plh_return_iomode = 0; 775 + lo->plh_return_seq = 0; 776 + clear_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags); 777 + } 778 + 772 779 /* update lo->plh_stateid with new if is more recent */ 773 780 void 774 781 pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, 775 782 bool update_barrier) 776 783 { 777 784 u32 oldseq, newseq, new_barrier = 0; 778 - bool invalid = !pnfs_layout_is_valid(lo); 779 785 780 786 oldseq = be32_to_cpu(lo->plh_stateid.seqid); 781 787 newseq = be32_to_cpu(new->seqid); 782 - if (invalid || pnfs_seqid_is_newer(newseq, oldseq)) { 788 + 789 + if (!pnfs_layout_is_valid(lo)) { 790 + nfs4_stateid_copy(&lo->plh_stateid, new); 791 + lo->plh_barrier = newseq; 792 + pnfs_clear_layoutreturn_info(lo); 793 + clear_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); 794 + return; 795 + } 796 + if (pnfs_seqid_is_newer(newseq, oldseq)) { 783 797 nfs4_stateid_copy(&lo->plh_stateid, new); 784 798 /* 785 799 * Because of wraparound, we want to keep the barrier ··· 806 790 new_barrier = be32_to_cpu(new->seqid); 807 791 else if (new_barrier == 0) 808 792 return; 809 - if (invalid || pnfs_seqid_is_newer(new_barrier, lo->plh_barrier)) 793 + if (pnfs_seqid_is_newer(new_barrier, lo->plh_barrier)) 810 794 lo->plh_barrier = new_barrier; 811 795 } 812 796 ··· 902 886 rpc_wake_up(&NFS_SERVER(lo->plh_inode)->roc_rpcwaitq); 903 887 } 904 888 905 - static void 906 - pnfs_clear_layoutreturn_info(struct pnfs_layout_hdr *lo) 907 - { 908 - lo->plh_return_iomode = 0; 909 - lo->plh_return_seq = 0; 910 - clear_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags); 911 - } 912 - 913 889 static bool 914 890 pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo, 915 891 nfs4_stateid *stateid, 916 892 enum pnfs_iomode *iomode) 917 893 { 894 + /* Serialise LAYOUTGET/LAYOUTRETURN */ 895 + if (atomic_read(&lo->plh_outstanding) != 0) 896 + return false; 918 897 if (test_and_set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) 919 898 return false; 920 899 pnfs_get_layout_hdr(lo); ··· 1809 1798 */ 1810 1799 pnfs_mark_layout_stateid_invalid(lo, &free_me); 1811 1800 1812 - nfs4_stateid_copy(&lo->plh_stateid, &res->stateid); 1813 - lo->plh_barrier = be32_to_cpu(res->stateid.seqid); 1801 + pnfs_set_layout_stateid(lo, &res->stateid, true); 1814 1802 } 1815 1803 1816 1804 pnfs_get_lseg(lseg); 1817 1805 pnfs_layout_insert_lseg(lo, lseg, &free_me); 1818 - if (!pnfs_layout_is_valid(lo)) { 1819 - pnfs_clear_layoutreturn_info(lo); 1820 - clear_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); 1821 - } 1822 1806 1823 1807 1824 1808 if (res->return_on_close)
+13 -7
include/asm-generic/uaccess.h
··· 231 231 might_fault(); \ 232 232 access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ 233 233 __get_user((x), (__typeof__(*(ptr)) *)__p) : \ 234 - -EFAULT; \ 234 + ((x) = (__typeof__(*(ptr)))0,-EFAULT); \ 235 235 }) 236 236 237 237 #ifndef __get_user_fn 238 238 static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) 239 239 { 240 - size = __copy_from_user(x, ptr, size); 241 - return size ? -EFAULT : size; 240 + size_t n = __copy_from_user(x, ptr, size); 241 + if (unlikely(n)) { 242 + memset(x + (size - n), 0, n); 243 + return -EFAULT; 244 + } 245 + return 0; 242 246 } 243 247 244 248 #define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k) ··· 262 258 static inline long copy_from_user(void *to, 263 259 const void __user * from, unsigned long n) 264 260 { 261 + unsigned long res = n; 265 262 might_fault(); 266 - if (access_ok(VERIFY_READ, from, n)) 267 - return __copy_from_user(to, from, n); 268 - else 269 - return n; 263 + if (likely(access_ok(VERIFY_READ, from, n))) 264 + res = __copy_from_user(to, from, n); 265 + if (unlikely(res)) 266 + memset(to + (n - res), 0, res); 267 + return res; 270 268 } 271 269 272 270 static inline long copy_to_user(void __user *to,
+4 -3
include/linux/compiler.h
··· 527 527 * object's lifetime is managed by something other than RCU. That 528 528 * "something other" might be reference counting or simple immortality. 529 529 * 530 - * The seemingly unused size_t variable is to validate @p is indeed a pointer 531 - * type by making sure it can be dereferenced. 530 + * The seemingly unused variable ___typecheck_p validates that @p is 531 + * indeed a pointer type by using a pointer to typeof(*p) as the type. 532 + * Taking a pointer to typeof(*p) again is needed in case p is void *. 532 533 */ 533 534 #define lockless_dereference(p) \ 534 535 ({ \ 535 536 typeof(p) _________p1 = READ_ONCE(p); \ 536 - size_t __maybe_unused __size_of_ptr = sizeof(*(p)); \ 537 + typeof(*(p)) *___typecheck_p __maybe_unused; \ 537 538 smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ 538 539 (_________p1); \ 539 540 })
+2
include/linux/cpuhotplug.h
··· 1 1 #ifndef __CPUHOTPLUG_H 2 2 #define __CPUHOTPLUG_H 3 3 4 + #include <linux/types.h> 5 + 4 6 enum cpuhp_state { 5 7 CPUHP_OFFLINE, 6 8 CPUHP_CREATE_THREADS,
+21 -6
include/linux/efi.h
··· 118 118 u32 imagesize; 119 119 } efi_capsule_header_t; 120 120 121 + struct efi_boot_memmap { 122 + efi_memory_desc_t **map; 123 + unsigned long *map_size; 124 + unsigned long *desc_size; 125 + u32 *desc_ver; 126 + unsigned long *key_ptr; 127 + unsigned long *buff_size; 128 + }; 129 + 121 130 /* 122 131 * EFI capsule flags 123 132 */ ··· 955 946 /* Iterate through an efi_memory_map */ 956 947 #define for_each_efi_memory_desc_in_map(m, md) \ 957 948 for ((md) = (m)->map; \ 958 - ((void *)(md) + (m)->desc_size) <= (m)->map_end; \ 949 + (md) && ((void *)(md) + (m)->desc_size) <= (m)->map_end; \ 959 950 (md) = (void *)(md) + (m)->desc_size) 960 951 961 952 /** ··· 1380 1371 efi_loaded_image_t *image, int *cmd_line_len); 1381 1372 1382 1373 efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, 1383 - efi_memory_desc_t **map, 1384 - unsigned long *map_size, 1385 - unsigned long *desc_size, 1386 - u32 *desc_ver, 1387 - unsigned long *key_ptr); 1374 + struct efi_boot_memmap *map); 1388 1375 1389 1376 efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, 1390 1377 unsigned long size, unsigned long align, ··· 1462 1457 arch_efi_call_virt_teardown(); \ 1463 1458 }) 1464 1459 1460 + typedef efi_status_t (*efi_exit_boot_map_processing)( 1461 + efi_system_table_t *sys_table_arg, 1462 + struct efi_boot_memmap *map, 1463 + void *priv); 1464 + 1465 + efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table, 1466 + void *handle, 1467 + struct efi_boot_memmap *map, 1468 + void *priv, 1469 + efi_exit_boot_map_processing priv_func); 1465 1470 #endif /* _LINUX_EFI_H */
+10
include/linux/irq.h
··· 945 945 static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } 946 946 #endif 947 947 948 + /* 949 + * The irqsave variants are for usage in non interrupt code. Do not use 950 + * them in irq_chip callbacks. Use irq_gc_lock() instead. 951 + */ 952 + #define irq_gc_lock_irqsave(gc, flags) \ 953 + raw_spin_lock_irqsave(&(gc)->lock, flags) 954 + 955 + #define irq_gc_unlock_irqrestore(gc, flags) \ 956 + raw_spin_unlock_irqrestore(&(gc)->lock, flags) 957 + 948 958 static inline void irq_reg_writel(struct irq_chip_generic *gc, 949 959 u32 val, int reg_offset) 950 960 {
+3 -2
include/linux/mlx5/mlx5_ifc.h
··· 6710 6710 }; 6711 6711 6712 6712 struct mlx5_ifc_ptys_reg_bits { 6713 - u8 an_disable_cap[0x1]; 6713 + u8 reserved_at_0[0x1]; 6714 6714 u8 an_disable_admin[0x1]; 6715 - u8 reserved_at_2[0x6]; 6715 + u8 an_disable_cap[0x1]; 6716 + u8 reserved_at_3[0x5]; 6716 6717 u8 local_port[0x8]; 6717 6718 u8 reserved_at_10[0xd]; 6718 6719 u8 proto_mask[0x3];
+1
include/linux/netdevice.h
··· 3267 3267 napi->skb = NULL; 3268 3268 } 3269 3269 3270 + bool netdev_is_rx_handler_busy(struct net_device *dev); 3270 3271 int netdev_rx_handler_register(struct net_device *dev, 3271 3272 rx_handler_func_t *rx_handler, 3272 3273 void *rx_handler_data);
+1 -1
include/linux/uio.h
··· 76 76 struct iov_iter *i, unsigned long offset, size_t bytes); 77 77 void iov_iter_advance(struct iov_iter *i, size_t bytes); 78 78 int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); 79 - int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes); 79 + #define iov_iter_fault_in_multipages_readable iov_iter_fault_in_readable 80 80 size_t iov_iter_single_seg_count(const struct iov_iter *i); 81 81 size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, 82 82 struct iov_iter *i);
+1 -1
include/net/af_unix.h
··· 52 52 struct sock sk; 53 53 struct unix_address *addr; 54 54 struct path path; 55 - struct mutex readlock; 55 + struct mutex iolock, bindlock; 56 56 struct sock *peer; 57 57 struct list_head link; 58 58 atomic_long_t inflight;
+9
include/net/cfg80211.h
··· 1102 1102 struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; 1103 1103 }; 1104 1104 1105 + #if IS_ENABLED(CONFIG_CFG80211) 1105 1106 /** 1106 1107 * cfg80211_get_station - retrieve information about a given station 1107 1108 * @dev: the device where the station is supposed to be connected to ··· 1115 1114 */ 1116 1115 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, 1117 1116 struct station_info *sinfo); 1117 + #else 1118 + static inline int cfg80211_get_station(struct net_device *dev, 1119 + const u8 *mac_addr, 1120 + struct station_info *sinfo) 1121 + { 1122 + return -ENOENT; 1123 + } 1124 + #endif 1118 1125 1119 1126 /** 1120 1127 * enum monitor_flags - monitor flags
+2 -1
include/net/ip_fib.h
··· 111 111 unsigned char fib_scope; 112 112 unsigned char fib_type; 113 113 __be32 fib_prefsrc; 114 + u32 fib_tb_id; 114 115 u32 fib_priority; 115 116 u32 *fib_metrics; 116 117 #define fib_mtu fib_metrics[RTAX_MTU-1] ··· 320 319 /* Exported by fib_semantics.c */ 321 320 int ip_fib_check_default(__be32 gw, struct net_device *dev); 322 321 int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); 323 - int fib_sync_down_addr(struct net *net, __be32 local); 322 + int fib_sync_down_addr(struct net_device *dev, __be32 local); 324 323 int fib_sync_up(struct net_device *dev, unsigned int nh_flags); 325 324 326 325 extern u32 fib_multipath_secret __read_mostly;
+4
include/net/netfilter/nft_meta.h
··· 36 36 void nft_meta_set_destroy(const struct nft_ctx *ctx, 37 37 const struct nft_expr *expr); 38 38 39 + int nft_meta_set_validate(const struct nft_ctx *ctx, 40 + const struct nft_expr *expr, 41 + const struct nft_data **data); 42 + 39 43 #endif
+4
include/net/netfilter/nft_reject.h
··· 8 8 9 9 extern const struct nla_policy nft_reject_policy[]; 10 10 11 + int nft_reject_validate(const struct nft_ctx *ctx, 12 + const struct nft_expr *expr, 13 + const struct nft_data **data); 14 + 11 15 int nft_reject_init(const struct nft_ctx *ctx, 12 16 const struct nft_expr *expr, 13 17 const struct nlattr * const tb[]);
+37 -10
kernel/events/core.c
··· 2496 2496 return 0; 2497 2497 } 2498 2498 2499 - static int perf_event_restart(struct perf_event *event) 2499 + static int perf_event_stop(struct perf_event *event, int restart) 2500 2500 { 2501 2501 struct stop_event_data sd = { 2502 2502 .event = event, 2503 - .restart = 1, 2503 + .restart = restart, 2504 2504 }; 2505 2505 int ret = 0; 2506 2506 ··· 3549 3549 .group = group, 3550 3550 .ret = 0, 3551 3551 }; 3552 - ret = smp_call_function_single(event->oncpu, __perf_event_read, &data, 1); 3553 - /* The event must have been read from an online CPU: */ 3554 - WARN_ON_ONCE(ret); 3555 - ret = ret ? : data.ret; 3552 + /* 3553 + * Purposely ignore the smp_call_function_single() return 3554 + * value. 3555 + * 3556 + * If event->oncpu isn't a valid CPU it means the event got 3557 + * scheduled out and that will have updated the event count. 3558 + * 3559 + * Therefore, either way, we'll have an up-to-date event count 3560 + * after this. 3561 + */ 3562 + (void)smp_call_function_single(event->oncpu, __perf_event_read, &data, 1); 3563 + ret = data.ret; 3556 3564 } else if (event->state == PERF_EVENT_STATE_INACTIVE) { 3557 3565 struct perf_event_context *ctx = event->ctx; 3558 3566 unsigned long flags; ··· 4845 4837 spin_unlock_irqrestore(&rb->event_lock, flags); 4846 4838 } 4847 4839 4840 + /* 4841 + * Avoid racing with perf_mmap_close(AUX): stop the event 4842 + * before swizzling the event::rb pointer; if it's getting 4843 + * unmapped, its aux_mmap_count will be 0 and it won't 4844 + * restart. See the comment in __perf_pmu_output_stop(). 4845 + * 4846 + * Data will inevitably be lost when set_output is done in 4847 + * mid-air, but then again, whoever does it like this is 4848 + * not in for the data anyway. 4849 + */ 4850 + if (has_aux(event)) 4851 + perf_event_stop(event, 0); 4852 + 4848 4853 rcu_assign_pointer(event->rb, rb); 4849 4854 4850 4855 if (old_rb) { ··· 6133 6112 raw_spin_unlock_irqrestore(&ifh->lock, flags); 6134 6113 6135 6114 if (restart) 6136 - perf_event_restart(event); 6115 + perf_event_stop(event, 1); 6137 6116 } 6138 6117 6139 6118 void perf_event_exec(void) ··· 6177 6156 6178 6157 /* 6179 6158 * In case of inheritance, it will be the parent that links to the 6180 - * ring-buffer, but it will be the child that's actually using it: 6159 + * ring-buffer, but it will be the child that's actually using it. 6160 + * 6161 + * We are using event::rb to determine if the event should be stopped, 6162 + * however this may race with ring_buffer_attach() (through set_output), 6163 + * which will make us skip the event that actually needs to be stopped. 6164 + * So ring_buffer_attach() has to stop an aux event before re-assigning 6165 + * its rb pointer. 6181 6166 */ 6182 6167 if (rcu_dereference(parent->rb) == rb) 6183 6168 ro->err = __perf_event_stop(&sd); ··· 6697 6670 raw_spin_unlock_irqrestore(&ifh->lock, flags); 6698 6671 6699 6672 if (restart) 6700 - perf_event_restart(event); 6673 + perf_event_stop(event, 1); 6701 6674 } 6702 6675 6703 6676 /* ··· 7886 7859 mmput(mm); 7887 7860 7888 7861 restart: 7889 - perf_event_restart(event); 7862 + perf_event_stop(event, 1); 7890 7863 } 7891 7864 7892 7865 /*
+11 -4
kernel/events/ring_buffer.c
··· 330 330 if (!rb) 331 331 return NULL; 332 332 333 - if (!rb_has_aux(rb) || !atomic_inc_not_zero(&rb->aux_refcount)) 333 + if (!rb_has_aux(rb)) 334 334 goto err; 335 335 336 336 /* 337 - * If rb::aux_mmap_count is zero (and rb_has_aux() above went through), 338 - * the aux buffer is in perf_mmap_close(), about to get freed. 337 + * If aux_mmap_count is zero, the aux buffer is in perf_mmap_close(), 338 + * about to get freed, so we leave immediately. 339 + * 340 + * Checking rb::aux_mmap_count and rb::refcount has to be done in 341 + * the same order, see perf_mmap_close. Otherwise we end up freeing 342 + * aux pages in this path, which is a bug, because in_atomic(). 339 343 */ 340 344 if (!atomic_read(&rb->aux_mmap_count)) 341 - goto err_put; 345 + goto err; 346 + 347 + if (!atomic_inc_not_zero(&rb->aux_refcount)) 348 + goto err; 342 349 343 350 /* 344 351 * Nesting is not supported for AUX area, make sure nested
+22
kernel/sched/core.c
··· 2016 2016 success = 1; /* we're going to change ->state */ 2017 2017 cpu = task_cpu(p); 2018 2018 2019 + /* 2020 + * Ensure we load p->on_rq _after_ p->state, otherwise it would 2021 + * be possible to, falsely, observe p->on_rq == 0 and get stuck 2022 + * in smp_cond_load_acquire() below. 2023 + * 2024 + * sched_ttwu_pending() try_to_wake_up() 2025 + * [S] p->on_rq = 1; [L] P->state 2026 + * UNLOCK rq->lock -----. 2027 + * \ 2028 + * +--- RMB 2029 + * schedule() / 2030 + * LOCK rq->lock -----' 2031 + * UNLOCK rq->lock 2032 + * 2033 + * [task p] 2034 + * [S] p->state = UNINTERRUPTIBLE [L] p->on_rq 2035 + * 2036 + * Pairs with the UNLOCK+LOCK on rq->lock from the 2037 + * last wakeup of our task and the schedule that got our task 2038 + * current. 2039 + */ 2040 + smp_rmb(); 2019 2041 if (p->on_rq && ttwu_remote(p, wake_flags)) 2020 2042 goto stat; 2021 2043
+2 -22
lib/iov_iter.c
··· 291 291 } 292 292 293 293 /* 294 - * Fault in the first iovec of the given iov_iter, to a maximum length 295 - * of bytes. Returns 0 on success, or non-zero if the memory could not be 296 - * accessed (ie. because it is an invalid address). 297 - * 298 - * writev-intensive code may want this to prefault several iovecs -- that 299 - * would be possible (callers must not rely on the fact that _only_ the 300 - * first iovec will be faulted with the current implementation). 301 - */ 302 - int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) 303 - { 304 - if (!(i->type & (ITER_BVEC|ITER_KVEC))) { 305 - char __user *buf = i->iov->iov_base + i->iov_offset; 306 - bytes = min(bytes, i->iov->iov_len - i->iov_offset); 307 - return fault_in_pages_readable(buf, bytes); 308 - } 309 - return 0; 310 - } 311 - EXPORT_SYMBOL(iov_iter_fault_in_readable); 312 - 313 - /* 314 294 * Fault in one or more iovecs of the given iov_iter, to a maximum length of 315 295 * bytes. For each iovec, fault in each page that constitutes the iovec. 316 296 * 317 297 * Return 0 on success, or non-zero if the memory could not be accessed (i.e. 318 298 * because it is an invalid address). 319 299 */ 320 - int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) 300 + int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) 321 301 { 322 302 size_t skip = i->iov_offset; 323 303 const struct iovec *iov; ··· 314 334 } 315 335 return 0; 316 336 } 317 - EXPORT_SYMBOL(iov_iter_fault_in_multipages_readable); 337 + EXPORT_SYMBOL(iov_iter_fault_in_readable); 318 338 319 339 void iov_iter_init(struct iov_iter *i, int direction, 320 340 const struct iovec *iov, unsigned long nr_segs,
+2 -5
net/bridge/br_input.c
··· 80 80 81 81 BR_INPUT_SKB_CB(skb)->proxyarp_replied = false; 82 82 83 - if (dev->flags & IFF_NOARP) 83 + if ((dev->flags & IFF_NOARP) || 84 + !pskb_may_pull(skb, arp_hdr_len(dev))) 84 85 return; 85 86 86 - if (!pskb_may_pull(skb, arp_hdr_len(dev))) { 87 - dev->stats.tx_dropped++; 88 - return; 89 - } 90 87 parp = arp_hdr(skb); 91 88 92 89 if (parp->ar_pro != htons(ETH_P_IP) ||
+1 -1
net/bridge/br_multicast.c
··· 1138 1138 } else { 1139 1139 err = br_ip6_multicast_add_group(br, port, 1140 1140 &grec->grec_mca, vid); 1141 - if (!err) 1141 + if (err) 1142 1142 break; 1143 1143 } 1144 1144 }
+2
net/bridge/netfilter/ebtables.c
··· 368 368 369 369 match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); 370 370 if (IS_ERR(match) || match->family != NFPROTO_BRIDGE) { 371 + if (!IS_ERR(match)) 372 + module_put(match->me); 371 373 request_module("ebt_%s", m->u.name); 372 374 match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); 373 375 }
+1
net/bridge/netfilter/nft_meta_bridge.c
··· 86 86 .init = nft_meta_set_init, 87 87 .destroy = nft_meta_set_destroy, 88 88 .dump = nft_meta_set_dump, 89 + .validate = nft_meta_set_validate, 89 90 }; 90 91 91 92 static const struct nft_expr_ops *
+16
net/core/dev.c
··· 3975 3975 } 3976 3976 3977 3977 /** 3978 + * netdev_is_rx_handler_busy - check if receive handler is registered 3979 + * @dev: device to check 3980 + * 3981 + * Check if a receive handler is already registered for a given device. 3982 + * Return true if there one. 3983 + * 3984 + * The caller must hold the rtnl_mutex. 3985 + */ 3986 + bool netdev_is_rx_handler_busy(struct net_device *dev) 3987 + { 3988 + ASSERT_RTNL(); 3989 + return dev && rtnl_dereference(dev->rx_handler); 3990 + } 3991 + EXPORT_SYMBOL_GPL(netdev_is_rx_handler_busy); 3992 + 3993 + /** 3978 3994 * netdev_rx_handler_register - register receive handler 3979 3995 * @dev: device to register a handler for 3980 3996 * @rx_handler: receive handler to register
+4 -2
net/core/flow_dissector.c
··· 680 680 void __skb_get_hash(struct sk_buff *skb) 681 681 { 682 682 struct flow_keys keys; 683 + u32 hash; 683 684 684 685 __flow_hash_secret_init(); 685 686 686 - __skb_set_sw_hash(skb, ___skb_get_hash(skb, &keys, hashrnd), 687 - flow_keys_have_l4(&keys)); 687 + hash = ___skb_get_hash(skb, &keys, hashrnd); 688 + 689 + __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); 688 690 } 689 691 EXPORT_SYMBOL(__skb_get_hash); 690 692
+7 -4
net/ipv4/devinet.c
··· 2232 2232 }; 2233 2233 2234 2234 static int __devinet_sysctl_register(struct net *net, char *dev_name, 2235 - struct ipv4_devconf *p) 2235 + int ifindex, struct ipv4_devconf *p) 2236 2236 { 2237 2237 int i; 2238 2238 struct devinet_sysctl_table *t; ··· 2255 2255 goto free; 2256 2256 2257 2257 p->sysctl = t; 2258 + 2259 + inet_netconf_notify_devconf(net, NETCONFA_ALL, ifindex, p); 2258 2260 return 0; 2259 2261 2260 2262 free: ··· 2288 2286 if (err) 2289 2287 return err; 2290 2288 err = __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name, 2291 - &idev->cnf); 2289 + idev->dev->ifindex, &idev->cnf); 2292 2290 if (err) 2293 2291 neigh_sysctl_unregister(idev->arp_parms); 2294 2292 return err; ··· 2349 2347 } 2350 2348 2351 2349 #ifdef CONFIG_SYSCTL 2352 - err = __devinet_sysctl_register(net, "all", all); 2350 + err = __devinet_sysctl_register(net, "all", NETCONFA_IFINDEX_ALL, all); 2353 2351 if (err < 0) 2354 2352 goto err_reg_all; 2355 2353 2356 - err = __devinet_sysctl_register(net, "default", dflt); 2354 + err = __devinet_sysctl_register(net, "default", 2355 + NETCONFA_IFINDEX_DEFAULT, dflt); 2357 2356 if (err < 0) 2358 2357 goto err_reg_dflt; 2359 2358
+2 -1
net/ipv4/fib_frontend.c
··· 509 509 if (!dev) 510 510 return -ENODEV; 511 511 cfg->fc_oif = dev->ifindex; 512 + cfg->fc_table = l3mdev_fib_table(dev); 512 513 if (colon) { 513 514 struct in_ifaddr *ifa; 514 515 struct in_device *in_dev = __in_dev_get_rtnl(dev); ··· 1028 1027 * First of all, we scan fib_info list searching 1029 1028 * for stray nexthop entries, then ignite fib_flush. 1030 1029 */ 1031 - if (fib_sync_down_addr(dev_net(dev), ifa->ifa_local)) 1030 + if (fib_sync_down_addr(dev, ifa->ifa_local)) 1032 1031 fib_flush(dev_net(dev)); 1033 1032 } 1034 1033 }
+6 -2
net/ipv4/fib_semantics.c
··· 1057 1057 fi->fib_priority = cfg->fc_priority; 1058 1058 fi->fib_prefsrc = cfg->fc_prefsrc; 1059 1059 fi->fib_type = cfg->fc_type; 1060 + fi->fib_tb_id = cfg->fc_table; 1060 1061 1061 1062 fi->fib_nhs = nhs; 1062 1063 change_nexthops(fi) { ··· 1338 1337 * referring to it. 1339 1338 * - device went down -> we must shutdown all nexthops going via it. 1340 1339 */ 1341 - int fib_sync_down_addr(struct net *net, __be32 local) 1340 + int fib_sync_down_addr(struct net_device *dev, __be32 local) 1342 1341 { 1343 1342 int ret = 0; 1344 1343 unsigned int hash = fib_laddr_hashfn(local); 1345 1344 struct hlist_head *head = &fib_info_laddrhash[hash]; 1345 + struct net *net = dev_net(dev); 1346 + int tb_id = l3mdev_fib_table(dev); 1346 1347 struct fib_info *fi; 1347 1348 1348 1349 if (!fib_info_laddrhash || local == 0) 1349 1350 return 0; 1350 1351 1351 1352 hlist_for_each_entry(fi, head, fib_lhash) { 1352 - if (!net_eq(fi->fib_net, net)) 1353 + if (!net_eq(fi->fib_net, net) || 1354 + fi->fib_tb_id != tb_id) 1353 1355 continue; 1354 1356 if (fi->fib_prefsrc == local) { 1355 1357 fi->fib_flags |= RTNH_F_DEAD;
+1
net/ipv4/netfilter/nft_reject_ipv4.c
··· 46 46 .eval = nft_reject_ipv4_eval, 47 47 .init = nft_reject_init, 48 48 .dump = nft_reject_dump, 49 + .validate = nft_reject_validate, 49 50 }; 50 51 51 52 static struct nft_expr_type nft_reject_ipv4_type __read_mostly = {
+2
net/ipv4/tcp_fastopen.c
··· 150 150 tp->segs_in = 0; 151 151 tcp_segs_in(tp, skb); 152 152 __skb_pull(skb, tcp_hdrlen(skb)); 153 + sk_forced_mem_schedule(sk, skb->truesize); 153 154 skb_set_owner_r(skb, sk); 154 155 155 156 TCP_SKB_CB(skb)->seq++; ··· 227 226 tcp_fastopen_add_skb(child, skb); 228 227 229 228 tcp_rsk(req)->rcv_nxt = tp->rcv_nxt; 229 + tp->rcv_wup = tp->rcv_nxt; 230 230 /* tcp_conn_request() is sending the SYNACK, 231 231 * and queues the child into listener accept queue. 232 232 */
+1 -1
net/ipv4/tcp_yeah.c
··· 76 76 if (!tcp_is_cwnd_limited(sk)) 77 77 return; 78 78 79 - if (tp->snd_cwnd <= tp->snd_ssthresh) 79 + if (tcp_in_slow_start(tp)) 80 80 tcp_slow_start(tp, acked); 81 81 82 82 else if (!yeah->doing_reno_now) {
+1 -1
net/ipv4/xfrm4_policy.c
··· 29 29 memset(fl4, 0, sizeof(*fl4)); 30 30 fl4->daddr = daddr->a4; 31 31 fl4->flowi4_tos = tos; 32 - fl4->flowi4_oif = oif; 32 + fl4->flowi4_oif = l3mdev_master_ifindex_by_index(net, oif); 33 33 if (saddr) 34 34 fl4->saddr = saddr->a4; 35 35
+17 -1
net/ipv6/addrconf.c
··· 778 778 } 779 779 780 780 if (p == &net->ipv6.devconf_all->forwarding) { 781 + int old_dflt = net->ipv6.devconf_dflt->forwarding; 782 + 781 783 net->ipv6.devconf_dflt->forwarding = newf; 784 + if ((!newf) ^ (!old_dflt)) 785 + inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, 786 + NETCONFA_IFINDEX_DEFAULT, 787 + net->ipv6.devconf_dflt); 788 + 782 789 addrconf_forward_change(net, newf); 783 790 if ((!newf) ^ (!old)) 784 791 inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, ··· 1948 1941 spin_unlock_bh(&ifp->lock); 1949 1942 1950 1943 addrconf_mod_dad_work(ifp, 0); 1944 + in6_ifa_put(ifp); 1951 1945 } 1952 1946 1953 1947 /* Join to solicited addr multicast group. ··· 3858 3850 addrconf_dad_begin(ifp); 3859 3851 goto out; 3860 3852 } else if (action == DAD_ABORT) { 3853 + in6_ifa_hold(ifp); 3861 3854 addrconf_dad_stop(ifp, 1); 3862 3855 if (disable_ipv6) 3863 3856 addrconf_ifdown(idev->dev, 0); ··· 6034 6025 static int __addrconf_sysctl_register(struct net *net, char *dev_name, 6035 6026 struct inet6_dev *idev, struct ipv6_devconf *p) 6036 6027 { 6037 - int i; 6028 + int i, ifindex; 6038 6029 struct ctl_table *table; 6039 6030 char path[sizeof("net/ipv6/conf/") + IFNAMSIZ]; 6040 6031 ··· 6054 6045 if (!p->sysctl_header) 6055 6046 goto free; 6056 6047 6048 + if (!strcmp(dev_name, "all")) 6049 + ifindex = NETCONFA_IFINDEX_ALL; 6050 + else if (!strcmp(dev_name, "default")) 6051 + ifindex = NETCONFA_IFINDEX_DEFAULT; 6052 + else 6053 + ifindex = idev->dev->ifindex; 6054 + inet6_netconf_notify_devconf(net, NETCONFA_ALL, ifindex, p); 6057 6055 return 0; 6058 6056 6059 6057 free:
+2
net/ipv6/ip6_tunnel.c
··· 1174 1174 encap_limit = t->parms.encap_limit; 1175 1175 1176 1176 memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); 1177 + fl6.flowi6_proto = IPPROTO_IPIP; 1177 1178 1178 1179 dsfield = ipv4_get_dsfield(iph); 1179 1180 ··· 1234 1233 encap_limit = t->parms.encap_limit; 1235 1234 1236 1235 memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); 1236 + fl6.flowi6_proto = IPPROTO_IPV6; 1237 1237 1238 1238 dsfield = ipv6_get_dsfield(ipv6h); 1239 1239 if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
+1
net/ipv6/netfilter/nft_reject_ipv6.c
··· 47 47 .eval = nft_reject_ipv6_eval, 48 48 .init = nft_reject_init, 49 49 .dump = nft_reject_dump, 50 + .validate = nft_reject_validate, 50 51 }; 51 52 52 53 static struct nft_expr_type nft_reject_ipv6_type __read_mostly = {
+7 -2
net/ipv6/ping.c
··· 126 126 rt = (struct rt6_info *) dst; 127 127 128 128 np = inet6_sk(sk); 129 - if (!np) 130 - return -EBADF; 129 + if (!np) { 130 + err = -EBADF; 131 + goto dst_err_out; 132 + } 131 133 132 134 if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) 133 135 fl6.flowi6_oif = np->mcast_oif; ··· 164 162 len); 165 163 } 166 164 release_sock(sk); 165 + 166 + dst_err_out: 167 + dst_release(dst); 167 168 168 169 if (err) 169 170 return err;
+1
net/ipv6/xfrm6_input.c
··· 23 23 24 24 int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 25 25 { 26 + XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL; 26 27 XFRM_SPI_SKB_CB(skb)->family = AF_INET6; 27 28 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); 28 29 return xfrm_input(skb, nexthdr, spi, 0);
+1 -1
net/ipv6/xfrm6_policy.c
··· 36 36 int err; 37 37 38 38 memset(&fl6, 0, sizeof(fl6)); 39 - fl6.flowi6_oif = oif; 39 + fl6.flowi6_oif = l3mdev_master_ifindex_by_index(net, oif); 40 40 fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF; 41 41 memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr)); 42 42 if (saddr)
+2 -1
net/kcm/kcmsock.c
··· 13 13 #include <linux/socket.h> 14 14 #include <linux/uaccess.h> 15 15 #include <linux/workqueue.h> 16 + #include <linux/syscalls.h> 16 17 #include <net/kcm.h> 17 18 #include <net/netns/generic.h> 18 19 #include <net/sock.h> ··· 2030 2029 if (copy_to_user((void __user *)arg, &info, 2031 2030 sizeof(info))) { 2032 2031 err = -EFAULT; 2033 - sock_release(newsock); 2032 + sys_close(info.fd); 2034 2033 } 2035 2034 } 2036 2035
+3
net/l2tp/l2tp_core.c
··· 1855 1855 (void)l2tp_tunnel_delete(tunnel); 1856 1856 } 1857 1857 rcu_read_unlock_bh(); 1858 + 1859 + flush_workqueue(l2tp_wq); 1860 + rcu_barrier(); 1858 1861 } 1859 1862 1860 1863 static struct pernet_operations l2tp_net_ops = {
+4 -3
net/mac80211/tdls.c
··· 333 333 if (!uc.center_freq1) 334 334 return; 335 335 336 - /* proceed to downgrade the chandef until usable or the same */ 336 + /* proceed to downgrade the chandef until usable or the same as AP BW */ 337 337 while (uc.width > max_width || 338 - !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc, 339 - sdata->wdev.iftype)) 338 + (uc.width > sta->tdls_chandef.width && 339 + !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc, 340 + sdata->wdev.iftype))) 340 341 ieee80211_chandef_downgrade(&uc); 341 342 342 343 if (!cfg80211_chandef_identical(&uc, &sta->tdls_chandef)) {
-1
net/netfilter/nf_tables_netdev.c
··· 30 30 if (!iph) 31 31 return; 32 32 33 - iph = ip_hdr(skb); 34 33 if (iph->ihl < 5 || iph->version != 4) 35 34 return; 36 35
+13 -4
net/netfilter/nft_meta.c
··· 291 291 } 292 292 EXPORT_SYMBOL_GPL(nft_meta_get_init); 293 293 294 - static int nft_meta_set_init_pkttype(const struct nft_ctx *ctx) 294 + int nft_meta_set_validate(const struct nft_ctx *ctx, 295 + const struct nft_expr *expr, 296 + const struct nft_data **data) 295 297 { 298 + struct nft_meta *priv = nft_expr_priv(expr); 296 299 unsigned int hooks; 300 + 301 + if (priv->key != NFT_META_PKTTYPE) 302 + return 0; 297 303 298 304 switch (ctx->afi->family) { 299 305 case NFPROTO_BRIDGE: ··· 314 308 315 309 return nft_chain_validate_hooks(ctx->chain, hooks); 316 310 } 311 + EXPORT_SYMBOL_GPL(nft_meta_set_validate); 317 312 318 313 int nft_meta_set_init(const struct nft_ctx *ctx, 319 314 const struct nft_expr *expr, ··· 334 327 len = sizeof(u8); 335 328 break; 336 329 case NFT_META_PKTTYPE: 337 - err = nft_meta_set_init_pkttype(ctx); 338 - if (err) 339 - return err; 340 330 len = sizeof(u8); 341 331 break; 342 332 default: 343 333 return -EOPNOTSUPP; 344 334 } 335 + 336 + err = nft_meta_set_validate(ctx, expr, NULL); 337 + if (err < 0) 338 + return err; 345 339 346 340 priv->sreg = nft_parse_register(tb[NFTA_META_SREG]); 347 341 err = nft_validate_register_load(priv->sreg, len); ··· 415 407 .init = nft_meta_set_init, 416 408 .destroy = nft_meta_set_destroy, 417 409 .dump = nft_meta_set_dump, 410 + .validate = nft_meta_set_validate, 418 411 }; 419 412 420 413 static const struct nft_expr_ops *
+16
net/netfilter/nft_reject.c
··· 26 26 }; 27 27 EXPORT_SYMBOL_GPL(nft_reject_policy); 28 28 29 + int nft_reject_validate(const struct nft_ctx *ctx, 30 + const struct nft_expr *expr, 31 + const struct nft_data **data) 32 + { 33 + return nft_chain_validate_hooks(ctx->chain, 34 + (1 << NF_INET_LOCAL_IN) | 35 + (1 << NF_INET_FORWARD) | 36 + (1 << NF_INET_LOCAL_OUT)); 37 + } 38 + EXPORT_SYMBOL_GPL(nft_reject_validate); 39 + 29 40 int nft_reject_init(const struct nft_ctx *ctx, 30 41 const struct nft_expr *expr, 31 42 const struct nlattr * const tb[]) 32 43 { 33 44 struct nft_reject *priv = nft_expr_priv(expr); 45 + int err; 46 + 47 + err = nft_reject_validate(ctx, expr, NULL); 48 + if (err < 0) 49 + return err; 34 50 35 51 if (tb[NFTA_REJECT_TYPE] == NULL) 36 52 return -EINVAL;
+6 -1
net/netfilter/nft_reject_inet.c
··· 66 66 const struct nlattr * const tb[]) 67 67 { 68 68 struct nft_reject *priv = nft_expr_priv(expr); 69 - int icmp_code; 69 + int icmp_code, err; 70 + 71 + err = nft_reject_validate(ctx, expr, NULL); 72 + if (err < 0) 73 + return err; 70 74 71 75 if (tb[NFTA_REJECT_TYPE] == NULL) 72 76 return -EINVAL; ··· 128 124 .eval = nft_reject_inet_eval, 129 125 .init = nft_reject_inet_init, 130 126 .dump = nft_reject_inet_dump, 127 + .validate = nft_reject_validate, 131 128 }; 132 129 133 130 static struct nft_expr_type nft_reject_inet_type __read_mostly = {
+12 -1
net/sctp/output.c
··· 878 878 struct sctp_chunk *chunk, 879 879 u16 chunk_len) 880 880 { 881 - size_t psize, pmtu; 881 + size_t psize, pmtu, maxsize; 882 882 sctp_xmit_t retval = SCTP_XMIT_OK; 883 883 884 884 psize = packet->size; ··· 905 905 packet->ipfragok = 1; 906 906 goto out; 907 907 } 908 + 909 + /* Similarly, if this chunk was built before a PMTU 910 + * reduction, we have to fragment it at IP level now. So 911 + * if the packet already contains something, we need to 912 + * flush. 913 + */ 914 + maxsize = pmtu - packet->overhead; 915 + if (packet->auth) 916 + maxsize -= WORD_ROUND(packet->auth->skb->len); 917 + if (chunk_len > maxsize) 918 + retval = SCTP_XMIT_PMTU_FULL; 908 919 909 920 /* It is also okay to fragment if the chunk we are 910 921 * adding is a control chunk, but only if current packet
+3 -2
net/sunrpc/auth_gss/svcauth_gss.c
··· 569 569 struct rsc *found; 570 570 571 571 memset(&rsci, 0, sizeof(rsci)); 572 - rsci.handle.data = handle->data; 573 - rsci.handle.len = handle->len; 572 + if (dup_to_netobj(&rsci.handle, handle->data, handle->len)) 573 + return NULL; 574 574 found = rsc_lookup(cd, &rsci); 575 + rsc_free(&rsci); 575 576 if (!found) 576 577 return NULL; 577 578 if (cache_check(cd, &found->h, NULL))
+32 -13
net/sunrpc/xprtrdma/verbs.c
··· 51 51 #include <linux/slab.h> 52 52 #include <linux/prefetch.h> 53 53 #include <linux/sunrpc/addr.h> 54 + #include <linux/sunrpc/svc_rdma.h> 54 55 #include <asm/bitops.h> 55 56 #include <linux/module.h> /* try_module_get()/module_put() */ 56 57 ··· 924 923 } 925 924 926 925 INIT_LIST_HEAD(&buf->rb_recv_bufs); 927 - for (i = 0; i < buf->rb_max_requests; i++) { 926 + for (i = 0; i < buf->rb_max_requests + RPCRDMA_MAX_BC_REQUESTS; i++) { 928 927 struct rpcrdma_rep *rep; 929 928 930 929 rep = rpcrdma_create_rep(r_xprt); ··· 1019 1018 rep = rpcrdma_buffer_get_rep_locked(buf); 1020 1019 rpcrdma_destroy_rep(ia, rep); 1021 1020 } 1021 + buf->rb_send_count = 0; 1022 1022 1023 1023 spin_lock(&buf->rb_reqslock); 1024 1024 while (!list_empty(&buf->rb_allreqs)) { ··· 1034 1032 spin_lock(&buf->rb_reqslock); 1035 1033 } 1036 1034 spin_unlock(&buf->rb_reqslock); 1035 + buf->rb_recv_count = 0; 1037 1036 1038 1037 rpcrdma_destroy_mrs(buf); 1039 1038 } ··· 1077 1074 spin_unlock(&buf->rb_mwlock); 1078 1075 } 1079 1076 1077 + static struct rpcrdma_rep * 1078 + rpcrdma_buffer_get_rep(struct rpcrdma_buffer *buffers) 1079 + { 1080 + /* If an RPC previously completed without a reply (say, a 1081 + * credential problem or a soft timeout occurs) then hold off 1082 + * on supplying more Receive buffers until the number of new 1083 + * pending RPCs catches up to the number of posted Receives. 1084 + */ 1085 + if (unlikely(buffers->rb_send_count < buffers->rb_recv_count)) 1086 + return NULL; 1087 + 1088 + if (unlikely(list_empty(&buffers->rb_recv_bufs))) 1089 + return NULL; 1090 + buffers->rb_recv_count++; 1091 + return rpcrdma_buffer_get_rep_locked(buffers); 1092 + } 1093 + 1080 1094 /* 1081 1095 * Get a set of request/reply buffers. 1096 + * 1097 + * Reply buffer (if available) is attached to send buffer upon return. 1082 1098 */ 1083 1099 struct rpcrdma_req * 1084 1100 rpcrdma_buffer_get(struct rpcrdma_buffer *buffers) ··· 1107 1085 spin_lock(&buffers->rb_lock); 1108 1086 if (list_empty(&buffers->rb_send_bufs)) 1109 1087 goto out_reqbuf; 1088 + buffers->rb_send_count++; 1110 1089 req = rpcrdma_buffer_get_req_locked(buffers); 1111 - if (list_empty(&buffers->rb_recv_bufs)) 1112 - goto out_repbuf; 1113 - req->rl_reply = rpcrdma_buffer_get_rep_locked(buffers); 1090 + req->rl_reply = rpcrdma_buffer_get_rep(buffers); 1114 1091 spin_unlock(&buffers->rb_lock); 1115 1092 return req; 1116 1093 1117 1094 out_reqbuf: 1118 1095 spin_unlock(&buffers->rb_lock); 1119 - pr_warn("rpcrdma: out of request buffers (%p)\n", buffers); 1120 - return NULL; 1121 - out_repbuf: 1122 - list_add(&req->rl_free, &buffers->rb_send_bufs); 1123 - spin_unlock(&buffers->rb_lock); 1124 - pr_warn("rpcrdma: out of reply buffers (%p)\n", buffers); 1096 + pr_warn("RPC: %s: out of request buffers\n", __func__); 1125 1097 return NULL; 1126 1098 } 1127 1099 ··· 1133 1117 req->rl_reply = NULL; 1134 1118 1135 1119 spin_lock(&buffers->rb_lock); 1120 + buffers->rb_send_count--; 1136 1121 list_add_tail(&req->rl_free, &buffers->rb_send_bufs); 1137 - if (rep) 1122 + if (rep) { 1123 + buffers->rb_recv_count--; 1138 1124 list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); 1125 + } 1139 1126 spin_unlock(&buffers->rb_lock); 1140 1127 } 1141 1128 ··· 1152 1133 struct rpcrdma_buffer *buffers = req->rl_buffer; 1153 1134 1154 1135 spin_lock(&buffers->rb_lock); 1155 - if (!list_empty(&buffers->rb_recv_bufs)) 1156 - req->rl_reply = rpcrdma_buffer_get_rep_locked(buffers); 1136 + req->rl_reply = rpcrdma_buffer_get_rep(buffers); 1157 1137 spin_unlock(&buffers->rb_lock); 1158 1138 } 1159 1139 ··· 1166 1148 struct rpcrdma_buffer *buffers = &rep->rr_rxprt->rx_buf; 1167 1149 1168 1150 spin_lock(&buffers->rb_lock); 1151 + buffers->rb_recv_count--; 1169 1152 list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); 1170 1153 spin_unlock(&buffers->rb_lock); 1171 1154 }
+1
net/sunrpc/xprtrdma/xprt_rdma.h
··· 321 321 char *rb_pool; 322 322 323 323 spinlock_t rb_lock; /* protect buf lists */ 324 + int rb_send_count, rb_recv_count; 324 325 struct list_head rb_send_bufs; 325 326 struct list_head rb_recv_bufs; 326 327 u32 rb_max_requests;
+1 -1
net/sunrpc/xprtsock.c
··· 1074 1074 skb = skb_recv_datagram(sk, 0, 1, &err); 1075 1075 if (skb != NULL) { 1076 1076 xs_udp_data_read_skb(&transport->xprt, sk, skb); 1077 - skb_free_datagram(sk, skb); 1077 + skb_free_datagram_locked(sk, skb); 1078 1078 continue; 1079 1079 } 1080 1080 if (!test_and_clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state))
+5 -3
net/tipc/name_distr.c
··· 62 62 63 63 /** 64 64 * named_prepare_buf - allocate & initialize a publication message 65 + * 66 + * The buffer returned is of size INT_H_SIZE + payload size 65 67 */ 66 68 static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size, 67 69 u32 dest) ··· 143 141 struct publication *publ; 144 142 struct sk_buff *skb = NULL; 145 143 struct distr_item *item = NULL; 146 - uint msg_dsz = (tipc_node_get_mtu(net, dnode, 0) / ITEM_SIZE) * 147 - ITEM_SIZE; 148 - uint msg_rem = msg_dsz; 144 + u32 msg_dsz = ((tipc_node_get_mtu(net, dnode, 0) - INT_H_SIZE) / 145 + ITEM_SIZE) * ITEM_SIZE; 146 + u32 msg_rem = msg_dsz; 149 147 150 148 list_for_each_entry(publ, pls, local_list) { 151 149 /* Prepare next buffer: */
+49 -62
net/unix/af_unix.c
··· 661 661 { 662 662 struct unix_sock *u = unix_sk(sk); 663 663 664 - if (mutex_lock_interruptible(&u->readlock)) 664 + if (mutex_lock_interruptible(&u->iolock)) 665 665 return -EINTR; 666 666 667 667 sk->sk_peek_off = val; 668 - mutex_unlock(&u->readlock); 668 + mutex_unlock(&u->iolock); 669 669 670 670 return 0; 671 671 } ··· 779 779 spin_lock_init(&u->lock); 780 780 atomic_long_set(&u->inflight, 0); 781 781 INIT_LIST_HEAD(&u->link); 782 - mutex_init(&u->readlock); /* single task reading lock */ 782 + mutex_init(&u->iolock); /* single task reading lock */ 783 + mutex_init(&u->bindlock); /* single task binding lock */ 783 784 init_waitqueue_head(&u->peer_wait); 784 785 init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay); 785 786 unix_insert_socket(unix_sockets_unbound(sk), sk); ··· 849 848 int err; 850 849 unsigned int retries = 0; 851 850 852 - err = mutex_lock_interruptible(&u->readlock); 851 + err = mutex_lock_interruptible(&u->bindlock); 853 852 if (err) 854 853 return err; 855 854 ··· 896 895 spin_unlock(&unix_table_lock); 897 896 err = 0; 898 897 899 - out: mutex_unlock(&u->readlock); 898 + out: mutex_unlock(&u->bindlock); 900 899 return err; 901 900 } 902 901 ··· 955 954 return NULL; 956 955 } 957 956 958 - static int unix_mknod(struct dentry *dentry, const struct path *path, umode_t mode, 959 - struct path *res) 957 + static int unix_mknod(const char *sun_path, umode_t mode, struct path *res) 960 958 { 961 - int err; 959 + struct dentry *dentry; 960 + struct path path; 961 + int err = 0; 962 + /* 963 + * Get the parent directory, calculate the hash for last 964 + * component. 965 + */ 966 + dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); 967 + err = PTR_ERR(dentry); 968 + if (IS_ERR(dentry)) 969 + return err; 962 970 963 - err = security_path_mknod(path, dentry, mode, 0); 971 + /* 972 + * All right, let's create it. 973 + */ 974 + err = security_path_mknod(&path, dentry, mode, 0); 964 975 if (!err) { 965 - err = vfs_mknod(d_inode(path->dentry), dentry, mode, 0); 976 + err = vfs_mknod(d_inode(path.dentry), dentry, mode, 0); 966 977 if (!err) { 967 - res->mnt = mntget(path->mnt); 978 + res->mnt = mntget(path.mnt); 968 979 res->dentry = dget(dentry); 969 980 } 970 981 } 971 - 982 + done_path_create(&path, dentry); 972 983 return err; 973 984 } 974 985 ··· 991 978 struct unix_sock *u = unix_sk(sk); 992 979 struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; 993 980 char *sun_path = sunaddr->sun_path; 994 - int err, name_err; 981 + int err; 995 982 unsigned int hash; 996 983 struct unix_address *addr; 997 984 struct hlist_head *list; 998 - struct path path; 999 - struct dentry *dentry; 1000 985 1001 986 err = -EINVAL; 1002 987 if (sunaddr->sun_family != AF_UNIX) ··· 1010 999 goto out; 1011 1000 addr_len = err; 1012 1001 1013 - name_err = 0; 1014 - dentry = NULL; 1015 - if (sun_path[0]) { 1016 - /* Get the parent directory, calculate the hash for last 1017 - * component. 1018 - */ 1019 - dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); 1020 - 1021 - if (IS_ERR(dentry)) { 1022 - /* delay report until after 'already bound' check */ 1023 - name_err = PTR_ERR(dentry); 1024 - dentry = NULL; 1025 - } 1026 - } 1027 - 1028 - err = mutex_lock_interruptible(&u->readlock); 1002 + err = mutex_lock_interruptible(&u->bindlock); 1029 1003 if (err) 1030 - goto out_path; 1004 + goto out; 1031 1005 1032 1006 err = -EINVAL; 1033 1007 if (u->addr) 1034 1008 goto out_up; 1035 - 1036 - if (name_err) { 1037 - err = name_err == -EEXIST ? -EADDRINUSE : name_err; 1038 - goto out_up; 1039 - } 1040 1009 1041 1010 err = -ENOMEM; 1042 1011 addr = kmalloc(sizeof(*addr)+addr_len, GFP_KERNEL); ··· 1028 1037 addr->hash = hash ^ sk->sk_type; 1029 1038 atomic_set(&addr->refcnt, 1); 1030 1039 1031 - if (dentry) { 1032 - struct path u_path; 1040 + if (sun_path[0]) { 1041 + struct path path; 1033 1042 umode_t mode = S_IFSOCK | 1034 1043 (SOCK_INODE(sock)->i_mode & ~current_umask()); 1035 - err = unix_mknod(dentry, &path, mode, &u_path); 1044 + err = unix_mknod(sun_path, mode, &path); 1036 1045 if (err) { 1037 1046 if (err == -EEXIST) 1038 1047 err = -EADDRINUSE; ··· 1040 1049 goto out_up; 1041 1050 } 1042 1051 addr->hash = UNIX_HASH_SIZE; 1043 - hash = d_real_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); 1052 + hash = d_real_inode(path.dentry)->i_ino & (UNIX_HASH_SIZE - 1); 1044 1053 spin_lock(&unix_table_lock); 1045 - u->path = u_path; 1054 + u->path = path; 1046 1055 list = &unix_socket_table[hash]; 1047 1056 } else { 1048 1057 spin_lock(&unix_table_lock); ··· 1064 1073 out_unlock: 1065 1074 spin_unlock(&unix_table_lock); 1066 1075 out_up: 1067 - mutex_unlock(&u->readlock); 1068 - out_path: 1069 - if (dentry) 1070 - done_path_create(&path, dentry); 1071 - 1076 + mutex_unlock(&u->bindlock); 1072 1077 out: 1073 1078 return err; 1074 1079 } ··· 1956 1969 if (false) { 1957 1970 alloc_skb: 1958 1971 unix_state_unlock(other); 1959 - mutex_unlock(&unix_sk(other)->readlock); 1972 + mutex_unlock(&unix_sk(other)->iolock); 1960 1973 newskb = sock_alloc_send_pskb(sk, 0, 0, flags & MSG_DONTWAIT, 1961 1974 &err, 0); 1962 1975 if (!newskb) 1963 1976 goto err; 1964 1977 } 1965 1978 1966 - /* we must acquire readlock as we modify already present 1979 + /* we must acquire iolock as we modify already present 1967 1980 * skbs in the sk_receive_queue and mess with skb->len 1968 1981 */ 1969 - err = mutex_lock_interruptible(&unix_sk(other)->readlock); 1982 + err = mutex_lock_interruptible(&unix_sk(other)->iolock); 1970 1983 if (err) { 1971 1984 err = flags & MSG_DONTWAIT ? -EAGAIN : -ERESTARTSYS; 1972 1985 goto err; ··· 2033 2046 } 2034 2047 2035 2048 unix_state_unlock(other); 2036 - mutex_unlock(&unix_sk(other)->readlock); 2049 + mutex_unlock(&unix_sk(other)->iolock); 2037 2050 2038 2051 other->sk_data_ready(other); 2039 2052 scm_destroy(&scm); ··· 2042 2055 err_state_unlock: 2043 2056 unix_state_unlock(other); 2044 2057 err_unlock: 2045 - mutex_unlock(&unix_sk(other)->readlock); 2058 + mutex_unlock(&unix_sk(other)->iolock); 2046 2059 err: 2047 2060 kfree_skb(newskb); 2048 2061 if (send_sigpipe && !(flags & MSG_NOSIGNAL)) ··· 2110 2123 timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 2111 2124 2112 2125 do { 2113 - mutex_lock(&u->readlock); 2126 + mutex_lock(&u->iolock); 2114 2127 2115 2128 skip = sk_peek_offset(sk, flags); 2116 2129 skb = __skb_try_recv_datagram(sk, flags, &peeked, &skip, &err, ··· 2118 2131 if (skb) 2119 2132 break; 2120 2133 2121 - mutex_unlock(&u->readlock); 2134 + mutex_unlock(&u->iolock); 2122 2135 2123 2136 if (err != -EAGAIN) 2124 2137 break; 2125 2138 } while (timeo && 2126 2139 !__skb_wait_for_more_packets(sk, &err, &timeo, last)); 2127 2140 2128 - if (!skb) { /* implies readlock unlocked */ 2141 + if (!skb) { /* implies iolock unlocked */ 2129 2142 unix_state_lock(sk); 2130 2143 /* Signal EOF on disconnected non-blocking SEQPACKET socket. */ 2131 2144 if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN && ··· 2190 2203 2191 2204 out_free: 2192 2205 skb_free_datagram(sk, skb); 2193 - mutex_unlock(&u->readlock); 2206 + mutex_unlock(&u->iolock); 2194 2207 out: 2195 2208 return err; 2196 2209 } ··· 2285 2298 /* Lock the socket to prevent queue disordering 2286 2299 * while sleeps in memcpy_tomsg 2287 2300 */ 2288 - mutex_lock(&u->readlock); 2301 + mutex_lock(&u->iolock); 2289 2302 2290 2303 if (flags & MSG_PEEK) 2291 2304 skip = sk_peek_offset(sk, flags); ··· 2327 2340 break; 2328 2341 } 2329 2342 2330 - mutex_unlock(&u->readlock); 2343 + mutex_unlock(&u->iolock); 2331 2344 2332 2345 timeo = unix_stream_data_wait(sk, timeo, last, 2333 2346 last_len); ··· 2338 2351 goto out; 2339 2352 } 2340 2353 2341 - mutex_lock(&u->readlock); 2354 + mutex_lock(&u->iolock); 2342 2355 goto redo; 2343 2356 unlock: 2344 2357 unix_state_unlock(sk); ··· 2441 2454 } 2442 2455 } while (size); 2443 2456 2444 - mutex_unlock(&u->readlock); 2457 + mutex_unlock(&u->iolock); 2445 2458 if (state->msg) 2446 2459 scm_recv(sock, state->msg, &scm, flags); 2447 2460 else ··· 2482 2495 int ret; 2483 2496 struct unix_sock *u = unix_sk(sk); 2484 2497 2485 - mutex_unlock(&u->readlock); 2498 + mutex_unlock(&u->iolock); 2486 2499 ret = splice_to_pipe(pipe, spd); 2487 - mutex_lock(&u->readlock); 2500 + mutex_lock(&u->iolock); 2488 2501 2489 2502 return ret; 2490 2503 }
+2 -23
net/wireless/wext-core.c
··· 958 958 return private(dev, iwr, cmd, info, handler); 959 959 } 960 960 /* Old driver API : call driver ioctl handler */ 961 - if (dev->netdev_ops->ndo_do_ioctl) { 962 - #ifdef CONFIG_COMPAT 963 - if (info->flags & IW_REQUEST_FLAG_COMPAT) { 964 - int ret = 0; 965 - struct iwreq iwr_lcl; 966 - struct compat_iw_point *iwp_compat = (void *) &iwr->u.data; 967 - 968 - memcpy(&iwr_lcl, iwr, sizeof(struct iwreq)); 969 - iwr_lcl.u.data.pointer = compat_ptr(iwp_compat->pointer); 970 - iwr_lcl.u.data.length = iwp_compat->length; 971 - iwr_lcl.u.data.flags = iwp_compat->flags; 972 - 973 - ret = dev->netdev_ops->ndo_do_ioctl(dev, (void *) &iwr_lcl, cmd); 974 - 975 - iwp_compat->pointer = ptr_to_compat(iwr_lcl.u.data.pointer); 976 - iwp_compat->length = iwr_lcl.u.data.length; 977 - iwp_compat->flags = iwr_lcl.u.data.flags; 978 - 979 - return ret; 980 - } else 981 - #endif 982 - return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); 983 - } 961 + if (dev->netdev_ops->ndo_do_ioctl) 962 + return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); 984 963 return -EOPNOTSUPP; 985 964 } 986 965
+7 -7
net/xfrm/xfrm_input.c
··· 207 207 family = XFRM_SPI_SKB_CB(skb)->family; 208 208 209 209 /* if tunnel is present override skb->mark value with tunnel i_key */ 210 - if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) { 211 - switch (family) { 212 - case AF_INET: 210 + switch (family) { 211 + case AF_INET: 212 + if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) 213 213 mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); 214 - break; 215 - case AF_INET6: 214 + break; 215 + case AF_INET6: 216 + if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6) 216 217 mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); 217 - break; 218 - } 218 + break; 219 219 } 220 220 221 221 /* Allocate new secpath or COW existing one. */
+4
net/xfrm/xfrm_policy.c
··· 626 626 627 627 /* re-insert all policies by order of creation */ 628 628 list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) { 629 + if (xfrm_policy_id2dir(policy->index) >= XFRM_POLICY_MAX) { 630 + /* skip socket policies */ 631 + continue; 632 + } 629 633 newpos = NULL; 630 634 chain = policy_hash_bysel(net, &policy->selector, 631 635 policy->family,
+4 -9
net/xfrm/xfrm_user.c
··· 896 896 struct sock *sk = cb->skb->sk; 897 897 struct net *net = sock_net(sk); 898 898 899 - xfrm_state_walk_done(walk, net); 899 + if (cb->args[0]) 900 + xfrm_state_walk_done(walk, net); 900 901 return 0; 901 902 } 902 903 ··· 922 921 u8 proto = 0; 923 922 int err; 924 923 925 - cb->args[0] = 1; 926 - 927 924 err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, 928 925 xfrma_policy); 929 926 if (err < 0) ··· 938 939 proto = nla_get_u8(attrs[XFRMA_PROTO]); 939 940 940 941 xfrm_state_walk_init(walk, proto, filter); 942 + cb->args[0] = 1; 941 943 } 942 944 943 945 (void) xfrm_state_walk(net, walk, dump_one_state, &info); ··· 2051 2051 if (up->hard) { 2052 2052 xfrm_policy_delete(xp, p->dir); 2053 2053 xfrm_audit_policy_delete(xp, 1, true); 2054 - } else { 2055 - // reset the timers here? 2056 - WARN(1, "Don't know what to do with soft policy expire\n"); 2057 2054 } 2058 2055 km_policy_expired(xp, p->dir, up->hard, nlh->nlmsg_pid); 2059 2056 ··· 2114 2117 2115 2118 err = verify_newpolicy_info(&ua->policy); 2116 2119 if (err) 2117 - goto bad_policy; 2120 + goto free_state; 2118 2121 2119 2122 /* build an XP */ 2120 2123 xp = xfrm_policy_construct(net, &ua->policy, attrs, &err); ··· 2146 2149 2147 2150 return 0; 2148 2151 2149 - bad_policy: 2150 - WARN(1, "BAD policy passed\n"); 2151 2152 free_state: 2152 2153 kfree(x); 2153 2154 nomem:
+3 -3
tools/lguest/lguest.c
··· 3266 3266 } 3267 3267 } 3268 3268 3269 + /* If we exit via err(), this kills all the threads, restores tty. */ 3270 + atexit(cleanup_devices); 3271 + 3269 3272 /* We always have a console device, and it's always device 1. */ 3270 3273 setup_console(); 3271 3274 ··· 3371 3368 3372 3369 /* Ensure that we terminate if a device-servicing child dies. */ 3373 3370 signal(SIGCHLD, kill_launcher); 3374 - 3375 - /* If we exit via err(), this kills all the threads, restores tty. */ 3376 - atexit(cleanup_devices); 3377 3371 3378 3372 /* If requested, chroot to a directory */ 3379 3373 if (chroot_path) {