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

Merge tag 'v3.18-rc7' into drm-next

This fixes a bunch of conflicts prior to merging i915 tree.

Linux 3.18-rc7

Conflicts:
drivers/gpu/drm/exynos/exynos_drm_drv.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/tegra/dc.c

+5475 -2568
+4 -2
Documentation/devicetree/bindings/ata/sata_rcar.txt
··· 3 3 Required properties: 4 4 - compatible : should contain one of the following: 5 5 - "renesas,sata-r8a7779" for R-Car H1 6 - - "renesas,sata-r8a7790" for R-Car H2 7 - - "renesas,sata-r8a7791" for R-Car M2 6 + - "renesas,sata-r8a7790-es1" for R-Car H2 ES1 7 + - "renesas,sata-r8a7790" for R-Car H2 other than ES1 8 + - "renesas,sata-r8a7791" for R-Car M2-W 9 + - "renesas,sata-r8a7793" for R-Car M2-N 8 10 - reg : address and length of the SATA registers; 9 11 - interrupts : must consist of one interrupt specifier. 10 12
-4
Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
··· 30 30 Example: 31 31 interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; 32 32 33 - A device node may contain either "interrupts" or "interrupts-extended", but not 34 - both. If both properties are present, then the operating system should log an 35 - error and use only the data in "interrupts". 36 - 37 33 2) Interrupt controller nodes 38 34 ----------------------------- 39 35
+11
Documentation/devicetree/bindings/pci/pci.txt
··· 7 7 8 8 Open Firmware Recommended Practice: Interrupt Mapping 9 9 http://www.openfirmware.org/1275/practice/imap/imap0_9d.pdf 10 + 11 + Additionally to the properties specified in the above standards a host bridge 12 + driver implementation may support the following properties: 13 + 14 + - linux,pci-domain: 15 + If present this property assigns a fixed PCI domain number to a host bridge, 16 + otherwise an unstable (across boots) unique number will be assigned. 17 + It is required to either not set this property at all or set it for all 18 + host bridges in the system, otherwise potentially conflicting domain numbers 19 + may be assigned to root buses behind different host bridges. The domain 20 + number for each host bridge in the system must be unique.
+1 -1
Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt
··· 9 9 common pinctrl bindings used by client devices, including the meaning of the 10 10 phrase "pin configuration node". 11 11 12 - TZ1090-PDC's pin configuration nodes act as a container for an abitrary number 12 + TZ1090-PDC's pin configuration nodes act as a container for an arbitrary number 13 13 of subnodes. Each of these subnodes represents some desired configuration for a 14 14 pin, a group, or a list of pins or groups. This configuration can include the 15 15 mux function to select on those pin(s)/group(s), and various pin configuration
+1 -1
Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt
··· 9 9 common pinctrl bindings used by client devices, including the meaning of the 10 10 phrase "pin configuration node". 11 11 12 - TZ1090's pin configuration nodes act as a container for an abitrary number of 12 + TZ1090's pin configuration nodes act as a container for an arbitrary number of 13 13 subnodes. Each of these subnodes represents some desired configuration for a 14 14 pin, a group, or a list of pins or groups. This configuration can include the 15 15 mux function to select on those pin(s)/group(s), and various pin configuration
+1 -1
Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt
··· 9 9 common pinctrl bindings used by client devices, including the meaning of the 10 10 phrase "pin configuration node". 11 11 12 - Lantiq's pin configuration nodes act as a container for an abitrary number of 12 + Lantiq's pin configuration nodes act as a container for an arbitrary number of 13 13 subnodes. Each of these subnodes represents some desired configuration for a 14 14 pin, a group, or a list of pins or groups. This configuration can include the 15 15 mux function to select on those group(s), and two pin configuration parameters:
+1 -1
Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt
··· 9 9 common pinctrl bindings used by client devices, including the meaning of the 10 10 phrase "pin configuration node". 11 11 12 - Lantiq's pin configuration nodes act as a container for an abitrary number of 12 + Lantiq's pin configuration nodes act as a container for an arbitrary number of 13 13 subnodes. Each of these subnodes represents some desired configuration for a 14 14 pin, a group, or a list of pins or groups. This configuration can include the 15 15 mux function to select on those group(s), and two pin configuration parameters:
+1 -1
Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
··· 9 9 common pinctrl bindings used by client devices, including the meaning of the 10 10 phrase "pin configuration node". 11 11 12 - Tegra's pin configuration nodes act as a container for an abitrary number of 12 + Tegra's pin configuration nodes act as a container for an arbitrary number of 13 13 subnodes. Each of these subnodes represents some desired configuration for a 14 14 pin, a group, or a list of pins or groups. This configuration can include the 15 15 mux function to select on those pin(s)/group(s), and various pin configuration
+1 -1
Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt
··· 13 13 Please refer to pinctrl-bindings.txt in this directory for details of the common 14 14 pinctrl bindings used by client devices. 15 15 16 - SiRFprimaII's pinmux nodes act as a container for an abitrary number of subnodes. 16 + SiRFprimaII's pinmux nodes act as a container for an arbitrary number of subnodes. 17 17 Each of these subnodes represents some desired configuration for a group of pins. 18 18 19 19 Required subnode-properties:
+1 -1
Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt
··· 32 32 Please refer to pinctrl-bindings.txt in this directory for details of the common 33 33 pinctrl bindings used by client devices. 34 34 35 - SPEAr's pinmux nodes act as a container for an abitrary number of subnodes. Each 35 + SPEAr's pinmux nodes act as a container for an arbitrary number of subnodes. Each 36 36 of these subnodes represents muxing for a pin, a group, or a list of pins or 37 37 groups. 38 38
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
··· 18 18 common pinctrl bindings used by client devices, including the meaning of the 19 19 phrase "pin configuration node". 20 20 21 - Qualcomm's pin configuration nodes act as a container for an abitrary number of 21 + Qualcomm's pin configuration nodes act as a container for an arbitrary number of 22 22 subnodes. Each of these subnodes represents some desired configuration for a 23 23 pin, a group, or a list of pins or groups. This configuration can include the 24 24 mux function to select on those pin(s)/group(s), and various pin configuration
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt
··· 47 47 common pinctrl bindings used by client devices, including the meaning of the 48 48 phrase "pin configuration node". 49 49 50 - The pin configuration nodes act as a container for an abitrary number of 50 + The pin configuration nodes act as a container for an arbitrary number of 51 51 subnodes. Each of these subnodes represents some desired configuration for a 52 52 pin, a group, or a list of pins or groups. This configuration can include the 53 53 mux function to select on those pin(s)/group(s), and various pin configuration
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt
··· 18 18 common pinctrl bindings used by client devices, including the meaning of the 19 19 phrase "pin configuration node". 20 20 21 - Qualcomm's pin configuration nodes act as a container for an abitrary number of 21 + Qualcomm's pin configuration nodes act as a container for an arbitrary number of 22 22 subnodes. Each of these subnodes represents some desired configuration for a 23 23 pin, a group, or a list of pins or groups. This configuration can include the 24 24 mux function to select on those pin(s)/group(s), and various pin configuration
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt
··· 47 47 common pinctrl bindings used by client devices, including the meaning of the 48 48 phrase "pin configuration node". 49 49 50 - The pin configuration nodes act as a container for an abitrary number of 50 + The pin configuration nodes act as a container for an arbitrary number of 51 51 subnodes. Each of these subnodes represents some desired configuration for a 52 52 pin, a group, or a list of pins or groups. This configuration can include the 53 53 mux function to select on those pin(s)/group(s), and various pin configuration
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
··· 18 18 common pinctrl bindings used by client devices, including the meaning of the 19 19 phrase "pin configuration node". 20 20 21 - Qualcomm's pin configuration nodes act as a container for an abitrary number of 21 + Qualcomm's pin configuration nodes act as a container for an arbitrary number of 22 22 subnodes. Each of these subnodes represents some desired configuration for a 23 23 pin, a group, or a list of pins or groups. This configuration can include the 24 24 mux function to select on those pin(s)/group(s), and various pin configuration
+4 -1
Documentation/devicetree/bindings/vendor-prefixes.txt
··· 34 34 chrp Common Hardware Reference Platform 35 35 chunghwa Chunghwa Picture Tubes Ltd. 36 36 cirrus Cirrus Logic, Inc. 37 + cnm Chips&Media, Inc. 37 38 cortina Cortina Systems, Inc. 38 39 crystalfontz Crystalfontz America, Inc. 39 40 dallas Maxim Integrated Products (formerly Dallas Semiconductor) ··· 95 94 mediatek MediaTek Inc. 96 95 micrel Micrel Inc. 97 96 microchip Microchip Technology Inc. 97 + micron Micron Technology Inc. 98 98 mitsubishi Mitsubishi Electric Corporation 99 99 mosaixtech Mosaix Technologies, Inc. 100 100 moxa Moxa ··· 131 129 ricoh Ricoh Co. Ltd. 132 130 rockchip Fuzhou Rockchip Electronics Co., Ltd 133 131 samsung Samsung Semiconductor 132 + sandisk Sandisk Corporation 134 133 sbs Smart Battery System 135 134 schindler Schindler 136 135 seagate Seagate Technology PLC ··· 143 140 sirf SiRF Technology, Inc. 144 141 sitronix Sitronix Technology Corporation 145 142 smsc Standard Microsystems Corporation 146 - snps Synopsys, Inc. 143 + snps Synopsys, Inc. 147 144 solidrun SolidRun 148 145 sony Sony Corporation 149 146 spansion Spansion Inc.
+1 -1
Documentation/filesystems/overlayfs.txt
··· 64 64 At mount time, the two directories given as mount options "lowerdir" and 65 65 "upperdir" are combined into a merged directory: 66 66 67 - mount -t overlayfs overlayfs -olowerdir=/lower,upperdir=/upper,\ 67 + mount -t overlay overlay -olowerdir=/lower,upperdir=/upper,\ 68 68 workdir=/work /merged 69 69 70 70 The "workdir" needs to be an empty directory on the same filesystem
+75 -6
Documentation/input/elantech.txt
··· 38 38 7.2.1 Status packet 39 39 7.2.2 Head packet 40 40 7.2.3 Motion packet 41 + 8. Trackpoint (for Hardware version 3 and 4) 42 + 8.1 Registers 43 + 8.2 Native relative mode 6 byte packet format 44 + 8.2.1 Status Packet 41 45 42 46 43 47 44 48 1. Introduction 45 49 ~~~~~~~~~~~~ 46 50 47 - Currently the Linux Elantech touchpad driver is aware of two different 48 - hardware versions unimaginatively called version 1 and version 2. Version 1 49 - is found in "older" laptops and uses 4 bytes per packet. Version 2 seems to 50 - be introduced with the EeePC and uses 6 bytes per packet, and provides 51 - additional features such as position of two fingers, and width of the touch. 51 + Currently the Linux Elantech touchpad driver is aware of four different 52 + hardware versions unimaginatively called version 1,version 2, version 3 53 + and version 4. Version 1 is found in "older" laptops and uses 4 bytes per 54 + packet. Version 2 seems to be introduced with the EeePC and uses 6 bytes 55 + per packet, and provides additional features such as position of two fingers, 56 + and width of the touch. Hardware version 3 uses 6 bytes per packet (and 57 + for 2 fingers the concatenation of two 6 bytes packets) and allows tracking 58 + of up to 3 fingers. Hardware version 4 uses 6 bytes per packet, and can 59 + combine a status packet with multiple head or motion packets. Hardware version 60 + 4 allows tracking up to 5 fingers. 61 + 62 + Some Hardware version 3 and version 4 also have a trackpoint which uses a 63 + separate packet format. It is also 6 bytes per packet. 52 64 53 65 The driver tries to support both hardware versions and should be compatible 54 66 with the Xorg Synaptics touchpad driver and its graphical configuration 55 67 utilities. 68 + 69 + Note that a mouse button is also associated with either the touchpad or the 70 + trackpoint when a trackpoint is available. Disabling the Touchpad in xorg 71 + (TouchPadOff=0) will also disable the buttons associated with the touchpad. 56 72 57 73 Additionally the operation of the touchpad can be altered by adjusting the 58 74 contents of some of its internal registers. These registers are represented ··· 94 78 2. Extra knobs 95 79 ~~~~~~~~~~~ 96 80 97 - Currently the Linux Elantech touchpad driver provides two extra knobs under 81 + Currently the Linux Elantech touchpad driver provides three extra knobs under 98 82 /sys/bus/serio/drivers/psmouse/serio? for the user. 99 83 100 84 * debug ··· 127 111 Hardware version 2 does not provide the same parity bits. Only some basic 128 112 data consistency checking can be done. For now checking is disabled by 129 113 default. Currently even turning it on will do nothing. 114 + 115 + * crc_enabled 116 + 117 + Sets crc_enabled to 0/1. The name "crc_enabled" is the official name of 118 + this integrity check, even though it is not an actual cyclic redundancy 119 + check. 120 + 121 + Depending on the state of crc_enabled, certain basic data integrity 122 + verification is done by the driver on hardware version 3 and 4. The 123 + driver will reject any packet that appears corrupted. Using this knob, 124 + The state of crc_enabled can be altered with this knob. 125 + 126 + Reading the crc_enabled value will show the active value. Echoing 127 + "0" or "1" to this file will set the state to "0" or "1". 130 128 131 129 ///////////////////////////////////////////////////////////////////////////// 132 130 ··· 776 746 777 747 byte 0 ~ 2 for one finger 778 748 byte 3 ~ 5 for another 749 + 750 + 751 + 8. Trackpoint (for Hardware version 3 and 4) 752 + ========================================= 753 + 8.1 Registers 754 + ~~~~~~~~~ 755 + No special registers have been identified. 756 + 757 + 8.2 Native relative mode 6 byte packet format 758 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 759 + 8.2.1 Status Packet 760 + ~~~~~~~~~~~~~ 761 + 762 + byte 0: 763 + bit 7 6 5 4 3 2 1 0 764 + 0 0 sx sy 0 M R L 765 + byte 1: 766 + bit 7 6 5 4 3 2 1 0 767 + ~sx 0 0 0 0 0 0 0 768 + byte 2: 769 + bit 7 6 5 4 3 2 1 0 770 + ~sy 0 0 0 0 0 0 0 771 + byte 3: 772 + bit 7 6 5 4 3 2 1 0 773 + 0 0 ~sy ~sx 0 1 1 0 774 + byte 4: 775 + bit 7 6 5 4 3 2 1 0 776 + x7 x6 x5 x4 x3 x2 x1 x0 777 + byte 5: 778 + bit 7 6 5 4 3 2 1 0 779 + y7 y6 y5 y4 y3 y2 y1 y0 780 + 781 + 782 + x and y are written in two's complement spread 783 + over 9 bits with sx/sy the relative top bit and 784 + x7..x0 and y7..y0 the lower bits. 785 + ~sx is the inverse of sx, ~sy is the inverse of sy. 786 + The sign of y is opposite to what the input driver 787 + expects for a relative movement
+14
Documentation/networking/ip-sysctl.txt
··· 56 56 0 - disabled 57 57 1 - enabled 58 58 59 + fwmark_reflect - BOOLEAN 60 + Controls the fwmark of kernel-generated IPv4 reply packets that are not 61 + associated with a socket for example, TCP RSTs or ICMP echo replies). 62 + If unset, these packets have a fwmark of zero. If set, they have the 63 + fwmark of the packet they are replying to. 64 + Default: 0 65 + 59 66 route/max_size - INTEGER 60 67 Maximum number of routes allowed in the kernel. Increase 61 68 this when using large numbers of interfaces and/or routes. ··· 1207 1200 1208 1201 proxy_ndp - BOOLEAN 1209 1202 Do proxy ndp. 1203 + 1204 + fwmark_reflect - BOOLEAN 1205 + Controls the fwmark of kernel-generated IPv6 reply packets that are not 1206 + associated with a socket for example, TCP RSTs or ICMPv6 echo replies). 1207 + If unset, these packets have a fwmark of zero. If set, they have the 1208 + fwmark of the packet they are replying to. 1209 + Default: 0 1210 1210 1211 1211 conf/interface/*: 1212 1212 Change special settings per interface.
+1 -1
Documentation/networking/timestamping.txt
··· 136 136 137 137 This option is implemented only for transmit timestamps. There, the 138 138 timestamp is always looped along with a struct sock_extended_err. 139 - The option modifies field ee_info to pass an id that is unique 139 + The option modifies field ee_data to pass an id that is unique 140 140 among all possibly concurrently outstanding timestamp requests for 141 141 that socket. In practice, it is a monotonically increasing u32 142 142 (that wraps).
+39 -3
MAINTAINERS
··· 2754 2754 S: Supported 2755 2755 F: drivers/net/ethernet/chelsio/cxgb3/ 2756 2756 2757 + CXGB3 ISCSI DRIVER (CXGB3I) 2758 + M: Karen Xie <kxie@chelsio.com> 2759 + L: linux-scsi@vger.kernel.org 2760 + W: http://www.chelsio.com 2761 + S: Supported 2762 + F: drivers/scsi/cxgbi/cxgb3i 2763 + 2757 2764 CXGB3 IWARP RNIC DRIVER (IW_CXGB3) 2758 2765 M: Steve Wise <swise@chelsio.com> 2759 2766 L: linux-rdma@vger.kernel.org ··· 2774 2767 W: http://www.chelsio.com 2775 2768 S: Supported 2776 2769 F: drivers/net/ethernet/chelsio/cxgb4/ 2770 + 2771 + CXGB4 ISCSI DRIVER (CXGB4I) 2772 + M: Karen Xie <kxie@chelsio.com> 2773 + L: linux-scsi@vger.kernel.org 2774 + W: http://www.chelsio.com 2775 + S: Supported 2776 + F: drivers/scsi/cxgbi/cxgb4i 2777 2777 2778 2778 CXGB4 IWARP RNIC DRIVER (IW_CXGB4) 2779 2779 M: Steve Wise <swise@chelsio.com> ··· 4747 4733 S: Maintained 4748 4734 F: drivers/iio/ 4749 4735 F: drivers/staging/iio/ 4736 + F: include/linux/iio/ 4750 4737 4751 4738 IKANOS/ADI EAGLE ADSL USB DRIVER 4752 4739 M: Matthieu Castet <castet.matthieu@free.fr> ··· 6628 6613 S: Maintained 6629 6614 F: arch/arm/*omap*/ 6630 6615 F: drivers/i2c/busses/i2c-omap.c 6616 + F: drivers/irqchip/irq-omap-intc.c 6617 + F: drivers/mfd/*omap*.c 6618 + F: drivers/mfd/menelaus.c 6619 + F: drivers/mfd/palmas.c 6620 + F: drivers/mfd/tps65217.c 6621 + F: drivers/mfd/tps65218.c 6622 + F: drivers/mfd/tps65910.c 6623 + F: drivers/mfd/twl-core.[ch] 6624 + F: drivers/mfd/twl4030*.c 6625 + F: drivers/mfd/twl6030*.c 6626 + F: drivers/mfd/twl6040*.c 6627 + F: drivers/regulator/palmas-regulator*.c 6628 + F: drivers/regulator/pbias-regulator.c 6629 + F: drivers/regulator/tps65217-regulator.c 6630 + F: drivers/regulator/tps65218-regulator.c 6631 + F: drivers/regulator/tps65910-regulator.c 6632 + F: drivers/regulator/twl-regulator.c 6631 6633 F: include/linux/i2c-omap.h 6632 6634 6633 6635 OMAP DEVICE TREE SUPPORT ··· 6655 6623 S: Maintained 6656 6624 F: arch/arm/boot/dts/*omap* 6657 6625 F: arch/arm/boot/dts/*am3* 6626 + F: arch/arm/boot/dts/*am4* 6627 + F: arch/arm/boot/dts/*am5* 6628 + F: arch/arm/boot/dts/*dra7* 6658 6629 6659 6630 OMAP CLOCK FRAMEWORK SUPPORT 6660 6631 M: Paul Walmsley <paul@pwsan.com> ··· 6905 6870 F: include/scsi/osd_* 6906 6871 F: fs/exofs/ 6907 6872 6908 - OVERLAYFS FILESYSTEM 6873 + OVERLAY FILESYSTEM 6909 6874 M: Miklos Szeredi <miklos@szeredi.hu> 6910 - L: linux-fsdevel@vger.kernel.org 6875 + L: linux-unionfs@vger.kernel.org 6876 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git 6911 6877 S: Supported 6912 - F: fs/overlayfs/* 6878 + F: fs/overlayfs/ 6913 6879 F: Documentation/filesystems/overlayfs.txt 6914 6880 6915 6881 P54 WIRELESS DRIVER
+4 -3
Makefile
··· 1 1 VERSION = 3 2 2 PATCHLEVEL = 18 3 3 SUBLEVEL = 0 4 - EXTRAVERSION = -rc4 4 + EXTRAVERSION = -rc7 5 5 NAME = Diseased Newt 6 6 7 7 # *DOCUMENTATION* ··· 297 297 298 298 HOSTCC = gcc 299 299 HOSTCXX = g++ 300 - HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer 300 + HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 301 301 HOSTCXXFLAGS = -O2 302 302 303 303 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) ··· 401 401 KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 402 402 -fno-strict-aliasing -fno-common \ 403 403 -Werror-implicit-function-declaration \ 404 - -Wno-format-security 404 + -Wno-format-security \ 405 + -std=gnu89 405 406 406 407 KBUILD_AFLAGS_KERNEL := 407 408 KBUILD_CFLAGS_KERNEL :=
+16 -4
arch/arm/boot/compressed/head.S
··· 397 397 add sp, sp, r6 398 398 #endif 399 399 400 - tst r4, #1 401 - bleq cache_clean_flush 400 + bl cache_clean_flush 402 401 403 402 adr r0, BSYM(restart) 404 403 add r0, r0, r6 ··· 1046 1047 b call_cache_fn 1047 1048 1048 1049 __armv4_mpu_cache_flush: 1050 + tst r4, #1 1051 + movne pc, lr 1049 1052 mov r2, #1 1050 1053 mov r3, #0 1051 1054 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache ··· 1065 1064 mov pc, lr 1066 1065 1067 1066 __fa526_cache_flush: 1067 + tst r4, #1 1068 + movne pc, lr 1068 1069 mov r1, #0 1069 1070 mcr p15, 0, r1, c7, c14, 0 @ clean and invalidate D cache 1070 1071 mcr p15, 0, r1, c7, c5, 0 @ flush I cache ··· 1075 1072 1076 1073 __armv6_mmu_cache_flush: 1077 1074 mov r1, #0 1078 - mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D 1075 + tst r4, #1 1076 + mcreq p15, 0, r1, c7, c14, 0 @ clean+invalidate D 1079 1077 mcr p15, 0, r1, c7, c5, 0 @ invalidate I+BTB 1080 - mcr p15, 0, r1, c7, c15, 0 @ clean+invalidate unified 1078 + mcreq p15, 0, r1, c7, c15, 0 @ clean+invalidate unified 1081 1079 mcr p15, 0, r1, c7, c10, 4 @ drain WB 1082 1080 mov pc, lr 1083 1081 1084 1082 __armv7_mmu_cache_flush: 1083 + tst r4, #1 1084 + bne iflush 1085 1085 mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 1086 1086 tst r10, #0xf << 16 @ hierarchical cache (ARMv7) 1087 1087 mov r10, #0 ··· 1145 1139 mov pc, lr 1146 1140 1147 1141 __armv5tej_mmu_cache_flush: 1142 + tst r4, #1 1143 + movne pc, lr 1148 1144 1: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate D cache 1149 1145 bne 1b 1150 1146 mcr p15, 0, r0, c7, c5, 0 @ flush I cache ··· 1154 1146 mov pc, lr 1155 1147 1156 1148 __armv4_mmu_cache_flush: 1149 + tst r4, #1 1150 + movne pc, lr 1157 1151 mov r2, #64*1024 @ default: 32K dcache size (*2) 1158 1152 mov r11, #32 @ default: 32 byte line size 1159 1153 mrc p15, 0, r3, c0, c0, 1 @ read cache type ··· 1189 1179 1190 1180 __armv3_mmu_cache_flush: 1191 1181 __armv3_mpu_cache_flush: 1182 + tst r4, #1 1183 + movne pc, lr 1192 1184 mov r1, #0 1193 1185 mcr p15, 0, r1, c7, c0, 0 @ invalidate whole cache v3 1194 1186 mov pc, lr
+1 -1
arch/arm/boot/dts/am335x-evm.dts
··· 489 489 reg = <0x00060000 0x00020000>; 490 490 }; 491 491 partition@4 { 492 - label = "NAND.u-boot-spl"; 492 + label = "NAND.u-boot-spl-os"; 493 493 reg = <0x00080000 0x00040000>; 494 494 }; 495 495 partition@5 {
+2 -2
arch/arm/boot/dts/am437x-gp-evm.dts
··· 291 291 dcdc3: regulator-dcdc3 { 292 292 compatible = "ti,tps65218-dcdc3"; 293 293 regulator-name = "vdcdc3"; 294 - regulator-min-microvolt = <1350000>; 295 - regulator-max-microvolt = <1350000>; 294 + regulator-min-microvolt = <1500000>; 295 + regulator-max-microvolt = <1500000>; 296 296 regulator-boot-on; 297 297 regulator-always-on; 298 298 };
+2 -2
arch/arm/boot/dts/am437x-sk-evm.dts
··· 363 363 dcdc3: regulator-dcdc3 { 364 364 compatible = "ti,tps65218-dcdc3"; 365 365 regulator-name = "vdds_ddr"; 366 - regulator-min-microvolt = <1350000>; 367 - regulator-max-microvolt = <1350000>; 366 + regulator-min-microvolt = <1500000>; 367 + regulator-max-microvolt = <1500000>; 368 368 regulator-boot-on; 369 369 regulator-always-on; 370 370 };
+2 -2
arch/arm/boot/dts/am43x-epos-evm.dts
··· 358 358 dcdc3: regulator-dcdc3 { 359 359 compatible = "ti,tps65218-dcdc3"; 360 360 regulator-name = "vdcdc3"; 361 - regulator-min-microvolt = <1350000>; 362 - regulator-max-microvolt = <1350000>; 361 + regulator-min-microvolt = <1500000>; 362 + regulator-max-microvolt = <1500000>; 363 363 regulator-boot-on; 364 364 regulator-always-on; 365 365 };
+4
arch/arm/boot/dts/exynos5250-snow.dts
··· 624 624 num-cs = <1>; 625 625 }; 626 626 627 + &usbdrd_dwc3 { 628 + dr_mode = "host"; 629 + }; 630 + 627 631 #include "cros-ec-keyboard.dtsi"
+1 -1
arch/arm/boot/dts/exynos5250.dtsi
··· 555 555 #size-cells = <1>; 556 556 ranges; 557 557 558 - dwc3 { 558 + usbdrd_dwc3: dwc3 { 559 559 compatible = "synopsys,dwc3"; 560 560 reg = <0x12000000 0x10000>; 561 561 interrupts = <0 72 0>;
+1 -1
arch/arm/boot/dts/r8a7740.dtsi
··· 433 433 clocks = <&cpg_clocks R8A7740_CLK_S>, 434 434 <&cpg_clocks R8A7740_CLK_S>, <&sub_clk>, 435 435 <&cpg_clocks R8A7740_CLK_B>, 436 - <&sub_clk>, <&sub_clk>, 436 + <&cpg_clocks R8A7740_CLK_HPP>, <&sub_clk>, 437 437 <&cpg_clocks R8A7740_CLK_B>; 438 438 #clock-cells = <1>; 439 439 renesas,clock-indices = <
+2 -2
arch/arm/boot/dts/r8a7790.dtsi
··· 756 756 #clock-cells = <0>; 757 757 clock-output-names = "sd2"; 758 758 }; 759 - sd3_clk: sd3_clk@e615007c { 759 + sd3_clk: sd3_clk@e615026c { 760 760 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; 761 - reg = <0 0xe615007c 0 4>; 761 + reg = <0 0xe615026c 0 4>; 762 762 clocks = <&pll1_div2_clk>; 763 763 #clock-cells = <0>; 764 764 clock-output-names = "sd3";
+1 -1
arch/arm/boot/dts/sama5d31.dtsi
··· 12 12 #include "sama5d3_uart.dtsi" 13 13 14 14 / { 15 - compatible = "atmel,samad31", "atmel,sama5d3", "atmel,sama5"; 15 + compatible = "atmel,sama5d31", "atmel,sama5d3", "atmel,sama5"; 16 16 };
+1 -1
arch/arm/boot/dts/sama5d33.dtsi
··· 10 10 #include "sama5d3_gmac.dtsi" 11 11 12 12 / { 13 - compatible = "atmel,samad33", "atmel,sama5d3", "atmel,sama5"; 13 + compatible = "atmel,sama5d33", "atmel,sama5d3", "atmel,sama5"; 14 14 };
+1 -1
arch/arm/boot/dts/sama5d34.dtsi
··· 12 12 #include "sama5d3_mci2.dtsi" 13 13 14 14 / { 15 - compatible = "atmel,samad34", "atmel,sama5d3", "atmel,sama5"; 15 + compatible = "atmel,sama5d34", "atmel,sama5d3", "atmel,sama5"; 16 16 };
+1 -1
arch/arm/boot/dts/sama5d35.dtsi
··· 14 14 #include "sama5d3_tcb1.dtsi" 15 15 16 16 / { 17 - compatible = "atmel,samad35", "atmel,sama5d3", "atmel,sama5"; 17 + compatible = "atmel,sama5d35", "atmel,sama5d3", "atmel,sama5"; 18 18 };
+1 -1
arch/arm/boot/dts/sama5d36.dtsi
··· 16 16 #include "sama5d3_uart.dtsi" 17 17 18 18 / { 19 - compatible = "atmel,samad36", "atmel,sama5d3", "atmel,sama5"; 19 + compatible = "atmel,sama5d36", "atmel,sama5d3", "atmel,sama5"; 20 20 };
+1 -1
arch/arm/boot/dts/sama5d3xcm.dtsi
··· 8 8 */ 9 9 10 10 / { 11 - compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5"; 11 + compatible = "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; 12 12 13 13 chosen { 14 14 bootargs = "console=ttyS0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs";
+4
arch/arm/boot/dts/sun6i-a31.dtsi
··· 361 361 clocks = <&ahb1_gates 6>; 362 362 resets = <&ahb1_rst 6>; 363 363 #dma-cells = <1>; 364 + 365 + /* DMA controller requires AHB1 clocked from PLL6 */ 366 + assigned-clocks = <&ahb1_mux>; 367 + assigned-clock-parents = <&pll6>; 364 368 }; 365 369 366 370 mmc0: mmc@01c0f000 {
+1
arch/arm/boot/dts/tegra114-dalmore.dts
··· 15 15 aliases { 16 16 rtc0 = "/i2c@7000d000/tps65913@58"; 17 17 rtc1 = "/rtc@7000e000"; 18 + serial0 = &uartd; 18 19 }; 19 20 20 21 memory {
+5 -4
arch/arm/boot/dts/tegra114-roth.dts
··· 15 15 linux,initrd-end = <0x82800000>; 16 16 }; 17 17 18 + aliases { 19 + serial0 = &uartd; 20 + }; 21 + 18 22 firmware { 19 23 trusted-foundations { 20 24 compatible = "tlm,trusted-foundations"; ··· 920 916 regulator-name = "vddio-sdmmc3"; 921 917 regulator-min-microvolt = <1800000>; 922 918 regulator-max-microvolt = <3300000>; 923 - regulator-always-on; 924 - regulator-boot-on; 925 919 }; 926 920 927 921 ldousb { ··· 964 962 sdhci@78000400 { 965 963 status = "okay"; 966 964 bus-width = <4>; 967 - vmmc-supply = <&vddio_sdmmc3>; 965 + vqmmc-supply = <&vddio_sdmmc3>; 968 966 cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; 969 967 power-gpios = <&gpio TEGRA_GPIO(H, 0) GPIO_ACTIVE_HIGH>; 970 968 }; ··· 973 971 sdhci@78000600 { 974 972 status = "okay"; 975 973 bus-width = <8>; 976 - vmmc-supply = <&vdd_1v8>; 977 974 non-removable; 978 975 }; 979 976
+4 -1
arch/arm/boot/dts/tegra114-tn7.dts
··· 15 15 linux,initrd-end = <0x82800000>; 16 16 }; 17 17 18 + aliases { 19 + serial0 = &uartd; 20 + }; 21 + 18 22 firmware { 19 23 trusted-foundations { 20 24 compatible = "tlm,trusted-foundations"; ··· 244 240 sdhci@78000600 { 245 241 status = "okay"; 246 242 bus-width = <8>; 247 - vmmc-supply = <&vdd_1v8>; 248 243 non-removable; 249 244 }; 250 245
-7
arch/arm/boot/dts/tegra114.dtsi
··· 9 9 compatible = "nvidia,tegra114"; 10 10 interrupt-parent = <&gic>; 11 11 12 - aliases { 13 - serial0 = &uarta; 14 - serial1 = &uartb; 15 - serial2 = &uartc; 16 - serial3 = &uartd; 17 - }; 18 - 19 12 host1x@50000000 { 20 13 compatible = "nvidia,tegra114-host1x", "simple-bus"; 21 14 reg = <0x50000000 0x00028000>;
+1
arch/arm/boot/dts/tegra124-jetson-tk1.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@0,7000d000/pmic@40"; 12 12 rtc1 = "/rtc@0,7000e000"; 13 + serial0 = &uartd; 13 14 }; 14 15 15 16 memory {
+1
arch/arm/boot/dts/tegra124-nyan-big.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@0,7000d000/pmic@40"; 12 12 rtc1 = "/rtc@0,7000e000"; 13 + serial0 = &uarta; 13 14 }; 14 15 15 16 memory {
+1
arch/arm/boot/dts/tegra124-venice2.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@0,7000d000/pmic@40"; 12 12 rtc1 = "/rtc@0,7000e000"; 13 + serial0 = &uarta; 13 14 }; 14 15 15 16 memory {
+4 -4
arch/arm/boot/dts/tegra124.dtsi
··· 286 286 * the APB DMA based serial driver, the comptible is 287 287 * "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart". 288 288 */ 289 - serial@0,70006000 { 289 + uarta: serial@0,70006000 { 290 290 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; 291 291 reg = <0x0 0x70006000 0x0 0x40>; 292 292 reg-shift = <2>; ··· 299 299 status = "disabled"; 300 300 }; 301 301 302 - serial@0,70006040 { 302 + uartb: serial@0,70006040 { 303 303 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; 304 304 reg = <0x0 0x70006040 0x0 0x40>; 305 305 reg-shift = <2>; ··· 312 312 status = "disabled"; 313 313 }; 314 314 315 - serial@0,70006200 { 315 + uartc: serial@0,70006200 { 316 316 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; 317 317 reg = <0x0 0x70006200 0x0 0x40>; 318 318 reg-shift = <2>; ··· 325 325 status = "disabled"; 326 326 }; 327 327 328 - serial@0,70006300 { 328 + uartd: serial@0,70006300 { 329 329 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; 330 330 reg = <0x0 0x70006300 0x0 0x40>; 331 331 reg-shift = <2>;
+1
arch/arm/boot/dts/tegra20-harmony.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@7000d000/tps6586x@34"; 12 12 rtc1 = "/rtc@7000e000"; 13 + serial0 = &uartd; 13 14 }; 14 15 15 16 memory {
+5
arch/arm/boot/dts/tegra20-iris-512.dts
··· 6 6 model = "Toradex Colibri T20 512MB on Iris"; 7 7 compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20"; 8 8 9 + aliases { 10 + serial0 = &uarta; 11 + serial1 = &uartd; 12 + }; 13 + 9 14 host1x@50000000 { 10 15 hdmi@54280000 { 11 16 status = "okay";
+4
arch/arm/boot/dts/tegra20-medcom-wide.dts
··· 6 6 model = "Avionic Design Medcom-Wide board"; 7 7 compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20"; 8 8 9 + aliases { 10 + serial0 = &uartd; 11 + }; 12 + 9 13 pwm@7000a000 { 10 14 status = "okay"; 11 15 };
+2
arch/arm/boot/dts/tegra20-paz00.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@7000d000/tps6586x@34"; 12 12 rtc1 = "/rtc@7000e000"; 13 + serial0 = &uarta; 14 + serial1 = &uartc; 13 15 }; 14 16 15 17 memory {
+1
arch/arm/boot/dts/tegra20-seaboard.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@7000d000/tps6586x@34"; 12 12 rtc1 = "/rtc@7000e000"; 13 + serial0 = &uartd; 13 14 }; 14 15 15 16 memory {
+1
arch/arm/boot/dts/tegra20-tamonten.dtsi
··· 7 7 aliases { 8 8 rtc0 = "/i2c@7000d000/tps6586x@34"; 9 9 rtc1 = "/rtc@7000e000"; 10 + serial0 = &uartd; 10 11 }; 11 12 12 13 memory {
+1
arch/arm/boot/dts/tegra20-trimslice.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@7000c500/rtc@56"; 12 12 rtc1 = "/rtc@7000e000"; 13 + serial0 = &uarta; 13 14 }; 14 15 15 16 memory {
+1
arch/arm/boot/dts/tegra20-ventana.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@7000d000/tps6586x@34"; 12 12 rtc1 = "/rtc@7000e000"; 13 + serial0 = &uartd; 13 14 }; 14 15 15 16 memory {
+1
arch/arm/boot/dts/tegra20-whistler.dts
··· 10 10 aliases { 11 11 rtc0 = "/i2c@7000d000/max8907@3c"; 12 12 rtc1 = "/rtc@7000e000"; 13 + serial0 = &uarta; 13 14 }; 14 15 15 16 memory {
-8
arch/arm/boot/dts/tegra20.dtsi
··· 9 9 compatible = "nvidia,tegra20"; 10 10 interrupt-parent = <&intc>; 11 11 12 - aliases { 13 - serial0 = &uarta; 14 - serial1 = &uartb; 15 - serial2 = &uartc; 16 - serial3 = &uartd; 17 - serial4 = &uarte; 18 - }; 19 - 20 12 host1x@50000000 { 21 13 compatible = "nvidia,tegra20-host1x", "simple-bus"; 22 14 reg = <0x50000000 0x00024000>;
+4
arch/arm/boot/dts/tegra30-apalis-eval.dts
··· 11 11 rtc0 = "/i2c@7000c000/rtc@68"; 12 12 rtc1 = "/i2c@7000d000/tps65911@2d"; 13 13 rtc2 = "/rtc@7000e000"; 14 + serial0 = &uarta; 15 + serial1 = &uartb; 16 + serial2 = &uartc; 17 + serial3 = &uartd; 14 18 }; 15 19 16 20 pcie-controller@00003000 {
+1
arch/arm/boot/dts/tegra30-beaver.dts
··· 9 9 aliases { 10 10 rtc0 = "/i2c@7000d000/tps65911@2d"; 11 11 rtc1 = "/rtc@7000e000"; 12 + serial0 = &uarta; 12 13 }; 13 14 14 15 memory {
+2
arch/arm/boot/dts/tegra30-cardhu.dtsi
··· 30 30 aliases { 31 31 rtc0 = "/i2c@7000d000/tps65911@2d"; 32 32 rtc1 = "/rtc@7000e000"; 33 + serial0 = &uarta; 34 + serial1 = &uartc; 33 35 }; 34 36 35 37 memory {
+3
arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
··· 10 10 rtc0 = "/i2c@7000c000/rtc@68"; 11 11 rtc1 = "/i2c@7000d000/tps65911@2d"; 12 12 rtc2 = "/rtc@7000e000"; 13 + serial0 = &uarta; 14 + serial1 = &uartb; 15 + serial2 = &uartd; 13 16 }; 14 17 15 18 host1x@50000000 {
-8
arch/arm/boot/dts/tegra30.dtsi
··· 9 9 compatible = "nvidia,tegra30"; 10 10 interrupt-parent = <&intc>; 11 11 12 - aliases { 13 - serial0 = &uarta; 14 - serial1 = &uartb; 15 - serial2 = &uartc; 16 - serial3 = &uartd; 17 - serial4 = &uarte; 18 - }; 19 - 20 12 pcie-controller@00003000 { 21 13 compatible = "nvidia,tegra30-pcie"; 22 14 device_type = "pci";
+2
arch/arm/configs/exynos_defconfig
··· 142 142 CONFIG_MMC_DW_EXYNOS=y 143 143 CONFIG_RTC_CLASS=y 144 144 CONFIG_RTC_DRV_MAX77686=y 145 + CONFIG_RTC_DRV_MAX77802=y 145 146 CONFIG_RTC_DRV_S5M=y 146 147 CONFIG_RTC_DRV_S3C=y 147 148 CONFIG_DMADEVICES=y 148 149 CONFIG_PL330_DMA=y 149 150 CONFIG_COMMON_CLK_MAX77686=y 151 + CONFIG_COMMON_CLK_MAX77802=y 150 152 CONFIG_COMMON_CLK_S2MPS11=y 151 153 CONFIG_EXYNOS_IOMMU=y 152 154 CONFIG_IIO=y
+1
arch/arm/configs/multi_v7_defconfig
··· 217 217 CONFIG_I2C_DESIGNWARE_PLATFORM=y 218 218 CONFIG_I2C_EXYNOS5=y 219 219 CONFIG_I2C_MV64XXX=y 220 + CONFIG_I2C_S3C2410=y 220 221 CONFIG_I2C_SIRF=y 221 222 CONFIG_I2C_TEGRA=y 222 223 CONFIG_I2C_ST=y
-11
arch/arm/include/asm/thread_info.h
··· 44 44 __u32 extra[2]; /* Xscale 'acc' register, etc */ 45 45 }; 46 46 47 - struct arm_restart_block { 48 - union { 49 - /* For user cache flushing */ 50 - struct { 51 - unsigned long start; 52 - unsigned long end; 53 - } cache; 54 - }; 55 - }; 56 - 57 47 /* 58 48 * low level task data that entry.S needs immediate access to. 59 49 * __switch_to() assumes cpu_context follows immediately after cpu_domain. ··· 69 79 unsigned long thumbee_state; /* ThumbEE Handler Base register */ 70 80 #endif 71 81 struct restart_block restart_block; 72 - struct arm_restart_block arm_restart_block; 73 82 }; 74 83 75 84 #define INIT_THREAD_INFO(tsk) \
+2 -29
arch/arm/kernel/traps.c
··· 533 533 return regs->ARM_r0; 534 534 } 535 535 536 - static long do_cache_op_restart(struct restart_block *); 537 - 538 536 static inline int 539 537 __do_cache_op(unsigned long start, unsigned long end) 540 538 { ··· 541 543 do { 542 544 unsigned long chunk = min(PAGE_SIZE, end - start); 543 545 544 - if (signal_pending(current)) { 545 - struct thread_info *ti = current_thread_info(); 546 - 547 - ti->restart_block = (struct restart_block) { 548 - .fn = do_cache_op_restart, 549 - }; 550 - 551 - ti->arm_restart_block = (struct arm_restart_block) { 552 - { 553 - .cache = { 554 - .start = start, 555 - .end = end, 556 - }, 557 - }, 558 - }; 559 - 560 - return -ERESTART_RESTARTBLOCK; 561 - } 546 + if (fatal_signal_pending(current)) 547 + return 0; 562 548 563 549 ret = flush_cache_user_range(start, start + chunk); 564 550 if (ret) ··· 553 571 } while (start < end); 554 572 555 573 return 0; 556 - } 557 - 558 - static long do_cache_op_restart(struct restart_block *unused) 559 - { 560 - struct arm_restart_block *restart_block; 561 - 562 - restart_block = &current_thread_info()->arm_restart_block; 563 - return __do_cache_op(restart_block->cache.start, 564 - restart_block->cache.end); 565 574 } 566 575 567 576 static inline int
+8 -2
arch/arm/kvm/mmu.c
··· 197 197 pgd = pgdp + pgd_index(addr); 198 198 do { 199 199 next = kvm_pgd_addr_end(addr, end); 200 - unmap_puds(kvm, pgd, addr, next); 200 + if (!pgd_none(*pgd)) 201 + unmap_puds(kvm, pgd, addr, next); 201 202 } while (pgd++, addr = next, addr != end); 202 203 } 203 204 ··· 835 834 return kvm_vcpu_dabt_iswrite(vcpu); 836 835 } 837 836 837 + static bool kvm_is_device_pfn(unsigned long pfn) 838 + { 839 + return !pfn_valid(pfn); 840 + } 841 + 838 842 static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, 839 843 struct kvm_memory_slot *memslot, unsigned long hva, 840 844 unsigned long fault_status) ··· 910 904 if (is_error_pfn(pfn)) 911 905 return -EFAULT; 912 906 913 - if (kvm_is_mmio_pfn(pfn)) 907 + if (kvm_is_device_pfn(pfn)) 914 908 mem_type = PAGE_S2_DEVICE; 915 909 916 910 spin_lock(&kvm->mmu_lock);
+1 -1
arch/arm/mach-mvebu/board-v7.c
··· 188 188 189 189 static void __init mvebu_dt_init(void) 190 190 { 191 - if (of_machine_is_compatible("plathome,openblocks-ax3-4")) 191 + if (of_machine_is_compatible("marvell,armadaxp")) 192 192 i2c_quirk(); 193 193 if (of_machine_is_compatible("marvell,a375-db")) { 194 194 external_abort_quirk();
+2
arch/arm/mach-mvebu/coherency.c
··· 400 400 type == COHERENCY_FABRIC_TYPE_ARMADA_380) 401 401 armada_375_380_coherency_init(np); 402 402 403 + of_node_put(np); 404 + 403 405 return 0; 404 406 } 405 407
+7 -2
arch/arm/mach-shmobile/clock-r8a7740.c
··· 451 451 MSTP128, MSTP127, MSTP125, 452 452 MSTP116, MSTP111, MSTP100, MSTP117, 453 453 454 - MSTP230, 454 + MSTP230, MSTP229, 455 455 MSTP222, 456 456 MSTP218, MSTP217, MSTP216, MSTP214, 457 457 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, ··· 470 470 [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */ 471 471 [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ 472 472 [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ 473 - [MSTP116] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ 473 + [MSTP116] = SH_CLK_MSTP32(&div4_clks[DIV4_HPP], SMSTPCR1, 16, 0), /* IIC0 */ 474 474 [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */ 475 475 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ 476 476 477 477 [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ 478 + [MSTP229] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 29, 0), /* INTCA */ 478 479 [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ 479 480 [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ 480 481 [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ ··· 572 571 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), 573 572 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), 574 573 CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]), 574 + CLKDEV_DEV_ID("renesas_intc_irqpin.0", &mstp_clks[MSTP229]), 575 + CLKDEV_DEV_ID("renesas_intc_irqpin.1", &mstp_clks[MSTP229]), 576 + CLKDEV_DEV_ID("renesas_intc_irqpin.2", &mstp_clks[MSTP229]), 577 + CLKDEV_DEV_ID("renesas_intc_irqpin.3", &mstp_clks[MSTP229]), 575 578 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), 576 579 CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]), 577 580
+1 -1
arch/arm/mach-shmobile/clock-r8a7790.c
··· 64 64 65 65 #define SDCKCR 0xE6150074 66 66 #define SD2CKCR 0xE6150078 67 - #define SD3CKCR 0xE615007C 67 + #define SD3CKCR 0xE615026C 68 68 #define MMC0CKCR 0xE6150240 69 69 #define MMC1CKCR 0xE6150244 70 70 #define SSPCKCR 0xE6150248
+20
arch/arm/mach-shmobile/setup-sh73a0.c
··· 22 22 #include <linux/of_platform.h> 23 23 #include <linux/delay.h> 24 24 #include <linux/input.h> 25 + #include <linux/i2c/i2c-sh_mobile.h> 25 26 #include <linux/io.h> 26 27 #include <linux/serial_sci.h> 27 28 #include <linux/sh_dma.h> ··· 189 188 }, 190 189 }; 191 190 191 + static struct i2c_sh_mobile_platform_data i2c_platform_data = { 192 + .clks_per_count = 2, 193 + }; 194 + 192 195 static struct platform_device i2c0_device = { 193 196 .name = "i2c-sh_mobile", 194 197 .id = 0, 195 198 .resource = i2c0_resources, 196 199 .num_resources = ARRAY_SIZE(i2c0_resources), 200 + .dev = { 201 + .platform_data = &i2c_platform_data, 202 + }, 197 203 }; 198 204 199 205 static struct platform_device i2c1_device = { ··· 208 200 .id = 1, 209 201 .resource = i2c1_resources, 210 202 .num_resources = ARRAY_SIZE(i2c1_resources), 203 + .dev = { 204 + .platform_data = &i2c_platform_data, 205 + }, 211 206 }; 212 207 213 208 static struct platform_device i2c2_device = { ··· 218 207 .id = 2, 219 208 .resource = i2c2_resources, 220 209 .num_resources = ARRAY_SIZE(i2c2_resources), 210 + .dev = { 211 + .platform_data = &i2c_platform_data, 212 + }, 221 213 }; 222 214 223 215 static struct platform_device i2c3_device = { ··· 228 214 .id = 3, 229 215 .resource = i2c3_resources, 230 216 .num_resources = ARRAY_SIZE(i2c3_resources), 217 + .dev = { 218 + .platform_data = &i2c_platform_data, 219 + }, 231 220 }; 232 221 233 222 static struct platform_device i2c4_device = { ··· 238 221 .id = 4, 239 222 .resource = i2c4_resources, 240 223 .num_resources = ARRAY_SIZE(i2c4_resources), 224 + .dev = { 225 + .platform_data = &i2c_platform_data, 226 + }, 241 227 }; 242 228 243 229 static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = {
+11 -11
arch/arm/mach-tegra/irq.c
··· 99 99 100 100 static void tegra_mask(struct irq_data *d) 101 101 { 102 - if (d->irq < FIRST_LEGACY_IRQ) 102 + if (d->hwirq < FIRST_LEGACY_IRQ) 103 103 return; 104 104 105 - tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_CLR); 105 + tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IER_CLR); 106 106 } 107 107 108 108 static void tegra_unmask(struct irq_data *d) 109 109 { 110 - if (d->irq < FIRST_LEGACY_IRQ) 110 + if (d->hwirq < FIRST_LEGACY_IRQ) 111 111 return; 112 112 113 - tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_SET); 113 + tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IER_SET); 114 114 } 115 115 116 116 static void tegra_ack(struct irq_data *d) 117 117 { 118 - if (d->irq < FIRST_LEGACY_IRQ) 118 + if (d->hwirq < FIRST_LEGACY_IRQ) 119 119 return; 120 120 121 - tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); 121 + tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_CLR); 122 122 } 123 123 124 124 static void tegra_eoi(struct irq_data *d) 125 125 { 126 - if (d->irq < FIRST_LEGACY_IRQ) 126 + if (d->hwirq < FIRST_LEGACY_IRQ) 127 127 return; 128 128 129 - tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); 129 + tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_CLR); 130 130 } 131 131 132 132 static int tegra_retrigger(struct irq_data *d) 133 133 { 134 - if (d->irq < FIRST_LEGACY_IRQ) 134 + if (d->hwirq < FIRST_LEGACY_IRQ) 135 135 return 0; 136 136 137 - tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_SET); 137 + tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_SET); 138 138 139 139 return 1; 140 140 } ··· 142 142 #ifdef CONFIG_PM_SLEEP 143 143 static int tegra_set_wake(struct irq_data *d, unsigned int enable) 144 144 { 145 - u32 irq = d->irq; 145 + u32 irq = d->hwirq; 146 146 u32 index, mask; 147 147 148 148 if (irq < FIRST_LEGACY_IRQ ||
+1
arch/arm/mm/Kconfig
··· 798 798 799 799 config KUSER_HELPERS 800 800 bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS 801 + depends on MMU 801 802 default y 802 803 help 803 804 Warning: disabling this option may break user programs.
-2
arch/arm/mm/proc-v7.S
··· 270 270 /* Auxiliary Debug Modes Control 1 Register */ 271 271 #define PJ4B_STATIC_BP (1 << 2) /* Enable Static BP */ 272 272 #define PJ4B_INTER_PARITY (1 << 8) /* Disable Internal Parity Handling */ 273 - #define PJ4B_BCK_OFF_STREX (1 << 5) /* Enable the back off of STREX instr */ 274 273 #define PJ4B_CLEAN_LINE (1 << 16) /* Disable data transfer for clean line */ 275 274 276 275 /* Auxiliary Debug Modes Control 2 Register */ ··· 292 293 /* Auxiliary Debug Modes Control 1 Register */ 293 294 mrc p15, 1, r0, c15, c1, 1 294 295 orr r0, r0, #PJ4B_CLEAN_LINE 295 - orr r0, r0, #PJ4B_BCK_OFF_STREX 296 296 orr r0, r0, #PJ4B_INTER_PARITY 297 297 bic r0, r0, #PJ4B_STATIC_BP 298 298 mcr p15, 1, r0, c15, c1, 1
+2 -2
arch/arm/mm/proc-xscale.S
··· 535 535 mrc p15, 0, r5, c15, c1, 0 @ CP access reg 536 536 mrc p15, 0, r6, c13, c0, 0 @ PID 537 537 mrc p15, 0, r7, c3, c0, 0 @ domain ID 538 - mrc p15, 0, r8, c1, c1, 0 @ auxiliary control reg 538 + mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg 539 539 mrc p15, 0, r9, c1, c0, 0 @ control reg 540 540 bic r4, r4, #2 @ clear frequency change bit 541 541 stmia r0, {r4 - r9} @ store cp regs ··· 552 552 mcr p15, 0, r6, c13, c0, 0 @ PID 553 553 mcr p15, 0, r7, c3, c0, 0 @ domain ID 554 554 mcr p15, 0, r1, c2, c0, 0 @ translation table base addr 555 - mcr p15, 0, r8, c1, c1, 0 @ auxiliary control reg 555 + mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg 556 556 mov r0, r9 @ control register 557 557 b cpu_resume_mmu 558 558 ENDPROC(cpu_xscale_do_resume)
+32 -4
arch/arm/plat-orion/gpio.c
··· 497 497 #define orion_gpio_dbg_show NULL 498 498 #endif 499 499 500 + static void orion_gpio_unmask_irq(struct irq_data *d) 501 + { 502 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 503 + struct irq_chip_type *ct = irq_data_get_chip_type(d); 504 + u32 reg_val; 505 + u32 mask = d->mask; 506 + 507 + irq_gc_lock(gc); 508 + reg_val = irq_reg_readl(gc->reg_base + ct->regs.mask); 509 + reg_val |= mask; 510 + irq_reg_writel(reg_val, gc->reg_base + ct->regs.mask); 511 + irq_gc_unlock(gc); 512 + } 513 + 514 + static void orion_gpio_mask_irq(struct irq_data *d) 515 + { 516 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 517 + struct irq_chip_type *ct = irq_data_get_chip_type(d); 518 + u32 mask = d->mask; 519 + u32 reg_val; 520 + 521 + irq_gc_lock(gc); 522 + reg_val = irq_reg_readl(gc->reg_base + ct->regs.mask); 523 + reg_val &= ~mask; 524 + irq_reg_writel(reg_val, gc->reg_base + ct->regs.mask); 525 + irq_gc_unlock(gc); 526 + } 527 + 500 528 void __init orion_gpio_init(struct device_node *np, 501 529 int gpio_base, int ngpio, 502 530 void __iomem *base, int mask_offset, ··· 593 565 ct = gc->chip_types; 594 566 ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF; 595 567 ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW; 596 - ct->chip.irq_mask = irq_gc_mask_clr_bit; 597 - ct->chip.irq_unmask = irq_gc_mask_set_bit; 568 + ct->chip.irq_mask = orion_gpio_mask_irq; 569 + ct->chip.irq_unmask = orion_gpio_unmask_irq; 598 570 ct->chip.irq_set_type = gpio_irq_set_type; 599 571 ct->chip.name = ochip->chip.label; 600 572 ··· 603 575 ct->regs.ack = GPIO_EDGE_CAUSE_OFF; 604 576 ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; 605 577 ct->chip.irq_ack = irq_gc_ack_clr_bit; 606 - ct->chip.irq_mask = irq_gc_mask_clr_bit; 607 - ct->chip.irq_unmask = irq_gc_mask_set_bit; 578 + ct->chip.irq_mask = orion_gpio_mask_irq; 579 + ct->chip.irq_unmask = orion_gpio_unmask_irq; 608 580 ct->chip.irq_set_type = gpio_irq_set_type; 609 581 ct->handler = handle_edge_irq; 610 582 ct->chip.name = ochip->chip.label;
+5 -5
arch/arm64/boot/dts/apm-storm.dtsi
··· 599 599 compatible = "apm,xgene-enet"; 600 600 status = "disabled"; 601 601 reg = <0x0 0x17020000 0x0 0xd100>, 602 - <0x0 0X17030000 0x0 0X400>, 602 + <0x0 0X17030000 0x0 0Xc300>, 603 603 <0x0 0X10000000 0x0 0X200>; 604 604 reg-names = "enet_csr", "ring_csr", "ring_cmd"; 605 605 interrupts = <0x0 0x3c 0x4>; ··· 624 624 sgenet0: ethernet@1f210000 { 625 625 compatible = "apm,xgene-enet"; 626 626 status = "disabled"; 627 - reg = <0x0 0x1f210000 0x0 0x10000>, 628 - <0x0 0x1f200000 0x0 0X10000>, 629 - <0x0 0x1B000000 0x0 0X20000>; 627 + reg = <0x0 0x1f210000 0x0 0xd100>, 628 + <0x0 0x1f200000 0x0 0Xc300>, 629 + <0x0 0x1B000000 0x0 0X200>; 630 630 reg-names = "enet_csr", "ring_csr", "ring_cmd"; 631 631 interrupts = <0x0 0xA0 0x4>; 632 632 dma-coherent; ··· 639 639 compatible = "apm,xgene-enet"; 640 640 status = "disabled"; 641 641 reg = <0x0 0x1f610000 0x0 0xd100>, 642 - <0x0 0x1f600000 0x0 0X400>, 642 + <0x0 0x1f600000 0x0 0Xc300>, 643 643 <0x0 0x18000000 0x0 0X200>; 644 644 reg-names = "enet_csr", "ring_csr", "ring_cmd"; 645 645 interrupts = <0x0 0x60 0x4>;
+1 -1
arch/arm64/include/asm/memory.h
··· 142 142 * virt_to_page(k) convert a _valid_ virtual address to struct page * 143 143 * virt_addr_valid(k) indicates whether a virtual address is valid 144 144 */ 145 - #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET 145 + #define ARCH_PFN_OFFSET ((unsigned long)PHYS_PFN_OFFSET) 146 146 147 147 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 148 148 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
+21 -6
arch/arm64/kernel/efi-entry.S
··· 54 54 b.eq efi_load_fail 55 55 56 56 /* 57 - * efi_entry() will have relocated the kernel image if necessary 58 - * and we return here with device tree address in x0 and the kernel 59 - * entry point stored at *image_addr. Save those values in registers 60 - * which are callee preserved. 57 + * efi_entry() will have copied the kernel image if necessary and we 58 + * return here with device tree address in x0 and the kernel entry 59 + * point stored at *image_addr. Save those values in registers which 60 + * are callee preserved. 61 61 */ 62 62 mov x20, x0 // DTB address 63 63 ldr x0, [sp, #16] // relocated _text address 64 64 mov x21, x0 65 65 66 66 /* 67 - * Flush dcache covering current runtime addresses 68 - * of kernel text/data. Then flush all of icache. 67 + * Calculate size of the kernel Image (same for original and copy). 69 68 */ 70 69 adrp x1, _text 71 70 add x1, x1, #:lo12:_text ··· 72 73 add x2, x2, #:lo12:_edata 73 74 sub x1, x2, x1 74 75 76 + /* 77 + * Flush the copied Image to the PoC, and ensure it is not shadowed by 78 + * stale icache entries from before relocation. 79 + */ 75 80 bl __flush_dcache_area 76 81 ic ialluis 82 + 83 + /* 84 + * Ensure that the rest of this function (in the original Image) is 85 + * visible when the caches are disabled. The I-cache can't have stale 86 + * entries for the VA range of the current image, so no maintenance is 87 + * necessary. 88 + */ 89 + adr x0, efi_stub_entry 90 + adr x1, efi_stub_entry_end 91 + sub x1, x1, x0 92 + bl __flush_dcache_area 77 93 78 94 /* Turn off Dcache and MMU */ 79 95 mrs x0, CurrentEL ··· 119 105 ldp x29, x30, [sp], #32 120 106 ret 121 107 108 + efi_stub_entry_end: 122 109 ENDPROC(efi_stub_entry)
+3 -2
arch/arm64/kernel/insn.c
··· 163 163 * which ends with "dsb; isb" pair guaranteeing global 164 164 * visibility. 165 165 */ 166 - atomic_set(&pp->cpu_count, -1); 166 + /* Notify other processors with an additional increment. */ 167 + atomic_inc(&pp->cpu_count); 167 168 } else { 168 - while (atomic_read(&pp->cpu_count) != -1) 169 + while (atomic_read(&pp->cpu_count) <= num_online_cpus()) 169 170 cpu_relax(); 170 171 isb(); 171 172 }
+9
arch/arm64/kvm/sys_regs.c
··· 424 424 /* VBAR_EL1 */ 425 425 { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b0000), Op2(0b000), 426 426 NULL, reset_val, VBAR_EL1, 0 }, 427 + 428 + /* ICC_SRE_EL1 */ 429 + { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b1100), Op2(0b101), 430 + trap_raz_wi }, 431 + 427 432 /* CONTEXTIDR_EL1 */ 428 433 { Op0(0b11), Op1(0b000), CRn(0b1101), CRm(0b0000), Op2(0b001), 429 434 access_vm_reg, reset_val, CONTEXTIDR_EL1, 0 }, ··· 695 690 { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, 696 691 { Op1( 0), CRn(10), CRm( 3), Op2( 0), access_vm_reg, NULL, c10_AMAIR0 }, 697 692 { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, 693 + 694 + /* ICC_SRE */ 695 + { Op1( 0), CRn(12), CRm(12), Op2( 5), trap_raz_wi }, 696 + 698 697 { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, 699 698 }; 700 699
+1 -1
arch/arm64/lib/clear_user.S
··· 46 46 sub x1, x1, #2 47 47 4: adds x1, x1, #1 48 48 b.mi 5f 49 - strb wzr, [x0] 49 + USER(9f, strb wzr, [x0] ) 50 50 5: mov x0, #0 51 51 ret 52 52 ENDPROC(__clear_user)
+1 -1
arch/arm64/mm/mmu.c
··· 202 202 } 203 203 204 204 static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, 205 - unsigned long end, unsigned long phys, 205 + unsigned long end, phys_addr_t phys, 206 206 int map_io) 207 207 { 208 208 pud_t *pud;
+1 -1
arch/ia64/kvm/kvm-ia64.c
··· 1563 1563 1564 1564 for (i = 0; i < npages; i++) { 1565 1565 pfn = gfn_to_pfn(kvm, base_gfn + i); 1566 - if (!kvm_is_mmio_pfn(pfn)) { 1566 + if (!kvm_is_reserved_pfn(pfn)) { 1567 1567 kvm_set_pmt_entry(kvm, base_gfn + i, 1568 1568 pfn << PAGE_SHIFT, 1569 1569 _PAGE_AR_RWX | _PAGE_MA_WB);
+12 -2
arch/mips/Kconfig
··· 2101 2101 config ARCH_PHYS_ADDR_T_64BIT 2102 2102 def_bool 64BIT_PHYS_ADDR 2103 2103 2104 + choice 2105 + prompt "SmartMIPS or microMIPS ASE support" 2106 + 2107 + config CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS 2108 + bool "None" 2109 + help 2110 + Select this if you want neither microMIPS nor SmartMIPS support 2111 + 2104 2112 config CPU_HAS_SMARTMIPS 2105 2113 depends on SYS_SUPPORTS_SMARTMIPS 2106 - bool "Support for the SmartMIPS ASE" 2114 + bool "SmartMIPS" 2107 2115 help 2108 2116 SmartMIPS is a extension of the MIPS32 architecture aimed at 2109 2117 increased security at both hardware and software level for ··· 2123 2115 2124 2116 config CPU_MICROMIPS 2125 2117 depends on SYS_SUPPORTS_MICROMIPS 2126 - bool "Build kernel using microMIPS ISA" 2118 + bool "microMIPS" 2127 2119 help 2128 2120 When this option is enabled the kernel will be built using the 2129 2121 microMIPS ISA 2122 + 2123 + endchoice 2130 2124 2131 2125 config CPU_HAS_MSA 2132 2126 bool "Support for the MIPS SIMD Architecture (EXPERIMENTAL)"
+7 -1
arch/mips/include/asm/jump_label.h
··· 20 20 #define WORD_INSN ".word" 21 21 #endif 22 22 23 + #ifdef CONFIG_CPU_MICROMIPS 24 + #define NOP_INSN "nop32" 25 + #else 26 + #define NOP_INSN "nop" 27 + #endif 28 + 23 29 static __always_inline bool arch_static_branch(struct static_key *key) 24 30 { 25 - asm_volatile_goto("1:\tnop\n\t" 31 + asm_volatile_goto("1:\t" NOP_INSN "\n\t" 26 32 "nop\n\t" 27 33 ".pushsection __jump_table, \"aw\"\n\t" 28 34 WORD_INSN " 1b, %l[l_yes], %0\n\t"
-2
arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
··· 41 41 #define cpu_has_mcheck 0 42 42 #define cpu_has_mdmx 0 43 43 #define cpu_has_mips16 0 44 - #define cpu_has_mips32r1 0 45 44 #define cpu_has_mips32r2 0 46 45 #define cpu_has_mips3d 0 47 - #define cpu_has_mips64r1 0 48 46 #define cpu_has_mips64r2 0 49 47 #define cpu_has_mipsmt 0 50 48 #define cpu_has_prefetch 0
+2
arch/mips/include/asm/mipsregs.h
··· 661 661 #define MIPS_CONF6_SYND (_ULCAST_(1) << 13) 662 662 /* proAptiv FTLB on/off bit */ 663 663 #define MIPS_CONF6_FTLBEN (_ULCAST_(1) << 15) 664 + /* FTLB probability bits */ 665 + #define MIPS_CONF6_FTLBP_SHIFT (16) 664 666 665 667 #define MIPS_CONF7_WII (_ULCAST_(1) << 31) 666 668
+4
arch/mips/include/asm/r4kcache.h
··· 257 257 */ 258 258 static inline void protected_writeback_dcache_line(unsigned long addr) 259 259 { 260 + #ifdef CONFIG_EVA 261 + protected_cachee_op(Hit_Writeback_Inv_D, addr); 262 + #else 260 263 protected_cache_op(Hit_Writeback_Inv_D, addr); 264 + #endif 261 265 } 262 266 263 267 static inline void protected_writeback_scache_line(unsigned long addr)
+10 -8
arch/mips/include/asm/uaccess.h
··· 301 301 __get_kernel_common((x), size, __gu_ptr); \ 302 302 else \ 303 303 __get_user_common((x), size, __gu_ptr); \ 304 - } \ 304 + } else \ 305 + (x) = 0; \ 305 306 \ 306 307 __gu_err; \ 307 308 }) ··· 317 316 " .insn \n" \ 318 317 " .section .fixup,\"ax\" \n" \ 319 318 "3: li %0, %4 \n" \ 319 + " move %1, $0 \n" \ 320 320 " j 2b \n" \ 321 321 " .previous \n" \ 322 322 " .section __ex_table,\"a\" \n" \ ··· 632 630 " .insn \n" \ 633 631 " .section .fixup,\"ax\" \n" \ 634 632 "3: li %0, %4 \n" \ 633 + " move %1, $0 \n" \ 635 634 " j 2b \n" \ 636 635 " .previous \n" \ 637 636 " .section __ex_table,\"a\" \n" \ ··· 776 773 "jal\t" #destination "\n\t" 777 774 #endif 778 775 779 - #ifndef CONFIG_CPU_DADDI_WORKAROUNDS 780 - #define DADDI_SCRATCH "$0" 781 - #else 776 + #if defined(CONFIG_CPU_DADDI_WORKAROUNDS) || (defined(CONFIG_EVA) && \ 777 + defined(CONFIG_CPU_HAS_PREFETCH)) 782 778 #define DADDI_SCRATCH "$3" 779 + #else 780 + #define DADDI_SCRATCH "$0" 783 781 #endif 784 782 785 783 extern size_t __copy_user(void *__to, const void *__from, size_t __n); ··· 1422 1418 } 1423 1419 1424 1420 /* 1425 - * strlen_user: - Get the size of a string in user space. 1421 + * strnlen_user: - Get the size of a string in user space. 1426 1422 * @str: The string to measure. 1427 1423 * 1428 1424 * Context: User context only. This function may sleep. ··· 1431 1427 * 1432 1428 * Returns the size of the string INCLUDING the terminating NUL. 1433 1429 * On exception, returns 0. 1434 - * 1435 - * If there is a limit on the length of a valid string, you may wish to 1436 - * consider using strnlen_user() instead. 1430 + * If the string is too long, returns a value greater than @n. 1437 1431 */ 1438 1432 static inline long strnlen_user(const char __user *s, long n) 1439 1433 {
+1 -1
arch/mips/include/uapi/asm/unistd.h
··· 1045 1045 #define __NR_seccomp (__NR_Linux + 316) 1046 1046 #define __NR_getrandom (__NR_Linux + 317) 1047 1047 #define __NR_memfd_create (__NR_Linux + 318) 1048 - #define __NR_memfd_create (__NR_Linux + 319) 1048 + #define __NR_bpf (__NR_Linux + 319) 1049 1049 1050 1050 /* 1051 1051 * Offset of the last N32 flavoured syscall
-3
arch/mips/kernel/bmips_vec.S
··· 208 208 END(bmips_reset_nmi_vec) 209 209 210 210 .set pop 211 - .previous 212 211 213 212 /*********************************************************************** 214 213 * CPU1 warm restart vector (used for second and subsequent boots). ··· 280 281 jr ra 281 282 282 283 END(bmips_enable_xks01) 283 - 284 - .previous
+2
arch/mips/kernel/cps-vec.S
··· 229 229 nop 230 230 231 231 .set push 232 + .set mips32r2 232 233 .set mt 233 234 234 235 /* Only allow 1 TC per VPE to execute... */ ··· 346 345 nop 347 346 348 347 .set push 348 + .set mips32r2 349 349 .set mt 350 350 351 351 1: /* Enter VPE configuration state */
+37 -3
arch/mips/kernel/cpu-probe.c
··· 193 193 static char unknown_isa[] = KERN_ERR \ 194 194 "Unsupported ISA type, c0.config0: %d."; 195 195 196 + static unsigned int calculate_ftlb_probability(struct cpuinfo_mips *c) 197 + { 198 + 199 + unsigned int probability = c->tlbsize / c->tlbsizevtlb; 200 + 201 + /* 202 + * 0 = All TLBWR instructions go to FTLB 203 + * 1 = 15:1: For every 16 TBLWR instructions, 15 go to the 204 + * FTLB and 1 goes to the VTLB. 205 + * 2 = 7:1: As above with 7:1 ratio. 206 + * 3 = 3:1: As above with 3:1 ratio. 207 + * 208 + * Use the linear midpoint as the probability threshold. 209 + */ 210 + if (probability >= 12) 211 + return 1; 212 + else if (probability >= 6) 213 + return 2; 214 + else 215 + /* 216 + * So FTLB is less than 4 times bigger than VTLB. 217 + * A 3:1 ratio can still be useful though. 218 + */ 219 + return 3; 220 + } 221 + 196 222 static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) 197 223 { 198 224 unsigned int config6; ··· 229 203 case CPU_P5600: 230 204 /* proAptiv & related cores use Config6 to enable the FTLB */ 231 205 config6 = read_c0_config6(); 206 + /* Clear the old probability value */ 207 + config6 &= ~(3 << MIPS_CONF6_FTLBP_SHIFT); 232 208 if (enable) 233 209 /* Enable FTLB */ 234 - write_c0_config6(config6 | MIPS_CONF6_FTLBEN); 210 + write_c0_config6(config6 | 211 + (calculate_ftlb_probability(c) 212 + << MIPS_CONF6_FTLBP_SHIFT) 213 + | MIPS_CONF6_FTLBEN); 235 214 else 236 215 /* Disable FTLB */ 237 216 write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN); ··· 788 757 c->cputype = CPU_LOONGSON2; 789 758 __cpu_name[cpu] = "ICT Loongson-2"; 790 759 set_elf_platform(cpu, "loongson2e"); 760 + set_isa(c, MIPS_CPU_ISA_III); 791 761 break; 792 762 case PRID_REV_LOONGSON2F: 793 763 c->cputype = CPU_LOONGSON2; 794 764 __cpu_name[cpu] = "ICT Loongson-2"; 795 765 set_elf_platform(cpu, "loongson2f"); 766 + set_isa(c, MIPS_CPU_ISA_III); 796 767 break; 797 768 case PRID_REV_LOONGSON3A: 798 769 c->cputype = CPU_LOONGSON3; 799 - c->writecombine = _CACHE_UNCACHED_ACCELERATED; 800 770 __cpu_name[cpu] = "ICT Loongson-3"; 801 771 set_elf_platform(cpu, "loongson3a"); 772 + set_isa(c, MIPS_CPU_ISA_M64R1); 802 773 break; 803 774 case PRID_REV_LOONGSON3B_R1: 804 775 case PRID_REV_LOONGSON3B_R2: 805 776 c->cputype = CPU_LOONGSON3; 806 777 __cpu_name[cpu] = "ICT Loongson-3"; 807 778 set_elf_platform(cpu, "loongson3b"); 779 + set_isa(c, MIPS_CPU_ISA_M64R1); 808 780 break; 809 781 } 810 782 811 - set_isa(c, MIPS_CPU_ISA_III); 812 783 c->options = R4K_OPTS | 813 784 MIPS_CPU_FPU | MIPS_CPU_LLSC | 814 785 MIPS_CPU_32FPR; 815 786 c->tlbsize = 64; 787 + c->writecombine = _CACHE_UNCACHED_ACCELERATED; 816 788 break; 817 789 case PRID_IMP_LOONGSON_32: /* Loongson-1 */ 818 790 decode_configs(c);
+32 -10
arch/mips/kernel/jump_label.c
··· 18 18 19 19 #ifdef HAVE_JUMP_LABEL 20 20 21 - #define J_RANGE_MASK ((1ul << 28) - 1) 21 + /* 22 + * Define parameters for the standard MIPS and the microMIPS jump 23 + * instruction encoding respectively: 24 + * 25 + * - the ISA bit of the target, either 0 or 1 respectively, 26 + * 27 + * - the amount the jump target address is shifted right to fit in the 28 + * immediate field of the machine instruction, either 2 or 1, 29 + * 30 + * - the mask determining the size of the jump region relative to the 31 + * delay-slot instruction, either 256MB or 128MB, 32 + * 33 + * - the jump target alignment, either 4 or 2 bytes. 34 + */ 35 + #define J_ISA_BIT IS_ENABLED(CONFIG_CPU_MICROMIPS) 36 + #define J_RANGE_SHIFT (2 - J_ISA_BIT) 37 + #define J_RANGE_MASK ((1ul << (26 + J_RANGE_SHIFT)) - 1) 38 + #define J_ALIGN_MASK ((1ul << J_RANGE_SHIFT) - 1) 22 39 23 40 void arch_jump_label_transform(struct jump_entry *e, 24 41 enum jump_label_type type) 25 42 { 43 + union mips_instruction *insn_p; 26 44 union mips_instruction insn; 27 - union mips_instruction *insn_p = 28 - (union mips_instruction *)(unsigned long)e->code; 29 45 30 - /* Jump only works within a 256MB aligned region. */ 31 - BUG_ON((e->target & ~J_RANGE_MASK) != (e->code & ~J_RANGE_MASK)); 46 + insn_p = (union mips_instruction *)msk_isa16_mode(e->code); 32 47 33 - /* Target must have 4 byte alignment. */ 34 - BUG_ON((e->target & 3) != 0); 48 + /* Jump only works within an aligned region its delay slot is in. */ 49 + BUG_ON((e->target & ~J_RANGE_MASK) != ((e->code + 4) & ~J_RANGE_MASK)); 50 + 51 + /* Target must have the right alignment and ISA must be preserved. */ 52 + BUG_ON((e->target & J_ALIGN_MASK) != J_ISA_BIT); 35 53 36 54 if (type == JUMP_LABEL_ENABLE) { 37 - insn.j_format.opcode = j_op; 38 - insn.j_format.target = (e->target & J_RANGE_MASK) >> 2; 55 + insn.j_format.opcode = J_ISA_BIT ? mm_j32_op : j_op; 56 + insn.j_format.target = e->target >> J_RANGE_SHIFT; 39 57 } else { 40 58 insn.word = 0; /* nop */ 41 59 } 42 60 43 61 get_online_cpus(); 44 62 mutex_lock(&text_mutex); 45 - *insn_p = insn; 63 + if (IS_ENABLED(CONFIG_CPU_MICROMIPS)) { 64 + insn_p->halfword[0] = insn.word >> 16; 65 + insn_p->halfword[1] = insn.word; 66 + } else 67 + *insn_p = insn; 46 68 47 69 flush_icache_range((unsigned long)insn_p, 48 70 (unsigned long)insn_p + sizeof(*insn_p));
+2 -2
arch/mips/kernel/rtlx.c
··· 94 94 int ret = 0; 95 95 96 96 if (index >= RTLX_CHANNELS) { 97 - pr_debug(KERN_DEBUG "rtlx_open index out of range\n"); 97 + pr_debug("rtlx_open index out of range\n"); 98 98 return -ENOSYS; 99 99 } 100 100 101 101 if (atomic_inc_return(&channel_wqs[index].in_open) > 1) { 102 - pr_debug(KERN_DEBUG "rtlx_open channel %d already opened\n", index); 102 + pr_debug("rtlx_open channel %d already opened\n", index); 103 103 ret = -EBUSY; 104 104 goto out_fail; 105 105 }
+2 -2
arch/mips/kernel/setup.c
··· 485 485 * NOTE: historically plat_mem_setup did the entire platform initialization. 486 486 * This was rather impractical because it meant plat_mem_setup had to 487 487 * get away without any kind of memory allocator. To keep old code from 488 - * breaking plat_setup was just renamed to plat_setup and a second platform 488 + * breaking plat_setup was just renamed to plat_mem_setup and a second platform 489 489 * initialization hook for anything else was introduced. 490 490 */ 491 491 ··· 493 493 494 494 static int __init early_parse_mem(char *p) 495 495 { 496 - unsigned long start, size; 496 + phys_t start, size; 497 497 498 498 /* 499 499 * If a user specifies memory size, we
+4 -4
arch/mips/kernel/signal.c
··· 658 658 save_fp_context = _save_fp_context; 659 659 restore_fp_context = _restore_fp_context; 660 660 } else { 661 - save_fp_context = copy_fp_from_sigcontext; 662 - restore_fp_context = copy_fp_to_sigcontext; 661 + save_fp_context = copy_fp_to_sigcontext; 662 + restore_fp_context = copy_fp_from_sigcontext; 663 663 } 664 664 #endif /* CONFIG_SMP */ 665 665 #else 666 - save_fp_context = copy_fp_from_sigcontext;; 667 - restore_fp_context = copy_fp_to_sigcontext; 666 + save_fp_context = copy_fp_to_sigcontext; 667 + restore_fp_context = copy_fp_from_sigcontext; 668 668 #endif 669 669 670 670 return 0;
+1
arch/mips/lib/memcpy.S
··· 503 503 STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@) 504 504 .Ldone\@: 505 505 jr ra 506 + nop 506 507 .if __memcpy == 1 507 508 END(memcpy) 508 509 .set __memcpy, 0
+2 -1
arch/mips/loongson/common/Makefile
··· 11 11 # Serial port support 12 12 # 13 13 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 14 - obj-$(CONFIG_SERIAL_8250) += serial.o 14 + loongson-serial-$(CONFIG_SERIAL_8250) := serial.o 15 + obj-y += $(loongson-serial-m) $(loongson-serial-y) 15 16 obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o 16 17 obj-$(CONFIG_LOONGSON_MC146818) += rtc.o 17 18
+1
arch/mips/loongson/loongson-3/numa.c
··· 33 33 34 34 static struct node_data prealloc__node_data[MAX_NUMNODES]; 35 35 unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; 36 + EXPORT_SYMBOL(__node_distances); 36 37 struct node_data *__node_data[MAX_NUMNODES]; 37 38 EXPORT_SYMBOL(__node_data); 38 39
+4
arch/mips/mm/tlb-r4k.c
··· 299 299 300 300 local_irq_save(flags); 301 301 302 + htw_stop(); 302 303 pid = read_c0_entryhi() & ASID_MASK; 303 304 address &= (PAGE_MASK << 1); 304 305 write_c0_entryhi(address | pid); ··· 347 346 tlb_write_indexed(); 348 347 } 349 348 tlbw_use_hazard(); 349 + htw_start(); 350 350 flush_itlb_vm(vma); 351 351 local_irq_restore(flags); 352 352 } ··· 424 422 425 423 local_irq_save(flags); 426 424 /* Save old context and create impossible VPN2 value */ 425 + htw_stop(); 427 426 old_ctx = read_c0_entryhi(); 428 427 old_pagemask = read_c0_pagemask(); 429 428 wired = read_c0_wired(); ··· 446 443 447 444 write_c0_entryhi(old_ctx); 448 445 write_c0_pagemask(old_pagemask); 446 + htw_start(); 449 447 out: 450 448 local_irq_restore(flags); 451 449 return ret;
+9 -1
arch/mips/mm/tlbex.c
··· 1872 1872 uasm_l_smp_pgtable_change(l, *p); 1873 1873 #endif 1874 1874 iPTE_LW(p, wr.r1, wr.r2); /* get even pte */ 1875 - if (!m4kc_tlbp_war()) 1875 + if (!m4kc_tlbp_war()) { 1876 1876 build_tlb_probe_entry(p); 1877 + if (cpu_has_htw) { 1878 + /* race condition happens, leaving */ 1879 + uasm_i_ehb(p); 1880 + uasm_i_mfc0(p, wr.r3, C0_INDEX); 1881 + uasm_il_bltz(p, r, wr.r3, label_leave); 1882 + uasm_i_nop(p); 1883 + } 1884 + } 1877 1885 return wr; 1878 1886 } 1879 1887
+2 -6
arch/mips/mti-sead3/sead3-leds.c
··· 5 5 * 6 6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. 7 7 */ 8 - #include <linux/module.h> 8 + #include <linux/init.h> 9 9 #include <linux/leds.h> 10 10 #include <linux/platform_device.h> 11 11 ··· 76 76 return platform_device_register(&fled_device); 77 77 } 78 78 79 - module_init(led_init); 80 - 81 - MODULE_AUTHOR("Chris Dearman <chris@mips.com>"); 82 - MODULE_LICENSE("GPL"); 83 - MODULE_DESCRIPTION("LED probe driver for SEAD-3"); 79 + device_initcall(led_init);
+8 -4
arch/mips/netlogic/xlp/Makefile
··· 1 1 obj-y += setup.o nlm_hal.o cop2-ex.o dt.o 2 2 obj-$(CONFIG_SMP) += wakeup.o 3 - obj-$(CONFIG_USB) += usb-init.o 4 - obj-$(CONFIG_USB) += usb-init-xlp2.o 5 - obj-$(CONFIG_SATA_AHCI) += ahci-init.o 6 - obj-$(CONFIG_SATA_AHCI) += ahci-init-xlp2.o 3 + ifdef CONFIG_USB 4 + obj-y += usb-init.o 5 + obj-y += usb-init-xlp2.o 6 + endif 7 + ifdef CONFIG_SATA_AHCI 8 + obj-y += ahci-init.o 9 + obj-y += ahci-init-xlp2.o 10 + endif
+1 -1
arch/mips/oprofile/backtrace.c
··· 92 92 /* This marks the end of the previous function, 93 93 which means we overran. */ 94 94 break; 95 - stack_size = (unsigned) stack_adjustment; 95 + stack_size = (unsigned long) stack_adjustment; 96 96 } else if (is_ra_save_ins(&ip)) { 97 97 int ra_slot = ip.i_format.simmediate; 98 98 if (ra_slot < 0)
+1
arch/mips/sgi-ip27/ip27-memory.c
··· 107 107 } 108 108 109 109 unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; 110 + EXPORT_SYMBOL(__node_distances); 110 111 111 112 static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) 112 113 {
+8 -11
arch/parisc/include/asm/uaccess.h
··· 9 9 #include <asm/errno.h> 10 10 #include <asm-generic/uaccess-unaligned.h> 11 11 12 + #include <linux/bug.h> 13 + 12 14 #define VERIFY_READ 0 13 15 #define VERIFY_WRITE 1 14 16 ··· 30 28 * that put_user is the same as __put_user, etc. 31 29 */ 32 30 33 - extern int __get_kernel_bad(void); 34 - extern int __get_user_bad(void); 35 - extern int __put_kernel_bad(void); 36 - extern int __put_user_bad(void); 37 - 38 31 static inline long access_ok(int type, const void __user * addr, 39 32 unsigned long size) 40 33 { ··· 40 43 #define get_user __get_user 41 44 42 45 #if !defined(CONFIG_64BIT) 43 - #define LDD_KERNEL(ptr) __get_kernel_bad(); 44 - #define LDD_USER(ptr) __get_user_bad(); 46 + #define LDD_KERNEL(ptr) BUILD_BUG() 47 + #define LDD_USER(ptr) BUILD_BUG() 45 48 #define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) 46 49 #define STD_USER(x, ptr) __put_user_asm64(x,ptr) 47 50 #define ASM_WORD_INSN ".word\t" ··· 91 94 case 2: __get_kernel_asm("ldh",ptr); break; \ 92 95 case 4: __get_kernel_asm("ldw",ptr); break; \ 93 96 case 8: LDD_KERNEL(ptr); break; \ 94 - default: __get_kernel_bad(); break; \ 97 + default: BUILD_BUG(); break; \ 95 98 } \ 96 99 } \ 97 100 else { \ ··· 100 103 case 2: __get_user_asm("ldh",ptr); break; \ 101 104 case 4: __get_user_asm("ldw",ptr); break; \ 102 105 case 8: LDD_USER(ptr); break; \ 103 - default: __get_user_bad(); break; \ 106 + default: BUILD_BUG(); break; \ 104 107 } \ 105 108 } \ 106 109 \ ··· 133 136 case 2: __put_kernel_asm("sth",__x,ptr); break; \ 134 137 case 4: __put_kernel_asm("stw",__x,ptr); break; \ 135 138 case 8: STD_KERNEL(__x,ptr); break; \ 136 - default: __put_kernel_bad(); break; \ 139 + default: BUILD_BUG(); break; \ 137 140 } \ 138 141 } \ 139 142 else { \ ··· 142 145 case 2: __put_user_asm("sth",__x,ptr); break; \ 143 146 case 4: __put_user_asm("stw",__x,ptr); break; \ 144 147 case 8: STD_USER(__x,ptr); break; \ 145 - default: __put_user_bad(); break; \ 148 + default: BUILD_BUG(); break; \ 146 149 } \ 147 150 } \ 148 151 \
+1 -7
arch/parisc/include/uapi/asm/bitsperlong.h
··· 1 1 #ifndef __ASM_PARISC_BITSPERLONG_H 2 2 #define __ASM_PARISC_BITSPERLONG_H 3 3 4 - /* 5 - * using CONFIG_* outside of __KERNEL__ is wrong, 6 - * __LP64__ was also removed from headers, so what 7 - * is the right approach on parisc? 8 - * -arnd 9 - */ 10 - #if (defined(__KERNEL__) && defined(CONFIG_64BIT)) || defined (__LP64__) 4 + #if defined(__LP64__) 11 5 #define __BITS_PER_LONG 64 12 6 #define SHIFT_PER_LONG 6 13 7 #else
+5 -3
arch/parisc/include/uapi/asm/msgbuf.h
··· 1 1 #ifndef _PARISC_MSGBUF_H 2 2 #define _PARISC_MSGBUF_H 3 3 4 + #include <asm/bitsperlong.h> 5 + 4 6 /* 5 7 * The msqid64_ds structure for parisc architecture, copied from sparc. 6 8 * Note extra padding because this structure is passed back and forth ··· 15 13 16 14 struct msqid64_ds { 17 15 struct ipc64_perm msg_perm; 18 - #ifndef CONFIG_64BIT 16 + #if __BITS_PER_LONG != 64 19 17 unsigned int __pad1; 20 18 #endif 21 19 __kernel_time_t msg_stime; /* last msgsnd time */ 22 - #ifndef CONFIG_64BIT 20 + #if __BITS_PER_LONG != 64 23 21 unsigned int __pad2; 24 22 #endif 25 23 __kernel_time_t msg_rtime; /* last msgrcv time */ 26 - #ifndef CONFIG_64BIT 24 + #if __BITS_PER_LONG != 64 27 25 unsigned int __pad3; 28 26 #endif 29 27 __kernel_time_t msg_ctime; /* last change time */
+4 -2
arch/parisc/include/uapi/asm/sembuf.h
··· 1 1 #ifndef _PARISC_SEMBUF_H 2 2 #define _PARISC_SEMBUF_H 3 3 4 + #include <asm/bitsperlong.h> 5 + 4 6 /* 5 7 * The semid64_ds structure for parisc architecture. 6 8 * Note extra padding because this structure is passed back and forth ··· 15 13 16 14 struct semid64_ds { 17 15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 18 - #ifndef CONFIG_64BIT 16 + #if __BITS_PER_LONG != 64 19 17 unsigned int __pad1; 20 18 #endif 21 19 __kernel_time_t sem_otime; /* last semop time */ 22 - #ifndef CONFIG_64BIT 20 + #if __BITS_PER_LONG != 64 23 21 unsigned int __pad2; 24 22 #endif 25 23 __kernel_time_t sem_ctime; /* last change time */
+15 -20
arch/parisc/include/uapi/asm/shmbuf.h
··· 1 1 #ifndef _PARISC_SHMBUF_H 2 2 #define _PARISC_SHMBUF_H 3 3 4 + #include <asm/bitsperlong.h> 5 + 4 6 /* 5 7 * The shmid64_ds structure for parisc architecture. 6 8 * Note extra padding because this structure is passed back and forth ··· 15 13 16 14 struct shmid64_ds { 17 15 struct ipc64_perm shm_perm; /* operation perms */ 18 - #ifndef CONFIG_64BIT 16 + #if __BITS_PER_LONG != 64 19 17 unsigned int __pad1; 20 18 #endif 21 19 __kernel_time_t shm_atime; /* last attach time */ 22 - #ifndef CONFIG_64BIT 20 + #if __BITS_PER_LONG != 64 23 21 unsigned int __pad2; 24 22 #endif 25 23 __kernel_time_t shm_dtime; /* last detach time */ 26 - #ifndef CONFIG_64BIT 24 + #if __BITS_PER_LONG != 64 27 25 unsigned int __pad3; 28 26 #endif 29 27 __kernel_time_t shm_ctime; /* last change time */ 30 - #ifndef CONFIG_64BIT 28 + #if __BITS_PER_LONG != 64 31 29 unsigned int __pad4; 32 30 #endif 33 31 size_t shm_segsz; /* size of segment (bytes) */ ··· 38 36 unsigned int __unused2; 39 37 }; 40 38 41 - #ifdef CONFIG_64BIT 42 - /* The 'unsigned int' (formerly 'unsigned long') data types below will 43 - * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on 44 - * a wide kernel, but if some of these values are meant to contain pointers 45 - * they may need to be 'long long' instead. -PB XXX FIXME 46 - */ 47 - #endif 48 39 struct shminfo64 { 49 - unsigned int shmmax; 50 - unsigned int shmmin; 51 - unsigned int shmmni; 52 - unsigned int shmseg; 53 - unsigned int shmall; 54 - unsigned int __unused1; 55 - unsigned int __unused2; 56 - unsigned int __unused3; 57 - unsigned int __unused4; 40 + unsigned long shmmax; 41 + unsigned long shmmin; 42 + unsigned long shmmni; 43 + unsigned long shmseg; 44 + unsigned long shmall; 45 + unsigned long __unused1; 46 + unsigned long __unused2; 47 + unsigned long __unused3; 48 + unsigned long __unused4; 58 49 }; 59 50 60 51 #endif /* _PARISC_SHMBUF_H */
+1 -1
arch/parisc/include/uapi/asm/signal.h
··· 85 85 struct siginfo; 86 86 87 87 /* Type of a signal handler. */ 88 - #ifdef CONFIG_64BIT 88 + #if defined(__LP64__) 89 89 /* function pointers on 64-bit parisc are pointers to little structs and the 90 90 * compiler doesn't support code which changes or tests the address of 91 91 * the function in the little struct. This is really ugly -PB
+2 -1
arch/parisc/include/uapi/asm/unistd.h
··· 833 833 #define __NR_seccomp (__NR_Linux + 338) 834 834 #define __NR_getrandom (__NR_Linux + 339) 835 835 #define __NR_memfd_create (__NR_Linux + 340) 836 + #define __NR_bpf (__NR_Linux + 341) 836 837 837 - #define __NR_Linux_syscalls (__NR_memfd_create + 1) 838 + #define __NR_Linux_syscalls (__NR_bpf + 1) 838 839 839 840 840 841 #define __IGNORE_select /* newselect */
+5 -4
arch/parisc/kernel/syscall_table.S
··· 286 286 ENTRY_COMP(msgsnd) 287 287 ENTRY_COMP(msgrcv) 288 288 ENTRY_SAME(msgget) /* 190 */ 289 - ENTRY_SAME(msgctl) 290 - ENTRY_SAME(shmat) 289 + ENTRY_COMP(msgctl) 290 + ENTRY_COMP(shmat) 291 291 ENTRY_SAME(shmdt) 292 292 ENTRY_SAME(shmget) 293 - ENTRY_SAME(shmctl) /* 195 */ 293 + ENTRY_COMP(shmctl) /* 195 */ 294 294 ENTRY_SAME(ni_syscall) /* streams1 */ 295 295 ENTRY_SAME(ni_syscall) /* streams2 */ 296 296 ENTRY_SAME(lstat64) ··· 323 323 ENTRY_SAME(epoll_ctl) /* 225 */ 324 324 ENTRY_SAME(epoll_wait) 325 325 ENTRY_SAME(remap_file_pages) 326 - ENTRY_SAME(semtimedop) 326 + ENTRY_COMP(semtimedop) 327 327 ENTRY_COMP(mq_open) 328 328 ENTRY_SAME(mq_unlink) /* 230 */ 329 329 ENTRY_COMP(mq_timedsend) ··· 436 436 ENTRY_SAME(seccomp) 437 437 ENTRY_SAME(getrandom) 438 438 ENTRY_SAME(memfd_create) /* 340 */ 439 + ENTRY_SAME(bpf) 439 440 440 441 /* Nothing yet */ 441 442
-2
arch/powerpc/include/asm/pci-bridge.h
··· 159 159 160 160 int pci_ext_config_space; /* for pci devices */ 161 161 162 - bool force_32bit_msi; 163 - 164 162 struct pci_dev *pcidev; /* back-pointer to the pci device */ 165 163 #ifdef CONFIG_EEH 166 164 struct eeh_dev *edev; /* eeh device */
+1 -1
arch/powerpc/kernel/eeh_sysfs.c
··· 65 65 return -ENODEV; 66 66 67 67 state = eeh_ops->get_state(edev->pe, NULL); 68 - return sprintf(buf, "%0x08x %0x08x\n", 68 + return sprintf(buf, "0x%08x 0x%08x\n", 69 69 state, edev->pe->state); 70 70 } 71 71
-10
arch/powerpc/kernel/pci_64.c
··· 266 266 } 267 267 EXPORT_SYMBOL(pcibus_to_node); 268 268 #endif 269 - 270 - static void quirk_radeon_32bit_msi(struct pci_dev *dev) 271 - { 272 - struct pci_dn *pdn = pci_get_pdn(dev); 273 - 274 - if (pdn) 275 - pdn->force_32bit_msi = true; 276 - } 277 - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon_32bit_msi); 278 - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi);
+2 -2
arch/powerpc/kernel/vdso32/getcpu.S
··· 30 30 V_FUNCTION_BEGIN(__kernel_getcpu) 31 31 .cfi_startproc 32 32 mfspr r5,SPRN_SPRG_VDSO_READ 33 - cmpdi cr0,r3,0 34 - cmpdi cr1,r4,0 33 + cmpwi cr0,r3,0 34 + cmpwi cr1,r4,0 35 35 clrlwi r6,r5,16 36 36 rlwinm r7,r5,16,31-15,31-0 37 37 beq cr0,1f
+1 -1
arch/powerpc/platforms/powernv/opal-hmi.c
··· 57 57 }; 58 58 59 59 /* Print things out */ 60 - if (hmi_evt->version != OpalHMIEvt_V1) { 60 + if (hmi_evt->version < OpalHMIEvt_V1) { 61 61 pr_err("HMI Interrupt, Unknown event version %d !\n", 62 62 hmi_evt->version); 63 63 return;
+2 -3
arch/powerpc/platforms/powernv/pci-ioda.c
··· 1509 1509 unsigned int is_64, struct msi_msg *msg) 1510 1510 { 1511 1511 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); 1512 - struct pci_dn *pdn = pci_get_pdn(dev); 1513 1512 unsigned int xive_num = hwirq - phb->msi_base; 1514 1513 __be32 data; 1515 1514 int rc; ··· 1522 1523 return -ENXIO; 1523 1524 1524 1525 /* Force 32-bit MSI on some broken devices */ 1525 - if (pdn && pdn->force_32bit_msi) 1526 + if (dev->no_64bit_msi) 1526 1527 is_64 = 0; 1527 1528 1528 1529 /* Assign XIVE to PE */ ··· 1996 1997 if (is_kdump_kernel()) { 1997 1998 pr_info(" Issue PHB reset ...\n"); 1998 1999 ioda_eeh_phb_reset(hose, EEH_RESET_FUNDAMENTAL); 1999 - ioda_eeh_phb_reset(hose, OPAL_DEASSERT_RESET); 2000 + ioda_eeh_phb_reset(hose, EEH_RESET_DEACTIVATE); 2000 2001 } 2001 2002 2002 2003 /* Configure M64 window */
+1 -2
arch/powerpc/platforms/powernv/pci.c
··· 50 50 { 51 51 struct pci_controller *hose = pci_bus_to_host(pdev->bus); 52 52 struct pnv_phb *phb = hose->private_data; 53 - struct pci_dn *pdn = pci_get_pdn(pdev); 54 53 struct msi_desc *entry; 55 54 struct msi_msg msg; 56 55 int hwirq; ··· 59 60 if (WARN_ON(!phb) || !phb->msi_bmp.bitmap) 60 61 return -ENODEV; 61 62 62 - if (pdn && pdn->force_32bit_msi && !phb->msi32_support) 63 + if (pdev->no_64bit_msi && !phb->msi32_support) 63 64 return -ENODEV; 64 65 65 66 list_for_each_entry(entry, &pdev->msi_list, list) {
+1 -1
arch/powerpc/platforms/pseries/msi.c
··· 420 420 */ 421 421 again: 422 422 if (type == PCI_CAP_ID_MSI) { 423 - if (pdn->force_32bit_msi) { 423 + if (pdev->no_64bit_msi) { 424 424 rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); 425 425 if (rc < 0) { 426 426 /*
+1 -1
arch/powerpc/sysdev/fsl_msi.c
··· 361 361 cascade_data->virq = virt_msir; 362 362 msi->cascade_array[irq_index] = cascade_data; 363 363 364 - ret = request_irq(virt_msir, fsl_msi_cascade, 0, 364 + ret = request_irq(virt_msir, fsl_msi_cascade, IRQF_NO_THREAD, 365 365 "fsl-msi-cascade", cascade_data); 366 366 if (ret) { 367 367 dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n",
+3 -3
arch/powerpc/xmon/xmon.c
··· 293 293 args.token = rtas_token("set-indicator"); 294 294 if (args.token == RTAS_UNKNOWN_SERVICE) 295 295 return; 296 - args.nargs = 3; 297 - args.nret = 1; 296 + args.nargs = cpu_to_be32(3); 297 + args.nret = cpu_to_be32(1); 298 298 args.rets = &args.args[3]; 299 - args.args[0] = SURVEILLANCE_TOKEN; 299 + args.args[0] = cpu_to_be32(SURVEILLANCE_TOKEN); 300 300 args.args[1] = 0; 301 301 args.args[2] = 0; 302 302 enter_rtas(__pa(&args));
+1 -1
arch/sparc/include/asm/atomic_32.h
··· 22 22 23 23 int atomic_add_return(int, atomic_t *); 24 24 int atomic_cmpxchg(atomic_t *, int, int); 25 - #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 25 + int atomic_xchg(atomic_t *, int); 26 26 int __atomic_add_unless(atomic_t *, int, int); 27 27 void atomic_set(atomic_t *, int); 28 28
+2 -10
arch/sparc/include/asm/cmpxchg_32.h
··· 11 11 #ifndef __ARCH_SPARC_CMPXCHG__ 12 12 #define __ARCH_SPARC_CMPXCHG__ 13 13 14 - static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) 15 - { 16 - __asm__ __volatile__("swap [%2], %0" 17 - : "=&r" (val) 18 - : "0" (val), "r" (m) 19 - : "memory"); 20 - return val; 21 - } 22 - 14 + unsigned long __xchg_u32(volatile u32 *m, u32 new); 23 15 void __xchg_called_with_bad_pointer(void); 24 16 25 17 static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) 26 18 { 27 19 switch (size) { 28 20 case 4: 29 - return xchg_u32(ptr, x); 21 + return __xchg_u32(ptr, x); 30 22 } 31 23 __xchg_called_with_bad_pointer(); 32 24 return x;
+8
arch/sparc/include/asm/dma-mapping.h
··· 12 12 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 13 13 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 14 14 15 + static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 16 + enum dma_data_direction dir) 17 + { 18 + /* Since dma_{alloc,free}_noncoherent() allocated coherent memory, this 19 + * routine can be a nop. 20 + */ 21 + } 22 + 15 23 extern struct dma_map_ops *dma_ops; 16 24 extern struct dma_map_ops *leon_dma_ops; 17 25 extern struct dma_map_ops pci32_dma_ops;
+6 -6
arch/sparc/include/uapi/asm/swab.h
··· 9 9 { 10 10 __u16 ret; 11 11 12 - __asm__ __volatile__ ("lduha [%1] %2, %0" 12 + __asm__ __volatile__ ("lduha [%2] %3, %0" 13 13 : "=r" (ret) 14 - : "r" (addr), "i" (ASI_PL)); 14 + : "m" (*addr), "r" (addr), "i" (ASI_PL)); 15 15 return ret; 16 16 } 17 17 #define __arch_swab16p __arch_swab16p ··· 20 20 { 21 21 __u32 ret; 22 22 23 - __asm__ __volatile__ ("lduwa [%1] %2, %0" 23 + __asm__ __volatile__ ("lduwa [%2] %3, %0" 24 24 : "=r" (ret) 25 - : "r" (addr), "i" (ASI_PL)); 25 + : "m" (*addr), "r" (addr), "i" (ASI_PL)); 26 26 return ret; 27 27 } 28 28 #define __arch_swab32p __arch_swab32p ··· 31 31 { 32 32 __u64 ret; 33 33 34 - __asm__ __volatile__ ("ldxa [%1] %2, %0" 34 + __asm__ __volatile__ ("ldxa [%2] %3, %0" 35 35 : "=r" (ret) 36 - : "r" (addr), "i" (ASI_PL)); 36 + : "m" (*addr), "r" (addr), "i" (ASI_PL)); 37 37 return ret; 38 38 } 39 39 #define __arch_swab64p __arch_swab64p
+3 -3
arch/sparc/kernel/pci_schizo.c
··· 581 581 { 582 582 unsigned long csr_reg, csr, csr_error_bits; 583 583 irqreturn_t ret = IRQ_NONE; 584 - u16 stat; 584 + u32 stat; 585 585 586 586 csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL; 587 587 csr = upa_readq(csr_reg); ··· 617 617 pbm->name); 618 618 ret = IRQ_HANDLED; 619 619 } 620 - pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat); 620 + pbm->pci_ops->read(pbm->pci_bus, 0, PCI_STATUS, 2, &stat); 621 621 if (stat & (PCI_STATUS_PARITY | 622 622 PCI_STATUS_SIG_TARGET_ABORT | 623 623 PCI_STATUS_REC_TARGET_ABORT | ··· 625 625 PCI_STATUS_SIG_SYSTEM_ERROR)) { 626 626 printk("%s: PCI bus error, PCI_STATUS[%04x]\n", 627 627 pbm->name, stat); 628 - pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff); 628 + pbm->pci_ops->write(pbm->pci_bus, 0, PCI_STATUS, 2, 0xffff); 629 629 ret = IRQ_HANDLED; 630 630 } 631 631 return ret;
+4
arch/sparc/kernel/smp_64.c
··· 816 816 void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs) 817 817 { 818 818 clear_softint(1 << irq); 819 + irq_enter(); 819 820 generic_smp_call_function_interrupt(); 821 + irq_exit(); 820 822 } 821 823 822 824 void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs) 823 825 { 824 826 clear_softint(1 << irq); 827 + irq_enter(); 825 828 generic_smp_call_function_single_interrupt(); 829 + irq_exit(); 826 830 } 827 831 828 832 static void tsb_sync(void *info)
+27
arch/sparc/lib/atomic32.c
··· 45 45 46 46 #undef ATOMIC_OP 47 47 48 + int atomic_xchg(atomic_t *v, int new) 49 + { 50 + int ret; 51 + unsigned long flags; 52 + 53 + spin_lock_irqsave(ATOMIC_HASH(v), flags); 54 + ret = v->counter; 55 + v->counter = new; 56 + spin_unlock_irqrestore(ATOMIC_HASH(v), flags); 57 + return ret; 58 + } 59 + EXPORT_SYMBOL(atomic_xchg); 60 + 48 61 int atomic_cmpxchg(atomic_t *v, int old, int new) 49 62 { 50 63 int ret; ··· 150 137 return (unsigned long)prev; 151 138 } 152 139 EXPORT_SYMBOL(__cmpxchg_u32); 140 + 141 + unsigned long __xchg_u32(volatile u32 *ptr, u32 new) 142 + { 143 + unsigned long flags; 144 + u32 prev; 145 + 146 + spin_lock_irqsave(ATOMIC_HASH(ptr), flags); 147 + prev = *ptr; 148 + *ptr = new; 149 + spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags); 150 + 151 + return (unsigned long)prev; 152 + } 153 + EXPORT_SYMBOL(__xchg_u32);
+1 -1
arch/x86/Kconfig
··· 144 144 145 145 config PERF_EVENTS_INTEL_UNCORE 146 146 def_bool y 147 - depends on PERF_EVENTS && SUP_SUP_INTEL && PCI 147 + depends on PERF_EVENTS && CPU_SUP_INTEL && PCI 148 148 149 149 config OUTPUT_FORMAT 150 150 string
+3 -1
arch/x86/boot/compressed/Makefile
··· 76 76 suffix-$(CONFIG_KERNEL_LZO) := lzo 77 77 suffix-$(CONFIG_KERNEL_LZ4) := lz4 78 78 79 + RUN_SIZE = $(shell objdump -h vmlinux | \ 80 + perl $(srctree)/arch/x86/tools/calc_run_size.pl) 79 81 quiet_cmd_mkpiggy = MKPIGGY $@ 80 - cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) 82 + cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) 81 83 82 84 targets += piggy.S 83 85 $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE
+3 -2
arch/x86/boot/compressed/head_32.S
··· 207 207 * Do the decompression, and jump to the new kernel.. 208 208 */ 209 209 /* push arguments for decompress_kernel: */ 210 - pushl $z_output_len /* decompressed length */ 210 + pushl $z_run_size /* size of kernel with .bss and .brk */ 211 + pushl $z_output_len /* decompressed length, end of relocs */ 211 212 leal z_extract_offset_negative(%ebx), %ebp 212 213 pushl %ebp /* output address */ 213 214 pushl $z_input_len /* input_len */ ··· 218 217 pushl %eax /* heap area */ 219 218 pushl %esi /* real mode pointer */ 220 219 call decompress_kernel /* returns kernel location in %eax */ 221 - addl $24, %esp 220 + addl $28, %esp 222 221 223 222 /* 224 223 * Jump to the decompressed kernel.
+4 -1
arch/x86/boot/compressed/head_64.S
··· 402 402 * Do the decompression, and jump to the new kernel.. 403 403 */ 404 404 pushq %rsi /* Save the real mode argument */ 405 + movq $z_run_size, %r9 /* size of kernel with .bss and .brk */ 406 + pushq %r9 405 407 movq %rsi, %rdi /* real mode address */ 406 408 leaq boot_heap(%rip), %rsi /* malloc area for uncompression */ 407 409 leaq input_data(%rip), %rdx /* input_data */ 408 410 movl $z_input_len, %ecx /* input_len */ 409 411 movq %rbp, %r8 /* output target address */ 410 - movq $z_output_len, %r9 /* decompressed length */ 412 + movq $z_output_len, %r9 /* decompressed length, end of relocs */ 411 413 call decompress_kernel /* returns kernel location in %rax */ 414 + popq %r9 412 415 popq %rsi 413 416 414 417 /*
+10 -3
arch/x86/boot/compressed/misc.c
··· 358 358 unsigned char *input_data, 359 359 unsigned long input_len, 360 360 unsigned char *output, 361 - unsigned long output_len) 361 + unsigned long output_len, 362 + unsigned long run_size) 362 363 { 363 364 real_mode = rmode; 364 365 ··· 382 381 free_mem_ptr = heap; /* Heap */ 383 382 free_mem_end_ptr = heap + BOOT_HEAP_SIZE; 384 383 385 - output = choose_kernel_location(input_data, input_len, 386 - output, output_len); 384 + /* 385 + * The memory hole needed for the kernel is the larger of either 386 + * the entire decompressed kernel plus relocation table, or the 387 + * entire decompressed kernel plus .bss and .brk sections. 388 + */ 389 + output = choose_kernel_location(input_data, input_len, output, 390 + output_len > run_size ? output_len 391 + : run_size); 387 392 388 393 /* Validate memory location choices. */ 389 394 if ((unsigned long)output & (MIN_KERNEL_ALIGN - 1))
+7 -2
arch/x86/boot/compressed/mkpiggy.c
··· 36 36 uint32_t olen; 37 37 long ilen; 38 38 unsigned long offs; 39 + unsigned long run_size; 39 40 FILE *f = NULL; 40 41 int retval = 1; 41 42 42 - if (argc < 2) { 43 - fprintf(stderr, "Usage: %s compressed_file\n", argv[0]); 43 + if (argc < 3) { 44 + fprintf(stderr, "Usage: %s compressed_file run_size\n", 45 + argv[0]); 44 46 goto bail; 45 47 } 46 48 ··· 76 74 offs += olen >> 12; /* Add 8 bytes for each 32K block */ 77 75 offs += 64*1024 + 128; /* Add 64K + 128 bytes slack */ 78 76 offs = (offs+4095) & ~4095; /* Round to a 4K boundary */ 77 + run_size = atoi(argv[2]); 79 78 80 79 printf(".section \".rodata..compressed\",\"a\",@progbits\n"); 81 80 printf(".globl z_input_len\n"); ··· 88 85 /* z_extract_offset_negative allows simplification of head_32.S */ 89 86 printf(".globl z_extract_offset_negative\n"); 90 87 printf("z_extract_offset_negative = -0x%lx\n", offs); 88 + printf(".globl z_run_size\n"); 89 + printf("z_run_size = %lu\n", run_size); 91 90 92 91 printf(".globl input_data, input_data_end\n"); 93 92 printf("input_data:\n");
-1
arch/x86/include/asm/page_32_types.h
··· 20 20 #define THREAD_SIZE_ORDER 1 21 21 #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) 22 22 23 - #define STACKFAULT_STACK 0 24 23 #define DOUBLEFAULT_STACK 1 25 24 #define NMI_STACK 0 26 25 #define DEBUG_STACK 0
+5 -6
arch/x86/include/asm/page_64_types.h
··· 14 14 #define IRQ_STACK_ORDER 2 15 15 #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) 16 16 17 - #define STACKFAULT_STACK 1 18 - #define DOUBLEFAULT_STACK 2 19 - #define NMI_STACK 3 20 - #define DEBUG_STACK 4 21 - #define MCE_STACK 5 22 - #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ 17 + #define DOUBLEFAULT_STACK 1 18 + #define NMI_STACK 2 19 + #define DEBUG_STACK 3 20 + #define MCE_STACK 4 21 + #define N_EXCEPTION_STACKS 4 /* hw limit: 7 */ 23 22 24 23 #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) 25 24 #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
+1
arch/x86/include/asm/smp.h
··· 150 150 } 151 151 152 152 void cpu_disable_common(void); 153 + void cpu_die_common(unsigned int cpu); 153 154 void native_smp_prepare_boot_cpu(void); 154 155 void native_smp_prepare_cpus(unsigned int max_cpus); 155 156 void native_smp_cpus_done(unsigned int max_cpus);
+1 -1
arch/x86/include/asm/thread_info.h
··· 141 141 /* Only used for 64 bit */ 142 142 #define _TIF_DO_NOTIFY_MASK \ 143 143 (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME | \ 144 - _TIF_USER_RETURN_NOTIFY) 144 + _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE) 145 145 146 146 /* flags to check in __switch_to() */ 147 147 #define _TIF_WORK_CTXSW \
+1
arch/x86/include/asm/traps.h
··· 39 39 40 40 #ifdef CONFIG_TRACING 41 41 asmlinkage void trace_page_fault(void); 42 + #define trace_stack_segment stack_segment 42 43 #define trace_divide_error divide_error 43 44 #define trace_bounds bounds 44 45 #define trace_invalid_op invalid_op
+2
arch/x86/kernel/cpu/common.c
··· 146 146 147 147 static int __init x86_xsave_setup(char *s) 148 148 { 149 + if (strlen(s)) 150 + return 0; 149 151 setup_clear_cpu_cap(X86_FEATURE_XSAVE); 150 152 setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); 151 153 setup_clear_cpu_cap(X86_FEATURE_XSAVES);
+21 -12
arch/x86/kernel/cpu/microcode/amd_early.c
··· 108 108 * load_microcode_amd() to save equivalent cpu table and microcode patches in 109 109 * kernel heap memory. 110 110 */ 111 - static void apply_ucode_in_initrd(void *ucode, size_t size) 111 + static void apply_ucode_in_initrd(void *ucode, size_t size, bool save_patch) 112 112 { 113 113 struct equiv_cpu_entry *eq; 114 114 size_t *cont_sz; 115 115 u32 *header; 116 116 u8 *data, **cont; 117 + u8 (*patch)[PATCH_MAX_SIZE]; 117 118 u16 eq_id = 0; 118 119 int offset, left; 119 120 u32 rev, eax, ebx, ecx, edx; ··· 124 123 new_rev = (u32 *)__pa_nodebug(&ucode_new_rev); 125 124 cont_sz = (size_t *)__pa_nodebug(&container_size); 126 125 cont = (u8 **)__pa_nodebug(&container); 126 + patch = (u8 (*)[PATCH_MAX_SIZE])__pa_nodebug(&amd_ucode_patch); 127 127 #else 128 128 new_rev = &ucode_new_rev; 129 129 cont_sz = &container_size; 130 130 cont = &container; 131 + patch = &amd_ucode_patch; 131 132 #endif 132 133 133 134 data = ucode; ··· 216 213 rev = mc->hdr.patch_id; 217 214 *new_rev = rev; 218 215 219 - /* save ucode patch */ 220 - memcpy(amd_ucode_patch, mc, 221 - min_t(u32, header[1], PATCH_MAX_SIZE)); 216 + if (save_patch) 217 + memcpy(patch, mc, 218 + min_t(u32, header[1], PATCH_MAX_SIZE)); 222 219 } 223 220 } 224 221 ··· 249 246 *data = cp.data; 250 247 *size = cp.size; 251 248 252 - apply_ucode_in_initrd(cp.data, cp.size); 249 + apply_ucode_in_initrd(cp.data, cp.size, true); 253 250 } 254 251 255 252 #ifdef CONFIG_X86_32 ··· 266 263 size_t *usize; 267 264 void **ucode; 268 265 269 - mc = (struct microcode_amd *)__pa(amd_ucode_patch); 266 + mc = (struct microcode_amd *)__pa_nodebug(amd_ucode_patch); 270 267 if (mc->hdr.patch_id && mc->hdr.processor_rev_id) { 271 268 __apply_microcode_amd(mc); 272 269 return; ··· 278 275 if (!*ucode || !*usize) 279 276 return; 280 277 281 - apply_ucode_in_initrd(*ucode, *usize); 278 + apply_ucode_in_initrd(*ucode, *usize, false); 282 279 } 283 280 284 281 static void __init collect_cpu_sig_on_bsp(void *arg) ··· 342 339 * AP has a different equivalence ID than BSP, looks like 343 340 * mixed-steppings silicon so go through the ucode blob anew. 344 341 */ 345 - apply_ucode_in_initrd(ucode_cpio.data, ucode_cpio.size); 342 + apply_ucode_in_initrd(ucode_cpio.data, ucode_cpio.size, false); 346 343 } 347 344 } 348 345 #endif ··· 350 347 int __init save_microcode_in_initrd_amd(void) 351 348 { 352 349 unsigned long cont; 350 + int retval = 0; 353 351 enum ucode_state ret; 352 + u8 *cont_va; 354 353 u32 eax; 355 354 356 355 if (!container) ··· 360 355 361 356 #ifdef CONFIG_X86_32 362 357 get_bsp_sig(); 363 - cont = (unsigned long)container; 358 + cont = (unsigned long)container; 359 + cont_va = __va(container); 364 360 #else 365 361 /* 366 362 * We need the physical address of the container for both bitness since 367 363 * boot_params.hdr.ramdisk_image is a physical address. 368 364 */ 369 - cont = __pa(container); 365 + cont = __pa(container); 366 + cont_va = container; 370 367 #endif 371 368 372 369 /* ··· 379 372 if (relocated_ramdisk) 380 373 container = (u8 *)(__va(relocated_ramdisk) + 381 374 (cont - boot_params.hdr.ramdisk_image)); 375 + else 376 + container = cont_va; 382 377 383 378 if (ucode_new_rev) 384 379 pr_info("microcode: updated early to new patch_level=0x%08x\n", ··· 391 382 392 383 ret = load_microcode_amd(eax, container, container_size); 393 384 if (ret != UCODE_OK) 394 - return -EINVAL; 385 + retval = -EINVAL; 395 386 396 387 /* 397 388 * This will be freed any msec now, stash patches for the current ··· 400 391 container = NULL; 401 392 container_size = 0; 402 393 403 - return 0; 394 + return retval; 404 395 }
+8
arch/x86/kernel/cpu/microcode/core.c
··· 465 465 466 466 if (uci->valid && uci->mc) 467 467 microcode_ops->apply_microcode(cpu); 468 + else if (!uci->mc) 469 + /* 470 + * We might resume and not have applied late microcode but still 471 + * have a newer patch stashed from the early loader. We don't 472 + * have it in uci->mc so we have to load it the same way we're 473 + * applying patches early on the APs. 474 + */ 475 + load_ucode_ap(); 468 476 } 469 477 470 478 static struct syscore_ops mc_syscore_ops = {
+1 -1
arch/x86/kernel/cpu/microcode/core_early.c
··· 124 124 static bool check_loader_disabled_ap(void) 125 125 { 126 126 #ifdef CONFIG_X86_32 127 - return __pa_nodebug(dis_ucode_ldr); 127 + return *((bool *)__pa_nodebug(&dis_ucode_ldr)); 128 128 #else 129 129 return dis_ucode_ldr; 130 130 #endif
+45 -4
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
··· 486 486 .attrs = snbep_uncore_qpi_formats_attr, 487 487 }; 488 488 489 - #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ 490 - .init_box = snbep_uncore_msr_init_box, \ 489 + #define __SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ 491 490 .disable_box = snbep_uncore_msr_disable_box, \ 492 491 .enable_box = snbep_uncore_msr_enable_box, \ 493 492 .disable_event = snbep_uncore_msr_disable_event, \ 494 493 .enable_event = snbep_uncore_msr_enable_event, \ 495 494 .read_counter = uncore_msr_read_counter 495 + 496 + #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ 497 + __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), \ 498 + .init_box = snbep_uncore_msr_init_box \ 496 499 497 500 static struct intel_uncore_ops snbep_uncore_msr_ops = { 498 501 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), ··· 1922 1919 .format_group = &hswep_uncore_cbox_format_group, 1923 1920 }; 1924 1921 1922 + /* 1923 + * Write SBOX Initialization register bit by bit to avoid spurious #GPs 1924 + */ 1925 + static void hswep_uncore_sbox_msr_init_box(struct intel_uncore_box *box) 1926 + { 1927 + unsigned msr = uncore_msr_box_ctl(box); 1928 + 1929 + if (msr) { 1930 + u64 init = SNBEP_PMON_BOX_CTL_INT; 1931 + u64 flags = 0; 1932 + int i; 1933 + 1934 + for_each_set_bit(i, (unsigned long *)&init, 64) { 1935 + flags |= (1ULL << i); 1936 + wrmsrl(msr, flags); 1937 + } 1938 + } 1939 + } 1940 + 1941 + static struct intel_uncore_ops hswep_uncore_sbox_msr_ops = { 1942 + __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), 1943 + .init_box = hswep_uncore_sbox_msr_init_box 1944 + }; 1945 + 1925 1946 static struct attribute *hswep_uncore_sbox_formats_attr[] = { 1926 1947 &format_attr_event.attr, 1927 1948 &format_attr_umask.attr, ··· 1971 1944 .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK, 1972 1945 .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL, 1973 1946 .msr_offset = HSWEP_SBOX_MSR_OFFSET, 1974 - .ops = &snbep_uncore_msr_ops, 1947 + .ops = &hswep_uncore_sbox_msr_ops, 1975 1948 .format_group = &hswep_uncore_sbox_format_group, 1976 1949 }; 1977 1950 ··· 2052 2025 SNBEP_UNCORE_PCI_COMMON_INIT(), 2053 2026 }; 2054 2027 2028 + static unsigned hswep_uncore_irp_ctrs[] = {0xa0, 0xa8, 0xb0, 0xb8}; 2029 + 2030 + static u64 hswep_uncore_irp_read_counter(struct intel_uncore_box *box, struct perf_event *event) 2031 + { 2032 + struct pci_dev *pdev = box->pci_dev; 2033 + struct hw_perf_event *hwc = &event->hw; 2034 + u64 count = 0; 2035 + 2036 + pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx], (u32 *)&count); 2037 + pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx] + 4, (u32 *)&count + 1); 2038 + 2039 + return count; 2040 + } 2041 + 2055 2042 static struct intel_uncore_ops hswep_uncore_irp_ops = { 2056 2043 .init_box = snbep_uncore_pci_init_box, 2057 2044 .disable_box = snbep_uncore_pci_disable_box, 2058 2045 .enable_box = snbep_uncore_pci_enable_box, 2059 2046 .disable_event = ivbep_uncore_irp_disable_event, 2060 2047 .enable_event = ivbep_uncore_irp_enable_event, 2061 - .read_counter = ivbep_uncore_irp_read_counter, 2048 + .read_counter = hswep_uncore_irp_read_counter, 2062 2049 }; 2063 2050 2064 2051 static struct intel_uncore_type hswep_uncore_irp = {
-1
arch/x86/kernel/dumpstack_64.c
··· 24 24 [ DEBUG_STACK-1 ] = "#DB", 25 25 [ NMI_STACK-1 ] = "NMI", 26 26 [ DOUBLEFAULT_STACK-1 ] = "#DF", 27 - [ STACKFAULT_STACK-1 ] = "#SS", 28 27 [ MCE_STACK-1 ] = "#MC", 29 28 #if DEBUG_STKSZ > EXCEPTION_STKSZ 30 29 [ N_EXCEPTION_STACKS ...
+22 -59
arch/x86/kernel/entry_64.S
··· 828 828 jnz native_irq_return_ldt 829 829 #endif 830 830 831 + .global native_irq_return_iret 831 832 native_irq_return_iret: 833 + /* 834 + * This may fault. Non-paranoid faults on return to userspace are 835 + * handled by fixup_bad_iret. These include #SS, #GP, and #NP. 836 + * Double-faults due to espfix64 are handled in do_double_fault. 837 + * Other faults here are fatal. 838 + */ 832 839 iretq 833 - _ASM_EXTABLE(native_irq_return_iret, bad_iret) 834 840 835 841 #ifdef CONFIG_X86_ESPFIX64 836 842 native_irq_return_ldt: ··· 863 857 popq_cfi %rax 864 858 jmp native_irq_return_iret 865 859 #endif 866 - 867 - .section .fixup,"ax" 868 - bad_iret: 869 - /* 870 - * The iret traps when the %cs or %ss being restored is bogus. 871 - * We've lost the original trap vector and error code. 872 - * #GPF is the most likely one to get for an invalid selector. 873 - * So pretend we completed the iret and took the #GPF in user mode. 874 - * 875 - * We are now running with the kernel GS after exception recovery. 876 - * But error_entry expects us to have user GS to match the user %cs, 877 - * so swap back. 878 - */ 879 - pushq $0 880 - 881 - SWAPGS 882 - jmp general_protection 883 - 884 - .previous 885 860 886 861 /* edi: workmask, edx: work */ 887 862 retint_careful: ··· 908 921 #endif 909 922 CFI_ENDPROC 910 923 END(common_interrupt) 911 - 912 - /* 913 - * If IRET takes a fault on the espfix stack, then we 914 - * end up promoting it to a doublefault. In that case, 915 - * modify the stack to make it look like we just entered 916 - * the #GP handler from user space, similar to bad_iret. 917 - */ 918 - #ifdef CONFIG_X86_ESPFIX64 919 - ALIGN 920 - __do_double_fault: 921 - XCPT_FRAME 1 RDI+8 922 - movq RSP(%rdi),%rax /* Trap on the espfix stack? */ 923 - sarq $PGDIR_SHIFT,%rax 924 - cmpl $ESPFIX_PGD_ENTRY,%eax 925 - jne do_double_fault /* No, just deliver the fault */ 926 - cmpl $__KERNEL_CS,CS(%rdi) 927 - jne do_double_fault 928 - movq RIP(%rdi),%rax 929 - cmpq $native_irq_return_iret,%rax 930 - jne do_double_fault /* This shouldn't happen... */ 931 - movq PER_CPU_VAR(kernel_stack),%rax 932 - subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */ 933 - movq %rax,RSP(%rdi) 934 - movq $0,(%rax) /* Missing (lost) #GP error code */ 935 - movq $general_protection,RIP(%rdi) 936 - retq 937 - CFI_ENDPROC 938 - END(__do_double_fault) 939 - #else 940 - # define __do_double_fault do_double_fault 941 - #endif 942 924 943 925 /* 944 926 * APIC interrupts. ··· 1080 1124 idtentry bounds do_bounds has_error_code=0 1081 1125 idtentry invalid_op do_invalid_op has_error_code=0 1082 1126 idtentry device_not_available do_device_not_available has_error_code=0 1083 - idtentry double_fault __do_double_fault has_error_code=1 paranoid=1 1127 + idtentry double_fault do_double_fault has_error_code=1 paranoid=1 1084 1128 idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0 1085 1129 idtentry invalid_TSS do_invalid_TSS has_error_code=1 1086 1130 idtentry segment_not_present do_segment_not_present has_error_code=1 ··· 1245 1289 1246 1290 idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK 1247 1291 idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK 1248 - idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1 1292 + idtentry stack_segment do_stack_segment has_error_code=1 1249 1293 #ifdef CONFIG_XEN 1250 1294 idtentry xen_debug do_debug has_error_code=0 1251 1295 idtentry xen_int3 do_int3 has_error_code=0 ··· 1355 1399 1356 1400 /* 1357 1401 * There are two places in the kernel that can potentially fault with 1358 - * usergs. Handle them here. The exception handlers after iret run with 1359 - * kernel gs again, so don't set the user space flag. B stepping K8s 1360 - * sometimes report an truncated RIP for IRET exceptions returning to 1361 - * compat mode. Check for these here too. 1402 + * usergs. Handle them here. B stepping K8s sometimes report a 1403 + * truncated RIP for IRET exceptions returning to compat mode. Check 1404 + * for these here too. 1362 1405 */ 1363 1406 error_kernelspace: 1364 1407 CFI_REL_OFFSET rcx, RCX+8 1365 1408 incl %ebx 1366 1409 leaq native_irq_return_iret(%rip),%rcx 1367 1410 cmpq %rcx,RIP+8(%rsp) 1368 - je error_swapgs 1411 + je error_bad_iret 1369 1412 movl %ecx,%eax /* zero extend */ 1370 1413 cmpq %rax,RIP+8(%rsp) 1371 1414 je bstep_iret ··· 1375 1420 bstep_iret: 1376 1421 /* Fix truncated RIP */ 1377 1422 movq %rcx,RIP+8(%rsp) 1378 - jmp error_swapgs 1423 + /* fall through */ 1424 + 1425 + error_bad_iret: 1426 + SWAPGS 1427 + mov %rsp,%rdi 1428 + call fixup_bad_iret 1429 + mov %rax,%rsp 1430 + decl %ebx /* Return to usergs */ 1431 + jmp error_sti 1379 1432 CFI_ENDPROC 1380 1433 END(error_entry) 1381 1434
+1 -1
arch/x86/kernel/ptrace.c
··· 1484 1484 */ 1485 1485 if (work & _TIF_NOHZ) { 1486 1486 user_exit(); 1487 - work &= ~TIF_NOHZ; 1487 + work &= ~_TIF_NOHZ; 1488 1488 } 1489 1489 1490 1490 #ifdef CONFIG_SECCOMP
+11 -4
arch/x86/kernel/smpboot.c
··· 1303 1303 numa_remove_cpu(cpu); 1304 1304 } 1305 1305 1306 + static DEFINE_PER_CPU(struct completion, die_complete); 1307 + 1306 1308 void cpu_disable_common(void) 1307 1309 { 1308 1310 int cpu = smp_processor_id(); 1311 + 1312 + init_completion(&per_cpu(die_complete, smp_processor_id())); 1309 1313 1310 1314 remove_siblinginfo(cpu); 1311 1315 ··· 1320 1316 fixup_irqs(); 1321 1317 } 1322 1318 1323 - static DEFINE_PER_CPU(struct completion, die_complete); 1324 - 1325 1319 int native_cpu_disable(void) 1326 1320 { 1327 1321 int ret; ··· 1329 1327 return ret; 1330 1328 1331 1329 clear_local_APIC(); 1332 - init_completion(&per_cpu(die_complete, smp_processor_id())); 1333 1330 cpu_disable_common(); 1334 1331 1335 1332 return 0; 1336 1333 } 1337 1334 1335 + void cpu_die_common(unsigned int cpu) 1336 + { 1337 + wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ); 1338 + } 1339 + 1338 1340 void native_cpu_die(unsigned int cpu) 1339 1341 { 1340 1342 /* We don't do anything here: idle task is faking death itself. */ 1341 - wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ); 1343 + 1344 + cpu_die_common(cpu); 1342 1345 1343 1346 /* They ack this in play_dead() by setting CPU_DEAD */ 1344 1347 if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
+54 -17
arch/x86/kernel/traps.c
··· 233 233 DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun) 234 234 DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS) 235 235 DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present) 236 - #ifdef CONFIG_X86_32 237 236 DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment) 238 - #endif 239 237 DO_ERROR(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check) 240 238 241 239 #ifdef CONFIG_X86_64 242 240 /* Runs on IST stack */ 243 - dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code) 244 - { 245 - enum ctx_state prev_state; 246 - 247 - prev_state = exception_enter(); 248 - if (notify_die(DIE_TRAP, "stack segment", regs, error_code, 249 - X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) { 250 - preempt_conditional_sti(regs); 251 - do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL); 252 - preempt_conditional_cli(regs); 253 - } 254 - exception_exit(prev_state); 255 - } 256 - 257 241 dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) 258 242 { 259 243 static const char str[] = "double fault"; 260 244 struct task_struct *tsk = current; 245 + 246 + #ifdef CONFIG_X86_ESPFIX64 247 + extern unsigned char native_irq_return_iret[]; 248 + 249 + /* 250 + * If IRET takes a non-IST fault on the espfix64 stack, then we 251 + * end up promoting it to a doublefault. In that case, modify 252 + * the stack to make it look like we just entered the #GP 253 + * handler from user space, similar to bad_iret. 254 + */ 255 + if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY && 256 + regs->cs == __KERNEL_CS && 257 + regs->ip == (unsigned long)native_irq_return_iret) 258 + { 259 + struct pt_regs *normal_regs = task_pt_regs(current); 260 + 261 + /* Fake a #GP(0) from userspace. */ 262 + memmove(&normal_regs->ip, (void *)regs->sp, 5*8); 263 + normal_regs->orig_ax = 0; /* Missing (lost) #GP error code */ 264 + regs->ip = (unsigned long)general_protection; 265 + regs->sp = (unsigned long)&normal_regs->orig_ax; 266 + return; 267 + } 268 + #endif 261 269 262 270 exception_enter(); 263 271 /* Return not checked because double check cannot be ignored */ ··· 407 399 return regs; 408 400 } 409 401 NOKPROBE_SYMBOL(sync_regs); 402 + 403 + struct bad_iret_stack { 404 + void *error_entry_ret; 405 + struct pt_regs regs; 406 + }; 407 + 408 + asmlinkage __visible 409 + struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s) 410 + { 411 + /* 412 + * This is called from entry_64.S early in handling a fault 413 + * caused by a bad iret to user mode. To handle the fault 414 + * correctly, we want move our stack frame to task_pt_regs 415 + * and we want to pretend that the exception came from the 416 + * iret target. 417 + */ 418 + struct bad_iret_stack *new_stack = 419 + container_of(task_pt_regs(current), 420 + struct bad_iret_stack, regs); 421 + 422 + /* Copy the IRET target to the new stack. */ 423 + memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8); 424 + 425 + /* Copy the remainder of the stack from the current stack. */ 426 + memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip)); 427 + 428 + BUG_ON(!user_mode_vm(&new_stack->regs)); 429 + return new_stack; 430 + } 410 431 #endif 411 432 412 433 /* ··· 815 778 set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun); 816 779 set_intr_gate(X86_TRAP_TS, invalid_TSS); 817 780 set_intr_gate(X86_TRAP_NP, segment_not_present); 818 - set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK); 781 + set_intr_gate(X86_TRAP_SS, stack_segment); 819 782 set_intr_gate(X86_TRAP_GP, general_protection); 820 783 set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug); 821 784 set_intr_gate(X86_TRAP_MF, coprocessor_error);
+8
arch/x86/kvm/emulate.c
··· 4287 4287 fetch_register_operand(op); 4288 4288 break; 4289 4289 case OpCL: 4290 + op->type = OP_IMM; 4290 4291 op->bytes = 1; 4291 4292 op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff; 4292 4293 break; ··· 4295 4294 rc = decode_imm(ctxt, op, 1, true); 4296 4295 break; 4297 4296 case OpOne: 4297 + op->type = OP_IMM; 4298 4298 op->bytes = 1; 4299 4299 op->val = 1; 4300 4300 break; ··· 4354 4352 ctxt->memop.bytes = ctxt->op_bytes + 2; 4355 4353 goto mem_common; 4356 4354 case OpES: 4355 + op->type = OP_IMM; 4357 4356 op->val = VCPU_SREG_ES; 4358 4357 break; 4359 4358 case OpCS: 4359 + op->type = OP_IMM; 4360 4360 op->val = VCPU_SREG_CS; 4361 4361 break; 4362 4362 case OpSS: 4363 + op->type = OP_IMM; 4363 4364 op->val = VCPU_SREG_SS; 4364 4365 break; 4365 4366 case OpDS: 4367 + op->type = OP_IMM; 4366 4368 op->val = VCPU_SREG_DS; 4367 4369 break; 4368 4370 case OpFS: 4371 + op->type = OP_IMM; 4369 4372 op->val = VCPU_SREG_FS; 4370 4373 break; 4371 4374 case OpGS: 4375 + op->type = OP_IMM; 4372 4376 op->val = VCPU_SREG_GS; 4373 4377 break; 4374 4378 case OpImplicit:
+3 -3
arch/x86/kvm/mmu.c
··· 630 630 * kvm mmu, before reclaiming the page, we should 631 631 * unmap it from mmu first. 632 632 */ 633 - WARN_ON(!kvm_is_mmio_pfn(pfn) && !page_count(pfn_to_page(pfn))); 633 + WARN_ON(!kvm_is_reserved_pfn(pfn) && !page_count(pfn_to_page(pfn))); 634 634 635 635 if (!shadow_accessed_mask || old_spte & shadow_accessed_mask) 636 636 kvm_set_pfn_accessed(pfn); ··· 2461 2461 spte |= PT_PAGE_SIZE_MASK; 2462 2462 if (tdp_enabled) 2463 2463 spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, 2464 - kvm_is_mmio_pfn(pfn)); 2464 + kvm_is_reserved_pfn(pfn)); 2465 2465 2466 2466 if (host_writable) 2467 2467 spte |= SPTE_HOST_WRITEABLE; ··· 2737 2737 * PT_PAGE_TABLE_LEVEL and there would be no adjustment done 2738 2738 * here. 2739 2739 */ 2740 - if (!is_error_noslot_pfn(pfn) && !kvm_is_mmio_pfn(pfn) && 2740 + if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) && 2741 2741 level == PT_PAGE_TABLE_LEVEL && 2742 2742 PageTransCompound(pfn_to_page(pfn)) && 2743 2743 !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) {
+2 -3
arch/x86/lib/csum-wrappers_64.c
··· 41 41 while (((unsigned long)src & 6) && len >= 2) { 42 42 __u16 val16; 43 43 44 - *errp = __get_user(val16, (const __u16 __user *)src); 45 - if (*errp) 46 - return isum; 44 + if (__get_user(val16, (const __u16 __user *)src)) 45 + goto out_err; 47 46 48 47 *(__u16 *)dst = val16; 49 48 isum = (__force __wsum)add32_with_carry(
+10 -1
arch/x86/mm/init_64.c
··· 1123 1123 unsigned long end = (unsigned long) &__end_rodata_hpage_align; 1124 1124 unsigned long text_end = PFN_ALIGN(&__stop___ex_table); 1125 1125 unsigned long rodata_end = PFN_ALIGN(&__end_rodata); 1126 - unsigned long all_end = PFN_ALIGN(&_end); 1126 + unsigned long all_end; 1127 1127 1128 1128 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", 1129 1129 (end - start) >> 10); ··· 1134 1134 /* 1135 1135 * The rodata/data/bss/brk section (but not the kernel text!) 1136 1136 * should also be not-executable. 1137 + * 1138 + * We align all_end to PMD_SIZE because the existing mapping 1139 + * is a full PMD. If we would align _brk_end to PAGE_SIZE we 1140 + * split the PMD and the reminder between _brk_end and the end 1141 + * of the PMD will remain mapped executable. 1142 + * 1143 + * Any PMD which was setup after the one which covers _brk_end 1144 + * has been zapped already via cleanup_highmem(). 1137 1145 */ 1146 + all_end = roundup((unsigned long)_brk_end, PMD_SIZE); 1138 1147 set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); 1139 1148 1140 1149 rodata_test();
+39
arch/x86/tools/calc_run_size.pl
··· 1 + #!/usr/bin/perl 2 + # 3 + # Calculate the amount of space needed to run the kernel, including room for 4 + # the .bss and .brk sections. 5 + # 6 + # Usage: 7 + # objdump -h a.out | perl calc_run_size.pl 8 + use strict; 9 + 10 + my $mem_size = 0; 11 + my $file_offset = 0; 12 + 13 + my $sections=" *[0-9]+ \.(?:bss|brk) +"; 14 + while (<>) { 15 + if (/^$sections([0-9a-f]+) +(?:[0-9a-f]+ +){2}([0-9a-f]+)/) { 16 + my $size = hex($1); 17 + my $offset = hex($2); 18 + $mem_size += $size; 19 + if ($file_offset == 0) { 20 + $file_offset = $offset; 21 + } elsif ($file_offset != $offset) { 22 + # BFD linker shows the same file offset in ELF. 23 + # Gold linker shows them as consecutive. 24 + next if ($file_offset + $mem_size == $offset + $size); 25 + 26 + printf STDERR "file_offset: 0x%lx\n", $file_offset; 27 + printf STDERR "mem_size: 0x%lx\n", $mem_size; 28 + printf STDERR "offset: 0x%lx\n", $offset; 29 + printf STDERR "size: 0x%lx\n", $size; 30 + 31 + die ".bss and .brk are non-contiguous\n"; 32 + } 33 + } 34 + } 35 + 36 + if ($file_offset == 0) { 37 + die "Never found .bss or .brk file offset\n"; 38 + } 39 + printf("%d\n", $mem_size + $file_offset);
+3
arch/x86/xen/smp.c
··· 510 510 current->state = TASK_UNINTERRUPTIBLE; 511 511 schedule_timeout(HZ/10); 512 512 } 513 + 514 + cpu_die_common(cpu); 515 + 513 516 xen_smp_intr_free(cpu); 514 517 xen_uninit_lock_cpu(cpu); 515 518 xen_teardown_timer(cpu);
+2 -2
arch/xtensa/Kconfig
··· 319 319 320 320 config XTENSA_PLATFORM_XTFPGA 321 321 bool "XTFPGA" 322 + select ETHOC if ETHERNET 322 323 select SERIAL_CONSOLE 323 - select ETHOC 324 324 select XTENSA_CALIBRATE_CCOUNT 325 325 help 326 326 XTFPGA is the name of Tensilica board family (LX60, LX110, LX200, ML605). ··· 367 367 config BLK_DEV_SIMDISK 368 368 tristate "Host file-based simulated block device support" 369 369 default n 370 - depends on XTENSA_PLATFORM_ISS 370 + depends on XTENSA_PLATFORM_ISS && BLOCK 371 371 help 372 372 Create block devices that map to files in the host file system. 373 373 Device binding to host file may be changed at runtime via proc
+16
arch/xtensa/boot/dts/lx200mx.dts
··· 1 + /dts-v1/; 2 + /include/ "xtfpga.dtsi" 3 + /include/ "xtfpga-flash-16m.dtsi" 4 + 5 + / { 6 + compatible = "cdns,xtensa-lx200"; 7 + memory@0 { 8 + device_type = "memory"; 9 + reg = <0x00000000 0x06000000>; 10 + }; 11 + pic: pic { 12 + compatible = "cdns,xtensa-mx"; 13 + #interrupt-cells = <2>; 14 + interrupt-controller; 15 + }; 16 + };
+131
arch/xtensa/configs/generic_kc705_defconfig
··· 1 + CONFIG_SYSVIPC=y 2 + CONFIG_POSIX_MQUEUE=y 3 + CONFIG_FHANDLE=y 4 + CONFIG_IRQ_DOMAIN_DEBUG=y 5 + CONFIG_NO_HZ_IDLE=y 6 + CONFIG_HIGH_RES_TIMERS=y 7 + CONFIG_IRQ_TIME_ACCOUNTING=y 8 + CONFIG_BSD_PROCESS_ACCT=y 9 + CONFIG_CGROUP_DEBUG=y 10 + CONFIG_CGROUP_FREEZER=y 11 + CONFIG_CGROUP_DEVICE=y 12 + CONFIG_CPUSETS=y 13 + CONFIG_CGROUP_CPUACCT=y 14 + CONFIG_RESOURCE_COUNTERS=y 15 + CONFIG_MEMCG=y 16 + CONFIG_NAMESPACES=y 17 + CONFIG_SCHED_AUTOGROUP=y 18 + CONFIG_RELAY=y 19 + CONFIG_BLK_DEV_INITRD=y 20 + CONFIG_EXPERT=y 21 + CONFIG_SYSCTL_SYSCALL=y 22 + CONFIG_KALLSYMS_ALL=y 23 + CONFIG_PROFILING=y 24 + CONFIG_OPROFILE=y 25 + CONFIG_MODULES=y 26 + CONFIG_MODULE_UNLOAD=y 27 + # CONFIG_IOSCHED_DEADLINE is not set 28 + # CONFIG_IOSCHED_CFQ is not set 29 + CONFIG_XTENSA_VARIANT_DC233C=y 30 + CONFIG_XTENSA_UNALIGNED_USER=y 31 + CONFIG_PREEMPT=y 32 + CONFIG_HIGHMEM=y 33 + # CONFIG_PCI is not set 34 + CONFIG_XTENSA_PLATFORM_XTFPGA=y 35 + CONFIG_CMDLINE_BOOL=y 36 + CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug" 37 + CONFIG_USE_OF=y 38 + CONFIG_BUILTIN_DTB="kc705" 39 + # CONFIG_COMPACTION is not set 40 + # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 41 + CONFIG_NET=y 42 + CONFIG_PACKET=y 43 + CONFIG_UNIX=y 44 + CONFIG_INET=y 45 + CONFIG_IP_MULTICAST=y 46 + CONFIG_IP_PNP=y 47 + CONFIG_IP_PNP_DHCP=y 48 + CONFIG_IP_PNP_BOOTP=y 49 + CONFIG_IP_PNP_RARP=y 50 + # CONFIG_IPV6 is not set 51 + CONFIG_NETFILTER=y 52 + # CONFIG_WIRELESS is not set 53 + CONFIG_DEVTMPFS=y 54 + CONFIG_DEVTMPFS_MOUNT=y 55 + # CONFIG_STANDALONE is not set 56 + CONFIG_MTD=y 57 + CONFIG_MTD_CFI=y 58 + CONFIG_MTD_JEDECPROBE=y 59 + CONFIG_MTD_CFI_INTELEXT=y 60 + CONFIG_MTD_CFI_AMDSTD=y 61 + CONFIG_MTD_CFI_STAA=y 62 + CONFIG_MTD_PHYSMAP_OF=y 63 + CONFIG_MTD_UBI=y 64 + CONFIG_BLK_DEV_LOOP=y 65 + CONFIG_BLK_DEV_RAM=y 66 + CONFIG_SCSI=y 67 + CONFIG_BLK_DEV_SD=y 68 + CONFIG_NETDEVICES=y 69 + # CONFIG_NET_VENDOR_ARC is not set 70 + # CONFIG_NET_VENDOR_BROADCOM is not set 71 + # CONFIG_NET_VENDOR_INTEL is not set 72 + # CONFIG_NET_VENDOR_MARVELL is not set 73 + # CONFIG_NET_VENDOR_MICREL is not set 74 + # CONFIG_NET_VENDOR_NATSEMI is not set 75 + # CONFIG_NET_VENDOR_SAMSUNG is not set 76 + # CONFIG_NET_VENDOR_SEEQ is not set 77 + # CONFIG_NET_VENDOR_SMSC is not set 78 + # CONFIG_NET_VENDOR_STMICRO is not set 79 + # CONFIG_NET_VENDOR_VIA is not set 80 + # CONFIG_NET_VENDOR_WIZNET is not set 81 + CONFIG_MARVELL_PHY=y 82 + # CONFIG_WLAN is not set 83 + # CONFIG_INPUT_MOUSEDEV is not set 84 + # CONFIG_INPUT_KEYBOARD is not set 85 + # CONFIG_INPUT_MOUSE is not set 86 + # CONFIG_SERIO is not set 87 + CONFIG_SERIAL_8250=y 88 + # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set 89 + CONFIG_SERIAL_8250_CONSOLE=y 90 + CONFIG_SERIAL_OF_PLATFORM=y 91 + CONFIG_HW_RANDOM=y 92 + # CONFIG_HWMON is not set 93 + CONFIG_WATCHDOG=y 94 + CONFIG_WATCHDOG_NOWAYOUT=y 95 + CONFIG_SOFT_WATCHDOG=y 96 + # CONFIG_VGA_CONSOLE is not set 97 + # CONFIG_USB_SUPPORT is not set 98 + # CONFIG_IOMMU_SUPPORT is not set 99 + CONFIG_EXT3_FS=y 100 + CONFIG_EXT4_FS=y 101 + CONFIG_FANOTIFY=y 102 + CONFIG_VFAT_FS=y 103 + CONFIG_PROC_KCORE=y 104 + CONFIG_TMPFS=y 105 + CONFIG_TMPFS_POSIX_ACL=y 106 + CONFIG_UBIFS_FS=y 107 + CONFIG_NFS_FS=y 108 + CONFIG_NFS_V4=y 109 + CONFIG_NFS_SWAP=y 110 + CONFIG_ROOT_NFS=y 111 + CONFIG_SUNRPC_DEBUG=y 112 + CONFIG_NLS_CODEPAGE_437=y 113 + CONFIG_NLS_ISO8859_1=y 114 + CONFIG_PRINTK_TIME=y 115 + CONFIG_DYNAMIC_DEBUG=y 116 + CONFIG_DEBUG_INFO=y 117 + CONFIG_MAGIC_SYSRQ=y 118 + CONFIG_LOCKUP_DETECTOR=y 119 + # CONFIG_SCHED_DEBUG is not set 120 + CONFIG_SCHEDSTATS=y 121 + CONFIG_TIMER_STATS=y 122 + CONFIG_DEBUG_RT_MUTEXES=y 123 + CONFIG_DEBUG_SPINLOCK=y 124 + CONFIG_DEBUG_MUTEXES=y 125 + CONFIG_DEBUG_ATOMIC_SLEEP=y 126 + CONFIG_STACKTRACE=y 127 + CONFIG_RCU_TRACE=y 128 + # CONFIG_FTRACE is not set 129 + CONFIG_LD_NO_RELAX=y 130 + # CONFIG_S32C1I_SELFTEST is not set 131 + CONFIG_CRYPTO_ANSI_CPRNG=y
+135
arch/xtensa/configs/smp_lx200_defconfig
··· 1 + CONFIG_SYSVIPC=y 2 + CONFIG_POSIX_MQUEUE=y 3 + CONFIG_FHANDLE=y 4 + CONFIG_IRQ_DOMAIN_DEBUG=y 5 + CONFIG_NO_HZ_IDLE=y 6 + CONFIG_HIGH_RES_TIMERS=y 7 + CONFIG_IRQ_TIME_ACCOUNTING=y 8 + CONFIG_BSD_PROCESS_ACCT=y 9 + CONFIG_CGROUP_DEBUG=y 10 + CONFIG_CGROUP_FREEZER=y 11 + CONFIG_CGROUP_DEVICE=y 12 + CONFIG_CPUSETS=y 13 + CONFIG_CGROUP_CPUACCT=y 14 + CONFIG_RESOURCE_COUNTERS=y 15 + CONFIG_MEMCG=y 16 + CONFIG_NAMESPACES=y 17 + CONFIG_SCHED_AUTOGROUP=y 18 + CONFIG_RELAY=y 19 + CONFIG_BLK_DEV_INITRD=y 20 + CONFIG_EXPERT=y 21 + CONFIG_SYSCTL_SYSCALL=y 22 + CONFIG_KALLSYMS_ALL=y 23 + CONFIG_PROFILING=y 24 + CONFIG_OPROFILE=y 25 + CONFIG_MODULES=y 26 + CONFIG_MODULE_UNLOAD=y 27 + # CONFIG_IOSCHED_DEADLINE is not set 28 + # CONFIG_IOSCHED_CFQ is not set 29 + CONFIG_XTENSA_VARIANT_CUSTOM=y 30 + CONFIG_XTENSA_VARIANT_CUSTOM_NAME="test_mmuhifi_c3" 31 + CONFIG_XTENSA_UNALIGNED_USER=y 32 + CONFIG_PREEMPT=y 33 + CONFIG_HAVE_SMP=y 34 + CONFIG_SMP=y 35 + CONFIG_HOTPLUG_CPU=y 36 + # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set 37 + # CONFIG_PCI is not set 38 + CONFIG_XTENSA_PLATFORM_XTFPGA=y 39 + CONFIG_CMDLINE_BOOL=y 40 + CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug" 41 + CONFIG_USE_OF=y 42 + CONFIG_BUILTIN_DTB="lx200mx" 43 + # CONFIG_COMPACTION is not set 44 + # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 45 + CONFIG_NET=y 46 + CONFIG_PACKET=y 47 + CONFIG_UNIX=y 48 + CONFIG_INET=y 49 + CONFIG_IP_MULTICAST=y 50 + CONFIG_IP_PNP=y 51 + CONFIG_IP_PNP_DHCP=y 52 + CONFIG_IP_PNP_BOOTP=y 53 + CONFIG_IP_PNP_RARP=y 54 + # CONFIG_IPV6 is not set 55 + CONFIG_NETFILTER=y 56 + # CONFIG_WIRELESS is not set 57 + CONFIG_DEVTMPFS=y 58 + CONFIG_DEVTMPFS_MOUNT=y 59 + # CONFIG_STANDALONE is not set 60 + CONFIG_MTD=y 61 + CONFIG_MTD_CFI=y 62 + CONFIG_MTD_JEDECPROBE=y 63 + CONFIG_MTD_CFI_INTELEXT=y 64 + CONFIG_MTD_CFI_AMDSTD=y 65 + CONFIG_MTD_CFI_STAA=y 66 + CONFIG_MTD_PHYSMAP_OF=y 67 + CONFIG_MTD_UBI=y 68 + CONFIG_BLK_DEV_LOOP=y 69 + CONFIG_BLK_DEV_RAM=y 70 + CONFIG_SCSI=y 71 + CONFIG_BLK_DEV_SD=y 72 + CONFIG_NETDEVICES=y 73 + # CONFIG_NET_VENDOR_ARC is not set 74 + # CONFIG_NET_VENDOR_BROADCOM is not set 75 + # CONFIG_NET_VENDOR_INTEL is not set 76 + # CONFIG_NET_VENDOR_MARVELL is not set 77 + # CONFIG_NET_VENDOR_MICREL is not set 78 + # CONFIG_NET_VENDOR_NATSEMI is not set 79 + # CONFIG_NET_VENDOR_SAMSUNG is not set 80 + # CONFIG_NET_VENDOR_SEEQ is not set 81 + # CONFIG_NET_VENDOR_SMSC is not set 82 + # CONFIG_NET_VENDOR_STMICRO is not set 83 + # CONFIG_NET_VENDOR_VIA is not set 84 + # CONFIG_NET_VENDOR_WIZNET is not set 85 + CONFIG_MARVELL_PHY=y 86 + # CONFIG_WLAN is not set 87 + # CONFIG_INPUT_MOUSEDEV is not set 88 + # CONFIG_INPUT_KEYBOARD is not set 89 + # CONFIG_INPUT_MOUSE is not set 90 + # CONFIG_SERIO is not set 91 + CONFIG_SERIAL_8250=y 92 + # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set 93 + CONFIG_SERIAL_8250_CONSOLE=y 94 + CONFIG_SERIAL_OF_PLATFORM=y 95 + CONFIG_HW_RANDOM=y 96 + # CONFIG_HWMON is not set 97 + CONFIG_WATCHDOG=y 98 + CONFIG_WATCHDOG_NOWAYOUT=y 99 + CONFIG_SOFT_WATCHDOG=y 100 + # CONFIG_VGA_CONSOLE is not set 101 + # CONFIG_USB_SUPPORT is not set 102 + # CONFIG_IOMMU_SUPPORT is not set 103 + CONFIG_EXT3_FS=y 104 + CONFIG_EXT4_FS=y 105 + CONFIG_FANOTIFY=y 106 + CONFIG_VFAT_FS=y 107 + CONFIG_PROC_KCORE=y 108 + CONFIG_TMPFS=y 109 + CONFIG_TMPFS_POSIX_ACL=y 110 + CONFIG_UBIFS_FS=y 111 + CONFIG_NFS_FS=y 112 + CONFIG_NFS_V4=y 113 + CONFIG_NFS_SWAP=y 114 + CONFIG_ROOT_NFS=y 115 + CONFIG_SUNRPC_DEBUG=y 116 + CONFIG_NLS_CODEPAGE_437=y 117 + CONFIG_NLS_ISO8859_1=y 118 + CONFIG_PRINTK_TIME=y 119 + CONFIG_DYNAMIC_DEBUG=y 120 + CONFIG_DEBUG_INFO=y 121 + CONFIG_MAGIC_SYSRQ=y 122 + CONFIG_DEBUG_VM=y 123 + CONFIG_LOCKUP_DETECTOR=y 124 + CONFIG_SCHEDSTATS=y 125 + CONFIG_TIMER_STATS=y 126 + CONFIG_DEBUG_RT_MUTEXES=y 127 + CONFIG_DEBUG_SPINLOCK=y 128 + CONFIG_DEBUG_MUTEXES=y 129 + CONFIG_DEBUG_ATOMIC_SLEEP=y 130 + CONFIG_STACKTRACE=y 131 + CONFIG_RCU_TRACE=y 132 + # CONFIG_FTRACE is not set 133 + CONFIG_LD_NO_RELAX=y 134 + # CONFIG_S32C1I_SELFTEST is not set 135 + CONFIG_CRYPTO_ANSI_CPRNG=y
+2
arch/xtensa/include/asm/pgtable.h
··· 277 277 static inline pte_t pte_mkspecial(pte_t pte) 278 278 { return pte; } 279 279 280 + #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) & ~_PAGE_CA_MASK)) 281 + 280 282 /* 281 283 * Conversion functions: convert a page and protection to a page entry, 282 284 * and a page entry and page directory to the page they refer to.
+10 -2
arch/xtensa/include/uapi/asm/unistd.h
··· 384 384 #define __NR_pivot_root 175 385 385 __SYSCALL(175, sys_pivot_root, 2) 386 386 #define __NR_umount 176 387 - __SYSCALL(176, sys_umount, 2) 387 + __SYSCALL(176, sys_oldumount, 1) 388 + #define __ARCH_WANT_SYS_OLDUMOUNT 388 389 #define __NR_swapoff 177 389 390 __SYSCALL(177, sys_swapoff, 1) 390 391 #define __NR_sync 178 ··· 743 742 #define __NR_renameat2 336 744 743 __SYSCALL(336, sys_renameat2, 5) 745 744 746 - #define __NR_syscall_count 337 745 + #define __NR_seccomp 337 746 + __SYSCALL(337, sys_seccomp, 3) 747 + #define __NR_getrandom 338 748 + __SYSCALL(338, sys_getrandom, 3) 749 + #define __NR_memfd_create 339 750 + __SYSCALL(339, sys_memfd_create, 2) 751 + 752 + #define __NR_syscall_count 340 747 753 748 754 /* 749 755 * sysxtensa syscall handler
+11 -8
block/blk-merge.c
··· 97 97 98 98 void blk_recount_segments(struct request_queue *q, struct bio *bio) 99 99 { 100 - bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, 101 - &q->queue_flags); 102 - bool merge_not_need = bio->bi_vcnt < queue_max_segments(q); 100 + unsigned short seg_cnt; 103 101 104 - if (no_sg_merge && !bio_flagged(bio, BIO_CLONED) && 105 - merge_not_need) 106 - bio->bi_phys_segments = bio->bi_vcnt; 102 + /* estimate segment number by bi_vcnt for non-cloned bio */ 103 + if (bio_flagged(bio, BIO_CLONED)) 104 + seg_cnt = bio_segments(bio); 105 + else 106 + seg_cnt = bio->bi_vcnt; 107 + 108 + if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags) && 109 + (seg_cnt < queue_max_segments(q))) 110 + bio->bi_phys_segments = seg_cnt; 107 111 else { 108 112 struct bio *nxt = bio->bi_next; 109 113 110 114 bio->bi_next = NULL; 111 - bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, 112 - no_sg_merge && merge_not_need); 115 + bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, false); 113 116 bio->bi_next = nxt; 114 117 } 115 118
+33 -8
block/blk-mq.c
··· 107 107 wake_up_all(&q->mq_freeze_wq); 108 108 } 109 109 110 - /* 111 - * Guarantee no request is in use, so we can change any data structure of 112 - * the queue afterward. 113 - */ 114 - void blk_mq_freeze_queue(struct request_queue *q) 110 + static void blk_mq_freeze_queue_start(struct request_queue *q) 115 111 { 116 112 bool freeze; 117 113 ··· 119 123 percpu_ref_kill(&q->mq_usage_counter); 120 124 blk_mq_run_queues(q, false); 121 125 } 126 + } 127 + 128 + static void blk_mq_freeze_queue_wait(struct request_queue *q) 129 + { 122 130 wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); 131 + } 132 + 133 + /* 134 + * Guarantee no request is in use, so we can change any data structure of 135 + * the queue afterward. 136 + */ 137 + void blk_mq_freeze_queue(struct request_queue *q) 138 + { 139 + blk_mq_freeze_queue_start(q); 140 + blk_mq_freeze_queue_wait(q); 123 141 } 124 142 125 143 static void blk_mq_unfreeze_queue(struct request_queue *q) ··· 1931 1921 /* Basically redo blk_mq_init_queue with queue frozen */ 1932 1922 static void blk_mq_queue_reinit(struct request_queue *q) 1933 1923 { 1934 - blk_mq_freeze_queue(q); 1924 + WARN_ON_ONCE(!q->mq_freeze_depth); 1935 1925 1936 1926 blk_mq_sysfs_unregister(q); 1937 1927 ··· 1946 1936 blk_mq_map_swqueue(q); 1947 1937 1948 1938 blk_mq_sysfs_register(q); 1949 - 1950 - blk_mq_unfreeze_queue(q); 1951 1939 } 1952 1940 1953 1941 static int blk_mq_queue_reinit_notify(struct notifier_block *nb, ··· 1964 1956 return NOTIFY_OK; 1965 1957 1966 1958 mutex_lock(&all_q_mutex); 1959 + 1960 + /* 1961 + * We need to freeze and reinit all existing queues. Freezing 1962 + * involves synchronous wait for an RCU grace period and doing it 1963 + * one by one may take a long time. Start freezing all queues in 1964 + * one swoop and then wait for the completions so that freezing can 1965 + * take place in parallel. 1966 + */ 1967 + list_for_each_entry(q, &all_q_list, all_q_node) 1968 + blk_mq_freeze_queue_start(q); 1969 + list_for_each_entry(q, &all_q_list, all_q_node) 1970 + blk_mq_freeze_queue_wait(q); 1971 + 1967 1972 list_for_each_entry(q, &all_q_list, all_q_node) 1968 1973 blk_mq_queue_reinit(q); 1974 + 1975 + list_for_each_entry(q, &all_q_list, all_q_node) 1976 + blk_mq_unfreeze_queue(q); 1977 + 1969 1978 mutex_unlock(&all_q_mutex); 1970 1979 return NOTIFY_OK; 1971 1980 }
+8 -6
block/ioprio.c
··· 157 157 158 158 int ioprio_best(unsigned short aprio, unsigned short bprio) 159 159 { 160 - unsigned short aclass = IOPRIO_PRIO_CLASS(aprio); 161 - unsigned short bclass = IOPRIO_PRIO_CLASS(bprio); 160 + unsigned short aclass; 161 + unsigned short bclass; 162 162 163 - if (aclass == IOPRIO_CLASS_NONE) 164 - aclass = IOPRIO_CLASS_BE; 165 - if (bclass == IOPRIO_CLASS_NONE) 166 - bclass = IOPRIO_CLASS_BE; 163 + if (!ioprio_valid(aprio)) 164 + aprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM); 165 + if (!ioprio_valid(bprio)) 166 + bprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM); 167 167 168 + aclass = IOPRIO_PRIO_CLASS(aprio); 169 + bclass = IOPRIO_PRIO_CLASS(bprio); 168 170 if (aclass == bclass) 169 171 return min(aprio, bprio); 170 172 if (aclass > bclass)
+5 -3
block/scsi_ioctl.c
··· 458 458 rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); 459 459 if (IS_ERR(rq)) { 460 460 err = PTR_ERR(rq); 461 - goto error; 461 + goto error_free_buffer; 462 462 } 463 463 blk_rq_set_block_pc(rq); 464 464 ··· 531 531 } 532 532 533 533 error: 534 + blk_put_request(rq); 535 + 536 + error_free_buffer: 534 537 kfree(buffer); 535 - if (rq) 536 - blk_put_request(rq); 538 + 537 539 return err; 538 540 } 539 541 EXPORT_SYMBOL_GPL(sg_scsi_ioctl);
+8
drivers/acpi/blacklist.c
··· 290 290 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3446"), 291 291 }, 292 292 }, 293 + { 294 + .callback = dmi_disable_osi_win8, 295 + .ident = "Dell Vostro 3546", 296 + .matches = { 297 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 298 + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3546"), 299 + }, 300 + }, 293 301 294 302 /* 295 303 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
+1 -1
drivers/acpi/device_pm.c
··· 878 878 return 0; 879 879 880 880 target_state = acpi_target_system_state(); 881 - wakeup = device_may_wakeup(dev); 881 + wakeup = device_may_wakeup(dev) && acpi_device_can_wakeup(adev); 882 882 error = acpi_device_wakeup(adev, target_state, wakeup); 883 883 if (wakeup && error) 884 884 return error;
+19 -9
drivers/ata/ahci.c
··· 60 60 /* board IDs by feature in alphabetical order */ 61 61 board_ahci, 62 62 board_ahci_ign_iferr, 63 + board_ahci_nomsi, 63 64 board_ahci_noncq, 64 65 board_ahci_nosntf, 65 66 board_ahci_yes_fbs, ··· 117 116 }, 118 117 [board_ahci_ign_iferr] = { 119 118 AHCI_HFLAGS (AHCI_HFLAG_IGN_IRQ_IF_ERR), 119 + .flags = AHCI_FLAG_COMMON, 120 + .pio_mask = ATA_PIO4, 121 + .udma_mask = ATA_UDMA6, 122 + .port_ops = &ahci_ops, 123 + }, 124 + [board_ahci_nomsi] = { 125 + AHCI_HFLAGS (AHCI_HFLAG_NO_MSI), 120 126 .flags = AHCI_FLAG_COMMON, 121 127 .pio_mask = ATA_PIO4, 122 128 .udma_mask = ATA_UDMA6, ··· 321 313 { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ 322 314 { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ 323 315 { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ 316 + { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ 317 + { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */ 318 + { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ 319 + { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ 320 + { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ 324 321 325 322 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 326 323 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, ··· 488 475 { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ 489 476 490 477 /* 491 - * Samsung SSDs found on some macbooks. NCQ times out. 492 - * https://bugzilla.kernel.org/show_bug.cgi?id=60731 478 + * Samsung SSDs found on some macbooks. NCQ times out if MSI is 479 + * enabled. https://bugzilla.kernel.org/show_bug.cgi?id=60731 493 480 */ 494 - { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_noncq }, 481 + { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_nomsi }, 495 482 496 483 /* Enmotus */ 497 484 { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, ··· 527 514 static void ahci_pci_save_initial_config(struct pci_dev *pdev, 528 515 struct ahci_host_priv *hpriv) 529 516 { 530 - unsigned int force_port_map = 0; 531 - unsigned int mask_port_map = 0; 532 - 533 517 if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) { 534 518 dev_info(&pdev->dev, "JMB361 has only one port\n"); 535 - force_port_map = 1; 519 + hpriv->force_port_map = 1; 536 520 } 537 521 538 522 /* ··· 539 529 */ 540 530 if (hpriv->flags & AHCI_HFLAG_MV_PATA) { 541 531 if (pdev->device == 0x6121) 542 - mask_port_map = 0x3; 532 + hpriv->mask_port_map = 0x3; 543 533 else 544 - mask_port_map = 0xf; 534 + hpriv->mask_port_map = 0xf; 545 535 dev_info(&pdev->dev, 546 536 "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n"); 547 537 }
+17 -61
drivers/ata/libahci.c
··· 1778 1778 } 1779 1779 } 1780 1780 1781 - static void ahci_update_intr_status(struct ata_port *ap) 1781 + static void ahci_port_intr(struct ata_port *ap) 1782 1782 { 1783 1783 void __iomem *port_mmio = ahci_port_base(ap); 1784 - struct ahci_port_priv *pp = ap->private_data; 1785 1784 u32 status; 1786 1785 1787 1786 status = readl(port_mmio + PORT_IRQ_STAT); 1788 1787 writel(status, port_mmio + PORT_IRQ_STAT); 1789 1788 1790 - atomic_or(status, &pp->intr_status); 1789 + ahci_handle_port_interrupt(ap, port_mmio, status); 1791 1790 } 1792 1791 1793 1792 static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) ··· 1803 1804 spin_lock_bh(ap->lock); 1804 1805 ahci_handle_port_interrupt(ap, port_mmio, status); 1805 1806 spin_unlock_bh(ap->lock); 1806 - 1807 - return IRQ_HANDLED; 1808 - } 1809 - 1810 - irqreturn_t ahci_thread_fn(int irq, void *dev_instance) 1811 - { 1812 - struct ata_host *host = dev_instance; 1813 - struct ahci_host_priv *hpriv = host->private_data; 1814 - u32 irq_masked = hpriv->port_map; 1815 - unsigned int i; 1816 - 1817 - for (i = 0; i < host->n_ports; i++) { 1818 - struct ata_port *ap; 1819 - 1820 - if (!(irq_masked & (1 << i))) 1821 - continue; 1822 - 1823 - ap = host->ports[i]; 1824 - if (ap) { 1825 - ahci_port_thread_fn(irq, ap); 1826 - VPRINTK("port %u\n", i); 1827 - } else { 1828 - VPRINTK("port %u (no irq)\n", i); 1829 - if (ata_ratelimit()) 1830 - dev_warn(host->dev, 1831 - "interrupt on disabled port %u\n", i); 1832 - } 1833 - } 1834 1807 1835 1808 return IRQ_HANDLED; 1836 1809 } ··· 1846 1875 1847 1876 irq_masked = irq_stat & hpriv->port_map; 1848 1877 1878 + spin_lock(&host->lock); 1879 + 1849 1880 for (i = 0; i < host->n_ports; i++) { 1850 1881 struct ata_port *ap; 1851 1882 ··· 1856 1883 1857 1884 ap = host->ports[i]; 1858 1885 if (ap) { 1859 - ahci_update_intr_status(ap); 1886 + ahci_port_intr(ap); 1860 1887 VPRINTK("port %u\n", i); 1861 1888 } else { 1862 1889 VPRINTK("port %u (no irq)\n", i); ··· 1879 1906 */ 1880 1907 writel(irq_stat, mmio + HOST_IRQ_STAT); 1881 1908 1909 + spin_unlock(&host->lock); 1910 + 1882 1911 VPRINTK("EXIT\n"); 1883 1912 1884 - return handled ? IRQ_WAKE_THREAD : IRQ_NONE; 1913 + return IRQ_RETVAL(handled); 1885 1914 } 1886 1915 1887 1916 unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) ··· 2295 2320 */ 2296 2321 pp->intr_mask = DEF_PORT_IRQ; 2297 2322 2298 - spin_lock_init(&pp->lock); 2299 - ap->lock = &pp->lock; 2323 + /* 2324 + * Switch to per-port locking in case each port has its own MSI vector. 2325 + */ 2326 + if ((hpriv->flags & AHCI_HFLAG_MULTI_MSI)) { 2327 + spin_lock_init(&pp->lock); 2328 + ap->lock = &pp->lock; 2329 + } 2300 2330 2301 2331 ap->private_data = pp; 2302 2332 ··· 2462 2482 return rc; 2463 2483 } 2464 2484 2465 - static int ahci_host_activate_single_irq(struct ata_host *host, int irq, 2466 - struct scsi_host_template *sht) 2467 - { 2468 - int i, rc; 2469 - 2470 - rc = ata_host_start(host); 2471 - if (rc) 2472 - return rc; 2473 - 2474 - rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr, 2475 - ahci_thread_fn, IRQF_SHARED, 2476 - dev_driver_string(host->dev), host); 2477 - if (rc) 2478 - return rc; 2479 - 2480 - for (i = 0; i < host->n_ports; i++) 2481 - ata_port_desc(host->ports[i], "irq %d", irq); 2482 - 2483 - rc = ata_host_register(host, sht); 2484 - if (rc) 2485 - devm_free_irq(host->dev, irq, host); 2486 - 2487 - return rc; 2488 - } 2489 - 2490 2485 /** 2491 2486 * ahci_host_activate - start AHCI host, request IRQs and register it 2492 2487 * @host: target ATA host ··· 2487 2532 if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) 2488 2533 rc = ahci_host_activate_multi_irqs(host, irq, sht); 2489 2534 else 2490 - rc = ahci_host_activate_single_irq(host, irq, sht); 2535 + rc = ata_host_activate(host, irq, ahci_single_irq_intr, 2536 + IRQF_SHARED, sht); 2491 2537 return rc; 2492 2538 } 2493 2539 EXPORT_SYMBOL_GPL(ahci_host_activate);
+15
drivers/ata/sata_rcar.c
··· 146 146 enum sata_rcar_type { 147 147 RCAR_GEN1_SATA, 148 148 RCAR_GEN2_SATA, 149 + RCAR_R8A7790_ES1_SATA, 149 150 }; 150 151 151 152 struct sata_rcar_priv { ··· 764 763 ap->udma_mask = ATA_UDMA6; 765 764 ap->flags |= ATA_FLAG_SATA; 766 765 766 + if (priv->type == RCAR_R8A7790_ES1_SATA) 767 + ap->flags |= ATA_FLAG_NO_DIPM; 768 + 767 769 ioaddr->cmd_addr = base + SDATA_REG; 768 770 ioaddr->ctl_addr = base + SSDEVCON_REG; 769 771 ioaddr->scr_addr = base + SCRSSTS_REG; ··· 796 792 sata_rcar_gen1_phy_init(priv); 797 793 break; 798 794 case RCAR_GEN2_SATA: 795 + case RCAR_R8A7790_ES1_SATA: 799 796 sata_rcar_gen2_phy_init(priv); 800 797 break; 801 798 default: ··· 843 838 .data = (void *)RCAR_GEN2_SATA 844 839 }, 845 840 { 841 + .compatible = "renesas,sata-r8a7790-es1", 842 + .data = (void *)RCAR_R8A7790_ES1_SATA 843 + }, 844 + { 846 845 .compatible = "renesas,sata-r8a7791", 846 + .data = (void *)RCAR_GEN2_SATA 847 + }, 848 + { 849 + .compatible = "renesas,sata-r8a7793", 847 850 .data = (void *)RCAR_GEN2_SATA 848 851 }, 849 852 { }, ··· 862 849 { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */ 863 850 { "sata-r8a7779", RCAR_GEN1_SATA }, 864 851 { "sata-r8a7790", RCAR_GEN2_SATA }, 852 + { "sata-r8a7790-es1", RCAR_R8A7790_ES1_SATA }, 865 853 { "sata-r8a7791", RCAR_GEN2_SATA }, 854 + { "sata-r8a7793", RCAR_GEN2_SATA }, 866 855 { }, 867 856 }; 868 857 MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
+2
drivers/atm/solos-pci.c
··· 1225 1225 card->config_regs = pci_iomap(dev, 0, CONFIG_RAM_SIZE); 1226 1226 if (!card->config_regs) { 1227 1227 dev_warn(&dev->dev, "Failed to ioremap config registers\n"); 1228 + err = -ENOMEM; 1228 1229 goto out_release_regions; 1229 1230 } 1230 1231 card->buffers = pci_iomap(dev, 1, DATA_RAM_SIZE); 1231 1232 if (!card->buffers) { 1232 1233 dev_warn(&dev->dev, "Failed to ioremap data buffers\n"); 1234 + err = -ENOMEM; 1233 1235 goto out_unmap_config; 1234 1236 } 1235 1237
+34 -8
drivers/base/power/domain.c
··· 361 361 struct device *dev = pdd->dev; 362 362 int ret = 0; 363 363 364 - if (gpd_data->need_restore) 364 + if (gpd_data->need_restore > 0) 365 365 return 0; 366 + 367 + /* 368 + * If the value of the need_restore flag is still unknown at this point, 369 + * we trust that pm_genpd_poweroff() has verified that the device is 370 + * already runtime PM suspended. 371 + */ 372 + if (gpd_data->need_restore < 0) { 373 + gpd_data->need_restore = 1; 374 + return 0; 375 + } 366 376 367 377 mutex_unlock(&genpd->lock); 368 378 ··· 383 373 mutex_lock(&genpd->lock); 384 374 385 375 if (!ret) 386 - gpd_data->need_restore = true; 376 + gpd_data->need_restore = 1; 387 377 388 378 return ret; 389 379 } ··· 399 389 { 400 390 struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd); 401 391 struct device *dev = pdd->dev; 402 - bool need_restore = gpd_data->need_restore; 392 + int need_restore = gpd_data->need_restore; 403 393 404 - gpd_data->need_restore = false; 394 + gpd_data->need_restore = 0; 405 395 mutex_unlock(&genpd->lock); 406 396 407 397 genpd_start_dev(genpd, dev); 398 + 399 + /* 400 + * Call genpd_restore_dev() for recently added devices too (need_restore 401 + * is negative then). 402 + */ 408 403 if (need_restore) 409 404 genpd_restore_dev(genpd, dev); 410 405 ··· 618 603 static int pm_genpd_runtime_suspend(struct device *dev) 619 604 { 620 605 struct generic_pm_domain *genpd; 606 + struct generic_pm_domain_data *gpd_data; 621 607 bool (*stop_ok)(struct device *__dev); 622 608 int ret; 623 609 ··· 644 628 return 0; 645 629 646 630 mutex_lock(&genpd->lock); 631 + 632 + /* 633 + * If we have an unknown state of the need_restore flag, it means none 634 + * of the runtime PM callbacks has been invoked yet. Let's update the 635 + * flag to reflect that the current state is active. 636 + */ 637 + gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); 638 + if (gpd_data->need_restore < 0) 639 + gpd_data->need_restore = 0; 640 + 647 641 genpd->in_progress++; 648 642 pm_genpd_poweroff(genpd); 649 643 genpd->in_progress--; ··· 1463 1437 spin_unlock_irq(&dev->power.lock); 1464 1438 1465 1439 if (genpd->attach_dev) 1466 - genpd->attach_dev(dev); 1440 + genpd->attach_dev(genpd, dev); 1467 1441 1468 1442 mutex_lock(&gpd_data->lock); 1469 1443 gpd_data->base.dev = dev; 1470 1444 list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); 1471 - gpd_data->need_restore = genpd->status == GPD_STATE_POWER_OFF; 1445 + gpd_data->need_restore = -1; 1472 1446 gpd_data->td.constraint_changed = true; 1473 1447 gpd_data->td.effective_constraint_ns = -1; 1474 1448 mutex_unlock(&gpd_data->lock); ··· 1525 1499 genpd->max_off_time_changed = true; 1526 1500 1527 1501 if (genpd->detach_dev) 1528 - genpd->detach_dev(dev); 1502 + genpd->detach_dev(genpd, dev); 1529 1503 1530 1504 spin_lock_irq(&dev->power.lock); 1531 1505 ··· 1572 1546 1573 1547 psd = dev_to_psd(dev); 1574 1548 if (psd && psd->domain_data) 1575 - to_gpd_data(psd->domain_data)->need_restore = val; 1549 + to_gpd_data(psd->domain_data)->need_restore = val ? 1 : 0; 1576 1550 1577 1551 spin_unlock_irqrestore(&dev->power.lock, flags); 1578 1552 }
+2 -1
drivers/block/zram/zram_drv.c
··· 560 560 } 561 561 562 562 if (page_zero_filled(uncmem)) { 563 - kunmap_atomic(user_mem); 563 + if (user_mem) 564 + kunmap_atomic(user_mem); 564 565 /* Free memory associated with this sector now. */ 565 566 bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); 566 567 zram_free_page(zram, index);
+7 -4
drivers/char/hw_random/pseries-rng.c
··· 25 25 #include <asm/vio.h> 26 26 27 27 28 - static int pseries_rng_data_read(struct hwrng *rng, u32 *data) 28 + static int pseries_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) 29 29 { 30 + u64 buffer[PLPAR_HCALL_BUFSIZE]; 31 + size_t size = max < 8 ? max : 8; 30 32 int rc; 31 33 32 - rc = plpar_hcall(H_RANDOM, (unsigned long *)data); 34 + rc = plpar_hcall(H_RANDOM, (unsigned long *)buffer); 33 35 if (rc != H_SUCCESS) { 34 36 pr_err_ratelimited("H_RANDOM call failed %d\n", rc); 35 37 return -EIO; 36 38 } 39 + memcpy(data, buffer, size); 37 40 38 41 /* The hypervisor interface returns 64 bits */ 39 - return 8; 42 + return size; 40 43 } 41 44 42 45 /** ··· 58 55 59 56 static struct hwrng pseries_rng = { 60 57 .name = KBUILD_MODNAME, 61 - .data_read = pseries_rng_data_read, 58 + .read = pseries_rng_read, 62 59 }; 63 60 64 61 static int __init pseries_rng_probe(struct vio_dev *dev,
+2 -2
drivers/char/virtio_console.c
··· 1449 1449 spin_lock_init(&port->outvq_lock); 1450 1450 init_waitqueue_head(&port->waitqueue); 1451 1451 1452 - virtio_device_ready(portdev->vdev); 1453 - 1454 1452 /* Fill the in_vq with buffers so the host can send us data. */ 1455 1453 nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); 1456 1454 if (!nr_added_bufs) { ··· 2023 2025 2024 2026 spin_lock_init(&portdev->ports_lock); 2025 2027 INIT_LIST_HEAD(&portdev->ports); 2028 + 2029 + virtio_device_ready(portdev->vdev); 2026 2030 2027 2031 if (multiport) { 2028 2032 unsigned int nr_added_bufs;
+18 -17
drivers/clk/at91/clk-usb.c
··· 52 52 53 53 tmp = pmc_read(pmc, AT91_PMC_USB); 54 54 usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; 55 - return parent_rate / (usbdiv + 1); 55 + 56 + return DIV_ROUND_CLOSEST(parent_rate, (usbdiv + 1)); 56 57 } 57 58 58 59 static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, 59 60 unsigned long *parent_rate) 60 61 { 61 62 unsigned long div; 62 - unsigned long bestrate; 63 - unsigned long tmp; 63 + 64 + if (!rate) 65 + return -EINVAL; 64 66 65 67 if (rate >= *parent_rate) 66 68 return *parent_rate; 67 69 68 - div = *parent_rate / rate; 69 - if (div >= SAM9X5_USB_MAX_DIV) 70 - return *parent_rate / (SAM9X5_USB_MAX_DIV + 1); 70 + div = DIV_ROUND_CLOSEST(*parent_rate, rate); 71 + if (div > SAM9X5_USB_MAX_DIV + 1) 72 + div = SAM9X5_USB_MAX_DIV + 1; 71 73 72 - bestrate = *parent_rate / div; 73 - tmp = *parent_rate / (div + 1); 74 - if (bestrate - rate > rate - tmp) 75 - bestrate = tmp; 76 - 77 - return bestrate; 74 + return DIV_ROUND_CLOSEST(*parent_rate, div); 78 75 } 79 76 80 77 static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) ··· 103 106 u32 tmp; 104 107 struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); 105 108 struct at91_pmc *pmc = usb->pmc; 106 - unsigned long div = parent_rate / rate; 109 + unsigned long div; 107 110 108 - if (parent_rate % rate || div < 1 || div >= SAM9X5_USB_MAX_DIV) 111 + if (!rate) 112 + return -EINVAL; 113 + 114 + div = DIV_ROUND_CLOSEST(parent_rate, rate); 115 + if (div > SAM9X5_USB_MAX_DIV + 1 || !div) 109 116 return -EINVAL; 110 117 111 118 tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; ··· 254 253 255 254 tmp_parent_rate = rate * usb->divisors[i]; 256 255 tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate); 257 - tmprate = tmp_parent_rate / usb->divisors[i]; 256 + tmprate = DIV_ROUND_CLOSEST(tmp_parent_rate, usb->divisors[i]); 258 257 if (tmprate < rate) 259 258 tmpdiff = rate - tmprate; 260 259 else ··· 282 281 struct at91_pmc *pmc = usb->pmc; 283 282 unsigned long div; 284 283 285 - if (!rate || parent_rate % rate) 284 + if (!rate) 286 285 return -EINVAL; 287 286 288 - div = parent_rate / rate; 287 + div = DIV_ROUND_CLOSEST(parent_rate, rate); 289 288 290 289 for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { 291 290 if (usb->divisors[i] == div) {
+9 -9
drivers/clk/clk-divider.c
··· 263 263 if (!rate) 264 264 rate = 1; 265 265 266 + /* if read only, just return current value */ 267 + if (divider->flags & CLK_DIVIDER_READ_ONLY) { 268 + bestdiv = readl(divider->reg) >> divider->shift; 269 + bestdiv &= div_mask(divider); 270 + bestdiv = _get_div(divider, bestdiv); 271 + return bestdiv; 272 + } 273 + 266 274 maxdiv = _get_maxdiv(divider); 267 275 268 276 if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { ··· 369 361 }; 370 362 EXPORT_SYMBOL_GPL(clk_divider_ops); 371 363 372 - const struct clk_ops clk_divider_ro_ops = { 373 - .recalc_rate = clk_divider_recalc_rate, 374 - }; 375 - EXPORT_SYMBOL_GPL(clk_divider_ro_ops); 376 - 377 364 static struct clk *_register_divider(struct device *dev, const char *name, 378 365 const char *parent_name, unsigned long flags, 379 366 void __iomem *reg, u8 shift, u8 width, ··· 394 391 } 395 392 396 393 init.name = name; 397 - if (clk_divider_flags & CLK_DIVIDER_READ_ONLY) 398 - init.ops = &clk_divider_ro_ops; 399 - else 400 - init.ops = &clk_divider_ops; 394 + init.ops = &clk_divider_ops; 401 395 init.flags = flags | CLK_IS_BASIC; 402 396 init.parent_names = (parent_name ? &parent_name: NULL); 403 397 init.num_parents = (parent_name ? 1 : 0);
+2 -2
drivers/clk/pxa/clk-pxa27x.c
··· 322 322 unsigned long ccsr = CCSR; 323 323 324 324 osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); 325 - a = cccr & CCCR_A_BIT; 325 + a = cccr & (1 << CCCR_A_BIT); 326 326 l = ccsr & CCSR_L_MASK; 327 327 328 328 if (osc_forced || a) ··· 341 341 unsigned long ccsr = CCSR; 342 342 343 343 osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); 344 - a = cccr & CCCR_A_BIT; 344 + a = cccr & (1 << CCCR_A_BIT); 345 345 if (osc_forced) 346 346 return PXA_MEM_13Mhz; 347 347 if (a)
+1 -1
drivers/clk/qcom/mmcc-apq8084.c
··· 3122 3122 [ESC1_CLK_SRC] = &esc1_clk_src.clkr, 3123 3123 [HDMI_CLK_SRC] = &hdmi_clk_src.clkr, 3124 3124 [VSYNC_CLK_SRC] = &vsync_clk_src.clkr, 3125 - [RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr, 3125 + [MMSS_RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr, 3126 3126 [RBBMTIMER_CLK_SRC] = &rbbmtimer_clk_src.clkr, 3127 3127 [MAPLE_CLK_SRC] = &maple_clk_src.clkr, 3128 3128 [VDP_CLK_SRC] = &vdp_clk_src.clkr,
+1 -3
drivers/clk/rockchip/clk.c
··· 90 90 div->width = div_width; 91 91 div->lock = lock; 92 92 div->table = div_table; 93 - div_ops = (div_flags & CLK_DIVIDER_READ_ONLY) 94 - ? &clk_divider_ro_ops 95 - : &clk_divider_ops; 93 + div_ops = &clk_divider_ops; 96 94 } 97 95 98 96 clk = clk_register_composite(NULL, name, parent_names, num_parents,
+6 -6
drivers/clocksource/sun4i_timer.c
··· 182 182 /* Make sure timer is stopped before playing with interrupts */ 183 183 sun4i_clkevt_time_stop(0); 184 184 185 + sun4i_clockevent.cpumask = cpu_possible_mask; 186 + sun4i_clockevent.irq = irq; 187 + 188 + clockevents_config_and_register(&sun4i_clockevent, rate, 189 + TIMER_SYNC_TICKS, 0xffffffff); 190 + 185 191 ret = setup_irq(irq, &sun4i_timer_irq); 186 192 if (ret) 187 193 pr_warn("failed to setup irq %d\n", irq); ··· 195 189 /* Enable timer0 interrupt */ 196 190 val = readl(timer_base + TIMER_IRQ_EN_REG); 197 191 writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); 198 - 199 - sun4i_clockevent.cpumask = cpu_possible_mask; 200 - sun4i_clockevent.irq = irq; 201 - 202 - clockevents_config_and_register(&sun4i_clockevent, rate, 203 - TIMER_SYNC_TICKS, 0xffffffff); 204 192 } 205 193 CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer", 206 194 sun4i_timer_init);
+2 -2
drivers/cpufreq/cpufreq-dt.c
··· 166 166 if (ret == -EPROBE_DEFER) 167 167 dev_dbg(cpu_dev, "cpu%d clock not ready, retry\n", cpu); 168 168 else 169 - dev_err(cpu_dev, "failed to get cpu%d clock: %d\n", ret, 170 - cpu); 169 + dev_err(cpu_dev, "failed to get cpu%d clock: %d\n", cpu, 170 + ret); 171 171 } else { 172 172 *cdev = cpu_dev; 173 173 *creg = cpu_reg;
+2 -1
drivers/cpufreq/cpufreq.c
··· 1022 1022 1023 1023 read_unlock_irqrestore(&cpufreq_driver_lock, flags); 1024 1024 1025 - policy->governor = NULL; 1025 + if (policy) 1026 + policy->governor = NULL; 1026 1027 1027 1028 return policy; 1028 1029 }
+14 -15
drivers/crypto/caam/key_gen.c
··· 48 48 u32 *desc; 49 49 struct split_key_result result; 50 50 dma_addr_t dma_addr_in, dma_addr_out; 51 - int ret = 0; 51 + int ret = -ENOMEM; 52 52 53 53 desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); 54 54 if (!desc) { 55 55 dev_err(jrdev, "unable to allocate key input memory\n"); 56 - return -ENOMEM; 56 + return ret; 57 57 } 58 - 59 - init_job_desc(desc, 0); 60 58 61 59 dma_addr_in = dma_map_single(jrdev, (void *)key_in, keylen, 62 60 DMA_TO_DEVICE); 63 61 if (dma_mapping_error(jrdev, dma_addr_in)) { 64 62 dev_err(jrdev, "unable to map key input memory\n"); 65 - kfree(desc); 66 - return -ENOMEM; 63 + goto out_free; 67 64 } 65 + 66 + dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len, 67 + DMA_FROM_DEVICE); 68 + if (dma_mapping_error(jrdev, dma_addr_out)) { 69 + dev_err(jrdev, "unable to map key output memory\n"); 70 + goto out_unmap_in; 71 + } 72 + 73 + init_job_desc(desc, 0); 68 74 append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG); 69 75 70 76 /* Sets MDHA up into an HMAC-INIT */ ··· 87 81 * FIFO_STORE with the explicit split-key content store 88 82 * (0x26 output type) 89 83 */ 90 - dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len, 91 - DMA_FROM_DEVICE); 92 - if (dma_mapping_error(jrdev, dma_addr_out)) { 93 - dev_err(jrdev, "unable to map key output memory\n"); 94 - kfree(desc); 95 - return -ENOMEM; 96 - } 97 84 append_fifo_store(desc, dma_addr_out, split_key_len, 98 85 LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); 99 86 ··· 114 115 115 116 dma_unmap_single(jrdev, dma_addr_out, split_key_pad_len, 116 117 DMA_FROM_DEVICE); 118 + out_unmap_in: 117 119 dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE); 118 - 120 + out_free: 119 121 kfree(desc); 120 - 121 122 return ret; 122 123 } 123 124 EXPORT_SYMBOL(gen_split_key);
+1 -2
drivers/crypto/qat/qat_common/adf_accel_devices.h
··· 198 198 struct dentry *debugfs_dir; 199 199 struct list_head list; 200 200 struct module *owner; 201 - uint8_t accel_id; 202 - uint8_t numa_node; 203 201 struct adf_accel_pci accel_pci_dev; 202 + uint8_t accel_id; 204 203 } __packed; 205 204 #endif
+7 -5
drivers/crypto/qat/qat_common/adf_transport.c
··· 419 419 WRITE_CSR_RING_BASE(csr_addr, bank_num, i, 0); 420 420 ring = &bank->rings[i]; 421 421 if (hw_data->tx_rings_mask & (1 << i)) { 422 - ring->inflights = kzalloc_node(sizeof(atomic_t), 423 - GFP_KERNEL, 424 - accel_dev->numa_node); 422 + ring->inflights = 423 + kzalloc_node(sizeof(atomic_t), 424 + GFP_KERNEL, 425 + dev_to_node(&GET_DEV(accel_dev))); 425 426 if (!ring->inflights) 426 427 goto err; 427 428 } else { ··· 470 469 int i, ret; 471 470 472 471 etr_data = kzalloc_node(sizeof(*etr_data), GFP_KERNEL, 473 - accel_dev->numa_node); 472 + dev_to_node(&GET_DEV(accel_dev))); 474 473 if (!etr_data) 475 474 return -ENOMEM; 476 475 477 476 num_banks = GET_MAX_BANKS(accel_dev); 478 477 size = num_banks * sizeof(struct adf_etr_bank_data); 479 - etr_data->banks = kzalloc_node(size, GFP_KERNEL, accel_dev->numa_node); 478 + etr_data->banks = kzalloc_node(size, GFP_KERNEL, 479 + dev_to_node(&GET_DEV(accel_dev))); 480 480 if (!etr_data->banks) { 481 481 ret = -ENOMEM; 482 482 goto err_bank;
+5 -2
drivers/crypto/qat/qat_common/qat_algs.c
··· 596 596 if (unlikely(!n)) 597 597 return -EINVAL; 598 598 599 - bufl = kmalloc_node(sz, GFP_ATOMIC, inst->accel_dev->numa_node); 599 + bufl = kmalloc_node(sz, GFP_ATOMIC, 600 + dev_to_node(&GET_DEV(inst->accel_dev))); 600 601 if (unlikely(!bufl)) 601 602 return -ENOMEM; 602 603 ··· 606 605 goto err; 607 606 608 607 for_each_sg(assoc, sg, assoc_n, i) { 608 + if (!sg->length) 609 + continue; 609 610 bufl->bufers[bufs].addr = dma_map_single(dev, 610 611 sg_virt(sg), 611 612 sg->length, ··· 643 640 struct qat_alg_buf *bufers; 644 641 645 642 buflout = kmalloc_node(sz, GFP_ATOMIC, 646 - inst->accel_dev->numa_node); 643 + dev_to_node(&GET_DEV(inst->accel_dev))); 647 644 if (unlikely(!buflout)) 648 645 goto err; 649 646 bloutp = dma_map_single(dev, buflout, sz, DMA_TO_DEVICE);
+5 -3
drivers/crypto/qat/qat_common/qat_crypto.c
··· 109 109 110 110 list_for_each(itr, adf_devmgr_get_head()) { 111 111 accel_dev = list_entry(itr, struct adf_accel_dev, list); 112 - if (accel_dev->numa_node == node && adf_dev_started(accel_dev)) 112 + if ((node == dev_to_node(&GET_DEV(accel_dev)) || 113 + dev_to_node(&GET_DEV(accel_dev)) < 0) 114 + && adf_dev_started(accel_dev)) 113 115 break; 114 116 accel_dev = NULL; 115 117 } 116 118 if (!accel_dev) { 117 - pr_err("QAT: Could not find device on give node\n"); 119 + pr_err("QAT: Could not find device on node %d\n", node); 118 120 accel_dev = adf_devmgr_get_first(); 119 121 } 120 122 if (!accel_dev || !adf_dev_started(accel_dev)) ··· 166 164 167 165 for (i = 0; i < num_inst; i++) { 168 166 inst = kzalloc_node(sizeof(*inst), GFP_KERNEL, 169 - accel_dev->numa_node); 167 + dev_to_node(&GET_DEV(accel_dev))); 170 168 if (!inst) 171 169 goto err; 172 170
+1 -1
drivers/crypto/qat/qat_dh895xcc/adf_admin.c
··· 108 108 uint64_t reg_val; 109 109 110 110 admin = kzalloc_node(sizeof(*accel_dev->admin), GFP_KERNEL, 111 - accel_dev->numa_node); 111 + dev_to_node(&GET_DEV(accel_dev))); 112 112 if (!admin) 113 113 return -ENOMEM; 114 114 admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE,
+12 -20
drivers/crypto/qat/qat_dh895xcc/adf_drv.c
··· 119 119 kfree(accel_dev); 120 120 } 121 121 122 - static uint8_t adf_get_dev_node_id(struct pci_dev *pdev) 123 - { 124 - unsigned int bus_per_cpu = 0; 125 - struct cpuinfo_x86 *c = &cpu_data(num_online_cpus() - 1); 126 - 127 - if (!c->phys_proc_id) 128 - return 0; 129 - 130 - bus_per_cpu = 256 / (c->phys_proc_id + 1); 131 - 132 - if (bus_per_cpu != 0) 133 - return pdev->bus->number / bus_per_cpu; 134 - return 0; 135 - } 136 - 137 122 static int qat_dev_start(struct adf_accel_dev *accel_dev) 138 123 { 139 124 int cpus = num_online_cpus(); ··· 220 235 void __iomem *pmisc_bar_addr = NULL; 221 236 char name[ADF_DEVICE_NAME_LENGTH]; 222 237 unsigned int i, bar_nr; 223 - uint8_t node; 224 238 int ret; 225 239 226 240 switch (ent->device) { ··· 230 246 return -ENODEV; 231 247 } 232 248 233 - node = adf_get_dev_node_id(pdev); 234 - accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL, node); 249 + if (num_possible_nodes() > 1 && dev_to_node(&pdev->dev) < 0) { 250 + /* If the accelerator is connected to a node with no memory 251 + * there is no point in using the accelerator since the remote 252 + * memory transaction will be very slow. */ 253 + dev_err(&pdev->dev, "Invalid NUMA configuration.\n"); 254 + return -EINVAL; 255 + } 256 + 257 + accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL, 258 + dev_to_node(&pdev->dev)); 235 259 if (!accel_dev) 236 260 return -ENOMEM; 237 261 238 - accel_dev->numa_node = node; 239 262 INIT_LIST_HEAD(&accel_dev->crypto_list); 240 263 241 264 /* Add accel device to accel table. ··· 255 264 256 265 accel_dev->owner = THIS_MODULE; 257 266 /* Allocate and configure device configuration structure */ 258 - hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL, node); 267 + hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL, 268 + dev_to_node(&pdev->dev)); 259 269 if (!hw_data) { 260 270 ret = -ENOMEM; 261 271 goto out_err;
+1 -1
drivers/crypto/qat/qat_dh895xcc/adf_isr.c
··· 168 168 uint32_t msix_num_entries = hw_data->num_banks + 1; 169 169 170 170 entries = kzalloc_node(msix_num_entries * sizeof(*entries), 171 - GFP_KERNEL, accel_dev->numa_node); 171 + GFP_KERNEL, dev_to_node(&GET_DEV(accel_dev))); 172 172 if (!entries) 173 173 return -ENOMEM; 174 174
+16 -7
drivers/dma/pl330.c
··· 271 271 #define DMAC_MODE_NS (1 << 0) 272 272 unsigned int mode; 273 273 unsigned int data_bus_width:10; /* In number of bits */ 274 - unsigned int data_buf_dep:10; 274 + unsigned int data_buf_dep:11; 275 275 unsigned int num_chan:4; 276 276 unsigned int num_peri:6; 277 277 u32 peri_ns; ··· 2336 2336 int burst_len; 2337 2337 2338 2338 burst_len = pl330->pcfg.data_bus_width / 8; 2339 - burst_len *= pl330->pcfg.data_buf_dep; 2339 + burst_len *= pl330->pcfg.data_buf_dep / pl330->pcfg.num_chan; 2340 2340 burst_len >>= desc->rqcfg.brst_size; 2341 2341 2342 2342 /* src/dst_burst_len can't be more than 16 */ ··· 2459 2459 /* Select max possible burst size */ 2460 2460 burst = pl330->pcfg.data_bus_width / 8; 2461 2461 2462 - while (burst > 1) { 2463 - if (!(len % burst)) 2464 - break; 2462 + /* 2463 + * Make sure we use a burst size that aligns with all the memcpy 2464 + * parameters because our DMA programming algorithm doesn't cope with 2465 + * transfers which straddle an entry in the DMA device's MFIFO. 2466 + */ 2467 + while ((src | dst | len) & (burst - 1)) 2465 2468 burst /= 2; 2466 - } 2467 2469 2468 2470 desc->rqcfg.brst_size = 0; 2469 2471 while (burst != (1 << desc->rqcfg.brst_size)) 2470 2472 desc->rqcfg.brst_size++; 2473 + 2474 + /* 2475 + * If burst size is smaller than bus width then make sure we only 2476 + * transfer one at a time to avoid a burst stradling an MFIFO entry. 2477 + */ 2478 + if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) 2479 + desc->rqcfg.brst_len = 1; 2471 2480 2472 2481 desc->rqcfg.brst_len = get_burst_len(desc, len); 2473 2482 ··· 2741 2732 2742 2733 2743 2734 dev_info(&adev->dev, 2744 - "Loaded driver for PL330 DMAC-%d\n", adev->periphid); 2735 + "Loaded driver for PL330 DMAC-%x\n", adev->periphid); 2745 2736 dev_info(&adev->dev, 2746 2737 "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", 2747 2738 pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan,
+30 -31
drivers/dma/sun6i-dma.c
··· 230 230 readl(pchan->base + DMA_CHAN_CUR_PARA)); 231 231 } 232 232 233 - static inline int convert_burst(u32 maxburst, u8 *burst) 233 + static inline s8 convert_burst(u32 maxburst) 234 234 { 235 235 switch (maxburst) { 236 236 case 1: 237 - *burst = 0; 238 - break; 237 + return 0; 239 238 case 8: 240 - *burst = 2; 241 - break; 239 + return 2; 242 240 default: 243 241 return -EINVAL; 244 242 } 245 - 246 - return 0; 247 243 } 248 244 249 - static inline int convert_buswidth(enum dma_slave_buswidth addr_width, u8 *width) 245 + static inline s8 convert_buswidth(enum dma_slave_buswidth addr_width) 250 246 { 251 247 if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || 252 248 (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) 253 249 return -EINVAL; 254 250 255 - *width = addr_width >> 1; 256 - return 0; 251 + return addr_width >> 1; 257 252 } 258 253 259 254 static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev, ··· 279 284 struct dma_slave_config *config) 280 285 { 281 286 u8 src_width, dst_width, src_burst, dst_burst; 282 - int ret; 283 287 284 288 if (!config) 285 289 return -EINVAL; 286 290 287 - ret = convert_burst(config->src_maxburst, &src_burst); 288 - if (ret) 289 - return ret; 291 + src_burst = convert_burst(config->src_maxburst); 292 + if (src_burst) 293 + return src_burst; 290 294 291 - ret = convert_burst(config->dst_maxburst, &dst_burst); 292 - if (ret) 293 - return ret; 295 + dst_burst = convert_burst(config->dst_maxburst); 296 + if (dst_burst) 297 + return dst_burst; 294 298 295 - ret = convert_buswidth(config->src_addr_width, &src_width); 296 - if (ret) 297 - return ret; 299 + src_width = convert_buswidth(config->src_addr_width); 300 + if (src_width) 301 + return src_width; 298 302 299 - ret = convert_buswidth(config->dst_addr_width, &dst_width); 300 - if (ret) 301 - return ret; 303 + dst_width = convert_buswidth(config->dst_addr_width); 304 + if (dst_width) 305 + return dst_width; 302 306 303 307 lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) | 304 308 DMA_CHAN_CFG_SRC_WIDTH(src_width) | ··· 536 542 { 537 543 struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device); 538 544 struct sun6i_vchan *vchan = to_sun6i_vchan(chan); 539 - struct dma_slave_config *sconfig = &vchan->cfg; 540 545 struct sun6i_dma_lli *v_lli; 541 546 struct sun6i_desc *txd; 542 547 dma_addr_t p_lli; 543 - int ret; 548 + s8 burst, width; 544 549 545 550 dev_dbg(chan2dev(chan), 546 551 "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n", ··· 558 565 goto err_txd_free; 559 566 } 560 567 561 - ret = sun6i_dma_cfg_lli(v_lli, src, dest, len, sconfig); 562 - if (ret) 563 - goto err_dma_free; 568 + v_lli->src = src; 569 + v_lli->dst = dest; 570 + v_lli->len = len; 571 + v_lli->para = NORMAL_WAIT; 564 572 573 + burst = convert_burst(8); 574 + width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES); 565 575 v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | 566 576 DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | 567 577 DMA_CHAN_CFG_DST_LINEAR_MODE | 568 - DMA_CHAN_CFG_SRC_LINEAR_MODE; 578 + DMA_CHAN_CFG_SRC_LINEAR_MODE | 579 + DMA_CHAN_CFG_SRC_BURST(burst) | 580 + DMA_CHAN_CFG_SRC_WIDTH(width) | 581 + DMA_CHAN_CFG_DST_BURST(burst) | 582 + DMA_CHAN_CFG_DST_WIDTH(width); 569 583 570 584 sun6i_dma_lli_add(NULL, v_lli, p_lli, txd); 571 585 ··· 580 580 581 581 return vchan_tx_prep(&vchan->vc, &txd->vd, flags); 582 582 583 - err_dma_free: 584 - dma_pool_free(sdev->pool, v_lli, p_lli); 585 583 err_txd_free: 586 584 kfree(txd); 587 585 return NULL; ··· 913 915 sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; 914 916 sdc->slave.device_control = sun6i_dma_control; 915 917 sdc->slave.chancnt = NR_MAX_VCHANS; 918 + sdc->slave.copy_align = 4; 916 919 917 920 sdc->slave.dev = &pdev->dev; 918 921
+1 -2
drivers/firewire/core-cdev.c
··· 1637 1637 _IOC_SIZE(cmd) > sizeof(buffer)) 1638 1638 return -ENOTTY; 1639 1639 1640 - if (_IOC_DIR(cmd) == _IOC_READ) 1641 - memset(&buffer, 0, _IOC_SIZE(cmd)); 1640 + memset(&buffer, 0, sizeof(buffer)); 1642 1641 1643 1642 if (_IOC_DIR(cmd) & _IOC_WRITE) 1644 1643 if (copy_from_user(&buffer, arg, _IOC_SIZE(cmd)))
+12
drivers/gpu/drm/exynos/exynos_drm_drv.c
··· 646 646 if (!is_exynos) 647 647 return -ENODEV; 648 648 649 + /* 650 + * Register device object only in case of Exynos SoC. 651 + * 652 + * Below codes resolves temporarily infinite loop issue incurred 653 + * by Exynos drm driver when using multi-platform kernel. 654 + * So these codes will be replaced with more generic way later. 655 + */ 656 + if (!of_machine_is_compatible("samsung,exynos3") && 657 + !of_machine_is_compatible("samsung,exynos4") && 658 + !of_machine_is_compatible("samsung,exynos5")) 659 + return -ENODEV; 660 + 649 661 exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, 650 662 NULL, 0); 651 663 if (IS_ERR(exynos_drm_pdev))
+8 -6
drivers/gpu/drm/i915/i915_dma.c
··· 1663 1663 goto out_regs; 1664 1664 1665 1665 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 1666 - ret = i915_kick_out_vgacon(dev_priv); 1667 - if (ret) { 1668 - DRM_ERROR("failed to remove conflicting VGA console\n"); 1669 - goto out_gtt; 1670 - } 1671 - 1666 + /* WARNING: Apparently we must kick fbdev drivers before vgacon, 1667 + * otherwise the vga fbdev driver falls over. */ 1672 1668 ret = i915_kick_out_firmware_fb(dev_priv); 1673 1669 if (ret) { 1674 1670 DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); 1671 + goto out_gtt; 1672 + } 1673 + 1674 + ret = i915_kick_out_vgacon(dev_priv); 1675 + if (ret) { 1676 + DRM_ERROR("failed to remove conflicting VGA console\n"); 1675 1677 goto out_gtt; 1676 1678 } 1677 1679 }
+16
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 1920 1920 GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | 1921 1921 GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); 1922 1922 1923 + if (!USES_PPGTT(dev_priv->dev)) 1924 + /* Spec: "For GGTT, there is NO pat_sel[2:0] from the entry, 1925 + * so RTL will always use the value corresponding to 1926 + * pat_sel = 000". 1927 + * So let's disable cache for GGTT to avoid screen corruptions. 1928 + * MOCS still can be used though. 1929 + * - System agent ggtt writes (i.e. cpu gtt mmaps) already work 1930 + * before this patch, i.e. the same uncached + snooping access 1931 + * like on gen6/7 seems to be in effect. 1932 + * - So this just fixes blitter/render access. Again it looks 1933 + * like it's not just uncached access, but uncached + snooping. 1934 + * So we can still hold onto all our assumptions wrt cpu 1935 + * clflushing on LLC machines. 1936 + */ 1937 + pat = GEN8_PPAT(0, GEN8_PPAT_UC); 1938 + 1923 1939 /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b 1924 1940 * write would work. */ 1925 1941 I915_WRITE(GEN8_PRIVATE_PAT, pat);
+3 -16
drivers/gpu/drm/i915/i915_gem_tiling.c
··· 375 375 * has to also include the unfenced register the GPU uses 376 376 * whilst executing a fenced command for an untiled object. 377 377 */ 378 - 379 - obj->map_and_fenceable = 380 - !i915_gem_obj_ggtt_bound(obj) || 381 - (i915_gem_obj_ggtt_offset(obj) + 382 - obj->base.size <= dev_priv->gtt.mappable_end && 383 - i915_gem_object_fence_ok(obj, args->tiling_mode)); 384 - 385 - /* Rebind if we need a change of alignment */ 386 - if (!obj->map_and_fenceable) { 387 - u32 unfenced_align = 388 - i915_gem_get_gtt_alignment(dev, obj->base.size, 389 - args->tiling_mode, 390 - false); 391 - if (i915_gem_obj_ggtt_offset(obj) & (unfenced_align - 1)) 392 - ret = i915_gem_object_ggtt_unbind(obj); 393 - } 378 + if (obj->map_and_fenceable && 379 + !i915_gem_object_fence_ok(obj, args->tiling_mode)) 380 + ret = i915_gem_object_ggtt_unbind(obj); 394 381 395 382 if (ret == 0) { 396 383 obj->fence_dirty =
+4
drivers/gpu/drm/i915/intel_display.c
··· 9066 9066 struct drm_device *dev = crtc->base.dev; 9067 9067 struct drm_i915_private *dev_priv = dev->dev_private; 9068 9068 9069 + if (i915_reset_in_progress(&dev_priv->gpu_error) || 9070 + crtc->reset_counter != atomic_read(&dev_priv->gpu_error.reset_counter)) 9071 + return true; 9072 + 9069 9073 /* 9070 9074 * The relevant registers doen't exist on pre-ctg. 9071 9075 * As the flip done interrupt doesn't trigger for mmio
+1
drivers/gpu/drm/i915/intel_dp.c
··· 4686 4686 * vdd might still be enabled do to the delayed vdd off. 4687 4687 * Make sure vdd is actually turned off here. 4688 4688 */ 4689 + cancel_delayed_work_sync(&intel_dp->panel_vdd_work); 4689 4690 pps_lock(intel_dp); 4690 4691 edp_panel_vdd_off_sync(intel_dp); 4691 4692 pps_unlock(intel_dp);
+15 -2
drivers/gpu/drm/i915/intel_panel.c
··· 1094 1094 struct drm_device *dev = connector->base.dev; 1095 1095 struct drm_i915_private *dev_priv = dev->dev_private; 1096 1096 struct intel_panel *panel = &connector->panel; 1097 + int min; 1097 1098 1098 1099 WARN_ON(panel->backlight.max == 0); 1099 1100 1101 + /* 1102 + * XXX: If the vbt value is 255, it makes min equal to max, which leads 1103 + * to problems. There are such machines out there. Either our 1104 + * interpretation is wrong or the vbt has bogus data. Or both. Safeguard 1105 + * against this by letting the minimum be at most (arbitrarily chosen) 1106 + * 25% of the max. 1107 + */ 1108 + min = clamp_t(int, dev_priv->vbt.backlight.min_brightness, 0, 64); 1109 + if (min != dev_priv->vbt.backlight.min_brightness) { 1110 + DRM_DEBUG_KMS("clamping VBT min backlight %d/255 to %d/255\n", 1111 + dev_priv->vbt.backlight.min_brightness, min); 1112 + } 1113 + 1100 1114 /* vbt value is a coefficient in range [0..255] */ 1101 - return scale(dev_priv->vbt.backlight.min_brightness, 0, 255, 1102 - 0, panel->backlight.max); 1115 + return scale(min, 0, 255, 0, panel->backlight.max); 1103 1116 } 1104 1117 1105 1118 static int bdw_setup_backlight(struct intel_connector *connector)
-5
drivers/gpu/drm/i915/intel_pm.c
··· 6533 6533 I915_WRITE(_3D_CHICKEN, 6534 6534 _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); 6535 6535 6536 - /* WaSetupGtModeTdRowDispatch:snb */ 6537 - if (IS_SNB_GT1(dev)) 6538 - I915_WRITE(GEN6_GT_MODE, 6539 - _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE)); 6540 - 6541 6536 /* WaDisable_RenderCache_OperationalFlush:snb */ 6542 6537 I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); 6543 6538
+15 -1
drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c
··· 27 27 }; 28 28 29 29 static int 30 + gk20a_fb_init(struct nouveau_object *object) 31 + { 32 + struct gk20a_fb_priv *priv = (void *)object; 33 + int ret; 34 + 35 + ret = nouveau_fb_init(&priv->base); 36 + if (ret) 37 + return ret; 38 + 39 + nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ 40 + return 0; 41 + } 42 + 43 + static int 30 44 gk20a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 31 45 struct nouveau_oclass *oclass, void *data, u32 size, 32 46 struct nouveau_object **pobject) ··· 62 48 .base.ofuncs = &(struct nouveau_ofuncs) { 63 49 .ctor = gk20a_fb_ctor, 64 50 .dtor = _nouveau_fb_dtor, 65 - .init = _nouveau_fb_init, 51 + .init = gk20a_fb_init, 66 52 .fini = _nouveau_fb_fini, 67 53 }, 68 54 .memtype = nvc0_fb_memtype_valid,
+23 -2
drivers/gpu/drm/nouveau/nv50_display.c
··· 792 792 } 793 793 794 794 static int 795 + nv50_crtc_set_raster_vblank_dmi(struct nouveau_crtc *nv_crtc, u32 usec) 796 + { 797 + struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); 798 + u32 *push; 799 + 800 + push = evo_wait(mast, 8); 801 + if (!push) 802 + return -ENOMEM; 803 + 804 + evo_mthd(push, 0x0828 + (nv_crtc->index * 0x400), 1); 805 + evo_data(push, usec); 806 + evo_kick(push, mast); 807 + return 0; 808 + } 809 + 810 + static int 795 811 nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) 796 812 { 797 813 struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); ··· 1121 1105 evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); 1122 1106 evo_data(push, 0x00800000 | mode->clock); 1123 1107 evo_data(push, (ilace == 2) ? 2 : 0); 1124 - evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 8); 1108 + evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 6); 1125 1109 evo_data(push, 0x00000000); 1126 1110 evo_data(push, (vactive << 16) | hactive); 1127 1111 evo_data(push, ( vsynce << 16) | hsynce); 1128 1112 evo_data(push, (vblanke << 16) | hblanke); 1129 1113 evo_data(push, (vblanks << 16) | hblanks); 1130 1114 evo_data(push, (vblan2e << 16) | vblan2s); 1131 - evo_data(push, vblankus); 1115 + evo_mthd(push, 0x082c + (nv_crtc->index * 0x400), 1); 1132 1116 evo_data(push, 0x00000000); 1133 1117 evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); 1134 1118 evo_data(push, 0x00000311); ··· 1158 1142 nv_connector = nouveau_crtc_connector_get(nv_crtc); 1159 1143 nv50_crtc_set_dither(nv_crtc, false); 1160 1144 nv50_crtc_set_scale(nv_crtc, false); 1145 + 1146 + /* G94 only accepts this after setting scale */ 1147 + if (nv50_vers(mast) < GF110_DISP_CORE_CHANNEL_DMA) 1148 + nv50_crtc_set_raster_vblank_dmi(nv_crtc, vblankus); 1149 + 1161 1150 nv50_crtc_set_color_vibrance(nv_crtc, false); 1162 1151 nv50_crtc_set_image(nv_crtc, crtc->primary->fb, x, y, false); 1163 1152 return 0;
+10 -1
drivers/gpu/drm/radeon/atom.c
··· 1217 1217 return ret; 1218 1218 } 1219 1219 1220 - int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1220 + int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int index, uint32_t * params) 1221 1221 { 1222 1222 int r; 1223 1223 ··· 1235 1235 ctx->divmul[1] = 0; 1236 1236 r = atom_execute_table_locked(ctx, index, params); 1237 1237 mutex_unlock(&ctx->mutex); 1238 + return r; 1239 + } 1240 + 1241 + int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1242 + { 1243 + int r; 1244 + mutex_lock(&ctx->scratch_mutex); 1245 + r = atom_execute_table_scratch_unlocked(ctx, index, params); 1246 + mutex_unlock(&ctx->scratch_mutex); 1238 1247 return r; 1239 1248 } 1240 1249
+2
drivers/gpu/drm/radeon/atom.h
··· 125 125 struct atom_context { 126 126 struct card_info *card; 127 127 struct mutex mutex; 128 + struct mutex scratch_mutex; 128 129 void *bios; 129 130 uint32_t cmd_table, data_table; 130 131 uint16_t *iio; ··· 146 145 147 146 struct atom_context *atom_parse(struct card_info *, void *); 148 147 int atom_execute_table(struct atom_context *, int, uint32_t *); 148 + int atom_execute_table_scratch_unlocked(struct atom_context *, int, uint32_t *); 149 149 int atom_asic_init(struct atom_context *); 150 150 void atom_destroy(struct atom_context *); 151 151 bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size,
+3 -1
drivers/gpu/drm/radeon/atombios_dp.c
··· 100 100 memset(&args, 0, sizeof(args)); 101 101 102 102 mutex_lock(&chan->mutex); 103 + mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); 103 104 104 105 base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); 105 106 ··· 114 113 if (ASIC_IS_DCE4(rdev)) 115 114 args.v2.ucHPD_ID = chan->rec.hpd; 116 115 117 - atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 116 + atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); 118 117 119 118 *ack = args.v1.ucReplyStatus; 120 119 ··· 148 147 149 148 r = recv_bytes; 150 149 done: 150 + mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); 151 151 mutex_unlock(&chan->mutex); 152 152 153 153 return r;
+3 -1
drivers/gpu/drm/radeon/atombios_i2c.c
··· 48 48 memset(&args, 0, sizeof(args)); 49 49 50 50 mutex_lock(&chan->mutex); 51 + mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); 51 52 52 53 base = (unsigned char *)rdev->mode_info.atom_context->scratch; 53 54 ··· 83 82 args.ucSlaveAddr = slave_addr << 1; 84 83 args.ucLineNumber = chan->rec.i2c_id; 85 84 86 - atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 85 + atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); 87 86 88 87 /* error */ 89 88 if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) { ··· 96 95 radeon_atom_copy_swap(buf, base, num, false); 97 96 98 97 done: 98 + mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); 99 99 mutex_unlock(&chan->mutex); 100 100 101 101 return r;
+5 -2
drivers/gpu/drm/radeon/cik.c
··· 4333 4333 /* init the CE partitions. CE only used for gfx on CIK */ 4334 4334 radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); 4335 4335 radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); 4336 - radeon_ring_write(ring, 0xc000); 4337 - radeon_ring_write(ring, 0xc000); 4336 + radeon_ring_write(ring, 0x8000); 4337 + radeon_ring_write(ring, 0x8000); 4338 4338 4339 4339 /* setup clear context state */ 4340 4340 radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); ··· 9416 9416 struct drm_display_mode *mode = NULL; 9417 9417 u32 num_heads = 0, lb_size; 9418 9418 int i; 9419 + 9420 + if (!rdev->mode_info.mode_config_initialized) 9421 + return; 9419 9422 9420 9423 radeon_update_display_priority(rdev); 9421 9424
+12 -9
drivers/gpu/drm/radeon/cik_sdma.c
··· 663 663 { 664 664 struct radeon_ib ib; 665 665 unsigned i; 666 + unsigned index; 666 667 int r; 667 - void __iomem *ptr = (void *)rdev->vram_scratch.ptr; 668 668 u32 tmp = 0; 669 + u64 gpu_addr; 669 670 670 - if (!ptr) { 671 - DRM_ERROR("invalid vram scratch pointer\n"); 672 - return -EINVAL; 673 - } 671 + if (ring->idx == R600_RING_TYPE_DMA_INDEX) 672 + index = R600_WB_DMA_RING_TEST_OFFSET; 673 + else 674 + index = CAYMAN_WB_DMA1_RING_TEST_OFFSET; 675 + 676 + gpu_addr = rdev->wb.gpu_addr + index; 674 677 675 678 tmp = 0xCAFEDEAD; 676 - writel(tmp, ptr); 679 + rdev->wb.wb[index/4] = cpu_to_le32(tmp); 677 680 678 681 r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); 679 682 if (r) { ··· 685 682 } 686 683 687 684 ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, SDMA_WRITE_SUB_OPCODE_LINEAR, 0); 688 - ib.ptr[1] = rdev->vram_scratch.gpu_addr & 0xfffffffc; 689 - ib.ptr[2] = upper_32_bits(rdev->vram_scratch.gpu_addr); 685 + ib.ptr[1] = lower_32_bits(gpu_addr); 686 + ib.ptr[2] = upper_32_bits(gpu_addr); 690 687 ib.ptr[3] = 1; 691 688 ib.ptr[4] = 0xDEADBEEF; 692 689 ib.length_dw = 5; ··· 703 700 return r; 704 701 } 705 702 for (i = 0; i < rdev->usec_timeout; i++) { 706 - tmp = readl(ptr); 703 + tmp = le32_to_cpu(rdev->wb.wb[index/4]); 707 704 if (tmp == 0xDEADBEEF) 708 705 break; 709 706 DRM_UDELAY(1);
+4
drivers/gpu/drm/radeon/evergreen.c
··· 2345 2345 u32 num_heads = 0, lb_size; 2346 2346 int i; 2347 2347 2348 + if (!rdev->mode_info.mode_config_initialized) 2349 + return; 2350 + 2348 2351 radeon_update_display_priority(rdev); 2349 2352 2350 2353 for (i = 0; i < rdev->num_crtc; i++) { ··· 2555 2552 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); 2556 2553 tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; 2557 2554 WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); 2555 + WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0); 2558 2556 } 2559 2557 } else { 2560 2558 tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]);
+3
drivers/gpu/drm/radeon/r100.c
··· 3207 3207 uint32_t pixel_bytes1 = 0; 3208 3208 uint32_t pixel_bytes2 = 0; 3209 3209 3210 + if (!rdev->mode_info.mode_config_initialized) 3211 + return; 3212 + 3210 3213 radeon_update_display_priority(rdev); 3211 3214 3212 3215 if (rdev->mode_info.crtcs[0]->base.enabled) {
+10 -10
drivers/gpu/drm/radeon/r600_dma.c
··· 338 338 { 339 339 struct radeon_ib ib; 340 340 unsigned i; 341 + unsigned index; 341 342 int r; 342 - void __iomem *ptr = (void *)rdev->vram_scratch.ptr; 343 343 u32 tmp = 0; 344 + u64 gpu_addr; 344 345 345 - if (!ptr) { 346 - DRM_ERROR("invalid vram scratch pointer\n"); 347 - return -EINVAL; 348 - } 346 + if (ring->idx == R600_RING_TYPE_DMA_INDEX) 347 + index = R600_WB_DMA_RING_TEST_OFFSET; 348 + else 349 + index = CAYMAN_WB_DMA1_RING_TEST_OFFSET; 349 350 350 - tmp = 0xCAFEDEAD; 351 - writel(tmp, ptr); 351 + gpu_addr = rdev->wb.gpu_addr + index; 352 352 353 353 r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); 354 354 if (r) { ··· 357 357 } 358 358 359 359 ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 1); 360 - ib.ptr[1] = rdev->vram_scratch.gpu_addr & 0xfffffffc; 361 - ib.ptr[2] = upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff; 360 + ib.ptr[1] = lower_32_bits(gpu_addr); 361 + ib.ptr[2] = upper_32_bits(gpu_addr) & 0xff; 362 362 ib.ptr[3] = 0xDEADBEEF; 363 363 ib.length_dw = 4; 364 364 ··· 374 374 return r; 375 375 } 376 376 for (i = 0; i < rdev->usec_timeout; i++) { 377 - tmp = readl(ptr); 377 + tmp = le32_to_cpu(rdev->wb.wb[index/4]); 378 378 if (tmp == 0xDEADBEEF) 379 379 break; 380 380 DRM_UDELAY(1);
+1 -1
drivers/gpu/drm/radeon/r600_dpm.c
··· 1265 1265 (mode_info->atom_context->bios + data_offset + 1266 1266 le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); 1267 1267 rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = 1268 - ppt->usMaximumPowerDeliveryLimit; 1268 + le16_to_cpu(ppt->usMaximumPowerDeliveryLimit); 1269 1269 pt = &ppt->power_tune_table; 1270 1270 } else { 1271 1271 ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *)
+18 -1
drivers/gpu/drm/radeon/radeon_connectors.c
··· 322 322 } 323 323 324 324 if (!radeon_connector->edid) { 325 + /* don't fetch the edid from the vbios if ddc fails and runpm is 326 + * enabled so we report disconnected. 327 + */ 328 + if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) 329 + return; 330 + 325 331 if (rdev->is_atom_bios) { 326 332 /* some laptops provide a hardcoded edid in rom for LCDs */ 327 333 if (((connector->connector_type == DRM_MODE_CONNECTOR_LVDS) || ··· 832 826 static enum drm_connector_status 833 827 radeon_lvds_detect(struct drm_connector *connector, bool force) 834 828 { 829 + struct drm_device *dev = connector->dev; 830 + struct radeon_device *rdev = dev->dev_private; 835 831 struct radeon_connector *radeon_connector = to_radeon_connector(connector); 836 832 struct drm_encoder *encoder = radeon_best_single_encoder(connector); 837 833 enum drm_connector_status ret = connector_status_disconnected; ··· 850 842 /* check if panel is valid */ 851 843 if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) 852 844 ret = connector_status_connected; 853 - 845 + /* don't fetch the edid from the vbios if ddc fails and runpm is 846 + * enabled so we report disconnected. 847 + */ 848 + if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) 849 + ret = connector_status_disconnected; 854 850 } 855 851 856 852 /* check for edid as well */ ··· 1601 1589 /* check if panel is valid */ 1602 1590 if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) 1603 1591 ret = connector_status_connected; 1592 + /* don't fetch the edid from the vbios if ddc fails and runpm is 1593 + * enabled so we report disconnected. 1594 + */ 1595 + if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) 1596 + ret = connector_status_disconnected; 1604 1597 } 1605 1598 /* eDP is always DP */ 1606 1599 radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT;
+1
drivers/gpu/drm/radeon/radeon_device.c
··· 983 983 } 984 984 985 985 mutex_init(&rdev->mode_info.atom_context->mutex); 986 + mutex_init(&rdev->mode_info.atom_context->scratch_mutex); 986 987 radeon_atom_initialize_bios_scratch_regs(rdev->ddev); 987 988 atom_allocate_fb_scratch(rdev->mode_info.atom_context); 988 989 return 0;
+3
drivers/gpu/drm/radeon/radeon_encoders.c
··· 179 179 (rdev->pdev->subsystem_vendor == 0x1734) && 180 180 (rdev->pdev->subsystem_device == 0x1107)) 181 181 use_bl = false; 182 + /* disable native backlight control on older asics */ 183 + else if (rdev->family < CHIP_R600) 184 + use_bl = false; 182 185 else 183 186 use_bl = true; 184 187 }
+10
drivers/gpu/drm/radeon/radeon_irq_kms.c
··· 185 185 if (rdev->flags & RADEON_IS_AGP) 186 186 return false; 187 187 188 + /* 189 + * Older chips have a HW limitation, they can only generate 40 bits 190 + * of address for "64-bit" MSIs which breaks on some platforms, notably 191 + * IBM POWER servers, so we limit them 192 + */ 193 + if (rdev->family < CHIP_BONAIRE) { 194 + dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n"); 195 + rdev->pdev->no_64bit_msi = 1; 196 + } 197 + 188 198 /* force MSI on */ 189 199 if (radeon_msi == 1) 190 200 return true;
+3
drivers/gpu/drm/radeon/rs600.c
··· 879 879 u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt; 880 880 /* FIXME: implement full support */ 881 881 882 + if (!rdev->mode_info.mode_config_initialized) 883 + return; 884 + 882 885 radeon_update_display_priority(rdev); 883 886 884 887 if (rdev->mode_info.crtcs[0]->base.enabled)
+3
drivers/gpu/drm/radeon/rs690.c
··· 579 579 u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt; 580 580 u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt; 581 581 582 + if (!rdev->mode_info.mode_config_initialized) 583 + return; 584 + 582 585 radeon_update_display_priority(rdev); 583 586 584 587 if (rdev->mode_info.crtcs[0]->base.enabled)
+3
drivers/gpu/drm/radeon/rv515.c
··· 1277 1277 struct drm_display_mode *mode0 = NULL; 1278 1278 struct drm_display_mode *mode1 = NULL; 1279 1279 1280 + if (!rdev->mode_info.mode_config_initialized) 1281 + return; 1282 + 1280 1283 radeon_update_display_priority(rdev); 1281 1284 1282 1285 if (rdev->mode_info.crtcs[0]->base.enabled)
+3
drivers/gpu/drm/radeon/si.c
··· 2384 2384 u32 num_heads = 0, lb_size; 2385 2385 int i; 2386 2386 2387 + if (!rdev->mode_info.mode_config_initialized) 2388 + return; 2389 + 2387 2390 radeon_update_display_priority(rdev); 2388 2391 2389 2392 for (i = 0; i < rdev->num_crtc; i++) {
+4 -4
drivers/gpu/drm/tegra/dc.c
··· 906 906 } 907 907 } 908 908 909 - drm_vblank_off(drm, dc->pipe); 909 + drm_crtc_vblank_off(crtc); 910 910 tegra_dc_commit(dc); 911 911 } 912 912 ··· 996 996 u32 value; 997 997 int err; 998 998 999 - drm_vblank_pre_modeset(crtc->dev, dc->pipe); 1000 - 1001 999 err = tegra_crtc_setup_clk(crtc, mode); 1002 1000 if (err) { 1003 1001 dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); ··· 1049 1051 unsigned int syncpt; 1050 1052 unsigned long value; 1051 1053 1054 + drm_crtc_vblank_off(crtc); 1055 + 1052 1056 /* hardware initialization */ 1053 1057 reset_control_deassert(dc->rst); 1054 1058 usleep_range(10000, 20000); ··· 1091 1091 { 1092 1092 struct tegra_dc *dc = to_tegra_dc(crtc); 1093 1093 1094 - drm_vblank_post_modeset(crtc->dev, dc->pipe); 1094 + drm_crtc_vblank_on(crtc); 1095 1095 tegra_dc_commit(dc); 1096 1096 } 1097 1097
+1
drivers/hid/hid-core.c
··· 1659 1659 hdev->hiddev_disconnect(hdev); 1660 1660 if (hdev->claimed & HID_CLAIMED_HIDRAW) 1661 1661 hidraw_disconnect(hdev); 1662 + hdev->claimed = 0; 1662 1663 } 1663 1664 EXPORT_SYMBOL_GPL(hid_disconnect); 1664 1665
+1
drivers/hid/hid-ids.h
··· 299 299 #define USB_VENDOR_ID_ELAN 0x04f3 300 300 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 301 301 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b 302 + #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 302 303 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f 303 304 304 305 #define USB_VENDOR_ID_ELECOM 0x056e
+1
drivers/hid/usbhid/hid-quirks.c
··· 72 72 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 73 73 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, 74 74 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, 75 + { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, 75 76 { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, 76 77 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 77 78 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
+1 -1
drivers/hwmon/fam15h_power.c
··· 234 234 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, 235 235 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, 236 236 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, 237 - { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, 237 + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, 238 238 {} 239 239 }; 240 240 MODULE_DEVICE_TABLE(pci, fam15h_power_id_table);
+2 -4
drivers/hwmon/g762.c
··· 1084 1084 if (ret) 1085 1085 goto clock_dis; 1086 1086 1087 - data->hwmon_dev = devm_hwmon_device_register_with_groups(dev, 1088 - client->name, 1089 - data, 1090 - g762_groups); 1087 + data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, 1088 + data, g762_groups); 1091 1089 if (IS_ERR(data->hwmon_dev)) { 1092 1090 ret = PTR_ERR(data->hwmon_dev); 1093 1091 goto clock_dis;
+4 -2
drivers/hwmon/ibmpowernv.c
··· 181 181 182 182 opal = of_find_node_by_path("/ibm,opal/sensors"); 183 183 if (!opal) { 184 - dev_err(&pdev->dev, "Opal node 'sensors' not found\n"); 184 + dev_dbg(&pdev->dev, "Opal node 'sensors' not found\n"); 185 185 return -ENODEV; 186 186 } 187 187 ··· 335 335 336 336 err = platform_driver_probe(&ibmpowernv_driver, ibmpowernv_probe); 337 337 if (err) { 338 - pr_err("Platfrom driver probe failed\n"); 338 + if (err != -ENODEV) 339 + pr_err("Platform driver probe failed (%d)\n", err); 340 + 339 341 goto exit_device_del; 340 342 } 341 343
+10 -3
drivers/hwmon/pwm-fan.c
··· 161 161 static int pwm_fan_resume(struct device *dev) 162 162 { 163 163 struct pwm_fan_ctx *ctx = dev_get_drvdata(dev); 164 + unsigned long duty; 165 + int ret; 164 166 165 - if (ctx->pwm_value) 166 - return pwm_enable(ctx->pwm); 167 - return 0; 167 + if (ctx->pwm_value == 0) 168 + return 0; 169 + 170 + duty = DIV_ROUND_UP(ctx->pwm_value * (ctx->pwm->period - 1), MAX_PWM); 171 + ret = pwm_config(ctx->pwm, duty, ctx->pwm->period); 172 + if (ret) 173 + return ret; 174 + return pwm_enable(ctx->pwm); 168 175 } 169 176 #endif 170 177
+33 -7
drivers/iio/accel/bmc150-accel.c
··· 44 44 45 45 #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B 46 46 #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 47 + #define BMC150_ACCEL_ANY_MOTION_BIT_X BIT(0) 48 + #define BMC150_ACCEL_ANY_MOTION_BIT_Y BIT(1) 49 + #define BMC150_ACCEL_ANY_MOTION_BIT_Z BIT(2) 47 50 #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) 48 51 49 52 #define BMC150_ACCEL_REG_PMU_LPW 0x11 ··· 95 92 #define BMC150_ACCEL_SLOPE_THRES_MASK 0xFF 96 93 97 94 /* Slope duration in terms of number of samples */ 98 - #define BMC150_ACCEL_DEF_SLOPE_DURATION 2 95 + #define BMC150_ACCEL_DEF_SLOPE_DURATION 1 99 96 /* in terms of multiples of g's/LSB, based on range */ 100 - #define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 5 97 + #define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 1 101 98 102 99 #define BMC150_ACCEL_REG_XOUT_L 0x02 103 100 ··· 539 536 if (ret < 0) { 540 537 dev_err(&data->client->dev, 541 538 "Failed: bmc150_accel_set_power_state for %d\n", on); 539 + if (on) 540 + pm_runtime_put_noidle(&data->client->dev); 541 + 542 542 return ret; 543 543 } 544 544 ··· 817 811 818 812 ret = bmc150_accel_setup_any_motion_interrupt(data, state); 819 813 if (ret < 0) { 814 + bmc150_accel_set_power_state(data, false); 820 815 mutex_unlock(&data->mutex); 821 816 return ret; 822 817 } ··· 853 846 854 847 static const struct iio_event_spec bmc150_accel_event = { 855 848 .type = IIO_EV_TYPE_ROC, 856 - .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, 849 + .dir = IIO_EV_DIR_EITHER, 857 850 .mask_separate = BIT(IIO_EV_INFO_VALUE) | 858 851 BIT(IIO_EV_INFO_ENABLE) | 859 852 BIT(IIO_EV_INFO_PERIOD) ··· 1061 1054 else 1062 1055 ret = bmc150_accel_setup_new_data_interrupt(data, state); 1063 1056 if (ret < 0) { 1057 + bmc150_accel_set_power_state(data, false); 1064 1058 mutex_unlock(&data->mutex); 1065 1059 return ret; 1066 1060 } ··· 1100 1092 else 1101 1093 dir = IIO_EV_DIR_RISING; 1102 1094 1103 - if (ret & BMC150_ACCEL_ANY_MOTION_MASK) 1095 + if (ret & BMC150_ACCEL_ANY_MOTION_BIT_X) 1104 1096 iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, 1105 1097 0, 1106 - IIO_MOD_X_OR_Y_OR_Z, 1098 + IIO_MOD_X, 1107 1099 IIO_EV_TYPE_ROC, 1108 - IIO_EV_DIR_EITHER), 1100 + dir), 1101 + data->timestamp); 1102 + if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Y) 1103 + iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, 1104 + 0, 1105 + IIO_MOD_Y, 1106 + IIO_EV_TYPE_ROC, 1107 + dir), 1108 + data->timestamp); 1109 + if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Z) 1110 + iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, 1111 + 0, 1112 + IIO_MOD_Z, 1113 + IIO_EV_TYPE_ROC, 1114 + dir), 1109 1115 data->timestamp); 1110 1116 ack_intr_status: 1111 1117 if (!data->dready_trigger_on) ··· 1376 1354 { 1377 1355 struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); 1378 1356 struct bmc150_accel_data *data = iio_priv(indio_dev); 1357 + int ret; 1379 1358 1380 1359 dev_dbg(&data->client->dev, __func__); 1360 + ret = bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0); 1361 + if (ret < 0) 1362 + return -EAGAIN; 1381 1363 1382 - return bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0); 1364 + return 0; 1383 1365 } 1384 1366 1385 1367 static int bmc150_accel_runtime_resume(struct device *dev)
+2
drivers/iio/accel/kxcjk-1013.c
··· 269 269 return ret; 270 270 } 271 271 272 + ret &= ~(KXCJK1013_REG_CTRL1_BIT_GSEL0 | 273 + KXCJK1013_REG_CTRL1_BIT_GSEL1); 272 274 ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3); 273 275 ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4); 274 276
+1
drivers/iio/adc/men_z188_adc.c
··· 152 152 153 153 static const struct mcb_device_id men_z188_ids[] = { 154 154 { .device = 0xbc }, 155 + { } 155 156 }; 156 157 MODULE_DEVICE_TABLE(mcb, men_z188_ids); 157 158
+49 -4
drivers/iio/gyro/bmg160.c
··· 67 67 #define BMG160_REG_INT_EN_0 0x15 68 68 #define BMG160_DATA_ENABLE_INT BIT(7) 69 69 70 + #define BMG160_REG_INT_EN_1 0x16 71 + #define BMG160_INT1_BIT_OD BIT(1) 72 + 70 73 #define BMG160_REG_XOUT_L 0x02 71 74 #define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2)) 72 75 ··· 85 82 86 83 #define BMG160_REG_INT_STATUS_2 0x0B 87 84 #define BMG160_ANY_MOTION_MASK 0x07 85 + #define BMG160_ANY_MOTION_BIT_X BIT(0) 86 + #define BMG160_ANY_MOTION_BIT_Y BIT(1) 87 + #define BMG160_ANY_MOTION_BIT_Z BIT(2) 88 88 89 89 #define BMG160_REG_TEMP 0x08 90 90 #define BMG160_TEMP_CENTER_VAL 23 ··· 228 222 data->slope_thres = ret; 229 223 230 224 /* Set default interrupt mode */ 225 + ret = i2c_smbus_read_byte_data(data->client, BMG160_REG_INT_EN_1); 226 + if (ret < 0) { 227 + dev_err(&data->client->dev, "Error reading reg_int_en_1\n"); 228 + return ret; 229 + } 230 + ret &= ~BMG160_INT1_BIT_OD; 231 + ret = i2c_smbus_write_byte_data(data->client, 232 + BMG160_REG_INT_EN_1, ret); 233 + if (ret < 0) { 234 + dev_err(&data->client->dev, "Error writing reg_int_en_1\n"); 235 + return ret; 236 + } 237 + 231 238 ret = i2c_smbus_write_byte_data(data->client, 232 239 BMG160_REG_INT_RST_LATCH, 233 240 BMG160_INT_MODE_LATCH_INT | ··· 269 250 if (ret < 0) { 270 251 dev_err(&data->client->dev, 271 252 "Failed: bmg160_set_power_state for %d\n", on); 253 + if (on) 254 + pm_runtime_put_noidle(&data->client->dev); 255 + 272 256 return ret; 273 257 } 274 258 #endif ··· 727 705 728 706 ret = bmg160_setup_any_motion_interrupt(data, state); 729 707 if (ret < 0) { 708 + bmg160_set_power_state(data, false); 730 709 mutex_unlock(&data->mutex); 731 710 return ret; 732 711 } ··· 766 743 767 744 static const struct iio_event_spec bmg160_event = { 768 745 .type = IIO_EV_TYPE_ROC, 769 - .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, 746 + .dir = IIO_EV_DIR_EITHER, 770 747 .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | 771 748 BIT(IIO_EV_INFO_ENABLE) 772 749 }; ··· 894 871 else 895 872 ret = bmg160_setup_new_data_interrupt(data, state); 896 873 if (ret < 0) { 874 + bmg160_set_power_state(data, false); 897 875 mutex_unlock(&data->mutex); 898 876 return ret; 899 877 } ··· 932 908 else 933 909 dir = IIO_EV_DIR_FALLING; 934 910 935 - if (ret & BMG160_ANY_MOTION_MASK) 911 + if (ret & BMG160_ANY_MOTION_BIT_X) 936 912 iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, 937 913 0, 938 - IIO_MOD_X_OR_Y_OR_Z, 914 + IIO_MOD_X, 915 + IIO_EV_TYPE_ROC, 916 + dir), 917 + data->timestamp); 918 + if (ret & BMG160_ANY_MOTION_BIT_Y) 919 + iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, 920 + 0, 921 + IIO_MOD_Y, 922 + IIO_EV_TYPE_ROC, 923 + dir), 924 + data->timestamp); 925 + if (ret & BMG160_ANY_MOTION_BIT_Z) 926 + iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, 927 + 0, 928 + IIO_MOD_Z, 939 929 IIO_EV_TYPE_ROC, 940 930 dir), 941 931 data->timestamp); ··· 1207 1169 { 1208 1170 struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); 1209 1171 struct bmg160_data *data = iio_priv(indio_dev); 1172 + int ret; 1210 1173 1211 - return bmg160_set_mode(data, BMG160_MODE_SUSPEND); 1174 + ret = bmg160_set_mode(data, BMG160_MODE_SUSPEND); 1175 + if (ret < 0) { 1176 + dev_err(&data->client->dev, "set mode failed\n"); 1177 + return -EAGAIN; 1178 + } 1179 + 1180 + return 0; 1212 1181 } 1213 1182 1214 1183 static int bmg160_runtime_resume(struct device *dev)
+30 -14
drivers/infiniband/ulp/isert/ib_isert.c
··· 115 115 attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; 116 116 /* 117 117 * FIXME: Use devattr.max_sge - 2 for max_send_sge as 118 - * work-around for RDMA_READ.. 118 + * work-around for RDMA_READs with ConnectX-2. 119 + * 120 + * Also, still make sure to have at least two SGEs for 121 + * outgoing control PDU responses. 119 122 */ 120 - attr.cap.max_send_sge = device->dev_attr.max_sge - 2; 123 + attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2); 121 124 isert_conn->max_sge = attr.cap.max_send_sge; 122 125 123 126 attr.cap.max_recv_sge = 1; ··· 228 225 struct isert_cq_desc *cq_desc; 229 226 struct ib_device_attr *dev_attr; 230 227 int ret = 0, i, j; 228 + int max_rx_cqe, max_tx_cqe; 231 229 232 230 dev_attr = &device->dev_attr; 233 231 ret = isert_query_device(ib_dev, dev_attr); 234 232 if (ret) 235 233 return ret; 234 + 235 + max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr->max_cqe); 236 + max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr->max_cqe); 236 237 237 238 /* asign function handlers */ 238 239 if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS && ··· 279 272 isert_cq_rx_callback, 280 273 isert_cq_event_callback, 281 274 (void *)&cq_desc[i], 282 - ISER_MAX_RX_CQ_LEN, i); 275 + max_rx_cqe, i); 283 276 if (IS_ERR(device->dev_rx_cq[i])) { 284 277 ret = PTR_ERR(device->dev_rx_cq[i]); 285 278 device->dev_rx_cq[i] = NULL; ··· 291 284 isert_cq_tx_callback, 292 285 isert_cq_event_callback, 293 286 (void *)&cq_desc[i], 294 - ISER_MAX_TX_CQ_LEN, i); 287 + max_tx_cqe, i); 295 288 if (IS_ERR(device->dev_tx_cq[i])) { 296 289 ret = PTR_ERR(device->dev_tx_cq[i]); 297 290 device->dev_tx_cq[i] = NULL; ··· 810 803 complete(&isert_conn->conn_wait); 811 804 } 812 805 813 - static void 806 + static int 814 807 isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) 815 808 { 816 - struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; 809 + struct isert_conn *isert_conn; 810 + 811 + if (!cma_id->qp) { 812 + struct isert_np *isert_np = cma_id->context; 813 + 814 + isert_np->np_cm_id = NULL; 815 + return -1; 816 + } 817 + 818 + isert_conn = (struct isert_conn *)cma_id->context; 817 819 818 820 isert_conn->disconnect = disconnect; 819 821 INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); 820 822 schedule_work(&isert_conn->conn_logout_work); 823 + 824 + return 0; 821 825 } 822 826 823 827 static int ··· 843 825 switch (event->event) { 844 826 case RDMA_CM_EVENT_CONNECT_REQUEST: 845 827 ret = isert_connect_request(cma_id, event); 828 + if (ret) 829 + pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", 830 + event->event, ret); 846 831 break; 847 832 case RDMA_CM_EVENT_ESTABLISHED: 848 833 isert_connected_handler(cma_id); ··· 855 834 case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ 856 835 disconnect = true; 857 836 case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ 858 - isert_disconnected_handler(cma_id, disconnect); 837 + ret = isert_disconnected_handler(cma_id, disconnect); 859 838 break; 860 839 case RDMA_CM_EVENT_CONNECT_ERROR: 861 840 default: 862 841 pr_err("Unhandled RDMA CMA event: %d\n", event->event); 863 842 break; 864 - } 865 - 866 - if (ret != 0) { 867 - pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", 868 - event->event, ret); 869 - dump_stack(); 870 843 } 871 844 872 845 return ret; ··· 3205 3190 { 3206 3191 struct isert_np *isert_np = (struct isert_np *)np->np_context; 3207 3192 3208 - rdma_destroy_id(isert_np->np_cm_id); 3193 + if (isert_np->np_cm_id) 3194 + rdma_destroy_id(isert_np->np_cm_id); 3209 3195 3210 3196 np->np_context = NULL; 3211 3197 kfree(isert_np);
+8
drivers/infiniband/ulp/srpt/ib_srpt.c
··· 2092 2092 if (!qp_init) 2093 2093 goto out; 2094 2094 2095 + retry: 2095 2096 ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, 2096 2097 ch->rq_size + srp_sq_size, 0); 2097 2098 if (IS_ERR(ch->cq)) { ··· 2116 2115 ch->qp = ib_create_qp(sdev->pd, qp_init); 2117 2116 if (IS_ERR(ch->qp)) { 2118 2117 ret = PTR_ERR(ch->qp); 2118 + if (ret == -ENOMEM) { 2119 + srp_sq_size /= 2; 2120 + if (srp_sq_size >= MIN_SRPT_SQ_SIZE) { 2121 + ib_destroy_cq(ch->cq); 2122 + goto retry; 2123 + } 2124 + } 2119 2125 printk(KERN_ERR "failed to create_qp ret= %d\n", ret); 2120 2126 goto err_destroy_cq; 2121 2127 }
+13 -3
drivers/input/joystick/xpad.c
··· 1179 1179 } 1180 1180 1181 1181 ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; 1182 - usb_fill_bulk_urb(xpad->bulk_out, udev, 1183 - usb_sndbulkpipe(udev, ep_irq_in->bEndpointAddress), 1184 - xpad->bdata, XPAD_PKT_LEN, xpad_bulk_out, xpad); 1182 + if (usb_endpoint_is_bulk_out(ep_irq_in)) { 1183 + usb_fill_bulk_urb(xpad->bulk_out, udev, 1184 + usb_sndbulkpipe(udev, 1185 + ep_irq_in->bEndpointAddress), 1186 + xpad->bdata, XPAD_PKT_LEN, 1187 + xpad_bulk_out, xpad); 1188 + } else { 1189 + usb_fill_int_urb(xpad->bulk_out, udev, 1190 + usb_sndintpipe(udev, 1191 + ep_irq_in->bEndpointAddress), 1192 + xpad->bdata, XPAD_PKT_LEN, 1193 + xpad_bulk_out, xpad, 0); 1194 + } 1185 1195 1186 1196 /* 1187 1197 * Submit the int URB immediately rather than waiting for open
+1
drivers/input/misc/twl4030-pwrbutton.c
··· 85 85 } 86 86 87 87 platform_set_drvdata(pdev, pwr); 88 + device_init_wakeup(&pdev->dev, true); 88 89 89 90 return 0; 90 91 }
+26 -2
drivers/input/mouse/alps.c
··· 1156 1156 { 1157 1157 struct alps_data *priv = psmouse->private; 1158 1158 1159 - if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */ 1159 + /* 1160 + * Check if we are dealing with a bare PS/2 packet, presumably from 1161 + * a device connected to the external PS/2 port. Because bare PS/2 1162 + * protocol does not have enough constant bits to self-synchronize 1163 + * properly we only do this if the device is fully synchronized. 1164 + */ 1165 + if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { 1160 1166 if (psmouse->pktcnt == 3) { 1161 1167 alps_report_bare_ps2_packet(psmouse, psmouse->packet, 1162 1168 true); ··· 1186 1180 } 1187 1181 1188 1182 /* Bytes 2 - pktsize should have 0 in the highest bit */ 1189 - if ((priv->proto_version < ALPS_PROTO_V5) && 1183 + if (priv->proto_version < ALPS_PROTO_V5 && 1190 1184 psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && 1191 1185 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { 1192 1186 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", 1193 1187 psmouse->pktcnt - 1, 1194 1188 psmouse->packet[psmouse->pktcnt - 1]); 1189 + 1190 + if (priv->proto_version == ALPS_PROTO_V3 && 1191 + psmouse->pktcnt == psmouse->pktsize) { 1192 + /* 1193 + * Some Dell boxes, such as Latitude E6440 or E7440 1194 + * with closed lid, quite often smash last byte of 1195 + * otherwise valid packet with 0xff. Given that the 1196 + * next packet is very likely to be valid let's 1197 + * report PSMOUSE_FULL_PACKET but not process data, 1198 + * rather than reporting PSMOUSE_BAD_DATA and 1199 + * filling the logs. 1200 + */ 1201 + return PSMOUSE_FULL_PACKET; 1202 + } 1203 + 1195 1204 return PSMOUSE_BAD_DATA; 1196 1205 } 1197 1206 ··· 2409 2388 2410 2389 /* We are having trouble resyncing ALPS touchpads so disable it for now */ 2411 2390 psmouse->resync_time = 0; 2391 + 2392 + /* Allow 2 invalid packets without resetting device */ 2393 + psmouse->resetafter = psmouse->pktsize * 2; 2412 2394 2413 2395 return 0; 2414 2396
+53 -11
drivers/input/mouse/elantech.c
··· 428 428 int x, y; 429 429 u32 t; 430 430 431 - if (dev_WARN_ONCE(&psmouse->ps2dev.serio->dev, 432 - !tp_dev, 433 - psmouse_fmt("Unexpected trackpoint message\n"))) { 434 - if (etd->debug == 1) 435 - elantech_packet_dump(psmouse); 436 - return; 437 - } 438 - 439 431 t = get_unaligned_le32(&packet[0]); 440 432 441 433 switch (t & ~7U) { ··· 555 563 } else { 556 564 input_report_key(dev, BTN_LEFT, packet[0] & 0x01); 557 565 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); 566 + input_report_key(dev, BTN_MIDDLE, packet[0] & 0x04); 558 567 } 559 568 560 569 input_mt_report_pointer_emulation(dev, true); ··· 785 792 unsigned char packet_type = packet[3] & 0x03; 786 793 bool sanity_check; 787 794 795 + if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) 796 + return PACKET_TRACKPOINT; 797 + 788 798 /* 789 799 * Sanity check based on the constant bits of a packet. 790 800 * The constant bits change depending on the value of ··· 873 877 874 878 case 4: 875 879 packet_type = elantech_packet_check_v4(psmouse); 876 - if (packet_type == PACKET_UNKNOWN) 880 + switch (packet_type) { 881 + case PACKET_UNKNOWN: 877 882 return PSMOUSE_BAD_DATA; 878 883 879 - elantech_report_absolute_v4(psmouse, packet_type); 884 + case PACKET_TRACKPOINT: 885 + elantech_report_trackpoint(psmouse, packet_type); 886 + break; 887 + 888 + default: 889 + elantech_report_absolute_v4(psmouse, packet_type); 890 + break; 891 + } 892 + 880 893 break; 881 894 } 882 895 ··· 1125 1120 } 1126 1121 1127 1122 /* 1123 + * Some hw_version 4 models do have a middle button 1124 + */ 1125 + static const struct dmi_system_id elantech_dmi_has_middle_button[] = { 1126 + #if defined(CONFIG_DMI) && defined(CONFIG_X86) 1127 + { 1128 + /* Fujitsu H730 has a middle button */ 1129 + .matches = { 1130 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 1131 + DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"), 1132 + }, 1133 + }, 1134 + #endif 1135 + { } 1136 + }; 1137 + 1138 + /* 1128 1139 * Set the appropriate event bits for the input subsystem 1129 1140 */ 1130 1141 static int elantech_set_input_params(struct psmouse *psmouse) ··· 1159 1138 __clear_bit(EV_REL, dev->evbit); 1160 1139 1161 1140 __set_bit(BTN_LEFT, dev->keybit); 1141 + if (dmi_check_system(elantech_dmi_has_middle_button)) 1142 + __set_bit(BTN_MIDDLE, dev->keybit); 1162 1143 __set_bit(BTN_RIGHT, dev->keybit); 1163 1144 1164 1145 __set_bit(BTN_TOUCH, dev->keybit); ··· 1322 1299 ELANTECH_INT_ATTR(reg_26, 0x26); 1323 1300 ELANTECH_INT_ATTR(debug, 0); 1324 1301 ELANTECH_INT_ATTR(paritycheck, 0); 1302 + ELANTECH_INT_ATTR(crc_enabled, 0); 1325 1303 1326 1304 static struct attribute *elantech_attrs[] = { 1327 1305 &psmouse_attr_reg_07.dattr.attr, ··· 1337 1313 &psmouse_attr_reg_26.dattr.attr, 1338 1314 &psmouse_attr_debug.dattr.attr, 1339 1315 &psmouse_attr_paritycheck.dattr.attr, 1316 + &psmouse_attr_crc_enabled.dattr.attr, 1340 1317 NULL 1341 1318 }; 1342 1319 ··· 1464 1439 } 1465 1440 1466 1441 /* 1442 + * Some hw_version 4 models do not work with crc_disabled 1443 + */ 1444 + static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { 1445 + #if defined(CONFIG_DMI) && defined(CONFIG_X86) 1446 + { 1447 + /* Fujitsu H730 does not work with crc_enabled == 0 */ 1448 + .matches = { 1449 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 1450 + DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"), 1451 + }, 1452 + }, 1453 + #endif 1454 + { } 1455 + }; 1456 + 1457 + /* 1467 1458 * Some hw_version 3 models go into error state when we try to set 1468 1459 * bit 3 and/or bit 1 of r10. 1469 1460 */ ··· 1554 1513 * The signatures of v3 and v4 packets change depending on the 1555 1514 * value of this hardware flag. 1556 1515 */ 1557 - etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000); 1516 + etd->crc_enabled = (etd->fw_version & 0x4000) == 0x4000 || 1517 + dmi_check_system(elantech_dmi_force_crc_enabled); 1558 1518 1559 1519 /* Enable real hardware resolution on hw_version 3 ? */ 1560 1520 etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table);
+7 -2
drivers/input/mouse/synaptics.c
··· 135 135 1232, 5710, 1156, 4696 136 136 }, 137 137 { 138 - (const char * const []){"LEN0034", "LEN0036", "LEN2002", 139 - "LEN2004", NULL}, 138 + (const char * const []){"LEN0034", "LEN0036", "LEN0039", 139 + "LEN2002", "LEN2004", NULL}, 140 140 1024, 5112, 2024, 4832 141 141 }, 142 142 { 143 143 (const char * const []){"LEN2001", NULL}, 144 144 1024, 5022, 2508, 4832 145 + }, 146 + { 147 + (const char * const []){"LEN2006", NULL}, 148 + 1264, 5675, 1171, 4688 145 149 }, 146 150 { } 147 151 }; ··· 167 163 "LEN0036", /* T440 */ 168 164 "LEN0037", 169 165 "LEN0038", 166 + "LEN0039", /* T440s */ 170 167 "LEN0041", 171 168 "LEN0042", /* Yoga */ 172 169 "LEN0045",
+3 -3
drivers/irqchip/irq-atmel-aic-common.c
··· 217 217 } 218 218 219 219 ret = irq_alloc_domain_generic_chips(domain, 32, 1, name, 220 - handle_level_irq, 0, 0, 221 - IRQCHIP_SKIP_SET_WAKE); 220 + handle_fasteoi_irq, 221 + IRQ_NOREQUEST | IRQ_NOPROBE | 222 + IRQ_NOAUTOEN, 0, 0); 222 223 if (ret) 223 224 goto err_domain_remove; 224 225 ··· 231 230 gc->unused = 0; 232 231 gc->wake_enabled = ~0; 233 232 gc->chip_types[0].type = IRQ_TYPE_SENSE_MASK; 234 - gc->chip_types[0].handler = handle_fasteoi_irq; 235 233 gc->chip_types[0].chip.irq_eoi = irq_gc_eoi; 236 234 gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; 237 235 gc->chip_types[0].chip.irq_shutdown = aic_common_shutdown;
+2 -2
drivers/irqchip/irq-bcm7120-l2.c
··· 101 101 int parent_irq; 102 102 103 103 parent_irq = irq_of_parse_and_map(dn, irq); 104 - if (parent_irq < 0) { 104 + if (!parent_irq) { 105 105 pr_err("failed to map interrupt %d\n", irq); 106 - return parent_irq; 106 + return -EINVAL; 107 107 } 108 108 109 109 data->irq_map_mask |= be32_to_cpup(map_mask + irq);
+2 -2
drivers/irqchip/irq-brcmstb-l2.c
··· 135 135 __raw_writel(0xffffffff, data->base + CPU_CLEAR); 136 136 137 137 data->parent_irq = irq_of_parse_and_map(np, 0); 138 - if (data->parent_irq < 0) { 138 + if (!data->parent_irq) { 139 139 pr_err("failed to find parent interrupt\n"); 140 - ret = data->parent_irq; 140 + ret = -EINVAL; 141 141 goto out_unmap; 142 142 } 143 143
+6 -6
drivers/md/dm-bufio.c
··· 1434 1434 1435 1435 /* 1436 1436 * Test if the buffer is unused and too old, and commit it. 1437 - * At if noio is set, we must not do any I/O because we hold 1438 - * dm_bufio_clients_lock and we would risk deadlock if the I/O gets rerouted to 1439 - * different bufio client. 1437 + * And if GFP_NOFS is used, we must not do any I/O because we hold 1438 + * dm_bufio_clients_lock and we would risk deadlock if the I/O gets 1439 + * rerouted to different bufio client. 1440 1440 */ 1441 1441 static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, 1442 1442 unsigned long max_jiffies) ··· 1444 1444 if (jiffies - b->last_accessed < max_jiffies) 1445 1445 return 0; 1446 1446 1447 - if (!(gfp & __GFP_IO)) { 1447 + if (!(gfp & __GFP_FS)) { 1448 1448 if (test_bit(B_READING, &b->state) || 1449 1449 test_bit(B_WRITING, &b->state) || 1450 1450 test_bit(B_DIRTY, &b->state)) ··· 1486 1486 unsigned long freed; 1487 1487 1488 1488 c = container_of(shrink, struct dm_bufio_client, shrinker); 1489 - if (sc->gfp_mask & __GFP_IO) 1489 + if (sc->gfp_mask & __GFP_FS) 1490 1490 dm_bufio_lock(c); 1491 1491 else if (!dm_bufio_trylock(c)) 1492 1492 return SHRINK_STOP; ··· 1503 1503 unsigned long count; 1504 1504 1505 1505 c = container_of(shrink, struct dm_bufio_client, shrinker); 1506 - if (sc->gfp_mask & __GFP_IO) 1506 + if (sc->gfp_mask & __GFP_FS) 1507 1507 dm_bufio_lock(c); 1508 1508 else if (!dm_bufio_trylock(c)) 1509 1509 return 0;
+12 -5
drivers/md/dm-raid.c
··· 789 789 __le32 layout; 790 790 __le32 stripe_sectors; 791 791 792 - __u8 pad[452]; /* Round struct to 512 bytes. */ 793 - /* Always set to 0 when writing. */ 792 + /* Remainder of a logical block is zero-filled when writing (see super_sync()). */ 794 793 } __packed; 795 794 796 795 static int read_disk_sb(struct md_rdev *rdev, int size) ··· 826 827 test_bit(Faulty, &(rs->dev[i].rdev.flags))) 827 828 failed_devices |= (1ULL << i); 828 829 829 - memset(sb, 0, sizeof(*sb)); 830 + memset(sb + 1, 0, rdev->sb_size - sizeof(*sb)); 830 831 831 832 sb->magic = cpu_to_le32(DM_RAID_MAGIC); 832 833 sb->features = cpu_to_le32(0); /* No features yet */ ··· 861 862 uint64_t events_sb, events_refsb; 862 863 863 864 rdev->sb_start = 0; 864 - rdev->sb_size = sizeof(*sb); 865 + rdev->sb_size = bdev_logical_block_size(rdev->meta_bdev); 866 + if (rdev->sb_size < sizeof(*sb) || rdev->sb_size > PAGE_SIZE) { 867 + DMERR("superblock size of a logical block is no longer valid"); 868 + return -EINVAL; 869 + } 865 870 866 871 ret = read_disk_sb(rdev, rdev->sb_size); 867 872 if (ret) ··· 1172 1169 raid456 = (rs->md.level == 4 || rs->md.level == 5 || rs->md.level == 6); 1173 1170 1174 1171 for (i = 0; i < rs->md.raid_disks; i++) { 1175 - struct request_queue *q = bdev_get_queue(rs->dev[i].rdev.bdev); 1172 + struct request_queue *q; 1176 1173 1174 + if (!rs->dev[i].rdev.bdev) 1175 + continue; 1176 + 1177 + q = bdev_get_queue(rs->dev[i].rdev.bdev); 1177 1178 if (!q || !blk_queue_discard(q)) 1178 1179 return; 1179 1180
+3 -1
drivers/md/dm-stripe.c
··· 159 159 sc->stripes_shift = __ffs(stripes); 160 160 161 161 r = dm_set_target_max_io_len(ti, chunk_size); 162 - if (r) 162 + if (r) { 163 + kfree(sc); 163 164 return r; 165 + } 164 166 165 167 ti->num_flush_bios = stripes; 166 168 ti->num_discard_bios = stripes;
+12 -4
drivers/md/dm-thin.c
··· 1936 1936 return DM_MAPIO_SUBMITTED; 1937 1937 } 1938 1938 1939 + /* 1940 + * We must hold the virtual cell before doing the lookup, otherwise 1941 + * there's a race with discard. 1942 + */ 1943 + build_virtual_key(tc->td, block, &key); 1944 + if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result)) 1945 + return DM_MAPIO_SUBMITTED; 1946 + 1939 1947 r = dm_thin_find_block(td, block, 0, &result); 1940 1948 1941 1949 /* ··· 1967 1959 * shared flag will be set in their case. 1968 1960 */ 1969 1961 thin_defer_bio(tc, bio); 1962 + cell_defer_no_holder_no_free(tc, &cell1); 1970 1963 return DM_MAPIO_SUBMITTED; 1971 1964 } 1972 - 1973 - build_virtual_key(tc->td, block, &key); 1974 - if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result)) 1975 - return DM_MAPIO_SUBMITTED; 1976 1965 1977 1966 build_data_key(tc->td, result.block, &key); 1978 1967 if (dm_bio_detain(tc->pool->prison, &key, bio, &cell2, &cell_result)) { ··· 1991 1986 * of doing so. 1992 1987 */ 1993 1988 handle_unserviceable_bio(tc->pool, bio); 1989 + cell_defer_no_holder_no_free(tc, &cell1); 1994 1990 return DM_MAPIO_SUBMITTED; 1995 1991 } 1996 1992 /* fall through */ ··· 2002 1996 * provide the hint to load the metadata into cache. 2003 1997 */ 2004 1998 thin_defer_bio(tc, bio); 1999 + cell_defer_no_holder_no_free(tc, &cell1); 2005 2000 return DM_MAPIO_SUBMITTED; 2006 2001 2007 2002 default: ··· 2012 2005 * pool is switched to fail-io mode. 2013 2006 */ 2014 2007 bio_io_error(bio); 2008 + cell_defer_no_holder_no_free(tc, &cell1); 2015 2009 return DM_MAPIO_SUBMITTED; 2016 2010 } 2017 2011 }
+4
drivers/md/md.c
··· 5121 5121 printk("md: %s still in use.\n",mdname(mddev)); 5122 5122 if (did_freeze) { 5123 5123 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 5124 + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 5124 5125 md_wakeup_thread(mddev->thread); 5125 5126 } 5126 5127 err = -EBUSY; ··· 5136 5135 mddev->ro = 1; 5137 5136 set_disk_ro(mddev->gendisk, 1); 5138 5137 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 5138 + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 5139 + md_wakeup_thread(mddev->thread); 5139 5140 sysfs_notify_dirent_safe(mddev->sysfs_state); 5140 5141 err = 0; 5141 5142 } ··· 5181 5178 mutex_unlock(&mddev->open_mutex); 5182 5179 if (did_freeze) { 5183 5180 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 5181 + set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 5184 5182 md_wakeup_thread(mddev->thread); 5185 5183 } 5186 5184 return -EBUSY;
+6
drivers/md/persistent-data/dm-btree-internal.h
··· 42 42 } __packed; 43 43 44 44 45 + /* 46 + * Locks a block using the btree node validator. 47 + */ 48 + int bn_read_lock(struct dm_btree_info *info, dm_block_t b, 49 + struct dm_block **result); 50 + 45 51 void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, 46 52 struct dm_btree_value_type *vt); 47 53
+1 -1
drivers/md/persistent-data/dm-btree-spine.c
··· 92 92 93 93 /*----------------------------------------------------------------*/ 94 94 95 - static int bn_read_lock(struct dm_btree_info *info, dm_block_t b, 95 + int bn_read_lock(struct dm_btree_info *info, dm_block_t b, 96 96 struct dm_block **result) 97 97 { 98 98 return dm_tm_read_lock(info->tm, b, &btree_node_validator, result);
+10 -14
drivers/md/persistent-data/dm-btree.c
··· 847 847 * FIXME: We shouldn't use a recursive algorithm when we have limited stack 848 848 * space. Also this only works for single level trees. 849 849 */ 850 - static int walk_node(struct ro_spine *s, dm_block_t block, 850 + static int walk_node(struct dm_btree_info *info, dm_block_t block, 851 851 int (*fn)(void *context, uint64_t *keys, void *leaf), 852 852 void *context) 853 853 { 854 854 int r; 855 855 unsigned i, nr; 856 + struct dm_block *node; 856 857 struct btree_node *n; 857 858 uint64_t keys; 858 859 859 - r = ro_step(s, block); 860 - n = ro_node(s); 860 + r = bn_read_lock(info, block, &node); 861 + if (r) 862 + return r; 863 + 864 + n = dm_block_data(node); 861 865 862 866 nr = le32_to_cpu(n->header.nr_entries); 863 867 for (i = 0; i < nr; i++) { 864 868 if (le32_to_cpu(n->header.flags) & INTERNAL_NODE) { 865 - r = walk_node(s, value64(n, i), fn, context); 869 + r = walk_node(info, value64(n, i), fn, context); 866 870 if (r) 867 871 goto out; 868 872 } else { ··· 878 874 } 879 875 880 876 out: 881 - ro_pop(s); 877 + dm_tm_unlock(info->tm, node); 882 878 return r; 883 879 } 884 880 ··· 886 882 int (*fn)(void *context, uint64_t *keys, void *leaf), 887 883 void *context) 888 884 { 889 - int r; 890 - struct ro_spine spine; 891 - 892 885 BUG_ON(info->levels > 1); 893 - 894 - init_ro_spine(&spine, info); 895 - r = walk_node(&spine, root, fn, context); 896 - exit_ro_spine(&spine); 897 - 898 - return r; 886 + return walk_node(info, root, fn, context); 899 887 } 900 888 EXPORT_SYMBOL_GPL(dm_btree_walk);
+13 -1
drivers/mfd/max77693.c
··· 240 240 goto err_irq_charger; 241 241 } 242 242 243 - ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, 243 + ret = regmap_add_irq_chip(max77693->regmap_muic, max77693->irq, 244 244 IRQF_ONESHOT | IRQF_SHARED | 245 245 IRQF_TRIGGER_FALLING, 0, 246 246 &max77693_muic_irq_chip, ··· 248 248 if (ret) { 249 249 dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); 250 250 goto err_irq_muic; 251 + } 252 + 253 + /* Unmask interrupts from all blocks in interrupt source register */ 254 + ret = regmap_update_bits(max77693->regmap, 255 + MAX77693_PMIC_REG_INTSRC_MASK, 256 + SRC_IRQ_ALL, (unsigned int)~SRC_IRQ_ALL); 257 + if (ret < 0) { 258 + dev_err(max77693->dev, 259 + "Could not unmask interrupts in INTSRC: %d\n", 260 + ret); 261 + goto err_intsrc; 251 262 } 252 263 253 264 pm_runtime_set_active(max77693->dev); ··· 272 261 273 262 err_mfd: 274 263 mfd_remove_devices(max77693->dev); 264 + err_intsrc: 275 265 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); 276 266 err_irq_muic: 277 267 regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
+2
drivers/mfd/rtsx_pcr.c
··· 947 947 mutex_unlock(&pcr->pcr_mutex); 948 948 } 949 949 950 + #ifdef CONFIG_PM 950 951 static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) 951 952 { 952 953 if (pcr->ops->turn_off_led) ··· 962 961 if (pcr->ops->force_power_down) 963 962 pcr->ops->force_power_down(pcr, pm_state); 964 963 } 964 + #endif 965 965 966 966 static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) 967 967 {
+1 -1
drivers/mfd/stmpe.h
··· 269 269 #define STMPE24XX_REG_CHIP_ID 0x80 270 270 #define STMPE24XX_REG_IEGPIOR_LSB 0x18 271 271 #define STMPE24XX_REG_ISGPIOR_MSB 0x19 272 - #define STMPE24XX_REG_GPMR_LSB 0xA5 272 + #define STMPE24XX_REG_GPMR_LSB 0xA4 273 273 #define STMPE24XX_REG_GPSR_LSB 0x85 274 274 #define STMPE24XX_REG_GPCR_LSB 0x88 275 275 #define STMPE24XX_REG_GPDR_LSB 0x8B
+52
drivers/mfd/twl4030-power.c
··· 44 44 #define PWR_DEVSLP BIT(1) 45 45 #define PWR_DEVOFF BIT(0) 46 46 47 + /* Register bits for CFG_P1_TRANSITION (also for P2 and P3) */ 48 + #define STARTON_SWBUG BIT(7) /* Start on watchdog */ 49 + #define STARTON_VBUS BIT(5) /* Start on VBUS */ 50 + #define STARTON_VBAT BIT(4) /* Start on battery insert */ 51 + #define STARTON_RTC BIT(3) /* Start on RTC */ 52 + #define STARTON_USB BIT(2) /* Start on USB host */ 53 + #define STARTON_CHG BIT(1) /* Start on charger */ 54 + #define STARTON_PWON BIT(0) /* Start on PWRON button */ 55 + 47 56 #define SEQ_OFFSYNC (1 << 0) 48 57 49 58 #define PHY_TO_OFF_PM_MASTER(p) (p - 0x36) ··· 615 606 return 0; 616 607 } 617 608 609 + static int twl4030_starton_mask_and_set(u8 bitmask, u8 bitvalues) 610 + { 611 + u8 regs[3] = { TWL4030_PM_MASTER_CFG_P1_TRANSITION, 612 + TWL4030_PM_MASTER_CFG_P2_TRANSITION, 613 + TWL4030_PM_MASTER_CFG_P3_TRANSITION, }; 614 + u8 val; 615 + int i, err; 616 + 617 + err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, 618 + TWL4030_PM_MASTER_PROTECT_KEY); 619 + if (err) 620 + goto relock; 621 + err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 622 + TWL4030_PM_MASTER_KEY_CFG2, 623 + TWL4030_PM_MASTER_PROTECT_KEY); 624 + if (err) 625 + goto relock; 626 + 627 + for (i = 0; i < sizeof(regs); i++) { 628 + err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, 629 + &val, regs[i]); 630 + if (err) 631 + break; 632 + val = (~bitmask & val) | (bitmask & bitvalues); 633 + err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 634 + val, regs[i]); 635 + if (err) 636 + break; 637 + } 638 + 639 + if (err) 640 + pr_err("TWL4030 Register access failed: %i\n", err); 641 + 642 + relock: 643 + return twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, 644 + TWL4030_PM_MASTER_PROTECT_KEY); 645 + } 646 + 618 647 /* 619 648 * In master mode, start the power off sequence. 620 649 * After a successful execution, TWL shuts down the power to the SoC ··· 661 614 void twl4030_power_off(void) 662 615 { 663 616 int err; 617 + 618 + /* Disable start on charger or VBUS as it can break poweroff */ 619 + err = twl4030_starton_mask_and_set(STARTON_VBUS | STARTON_CHG, 0); 620 + if (err) 621 + pr_err("TWL4030 Unable to configure start-up\n"); 664 622 665 623 err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF, 666 624 TWL4030_PM_MASTER_P1_SW_EVENTS);
+3 -2
drivers/mfd/viperboard.c
··· 93 93 version >> 8, version & 0xff, 94 94 vb->usb_dev->bus->busnum, vb->usb_dev->devnum); 95 95 96 - ret = mfd_add_devices(&interface->dev, -1, vprbrd_devs, 97 - ARRAY_SIZE(vprbrd_devs), NULL, 0, NULL); 96 + ret = mfd_add_devices(&interface->dev, PLATFORM_DEVID_AUTO, 97 + vprbrd_devs, ARRAY_SIZE(vprbrd_devs), NULL, 0, 98 + NULL); 98 99 if (ret != 0) { 99 100 dev_err(&interface->dev, "Failed to add mfd devices to core."); 100 101 goto error;
+2 -1
drivers/net/bonding/bond_main.c
··· 2471 2471 bond_slave_state_change(bond); 2472 2472 if (BOND_MODE(bond) == BOND_MODE_XOR) 2473 2473 bond_update_slave_arr(bond, NULL); 2474 - } else if (do_failover) { 2474 + } 2475 + if (do_failover) { 2475 2476 block_netpoll_tx(); 2476 2477 bond_select_active_slave(bond); 2477 2478 unblock_netpoll_tx();
+2 -2
drivers/net/can/dev.c
··· 110 110 long rate; 111 111 u64 v64; 112 112 113 - /* Use CIA recommended sample points */ 113 + /* Use CiA recommended sample points */ 114 114 if (bt->sample_point) { 115 115 sampl_pt = bt->sample_point; 116 116 } else { ··· 382 382 BUG_ON(idx >= priv->echo_skb_max); 383 383 384 384 if (priv->echo_skb[idx]) { 385 - kfree_skb(priv->echo_skb[idx]); 385 + dev_kfree_skb_any(priv->echo_skb[idx]); 386 386 priv->echo_skb[idx] = NULL; 387 387 } 388 388 }
+1
drivers/net/can/m_can/Kconfig
··· 1 1 config CAN_M_CAN 2 + depends on HAS_IOMEM 2 3 tristate "Bosch M_CAN devices" 3 4 ---help--- 4 5 Say Y here if you want to support for Bosch M_CAN controller.
+166 -53
drivers/net/can/m_can/m_can.c
··· 105 105 MRAM_CFG_NUM, 106 106 }; 107 107 108 + /* Fast Bit Timing & Prescaler Register (FBTP) */ 109 + #define FBTR_FBRP_MASK 0x1f 110 + #define FBTR_FBRP_SHIFT 16 111 + #define FBTR_FTSEG1_SHIFT 8 112 + #define FBTR_FTSEG1_MASK (0xf << FBTR_FTSEG1_SHIFT) 113 + #define FBTR_FTSEG2_SHIFT 4 114 + #define FBTR_FTSEG2_MASK (0x7 << FBTR_FTSEG2_SHIFT) 115 + #define FBTR_FSJW_SHIFT 0 116 + #define FBTR_FSJW_MASK 0x3 117 + 108 118 /* Test Register (TEST) */ 109 119 #define TEST_LBCK BIT(4) 110 120 111 121 /* CC Control Register(CCCR) */ 112 - #define CCCR_TEST BIT(7) 113 - #define CCCR_MON BIT(5) 114 - #define CCCR_CCE BIT(1) 115 - #define CCCR_INIT BIT(0) 122 + #define CCCR_TEST BIT(7) 123 + #define CCCR_CMR_MASK 0x3 124 + #define CCCR_CMR_SHIFT 10 125 + #define CCCR_CMR_CANFD 0x1 126 + #define CCCR_CMR_CANFD_BRS 0x2 127 + #define CCCR_CMR_CAN 0x3 128 + #define CCCR_CME_MASK 0x3 129 + #define CCCR_CME_SHIFT 8 130 + #define CCCR_CME_CAN 0 131 + #define CCCR_CME_CANFD 0x1 132 + #define CCCR_CME_CANFD_BRS 0x2 133 + #define CCCR_TEST BIT(7) 134 + #define CCCR_MON BIT(5) 135 + #define CCCR_CCE BIT(1) 136 + #define CCCR_INIT BIT(0) 137 + #define CCCR_CANFD 0x10 116 138 117 139 /* Bit Timing & Prescaler Register (BTP) */ 118 140 #define BTR_BRP_MASK 0x3ff ··· 226 204 227 205 /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ 228 206 #define M_CAN_RXESC_8BYTES 0x0 207 + #define M_CAN_RXESC_64BYTES 0x777 229 208 230 209 /* Tx Buffer Configuration(TXBC) */ 231 210 #define TXBC_NDTB_OFF 16 ··· 234 211 235 212 /* Tx Buffer Element Size Configuration(TXESC) */ 236 213 #define TXESC_TBDS_8BYTES 0x0 214 + #define TXESC_TBDS_64BYTES 0x7 237 215 238 216 /* Tx Event FIFO Con.guration (TXEFC) */ 239 217 #define TXEFC_EFS_OFF 16 ··· 243 219 /* Message RAM Configuration (in bytes) */ 244 220 #define SIDF_ELEMENT_SIZE 4 245 221 #define XIDF_ELEMENT_SIZE 8 246 - #define RXF0_ELEMENT_SIZE 16 247 - #define RXF1_ELEMENT_SIZE 16 222 + #define RXF0_ELEMENT_SIZE 72 223 + #define RXF1_ELEMENT_SIZE 72 248 224 #define RXB_ELEMENT_SIZE 16 249 225 #define TXE_ELEMENT_SIZE 8 250 - #define TXB_ELEMENT_SIZE 16 226 + #define TXB_ELEMENT_SIZE 72 251 227 252 228 /* Message RAM Elements */ 253 229 #define M_CAN_FIFO_ID 0x0 ··· 255 231 #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) 256 232 257 233 /* Rx Buffer Element */ 234 + /* R0 */ 258 235 #define RX_BUF_ESI BIT(31) 259 236 #define RX_BUF_XTD BIT(30) 260 237 #define RX_BUF_RTR BIT(29) 238 + /* R1 */ 239 + #define RX_BUF_ANMF BIT(31) 240 + #define RX_BUF_EDL BIT(21) 241 + #define RX_BUF_BRS BIT(20) 261 242 262 243 /* Tx Buffer Element */ 244 + /* R0 */ 263 245 #define TX_BUF_XTD BIT(30) 264 246 #define TX_BUF_RTR BIT(29) 265 247 ··· 326 296 if (enable) { 327 297 /* enable m_can configuration */ 328 298 m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); 299 + udelay(5); 329 300 /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ 330 301 m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); 331 302 } else { ··· 357 326 m_can_write(priv, M_CAN_ILE, 0x0); 358 327 } 359 328 360 - static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, 361 - u32 rxfs) 329 + static void m_can_read_fifo(struct net_device *dev, u32 rxfs) 362 330 { 331 + struct net_device_stats *stats = &dev->stats; 363 332 struct m_can_priv *priv = netdev_priv(dev); 364 - u32 id, fgi; 333 + struct canfd_frame *cf; 334 + struct sk_buff *skb; 335 + u32 id, fgi, dlc; 336 + int i; 365 337 366 338 /* calculate the fifo get index for where to read data */ 367 339 fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; 340 + dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); 341 + if (dlc & RX_BUF_EDL) 342 + skb = alloc_canfd_skb(dev, &cf); 343 + else 344 + skb = alloc_can_skb(dev, (struct can_frame **)&cf); 345 + if (!skb) { 346 + stats->rx_dropped++; 347 + return; 348 + } 349 + 350 + if (dlc & RX_BUF_EDL) 351 + cf->len = can_dlc2len((dlc >> 16) & 0x0F); 352 + else 353 + cf->len = get_can_dlc((dlc >> 16) & 0x0F); 354 + 368 355 id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); 369 356 if (id & RX_BUF_XTD) 370 357 cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; 371 358 else 372 359 cf->can_id = (id >> 18) & CAN_SFF_MASK; 373 360 374 - if (id & RX_BUF_RTR) { 361 + if (id & RX_BUF_ESI) { 362 + cf->flags |= CANFD_ESI; 363 + netdev_dbg(dev, "ESI Error\n"); 364 + } 365 + 366 + if (!(dlc & RX_BUF_EDL) && (id & RX_BUF_RTR)) { 375 367 cf->can_id |= CAN_RTR_FLAG; 376 368 } else { 377 - id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); 378 - cf->can_dlc = get_can_dlc((id >> 16) & 0x0F); 379 - *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi, 380 - M_CAN_FIFO_DATA(0)); 381 - *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi, 382 - M_CAN_FIFO_DATA(1)); 369 + if (dlc & RX_BUF_BRS) 370 + cf->flags |= CANFD_BRS; 371 + 372 + for (i = 0; i < cf->len; i += 4) 373 + *(u32 *)(cf->data + i) = 374 + m_can_fifo_read(priv, fgi, 375 + M_CAN_FIFO_DATA(i / 4)); 383 376 } 384 377 385 378 /* acknowledge rx fifo 0 */ 386 379 m_can_write(priv, M_CAN_RXF0A, fgi); 380 + 381 + stats->rx_packets++; 382 + stats->rx_bytes += cf->len; 383 + 384 + netif_receive_skb(skb); 387 385 } 388 386 389 387 static int m_can_do_rx_poll(struct net_device *dev, int quota) 390 388 { 391 389 struct m_can_priv *priv = netdev_priv(dev); 392 - struct net_device_stats *stats = &dev->stats; 393 - struct sk_buff *skb; 394 - struct can_frame *frame; 395 390 u32 pkts = 0; 396 391 u32 rxfs; 397 392 ··· 431 374 if (rxfs & RXFS_RFL) 432 375 netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); 433 376 434 - skb = alloc_can_skb(dev, &frame); 435 - if (!skb) { 436 - stats->rx_dropped++; 437 - return pkts; 438 - } 439 - 440 - m_can_read_fifo(dev, frame, rxfs); 441 - 442 - stats->rx_packets++; 443 - stats->rx_bytes += frame->can_dlc; 444 - 445 - netif_receive_skb(skb); 377 + m_can_read_fifo(dev, rxfs); 446 378 447 379 quota--; 448 380 pkts++; ··· 527 481 return 1; 528 482 } 529 483 484 + static int __m_can_get_berr_counter(const struct net_device *dev, 485 + struct can_berr_counter *bec) 486 + { 487 + struct m_can_priv *priv = netdev_priv(dev); 488 + unsigned int ecr; 489 + 490 + ecr = m_can_read(priv, M_CAN_ECR); 491 + bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; 492 + bec->txerr = ecr & ECR_TEC_MASK; 493 + 494 + return 0; 495 + } 496 + 530 497 static int m_can_get_berr_counter(const struct net_device *dev, 531 498 struct can_berr_counter *bec) 532 499 { 533 500 struct m_can_priv *priv = netdev_priv(dev); 534 - unsigned int ecr; 535 501 int err; 536 502 537 503 err = clk_prepare_enable(priv->hclk); ··· 556 498 return err; 557 499 } 558 500 559 - ecr = m_can_read(priv, M_CAN_ECR); 560 - bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; 561 - bec->txerr = ecr & ECR_TEC_MASK; 501 + __m_can_get_berr_counter(dev, bec); 562 502 563 503 clk_disable_unprepare(priv->cclk); 564 504 clk_disable_unprepare(priv->hclk); ··· 600 544 if (unlikely(!skb)) 601 545 return 0; 602 546 603 - m_can_get_berr_counter(dev, &bec); 547 + __m_can_get_berr_counter(dev, &bec); 604 548 605 549 switch (new_state) { 606 550 case CAN_STATE_ERROR_ACTIVE: ··· 652 596 653 597 if ((psr & PSR_EP) && 654 598 (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { 655 - netdev_dbg(dev, "entered error warning state\n"); 599 + netdev_dbg(dev, "entered error passive state\n"); 656 600 work_done += m_can_handle_state_change(dev, 657 601 CAN_STATE_ERROR_PASSIVE); 658 602 } 659 603 660 604 if ((psr & PSR_BO) && 661 605 (priv->can.state != CAN_STATE_BUS_OFF)) { 662 - netdev_dbg(dev, "entered error warning state\n"); 606 + netdev_dbg(dev, "entered error bus off state\n"); 663 607 work_done += m_can_handle_state_change(dev, 664 608 CAN_STATE_BUS_OFF); 665 609 } ··· 671 615 { 672 616 if (irqstatus & IR_WDI) 673 617 netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); 674 - if (irqstatus & IR_BEU) 618 + if (irqstatus & IR_ELO) 675 619 netdev_err(dev, "Error Logging Overflow\n"); 676 620 if (irqstatus & IR_BEU) 677 621 netdev_err(dev, "Bit Error Uncorrected\n"); ··· 789 733 .brp_inc = 1, 790 734 }; 791 735 736 + static const struct can_bittiming_const m_can_data_bittiming_const = { 737 + .name = KBUILD_MODNAME, 738 + .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ 739 + .tseg1_max = 16, 740 + .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ 741 + .tseg2_max = 8, 742 + .sjw_max = 4, 743 + .brp_min = 1, 744 + .brp_max = 32, 745 + .brp_inc = 1, 746 + }; 747 + 792 748 static int m_can_set_bittiming(struct net_device *dev) 793 749 { 794 750 struct m_can_priv *priv = netdev_priv(dev); 795 751 const struct can_bittiming *bt = &priv->can.bittiming; 752 + const struct can_bittiming *dbt = &priv->can.data_bittiming; 796 753 u16 brp, sjw, tseg1, tseg2; 797 754 u32 reg_btp; 798 755 ··· 816 747 reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | 817 748 (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); 818 749 m_can_write(priv, M_CAN_BTP, reg_btp); 819 - netdev_dbg(dev, "setting BTP 0x%x\n", reg_btp); 750 + 751 + if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { 752 + brp = dbt->brp - 1; 753 + sjw = dbt->sjw - 1; 754 + tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1; 755 + tseg2 = dbt->phase_seg2 - 1; 756 + reg_btp = (brp << FBTR_FBRP_SHIFT) | (sjw << FBTR_FSJW_SHIFT) | 757 + (tseg1 << FBTR_FTSEG1_SHIFT) | 758 + (tseg2 << FBTR_FTSEG2_SHIFT); 759 + m_can_write(priv, M_CAN_FBTP, reg_btp); 760 + } 820 761 821 762 return 0; 822 763 } ··· 846 767 847 768 m_can_config_endisable(priv, true); 848 769 849 - /* RX Buffer/FIFO Element Size 8 bytes data field */ 850 - m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_8BYTES); 770 + /* RX Buffer/FIFO Element Size 64 bytes data field */ 771 + m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_64BYTES); 851 772 852 773 /* Accept Non-matching Frames Into FIFO 0 */ 853 774 m_can_write(priv, M_CAN_GFC, 0x0); ··· 856 777 m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | 857 778 priv->mcfg[MRAM_TXB].off); 858 779 859 - /* only support 8 bytes firstly */ 860 - m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_8BYTES); 780 + /* support 64 bytes payload */ 781 + m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_64BYTES); 861 782 862 783 m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | 863 784 priv->mcfg[MRAM_TXE].off); ··· 872 793 RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); 873 794 874 795 cccr = m_can_read(priv, M_CAN_CCCR); 875 - cccr &= ~(CCCR_TEST | CCCR_MON); 796 + cccr &= ~(CCCR_TEST | CCCR_MON | (CCCR_CMR_MASK << CCCR_CMR_SHIFT) | 797 + (CCCR_CME_MASK << CCCR_CME_SHIFT)); 876 798 test = m_can_read(priv, M_CAN_TEST); 877 799 test &= ~TEST_LBCK; 878 800 ··· 884 804 cccr |= CCCR_TEST; 885 805 test |= TEST_LBCK; 886 806 } 807 + 808 + if (priv->can.ctrlmode & CAN_CTRLMODE_FD) 809 + cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT; 887 810 888 811 m_can_write(priv, M_CAN_CCCR, cccr); 889 812 m_can_write(priv, M_CAN_TEST, test); ··· 952 869 953 870 priv->dev = dev; 954 871 priv->can.bittiming_const = &m_can_bittiming_const; 872 + priv->can.data_bittiming_const = &m_can_data_bittiming_const; 955 873 priv->can.do_set_mode = m_can_set_mode; 956 874 priv->can.do_get_berr_counter = m_can_get_berr_counter; 957 875 priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | 958 876 CAN_CTRLMODE_LISTENONLY | 959 - CAN_CTRLMODE_BERR_REPORTING; 877 + CAN_CTRLMODE_BERR_REPORTING | 878 + CAN_CTRLMODE_FD; 960 879 961 880 return dev; 962 881 } ··· 1041 956 struct net_device *dev) 1042 957 { 1043 958 struct m_can_priv *priv = netdev_priv(dev); 1044 - struct can_frame *cf = (struct can_frame *)skb->data; 1045 - u32 id; 959 + struct canfd_frame *cf = (struct canfd_frame *)skb->data; 960 + u32 id, cccr; 961 + int i; 1046 962 1047 963 if (can_dropped_invalid_skb(dev, skb)) 1048 964 return NETDEV_TX_OK; ··· 1062 976 1063 977 /* message ram configuration */ 1064 978 m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); 1065 - m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, cf->can_dlc << 16); 1066 - m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(0), *(u32 *)(cf->data + 0)); 1067 - m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(1), *(u32 *)(cf->data + 4)); 979 + m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16); 980 + 981 + for (i = 0; i < cf->len; i += 4) 982 + m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4), 983 + *(u32 *)(cf->data + i)); 984 + 1068 985 can_put_echo_skb(skb, dev, 0); 986 + 987 + if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { 988 + cccr = m_can_read(priv, M_CAN_CCCR); 989 + cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT); 990 + if (can_is_canfd_skb(skb)) { 991 + if (cf->flags & CANFD_BRS) 992 + cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT; 993 + else 994 + cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT; 995 + } else { 996 + cccr |= CCCR_CMR_CAN << CCCR_CMR_SHIFT; 997 + } 998 + m_can_write(priv, M_CAN_CCCR, cccr); 999 + } 1069 1000 1070 1001 /* enable first TX buffer to start transfer */ 1071 1002 m_can_write(priv, M_CAN_TXBTIE, 0x1); ··· 1095 992 .ndo_open = m_can_open, 1096 993 .ndo_stop = m_can_close, 1097 994 .ndo_start_xmit = m_can_start_xmit, 995 + .ndo_change_mtu = can_change_mtu, 1098 996 }; 1099 997 1100 998 static int register_m_can_dev(struct net_device *dev) ··· 1113 1009 struct resource *res; 1114 1010 void __iomem *addr; 1115 1011 u32 out_val[MRAM_CFG_LEN]; 1116 - int ret; 1012 + int i, start, end, ret; 1117 1013 1118 1014 /* message ram could be shared */ 1119 1015 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); ··· 1163 1059 priv->mcfg[MRAM_RXB].off, priv->mcfg[MRAM_RXB].num, 1164 1060 priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, 1165 1061 priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); 1062 + 1063 + /* initialize the entire Message RAM in use to avoid possible 1064 + * ECC/parity checksum errors when reading an uninitialized buffer 1065 + */ 1066 + start = priv->mcfg[MRAM_SIDF].off; 1067 + end = priv->mcfg[MRAM_TXB].off + 1068 + priv->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE; 1069 + for (i = start; i < end; i += 4) 1070 + writel(0x0, priv->mram_base + i); 1166 1071 1167 1072 return 0; 1168 1073 }
+1
drivers/net/can/rcar_can.c
··· 628 628 .ndo_open = rcar_can_open, 629 629 .ndo_stop = rcar_can_close, 630 630 .ndo_start_xmit = rcar_can_start_xmit, 631 + .ndo_change_mtu = can_change_mtu, 631 632 }; 632 633 633 634 static void rcar_can_rx_pkt(struct rcar_can_priv *priv)
+1 -4
drivers/net/can/sja1000/kvaser_pci.c
··· 214 214 struct net_device *dev; 215 215 struct sja1000_priv *priv; 216 216 struct kvaser_pci *board; 217 - int err, init_step; 217 + int err; 218 218 219 219 dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); 220 220 if (dev == NULL) ··· 235 235 if (channel == 0) { 236 236 board->xilinx_ver = 237 237 ioread8(board->res_addr + XILINX_VERINT) >> 4; 238 - init_step = 2; 239 238 240 239 /* Assert PTADR# - we're in passive mode so the other bits are 241 240 not important */ ··· 262 263 263 264 priv->irq_flags = IRQF_SHARED; 264 265 dev->irq = pdev->irq; 265 - 266 - init_step = 4; 267 266 268 267 dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", 269 268 priv->reg_base, board->conf_addr, dev->irq);
+1 -2
drivers/net/can/usb/ems_usb.c
··· 434 434 if (urb->actual_length > CPC_HEADER_SIZE) { 435 435 struct ems_cpc_msg *msg; 436 436 u8 *ibuf = urb->transfer_buffer; 437 - u8 msg_count, again, start; 437 + u8 msg_count, start; 438 438 439 439 msg_count = ibuf[0] & ~0x80; 440 - again = ibuf[0] & 0x80; 441 440 442 441 start = CPC_HEADER_SIZE; 443 442
+1 -2
drivers/net/can/usb/esd_usb2.c
··· 464 464 { 465 465 struct esd_tx_urb_context *context = urb->context; 466 466 struct esd_usb2_net_priv *priv; 467 - struct esd_usb2 *dev; 468 467 struct net_device *netdev; 469 468 size_t size = sizeof(struct esd_usb2_msg); 470 469 ··· 471 472 472 473 priv = context->priv; 473 474 netdev = priv->netdev; 474 - dev = priv->usb2; 475 475 476 476 /* free up our allocated buffer */ 477 477 usb_free_coherent(urb->dev, size, ··· 1141 1143 } 1142 1144 } 1143 1145 unlink_all_urbs(dev); 1146 + kfree(dev); 1144 1147 } 1145 1148 } 1146 1149
+1
drivers/net/can/usb/gs_usb.c
··· 718 718 .ndo_open = gs_can_open, 719 719 .ndo_stop = gs_can_close, 720 720 .ndo_start_xmit = gs_can_start_xmit, 721 + .ndo_change_mtu = can_change_mtu, 721 722 }; 722 723 723 724 static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf)
+3 -1
drivers/net/can/xilinx_can.c
··· 300 300 static int xcan_chip_start(struct net_device *ndev) 301 301 { 302 302 struct xcan_priv *priv = netdev_priv(ndev); 303 - u32 err, reg_msr, reg_sr_mask; 303 + u32 reg_msr, reg_sr_mask; 304 + int err; 304 305 unsigned long timeout; 305 306 306 307 /* Check if it is in reset mode */ ··· 962 961 .ndo_open = xcan_open, 963 962 .ndo_stop = xcan_close, 964 963 .ndo_start_xmit = xcan_start_xmit, 964 + .ndo_change_mtu = can_change_mtu, 965 965 }; 966 966 967 967 /**
+33 -25
drivers/net/dsa/bcm_sf2.c
··· 377 377 return IRQ_HANDLED; 378 378 } 379 379 380 + static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) 381 + { 382 + unsigned int timeout = 1000; 383 + u32 reg; 384 + 385 + reg = core_readl(priv, CORE_WATCHDOG_CTRL); 386 + reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; 387 + core_writel(priv, reg, CORE_WATCHDOG_CTRL); 388 + 389 + do { 390 + reg = core_readl(priv, CORE_WATCHDOG_CTRL); 391 + if (!(reg & SOFTWARE_RESET)) 392 + break; 393 + 394 + usleep_range(1000, 2000); 395 + } while (timeout-- > 0); 396 + 397 + if (timeout == 0) 398 + return -ETIMEDOUT; 399 + 400 + return 0; 401 + } 402 + 380 403 static int bcm_sf2_sw_setup(struct dsa_switch *ds) 381 404 { 382 405 const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; ··· 427 404 *base = of_iomap(dn, i); 428 405 if (*base == NULL) { 429 406 pr_err("unable to find register: %s\n", reg_names[i]); 430 - return -ENODEV; 407 + ret = -ENOMEM; 408 + goto out_unmap; 431 409 } 432 410 base++; 411 + } 412 + 413 + ret = bcm_sf2_sw_rst(priv); 414 + if (ret) { 415 + pr_err("unable to software reset switch: %d\n", ret); 416 + goto out_unmap; 433 417 } 434 418 435 419 /* Disable all interrupts and request them */ ··· 514 484 out_unmap: 515 485 base = &priv->core; 516 486 for (i = 0; i < BCM_SF2_REGS_NUM; i++) { 517 - iounmap(*base); 487 + if (*base) 488 + iounmap(*base); 518 489 base++; 519 490 } 520 491 return ret; ··· 760 729 dsa_is_cpu_port(ds, port)) 761 730 bcm_sf2_port_disable(ds, port, NULL); 762 731 } 763 - 764 - return 0; 765 - } 766 - 767 - static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) 768 - { 769 - unsigned int timeout = 1000; 770 - u32 reg; 771 - 772 - reg = core_readl(priv, CORE_WATCHDOG_CTRL); 773 - reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; 774 - core_writel(priv, reg, CORE_WATCHDOG_CTRL); 775 - 776 - do { 777 - reg = core_readl(priv, CORE_WATCHDOG_CTRL); 778 - if (!(reg & SOFTWARE_RESET)) 779 - break; 780 - 781 - usleep_range(1000, 2000); 782 - } while (timeout-- > 0); 783 - 784 - if (timeout == 0) 785 - return -ETIMEDOUT; 786 732 787 733 return 0; 788 734 }
+17 -1
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
··· 575 575 xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN); 576 576 } 577 577 578 - static void xgene_enet_reset(struct xgene_enet_pdata *pdata) 578 + bool xgene_ring_mgr_init(struct xgene_enet_pdata *p) 579 + { 580 + if (!ioread32(p->ring_csr_addr + CLKEN_ADDR)) 581 + return false; 582 + 583 + if (ioread32(p->ring_csr_addr + SRST_ADDR)) 584 + return false; 585 + 586 + return true; 587 + } 588 + 589 + static int xgene_enet_reset(struct xgene_enet_pdata *pdata) 579 590 { 580 591 u32 val; 592 + 593 + if (!xgene_ring_mgr_init(pdata)) 594 + return -ENODEV; 581 595 582 596 clk_prepare_enable(pdata->clk); 583 597 clk_disable_unprepare(pdata->clk); ··· 604 590 val |= SCAN_AUTO_INCR; 605 591 MGMT_CLOCK_SEL_SET(&val, 1); 606 592 xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val); 593 + 594 + return 0; 607 595 } 608 596 609 597 static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
+4
drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
··· 104 104 #define BLOCK_ETH_MAC_OFFSET 0x0000 105 105 #define BLOCK_ETH_MAC_CSR_OFFSET 0x2800 106 106 107 + #define CLKEN_ADDR 0xc208 108 + #define SRST_ADDR 0xc200 109 + 107 110 #define MAC_ADDR_REG_OFFSET 0x00 108 111 #define MAC_COMMAND_REG_OFFSET 0x04 109 112 #define MAC_WRITE_REG_OFFSET 0x08 ··· 321 318 322 319 int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata); 323 320 void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata); 321 + bool xgene_ring_mgr_init(struct xgene_enet_pdata *p); 324 322 325 323 extern struct xgene_mac_ops xgene_gmac_ops; 326 324 extern struct xgene_port_ops xgene_gport_ops;
+7 -4
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
··· 639 639 struct device *dev = ndev_to_dev(ndev); 640 640 struct xgene_enet_desc_ring *rx_ring, *tx_ring, *cp_ring; 641 641 struct xgene_enet_desc_ring *buf_pool = NULL; 642 - u8 cpu_bufnum = 0, eth_bufnum = 0; 643 - u8 bp_bufnum = 0x20; 644 - u16 ring_id, ring_num = 0; 642 + u8 cpu_bufnum = 0, eth_bufnum = START_ETH_BUFNUM; 643 + u8 bp_bufnum = START_BP_BUFNUM; 644 + u16 ring_id, ring_num = START_RING_NUM; 645 645 int ret; 646 646 647 647 /* allocate rx descriptor ring */ ··· 852 852 u16 dst_ring_num; 853 853 int ret; 854 854 855 - pdata->port_ops->reset(pdata); 855 + ret = pdata->port_ops->reset(pdata); 856 + if (ret) 857 + return ret; 856 858 857 859 ret = xgene_enet_create_desc_rings(ndev); 858 860 if (ret) { ··· 956 954 957 955 return ret; 958 956 err: 957 + unregister_netdev(ndev); 959 958 free_netdev(ndev); 960 959 return ret; 961 960 }
+4 -1
drivers/net/ethernet/apm/xgene/xgene_enet_main.h
··· 38 38 #define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN) 39 39 #define NUM_PKT_BUF 64 40 40 #define NUM_BUFPOOL 32 41 + #define START_ETH_BUFNUM 2 42 + #define START_BP_BUFNUM 0x22 43 + #define START_RING_NUM 8 41 44 42 45 #define PHY_POLL_LINK_ON (10 * HZ) 43 46 #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5) ··· 86 83 }; 87 84 88 85 struct xgene_port_ops { 89 - void (*reset)(struct xgene_enet_pdata *pdata); 86 + int (*reset)(struct xgene_enet_pdata *pdata); 90 87 void (*cle_bypass)(struct xgene_enet_pdata *pdata, 91 88 u32 dst_ring_num, u16 bufpool_id); 92 89 void (*shutdown)(struct xgene_enet_pdata *pdata);
+6 -1
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
··· 311 311 xgene_sgmac_rxtx(p, TX_EN, false); 312 312 } 313 313 314 - static void xgene_enet_reset(struct xgene_enet_pdata *p) 314 + static int xgene_enet_reset(struct xgene_enet_pdata *p) 315 315 { 316 + if (!xgene_ring_mgr_init(p)) 317 + return -ENODEV; 318 + 316 319 clk_prepare_enable(p->clk); 317 320 clk_disable_unprepare(p->clk); 318 321 clk_prepare_enable(p->clk); 319 322 320 323 xgene_enet_ecc_init(p); 321 324 xgene_enet_config_ring_if_assoc(p); 325 + 326 + return 0; 322 327 } 323 328 324 329 static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p,
+6 -1
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
··· 252 252 xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN); 253 253 } 254 254 255 - static void xgene_enet_reset(struct xgene_enet_pdata *pdata) 255 + static int xgene_enet_reset(struct xgene_enet_pdata *pdata) 256 256 { 257 + if (!xgene_ring_mgr_init(pdata)) 258 + return -ENODEV; 259 + 257 260 clk_prepare_enable(pdata->clk); 258 261 clk_disable_unprepare(pdata->clk); 259 262 clk_prepare_enable(pdata->clk); 260 263 261 264 xgene_enet_ecc_init(pdata); 262 265 xgene_enet_config_ring_if_assoc(pdata); 266 + 267 + return 0; 263 268 } 264 269 265 270 static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata,
+11 -2
drivers/net/ethernet/broadcom/bcmsysport.c
··· 1110 1110 /* We just need one DMA descriptor which is DMA-able, since writing to 1111 1111 * the port will allocate a new descriptor in its internal linked-list 1112 1112 */ 1113 - p = dma_zalloc_coherent(kdev, 1, &ring->desc_dma, GFP_KERNEL); 1113 + p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma, 1114 + GFP_KERNEL); 1114 1115 if (!p) { 1115 1116 netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); 1116 1117 return -ENOMEM; ··· 1175 1174 if (!(reg & TDMA_DISABLED)) 1176 1175 netdev_warn(priv->netdev, "TDMA not stopped!\n"); 1177 1176 1177 + /* ring->cbs is the last part in bcm_sysport_init_tx_ring which could 1178 + * fail, so by checking this pointer we know whether the TX ring was 1179 + * fully initialized or not. 1180 + */ 1181 + if (!ring->cbs) 1182 + return; 1183 + 1178 1184 napi_disable(&ring->napi); 1179 1185 netif_napi_del(&ring->napi); 1180 1186 ··· 1191 1183 ring->cbs = NULL; 1192 1184 1193 1185 if (ring->desc_dma) { 1194 - dma_free_coherent(kdev, 1, ring->desc_cpu, ring->desc_dma); 1186 + dma_free_coherent(kdev, sizeof(struct dma_desc), 1187 + ring->desc_cpu, ring->desc_dma); 1195 1188 ring->desc_dma = 0; 1196 1189 } 1197 1190 ring->size = 0;
+10 -1
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 2140 2140 goto err_irq0; 2141 2141 } 2142 2142 2143 + /* Re-configure the port multiplexer towards the PHY device */ 2144 + bcmgenet_mii_config(priv->dev, false); 2145 + 2146 + phy_connect_direct(dev, priv->phydev, bcmgenet_mii_setup, 2147 + priv->phy_interface); 2148 + 2143 2149 bcmgenet_netif_start(dev); 2144 2150 2145 2151 return 0; ··· 2189 2183 netif_dbg(priv, ifdown, dev, "bcmgenet_close\n"); 2190 2184 2191 2185 bcmgenet_netif_stop(dev); 2186 + 2187 + /* Really kill the PHY state machine and disconnect from it */ 2188 + phy_disconnect(priv->phydev); 2192 2189 2193 2190 /* Disable MAC receive */ 2194 2191 umac_enable_set(priv, CMD_RX_EN, false); ··· 2694 2685 2695 2686 phy_init_hw(priv->phydev); 2696 2687 /* Speed settings must be restored */ 2697 - bcmgenet_mii_config(priv->dev); 2688 + bcmgenet_mii_config(priv->dev, false); 2698 2689 2699 2690 /* disable ethernet MAC while updating its registers */ 2700 2691 umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false);
+2 -1
drivers/net/ethernet/broadcom/genet/bcmgenet.h
··· 617 617 618 618 /* MDIO routines */ 619 619 int bcmgenet_mii_init(struct net_device *dev); 620 - int bcmgenet_mii_config(struct net_device *dev); 620 + int bcmgenet_mii_config(struct net_device *dev, bool init); 621 621 void bcmgenet_mii_exit(struct net_device *dev); 622 622 void bcmgenet_mii_reset(struct net_device *dev); 623 + void bcmgenet_mii_setup(struct net_device *dev); 623 624 624 625 /* Wake-on-LAN routines */ 625 626 void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol);
+5 -4
drivers/net/ethernet/broadcom/genet/bcmmii.c
··· 77 77 /* setup netdev link state when PHY link status change and 78 78 * update UMAC and RGMII block when link up 79 79 */ 80 - static void bcmgenet_mii_setup(struct net_device *dev) 80 + void bcmgenet_mii_setup(struct net_device *dev) 81 81 { 82 82 struct bcmgenet_priv *priv = netdev_priv(dev); 83 83 struct phy_device *phydev = priv->phydev; ··· 211 211 bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL); 212 212 } 213 213 214 - int bcmgenet_mii_config(struct net_device *dev) 214 + int bcmgenet_mii_config(struct net_device *dev, bool init) 215 215 { 216 216 struct bcmgenet_priv *priv = netdev_priv(dev); 217 217 struct phy_device *phydev = priv->phydev; ··· 298 298 return -EINVAL; 299 299 } 300 300 301 - dev_info(kdev, "configuring instance for %s\n", phy_name); 301 + if (init) 302 + dev_info(kdev, "configuring instance for %s\n", phy_name); 302 303 303 304 return 0; 304 305 } ··· 351 350 * PHY speed which is needed for bcmgenet_mii_config() to configure 352 351 * things appropriately. 353 352 */ 354 - ret = bcmgenet_mii_config(dev); 353 + ret = bcmgenet_mii_config(dev, true); 355 354 if (ret) { 356 355 phy_disconnect(priv->phydev); 357 356 return ret;
+2 -1
drivers/net/ethernet/broadcom/tg3.c
··· 8563 8563 if (tnapi->rx_rcb) 8564 8564 memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); 8565 8565 8566 - if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { 8566 + if (tnapi->prodring.rx_std && 8567 + tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { 8567 8568 tg3_free_rings(tp); 8568 8569 return -ENOMEM; 8569 8570 }
+22 -11
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
··· 79 79 app.protocol = dcb->app_priority[i].protocolid; 80 80 81 81 if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { 82 + app.priority = dcb->app_priority[i].user_prio_map; 82 83 app.selector = dcb->app_priority[i].sel_field + 1; 83 - err = dcb_ieee_setapp(dev, &app); 84 + err = dcb_ieee_delapp(dev, &app); 84 85 } else { 85 86 app.selector = !!(dcb->app_priority[i].sel_field); 86 87 err = dcb_setapp(dev, &app); ··· 123 122 case CXGB4_DCB_INPUT_FW_ENABLED: { 124 123 /* we're going to use Firmware DCB */ 125 124 dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; 126 - dcb->supported = CXGB4_DCBX_FW_SUPPORT; 125 + dcb->supported = DCB_CAP_DCBX_LLD_MANAGED; 126 + if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) 127 + dcb->supported |= DCB_CAP_DCBX_VER_IEEE; 128 + else 129 + dcb->supported |= DCB_CAP_DCBX_VER_CEE; 127 130 break; 128 131 } 129 132 ··· 441 436 *up_tc_map = (1 << tc); 442 437 443 438 /* prio_type is link strict */ 444 - *prio_type = 0x2; 439 + if (*pgid != 0xF) 440 + *prio_type = 0x2; 445 441 } 446 442 447 443 static void cxgb4_getpgtccfg_tx(struct net_device *dev, int tc, 448 444 u8 *prio_type, u8 *pgid, u8 *bw_per, 449 445 u8 *up_tc_map) 450 446 { 451 - return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 1); 447 + /* tc 0 is written at MSB position */ 448 + return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per, 449 + up_tc_map, 1); 452 450 } 453 451 454 452 ··· 459 451 u8 *prio_type, u8 *pgid, u8 *bw_per, 460 452 u8 *up_tc_map) 461 453 { 462 - return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 0); 454 + /* tc 0 is written at MSB position */ 455 + return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per, 456 + up_tc_map, 0); 463 457 } 464 458 465 459 static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, ··· 471 461 struct fw_port_cmd pcmd; 472 462 struct port_info *pi = netdev2pinfo(dev); 473 463 struct adapter *adap = pi->adapter; 464 + int fw_tc = 7 - tc; 474 465 u32 _pgid; 475 466 int err; 476 467 ··· 490 479 } 491 480 492 481 _pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); 493 - _pgid &= ~(0xF << (tc * 4)); 494 - _pgid |= pgid << (tc * 4); 482 + _pgid &= ~(0xF << (fw_tc * 4)); 483 + _pgid |= pgid << (fw_tc * 4); 495 484 pcmd.u.dcb.pgid.pgid = cpu_to_be32(_pgid); 496 485 497 486 INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); ··· 604 593 priority >= CXGB4_MAX_PRIORITY) 605 594 *pfccfg = 0; 606 595 else 607 - *pfccfg = (pi->dcb.pfcen >> priority) & 1; 596 + *pfccfg = (pi->dcb.pfcen >> (7 - priority)) & 1; 608 597 } 609 598 610 599 /* Enable/disable Priority Pause Frames for the specified Traffic Class ··· 629 618 pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen; 630 619 631 620 if (pfccfg) 632 - pcmd.u.dcb.pfc.pfcen |= (1 << priority); 621 + pcmd.u.dcb.pfc.pfcen |= (1 << (7 - priority)); 633 622 else 634 - pcmd.u.dcb.pfc.pfcen &= (~(1 << priority)); 623 + pcmd.u.dcb.pfc.pfcen &= (~(1 << (7 - priority))); 635 624 636 625 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); 637 626 if (err != FW_PORT_DCB_CFG_SUCCESS) { ··· 1082 1071 pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); 1083 1072 1084 1073 for (i = 0; i < CXGB4_MAX_PRIORITY; i++) 1085 - pg->prio_pg[i] = (pgid >> (i * 4)) & 0xF; 1074 + pg->prio_pg[7 - i] = (pgid >> (i * 4)) & 0xF; 1086 1075 1087 1076 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); 1088 1077 pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE;
+27 -3
drivers/net/ethernet/chelsio/cxgb4/sge.c
··· 2914 2914 int t4_sge_init(struct adapter *adap) 2915 2915 { 2916 2916 struct sge *s = &adap->sge; 2917 - u32 sge_control, sge_conm_ctrl; 2917 + u32 sge_control, sge_control2, sge_conm_ctrl; 2918 + unsigned int ingpadboundary, ingpackboundary; 2918 2919 int ret, egress_threshold; 2919 2920 2920 2921 /* ··· 2925 2924 sge_control = t4_read_reg(adap, SGE_CONTROL); 2926 2925 s->pktshift = PKTSHIFT_GET(sge_control); 2927 2926 s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64; 2928 - s->fl_align = 1 << (INGPADBOUNDARY_GET(sge_control) + 2929 - X_INGPADBOUNDARY_SHIFT); 2927 + 2928 + /* T4 uses a single control field to specify both the PCIe Padding and 2929 + * Packing Boundary. T5 introduced the ability to specify these 2930 + * separately. The actual Ingress Packet Data alignment boundary 2931 + * within Packed Buffer Mode is the maximum of these two 2932 + * specifications. 2933 + */ 2934 + ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_control) + 2935 + X_INGPADBOUNDARY_SHIFT); 2936 + if (is_t4(adap->params.chip)) { 2937 + s->fl_align = ingpadboundary; 2938 + } else { 2939 + /* T5 has a different interpretation of one of the PCIe Packing 2940 + * Boundary values. 2941 + */ 2942 + sge_control2 = t4_read_reg(adap, SGE_CONTROL2_A); 2943 + ingpackboundary = INGPACKBOUNDARY_G(sge_control2); 2944 + if (ingpackboundary == INGPACKBOUNDARY_16B_X) 2945 + ingpackboundary = 16; 2946 + else 2947 + ingpackboundary = 1 << (ingpackboundary + 2948 + INGPACKBOUNDARY_SHIFT_X); 2949 + 2950 + s->fl_align = max(ingpadboundary, ingpackboundary); 2951 + } 2930 2952 2931 2953 if (adap->flags & USING_SOFT_PARAMS) 2932 2954 ret = t4_sge_init_soft(adap);
+45 -6
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
··· 3129 3129 HOSTPAGESIZEPF6(sge_hps) | 3130 3130 HOSTPAGESIZEPF7(sge_hps)); 3131 3131 3132 - t4_set_reg_field(adap, SGE_CONTROL, 3133 - INGPADBOUNDARY_MASK | 3134 - EGRSTATUSPAGESIZE_MASK, 3135 - INGPADBOUNDARY(fl_align_log - 5) | 3136 - EGRSTATUSPAGESIZE(stat_len != 64)); 3137 - 3132 + if (is_t4(adap->params.chip)) { 3133 + t4_set_reg_field(adap, SGE_CONTROL, 3134 + INGPADBOUNDARY_MASK | 3135 + EGRSTATUSPAGESIZE_MASK, 3136 + INGPADBOUNDARY(fl_align_log - 5) | 3137 + EGRSTATUSPAGESIZE(stat_len != 64)); 3138 + } else { 3139 + /* T5 introduced the separation of the Free List Padding and 3140 + * Packing Boundaries. Thus, we can select a smaller Padding 3141 + * Boundary to avoid uselessly chewing up PCIe Link and Memory 3142 + * Bandwidth, and use a Packing Boundary which is large enough 3143 + * to avoid false sharing between CPUs, etc. 3144 + * 3145 + * For the PCI Link, the smaller the Padding Boundary the 3146 + * better. For the Memory Controller, a smaller Padding 3147 + * Boundary is better until we cross under the Memory Line 3148 + * Size (the minimum unit of transfer to/from Memory). If we 3149 + * have a Padding Boundary which is smaller than the Memory 3150 + * Line Size, that'll involve a Read-Modify-Write cycle on the 3151 + * Memory Controller which is never good. For T5 the smallest 3152 + * Padding Boundary which we can select is 32 bytes which is 3153 + * larger than any known Memory Controller Line Size so we'll 3154 + * use that. 3155 + * 3156 + * T5 has a different interpretation of the "0" value for the 3157 + * Packing Boundary. This corresponds to 16 bytes instead of 3158 + * the expected 32 bytes. We never have a Packing Boundary 3159 + * less than 32 bytes so we can't use that special value but 3160 + * on the other hand, if we wanted 32 bytes, the best we can 3161 + * really do is 64 bytes. 3162 + */ 3163 + if (fl_align <= 32) { 3164 + fl_align = 64; 3165 + fl_align_log = 6; 3166 + } 3167 + t4_set_reg_field(adap, SGE_CONTROL, 3168 + INGPADBOUNDARY_MASK | 3169 + EGRSTATUSPAGESIZE_MASK, 3170 + INGPADBOUNDARY(INGPCIEBOUNDARY_32B_X) | 3171 + EGRSTATUSPAGESIZE(stat_len != 64)); 3172 + t4_set_reg_field(adap, SGE_CONTROL2_A, 3173 + INGPACKBOUNDARY_V(INGPACKBOUNDARY_M), 3174 + INGPACKBOUNDARY_V(fl_align_log - 3175 + INGPACKBOUNDARY_SHIFT_X)); 3176 + } 3138 3177 /* 3139 3178 * Adjust various SGE Free List Host Buffer Sizes. 3140 3179 *
+10
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
··· 95 95 #define X_INGPADBOUNDARY_SHIFT 5 96 96 97 97 #define SGE_CONTROL 0x1008 98 + #define SGE_CONTROL2_A 0x1124 98 99 #define DCASYSTYPE 0x00080000U 99 100 #define RXPKTCPLMODE_MASK 0x00040000U 100 101 #define RXPKTCPLMODE_SHIFT 18 ··· 107 106 #define PKTSHIFT_SHIFT 10 108 107 #define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT) 109 108 #define PKTSHIFT_GET(x) (((x) & PKTSHIFT_MASK) >> PKTSHIFT_SHIFT) 109 + #define INGPCIEBOUNDARY_32B_X 0 110 110 #define INGPCIEBOUNDARY_MASK 0x00000380U 111 111 #define INGPCIEBOUNDARY_SHIFT 7 112 112 #define INGPCIEBOUNDARY(x) ((x) << INGPCIEBOUNDARY_SHIFT) ··· 116 114 #define INGPADBOUNDARY(x) ((x) << INGPADBOUNDARY_SHIFT) 117 115 #define INGPADBOUNDARY_GET(x) (((x) & INGPADBOUNDARY_MASK) \ 118 116 >> INGPADBOUNDARY_SHIFT) 117 + #define INGPACKBOUNDARY_16B_X 0 118 + #define INGPACKBOUNDARY_SHIFT_X 5 119 + 120 + #define INGPACKBOUNDARY_S 16 121 + #define INGPACKBOUNDARY_M 0x7U 122 + #define INGPACKBOUNDARY_V(x) ((x) << INGPACKBOUNDARY_S) 123 + #define INGPACKBOUNDARY_G(x) (((x) >> INGPACKBOUNDARY_S) \ 124 + & INGPACKBOUNDARY_M) 119 125 #define EGRPCIEBOUNDARY_MASK 0x0000000eU 120 126 #define EGRPCIEBOUNDARY_SHIFT 1 121 127 #define EGRPCIEBOUNDARY(x) ((x) << EGRPCIEBOUNDARY_SHIFT)
+8
drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
··· 299 299 u16 timer_val[SGE_NTIMERS]; /* interrupt holdoff timer array */ 300 300 u8 counter_val[SGE_NCOUNTERS]; /* interrupt RX threshold array */ 301 301 302 + /* Decoded Adapter Parameters. 303 + */ 304 + u32 fl_pg_order; /* large page allocation size */ 305 + u32 stat_len; /* length of status page at ring end */ 306 + u32 pktshift; /* padding between CPL & packet data */ 307 + u32 fl_align; /* response queue message alignment */ 308 + u32 fl_starve_thres; /* Free List starvation threshold */ 309 + 302 310 /* 303 311 * Reverse maps from Absolute Queue IDs to associated queue pointers. 304 312 * The absolute Queue IDs are in a compact range which start at a
+90 -46
drivers/net/ethernet/chelsio/cxgb4vf/sge.c
··· 51 51 #include "../cxgb4/t4_msg.h" 52 52 53 53 /* 54 - * Decoded Adapter Parameters. 55 - */ 56 - static u32 FL_PG_ORDER; /* large page allocation size */ 57 - static u32 STAT_LEN; /* length of status page at ring end */ 58 - static u32 PKTSHIFT; /* padding between CPL and packet data */ 59 - static u32 FL_ALIGN; /* response queue message alignment */ 60 - 61 - /* 62 54 * Constants ... 63 55 */ 64 56 enum { ··· 92 100 */ 93 101 TX_QCHECK_PERIOD = (HZ / 2), 94 102 MAX_TIMER_TX_RECLAIM = 100, 95 - 96 - /* 97 - * An FL with <= FL_STARVE_THRES buffers is starving and a periodic 98 - * timer will attempt to refill it. 99 - */ 100 - FL_STARVE_THRES = 4, 101 103 102 104 /* 103 105 * Suspend an Ethernet TX queue with fewer available descriptors than ··· 250 264 251 265 /** 252 266 * fl_starving - return whether a Free List is starving. 267 + * @adapter: pointer to the adapter 253 268 * @fl: the Free List 254 269 * 255 270 * Tests specified Free List to see whether the number of buffers 256 271 * available to the hardware has falled below our "starvation" 257 272 * threshold. 258 273 */ 259 - static inline bool fl_starving(const struct sge_fl *fl) 274 + static inline bool fl_starving(const struct adapter *adapter, 275 + const struct sge_fl *fl) 260 276 { 261 - return fl->avail - fl->pend_cred <= FL_STARVE_THRES; 277 + const struct sge *s = &adapter->sge; 278 + 279 + return fl->avail - fl->pend_cred <= s->fl_starve_thres; 262 280 } 263 281 264 282 /** ··· 447 457 448 458 /** 449 459 * get_buf_size - return the size of an RX Free List buffer. 460 + * @adapter: pointer to the associated adapter 450 461 * @sdesc: pointer to the software buffer descriptor 451 462 */ 452 - static inline int get_buf_size(const struct rx_sw_desc *sdesc) 463 + static inline int get_buf_size(const struct adapter *adapter, 464 + const struct rx_sw_desc *sdesc) 453 465 { 454 - return FL_PG_ORDER > 0 && (sdesc->dma_addr & RX_LARGE_BUF) 455 - ? (PAGE_SIZE << FL_PG_ORDER) 456 - : PAGE_SIZE; 466 + const struct sge *s = &adapter->sge; 467 + 468 + return (s->fl_pg_order > 0 && (sdesc->dma_addr & RX_LARGE_BUF) 469 + ? (PAGE_SIZE << s->fl_pg_order) : PAGE_SIZE); 457 470 } 458 471 459 472 /** ··· 476 483 477 484 if (is_buf_mapped(sdesc)) 478 485 dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), 479 - get_buf_size(sdesc), PCI_DMA_FROMDEVICE); 486 + get_buf_size(adapter, sdesc), 487 + PCI_DMA_FROMDEVICE); 480 488 put_page(sdesc->page); 481 489 sdesc->page = NULL; 482 490 if (++fl->cidx == fl->size) ··· 505 511 506 512 if (is_buf_mapped(sdesc)) 507 513 dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), 508 - get_buf_size(sdesc), PCI_DMA_FROMDEVICE); 514 + get_buf_size(adapter, sdesc), 515 + PCI_DMA_FROMDEVICE); 509 516 sdesc->page = NULL; 510 517 if (++fl->cidx == fl->size) 511 518 fl->cidx = 0; ··· 584 589 static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, 585 590 int n, gfp_t gfp) 586 591 { 592 + struct sge *s = &adapter->sge; 587 593 struct page *page; 588 594 dma_addr_t dma_addr; 589 595 unsigned int cred = fl->avail; ··· 604 608 * If we don't support large pages, drop directly into the small page 605 609 * allocation code. 606 610 */ 607 - if (FL_PG_ORDER == 0) 611 + if (s->fl_pg_order == 0) 608 612 goto alloc_small_pages; 609 613 610 614 while (n) { 611 615 page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN, 612 - FL_PG_ORDER); 616 + s->fl_pg_order); 613 617 if (unlikely(!page)) { 614 618 /* 615 619 * We've failed inour attempt to allocate a "large ··· 619 623 fl->large_alloc_failed++; 620 624 break; 621 625 } 622 - poison_buf(page, PAGE_SIZE << FL_PG_ORDER); 626 + poison_buf(page, PAGE_SIZE << s->fl_pg_order); 623 627 624 628 dma_addr = dma_map_page(adapter->pdev_dev, page, 0, 625 - PAGE_SIZE << FL_PG_ORDER, 629 + PAGE_SIZE << s->fl_pg_order, 626 630 PCI_DMA_FROMDEVICE); 627 631 if (unlikely(dma_mapping_error(adapter->pdev_dev, dma_addr))) { 628 632 /* ··· 633 637 * because DMA mapping resources are typically 634 638 * critical resources once they become scarse. 635 639 */ 636 - __free_pages(page, FL_PG_ORDER); 640 + __free_pages(page, s->fl_pg_order); 637 641 goto out; 638 642 } 639 643 dma_addr |= RX_LARGE_BUF; ··· 689 693 fl->pend_cred += cred; 690 694 ring_fl_db(adapter, fl); 691 695 692 - if (unlikely(fl_starving(fl))) { 696 + if (unlikely(fl_starving(adapter, fl))) { 693 697 smp_wmb(); 694 698 set_bit(fl->cntxt_id, adapter->sge.starving_fl); 695 699 } ··· 1464 1468 static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, 1465 1469 const struct cpl_rx_pkt *pkt) 1466 1470 { 1471 + struct adapter *adapter = rxq->rspq.adapter; 1472 + struct sge *s = &adapter->sge; 1467 1473 int ret; 1468 1474 struct sk_buff *skb; 1469 1475 ··· 1476 1478 return; 1477 1479 } 1478 1480 1479 - copy_frags(skb, gl, PKTSHIFT); 1480 - skb->len = gl->tot_len - PKTSHIFT; 1481 + copy_frags(skb, gl, s->pktshift); 1482 + skb->len = gl->tot_len - s->pktshift; 1481 1483 skb->data_len = skb->len; 1482 1484 skb->truesize += skb->data_len; 1483 1485 skb->ip_summed = CHECKSUM_UNNECESSARY; ··· 1514 1516 bool csum_ok = pkt->csum_calc && !pkt->err_vec && 1515 1517 (rspq->netdev->features & NETIF_F_RXCSUM); 1516 1518 struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); 1519 + struct adapter *adapter = rspq->adapter; 1520 + struct sge *s = &adapter->sge; 1517 1521 1518 1522 /* 1519 1523 * If this is a good TCP packet and we have Generic Receive Offload ··· 1537 1537 rxq->stats.rx_drops++; 1538 1538 return 0; 1539 1539 } 1540 - __skb_pull(skb, PKTSHIFT); 1540 + __skb_pull(skb, s->pktshift); 1541 1541 skb->protocol = eth_type_trans(skb, rspq->netdev); 1542 1542 skb_record_rx_queue(skb, rspq->idx); 1543 1543 rxq->stats.pkts++; ··· 1648 1648 static int process_responses(struct sge_rspq *rspq, int budget) 1649 1649 { 1650 1650 struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); 1651 + struct adapter *adapter = rspq->adapter; 1652 + struct sge *s = &adapter->sge; 1651 1653 int budget_left = budget; 1652 1654 1653 1655 while (likely(budget_left)) { ··· 1699 1697 BUG_ON(frag >= MAX_SKB_FRAGS); 1700 1698 BUG_ON(rxq->fl.avail == 0); 1701 1699 sdesc = &rxq->fl.sdesc[rxq->fl.cidx]; 1702 - bufsz = get_buf_size(sdesc); 1700 + bufsz = get_buf_size(adapter, sdesc); 1703 1701 fp->page = sdesc->page; 1704 1702 fp->offset = rspq->offset; 1705 1703 fp->size = min(bufsz, len); ··· 1728 1726 */ 1729 1727 ret = rspq->handler(rspq, rspq->cur_desc, &gl); 1730 1728 if (likely(ret == 0)) 1731 - rspq->offset += ALIGN(fp->size, FL_ALIGN); 1729 + rspq->offset += ALIGN(fp->size, s->fl_align); 1732 1730 else 1733 1731 restore_rx_bufs(&gl, &rxq->fl, frag); 1734 1732 } else if (likely(rsp_type == RSP_TYPE_CPL)) { ··· 1965 1963 * schedule napi but the FL is no longer starving. 1966 1964 * No biggie. 1967 1965 */ 1968 - if (fl_starving(fl)) { 1966 + if (fl_starving(adapter, fl)) { 1969 1967 struct sge_eth_rxq *rxq; 1970 1968 1971 1969 rxq = container_of(fl, struct sge_eth_rxq, fl); ··· 2049 2047 int intr_dest, 2050 2048 struct sge_fl *fl, rspq_handler_t hnd) 2051 2049 { 2050 + struct sge *s = &adapter->sge; 2052 2051 struct port_info *pi = netdev_priv(dev); 2053 2052 struct fw_iq_cmd cmd, rpl; 2054 2053 int ret, iqandst, flsz = 0; ··· 2120 2117 fl->size = roundup(fl->size, FL_PER_EQ_UNIT); 2121 2118 fl->desc = alloc_ring(adapter->pdev_dev, fl->size, 2122 2119 sizeof(__be64), sizeof(struct rx_sw_desc), 2123 - &fl->addr, &fl->sdesc, STAT_LEN); 2120 + &fl->addr, &fl->sdesc, s->stat_len); 2124 2121 if (!fl->desc) { 2125 2122 ret = -ENOMEM; 2126 2123 goto err; ··· 2132 2129 * free list ring) in Egress Queue Units. 2133 2130 */ 2134 2131 flsz = (fl->size / FL_PER_EQ_UNIT + 2135 - STAT_LEN / EQ_UNIT); 2132 + s->stat_len / EQ_UNIT); 2136 2133 2137 2134 /* 2138 2135 * Fill in all the relevant firmware Ingress Queue Command ··· 2220 2217 struct net_device *dev, struct netdev_queue *devq, 2221 2218 unsigned int iqid) 2222 2219 { 2220 + struct sge *s = &adapter->sge; 2223 2221 int ret, nentries; 2224 2222 struct fw_eq_eth_cmd cmd, rpl; 2225 2223 struct port_info *pi = netdev_priv(dev); ··· 2229 2225 * Calculate the size of the hardware TX Queue (including the Status 2230 2226 * Page on the end of the TX Queue) in units of TX Descriptors. 2231 2227 */ 2232 - nentries = txq->q.size + STAT_LEN / sizeof(struct tx_desc); 2228 + nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc); 2233 2229 2234 2230 /* 2235 2231 * Allocate the hardware ring for the TX ring (with space for its ··· 2238 2234 txq->q.desc = alloc_ring(adapter->pdev_dev, txq->q.size, 2239 2235 sizeof(struct tx_desc), 2240 2236 sizeof(struct tx_sw_desc), 2241 - &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN); 2237 + &txq->q.phys_addr, &txq->q.sdesc, s->stat_len); 2242 2238 if (!txq->q.desc) 2243 2239 return -ENOMEM; 2244 2240 ··· 2311 2307 */ 2312 2308 static void free_txq(struct adapter *adapter, struct sge_txq *tq) 2313 2309 { 2310 + struct sge *s = &adapter->sge; 2311 + 2314 2312 dma_free_coherent(adapter->pdev_dev, 2315 - tq->size * sizeof(*tq->desc) + STAT_LEN, 2313 + tq->size * sizeof(*tq->desc) + s->stat_len, 2316 2314 tq->desc, tq->phys_addr); 2317 2315 tq->cntxt_id = 0; 2318 2316 tq->sdesc = NULL; ··· 2328 2322 static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq, 2329 2323 struct sge_fl *fl) 2330 2324 { 2325 + struct sge *s = &adapter->sge; 2331 2326 unsigned int flid = fl ? fl->cntxt_id : 0xffff; 2332 2327 2333 2328 t4vf_iq_free(adapter, FW_IQ_TYPE_FL_INT_CAP, ··· 2344 2337 if (fl) { 2345 2338 free_rx_bufs(adapter, fl, fl->avail); 2346 2339 dma_free_coherent(adapter->pdev_dev, 2347 - fl->size * sizeof(*fl->desc) + STAT_LEN, 2340 + fl->size * sizeof(*fl->desc) + s->stat_len, 2348 2341 fl->desc, fl->addr); 2349 2342 kfree(fl->sdesc); 2350 2343 fl->sdesc = NULL; ··· 2430 2423 u32 fl0 = sge_params->sge_fl_buffer_size[0]; 2431 2424 u32 fl1 = sge_params->sge_fl_buffer_size[1]; 2432 2425 struct sge *s = &adapter->sge; 2426 + unsigned int ingpadboundary, ingpackboundary; 2433 2427 2434 2428 /* 2435 2429 * Start by vetting the basic SGE parameters which have been set up by ··· 2451 2443 * Now translate the adapter parameters into our internal forms. 2452 2444 */ 2453 2445 if (fl1) 2454 - FL_PG_ORDER = ilog2(fl1) - PAGE_SHIFT; 2455 - STAT_LEN = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK) 2456 - ? 128 : 64); 2457 - PKTSHIFT = PKTSHIFT_GET(sge_params->sge_control); 2458 - FL_ALIGN = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) + 2459 - SGE_INGPADBOUNDARY_SHIFT); 2446 + s->fl_pg_order = ilog2(fl1) - PAGE_SHIFT; 2447 + s->stat_len = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK) 2448 + ? 128 : 64); 2449 + s->pktshift = PKTSHIFT_GET(sge_params->sge_control); 2450 + 2451 + /* T4 uses a single control field to specify both the PCIe Padding and 2452 + * Packing Boundary. T5 introduced the ability to specify these 2453 + * separately. The actual Ingress Packet Data alignment boundary 2454 + * within Packed Buffer Mode is the maximum of these two 2455 + * specifications. (Note that it makes no real practical sense to 2456 + * have the Pading Boudary be larger than the Packing Boundary but you 2457 + * could set the chip up that way and, in fact, legacy T4 code would 2458 + * end doing this because it would initialize the Padding Boundary and 2459 + * leave the Packing Boundary initialized to 0 (16 bytes).) 2460 + */ 2461 + ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) + 2462 + X_INGPADBOUNDARY_SHIFT); 2463 + if (is_t4(adapter->params.chip)) { 2464 + s->fl_align = ingpadboundary; 2465 + } else { 2466 + /* T5 has a different interpretation of one of the PCIe Packing 2467 + * Boundary values. 2468 + */ 2469 + ingpackboundary = INGPACKBOUNDARY_G(sge_params->sge_control2); 2470 + if (ingpackboundary == INGPACKBOUNDARY_16B_X) 2471 + ingpackboundary = 16; 2472 + else 2473 + ingpackboundary = 1 << (ingpackboundary + 2474 + INGPACKBOUNDARY_SHIFT_X); 2475 + 2476 + s->fl_align = max(ingpadboundary, ingpackboundary); 2477 + } 2478 + 2479 + /* A FL with <= fl_starve_thres buffers is starving and a periodic 2480 + * timer will attempt to refill it. This needs to be larger than the 2481 + * SGE's Egress Congestion Threshold. If it isn't, then we can get 2482 + * stuck waiting for new packets while the SGE is waiting for us to 2483 + * give it more Free List entries. (Note that the SGE's Egress 2484 + * Congestion Threshold is in units of 2 Free List pointers.) 2485 + */ 2486 + s->fl_starve_thres 2487 + = EGRTHRESHOLD_GET(sge_params->sge_congestion_control)*2 + 1; 2460 2488 2461 2489 /* 2462 2490 * Set up tasklet timers.
+2
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
··· 134 134 */ 135 135 struct sge_params { 136 136 u32 sge_control; /* padding, boundaries, lengths, etc. */ 137 + u32 sge_control2; /* T5: more of the same */ 137 138 u32 sge_host_page_size; /* RDMA page sizes */ 138 139 u32 sge_queues_per_page; /* RDMA queues/page */ 139 140 u32 sge_user_mode_limits; /* limits for BAR2 user mode accesses */ 140 141 u32 sge_fl_buffer_size[16]; /* free list buffer sizes */ 141 142 u32 sge_ingress_rx_threshold; /* RX counter interrupt threshold[4] */ 143 + u32 sge_congestion_control; /* congestion thresholds, etc. */ 142 144 u32 sge_timer_value_0_and_1; /* interrupt coalescing timer values */ 143 145 u32 sge_timer_value_2_and_3; 144 146 u32 sge_timer_value_4_and_5;
+27 -1
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
··· 468 468 sge_params->sge_timer_value_2_and_3 = vals[5]; 469 469 sge_params->sge_timer_value_4_and_5 = vals[6]; 470 470 471 + /* T4 uses a single control field to specify both the PCIe Padding and 472 + * Packing Boundary. T5 introduced the ability to specify these 473 + * separately with the Padding Boundary in SGE_CONTROL and and Packing 474 + * Boundary in SGE_CONTROL2. So for T5 and later we need to grab 475 + * SGE_CONTROL in order to determine how ingress packet data will be 476 + * laid out in Packed Buffer Mode. Unfortunately, older versions of 477 + * the firmware won't let us retrieve SGE_CONTROL2 so if we get a 478 + * failure grabbing it we throw an error since we can't figure out the 479 + * right value. 480 + */ 481 + if (!is_t4(adapter->params.chip)) { 482 + params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | 483 + FW_PARAMS_PARAM_XYZ(SGE_CONTROL2_A)); 484 + v = t4vf_query_params(adapter, 1, params, vals); 485 + if (v != FW_SUCCESS) { 486 + dev_err(adapter->pdev_dev, 487 + "Unable to get SGE Control2; " 488 + "probably old firmware.\n"); 489 + return v; 490 + } 491 + sge_params->sge_control2 = vals[0]; 492 + } 493 + 471 494 params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | 472 495 FW_PARAMS_PARAM_XYZ(SGE_INGRESS_RX_THRESHOLD)); 473 - v = t4vf_query_params(adapter, 1, params, vals); 496 + params[1] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | 497 + FW_PARAMS_PARAM_XYZ(SGE_CONM_CTRL)); 498 + v = t4vf_query_params(adapter, 2, params, vals); 474 499 if (v) 475 500 return v; 476 501 sge_params->sge_ingress_rx_threshold = vals[0]; 502 + sge_params->sge_congestion_control = vals[1]; 477 503 478 504 return 0; 479 505 }
+8 -12
drivers/net/ethernet/cisco/enic/enic_main.c
··· 940 940 struct vnic_rq_buf *buf = rq->to_use; 941 941 942 942 if (buf->os_buf) { 943 - buf = buf->next; 944 - rq->to_use = buf; 945 - rq->ring.desc_avail--; 946 - if ((buf->index & VNIC_RQ_RETURN_RATE) == 0) { 947 - /* Adding write memory barrier prevents compiler and/or 948 - * CPU reordering, thus avoiding descriptor posting 949 - * before descriptor is initialized. Otherwise, hardware 950 - * can read stale descriptor fields. 951 - */ 952 - wmb(); 953 - iowrite32(buf->index, &rq->ctrl->posted_index); 954 - } 943 + enic_queue_rq_desc(rq, buf->os_buf, os_buf_index, buf->dma_addr, 944 + buf->len); 955 945 956 946 return 0; 957 947 } ··· 1027 1037 enic->rq_truncated_pkts++; 1028 1038 } 1029 1039 1040 + pci_unmap_single(enic->pdev, buf->dma_addr, buf->len, 1041 + PCI_DMA_FROMDEVICE); 1030 1042 dev_kfree_skb_any(skb); 1043 + buf->os_buf = NULL; 1031 1044 1032 1045 return; 1033 1046 } ··· 1081 1088 /* Buffer overflow 1082 1089 */ 1083 1090 1091 + pci_unmap_single(enic->pdev, buf->dma_addr, buf->len, 1092 + PCI_DMA_FROMDEVICE); 1084 1093 dev_kfree_skb_any(skb); 1094 + buf->os_buf = NULL; 1085 1095 } 1086 1096 } 1087 1097
+11
drivers/net/ethernet/emulex/benet/be_main.c
··· 4309 4309 return -EOPNOTSUPP; 4310 4310 4311 4311 br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); 4312 + if (!br_spec) 4313 + return -EINVAL; 4312 4314 4313 4315 nla_for_each_nested(attr, br_spec, rem) { 4314 4316 if (nla_type(attr) != IFLA_BRIDGE_MODE) 4315 4317 continue; 4318 + 4319 + if (nla_len(attr) < sizeof(mode)) 4320 + return -EINVAL; 4316 4321 4317 4322 mode = nla_get_u16(attr); 4318 4323 if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) ··· 4426 4421 "Disabled VxLAN offloads for UDP port %d\n", 4427 4422 be16_to_cpu(port)); 4428 4423 } 4424 + 4425 + static bool be_gso_check(struct sk_buff *skb, struct net_device *dev) 4426 + { 4427 + return vxlan_gso_check(skb); 4428 + } 4429 4429 #endif 4430 4430 4431 4431 static const struct net_device_ops be_netdev_ops = { ··· 4460 4450 #ifdef CONFIG_BE2NET_VXLAN 4461 4451 .ndo_add_vxlan_port = be_add_vxlan_port, 4462 4452 .ndo_del_vxlan_port = be_del_vxlan_port, 4453 + .ndo_gso_check = be_gso_check, 4463 4454 #endif 4464 4455 }; 4465 4456
+27 -12
drivers/net/ethernet/freescale/fec_main.c
··· 298 298 return bufaddr; 299 299 } 300 300 301 + static void swap_buffer2(void *dst_buf, void *src_buf, int len) 302 + { 303 + int i; 304 + unsigned int *src = src_buf; 305 + unsigned int *dst = dst_buf; 306 + 307 + for (i = 0; i < len; i += 4, src++, dst++) 308 + *dst = swab32p(src); 309 + } 310 + 301 311 static void fec_dump(struct net_device *ndev) 302 312 { 303 313 struct fec_enet_private *fep = netdev_priv(ndev); ··· 1317 1307 } 1318 1308 1319 1309 static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, 1320 - struct bufdesc *bdp, u32 length) 1310 + struct bufdesc *bdp, u32 length, bool swap) 1321 1311 { 1322 1312 struct fec_enet_private *fep = netdev_priv(ndev); 1323 1313 struct sk_buff *new_skb; ··· 1332 1322 dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr, 1333 1323 FEC_ENET_RX_FRSIZE - fep->rx_align, 1334 1324 DMA_FROM_DEVICE); 1335 - memcpy(new_skb->data, (*skb)->data, length); 1325 + if (!swap) 1326 + memcpy(new_skb->data, (*skb)->data, length); 1327 + else 1328 + swap_buffer2(new_skb->data, (*skb)->data, length); 1336 1329 *skb = new_skb; 1337 1330 1338 1331 return true; ··· 1365 1352 u16 vlan_tag; 1366 1353 int index = 0; 1367 1354 bool is_copybreak; 1355 + bool need_swap = id_entry->driver_data & FEC_QUIRK_SWAP_FRAME; 1368 1356 1369 1357 #ifdef CONFIG_M532x 1370 1358 flush_cache_all(); ··· 1429 1415 * include that when passing upstream as it messes up 1430 1416 * bridging applications. 1431 1417 */ 1432 - is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4); 1418 + is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4, 1419 + need_swap); 1433 1420 if (!is_copybreak) { 1434 1421 skb_new = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE); 1435 1422 if (unlikely(!skb_new)) { ··· 1445 1430 prefetch(skb->data - NET_IP_ALIGN); 1446 1431 skb_put(skb, pkt_len - 4); 1447 1432 data = skb->data; 1448 - if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) 1433 + if (!is_copybreak && need_swap) 1449 1434 swap_buffer(data, pkt_len); 1450 1435 1451 1436 /* Extract the enhanced buffer descriptor */ ··· 3358 3343 netif_device_detach(ndev); 3359 3344 netif_tx_unlock_bh(ndev); 3360 3345 fec_stop(ndev); 3346 + fec_enet_clk_enable(ndev, false); 3347 + pinctrl_pm_select_sleep_state(&fep->pdev->dev); 3361 3348 } 3362 3349 rtnl_unlock(); 3363 - 3364 - fec_enet_clk_enable(ndev, false); 3365 - pinctrl_pm_select_sleep_state(&fep->pdev->dev); 3366 3350 3367 3351 if (fep->reg_phy) 3368 3352 regulator_disable(fep->reg_phy); ··· 3381 3367 return ret; 3382 3368 } 3383 3369 3384 - pinctrl_pm_select_default_state(&fep->pdev->dev); 3385 - ret = fec_enet_clk_enable(ndev, true); 3386 - if (ret) 3387 - goto failed_clk; 3388 - 3389 3370 rtnl_lock(); 3390 3371 if (netif_running(ndev)) { 3372 + pinctrl_pm_select_default_state(&fep->pdev->dev); 3373 + ret = fec_enet_clk_enable(ndev, true); 3374 + if (ret) { 3375 + rtnl_unlock(); 3376 + goto failed_clk; 3377 + } 3391 3378 fec_restart(ndev); 3392 3379 netif_tx_lock_bh(ndev); 3393 3380 netif_device_attach(ndev);
+16 -7
drivers/net/ethernet/intel/igb/igb_main.c
··· 1012 1012 /* igb_get_stats64() might access the rings on this vector, 1013 1013 * we must wait a grace period before freeing it. 1014 1014 */ 1015 - kfree_rcu(q_vector, rcu); 1015 + if (q_vector) 1016 + kfree_rcu(q_vector, rcu); 1016 1017 } 1017 1018 1018 1019 /** ··· 1793 1792 adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; 1794 1793 1795 1794 for (i = 0; i < adapter->num_q_vectors; i++) { 1796 - napi_synchronize(&(adapter->q_vector[i]->napi)); 1797 - napi_disable(&(adapter->q_vector[i]->napi)); 1795 + if (adapter->q_vector[i]) { 1796 + napi_synchronize(&adapter->q_vector[i]->napi); 1797 + napi_disable(&adapter->q_vector[i]->napi); 1798 + } 1798 1799 } 1799 1800 1800 1801 ··· 3720 3717 int i; 3721 3718 3722 3719 for (i = 0; i < adapter->num_tx_queues; i++) 3723 - igb_free_tx_resources(adapter->tx_ring[i]); 3720 + if (adapter->tx_ring[i]) 3721 + igb_free_tx_resources(adapter->tx_ring[i]); 3724 3722 } 3725 3723 3726 3724 void igb_unmap_and_free_tx_resource(struct igb_ring *ring, ··· 3786 3782 int i; 3787 3783 3788 3784 for (i = 0; i < adapter->num_tx_queues; i++) 3789 - igb_clean_tx_ring(adapter->tx_ring[i]); 3785 + if (adapter->tx_ring[i]) 3786 + igb_clean_tx_ring(adapter->tx_ring[i]); 3790 3787 } 3791 3788 3792 3789 /** ··· 3824 3819 int i; 3825 3820 3826 3821 for (i = 0; i < adapter->num_rx_queues; i++) 3827 - igb_free_rx_resources(adapter->rx_ring[i]); 3822 + if (adapter->rx_ring[i]) 3823 + igb_free_rx_resources(adapter->rx_ring[i]); 3828 3824 } 3829 3825 3830 3826 /** ··· 3880 3874 int i; 3881 3875 3882 3876 for (i = 0; i < adapter->num_rx_queues; i++) 3883 - igb_clean_rx_ring(adapter->rx_ring[i]); 3877 + if (adapter->rx_ring[i]) 3878 + igb_clean_rx_ring(adapter->rx_ring[i]); 3884 3879 } 3885 3880 3886 3881 /** ··· 7411 7404 pci_restore_state(pdev); 7412 7405 pci_save_state(pdev); 7413 7406 7407 + if (!pci_device_is_present(pdev)) 7408 + return -ENODEV; 7414 7409 err = pci_enable_device_mem(pdev); 7415 7410 if (err) { 7416 7411 dev_err(&pdev->dev,
+13 -4
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 3936 3936 * if SR-IOV and VMDQ are disabled - otherwise ensure 3937 3937 * that hardware VLAN filters remain enabled. 3938 3938 */ 3939 - if (!(adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | 3940 - IXGBE_FLAG_SRIOV_ENABLED))) 3939 + if (adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | 3940 + IXGBE_FLAG_SRIOV_ENABLED)) 3941 3941 vlnctrl |= (IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN); 3942 3942 } else { 3943 3943 if (netdev->flags & IFF_ALLMULTI) { ··· 7669 7669 return -EOPNOTSUPP; 7670 7670 7671 7671 br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); 7672 + if (!br_spec) 7673 + return -EINVAL; 7672 7674 7673 7675 nla_for_each_nested(attr, br_spec, rem) { 7674 7676 __u16 mode; ··· 7678 7676 7679 7677 if (nla_type(attr) != IFLA_BRIDGE_MODE) 7680 7678 continue; 7679 + 7680 + if (nla_len(attr) < sizeof(mode)) 7681 + return -EINVAL; 7681 7682 7682 7683 mode = nla_get_u16(attr); 7683 7684 if (mode == BRIDGE_MODE_VEPA) { ··· 7984 7979 int i, err, pci_using_dac, expected_gts; 7985 7980 unsigned int indices = MAX_TX_QUEUES; 7986 7981 u8 part_str[IXGBE_PBANUM_LENGTH]; 7982 + bool disable_dev = false; 7987 7983 #ifdef IXGBE_FCOE 7988 7984 u16 device_caps; 7989 7985 #endif ··· 8375 8369 iounmap(adapter->io_addr); 8376 8370 kfree(adapter->mac_table); 8377 8371 err_ioremap: 8372 + disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); 8378 8373 free_netdev(netdev); 8379 8374 err_alloc_etherdev: 8380 8375 pci_release_selected_regions(pdev, 8381 8376 pci_select_bars(pdev, IORESOURCE_MEM)); 8382 8377 err_pci_reg: 8383 8378 err_dma: 8384 - if (!adapter || !test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) 8379 + if (!adapter || disable_dev) 8385 8380 pci_disable_device(pdev); 8386 8381 return err; 8387 8382 } ··· 8400 8393 { 8401 8394 struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); 8402 8395 struct net_device *netdev = adapter->netdev; 8396 + bool disable_dev; 8403 8397 8404 8398 ixgbe_dbg_adapter_exit(adapter); 8405 8399 ··· 8450 8442 e_dev_info("complete\n"); 8451 8443 8452 8444 kfree(adapter->mac_table); 8445 + disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); 8453 8446 free_netdev(netdev); 8454 8447 8455 8448 pci_disable_pcie_error_reporting(pdev); 8456 8449 8457 - if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) 8450 + if (disable_dev) 8458 8451 pci_disable_device(pdev); 8459 8452 } 8460 8453
+1 -3
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
··· 635 635 **/ 636 636 s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) 637 637 { 638 - s32 status; 639 638 u16 autoneg_reg = IXGBE_MII_AUTONEG_REG; 640 639 bool autoneg = false; 641 640 ixgbe_link_speed speed; ··· 699 700 700 701 hw->phy.ops.write_reg(hw, MDIO_CTRL1, 701 702 MDIO_MMD_AN, autoneg_reg); 702 - 703 - return status; 703 + return 0; 704 704 } 705 705 706 706 /**
+10 -8
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 1047 1047 int tx_index; 1048 1048 struct tx_desc *desc; 1049 1049 u32 cmd_sts; 1050 - struct sk_buff *skb; 1051 1050 1052 1051 tx_index = txq->tx_used_desc; 1053 1052 desc = &txq->tx_desc_area[tx_index]; ··· 1065 1066 reclaimed++; 1066 1067 txq->tx_desc_count--; 1067 1068 1068 - skb = NULL; 1069 - if (cmd_sts & TX_LAST_DESC) 1070 - skb = __skb_dequeue(&txq->tx_skb); 1069 + if (!IS_TSO_HEADER(txq, desc->buf_ptr)) 1070 + dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, 1071 + desc->byte_cnt, DMA_TO_DEVICE); 1072 + 1073 + if (cmd_sts & TX_ENABLE_INTERRUPT) { 1074 + struct sk_buff *skb = __skb_dequeue(&txq->tx_skb); 1075 + 1076 + if (!WARN_ON(!skb)) 1077 + dev_kfree_skb(skb); 1078 + } 1071 1079 1072 1080 if (cmd_sts & ERROR_SUMMARY) { 1073 1081 netdev_info(mp->dev, "tx error\n"); 1074 1082 mp->dev->stats.tx_errors++; 1075 1083 } 1076 1084 1077 - if (!IS_TSO_HEADER(txq, desc->buf_ptr)) 1078 - dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, 1079 - desc->byte_cnt, DMA_TO_DEVICE); 1080 - dev_kfree_skb(skb); 1081 1085 } 1082 1086 1083 1087 __netif_tx_unlock_bh(nq);
+18 -9
drivers/net/ethernet/marvell/mvpp2.c
··· 1692 1692 { 1693 1693 struct mvpp2_prs_entry *pe; 1694 1694 int tid_aux, tid; 1695 + int ret = 0; 1695 1696 1696 1697 pe = mvpp2_prs_vlan_find(priv, tpid, ai); 1697 1698 ··· 1724 1723 break; 1725 1724 } 1726 1725 1727 - if (tid <= tid_aux) 1728 - return -EINVAL; 1726 + if (tid <= tid_aux) { 1727 + ret = -EINVAL; 1728 + goto error; 1729 + } 1729 1730 1730 1731 memset(pe, 0 , sizeof(struct mvpp2_prs_entry)); 1731 1732 mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); ··· 1759 1756 1760 1757 mvpp2_prs_hw_write(priv, pe); 1761 1758 1759 + error: 1762 1760 kfree(pe); 1763 1761 1764 - return 0; 1762 + return ret; 1765 1763 } 1766 1764 1767 1765 /* Get first free double vlan ai number */ ··· 1825 1821 unsigned int port_map) 1826 1822 { 1827 1823 struct mvpp2_prs_entry *pe; 1828 - int tid_aux, tid, ai; 1824 + int tid_aux, tid, ai, ret = 0; 1829 1825 1830 1826 pe = mvpp2_prs_double_vlan_find(priv, tpid1, tpid2); 1831 1827 ··· 1842 1838 1843 1839 /* Set ai value for new double vlan entry */ 1844 1840 ai = mvpp2_prs_double_vlan_ai_free_get(priv); 1845 - if (ai < 0) 1846 - return ai; 1841 + if (ai < 0) { 1842 + ret = ai; 1843 + goto error; 1844 + } 1847 1845 1848 1846 /* Get first single/triple vlan tid */ 1849 1847 for (tid_aux = MVPP2_PE_FIRST_FREE_TID; ··· 1865 1859 break; 1866 1860 } 1867 1861 1868 - if (tid >= tid_aux) 1869 - return -ERANGE; 1862 + if (tid >= tid_aux) { 1863 + ret = -ERANGE; 1864 + goto error; 1865 + } 1870 1866 1871 1867 memset(pe, 0, sizeof(struct mvpp2_prs_entry)); 1872 1868 mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); ··· 1895 1887 mvpp2_prs_tcam_port_map_set(pe, port_map); 1896 1888 mvpp2_prs_hw_write(priv, pe); 1897 1889 1890 + error: 1898 1891 kfree(pe); 1899 - return 0; 1892 + return ret; 1900 1893 } 1901 1894 1902 1895 /* IPv4 header parsing for fragmentation and L4 offset */
+26 -9
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
··· 1693 1693 mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); 1694 1694 1695 1695 #ifdef CONFIG_MLX4_EN_VXLAN 1696 - if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) 1696 + if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) 1697 1697 vxlan_get_rx_port(dev); 1698 1698 #endif 1699 1699 priv->port_up = true; ··· 2281 2281 ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, 2282 2282 VXLAN_STEER_BY_OUTER_MAC, 1); 2283 2283 out: 2284 - if (ret) 2284 + if (ret) { 2285 2285 en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret); 2286 + return; 2287 + } 2288 + 2289 + /* set offloads */ 2290 + priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | 2291 + NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; 2292 + priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; 2293 + priv->dev->features |= NETIF_F_GSO_UDP_TUNNEL; 2286 2294 } 2287 2295 2288 2296 static void mlx4_en_del_vxlan_offloads(struct work_struct *work) ··· 2298 2290 int ret; 2299 2291 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, 2300 2292 vxlan_del_task); 2293 + /* unset offloads */ 2294 + priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | 2295 + NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL); 2296 + priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL; 2297 + priv->dev->features &= ~NETIF_F_GSO_UDP_TUNNEL; 2301 2298 2302 2299 ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, 2303 2300 VXLAN_STEER_BY_OUTER_MAC, 0); ··· 2355 2342 2356 2343 queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); 2357 2344 } 2345 + 2346 + static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev) 2347 + { 2348 + return vxlan_gso_check(skb); 2349 + } 2358 2350 #endif 2359 2351 2360 2352 static const struct net_device_ops mlx4_netdev_ops = { ··· 2391 2373 #ifdef CONFIG_MLX4_EN_VXLAN 2392 2374 .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, 2393 2375 .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, 2376 + .ndo_gso_check = mlx4_en_gso_check, 2394 2377 #endif 2395 2378 }; 2396 2379 ··· 2422 2403 .ndo_rx_flow_steer = mlx4_en_filter_rfs, 2423 2404 #endif 2424 2405 .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, 2406 + #ifdef CONFIG_MLX4_EN_VXLAN 2407 + .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, 2408 + .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, 2409 + .ndo_gso_check = mlx4_en_gso_check, 2410 + #endif 2425 2411 }; 2426 2412 2427 2413 int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, ··· 2591 2567 2592 2568 if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) 2593 2569 dev->priv_flags |= IFF_UNICAST_FLT; 2594 - 2595 - if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { 2596 - dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | 2597 - NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; 2598 - dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; 2599 - dev->features |= NETIF_F_GSO_UDP_TUNNEL; 2600 - } 2601 2570 2602 2571 mdev->pndev[port] = dev; 2603 2572
+1 -1
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
··· 1546 1546 1547 1547 switch (op) { 1548 1548 case RES_OP_RESERVE: 1549 - count = get_param_l(&in_param); 1549 + count = get_param_l(&in_param) & 0xffffff; 1550 1550 align = get_param_h(&in_param); 1551 1551 err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); 1552 1552 if (err)
+3 -4
drivers/net/ethernet/mellanox/mlx5/core/eq.c
··· 374 374 snprintf(eq->name, MLX5_MAX_EQ_NAME, "%s@pci:%s", 375 375 name, pci_name(dev->pdev)); 376 376 eq->eqn = out.eq_number; 377 + eq->irqn = vecidx; 378 + eq->dev = dev; 379 + eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; 377 380 err = request_irq(table->msix_arr[vecidx].vector, mlx5_msix_handler, 0, 378 381 eq->name, eq); 379 382 if (err) 380 383 goto err_eq; 381 - 382 - eq->irqn = vecidx; 383 - eq->dev = dev; 384 - eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; 385 384 386 385 err = mlx5_debug_eq_add(dev, eq); 387 386 if (err)
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 864 864 dev->profile = &profile[prof_sel]; 865 865 dev->event = mlx5_core_event; 866 866 867 + INIT_LIST_HEAD(&priv->ctx_list); 868 + spin_lock_init(&priv->ctx_lock); 867 869 err = mlx5_dev_init(dev, pdev); 868 870 if (err) { 869 871 dev_err(&pdev->dev, "mlx5_dev_init failed %d\n", err); 870 872 goto out; 871 873 } 872 874 873 - INIT_LIST_HEAD(&priv->ctx_list); 874 - spin_lock_init(&priv->ctx_lock); 875 875 err = mlx5_register_device(dev); 876 876 if (err) { 877 877 dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err);
+2 -1
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
··· 2762 2762 if (test_bit(__NX_RESETTING, &adapter->state)) 2763 2763 goto reschedule; 2764 2764 2765 - if (test_bit(__NX_DEV_UP, &adapter->state)) { 2765 + if (test_bit(__NX_DEV_UP, &adapter->state) && 2766 + !(adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION)) { 2766 2767 if (!adapter->has_link_events) { 2767 2768 2768 2769 netxen_nic_handle_phy_intr(adapter);
+6
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 503 503 504 504 adapter->flags |= QLCNIC_DEL_VXLAN_PORT; 505 505 } 506 + 507 + static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev) 508 + { 509 + return vxlan_gso_check(skb); 510 + } 506 511 #endif 507 512 508 513 static const struct net_device_ops qlcnic_netdev_ops = { ··· 531 526 #ifdef CONFIG_QLCNIC_VXLAN 532 527 .ndo_add_vxlan_port = qlcnic_add_vxlan_port, 533 528 .ndo_del_vxlan_port = qlcnic_del_vxlan_port, 529 + .ndo_gso_check = qlcnic_gso_check, 534 530 #endif 535 531 #ifdef CONFIG_NET_POLL_CONTROLLER 536 532 .ndo_poll_controller = qlcnic_poll_controller,
+1 -2
drivers/net/ethernet/qualcomm/Kconfig
··· 5 5 config NET_VENDOR_QUALCOMM 6 6 bool "Qualcomm devices" 7 7 default y 8 - depends on SPI_MASTER && OF_GPIO 9 8 ---help--- 10 9 If you have a network (Ethernet) card belonging to this class, say Y 11 10 and read the Ethernet-HOWTO, available from ··· 19 20 20 21 config QCA7000 21 22 tristate "Qualcomm Atheros QCA7000 support" 22 - depends on SPI_MASTER && OF_GPIO 23 + depends on SPI_MASTER && OF 23 24 ---help--- 24 25 This SPI protocol driver supports the Qualcomm Atheros QCA7000. 25 26
+2 -1
drivers/net/ethernet/sfc/ef10.c
··· 180 180 EFX_MAX_CHANNELS, 181 181 resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]) / 182 182 (EFX_VI_PAGE_SIZE * EFX_TXQ_TYPES)); 183 - BUG_ON(efx->max_channels == 0); 183 + if (WARN_ON(efx->max_channels == 0)) 184 + return -EIO; 184 185 185 186 nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); 186 187 if (!nic_data)
+12 -8
drivers/net/ethernet/smsc/smc91x.c
··· 2243 2243 const struct of_device_id *match = NULL; 2244 2244 struct smc_local *lp; 2245 2245 struct net_device *ndev; 2246 - struct resource *res, *ires; 2246 + struct resource *res; 2247 2247 unsigned int __iomem *addr; 2248 2248 unsigned long irq_flags = SMC_IRQ_FLAGS; 2249 + unsigned long irq_resflags; 2249 2250 int ret; 2250 2251 2251 2252 ndev = alloc_etherdev(sizeof(struct smc_local)); ··· 2338 2337 goto out_free_netdev; 2339 2338 } 2340 2339 2341 - ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 2342 - if (!ires) { 2340 + ndev->irq = platform_get_irq(pdev, 0); 2341 + if (ndev->irq <= 0) { 2343 2342 ret = -ENODEV; 2344 2343 goto out_release_io; 2345 2344 } 2346 - 2347 - ndev->irq = ires->start; 2348 - 2349 - if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK) 2350 - irq_flags = ires->flags & IRQF_TRIGGER_MASK; 2345 + /* 2346 + * If this platform does not specify any special irqflags, or if 2347 + * the resource supplies a trigger, override the irqflags with 2348 + * the trigger flags from the resource. 2349 + */ 2350 + irq_resflags = irqd_get_trigger_type(irq_get_irq_data(ndev->irq)); 2351 + if (irq_flags == -1 || irq_resflags & IRQF_TRIGGER_MASK) 2352 + irq_flags = irq_resflags & IRQF_TRIGGER_MASK; 2351 2353 2352 2354 ret = smc_request_attrib(pdev, ndev); 2353 2355 if (ret)
+50 -11
drivers/net/ethernet/smsc/smsc911x.c
··· 1342 1342 spin_unlock(&pdata->mac_lock); 1343 1343 } 1344 1344 1345 + static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata) 1346 + { 1347 + int rc = 0; 1348 + 1349 + if (!pdata->phy_dev) 1350 + return rc; 1351 + 1352 + /* If the internal PHY is in General Power-Down mode, all, except the 1353 + * management interface, is powered-down and stays in that condition as 1354 + * long as Phy register bit 0.11 is HIGH. 1355 + * 1356 + * In that case, clear the bit 0.11, so the PHY powers up and we can 1357 + * access to the phy registers. 1358 + */ 1359 + rc = phy_read(pdata->phy_dev, MII_BMCR); 1360 + if (rc < 0) { 1361 + SMSC_WARN(pdata, drv, "Failed reading PHY control reg"); 1362 + return rc; 1363 + } 1364 + 1365 + /* If the PHY general power-down bit is not set is not necessary to 1366 + * disable the general power down-mode. 1367 + */ 1368 + if (rc & BMCR_PDOWN) { 1369 + rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN); 1370 + if (rc < 0) { 1371 + SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); 1372 + return rc; 1373 + } 1374 + 1375 + usleep_range(1000, 1500); 1376 + } 1377 + 1378 + return 0; 1379 + } 1380 + 1345 1381 static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) 1346 1382 { 1347 1383 int rc = 0; ··· 1392 1356 return rc; 1393 1357 } 1394 1358 1395 - /* 1396 - * If energy is detected the PHY is already awake so is not necessary 1397 - * to disable the energy detect power-down mode. 1398 - */ 1399 - if ((rc & MII_LAN83C185_EDPWRDOWN) && 1400 - !(rc & MII_LAN83C185_ENERGYON)) { 1359 + /* Only disable if energy detect mode is already enabled */ 1360 + if (rc & MII_LAN83C185_EDPWRDOWN) { 1401 1361 /* Disable energy detect mode for this SMSC Transceivers */ 1402 1362 rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, 1403 1363 rc & (~MII_LAN83C185_EDPWRDOWN)); ··· 1402 1370 SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); 1403 1371 return rc; 1404 1372 } 1405 - 1406 - mdelay(1); 1373 + /* Allow PHY to wakeup */ 1374 + mdelay(2); 1407 1375 } 1408 1376 1409 1377 return 0; ··· 1425 1393 1426 1394 /* Only enable if energy detect mode is already disabled */ 1427 1395 if (!(rc & MII_LAN83C185_EDPWRDOWN)) { 1428 - mdelay(100); 1429 1396 /* Enable energy detect mode for this SMSC Transceivers */ 1430 1397 rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, 1431 1398 rc | MII_LAN83C185_EDPWRDOWN); ··· 1433 1402 SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); 1434 1403 return rc; 1435 1404 } 1436 - 1437 - mdelay(1); 1438 1405 } 1439 1406 return 0; 1440 1407 } ··· 1442 1413 unsigned int timeout; 1443 1414 unsigned int temp; 1444 1415 int ret; 1416 + 1417 + /* 1418 + * Make sure to power-up the PHY chip before doing a reset, otherwise 1419 + * the reset fails. 1420 + */ 1421 + ret = smsc911x_phy_general_power_up(pdata); 1422 + if (ret) { 1423 + SMSC_WARN(pdata, drv, "Failed to power-up the PHY chip"); 1424 + return ret; 1425 + } 1445 1426 1446 1427 /* 1447 1428 * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that
+29 -23
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 276 276 bool stmmac_eee_init(struct stmmac_priv *priv) 277 277 { 278 278 char *phy_bus_name = priv->plat->phy_bus_name; 279 + unsigned long flags; 279 280 bool ret = false; 280 281 281 282 /* Using PCS we cannot dial with the phy registers at this stage ··· 301 300 * changed). 302 301 * In that case the driver disable own timers. 303 302 */ 303 + spin_lock_irqsave(&priv->lock, flags); 304 304 if (priv->eee_active) { 305 305 pr_debug("stmmac: disable EEE\n"); 306 306 del_timer_sync(&priv->eee_ctrl_timer); ··· 309 307 tx_lpi_timer); 310 308 } 311 309 priv->eee_active = 0; 310 + spin_unlock_irqrestore(&priv->lock, flags); 312 311 goto out; 313 312 } 314 313 /* Activate the EEE and start timers */ 314 + spin_lock_irqsave(&priv->lock, flags); 315 315 if (!priv->eee_active) { 316 316 priv->eee_active = 1; 317 317 init_timer(&priv->eee_ctrl_timer); ··· 329 325 /* Set HW EEE according to the speed */ 330 326 priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); 331 327 332 - pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); 333 - 334 328 ret = true; 329 + spin_unlock_irqrestore(&priv->lock, flags); 330 + 331 + pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); 335 332 } 336 333 out: 337 334 return ret; ··· 765 760 if (new_state && netif_msg_link(priv)) 766 761 phy_print_status(phydev); 767 762 763 + spin_unlock_irqrestore(&priv->lock, flags); 764 + 768 765 /* At this stage, it could be needed to setup the EEE or adjust some 769 766 * MAC related HW registers. 770 767 */ 771 768 priv->eee_enabled = stmmac_eee_init(priv); 772 - 773 - spin_unlock_irqrestore(&priv->lock, flags); 774 769 } 775 770 776 771 /** ··· 964 959 } 965 960 966 961 static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, 967 - int i) 962 + int i, gfp_t flags) 968 963 { 969 964 struct sk_buff *skb; 970 965 971 966 skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, 972 - GFP_KERNEL); 967 + flags); 973 968 if (!skb) { 974 969 pr_err("%s: Rx init fails; skb is NULL\n", __func__); 975 970 return -ENOMEM; ··· 1011 1006 * and allocates the socket buffers. It suppors the chained and ring 1012 1007 * modes. 1013 1008 */ 1014 - static int init_dma_desc_rings(struct net_device *dev) 1009 + static int init_dma_desc_rings(struct net_device *dev, gfp_t flags) 1015 1010 { 1016 1011 int i; 1017 1012 struct stmmac_priv *priv = netdev_priv(dev); ··· 1046 1041 else 1047 1042 p = priv->dma_rx + i; 1048 1043 1049 - ret = stmmac_init_rx_buffers(priv, p, i); 1044 + ret = stmmac_init_rx_buffers(priv, p, i, flags); 1050 1045 if (ret) 1051 1046 goto err_init_rx_buffers; 1052 1047 ··· 1652 1647 struct stmmac_priv *priv = netdev_priv(dev); 1653 1648 int ret; 1654 1649 1655 - ret = init_dma_desc_rings(dev); 1656 - if (ret < 0) { 1657 - pr_err("%s: DMA descriptors initialization failed\n", __func__); 1658 - return ret; 1659 - } 1660 1650 /* DMA initialization and SW reset */ 1661 1651 ret = stmmac_init_dma_engine(priv); 1662 1652 if (ret < 0) { ··· 1705 1705 } 1706 1706 priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; 1707 1707 1708 - priv->eee_enabled = stmmac_eee_init(priv); 1709 - 1710 - stmmac_init_tx_coalesce(priv); 1711 - 1712 1708 if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) { 1713 1709 priv->rx_riwt = MAX_DMA_RIWT; 1714 1710 priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT); ··· 1757 1761 goto dma_desc_error; 1758 1762 } 1759 1763 1764 + ret = init_dma_desc_rings(dev, GFP_KERNEL); 1765 + if (ret < 0) { 1766 + pr_err("%s: DMA descriptors initialization failed\n", __func__); 1767 + goto init_error; 1768 + } 1769 + 1760 1770 ret = stmmac_hw_setup(dev); 1761 1771 if (ret < 0) { 1762 1772 pr_err("%s: Hw setup failed\n", __func__); 1763 1773 goto init_error; 1764 1774 } 1775 + 1776 + stmmac_init_tx_coalesce(priv); 1765 1777 1766 1778 if (priv->phydev) 1767 1779 phy_start(priv->phydev); ··· 1898 1894 unsigned int nopaged_len = skb_headlen(skb); 1899 1895 unsigned int enh_desc = priv->plat->enh_desc; 1900 1896 1897 + spin_lock(&priv->tx_lock); 1898 + 1901 1899 if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { 1900 + spin_unlock(&priv->tx_lock); 1902 1901 if (!netif_queue_stopped(dev)) { 1903 1902 netif_stop_queue(dev); 1904 1903 /* This is a hard error, log it. */ ··· 1909 1902 } 1910 1903 return NETDEV_TX_BUSY; 1911 1904 } 1912 - 1913 - spin_lock(&priv->tx_lock); 1914 1905 1915 1906 if (priv->tx_path_in_lpi_mode) 1916 1907 stmmac_disable_eee_mode(priv); ··· 2030 2025 return NETDEV_TX_OK; 2031 2026 2032 2027 dma_map_err: 2028 + spin_unlock(&priv->tx_lock); 2033 2029 dev_err(priv->device, "Tx dma map failed\n"); 2034 2030 dev_kfree_skb(skb); 2035 2031 priv->dev->stats.tx_dropped++; ··· 2287 2281 { 2288 2282 struct stmmac_priv *priv = netdev_priv(dev); 2289 2283 2290 - spin_lock(&priv->lock); 2291 2284 priv->hw->mac->set_filter(priv->hw, dev); 2292 - spin_unlock(&priv->lock); 2293 2285 } 2294 2286 2295 2287 /** ··· 2954 2950 stmmac_set_mac(priv->ioaddr, false); 2955 2951 pinctrl_pm_select_sleep_state(priv->device); 2956 2952 /* Disable clock in case of PWM is off */ 2957 - clk_disable_unprepare(priv->stmmac_clk); 2953 + clk_disable(priv->stmmac_clk); 2958 2954 } 2959 2955 spin_unlock_irqrestore(&priv->lock, flags); 2960 2956 ··· 2986 2982 } else { 2987 2983 pinctrl_pm_select_default_state(priv->device); 2988 2984 /* enable the clk prevously disabled */ 2989 - clk_prepare_enable(priv->stmmac_clk); 2985 + clk_enable(priv->stmmac_clk); 2990 2986 /* reset the phy so that it's ready */ 2991 2987 if (priv->mii) 2992 2988 stmmac_mdio_reset(priv->mii); ··· 2994 2990 2995 2991 netif_device_attach(ndev); 2996 2992 2993 + init_dma_desc_rings(ndev, GFP_ATOMIC); 2997 2994 stmmac_hw_setup(ndev); 2995 + stmmac_init_tx_coalesce(priv); 2998 2996 2999 2997 napi_enable(&priv->napi); 3000 2998
+7 -6
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 177 177 */ 178 178 plat->maxmtu = JUMBO_LEN; 179 179 180 - /* Set default value for multicast hash bins */ 181 - plat->multicast_filter_bins = HASH_TABLE_SIZE; 182 - 183 - /* Set default value for unicast filter entries */ 184 - plat->unicast_filter_entries = 1; 185 - 186 180 /* 187 181 * Currently only the properties needed on SPEAr600 188 182 * are provided. All other properties should be added ··· 264 270 return PTR_ERR(addr); 265 271 266 272 plat_dat = dev_get_platdata(&pdev->dev); 273 + 274 + /* Set default value for multicast hash bins */ 275 + plat_dat->multicast_filter_bins = HASH_TABLE_SIZE; 276 + 277 + /* Set default value for unicast filter entries */ 278 + plat_dat->unicast_filter_entries = 1; 279 + 267 280 if (pdev->dev.of_node) { 268 281 if (!plat_dat) 269 282 plat_dat = devm_kzalloc(&pdev->dev,
+57 -5
drivers/net/ethernet/sun/sunhme.c
··· 1262 1262 HMD(("init rxring, ")); 1263 1263 for (i = 0; i < RX_RING_SIZE; i++) { 1264 1264 struct sk_buff *skb; 1265 + u32 mapping; 1265 1266 1266 1267 skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); 1267 1268 if (!skb) { ··· 1273 1272 1274 1273 /* Because we reserve afterwards. */ 1275 1274 skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); 1275 + mapping = dma_map_single(hp->dma_dev, skb->data, RX_BUF_ALLOC_SIZE, 1276 + DMA_FROM_DEVICE); 1277 + if (dma_mapping_error(hp->dma_dev, mapping)) { 1278 + dev_kfree_skb_any(skb); 1279 + hme_write_rxd(hp, &hb->happy_meal_rxd[i], 0, 0); 1280 + continue; 1281 + } 1276 1282 hme_write_rxd(hp, &hb->happy_meal_rxd[i], 1277 1283 (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), 1278 - dma_map_single(hp->dma_dev, skb->data, RX_BUF_ALLOC_SIZE, 1279 - DMA_FROM_DEVICE)); 1284 + mapping); 1280 1285 skb_reserve(skb, RX_OFFSET); 1281 1286 } 1282 1287 ··· 2027 2020 skb = hp->rx_skbs[elem]; 2028 2021 if (len > RX_COPY_THRESHOLD) { 2029 2022 struct sk_buff *new_skb; 2023 + u32 mapping; 2030 2024 2031 2025 /* Now refill the entry, if we can. */ 2032 2026 new_skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); ··· 2035 2027 drops++; 2036 2028 goto drop_it; 2037 2029 } 2030 + skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); 2031 + mapping = dma_map_single(hp->dma_dev, new_skb->data, 2032 + RX_BUF_ALLOC_SIZE, 2033 + DMA_FROM_DEVICE); 2034 + if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) { 2035 + dev_kfree_skb_any(new_skb); 2036 + drops++; 2037 + goto drop_it; 2038 + } 2039 + 2038 2040 dma_unmap_single(hp->dma_dev, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROM_DEVICE); 2039 2041 hp->rx_skbs[elem] = new_skb; 2040 - skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); 2041 2042 hme_write_rxd(hp, this, 2042 2043 (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), 2043 - dma_map_single(hp->dma_dev, new_skb->data, RX_BUF_ALLOC_SIZE, 2044 - DMA_FROM_DEVICE)); 2044 + mapping); 2045 2045 skb_reserve(new_skb, RX_OFFSET); 2046 2046 2047 2047 /* Trim the original skb for the netif. */ ··· 2264 2248 netif_wake_queue(dev); 2265 2249 } 2266 2250 2251 + static void unmap_partial_tx_skb(struct happy_meal *hp, u32 first_mapping, 2252 + u32 first_len, u32 first_entry, u32 entry) 2253 + { 2254 + struct happy_meal_txd *txbase = &hp->happy_block->happy_meal_txd[0]; 2255 + 2256 + dma_unmap_single(hp->dma_dev, first_mapping, first_len, DMA_TO_DEVICE); 2257 + 2258 + first_entry = NEXT_TX(first_entry); 2259 + while (first_entry != entry) { 2260 + struct happy_meal_txd *this = &txbase[first_entry]; 2261 + u32 addr, len; 2262 + 2263 + addr = hme_read_desc32(hp, &this->tx_addr); 2264 + len = hme_read_desc32(hp, &this->tx_flags); 2265 + len &= TXFLAG_SIZE; 2266 + dma_unmap_page(hp->dma_dev, addr, len, DMA_TO_DEVICE); 2267 + } 2268 + } 2269 + 2267 2270 static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, 2268 2271 struct net_device *dev) 2269 2272 { ··· 2319 2284 2320 2285 len = skb->len; 2321 2286 mapping = dma_map_single(hp->dma_dev, skb->data, len, DMA_TO_DEVICE); 2287 + if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) 2288 + goto out_dma_error; 2322 2289 tx_flags |= (TXFLAG_SOP | TXFLAG_EOP); 2323 2290 hme_write_txd(hp, &hp->happy_block->happy_meal_txd[entry], 2324 2291 (tx_flags | (len & TXFLAG_SIZE)), ··· 2336 2299 first_len = skb_headlen(skb); 2337 2300 first_mapping = dma_map_single(hp->dma_dev, skb->data, first_len, 2338 2301 DMA_TO_DEVICE); 2302 + if (unlikely(dma_mapping_error(hp->dma_dev, first_mapping))) 2303 + goto out_dma_error; 2339 2304 entry = NEXT_TX(entry); 2340 2305 2341 2306 for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { ··· 2347 2308 len = skb_frag_size(this_frag); 2348 2309 mapping = skb_frag_dma_map(hp->dma_dev, this_frag, 2349 2310 0, len, DMA_TO_DEVICE); 2311 + if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) { 2312 + unmap_partial_tx_skb(hp, first_mapping, first_len, 2313 + first_entry, entry); 2314 + goto out_dma_error; 2315 + } 2350 2316 this_txflags = tx_flags; 2351 2317 if (frag == skb_shinfo(skb)->nr_frags - 1) 2352 2318 this_txflags |= TXFLAG_EOP; ··· 2376 2332 spin_unlock_irq(&hp->happy_lock); 2377 2333 2378 2334 tx_add_log(hp, TXLOG_ACTION_TXMIT, 0); 2335 + return NETDEV_TX_OK; 2336 + 2337 + out_dma_error: 2338 + hp->tx_skbs[hp->tx_new] = NULL; 2339 + spin_unlock_irq(&hp->happy_lock); 2340 + 2341 + dev_kfree_skb_any(skb); 2342 + dev->stats.tx_dropped++; 2379 2343 return NETDEV_TX_OK; 2380 2344 } 2381 2345
+3 -3
drivers/net/ethernet/ti/cpsw.c
··· 129 129 #define CPSW_VLAN_AWARE BIT(1) 130 130 #define CPSW_ALE_VLAN_AWARE 1 131 131 132 - #define CPSW_FIFO_NORMAL_MODE (0 << 15) 133 - #define CPSW_FIFO_DUAL_MAC_MODE (1 << 15) 134 - #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 15) 132 + #define CPSW_FIFO_NORMAL_MODE (0 << 16) 133 + #define CPSW_FIFO_DUAL_MAC_MODE (1 << 16) 134 + #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 16) 135 135 136 136 #define CPSW_INTPACEEN (0x3f << 16) 137 137 #define CPSW_INTPRESCALE_MASK (0x7FF << 0)
-1
drivers/net/ethernet/ti/cpsw_ale.c
··· 785 785 { 786 786 if (!ale) 787 787 return -EINVAL; 788 - cpsw_ale_stop(ale); 789 788 cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); 790 789 kfree(ale); 791 790 return 0;
+1 -1
drivers/net/ethernet/ti/cpts.c
··· 264 264 265 265 switch (ptp_class & PTP_CLASS_PMASK) { 266 266 case PTP_CLASS_IPV4: 267 - offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; 267 + offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; 268 268 break; 269 269 case PTP_CLASS_IPV6: 270 270 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN;
+8 -5
drivers/net/ieee802154/fakehard.c
··· 377 377 378 378 err = wpan_phy_register(phy); 379 379 if (err) 380 - goto out; 380 + goto err_phy_reg; 381 381 382 382 err = register_netdev(dev); 383 - if (err < 0) 384 - goto out; 383 + if (err) 384 + goto err_netdev_reg; 385 385 386 386 dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); 387 387 return 0; 388 388 389 - out: 390 - unregister_netdev(dev); 389 + err_netdev_reg: 390 + wpan_phy_unregister(phy); 391 + err_phy_reg: 392 + free_netdev(dev); 393 + wpan_phy_free(phy); 391 394 return err; 392 395 } 393 396
+2
drivers/net/macvtap.c
··· 629 629 if (skb->ip_summed == CHECKSUM_PARTIAL) { 630 630 vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; 631 631 vnet_hdr->csum_start = skb_checksum_start_offset(skb); 632 + if (vlan_tx_tag_present(skb)) 633 + vnet_hdr->csum_start += VLAN_HLEN; 632 634 vnet_hdr->csum_offset = skb->csum_offset; 633 635 } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { 634 636 vnet_hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID;
+2 -2
drivers/net/phy/dp83640.c
··· 791 791 792 792 switch (type & PTP_CLASS_PMASK) { 793 793 case PTP_CLASS_IPV4: 794 - offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; 794 + offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; 795 795 break; 796 796 case PTP_CLASS_IPV6: 797 797 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; ··· 934 934 935 935 switch (type & PTP_CLASS_PMASK) { 936 936 case PTP_CLASS_IPV4: 937 - offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; 937 + offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; 938 938 break; 939 939 case PTP_CLASS_IPV6: 940 940 offset += ETH_HLEN + IP6_HLEN + UDP_HLEN;
+24 -12
drivers/net/phy/phy.c
··· 352 352 { 353 353 struct mii_ioctl_data *mii_data = if_mii(ifr); 354 354 u16 val = mii_data->val_in; 355 + bool change_autoneg = false; 355 356 356 357 switch (cmd) { 357 358 case SIOCGMIIPHY: ··· 368 367 if (mii_data->phy_id == phydev->addr) { 369 368 switch (mii_data->reg_num) { 370 369 case MII_BMCR: 371 - if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) 370 + if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) { 371 + if (phydev->autoneg == AUTONEG_ENABLE) 372 + change_autoneg = true; 372 373 phydev->autoneg = AUTONEG_DISABLE; 373 - else 374 + if (val & BMCR_FULLDPLX) 375 + phydev->duplex = DUPLEX_FULL; 376 + else 377 + phydev->duplex = DUPLEX_HALF; 378 + if (val & BMCR_SPEED1000) 379 + phydev->speed = SPEED_1000; 380 + else if (val & BMCR_SPEED100) 381 + phydev->speed = SPEED_100; 382 + else phydev->speed = SPEED_10; 383 + } 384 + else { 385 + if (phydev->autoneg == AUTONEG_DISABLE) 386 + change_autoneg = true; 374 387 phydev->autoneg = AUTONEG_ENABLE; 375 - if (!phydev->autoneg && (val & BMCR_FULLDPLX)) 376 - phydev->duplex = DUPLEX_FULL; 377 - else 378 - phydev->duplex = DUPLEX_HALF; 379 - if (!phydev->autoneg && (val & BMCR_SPEED1000)) 380 - phydev->speed = SPEED_1000; 381 - else if (!phydev->autoneg && 382 - (val & BMCR_SPEED100)) 383 - phydev->speed = SPEED_100; 388 + } 384 389 break; 385 390 case MII_ADVERTISE: 386 - phydev->advertising = val; 391 + phydev->advertising = mii_adv_to_ethtool_adv_t(val); 392 + change_autoneg = true; 387 393 break; 388 394 default: 389 395 /* do nothing */ ··· 404 396 if (mii_data->reg_num == MII_BMCR && 405 397 val & BMCR_RESET) 406 398 return phy_init_hw(phydev); 399 + 400 + if (change_autoneg) 401 + return phy_start_aneg(phydev); 402 + 407 403 return 0; 408 404 409 405 case SIOCSHWTSTAMP:
+20 -20
drivers/net/ppp/ppp_generic.c
··· 755 755 756 756 err = get_filter(argp, &code); 757 757 if (err >= 0) { 758 + struct bpf_prog *pass_filter = NULL; 758 759 struct sock_fprog_kern fprog = { 759 760 .len = err, 760 761 .filter = code, 761 762 }; 762 763 763 - ppp_lock(ppp); 764 - if (ppp->pass_filter) { 765 - bpf_prog_destroy(ppp->pass_filter); 766 - ppp->pass_filter = NULL; 764 + err = 0; 765 + if (fprog.filter) 766 + err = bpf_prog_create(&pass_filter, &fprog); 767 + if (!err) { 768 + ppp_lock(ppp); 769 + if (ppp->pass_filter) 770 + bpf_prog_destroy(ppp->pass_filter); 771 + ppp->pass_filter = pass_filter; 772 + ppp_unlock(ppp); 767 773 } 768 - if (fprog.filter != NULL) 769 - err = bpf_prog_create(&ppp->pass_filter, 770 - &fprog); 771 - else 772 - err = 0; 773 774 kfree(code); 774 - ppp_unlock(ppp); 775 775 } 776 776 break; 777 777 } ··· 781 781 782 782 err = get_filter(argp, &code); 783 783 if (err >= 0) { 784 + struct bpf_prog *active_filter = NULL; 784 785 struct sock_fprog_kern fprog = { 785 786 .len = err, 786 787 .filter = code, 787 788 }; 788 789 789 - ppp_lock(ppp); 790 - if (ppp->active_filter) { 791 - bpf_prog_destroy(ppp->active_filter); 792 - ppp->active_filter = NULL; 790 + err = 0; 791 + if (fprog.filter) 792 + err = bpf_prog_create(&active_filter, &fprog); 793 + if (!err) { 794 + ppp_lock(ppp); 795 + if (ppp->active_filter) 796 + bpf_prog_destroy(ppp->active_filter); 797 + ppp->active_filter = active_filter; 798 + ppp_unlock(ppp); 793 799 } 794 - if (fprog.filter != NULL) 795 - err = bpf_prog_create(&ppp->active_filter, 796 - &fprog); 797 - else 798 - err = 0; 799 800 kfree(code); 800 - ppp_unlock(ppp); 801 801 } 802 802 break; 803 803 }
+3 -1
drivers/net/ppp/pptp.c
··· 506 506 int len = sizeof(struct sockaddr_pppox); 507 507 struct sockaddr_pppox sp; 508 508 509 - sp.sa_family = AF_PPPOX; 509 + memset(&sp.sa_addr, 0, sizeof(sp.sa_addr)); 510 + 511 + sp.sa_family = AF_PPPOX; 510 512 sp.sa_protocol = PX_PROTO_PPTP; 511 513 sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; 512 514
+17 -11
drivers/net/tun.c
··· 1235 1235 struct tun_pi pi = { 0, skb->protocol }; 1236 1236 ssize_t total = 0; 1237 1237 int vlan_offset = 0, copied; 1238 + int vlan_hlen = 0; 1239 + int vnet_hdr_sz = 0; 1240 + 1241 + if (vlan_tx_tag_present(skb)) 1242 + vlan_hlen = VLAN_HLEN; 1243 + 1244 + if (tun->flags & TUN_VNET_HDR) 1245 + vnet_hdr_sz = tun->vnet_hdr_sz; 1238 1246 1239 1247 if (!(tun->flags & TUN_NO_PI)) { 1240 1248 if ((len -= sizeof(pi)) < 0) 1241 1249 return -EINVAL; 1242 1250 1243 - if (len < skb->len) { 1251 + if (len < skb->len + vlan_hlen + vnet_hdr_sz) { 1244 1252 /* Packet will be striped */ 1245 1253 pi.flags |= TUN_PKT_STRIP; 1246 1254 } ··· 1258 1250 total += sizeof(pi); 1259 1251 } 1260 1252 1261 - if (tun->flags & TUN_VNET_HDR) { 1253 + if (vnet_hdr_sz) { 1262 1254 struct virtio_net_hdr gso = { 0 }; /* no info leak */ 1263 - if ((len -= tun->vnet_hdr_sz) < 0) 1255 + if ((len -= vnet_hdr_sz) < 0) 1264 1256 return -EINVAL; 1265 1257 1266 1258 if (skb_is_gso(skb)) { ··· 1292 1284 1293 1285 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1294 1286 gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; 1295 - gso.csum_start = skb_checksum_start_offset(skb); 1287 + gso.csum_start = skb_checksum_start_offset(skb) + 1288 + vlan_hlen; 1296 1289 gso.csum_offset = skb->csum_offset; 1297 1290 } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { 1298 1291 gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; ··· 1302 1293 if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, 1303 1294 sizeof(gso)))) 1304 1295 return -EFAULT; 1305 - total += tun->vnet_hdr_sz; 1296 + total += vnet_hdr_sz; 1306 1297 } 1307 1298 1308 1299 copied = total; 1309 - total += skb->len; 1310 - if (!vlan_tx_tag_present(skb)) { 1311 - len = min_t(int, skb->len, len); 1312 - } else { 1300 + len = min_t(int, skb->len + vlan_hlen, len); 1301 + total += skb->len + vlan_hlen; 1302 + if (vlan_hlen) { 1313 1303 int copy, ret; 1314 1304 struct { 1315 1305 __be16 h_vlan_proto; ··· 1319 1311 veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); 1320 1312 1321 1313 vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); 1322 - len = min_t(int, skb->len + VLAN_HLEN, len); 1323 - total += VLAN_HLEN; 1324 1314 1325 1315 copy = min_t(int, vlan_offset, len); 1326 1316 ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy);
+1 -13
drivers/net/usb/asix_devices.c
··· 465 465 return ret; 466 466 } 467 467 468 - ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL); 469 - if (ret < 0) 470 - return ret; 471 - 472 - msleep(150); 473 - 474 - ret = asix_sw_reset(dev, AX_SWRESET_CLEAR); 475 - if (ret < 0) 476 - return ret; 477 - 478 - msleep(150); 479 - 480 - ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE); 468 + ax88772_reset(dev); 481 469 482 470 /* Read PHYID register *AFTER* the PHY was reset properly */ 483 471 phyid = asix_get_phyid(dev);
+1
drivers/net/usb/qmi_wwan.c
··· 780 780 {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ 781 781 {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ 782 782 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ 783 + {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ 783 784 784 785 /* 4. Gobi 1000 devices */ 785 786 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+37
drivers/net/virtio_net.c
··· 1673 1673 }; 1674 1674 #endif 1675 1675 1676 + static bool virtnet_fail_on_feature(struct virtio_device *vdev, 1677 + unsigned int fbit, 1678 + const char *fname, const char *dname) 1679 + { 1680 + if (!virtio_has_feature(vdev, fbit)) 1681 + return false; 1682 + 1683 + dev_err(&vdev->dev, "device advertises feature %s but not %s", 1684 + fname, dname); 1685 + 1686 + return true; 1687 + } 1688 + 1689 + #define VIRTNET_FAIL_ON(vdev, fbit, dbit) \ 1690 + virtnet_fail_on_feature(vdev, fbit, #fbit, dbit) 1691 + 1692 + static bool virtnet_validate_features(struct virtio_device *vdev) 1693 + { 1694 + if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) && 1695 + (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX, 1696 + "VIRTIO_NET_F_CTRL_VQ") || 1697 + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN, 1698 + "VIRTIO_NET_F_CTRL_VQ") || 1699 + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE, 1700 + "VIRTIO_NET_F_CTRL_VQ") || 1701 + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") || 1702 + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR, 1703 + "VIRTIO_NET_F_CTRL_VQ"))) { 1704 + return false; 1705 + } 1706 + 1707 + return true; 1708 + } 1709 + 1676 1710 static int virtnet_probe(struct virtio_device *vdev) 1677 1711 { 1678 1712 int i, err; 1679 1713 struct net_device *dev; 1680 1714 struct virtnet_info *vi; 1681 1715 u16 max_queue_pairs; 1716 + 1717 + if (!virtnet_validate_features(vdev)) 1718 + return -EINVAL; 1682 1719 1683 1720 /* Find if host supports multiqueue virtio_net device */ 1684 1721 err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ,
+23 -18
drivers/net/vxlan.c
··· 67 67 68 68 #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ 69 69 70 - /* VXLAN protocol header */ 71 - struct vxlanhdr { 72 - __be32 vx_flags; 73 - __be32 vx_vni; 74 - }; 75 - 76 70 /* UDP port for VXLAN traffic. 77 71 * The IANA assigned port is 4789, but the Linux default is 8472 78 72 * for compatibility with early adopters. ··· 269 275 return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); 270 276 } 271 277 272 - /* Find VXLAN socket based on network namespace and UDP port */ 273 - static struct vxlan_sock *vxlan_find_sock(struct net *net, __be16 port) 278 + /* Find VXLAN socket based on network namespace, address family and UDP port */ 279 + static struct vxlan_sock *vxlan_find_sock(struct net *net, 280 + sa_family_t family, __be16 port) 274 281 { 275 282 struct vxlan_sock *vs; 276 283 277 284 hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) { 278 - if (inet_sk(vs->sock->sk)->inet_sport == port) 285 + if (inet_sk(vs->sock->sk)->inet_sport == port && 286 + inet_sk(vs->sock->sk)->sk.sk_family == family) 279 287 return vs; 280 288 } 281 289 return NULL; ··· 296 300 } 297 301 298 302 /* Look up VNI in a per net namespace table */ 299 - static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, __be16 port) 303 + static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, 304 + sa_family_t family, __be16 port) 300 305 { 301 306 struct vxlan_sock *vs; 302 307 303 - vs = vxlan_find_sock(net, port); 308 + vs = vxlan_find_sock(net, family, port); 304 309 if (!vs) 305 310 return NULL; 306 311 ··· 617 620 __be16 type; 618 621 int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr); 619 622 int err = -ENOSYS; 623 + 624 + udp_tunnel_gro_complete(skb, nhoff); 620 625 621 626 eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr)); 622 627 type = eh->h_proto; ··· 1770 1771 struct vxlan_dev *dst_vxlan; 1771 1772 1772 1773 ip_rt_put(rt); 1773 - dst_vxlan = vxlan_find_vni(vxlan->net, vni, dst_port); 1774 + dst_vxlan = vxlan_find_vni(vxlan->net, vni, 1775 + dst->sa.sa_family, dst_port); 1774 1776 if (!dst_vxlan) 1775 1777 goto tx_error; 1776 1778 vxlan_encap_bypass(skb, vxlan, dst_vxlan); ··· 1825 1825 struct vxlan_dev *dst_vxlan; 1826 1826 1827 1827 dst_release(ndst); 1828 - dst_vxlan = vxlan_find_vni(vxlan->net, vni, dst_port); 1828 + dst_vxlan = vxlan_find_vni(vxlan->net, vni, 1829 + dst->sa.sa_family, dst_port); 1829 1830 if (!dst_vxlan) 1830 1831 goto tx_error; 1831 1832 vxlan_encap_bypass(skb, vxlan, dst_vxlan); ··· 1986 1985 struct vxlan_dev *vxlan = netdev_priv(dev); 1987 1986 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); 1988 1987 struct vxlan_sock *vs; 1988 + bool ipv6 = vxlan->flags & VXLAN_F_IPV6; 1989 1989 1990 1990 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 1991 1991 if (!dev->tstats) 1992 1992 return -ENOMEM; 1993 1993 1994 1994 spin_lock(&vn->sock_lock); 1995 - vs = vxlan_find_sock(vxlan->net, vxlan->dst_port); 1995 + vs = vxlan_find_sock(vxlan->net, ipv6 ? AF_INET6 : AF_INET, 1996 + vxlan->dst_port); 1996 1997 if (vs) { 1997 1998 /* If we have a socket with same port already, reuse it */ 1998 1999 atomic_inc(&vs->refcnt); ··· 2306 2303 if (ipv6) { 2307 2304 udp_conf.family = AF_INET6; 2308 2305 udp_conf.use_udp6_tx_checksums = 2309 - !!(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); 2306 + !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); 2310 2307 udp_conf.use_udp6_rx_checksums = 2311 - !!(flags & VXLAN_F_UDP_ZERO_CSUM6_RX); 2308 + !(flags & VXLAN_F_UDP_ZERO_CSUM6_RX); 2312 2309 } else { 2313 2310 udp_conf.family = AF_INET; 2314 2311 udp_conf.local_ip.s_addr = INADDR_ANY; ··· 2385 2382 { 2386 2383 struct vxlan_net *vn = net_generic(net, vxlan_net_id); 2387 2384 struct vxlan_sock *vs; 2385 + bool ipv6 = flags & VXLAN_F_IPV6; 2388 2386 2389 2387 vs = vxlan_socket_create(net, port, rcv, data, flags); 2390 2388 if (!IS_ERR(vs)) ··· 2395 2391 return vs; 2396 2392 2397 2393 spin_lock(&vn->sock_lock); 2398 - vs = vxlan_find_sock(net, port); 2394 + vs = vxlan_find_sock(net, ipv6 ? AF_INET6 : AF_INET, port); 2399 2395 if (vs) { 2400 2396 if (vs->rcv == rcv) 2401 2397 atomic_inc(&vs->refcnt); ··· 2554 2550 nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX])) 2555 2551 vxlan->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX; 2556 2552 2557 - if (vxlan_find_vni(net, vni, vxlan->dst_port)) { 2553 + if (vxlan_find_vni(net, vni, use_ipv6 ? AF_INET6 : AF_INET, 2554 + vxlan->dst_port)) { 2558 2555 pr_info("duplicate VNI %u\n", vni); 2559 2556 return -EEXIST; 2560 2557 }
+13
drivers/net/wireless/ath/ath9k/ar9003_phy.c
··· 664 664 ah->enabled_cals |= TX_CL_CAL; 665 665 else 666 666 ah->enabled_cals &= ~TX_CL_CAL; 667 + 668 + if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) { 669 + if (ah->is_clk_25mhz) { 670 + REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); 671 + REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); 672 + REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); 673 + } else { 674 + REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); 675 + REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); 676 + REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); 677 + } 678 + udelay(100); 679 + } 667 680 } 668 681 669 682 static void ar9003_hw_prog_ini(struct ath_hw *ah,
-13
drivers/net/wireless/ath/ath9k/hw.c
··· 861 861 udelay(RTC_PLL_SETTLE_DELAY); 862 862 863 863 REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); 864 - 865 - if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) { 866 - if (ah->is_clk_25mhz) { 867 - REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); 868 - REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); 869 - REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); 870 - } else { 871 - REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); 872 - REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); 873 - REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); 874 - } 875 - udelay(100); 876 - } 877 864 } 878 865 879 866 static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
+6 -3
drivers/net/wireless/ath/ath9k/main.c
··· 974 974 struct ath_vif *avp; 975 975 976 976 /* 977 - * Pick the MAC address of the first interface as the new hardware 978 - * MAC address. The hardware will use it together with the BSSID mask 979 - * when matching addresses. 977 + * The hardware will use primary station addr together with the 978 + * BSSID mask when matching addresses. 980 979 */ 981 980 memset(iter_data, 0, sizeof(*iter_data)); 982 981 memset(&iter_data->mask, 0xff, ETH_ALEN); ··· 1204 1205 list_add_tail(&avp->list, &avp->chanctx->vifs); 1205 1206 } 1206 1207 1208 + ath9k_calculate_summary_state(sc, avp->chanctx); 1209 + 1207 1210 ath9k_assign_hw_queues(hw, vif); 1208 1211 1209 1212 an->sc = sc; ··· 1274 1273 ath9k_beacon_remove_slot(sc, vif); 1275 1274 1276 1275 ath_tx_node_cleanup(sc, &avp->mcast_node); 1276 + 1277 + ath9k_calculate_summary_state(sc, avp->chanctx); 1277 1278 1278 1279 mutex_unlock(&sc->mutex); 1279 1280 }
+1 -3
drivers/net/wireless/b43/phy_common.c
··· 300 300 301 301 void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) 302 302 { 303 - assert_mac_suspended(dev); 304 - dev->phy.ops->phy_write(dev, destreg, 305 - dev->phy.ops->phy_read(dev, srcreg)); 303 + b43_phy_write(dev, destreg, b43_phy_read(dev, srcreg)); 306 304 } 307 305 308 306 void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
+2 -2
drivers/net/wireless/brcm80211/brcmfmac/of.c
··· 40 40 return; 41 41 42 42 irq = irq_of_parse_and_map(np, 0); 43 - if (irq < 0) { 44 - brcmf_err("interrupt could not be mapped: err=%d\n", irq); 43 + if (!irq) { 44 + brcmf_err("interrupt could not be mapped\n"); 45 45 devm_kfree(dev, sdiodev->pdata); 46 46 return; 47 47 }
+1 -1
drivers/net/wireless/brcm80211/brcmfmac/pcie.c
··· 19 19 #include <linux/pci.h> 20 20 #include <linux/vmalloc.h> 21 21 #include <linux/delay.h> 22 - #include <linux/unaligned/access_ok.h> 23 22 #include <linux/interrupt.h> 24 23 #include <linux/bcma/bcma.h> 25 24 #include <linux/sched.h> 25 + #include <asm/unaligned.h> 26 26 27 27 #include <soc.h> 28 28 #include <chipcommon.h>
+4 -2
drivers/net/wireless/brcm80211/brcmfmac/usb.c
··· 669 669 goto finalize; 670 670 } 671 671 672 - if (!brcmf_usb_ioctl_resp_wait(devinfo)) 672 + if (!brcmf_usb_ioctl_resp_wait(devinfo)) { 673 + usb_kill_urb(devinfo->ctl_urb); 673 674 ret = -ETIMEDOUT; 674 - else 675 + } else { 675 676 memcpy(buffer, tmpbuf, buflen); 677 + } 676 678 677 679 finalize: 678 680 kfree(tmpbuf);
+6
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
··· 299 299 primary_offset = ch->center_freq1 - ch->chan->center_freq; 300 300 switch (ch->width) { 301 301 case NL80211_CHAN_WIDTH_20: 302 + case NL80211_CHAN_WIDTH_20_NOHT: 302 303 ch_inf.bw = BRCMU_CHAN_BW_20; 303 304 WARN_ON(primary_offset != 0); 304 305 break; ··· 324 323 ch_inf.sb = BRCMU_CHAN_SB_LU; 325 324 } 326 325 break; 326 + case NL80211_CHAN_WIDTH_80P80: 327 + case NL80211_CHAN_WIDTH_160: 328 + case NL80211_CHAN_WIDTH_5: 329 + case NL80211_CHAN_WIDTH_10: 327 330 default: 328 331 WARN_ON_ONCE(1); 329 332 } ··· 338 333 case IEEE80211_BAND_5GHZ: 339 334 ch_inf.band = BRCMU_CHAN_BAND_5G; 340 335 break; 336 + case IEEE80211_BAND_60GHZ: 341 337 default: 342 338 WARN_ON_ONCE(1); 343 339 }
+2
drivers/net/wireless/iwlwifi/iwl-fw.h
··· 155 155 * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests 156 156 * @IWL_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA), 157 157 * which also implies support for the scheduler configuration command 158 + * @IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT: supports Hot Spot Command 158 159 */ 159 160 enum iwl_ucode_tlv_capa { 160 161 IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0), ··· 164 163 IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = BIT(10), 165 164 IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = BIT(11), 166 165 IWL_UCODE_TLV_CAPA_DQA_SUPPORT = BIT(12), 166 + IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = BIT(18), 167 167 }; 168 168 169 169 /* The default calibrate table size if not specified by firmware file */
+9 -1
drivers/net/wireless/iwlwifi/mvm/fw.c
··· 284 284 285 285 lockdep_assert_held(&mvm->mutex); 286 286 287 - if (WARN_ON_ONCE(mvm->init_ucode_complete)) 287 + if (WARN_ON_ONCE(mvm->init_ucode_complete || mvm->calibrating)) 288 288 return 0; 289 289 290 290 iwl_init_notification_wait(&mvm->notif_wait, ··· 334 334 goto out; 335 335 } 336 336 337 + mvm->calibrating = true; 338 + 337 339 /* Send TX valid antennas before triggering calibrations */ 338 340 ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant); 339 341 if (ret) ··· 360 358 MVM_UCODE_CALIB_TIMEOUT); 361 359 if (!ret) 362 360 mvm->init_ucode_complete = true; 361 + 362 + if (ret && iwl_mvm_is_radio_killed(mvm)) { 363 + IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); 364 + ret = 1; 365 + } 363 366 goto out; 364 367 365 368 error: 366 369 iwl_remove_notification(&mvm->notif_wait, &calib_wait); 367 370 out: 371 + mvm->calibrating = false; 368 372 if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { 369 373 /* we want to debug INIT and we have no NVM - fake */ 370 374 mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) +
+10 -3
drivers/net/wireless/iwlwifi/mvm/mac80211.c
··· 788 788 789 789 mvm->scan_status = IWL_MVM_SCAN_NONE; 790 790 mvm->ps_disabled = false; 791 + mvm->calibrating = false; 791 792 792 793 /* just in case one was running */ 793 794 ieee80211_remain_on_channel_expired(mvm->hw); ··· 2448 2447 2449 2448 switch (vif->type) { 2450 2449 case NL80211_IFTYPE_STATION: 2451 - /* Use aux roc framework (HS20) */ 2452 - ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, 2453 - vif, duration); 2450 + if (mvm->fw->ucode_capa.capa[0] & 2451 + IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT) { 2452 + /* Use aux roc framework (HS20) */ 2453 + ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, 2454 + vif, duration); 2455 + goto out_unlock; 2456 + } 2457 + IWL_ERR(mvm, "hotspot not supported\n"); 2458 + ret = -EINVAL; 2454 2459 goto out_unlock; 2455 2460 case NL80211_IFTYPE_P2P_DEVICE: 2456 2461 /* handle below */
+1
drivers/net/wireless/iwlwifi/mvm/mvm.h
··· 548 548 enum iwl_ucode_type cur_ucode; 549 549 bool ucode_loaded; 550 550 bool init_ucode_complete; 551 + bool calibrating; 551 552 u32 error_event_table; 552 553 u32 log_event_table; 553 554 u32 umac_error_event_table;
+11 -1
drivers/net/wireless/iwlwifi/mvm/ops.c
··· 424 424 } 425 425 mvm->sf_state = SF_UNINIT; 426 426 mvm->low_latency_agg_frame_limit = 6; 427 + mvm->cur_ucode = IWL_UCODE_INIT; 427 428 428 429 mutex_init(&mvm->mutex); 429 430 mutex_init(&mvm->d0i3_suspend_mutex); ··· 753 752 static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) 754 753 { 755 754 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); 755 + bool calibrating = ACCESS_ONCE(mvm->calibrating); 756 756 757 757 if (state) 758 758 set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); ··· 762 760 763 761 wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); 764 762 765 - return state && mvm->cur_ucode != IWL_UCODE_INIT; 763 + /* iwl_run_init_mvm_ucode is waiting for results, abort it */ 764 + if (calibrating) 765 + iwl_abort_notification_waits(&mvm->notif_wait); 766 + 767 + /* 768 + * Stop the device if we run OPERATIONAL firmware or if we are in the 769 + * middle of the calibrations. 770 + */ 771 + return state && (mvm->cur_ucode != IWL_UCODE_INIT || calibrating); 766 772 } 767 773 768 774 static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb)
+10 -10
drivers/net/wireless/iwlwifi/mvm/scan.c
··· 602 602 SCAN_COMPLETE_NOTIFICATION }; 603 603 int ret; 604 604 605 - if (mvm->scan_status == IWL_MVM_SCAN_NONE) 606 - return 0; 607 - 608 - if (iwl_mvm_is_radio_killed(mvm)) { 609 - ieee80211_scan_completed(mvm->hw, true); 610 - iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); 611 - mvm->scan_status = IWL_MVM_SCAN_NONE; 612 - return 0; 613 - } 614 - 615 605 iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, 616 606 scan_abort_notif, 617 607 ARRAY_SIZE(scan_abort_notif), ··· 1390 1400 1391 1401 int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) 1392 1402 { 1403 + if (mvm->scan_status == IWL_MVM_SCAN_NONE) 1404 + return 0; 1405 + 1406 + if (iwl_mvm_is_radio_killed(mvm)) { 1407 + ieee80211_scan_completed(mvm->hw, true); 1408 + iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); 1409 + mvm->scan_status = IWL_MVM_SCAN_NONE; 1410 + return 0; 1411 + } 1412 + 1393 1413 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) 1394 1414 return iwl_mvm_scan_offload_stop(mvm, true); 1395 1415 return iwl_mvm_cancel_regular_scan(mvm);
+3 -4
drivers/net/wireless/iwlwifi/pcie/trans.c
··· 915 915 * restart. So don't process again if the device is 916 916 * already dead. 917 917 */ 918 - if (test_bit(STATUS_DEVICE_ENABLED, &trans->status)) { 918 + if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { 919 + IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n"); 919 920 iwl_pcie_tx_stop(trans); 920 921 iwl_pcie_rx_stop(trans); 921 922 ··· 946 945 /* clear all status bits */ 947 946 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); 948 947 clear_bit(STATUS_INT_ENABLED, &trans->status); 949 - clear_bit(STATUS_DEVICE_ENABLED, &trans->status); 950 948 clear_bit(STATUS_TPOWER_PMI, &trans->status); 951 949 clear_bit(STATUS_RFKILL, &trans->status); 952 950 ··· 1894 1894 int reg; 1895 1895 __le32 *val; 1896 1896 1897 - prph_len += sizeof(*data) + sizeof(*prph) + 1898 - num_bytes_in_chunk; 1897 + prph_len += sizeof(**data) + sizeof(*prph) + num_bytes_in_chunk; 1899 1898 1900 1899 (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); 1901 1900 (*data)->len = cpu_to_le32(sizeof(*prph) +
+3 -1
drivers/net/wireless/mac80211_hwsim.c
··· 1987 1987 if (err != 0) { 1988 1988 printk(KERN_DEBUG "mac80211_hwsim: device_bind_driver failed (%d)\n", 1989 1989 err); 1990 - goto failed_hw; 1990 + goto failed_bind; 1991 1991 } 1992 1992 1993 1993 skb_queue_head_init(&data->pending); ··· 2183 2183 return idx; 2184 2184 2185 2185 failed_hw: 2186 + device_release_driver(data->dev); 2187 + failed_bind: 2186 2188 device_unregister(data->dev); 2187 2189 failed_drvdata: 2188 2190 ieee80211_free_hw(hw);
+18 -44
drivers/net/wireless/rt2x00/rt2x00queue.c
··· 158 158 skb_trim(skb, frame_length); 159 159 } 160 160 161 - void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) 161 + /* 162 + * H/W needs L2 padding between the header and the paylod if header size 163 + * is not 4 bytes aligned. 164 + */ 165 + void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len) 162 166 { 163 - unsigned int payload_length = skb->len - header_length; 164 - unsigned int header_align = ALIGN_SIZE(skb, 0); 165 - unsigned int payload_align = ALIGN_SIZE(skb, header_length); 166 - unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0; 167 - 168 - /* 169 - * Adjust the header alignment if the payload needs to be moved more 170 - * than the header. 171 - */ 172 - if (payload_align > header_align) 173 - header_align += 4; 174 - 175 - /* There is nothing to do if no alignment is needed */ 176 - if (!header_align) 177 - return; 178 - 179 - /* Reserve the amount of space needed in front of the frame */ 180 - skb_push(skb, header_align); 181 - 182 - /* 183 - * Move the header. 184 - */ 185 - memmove(skb->data, skb->data + header_align, header_length); 186 - 187 - /* Move the payload, if present and if required */ 188 - if (payload_length && payload_align) 189 - memmove(skb->data + header_length + l2pad, 190 - skb->data + header_length + l2pad + payload_align, 191 - payload_length); 192 - 193 - /* Trim the skb to the correct size */ 194 - skb_trim(skb, header_length + l2pad + payload_length); 195 - } 196 - 197 - void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) 198 - { 199 - /* 200 - * L2 padding is only present if the skb contains more than just the 201 - * IEEE 802.11 header. 202 - */ 203 - unsigned int l2pad = (skb->len > header_length) ? 204 - L2PAD_SIZE(header_length) : 0; 167 + unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; 205 168 206 169 if (!l2pad) 207 170 return; 208 171 209 - memmove(skb->data + l2pad, skb->data, header_length); 172 + skb_push(skb, l2pad); 173 + memmove(skb->data, skb->data + l2pad, hdr_len); 174 + } 175 + 176 + void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len) 177 + { 178 + unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; 179 + 180 + if (!l2pad) 181 + return; 182 + 183 + memmove(skb->data + l2pad, skb->data, hdr_len); 210 184 skb_pull(skb, l2pad); 211 185 } 212 186
+22 -17
drivers/net/wireless/rtlwifi/pci.c
··· 842 842 break; 843 843 } 844 844 /* handle command packet here */ 845 - if (rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { 845 + if (rtlpriv->cfg->ops->rx_command_packet && 846 + rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { 846 847 dev_kfree_skb_any(skb); 847 848 goto end; 848 849 } ··· 1128 1127 1129 1128 __skb_queue_tail(&ring->queue, pskb); 1130 1129 1131 - rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, 1132 - &temp_one); 1133 - 1130 + if (rtlpriv->use_new_trx_flow) { 1131 + temp_one = 4; 1132 + rtlpriv->cfg->ops->set_desc(hw, (u8 *)pbuffer_desc, true, 1133 + HW_DESC_OWN, (u8 *)&temp_one); 1134 + } else { 1135 + rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, 1136 + &temp_one); 1137 + } 1134 1138 return; 1135 1139 } 1136 1140 ··· 1376 1370 ring->desc = NULL; 1377 1371 if (rtlpriv->use_new_trx_flow) { 1378 1372 pci_free_consistent(rtlpci->pdev, 1379 - sizeof(*ring->desc) * ring->entries, 1373 + sizeof(*ring->buffer_desc) * ring->entries, 1380 1374 ring->buffer_desc, ring->buffer_desc_dma); 1381 - ring->desc = NULL; 1375 + ring->buffer_desc = NULL; 1382 1376 } 1383 1377 } 1384 1378 ··· 1549 1543 true, 1550 1544 HW_DESC_TXBUFF_ADDR), 1551 1545 skb->len, PCI_DMA_TODEVICE); 1552 - ring->idx = (ring->idx + 1) % ring->entries; 1553 1546 kfree_skb(skb); 1554 1547 ring->idx = (ring->idx + 1) % ring->entries; 1555 1548 } ··· 2249 2244 /*like read eeprom and so on */ 2250 2245 rtlpriv->cfg->ops->read_eeprom_info(hw); 2251 2246 2247 + if (rtlpriv->cfg->ops->init_sw_vars(hw)) { 2248 + RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); 2249 + err = -ENODEV; 2250 + goto fail3; 2251 + } 2252 + rtlpriv->cfg->ops->init_sw_leds(hw); 2253 + 2254 + /*aspm */ 2255 + rtl_pci_init_aspm(hw); 2256 + 2252 2257 /* Init mac80211 sw */ 2253 2258 err = rtl_init_core(hw); 2254 2259 if (err) { ··· 2273 2258 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Failed to init PCI\n"); 2274 2259 goto fail3; 2275 2260 } 2276 - 2277 - if (rtlpriv->cfg->ops->init_sw_vars(hw)) { 2278 - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); 2279 - err = -ENODEV; 2280 - goto fail3; 2281 - } 2282 - rtlpriv->cfg->ops->init_sw_leds(hw); 2283 - 2284 - /*aspm */ 2285 - rtl_pci_init_aspm(hw); 2286 2261 2287 2262 err = ieee80211_register_hw(hw); 2288 2263 if (err) {
+5 -2
drivers/net/wireless/rtlwifi/rtl8192se/hw.c
··· 1201 1201 1202 1202 } 1203 1203 1204 + if (type != NL80211_IFTYPE_AP && 1205 + rtlpriv->mac80211.link_state < MAC80211_LINKED) 1206 + bt_msr = rtl_read_byte(rtlpriv, MSR) & ~MSR_LINK_MASK; 1204 1207 rtl_write_byte(rtlpriv, (MSR), bt_msr); 1205 1208 1206 1209 temp = rtl_read_dword(rtlpriv, TCR); ··· 1265 1262 rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); 1266 1263 /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ 1267 1264 rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); 1265 + rtlpci->irq_enabled = true; 1268 1266 } 1269 1267 1270 1268 void rtl92se_disable_interrupt(struct ieee80211_hw *hw) ··· 1280 1276 rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1281 1277 rtl_write_dword(rtlpriv, INTA_MASK, 0); 1282 1278 rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); 1283 - 1284 - synchronize_irq(rtlpci->pdev->irq); 1279 + rtlpci->irq_enabled = false; 1285 1280 } 1286 1281 1287 1282 static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data)
+2
drivers/net/wireless/rtlwifi/rtl8192se/phy.c
··· 399 399 case 2: 400 400 currentcmd = &postcommoncmd[*step]; 401 401 break; 402 + default: 403 + return true; 402 404 } 403 405 404 406 if (currentcmd->cmdid == CMDID_END) {
+16
drivers/net/wireless/rtlwifi/rtl8192se/sw.c
··· 236 236 } 237 237 } 238 238 239 + static bool rtl92se_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, 240 + u16 index) 241 + { 242 + struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 243 + struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; 244 + u8 *entry = (u8 *)(&ring->desc[ring->idx]); 245 + u8 own = (u8)rtl92se_get_desc(entry, true, HW_DESC_OWN); 246 + 247 + if (own) 248 + return false; 249 + return true; 250 + } 251 + 239 252 static struct rtl_hal_ops rtl8192se_hal_ops = { 240 253 .init_sw_vars = rtl92s_init_sw_vars, 241 254 .deinit_sw_vars = rtl92s_deinit_sw_vars, ··· 282 269 .led_control = rtl92se_led_control, 283 270 .set_desc = rtl92se_set_desc, 284 271 .get_desc = rtl92se_get_desc, 272 + .is_tx_desc_closed = rtl92se_is_tx_desc_closed, 285 273 .tx_polling = rtl92se_tx_polling, 286 274 .enable_hw_sec = rtl92se_enable_hw_security_config, 287 275 .set_key = rtl92se_set_key, ··· 320 306 .maps[MAC_RCR_ACRC32] = RCR_ACRC32, 321 307 .maps[MAC_RCR_ACF] = RCR_ACF, 322 308 .maps[MAC_RCR_AAP] = RCR_AAP, 309 + .maps[MAC_HIMR] = INTA_MASK, 310 + .maps[MAC_HIMRE] = INTA_MASK + 4, 323 311 324 312 .maps[EFUSE_TEST] = REG_EFUSE_TEST, 325 313 .maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
+3 -2
drivers/net/wireless/rtlwifi/rtl8821ae/hw.c
··· 3672 3672 mac->opmode == NL80211_IFTYPE_ADHOC) 3673 3673 macid = sta->aid + 1; 3674 3674 if (wirelessmode == WIRELESS_MODE_N_5G || 3675 - wirelessmode == WIRELESS_MODE_AC_5G) 3676 - ratr_bitmap = sta->supp_rates[NL80211_BAND_5GHZ]; 3675 + wirelessmode == WIRELESS_MODE_AC_5G || 3676 + wirelessmode == WIRELESS_MODE_A) 3677 + ratr_bitmap = sta->supp_rates[NL80211_BAND_5GHZ] << 4; 3677 3678 else 3678 3679 ratr_bitmap = sta->supp_rates[NL80211_BAND_2GHZ]; 3679 3680
+9 -6
drivers/net/xen-netback/xenbus.c
··· 39 39 static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); 40 40 static void connect(struct backend_info *be); 41 41 static int read_xenbus_vif_flags(struct backend_info *be); 42 - static void backend_create_xenvif(struct backend_info *be); 42 + static int backend_create_xenvif(struct backend_info *be); 43 43 static void unregister_hotplug_status_watch(struct backend_info *be); 44 44 static void set_backend_state(struct backend_info *be, 45 45 enum xenbus_state state); ··· 352 352 be->state = XenbusStateInitWait; 353 353 354 354 /* This kicks hotplug scripts, so do it immediately. */ 355 - backend_create_xenvif(be); 355 + err = backend_create_xenvif(be); 356 + if (err) 357 + goto fail; 356 358 357 359 return 0; 358 360 ··· 399 397 } 400 398 401 399 402 - static void backend_create_xenvif(struct backend_info *be) 400 + static int backend_create_xenvif(struct backend_info *be) 403 401 { 404 402 int err; 405 403 long handle; 406 404 struct xenbus_device *dev = be->dev; 407 405 408 406 if (be->vif != NULL) 409 - return; 407 + return 0; 410 408 411 409 err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); 412 410 if (err != 1) { 413 411 xenbus_dev_fatal(dev, err, "reading handle"); 414 - return; 412 + return (err < 0) ? err : -EINVAL; 415 413 } 416 414 417 415 be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); ··· 419 417 err = PTR_ERR(be->vif); 420 418 be->vif = NULL; 421 419 xenbus_dev_fatal(dev, err, "creating interface"); 422 - return; 420 + return err; 423 421 } 424 422 425 423 kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); 424 + return 0; 426 425 } 427 426 428 427 static void backend_disconnect(struct backend_info *be)
+16 -3
drivers/of/address.c
··· 450 450 return NULL; 451 451 } 452 452 453 + static int of_empty_ranges_quirk(void) 454 + { 455 + if (IS_ENABLED(CONFIG_PPC)) { 456 + /* To save cycles, we cache the result */ 457 + static int quirk_state = -1; 458 + 459 + if (quirk_state < 0) 460 + quirk_state = 461 + of_machine_is_compatible("Power Macintosh") || 462 + of_machine_is_compatible("MacRISC"); 463 + return quirk_state; 464 + } 465 + return false; 466 + } 467 + 453 468 static int of_translate_one(struct device_node *parent, struct of_bus *bus, 454 469 struct of_bus *pbus, __be32 *addr, 455 470 int na, int ns, int pna, const char *rprop) ··· 490 475 * This code is only enabled on powerpc. --gcl 491 476 */ 492 477 ranges = of_get_property(parent, rprop, &rlen); 493 - #if !defined(CONFIG_PPC) 494 - if (ranges == NULL) { 478 + if (ranges == NULL && !of_empty_ranges_quirk()) { 495 479 pr_err("OF: no ranges; cannot translate\n"); 496 480 return 1; 497 481 } 498 - #endif /* !defined(CONFIG_PPC) */ 499 482 if (ranges == NULL || rlen == 0) { 500 483 offset = of_read_number(addr, na); 501 484 memset(addr, 0, pna * 4);
+1 -1
drivers/of/dynamic.c
··· 247 247 * @allocflags: Allocation flags (typically pass GFP_KERNEL) 248 248 * 249 249 * Copy a property by dynamically allocating the memory of both the 250 - * property stucture and the property name & contents. The property's 250 + * property structure and the property name & contents. The property's 251 251 * flags have the OF_DYNAMIC bit set so that we can differentiate between 252 252 * dynamically allocated properties and not. 253 253 * Returns the newly allocated property or NULL on out of memory error.
+1 -1
drivers/of/fdt.c
··· 773 773 if (offset < 0) 774 774 return -ENODEV; 775 775 776 - while (match->compatible) { 776 + while (match->compatible[0]) { 777 777 unsigned long addr; 778 778 if (fdt_node_check_compatible(fdt, offset, match->compatible)) { 779 779 match++;
+8 -3
drivers/of/selftest.c
··· 896 896 return; 897 897 } 898 898 899 - while (last_node_index >= 0) { 899 + while (last_node_index-- > 0) { 900 900 if (nodes[last_node_index]) { 901 901 np = of_find_node_by_path(nodes[last_node_index]->full_name); 902 - if (strcmp(np->full_name, "/aliases") != 0) { 902 + if (np == nodes[last_node_index]) { 903 + if (of_aliases == np) { 904 + of_node_put(of_aliases); 905 + of_aliases = NULL; 906 + } 903 907 detach_node_and_children(np); 904 908 } else { 905 909 for_each_property_of_node(np, prop) { ··· 912 908 } 913 909 } 914 910 } 915 - last_node_index--; 916 911 } 917 912 } 918 913 ··· 924 921 res = selftest_data_add(); 925 922 if (res) 926 923 return res; 924 + if (!of_aliases) 925 + of_aliases = of_find_node_by_path("/aliases"); 927 926 928 927 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); 929 928 if (!np) {
+1 -1
drivers/pci/access.c
··· 444 444 return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; 445 445 } 446 446 447 - static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev) 447 + bool pcie_cap_has_lnkctl(const struct pci_dev *dev) 448 448 { 449 449 int type = pci_pcie_type(dev); 450 450
+6 -1
drivers/pci/host/pci-xgene.c
··· 631 631 if (ret) 632 632 return ret; 633 633 634 - bus = pci_scan_root_bus(&pdev->dev, 0, &xgene_pcie_ops, port, &res); 634 + bus = pci_create_root_bus(&pdev->dev, 0, 635 + &xgene_pcie_ops, port, &res); 635 636 if (!bus) 636 637 return -ENOMEM; 638 + 639 + pci_scan_child_bus(bus); 640 + pci_assign_unassigned_bus_resources(bus); 641 + pci_bus_add_devices(bus); 637 642 638 643 platform_set_drvdata(pdev, port); 639 644 return 0;
+26
drivers/pci/msi.c
··· 590 590 return entry; 591 591 } 592 592 593 + static int msi_verify_entries(struct pci_dev *dev) 594 + { 595 + struct msi_desc *entry; 596 + 597 + list_for_each_entry(entry, &dev->msi_list, list) { 598 + if (!dev->no_64bit_msi || !entry->msg.address_hi) 599 + continue; 600 + dev_err(&dev->dev, "Device has broken 64-bit MSI but arch" 601 + " tried to assign one above 4G\n"); 602 + return -EIO; 603 + } 604 + return 0; 605 + } 606 + 593 607 /** 594 608 * msi_capability_init - configure device's MSI capability structure 595 609 * @dev: pointer to the pci_dev data structure of MSI device function ··· 635 621 636 622 /* Configure MSI capability structure */ 637 623 ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); 624 + if (ret) { 625 + msi_mask_irq(entry, mask, ~mask); 626 + free_msi_irqs(dev); 627 + return ret; 628 + } 629 + 630 + ret = msi_verify_entries(dev); 638 631 if (ret) { 639 632 msi_mask_irq(entry, mask, ~mask); 640 633 free_msi_irqs(dev); ··· 759 738 ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX); 760 739 if (ret) 761 740 goto out_avail; 741 + 742 + /* Check if all MSI entries honor device restrictions */ 743 + ret = msi_verify_entries(dev); 744 + if (ret) 745 + goto out_free; 762 746 763 747 /* 764 748 * Some devices require MSI-X to be enabled before we can touch the
+2
drivers/pci/pci.h
··· 6 6 7 7 extern const unsigned char pcie_link_speed[]; 8 8 9 + bool pcie_cap_has_lnkctl(const struct pci_dev *dev); 10 + 9 11 /* Functions internal to the PCI core code */ 10 12 11 13 int pci_create_sysfs_dev_files(struct pci_dev *pdev);
+17 -13
drivers/pci/probe.c
··· 407 407 { 408 408 struct pci_dev *dev = child->self; 409 409 u16 mem_base_lo, mem_limit_lo; 410 - unsigned long base, limit; 410 + u64 base64, limit64; 411 + dma_addr_t base, limit; 411 412 struct pci_bus_region region; 412 413 struct resource *res; 413 414 414 415 res = child->resource[2]; 415 416 pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); 416 417 pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); 417 - base = ((unsigned long) mem_base_lo & PCI_PREF_RANGE_MASK) << 16; 418 - limit = ((unsigned long) mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; 418 + base64 = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16; 419 + limit64 = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; 419 420 420 421 if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { 421 422 u32 mem_base_hi, mem_limit_hi; ··· 430 429 * this, just assume they are not being used. 431 430 */ 432 431 if (mem_base_hi <= mem_limit_hi) { 433 - #if BITS_PER_LONG == 64 434 - base |= ((unsigned long) mem_base_hi) << 32; 435 - limit |= ((unsigned long) mem_limit_hi) << 32; 436 - #else 437 - if (mem_base_hi || mem_limit_hi) { 438 - dev_err(&dev->dev, "can't handle 64-bit address space for bridge\n"); 439 - return; 440 - } 441 - #endif 432 + base64 |= (u64) mem_base_hi << 32; 433 + limit64 |= (u64) mem_limit_hi << 32; 442 434 } 443 435 } 436 + 437 + base = (dma_addr_t) base64; 438 + limit = (dma_addr_t) limit64; 439 + 440 + if (base != base64) { 441 + dev_err(&dev->dev, "can't handle bridge window above 4GB (bus address %#010llx)\n", 442 + (unsigned long long) base64); 443 + return; 444 + } 445 + 444 446 if (base <= limit) { 445 447 res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | 446 448 IORESOURCE_MEM | IORESOURCE_PREFETCH; ··· 1327 1323 ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); 1328 1324 1329 1325 /* Initialize Link Control Register */ 1330 - if (dev->subordinate) 1326 + if (pcie_cap_has_lnkctl(dev)) 1331 1327 pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, 1332 1328 ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); 1333 1329
+1
drivers/platform/x86/Kconfig
··· 202 202 config HP_ACCEL 203 203 tristate "HP laptop accelerometer" 204 204 depends on INPUT && ACPI 205 + depends on SERIO_I8042 205 206 select SENSORS_LIS3LV02D 206 207 select NEW_LEDS 207 208 select LEDS_CLASS
+44
drivers/platform/x86/hp_accel.c
··· 37 37 #include <linux/leds.h> 38 38 #include <linux/atomic.h> 39 39 #include <linux/acpi.h> 40 + #include <linux/i8042.h> 41 + #include <linux/serio.h> 40 42 #include "../../misc/lis3lv02d/lis3lv02d.h" 41 43 42 44 #define DRIVER_NAME "hp_accel" ··· 74 72 } 75 73 76 74 /* HP-specific accelerometer driver ------------------------------------ */ 75 + 76 + /* e0 25, e0 26, e0 27, e0 28 are scan codes that the accelerometer with acpi id 77 + * HPQ6000 sends through the keyboard bus */ 78 + #define ACCEL_1 0x25 79 + #define ACCEL_2 0x26 80 + #define ACCEL_3 0x27 81 + #define ACCEL_4 0x28 77 82 78 83 /* For automatic insertion of the module */ 79 84 static const struct acpi_device_id lis3lv02d_device_ids[] = { ··· 303 294 printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); 304 295 } 305 296 297 + static bool hp_accel_i8042_filter(unsigned char data, unsigned char str, 298 + struct serio *port) 299 + { 300 + static bool extended; 301 + 302 + if (str & I8042_STR_AUXDATA) 303 + return false; 304 + 305 + if (data == 0xe0) { 306 + extended = true; 307 + return true; 308 + } else if (unlikely(extended)) { 309 + extended = false; 310 + 311 + switch (data) { 312 + case ACCEL_1: 313 + case ACCEL_2: 314 + case ACCEL_3: 315 + case ACCEL_4: 316 + return true; 317 + default: 318 + serio_interrupt(port, 0xe0, 0); 319 + return false; 320 + } 321 + } 322 + 323 + return false; 324 + } 325 + 306 326 static int lis3lv02d_add(struct acpi_device *device) 307 327 { 308 328 int ret; ··· 364 326 if (ret) 365 327 return ret; 366 328 329 + /* filter to remove HPQ6000 accelerometer data 330 + * from keyboard bus stream */ 331 + if (strstr(dev_name(&device->dev), "HPQ6000")) 332 + i8042_install_filter(hp_accel_i8042_filter); 333 + 367 334 INIT_WORK(&hpled_led.work, delayed_set_status_worker); 368 335 ret = led_classdev_register(NULL, &hpled_led.led_classdev); 369 336 if (ret) { ··· 386 343 if (!device) 387 344 return -EINVAL; 388 345 346 + i8042_remove_filter(hp_accel_i8042_filter); 389 347 lis3lv02d_joystick_disable(&lis3_dev); 390 348 lis3lv02d_poweroff(&lis3_dev); 391 349
+9 -8
drivers/power/ab8500_fg.c
··· 25 25 #include <linux/slab.h> 26 26 #include <linux/delay.h> 27 27 #include <linux/time.h> 28 + #include <linux/time64.h> 28 29 #include <linux/of.h> 29 30 #include <linux/completion.h> 30 31 #include <linux/mfd/core.h> ··· 109 108 struct ab8500_fg_avg_cap { 110 109 int avg; 111 110 int samples[NBR_AVG_SAMPLES]; 112 - __kernel_time_t time_stamps[NBR_AVG_SAMPLES]; 111 + time64_t time_stamps[NBR_AVG_SAMPLES]; 113 112 int pos; 114 113 int nbr_samples; 115 114 int sum; ··· 387 386 */ 388 387 static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample) 389 388 { 390 - struct timespec ts; 389 + struct timespec64 ts64; 391 390 struct ab8500_fg_avg_cap *avg = &di->avg_cap; 392 391 393 - getnstimeofday(&ts); 392 + getnstimeofday64(&ts64); 394 393 395 394 do { 396 395 avg->sum += sample - avg->samples[avg->pos]; 397 396 avg->samples[avg->pos] = sample; 398 - avg->time_stamps[avg->pos] = ts.tv_sec; 397 + avg->time_stamps[avg->pos] = ts64.tv_sec; 399 398 avg->pos++; 400 399 401 400 if (avg->pos == NBR_AVG_SAMPLES) ··· 408 407 * Check the time stamp for each sample. If too old, 409 408 * replace with latest sample 410 409 */ 411 - } while (ts.tv_sec - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]); 410 + } while (ts64.tv_sec - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]); 412 411 413 412 avg->avg = avg->sum / avg->nbr_samples; 414 413 ··· 447 446 static void ab8500_fg_fill_cap_sample(struct ab8500_fg *di, int sample) 448 447 { 449 448 int i; 450 - struct timespec ts; 449 + struct timespec64 ts64; 451 450 struct ab8500_fg_avg_cap *avg = &di->avg_cap; 452 451 453 - getnstimeofday(&ts); 452 + getnstimeofday64(&ts64); 454 453 455 454 for (i = 0; i < NBR_AVG_SAMPLES; i++) { 456 455 avg->samples[i] = sample; 457 - avg->time_stamps[i] = ts.tv_sec; 456 + avg->time_stamps[i] = ts64.tv_sec; 458 457 } 459 458 460 459 avg->pos = 0;
+15 -8
drivers/power/bq2415x_charger.c
··· 1579 1579 if (np) { 1580 1580 bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); 1581 1581 1582 - if (!bq->notify_psy) 1583 - return -EPROBE_DEFER; 1582 + if (IS_ERR(bq->notify_psy)) { 1583 + dev_info(&client->dev, 1584 + "no 'ti,usb-charger-detection' property (err=%ld)\n", 1585 + PTR_ERR(bq->notify_psy)); 1586 + bq->notify_psy = NULL; 1587 + } else if (!bq->notify_psy) { 1588 + ret = -EPROBE_DEFER; 1589 + goto error_2; 1590 + } 1584 1591 } 1585 1592 else if (pdata->notify_device) 1586 1593 bq->notify_psy = power_supply_get_by_name(pdata->notify_device); ··· 1609 1602 ret = of_property_read_u32(np, "ti,current-limit", 1610 1603 &bq->init_data.current_limit); 1611 1604 if (ret) 1612 - return ret; 1605 + goto error_2; 1613 1606 ret = of_property_read_u32(np, "ti,weak-battery-voltage", 1614 1607 &bq->init_data.weak_battery_voltage); 1615 1608 if (ret) 1616 - return ret; 1609 + goto error_2; 1617 1610 ret = of_property_read_u32(np, "ti,battery-regulation-voltage", 1618 1611 &bq->init_data.battery_regulation_voltage); 1619 1612 if (ret) 1620 - return ret; 1613 + goto error_2; 1621 1614 ret = of_property_read_u32(np, "ti,charge-current", 1622 1615 &bq->init_data.charge_current); 1623 1616 if (ret) 1624 - return ret; 1617 + goto error_2; 1625 1618 ret = of_property_read_u32(np, "ti,termination-current", 1626 1619 &bq->init_data.termination_current); 1627 1620 if (ret) 1628 - return ret; 1621 + goto error_2; 1629 1622 ret = of_property_read_u32(np, "ti,resistor-sense", 1630 1623 &bq->init_data.resistor_sense); 1631 1624 if (ret) 1632 - return ret; 1625 + goto error_2; 1633 1626 } else { 1634 1627 memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); 1635 1628 }
+111 -53
drivers/power/charger-manager.c
··· 97 97 static bool is_batt_present(struct charger_manager *cm) 98 98 { 99 99 union power_supply_propval val; 100 + struct power_supply *psy; 100 101 bool present = false; 101 102 int i, ret; 102 103 ··· 108 107 case CM_NO_BATTERY: 109 108 break; 110 109 case CM_FUEL_GAUGE: 111 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 110 + psy = power_supply_get_by_name(cm->desc->psy_fuel_gauge); 111 + if (!psy) 112 + break; 113 + 114 + ret = psy->get_property(psy, 112 115 POWER_SUPPLY_PROP_PRESENT, &val); 113 116 if (ret == 0 && val.intval) 114 117 present = true; 115 118 break; 116 119 case CM_CHARGER_STAT: 117 - for (i = 0; cm->charger_stat[i]; i++) { 118 - ret = cm->charger_stat[i]->get_property( 119 - cm->charger_stat[i], 120 - POWER_SUPPLY_PROP_PRESENT, &val); 120 + for (i = 0; cm->desc->psy_charger_stat[i]; i++) { 121 + psy = power_supply_get_by_name( 122 + cm->desc->psy_charger_stat[i]); 123 + if (!psy) { 124 + dev_err(cm->dev, "Cannot find power supply \"%s\"\n", 125 + cm->desc->psy_charger_stat[i]); 126 + continue; 127 + } 128 + 129 + ret = psy->get_property(psy, POWER_SUPPLY_PROP_PRESENT, 130 + &val); 121 131 if (ret == 0 && val.intval) { 122 132 present = true; 123 133 break; ··· 151 139 static bool is_ext_pwr_online(struct charger_manager *cm) 152 140 { 153 141 union power_supply_propval val; 142 + struct power_supply *psy; 154 143 bool online = false; 155 144 int i, ret; 156 145 157 146 /* If at least one of them has one, it's yes. */ 158 - for (i = 0; cm->charger_stat[i]; i++) { 159 - ret = cm->charger_stat[i]->get_property( 160 - cm->charger_stat[i], 161 - POWER_SUPPLY_PROP_ONLINE, &val); 147 + for (i = 0; cm->desc->psy_charger_stat[i]; i++) { 148 + psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); 149 + if (!psy) { 150 + dev_err(cm->dev, "Cannot find power supply \"%s\"\n", 151 + cm->desc->psy_charger_stat[i]); 152 + continue; 153 + } 154 + 155 + ret = psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); 162 156 if (ret == 0 && val.intval) { 163 157 online = true; 164 158 break; ··· 185 167 static int get_batt_uV(struct charger_manager *cm, int *uV) 186 168 { 187 169 union power_supply_propval val; 170 + struct power_supply *fuel_gauge; 188 171 int ret; 189 172 190 - if (!cm->fuel_gauge) 173 + fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); 174 + if (!fuel_gauge) 191 175 return -ENODEV; 192 176 193 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 177 + ret = fuel_gauge->get_property(fuel_gauge, 194 178 POWER_SUPPLY_PROP_VOLTAGE_NOW, &val); 195 179 if (ret) 196 180 return ret; ··· 209 189 { 210 190 int i, ret; 211 191 bool charging = false; 192 + struct power_supply *psy; 212 193 union power_supply_propval val; 213 194 214 195 /* If there is no battery, it cannot be charged */ ··· 217 196 return false; 218 197 219 198 /* If at least one of the charger is charging, return yes */ 220 - for (i = 0; cm->charger_stat[i]; i++) { 199 + for (i = 0; cm->desc->psy_charger_stat[i]; i++) { 221 200 /* 1. The charger sholuld not be DISABLED */ 222 201 if (cm->emergency_stop) 223 202 continue; 224 203 if (!cm->charger_enabled) 225 204 continue; 226 205 206 + psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); 207 + if (!psy) { 208 + dev_err(cm->dev, "Cannot find power supply \"%s\"\n", 209 + cm->desc->psy_charger_stat[i]); 210 + continue; 211 + } 212 + 227 213 /* 2. The charger should be online (ext-power) */ 228 - ret = cm->charger_stat[i]->get_property( 229 - cm->charger_stat[i], 230 - POWER_SUPPLY_PROP_ONLINE, &val); 214 + ret = psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); 231 215 if (ret) { 232 216 dev_warn(cm->dev, "Cannot read ONLINE value from %s\n", 233 217 cm->desc->psy_charger_stat[i]); ··· 245 219 * 3. The charger should not be FULL, DISCHARGING, 246 220 * or NOT_CHARGING. 247 221 */ 248 - ret = cm->charger_stat[i]->get_property( 249 - cm->charger_stat[i], 250 - POWER_SUPPLY_PROP_STATUS, &val); 222 + ret = psy->get_property(psy, POWER_SUPPLY_PROP_STATUS, &val); 251 223 if (ret) { 252 224 dev_warn(cm->dev, "Cannot read STATUS value from %s\n", 253 225 cm->desc->psy_charger_stat[i]); ··· 272 248 { 273 249 struct charger_desc *desc = cm->desc; 274 250 union power_supply_propval val; 251 + struct power_supply *fuel_gauge; 275 252 int ret = 0; 276 253 int uV; 277 254 ··· 280 255 if (!is_batt_present(cm)) 281 256 return false; 282 257 283 - if (cm->fuel_gauge && desc->fullbatt_full_capacity > 0) { 258 + fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); 259 + if (!fuel_gauge) 260 + return false; 261 + 262 + if (desc->fullbatt_full_capacity > 0) { 284 263 val.intval = 0; 285 264 286 265 /* Not full if capacity of fuel gauge isn't full */ 287 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 266 + ret = fuel_gauge->get_property(fuel_gauge, 288 267 POWER_SUPPLY_PROP_CHARGE_FULL, &val); 289 268 if (!ret && val.intval > desc->fullbatt_full_capacity) 290 269 return true; ··· 302 273 } 303 274 304 275 /* Full, if the capacity is more than fullbatt_soc */ 305 - if (cm->fuel_gauge && desc->fullbatt_soc > 0) { 276 + if (desc->fullbatt_soc > 0) { 306 277 val.intval = 0; 307 278 308 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 279 + ret = fuel_gauge->get_property(fuel_gauge, 309 280 POWER_SUPPLY_PROP_CAPACITY, &val); 310 281 if (!ret && val.intval >= desc->fullbatt_soc) 311 282 return true; ··· 580 551 return ret; 581 552 } 582 553 554 + static int cm_get_battery_temperature_by_psy(struct charger_manager *cm, 555 + int *temp) 556 + { 557 + struct power_supply *fuel_gauge; 558 + 559 + fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); 560 + if (!fuel_gauge) 561 + return -ENODEV; 562 + 563 + return fuel_gauge->get_property(fuel_gauge, 564 + POWER_SUPPLY_PROP_TEMP, 565 + (union power_supply_propval *)temp); 566 + } 567 + 583 568 static int cm_get_battery_temperature(struct charger_manager *cm, 584 569 int *temp) 585 570 { ··· 603 560 return -ENODEV; 604 561 605 562 #ifdef CONFIG_THERMAL 606 - ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); 607 - if (!ret) 608 - /* Calibrate temperature unit */ 609 - *temp /= 100; 610 - #else 611 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 612 - POWER_SUPPLY_PROP_TEMP, 613 - (union power_supply_propval *)temp); 563 + if (cm->tzd_batt) { 564 + ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); 565 + if (!ret) 566 + /* Calibrate temperature unit */ 567 + *temp /= 100; 568 + } else 614 569 #endif 570 + { 571 + /* if-else continued from CONFIG_THERMAL */ 572 + ret = cm_get_battery_temperature_by_psy(cm, temp); 573 + } 574 + 615 575 return ret; 616 576 } 617 577 ··· 873 827 struct charger_manager *cm = container_of(psy, 874 828 struct charger_manager, charger_psy); 875 829 struct charger_desc *desc = cm->desc; 830 + struct power_supply *fuel_gauge; 876 831 int ret = 0; 877 832 int uV; 878 833 ··· 904 857 ret = get_batt_uV(cm, &val->intval); 905 858 break; 906 859 case POWER_SUPPLY_PROP_CURRENT_NOW: 907 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 860 + fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); 861 + if (!fuel_gauge) { 862 + ret = -ENODEV; 863 + break; 864 + } 865 + ret = fuel_gauge->get_property(fuel_gauge, 908 866 POWER_SUPPLY_PROP_CURRENT_NOW, val); 909 867 break; 910 868 case POWER_SUPPLY_PROP_TEMP: 911 869 case POWER_SUPPLY_PROP_TEMP_AMBIENT: 912 870 return cm_get_battery_temperature(cm, &val->intval); 913 871 case POWER_SUPPLY_PROP_CAPACITY: 914 - if (!cm->fuel_gauge) { 872 + fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); 873 + if (!fuel_gauge) { 915 874 ret = -ENODEV; 916 875 break; 917 876 } ··· 928 875 break; 929 876 } 930 877 931 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 878 + ret = fuel_gauge->get_property(fuel_gauge, 932 879 POWER_SUPPLY_PROP_CAPACITY, val); 933 880 if (ret) 934 881 break; ··· 977 924 break; 978 925 case POWER_SUPPLY_PROP_CHARGE_NOW: 979 926 if (is_charging(cm)) { 980 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 927 + fuel_gauge = power_supply_get_by_name( 928 + cm->desc->psy_fuel_gauge); 929 + if (!fuel_gauge) { 930 + ret = -ENODEV; 931 + break; 932 + } 933 + 934 + ret = fuel_gauge->get_property(fuel_gauge, 981 935 POWER_SUPPLY_PROP_CHARGE_NOW, 982 936 val); 983 937 if (ret) { ··· 1030 970 .properties = default_charger_props, 1031 971 .num_properties = ARRAY_SIZE(default_charger_props), 1032 972 .get_property = charger_get_property, 973 + .no_thermal = true, 1033 974 }; 1034 975 1035 976 /** ··· 1546 1485 return ret; 1547 1486 } 1548 1487 1549 - static int cm_init_thermal_data(struct charger_manager *cm) 1488 + static int cm_init_thermal_data(struct charger_manager *cm, 1489 + struct power_supply *fuel_gauge) 1550 1490 { 1551 1491 struct charger_desc *desc = cm->desc; 1552 1492 union power_supply_propval val; 1553 1493 int ret; 1554 1494 1555 1495 /* Verify whether fuel gauge provides battery temperature */ 1556 - ret = cm->fuel_gauge->get_property(cm->fuel_gauge, 1496 + ret = fuel_gauge->get_property(fuel_gauge, 1557 1497 POWER_SUPPLY_PROP_TEMP, &val); 1558 1498 1559 1499 if (!ret) { ··· 1564 1502 cm->desc->measure_battery_temp = true; 1565 1503 } 1566 1504 #ifdef CONFIG_THERMAL 1567 - cm->tzd_batt = cm->fuel_gauge->tzd; 1568 - 1569 1505 if (ret && desc->thermal_zone) { 1570 1506 cm->tzd_batt = 1571 1507 thermal_zone_get_zone_by_name(desc->thermal_zone); ··· 1726 1666 int ret = 0, i = 0; 1727 1667 int j = 0; 1728 1668 union power_supply_propval val; 1669 + struct power_supply *fuel_gauge; 1729 1670 1730 1671 if (g_desc && !rtc_dev && g_desc->rtc_name) { 1731 1672 rtc_dev = rtc_class_open(g_desc->rtc_name); ··· 1790 1729 while (desc->psy_charger_stat[i]) 1791 1730 i++; 1792 1731 1793 - cm->charger_stat = devm_kzalloc(&pdev->dev, 1794 - sizeof(struct power_supply *) * i, GFP_KERNEL); 1795 - if (!cm->charger_stat) 1796 - return -ENOMEM; 1797 - 1732 + /* Check if charger's supplies are present at probe */ 1798 1733 for (i = 0; desc->psy_charger_stat[i]; i++) { 1799 - cm->charger_stat[i] = power_supply_get_by_name( 1800 - desc->psy_charger_stat[i]); 1801 - if (!cm->charger_stat[i]) { 1734 + struct power_supply *psy; 1735 + 1736 + psy = power_supply_get_by_name(desc->psy_charger_stat[i]); 1737 + if (!psy) { 1802 1738 dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", 1803 1739 desc->psy_charger_stat[i]); 1804 1740 return -ENODEV; 1805 1741 } 1806 1742 } 1807 1743 1808 - cm->fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); 1809 - if (!cm->fuel_gauge) { 1744 + fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); 1745 + if (!fuel_gauge) { 1810 1746 dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", 1811 1747 desc->psy_fuel_gauge); 1812 1748 return -ENODEV; ··· 1846 1788 cm->charger_psy.num_properties = psy_default.num_properties; 1847 1789 1848 1790 /* Find which optional psy-properties are available */ 1849 - if (!cm->fuel_gauge->get_property(cm->fuel_gauge, 1791 + if (!fuel_gauge->get_property(fuel_gauge, 1850 1792 POWER_SUPPLY_PROP_CHARGE_NOW, &val)) { 1851 1793 cm->charger_psy.properties[cm->charger_psy.num_properties] = 1852 1794 POWER_SUPPLY_PROP_CHARGE_NOW; 1853 1795 cm->charger_psy.num_properties++; 1854 1796 } 1855 - if (!cm->fuel_gauge->get_property(cm->fuel_gauge, 1797 + if (!fuel_gauge->get_property(fuel_gauge, 1856 1798 POWER_SUPPLY_PROP_CURRENT_NOW, 1857 1799 &val)) { 1858 1800 cm->charger_psy.properties[cm->charger_psy.num_properties] = ··· 1860 1802 cm->charger_psy.num_properties++; 1861 1803 } 1862 1804 1863 - ret = cm_init_thermal_data(cm); 1805 + ret = cm_init_thermal_data(cm, fuel_gauge); 1864 1806 if (ret) { 1865 1807 dev_err(&pdev->dev, "Failed to initialize thermal data\n"); 1866 1808 cm->desc->measure_battery_temp = false; ··· 2124 2066 int i; 2125 2067 bool found = false; 2126 2068 2127 - for (i = 0; cm->charger_stat[i]; i++) { 2128 - if (psy == cm->charger_stat[i]) { 2069 + for (i = 0; cm->desc->psy_charger_stat[i]; i++) { 2070 + if (!strcmp(psy->name, cm->desc->psy_charger_stat[i])) { 2129 2071 found = true; 2130 2072 break; 2131 2073 }
+3
drivers/power/power_supply_core.c
··· 417 417 { 418 418 int i; 419 419 420 + if (psy->no_thermal) 421 + return 0; 422 + 420 423 /* Register battery zone device psy reports temperature */ 421 424 for (i = 0; i < psy->num_properties; i++) { 422 425 if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) {
-1
drivers/s390/kvm/virtio_ccw.c
··· 888 888 struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev); 889 889 int i; 890 890 struct virtqueue *vq; 891 - struct virtio_driver *drv; 892 891 893 892 if (!vcdev) 894 893 return;
-2
drivers/scsi/bnx2fc/bnx2fc_els.c
··· 480 480 bnx2fc_initiate_cleanup(orig_io_req); 481 481 /* Post a new IO req with the same sc_cmd */ 482 482 BNX2FC_IO_DBG(rec_req, "Post IO request again\n"); 483 - spin_unlock_bh(&tgt->tgt_lock); 484 483 rc = bnx2fc_post_io_req(tgt, new_io_req); 485 - spin_lock_bh(&tgt->tgt_lock); 486 484 if (!rc) 487 485 goto free_frame; 488 486 BNX2FC_IO_DBG(rec_req, "REC: io post err\n");
+7
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
··· 412 412 struct fc_frame_header *fh; 413 413 struct fcoe_rcv_info *fr; 414 414 struct fcoe_percpu_s *bg; 415 + struct sk_buff *tmp_skb; 415 416 unsigned short oxid; 416 417 417 418 interface = container_of(ptype, struct bnx2fc_interface, ··· 424 423 printk(KERN_ERR PFX "bnx2fc_rcv: lport is NULL\n"); 425 424 goto err; 426 425 } 426 + 427 + tmp_skb = skb_share_check(skb, GFP_ATOMIC); 428 + if (!tmp_skb) 429 + goto err; 430 + 431 + skb = tmp_skb; 427 432 428 433 if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { 429 434 printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n");
+10 -9
drivers/scsi/bnx2fc/bnx2fc_io.c
··· 1894 1894 goto exit_qcmd; 1895 1895 } 1896 1896 } 1897 + 1898 + spin_lock_bh(&tgt->tgt_lock); 1899 + 1897 1900 io_req = bnx2fc_cmd_alloc(tgt); 1898 1901 if (!io_req) { 1899 1902 rc = SCSI_MLQUEUE_HOST_BUSY; 1900 - goto exit_qcmd; 1903 + goto exit_qcmd_tgtlock; 1901 1904 } 1902 1905 io_req->sc_cmd = sc_cmd; 1903 1906 1904 1907 if (bnx2fc_post_io_req(tgt, io_req)) { 1905 1908 printk(KERN_ERR PFX "Unable to post io_req\n"); 1906 1909 rc = SCSI_MLQUEUE_HOST_BUSY; 1907 - goto exit_qcmd; 1910 + goto exit_qcmd_tgtlock; 1908 1911 } 1912 + 1913 + exit_qcmd_tgtlock: 1914 + spin_unlock_bh(&tgt->tgt_lock); 1909 1915 exit_qcmd: 1910 1916 return rc; 1911 1917 } ··· 2026 2020 int task_idx, index; 2027 2021 u16 xid; 2028 2022 2023 + /* bnx2fc_post_io_req() is called with the tgt_lock held */ 2024 + 2029 2025 /* Initialize rest of io_req fields */ 2030 2026 io_req->cmd_type = BNX2FC_SCSI_CMD; 2031 2027 io_req->port = port; ··· 2055 2047 /* Build buffer descriptor list for firmware from sg list */ 2056 2048 if (bnx2fc_build_bd_list_from_sg(io_req)) { 2057 2049 printk(KERN_ERR PFX "BD list creation failed\n"); 2058 - spin_lock_bh(&tgt->tgt_lock); 2059 2050 kref_put(&io_req->refcount, bnx2fc_cmd_release); 2060 - spin_unlock_bh(&tgt->tgt_lock); 2061 2051 return -EAGAIN; 2062 2052 } 2063 2053 ··· 2067 2061 task = &(task_page[index]); 2068 2062 bnx2fc_init_task(io_req, task); 2069 2063 2070 - spin_lock_bh(&tgt->tgt_lock); 2071 - 2072 2064 if (tgt->flush_in_prog) { 2073 2065 printk(KERN_ERR PFX "Flush in progress..Host Busy\n"); 2074 2066 kref_put(&io_req->refcount, bnx2fc_cmd_release); 2075 - spin_unlock_bh(&tgt->tgt_lock); 2076 2067 return -EAGAIN; 2077 2068 } 2078 2069 2079 2070 if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) { 2080 2071 printk(KERN_ERR PFX "Session not ready...post_io\n"); 2081 2072 kref_put(&io_req->refcount, bnx2fc_cmd_release); 2082 - spin_unlock_bh(&tgt->tgt_lock); 2083 2073 return -EAGAIN; 2084 2074 } 2085 2075 ··· 2093 2091 2094 2092 /* Ring doorbell */ 2095 2093 bnx2fc_ring_doorbell(tgt); 2096 - spin_unlock_bh(&tgt->tgt_lock); 2097 2094 return 0; 2098 2095 }
+11 -6
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
··· 828 828 if (status == CPL_ERR_RTX_NEG_ADVICE) 829 829 goto rel_skb; 830 830 831 + module_put(THIS_MODULE); 832 + 831 833 if (status && status != CPL_ERR_TCAM_FULL && 832 834 status != CPL_ERR_CONN_EXIST && 833 835 status != CPL_ERR_ARP_MISS) ··· 938 936 cxgbi_sock_get(csk); 939 937 spin_lock_bh(&csk->lock); 940 938 941 - if (!cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) { 942 - cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD); 943 - cxgbi_sock_set_state(csk, CTP_ABORTING); 944 - goto done; 939 + cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD); 940 + 941 + if (!cxgbi_sock_flag(csk, CTPF_TX_DATA_SENT)) { 942 + send_tx_flowc_wr(csk); 943 + cxgbi_sock_set_flag(csk, CTPF_TX_DATA_SENT); 945 944 } 946 945 947 - cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD); 946 + cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD); 947 + cxgbi_sock_set_state(csk, CTP_ABORTING); 948 + 948 949 send_abort_rpl(csk, rst_status); 949 950 950 951 if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { 951 952 csk->err = abort_status_to_errno(csk, req->status, &rst_status); 952 953 cxgbi_sock_closed(csk); 953 954 } 954 - done: 955 + 955 956 spin_unlock_bh(&csk->lock); 956 957 cxgbi_sock_put(csk); 957 958 rel_skb:
+9 -11
drivers/scsi/cxgbi/libcxgbi.c
··· 816 816 read_lock_bh(&csk->callback_lock); 817 817 if (csk->user_data) 818 818 iscsi_conn_failure(csk->user_data, 819 - ISCSI_ERR_CONN_FAILED); 819 + ISCSI_ERR_TCP_CONN_CLOSE); 820 820 read_unlock_bh(&csk->callback_lock); 821 821 } 822 822 } ··· 905 905 { 906 906 cxgbi_sock_get(csk); 907 907 spin_lock_bh(&csk->lock); 908 + 909 + cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); 908 910 if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { 909 - if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_RCVD)) 910 - cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); 911 - else { 912 - cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_RCVD); 913 - cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); 914 - if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) 915 - pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n", 916 - csk, csk->state, csk->flags, csk->tid); 917 - cxgbi_sock_closed(csk); 918 - } 911 + cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); 912 + if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) 913 + pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n", 914 + csk, csk->state, csk->flags, csk->tid); 915 + cxgbi_sock_closed(csk); 919 916 } 917 + 920 918 spin_unlock_bh(&csk->lock); 921 919 cxgbi_sock_put(csk); 922 920 }
+7
drivers/scsi/device_handler/scsi_dh_alua.c
··· 474 474 * LUN Not Ready -- Offline 475 475 */ 476 476 return SUCCESS; 477 + if (sdev->allow_restart && 478 + sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x02) 479 + /* 480 + * if the device is not started, we need to wake 481 + * the error handler to start the motor 482 + */ 483 + return FAILED; 477 484 break; 478 485 case UNIT_ATTENTION: 479 486 if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00)
+1 -1
drivers/scsi/megaraid/megaraid_sas_base.c
··· 4453 4453 instance->msixentry[i].entry = i; 4454 4454 i = pci_enable_msix_range(instance->pdev, instance->msixentry, 4455 4455 1, instance->msix_vectors); 4456 - if (i) 4456 + if (i > 0) 4457 4457 instance->msix_vectors = i; 4458 4458 else 4459 4459 instance->msix_vectors = 0;
+1
drivers/scsi/scsi_devinfo.c
··· 202 202 {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, 203 203 {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, 204 204 {"INSITE", "I325VM", NULL, BLIST_KEY}, 205 + {"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC}, 205 206 {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, 206 207 {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, 207 208 {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
+11 -9
drivers/scsi/scsi_error.c
··· 459 459 if (! scsi_command_normalize_sense(scmd, &sshdr)) 460 460 return FAILED; /* no valid sense data */ 461 461 462 - if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done) 463 - /* 464 - * nasty: for mid-layer issued TURs, we need to return the 465 - * actual sense data without any recovery attempt. For eh 466 - * issued ones, we need to try to recover and interpret 467 - */ 468 - return SUCCESS; 469 - 470 462 scsi_report_sense(sdev, &sshdr); 471 463 472 464 if (scsi_sense_is_deferred(&sshdr)) ··· 473 481 return rc; 474 482 /* handler does not care. Drop down to default handling */ 475 483 } 484 + 485 + if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done) 486 + /* 487 + * nasty: for mid-layer issued TURs, we need to return the 488 + * actual sense data without any recovery attempt. For eh 489 + * issued ones, we need to try to recover and interpret 490 + */ 491 + return SUCCESS; 476 492 477 493 /* 478 494 * Previous logic looked for FILEMARK, EOM or ILI which are ··· 2001 2001 * is no point trying to lock the door of an off-line device. 2002 2002 */ 2003 2003 shost_for_each_device(sdev, shost) { 2004 - if (scsi_device_online(sdev) && sdev->locked) 2004 + if (scsi_device_online(sdev) && sdev->was_reset && sdev->locked) { 2005 2005 scsi_eh_lock_door(sdev); 2006 + sdev->was_reset = 0; 2007 + } 2006 2008 } 2007 2009 2008 2010 /*
+5 -10
drivers/scsi/ufs/ufshcd-pltfrm.c
··· 102 102 clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), 103 103 GFP_KERNEL); 104 104 if (!clkfreq) { 105 - dev_err(dev, "%s: no memory\n", "freq-table-hz"); 106 105 ret = -ENOMEM; 107 106 goto out; 108 107 } ··· 111 112 if (ret && (ret != -EINVAL)) { 112 113 dev_err(dev, "%s: error reading array %d\n", 113 114 "freq-table-hz", ret); 114 - goto free_clkfreq; 115 + return ret; 115 116 } 116 117 117 118 for (i = 0; i < sz; i += 2) { 118 119 ret = of_property_read_string_index(np, 119 120 "clock-names", i/2, (const char **)&name); 120 121 if (ret) 121 - goto free_clkfreq; 122 + goto out; 122 123 123 124 clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); 124 125 if (!clki) { 125 126 ret = -ENOMEM; 126 - goto free_clkfreq; 127 + goto out; 127 128 } 128 129 129 130 clki->min_freq = clkfreq[i]; ··· 133 134 clki->min_freq, clki->max_freq, clki->name); 134 135 list_add_tail(&clki->list, &hba->clk_list_head); 135 136 } 136 - free_clkfreq: 137 - kfree(clkfreq); 138 137 out: 139 138 return ret; 140 139 } ··· 159 162 } 160 163 161 164 vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); 162 - if (!vreg) { 163 - dev_err(dev, "No memory for %s regulator\n", name); 164 - goto out; 165 - } 165 + if (!vreg) 166 + return -ENOMEM; 166 167 167 168 vreg->name = kstrdup(name, GFP_KERNEL); 168 169
+64 -40
drivers/scsi/ufs/ufshcd.c
··· 744 744 if (!ufshcd_is_clkgating_allowed(hba)) 745 745 return; 746 746 device_remove_file(hba->dev, &hba->clk_gating.delay_attr); 747 + cancel_work_sync(&hba->clk_gating.ungate_work); 748 + cancel_delayed_work_sync(&hba->clk_gating.gate_work); 747 749 } 748 750 749 751 /* Must be called with host lock acquired */ ··· 2248 2246 return ret; 2249 2247 } 2250 2248 2249 + /** 2250 + * ufshcd_init_pwr_info - setting the POR (power on reset) 2251 + * values in hba power info 2252 + * @hba: per-adapter instance 2253 + */ 2254 + static void ufshcd_init_pwr_info(struct ufs_hba *hba) 2255 + { 2256 + hba->pwr_info.gear_rx = UFS_PWM_G1; 2257 + hba->pwr_info.gear_tx = UFS_PWM_G1; 2258 + hba->pwr_info.lane_rx = 1; 2259 + hba->pwr_info.lane_tx = 1; 2260 + hba->pwr_info.pwr_rx = SLOWAUTO_MODE; 2261 + hba->pwr_info.pwr_tx = SLOWAUTO_MODE; 2262 + hba->pwr_info.hs_rate = 0; 2263 + } 2264 + 2251 2265 /** 2252 2266 * ufshcd_get_max_pwr_mode - reads the max power mode negotiated with device 2253 2267 * @hba: per-adapter instance ··· 2862 2844 hba = shost_priv(sdev->host); 2863 2845 scsi_deactivate_tcq(sdev, hba->nutrs); 2864 2846 /* Drop the reference as it won't be needed anymore */ 2865 - if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) 2847 + if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) { 2848 + unsigned long flags; 2849 + 2850 + spin_lock_irqsave(hba->host->host_lock, flags); 2866 2851 hba->sdev_ufs_device = NULL; 2852 + spin_unlock_irqrestore(hba->host->host_lock, flags); 2853 + } 2867 2854 } 2868 2855 2869 2856 /** ··· 4085 4062 static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) 4086 4063 { 4087 4064 int ret = 0; 4065 + struct scsi_device *sdev_rpmb; 4066 + struct scsi_device *sdev_boot; 4088 4067 4089 4068 hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, 4090 4069 ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL); ··· 4095 4070 hba->sdev_ufs_device = NULL; 4096 4071 goto out; 4097 4072 } 4073 + scsi_device_put(hba->sdev_ufs_device); 4098 4074 4099 - hba->sdev_boot = __scsi_add_device(hba->host, 0, 0, 4075 + sdev_boot = __scsi_add_device(hba->host, 0, 0, 4100 4076 ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); 4101 - if (IS_ERR(hba->sdev_boot)) { 4102 - ret = PTR_ERR(hba->sdev_boot); 4103 - hba->sdev_boot = NULL; 4077 + if (IS_ERR(sdev_boot)) { 4078 + ret = PTR_ERR(sdev_boot); 4104 4079 goto remove_sdev_ufs_device; 4105 4080 } 4081 + scsi_device_put(sdev_boot); 4106 4082 4107 - hba->sdev_rpmb = __scsi_add_device(hba->host, 0, 0, 4083 + sdev_rpmb = __scsi_add_device(hba->host, 0, 0, 4108 4084 ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); 4109 - if (IS_ERR(hba->sdev_rpmb)) { 4110 - ret = PTR_ERR(hba->sdev_rpmb); 4111 - hba->sdev_rpmb = NULL; 4085 + if (IS_ERR(sdev_rpmb)) { 4086 + ret = PTR_ERR(sdev_rpmb); 4112 4087 goto remove_sdev_boot; 4113 4088 } 4089 + scsi_device_put(sdev_rpmb); 4114 4090 goto out; 4115 4091 4116 4092 remove_sdev_boot: 4117 - scsi_remove_device(hba->sdev_boot); 4093 + scsi_remove_device(sdev_boot); 4118 4094 remove_sdev_ufs_device: 4119 4095 scsi_remove_device(hba->sdev_ufs_device); 4120 4096 out: 4121 4097 return ret; 4122 - } 4123 - 4124 - /** 4125 - * ufshcd_scsi_remove_wlus - Removes the W-LUs which were added by 4126 - * ufshcd_scsi_add_wlus() 4127 - * @hba: per-adapter instance 4128 - * 4129 - */ 4130 - static void ufshcd_scsi_remove_wlus(struct ufs_hba *hba) 4131 - { 4132 - if (hba->sdev_ufs_device) { 4133 - scsi_remove_device(hba->sdev_ufs_device); 4134 - hba->sdev_ufs_device = NULL; 4135 - } 4136 - 4137 - if (hba->sdev_boot) { 4138 - scsi_remove_device(hba->sdev_boot); 4139 - hba->sdev_boot = NULL; 4140 - } 4141 - 4142 - if (hba->sdev_rpmb) { 4143 - scsi_remove_device(hba->sdev_rpmb); 4144 - hba->sdev_rpmb = NULL; 4145 - } 4146 4098 } 4147 4099 4148 4100 /** ··· 4135 4133 ret = ufshcd_link_startup(hba); 4136 4134 if (ret) 4137 4135 goto out; 4136 + 4137 + ufshcd_init_pwr_info(hba); 4138 4138 4139 4139 /* UniPro link is active now */ 4140 4140 ufshcd_set_link_active(hba); ··· 4268 4264 static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, 4269 4265 struct ufs_vreg *vreg) 4270 4266 { 4267 + if (!vreg) 4268 + return 0; 4269 + 4271 4270 return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); 4272 4271 } 4273 4272 4274 4273 static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, 4275 4274 struct ufs_vreg *vreg) 4276 4275 { 4276 + if (!vreg) 4277 + return 0; 4278 + 4277 4279 return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); 4278 4280 } 4279 4281 ··· 4481 4471 if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled) 4482 4472 clk_disable_unprepare(clki->clk); 4483 4473 } 4484 - } else if (!ret && on) { 4474 + } else if (on) { 4485 4475 spin_lock_irqsave(hba->host->host_lock, flags); 4486 4476 hba->clk_gating.state = CLKS_ON; 4487 4477 spin_unlock_irqrestore(hba->host->host_lock, flags); ··· 4685 4675 { 4686 4676 unsigned char cmd[6] = { START_STOP }; 4687 4677 struct scsi_sense_hdr sshdr; 4688 - struct scsi_device *sdp = hba->sdev_ufs_device; 4678 + struct scsi_device *sdp; 4679 + unsigned long flags; 4689 4680 int ret; 4690 4681 4691 - if (!sdp || !scsi_device_online(sdp)) 4692 - return -ENODEV; 4682 + spin_lock_irqsave(hba->host->host_lock, flags); 4683 + sdp = hba->sdev_ufs_device; 4684 + if (sdp) { 4685 + ret = scsi_device_get(sdp); 4686 + if (!ret && !scsi_device_online(sdp)) { 4687 + ret = -ENODEV; 4688 + scsi_device_put(sdp); 4689 + } 4690 + } else { 4691 + ret = -ENODEV; 4692 + } 4693 + spin_unlock_irqrestore(hba->host->host_lock, flags); 4694 + 4695 + if (ret) 4696 + return ret; 4693 4697 4694 4698 /* 4695 4699 * If scsi commands fail, the scsi mid-layer schedules scsi error- ··· 4742 4718 if (!ret) 4743 4719 hba->curr_dev_pwr_mode = pwr_mode; 4744 4720 out: 4721 + scsi_device_put(sdp); 4745 4722 hba->host->eh_noresume = 0; 4746 4723 return ret; 4747 4724 } ··· 5112 5087 int ret = 0; 5113 5088 5114 5089 if (!hba || !hba->is_powered) 5115 - goto out; 5090 + return 0; 5116 5091 5117 5092 if (pm_runtime_suspended(hba->dev)) { 5118 5093 if (hba->rpm_lvl == hba->spm_lvl) ··· 5256 5231 void ufshcd_remove(struct ufs_hba *hba) 5257 5232 { 5258 5233 scsi_remove_host(hba->host); 5259 - ufshcd_scsi_remove_wlus(hba); 5260 5234 /* disable interrupts */ 5261 5235 ufshcd_disable_intr(hba, hba->intr_mask); 5262 5236 ufshcd_hba_stop(hba);
-2
drivers/scsi/ufs/ufshcd.h
··· 392 392 * "UFS device" W-LU. 393 393 */ 394 394 struct scsi_device *sdev_ufs_device; 395 - struct scsi_device *sdev_rpmb; 396 - struct scsi_device *sdev_boot; 397 395 398 396 enum ufs_dev_pwr_mode curr_dev_pwr_mode; 399 397 enum uic_link_state uic_link_state;
+1 -5
drivers/spi/spi-dw.c
··· 376 376 chip = dws->cur_chip; 377 377 spi = message->spi; 378 378 379 - if (unlikely(!chip->clk_div)) 380 - chip->clk_div = dws->max_freq / chip->speed_hz; 381 - 382 379 if (message->state == ERROR_STATE) { 383 380 message->status = -EIO; 384 381 goto early_exit; ··· 416 419 if (transfer->speed_hz) { 417 420 speed = chip->speed_hz; 418 421 419 - if (transfer->speed_hz != speed) { 422 + if ((transfer->speed_hz != speed) || (!chip->clk_div)) { 420 423 speed = transfer->speed_hz; 421 424 422 425 /* clk_div doesn't support odd number */ ··· 578 581 dev_err(&spi->dev, "No max speed HZ parameter\n"); 579 582 return -EINVAL; 580 583 } 581 - chip->speed_hz = spi->max_speed_hz; 582 584 583 585 chip->tmode = 0; /* Tx & Rx */ 584 586 /* Default SPI mode is SCPOL = 0, SCPH = 0 */
+2 -2
drivers/spi/spi-sirf.c
··· 562 562 563 563 sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); 564 564 txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | 565 - sspi->word_width; 565 + (sspi->word_width >> 1); 566 566 rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | 567 - sspi->word_width; 567 + (sspi->word_width >> 1); 568 568 569 569 if (!(spi->mode & SPI_CS_HIGH)) 570 570 regval |= SIRFSOC_SPI_CS_IDLE_STAT;
+3 -3
drivers/spi/spi.c
··· 615 615 sg_free_table(sgt); 616 616 return -ENOMEM; 617 617 } 618 - sg_buf = page_address(vm_page) + 619 - ((size_t)buf & ~PAGE_MASK); 618 + sg_set_page(&sgt->sgl[i], vm_page, 619 + min, offset_in_page(buf)); 620 620 } else { 621 621 sg_buf = buf; 622 + sg_set_buf(&sgt->sgl[i], sg_buf, min); 622 623 } 623 624 624 - sg_set_buf(&sgt->sgl[i], sg_buf, min); 625 625 626 626 buf += min; 627 627 len -= min;
+11 -11
drivers/staging/rtl8188eu/core/rtw_cmd.c
··· 275 275 if (check_fwstate(pmlmepriv, _FW_LINKED) == true) 276 276 rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); 277 277 278 - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 278 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 279 279 if (ph2c == NULL) 280 280 return _FAIL; 281 281 282 - psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL); 282 + psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); 283 283 if (psurveyPara == NULL) { 284 284 kfree(ph2c); 285 285 return _FAIL; ··· 405 405 else 406 406 RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); 407 407 408 - pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 408 + pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 409 409 if (pcmd == NULL) { 410 410 res = _FAIL; 411 411 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); ··· 755 755 u8 res = _SUCCESS; 756 756 757 757 758 - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 758 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 759 759 if (ph2c == NULL) { 760 760 res = _FAIL; 761 761 goto exit; 762 762 } 763 763 764 - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); 764 + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 765 765 if (pdrvextra_cmd_parm == NULL) { 766 766 kfree(ph2c); 767 767 res = _FAIL; ··· 967 967 u8 res = _SUCCESS; 968 968 969 969 if (enqueue) { 970 - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 970 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 971 971 if (ph2c == NULL) { 972 972 res = _FAIL; 973 973 goto exit; 974 974 } 975 975 976 - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); 976 + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 977 977 if (pdrvextra_cmd_parm == NULL) { 978 978 kfree(ph2c); 979 979 res = _FAIL; ··· 1010 1010 1011 1011 u8 res = _SUCCESS; 1012 1012 1013 - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 1013 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1014 1014 if (ph2c == NULL) { 1015 1015 res = _FAIL; 1016 1016 goto exit; 1017 1017 } 1018 1018 1019 - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); 1019 + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 1020 1020 if (pdrvextra_cmd_parm == NULL) { 1021 1021 kfree(ph2c); 1022 1022 res = _FAIL; ··· 1088 1088 1089 1089 u8 res = _SUCCESS; 1090 1090 1091 - ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 1091 + ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 1092 1092 if (ppscmd == NULL) { 1093 1093 res = _FAIL; 1094 1094 goto exit; 1095 1095 } 1096 1096 1097 - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); 1097 + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); 1098 1098 if (pdrvextra_cmd_parm == NULL) { 1099 1099 kfree(ppscmd); 1100 1100 res = _FAIL;
+6 -6
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
··· 4241 4241 pcmdpriv = &padapter->cmdpriv; 4242 4242 4243 4243 4244 - pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 4244 + pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 4245 4245 if (pcmd_obj == NULL) 4246 4246 return; 4247 4247 4248 4248 cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); 4249 - pevtcmd = kzalloc(cmdsz, GFP_KERNEL); 4249 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); 4250 4250 if (pevtcmd == NULL) { 4251 4251 kfree(pcmd_obj); 4252 4252 return; ··· 4339 4339 struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4340 4340 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 4341 4341 4342 - pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 4342 + pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 4343 4343 if (pcmd_obj == NULL) 4344 4344 return; 4345 4345 4346 4346 cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); 4347 - pevtcmd = kzalloc(cmdsz, GFP_KERNEL); 4347 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); 4348 4348 if (pevtcmd == NULL) { 4349 4349 kfree(pcmd_obj); 4350 4350 return; ··· 4854 4854 pmlmeext->scan_abort = false;/* reset */ 4855 4855 } 4856 4856 4857 - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); 4857 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); 4858 4858 if (ph2c == NULL) 4859 4859 goto exit_survey_timer_hdl; 4860 4860 4861 - psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL); 4861 + psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); 4862 4862 if (psurveyPara == NULL) { 4863 4863 kfree(ph2c); 4864 4864 goto exit_survey_timer_hdl;
+1 -1
drivers/staging/rtl8188eu/core/rtw_wlan_util.c
··· 935 935 return true; 936 936 } 937 937 938 - bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL); 938 + bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); 939 939 940 940 subtype = GetFrameSubType(pframe) >> 4; 941 941
+1
drivers/staging/rtl8188eu/os_dep/usb_intf.c
··· 47 47 {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ 48 48 {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ 49 49 {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ 50 + {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ 50 51 {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ 51 52 {} /* Terminating entry */ 52 53 };
+1 -1
drivers/target/iscsi/iscsi_target.c
··· 3491 3491 len = sprintf(buf, "TargetAddress=" 3492 3492 "%s:%hu,%hu", 3493 3493 inaddr_any ? conn->local_ip : np->np_ip, 3494 - inaddr_any ? conn->local_port : np->np_port, 3494 + np->np_port, 3495 3495 tpg->tpgt); 3496 3496 len += 1; 3497 3497
+5 -4
drivers/target/target_core_pr.c
··· 2738 2738 struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; 2739 2739 struct t10_reservation *pr_tmpl = &dev->t10_pr; 2740 2740 u32 pr_res_mapped_lun = 0; 2741 - int all_reg = 0, calling_it_nexus = 0, released_regs = 0; 2741 + int all_reg = 0, calling_it_nexus = 0; 2742 + bool sa_res_key_unmatched = sa_res_key != 0; 2742 2743 int prh_type = 0, prh_scope = 0; 2743 2744 2744 2745 if (!se_sess) ··· 2814 2813 if (!all_reg) { 2815 2814 if (pr_reg->pr_res_key != sa_res_key) 2816 2815 continue; 2816 + sa_res_key_unmatched = false; 2817 2817 2818 2818 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; 2819 2819 pr_reg_nacl = pr_reg->pr_reg_nacl; ··· 2822 2820 __core_scsi3_free_registration(dev, pr_reg, 2823 2821 (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : 2824 2822 NULL, calling_it_nexus); 2825 - released_regs++; 2826 2823 } else { 2827 2824 /* 2828 2825 * Case for any existing all registrants type ··· 2839 2838 if ((sa_res_key) && 2840 2839 (pr_reg->pr_res_key != sa_res_key)) 2841 2840 continue; 2841 + sa_res_key_unmatched = false; 2842 2842 2843 2843 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; 2844 2844 if (calling_it_nexus) ··· 2850 2848 __core_scsi3_free_registration(dev, pr_reg, 2851 2849 (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : 2852 2850 NULL, 0); 2853 - released_regs++; 2854 2851 } 2855 2852 if (!calling_it_nexus) 2856 2853 core_scsi3_ua_allocate(pr_reg_nacl, ··· 2864 2863 * registered reservation key, then the device server shall 2865 2864 * complete the command with RESERVATION CONFLICT status. 2866 2865 */ 2867 - if (!released_regs) { 2866 + if (sa_res_key_unmatched) { 2868 2867 spin_unlock(&dev->dev_reservation_lock); 2869 2868 core_scsi3_put_pr_reg(pr_reg_n); 2870 2869 return TCM_RESERVATION_CONFLICT;
+1 -1
drivers/target/target_core_transport.c
··· 2292 2292 * and let it call back once the write buffers are ready. 2293 2293 */ 2294 2294 target_add_to_state_list(cmd); 2295 - if (cmd->data_direction != DMA_TO_DEVICE) { 2295 + if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) { 2296 2296 target_execute_cmd(cmd); 2297 2297 return 0; 2298 2298 }
+21 -16
drivers/thermal/cpu_cooling.c
··· 50 50 unsigned int cpufreq_state; 51 51 unsigned int cpufreq_val; 52 52 struct cpumask allowed_cpus; 53 + struct list_head node; 53 54 }; 54 55 static DEFINE_IDR(cpufreq_idr); 55 56 static DEFINE_MUTEX(cooling_cpufreq_lock); 56 57 57 58 static unsigned int cpufreq_dev_count; 58 59 59 - /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ 60 - #define NOTIFY_INVALID NULL 61 - static struct cpufreq_cooling_device *notify_device; 60 + static LIST_HEAD(cpufreq_dev_list); 62 61 63 62 /** 64 63 * get_idr - function to get a unique id. ··· 286 287 287 288 cpufreq_device->cpufreq_state = cooling_state; 288 289 cpufreq_device->cpufreq_val = clip_freq; 289 - notify_device = cpufreq_device; 290 290 291 291 for_each_cpu(cpuid, mask) { 292 292 if (is_cpufreq_valid(cpuid)) 293 293 cpufreq_update_policy(cpuid); 294 294 } 295 - 296 - notify_device = NOTIFY_INVALID; 297 295 298 296 return 0; 299 297 } ··· 312 316 { 313 317 struct cpufreq_policy *policy = data; 314 318 unsigned long max_freq = 0; 319 + struct cpufreq_cooling_device *cpufreq_dev; 315 320 316 - if (event != CPUFREQ_ADJUST || notify_device == NOTIFY_INVALID) 321 + if (event != CPUFREQ_ADJUST) 317 322 return 0; 318 323 319 - if (cpumask_test_cpu(policy->cpu, &notify_device->allowed_cpus)) 320 - max_freq = notify_device->cpufreq_val; 321 - else 322 - return 0; 324 + mutex_lock(&cooling_cpufreq_lock); 325 + list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { 326 + if (!cpumask_test_cpu(policy->cpu, 327 + &cpufreq_dev->allowed_cpus)) 328 + continue; 323 329 324 - /* Never exceed user_policy.max */ 325 - if (max_freq > policy->user_policy.max) 326 - max_freq = policy->user_policy.max; 330 + if (!cpufreq_dev->cpufreq_val) 331 + cpufreq_dev->cpufreq_val = get_cpu_frequency( 332 + cpumask_any(&cpufreq_dev->allowed_cpus), 333 + cpufreq_dev->cpufreq_state); 327 334 328 - if (policy->max != max_freq) 329 - cpufreq_verify_within_limits(policy, 0, max_freq); 335 + max_freq = cpufreq_dev->cpufreq_val; 336 + 337 + if (policy->max != max_freq) 338 + cpufreq_verify_within_limits(policy, 0, max_freq); 339 + } 340 + mutex_unlock(&cooling_cpufreq_lock); 330 341 331 342 return 0; 332 343 } ··· 489 486 cpufreq_register_notifier(&thermal_cpufreq_notifier_block, 490 487 CPUFREQ_POLICY_NOTIFIER); 491 488 cpufreq_dev_count++; 489 + list_add(&cpufreq_dev->node, &cpufreq_dev_list); 492 490 493 491 mutex_unlock(&cooling_cpufreq_lock); 494 492 ··· 553 549 554 550 cpufreq_dev = cdev->devdata; 555 551 mutex_lock(&cooling_cpufreq_lock); 552 + list_del(&cpufreq_dev->node); 556 553 cpufreq_dev_count--; 557 554 558 555 /* Unregister the notifier for the last cpufreq cooling device */
+29 -16
drivers/thermal/imx_thermal.c
··· 459 459 int measure_freq; 460 460 int ret; 461 461 462 + if (!cpufreq_get_current_driver()) { 463 + dev_dbg(&pdev->dev, "no cpufreq driver!"); 464 + return -EPROBE_DEFER; 465 + } 462 466 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 463 467 if (!data) 464 468 return -ENOMEM; ··· 525 521 return ret; 526 522 } 527 523 524 + data->thermal_clk = devm_clk_get(&pdev->dev, NULL); 525 + if (IS_ERR(data->thermal_clk)) { 526 + ret = PTR_ERR(data->thermal_clk); 527 + if (ret != -EPROBE_DEFER) 528 + dev_err(&pdev->dev, 529 + "failed to get thermal clk: %d\n", ret); 530 + cpufreq_cooling_unregister(data->cdev); 531 + return ret; 532 + } 533 + 534 + /* 535 + * Thermal sensor needs clk on to get correct value, normally 536 + * we should enable its clk before taking measurement and disable 537 + * clk after measurement is done, but if alarm function is enabled, 538 + * hardware will auto measure the temperature periodically, so we 539 + * need to keep the clk always on for alarm function. 540 + */ 541 + ret = clk_prepare_enable(data->thermal_clk); 542 + if (ret) { 543 + dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret); 544 + cpufreq_cooling_unregister(data->cdev); 545 + return ret; 546 + } 547 + 528 548 data->tz = thermal_zone_device_register("imx_thermal_zone", 529 549 IMX_TRIP_NUM, 530 550 BIT(IMX_TRIP_PASSIVE), data, ··· 559 531 ret = PTR_ERR(data->tz); 560 532 dev_err(&pdev->dev, 561 533 "failed to register thermal zone device %d\n", ret); 534 + clk_disable_unprepare(data->thermal_clk); 562 535 cpufreq_cooling_unregister(data->cdev); 563 536 return ret; 564 - } 565 - 566 - data->thermal_clk = devm_clk_get(&pdev->dev, NULL); 567 - if (IS_ERR(data->thermal_clk)) { 568 - dev_warn(&pdev->dev, "failed to get thermal clk!\n"); 569 - } else { 570 - /* 571 - * Thermal sensor needs clk on to get correct value, normally 572 - * we should enable its clk before taking measurement and disable 573 - * clk after measurement is done, but if alarm function is enabled, 574 - * hardware will auto measure the temperature periodically, so we 575 - * need to keep the clk always on for alarm function. 576 - */ 577 - ret = clk_prepare_enable(data->thermal_clk); 578 - if (ret) 579 - dev_warn(&pdev->dev, "failed to enable thermal clk: %d\n", ret); 580 537 } 581 538 582 539 /* Enable measurements at ~ 10 Hz */
+7 -1
drivers/thermal/int340x_thermal/int3403_thermal.c
··· 92 92 if (ACPI_FAILURE(status)) 93 93 return -EIO; 94 94 95 - *temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET); 95 + /* 96 + * Thermal hysteresis represents a temperature difference. 97 + * Kelvin and Celsius have same degree size. So the 98 + * conversion here between tenths of degree Kelvin unit 99 + * and Milli-Celsius unit is just to multiply 100. 100 + */ 101 + *temp = hyst * 100; 96 102 97 103 return 0; 98 104 }
+3 -6
drivers/thermal/samsung/exynos_thermal_common.c
··· 417 417 418 418 th_zone = sensor_conf->pzone_data; 419 419 420 - if (th_zone->therm_dev) 421 - thermal_zone_device_unregister(th_zone->therm_dev); 420 + thermal_zone_device_unregister(th_zone->therm_dev); 422 421 423 - for (i = 0; i < th_zone->cool_dev_size; i++) { 424 - if (th_zone->cool_dev[i]) 425 - cpufreq_cooling_unregister(th_zone->cool_dev[i]); 426 - } 422 + for (i = 0; i < th_zone->cool_dev_size; ++i) 423 + cpufreq_cooling_unregister(th_zone->cool_dev[i]); 427 424 428 425 dev_info(sensor_conf->dev, 429 426 "Exynos: Kernel Thermal management unregistered\n");
-1
drivers/thermal/samsung/exynos_tmu_data.c
··· 264 264 static const struct exynos_tmu_registers exynos5260_tmu_registers = { 265 265 .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, 266 266 .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, 267 - .tmu_ctrl = EXYNOS_TMU_REG_CONTROL1, 268 267 .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, 269 268 .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, 270 269 .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
-1
drivers/thermal/samsung/exynos_tmu_data.h
··· 75 75 #define EXYNOS_MAX_TRIGGER_PER_REG 4 76 76 77 77 /* Exynos5260 specific */ 78 - #define EXYNOS_TMU_REG_CONTROL1 0x24 79 78 #define EXYNOS5260_TMU_REG_INTEN 0xC0 80 79 #define EXYNOS5260_TMU_REG_INTSTAT 0xC4 81 80 #define EXYNOS5260_TMU_REG_INTCLEAR 0xC8
+3
drivers/thermal/st/st_thermal.c
··· 275 275 } 276 276 EXPORT_SYMBOL_GPL(st_thermal_unregister); 277 277 278 + #ifdef CONFIG_PM_SLEEP 278 279 static int st_thermal_suspend(struct device *dev) 279 280 { 280 281 struct platform_device *pdev = to_platform_device(dev); ··· 306 305 307 306 return 0; 308 307 } 308 + #endif 309 + 309 310 SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); 310 311 EXPORT_SYMBOL_GPL(st_thermal_pm_ops); 311 312
-27
drivers/tty/serial/of_serial.c
··· 240 240 return 0; 241 241 } 242 242 243 - #ifdef CONFIG_PM_SLEEP 244 - static int of_serial_suspend(struct device *dev) 245 - { 246 - struct of_serial_info *info = dev_get_drvdata(dev); 247 - 248 - serial8250_suspend_port(info->line); 249 - if (info->clk) 250 - clk_disable_unprepare(info->clk); 251 - 252 - return 0; 253 - } 254 - 255 - static int of_serial_resume(struct device *dev) 256 - { 257 - struct of_serial_info *info = dev_get_drvdata(dev); 258 - 259 - if (info->clk) 260 - clk_prepare_enable(info->clk); 261 - 262 - serial8250_resume_port(info->line); 263 - 264 - return 0; 265 - } 266 - #endif 267 - static SIMPLE_DEV_PM_OPS(of_serial_pm_ops, of_serial_suspend, of_serial_resume); 268 - 269 243 /* 270 244 * A few common types, add more as needed. 271 245 */ ··· 271 297 .name = "of_serial", 272 298 .owner = THIS_MODULE, 273 299 .of_match_table = of_platform_serial_table, 274 - .pm = &of_serial_pm_ops, 275 300 }, 276 301 .probe = of_platform_serial_probe, 277 302 .remove = of_platform_serial_remove,
+3
drivers/usb/core/quirks.c
··· 44 44 /* Creative SB Audigy 2 NX */ 45 45 { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, 46 46 47 + /* Microsoft Wireless Laser Mouse 6000 Receiver */ 48 + { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, 49 + 47 50 /* Microsoft LifeCam-VX700 v2.0 */ 48 51 { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, 49 52
+4 -4
drivers/usb/dwc3/ep0.c
··· 791 791 792 792 trb = dwc->ep0_trb; 793 793 794 + r = next_request(&ep0->request_list); 795 + if (!r) 796 + return; 797 + 794 798 status = DWC3_TRB_SIZE_TRBSTS(trb->size); 795 799 if (status == DWC3_TRBSTS_SETUP_PENDING) { 796 800 dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); ··· 804 800 805 801 return; 806 802 } 807 - 808 - r = next_request(&ep0->request_list); 809 - if (!r) 810 - return; 811 803 812 804 ur = &r->request; 813 805
+1 -4
drivers/usb/host/xhci-hub.c
··· 22 22 23 23 24 24 #include <linux/slab.h> 25 - #include <linux/device.h> 26 25 #include <asm/unaligned.h> 27 26 28 27 #include "xhci.h" ··· 1148 1149 * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME 1149 1150 * is enabled, so also enable remote wake here. 1150 1151 */ 1151 - if (hcd->self.root_hub->do_remote_wakeup 1152 - && device_may_wakeup(hcd->self.controller)) { 1153 - 1152 + if (hcd->self.root_hub->do_remote_wakeup) { 1154 1153 if (t1 & PORT_CONNECT) { 1155 1154 t2 |= PORT_WKOC_E | PORT_WKDISC_E; 1156 1155 t2 &= ~PORT_WKCONN_E;
+1 -1
drivers/usb/host/xhci-pci.c
··· 281 281 if (xhci->quirks & XHCI_COMP_MODE_QUIRK) 282 282 pdev->no_d3cold = true; 283 283 284 - return xhci_suspend(xhci); 284 + return xhci_suspend(xhci, do_wakeup); 285 285 } 286 286 287 287 static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
+9 -1
drivers/usb/host/xhci-plat.c
··· 204 204 struct usb_hcd *hcd = dev_get_drvdata(dev); 205 205 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 206 206 207 - return xhci_suspend(xhci); 207 + /* 208 + * xhci_suspend() needs `do_wakeup` to know whether host is allowed 209 + * to do wakeup during suspend. Since xhci_plat_suspend is currently 210 + * only designed for system suspend, device_may_wakeup() is enough 211 + * to dertermine whether host is allowed to do wakeup. Need to 212 + * reconsider this when xhci_plat_suspend enlarges its scope, e.g., 213 + * also applies to runtime suspend. 214 + */ 215 + return xhci_suspend(xhci, device_may_wakeup(dev)); 208 216 } 209 217 210 218 static int xhci_plat_resume(struct device *dev)
+11 -32
drivers/usb/host/xhci-ring.c
··· 1067 1067 false); 1068 1068 xhci_ring_cmd_db(xhci); 1069 1069 } else { 1070 - /* Clear our internal halted state and restart the ring(s) */ 1070 + /* Clear our internal halted state */ 1071 1071 xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; 1072 - ring_doorbell_for_active_rings(xhci, slot_id, ep_index); 1073 1072 } 1074 1073 } 1075 1074 ··· 1822 1823 ep->stopped_td = td; 1823 1824 return 0; 1824 1825 } else { 1825 - if (trb_comp_code == COMP_STALL) { 1826 - /* The transfer is completed from the driver's 1827 - * perspective, but we need to issue a set dequeue 1828 - * command for this stalled endpoint to move the dequeue 1829 - * pointer past the TD. We can't do that here because 1830 - * the halt condition must be cleared first. Let the 1831 - * USB class driver clear the stall later. 1832 - */ 1833 - ep->stopped_td = td; 1834 - ep->stopped_stream = ep_ring->stream_id; 1835 - } else if (xhci_requires_manual_halt_cleanup(xhci, 1836 - ep_ctx, trb_comp_code)) { 1837 - /* Other types of errors halt the endpoint, but the 1838 - * class driver doesn't call usb_reset_endpoint() unless 1839 - * the error is -EPIPE. Clear the halted status in the 1840 - * xHCI hardware manually. 1826 + if (trb_comp_code == COMP_STALL || 1827 + xhci_requires_manual_halt_cleanup(xhci, ep_ctx, 1828 + trb_comp_code)) { 1829 + /* Issue a reset endpoint command to clear the host side 1830 + * halt, followed by a set dequeue command to move the 1831 + * dequeue pointer past the TD. 1832 + * The class driver clears the device side halt later. 1841 1833 */ 1842 1834 xhci_cleanup_halted_endpoint(xhci, 1843 1835 slot_id, ep_index, ep_ring->stream_id, ··· 1948 1958 else 1949 1959 td->urb->actual_length = 0; 1950 1960 1951 - xhci_cleanup_halted_endpoint(xhci, 1952 - slot_id, ep_index, 0, td, event_trb); 1953 - return finish_td(xhci, td, event_trb, event, ep, status, true); 1961 + return finish_td(xhci, td, event_trb, event, ep, status, false); 1954 1962 } 1955 1963 /* 1956 1964 * Did we transfer any data, despite the errors that might have ··· 2507 2519 if (ret) { 2508 2520 urb = td->urb; 2509 2521 urb_priv = urb->hcpriv; 2510 - /* Leave the TD around for the reset endpoint function 2511 - * to use(but only if it's not a control endpoint, 2512 - * since we already queued the Set TR dequeue pointer 2513 - * command for stalled control endpoints). 2514 - */ 2515 - if (usb_endpoint_xfer_control(&urb->ep->desc) || 2516 - (trb_comp_code != COMP_STALL && 2517 - trb_comp_code != COMP_BABBLE)) 2518 - xhci_urb_free_priv(xhci, urb_priv); 2519 - else 2520 - kfree(urb_priv); 2522 + 2523 + xhci_urb_free_priv(xhci, urb_priv); 2521 2524 2522 2525 usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); 2523 2526 if ((urb->actual_length != urb->transfer_buffer_length &&
+56 -51
drivers/usb/host/xhci.c
··· 35 35 #define DRIVER_AUTHOR "Sarah Sharp" 36 36 #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" 37 37 38 + #define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E) 39 + 38 40 /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */ 39 41 static int link_quirk; 40 42 module_param(link_quirk, int, S_IRUGO | S_IWUSR); ··· 853 851 xhci_set_cmd_ring_deq(xhci); 854 852 } 855 853 854 + static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) 855 + { 856 + int port_index; 857 + __le32 __iomem **port_array; 858 + unsigned long flags; 859 + u32 t1, t2; 860 + 861 + spin_lock_irqsave(&xhci->lock, flags); 862 + 863 + /* disble usb3 ports Wake bits*/ 864 + port_index = xhci->num_usb3_ports; 865 + port_array = xhci->usb3_ports; 866 + while (port_index--) { 867 + t1 = readl(port_array[port_index]); 868 + t1 = xhci_port_state_to_neutral(t1); 869 + t2 = t1 & ~PORT_WAKE_BITS; 870 + if (t1 != t2) 871 + writel(t2, port_array[port_index]); 872 + } 873 + 874 + /* disble usb2 ports Wake bits*/ 875 + port_index = xhci->num_usb2_ports; 876 + port_array = xhci->usb2_ports; 877 + while (port_index--) { 878 + t1 = readl(port_array[port_index]); 879 + t1 = xhci_port_state_to_neutral(t1); 880 + t2 = t1 & ~PORT_WAKE_BITS; 881 + if (t1 != t2) 882 + writel(t2, port_array[port_index]); 883 + } 884 + 885 + spin_unlock_irqrestore(&xhci->lock, flags); 886 + } 887 + 856 888 /* 857 889 * Stop HC (not bus-specific) 858 890 * 859 891 * This is called when the machine transition into S3/S4 mode. 860 892 * 861 893 */ 862 - int xhci_suspend(struct xhci_hcd *xhci) 894 + int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) 863 895 { 864 896 int rc = 0; 865 897 unsigned int delay = XHCI_MAX_HALT_USEC; ··· 903 867 if (hcd->state != HC_STATE_SUSPENDED || 904 868 xhci->shared_hcd->state != HC_STATE_SUSPENDED) 905 869 return -EINVAL; 870 + 871 + /* Clear root port wake on bits if wakeup not allowed. */ 872 + if (!do_wakeup) 873 + xhci_disable_port_wake_on_bits(xhci); 906 874 907 875 /* Don't poll the roothubs on bus suspend. */ 908 876 xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); ··· 2952 2912 } 2953 2913 } 2954 2914 2955 - /* Deal with stalled endpoints. The core should have sent the control message 2956 - * to clear the halt condition. However, we need to make the xHCI hardware 2957 - * reset its sequence number, since a device will expect a sequence number of 2958 - * zero after the halt condition is cleared. 2915 + /* Called when clearing halted device. The core should have sent the control 2916 + * message to clear the device halt condition. The host side of the halt should 2917 + * already be cleared with a reset endpoint command issued when the STALL tx 2918 + * event was received. 2919 + * 2959 2920 * Context: in_interrupt 2960 2921 */ 2922 + 2961 2923 void xhci_endpoint_reset(struct usb_hcd *hcd, 2962 2924 struct usb_host_endpoint *ep) 2963 2925 { 2964 2926 struct xhci_hcd *xhci; 2965 - struct usb_device *udev; 2966 - unsigned int ep_index; 2967 - unsigned long flags; 2968 - int ret; 2969 - struct xhci_virt_ep *virt_ep; 2970 - struct xhci_command *command; 2971 2927 2972 2928 xhci = hcd_to_xhci(hcd); 2973 - udev = (struct usb_device *) ep->hcpriv; 2974 - /* Called with a root hub endpoint (or an endpoint that wasn't added 2975 - * with xhci_add_endpoint() 2976 - */ 2977 - if (!ep->hcpriv) 2978 - return; 2979 - ep_index = xhci_get_endpoint_index(&ep->desc); 2980 - virt_ep = &xhci->devs[udev->slot_id]->eps[ep_index]; 2981 - if (!virt_ep->stopped_td) { 2982 - xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, 2983 - "Endpoint 0x%x not halted, refusing to reset.", 2984 - ep->desc.bEndpointAddress); 2985 - return; 2986 - } 2987 - if (usb_endpoint_xfer_control(&ep->desc)) { 2988 - xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, 2989 - "Control endpoint stall already handled."); 2990 - return; 2991 - } 2992 2929 2993 - command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); 2994 - if (!command) 2995 - return; 2996 - 2997 - xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, 2998 - "Queueing reset endpoint command"); 2999 - spin_lock_irqsave(&xhci->lock, flags); 3000 - ret = xhci_queue_reset_ep(xhci, command, udev->slot_id, ep_index); 3001 2930 /* 3002 - * Can't change the ring dequeue pointer until it's transitioned to the 3003 - * stopped state, which is only upon a successful reset endpoint 3004 - * command. Better hope that last command worked! 2931 + * We might need to implement the config ep cmd in xhci 4.8.1 note: 2932 + * The Reset Endpoint Command may only be issued to endpoints in the 2933 + * Halted state. If software wishes reset the Data Toggle or Sequence 2934 + * Number of an endpoint that isn't in the Halted state, then software 2935 + * may issue a Configure Endpoint Command with the Drop and Add bits set 2936 + * for the target endpoint. that is in the Stopped state. 3005 2937 */ 3006 - if (!ret) { 3007 - xhci_cleanup_stalled_ring(xhci, udev, ep_index); 3008 - kfree(virt_ep->stopped_td); 3009 - xhci_ring_cmd_db(xhci); 3010 - } 3011 - virt_ep->stopped_td = NULL; 3012 - virt_ep->stopped_stream = 0; 3013 - spin_unlock_irqrestore(&xhci->lock, flags); 3014 2938 3015 - if (ret) 3016 - xhci_warn(xhci, "FIXME allocate a new ring segment\n"); 2939 + /* For now just print debug to follow the situation */ 2940 + xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n", 2941 + ep->desc.bEndpointAddress); 3017 2942 } 3018 2943 3019 2944 static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
+1 -1
drivers/usb/host/xhci.h
··· 1746 1746 void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *)); 1747 1747 1748 1748 #ifdef CONFIG_PM 1749 - int xhci_suspend(struct xhci_hcd *xhci); 1749 + int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup); 1750 1750 int xhci_resume(struct xhci_hcd *xhci, bool hibernated); 1751 1751 #else 1752 1752 #define xhci_suspend NULL
+1
drivers/usb/serial/cp210x.c
··· 120 120 { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ 121 121 { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ 122 122 { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ 123 + { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */ 123 124 { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ 124 125 { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ 125 126 { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
+33
drivers/usb/serial/ftdi_sio.c
··· 470 470 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, 471 471 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, 472 472 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, 473 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) }, 474 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) }, 475 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) }, 476 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) }, 477 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) }, 478 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) }, 479 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) }, 480 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) }, 481 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) }, 482 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) }, 483 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) }, 484 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) }, 485 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) }, 486 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) }, 487 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) }, 488 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) }, 489 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) }, 490 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) }, 491 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) }, 492 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) }, 493 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) }, 494 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) }, 495 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) }, 496 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) }, 497 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) }, 498 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) }, 499 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) }, 500 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) }, 501 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) }, 502 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) }, 503 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) }, 504 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) }, 505 + { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) }, 473 506 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, 474 507 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, 475 508 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
+35 -4
drivers/usb/serial/ftdi_sio_ids.h
··· 926 926 #define BAYER_CONTOUR_CABLE_PID 0x6001 927 927 928 928 /* 929 - * The following are the values for the Matrix Orbital FTDI Range 930 - * Anything in this range will use an FT232RL. 929 + * Matrix Orbital Intelligent USB displays. 930 + * http://www.matrixorbital.com 931 931 */ 932 932 #define MTXORB_VID 0x1B3D 933 933 #define MTXORB_FTDI_RANGE_0100_PID 0x0100 ··· 1186 1186 #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD 1187 1187 #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE 1188 1188 #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF 1189 - 1190 - 1189 + #define MTXORB_FTDI_RANGE_4701_PID 0x4701 1190 + #define MTXORB_FTDI_RANGE_9300_PID 0x9300 1191 + #define MTXORB_FTDI_RANGE_9301_PID 0x9301 1192 + #define MTXORB_FTDI_RANGE_9302_PID 0x9302 1193 + #define MTXORB_FTDI_RANGE_9303_PID 0x9303 1194 + #define MTXORB_FTDI_RANGE_9304_PID 0x9304 1195 + #define MTXORB_FTDI_RANGE_9305_PID 0x9305 1196 + #define MTXORB_FTDI_RANGE_9306_PID 0x9306 1197 + #define MTXORB_FTDI_RANGE_9307_PID 0x9307 1198 + #define MTXORB_FTDI_RANGE_9308_PID 0x9308 1199 + #define MTXORB_FTDI_RANGE_9309_PID 0x9309 1200 + #define MTXORB_FTDI_RANGE_930A_PID 0x930A 1201 + #define MTXORB_FTDI_RANGE_930B_PID 0x930B 1202 + #define MTXORB_FTDI_RANGE_930C_PID 0x930C 1203 + #define MTXORB_FTDI_RANGE_930D_PID 0x930D 1204 + #define MTXORB_FTDI_RANGE_930E_PID 0x930E 1205 + #define MTXORB_FTDI_RANGE_930F_PID 0x930F 1206 + #define MTXORB_FTDI_RANGE_9310_PID 0x9310 1207 + #define MTXORB_FTDI_RANGE_9311_PID 0x9311 1208 + #define MTXORB_FTDI_RANGE_9312_PID 0x9312 1209 + #define MTXORB_FTDI_RANGE_9313_PID 0x9313 1210 + #define MTXORB_FTDI_RANGE_9314_PID 0x9314 1211 + #define MTXORB_FTDI_RANGE_9315_PID 0x9315 1212 + #define MTXORB_FTDI_RANGE_9316_PID 0x9316 1213 + #define MTXORB_FTDI_RANGE_9317_PID 0x9317 1214 + #define MTXORB_FTDI_RANGE_9318_PID 0x9318 1215 + #define MTXORB_FTDI_RANGE_9319_PID 0x9319 1216 + #define MTXORB_FTDI_RANGE_931A_PID 0x931A 1217 + #define MTXORB_FTDI_RANGE_931B_PID 0x931B 1218 + #define MTXORB_FTDI_RANGE_931C_PID 0x931C 1219 + #define MTXORB_FTDI_RANGE_931D_PID 0x931D 1220 + #define MTXORB_FTDI_RANGE_931E_PID 0x931E 1221 + #define MTXORB_FTDI_RANGE_931F_PID 0x931F 1191 1222 1192 1223 /* 1193 1224 * The Mobility Lab (TML)
+59 -38
drivers/usb/serial/keyspan.c
··· 311 311 if ((data[0] & 0x80) == 0) { 312 312 /* no errors on individual bytes, only 313 313 possible overrun err */ 314 - if (data[0] & RXERROR_OVERRUN) 315 - err = TTY_OVERRUN; 316 - else 317 - err = 0; 314 + if (data[0] & RXERROR_OVERRUN) { 315 + tty_insert_flip_char(&port->port, 0, 316 + TTY_OVERRUN); 317 + } 318 318 for (i = 1; i < urb->actual_length ; ++i) 319 - tty_insert_flip_char(&port->port, data[i], err); 319 + tty_insert_flip_char(&port->port, data[i], 320 + TTY_NORMAL); 320 321 } else { 321 322 /* some bytes had errors, every byte has status */ 322 323 dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); 323 324 for (i = 0; i + 1 < urb->actual_length; i += 2) { 324 - int stat = data[i], flag = 0; 325 - if (stat & RXERROR_OVERRUN) 326 - flag |= TTY_OVERRUN; 327 - if (stat & RXERROR_FRAMING) 328 - flag |= TTY_FRAME; 329 - if (stat & RXERROR_PARITY) 330 - flag |= TTY_PARITY; 325 + int stat = data[i]; 326 + int flag = TTY_NORMAL; 327 + 328 + if (stat & RXERROR_OVERRUN) { 329 + tty_insert_flip_char(&port->port, 0, 330 + TTY_OVERRUN); 331 + } 331 332 /* XXX should handle break (0x10) */ 333 + if (stat & RXERROR_PARITY) 334 + flag = TTY_PARITY; 335 + else if (stat & RXERROR_FRAMING) 336 + flag = TTY_FRAME; 337 + 332 338 tty_insert_flip_char(&port->port, data[i+1], 333 339 flag); 334 340 } ··· 655 649 } else { 656 650 /* some bytes had errors, every byte has status */ 657 651 for (i = 0; i + 1 < urb->actual_length; i += 2) { 658 - int stat = data[i], flag = 0; 659 - if (stat & RXERROR_OVERRUN) 660 - flag |= TTY_OVERRUN; 661 - if (stat & RXERROR_FRAMING) 662 - flag |= TTY_FRAME; 663 - if (stat & RXERROR_PARITY) 664 - flag |= TTY_PARITY; 652 + int stat = data[i]; 653 + int flag = TTY_NORMAL; 654 + 655 + if (stat & RXERROR_OVERRUN) { 656 + tty_insert_flip_char(&port->port, 0, 657 + TTY_OVERRUN); 658 + } 665 659 /* XXX should handle break (0x10) */ 660 + if (stat & RXERROR_PARITY) 661 + flag = TTY_PARITY; 662 + else if (stat & RXERROR_FRAMING) 663 + flag = TTY_FRAME; 664 + 666 665 tty_insert_flip_char(&port->port, data[i+1], 667 666 flag); 668 667 } ··· 724 713 */ 725 714 for (x = 0; x + 1 < len && 726 715 i + 1 < urb->actual_length; x += 2) { 727 - int stat = data[i], flag = 0; 716 + int stat = data[i]; 717 + int flag = TTY_NORMAL; 728 718 729 - if (stat & RXERROR_OVERRUN) 730 - flag |= TTY_OVERRUN; 731 - if (stat & RXERROR_FRAMING) 732 - flag |= TTY_FRAME; 733 - if (stat & RXERROR_PARITY) 734 - flag |= TTY_PARITY; 719 + if (stat & RXERROR_OVERRUN) { 720 + tty_insert_flip_char(&port->port, 0, 721 + TTY_OVERRUN); 722 + } 735 723 /* XXX should handle break (0x10) */ 724 + if (stat & RXERROR_PARITY) 725 + flag = TTY_PARITY; 726 + else if (stat & RXERROR_FRAMING) 727 + flag = TTY_FRAME; 728 + 736 729 tty_insert_flip_char(&port->port, data[i+1], 737 730 flag); 738 731 i += 2; ··· 788 773 if ((data[0] & 0x80) == 0) { 789 774 /* no errors on individual bytes, only 790 775 possible overrun err*/ 791 - if (data[0] & RXERROR_OVERRUN) 792 - err = TTY_OVERRUN; 793 - else 794 - err = 0; 776 + if (data[0] & RXERROR_OVERRUN) { 777 + tty_insert_flip_char(&port->port, 0, 778 + TTY_OVERRUN); 779 + } 795 780 for (i = 1; i < urb->actual_length ; ++i) 796 781 tty_insert_flip_char(&port->port, 797 - data[i], err); 782 + data[i], TTY_NORMAL); 798 783 } else { 799 784 /* some bytes had errors, every byte has status */ 800 785 dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); 801 786 for (i = 0; i + 1 < urb->actual_length; i += 2) { 802 - int stat = data[i], flag = 0; 803 - if (stat & RXERROR_OVERRUN) 804 - flag |= TTY_OVERRUN; 805 - if (stat & RXERROR_FRAMING) 806 - flag |= TTY_FRAME; 807 - if (stat & RXERROR_PARITY) 808 - flag |= TTY_PARITY; 787 + int stat = data[i]; 788 + int flag = TTY_NORMAL; 789 + 790 + if (stat & RXERROR_OVERRUN) { 791 + tty_insert_flip_char( 792 + &port->port, 0, 793 + TTY_OVERRUN); 794 + } 809 795 /* XXX should handle break (0x10) */ 796 + if (stat & RXERROR_PARITY) 797 + flag = TTY_PARITY; 798 + else if (stat & RXERROR_FRAMING) 799 + flag = TTY_FRAME; 800 + 810 801 tty_insert_flip_char(&port->port, 811 802 data[i+1], flag); 812 803 }
+3 -8
drivers/usb/serial/ssu100.c
··· 490 490 if (*tty_flag == TTY_NORMAL) 491 491 *tty_flag = TTY_FRAME; 492 492 } 493 - if (lsr & UART_LSR_OE){ 493 + if (lsr & UART_LSR_OE) { 494 494 port->icount.overrun++; 495 - if (*tty_flag == TTY_NORMAL) 496 - *tty_flag = TTY_OVERRUN; 495 + tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); 497 496 } 498 497 } 499 498 ··· 510 511 if ((len >= 4) && 511 512 (packet[0] == 0x1b) && (packet[1] == 0x1b) && 512 513 ((packet[2] == 0x00) || (packet[2] == 0x01))) { 513 - if (packet[2] == 0x00) { 514 + if (packet[2] == 0x00) 514 515 ssu100_update_lsr(port, packet[3], &flag); 515 - if (flag == TTY_OVERRUN) 516 - tty_insert_flip_char(&port->port, 0, 517 - TTY_OVERRUN); 518 - } 519 516 if (packet[2] == 0x01) 520 517 ssu100_update_msr(port, packet[3]); 521 518
+7
drivers/usb/storage/unusual_uas.h
··· 103 103 "VL711", 104 104 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 105 105 US_FL_NO_ATA_1X), 106 + 107 + /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ 108 + UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, 109 + "Hitachi", 110 + "External HDD", 111 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 112 + US_FL_IGNORE_UAS),
+24
drivers/vhost/scsi.c
··· 1312 1312 vhost_scsi_set_endpoint(struct vhost_scsi *vs, 1313 1313 struct vhost_scsi_target *t) 1314 1314 { 1315 + struct se_portal_group *se_tpg; 1315 1316 struct tcm_vhost_tport *tv_tport; 1316 1317 struct tcm_vhost_tpg *tpg; 1317 1318 struct tcm_vhost_tpg **vs_tpg; ··· 1360 1359 ret = -EEXIST; 1361 1360 goto out; 1362 1361 } 1362 + /* 1363 + * In order to ensure individual vhost-scsi configfs 1364 + * groups cannot be removed while in use by vhost ioctl, 1365 + * go ahead and take an explicit se_tpg->tpg_group.cg_item 1366 + * dependency now. 1367 + */ 1368 + se_tpg = &tpg->se_tpg; 1369 + ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, 1370 + &se_tpg->tpg_group.cg_item); 1371 + if (ret) { 1372 + pr_warn("configfs_depend_item() failed: %d\n", ret); 1373 + kfree(vs_tpg); 1374 + mutex_unlock(&tpg->tv_tpg_mutex); 1375 + goto out; 1376 + } 1363 1377 tpg->tv_tpg_vhost_count++; 1364 1378 tpg->vhost_scsi = vs; 1365 1379 vs_tpg[tpg->tport_tpgt] = tpg; ··· 1417 1401 vhost_scsi_clear_endpoint(struct vhost_scsi *vs, 1418 1402 struct vhost_scsi_target *t) 1419 1403 { 1404 + struct se_portal_group *se_tpg; 1420 1405 struct tcm_vhost_tport *tv_tport; 1421 1406 struct tcm_vhost_tpg *tpg; 1422 1407 struct vhost_virtqueue *vq; ··· 1466 1449 vs->vs_tpg[target] = NULL; 1467 1450 match = true; 1468 1451 mutex_unlock(&tpg->tv_tpg_mutex); 1452 + /* 1453 + * Release se_tpg->tpg_group.cg_item configfs dependency now 1454 + * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. 1455 + */ 1456 + se_tpg = &tpg->se_tpg; 1457 + configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, 1458 + &se_tpg->tpg_group.cg_item); 1469 1459 } 1470 1460 if (match) { 1471 1461 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
+1 -1
fs/Makefile
··· 104 104 obj-$(CONFIG_AUTOFS4_FS) += autofs4/ 105 105 obj-$(CONFIG_ADFS_FS) += adfs/ 106 106 obj-$(CONFIG_FUSE_FS) += fuse/ 107 - obj-$(CONFIG_OVERLAYFS_FS) += overlayfs/ 107 + obj-$(CONFIG_OVERLAY_FS) += overlayfs/ 108 108 obj-$(CONFIG_UDF_FS) += udf/ 109 109 obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ 110 110 obj-$(CONFIG_OMFS_FS) += omfs/
+14 -7
fs/aio.c
··· 165 165 static const struct file_operations aio_ring_fops; 166 166 static const struct address_space_operations aio_ctx_aops; 167 167 168 + /* Backing dev info for aio fs. 169 + * -no dirty page accounting or writeback happens 170 + */ 171 + static struct backing_dev_info aio_fs_backing_dev_info = { 172 + .name = "aiofs", 173 + .state = 0, 174 + .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_MAP_COPY, 175 + }; 176 + 168 177 static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) 169 178 { 170 179 struct qstr this = QSTR_INIT("[aio]", 5); ··· 185 176 186 177 inode->i_mapping->a_ops = &aio_ctx_aops; 187 178 inode->i_mapping->private_data = ctx; 179 + inode->i_mapping->backing_dev_info = &aio_fs_backing_dev_info; 188 180 inode->i_size = PAGE_SIZE * nr_pages; 189 181 190 182 path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this); ··· 229 219 aio_mnt = kern_mount(&aio_fs); 230 220 if (IS_ERR(aio_mnt)) 231 221 panic("Failed to create aio fs mount."); 222 + 223 + if (bdi_init(&aio_fs_backing_dev_info)) 224 + panic("Failed to init aio fs backing dev info."); 232 225 233 226 kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC); 234 227 kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC); ··· 293 280 static const struct file_operations aio_ring_fops = { 294 281 .mmap = aio_ring_mmap, 295 282 }; 296 - 297 - static int aio_set_page_dirty(struct page *page) 298 - { 299 - return 0; 300 - } 301 283 302 284 #if IS_ENABLED(CONFIG_MIGRATION) 303 285 static int aio_migratepage(struct address_space *mapping, struct page *new, ··· 365 357 #endif 366 358 367 359 static const struct address_space_operations aio_ctx_aops = { 368 - .set_page_dirty = aio_set_page_dirty, 360 + .set_page_dirty = __set_page_dirty_no_writeback, 369 361 #if IS_ENABLED(CONFIG_MIGRATION) 370 362 .migratepage = aio_migratepage, 371 363 #endif ··· 420 412 pr_debug("pid(%d) page[%d]->count=%d\n", 421 413 current->pid, i, page_count(page)); 422 414 SetPageUptodate(page); 423 - SetPageDirty(page); 424 415 unlock_page(page); 425 416 426 417 ctx->ring_pages[i] = page;
+31 -2
fs/btrfs/compression.c
··· 1011 1011 bytes = min(bytes, working_bytes); 1012 1012 kaddr = kmap_atomic(page_out); 1013 1013 memcpy(kaddr + *pg_offset, buf + buf_offset, bytes); 1014 - if (*pg_index == (vcnt - 1) && *pg_offset == 0) 1015 - memset(kaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); 1016 1014 kunmap_atomic(kaddr); 1017 1015 flush_dcache_page(page_out); 1018 1016 ··· 1051 1053 } 1052 1054 1053 1055 return 1; 1056 + } 1057 + 1058 + /* 1059 + * When uncompressing data, we need to make sure and zero any parts of 1060 + * the biovec that were not filled in by the decompression code. pg_index 1061 + * and pg_offset indicate the last page and the last offset of that page 1062 + * that have been filled in. This will zero everything remaining in the 1063 + * biovec. 1064 + */ 1065 + void btrfs_clear_biovec_end(struct bio_vec *bvec, int vcnt, 1066 + unsigned long pg_index, 1067 + unsigned long pg_offset) 1068 + { 1069 + while (pg_index < vcnt) { 1070 + struct page *page = bvec[pg_index].bv_page; 1071 + unsigned long off = bvec[pg_index].bv_offset; 1072 + unsigned long len = bvec[pg_index].bv_len; 1073 + 1074 + if (pg_offset < off) 1075 + pg_offset = off; 1076 + if (pg_offset < off + len) { 1077 + unsigned long bytes = off + len - pg_offset; 1078 + char *kaddr; 1079 + 1080 + kaddr = kmap_atomic(page); 1081 + memset(kaddr + pg_offset, 0, bytes); 1082 + kunmap_atomic(kaddr); 1083 + } 1084 + pg_index++; 1085 + pg_offset = 0; 1086 + } 1054 1087 }
+3 -1
fs/btrfs/compression.h
··· 45 45 unsigned long nr_pages); 46 46 int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, 47 47 int mirror_num, unsigned long bio_flags); 48 - 48 + void btrfs_clear_biovec_end(struct bio_vec *bvec, int vcnt, 49 + unsigned long pg_index, 50 + unsigned long pg_offset); 49 51 struct btrfs_compress_op { 50 52 struct list_head *(*alloc_workspace)(void); 51 53
+2 -12
fs/btrfs/ctree.c
··· 80 80 { 81 81 int i; 82 82 83 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 84 - /* lockdep really cares that we take all of these spinlocks 85 - * in the right order. If any of the locks in the path are not 86 - * currently blocking, it is going to complain. So, make really 87 - * really sure by forcing the path to blocking before we clear 88 - * the path blocking. 89 - */ 90 83 if (held) { 91 84 btrfs_set_lock_blocking_rw(held, held_rw); 92 85 if (held_rw == BTRFS_WRITE_LOCK) ··· 88 95 held_rw = BTRFS_READ_LOCK_BLOCKING; 89 96 } 90 97 btrfs_set_path_blocking(p); 91 - #endif 92 98 93 99 for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) { 94 100 if (p->nodes[i] && p->locks[i]) { ··· 99 107 } 100 108 } 101 109 102 - #ifdef CONFIG_DEBUG_LOCK_ALLOC 103 110 if (held) 104 111 btrfs_clear_lock_blocking_rw(held, held_rw); 105 - #endif 106 112 } 107 113 108 114 /* this also releases the path */ ··· 2883 2893 } 2884 2894 p->locks[level] = BTRFS_WRITE_LOCK; 2885 2895 } else { 2886 - err = btrfs_try_tree_read_lock(b); 2896 + err = btrfs_tree_read_lock_atomic(b); 2887 2897 if (!err) { 2888 2898 btrfs_set_path_blocking(p); 2889 2899 btrfs_tree_read_lock(b); ··· 3015 3025 } 3016 3026 3017 3027 level = btrfs_header_level(b); 3018 - err = btrfs_try_tree_read_lock(b); 3028 + err = btrfs_tree_read_lock_atomic(b); 3019 3029 if (!err) { 3020 3030 btrfs_set_path_blocking(p); 3021 3031 btrfs_tree_read_lock(b);
+21 -3
fs/btrfs/locking.c
··· 128 128 } 129 129 130 130 /* 131 + * take a spinning read lock. 132 + * returns 1 if we get the read lock and 0 if we don't 133 + * this won't wait for blocking writers 134 + */ 135 + int btrfs_tree_read_lock_atomic(struct extent_buffer *eb) 136 + { 137 + if (atomic_read(&eb->blocking_writers)) 138 + return 0; 139 + 140 + read_lock(&eb->lock); 141 + if (atomic_read(&eb->blocking_writers)) { 142 + read_unlock(&eb->lock); 143 + return 0; 144 + } 145 + atomic_inc(&eb->read_locks); 146 + atomic_inc(&eb->spinning_readers); 147 + return 1; 148 + } 149 + 150 + /* 131 151 * returns 1 if we get the read lock and 0 if we don't 132 152 * this won't wait for blocking writers 133 153 */ ··· 178 158 atomic_read(&eb->blocking_readers)) 179 159 return 0; 180 160 181 - if (!write_trylock(&eb->lock)) 182 - return 0; 183 - 161 + write_lock(&eb->lock); 184 162 if (atomic_read(&eb->blocking_writers) || 185 163 atomic_read(&eb->blocking_readers)) { 186 164 write_unlock(&eb->lock);
+2
fs/btrfs/locking.h
··· 35 35 void btrfs_assert_tree_locked(struct extent_buffer *eb); 36 36 int btrfs_try_tree_read_lock(struct extent_buffer *eb); 37 37 int btrfs_try_tree_write_lock(struct extent_buffer *eb); 38 + int btrfs_tree_read_lock_atomic(struct extent_buffer *eb); 39 + 38 40 39 41 static inline void btrfs_tree_unlock_rw(struct extent_buffer *eb, int rw) 40 42 {
+15
fs/btrfs/lzo.c
··· 373 373 } 374 374 done: 375 375 kunmap(pages_in[page_in_index]); 376 + if (!ret) 377 + btrfs_clear_biovec_end(bvec, vcnt, page_out_index, pg_offset); 376 378 return ret; 377 379 } 378 380 ··· 412 410 goto out; 413 411 } 414 412 413 + /* 414 + * the caller is already checking against PAGE_SIZE, but lets 415 + * move this check closer to the memcpy/memset 416 + */ 417 + destlen = min_t(unsigned long, destlen, PAGE_SIZE); 415 418 bytes = min_t(unsigned long, destlen, out_len - start_byte); 416 419 417 420 kaddr = kmap_atomic(dest_page); 418 421 memcpy(kaddr, workspace->buf + start_byte, bytes); 422 + 423 + /* 424 + * btrfs_getblock is doing a zero on the tail of the page too, 425 + * but this will cover anything missing from the decompressed 426 + * data. 427 + */ 428 + if (bytes < destlen) 429 + memset(kaddr+bytes, 0, destlen-bytes); 419 430 kunmap_atomic(kaddr); 420 431 out: 421 432 return ret;
+18 -2
fs/btrfs/zlib.c
··· 299 299 zlib_inflateEnd(&workspace->strm); 300 300 if (data_in) 301 301 kunmap(pages_in[page_in_index]); 302 + if (!ret) 303 + btrfs_clear_biovec_end(bvec, vcnt, page_out_index, pg_offset); 302 304 return ret; 303 305 } 304 306 ··· 312 310 struct workspace *workspace = list_entry(ws, struct workspace, list); 313 311 int ret = 0; 314 312 int wbits = MAX_WBITS; 315 - unsigned long bytes_left = destlen; 313 + unsigned long bytes_left; 316 314 unsigned long total_out = 0; 315 + unsigned long pg_offset = 0; 317 316 char *kaddr; 317 + 318 + destlen = min_t(unsigned long, destlen, PAGE_SIZE); 319 + bytes_left = destlen; 318 320 319 321 workspace->strm.next_in = data_in; 320 322 workspace->strm.avail_in = srclen; ··· 347 341 unsigned long buf_start; 348 342 unsigned long buf_offset; 349 343 unsigned long bytes; 350 - unsigned long pg_offset = 0; 351 344 352 345 ret = zlib_inflate(&workspace->strm, Z_NO_FLUSH); 353 346 if (ret != Z_OK && ret != Z_STREAM_END) ··· 389 384 ret = 0; 390 385 391 386 zlib_inflateEnd(&workspace->strm); 387 + 388 + /* 389 + * this should only happen if zlib returned fewer bytes than we 390 + * expected. btrfs_get_block is responsible for zeroing from the 391 + * end of the inline extent (destlen) to the end of the page 392 + */ 393 + if (pg_offset < destlen) { 394 + kaddr = kmap_atomic(dest_page); 395 + memset(kaddr + pg_offset, 0, destlen - pg_offset); 396 + kunmap_atomic(kaddr); 397 + } 392 398 return ret; 393 399 } 394 400
+1 -1
fs/ceph/caps.c
··· 2638 2638 2639 2639 for (i = 0; i < CEPH_CAP_BITS; i++) 2640 2640 if ((dirty & (1 << i)) && 2641 - flush_tid == ci->i_cap_flush_tid[i]) 2641 + (u16)flush_tid == ci->i_cap_flush_tid[i]) 2642 2642 cleaned |= 1 << i; 2643 2643 2644 2644 dout("handle_cap_flush_ack inode %p mds%d seq %d on %s cleaned %s,"
+1
fs/dcache.c
··· 778 778 struct dentry *parent = lock_parent(dentry); 779 779 if (likely(!dentry->d_lockref.count)) { 780 780 __dentry_kill(dentry); 781 + dput(parent); 781 782 goto restart; 782 783 } 783 784 if (parent)
+21 -21
fs/isofs/inode.c
··· 174 174 * Compute the hash for the isofs name corresponding to the dentry. 175 175 */ 176 176 static int 177 - isofs_hash_common(struct qstr *qstr, int ms) 178 - { 179 - const char *name; 180 - int len; 181 - 182 - len = qstr->len; 183 - name = qstr->name; 184 - if (ms) { 185 - while (len && name[len-1] == '.') 186 - len--; 187 - } 188 - 189 - qstr->hash = full_name_hash(name, len); 190 - 191 - return 0; 192 - } 193 - 194 - /* 195 - * Compute the hash for the isofs name corresponding to the dentry. 196 - */ 197 - static int 198 177 isofs_hashi_common(struct qstr *qstr, int ms) 199 178 { 200 179 const char *name; ··· 242 263 } 243 264 244 265 #ifdef CONFIG_JOLIET 266 + /* 267 + * Compute the hash for the isofs name corresponding to the dentry. 268 + */ 269 + static int 270 + isofs_hash_common(struct qstr *qstr, int ms) 271 + { 272 + const char *name; 273 + int len; 274 + 275 + len = qstr->len; 276 + name = qstr->name; 277 + if (ms) { 278 + while (len && name[len-1] == '.') 279 + len--; 280 + } 281 + 282 + qstr->hash = full_name_hash(name, len); 283 + 284 + return 0; 285 + } 286 + 245 287 static int 246 288 isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr) 247 289 {
+1 -1
fs/nfs/blocklayout/blocklayout.c
··· 378 378 loff_t offset = header->args.offset; 379 379 size_t count = header->args.count; 380 380 struct page **pages = header->args.pages; 381 - int pg_index = pg_index = header->args.pgbase >> PAGE_CACHE_SHIFT; 381 + int pg_index = header->args.pgbase >> PAGE_CACHE_SHIFT; 382 382 unsigned int pg_len; 383 383 struct blk_plug plug; 384 384 int i;
+9 -5
fs/nfs/blocklayout/rpc_pipefs.c
··· 65 65 66 66 dprintk("%s CREATING PIPEFS MESSAGE\n", __func__); 67 67 68 + mutex_lock(&nn->bl_mutex); 68 69 bl_pipe_msg.bl_wq = &nn->bl_wq; 69 70 70 71 b->simple.len += 4; /* single volume */ 71 72 if (b->simple.len > PAGE_SIZE) 72 - return -EIO; 73 + goto out_unlock; 73 74 74 75 memset(msg, 0, sizeof(*msg)); 75 76 msg->len = sizeof(*bl_msg) + b->simple.len; 76 77 msg->data = kzalloc(msg->len, gfp_mask); 77 78 if (!msg->data) 78 - goto out; 79 + goto out_free_data; 79 80 80 81 bl_msg = msg->data; 81 82 bl_msg->type = BL_DEVICE_MOUNT, ··· 88 87 rc = rpc_queue_upcall(nn->bl_device_pipe, msg); 89 88 if (rc < 0) { 90 89 remove_wait_queue(&nn->bl_wq, &wq); 91 - goto out; 90 + goto out_free_data; 92 91 } 93 92 94 93 set_current_state(TASK_UNINTERRUPTIBLE); ··· 98 97 if (reply->status != BL_DEVICE_REQUEST_PROC) { 99 98 printk(KERN_WARNING "%s failed to decode device: %d\n", 100 99 __func__, reply->status); 101 - goto out; 100 + goto out_free_data; 102 101 } 103 102 104 103 dev = MKDEV(reply->major, reply->minor); 105 - out: 104 + out_free_data: 106 105 kfree(msg->data); 106 + out_unlock: 107 + mutex_unlock(&nn->bl_mutex); 107 108 return dev; 108 109 } 109 110 ··· 235 232 struct nfs_net *nn = net_generic(net, nfs_net_id); 236 233 struct dentry *dentry; 237 234 235 + mutex_init(&nn->bl_mutex); 238 236 init_waitqueue_head(&nn->bl_wq); 239 237 nn->bl_device_pipe = rpc_mkpipe_data(&bl_upcall_ops, 0); 240 238 if (IS_ERR(nn->bl_device_pipe))
+23 -2
fs/nfs/delegation.c
··· 125 125 continue; 126 126 if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) 127 127 continue; 128 + if (!nfs4_valid_open_stateid(state)) 129 + continue; 128 130 if (!nfs4_stateid_match(&state->stateid, stateid)) 129 131 continue; 130 132 get_nfs_open_context(ctx); ··· 195 193 { 196 194 int res = 0; 197 195 198 - res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid, issync); 196 + if (!test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) 197 + res = nfs4_proc_delegreturn(inode, 198 + delegation->cred, 199 + &delegation->stateid, 200 + issync); 199 201 nfs_free_delegation(delegation); 200 202 return res; 201 203 } ··· 386 380 { 387 381 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; 388 382 struct nfs_inode *nfsi = NFS_I(inode); 389 - int err; 383 + int err = 0; 390 384 391 385 if (delegation == NULL) 392 386 return 0; 393 387 do { 388 + if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) 389 + break; 394 390 err = nfs_delegation_claim_opens(inode, &delegation->stateid); 395 391 if (!issync || err != -EAGAIN) 396 392 break; ··· 613 605 rcu_read_unlock(); 614 606 } 615 607 608 + static void nfs_revoke_delegation(struct inode *inode) 609 + { 610 + struct nfs_delegation *delegation; 611 + rcu_read_lock(); 612 + delegation = rcu_dereference(NFS_I(inode)->delegation); 613 + if (delegation != NULL) { 614 + set_bit(NFS_DELEGATION_REVOKED, &delegation->flags); 615 + nfs_mark_return_delegation(NFS_SERVER(inode), delegation); 616 + } 617 + rcu_read_unlock(); 618 + } 619 + 616 620 void nfs_remove_bad_delegation(struct inode *inode) 617 621 { 618 622 struct nfs_delegation *delegation; 619 623 624 + nfs_revoke_delegation(inode); 620 625 delegation = nfs_inode_detach_delegation(inode); 621 626 if (delegation) { 622 627 nfs_inode_find_state_and_recover(inode, &delegation->stateid);
+1
fs/nfs/delegation.h
··· 31 31 NFS_DELEGATION_RETURN_IF_CLOSED, 32 32 NFS_DELEGATION_REFERENCED, 33 33 NFS_DELEGATION_RETURNING, 34 + NFS_DELEGATION_REVOKED, 34 35 }; 35 36 36 37 int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res);
+1
fs/nfs/dir.c
··· 1527 1527 case -ENOENT: 1528 1528 d_drop(dentry); 1529 1529 d_add(dentry, NULL); 1530 + nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1530 1531 break; 1531 1532 case -EISDIR: 1532 1533 case -ENOTDIR:
+1
fs/nfs/direct.c
··· 266 266 { 267 267 struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); 268 268 269 + nfs_free_pnfs_ds_cinfo(&dreq->ds_cinfo); 269 270 if (dreq->l_ctx != NULL) 270 271 nfs_put_lock_context(dreq->l_ctx); 271 272 if (dreq->ctx != NULL)
-3
fs/nfs/filelayout/filelayout.c
··· 145 145 case -NFS4ERR_DELEG_REVOKED: 146 146 case -NFS4ERR_ADMIN_REVOKED: 147 147 case -NFS4ERR_BAD_STATEID: 148 - if (state == NULL) 149 - break; 150 - nfs_remove_bad_delegation(state->inode); 151 148 case -NFS4ERR_OPENMODE: 152 149 if (state == NULL) 153 150 break;
+1 -1
fs/nfs/inode.c
··· 626 626 { 627 627 struct inode *inode = dentry->d_inode; 628 628 int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; 629 - int err; 629 + int err = 0; 630 630 631 631 trace_nfs_getattr_enter(inode); 632 632 /* Flush out writes to the server in order to update c/mtime. */
+1
fs/nfs/netns.h
··· 19 19 struct rpc_pipe *bl_device_pipe; 20 20 struct bl_dev_msg bl_mount_reply; 21 21 wait_queue_head_t bl_wq; 22 + struct mutex bl_mutex; 22 23 struct list_head nfs_client_list; 23 24 struct list_head nfs_volume_list; 24 25 #if IS_ENABLED(CONFIG_NFS_V4)
+45 -50
fs/nfs/nfs4proc.c
··· 370 370 case -NFS4ERR_DELEG_REVOKED: 371 371 case -NFS4ERR_ADMIN_REVOKED: 372 372 case -NFS4ERR_BAD_STATEID: 373 - if (inode != NULL && nfs4_have_delegation(inode, FMODE_READ)) { 374 - nfs_remove_bad_delegation(inode); 375 - exception->retry = 1; 376 - break; 377 - } 378 373 if (state == NULL) 379 374 break; 380 375 ret = nfs4_schedule_stateid_recovery(server, state); ··· 1649 1654 nfs_inode_find_state_and_recover(state->inode, 1650 1655 stateid); 1651 1656 nfs4_schedule_stateid_recovery(server, state); 1652 - return 0; 1657 + return -EAGAIN; 1653 1658 case -NFS4ERR_DELAY: 1654 1659 case -NFS4ERR_GRACE: 1655 1660 set_bit(NFS_DELEGATED_STATE, &state->flags); ··· 2104 2109 return ret; 2105 2110 } 2106 2111 2112 + static void nfs_finish_clear_delegation_stateid(struct nfs4_state *state) 2113 + { 2114 + nfs_remove_bad_delegation(state->inode); 2115 + write_seqlock(&state->seqlock); 2116 + nfs4_stateid_copy(&state->stateid, &state->open_stateid); 2117 + write_sequnlock(&state->seqlock); 2118 + clear_bit(NFS_DELEGATED_STATE, &state->flags); 2119 + } 2120 + 2121 + static void nfs40_clear_delegation_stateid(struct nfs4_state *state) 2122 + { 2123 + if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL) 2124 + nfs_finish_clear_delegation_stateid(state); 2125 + } 2126 + 2127 + static int nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state) 2128 + { 2129 + /* NFSv4.0 doesn't allow for delegation recovery on open expire */ 2130 + nfs40_clear_delegation_stateid(state); 2131 + return nfs4_open_expired(sp, state); 2132 + } 2133 + 2107 2134 #if defined(CONFIG_NFS_V4_1) 2108 - static void nfs41_clear_delegation_stateid(struct nfs4_state *state) 2135 + static void nfs41_check_delegation_stateid(struct nfs4_state *state) 2109 2136 { 2110 2137 struct nfs_server *server = NFS_SERVER(state->inode); 2111 - nfs4_stateid *stateid = &state->stateid; 2138 + nfs4_stateid stateid; 2112 2139 struct nfs_delegation *delegation; 2113 - struct rpc_cred *cred = NULL; 2114 - int status = -NFS4ERR_BAD_STATEID; 2115 - 2116 - /* If a state reset has been done, test_stateid is unneeded */ 2117 - if (test_bit(NFS_DELEGATED_STATE, &state->flags) == 0) 2118 - return; 2140 + struct rpc_cred *cred; 2141 + int status; 2119 2142 2120 2143 /* Get the delegation credential for use by test/free_stateid */ 2121 2144 rcu_read_lock(); 2122 2145 delegation = rcu_dereference(NFS_I(state->inode)->delegation); 2123 - if (delegation != NULL && 2124 - nfs4_stateid_match(&delegation->stateid, stateid)) { 2125 - cred = get_rpccred(delegation->cred); 2146 + if (delegation == NULL) { 2126 2147 rcu_read_unlock(); 2127 - status = nfs41_test_stateid(server, stateid, cred); 2128 - trace_nfs4_test_delegation_stateid(state, NULL, status); 2129 - } else 2130 - rcu_read_unlock(); 2148 + return; 2149 + } 2150 + 2151 + nfs4_stateid_copy(&stateid, &delegation->stateid); 2152 + cred = get_rpccred(delegation->cred); 2153 + rcu_read_unlock(); 2154 + status = nfs41_test_stateid(server, &stateid, cred); 2155 + trace_nfs4_test_delegation_stateid(state, NULL, status); 2131 2156 2132 2157 if (status != NFS_OK) { 2133 2158 /* Free the stateid unless the server explicitly 2134 2159 * informs us the stateid is unrecognized. */ 2135 2160 if (status != -NFS4ERR_BAD_STATEID) 2136 - nfs41_free_stateid(server, stateid, cred); 2137 - nfs_remove_bad_delegation(state->inode); 2138 - 2139 - write_seqlock(&state->seqlock); 2140 - nfs4_stateid_copy(&state->stateid, &state->open_stateid); 2141 - write_sequnlock(&state->seqlock); 2142 - clear_bit(NFS_DELEGATED_STATE, &state->flags); 2161 + nfs41_free_stateid(server, &stateid, cred); 2162 + nfs_finish_clear_delegation_stateid(state); 2143 2163 } 2144 2164 2145 - if (cred != NULL) 2146 - put_rpccred(cred); 2165 + put_rpccred(cred); 2147 2166 } 2148 2167 2149 2168 /** ··· 2201 2192 { 2202 2193 int status; 2203 2194 2204 - nfs41_clear_delegation_stateid(state); 2195 + nfs41_check_delegation_stateid(state); 2205 2196 status = nfs41_check_open_stateid(state); 2206 2197 if (status != NFS_OK) 2207 2198 status = nfs4_open_expired(sp, state); ··· 2240 2231 seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); 2241 2232 2242 2233 ret = _nfs4_proc_open(opendata); 2243 - if (ret != 0) { 2244 - if (ret == -ENOENT) { 2245 - dentry = opendata->dentry; 2246 - if (dentry->d_inode) 2247 - d_delete(dentry); 2248 - else if (d_unhashed(dentry)) 2249 - d_add(dentry, NULL); 2250 - 2251 - nfs_set_verifier(dentry, 2252 - nfs_save_change_attribute(opendata->dir->d_inode)); 2253 - } 2234 + if (ret != 0) 2254 2235 goto out; 2255 - } 2256 2236 2257 2237 state = nfs4_opendata_to_nfs4_state(opendata); 2258 2238 ret = PTR_ERR(state); ··· 4839 4841 case -NFS4ERR_DELEG_REVOKED: 4840 4842 case -NFS4ERR_ADMIN_REVOKED: 4841 4843 case -NFS4ERR_BAD_STATEID: 4842 - if (state == NULL) 4843 - break; 4844 - nfs_remove_bad_delegation(state->inode); 4845 4844 case -NFS4ERR_OPENMODE: 4846 4845 if (state == NULL) 4847 4846 break; ··· 8336 8341 static const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = { 8337 8342 .owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE, 8338 8343 .state_flag_bit = NFS_STATE_RECLAIM_NOGRACE, 8339 - .recover_open = nfs4_open_expired, 8344 + .recover_open = nfs40_open_expired, 8340 8345 .recover_lock = nfs4_lock_expired, 8341 8346 .establish_clid = nfs4_init_clientid, 8342 8347 }; ··· 8403 8408 | NFS_CAP_CHANGE_ATTR 8404 8409 | NFS_CAP_POSIX_LOCK 8405 8410 | NFS_CAP_STATEID_NFSV41 8406 - | NFS_CAP_ATOMIC_OPEN_V1 8407 - | NFS_CAP_SEEK, 8411 + | NFS_CAP_ATOMIC_OPEN_V1, 8408 8412 .init_client = nfs41_init_client, 8409 8413 .shutdown_client = nfs41_shutdown_client, 8410 8414 .match_stateid = nfs41_match_stateid, ··· 8425 8431 | NFS_CAP_CHANGE_ATTR 8426 8432 | NFS_CAP_POSIX_LOCK 8427 8433 | NFS_CAP_STATEID_NFSV41 8428 - | NFS_CAP_ATOMIC_OPEN_V1, 8434 + | NFS_CAP_ATOMIC_OPEN_V1 8435 + | NFS_CAP_SEEK, 8429 8436 .init_client = nfs41_init_client, 8430 8437 .shutdown_client = nfs41_shutdown_client, 8431 8438 .match_stateid = nfs41_match_stateid,
-2
fs/nfs/write.c
··· 715 715 716 716 if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) 717 717 nfs_release_request(req); 718 - else 719 - WARN_ON_ONCE(1); 720 718 } 721 719 722 720 static void
+6 -2
fs/nfsd/nfs4callback.c
··· 774 774 { 775 775 if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { 776 776 rpc_sleep_on(&clp->cl_cb_waitq, task, NULL); 777 - dprintk("%s slot is busy\n", __func__); 778 - return false; 777 + /* Race breaker */ 778 + if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { 779 + dprintk("%s slot is busy\n", __func__); 780 + return false; 781 + } 782 + rpc_wake_up_queued_task(&clp->cl_cb_waitq, task); 779 783 } 780 784 return true; 781 785 }
+6 -3
fs/nfsd/nfsd.h
··· 335 335 (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) 336 336 337 337 #ifdef CONFIG_NFSD_V4_SECURITY_LABEL 338 - #define NFSD4_2_SUPPORTED_ATTRS_WORD2 \ 339 - (NFSD4_1_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SECURITY_LABEL) 338 + #define NFSD4_2_SECURITY_ATTRS FATTR4_WORD2_SECURITY_LABEL 340 339 #else 341 - #define NFSD4_2_SUPPORTED_ATTRS_WORD2 0 340 + #define NFSD4_2_SECURITY_ATTRS 0 342 341 #endif 342 + 343 + #define NFSD4_2_SUPPORTED_ATTRS_WORD2 \ 344 + (NFSD4_1_SUPPORTED_ATTRS_WORD2 | \ 345 + NFSD4_2_SECURITY_ATTRS) 343 346 344 347 static inline u32 nfsd_suppattrs0(u32 minorversion) 345 348 {
+21 -15
fs/notify/fsnotify.c
··· 229 229 &fsnotify_mark_srcu); 230 230 } 231 231 232 + /* 233 + * We need to merge inode & vfsmount mark lists so that inode mark 234 + * ignore masks are properly reflected for mount mark notifications. 235 + * That's why this traversal is so complicated... 236 + */ 232 237 while (inode_node || vfsmount_node) { 233 - inode_group = vfsmount_group = NULL; 238 + inode_group = NULL; 239 + inode_mark = NULL; 240 + vfsmount_group = NULL; 241 + vfsmount_mark = NULL; 234 242 235 243 if (inode_node) { 236 244 inode_mark = hlist_entry(srcu_dereference(inode_node, &fsnotify_mark_srcu), ··· 252 244 vfsmount_group = vfsmount_mark->group; 253 245 } 254 246 255 - if (inode_group > vfsmount_group) { 256 - /* handle inode */ 257 - ret = send_to_group(to_tell, inode_mark, NULL, mask, 258 - data, data_is, cookie, file_name); 259 - /* we didn't use the vfsmount_mark */ 260 - vfsmount_group = NULL; 261 - } else if (vfsmount_group > inode_group) { 262 - ret = send_to_group(to_tell, NULL, vfsmount_mark, mask, 263 - data, data_is, cookie, file_name); 264 - inode_group = NULL; 265 - } else { 266 - ret = send_to_group(to_tell, inode_mark, vfsmount_mark, 267 - mask, data, data_is, cookie, 268 - file_name); 247 + if (inode_group && vfsmount_group) { 248 + int cmp = fsnotify_compare_groups(inode_group, 249 + vfsmount_group); 250 + if (cmp > 0) { 251 + inode_group = NULL; 252 + inode_mark = NULL; 253 + } else if (cmp < 0) { 254 + vfsmount_group = NULL; 255 + vfsmount_mark = NULL; 256 + } 269 257 } 258 + ret = send_to_group(to_tell, inode_mark, vfsmount_mark, mask, 259 + data, data_is, cookie, file_name); 270 260 271 261 if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) 272 262 goto out;
+4
fs/notify/fsnotify.h
··· 12 12 /* protects reads of inode and vfsmount marks list */ 13 13 extern struct srcu_struct fsnotify_mark_srcu; 14 14 15 + /* compare two groups for sorting of marks lists */ 16 + extern int fsnotify_compare_groups(struct fsnotify_group *a, 17 + struct fsnotify_group *b); 18 + 15 19 extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark, 16 20 __u32 mask); 17 21 /* add a mark to an inode */
+3 -5
fs/notify/inode_mark.c
··· 194 194 { 195 195 struct fsnotify_mark *lmark, *last = NULL; 196 196 int ret = 0; 197 + int cmp; 197 198 198 199 mark->flags |= FSNOTIFY_MARK_FLAG_INODE; 199 200 ··· 220 219 goto out; 221 220 } 222 221 223 - if (mark->group->priority < lmark->group->priority) 224 - continue; 225 - 226 - if ((mark->group->priority == lmark->group->priority) && 227 - (mark->group < lmark->group)) 222 + cmp = fsnotify_compare_groups(lmark->group, mark->group); 223 + if (cmp < 0) 228 224 continue; 229 225 230 226 hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list);
+36
fs/notify/mark.c
··· 210 210 } 211 211 212 212 /* 213 + * Sorting function for lists of fsnotify marks. 214 + * 215 + * Fanotify supports different notification classes (reflected as priority of 216 + * notification group). Events shall be passed to notification groups in 217 + * decreasing priority order. To achieve this marks in notification lists for 218 + * inodes and vfsmounts are sorted so that priorities of corresponding groups 219 + * are descending. 220 + * 221 + * Furthermore correct handling of the ignore mask requires processing inode 222 + * and vfsmount marks of each group together. Using the group address as 223 + * further sort criterion provides a unique sorting order and thus we can 224 + * merge inode and vfsmount lists of marks in linear time and find groups 225 + * present in both lists. 226 + * 227 + * A return value of 1 signifies that b has priority over a. 228 + * A return value of 0 signifies that the two marks have to be handled together. 229 + * A return value of -1 signifies that a has priority over b. 230 + */ 231 + int fsnotify_compare_groups(struct fsnotify_group *a, struct fsnotify_group *b) 232 + { 233 + if (a == b) 234 + return 0; 235 + if (!a) 236 + return 1; 237 + if (!b) 238 + return -1; 239 + if (a->priority < b->priority) 240 + return 1; 241 + if (a->priority > b->priority) 242 + return -1; 243 + if (a < b) 244 + return 1; 245 + return -1; 246 + } 247 + 248 + /* 213 249 * Attach an initialized mark to a given group and fs object. 214 250 * These marks may be used for the fsnotify backend to determine which 215 251 * event types should be delivered to which group.
+3 -5
fs/notify/vfsmount_mark.c
··· 153 153 struct mount *m = real_mount(mnt); 154 154 struct fsnotify_mark *lmark, *last = NULL; 155 155 int ret = 0; 156 + int cmp; 156 157 157 158 mark->flags |= FSNOTIFY_MARK_FLAG_VFSMOUNT; 158 159 ··· 179 178 goto out; 180 179 } 181 180 182 - if (mark->group->priority < lmark->group->priority) 183 - continue; 184 - 185 - if ((mark->group->priority == lmark->group->priority) && 186 - (mark->group < lmark->group)) 181 + cmp = fsnotify_compare_groups(lmark->group, mark->group); 182 + if (cmp < 0) 187 183 continue; 188 184 189 185 hlist_add_before_rcu(&mark->m.m_list, &lmark->m.m_list);
+1 -1
fs/overlayfs/Kconfig
··· 1 - config OVERLAYFS_FS 1 + config OVERLAY_FS 2 2 tristate "Overlay filesystem support" 3 3 help 4 4 An overlay filesystem combines two filesystems - an 'upper' filesystem
+2 -2
fs/overlayfs/Makefile
··· 2 2 # Makefile for the overlay filesystem. 3 3 # 4 4 5 - obj-$(CONFIG_OVERLAYFS_FS) += overlayfs.o 5 + obj-$(CONFIG_OVERLAY_FS) += overlay.o 6 6 7 - overlayfs-objs := super.o inode.o dir.o readdir.o copy_up.o 7 + overlay-objs := super.o inode.o dir.o readdir.o copy_up.o
+19 -12
fs/overlayfs/dir.c
··· 284 284 return ERR_PTR(err); 285 285 } 286 286 287 - static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry, 288 - enum ovl_path_type type) 287 + static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry) 289 288 { 290 289 int err; 291 290 struct dentry *ret = NULL; ··· 293 294 err = ovl_check_empty_dir(dentry, &list); 294 295 if (err) 295 296 ret = ERR_PTR(err); 296 - else if (type == OVL_PATH_MERGE) 297 - ret = ovl_clear_empty(dentry, &list); 297 + else { 298 + /* 299 + * If no upperdentry then skip clearing whiteouts. 300 + * 301 + * Can race with copy-up, since we don't hold the upperdir 302 + * mutex. Doesn't matter, since copy-up can't create a 303 + * non-empty directory from an empty one. 304 + */ 305 + if (ovl_dentry_upper(dentry)) 306 + ret = ovl_clear_empty(dentry, &list); 307 + } 298 308 299 309 ovl_cache_free(&list); 300 310 ··· 495 487 return err; 496 488 } 497 489 498 - static int ovl_remove_and_whiteout(struct dentry *dentry, 499 - enum ovl_path_type type, bool is_dir) 490 + static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir) 500 491 { 501 492 struct dentry *workdir = ovl_workdir(dentry); 502 493 struct inode *wdir = workdir->d_inode; ··· 507 500 int err; 508 501 509 502 if (is_dir) { 510 - opaquedir = ovl_check_empty_and_clear(dentry, type); 503 + opaquedir = ovl_check_empty_and_clear(dentry); 511 504 err = PTR_ERR(opaquedir); 512 505 if (IS_ERR(opaquedir)) 513 506 goto out; ··· 522 515 if (IS_ERR(whiteout)) 523 516 goto out_unlock; 524 517 525 - if (type == OVL_PATH_LOWER) { 518 + upper = ovl_dentry_upper(dentry); 519 + if (!upper) { 526 520 upper = lookup_one_len(dentry->d_name.name, upperdir, 527 - dentry->d_name.len); 521 + dentry->d_name.len); 528 522 err = PTR_ERR(upper); 529 523 if (IS_ERR(upper)) 530 524 goto kill_whiteout; ··· 537 529 } else { 538 530 int flags = 0; 539 531 540 - upper = ovl_dentry_upper(dentry); 541 532 if (opaquedir) 542 533 upper = opaquedir; 543 534 err = -ESTALE; ··· 655 648 cap_raise(override_cred->cap_effective, CAP_CHOWN); 656 649 old_cred = override_creds(override_cred); 657 650 658 - err = ovl_remove_and_whiteout(dentry, type, is_dir); 651 + err = ovl_remove_and_whiteout(dentry, is_dir); 659 652 660 653 revert_creds(old_cred); 661 654 put_cred(override_cred); ··· 788 781 } 789 782 790 783 if (overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) { 791 - opaquedir = ovl_check_empty_and_clear(new, new_type); 784 + opaquedir = ovl_check_empty_and_clear(new); 792 785 err = PTR_ERR(opaquedir); 793 786 if (IS_ERR(opaquedir)) { 794 787 opaquedir = NULL;
+18 -9
fs/overlayfs/inode.c
··· 235 235 return err; 236 236 } 237 237 238 + static bool ovl_need_xattr_filter(struct dentry *dentry, 239 + enum ovl_path_type type) 240 + { 241 + return type == OVL_PATH_UPPER && S_ISDIR(dentry->d_inode->i_mode); 242 + } 243 + 238 244 ssize_t ovl_getxattr(struct dentry *dentry, const char *name, 239 245 void *value, size_t size) 240 246 { 241 - if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && 242 - ovl_is_private_xattr(name)) 247 + struct path realpath; 248 + enum ovl_path_type type = ovl_path_real(dentry, &realpath); 249 + 250 + if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) 243 251 return -ENODATA; 244 252 245 - return vfs_getxattr(ovl_dentry_real(dentry), name, value, size); 253 + return vfs_getxattr(realpath.dentry, name, value, size); 246 254 } 247 255 248 256 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) 249 257 { 258 + struct path realpath; 259 + enum ovl_path_type type = ovl_path_real(dentry, &realpath); 250 260 ssize_t res; 251 261 int off; 252 262 253 - res = vfs_listxattr(ovl_dentry_real(dentry), list, size); 263 + res = vfs_listxattr(realpath.dentry, list, size); 254 264 if (res <= 0 || size == 0) 255 265 return res; 256 266 257 - if (ovl_path_type(dentry->d_parent) != OVL_PATH_MERGE) 267 + if (!ovl_need_xattr_filter(dentry, type)) 258 268 return res; 259 269 260 270 /* filter out private xattrs */ ··· 289 279 { 290 280 int err; 291 281 struct path realpath; 292 - enum ovl_path_type type; 282 + enum ovl_path_type type = ovl_path_real(dentry, &realpath); 293 283 294 284 err = ovl_want_write(dentry); 295 285 if (err) 296 286 goto out; 297 287 298 - if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && 299 - ovl_is_private_xattr(name)) 288 + err = -ENODATA; 289 + if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) 300 290 goto out_drop_write; 301 291 302 - type = ovl_path_real(dentry, &realpath); 303 292 if (type == OVL_PATH_LOWER) { 304 293 err = vfs_getxattr(realpath.dentry, name, NULL, 0); 305 294 if (err < 0)
+16 -23
fs/overlayfs/readdir.c
··· 274 274 return 0; 275 275 } 276 276 277 - static inline int ovl_dir_read_merged(struct path *upperpath, 278 - struct path *lowerpath, 279 - struct list_head *list) 277 + static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) 280 278 { 281 279 int err; 280 + struct path lowerpath; 281 + struct path upperpath; 282 282 struct ovl_readdir_data rdd = { 283 283 .ctx.actor = ovl_fill_merge, 284 284 .list = list, ··· 286 286 .is_merge = false, 287 287 }; 288 288 289 - if (upperpath->dentry) { 290 - err = ovl_dir_read(upperpath, &rdd); 289 + ovl_path_lower(dentry, &lowerpath); 290 + ovl_path_upper(dentry, &upperpath); 291 + 292 + if (upperpath.dentry) { 293 + err = ovl_dir_read(&upperpath, &rdd); 291 294 if (err) 292 295 goto out; 293 296 294 - if (lowerpath->dentry) { 295 - err = ovl_dir_mark_whiteouts(upperpath->dentry, &rdd); 297 + if (lowerpath.dentry) { 298 + err = ovl_dir_mark_whiteouts(upperpath.dentry, &rdd); 296 299 if (err) 297 300 goto out; 298 301 } 299 302 } 300 - if (lowerpath->dentry) { 303 + if (lowerpath.dentry) { 301 304 /* 302 305 * Insert lowerpath entries before upperpath ones, this allows 303 306 * offsets to be reasonably constant 304 307 */ 305 308 list_add(&rdd.middle, rdd.list); 306 309 rdd.is_merge = true; 307 - err = ovl_dir_read(lowerpath, &rdd); 310 + err = ovl_dir_read(&lowerpath, &rdd); 308 311 list_del(&rdd.middle); 309 312 } 310 313 out: ··· 332 329 static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) 333 330 { 334 331 int res; 335 - struct path lowerpath; 336 - struct path upperpath; 337 332 struct ovl_dir_cache *cache; 338 333 339 334 cache = ovl_dir_cache(dentry); ··· 348 347 cache->refcount = 1; 349 348 INIT_LIST_HEAD(&cache->entries); 350 349 351 - ovl_path_lower(dentry, &lowerpath); 352 - ovl_path_upper(dentry, &upperpath); 353 - 354 - res = ovl_dir_read_merged(&upperpath, &lowerpath, &cache->entries); 350 + res = ovl_dir_read_merged(dentry, &cache->entries); 355 351 if (res) { 356 352 ovl_cache_free(&cache->entries); 357 353 kfree(cache); ··· 450 452 /* 451 453 * Need to check if we started out being a lower dir, but got copied up 452 454 */ 453 - if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { 455 + if (!od->is_upper && ovl_path_type(dentry) != OVL_PATH_LOWER) { 454 456 struct inode *inode = file_inode(file); 455 457 456 - realfile =lockless_dereference(od->upperfile); 458 + realfile = lockless_dereference(od->upperfile); 457 459 if (!realfile) { 458 460 struct path upperpath; 459 461 ··· 536 538 int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list) 537 539 { 538 540 int err; 539 - struct path lowerpath; 540 - struct path upperpath; 541 541 struct ovl_cache_entry *p; 542 542 543 - ovl_path_upper(dentry, &upperpath); 544 - ovl_path_lower(dentry, &lowerpath); 545 - 546 - err = ovl_dir_read_merged(&upperpath, &lowerpath, list); 543 + err = ovl_dir_read_merged(dentry, list); 547 544 if (err) 548 545 return err; 549 546
+49 -12
fs/overlayfs/super.c
··· 24 24 MODULE_DESCRIPTION("Overlay filesystem"); 25 25 MODULE_LICENSE("GPL"); 26 26 27 - #define OVERLAYFS_SUPER_MAGIC 0x794c764f 27 + #define OVERLAYFS_SUPER_MAGIC 0x794c7630 28 28 29 29 struct ovl_config { 30 30 char *lowerdir; ··· 84 84 85 85 static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) 86 86 { 87 - struct dentry *upperdentry = ACCESS_ONCE(oe->__upperdentry); 88 - /* 89 - * Make sure to order reads to upperdentry wrt ovl_dentry_update() 90 - */ 91 - smp_read_barrier_depends(); 92 - return upperdentry; 87 + return lockless_dereference(oe->__upperdentry); 93 88 } 94 89 95 90 void ovl_path_upper(struct dentry *dentry, struct path *path) ··· 457 462 {OPT_ERR, NULL} 458 463 }; 459 464 465 + static char *ovl_next_opt(char **s) 466 + { 467 + char *sbegin = *s; 468 + char *p; 469 + 470 + if (sbegin == NULL) 471 + return NULL; 472 + 473 + for (p = sbegin; *p; p++) { 474 + if (*p == '\\') { 475 + p++; 476 + if (!*p) 477 + break; 478 + } else if (*p == ',') { 479 + *p = '\0'; 480 + *s = p + 1; 481 + return sbegin; 482 + } 483 + } 484 + *s = NULL; 485 + return sbegin; 486 + } 487 + 460 488 static int ovl_parse_opt(char *opt, struct ovl_config *config) 461 489 { 462 490 char *p; 463 491 464 - while ((p = strsep(&opt, ",")) != NULL) { 492 + while ((p = ovl_next_opt(&opt)) != NULL) { 465 493 int token; 466 494 substring_t args[MAX_OPT_ARGS]; 467 495 ··· 572 554 goto out_unlock; 573 555 } 574 556 557 + static void ovl_unescape(char *s) 558 + { 559 + char *d = s; 560 + 561 + for (;; s++, d++) { 562 + if (*s == '\\') 563 + s++; 564 + *d = *s; 565 + if (!*s) 566 + break; 567 + } 568 + } 569 + 575 570 static int ovl_mount_dir(const char *name, struct path *path) 576 571 { 577 572 int err; 573 + char *tmp = kstrdup(name, GFP_KERNEL); 578 574 579 - err = kern_path(name, LOOKUP_FOLLOW, path); 575 + if (!tmp) 576 + return -ENOMEM; 577 + 578 + ovl_unescape(tmp); 579 + err = kern_path(tmp, LOOKUP_FOLLOW, path); 580 580 if (err) { 581 - pr_err("overlayfs: failed to resolve '%s': %i\n", name, err); 581 + pr_err("overlayfs: failed to resolve '%s': %i\n", tmp, err); 582 582 err = -EINVAL; 583 583 } 584 + kfree(tmp); 584 585 return err; 585 586 } 586 587 ··· 813 776 814 777 static struct file_system_type ovl_fs_type = { 815 778 .owner = THIS_MODULE, 816 - .name = "overlayfs", 779 + .name = "overlay", 817 780 .mount = ovl_mount, 818 781 .kill_sb = kill_anon_super, 819 782 }; 820 - MODULE_ALIAS_FS("overlayfs"); 783 + MODULE_ALIAS_FS("overlay"); 821 784 822 785 static int __init ovl_init(void) 823 786 {
+1 -1
include/dt-bindings/clock/qcom,mmcc-apq8084.h
··· 60 60 #define ESC1_CLK_SRC 43 61 61 #define HDMI_CLK_SRC 44 62 62 #define VSYNC_CLK_SRC 45 63 - #define RBCPR_CLK_SRC 46 63 + #define MMSS_RBCPR_CLK_SRC 46 64 64 #define RBBMTIMER_CLK_SRC 47 65 65 #define MAPLE_CLK_SRC 48 66 66 #define VDP_CLK_SRC 49
+2 -2
include/dt-bindings/pinctrl/dra.h
··· 40 40 41 41 /* Active pin states */ 42 42 #define PIN_OUTPUT (0 | PULL_DIS) 43 - #define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP) 44 - #define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) 43 + #define PIN_OUTPUT_PULLUP (PULL_UP) 44 + #define PIN_OUTPUT_PULLDOWN (0) 45 45 #define PIN_INPUT (INPUT_EN | PULL_DIS) 46 46 #define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL) 47 47 #define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
+5 -2
include/linux/bitops.h
··· 18 18 * position @h. For example 19 19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. 20 20 */ 21 - #define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l)) 22 - #define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l)) 21 + #define GENMASK(h, l) \ 22 + (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) 23 + 24 + #define GENMASK_ULL(h, l) \ 25 + (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) 23 26 24 27 extern unsigned int __sw_hweight8(unsigned int w); 25 28 extern unsigned int __sw_hweight16(unsigned int w);
+1
include/linux/bootmem.h
··· 46 46 extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 47 47 48 48 extern unsigned long free_all_bootmem(void); 49 + extern void reset_node_managed_pages(pg_data_t *pgdat); 49 50 extern void reset_all_zones_managed_pages(void); 50 51 51 52 extern void free_bootmem_node(pg_data_t *pgdat,
+6
include/linux/can/dev.h
··· 99 99 return 1; 100 100 } 101 101 102 + static inline bool can_is_canfd_skb(const struct sk_buff *skb) 103 + { 104 + /* the CAN specific type of skb is identified by its data length */ 105 + return skb->len == CANFD_MTU; 106 + } 107 + 102 108 /* get data length from can_dlc with sanitized can_dlc */ 103 109 u8 can_dlc2len(u8 can_dlc); 104 110
-1
include/linux/clk-provider.h
··· 352 352 #define CLK_DIVIDER_READ_ONLY BIT(5) 353 353 354 354 extern const struct clk_ops clk_divider_ops; 355 - extern const struct clk_ops clk_divider_ro_ops; 356 355 struct clk *clk_register_divider(struct device *dev, const char *name, 357 356 const char *parent_name, unsigned long flags, 358 357 void __iomem *reg, u8 shift, u8 width,
+1 -1
include/linux/iio/events.h
··· 72 72 73 73 #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF) 74 74 75 - #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF) 75 + #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F) 76 76 77 77 #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF) 78 78
+1 -1
include/linux/inetdevice.h
··· 242 242 static __inline__ __be32 inet_make_mask(int logmask) 243 243 { 244 244 if (logmask) 245 - return htonl(~((1<<(32-logmask))-1)); 245 + return htonl(~((1U<<(32-logmask))-1)); 246 246 return 0; 247 247 } 248 248
-5
include/linux/kernel_stat.h
··· 77 77 return kstat_cpu(cpu).irqs_sum; 78 78 } 79 79 80 - /* 81 - * Lock/unlock the current runqueue - to extract task statistics: 82 - */ 83 - extern unsigned long long task_delta_exec(struct task_struct *); 84 - 85 80 extern void account_user_time(struct task_struct *, cputime_t, cputime_t); 86 81 extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); 87 82 extern void account_steal_time(cputime_t);
+1 -1
include/linux/kvm_host.h
··· 703 703 int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 704 704 void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 705 705 706 - bool kvm_is_mmio_pfn(pfn_t pfn); 706 + bool kvm_is_reserved_pfn(pfn_t pfn); 707 707 708 708 struct kvm_irq_ack_notifier { 709 709 struct hlist_node link;
+7
include/linux/mfd/max77693-private.h
··· 330 330 MAX77693_IRQ_GROUP_NR, 331 331 }; 332 332 333 + #define SRC_IRQ_CHARGER BIT(0) 334 + #define SRC_IRQ_TOP BIT(1) 335 + #define SRC_IRQ_FLASH BIT(2) 336 + #define SRC_IRQ_MUIC BIT(3) 337 + #define SRC_IRQ_ALL (SRC_IRQ_CHARGER | SRC_IRQ_TOP \ 338 + | SRC_IRQ_FLASH | SRC_IRQ_MUIC) 339 + 333 340 #define LED_IRQ_FLED2_OPEN BIT(0) 334 341 #define LED_IRQ_FLED2_SHORT BIT(1) 335 342 #define LED_IRQ_FLED1_OPEN BIT(2)
+9
include/linux/mmzone.h
··· 431 431 */ 432 432 int nr_migrate_reserve_block; 433 433 434 + #ifdef CONFIG_MEMORY_ISOLATION 435 + /* 436 + * Number of isolated pageblock. It is used to solve incorrect 437 + * freepage counting problem due to racy retrieving migratetype 438 + * of pageblock. Protected by zone->lock. 439 + */ 440 + unsigned long nr_isolate_pageblock; 441 + #endif 442 + 434 443 #ifdef CONFIG_MEMORY_HOTPLUG 435 444 /* see spanned/present_pages for more description */ 436 445 seqlock_t span_seqlock;
+11
include/linux/nfs_xdr.h
··· 1224 1224 unsigned int status; 1225 1225 }; 1226 1226 1227 + static inline void 1228 + nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) 1229 + { 1230 + kfree(cinfo->buckets); 1231 + } 1232 + 1227 1233 #else 1228 1234 1229 1235 struct pnfs_ds_commit_info { 1230 1236 }; 1237 + 1238 + static inline void 1239 + nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) 1240 + { 1241 + } 1231 1242 1232 1243 #endif /* CONFIG_NFS_V4_1 */ 1233 1244
+8
include/linux/page-isolation.h
··· 2 2 #define __LINUX_PAGEISOLATION_H 3 3 4 4 #ifdef CONFIG_MEMORY_ISOLATION 5 + static inline bool has_isolate_pageblock(struct zone *zone) 6 + { 7 + return zone->nr_isolate_pageblock; 8 + } 5 9 static inline bool is_migrate_isolate_page(struct page *page) 6 10 { 7 11 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE; ··· 15 11 return migratetype == MIGRATE_ISOLATE; 16 12 } 17 13 #else 14 + static inline bool has_isolate_pageblock(struct zone *zone) 15 + { 16 + return false; 17 + } 18 18 static inline bool is_migrate_isolate_page(struct page *page) 19 19 { 20 20 return false;
+1
include/linux/pci.h
··· 331 331 unsigned int is_added:1; 332 332 unsigned int is_busmaster:1; /* device is busmaster */ 333 333 unsigned int no_msi:1; /* device may not use msi */ 334 + unsigned int no_64bit_msi:1; /* device may only use 32-bit MSIs */ 334 335 unsigned int block_cfg_access:1; /* config space access is blocked */ 335 336 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 336 337 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
+7 -1
include/linux/percpu-refcount.h
··· 133 133 /* paired with smp_store_release() in percpu_ref_reinit() */ 134 134 smp_read_barrier_depends(); 135 135 136 - if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC)) 136 + /* 137 + * Theoretically, the following could test just ATOMIC; however, 138 + * then we'd have to mask off DEAD separately as DEAD may be 139 + * visible without ATOMIC if we race with percpu_ref_kill(). DEAD 140 + * implies ATOMIC anyway. Test them together. 141 + */ 142 + if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC_DEAD)) 137 143 return false; 138 144 139 145 *percpu_countp = (unsigned long __percpu *)percpu_ptr;
+5 -3
include/linux/pm_domain.h
··· 72 72 bool max_off_time_changed; 73 73 bool cached_power_down_ok; 74 74 struct gpd_cpuidle_data *cpuidle_data; 75 - void (*attach_dev)(struct device *dev); 76 - void (*detach_dev)(struct device *dev); 75 + int (*attach_dev)(struct generic_pm_domain *domain, 76 + struct device *dev); 77 + void (*detach_dev)(struct generic_pm_domain *domain, 78 + struct device *dev); 77 79 }; 78 80 79 81 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) ··· 106 104 struct notifier_block nb; 107 105 struct mutex lock; 108 106 unsigned int refcount; 109 - bool need_restore; 107 + int need_restore; 110 108 }; 111 109 112 110 #ifdef CONFIG_PM_GENERIC_DOMAINS
-3
include/linux/power/charger-manager.h
··· 253 253 struct device *dev; 254 254 struct charger_desc *desc; 255 255 256 - struct power_supply *fuel_gauge; 257 - struct power_supply **charger_stat; 258 - 259 256 #ifdef CONFIG_THERMAL 260 257 struct thermal_zone_device *tzd_batt; 261 258 #endif
+6
include/linux/power_supply.h
··· 200 200 void (*external_power_changed)(struct power_supply *psy); 201 201 void (*set_charged)(struct power_supply *psy); 202 202 203 + /* 204 + * Set if thermal zone should not be created for this power supply. 205 + * For example for virtual supplies forwarding calls to actual 206 + * sensors or other supplies. 207 + */ 208 + bool no_thermal; 203 209 /* For APM emulation, think legacy userspace. */ 204 210 int use_for_apm; 205 211
+1 -1
include/linux/ring_buffer.h
··· 97 97 __ring_buffer_alloc((size), (flags), &__key); \ 98 98 }) 99 99 100 - int ring_buffer_wait(struct ring_buffer *buffer, int cpu); 100 + int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full); 101 101 int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, 102 102 struct file *filp, poll_table *poll_table); 103 103
+1 -1
include/linux/socket.h
··· 256 256 #define MSG_EOF MSG_FIN 257 257 258 258 #define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ 259 - #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file 259 + #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exec for file 260 260 descriptor received through 261 261 SCM_RIGHTS */ 262 262 #if defined(CONFIG_COMPAT)
-1
include/net/9p/transport.h
··· 34 34 * @list: used to maintain a list of currently available transports 35 35 * @name: the human-readable name of the transport 36 36 * @maxsize: transport provided maximum packet size 37 - * @pref: Preferences of this transport 38 37 * @def: set if this transport should be considered the default 39 38 * @create: member function to create a new connection on this transport 40 39 * @close: member function to discard a connection on this transport
+2
include/net/inet_common.h
··· 37 37 int inet_ctl_sock_create(struct sock **sk, unsigned short family, 38 38 unsigned short type, unsigned char protocol, 39 39 struct net *net); 40 + int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, 41 + int *addr_len); 40 42 41 43 static inline void inet_ctl_sock_destroy(struct sock *sk) 42 44 {
-2
include/net/netfilter/nf_tables.h
··· 396 396 /** 397 397 * struct nft_trans - nf_tables object update in transaction 398 398 * 399 - * @rcu_head: rcu head to defer release of transaction data 400 399 * @list: used internally 401 400 * @msg_type: message type 402 401 * @ctx: transaction context 403 402 * @data: internal information related to the transaction 404 403 */ 405 404 struct nft_trans { 406 - struct rcu_head rcu_head; 407 405 struct list_head list; 408 406 int msg_type; 409 407 struct nft_ctx ctx;
+9
include/net/udp_tunnel.h
··· 100 100 return iptunnel_handle_offloads(skb, udp_csum, type); 101 101 } 102 102 103 + static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff) 104 + { 105 + struct udphdr *uh; 106 + 107 + uh = (struct udphdr *)(skb->data + nhoff - sizeof(struct udphdr)); 108 + skb_shinfo(skb)->gso_type |= uh->check ? 109 + SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL; 110 + } 111 + 103 112 static inline void udp_tunnel_encap_enable(struct socket *sock) 104 113 { 105 114 #if IS_ENABLED(CONFIG_IPV6)
+18
include/net/vxlan.h
··· 8 8 #define VNI_HASH_BITS 10 9 9 #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) 10 10 11 + /* VXLAN protocol header */ 12 + struct vxlanhdr { 13 + __be32 vx_flags; 14 + __be32 vx_vni; 15 + }; 16 + 11 17 struct vxlan_sock; 12 18 typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); 13 19 ··· 50 44 struct rtable *rt, struct sk_buff *skb, 51 45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 52 46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); 47 + 48 + static inline bool vxlan_gso_check(struct sk_buff *skb) 49 + { 50 + if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) && 51 + (skb->inner_protocol_type != ENCAP_TYPE_ETHER || 52 + skb->inner_protocol != htons(ETH_P_TEB) || 53 + (skb_inner_mac_header(skb) - skb_transport_header(skb) != 54 + sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) 55 + return false; 56 + 57 + return true; 58 + } 53 59 54 60 /* IP header + UDP + VXLAN + Ethernet header */ 55 61 #define VXLAN_HEADROOM (20 + 8 + 8 + 14)
+2
include/sound/pcm.h
··· 184 184 #define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) 185 185 #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) 186 186 #define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) 187 + #define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE) 188 + #define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE) 187 189 188 190 #ifdef SNDRV_LITTLE_ENDIAN 189 191 #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
+2
include/sound/soc-dpcm.h
··· 102 102 /* state and update */ 103 103 enum snd_soc_dpcm_update runtime_update; 104 104 enum snd_soc_dpcm_state state; 105 + 106 + int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */ 105 107 }; 106 108 107 109 /* can this BE stop and free */
+4
include/uapi/linux/Kbuild
··· 125 125 header-y += firewire-cdev.h 126 126 header-y += firewire-constants.h 127 127 header-y += flat.h 128 + header-y += fou.h 128 129 header-y += fs.h 129 130 header-y += fsl_hypervisor.h 130 131 header-y += fuse.h ··· 142 141 header-y += hiddev.h 143 142 header-y += hidraw.h 144 143 header-y += hpet.h 144 + header-y += hsr_netlink.h 145 145 header-y += hyperv.h 146 146 header-y += hysdn_if.h 147 147 header-y += i2c-dev.h ··· 253 251 header-y += minix_fs.h 254 252 header-y += mman.h 255 253 header-y += mmtimer.h 254 + header-y += mpls.h 256 255 header-y += mqueue.h 257 256 header-y += mroute.h 258 257 header-y += mroute6.h ··· 427 424 header-y += virtio_pci.h 428 425 header-y += virtio_ring.h 429 426 header-y += virtio_rng.h 427 + header=y += vm_sockets.h 430 428 header-y += vt.h 431 429 header-y += wait.h 432 430 header-y += wanrouter.h
+1
include/uapi/linux/if_bridge.h
··· 15 15 16 16 #include <linux/types.h> 17 17 #include <linux/if_ether.h> 18 + #include <linux/in6.h> 18 19 19 20 #define SYSFS_BRIDGE_ATTR "bridge" 20 21 #define SYSFS_BRIDGE_FDB "brforward"
+3 -1
include/uapi/sound/asound.h
··· 220 220 #define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ 221 221 #define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ 222 222 #define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ 223 - #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_LE 223 + #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ 224 + #define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ 225 + #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE 224 226 225 227 #ifdef SNDRV_LITTLE_ENDIAN 226 228 #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
+1 -1
init/main.c
··· 544 544 static_command_line, __start___param, 545 545 __stop___param - __start___param, 546 546 -1, -1, &unknown_bootoption); 547 - if (after_dashes) 547 + if (!IS_ERR_OR_NULL(after_dashes)) 548 548 parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, 549 549 set_init_arg); 550 550
+1 -1
kernel/audit.c
··· 739 739 740 740 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE); 741 741 audit_log_task_info(ab, current); 742 - audit_log_format(ab, "feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", 742 + audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", 743 743 audit_feature_names[which], !!old_feature, !!new_feature, 744 744 !!old_lock, !!new_lock, res); 745 745 audit_log_end(ab);
+1
kernel/audit_tree.c
··· 154 154 chunk->owners[i].index = i; 155 155 } 156 156 fsnotify_init_mark(&chunk->mark, audit_tree_destroy_watch); 157 + chunk->mark.mask = FS_IN_IGNORED; 157 158 return chunk; 158 159 } 159 160
+5 -3
kernel/events/core.c
··· 1562 1562 1563 1563 if (!task) { 1564 1564 /* 1565 - * Per cpu events are removed via an smp call and 1566 - * the removal is always successful. 1565 + * Per cpu events are removed via an smp call. The removal can 1566 + * fail if the CPU is currently offline, but in that case we 1567 + * already called __perf_remove_from_context from 1568 + * perf_event_exit_cpu. 1567 1569 */ 1568 1570 cpu_function_call(event->cpu, __perf_remove_from_context, &re); 1569 1571 return; ··· 8119 8117 8120 8118 static void __perf_event_exit_context(void *__info) 8121 8119 { 8122 - struct remove_event re = { .detach_group = false }; 8120 + struct remove_event re = { .detach_group = true }; 8123 8121 struct perf_event_context *ctx = __info; 8124 8122 8125 8123 perf_pmu_rotate_stop(ctx->pmu);
-1
kernel/events/uprobes.c
··· 1640 1640 if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) { 1641 1641 utask->state = UTASK_SSTEP_TRAPPED; 1642 1642 set_tsk_thread_flag(t, TIF_UPROBE); 1643 - set_tsk_thread_flag(t, TIF_NOTIFY_RESUME); 1644 1643 } 1645 1644 } 1646 1645
+1
kernel/panic.c
··· 244 244 * 'I' - Working around severe firmware bug. 245 245 * 'O' - Out-of-tree module has been loaded. 246 246 * 'E' - Unsigned module has been loaded. 247 + * 'L' - A soft lockup has previously occurred. 247 248 * 248 249 * The string is overwritten by the next call to print_tainted(). 249 250 */
+2 -2
kernel/power/suspend.c
··· 146 146 147 147 static int platform_suspend_prepare_late(suspend_state_t state) 148 148 { 149 - return state == PM_SUSPEND_FREEZE && freeze_ops->prepare ? 149 + return state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->prepare ? 150 150 freeze_ops->prepare() : 0; 151 151 } 152 152 ··· 164 164 165 165 static void platform_resume_early(suspend_state_t state) 166 166 { 167 - if (state == PM_SUSPEND_FREEZE && freeze_ops->restore) 167 + if (state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->restore) 168 168 freeze_ops->restore(); 169 169 } 170 170
+21 -42
kernel/sched/core.c
··· 2475 2475 EXPORT_PER_CPU_SYMBOL(kernel_cpustat); 2476 2476 2477 2477 /* 2478 - * Return any ns on the sched_clock that have not yet been accounted in 2479 - * @p in case that task is currently running. 2480 - * 2481 - * Called with task_rq_lock() held on @rq. 2482 - */ 2483 - static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq) 2484 - { 2485 - u64 ns = 0; 2486 - 2487 - /* 2488 - * Must be ->curr _and_ ->on_rq. If dequeued, we would 2489 - * project cycles that may never be accounted to this 2490 - * thread, breaking clock_gettime(). 2491 - */ 2492 - if (task_current(rq, p) && task_on_rq_queued(p)) { 2493 - update_rq_clock(rq); 2494 - ns = rq_clock_task(rq) - p->se.exec_start; 2495 - if ((s64)ns < 0) 2496 - ns = 0; 2497 - } 2498 - 2499 - return ns; 2500 - } 2501 - 2502 - unsigned long long task_delta_exec(struct task_struct *p) 2503 - { 2504 - unsigned long flags; 2505 - struct rq *rq; 2506 - u64 ns = 0; 2507 - 2508 - rq = task_rq_lock(p, &flags); 2509 - ns = do_task_delta_exec(p, rq); 2510 - task_rq_unlock(rq, p, &flags); 2511 - 2512 - return ns; 2513 - } 2514 - 2515 - /* 2516 2478 * Return accounted runtime for the task. 2517 2479 * In case the task is currently running, return the runtime plus current's 2518 2480 * pending runtime that have not been accounted yet. ··· 2483 2521 { 2484 2522 unsigned long flags; 2485 2523 struct rq *rq; 2486 - u64 ns = 0; 2524 + u64 ns; 2487 2525 2488 2526 #if defined(CONFIG_64BIT) && defined(CONFIG_SMP) 2489 2527 /* ··· 2502 2540 #endif 2503 2541 2504 2542 rq = task_rq_lock(p, &flags); 2505 - ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq); 2543 + /* 2544 + * Must be ->curr _and_ ->on_rq. If dequeued, we would 2545 + * project cycles that may never be accounted to this 2546 + * thread, breaking clock_gettime(). 2547 + */ 2548 + if (task_current(rq, p) && task_on_rq_queued(p)) { 2549 + update_rq_clock(rq); 2550 + p->sched_class->update_curr(rq); 2551 + } 2552 + ns = p->se.sum_exec_runtime; 2506 2553 task_rq_unlock(rq, p, &flags); 2507 2554 2508 2555 return ns; ··· 6339 6368 if (!sched_debug()) 6340 6369 break; 6341 6370 } 6371 + 6372 + if (!level) 6373 + return; 6374 + 6342 6375 /* 6343 6376 * 'level' contains the number of unique distances, excluding the 6344 6377 * identity distance node_distance(i,i). ··· 7419 7444 if (unlikely(running)) 7420 7445 put_prev_task(rq, tsk); 7421 7446 7422 - tg = container_of(task_css_check(tsk, cpu_cgrp_id, 7423 - lockdep_is_held(&tsk->sighand->siglock)), 7447 + /* 7448 + * All callers are synchronized by task_rq_lock(); we do not use RCU 7449 + * which is pointless here. Thus, we pass "true" to task_css_check() 7450 + * to prevent lockdep warnings. 7451 + */ 7452 + tg = container_of(task_css_check(tsk, cpu_cgrp_id, true), 7424 7453 struct task_group, css); 7425 7454 tg = autogroup_task_group(tsk, tg); 7426 7455 tsk->sched_task_group = tg;
+2
kernel/sched/deadline.c
··· 1701 1701 .prio_changed = prio_changed_dl, 1702 1702 .switched_from = switched_from_dl, 1703 1703 .switched_to = switched_to_dl, 1704 + 1705 + .update_curr = update_curr_dl, 1704 1706 };
+14
kernel/sched/fair.c
··· 726 726 account_cfs_rq_runtime(cfs_rq, delta_exec); 727 727 } 728 728 729 + static void update_curr_fair(struct rq *rq) 730 + { 731 + update_curr(cfs_rq_of(&rq->curr->se)); 732 + } 733 + 729 734 static inline void 730 735 update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se) 731 736 { ··· 1183 1178 if ((cur->flags & PF_EXITING) || is_idle_task(cur)) 1184 1179 cur = NULL; 1185 1180 raw_spin_unlock_irq(&dst_rq->lock); 1181 + 1182 + /* 1183 + * Because we have preemption enabled we can get migrated around and 1184 + * end try selecting ourselves (current == env->p) as a swap candidate. 1185 + */ 1186 + if (cur == env->p) 1187 + goto unlock; 1186 1188 1187 1189 /* 1188 1190 * "imp" is the fault differential for the source task between the ··· 7960 7948 .switched_to = switched_to_fair, 7961 7949 7962 7950 .get_rr_interval = get_rr_interval_fair, 7951 + 7952 + .update_curr = update_curr_fair, 7963 7953 7964 7954 #ifdef CONFIG_FAIR_GROUP_SCHED 7965 7955 .task_move_group = task_move_group_fair,
+5
kernel/sched/idle_task.c
··· 75 75 return 0; 76 76 } 77 77 78 + static void update_curr_idle(struct rq *rq) 79 + { 80 + } 81 + 78 82 /* 79 83 * Simple, special scheduling class for the per-CPU idle tasks: 80 84 */ ··· 105 101 106 102 .prio_changed = prio_changed_idle, 107 103 .switched_to = switched_to_idle, 104 + .update_curr = update_curr_idle, 108 105 };
+2
kernel/sched/rt.c
··· 2128 2128 2129 2129 .prio_changed = prio_changed_rt, 2130 2130 .switched_to = switched_to_rt, 2131 + 2132 + .update_curr = update_curr_rt, 2131 2133 }; 2132 2134 2133 2135 #ifdef CONFIG_SCHED_DEBUG
+2
kernel/sched/sched.h
··· 1135 1135 unsigned int (*get_rr_interval) (struct rq *rq, 1136 1136 struct task_struct *task); 1137 1137 1138 + void (*update_curr) (struct rq *rq); 1139 + 1138 1140 #ifdef CONFIG_FAIR_GROUP_SCHED 1139 1141 void (*task_move_group) (struct task_struct *p, int on_rq); 1140 1142 #endif
+5
kernel/sched/stop_task.c
··· 102 102 return 0; 103 103 } 104 104 105 + static void update_curr_stop(struct rq *rq) 106 + { 107 + } 108 + 105 109 /* 106 110 * Simple, special scheduling class for the per-CPU stop tasks: 107 111 */ ··· 132 128 133 129 .prio_changed = prio_changed_stop, 134 130 .switched_to = switched_to_stop, 131 + .update_curr = update_curr_stop, 135 132 };
+1 -1
kernel/time/posix-cpu-timers.c
··· 553 553 *sample = cputime_to_expires(cputime.utime); 554 554 break; 555 555 case CPUCLOCK_SCHED: 556 - *sample = cputime.sum_exec_runtime + task_delta_exec(p); 556 + *sample = cputime.sum_exec_runtime; 557 557 break; 558 558 } 559 559 return 0;
+54 -27
kernel/trace/ring_buffer.c
··· 538 538 * ring_buffer_wait - wait for input to the ring buffer 539 539 * @buffer: buffer to wait on 540 540 * @cpu: the cpu buffer to wait on 541 + * @full: wait until a full page is available, if @cpu != RING_BUFFER_ALL_CPUS 541 542 * 542 543 * If @cpu == RING_BUFFER_ALL_CPUS then the task will wake up as soon 543 544 * as data is added to any of the @buffer's cpu buffers. Otherwise 544 545 * it will wait for data to be added to a specific cpu buffer. 545 546 */ 546 - int ring_buffer_wait(struct ring_buffer *buffer, int cpu) 547 + int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full) 547 548 { 548 - struct ring_buffer_per_cpu *cpu_buffer; 549 + struct ring_buffer_per_cpu *uninitialized_var(cpu_buffer); 549 550 DEFINE_WAIT(wait); 550 551 struct rb_irq_work *work; 552 + int ret = 0; 551 553 552 554 /* 553 555 * Depending on what the caller is waiting for, either any ··· 566 564 } 567 565 568 566 569 - prepare_to_wait(&work->waiters, &wait, TASK_INTERRUPTIBLE); 567 + while (true) { 568 + prepare_to_wait(&work->waiters, &wait, TASK_INTERRUPTIBLE); 570 569 571 - /* 572 - * The events can happen in critical sections where 573 - * checking a work queue can cause deadlocks. 574 - * After adding a task to the queue, this flag is set 575 - * only to notify events to try to wake up the queue 576 - * using irq_work. 577 - * 578 - * We don't clear it even if the buffer is no longer 579 - * empty. The flag only causes the next event to run 580 - * irq_work to do the work queue wake up. The worse 581 - * that can happen if we race with !trace_empty() is that 582 - * an event will cause an irq_work to try to wake up 583 - * an empty queue. 584 - * 585 - * There's no reason to protect this flag either, as 586 - * the work queue and irq_work logic will do the necessary 587 - * synchronization for the wake ups. The only thing 588 - * that is necessary is that the wake up happens after 589 - * a task has been queued. It's OK for spurious wake ups. 590 - */ 591 - work->waiters_pending = true; 570 + /* 571 + * The events can happen in critical sections where 572 + * checking a work queue can cause deadlocks. 573 + * After adding a task to the queue, this flag is set 574 + * only to notify events to try to wake up the queue 575 + * using irq_work. 576 + * 577 + * We don't clear it even if the buffer is no longer 578 + * empty. The flag only causes the next event to run 579 + * irq_work to do the work queue wake up. The worse 580 + * that can happen if we race with !trace_empty() is that 581 + * an event will cause an irq_work to try to wake up 582 + * an empty queue. 583 + * 584 + * There's no reason to protect this flag either, as 585 + * the work queue and irq_work logic will do the necessary 586 + * synchronization for the wake ups. The only thing 587 + * that is necessary is that the wake up happens after 588 + * a task has been queued. It's OK for spurious wake ups. 589 + */ 590 + work->waiters_pending = true; 592 591 593 - if ((cpu == RING_BUFFER_ALL_CPUS && ring_buffer_empty(buffer)) || 594 - (cpu != RING_BUFFER_ALL_CPUS && ring_buffer_empty_cpu(buffer, cpu))) 592 + if (signal_pending(current)) { 593 + ret = -EINTR; 594 + break; 595 + } 596 + 597 + if (cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) 598 + break; 599 + 600 + if (cpu != RING_BUFFER_ALL_CPUS && 601 + !ring_buffer_empty_cpu(buffer, cpu)) { 602 + unsigned long flags; 603 + bool pagebusy; 604 + 605 + if (!full) 606 + break; 607 + 608 + raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags); 609 + pagebusy = cpu_buffer->reader_page == cpu_buffer->commit_page; 610 + raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); 611 + 612 + if (!pagebusy) 613 + break; 614 + } 615 + 595 616 schedule(); 617 + } 596 618 597 619 finish_wait(&work->waiters, &wait); 598 - return 0; 620 + 621 + return ret; 599 622 } 600 623 601 624 /**
+15 -18
kernel/trace/trace.c
··· 1076 1076 } 1077 1077 #endif /* CONFIG_TRACER_MAX_TRACE */ 1078 1078 1079 - static int wait_on_pipe(struct trace_iterator *iter) 1079 + static int wait_on_pipe(struct trace_iterator *iter, bool full) 1080 1080 { 1081 1081 /* Iterators are static, they should be filled or empty */ 1082 1082 if (trace_buffer_iter(iter, iter->cpu_file)) 1083 1083 return 0; 1084 1084 1085 - return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file); 1085 + return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file, 1086 + full); 1086 1087 } 1087 1088 1088 1089 #ifdef CONFIG_FTRACE_STARTUP_TEST ··· 4435 4434 4436 4435 mutex_unlock(&iter->mutex); 4437 4436 4438 - ret = wait_on_pipe(iter); 4437 + ret = wait_on_pipe(iter, false); 4439 4438 4440 4439 mutex_lock(&iter->mutex); 4441 4440 4442 4441 if (ret) 4443 4442 return ret; 4444 - 4445 - if (signal_pending(current)) 4446 - return -EINTR; 4447 4443 } 4448 4444 4449 4445 return 1; ··· 5370 5372 goto out_unlock; 5371 5373 } 5372 5374 mutex_unlock(&trace_types_lock); 5373 - ret = wait_on_pipe(iter); 5375 + ret = wait_on_pipe(iter, false); 5374 5376 mutex_lock(&trace_types_lock); 5375 5377 if (ret) { 5376 5378 size = ret; 5377 - goto out_unlock; 5378 - } 5379 - if (signal_pending(current)) { 5380 - size = -EINTR; 5381 5379 goto out_unlock; 5382 5380 } 5383 5381 goto again; ··· 5494 5500 }; 5495 5501 struct buffer_ref *ref; 5496 5502 int entries, size, i; 5497 - ssize_t ret; 5503 + ssize_t ret = 0; 5498 5504 5499 5505 mutex_lock(&trace_types_lock); 5500 5506 ··· 5532 5538 int r; 5533 5539 5534 5540 ref = kzalloc(sizeof(*ref), GFP_KERNEL); 5535 - if (!ref) 5541 + if (!ref) { 5542 + ret = -ENOMEM; 5536 5543 break; 5544 + } 5537 5545 5538 5546 ref->ref = 1; 5539 5547 ref->buffer = iter->trace_buffer->buffer; 5540 5548 ref->page = ring_buffer_alloc_read_page(ref->buffer, iter->cpu_file); 5541 5549 if (!ref->page) { 5550 + ret = -ENOMEM; 5542 5551 kfree(ref); 5543 5552 break; 5544 5553 } ··· 5579 5582 5580 5583 /* did we read anything? */ 5581 5584 if (!spd.nr_pages) { 5585 + if (ret) 5586 + goto out; 5587 + 5582 5588 if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) { 5583 5589 ret = -EAGAIN; 5584 5590 goto out; 5585 5591 } 5586 5592 mutex_unlock(&trace_types_lock); 5587 - ret = wait_on_pipe(iter); 5593 + ret = wait_on_pipe(iter, true); 5588 5594 mutex_lock(&trace_types_lock); 5589 5595 if (ret) 5590 5596 goto out; 5591 - if (signal_pending(current)) { 5592 - ret = -EINTR; 5593 - goto out; 5594 - } 5597 + 5595 5598 goto again; 5596 5599 } 5597 5600
+2 -2
lib/Makefile
··· 10 10 lib-y := ctype.o string.o vsprintf.o cmdline.o \ 11 11 rbtree.o radix-tree.o dump_stack.o timerqueue.o\ 12 12 idr.o int_sqrt.o extable.o \ 13 - sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ 13 + sha1.o md5.o irq_regs.o argv_split.o \ 14 14 proportions.o flex_proportions.o ratelimit.o show_mem.o \ 15 15 is_single_threaded.o plist.o decompress.o kobject_uevent.o \ 16 16 earlycpio.o ··· 26 26 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ 27 27 gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ 28 28 bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ 29 - percpu-refcount.o percpu_ida.o hash.o rhashtable.o 29 + percpu-refcount.o percpu_ida.o hash.o rhashtable.o reciprocal_div.o 30 30 obj-y += string_helpers.o 31 31 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o 32 32 obj-y += kstrtox.o
+5 -5
lib/rhashtable.c
··· 230 230 ht->shift++; 231 231 232 232 /* For each new bucket, search the corresponding old bucket 233 - * for the first entry that hashes to the new bucket, and 233 + * for the first entry that hashes to the new bucket, and 234 234 * link the new bucket to that entry. Since all the entries 235 235 * which will end up in the new bucket appear in the same 236 236 * old bucket, this constructs an entirely valid new hash ··· 248 248 } 249 249 250 250 /* Publish the new table pointer. Lookups may now traverse 251 - * the new table, but they will not benefit from any 252 - * additional efficiency until later steps unzip the buckets. 251 + * the new table, but they will not benefit from any 252 + * additional efficiency until later steps unzip the buckets. 253 253 */ 254 254 rcu_assign_pointer(ht->tbl, new_tbl); 255 255 ··· 306 306 307 307 ht->shift--; 308 308 309 - /* Link each bucket in the new table to the first bucket 309 + /* Link each bucket in the new table to the first bucket 310 310 * in the old table that contains entries which will hash 311 311 * to the new bucket. 312 312 */ 313 313 for (i = 0; i < ntbl->size; i++) { 314 314 ntbl->buckets[i] = tbl->buckets[i]; 315 315 316 - /* Link each bucket in the new table to the first bucket 316 + /* Link each bucket in the new table to the first bucket 317 317 * in the old table that contains entries which will hash 318 318 * to the new bucket. 319 319 */
+5 -4
mm/bootmem.c
··· 243 243 244 244 static int reset_managed_pages_done __initdata; 245 245 246 - static inline void __init reset_node_managed_pages(pg_data_t *pgdat) 246 + void reset_node_managed_pages(pg_data_t *pgdat) 247 247 { 248 248 struct zone *z; 249 - 250 - if (reset_managed_pages_done) 251 - return; 252 249 253 250 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) 254 251 z->managed_pages = 0; ··· 255 258 { 256 259 struct pglist_data *pgdat; 257 260 261 + if (reset_managed_pages_done) 262 + return; 263 + 258 264 for_each_online_pgdat(pgdat) 259 265 reset_node_managed_pages(pgdat); 266 + 260 267 reset_managed_pages_done = 1; 261 268 } 262 269
+16 -2
mm/compaction.c
··· 479 479 480 480 block_end_pfn = min(block_end_pfn, end_pfn); 481 481 482 + /* 483 + * pfn could pass the block_end_pfn if isolated freepage 484 + * is more than pageblock order. In this case, we adjust 485 + * scanning range to right one. 486 + */ 487 + if (pfn >= block_end_pfn) { 488 + block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); 489 + block_end_pfn = min(block_end_pfn, end_pfn); 490 + } 491 + 482 492 if (!pageblock_pfn_to_page(pfn, block_end_pfn, cc->zone)) 483 493 break; 484 494 ··· 1039 1029 } 1040 1030 1041 1031 acct_isolated(zone, cc); 1042 - /* Record where migration scanner will be restarted */ 1043 - cc->migrate_pfn = low_pfn; 1032 + /* 1033 + * Record where migration scanner will be restarted. If we end up in 1034 + * the same pageblock as the free scanner, make the scanners fully 1035 + * meet so that compact_finished() terminates compaction. 1036 + */ 1037 + cc->migrate_pfn = (end_pfn <= cc->free_pfn) ? low_pfn : cc->free_pfn; 1044 1038 1045 1039 return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; 1046 1040 }
+25
mm/internal.h
··· 108 108 /* 109 109 * in mm/page_alloc.c 110 110 */ 111 + 112 + /* 113 + * Locate the struct page for both the matching buddy in our 114 + * pair (buddy1) and the combined O(n+1) page they form (page). 115 + * 116 + * 1) Any buddy B1 will have an order O twin B2 which satisfies 117 + * the following equation: 118 + * B2 = B1 ^ (1 << O) 119 + * For example, if the starting buddy (buddy2) is #8 its order 120 + * 1 buddy is #10: 121 + * B2 = 8 ^ (1 << 1) = 8 ^ 2 = 10 122 + * 123 + * 2) Any buddy B will have an order O+1 parent P which 124 + * satisfies the following equation: 125 + * P = B & ~(1 << O) 126 + * 127 + * Assumption: *_mem_map is contiguous at least up to MAX_ORDER 128 + */ 129 + static inline unsigned long 130 + __find_buddy_index(unsigned long page_idx, unsigned int order) 131 + { 132 + return page_idx ^ (1 << order); 133 + } 134 + 135 + extern int __isolate_free_page(struct page *page, unsigned int order); 111 136 extern void __free_pages_bootmem(struct page *page, unsigned int order); 112 137 extern void prep_compound_page(struct page *page, unsigned long order); 113 138 #ifdef CONFIG_MEMORY_FAILURE
+2 -2
mm/iov_iter.c
··· 911 911 if (i->nr_segs == 1) 912 912 return i->count; 913 913 else if (i->type & ITER_BVEC) 914 - return min(i->count, i->iov->iov_len - i->iov_offset); 915 - else 916 914 return min(i->count, i->bvec->bv_len - i->iov_offset); 915 + else 916 + return min(i->count, i->iov->iov_len - i->iov_offset); 917 917 } 918 918 EXPORT_SYMBOL(iov_iter_single_seg_count); 919 919
+26
mm/memory_hotplug.c
··· 31 31 #include <linux/stop_machine.h> 32 32 #include <linux/hugetlb.h> 33 33 #include <linux/memblock.h> 34 + #include <linux/bootmem.h> 34 35 35 36 #include <asm/tlbflush.h> 36 37 ··· 1067 1066 } 1068 1067 #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 1069 1068 1069 + static void reset_node_present_pages(pg_data_t *pgdat) 1070 + { 1071 + struct zone *z; 1072 + 1073 + for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) 1074 + z->present_pages = 0; 1075 + 1076 + pgdat->node_present_pages = 0; 1077 + } 1078 + 1070 1079 /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ 1071 1080 static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) 1072 1081 { ··· 1106 1095 mutex_lock(&zonelists_mutex); 1107 1096 build_all_zonelists(pgdat, NULL); 1108 1097 mutex_unlock(&zonelists_mutex); 1098 + 1099 + /* 1100 + * zone->managed_pages is set to an approximate value in 1101 + * free_area_init_core(), which will cause 1102 + * /sys/device/system/node/nodeX/meminfo has wrong data. 1103 + * So reset it to 0 before any memory is onlined. 1104 + */ 1105 + reset_node_managed_pages(pgdat); 1106 + 1107 + /* 1108 + * When memory is hot-added, all the memory is in offline state. So 1109 + * clear all zones' present_pages because they will be updated in 1110 + * online_pages() and offline_pages(). 1111 + */ 1112 + reset_node_present_pages(pgdat); 1109 1113 1110 1114 return pgdat; 1111 1115 }
+5 -3
mm/nobootmem.c
··· 145 145 146 146 static int reset_managed_pages_done __initdata; 147 147 148 - static inline void __init reset_node_managed_pages(pg_data_t *pgdat) 148 + void reset_node_managed_pages(pg_data_t *pgdat) 149 149 { 150 150 struct zone *z; 151 151 152 - if (reset_managed_pages_done) 153 - return; 154 152 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) 155 153 z->managed_pages = 0; 156 154 } ··· 157 159 { 158 160 struct pglist_data *pgdat; 159 161 162 + if (reset_managed_pages_done) 163 + return; 164 + 160 165 for_each_online_pgdat(pgdat) 161 166 reset_node_managed_pages(pgdat); 167 + 162 168 reset_managed_pages_done = 1; 163 169 } 164 170
+29 -39
mm/page_alloc.c
··· 467 467 } 468 468 469 469 /* 470 - * Locate the struct page for both the matching buddy in our 471 - * pair (buddy1) and the combined O(n+1) page they form (page). 472 - * 473 - * 1) Any buddy B1 will have an order O twin B2 which satisfies 474 - * the following equation: 475 - * B2 = B1 ^ (1 << O) 476 - * For example, if the starting buddy (buddy2) is #8 its order 477 - * 1 buddy is #10: 478 - * B2 = 8 ^ (1 << 1) = 8 ^ 2 = 10 479 - * 480 - * 2) Any buddy B will have an order O+1 parent P which 481 - * satisfies the following equation: 482 - * P = B & ~(1 << O) 483 - * 484 - * Assumption: *_mem_map is contiguous at least up to MAX_ORDER 485 - */ 486 - static inline unsigned long 487 - __find_buddy_index(unsigned long page_idx, unsigned int order) 488 - { 489 - return page_idx ^ (1 << order); 490 - } 491 - 492 - /* 493 470 * This function checks whether a page is free && is the buddy 494 471 * we can do coalesce a page and its buddy if 495 472 * (a) the buddy is not in a hole && ··· 546 569 unsigned long combined_idx; 547 570 unsigned long uninitialized_var(buddy_idx); 548 571 struct page *buddy; 572 + int max_order = MAX_ORDER; 549 573 550 574 VM_BUG_ON(!zone_is_initialized(zone)); 551 575 ··· 555 577 return; 556 578 557 579 VM_BUG_ON(migratetype == -1); 580 + if (is_migrate_isolate(migratetype)) { 581 + /* 582 + * We restrict max order of merging to prevent merge 583 + * between freepages on isolate pageblock and normal 584 + * pageblock. Without this, pageblock isolation 585 + * could cause incorrect freepage accounting. 586 + */ 587 + max_order = min(MAX_ORDER, pageblock_order + 1); 588 + } else { 589 + __mod_zone_freepage_state(zone, 1 << order, migratetype); 590 + } 558 591 559 - page_idx = pfn & ((1 << MAX_ORDER) - 1); 592 + page_idx = pfn & ((1 << max_order) - 1); 560 593 561 594 VM_BUG_ON_PAGE(page_idx & ((1 << order) - 1), page); 562 595 VM_BUG_ON_PAGE(bad_range(zone, page), page); 563 596 564 - while (order < MAX_ORDER-1) { 597 + while (order < max_order - 1) { 565 598 buddy_idx = __find_buddy_index(page_idx, order); 566 599 buddy = page + (buddy_idx - page_idx); 567 600 if (!page_is_buddy(page, buddy, order)) ··· 583 594 */ 584 595 if (page_is_guard(buddy)) { 585 596 clear_page_guard_flag(buddy); 586 - set_page_private(page, 0); 587 - __mod_zone_freepage_state(zone, 1 << order, 588 - migratetype); 597 + set_page_private(buddy, 0); 598 + if (!is_migrate_isolate(migratetype)) { 599 + __mod_zone_freepage_state(zone, 1 << order, 600 + migratetype); 601 + } 589 602 } else { 590 603 list_del(&buddy->lru); 591 604 zone->free_area[order].nr_free--; ··· 706 715 /* must delete as __free_one_page list manipulates */ 707 716 list_del(&page->lru); 708 717 mt = get_freepage_migratetype(page); 718 + if (unlikely(has_isolate_pageblock(zone))) 719 + mt = get_pageblock_migratetype(page); 720 + 709 721 /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ 710 722 __free_one_page(page, page_to_pfn(page), zone, 0, mt); 711 723 trace_mm_page_pcpu_drain(page, 0, mt); 712 - if (likely(!is_migrate_isolate_page(page))) { 713 - __mod_zone_page_state(zone, NR_FREE_PAGES, 1); 714 - if (is_migrate_cma(mt)) 715 - __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1); 716 - } 717 724 } while (--to_free && --batch_free && !list_empty(list)); 718 725 } 719 726 spin_unlock(&zone->lock); ··· 728 739 if (nr_scanned) 729 740 __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); 730 741 742 + if (unlikely(has_isolate_pageblock(zone) || 743 + is_migrate_isolate(migratetype))) { 744 + migratetype = get_pfnblock_migratetype(page, pfn); 745 + } 731 746 __free_one_page(page, pfn, zone, order, migratetype); 732 - if (unlikely(!is_migrate_isolate(migratetype))) 733 - __mod_zone_freepage_state(zone, 1 << order, migratetype); 734 747 spin_unlock(&zone->lock); 735 748 } 736 749 ··· 1475 1484 } 1476 1485 EXPORT_SYMBOL_GPL(split_page); 1477 1486 1478 - static int __isolate_free_page(struct page *page, unsigned int order) 1487 + int __isolate_free_page(struct page *page, unsigned int order) 1479 1488 { 1480 1489 unsigned long watermark; 1481 1490 struct zone *zone; ··· 6399 6408 6400 6409 /* Make sure the range is really isolated. */ 6401 6410 if (test_pages_isolated(outer_start, end, false)) { 6402 - pr_warn("alloc_contig_range test_pages_isolated(%lx, %lx) failed\n", 6403 - outer_start, end); 6411 + pr_info("%s: [%lx, %lx) PFNs busy\n", 6412 + __func__, outer_start, end); 6404 6413 ret = -EBUSY; 6405 6414 goto done; 6406 6415 } 6407 - 6408 6416 6409 6417 /* Grab isolated pages from freelists. */ 6410 6418 outer_end = isolate_freepages_range(&cc, outer_start, end);
+41 -2
mm/page_isolation.c
··· 60 60 int migratetype = get_pageblock_migratetype(page); 61 61 62 62 set_pageblock_migratetype(page, MIGRATE_ISOLATE); 63 + zone->nr_isolate_pageblock++; 63 64 nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE); 64 65 65 66 __mod_zone_freepage_state(zone, -nr_pages, migratetype); ··· 76 75 { 77 76 struct zone *zone; 78 77 unsigned long flags, nr_pages; 78 + struct page *isolated_page = NULL; 79 + unsigned int order; 80 + unsigned long page_idx, buddy_idx; 81 + struct page *buddy; 79 82 80 83 zone = page_zone(page); 81 84 spin_lock_irqsave(&zone->lock, flags); 82 85 if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) 83 86 goto out; 84 - nr_pages = move_freepages_block(zone, page, migratetype); 85 - __mod_zone_freepage_state(zone, nr_pages, migratetype); 87 + 88 + /* 89 + * Because freepage with more than pageblock_order on isolated 90 + * pageblock is restricted to merge due to freepage counting problem, 91 + * it is possible that there is free buddy page. 92 + * move_freepages_block() doesn't care of merge so we need other 93 + * approach in order to merge them. Isolation and free will make 94 + * these pages to be merged. 95 + */ 96 + if (PageBuddy(page)) { 97 + order = page_order(page); 98 + if (order >= pageblock_order) { 99 + page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1); 100 + buddy_idx = __find_buddy_index(page_idx, order); 101 + buddy = page + (buddy_idx - page_idx); 102 + 103 + if (!is_migrate_isolate_page(buddy)) { 104 + __isolate_free_page(page, order); 105 + set_page_refcounted(page); 106 + isolated_page = page; 107 + } 108 + } 109 + } 110 + 111 + /* 112 + * If we isolate freepage with more than pageblock_order, there 113 + * should be no freepage in the range, so we could avoid costly 114 + * pageblock scanning for freepage moving. 115 + */ 116 + if (!isolated_page) { 117 + nr_pages = move_freepages_block(zone, page, migratetype); 118 + __mod_zone_freepage_state(zone, nr_pages, migratetype); 119 + } 86 120 set_pageblock_migratetype(page, migratetype); 121 + zone->nr_isolate_pageblock--; 87 122 out: 88 123 spin_unlock_irqrestore(&zone->lock, flags); 124 + if (isolated_page) 125 + __free_pages(isolated_page, order); 89 126 } 90 127 91 128 static inline struct page *
+4
mm/slab_common.c
··· 259 259 if (s->size - size >= sizeof(void *)) 260 260 continue; 261 261 262 + if (IS_ENABLED(CONFIG_SLAB) && align && 263 + (align > s->align || s->align % align)) 264 + continue; 265 + 262 266 return s; 263 267 } 264 268 return NULL;
+1 -2
net/bridge/br_multicast.c
··· 813 813 return; 814 814 815 815 if (port) { 816 - __skb_push(skb, sizeof(struct ethhdr)); 817 816 skb->dev = port->dev; 818 817 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, 819 - dev_queue_xmit); 818 + br_dev_queue_push_xmit); 820 819 } else { 821 820 br_multicast_select_own_querier(br, ip, skb); 822 821 netif_rx(skb);
+1
net/bridge/br_netlink.c
··· 280 280 [IFLA_BRPORT_MODE] = { .type = NLA_U8 }, 281 281 [IFLA_BRPORT_GUARD] = { .type = NLA_U8 }, 282 282 [IFLA_BRPORT_PROTECT] = { .type = NLA_U8 }, 283 + [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 }, 283 284 [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 }, 284 285 [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 }, 285 286 };
+1
net/bridge/netfilter/nft_reject_bridge.c
··· 18 18 #include <net/netfilter/ipv6/nf_reject.h> 19 19 #include <linux/ip.h> 20 20 #include <net/ip.h> 21 + #include <net/ip6_checksum.h> 21 22 #include <linux/netfilter_bridge.h> 22 23 #include "../br_private.h" 23 24
+132 -37
net/ceph/crypto.c
··· 90 90 91 91 static const u8 *aes_iv = (u8 *)CEPH_AES_IV; 92 92 93 + /* 94 + * Should be used for buffers allocated with ceph_kvmalloc(). 95 + * Currently these are encrypt out-buffer (ceph_buffer) and decrypt 96 + * in-buffer (msg front). 97 + * 98 + * Dispose of @sgt with teardown_sgtable(). 99 + * 100 + * @prealloc_sg is to avoid memory allocation inside sg_alloc_table() 101 + * in cases where a single sg is sufficient. No attempt to reduce the 102 + * number of sgs by squeezing physically contiguous pages together is 103 + * made though, for simplicity. 104 + */ 105 + static int setup_sgtable(struct sg_table *sgt, struct scatterlist *prealloc_sg, 106 + const void *buf, unsigned int buf_len) 107 + { 108 + struct scatterlist *sg; 109 + const bool is_vmalloc = is_vmalloc_addr(buf); 110 + unsigned int off = offset_in_page(buf); 111 + unsigned int chunk_cnt = 1; 112 + unsigned int chunk_len = PAGE_ALIGN(off + buf_len); 113 + int i; 114 + int ret; 115 + 116 + if (buf_len == 0) { 117 + memset(sgt, 0, sizeof(*sgt)); 118 + return -EINVAL; 119 + } 120 + 121 + if (is_vmalloc) { 122 + chunk_cnt = chunk_len >> PAGE_SHIFT; 123 + chunk_len = PAGE_SIZE; 124 + } 125 + 126 + if (chunk_cnt > 1) { 127 + ret = sg_alloc_table(sgt, chunk_cnt, GFP_NOFS); 128 + if (ret) 129 + return ret; 130 + } else { 131 + WARN_ON(chunk_cnt != 1); 132 + sg_init_table(prealloc_sg, 1); 133 + sgt->sgl = prealloc_sg; 134 + sgt->nents = sgt->orig_nents = 1; 135 + } 136 + 137 + for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) { 138 + struct page *page; 139 + unsigned int len = min(chunk_len - off, buf_len); 140 + 141 + if (is_vmalloc) 142 + page = vmalloc_to_page(buf); 143 + else 144 + page = virt_to_page(buf); 145 + 146 + sg_set_page(sg, page, len, off); 147 + 148 + off = 0; 149 + buf += len; 150 + buf_len -= len; 151 + } 152 + WARN_ON(buf_len != 0); 153 + 154 + return 0; 155 + } 156 + 157 + static void teardown_sgtable(struct sg_table *sgt) 158 + { 159 + if (sgt->orig_nents > 1) 160 + sg_free_table(sgt); 161 + } 162 + 93 163 static int ceph_aes_encrypt(const void *key, int key_len, 94 164 void *dst, size_t *dst_len, 95 165 const void *src, size_t src_len) 96 166 { 97 - struct scatterlist sg_in[2], sg_out[1]; 167 + struct scatterlist sg_in[2], prealloc_sg; 168 + struct sg_table sg_out; 98 169 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); 99 170 struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; 100 171 int ret; ··· 181 110 182 111 *dst_len = src_len + zero_padding; 183 112 184 - crypto_blkcipher_setkey((void *)tfm, key, key_len); 185 113 sg_init_table(sg_in, 2); 186 114 sg_set_buf(&sg_in[0], src, src_len); 187 115 sg_set_buf(&sg_in[1], pad, zero_padding); 188 - sg_init_table(sg_out, 1); 189 - sg_set_buf(sg_out, dst, *dst_len); 116 + ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len); 117 + if (ret) 118 + goto out_tfm; 119 + 120 + crypto_blkcipher_setkey((void *)tfm, key, key_len); 190 121 iv = crypto_blkcipher_crt(tfm)->iv; 191 122 ivsize = crypto_blkcipher_ivsize(tfm); 192 - 193 123 memcpy(iv, aes_iv, ivsize); 124 + 194 125 /* 195 126 print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, 196 127 key, key_len, 1); ··· 201 128 print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, 202 129 pad, zero_padding, 1); 203 130 */ 204 - ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, 131 + ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in, 205 132 src_len + zero_padding); 206 - crypto_free_blkcipher(tfm); 207 - if (ret < 0) 133 + if (ret < 0) { 208 134 pr_err("ceph_aes_crypt failed %d\n", ret); 135 + goto out_sg; 136 + } 209 137 /* 210 138 print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, 211 139 dst, *dst_len, 1); 212 140 */ 213 - return 0; 141 + 142 + out_sg: 143 + teardown_sgtable(&sg_out); 144 + out_tfm: 145 + crypto_free_blkcipher(tfm); 146 + return ret; 214 147 } 215 148 216 149 static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, ··· 224 145 const void *src1, size_t src1_len, 225 146 const void *src2, size_t src2_len) 226 147 { 227 - struct scatterlist sg_in[3], sg_out[1]; 148 + struct scatterlist sg_in[3], prealloc_sg; 149 + struct sg_table sg_out; 228 150 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); 229 151 struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; 230 152 int ret; ··· 241 161 242 162 *dst_len = src1_len + src2_len + zero_padding; 243 163 244 - crypto_blkcipher_setkey((void *)tfm, key, key_len); 245 164 sg_init_table(sg_in, 3); 246 165 sg_set_buf(&sg_in[0], src1, src1_len); 247 166 sg_set_buf(&sg_in[1], src2, src2_len); 248 167 sg_set_buf(&sg_in[2], pad, zero_padding); 249 - sg_init_table(sg_out, 1); 250 - sg_set_buf(sg_out, dst, *dst_len); 168 + ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len); 169 + if (ret) 170 + goto out_tfm; 171 + 172 + crypto_blkcipher_setkey((void *)tfm, key, key_len); 251 173 iv = crypto_blkcipher_crt(tfm)->iv; 252 174 ivsize = crypto_blkcipher_ivsize(tfm); 253 - 254 175 memcpy(iv, aes_iv, ivsize); 176 + 255 177 /* 256 178 print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, 257 179 key, key_len, 1); ··· 264 182 print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, 265 183 pad, zero_padding, 1); 266 184 */ 267 - ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, 185 + ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in, 268 186 src1_len + src2_len + zero_padding); 269 - crypto_free_blkcipher(tfm); 270 - if (ret < 0) 187 + if (ret < 0) { 271 188 pr_err("ceph_aes_crypt2 failed %d\n", ret); 189 + goto out_sg; 190 + } 272 191 /* 273 192 print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, 274 193 dst, *dst_len, 1); 275 194 */ 276 - return 0; 195 + 196 + out_sg: 197 + teardown_sgtable(&sg_out); 198 + out_tfm: 199 + crypto_free_blkcipher(tfm); 200 + return ret; 277 201 } 278 202 279 203 static int ceph_aes_decrypt(const void *key, int key_len, 280 204 void *dst, size_t *dst_len, 281 205 const void *src, size_t src_len) 282 206 { 283 - struct scatterlist sg_in[1], sg_out[2]; 207 + struct sg_table sg_in; 208 + struct scatterlist sg_out[2], prealloc_sg; 284 209 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); 285 210 struct blkcipher_desc desc = { .tfm = tfm }; 286 211 char pad[16]; ··· 299 210 if (IS_ERR(tfm)) 300 211 return PTR_ERR(tfm); 301 212 302 - crypto_blkcipher_setkey((void *)tfm, key, key_len); 303 - sg_init_table(sg_in, 1); 304 213 sg_init_table(sg_out, 2); 305 - sg_set_buf(sg_in, src, src_len); 306 214 sg_set_buf(&sg_out[0], dst, *dst_len); 307 215 sg_set_buf(&sg_out[1], pad, sizeof(pad)); 216 + ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len); 217 + if (ret) 218 + goto out_tfm; 308 219 220 + crypto_blkcipher_setkey((void *)tfm, key, key_len); 309 221 iv = crypto_blkcipher_crt(tfm)->iv; 310 222 ivsize = crypto_blkcipher_ivsize(tfm); 311 - 312 223 memcpy(iv, aes_iv, ivsize); 313 224 314 225 /* ··· 317 228 print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, 318 229 src, src_len, 1); 319 230 */ 320 - 321 - ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len); 322 - crypto_free_blkcipher(tfm); 231 + ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len); 323 232 if (ret < 0) { 324 233 pr_err("ceph_aes_decrypt failed %d\n", ret); 325 - return ret; 234 + goto out_sg; 326 235 } 327 236 328 237 if (src_len <= *dst_len) ··· 338 251 print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1, 339 252 dst, *dst_len, 1); 340 253 */ 341 - return 0; 254 + 255 + out_sg: 256 + teardown_sgtable(&sg_in); 257 + out_tfm: 258 + crypto_free_blkcipher(tfm); 259 + return ret; 342 260 } 343 261 344 262 static int ceph_aes_decrypt2(const void *key, int key_len, ··· 351 259 void *dst2, size_t *dst2_len, 352 260 const void *src, size_t src_len) 353 261 { 354 - struct scatterlist sg_in[1], sg_out[3]; 262 + struct sg_table sg_in; 263 + struct scatterlist sg_out[3], prealloc_sg; 355 264 struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); 356 265 struct blkcipher_desc desc = { .tfm = tfm }; 357 266 char pad[16]; ··· 364 271 if (IS_ERR(tfm)) 365 272 return PTR_ERR(tfm); 366 273 367 - sg_init_table(sg_in, 1); 368 - sg_set_buf(sg_in, src, src_len); 369 274 sg_init_table(sg_out, 3); 370 275 sg_set_buf(&sg_out[0], dst1, *dst1_len); 371 276 sg_set_buf(&sg_out[1], dst2, *dst2_len); 372 277 sg_set_buf(&sg_out[2], pad, sizeof(pad)); 278 + ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len); 279 + if (ret) 280 + goto out_tfm; 373 281 374 282 crypto_blkcipher_setkey((void *)tfm, key, key_len); 375 283 iv = crypto_blkcipher_crt(tfm)->iv; 376 284 ivsize = crypto_blkcipher_ivsize(tfm); 377 - 378 285 memcpy(iv, aes_iv, ivsize); 379 286 380 287 /* ··· 383 290 print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, 384 291 src, src_len, 1); 385 292 */ 386 - 387 - ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len); 388 - crypto_free_blkcipher(tfm); 293 + ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len); 389 294 if (ret < 0) { 390 295 pr_err("ceph_aes_decrypt failed %d\n", ret); 391 - return ret; 296 + goto out_sg; 392 297 } 393 298 394 299 if (src_len <= *dst1_len) ··· 416 325 dst2, *dst2_len, 1); 417 326 */ 418 327 419 - return 0; 328 + out_sg: 329 + teardown_sgtable(&sg_in); 330 + out_tfm: 331 + crypto_free_blkcipher(tfm); 332 + return ret; 420 333 } 421 334 422 335
+5 -2
net/ceph/osd_client.c
··· 1007 1007 static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) 1008 1008 { 1009 1009 dout("__remove_osd %p\n", osd); 1010 - BUG_ON(!list_empty(&osd->o_requests)); 1011 - BUG_ON(!list_empty(&osd->o_linger_requests)); 1010 + WARN_ON(!list_empty(&osd->o_requests)); 1011 + WARN_ON(!list_empty(&osd->o_linger_requests)); 1012 1012 1013 1013 rb_erase(&osd->o_node, &osdc->osds); 1014 1014 list_del_init(&osd->o_osd_lru); ··· 1254 1254 if (list_empty(&req->r_osd_item)) 1255 1255 req->r_osd = NULL; 1256 1256 } 1257 + 1258 + list_del_init(&req->r_req_lru_item); /* can be on notarget */ 1257 1259 ceph_osdc_put_request(req); 1258 1260 } 1259 1261 ··· 1397 1395 if (req->r_osd) { 1398 1396 __cancel_request(req); 1399 1397 list_del_init(&req->r_osd_item); 1398 + list_del_init(&req->r_linger_osd_item); 1400 1399 req->r_osd = NULL; 1401 1400 } 1402 1401
+18 -5
net/core/rtnetlink.c
··· 2685 2685 int idx = 0; 2686 2686 u32 portid = NETLINK_CB(cb->skb).portid; 2687 2687 u32 seq = cb->nlh->nlmsg_seq; 2688 - struct nlattr *extfilt; 2689 2688 u32 filter_mask = 0; 2690 2689 2691 - extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), 2692 - IFLA_EXT_MASK); 2693 - if (extfilt) 2694 - filter_mask = nla_get_u32(extfilt); 2690 + if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) { 2691 + struct nlattr *extfilt; 2692 + 2693 + extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), 2694 + IFLA_EXT_MASK); 2695 + if (extfilt) { 2696 + if (nla_len(extfilt) < sizeof(filter_mask)) 2697 + return -EINVAL; 2698 + 2699 + filter_mask = nla_get_u32(extfilt); 2700 + } 2701 + } 2695 2702 2696 2703 rcu_read_lock(); 2697 2704 for_each_netdev_rcu(net, dev) { ··· 2805 2798 if (br_spec) { 2806 2799 nla_for_each_nested(attr, br_spec, rem) { 2807 2800 if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { 2801 + if (nla_len(attr) < sizeof(flags)) 2802 + return -EINVAL; 2803 + 2808 2804 have_flags = true; 2809 2805 flags = nla_get_u16(attr); 2810 2806 break; ··· 2878 2868 if (br_spec) { 2879 2869 nla_for_each_nested(attr, br_spec, rem) { 2880 2870 if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { 2871 + if (nla_len(attr) < sizeof(flags)) 2872 + return -EINVAL; 2873 + 2881 2874 have_flags = true; 2882 2875 flags = nla_get_u16(attr); 2883 2876 break;
+6 -17
net/core/skbuff.c
··· 552 552 case SKB_FCLONE_CLONE: 553 553 fclones = container_of(skb, struct sk_buff_fclones, skb2); 554 554 555 - /* Warning : We must perform the atomic_dec_and_test() before 556 - * setting skb->fclone back to SKB_FCLONE_FREE, otherwise 557 - * skb_clone() could set clone_ref to 2 before our decrement. 558 - * Anyway, if we are going to free the structure, no need to 559 - * rewrite skb->fclone. 555 + /* The clone portion is available for 556 + * fast-cloning again. 560 557 */ 561 - if (atomic_dec_and_test(&fclones->fclone_ref)) { 558 + skb->fclone = SKB_FCLONE_FREE; 559 + 560 + if (atomic_dec_and_test(&fclones->fclone_ref)) 562 561 kmem_cache_free(skbuff_fclone_cache, fclones); 563 - } else { 564 - /* The clone portion is available for 565 - * fast-cloning again. 566 - */ 567 - skb->fclone = SKB_FCLONE_FREE; 568 - } 569 562 break; 570 563 } 571 564 } ··· 880 887 if (skb->fclone == SKB_FCLONE_ORIG && 881 888 n->fclone == SKB_FCLONE_FREE) { 882 889 n->fclone = SKB_FCLONE_CLONE; 883 - /* As our fastclone was free, clone_ref must be 1 at this point. 884 - * We could use atomic_inc() here, but it is faster 885 - * to set the final value. 886 - */ 887 - atomic_set(&fclones->fclone_ref, 2); 890 + atomic_inc(&fclones->fclone_ref); 888 891 } else { 889 892 if (skb_pfmemalloc(skb)) 890 893 gfp_mask |= __GFP_MEMALLOC;
+18 -18
net/dcb/dcbnl.c
··· 1080 1080 if (!app) 1081 1081 return -EMSGSIZE; 1082 1082 1083 - spin_lock(&dcb_lock); 1083 + spin_lock_bh(&dcb_lock); 1084 1084 list_for_each_entry(itr, &dcb_app_list, list) { 1085 1085 if (itr->ifindex == netdev->ifindex) { 1086 1086 err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), 1087 1087 &itr->app); 1088 1088 if (err) { 1089 - spin_unlock(&dcb_lock); 1089 + spin_unlock_bh(&dcb_lock); 1090 1090 return -EMSGSIZE; 1091 1091 } 1092 1092 } ··· 1097 1097 else 1098 1098 dcbx = -EOPNOTSUPP; 1099 1099 1100 - spin_unlock(&dcb_lock); 1100 + spin_unlock_bh(&dcb_lock); 1101 1101 nla_nest_end(skb, app); 1102 1102 1103 1103 /* get peer info if available */ ··· 1234 1234 } 1235 1235 1236 1236 /* local app */ 1237 - spin_lock(&dcb_lock); 1237 + spin_lock_bh(&dcb_lock); 1238 1238 app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); 1239 1239 if (!app) 1240 1240 goto dcb_unlock; ··· 1271 1271 else 1272 1272 dcbx = -EOPNOTSUPP; 1273 1273 1274 - spin_unlock(&dcb_lock); 1274 + spin_unlock_bh(&dcb_lock); 1275 1275 1276 1276 /* features flags */ 1277 1277 if (ops->getfeatcfg) { ··· 1326 1326 return 0; 1327 1327 1328 1328 dcb_unlock: 1329 - spin_unlock(&dcb_lock); 1329 + spin_unlock_bh(&dcb_lock); 1330 1330 nla_put_failure: 1331 1331 return err; 1332 1332 } ··· 1762 1762 struct dcb_app_type *itr; 1763 1763 u8 prio = 0; 1764 1764 1765 - spin_lock(&dcb_lock); 1765 + spin_lock_bh(&dcb_lock); 1766 1766 if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) 1767 1767 prio = itr->app.priority; 1768 - spin_unlock(&dcb_lock); 1768 + spin_unlock_bh(&dcb_lock); 1769 1769 1770 1770 return prio; 1771 1771 } ··· 1789 1789 if (dev->dcbnl_ops->getdcbx) 1790 1790 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1791 1791 1792 - spin_lock(&dcb_lock); 1792 + spin_lock_bh(&dcb_lock); 1793 1793 /* Search for existing match and replace */ 1794 1794 if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { 1795 1795 if (new->priority) ··· 1804 1804 if (new->priority) 1805 1805 err = dcb_app_add(new, dev->ifindex); 1806 1806 out: 1807 - spin_unlock(&dcb_lock); 1807 + spin_unlock_bh(&dcb_lock); 1808 1808 if (!err) 1809 1809 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1810 1810 return err; ··· 1823 1823 struct dcb_app_type *itr; 1824 1824 u8 prio = 0; 1825 1825 1826 - spin_lock(&dcb_lock); 1826 + spin_lock_bh(&dcb_lock); 1827 1827 if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) 1828 1828 prio |= 1 << itr->app.priority; 1829 - spin_unlock(&dcb_lock); 1829 + spin_unlock_bh(&dcb_lock); 1830 1830 1831 1831 return prio; 1832 1832 } ··· 1850 1850 if (dev->dcbnl_ops->getdcbx) 1851 1851 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1852 1852 1853 - spin_lock(&dcb_lock); 1853 + spin_lock_bh(&dcb_lock); 1854 1854 /* Search for existing match and abort if found */ 1855 1855 if (dcb_app_lookup(new, dev->ifindex, new->priority)) { 1856 1856 err = -EEXIST; ··· 1859 1859 1860 1860 err = dcb_app_add(new, dev->ifindex); 1861 1861 out: 1862 - spin_unlock(&dcb_lock); 1862 + spin_unlock_bh(&dcb_lock); 1863 1863 if (!err) 1864 1864 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1865 1865 return err; ··· 1882 1882 if (dev->dcbnl_ops->getdcbx) 1883 1883 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1884 1884 1885 - spin_lock(&dcb_lock); 1885 + spin_lock_bh(&dcb_lock); 1886 1886 /* Search for existing match and remove it. */ 1887 1887 if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { 1888 1888 list_del(&itr->list); ··· 1890 1890 err = 0; 1891 1891 } 1892 1892 1893 - spin_unlock(&dcb_lock); 1893 + spin_unlock_bh(&dcb_lock); 1894 1894 if (!err) 1895 1895 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1896 1896 return err; ··· 1902 1902 struct dcb_app_type *app; 1903 1903 struct dcb_app_type *tmp; 1904 1904 1905 - spin_lock(&dcb_lock); 1905 + spin_lock_bh(&dcb_lock); 1906 1906 list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { 1907 1907 list_del(&app->list); 1908 1908 kfree(app); 1909 1909 } 1910 - spin_unlock(&dcb_lock); 1910 + spin_unlock_bh(&dcb_lock); 1911 1911 } 1912 1912 1913 1913 static int __init dcbnl_init(void)
+5 -2
net/dsa/slave.c
··· 489 489 /* We could not connect to a designated PHY, so use the switch internal 490 490 * MDIO bus instead 491 491 */ 492 - if (!p->phy) 492 + if (!p->phy) { 493 493 p->phy = ds->slave_mii_bus->phy_map[p->port]; 494 - else 494 + phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, 495 + p->phy_interface); 496 + } else { 495 497 pr_info("attached PHY at address %d [%s]\n", 496 498 p->phy->addr, p->phy->drv->name); 499 + } 497 500 } 498 501 499 502 int dsa_slave_suspend(struct net_device *slave_dev)
+11
net/ipv4/af_inet.c
··· 1386 1386 return pp; 1387 1387 } 1388 1388 1389 + int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) 1390 + { 1391 + if (sk->sk_family == AF_INET) 1392 + return ip_recv_error(sk, msg, len, addr_len); 1393 + #if IS_ENABLED(CONFIG_IPV6) 1394 + if (sk->sk_family == AF_INET6) 1395 + return pingv6_ops.ipv6_recv_error(sk, msg, len, addr_len); 1396 + #endif 1397 + return -EINVAL; 1398 + } 1399 + 1389 1400 static int inet_gro_complete(struct sk_buff *skb, int nhoff) 1390 1401 { 1391 1402 __be16 newlen = htons(skb->len - nhoff);
+4
net/ipv4/fib_rules.c
··· 62 62 else 63 63 res->tclassid = 0; 64 64 #endif 65 + 66 + if (err == -ESRCH) 67 + err = -ENETUNREACH; 68 + 65 69 return err; 66 70 } 67 71 EXPORT_SYMBOL_GPL(__fib_lookup);
+2
net/ipv4/fou.c
··· 133 133 int err = -ENOSYS; 134 134 const struct net_offload **offloads; 135 135 136 + udp_tunnel_gro_complete(skb, nhoff); 137 + 136 138 rcu_read_lock(); 137 139 offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; 138 140 ops = rcu_dereference(offloads[proto]);
+3
net/ipv4/geneve.c
··· 144 144 gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len); 145 145 geneve_build_header(gnvh, tun_flags, vni, opt_len, opt); 146 146 147 + skb_set_inner_protocol(skb, htons(ETH_P_TEB)); 148 + 147 149 return udp_tunnel_xmit_skb(gs->sock, rt, skb, src, dst, 148 150 tos, ttl, df, src_port, dst_port, xnet); 149 151 } ··· 366 364 static void __exit geneve_cleanup_module(void) 367 365 { 368 366 destroy_workqueue(geneve_wq); 367 + unregister_pernet_subsys(&geneve_net_ops); 369 368 } 370 369 module_exit(geneve_cleanup_module); 371 370
+5 -6
net/ipv4/igmp.c
··· 318 318 return scount; 319 319 } 320 320 321 - #define igmp_skb_size(skb) (*(unsigned int *)((skb)->cb)) 322 - 323 - static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) 321 + static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu) 324 322 { 325 323 struct sk_buff *skb; 326 324 struct rtable *rt; ··· 328 330 struct flowi4 fl4; 329 331 int hlen = LL_RESERVED_SPACE(dev); 330 332 int tlen = dev->needed_tailroom; 333 + unsigned int size = mtu; 331 334 332 335 while (1) { 333 336 skb = alloc_skb(size + hlen + tlen, ··· 340 341 return NULL; 341 342 } 342 343 skb->priority = TC_PRIO_CONTROL; 343 - igmp_skb_size(skb) = size; 344 344 345 345 rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, 346 346 0, 0, ··· 352 354 skb_dst_set(skb, &rt->dst); 353 355 skb->dev = dev; 354 356 357 + skb->reserved_tailroom = skb_end_offset(skb) - 358 + min(mtu, skb_end_offset(skb)); 355 359 skb_reserve(skb, hlen); 356 360 357 361 skb_reset_network_header(skb); ··· 423 423 return skb; 424 424 } 425 425 426 - #define AVAILABLE(skb) ((skb) ? ((skb)->dev ? igmp_skb_size(skb) - (skb)->len : \ 427 - skb_tailroom(skb)) : 0) 426 + #define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0) 428 427 429 428 static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, 430 429 int type, int gdeleted, int sdeleted)
+1 -1
net/ipv4/ip_sockglue.c
··· 195 195 for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { 196 196 if (!CMSG_OK(msg, cmsg)) 197 197 return -EINVAL; 198 - #if defined(CONFIG_IPV6) 198 + #if IS_ENABLED(CONFIG_IPV6) 199 199 if (allow_ipv6 && 200 200 cmsg->cmsg_level == SOL_IPV6 && 201 201 cmsg->cmsg_type == IPV6_PKTINFO) {
+1
net/ipv4/ip_vti.c
··· 528 528 .validate = vti_tunnel_validate, 529 529 .newlink = vti_newlink, 530 530 .changelink = vti_changelink, 531 + .dellink = ip_tunnel_dellink, 531 532 .get_size = vti_get_size, 532 533 .fill_info = vti_fill_info, 533 534 };
+1
net/ipv4/netfilter/nft_masq_ipv4.c
··· 24 24 struct nf_nat_range range; 25 25 unsigned int verdict; 26 26 27 + memset(&range, 0, sizeof(range)); 27 28 range.flags = priv->flags; 28 29 29 30 verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum,
+4 -10
net/ipv4/ping.c
··· 217 217 &ipv6_hdr(skb)->daddr)) 218 218 continue; 219 219 #endif 220 + } else { 221 + continue; 220 222 } 221 223 222 224 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) ··· 855 853 if (flags & MSG_OOB) 856 854 goto out; 857 855 858 - if (flags & MSG_ERRQUEUE) { 859 - if (family == AF_INET) { 860 - return ip_recv_error(sk, msg, len, addr_len); 861 - #if IS_ENABLED(CONFIG_IPV6) 862 - } else if (family == AF_INET6) { 863 - return pingv6_ops.ipv6_recv_error(sk, msg, len, 864 - addr_len); 865 - #endif 866 - } 867 - } 856 + if (flags & MSG_ERRQUEUE) 857 + return inet_recv_error(sk, msg, len, addr_len); 868 858 869 859 skb = skb_recv_datagram(sk, flags, noblock, &err); 870 860 if (!skb)
+1 -1
net/ipv4/tcp.c
··· 1598 1598 u32 urg_hole = 0; 1599 1599 1600 1600 if (unlikely(flags & MSG_ERRQUEUE)) 1601 - return ip_recv_error(sk, msg, len, addr_len); 1601 + return inet_recv_error(sk, msg, len, addr_len); 1602 1602 1603 1603 if (sk_can_busy_loop(sk) && skb_queue_empty(&sk->sk_receive_queue) && 1604 1604 (sk->sk_state == TCP_ESTABLISHED))
+33 -31
net/ipv4/tcp_input.c
··· 2315 2315 2316 2316 /* Undo procedures. */ 2317 2317 2318 + /* We can clear retrans_stamp when there are no retransmissions in the 2319 + * window. It would seem that it is trivially available for us in 2320 + * tp->retrans_out, however, that kind of assumptions doesn't consider 2321 + * what will happen if errors occur when sending retransmission for the 2322 + * second time. ...It could the that such segment has only 2323 + * TCPCB_EVER_RETRANS set at the present time. It seems that checking 2324 + * the head skb is enough except for some reneging corner cases that 2325 + * are not worth the effort. 2326 + * 2327 + * Main reason for all this complexity is the fact that connection dying 2328 + * time now depends on the validity of the retrans_stamp, in particular, 2329 + * that successive retransmissions of a segment must not advance 2330 + * retrans_stamp under any conditions. 2331 + */ 2332 + static bool tcp_any_retrans_done(const struct sock *sk) 2333 + { 2334 + const struct tcp_sock *tp = tcp_sk(sk); 2335 + struct sk_buff *skb; 2336 + 2337 + if (tp->retrans_out) 2338 + return true; 2339 + 2340 + skb = tcp_write_queue_head(sk); 2341 + if (unlikely(skb && TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS)) 2342 + return true; 2343 + 2344 + return false; 2345 + } 2346 + 2318 2347 #if FASTRETRANS_DEBUG > 1 2319 2348 static void DBGUNDO(struct sock *sk, const char *msg) 2320 2349 { ··· 2439 2410 * is ACKed. For Reno it is MUST to prevent false 2440 2411 * fast retransmits (RFC2582). SACK TCP is safe. */ 2441 2412 tcp_moderate_cwnd(tp); 2413 + if (!tcp_any_retrans_done(sk)) 2414 + tp->retrans_stamp = 0; 2442 2415 return true; 2443 2416 } 2444 2417 tcp_set_ca_state(sk, TCP_CA_Open); ··· 2458 2427 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPDSACKUNDO); 2459 2428 return true; 2460 2429 } 2461 - return false; 2462 - } 2463 - 2464 - /* We can clear retrans_stamp when there are no retransmissions in the 2465 - * window. It would seem that it is trivially available for us in 2466 - * tp->retrans_out, however, that kind of assumptions doesn't consider 2467 - * what will happen if errors occur when sending retransmission for the 2468 - * second time. ...It could the that such segment has only 2469 - * TCPCB_EVER_RETRANS set at the present time. It seems that checking 2470 - * the head skb is enough except for some reneging corner cases that 2471 - * are not worth the effort. 2472 - * 2473 - * Main reason for all this complexity is the fact that connection dying 2474 - * time now depends on the validity of the retrans_stamp, in particular, 2475 - * that successive retransmissions of a segment must not advance 2476 - * retrans_stamp under any conditions. 2477 - */ 2478 - static bool tcp_any_retrans_done(const struct sock *sk) 2479 - { 2480 - const struct tcp_sock *tp = tcp_sk(sk); 2481 - struct sk_buff *skb; 2482 - 2483 - if (tp->retrans_out) 2484 - return true; 2485 - 2486 - skb = tcp_write_queue_head(sk); 2487 - if (unlikely(skb && TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS)) 2488 - return true; 2489 - 2490 2430 return false; 2491 2431 } 2492 2432 ··· 5231 5229 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) 5232 5230 goto csum_error; 5233 5231 5234 - if (!th->ack && !th->rst) 5232 + if (!th->ack && !th->rst && !th->syn) 5235 5233 goto discard; 5236 5234 5237 5235 /* ··· 5650 5648 goto discard; 5651 5649 } 5652 5650 5653 - if (!th->ack && !th->rst) 5651 + if (!th->ack && !th->rst && !th->syn) 5654 5652 goto discard; 5655 5653 5656 5654 if (!tcp_validate_incoming(sk, skb, th, 0))
+4 -1
net/ipv4/tcp_ipv4.c
··· 598 598 if (th->rst) 599 599 return; 600 600 601 - if (skb_rtable(skb)->rt_type != RTN_LOCAL) 601 + /* If sk not NULL, it means we did a successful lookup and incoming 602 + * route had to be correct. prequeue might have dropped our dst. 603 + */ 604 + if (!sk && skb_rtable(skb)->rt_type != RTN_LOCAL) 602 605 return; 603 606 604 607 /* Swap the send and the receive. */
+5 -4
net/ipv6/ip6_gre.c
··· 502 502 503 503 skb->protocol = gre_proto; 504 504 /* WCCP version 1 and 2 protocol decoding. 505 - * - Change protocol to IP 505 + * - Change protocol to IPv6 506 506 * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header 507 507 */ 508 508 if (flags == 0 && gre_proto == htons(ETH_P_WCCP)) { 509 - skb->protocol = htons(ETH_P_IP); 509 + skb->protocol = htons(ETH_P_IPV6); 510 510 if ((*(h + offset) & 0xF0) != 0x40) 511 511 offset += 4; 512 512 } ··· 961 961 else 962 962 dev->flags &= ~IFF_POINTOPOINT; 963 963 964 - dev->iflink = p->link; 965 - 966 964 /* Precalculate GRE options length */ 967 965 if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { 968 966 if (t->parms.o_flags&GRE_CSUM) ··· 1270 1272 u64_stats_init(&ip6gre_tunnel_stats->syncp); 1271 1273 } 1272 1274 1275 + dev->iflink = tunnel->parms.link; 1273 1276 1274 1277 return 0; 1275 1278 } ··· 1479 1480 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 1480 1481 if (!dev->tstats) 1481 1482 return -ENOMEM; 1483 + 1484 + dev->iflink = tunnel->parms.link; 1482 1485 1483 1486 return 0; 1484 1487 }
+2 -1
net/ipv6/ip6_offload.c
··· 69 69 int nhoff; 70 70 71 71 if (unlikely(skb_shinfo(skb)->gso_type & 72 - ~(SKB_GSO_UDP | 72 + ~(SKB_GSO_TCPV4 | 73 + SKB_GSO_UDP | 73 74 SKB_GSO_DODGY | 74 75 SKB_GSO_TCP_ECN | 75 76 SKB_GSO_GRE |
+1 -9
net/ipv6/ip6_tunnel.c
··· 272 272 int err; 273 273 274 274 t = netdev_priv(dev); 275 - err = ip6_tnl_dev_init(dev); 276 - if (err < 0) 277 - goto out; 278 275 279 276 err = register_netdevice(dev); 280 277 if (err < 0) ··· 1459 1462 1460 1463 1461 1464 static const struct net_device_ops ip6_tnl_netdev_ops = { 1465 + .ndo_init = ip6_tnl_dev_init, 1462 1466 .ndo_uninit = ip6_tnl_dev_uninit, 1463 1467 .ndo_start_xmit = ip6_tnl_xmit, 1464 1468 .ndo_do_ioctl = ip6_tnl_ioctl, ··· 1544 1546 struct ip6_tnl *t = netdev_priv(dev); 1545 1547 struct net *net = dev_net(dev); 1546 1548 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); 1547 - int err = ip6_tnl_dev_init_gen(dev); 1548 - 1549 - if (err) 1550 - return err; 1551 1549 1552 1550 t->parms.proto = IPPROTO_IPV6; 1553 1551 dev_hold(dev); 1554 - 1555 - ip6_tnl_link_config(t); 1556 1552 1557 1553 rcu_assign_pointer(ip6n->tnls_wc[0], t); 1558 1554 return 0;
+1 -3
net/ipv6/ip6_udp_tunnel.c
··· 79 79 uh->source = src_port; 80 80 81 81 uh->len = htons(skb->len); 82 - uh->check = 0; 83 82 84 83 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 85 84 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED 86 85 | IPSKB_REROUTED); 87 86 skb_dst_set(skb, dst); 88 87 89 - udp6_set_csum(udp_get_no_check6_tx(sk), skb, &inet6_sk(sk)->saddr, 90 - &sk->sk_v6_daddr, skb->len); 88 + udp6_set_csum(udp_get_no_check6_tx(sk), skb, saddr, daddr, skb->len); 91 89 92 90 __skb_push(skb, sizeof(*ip6h)); 93 91 skb_reset_network_header(skb);
+12 -10
net/ipv6/ip6_vti.c
··· 172 172 struct vti6_net *ip6n = net_generic(net, vti6_net_id); 173 173 int err; 174 174 175 - err = vti6_dev_init(dev); 176 - if (err < 0) 177 - goto out; 178 - 179 175 err = register_netdevice(dev); 180 176 if (err < 0) 181 177 goto out; ··· 779 783 } 780 784 781 785 static const struct net_device_ops vti6_netdev_ops = { 786 + .ndo_init = vti6_dev_init, 782 787 .ndo_uninit = vti6_dev_uninit, 783 788 .ndo_start_xmit = vti6_tnl_xmit, 784 789 .ndo_do_ioctl = vti6_ioctl, ··· 849 852 struct ip6_tnl *t = netdev_priv(dev); 850 853 struct net *net = dev_net(dev); 851 854 struct vti6_net *ip6n = net_generic(net, vti6_net_id); 852 - int err = vti6_dev_init_gen(dev); 853 - 854 - if (err) 855 - return err; 856 855 857 856 t->parms.proto = IPPROTO_IPV6; 858 857 dev_hold(dev); 859 - 860 - vti6_link_config(t); 861 858 862 859 rcu_assign_pointer(ip6n->tnls_wc[0], t); 863 860 return 0; ··· 903 912 return -EEXIST; 904 913 905 914 return vti6_tnl_create2(dev); 915 + } 916 + 917 + static void vti6_dellink(struct net_device *dev, struct list_head *head) 918 + { 919 + struct net *net = dev_net(dev); 920 + struct vti6_net *ip6n = net_generic(net, vti6_net_id); 921 + 922 + if (dev != ip6n->fb_tnl_dev) 923 + unregister_netdevice_queue(dev, head); 906 924 } 907 925 908 926 static int vti6_changelink(struct net_device *dev, struct nlattr *tb[], ··· 989 989 .setup = vti6_dev_setup, 990 990 .validate = vti6_validate, 991 991 .newlink = vti6_newlink, 992 + .dellink = vti6_dellink, 992 993 .changelink = vti6_changelink, 993 994 .get_size = vti6_get_size, 994 995 .fill_info = vti6_fill_info, ··· 1030 1029 if (!ip6n->fb_tnl_dev) 1031 1030 goto err_alloc_dev; 1032 1031 dev_net_set(ip6n->fb_tnl_dev, net); 1032 + ip6n->fb_tnl_dev->rtnl_link_ops = &vti6_link_ops; 1033 1033 1034 1034 err = vti6_fb_tnl_dev_init(ip6n->fb_tnl_dev); 1035 1035 if (err < 0)
+4
net/ipv6/ip6mr.c
··· 1439 1439 1440 1440 void ip6_mr_cleanup(void) 1441 1441 { 1442 + rtnl_unregister(RTNL_FAMILY_IP6MR, RTM_GETROUTE); 1443 + #ifdef CONFIG_IPV6_PIMSM_V2 1444 + inet6_del_protocol(&pim6_protocol, IPPROTO_PIM); 1445 + #endif 1442 1446 unregister_netdevice_notifier(&ip6_mr_notifier); 1443 1447 unregister_pernet_subsys(&ip6mr_net_ops); 1444 1448 kmem_cache_destroy(mrt_cachep);
+5 -4
net/ipv6/mcast.c
··· 1550 1550 hdr->daddr = *daddr; 1551 1551 } 1552 1552 1553 - static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) 1553 + static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu) 1554 1554 { 1555 1555 struct net_device *dev = idev->dev; 1556 1556 struct net *net = dev_net(dev); ··· 1561 1561 const struct in6_addr *saddr; 1562 1562 int hlen = LL_RESERVED_SPACE(dev); 1563 1563 int tlen = dev->needed_tailroom; 1564 + unsigned int size = mtu + hlen + tlen; 1564 1565 int err; 1565 1566 u8 ra[8] = { IPPROTO_ICMPV6, 0, 1566 1567 IPV6_TLV_ROUTERALERT, 2, 0, 0, 1567 1568 IPV6_TLV_PADN, 0 }; 1568 1569 1569 1570 /* we assume size > sizeof(ra) here */ 1570 - size += hlen + tlen; 1571 1571 /* limit our allocations to order-0 page */ 1572 1572 size = min_t(int, size, SKB_MAX_ORDER(0, 0)); 1573 1573 skb = sock_alloc_send_skb(sk, size, 1, &err); ··· 1576 1576 return NULL; 1577 1577 1578 1578 skb->priority = TC_PRIO_CONTROL; 1579 + skb->reserved_tailroom = skb_end_offset(skb) - 1580 + min(mtu, skb_end_offset(skb)); 1579 1581 skb_reserve(skb, hlen); 1580 1582 1581 1583 if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { ··· 1692 1690 return skb; 1693 1691 } 1694 1692 1695 - #define AVAILABLE(skb) ((skb) ? ((skb)->dev ? (skb)->dev->mtu - (skb)->len : \ 1696 - skb_tailroom(skb)) : 0) 1693 + #define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0) 1697 1694 1698 1695 static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, 1699 1696 int type, int gdeleted, int sdeleted, int crsend)
+1
net/ipv6/netfilter/nft_masq_ipv6.c
··· 25 25 struct nf_nat_range range; 26 26 unsigned int verdict; 27 27 28 + memset(&range, 0, sizeof(range)); 28 29 range.flags = priv->flags; 29 30 30 31 verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out);
+6 -9
net/ipv6/sit.c
··· 195 195 struct sit_net *sitn = net_generic(net, sit_net_id); 196 196 int err; 197 197 198 - err = ipip6_tunnel_init(dev); 199 - if (err < 0) 200 - goto out; 201 - ipip6_tunnel_clone_6rd(dev, sitn); 198 + memcpy(dev->dev_addr, &t->parms.iph.saddr, 4); 199 + memcpy(dev->broadcast, &t->parms.iph.daddr, 4); 202 200 203 201 if ((__force u16)t->parms.i_flags & SIT_ISATAP) 204 202 dev->priv_flags |= IFF_ISATAP; ··· 205 207 if (err < 0) 206 208 goto out; 207 209 208 - strcpy(t->parms.name, dev->name); 210 + ipip6_tunnel_clone_6rd(dev, sitn); 211 + 209 212 dev->rtnl_link_ops = &sit_link_ops; 210 213 211 214 dev_hold(dev); ··· 1329 1330 } 1330 1331 1331 1332 static const struct net_device_ops ipip6_netdev_ops = { 1333 + .ndo_init = ipip6_tunnel_init, 1332 1334 .ndo_uninit = ipip6_tunnel_uninit, 1333 1335 .ndo_start_xmit = sit_tunnel_xmit, 1334 1336 .ndo_do_ioctl = ipip6_tunnel_ioctl, ··· 1378 1378 1379 1379 tunnel->dev = dev; 1380 1380 tunnel->net = dev_net(dev); 1381 - 1382 - memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); 1383 - memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); 1381 + strcpy(tunnel->parms.name, dev->name); 1384 1382 1385 1383 ipip6_tunnel_bind_dev(dev); 1386 1384 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); ··· 1403 1405 1404 1406 tunnel->dev = dev; 1405 1407 tunnel->net = dev_net(dev); 1406 - strcpy(tunnel->parms.name, dev->name); 1407 1408 1408 1409 iph->version = 4; 1409 1410 iph->protocol = IPPROTO_IPV6;
+4 -1
net/ipv6/tcp_ipv6.c
··· 903 903 if (th->rst) 904 904 return; 905 905 906 - if (!ipv6_unicast_destination(skb)) 906 + /* If sk not NULL, it means we did a successful lookup and incoming 907 + * route had to be correct. prequeue might have dropped our dst. 908 + */ 909 + if (!sk && !ipv6_unicast_destination(skb)) 907 910 return; 908 911 909 912 #ifdef CONFIG_TCP_MD5SIG
+5 -1
net/ipx/af_ipx.c
··· 1764 1764 struct ipxhdr *ipx = NULL; 1765 1765 struct sk_buff *skb; 1766 1766 int copied, rc; 1767 + bool locked = true; 1767 1768 1768 1769 lock_sock(sk); 1769 1770 /* put the autobinding in */ ··· 1791 1790 if (sock_flag(sk, SOCK_ZAPPED)) 1792 1791 goto out; 1793 1792 1793 + release_sock(sk); 1794 + locked = false; 1794 1795 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 1795 1796 flags & MSG_DONTWAIT, &rc); 1796 1797 if (!skb) { ··· 1829 1826 out_free: 1830 1827 skb_free_datagram(sk, skb); 1831 1828 out: 1832 - release_sock(sk); 1829 + if (locked) 1830 + release_sock(sk); 1833 1831 return rc; 1834 1832 } 1835 1833
+3
net/mac80211/aes_ccm.c
··· 53 53 __aligned(__alignof__(struct aead_request)); 54 54 struct aead_request *aead_req = (void *) aead_req_data; 55 55 56 + if (data_len == 0) 57 + return -EINVAL; 58 + 56 59 memset(aead_req, 0, sizeof(aead_req_data)); 57 60 58 61 sg_init_one(&pt, data, data_len);
+1 -1
net/mac80211/ibss.c
··· 805 805 806 806 memset(&params, 0, sizeof(params)); 807 807 memset(&csa_ie, 0, sizeof(csa_ie)); 808 - err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, 808 + err = ieee80211_parse_ch_switch_ie(sdata, elems, 809 809 ifibss->chandef.chan->band, 810 810 sta_flags, ifibss->bssid, &csa_ie); 811 811 /* can't switch to destination channel, fail */
+1 -2
net/mac80211/ieee80211_i.h
··· 1642 1642 * ieee80211_parse_ch_switch_ie - parses channel switch IEs 1643 1643 * @sdata: the sdata of the interface which has received the frame 1644 1644 * @elems: parsed 802.11 elements received with the frame 1645 - * @beacon: indicates if the frame was a beacon or probe response 1646 1645 * @current_band: indicates the current band 1647 1646 * @sta_flags: contains information about own capabilities and restrictions 1648 1647 * to decide which channel switch announcements can be accepted. Only the ··· 1655 1656 * Return: 0 on success, <0 on error and >0 if there is nothing to parse. 1656 1657 */ 1657 1658 int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, 1658 - struct ieee802_11_elems *elems, bool beacon, 1659 + struct ieee802_11_elems *elems, 1659 1660 enum ieee80211_band current_band, 1660 1661 u32 sta_flags, u8 *bssid, 1661 1662 struct ieee80211_csa_ie *csa_ie);
+12 -6
net/mac80211/iface.c
··· 766 766 int i, flushed; 767 767 struct ps_data *ps; 768 768 struct cfg80211_chan_def chandef; 769 + bool cancel_scan; 769 770 770 771 clear_bit(SDATA_STATE_RUNNING, &sdata->state); 771 772 772 - if (rcu_access_pointer(local->scan_sdata) == sdata) 773 + cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata; 774 + if (cancel_scan) 773 775 ieee80211_scan_cancel(local); 774 776 775 777 /* ··· 900 898 list_del(&sdata->u.vlan.list); 901 899 mutex_unlock(&local->mtx); 902 900 RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); 901 + /* see comment in the default case below */ 902 + ieee80211_free_keys(sdata, true); 903 903 /* no need to tell driver */ 904 904 break; 905 905 case NL80211_IFTYPE_MONITOR: ··· 927 923 /* 928 924 * When we get here, the interface is marked down. 929 925 * Free the remaining keys, if there are any 930 - * (shouldn't be, except maybe in WDS mode?) 926 + * (which can happen in AP mode if userspace sets 927 + * keys before the interface is operating, and maybe 928 + * also in WDS mode) 931 929 * 932 930 * Force the key freeing to always synchronize_net() 933 931 * to wait for the RX path in case it is using this 934 - * interface enqueuing frames * at this very time on 932 + * interface enqueuing frames at this very time on 935 933 * another CPU. 936 934 */ 937 935 ieee80211_free_keys(sdata, true); 938 - 939 - /* fall through */ 940 - case NL80211_IFTYPE_AP: 941 936 skb_queue_purge(&sdata->skb_queue); 942 937 } 943 938 ··· 993 990 } 994 991 995 992 ieee80211_recalc_ps(local, -1); 993 + 994 + if (cancel_scan) 995 + flush_delayed_work(&local->scan_work); 996 996 997 997 if (local->open_count == 0) { 998 998 ieee80211_stop_device(local);
+1 -1
net/mac80211/mesh.c
··· 874 874 875 875 memset(&params, 0, sizeof(params)); 876 876 memset(&csa_ie, 0, sizeof(csa_ie)); 877 - err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, band, 877 + err = ieee80211_parse_ch_switch_ie(sdata, elems, band, 878 878 sta_flags, sdata->vif.addr, 879 879 &csa_ie); 880 880 if (err < 0)
+3 -2
net/mac80211/mlme.c
··· 1072 1072 1073 1073 current_band = cbss->channel->band; 1074 1074 memset(&csa_ie, 0, sizeof(csa_ie)); 1075 - res = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, current_band, 1075 + res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band, 1076 1076 ifmgd->flags, 1077 1077 ifmgd->associated->bssid, &csa_ie); 1078 1078 if (res < 0) ··· 1168 1168 ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); 1169 1169 else 1170 1170 mod_timer(&ifmgd->chswitch_timer, 1171 - TU_TO_EXP_TIME(csa_ie.count * cbss->beacon_interval)); 1171 + TU_TO_EXP_TIME((csa_ie.count - 1) * 1172 + cbss->beacon_interval)); 1172 1173 } 1173 1174 1174 1175 static bool
+6 -9
net/mac80211/rc80211_minstrel_ht.c
··· 252 252 cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; 253 253 cur_prob = mi->groups[cur_group].rates[cur_idx].probability; 254 254 255 - tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; 256 - tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; 257 - tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; 258 - tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; 259 - 260 - while (j > 0 && (cur_thr > tmp_thr || 261 - (cur_thr == tmp_thr && cur_prob > tmp_prob))) { 262 - j--; 255 + do { 263 256 tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; 264 257 tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; 265 258 tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; 266 259 tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; 267 - } 260 + if (cur_thr < tmp_thr || 261 + (cur_thr == tmp_thr && cur_prob <= tmp_prob)) 262 + break; 263 + j--; 264 + } while (j > 0); 268 265 269 266 if (j < MAX_THR_RATES - 1) { 270 267 memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) *
+7 -7
net/mac80211/rx.c
··· 1678 1678 sc = le16_to_cpu(hdr->seq_ctrl); 1679 1679 frag = sc & IEEE80211_SCTL_FRAG; 1680 1680 1681 - if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || 1682 - is_multicast_ether_addr(hdr->addr1))) { 1683 - /* not fragmented */ 1681 + if (likely(!ieee80211_has_morefrags(fc) && frag == 0)) 1682 + goto out; 1683 + 1684 + if (is_multicast_ether_addr(hdr->addr1)) { 1685 + rx->local->dot11MulticastReceivedFrameCount++; 1684 1686 goto out; 1685 1687 } 1688 + 1686 1689 I802_DEBUG_INC(rx->local->rx_handlers_fragments); 1687 1690 1688 1691 if (skb_linearize(rx->skb)) ··· 1778 1775 out: 1779 1776 if (rx->sta) 1780 1777 rx->sta->rx_packets++; 1781 - if (is_multicast_ether_addr(hdr->addr1)) 1782 - rx->local->dot11MulticastReceivedFrameCount++; 1783 - else 1784 - ieee80211_led_rx(rx->local); 1778 + ieee80211_led_rx(rx->local); 1785 1779 return RX_CONTINUE; 1786 1780 } 1787 1781
+6 -12
net/mac80211/spectmgmt.c
··· 22 22 #include "wme.h" 23 23 24 24 int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, 25 - struct ieee802_11_elems *elems, bool beacon, 25 + struct ieee802_11_elems *elems, 26 26 enum ieee80211_band current_band, 27 27 u32 sta_flags, u8 *bssid, 28 28 struct ieee80211_csa_ie *csa_ie) ··· 91 91 return -EINVAL; 92 92 } 93 93 94 - if (!beacon && sec_chan_offs) { 94 + if (sec_chan_offs) { 95 95 secondary_channel_offset = sec_chan_offs->sec_chan_offs; 96 - } else if (beacon && ht_oper) { 97 - secondary_channel_offset = 98 - ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET; 99 96 } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) { 100 - /* If it's not a beacon, HT is enabled and the IE not present, 101 - * it's 20 MHz, 802.11-2012 8.5.2.6: 102 - * This element [the Secondary Channel Offset Element] is 103 - * present when switching to a 40 MHz channel. It may be 104 - * present when switching to a 20 MHz channel (in which 105 - * case the secondary channel offset is set to SCN). 106 - */ 97 + /* If the secondary channel offset IE is not present, 98 + * we can't know what's the post-CSA offset, so the 99 + * best we can do is use 20MHz. 100 + */ 107 101 secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; 108 102 } 109 103
+6
net/netfilter/ipset/ip_set_core.c
··· 1863 1863 if (*op < IP_SET_OP_VERSION) { 1864 1864 /* Check the version at the beginning of operations */ 1865 1865 struct ip_set_req_version *req_version = data; 1866 + 1867 + if (*len < sizeof(struct ip_set_req_version)) { 1868 + ret = -EINVAL; 1869 + goto done; 1870 + } 1871 + 1866 1872 if (req_version->version != IPSET_PROTOCOL) { 1867 1873 ret = -EPROTO; 1868 1874 goto done;
+2
net/netfilter/ipvs/ip_vs_xmit.c
··· 846 846 new_skb = skb_realloc_headroom(skb, max_headroom); 847 847 if (!new_skb) 848 848 goto error; 849 + if (skb->sk) 850 + skb_set_owner_w(new_skb, skb->sk); 849 851 consume_skb(skb); 850 852 skb = new_skb; 851 853 }
+8 -16
net/netfilter/nf_tables_api.c
··· 3484 3484 } 3485 3485 } 3486 3486 3487 - /* Schedule objects for release via rcu to make sure no packets are accesing 3488 - * removed rules. 3489 - */ 3490 - static void nf_tables_commit_release_rcu(struct rcu_head *rt) 3487 + static void nf_tables_commit_release(struct nft_trans *trans) 3491 3488 { 3492 - struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); 3493 - 3494 3489 switch (trans->msg_type) { 3495 3490 case NFT_MSG_DELTABLE: 3496 3491 nf_tables_table_destroy(&trans->ctx); ··· 3607 3612 } 3608 3613 } 3609 3614 3615 + synchronize_rcu(); 3616 + 3610 3617 list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { 3611 3618 list_del(&trans->list); 3612 - trans->ctx.nla = NULL; 3613 - call_rcu(&trans->rcu_head, nf_tables_commit_release_rcu); 3619 + nf_tables_commit_release(trans); 3614 3620 } 3615 3621 3616 3622 nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); ··· 3619 3623 return 0; 3620 3624 } 3621 3625 3622 - /* Schedule objects for release via rcu to make sure no packets are accesing 3623 - * aborted rules. 3624 - */ 3625 - static void nf_tables_abort_release_rcu(struct rcu_head *rt) 3626 + static void nf_tables_abort_release(struct nft_trans *trans) 3626 3627 { 3627 - struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); 3628 - 3629 3628 switch (trans->msg_type) { 3630 3629 case NFT_MSG_NEWTABLE: 3631 3630 nf_tables_table_destroy(&trans->ctx); ··· 3716 3725 } 3717 3726 } 3718 3727 3728 + synchronize_rcu(); 3729 + 3719 3730 list_for_each_entry_safe_reverse(trans, next, 3720 3731 &net->nft.commit_list, list) { 3721 3732 list_del(&trans->list); 3722 - trans->ctx.nla = NULL; 3723 - call_rcu(&trans->rcu_head, nf_tables_abort_release_rcu); 3733 + nf_tables_abort_release(trans); 3724 3734 } 3725 3735 3726 3736 return 0;
+11 -1
net/netfilter/nfnetlink.c
··· 47 47 [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, 48 48 [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, 49 49 [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, 50 + [NFNLGRP_NFTABLES] = NFNL_SUBSYS_NFTABLES, 51 + [NFNLGRP_ACCT_QUOTA] = NFNL_SUBSYS_ACCT, 50 52 }; 51 53 52 54 void nfnl_lock(__u8 subsys_id) ··· 466 464 static int nfnetlink_bind(int group) 467 465 { 468 466 const struct nfnetlink_subsystem *ss; 469 - int type = nfnl_group2type[group]; 467 + int type; 468 + 469 + if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX) 470 + return -EINVAL; 471 + 472 + type = nfnl_group2type[group]; 470 473 471 474 rcu_read_lock(); 472 475 ss = nfnetlink_get_subsys(type); ··· 520 513 static int __init nfnetlink_init(void) 521 514 { 522 515 int i; 516 + 517 + for (i = NFNLGRP_NONE + 1; i <= NFNLGRP_MAX; i++) 518 + BUG_ON(nfnl_group2type[i] == NFNL_SUBSYS_NONE); 523 519 524 520 for (i=0; i<NFNL_SUBSYS_COUNT; i++) 525 521 mutex_init(&table[i].mutex);
+6 -34
net/netfilter/nft_compat.c
··· 21 21 #include <linux/netfilter_ipv6/ip6_tables.h> 22 22 #include <net/netfilter/nf_tables.h> 23 23 24 - static const struct { 25 - const char *name; 26 - u8 type; 27 - } table_to_chaintype[] = { 28 - { "filter", NFT_CHAIN_T_DEFAULT }, 29 - { "raw", NFT_CHAIN_T_DEFAULT }, 30 - { "security", NFT_CHAIN_T_DEFAULT }, 31 - { "mangle", NFT_CHAIN_T_ROUTE }, 32 - { "nat", NFT_CHAIN_T_NAT }, 33 - { }, 34 - }; 35 - 36 - static int nft_compat_table_to_chaintype(const char *table) 37 - { 38 - int i; 39 - 40 - for (i = 0; table_to_chaintype[i].name != NULL; i++) { 41 - if (strcmp(table_to_chaintype[i].name, table) == 0) 42 - return table_to_chaintype[i].type; 43 - } 44 - 45 - return -1; 46 - } 47 - 48 24 static int nft_compat_chain_validate_dependency(const char *tablename, 49 25 const struct nft_chain *chain) 50 26 { 51 - enum nft_chain_type type; 52 27 const struct nft_base_chain *basechain; 53 28 54 29 if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) 55 30 return 0; 56 31 57 - type = nft_compat_table_to_chaintype(tablename); 58 - if (type < 0) 59 - return -EINVAL; 60 - 61 32 basechain = nft_base_chain(chain); 62 - if (basechain->type->type != type) 33 + if (strcmp(tablename, "nat") == 0 && 34 + basechain->type->type != NFT_CHAIN_T_NAT) 63 35 return -EINVAL; 64 36 65 37 return 0; ··· 89 117 struct xt_target *target, void *info, 90 118 union nft_entry *entry, u8 proto, bool inv) 91 119 { 92 - par->net = &init_net; 120 + par->net = ctx->net; 93 121 par->table = ctx->table->name; 94 122 switch (ctx->afi->family) { 95 123 case AF_INET: ··· 296 324 struct xt_match *match, void *info, 297 325 union nft_entry *entry, u8 proto, bool inv) 298 326 { 299 - par->net = &init_net; 327 + par->net = ctx->net; 300 328 par->table = ctx->table->name; 301 329 switch (ctx->afi->family) { 302 330 case AF_INET: ··· 346 374 union nft_entry e = {}; 347 375 int ret; 348 376 349 - ret = nft_compat_chain_validate_dependency(match->name, ctx->chain); 377 + ret = nft_compat_chain_validate_dependency(match->table, ctx->chain); 350 378 if (ret < 0) 351 379 goto err; 352 380 ··· 420 448 if (!(hook_mask & match->hooks)) 421 449 return -EINVAL; 422 450 423 - ret = nft_compat_chain_validate_dependency(match->name, 451 + ret = nft_compat_chain_validate_dependency(match->table, 424 452 ctx->chain); 425 453 if (ret < 0) 426 454 return ret;
+3 -2
net/netlink/af_netlink.c
··· 1440 1440 return; 1441 1441 1442 1442 for (undo = 0; undo < group; undo++) 1443 - if (test_bit(group, &groups)) 1443 + if (test_bit(undo, &groups)) 1444 1444 nlk->netlink_unbind(undo); 1445 1445 } 1446 1446 ··· 1492 1492 netlink_insert(sk, net, nladdr->nl_pid) : 1493 1493 netlink_autobind(sock); 1494 1494 if (err) { 1495 - netlink_unbind(nlk->ngroups - 1, groups, nlk); 1495 + netlink_unbind(nlk->ngroups, groups, nlk); 1496 1496 return err; 1497 1497 } 1498 1498 } ··· 2509 2509 nl_table[unit].module = module; 2510 2510 if (cfg) { 2511 2511 nl_table[unit].bind = cfg->bind; 2512 + nl_table[unit].unbind = cfg->unbind; 2512 2513 nl_table[unit].flags = cfg->flags; 2513 2514 if (cfg->compare) 2514 2515 nl_table[unit].compare = cfg->compare;
+6 -4
net/openvswitch/actions.c
··· 246 246 { 247 247 int transport_len = skb->len - skb_transport_offset(skb); 248 248 249 - if (l4_proto == IPPROTO_TCP) { 249 + if (l4_proto == NEXTHDR_TCP) { 250 250 if (likely(transport_len >= sizeof(struct tcphdr))) 251 251 inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, 252 252 addr, new_addr, 1); 253 - } else if (l4_proto == IPPROTO_UDP) { 253 + } else if (l4_proto == NEXTHDR_UDP) { 254 254 if (likely(transport_len >= sizeof(struct udphdr))) { 255 255 struct udphdr *uh = udp_hdr(skb); 256 256 ··· 261 261 uh->check = CSUM_MANGLED_0; 262 262 } 263 263 } 264 + } else if (l4_proto == NEXTHDR_ICMP) { 265 + if (likely(transport_len >= sizeof(struct icmp6hdr))) 266 + inet_proto_csum_replace16(&icmp6_hdr(skb)->icmp6_cksum, 267 + skb, addr, new_addr, 1); 264 268 } 265 269 } 266 270 ··· 726 722 727 723 case OVS_ACTION_ATTR_SAMPLE: 728 724 err = sample(dp, skb, key, a); 729 - if (unlikely(err)) /* skb already freed. */ 730 - return err; 731 725 break; 732 726 } 733 727
+7 -7
net/openvswitch/datapath.c
··· 1265 1265 return msgsize; 1266 1266 } 1267 1267 1268 - /* Called with ovs_mutex or RCU read lock. */ 1268 + /* Called with ovs_mutex. */ 1269 1269 static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, 1270 1270 u32 portid, u32 seq, u32 flags, u8 cmd) 1271 1271 { ··· 1555 1555 if (!reply) 1556 1556 return -ENOMEM; 1557 1557 1558 - rcu_read_lock(); 1558 + ovs_lock(); 1559 1559 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); 1560 1560 if (IS_ERR(dp)) { 1561 1561 err = PTR_ERR(dp); ··· 1564 1564 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, 1565 1565 info->snd_seq, 0, OVS_DP_CMD_NEW); 1566 1566 BUG_ON(err < 0); 1567 - rcu_read_unlock(); 1567 + ovs_unlock(); 1568 1568 1569 1569 return genlmsg_reply(reply, info); 1570 1570 1571 1571 err_unlock_free: 1572 - rcu_read_unlock(); 1572 + ovs_unlock(); 1573 1573 kfree_skb(reply); 1574 1574 return err; 1575 1575 } ··· 1581 1581 int skip = cb->args[0]; 1582 1582 int i = 0; 1583 1583 1584 - rcu_read_lock(); 1585 - list_for_each_entry_rcu(dp, &ovs_net->dps, list_node) { 1584 + ovs_lock(); 1585 + list_for_each_entry(dp, &ovs_net->dps, list_node) { 1586 1586 if (i >= skip && 1587 1587 ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, 1588 1588 cb->nlh->nlmsg_seq, NLM_F_MULTI, ··· 1590 1590 break; 1591 1591 i++; 1592 1592 } 1593 - rcu_read_unlock(); 1593 + ovs_unlock(); 1594 1594 1595 1595 cb->args[0] = i; 1596 1596
+8 -1
net/openvswitch/flow_netlink.c
··· 145 145 if (match->key->eth.type == htons(ETH_P_ARP) 146 146 || match->key->eth.type == htons(ETH_P_RARP)) { 147 147 key_expected |= 1 << OVS_KEY_ATTR_ARP; 148 - if (match->mask && (match->mask->key.eth.type == htons(0xffff))) 148 + if (match->mask && (match->mask->key.tp.src == htons(0xff))) 149 149 mask_allowed |= 1 << OVS_KEY_ATTR_ARP; 150 150 } 151 151 ··· 689 689 ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); 690 690 return -EINVAL; 691 691 } 692 + 693 + if (!is_mask && ipv6_key->ipv6_label & htonl(0xFFF00000)) { 694 + OVS_NLERR("IPv6 flow label %x is out of range (max=%x).\n", 695 + ntohl(ipv6_key->ipv6_label), (1 << 20) - 1); 696 + return -EINVAL; 697 + } 698 + 692 699 SW_FLOW_KEY_PUT(match, ipv6.label, 693 700 ipv6_key->ipv6_label, is_mask); 694 701 SW_FLOW_KEY_PUT(match, ip.proto,
+1 -1
net/packet/af_packet.c
··· 378 378 __unregister_prot_hook(sk, sync); 379 379 } 380 380 381 - static inline __pure struct page *pgv_to_page(void *addr) 381 + static inline struct page * __pure pgv_to_page(void *addr) 382 382 { 383 383 if (is_vmalloc_addr(addr)) 384 384 return vmalloc_to_page(addr);
-2
net/sctp/auth.c
··· 862 862 list_add(&cur_key->key_list, sh_keys); 863 863 864 864 cur_key->key = key; 865 - sctp_auth_key_hold(key); 866 - 867 865 return 0; 868 866 nomem: 869 867 if (!replace)
+3
net/sctp/sm_make_chunk.c
··· 2609 2609 addr_param = param.v + sizeof(sctp_addip_param_t); 2610 2610 2611 2611 af = sctp_get_af_specific(param_type2af(param.p->type)); 2612 + if (af == NULL) 2613 + break; 2614 + 2612 2615 af->from_addr_param(&addr, addr_param, 2613 2616 htons(asoc->peer.port), 0); 2614 2617
+30 -5
net/sunrpc/auth_gss/auth_gss.c
··· 1353 1353 char *string = NULL; 1354 1354 struct gss_cred *gss_cred = container_of(cred, struct gss_cred, gc_base); 1355 1355 struct gss_cl_ctx *ctx; 1356 + unsigned int len; 1356 1357 struct xdr_netobj *acceptor; 1357 1358 1358 1359 rcu_read_lock(); ··· 1361 1360 if (!ctx) 1362 1361 goto out; 1363 1362 1364 - acceptor = &ctx->gc_acceptor; 1363 + len = ctx->gc_acceptor.len; 1364 + rcu_read_unlock(); 1365 1365 1366 1366 /* no point if there's no string */ 1367 - if (!acceptor->len) 1368 - goto out; 1369 - 1370 - string = kmalloc(acceptor->len + 1, GFP_KERNEL); 1367 + if (!len) 1368 + return NULL; 1369 + realloc: 1370 + string = kmalloc(len + 1, GFP_KERNEL); 1371 1371 if (!string) 1372 + return NULL; 1373 + 1374 + rcu_read_lock(); 1375 + ctx = rcu_dereference(gss_cred->gc_ctx); 1376 + 1377 + /* did the ctx disappear or was it replaced by one with no acceptor? */ 1378 + if (!ctx || !ctx->gc_acceptor.len) { 1379 + kfree(string); 1380 + string = NULL; 1372 1381 goto out; 1382 + } 1383 + 1384 + acceptor = &ctx->gc_acceptor; 1385 + 1386 + /* 1387 + * Did we find a new acceptor that's longer than the original? Allocate 1388 + * a longer buffer and try again. 1389 + */ 1390 + if (len < acceptor->len) { 1391 + len = acceptor->len; 1392 + rcu_read_unlock(); 1393 + kfree(string); 1394 + goto realloc; 1395 + } 1373 1396 1374 1397 memcpy(string, acceptor->data, acceptor->len); 1375 1398 string[acceptor->len] = '\0';
+16 -11
net/sunrpc/svcsock.c
··· 1019 1019 xid = *p++; 1020 1020 calldir = *p; 1021 1021 1022 - if (bc_xprt) 1023 - req = xprt_lookup_rqst(bc_xprt, xid); 1024 - 1025 - if (!req) { 1026 - printk(KERN_NOTICE 1027 - "%s: Got unrecognized reply: " 1028 - "calldir 0x%x xpt_bc_xprt %p xid %08x\n", 1029 - __func__, ntohl(calldir), 1030 - bc_xprt, ntohl(xid)); 1022 + if (!bc_xprt) 1031 1023 return -EAGAIN; 1032 - } 1024 + spin_lock_bh(&bc_xprt->transport_lock); 1025 + req = xprt_lookup_rqst(bc_xprt, xid); 1026 + if (!req) 1027 + goto unlock_notfound; 1033 1028 1034 1029 memcpy(&req->rq_private_buf, &req->rq_rcv_buf, sizeof(struct xdr_buf)); 1035 1030 /* ··· 1035 1040 dst = &req->rq_private_buf.head[0]; 1036 1041 src = &rqstp->rq_arg.head[0]; 1037 1042 if (dst->iov_len < src->iov_len) 1038 - return -EAGAIN; /* whatever; just giving up. */ 1043 + goto unlock_eagain; /* whatever; just giving up. */ 1039 1044 memcpy(dst->iov_base, src->iov_base, src->iov_len); 1040 1045 xprt_complete_rqst(req->rq_task, rqstp->rq_arg.len); 1041 1046 rqstp->rq_arg.len = 0; 1047 + spin_unlock_bh(&bc_xprt->transport_lock); 1042 1048 return 0; 1049 + unlock_notfound: 1050 + printk(KERN_NOTICE 1051 + "%s: Got unrecognized reply: " 1052 + "calldir 0x%x xpt_bc_xprt %p xid %08x\n", 1053 + __func__, ntohl(calldir), 1054 + bc_xprt, ntohl(xid)); 1055 + unlock_eagain: 1056 + spin_unlock_bh(&bc_xprt->transport_lock); 1057 + return -EAGAIN; 1043 1058 } 1044 1059 1045 1060 static int copy_pages_to_kvecs(struct kvec *vec, struct page **pages, int len)
+4 -3
security/selinux/hooks.c
··· 4725 4725 err = selinux_nlmsg_lookup(sksec->sclass, nlh->nlmsg_type, &perm); 4726 4726 if (err) { 4727 4727 if (err == -EINVAL) { 4728 - WARN_ONCE(1, "selinux_nlmsg_perm: unrecognized netlink message:" 4729 - " protocol=%hu nlmsg_type=%hu sclass=%hu\n", 4730 - sk->sk_protocol, nlh->nlmsg_type, sksec->sclass); 4728 + printk(KERN_WARNING 4729 + "SELinux: unrecognized netlink message:" 4730 + " protocol=%hu nlmsg_type=%hu sclass=%hu\n", 4731 + sk->sk_protocol, nlh->nlmsg_type, sksec->sclass); 4731 4732 if (!selinux_enforcing || security_get_allow_unknown()) 4732 4733 err = 0; 4733 4734 }
+2
sound/core/pcm.c
··· 216 216 FORMAT(DSD_U8), 217 217 FORMAT(DSD_U16_LE), 218 218 FORMAT(DSD_U32_LE), 219 + FORMAT(DSD_U16_BE), 220 + FORMAT(DSD_U32_BE), 219 221 }; 220 222 221 223 const char *snd_pcm_format_name(snd_pcm_format_t format)
+8
sound/core/pcm_misc.c
··· 152 152 .width = 32, .phys = 32, .le = 1, .signd = 0, 153 153 .silence = { 0x69, 0x69, 0x69, 0x69 }, 154 154 }, 155 + [SNDRV_PCM_FORMAT_DSD_U16_BE] = { 156 + .width = 16, .phys = 16, .le = 0, .signd = 0, 157 + .silence = { 0x69, 0x69 }, 158 + }, 159 + [SNDRV_PCM_FORMAT_DSD_U32_BE] = { 160 + .width = 32, .phys = 32, .le = 0, .signd = 0, 161 + .silence = { 0x69, 0x69, 0x69, 0x69 }, 162 + }, 155 163 /* FIXME: the following three formats are not defined properly yet */ 156 164 [SNDRV_PCM_FORMAT_MPEG] = { 157 165 .le = -1, .signd = -1,
+23 -5
sound/pci/hda/hda_intel.c
··· 219 219 "{Intel, LPT_LP}," 220 220 "{Intel, WPT_LP}," 221 221 "{Intel, SPT}," 222 + "{Intel, SPT_LP}," 222 223 "{Intel, HPT}," 223 224 "{Intel, PBG}," 224 225 "{Intel, SCH}," ··· 298 297 299 298 /* quirks for ATI/AMD HDMI */ 300 299 #define AZX_DCAPS_PRESET_ATI_HDMI \ 301 - (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB) 300 + (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\ 301 + AZX_DCAPS_NO_MSI64) 302 302 303 303 /* quirks for Nvidia */ 304 304 #define AZX_DCAPS_PRESET_NVIDIA \ ··· 1487 1485 struct snd_card *card = chip->card; 1488 1486 int err; 1489 1487 unsigned short gcap; 1488 + unsigned int dma_bits = 64; 1490 1489 1491 1490 #if BITS_PER_LONG != 64 1492 1491 /* Fix up base address on ULI M5461 */ ··· 1511 1508 return -ENXIO; 1512 1509 } 1513 1510 1514 - if (chip->msi) 1511 + if (chip->msi) { 1512 + if (chip->driver_caps & AZX_DCAPS_NO_MSI64) { 1513 + dev_dbg(card->dev, "Disabling 64bit MSI\n"); 1514 + pci->no_64bit_msi = true; 1515 + } 1515 1516 if (pci_enable_msi(pci) < 0) 1516 1517 chip->msi = 0; 1518 + } 1517 1519 1518 1520 if (azx_acquire_irq(chip, 0) < 0) 1519 1521 return -EBUSY; ··· 1529 1521 gcap = azx_readw(chip, GCAP); 1530 1522 dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); 1531 1523 1524 + /* AMD devices support 40 or 48bit DMA, take the safe one */ 1525 + if (chip->pci->vendor == PCI_VENDOR_ID_AMD) 1526 + dma_bits = 40; 1527 + 1532 1528 /* disable SB600 64bit support for safety */ 1533 1529 if (chip->pci->vendor == PCI_VENDOR_ID_ATI) { 1534 1530 struct pci_dev *p_smbus; 1531 + dma_bits = 40; 1535 1532 p_smbus = pci_get_device(PCI_VENDOR_ID_ATI, 1536 1533 PCI_DEVICE_ID_ATI_SBX00_SMBUS, 1537 1534 NULL); ··· 1566 1553 } 1567 1554 1568 1555 /* allow 64bit DMA address if supported by H/W */ 1569 - if ((gcap & AZX_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) 1570 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); 1571 - else { 1556 + if (!(gcap & AZX_GCAP_64OK)) 1557 + dma_bits = 32; 1558 + if (!pci_set_dma_mask(pci, DMA_BIT_MASK(dma_bits))) { 1559 + pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(dma_bits)); 1560 + } else { 1572 1561 pci_set_dma_mask(pci, DMA_BIT_MASK(32)); 1573 1562 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); 1574 1563 } ··· 2018 2003 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2019 2004 /* Sunrise Point */ 2020 2005 { PCI_DEVICE(0x8086, 0xa170), 2006 + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2007 + /* Sunrise Point-LP */ 2008 + { PCI_DEVICE(0x8086, 0x9d70), 2021 2009 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2022 2010 /* Haswell */ 2023 2011 { PCI_DEVICE(0x8086, 0x0a0c),
+1
sound/pci/hda/hda_priv.h
··· 171 171 #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ 172 172 #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ 173 173 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ 174 + #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ 174 175 175 176 /* HD Audio class code */ 176 177 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403
+31
sound/pci/hda/patch_conexant.c
··· 43 43 unsigned int num_eapds; 44 44 hda_nid_t eapds[4]; 45 45 bool dynamic_eapd; 46 + hda_nid_t mute_led_eapd; 46 47 47 48 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ 48 49 ··· 164 163 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); 165 164 } 166 165 166 + /* turn on/off EAPD according to Master switch (inversely!) for mute LED */ 167 + static void cx_auto_vmaster_hook_mute_led(void *private_data, int enabled) 168 + { 169 + struct hda_codec *codec = private_data; 170 + struct conexant_spec *spec = codec->spec; 171 + 172 + snd_hda_codec_write(codec, spec->mute_led_eapd, 0, 173 + AC_VERB_SET_EAPD_BTLENABLE, 174 + enabled ? 0x00 : 0x02); 175 + } 176 + 167 177 static int cx_auto_build_controls(struct hda_codec *codec) 168 178 { 169 179 int err; ··· 235 223 CXT_FIXUP_TOSHIBA_P105, 236 224 CXT_FIXUP_HP_530, 237 225 CXT_FIXUP_CAP_MIX_AMP_5047, 226 + CXT_FIXUP_MUTE_LED_EAPD, 238 227 }; 239 228 240 229 /* for hda_fixup_thinkpad_acpi() */ ··· 570 557 } 571 558 } 572 559 560 + static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, 561 + const struct hda_fixup *fix, int action) 562 + { 563 + struct conexant_spec *spec = codec->spec; 564 + 565 + if (action == HDA_FIXUP_ACT_PRE_PROBE) { 566 + spec->mute_led_eapd = 0x1b; 567 + spec->dynamic_eapd = 1; 568 + spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook_mute_led; 569 + } 570 + } 571 + 573 572 /* 574 573 * Fix max input level on mixer widget to 0dB 575 574 * (originally it has 0x2b steps with 0dB offset 0x14) ··· 730 705 .type = HDA_FIXUP_FUNC, 731 706 .v.func = cxt_fixup_cap_mix_amp_5047, 732 707 }, 708 + [CXT_FIXUP_MUTE_LED_EAPD] = { 709 + .type = HDA_FIXUP_FUNC, 710 + .v.func = cxt_fixup_mute_led_eapd, 711 + }, 733 712 }; 734 713 735 714 static const struct snd_pci_quirk cxt5045_fixups[] = { ··· 791 762 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), 792 763 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), 793 764 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), 765 + SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD), 794 766 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 795 767 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), 796 768 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), ··· 810 780 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, 811 781 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, 812 782 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, 783 + { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" }, 813 784 {} 814 785 }; 815 786
+79 -35
sound/pci/hda/patch_realtek.c
··· 288 288 snd_hda_jack_unsol_event(codec, res >> 2); 289 289 } 290 290 291 + /* Change EAPD to verb control */ 292 + static void alc_fill_eapd_coef(struct hda_codec *codec) 293 + { 294 + int coef; 295 + 296 + coef = alc_get_coef0(codec); 297 + 298 + switch (codec->vendor_id) { 299 + case 0x10ec0262: 300 + alc_update_coef_idx(codec, 0x7, 0, 1<<5); 301 + break; 302 + case 0x10ec0267: 303 + case 0x10ec0268: 304 + alc_update_coef_idx(codec, 0x7, 0, 1<<13); 305 + break; 306 + case 0x10ec0269: 307 + if ((coef & 0x00f0) == 0x0010) 308 + alc_update_coef_idx(codec, 0xd, 0, 1<<14); 309 + if ((coef & 0x00f0) == 0x0020) 310 + alc_update_coef_idx(codec, 0x4, 1<<15, 0); 311 + if ((coef & 0x00f0) == 0x0030) 312 + alc_update_coef_idx(codec, 0x10, 1<<9, 0); 313 + break; 314 + case 0x10ec0280: 315 + case 0x10ec0284: 316 + case 0x10ec0290: 317 + case 0x10ec0292: 318 + alc_update_coef_idx(codec, 0x4, 1<<15, 0); 319 + break; 320 + case 0x10ec0233: 321 + case 0x10ec0255: 322 + case 0x10ec0282: 323 + case 0x10ec0283: 324 + case 0x10ec0286: 325 + case 0x10ec0288: 326 + alc_update_coef_idx(codec, 0x10, 1<<9, 0); 327 + break; 328 + case 0x10ec0285: 329 + case 0x10ec0293: 330 + alc_update_coef_idx(codec, 0xa, 1<<13, 0); 331 + break; 332 + case 0x10ec0662: 333 + if ((coef & 0x00f0) == 0x0030) 334 + alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ 335 + break; 336 + case 0x10ec0272: 337 + case 0x10ec0273: 338 + case 0x10ec0663: 339 + case 0x10ec0665: 340 + case 0x10ec0670: 341 + case 0x10ec0671: 342 + case 0x10ec0672: 343 + alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ 344 + break; 345 + case 0x10ec0668: 346 + alc_update_coef_idx(codec, 0x7, 3<<13, 0); 347 + break; 348 + case 0x10ec0867: 349 + alc_update_coef_idx(codec, 0x4, 1<<10, 0); 350 + break; 351 + case 0x10ec0888: 352 + if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030) 353 + alc_update_coef_idx(codec, 0x7, 1<<5, 0); 354 + break; 355 + case 0x10ec0892: 356 + alc_update_coef_idx(codec, 0x7, 1<<5, 0); 357 + break; 358 + case 0x10ec0899: 359 + case 0x10ec0900: 360 + alc_update_coef_idx(codec, 0x7, 1<<1, 0); 361 + break; 362 + } 363 + } 364 + 291 365 /* additional initialization for ALC888 variants */ 292 366 static void alc888_coef_init(struct hda_codec *codec) 293 367 { ··· 413 339 /* generic EAPD initialization */ 414 340 static void alc_auto_init_amp(struct hda_codec *codec, int type) 415 341 { 342 + alc_fill_eapd_coef(codec); 416 343 alc_auto_setup_eapd(codec, true); 417 344 switch (type) { 418 345 case ALC_INIT_GPIO1: ··· 4520 4445 [ALC269_FIXUP_HEADSET_MODE] = { 4521 4446 .type = HDA_FIXUP_FUNC, 4522 4447 .v.func = alc_fixup_headset_mode, 4448 + .chained = true, 4449 + .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED 4523 4450 }, 4524 4451 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { 4525 4452 .type = HDA_FIXUP_FUNC, ··· 4711 4634 [ALC255_FIXUP_HEADSET_MODE] = { 4712 4635 .type = HDA_FIXUP_FUNC, 4713 4636 .v.func = alc_fixup_headset_mode_alc255, 4637 + .chained = true, 4638 + .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED 4714 4639 }, 4715 4640 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { 4716 4641 .type = HDA_FIXUP_FUNC, ··· 4748 4669 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { 4749 4670 .type = HDA_FIXUP_FUNC, 4750 4671 .v.func = alc_fixup_dell_wmi, 4751 - .chained_before = true, 4752 - .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE 4753 4672 }, 4754 4673 [ALC282_FIXUP_ASPIRE_V5_PINS] = { 4755 4674 .type = HDA_FIXUP_PINS, ··· 4785 4708 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4786 4709 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4787 4710 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4788 - SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), 4789 4711 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), 4790 4712 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), 4791 - SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), 4792 4713 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), 4793 4714 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 4794 4715 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), ··· 4818 4743 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4819 4744 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4820 4745 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4821 - SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4822 4746 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4823 4747 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 4824 4748 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), ··· 5285 5211 alc_write_coef_idx(codec, 0x17, val | (1<<7)); 5286 5212 } 5287 5213 } 5288 - 5289 - /* Class D */ 5290 - alc_update_coef_idx(codec, 0xd, 0, 1<<14); 5291 5214 5292 5215 /* HP */ 5293 5216 alc_update_coef_idx(codec, 0x4, 0, 1<<11); ··· 6195 6124 {} 6196 6125 }; 6197 6126 6198 - static void alc662_fill_coef(struct hda_codec *codec) 6199 - { 6200 - int coef; 6201 - 6202 - coef = alc_get_coef0(codec); 6203 - 6204 - switch (codec->vendor_id) { 6205 - case 0x10ec0662: 6206 - if ((coef & 0x00f0) == 0x0030) 6207 - alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ 6208 - break; 6209 - case 0x10ec0272: 6210 - case 0x10ec0273: 6211 - case 0x10ec0663: 6212 - case 0x10ec0665: 6213 - case 0x10ec0670: 6214 - case 0x10ec0671: 6215 - case 0x10ec0672: 6216 - alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ 6217 - break; 6218 - } 6219 - } 6220 - 6221 6127 /* 6222 6128 */ 6223 6129 static int patch_alc662(struct hda_codec *codec) ··· 6216 6168 switch (codec->vendor_id) { 6217 6169 case 0x10ec0668: 6218 6170 spec->init_hook = alc668_restore_default_value; 6219 - break; 6220 - default: 6221 - spec->init_hook = alc662_fill_coef; 6222 - alc662_fill_coef(codec); 6223 6171 break; 6224 6172 } 6225 6173
+1
sound/soc/codecs/cs42l51-i2c.c
··· 46 46 .driver = { 47 47 .name = "cs42l51", 48 48 .owner = THIS_MODULE, 49 + .of_match_table = cs42l51_of_match, 49 50 }, 50 51 .probe = cs42l51_i2c_probe, 51 52 .remove = cs42l51_i2c_remove,
+3 -1
sound/soc/codecs/cs42l51.c
··· 558 558 } 559 559 EXPORT_SYMBOL_GPL(cs42l51_probe); 560 560 561 - static const struct of_device_id cs42l51_of_match[] = { 561 + const struct of_device_id cs42l51_of_match[] = { 562 562 { .compatible = "cirrus,cs42l51", }, 563 563 { } 564 564 }; 565 565 MODULE_DEVICE_TABLE(of, cs42l51_of_match); 566 + EXPORT_SYMBOL_GPL(cs42l51_of_match); 567 + 566 568 MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); 567 569 MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver"); 568 570 MODULE_LICENSE("GPL");
+1
sound/soc/codecs/cs42l51.h
··· 22 22 23 23 extern const struct regmap_config cs42l51_regmap; 24 24 int cs42l51_probe(struct device *dev, struct regmap *regmap); 25 + extern const struct of_device_id cs42l51_of_match[]; 25 26 26 27 #define CS42L51_CHIP_ID 0x1B 27 28 #define CS42L51_CHIP_REV_A 0x00
+1 -1
sound/soc/codecs/es8328-i2c.c
··· 19 19 #include "es8328.h" 20 20 21 21 static const struct i2c_device_id es8328_id[] = { 22 - { "everest,es8328", 0 }, 22 + { "es8328", 0 }, 23 23 { } 24 24 }; 25 25 MODULE_DEVICE_TABLE(i2c, es8328_id);
+3 -3
sound/soc/codecs/max98090.c
··· 1941 1941 * 0x02 (when master clk is 20MHz to 40MHz).. 1942 1942 * 0x03 (when master clk is 40MHz to 60MHz).. 1943 1943 */ 1944 - if ((freq >= 10000000) && (freq < 20000000)) { 1944 + if ((freq >= 10000000) && (freq <= 20000000)) { 1945 1945 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, 1946 1946 M98090_PSCLK_DIV1); 1947 - } else if ((freq >= 20000000) && (freq < 40000000)) { 1947 + } else if ((freq > 20000000) && (freq <= 40000000)) { 1948 1948 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, 1949 1949 M98090_PSCLK_DIV2); 1950 - } else if ((freq >= 40000000) && (freq < 60000000)) { 1950 + } else if ((freq > 40000000) && (freq <= 60000000)) { 1951 1951 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, 1952 1952 M98090_PSCLK_DIV4); 1953 1953 } else {
+2
sound/soc/codecs/rt5645.c
··· 139 139 { 0x76, 0x000a }, 140 140 { 0x77, 0x0c00 }, 141 141 { 0x78, 0x0000 }, 142 + { 0x79, 0x0123 }, 142 143 { 0x80, 0x0000 }, 143 144 { 0x81, 0x0000 }, 144 145 { 0x82, 0x0000 }, ··· 335 334 case RT5645_DMIC_CTRL2: 336 335 case RT5645_TDM_CTRL_1: 337 336 case RT5645_TDM_CTRL_2: 337 + case RT5645_TDM_CTRL_3: 338 338 case RT5645_GLB_CLK: 339 339 case RT5645_PLL_CTRL1: 340 340 case RT5645_PLL_CTRL2:
+18 -18
sound/soc/codecs/rt5670.c
··· 100 100 { 0x4c, 0x5380 }, 101 101 { 0x4f, 0x0073 }, 102 102 { 0x52, 0x00d3 }, 103 - { 0x53, 0xf0f0 }, 103 + { 0x53, 0xf000 }, 104 104 { 0x61, 0x0000 }, 105 105 { 0x62, 0x0001 }, 106 106 { 0x63, 0x00c3 }, 107 107 { 0x64, 0x0000 }, 108 - { 0x65, 0x0000 }, 108 + { 0x65, 0x0001 }, 109 109 { 0x66, 0x0000 }, 110 110 { 0x6f, 0x8000 }, 111 111 { 0x70, 0x8000 }, 112 112 { 0x71, 0x8000 }, 113 113 { 0x72, 0x8000 }, 114 - { 0x73, 0x1110 }, 114 + { 0x73, 0x7770 }, 115 115 { 0x74, 0x0e00 }, 116 116 { 0x75, 0x1505 }, 117 117 { 0x76, 0x0015 }, ··· 125 125 { 0x83, 0x0000 }, 126 126 { 0x84, 0x0000 }, 127 127 { 0x85, 0x0000 }, 128 - { 0x86, 0x0008 }, 128 + { 0x86, 0x0004 }, 129 129 { 0x87, 0x0000 }, 130 130 { 0x88, 0x0000 }, 131 131 { 0x89, 0x0000 }, 132 132 { 0x8a, 0x0000 }, 133 133 { 0x8b, 0x0000 }, 134 - { 0x8c, 0x0007 }, 134 + { 0x8c, 0x0003 }, 135 135 { 0x8d, 0x0000 }, 136 136 { 0x8e, 0x0004 }, 137 137 { 0x8f, 0x1100 }, 138 138 { 0x90, 0x0646 }, 139 139 { 0x91, 0x0c06 }, 140 140 { 0x93, 0x0000 }, 141 - { 0x94, 0x0000 }, 142 - { 0x95, 0x0000 }, 141 + { 0x94, 0x1270 }, 142 + { 0x95, 0x1000 }, 143 143 { 0x97, 0x0000 }, 144 144 { 0x98, 0x0000 }, 145 145 { 0x99, 0x0000 }, ··· 150 150 { 0x9e, 0x0400 }, 151 151 { 0xae, 0x7000 }, 152 152 { 0xaf, 0x0000 }, 153 - { 0xb0, 0x6000 }, 153 + { 0xb0, 0x7000 }, 154 154 { 0xb1, 0x0000 }, 155 155 { 0xb2, 0x0000 }, 156 156 { 0xb3, 0x001f }, 157 - { 0xb4, 0x2206 }, 157 + { 0xb4, 0x220c }, 158 158 { 0xb5, 0x1f00 }, 159 159 { 0xb6, 0x0000 }, 160 160 { 0xb7, 0x0000 }, ··· 171 171 { 0xcf, 0x1813 }, 172 172 { 0xd0, 0x0690 }, 173 173 { 0xd1, 0x1c17 }, 174 - { 0xd3, 0xb320 }, 174 + { 0xd3, 0xa220 }, 175 175 { 0xd4, 0x0000 }, 176 176 { 0xd6, 0x0400 }, 177 177 { 0xd9, 0x0809 }, 178 178 { 0xda, 0x0000 }, 179 179 { 0xdb, 0x0001 }, 180 180 { 0xdc, 0x0049 }, 181 - { 0xdd, 0x0009 }, 181 + { 0xdd, 0x0024 }, 182 182 { 0xe6, 0x8000 }, 183 183 { 0xe7, 0x0000 }, 184 - { 0xec, 0xb300 }, 184 + { 0xec, 0xa200 }, 185 185 { 0xed, 0x0000 }, 186 - { 0xee, 0xb300 }, 186 + { 0xee, 0xa200 }, 187 187 { 0xef, 0x0000 }, 188 188 { 0xf8, 0x0000 }, 189 189 { 0xf9, 0x0000 }, 190 190 { 0xfa, 0x8010 }, 191 191 { 0xfb, 0x0033 }, 192 - { 0xfc, 0x0080 }, 192 + { 0xfc, 0x0100 }, 193 193 }; 194 194 195 195 static bool rt5670_volatile_register(struct device *dev, unsigned int reg) ··· 1877 1877 { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" }, 1878 1878 { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" }, 1879 1879 1880 + { "DAC Stereo1 Filter", NULL, "PLL1", is_sys_clk_from_pll }, 1881 + { "DAC Mono Left Filter", NULL, "PLL1", is_sys_clk_from_pll }, 1882 + { "DAC Mono Right Filter", NULL, "PLL1", is_sys_clk_from_pll }, 1883 + 1880 1884 { "DAC MIX", NULL, "DAC1 MIXL" }, 1881 1885 { "DAC MIX", NULL, "DAC1 MIXR" }, 1882 1886 ··· 1930 1926 1931 1927 { "DAC L1", NULL, "DAC L1 Power" }, 1932 1928 { "DAC L1", NULL, "Stereo DAC MIXL" }, 1933 - { "DAC L1", NULL, "PLL1", is_sys_clk_from_pll }, 1934 1929 { "DAC R1", NULL, "DAC R1 Power" }, 1935 1930 { "DAC R1", NULL, "Stereo DAC MIXR" }, 1936 - { "DAC R1", NULL, "PLL1", is_sys_clk_from_pll }, 1937 1931 { "DAC L2", NULL, "Mono DAC MIXL" }, 1938 - { "DAC L2", NULL, "PLL1", is_sys_clk_from_pll }, 1939 1932 { "DAC R2", NULL, "Mono DAC MIXR" }, 1940 - { "DAC R2", NULL, "PLL1", is_sys_clk_from_pll }, 1941 1933 1942 1934 { "OUT MIXL", "BST1 Switch", "BST1" }, 1943 1935 { "OUT MIXL", "INL Switch", "INL VOL" },
+1 -2
sound/soc/codecs/sgtl5000.c
··· 1299 1299 1300 1300 /* enable small pop, introduce 400ms delay in turning off */ 1301 1301 snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, 1302 - SGTL5000_SMALL_POP, 1303 - SGTL5000_SMALL_POP); 1302 + SGTL5000_SMALL_POP, 1); 1304 1303 1305 1304 /* disable short cut detector */ 1306 1305 snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0);
+1 -1
sound/soc/codecs/sgtl5000.h
··· 275 275 #define SGTL5000_BIAS_CTRL_MASK 0x000e 276 276 #define SGTL5000_BIAS_CTRL_SHIFT 1 277 277 #define SGTL5000_BIAS_CTRL_WIDTH 3 278 - #define SGTL5000_SMALL_POP 0x0001 278 + #define SGTL5000_SMALL_POP 0 279 279 280 280 /* 281 281 * SGTL5000_CHIP_MIC_CTRL
+1
sound/soc/codecs/wm_adsp.c
··· 1355 1355 file, blocks, pos - firmware->size); 1356 1356 1357 1357 out_fw: 1358 + regmap_async_complete(regmap); 1358 1359 release_firmware(firmware); 1359 1360 wm_adsp_buf_free(&buf_list); 1360 1361 out:
+26
sound/soc/fsl/fsl_asrc.c
··· 684 684 } 685 685 } 686 686 687 + static struct reg_default fsl_asrc_reg[] = { 688 + { REG_ASRCTR, 0x0000 }, { REG_ASRIER, 0x0000 }, 689 + { REG_ASRCNCR, 0x0000 }, { REG_ASRCFG, 0x0000 }, 690 + { REG_ASRCSR, 0x0000 }, { REG_ASRCDR1, 0x0000 }, 691 + { REG_ASRCDR2, 0x0000 }, { REG_ASRSTR, 0x0000 }, 692 + { REG_ASRRA, 0x0000 }, { REG_ASRRB, 0x0000 }, 693 + { REG_ASRRC, 0x0000 }, { REG_ASRPM1, 0x0000 }, 694 + { REG_ASRPM2, 0x0000 }, { REG_ASRPM3, 0x0000 }, 695 + { REG_ASRPM4, 0x0000 }, { REG_ASRPM5, 0x0000 }, 696 + { REG_ASRTFR1, 0x0000 }, { REG_ASRCCR, 0x0000 }, 697 + { REG_ASRDIA, 0x0000 }, { REG_ASRDOA, 0x0000 }, 698 + { REG_ASRDIB, 0x0000 }, { REG_ASRDOB, 0x0000 }, 699 + { REG_ASRDIC, 0x0000 }, { REG_ASRDOC, 0x0000 }, 700 + { REG_ASRIDRHA, 0x0000 }, { REG_ASRIDRLA, 0x0000 }, 701 + { REG_ASRIDRHB, 0x0000 }, { REG_ASRIDRLB, 0x0000 }, 702 + { REG_ASRIDRHC, 0x0000 }, { REG_ASRIDRLC, 0x0000 }, 703 + { REG_ASR76K, 0x0A47 }, { REG_ASR56K, 0x0DF3 }, 704 + { REG_ASRMCRA, 0x0000 }, { REG_ASRFSTA, 0x0000 }, 705 + { REG_ASRMCRB, 0x0000 }, { REG_ASRFSTB, 0x0000 }, 706 + { REG_ASRMCRC, 0x0000 }, { REG_ASRFSTC, 0x0000 }, 707 + { REG_ASRMCR1A, 0x0000 }, { REG_ASRMCR1B, 0x0000 }, 708 + { REG_ASRMCR1C, 0x0000 }, 709 + }; 710 + 687 711 static const struct regmap_config fsl_asrc_regmap_config = { 688 712 .reg_bits = 32, 689 713 .reg_stride = 4, 690 714 .val_bits = 32, 691 715 692 716 .max_register = REG_ASRMCR1C, 717 + .reg_defaults = fsl_asrc_reg, 718 + .num_reg_defaults = ARRAY_SIZE(fsl_asrc_reg), 693 719 .readable_reg = fsl_asrc_readable_reg, 694 720 .volatile_reg = fsl_asrc_volatile_reg, 695 721 .writeable_reg = fsl_asrc_writeable_reg,
+3 -1
sound/soc/rockchip/rockchip_i2s.c
··· 154 154 while (val) { 155 155 regmap_read(i2s->regmap, I2S_CLR, &val); 156 156 retry--; 157 - if (!retry) 157 + if (!retry) { 158 158 dev_warn(i2s->dev, "fail to clear\n"); 159 + break; 160 + } 159 161 } 160 162 } 161 163 }
+1
sound/soc/samsung/snow.c
··· 110 110 { .compatible = "google,snow-audio-max98095", }, 111 111 {}, 112 112 }; 113 + MODULE_DEVICE_TABLE(of, snow_of_match); 113 114 114 115 static struct platform_driver snow_driver = { 115 116 .driver = {
+1 -2
sound/soc/sh/fsi.c
··· 1711 1711 static struct snd_pcm_hardware fsi_pcm_hardware = { 1712 1712 .info = SNDRV_PCM_INFO_INTERLEAVED | 1713 1713 SNDRV_PCM_INFO_MMAP | 1714 - SNDRV_PCM_INFO_MMAP_VALID | 1715 - SNDRV_PCM_INFO_PAUSE, 1714 + SNDRV_PCM_INFO_MMAP_VALID, 1716 1715 .buffer_bytes_max = 64 * 1024, 1717 1716 .period_bytes_min = 32, 1718 1717 .period_bytes_max = 8192,
+1 -2
sound/soc/sh/rcar/core.c
··· 886 886 static struct snd_pcm_hardware rsnd_pcm_hardware = { 887 887 .info = SNDRV_PCM_INFO_INTERLEAVED | 888 888 SNDRV_PCM_INFO_MMAP | 889 - SNDRV_PCM_INFO_MMAP_VALID | 890 - SNDRV_PCM_INFO_PAUSE, 889 + SNDRV_PCM_INFO_MMAP_VALID, 891 890 .buffer_bytes_max = 64 * 1024, 892 891 .period_bytes_min = 32, 893 892 .period_bytes_max = 8192,
+1 -1
sound/soc/soc-core.c
··· 884 884 list_for_each_entry(component, &component_list, list) { 885 885 if (dlc->of_node && component->dev->of_node != dlc->of_node) 886 886 continue; 887 - if (dlc->name && strcmp(dev_name(component->dev), dlc->name)) 887 + if (dlc->name && strcmp(component->name, dlc->name)) 888 888 continue; 889 889 list_for_each_entry(dai, &component->dai_list, list) { 890 890 if (dlc->dai_name && strcmp(dai->name, dlc->dai_name))
+56 -16
sound/soc/soc-pcm.c
··· 1522 1522 dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); 1523 1523 } 1524 1524 1525 + static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd); 1526 + 1527 + /* Set FE's runtime_update state; the state is protected via PCM stream lock 1528 + * for avoiding the race with trigger callback. 1529 + * If the state is unset and a trigger is pending while the previous operation, 1530 + * process the pending trigger action here. 1531 + */ 1532 + static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, 1533 + int stream, enum snd_soc_dpcm_update state) 1534 + { 1535 + struct snd_pcm_substream *substream = 1536 + snd_soc_dpcm_get_substream(fe, stream); 1537 + 1538 + snd_pcm_stream_lock_irq(substream); 1539 + if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { 1540 + dpcm_fe_dai_do_trigger(substream, 1541 + fe->dpcm[stream].trigger_pending - 1); 1542 + fe->dpcm[stream].trigger_pending = 0; 1543 + } 1544 + fe->dpcm[stream].runtime_update = state; 1545 + snd_pcm_stream_unlock_irq(substream); 1546 + } 1547 + 1525 1548 static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) 1526 1549 { 1527 1550 struct snd_soc_pcm_runtime *fe = fe_substream->private_data; 1528 1551 struct snd_pcm_runtime *runtime = fe_substream->runtime; 1529 1552 int stream = fe_substream->stream, ret = 0; 1530 1553 1531 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1554 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); 1532 1555 1533 1556 ret = dpcm_be_dai_startup(fe, fe_substream->stream); 1534 1557 if (ret < 0) { ··· 1573 1550 dpcm_set_fe_runtime(fe_substream); 1574 1551 snd_pcm_limit_hw_rates(runtime); 1575 1552 1576 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1553 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 1577 1554 return 0; 1578 1555 1579 1556 unwind: 1580 1557 dpcm_be_dai_startup_unwind(fe, fe_substream->stream); 1581 1558 be_err: 1582 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1559 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 1583 1560 return ret; 1584 1561 } 1585 1562 ··· 1626 1603 struct snd_soc_pcm_runtime *fe = substream->private_data; 1627 1604 int stream = substream->stream; 1628 1605 1629 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1606 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); 1630 1607 1631 1608 /* shutdown the BEs */ 1632 1609 dpcm_be_dai_shutdown(fe, substream->stream); ··· 1640 1617 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); 1641 1618 1642 1619 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; 1643 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1620 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 1644 1621 return 0; 1645 1622 } 1646 1623 ··· 1688 1665 int err, stream = substream->stream; 1689 1666 1690 1667 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); 1691 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1668 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); 1692 1669 1693 1670 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); 1694 1671 ··· 1703 1680 err = dpcm_be_dai_hw_free(fe, stream); 1704 1681 1705 1682 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; 1706 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1683 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 1707 1684 1708 1685 mutex_unlock(&fe->card->mutex); 1709 1686 return 0; ··· 1796 1773 int ret, stream = substream->stream; 1797 1774 1798 1775 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); 1799 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1776 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); 1800 1777 1801 1778 memcpy(&fe->dpcm[substream->stream].hw_params, params, 1802 1779 sizeof(struct snd_pcm_hw_params)); ··· 1819 1796 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; 1820 1797 1821 1798 out: 1822 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1799 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 1823 1800 mutex_unlock(&fe->card->mutex); 1824 1801 return ret; 1825 1802 } ··· 1933 1910 } 1934 1911 EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); 1935 1912 1936 - static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) 1913 + static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) 1937 1914 { 1938 1915 struct snd_soc_pcm_runtime *fe = substream->private_data; 1939 1916 int stream = substream->stream, ret; ··· 2007 1984 return ret; 2008 1985 } 2009 1986 1987 + static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) 1988 + { 1989 + struct snd_soc_pcm_runtime *fe = substream->private_data; 1990 + int stream = substream->stream; 1991 + 1992 + /* if FE's runtime_update is already set, we're in race; 1993 + * process this trigger later at exit 1994 + */ 1995 + if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { 1996 + fe->dpcm[stream].trigger_pending = cmd + 1; 1997 + return 0; /* delayed, assuming it's successful */ 1998 + } 1999 + 2000 + /* we're alone, let's trigger */ 2001 + return dpcm_fe_dai_do_trigger(substream, cmd); 2002 + } 2003 + 2010 2004 int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) 2011 2005 { 2012 2006 struct snd_soc_dpcm *dpcm; ··· 2067 2027 2068 2028 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); 2069 2029 2070 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 2030 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); 2071 2031 2072 2032 /* there is no point preparing this FE if there are no BEs */ 2073 2033 if (list_empty(&fe->dpcm[stream].be_clients)) { ··· 2094 2054 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; 2095 2055 2096 2056 out: 2097 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 2057 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 2098 2058 mutex_unlock(&fe->card->mutex); 2099 2059 2100 2060 return ret; ··· 2241 2201 { 2242 2202 int ret; 2243 2203 2244 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; 2204 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); 2245 2205 ret = dpcm_run_update_startup(fe, stream); 2246 2206 if (ret < 0) 2247 2207 dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); 2248 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 2208 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 2249 2209 2250 2210 return ret; 2251 2211 } ··· 2254 2214 { 2255 2215 int ret; 2256 2216 2257 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; 2217 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); 2258 2218 ret = dpcm_run_update_shutdown(fe, stream); 2259 2219 if (ret < 0) 2260 2220 dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); 2261 - fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 2221 + dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); 2262 2222 2263 2223 return ret; 2264 2224 }
+4 -3
sound/usb/mixer.c
··· 2033 2033 cval->res = 1; 2034 2034 cval->initialized = 1; 2035 2035 2036 - if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) 2037 - cval->control = UAC2_CX_CLOCK_SELECTOR; 2038 - else 2036 + if (state->mixer->protocol == UAC_VERSION_1) 2039 2037 cval->control = 0; 2038 + else /* UAC_VERSION_2 */ 2039 + cval->control = (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) ? 2040 + UAC2_CX_CLOCK_SELECTOR : UAC2_SU_SELECTOR; 2040 2041 2041 2042 namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); 2042 2043 if (!namelist) {
+8 -2
sound/usb/mixer_quirks.c
··· 593 593 if (mixer->chip->shutdown) 594 594 ret = -ENODEV; 595 595 else 596 - ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, 596 + ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, 597 597 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 598 598 0, wIndex, 599 - &tmp, sizeof(tmp), 1000); 599 + &tmp, sizeof(tmp)); 600 600 up_read(&mixer->chip->shutdown_rwsem); 601 601 602 602 if (ret < 0) { ··· 885 885 return changed; 886 886 } 887 887 888 + static void kctl_private_value_free(struct snd_kcontrol *kctl) 889 + { 890 + kfree((void *)kctl->private_value); 891 + } 892 + 888 893 static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, 889 894 int validx, int bUnitID) 890 895 { ··· 924 919 return -ENOMEM; 925 920 } 926 921 922 + kctl->private_free = kctl_private_value_free; 927 923 err = snd_ctl_add(mixer->chip->card, kctl); 928 924 if (err < 0) 929 925 return err;
+16 -2
sound/usb/quirks.c
··· 1146 1146 if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && 1147 1147 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) 1148 1148 mdelay(20); 1149 + 1150 + /* Marantz/Denon devices with USB DAC functionality need a delay 1151 + * after each class compliant request 1152 + */ 1153 + if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) && 1154 + (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { 1155 + 1156 + switch (le16_to_cpu(dev->descriptor.idProduct)) { 1157 + case 0x3005: /* Marantz HD-DAC1 */ 1158 + case 0x3006: /* Marantz SA-14S1 */ 1159 + mdelay(20); 1160 + break; 1161 + } 1162 + } 1149 1163 } 1150 1164 1151 1165 /* ··· 1193 1179 /* iFi Audio micro/nano iDSD */ 1194 1180 case USB_ID(0x20b1, 0x3008): 1195 1181 if (fp->altsetting == 2) 1196 - return SNDRV_PCM_FMTBIT_DSD_U32_LE; 1182 + return SNDRV_PCM_FMTBIT_DSD_U32_BE; 1197 1183 break; 1198 1184 /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ 1199 1185 case USB_ID(0x20b1, 0x2009): 1200 1186 if (fp->altsetting == 3) 1201 - return SNDRV_PCM_FMTBIT_DSD_U32_LE; 1187 + return SNDRV_PCM_FMTBIT_DSD_U32_BE; 1202 1188 break; 1203 1189 default: 1204 1190 break;
+1 -1
tools/testing/selftests/net/psock_fanout.c
··· 128 128 struct tpacket2_hdr *header = ring; 129 129 int count = 0; 130 130 131 - while (header->tp_status & TP_STATUS_USER && count < RING_NUM_FRAMES) { 131 + while (count < RING_NUM_FRAMES && header->tp_status & TP_STATUS_USER) { 132 132 count++; 133 133 header = ring + (count * getpagesize()); 134 134 }
+4 -4
virt/kvm/arm/vgic.c
··· 1933 1933 1934 1934 int kvm_vgic_create(struct kvm *kvm) 1935 1935 { 1936 - int i, vcpu_lock_idx = -1, ret = 0; 1936 + int i, vcpu_lock_idx = -1, ret; 1937 1937 struct kvm_vcpu *vcpu; 1938 1938 1939 1939 mutex_lock(&kvm->lock); ··· 1948 1948 * vcpu->mutex. By grabbing the vcpu->mutex of all VCPUs we ensure 1949 1949 * that no other VCPUs are run while we create the vgic. 1950 1950 */ 1951 + ret = -EBUSY; 1951 1952 kvm_for_each_vcpu(i, vcpu, kvm) { 1952 1953 if (!mutex_trylock(&vcpu->mutex)) 1953 1954 goto out_unlock; ··· 1956 1955 } 1957 1956 1958 1957 kvm_for_each_vcpu(i, vcpu, kvm) { 1959 - if (vcpu->arch.has_run_once) { 1960 - ret = -EBUSY; 1958 + if (vcpu->arch.has_run_once) 1961 1959 goto out_unlock; 1962 - } 1963 1960 } 1961 + ret = 0; 1964 1962 1965 1963 spin_lock_init(&kvm->arch.vgic.lock); 1966 1964 kvm->arch.vgic.in_kernel = true;
+8 -8
virt/kvm/kvm_main.c
··· 107 107 108 108 static bool largepages_enabled = true; 109 109 110 - bool kvm_is_mmio_pfn(pfn_t pfn) 110 + bool kvm_is_reserved_pfn(pfn_t pfn) 111 111 { 112 112 if (pfn_valid(pfn)) 113 - return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn)); 113 + return PageReserved(pfn_to_page(pfn)); 114 114 115 115 return true; 116 116 } ··· 1321 1321 else if ((vma->vm_flags & VM_PFNMAP)) { 1322 1322 pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) + 1323 1323 vma->vm_pgoff; 1324 - BUG_ON(!kvm_is_mmio_pfn(pfn)); 1324 + BUG_ON(!kvm_is_reserved_pfn(pfn)); 1325 1325 } else { 1326 1326 if (async && vma_is_valid(vma, write_fault)) 1327 1327 *async = true; ··· 1427 1427 if (is_error_noslot_pfn(pfn)) 1428 1428 return KVM_ERR_PTR_BAD_PAGE; 1429 1429 1430 - if (kvm_is_mmio_pfn(pfn)) { 1430 + if (kvm_is_reserved_pfn(pfn)) { 1431 1431 WARN_ON(1); 1432 1432 return KVM_ERR_PTR_BAD_PAGE; 1433 1433 } ··· 1456 1456 1457 1457 void kvm_release_pfn_clean(pfn_t pfn) 1458 1458 { 1459 - if (!is_error_noslot_pfn(pfn) && !kvm_is_mmio_pfn(pfn)) 1459 + if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn)) 1460 1460 put_page(pfn_to_page(pfn)); 1461 1461 } 1462 1462 EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); ··· 1477 1477 1478 1478 void kvm_set_pfn_dirty(pfn_t pfn) 1479 1479 { 1480 - if (!kvm_is_mmio_pfn(pfn)) { 1480 + if (!kvm_is_reserved_pfn(pfn)) { 1481 1481 struct page *page = pfn_to_page(pfn); 1482 1482 if (!PageReserved(page)) 1483 1483 SetPageDirty(page); ··· 1487 1487 1488 1488 void kvm_set_pfn_accessed(pfn_t pfn) 1489 1489 { 1490 - if (!kvm_is_mmio_pfn(pfn)) 1490 + if (!kvm_is_reserved_pfn(pfn)) 1491 1491 mark_page_accessed(pfn_to_page(pfn)); 1492 1492 } 1493 1493 EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed); 1494 1494 1495 1495 void kvm_get_pfn(pfn_t pfn) 1496 1496 { 1497 - if (!kvm_is_mmio_pfn(pfn)) 1497 + if (!kvm_is_reserved_pfn(pfn)) 1498 1498 get_page(pfn_to_page(pfn)); 1499 1499 } 1500 1500 EXPORT_SYMBOL_GPL(kvm_get_pfn);