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

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

+3315 -1874
+2 -2
Documentation/DocBook/media_api.tmpl
··· 1 1 <?xml version="1.0"?> 2 - <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 3 - "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ 2 + <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 3 + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ 4 4 <!ENTITY % media-entities SYSTEM "./media-entities.tmpl"> %media-entities; 5 5 <!ENTITY media-indices SYSTEM "./media-indices.tmpl"> 6 6
+1 -1
Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
··· 4 4 Required properties : 5 5 6 6 - reg : Offset and length of the register set for the device 7 - - compatible : Should be "marvell,mv64xxx-i2c" 7 + - compatible : Should be "marvell,mv64xxx-i2c" or "allwinner,sun4i-i2c" 8 8 - interrupts : The interrupt number 9 9 10 10 Optional properties :
+1 -3
Documentation/devicetree/bindings/regulator/palmas-pmic.txt
··· 31 31 Optional sub-node properties: 32 32 ti,warm-reset - maintain voltage during warm reset(boolean) 33 33 ti,roof-floor - control voltage selection by pin(boolean) 34 - ti,sleep-mode - mode to adopt in pmic sleep 0 - off, 1 - auto, 34 + ti,mode-sleep - mode to adopt in pmic sleep 0 - off, 1 - auto, 35 35 2 - eco, 3 - forced pwm 36 - ti,tstep - slope control 0 - Jump, 1 10mV/us, 2 5mV/us, 3 2.5mV/us 37 36 ti,smps-range - OTP has the wrong range set for the hardware so override 38 37 0 - low range, 1 - high range. 39 38 ··· 58 59 ti,warm-reset; 59 60 ti,roof-floor; 60 61 ti,mode-sleep = <0>; 61 - ti,tstep = <0>; 62 62 ti,smps-range = <1>; 63 63 }; 64 64
+13 -3
MAINTAINERS
··· 965 965 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 966 966 S: Maintained 967 967 968 + ARM/TEXAS INSTRUMENT KEYSTONE ARCHITECTURE 969 + M: Santosh Shilimkar <santosh.shilimkar@ti.com> 970 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 971 + S: Maintained 972 + F: arch/arm/mach-keystone/ 973 + 968 974 ARM/LOGICPD PXA270 MACHINE SUPPORT 969 975 M: Lennert Buytenhek <kernel@wantstofly.org> 970 976 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) ··· 1265 1259 T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git 1266 1260 1267 1261 ARM/Ux500 ARM ARCHITECTURE 1268 - M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> 1269 1262 M: Linus Walleij <linus.walleij@linaro.org> 1270 1263 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1271 1264 S: Maintained ··· 5581 5576 F: drivers/media/tuners/mxl5007t.* 5582 5577 5583 5578 MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) 5584 - M: Andrew Gallatin <gallatin@myri.com> 5579 + M: Hyong-Youb Kim <hykim@myri.com> 5585 5580 L: netdev@vger.kernel.org 5586 - W: http://www.myri.com/scs/download-Myri10GE.html 5581 + W: https://www.myricom.com/support/downloads/myri10ge.html 5587 5582 S: Supported 5588 5583 F: drivers/net/ethernet/myricom/myri10ge/ 5589 5584 ··· 8669 8664 T: git git://git.alsa-project.org/alsa-kernel.git 8670 8665 S: Maintained 8671 8666 F: sound/usb/midi.* 8667 + 8668 + USB NETWORKING DRIVERS 8669 + L: linux-usb@vger.kernel.org 8670 + S: Odd Fixes 8671 + F: drivers/net/usb/ 8672 8672 8673 8673 USB OHCI DRIVER 8674 8674 M: Alan Stern <stern@rowland.harvard.edu>
+1 -1
Makefile
··· 1 1 VERSION = 3 2 2 PATCHLEVEL = 11 3 3 SUBLEVEL = 0 4 - EXTRAVERSION = -rc3 4 + EXTRAVERSION = -rc5 5 5 NAME = Linux for Workgroups 6 6 7 7 # *DOCUMENTATION*
+6
arch/Kconfig
··· 407 407 help 408 408 Architecture has the first two arguments of clone(2) swapped. 409 409 410 + config CLONE_BACKWARDS3 411 + bool 412 + help 413 + Architecture has tls passed as the 3rd argument of clone(2), 414 + not the 5th one. 415 + 410 416 config ODD_RT_SIGACTION 411 417 bool 412 418 help
+2 -2
arch/arm/boot/dts/msm8960-cdp.dts
··· 26 26 cpu-offset = <0x80000>; 27 27 }; 28 28 29 - msmgpio: gpio@fd510000 { 29 + msmgpio: gpio@800000 { 30 30 compatible = "qcom,msm-gpio"; 31 31 gpio-controller; 32 32 #gpio-cells = <2>; ··· 34 34 interrupts = <0 32 0x4>; 35 35 interrupt-controller; 36 36 #interrupt-cells = <2>; 37 - reg = <0xfd510000 0x4000>; 37 + reg = <0x800000 0x4000>; 38 38 }; 39 39 40 40 serial@16440000 {
+49 -29
arch/arm/boot/dts/omap5-uevm.dts
··· 235 235 }; 236 236 237 237 &mmc1 { 238 - vmmc-supply = <&vmmcsd_fixed>; 238 + vmmc-supply = <&ldo9_reg>; 239 239 bus-width = <4>; 240 240 }; 241 241 ··· 282 282 283 283 regulators { 284 284 smps123_reg: smps123 { 285 + /* VDD_OPP_MPU */ 285 286 regulator-name = "smps123"; 286 287 regulator-min-microvolt = < 600000>; 287 288 regulator-max-microvolt = <1500000>; ··· 291 290 }; 292 291 293 292 smps45_reg: smps45 { 293 + /* VDD_OPP_MM */ 294 294 regulator-name = "smps45"; 295 295 regulator-min-microvolt = < 600000>; 296 296 regulator-max-microvolt = <1310000>; ··· 300 298 }; 301 299 302 300 smps6_reg: smps6 { 301 + /* VDD_DDR3 - over VDD_SMPS6 */ 303 302 regulator-name = "smps6"; 304 303 regulator-min-microvolt = <1200000>; 305 304 regulator-max-microvolt = <1200000>; ··· 309 306 }; 310 307 311 308 smps7_reg: smps7 { 309 + /* VDDS_1v8_OMAP over VDDS_1v8_MAIN */ 312 310 regulator-name = "smps7"; 313 311 regulator-min-microvolt = <1800000>; 314 312 regulator-max-microvolt = <1800000>; ··· 318 314 }; 319 315 320 316 smps8_reg: smps8 { 317 + /* VDD_OPP_CORE */ 321 318 regulator-name = "smps8"; 322 319 regulator-min-microvolt = < 600000>; 323 320 regulator-max-microvolt = <1310000>; ··· 327 322 }; 328 323 329 324 smps9_reg: smps9 { 325 + /* VDDA_2v1_AUD over VDD_2v1 */ 330 326 regulator-name = "smps9"; 331 327 regulator-min-microvolt = <2100000>; 332 328 regulator-max-microvolt = <2100000>; 333 - regulator-always-on; 334 - regulator-boot-on; 335 329 ti,smps-range = <0x80>; 336 330 }; 337 331 338 332 smps10_reg: smps10 { 333 + /* VBUS_5V_OTG */ 339 334 regulator-name = "smps10"; 340 335 regulator-min-microvolt = <5000000>; 341 336 regulator-max-microvolt = <5000000>; ··· 344 339 }; 345 340 346 341 ldo1_reg: ldo1 { 342 + /* VDDAPHY_CAM: vdda_csiport */ 347 343 regulator-name = "ldo1"; 348 - regulator-min-microvolt = <2800000>; 349 - regulator-max-microvolt = <2800000>; 350 - regulator-always-on; 351 - regulator-boot-on; 344 + regulator-min-microvolt = <1500000>; 345 + regulator-max-microvolt = <1800000>; 352 346 }; 353 347 354 348 ldo2_reg: ldo2 { 349 + /* VCC_2V8_DISP: Does not go anywhere */ 355 350 regulator-name = "ldo2"; 356 - regulator-min-microvolt = <2900000>; 357 - regulator-max-microvolt = <2900000>; 358 - regulator-always-on; 359 - regulator-boot-on; 351 + regulator-min-microvolt = <2800000>; 352 + regulator-max-microvolt = <2800000>; 353 + /* Unused */ 354 + status = "disabled"; 360 355 }; 361 356 362 357 ldo3_reg: ldo3 { 358 + /* VDDAPHY_MDM: vdda_lli */ 363 359 regulator-name = "ldo3"; 364 - regulator-min-microvolt = <3000000>; 365 - regulator-max-microvolt = <3000000>; 366 - regulator-always-on; 360 + regulator-min-microvolt = <1500000>; 361 + regulator-max-microvolt = <1500000>; 367 362 regulator-boot-on; 363 + /* Only if Modem is used */ 364 + status = "disabled"; 368 365 }; 369 366 370 367 ldo4_reg: ldo4 { 368 + /* VDDAPHY_DISP: vdda_dsiport/hdmi */ 371 369 regulator-name = "ldo4"; 372 - regulator-min-microvolt = <2200000>; 373 - regulator-max-microvolt = <2200000>; 374 - regulator-always-on; 375 - regulator-boot-on; 370 + regulator-min-microvolt = <1500000>; 371 + regulator-max-microvolt = <1800000>; 376 372 }; 377 373 378 374 ldo5_reg: ldo5 { 375 + /* VDDA_1V8_PHY: usb/sata/hdmi.. */ 379 376 regulator-name = "ldo5"; 380 377 regulator-min-microvolt = <1800000>; 381 378 regulator-max-microvolt = <1800000>; ··· 386 379 }; 387 380 388 381 ldo6_reg: ldo6 { 382 + /* VDDS_1V2_WKUP: hsic/ldo_emu_wkup */ 389 383 regulator-name = "ldo6"; 390 - regulator-min-microvolt = <1500000>; 391 - regulator-max-microvolt = <1500000>; 384 + regulator-min-microvolt = <1200000>; 385 + regulator-max-microvolt = <1200000>; 392 386 regulator-always-on; 393 387 regulator-boot-on; 394 388 }; 395 389 396 390 ldo7_reg: ldo7 { 391 + /* VDD_VPP: vpp1 */ 397 392 regulator-name = "ldo7"; 398 - regulator-min-microvolt = <1500000>; 399 - regulator-max-microvolt = <1500000>; 400 - regulator-always-on; 401 - regulator-boot-on; 393 + regulator-min-microvolt = <2000000>; 394 + regulator-max-microvolt = <2000000>; 395 + /* Only for efuse reprograming! */ 396 + status = "disabled"; 402 397 }; 403 398 404 399 ldo8_reg: ldo8 { 400 + /* VDD_3v0: Does not go anywhere */ 405 401 regulator-name = "ldo8"; 406 - regulator-min-microvolt = <1500000>; 407 - regulator-max-microvolt = <1500000>; 408 - regulator-always-on; 402 + regulator-min-microvolt = <3000000>; 403 + regulator-max-microvolt = <3000000>; 409 404 regulator-boot-on; 405 + /* Unused */ 406 + status = "disabled"; 410 407 }; 411 408 412 409 ldo9_reg: ldo9 { 410 + /* VCC_DV_SDIO: vdds_sdcard */ 413 411 regulator-name = "ldo9"; 414 412 regulator-min-microvolt = <1800000>; 415 - regulator-max-microvolt = <3300000>; 416 - regulator-always-on; 413 + regulator-max-microvolt = <3000000>; 417 414 regulator-boot-on; 418 415 }; 419 416 420 417 ldoln_reg: ldoln { 418 + /* VDDA_1v8_REF: vdds_osc/mm_l4per.. */ 421 419 regulator-name = "ldoln"; 422 420 regulator-min-microvolt = <1800000>; 423 421 regulator-max-microvolt = <1800000>; ··· 431 419 }; 432 420 433 421 ldousb_reg: ldousb { 422 + /* VDDA_3V_USB: VDDA_USBHS33 */ 434 423 regulator-name = "ldousb"; 435 424 regulator-min-microvolt = <3250000>; 436 425 regulator-max-microvolt = <3250000>; 426 + regulator-always-on; 427 + regulator-boot-on; 428 + }; 429 + 430 + regen3_reg: regen3 { 431 + /* REGEN3 controls LDO9 supply to card */ 432 + regulator-name = "regen3"; 437 433 regulator-always-on; 438 434 regulator-boot-on; 439 435 };
+2
arch/arm/boot/dts/stih41x.dtsi
··· 6 6 #address-cells = <1>; 7 7 #size-cells = <0>; 8 8 cpu@0 { 9 + device_type = "cpu"; 9 10 compatible = "arm,cortex-a9"; 10 11 reg = <0>; 11 12 }; 12 13 cpu@1 { 14 + device_type = "cpu"; 13 15 compatible = "arm,cortex-a9"; 14 16 reg = <1>; 15 17 };
+1
arch/arm/boot/dts/tegra20-colibri-512.dtsi
··· 457 457 }; 458 458 459 459 usb-phy@c5004000 { 460 + status = "okay"; 460 461 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1) 461 462 GPIO_ACTIVE_LOW>; 462 463 };
+5 -2
arch/arm/include/asm/tlb.h
··· 43 43 struct mm_struct *mm; 44 44 unsigned int fullmm; 45 45 struct vm_area_struct *vma; 46 + unsigned long start, end; 46 47 unsigned long range_start; 47 48 unsigned long range_end; 48 49 unsigned int nr; ··· 108 107 } 109 108 110 109 static inline void 111 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int fullmm) 110 + tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 112 111 { 113 112 tlb->mm = mm; 114 - tlb->fullmm = fullmm; 113 + tlb->fullmm = !(start | (end+1)); 114 + tlb->start = start; 115 + tlb->end = end; 115 116 tlb->vma = NULL; 116 117 tlb->max = ARRAY_SIZE(tlb->local); 117 118 tlb->pages = tlb->local;
+6 -1
arch/arm/kernel/perf_event.c
··· 53 53 static int 54 54 armpmu_map_hw_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config) 55 55 { 56 - int mapping = (*event_map)[config]; 56 + int mapping; 57 + 58 + if (config >= PERF_COUNT_HW_MAX) 59 + return -ENOENT; 60 + 61 + mapping = (*event_map)[config]; 57 62 return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping; 58 63 } 59 64
+1 -2
arch/arm/mach-msm/Kconfig
··· 121 121 bool 122 122 123 123 config MSM_GPIOMUX 124 - depends on !(ARCH_MSM8X60 || ARCH_MSM8960) 125 - bool "MSM V1 TLMM GPIOMUX architecture" 124 + bool 126 125 help 127 126 Support for MSM V1 TLMM GPIOMUX architecture. 128 127
-33
arch/arm/mach-msm/gpiomux-v1.c
··· 1 - /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - */ 17 - #include <linux/kernel.h> 18 - #include "gpiomux.h" 19 - #include "proc_comm.h" 20 - 21 - void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val) 22 - { 23 - unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) | 24 - ((gpio & 0x3ff) << 4); 25 - unsigned tlmm_disable = 0; 26 - int rc; 27 - 28 - rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, 29 - &tlmm_config, &tlmm_disable); 30 - if (rc) 31 - pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n", 32 - __func__, rc, tlmm_config, tlmm_disable); 33 - }
-10
arch/arm/mach-msm/gpiomux.h
··· 73 73 int msm_gpiomux_write(unsigned gpio, 74 74 gpiomux_config_t active, 75 75 gpiomux_config_t suspended); 76 - 77 - /* Architecture-internal function for use by the framework only. 78 - * This function can assume the following: 79 - * - the gpio value has passed a bounds-check 80 - * - the gpiomux spinlock has been obtained 81 - * 82 - * This function is not for public consumption. External users 83 - * should use msm_gpiomux_write. 84 - */ 85 - void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val); 86 76 #else 87 77 static inline int msm_gpiomux_write(unsigned gpio, 88 78 gpiomux_config_t active,
+1 -1
arch/arm/mach-omap2/dss-common.c
··· 42 42 43 43 /* Using generic display panel */ 44 44 static struct tfp410_platform_data omap4_dvi_panel = { 45 - .i2c_bus_num = 3, 45 + .i2c_bus_num = 2, 46 46 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, 47 47 }; 48 48
+18
arch/arm/mach-omap2/omap_device.c
··· 129 129 struct device_node *node = pdev->dev.of_node; 130 130 const char *oh_name; 131 131 int oh_cnt, i, ret = 0; 132 + bool device_active = false; 132 133 133 134 oh_cnt = of_property_count_strings(node, "ti,hwmods"); 134 135 if (oh_cnt <= 0) { ··· 153 152 goto odbfd_exit1; 154 153 } 155 154 hwmods[i] = oh; 155 + if (oh->flags & HWMOD_INIT_NO_IDLE) 156 + device_active = true; 156 157 } 157 158 158 159 od = omap_device_alloc(pdev, hwmods, oh_cnt); ··· 174 171 } 175 172 176 173 pdev->dev.pm_domain = &omap_device_pm_domain; 174 + 175 + if (device_active) { 176 + omap_device_enable(pdev); 177 + pm_runtime_set_active(&pdev->dev); 178 + } 177 179 178 180 odbfd_exit1: 179 181 kfree(hwmods); ··· 850 842 { 851 843 struct platform_device *pdev = to_platform_device(dev); 852 844 struct omap_device *od = to_omap_device(pdev); 845 + int i; 853 846 854 847 if (!od) 855 848 return 0; ··· 859 850 * If omap_device state is enabled, but has no driver bound, 860 851 * idle it. 861 852 */ 853 + 854 + /* 855 + * Some devices (like memory controllers) are always kept 856 + * enabled, and should not be idled even with no drivers. 857 + */ 858 + for (i = 0; i < od->hwmods_cnt; i++) 859 + if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) 860 + return 0; 861 + 862 862 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) { 863 863 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { 864 864 dev_warn(dev, "%s: enabled but no driver. Idling\n",
+1 -1
arch/arm/mach-omap2/omap_hwmod.c
··· 2386 2386 2387 2387 np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); 2388 2388 if (np) 2389 - va_start = of_iomap(np, 0); 2389 + va_start = of_iomap(np, oh->mpu_rt_idx); 2390 2390 } else { 2391 2391 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); 2392 2392 }
+50
arch/arm/mach-omap2/omap_hwmod.h
··· 95 95 #define MODULEMODE_HWCTRL 1 96 96 #define MODULEMODE_SWCTRL 2 97 97 98 + #define DEBUG_OMAP2UART1_FLAGS 0 99 + #define DEBUG_OMAP2UART2_FLAGS 0 100 + #define DEBUG_OMAP2UART3_FLAGS 0 101 + #define DEBUG_OMAP3UART3_FLAGS 0 102 + #define DEBUG_OMAP3UART4_FLAGS 0 103 + #define DEBUG_OMAP4UART3_FLAGS 0 104 + #define DEBUG_OMAP4UART4_FLAGS 0 105 + #define DEBUG_TI81XXUART1_FLAGS 0 106 + #define DEBUG_TI81XXUART2_FLAGS 0 107 + #define DEBUG_TI81XXUART3_FLAGS 0 108 + #define DEBUG_AM33XXUART1_FLAGS 0 109 + 110 + #define DEBUG_OMAPUART_FLAGS (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET) 111 + 112 + #if defined(CONFIG_DEBUG_OMAP2UART1) 113 + #undef DEBUG_OMAP2UART1_FLAGS 114 + #define DEBUG_OMAP2UART1_FLAGS DEBUG_OMAPUART_FLAGS 115 + #elif defined(CONFIG_DEBUG_OMAP2UART2) 116 + #undef DEBUG_OMAP2UART2_FLAGS 117 + #define DEBUG_OMAP2UART2_FLAGS DEBUG_OMAPUART_FLAGS 118 + #elif defined(CONFIG_DEBUG_OMAP2UART3) 119 + #undef DEBUG_OMAP2UART3_FLAGS 120 + #define DEBUG_OMAP2UART3_FLAGS DEBUG_OMAPUART_FLAGS 121 + #elif defined(CONFIG_DEBUG_OMAP3UART3) 122 + #undef DEBUG_OMAP3UART3_FLAGS 123 + #define DEBUG_OMAP3UART3_FLAGS DEBUG_OMAPUART_FLAGS 124 + #elif defined(CONFIG_DEBUG_OMAP3UART4) 125 + #undef DEBUG_OMAP3UART4_FLAGS 126 + #define DEBUG_OMAP3UART4_FLAGS DEBUG_OMAPUART_FLAGS 127 + #elif defined(CONFIG_DEBUG_OMAP4UART3) 128 + #undef DEBUG_OMAP4UART3_FLAGS 129 + #define DEBUG_OMAP4UART3_FLAGS DEBUG_OMAPUART_FLAGS 130 + #elif defined(CONFIG_DEBUG_OMAP4UART4) 131 + #undef DEBUG_OMAP4UART4_FLAGS 132 + #define DEBUG_OMAP4UART4_FLAGS DEBUG_OMAPUART_FLAGS 133 + #elif defined(CONFIG_DEBUG_TI81XXUART1) 134 + #undef DEBUG_TI81XXUART1_FLAGS 135 + #define DEBUG_TI81XXUART1_FLAGS DEBUG_OMAPUART_FLAGS 136 + #elif defined(CONFIG_DEBUG_TI81XXUART2) 137 + #undef DEBUG_TI81XXUART2_FLAGS 138 + #define DEBUG_TI81XXUART2_FLAGS DEBUG_OMAPUART_FLAGS 139 + #elif defined(CONFIG_DEBUG_TI81XXUART3) 140 + #undef DEBUG_TI81XXUART3_FLAGS 141 + #define DEBUG_TI81XXUART3_FLAGS DEBUG_OMAPUART_FLAGS 142 + #elif defined(CONFIG_DEBUG_AM33XXUART1) 143 + #undef DEBUG_AM33XXUART1_FLAGS 144 + #define DEBUG_AM33XXUART1_FLAGS DEBUG_OMAPUART_FLAGS 145 + #endif 98 146 99 147 /** 100 148 * struct omap_hwmod_mux_info - hwmod specific mux configuration ··· 616 568 * @voltdm: pointer to voltage domain (filled in at runtime) 617 569 * @dev_attr: arbitrary device attributes that can be passed to the driver 618 570 * @_sysc_cache: internal-use hwmod flags 571 + * @mpu_rt_idx: index of device address space for register target (for DT boot) 619 572 * @_mpu_rt_va: cached register target start address (internal use) 620 573 * @_mpu_port: cached MPU register target slave (internal use) 621 574 * @opt_clks_cnt: number of @opt_clks ··· 666 617 struct list_head node; 667 618 struct omap_hwmod_ocp_if *_mpu_port; 668 619 u16 flags; 620 + u8 mpu_rt_idx; 669 621 u8 response_lat; 670 622 u8 rst_lines_cnt; 671 623 u8 opt_clks_cnt;
+3 -3
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
··· 512 512 .mpu_irqs = omap2_uart1_mpu_irqs, 513 513 .sdma_reqs = omap2_uart1_sdma_reqs, 514 514 .main_clk = "uart1_fck", 515 - .flags = HWMOD_SWSUP_SIDLE_ACT, 515 + .flags = DEBUG_OMAP2UART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 516 516 .prcm = { 517 517 .omap2 = { 518 518 .module_offs = CORE_MOD, ··· 532 532 .mpu_irqs = omap2_uart2_mpu_irqs, 533 533 .sdma_reqs = omap2_uart2_sdma_reqs, 534 534 .main_clk = "uart2_fck", 535 - .flags = HWMOD_SWSUP_SIDLE_ACT, 535 + .flags = DEBUG_OMAP2UART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 536 536 .prcm = { 537 537 .omap2 = { 538 538 .module_offs = CORE_MOD, ··· 552 552 .mpu_irqs = omap2_uart3_mpu_irqs, 553 553 .sdma_reqs = omap2_uart3_sdma_reqs, 554 554 .main_clk = "uart3_fck", 555 - .flags = HWMOD_SWSUP_SIDLE_ACT, 555 + .flags = DEBUG_OMAP2UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 556 556 .prcm = { 557 557 .omap2 = { 558 558 .module_offs = CORE_MOD,
+2 -1
arch/arm/mach-omap2/omap_hwmod_33xx_data.c
··· 562 562 .clkdm_name = "cpsw_125mhz_clkdm", 563 563 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), 564 564 .main_clk = "cpsw_125mhz_gclk", 565 + .mpu_rt_idx = 1, 565 566 .prcm = { 566 567 .omap4 = { 567 568 .clkctrl_offs = AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET, ··· 1513 1512 .name = "uart1", 1514 1513 .class = &uart_class, 1515 1514 .clkdm_name = "l4_wkup_clkdm", 1516 - .flags = HWMOD_SWSUP_SIDLE_ACT, 1515 + .flags = DEBUG_AM33XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 1517 1516 .main_clk = "dpll_per_m2_div4_wkupdm_ck", 1518 1517 .prcm = { 1519 1518 .omap4 = {
+5 -4
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
··· 490 490 .mpu_irqs = omap2_uart1_mpu_irqs, 491 491 .sdma_reqs = omap2_uart1_sdma_reqs, 492 492 .main_clk = "uart1_fck", 493 - .flags = HWMOD_SWSUP_SIDLE_ACT, 493 + .flags = DEBUG_TI81XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 494 494 .prcm = { 495 495 .omap2 = { 496 496 .module_offs = CORE_MOD, ··· 509 509 .mpu_irqs = omap2_uart2_mpu_irqs, 510 510 .sdma_reqs = omap2_uart2_sdma_reqs, 511 511 .main_clk = "uart2_fck", 512 - .flags = HWMOD_SWSUP_SIDLE_ACT, 512 + .flags = DEBUG_TI81XXUART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 513 513 .prcm = { 514 514 .omap2 = { 515 515 .module_offs = CORE_MOD, ··· 528 528 .mpu_irqs = omap2_uart3_mpu_irqs, 529 529 .sdma_reqs = omap2_uart3_sdma_reqs, 530 530 .main_clk = "uart3_fck", 531 - .flags = HWMOD_SWSUP_SIDLE_ACT, 531 + .flags = DEBUG_OMAP3UART3_FLAGS | DEBUG_TI81XXUART3_FLAGS | 532 + HWMOD_SWSUP_SIDLE_ACT, 532 533 .prcm = { 533 534 .omap2 = { 534 535 .module_offs = OMAP3430_PER_MOD, ··· 559 558 .mpu_irqs = uart4_mpu_irqs, 560 559 .sdma_reqs = uart4_sdma_reqs, 561 560 .main_clk = "uart4_fck", 562 - .flags = HWMOD_SWSUP_SIDLE_ACT, 561 + .flags = DEBUG_OMAP3UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 563 562 .prcm = { 564 563 .omap2 = { 565 564 .module_offs = OMAP3430_PER_MOD,
+2 -3
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
··· 2858 2858 .name = "uart3", 2859 2859 .class = &omap44xx_uart_hwmod_class, 2860 2860 .clkdm_name = "l4_per_clkdm", 2861 - .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET | 2862 - HWMOD_SWSUP_SIDLE_ACT, 2861 + .flags = DEBUG_OMAP4UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 2863 2862 .main_clk = "func_48m_fclk", 2864 2863 .prcm = { 2865 2864 .omap4 = { ··· 2874 2875 .name = "uart4", 2875 2876 .class = &omap44xx_uart_hwmod_class, 2876 2877 .clkdm_name = "l4_per_clkdm", 2877 - .flags = HWMOD_SWSUP_SIDLE_ACT, 2878 + .flags = DEBUG_OMAP4UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 2878 2879 .main_clk = "func_48m_fclk", 2879 2880 .prcm = { 2880 2881 .omap4 = {
+2 -1
arch/arm/mach-omap2/omap_hwmod_54xx_data.c
··· 1375 1375 .name = "uart3", 1376 1376 .class = &omap54xx_uart_hwmod_class, 1377 1377 .clkdm_name = "l4per_clkdm", 1378 - .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 1378 + .flags = DEBUG_OMAP4UART3_FLAGS, 1379 1379 .main_clk = "func_48m_fclk", 1380 1380 .prcm = { 1381 1381 .omap4 = { ··· 1391 1391 .name = "uart4", 1392 1392 .class = &omap54xx_uart_hwmod_class, 1393 1393 .clkdm_name = "l4per_clkdm", 1394 + .flags = DEBUG_OMAP4UART4_FLAGS, 1394 1395 .main_clk = "func_48m_fclk", 1395 1396 .prcm = { 1396 1397 .omap4 = {
-11
arch/arm/mach-omap2/serial.c
··· 208 208 pr_info("%s used as console in debug mode: uart%d clocks will not be gated", 209 209 uart_name, uart->num); 210 210 } 211 - 212 - /* 213 - * omap-uart can be used for earlyprintk logs 214 - * So if omap-uart is used as console then prevent 215 - * uart reset and idle to get logs from omap-uart 216 - * until uart console driver is available to take 217 - * care for console messages. 218 - * Idling or resetting omap-uart while printing logs 219 - * early boot logs can stall the boot-up. 220 - */ 221 - oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET; 222 211 } 223 212 } while (1); 224 213
-3
arch/arm/mach-shmobile/board-armadillo800eva.c
··· 1162 1162 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1163 1163 gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */ 1164 1164 1165 - /* Touchscreen */ 1166 - gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */ 1167 - 1168 1165 /* GETHER */ 1169 1166 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ 1170 1167
+7 -1
arch/arm/mach-shmobile/board-bockw.c
··· 167 167 "usb1", "usb1"), 168 168 /* SDHI0 */ 169 169 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", 170 - "sdhi0", "sdhi0"), 170 + "sdhi0_data4", "sdhi0"), 171 + PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", 172 + "sdhi0_ctrl", "sdhi0"), 173 + PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", 174 + "sdhi0_cd", "sdhi0"), 175 + PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778", 176 + "sdhi0_wp", "sdhi0"), 171 177 }; 172 178 173 179 #define FPGA 0x18200000
+1 -1
arch/arm/mach-shmobile/board-lager.c
··· 59 59 #define GPIO_KEY(c, g, d, ...) \ 60 60 { .code = c, .gpio = g, .desc = d, .active_low = 1 } 61 61 62 - static __initdata struct gpio_keys_button gpio_buttons[] = { 62 + static struct gpio_keys_button gpio_buttons[] = { 63 63 GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"), 64 64 GPIO_KEY(KEY_3, RCAR_GP_PIN(1, 26), "SW2-pin3"), 65 65 GPIO_KEY(KEY_2, RCAR_GP_PIN(1, 24), "SW2-pin2"),
-2
arch/arm/mach-sti/headsmp.S
··· 16 16 #include <linux/linkage.h> 17 17 #include <linux/init.h> 18 18 19 - __INIT 20 - 21 19 /* 22 20 * ST specific entry point for secondary CPUs. This provides 23 21 * a "holding pen" into which all secondary cores are held until we're
+5 -2
arch/arm64/include/asm/tlb.h
··· 35 35 struct mm_struct *mm; 36 36 unsigned int fullmm; 37 37 struct vm_area_struct *vma; 38 + unsigned long start, end; 38 39 unsigned long range_start; 39 40 unsigned long range_end; 40 41 unsigned int nr; ··· 98 97 } 99 98 100 99 static inline void 101 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int fullmm) 100 + tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 102 101 { 103 102 tlb->mm = mm; 104 - tlb->fullmm = fullmm; 103 + tlb->fullmm = !(start | (end+1)); 104 + tlb->start = start; 105 + tlb->end = end; 105 106 tlb->vma = NULL; 106 107 tlb->max = ARRAY_SIZE(tlb->local); 107 108 tlb->pages = tlb->local;
-1
arch/avr32/boards/atngw100/mrmt.c
··· 150 150 static struct platform_device rmt_ts_device = { 151 151 .name = "ucb1400_ts", 152 152 .id = -1, 153 - } 154 153 }; 155 154 #endif 156 155
+1
arch/hexagon/Kconfig
··· 158 158 endmenu 159 159 160 160 source "init/Kconfig" 161 + source "kernel/Kconfig.freezer" 161 162 source "drivers/Kconfig" 162 163 source "fs/Kconfig" 163 164
+6 -3
arch/ia64/include/asm/tlb.h
··· 22 22 * unmapping a portion of the virtual address space, these hooks are called according to 23 23 * the following template: 24 24 * 25 - * tlb <- tlb_gather_mmu(mm, full_mm_flush); // start unmap for address space MM 25 + * tlb <- tlb_gather_mmu(mm, start, end); // start unmap for address space MM 26 26 * { 27 27 * for each vma that needs a shootdown do { 28 28 * tlb_start_vma(tlb, vma); ··· 58 58 unsigned int max; 59 59 unsigned char fullmm; /* non-zero means full mm flush */ 60 60 unsigned char need_flush; /* really unmapped some PTEs? */ 61 + unsigned long start, end; 61 62 unsigned long start_addr; 62 63 unsigned long end_addr; 63 64 struct page **pages; ··· 156 155 157 156 158 157 static inline void 159 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int full_mm_flush) 158 + tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 160 159 { 161 160 tlb->mm = mm; 162 161 tlb->max = ARRAY_SIZE(tlb->local); 163 162 tlb->pages = tlb->local; 164 163 tlb->nr = 0; 165 - tlb->fullmm = full_mm_flush; 164 + tlb->fullmm = !(start | (end+1)); 165 + tlb->start = start; 166 + tlb->end = end; 166 167 tlb->start_addr = ~0UL; 167 168 } 168 169
+1 -1
arch/microblaze/Kconfig
··· 28 28 select GENERIC_CLOCKEVENTS 29 29 select GENERIC_IDLE_POLL_SETUP 30 30 select MODULES_USE_ELF_RELA 31 - select CLONE_BACKWARDS 31 + select CLONE_BACKWARDS3 32 32 33 33 config SWAP 34 34 def_bool n
+2
arch/mips/include/asm/cpu-features.h
··· 17 17 #define current_cpu_type() current_cpu_data.cputype 18 18 #endif 19 19 20 + #define boot_cpu_type() cpu_data[0].cputype 21 + 20 22 /* 21 23 * SMP assumption: Options of CPU 0 are a superset of all processors. 22 24 * This is true for all known MIPS systems.
+8 -2
arch/mips/kernel/smp-bmips.c
··· 66 66 int i, cpu = 1, boot_cpu = 0; 67 67 68 68 #if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 69 + int cpu_hw_intr; 70 + 69 71 /* arbitration priority */ 70 72 clear_c0_brcm_cmt_ctrl(0x30); 71 73 ··· 82 80 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output 83 81 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output 84 82 */ 85 - change_c0_brcm_cmt_intr(0xf8018000, 86 - (0x02 << 27) | (0x03 << 15)); 83 + if (boot_cpu == 0) 84 + cpu_hw_intr = 0x02; 85 + else 86 + cpu_hw_intr = 0x1d; 87 + 88 + change_c0_brcm_cmt_intr(0xf8018000, (cpu_hw_intr << 27) | (0x03 << 15)); 87 89 88 90 /* single core, 2 threads (2 pipelines) */ 89 91 max_cpus = 2;
+1 -1
arch/mips/oprofile/op_model_mipsxx.c
··· 166 166 reg.control[i] |= M_PERFCTL_USER; 167 167 if (ctr[i].exl) 168 168 reg.control[i] |= M_PERFCTL_EXL; 169 - if (current_cpu_type() == CPU_XLR) 169 + if (boot_cpu_type() == CPU_XLR) 170 170 reg.control[i] |= M_PERFCTL_COUNT_ALL_THREADS; 171 171 reg.counter[i] = 0x80000000 - ctr[i].count; 172 172 }
+2
arch/mips/pnx833x/common/platform.c
··· 206 206 .end = PNX8335_IP3902_PORTS_END, 207 207 .flags = IORESOURCE_MEM, 208 208 }, 209 + #ifdef CONFIG_SOC_PNX8335 209 210 [1] = { 210 211 .start = PNX8335_PIC_ETHERNET_INT, 211 212 .end = PNX8335_PIC_ETHERNET_INT, 212 213 .flags = IORESOURCE_IRQ, 213 214 }, 215 + #endif 214 216 }; 215 217 216 218 static struct platform_device pnx833x_ethernet_device = {
+1
arch/openrisc/Kconfig
··· 55 55 56 56 source "init/Kconfig" 57 57 58 + source "kernel/Kconfig.freezer" 58 59 59 60 menu "Processor type and features" 60 61
+1 -1
arch/powerpc/Kconfig
··· 566 566 config PPC_DENORMALISATION 567 567 bool "PowerPC denormalisation exception handling" 568 568 depends on PPC_BOOK3S_64 569 - default "n" 569 + default "y" if PPC_POWERNV 570 570 ---help--- 571 571 Add support for handling denormalisation of single precision 572 572 values. Useful for bare metal only. If unsure say Y here.
+4
arch/powerpc/include/asm/processor.h
··· 247 247 unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */ 248 248 struct pt_regs ckpt_regs; /* Checkpointed registers */ 249 249 250 + unsigned long tm_tar; 251 + unsigned long tm_ppr; 252 + unsigned long tm_dscr; 253 + 250 254 /* 251 255 * Transactional FP and VSX 0-31 register set. 252 256 * NOTE: the sense of these is the opposite of the integer ckpt_regs!
+20 -11
arch/powerpc/include/asm/reg.h
··· 254 254 #define SPRN_HRMOR 0x139 /* Real mode offset register */ 255 255 #define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */ 256 256 #define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */ 257 + /* HFSCR and FSCR bit numbers are the same */ 258 + #define FSCR_TAR_LG 8 /* Enable Target Address Register */ 259 + #define FSCR_EBB_LG 7 /* Enable Event Based Branching */ 260 + #define FSCR_TM_LG 5 /* Enable Transactional Memory */ 261 + #define FSCR_PM_LG 4 /* Enable prob/priv access to PMU SPRs */ 262 + #define FSCR_BHRB_LG 3 /* Enable Branch History Rolling Buffer*/ 263 + #define FSCR_DSCR_LG 2 /* Enable Data Stream Control Register */ 264 + #define FSCR_VECVSX_LG 1 /* Enable VMX/VSX */ 265 + #define FSCR_FP_LG 0 /* Enable Floating Point */ 257 266 #define SPRN_FSCR 0x099 /* Facility Status & Control Register */ 258 - #define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ 259 - #define FSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */ 260 - #define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ 267 + #define FSCR_TAR __MASK(FSCR_TAR_LG) 268 + #define FSCR_EBB __MASK(FSCR_EBB_LG) 269 + #define FSCR_DSCR __MASK(FSCR_DSCR_LG) 261 270 #define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */ 262 - #define HFSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ 263 - #define HFSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */ 264 - #define HFSCR_TM (1 << (63-58)) /* Enable Transactional Memory */ 265 - #define HFSCR_PM (1 << (63-60)) /* Enable prob/priv access to PMU SPRs */ 266 - #define HFSCR_BHRB (1 << (63-59)) /* Enable Branch History Rolling Buffer*/ 267 - #define HFSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ 268 - #define HFSCR_VECVSX (1 << (63-62)) /* Enable VMX/VSX */ 269 - #define HFSCR_FP (1 << (63-63)) /* Enable Floating Point */ 271 + #define HFSCR_TAR __MASK(FSCR_TAR_LG) 272 + #define HFSCR_EBB __MASK(FSCR_EBB_LG) 273 + #define HFSCR_TM __MASK(FSCR_TM_LG) 274 + #define HFSCR_PM __MASK(FSCR_PM_LG) 275 + #define HFSCR_BHRB __MASK(FSCR_BHRB_LG) 276 + #define HFSCR_DSCR __MASK(FSCR_DSCR_LG) 277 + #define HFSCR_VECVSX __MASK(FSCR_VECVSX_LG) 278 + #define HFSCR_FP __MASK(FSCR_FP_LG) 270 279 #define SPRN_TAR 0x32f /* Target Address Register */ 271 280 #define SPRN_LPCR 0x13E /* LPAR Control Register */ 272 281 #define LPCR_VPM0 (1ul << (63-0))
+9
arch/powerpc/include/asm/switch_to.h
··· 15 15 struct thread_struct; 16 16 extern struct task_struct *_switch(struct thread_struct *prev, 17 17 struct thread_struct *next); 18 + #ifdef CONFIG_PPC_BOOK3S_64 19 + static inline void save_tar(struct thread_struct *prev) 20 + { 21 + if (cpu_has_feature(CPU_FTR_ARCH_207S)) 22 + prev->tar = mfspr(SPRN_TAR); 23 + } 24 + #else 25 + static inline void save_tar(struct thread_struct *prev) {} 26 + #endif 18 27 19 28 extern void giveup_fpu(struct task_struct *); 20 29 extern void load_up_fpu(void);
+3
arch/powerpc/kernel/asm-offsets.c
··· 138 138 DEFINE(THREAD_TM_TFHAR, offsetof(struct thread_struct, tm_tfhar)); 139 139 DEFINE(THREAD_TM_TEXASR, offsetof(struct thread_struct, tm_texasr)); 140 140 DEFINE(THREAD_TM_TFIAR, offsetof(struct thread_struct, tm_tfiar)); 141 + DEFINE(THREAD_TM_TAR, offsetof(struct thread_struct, tm_tar)); 142 + DEFINE(THREAD_TM_PPR, offsetof(struct thread_struct, tm_ppr)); 143 + DEFINE(THREAD_TM_DSCR, offsetof(struct thread_struct, tm_dscr)); 141 144 DEFINE(PT_CKPT_REGS, offsetof(struct thread_struct, ckpt_regs)); 142 145 DEFINE(THREAD_TRANSACT_VR0, offsetof(struct thread_struct, 143 146 transact_vr[0]));
+1 -1
arch/powerpc/kernel/eeh.c
··· 1061 1061 1062 1062 static int __init eeh_init_proc(void) 1063 1063 { 1064 - if (machine_is(pseries)) 1064 + if (machine_is(pseries) || machine_is(powernv)) 1065 1065 proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations); 1066 1066 return 0; 1067 1067 }
+26 -10
arch/powerpc/kernel/entry_64.S
··· 449 449 450 450 #ifdef CONFIG_PPC_BOOK3S_64 451 451 BEGIN_FTR_SECTION 452 - /* 453 - * Back up the TAR across context switches. Note that the TAR is not 454 - * available for use in the kernel. (To provide this, the TAR should 455 - * be backed up/restored on exception entry/exit instead, and be in 456 - * pt_regs. FIXME, this should be in pt_regs anyway (for debug).) 457 - */ 458 - mfspr r0,SPRN_TAR 459 - std r0,THREAD_TAR(r3) 460 - 461 452 /* Event based branch registers */ 462 453 mfspr r0, SPRN_BESCR 463 454 std r0, THREAD_BESCR(r3) ··· 575 584 ld r7,DSCR_DEFAULT@toc(2) 576 585 ld r0,THREAD_DSCR(r4) 577 586 cmpwi r6,0 587 + li r8, FSCR_DSCR 578 588 bne 1f 579 589 ld r0,0(r7) 580 - 1: cmpd r0,r25 590 + b 3f 591 + 1: 592 + BEGIN_FTR_SECTION_NESTED(70) 593 + mfspr r6, SPRN_FSCR 594 + or r6, r6, r8 595 + mtspr SPRN_FSCR, r6 596 + BEGIN_FTR_SECTION_NESTED(69) 597 + mfspr r6, SPRN_HFSCR 598 + or r6, r6, r8 599 + mtspr SPRN_HFSCR, r6 600 + END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69) 601 + b 4f 602 + END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70) 603 + 3: 604 + BEGIN_FTR_SECTION_NESTED(70) 605 + mfspr r6, SPRN_FSCR 606 + andc r6, r6, r8 607 + mtspr SPRN_FSCR, r6 608 + BEGIN_FTR_SECTION_NESTED(69) 609 + mfspr r6, SPRN_HFSCR 610 + andc r6, r6, r8 611 + mtspr SPRN_HFSCR, r6 612 + END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69) 613 + END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70) 614 + 4: cmpd r0,r25 581 615 beq 2f 582 616 mtspr SPRN_DSCR,r0 583 617 2:
+3 -2
arch/powerpc/kernel/exceptions-64s.S
··· 848 848 . = 0x4f80 849 849 SET_SCRATCH0(r13) 850 850 EXCEPTION_PROLOG_0(PACA_EXGEN) 851 - b facility_unavailable_relon_hv 851 + b hv_facility_unavailable_relon_hv 852 852 853 853 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint) 854 854 #ifdef CONFIG_PPC_DENORMALISATION ··· 1175 1175 b .ret_from_except 1176 1176 1177 1177 STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception) 1178 + STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, .facility_unavailable_exception) 1178 1179 1179 1180 .align 7 1180 1181 .globl __end_handlers ··· 1189 1188 STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) 1190 1189 STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) 1191 1190 STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable) 1192 - STD_RELON_EXCEPTION_HV_OOL(0xf80, facility_unavailable) 1191 + STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable) 1193 1192 1194 1193 #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 1195 1194 /*
+10
arch/powerpc/kernel/process.c
··· 600 600 struct ppc64_tlb_batch *batch; 601 601 #endif 602 602 603 + /* Back up the TAR across context switches. 604 + * Note that the TAR is not available for use in the kernel. (To 605 + * provide this, the TAR should be backed up/restored on exception 606 + * entry/exit instead, and be in pt_regs. FIXME, this should be in 607 + * pt_regs anyway (for debug).) 608 + * Save the TAR here before we do treclaim/trecheckpoint as these 609 + * will change the TAR. 610 + */ 611 + save_tar(&prev->thread); 612 + 603 613 __switch_to_tm(prev); 604 614 605 615 #ifdef CONFIG_SMP
+20
arch/powerpc/kernel/tm.S
··· 233 233 std r5, _CCR(r7) 234 234 std r6, _XER(r7) 235 235 236 + 237 + /* ******************** TAR, PPR, DSCR ********** */ 238 + mfspr r3, SPRN_TAR 239 + mfspr r4, SPRN_PPR 240 + mfspr r5, SPRN_DSCR 241 + 242 + std r3, THREAD_TM_TAR(r12) 243 + std r4, THREAD_TM_PPR(r12) 244 + std r5, THREAD_TM_DSCR(r12) 245 + 236 246 /* MSR and flags: We don't change CRs, and we don't need to alter 237 247 * MSR. 238 248 */ ··· 357 347 mtmsr r6 /* FP/Vec off again! */ 358 348 359 349 restore_gprs: 350 + 351 + /* ******************** TAR, PPR, DSCR ********** */ 352 + ld r4, THREAD_TM_TAR(r3) 353 + ld r5, THREAD_TM_PPR(r3) 354 + ld r6, THREAD_TM_DSCR(r3) 355 + 356 + mtspr SPRN_TAR, r4 357 + mtspr SPRN_PPR, r5 358 + mtspr SPRN_DSCR, r6 359 + 360 360 /* ******************** CR,LR,CCR,MSR ********** */ 361 361 ld r3, _CTR(r7) 362 362 ld r4, _LINK(r7)
+34 -24
arch/powerpc/kernel/traps.c
··· 44 44 #include <asm/machdep.h> 45 45 #include <asm/rtas.h> 46 46 #include <asm/pmc.h> 47 - #ifdef CONFIG_PPC32 48 47 #include <asm/reg.h> 49 - #endif 50 48 #ifdef CONFIG_PMAC_BACKLIGHT 51 49 #include <asm/backlight.h> 52 50 #endif ··· 1294 1296 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT); 1295 1297 } 1296 1298 1299 + #ifdef CONFIG_PPC64 1297 1300 void facility_unavailable_exception(struct pt_regs *regs) 1298 1301 { 1299 1302 static char *facility_strings[] = { 1300 - "FPU", 1301 - "VMX/VSX", 1302 - "DSCR", 1303 - "PMU SPRs", 1304 - "BHRB", 1305 - "TM", 1306 - "AT", 1307 - "EBB", 1308 - "TAR", 1303 + [FSCR_FP_LG] = "FPU", 1304 + [FSCR_VECVSX_LG] = "VMX/VSX", 1305 + [FSCR_DSCR_LG] = "DSCR", 1306 + [FSCR_PM_LG] = "PMU SPRs", 1307 + [FSCR_BHRB_LG] = "BHRB", 1308 + [FSCR_TM_LG] = "TM", 1309 + [FSCR_EBB_LG] = "EBB", 1310 + [FSCR_TAR_LG] = "TAR", 1309 1311 }; 1310 - char *facility, *prefix; 1312 + char *facility = "unknown"; 1311 1313 u64 value; 1314 + u8 status; 1315 + bool hv; 1312 1316 1313 - if (regs->trap == 0xf60) { 1314 - value = mfspr(SPRN_FSCR); 1315 - prefix = ""; 1316 - } else { 1317 + hv = (regs->trap == 0xf80); 1318 + if (hv) 1317 1319 value = mfspr(SPRN_HFSCR); 1318 - prefix = "Hypervisor "; 1320 + else 1321 + value = mfspr(SPRN_FSCR); 1322 + 1323 + status = value >> 56; 1324 + if (status == FSCR_DSCR_LG) { 1325 + /* User is acessing the DSCR. Set the inherit bit and allow 1326 + * the user to set it directly in future by setting via the 1327 + * H/FSCR DSCR bit. 1328 + */ 1329 + current->thread.dscr_inherit = 1; 1330 + if (hv) 1331 + mtspr(SPRN_HFSCR, value | HFSCR_DSCR); 1332 + else 1333 + mtspr(SPRN_FSCR, value | FSCR_DSCR); 1334 + return; 1319 1335 } 1320 1336 1321 - value = value >> 56; 1337 + if ((status < ARRAY_SIZE(facility_strings)) && 1338 + facility_strings[status]) 1339 + facility = facility_strings[status]; 1322 1340 1323 1341 /* We restore the interrupt state now */ 1324 1342 if (!arch_irq_disabled_regs(regs)) 1325 1343 local_irq_enable(); 1326 1344 1327 - if (value < ARRAY_SIZE(facility_strings)) 1328 - facility = facility_strings[value]; 1329 - else 1330 - facility = "unknown"; 1331 - 1332 1345 pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n", 1333 - prefix, facility, regs->nip, regs->msr); 1346 + hv ? "Hypervisor " : "", facility, regs->nip, regs->msr); 1334 1347 1335 1348 if (user_mode(regs)) { 1336 1349 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); ··· 1350 1341 1351 1342 die("Unexpected facility unavailable exception", regs, SIGABRT); 1352 1343 } 1344 + #endif 1353 1345 1354 1346 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1355 1347
+2 -2
arch/powerpc/kvm/book3s_hv.c
··· 1809 1809 rma_size <<= PAGE_SHIFT; 1810 1810 rmls = lpcr_rmls(rma_size); 1811 1811 err = -EINVAL; 1812 - if (rmls < 0) { 1812 + if ((long)rmls < 0) { 1813 1813 pr_err("KVM: Can't use RMA of 0x%lx bytes\n", rma_size); 1814 1814 goto out_srcu; 1815 1815 } ··· 1874 1874 /* Allocate the guest's logical partition ID */ 1875 1875 1876 1876 lpid = kvmppc_alloc_lpid(); 1877 - if (lpid < 0) 1877 + if ((long)lpid < 0) 1878 1878 return -ENOMEM; 1879 1879 kvm->arch.lpid = lpid; 1880 1880
+3 -2
arch/powerpc/kvm/book3s_pr.c
··· 1047 1047 if (err) 1048 1048 goto free_shadow_vcpu; 1049 1049 1050 + err = -ENOMEM; 1050 1051 p = __get_free_page(GFP_KERNEL|__GFP_ZERO); 1051 - /* the real shared page fills the last 4k of our page */ 1052 - vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096); 1053 1052 if (!p) 1054 1053 goto uninit_vcpu; 1054 + /* the real shared page fills the last 4k of our page */ 1055 + vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096); 1055 1056 1056 1057 #ifdef CONFIG_PPC_BOOK3S_64 1057 1058 /* default to book3s_64 (970fx) */
+34 -46
arch/powerpc/platforms/pseries/nvram.c
··· 569 569 return ret; 570 570 } 571 571 572 - static int unzip_oops(char *oops_buf, char *big_buf) 573 - { 574 - struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf; 575 - u64 timestamp = oops_hdr->timestamp; 576 - char *big_oops_data = NULL; 577 - char *oops_data_buf = NULL; 578 - size_t big_oops_data_sz; 579 - int unzipped_len; 580 - 581 - big_oops_data = big_buf + sizeof(struct oops_log_info); 582 - big_oops_data_sz = big_oops_buf_sz - sizeof(struct oops_log_info); 583 - oops_data_buf = oops_buf + sizeof(struct oops_log_info); 584 - 585 - unzipped_len = nvram_decompress(oops_data_buf, big_oops_data, 586 - oops_hdr->report_length, 587 - big_oops_data_sz); 588 - 589 - if (unzipped_len < 0) { 590 - pr_err("nvram: decompression failed; returned %d\n", 591 - unzipped_len); 592 - return -1; 593 - } 594 - oops_hdr = (struct oops_log_info *)big_buf; 595 - oops_hdr->version = OOPS_HDR_VERSION; 596 - oops_hdr->report_length = (u16) unzipped_len; 597 - oops_hdr->timestamp = timestamp; 598 - return 0; 599 - } 600 - 601 572 static int nvram_pstore_open(struct pstore_info *psi) 602 573 { 603 574 /* Reset the iterator to start reading partitions again */ ··· 656 685 unsigned int err_type, id_no, size = 0; 657 686 struct nvram_os_partition *part = NULL; 658 687 char *buff = NULL, *big_buff = NULL; 659 - int rc, sig = 0; 688 + int sig = 0; 660 689 loff_t p; 661 690 662 - read_partition: 663 691 read_type++; 664 692 665 693 switch (nvram_type_ids[read_type]) { ··· 719 749 *id = id_no; 720 750 721 751 if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) { 752 + int length, unzipped_len; 753 + size_t hdr_size; 754 + 722 755 oops_hdr = (struct oops_log_info *)buff; 723 - *buf = buff + sizeof(*oops_hdr); 756 + if (oops_hdr->version < OOPS_HDR_VERSION) { 757 + /* Old format oops header had 2-byte record size */ 758 + hdr_size = sizeof(u16); 759 + length = oops_hdr->version; 760 + time->tv_sec = 0; 761 + time->tv_nsec = 0; 762 + } else { 763 + hdr_size = sizeof(*oops_hdr); 764 + length = oops_hdr->report_length; 765 + time->tv_sec = oops_hdr->timestamp; 766 + time->tv_nsec = 0; 767 + } 768 + *buf = kmalloc(length, GFP_KERNEL); 769 + if (*buf == NULL) 770 + return -ENOMEM; 771 + memcpy(*buf, buff + hdr_size, length); 772 + kfree(buff); 724 773 725 774 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) { 726 775 big_buff = kmalloc(big_oops_buf_sz, GFP_KERNEL); 727 776 if (!big_buff) 728 777 return -ENOMEM; 729 778 730 - rc = unzip_oops(buff, big_buff); 779 + unzipped_len = nvram_decompress(*buf, big_buff, 780 + length, big_oops_buf_sz); 731 781 732 - if (rc != 0) { 733 - kfree(buff); 782 + if (unzipped_len < 0) { 783 + pr_err("nvram: decompression failed, returned " 784 + "rc %d\n", unzipped_len); 734 785 kfree(big_buff); 735 - goto read_partition; 786 + } else { 787 + *buf = big_buff; 788 + length = unzipped_len; 736 789 } 737 - 738 - oops_hdr = (struct oops_log_info *)big_buff; 739 - *buf = big_buff + sizeof(*oops_hdr); 740 - kfree(buff); 741 790 } 742 - 743 - time->tv_sec = oops_hdr->timestamp; 744 - time->tv_nsec = 0; 745 - return oops_hdr->report_length; 791 + return length; 746 792 } 747 793 748 794 *buf = buff; ··· 802 816 static void __init nvram_init_oops_partition(int rtas_partition_exists) 803 817 { 804 818 int rc; 819 + size_t size; 805 820 806 821 rc = pseries_nvram_init_os_partition(&oops_log_partition); 807 822 if (rc != 0) { ··· 831 844 big_oops_buf_sz = (oops_data_sz * 100) / 45; 832 845 big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL); 833 846 if (big_oops_buf) { 834 - stream.workspace = kmalloc(zlib_deflate_workspacesize( 835 - WINDOW_BITS, MEM_LEVEL), GFP_KERNEL); 847 + size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL), 848 + zlib_inflate_workspacesize()); 849 + stream.workspace = kmalloc(size, GFP_KERNEL); 836 850 if (!stream.workspace) { 837 851 pr_err("nvram: No memory for compression workspace; " 838 852 "skipping compression of %s partition data\n",
+6 -3
arch/s390/Kconfig
··· 118 118 select HAVE_FUNCTION_TRACE_MCOUNT_TEST 119 119 select HAVE_KERNEL_BZIP2 120 120 select HAVE_KERNEL_GZIP 121 + select HAVE_KERNEL_LZ4 121 122 select HAVE_KERNEL_LZMA 122 123 select HAVE_KERNEL_LZO 123 124 select HAVE_KERNEL_XZ ··· 228 227 not work on older machines. 229 228 230 229 config MARCH_ZEC12 231 - bool "IBM zEC12" 230 + bool "IBM zBC12 and zEC12" 232 231 select HAVE_MARCH_ZEC12_FEATURES if 64BIT 233 232 help 234 - Select this to enable optimizations for IBM zEC12 (2827 series). The 235 - kernel will be slightly faster but will not work on older machines. 233 + Select this to enable optimizations for IBM zBC12 and zEC12 (2828 and 234 + 2827 series). The kernel will be slightly faster but will not work on 235 + older machines. 236 236 237 237 endchoice 238 238 ··· 711 709 def_bool y 712 710 prompt "s390 support for virtio devices" 713 711 depends on 64BIT 712 + select TTY 714 713 select VIRTUALIZATION 715 714 select VIRTIO 716 715 select VIRTIO_CONSOLE
+6 -3
arch/s390/boot/compressed/Makefile
··· 6 6 7 7 BITS := $(if $(CONFIG_64BIT),64,31) 8 8 9 - targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ 10 - vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo misc.o piggy.o \ 11 - sizes.h head$(BITS).o 9 + targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 10 + targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 11 + targets += misc.o piggy.o sizes.h head$(BITS).o 12 12 13 13 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 14 14 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING ··· 48 48 49 49 suffix-$(CONFIG_KERNEL_GZIP) := gz 50 50 suffix-$(CONFIG_KERNEL_BZIP2) := bz2 51 + suffix-$(CONFIG_KERNEL_LZ4) := lz4 51 52 suffix-$(CONFIG_KERNEL_LZMA) := lzma 52 53 suffix-$(CONFIG_KERNEL_LZO) := lzo 53 54 suffix-$(CONFIG_KERNEL_XZ) := xz ··· 57 56 $(call if_changed,gzip) 58 57 $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) 59 58 $(call if_changed,bzip2) 59 + $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) 60 + $(call if_changed,lz4) 60 61 $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) 61 62 $(call if_changed,lzma) 62 63 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
+4
arch/s390/boot/compressed/misc.c
··· 47 47 #include "../../../../lib/decompress_bunzip2.c" 48 48 #endif 49 49 50 + #ifdef CONFIG_KERNEL_LZ4 51 + #include "../../../../lib/decompress_unlz4.c" 52 + #endif 53 + 50 54 #ifdef CONFIG_KERNEL_LZMA 51 55 #include "../../../../lib/decompress_unlzma.c" 52 56 #endif
+1 -1
arch/s390/include/asm/bitops.h
··· 693 693 size -= offset; 694 694 p = addr + offset / BITS_PER_LONG; 695 695 if (bit) { 696 - set = __flo_word(0, *p & (~0UL << bit)); 696 + set = __flo_word(0, *p & (~0UL >> bit)); 697 697 if (set >= size) 698 698 return size + offset; 699 699 if (set < BITS_PER_LONG)
+6 -2
arch/s390/include/asm/tlb.h
··· 32 32 struct mm_struct *mm; 33 33 struct mmu_table_batch *batch; 34 34 unsigned int fullmm; 35 + unsigned long start, unsigned long end; 35 36 }; 36 37 37 38 struct mmu_table_batch { ··· 49 48 50 49 static inline void tlb_gather_mmu(struct mmu_gather *tlb, 51 50 struct mm_struct *mm, 52 - unsigned int full_mm_flush) 51 + unsigned long start, 52 + unsigned long end) 53 53 { 54 54 tlb->mm = mm; 55 - tlb->fullmm = full_mm_flush; 55 + tlb->start = start; 56 + tlb->end = end; 57 + tlb->fullmm = !(start | (end+1)); 56 58 tlb->batch = NULL; 57 59 if (tlb->fullmm) 58 60 __tlb_flush_mm(mm);
+5 -4
arch/s390/kernel/perf_event.c
··· 52 52 53 53 static bool is_in_guest(struct pt_regs *regs) 54 54 { 55 - unsigned long ip = instruction_pointer(regs); 56 - 57 55 if (user_mode(regs)) 58 56 return false; 59 - 60 - return ip == (unsigned long) &sie_exit; 57 + #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) 58 + return instruction_pointer(regs) == (unsigned long) &sie_exit; 59 + #else 60 + return false; 61 + #endif 61 62 } 62 63 63 64 static unsigned long guest_is_user_mode(struct pt_regs *regs)
+1
arch/s390/kernel/setup.c
··· 994 994 strcpy(elf_platform, "z196"); 995 995 break; 996 996 case 0x2827: 997 + case 0x2828: 997 998 strcpy(elf_platform, "zEC12"); 998 999 break; 999 1000 }
+14 -7
arch/s390/kvm/kvm-s390.c
··· 702 702 return rc; 703 703 704 704 vcpu->arch.sie_block->icptcode = 0; 705 - preempt_disable(); 706 - kvm_guest_enter(); 707 - preempt_enable(); 708 705 VCPU_EVENT(vcpu, 6, "entering sie flags %x", 709 706 atomic_read(&vcpu->arch.sie_block->cpuflags)); 710 707 trace_kvm_s390_sie_enter(vcpu, 711 708 atomic_read(&vcpu->arch.sie_block->cpuflags)); 709 + 710 + /* 711 + * As PF_VCPU will be used in fault handler, between guest_enter 712 + * and guest_exit should be no uaccess. 713 + */ 714 + preempt_disable(); 715 + kvm_guest_enter(); 716 + preempt_enable(); 712 717 rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs); 718 + kvm_guest_exit(); 719 + 720 + VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", 721 + vcpu->arch.sie_block->icptcode); 722 + trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); 723 + 713 724 if (rc > 0) 714 725 rc = 0; 715 726 if (rc < 0) { ··· 732 721 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 733 722 } 734 723 } 735 - VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", 736 - vcpu->arch.sie_block->icptcode); 737 - trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); 738 - kvm_guest_exit(); 739 724 740 725 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); 741 726 return rc;
+2 -2
arch/s390/kvm/priv.c
··· 16 16 #include <linux/errno.h> 17 17 #include <linux/compat.h> 18 18 #include <asm/asm-offsets.h> 19 + #include <asm/facility.h> 19 20 #include <asm/current.h> 20 21 #include <asm/debug.h> 21 22 #include <asm/ebcdic.h> ··· 533 532 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 534 533 535 534 /* Only provide non-quiescing support if the host supports it */ 536 - if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && 537 - S390_lowcore.stfl_fac_list & 0x00020000) 535 + if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && !test_facility(14)) 538 536 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 539 537 540 538 /* No support for conditional-SSKE */
+1
arch/s390/mm/init.c
··· 69 69 order = 2; 70 70 break; 71 71 case 0x2827: /* zEC12 */ 72 + case 0x2828: /* zEC12 */ 72 73 default: 73 74 order = 5; 74 75 break;
+1 -1
arch/s390/oprofile/init.c
··· 440 440 switch (id.machine) { 441 441 case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break; 442 442 case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break; 443 - case 0x2827: ops->cpu_type = "s390/zEC12"; break; 443 + case 0x2827: case 0x2828: ops->cpu_type = "s390/zEC12"; break; 444 444 default: return -ENODEV; 445 445 } 446 446 }
+2
arch/score/Kconfig
··· 87 87 88 88 source "init/Kconfig" 89 89 90 + source "kernel/Kconfig.freezer" 91 + 90 92 config MMU 91 93 def_bool y 92 94
+4 -2
arch/sh/include/asm/tlb.h
··· 36 36 } 37 37 38 38 static inline void 39 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int full_mm_flush) 39 + tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 40 40 { 41 41 tlb->mm = mm; 42 - tlb->fullmm = full_mm_flush; 42 + tlb->start = start; 43 + tlb->end = end; 44 + tlb->fullmm = !(start | (end+1)); 43 45 44 46 init_tlb_gather(tlb); 45 47 }
+4 -2
arch/um/include/asm/tlb.h
··· 45 45 } 46 46 47 47 static inline void 48 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned int full_mm_flush) 48 + tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 49 49 { 50 50 tlb->mm = mm; 51 - tlb->fullmm = full_mm_flush; 51 + tlb->start = start; 52 + tlb->end = end; 53 + tlb->fullmm = !(start | (end+1)); 52 54 53 55 init_tlb_gather(tlb); 54 56 }
+1 -1
arch/x86/boot/compressed/eboot.c
··· 225 225 unsigned long nr_pages; 226 226 227 227 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; 228 - efi_call_phys2(sys_table->boottime->free_pages, addr, size); 228 + efi_call_phys2(sys_table->boottime->free_pages, addr, nr_pages); 229 229 } 230 230 231 231 static void find_bits(unsigned long mask, u8 *pos, u8 *size)
+47 -1
arch/x86/include/asm/pgtable-2level.h
··· 55 55 #define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp) 56 56 #endif 57 57 58 + #ifdef CONFIG_MEM_SOFT_DIRTY 59 + 60 + /* 61 + * Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE, _PAGE_BIT_SOFT_DIRTY and 62 + * _PAGE_BIT_PROTNONE are taken, split up the 28 bits of offset 63 + * into this range. 64 + */ 65 + #define PTE_FILE_MAX_BITS 28 66 + #define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1) 67 + #define PTE_FILE_SHIFT2 (_PAGE_BIT_FILE + 1) 68 + #define PTE_FILE_SHIFT3 (_PAGE_BIT_PROTNONE + 1) 69 + #define PTE_FILE_SHIFT4 (_PAGE_BIT_SOFT_DIRTY + 1) 70 + #define PTE_FILE_BITS1 (PTE_FILE_SHIFT2 - PTE_FILE_SHIFT1 - 1) 71 + #define PTE_FILE_BITS2 (PTE_FILE_SHIFT3 - PTE_FILE_SHIFT2 - 1) 72 + #define PTE_FILE_BITS3 (PTE_FILE_SHIFT4 - PTE_FILE_SHIFT3 - 1) 73 + 74 + #define pte_to_pgoff(pte) \ 75 + ((((pte).pte_low >> (PTE_FILE_SHIFT1)) \ 76 + & ((1U << PTE_FILE_BITS1) - 1))) \ 77 + + ((((pte).pte_low >> (PTE_FILE_SHIFT2)) \ 78 + & ((1U << PTE_FILE_BITS2) - 1)) \ 79 + << (PTE_FILE_BITS1)) \ 80 + + ((((pte).pte_low >> (PTE_FILE_SHIFT3)) \ 81 + & ((1U << PTE_FILE_BITS3) - 1)) \ 82 + << (PTE_FILE_BITS1 + PTE_FILE_BITS2)) \ 83 + + ((((pte).pte_low >> (PTE_FILE_SHIFT4))) \ 84 + << (PTE_FILE_BITS1 + PTE_FILE_BITS2 + PTE_FILE_BITS3)) 85 + 86 + #define pgoff_to_pte(off) \ 87 + ((pte_t) { .pte_low = \ 88 + ((((off)) & ((1U << PTE_FILE_BITS1) - 1)) << PTE_FILE_SHIFT1) \ 89 + + ((((off) >> PTE_FILE_BITS1) \ 90 + & ((1U << PTE_FILE_BITS2) - 1)) \ 91 + << PTE_FILE_SHIFT2) \ 92 + + ((((off) >> (PTE_FILE_BITS1 + PTE_FILE_BITS2)) \ 93 + & ((1U << PTE_FILE_BITS3) - 1)) \ 94 + << PTE_FILE_SHIFT3) \ 95 + + ((((off) >> \ 96 + (PTE_FILE_BITS1 + PTE_FILE_BITS2 + PTE_FILE_BITS3))) \ 97 + << PTE_FILE_SHIFT4) \ 98 + + _PAGE_FILE }) 99 + 100 + #else /* CONFIG_MEM_SOFT_DIRTY */ 101 + 58 102 /* 59 103 * Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE and _PAGE_BIT_PROTNONE are taken, 60 - * split up the 29 bits of offset into this range: 104 + * split up the 29 bits of offset into this range. 61 105 */ 62 106 #define PTE_FILE_MAX_BITS 29 63 107 #define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1) ··· 131 87 + (((off) >> (PTE_FILE_BITS1 + PTE_FILE_BITS2)) \ 132 88 << PTE_FILE_SHIFT3) \ 133 89 + _PAGE_FILE }) 90 + 91 + #endif /* CONFIG_MEM_SOFT_DIRTY */ 134 92 135 93 /* Encode and de-code a swap entry */ 136 94 #if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE
+3
arch/x86/include/asm/pgtable-3level.h
··· 179 179 /* 180 180 * Bits 0, 6 and 7 are taken in the low part of the pte, 181 181 * put the 32 bits of offset into the high part. 182 + * 183 + * For soft-dirty tracking 11 bit is taken from 184 + * the low part of pte as well. 182 185 */ 183 186 #define pte_to_pgoff(pte) ((pte).pte_high) 184 187 #define pgoff_to_pte(off) \
+30
arch/x86/include/asm/pgtable.h
··· 314 314 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY); 315 315 } 316 316 317 + static inline pte_t pte_swp_mksoft_dirty(pte_t pte) 318 + { 319 + return pte_set_flags(pte, _PAGE_SWP_SOFT_DIRTY); 320 + } 321 + 322 + static inline int pte_swp_soft_dirty(pte_t pte) 323 + { 324 + return pte_flags(pte) & _PAGE_SWP_SOFT_DIRTY; 325 + } 326 + 327 + static inline pte_t pte_swp_clear_soft_dirty(pte_t pte) 328 + { 329 + return pte_clear_flags(pte, _PAGE_SWP_SOFT_DIRTY); 330 + } 331 + 332 + static inline pte_t pte_file_clear_soft_dirty(pte_t pte) 333 + { 334 + return pte_clear_flags(pte, _PAGE_SOFT_DIRTY); 335 + } 336 + 337 + static inline pte_t pte_file_mksoft_dirty(pte_t pte) 338 + { 339 + return pte_set_flags(pte, _PAGE_SOFT_DIRTY); 340 + } 341 + 342 + static inline int pte_file_soft_dirty(pte_t pte) 343 + { 344 + return pte_flags(pte) & _PAGE_SOFT_DIRTY; 345 + } 346 + 317 347 /* 318 348 * Mask out unsupported bits in a present pgprot. Non-present pgprots 319 349 * can use those bits for other purposes, so leave them be.
+16 -1
arch/x86/include/asm/pgtable_types.h
··· 61 61 * they do not conflict with each other. 62 62 */ 63 63 64 + #define _PAGE_BIT_SOFT_DIRTY _PAGE_BIT_HIDDEN 65 + 64 66 #ifdef CONFIG_MEM_SOFT_DIRTY 65 - #define _PAGE_SOFT_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_HIDDEN) 67 + #define _PAGE_SOFT_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_SOFT_DIRTY) 66 68 #else 67 69 #define _PAGE_SOFT_DIRTY (_AT(pteval_t, 0)) 70 + #endif 71 + 72 + /* 73 + * Tracking soft dirty bit when a page goes to a swap is tricky. 74 + * We need a bit which can be stored in pte _and_ not conflict 75 + * with swap entry format. On x86 bits 6 and 7 are *not* involved 76 + * into swap entry computation, but bit 6 is used for nonlinear 77 + * file mapping, so we borrow bit 7 for soft dirty tracking. 78 + */ 79 + #ifdef CONFIG_MEM_SOFT_DIRTY 80 + #define _PAGE_SWP_SOFT_DIRTY _PAGE_PSE 81 + #else 82 + #define _PAGE_SWP_SOFT_DIRTY (_AT(pteval_t, 0)) 68 83 #endif 69 84 70 85 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
-4
arch/x86/include/asm/spinlock.h
··· 233 233 #define arch_read_relax(lock) cpu_relax() 234 234 #define arch_write_relax(lock) cpu_relax() 235 235 236 - /* The {read|write|spin}_lock() on x86 are full memory barriers. */ 237 - static inline void smp_mb__after_lock(void) { } 238 - #define ARCH_HAS_SMP_MB_AFTER_LOCK 239 - 240 236 #endif /* _ASM_X86_SPINLOCK_H */
+1
arch/x86/kernel/cpu/perf_event_intel.c
··· 2270 2270 case 70: 2271 2271 case 71: 2272 2272 case 63: 2273 + case 69: 2273 2274 x86_pmu.late_ack = true; 2274 2275 memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids)); 2275 2276 memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
+2 -2
arch/x86/kernel/cpu/perf_event_intel_uncore.c
··· 314 314 static struct uncore_event_desc snbep_uncore_qpi_events[] = { 315 315 INTEL_UNCORE_EVENT_DESC(clockticks, "event=0x14"), 316 316 INTEL_UNCORE_EVENT_DESC(txl_flits_active, "event=0x00,umask=0x06"), 317 - INTEL_UNCORE_EVENT_DESC(drs_data, "event=0x02,umask=0x08"), 318 - INTEL_UNCORE_EVENT_DESC(ncb_data, "event=0x03,umask=0x04"), 317 + INTEL_UNCORE_EVENT_DESC(drs_data, "event=0x102,umask=0x08"), 318 + INTEL_UNCORE_EVENT_DESC(ncb_data, "event=0x103,umask=0x04"), 319 319 { /* end: all zeroes */ }, 320 320 }; 321 321
+12 -2
arch/x86/kernel/early-quirks.c
··· 196 196 static void __init intel_remapping_check(int num, int slot, int func) 197 197 { 198 198 u8 revision; 199 + u16 device; 199 200 201 + device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); 200 202 revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID); 201 203 202 204 /* 203 - * Revision 0x13 of this chipset supports irq remapping 204 - * but has an erratum that breaks its behavior, flag it as such 205 + * Revision 13 of all triggering devices id in this quirk have 206 + * a problem draining interrupts when irq remapping is enabled, 207 + * and should be flagged as broken. Additionally revisions 0x12 208 + * and 0x22 of device id 0x3405 has this problem. 205 209 */ 206 210 if (revision == 0x13) 211 + set_irq_remapping_broken(); 212 + else if ((device == 0x3405) && 213 + ((revision == 0x12) || 214 + (revision == 0x22))) 207 215 set_irq_remapping_broken(); 208 216 209 217 } ··· 246 238 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, 247 239 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, 248 240 { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, 241 + PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, 242 + { PCI_VENDOR_ID_INTEL, 0x3405, PCI_CLASS_BRIDGE_HOST, 249 243 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, 250 244 { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, 251 245 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
+1 -1
arch/x86/kernel/i387.c
··· 116 116 117 117 if (cpu_has_fxsr) { 118 118 memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct)); 119 - asm volatile("fxsave %0" : : "m" (fx_scratch)); 119 + asm volatile("fxsave %0" : "+m" (fx_scratch)); 120 120 mask = fx_scratch.mxcsr_mask; 121 121 if (mask == 0) 122 122 mask = 0x0000ffbf;
+5 -4
arch/x86/kernel/microcode_amd.c
··· 220 220 return 0; 221 221 } 222 222 223 - if (__apply_microcode_amd(mc_amd)) 223 + if (__apply_microcode_amd(mc_amd)) { 224 224 pr_err("CPU%d: update failed for patch_level=0x%08x\n", 225 225 cpu, mc_amd->hdr.patch_id); 226 - else 227 - pr_info("CPU%d: new patch_level=0x%08x\n", cpu, 228 - mc_amd->hdr.patch_id); 226 + return -1; 227 + } 228 + pr_info("CPU%d: new patch_level=0x%08x\n", cpu, 229 + mc_amd->hdr.patch_id); 229 230 230 231 uci->cpu_sig.rev = mc_amd->hdr.patch_id; 231 232 c->microcode = mc_amd->hdr.patch_id;
+1 -1
arch/x86/kernel/sys_x86_64.c
··· 101 101 *begin = new_begin; 102 102 } 103 103 } else { 104 - *begin = TASK_UNMAPPED_BASE; 104 + *begin = mmap_legacy_base(); 105 105 *end = TASK_SIZE; 106 106 } 107 107 }
+1 -1
arch/x86/mm/mmap.c
··· 98 98 * Bottom-up (legacy) layout on X86_32 did not support randomization, X86_64 99 99 * does, but not when emulating X86_32 100 100 */ 101 - static unsigned long mmap_legacy_base(void) 101 + unsigned long mmap_legacy_base(void) 102 102 { 103 103 if (mmap_is_ia32()) 104 104 return TASK_UNMAPPED_BASE;
+2 -1
drivers/acpi/acpi_processor.c
··· 451 451 /* Clean up. */ 452 452 per_cpu(processor_device_array, pr->id) = NULL; 453 453 per_cpu(processors, pr->id) = NULL; 454 - try_offline_node(cpu_to_node(pr->id)); 455 454 456 455 /* Remove the CPU. */ 457 456 get_online_cpus(); 458 457 arch_unregister_cpu(pr->id); 459 458 acpi_unmap_lsapic(pr->id); 460 459 put_online_cpus(); 460 + 461 + try_offline_node(cpu_to_node(pr->id)); 461 462 462 463 out: 463 464 free_cpumask_var(pr->throttling.shared_cpu_map);
+101 -32
drivers/acpi/glue.c
··· 31 31 static DECLARE_RWSEM(bus_type_sem); 32 32 33 33 #define PHYSICAL_NODE_STRING "physical_node" 34 + #define PHYSICAL_NODE_NAME_SIZE (sizeof(PHYSICAL_NODE_STRING) + 10) 34 35 35 36 int register_acpi_bus_type(struct acpi_bus_type *type) 36 37 { ··· 79 78 return ret; 80 79 } 81 80 82 - static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, 83 - void *addr_p, void **ret_p) 81 + static acpi_status acpi_dev_present(acpi_handle handle, u32 lvl_not_used, 82 + void *not_used, void **ret_p) 84 83 { 85 - unsigned long long addr, sta; 86 - acpi_status status; 84 + struct acpi_device *adev = NULL; 87 85 88 - status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); 89 - if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { 86 + acpi_bus_get_device(handle, &adev); 87 + if (adev) { 90 88 *ret_p = handle; 91 - status = acpi_bus_get_status_handle(handle, &sta); 92 - if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_ENABLED)) 93 - return AE_CTRL_TERMINATE; 89 + return AE_CTRL_TERMINATE; 94 90 } 95 91 return AE_OK; 96 92 } 97 93 98 - acpi_handle acpi_get_child(acpi_handle parent, u64 address) 94 + static bool acpi_extra_checks_passed(acpi_handle handle, bool is_bridge) 99 95 { 100 - void *ret = NULL; 96 + unsigned long long sta; 97 + acpi_status status; 101 98 102 - if (!parent) 103 - return NULL; 99 + status = acpi_bus_get_status_handle(handle, &sta); 100 + if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) 101 + return false; 104 102 105 - acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, 106 - do_acpi_find_child, &address, &ret); 107 - return (acpi_handle)ret; 103 + if (is_bridge) { 104 + void *test = NULL; 105 + 106 + /* Check if this object has at least one child device. */ 107 + acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, 108 + acpi_dev_present, NULL, NULL, &test); 109 + return !!test; 110 + } 111 + return true; 108 112 } 109 - EXPORT_SYMBOL(acpi_get_child); 113 + 114 + struct find_child_context { 115 + u64 addr; 116 + bool is_bridge; 117 + acpi_handle ret; 118 + bool ret_checked; 119 + }; 120 + 121 + static acpi_status do_find_child(acpi_handle handle, u32 lvl_not_used, 122 + void *data, void **not_used) 123 + { 124 + struct find_child_context *context = data; 125 + unsigned long long addr; 126 + acpi_status status; 127 + 128 + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); 129 + if (ACPI_FAILURE(status) || addr != context->addr) 130 + return AE_OK; 131 + 132 + if (!context->ret) { 133 + /* This is the first matching object. Save its handle. */ 134 + context->ret = handle; 135 + return AE_OK; 136 + } 137 + /* 138 + * There is more than one matching object with the same _ADR value. 139 + * That really is unexpected, so we are kind of beyond the scope of the 140 + * spec here. We have to choose which one to return, though. 141 + * 142 + * First, check if the previously found object is good enough and return 143 + * its handle if so. Second, check the same for the object that we've 144 + * just found. 145 + */ 146 + if (!context->ret_checked) { 147 + if (acpi_extra_checks_passed(context->ret, context->is_bridge)) 148 + return AE_CTRL_TERMINATE; 149 + else 150 + context->ret_checked = true; 151 + } 152 + if (acpi_extra_checks_passed(handle, context->is_bridge)) { 153 + context->ret = handle; 154 + return AE_CTRL_TERMINATE; 155 + } 156 + return AE_OK; 157 + } 158 + 159 + acpi_handle acpi_find_child(acpi_handle parent, u64 addr, bool is_bridge) 160 + { 161 + if (parent) { 162 + struct find_child_context context = { 163 + .addr = addr, 164 + .is_bridge = is_bridge, 165 + }; 166 + 167 + acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, do_find_child, 168 + NULL, &context, NULL); 169 + return context.ret; 170 + } 171 + return NULL; 172 + } 173 + EXPORT_SYMBOL_GPL(acpi_find_child); 110 174 111 175 int acpi_bind_one(struct device *dev, acpi_handle handle) 112 176 { 113 177 struct acpi_device *acpi_dev; 114 178 acpi_status status; 115 179 struct acpi_device_physical_node *physical_node, *pn; 116 - char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; 180 + char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; 181 + struct list_head *physnode_list; 182 + unsigned int node_id; 117 183 int retval = -EINVAL; 118 184 119 185 if (ACPI_HANDLE(dev)) { ··· 207 139 208 140 mutex_lock(&acpi_dev->physical_node_lock); 209 141 210 - /* Sanity check. */ 211 - list_for_each_entry(pn, &acpi_dev->physical_node_list, node) 142 + /* 143 + * Keep the list sorted by node_id so that the IDs of removed nodes can 144 + * be recycled easily. 145 + */ 146 + physnode_list = &acpi_dev->physical_node_list; 147 + node_id = 0; 148 + list_for_each_entry(pn, &acpi_dev->physical_node_list, node) { 149 + /* Sanity check. */ 212 150 if (pn->dev == dev) { 213 151 dev_warn(dev, "Already associated with ACPI node\n"); 214 152 goto err_free; 215 153 } 216 - 217 - /* allocate physical node id according to physical_node_id_bitmap */ 218 - physical_node->node_id = 219 - find_first_zero_bit(acpi_dev->physical_node_id_bitmap, 220 - ACPI_MAX_PHYSICAL_NODE); 221 - if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { 222 - retval = -ENOSPC; 223 - goto err_free; 154 + if (pn->node_id == node_id) { 155 + physnode_list = &pn->node; 156 + node_id++; 157 + } 224 158 } 225 159 226 - set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); 160 + physical_node->node_id = node_id; 227 161 physical_node->dev = dev; 228 - list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); 162 + list_add(&physical_node->node, physnode_list); 229 163 acpi_dev->physical_node_count++; 230 164 231 165 mutex_unlock(&acpi_dev->physical_node_lock); ··· 278 208 279 209 mutex_lock(&acpi_dev->physical_node_lock); 280 210 list_for_each_safe(node, next, &acpi_dev->physical_node_list) { 281 - char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; 211 + char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; 282 212 283 213 entry = list_entry(node, struct acpi_device_physical_node, 284 214 node); ··· 286 216 continue; 287 217 288 218 list_del(node); 289 - clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap); 290 219 291 220 acpi_dev->physical_node_count--; 292 221
+8
drivers/acpi/proc.c
··· 311 311 dev->pnp.bus_id, 312 312 (u32) dev->wakeup.sleep_state); 313 313 314 + mutex_lock(&dev->physical_node_lock); 315 + 314 316 if (!dev->physical_node_count) { 315 317 seq_printf(seq, "%c%-8s\n", 316 318 dev->wakeup.flags.run_wake ? '*' : ' ', ··· 340 338 put_device(ldev); 341 339 } 342 340 } 341 + 342 + mutex_unlock(&dev->physical_node_lock); 343 343 } 344 344 mutex_unlock(&acpi_device_lock); 345 345 return 0; ··· 351 347 { 352 348 struct acpi_device_physical_node *entry; 353 349 350 + mutex_lock(&adev->physical_node_lock); 351 + 354 352 list_for_each_entry(entry, 355 353 &adev->physical_node_list, node) 356 354 if (entry->dev && device_can_wakeup(entry->dev)) { 357 355 bool enable = !device_may_wakeup(entry->dev); 358 356 device_set_wakeup_enable(entry->dev, enable); 359 357 } 358 + 359 + mutex_unlock(&adev->physical_node_lock); 360 360 } 361 361 362 362 static ssize_t
+1 -1
drivers/acpi/video.c
··· 689 689 * Some systems always report current brightness level as maximum 690 690 * through _BQC, we need to test another value for them. 691 691 */ 692 - test_level = current_level == max_level ? br->levels[2] : max_level; 692 + test_level = current_level == max_level ? br->levels[3] : max_level; 693 693 694 694 result = acpi_video_device_lcd_set_level(device, test_level); 695 695 if (result)
+1
drivers/ata/pata_imx.c
··· 237 237 /* sentinel */ 238 238 } 239 239 }; 240 + MODULE_DEVICE_TABLE(of, imx_pata_dt_ids); 240 241 241 242 static struct platform_driver pata_imx_driver = { 242 243 .probe = pata_imx_probe,
+2 -1
drivers/base/regmap/regcache.c
··· 719 719 } 720 720 } 721 721 722 - return regcache_sync_block_raw_flush(map, &data, base, regtmp); 722 + return regcache_sync_block_raw_flush(map, &data, base, regtmp + 723 + map->reg_stride); 723 724 } 724 725 725 726 int regcache_sync_block(struct regmap *map, void *block,
+7 -10
drivers/block/aoe/aoecmd.c
··· 906 906 int i; 907 907 908 908 bio_for_each_segment(bv, bio, i) { 909 - page = bv->bv_page; 910 909 /* Non-zero page count for non-head members of 911 - * compound pages is no longer allowed by the kernel, 912 - * but this has never been seen here. 910 + * compound pages is no longer allowed by the kernel. 913 911 */ 914 - if (unlikely(PageCompound(page))) 915 - if (compound_trans_head(page) != page) { 916 - pr_crit("page tail used for block I/O\n"); 917 - BUG(); 918 - } 912 + page = compound_trans_head(bv->bv_page); 919 913 atomic_inc(&page->_count); 920 914 } 921 915 } ··· 918 924 bio_pagedec(struct bio *bio) 919 925 { 920 926 struct bio_vec *bv; 927 + struct page *page; 921 928 int i; 922 929 923 - bio_for_each_segment(bv, bio, i) 924 - atomic_dec(&bv->bv_page->_count); 930 + bio_for_each_segment(bv, bio, i) { 931 + page = compound_trans_head(bv->bv_page); 932 + atomic_dec(&page->_count); 933 + } 925 934 } 926 935 927 936 static void
+49 -23
drivers/char/virtio_console.c
··· 272 272 unsigned long flags; 273 273 274 274 spin_lock_irqsave(&portdev->ports_lock, flags); 275 - list_for_each_entry(port, &portdev->ports, list) 276 - if (port->cdev->dev == dev) 275 + list_for_each_entry(port, &portdev->ports, list) { 276 + if (port->cdev->dev == dev) { 277 + kref_get(&port->kref); 277 278 goto out; 279 + } 280 + } 278 281 port = NULL; 279 282 out: 280 283 spin_unlock_irqrestore(&portdev->ports_lock, flags); ··· 749 746 750 747 port = filp->private_data; 751 748 749 + /* Port is hot-unplugged. */ 750 + if (!port->guest_connected) 751 + return -ENODEV; 752 + 752 753 if (!port_has_data(port)) { 753 754 /* 754 755 * If nothing's connected on the host just return 0 in ··· 769 762 if (ret < 0) 770 763 return ret; 771 764 } 772 - /* Port got hot-unplugged. */ 765 + /* Port got hot-unplugged while we were waiting above. */ 773 766 if (!port->guest_connected) 774 767 return -ENODEV; 775 768 /* ··· 939 932 if (is_rproc_serial(port->out_vq->vdev)) 940 933 return -EINVAL; 941 934 935 + /* 936 + * pipe->nrbufs == 0 means there are no data to transfer, 937 + * so this returns just 0 for no data. 938 + */ 939 + pipe_lock(pipe); 940 + if (!pipe->nrbufs) { 941 + ret = 0; 942 + goto error_out; 943 + } 944 + 942 945 ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); 943 946 if (ret < 0) 944 - return ret; 947 + goto error_out; 945 948 946 949 buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); 947 - if (!buf) 948 - return -ENOMEM; 950 + if (!buf) { 951 + ret = -ENOMEM; 952 + goto error_out; 953 + } 949 954 950 955 sgl.n = 0; 951 956 sgl.len = 0; ··· 965 946 sgl.sg = buf->sg; 966 947 sg_init_table(sgl.sg, sgl.size); 967 948 ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); 949 + pipe_unlock(pipe); 968 950 if (likely(ret > 0)) 969 951 ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); 970 952 971 953 if (unlikely(ret <= 0)) 972 954 free_buf(buf, true); 955 + return ret; 956 + 957 + error_out: 958 + pipe_unlock(pipe); 973 959 return ret; 974 960 } 975 961 ··· 1043 1019 struct port *port; 1044 1020 int ret; 1045 1021 1022 + /* We get the port with a kref here */ 1046 1023 port = find_port_by_devt(cdev->dev); 1024 + if (!port) { 1025 + /* Port was unplugged before we could proceed */ 1026 + return -ENXIO; 1027 + } 1047 1028 filp->private_data = port; 1048 - 1049 - /* Prevent against a port getting hot-unplugged at the same time */ 1050 - spin_lock_irq(&port->portdev->ports_lock); 1051 - kref_get(&port->kref); 1052 - spin_unlock_irq(&port->portdev->ports_lock); 1053 1029 1054 1030 /* 1055 1031 * Don't allow opening of console port devices -- that's done ··· 1522 1498 1523 1499 port = container_of(kref, struct port, kref); 1524 1500 1525 - sysfs_remove_group(&port->dev->kobj, &port_attribute_group); 1526 - device_destroy(pdrvdata.class, port->dev->devt); 1527 - cdev_del(port->cdev); 1528 - 1529 - kfree(port->name); 1530 - 1531 - debugfs_remove(port->debugfs_file); 1532 - 1533 1501 kfree(port); 1534 1502 } 1535 1503 ··· 1555 1539 spin_unlock_irq(&port->portdev->ports_lock); 1556 1540 1557 1541 if (port->guest_connected) { 1558 - port->guest_connected = false; 1559 - port->host_connected = false; 1560 - wake_up_interruptible(&port->waitqueue); 1561 - 1562 1542 /* Let the app know the port is going down. */ 1563 1543 send_sigio_to_port(port); 1544 + 1545 + /* Do this after sigio is actually sent */ 1546 + port->guest_connected = false; 1547 + port->host_connected = false; 1548 + 1549 + wake_up_interruptible(&port->waitqueue); 1564 1550 } 1565 1551 1566 1552 if (is_console_port(port)) { ··· 1580 1562 * control message. 1581 1563 */ 1582 1564 port->portdev = NULL; 1565 + 1566 + sysfs_remove_group(&port->dev->kobj, &port_attribute_group); 1567 + device_destroy(pdrvdata.class, port->dev->devt); 1568 + cdev_del(port->cdev); 1569 + 1570 + kfree(port->name); 1571 + 1572 + debugfs_remove(port->debugfs_file); 1583 1573 1584 1574 /* 1585 1575 * Locks around here are not necessary - a port can't be
+34 -30
drivers/clk/samsung/clk-exynos4.c
··· 581 581 DIV(none, "div_spi1_isp", "mout_spi1_isp", E4X12_DIV_ISP, 16, 4), 582 582 DIV(none, "div_spi1_isp_pre", "div_spi1_isp", E4X12_DIV_ISP, 20, 8), 583 583 DIV(none, "div_uart_isp", "mout_uart_isp", E4X12_DIV_ISP, 28, 4), 584 - DIV(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3), 585 - DIV(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3), 584 + DIV_F(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3, 585 + CLK_GET_RATE_NOCACHE, 0), 586 + DIV_F(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3, 587 + CLK_GET_RATE_NOCACHE, 0), 586 588 DIV(none, "div_mpwm", "div_isp1", E4X12_DIV_ISP1, 0, 3), 587 - DIV(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1, 4, 3), 588 - DIV(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1, 8, 3), 589 + DIV_F(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1, 590 + 4, 3, CLK_GET_RATE_NOCACHE, 0), 591 + DIV_F(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1, 592 + 8, 3, CLK_GET_RATE_NOCACHE, 0), 589 593 DIV(sclk_fimg2d, "sclk_fimg2d", "mout_g2d", DIV_DMC1, 0, 4), 590 594 }; 591 595 ··· 867 863 GATE_DA(i2s0, "samsung-i2s.0", "i2s0", "aclk100", 868 864 E4X12_GATE_IP_MAUDIO, 3, 0, 0, "iis"), 869 865 GATE(fimc_isp, "isp", "aclk200", E4X12_GATE_ISP0, 0, 870 - CLK_IGNORE_UNUSED, 0), 866 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 871 867 GATE(fimc_drc, "drc", "aclk200", E4X12_GATE_ISP0, 1, 872 - CLK_IGNORE_UNUSED, 0), 868 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 873 869 GATE(fimc_fd, "fd", "aclk200", E4X12_GATE_ISP0, 2, 874 - CLK_IGNORE_UNUSED, 0), 870 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 875 871 GATE(fimc_lite0, "lite0", "aclk200", E4X12_GATE_ISP0, 3, 876 - CLK_IGNORE_UNUSED, 0), 872 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 877 873 GATE(fimc_lite1, "lite1", "aclk200", E4X12_GATE_ISP0, 4, 878 - CLK_IGNORE_UNUSED, 0), 874 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 879 875 GATE(mcuisp, "mcuisp", "aclk200", E4X12_GATE_ISP0, 5, 880 - CLK_IGNORE_UNUSED, 0), 876 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 881 877 GATE(gicisp, "gicisp", "aclk200", E4X12_GATE_ISP0, 7, 882 - CLK_IGNORE_UNUSED, 0), 878 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 883 879 GATE(smmu_isp, "smmu_isp", "aclk200", E4X12_GATE_ISP0, 8, 884 - CLK_IGNORE_UNUSED, 0), 880 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 885 881 GATE(smmu_drc, "smmu_drc", "aclk200", E4X12_GATE_ISP0, 9, 886 - CLK_IGNORE_UNUSED, 0), 882 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 887 883 GATE(smmu_fd, "smmu_fd", "aclk200", E4X12_GATE_ISP0, 10, 888 - CLK_IGNORE_UNUSED, 0), 884 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 889 885 GATE(smmu_lite0, "smmu_lite0", "aclk200", E4X12_GATE_ISP0, 11, 890 - CLK_IGNORE_UNUSED, 0), 886 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 891 887 GATE(smmu_lite1, "smmu_lite1", "aclk200", E4X12_GATE_ISP0, 12, 892 - CLK_IGNORE_UNUSED, 0), 888 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 893 889 GATE(ppmuispmx, "ppmuispmx", "aclk200", E4X12_GATE_ISP0, 20, 894 - CLK_IGNORE_UNUSED, 0), 890 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 895 891 GATE(ppmuispx, "ppmuispx", "aclk200", E4X12_GATE_ISP0, 21, 896 - CLK_IGNORE_UNUSED, 0), 892 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 897 893 GATE(mcuctl_isp, "mcuctl_isp", "aclk200", E4X12_GATE_ISP0, 23, 898 - CLK_IGNORE_UNUSED, 0), 894 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 899 895 GATE(mpwm_isp, "mpwm_isp", "aclk200", E4X12_GATE_ISP0, 24, 900 - CLK_IGNORE_UNUSED, 0), 896 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 901 897 GATE(i2c0_isp, "i2c0_isp", "aclk200", E4X12_GATE_ISP0, 25, 902 - CLK_IGNORE_UNUSED, 0), 898 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 903 899 GATE(i2c1_isp, "i2c1_isp", "aclk200", E4X12_GATE_ISP0, 26, 904 - CLK_IGNORE_UNUSED, 0), 900 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 905 901 GATE(mtcadc_isp, "mtcadc_isp", "aclk200", E4X12_GATE_ISP0, 27, 906 - CLK_IGNORE_UNUSED, 0), 902 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 907 903 GATE(pwm_isp, "pwm_isp", "aclk200", E4X12_GATE_ISP0, 28, 908 - CLK_IGNORE_UNUSED, 0), 904 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 909 905 GATE(wdt_isp, "wdt_isp", "aclk200", E4X12_GATE_ISP0, 30, 910 - CLK_IGNORE_UNUSED, 0), 906 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 911 907 GATE(uart_isp, "uart_isp", "aclk200", E4X12_GATE_ISP0, 31, 912 - CLK_IGNORE_UNUSED, 0), 908 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 913 909 GATE(asyncaxim, "asyncaxim", "aclk200", E4X12_GATE_ISP1, 0, 914 - CLK_IGNORE_UNUSED, 0), 910 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 915 911 GATE(smmu_ispcx, "smmu_ispcx", "aclk200", E4X12_GATE_ISP1, 4, 916 - CLK_IGNORE_UNUSED, 0), 912 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 917 913 GATE(spi0_isp, "spi0_isp", "aclk200", E4X12_GATE_ISP1, 12, 918 - CLK_IGNORE_UNUSED, 0), 914 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 919 915 GATE(spi1_isp, "spi1_isp", "aclk200", E4X12_GATE_ISP1, 13, 920 - CLK_IGNORE_UNUSED, 0), 916 + CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), 921 917 GATE(g2d, "g2d", "aclk200", GATE_IP_DMC, 23, 0, 0), 922 918 }; 923 919
+8 -5
drivers/clk/zynq/clkc.c
··· 71 71 static DEFINE_SPINLOCK(ddrpll_lock); 72 72 static DEFINE_SPINLOCK(iopll_lock); 73 73 static DEFINE_SPINLOCK(armclk_lock); 74 + static DEFINE_SPINLOCK(swdtclk_lock); 74 75 static DEFINE_SPINLOCK(ddrclk_lock); 75 76 static DEFINE_SPINLOCK(dciclk_lock); 76 77 static DEFINE_SPINLOCK(gem0clk_lock); ··· 294 293 } 295 294 clks[swdt] = clk_register_mux(NULL, clk_output_name[swdt], 296 295 swdt_ext_clk_mux_parents, 2, CLK_SET_RATE_PARENT, 297 - SLCR_SWDT_CLK_SEL, 0, 1, 0, &gem0clk_lock); 296 + SLCR_SWDT_CLK_SEL, 0, 1, 0, &swdtclk_lock); 298 297 299 298 /* DDR clocks */ 300 299 clk = clk_register_divider(NULL, "ddr2x_div", "ddrpll", 0, ··· 365 364 CLK_SET_RATE_PARENT, SLCR_GEM0_CLK_CTRL, 20, 6, 366 365 CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, 367 366 &gem0clk_lock); 368 - clk = clk_register_mux(NULL, "gem0_emio_mux", gem0_mux_parents, 2, 0, 369 - SLCR_GEM0_CLK_CTRL, 6, 1, 0, &gem0clk_lock); 367 + clk = clk_register_mux(NULL, "gem0_emio_mux", gem0_mux_parents, 2, 368 + CLK_SET_RATE_PARENT, SLCR_GEM0_CLK_CTRL, 6, 1, 0, 369 + &gem0clk_lock); 370 370 clks[gem0] = clk_register_gate(NULL, clk_output_name[gem0], 371 371 "gem0_emio_mux", CLK_SET_RATE_PARENT, 372 372 SLCR_GEM0_CLK_CTRL, 0, 0, &gem0clk_lock); ··· 388 386 CLK_SET_RATE_PARENT, SLCR_GEM1_CLK_CTRL, 20, 6, 389 387 CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, 390 388 &gem1clk_lock); 391 - clk = clk_register_mux(NULL, "gem1_emio_mux", gem1_mux_parents, 2, 0, 392 - SLCR_GEM1_CLK_CTRL, 6, 1, 0, &gem1clk_lock); 389 + clk = clk_register_mux(NULL, "gem1_emio_mux", gem1_mux_parents, 2, 390 + CLK_SET_RATE_PARENT, SLCR_GEM1_CLK_CTRL, 6, 1, 0, 391 + &gem1clk_lock); 393 392 clks[gem1] = clk_register_gate(NULL, clk_output_name[gem1], 394 393 "gem1_emio_mux", CLK_SET_RATE_PARENT, 395 394 SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock);
+10 -10
drivers/cpufreq/cpufreq_conservative.c
··· 221 221 return count; 222 222 } 223 223 224 - static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, 225 - size_t count) 224 + static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, 225 + const char *buf, size_t count) 226 226 { 227 227 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; 228 228 unsigned int input, j; ··· 235 235 if (input > 1) 236 236 input = 1; 237 237 238 - if (input == cs_tuners->ignore_nice) /* nothing to do */ 238 + if (input == cs_tuners->ignore_nice_load) /* nothing to do */ 239 239 return count; 240 240 241 - cs_tuners->ignore_nice = input; 241 + cs_tuners->ignore_nice_load = input; 242 242 243 243 /* we need to re-evaluate prev_cpu_idle */ 244 244 for_each_online_cpu(j) { ··· 246 246 dbs_info = &per_cpu(cs_cpu_dbs_info, j); 247 247 dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, 248 248 &dbs_info->cdbs.prev_cpu_wall, 0); 249 - if (cs_tuners->ignore_nice) 249 + if (cs_tuners->ignore_nice_load) 250 250 dbs_info->cdbs.prev_cpu_nice = 251 251 kcpustat_cpu(j).cpustat[CPUTIME_NICE]; 252 252 } ··· 279 279 show_store_one(cs, sampling_down_factor); 280 280 show_store_one(cs, up_threshold); 281 281 show_store_one(cs, down_threshold); 282 - show_store_one(cs, ignore_nice); 282 + show_store_one(cs, ignore_nice_load); 283 283 show_store_one(cs, freq_step); 284 284 declare_show_sampling_rate_min(cs); 285 285 ··· 287 287 gov_sys_pol_attr_rw(sampling_down_factor); 288 288 gov_sys_pol_attr_rw(up_threshold); 289 289 gov_sys_pol_attr_rw(down_threshold); 290 - gov_sys_pol_attr_rw(ignore_nice); 290 + gov_sys_pol_attr_rw(ignore_nice_load); 291 291 gov_sys_pol_attr_rw(freq_step); 292 292 gov_sys_pol_attr_ro(sampling_rate_min); 293 293 ··· 297 297 &sampling_down_factor_gov_sys.attr, 298 298 &up_threshold_gov_sys.attr, 299 299 &down_threshold_gov_sys.attr, 300 - &ignore_nice_gov_sys.attr, 300 + &ignore_nice_load_gov_sys.attr, 301 301 &freq_step_gov_sys.attr, 302 302 NULL 303 303 }; ··· 313 313 &sampling_down_factor_gov_pol.attr, 314 314 &up_threshold_gov_pol.attr, 315 315 &down_threshold_gov_pol.attr, 316 - &ignore_nice_gov_pol.attr, 316 + &ignore_nice_load_gov_pol.attr, 317 317 &freq_step_gov_pol.attr, 318 318 NULL 319 319 }; ··· 338 338 tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; 339 339 tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; 340 340 tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; 341 - tuners->ignore_nice = 0; 341 + tuners->ignore_nice_load = 0; 342 342 tuners->freq_step = DEF_FREQUENCY_STEP; 343 343 344 344 dbs_data->tuners = tuners;
+4 -4
drivers/cpufreq/cpufreq_governor.c
··· 47 47 unsigned int j; 48 48 49 49 if (dbs_data->cdata->governor == GOV_ONDEMAND) 50 - ignore_nice = od_tuners->ignore_nice; 50 + ignore_nice = od_tuners->ignore_nice_load; 51 51 else 52 - ignore_nice = cs_tuners->ignore_nice; 52 + ignore_nice = cs_tuners->ignore_nice_load; 53 53 54 54 policy = cdbs->cur_policy; 55 55 ··· 298 298 cs_tuners = dbs_data->tuners; 299 299 cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); 300 300 sampling_rate = cs_tuners->sampling_rate; 301 - ignore_nice = cs_tuners->ignore_nice; 301 + ignore_nice = cs_tuners->ignore_nice_load; 302 302 } else { 303 303 od_tuners = dbs_data->tuners; 304 304 od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); 305 305 sampling_rate = od_tuners->sampling_rate; 306 - ignore_nice = od_tuners->ignore_nice; 306 + ignore_nice = od_tuners->ignore_nice_load; 307 307 od_ops = dbs_data->cdata->gov_ops; 308 308 io_busy = od_tuners->io_is_busy; 309 309 }
+2 -2
drivers/cpufreq/cpufreq_governor.h
··· 165 165 166 166 /* Per policy Governers sysfs tunables */ 167 167 struct od_dbs_tuners { 168 - unsigned int ignore_nice; 168 + unsigned int ignore_nice_load; 169 169 unsigned int sampling_rate; 170 170 unsigned int sampling_down_factor; 171 171 unsigned int up_threshold; ··· 175 175 }; 176 176 177 177 struct cs_dbs_tuners { 178 - unsigned int ignore_nice; 178 + unsigned int ignore_nice_load; 179 179 unsigned int sampling_rate; 180 180 unsigned int sampling_down_factor; 181 181 unsigned int up_threshold;
+10 -10
drivers/cpufreq/cpufreq_ondemand.c
··· 403 403 return count; 404 404 } 405 405 406 - static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, 407 - size_t count) 406 + static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, 407 + const char *buf, size_t count) 408 408 { 409 409 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 410 410 unsigned int input; ··· 419 419 if (input > 1) 420 420 input = 1; 421 421 422 - if (input == od_tuners->ignore_nice) { /* nothing to do */ 422 + if (input == od_tuners->ignore_nice_load) { /* nothing to do */ 423 423 return count; 424 424 } 425 - od_tuners->ignore_nice = input; 425 + od_tuners->ignore_nice_load = input; 426 426 427 427 /* we need to re-evaluate prev_cpu_idle */ 428 428 for_each_online_cpu(j) { ··· 430 430 dbs_info = &per_cpu(od_cpu_dbs_info, j); 431 431 dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, 432 432 &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); 433 - if (od_tuners->ignore_nice) 433 + if (od_tuners->ignore_nice_load) 434 434 dbs_info->cdbs.prev_cpu_nice = 435 435 kcpustat_cpu(j).cpustat[CPUTIME_NICE]; 436 436 ··· 461 461 show_store_one(od, io_is_busy); 462 462 show_store_one(od, up_threshold); 463 463 show_store_one(od, sampling_down_factor); 464 - show_store_one(od, ignore_nice); 464 + show_store_one(od, ignore_nice_load); 465 465 show_store_one(od, powersave_bias); 466 466 declare_show_sampling_rate_min(od); 467 467 ··· 469 469 gov_sys_pol_attr_rw(io_is_busy); 470 470 gov_sys_pol_attr_rw(up_threshold); 471 471 gov_sys_pol_attr_rw(sampling_down_factor); 472 - gov_sys_pol_attr_rw(ignore_nice); 472 + gov_sys_pol_attr_rw(ignore_nice_load); 473 473 gov_sys_pol_attr_rw(powersave_bias); 474 474 gov_sys_pol_attr_ro(sampling_rate_min); 475 475 ··· 478 478 &sampling_rate_gov_sys.attr, 479 479 &up_threshold_gov_sys.attr, 480 480 &sampling_down_factor_gov_sys.attr, 481 - &ignore_nice_gov_sys.attr, 481 + &ignore_nice_load_gov_sys.attr, 482 482 &powersave_bias_gov_sys.attr, 483 483 &io_is_busy_gov_sys.attr, 484 484 NULL ··· 494 494 &sampling_rate_gov_pol.attr, 495 495 &up_threshold_gov_pol.attr, 496 496 &sampling_down_factor_gov_pol.attr, 497 - &ignore_nice_gov_pol.attr, 497 + &ignore_nice_load_gov_pol.attr, 498 498 &powersave_bias_gov_pol.attr, 499 499 &io_is_busy_gov_pol.attr, 500 500 NULL ··· 544 544 } 545 545 546 546 tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; 547 - tuners->ignore_nice = 0; 547 + tuners->ignore_nice_load = 0; 548 548 tuners->powersave_bias = default_powersave_bias; 549 549 tuners->io_is_busy = should_io_be_busy(); 550 550
+6 -5
drivers/cpufreq/loongson2_cpufreq.c
··· 118 118 clk_put(cpuclk); 119 119 return -EINVAL; 120 120 } 121 - ret = clk_set_rate(cpuclk, rate); 122 - if (ret) { 123 - clk_put(cpuclk); 124 - return ret; 125 - } 126 121 127 122 /* clock table init */ 128 123 for (i = 2; 129 124 (loongson2_clockmod_table[i].frequency != CPUFREQ_TABLE_END); 130 125 i++) 131 126 loongson2_clockmod_table[i].frequency = (rate * i) / 8; 127 + 128 + ret = clk_set_rate(cpuclk, rate); 129 + if (ret) { 130 + clk_put(cpuclk); 131 + return ret; 132 + } 132 133 133 134 policy->cur = loongson2_cpufreq_get(policy->cpu); 134 135
+1
drivers/dma/pch_dma.c
··· 867 867 868 868 if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { 869 869 dev_err(&pdev->dev, "Cannot find proper base address\n"); 870 + err = -ENODEV; 870 871 goto err_disable_pdev; 871 872 } 872 873
+67 -26
drivers/dma/pl330.c
··· 2505 2505 /* Assign cookies to all nodes */ 2506 2506 while (!list_empty(&last->node)) { 2507 2507 desc = list_entry(last->node.next, struct dma_pl330_desc, node); 2508 + if (pch->cyclic) { 2509 + desc->txd.callback = last->txd.callback; 2510 + desc->txd.callback_param = last->txd.callback_param; 2511 + } 2508 2512 2509 2513 dma_cookie_assign(&desc->txd); 2510 2514 ··· 2692 2688 size_t period_len, enum dma_transfer_direction direction, 2693 2689 unsigned long flags, void *context) 2694 2690 { 2695 - struct dma_pl330_desc *desc; 2691 + struct dma_pl330_desc *desc = NULL, *first = NULL; 2696 2692 struct dma_pl330_chan *pch = to_pchan(chan); 2693 + struct dma_pl330_dmac *pdmac = pch->dmac; 2694 + unsigned int i; 2697 2695 dma_addr_t dst; 2698 2696 dma_addr_t src; 2699 2697 2700 - desc = pl330_get_desc(pch); 2701 - if (!desc) { 2702 - dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", 2703 - __func__, __LINE__); 2698 + if (len % period_len != 0) 2704 2699 return NULL; 2705 - } 2706 2700 2707 - switch (direction) { 2708 - case DMA_MEM_TO_DEV: 2709 - desc->rqcfg.src_inc = 1; 2710 - desc->rqcfg.dst_inc = 0; 2711 - desc->req.rqtype = MEMTODEV; 2712 - src = dma_addr; 2713 - dst = pch->fifo_addr; 2714 - break; 2715 - case DMA_DEV_TO_MEM: 2716 - desc->rqcfg.src_inc = 0; 2717 - desc->rqcfg.dst_inc = 1; 2718 - desc->req.rqtype = DEVTOMEM; 2719 - src = pch->fifo_addr; 2720 - dst = dma_addr; 2721 - break; 2722 - default: 2701 + if (!is_slave_direction(direction)) { 2723 2702 dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n", 2724 2703 __func__, __LINE__); 2725 2704 return NULL; 2726 2705 } 2727 2706 2728 - desc->rqcfg.brst_size = pch->burst_sz; 2729 - desc->rqcfg.brst_len = 1; 2707 + for (i = 0; i < len / period_len; i++) { 2708 + desc = pl330_get_desc(pch); 2709 + if (!desc) { 2710 + dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", 2711 + __func__, __LINE__); 2712 + 2713 + if (!first) 2714 + return NULL; 2715 + 2716 + spin_lock_irqsave(&pdmac->pool_lock, flags); 2717 + 2718 + while (!list_empty(&first->node)) { 2719 + desc = list_entry(first->node.next, 2720 + struct dma_pl330_desc, node); 2721 + list_move_tail(&desc->node, &pdmac->desc_pool); 2722 + } 2723 + 2724 + list_move_tail(&first->node, &pdmac->desc_pool); 2725 + 2726 + spin_unlock_irqrestore(&pdmac->pool_lock, flags); 2727 + 2728 + return NULL; 2729 + } 2730 + 2731 + switch (direction) { 2732 + case DMA_MEM_TO_DEV: 2733 + desc->rqcfg.src_inc = 1; 2734 + desc->rqcfg.dst_inc = 0; 2735 + desc->req.rqtype = MEMTODEV; 2736 + src = dma_addr; 2737 + dst = pch->fifo_addr; 2738 + break; 2739 + case DMA_DEV_TO_MEM: 2740 + desc->rqcfg.src_inc = 0; 2741 + desc->rqcfg.dst_inc = 1; 2742 + desc->req.rqtype = DEVTOMEM; 2743 + src = pch->fifo_addr; 2744 + dst = dma_addr; 2745 + break; 2746 + default: 2747 + break; 2748 + } 2749 + 2750 + desc->rqcfg.brst_size = pch->burst_sz; 2751 + desc->rqcfg.brst_len = 1; 2752 + fill_px(&desc->px, dst, src, period_len); 2753 + 2754 + if (!first) 2755 + first = desc; 2756 + else 2757 + list_add_tail(&desc->node, &first->node); 2758 + 2759 + dma_addr += period_len; 2760 + } 2761 + 2762 + if (!desc) 2763 + return NULL; 2730 2764 2731 2765 pch->cyclic = true; 2732 - 2733 - fill_px(&desc->px, dst, src, period_len); 2766 + desc->txd.flags = flags; 2734 2767 2735 2768 return &desc->txd; 2736 2769 }
+2 -2
drivers/dma/sh/shdma.c
··· 400 400 shdma_chan); 401 401 struct sh_dmae_desc *sh_desc = container_of(sdesc, 402 402 struct sh_dmae_desc, shdma_desc); 403 - return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) << 404 - sh_chan->xmit_shift; 403 + return sh_desc->hw.tcr - 404 + (sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift); 405 405 } 406 406 407 407 /* Called from error IRQ or NMI */
+1
drivers/gpu/drm/ast/ast_ttm.c
··· 323 323 324 324 astbo->gem.driver_private = NULL; 325 325 astbo->bo.bdev = &ast->ttm.bdev; 326 + astbo->bo.bdev->dev_mapping = dev->dev_mapping; 326 327 327 328 ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); 328 329
+1
drivers/gpu/drm/cirrus/cirrus_ttm.c
··· 328 328 329 329 cirrusbo->gem.driver_private = NULL; 330 330 cirrusbo->bo.bdev = &cirrus->ttm.bdev; 331 + cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping; 331 332 332 333 cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); 333 334
+4 -1
drivers/gpu/drm/drm_irq.c
··· 708 708 /* Subtract time delta from raw timestamp to get final 709 709 * vblank_time timestamp for end of vblank. 710 710 */ 711 - etime = ktime_sub_ns(etime, delta_ns); 711 + if (delta_ns < 0) 712 + etime = ktime_add_ns(etime, -delta_ns); 713 + else 714 + etime = ktime_sub_ns(etime, delta_ns); 712 715 *vblank_time = ktime_to_timeval(etime); 713 716 714 717 DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
+9 -3
drivers/gpu/drm/i915/i915_reg.h
··· 1856 1856 #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) 1857 1857 1858 1858 #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) 1859 - /* HDMI/DP bits are gen4+ */ 1860 - #define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) 1859 + /* 1860 + * HDMI/DP bits are gen4+ 1861 + * 1862 + * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused. 1863 + * Please check the detailed lore in the commit message for for experimental 1864 + * evidence. 1865 + */ 1866 + #define PORTD_HOTPLUG_LIVE_STATUS (1 << 29) 1861 1867 #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) 1862 - #define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) 1868 + #define PORTB_HOTPLUG_LIVE_STATUS (1 << 27) 1863 1869 #define PORTD_HOTPLUG_INT_STATUS (3 << 21) 1864 1870 #define PORTC_HOTPLUG_INT_STATUS (3 << 19) 1865 1871 #define PORTB_HOTPLUG_INT_STATUS (3 << 17)
+3 -1
drivers/gpu/drm/i915/intel_display.c
··· 8269 8269 8270 8270 list_for_each_entry(encoder, &dev->mode_config.encoder_list, 8271 8271 base.head) { 8272 + enum pipe pipe; 8272 8273 if (encoder->base.crtc != &crtc->base) 8273 8274 continue; 8274 - if (encoder->get_config) 8275 + if (encoder->get_config && 8276 + encoder->get_hw_state(encoder, &pipe)) 8275 8277 encoder->get_config(encoder, &pipe_config); 8276 8278 } 8277 8279
+16 -2
drivers/gpu/drm/i915/intel_panel.c
··· 497 497 goto out; 498 498 } 499 499 500 - /* scale to hardware */ 501 - level = level * freq / max; 500 + /* scale to hardware, but be careful to not overflow */ 501 + if (freq < max) 502 + level = level * freq / max; 503 + else 504 + level = freq / max * level; 502 505 503 506 dev_priv->backlight.level = level; 504 507 if (dev_priv->backlight.device) ··· 517 514 { 518 515 struct drm_i915_private *dev_priv = dev->dev_private; 519 516 unsigned long flags; 517 + 518 + /* 519 + * Do not disable backlight on the vgaswitcheroo path. When switching 520 + * away from i915, the other client may depend on i915 to handle the 521 + * backlight. This will leave the backlight on unnecessarily when 522 + * another client is not activated. 523 + */ 524 + if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) { 525 + DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n"); 526 + return; 527 + } 520 528 521 529 spin_lock_irqsave(&dev_priv->backlight.lock, flags); 522 530
+18
drivers/gpu/drm/i915/intel_pm.c
··· 5063 5063 } 5064 5064 } else { 5065 5065 if (enable_requested) { 5066 + unsigned long irqflags; 5067 + enum pipe p; 5068 + 5066 5069 I915_WRITE(HSW_PWR_WELL_DRIVER, 0); 5070 + POSTING_READ(HSW_PWR_WELL_DRIVER); 5067 5071 DRM_DEBUG_KMS("Requesting to disable the power well\n"); 5072 + 5073 + /* 5074 + * After this, the registers on the pipes that are part 5075 + * of the power well will become zero, so we have to 5076 + * adjust our counters according to that. 5077 + * 5078 + * FIXME: Should we do this in general in 5079 + * drm_vblank_post_modeset? 5080 + */ 5081 + spin_lock_irqsave(&dev->vbl_lock, irqflags); 5082 + for_each_pipe(p) 5083 + if (p != PIPE_A) 5084 + dev->last_vblank[p] = 0; 5085 + spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 5068 5086 } 5069 5087 } 5070 5088 }
+1
drivers/gpu/drm/mgag200/mgag200_ttm.c
··· 323 323 324 324 mgabo->gem.driver_private = NULL; 325 325 mgabo->bo.bdev = &mdev->ttm.bdev; 326 + mgabo->bo.bdev->dev_mapping = dev->dev_mapping; 326 327 327 328 mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); 328 329
+2 -15
drivers/gpu/drm/radeon/btc_dpm.c
··· 2548 2548 { 2549 2549 struct rv7xx_power_info *pi; 2550 2550 struct evergreen_power_info *eg_pi; 2551 - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); 2552 - u16 data_offset, size; 2553 - u8 frev, crev; 2554 2551 struct atom_clock_dividers dividers; 2555 2552 int ret; 2556 2553 ··· 2630 2633 eg_pi->vddci_control = 2631 2634 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); 2632 2635 2633 - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 2634 - &frev, &crev, &data_offset)) { 2635 - pi->sclk_ss = true; 2636 - pi->mclk_ss = true; 2637 - pi->dynamic_ss = true; 2638 - } else { 2639 - pi->sclk_ss = false; 2640 - pi->mclk_ss = false; 2641 - pi->dynamic_ss = true; 2642 - } 2636 + rv770_get_engine_memory_ss(rdev); 2643 2637 2644 2638 pi->asi = RV770_ASI_DFLT; 2645 2639 pi->pasi = CYPRESS_HASI_DFLT; ··· 2647 2659 2648 2660 pi->dynamic_pcie_gen2 = true; 2649 2661 2650 - if (pi->gfx_clock_gating && 2651 - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) 2662 + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) 2652 2663 pi->thermal_protection = true; 2653 2664 else 2654 2665 pi->thermal_protection = false;
+15 -3
drivers/gpu/drm/radeon/cik.c
··· 2587 2587 if (rdev->wb.enabled) { 2588 2588 rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); 2589 2589 } else { 2590 + mutex_lock(&rdev->srbm_mutex); 2590 2591 cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); 2591 2592 rptr = RREG32(CP_HQD_PQ_RPTR); 2592 2593 cik_srbm_select(rdev, 0, 0, 0, 0); 2594 + mutex_unlock(&rdev->srbm_mutex); 2593 2595 } 2594 2596 rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; 2595 2597 ··· 2606 2604 if (rdev->wb.enabled) { 2607 2605 wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); 2608 2606 } else { 2607 + mutex_lock(&rdev->srbm_mutex); 2609 2608 cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); 2610 2609 wptr = RREG32(CP_HQD_PQ_WPTR); 2611 2610 cik_srbm_select(rdev, 0, 0, 0, 0); 2611 + mutex_unlock(&rdev->srbm_mutex); 2612 2612 } 2613 2613 wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; 2614 2614 ··· 2901 2897 WREG32(CP_CPF_DEBUG, tmp); 2902 2898 2903 2899 /* init the pipes */ 2900 + mutex_lock(&rdev->srbm_mutex); 2904 2901 for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { 2905 2902 int me = (i < 4) ? 1 : 2; 2906 2903 int pipe = (i < 4) ? i : (i - 4); ··· 2924 2919 WREG32(CP_HPD_EOP_CONTROL, tmp); 2925 2920 } 2926 2921 cik_srbm_select(rdev, 0, 0, 0, 0); 2922 + mutex_unlock(&rdev->srbm_mutex); 2927 2923 2928 2924 /* init the queues. Just two for now. */ 2929 2925 for (i = 0; i < 2; i++) { ··· 2978 2972 mqd->static_thread_mgmt23[0] = 0xffffffff; 2979 2973 mqd->static_thread_mgmt23[1] = 0xffffffff; 2980 2974 2975 + mutex_lock(&rdev->srbm_mutex); 2981 2976 cik_srbm_select(rdev, rdev->ring[idx].me, 2982 2977 rdev->ring[idx].pipe, 2983 2978 rdev->ring[idx].queue, 0); ··· 3106 3099 WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); 3107 3100 3108 3101 cik_srbm_select(rdev, 0, 0, 0, 0); 3102 + mutex_unlock(&rdev->srbm_mutex); 3109 3103 3110 3104 radeon_bo_kunmap(rdev->ring[idx].mqd_obj); 3111 3105 radeon_bo_unreserve(rdev->ring[idx].mqd_obj); ··· 4328 4320 4329 4321 /* XXX SH_MEM regs */ 4330 4322 /* where to put LDS, scratch, GPUVM in FSA64 space */ 4323 + mutex_lock(&rdev->srbm_mutex); 4331 4324 for (i = 0; i < 16; i++) { 4332 4325 cik_srbm_select(rdev, 0, 0, 0, i); 4333 4326 /* CP and shaders */ ··· 4344 4335 /* XXX SDMA RLC - todo */ 4345 4336 } 4346 4337 cik_srbm_select(rdev, 0, 0, 0, 0); 4338 + mutex_unlock(&rdev->srbm_mutex); 4347 4339 4348 4340 cik_pcie_gart_tlb_flush(rdev); 4349 4341 DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", ··· 5964 5954 struct radeon_ring *ring; 5965 5955 int r; 5966 5956 5957 + cik_mc_program(rdev); 5958 + 5967 5959 if (rdev->flags & RADEON_IS_IGP) { 5968 5960 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || 5969 5961 !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { ··· 5997 5985 if (r) 5998 5986 return r; 5999 5987 6000 - cik_mc_program(rdev); 6001 5988 r = cik_pcie_gart_enable(rdev); 6002 5989 if (r) 6003 5990 return r; ··· 6205 6194 radeon_vm_manager_fini(rdev); 6206 6195 cik_cp_enable(rdev, false); 6207 6196 cik_sdma_enable(rdev, false); 6208 - r600_uvd_rbc_stop(rdev); 6197 + r600_uvd_stop(rdev); 6209 6198 radeon_uvd_suspend(rdev); 6210 6199 cik_irq_suspend(rdev); 6211 6200 radeon_wb_disable(rdev); ··· 6369 6358 radeon_vm_manager_fini(rdev); 6370 6359 radeon_ib_pool_fini(rdev); 6371 6360 radeon_irq_kms_fini(rdev); 6361 + r600_uvd_stop(rdev); 6372 6362 radeon_uvd_fini(rdev); 6373 6363 cik_pcie_gart_fini(rdev); 6374 6364 r600_vram_scratch_fini(rdev); ··· 6990 6978 6991 6979 /* programm the VCPU memory controller bits 0-27 */ 6992 6980 addr = rdev->uvd.gpu_addr >> 3; 6993 - size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; 6981 + size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; 6994 6982 WREG32(UVD_VCPU_CACHE_OFFSET0, addr); 6995 6983 WREG32(UVD_VCPU_CACHE_SIZE0, size); 6996 6984
+2 -15
drivers/gpu/drm/radeon/cypress_dpm.c
··· 2038 2038 { 2039 2039 struct rv7xx_power_info *pi; 2040 2040 struct evergreen_power_info *eg_pi; 2041 - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); 2042 - uint16_t data_offset, size; 2043 - uint8_t frev, crev; 2044 2041 struct atom_clock_dividers dividers; 2045 2042 int ret; 2046 2043 ··· 2089 2092 eg_pi->vddci_control = 2090 2093 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); 2091 2094 2092 - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 2093 - &frev, &crev, &data_offset)) { 2094 - pi->sclk_ss = true; 2095 - pi->mclk_ss = true; 2096 - pi->dynamic_ss = true; 2097 - } else { 2098 - pi->sclk_ss = false; 2099 - pi->mclk_ss = false; 2100 - pi->dynamic_ss = true; 2101 - } 2095 + rv770_get_engine_memory_ss(rdev); 2102 2096 2103 2097 pi->asi = RV770_ASI_DFLT; 2104 2098 pi->pasi = CYPRESS_HASI_DFLT; ··· 2110 2122 2111 2123 pi->dynamic_pcie_gen2 = true; 2112 2124 2113 - if (pi->gfx_clock_gating && 2114 - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) 2125 + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) 2115 2126 pi->thermal_protection = true; 2116 2127 else 2117 2128 pi->thermal_protection = false;
+4 -2
drivers/gpu/drm/radeon/evergreen.c
··· 5106 5106 /* enable aspm */ 5107 5107 evergreen_program_aspm(rdev); 5108 5108 5109 + evergreen_mc_program(rdev); 5110 + 5109 5111 if (ASIC_IS_DCE5(rdev)) { 5110 5112 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { 5111 5113 r = ni_init_microcode(rdev); ··· 5135 5133 if (r) 5136 5134 return r; 5137 5135 5138 - evergreen_mc_program(rdev); 5139 5136 if (rdev->flags & RADEON_IS_AGP) { 5140 5137 evergreen_agp_enable(rdev); 5141 5138 } else { ··· 5292 5291 int evergreen_suspend(struct radeon_device *rdev) 5293 5292 { 5294 5293 r600_audio_fini(rdev); 5294 + r600_uvd_stop(rdev); 5295 5295 radeon_uvd_suspend(rdev); 5296 5296 r700_cp_stop(rdev); 5297 5297 r600_dma_stop(rdev); 5298 - r600_uvd_rbc_stop(rdev); 5299 5298 evergreen_irq_suspend(rdev); 5300 5299 radeon_wb_disable(rdev); 5301 5300 evergreen_pcie_gart_disable(rdev); ··· 5430 5429 radeon_ib_pool_fini(rdev); 5431 5430 radeon_irq_kms_fini(rdev); 5432 5431 evergreen_pcie_gart_fini(rdev); 5432 + r600_uvd_stop(rdev); 5433 5433 radeon_uvd_fini(rdev); 5434 5434 r600_vram_scratch_fini(rdev); 5435 5435 radeon_gem_fini(rdev);
+24 -2
drivers/gpu/drm/radeon/evergreen_hdmi.c
··· 148 148 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 149 149 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); 150 150 u32 base_rate = 24000; 151 + u32 max_ratio = clock / base_rate; 152 + u32 dto_phase; 153 + u32 dto_modulo = clock; 154 + u32 wallclock_ratio; 155 + u32 dto_cntl; 151 156 152 157 if (!dig || !dig->afmt) 153 158 return; 159 + 160 + if (max_ratio >= 8) { 161 + dto_phase = 192 * 1000; 162 + wallclock_ratio = 3; 163 + } else if (max_ratio >= 4) { 164 + dto_phase = 96 * 1000; 165 + wallclock_ratio = 2; 166 + } else if (max_ratio >= 2) { 167 + dto_phase = 48 * 1000; 168 + wallclock_ratio = 1; 169 + } else { 170 + dto_phase = 24 * 1000; 171 + wallclock_ratio = 0; 172 + } 173 + dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; 174 + dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); 175 + WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); 154 176 155 177 /* XXX two dtos; generally use dto0 for hdmi */ 156 178 /* Express [24MHz / target pixel clock] as an exact rational ··· 180 158 * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator 181 159 */ 182 160 WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); 183 - WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); 184 - WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); 161 + WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); 162 + WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); 185 163 } 186 164 187 165
+3
drivers/gpu/drm/radeon/evergreend.h
··· 497 497 #define DCCG_AUDIO_DTO0_MODULE 0x05b4 498 498 #define DCCG_AUDIO_DTO0_LOAD 0x05b8 499 499 #define DCCG_AUDIO_DTO0_CNTL 0x05bc 500 + # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) 501 + # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 502 + # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 500 503 501 504 #define DCCG_AUDIO_DTO1_PHASE 0x05c0 502 505 #define DCCG_AUDIO_DTO1_MODULE 0x05c4
+11 -5
drivers/gpu/drm/radeon/ni.c
··· 794 794 if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { 795 795 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); 796 796 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); 797 - if (err) 798 - goto out; 799 - if (rdev->smc_fw->size != smc_req_size) { 797 + if (err) { 798 + printk(KERN_ERR 799 + "smc: error loading firmware \"%s\"\n", 800 + fw_name); 801 + release_firmware(rdev->smc_fw); 802 + rdev->smc_fw = NULL; 803 + } else if (rdev->smc_fw->size != smc_req_size) { 800 804 printk(KERN_ERR 801 805 "ni_mc: Bogus length %zu in firmware \"%s\"\n", 802 806 rdev->mc_fw->size, fw_name); ··· 2083 2079 /* enable aspm */ 2084 2080 evergreen_program_aspm(rdev); 2085 2081 2082 + evergreen_mc_program(rdev); 2083 + 2086 2084 if (rdev->flags & RADEON_IS_IGP) { 2087 2085 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { 2088 2086 r = ni_init_microcode(rdev); ··· 2113 2107 if (r) 2114 2108 return r; 2115 2109 2116 - evergreen_mc_program(rdev); 2117 2110 r = cayman_pcie_gart_enable(rdev); 2118 2111 if (r) 2119 2112 return r; ··· 2291 2286 radeon_vm_manager_fini(rdev); 2292 2287 cayman_cp_enable(rdev, false); 2293 2288 cayman_dma_stop(rdev); 2294 - r600_uvd_rbc_stop(rdev); 2289 + r600_uvd_stop(rdev); 2295 2290 radeon_uvd_suspend(rdev); 2296 2291 evergreen_irq_suspend(rdev); 2297 2292 radeon_wb_disable(rdev); ··· 2423 2418 radeon_vm_manager_fini(rdev); 2424 2419 radeon_ib_pool_fini(rdev); 2425 2420 radeon_irq_kms_fini(rdev); 2421 + r600_uvd_stop(rdev); 2426 2422 radeon_uvd_fini(rdev); 2427 2423 cayman_pcie_gart_fini(rdev); 2428 2424 r600_vram_scratch_fini(rdev);
+2 -15
drivers/gpu/drm/radeon/ni_dpm.c
··· 4067 4067 struct rv7xx_power_info *pi; 4068 4068 struct evergreen_power_info *eg_pi; 4069 4069 struct ni_power_info *ni_pi; 4070 - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); 4071 - u16 data_offset, size; 4072 - u8 frev, crev; 4073 4070 struct atom_clock_dividers dividers; 4074 4071 int ret; 4075 4072 ··· 4159 4162 eg_pi->vddci_control = 4160 4163 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); 4161 4164 4162 - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 4163 - &frev, &crev, &data_offset)) { 4164 - pi->sclk_ss = true; 4165 - pi->mclk_ss = true; 4166 - pi->dynamic_ss = true; 4167 - } else { 4168 - pi->sclk_ss = false; 4169 - pi->mclk_ss = false; 4170 - pi->dynamic_ss = true; 4171 - } 4165 + rv770_get_engine_memory_ss(rdev); 4172 4166 4173 4167 pi->asi = RV770_ASI_DFLT; 4174 4168 pi->pasi = CYPRESS_HASI_DFLT; ··· 4176 4188 4177 4189 pi->dynamic_pcie_gen2 = true; 4178 4190 4179 - if (pi->gfx_clock_gating && 4180 - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) 4191 + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) 4181 4192 pi->thermal_protection = true; 4182 4193 else 4183 4194 pi->thermal_protection = false;
+32 -9
drivers/gpu/drm/radeon/r600.c
··· 2299 2299 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { 2300 2300 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); 2301 2301 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); 2302 - if (err) 2303 - goto out; 2304 - if (rdev->smc_fw->size != smc_req_size) { 2302 + if (err) { 2303 + printk(KERN_ERR 2304 + "smc: error loading firmware \"%s\"\n", 2305 + fw_name); 2306 + release_firmware(rdev->smc_fw); 2307 + rdev->smc_fw = NULL; 2308 + } else if (rdev->smc_fw->size != smc_req_size) { 2305 2309 printk(KERN_ERR 2306 2310 "smc: Bogus length %zu in firmware \"%s\"\n", 2307 2311 rdev->smc_fw->size, fw_name); ··· 2701 2697 return 0; 2702 2698 } 2703 2699 2704 - void r600_uvd_rbc_stop(struct radeon_device *rdev) 2700 + void r600_uvd_stop(struct radeon_device *rdev) 2705 2701 { 2706 2702 struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; 2707 2703 2708 2704 /* force RBC into idle state */ 2709 2705 WREG32(UVD_RBC_RB_CNTL, 0x11010101); 2706 + 2707 + /* Stall UMC and register bus before resetting VCPU */ 2708 + WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); 2709 + WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); 2710 + mdelay(1); 2711 + 2712 + /* put VCPU into reset */ 2713 + WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); 2714 + mdelay(5); 2715 + 2716 + /* disable VCPU clock */ 2717 + WREG32(UVD_VCPU_CNTL, 0x0); 2718 + 2719 + /* Unstall UMC and register bus */ 2720 + WREG32_P(UVD_LMI_CTRL2, 0, ~(1 << 8)); 2721 + WREG32_P(UVD_RB_ARB_CTRL, 0, ~(1 << 3)); 2722 + 2710 2723 ring->ready = false; 2711 2724 } 2712 2725 ··· 2742 2721 2743 2722 /* disable interupt */ 2744 2723 WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); 2724 + 2725 + /* Stall UMC and register bus before resetting VCPU */ 2726 + WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); 2727 + WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); 2728 + mdelay(1); 2745 2729 2746 2730 /* put LMI, VCPU, RBC etc... into reset */ 2747 2731 WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | ··· 2776 2750 WREG32(UVD_MPC_SET_MUXB1, 0x0); 2777 2751 WREG32(UVD_MPC_SET_ALU, 0); 2778 2752 WREG32(UVD_MPC_SET_MUX, 0x88); 2779 - 2780 - /* Stall UMC */ 2781 - WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); 2782 - WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); 2783 2753 2784 2754 /* take all subblocks out of reset, except VCPU */ 2785 2755 WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); ··· 3334 3312 /* enable pcie gen2 link */ 3335 3313 r600_pcie_gen2_enable(rdev); 3336 3314 3315 + r600_mc_program(rdev); 3316 + 3337 3317 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { 3338 3318 r = r600_init_microcode(rdev); 3339 3319 if (r) { ··· 3348 3324 if (r) 3349 3325 return r; 3350 3326 3351 - r600_mc_program(rdev); 3352 3327 if (rdev->flags & RADEON_IS_AGP) { 3353 3328 r600_agp_enable(rdev); 3354 3329 } else {
+34 -3
drivers/gpu/drm/radeon/r600_hdmi.c
··· 226 226 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 227 227 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 228 228 u32 base_rate = 24000; 229 + u32 max_ratio = clock / base_rate; 230 + u32 dto_phase; 231 + u32 dto_modulo = clock; 232 + u32 wallclock_ratio; 233 + u32 dto_cntl; 229 234 230 235 if (!dig || !dig->afmt) 231 236 return; 237 + 238 + if (max_ratio >= 8) { 239 + dto_phase = 192 * 1000; 240 + wallclock_ratio = 3; 241 + } else if (max_ratio >= 4) { 242 + dto_phase = 96 * 1000; 243 + wallclock_ratio = 2; 244 + } else if (max_ratio >= 2) { 245 + dto_phase = 48 * 1000; 246 + wallclock_ratio = 1; 247 + } else { 248 + dto_phase = 24 * 1000; 249 + wallclock_ratio = 0; 250 + } 232 251 233 252 /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. 234 253 * doesn't matter which one you use. Just use the first one. ··· 261 242 /* according to the reg specs, this should DCE3.2 only, but in 262 243 * practice it seems to cover DCE3.0 as well. 263 244 */ 264 - WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); 265 - WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); 266 - WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ 245 + if (dig->dig_encoder == 0) { 246 + dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; 247 + dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); 248 + WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); 249 + WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); 250 + WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); 251 + WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ 252 + } else { 253 + dto_cntl = RREG32(DCCG_AUDIO_DTO1_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; 254 + dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); 255 + WREG32(DCCG_AUDIO_DTO1_CNTL, dto_cntl); 256 + WREG32(DCCG_AUDIO_DTO1_PHASE, dto_phase); 257 + WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo); 258 + WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ 259 + } 267 260 } else { 268 261 /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ 269 262 WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) |
+3
drivers/gpu/drm/radeon/r600d.h
··· 933 933 #define DCCG_AUDIO_DTO0_LOAD 0x051c 934 934 # define DTO_LOAD (1 << 31) 935 935 #define DCCG_AUDIO_DTO0_CNTL 0x0520 936 + # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) 937 + # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 938 + # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 936 939 937 940 #define DCCG_AUDIO_DTO1_PHASE 0x0524 938 941 #define DCCG_AUDIO_DTO1_MODULE 0x0528
+3 -1
drivers/gpu/drm/radeon/radeon.h
··· 1468 1468 void *cpu_addr; 1469 1469 uint64_t gpu_addr; 1470 1470 void *saved_bo; 1471 - unsigned fw_size; 1472 1471 atomic_t handles[RADEON_MAX_UVD_HANDLES]; 1473 1472 struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; 1474 1473 struct delayed_work idle_work; ··· 2065 2066 const struct firmware *mec_fw; /* CIK MEC firmware */ 2066 2067 const struct firmware *sdma_fw; /* CIK SDMA firmware */ 2067 2068 const struct firmware *smc_fw; /* SMC firmware */ 2069 + const struct firmware *uvd_fw; /* UVD firmware */ 2068 2070 struct r600_blit r600_blit; 2069 2071 struct r600_vram_scratch vram_scratch; 2070 2072 int msi_enabled; /* msi enabled */ ··· 2095 2095 /* ACPI interface */ 2096 2096 struct radeon_atif atif; 2097 2097 struct radeon_atcs atcs; 2098 + /* srbm instance registers */ 2099 + struct mutex srbm_mutex; 2098 2100 }; 2099 2101 2100 2102 int radeon_device_init(struct radeon_device *rdev,
+1 -1
drivers/gpu/drm/radeon/radeon_asic.h
··· 441 441 /* uvd */ 442 442 int r600_uvd_init(struct radeon_device *rdev); 443 443 int r600_uvd_rbc_start(struct radeon_device *rdev); 444 - void r600_uvd_rbc_stop(struct radeon_device *rdev); 444 + void r600_uvd_stop(struct radeon_device *rdev); 445 445 int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); 446 446 void r600_uvd_fence_emit(struct radeon_device *rdev, 447 447 struct radeon_fence *fence);
+3
drivers/gpu/drm/radeon/radeon_device.c
··· 1163 1163 mutex_init(&rdev->gem.mutex); 1164 1164 mutex_init(&rdev->pm.mutex); 1165 1165 mutex_init(&rdev->gpu_clock_mutex); 1166 + mutex_init(&rdev->srbm_mutex); 1166 1167 init_rwsem(&rdev->pm.mclk_lock); 1167 1168 init_rwsem(&rdev->exclusive_lock); 1168 1169 init_waitqueue_head(&rdev->irq.vblank_queue); ··· 1520 1519 radeon_save_bios_scratch_regs(rdev); 1521 1520 /* block TTM */ 1522 1521 resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); 1522 + radeon_pm_suspend(rdev); 1523 1523 radeon_suspend(rdev); 1524 1524 1525 1525 for (i = 0; i < RADEON_NUM_RINGS; ++i) { ··· 1566 1564 } 1567 1565 } 1568 1566 1567 + radeon_pm_resume(rdev); 1569 1568 drm_helper_resume_force_mode(rdev->ddev); 1570 1569 1571 1570 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
+1 -1
drivers/gpu/drm/radeon/radeon_fence.c
··· 782 782 783 783 } else { 784 784 /* put fence directly behind firmware */ 785 - index = ALIGN(rdev->uvd.fw_size, 8); 785 + index = ALIGN(rdev->uvd_fw->size, 8); 786 786 rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; 787 787 rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; 788 788 }
-1
drivers/gpu/drm/radeon/radeon_gart.c
··· 207 207 if (rdev->gart.robj == NULL) { 208 208 return; 209 209 } 210 - radeon_gart_table_vram_unpin(rdev); 211 210 radeon_bo_unref(&rdev->gart.robj); 212 211 } 213 212
+8 -1
drivers/gpu/drm/radeon/radeon_pm.c
··· 1176 1176 case CHIP_VERDE: 1177 1177 case CHIP_OLAND: 1178 1178 case CHIP_HAINAN: 1179 - if (radeon_dpm == 1) 1179 + /* DPM requires the RLC, RV770+ dGPU requires SMC */ 1180 + if (!rdev->rlc_fw) 1181 + rdev->pm.pm_method = PM_METHOD_PROFILE; 1182 + else if ((rdev->family >= CHIP_RV770) && 1183 + (!(rdev->flags & RADEON_IS_IGP)) && 1184 + (!rdev->smc_fw)) 1185 + rdev->pm.pm_method = PM_METHOD_PROFILE; 1186 + else if (radeon_dpm == 1) 1180 1187 rdev->pm.pm_method = PM_METHOD_DPM; 1181 1188 else 1182 1189 rdev->pm.pm_method = PM_METHOD_PROFILE;
+70 -23
drivers/gpu/drm/radeon/radeon_uvd.c
··· 56 56 57 57 int radeon_uvd_init(struct radeon_device *rdev) 58 58 { 59 - const struct firmware *fw; 60 59 unsigned long bo_size; 61 60 const char *fw_name; 62 61 int i, r; ··· 104 105 return -EINVAL; 105 106 } 106 107 107 - r = request_firmware(&fw, fw_name, rdev->dev); 108 + r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev); 108 109 if (r) { 109 110 dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", 110 111 fw_name); 111 112 return r; 112 113 } 113 114 114 - bo_size = RADEON_GPU_PAGE_ALIGN(fw->size + 8) + 115 + bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) + 115 116 RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; 116 117 r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, 117 118 RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); ··· 144 145 145 146 radeon_bo_unreserve(rdev->uvd.vcpu_bo); 146 147 147 - rdev->uvd.fw_size = fw->size; 148 - memset(rdev->uvd.cpu_addr, 0, bo_size); 149 - memcpy(rdev->uvd.cpu_addr, fw->data, fw->size); 150 - 151 - release_firmware(fw); 152 - 153 148 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { 154 149 atomic_set(&rdev->uvd.handles[i], 0); 155 150 rdev->uvd.filp[i] = NULL; ··· 167 174 } 168 175 169 176 radeon_bo_unref(&rdev->uvd.vcpu_bo); 177 + 178 + release_firmware(rdev->uvd_fw); 170 179 } 171 180 172 181 int radeon_uvd_suspend(struct radeon_device *rdev) 173 182 { 174 183 unsigned size; 184 + void *ptr; 185 + int i; 175 186 176 187 if (rdev->uvd.vcpu_bo == NULL) 177 188 return 0; 178 189 190 + for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) 191 + if (atomic_read(&rdev->uvd.handles[i])) 192 + break; 193 + 194 + if (i == RADEON_MAX_UVD_HANDLES) 195 + return 0; 196 + 179 197 size = radeon_bo_size(rdev->uvd.vcpu_bo); 198 + size -= rdev->uvd_fw->size; 199 + 200 + ptr = rdev->uvd.cpu_addr; 201 + ptr += rdev->uvd_fw->size; 202 + 180 203 rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); 181 - memcpy(rdev->uvd.saved_bo, rdev->uvd.cpu_addr, size); 204 + memcpy(rdev->uvd.saved_bo, ptr, size); 182 205 183 206 return 0; 184 207 } 185 208 186 209 int radeon_uvd_resume(struct radeon_device *rdev) 187 210 { 211 + unsigned size; 212 + void *ptr; 213 + 188 214 if (rdev->uvd.vcpu_bo == NULL) 189 215 return -EINVAL; 190 216 217 + memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); 218 + 219 + size = radeon_bo_size(rdev->uvd.vcpu_bo); 220 + size -= rdev->uvd_fw->size; 221 + 222 + ptr = rdev->uvd.cpu_addr; 223 + ptr += rdev->uvd_fw->size; 224 + 191 225 if (rdev->uvd.saved_bo != NULL) { 192 - unsigned size = radeon_bo_size(rdev->uvd.vcpu_bo); 193 - memcpy(rdev->uvd.cpu_addr, rdev->uvd.saved_bo, size); 226 + memcpy(ptr, rdev->uvd.saved_bo, size); 194 227 kfree(rdev->uvd.saved_bo); 195 228 rdev->uvd.saved_bo = NULL; 196 - } 229 + } else 230 + memset(ptr, 0, size); 197 231 198 232 return 0; 199 233 } ··· 235 215 { 236 216 int i, r; 237 217 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { 238 - if (rdev->uvd.filp[i] == filp) { 239 - uint32_t handle = atomic_read(&rdev->uvd.handles[i]); 218 + uint32_t handle = atomic_read(&rdev->uvd.handles[i]); 219 + if (handle != 0 && rdev->uvd.filp[i] == filp) { 240 220 struct radeon_fence *fence; 241 221 242 222 r = radeon_uvd_get_destroy_msg(rdev, ··· 357 337 } 358 338 359 339 r = radeon_bo_kmap(bo, &ptr); 360 - if (r) 340 + if (r) { 341 + DRM_ERROR("Failed mapping the UVD message (%d)!\n", r); 361 342 return r; 343 + } 362 344 363 345 msg = ptr + offset; 364 346 ··· 386 364 radeon_bo_kunmap(bo); 387 365 return 0; 388 366 } else { 389 - /* it's a create msg, no special handling needed */ 390 367 radeon_bo_kunmap(bo); 368 + 369 + if (msg_type != 0) { 370 + DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type); 371 + return -EINVAL; 372 + } 373 + 374 + /* it's a create msg, no special handling needed */ 391 375 } 392 376 393 377 /* create or decode, validate the handle */ ··· 416 388 417 389 static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, 418 390 int data0, int data1, 419 - unsigned buf_sizes[]) 391 + unsigned buf_sizes[], bool *has_msg_cmd) 420 392 { 421 393 struct radeon_cs_chunk *relocs_chunk; 422 394 struct radeon_cs_reloc *reloc; ··· 445 417 446 418 if (cmd < 0x4) { 447 419 if ((end - start) < buf_sizes[cmd]) { 448 - DRM_ERROR("buffer to small (%d / %d)!\n", 420 + DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd, 449 421 (unsigned)(end - start), buf_sizes[cmd]); 450 422 return -EINVAL; 451 423 } ··· 470 442 } 471 443 472 444 if (cmd == 0) { 445 + if (*has_msg_cmd) { 446 + DRM_ERROR("More than one message in a UVD-IB!\n"); 447 + return -EINVAL; 448 + } 449 + *has_msg_cmd = true; 473 450 r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); 474 451 if (r) 475 452 return r; 453 + } else if (!*has_msg_cmd) { 454 + DRM_ERROR("Message needed before other commands are send!\n"); 455 + return -EINVAL; 476 456 } 477 457 478 458 return 0; ··· 489 453 static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, 490 454 struct radeon_cs_packet *pkt, 491 455 int *data0, int *data1, 492 - unsigned buf_sizes[]) 456 + unsigned buf_sizes[], 457 + bool *has_msg_cmd) 493 458 { 494 459 int i, r; 495 460 ··· 504 467 *data1 = p->idx; 505 468 break; 506 469 case UVD_GPCOM_VCPU_CMD: 507 - r = radeon_uvd_cs_reloc(p, *data0, *data1, buf_sizes); 470 + r = radeon_uvd_cs_reloc(p, *data0, *data1, 471 + buf_sizes, has_msg_cmd); 508 472 if (r) 509 473 return r; 510 474 break; ··· 525 487 { 526 488 struct radeon_cs_packet pkt; 527 489 int r, data0 = 0, data1 = 0; 490 + 491 + /* does the IB has a msg command */ 492 + bool has_msg_cmd = false; 528 493 529 494 /* minimum buffer sizes */ 530 495 unsigned buf_sizes[] = { ··· 555 514 return r; 556 515 switch (pkt.type) { 557 516 case RADEON_PACKET_TYPE0: 558 - r = radeon_uvd_cs_reg(p, &pkt, &data0, 559 - &data1, buf_sizes); 517 + r = radeon_uvd_cs_reg(p, &pkt, &data0, &data1, 518 + buf_sizes, &has_msg_cmd); 560 519 if (r) 561 520 return r; 562 521 break; ··· 568 527 return -EINVAL; 569 528 } 570 529 } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); 530 + 531 + if (!has_msg_cmd) { 532 + DRM_ERROR("UVD-IBs need a msg command!\n"); 533 + return -EINVAL; 534 + } 535 + 571 536 return 0; 572 537 } 573 538
+11 -11
drivers/gpu/drm/radeon/rv6xx_dpm.c
··· 1944 1944 1945 1945 int rv6xx_dpm_init(struct radeon_device *rdev) 1946 1946 { 1947 - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); 1948 - uint16_t data_offset, size; 1949 - uint8_t frev, crev; 1947 + struct radeon_atom_ss ss; 1950 1948 struct atom_clock_dividers dividers; 1951 1949 struct rv6xx_power_info *pi; 1952 1950 int ret; ··· 1987 1989 1988 1990 pi->gfx_clock_gating = true; 1989 1991 1990 - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 1991 - &frev, &crev, &data_offset)) { 1992 - pi->sclk_ss = true; 1993 - pi->mclk_ss = true; 1992 + pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, 1993 + ASIC_INTERNAL_ENGINE_SS, 0); 1994 + pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, 1995 + ASIC_INTERNAL_MEMORY_SS, 0); 1996 + 1997 + /* Disable sclk ss, causes hangs on a lot of systems */ 1998 + pi->sclk_ss = false; 1999 + 2000 + if (pi->sclk_ss || pi->mclk_ss) 1994 2001 pi->dynamic_ss = true; 1995 - } else { 1996 - pi->sclk_ss = false; 1997 - pi->mclk_ss = false; 2002 + else 1998 2003 pi->dynamic_ss = false; 1999 - } 2000 2004 2001 2005 pi->dynamic_pcie_gen2 = true; 2002 2006
+5 -2
drivers/gpu/drm/radeon/rv770.c
··· 813 813 814 814 /* programm the VCPU memory controller bits 0-27 */ 815 815 addr = rdev->uvd.gpu_addr >> 3; 816 - size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; 816 + size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; 817 817 WREG32(UVD_VCPU_CACHE_OFFSET0, addr); 818 818 WREG32(UVD_VCPU_CACHE_SIZE0, size); 819 819 ··· 1829 1829 /* enable pcie gen2 link */ 1830 1830 rv770_pcie_gen2_enable(rdev); 1831 1831 1832 + rv770_mc_program(rdev); 1833 + 1832 1834 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { 1833 1835 r = r600_init_microcode(rdev); 1834 1836 if (r) { ··· 1843 1841 if (r) 1844 1842 return r; 1845 1843 1846 - rv770_mc_program(rdev); 1847 1844 if (rdev->flags & RADEON_IS_AGP) { 1848 1845 rv770_agp_enable(rdev); 1849 1846 } else { ··· 1984 1983 int rv770_suspend(struct radeon_device *rdev) 1985 1984 { 1986 1985 r600_audio_fini(rdev); 1986 + r600_uvd_stop(rdev); 1987 1987 radeon_uvd_suspend(rdev); 1988 1988 r700_cp_stop(rdev); 1989 1989 r600_dma_stop(rdev); ··· 2100 2098 radeon_ib_pool_fini(rdev); 2101 2099 radeon_irq_kms_fini(rdev); 2102 2100 rv770_pcie_gart_fini(rdev); 2101 + r600_uvd_stop(rdev); 2103 2102 radeon_uvd_fini(rdev); 2104 2103 r600_vram_scratch_fini(rdev); 2105 2104 radeon_gem_fini(rdev);
+18 -15
drivers/gpu/drm/radeon/rv770_dpm.c
··· 2319 2319 return 0; 2320 2320 } 2321 2321 2322 + void rv770_get_engine_memory_ss(struct radeon_device *rdev) 2323 + { 2324 + struct rv7xx_power_info *pi = rv770_get_pi(rdev); 2325 + struct radeon_atom_ss ss; 2326 + 2327 + pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, 2328 + ASIC_INTERNAL_ENGINE_SS, 0); 2329 + pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, 2330 + ASIC_INTERNAL_MEMORY_SS, 0); 2331 + 2332 + if (pi->sclk_ss || pi->mclk_ss) 2333 + pi->dynamic_ss = true; 2334 + else 2335 + pi->dynamic_ss = false; 2336 + } 2337 + 2322 2338 int rv770_dpm_init(struct radeon_device *rdev) 2323 2339 { 2324 2340 struct rv7xx_power_info *pi; 2325 - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); 2326 - uint16_t data_offset, size; 2327 - uint8_t frev, crev; 2328 2341 struct atom_clock_dividers dividers; 2329 2342 int ret; 2330 2343 ··· 2382 2369 pi->mvdd_control = 2383 2370 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); 2384 2371 2385 - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 2386 - &frev, &crev, &data_offset)) { 2387 - pi->sclk_ss = true; 2388 - pi->mclk_ss = true; 2389 - pi->dynamic_ss = true; 2390 - } else { 2391 - pi->sclk_ss = false; 2392 - pi->mclk_ss = false; 2393 - pi->dynamic_ss = false; 2394 - } 2372 + rv770_get_engine_memory_ss(rdev); 2395 2373 2396 2374 pi->asi = RV770_ASI_DFLT; 2397 2375 pi->pasi = RV770_HASI_DFLT; ··· 2397 2393 2398 2394 pi->dynamic_pcie_gen2 = true; 2399 2395 2400 - if (pi->gfx_clock_gating && 2401 - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) 2396 + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) 2402 2397 pi->thermal_protection = true; 2403 2398 else 2404 2399 pi->thermal_protection = false;
+1
drivers/gpu/drm/radeon/rv770_dpm.h
··· 275 275 void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, 276 276 struct radeon_ps *new_ps, 277 277 struct radeon_ps *old_ps); 278 + void rv770_get_engine_memory_ss(struct radeon_device *rdev); 278 279 279 280 /* smc */ 280 281 int rv770_read_smc_soft_register(struct radeon_device *rdev,
+13 -6
drivers/gpu/drm/radeon/si.c
··· 1663 1663 1664 1664 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); 1665 1665 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); 1666 - if (err) 1667 - goto out; 1668 - if (rdev->smc_fw->size != smc_req_size) { 1666 + if (err) { 1667 + printk(KERN_ERR 1668 + "smc: error loading firmware \"%s\"\n", 1669 + fw_name); 1670 + release_firmware(rdev->smc_fw); 1671 + rdev->smc_fw = NULL; 1672 + } else if (rdev->smc_fw->size != smc_req_size) { 1669 1673 printk(KERN_ERR 1670 1674 "si_smc: Bogus length %zu in firmware \"%s\"\n", 1671 1675 rdev->smc_fw->size, fw_name); ··· 6422 6418 /* enable aspm */ 6423 6419 si_program_aspm(rdev); 6424 6420 6421 + si_mc_program(rdev); 6422 + 6425 6423 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || 6426 6424 !rdev->rlc_fw || !rdev->mc_fw) { 6427 6425 r = si_init_microcode(rdev); ··· 6443 6437 if (r) 6444 6438 return r; 6445 6439 6446 - si_mc_program(rdev); 6447 6440 r = si_pcie_gart_enable(rdev); 6448 6441 if (r) 6449 6442 return r; ··· 6626 6621 si_cp_enable(rdev, false); 6627 6622 cayman_dma_stop(rdev); 6628 6623 if (rdev->has_uvd) { 6629 - r600_uvd_rbc_stop(rdev); 6624 + r600_uvd_stop(rdev); 6630 6625 radeon_uvd_suspend(rdev); 6631 6626 } 6632 6627 si_irq_suspend(rdev); ··· 6768 6763 radeon_vm_manager_fini(rdev); 6769 6764 radeon_ib_pool_fini(rdev); 6770 6765 radeon_irq_kms_fini(rdev); 6771 - if (rdev->has_uvd) 6766 + if (rdev->has_uvd) { 6767 + r600_uvd_stop(rdev); 6772 6768 radeon_uvd_fini(rdev); 6769 + } 6773 6770 si_pcie_gart_fini(rdev); 6774 6771 r600_vram_scratch_fini(rdev); 6775 6772 radeon_gem_fini(rdev);
+35 -28
drivers/gpu/drm/radeon/si_dpm.c
··· 1767 1767 s64 temperature, t_slope, t_intercept, av, bv, t_ref; 1768 1768 s64 tmp; 1769 1769 1770 - i_leakage = drm_int2fixp(ileakage) / 100; 1770 + i_leakage = div64_s64(drm_int2fixp(ileakage), 100); 1771 1771 vddc = div64_s64(drm_int2fixp(v), 1000); 1772 1772 temperature = div64_s64(drm_int2fixp(t), 1000); 1773 1773 ··· 2903 2903 { 2904 2904 struct ni_ps *ps = ni_get_ps(rps); 2905 2905 struct radeon_clock_and_voltage_limits *max_limits; 2906 - bool disable_mclk_switching; 2906 + bool disable_mclk_switching = false; 2907 + bool disable_sclk_switching = false; 2907 2908 u32 mclk, sclk; 2908 2909 u16 vddc, vddci; 2909 2910 int i; ··· 2912 2911 if ((rdev->pm.dpm.new_active_crtc_count > 1) || 2913 2912 ni_dpm_vblank_too_short(rdev)) 2914 2913 disable_mclk_switching = true; 2915 - else 2916 - disable_mclk_switching = false; 2914 + 2915 + if (rps->vclk || rps->dclk) { 2916 + disable_mclk_switching = true; 2917 + disable_sclk_switching = true; 2918 + } 2917 2919 2918 2920 if (rdev->pm.dpm.ac_power) 2919 2921 max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; ··· 2944 2940 2945 2941 if (disable_mclk_switching) { 2946 2942 mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; 2947 - sclk = ps->performance_levels[0].sclk; 2948 - vddc = ps->performance_levels[0].vddc; 2949 2943 vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; 2950 2944 } else { 2951 - sclk = ps->performance_levels[0].sclk; 2952 2945 mclk = ps->performance_levels[0].mclk; 2953 - vddc = ps->performance_levels[0].vddc; 2954 2946 vddci = ps->performance_levels[0].vddci; 2947 + } 2948 + 2949 + if (disable_sclk_switching) { 2950 + sclk = ps->performance_levels[ps->performance_level_count - 1].sclk; 2951 + vddc = ps->performance_levels[ps->performance_level_count - 1].vddc; 2952 + } else { 2953 + sclk = ps->performance_levels[0].sclk; 2954 + vddc = ps->performance_levels[0].vddc; 2955 2955 } 2956 2956 2957 2957 /* adjusted low state */ ··· 2964 2956 ps->performance_levels[0].vddc = vddc; 2965 2957 ps->performance_levels[0].vddci = vddci; 2966 2958 2967 - for (i = 1; i < ps->performance_level_count; i++) { 2968 - if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) 2969 - ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; 2970 - if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) 2971 - ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; 2959 + if (disable_sclk_switching) { 2960 + sclk = ps->performance_levels[0].sclk; 2961 + for (i = 1; i < ps->performance_level_count; i++) { 2962 + if (sclk < ps->performance_levels[i].sclk) 2963 + sclk = ps->performance_levels[i].sclk; 2964 + } 2965 + for (i = 0; i < ps->performance_level_count; i++) { 2966 + ps->performance_levels[i].sclk = sclk; 2967 + ps->performance_levels[i].vddc = vddc; 2968 + } 2969 + } else { 2970 + for (i = 1; i < ps->performance_level_count; i++) { 2971 + if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) 2972 + ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; 2973 + if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) 2974 + ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; 2975 + } 2972 2976 } 2973 2977 2974 2978 if (disable_mclk_switching) { ··· 6273 6253 struct evergreen_power_info *eg_pi; 6274 6254 struct ni_power_info *ni_pi; 6275 6255 struct si_power_info *si_pi; 6276 - int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); 6277 - u16 data_offset, size; 6278 - u8 frev, crev; 6279 6256 struct atom_clock_dividers dividers; 6280 6257 int ret; 6281 6258 u32 mask; ··· 6363 6346 si_pi->vddc_phase_shed_control = 6364 6347 radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); 6365 6348 6366 - if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, 6367 - &frev, &crev, &data_offset)) { 6368 - pi->sclk_ss = true; 6369 - pi->mclk_ss = true; 6370 - pi->dynamic_ss = true; 6371 - } else { 6372 - pi->sclk_ss = false; 6373 - pi->mclk_ss = false; 6374 - pi->dynamic_ss = true; 6375 - } 6349 + rv770_get_engine_memory_ss(rdev); 6376 6350 6377 6351 pi->asi = RV770_ASI_DFLT; 6378 6352 pi->pasi = CYPRESS_HASI_DFLT; ··· 6374 6366 eg_pi->sclk_deep_sleep = true; 6375 6367 si_pi->sclk_deep_sleep_above_low = false; 6376 6368 6377 - if (pi->gfx_clock_gating && 6378 - (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) 6369 + if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) 6379 6370 pi->thermal_protection = true; 6380 6371 else 6381 6372 pi->thermal_protection = false;
-2
drivers/hid/hid-logitech-dj.c
··· 488 488 if (djrcv_dev->querying_devices) 489 489 return 0; 490 490 491 - djrcv_dev->querying_devices = true; 492 - 493 491 dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); 494 492 if (!dj_report) 495 493 return -ENOMEM;
+1 -1
drivers/hwmon/adt7470.c
··· 215 215 u16 value) 216 216 { 217 217 return i2c_smbus_write_byte_data(client, reg, value & 0xFF) 218 - && i2c_smbus_write_byte_data(client, reg + 1, value >> 8); 218 + || i2c_smbus_write_byte_data(client, reg + 1, value >> 8); 219 219 } 220 220 221 221 static void adt7470_init_client(struct i2c_client *client)
+2 -2
drivers/i2c/busses/i2c-kempld.c
··· 246 246 bus_frequency = KEMPLD_I2C_FREQ_MAX; 247 247 248 248 if (pld->info.spec_major == 1) 249 - prescale = pld->pld_clock / bus_frequency * 5 - 1000; 249 + prescale = pld->pld_clock / (bus_frequency * 5) - 1000; 250 250 else 251 - prescale = pld->pld_clock / bus_frequency * 4 - 3000; 251 + prescale = pld->pld_clock / (bus_frequency * 4) - 3000; 252 252 253 253 if (prescale < 0) 254 254 prescale = 0;
+1 -1
drivers/i2c/busses/i2c-mxs.c
··· 493 493 * based on this empirical measurement and a lot of previous frobbing. 494 494 */ 495 495 i2c->cmd_err = 0; 496 - if (msg->len < 8) { 496 + if (0) { /* disable PIO mode until a proper fix is made */ 497 497 ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); 498 498 if (ret) 499 499 mxs_i2c_reset(i2c);
+22 -8
drivers/iio/adc/ti_am335x_adc.c
··· 60 60 { 61 61 unsigned int stepconfig; 62 62 int i, steps; 63 - u32 step_en; 64 63 65 64 /* 66 65 * There are 16 configurable steps and 8 analog input ··· 85 86 adc_dev->channel_step[i] = steps; 86 87 steps++; 87 88 } 88 - step_en = get_adc_step_mask(adc_dev); 89 - am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); 89 + 90 90 } 91 91 92 92 static const char * const chan_name_ain[] = { ··· 140 142 int *val, int *val2, long mask) 141 143 { 142 144 struct tiadc_device *adc_dev = iio_priv(indio_dev); 143 - int i; 144 - unsigned int fifo1count, read; 145 + int i, map_val; 146 + unsigned int fifo1count, read, stepid; 145 147 u32 step = UINT_MAX; 146 148 bool found = false; 149 + u32 step_en; 150 + unsigned long timeout = jiffies + usecs_to_jiffies 151 + (IDLE_TIMEOUT * adc_dev->channels); 152 + step_en = get_adc_step_mask(adc_dev); 153 + am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); 154 + 155 + /* Wait for ADC sequencer to complete sampling */ 156 + while (tiadc_readl(adc_dev, REG_ADCFSM) & SEQ_STATUS) { 157 + if (time_after(jiffies, timeout)) 158 + return -EAGAIN; 159 + } 160 + map_val = chan->channel + TOTAL_CHANNELS; 147 161 148 162 /* 149 163 * When the sub-system is first enabled, ··· 180 170 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); 181 171 for (i = 0; i < fifo1count; i++) { 182 172 read = tiadc_readl(adc_dev, REG_FIFO1); 183 - if (read >> 16 == step) { 184 - *val = read & 0xfff; 173 + stepid = read & FIFOREAD_CHNLID_MASK; 174 + stepid = stepid >> 0x10; 175 + 176 + if (stepid == map_val) { 177 + read = read & FIFOREAD_DATA_MASK; 185 178 found = true; 179 + *val = read; 186 180 } 187 181 } 188 - am335x_tsc_se_update(adc_dev->mfd_tscadc); 182 + 189 183 if (found == false) 190 184 return -EBUSY; 191 185 return IIO_VAL_INT;
+22 -12
drivers/iio/industrialio-trigger.c
··· 127 127 void iio_trigger_poll(struct iio_trigger *trig, s64 time) 128 128 { 129 129 int i; 130 - if (!trig->use_count) 131 - for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) 132 - if (trig->subirqs[i].enabled) { 133 - trig->use_count++; 130 + 131 + if (!atomic_read(&trig->use_count)) { 132 + atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); 133 + 134 + for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { 135 + if (trig->subirqs[i].enabled) 134 136 generic_handle_irq(trig->subirq_base + i); 135 - } 137 + else 138 + iio_trigger_notify_done(trig); 139 + } 140 + } 136 141 } 137 142 EXPORT_SYMBOL(iio_trigger_poll); 138 143 ··· 151 146 void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) 152 147 { 153 148 int i; 154 - if (!trig->use_count) 155 - for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) 156 - if (trig->subirqs[i].enabled) { 157 - trig->use_count++; 149 + 150 + if (!atomic_read(&trig->use_count)) { 151 + atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); 152 + 153 + for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { 154 + if (trig->subirqs[i].enabled) 158 155 handle_nested_irq(trig->subirq_base + i); 159 - } 156 + else 157 + iio_trigger_notify_done(trig); 158 + } 159 + } 160 160 } 161 161 EXPORT_SYMBOL(iio_trigger_poll_chained); 162 162 163 163 void iio_trigger_notify_done(struct iio_trigger *trig) 164 164 { 165 - trig->use_count--; 166 - if (trig->use_count == 0 && trig->ops && trig->ops->try_reenable) 165 + if (atomic_dec_and_test(&trig->use_count) && trig->ops && 166 + trig->ops->try_reenable) 167 167 if (trig->ops->try_reenable(trig)) 168 168 /* Missed an interrupt so launch new poll now */ 169 169 iio_trigger_poll(trig, 0);
+2 -2
drivers/media/i2c/ml86v7667.c
··· 117 117 { 118 118 struct v4l2_subdev *sd = to_sd(ctrl); 119 119 struct i2c_client *client = v4l2_get_subdevdata(sd); 120 - int ret; 120 + int ret = -EINVAL; 121 121 122 122 switch (ctrl->id) { 123 123 case V4L2_CID_BRIGHTNESS: ··· 157 157 break; 158 158 } 159 159 160 - return 0; 160 + return ret; 161 161 } 162 162 163 163 static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
+1 -1
drivers/media/platform/coda.c
··· 1987 1987 1988 1988 #ifdef CONFIG_OF 1989 1989 static const struct of_device_id coda_dt_ids[] = { 1990 - { .compatible = "fsl,imx27-vpu", .data = &coda_platform_ids[CODA_IMX27] }, 1990 + { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] }, 1991 1991 { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, 1992 1992 { /* sentinel */ } 1993 1993 };
+1
drivers/media/platform/s5p-g2d/g2d.c
··· 784 784 } 785 785 *vfd = g2d_videodev; 786 786 vfd->lock = &dev->mutex; 787 + vfd->v4l2_dev = &dev->v4l2_dev; 787 788 ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); 788 789 if (ret) { 789 790 v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
+33 -50
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
··· 344 344 pix_mp->num_planes = 2; 345 345 /* Set pixelformat to the format in which MFC 346 346 outputs the decoded frame */ 347 - pix_mp->pixelformat = V4L2_PIX_FMT_NV12MT; 347 + pix_mp->pixelformat = ctx->dst_fmt->fourcc; 348 348 pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; 349 349 pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; 350 350 pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; ··· 382 382 mfc_err("Unsupported format for source.\n"); 383 383 return -EINVAL; 384 384 } 385 - if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { 386 - mfc_err("Not supported format.\n"); 385 + if (fmt->codec_mode == S5P_FIMV_CODEC_NONE) { 386 + mfc_err("Unknown codec\n"); 387 387 return -EINVAL; 388 + } 389 + if (!IS_MFCV6(dev)) { 390 + if (fmt->fourcc == V4L2_PIX_FMT_VP8) { 391 + mfc_err("Not supported format.\n"); 392 + return -EINVAL; 393 + } 388 394 } 389 395 } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 390 396 fmt = find_format(f, MFC_FMT_RAW); ··· 417 411 struct s5p_mfc_dev *dev = video_drvdata(file); 418 412 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); 419 413 int ret = 0; 420 - struct s5p_mfc_fmt *fmt; 421 414 struct v4l2_pix_format_mplane *pix_mp; 422 415 423 416 mfc_debug_enter(); ··· 430 425 goto out; 431 426 } 432 427 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 433 - fmt = find_format(f, MFC_FMT_RAW); 434 - if (!fmt) { 435 - mfc_err("Unsupported format for source.\n"); 436 - return -EINVAL; 437 - } 438 - if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) { 439 - mfc_err("Not supported format.\n"); 440 - return -EINVAL; 441 - } else if (IS_MFCV6(dev) && 442 - (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { 443 - mfc_err("Not supported format.\n"); 444 - return -EINVAL; 445 - } 446 - ctx->dst_fmt = fmt; 447 - mfc_debug_leave(); 448 - return ret; 449 - } else if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 450 - mfc_err("Wrong type error for S_FMT : %d", f->type); 451 - return -EINVAL; 452 - } 453 - fmt = find_format(f, MFC_FMT_DEC); 454 - if (!fmt || fmt->codec_mode == S5P_MFC_CODEC_NONE) { 455 - mfc_err("Unknown codec\n"); 456 - ret = -EINVAL; 428 + /* dst_fmt is validated by call to vidioc_try_fmt */ 429 + ctx->dst_fmt = find_format(f, MFC_FMT_RAW); 430 + ret = 0; 457 431 goto out; 458 - } 459 - if (fmt->type != MFC_FMT_DEC) { 460 - mfc_err("Wrong format selected, you should choose " 461 - "format for decoding\n"); 462 - ret = -EINVAL; 463 - goto out; 464 - } 465 - if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { 466 - mfc_err("Not supported format.\n"); 467 - return -EINVAL; 468 - } 469 - ctx->src_fmt = fmt; 470 - ctx->codec_mode = fmt->codec_mode; 471 - mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); 472 - pix_mp->height = 0; 473 - pix_mp->width = 0; 474 - if (pix_mp->plane_fmt[0].sizeimage) 475 - ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; 476 - else 477 - pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = 432 + } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 433 + /* src_fmt is validated by call to vidioc_try_fmt */ 434 + ctx->src_fmt = find_format(f, MFC_FMT_DEC); 435 + ctx->codec_mode = ctx->src_fmt->codec_mode; 436 + mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); 437 + pix_mp->height = 0; 438 + pix_mp->width = 0; 439 + if (pix_mp->plane_fmt[0].sizeimage) 440 + ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; 441 + else 442 + pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = 478 443 DEF_CPB_SIZE; 479 - pix_mp->plane_fmt[0].bytesperline = 0; 480 - ctx->state = MFCINST_INIT; 444 + pix_mp->plane_fmt[0].bytesperline = 0; 445 + ctx->state = MFCINST_INIT; 446 + ret = 0; 447 + goto out; 448 + } else { 449 + mfc_err("Wrong type error for S_FMT : %d", f->type); 450 + ret = -EINVAL; 451 + goto out; 452 + } 453 + 481 454 out: 482 455 mfc_debug_leave(); 483 456 return ret;
+17 -29
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
··· 906 906 907 907 static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) 908 908 { 909 + struct s5p_mfc_dev *dev = video_drvdata(file); 909 910 struct s5p_mfc_fmt *fmt; 910 911 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; 911 912 ··· 931 930 return -EINVAL; 932 931 } 933 932 933 + if (!IS_MFCV6(dev)) { 934 + if (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) { 935 + mfc_err("Not supported format.\n"); 936 + return -EINVAL; 937 + } 938 + } else if (IS_MFCV6(dev)) { 939 + if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) { 940 + mfc_err("Not supported format.\n"); 941 + return -EINVAL; 942 + } 943 + } 944 + 934 945 if (fmt->num_planes != pix_fmt_mp->num_planes) { 935 946 mfc_err("failed to try output format\n"); 936 947 return -EINVAL; ··· 960 947 { 961 948 struct s5p_mfc_dev *dev = video_drvdata(file); 962 949 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); 963 - struct s5p_mfc_fmt *fmt; 964 950 struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; 965 951 int ret = 0; 966 952 ··· 972 960 goto out; 973 961 } 974 962 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 975 - fmt = find_format(f, MFC_FMT_ENC); 976 - if (!fmt) { 977 - mfc_err("failed to set capture format\n"); 978 - return -EINVAL; 979 - } 963 + /* dst_fmt is validated by call to vidioc_try_fmt */ 964 + ctx->dst_fmt = find_format(f, MFC_FMT_ENC); 980 965 ctx->state = MFCINST_INIT; 981 - ctx->dst_fmt = fmt; 982 966 ctx->codec_mode = ctx->dst_fmt->codec_mode; 983 967 ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; 984 968 pix_fmt_mp->plane_fmt[0].bytesperline = 0; ··· 995 987 } 996 988 mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); 997 989 } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 998 - fmt = find_format(f, MFC_FMT_RAW); 999 - if (!fmt) { 1000 - mfc_err("failed to set output format\n"); 1001 - return -EINVAL; 1002 - } 1003 - 1004 - if (!IS_MFCV6(dev) && 1005 - (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) { 1006 - mfc_err("Not supported format.\n"); 1007 - return -EINVAL; 1008 - } else if (IS_MFCV6(dev) && 1009 - (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { 1010 - mfc_err("Not supported format.\n"); 1011 - return -EINVAL; 1012 - } 1013 - 1014 - if (fmt->num_planes != pix_fmt_mp->num_planes) { 1015 - mfc_err("failed to set output format\n"); 1016 - ret = -EINVAL; 1017 - goto out; 1018 - } 1019 - ctx->src_fmt = fmt; 990 + /* src_fmt is validated by call to vidioc_try_fmt */ 991 + ctx->src_fmt = find_format(f, MFC_FMT_RAW); 1020 992 ctx->img_width = pix_fmt_mp->width; 1021 993 ctx->img_height = pix_fmt_mp->height; 1022 994 mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode);
+1 -1
drivers/media/usb/em28xx/em28xx-i2c.c
··· 726 726 727 727 *eedata = data; 728 728 *eedata_len = len; 729 - dev_config = (void *)eedata; 729 + dev_config = (void *)*eedata; 730 730 731 731 switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { 732 732 case 0:
+6 -5
drivers/media/usb/hdpvr/hdpvr-core.c
··· 303 303 304 304 dev->workqueue = 0; 305 305 306 + /* init video transfer queues first of all */ 307 + /* to prevent oops in hdpvr_delete() on error paths */ 308 + INIT_LIST_HEAD(&dev->free_buff_list); 309 + INIT_LIST_HEAD(&dev->rec_buff_list); 310 + 306 311 /* register v4l2_device early so it can be used for printks */ 307 312 if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { 308 313 dev_err(&interface->dev, "v4l2_device_register failed\n"); ··· 329 324 dev->workqueue = create_singlethread_workqueue("hdpvr_buffer"); 330 325 if (!dev->workqueue) 331 326 goto error; 332 - 333 - /* init video transfer queues */ 334 - INIT_LIST_HEAD(&dev->free_buff_list); 335 - INIT_LIST_HEAD(&dev->rec_buff_list); 336 327 337 328 dev->options = hdpvr_default_options; 338 329 ··· 406 405 video_nr[atomic_inc_return(&dev_nr)]); 407 406 if (retval < 0) { 408 407 v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); 409 - goto error; 408 + goto reg_fail; 410 409 } 411 410 412 411 /* let the user know what node this device is now attached to */
+1 -1
drivers/media/usb/usbtv/Kconfig
··· 1 1 config VIDEO_USBTV 2 2 tristate "USBTV007 video capture support" 3 - depends on VIDEO_DEV 3 + depends on VIDEO_V4L2 4 4 select VIDEOBUF2_VMALLOC 5 5 6 6 ---help---
+38 -13
drivers/media/usb/usbtv/usbtv.c
··· 57 57 #define USBTV_CHUNK_SIZE 256 58 58 #define USBTV_CHUNK 240 59 59 #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ 60 - / 2 / USBTV_CHUNK) 60 + / 4 / USBTV_CHUNK) 61 61 62 62 /* Chunk header. */ 63 63 #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ ··· 89 89 /* Number of currently processed frame, useful find 90 90 * out when a new one begins. */ 91 91 u32 frame_id; 92 + int chunks_done; 92 93 93 94 int iso_size; 94 95 unsigned int sequence; ··· 203 202 return 0; 204 203 } 205 204 205 + /* Copy data from chunk into a frame buffer, deinterlacing the data 206 + * into every second line. Unfortunately, they don't align nicely into 207 + * 720 pixel lines, as the chunk is 240 words long, which is 480 pixels. 208 + * Therefore, we break down the chunk into two halves before copyting, 209 + * so that we can interleave a line if needed. */ 210 + static void usbtv_chunk_to_vbuf(u32 *frame, u32 *src, int chunk_no, int odd) 211 + { 212 + int half; 213 + 214 + for (half = 0; half < 2; half++) { 215 + int part_no = chunk_no * 2 + half; 216 + int line = part_no / 3; 217 + int part_index = (line * 2 + !odd) * 3 + (part_no % 3); 218 + 219 + u32 *dst = &frame[part_index * USBTV_CHUNK/2]; 220 + memcpy(dst, src, USBTV_CHUNK/2 * sizeof(*src)); 221 + src += USBTV_CHUNK/2; 222 + } 223 + } 224 + 206 225 /* Called for each 256-byte image chunk. 207 226 * First word identifies the chunk, followed by 240 words of image 208 227 * data and padding. */ ··· 239 218 frame_id = USBTV_FRAME_ID(chunk); 240 219 odd = USBTV_ODD(chunk); 241 220 chunk_no = USBTV_CHUNK_NO(chunk); 242 - 243 - /* Deinterlace. TODO: Use interlaced frame format. */ 244 - chunk_no = (chunk_no - chunk_no % 3) * 2 + chunk_no % 3; 245 - chunk_no += !odd * 3; 246 - 247 221 if (chunk_no >= USBTV_CHUNKS) 248 222 return; 249 223 250 224 /* Beginning of a frame. */ 251 - if (chunk_no == 0) 225 + if (chunk_no == 0) { 252 226 usbtv->frame_id = frame_id; 227 + usbtv->chunks_done = 0; 228 + } 229 + 230 + if (usbtv->frame_id != frame_id) 231 + return; 253 232 254 233 spin_lock_irqsave(&usbtv->buflock, flags); 255 234 if (list_empty(&usbtv->bufs)) { ··· 262 241 buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); 263 242 frame = vb2_plane_vaddr(&buf->vb, 0); 264 243 265 - /* Copy the chunk. */ 266 - memcpy(&frame[chunk_no * USBTV_CHUNK], &chunk[1], 267 - USBTV_CHUNK * sizeof(chunk[1])); 244 + /* Copy the chunk data. */ 245 + usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd); 246 + usbtv->chunks_done++; 268 247 269 248 /* Last chunk in a frame, signalling an end */ 270 - if (usbtv->frame_id && chunk_no == USBTV_CHUNKS-1) { 249 + if (odd && chunk_no == USBTV_CHUNKS-1) { 271 250 int size = vb2_plane_size(&buf->vb, 0); 251 + enum vb2_buffer_state state = usbtv->chunks_done == 252 + USBTV_CHUNKS ? 253 + VB2_BUF_STATE_DONE : 254 + VB2_BUF_STATE_ERROR; 272 255 273 256 buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; 274 257 buf->vb.v4l2_buf.sequence = usbtv->sequence++; 275 258 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); 276 259 vb2_set_plane_payload(&buf->vb, 0, size); 277 - vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); 260 + vb2_buffer_done(&buf->vb, state); 278 261 list_del(&buf->list); 279 262 } 280 263 ··· 543 518 if (*nbuffers < 2) 544 519 *nbuffers = 2; 545 520 *nplanes = 1; 546 - sizes[0] = USBTV_CHUNK * USBTV_CHUNKS * sizeof(u32); 521 + sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32); 547 522 548 523 return 0; 549 524 }
+1 -1
drivers/net/can/usb/peak_usb/pcan_usb.c
··· 649 649 if ((mc->ptr + rec_len) > mc->end) 650 650 goto decode_failed; 651 651 652 - memcpy(cf->data, mc->ptr, rec_len); 652 + memcpy(cf->data, mc->ptr, cf->can_dlc); 653 653 mc->ptr += rec_len; 654 654 } 655 655
+1 -1
drivers/net/ethernet/arc/emac_main.c
··· 199 199 struct arc_emac_priv *priv = netdev_priv(ndev); 200 200 unsigned int work_done; 201 201 202 - for (work_done = 0; work_done <= budget; work_done++) { 202 + for (work_done = 0; work_done < budget; work_done++) { 203 203 unsigned int *last_rx_bd = &priv->last_rx_bd; 204 204 struct net_device_stats *stats = &priv->stats; 205 205 struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd];
+5
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 1502 1502 #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21) 1503 1503 #define IS_VF_FLAG (1 << 22) 1504 1504 #define INTERRUPTS_ENABLED_FLAG (1 << 23) 1505 + #define BC_SUPPORTS_RMMOD_CMD (1 << 24) 1505 1506 1506 1507 #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) 1507 1508 ··· 1831 1830 1832 1831 int fp_array_size; 1833 1832 u32 dump_preset_idx; 1833 + bool stats_started; 1834 + struct semaphore stats_sema; 1834 1835 }; 1835 1836 1836 1837 /* Tx queues may be less or equal to Rx queues */ ··· 2454 2451 BNX2X_PCI_LINK_SPEED_5000 = 5000, 2455 2452 BNX2X_PCI_LINK_SPEED_8000 = 8000 2456 2453 }; 2454 + 2455 + void bnx2x_set_local_cmng(struct bnx2x *bp); 2457 2456 #endif /* bnx2x.h */
+4
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
··· 753 753 bnx2x_pfc_set_pfc(bp); 754 754 755 755 bnx2x_dcbx_update_ets_params(bp); 756 + 757 + /* ets may affect cmng configuration: reinit it in hw */ 758 + bnx2x_set_local_cmng(bp); 759 + 756 760 bnx2x_dcbx_resume_hw_tx(bp); 757 761 758 762 return;
+5
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
··· 1300 1300 1301 1301 #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000 1302 1302 1303 + #define DRV_MSG_CODE_RMMOD 0xdb000000 1304 + #define REQ_BC_VER_4_RMMOD_CMD 0x0007080f 1305 + 1303 1306 #define DRV_MSG_CODE_SET_MF_BW 0xe0000000 1304 1307 #define REQ_BC_VER_4_SET_MF_BW 0x00060202 1305 1308 #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000 ··· 1374 1371 #define FW_MSG_CODE_DRV_INFO_NACK 0xd9100000 1375 1372 1376 1373 #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000 1374 + 1375 + #define FW_MSG_CODE_RMMOD_ACK 0xdb100000 1377 1376 1378 1377 #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000 1379 1378 #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000
+29 -14
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 2476 2476 2477 2477 input.port_rate = bp->link_vars.line_speed; 2478 2478 2479 - if (cmng_type == CMNG_FNS_MINMAX) { 2479 + if (cmng_type == CMNG_FNS_MINMAX && input.port_rate) { 2480 2480 int vn; 2481 2481 2482 2482 /* read mf conf from shmem */ ··· 2533 2533 } 2534 2534 } 2535 2535 2536 + /* init cmng mode in HW according to local configuration */ 2537 + void bnx2x_set_local_cmng(struct bnx2x *bp) 2538 + { 2539 + int cmng_fns = bnx2x_get_cmng_fns_mode(bp); 2540 + 2541 + if (cmng_fns != CMNG_FNS_NONE) { 2542 + bnx2x_cmng_fns_init(bp, false, cmng_fns); 2543 + storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp)); 2544 + } else { 2545 + /* rate shaping and fairness are disabled */ 2546 + DP(NETIF_MSG_IFUP, 2547 + "single function mode without fairness\n"); 2548 + } 2549 + } 2550 + 2536 2551 /* This function is called upon link interrupt */ 2537 2552 static void bnx2x_link_attn(struct bnx2x *bp) 2538 2553 { ··· 2583 2568 bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); 2584 2569 } 2585 2570 2586 - if (bp->link_vars.link_up && bp->link_vars.line_speed) { 2587 - int cmng_fns = bnx2x_get_cmng_fns_mode(bp); 2588 - 2589 - if (cmng_fns != CMNG_FNS_NONE) { 2590 - bnx2x_cmng_fns_init(bp, false, cmng_fns); 2591 - storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp)); 2592 - } else 2593 - /* rate shaping and fairness are disabled */ 2594 - DP(NETIF_MSG_IFUP, 2595 - "single function mode without fairness\n"); 2596 - } 2571 + if (bp->link_vars.link_up && bp->link_vars.line_speed) 2572 + bnx2x_set_local_cmng(bp); 2597 2573 2598 2574 __bnx2x_link_report(bp); 2599 2575 ··· 10366 10360 10367 10361 bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ? 10368 10362 BC_SUPPORTS_DCBX_MSG_NON_PMF : 0; 10363 + 10364 + bp->flags |= (val >= REQ_BC_VER_4_RMMOD_CMD) ? 10365 + BC_SUPPORTS_RMMOD_CMD : 0; 10366 + 10369 10367 boot_mode = SHMEM_RD(bp, 10370 10368 dev_info.port_feature_config[BP_PORT(bp)].mba_config) & 10371 10369 PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK; ··· 11532 11522 mutex_init(&bp->port.phy_mutex); 11533 11523 mutex_init(&bp->fw_mb_mutex); 11534 11524 spin_lock_init(&bp->stats_lock); 11525 + sema_init(&bp->stats_sema, 1); 11535 11526 11536 11527 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); 11537 11528 INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task); ··· 12836 12825 bnx2x_dcbnl_update_applist(bp, true); 12837 12826 #endif 12838 12827 12828 + if (IS_PF(bp) && 12829 + !BP_NOMCP(bp) && 12830 + (bp->flags & BC_SUPPORTS_RMMOD_CMD)) 12831 + bnx2x_fw_command(bp, DRV_MSG_CODE_RMMOD, 0); 12832 + 12839 12833 /* Close the interface - either directly or implicitly */ 12840 12834 if (remove_netdev) { 12841 12835 unregister_netdev(dev); 12842 12836 } else { 12843 12837 rtnl_lock(); 12844 - if (netif_running(dev)) 12845 - bnx2x_close(dev); 12838 + dev_close(dev); 12846 12839 rtnl_unlock(); 12847 12840 } 12848 12841
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
··· 3471 3471 alloc_mem_err: 3472 3472 BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, 3473 3473 sizeof(struct bnx2x_vf_mbx_msg)); 3474 - BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, 3474 + BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping, 3475 3475 sizeof(union pf_vf_bulletin)); 3476 3476 return -ENOMEM; 3477 3477 }
+54 -12
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
··· 221 221 * Statistics service functions 222 222 */ 223 223 224 - static void bnx2x_stats_pmf_update(struct bnx2x *bp) 224 + /* should be called under stats_sema */ 225 + static void __bnx2x_stats_pmf_update(struct bnx2x *bp) 225 226 { 226 227 struct dmae_command *dmae; 227 228 u32 opcode; ··· 519 518 *stats_comp = 0; 520 519 } 521 520 522 - static void bnx2x_stats_start(struct bnx2x *bp) 521 + /* should be called under stats_sema */ 522 + static void __bnx2x_stats_start(struct bnx2x *bp) 523 523 { 524 524 /* vfs travel through here as part of the statistics FSM, but no action 525 525 * is required ··· 536 534 537 535 bnx2x_hw_stats_post(bp); 538 536 bnx2x_storm_stats_post(bp); 537 + 538 + bp->stats_started = true; 539 + } 540 + 541 + static void bnx2x_stats_start(struct bnx2x *bp) 542 + { 543 + if (down_timeout(&bp->stats_sema, HZ/10)) 544 + BNX2X_ERR("Unable to acquire stats lock\n"); 545 + __bnx2x_stats_start(bp); 546 + up(&bp->stats_sema); 539 547 } 540 548 541 549 static void bnx2x_stats_pmf_start(struct bnx2x *bp) 542 550 { 551 + if (down_timeout(&bp->stats_sema, HZ/10)) 552 + BNX2X_ERR("Unable to acquire stats lock\n"); 543 553 bnx2x_stats_comp(bp); 544 - bnx2x_stats_pmf_update(bp); 545 - bnx2x_stats_start(bp); 554 + __bnx2x_stats_pmf_update(bp); 555 + __bnx2x_stats_start(bp); 556 + up(&bp->stats_sema); 557 + } 558 + 559 + static void bnx2x_stats_pmf_update(struct bnx2x *bp) 560 + { 561 + if (down_timeout(&bp->stats_sema, HZ/10)) 562 + BNX2X_ERR("Unable to acquire stats lock\n"); 563 + __bnx2x_stats_pmf_update(bp); 564 + up(&bp->stats_sema); 546 565 } 547 566 548 567 static void bnx2x_stats_restart(struct bnx2x *bp) ··· 573 550 */ 574 551 if (IS_VF(bp)) 575 552 return; 553 + if (down_timeout(&bp->stats_sema, HZ/10)) 554 + BNX2X_ERR("Unable to acquire stats lock\n"); 576 555 bnx2x_stats_comp(bp); 577 - bnx2x_stats_start(bp); 556 + __bnx2x_stats_start(bp); 557 + up(&bp->stats_sema); 578 558 } 579 559 580 560 static void bnx2x_bmac_stats_update(struct bnx2x *bp) ··· 914 888 /* Make sure we use the value of the counter 915 889 * used for sending the last stats ramrod. 916 890 */ 917 - spin_lock_bh(&bp->stats_lock); 918 891 cur_stats_counter = bp->stats_counter - 1; 919 - spin_unlock_bh(&bp->stats_lock); 920 892 921 893 /* are storm stats valid? */ 922 894 if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) { ··· 1251 1227 { 1252 1228 u32 *stats_comp = bnx2x_sp(bp, stats_comp); 1253 1229 1254 - if (bnx2x_edebug_stats_stopped(bp)) 1230 + /* we run update from timer context, so give up 1231 + * if somebody is in the middle of transition 1232 + */ 1233 + if (down_trylock(&bp->stats_sema)) 1255 1234 return; 1235 + 1236 + if (bnx2x_edebug_stats_stopped(bp) || !bp->stats_started) 1237 + goto out; 1256 1238 1257 1239 if (IS_PF(bp)) { 1258 1240 if (*stats_comp != DMAE_COMP_VAL) 1259 - return; 1241 + goto out; 1260 1242 1261 1243 if (bp->port.pmf) 1262 1244 bnx2x_hw_stats_update(bp); ··· 1272 1242 BNX2X_ERR("storm stats were not updated for 3 times\n"); 1273 1243 bnx2x_panic(); 1274 1244 } 1275 - return; 1245 + goto out; 1276 1246 } 1277 1247 } else { 1278 1248 /* vf doesn't collect HW statistics, and doesn't get completions ··· 1286 1256 1287 1257 /* vf is done */ 1288 1258 if (IS_VF(bp)) 1289 - return; 1259 + goto out; 1290 1260 1291 1261 if (netif_msg_timer(bp)) { 1292 1262 struct bnx2x_eth_stats *estats = &bp->eth_stats; ··· 1297 1267 1298 1268 bnx2x_hw_stats_post(bp); 1299 1269 bnx2x_storm_stats_post(bp); 1270 + 1271 + out: 1272 + up(&bp->stats_sema); 1300 1273 } 1301 1274 1302 1275 static void bnx2x_port_stats_stop(struct bnx2x *bp) ··· 1365 1332 { 1366 1333 int update = 0; 1367 1334 1335 + if (down_timeout(&bp->stats_sema, HZ/10)) 1336 + BNX2X_ERR("Unable to acquire stats lock\n"); 1337 + 1338 + bp->stats_started = false; 1339 + 1368 1340 bnx2x_stats_comp(bp); 1369 1341 1370 1342 if (bp->port.pmf) ··· 1386 1348 bnx2x_hw_stats_post(bp); 1387 1349 bnx2x_stats_comp(bp); 1388 1350 } 1351 + 1352 + up(&bp->stats_sema); 1389 1353 } 1390 1354 1391 1355 static void bnx2x_stats_do_nothing(struct bnx2x *bp) ··· 1416 1376 void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) 1417 1377 { 1418 1378 enum bnx2x_stats_state state; 1379 + void (*action)(struct bnx2x *bp); 1419 1380 if (unlikely(bp->panic)) 1420 1381 return; 1421 1382 1422 1383 spin_lock_bh(&bp->stats_lock); 1423 1384 state = bp->stats_state; 1424 1385 bp->stats_state = bnx2x_stats_stm[state][event].next_state; 1386 + action = bnx2x_stats_stm[state][event].action; 1425 1387 spin_unlock_bh(&bp->stats_lock); 1426 1388 1427 - bnx2x_stats_stm[state][event].action(bp); 1389 + action(bp); 1428 1390 1429 1391 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) 1430 1392 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
+8 -5
drivers/net/ethernet/broadcom/tg3.c
··· 17858 17858 17859 17859 done: 17860 17860 if (state == pci_channel_io_perm_failure) { 17861 - tg3_napi_enable(tp); 17862 - dev_close(netdev); 17861 + if (netdev) { 17862 + tg3_napi_enable(tp); 17863 + dev_close(netdev); 17864 + } 17863 17865 err = PCI_ERS_RESULT_DISCONNECT; 17864 17866 } else { 17865 17867 pci_disable_device(pdev); ··· 17891 17889 rtnl_lock(); 17892 17890 17893 17891 if (pci_enable_device(pdev)) { 17894 - netdev_err(netdev, "Cannot re-enable PCI device after reset.\n"); 17892 + dev_err(&pdev->dev, 17893 + "Cannot re-enable PCI device after reset.\n"); 17895 17894 goto done; 17896 17895 } 17897 17896 ··· 17900 17897 pci_restore_state(pdev); 17901 17898 pci_save_state(pdev); 17902 17899 17903 - if (!netif_running(netdev)) { 17900 + if (!netdev || !netif_running(netdev)) { 17904 17901 rc = PCI_ERS_RESULT_RECOVERED; 17905 17902 goto done; 17906 17903 } ··· 17912 17909 rc = PCI_ERS_RESULT_RECOVERED; 17913 17910 17914 17911 done: 17915 - if (rc != PCI_ERS_RESULT_RECOVERED && netif_running(netdev)) { 17912 + if (rc != PCI_ERS_RESULT_RECOVERED && netdev && netif_running(netdev)) { 17916 17913 tg3_napi_enable(tp); 17917 17914 dev_close(netdev); 17918 17915 }
+24 -83
drivers/net/ethernet/chelsio/cxgb3/sge.c
··· 455 455 q->pg_chunk.offset = 0; 456 456 mapping = pci_map_page(adapter->pdev, q->pg_chunk.page, 457 457 0, q->alloc_size, PCI_DMA_FROMDEVICE); 458 - if (unlikely(pci_dma_mapping_error(adapter->pdev, mapping))) { 459 - __free_pages(q->pg_chunk.page, order); 460 - q->pg_chunk.page = NULL; 461 - return -EIO; 462 - } 463 458 q->pg_chunk.mapping = mapping; 464 459 } 465 460 sd->pg_chunk = q->pg_chunk; ··· 949 954 return flits_to_desc(flits); 950 955 } 951 956 952 - 953 - /* map_skb - map a packet main body and its page fragments 954 - * @pdev: the PCI device 955 - * @skb: the packet 956 - * @addr: placeholder to save the mapped addresses 957 - * 958 - * map the main body of an sk_buff and its page fragments, if any. 959 - */ 960 - static int map_skb(struct pci_dev *pdev, const struct sk_buff *skb, 961 - dma_addr_t *addr) 962 - { 963 - const skb_frag_t *fp, *end; 964 - const struct skb_shared_info *si; 965 - 966 - *addr = pci_map_single(pdev, skb->data, skb_headlen(skb), 967 - PCI_DMA_TODEVICE); 968 - if (pci_dma_mapping_error(pdev, *addr)) 969 - goto out_err; 970 - 971 - si = skb_shinfo(skb); 972 - end = &si->frags[si->nr_frags]; 973 - 974 - for (fp = si->frags; fp < end; fp++) { 975 - *++addr = skb_frag_dma_map(&pdev->dev, fp, 0, skb_frag_size(fp), 976 - DMA_TO_DEVICE); 977 - if (pci_dma_mapping_error(pdev, *addr)) 978 - goto unwind; 979 - } 980 - return 0; 981 - 982 - unwind: 983 - while (fp-- > si->frags) 984 - dma_unmap_page(&pdev->dev, *--addr, skb_frag_size(fp), 985 - DMA_TO_DEVICE); 986 - 987 - pci_unmap_single(pdev, addr[-1], skb_headlen(skb), PCI_DMA_TODEVICE); 988 - out_err: 989 - return -ENOMEM; 990 - } 991 - 992 957 /** 993 - * write_sgl - populate a scatter/gather list for a packet 958 + * make_sgl - populate a scatter/gather list for a packet 994 959 * @skb: the packet 995 960 * @sgp: the SGL to populate 996 961 * @start: start address of skb main body data to include in the SGL 997 962 * @len: length of skb main body data to include in the SGL 998 - * @addr: the list of the mapped addresses 963 + * @pdev: the PCI device 999 964 * 1000 - * Copies the scatter/gather list for the buffers that make up a packet 965 + * Generates a scatter/gather list for the buffers that make up a packet 1001 966 * and returns the SGL size in 8-byte words. The caller must size the SGL 1002 967 * appropriately. 1003 968 */ 1004 - static inline unsigned int write_sgl(const struct sk_buff *skb, 969 + static inline unsigned int make_sgl(const struct sk_buff *skb, 1005 970 struct sg_ent *sgp, unsigned char *start, 1006 - unsigned int len, const dma_addr_t *addr) 971 + unsigned int len, struct pci_dev *pdev) 1007 972 { 1008 - unsigned int i, j = 0, k = 0, nfrags; 973 + dma_addr_t mapping; 974 + unsigned int i, j = 0, nfrags; 1009 975 1010 976 if (len) { 977 + mapping = pci_map_single(pdev, start, len, PCI_DMA_TODEVICE); 1011 978 sgp->len[0] = cpu_to_be32(len); 1012 - sgp->addr[j++] = cpu_to_be64(addr[k++]); 979 + sgp->addr[0] = cpu_to_be64(mapping); 980 + j = 1; 1013 981 } 1014 982 1015 983 nfrags = skb_shinfo(skb)->nr_frags; 1016 984 for (i = 0; i < nfrags; i++) { 1017 985 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 1018 986 987 + mapping = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag), 988 + DMA_TO_DEVICE); 1019 989 sgp->len[j] = cpu_to_be32(skb_frag_size(frag)); 1020 - sgp->addr[j] = cpu_to_be64(addr[k++]); 990 + sgp->addr[j] = cpu_to_be64(mapping); 1021 991 j ^= 1; 1022 992 if (j == 0) 1023 993 ++sgp; ··· 1138 1178 const struct port_info *pi, 1139 1179 unsigned int pidx, unsigned int gen, 1140 1180 struct sge_txq *q, unsigned int ndesc, 1141 - unsigned int compl, const dma_addr_t *addr) 1181 + unsigned int compl) 1142 1182 { 1143 1183 unsigned int flits, sgl_flits, cntrl, tso_info; 1144 1184 struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1]; ··· 1196 1236 } 1197 1237 1198 1238 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; 1199 - sgl_flits = write_sgl(skb, sgp, skb->data, skb_headlen(skb), addr); 1239 + sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev); 1200 1240 1201 1241 write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen, 1202 1242 htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl), ··· 1227 1267 struct netdev_queue *txq; 1228 1268 struct sge_qset *qs; 1229 1269 struct sge_txq *q; 1230 - dma_addr_t addr[MAX_SKB_FRAGS + 1]; 1231 1270 1232 1271 /* 1233 1272 * The chip min packet length is 9 octets but play safe and reject ··· 1253 1294 "%s: Tx ring %u full while queue awake!\n", 1254 1295 dev->name, q->cntxt_id & 7); 1255 1296 return NETDEV_TX_BUSY; 1256 - } 1257 - 1258 - if (unlikely(map_skb(adap->pdev, skb, addr) < 0)) { 1259 - dev_kfree_skb(skb); 1260 - return NETDEV_TX_OK; 1261 1297 } 1262 1298 1263 1299 q->in_use += ndesc; ··· 1312 1358 if (likely(!skb_shared(skb))) 1313 1359 skb_orphan(skb); 1314 1360 1315 - write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl, addr); 1361 + write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl); 1316 1362 check_ring_tx_db(adap, q); 1317 1363 return NETDEV_TX_OK; 1318 1364 } ··· 1577 1623 */ 1578 1624 static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, 1579 1625 struct sge_txq *q, unsigned int pidx, 1580 - unsigned int gen, unsigned int ndesc, 1581 - const dma_addr_t *addr) 1626 + unsigned int gen, unsigned int ndesc) 1582 1627 { 1583 1628 unsigned int sgl_flits, flits; 1584 1629 struct work_request_hdr *from; ··· 1598 1645 1599 1646 flits = skb_transport_offset(skb) / 8; 1600 1647 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; 1601 - sgl_flits = write_sgl(skb, sgp, skb_transport_header(skb), 1602 - skb_tail_pointer(skb) - 1603 - skb_transport_header(skb), addr); 1648 + sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), 1649 + skb->tail - skb->transport_header, 1650 + adap->pdev); 1604 1651 if (need_skb_unmap()) { 1605 1652 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); 1606 1653 skb->destructor = deferred_unmap_destructor; ··· 1658 1705 goto again; 1659 1706 } 1660 1707 1661 - if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) { 1662 - spin_unlock(&q->lock); 1663 - return NET_XMIT_SUCCESS; 1664 - } 1665 - 1666 1708 gen = q->gen; 1667 1709 q->in_use += ndesc; 1668 1710 pidx = q->pidx; ··· 1668 1720 } 1669 1721 spin_unlock(&q->lock); 1670 1722 1671 - write_ofld_wr(adap, skb, q, pidx, gen, ndesc, (dma_addr_t *)skb->head); 1723 + write_ofld_wr(adap, skb, q, pidx, gen, ndesc); 1672 1724 check_ring_tx_db(adap, q); 1673 1725 return NET_XMIT_SUCCESS; 1674 1726 } ··· 1686 1738 struct sge_txq *q = &qs->txq[TXQ_OFLD]; 1687 1739 const struct port_info *pi = netdev_priv(qs->netdev); 1688 1740 struct adapter *adap = pi->adapter; 1689 - unsigned int written = 0; 1690 1741 1691 1742 spin_lock(&q->lock); 1692 1743 again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); ··· 1705 1758 break; 1706 1759 } 1707 1760 1708 - if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) 1709 - break; 1710 - 1711 1761 gen = q->gen; 1712 1762 q->in_use += ndesc; 1713 1763 pidx = q->pidx; 1714 1764 q->pidx += ndesc; 1715 - written += ndesc; 1716 1765 if (q->pidx >= q->size) { 1717 1766 q->pidx -= q->size; 1718 1767 q->gen ^= 1; ··· 1716 1773 __skb_unlink(skb, &q->sendq); 1717 1774 spin_unlock(&q->lock); 1718 1775 1719 - write_ofld_wr(adap, skb, q, pidx, gen, ndesc, 1720 - (dma_addr_t *)skb->head); 1776 + write_ofld_wr(adap, skb, q, pidx, gen, ndesc); 1721 1777 spin_lock(&q->lock); 1722 1778 } 1723 1779 spin_unlock(&q->lock); ··· 1726 1784 set_bit(TXQ_LAST_PKT_DB, &q->flags); 1727 1785 #endif 1728 1786 wmb(); 1729 - if (likely(written)) 1730 - t3_write_reg(adap, A_SG_KDOORBELL, 1731 - F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); 1787 + t3_write_reg(adap, A_SG_KDOORBELL, 1788 + F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); 1732 1789 } 1733 1790 1734 1791 /**
+3
drivers/net/ethernet/emulex/benet/be_cmds.c
··· 3168 3168 3169 3169 adapter->max_event_queues = le16_to_cpu(desc->eq_count); 3170 3170 adapter->if_cap_flags = le32_to_cpu(desc->cap_flags); 3171 + 3172 + /* Clear flags that driver is not interested in */ 3173 + adapter->if_cap_flags &= BE_IF_CAP_FLAGS_WANT; 3171 3174 } 3172 3175 err: 3173 3176 mutex_unlock(&adapter->mbox_lock);
+6
drivers/net/ethernet/emulex/benet/be_cmds.h
··· 564 564 BE_IF_FLAGS_MULTICAST = 0x1000 565 565 }; 566 566 567 + #define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\ 568 + BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\ 569 + BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\ 570 + BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\ 571 + BE_IF_FLAGS_UNTAGGED) 572 + 567 573 /* An RX interface is an object with one or more MAC addresses and 568 574 * filtering capabilities. */ 569 575 struct be_cmd_req_if_create {
+53 -15
drivers/net/ethernet/marvell/skge.c
··· 931 931 } 932 932 933 933 /* Allocate and setup a new buffer for receiving */ 934 - static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, 935 - struct sk_buff *skb, unsigned int bufsize) 934 + static int skge_rx_setup(struct skge_port *skge, struct skge_element *e, 935 + struct sk_buff *skb, unsigned int bufsize) 936 936 { 937 937 struct skge_rx_desc *rd = e->desc; 938 - u64 map; 938 + dma_addr_t map; 939 939 940 940 map = pci_map_single(skge->hw->pdev, skb->data, bufsize, 941 941 PCI_DMA_FROMDEVICE); 942 942 943 - rd->dma_lo = map; 944 - rd->dma_hi = map >> 32; 943 + if (pci_dma_mapping_error(skge->hw->pdev, map)) 944 + return -1; 945 + 946 + rd->dma_lo = lower_32_bits(map); 947 + rd->dma_hi = upper_32_bits(map); 945 948 e->skb = skb; 946 949 rd->csum1_start = ETH_HLEN; 947 950 rd->csum2_start = ETH_HLEN; ··· 956 953 rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; 957 954 dma_unmap_addr_set(e, mapaddr, map); 958 955 dma_unmap_len_set(e, maplen, bufsize); 956 + return 0; 959 957 } 960 958 961 959 /* Resume receiving using existing skb, ··· 1018 1014 return -ENOMEM; 1019 1015 1020 1016 skb_reserve(skb, NET_IP_ALIGN); 1021 - skge_rx_setup(skge, e, skb, skge->rx_buf_size); 1017 + if (skge_rx_setup(skge, e, skb, skge->rx_buf_size) < 0) { 1018 + dev_kfree_skb(skb); 1019 + return -EIO; 1020 + } 1022 1021 } while ((e = e->next) != ring->start); 1023 1022 1024 1023 ring->to_clean = ring->start; ··· 2551 2544 2552 2545 BUG_ON(skge->dma & 7); 2553 2546 2554 - if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) { 2547 + if (upper_32_bits(skge->dma) != upper_32_bits(skge->dma + skge->mem_size)) { 2555 2548 dev_err(&hw->pdev->dev, "pci_alloc_consistent region crosses 4G boundary\n"); 2556 2549 err = -EINVAL; 2557 2550 goto free_pci_mem; ··· 2736 2729 struct skge_tx_desc *td; 2737 2730 int i; 2738 2731 u32 control, len; 2739 - u64 map; 2732 + dma_addr_t map; 2740 2733 2741 2734 if (skb_padto(skb, ETH_ZLEN)) 2742 2735 return NETDEV_TX_OK; ··· 2750 2743 e->skb = skb; 2751 2744 len = skb_headlen(skb); 2752 2745 map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); 2746 + if (pci_dma_mapping_error(hw->pdev, map)) 2747 + goto mapping_error; 2748 + 2753 2749 dma_unmap_addr_set(e, mapaddr, map); 2754 2750 dma_unmap_len_set(e, maplen, len); 2755 2751 2756 - td->dma_lo = map; 2757 - td->dma_hi = map >> 32; 2752 + td->dma_lo = lower_32_bits(map); 2753 + td->dma_hi = upper_32_bits(map); 2758 2754 2759 2755 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2760 2756 const int offset = skb_checksum_start_offset(skb); ··· 2788 2778 2789 2779 map = skb_frag_dma_map(&hw->pdev->dev, frag, 0, 2790 2780 skb_frag_size(frag), DMA_TO_DEVICE); 2781 + if (dma_mapping_error(&hw->pdev->dev, map)) 2782 + goto mapping_unwind; 2791 2783 2792 2784 e = e->next; 2793 2785 e->skb = skb; 2794 2786 tf = e->desc; 2795 2787 BUG_ON(tf->control & BMU_OWN); 2796 2788 2797 - tf->dma_lo = map; 2798 - tf->dma_hi = (u64) map >> 32; 2789 + tf->dma_lo = lower_32_bits(map); 2790 + tf->dma_hi = upper_32_bits(map); 2799 2791 dma_unmap_addr_set(e, mapaddr, map); 2800 2792 dma_unmap_len_set(e, maplen, skb_frag_size(frag)); 2801 2793 ··· 2826 2814 netif_stop_queue(dev); 2827 2815 } 2828 2816 2817 + return NETDEV_TX_OK; 2818 + 2819 + mapping_unwind: 2820 + e = skge->tx_ring.to_use; 2821 + pci_unmap_single(hw->pdev, 2822 + dma_unmap_addr(e, mapaddr), 2823 + dma_unmap_len(e, maplen), 2824 + PCI_DMA_TODEVICE); 2825 + while (i-- > 0) { 2826 + e = e->next; 2827 + pci_unmap_page(hw->pdev, 2828 + dma_unmap_addr(e, mapaddr), 2829 + dma_unmap_len(e, maplen), 2830 + PCI_DMA_TODEVICE); 2831 + } 2832 + 2833 + mapping_error: 2834 + if (net_ratelimit()) 2835 + dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); 2836 + dev_kfree_skb(skb); 2829 2837 return NETDEV_TX_OK; 2830 2838 } 2831 2839 ··· 3077 3045 3078 3046 pci_dma_sync_single_for_cpu(skge->hw->pdev, 3079 3047 dma_unmap_addr(e, mapaddr), 3080 - len, PCI_DMA_FROMDEVICE); 3048 + dma_unmap_len(e, maplen), 3049 + PCI_DMA_FROMDEVICE); 3081 3050 skb_copy_from_linear_data(e->skb, skb->data, len); 3082 3051 pci_dma_sync_single_for_device(skge->hw->pdev, 3083 3052 dma_unmap_addr(e, mapaddr), 3084 - len, PCI_DMA_FROMDEVICE); 3053 + dma_unmap_len(e, maplen), 3054 + PCI_DMA_FROMDEVICE); 3085 3055 skge_rx_reuse(e, skge->rx_buf_size); 3086 3056 } else { 3087 3057 struct sk_buff *nskb; ··· 3092 3058 if (!nskb) 3093 3059 goto resubmit; 3094 3060 3061 + if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { 3062 + dev_kfree_skb(nskb); 3063 + goto resubmit; 3064 + } 3065 + 3095 3066 pci_unmap_single(skge->hw->pdev, 3096 3067 dma_unmap_addr(e, mapaddr), 3097 3068 dma_unmap_len(e, maplen), 3098 3069 PCI_DMA_FROMDEVICE); 3099 3070 skb = e->skb; 3100 3071 prefetch(skb->data); 3101 - skge_rx_setup(skge, e, nskb, skge->rx_buf_size); 3102 3072 } 3103 3073 3104 3074 skb_put(skb, len);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
··· 46 46 #include "mlx5_core.h" 47 47 48 48 enum { 49 - CMD_IF_REV = 4, 49 + CMD_IF_REV = 5, 50 50 }; 51 51 52 52 enum {
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/eq.c
··· 268 268 case MLX5_EVENT_TYPE_PAGE_REQUEST: 269 269 { 270 270 u16 func_id = be16_to_cpu(eqe->data.req_pages.func_id); 271 - s16 npages = be16_to_cpu(eqe->data.req_pages.num_pages); 271 + s32 npages = be32_to_cpu(eqe->data.req_pages.num_pages); 272 272 273 273 mlx5_core_dbg(dev, "page request for func 0x%x, napges %d\n", func_id, npages); 274 274 mlx5_core_req_pages_handler(dev, func_id, npages);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/fw.c
··· 113 113 caps->log_max_srq = out->hca_cap.log_max_srqs & 0x1f; 114 114 caps->local_ca_ack_delay = out->hca_cap.local_ca_ack_delay & 0x1f; 115 115 caps->log_max_mcg = out->hca_cap.log_max_mcg; 116 - caps->max_qp_mcg = be16_to_cpu(out->hca_cap.max_qp_mcg); 116 + caps->max_qp_mcg = be32_to_cpu(out->hca_cap.max_qp_mcg) & 0xffffff; 117 117 caps->max_ra_res_qp = 1 << (out->hca_cap.log_max_ra_res_qp & 0x3f); 118 118 caps->max_ra_req_qp = 1 << (out->hca_cap.log_max_ra_req_qp & 0x3f); 119 119 caps->max_srq_wqes = 1 << out->hca_cap.log_max_srq_sz;
+1 -28
drivers/net/ethernet/mellanox/mlx5/core/health.c
··· 55 55 }; 56 56 57 57 static DEFINE_SPINLOCK(health_lock); 58 - 59 58 static LIST_HEAD(health_list); 60 59 static struct work_struct health_work; 61 - 62 - static health_handler_t reg_handler; 63 - int mlx5_register_health_report_handler(health_handler_t handler) 64 - { 65 - spin_lock_irq(&health_lock); 66 - if (reg_handler) { 67 - spin_unlock_irq(&health_lock); 68 - return -EEXIST; 69 - } 70 - reg_handler = handler; 71 - spin_unlock_irq(&health_lock); 72 - 73 - return 0; 74 - } 75 - EXPORT_SYMBOL(mlx5_register_health_report_handler); 76 - 77 - void mlx5_unregister_health_report_handler(void) 78 - { 79 - spin_lock_irq(&health_lock); 80 - reg_handler = NULL; 81 - spin_unlock_irq(&health_lock); 82 - } 83 - EXPORT_SYMBOL(mlx5_unregister_health_report_handler); 84 60 85 61 static void health_care(struct work_struct *work) 86 62 { ··· 74 98 priv = container_of(health, struct mlx5_priv, health); 75 99 dev = container_of(priv, struct mlx5_core_dev, priv); 76 100 mlx5_core_warn(dev, "handling bad device here\n"); 101 + /* nothing yet */ 77 102 spin_lock_irq(&health_lock); 78 - if (reg_handler) 79 - reg_handler(dev->pdev, health->health, 80 - sizeof(health->health)); 81 - 82 103 list_del_init(&health->list); 83 104 spin_unlock_irq(&health_lock); 84 105 }
+26 -32
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
··· 43 43 MLX5_PAGES_TAKE = 2 44 44 }; 45 45 46 + enum { 47 + MLX5_BOOT_PAGES = 1, 48 + MLX5_INIT_PAGES = 2, 49 + MLX5_POST_INIT_PAGES = 3 50 + }; 51 + 46 52 struct mlx5_pages_req { 47 53 struct mlx5_core_dev *dev; 48 54 u32 func_id; 49 - s16 npages; 55 + s32 npages; 50 56 struct work_struct work; 51 57 }; 52 58 ··· 70 64 71 65 struct mlx5_query_pages_outbox { 72 66 struct mlx5_outbox_hdr hdr; 73 - __be16 num_boot_pages; 67 + __be16 rsvd; 74 68 __be16 func_id; 75 - __be16 init_pages; 76 - __be16 num_pages; 69 + __be32 num_pages; 77 70 }; 78 71 79 72 struct mlx5_manage_pages_inbox { 80 73 struct mlx5_inbox_hdr hdr; 81 - __be16 rsvd0; 74 + __be16 rsvd; 82 75 __be16 func_id; 83 - __be16 rsvd1; 84 - __be16 num_entries; 85 - u8 rsvd2[16]; 76 + __be32 num_entries; 86 77 __be64 pas[0]; 87 78 }; 88 79 89 80 struct mlx5_manage_pages_outbox { 90 81 struct mlx5_outbox_hdr hdr; 91 - u8 rsvd0[2]; 92 - __be16 num_entries; 93 - u8 rsvd1[20]; 82 + __be32 num_entries; 83 + u8 rsvd[4]; 94 84 __be64 pas[0]; 95 85 }; 96 86 ··· 148 146 } 149 147 150 148 static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, 151 - s16 *pages, s16 *init_pages, u16 *boot_pages) 149 + s32 *npages, int boot) 152 150 { 153 151 struct mlx5_query_pages_inbox in; 154 152 struct mlx5_query_pages_outbox out; ··· 157 155 memset(&in, 0, sizeof(in)); 158 156 memset(&out, 0, sizeof(out)); 159 157 in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_PAGES); 158 + in.hdr.opmod = boot ? cpu_to_be16(MLX5_BOOT_PAGES) : cpu_to_be16(MLX5_INIT_PAGES); 159 + 160 160 err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); 161 161 if (err) 162 162 return err; ··· 166 162 if (out.hdr.status) 167 163 return mlx5_cmd_status_to_err(&out.hdr); 168 164 169 - if (pages) 170 - *pages = be16_to_cpu(out.num_pages); 171 - 172 - if (init_pages) 173 - *init_pages = be16_to_cpu(out.init_pages); 174 - 175 - if (boot_pages) 176 - *boot_pages = be16_to_cpu(out.num_boot_pages); 177 - 165 + *npages = be32_to_cpu(out.num_pages); 178 166 *func_id = be16_to_cpu(out.func_id); 179 167 180 168 return err; ··· 220 224 in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); 221 225 in->hdr.opmod = cpu_to_be16(MLX5_PAGES_GIVE); 222 226 in->func_id = cpu_to_be16(func_id); 223 - in->num_entries = cpu_to_be16(npages); 227 + in->num_entries = cpu_to_be32(npages); 224 228 err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); 225 229 mlx5_core_dbg(dev, "err %d\n", err); 226 230 if (err) { ··· 288 292 in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); 289 293 in.hdr.opmod = cpu_to_be16(MLX5_PAGES_TAKE); 290 294 in.func_id = cpu_to_be16(func_id); 291 - in.num_entries = cpu_to_be16(npages); 295 + in.num_entries = cpu_to_be32(npages); 292 296 mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); 293 297 err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen); 294 298 if (err) { ··· 302 306 goto out_free; 303 307 } 304 308 305 - num_claimed = be16_to_cpu(out->num_entries); 309 + num_claimed = be32_to_cpu(out->num_entries); 306 310 if (nclaimed) 307 311 *nclaimed = num_claimed; 308 312 ··· 341 345 } 342 346 343 347 void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, 344 - s16 npages) 348 + s32 npages) 345 349 { 346 350 struct mlx5_pages_req *req; 347 351 ··· 360 364 361 365 int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) 362 366 { 363 - u16 uninitialized_var(boot_pages); 364 - s16 uninitialized_var(init_pages); 365 367 u16 uninitialized_var(func_id); 368 + s32 uninitialized_var(npages); 366 369 int err; 367 370 368 - err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages, 369 - &boot_pages); 371 + err = mlx5_cmd_query_pages(dev, &func_id, &npages, boot); 370 372 if (err) 371 373 return err; 372 374 375 + mlx5_core_dbg(dev, "requested %d %s pages for func_id 0x%x\n", 376 + npages, boot ? "boot" : "init", func_id); 373 377 374 - mlx5_core_dbg(dev, "requested %d init pages and %d boot pages for func_id 0x%x\n", 375 - init_pages, boot_pages, func_id); 376 - return give_pages(dev, func_id, boot ? boot_pages : init_pages, 0); 378 + return give_pages(dev, func_id, npages, 0); 377 379 } 378 380 379 381 static int optimal_reclaimed_pages(void)
+5
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
··· 3272 3272 u8 val; 3273 3273 int ret, max_sds_rings = adapter->max_sds_rings; 3274 3274 3275 + if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { 3276 + netdev_info(netdev, "Device is resetting\n"); 3277 + return -EBUSY; 3278 + } 3279 + 3275 3280 if (qlcnic_get_diag_lock(adapter)) { 3276 3281 netdev_info(netdev, "Device in diagnostics mode\n"); 3277 3282 return -EBUSY;
+2 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
··· 633 633 return -EIO; 634 634 } 635 635 636 - qlcnic_set_drv_version(adapter); 636 + if (adapter->portnum == 0) 637 + qlcnic_set_drv_version(adapter); 637 638 qlcnic_83xx_idc_attach_driver(adapter); 638 639 639 640 return 0;
+4 -2
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 2161 2161 if (err) 2162 2162 goto err_out_disable_mbx_intr; 2163 2163 2164 - qlcnic_set_drv_version(adapter); 2164 + if (adapter->portnum == 0) 2165 + qlcnic_set_drv_version(adapter); 2165 2166 2166 2167 pci_set_drvdata(pdev, adapter); 2167 2168 ··· 3084 3083 adapter->fw_fail_cnt = 0; 3085 3084 adapter->flags &= ~QLCNIC_FW_HANG; 3086 3085 clear_bit(__QLCNIC_RESETTING, &adapter->state); 3087 - qlcnic_set_drv_version(adapter); 3086 + if (adapter->portnum == 0) 3087 + qlcnic_set_drv_version(adapter); 3088 3088 3089 3089 if (!qlcnic_clr_drv_state(adapter)) 3090 3090 qlcnic_schedule_work(adapter, qlcnic_fw_poll_work,
+3 -3
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
··· 170 170 171 171 if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) { 172 172 err = qlcnic_get_beacon_state(adapter, &h_beacon_state); 173 - if (!err) { 174 - dev_info(&adapter->pdev->dev, 175 - "Failed to get current beacon state\n"); 173 + if (err) { 174 + netdev_err(adapter->netdev, 175 + "Failed to get current beacon state\n"); 176 176 } else { 177 177 if (h_beacon_state == QLCNIC_BEACON_DISABLE) 178 178 ahw->beacon_state = 0;
+1
drivers/net/ethernet/realtek/8139cp.c
··· 524 524 PCI_DMA_FROMDEVICE); 525 525 if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { 526 526 dev->stats.rx_dropped++; 527 + kfree_skb(new_skb); 527 528 goto rx_next; 528 529 } 529 530
+11 -2
drivers/net/ethernet/stmicro/stmmac/ring_mode.c
··· 33 33 struct stmmac_priv *priv = (struct stmmac_priv *)p; 34 34 unsigned int txsize = priv->dma_tx_size; 35 35 unsigned int entry = priv->cur_tx % txsize; 36 - struct dma_desc *desc = priv->dma_tx + entry; 36 + struct dma_desc *desc; 37 37 unsigned int nopaged_len = skb_headlen(skb); 38 38 unsigned int bmax, len; 39 + 40 + if (priv->extend_desc) 41 + desc = (struct dma_desc *)(priv->dma_etx + entry); 42 + else 43 + desc = priv->dma_tx + entry; 39 44 40 45 if (priv->plat->enh_desc) 41 46 bmax = BUF_SIZE_8KiB; ··· 59 54 STMMAC_RING_MODE); 60 55 wmb(); 61 56 entry = (++priv->cur_tx) % txsize; 62 - desc = priv->dma_tx + entry; 57 + 58 + if (priv->extend_desc) 59 + desc = (struct dma_desc *)(priv->dma_etx + entry); 60 + else 61 + desc = priv->dma_tx + entry; 63 62 64 63 desc->des2 = dma_map_single(priv->device, skb->data + bmax, 65 64 len, DMA_TO_DEVICE);
+92 -19
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 939 939 940 940 skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, 941 941 GFP_KERNEL); 942 - if (unlikely(skb == NULL)) { 942 + if (!skb) { 943 943 pr_err("%s: Rx init fails; skb is NULL\n", __func__); 944 - return 1; 944 + return -ENOMEM; 945 945 } 946 946 skb_reserve(skb, NET_IP_ALIGN); 947 947 priv->rx_skbuff[i] = skb; 948 948 priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data, 949 949 priv->dma_buf_sz, 950 950 DMA_FROM_DEVICE); 951 + if (dma_mapping_error(priv->device, priv->rx_skbuff_dma[i])) { 952 + pr_err("%s: DMA mapping error\n", __func__); 953 + dev_kfree_skb_any(skb); 954 + return -EINVAL; 955 + } 951 956 952 957 p->des2 = priv->rx_skbuff_dma[i]; 953 958 ··· 963 958 return 0; 964 959 } 965 960 961 + static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i) 962 + { 963 + if (priv->rx_skbuff[i]) { 964 + dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], 965 + priv->dma_buf_sz, DMA_FROM_DEVICE); 966 + dev_kfree_skb_any(priv->rx_skbuff[i]); 967 + } 968 + priv->rx_skbuff[i] = NULL; 969 + } 970 + 966 971 /** 967 972 * init_dma_desc_rings - init the RX/TX descriptor rings 968 973 * @dev: net device structure ··· 980 965 * and allocates the socket buffers. It suppors the chained and ring 981 966 * modes. 982 967 */ 983 - static void init_dma_desc_rings(struct net_device *dev) 968 + static int init_dma_desc_rings(struct net_device *dev) 984 969 { 985 970 int i; 986 971 struct stmmac_priv *priv = netdev_priv(dev); 987 972 unsigned int txsize = priv->dma_tx_size; 988 973 unsigned int rxsize = priv->dma_rx_size; 989 974 unsigned int bfsize = 0; 975 + int ret = -ENOMEM; 990 976 991 977 /* Set the max buffer size according to the DESC mode 992 978 * and the MTU. Note that RING mode allows 16KiB bsize. ··· 1008 992 dma_extended_desc), 1009 993 &priv->dma_rx_phy, 1010 994 GFP_KERNEL); 995 + if (!priv->dma_erx) 996 + goto err_dma; 997 + 1011 998 priv->dma_etx = dma_alloc_coherent(priv->device, txsize * 1012 999 sizeof(struct 1013 1000 dma_extended_desc), 1014 1001 &priv->dma_tx_phy, 1015 1002 GFP_KERNEL); 1016 - if ((!priv->dma_erx) || (!priv->dma_etx)) 1017 - return; 1003 + if (!priv->dma_etx) { 1004 + dma_free_coherent(priv->device, priv->dma_rx_size * 1005 + sizeof(struct dma_extended_desc), 1006 + priv->dma_erx, priv->dma_rx_phy); 1007 + goto err_dma; 1008 + } 1018 1009 } else { 1019 1010 priv->dma_rx = dma_alloc_coherent(priv->device, rxsize * 1020 1011 sizeof(struct dma_desc), 1021 1012 &priv->dma_rx_phy, 1022 1013 GFP_KERNEL); 1014 + if (!priv->dma_rx) 1015 + goto err_dma; 1016 + 1023 1017 priv->dma_tx = dma_alloc_coherent(priv->device, txsize * 1024 1018 sizeof(struct dma_desc), 1025 1019 &priv->dma_tx_phy, 1026 1020 GFP_KERNEL); 1027 - if ((!priv->dma_rx) || (!priv->dma_tx)) 1028 - return; 1021 + if (!priv->dma_tx) { 1022 + dma_free_coherent(priv->device, priv->dma_rx_size * 1023 + sizeof(struct dma_desc), 1024 + priv->dma_rx, priv->dma_rx_phy); 1025 + goto err_dma; 1026 + } 1029 1027 } 1030 1028 1031 1029 priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t), 1032 1030 GFP_KERNEL); 1031 + if (!priv->rx_skbuff_dma) 1032 + goto err_rx_skbuff_dma; 1033 + 1033 1034 priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *), 1034 1035 GFP_KERNEL); 1036 + if (!priv->rx_skbuff) 1037 + goto err_rx_skbuff; 1038 + 1035 1039 priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), 1036 1040 GFP_KERNEL); 1041 + if (!priv->tx_skbuff_dma) 1042 + goto err_tx_skbuff_dma; 1043 + 1037 1044 priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *), 1038 1045 GFP_KERNEL); 1046 + if (!priv->tx_skbuff) 1047 + goto err_tx_skbuff; 1048 + 1039 1049 if (netif_msg_probe(priv)) { 1040 1050 pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__, 1041 1051 (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy); ··· 1076 1034 else 1077 1035 p = priv->dma_rx + i; 1078 1036 1079 - if (stmmac_init_rx_buffers(priv, p, i)) 1080 - break; 1037 + ret = stmmac_init_rx_buffers(priv, p, i); 1038 + if (ret) 1039 + goto err_init_rx_buffers; 1081 1040 1082 1041 if (netif_msg_probe(priv)) 1083 1042 pr_debug("[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i], ··· 1124 1081 1125 1082 if (netif_msg_hw(priv)) 1126 1083 stmmac_display_rings(priv); 1084 + 1085 + return 0; 1086 + err_init_rx_buffers: 1087 + while (--i >= 0) 1088 + stmmac_free_rx_buffers(priv, i); 1089 + kfree(priv->tx_skbuff); 1090 + err_tx_skbuff: 1091 + kfree(priv->tx_skbuff_dma); 1092 + err_tx_skbuff_dma: 1093 + kfree(priv->rx_skbuff); 1094 + err_rx_skbuff: 1095 + kfree(priv->rx_skbuff_dma); 1096 + err_rx_skbuff_dma: 1097 + if (priv->extend_desc) { 1098 + dma_free_coherent(priv->device, priv->dma_tx_size * 1099 + sizeof(struct dma_extended_desc), 1100 + priv->dma_etx, priv->dma_tx_phy); 1101 + dma_free_coherent(priv->device, priv->dma_rx_size * 1102 + sizeof(struct dma_extended_desc), 1103 + priv->dma_erx, priv->dma_rx_phy); 1104 + } else { 1105 + dma_free_coherent(priv->device, 1106 + priv->dma_tx_size * sizeof(struct dma_desc), 1107 + priv->dma_tx, priv->dma_tx_phy); 1108 + dma_free_coherent(priv->device, 1109 + priv->dma_rx_size * sizeof(struct dma_desc), 1110 + priv->dma_rx, priv->dma_rx_phy); 1111 + } 1112 + err_dma: 1113 + return ret; 1127 1114 } 1128 1115 1129 1116 static void dma_free_rx_skbufs(struct stmmac_priv *priv) 1130 1117 { 1131 1118 int i; 1132 1119 1133 - for (i = 0; i < priv->dma_rx_size; i++) { 1134 - if (priv->rx_skbuff[i]) { 1135 - dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], 1136 - priv->dma_buf_sz, DMA_FROM_DEVICE); 1137 - dev_kfree_skb_any(priv->rx_skbuff[i]); 1138 - } 1139 - priv->rx_skbuff[i] = NULL; 1140 - } 1120 + for (i = 0; i < priv->dma_rx_size; i++) 1121 + stmmac_free_rx_buffers(priv, i); 1141 1122 } 1142 1123 1143 1124 static void dma_free_tx_skbufs(struct stmmac_priv *priv) ··· 1627 1560 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); 1628 1561 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); 1629 1562 priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); 1630 - init_dma_desc_rings(dev); 1563 + 1564 + ret = init_dma_desc_rings(dev); 1565 + if (ret < 0) { 1566 + pr_err("%s: DMA descriptors initialization failed\n", __func__); 1567 + goto dma_desc_error; 1568 + } 1631 1569 1632 1570 /* DMA initialization and SW reset */ 1633 1571 ret = stmmac_init_dma_engine(priv); 1634 1572 if (ret < 0) { 1635 - pr_err("%s: DMA initialization failed\n", __func__); 1573 + pr_err("%s: DMA engine initialization failed\n", __func__); 1636 1574 goto init_error; 1637 1575 } 1638 1576 ··· 1744 1672 1745 1673 init_error: 1746 1674 free_dma_desc_resources(priv); 1675 + dma_desc_error: 1747 1676 if (priv->phydev) 1748 1677 phy_disconnect(priv->phydev); 1749 1678 phy_error:
+3 -1
drivers/net/ethernet/via/via-velocity.c
··· 2100 2100 2101 2101 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); 2102 2102 } 2103 - netif_rx(skb); 2103 + netif_receive_skb(skb); 2104 2104 2105 2105 stats->rx_bytes += pkt_len; 2106 2106 stats->rx_packets++; ··· 2904 2904 return ret; 2905 2905 2906 2906 err_iounmap: 2907 + netif_napi_del(&vptr->napi); 2907 2908 iounmap(regs); 2908 2909 err_free_dev: 2909 2910 free_netdev(netdev); ··· 2925 2924 struct velocity_info *vptr = netdev_priv(netdev); 2926 2925 2927 2926 unregister_netdev(netdev); 2927 + netif_napi_del(&vptr->napi); 2928 2928 iounmap(vptr->mac_regs); 2929 2929 free_netdev(netdev); 2930 2930 velocity_nics--;
+4
drivers/net/macvlan.c
··· 742 742 return -EADDRNOTAVAIL; 743 743 } 744 744 745 + if (data && data[IFLA_MACVLAN_FLAGS] && 746 + nla_get_u16(data[IFLA_MACVLAN_FLAGS]) & ~MACVLAN_FLAG_NOPROMISC) 747 + return -EINVAL; 748 + 745 749 if (data && data[IFLA_MACVLAN_MODE]) { 746 750 switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) { 747 751 case MACVLAN_MODE_PRIVATE:
+9 -3
drivers/net/macvtap.c
··· 715 715 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; 716 716 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; 717 717 } 718 - if (vlan) 718 + if (vlan) { 719 + local_bh_disable(); 719 720 macvlan_start_xmit(skb, vlan->dev); 720 - else 721 + local_bh_enable(); 722 + } else { 721 723 kfree_skb(skb); 724 + } 722 725 rcu_read_unlock(); 723 726 724 727 return total_len; ··· 812 809 done: 813 810 rcu_read_lock(); 814 811 vlan = rcu_dereference(q->vlan); 815 - if (vlan) 812 + if (vlan) { 813 + preempt_disable(); 816 814 macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); 815 + preempt_enable(); 816 + } 817 817 rcu_read_unlock(); 818 818 819 819 return ret ? ret : copied;
+4 -2
drivers/net/tun.c
··· 977 977 u32 rxhash; 978 978 979 979 if (!(tun->flags & TUN_NO_PI)) { 980 - if ((len -= sizeof(pi)) > total_len) 980 + if (len < sizeof(pi)) 981 981 return -EINVAL; 982 + len -= sizeof(pi); 982 983 983 984 if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) 984 985 return -EFAULT; ··· 987 986 } 988 987 989 988 if (tun->flags & TUN_VNET_HDR) { 990 - if ((len -= tun->vnet_hdr_sz) > total_len) 989 + if (len < tun->vnet_hdr_sz) 991 990 return -EINVAL; 991 + len -= tun->vnet_hdr_sz; 992 992 993 993 if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) 994 994 return -EFAULT;
+1 -3
drivers/net/vxlan.c
··· 1430 1430 return -ENOTCONN; 1431 1431 1432 1432 if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && 1433 - ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { 1433 + vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { 1434 1434 vxlan_sock_hold(vs); 1435 1435 dev_hold(dev); 1436 1436 queue_work(vxlan_wq, &vxlan->igmp_join); ··· 1836 1836 { 1837 1837 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 1838 1838 struct vxlan_dev *vxlan = netdev_priv(dev); 1839 - 1840 - flush_workqueue(vxlan_wq); 1841 1839 1842 1840 spin_lock(&vn->sock_lock); 1843 1841 hlist_del_rcu(&vxlan->hlist);
+11 -4
drivers/pci/pci-acpi.c
··· 317 317 /* ACPI bus type */ 318 318 static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) 319 319 { 320 - struct pci_dev * pci_dev; 321 - u64 addr; 320 + struct pci_dev *pci_dev = to_pci_dev(dev); 321 + bool is_bridge; 322 + u64 addr; 322 323 323 - pci_dev = to_pci_dev(dev); 324 + /* 325 + * pci_is_bridge() is not suitable here, because pci_dev->subordinate 326 + * is set only after acpi_pci_find_device() has been called for the 327 + * given device. 328 + */ 329 + is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE 330 + || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; 324 331 /* Please ref to ACPI spec for the syntax of _ADR */ 325 332 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 326 - *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); 333 + *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge); 327 334 if (!*handle) 328 335 return -ENODEV; 329 336 return 0;
+25 -10
drivers/rtc/rtc-stmp3xxx.c
··· 23 23 #include <linux/init.h> 24 24 #include <linux/platform_device.h> 25 25 #include <linux/interrupt.h> 26 + #include <linux/delay.h> 26 27 #include <linux/rtc.h> 27 28 #include <linux/slab.h> 28 29 #include <linux/of_device.h> ··· 120 119 } 121 120 #endif /* CONFIG_STMP3XXX_RTC_WATCHDOG */ 122 121 123 - static void stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data) 122 + static int stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data) 124 123 { 124 + int timeout = 5000; /* 3ms according to i.MX28 Ref Manual */ 125 125 /* 126 - * The datasheet doesn't say which way round the 127 - * NEW_REGS/STALE_REGS bitfields go. In fact it's 0x1=P0, 128 - * 0x2=P1, .., 0x20=P5, 0x40=ALARM, 0x80=SECONDS 126 + * The i.MX28 Applications Processor Reference Manual, Rev. 1, 2010 127 + * states: 128 + * | The order in which registers are updated is 129 + * | Persistent 0, 1, 2, 3, 4, 5, Alarm, Seconds. 130 + * | (This list is in bitfield order, from LSB to MSB, as they would 131 + * | appear in the STALE_REGS and NEW_REGS bitfields of the HW_RTC_STAT 132 + * | register. For example, the Seconds register corresponds to 133 + * | STALE_REGS or NEW_REGS containing 0x80.) 129 134 */ 130 - while (readl(rtc_data->io + STMP3XXX_RTC_STAT) & 131 - (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)) 132 - cpu_relax(); 135 + do { 136 + if (!(readl(rtc_data->io + STMP3XXX_RTC_STAT) & 137 + (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT))) 138 + return 0; 139 + udelay(1); 140 + } while (--timeout > 0); 141 + return (readl(rtc_data->io + STMP3XXX_RTC_STAT) & 142 + (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)) ? -ETIME : 0; 133 143 } 134 144 135 145 /* Time read/write */ 136 146 static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) 137 147 { 148 + int ret; 138 149 struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev); 139 150 140 - stmp3xxx_wait_time(rtc_data); 151 + ret = stmp3xxx_wait_time(rtc_data); 152 + if (ret) 153 + return ret; 154 + 141 155 rtc_time_to_tm(readl(rtc_data->io + STMP3XXX_RTC_SECONDS), rtc_tm); 142 156 return 0; 143 157 } ··· 162 146 struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev); 163 147 164 148 writel(t, rtc_data->io + STMP3XXX_RTC_SECONDS); 165 - stmp3xxx_wait_time(rtc_data); 166 - return 0; 149 + return stmp3xxx_wait_time(rtc_data); 167 150 } 168 151 169 152 /* interrupt(s) handler */
+6
drivers/s390/block/dasd.c
··· 2392 2392 rc = cqr->intrc; 2393 2393 else 2394 2394 rc = -EIO; 2395 + 2396 + /* kick tasklets */ 2397 + dasd_schedule_device_bh(device); 2398 + if (device->block) 2399 + dasd_schedule_block_bh(device->block); 2400 + 2395 2401 return rc; 2396 2402 } 2397 2403
+1 -1
drivers/scsi/fnic/fnic.h
··· 38 38 39 39 #define DRV_NAME "fnic" 40 40 #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" 41 - #define DRV_VERSION "1.5.0.22" 41 + #define DRV_VERSION "1.5.0.23" 42 42 #define PFX DRV_NAME ": " 43 43 #define DFX DRV_NAME "%d: " 44 44
+9 -13
drivers/scsi/fnic/fnic_main.c
··· 642 642 INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); 643 643 INIT_WORK(&fnic->event_work, fnic_handle_event); 644 644 skb_queue_head_init(&fnic->fip_frame_queue); 645 - spin_lock_irqsave(&fnic_list_lock, flags); 646 - if (!fnic_fip_queue) { 647 - fnic_fip_queue = 648 - create_singlethread_workqueue("fnic_fip_q"); 649 - if (!fnic_fip_queue) { 650 - spin_unlock_irqrestore(&fnic_list_lock, flags); 651 - printk(KERN_ERR PFX "fnic FIP work queue " 652 - "create failed\n"); 653 - err = -ENOMEM; 654 - goto err_out_free_max_pool; 655 - } 656 - } 657 - spin_unlock_irqrestore(&fnic_list_lock, flags); 658 645 INIT_LIST_HEAD(&fnic->evlist); 659 646 INIT_LIST_HEAD(&fnic->vlans); 660 647 } else { ··· 947 960 spin_lock_init(&fnic_list_lock); 948 961 INIT_LIST_HEAD(&fnic_list); 949 962 963 + fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q"); 964 + if (!fnic_fip_queue) { 965 + printk(KERN_ERR PFX "fnic FIP work queue create failed\n"); 966 + err = -ENOMEM; 967 + goto err_create_fip_workq; 968 + } 969 + 950 970 fnic_fc_transport = fc_attach_transport(&fnic_fc_functions); 951 971 if (!fnic_fc_transport) { 952 972 printk(KERN_ERR PFX "fc_attach_transport error\n"); ··· 972 978 err_pci_register: 973 979 fc_release_transport(fnic_fc_transport); 974 980 err_fc_transport: 981 + destroy_workqueue(fnic_fip_queue); 982 + err_create_fip_workq: 975 983 destroy_workqueue(fnic_event_queue); 976 984 err_create_fnic_workq: 977 985 kmem_cache_destroy(fnic_io_req_cache);
+15 -5
drivers/scsi/megaraid/megaraid_sas_base.c
··· 3547 3547 break; 3548 3548 } 3549 3549 3550 - /* 3551 - * We expect the FW state to be READY 3552 - */ 3553 - if (megasas_transition_to_ready(instance, 0)) 3554 - goto fail_ready_state; 3550 + if (megasas_transition_to_ready(instance, 0)) { 3551 + atomic_set(&instance->fw_reset_no_pci_access, 1); 3552 + instance->instancet->adp_reset 3553 + (instance, instance->reg_set); 3554 + atomic_set(&instance->fw_reset_no_pci_access, 0); 3555 + dev_info(&instance->pdev->dev, 3556 + "megasas: FW restarted successfully from %s!\n", 3557 + __func__); 3558 + 3559 + /*waitting for about 30 second before retry*/ 3560 + ssleep(30); 3561 + 3562 + if (megasas_transition_to_ready(instance, 0)) 3563 + goto fail_ready_state; 3564 + } 3555 3565 3556 3566 /* 3557 3567 * MSI-X host index 0 is common for all adapter.
+3
drivers/scsi/scsi.c
··· 1031 1031 { 1032 1032 int i, result; 1033 1033 1034 + if (sdev->skip_vpd_pages) 1035 + goto fail; 1036 + 1034 1037 /* Ask for all the pages supported by this device */ 1035 1038 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len); 1036 1039 if (result)
+1 -1
drivers/scsi/virtio_scsi.c
··· 751 751 752 752 vscsi->affinity_hint_set = true; 753 753 } else { 754 - for (i = 0; i < vscsi->num_queues - VIRTIO_SCSI_VQ_BASE; i++) 754 + for (i = 0; i < vscsi->num_queues; i++) 755 755 virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); 756 756 757 757 vscsi->affinity_hint_set = false;
+1 -1
drivers/spi/spi-davinci.c
··· 609 609 else 610 610 buf = (void *)t->tx_buf; 611 611 t->tx_dma = dma_map_single(&spi->dev, buf, 612 - t->len, DMA_FROM_DEVICE); 612 + t->len, DMA_TO_DEVICE); 613 613 if (!t->tx_dma) { 614 614 ret = -EFAULT; 615 615 goto err_tx_map;
+4 -2
drivers/staging/zcache/zcache-main.c
··· 1811 1811 #else 1812 1812 if (*zcache_comp_name != '\0') { 1813 1813 ret = crypto_has_comp(zcache_comp_name, 0, 0); 1814 - if (!ret) 1814 + if (!ret) { 1815 1815 pr_info("zcache: %s not supported\n", 1816 1816 zcache_comp_name); 1817 - goto out; 1817 + ret = 1; 1818 + goto out; 1819 + } 1818 1820 } 1819 1821 if (!ret) 1820 1822 strcpy(zcache_comp_name, "lzo");
+4 -4
drivers/usb/class/usbtmc.c
··· 1119 1119 /* Determine if it is a Rigol or not */ 1120 1120 data->rigol_quirk = 0; 1121 1121 dev_dbg(&intf->dev, "Trying to find if device Vendor 0x%04X Product 0x%04X has the RIGOL quirk\n", 1122 - data->usb_dev->descriptor.idVendor, 1123 - data->usb_dev->descriptor.idProduct); 1122 + le16_to_cpu(data->usb_dev->descriptor.idVendor), 1123 + le16_to_cpu(data->usb_dev->descriptor.idProduct)); 1124 1124 for(n = 0; usbtmc_id_quirk[n].idVendor > 0; n++) { 1125 - if ((usbtmc_id_quirk[n].idVendor == data->usb_dev->descriptor.idVendor) && 1126 - (usbtmc_id_quirk[n].idProduct == data->usb_dev->descriptor.idProduct)) { 1125 + if ((usbtmc_id_quirk[n].idVendor == le16_to_cpu(data->usb_dev->descriptor.idVendor)) && 1126 + (usbtmc_id_quirk[n].idProduct == le16_to_cpu(data->usb_dev->descriptor.idProduct))) { 1127 1127 dev_dbg(&intf->dev, "Setting this device as having the RIGOL quirk\n"); 1128 1128 data->rigol_quirk = 1; 1129 1129 break;
+3 -2
drivers/usb/core/hub.c
··· 4798 4798 hub->ports[i - 1]->child; 4799 4799 4800 4800 dev_dbg(hub_dev, "warm reset port %d\n", i); 4801 - if (!udev) { 4801 + if (!udev || !(portstatus & 4802 + USB_PORT_STAT_CONNECTION)) { 4802 4803 status = hub_port_reset(hub, i, 4803 4804 NULL, HUB_BH_RESET_TIME, 4804 4805 true); ··· 4809 4808 usb_lock_device(udev); 4810 4809 status = usb_reset_device(udev); 4811 4810 usb_unlock_device(udev); 4811 + connect_change = 0; 4812 4812 } 4813 - connect_change = 0; 4814 4813 } 4815 4814 4816 4815 if (connect_change)
+6
drivers/usb/core/quirks.c
··· 78 78 { USB_DEVICE(0x04d8, 0x000c), .driver_info = 79 79 USB_QUIRK_CONFIG_INTF_STRINGS }, 80 80 81 + /* CarrolTouch 4000U */ 82 + { USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME }, 83 + 84 + /* CarrolTouch 4500U */ 85 + { USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME }, 86 + 81 87 /* Samsung Android phone modem - ID conflict with SPH-I500 */ 82 88 { USB_DEVICE(0x04e8, 0x6601), .driver_info = 83 89 USB_QUIRK_CONFIG_INTF_STRINGS },
+6 -7
drivers/usb/host/ehci-sched.c
··· 1391 1391 1392 1392 /* Behind the scheduling threshold? */ 1393 1393 if (unlikely(start < next)) { 1394 + unsigned now2 = (now - base) & (mod - 1); 1394 1395 1395 1396 /* USB_ISO_ASAP: Round up to the first available slot */ 1396 1397 if (urb->transfer_flags & URB_ISO_ASAP) 1397 1398 start += (next - start + period - 1) & -period; 1398 1399 1399 1400 /* 1400 - * Not ASAP: Use the next slot in the stream. If 1401 - * the entire URB falls before the threshold, fail. 1401 + * Not ASAP: Use the next slot in the stream, 1402 + * no matter what. 1402 1403 */ 1403 - else if (start + span - period < next) { 1404 - ehci_dbg(ehci, "iso urb late %p (%u+%u < %u)\n", 1404 + else if (start + span - period < now2) { 1405 + ehci_dbg(ehci, "iso underrun %p (%u+%u < %u)\n", 1405 1406 urb, start + base, 1406 - span - period, next + base); 1407 - status = -EXDEV; 1408 - goto fail; 1407 + span - period, now2 + base); 1409 1408 } 1410 1409 } 1411 1410
+1
drivers/usb/host/xhci-mem.c
··· 24 24 #include <linux/pci.h> 25 25 #include <linux/slab.h> 26 26 #include <linux/dmapool.h> 27 + #include <linux/dma-mapping.h> 27 28 28 29 #include "xhci.h" 29 30
+1
drivers/usb/host/xhci.c
··· 27 27 #include <linux/moduleparam.h> 28 28 #include <linux/slab.h> 29 29 #include <linux/dmi.h> 30 + #include <linux/dma-mapping.h> 30 31 31 32 #include "xhci.h" 32 33
+1 -1
drivers/usb/misc/adutux.c
··· 830 830 831 831 /* let the user know what node this device is now attached to */ 832 832 dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n", 833 - udev->descriptor.idProduct, dev->serial_number, 833 + le16_to_cpu(udev->descriptor.idProduct), dev->serial_number, 834 834 (dev->minor - ADU_MINOR_BASE)); 835 835 exit: 836 836 dbg(2, " %s : leave, return value %p (dev)", __func__, dev);
+1 -1
drivers/usb/serial/keyspan.c
··· 2303 2303 if (d_details == NULL) { 2304 2304 dev_err(&serial->dev->dev, "%s - unknown product id %x\n", 2305 2305 __func__, le16_to_cpu(serial->dev->descriptor.idProduct)); 2306 - return 1; 2306 + return -ENODEV; 2307 2307 } 2308 2308 2309 2309 /* Setup private data for serial driver */
+14 -7
drivers/usb/serial/mos7720.c
··· 90 90 struct list_head urblist_entry; 91 91 struct kref ref_count; 92 92 struct urb *urb; 93 + struct usb_ctrlrequest *setup; 93 94 }; 94 95 95 96 enum mos7715_pp_modes { ··· 272 271 struct mos7715_parport *mos_parport = urbtrack->mos_parport; 273 272 274 273 usb_free_urb(urbtrack->urb); 274 + kfree(urbtrack->setup); 275 275 kfree(urbtrack); 276 276 kref_put(&mos_parport->ref_count, destroy_mos_parport); 277 277 } ··· 357 355 struct urbtracker *urbtrack; 358 356 int ret_val; 359 357 unsigned long flags; 360 - struct usb_ctrlrequest setup; 361 358 struct usb_serial *serial = mos_parport->serial; 362 359 struct usb_device *usbdev = serial->dev; 363 360 ··· 374 373 kfree(urbtrack); 375 374 return -ENOMEM; 376 375 } 377 - setup.bRequestType = (__u8)0x40; 378 - setup.bRequest = (__u8)0x0e; 379 - setup.wValue = get_reg_value(reg, dummy); 380 - setup.wIndex = get_reg_index(reg); 381 - setup.wLength = 0; 376 + urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_KERNEL); 377 + if (!urbtrack->setup) { 378 + usb_free_urb(urbtrack->urb); 379 + kfree(urbtrack); 380 + return -ENOMEM; 381 + } 382 + urbtrack->setup->bRequestType = (__u8)0x40; 383 + urbtrack->setup->bRequest = (__u8)0x0e; 384 + urbtrack->setup->wValue = get_reg_value(reg, dummy); 385 + urbtrack->setup->wIndex = get_reg_index(reg); 386 + urbtrack->setup->wLength = 0; 382 387 usb_fill_control_urb(urbtrack->urb, usbdev, 383 388 usb_sndctrlpipe(usbdev, 0), 384 - (unsigned char *)&setup, 389 + (unsigned char *)urbtrack->setup, 385 390 NULL, 0, async_complete, urbtrack); 386 391 kref_init(&urbtrack->ref_count); 387 392 INIT_LIST_HEAD(&urbtrack->urblist_entry);
+1 -1
drivers/usb/serial/mos7840.c
··· 2193 2193 static int mos7840_probe(struct usb_serial *serial, 2194 2194 const struct usb_device_id *id) 2195 2195 { 2196 - u16 product = serial->dev->descriptor.idProduct; 2196 + u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); 2197 2197 u8 *buf; 2198 2198 int device_type; 2199 2199
+5 -4
drivers/usb/serial/ti_usb_3410_5052.c
··· 1536 1536 char buf[32]; 1537 1537 1538 1538 /* try ID specific firmware first, then try generic firmware */ 1539 - sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor, 1540 - dev->descriptor.idProduct); 1539 + sprintf(buf, "ti_usb-v%04x-p%04x.fw", 1540 + le16_to_cpu(dev->descriptor.idVendor), 1541 + le16_to_cpu(dev->descriptor.idProduct)); 1541 1542 status = request_firmware(&fw_p, buf, &dev->dev); 1542 1543 1543 1544 if (status != 0) { 1544 1545 buf[0] = '\0'; 1545 - if (dev->descriptor.idVendor == MTS_VENDOR_ID) { 1546 - switch (dev->descriptor.idProduct) { 1546 + if (le16_to_cpu(dev->descriptor.idVendor) == MTS_VENDOR_ID) { 1547 + switch (le16_to_cpu(dev->descriptor.idProduct)) { 1547 1548 case MTS_CDMA_PRODUCT_ID: 1548 1549 strcpy(buf, "mts_cdma.fw"); 1549 1550 break;
+10 -10
drivers/usb/serial/usb_wwan.c
··· 291 291 tty_flip_buffer_push(&port->port); 292 292 } else 293 293 dev_dbg(dev, "%s: empty read urb received\n", __func__); 294 - 295 - /* Resubmit urb so we continue receiving */ 296 - err = usb_submit_urb(urb, GFP_ATOMIC); 297 - if (err) { 298 - if (err != -EPERM) { 299 - dev_err(dev, "%s: resubmit read urb failed. (%d)\n", __func__, err); 300 - /* busy also in error unless we are killed */ 301 - usb_mark_last_busy(port->serial->dev); 302 - } 303 - } else { 294 + } 295 + /* Resubmit urb so we continue receiving */ 296 + err = usb_submit_urb(urb, GFP_ATOMIC); 297 + if (err) { 298 + if (err != -EPERM) { 299 + dev_err(dev, "%s: resubmit read urb failed. (%d)\n", 300 + __func__, err); 301 + /* busy also in error unless we are killed */ 304 302 usb_mark_last_busy(port->serial->dev); 305 303 } 304 + } else { 305 + usb_mark_last_busy(port->serial->dev); 306 306 } 307 307 } 308 308
+7 -2
drivers/usb/wusbcore/wa-xfer.c
··· 1226 1226 } 1227 1227 spin_lock_irqsave(&xfer->lock, flags); 1228 1228 rpipe = xfer->ep->hcpriv; 1229 + if (rpipe == NULL) { 1230 + pr_debug("%s: xfer id 0x%08X has no RPIPE. %s", 1231 + __func__, wa_xfer_id(xfer), 1232 + "Probably already aborted.\n" ); 1233 + goto out_unlock; 1234 + } 1229 1235 /* Check the delayed list -> if there, release and complete */ 1230 1236 spin_lock_irqsave(&wa->xfer_list_lock, flags2); 1231 1237 if (!list_empty(&xfer->list_node) && xfer->seg == NULL) ··· 1650 1644 break; 1651 1645 } 1652 1646 usb_status = xfer_result->bTransferStatus & 0x3f; 1653 - if (usb_status == WA_XFER_STATUS_ABORTED 1654 - || usb_status == WA_XFER_STATUS_NOT_FOUND) 1647 + if (usb_status == WA_XFER_STATUS_NOT_FOUND) 1655 1648 /* taken care of already */ 1656 1649 break; 1657 1650 xfer_id = xfer_result->dwTransferID;
-26
drivers/video/mxsfb.c
··· 239 239 } 240 240 }; 241 241 242 - static const struct fb_bitfield def_rgb666[] = { 243 - [RED] = { 244 - .offset = 16, 245 - .length = 6, 246 - }, 247 - [GREEN] = { 248 - .offset = 8, 249 - .length = 6, 250 - }, 251 - [BLUE] = { 252 - .offset = 0, 253 - .length = 6, 254 - }, 255 - [TRANSP] = { /* no support for transparency */ 256 - .length = 0, 257 - } 258 - }; 259 - 260 242 static const struct fb_bitfield def_rgb888[] = { 261 243 [RED] = { 262 244 .offset = 16, ··· 291 309 break; 292 310 case STMLCDIF_16BIT: 293 311 case STMLCDIF_18BIT: 294 - /* 24 bit to 18 bit mapping */ 295 - rgb = def_rgb666; 296 - break; 297 312 case STMLCDIF_24BIT: 298 313 /* real 24 bit */ 299 314 rgb = def_rgb888; ··· 432 453 return -EINVAL; 433 454 case STMLCDIF_16BIT: 434 455 case STMLCDIF_18BIT: 435 - /* 24 bit to 18 bit mapping */ 436 - ctrl |= CTRL_DF24; /* ignore the upper 2 bits in 437 - * each colour component 438 - */ 439 - break; 440 456 case STMLCDIF_24BIT: 441 457 /* real 24 bit */ 442 458 break;
+16 -2
drivers/video/omap2/displays-new/connector-analog-tv.c
··· 28 28 bool invert_polarity; 29 29 }; 30 30 31 + static const struct omap_video_timings tvc_pal_timings = { 32 + .x_res = 720, 33 + .y_res = 574, 34 + .pixel_clock = 13500, 35 + .hsw = 64, 36 + .hfp = 12, 37 + .hbp = 68, 38 + .vsw = 5, 39 + .vfp = 5, 40 + .vbp = 41, 41 + 42 + .interlace = true, 43 + }; 44 + 31 45 #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) 32 46 33 47 static int tvc_connect(struct omap_dss_device *dssdev) ··· 226 212 return -ENODEV; 227 213 } 228 214 229 - ddata->timings = omap_dss_pal_timings; 215 + ddata->timings = tvc_pal_timings; 230 216 231 217 dssdev = &ddata->dssdev; 232 218 dssdev->driver = &tvc_driver; 233 219 dssdev->dev = &pdev->dev; 234 220 dssdev->type = OMAP_DISPLAY_TYPE_VENC; 235 221 dssdev->owner = THIS_MODULE; 236 - dssdev->panel.timings = omap_dss_pal_timings; 222 + dssdev->panel.timings = tvc_pal_timings; 237 223 238 224 r = omapdss_register_display(dssdev); 239 225 if (r) {
+29 -19
fs/btrfs/backref.c
··· 36 36 u64 extent_item_pos, 37 37 struct extent_inode_elem **eie) 38 38 { 39 - u64 data_offset; 40 - u64 data_len; 39 + u64 offset = 0; 41 40 struct extent_inode_elem *e; 42 41 43 - data_offset = btrfs_file_extent_offset(eb, fi); 44 - data_len = btrfs_file_extent_num_bytes(eb, fi); 42 + if (!btrfs_file_extent_compression(eb, fi) && 43 + !btrfs_file_extent_encryption(eb, fi) && 44 + !btrfs_file_extent_other_encoding(eb, fi)) { 45 + u64 data_offset; 46 + u64 data_len; 45 47 46 - if (extent_item_pos < data_offset || 47 - extent_item_pos >= data_offset + data_len) 48 - return 1; 48 + data_offset = btrfs_file_extent_offset(eb, fi); 49 + data_len = btrfs_file_extent_num_bytes(eb, fi); 50 + 51 + if (extent_item_pos < data_offset || 52 + extent_item_pos >= data_offset + data_len) 53 + return 1; 54 + offset = extent_item_pos - data_offset; 55 + } 49 56 50 57 e = kmalloc(sizeof(*e), GFP_NOFS); 51 58 if (!e) ··· 60 53 61 54 e->next = *eie; 62 55 e->inum = key->objectid; 63 - e->offset = key->offset + (extent_item_pos - data_offset); 56 + e->offset = key->offset + offset; 64 57 *eie = e; 65 58 66 59 return 0; ··· 196 189 struct extent_buffer *eb; 197 190 struct btrfs_key key; 198 191 struct btrfs_file_extent_item *fi; 199 - struct extent_inode_elem *eie = NULL; 192 + struct extent_inode_elem *eie = NULL, *old = NULL; 200 193 u64 disk_byte; 201 194 202 195 if (level != 0) { ··· 230 223 231 224 if (disk_byte == wanted_disk_byte) { 232 225 eie = NULL; 226 + old = NULL; 233 227 if (extent_item_pos) { 234 228 ret = check_extent_in_eb(&key, eb, fi, 235 229 *extent_item_pos, ··· 238 230 if (ret < 0) 239 231 break; 240 232 } 241 - if (!ret) { 242 - ret = ulist_add(parents, eb->start, 243 - (uintptr_t)eie, GFP_NOFS); 244 - if (ret < 0) 245 - break; 246 - if (!extent_item_pos) { 247 - ret = btrfs_next_old_leaf(root, path, 248 - time_seq); 249 - continue; 250 - } 233 + if (ret > 0) 234 + goto next; 235 + ret = ulist_add_merge(parents, eb->start, 236 + (uintptr_t)eie, 237 + (u64 *)&old, GFP_NOFS); 238 + if (ret < 0) 239 + break; 240 + if (!ret && extent_item_pos) { 241 + while (old->next) 242 + old = old->next; 243 + old->next = eie; 251 244 } 252 245 } 246 + next: 253 247 ret = btrfs_next_old_item(root, path, time_seq); 254 248 } 255 249
-1
fs/btrfs/ctree.c
··· 1271 1271 BUG_ON(!eb_rewin); 1272 1272 } 1273 1273 1274 - extent_buffer_get(eb_rewin); 1275 1274 btrfs_tree_read_unlock(eb); 1276 1275 free_extent_buffer(eb); 1277 1276
+6 -3
fs/btrfs/extent_io.c
··· 4048 4048 } 4049 4049 4050 4050 while (!end) { 4051 - u64 offset_in_extent; 4051 + u64 offset_in_extent = 0; 4052 4052 4053 4053 /* break if the extent we found is outside the range */ 4054 4054 if (em->start >= max || extent_map_end(em) < off) ··· 4064 4064 4065 4065 /* 4066 4066 * record the offset from the start of the extent 4067 - * for adjusting the disk offset below 4067 + * for adjusting the disk offset below. Only do this if the 4068 + * extent isn't compressed since our in ram offset may be past 4069 + * what we have actually allocated on disk. 4068 4070 */ 4069 - offset_in_extent = em_start - em->start; 4071 + if (!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) 4072 + offset_in_extent = em_start - em->start; 4070 4073 em_end = extent_map_end(em); 4071 4074 em_len = em_end - em_start; 4072 4075 emflags = em->flags;
+41 -23
fs/btrfs/file.c
··· 596 596 if (no_splits) 597 597 goto next; 598 598 599 - if (em->block_start < EXTENT_MAP_LAST_BYTE && 600 - em->start < start) { 599 + if (em->start < start) { 601 600 split->start = em->start; 602 601 split->len = start - em->start; 603 - split->orig_start = em->orig_start; 604 - split->block_start = em->block_start; 605 602 606 - if (compressed) 607 - split->block_len = em->block_len; 608 - else 609 - split->block_len = split->len; 610 - split->ram_bytes = em->ram_bytes; 611 - split->orig_block_len = max(split->block_len, 612 - em->orig_block_len); 603 + if (em->block_start < EXTENT_MAP_LAST_BYTE) { 604 + split->orig_start = em->orig_start; 605 + split->block_start = em->block_start; 606 + 607 + if (compressed) 608 + split->block_len = em->block_len; 609 + else 610 + split->block_len = split->len; 611 + split->orig_block_len = max(split->block_len, 612 + em->orig_block_len); 613 + split->ram_bytes = em->ram_bytes; 614 + } else { 615 + split->orig_start = split->start; 616 + split->block_len = 0; 617 + split->block_start = em->block_start; 618 + split->orig_block_len = 0; 619 + split->ram_bytes = split->len; 620 + } 621 + 613 622 split->generation = gen; 614 623 split->bdev = em->bdev; 615 624 split->flags = flags; ··· 629 620 split = split2; 630 621 split2 = NULL; 631 622 } 632 - if (em->block_start < EXTENT_MAP_LAST_BYTE && 633 - testend && em->start + em->len > start + len) { 623 + if (testend && em->start + em->len > start + len) { 634 624 u64 diff = start + len - em->start; 635 625 636 626 split->start = start + len; ··· 638 630 split->flags = flags; 639 631 split->compress_type = em->compress_type; 640 632 split->generation = gen; 641 - split->orig_block_len = max(em->block_len, 642 - em->orig_block_len); 643 - split->ram_bytes = em->ram_bytes; 644 633 645 - if (compressed) { 646 - split->block_len = em->block_len; 647 - split->block_start = em->block_start; 648 - split->orig_start = em->orig_start; 634 + if (em->block_start < EXTENT_MAP_LAST_BYTE) { 635 + split->orig_block_len = max(em->block_len, 636 + em->orig_block_len); 637 + 638 + split->ram_bytes = em->ram_bytes; 639 + if (compressed) { 640 + split->block_len = em->block_len; 641 + split->block_start = em->block_start; 642 + split->orig_start = em->orig_start; 643 + } else { 644 + split->block_len = split->len; 645 + split->block_start = em->block_start 646 + + diff; 647 + split->orig_start = em->orig_start; 648 + } 649 649 } else { 650 - split->block_len = split->len; 651 - split->block_start = em->block_start + diff; 652 - split->orig_start = em->orig_start; 650 + split->ram_bytes = split->len; 651 + split->orig_start = split->start; 652 + split->block_len = 0; 653 + split->block_start = em->block_start; 654 + split->orig_block_len = 0; 653 655 } 654 656 655 657 ret = add_extent_mapping(em_tree, split, modified);
+37 -15
fs/btrfs/inode.c
··· 2166 2166 if (btrfs_file_extent_disk_bytenr(leaf, extent) != old->bytenr) 2167 2167 continue; 2168 2168 2169 - extent_offset = btrfs_file_extent_offset(leaf, extent); 2170 - if (key.offset - extent_offset != offset) 2169 + /* 2170 + * 'offset' refers to the exact key.offset, 2171 + * NOT the 'offset' field in btrfs_extent_data_ref, ie. 2172 + * (key.offset - extent_offset). 2173 + */ 2174 + if (key.offset != offset) 2171 2175 continue; 2172 2176 2177 + extent_offset = btrfs_file_extent_offset(leaf, extent); 2173 2178 num_bytes = btrfs_file_extent_num_bytes(leaf, extent); 2179 + 2174 2180 if (extent_offset >= old->extent_offset + old->offset + 2175 2181 old->len || extent_offset + num_bytes <= 2176 2182 old->extent_offset + old->offset) 2177 2183 continue; 2178 2184 2185 + ret = 0; 2179 2186 break; 2180 2187 } 2181 2188 ··· 2194 2187 2195 2188 backref->root_id = root_id; 2196 2189 backref->inum = inum; 2197 - backref->file_pos = offset + extent_offset; 2190 + backref->file_pos = offset; 2198 2191 backref->num_bytes = num_bytes; 2199 2192 backref->extent_offset = extent_offset; 2200 2193 backref->generation = btrfs_file_extent_generation(leaf, extent); ··· 2217 2210 new->path = path; 2218 2211 2219 2212 list_for_each_entry_safe(old, tmp, &new->head, list) { 2220 - ret = iterate_inodes_from_logical(old->bytenr, fs_info, 2213 + ret = iterate_inodes_from_logical(old->bytenr + 2214 + old->extent_offset, fs_info, 2221 2215 path, record_one_backref, 2222 2216 old); 2223 2217 BUG_ON(ret < 0 && ret != -ENOENT); ··· 4399 4391 int mask = attr->ia_valid; 4400 4392 int ret; 4401 4393 4402 - if (newsize == oldsize) 4403 - return 0; 4404 - 4405 4394 /* 4406 4395 * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a 4407 4396 * special case where we need to update the times despite not having ··· 5170 5165 } 5171 5166 5172 5167 /* Reached end of directory/root. Bump pos past the last item. */ 5173 - if (key_type == BTRFS_DIR_INDEX_KEY) 5174 - /* 5175 - * 32-bit glibc will use getdents64, but then strtol - 5176 - * so the last number we can serve is this. 5177 - */ 5178 - ctx->pos = 0x7fffffff; 5179 - else 5180 - ctx->pos++; 5168 + ctx->pos++; 5169 + 5170 + /* 5171 + * Stop new entries from being returned after we return the last 5172 + * entry. 5173 + * 5174 + * New directory entries are assigned a strictly increasing 5175 + * offset. This means that new entries created during readdir 5176 + * are *guaranteed* to be seen in the future by that readdir. 5177 + * This has broken buggy programs which operate on names as 5178 + * they're returned by readdir. Until we re-use freed offsets 5179 + * we have this hack to stop new entries from being returned 5180 + * under the assumption that they'll never reach this huge 5181 + * offset. 5182 + * 5183 + * This is being careful not to overflow 32bit loff_t unless the 5184 + * last entry requires it because doing so has broken 32bit apps 5185 + * in the past. 5186 + */ 5187 + if (key_type == BTRFS_DIR_INDEX_KEY) { 5188 + if (ctx->pos >= INT_MAX) 5189 + ctx->pos = LLONG_MAX; 5190 + else 5191 + ctx->pos = INT_MAX; 5192 + } 5181 5193 nopos: 5182 5194 ret = 0; 5183 5195 err:
+4 -4
fs/btrfs/transaction.c
··· 983 983 * a dirty root struct and adds it into the list of dead roots that need to 984 984 * be deleted 985 985 */ 986 - int btrfs_add_dead_root(struct btrfs_root *root) 986 + void btrfs_add_dead_root(struct btrfs_root *root) 987 987 { 988 988 spin_lock(&root->fs_info->trans_lock); 989 - list_add_tail(&root->root_list, &root->fs_info->dead_roots); 989 + if (list_empty(&root->root_list)) 990 + list_add_tail(&root->root_list, &root->fs_info->dead_roots); 990 991 spin_unlock(&root->fs_info->trans_lock); 991 - return 0; 992 992 } 993 993 994 994 /* ··· 1925 1925 } 1926 1926 root = list_first_entry(&fs_info->dead_roots, 1927 1927 struct btrfs_root, root_list); 1928 - list_del(&root->root_list); 1928 + list_del_init(&root->root_list); 1929 1929 spin_unlock(&fs_info->trans_lock); 1930 1930 1931 1931 pr_debug("btrfs: cleaner removing %llu\n",
+1 -1
fs/btrfs/transaction.h
··· 143 143 int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, 144 144 struct btrfs_root *root); 145 145 146 - int btrfs_add_dead_root(struct btrfs_root *root); 146 + void btrfs_add_dead_root(struct btrfs_root *root); 147 147 int btrfs_defrag_root(struct btrfs_root *root); 148 148 int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root); 149 149 int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
+2 -3
fs/btrfs/tree-log.c
··· 3746 3746 } 3747 3747 3748 3748 log_extents: 3749 + btrfs_release_path(path); 3750 + btrfs_release_path(dst_path); 3749 3751 if (fast_search) { 3750 - btrfs_release_path(dst_path); 3751 3752 ret = btrfs_log_changed_extents(trans, root, inode, dst_path); 3752 3753 if (ret) { 3753 3754 err = ret; ··· 3765 3764 } 3766 3765 3767 3766 if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { 3768 - btrfs_release_path(path); 3769 - btrfs_release_path(dst_path); 3770 3767 ret = log_directory_changes(trans, root, inode, path, dst_path); 3771 3768 if (ret) { 3772 3769 err = ret;
+9 -5
fs/cifs/cifsencrypt.c
··· 43 43 server->secmech.md5 = crypto_alloc_shash("md5", 0, 0); 44 44 if (IS_ERR(server->secmech.md5)) { 45 45 cifs_dbg(VFS, "could not allocate crypto md5\n"); 46 - return PTR_ERR(server->secmech.md5); 46 + rc = PTR_ERR(server->secmech.md5); 47 + server->secmech.md5 = NULL; 48 + return rc; 47 49 } 48 50 49 51 size = sizeof(struct shash_desc) + 50 52 crypto_shash_descsize(server->secmech.md5); 51 53 server->secmech.sdescmd5 = kmalloc(size, GFP_KERNEL); 52 54 if (!server->secmech.sdescmd5) { 53 - rc = -ENOMEM; 54 55 crypto_free_shash(server->secmech.md5); 55 56 server->secmech.md5 = NULL; 56 - return rc; 57 + return -ENOMEM; 57 58 } 58 59 server->secmech.sdescmd5->shash.tfm = server->secmech.md5; 59 60 server->secmech.sdescmd5->shash.flags = 0x0; ··· 422 421 if (blobptr + attrsize > blobend) 423 422 break; 424 423 if (type == NTLMSSP_AV_NB_DOMAIN_NAME) { 425 - if (!attrsize) 424 + if (!attrsize || attrsize >= CIFS_MAX_DOMAINNAME_LEN) 426 425 break; 427 426 if (!ses->domainName) { 428 427 ses->domainName = ··· 592 591 593 592 static int crypto_hmacmd5_alloc(struct TCP_Server_Info *server) 594 593 { 594 + int rc; 595 595 unsigned int size; 596 596 597 597 /* check if already allocated */ ··· 602 600 server->secmech.hmacmd5 = crypto_alloc_shash("hmac(md5)", 0, 0); 603 601 if (IS_ERR(server->secmech.hmacmd5)) { 604 602 cifs_dbg(VFS, "could not allocate crypto hmacmd5\n"); 605 - return PTR_ERR(server->secmech.hmacmd5); 603 + rc = PTR_ERR(server->secmech.hmacmd5); 604 + server->secmech.hmacmd5 = NULL; 605 + return rc; 606 606 } 607 607 608 608 size = sizeof(struct shash_desc) +
+5 -6
fs/cifs/cifsfs.c
··· 147 147 goto out_no_root; 148 148 } 149 149 150 + if (cifs_sb_master_tcon(cifs_sb)->nocase) 151 + sb->s_d_op = &cifs_ci_dentry_ops; 152 + else 153 + sb->s_d_op = &cifs_dentry_ops; 154 + 150 155 sb->s_root = d_make_root(inode); 151 156 if (!sb->s_root) { 152 157 rc = -ENOMEM; 153 158 goto out_no_root; 154 159 } 155 - 156 - /* do that *after* d_make_root() - we want NULL ->d_op for root here */ 157 - if (cifs_sb_master_tcon(cifs_sb)->nocase) 158 - sb->s_d_op = &cifs_ci_dentry_ops; 159 - else 160 - sb->s_d_op = &cifs_dentry_ops; 161 160 162 161 #ifdef CONFIG_CIFS_NFSD_EXPORT 163 162 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
+4
fs/cifs/cifsglob.h
··· 44 44 #define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1) 45 45 #define MAX_SERVER_SIZE 15 46 46 #define MAX_SHARE_SIZE 80 47 + #define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */ 47 48 #define MAX_USERNAME_SIZE 256 /* reasonable maximum for current servers */ 48 49 #define MAX_PASSWORD_SIZE 512 /* max for windows seems to be 256 wide chars */ 49 50 ··· 370 369 void (*generate_signingkey)(struct TCP_Server_Info *server); 371 370 int (*calc_signature)(struct smb_rqst *rqst, 372 371 struct TCP_Server_Info *server); 372 + int (*query_mf_symlink)(const unsigned char *path, char *pbuf, 373 + unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb, 374 + unsigned int xid); 373 375 }; 374 376 375 377 struct smb_version_values {
+3 -1
fs/cifs/cifsproto.h
··· 497 497 struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages, 498 498 work_func_t complete); 499 499 void cifs_writedata_release(struct kref *refcount); 500 - 500 + int open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, 501 + unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb, 502 + unsigned int xid); 501 503 #endif /* _CIFSPROTO_H */
+4 -3
fs/cifs/connect.c
··· 1675 1675 if (string == NULL) 1676 1676 goto out_nomem; 1677 1677 1678 - if (strnlen(string, 256) == 256) { 1678 + if (strnlen(string, CIFS_MAX_DOMAINNAME_LEN) 1679 + == CIFS_MAX_DOMAINNAME_LEN) { 1679 1680 printk(KERN_WARNING "CIFS: domain name too" 1680 1681 " long\n"); 1681 1682 goto cifs_parse_mount_err; ··· 2277 2276 2278 2277 #ifdef CONFIG_KEYS 2279 2278 2280 - /* strlen("cifs:a:") + INET6_ADDRSTRLEN + 1 */ 2281 - #define CIFSCREDS_DESC_SIZE (7 + INET6_ADDRSTRLEN + 1) 2279 + /* strlen("cifs:a:") + CIFS_MAX_DOMAINNAME_LEN + 1 */ 2280 + #define CIFSCREDS_DESC_SIZE (7 + CIFS_MAX_DOMAINNAME_LEN + 1) 2282 2281 2283 2282 /* Populate username and pw fields from keyring if possible */ 2284 2283 static int
+1
fs/cifs/file.c
··· 647 647 oflags, &oplock, &cfile->fid.netfid, xid); 648 648 if (rc == 0) { 649 649 cifs_dbg(FYI, "posix reopen succeeded\n"); 650 + oparms.reconnect = true; 650 651 goto reopen_success; 651 652 } 652 653 /*
+53 -31
fs/cifs/link.c
··· 305 305 } 306 306 307 307 int 308 - CIFSCheckMFSymlink(struct cifs_fattr *fattr, 309 - const unsigned char *path, 310 - struct cifs_sb_info *cifs_sb, unsigned int xid) 308 + open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, 309 + unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb, 310 + unsigned int xid) 311 311 { 312 312 int rc; 313 313 int oplock = 0; 314 314 __u16 netfid = 0; 315 315 struct tcon_link *tlink; 316 - struct cifs_tcon *pTcon; 316 + struct cifs_tcon *ptcon; 317 317 struct cifs_io_parms io_parms; 318 - u8 *buf; 319 - char *pbuf; 320 - unsigned int bytes_read = 0; 321 318 int buf_type = CIFS_NO_BUFFER; 322 - unsigned int link_len = 0; 323 319 FILE_ALL_INFO file_info; 324 - 325 - if (!CIFSCouldBeMFSymlink(fattr)) 326 - /* it's not a symlink */ 327 - return 0; 328 320 329 321 tlink = cifs_sb_tlink(cifs_sb); 330 322 if (IS_ERR(tlink)) 331 323 return PTR_ERR(tlink); 332 - pTcon = tlink_tcon(tlink); 324 + ptcon = tlink_tcon(tlink); 333 325 334 - rc = CIFSSMBOpen(xid, pTcon, path, FILE_OPEN, GENERIC_READ, 326 + rc = CIFSSMBOpen(xid, ptcon, path, FILE_OPEN, GENERIC_READ, 335 327 CREATE_NOT_DIR, &netfid, &oplock, &file_info, 336 328 cifs_sb->local_nls, 337 329 cifs_sb->mnt_cifs_flags & 338 330 CIFS_MOUNT_MAP_SPECIAL_CHR); 339 - if (rc != 0) 340 - goto out; 331 + if (rc != 0) { 332 + cifs_put_tlink(tlink); 333 + return rc; 334 + } 341 335 342 336 if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) { 343 - CIFSSMBClose(xid, pTcon, netfid); 337 + CIFSSMBClose(xid, ptcon, netfid); 338 + cifs_put_tlink(tlink); 344 339 /* it's not a symlink */ 345 - goto out; 340 + return rc; 346 341 } 342 + 343 + io_parms.netfid = netfid; 344 + io_parms.pid = current->tgid; 345 + io_parms.tcon = ptcon; 346 + io_parms.offset = 0; 347 + io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE; 348 + 349 + rc = CIFSSMBRead(xid, &io_parms, pbytes_read, &pbuf, &buf_type); 350 + CIFSSMBClose(xid, ptcon, netfid); 351 + cifs_put_tlink(tlink); 352 + return rc; 353 + } 354 + 355 + 356 + int 357 + CIFSCheckMFSymlink(struct cifs_fattr *fattr, 358 + const unsigned char *path, 359 + struct cifs_sb_info *cifs_sb, unsigned int xid) 360 + { 361 + int rc = 0; 362 + u8 *buf = NULL; 363 + unsigned int link_len = 0; 364 + unsigned int bytes_read = 0; 365 + struct cifs_tcon *ptcon; 366 + 367 + if (!CIFSCouldBeMFSymlink(fattr)) 368 + /* it's not a symlink */ 369 + return 0; 347 370 348 371 buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL); 349 372 if (!buf) { 350 373 rc = -ENOMEM; 351 374 goto out; 352 375 } 353 - pbuf = buf; 354 - io_parms.netfid = netfid; 355 - io_parms.pid = current->tgid; 356 - io_parms.tcon = pTcon; 357 - io_parms.offset = 0; 358 - io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE; 359 376 360 - rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf, &buf_type); 361 - CIFSSMBClose(xid, pTcon, netfid); 362 - if (rc != 0) { 363 - kfree(buf); 377 + ptcon = tlink_tcon(cifs_sb_tlink(cifs_sb)); 378 + if ((ptcon->ses) && (ptcon->ses->server->ops->query_mf_symlink)) 379 + rc = ptcon->ses->server->ops->query_mf_symlink(path, buf, 380 + &bytes_read, cifs_sb, xid); 381 + else 364 382 goto out; 365 - } 383 + 384 + if (rc != 0) 385 + goto out; 386 + 387 + if (bytes_read == 0) /* not a symlink */ 388 + goto out; 366 389 367 390 rc = CIFSParseMFSymlink(buf, bytes_read, &link_len, NULL); 368 - kfree(buf); 369 391 if (rc == -EINVAL) { 370 392 /* it's not a symlink */ 371 393 rc = 0; ··· 403 381 fattr->cf_mode |= S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO; 404 382 fattr->cf_dtype = DT_LNK; 405 383 out: 406 - cifs_put_tlink(tlink); 384 + kfree(buf); 407 385 return rc; 408 386 } 409 387
+8
fs/cifs/readdir.c
··· 111 111 return; 112 112 } 113 113 114 + /* 115 + * If we know that the inode will need to be revalidated immediately, 116 + * then don't create a new dentry for it. We'll end up doing an on 117 + * the wire call either way and this spares us an invalidation. 118 + */ 119 + if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL) 120 + return; 121 + 114 122 dentry = d_alloc(parent, name); 115 123 if (!dentry) 116 124 return;
+3 -3
fs/cifs/sess.c
··· 197 197 bytes_ret = 0; 198 198 } else 199 199 bytes_ret = cifs_strtoUTF16((__le16 *) bcc_ptr, ses->domainName, 200 - 256, nls_cp); 200 + CIFS_MAX_DOMAINNAME_LEN, nls_cp); 201 201 bcc_ptr += 2 * bytes_ret; 202 202 bcc_ptr += 2; /* account for null terminator */ 203 203 ··· 255 255 256 256 /* copy domain */ 257 257 if (ses->domainName != NULL) { 258 - strncpy(bcc_ptr, ses->domainName, 256); 259 - bcc_ptr += strnlen(ses->domainName, 256); 258 + strncpy(bcc_ptr, ses->domainName, CIFS_MAX_DOMAINNAME_LEN); 259 + bcc_ptr += strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN); 260 260 } /* else we will send a null domain name 261 261 so the server will default to its own domain */ 262 262 *bcc_ptr = 0;
+1
fs/cifs/smb1ops.c
··· 944 944 .mand_lock = cifs_mand_lock, 945 945 .mand_unlock_range = cifs_unlock_range, 946 946 .push_mand_locks = cifs_push_mandatory_locks, 947 + .query_mf_symlink = open_query_close_cifs_symlink, 947 948 }; 948 949 949 950 struct smb_version_values smb1_values = {
+7 -2
fs/cifs/smb2transport.c
··· 42 42 static int 43 43 smb2_crypto_shash_allocate(struct TCP_Server_Info *server) 44 44 { 45 + int rc; 45 46 unsigned int size; 46 47 47 48 if (server->secmech.sdeschmacsha256 != NULL) ··· 51 50 server->secmech.hmacsha256 = crypto_alloc_shash("hmac(sha256)", 0, 0); 52 51 if (IS_ERR(server->secmech.hmacsha256)) { 53 52 cifs_dbg(VFS, "could not allocate crypto hmacsha256\n"); 54 - return PTR_ERR(server->secmech.hmacsha256); 53 + rc = PTR_ERR(server->secmech.hmacsha256); 54 + server->secmech.hmacsha256 = NULL; 55 + return rc; 55 56 } 56 57 57 58 size = sizeof(struct shash_desc) + ··· 90 87 server->secmech.sdeschmacsha256 = NULL; 91 88 crypto_free_shash(server->secmech.hmacsha256); 92 89 server->secmech.hmacsha256 = NULL; 93 - return PTR_ERR(server->secmech.cmacaes); 90 + rc = PTR_ERR(server->secmech.cmacaes); 91 + server->secmech.cmacaes = NULL; 92 + return rc; 94 93 } 95 94 96 95 size = sizeof(struct shash_desc) +
+23 -48
fs/debugfs/inode.c
··· 533 533 */ 534 534 void debugfs_remove_recursive(struct dentry *dentry) 535 535 { 536 - struct dentry *child; 537 - struct dentry *parent; 536 + struct dentry *child, *next, *parent; 538 537 539 538 if (IS_ERR_OR_NULL(dentry)) 540 539 return; ··· 543 544 return; 544 545 545 546 parent = dentry; 547 + down: 546 548 mutex_lock(&parent->d_inode->i_mutex); 549 + list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) { 550 + if (!debugfs_positive(child)) 551 + continue; 547 552 548 - while (1) { 549 - /* 550 - * When all dentries under "parent" has been removed, 551 - * walk up the tree until we reach our starting point. 552 - */ 553 - if (list_empty(&parent->d_subdirs)) { 554 - mutex_unlock(&parent->d_inode->i_mutex); 555 - if (parent == dentry) 556 - break; 557 - parent = parent->d_parent; 558 - mutex_lock(&parent->d_inode->i_mutex); 559 - } 560 - child = list_entry(parent->d_subdirs.next, struct dentry, 561 - d_u.d_child); 562 - next_sibling: 563 - 564 - /* 565 - * If "child" isn't empty, walk down the tree and 566 - * remove all its descendants first. 567 - */ 553 + /* perhaps simple_empty(child) makes more sense */ 568 554 if (!list_empty(&child->d_subdirs)) { 569 555 mutex_unlock(&parent->d_inode->i_mutex); 570 556 parent = child; 571 - mutex_lock(&parent->d_inode->i_mutex); 572 - continue; 557 + goto down; 573 558 } 574 - __debugfs_remove(child, parent); 575 - if (parent->d_subdirs.next == &child->d_u.d_child) { 576 - /* 577 - * Try the next sibling. 578 - */ 579 - if (child->d_u.d_child.next != &parent->d_subdirs) { 580 - child = list_entry(child->d_u.d_child.next, 581 - struct dentry, 582 - d_u.d_child); 583 - goto next_sibling; 584 - } 585 - 586 - /* 587 - * Avoid infinite loop if we fail to remove 588 - * one dentry. 589 - */ 590 - mutex_unlock(&parent->d_inode->i_mutex); 591 - break; 592 - } 593 - simple_release_fs(&debugfs_mount, &debugfs_mount_count); 559 + up: 560 + if (!__debugfs_remove(child, parent)) 561 + simple_release_fs(&debugfs_mount, &debugfs_mount_count); 594 562 } 595 563 596 - parent = dentry->d_parent; 597 - mutex_lock(&parent->d_inode->i_mutex); 598 - __debugfs_remove(dentry, parent); 599 564 mutex_unlock(&parent->d_inode->i_mutex); 600 - simple_release_fs(&debugfs_mount, &debugfs_mount_count); 565 + child = parent; 566 + parent = parent->d_parent; 567 + mutex_lock(&parent->d_inode->i_mutex); 568 + 569 + if (child != dentry) { 570 + next = list_entry(child->d_u.d_child.next, struct dentry, 571 + d_u.d_child); 572 + goto up; 573 + } 574 + 575 + if (!__debugfs_remove(child, parent)) 576 + simple_release_fs(&debugfs_mount, &debugfs_mount_count); 577 + mutex_unlock(&parent->d_inode->i_mutex); 601 578 } 602 579 EXPORT_SYMBOL_GPL(debugfs_remove_recursive); 603 580
-1
fs/dlm/user.c
··· 686 686 device_remove_lockspace() */ 687 687 688 688 sigprocmask(SIG_SETMASK, &tmpsig, NULL); 689 - recalc_sigpending(); 690 689 691 690 return 0; 692 691 }
+2 -2
fs/exec.c
··· 608 608 return -ENOMEM; 609 609 610 610 lru_add_drain(); 611 - tlb_gather_mmu(&tlb, mm, 0); 611 + tlb_gather_mmu(&tlb, mm, old_start, old_end); 612 612 if (new_end > old_start) { 613 613 /* 614 614 * when the old and new regions overlap clear from new_end. ··· 625 625 free_pgd_range(&tlb, old_start, old_end, new_end, 626 626 vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING); 627 627 } 628 - tlb_finish_mmu(&tlb, new_end, old_end); 628 + tlb_finish_mmu(&tlb, old_start, old_end); 629 629 630 630 /* 631 631 * Shrink the vma to just the new range. Always succeeds.
+1 -1
fs/ext4/extents.c
··· 4412 4412 retry: 4413 4413 err = ext4_es_remove_extent(inode, last_block, 4414 4414 EXT_MAX_BLOCKS - last_block); 4415 - if (err == ENOMEM) { 4415 + if (err == -ENOMEM) { 4416 4416 cond_resched(); 4417 4417 congestion_wait(BLK_RW_ASYNC, HZ/50); 4418 4418 goto retry;
+5 -5
fs/ext4/ialloc.c
··· 734 734 ino = ext4_find_next_zero_bit((unsigned long *) 735 735 inode_bitmap_bh->b_data, 736 736 EXT4_INODES_PER_GROUP(sb), ino); 737 - if (ino >= EXT4_INODES_PER_GROUP(sb)) { 738 - if (++group == ngroups) 739 - group = 0; 740 - continue; 741 - } 737 + if (ino >= EXT4_INODES_PER_GROUP(sb)) 738 + goto next_group; 742 739 if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { 743 740 ext4_error(sb, "reserved inode found cleared - " 744 741 "inode=%lu", ino + 1); ··· 766 769 goto got; /* we grabbed the inode! */ 767 770 if (ino < EXT4_INODES_PER_GROUP(sb)) 768 771 goto repeat_in_this_group; 772 + next_group: 773 + if (++group == ngroups) 774 + group = 0; 769 775 } 770 776 err = -ENOSPC; 771 777 goto out;
+18 -21
fs/ext4/inode.c
··· 555 555 int ret; 556 556 unsigned long long status; 557 557 558 - #ifdef ES_AGGRESSIVE_TEST 559 - if (retval != map->m_len) { 560 - printk("ES len assertion failed for inode: %lu " 561 - "retval %d != map->m_len %d " 562 - "in %s (lookup)\n", inode->i_ino, retval, 563 - map->m_len, __func__); 558 + if (unlikely(retval != map->m_len)) { 559 + ext4_warning(inode->i_sb, 560 + "ES len assertion failed for inode " 561 + "%lu: retval %d != map->m_len %d", 562 + inode->i_ino, retval, map->m_len); 563 + WARN_ON(1); 564 564 } 565 - #endif 566 565 567 566 status = map->m_flags & EXT4_MAP_UNWRITTEN ? 568 567 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; ··· 655 656 int ret; 656 657 unsigned long long status; 657 658 658 - #ifdef ES_AGGRESSIVE_TEST 659 - if (retval != map->m_len) { 660 - printk("ES len assertion failed for inode: %lu " 661 - "retval %d != map->m_len %d " 662 - "in %s (allocation)\n", inode->i_ino, retval, 663 - map->m_len, __func__); 659 + if (unlikely(retval != map->m_len)) { 660 + ext4_warning(inode->i_sb, 661 + "ES len assertion failed for inode " 662 + "%lu: retval %d != map->m_len %d", 663 + inode->i_ino, retval, map->m_len); 664 + WARN_ON(1); 664 665 } 665 - #endif 666 666 667 667 /* 668 668 * If the extent has been zeroed out, we don't need to update ··· 1635 1637 int ret; 1636 1638 unsigned long long status; 1637 1639 1638 - #ifdef ES_AGGRESSIVE_TEST 1639 - if (retval != map->m_len) { 1640 - printk("ES len assertion failed for inode: %lu " 1641 - "retval %d != map->m_len %d " 1642 - "in %s (lookup)\n", inode->i_ino, retval, 1643 - map->m_len, __func__); 1640 + if (unlikely(retval != map->m_len)) { 1641 + ext4_warning(inode->i_sb, 1642 + "ES len assertion failed for inode " 1643 + "%lu: retval %d != map->m_len %d", 1644 + inode->i_ino, retval, map->m_len); 1645 + WARN_ON(1); 1644 1646 } 1645 - #endif 1646 1647 1647 1648 status = map->m_flags & EXT4_MAP_UNWRITTEN ? 1648 1649 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
+4 -2
fs/ext4/ioctl.c
··· 77 77 memswap(ei1->i_data, ei2->i_data, sizeof(ei1->i_data)); 78 78 memswap(&ei1->i_flags, &ei2->i_flags, sizeof(ei1->i_flags)); 79 79 memswap(&ei1->i_disksize, &ei2->i_disksize, sizeof(ei1->i_disksize)); 80 - memswap(&ei1->i_es_tree, &ei2->i_es_tree, sizeof(ei1->i_es_tree)); 81 - memswap(&ei1->i_es_lru_nr, &ei2->i_es_lru_nr, sizeof(ei1->i_es_lru_nr)); 80 + ext4_es_remove_extent(inode1, 0, EXT_MAX_BLOCKS); 81 + ext4_es_remove_extent(inode2, 0, EXT_MAX_BLOCKS); 82 + ext4_es_lru_del(inode1); 83 + ext4_es_lru_del(inode2); 82 84 83 85 isize = i_size_read(inode1); 84 86 i_size_write(inode1, i_size_read(inode2));
+18 -2
fs/ext4/super.c
··· 1359 1359 {Opt_delalloc, EXT4_MOUNT_DELALLOC, 1360 1360 MOPT_EXT4_ONLY | MOPT_SET | MOPT_EXPLICIT}, 1361 1361 {Opt_nodelalloc, EXT4_MOUNT_DELALLOC, 1362 - MOPT_EXT4_ONLY | MOPT_CLEAR | MOPT_EXPLICIT}, 1362 + MOPT_EXT4_ONLY | MOPT_CLEAR}, 1363 1363 {Opt_journal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM, 1364 1364 MOPT_EXT4_ONLY | MOPT_SET}, 1365 1365 {Opt_journal_async_commit, (EXT4_MOUNT_JOURNAL_ASYNC_COMMIT | ··· 3483 3483 } 3484 3484 if (test_opt(sb, DIOREAD_NOLOCK)) { 3485 3485 ext4_msg(sb, KERN_ERR, "can't mount with " 3486 - "both data=journal and delalloc"); 3486 + "both data=journal and dioread_nolock"); 3487 3487 goto failed_mount; 3488 3488 } 3489 3489 if (test_opt(sb, DELALLOC)) ··· 4727 4727 goto restore_opts; 4728 4728 } 4729 4729 4730 + if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { 4731 + if (test_opt2(sb, EXPLICIT_DELALLOC)) { 4732 + ext4_msg(sb, KERN_ERR, "can't mount with " 4733 + "both data=journal and delalloc"); 4734 + err = -EINVAL; 4735 + goto restore_opts; 4736 + } 4737 + if (test_opt(sb, DIOREAD_NOLOCK)) { 4738 + ext4_msg(sb, KERN_ERR, "can't mount with " 4739 + "both data=journal and dioread_nolock"); 4740 + err = -EINVAL; 4741 + goto restore_opts; 4742 + } 4743 + } 4744 + 4730 4745 if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) 4731 4746 ext4_abort(sb, "Abort forced by user"); 4732 4747 ··· 5496 5481 kset_unregister(ext4_kset); 5497 5482 ext4_exit_system_zone(); 5498 5483 ext4_exit_pageio(); 5484 + ext4_exit_es(); 5499 5485 } 5500 5486 5501 5487 MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
+2 -2
fs/fcntl.c
··· 730 730 * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY 731 731 * is defined as O_NONBLOCK on some platforms and not on others. 732 732 */ 733 - BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( 733 + BUILD_BUG_ON(20 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( 734 734 O_RDONLY | O_WRONLY | O_RDWR | 735 735 O_CREAT | O_EXCL | O_NOCTTY | 736 736 O_TRUNC | O_APPEND | /* O_NONBLOCK | */ 737 737 __O_SYNC | O_DSYNC | FASYNC | 738 738 O_DIRECT | O_LARGEFILE | O_DIRECTORY | 739 739 O_NOFOLLOW | O_NOATIME | O_CLOEXEC | 740 - __FMODE_EXEC | O_PATH 740 + __FMODE_EXEC | O_PATH | __O_TMPFILE 741 741 )); 742 742 743 743 fasync_cache = kmem_cache_create("fasync_cache",
+10
fs/hugetlbfs/inode.c
··· 463 463 return inode; 464 464 } 465 465 466 + /* 467 + * Hugetlbfs is not reclaimable; therefore its i_mmap_mutex will never 468 + * be taken from reclaim -- unlike regular filesystems. This needs an 469 + * annotation because huge_pmd_share() does an allocation under 470 + * i_mmap_mutex. 471 + */ 472 + struct lock_class_key hugetlbfs_i_mmap_mutex_key; 473 + 466 474 static struct inode *hugetlbfs_get_inode(struct super_block *sb, 467 475 struct inode *dir, 468 476 umode_t mode, dev_t dev) ··· 482 474 struct hugetlbfs_inode_info *info; 483 475 inode->i_ino = get_next_ino(); 484 476 inode_init_owner(inode, dir, mode); 477 + lockdep_set_class(&inode->i_mapping->i_mmap_mutex, 478 + &hugetlbfs_i_mmap_mutex_key); 485 479 inode->i_mapping->a_ops = &hugetlbfs_aops; 486 480 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; 487 481 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+9 -4
fs/lockd/clntlock.c
··· 64 64 nlm_init->protocol, nlm_version, 65 65 nlm_init->hostname, nlm_init->noresvport, 66 66 nlm_init->net); 67 - if (host == NULL) { 68 - lockd_down(nlm_init->net); 69 - return ERR_PTR(-ENOLCK); 70 - } 67 + if (host == NULL) 68 + goto out_nohost; 69 + if (host->h_rpcclnt == NULL && nlm_bind_host(host) == NULL) 70 + goto out_nobind; 71 71 72 72 return host; 73 + out_nobind: 74 + nlmclnt_release_host(host); 75 + out_nohost: 76 + lockd_down(nlm_init->net); 77 + return ERR_PTR(-ENOLCK); 73 78 } 74 79 EXPORT_SYMBOL_GPL(nlmclnt_init); 75 80
+3 -2
fs/lockd/clntproc.c
··· 125 125 { 126 126 struct nlm_args *argp = &req->a_args; 127 127 struct nlm_lock *lock = &argp->lock; 128 + char *nodename = req->a_host->h_rpcclnt->cl_nodename; 128 129 129 130 nlmclnt_next_cookie(&argp->cookie); 130 131 memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); 131 - lock->caller = utsname()->nodename; 132 + lock->caller = nodename; 132 133 lock->oh.data = req->a_owner; 133 134 lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", 134 135 (unsigned int)fl->fl_u.nfs_fl.owner->pid, 135 - utsname()->nodename); 136 + nodename); 136 137 lock->svid = fl->fl_u.nfs_fl.owner->pid; 137 138 lock->fl.fl_start = fl->fl_start; 138 139 lock->fl.fl_end = fl->fl_end;
+3 -7
fs/namei.c
··· 3671 3671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) 3672 3672 return -EINVAL; 3673 3673 /* 3674 - * To use null names we require CAP_DAC_READ_SEARCH 3675 - * This ensures that not everyone will be able to create 3676 - * handlink using the passed filedescriptor. 3674 + * Using empty names is equivalent to using AT_SYMLINK_FOLLOW 3675 + * on /proc/self/fd/<fd>. 3677 3676 */ 3678 - if (flags & AT_EMPTY_PATH) { 3679 - if (!capable(CAP_DAC_READ_SEARCH)) 3680 - return -ENOENT; 3677 + if (flags & AT_EMPTY_PATH) 3681 3678 how = LOOKUP_EMPTY; 3682 - } 3683 3679 3684 3680 if (flags & AT_SYMLINK_FOLLOW) 3685 3681 how |= LOOKUP_FOLLOW;
+8 -3
fs/nfs/inode.c
··· 463 463 unlock_new_inode(inode); 464 464 } else 465 465 nfs_refresh_inode(inode, fattr); 466 - nfs_setsecurity(inode, fattr, label); 467 466 dprintk("NFS: nfs_fhget(%s/%Ld fh_crc=0x%08x ct=%d)\n", 468 467 inode->i_sb->s_id, 469 468 (long long)NFS_FILEID(inode), ··· 962 963 static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) 963 964 { 964 965 struct nfs_inode *nfsi = NFS_I(inode); 965 - 966 + int ret; 967 + 966 968 if (mapping->nrpages != 0) { 967 - int ret = invalidate_inode_pages2(mapping); 969 + if (S_ISREG(inode->i_mode)) { 970 + ret = nfs_sync_mapping(mapping); 971 + if (ret < 0) 972 + return ret; 973 + } 974 + ret = invalidate_inode_pages2(mapping); 968 975 if (ret < 0) 969 976 return ret; 970 977 }
+3 -5
fs/nfs/nfs4proc.c
··· 3071 3071 nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, 3072 3072 struct nfs_fh *fhandle, struct nfs_fattr *fattr) 3073 3073 { 3074 + struct rpc_clnt *client = NFS_CLIENT(dir); 3074 3075 int status; 3075 - struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir)); 3076 3076 3077 3077 status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL); 3078 - if (status < 0) { 3079 - rpc_shutdown_client(client); 3078 + if (status < 0) 3080 3079 return ERR_PTR(status); 3081 - } 3082 - return client; 3080 + return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client; 3083 3081 } 3084 3082 3085 3083 static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)
+4
fs/nfs/super.c
··· 2478 2478 if (server->flags & NFS_MOUNT_NOAC) 2479 2479 sb_mntdata.mntflags |= MS_SYNCHRONOUS; 2480 2480 2481 + if (mount_info->cloned != NULL && mount_info->cloned->sb != NULL) 2482 + if (mount_info->cloned->sb->s_flags & MS_SYNCHRONOUS) 2483 + sb_mntdata.mntflags |= MS_SYNCHRONOUS; 2484 + 2481 2485 /* Get a superblock - note that we may end up sharing one that already exists */ 2482 2486 s = sget(nfs_mod->nfs_fs, compare_super, nfs_set_super, flags, &sb_mntdata); 2483 2487 if (IS_ERR(s)) {
+1 -1
fs/nfsd/nfs4proc.c
··· 1524 1524 static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) 1525 1525 { 1526 1526 return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\ 1527 - 1 + 1 + 0 + /* eir_flags, spr_how, SP4_NONE (for now) */\ 1527 + 1 + 1 + 2 + /* eir_flags, spr_how, spo_must_enforce & _allow */\ 1528 1528 2 + /*eir_server_owner.so_minor_id */\ 1529 1529 /* eir_server_owner.so_major_id<> */\ 1530 1530 XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 +\
+2
fs/nfsd/nfs4state.c
··· 1264 1264 struct svc_cred *cr = &rqstp->rq_cred; 1265 1265 u32 service; 1266 1266 1267 + if (!cr->cr_gss_mech) 1268 + return false; 1267 1269 service = gss_pseudoflavor_to_service(cr->cr_gss_mech, cr->cr_flavor); 1268 1270 return service == RPC_GSS_SVC_INTEGRITY || 1269 1271 service == RPC_GSS_SVC_PRIVACY;
+2 -3
fs/nfsd/nfs4xdr.c
··· 3360 3360 8 /* eir_clientid */ + 3361 3361 4 /* eir_sequenceid */ + 3362 3362 4 /* eir_flags */ + 3363 - 4 /* spr_how (SP4_NONE) */ + 3363 + 4 /* spr_how */ + 3364 + 8 /* spo_must_enforce, spo_must_allow */ + 3364 3365 8 /* so_minor_id */ + 3365 3366 4 /* so_major_id.len */ + 3366 3367 (XDR_QUADLEN(major_id_sz) * 4) + ··· 3373 3372 WRITE32(exid->seqid); 3374 3373 WRITE32(exid->flags); 3375 3374 3376 - /* state_protect4_r. Currently only support SP4_NONE */ 3377 - BUG_ON(exid->spa_how != SP4_NONE); 3378 3375 WRITE32(exid->spa_how); 3379 3376 switch (exid->spa_how) { 3380 3377 case SP4_NONE:
+1 -1
fs/ocfs2/aops.c
··· 1757 1757 goto out; 1758 1758 } else if (ret == 1) { 1759 1759 clusters_need = wc->w_clen; 1760 - ret = ocfs2_refcount_cow(inode, filp, di_bh, 1760 + ret = ocfs2_refcount_cow(inode, di_bh, 1761 1761 wc->w_cpos, wc->w_clen, UINT_MAX); 1762 1762 if (ret) { 1763 1763 mlog_errno(ret);
+1 -3
fs/ocfs2/dir.c
··· 2153 2153 { 2154 2154 int ret; 2155 2155 struct ocfs2_empty_dir_priv priv = { 2156 - .ctx.actor = ocfs2_empty_dir_filldir 2156 + .ctx.actor = ocfs2_empty_dir_filldir, 2157 2157 }; 2158 - 2159 - memset(&priv, 0, sizeof(priv)); 2160 2158 2161 2159 if (ocfs2_dir_indexed(inode)) { 2162 2160 ret = ocfs2_empty_dir_dx(inode, &priv);
+3 -3
fs/ocfs2/file.c
··· 370 370 if (!(ext_flags & OCFS2_EXT_REFCOUNTED)) 371 371 goto out; 372 372 373 - return ocfs2_refcount_cow(inode, NULL, fe_bh, cpos, 1, cpos+1); 373 + return ocfs2_refcount_cow(inode, fe_bh, cpos, 1, cpos+1); 374 374 375 375 out: 376 376 return status; ··· 899 899 zero_clusters = last_cpos - zero_cpos; 900 900 901 901 if (needs_cow) { 902 - rc = ocfs2_refcount_cow(inode, NULL, di_bh, zero_cpos, 902 + rc = ocfs2_refcount_cow(inode, di_bh, zero_cpos, 903 903 zero_clusters, UINT_MAX); 904 904 if (rc) { 905 905 mlog_errno(rc); ··· 2078 2078 2079 2079 *meta_level = 1; 2080 2080 2081 - ret = ocfs2_refcount_cow(inode, file, di_bh, cpos, clusters, UINT_MAX); 2081 + ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX); 2082 2082 if (ret) 2083 2083 mlog_errno(ret); 2084 2084 out:
+1 -1
fs/ocfs2/journal.h
··· 537 537 extent_blocks = 1 + 1 + le16_to_cpu(root_el->l_tree_depth); 538 538 539 539 return bitmap_blocks + sysfile_bitmap_blocks + extent_blocks + 540 - ocfs2_quota_trans_credits(sb) + bits_wanted; 540 + ocfs2_quota_trans_credits(sb); 541 541 } 542 542 543 543 static inline int ocfs2_calc_symlink_credits(struct super_block *sb)
+1 -1
fs/ocfs2/move_extents.c
··· 69 69 u64 ino = ocfs2_metadata_cache_owner(context->et.et_ci); 70 70 u64 old_blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cpos); 71 71 72 - ret = ocfs2_duplicate_clusters_by_page(handle, context->file, cpos, 72 + ret = ocfs2_duplicate_clusters_by_page(handle, inode, cpos, 73 73 p_cpos, new_p_cpos, len); 74 74 if (ret) { 75 75 mlog_errno(ret);
+8 -45
fs/ocfs2/refcounttree.c
··· 49 49 50 50 struct ocfs2_cow_context { 51 51 struct inode *inode; 52 - struct file *file; 53 52 u32 cow_start; 54 53 u32 cow_len; 55 54 struct ocfs2_extent_tree data_et; ··· 65 66 u32 *num_clusters, 66 67 unsigned int *extent_flags); 67 68 int (*cow_duplicate_clusters)(handle_t *handle, 68 - struct file *file, 69 + struct inode *inode, 69 70 u32 cpos, u32 old_cluster, 70 71 u32 new_cluster, u32 new_len); 71 72 }; ··· 2921 2922 } 2922 2923 2923 2924 int ocfs2_duplicate_clusters_by_page(handle_t *handle, 2924 - struct file *file, 2925 + struct inode *inode, 2925 2926 u32 cpos, u32 old_cluster, 2926 2927 u32 new_cluster, u32 new_len) 2927 2928 { 2928 2929 int ret = 0, partial; 2929 - struct inode *inode = file_inode(file); 2930 - struct ocfs2_caching_info *ci = INODE_CACHE(inode); 2931 - struct super_block *sb = ocfs2_metadata_cache_get_super(ci); 2930 + struct super_block *sb = inode->i_sb; 2932 2931 u64 new_block = ocfs2_clusters_to_blocks(sb, new_cluster); 2933 2932 struct page *page; 2934 2933 pgoff_t page_index; ··· 2975 2978 if (PAGE_CACHE_SIZE <= OCFS2_SB(sb)->s_clustersize) 2976 2979 BUG_ON(PageDirty(page)); 2977 2980 2978 - if (PageReadahead(page)) { 2979 - page_cache_async_readahead(mapping, 2980 - &file->f_ra, file, 2981 - page, page_index, 2982 - readahead_pages); 2983 - } 2984 - 2985 2981 if (!PageUptodate(page)) { 2986 2982 ret = block_read_full_page(page, ocfs2_get_block); 2987 2983 if (ret) { ··· 2994 3004 } 2995 3005 } 2996 3006 2997 - ocfs2_map_and_dirty_page(inode, handle, from, to, 3007 + ocfs2_map_and_dirty_page(inode, 3008 + handle, from, to, 2998 3009 page, 0, &new_block); 2999 3010 mark_page_accessed(page); 3000 3011 unlock: ··· 3011 3020 } 3012 3021 3013 3022 int ocfs2_duplicate_clusters_by_jbd(handle_t *handle, 3014 - struct file *file, 3023 + struct inode *inode, 3015 3024 u32 cpos, u32 old_cluster, 3016 3025 u32 new_cluster, u32 new_len) 3017 3026 { 3018 3027 int ret = 0; 3019 - struct inode *inode = file_inode(file); 3020 3028 struct super_block *sb = inode->i_sb; 3021 3029 struct ocfs2_caching_info *ci = INODE_CACHE(inode); 3022 3030 int i, blocks = ocfs2_clusters_to_blocks(sb, new_len); ··· 3140 3150 3141 3151 /*If the old clusters is unwritten, no need to duplicate. */ 3142 3152 if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) { 3143 - ret = context->cow_duplicate_clusters(handle, context->file, 3153 + ret = context->cow_duplicate_clusters(handle, context->inode, 3144 3154 cpos, old, new, len); 3145 3155 if (ret) { 3146 3156 mlog_errno(ret); ··· 3418 3428 return ret; 3419 3429 } 3420 3430 3421 - static void ocfs2_readahead_for_cow(struct inode *inode, 3422 - struct file *file, 3423 - u32 start, u32 len) 3424 - { 3425 - struct address_space *mapping; 3426 - pgoff_t index; 3427 - unsigned long num_pages; 3428 - int cs_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits; 3429 - 3430 - if (!file) 3431 - return; 3432 - 3433 - mapping = file->f_mapping; 3434 - num_pages = (len << cs_bits) >> PAGE_CACHE_SHIFT; 3435 - if (!num_pages) 3436 - num_pages = 1; 3437 - 3438 - index = ((loff_t)start << cs_bits) >> PAGE_CACHE_SHIFT; 3439 - page_cache_sync_readahead(mapping, &file->f_ra, file, 3440 - index, num_pages); 3441 - } 3442 - 3443 3431 /* 3444 3432 * Starting at cpos, try to CoW write_len clusters. Don't CoW 3445 3433 * past max_cpos. This will stop when it runs into a hole or an 3446 3434 * unrefcounted extent. 3447 3435 */ 3448 3436 static int ocfs2_refcount_cow_hunk(struct inode *inode, 3449 - struct file *file, 3450 3437 struct buffer_head *di_bh, 3451 3438 u32 cpos, u32 write_len, u32 max_cpos) 3452 3439 { ··· 3452 3485 3453 3486 BUG_ON(cow_len == 0); 3454 3487 3455 - ocfs2_readahead_for_cow(inode, file, cow_start, cow_len); 3456 - 3457 3488 context = kzalloc(sizeof(struct ocfs2_cow_context), GFP_NOFS); 3458 3489 if (!context) { 3459 3490 ret = -ENOMEM; ··· 3473 3508 context->ref_root_bh = ref_root_bh; 3474 3509 context->cow_duplicate_clusters = ocfs2_duplicate_clusters_by_page; 3475 3510 context->get_clusters = ocfs2_di_get_clusters; 3476 - context->file = file; 3477 3511 3478 3512 ocfs2_init_dinode_extent_tree(&context->data_et, 3479 3513 INODE_CACHE(inode), di_bh); ··· 3501 3537 * clusters between cpos and cpos+write_len are safe to modify. 3502 3538 */ 3503 3539 int ocfs2_refcount_cow(struct inode *inode, 3504 - struct file *file, 3505 3540 struct buffer_head *di_bh, 3506 3541 u32 cpos, u32 write_len, u32 max_cpos) 3507 3542 { ··· 3520 3557 num_clusters = write_len; 3521 3558 3522 3559 if (ext_flags & OCFS2_EXT_REFCOUNTED) { 3523 - ret = ocfs2_refcount_cow_hunk(inode, file, di_bh, cpos, 3560 + ret = ocfs2_refcount_cow_hunk(inode, di_bh, cpos, 3524 3561 num_clusters, max_cpos); 3525 3562 if (ret) { 3526 3563 mlog_errno(ret);
+3 -3
fs/ocfs2/refcounttree.h
··· 53 53 int *credits, 54 54 int *ref_blocks); 55 55 int ocfs2_refcount_cow(struct inode *inode, 56 - struct file *filep, struct buffer_head *di_bh, 56 + struct buffer_head *di_bh, 57 57 u32 cpos, u32 write_len, u32 max_cpos); 58 58 59 59 typedef int (ocfs2_post_refcount_func)(struct inode *inode, ··· 85 85 u32 cpos, u32 write_len, 86 86 struct ocfs2_post_refcount *post); 87 87 int ocfs2_duplicate_clusters_by_page(handle_t *handle, 88 - struct file *file, 88 + struct inode *inode, 89 89 u32 cpos, u32 old_cluster, 90 90 u32 new_cluster, u32 new_len); 91 91 int ocfs2_duplicate_clusters_by_jbd(handle_t *handle, 92 - struct file *file, 92 + struct inode *inode, 93 93 u32 cpos, u32 old_cluster, 94 94 u32 new_cluster, u32 new_len); 95 95 int ocfs2_cow_sync_writeback(struct super_block *sb,
+1 -1
fs/open.c
··· 823 823 int lookup_flags = 0; 824 824 int acc_mode; 825 825 826 - if (flags & O_CREAT) 826 + if (flags & (O_CREAT | __O_TMPFILE)) 827 827 op->mode = (mode & S_IALLUGO) | S_IFREG; 828 828 else 829 829 op->mode = 0;
+21 -10
fs/proc/task_mmu.c
··· 730 730 * of how soft-dirty works. 731 731 */ 732 732 pte_t ptent = *pte; 733 - ptent = pte_wrprotect(ptent); 734 - ptent = pte_clear_flags(ptent, _PAGE_SOFT_DIRTY); 733 + 734 + if (pte_present(ptent)) { 735 + ptent = pte_wrprotect(ptent); 736 + ptent = pte_clear_flags(ptent, _PAGE_SOFT_DIRTY); 737 + } else if (is_swap_pte(ptent)) { 738 + ptent = pte_swp_clear_soft_dirty(ptent); 739 + } else if (pte_file(ptent)) { 740 + ptent = pte_file_clear_soft_dirty(ptent); 741 + } 742 + 735 743 set_pte_at(vma->vm_mm, addr, pte, ptent); 736 744 #endif 737 745 } ··· 760 752 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); 761 753 for (; addr != end; pte++, addr += PAGE_SIZE) { 762 754 ptent = *pte; 763 - if (!pte_present(ptent)) 764 - continue; 765 755 766 756 if (cp->type == CLEAR_REFS_SOFT_DIRTY) { 767 757 clear_soft_dirty(vma, addr, pte); 768 758 continue; 769 759 } 760 + 761 + if (!pte_present(ptent)) 762 + continue; 770 763 771 764 page = vm_normal_page(vma, addr, ptent); 772 765 if (!page) ··· 868 859 } pagemap_entry_t; 869 860 870 861 struct pagemapread { 871 - int pos, len; 862 + int pos, len; /* units: PM_ENTRY_BYTES, not bytes */ 872 863 pagemap_entry_t *buffer; 873 864 bool v2; 874 865 }; ··· 876 867 #define PAGEMAP_WALK_SIZE (PMD_SIZE) 877 868 #define PAGEMAP_WALK_MASK (PMD_MASK) 878 869 879 - #define PM_ENTRY_BYTES sizeof(u64) 870 + #define PM_ENTRY_BYTES sizeof(pagemap_entry_t) 880 871 #define PM_STATUS_BITS 3 881 872 #define PM_STATUS_OFFSET (64 - PM_STATUS_BITS) 882 873 #define PM_STATUS_MASK (((1LL << PM_STATUS_BITS) - 1) << PM_STATUS_OFFSET) ··· 939 930 flags = PM_PRESENT; 940 931 page = vm_normal_page(vma, addr, pte); 941 932 } else if (is_swap_pte(pte)) { 942 - swp_entry_t entry = pte_to_swp_entry(pte); 943 - 933 + swp_entry_t entry; 934 + if (pte_swp_soft_dirty(pte)) 935 + flags2 |= __PM_SOFT_DIRTY; 936 + entry = pte_to_swp_entry(pte); 944 937 frame = swp_type(entry) | 945 938 (swp_offset(entry) << MAX_SWAPFILES_SHIFT); 946 939 flags = PM_SWAP; ··· 1127 1116 goto out_task; 1128 1117 1129 1118 pm.v2 = soft_dirty_cleared; 1130 - pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT); 1131 - pm.buffer = kmalloc(pm.len, GFP_TEMPORARY); 1119 + pm.len = (PAGEMAP_WALK_SIZE >> PAGE_SHIFT); 1120 + pm.buffer = kmalloc(pm.len * PM_ENTRY_BYTES, GFP_TEMPORARY); 1132 1121 ret = -ENOMEM; 1133 1122 if (!pm.buffer) 1134 1123 goto out_task;
+19 -80
fs/reiserfs/procfs.c
··· 19 19 /* 20 20 * LOCKING: 21 21 * 22 - * We rely on new Alexander Viro's super-block locking. 22 + * These guys are evicted from procfs as the very first step in ->kill_sb(). 23 23 * 24 24 */ 25 25 26 - static int show_version(struct seq_file *m, struct super_block *sb) 26 + static int show_version(struct seq_file *m, void *unused) 27 27 { 28 + struct super_block *sb = m->private; 28 29 char *format; 29 30 30 31 if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) { ··· 67 66 #define DJP( x ) le32_to_cpu( jp -> x ) 68 67 #define JF( x ) ( r -> s_journal -> x ) 69 68 70 - static int show_super(struct seq_file *m, struct super_block *sb) 69 + static int show_super(struct seq_file *m, void *unused) 71 70 { 71 + struct super_block *sb = m->private; 72 72 struct reiserfs_sb_info *r = REISERFS_SB(sb); 73 73 74 74 seq_printf(m, "state: \t%s\n" ··· 130 128 return 0; 131 129 } 132 130 133 - static int show_per_level(struct seq_file *m, struct super_block *sb) 131 + static int show_per_level(struct seq_file *m, void *unused) 134 132 { 133 + struct super_block *sb = m->private; 135 134 struct reiserfs_sb_info *r = REISERFS_SB(sb); 136 135 int level; 137 136 ··· 189 186 return 0; 190 187 } 191 188 192 - static int show_bitmap(struct seq_file *m, struct super_block *sb) 189 + static int show_bitmap(struct seq_file *m, void *unused) 193 190 { 191 + struct super_block *sb = m->private; 194 192 struct reiserfs_sb_info *r = REISERFS_SB(sb); 195 193 196 194 seq_printf(m, "free_block: %lu\n" ··· 222 218 return 0; 223 219 } 224 220 225 - static int show_on_disk_super(struct seq_file *m, struct super_block *sb) 221 + static int show_on_disk_super(struct seq_file *m, void *unused) 226 222 { 223 + struct super_block *sb = m->private; 227 224 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); 228 225 struct reiserfs_super_block *rs = sb_info->s_rs; 229 226 int hash_code = DFL(s_hash_function_code); ··· 266 261 return 0; 267 262 } 268 263 269 - static int show_oidmap(struct seq_file *m, struct super_block *sb) 264 + static int show_oidmap(struct seq_file *m, void *unused) 270 265 { 266 + struct super_block *sb = m->private; 271 267 struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); 272 268 struct reiserfs_super_block *rs = sb_info->s_rs; 273 269 unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize); ··· 297 291 return 0; 298 292 } 299 293 300 - static int show_journal(struct seq_file *m, struct super_block *sb) 294 + static int show_journal(struct seq_file *m, void *unused) 301 295 { 296 + struct super_block *sb = m->private; 302 297 struct reiserfs_sb_info *r = REISERFS_SB(sb); 303 298 struct reiserfs_super_block *rs = r->s_rs; 304 299 struct journal_params *jp = &rs->s_v1.s_journal; ··· 390 383 return 0; 391 384 } 392 385 393 - /* iterator */ 394 - static int test_sb(struct super_block *sb, void *data) 395 - { 396 - return data == sb; 397 - } 398 - 399 - static int set_sb(struct super_block *sb, void *data) 400 - { 401 - return -ENOENT; 402 - } 403 - 404 - struct reiserfs_seq_private { 405 - struct super_block *sb; 406 - int (*show) (struct seq_file *, struct super_block *); 407 - }; 408 - 409 - static void *r_start(struct seq_file *m, loff_t * pos) 410 - { 411 - struct reiserfs_seq_private *priv = m->private; 412 - loff_t l = *pos; 413 - 414 - if (l) 415 - return NULL; 416 - 417 - if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb))) 418 - return NULL; 419 - 420 - up_write(&priv->sb->s_umount); 421 - return priv->sb; 422 - } 423 - 424 - static void *r_next(struct seq_file *m, void *v, loff_t * pos) 425 - { 426 - ++*pos; 427 - if (v) 428 - deactivate_super(v); 429 - return NULL; 430 - } 431 - 432 - static void r_stop(struct seq_file *m, void *v) 433 - { 434 - if (v) 435 - deactivate_super(v); 436 - } 437 - 438 - static int r_show(struct seq_file *m, void *v) 439 - { 440 - struct reiserfs_seq_private *priv = m->private; 441 - return priv->show(m, v); 442 - } 443 - 444 - static const struct seq_operations r_ops = { 445 - .start = r_start, 446 - .next = r_next, 447 - .stop = r_stop, 448 - .show = r_show, 449 - }; 450 - 451 386 static int r_open(struct inode *inode, struct file *file) 452 387 { 453 - struct reiserfs_seq_private *priv; 454 - int ret = seq_open_private(file, &r_ops, 455 - sizeof(struct reiserfs_seq_private)); 456 - 457 - if (!ret) { 458 - struct seq_file *m = file->private_data; 459 - priv = m->private; 460 - priv->sb = proc_get_parent_data(inode); 461 - priv->show = PDE_DATA(inode); 462 - } 463 - return ret; 388 + return single_open(file, PDE_DATA(inode), 389 + proc_get_parent_data(inode)); 464 390 } 465 391 466 392 static const struct file_operations r_file_operations = { 467 393 .open = r_open, 468 394 .read = seq_read, 469 395 .llseek = seq_lseek, 470 - .release = seq_release_private, 471 - .owner = THIS_MODULE, 396 + .release = single_release, 472 397 }; 473 398 474 399 static struct proc_dir_entry *proc_info_root = NULL; 475 400 static const char proc_info_root_name[] = "fs/reiserfs"; 476 401 477 402 static void add_file(struct super_block *sb, char *name, 478 - int (*func) (struct seq_file *, struct super_block *)) 403 + int (*func) (struct seq_file *, void *)) 479 404 { 480 405 proc_create_data(name, 0, REISERFS_SB(sb)->procdir, 481 406 &r_file_operations, func);
+1 -2
fs/reiserfs/super.c
··· 499 499 static void reiserfs_kill_sb(struct super_block *s) 500 500 { 501 501 if (REISERFS_SB(s)) { 502 + reiserfs_proc_info_done(s); 502 503 /* 503 504 * Force any pending inode evictions to occur now. Any 504 505 * inodes to be removed that have extended attributes ··· 554 553 reiserfs_warning(s, "green-2005", "reserved blocks left %d", 555 554 REISERFS_SB(s)->reserved_blocks); 556 555 } 557 - 558 - reiserfs_proc_info_done(s); 559 556 560 557 reiserfs_write_unlock(s); 561 558 mutex_destroy(&REISERFS_SB(s)->lock);
+7 -7
include/acpi/acpi_bus.h
··· 274 274 }; 275 275 276 276 struct acpi_device_physical_node { 277 - u8 node_id; 277 + unsigned int node_id; 278 278 struct list_head node; 279 279 struct device *dev; 280 280 bool put_online:1; 281 281 }; 282 - 283 - /* set maximum of physical nodes to 32 for expansibility */ 284 - #define ACPI_MAX_PHYSICAL_NODE 32 285 282 286 283 /* Device */ 287 284 struct acpi_device { ··· 299 302 struct acpi_driver *driver; 300 303 void *driver_data; 301 304 struct device dev; 302 - u8 physical_node_count; 305 + unsigned int physical_node_count; 303 306 struct list_head physical_node_list; 304 307 struct mutex physical_node_lock; 305 - DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE); 306 308 struct list_head power_dependent; 307 309 void (*remove)(struct acpi_device *); 308 310 }; ··· 441 445 }; 442 446 443 447 /* helper */ 444 - acpi_handle acpi_get_child(acpi_handle, u64); 448 + acpi_handle acpi_find_child(acpi_handle, u64, bool); 449 + static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr) 450 + { 451 + return acpi_find_child(handle, addr, false); 452 + } 445 453 int acpi_is_root_bridge(acpi_handle); 446 454 struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); 447 455 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))
+30
include/asm-generic/pgtable.h
··· 417 417 { 418 418 return pmd; 419 419 } 420 + 421 + static inline pte_t pte_swp_mksoft_dirty(pte_t pte) 422 + { 423 + return pte; 424 + } 425 + 426 + static inline int pte_swp_soft_dirty(pte_t pte) 427 + { 428 + return 0; 429 + } 430 + 431 + static inline pte_t pte_swp_clear_soft_dirty(pte_t pte) 432 + { 433 + return pte; 434 + } 435 + 436 + static inline pte_t pte_file_clear_soft_dirty(pte_t pte) 437 + { 438 + return pte; 439 + } 440 + 441 + static inline pte_t pte_file_mksoft_dirty(pte_t pte) 442 + { 443 + return pte; 444 + } 445 + 446 + static inline int pte_file_soft_dirty(pte_t pte) 447 + { 448 + return 0; 449 + } 420 450 #endif 421 451 422 452 #ifndef __HAVE_PFNMAP_TRACKING
+1 -1
include/asm-generic/tlb.h
··· 112 112 113 113 #define HAVE_GENERIC_MMU_GATHER 114 114 115 - void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm); 115 + void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end); 116 116 void tlb_flush_mmu(struct mmu_gather *tlb); 117 117 void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, 118 118 unsigned long end);
+7 -5
include/linux/ftrace_event.h
··· 78 78 /* trace_seq for __print_flags() and __print_symbolic() etc. */ 79 79 struct trace_seq tmp_seq; 80 80 81 + cpumask_var_t started; 82 + 83 + /* it's true when current open file is snapshot */ 84 + bool snapshot; 85 + 81 86 /* The below is zeroed out in pipe_read */ 82 87 struct trace_seq seq; 83 88 struct trace_entry *ent; ··· 95 90 loff_t pos; 96 91 long idx; 97 92 98 - cpumask_var_t started; 99 - 100 - /* it's true when current open file is snapshot */ 101 - bool snapshot; 93 + /* All new field here will be zeroed out in pipe_read */ 102 94 }; 103 95 104 96 enum trace_iter_flags { ··· 334 332 const char *name, int offset, int size, 335 333 int is_signed, int filter_type); 336 334 extern int trace_add_event_call(struct ftrace_event_call *call); 337 - extern void trace_remove_event_call(struct ftrace_event_call *call); 335 + extern int trace_remove_event_call(struct ftrace_event_call *call); 338 336 339 337 #define is_signed_type(type) (((type)(-1)) < (type)1) 340 338
+2 -1
include/linux/iio/trigger.h
··· 8 8 */ 9 9 #include <linux/irq.h> 10 10 #include <linux/module.h> 11 + #include <linux/atomic.h> 11 12 12 13 #ifndef _IIO_TRIGGER_H_ 13 14 #define _IIO_TRIGGER_H_ ··· 62 61 63 62 struct list_head list; 64 63 struct list_head alloc_list; 65 - int use_count; 64 + atomic_t use_count; 66 65 67 66 struct irq_chip subirq_chip; 68 67 int subirq_base;
+1 -1
include/linux/kernel.h
··· 629 629 static inline void tracing_start(void) { } 630 630 static inline void tracing_stop(void) { } 631 631 static inline void ftrace_off_permanent(void) { } 632 - static inline void trace_dump_stack(void) { } 632 + static inline void trace_dump_stack(int skip) { } 633 633 634 634 static inline void tracing_on(void) { } 635 635 static inline void tracing_off(void) { }
+16
include/linux/mfd/ti_am335x_tscadc.h
··· 113 113 #define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3) 114 114 #define CNTRLREG_TSCENB BIT(7) 115 115 116 + /* FIFO READ Register */ 117 + #define FIFOREAD_DATA_MASK (0xfff << 0) 118 + #define FIFOREAD_CHNLID_MASK (0xf << 16) 119 + 120 + /* Sequencer Status */ 121 + #define SEQ_STATUS BIT(5) 122 + 116 123 #define ADC_CLK 3000000 117 124 #define MAX_CLK_DIV 7 118 125 #define TOTAL_STEPS 16 119 126 #define TOTAL_CHANNELS 8 127 + 128 + /* 129 + * ADC runs at 3MHz, and it takes 130 + * 15 cycles to latch one data output. 131 + * Hence the idle time for ADC to 132 + * process one sample data would be 133 + * around 5 micro seconds. 134 + */ 135 + #define IDLE_TIMEOUT 5 /* microsec */ 120 136 121 137 #define TSCADC_CELLS 2 122 138
+10 -12
include/linux/mlx5/device.h
··· 309 309 __be16 max_desc_sz_rq; 310 310 u8 rsvd21[2]; 311 311 __be16 max_desc_sz_sq_dc; 312 - u8 rsvd22[4]; 313 - __be16 max_qp_mcg; 314 - u8 rsvd23; 312 + __be32 max_qp_mcg; 313 + u8 rsvd22[3]; 315 314 u8 log_max_mcg; 316 - u8 rsvd24; 315 + u8 rsvd23; 317 316 u8 log_max_pd; 318 - u8 rsvd25; 317 + u8 rsvd24; 319 318 u8 log_max_xrcd; 320 - u8 rsvd26[42]; 319 + u8 rsvd25[42]; 321 320 __be16 log_uar_page_sz; 322 - u8 rsvd27[28]; 321 + u8 rsvd26[28]; 323 322 u8 log_msx_atomic_size_qp; 324 - u8 rsvd28[2]; 323 + u8 rsvd27[2]; 325 324 u8 log_msx_atomic_size_dc; 326 - u8 rsvd29[76]; 325 + u8 rsvd28[76]; 327 326 }; 328 327 329 328 ··· 471 472 struct mlx5_eqe_page_req { 472 473 u8 rsvd0[2]; 473 474 __be16 func_id; 474 - u8 rsvd1[2]; 475 - __be16 num_pages; 476 - __be32 rsvd2[5]; 475 + __be32 num_pages; 476 + __be32 rsvd1[5]; 477 477 }; 478 478 479 479 union ev_data {
+2 -5
include/linux/mlx5/driver.h
··· 358 358 u32 reserved_lkey; 359 359 u8 local_ca_ack_delay; 360 360 u8 log_max_mcg; 361 - u16 max_qp_mcg; 361 + u32 max_qp_mcg; 362 362 int min_page_sz; 363 363 }; 364 364 ··· 691 691 int mlx5_pagealloc_start(struct mlx5_core_dev *dev); 692 692 void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); 693 693 void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, 694 - s16 npages); 694 + s32 npages); 695 695 int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); 696 696 int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); 697 697 void mlx5_register_debugfs(void); ··· 731 731 int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db); 732 732 void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db); 733 733 734 - typedef void (*health_handler_t)(struct pci_dev *pdev, struct health_buffer __iomem *buf, int size); 735 - int mlx5_register_health_report_handler(health_handler_t handler); 736 - void mlx5_unregister_health_report_handler(void); 737 734 const char *mlx5_command_str(int command); 738 735 int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); 739 736 void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
+1
include/linux/regmap.h
··· 15 15 16 16 #include <linux/list.h> 17 17 #include <linux/rbtree.h> 18 + #include <linux/err.h> 18 19 19 20 struct module; 20 21 struct device;
+7
include/linux/sched.h
··· 314 314 struct user_namespace; 315 315 316 316 #ifdef CONFIG_MMU 317 + extern unsigned long mmap_legacy_base(void); 317 318 extern void arch_pick_mmap_layout(struct mm_struct *mm); 318 319 extern unsigned long 319 320 arch_get_unmapped_area(struct file *, unsigned long, unsigned long, ··· 1533 1532 * Test if a process is not yet dead (at most zombie state) 1534 1533 * If pid_alive fails, then pointers within the task structure 1535 1534 * can be stale and must not be dereferenced. 1535 + * 1536 + * Return: 1 if the process is alive. 0 otherwise. 1536 1537 */ 1537 1538 static inline int pid_alive(struct task_struct *p) 1538 1539 { ··· 1546 1543 * @tsk: Task structure to be checked. 1547 1544 * 1548 1545 * Check if a task structure is the first user space task the kernel created. 1546 + * 1547 + * Return: 1 if the task structure is init. 0 otherwise. 1549 1548 */ 1550 1549 static inline int is_global_init(struct task_struct *tsk) 1551 1550 { ··· 1899 1894 /** 1900 1895 * is_idle_task - is the specified task an idle task? 1901 1896 * @p: the task in question. 1897 + * 1898 + * Return: 1 if @p is an idle task. 0 otherwise. 1902 1899 */ 1903 1900 static inline bool is_idle_task(const struct task_struct *p) 1904 1901 {
+11 -3
include/linux/spinlock.h
··· 117 117 #endif /*arch_spin_is_contended*/ 118 118 #endif 119 119 120 - /* The lock does not imply full memory barrier. */ 121 - #ifndef ARCH_HAS_SMP_MB_AFTER_LOCK 122 - static inline void smp_mb__after_lock(void) { smp_mb(); } 120 + /* 121 + * Despite its name it doesn't necessarily has to be a full barrier. 122 + * It should only guarantee that a STORE before the critical section 123 + * can not be reordered with a LOAD inside this section. 124 + * spin_lock() is the one-way barrier, this LOAD can not escape out 125 + * of the region. So the default implementation simply ensures that 126 + * a STORE can not move into the critical section, smp_wmb() should 127 + * serialize it with another STORE done by spin_lock(). 128 + */ 129 + #ifndef smp_mb__before_spinlock 130 + #define smp_mb__before_spinlock() smp_wmb() 123 131 #endif 124 132 125 133 /**
+1
include/linux/sunrpc/sched.h
··· 121 121 #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ 122 122 #define RPC_TASK_SENT 0x0800 /* message was sent */ 123 123 #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 124 + #define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ 124 125 125 126 #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 126 127 #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
+2
include/linux/swapops.h
··· 67 67 swp_entry_t arch_entry; 68 68 69 69 BUG_ON(pte_file(pte)); 70 + if (pte_swp_soft_dirty(pte)) 71 + pte = pte_swp_clear_soft_dirty(pte); 70 72 arch_entry = __pte_to_swp_entry(pte); 71 73 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry)); 72 74 }
+5
include/linux/syscalls.h
··· 802 802 asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int, 803 803 int __user *); 804 804 #else 805 + #ifdef CONFIG_CLONE_BACKWARDS3 806 + asmlinkage long sys_clone(unsigned long, unsigned long, int, int __user *, 807 + int __user *, int); 808 + #else 805 809 asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, 806 810 int __user *, int); 811 + #endif 807 812 #endif 808 813 809 814 asmlinkage long sys_execve(const char __user *filename,
+1
include/linux/user_namespace.h
··· 23 23 struct uid_gid_map projid_map; 24 24 atomic_t count; 25 25 struct user_namespace *parent; 26 + int level; 26 27 kuid_t owner; 27 28 kgid_t group; 28 29 unsigned int proc_inum;
+1
include/media/v4l2-ctrls.h
··· 22 22 #define _V4L2_CTRLS_H 23 23 24 24 #include <linux/list.h> 25 + #include <linux/mutex.h> 25 26 #include <linux/videodev2.h> 26 27 27 28 /* forward references */
+1 -6
include/net/busy_poll.h
··· 122 122 if (rc > 0) 123 123 /* local bh are disabled so it is ok to use _BH */ 124 124 NET_ADD_STATS_BH(sock_net(sk), 125 - LINUX_MIB_LOWLATENCYRXPACKETS, rc); 125 + LINUX_MIB_BUSYPOLLRXPACKETS, rc); 126 126 127 127 } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) && 128 128 !need_resched() && !busy_loop_timeout(end_time)); ··· 158 158 } 159 159 160 160 static inline bool sk_can_busy_loop(struct sock *sk) 161 - { 162 - return false; 163 - } 164 - 165 - static inline bool sk_busy_poll(struct sock *sk, int nonblock) 166 161 { 167 162 return false; 168 163 }
-14
include/net/ip_tunnels.h
··· 145 145 return INET_ECN_encapsulate(tos, inner); 146 146 } 147 147 148 - static inline void tunnel_ip_select_ident(struct sk_buff *skb, 149 - const struct iphdr *old_iph, 150 - struct dst_entry *dst) 151 - { 152 - struct iphdr *iph = ip_hdr(skb); 153 - 154 - /* Use inner packet iph-id if possible. */ 155 - if (skb->protocol == htons(ETH_P_IP) && old_iph->id) 156 - iph->id = old_iph->id; 157 - else 158 - __ip_select_ident(iph, dst, 159 - (skb_shinfo(skb)->gso_segs ?: 1) - 1); 160 - } 161 - 162 148 int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); 163 149 int iptunnel_xmit(struct net *net, struct rtable *rt, 164 150 struct sk_buff *skb,
+8 -1
include/net/sch_generic.h
··· 685 685 u64 rate_bytes_ps; /* bytes per second */ 686 686 u32 mult; 687 687 u16 overhead; 688 + u8 linklayer; 688 689 u8 shift; 689 690 }; 690 691 691 692 static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, 692 693 unsigned int len) 693 694 { 694 - return ((u64)(len + r->overhead) * r->mult) >> r->shift; 695 + len += r->overhead; 696 + 697 + if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) 698 + return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; 699 + 700 + return ((u64)len * r->mult) >> r->shift; 695 701 } 696 702 697 703 void psched_ratecfg_precompute(struct psched_ratecfg *r, ··· 709 703 memset(res, 0, sizeof(*res)); 710 704 res->rate = r->rate_bytes_ps; 711 705 res->overhead = r->overhead; 706 + res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); 712 707 } 713 708 714 709 #endif
+9 -1
include/uapi/linux/pkt_sched.h
··· 73 73 #define TC_H_ROOT (0xFFFFFFFFU) 74 74 #define TC_H_INGRESS (0xFFFFFFF1U) 75 75 76 + /* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ 77 + enum tc_link_layer { 78 + TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ 79 + TC_LINKLAYER_ETHERNET, 80 + TC_LINKLAYER_ATM, 81 + }; 82 + #define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ 83 + 76 84 struct tc_ratespec { 77 85 unsigned char cell_log; 78 - unsigned char __reserved; 86 + __u8 linklayer; /* lower 4 bits */ 79 87 unsigned short overhead; 80 88 short cell_align; 81 89 unsigned short mpu;
+1 -1
include/uapi/linux/snmp.h
··· 257 257 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ 258 258 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ 259 259 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ 260 - LINUX_MIB_LOWLATENCYRXPACKETS, /* LowLatencyRxPackets */ 260 + LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */ 261 261 __LINUX_MIB_MAX 262 262 }; 263 263
+3 -1
kernel/cgroup.c
··· 4335 4335 } 4336 4336 4337 4337 err = percpu_ref_init(&css->refcnt, css_release); 4338 - if (err) 4338 + if (err) { 4339 + ss->css_free(cgrp); 4339 4340 goto err_free_all; 4341 + } 4340 4342 4341 4343 init_cgroup_css(css, ss, cgrp); 4342 4344
+6
kernel/fork.c
··· 1679 1679 int __user *, parent_tidptr, 1680 1680 int __user *, child_tidptr, 1681 1681 int, tls_val) 1682 + #elif defined(CONFIG_CLONE_BACKWARDS3) 1683 + SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp, 1684 + int, stack_size, 1685 + int __user *, parent_tidptr, 1686 + int __user *, child_tidptr, 1687 + int, tls_val) 1682 1688 #else 1683 1689 SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, 1684 1690 int __user *, parent_tidptr,
+2 -2
kernel/mutex.c
··· 686 686 might_sleep(); 687 687 ret = __mutex_lock_common(&lock->base, TASK_UNINTERRUPTIBLE, 688 688 0, &ctx->dep_map, _RET_IP_, ctx); 689 - if (!ret && ctx->acquired > 0) 689 + if (!ret && ctx->acquired > 1) 690 690 return ww_mutex_deadlock_injection(lock, ctx); 691 691 692 692 return ret; ··· 702 702 ret = __mutex_lock_common(&lock->base, TASK_INTERRUPTIBLE, 703 703 0, &ctx->dep_map, _RET_IP_, ctx); 704 704 705 - if (!ret && ctx->acquired > 0) 705 + if (!ret && ctx->acquired > 1) 706 706 return ww_mutex_deadlock_injection(lock, ctx); 707 707 708 708 return ret;
+13 -7
kernel/power/qos.c
··· 296 296 } 297 297 EXPORT_SYMBOL_GPL(pm_qos_request_active); 298 298 299 + static void __pm_qos_update_request(struct pm_qos_request *req, 300 + s32 new_value) 301 + { 302 + trace_pm_qos_update_request(req->pm_qos_class, new_value); 303 + 304 + if (new_value != req->node.prio) 305 + pm_qos_update_target( 306 + pm_qos_array[req->pm_qos_class]->constraints, 307 + &req->node, PM_QOS_UPDATE_REQ, new_value); 308 + } 309 + 299 310 /** 300 311 * pm_qos_work_fn - the timeout handler of pm_qos_update_request_timeout 301 312 * @work: work struct for the delayed work (timeout) ··· 319 308 struct pm_qos_request, 320 309 work); 321 310 322 - pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE); 311 + __pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE); 323 312 } 324 313 325 314 /** ··· 375 364 } 376 365 377 366 cancel_delayed_work_sync(&req->work); 378 - 379 - trace_pm_qos_update_request(req->pm_qos_class, new_value); 380 - if (new_value != req->node.prio) 381 - pm_qos_update_target( 382 - pm_qos_array[req->pm_qos_class]->constraints, 383 - &req->node, PM_QOS_UPDATE_REQ, new_value); 367 + __pm_qos_update_request(req, new_value); 384 368 } 385 369 EXPORT_SYMBOL_GPL(pm_qos_update_request); 386 370
+2 -1
kernel/printk/braille.c
··· 19 19 pr_err("need port name after brl=\n"); 20 20 else 21 21 *((*str)++) = 0; 22 - } 22 + } else 23 + return NULL; 23 24 24 25 return *str; 25 26 }
-1
kernel/ptrace.c
··· 469 469 /* Architecture-specific hardware disable .. */ 470 470 ptrace_disable(child); 471 471 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 472 - flush_ptrace_hw_breakpoint(child); 473 472 474 473 write_lock_irq(&tasklist_lock); 475 474 /*
+74 -22
kernel/sched/core.c
··· 933 933 /** 934 934 * task_curr - is this task currently executing on a CPU? 935 935 * @p: the task in question. 936 + * 937 + * Return: 1 if the task is currently executing. 0 otherwise. 936 938 */ 937 939 inline int task_curr(const struct task_struct *p) 938 940 { ··· 1484 1482 * the simpler "current->state = TASK_RUNNING" to mark yourself 1485 1483 * runnable without the overhead of this. 1486 1484 * 1487 - * Returns %true if @p was woken up, %false if it was already running 1485 + * Return: %true if @p was woken up, %false if it was already running. 1488 1486 * or @state didn't match @p's state. 1489 1487 */ 1490 1488 static int ··· 1493 1491 unsigned long flags; 1494 1492 int cpu, success = 0; 1495 1493 1496 - smp_wmb(); 1494 + /* 1495 + * If we are going to wake up a thread waiting for CONDITION we 1496 + * need to ensure that CONDITION=1 done by the caller can not be 1497 + * reordered with p->state check below. This pairs with mb() in 1498 + * set_current_state() the waiting thread does. 1499 + */ 1500 + smp_mb__before_spinlock(); 1497 1501 raw_spin_lock_irqsave(&p->pi_lock, flags); 1498 1502 if (!(p->state & state)) 1499 1503 goto out; ··· 1585 1577 * @p: The process to be woken up. 1586 1578 * 1587 1579 * Attempt to wake up the nominated process and move it to the set of runnable 1588 - * processes. Returns 1 if the process was woken up, 0 if it was already 1589 - * running. 1580 + * processes. 1581 + * 1582 + * Return: 1 if the process was woken up, 0 if it was already running. 1590 1583 * 1591 1584 * It may be assumed that this function implies a write memory barrier before 1592 1585 * changing the task state if and only if any tasks are woken up. ··· 2200 2191 * This makes sure that uptime, CFS vruntime, load 2201 2192 * balancing, etc... continue to move forward, even 2202 2193 * with a very low granularity. 2194 + * 2195 + * Return: Maximum deferment in nanoseconds. 2203 2196 */ 2204 2197 u64 scheduler_tick_max_deferment(void) 2205 2198 { ··· 2405 2394 if (sched_feat(HRTICK)) 2406 2395 hrtick_clear(rq); 2407 2396 2397 + /* 2398 + * Make sure that signal_pending_state()->signal_pending() below 2399 + * can't be reordered with __set_current_state(TASK_INTERRUPTIBLE) 2400 + * done by the caller to avoid the race with signal_wake_up(). 2401 + */ 2402 + smp_mb__before_spinlock(); 2408 2403 raw_spin_lock_irq(&rq->lock); 2409 2404 2410 2405 switch_count = &prev->nivcsw; ··· 2813 2796 * specified timeout to expire. The timeout is in jiffies. It is not 2814 2797 * interruptible. 2815 2798 * 2816 - * The return value is 0 if timed out, and positive (at least 1, or number of 2817 - * jiffies left till timeout) if completed. 2799 + * Return: 0 if timed out, and positive (at least 1, or number of jiffies left 2800 + * till timeout) if completed. 2818 2801 */ 2819 2802 unsigned long __sched 2820 2803 wait_for_completion_timeout(struct completion *x, unsigned long timeout) ··· 2846 2829 * specified timeout to expire. The timeout is in jiffies. It is not 2847 2830 * interruptible. The caller is accounted as waiting for IO. 2848 2831 * 2849 - * The return value is 0 if timed out, and positive (at least 1, or number of 2850 - * jiffies left till timeout) if completed. 2832 + * Return: 0 if timed out, and positive (at least 1, or number of jiffies left 2833 + * till timeout) if completed. 2851 2834 */ 2852 2835 unsigned long __sched 2853 2836 wait_for_completion_io_timeout(struct completion *x, unsigned long timeout) ··· 2863 2846 * This waits for completion of a specific task to be signaled. It is 2864 2847 * interruptible. 2865 2848 * 2866 - * The return value is -ERESTARTSYS if interrupted, 0 if completed. 2849 + * Return: -ERESTARTSYS if interrupted, 0 if completed. 2867 2850 */ 2868 2851 int __sched wait_for_completion_interruptible(struct completion *x) 2869 2852 { ··· 2882 2865 * This waits for either a completion of a specific task to be signaled or for a 2883 2866 * specified timeout to expire. It is interruptible. The timeout is in jiffies. 2884 2867 * 2885 - * The return value is -ERESTARTSYS if interrupted, 0 if timed out, 2886 - * positive (at least 1, or number of jiffies left till timeout) if completed. 2868 + * Return: -ERESTARTSYS if interrupted, 0 if timed out, positive (at least 1, 2869 + * or number of jiffies left till timeout) if completed. 2887 2870 */ 2888 2871 long __sched 2889 2872 wait_for_completion_interruptible_timeout(struct completion *x, ··· 2900 2883 * This waits to be signaled for completion of a specific task. It can be 2901 2884 * interrupted by a kill signal. 2902 2885 * 2903 - * The return value is -ERESTARTSYS if interrupted, 0 if completed. 2886 + * Return: -ERESTARTSYS if interrupted, 0 if completed. 2904 2887 */ 2905 2888 int __sched wait_for_completion_killable(struct completion *x) 2906 2889 { ··· 2920 2903 * signaled or for a specified timeout to expire. It can be 2921 2904 * interrupted by a kill signal. The timeout is in jiffies. 2922 2905 * 2923 - * The return value is -ERESTARTSYS if interrupted, 0 if timed out, 2924 - * positive (at least 1, or number of jiffies left till timeout) if completed. 2906 + * Return: -ERESTARTSYS if interrupted, 0 if timed out, positive (at least 1, 2907 + * or number of jiffies left till timeout) if completed. 2925 2908 */ 2926 2909 long __sched 2927 2910 wait_for_completion_killable_timeout(struct completion *x, ··· 2935 2918 * try_wait_for_completion - try to decrement a completion without blocking 2936 2919 * @x: completion structure 2937 2920 * 2938 - * Returns: 0 if a decrement cannot be done without blocking 2921 + * Return: 0 if a decrement cannot be done without blocking 2939 2922 * 1 if a decrement succeeded. 2940 2923 * 2941 2924 * If a completion is being used as a counting completion, ··· 2962 2945 * completion_done - Test to see if a completion has any waiters 2963 2946 * @x: completion structure 2964 2947 * 2965 - * Returns: 0 if there are waiters (wait_for_completion() in progress) 2948 + * Return: 0 if there are waiters (wait_for_completion() in progress) 2966 2949 * 1 if there are no waiters. 2967 2950 * 2968 2951 */ ··· 3199 3182 * task_prio - return the priority value of a given task. 3200 3183 * @p: the task in question. 3201 3184 * 3202 - * This is the priority value as seen by users in /proc. 3185 + * Return: The priority value as seen by users in /proc. 3203 3186 * RT tasks are offset by -200. Normal tasks are centered 3204 3187 * around 0, value goes from -16 to +15. 3205 3188 */ ··· 3211 3194 /** 3212 3195 * task_nice - return the nice value of a given task. 3213 3196 * @p: the task in question. 3197 + * 3198 + * Return: The nice value [ -20 ... 0 ... 19 ]. 3214 3199 */ 3215 3200 int task_nice(const struct task_struct *p) 3216 3201 { ··· 3223 3204 /** 3224 3205 * idle_cpu - is a given cpu idle currently? 3225 3206 * @cpu: the processor in question. 3207 + * 3208 + * Return: 1 if the CPU is currently idle. 0 otherwise. 3226 3209 */ 3227 3210 int idle_cpu(int cpu) 3228 3211 { ··· 3247 3226 /** 3248 3227 * idle_task - return the idle task for a given cpu. 3249 3228 * @cpu: the processor in question. 3229 + * 3230 + * Return: The idle task for the cpu @cpu. 3250 3231 */ 3251 3232 struct task_struct *idle_task(int cpu) 3252 3233 { ··· 3258 3235 /** 3259 3236 * find_process_by_pid - find a process with a matching PID value. 3260 3237 * @pid: the pid in question. 3238 + * 3239 + * The task of @pid, if found. %NULL otherwise. 3261 3240 */ 3262 3241 static struct task_struct *find_process_by_pid(pid_t pid) 3263 3242 { ··· 3457 3432 * @policy: new policy. 3458 3433 * @param: structure containing the new RT priority. 3459 3434 * 3435 + * Return: 0 on success. An error code otherwise. 3436 + * 3460 3437 * NOTE that the task may be already dead. 3461 3438 */ 3462 3439 int sched_setscheduler(struct task_struct *p, int policy, ··· 3478 3451 * current context has permission. For example, this is needed in 3479 3452 * stop_machine(): we create temporary high priority worker threads, 3480 3453 * but our caller might not have that capability. 3454 + * 3455 + * Return: 0 on success. An error code otherwise. 3481 3456 */ 3482 3457 int sched_setscheduler_nocheck(struct task_struct *p, int policy, 3483 3458 const struct sched_param *param) ··· 3514 3485 * @pid: the pid in question. 3515 3486 * @policy: new policy. 3516 3487 * @param: structure containing the new RT priority. 3488 + * 3489 + * Return: 0 on success. An error code otherwise. 3517 3490 */ 3518 3491 SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy, 3519 3492 struct sched_param __user *, param) ··· 3531 3500 * sys_sched_setparam - set/change the RT priority of a thread 3532 3501 * @pid: the pid in question. 3533 3502 * @param: structure containing the new RT priority. 3503 + * 3504 + * Return: 0 on success. An error code otherwise. 3534 3505 */ 3535 3506 SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param) 3536 3507 { ··· 3542 3509 /** 3543 3510 * sys_sched_getscheduler - get the policy (scheduling class) of a thread 3544 3511 * @pid: the pid in question. 3512 + * 3513 + * Return: On success, the policy of the thread. Otherwise, a negative error 3514 + * code. 3545 3515 */ 3546 3516 SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid) 3547 3517 { ··· 3571 3535 * sys_sched_getparam - get the RT priority of a thread 3572 3536 * @pid: the pid in question. 3573 3537 * @param: structure containing the RT priority. 3538 + * 3539 + * Return: On success, 0 and the RT priority is in @param. Otherwise, an error 3540 + * code. 3574 3541 */ 3575 3542 SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param) 3576 3543 { ··· 3698 3659 * @pid: pid of the process 3699 3660 * @len: length in bytes of the bitmask pointed to by user_mask_ptr 3700 3661 * @user_mask_ptr: user-space pointer to the new cpu mask 3662 + * 3663 + * Return: 0 on success. An error code otherwise. 3701 3664 */ 3702 3665 SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len, 3703 3666 unsigned long __user *, user_mask_ptr) ··· 3751 3710 * @pid: pid of the process 3752 3711 * @len: length in bytes of the bitmask pointed to by user_mask_ptr 3753 3712 * @user_mask_ptr: user-space pointer to hold the current cpu mask 3713 + * 3714 + * Return: 0 on success. An error code otherwise. 3754 3715 */ 3755 3716 SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len, 3756 3717 unsigned long __user *, user_mask_ptr) ··· 3787 3744 * 3788 3745 * This function yields the current CPU to other tasks. If there are no 3789 3746 * other threads running on this CPU then this function will return. 3747 + * 3748 + * Return: 0. 3790 3749 */ 3791 3750 SYSCALL_DEFINE0(sched_yield) 3792 3751 { ··· 3914 3869 * It's the caller's job to ensure that the target task struct 3915 3870 * can't go away on us before we can do any checks. 3916 3871 * 3917 - * Returns: 3872 + * Return: 3918 3873 * true (>0) if we indeed boosted the target task. 3919 3874 * false (0) if we failed to boost the target. 3920 3875 * -ESRCH if there's no task to yield to. ··· 4017 3972 * sys_sched_get_priority_max - return maximum RT priority. 4018 3973 * @policy: scheduling class. 4019 3974 * 4020 - * this syscall returns the maximum rt_priority that can be used 4021 - * by a given scheduling class. 3975 + * Return: On success, this syscall returns the maximum 3976 + * rt_priority that can be used by a given scheduling class. 3977 + * On failure, a negative error code is returned. 4022 3978 */ 4023 3979 SYSCALL_DEFINE1(sched_get_priority_max, int, policy) 4024 3980 { ··· 4043 3997 * sys_sched_get_priority_min - return minimum RT priority. 4044 3998 * @policy: scheduling class. 4045 3999 * 4046 - * this syscall returns the minimum rt_priority that can be used 4047 - * by a given scheduling class. 4000 + * Return: On success, this syscall returns the minimum 4001 + * rt_priority that can be used by a given scheduling class. 4002 + * On failure, a negative error code is returned. 4048 4003 */ 4049 4004 SYSCALL_DEFINE1(sched_get_priority_min, int, policy) 4050 4005 { ··· 4071 4024 * 4072 4025 * this syscall writes the default timeslice value of a given process 4073 4026 * into the user-space timespec buffer. A value of '0' means infinity. 4027 + * 4028 + * Return: On success, 0 and the timeslice is in @interval. Otherwise, 4029 + * an error code. 4074 4030 */ 4075 4031 SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, 4076 4032 struct timespec __user *, interval) ··· 6682 6632 * @cpu: the processor in question. 6683 6633 * 6684 6634 * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED! 6635 + * 6636 + * Return: The current task for @cpu. 6685 6637 */ 6686 6638 struct task_struct *curr_task(int cpu) 6687 6639 {
+2 -2
kernel/sched/cpupri.c
··· 62 62 * any discrepancies created by racing against the uncertainty of the current 63 63 * priority configuration. 64 64 * 65 - * Returns: (int)bool - CPUs were found 65 + * Return: (int)bool - CPUs were found 66 66 */ 67 67 int cpupri_find(struct cpupri *cp, struct task_struct *p, 68 68 struct cpumask *lowest_mask) ··· 203 203 * cpupri_init - initialize the cpupri structure 204 204 * @cp: The cpupri context 205 205 * 206 - * Returns: -ENOMEM if memory fails. 206 + * Return: -ENOMEM on memory allocation failure. 207 207 */ 208 208 int cpupri_init(struct cpupri *cp) 209 209 {
+8 -2
kernel/sched/fair.c
··· 2032 2032 */ 2033 2033 update_entity_load_avg(curr, 1); 2034 2034 update_cfs_rq_blocked_load(cfs_rq, 1); 2035 + update_cfs_shares(cfs_rq); 2035 2036 2036 2037 #ifdef CONFIG_SCHED_HRTICK 2037 2038 /* ··· 4281 4280 * get_sd_load_idx - Obtain the load index for a given sched domain. 4282 4281 * @sd: The sched_domain whose load_idx is to be obtained. 4283 4282 * @idle: The Idle status of the CPU for whose sd load_icx is obtained. 4283 + * 4284 + * Return: The load index. 4284 4285 */ 4285 4286 static inline int get_sd_load_idx(struct sched_domain *sd, 4286 4287 enum cpu_idle_type idle) ··· 4577 4574 * 4578 4575 * Determine if @sg is a busier group than the previously selected 4579 4576 * busiest group. 4577 + * 4578 + * Return: %true if @sg is a busier group than the previously selected 4579 + * busiest group. %false otherwise. 4580 4580 */ 4581 4581 static bool update_sd_pick_busiest(struct lb_env *env, 4582 4582 struct sd_lb_stats *sds, ··· 4697 4691 * assuming lower CPU number will be equivalent to lower a SMT thread 4698 4692 * number. 4699 4693 * 4700 - * Returns 1 when packing is required and a task should be moved to 4694 + * Return: 1 when packing is required and a task should be moved to 4701 4695 * this CPU. The amount of the imbalance is returned in *imbalance. 4702 4696 * 4703 4697 * @env: The load balancing environment. ··· 4875 4869 * @balance: Pointer to a variable indicating if this_cpu 4876 4870 * is the appropriate cpu to perform load balancing at this_level. 4877 4871 * 4878 - * Returns: - the busiest group if imbalance exists. 4872 + * Return: - The busiest group if imbalance exists. 4879 4873 * - If no imbalance and user has opted for power-savings balance, 4880 4874 * return the least loaded group whose CPUs can be 4881 4875 * put to idle by rebalancing its tasks onto our group.
+72 -15
kernel/trace/ftrace.c
··· 2169 2169 static unsigned long ftrace_update_cnt; 2170 2170 unsigned long ftrace_update_tot_cnt; 2171 2171 2172 - static int ops_traces_mod(struct ftrace_ops *ops) 2172 + static inline int ops_traces_mod(struct ftrace_ops *ops) 2173 2173 { 2174 - struct ftrace_hash *hash; 2174 + /* 2175 + * Filter_hash being empty will default to trace module. 2176 + * But notrace hash requires a test of individual module functions. 2177 + */ 2178 + return ftrace_hash_empty(ops->filter_hash) && 2179 + ftrace_hash_empty(ops->notrace_hash); 2180 + } 2175 2181 2176 - hash = ops->filter_hash; 2177 - return ftrace_hash_empty(hash); 2182 + /* 2183 + * Check if the current ops references the record. 2184 + * 2185 + * If the ops traces all functions, then it was already accounted for. 2186 + * If the ops does not trace the current record function, skip it. 2187 + * If the ops ignores the function via notrace filter, skip it. 2188 + */ 2189 + static inline bool 2190 + ops_references_rec(struct ftrace_ops *ops, struct dyn_ftrace *rec) 2191 + { 2192 + /* If ops isn't enabled, ignore it */ 2193 + if (!(ops->flags & FTRACE_OPS_FL_ENABLED)) 2194 + return 0; 2195 + 2196 + /* If ops traces all mods, we already accounted for it */ 2197 + if (ops_traces_mod(ops)) 2198 + return 0; 2199 + 2200 + /* The function must be in the filter */ 2201 + if (!ftrace_hash_empty(ops->filter_hash) && 2202 + !ftrace_lookup_ip(ops->filter_hash, rec->ip)) 2203 + return 0; 2204 + 2205 + /* If in notrace hash, we ignore it too */ 2206 + if (ftrace_lookup_ip(ops->notrace_hash, rec->ip)) 2207 + return 0; 2208 + 2209 + return 1; 2210 + } 2211 + 2212 + static int referenced_filters(struct dyn_ftrace *rec) 2213 + { 2214 + struct ftrace_ops *ops; 2215 + int cnt = 0; 2216 + 2217 + for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { 2218 + if (ops_references_rec(ops, rec)) 2219 + cnt++; 2220 + } 2221 + 2222 + return cnt; 2178 2223 } 2179 2224 2180 2225 static int ftrace_update_code(struct module *mod) ··· 2228 2183 struct dyn_ftrace *p; 2229 2184 cycle_t start, stop; 2230 2185 unsigned long ref = 0; 2186 + bool test = false; 2231 2187 int i; 2232 2188 2233 2189 /* ··· 2242 2196 2243 2197 for (ops = ftrace_ops_list; 2244 2198 ops != &ftrace_list_end; ops = ops->next) { 2245 - if (ops->flags & FTRACE_OPS_FL_ENABLED && 2246 - ops_traces_mod(ops)) 2247 - ref++; 2199 + if (ops->flags & FTRACE_OPS_FL_ENABLED) { 2200 + if (ops_traces_mod(ops)) 2201 + ref++; 2202 + else 2203 + test = true; 2204 + } 2248 2205 } 2249 2206 } 2250 2207 ··· 2257 2208 for (pg = ftrace_new_pgs; pg; pg = pg->next) { 2258 2209 2259 2210 for (i = 0; i < pg->index; i++) { 2211 + int cnt = ref; 2212 + 2260 2213 /* If something went wrong, bail without enabling anything */ 2261 2214 if (unlikely(ftrace_disabled)) 2262 2215 return -1; 2263 2216 2264 2217 p = &pg->records[i]; 2265 - p->flags = ref; 2218 + if (test) 2219 + cnt += referenced_filters(p); 2220 + p->flags = cnt; 2266 2221 2267 2222 /* 2268 2223 * Do the initial record conversion from mcount jump ··· 2286 2233 * conversion puts the module to the correct state, thus 2287 2234 * passing the ftrace_make_call check. 2288 2235 */ 2289 - if (ftrace_start_up && ref) { 2236 + if (ftrace_start_up && cnt) { 2290 2237 int failed = __ftrace_replace_code(p, 1); 2291 2238 if (failed) 2292 2239 ftrace_bug(failed, p->ip); ··· 3437 3384 return add_hash_entry(hash, ip); 3438 3385 } 3439 3386 3387 + static void ftrace_ops_update_code(struct ftrace_ops *ops) 3388 + { 3389 + if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled) 3390 + ftrace_run_update_code(FTRACE_UPDATE_CALLS); 3391 + } 3392 + 3440 3393 static int 3441 3394 ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, 3442 3395 unsigned long ip, int remove, int reset, int enable) ··· 3485 3426 3486 3427 mutex_lock(&ftrace_lock); 3487 3428 ret = ftrace_hash_move(ops, enable, orig_hash, hash); 3488 - if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED 3489 - && ftrace_enabled) 3490 - ftrace_run_update_code(FTRACE_UPDATE_CALLS); 3429 + if (!ret) 3430 + ftrace_ops_update_code(ops); 3491 3431 3492 3432 mutex_unlock(&ftrace_lock); 3493 3433 ··· 3713 3655 mutex_lock(&ftrace_lock); 3714 3656 ret = ftrace_hash_move(iter->ops, filter_hash, 3715 3657 orig_hash, iter->hash); 3716 - if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED) 3717 - && ftrace_enabled) 3718 - ftrace_run_update_code(FTRACE_UPDATE_CALLS); 3658 + if (!ret) 3659 + ftrace_ops_update_code(iter->ops); 3719 3660 3720 3661 mutex_unlock(&ftrace_lock); 3721 3662 }
+14 -13
kernel/trace/trace.c
··· 243 243 } 244 244 EXPORT_SYMBOL_GPL(filter_current_check_discard); 245 245 246 - cycle_t ftrace_now(int cpu) 246 + cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu) 247 247 { 248 248 u64 ts; 249 249 250 250 /* Early boot up does not have a buffer yet */ 251 - if (!global_trace.trace_buffer.buffer) 251 + if (!buf->buffer) 252 252 return trace_clock_local(); 253 253 254 - ts = ring_buffer_time_stamp(global_trace.trace_buffer.buffer, cpu); 255 - ring_buffer_normalize_time_stamp(global_trace.trace_buffer.buffer, cpu, &ts); 254 + ts = ring_buffer_time_stamp(buf->buffer, cpu); 255 + ring_buffer_normalize_time_stamp(buf->buffer, cpu, &ts); 256 256 257 257 return ts; 258 + } 259 + 260 + cycle_t ftrace_now(int cpu) 261 + { 262 + return buffer_ftrace_now(&global_trace.trace_buffer, cpu); 258 263 } 259 264 260 265 /** ··· 1216 1211 /* Make sure all commits have finished */ 1217 1212 synchronize_sched(); 1218 1213 1219 - buf->time_start = ftrace_now(buf->cpu); 1214 + buf->time_start = buffer_ftrace_now(buf, buf->cpu); 1220 1215 1221 1216 for_each_online_cpu(cpu) 1222 1217 ring_buffer_reset_cpu(buffer, cpu); 1223 1218 1224 1219 ring_buffer_record_enable(buffer); 1225 - } 1226 - 1227 - void tracing_reset_current(int cpu) 1228 - { 1229 - tracing_reset(&global_trace.trace_buffer, cpu); 1230 1220 } 1231 1221 1232 1222 /* Must have trace_types_lock held */ ··· 4151 4151 memset(&iter->seq, 0, 4152 4152 sizeof(struct trace_iterator) - 4153 4153 offsetof(struct trace_iterator, seq)); 4154 + cpumask_clear(iter->started); 4154 4155 iter->pos = -1; 4155 4156 4156 4157 trace_event_read_lock(); ··· 4469 4468 4470 4469 /* disable tracing ? */ 4471 4470 if (trace_flags & TRACE_ITER_STOP_ON_FREE) 4472 - tracing_off(); 4471 + tracer_tracing_off(tr); 4473 4472 /* resize the ring buffer to 0 */ 4474 4473 tracing_resize_ring_buffer(tr, 0, RING_BUFFER_ALL_CPUS); 4475 4474 ··· 4634 4633 * New clock may not be consistent with the previous clock. 4635 4634 * Reset the buffer so that it doesn't have incomparable timestamps. 4636 4635 */ 4637 - tracing_reset_online_cpus(&global_trace.trace_buffer); 4636 + tracing_reset_online_cpus(&tr->trace_buffer); 4638 4637 4639 4638 #ifdef CONFIG_TRACER_MAX_TRACE 4640 4639 if (tr->flags & TRACE_ARRAY_FL_GLOBAL && tr->max_buffer.buffer) 4641 4640 ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func); 4642 - tracing_reset_online_cpus(&global_trace.max_buffer); 4641 + tracing_reset_online_cpus(&tr->max_buffer); 4643 4642 #endif 4644 4643 4645 4644 mutex_unlock(&trace_types_lock);
+129 -75
kernel/trace/trace_events.c
··· 409 409 mutex_unlock(&event_mutex); 410 410 } 411 411 412 - /* 413 - * Open and update trace_array ref count. 414 - * Must have the current trace_array passed to it. 415 - */ 416 - static int tracing_open_generic_file(struct inode *inode, struct file *filp) 412 + static void remove_subsystem(struct ftrace_subsystem_dir *dir) 417 413 { 418 - struct ftrace_event_file *file = inode->i_private; 419 - struct trace_array *tr = file->tr; 420 - int ret; 414 + if (!dir) 415 + return; 421 416 422 - if (trace_array_get(tr) < 0) 423 - return -ENODEV; 424 - 425 - ret = tracing_open_generic(inode, filp); 426 - if (ret < 0) 427 - trace_array_put(tr); 428 - return ret; 417 + if (!--dir->nr_events) { 418 + debugfs_remove_recursive(dir->entry); 419 + list_del(&dir->list); 420 + __put_system_dir(dir); 421 + } 429 422 } 430 423 431 - static int tracing_release_generic_file(struct inode *inode, struct file *filp) 424 + static void *event_file_data(struct file *filp) 432 425 { 433 - struct ftrace_event_file *file = inode->i_private; 434 - struct trace_array *tr = file->tr; 426 + return ACCESS_ONCE(file_inode(filp)->i_private); 427 + } 435 428 436 - trace_array_put(tr); 429 + static void remove_event_file_dir(struct ftrace_event_file *file) 430 + { 431 + struct dentry *dir = file->dir; 432 + struct dentry *child; 437 433 438 - return 0; 434 + if (dir) { 435 + spin_lock(&dir->d_lock); /* probably unneeded */ 436 + list_for_each_entry(child, &dir->d_subdirs, d_u.d_child) { 437 + if (child->d_inode) /* probably unneeded */ 438 + child->d_inode->i_private = NULL; 439 + } 440 + spin_unlock(&dir->d_lock); 441 + 442 + debugfs_remove_recursive(dir); 443 + } 444 + 445 + list_del(&file->list); 446 + remove_subsystem(file->system); 447 + kmem_cache_free(file_cachep, file); 439 448 } 440 449 441 450 /* ··· 688 679 event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, 689 680 loff_t *ppos) 690 681 { 691 - struct ftrace_event_file *file = filp->private_data; 682 + struct ftrace_event_file *file; 683 + unsigned long flags; 692 684 char buf[4] = "0"; 693 685 694 - if (file->flags & FTRACE_EVENT_FL_ENABLED && 695 - !(file->flags & FTRACE_EVENT_FL_SOFT_DISABLED)) 686 + mutex_lock(&event_mutex); 687 + file = event_file_data(filp); 688 + if (likely(file)) 689 + flags = file->flags; 690 + mutex_unlock(&event_mutex); 691 + 692 + if (!file) 693 + return -ENODEV; 694 + 695 + if (flags & FTRACE_EVENT_FL_ENABLED && 696 + !(flags & FTRACE_EVENT_FL_SOFT_DISABLED)) 696 697 strcpy(buf, "1"); 697 698 698 - if (file->flags & FTRACE_EVENT_FL_SOFT_DISABLED || 699 - file->flags & FTRACE_EVENT_FL_SOFT_MODE) 699 + if (flags & FTRACE_EVENT_FL_SOFT_DISABLED || 700 + flags & FTRACE_EVENT_FL_SOFT_MODE) 700 701 strcat(buf, "*"); 701 702 702 703 strcat(buf, "\n"); ··· 718 699 event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, 719 700 loff_t *ppos) 720 701 { 721 - struct ftrace_event_file *file = filp->private_data; 702 + struct ftrace_event_file *file; 722 703 unsigned long val; 723 704 int ret; 724 - 725 - if (!file) 726 - return -EINVAL; 727 705 728 706 ret = kstrtoul_from_user(ubuf, cnt, 10, &val); 729 707 if (ret) ··· 733 717 switch (val) { 734 718 case 0: 735 719 case 1: 720 + ret = -ENODEV; 736 721 mutex_lock(&event_mutex); 737 - ret = ftrace_event_enable_disable(file, val); 722 + file = event_file_data(filp); 723 + if (likely(file)) 724 + ret = ftrace_event_enable_disable(file, val); 738 725 mutex_unlock(&event_mutex); 739 726 break; 740 727 ··· 844 825 845 826 static void *f_next(struct seq_file *m, void *v, loff_t *pos) 846 827 { 847 - struct ftrace_event_call *call = m->private; 828 + struct ftrace_event_call *call = event_file_data(m->private); 848 829 struct list_head *common_head = &ftrace_common_fields; 849 830 struct list_head *head = trace_get_fields(call); 850 831 struct list_head *node = v; ··· 876 857 877 858 static int f_show(struct seq_file *m, void *v) 878 859 { 879 - struct ftrace_event_call *call = m->private; 860 + struct ftrace_event_call *call = event_file_data(m->private); 880 861 struct ftrace_event_field *field; 881 862 const char *array_descriptor; 882 863 ··· 929 910 void *p = (void *)FORMAT_HEADER; 930 911 loff_t l = 0; 931 912 913 + /* ->stop() is called even if ->start() fails */ 914 + mutex_lock(&event_mutex); 915 + if (!event_file_data(m->private)) 916 + return ERR_PTR(-ENODEV); 917 + 932 918 while (l < *pos && p) 933 919 p = f_next(m, p, &l); 934 920 ··· 942 918 943 919 static void f_stop(struct seq_file *m, void *p) 944 920 { 921 + mutex_unlock(&event_mutex); 945 922 } 946 923 947 924 static const struct seq_operations trace_format_seq_ops = { ··· 954 929 955 930 static int trace_format_open(struct inode *inode, struct file *file) 956 931 { 957 - struct ftrace_event_call *call = inode->i_private; 958 932 struct seq_file *m; 959 933 int ret; 960 934 ··· 962 938 return ret; 963 939 964 940 m = file->private_data; 965 - m->private = call; 941 + m->private = file; 966 942 967 943 return 0; 968 944 } ··· 970 946 static ssize_t 971 947 event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) 972 948 { 973 - struct ftrace_event_call *call = filp->private_data; 949 + int id = (long)event_file_data(filp); 974 950 char buf[32]; 975 951 int len; 976 952 977 953 if (*ppos) 978 954 return 0; 979 955 980 - len = sprintf(buf, "%d\n", call->event.type); 956 + if (unlikely(!id)) 957 + return -ENODEV; 958 + 959 + len = sprintf(buf, "%d\n", id); 960 + 981 961 return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); 982 962 } 983 963 ··· 989 961 event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, 990 962 loff_t *ppos) 991 963 { 992 - struct ftrace_event_call *call = filp->private_data; 964 + struct ftrace_event_call *call; 993 965 struct trace_seq *s; 994 - int r; 966 + int r = -ENODEV; 995 967 996 968 if (*ppos) 997 969 return 0; 998 970 999 971 s = kmalloc(sizeof(*s), GFP_KERNEL); 972 + 1000 973 if (!s) 1001 974 return -ENOMEM; 1002 975 1003 976 trace_seq_init(s); 1004 977 1005 - print_event_filter(call, s); 1006 - r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len); 978 + mutex_lock(&event_mutex); 979 + call = event_file_data(filp); 980 + if (call) 981 + print_event_filter(call, s); 982 + mutex_unlock(&event_mutex); 983 + 984 + if (call) 985 + r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len); 1007 986 1008 987 kfree(s); 1009 988 ··· 1021 986 event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, 1022 987 loff_t *ppos) 1023 988 { 1024 - struct ftrace_event_call *call = filp->private_data; 989 + struct ftrace_event_call *call; 1025 990 char *buf; 1026 - int err; 991 + int err = -ENODEV; 1027 992 1028 993 if (cnt >= PAGE_SIZE) 1029 994 return -EINVAL; ··· 1038 1003 } 1039 1004 buf[cnt] = '\0'; 1040 1005 1041 - err = apply_event_filter(call, buf); 1006 + mutex_lock(&event_mutex); 1007 + call = event_file_data(filp); 1008 + if (call) 1009 + err = apply_event_filter(call, buf); 1010 + mutex_unlock(&event_mutex); 1011 + 1042 1012 free_page((unsigned long) buf); 1043 1013 if (err < 0) 1044 1014 return err; ··· 1265 1225 }; 1266 1226 1267 1227 static const struct file_operations ftrace_enable_fops = { 1268 - .open = tracing_open_generic_file, 1228 + .open = tracing_open_generic, 1269 1229 .read = event_enable_read, 1270 1230 .write = event_enable_write, 1271 - .release = tracing_release_generic_file, 1272 1231 .llseek = default_llseek, 1273 1232 }; 1274 1233 ··· 1279 1240 }; 1280 1241 1281 1242 static const struct file_operations ftrace_event_id_fops = { 1282 - .open = tracing_open_generic, 1283 1243 .read = event_id_read, 1284 1244 .llseek = default_llseek, 1285 1245 }; ··· 1526 1488 1527 1489 #ifdef CONFIG_PERF_EVENTS 1528 1490 if (call->event.type && call->class->reg) 1529 - trace_create_file("id", 0444, file->dir, call, 1530 - id); 1491 + trace_create_file("id", 0444, file->dir, 1492 + (void *)(long)call->event.type, id); 1531 1493 #endif 1532 1494 1533 1495 /* ··· 1552 1514 return 0; 1553 1515 } 1554 1516 1555 - static void remove_subsystem(struct ftrace_subsystem_dir *dir) 1556 - { 1557 - if (!dir) 1558 - return; 1559 - 1560 - if (!--dir->nr_events) { 1561 - debugfs_remove_recursive(dir->entry); 1562 - list_del(&dir->list); 1563 - __put_system_dir(dir); 1564 - } 1565 - } 1566 - 1567 1517 static void remove_event_from_tracers(struct ftrace_event_call *call) 1568 1518 { 1569 1519 struct ftrace_event_file *file; 1570 1520 struct trace_array *tr; 1571 1521 1572 1522 do_for_each_event_file_safe(tr, file) { 1573 - 1574 1523 if (file->event_call != call) 1575 1524 continue; 1576 1525 1577 - list_del(&file->list); 1578 - debugfs_remove_recursive(file->dir); 1579 - remove_subsystem(file->system); 1580 - kmem_cache_free(file_cachep, file); 1581 - 1526 + remove_event_file_dir(file); 1582 1527 /* 1583 1528 * The do_for_each_event_file_safe() is 1584 1529 * a double loop. After finding the call for this ··· 1713 1692 destroy_preds(call); 1714 1693 } 1715 1694 1716 - /* Remove an event_call */ 1717 - void trace_remove_event_call(struct ftrace_event_call *call) 1695 + static int probe_remove_event_call(struct ftrace_event_call *call) 1718 1696 { 1697 + struct trace_array *tr; 1698 + struct ftrace_event_file *file; 1699 + 1700 + #ifdef CONFIG_PERF_EVENTS 1701 + if (call->perf_refcount) 1702 + return -EBUSY; 1703 + #endif 1704 + do_for_each_event_file(tr, file) { 1705 + if (file->event_call != call) 1706 + continue; 1707 + /* 1708 + * We can't rely on ftrace_event_enable_disable(enable => 0) 1709 + * we are going to do, FTRACE_EVENT_FL_SOFT_MODE can suppress 1710 + * TRACE_REG_UNREGISTER. 1711 + */ 1712 + if (file->flags & FTRACE_EVENT_FL_ENABLED) 1713 + return -EBUSY; 1714 + /* 1715 + * The do_for_each_event_file_safe() is 1716 + * a double loop. After finding the call for this 1717 + * trace_array, we use break to jump to the next 1718 + * trace_array. 1719 + */ 1720 + break; 1721 + } while_for_each_event_file(); 1722 + 1723 + __trace_remove_event_call(call); 1724 + 1725 + return 0; 1726 + } 1727 + 1728 + /* Remove an event_call */ 1729 + int trace_remove_event_call(struct ftrace_event_call *call) 1730 + { 1731 + int ret; 1732 + 1719 1733 mutex_lock(&trace_types_lock); 1720 1734 mutex_lock(&event_mutex); 1721 1735 down_write(&trace_event_sem); 1722 - __trace_remove_event_call(call); 1736 + ret = probe_remove_event_call(call); 1723 1737 up_write(&trace_event_sem); 1724 1738 mutex_unlock(&event_mutex); 1725 1739 mutex_unlock(&trace_types_lock); 1740 + 1741 + return ret; 1726 1742 } 1727 1743 1728 1744 #define for_each_event(event, start, end) \ ··· 2328 2270 { 2329 2271 struct ftrace_event_file *file, *next; 2330 2272 2331 - list_for_each_entry_safe(file, next, &tr->events, list) { 2332 - list_del(&file->list); 2333 - debugfs_remove_recursive(file->dir); 2334 - remove_subsystem(file->system); 2335 - kmem_cache_free(file_cachep, file); 2336 - } 2273 + list_for_each_entry_safe(file, next, &tr->events, list) 2274 + remove_event_file_dir(file); 2337 2275 } 2338 2276 2339 2277 static void
+6 -11
kernel/trace/trace_events_filter.c
··· 637 637 free_page((unsigned long) buf); 638 638 } 639 639 640 + /* caller must hold event_mutex */ 640 641 void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s) 641 642 { 642 - struct event_filter *filter; 643 + struct event_filter *filter = call->filter; 643 644 644 - mutex_lock(&event_mutex); 645 - filter = call->filter; 646 645 if (filter && filter->filter_string) 647 646 trace_seq_printf(s, "%s\n", filter->filter_string); 648 647 else 649 648 trace_seq_puts(s, "none\n"); 650 - mutex_unlock(&event_mutex); 651 649 } 652 650 653 651 void print_subsystem_event_filter(struct event_subsystem *system, ··· 1839 1841 return err; 1840 1842 } 1841 1843 1844 + /* caller must hold event_mutex */ 1842 1845 int apply_event_filter(struct ftrace_event_call *call, char *filter_string) 1843 1846 { 1844 1847 struct event_filter *filter; 1845 - int err = 0; 1846 - 1847 - mutex_lock(&event_mutex); 1848 + int err; 1848 1849 1849 1850 if (!strcmp(strstrip(filter_string), "0")) { 1850 1851 filter_disable(call); 1851 1852 filter = call->filter; 1852 1853 if (!filter) 1853 - goto out_unlock; 1854 + return 0; 1854 1855 RCU_INIT_POINTER(call->filter, NULL); 1855 1856 /* Make sure the filter is not being used */ 1856 1857 synchronize_sched(); 1857 1858 __free_filter(filter); 1858 - goto out_unlock; 1859 + return 0; 1859 1860 } 1860 1861 1861 1862 err = create_filter(call, filter_string, true, &filter); ··· 1881 1884 __free_filter(tmp); 1882 1885 } 1883 1886 } 1884 - out_unlock: 1885 - mutex_unlock(&event_mutex); 1886 1887 1887 1888 return err; 1888 1889 }
+15 -6
kernel/trace/trace_kprobe.c
··· 95 95 } 96 96 97 97 static int register_probe_event(struct trace_probe *tp); 98 - static void unregister_probe_event(struct trace_probe *tp); 98 + static int unregister_probe_event(struct trace_probe *tp); 99 99 100 100 static DEFINE_MUTEX(probe_lock); 101 101 static LIST_HEAD(probe_list); ··· 351 351 if (trace_probe_is_enabled(tp)) 352 352 return -EBUSY; 353 353 354 + /* Will fail if probe is being used by ftrace or perf */ 355 + if (unregister_probe_event(tp)) 356 + return -EBUSY; 357 + 354 358 __unregister_trace_probe(tp); 355 359 list_del(&tp->list); 356 - unregister_probe_event(tp); 357 360 358 361 return 0; 359 362 } ··· 635 632 /* TODO: Use batch unregistration */ 636 633 while (!list_empty(&probe_list)) { 637 634 tp = list_entry(probe_list.next, struct trace_probe, list); 638 - unregister_trace_probe(tp); 635 + ret = unregister_trace_probe(tp); 636 + if (ret) 637 + goto end; 639 638 free_trace_probe(tp); 640 639 } 641 640 ··· 1252 1247 return ret; 1253 1248 } 1254 1249 1255 - static void unregister_probe_event(struct trace_probe *tp) 1250 + static int unregister_probe_event(struct trace_probe *tp) 1256 1251 { 1252 + int ret; 1253 + 1257 1254 /* tp->event is unregistered in trace_remove_event_call() */ 1258 - trace_remove_event_call(&tp->call); 1259 - kfree(tp->call.print_fmt); 1255 + ret = trace_remove_event_call(&tp->call); 1256 + if (!ret) 1257 + kfree(tp->call.print_fmt); 1258 + return ret; 1260 1259 } 1261 1260 1262 1261 /* Make a debugfs interface for controlling probe points */
+38 -13
kernel/trace/trace_uprobe.c
··· 70 70 (sizeof(struct probe_arg) * (n))) 71 71 72 72 static int register_uprobe_event(struct trace_uprobe *tu); 73 - static void unregister_uprobe_event(struct trace_uprobe *tu); 73 + static int unregister_uprobe_event(struct trace_uprobe *tu); 74 74 75 75 static DEFINE_MUTEX(uprobe_lock); 76 76 static LIST_HEAD(uprobe_list); ··· 164 164 } 165 165 166 166 /* Unregister a trace_uprobe and probe_event: call with locking uprobe_lock */ 167 - static void unregister_trace_uprobe(struct trace_uprobe *tu) 167 + static int unregister_trace_uprobe(struct trace_uprobe *tu) 168 168 { 169 + int ret; 170 + 171 + ret = unregister_uprobe_event(tu); 172 + if (ret) 173 + return ret; 174 + 169 175 list_del(&tu->list); 170 - unregister_uprobe_event(tu); 171 176 free_trace_uprobe(tu); 177 + return 0; 172 178 } 173 179 174 180 /* Register a trace_uprobe and probe_event */ ··· 187 181 188 182 /* register as an event */ 189 183 old_tp = find_probe_event(tu->call.name, tu->call.class->system); 190 - if (old_tp) 184 + if (old_tp) { 191 185 /* delete old event */ 192 - unregister_trace_uprobe(old_tp); 186 + ret = unregister_trace_uprobe(old_tp); 187 + if (ret) 188 + goto end; 189 + } 193 190 194 191 ret = register_uprobe_event(tu); 195 192 if (ret) { ··· 265 256 group = UPROBE_EVENT_SYSTEM; 266 257 267 258 if (is_delete) { 259 + int ret; 260 + 268 261 if (!event) { 269 262 pr_info("Delete command needs an event name.\n"); 270 263 return -EINVAL; ··· 280 269 return -ENOENT; 281 270 } 282 271 /* delete an event */ 283 - unregister_trace_uprobe(tu); 272 + ret = unregister_trace_uprobe(tu); 284 273 mutex_unlock(&uprobe_lock); 285 - return 0; 274 + return ret; 286 275 } 287 276 288 277 if (argc < 2) { ··· 419 408 return ret; 420 409 } 421 410 422 - static void cleanup_all_probes(void) 411 + static int cleanup_all_probes(void) 423 412 { 424 413 struct trace_uprobe *tu; 414 + int ret = 0; 425 415 426 416 mutex_lock(&uprobe_lock); 427 417 while (!list_empty(&uprobe_list)) { 428 418 tu = list_entry(uprobe_list.next, struct trace_uprobe, list); 429 - unregister_trace_uprobe(tu); 419 + ret = unregister_trace_uprobe(tu); 420 + if (ret) 421 + break; 430 422 } 431 423 mutex_unlock(&uprobe_lock); 424 + return ret; 432 425 } 433 426 434 427 /* Probes listing interfaces */ ··· 477 462 478 463 static int probes_open(struct inode *inode, struct file *file) 479 464 { 480 - if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) 481 - cleanup_all_probes(); 465 + int ret; 466 + 467 + if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) { 468 + ret = cleanup_all_probes(); 469 + if (ret) 470 + return ret; 471 + } 482 472 483 473 return seq_open(file, &probes_seq_op); 484 474 } ··· 988 968 return ret; 989 969 } 990 970 991 - static void unregister_uprobe_event(struct trace_uprobe *tu) 971 + static int unregister_uprobe_event(struct trace_uprobe *tu) 992 972 { 973 + int ret; 974 + 993 975 /* tu->event is unregistered in trace_remove_event_call() */ 994 - trace_remove_event_call(&tu->call); 976 + ret = trace_remove_event_call(&tu->call); 977 + if (ret) 978 + return ret; 995 979 kfree(tu->call.print_fmt); 996 980 tu->call.print_fmt = NULL; 981 + return 0; 997 982 } 998 983 999 984 /* Make a trace interface for controling probe points */
+13 -4
kernel/user_namespace.c
··· 62 62 kgid_t group = new->egid; 63 63 int ret; 64 64 65 + if (parent_ns->level > 32) 66 + return -EUSERS; 67 + 65 68 /* 66 69 * Verify that we can not violate the policy of which files 67 70 * may be accessed that is specified by the root directory, ··· 95 92 atomic_set(&ns->count, 1); 96 93 /* Leave the new->user_ns reference with the new user namespace. */ 97 94 ns->parent = parent_ns; 95 + ns->level = parent_ns->level + 1; 98 96 ns->owner = owner; 99 97 ns->group = group; 100 98 ··· 109 105 int unshare_userns(unsigned long unshare_flags, struct cred **new_cred) 110 106 { 111 107 struct cred *cred; 108 + int err = -ENOMEM; 112 109 113 110 if (!(unshare_flags & CLONE_NEWUSER)) 114 111 return 0; 115 112 116 113 cred = prepare_creds(); 117 - if (!cred) 118 - return -ENOMEM; 114 + if (cred) { 115 + err = create_user_ns(cred); 116 + if (err) 117 + put_cred(cred); 118 + else 119 + *new_cred = cred; 120 + } 119 121 120 - *new_cred = cred; 121 - return create_user_ns(cred); 122 + return err; 122 123 } 123 124 124 125 void free_user_ns(struct user_namespace *ns)
+34 -10
kernel/workqueue.c
··· 2817 2817 return false; 2818 2818 } 2819 2819 2820 + static bool __flush_work(struct work_struct *work) 2821 + { 2822 + struct wq_barrier barr; 2823 + 2824 + if (start_flush_work(work, &barr)) { 2825 + wait_for_completion(&barr.done); 2826 + destroy_work_on_stack(&barr.work); 2827 + return true; 2828 + } else { 2829 + return false; 2830 + } 2831 + } 2832 + 2820 2833 /** 2821 2834 * flush_work - wait for a work to finish executing the last queueing instance 2822 2835 * @work: the work to flush ··· 2843 2830 */ 2844 2831 bool flush_work(struct work_struct *work) 2845 2832 { 2846 - struct wq_barrier barr; 2847 - 2848 2833 lock_map_acquire(&work->lockdep_map); 2849 2834 lock_map_release(&work->lockdep_map); 2850 2835 2851 - if (start_flush_work(work, &barr)) { 2852 - wait_for_completion(&barr.done); 2853 - destroy_work_on_stack(&barr.work); 2854 - return true; 2855 - } else { 2856 - return false; 2857 - } 2836 + return __flush_work(work); 2858 2837 } 2859 2838 EXPORT_SYMBOL_GPL(flush_work); 2860 2839 ··· 3416 3411 { 3417 3412 to->nice = from->nice; 3418 3413 cpumask_copy(to->cpumask, from->cpumask); 3414 + /* 3415 + * Unlike hash and equality test, this function doesn't ignore 3416 + * ->no_numa as it is used for both pool and wq attrs. Instead, 3417 + * get_unbound_pool() explicitly clears ->no_numa after copying. 3418 + */ 3419 + to->no_numa = from->no_numa; 3419 3420 } 3420 3421 3421 3422 /* hash value of the content of @attr */ ··· 3588 3577 3589 3578 lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */ 3590 3579 copy_workqueue_attrs(pool->attrs, attrs); 3580 + 3581 + /* 3582 + * no_numa isn't a worker_pool attribute, always clear it. See 3583 + * 'struct workqueue_attrs' comments for detail. 3584 + */ 3585 + pool->attrs->no_numa = false; 3591 3586 3592 3587 /* if cpumask is contained inside a NUMA node, we belong to that node */ 3593 3588 if (wq_numa_enabled) { ··· 4773 4756 4774 4757 INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); 4775 4758 schedule_work_on(cpu, &wfc.work); 4776 - flush_work(&wfc.work); 4759 + 4760 + /* 4761 + * The work item is on-stack and can't lead to deadlock through 4762 + * flushing. Use __flush_work() to avoid spurious lockdep warnings 4763 + * when work_on_cpu()s are nested. 4764 + */ 4765 + __flush_work(&wfc.work); 4766 + 4777 4767 return wfc.ret; 4778 4768 } 4779 4769 EXPORT_SYMBOL_GPL(work_on_cpu);
+9 -4
mm/fremap.c
··· 57 57 unsigned long addr, unsigned long pgoff, pgprot_t prot) 58 58 { 59 59 int err = -ENOMEM; 60 - pte_t *pte; 60 + pte_t *pte, ptfile; 61 61 spinlock_t *ptl; 62 62 63 63 pte = get_locked_pte(mm, addr, &ptl); 64 64 if (!pte) 65 65 goto out; 66 66 67 - if (!pte_none(*pte)) 68 - zap_pte(mm, vma, addr, pte); 67 + ptfile = pgoff_to_pte(pgoff); 69 68 70 - set_pte_at(mm, addr, pte, pgoff_to_pte(pgoff)); 69 + if (!pte_none(*pte)) { 70 + if (pte_present(*pte) && pte_soft_dirty(*pte)) 71 + pte_file_mksoft_dirty(ptfile); 72 + zap_pte(mm, vma, addr, pte); 73 + } 74 + 75 + set_pte_at(mm, addr, pte, ptfile); 71 76 /* 72 77 * We don't need to run update_mmu_cache() here because the "file pte" 73 78 * being installed by install_file_pte() is not a real pte - it's a
+1 -1
mm/hugetlb.c
··· 2490 2490 2491 2491 mm = vma->vm_mm; 2492 2492 2493 - tlb_gather_mmu(&tlb, mm, 0); 2493 + tlb_gather_mmu(&tlb, mm, start, end); 2494 2494 __unmap_hugepage_range(&tlb, vma, start, end, ref_page); 2495 2495 tlb_finish_mmu(&tlb, start, end); 2496 2496 }
+2 -2
mm/memcontrol.c
··· 3195 3195 if (!s->memcg_params) 3196 3196 return -ENOMEM; 3197 3197 3198 - INIT_WORK(&s->memcg_params->destroy, 3199 - kmem_cache_destroy_work_func); 3200 3198 if (memcg) { 3201 3199 s->memcg_params->memcg = memcg; 3202 3200 s->memcg_params->root_cache = root_cache; 3201 + INIT_WORK(&s->memcg_params->destroy, 3202 + kmem_cache_destroy_work_func); 3203 3203 } else 3204 3204 s->memcg_params->is_root_cache = true; 3205 3205
+31 -18
mm/memory.c
··· 209 209 * tear-down from @mm. The @fullmm argument is used when @mm is without 210 210 * users and we're going to destroy the full address space (exit/execve). 211 211 */ 212 - void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm) 212 + void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 213 213 { 214 214 tlb->mm = mm; 215 215 216 - tlb->fullmm = fullmm; 216 + /* Is it from 0 to ~0? */ 217 + tlb->fullmm = !(start | (end+1)); 217 218 tlb->need_flush_all = 0; 218 - tlb->start = -1UL; 219 - tlb->end = 0; 219 + tlb->start = start; 220 + tlb->end = end; 220 221 tlb->need_flush = 0; 221 222 tlb->local.next = NULL; 222 223 tlb->local.nr = 0; ··· 257 256 { 258 257 struct mmu_gather_batch *batch, *next; 259 258 260 - tlb->start = start; 261 - tlb->end = end; 262 259 tlb_flush_mmu(tlb); 263 260 264 261 /* keep the page table cache within bounds */ ··· 1098 1099 spinlock_t *ptl; 1099 1100 pte_t *start_pte; 1100 1101 pte_t *pte; 1101 - unsigned long range_start = addr; 1102 1102 1103 1103 again: 1104 1104 init_rss_vec(rss); ··· 1139 1141 continue; 1140 1142 if (unlikely(details) && details->nonlinear_vma 1141 1143 && linear_page_index(details->nonlinear_vma, 1142 - addr) != page->index) 1143 - set_pte_at(mm, addr, pte, 1144 - pgoff_to_pte(page->index)); 1144 + addr) != page->index) { 1145 + pte_t ptfile = pgoff_to_pte(page->index); 1146 + if (pte_soft_dirty(ptent)) 1147 + pte_file_mksoft_dirty(ptfile); 1148 + set_pte_at(mm, addr, pte, ptfile); 1149 + } 1145 1150 if (PageAnon(page)) 1146 1151 rss[MM_ANONPAGES]--; 1147 1152 else { ··· 1203 1202 * and page-free while holding it. 1204 1203 */ 1205 1204 if (force_flush) { 1205 + unsigned long old_end; 1206 + 1206 1207 force_flush = 0; 1207 1208 1208 - #ifdef HAVE_GENERIC_MMU_GATHER 1209 - tlb->start = range_start; 1209 + /* 1210 + * Flush the TLB just for the previous segment, 1211 + * then update the range to be the remaining 1212 + * TLB range. 1213 + */ 1214 + old_end = tlb->end; 1210 1215 tlb->end = addr; 1211 - #endif 1216 + 1212 1217 tlb_flush_mmu(tlb); 1213 - if (addr != end) { 1214 - range_start = addr; 1218 + 1219 + tlb->start = addr; 1220 + tlb->end = old_end; 1221 + 1222 + if (addr != end) 1215 1223 goto again; 1216 - } 1217 1224 } 1218 1225 1219 1226 return addr; ··· 1406 1397 unsigned long end = start + size; 1407 1398 1408 1399 lru_add_drain(); 1409 - tlb_gather_mmu(&tlb, mm, 0); 1400 + tlb_gather_mmu(&tlb, mm, start, end); 1410 1401 update_hiwater_rss(mm); 1411 1402 mmu_notifier_invalidate_range_start(mm, start, end); 1412 1403 for ( ; vma && vma->vm_start < end; vma = vma->vm_next) ··· 1432 1423 unsigned long end = address + size; 1433 1424 1434 1425 lru_add_drain(); 1435 - tlb_gather_mmu(&tlb, mm, 0); 1426 + tlb_gather_mmu(&tlb, mm, address, end); 1436 1427 update_hiwater_rss(mm); 1437 1428 mmu_notifier_invalidate_range_start(mm, address, end); 1438 1429 unmap_single_vma(&tlb, vma, address, end, details); ··· 3124 3115 exclusive = 1; 3125 3116 } 3126 3117 flush_icache_page(vma, page); 3118 + if (pte_swp_soft_dirty(orig_pte)) 3119 + pte = pte_mksoft_dirty(pte); 3127 3120 set_pte_at(mm, address, page_table, pte); 3128 3121 if (page == swapcache) 3129 3122 do_page_add_anon_rmap(page, vma, address, exclusive); ··· 3419 3408 entry = mk_pte(page, vma->vm_page_prot); 3420 3409 if (flags & FAULT_FLAG_WRITE) 3421 3410 entry = maybe_mkwrite(pte_mkdirty(entry), vma); 3411 + else if (pte_file(orig_pte) && pte_file_soft_dirty(orig_pte)) 3412 + pte_mksoft_dirty(entry); 3422 3413 if (anon) { 3423 3414 inc_mm_counter_fast(mm, MM_ANONPAGES); 3424 3415 page_add_new_anon_rmap(page, vma, address);
+2 -2
mm/mmap.c
··· 2336 2336 struct mmu_gather tlb; 2337 2337 2338 2338 lru_add_drain(); 2339 - tlb_gather_mmu(&tlb, mm, 0); 2339 + tlb_gather_mmu(&tlb, mm, start, end); 2340 2340 update_hiwater_rss(mm); 2341 2341 unmap_vmas(&tlb, vma, start, end); 2342 2342 free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS, ··· 2709 2709 2710 2710 lru_add_drain(); 2711 2711 flush_cache_mm(mm); 2712 - tlb_gather_mmu(&tlb, mm, 1); 2712 + tlb_gather_mmu(&tlb, mm, 0, -1); 2713 2713 /* update_hiwater_rss(mm) here? but nobody should be looking */ 2714 2714 /* Use -1 here to ensure all VMAs in the mm are unmapped */ 2715 2715 unmap_vmas(&tlb, vma, 0, -1);
+11 -3
mm/rmap.c
··· 1236 1236 swp_entry_to_pte(make_hwpoison_entry(page))); 1237 1237 } else if (PageAnon(page)) { 1238 1238 swp_entry_t entry = { .val = page_private(page) }; 1239 + pte_t swp_pte; 1239 1240 1240 1241 if (PageSwapCache(page)) { 1241 1242 /* ··· 1265 1264 BUG_ON(TTU_ACTION(flags) != TTU_MIGRATION); 1266 1265 entry = make_migration_entry(page, pte_write(pteval)); 1267 1266 } 1268 - set_pte_at(mm, address, pte, swp_entry_to_pte(entry)); 1267 + swp_pte = swp_entry_to_pte(entry); 1268 + if (pte_soft_dirty(pteval)) 1269 + swp_pte = pte_swp_mksoft_dirty(swp_pte); 1270 + set_pte_at(mm, address, pte, swp_pte); 1269 1271 BUG_ON(pte_file(*pte)); 1270 1272 } else if (IS_ENABLED(CONFIG_MIGRATION) && 1271 1273 (TTU_ACTION(flags) == TTU_MIGRATION)) { ··· 1405 1401 pteval = ptep_clear_flush(vma, address, pte); 1406 1402 1407 1403 /* If nonlinear, store the file page offset in the pte. */ 1408 - if (page->index != linear_page_index(vma, address)) 1409 - set_pte_at(mm, address, pte, pgoff_to_pte(page->index)); 1404 + if (page->index != linear_page_index(vma, address)) { 1405 + pte_t ptfile = pgoff_to_pte(page->index); 1406 + if (pte_soft_dirty(pteval)) 1407 + pte_file_mksoft_dirty(ptfile); 1408 + set_pte_at(mm, address, pte, ptfile); 1409 + } 1410 1410 1411 1411 /* Move the dirty bit to the physical page now the pte is gone. */ 1412 1412 if (pte_dirty(pteval))
+2 -1
mm/shmem.c
··· 1798 1798 } 1799 1799 } 1800 1800 1801 - offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE); 1801 + if (offset >= 0) 1802 + offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE); 1802 1803 mutex_unlock(&inode->i_mutex); 1803 1804 return offset; 1804 1805 }
-3
mm/slub.c
··· 1968 1968 int pages; 1969 1969 int pobjects; 1970 1970 1971 - if (!s->cpu_partial) 1972 - return; 1973 - 1974 1971 do { 1975 1972 pages = 0; 1976 1973 pobjects = 0;
+17 -2
mm/swapfile.c
··· 866 866 } 867 867 #endif /* CONFIG_HIBERNATION */ 868 868 869 + static inline int maybe_same_pte(pte_t pte, pte_t swp_pte) 870 + { 871 + #ifdef CONFIG_MEM_SOFT_DIRTY 872 + /* 873 + * When pte keeps soft dirty bit the pte generated 874 + * from swap entry does not has it, still it's same 875 + * pte from logical point of view. 876 + */ 877 + pte_t swp_pte_dirty = pte_swp_mksoft_dirty(swp_pte); 878 + return pte_same(pte, swp_pte) || pte_same(pte, swp_pte_dirty); 879 + #else 880 + return pte_same(pte, swp_pte); 881 + #endif 882 + } 883 + 869 884 /* 870 885 * No need to decide whether this PTE shares the swap entry with others, 871 886 * just let do_wp_page work it out if a write is requested later - to ··· 907 892 } 908 893 909 894 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); 910 - if (unlikely(!pte_same(*pte, swp_entry_to_pte(entry)))) { 895 + if (unlikely(!maybe_same_pte(*pte, swp_entry_to_pte(entry)))) { 911 896 mem_cgroup_cancel_charge_swapin(memcg); 912 897 ret = 0; 913 898 goto out; ··· 962 947 * swapoff spends a _lot_ of time in this loop! 963 948 * Test inline before going to call unuse_pte. 964 949 */ 965 - if (unlikely(pte_same(*pte, swp_pte))) { 950 + if (unlikely(maybe_same_pte(*pte, swp_pte))) { 966 951 pte_unmap(pte); 967 952 ret = unuse_pte(vma, pmd, addr, entry, page); 968 953 if (ret)
+6 -1
net/8021q/vlan_core.c
··· 91 91 92 92 struct net_device *vlan_dev_real_dev(const struct net_device *dev) 93 93 { 94 - return vlan_dev_priv(dev)->real_dev; 94 + struct net_device *ret = vlan_dev_priv(dev)->real_dev; 95 + 96 + while (is_vlan_dev(ret)) 97 + ret = vlan_dev_priv(ret)->real_dev; 98 + 99 + return ret; 95 100 } 96 101 EXPORT_SYMBOL(vlan_dev_real_dev); 97 102
+2
net/batman-adv/bridge_loop_avoidance.c
··· 1529 1529 * in these cases, the skb is further handled by this function and 1530 1530 * returns 1, otherwise it returns 0 and the caller shall further 1531 1531 * process the skb. 1532 + * 1533 + * This call might reallocate skb data. 1532 1534 */ 1533 1535 int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, 1534 1536 unsigned short vid)
+12 -1
net/batman-adv/gateway_client.c
··· 508 508 return 0; 509 509 } 510 510 511 + /* this call might reallocate skb data */ 511 512 static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) 512 513 { 513 514 int ret = false; ··· 569 568 return ret; 570 569 } 571 570 571 + /* this call might reallocate skb data */ 572 572 bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) 573 573 { 574 574 struct ethhdr *ethhdr; ··· 621 619 622 620 if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr))) 623 621 return false; 622 + 623 + /* skb->data might have been reallocated by pskb_may_pull() */ 624 + ethhdr = (struct ethhdr *)skb->data; 625 + if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) 626 + ethhdr = (struct ethhdr *)(skb->data + VLAN_HLEN); 627 + 624 628 udphdr = (struct udphdr *)(skb->data + *header_len); 625 629 *header_len += sizeof(*udphdr); 626 630 ··· 642 634 return true; 643 635 } 644 636 637 + /* this call might reallocate skb data */ 645 638 bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, 646 - struct sk_buff *skb, struct ethhdr *ethhdr) 639 + struct sk_buff *skb) 647 640 { 648 641 struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL; 649 642 struct batadv_orig_node *orig_dst_node = NULL; 650 643 struct batadv_gw_node *curr_gw = NULL; 644 + struct ethhdr *ethhdr; 651 645 bool ret, out_of_range = false; 652 646 unsigned int header_len = 0; 653 647 uint8_t curr_tq_avg; ··· 658 648 if (!ret) 659 649 goto out; 660 650 651 + ethhdr = (struct ethhdr *)skb->data; 661 652 orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, 662 653 ethhdr->h_dest); 663 654 if (!orig_dst_node)
+1 -2
net/batman-adv/gateway_client.h
··· 34 34 void batadv_gw_node_purge(struct batadv_priv *bat_priv); 35 35 int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset); 36 36 bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len); 37 - bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, 38 - struct sk_buff *skb, struct ethhdr *ethhdr); 37 + bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb); 39 38 40 39 #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
+8 -1
net/batman-adv/soft-interface.c
··· 180 180 if (batadv_bla_tx(bat_priv, skb, vid)) 181 181 goto dropped; 182 182 183 + /* skb->data might have been reallocated by batadv_bla_tx() */ 184 + ethhdr = (struct ethhdr *)skb->data; 185 + 183 186 /* Register the client MAC in the transtable */ 184 187 if (!is_multicast_ether_addr(ethhdr->h_source)) 185 188 batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif); ··· 223 220 default: 224 221 break; 225 222 } 223 + 224 + /* reminder: ethhdr might have become unusable from here on 225 + * (batadv_gw_is_dhcp_target() might have reallocated skb data) 226 + */ 226 227 } 227 228 228 229 /* ethernet packet should be broadcasted */ ··· 273 266 /* unicast packet */ 274 267 } else { 275 268 if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) { 276 - ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr); 269 + ret = batadv_gw_out_of_range(bat_priv, skb); 277 270 if (ret) 278 271 goto dropped; 279 272 }
+10 -3
net/batman-adv/unicast.c
··· 326 326 * @skb: the skb containing the payload to encapsulate 327 327 * @orig_node: the destination node 328 328 * 329 - * Returns false if the payload could not be encapsulated or true otherwise 329 + * Returns false if the payload could not be encapsulated or true otherwise. 330 + * 331 + * This call might reallocate skb data. 330 332 */ 331 333 static bool batadv_unicast_prepare_skb(struct sk_buff *skb, 332 334 struct batadv_orig_node *orig_node) ··· 345 343 * @orig_node: the destination node 346 344 * @packet_subtype: the batman 4addr packet subtype to use 347 345 * 348 - * Returns false if the payload could not be encapsulated or true otherwise 346 + * Returns false if the payload could not be encapsulated or true otherwise. 347 + * 348 + * This call might reallocate skb data. 349 349 */ 350 350 bool batadv_unicast_4addr_prepare_skb(struct batadv_priv *bat_priv, 351 351 struct sk_buff *skb, ··· 405 401 struct batadv_neigh_node *neigh_node; 406 402 int data_len = skb->len; 407 403 int ret = NET_RX_DROP; 408 - unsigned int dev_mtu; 404 + unsigned int dev_mtu, header_len; 409 405 410 406 /* get routing information */ 411 407 if (is_multicast_ether_addr(ethhdr->h_dest)) { ··· 433 429 switch (packet_type) { 434 430 case BATADV_UNICAST: 435 431 batadv_unicast_prepare_skb(skb, orig_node); 432 + header_len = sizeof(struct batadv_unicast_packet); 436 433 break; 437 434 case BATADV_UNICAST_4ADDR: 438 435 batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node, 439 436 packet_subtype); 437 + header_len = sizeof(struct batadv_unicast_4addr_packet); 440 438 break; 441 439 default: 442 440 /* this function supports UNICAST and UNICAST_4ADDR only. It ··· 447 441 goto out; 448 442 } 449 443 444 + ethhdr = (struct ethhdr *)(skb->data + header_len); 450 445 unicast_packet = (struct batadv_unicast_packet *)skb->data; 451 446 452 447 /* inform the destination node that we are still missing a correct route
+1 -1
net/bridge/br_multicast.c
··· 1195 1195 max_delay = msecs_to_jiffies(ntohs(mld->mld_maxdelay)); 1196 1196 if (max_delay) 1197 1197 group = &mld->mld_mca; 1198 - } else if (skb->len >= sizeof(*mld2q)) { 1198 + } else { 1199 1199 if (!pskb_may_pull(skb, sizeof(*mld2q))) { 1200 1200 err = -EINVAL; 1201 1201 goto out;
+1 -1
net/bridge/br_sysfs_br.c
··· 1 1 /* 2 - * Sysfs attributes of bridge ports 2 + * Sysfs attributes of bridge 3 3 * Linux ethernet bridge 4 4 * 5 5 * Authors:
+1
net/core/flow_dissector.c
··· 65 65 nhoff += sizeof(struct ipv6hdr); 66 66 break; 67 67 } 68 + case __constant_htons(ETH_P_8021AD): 68 69 case __constant_htons(ETH_P_8021Q): { 69 70 const struct vlan_hdr *vlan; 70 71 struct vlan_hdr _vlan;
+2 -2
net/core/rtnetlink.c
··· 2179 2179 /* If aging addresses are supported device will need to 2180 2180 * implement its own handler for this. 2181 2181 */ 2182 - if (ndm->ndm_state & NUD_PERMANENT) { 2182 + if (!(ndm->ndm_state & NUD_PERMANENT)) { 2183 2183 pr_info("%s: FDB only supports static addresses\n", dev->name); 2184 2184 return -EINVAL; 2185 2185 } ··· 2407 2407 struct nlattr *extfilt; 2408 2408 u32 filter_mask = 0; 2409 2409 2410 - extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct rtgenmsg), 2410 + extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), 2411 2411 IFLA_EXT_MASK); 2412 2412 if (extfilt) 2413 2413 filter_mask = nla_get_u32(extfilt);
+1 -1
net/ipv4/esp4.c
··· 477 477 } 478 478 479 479 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - 480 - net_adj) & ~(align - 1)) + (net_adj - 2); 480 + net_adj) & ~(align - 1)) + net_adj - 2; 481 481 } 482 482 483 483 static void esp4_err(struct sk_buff *skb, u32 info)
+1 -4
net/ipv4/fib_trie.c
··· 71 71 #include <linux/init.h> 72 72 #include <linux/list.h> 73 73 #include <linux/slab.h> 74 - #include <linux/prefetch.h> 75 74 #include <linux/export.h> 76 75 #include <net/net_namespace.h> 77 76 #include <net/ip.h> ··· 1760 1761 if (!c) 1761 1762 continue; 1762 1763 1763 - if (IS_LEAF(c)) { 1764 - prefetch(rcu_dereference_rtnl(p->child[idx])); 1764 + if (IS_LEAF(c)) 1765 1765 return (struct leaf *) c; 1766 - } 1767 1766 1768 1767 /* Rescan start scanning in new node */ 1769 1768 p = (struct tnode *) c;
+1 -1
net/ipv4/ip_gre.c
··· 383 383 if (daddr) 384 384 memcpy(&iph->daddr, daddr, 4); 385 385 if (iph->daddr) 386 - return t->hlen; 386 + return t->hlen + sizeof(*iph); 387 387 388 388 return -(t->hlen + sizeof(*iph)); 389 389 }
+1 -3
net/ipv4/ip_tunnel_core.c
··· 76 76 iph->daddr = dst; 77 77 iph->saddr = src; 78 78 iph->ttl = ttl; 79 - tunnel_ip_select_ident(skb, 80 - (const struct iphdr *)skb_inner_network_header(skb), 81 - &rt->dst); 79 + __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1); 82 80 83 81 err = ip_local_out(skb); 84 82 if (unlikely(net_xmit_eval(err)))
+1 -1
net/ipv4/proc.c
··· 278 278 SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW), 279 279 SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD), 280 280 SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES), 281 - SNMP_MIB_ITEM("LowLatencyRxPackets", LINUX_MIB_LOWLATENCYRXPACKETS), 281 + SNMP_MIB_ITEM("BusyPollRxPackets", LINUX_MIB_BUSYPOLLRXPACKETS), 282 282 SNMP_MIB_SENTINEL 283 283 }; 284 284
+7 -5
net/ipv4/tcp_cubic.c
··· 206 206 */ 207 207 static inline void bictcp_update(struct bictcp *ca, u32 cwnd) 208 208 { 209 - u64 offs; 210 - u32 delta, t, bic_target, max_cnt; 209 + u32 delta, bic_target, max_cnt; 210 + u64 offs, t; 211 211 212 212 ca->ack_cnt++; /* count the number of ACKs */ 213 213 ··· 250 250 * if the cwnd < 1 million packets !!! 251 251 */ 252 252 253 + t = (s32)(tcp_time_stamp - ca->epoch_start); 254 + t += msecs_to_jiffies(ca->delay_min >> 3); 253 255 /* change the unit from HZ to bictcp_HZ */ 254 - t = ((tcp_time_stamp + msecs_to_jiffies(ca->delay_min>>3) 255 - - ca->epoch_start) << BICTCP_HZ) / HZ; 256 + t <<= BICTCP_HZ; 257 + do_div(t, HZ); 256 258 257 259 if (t < ca->bic_K) /* t - K */ 258 260 offs = ca->bic_K - t; ··· 416 414 return; 417 415 418 416 /* Discard delay samples right after fast recovery */ 419 - if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ) 417 + if (ca->epoch_start && (s32)(tcp_time_stamp - ca->epoch_start) < HZ) 420 418 return; 421 419 422 420 delay = (rtt_us << 3) / USEC_PER_MSEC;
+1 -1
net/ipv6/esp6.c
··· 425 425 net_adj = 0; 426 426 427 427 return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - 428 - net_adj) & ~(align - 1)) + (net_adj - 2); 428 + net_adj) & ~(align - 1)) + net_adj - 2; 429 429 } 430 430 431 431 static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+12 -4
net/ipv6/ip6_fib.c
··· 993 993 994 994 if (ipv6_prefix_equal(&key->addr, args->addr, key->plen)) { 995 995 #ifdef CONFIG_IPV6_SUBTREES 996 - if (fn->subtree) 997 - fn = fib6_lookup_1(fn->subtree, args + 1); 996 + if (fn->subtree) { 997 + struct fib6_node *sfn; 998 + sfn = fib6_lookup_1(fn->subtree, 999 + args + 1); 1000 + if (!sfn) 1001 + goto backtrack; 1002 + fn = sfn; 1003 + } 998 1004 #endif 999 - if (!fn || fn->fn_flags & RTN_RTINFO) 1005 + if (fn->fn_flags & RTN_RTINFO) 1000 1006 return fn; 1001 1007 } 1002 1008 } 1003 - 1009 + #ifdef CONFIG_IPV6_SUBTREES 1010 + backtrack: 1011 + #endif 1004 1012 if (fn->fn_flags & RTN_ROOT) 1005 1013 break; 1006 1014
+8 -4
net/netfilter/nf_conntrack_proto_tcp.c
··· 526 526 const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; 527 527 __u32 seq, ack, sack, end, win, swin; 528 528 s16 receiver_offset; 529 - bool res; 529 + bool res, in_recv_win; 530 530 531 531 /* 532 532 * Get the required data from the packet. ··· 649 649 receiver->td_end, receiver->td_maxend, receiver->td_maxwin, 650 650 receiver->td_scale); 651 651 652 + /* Is the ending sequence in the receive window (if available)? */ 653 + in_recv_win = !receiver->td_maxwin || 654 + after(end, sender->td_end - receiver->td_maxwin - 1); 655 + 652 656 pr_debug("tcp_in_window: I=%i II=%i III=%i IV=%i\n", 653 657 before(seq, sender->td_maxend + 1), 654 - after(end, sender->td_end - receiver->td_maxwin - 1), 658 + (in_recv_win ? 1 : 0), 655 659 before(sack, receiver->td_end + 1), 656 660 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)); 657 661 658 662 if (before(seq, sender->td_maxend + 1) && 659 - after(end, sender->td_end - receiver->td_maxwin - 1) && 663 + in_recv_win && 660 664 before(sack, receiver->td_end + 1) && 661 665 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)) { 662 666 /* ··· 729 725 nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, 730 726 "nf_ct_tcp: %s ", 731 727 before(seq, sender->td_maxend + 1) ? 732 - after(end, sender->td_end - receiver->td_maxwin - 1) ? 728 + in_recv_win ? 733 729 before(sack, receiver->td_end + 1) ? 734 730 after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1) ? "BUG" 735 731 : "ACK is under the lower bound (possible overly delayed ACK)"
+17 -13
net/netfilter/xt_TCPMSS.c
··· 52 52 { 53 53 const struct xt_tcpmss_info *info = par->targinfo; 54 54 struct tcphdr *tcph; 55 - unsigned int tcplen, i; 55 + int len, tcp_hdrlen; 56 + unsigned int i; 56 57 __be16 oldval; 57 58 u16 newmss; 58 59 u8 *opt; ··· 65 64 if (!skb_make_writable(skb, skb->len)) 66 65 return -1; 67 66 68 - tcplen = skb->len - tcphoff; 69 - tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); 67 + len = skb->len - tcphoff; 68 + if (len < (int)sizeof(struct tcphdr)) 69 + return -1; 70 70 71 - /* Header cannot be larger than the packet */ 72 - if (tcplen < tcph->doff*4) 71 + tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); 72 + tcp_hdrlen = tcph->doff * 4; 73 + 74 + if (len < tcp_hdrlen) 73 75 return -1; 74 76 75 77 if (info->mss == XT_TCPMSS_CLAMP_PMTU) { ··· 91 87 newmss = info->mss; 92 88 93 89 opt = (u_int8_t *)tcph; 94 - for (i = sizeof(struct tcphdr); i < tcph->doff*4; i += optlen(opt, i)) { 95 - if (opt[i] == TCPOPT_MSS && tcph->doff*4 - i >= TCPOLEN_MSS && 96 - opt[i+1] == TCPOLEN_MSS) { 90 + for (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) { 91 + if (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) { 97 92 u_int16_t oldmss; 98 93 99 94 oldmss = (opt[i+2] << 8) | opt[i+3]; ··· 115 112 } 116 113 117 114 /* There is data after the header so the option can't be added 118 - without moving it, and doing so may make the SYN packet 119 - itself too large. Accept the packet unmodified instead. */ 120 - if (tcplen > tcph->doff*4) 115 + * without moving it, and doing so may make the SYN packet 116 + * itself too large. Accept the packet unmodified instead. 117 + */ 118 + if (len > tcp_hdrlen) 121 119 return 0; 122 120 123 121 /* ··· 147 143 newmss = min(newmss, (u16)1220); 148 144 149 145 opt = (u_int8_t *)tcph + sizeof(struct tcphdr); 150 - memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); 146 + memmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr)); 151 147 152 148 inet_proto_csum_replace2(&tcph->check, skb, 153 - htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1); 149 + htons(len), htons(len + TCPOLEN_MSS), 1); 154 150 opt[0] = TCPOPT_MSS; 155 151 opt[1] = TCPOLEN_MSS; 156 152 opt[2] = (newmss & 0xff00) >> 8;
+6 -4
net/netfilter/xt_TCPOPTSTRIP.c
··· 38 38 struct tcphdr *tcph; 39 39 u_int16_t n, o; 40 40 u_int8_t *opt; 41 - int len; 41 + int len, tcp_hdrlen; 42 42 43 43 /* This is a fragment, no TCP header is available */ 44 44 if (par->fragoff != 0) ··· 52 52 return NF_DROP; 53 53 54 54 tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); 55 - if (tcph->doff * 4 > len) 55 + tcp_hdrlen = tcph->doff * 4; 56 + 57 + if (len < tcp_hdrlen) 56 58 return NF_DROP; 57 59 58 60 opt = (u_int8_t *)tcph; ··· 63 61 * Walk through all TCP options - if we find some option to remove, 64 62 * set all octets to %TCPOPT_NOP and adjust checksum. 65 63 */ 66 - for (i = sizeof(struct tcphdr); i < tcp_hdrlen(skb); i += optl) { 64 + for (i = sizeof(struct tcphdr); i < tcp_hdrlen - 1; i += optl) { 67 65 optl = optlen(opt, i); 68 66 69 - if (i + optl > tcp_hdrlen(skb)) 67 + if (i + optl > tcp_hdrlen) 70 68 break; 71 69 72 70 if (!tcpoptstrip_test_bit(info->strip_bmap, opt[i]))
+7
net/netlink/genetlink.c
··· 789 789 struct net *net = sock_net(skb->sk); 790 790 int chains_to_skip = cb->args[0]; 791 791 int fams_to_skip = cb->args[1]; 792 + bool need_locking = chains_to_skip || fams_to_skip; 793 + 794 + if (need_locking) 795 + genl_lock(); 792 796 793 797 for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) { 794 798 n = 0; ··· 813 809 errout: 814 810 cb->args[0] = i; 815 811 cb->args[1] = n; 812 + 813 + if (need_locking) 814 + genl_unlock(); 816 815 817 816 return skb->len; 818 817 }
+1
net/openvswitch/actions.c
··· 535 535 { 536 536 struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts); 537 537 538 + OVS_CB(skb)->tun_key = NULL; 538 539 return do_execute_actions(dp, skb, acts->actions, 539 540 acts->actions_len, false); 540 541 }
-3
net/openvswitch/datapath.c
··· 2076 2076 ovs_notify(reply, info, &ovs_dp_vport_multicast_group); 2077 2077 return 0; 2078 2078 2079 - rtnl_unlock(); 2080 - return 0; 2081 - 2082 2079 exit_free: 2083 2080 kfree_skb(reply); 2084 2081 exit_unlock:
+1 -1
net/openvswitch/flow.c
··· 240 240 struct flex_array *buckets; 241 241 int i, err; 242 242 243 - buckets = flex_array_alloc(sizeof(struct hlist_head *), 243 + buckets = flex_array_alloc(sizeof(struct hlist_head), 244 244 n_buckets, GFP_KERNEL); 245 245 if (!buckets) 246 246 return NULL;
+41
net/sched/sch_api.c
··· 285 285 return q; 286 286 } 287 287 288 + /* The linklayer setting were not transferred from iproute2, in older 289 + * versions, and the rate tables lookup systems have been dropped in 290 + * the kernel. To keep backward compatible with older iproute2 tc 291 + * utils, we detect the linklayer setting by detecting if the rate 292 + * table were modified. 293 + * 294 + * For linklayer ATM table entries, the rate table will be aligned to 295 + * 48 bytes, thus some table entries will contain the same value. The 296 + * mpu (min packet unit) is also encoded into the old rate table, thus 297 + * starting from the mpu, we find low and high table entries for 298 + * mapping this cell. If these entries contain the same value, when 299 + * the rate tables have been modified for linklayer ATM. 300 + * 301 + * This is done by rounding mpu to the nearest 48 bytes cell/entry, 302 + * and then roundup to the next cell, calc the table entry one below, 303 + * and compare. 304 + */ 305 + static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab) 306 + { 307 + int low = roundup(r->mpu, 48); 308 + int high = roundup(low+1, 48); 309 + int cell_low = low >> r->cell_log; 310 + int cell_high = (high >> r->cell_log) - 1; 311 + 312 + /* rtab is too inaccurate at rates > 100Mbit/s */ 313 + if ((r->rate > (100000000/8)) || (rtab[0] == 0)) { 314 + pr_debug("TC linklayer: Giving up ATM detection\n"); 315 + return TC_LINKLAYER_ETHERNET; 316 + } 317 + 318 + if ((cell_high > cell_low) && (cell_high < 256) 319 + && (rtab[cell_low] == rtab[cell_high])) { 320 + pr_debug("TC linklayer: Detected ATM, low(%d)=high(%d)=%u\n", 321 + cell_low, cell_high, rtab[cell_high]); 322 + return TC_LINKLAYER_ATM; 323 + } 324 + return TC_LINKLAYER_ETHERNET; 325 + } 326 + 288 327 static struct qdisc_rate_table *qdisc_rtab_list; 289 328 290 329 struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *tab) ··· 347 308 rtab->rate = *r; 348 309 rtab->refcnt = 1; 349 310 memcpy(rtab->data, nla_data(tab), 1024); 311 + if (r->linklayer == TC_LINKLAYER_UNAWARE) 312 + r->linklayer = __detect_linklayer(r, rtab->data); 350 313 rtab->next = qdisc_rtab_list; 351 314 qdisc_rtab_list = rtab; 352 315 }
+7 -1
net/sched/sch_generic.c
··· 25 25 #include <linux/rcupdate.h> 26 26 #include <linux/list.h> 27 27 #include <linux/slab.h> 28 + #include <linux/if_vlan.h> 28 29 #include <net/sch_generic.h> 29 30 #include <net/pkt_sched.h> 30 31 #include <net/dst.h> ··· 208 207 209 208 unsigned long dev_trans_start(struct net_device *dev) 210 209 { 211 - unsigned long val, res = dev->trans_start; 210 + unsigned long val, res; 212 211 unsigned int i; 213 212 213 + if (is_vlan_dev(dev)) 214 + dev = vlan_dev_real_dev(dev); 215 + res = dev->trans_start; 214 216 for (i = 0; i < dev->num_tx_queues; i++) { 215 217 val = netdev_get_tx_queue(dev, i)->trans_start; 216 218 if (val && time_after(val, res)) 217 219 res = val; 218 220 } 219 221 dev->trans_start = res; 222 + 220 223 return res; 221 224 } 222 225 EXPORT_SYMBOL(dev_trans_start); ··· 909 904 memset(r, 0, sizeof(*r)); 910 905 r->overhead = conf->overhead; 911 906 r->rate_bytes_ps = conf->rate; 907 + r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); 912 908 r->mult = 1; 913 909 /* 914 910 * The deal here is to replace a divide by a reciprocal one
+13
net/sched/sch_htb.c
··· 1329 1329 struct htb_sched *q = qdisc_priv(sch); 1330 1330 struct htb_class *cl = (struct htb_class *)*arg, *parent; 1331 1331 struct nlattr *opt = tca[TCA_OPTIONS]; 1332 + struct qdisc_rate_table *rtab = NULL, *ctab = NULL; 1332 1333 struct nlattr *tb[TCA_HTB_MAX + 1]; 1333 1334 struct tc_htb_opt *hopt; 1334 1335 ··· 1350 1349 hopt = nla_data(tb[TCA_HTB_PARMS]); 1351 1350 if (!hopt->rate.rate || !hopt->ceil.rate) 1352 1351 goto failure; 1352 + 1353 + /* Keeping backward compatible with rate_table based iproute2 tc */ 1354 + if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE) { 1355 + rtab = qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB]); 1356 + if (rtab) 1357 + qdisc_put_rtab(rtab); 1358 + } 1359 + if (hopt->ceil.linklayer == TC_LINKLAYER_UNAWARE) { 1360 + ctab = qdisc_get_rtab(&hopt->ceil, tb[TCA_HTB_CTAB]); 1361 + if (ctab) 1362 + qdisc_put_rtab(ctab); 1363 + } 1353 1364 1354 1365 if (!cl) { /* new class */ 1355 1366 struct Qdisc *new_q;
+2 -2
net/sctp/associola.c
··· 840 840 else 841 841 spc_state = SCTP_ADDR_AVAILABLE; 842 842 /* Don't inform ULP about transition from PF to 843 - * active state and set cwnd to 1, see SCTP 843 + * active state and set cwnd to 1 MTU, see SCTP 844 844 * Quick failover draft section 5.1, point 5 845 845 */ 846 846 if (transport->state == SCTP_PF) { 847 847 ulp_notify = false; 848 - transport->cwnd = 1; 848 + transport->cwnd = asoc->pathmtu; 849 849 } 850 850 transport->state = SCTP_ACTIVE; 851 851 break;
+2 -2
net/sctp/transport.c
··· 175 175 return; 176 176 } 177 177 178 - call_rcu(&transport->rcu, sctp_transport_destroy_rcu); 179 - 180 178 sctp_packet_free(&transport->packet); 181 179 182 180 if (transport->asoc) 183 181 sctp_association_put(transport->asoc); 182 + 183 + call_rcu(&transport->rcu, sctp_transport_destroy_rcu); 184 184 } 185 185 186 186 /* Start T3_rtx timer if it is not already running and update the heartbeat
+4
net/sunrpc/clnt.c
··· 1660 1660 task->tk_action = call_connect_status; 1661 1661 if (task->tk_status < 0) 1662 1662 return; 1663 + if (task->tk_flags & RPC_TASK_NOCONNECT) { 1664 + rpc_exit(task, -ENOTCONN); 1665 + return; 1666 + } 1663 1667 xprt_connect(task); 1664 1668 } 1665 1669 }
+1
net/sunrpc/netns.h
··· 23 23 struct rpc_clnt *rpcb_local_clnt4; 24 24 spinlock_t rpcb_clnt_lock; 25 25 unsigned int rpcb_users; 26 + unsigned int rpcb_is_af_local : 1; 26 27 27 28 struct mutex gssp_lock; 28 29 wait_queue_head_t gssp_wq;
+35 -13
net/sunrpc/rpcb_clnt.c
··· 204 204 } 205 205 206 206 static void rpcb_set_local(struct net *net, struct rpc_clnt *clnt, 207 - struct rpc_clnt *clnt4) 207 + struct rpc_clnt *clnt4, 208 + bool is_af_local) 208 209 { 209 210 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); 210 211 211 212 /* Protected by rpcb_create_local_mutex */ 212 213 sn->rpcb_local_clnt = clnt; 213 214 sn->rpcb_local_clnt4 = clnt4; 215 + sn->rpcb_is_af_local = is_af_local ? 1 : 0; 214 216 smp_wmb(); 215 217 sn->rpcb_users = 1; 216 218 dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: " ··· 240 238 .program = &rpcb_program, 241 239 .version = RPCBVERS_2, 242 240 .authflavor = RPC_AUTH_NULL, 241 + /* 242 + * We turn off the idle timeout to prevent the kernel 243 + * from automatically disconnecting the socket. 244 + * Otherwise, we'd have to cache the mount namespace 245 + * of the caller and somehow pass that to the socket 246 + * reconnect code. 247 + */ 248 + .flags = RPC_CLNT_CREATE_NO_IDLE_TIMEOUT, 243 249 }; 244 250 struct rpc_clnt *clnt, *clnt4; 245 251 int result = 0; ··· 273 263 clnt4 = NULL; 274 264 } 275 265 276 - rpcb_set_local(net, clnt, clnt4); 266 + rpcb_set_local(net, clnt, clnt4, true); 277 267 278 268 out: 279 269 return result; ··· 325 315 clnt4 = NULL; 326 316 } 327 317 328 - rpcb_set_local(net, clnt, clnt4); 318 + rpcb_set_local(net, clnt, clnt4, false); 329 319 330 320 out: 331 321 return result; ··· 386 376 return rpc_create(&args); 387 377 } 388 378 389 - static int rpcb_register_call(struct rpc_clnt *clnt, struct rpc_message *msg) 379 + static int rpcb_register_call(struct sunrpc_net *sn, struct rpc_clnt *clnt, struct rpc_message *msg, bool is_set) 390 380 { 391 - int result, error = 0; 381 + int flags = RPC_TASK_NOCONNECT; 382 + int error, result = 0; 392 383 384 + if (is_set || !sn->rpcb_is_af_local) 385 + flags = RPC_TASK_SOFTCONN; 393 386 msg->rpc_resp = &result; 394 387 395 - error = rpc_call_sync(clnt, msg, RPC_TASK_SOFTCONN); 388 + error = rpc_call_sync(clnt, msg, flags); 396 389 if (error < 0) { 397 390 dprintk("RPC: failed to contact local rpcbind " 398 391 "server (errno %d).\n", -error); ··· 452 439 .rpc_argp = &map, 453 440 }; 454 441 struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); 442 + bool is_set = false; 455 443 456 444 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " 457 445 "rpcbind\n", (port ? "" : "un"), 458 446 prog, vers, prot, port); 459 447 460 448 msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET]; 461 - if (port) 449 + if (port != 0) { 462 450 msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET]; 451 + is_set = true; 452 + } 463 453 464 - return rpcb_register_call(sn->rpcb_local_clnt, &msg); 454 + return rpcb_register_call(sn, sn->rpcb_local_clnt, &msg, is_set); 465 455 } 466 456 467 457 /* ··· 477 461 const struct sockaddr_in *sin = (const struct sockaddr_in *)sap; 478 462 struct rpcbind_args *map = msg->rpc_argp; 479 463 unsigned short port = ntohs(sin->sin_port); 464 + bool is_set = false; 480 465 int result; 481 466 482 467 map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); ··· 488 471 map->r_addr, map->r_netid); 489 472 490 473 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; 491 - if (port) 474 + if (port != 0) { 492 475 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; 476 + is_set = true; 477 + } 493 478 494 - result = rpcb_register_call(sn->rpcb_local_clnt4, msg); 479 + result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set); 495 480 kfree(map->r_addr); 496 481 return result; 497 482 } ··· 508 489 const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sap; 509 490 struct rpcbind_args *map = msg->rpc_argp; 510 491 unsigned short port = ntohs(sin6->sin6_port); 492 + bool is_set = false; 511 493 int result; 512 494 513 495 map->r_addr = rpc_sockaddr2uaddr(sap, GFP_KERNEL); ··· 519 499 map->r_addr, map->r_netid); 520 500 521 501 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; 522 - if (port) 502 + if (port != 0) { 523 503 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; 504 + is_set = true; 505 + } 524 506 525 - result = rpcb_register_call(sn->rpcb_local_clnt4, msg); 507 + result = rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, is_set); 526 508 kfree(map->r_addr); 527 509 return result; 528 510 } ··· 541 519 map->r_addr = ""; 542 520 msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; 543 521 544 - return rpcb_register_call(sn->rpcb_local_clnt4, msg); 522 + return rpcb_register_call(sn, sn->rpcb_local_clnt4, msg, false); 545 523 } 546 524 547 525 /**
+7 -2
net/tipc/bearer.c
··· 460 460 { 461 461 struct tipc_link *l_ptr; 462 462 struct tipc_link *temp_l_ptr; 463 + struct tipc_link_req *temp_req; 463 464 464 465 pr_info("Disabling bearer <%s>\n", b_ptr->name); 465 466 spin_lock_bh(&b_ptr->lock); ··· 469 468 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { 470 469 tipc_link_delete(l_ptr); 471 470 } 472 - if (b_ptr->link_req) 473 - tipc_disc_delete(b_ptr->link_req); 471 + temp_req = b_ptr->link_req; 472 + b_ptr->link_req = NULL; 474 473 spin_unlock_bh(&b_ptr->lock); 474 + 475 + if (temp_req) 476 + tipc_disc_delete(temp_req); 477 + 475 478 memset(b_ptr, 0, sizeof(struct tipc_bearer)); 476 479 } 477 480
+1 -1
net/vmw_vsock/af_vsock.c
··· 346 346 for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) { 347 347 struct vsock_sock *vsk; 348 348 list_for_each_entry(vsk, &vsock_connected_table[i], 349 - connected_table); 349 + connected_table) 350 350 fn(sk_vsock(vsk)); 351 351 } 352 352
+11 -13
security/smack/smack_lsm.c
··· 1998 1998 * 1999 1999 * Create or update the port list entry 2000 2000 */ 2001 - static int smk_ipv6_port_check(struct sock *sk, struct sockaddr *address, 2001 + static int smk_ipv6_port_check(struct sock *sk, struct sockaddr_in6 *address, 2002 2002 int act) 2003 2003 { 2004 2004 __be16 *bep; 2005 2005 __be32 *be32p; 2006 - struct sockaddr_in6 *addr6; 2007 2006 struct smk_port_label *spp; 2008 2007 struct socket_smack *ssp = sk->sk_security; 2009 2008 struct smack_known *skp; ··· 2024 2025 /* 2025 2026 * Get the IP address and port from the address. 2026 2027 */ 2027 - addr6 = (struct sockaddr_in6 *)address; 2028 - port = ntohs(addr6->sin6_port); 2029 - bep = (__be16 *)(&addr6->sin6_addr); 2030 - be32p = (__be32 *)(&addr6->sin6_addr); 2028 + port = ntohs(address->sin6_port); 2029 + bep = (__be16 *)(&address->sin6_addr); 2030 + be32p = (__be32 *)(&address->sin6_addr); 2031 2031 2032 2032 /* 2033 2033 * It's remote, so port lookup does no good. ··· 2058 2060 ad.a.u.net->family = sk->sk_family; 2059 2061 ad.a.u.net->dport = port; 2060 2062 if (act == SMK_RECEIVING) 2061 - ad.a.u.net->v6info.saddr = addr6->sin6_addr; 2063 + ad.a.u.net->v6info.saddr = address->sin6_addr; 2062 2064 else 2063 - ad.a.u.net->v6info.daddr = addr6->sin6_addr; 2065 + ad.a.u.net->v6info.daddr = address->sin6_addr; 2064 2066 #endif 2065 2067 return smk_access(skp, object, MAY_WRITE, &ad); 2066 2068 } ··· 2199 2201 case PF_INET6: 2200 2202 if (addrlen < sizeof(struct sockaddr_in6)) 2201 2203 return -EINVAL; 2202 - rc = smk_ipv6_port_check(sock->sk, sap, SMK_CONNECTING); 2204 + rc = smk_ipv6_port_check(sock->sk, (struct sockaddr_in6 *)sap, 2205 + SMK_CONNECTING); 2203 2206 break; 2204 2207 } 2205 2208 return rc; ··· 3033 3034 int size) 3034 3035 { 3035 3036 struct sockaddr_in *sip = (struct sockaddr_in *) msg->msg_name; 3036 - struct sockaddr *sap = (struct sockaddr *) msg->msg_name; 3037 + struct sockaddr_in6 *sap = (struct sockaddr_in6 *) msg->msg_name; 3037 3038 int rc = 0; 3038 3039 3039 3040 /* ··· 3120 3121 return smack_net_ambient; 3121 3122 } 3122 3123 3123 - static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr *sap) 3124 + static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip) 3124 3125 { 3125 - struct sockaddr_in6 *sip = (struct sockaddr_in6 *)sap; 3126 3126 u8 nexthdr; 3127 3127 int offset; 3128 3128 int proto = -EINVAL; ··· 3179 3181 struct netlbl_lsm_secattr secattr; 3180 3182 struct socket_smack *ssp = sk->sk_security; 3181 3183 struct smack_known *skp; 3182 - struct sockaddr sadd; 3184 + struct sockaddr_in6 sadd; 3183 3185 int rc = 0; 3184 3186 struct smk_audit_info ad; 3185 3187 #ifdef CONFIG_AUDIT
+1 -1
sound/core/compress_offload.c
··· 743 743 mutex_lock(&stream->device->lock); 744 744 switch (_IOC_NR(cmd)) { 745 745 case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION): 746 - put_user(SNDRV_COMPRESS_VERSION, 746 + retval = put_user(SNDRV_COMPRESS_VERSION, 747 747 (int __user *)arg) ? -EFAULT : 0; 748 748 break; 749 749 case _IOC_NR(SNDRV_COMPRESS_GET_CAPS):
+1 -1
sound/pci/hda/hda_auto_parser.c
··· 860 860 } 861 861 } 862 862 if (id < 0 && quirk) { 863 - for (q = quirk; q->subvendor; q++) { 863 + for (q = quirk; q->subvendor || q->subdevice; q++) { 864 864 unsigned int vendorid = 865 865 q->subdevice | (q->subvendor << 16); 866 866 unsigned int mask = 0xffff0000 | q->subdevice_mask;
+3 -3
sound/pci/hda/hda_generic.c
··· 522 522 } 523 523 524 524 #define nid_has_mute(codec, nid, dir) \ 525 - check_amp_caps(codec, nid, dir, AC_AMPCAP_MUTE) 525 + check_amp_caps(codec, nid, dir, (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) 526 526 #define nid_has_volume(codec, nid, dir) \ 527 527 check_amp_caps(codec, nid, dir, AC_AMPCAP_NUM_STEPS) 528 528 ··· 624 624 if (enable) 625 625 val = (caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT; 626 626 } 627 - if (caps & AC_AMPCAP_MUTE) { 627 + if (caps & (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) { 628 628 if (!enable) 629 629 val |= HDA_AMP_MUTE; 630 630 } ··· 648 648 { 649 649 unsigned int mask = 0xff; 650 650 651 - if (caps & AC_AMPCAP_MUTE) { 651 + if (caps & (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) { 652 652 if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_MUTE_CTL)) 653 653 mask &= ~0x80; 654 654 }
+11
sound/pci/hda/patch_realtek.c
··· 1031 1031 ALC880_FIXUP_GPIO2, 1032 1032 ALC880_FIXUP_MEDION_RIM, 1033 1033 ALC880_FIXUP_LG, 1034 + ALC880_FIXUP_LG_LW25, 1034 1035 ALC880_FIXUP_W810, 1035 1036 ALC880_FIXUP_EAPD_COEF, 1036 1037 ALC880_FIXUP_TCL_S700, ··· 1087 1086 { 0x16, 0x411111f0 }, 1088 1087 { 0x18, 0x411111f0 }, 1089 1088 { 0x1a, 0x411111f0 }, 1089 + { } 1090 + } 1091 + }, 1092 + [ALC880_FIXUP_LG_LW25] = { 1093 + .type = HDA_FIXUP_PINS, 1094 + .v.pins = (const struct hda_pintbl[]) { 1095 + { 0x1a, 0x0181344f }, /* line-in */ 1096 + { 0x1b, 0x0321403f }, /* headphone */ 1090 1097 { } 1091 1098 } 1092 1099 }, ··· 1350 1341 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG), 1351 1342 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG), 1352 1343 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG), 1344 + SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25), 1353 1345 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700), 1354 1346 1355 1347 /* Below is the copied entries from alc880_quirks.c. ··· 4339 4329 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), 4340 4330 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), 4341 4331 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), 4332 + SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), 4342 4333 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), 4343 4334 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 4344 4335 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
+1
sound/pci/hda/patch_sigmatel.c
··· 2819 2819 2820 2820 /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */ 2821 2821 static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = { 2822 + SND_PCI_QUIRK(0x0000, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3), 2822 2823 SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1), 2823 2824 SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2), 2824 2825 SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),
+1 -1
sound/soc/au1x/ac97c.c
··· 341 341 .remove = au1xac97c_drvremove, 342 342 }; 343 343 344 - module_platform_driver(&au1xac97c_driver); 344 + module_platform_driver(au1xac97c_driver); 345 345 346 346 MODULE_LICENSE("GPL"); 347 347 MODULE_DESCRIPTION("Au1000/1500/1100 AC97C ASoC driver");
+3 -2
sound/soc/blackfin/bf5xx-ac97.c
··· 294 294 /* Request PB3 as reset pin */ 295 295 ret = devm_gpio_request_one(&pdev->dev, 296 296 CONFIG_SND_BF5XX_RESET_GPIO_NUM, 297 - GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET") { 297 + GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET"); 298 + if (ret) { 298 299 dev_err(&pdev->dev, 299 300 "Failed to request GPIO_%d for reset: %d\n", 300 301 CONFIG_SND_BF5XX_RESET_GPIO_NUM, ret); 301 - goto gpio_err; 302 + return ret; 302 303 } 303 304 #endif 304 305
-1
sound/soc/blackfin/bf5xx-ac97.h
··· 9 9 #ifndef _BF5XX_AC97_H 10 10 #define _BF5XX_AC97_H 11 11 12 - extern struct snd_ac97_bus_ops bf5xx_ac97_ops; 13 12 extern struct snd_ac97 *ac97; 14 13 /* Frame format in memory, only support stereo currently */ 15 14 struct ac97_frame {
+4 -1
sound/soc/codecs/cs42l52.c
··· 195 195 196 196 static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0); 197 197 198 + static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0); 199 + 198 200 static const unsigned int limiter_tlv[] = { 199 201 TLV_DB_RANGE_HEAD(2), 200 202 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0), ··· 453 451 SOC_ENUM("Beep Pitch", beep_pitch_enum), 454 452 SOC_ENUM("Beep on Time", beep_ontime_enum), 455 453 SOC_ENUM("Beep off Time", beep_offtime_enum), 456 - SOC_SINGLE_TLV("Beep Volume", CS42L52_BEEP_VOL, 0, 0x1f, 0x07, hl_tlv), 454 + SOC_SINGLE_SX_TLV("Beep Volume", CS42L52_BEEP_VOL, 455 + 0, 0x07, 0x1f, beep_tlv), 457 456 SOC_SINGLE("Beep Mixer Switch", CS42L52_BEEP_TONE_CTL, 5, 1, 1), 458 457 SOC_ENUM("Beep Treble Corner Freq", beep_treble_enum), 459 458 SOC_ENUM("Beep Bass Corner Freq", beep_bass_enum),
+14 -4
sound/soc/codecs/sgtl5000.c
··· 153 153 static int power_vag_event(struct snd_soc_dapm_widget *w, 154 154 struct snd_kcontrol *kcontrol, int event) 155 155 { 156 + const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP; 157 + 156 158 switch (event) { 157 159 case SND_SOC_DAPM_POST_PMU: 158 160 snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, ··· 162 160 break; 163 161 164 162 case SND_SOC_DAPM_PRE_PMD: 165 - snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, 166 - SGTL5000_VAG_POWERUP, 0); 167 - msleep(400); 163 + /* 164 + * Don't clear VAG_POWERUP, when both DAC and ADC are 165 + * operational to prevent inadvertently starving the 166 + * other one of them. 167 + */ 168 + if ((snd_soc_read(w->codec, SGTL5000_CHIP_ANA_POWER) & 169 + mask) != mask) { 170 + snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, 171 + SGTL5000_VAG_POWERUP, 0); 172 + msleep(400); 173 + } 168 174 break; 169 175 default: 170 176 break; ··· 398 388 SOC_DOUBLE("Capture Volume", SGTL5000_CHIP_ANA_ADC_CTRL, 0, 4, 0xf, 0), 399 389 SOC_SINGLE_TLV("Capture Attenuate Switch (-6dB)", 400 390 SGTL5000_CHIP_ANA_ADC_CTRL, 401 - 8, 2, 0, capture_6db_attenuate), 391 + 8, 1, 0, capture_6db_attenuate), 402 392 SOC_SINGLE("Capture ZC Switch", SGTL5000_CHIP_ANA_CTRL, 1, 1, 0), 403 393 404 394 SOC_DOUBLE_TLV("Headphone Playback Volume",
+12 -12
sound/soc/codecs/wm0010.c
··· 410 410 rec->command, rec->length); 411 411 len = rec->length + 8; 412 412 413 + xfer = kzalloc(sizeof(*xfer), GFP_KERNEL); 414 + if (!xfer) { 415 + dev_err(codec->dev, "Failed to allocate xfer\n"); 416 + ret = -ENOMEM; 417 + goto abort; 418 + } 419 + 420 + xfer->codec = codec; 421 + list_add_tail(&xfer->list, &xfer_list); 422 + 413 423 out = kzalloc(len, GFP_KERNEL); 414 424 if (!out) { 415 425 dev_err(codec->dev, ··· 427 417 ret = -ENOMEM; 428 418 goto abort1; 429 419 } 420 + xfer->t.rx_buf = out; 430 421 431 422 img = kzalloc(len, GFP_KERNEL); 432 423 if (!img) { ··· 436 425 ret = -ENOMEM; 437 426 goto abort1; 438 427 } 428 + xfer->t.tx_buf = img; 439 429 440 430 byte_swap_64((u64 *)&rec->command, img, len); 441 - 442 - xfer = kzalloc(sizeof(*xfer), GFP_KERNEL); 443 - if (!xfer) { 444 - dev_err(codec->dev, "Failed to allocate xfer\n"); 445 - ret = -ENOMEM; 446 - goto abort1; 447 - } 448 - 449 - xfer->codec = codec; 450 - list_add_tail(&xfer->list, &xfer_list); 451 431 452 432 spi_message_init(&xfer->m); 453 433 xfer->m.complete = wm0010_boot_xfer_complete; 454 434 xfer->m.context = xfer; 455 - xfer->t.tx_buf = img; 456 - xfer->t.rx_buf = out; 457 435 xfer->t.len = len; 458 436 xfer->t.bits_per_word = 8; 459 437
+6 -6
sound/soc/soc-dapm.c
··· 679 679 return -EINVAL; 680 680 } 681 681 682 - path = list_first_entry(&w->sources, struct snd_soc_dapm_path, 683 - list_sink); 684 - if (!path) { 682 + if (list_empty(&w->sources)) { 685 683 dev_err(dapm->dev, "ASoC: mux %s has no paths\n", w->name); 686 684 return -EINVAL; 687 685 } 686 + 687 + path = list_first_entry(&w->sources, struct snd_soc_dapm_path, 688 + list_sink); 688 689 689 690 ret = dapm_create_or_share_mixmux_kcontrol(w, 0, path); 690 691 if (ret < 0) ··· 2734 2733 } 2735 2734 2736 2735 mutex_unlock(&card->dapm_mutex); 2737 - return 0; 2736 + return change; 2738 2737 } 2739 2738 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw); 2740 2739 ··· 2862 2861 struct soc_enum *e = 2863 2862 (struct soc_enum *)kcontrol->private_value; 2864 2863 int change; 2865 - int ret = 0; 2866 2864 int wi; 2867 2865 2868 2866 if (ucontrol->value.enumerated.item[0] >= e->max) ··· 2881 2881 } 2882 2882 2883 2883 mutex_unlock(&card->dapm_mutex); 2884 - return ret; 2884 + return change; 2885 2885 } 2886 2886 EXPORT_SYMBOL_GPL(snd_soc_dapm_put_enum_virt); 2887 2887
+1 -1
sound/soc/tegra/tegra30_i2s.c
··· 228 228 reg = TEGRA30_I2S_CIF_RX_CTRL; 229 229 } else { 230 230 val |= TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX; 231 - reg = TEGRA30_I2S_CIF_RX_CTRL; 231 + reg = TEGRA30_I2S_CIF_TX_CTRL; 232 232 } 233 233 234 234 regmap_write(i2s->regmap, reg, val);
+33 -5
sound/usb/6fire/comm.c
··· 110 110 static int usb6fire_comm_write8(struct comm_runtime *rt, u8 request, 111 111 u8 reg, u8 value) 112 112 { 113 - u8 buffer[13]; /* 13: maximum length of message */ 113 + u8 *buffer; 114 + int ret; 115 + 116 + /* 13: maximum length of message */ 117 + buffer = kmalloc(13, GFP_KERNEL); 118 + if (!buffer) 119 + return -ENOMEM; 114 120 115 121 usb6fire_comm_init_buffer(buffer, 0x00, request, reg, value, 0x00); 116 - return usb6fire_comm_send_buffer(buffer, rt->chip->dev); 122 + ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev); 123 + 124 + kfree(buffer); 125 + return ret; 117 126 } 118 127 119 128 static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request, 120 129 u8 reg, u8 vl, u8 vh) 121 130 { 122 - u8 buffer[13]; /* 13: maximum length of message */ 131 + u8 *buffer; 132 + int ret; 133 + 134 + /* 13: maximum length of message */ 135 + buffer = kmalloc(13, GFP_KERNEL); 136 + if (!buffer) 137 + return -ENOMEM; 123 138 124 139 usb6fire_comm_init_buffer(buffer, 0x00, request, reg, vl, vh); 125 - return usb6fire_comm_send_buffer(buffer, rt->chip->dev); 140 + ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev); 141 + 142 + kfree(buffer); 143 + return ret; 126 144 } 127 145 128 146 int usb6fire_comm_init(struct sfire_chip *chip) ··· 152 134 153 135 if (!rt) 154 136 return -ENOMEM; 137 + 138 + rt->receiver_buffer = kzalloc(COMM_RECEIVER_BUFSIZE, GFP_KERNEL); 139 + if (!rt->receiver_buffer) { 140 + kfree(rt); 141 + return -ENOMEM; 142 + } 155 143 156 144 urb = &rt->receiver; 157 145 rt->serial = 1; ··· 177 153 urb->interval = 1; 178 154 ret = usb_submit_urb(urb, GFP_KERNEL); 179 155 if (ret < 0) { 156 + kfree(rt->receiver_buffer); 180 157 kfree(rt); 181 158 snd_printk(KERN_ERR PREFIX "cannot create comm data receiver."); 182 159 return ret; ··· 196 171 197 172 void usb6fire_comm_destroy(struct sfire_chip *chip) 198 173 { 199 - kfree(chip->comm); 174 + struct comm_runtime *rt = chip->comm; 175 + 176 + kfree(rt->receiver_buffer); 177 + kfree(rt); 200 178 chip->comm = NULL; 201 179 }
+1 -1
sound/usb/6fire/comm.h
··· 24 24 struct sfire_chip *chip; 25 25 26 26 struct urb receiver; 27 - u8 receiver_buffer[COMM_RECEIVER_BUFSIZE]; 27 + u8 *receiver_buffer; 28 28 29 29 u8 serial; /* urb serial */ 30 30
+15 -1
sound/usb/6fire/midi.c
··· 19 19 #include "chip.h" 20 20 #include "comm.h" 21 21 22 + enum { 23 + MIDI_BUFSIZE = 64 24 + }; 25 + 22 26 static void usb6fire_midi_out_handler(struct urb *urb) 23 27 { 24 28 struct midi_runtime *rt = urb->context; ··· 160 156 if (!rt) 161 157 return -ENOMEM; 162 158 159 + rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL); 160 + if (!rt->out_buffer) { 161 + kfree(rt); 162 + return -ENOMEM; 163 + } 164 + 163 165 rt->chip = chip; 164 166 rt->in_received = usb6fire_midi_in_received; 165 167 rt->out_buffer[0] = 0x80; /* 'send midi' command */ ··· 179 169 180 170 ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance); 181 171 if (ret < 0) { 172 + kfree(rt->out_buffer); 182 173 kfree(rt); 183 174 snd_printk(KERN_ERR PREFIX "unable to create midi.\n"); 184 175 return ret; ··· 208 197 209 198 void usb6fire_midi_destroy(struct sfire_chip *chip) 210 199 { 211 - kfree(chip->midi); 200 + struct midi_runtime *rt = chip->midi; 201 + 202 + kfree(rt->out_buffer); 203 + kfree(rt); 212 204 chip->midi = NULL; 213 205 }
+1 -5
sound/usb/6fire/midi.h
··· 16 16 17 17 #include "common.h" 18 18 19 - enum { 20 - MIDI_BUFSIZE = 64 21 - }; 22 - 23 19 struct midi_runtime { 24 20 struct sfire_chip *chip; 25 21 struct snd_rawmidi *instance; ··· 28 32 struct snd_rawmidi_substream *out; 29 33 struct urb out_urb; 30 34 u8 out_serial; /* serial number of out packet */ 31 - u8 out_buffer[MIDI_BUFSIZE]; 35 + u8 *out_buffer; 32 36 int buffer_offset; 33 37 34 38 void (*in_received)(struct midi_runtime *rt, u8 *data, int length);
+40 -1
sound/usb/6fire/pcm.c
··· 582 582 urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB; 583 583 } 584 584 585 + static int usb6fire_pcm_buffers_init(struct pcm_runtime *rt) 586 + { 587 + int i; 588 + 589 + for (i = 0; i < PCM_N_URBS; i++) { 590 + rt->out_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB 591 + * PCM_MAX_PACKET_SIZE, GFP_KERNEL); 592 + if (!rt->out_urbs[i].buffer) 593 + return -ENOMEM; 594 + rt->in_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB 595 + * PCM_MAX_PACKET_SIZE, GFP_KERNEL); 596 + if (!rt->in_urbs[i].buffer) 597 + return -ENOMEM; 598 + } 599 + return 0; 600 + } 601 + 602 + static void usb6fire_pcm_buffers_destroy(struct pcm_runtime *rt) 603 + { 604 + int i; 605 + 606 + for (i = 0; i < PCM_N_URBS; i++) { 607 + kfree(rt->out_urbs[i].buffer); 608 + kfree(rt->in_urbs[i].buffer); 609 + } 610 + } 611 + 585 612 int usb6fire_pcm_init(struct sfire_chip *chip) 586 613 { 587 614 int i; ··· 619 592 620 593 if (!rt) 621 594 return -ENOMEM; 595 + 596 + ret = usb6fire_pcm_buffers_init(rt); 597 + if (ret) { 598 + usb6fire_pcm_buffers_destroy(rt); 599 + kfree(rt); 600 + return ret; 601 + } 622 602 623 603 rt->chip = chip; 624 604 rt->stream_state = STREAM_DISABLED; ··· 648 614 649 615 ret = snd_pcm_new(chip->card, "DMX6FireUSB", 0, 1, 1, &pcm); 650 616 if (ret < 0) { 617 + usb6fire_pcm_buffers_destroy(rt); 651 618 kfree(rt); 652 619 snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n"); 653 620 return ret; ··· 660 625 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops); 661 626 662 627 if (ret) { 628 + usb6fire_pcm_buffers_destroy(rt); 663 629 kfree(rt); 664 630 snd_printk(KERN_ERR PREFIX 665 631 "error preallocating pcm buffers.\n"); ··· 705 669 706 670 void usb6fire_pcm_destroy(struct sfire_chip *chip) 707 671 { 708 - kfree(chip->pcm); 672 + struct pcm_runtime *rt = chip->pcm; 673 + 674 + usb6fire_pcm_buffers_destroy(rt); 675 + kfree(rt); 709 676 chip->pcm = NULL; 710 677 }
+1 -1
sound/usb/6fire/pcm.h
··· 32 32 struct urb instance; 33 33 struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB]; 34 34 /* END DO NOT SEPARATE */ 35 - u8 buffer[PCM_N_PACKETS_PER_URB * PCM_MAX_PACKET_SIZE]; 35 + u8 *buffer; 36 36 37 37 struct pcm_urb *peer; 38 38 };
+6 -7
sound/usb/endpoint.c
··· 591 591 ep->stride = frame_bits >> 3; 592 592 ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; 593 593 594 - /* calculate max. frequency */ 595 - if (ep->maxpacksize) { 594 + /* assume max. frequency is 25% higher than nominal */ 595 + ep->freqmax = ep->freqn + (ep->freqn >> 2); 596 + maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) 597 + >> (16 - ep->datainterval); 598 + /* but wMaxPacketSize might reduce this */ 599 + if (ep->maxpacksize && ep->maxpacksize < maxsize) { 596 600 /* whatever fits into a max. size packet */ 597 601 maxsize = ep->maxpacksize; 598 602 ep->freqmax = (maxsize / (frame_bits >> 3)) 599 603 << (16 - ep->datainterval); 600 - } else { 601 - /* no max. packet size: just take 25% higher than nominal */ 602 - ep->freqmax = ep->freqn + (ep->freqn >> 2); 603 - maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) 604 - >> (16 - ep->datainterval); 605 604 } 606 605 607 606 if (ep->fill_max)
+1
sound/usb/mixer.c
··· 888 888 case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */ 889 889 case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ 890 890 case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ 891 + case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */ 891 892 case USB_ID(0x046d, 0x0991): 892 893 /* Most audio usb devices lie about volume resolution. 893 894 * Most Logitech webcams have res = 384.
+3 -3
sound/usb/quirks.c
··· 319 319 if (altsd->bNumEndpoints < 1) 320 320 return -ENODEV; 321 321 epd = get_endpoint(alts, 0); 322 - if (!usb_endpoint_xfer_bulk(epd) || 322 + if (!usb_endpoint_xfer_bulk(epd) && 323 323 !usb_endpoint_xfer_int(epd)) 324 324 return -ENODEV; 325 325 326 326 switch (USB_ID_VENDOR(chip->usb_id)) { 327 327 case 0x0499: /* Yamaha */ 328 328 err = create_yamaha_midi_quirk(chip, iface, driver, alts); 329 - if (err < 0 && err != -ENODEV) 329 + if (err != -ENODEV) 330 330 return err; 331 331 break; 332 332 case 0x0582: /* Roland */ 333 333 err = create_roland_midi_quirk(chip, iface, driver, alts); 334 - if (err < 0 && err != -ENODEV) 334 + if (err != -ENODEV) 335 335 return err; 336 336 break; 337 337 }