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

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

drivers/net/ethernet/freescale/fec.h
7d650df99d52 ("net: fec: add pm_qos support on imx6q platform")
40c79ce13b03 ("net: fec: add stop mode support for imx8 platform")

Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+3325 -1978
+1
Documentation/block/index.rst
··· 23 23 stat 24 24 switching-sched 25 25 writeback_cache_control 26 + ublk
+253
Documentation/block/ublk.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + =========================================== 4 + Userspace block device driver (ublk driver) 5 + =========================================== 6 + 7 + Overview 8 + ======== 9 + 10 + ublk is a generic framework for implementing block device logic from userspace. 11 + The motivation behind it is that moving virtual block drivers into userspace, 12 + such as loop, nbd and similar can be very helpful. It can help to implement 13 + new virtual block device such as ublk-qcow2 (there are several attempts of 14 + implementing qcow2 driver in kernel). 15 + 16 + Userspace block devices are attractive because: 17 + 18 + - They can be written many programming languages. 19 + - They can use libraries that are not available in the kernel. 20 + - They can be debugged with tools familiar to application developers. 21 + - Crashes do not kernel panic the machine. 22 + - Bugs are likely to have a lower security impact than bugs in kernel 23 + code. 24 + - They can be installed and updated independently of the kernel. 25 + - They can be used to simulate block device easily with user specified 26 + parameters/setting for test/debug purpose 27 + 28 + ublk block device (``/dev/ublkb*``) is added by ublk driver. Any IO request 29 + on the device will be forwarded to ublk userspace program. For convenience, 30 + in this document, ``ublk server`` refers to generic ublk userspace 31 + program. ``ublksrv`` [#userspace]_ is one of such implementation. It 32 + provides ``libublksrv`` [#userspace_lib]_ library for developing specific 33 + user block device conveniently, while also generic type block device is 34 + included, such as loop and null. Richard W.M. Jones wrote userspace nbd device 35 + ``nbdublk`` [#userspace_nbdublk]_ based on ``libublksrv`` [#userspace_lib]_. 36 + 37 + After the IO is handled by userspace, the result is committed back to the 38 + driver, thus completing the request cycle. This way, any specific IO handling 39 + logic is totally done by userspace, such as loop's IO handling, NBD's IO 40 + communication, or qcow2's IO mapping. 41 + 42 + ``/dev/ublkb*`` is driven by blk-mq request-based driver. Each request is 43 + assigned by one queue wide unique tag. ublk server assigns unique tag to each 44 + IO too, which is 1:1 mapped with IO of ``/dev/ublkb*``. 45 + 46 + Both the IO request forward and IO handling result committing are done via 47 + ``io_uring`` passthrough command; that is why ublk is also one io_uring based 48 + block driver. It has been observed that using io_uring passthrough command can 49 + give better IOPS than block IO; which is why ublk is one of high performance 50 + implementation of userspace block device: not only IO request communication is 51 + done by io_uring, but also the preferred IO handling in ublk server is io_uring 52 + based approach too. 53 + 54 + ublk provides control interface to set/get ublk block device parameters. 55 + The interface is extendable and kabi compatible: basically any ublk request 56 + queue's parameter or ublk generic feature parameters can be set/get via the 57 + interface. Thus, ublk is generic userspace block device framework. 58 + For example, it is easy to setup a ublk device with specified block 59 + parameters from userspace. 60 + 61 + Using ublk 62 + ========== 63 + 64 + ublk requires userspace ublk server to handle real block device logic. 65 + 66 + Below is example of using ``ublksrv`` to provide ublk-based loop device. 67 + 68 + - add a device:: 69 + 70 + ublk add -t loop -f ublk-loop.img 71 + 72 + - format with xfs, then use it:: 73 + 74 + mkfs.xfs /dev/ublkb0 75 + mount /dev/ublkb0 /mnt 76 + # do anything. all IOs are handled by io_uring 77 + ... 78 + umount /mnt 79 + 80 + - list the devices with their info:: 81 + 82 + ublk list 83 + 84 + - delete the device:: 85 + 86 + ublk del -a 87 + ublk del -n $ublk_dev_id 88 + 89 + See usage details in README of ``ublksrv`` [#userspace_readme]_. 90 + 91 + Design 92 + ====== 93 + 94 + Control plane 95 + ------------- 96 + 97 + ublk driver provides global misc device node (``/dev/ublk-control``) for 98 + managing and controlling ublk devices with help of several control commands: 99 + 100 + - ``UBLK_CMD_ADD_DEV`` 101 + 102 + Add a ublk char device (``/dev/ublkc*``) which is talked with ublk server 103 + WRT IO command communication. Basic device info is sent together with this 104 + command. It sets UAPI structure of ``ublksrv_ctrl_dev_info``, 105 + such as ``nr_hw_queues``, ``queue_depth``, and max IO request buffer size, 106 + for which the info is negotiated with the driver and sent back to the server. 107 + When this command is completed, the basic device info is immutable. 108 + 109 + - ``UBLK_CMD_SET_PARAMS`` / ``UBLK_CMD_GET_PARAMS`` 110 + 111 + Set or get parameters of the device, which can be either generic feature 112 + related, or request queue limit related, but can't be IO logic specific, 113 + because the driver does not handle any IO logic. This command has to be 114 + sent before sending ``UBLK_CMD_START_DEV``. 115 + 116 + - ``UBLK_CMD_START_DEV`` 117 + 118 + After the server prepares userspace resources (such as creating per-queue 119 + pthread & io_uring for handling ublk IO), this command is sent to the 120 + driver for allocating & exposing ``/dev/ublkb*``. Parameters set via 121 + ``UBLK_CMD_SET_PARAMS`` are applied for creating the device. 122 + 123 + - ``UBLK_CMD_STOP_DEV`` 124 + 125 + Halt IO on ``/dev/ublkb*`` and remove the device. When this command returns, 126 + ublk server will release resources (such as destroying per-queue pthread & 127 + io_uring). 128 + 129 + - ``UBLK_CMD_DEL_DEV`` 130 + 131 + Remove ``/dev/ublkc*``. When this command returns, the allocated ublk device 132 + number can be reused. 133 + 134 + - ``UBLK_CMD_GET_QUEUE_AFFINITY`` 135 + 136 + When ``/dev/ublkc`` is added, the driver creates block layer tagset, so 137 + that each queue's affinity info is available. The server sends 138 + ``UBLK_CMD_GET_QUEUE_AFFINITY`` to retrieve queue affinity info. It can 139 + set up the per-queue context efficiently, such as bind affine CPUs with IO 140 + pthread and try to allocate buffers in IO thread context. 141 + 142 + - ``UBLK_CMD_GET_DEV_INFO`` 143 + 144 + For retrieving device info via ``ublksrv_ctrl_dev_info``. It is the server's 145 + responsibility to save IO target specific info in userspace. 146 + 147 + Data plane 148 + ---------- 149 + 150 + ublk server needs to create per-queue IO pthread & io_uring for handling IO 151 + commands via io_uring passthrough. The per-queue IO pthread 152 + focuses on IO handling and shouldn't handle any control & management 153 + tasks. 154 + 155 + The's IO is assigned by a unique tag, which is 1:1 mapping with IO 156 + request of ``/dev/ublkb*``. 157 + 158 + UAPI structure of ``ublksrv_io_desc`` is defined for describing each IO from 159 + the driver. A fixed mmaped area (array) on ``/dev/ublkc*`` is provided for 160 + exporting IO info to the server; such as IO offset, length, OP/flags and 161 + buffer address. Each ``ublksrv_io_desc`` instance can be indexed via queue id 162 + and IO tag directly. 163 + 164 + The following IO commands are communicated via io_uring passthrough command, 165 + and each command is only for forwarding the IO and committing the result 166 + with specified IO tag in the command data: 167 + 168 + - ``UBLK_IO_FETCH_REQ`` 169 + 170 + Sent from the server IO pthread for fetching future incoming IO requests 171 + destined to ``/dev/ublkb*``. This command is sent only once from the server 172 + IO pthread for ublk driver to setup IO forward environment. 173 + 174 + - ``UBLK_IO_COMMIT_AND_FETCH_REQ`` 175 + 176 + When an IO request is destined to ``/dev/ublkb*``, the driver stores 177 + the IO's ``ublksrv_io_desc`` to the specified mapped area; then the 178 + previous received IO command of this IO tag (either ``UBLK_IO_FETCH_REQ`` 179 + or ``UBLK_IO_COMMIT_AND_FETCH_REQ)`` is completed, so the server gets 180 + the IO notification via io_uring. 181 + 182 + After the server handles the IO, its result is committed back to the 183 + driver by sending ``UBLK_IO_COMMIT_AND_FETCH_REQ`` back. Once ublkdrv 184 + received this command, it parses the result and complete the request to 185 + ``/dev/ublkb*``. In the meantime setup environment for fetching future 186 + requests with the same IO tag. That is, ``UBLK_IO_COMMIT_AND_FETCH_REQ`` 187 + is reused for both fetching request and committing back IO result. 188 + 189 + - ``UBLK_IO_NEED_GET_DATA`` 190 + 191 + With ``UBLK_F_NEED_GET_DATA`` enabled, the WRITE request will be firstly 192 + issued to ublk server without data copy. Then, IO backend of ublk server 193 + receives the request and it can allocate data buffer and embed its addr 194 + inside this new io command. After the kernel driver gets the command, 195 + data copy is done from request pages to this backend's buffer. Finally, 196 + backend receives the request again with data to be written and it can 197 + truly handle the request. 198 + 199 + ``UBLK_IO_NEED_GET_DATA`` adds one additional round-trip and one 200 + io_uring_enter() syscall. Any user thinks that it may lower performance 201 + should not enable UBLK_F_NEED_GET_DATA. ublk server pre-allocates IO 202 + buffer for each IO by default. Any new project should try to use this 203 + buffer to communicate with ublk driver. However, existing project may 204 + break or not able to consume the new buffer interface; that's why this 205 + command is added for backwards compatibility so that existing projects 206 + can still consume existing buffers. 207 + 208 + - data copy between ublk server IO buffer and ublk block IO request 209 + 210 + The driver needs to copy the block IO request pages into the server buffer 211 + (pages) first for WRITE before notifying the server of the coming IO, so 212 + that the server can handle WRITE request. 213 + 214 + When the server handles READ request and sends 215 + ``UBLK_IO_COMMIT_AND_FETCH_REQ`` to the server, ublkdrv needs to copy 216 + the server buffer (pages) read to the IO request pages. 217 + 218 + Future development 219 + ================== 220 + 221 + Container-aware ublk deivice 222 + ---------------------------- 223 + 224 + ublk driver doesn't handle any IO logic. Its function is well defined 225 + for now and very limited userspace interfaces are needed, which is also 226 + well defined too. It is possible to make ublk devices container-aware block 227 + devices in future as Stefan Hajnoczi suggested [#stefan]_, by removing 228 + ADMIN privilege. 229 + 230 + Zero copy 231 + --------- 232 + 233 + Zero copy is a generic requirement for nbd, fuse or similar drivers. A 234 + problem [#xiaoguang]_ Xiaoguang mentioned is that pages mapped to userspace 235 + can't be remapped any more in kernel with existing mm interfaces. This can 236 + occurs when destining direct IO to ``/dev/ublkb*``. Also, he reported that 237 + big requests (IO size >= 256 KB) may benefit a lot from zero copy. 238 + 239 + 240 + References 241 + ========== 242 + 243 + .. [#userspace] https://github.com/ming1/ubdsrv 244 + 245 + .. [#userspace_lib] https://github.com/ming1/ubdsrv/tree/master/lib 246 + 247 + .. [#userspace_nbdublk] https://gitlab.com/rwmjones/libnbd/-/tree/nbdublk 248 + 249 + .. [#userspace_readme] https://github.com/ming1/ubdsrv/blob/master/README 250 + 251 + .. [#stefan] https://lore.kernel.org/linux-block/YoOr6jBfgVm8GvWg@stefanha-x1.localdomain/ 252 + 253 + .. [#xiaoguang] https://lore.kernel.org/linux-block/YoOr6jBfgVm8GvWg@stefanha-x1.localdomain/
+2
Documentation/devicetree/bindings/iio/gyroscope/bosch,bmg160.yaml
··· 24 24 25 25 interrupts: 26 26 minItems: 1 27 + maxItems: 2 27 28 description: 28 29 Should be configured with type IRQ_TYPE_EDGE_RISING. 30 + If two interrupts are provided, expected order is INT1 and INT2. 29 31 30 32 required: 31 33 - compatible
+1
Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
··· 16 16 compatible: 17 17 enum: 18 18 - goodix,gt1151 19 + - goodix,gt1158 19 20 - goodix,gt5663 20 21 - goodix,gt5688 21 22 - goodix,gt911
+1
Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml
··· 24 24 - mediatek,mt2712-mtu3 25 25 - mediatek,mt8173-mtu3 26 26 - mediatek,mt8183-mtu3 27 + - mediatek,mt8188-mtu3 27 28 - mediatek,mt8192-mtu3 28 29 - mediatek,mt8195-mtu3 29 30 - const: mediatek,mtu3
+6
Documentation/devicetree/bindings/usb/qcom,dwc3.yaml
··· 33 33 - qcom,sm6115-dwc3 34 34 - qcom,sm6125-dwc3 35 35 - qcom,sm6350-dwc3 36 + - qcom,sm6375-dwc3 36 37 - qcom,sm8150-dwc3 37 38 - qcom,sm8250-dwc3 38 39 - qcom,sm8350-dwc3 ··· 109 108 HS/FS/LS modes are supported. 110 109 type: boolean 111 110 111 + wakeup-source: true 112 + 112 113 # Required child node: 113 114 114 115 patternProperties: 115 116 "^usb@[0-9a-f]+$": 116 117 $ref: snps,dwc3.yaml# 118 + 119 + properties: 120 + wakeup-source: false 117 121 118 122 required: 119 123 - compatible
+1
Documentation/input/joydev/joystick.rst
··· 517 517 * AVB Mag Turbo Force 518 518 * AVB Top Shot Pegasus 519 519 * AVB Top Shot Force Feedback Racing Wheel 520 + * Boeder Force Feedback Wheel 520 521 * Logitech WingMan Force 521 522 * Logitech WingMan Force Wheel 522 523 * Guillemot Race Leader Force Feedback
-11
Documentation/networking/rxrpc.rst
··· 1055 1055 first function to change. Note that this must be called in TASK_RUNNING 1056 1056 state. 1057 1057 1058 - (#) Get reply timestamp:: 1059 - 1060 - bool rxrpc_kernel_get_reply_time(struct socket *sock, 1061 - struct rxrpc_call *call, 1062 - ktime_t *_ts) 1063 - 1064 - This allows the timestamp on the first DATA packet of the reply of a 1065 - client call to be queried, provided that it is still in the Rx ring. If 1066 - successful, the timestamp will be stored into ``*_ts`` and true will be 1067 - returned; false will be returned otherwise. 1068 - 1069 1058 (#) Get remote client epoch:: 1070 1059 1071 1060 u32 rxrpc_kernel_get_epoch(struct socket *sock,
+13 -1
MAINTAINERS
··· 10032 10032 F: Documentation/devicetree/bindings/serio/ 10033 10033 F: Documentation/input/ 10034 10034 F: drivers/input/ 10035 + F: include/dt-bindings/input/ 10035 10036 F: include/linux/input.h 10036 10037 F: include/linux/input/ 10037 10038 F: include/uapi/linux/input-event-codes.h ··· 17532 17531 M: Daire McNamara <daire.mcnamara@microchip.com> 17533 17532 L: linux-riscv@lists.infradead.org 17534 17533 S: Supported 17534 + F: Documentation/devicetree/bindings/clock/microchip,mpfs.yaml 17535 + F: Documentation/devicetree/bindings/gpio/microchip,mpfs-gpio.yaml 17536 + F: Documentation/devicetree/bindings/i2c/microchip,corei2c.yaml 17537 + F: Documentation/devicetree/bindings/mailbox/microchip,mpfs-mailbox.yaml 17538 + F: Documentation/devicetree/bindings/net/can/microchip,mpfs-can.yaml 17539 + F: Documentation/devicetree/bindings/pwm/microchip,corepwm.yaml 17540 + F: Documentation/devicetree/bindings/soc/microchip/microchip,mpfs-sys-controller.yaml 17541 + F: Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml 17542 + F: Documentation/devicetree/bindings/usb/microchip,mpfs-musb.yaml 17535 17543 F: arch/riscv/boot/dts/microchip/ 17536 17544 F: drivers/char/hw_random/mpfs-rng.c 17537 17545 F: drivers/clk/microchip/clk-mpfs.c 17546 + F: drivers/i2c/busses/i2c-microchip-core.c 17538 17547 F: drivers/mailbox/mailbox-mpfs.c 17539 17548 F: drivers/pci/controller/pcie-microchip-host.c 17540 17549 F: drivers/rtc/rtc-mpfs.c ··· 20775 20764 M: Ming Lei <ming.lei@redhat.com> 20776 20765 L: linux-block@vger.kernel.org 20777 20766 S: Maintained 20767 + F: Documentation/block/ublk.rst 20778 20768 F: drivers/block/ublk_drv.c 20779 20769 F: include/uapi/linux/ublk_cmd.h 20780 20770 ··· 22319 22307 R: Srinivas Neeli <srinivas.neeli@xilinx.com> 22320 22308 R: Michal Simek <michal.simek@xilinx.com> 22321 22309 S: Maintained 22322 - F: Documentation/devicetree/bindings/gpio/gpio-xilinx.txt 22310 + F: Documentation/devicetree/bindings/gpio/xlnx,gpio-xilinx.yaml 22323 22311 F: Documentation/devicetree/bindings/gpio/gpio-zynq.yaml 22324 22312 F: drivers/gpio/gpio-xilinx.c 22325 22313 F: drivers/gpio/gpio-zynq.c
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 0 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc3 5 + EXTRAVERSION = -rc4 6 6 NAME = Hurr durr I'ma ninja sloth 7 7 8 8 # *DOCUMENTATION*
+1 -1
arch/arm/boot/dts/arm-realview-eb.dtsi
··· 399 399 compatible = "arm,pl022", "arm,primecell"; 400 400 reg = <0x1000d000 0x1000>; 401 401 clocks = <&sspclk>, <&pclk>; 402 - clock-names = "SSPCLK", "apb_pclk"; 402 + clock-names = "sspclk", "apb_pclk"; 403 403 }; 404 404 405 405 wdog: watchdog@10010000 {
+1 -1
arch/arm/boot/dts/arm-realview-pb1176.dts
··· 410 410 interrupt-parent = <&intc_dc1176>; 411 411 interrupts = <0 17 IRQ_TYPE_LEVEL_HIGH>; 412 412 clocks = <&sspclk>, <&pclk>; 413 - clock-names = "SSPCLK", "apb_pclk"; 413 + clock-names = "sspclk", "apb_pclk"; 414 414 }; 415 415 416 416 pb1176_serial0: serial@1010c000 {
+1 -1
arch/arm/boot/dts/arm-realview-pb11mp.dts
··· 555 555 interrupt-parent = <&intc_pb11mp>; 556 556 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>; 557 557 clocks = <&sspclk>, <&pclk>; 558 - clock-names = "SSPCLK", "apb_pclk"; 558 + clock-names = "sspclk", "apb_pclk"; 559 559 }; 560 560 561 561 watchdog@1000f000 {
+1 -1
arch/arm/boot/dts/arm-realview-pbx.dtsi
··· 390 390 compatible = "arm,pl022", "arm,primecell"; 391 391 reg = <0x1000d000 0x1000>; 392 392 clocks = <&sspclk>, <&pclk>; 393 - clock-names = "SSPCLK", "apb_pclk"; 393 + clock-names = "sspclk", "apb_pclk"; 394 394 }; 395 395 396 396 wdog0: watchdog@1000f000 {
+10 -11
arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
··· 76 76 regulators { 77 77 vdd_3v3: VDD_IO { 78 78 regulator-name = "VDD_IO"; 79 - regulator-min-microvolt = <1200000>; 80 - regulator-max-microvolt = <3700000>; 79 + regulator-min-microvolt = <3300000>; 80 + regulator-max-microvolt = <3300000>; 81 81 regulator-initial-mode = <2>; 82 82 regulator-allowed-modes = <2>, <4>; 83 83 regulator-always-on; ··· 95 95 96 96 vddio_ddr: VDD_DDR { 97 97 regulator-name = "VDD_DDR"; 98 - regulator-min-microvolt = <600000>; 99 - regulator-max-microvolt = <1850000>; 98 + regulator-min-microvolt = <1200000>; 99 + regulator-max-microvolt = <1200000>; 100 100 regulator-initial-mode = <2>; 101 101 regulator-allowed-modes = <2>, <4>; 102 102 regulator-always-on; ··· 118 118 119 119 vdd_core: VDD_CORE { 120 120 regulator-name = "VDD_CORE"; 121 - regulator-min-microvolt = <600000>; 122 - regulator-max-microvolt = <1850000>; 121 + regulator-min-microvolt = <1250000>; 122 + regulator-max-microvolt = <1250000>; 123 123 regulator-initial-mode = <2>; 124 124 regulator-allowed-modes = <2>, <4>; 125 125 regulator-always-on; ··· 160 160 161 161 LDO1 { 162 162 regulator-name = "LDO1"; 163 - regulator-min-microvolt = <1200000>; 164 - regulator-max-microvolt = <3700000>; 163 + regulator-min-microvolt = <3300000>; 164 + regulator-max-microvolt = <3300000>; 165 165 regulator-always-on; 166 166 167 167 regulator-state-standby { ··· 175 175 176 176 LDO2 { 177 177 regulator-name = "LDO2"; 178 - regulator-min-microvolt = <1200000>; 179 - regulator-max-microvolt = <3700000>; 180 - regulator-always-on; 178 + regulator-min-microvolt = <1800000>; 179 + regulator-max-microvolt = <3300000>; 181 180 182 181 regulator-state-standby { 183 182 regulator-on-in-suspend;
+10 -11
arch/arm/boot/dts/at91-sama5d2_icp.dts
··· 196 196 regulators { 197 197 vdd_io_reg: VDD_IO { 198 198 regulator-name = "VDD_IO"; 199 - regulator-min-microvolt = <1200000>; 200 - regulator-max-microvolt = <3700000>; 199 + regulator-min-microvolt = <3300000>; 200 + regulator-max-microvolt = <3300000>; 201 201 regulator-initial-mode = <2>; 202 202 regulator-allowed-modes = <2>, <4>; 203 203 regulator-always-on; ··· 215 215 216 216 VDD_DDR { 217 217 regulator-name = "VDD_DDR"; 218 - regulator-min-microvolt = <600000>; 219 - regulator-max-microvolt = <1850000>; 218 + regulator-min-microvolt = <1350000>; 219 + regulator-max-microvolt = <1350000>; 220 220 regulator-initial-mode = <2>; 221 221 regulator-allowed-modes = <2>, <4>; 222 222 regulator-always-on; ··· 234 234 235 235 VDD_CORE { 236 236 regulator-name = "VDD_CORE"; 237 - regulator-min-microvolt = <600000>; 238 - regulator-max-microvolt = <1850000>; 237 + regulator-min-microvolt = <1250000>; 238 + regulator-max-microvolt = <1250000>; 239 239 regulator-initial-mode = <2>; 240 240 regulator-allowed-modes = <2>, <4>; 241 241 regulator-always-on; ··· 257 257 regulator-max-microvolt = <1850000>; 258 258 regulator-initial-mode = <2>; 259 259 regulator-allowed-modes = <2>, <4>; 260 - regulator-always-on; 261 260 262 261 regulator-state-standby { 263 262 regulator-on-in-suspend; ··· 271 272 272 273 LDO1 { 273 274 regulator-name = "LDO1"; 274 - regulator-min-microvolt = <1200000>; 275 - regulator-max-microvolt = <3700000>; 275 + regulator-min-microvolt = <2500000>; 276 + regulator-max-microvolt = <2500000>; 276 277 regulator-always-on; 277 278 278 279 regulator-state-standby { ··· 286 287 287 288 LDO2 { 288 289 regulator-name = "LDO2"; 289 - regulator-min-microvolt = <1200000>; 290 - regulator-max-microvolt = <3700000>; 290 + regulator-min-microvolt = <3300000>; 291 + regulator-max-microvolt = <3300000>; 291 292 regulator-always-on; 292 293 293 294 regulator-state-standby {
+9 -9
arch/arm/boot/dts/at91-sama7g5ek.dts
··· 244 244 regulators { 245 245 vdd_3v3: VDD_IO { 246 246 regulator-name = "VDD_IO"; 247 - regulator-min-microvolt = <1200000>; 248 - regulator-max-microvolt = <3700000>; 247 + regulator-min-microvolt = <3300000>; 248 + regulator-max-microvolt = <3300000>; 249 249 regulator-initial-mode = <2>; 250 250 regulator-allowed-modes = <2>, <4>; 251 251 regulator-always-on; ··· 264 264 265 265 vddioddr: VDD_DDR { 266 266 regulator-name = "VDD_DDR"; 267 - regulator-min-microvolt = <1300000>; 268 - regulator-max-microvolt = <1450000>; 267 + regulator-min-microvolt = <1350000>; 268 + regulator-max-microvolt = <1350000>; 269 269 regulator-initial-mode = <2>; 270 270 regulator-allowed-modes = <2>, <4>; 271 271 regulator-always-on; ··· 285 285 286 286 vddcore: VDD_CORE { 287 287 regulator-name = "VDD_CORE"; 288 - regulator-min-microvolt = <1100000>; 289 - regulator-max-microvolt = <1850000>; 288 + regulator-min-microvolt = <1150000>; 289 + regulator-max-microvolt = <1150000>; 290 290 regulator-initial-mode = <2>; 291 291 regulator-allowed-modes = <2>, <4>; 292 292 regulator-always-on; ··· 306 306 vddcpu: VDD_OTHER { 307 307 regulator-name = "VDD_OTHER"; 308 308 regulator-min-microvolt = <1050000>; 309 - regulator-max-microvolt = <1850000>; 309 + regulator-max-microvolt = <1250000>; 310 310 regulator-initial-mode = <2>; 311 311 regulator-allowed-modes = <2>, <4>; 312 312 regulator-ramp-delay = <3125>; ··· 326 326 327 327 vldo1: LDO1 { 328 328 regulator-name = "LDO1"; 329 - regulator-min-microvolt = <1200000>; 330 - regulator-max-microvolt = <3700000>; 329 + regulator-min-microvolt = <1800000>; 330 + regulator-max-microvolt = <1800000>; 331 331 regulator-always-on; 332 332 333 333 regulator-state-standby {
+11 -9
arch/arm/boot/dts/bcm63178.dtsi
··· 32 32 next-level-cache = <&L2_0>; 33 33 enable-method = "psci"; 34 34 }; 35 + 35 36 CA7_2: cpu@2 { 36 37 device_type = "cpu"; 37 38 compatible = "arm,cortex-a7"; ··· 40 39 next-level-cache = <&L2_0>; 41 40 enable-method = "psci"; 42 41 }; 42 + 43 43 L2_0: l2-cache0 { 44 44 compatible = "cache"; 45 45 }; ··· 48 46 49 47 timer { 50 48 compatible = "arm,armv7-timer"; 51 - interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 52 - <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 53 - <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 54 - <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 49 + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(3) | IRQ_TYPE_LEVEL_LOW)>, 50 + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(3) | IRQ_TYPE_LEVEL_LOW)>, 51 + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(3) | IRQ_TYPE_LEVEL_LOW)>, 52 + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(3) | IRQ_TYPE_LEVEL_LOW)>; 55 53 arm,cpu-registers-not-fw-configured; 56 54 }; 57 55 ··· 82 80 psci { 83 81 compatible = "arm,psci-0.2"; 84 82 method = "smc"; 85 - cpu_off = <1>; 86 - cpu_on = <2>; 87 83 }; 88 84 89 85 axi@81000000 { 90 86 compatible = "simple-bus"; 91 87 #address-cells = <1>; 92 88 #size-cells = <1>; 93 - ranges = <0 0x81000000 0x4000>; 89 + ranges = <0 0x81000000 0x8000>; 94 90 95 91 gic: interrupt-controller@1000 { 96 92 compatible = "arm,cortex-a7-gic"; 97 93 #interrupt-cells = <3>; 98 - #address-cells = <0>; 99 94 interrupt-controller; 95 + interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(3) | IRQ_TYPE_LEVEL_HIGH)>; 100 96 reg = <0x1000 0x1000>, 101 - <0x2000 0x2000>; 97 + <0x2000 0x2000>, 98 + <0x4000 0x2000>, 99 + <0x6000 0x2000>; 102 100 }; 103 101 }; 104 102
+9 -9
arch/arm/boot/dts/bcm6846.dtsi
··· 40 40 41 41 timer { 42 42 compatible = "arm,armv7-timer"; 43 - interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 44 - <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 45 - <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 46 - <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 43 + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, 44 + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, 45 + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, 46 + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; 47 47 arm,cpu-registers-not-fw-configured; 48 48 }; 49 49 ··· 65 65 psci { 66 66 compatible = "arm,psci-0.2"; 67 67 method = "smc"; 68 - cpu_off = <1>; 69 - cpu_on = <2>; 70 68 }; 71 69 72 70 axi@81000000 { 73 71 compatible = "simple-bus"; 74 72 #address-cells = <1>; 75 73 #size-cells = <1>; 76 - ranges = <0 0x81000000 0x4000>; 74 + ranges = <0 0x81000000 0x8000>; 77 75 78 76 gic: interrupt-controller@1000 { 79 77 compatible = "arm,cortex-a7-gic"; 80 78 #interrupt-cells = <3>; 81 - #address-cells = <0>; 82 79 interrupt-controller; 80 + interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>; 83 81 reg = <0x1000 0x1000>, 84 - <0x2000 0x2000>; 82 + <0x2000 0x2000>, 83 + <0x4000 0x2000>, 84 + <0x6000 0x2000>; 85 85 }; 86 86 }; 87 87
+5 -4
arch/arm/boot/dts/bcm6878.dtsi
··· 32 32 next-level-cache = <&L2_0>; 33 33 enable-method = "psci"; 34 34 }; 35 + 35 36 L2_0: l2-cache0 { 36 37 compatible = "cache"; 37 38 }; ··· 40 39 41 40 timer { 42 41 compatible = "arm,armv7-timer"; 43 - interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 44 - <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 45 - <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, 46 - <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; 42 + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, 43 + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, 44 + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>, 45 + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; 47 46 arm,cpu-registers-not-fw-configured; 48 47 }; 49 48
+1 -11
arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi
··· 51 51 vin-supply = <&reg_3p3v_s5>; 52 52 }; 53 53 54 - reg_3p3v_s0: regulator-3p3v-s0 { 55 - compatible = "regulator-fixed"; 56 - regulator-name = "V_3V3_S0"; 57 - regulator-min-microvolt = <3300000>; 58 - regulator-max-microvolt = <3300000>; 59 - regulator-always-on; 60 - regulator-boot-on; 61 - vin-supply = <&reg_3p3v_s5>; 62 - }; 63 - 64 54 reg_3p3v_s5: regulator-3p3v-s5 { 65 55 compatible = "regulator-fixed"; 66 56 regulator-name = "V_3V3_S5"; ··· 249 259 250 260 /* default boot source: workaround #1 for errata ERR006282 */ 251 261 smarc_flash: flash@0 { 252 - compatible = "winbond,w25q16dw", "jedec,spi-nor"; 262 + compatible = "jedec,spi-nor"; 253 263 reg = <0>; 254 264 spi-max-frequency = <20000000>; 255 265 };
+1 -1
arch/arm/boot/dts/imx6qdl-vicut1.dtsi
··· 28 28 enable-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>; 29 29 }; 30 30 31 - backlight_led: backlight_led { 31 + backlight_led: backlight-led { 32 32 compatible = "pwm-backlight"; 33 33 pwms = <&pwm3 0 5000000 0>; 34 34 brightness-levels = <0 16 64 255>;
+2 -2
arch/arm/boot/dts/integratorap-im-pd1.dts
··· 178 178 clock-names = "uartclk", "apb_pclk"; 179 179 }; 180 180 181 - ssp@300000 { 181 + spi@300000 { 182 182 compatible = "arm,pl022", "arm,primecell"; 183 183 reg = <0x00300000 0x1000>; 184 184 interrupts-extended = <&impd1_vic 3>; 185 185 clocks = <&impd1_sspclk>, <&sysclk>; 186 - clock-names = "spiclk", "apb_pclk"; 186 + clock-names = "sspclk", "apb_pclk"; 187 187 }; 188 188 189 189 impd1_gpio0: gpio@400000 {
+1 -1
arch/arm/boot/dts/versatile-ab.dts
··· 391 391 reg = <0x101f4000 0x1000>; 392 392 interrupts = <11>; 393 393 clocks = <&xtal24mhz>, <&pclk>; 394 - clock-names = "SSPCLK", "apb_pclk"; 394 + clock-names = "sspclk", "apb_pclk"; 395 395 }; 396 396 397 397 fpga {
-1
arch/arm/configs/at91_dt_defconfig
··· 196 196 CONFIG_DMADEVICES=y 197 197 CONFIG_AT_HDMAC=y 198 198 CONFIG_AT_XDMAC=y 199 - CONFIG_MICROCHIP_PIT64B=y 200 199 # CONFIG_IOMMU_SUPPORT is not set 201 200 CONFIG_IIO=y 202 201 CONFIG_AT91_ADC=y
-1
arch/arm/configs/sama7_defconfig
··· 188 188 CONFIG_DMADEVICES=y 189 189 CONFIG_AT_XDMAC=y 190 190 CONFIG_STAGING=y 191 - CONFIG_MICROCHIP_PIT64B=y 192 191 # CONFIG_IOMMU_SUPPORT is not set 193 192 CONFIG_IIO=y 194 193 CONFIG_IIO_SW_TRIGGER=y
+32 -4
arch/arm/mach-at91/pm.c
··· 541 541 542 542 static int at91_suspend_finish(unsigned long val) 543 543 { 544 + unsigned char modified_gray_code[] = { 545 + 0x00, 0x01, 0x02, 0x03, 0x06, 0x07, 0x04, 0x05, 0x0c, 0x0d, 546 + 0x0e, 0x0f, 0x0a, 0x0b, 0x08, 0x09, 0x18, 0x19, 0x1a, 0x1b, 547 + 0x1e, 0x1f, 0x1c, 0x1d, 0x14, 0x15, 0x16, 0x17, 0x12, 0x13, 548 + 0x10, 0x11, 549 + }; 550 + unsigned int tmp, index; 544 551 int i; 545 552 546 553 if (soc_pm.data.mode == AT91_PM_BACKUP && soc_pm.data.ramc_phy) { 554 + /* 555 + * Bootloader will perform DDR recalibration and will try to 556 + * restore the ZQ0SR0 with the value saved here. But the 557 + * calibration is buggy and restoring some values from ZQ0SR0 558 + * is forbidden and risky thus we need to provide processed 559 + * values for these (modified gray code values). 560 + */ 561 + tmp = readl(soc_pm.data.ramc_phy + DDR3PHY_ZQ0SR0); 562 + 563 + /* Store pull-down output impedance select. */ 564 + index = (tmp >> DDR3PHY_ZQ0SR0_PDO_OFF) & 0x1f; 565 + soc_pm.bu->ddr_phy_calibration[0] = modified_gray_code[index]; 566 + 567 + /* Store pull-up output impedance select. */ 568 + index = (tmp >> DDR3PHY_ZQ0SR0_PUO_OFF) & 0x1f; 569 + soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; 570 + 571 + /* Store pull-down on-die termination impedance select. */ 572 + index = (tmp >> DDR3PHY_ZQ0SR0_PDODT_OFF) & 0x1f; 573 + soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; 574 + 575 + /* Store pull-up on-die termination impedance select. */ 576 + index = (tmp >> DDR3PHY_ZQ0SRO_PUODT_OFF) & 0x1f; 577 + soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; 578 + 547 579 /* 548 580 * The 1st 8 words of memory might get corrupted in the process 549 581 * of DDR PHY recalibration; it is saved here in securam and it ··· 1098 1066 of_scan_flat_dt(at91_pm_backup_scan_memcs, &located); 1099 1067 if (!located) 1100 1068 goto securam_fail; 1101 - 1102 - /* DDR3PHY_ZQ0SR0 */ 1103 - soc_pm.bu->ddr_phy_calibration[0] = readl(soc_pm.data.ramc_phy + 1104 - 0x188); 1105 1069 } 1106 1070 1107 1071 return 0;
+17 -7
arch/arm/mach-at91/pm_suspend.S
··· 172 172 /* Put DDR PHY's DLL in bypass mode for non-backup modes. */ 173 173 cmp r7, #AT91_PM_BACKUP 174 174 beq sr_ena_3 175 - ldr tmp1, [r3, #DDR3PHY_PIR] 176 - orr tmp1, tmp1, #DDR3PHY_PIR_DLLBYP 177 - str tmp1, [r3, #DDR3PHY_PIR] 175 + 176 + /* Disable DX DLLs. */ 177 + ldr tmp1, [r3, #DDR3PHY_DX0DLLCR] 178 + orr tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS 179 + str tmp1, [r3, #DDR3PHY_DX0DLLCR] 180 + 181 + ldr tmp1, [r3, #DDR3PHY_DX1DLLCR] 182 + orr tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS 183 + str tmp1, [r3, #DDR3PHY_DX1DLLCR] 178 184 179 185 sr_ena_3: 180 186 /* Power down DDR PHY data receivers. */ ··· 227 221 bic tmp1, tmp1, #DDR3PHY_DSGCR_ODTPDD_ODT0 228 222 str tmp1, [r3, #DDR3PHY_DSGCR] 229 223 230 - /* Take DDR PHY's DLL out of bypass mode. */ 231 - ldr tmp1, [r3, #DDR3PHY_PIR] 232 - bic tmp1, tmp1, #DDR3PHY_PIR_DLLBYP 233 - str tmp1, [r3, #DDR3PHY_PIR] 224 + /* Enable DX DLLs. */ 225 + ldr tmp1, [r3, #DDR3PHY_DX0DLLCR] 226 + bic tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS 227 + str tmp1, [r3, #DDR3PHY_DX0DLLCR] 228 + 229 + ldr tmp1, [r3, #DDR3PHY_DX1DLLCR] 230 + bic tmp1, tmp1, #DDR3PHY_DXDLLCR_DLLDIS 231 + str tmp1, [r3, #DDR3PHY_DX1DLLCR] 234 232 235 233 /* Enable quasi-dynamic programming. */ 236 234 mov tmp1, #0
+1 -1
arch/arm/mach-ixp4xx/ixp4xx-of.c
··· 46 46 } 47 47 48 48 /* 49 - * We handle 4 differen SoC families. These compatible strings are enough 49 + * We handle 4 different SoC families. These compatible strings are enough 50 50 * to provide the core so that different boards can add their more detailed 51 51 * specifics. 52 52 */
+2 -1
arch/arm64/boot/dts/arm/juno-base.dtsi
··· 26 26 compatible = "arm,mhu", "arm,primecell"; 27 27 reg = <0x0 0x2b1f0000 0x0 0x1000>; 28 28 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>, 29 - <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; 29 + <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>, 30 + <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; 30 31 #mbox-cells = <1>; 31 32 clocks = <&soc_refclk100mhz>; 32 33 clock-names = "apb_pclk";
-2
arch/arm64/boot/dts/arm/juno-cs-r1r2.dtsi
··· 67 67 port@0 { 68 68 reg = <0>; 69 69 csys2_funnel_in_port0: endpoint { 70 - slave-mode; 71 70 remote-endpoint = <&etf0_out_port>; 72 71 }; 73 72 }; ··· 74 75 port@1 { 75 76 reg = <1>; 76 77 csys2_funnel_in_port1: endpoint { 77 - slave-mode; 78 78 remote-endpoint = <&etf1_out_port>; 79 79 }; 80 80 };
-1
arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dts
··· 25 25 &enetc_port0 { 26 26 phy-handle = <&slot1_sgmii>; 27 27 phy-mode = "2500base-x"; 28 - managed = "in-band-status"; 29 28 status = "okay"; 30 29 }; 31 30
+4
arch/arm64/boot/dts/freescale/imx8mm-venice-gw7901.dts
··· 626 626 lan1: port@0 { 627 627 reg = <0>; 628 628 label = "lan1"; 629 + phy-mode = "internal"; 629 630 local-mac-address = [00 00 00 00 00 00]; 630 631 }; 631 632 632 633 lan2: port@1 { 633 634 reg = <1>; 634 635 label = "lan2"; 636 + phy-mode = "internal"; 635 637 local-mac-address = [00 00 00 00 00 00]; 636 638 }; 637 639 638 640 lan3: port@2 { 639 641 reg = <2>; 640 642 label = "lan3"; 643 + phy-mode = "internal"; 641 644 local-mac-address = [00 00 00 00 00 00]; 642 645 }; 643 646 644 647 lan4: port@3 { 645 648 reg = <3>; 646 649 label = "lan4"; 650 + phy-mode = "internal"; 647 651 local-mac-address = [00 00 00 00 00 00]; 648 652 }; 649 653
+6 -5
arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
··· 32 32 }; 33 33 34 34 /* Fixed clock dedicated to SPI CAN controller */ 35 - clk20m: oscillator { 35 + clk40m: oscillator { 36 36 compatible = "fixed-clock"; 37 37 #clock-cells = <0>; 38 - clock-frequency = <20000000>; 38 + clock-frequency = <40000000>; 39 39 }; 40 40 41 41 gpio-keys { ··· 202 202 203 203 can1: can@0 { 204 204 compatible = "microchip,mcp251xfd"; 205 - clocks = <&clk20m>; 206 - interrupts-extended = <&gpio1 6 IRQ_TYPE_EDGE_FALLING>; 205 + clocks = <&clk40m>; 206 + interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_LOW>; 207 207 pinctrl-names = "default"; 208 208 pinctrl-0 = <&pinctrl_can1_int>; 209 209 reg = <0>; ··· 603 603 pinctrl-0 = <&pinctrl_gpio_9_dsi>, <&pinctrl_i2s_2_bclk_touch_reset>; 604 604 reg = <0x4a>; 605 605 /* Verdin I2S_2_BCLK (TOUCH_RESET#, SODIMM 42) */ 606 - reset-gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; 606 + reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>; 607 607 status = "disabled"; 608 608 }; 609 609 ··· 745 745 }; 746 746 747 747 &usbphynop2 { 748 + power-domains = <&pgc_otg2>; 748 749 vcc-supply = <&reg_vdd_3v3>; 749 750 }; 750 751
+7 -7
arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi
··· 70 70 &ecspi1 { 71 71 pinctrl-names = "default"; 72 72 pinctrl-0 = <&pinctrl_ecspi1>; 73 - cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>; 73 + cs-gpios = <&gpio5 17 GPIO_ACTIVE_LOW>; 74 74 status = "disabled"; 75 75 }; 76 76 ··· 403 403 pinctrl-names = "default", "gpio"; 404 404 pinctrl-0 = <&pinctrl_i2c5>; 405 405 pinctrl-1 = <&pinctrl_i2c5_gpio>; 406 - scl-gpios = <&gpio5 26 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; 407 - sda-gpios = <&gpio5 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; 406 + scl-gpios = <&gpio3 26 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; 407 + sda-gpios = <&gpio3 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; 408 408 status = "okay"; 409 409 }; 410 410 ··· 648 648 649 649 pinctrl_ecspi1: dhcom-ecspi1-grp { 650 650 fsl,pins = < 651 - MX8MP_IOMUXC_ECSPI1_SCLK__ECSPI1_SCLK 0x44 652 - MX8MP_IOMUXC_ECSPI1_MOSI__ECSPI1_MOSI 0x44 653 - MX8MP_IOMUXC_ECSPI1_MISO__ECSPI1_MISO 0x44 654 - MX8MP_IOMUXC_ECSPI1_SS0__GPIO5_IO09 0x40 651 + MX8MP_IOMUXC_I2C1_SCL__ECSPI1_SCLK 0x44 652 + MX8MP_IOMUXC_I2C1_SDA__ECSPI1_MOSI 0x44 653 + MX8MP_IOMUXC_I2C2_SCL__ECSPI1_MISO 0x44 654 + MX8MP_IOMUXC_I2C2_SDA__GPIO5_IO17 0x40 655 655 >; 656 656 }; 657 657
+4 -4
arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts
··· 770 770 771 771 pinctrl_sai2: sai2grp { 772 772 fsl,pins = < 773 - MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC 774 - MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 775 - MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK 776 - MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK 773 + MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC 0xd6 774 + MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 0xd6 775 + MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK 0xd6 776 + MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK 0xd6 777 777 >; 778 778 }; 779 779
+2 -2
arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi
··· 628 628 interrupts = <5 IRQ_TYPE_EDGE_FALLING>; 629 629 reg = <0x4a>; 630 630 /* Verdin GPIO_2 (SODIMM 208) */ 631 - reset-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; 631 + reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; 632 632 status = "disabled"; 633 633 }; 634 634 }; ··· 705 705 pinctrl-0 = <&pinctrl_gpio_9_dsi>, <&pinctrl_i2s_2_bclk_touch_reset>; 706 706 reg = <0x4a>; 707 707 /* Verdin I2S_2_BCLK (TOUCH_RESET#, SODIMM 42) */ 708 - reset-gpios = <&gpio5 0 GPIO_ACTIVE_HIGH>; 708 + reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; 709 709 status = "disabled"; 710 710 }; 711 711
-1
arch/arm64/boot/dts/freescale/imx8mq-tqma8mq.dtsi
··· 204 204 reg = <0x51>; 205 205 pinctrl-names = "default"; 206 206 pinctrl-0 = <&pinctrl_rtc>; 207 - interrupt-names = "irq"; 208 207 interrupt-parent = <&gpio1>; 209 208 interrupts = <1 IRQ_TYPE_EDGE_FALLING>; 210 209 quartz-load-femtofarads = <7000>;
+1 -1
arch/arm64/boot/dts/renesas/r8a779g0.dtsi
··· 85 85 "renesas,rcar-gen4-hscif", 86 86 "renesas,hscif"; 87 87 reg = <0 0xe6540000 0 96>; 88 - interrupts = <GIC_SPI 245 IRQ_TYPE_LEVEL_HIGH>; 88 + interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>; 89 89 clocks = <&cpg CPG_MOD 514>, 90 90 <&cpg CPG_CORE R8A779G0_CLK_S0D3_PER>, 91 91 <&scif_clk>;
+13 -13
arch/arm64/include/asm/kernel-pgtable.h
··· 64 64 #define EARLY_KASLR (0) 65 65 #endif 66 66 67 - #define EARLY_ENTRIES(vstart, vend, shift) \ 68 - ((((vend) - 1) >> (shift)) - ((vstart) >> (shift)) + 1 + EARLY_KASLR) 67 + #define EARLY_ENTRIES(vstart, vend, shift, add) \ 68 + ((((vend) - 1) >> (shift)) - ((vstart) >> (shift)) + 1 + add) 69 69 70 - #define EARLY_PGDS(vstart, vend) (EARLY_ENTRIES(vstart, vend, PGDIR_SHIFT)) 70 + #define EARLY_PGDS(vstart, vend, add) (EARLY_ENTRIES(vstart, vend, PGDIR_SHIFT, add)) 71 71 72 72 #if SWAPPER_PGTABLE_LEVELS > 3 73 - #define EARLY_PUDS(vstart, vend) (EARLY_ENTRIES(vstart, vend, PUD_SHIFT)) 73 + #define EARLY_PUDS(vstart, vend, add) (EARLY_ENTRIES(vstart, vend, PUD_SHIFT, add)) 74 74 #else 75 - #define EARLY_PUDS(vstart, vend) (0) 75 + #define EARLY_PUDS(vstart, vend, add) (0) 76 76 #endif 77 77 78 78 #if SWAPPER_PGTABLE_LEVELS > 2 79 - #define EARLY_PMDS(vstart, vend) (EARLY_ENTRIES(vstart, vend, SWAPPER_TABLE_SHIFT)) 79 + #define EARLY_PMDS(vstart, vend, add) (EARLY_ENTRIES(vstart, vend, SWAPPER_TABLE_SHIFT, add)) 80 80 #else 81 - #define EARLY_PMDS(vstart, vend) (0) 81 + #define EARLY_PMDS(vstart, vend, add) (0) 82 82 #endif 83 83 84 - #define EARLY_PAGES(vstart, vend) ( 1 /* PGDIR page */ \ 85 - + EARLY_PGDS((vstart), (vend)) /* each PGDIR needs a next level page table */ \ 86 - + EARLY_PUDS((vstart), (vend)) /* each PUD needs a next level page table */ \ 87 - + EARLY_PMDS((vstart), (vend))) /* each PMD needs a next level page table */ 88 - #define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR, _end)) 84 + #define EARLY_PAGES(vstart, vend, add) ( 1 /* PGDIR page */ \ 85 + + EARLY_PGDS((vstart), (vend), add) /* each PGDIR needs a next level page table */ \ 86 + + EARLY_PUDS((vstart), (vend), add) /* each PUD needs a next level page table */ \ 87 + + EARLY_PMDS((vstart), (vend), add)) /* each PMD needs a next level page table */ 88 + #define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR, _end, EARLY_KASLR)) 89 89 90 90 /* the initial ID map may need two extra pages if it needs to be extended */ 91 91 #if VA_BITS < 48 ··· 93 93 #else 94 94 #define INIT_IDMAP_DIR_SIZE (INIT_IDMAP_DIR_PAGES * PAGE_SIZE) 95 95 #endif 96 - #define INIT_IDMAP_DIR_PAGES EARLY_PAGES(KIMAGE_VADDR, _end + MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE) 96 + #define INIT_IDMAP_DIR_PAGES EARLY_PAGES(KIMAGE_VADDR, _end + MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE, 1) 97 97 98 98 /* Initial memory map size */ 99 99 #if ARM64_KERNEL_USES_PMD_MAPS
+2
arch/arm64/kernel/head.S
··· 371 371 SYM_FUNC_START_LOCAL(create_kernel_mapping) 372 372 adrp x0, init_pg_dir 373 373 mov_q x5, KIMAGE_VADDR // compile time __va(_text) 374 + #ifdef CONFIG_RELOCATABLE 374 375 add x5, x5, x23 // add KASLR displacement 376 + #endif 375 377 adrp x6, _end // runtime __pa(_end) 376 378 adrp x3, _text // runtime __pa(_text) 377 379 sub x6, x6, x3 // _end - _text
+1 -1
arch/arm64/kernel/machine_kexec_file.c
··· 47 47 u64 i; 48 48 phys_addr_t start, end; 49 49 50 - nr_ranges = 1; /* for exclusion of crashkernel region */ 50 + nr_ranges = 2; /* for exclusion of crashkernel region */ 51 51 for_each_mem_range(i, &start, &end) 52 52 nr_ranges++; 53 53
+2
arch/loongarch/Kconfig
··· 39 39 select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION 40 40 select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION 41 41 select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION 42 + select ARCH_KEEP_MEMBLOCK 42 43 select ARCH_MIGHT_HAVE_PC_PARPORT 43 44 select ARCH_MIGHT_HAVE_PC_SERIO 44 45 select ARCH_SPARSEMEM_ENABLE ··· 52 51 select ARCH_USE_CMPXCHG_LOCKREF 53 52 select ARCH_USE_QUEUED_RWLOCKS 54 53 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT 54 + select ARCH_WANT_LD_ORPHAN_WARN 55 55 select ARCH_WANTS_NO_INSTR 56 56 select BUILDTIME_TABLE_SORT 57 57 select COMMON_CLK
+1 -1
arch/loongarch/include/asm/acpi.h
··· 15 15 extern int acpi_noirq; 16 16 17 17 #define acpi_os_ioremap acpi_os_ioremap 18 - void __init __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); 18 + void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); 19 19 20 20 static inline void disable_acpi(void) 21 21 {
+1 -1
arch/loongarch/kernel/acpi.c
··· 48 48 early_memunmap(map, size); 49 49 } 50 50 51 - void __init __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) 51 + void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) 52 52 { 53 53 if (!memblock_is_memory(phys)) 54 54 return ioremap(phys, size);
+2 -2
arch/loongarch/kernel/signal.c
··· 529 529 signal_setup_done(ret, ksig, 0); 530 530 } 531 531 532 - void arch_do_signal_or_restart(struct pt_regs *regs, bool has_signal) 532 + void arch_do_signal_or_restart(struct pt_regs *regs) 533 533 { 534 534 struct ksignal ksig; 535 535 536 - if (has_signal && get_signal(&ksig)) { 536 + if (get_signal(&ksig)) { 537 537 /* Whee! Actually deliver the signal. */ 538 538 handle_signal(&ksig, regs); 539 539 return;
+2
arch/loongarch/kernel/vmlinux.lds.S
··· 77 77 PERCPU_SECTION(1 << CONFIG_L1_CACHE_SHIFT) 78 78 #endif 79 79 80 + .rela.dyn : ALIGN(8) { *(.rela.dyn) *(.rela*) } 81 + 80 82 .init.bss : { 81 83 *(.init.bss) 82 84 }
+13 -13
arch/loongarch/lib/dump_tlb.c
··· 18 18 { 19 19 const int field = 2 * sizeof(unsigned long); 20 20 21 - pr_info("Index : %0x\n", read_csr_tlbidx()); 22 - pr_info("PageSize : %0x\n", read_csr_pagesize()); 23 - pr_info("EntryHi : %0*llx\n", field, read_csr_entryhi()); 24 - pr_info("EntryLo0 : %0*llx\n", field, read_csr_entrylo0()); 25 - pr_info("EntryLo1 : %0*llx\n", field, read_csr_entrylo1()); 21 + pr_info("Index : 0x%0x\n", read_csr_tlbidx()); 22 + pr_info("PageSize : 0x%0x\n", read_csr_pagesize()); 23 + pr_info("EntryHi : 0x%0*llx\n", field, read_csr_entryhi()); 24 + pr_info("EntryLo0 : 0x%0*llx\n", field, read_csr_entrylo0()); 25 + pr_info("EntryLo1 : 0x%0*llx\n", field, read_csr_entrylo1()); 26 26 } 27 27 28 28 static void dump_tlb(int first, int last) ··· 33 33 unsigned int s_index, s_asid; 34 34 unsigned int pagesize, c0, c1, i; 35 35 unsigned long asidmask = cpu_asid_mask(&current_cpu_data); 36 - int pwidth = 11; 37 - int vwidth = 11; 36 + int pwidth = 16; 37 + int vwidth = 16; 38 38 int asidwidth = DIV_ROUND_UP(ilog2(asidmask) + 1, 4); 39 39 40 40 s_entryhi = read_csr_entryhi(); ··· 64 64 /* 65 65 * Only print entries in use 66 66 */ 67 - pr_info("Index: %2d pgsize=%x ", i, (1 << pagesize)); 67 + pr_info("Index: %4d pgsize=0x%x ", i, (1 << pagesize)); 68 68 69 69 c0 = (entrylo0 & ENTRYLO_C) >> ENTRYLO_C_SHIFT; 70 70 c1 = (entrylo1 & ENTRYLO_C) >> ENTRYLO_C_SHIFT; 71 71 72 - pr_cont("va=%0*lx asid=%0*lx", 72 + pr_cont("va=0x%0*lx asid=0x%0*lx", 73 73 vwidth, (entryhi & ~0x1fffUL), asidwidth, asid & asidmask); 74 74 75 75 /* NR/NX are in awkward places, so mask them off separately */ 76 76 pa = entrylo0 & ~(ENTRYLO_NR | ENTRYLO_NX); 77 77 pa = pa & PAGE_MASK; 78 78 pr_cont("\n\t["); 79 - pr_cont("ri=%d xi=%d ", 79 + pr_cont("nr=%d nx=%d ", 80 80 (entrylo0 & ENTRYLO_NR) ? 1 : 0, 81 81 (entrylo0 & ENTRYLO_NX) ? 1 : 0); 82 - pr_cont("pa=%0*llx c=%d d=%d v=%d g=%d plv=%lld] [", 82 + pr_cont("pa=0x%0*llx c=%d d=%d v=%d g=%d plv=%lld] [", 83 83 pwidth, pa, c0, 84 84 (entrylo0 & ENTRYLO_D) ? 1 : 0, 85 85 (entrylo0 & ENTRYLO_V) ? 1 : 0, ··· 88 88 /* NR/NX are in awkward places, so mask them off separately */ 89 89 pa = entrylo1 & ~(ENTRYLO_NR | ENTRYLO_NX); 90 90 pa = pa & PAGE_MASK; 91 - pr_cont("ri=%d xi=%d ", 91 + pr_cont("nr=%d nx=%d ", 92 92 (entrylo1 & ENTRYLO_NR) ? 1 : 0, 93 93 (entrylo1 & ENTRYLO_NX) ? 1 : 0); 94 - pr_cont("pa=%0*llx c=%d d=%d v=%d g=%d plv=%lld]\n", 94 + pr_cont("pa=0x%0*llx c=%d d=%d v=%d g=%d plv=%lld]\n", 95 95 pwidth, pa, c1, 96 96 (entrylo1 & ENTRYLO_D) ? 1 : 0, 97 97 (entrylo1 & ENTRYLO_V) ? 1 : 0,
+7 -12
arch/loongarch/mm/init.c
··· 131 131 return ret; 132 132 } 133 133 134 - #ifdef CONFIG_NUMA 135 - int memory_add_physaddr_to_nid(u64 start) 136 - { 137 - int nid; 138 - 139 - nid = pa_to_nid(start); 140 - return nid; 141 - } 142 - EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 143 - #endif 144 - 145 - #ifdef CONFIG_MEMORY_HOTREMOVE 146 134 void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap) 147 135 { 148 136 unsigned long start_pfn = start >> PAGE_SHIFT; ··· 142 154 page += vmem_altmap_offset(altmap); 143 155 __remove_pages(start_pfn, nr_pages, altmap); 144 156 } 157 + 158 + #ifdef CONFIG_NUMA 159 + int memory_add_physaddr_to_nid(u64 start) 160 + { 161 + return pa_to_nid(start); 162 + } 163 + EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 145 164 #endif 146 165 #endif 147 166
+8
arch/powerpc/include/asm/firmware.h
··· 83 83 FW_FEATURE_POWERNV_ALWAYS = 0, 84 84 FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, 85 85 FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, 86 + FW_FEATURE_NATIVE_POSSIBLE = 0, 87 + FW_FEATURE_NATIVE_ALWAYS = 0, 86 88 FW_FEATURE_POSSIBLE = 87 89 #ifdef CONFIG_PPC_PSERIES 88 90 FW_FEATURE_PSERIES_POSSIBLE | ··· 94 92 #endif 95 93 #ifdef CONFIG_PPC_PS3 96 94 FW_FEATURE_PS3_POSSIBLE | 95 + #endif 96 + #ifdef CONFIG_PPC_HASH_MMU_NATIVE 97 + FW_FEATURE_NATIVE_ALWAYS | 97 98 #endif 98 99 0, 99 100 FW_FEATURE_ALWAYS = ··· 108 103 #endif 109 104 #ifdef CONFIG_PPC_PS3 110 105 FW_FEATURE_PS3_ALWAYS & 106 + #endif 107 + #ifdef CONFIG_PPC_HASH_MMU_NATIVE 108 + FW_FEATURE_NATIVE_ALWAYS & 111 109 #endif 112 110 FW_FEATURE_POSSIBLE, 113 111
+38 -8
arch/powerpc/include/asm/hw_irq.h
··· 113 113 114 114 static inline notrace unsigned long irq_soft_mask_return(void) 115 115 { 116 - return READ_ONCE(local_paca->irq_soft_mask); 116 + unsigned long flags; 117 + 118 + asm volatile( 119 + "lbz %0,%1(13)" 120 + : "=r" (flags) 121 + : "i" (offsetof(struct paca_struct, irq_soft_mask))); 122 + 123 + return flags; 117 124 } 118 125 119 126 /* ··· 147 140 if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) 148 141 WARN_ON(mask && !(mask & IRQS_DISABLED)); 149 142 150 - WRITE_ONCE(local_paca->irq_soft_mask, mask); 151 - barrier(); 143 + asm volatile( 144 + "stb %0,%1(13)" 145 + : 146 + : "r" (mask), 147 + "i" (offsetof(struct paca_struct, irq_soft_mask)) 148 + : "memory"); 152 149 } 153 150 154 151 static inline notrace unsigned long irq_soft_mask_set_return(unsigned long mask) 155 152 { 156 - unsigned long flags = irq_soft_mask_return(); 153 + unsigned long flags; 157 154 158 - irq_soft_mask_set(mask); 155 + #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG 156 + WARN_ON(mask && !(mask & IRQS_DISABLED)); 157 + #endif 158 + 159 + asm volatile( 160 + "lbz %0,%1(13); stb %2,%1(13)" 161 + : "=&r" (flags) 162 + : "i" (offsetof(struct paca_struct, irq_soft_mask)), 163 + "r" (mask) 164 + : "memory"); 159 165 160 166 return flags; 161 167 } 162 168 163 169 static inline notrace unsigned long irq_soft_mask_or_return(unsigned long mask) 164 170 { 165 - unsigned long flags = irq_soft_mask_return(); 171 + unsigned long flags, tmp; 166 172 167 - irq_soft_mask_set(flags | mask); 173 + asm volatile( 174 + "lbz %0,%2(13); or %1,%0,%3; stb %1,%2(13)" 175 + : "=&r" (flags), "=r" (tmp) 176 + : "i" (offsetof(struct paca_struct, irq_soft_mask)), 177 + "r" (mask) 178 + : "memory"); 179 + 180 + #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG 181 + WARN_ON((mask | flags) && !((mask | flags) & IRQS_DISABLED)); 182 + #endif 168 183 169 184 return flags; 170 185 } ··· 311 282 flags = irq_soft_mask_set_return(IRQS_ALL_DISABLED); \ 312 283 local_paca->irq_happened |= PACA_IRQ_HARD_DIS; \ 313 284 if (!arch_irqs_disabled_flags(flags)) { \ 314 - WRITE_ONCE(local_paca->saved_r1, current_stack_pointer);\ 285 + asm volatile("std%X0 %1,%0" : "=m" (local_paca->saved_r1) \ 286 + : "r" (current_stack_pointer)); \ 315 287 trace_hardirqs_off(); \ 316 288 } \ 317 289 } while(0)
+9
arch/powerpc/kernel/pci_32.c
··· 245 245 246 246 printk(KERN_INFO "PCI: Probing PCI hardware\n"); 247 247 248 + #ifdef CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT 249 + /* 250 + * Enable PCI domains in /proc when PCI bus numbers are not unique 251 + * across all PCI domains to prevent conflicts. And keep PCI domain 0 252 + * backward compatible in /proc for video cards. 253 + */ 254 + pci_add_flags(PCI_ENABLE_PROC_DOMAINS | PCI_COMPAT_DOMAIN_0); 255 + #endif 256 + 248 257 if (pci_has_flag(PCI_REASSIGN_ALL_BUS)) 249 258 pci_assign_all_buses = 1; 250 259
+4
arch/powerpc/kernel/rtas_entry.S
··· 109 109 * its critical regions (as specified in PAPR+ section 7.2.1). MSR[S] 110 110 * is not impacted by RFI_TO_KERNEL (only urfid can unset it). So if 111 111 * MSR[S] is set, it will remain when entering RTAS. 112 + * If we're in HV mode, RTAS must also run in HV mode, so extract MSR_HV 113 + * from the saved MSR value and insert into the value RTAS will use. 112 114 */ 115 + extrdi r0, r6, 1, 63 - MSR_HV_LG 113 116 LOAD_REG_IMMEDIATE(r6, MSR_ME | MSR_RI) 117 + insrdi r6, r0, 1, 63 - MSR_HV_LG 114 118 115 119 li r0,0 116 120 mtmsrd r0,1 /* disable RI before using SRR0/1 */
+1
arch/powerpc/kernel/systbl.S
··· 18 18 .p2align 3 19 19 #define __SYSCALL(nr, entry) .8byte entry 20 20 #else 21 + .p2align 2 21 22 #define __SYSCALL(nr, entry) .long entry 22 23 #endif 23 24
+29 -61
arch/powerpc/platforms/pseries/papr_scm.c
··· 124 124 125 125 /* The bits which needs to be overridden */ 126 126 u64 health_bitmap_inject_mask; 127 - 128 - /* array to have event_code and stat_id mappings */ 129 - u8 *nvdimm_events_map; 130 127 }; 131 128 132 129 static int papr_scm_pmem_flush(struct nd_region *nd_region, ··· 347 350 #ifdef CONFIG_PERF_EVENTS 348 351 #define to_nvdimm_pmu(_pmu) container_of(_pmu, struct nvdimm_pmu, pmu) 349 352 353 + static const char * const nvdimm_events_map[] = { 354 + [1] = "CtlResCt", 355 + [2] = "CtlResTm", 356 + [3] = "PonSecs ", 357 + [4] = "MemLife ", 358 + [5] = "CritRscU", 359 + [6] = "HostLCnt", 360 + [7] = "HostSCnt", 361 + [8] = "HostSDur", 362 + [9] = "HostLDur", 363 + [10] = "MedRCnt ", 364 + [11] = "MedWCnt ", 365 + [12] = "MedRDur ", 366 + [13] = "MedWDur ", 367 + [14] = "CchRHCnt", 368 + [15] = "CchWHCnt", 369 + [16] = "FastWCnt", 370 + }; 371 + 350 372 static int papr_scm_pmu_get_value(struct perf_event *event, struct device *dev, u64 *count) 351 373 { 352 374 struct papr_scm_perf_stat *stat; ··· 373 357 struct papr_scm_priv *p = dev_get_drvdata(dev); 374 358 int rc, size; 375 359 360 + /* Invalid eventcode */ 361 + if (event->attr.config == 0 || event->attr.config >= ARRAY_SIZE(nvdimm_events_map)) 362 + return -EINVAL; 363 + 376 364 /* Allocate request buffer enough to hold single performance stat */ 377 365 size = sizeof(struct papr_scm_perf_stats) + 378 366 sizeof(struct papr_scm_perf_stat); 379 367 380 - if (!p || !p->nvdimm_events_map) 368 + if (!p) 381 369 return -EINVAL; 382 370 383 371 stats = kzalloc(size, GFP_KERNEL); ··· 390 370 391 371 stat = &stats->scm_statistic[0]; 392 372 memcpy(&stat->stat_id, 393 - &p->nvdimm_events_map[event->attr.config * sizeof(stat->stat_id)], 373 + nvdimm_events_map[event->attr.config], 394 374 sizeof(stat->stat_id)); 395 375 stat->stat_val = 0; 396 376 ··· 478 458 papr_scm_pmu_read(event); 479 459 } 480 460 481 - static int papr_scm_pmu_check_events(struct papr_scm_priv *p, struct nvdimm_pmu *nd_pmu) 482 - { 483 - struct papr_scm_perf_stat *stat; 484 - struct papr_scm_perf_stats *stats; 485 - u32 available_events; 486 - int index, rc = 0; 487 - 488 - if (!p->stat_buffer_len) 489 - return -ENOENT; 490 - 491 - available_events = (p->stat_buffer_len - sizeof(struct papr_scm_perf_stats)) 492 - / sizeof(struct papr_scm_perf_stat); 493 - if (available_events == 0) 494 - return -EOPNOTSUPP; 495 - 496 - /* Allocate the buffer for phyp where stats are written */ 497 - stats = kzalloc(p->stat_buffer_len, GFP_KERNEL); 498 - if (!stats) { 499 - rc = -ENOMEM; 500 - return rc; 501 - } 502 - 503 - /* Called to get list of events supported */ 504 - rc = drc_pmem_query_stats(p, stats, 0); 505 - if (rc) 506 - goto out; 507 - 508 - /* 509 - * Allocate memory and populate nvdimm_event_map. 510 - * Allocate an extra element for NULL entry 511 - */ 512 - p->nvdimm_events_map = kcalloc(available_events + 1, 513 - sizeof(stat->stat_id), 514 - GFP_KERNEL); 515 - if (!p->nvdimm_events_map) { 516 - rc = -ENOMEM; 517 - goto out; 518 - } 519 - 520 - /* Copy all stat_ids to event map */ 521 - for (index = 0, stat = stats->scm_statistic; 522 - index < available_events; index++, ++stat) { 523 - memcpy(&p->nvdimm_events_map[index * sizeof(stat->stat_id)], 524 - &stat->stat_id, sizeof(stat->stat_id)); 525 - } 526 - out: 527 - kfree(stats); 528 - return rc; 529 - } 530 - 531 461 static void papr_scm_pmu_register(struct papr_scm_priv *p) 532 462 { 533 463 struct nvdimm_pmu *nd_pmu; ··· 489 519 goto pmu_err_print; 490 520 } 491 521 492 - rc = papr_scm_pmu_check_events(p, nd_pmu); 493 - if (rc) 522 + if (!p->stat_buffer_len) { 523 + rc = -ENOENT; 494 524 goto pmu_check_events_err; 525 + } 495 526 496 527 nd_pmu->pmu.task_ctx_nr = perf_invalid_context; 497 528 nd_pmu->pmu.name = nvdimm_name(p->nvdimm); ··· 510 539 511 540 rc = register_nvdimm_pmu(nd_pmu, p->pdev); 512 541 if (rc) 513 - goto pmu_register_err; 542 + goto pmu_check_events_err; 514 543 515 544 /* 516 545 * Set archdata.priv value to nvdimm_pmu structure, to handle the ··· 519 548 p->pdev->archdata.priv = nd_pmu; 520 549 return; 521 550 522 - pmu_register_err: 523 - kfree(p->nvdimm_events_map); 524 551 pmu_check_events_err: 525 552 kfree(nd_pmu); 526 553 pmu_err_print: ··· 1529 1560 unregister_nvdimm_pmu(pdev->archdata.priv); 1530 1561 1531 1562 pdev->archdata.priv = NULL; 1532 - kfree(p->nvdimm_events_map); 1533 1563 kfree(p->bus_desc.provider_name); 1534 1564 kfree(p); 1535 1565
+12
arch/riscv/include/asm/kvm_vcpu_sbi.h
··· 33 33 u32 type, u64 flags); 34 34 const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext(unsigned long extid); 35 35 36 + #ifdef CONFIG_RISCV_SBI_V01 37 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_v01; 38 + #endif 39 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_base; 40 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_time; 41 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_ipi; 42 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence; 43 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst; 44 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm; 45 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental; 46 + extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor; 47 + 36 48 #endif /* __RISCV_KVM_VCPU_SBI_H__ */
+1 -11
arch/riscv/kvm/vcpu_sbi.c
··· 32 32 }; 33 33 } 34 34 35 - #ifdef CONFIG_RISCV_SBI_V01 36 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_v01; 37 - #else 35 + #ifndef CONFIG_RISCV_SBI_V01 38 36 static const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_v01 = { 39 37 .extid_start = -1UL, 40 38 .extid_end = -1UL, 41 39 .handler = NULL, 42 40 }; 43 41 #endif 44 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_base; 45 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_time; 46 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_ipi; 47 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence; 48 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst; 49 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm; 50 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental; 51 - extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor; 52 42 53 43 static const struct kvm_vcpu_sbi_extension *sbi_ext[] = { 54 44 &vcpu_sbi_ext_v01,
-4
arch/riscv/kvm/vcpu_timer.c
··· 299 299 300 300 void kvm_riscv_vcpu_timer_restore(struct kvm_vcpu *vcpu) 301 301 { 302 - struct kvm_vcpu_csr *csr; 303 302 struct kvm_vcpu_timer *t = &vcpu->arch.timer; 304 303 305 304 kvm_riscv_vcpu_update_timedelta(vcpu); ··· 306 307 if (!t->sstc_enabled) 307 308 return; 308 309 309 - csr = &vcpu->arch.guest_csr; 310 310 #if defined(CONFIG_32BIT) 311 311 csr_write(CSR_VSTIMECMP, (u32)t->next_cycles); 312 312 csr_write(CSR_VSTIMECMPH, (u32)(t->next_cycles >> 32)); ··· 322 324 323 325 void kvm_riscv_vcpu_timer_save(struct kvm_vcpu *vcpu) 324 326 { 325 - struct kvm_vcpu_csr *csr; 326 327 struct kvm_vcpu_timer *t = &vcpu->arch.timer; 327 328 328 329 if (!t->sstc_enabled) 329 330 return; 330 331 331 - csr = &vcpu->arch.guest_csr; 332 332 t = &vcpu->arch.timer; 333 333 #if defined(CONFIG_32BIT) 334 334 t->next_cycles = csr_read(CSR_VSTIMECMP);
+2 -2
arch/riscv/mm/pageattr.c
··· 118 118 if (!numpages) 119 119 return 0; 120 120 121 - mmap_read_lock(&init_mm); 121 + mmap_write_lock(&init_mm); 122 122 ret = walk_page_range_novma(&init_mm, start, end, &pageattr_ops, NULL, 123 123 &masks); 124 - mmap_read_unlock(&init_mm); 124 + mmap_write_unlock(&init_mm); 125 125 126 126 flush_tlb_kernel_range(start, end); 127 127
+29 -24
arch/s390/configs/debug_defconfig
··· 40 40 CONFIG_SCHED_AUTOGROUP=y 41 41 CONFIG_EXPERT=y 42 42 # CONFIG_SYSFS_SYSCALL is not set 43 - CONFIG_USERFAULTFD=y 44 - # CONFIG_COMPAT_BRK is not set 45 43 CONFIG_PROFILING=y 46 44 CONFIG_LIVEPATCH=y 47 45 CONFIG_MARCH_ZEC12=y ··· 72 74 CONFIG_MODULE_FORCE_LOAD=y 73 75 CONFIG_MODULE_UNLOAD=y 74 76 CONFIG_MODULE_FORCE_UNLOAD=y 77 + CONFIG_MODULE_UNLOAD_TAINT_TRACKING=y 75 78 CONFIG_MODVERSIONS=y 76 79 CONFIG_MODULE_SRCVERSION_ALL=y 77 80 CONFIG_MODULE_SIG_SHA256=y ··· 92 93 CONFIG_IOSCHED_BFQ=y 93 94 CONFIG_BFQ_GROUP_IOSCHED=y 94 95 CONFIG_BINFMT_MISC=m 96 + CONFIG_ZSWAP=y 97 + CONFIG_ZSMALLOC_STAT=y 98 + CONFIG_SLUB_STATS=y 99 + # CONFIG_COMPAT_BRK is not set 95 100 CONFIG_MEMORY_HOTPLUG=y 96 101 CONFIG_MEMORY_HOTREMOVE=y 97 102 CONFIG_KSM=y ··· 105 102 CONFIG_CMA_SYSFS=y 106 103 CONFIG_CMA_AREAS=7 107 104 CONFIG_MEM_SOFT_DIRTY=y 108 - CONFIG_ZSWAP=y 109 - CONFIG_ZSMALLOC=y 110 - CONFIG_ZSMALLOC_STAT=y 111 105 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y 112 106 CONFIG_IDLE_PAGE_TRACKING=y 113 107 CONFIG_PERCPU_STATS=y 114 108 CONFIG_GUP_TEST=y 115 109 CONFIG_ANON_VMA_NAME=y 110 + CONFIG_USERFAULTFD=y 116 111 CONFIG_NET=y 117 112 CONFIG_PACKET=y 118 113 CONFIG_PACKET_DIAG=m ··· 168 167 CONFIG_NETFILTER_NETLINK_HOOK=m 169 168 CONFIG_NF_CONNTRACK=m 170 169 CONFIG_NF_CONNTRACK_SECMARK=y 170 + CONFIG_NF_CONNTRACK_PROCFS=y 171 171 CONFIG_NF_CONNTRACK_EVENTS=y 172 172 CONFIG_NF_CONNTRACK_TIMEOUT=y 173 173 CONFIG_NF_CONNTRACK_TIMESTAMP=y ··· 495 493 # CONFIG_NET_VENDOR_ASIX is not set 496 494 # CONFIG_NET_VENDOR_ATHEROS is not set 497 495 # CONFIG_NET_VENDOR_BROADCOM is not set 498 - # CONFIG_NET_VENDOR_BROCADE is not set 499 496 # CONFIG_NET_VENDOR_CADENCE is not set 500 497 # CONFIG_NET_VENDOR_CAVIUM is not set 501 498 # CONFIG_NET_VENDOR_CHELSIO is not set ··· 510 509 # CONFIG_NET_VENDOR_GOOGLE is not set 511 510 # CONFIG_NET_VENDOR_HUAWEI is not set 512 511 # CONFIG_NET_VENDOR_INTEL is not set 513 - # CONFIG_NET_VENDOR_MICROSOFT is not set 512 + # CONFIG_NET_VENDOR_WANGXUN is not set 514 513 # CONFIG_NET_VENDOR_LITEX is not set 515 514 # CONFIG_NET_VENDOR_MARVELL is not set 516 515 CONFIG_MLX4_EN=m ··· 519 518 # CONFIG_NET_VENDOR_MICREL is not set 520 519 # CONFIG_NET_VENDOR_MICROCHIP is not set 521 520 # CONFIG_NET_VENDOR_MICROSEMI is not set 521 + # CONFIG_NET_VENDOR_MICROSOFT is not set 522 522 # CONFIG_NET_VENDOR_MYRI is not set 523 + # CONFIG_NET_VENDOR_NI is not set 523 524 # CONFIG_NET_VENDOR_NATSEMI is not set 524 525 # CONFIG_NET_VENDOR_NETERION is not set 525 526 # CONFIG_NET_VENDOR_NETRONOME is not set 526 - # CONFIG_NET_VENDOR_NI is not set 527 527 # CONFIG_NET_VENDOR_NVIDIA is not set 528 528 # CONFIG_NET_VENDOR_OKI is not set 529 529 # CONFIG_NET_VENDOR_PACKET_ENGINES is not set 530 530 # CONFIG_NET_VENDOR_PENSANDO is not set 531 531 # CONFIG_NET_VENDOR_QLOGIC is not set 532 + # CONFIG_NET_VENDOR_BROCADE is not set 532 533 # CONFIG_NET_VENDOR_QUALCOMM is not set 533 534 # CONFIG_NET_VENDOR_RDC is not set 534 535 # CONFIG_NET_VENDOR_REALTEK is not set ··· 538 535 # CONFIG_NET_VENDOR_ROCKER is not set 539 536 # CONFIG_NET_VENDOR_SAMSUNG is not set 540 537 # CONFIG_NET_VENDOR_SEEQ is not set 541 - # CONFIG_NET_VENDOR_SOLARFLARE is not set 542 538 # CONFIG_NET_VENDOR_SILAN is not set 543 539 # CONFIG_NET_VENDOR_SIS is not set 540 + # CONFIG_NET_VENDOR_SOLARFLARE is not set 544 541 # CONFIG_NET_VENDOR_SMSC is not set 545 542 # CONFIG_NET_VENDOR_SOCIONEXT is not set 546 543 # CONFIG_NET_VENDOR_STMICRO is not set ··· 573 570 CONFIG_HW_RANDOM_VIRTIO=m 574 571 CONFIG_HANGCHECK_TIMER=m 575 572 CONFIG_TN3270_FS=y 573 + # CONFIG_RANDOM_TRUST_CPU is not set 574 + # CONFIG_RANDOM_TRUST_BOOTLOADER is not set 576 575 CONFIG_PPS=m 577 576 # CONFIG_PTP_1588_CLOCK is not set 578 577 # CONFIG_HWMON is not set ··· 732 727 CONFIG_CRYPTO_PCBC=m 733 728 CONFIG_CRYPTO_KEYWRAP=m 734 729 CONFIG_CRYPTO_ADIANTUM=m 730 + CONFIG_CRYPTO_HCTR2=m 735 731 CONFIG_CRYPTO_XCBC=m 736 732 CONFIG_CRYPTO_VMAC=m 737 733 CONFIG_CRYPTO_CRC32=m 738 - CONFIG_CRYPTO_BLAKE2S=m 734 + CONFIG_CRYPTO_CRC32_S390=y 739 735 CONFIG_CRYPTO_MD4=m 740 736 CONFIG_CRYPTO_MD5=y 741 737 CONFIG_CRYPTO_MICHAEL_MIC=m 742 738 CONFIG_CRYPTO_RMD160=m 739 + CONFIG_CRYPTO_SHA512_S390=m 740 + CONFIG_CRYPTO_SHA1_S390=m 741 + CONFIG_CRYPTO_SHA256_S390=m 743 742 CONFIG_CRYPTO_SHA3=m 744 - CONFIG_CRYPTO_SM3=m 743 + CONFIG_CRYPTO_SHA3_256_S390=m 744 + CONFIG_CRYPTO_SHA3_512_S390=m 745 + CONFIG_CRYPTO_SM3_GENERIC=m 745 746 CONFIG_CRYPTO_WP512=m 747 + CONFIG_CRYPTO_GHASH_S390=m 746 748 CONFIG_CRYPTO_AES_TI=m 749 + CONFIG_CRYPTO_AES_S390=m 747 750 CONFIG_CRYPTO_ANUBIS=m 748 751 CONFIG_CRYPTO_ARC4=m 749 752 CONFIG_CRYPTO_BLOWFISH=m ··· 759 746 CONFIG_CRYPTO_CAST5=m 760 747 CONFIG_CRYPTO_CAST6=m 761 748 CONFIG_CRYPTO_DES=m 749 + CONFIG_CRYPTO_DES_S390=m 762 750 CONFIG_CRYPTO_FCRYPT=m 763 751 CONFIG_CRYPTO_KHAZAD=m 752 + CONFIG_CRYPTO_CHACHA_S390=m 764 753 CONFIG_CRYPTO_SEED=m 754 + CONFIG_CRYPTO_ARIA=m 765 755 CONFIG_CRYPTO_SERPENT=m 766 - CONFIG_CRYPTO_SM4=m 756 + CONFIG_CRYPTO_SM4_GENERIC=m 767 757 CONFIG_CRYPTO_TEA=m 768 758 CONFIG_CRYPTO_TWOFISH=m 769 759 CONFIG_CRYPTO_842=m ··· 782 766 CONFIG_ZCRYPT=m 783 767 CONFIG_PKEY=m 784 768 CONFIG_CRYPTO_PAES_S390=m 785 - CONFIG_CRYPTO_SHA1_S390=m 786 - CONFIG_CRYPTO_SHA256_S390=m 787 - CONFIG_CRYPTO_SHA512_S390=m 788 - CONFIG_CRYPTO_SHA3_256_S390=m 789 - CONFIG_CRYPTO_SHA3_512_S390=m 790 - CONFIG_CRYPTO_DES_S390=m 791 - CONFIG_CRYPTO_AES_S390=m 792 - CONFIG_CRYPTO_CHACHA_S390=m 793 - CONFIG_CRYPTO_GHASH_S390=m 794 - CONFIG_CRYPTO_CRC32_S390=y 795 769 CONFIG_CRYPTO_DEV_VIRTIO=m 796 770 CONFIG_CORDIC=m 797 771 CONFIG_CRYPTO_LIB_CURVE25519=m ··· 803 797 CONFIG_DEBUG_SECTION_MISMATCH=y 804 798 CONFIG_MAGIC_SYSRQ=y 805 799 CONFIG_DEBUG_PAGEALLOC=y 800 + CONFIG_SLUB_DEBUG_ON=y 806 801 CONFIG_PAGE_OWNER=y 807 802 CONFIG_DEBUG_RODATA_TEST=y 808 803 CONFIG_DEBUG_WX=y ··· 815 808 CONFIG_DEBUG_OBJECTS_WORK=y 816 809 CONFIG_DEBUG_OBJECTS_RCU_HEAD=y 817 810 CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y 818 - CONFIG_SLUB_DEBUG_ON=y 819 - CONFIG_SLUB_STATS=y 820 811 CONFIG_DEBUG_STACK_USAGE=y 821 812 CONFIG_DEBUG_VM=y 822 813 CONFIG_DEBUG_VM_PGFLAGS=y
+27 -22
arch/s390/configs/defconfig
··· 38 38 CONFIG_SCHED_AUTOGROUP=y 39 39 CONFIG_EXPERT=y 40 40 # CONFIG_SYSFS_SYSCALL is not set 41 - CONFIG_USERFAULTFD=y 42 - # CONFIG_COMPAT_BRK is not set 43 41 CONFIG_PROFILING=y 44 42 CONFIG_LIVEPATCH=y 45 43 CONFIG_MARCH_ZEC12=y ··· 67 69 CONFIG_MODULE_FORCE_LOAD=y 68 70 CONFIG_MODULE_UNLOAD=y 69 71 CONFIG_MODULE_FORCE_UNLOAD=y 72 + CONFIG_MODULE_UNLOAD_TAINT_TRACKING=y 70 73 CONFIG_MODVERSIONS=y 71 74 CONFIG_MODULE_SRCVERSION_ALL=y 72 75 CONFIG_MODULE_SIG_SHA256=y ··· 87 88 CONFIG_IOSCHED_BFQ=y 88 89 CONFIG_BFQ_GROUP_IOSCHED=y 89 90 CONFIG_BINFMT_MISC=m 91 + CONFIG_ZSWAP=y 92 + CONFIG_ZSMALLOC_STAT=y 93 + # CONFIG_COMPAT_BRK is not set 90 94 CONFIG_MEMORY_HOTPLUG=y 91 95 CONFIG_MEMORY_HOTREMOVE=y 92 96 CONFIG_KSM=y ··· 97 95 CONFIG_CMA_SYSFS=y 98 96 CONFIG_CMA_AREAS=7 99 97 CONFIG_MEM_SOFT_DIRTY=y 100 - CONFIG_ZSWAP=y 101 - CONFIG_ZSMALLOC=y 102 - CONFIG_ZSMALLOC_STAT=y 103 98 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y 104 99 CONFIG_IDLE_PAGE_TRACKING=y 105 100 CONFIG_PERCPU_STATS=y 106 101 CONFIG_ANON_VMA_NAME=y 102 + CONFIG_USERFAULTFD=y 107 103 CONFIG_NET=y 108 104 CONFIG_PACKET=y 109 105 CONFIG_PACKET_DIAG=m ··· 159 159 CONFIG_NETFILTER_NETLINK_HOOK=m 160 160 CONFIG_NF_CONNTRACK=m 161 161 CONFIG_NF_CONNTRACK_SECMARK=y 162 + CONFIG_NF_CONNTRACK_PROCFS=y 162 163 CONFIG_NF_CONNTRACK_EVENTS=y 163 164 CONFIG_NF_CONNTRACK_TIMEOUT=y 164 165 CONFIG_NF_CONNTRACK_TIMESTAMP=y ··· 485 484 # CONFIG_NET_VENDOR_ASIX is not set 486 485 # CONFIG_NET_VENDOR_ATHEROS is not set 487 486 # CONFIG_NET_VENDOR_BROADCOM is not set 488 - # CONFIG_NET_VENDOR_BROCADE is not set 489 487 # CONFIG_NET_VENDOR_CADENCE is not set 490 488 # CONFIG_NET_VENDOR_CAVIUM is not set 491 489 # CONFIG_NET_VENDOR_CHELSIO is not set ··· 500 500 # CONFIG_NET_VENDOR_GOOGLE is not set 501 501 # CONFIG_NET_VENDOR_HUAWEI is not set 502 502 # CONFIG_NET_VENDOR_INTEL is not set 503 - # CONFIG_NET_VENDOR_MICROSOFT is not set 503 + # CONFIG_NET_VENDOR_WANGXUN is not set 504 504 # CONFIG_NET_VENDOR_LITEX is not set 505 505 # CONFIG_NET_VENDOR_MARVELL is not set 506 506 CONFIG_MLX4_EN=m ··· 509 509 # CONFIG_NET_VENDOR_MICREL is not set 510 510 # CONFIG_NET_VENDOR_MICROCHIP is not set 511 511 # CONFIG_NET_VENDOR_MICROSEMI is not set 512 + # CONFIG_NET_VENDOR_MICROSOFT is not set 512 513 # CONFIG_NET_VENDOR_MYRI is not set 514 + # CONFIG_NET_VENDOR_NI is not set 513 515 # CONFIG_NET_VENDOR_NATSEMI is not set 514 516 # CONFIG_NET_VENDOR_NETERION is not set 515 517 # CONFIG_NET_VENDOR_NETRONOME is not set 516 - # CONFIG_NET_VENDOR_NI is not set 517 518 # CONFIG_NET_VENDOR_NVIDIA is not set 518 519 # CONFIG_NET_VENDOR_OKI is not set 519 520 # CONFIG_NET_VENDOR_PACKET_ENGINES is not set 520 521 # CONFIG_NET_VENDOR_PENSANDO is not set 521 522 # CONFIG_NET_VENDOR_QLOGIC is not set 523 + # CONFIG_NET_VENDOR_BROCADE is not set 522 524 # CONFIG_NET_VENDOR_QUALCOMM is not set 523 525 # CONFIG_NET_VENDOR_RDC is not set 524 526 # CONFIG_NET_VENDOR_REALTEK is not set ··· 528 526 # CONFIG_NET_VENDOR_ROCKER is not set 529 527 # CONFIG_NET_VENDOR_SAMSUNG is not set 530 528 # CONFIG_NET_VENDOR_SEEQ is not set 531 - # CONFIG_NET_VENDOR_SOLARFLARE is not set 532 529 # CONFIG_NET_VENDOR_SILAN is not set 533 530 # CONFIG_NET_VENDOR_SIS is not set 531 + # CONFIG_NET_VENDOR_SOLARFLARE is not set 534 532 # CONFIG_NET_VENDOR_SMSC is not set 535 533 # CONFIG_NET_VENDOR_SOCIONEXT is not set 536 534 # CONFIG_NET_VENDOR_STMICRO is not set ··· 563 561 CONFIG_HW_RANDOM_VIRTIO=m 564 562 CONFIG_HANGCHECK_TIMER=m 565 563 CONFIG_TN3270_FS=y 564 + # CONFIG_RANDOM_TRUST_CPU is not set 565 + # CONFIG_RANDOM_TRUST_BOOTLOADER is not set 566 566 # CONFIG_PTP_1588_CLOCK is not set 567 567 # CONFIG_HWMON is not set 568 568 CONFIG_WATCHDOG=y ··· 717 713 CONFIG_CRYPTO_PCBC=m 718 714 CONFIG_CRYPTO_KEYWRAP=m 719 715 CONFIG_CRYPTO_ADIANTUM=m 716 + CONFIG_CRYPTO_HCTR2=m 720 717 CONFIG_CRYPTO_XCBC=m 721 718 CONFIG_CRYPTO_VMAC=m 722 719 CONFIG_CRYPTO_CRC32=m 723 - CONFIG_CRYPTO_BLAKE2S=m 720 + CONFIG_CRYPTO_CRC32_S390=y 724 721 CONFIG_CRYPTO_MD4=m 725 722 CONFIG_CRYPTO_MD5=y 726 723 CONFIG_CRYPTO_MICHAEL_MIC=m 727 724 CONFIG_CRYPTO_RMD160=m 725 + CONFIG_CRYPTO_SHA512_S390=m 726 + CONFIG_CRYPTO_SHA1_S390=m 727 + CONFIG_CRYPTO_SHA256_S390=m 728 728 CONFIG_CRYPTO_SHA3=m 729 - CONFIG_CRYPTO_SM3=m 729 + CONFIG_CRYPTO_SHA3_256_S390=m 730 + CONFIG_CRYPTO_SHA3_512_S390=m 731 + CONFIG_CRYPTO_SM3_GENERIC=m 730 732 CONFIG_CRYPTO_WP512=m 733 + CONFIG_CRYPTO_GHASH_S390=m 731 734 CONFIG_CRYPTO_AES_TI=m 735 + CONFIG_CRYPTO_AES_S390=m 732 736 CONFIG_CRYPTO_ANUBIS=m 733 737 CONFIG_CRYPTO_ARC4=m 734 738 CONFIG_CRYPTO_BLOWFISH=m ··· 744 732 CONFIG_CRYPTO_CAST5=m 745 733 CONFIG_CRYPTO_CAST6=m 746 734 CONFIG_CRYPTO_DES=m 735 + CONFIG_CRYPTO_DES_S390=m 747 736 CONFIG_CRYPTO_FCRYPT=m 748 737 CONFIG_CRYPTO_KHAZAD=m 738 + CONFIG_CRYPTO_CHACHA_S390=m 749 739 CONFIG_CRYPTO_SEED=m 740 + CONFIG_CRYPTO_ARIA=m 750 741 CONFIG_CRYPTO_SERPENT=m 751 - CONFIG_CRYPTO_SM4=m 742 + CONFIG_CRYPTO_SM4_GENERIC=m 752 743 CONFIG_CRYPTO_TEA=m 753 744 CONFIG_CRYPTO_TWOFISH=m 754 745 CONFIG_CRYPTO_842=m ··· 767 752 CONFIG_ZCRYPT=m 768 753 CONFIG_PKEY=m 769 754 CONFIG_CRYPTO_PAES_S390=m 770 - CONFIG_CRYPTO_SHA1_S390=m 771 - CONFIG_CRYPTO_SHA256_S390=m 772 - CONFIG_CRYPTO_SHA512_S390=m 773 - CONFIG_CRYPTO_SHA3_256_S390=m 774 - CONFIG_CRYPTO_SHA3_512_S390=m 775 - CONFIG_CRYPTO_DES_S390=m 776 - CONFIG_CRYPTO_AES_S390=m 777 - CONFIG_CRYPTO_CHACHA_S390=m 778 - CONFIG_CRYPTO_GHASH_S390=m 779 - CONFIG_CRYPTO_CRC32_S390=y 780 755 CONFIG_CRYPTO_DEV_VIRTIO=m 781 756 CONFIG_CORDIC=m 782 757 CONFIG_PRIME_NUMBERS=m
+4 -2
arch/s390/configs/zfcpdump_defconfig
··· 1 - # CONFIG_SWAP is not set 2 1 CONFIG_NO_HZ_IDLE=y 3 2 CONFIG_HIGH_RES_TIMERS=y 4 3 CONFIG_BPF_SYSCALL=y ··· 8 9 # CONFIG_NET_NS is not set 9 10 CONFIG_BLK_DEV_INITRD=y 10 11 CONFIG_CC_OPTIMIZE_FOR_SIZE=y 11 - # CONFIG_COMPAT_BRK is not set 12 12 CONFIG_MARCH_ZEC12=y 13 13 CONFIG_TUNE_ZEC12=y 14 14 # CONFIG_COMPAT is not set ··· 26 28 # CONFIG_BLOCK_LEGACY_AUTOLOAD is not set 27 29 CONFIG_PARTITION_ADVANCED=y 28 30 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 31 + # CONFIG_SWAP is not set 32 + # CONFIG_COMPAT_BRK is not set 29 33 # CONFIG_COMPACTION is not set 30 34 # CONFIG_MIGRATION is not set 31 35 CONFIG_NET=y ··· 53 53 # CONFIG_HVC_IUCV is not set 54 54 # CONFIG_HW_RANDOM_S390 is not set 55 55 # CONFIG_HMC_DRV is not set 56 + # CONFIG_S390_UV_UAPI is not set 56 57 # CONFIG_S390_TAPE is not set 57 58 # CONFIG_VMCP is not set 58 59 # CONFIG_MONWRITER is not set 59 60 # CONFIG_S390_VMUR is not set 61 + # CONFIG_RANDOM_TRUST_BOOTLOADER is not set 60 62 # CONFIG_HID is not set 61 63 # CONFIG_VIRTIO_MENU is not set 62 64 # CONFIG_VHOST_MENU is not set
+4 -2
arch/s390/include/asm/hugetlb.h
··· 28 28 static inline int prepare_hugepage_range(struct file *file, 29 29 unsigned long addr, unsigned long len) 30 30 { 31 - if (len & ~HPAGE_MASK) 31 + struct hstate *h = hstate_file(file); 32 + 33 + if (len & ~huge_page_mask(h)) 32 34 return -EINVAL; 33 - if (addr & ~HPAGE_MASK) 35 + if (addr & ~huge_page_mask(h)) 34 36 return -EINVAL; 35 37 return 0; 36 38 }
+6 -11
arch/s390/include/asm/kvm_host.h
··· 1038 1038 #define __KVM_HAVE_ARCH_VM_FREE 1039 1039 void kvm_arch_free_vm(struct kvm *kvm); 1040 1040 1041 - #ifdef CONFIG_VFIO_PCI_ZDEV_KVM 1042 - int kvm_s390_pci_register_kvm(struct zpci_dev *zdev, struct kvm *kvm); 1043 - void kvm_s390_pci_unregister_kvm(struct zpci_dev *zdev); 1044 - #else 1045 - static inline int kvm_s390_pci_register_kvm(struct zpci_dev *dev, 1046 - struct kvm *kvm) 1047 - { 1048 - return -EPERM; 1049 - } 1050 - static inline void kvm_s390_pci_unregister_kvm(struct zpci_dev *dev) {} 1051 - #endif 1041 + struct zpci_kvm_hook { 1042 + int (*kvm_register)(void *opaque, struct kvm *kvm); 1043 + void (*kvm_unregister)(void *opaque); 1044 + }; 1045 + 1046 + extern struct zpci_kvm_hook zpci_kvm_hook; 1052 1047 1053 1048 #endif
+1
arch/s390/kernel/vmlinux.lds.S
··· 131 131 /* 132 132 * Table with the patch locations to undo expolines 133 133 */ 134 + . = ALIGN(4); 134 135 .nospec_call_table : { 135 136 __nospec_call_start = . ; 136 137 *(.s390_indirect*)
+8 -4
arch/s390/kvm/pci.c
··· 431 431 * available, enable them and let userspace indicate whether or not they will 432 432 * be used (specify SHM bit to disable). 433 433 */ 434 - int kvm_s390_pci_register_kvm(struct zpci_dev *zdev, struct kvm *kvm) 434 + static int kvm_s390_pci_register_kvm(void *opaque, struct kvm *kvm) 435 435 { 436 + struct zpci_dev *zdev = opaque; 436 437 int rc; 437 438 438 439 if (!zdev) ··· 511 510 kvm_put_kvm(kvm); 512 511 return rc; 513 512 } 514 - EXPORT_SYMBOL_GPL(kvm_s390_pci_register_kvm); 515 513 516 - void kvm_s390_pci_unregister_kvm(struct zpci_dev *zdev) 514 + static void kvm_s390_pci_unregister_kvm(void *opaque) 517 515 { 516 + struct zpci_dev *zdev = opaque; 518 517 struct kvm *kvm; 519 518 520 519 if (!zdev) ··· 567 566 568 567 kvm_put_kvm(kvm); 569 568 } 570 - EXPORT_SYMBOL_GPL(kvm_s390_pci_unregister_kvm); 571 569 572 570 void kvm_s390_pci_init_list(struct kvm *kvm) 573 571 { ··· 678 678 679 679 spin_lock_init(&aift->gait_lock); 680 680 mutex_init(&aift->aift_lock); 681 + zpci_kvm_hook.kvm_register = kvm_s390_pci_register_kvm; 682 + zpci_kvm_hook.kvm_unregister = kvm_s390_pci_unregister_kvm; 681 683 682 684 return 0; 683 685 } ··· 687 685 void kvm_s390_pci_exit(void) 688 686 { 689 687 mutex_destroy(&aift->aift_lock); 688 + zpci_kvm_hook.kvm_register = NULL; 689 + zpci_kvm_hook.kvm_unregister = NULL; 690 690 691 691 kfree(aift); 692 692 }
-2
arch/s390/mm/fault.c
··· 421 421 if (unlikely(!(vma->vm_flags & access))) 422 422 goto out_up; 423 423 424 - if (is_vm_hugetlb_page(vma)) 425 - address &= HPAGE_MASK; 426 424 /* 427 425 * If for any reason at all we couldn't handle the fault, 428 426 * make sure we exit gracefully rather than endlessly redo
+1 -1
arch/s390/pci/Makefile
··· 5 5 6 6 obj-$(CONFIG_PCI) += pci.o pci_irq.o pci_dma.o pci_clp.o pci_sysfs.o \ 7 7 pci_event.o pci_debug.o pci_insn.o pci_mmio.o \ 8 - pci_bus.o 8 + pci_bus.o pci_kvm_hook.o 9 9 obj-$(CONFIG_PCI_IOV) += pci_iov.o
+11
arch/s390/pci/pci_kvm_hook.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * VFIO ZPCI devices support 4 + * 5 + * Copyright (C) IBM Corp. 2022. All rights reserved. 6 + * Author(s): Pierre Morel <pmorel@linux.ibm.com> 7 + */ 8 + #include <linux/kvm_host.h> 9 + 10 + struct zpci_kvm_hook zpci_kvm_hook; 11 + EXPORT_SYMBOL_GPL(zpci_kvm_hook);
+2 -1
arch/x86/events/intel/core.c
··· 4052 4052 /* Disable guest PEBS if host PEBS is enabled. */ 4053 4053 arr[pebs_enable].guest = 0; 4054 4054 } else { 4055 - /* Disable guest PEBS for cross-mapped PEBS counters. */ 4055 + /* Disable guest PEBS thoroughly for cross-mapped PEBS counters. */ 4056 4056 arr[pebs_enable].guest &= ~kvm_pmu->host_cross_mapped_mask; 4057 + arr[global_ctrl].guest &= ~kvm_pmu->host_cross_mapped_mask; 4057 4058 /* Set hw GLOBAL_CTRL bits for PEBS counter when it runs for guest */ 4058 4059 arr[global_ctrl].guest |= arr[pebs_enable].guest; 4059 4060 }
+8 -52
arch/x86/kvm/mmu/mmu.c
··· 5361 5361 __kvm_mmu_free_obsolete_roots(vcpu->kvm, &vcpu->arch.guest_mmu); 5362 5362 } 5363 5363 5364 - static bool need_remote_flush(u64 old, u64 new) 5365 - { 5366 - if (!is_shadow_present_pte(old)) 5367 - return false; 5368 - if (!is_shadow_present_pte(new)) 5369 - return true; 5370 - if ((old ^ new) & SPTE_BASE_ADDR_MASK) 5371 - return true; 5372 - old ^= shadow_nx_mask; 5373 - new ^= shadow_nx_mask; 5374 - return (old & ~new & SPTE_PERM_MASK) != 0; 5375 - } 5376 - 5377 5364 static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa, 5378 5365 int *bytes) 5379 5366 { ··· 5506 5519 mmu_page_zap_pte(vcpu->kvm, sp, spte, NULL); 5507 5520 if (gentry && sp->role.level != PG_LEVEL_4K) 5508 5521 ++vcpu->kvm->stat.mmu_pde_zapped; 5509 - if (need_remote_flush(entry, *spte)) 5522 + if (is_shadow_present_pte(entry)) 5510 5523 flush = true; 5511 5524 ++spte; 5512 5525 } ··· 6072 6085 const struct kvm_memory_slot *memslot, 6073 6086 int start_level) 6074 6087 { 6075 - bool flush = false; 6076 - 6077 6088 if (kvm_memslots_have_rmaps(kvm)) { 6078 6089 write_lock(&kvm->mmu_lock); 6079 - flush = slot_handle_level(kvm, memslot, slot_rmap_write_protect, 6080 - start_level, KVM_MAX_HUGEPAGE_LEVEL, 6081 - false); 6090 + slot_handle_level(kvm, memslot, slot_rmap_write_protect, 6091 + start_level, KVM_MAX_HUGEPAGE_LEVEL, false); 6082 6092 write_unlock(&kvm->mmu_lock); 6083 6093 } 6084 6094 6085 6095 if (is_tdp_mmu_enabled(kvm)) { 6086 6096 read_lock(&kvm->mmu_lock); 6087 - flush |= kvm_tdp_mmu_wrprot_slot(kvm, memslot, start_level); 6097 + kvm_tdp_mmu_wrprot_slot(kvm, memslot, start_level); 6088 6098 read_unlock(&kvm->mmu_lock); 6089 6099 } 6090 - 6091 - /* 6092 - * Flush TLBs if any SPTEs had to be write-protected to ensure that 6093 - * guest writes are reflected in the dirty bitmap before the memslot 6094 - * update completes, i.e. before enabling dirty logging is visible to 6095 - * userspace. 6096 - * 6097 - * Perform the TLB flush outside the mmu_lock to reduce the amount of 6098 - * time the lock is held. However, this does mean that another CPU can 6099 - * now grab mmu_lock and encounter a write-protected SPTE while CPUs 6100 - * still have a writable mapping for the associated GFN in their TLB. 6101 - * 6102 - * This is safe but requires KVM to be careful when making decisions 6103 - * based on the write-protection status of an SPTE. Specifically, KVM 6104 - * also write-protects SPTEs to monitor changes to guest page tables 6105 - * during shadow paging, and must guarantee no CPUs can write to those 6106 - * page before the lock is dropped. As mentioned in the previous 6107 - * paragraph, a write-protected SPTE is no guarantee that CPU cannot 6108 - * perform writes. So to determine if a TLB flush is truly required, KVM 6109 - * will clear a separate software-only bit (MMU-writable) and skip the 6110 - * flush if-and-only-if this bit was already clear. 6111 - * 6112 - * See is_writable_pte() for more details. 6113 - */ 6114 - if (flush) 6115 - kvm_arch_flush_remote_tlbs_memslot(kvm, memslot); 6116 6100 } 6117 6101 6118 6102 static inline bool need_topup(struct kvm_mmu_memory_cache *cache, int min) ··· 6451 6493 void kvm_mmu_slot_leaf_clear_dirty(struct kvm *kvm, 6452 6494 const struct kvm_memory_slot *memslot) 6453 6495 { 6454 - bool flush = false; 6455 - 6456 6496 if (kvm_memslots_have_rmaps(kvm)) { 6457 6497 write_lock(&kvm->mmu_lock); 6458 6498 /* 6459 6499 * Clear dirty bits only on 4k SPTEs since the legacy MMU only 6460 6500 * support dirty logging at a 4k granularity. 6461 6501 */ 6462 - flush = slot_handle_level_4k(kvm, memslot, __rmap_clear_dirty, false); 6502 + slot_handle_level_4k(kvm, memslot, __rmap_clear_dirty, false); 6463 6503 write_unlock(&kvm->mmu_lock); 6464 6504 } 6465 6505 6466 6506 if (is_tdp_mmu_enabled(kvm)) { 6467 6507 read_lock(&kvm->mmu_lock); 6468 - flush |= kvm_tdp_mmu_clear_dirty_slot(kvm, memslot); 6508 + kvm_tdp_mmu_clear_dirty_slot(kvm, memslot); 6469 6509 read_unlock(&kvm->mmu_lock); 6470 6510 } 6471 6511 6472 6512 /* 6513 + * The caller will flush the TLBs after this function returns. 6514 + * 6473 6515 * It's also safe to flush TLBs out of mmu lock here as currently this 6474 6516 * function is only used for dirty logging, in which case flushing TLB 6475 6517 * out of mmu lock also guarantees no dirty pages will be lost in 6476 6518 * dirty_bitmap. 6477 6519 */ 6478 - if (flush) 6479 - kvm_arch_flush_remote_tlbs_memslot(kvm, memslot); 6480 6520 } 6481 6521 6482 6522 void kvm_mmu_zap_all(struct kvm *kvm)
+10 -4
arch/x86/kvm/mmu/spte.h
··· 343 343 } 344 344 345 345 /* 346 - * An shadow-present leaf SPTE may be non-writable for 3 possible reasons: 346 + * A shadow-present leaf SPTE may be non-writable for 4 possible reasons: 347 347 * 348 348 * 1. To intercept writes for dirty logging. KVM write-protects huge pages 349 349 * so that they can be split be split down into the dirty logging ··· 361 361 * read-only memslot or guest memory backed by a read-only VMA. Writes to 362 362 * such pages are disallowed entirely. 363 363 * 364 - * To keep track of why a given SPTE is write-protected, KVM uses 2 365 - * software-only bits in the SPTE: 364 + * 4. To emulate the Accessed bit for SPTEs without A/D bits. Note, in this 365 + * case, the SPTE is access-protected, not just write-protected! 366 + * 367 + * For cases #1 and #4, KVM can safely make such SPTEs writable without taking 368 + * mmu_lock as capturing the Accessed/Dirty state doesn't require taking it. 369 + * To differentiate #1 and #4 from #2 and #3, KVM uses two software-only bits 370 + * in the SPTE: 366 371 * 367 372 * shadow_mmu_writable_mask, aka MMU-writable - 368 373 * Cleared on SPTEs that KVM is currently write-protecting for shadow paging ··· 396 391 * shadow page tables between vCPUs. Write-protecting an SPTE for dirty logging 397 392 * (which does not clear the MMU-writable bit), does not flush TLBs before 398 393 * dropping the lock, as it only needs to synchronize guest writes with the 399 - * dirty bitmap. 394 + * dirty bitmap. Similarly, making the SPTE inaccessible (and non-writable) for 395 + * access-tracking via the clear_young() MMU notifier also does not flush TLBs. 400 396 * 401 397 * So, there is the problem: clearing the MMU-writable bit can encounter a 402 398 * write-protected SPTE while CPUs still have writable mappings for that SPTE
+1 -2
arch/x86/kvm/vmx/vmx.c
··· 843 843 if (!(exec_controls_get(vmx) & CPU_BASED_USE_MSR_BITMAPS)) 844 844 return true; 845 845 846 - return vmx_test_msr_bitmap_write(vmx->loaded_vmcs->msr_bitmap, 847 - MSR_IA32_SPEC_CTRL); 846 + return vmx_test_msr_bitmap_write(vmx->loaded_vmcs->msr_bitmap, msr); 848 847 } 849 848 850 849 unsigned int __vmx_vcpu_run_flags(struct vcpu_vmx *vmx)
+83 -9
arch/x86/kvm/x86.c
··· 1557 1557 static u32 msr_based_features[ARRAY_SIZE(msr_based_features_all)]; 1558 1558 static unsigned int num_msr_based_features; 1559 1559 1560 + /* 1561 + * Some IA32_ARCH_CAPABILITIES bits have dependencies on MSRs that KVM 1562 + * does not yet virtualize. These include: 1563 + * 10 - MISC_PACKAGE_CTRLS 1564 + * 11 - ENERGY_FILTERING_CTL 1565 + * 12 - DOITM 1566 + * 18 - FB_CLEAR_CTRL 1567 + * 21 - XAPIC_DISABLE_STATUS 1568 + * 23 - OVERCLOCKING_STATUS 1569 + */ 1570 + 1571 + #define KVM_SUPPORTED_ARCH_CAP \ 1572 + (ARCH_CAP_RDCL_NO | ARCH_CAP_IBRS_ALL | ARCH_CAP_RSBA | \ 1573 + ARCH_CAP_SKIP_VMENTRY_L1DFLUSH | ARCH_CAP_SSB_NO | ARCH_CAP_MDS_NO | \ 1574 + ARCH_CAP_PSCHANGE_MC_NO | ARCH_CAP_TSX_CTRL_MSR | ARCH_CAP_TAA_NO | \ 1575 + ARCH_CAP_SBDR_SSDP_NO | ARCH_CAP_FBSDP_NO | ARCH_CAP_PSDP_NO | \ 1576 + ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO) 1577 + 1560 1578 static u64 kvm_get_arch_capabilities(void) 1561 1579 { 1562 1580 u64 data = 0; 1563 1581 1564 - if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES)) 1582 + if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES)) { 1565 1583 rdmsrl(MSR_IA32_ARCH_CAPABILITIES, data); 1584 + data &= KVM_SUPPORTED_ARCH_CAP; 1585 + } 1566 1586 1567 1587 /* 1568 1588 * If nx_huge_pages is enabled, KVM's shadow paging will ensure that ··· 1629 1609 * using VERW to clear CPU buffers. 1630 1610 */ 1631 1611 } 1632 - 1633 - /* Guests don't need to know "Fill buffer clear control" exists */ 1634 - data &= ~ARCH_CAP_FB_CLEAR_CTRL; 1635 1612 1636 1613 return data; 1637 1614 } ··· 10669 10652 case KVM_MP_STATE_INIT_RECEIVED: 10670 10653 break; 10671 10654 default: 10672 - return -EINTR; 10655 + WARN_ON_ONCE(1); 10656 + break; 10673 10657 } 10674 10658 return 1; 10675 10659 } ··· 11111 11093 11112 11094 vcpu_load(vcpu); 11113 11095 11114 - if (!lapic_in_kernel(vcpu) && 11115 - mp_state->mp_state != KVM_MP_STATE_RUNNABLE) 11096 + switch (mp_state->mp_state) { 11097 + case KVM_MP_STATE_UNINITIALIZED: 11098 + case KVM_MP_STATE_HALTED: 11099 + case KVM_MP_STATE_AP_RESET_HOLD: 11100 + case KVM_MP_STATE_INIT_RECEIVED: 11101 + case KVM_MP_STATE_SIPI_RECEIVED: 11102 + if (!lapic_in_kernel(vcpu)) 11103 + goto out; 11104 + break; 11105 + 11106 + case KVM_MP_STATE_RUNNABLE: 11107 + break; 11108 + 11109 + default: 11116 11110 goto out; 11111 + } 11117 11112 11118 11113 /* 11119 11114 * KVM_MP_STATE_INIT_RECEIVED means the processor is in ··· 11594 11563 vcpu->arch.mci_ctl2_banks = kcalloc(KVM_MAX_MCE_BANKS, sizeof(u64), 11595 11564 GFP_KERNEL_ACCOUNT); 11596 11565 if (!vcpu->arch.mce_banks || !vcpu->arch.mci_ctl2_banks) 11597 - goto fail_free_pio_data; 11566 + goto fail_free_mce_banks; 11598 11567 vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS; 11599 11568 11600 11569 if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, ··· 11648 11617 fail_free_mce_banks: 11649 11618 kfree(vcpu->arch.mce_banks); 11650 11619 kfree(vcpu->arch.mci_ctl2_banks); 11651 - fail_free_pio_data: 11652 11620 free_page((unsigned long)vcpu->arch.pio_data); 11653 11621 fail_free_lapic: 11654 11622 kvm_free_lapic(vcpu); ··· 12503 12473 } else { 12504 12474 kvm_mmu_slot_remove_write_access(kvm, new, PG_LEVEL_4K); 12505 12475 } 12476 + 12477 + /* 12478 + * Unconditionally flush the TLBs after enabling dirty logging. 12479 + * A flush is almost always going to be necessary (see below), 12480 + * and unconditionally flushing allows the helpers to omit 12481 + * the subtly complex checks when removing write access. 12482 + * 12483 + * Do the flush outside of mmu_lock to reduce the amount of 12484 + * time mmu_lock is held. Flushing after dropping mmu_lock is 12485 + * safe as KVM only needs to guarantee the slot is fully 12486 + * write-protected before returning to userspace, i.e. before 12487 + * userspace can consume the dirty status. 12488 + * 12489 + * Flushing outside of mmu_lock requires KVM to be careful when 12490 + * making decisions based on writable status of an SPTE, e.g. a 12491 + * !writable SPTE doesn't guarantee a CPU can't perform writes. 12492 + * 12493 + * Specifically, KVM also write-protects guest page tables to 12494 + * monitor changes when using shadow paging, and must guarantee 12495 + * no CPUs can write to those page before mmu_lock is dropped. 12496 + * Because CPUs may have stale TLB entries at this point, a 12497 + * !writable SPTE doesn't guarantee CPUs can't perform writes. 12498 + * 12499 + * KVM also allows making SPTES writable outside of mmu_lock, 12500 + * e.g. to allow dirty logging without taking mmu_lock. 12501 + * 12502 + * To handle these scenarios, KVM uses a separate software-only 12503 + * bit (MMU-writable) to track if a SPTE is !writable due to 12504 + * a guest page table being write-protected (KVM clears the 12505 + * MMU-writable flag when write-protecting for shadow paging). 12506 + * 12507 + * The use of MMU-writable is also the primary motivation for 12508 + * the unconditional flush. Because KVM must guarantee that a 12509 + * CPU doesn't contain stale, writable TLB entries for a 12510 + * !MMU-writable SPTE, KVM must flush if it encounters any 12511 + * MMU-writable SPTE regardless of whether the actual hardware 12512 + * writable bit was set. I.e. KVM is almost guaranteed to need 12513 + * to flush, while unconditionally flushing allows the "remove 12514 + * write access" helpers to ignore MMU-writable entirely. 12515 + * 12516 + * See is_writable_pte() for more details (the case involving 12517 + * access-tracked SPTEs is particularly relevant). 12518 + */ 12519 + kvm_arch_flush_remote_tlbs_memslot(kvm, new); 12506 12520 } 12507 12521 } 12508 12522
+7 -1
drivers/amba/bus.c
··· 209 209 struct amba_device *pcdev = to_amba_device(dev); 210 210 struct amba_driver *pcdrv = to_amba_driver(drv); 211 211 212 + mutex_lock(&pcdev->periphid_lock); 212 213 if (!pcdev->periphid) { 213 214 int ret = amba_read_periphid(pcdev); 214 215 ··· 219 218 * permanent failure in reading pid and cid, simply map it to 220 219 * -EPROBE_DEFER. 221 220 */ 222 - if (ret) 221 + if (ret) { 222 + mutex_unlock(&pcdev->periphid_lock); 223 223 return -EPROBE_DEFER; 224 + } 224 225 dev_set_uevent_suppress(dev, false); 225 226 kobject_uevent(&dev->kobj, KOBJ_ADD); 226 227 } 228 + mutex_unlock(&pcdev->periphid_lock); 227 229 228 230 /* When driver_override is set, only bind to the matching driver */ 229 231 if (pcdev->driver_override) ··· 536 532 537 533 if (d->res.parent) 538 534 release_resource(&d->res); 535 + mutex_destroy(&d->periphid_lock); 539 536 kfree(d); 540 537 } 541 538 ··· 589 584 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; 590 585 dev->dev.dma_parms = &dev->dma_parms; 591 586 dev->res.name = dev_name(&dev->dev); 587 + mutex_init(&dev->periphid_lock); 592 588 } 593 589 594 590 /**
+12
drivers/android/binder.c
··· 1385 1385 } 1386 1386 ret = binder_inc_ref_olocked(ref, strong, target_list); 1387 1387 *rdata = ref->data; 1388 + if (ret && ref == new_ref) { 1389 + /* 1390 + * Cleanup the failed reference here as the target 1391 + * could now be dead and have already released its 1392 + * references by now. Calling on the new reference 1393 + * with strong=0 and a tmp_refs will not decrement 1394 + * the node. The new_ref gets kfree'd below. 1395 + */ 1396 + binder_cleanup_ref_olocked(new_ref); 1397 + ref = NULL; 1398 + } 1399 + 1388 1400 binder_proc_unlock(proc); 1389 1401 if (new_ref && ref != new_ref) 1390 1402 /*
+2 -2
drivers/android/binder_alloc.c
··· 322 322 */ 323 323 if (vma) { 324 324 vm_start = vma->vm_start; 325 - alloc->vma_vm_mm = vma->vm_mm; 326 325 mmap_assert_write_locked(alloc->vma_vm_mm); 327 326 } else { 328 327 mmap_assert_locked(alloc->vma_vm_mm); ··· 794 795 binder_insert_free_buffer(alloc, buffer); 795 796 alloc->free_async_space = alloc->buffer_size / 2; 796 797 binder_alloc_set_vma(alloc, vma); 797 - mmgrab(alloc->vma_vm_mm); 798 798 799 799 return 0; 800 800 ··· 1089 1091 void binder_alloc_init(struct binder_alloc *alloc) 1090 1092 { 1091 1093 alloc->pid = current->group_leader->pid; 1094 + alloc->vma_vm_mm = current->mm; 1095 + mmgrab(alloc->vma_vm_mm); 1092 1096 mutex_init(&alloc->mutex); 1093 1097 INIT_LIST_HEAD(&alloc->buffers); 1094 1098 }
+1 -1
drivers/base/arch_topology.c
··· 735 735 int cpu, ret; 736 736 737 737 ret = detect_cache_attributes(cpuid); 738 - if (ret) 738 + if (ret && ret != -ENOENT) 739 739 pr_info("Early cacheinfo failed, ret = %d\n", ret); 740 740 741 741 /* update core and thread sibling masks */
+40
drivers/base/dd.c
··· 274 274 } 275 275 __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); 276 276 277 + /** 278 + * driver_deferred_probe_check_state() - Check deferred probe state 279 + * @dev: device to check 280 + * 281 + * Return: 282 + * * -ENODEV if initcalls have completed and modules are disabled. 283 + * * -ETIMEDOUT if the deferred probe timeout was set and has expired 284 + * and modules are enabled. 285 + * * -EPROBE_DEFER in other cases. 286 + * 287 + * Drivers or subsystems can opt-in to calling this function instead of directly 288 + * returning -EPROBE_DEFER. 289 + */ 290 + int driver_deferred_probe_check_state(struct device *dev) 291 + { 292 + if (!IS_ENABLED(CONFIG_MODULES) && initcalls_done) { 293 + dev_warn(dev, "ignoring dependency for device, assuming no driver\n"); 294 + return -ENODEV; 295 + } 296 + 297 + if (!driver_deferred_probe_timeout && initcalls_done) { 298 + dev_warn(dev, "deferred probe timeout, ignoring dependency\n"); 299 + return -ETIMEDOUT; 300 + } 301 + 302 + return -EPROBE_DEFER; 303 + } 304 + EXPORT_SYMBOL_GPL(driver_deferred_probe_check_state); 305 + 277 306 static void deferred_probe_timeout_work_func(struct work_struct *work) 278 307 { 279 308 struct device_private *p; 280 309 281 310 fw_devlink_drivers_done(); 282 311 312 + driver_deferred_probe_timeout = 0; 283 313 driver_deferred_probe_trigger(); 284 314 flush_work(&deferred_probe_work); 285 315 ··· 911 881 dev_dbg(dev, "Device match requests probe deferral\n"); 912 882 dev->can_match = true; 913 883 driver_deferred_probe_add(dev); 884 + /* 885 + * Device can't match with a driver right now, so don't attempt 886 + * to match or bind with other drivers on the bus. 887 + */ 888 + return ret; 914 889 } else if (ret < 0) { 915 890 dev_dbg(dev, "Bus failed to match device: %d\n", ret); 916 891 return ret; ··· 1155 1120 dev_dbg(dev, "Device match requests probe deferral\n"); 1156 1121 dev->can_match = true; 1157 1122 driver_deferred_probe_add(dev); 1123 + /* 1124 + * Driver could not match with device, but may match with 1125 + * another device on the bus. 1126 + */ 1127 + return 0; 1158 1128 } else if (ret < 0) { 1159 1129 dev_dbg(dev, "Bus failed to match device: %d\n", ret); 1160 1130 return ret;
+3 -4
drivers/base/firmware_loader/sysfs.c
··· 93 93 { 94 94 struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev); 95 95 96 - if (fw_sysfs->fw_upload_priv) { 97 - free_fw_priv(fw_sysfs->fw_priv); 98 - kfree(fw_sysfs->fw_upload_priv); 99 - } 96 + if (fw_sysfs->fw_upload_priv) 97 + fw_upload_free(fw_sysfs); 98 + 100 99 kfree(fw_sysfs); 101 100 } 102 101
+5
drivers/base/firmware_loader/sysfs.h
··· 106 106 extern struct device_attribute dev_attr_remaining_size; 107 107 108 108 int fw_upload_start(struct fw_sysfs *fw_sysfs); 109 + void fw_upload_free(struct fw_sysfs *fw_sysfs); 109 110 umode_t fw_upload_is_visible(struct kobject *kobj, struct attribute *attr, int n); 110 111 #else 111 112 static inline int fw_upload_start(struct fw_sysfs *fw_sysfs) 112 113 { 113 114 return 0; 115 + } 116 + 117 + static inline void fw_upload_free(struct fw_sysfs *fw_sysfs) 118 + { 114 119 } 115 120 #endif 116 121
+11 -1
drivers/base/firmware_loader/sysfs_upload.c
··· 264 264 return 0; 265 265 } 266 266 267 + void fw_upload_free(struct fw_sysfs *fw_sysfs) 268 + { 269 + struct fw_upload_priv *fw_upload_priv = fw_sysfs->fw_upload_priv; 270 + 271 + free_fw_priv(fw_sysfs->fw_priv); 272 + kfree(fw_upload_priv->fw_upload); 273 + kfree(fw_upload_priv); 274 + } 275 + 267 276 /** 268 277 * firmware_upload_register() - register for the firmware upload sysfs API 269 278 * @module: kernel module of this device ··· 386 377 { 387 378 struct fw_sysfs *fw_sysfs = fw_upload->priv; 388 379 struct fw_upload_priv *fw_upload_priv = fw_sysfs->fw_upload_priv; 380 + struct module *module = fw_upload_priv->module; 389 381 390 382 mutex_lock(&fw_upload_priv->lock); 391 383 if (fw_upload_priv->progress == FW_UPLOAD_PROG_IDLE) { ··· 402 392 403 393 unregister: 404 394 device_unregister(&fw_sysfs->dev); 405 - module_put(fw_upload_priv->module); 395 + module_put(module); 406 396 } 407 397 EXPORT_SYMBOL_GPL(firmware_upload_unregister);
+1 -1
drivers/base/power/domain.c
··· 2733 2733 mutex_unlock(&gpd_list_lock); 2734 2734 dev_dbg(dev, "%s() failed to find PM domain: %ld\n", 2735 2735 __func__, PTR_ERR(pd)); 2736 - return -ENODEV; 2736 + return driver_deferred_probe_check_state(base_dev); 2737 2737 } 2738 2738 2739 2739 dev_dbg(dev, "adding to PM domain %s\n", pd->name);
+3
drivers/block/xen-blkback/common.h
··· 226 226 sector_t size; 227 227 unsigned int flush_support:1; 228 228 unsigned int discard_secure:1; 229 + /* Connect-time cached feature_persistent parameter value */ 230 + unsigned int feature_gnt_persistent_parm:1; 231 + /* Persistent grants feature negotiation result */ 229 232 unsigned int feature_gnt_persistent:1; 230 233 unsigned int overflow_max_grants:1; 231 234 };
+4 -2
drivers/block/xen-blkback/xenbus.c
··· 907 907 xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); 908 908 909 909 err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 910 - be->blkif->vbd.feature_gnt_persistent); 910 + be->blkif->vbd.feature_gnt_persistent_parm); 911 911 if (err) { 912 912 xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", 913 913 dev->nodename); ··· 1085 1085 return -ENOSYS; 1086 1086 } 1087 1087 1088 - blkif->vbd.feature_gnt_persistent = feature_persistent && 1088 + blkif->vbd.feature_gnt_persistent_parm = feature_persistent; 1089 + blkif->vbd.feature_gnt_persistent = 1090 + blkif->vbd.feature_gnt_persistent_parm && 1089 1091 xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); 1090 1092 1091 1093 blkif->vbd.overflow_max_grants = 0;
+12 -8
drivers/block/xen-blkfront.c
··· 213 213 unsigned int feature_fua:1; 214 214 unsigned int feature_discard:1; 215 215 unsigned int feature_secdiscard:1; 216 + /* Connect-time cached feature_persistent parameter */ 217 + unsigned int feature_persistent_parm:1; 218 + /* Persistent grants feature negotiation result */ 216 219 unsigned int feature_persistent:1; 217 220 unsigned int bounce:1; 218 221 unsigned int discard_granularity; ··· 1759 1756 return err; 1760 1757 } 1761 1758 1759 + /* Enable the persistent grants feature. */ 1760 + static bool feature_persistent = true; 1761 + module_param(feature_persistent, bool, 0644); 1762 + MODULE_PARM_DESC(feature_persistent, 1763 + "Enables the persistent grants feature"); 1764 + 1762 1765 /* Common code used when first setting up, and when resuming. */ 1763 1766 static int talk_to_blkback(struct xenbus_device *dev, 1764 1767 struct blkfront_info *info) ··· 1856 1847 message = "writing protocol"; 1857 1848 goto abort_transaction; 1858 1849 } 1850 + info->feature_persistent_parm = feature_persistent; 1859 1851 err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 1860 - info->feature_persistent); 1852 + info->feature_persistent_parm); 1861 1853 if (err) 1862 1854 dev_warn(&dev->dev, 1863 1855 "writing persistent grants feature to xenbus"); ··· 1925 1915 } 1926 1916 return 0; 1927 1917 } 1928 - 1929 - /* Enable the persistent grants feature. */ 1930 - static bool feature_persistent = true; 1931 - module_param(feature_persistent, bool, 0644); 1932 - MODULE_PARM_DESC(feature_persistent, 1933 - "Enables the persistent grants feature"); 1934 1918 1935 1919 /* 1936 1920 * Entry point to this code when a new device is created. Allocate the basic ··· 2285 2281 if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) 2286 2282 blkfront_setup_discard(info); 2287 2283 2288 - if (feature_persistent) 2284 + if (info->feature_persistent_parm) 2289 2285 info->feature_persistent = 2290 2286 !!xenbus_read_unsigned(info->xbdev->otherend, 2291 2287 "feature-persistent", 0);
+16 -3
drivers/bus/mhi/host/main.c
··· 430 430 { 431 431 struct mhi_event *mhi_event = dev; 432 432 struct mhi_controller *mhi_cntrl = mhi_event->mhi_cntrl; 433 - struct mhi_event_ctxt *er_ctxt = 434 - &mhi_cntrl->mhi_ctxt->er_ctxt[mhi_event->er_index]; 433 + struct mhi_event_ctxt *er_ctxt; 435 434 struct mhi_ring *ev_ring = &mhi_event->ring; 436 - dma_addr_t ptr = le64_to_cpu(er_ctxt->rp); 435 + dma_addr_t ptr; 437 436 void *dev_rp; 437 + 438 + /* 439 + * If CONFIG_DEBUG_SHIRQ is set, the IRQ handler will get invoked during __free_irq() 440 + * and by that time mhi_ctxt() would've freed. So check for the existence of mhi_ctxt 441 + * before handling the IRQs. 442 + */ 443 + if (!mhi_cntrl->mhi_ctxt) { 444 + dev_dbg(&mhi_cntrl->mhi_dev->dev, 445 + "mhi_ctxt has been freed\n"); 446 + return IRQ_HANDLED; 447 + } 448 + 449 + er_ctxt = &mhi_cntrl->mhi_ctxt->er_ctxt[mhi_event->er_index]; 450 + ptr = le64_to_cpu(er_ctxt->rp); 438 451 439 452 if (!is_valid_ring_ptr(ev_ring, ptr)) { 440 453 dev_err(&mhi_cntrl->mhi_dev->dev,
+11 -5
drivers/clk/bcm/clk-raspberrypi.c
··· 203 203 ret = raspberrypi_clock_property(rpi->firmware, data, 204 204 RPI_FIRMWARE_GET_CLOCK_RATE, &val); 205 205 if (ret) 206 - return ret; 206 + return 0; 207 207 208 208 return val; 209 209 } ··· 220 220 ret = raspberrypi_clock_property(rpi->firmware, data, 221 221 RPI_FIRMWARE_SET_CLOCK_RATE, &_rate); 222 222 if (ret) 223 - dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d", 223 + dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d\n", 224 224 clk_hw_get_name(hw), ret); 225 225 226 226 return ret; ··· 288 288 RPI_FIRMWARE_GET_MIN_CLOCK_RATE, 289 289 &min_rate); 290 290 if (ret) { 291 - dev_err(rpi->dev, "Failed to get clock %d min freq: %d", 291 + dev_err(rpi->dev, "Failed to get clock %d min freq: %d\n", 292 292 id, ret); 293 293 return ERR_PTR(ret); 294 294 } ··· 344 344 struct rpi_firmware_get_clocks_response *clks; 345 345 int ret; 346 346 347 + /* 348 + * The firmware doesn't guarantee that the last element of 349 + * RPI_FIRMWARE_GET_CLOCKS is zeroed. So allocate an additional 350 + * zero element as sentinel. 351 + */ 347 352 clks = devm_kcalloc(rpi->dev, 348 - RPI_FIRMWARE_NUM_CLK_ID, sizeof(*clks), 353 + RPI_FIRMWARE_NUM_CLK_ID + 1, sizeof(*clks), 349 354 GFP_KERNEL); 350 355 if (!clks) 351 356 return -ENOMEM; ··· 365 360 struct raspberrypi_clk_variant *variant; 366 361 367 362 if (clks->id > RPI_FIRMWARE_NUM_CLK_ID) { 368 - dev_err(rpi->dev, "Unknown clock id: %u", clks->id); 363 + dev_err(rpi->dev, "Unknown clock id: %u (max: %u)\n", 364 + clks->id, RPI_FIRMWARE_NUM_CLK_ID); 369 365 return -EINVAL; 370 366 } 371 367
+1 -2
drivers/clk/clk.c
··· 840 840 if (core->ops->unprepare) 841 841 core->ops->unprepare(core->hw); 842 842 843 - clk_pm_runtime_put(core); 844 - 845 843 trace_clk_unprepare_complete(core); 846 844 clk_core_unprepare(core->parent); 845 + clk_pm_runtime_put(core); 847 846 } 848 847 849 848 static void clk_core_unprepare_lock(struct clk_core *core)
+1
drivers/clk/ti/clk.c
··· 135 135 continue; 136 136 137 137 if (!strncmp(n, tmp, strlen(tmp))) { 138 + of_node_get(np); 138 139 found = true; 139 140 break; 140 141 }
+2 -1
drivers/dma-buf/dma-resv.c
··· 295 295 enum dma_resv_usage old_usage; 296 296 297 297 dma_resv_list_entry(fobj, i, obj, &old, &old_usage); 298 - if ((old->context == fence->context && old_usage >= usage) || 298 + if ((old->context == fence->context && old_usage >= usage && 299 + dma_fence_is_later(fence, old)) || 299 300 dma_fence_is_signaled(old)) { 300 301 dma_resv_list_set(fobj, i, fence, usage); 301 302 dma_fence_put(old);
+7 -24
drivers/firmware/efi/capsule-loader.c
··· 243 243 } 244 244 245 245 /** 246 - * efi_capsule_flush - called by file close or file flush 247 - * @file: file pointer 248 - * @id: not used 249 - * 250 - * If a capsule is being partially uploaded then calling this function 251 - * will be treated as upload termination and will free those completed 252 - * buffer pages and -ECANCELED will be returned. 253 - **/ 254 - static int efi_capsule_flush(struct file *file, fl_owner_t id) 255 - { 256 - int ret = 0; 257 - struct capsule_info *cap_info = file->private_data; 258 - 259 - if (cap_info->index > 0) { 260 - pr_err("capsule upload not complete\n"); 261 - efi_free_all_buff_pages(cap_info); 262 - ret = -ECANCELED; 263 - } 264 - 265 - return ret; 266 - } 267 - 268 - /** 269 246 * efi_capsule_release - called by file close 270 247 * @inode: not used 271 248 * @file: file pointer ··· 253 276 static int efi_capsule_release(struct inode *inode, struct file *file) 254 277 { 255 278 struct capsule_info *cap_info = file->private_data; 279 + 280 + if (cap_info->index > 0 && 281 + (cap_info->header.headersize == 0 || 282 + cap_info->count < cap_info->total_size)) { 283 + pr_err("capsule upload not complete\n"); 284 + efi_free_all_buff_pages(cap_info); 285 + } 256 286 257 287 kfree(cap_info->pages); 258 288 kfree(cap_info->phys); ··· 308 324 .owner = THIS_MODULE, 309 325 .open = efi_capsule_open, 310 326 .write = efi_capsule_write, 311 - .flush = efi_capsule_flush, 312 327 .release = efi_capsule_release, 313 328 .llseek = no_llseek, 314 329 };
+7
drivers/firmware/efi/libstub/Makefile
··· 37 37 $(call cc-option,-fno-addrsig) \ 38 38 -D__DISABLE_EXPORTS 39 39 40 + # 41 + # struct randomization only makes sense for Linux internal types, which the EFI 42 + # stub code never touches, so let's turn off struct randomization for the stub 43 + # altogether 44 + # 45 + KBUILD_CFLAGS := $(filter-out $(RANDSTRUCT_CFLAGS), $(KBUILD_CFLAGS)) 46 + 40 47 # remove SCS flags from all objects in this directory 41 48 KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) 42 49 # disable LTO
-1
drivers/firmware/efi/libstub/x86-stub.c
··· 220 220 unsigned long end, next; 221 221 unsigned long rounded_start, rounded_end; 222 222 unsigned long unprotect_start, unprotect_size; 223 - int has_system_memory = 0; 224 223 225 224 if (efi_dxe_table == NULL) 226 225 return;
+7 -3
drivers/gpio/gpio-104-dio-48e.c
··· 164 164 dio48egpio->irq_mask &= ~BIT(0); 165 165 else 166 166 dio48egpio->irq_mask &= ~BIT(1); 167 + gpiochip_disable_irq(chip, offset); 167 168 168 169 if (!dio48egpio->irq_mask) 169 170 /* disable interrupts */ ··· 192 191 iowrite8(0x00, &dio48egpio->reg->enable_interrupt); 193 192 } 194 193 194 + gpiochip_enable_irq(chip, offset); 195 195 if (offset == 19) 196 196 dio48egpio->irq_mask |= BIT(0); 197 197 else ··· 215 213 return 0; 216 214 } 217 215 218 - static struct irq_chip dio48e_irqchip = { 216 + static const struct irq_chip dio48e_irqchip = { 219 217 .name = "104-dio-48e", 220 218 .irq_ack = dio48e_irq_ack, 221 219 .irq_mask = dio48e_irq_mask, 222 220 .irq_unmask = dio48e_irq_unmask, 223 - .irq_set_type = dio48e_irq_set_type 221 + .irq_set_type = dio48e_irq_set_type, 222 + .flags = IRQCHIP_IMMUTABLE, 223 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 224 224 }; 225 225 226 226 static irqreturn_t dio48e_irq_handler(int irq, void *dev_id) ··· 326 322 dio48egpio->chip.set_multiple = dio48e_gpio_set_multiple; 327 323 328 324 girq = &dio48egpio->chip.irq; 329 - girq->chip = &dio48e_irqchip; 325 + gpio_irq_chip_set_chip(girq, &dio48e_irqchip); 330 326 /* This will let us handle the parent IRQ in the driver */ 331 327 girq->parent_handler = NULL; 332 328 girq->num_parents = 0;
+7 -3
drivers/gpio/gpio-104-idi-48.c
··· 113 113 spin_lock_irqsave(&idi48gpio->lock, flags); 114 114 115 115 idi48gpio->irq_mask[boundary] &= ~mask; 116 + gpiochip_disable_irq(chip, offset); 116 117 117 118 /* Exit early if there are still input lines with IRQ unmasked */ 118 119 if (idi48gpio->irq_mask[boundary]) ··· 141 140 142 141 prev_irq_mask = idi48gpio->irq_mask[boundary]; 143 142 143 + gpiochip_enable_irq(chip, offset); 144 144 idi48gpio->irq_mask[boundary] |= mask; 145 145 146 146 /* Exit early if IRQ was already unmasked for this boundary */ ··· 166 164 return 0; 167 165 } 168 166 169 - static struct irq_chip idi_48_irqchip = { 167 + static const struct irq_chip idi_48_irqchip = { 170 168 .name = "104-idi-48", 171 169 .irq_ack = idi_48_irq_ack, 172 170 .irq_mask = idi_48_irq_mask, 173 171 .irq_unmask = idi_48_irq_unmask, 174 - .irq_set_type = idi_48_irq_set_type 172 + .irq_set_type = idi_48_irq_set_type, 173 + .flags = IRQCHIP_IMMUTABLE, 174 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 175 175 }; 176 176 177 177 static irqreturn_t idi_48_irq_handler(int irq, void *dev_id) ··· 271 267 idi48gpio->chip.get_multiple = idi_48_gpio_get_multiple; 272 268 273 269 girq = &idi48gpio->chip.irq; 274 - girq->chip = &idi_48_irqchip; 270 + gpio_irq_chip_set_chip(girq, &idi_48_irqchip); 275 271 /* This will let us handle the parent IRQ in the driver */ 276 272 girq->parent_handler = NULL; 277 273 girq->num_parents = 0;
+11 -7
drivers/gpio/gpio-104-idio-16.c
··· 174 174 { 175 175 struct gpio_chip *chip = irq_data_get_irq_chip_data(data); 176 176 struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); 177 - const unsigned long mask = BIT(irqd_to_hwirq(data)); 177 + const unsigned long offset = irqd_to_hwirq(data); 178 178 unsigned long flags; 179 179 180 - idio16gpio->irq_mask &= ~mask; 180 + idio16gpio->irq_mask &= ~BIT(offset); 181 + gpiochip_disable_irq(chip, offset); 181 182 182 183 if (!idio16gpio->irq_mask) { 183 184 raw_spin_lock_irqsave(&idio16gpio->lock, flags); ··· 193 192 { 194 193 struct gpio_chip *chip = irq_data_get_irq_chip_data(data); 195 194 struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); 196 - const unsigned long mask = BIT(irqd_to_hwirq(data)); 195 + const unsigned long offset = irqd_to_hwirq(data); 197 196 const unsigned long prev_irq_mask = idio16gpio->irq_mask; 198 197 unsigned long flags; 199 198 200 - idio16gpio->irq_mask |= mask; 199 + gpiochip_enable_irq(chip, offset); 200 + idio16gpio->irq_mask |= BIT(offset); 201 201 202 202 if (!prev_irq_mask) { 203 203 raw_spin_lock_irqsave(&idio16gpio->lock, flags); ··· 219 217 return 0; 220 218 } 221 219 222 - static struct irq_chip idio_16_irqchip = { 220 + static const struct irq_chip idio_16_irqchip = { 223 221 .name = "104-idio-16", 224 222 .irq_ack = idio_16_irq_ack, 225 223 .irq_mask = idio_16_irq_mask, 226 224 .irq_unmask = idio_16_irq_unmask, 227 - .irq_set_type = idio_16_irq_set_type 225 + .irq_set_type = idio_16_irq_set_type, 226 + .flags = IRQCHIP_IMMUTABLE, 227 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 228 228 }; 229 229 230 230 static irqreturn_t idio_16_irq_handler(int irq, void *dev_id) ··· 303 299 idio16gpio->out_state = 0xFFFF; 304 300 305 301 girq = &idio16gpio->chip.irq; 306 - girq->chip = &idio_16_irqchip; 302 + gpio_irq_chip_set_chip(girq, &idio_16_irqchip); 307 303 /* This will let us handle the parent IRQ in the driver */ 308 304 girq->parent_handler = NULL; 309 305 girq->num_parents = 0;
+8 -1
drivers/gpio/gpio-mockup.c
··· 373 373 } 374 374 } 375 375 376 + static void gpio_mockup_debugfs_cleanup(void *data) 377 + { 378 + struct gpio_mockup_chip *chip = data; 379 + 380 + debugfs_remove_recursive(chip->dbg_dir); 381 + } 382 + 376 383 static void gpio_mockup_dispose_mappings(void *data) 377 384 { 378 385 struct gpio_mockup_chip *chip = data; ··· 462 455 463 456 gpio_mockup_debugfs_setup(dev, chip); 464 457 465 - return 0; 458 + return devm_add_action_or_reset(dev, gpio_mockup_debugfs_cleanup, chip); 466 459 } 467 460 468 461 static const struct of_device_id gpio_mockup_of_match[] = {
+7 -1
drivers/gpio/gpio-pca953x.c
··· 1175 1175 { 1176 1176 struct pca953x_chip *chip = dev_get_drvdata(dev); 1177 1177 1178 + mutex_lock(&chip->i2c_lock); 1178 1179 regcache_cache_only(chip->regmap, true); 1180 + mutex_unlock(&chip->i2c_lock); 1179 1181 1180 1182 if (atomic_read(&chip->wakeup_path)) 1181 1183 device_set_wakeup_path(dev); ··· 1200 1198 } 1201 1199 } 1202 1200 1201 + mutex_lock(&chip->i2c_lock); 1203 1202 regcache_cache_only(chip->regmap, false); 1204 1203 regcache_mark_dirty(chip->regmap); 1205 1204 ret = pca953x_regcache_sync(dev); 1206 - if (ret) 1205 + if (ret) { 1206 + mutex_unlock(&chip->i2c_lock); 1207 1207 return ret; 1208 + } 1208 1209 1209 1210 ret = regcache_sync(chip->regmap); 1211 + mutex_unlock(&chip->i2c_lock); 1210 1212 if (ret) { 1211 1213 dev_err(dev, "Failed to restore register map: %d\n", ret); 1212 1214 return ret;
+2 -9
drivers/gpio/gpio-pxa.c
··· 661 661 if (IS_ERR(gpio_reg_base)) 662 662 return PTR_ERR(gpio_reg_base); 663 663 664 - clk = clk_get(&pdev->dev, NULL); 664 + clk = devm_clk_get_enabled(&pdev->dev, NULL); 665 665 if (IS_ERR(clk)) { 666 666 dev_err(&pdev->dev, "Error %ld to get gpio clock\n", 667 667 PTR_ERR(clk)); 668 668 return PTR_ERR(clk); 669 669 } 670 - ret = clk_prepare_enable(clk); 671 - if (ret) { 672 - clk_put(clk); 673 - return ret; 674 - } 675 670 676 671 /* Initialize GPIO chips */ 677 672 ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, gpio_reg_base); 678 - if (ret) { 679 - clk_put(clk); 673 + if (ret) 680 674 return ret; 681 - } 682 675 683 676 /* clear all GPIO edge detects */ 684 677 for_each_gpio_bank(gpio, c, pchip) {
+85 -81
drivers/gpio/gpio-realtek-otto.c
··· 46 46 * @lock: Lock for accessing the IRQ registers and values 47 47 * @intr_mask: Mask for interrupts lines 48 48 * @intr_type: Interrupt type selection 49 + * @bank_read: Read a bank setting as a single 32-bit value 50 + * @bank_write: Write a bank setting as a single 32-bit value 51 + * @imr_line_pos: Bit shift of an IRQ line's IMR value. 52 + * 53 + * The DIR, DATA, and ISR registers consist of four 8-bit port values, packed 54 + * into a single 32-bit register. Use @bank_read (@bank_write) to get (assign) 55 + * a value from (to) these registers. The IMR register consists of four 16-bit 56 + * port values, packed into two 32-bit registers. Use @imr_line_pos to get the 57 + * bit shift of the 2-bit field for a line's IMR settings. Shifts larger than 58 + * 32 overflow into the second register. 49 59 * 50 60 * Because the interrupt mask register (IMR) combines the function of IRQ type 51 61 * selection and masking, two extra values are stored. @intr_mask is used to 52 - * mask/unmask the interrupts for a GPIO port, and @intr_type is used to store 62 + * mask/unmask the interrupts for a GPIO line, and @intr_type is used to store 53 63 * the selected interrupt types. The logical AND of these values is written to 54 64 * IMR on changes. 55 65 */ ··· 69 59 void __iomem *cpumask_base; 70 60 struct cpumask cpu_irq_maskable; 71 61 raw_spinlock_t lock; 72 - u16 intr_mask[REALTEK_GPIO_PORTS_PER_BANK]; 73 - u16 intr_type[REALTEK_GPIO_PORTS_PER_BANK]; 74 - unsigned int (*port_offset_u8)(unsigned int port); 75 - unsigned int (*port_offset_u16)(unsigned int port); 62 + u8 intr_mask[REALTEK_GPIO_MAX]; 63 + u8 intr_type[REALTEK_GPIO_MAX]; 64 + u32 (*bank_read)(void __iomem *reg); 65 + void (*bank_write)(void __iomem *reg, u32 value); 66 + unsigned int (*line_imr_pos)(unsigned int line); 76 67 }; 77 68 78 69 /* Expand with more flags as devices with other quirks are added */ ··· 112 101 * port. The two interrupt mask registers store two bits per GPIO, so use u16 113 102 * values. 114 103 */ 115 - static unsigned int realtek_gpio_port_offset_u8(unsigned int port) 104 + static u32 realtek_gpio_bank_read_swapped(void __iomem *reg) 116 105 { 117 - return port; 106 + return ioread32be(reg); 118 107 } 119 108 120 - static unsigned int realtek_gpio_port_offset_u16(unsigned int port) 109 + static void realtek_gpio_bank_write_swapped(void __iomem *reg, u32 value) 121 110 { 122 - return 2 * port; 111 + iowrite32be(value, reg); 112 + } 113 + 114 + static unsigned int realtek_gpio_line_imr_pos_swapped(unsigned int line) 115 + { 116 + unsigned int port_pin = line % 8; 117 + unsigned int port = line / 8; 118 + 119 + return 2 * (8 * (port ^ 1) + port_pin); 123 120 } 124 121 125 122 /* ··· 138 119 * per GPIO, so use u16 values. The first register contains ports 1 and 0, the 139 120 * second ports 3 and 2. 140 121 */ 141 - static unsigned int realtek_gpio_port_offset_u8_rev(unsigned int port) 122 + static u32 realtek_gpio_bank_read(void __iomem *reg) 142 123 { 143 - return 3 - port; 124 + return ioread32(reg); 144 125 } 145 126 146 - static unsigned int realtek_gpio_port_offset_u16_rev(unsigned int port) 127 + static void realtek_gpio_bank_write(void __iomem *reg, u32 value) 147 128 { 148 - return 2 * (port ^ 1); 129 + iowrite32(value, reg); 149 130 } 150 131 151 - static void realtek_gpio_write_imr(struct realtek_gpio_ctrl *ctrl, 152 - unsigned int port, u16 irq_type, u16 irq_mask) 132 + static unsigned int realtek_gpio_line_imr_pos(unsigned int line) 153 133 { 154 - iowrite16(irq_type & irq_mask, 155 - ctrl->base + REALTEK_GPIO_REG_IMR + ctrl->port_offset_u16(port)); 134 + return 2 * line; 156 135 } 157 136 158 - static void realtek_gpio_clear_isr(struct realtek_gpio_ctrl *ctrl, 159 - unsigned int port, u8 mask) 137 + static void realtek_gpio_clear_isr(struct realtek_gpio_ctrl *ctrl, u32 mask) 160 138 { 161 - iowrite8(mask, ctrl->base + REALTEK_GPIO_REG_ISR + ctrl->port_offset_u8(port)); 139 + ctrl->bank_write(ctrl->base + REALTEK_GPIO_REG_ISR, mask); 162 140 } 163 141 164 - static u8 realtek_gpio_read_isr(struct realtek_gpio_ctrl *ctrl, unsigned int port) 142 + static u32 realtek_gpio_read_isr(struct realtek_gpio_ctrl *ctrl) 165 143 { 166 - return ioread8(ctrl->base + REALTEK_GPIO_REG_ISR + ctrl->port_offset_u8(port)); 144 + return ctrl->bank_read(ctrl->base + REALTEK_GPIO_REG_ISR); 167 145 } 168 146 169 - /* Set the rising and falling edge mask bits for a GPIO port pin */ 170 - static u16 realtek_gpio_imr_bits(unsigned int pin, u16 value) 147 + /* Set the rising and falling edge mask bits for a GPIO pin */ 148 + static void realtek_gpio_update_line_imr(struct realtek_gpio_ctrl *ctrl, unsigned int line) 171 149 { 172 - return (value & REALTEK_GPIO_IMR_LINE_MASK) << 2 * pin; 150 + void __iomem *reg = ctrl->base + REALTEK_GPIO_REG_IMR; 151 + unsigned int line_shift = ctrl->line_imr_pos(line); 152 + unsigned int shift = line_shift % 32; 153 + u32 irq_type = ctrl->intr_type[line]; 154 + u32 irq_mask = ctrl->intr_mask[line]; 155 + u32 reg_val; 156 + 157 + reg += 4 * (line_shift / 32); 158 + reg_val = ioread32(reg); 159 + reg_val &= ~(REALTEK_GPIO_IMR_LINE_MASK << shift); 160 + reg_val |= (irq_type & irq_mask & REALTEK_GPIO_IMR_LINE_MASK) << shift; 161 + iowrite32(reg_val, reg); 173 162 } 174 163 175 164 static void realtek_gpio_irq_ack(struct irq_data *data) 176 165 { 177 166 struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); 178 167 irq_hw_number_t line = irqd_to_hwirq(data); 179 - unsigned int port = line / 8; 180 - unsigned int port_pin = line % 8; 181 168 182 - realtek_gpio_clear_isr(ctrl, port, BIT(port_pin)); 169 + realtek_gpio_clear_isr(ctrl, BIT(line)); 183 170 } 184 171 185 172 static void realtek_gpio_irq_unmask(struct irq_data *data) 186 173 { 187 174 struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); 188 175 unsigned int line = irqd_to_hwirq(data); 189 - unsigned int port = line / 8; 190 - unsigned int port_pin = line % 8; 191 176 unsigned long flags; 192 - u16 m; 193 177 194 178 gpiochip_enable_irq(&ctrl->gc, line); 195 179 196 180 raw_spin_lock_irqsave(&ctrl->lock, flags); 197 - m = ctrl->intr_mask[port]; 198 - m |= realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK); 199 - ctrl->intr_mask[port] = m; 200 - realtek_gpio_write_imr(ctrl, port, ctrl->intr_type[port], m); 181 + ctrl->intr_mask[line] = REALTEK_GPIO_IMR_LINE_MASK; 182 + realtek_gpio_update_line_imr(ctrl, line); 201 183 raw_spin_unlock_irqrestore(&ctrl->lock, flags); 202 184 } 203 185 ··· 206 186 { 207 187 struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); 208 188 unsigned int line = irqd_to_hwirq(data); 209 - unsigned int port = line / 8; 210 - unsigned int port_pin = line % 8; 211 189 unsigned long flags; 212 - u16 m; 213 190 214 191 raw_spin_lock_irqsave(&ctrl->lock, flags); 215 - m = ctrl->intr_mask[port]; 216 - m &= ~realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK); 217 - ctrl->intr_mask[port] = m; 218 - realtek_gpio_write_imr(ctrl, port, ctrl->intr_type[port], m); 192 + ctrl->intr_mask[line] = 0; 193 + realtek_gpio_update_line_imr(ctrl, line); 219 194 raw_spin_unlock_irqrestore(&ctrl->lock, flags); 220 195 221 196 gpiochip_disable_irq(&ctrl->gc, line); ··· 220 205 { 221 206 struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); 222 207 unsigned int line = irqd_to_hwirq(data); 223 - unsigned int port = line / 8; 224 - unsigned int port_pin = line % 8; 225 208 unsigned long flags; 226 - u16 type, t; 209 + u8 type; 227 210 228 211 switch (flow_type & IRQ_TYPE_SENSE_MASK) { 229 212 case IRQ_TYPE_EDGE_FALLING: ··· 240 227 irq_set_handler_locked(data, handle_edge_irq); 241 228 242 229 raw_spin_lock_irqsave(&ctrl->lock, flags); 243 - t = ctrl->intr_type[port]; 244 - t &= ~realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK); 245 - t |= realtek_gpio_imr_bits(port_pin, type); 246 - ctrl->intr_type[port] = t; 247 - realtek_gpio_write_imr(ctrl, port, t, ctrl->intr_mask[port]); 230 + ctrl->intr_type[line] = type; 231 + realtek_gpio_update_line_imr(ctrl, line); 248 232 raw_spin_unlock_irqrestore(&ctrl->lock, flags); 249 233 250 234 return 0; ··· 252 242 struct gpio_chip *gc = irq_desc_get_handler_data(desc); 253 243 struct realtek_gpio_ctrl *ctrl = gpiochip_get_data(gc); 254 244 struct irq_chip *irq_chip = irq_desc_get_chip(desc); 255 - unsigned int lines_done; 256 - unsigned int port_pin_count; 257 245 unsigned long status; 258 246 int offset; 259 247 260 248 chained_irq_enter(irq_chip, desc); 261 249 262 - for (lines_done = 0; lines_done < gc->ngpio; lines_done += 8) { 263 - status = realtek_gpio_read_isr(ctrl, lines_done / 8); 264 - port_pin_count = min(gc->ngpio - lines_done, 8U); 265 - for_each_set_bit(offset, &status, port_pin_count) 266 - generic_handle_domain_irq(gc->irq.domain, offset + lines_done); 267 - } 250 + status = realtek_gpio_read_isr(ctrl); 251 + for_each_set_bit(offset, &status, gc->ngpio) 252 + generic_handle_domain_irq(gc->irq.domain, offset); 268 253 269 254 chained_irq_exit(irq_chip, desc); 270 255 } 271 256 272 - static inline void __iomem *realtek_gpio_irq_cpu_mask(struct realtek_gpio_ctrl *ctrl, 273 - unsigned int port, int cpu) 257 + static inline void __iomem *realtek_gpio_irq_cpu_mask(struct realtek_gpio_ctrl *ctrl, int cpu) 274 258 { 275 - return ctrl->cpumask_base + ctrl->port_offset_u8(port) + 276 - REALTEK_GPIO_PORTS_PER_BANK * cpu; 259 + return ctrl->cpumask_base + REALTEK_GPIO_PORTS_PER_BANK * cpu; 277 260 } 278 261 279 262 static int realtek_gpio_irq_set_affinity(struct irq_data *data, ··· 274 271 { 275 272 struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); 276 273 unsigned int line = irqd_to_hwirq(data); 277 - unsigned int port = line / 8; 278 - unsigned int port_pin = line % 8; 279 274 void __iomem *irq_cpu_mask; 280 275 unsigned long flags; 281 276 int cpu; 282 - u8 v; 277 + u32 v; 283 278 284 279 if (!ctrl->cpumask_base) 285 280 return -ENXIO; ··· 285 284 raw_spin_lock_irqsave(&ctrl->lock, flags); 286 285 287 286 for_each_cpu(cpu, &ctrl->cpu_irq_maskable) { 288 - irq_cpu_mask = realtek_gpio_irq_cpu_mask(ctrl, port, cpu); 289 - v = ioread8(irq_cpu_mask); 287 + irq_cpu_mask = realtek_gpio_irq_cpu_mask(ctrl, cpu); 288 + v = ctrl->bank_read(irq_cpu_mask); 290 289 291 290 if (cpumask_test_cpu(cpu, dest)) 292 - v |= BIT(port_pin); 291 + v |= BIT(line); 293 292 else 294 - v &= ~BIT(port_pin); 293 + v &= ~BIT(line); 295 294 296 - iowrite8(v, irq_cpu_mask); 295 + ctrl->bank_write(irq_cpu_mask, v); 297 296 } 298 297 299 298 raw_spin_unlock_irqrestore(&ctrl->lock, flags); ··· 306 305 static int realtek_gpio_irq_init(struct gpio_chip *gc) 307 306 { 308 307 struct realtek_gpio_ctrl *ctrl = gpiochip_get_data(gc); 309 - unsigned int port; 308 + u32 mask_all = GENMASK(gc->ngpio - 1, 0); 309 + unsigned int line; 310 310 int cpu; 311 311 312 - for (port = 0; (port * 8) < gc->ngpio; port++) { 313 - realtek_gpio_write_imr(ctrl, port, 0, 0); 314 - realtek_gpio_clear_isr(ctrl, port, GENMASK(7, 0)); 312 + for (line = 0; line < gc->ngpio; line++) 313 + realtek_gpio_update_line_imr(ctrl, line); 315 314 316 - for_each_cpu(cpu, &ctrl->cpu_irq_maskable) 317 - iowrite8(GENMASK(7, 0), realtek_gpio_irq_cpu_mask(ctrl, port, cpu)); 318 - } 315 + realtek_gpio_clear_isr(ctrl, mask_all); 316 + 317 + for_each_cpu(cpu, &ctrl->cpu_irq_maskable) 318 + ctrl->bank_write(realtek_gpio_irq_cpu_mask(ctrl, cpu), mask_all); 319 319 320 320 return 0; 321 321 } ··· 389 387 390 388 if (dev_flags & GPIO_PORTS_REVERSED) { 391 389 bgpio_flags = 0; 392 - ctrl->port_offset_u8 = realtek_gpio_port_offset_u8_rev; 393 - ctrl->port_offset_u16 = realtek_gpio_port_offset_u16_rev; 390 + ctrl->bank_read = realtek_gpio_bank_read; 391 + ctrl->bank_write = realtek_gpio_bank_write; 392 + ctrl->line_imr_pos = realtek_gpio_line_imr_pos; 394 393 } else { 395 394 bgpio_flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER; 396 - ctrl->port_offset_u8 = realtek_gpio_port_offset_u8; 397 - ctrl->port_offset_u16 = realtek_gpio_port_offset_u16; 395 + ctrl->bank_read = realtek_gpio_bank_read_swapped; 396 + ctrl->bank_write = realtek_gpio_bank_write_swapped; 397 + ctrl->line_imr_pos = realtek_gpio_line_imr_pos_swapped; 398 398 } 399 399 400 400 err = bgpio_init(&ctrl->gc, dev, 4,
+7 -3
drivers/gpio/gpio-ws16c48.c
··· 265 265 raw_spin_lock_irqsave(&ws16c48gpio->lock, flags); 266 266 267 267 ws16c48gpio->irq_mask &= ~mask; 268 + gpiochip_disable_irq(chip, offset); 268 269 port_state = ws16c48gpio->irq_mask >> (8 * port); 269 270 270 271 /* Select Register Page 2; Unlock all I/O ports */ ··· 296 295 297 296 raw_spin_lock_irqsave(&ws16c48gpio->lock, flags); 298 297 298 + gpiochip_enable_irq(chip, offset); 299 299 ws16c48gpio->irq_mask |= mask; 300 300 port_state = ws16c48gpio->irq_mask >> (8 * port); 301 301 ··· 358 356 return 0; 359 357 } 360 358 361 - static struct irq_chip ws16c48_irqchip = { 359 + static const struct irq_chip ws16c48_irqchip = { 362 360 .name = "ws16c48", 363 361 .irq_ack = ws16c48_irq_ack, 364 362 .irq_mask = ws16c48_irq_mask, 365 363 .irq_unmask = ws16c48_irq_unmask, 366 - .irq_set_type = ws16c48_irq_set_type 364 + .irq_set_type = ws16c48_irq_set_type, 365 + .flags = IRQCHIP_IMMUTABLE, 366 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 367 367 }; 368 368 369 369 static irqreturn_t ws16c48_irq_handler(int irq, void *dev_id) ··· 467 463 ws16c48gpio->chip.set_multiple = ws16c48_gpio_set_multiple; 468 464 469 465 girq = &ws16c48gpio->chip.irq; 470 - girq->chip = &ws16c48_irqchip; 466 + gpio_irq_chip_set_chip(girq, &ws16c48_irqchip); 471 467 /* This will let us handle the parent IRQ in the driver */ 472 468 girq->parent_handler = NULL; 473 469 girq->num_parents = 0;
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 5524 5524 ~*peer_adev->dev->dma_mask : ~((1ULL << 32) - 1); 5525 5525 resource_size_t aper_limit = 5526 5526 adev->gmc.aper_base + adev->gmc.aper_size - 1; 5527 - bool p2p_access = !(pci_p2pdma_distance_many(adev->pdev, 5527 + bool p2p_access = !adev->gmc.xgmi.connected_to_cpu && 5528 + !(pci_p2pdma_distance_many(adev->pdev, 5528 5529 &peer_adev->dev, 1, true) < 0); 5529 5530 5530 5531 return pcie_p2p && p2p_access && (adev->gmc.visible_vram_size &&
+7 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
··· 66 66 return true; 67 67 case CHIP_SIENNA_CICHLID: 68 68 if (strnstr(atom_ctx->vbios_version, "D603", 69 + sizeof(atom_ctx->vbios_version))) { 70 + if (strnstr(atom_ctx->vbios_version, "D603GLXE", 69 71 sizeof(atom_ctx->vbios_version))) 70 - return true; 71 - else 72 + return false; 73 + else 74 + return true; 75 + } else { 72 76 return false; 77 + } 73 78 default: 74 79 return false; 75 80 }
+4 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
··· 159 159 amdgpu_sync_free(&job->sync); 160 160 amdgpu_sync_free(&job->sched_sync); 161 161 162 - dma_fence_put(&job->hw_fence); 162 + if (!job->hw_fence.ops) 163 + kfree(job); 164 + else 165 + dma_fence_put(&job->hw_fence); 163 166 } 164 167 165 168 int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 2401 2401 static bool fw_load_skip_check(struct psp_context *psp, 2402 2402 struct amdgpu_firmware_info *ucode) 2403 2403 { 2404 - if (!ucode->fw) 2404 + if (!ucode->fw || !ucode->ucode_size) 2405 2405 return true; 2406 2406 2407 2407 if (ucode->ucode_id == AMDGPU_UCODE_ID_SMC &&
+35 -25
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
··· 4274 4274 4275 4275 } 4276 4276 4277 - info = &adev->firmware.ucode[AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS]; 4278 - info->ucode_id = AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS; 4279 - info->fw = adev->gfx.rlc_fw; 4280 - adev->firmware.fw_size += 4281 - ALIGN(adev->gfx.rlc.global_tap_delays_ucode_size_bytes, PAGE_SIZE); 4277 + if (adev->gfx.rlc.global_tap_delays_ucode_size_bytes) { 4278 + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS]; 4279 + info->ucode_id = AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS; 4280 + info->fw = adev->gfx.rlc_fw; 4281 + adev->firmware.fw_size += 4282 + ALIGN(adev->gfx.rlc.global_tap_delays_ucode_size_bytes, PAGE_SIZE); 4283 + } 4282 4284 4283 - info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE0_TAP_DELAYS]; 4284 - info->ucode_id = AMDGPU_UCODE_ID_SE0_TAP_DELAYS; 4285 - info->fw = adev->gfx.rlc_fw; 4286 - adev->firmware.fw_size += 4287 - ALIGN(adev->gfx.rlc.se0_tap_delays_ucode_size_bytes, PAGE_SIZE); 4285 + if (adev->gfx.rlc.se0_tap_delays_ucode_size_bytes) { 4286 + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE0_TAP_DELAYS]; 4287 + info->ucode_id = AMDGPU_UCODE_ID_SE0_TAP_DELAYS; 4288 + info->fw = adev->gfx.rlc_fw; 4289 + adev->firmware.fw_size += 4290 + ALIGN(adev->gfx.rlc.se0_tap_delays_ucode_size_bytes, PAGE_SIZE); 4291 + } 4288 4292 4289 - info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE1_TAP_DELAYS]; 4290 - info->ucode_id = AMDGPU_UCODE_ID_SE1_TAP_DELAYS; 4291 - info->fw = adev->gfx.rlc_fw; 4292 - adev->firmware.fw_size += 4293 - ALIGN(adev->gfx.rlc.se1_tap_delays_ucode_size_bytes, PAGE_SIZE); 4293 + if (adev->gfx.rlc.se1_tap_delays_ucode_size_bytes) { 4294 + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE1_TAP_DELAYS]; 4295 + info->ucode_id = AMDGPU_UCODE_ID_SE1_TAP_DELAYS; 4296 + info->fw = adev->gfx.rlc_fw; 4297 + adev->firmware.fw_size += 4298 + ALIGN(adev->gfx.rlc.se1_tap_delays_ucode_size_bytes, PAGE_SIZE); 4299 + } 4294 4300 4295 - info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE2_TAP_DELAYS]; 4296 - info->ucode_id = AMDGPU_UCODE_ID_SE2_TAP_DELAYS; 4297 - info->fw = adev->gfx.rlc_fw; 4298 - adev->firmware.fw_size += 4299 - ALIGN(adev->gfx.rlc.se2_tap_delays_ucode_size_bytes, PAGE_SIZE); 4301 + if (adev->gfx.rlc.se2_tap_delays_ucode_size_bytes) { 4302 + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE2_TAP_DELAYS]; 4303 + info->ucode_id = AMDGPU_UCODE_ID_SE2_TAP_DELAYS; 4304 + info->fw = adev->gfx.rlc_fw; 4305 + adev->firmware.fw_size += 4306 + ALIGN(adev->gfx.rlc.se2_tap_delays_ucode_size_bytes, PAGE_SIZE); 4307 + } 4300 4308 4301 - info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE3_TAP_DELAYS]; 4302 - info->ucode_id = AMDGPU_UCODE_ID_SE3_TAP_DELAYS; 4303 - info->fw = adev->gfx.rlc_fw; 4304 - adev->firmware.fw_size += 4305 - ALIGN(adev->gfx.rlc.se3_tap_delays_ucode_size_bytes, PAGE_SIZE); 4309 + if (adev->gfx.rlc.se3_tap_delays_ucode_size_bytes) { 4310 + info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SE3_TAP_DELAYS]; 4311 + info->ucode_id = AMDGPU_UCODE_ID_SE3_TAP_DELAYS; 4312 + info->fw = adev->gfx.rlc_fw; 4313 + adev->firmware.fw_size += 4314 + ALIGN(adev->gfx.rlc.se3_tap_delays_ucode_size_bytes, PAGE_SIZE); 4315 + } 4306 4316 4307 4317 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1]; 4308 4318 info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1;
+1
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
··· 183 183 mes_add_queue_pkt.trap_handler_addr = input->tba_addr; 184 184 mes_add_queue_pkt.tma_addr = input->tma_addr; 185 185 mes_add_queue_pkt.is_kfd_process = input->is_kfd_process; 186 + mes_add_queue_pkt.trap_en = 1; 186 187 187 188 return mes_v11_0_submit_pkt_and_poll_completion(mes, 188 189 &mes_add_queue_pkt, sizeof(mes_add_queue_pkt),
+2 -1
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 1094 1094 dc->current_state->stream_count != context->stream_count) 1095 1095 should_disable = true; 1096 1096 1097 - if (old_stream && !dc->current_state->res_ctx.pipe_ctx[i].top_pipe) { 1097 + if (old_stream && !dc->current_state->res_ctx.pipe_ctx[i].top_pipe && 1098 + !dc->current_state->res_ctx.pipe_ctx[i].prev_odm_pipe) { 1098 1099 struct pipe_ctx *old_pipe, *new_pipe; 1099 1100 1100 1101 old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
+1
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c
··· 317 317 /* switch DP encoder to CRTC data, but reset it the fifo first. It may happen 318 318 * that it overflows during mode transition, and sometimes doesn't recover. 319 319 */ 320 + REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_READ_START_LEVEL, 0x7); 320 321 REG_UPDATE(DP_STEER_FIFO, DP_STEER_FIFO_RESET, 1); 321 322 udelay(10); 322 323
+2 -1
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c
··· 98 98 REG_UPDATE(OPTC_WIDTH_CONTROL, 99 99 OPTC_SEGMENT_WIDTH, mpcc_hactive); 100 100 101 - REG_SET(OTG_H_TIMING_CNTL, 0, OTG_H_TIMING_DIV_MODE, opp_cnt - 1); 101 + REG_UPDATE(OTG_H_TIMING_CNTL, 102 + OTG_H_TIMING_DIV_MODE, opp_cnt - 1); 102 103 optc1->opp_count = opp_cnt; 103 104 } 104 105
+1
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
··· 454 454 hpo_dp_stream_encoder_reg_list(0), 455 455 hpo_dp_stream_encoder_reg_list(1), 456 456 hpo_dp_stream_encoder_reg_list(2), 457 + hpo_dp_stream_encoder_reg_list(3) 457 458 }; 458 459 459 460 static const struct dcn31_hpo_dp_stream_encoder_shift hpo_dp_se_shift = {
+4 -4
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dccg.c
··· 225 225 case 0: 226 226 REG_UPDATE_2(DPSTREAMCLK_CNTL, 227 227 DPSTREAMCLK0_EN, 228 - (src == REFCLK) ? 0 : 1, DPSTREAMCLK0_SRC_SEL, 0); 228 + (src == REFCLK) ? 0 : 1, DPSTREAMCLK0_SRC_SEL, otg_inst); 229 229 break; 230 230 case 1: 231 231 REG_UPDATE_2(DPSTREAMCLK_CNTL, DPSTREAMCLK1_EN, 232 - (src == REFCLK) ? 0 : 1, DPSTREAMCLK1_SRC_SEL, 1); 232 + (src == REFCLK) ? 0 : 1, DPSTREAMCLK1_SRC_SEL, otg_inst); 233 233 break; 234 234 case 2: 235 235 REG_UPDATE_2(DPSTREAMCLK_CNTL, DPSTREAMCLK2_EN, 236 - (src == REFCLK) ? 0 : 1, DPSTREAMCLK2_SRC_SEL, 2); 236 + (src == REFCLK) ? 0 : 1, DPSTREAMCLK2_SRC_SEL, otg_inst); 237 237 break; 238 238 case 3: 239 239 REG_UPDATE_2(DPSTREAMCLK_CNTL, DPSTREAMCLK3_EN, 240 - (src == REFCLK) ? 0 : 1, DPSTREAMCLK3_SRC_SEL, 3); 240 + (src == REFCLK) ? 0 : 1, DPSTREAMCLK3_SRC_SEL, otg_inst); 241 241 break; 242 242 default: 243 243 BREAK_TO_DEBUGGER();
+5
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_stream_encoder.c
··· 310 310 // TODO: Confirm if we need to wait for DIG_SYMCLK_FE_ON 311 311 REG_WAIT(DIG_FE_CNTL, DIG_SYMCLK_FE_ON, 1, 10, 5000); 312 312 313 + /* read start level = 0 will bring underflow / overflow and DIG_FIFO_ERROR = 1 314 + * so set it to 1/2 full = 7 before reset as suggested by hardware team. 315 + */ 316 + REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_READ_START_LEVEL, 0x7); 317 + 313 318 REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_RESET, 1); 314 319 315 320 REG_WAIT(DIG_FIFO_CTRL0, DIG_FIFO_RESET_DONE, 1, 10, 5000);
+51 -17
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
··· 295 295 } 296 296 297 297 // Include cursor size for CAB allocation 298 - if (stream->cursor_position.enable && plane->address.grph.cursor_cache_addr.quad_part) { 299 - cursor_size = dc->caps.max_cursor_size * dc->caps.max_cursor_size; 300 - switch (stream->cursor_attributes.color_format) { 301 - case CURSOR_MODE_MONO: 302 - cursor_size /= 2; 303 - break; 304 - case CURSOR_MODE_COLOR_1BIT_AND: 305 - case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA: 306 - case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA: 307 - cursor_size *= 4; 308 - break; 298 + for (j = 0; j < dc->res_pool->pipe_count; j++) { 299 + struct pipe_ctx *pipe = &ctx->res_ctx.pipe_ctx[j]; 300 + struct hubp *hubp = pipe->plane_res.hubp; 309 301 310 - case CURSOR_MODE_COLOR_64BIT_FP_PRE_MULTIPLIED: 311 - case CURSOR_MODE_COLOR_64BIT_FP_UN_PRE_MULTIPLIED: 312 - cursor_size *= 8; 313 - break; 314 - } 315 - cache_lines_used += dcn32_cache_lines_for_surface(dc, surface_size, 302 + if (pipe->stream && pipe->plane_state && hubp) 303 + /* Find the cursor plane and use the exact size instead of 304 + * using the max for calculation 305 + */ 306 + if (hubp->curs_attr.width > 0) { 307 + cursor_size = hubp->curs_attr.width * hubp->curs_attr.height; 308 + break; 309 + } 310 + } 311 + 312 + switch (stream->cursor_attributes.color_format) { 313 + case CURSOR_MODE_MONO: 314 + cursor_size /= 2; 315 + break; 316 + case CURSOR_MODE_COLOR_1BIT_AND: 317 + case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA: 318 + case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA: 319 + cursor_size *= 4; 320 + break; 321 + 322 + case CURSOR_MODE_COLOR_64BIT_FP_PRE_MULTIPLIED: 323 + case CURSOR_MODE_COLOR_64BIT_FP_UN_PRE_MULTIPLIED: 324 + cursor_size *= 8; 325 + break; 326 + } 327 + 328 + if (stream->cursor_position.enable && plane->address.grph.cursor_cache_addr.quad_part) { 329 + cache_lines_used += dcn32_cache_lines_for_surface(dc, cursor_size, 316 330 plane->address.grph.cursor_cache_addr.quad_part); 317 331 } 318 332 } ··· 338 324 339 325 if (cache_lines_used % lines_per_way > 0) 340 326 num_ways++; 327 + 328 + for (i = 0; i < ctx->stream_count; i++) { 329 + stream = ctx->streams[i]; 330 + for (j = 0; j < ctx->stream_status[i].plane_count; j++) { 331 + plane = ctx->stream_status[i].plane_states[j]; 332 + 333 + if (stream->cursor_position.enable && plane && 334 + !plane->address.grph.cursor_cache_addr.quad_part && 335 + cursor_size > 16384) { 336 + /* Cursor caching is not supported since it won't be on the same line. 337 + * So we need an extra line to accommodate it. With large cursors and a single 4k monitor 338 + * this case triggers corruption. If we're at the edge, then dont trigger display refresh 339 + * from MALL. We only need to cache cursor if its greater that 64x64 at 4 bpp. 340 + */ 341 + num_ways++; 342 + /* We only expect one cursor plane */ 343 + break; 344 + } 345 + } 346 + } 341 347 342 348 return num_ways; 343 349 }
+1 -1
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c
··· 144 144 struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; 145 145 146 146 if (!pipe->stream) 147 - continue; 147 + return false; 148 148 149 149 if (!pipe->plane_state) 150 150 return false;
+9
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
··· 1014 1014 dc->debug.force_subvp_mclk_switch)) { 1015 1015 1016 1016 dcn32_merge_pipes_for_subvp(dc, context); 1017 + // to re-initialize viewport after the pipe merge 1018 + for (int i = 0; i < dc->res_pool->pipe_count; i++) { 1019 + struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; 1020 + 1021 + if (!pipe_ctx->plane_state || !pipe_ctx->stream) 1022 + continue; 1023 + 1024 + resource_build_scaling_params(pipe_ctx); 1025 + } 1017 1026 1018 1027 while (!found_supported_config && dcn32_enough_pipes_for_subvp(dc, context) && 1019 1028 dcn32_assign_subvp_pipe(dc, context, &dc_pipe_idx)) {
+2 -1
drivers/gpu/drm/amd/include/mes_v11_api_def.h
··· 268 268 uint32_t is_tmz_queue : 1; 269 269 uint32_t map_kiq_utility_queue : 1; 270 270 uint32_t is_kfd_process : 1; 271 - uint32_t reserved : 22; 271 + uint32_t trap_en : 1; 272 + uint32_t reserved : 21; 272 273 }; 273 274 struct MES_API_STATUS api_status; 274 275 uint64_t tma_addr;
+1 -1
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h
··· 25 25 #define SMU13_DRIVER_IF_V13_0_0_H 26 26 27 27 //Increment this version if SkuTable_t or BoardTable_t change 28 - #define PPTABLE_VERSION 0x22 28 + #define PPTABLE_VERSION 0x24 29 29 30 30 #define NUM_GFXCLK_DPM_LEVELS 16 31 31 #define NUM_SOCCLK_DPM_LEVELS 8
+7 -1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
··· 30 30 #define SMU13_DRIVER_IF_VERSION_ALDE 0x08 31 31 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_4 0x05 32 32 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_5 0x04 33 - #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_0 0x2E 33 + #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_0 0x30 34 34 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_7 0x2C 35 35 36 36 #define SMU13_MODE1_RESET_WAIT_TIME_IN_MS 500 //500ms ··· 291 291 void smu_v13_0_set_smu_mailbox_registers(struct smu_context *smu); 292 292 293 293 int smu_v13_0_mode1_reset(struct smu_context *smu); 294 + 295 + int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu, 296 + void **table, 297 + uint32_t *size, 298 + uint32_t pptable_id); 299 + 294 300 #endif 295 301 #endif
+9 -14
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
··· 84 84 static const int link_width[] = {0, 1, 2, 4, 8, 12, 16}; 85 85 static const int link_speed[] = {25, 50, 80, 160}; 86 86 87 - static int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu, void **table, uint32_t *size, 88 - uint32_t pptable_id); 89 - 90 87 int smu_v13_0_init_microcode(struct smu_context *smu) 91 88 { 92 89 struct amdgpu_device *adev = smu->adev; ··· 221 224 222 225 /* 223 226 * Temporary solution for SMU V13.0.0 with SCPM enabled: 224 - * - use 36831 signed pptable when pp_table_id is 3683 225 - * - use 37151 signed pptable when pp_table_id is 3715 226 - * - use 36641 signed pptable when pp_table_id is 3664 or 0 227 - * TODO: drop these when the pptable carried in vbios is ready. 227 + * - use vbios carried pptable when pptable_id is 3664, 3715 or 3795 228 + * - use 36831 soft pptable when pptable_id is 3683 228 229 */ 229 230 if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) { 230 231 switch (pptable_id) { 231 - case 0: 232 232 case 3664: 233 - pptable_id = 36641; 233 + case 3715: 234 + case 3795: 235 + pptable_id = 0; 234 236 break; 235 237 case 3683: 236 238 pptable_id = 36831; 237 - break; 238 - case 3715: 239 - pptable_id = 37151; 240 239 break; 241 240 default: 242 241 dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id); ··· 418 425 return 0; 419 426 } 420 427 421 - static int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu, void **table, uint32_t *size, 422 - uint32_t pptable_id) 428 + int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu, 429 + void **table, 430 + uint32_t *size, 431 + uint32_t pptable_id) 423 432 { 424 433 const struct smc_firmware_header_v1_0 *hdr; 425 434 struct amdgpu_device *adev = smu->adev;
+62 -10
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
··· 388 388 return 0; 389 389 } 390 390 391 - static int smu_v13_0_0_setup_pptable(struct smu_context *smu) 391 + static int smu_v13_0_0_get_pptable_from_pmfw(struct smu_context *smu, 392 + void **table, 393 + uint32_t *size) 392 394 { 393 395 struct smu_table_context *smu_table = &smu->smu_table; 394 396 void *combo_pptable = smu_table->combo_pptable; 397 + int ret = 0; 398 + 399 + ret = smu_cmn_get_combo_pptable(smu); 400 + if (ret) 401 + return ret; 402 + 403 + *table = combo_pptable; 404 + *size = sizeof(struct smu_13_0_0_powerplay_table); 405 + 406 + return 0; 407 + } 408 + 409 + static int smu_v13_0_0_setup_pptable(struct smu_context *smu) 410 + { 411 + struct smu_table_context *smu_table = &smu->smu_table; 395 412 struct amdgpu_device *adev = smu->adev; 413 + uint32_t pptable_id; 396 414 int ret = 0; 397 415 398 416 /* ··· 419 401 * rely on the combo pptable(and its revelant SMU message). 420 402 */ 421 403 if (adev->scpm_enabled) { 422 - ret = smu_cmn_get_combo_pptable(smu); 423 - if (ret) 424 - return ret; 425 - 426 - smu->smu_table.power_play_table = combo_pptable; 427 - smu->smu_table.power_play_table_size = sizeof(struct smu_13_0_0_powerplay_table); 404 + ret = smu_v13_0_0_get_pptable_from_pmfw(smu, 405 + &smu_table->power_play_table, 406 + &smu_table->power_play_table_size); 428 407 } else { 429 - ret = smu_v13_0_setup_pptable(smu); 430 - if (ret) 431 - return ret; 408 + /* override pptable_id from driver parameter */ 409 + if (amdgpu_smu_pptable_id >= 0) { 410 + pptable_id = amdgpu_smu_pptable_id; 411 + dev_info(adev->dev, "override pptable id %d\n", pptable_id); 412 + } else { 413 + pptable_id = smu_table->boot_values.pp_table_id; 414 + } 415 + 416 + /* 417 + * Temporary solution for SMU V13.0.0 with SCPM disabled: 418 + * - use vbios carried pptable when pptable_id is 3664, 3715 or 3795 419 + * - use soft pptable when pptable_id is 3683 420 + */ 421 + if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) { 422 + switch (pptable_id) { 423 + case 3664: 424 + case 3715: 425 + case 3795: 426 + pptable_id = 0; 427 + break; 428 + case 3683: 429 + break; 430 + default: 431 + dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id); 432 + return -EINVAL; 433 + } 434 + } 435 + 436 + /* force using vbios pptable in sriov mode */ 437 + if ((amdgpu_sriov_vf(adev) || !pptable_id) && (amdgpu_emu_mode != 1)) 438 + ret = smu_v13_0_0_get_pptable_from_pmfw(smu, 439 + &smu_table->power_play_table, 440 + &smu_table->power_play_table_size); 441 + else 442 + ret = smu_v13_0_get_pptable_from_firmware(smu, 443 + &smu_table->power_play_table, 444 + &smu_table->power_play_table_size, 445 + pptable_id); 432 446 } 447 + if (ret) 448 + return ret; 433 449 434 450 ret = smu_v13_0_0_store_powerplay_table(smu); 435 451 if (ret)
+22 -13
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
··· 400 400 return 0; 401 401 } 402 402 403 + static int smu_v13_0_7_get_pptable_from_pmfw(struct smu_context *smu, 404 + void **table, 405 + uint32_t *size) 406 + { 407 + struct smu_table_context *smu_table = &smu->smu_table; 408 + void *combo_pptable = smu_table->combo_pptable; 409 + int ret = 0; 410 + 411 + ret = smu_cmn_get_combo_pptable(smu); 412 + if (ret) 413 + return ret; 414 + 415 + *table = combo_pptable; 416 + *size = sizeof(struct smu_13_0_7_powerplay_table); 417 + 418 + return 0; 419 + } 403 420 404 421 static int smu_v13_0_7_setup_pptable(struct smu_context *smu) 405 422 { 406 423 struct smu_table_context *smu_table = &smu->smu_table; 407 - void *combo_pptable = smu_table->combo_pptable; 408 424 struct amdgpu_device *adev = smu->adev; 409 425 int ret = 0; 410 426 ··· 429 413 * be used directly by driver. To get the raw pptable, we need to 430 414 * rely on the combo pptable(and its revelant SMU message). 431 415 */ 432 - if (adev->scpm_enabled) { 433 - ret = smu_cmn_get_combo_pptable(smu); 434 - if (ret) 435 - return ret; 436 - 437 - smu->smu_table.power_play_table = combo_pptable; 438 - smu->smu_table.power_play_table_size = sizeof(struct smu_13_0_7_powerplay_table); 439 - } else { 440 - ret = smu_v13_0_setup_pptable(smu); 441 - if (ret) 442 - return ret; 443 - } 416 + ret = smu_v13_0_7_get_pptable_from_pmfw(smu, 417 + &smu_table->power_play_table, 418 + &smu_table->power_play_table_size); 419 + if (ret) 420 + return ret; 444 421 445 422 ret = smu_v13_0_7_store_powerplay_table(smu); 446 423 if (ret)
+7
drivers/gpu/drm/i915/display/icl_dsi.c
··· 2070 2070 else 2071 2071 intel_dsi->ports = BIT(port); 2072 2072 2073 + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports)) 2074 + intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports; 2075 + 2073 2076 intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports; 2077 + 2078 + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports)) 2079 + intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports; 2080 + 2074 2081 intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports; 2075 2082 2076 2083 for_each_dsi_port(port, intel_dsi->ports) {
+20 -17
drivers/gpu/drm/i915/display/intel_backlight.c
··· 16 16 #include "intel_dsi_dcs_backlight.h" 17 17 #include "intel_panel.h" 18 18 #include "intel_pci_config.h" 19 + #include "intel_pps.h" 19 20 20 21 /** 21 22 * scale - scale values from one range to another ··· 972 971 if (!name) 973 972 return -ENOMEM; 974 973 975 - bd = backlight_device_register(name, connector->base.kdev, connector, 976 - &intel_backlight_device_ops, &props); 977 - 978 - /* 979 - * Using the same name independent of the drm device or connector 980 - * prevents registration of multiple backlight devices in the 981 - * driver. However, we need to use the default name for backward 982 - * compatibility. Use unique names for subsequent backlight devices as a 983 - * fallback when the default name already exists. 984 - */ 985 - if (IS_ERR(bd) && PTR_ERR(bd) == -EEXIST) { 974 + bd = backlight_device_get_by_name(name); 975 + if (bd) { 976 + put_device(&bd->dev); 977 + /* 978 + * Using the same name independent of the drm device or connector 979 + * prevents registration of multiple backlight devices in the 980 + * driver. However, we need to use the default name for backward 981 + * compatibility. Use unique names for subsequent backlight devices as a 982 + * fallback when the default name already exists. 983 + */ 986 984 kfree(name); 987 985 name = kasprintf(GFP_KERNEL, "card%d-%s-backlight", 988 986 i915->drm.primary->index, connector->base.name); 989 987 if (!name) 990 988 return -ENOMEM; 991 - 992 - bd = backlight_device_register(name, connector->base.kdev, connector, 993 - &intel_backlight_device_ops, &props); 994 989 } 990 + bd = backlight_device_register(name, connector->base.kdev, connector, 991 + &intel_backlight_device_ops, &props); 995 992 996 993 if (IS_ERR(bd)) { 997 994 drm_err(&i915->drm, ··· 1772 1773 panel->backlight.pwm_funcs = &i9xx_pwm_funcs; 1773 1774 } 1774 1775 1775 - if (connector->base.connector_type == DRM_MODE_CONNECTOR_eDP && 1776 - intel_dp_aux_init_backlight_funcs(connector) == 0) 1777 - return; 1776 + if (connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) { 1777 + if (intel_dp_aux_init_backlight_funcs(connector) == 0) 1778 + return; 1779 + 1780 + if (!(dev_priv->quirks & QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK)) 1781 + connector->panel.backlight.power = intel_pps_backlight_power; 1782 + } 1778 1783 1779 1784 /* We're using a standard PWM backlight interface */ 1780 1785 panel->backlight.funcs = &pwm_bl_funcs;
+6 -4
drivers/gpu/drm/i915/display/intel_bios.c
··· 1596 1596 struct intel_panel *panel, 1597 1597 enum port port) 1598 1598 { 1599 + enum port port_bc = DISPLAY_VER(i915) >= 11 ? PORT_B : PORT_C; 1600 + 1599 1601 if (!panel->vbt.dsi.config->dual_link || i915->vbt.version < 197) { 1600 1602 panel->vbt.dsi.bl_ports = BIT(port); 1601 1603 if (panel->vbt.dsi.config->cabc_supported) ··· 1611 1609 panel->vbt.dsi.bl_ports = BIT(PORT_A); 1612 1610 break; 1613 1611 case DL_DCS_PORT_C: 1614 - panel->vbt.dsi.bl_ports = BIT(PORT_C); 1612 + panel->vbt.dsi.bl_ports = BIT(port_bc); 1615 1613 break; 1616 1614 default: 1617 1615 case DL_DCS_PORT_A_AND_C: 1618 - panel->vbt.dsi.bl_ports = BIT(PORT_A) | BIT(PORT_C); 1616 + panel->vbt.dsi.bl_ports = BIT(PORT_A) | BIT(port_bc); 1619 1617 break; 1620 1618 } 1621 1619 ··· 1627 1625 panel->vbt.dsi.cabc_ports = BIT(PORT_A); 1628 1626 break; 1629 1627 case DL_DCS_PORT_C: 1630 - panel->vbt.dsi.cabc_ports = BIT(PORT_C); 1628 + panel->vbt.dsi.cabc_ports = BIT(port_bc); 1631 1629 break; 1632 1630 default: 1633 1631 case DL_DCS_PORT_A_AND_C: 1634 1632 panel->vbt.dsi.cabc_ports = 1635 - BIT(PORT_A) | BIT(PORT_C); 1633 + BIT(PORT_A) | BIT(port_bc); 1636 1634 break; 1637 1635 } 1638 1636 }
+9 -7
drivers/gpu/drm/i915/display/intel_bw.c
··· 404 404 int clpchgroup; 405 405 int j; 406 406 407 - if (i < num_groups - 1) 408 - bi_next = &dev_priv->max_bw[i + 1]; 409 - 410 407 clpchgroup = (sa->deburst * qi.deinterleave / num_channels) << i; 411 408 412 - if (i < num_groups - 1 && clpchgroup < clperchgroup) 413 - bi_next->num_planes = (ipqdepth - clpchgroup) / clpchgroup + 1; 414 - else 415 - bi_next->num_planes = 0; 409 + if (i < num_groups - 1) { 410 + bi_next = &dev_priv->max_bw[i + 1]; 411 + 412 + if (clpchgroup < clperchgroup) 413 + bi_next->num_planes = (ipqdepth - clpchgroup) / 414 + clpchgroup + 1; 415 + else 416 + bi_next->num_planes = 0; 417 + } 416 418 417 419 bi->num_qgv_points = qi.num_points; 418 420 bi->num_psf_gv_points = qi.num_psf_points;
-2
drivers/gpu/drm/i915/display/intel_dp.c
··· 5293 5293 5294 5294 intel_panel_init(intel_connector); 5295 5295 5296 - if (!(dev_priv->quirks & QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK)) 5297 - intel_connector->panel.backlight.power = intel_pps_backlight_power; 5298 5296 intel_backlight_setup(intel_connector, pipe); 5299 5297 5300 5298 intel_edp_add_properties(intel_dp);
+3
drivers/gpu/drm/i915/display/intel_quirks.c
··· 191 191 /* ASRock ITX*/ 192 192 { 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, 193 193 { 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, 194 + /* ECS Liva Q2 */ 195 + { 0x3185, 0x1019, 0xa94d, quirk_increase_ddi_disabled_time }, 196 + { 0x3184, 0x1019, 0xa94d, quirk_increase_ddi_disabled_time }, 194 197 }; 195 198 196 199 void intel_init_quirks(struct drm_i915_private *i915)
+7
drivers/gpu/drm/i915/display/vlv_dsi.c
··· 1933 1933 else 1934 1934 intel_dsi->ports = BIT(port); 1935 1935 1936 + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports)) 1937 + intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports; 1938 + 1936 1939 intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports; 1940 + 1941 + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports)) 1942 + intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports; 1943 + 1937 1944 intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports; 1938 1945 1939 1946 /* Create a DSI host (and a device) for each port. */
+21 -23
drivers/gpu/drm/i915/gt/intel_migrate.c
··· 638 638 return 0; 639 639 } 640 640 641 - static int scatter_list_length(struct scatterlist *sg) 641 + static u64 scatter_list_length(struct scatterlist *sg) 642 642 { 643 - int len = 0; 643 + u64 len = 0; 644 644 645 645 while (sg && sg_dma_len(sg)) { 646 646 len += sg_dma_len(sg); ··· 650 650 return len; 651 651 } 652 652 653 - static void 653 + static int 654 654 calculate_chunk_sz(struct drm_i915_private *i915, bool src_is_lmem, 655 - int *src_sz, u32 bytes_to_cpy, u32 ccs_bytes_to_cpy) 655 + u64 bytes_to_cpy, u64 ccs_bytes_to_cpy) 656 656 { 657 - if (ccs_bytes_to_cpy) { 658 - if (!src_is_lmem) 659 - /* 660 - * When CHUNK_SZ is passed all the pages upto CHUNK_SZ 661 - * will be taken for the blt. in Flat-ccs supported 662 - * platform Smem obj will have more pages than required 663 - * for main meory hence limit it to the required size 664 - * for main memory 665 - */ 666 - *src_sz = min_t(int, bytes_to_cpy, CHUNK_SZ); 667 - } else { /* ccs handling is not required */ 668 - *src_sz = CHUNK_SZ; 669 - } 657 + if (ccs_bytes_to_cpy && !src_is_lmem) 658 + /* 659 + * When CHUNK_SZ is passed all the pages upto CHUNK_SZ 660 + * will be taken for the blt. in Flat-ccs supported 661 + * platform Smem obj will have more pages than required 662 + * for main meory hence limit it to the required size 663 + * for main memory 664 + */ 665 + return min_t(u64, bytes_to_cpy, CHUNK_SZ); 666 + else 667 + return CHUNK_SZ; 670 668 } 671 669 672 - static void get_ccs_sg_sgt(struct sgt_dma *it, u32 bytes_to_cpy) 670 + static void get_ccs_sg_sgt(struct sgt_dma *it, u64 bytes_to_cpy) 673 671 { 674 - u32 len; 672 + u64 len; 675 673 676 674 do { 677 675 GEM_BUG_ON(!it->sg || !sg_dma_len(it->sg)); ··· 700 702 { 701 703 struct sgt_dma it_src = sg_sgt(src), it_dst = sg_sgt(dst), it_ccs; 702 704 struct drm_i915_private *i915 = ce->engine->i915; 703 - u32 ccs_bytes_to_cpy = 0, bytes_to_cpy; 705 + u64 ccs_bytes_to_cpy = 0, bytes_to_cpy; 704 706 enum i915_cache_level ccs_cache_level; 705 707 u32 src_offset, dst_offset; 706 708 u8 src_access, dst_access; 707 709 struct i915_request *rq; 708 - int src_sz, dst_sz; 710 + u64 src_sz, dst_sz; 709 711 bool ccs_is_src, overwrite_ccs; 710 712 int err; 711 713 ··· 788 790 if (err) 789 791 goto out_rq; 790 792 791 - calculate_chunk_sz(i915, src_is_lmem, &src_sz, 792 - bytes_to_cpy, ccs_bytes_to_cpy); 793 + src_sz = calculate_chunk_sz(i915, src_is_lmem, 794 + bytes_to_cpy, ccs_bytes_to_cpy); 793 795 794 796 len = emit_pte(rq, &it_src, src_cache_level, src_is_lmem, 795 797 src_offset, src_sz);
+7
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
··· 4027 4027 xa_destroy(&guc->context_lookup); 4028 4028 4029 4029 /* 4030 + * A reset might have occurred while we had a pending stalled request, 4031 + * so make sure we clean that up. 4032 + */ 4033 + guc->stalled_request = NULL; 4034 + guc->submission_stall_reason = STALL_NONE; 4035 + 4036 + /* 4030 4037 * Some contexts might have been pinned before we enabled GuC 4031 4038 * submission, so we need to add them to the GuC bookeeping. 4032 4039 * Also, after a reset the of the GuC we want to make sure that the
+2 -2
drivers/gpu/drm/i915/gvt/aperture_gm.c
··· 298 298 } 299 299 300 300 /** 301 - * inte_gvt_free_vgpu_resource - free HW resource owned by a vGPU 301 + * intel_vgpu_free_resource() - free HW resource owned by a vGPU 302 302 * @vgpu: a vGPU 303 303 * 304 304 * This function is used to free the HW resource owned by a vGPU. ··· 328 328 } 329 329 330 330 /** 331 - * intel_alloc_vgpu_resource - allocate HW resource for a vGPU 331 + * intel_vgpu_alloc_resource() - allocate HW resource for a vGPU 332 332 * @vgpu: vGPU 333 333 * @param: vGPU creation params 334 334 *
+1 -1
drivers/gpu/drm/i915/gvt/gtt.c
··· 2341 2341 gvt_vgpu_err("fail to populate guest ggtt entry\n"); 2342 2342 /* guest driver may read/write the entry when partial 2343 2343 * update the entry in this situation p2m will fail 2344 - * settting the shadow entry to point to a scratch page 2344 + * setting the shadow entry to point to a scratch page 2345 2345 */ 2346 2346 ops->set_pfn(&m, gvt->gtt.scratch_mfn); 2347 2347 } else
+2 -2
drivers/gpu/drm/i915/gvt/handlers.c
··· 905 905 else if (FDI_RX_IMR_TO_PIPE(offset) != INVALID_INDEX) 906 906 index = FDI_RX_IMR_TO_PIPE(offset); 907 907 else { 908 - gvt_vgpu_err("Unsupport registers %x\n", offset); 908 + gvt_vgpu_err("Unsupported registers %x\n", offset); 909 909 return -EINVAL; 910 910 } 911 911 ··· 3052 3052 } 3053 3053 3054 3054 /** 3055 - * intel_t_default_mmio_write - default MMIO write handler 3055 + * intel_vgpu_default_mmio_write() - default MMIO write handler 3056 3056 * @vgpu: a vGPU 3057 3057 * @offset: access offset 3058 3058 * @p_data: write data buffer
+1 -1
drivers/gpu/drm/i915/gvt/mmio_context.c
··· 546 546 } 547 547 548 548 /** 549 - * intel_gvt_switch_render_mmio - switch mmio context of specific engine 549 + * intel_gvt_switch_mmio - switch mmio context of specific engine 550 550 * @pre: the last vGPU that own the engine 551 551 * @next: the vGPU to switch to 552 552 * @engine: the engine
+2 -1
drivers/gpu/drm/i915/intel_gvt_mmio_table.c
··· 1076 1076 MMIO_D(GEN8_HDC_CHICKEN1); 1077 1077 MMIO_D(GEN9_WM_CHICKEN3); 1078 1078 1079 - if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) 1079 + if (IS_KABYLAKE(dev_priv) || 1080 + IS_COFFEELAKE(dev_priv) || IS_COMETLAKE(dev_priv)) 1080 1081 MMIO_D(GAMT_CHKN_BIT_REG); 1081 1082 if (!IS_BROXTON(dev_priv)) 1082 1083 MMIO_D(GEN9_CTX_PREEMPT_REG);
+7 -1
drivers/gpu/drm/i915/intel_pm.c
··· 6561 6561 enum plane_id plane_id; 6562 6562 u8 slices; 6563 6563 6564 - skl_pipe_wm_get_hw_state(crtc, &crtc_state->wm.skl.optimal); 6564 + memset(&crtc_state->wm.skl.optimal, 0, 6565 + sizeof(crtc_state->wm.skl.optimal)); 6566 + if (crtc_state->hw.active) 6567 + skl_pipe_wm_get_hw_state(crtc, &crtc_state->wm.skl.optimal); 6565 6568 crtc_state->wm.skl.raw = crtc_state->wm.skl.optimal; 6566 6569 6567 6570 memset(&dbuf_state->ddb[pipe], 0, sizeof(dbuf_state->ddb[pipe])); ··· 6574 6571 &crtc_state->wm.skl.plane_ddb[plane_id]; 6575 6572 struct skl_ddb_entry *ddb_y = 6576 6573 &crtc_state->wm.skl.plane_ddb_y[plane_id]; 6574 + 6575 + if (!crtc_state->hw.active) 6576 + continue; 6577 6577 6578 6578 skl_ddb_get_hw_plane_state(dev_priv, crtc->pipe, 6579 6579 plane_id, ddb, ddb_y);
+6
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
··· 2061 2061 2062 2062 intf_cfg.stream_sel = 0; /* Don't care value for video mode */ 2063 2063 intf_cfg.mode_3d = dpu_encoder_helper_get_3d_blend_mode(phys_enc); 2064 + 2065 + if (phys_enc->hw_intf) 2066 + intf_cfg.intf = phys_enc->hw_intf->idx; 2067 + if (phys_enc->hw_wb) 2068 + intf_cfg.wb = phys_enc->hw_wb->idx; 2069 + 2064 2070 if (phys_enc->hw_pp->merge_3d) 2065 2071 intf_cfg.merge_3d = phys_enc->hw_pp->merge_3d->idx; 2066 2072
+1 -1
drivers/gpu/drm/msm/dp/dp_ctrl.c
··· 1214 1214 if (ret) 1215 1215 return ret; 1216 1216 1217 - dp_ctrl_train_pattern_set(ctrl, pattern | DP_RECOVERED_CLOCK_OUT_EN); 1217 + dp_ctrl_train_pattern_set(ctrl, pattern); 1218 1218 1219 1219 for (tries = 0; tries <= maximum_retries; tries++) { 1220 1220 drm_dp_link_train_channel_eq_delay(ctrl->aux, ctrl->panel->dpcd);
+2 -2
drivers/gpu/drm/msm/dsi/dsi_cfg.c
··· 109 109 static const struct msm_dsi_config msm8996_dsi_cfg = { 110 110 .io_offset = DSI_6G_REG_SHIFT, 111 111 .reg_cfg = { 112 - .num = 2, 112 + .num = 3, 113 113 .regs = { 114 114 {"vdda", 18160, 1 }, /* 1.25 V */ 115 115 {"vcca", 17000, 32 }, /* 0.925 V */ ··· 148 148 static const struct msm_dsi_config sdm660_dsi_cfg = { 149 149 .io_offset = DSI_6G_REG_SHIFT, 150 150 .reg_cfg = { 151 - .num = 2, 151 + .num = 1, 152 152 .regs = { 153 153 {"vdda", 12560, 4 }, /* 1.2 V */ 154 154 },
+1 -1
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
··· 347 347 } else { 348 348 timing->shared_timings.clk_pre = 349 349 linear_inter(tmax, tmin, pcnt2, 0, false); 350 - timing->shared_timings.clk_pre_inc_by_2 = 0; 350 + timing->shared_timings.clk_pre_inc_by_2 = 0; 351 351 } 352 352 353 353 timing->ta_go = 3;
+2
drivers/gpu/drm/msm/msm_drv.c
··· 469 469 } 470 470 } 471 471 472 + drm_helper_move_panel_connectors_to_head(ddev); 473 + 472 474 ddev->mode_config.funcs = &mode_config_funcs; 473 475 ddev->mode_config.helper_private = &mode_config_helper_funcs; 474 476
+2
drivers/gpu/drm/msm/msm_gpu_devfreq.c
··· 213 213 214 214 if (IS_ERR(df->devfreq)) { 215 215 DRM_DEV_ERROR(&gpu->pdev->dev, "Couldn't initialize GPU devfreq\n"); 216 + dev_pm_qos_remove_request(&df->idle_freq); 217 + dev_pm_qos_remove_request(&df->boost_freq); 216 218 df->devfreq = NULL; 217 219 return; 218 220 }
+3
drivers/gpu/drm/msm/msm_rd.c
··· 196 196 file->private_data = rd; 197 197 rd->open = true; 198 198 199 + /* Reset fifo to clear any previously unread data: */ 200 + rd->fifo.head = rd->fifo.tail = 0; 201 + 199 202 /* the parsing tools need to know gpu-id to know which 200 203 * register database to load. 201 204 *
+3
drivers/hwmon/gpio-fan.c
··· 391 391 if (!fan_data) 392 392 return -EINVAL; 393 393 394 + if (state >= fan_data->num_speed) 395 + return -EINVAL; 396 + 394 397 set_fan_speed(fan_data, state); 395 398 return 0; 396 399 }
+12 -7
drivers/hwmon/pmbus/pmbus_core.c
··· 2861 2861 .data = -1, 2862 2862 }; 2863 2863 2864 - if (!data->vout_low[page]) { 2864 + if (data->vout_low[page] < 0) { 2865 2865 if (pmbus_check_word_register(client, page, PMBUS_MFR_VOUT_MIN)) 2866 2866 s.data = _pmbus_read_word_data(client, page, 0xff, 2867 2867 PMBUS_MFR_VOUT_MIN); ··· 2887 2887 .data = -1, 2888 2888 }; 2889 2889 2890 - if (!data->vout_high[page]) { 2890 + if (data->vout_high[page] < 0) { 2891 2891 if (pmbus_check_word_register(client, page, PMBUS_MFR_VOUT_MAX)) 2892 2892 s.data = _pmbus_read_word_data(client, page, 0xff, 2893 2893 PMBUS_MFR_VOUT_MAX); ··· 3016 3016 3017 3017 rdev = devm_regulator_register(dev, &info->reg_desc[i], 3018 3018 &config); 3019 - if (IS_ERR(rdev)) { 3020 - dev_err(dev, "Failed to register %s regulator\n", 3021 - info->reg_desc[i].name); 3022 - return PTR_ERR(rdev); 3023 - } 3019 + if (IS_ERR(rdev)) 3020 + return dev_err_probe(dev, PTR_ERR(rdev), 3021 + "Failed to register %s regulator\n", 3022 + info->reg_desc[i].name); 3024 3023 } 3025 3024 3026 3025 return 0; ··· 3319 3320 struct pmbus_data *data; 3320 3321 size_t groups_num = 0; 3321 3322 int ret; 3323 + int i; 3322 3324 char *name; 3323 3325 3324 3326 if (!info) ··· 3352 3352 data->info = info; 3353 3353 data->currpage = -1; 3354 3354 data->currphase = -1; 3355 + 3356 + for (i = 0; i < ARRAY_SIZE(data->vout_low); i++) { 3357 + data->vout_low[i] = -1; 3358 + data->vout_high[i] = -1; 3359 + } 3355 3360 3356 3361 ret = pmbus_init_common(client, data, info); 3357 3362 if (ret < 0)
+1 -3
drivers/iio/adc/ad7292.c
··· 287 287 288 288 ret = devm_add_action_or_reset(&spi->dev, 289 289 ad7292_regulator_disable, st); 290 - if (ret) { 291 - regulator_disable(st->reg); 290 + if (ret) 292 291 return ret; 293 - } 294 292 295 293 ret = regulator_get_voltage(st->reg); 296 294 if (ret < 0)
+22 -6
drivers/iio/adc/mcp3911.c
··· 40 40 #define MCP3911_CHANNEL(x) (MCP3911_REG_CHANNEL0 + x * 3) 41 41 #define MCP3911_OFFCAL(x) (MCP3911_REG_OFFCAL_CH0 + x * 6) 42 42 43 - /* Internal voltage reference in uV */ 44 - #define MCP3911_INT_VREF_UV 1200000 43 + /* Internal voltage reference in mV */ 44 + #define MCP3911_INT_VREF_MV 1200 45 45 46 46 #define MCP3911_REG_READ(reg, id) ((((reg) << 1) | ((id) << 5) | (1 << 0)) & 0xff) 47 47 #define MCP3911_REG_WRITE(reg, id) ((((reg) << 1) | ((id) << 5) | (0 << 0)) & 0xff) ··· 113 113 if (ret) 114 114 goto out; 115 115 116 + *val = sign_extend32(*val, 23); 117 + 116 118 ret = IIO_VAL_INT; 117 119 break; 118 120 ··· 139 137 140 138 *val = ret / 1000; 141 139 } else { 142 - *val = MCP3911_INT_VREF_UV; 140 + *val = MCP3911_INT_VREF_MV; 143 141 } 144 142 145 - *val2 = 24; 146 - ret = IIO_VAL_FRACTIONAL_LOG2; 143 + /* 144 + * For 24bit Conversion 145 + * Raw = ((Voltage)/(Vref) * 2^23 * Gain * 1.5 146 + * Voltage = Raw * (Vref)/(2^23 * Gain * 1.5) 147 + */ 148 + 149 + /* val2 = (2^23 * 1.5) */ 150 + *val2 = 12582912; 151 + ret = IIO_VAL_FRACTIONAL; 147 152 break; 148 153 } 149 154 ··· 217 208 u32 configreg; 218 209 int ret; 219 210 220 - device_property_read_u32(dev, "device-addr", &adc->dev_addr); 211 + ret = device_property_read_u32(dev, "microchip,device-addr", &adc->dev_addr); 212 + 213 + /* 214 + * Fallback to "device-addr" due to historical mismatch between 215 + * dt-bindings and implementation 216 + */ 217 + if (ret) 218 + device_property_read_u32(dev, "device-addr", &adc->dev_addr); 221 219 if (adc->dev_addr > 3) { 222 220 dev_err(&adc->spi->dev, 223 221 "invalid device address (%i). Must be in range 0-3.\n",
+1 -1
drivers/iio/light/cm32181.c
··· 505 505 cm32181->conf_regs[CM32181_REG_ADDR_CMD]); 506 506 } 507 507 508 - DEFINE_SIMPLE_DEV_PM_OPS(cm32181_pm_ops, cm32181_suspend, cm32181_resume); 508 + static DEFINE_SIMPLE_DEV_PM_OPS(cm32181_pm_ops, cm32181_suspend, cm32181_resume); 509 509 510 510 static const struct of_device_id cm32181_of_match[] = { 511 511 { .compatible = "capella,cm3218" },
+4 -2
drivers/iio/light/cm3605.c
··· 226 226 } 227 227 228 228 irq = platform_get_irq(pdev, 0); 229 - if (irq < 0) 230 - return dev_err_probe(dev, irq, "failed to get irq\n"); 229 + if (irq < 0) { 230 + ret = dev_err_probe(dev, irq, "failed to get irq\n"); 231 + goto out_disable_aset; 232 + } 231 233 232 234 ret = devm_request_threaded_irq(dev, irq, cm3605_prox_irq, 233 235 NULL, 0, "cm3605", indio_dev);
+1
drivers/input/joystick/iforce/iforce-main.c
··· 50 50 { 0x046d, 0xc291, "Logitech WingMan Formula Force", btn_wheel, abs_wheel, ff_iforce }, 51 51 { 0x05ef, 0x020a, "AVB Top Shot Pegasus", btn_joystick_avb, abs_avb_pegasus, ff_iforce }, 52 52 { 0x05ef, 0x8884, "AVB Mag Turbo Force", btn_wheel, abs_wheel, ff_iforce }, 53 + { 0x05ef, 0x8886, "Boeder Force Feedback Wheel", btn_wheel, abs_wheel, ff_iforce }, 53 54 { 0x05ef, 0x8888, "AVB Top Shot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? 54 55 { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //? 55 56 { 0x061c, 0xc084, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce },
+3 -3
drivers/input/joystick/iforce/iforce-serio.c
··· 39 39 40 40 again: 41 41 if (iforce->xmit.head == iforce->xmit.tail) { 42 - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); 42 + iforce_clear_xmit_and_wake(iforce); 43 43 spin_unlock_irqrestore(&iforce->xmit_lock, flags); 44 44 return; 45 45 } ··· 64 64 if (test_and_clear_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags)) 65 65 goto again; 66 66 67 - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); 67 + iforce_clear_xmit_and_wake(iforce); 68 68 69 69 spin_unlock_irqrestore(&iforce->xmit_lock, flags); 70 70 } ··· 169 169 iforce_serio->cmd_response_len = iforce_serio->len; 170 170 171 171 /* Signal that command is done */ 172 - wake_up(&iforce->wait); 172 + wake_up_all(&iforce->wait); 173 173 } else if (likely(iforce->type)) { 174 174 iforce_process_packet(iforce, iforce_serio->id, 175 175 iforce_serio->data_in,
+4 -4
drivers/input/joystick/iforce/iforce-usb.c
··· 30 30 spin_lock_irqsave(&iforce->xmit_lock, flags); 31 31 32 32 if (iforce->xmit.head == iforce->xmit.tail) { 33 - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); 33 + iforce_clear_xmit_and_wake(iforce); 34 34 spin_unlock_irqrestore(&iforce->xmit_lock, flags); 35 35 return; 36 36 } ··· 58 58 XMIT_INC(iforce->xmit.tail, n); 59 59 60 60 if ( (n=usb_submit_urb(iforce_usb->out, GFP_ATOMIC)) ) { 61 - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); 62 61 dev_warn(&iforce_usb->intf->dev, 63 62 "usb_submit_urb failed %d\n", n); 63 + iforce_clear_xmit_and_wake(iforce); 64 64 } 65 65 66 66 /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. ··· 175 175 struct iforce *iforce = &iforce_usb->iforce; 176 176 177 177 if (urb->status) { 178 - clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); 179 178 dev_dbg(&iforce_usb->intf->dev, "urb->status %d, exiting\n", 180 179 urb->status); 180 + iforce_clear_xmit_and_wake(iforce); 181 181 return; 182 182 } 183 183 184 184 __iforce_usb_xmit(iforce); 185 185 186 - wake_up(&iforce->wait); 186 + wake_up_all(&iforce->wait); 187 187 } 188 188 189 189 static int iforce_usb_probe(struct usb_interface *intf,
+6
drivers/input/joystick/iforce/iforce.h
··· 119 119 response_data, response_len); 120 120 } 121 121 122 + static inline void iforce_clear_xmit_and_wake(struct iforce *iforce) 123 + { 124 + clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); 125 + wake_up_all(&iforce->wait); 126 + } 127 + 122 128 /* Public functions */ 123 129 /* iforce-main.c */ 124 130 int iforce_init_device(struct device *parent, u16 bustype,
+1
drivers/input/misc/rk805-pwrkey.c
··· 98 98 }; 99 99 module_platform_driver(rk805_pwrkey_driver); 100 100 101 + MODULE_ALIAS("platform:rk805-pwrkey"); 101 102 MODULE_AUTHOR("Joseph Chen <chenjh@rock-chips.com>"); 102 103 MODULE_DESCRIPTION("RK805 PMIC Power Key driver"); 103 104 MODULE_LICENSE("GPL");
+2
drivers/input/touchscreen/goodix.c
··· 95 95 96 96 static const struct goodix_chip_id goodix_chip_ids[] = { 97 97 { .id = "1151", .data = &gt1x_chip_data }, 98 + { .id = "1158", .data = &gt1x_chip_data }, 98 99 { .id = "5663", .data = &gt1x_chip_data }, 99 100 { .id = "5688", .data = &gt1x_chip_data }, 100 101 { .id = "917S", .data = &gt1x_chip_data }, ··· 1509 1508 #ifdef CONFIG_OF 1510 1509 static const struct of_device_id goodix_of_match[] = { 1511 1510 { .compatible = "goodix,gt1151" }, 1511 + { .compatible = "goodix,gt1158" }, 1512 1512 { .compatible = "goodix,gt5663" }, 1513 1513 { .compatible = "goodix,gt5688" }, 1514 1514 { .compatible = "goodix,gt911" },
+1 -1
drivers/iommu/of_iommu.c
··· 40 40 * a proper probe-ordering dependency mechanism in future. 41 41 */ 42 42 if (!ops) 43 - return -ENODEV; 43 + return driver_deferred_probe_check_state(dev); 44 44 45 45 if (!try_module_get(ops->owner)) 46 46 return -ENODEV;
+14 -21
drivers/media/rc/mceusb.c
··· 1416 1416 { 1417 1417 int ret; 1418 1418 struct device *dev = ir->dev; 1419 - char *data; 1420 - 1421 - data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL); 1422 - if (!data) { 1423 - dev_err(dev, "%s: memory allocation failed!", __func__); 1424 - return; 1425 - } 1419 + char data[USB_CTRL_MSG_SZ]; 1426 1420 1427 1421 /* 1428 1422 * This is a strange one. Windows issues a set address to the device 1429 1423 * on the receive control pipe and expect a certain value pair back 1430 1424 */ 1431 - ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), 1432 - USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, 1433 - data, USB_CTRL_MSG_SZ, 3000); 1425 + ret = usb_control_msg_recv(ir->usbdev, 0, USB_REQ_SET_ADDRESS, 1426 + USB_DIR_IN | USB_TYPE_VENDOR, 1427 + 0, 0, data, USB_CTRL_MSG_SZ, 3000, 1428 + GFP_KERNEL); 1434 1429 dev_dbg(dev, "set address - ret = %d", ret); 1435 1430 dev_dbg(dev, "set address - data[0] = %d, data[1] = %d", 1436 1431 data[0], data[1]); 1437 1432 1438 1433 /* set feature: bit rate 38400 bps */ 1439 - ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 1440 - USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, 1441 - 0xc04e, 0x0000, NULL, 0, 3000); 1434 + ret = usb_control_msg_send(ir->usbdev, 0, 1435 + USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, 1436 + 0xc04e, 0x0000, NULL, 0, 3000, GFP_KERNEL); 1442 1437 1443 1438 dev_dbg(dev, "set feature - ret = %d", ret); 1444 1439 1445 1440 /* bRequest 4: set char length to 8 bits */ 1446 - ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 1447 - 4, USB_TYPE_VENDOR, 1448 - 0x0808, 0x0000, NULL, 0, 3000); 1441 + ret = usb_control_msg_send(ir->usbdev, 0, 1442 + 4, USB_TYPE_VENDOR, 1443 + 0x0808, 0x0000, NULL, 0, 3000, GFP_KERNEL); 1449 1444 dev_dbg(dev, "set char length - retB = %d", ret); 1450 1445 1451 1446 /* bRequest 2: set handshaking to use DTR/DSR */ 1452 - ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 1453 - 2, USB_TYPE_VENDOR, 1454 - 0x0000, 0x0100, NULL, 0, 3000); 1447 + ret = usb_control_msg_send(ir->usbdev, 0, 1448 + 2, USB_TYPE_VENDOR, 1449 + 0x0000, 0x0100, NULL, 0, 3000, GFP_KERNEL); 1455 1450 dev_dbg(dev, "set handshake - retC = %d", ret); 1456 1451 1457 1452 /* device resume */ ··· 1454 1459 1455 1460 /* get hw/sw revision? */ 1456 1461 mce_command_out(ir, GET_REVISION, sizeof(GET_REVISION)); 1457 - 1458 - kfree(data); 1459 1462 } 1460 1463 1461 1464 static void mceusb_gen2_init(struct mceusb_dev *ir)
+9 -5
drivers/misc/fastrpc.c
··· 25 25 #define SDSP_DOMAIN_ID (2) 26 26 #define CDSP_DOMAIN_ID (3) 27 27 #define FASTRPC_DEV_MAX 4 /* adsp, mdsp, slpi, cdsp*/ 28 - #define FASTRPC_MAX_SESSIONS 13 /*12 compute, 1 cpz*/ 28 + #define FASTRPC_MAX_SESSIONS 14 29 29 #define FASTRPC_MAX_VMIDS 16 30 30 #define FASTRPC_ALIGN 128 31 31 #define FASTRPC_MAX_FDLIST 16 ··· 1943 1943 of_property_read_u32(dev->of_node, "qcom,nsessions", &sessions); 1944 1944 1945 1945 spin_lock_irqsave(&cctx->lock, flags); 1946 - sess = &cctx->session[cctx->sesscount]; 1946 + if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) { 1947 + dev_err(&pdev->dev, "too many sessions\n"); 1948 + spin_unlock_irqrestore(&cctx->lock, flags); 1949 + return -ENOSPC; 1950 + } 1951 + sess = &cctx->session[cctx->sesscount++]; 1947 1952 sess->used = false; 1948 1953 sess->valid = true; 1949 1954 sess->dev = dev; ··· 1961 1956 struct fastrpc_session_ctx *dup_sess; 1962 1957 1963 1958 for (i = 1; i < sessions; i++) { 1964 - if (cctx->sesscount++ >= FASTRPC_MAX_SESSIONS) 1959 + if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) 1965 1960 break; 1966 - dup_sess = &cctx->session[cctx->sesscount]; 1961 + dup_sess = &cctx->session[cctx->sesscount++]; 1967 1962 memcpy(dup_sess, sess, sizeof(*dup_sess)); 1968 1963 } 1969 1964 } 1970 - cctx->sesscount++; 1971 1965 spin_unlock_irqrestore(&cctx->lock, flags); 1972 1966 rc = dma_set_mask(dev, DMA_BIT_MASK(32)); 1973 1967 if (rc) {
+18 -28
drivers/mmc/core/sd.c
··· 949 949 950 950 /* Erase init depends on CSD and SSR */ 951 951 mmc_init_erase(card); 952 - 953 - /* 954 - * Fetch switch information from card. 955 - */ 956 - err = mmc_read_switch(card); 957 - if (err) 958 - return err; 959 952 } 953 + 954 + /* 955 + * Fetch switch information from card. Note, sd3_bus_mode can change if 956 + * voltage switch outcome changes, so do this always. 957 + */ 958 + err = mmc_read_switch(card); 959 + if (err) 960 + return err; 960 961 961 962 /* 962 963 * For SPI, enable CRC as appropriate. ··· 1481 1480 if (!v18_fixup_failed && !mmc_host_is_spi(host) && mmc_host_uhs(host) && 1482 1481 mmc_sd_card_using_v18(card) && 1483 1482 host->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_180) { 1484 - /* 1485 - * Re-read switch information in case it has changed since 1486 - * oldcard was initialized. 1487 - */ 1488 - if (oldcard) { 1489 - err = mmc_read_switch(card); 1490 - if (err) 1491 - goto free_card; 1483 + if (mmc_host_set_uhs_voltage(host) || 1484 + mmc_sd_init_uhs_card(card)) { 1485 + v18_fixup_failed = true; 1486 + mmc_power_cycle(host, ocr); 1487 + if (!oldcard) 1488 + mmc_remove_card(card); 1489 + goto retry; 1492 1490 } 1493 - if (mmc_sd_card_using_v18(card)) { 1494 - if (mmc_host_set_uhs_voltage(host) || 1495 - mmc_sd_init_uhs_card(card)) { 1496 - v18_fixup_failed = true; 1497 - mmc_power_cycle(host, ocr); 1498 - if (!oldcard) 1499 - mmc_remove_card(card); 1500 - goto retry; 1501 - } 1502 - goto done; 1503 - } 1491 + goto cont; 1504 1492 } 1505 1493 1506 1494 /* Initialization sequence for UHS-I cards */ ··· 1524 1534 mmc_set_bus_width(host, MMC_BUS_WIDTH_4); 1525 1535 } 1526 1536 } 1527 - 1537 + cont: 1528 1538 if (!oldcard) { 1529 1539 /* Read/parse the extension registers. */ 1530 1540 err = sd_read_ext_regs(card); ··· 1556 1566 err = -EINVAL; 1557 1567 goto free_card; 1558 1568 } 1559 - done: 1569 + 1560 1570 host->card = card; 1561 1571 return 0; 1562 1572
+15 -5
drivers/net/bonding/bond_main.c
··· 3167 3167 found: 3168 3168 if (!ipv6_dev_get_saddr(dev_net(dst->dev), dst->dev, &targets[i], 0, &saddr)) 3169 3169 bond_ns_send(slave, &targets[i], &saddr, tags); 3170 + else 3171 + bond_ns_send(slave, &targets[i], &in6addr_any, tags); 3172 + 3170 3173 dst_release(dst); 3171 3174 kfree(tags); 3172 3175 } ··· 3201 3198 return ret; 3202 3199 } 3203 3200 3204 - static void bond_validate_ns(struct bonding *bond, struct slave *slave, 3201 + static void bond_validate_na(struct bonding *bond, struct slave *slave, 3205 3202 struct in6_addr *saddr, struct in6_addr *daddr) 3206 3203 { 3207 3204 int i; 3208 3205 3209 - if (ipv6_addr_any(saddr) || !bond_has_this_ip6(bond, daddr)) { 3206 + /* Ignore NAs that: 3207 + * 1. Source address is unspecified address. 3208 + * 2. Dest address is neither all-nodes multicast address nor 3209 + * exist on bond interface. 3210 + */ 3211 + if (ipv6_addr_any(saddr) || 3212 + (!ipv6_addr_equal(daddr, &in6addr_linklocal_allnodes) && 3213 + !bond_has_this_ip6(bond, daddr))) { 3210 3214 slave_dbg(bond->dev, slave->dev, "%s: sip %pI6c tip %pI6c not found\n", 3211 3215 __func__, saddr, daddr); 3212 3216 return; ··· 3256 3246 * see bond_arp_rcv(). 3257 3247 */ 3258 3248 if (bond_is_active_slave(slave)) 3259 - bond_validate_ns(bond, slave, saddr, daddr); 3249 + bond_validate_na(bond, slave, saddr, daddr); 3260 3250 else if (curr_active_slave && 3261 3251 time_after(slave_last_rx(bond, curr_active_slave), 3262 3252 curr_active_slave->last_link_up)) 3263 - bond_validate_ns(bond, slave, saddr, daddr); 3253 + bond_validate_na(bond, slave, saddr, daddr); 3264 3254 else if (curr_arp_slave && 3265 3255 bond_time_in_interval(bond, slave_last_tx(curr_arp_slave), 1)) 3266 - bond_validate_ns(bond, slave, saddr, daddr); 3256 + bond_validate_na(bond, slave, saddr, daddr); 3267 3257 3268 3258 out: 3269 3259 return RX_HANDLER_ANOTHER;
+24 -6
drivers/net/dsa/microchip/ksz_common.c
··· 170 170 .exit = ksz8_switch_exit, 171 171 }; 172 172 173 + static void ksz9477_phylink_mac_link_up(struct ksz_device *dev, int port, 174 + unsigned int mode, 175 + phy_interface_t interface, 176 + struct phy_device *phydev, int speed, 177 + int duplex, bool tx_pause, 178 + bool rx_pause); 179 + 173 180 static const struct ksz_dev_ops ksz9477_dev_ops = { 174 181 .setup = ksz9477_setup, 175 182 .get_port_addr = ksz9477_get_port_addr, ··· 203 196 .mdb_del = ksz9477_mdb_del, 204 197 .change_mtu = ksz9477_change_mtu, 205 198 .max_mtu = ksz9477_max_mtu, 199 + .phylink_mac_link_up = ksz9477_phylink_mac_link_up, 206 200 .config_cpu_port = ksz9477_config_cpu_port, 207 201 .enable_stp_addr = ksz9477_enable_stp_addr, 208 202 .reset = ksz9477_reset_switch, ··· 239 231 .mdb_del = ksz9477_mdb_del, 240 232 .change_mtu = lan937x_change_mtu, 241 233 .max_mtu = ksz9477_max_mtu, 234 + .phylink_mac_link_up = ksz9477_phylink_mac_link_up, 242 235 .config_cpu_port = lan937x_config_cpu_port, 243 236 .enable_stp_addr = ksz9477_enable_stp_addr, 244 237 .reset = lan937x_reset_switch, ··· 2349 2340 ksz_prmw8(dev, port, regs[P_XMII_CTRL_0], mask, val); 2350 2341 } 2351 2342 2352 - static void ksz_phylink_mac_link_up(struct dsa_switch *ds, int port, 2353 - unsigned int mode, 2354 - phy_interface_t interface, 2355 - struct phy_device *phydev, int speed, 2356 - int duplex, bool tx_pause, bool rx_pause) 2343 + static void ksz9477_phylink_mac_link_up(struct ksz_device *dev, int port, 2344 + unsigned int mode, 2345 + phy_interface_t interface, 2346 + struct phy_device *phydev, int speed, 2347 + int duplex, bool tx_pause, 2348 + bool rx_pause) 2357 2349 { 2358 - struct ksz_device *dev = ds->priv; 2359 2350 struct ksz_port *p; 2360 2351 2361 2352 p = &dev->ports[port]; ··· 2369 2360 ksz_port_set_xmii_speed(dev, port, speed); 2370 2361 2371 2362 ksz_duplex_flowctrl(dev, port, duplex, tx_pause, rx_pause); 2363 + } 2364 + 2365 + static void ksz_phylink_mac_link_up(struct dsa_switch *ds, int port, 2366 + unsigned int mode, 2367 + phy_interface_t interface, 2368 + struct phy_device *phydev, int speed, 2369 + int duplex, bool tx_pause, bool rx_pause) 2370 + { 2371 + struct ksz_device *dev = ds->priv; 2372 2372 2373 2373 if (dev->dev_ops->phylink_mac_link_up) 2374 2374 dev->dev_ops->phylink_mac_link_up(dev, port, mode, interface,
+112 -49
drivers/net/dsa/ocelot/felix_vsc9959.c
··· 22 22 #define VSC9959_NUM_PORTS 6 23 23 24 24 #define VSC9959_TAS_GCL_ENTRY_MAX 63 25 + #define VSC9959_TAS_MIN_GATE_LEN_NS 33 25 26 #define VSC9959_VCAP_POLICER_BASE 63 26 27 #define VSC9959_VCAP_POLICER_MAX 383 27 28 #define VSC9959_SWITCH_PCI_BAR 4 ··· 1479 1478 mdiobus_free(felix->imdio); 1480 1479 } 1481 1480 1481 + /* The switch considers any frame (regardless of size) as eligible for 1482 + * transmission if the traffic class gate is open for at least 33 ns. 1483 + * Overruns are prevented by cropping an interval at the end of the gate time 1484 + * slot for which egress scheduling is blocked, but we need to still keep 33 ns 1485 + * available for one packet to be transmitted, otherwise the port tc will hang. 1486 + * This function returns the size of a gate interval that remains available for 1487 + * setting the guard band, after reserving the space for one egress frame. 1488 + */ 1489 + static u64 vsc9959_tas_remaining_gate_len_ps(u64 gate_len_ns) 1490 + { 1491 + /* Gate always open */ 1492 + if (gate_len_ns == U64_MAX) 1493 + return U64_MAX; 1494 + 1495 + return (gate_len_ns - VSC9959_TAS_MIN_GATE_LEN_NS) * PSEC_PER_NSEC; 1496 + } 1497 + 1482 1498 /* Extract shortest continuous gate open intervals in ns for each traffic class 1483 1499 * of a cyclic tc-taprio schedule. If a gate is always open, the duration is 1484 1500 * considered U64_MAX. If the gate is always closed, it is considered 0. ··· 1557 1539 min_gate_len[tc] = 0; 1558 1540 } 1559 1541 1542 + /* ocelot_write_rix is a macro that concatenates QSYS_MAXSDU_CFG_* with _RSZ, 1543 + * so we need to spell out the register access to each traffic class in helper 1544 + * functions, to simplify callers 1545 + */ 1546 + static void vsc9959_port_qmaxsdu_set(struct ocelot *ocelot, int port, int tc, 1547 + u32 max_sdu) 1548 + { 1549 + switch (tc) { 1550 + case 0: 1551 + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_0, 1552 + port); 1553 + break; 1554 + case 1: 1555 + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_1, 1556 + port); 1557 + break; 1558 + case 2: 1559 + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_2, 1560 + port); 1561 + break; 1562 + case 3: 1563 + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_3, 1564 + port); 1565 + break; 1566 + case 4: 1567 + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_4, 1568 + port); 1569 + break; 1570 + case 5: 1571 + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_5, 1572 + port); 1573 + break; 1574 + case 6: 1575 + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_6, 1576 + port); 1577 + break; 1578 + case 7: 1579 + ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_7, 1580 + port); 1581 + break; 1582 + } 1583 + } 1584 + 1585 + static u32 vsc9959_port_qmaxsdu_get(struct ocelot *ocelot, int port, int tc) 1586 + { 1587 + switch (tc) { 1588 + case 0: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_0, port); 1589 + case 1: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_1, port); 1590 + case 2: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_2, port); 1591 + case 3: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_3, port); 1592 + case 4: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_4, port); 1593 + case 5: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_5, port); 1594 + case 6: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_6, port); 1595 + case 7: return ocelot_read_rix(ocelot, QSYS_QMAXSDU_CFG_7, port); 1596 + default: 1597 + return 0; 1598 + } 1599 + } 1600 + 1560 1601 /* Update QSYS_PORT_MAX_SDU to make sure the static guard bands added by the 1561 1602 * switch (see the ALWAYS_GUARD_BAND_SCH_Q comment) are correct at all MTU 1562 1603 * values (the default value is 1518). Also, for traffic class windows smaller ··· 1672 1595 1673 1596 vsc9959_tas_min_gate_lengths(ocelot_port->taprio, min_gate_len); 1674 1597 1598 + mutex_lock(&ocelot->fwd_domain_lock); 1599 + 1675 1600 for (tc = 0; tc < OCELOT_NUM_TC; tc++) { 1601 + u64 remaining_gate_len_ps; 1676 1602 u32 max_sdu; 1677 1603 1678 - if (min_gate_len[tc] == U64_MAX /* Gate always open */ || 1679 - min_gate_len[tc] * PSEC_PER_NSEC > needed_bit_time_ps) { 1604 + remaining_gate_len_ps = 1605 + vsc9959_tas_remaining_gate_len_ps(min_gate_len[tc]); 1606 + 1607 + if (remaining_gate_len_ps > needed_bit_time_ps) { 1680 1608 /* Setting QMAXSDU_CFG to 0 disables oversized frame 1681 1609 * dropping. 1682 1610 */ ··· 1694 1612 /* If traffic class doesn't support a full MTU sized 1695 1613 * frame, make sure to enable oversize frame dropping 1696 1614 * for frames larger than the smallest that would fit. 1615 + * 1616 + * However, the exact same register, QSYS_QMAXSDU_CFG_*, 1617 + * controls not only oversized frame dropping, but also 1618 + * per-tc static guard band lengths, so it reduces the 1619 + * useful gate interval length. Therefore, be careful 1620 + * to calculate a guard band (and therefore max_sdu) 1621 + * that still leaves 33 ns available in the time slot. 1697 1622 */ 1698 - max_sdu = div_u64(min_gate_len[tc] * PSEC_PER_NSEC, 1699 - picos_per_byte); 1623 + max_sdu = div_u64(remaining_gate_len_ps, picos_per_byte); 1700 1624 /* A TC gate may be completely closed, which is a 1701 1625 * special case where all packets are oversized. 1702 1626 * Any limit smaller than 64 octets accomplishes this ··· 1725 1637 max_sdu); 1726 1638 } 1727 1639 1728 - /* ocelot_write_rix is a macro that concatenates 1729 - * QSYS_MAXSDU_CFG_* with _RSZ, so we need to spell out 1730 - * the writes to each traffic class 1731 - */ 1732 - switch (tc) { 1733 - case 0: 1734 - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_0, 1735 - port); 1736 - break; 1737 - case 1: 1738 - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_1, 1739 - port); 1740 - break; 1741 - case 2: 1742 - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_2, 1743 - port); 1744 - break; 1745 - case 3: 1746 - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_3, 1747 - port); 1748 - break; 1749 - case 4: 1750 - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_4, 1751 - port); 1752 - break; 1753 - case 5: 1754 - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_5, 1755 - port); 1756 - break; 1757 - case 6: 1758 - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_6, 1759 - port); 1760 - break; 1761 - case 7: 1762 - ocelot_write_rix(ocelot, max_sdu, QSYS_QMAXSDU_CFG_7, 1763 - port); 1764 - break; 1765 - } 1640 + vsc9959_port_qmaxsdu_set(ocelot, port, tc, max_sdu); 1766 1641 } 1767 1642 1768 1643 ocelot_write_rix(ocelot, maxlen, QSYS_PORT_MAX_SDU, port); 1644 + 1645 + ocelot->ops->cut_through_fwd(ocelot); 1646 + 1647 + mutex_unlock(&ocelot->fwd_domain_lock); 1769 1648 } 1770 1649 1771 1650 static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, ··· 1759 1704 break; 1760 1705 } 1761 1706 1707 + mutex_lock(&ocelot->tas_lock); 1708 + 1762 1709 ocelot_rmw_rix(ocelot, 1763 1710 QSYS_TAG_CONFIG_LINK_SPEED(tas_speed), 1764 1711 QSYS_TAG_CONFIG_LINK_SPEED_M, 1765 1712 QSYS_TAG_CONFIG, port); 1766 - 1767 - mutex_lock(&ocelot->tas_lock); 1768 1713 1769 1714 if (ocelot_port->taprio) 1770 1715 vsc9959_tas_guard_bands_update(ocelot, port); ··· 2825 2770 { 2826 2771 struct felix *felix = ocelot_to_felix(ocelot); 2827 2772 struct dsa_switch *ds = felix->ds; 2828 - int port, other_port; 2773 + int tc, port, other_port; 2829 2774 2830 2775 lockdep_assert_held(&ocelot->fwd_domain_lock); 2831 2776 ··· 2869 2814 min_speed = other_ocelot_port->speed; 2870 2815 } 2871 2816 2872 - /* Enable cut-through forwarding for all traffic classes. */ 2873 - if (ocelot_port->speed == min_speed) 2817 + /* Enable cut-through forwarding for all traffic classes that 2818 + * don't have oversized dropping enabled, since this check is 2819 + * bypassed in cut-through mode. 2820 + */ 2821 + if (ocelot_port->speed == min_speed) { 2874 2822 val = GENMASK(7, 0); 2823 + 2824 + for (tc = 0; tc < OCELOT_NUM_TC; tc++) 2825 + if (vsc9959_port_qmaxsdu_get(ocelot, port, tc)) 2826 + val &= ~BIT(tc); 2827 + } 2875 2828 2876 2829 set: 2877 2830 tmp = ocelot_read_rix(ocelot, ANA_CUT_THRU_CFG, port); ··· 2887 2824 continue; 2888 2825 2889 2826 dev_dbg(ocelot->dev, 2890 - "port %d fwd mask 0x%lx speed %d min_speed %d, %s cut-through forwarding\n", 2827 + "port %d fwd mask 0x%lx speed %d min_speed %d, %s cut-through forwarding on TC mask 0x%x\n", 2891 2828 port, mask, ocelot_port->speed, min_speed, 2892 - val ? "enabling" : "disabling"); 2829 + val ? "enabling" : "disabling", val); 2893 2830 2894 2831 ocelot_write_rix(ocelot, val, ANA_CUT_THRU_CFG, port); 2895 2832 }
+1 -1
drivers/net/dsa/qca/qca8k-8xxx.c
··· 1889 1889 if (!priv) 1890 1890 return -ENOMEM; 1891 1891 1892 - priv->info = of_device_get_match_data(priv->dev); 1893 1892 priv->bus = mdiodev->bus; 1894 1893 priv->dev = &mdiodev->dev; 1894 + priv->info = of_device_get_match_data(priv->dev); 1895 1895 1896 1896 priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", 1897 1897 GPIOD_ASIS);
+5 -1
drivers/net/ethernet/freescale/fec.h
··· 16 16 17 17 #include <linux/clocksource.h> 18 18 #include <linux/net_tstamp.h> 19 + #include <linux/pm_qos.h> 19 20 #include <linux/ptp_clock_kernel.h> 20 21 #include <linux/timecounter.h> 21 22 #include <dt-bindings/firmware/imx/rsrc.h> ··· 501 500 /* i.MX8MQ SoC integration mix wakeup interrupt signal into "int2" interrupt line. */ 502 501 #define FEC_QUIRK_WAKEUP_FROM_INT2 (1 << 22) 503 502 503 + /* i.MX6Q adds pm_qos support */ 504 + #define FEC_QUIRK_HAS_PMQOS BIT(23) 505 + 504 506 struct bufdesc_prop { 505 507 int qid; 506 508 /* Address of Rx and Tx buffers */ ··· 563 559 struct clk *clk_2x_txclk; 564 560 565 561 bool ptp_clk_on; 566 - struct mutex ptp_clk_mutex; 567 562 unsigned int num_tx_queues; 568 563 unsigned int num_rx_queues; 569 564 ··· 613 610 struct delayed_work time_keep; 614 611 struct regulator *reg_phy; 615 612 struct fec_stop_mode_gpr stop_gpr; 613 + struct pm_qos_request pm_qos_req; 616 614 617 615 unsigned int tx_align; 618 616 unsigned int rx_align;
+17 -9
drivers/net/ethernet/freescale/fec_main.c
··· 111 111 .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | 112 112 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | 113 113 FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | 114 - FEC_QUIRK_HAS_RACC | FEC_QUIRK_CLEAR_SETUP_MII, 114 + FEC_QUIRK_HAS_RACC | FEC_QUIRK_CLEAR_SETUP_MII | 115 + FEC_QUIRK_HAS_PMQOS, 115 116 }; 116 117 117 118 static const struct fec_devinfo fec_mvf600_info = { ··· 2059 2058 static int fec_enet_clk_enable(struct net_device *ndev, bool enable) 2060 2059 { 2061 2060 struct fec_enet_private *fep = netdev_priv(ndev); 2061 + unsigned long flags; 2062 2062 int ret; 2063 2063 2064 2064 if (enable) { ··· 2068 2066 return ret; 2069 2067 2070 2068 if (fep->clk_ptp) { 2071 - mutex_lock(&fep->ptp_clk_mutex); 2069 + spin_lock_irqsave(&fep->tmreg_lock, flags); 2072 2070 ret = clk_prepare_enable(fep->clk_ptp); 2073 2071 if (ret) { 2074 - mutex_unlock(&fep->ptp_clk_mutex); 2072 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 2075 2073 goto failed_clk_ptp; 2076 2074 } else { 2077 2075 fep->ptp_clk_on = true; 2078 2076 } 2079 - mutex_unlock(&fep->ptp_clk_mutex); 2077 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 2080 2078 } 2081 2079 2082 2080 ret = clk_prepare_enable(fep->clk_ref); ··· 2091 2089 } else { 2092 2090 clk_disable_unprepare(fep->clk_enet_out); 2093 2091 if (fep->clk_ptp) { 2094 - mutex_lock(&fep->ptp_clk_mutex); 2092 + spin_lock_irqsave(&fep->tmreg_lock, flags); 2095 2093 clk_disable_unprepare(fep->clk_ptp); 2096 2094 fep->ptp_clk_on = false; 2097 - mutex_unlock(&fep->ptp_clk_mutex); 2095 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 2098 2096 } 2099 2097 clk_disable_unprepare(fep->clk_ref); 2100 2098 clk_disable_unprepare(fep->clk_2x_txclk); ··· 2107 2105 clk_disable_unprepare(fep->clk_ref); 2108 2106 failed_clk_ref: 2109 2107 if (fep->clk_ptp) { 2110 - mutex_lock(&fep->ptp_clk_mutex); 2108 + spin_lock_irqsave(&fep->tmreg_lock, flags); 2111 2109 clk_disable_unprepare(fep->clk_ptp); 2112 2110 fep->ptp_clk_on = false; 2113 - mutex_unlock(&fep->ptp_clk_mutex); 2111 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 2114 2112 } 2115 2113 failed_clk_ptp: 2116 2114 clk_disable_unprepare(fep->clk_enet_out); ··· 3276 3274 if (fep->quirks & FEC_QUIRK_ERR006687) 3277 3275 imx6q_cpuidle_fec_irqs_used(); 3278 3276 3277 + if (fep->quirks & FEC_QUIRK_HAS_PMQOS) 3278 + cpu_latency_qos_add_request(&fep->pm_qos_req, 0); 3279 + 3279 3280 napi_enable(&fep->napi); 3280 3281 phy_start(ndev->phydev); 3281 3282 netif_tx_start_all_queues(ndev); ··· 3320 3315 fec_enet_update_ethtool_stats(ndev); 3321 3316 3322 3317 fec_enet_clk_enable(ndev, false); 3318 + if (fep->quirks & FEC_QUIRK_HAS_PMQOS) 3319 + cpu_latency_qos_remove_request(&fep->pm_qos_req); 3320 + 3323 3321 pinctrl_pm_select_sleep_state(&fep->pdev->dev); 3324 3322 pm_runtime_mark_last_busy(&fep->pdev->dev); 3325 3323 pm_runtime_put_autosuspend(&fep->pdev->dev); ··· 3949 3941 } 3950 3942 3951 3943 fep->ptp_clk_on = false; 3952 - mutex_init(&fep->ptp_clk_mutex); 3944 + spin_lock_init(&fep->tmreg_lock); 3953 3945 3954 3946 /* clk_ref is optional, depends on board */ 3955 3947 fep->clk_ref = devm_clk_get_optional(&pdev->dev, "enet_clk_ref");
+10 -18
drivers/net/ethernet/freescale/fec_ptp.c
··· 365 365 */ 366 366 static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) 367 367 { 368 - struct fec_enet_private *adapter = 368 + struct fec_enet_private *fep = 369 369 container_of(ptp, struct fec_enet_private, ptp_caps); 370 370 u64 ns; 371 371 unsigned long flags; 372 372 373 - mutex_lock(&adapter->ptp_clk_mutex); 373 + spin_lock_irqsave(&fep->tmreg_lock, flags); 374 374 /* Check the ptp clock */ 375 - if (!adapter->ptp_clk_on) { 376 - mutex_unlock(&adapter->ptp_clk_mutex); 375 + if (!fep->ptp_clk_on) { 376 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 377 377 return -EINVAL; 378 378 } 379 - spin_lock_irqsave(&adapter->tmreg_lock, flags); 380 - ns = timecounter_read(&adapter->tc); 381 - spin_unlock_irqrestore(&adapter->tmreg_lock, flags); 382 - mutex_unlock(&adapter->ptp_clk_mutex); 379 + ns = timecounter_read(&fep->tc); 380 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 383 381 384 382 *ts = ns_to_timespec64(ns); 385 383 ··· 402 404 unsigned long flags; 403 405 u32 counter; 404 406 405 - mutex_lock(&fep->ptp_clk_mutex); 407 + spin_lock_irqsave(&fep->tmreg_lock, flags); 406 408 /* Check the ptp clock */ 407 409 if (!fep->ptp_clk_on) { 408 - mutex_unlock(&fep->ptp_clk_mutex); 410 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 409 411 return -EINVAL; 410 412 } 411 413 ··· 415 417 */ 416 418 counter = ns & fep->cc.mask; 417 419 418 - spin_lock_irqsave(&fep->tmreg_lock, flags); 419 420 writel(counter, fep->hwp + FEC_ATIME); 420 421 timecounter_init(&fep->tc, &fep->cc, ns); 421 422 spin_unlock_irqrestore(&fep->tmreg_lock, flags); 422 - mutex_unlock(&fep->ptp_clk_mutex); 423 423 return 0; 424 424 } 425 425 ··· 514 518 struct fec_enet_private *fep = container_of(dwork, struct fec_enet_private, time_keep); 515 519 unsigned long flags; 516 520 517 - mutex_lock(&fep->ptp_clk_mutex); 521 + spin_lock_irqsave(&fep->tmreg_lock, flags); 518 522 if (fep->ptp_clk_on) { 519 - spin_lock_irqsave(&fep->tmreg_lock, flags); 520 523 timecounter_read(&fep->tc); 521 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 522 524 } 523 - mutex_unlock(&fep->ptp_clk_mutex); 525 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 524 526 525 527 schedule_delayed_work(&fep->time_keep, HZ); 526 528 } ··· 592 598 dev_err(&fep->pdev->dev, "clk_ptp clock rate is zero\n"); 593 599 } 594 600 fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed; 595 - 596 - spin_lock_init(&fep->tmreg_lock); 597 601 598 602 fec_ptp_start_cyclecounter(ndev); 599 603
+4 -1
drivers/net/ethernet/intel/i40e/i40e_client.c
··· 177 177 "Cannot locate client instance close routine\n"); 178 178 return; 179 179 } 180 + if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) { 181 + dev_dbg(&pf->pdev->dev, "Client is not open, abort close\n"); 182 + return; 183 + } 180 184 cdev->client->ops->close(&cdev->lan_info, cdev->client, reset); 181 185 clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state); 182 186 i40e_client_release_qvlist(&cdev->lan_info); ··· 433 429 /* Remove failed client instance */ 434 430 clear_bit(__I40E_CLIENT_INSTANCE_OPENED, 435 431 &cdev->state); 436 - i40e_client_del_instance(pf); 437 432 return; 438 433 } 439 434 }
+3
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 6652 6652 vsi->tc_seid_map[i] = ch->seid; 6653 6653 } 6654 6654 } 6655 + 6656 + /* reset to reconfigure TX queue contexts */ 6657 + i40e_do_reset(vsi->back, I40E_PF_RESET_FLAG, true); 6655 6658 return ret; 6656 6659 6657 6660 err_free:
+2 -1
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 3688 3688 u8 prio; 3689 3689 3690 3690 /* is DCB enabled at all? */ 3691 - if (vsi->tc_config.numtc == 1) 3691 + if (vsi->tc_config.numtc == 1 || 3692 + i40e_is_tc_mqprio_enabled(vsi->back)) 3692 3693 return netdev_pick_tx(netdev, skb, sb_dev); 3693 3694 3694 3695 prio = skb->priority;
+11 -3
drivers/net/ethernet/intel/iavf/iavf_main.c
··· 2954 2954 int i = 0, err; 2955 2955 bool running; 2956 2956 2957 + /* Detach interface to avoid subsequent NDO callbacks */ 2958 + rtnl_lock(); 2959 + netif_device_detach(netdev); 2960 + rtnl_unlock(); 2961 + 2957 2962 /* When device is being removed it doesn't make sense to run the reset 2958 2963 * task, just return in such a case. 2959 2964 */ ··· 2966 2961 if (adapter->state != __IAVF_REMOVE) 2967 2962 queue_work(iavf_wq, &adapter->reset_task); 2968 2963 2969 - return; 2964 + goto reset_finish; 2970 2965 } 2971 2966 2972 2967 while (!mutex_trylock(&adapter->client_lock)) ··· 3036 3031 3037 3032 if (running) { 3038 3033 netif_carrier_off(netdev); 3039 - netif_tx_stop_all_queues(netdev); 3040 3034 adapter->link_up = false; 3041 3035 iavf_napi_disable_all(adapter); 3042 3036 } ··· 3165 3161 mutex_unlock(&adapter->client_lock); 3166 3162 mutex_unlock(&adapter->crit_lock); 3167 3163 3168 - return; 3164 + goto reset_finish; 3169 3165 reset_err: 3170 3166 if (running) { 3171 3167 set_bit(__IAVF_VSI_DOWN, adapter->vsi.state); ··· 3176 3172 mutex_unlock(&adapter->client_lock); 3177 3173 mutex_unlock(&adapter->crit_lock); 3178 3174 dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n"); 3175 + reset_finish: 3176 + rtnl_lock(); 3177 + netif_device_attach(netdev); 3178 + rtnl_unlock(); 3179 3179 } 3180 3180 3181 3181 /**
-17
drivers/net/ethernet/intel/ice/ice_base.c
··· 7 7 #include "ice_dcb_lib.h" 8 8 #include "ice_sriov.h" 9 9 10 - static bool ice_alloc_rx_buf_zc(struct ice_rx_ring *rx_ring) 11 - { 12 - rx_ring->xdp_buf = kcalloc(rx_ring->count, sizeof(*rx_ring->xdp_buf), GFP_KERNEL); 13 - return !!rx_ring->xdp_buf; 14 - } 15 - 16 - static bool ice_alloc_rx_buf(struct ice_rx_ring *rx_ring) 17 - { 18 - rx_ring->rx_buf = kcalloc(rx_ring->count, sizeof(*rx_ring->rx_buf), GFP_KERNEL); 19 - return !!rx_ring->rx_buf; 20 - } 21 - 22 10 /** 23 11 * __ice_vsi_get_qs_contig - Assign a contiguous chunk of queues to VSI 24 12 * @qs_cfg: gathered variables needed for PF->VSI queues assignment ··· 507 519 xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, 508 520 ring->q_index, ring->q_vector->napi.napi_id); 509 521 510 - kfree(ring->rx_buf); 511 522 ring->xsk_pool = ice_xsk_pool(ring); 512 523 if (ring->xsk_pool) { 513 - if (!ice_alloc_rx_buf_zc(ring)) 514 - return -ENOMEM; 515 524 xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq); 516 525 517 526 ring->rx_buf_len = ··· 523 538 dev_info(dev, "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n", 524 539 ring->q_index); 525 540 } else { 526 - if (!ice_alloc_rx_buf(ring)) 527 - return -ENOMEM; 528 541 if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) 529 542 /* coverity[check_return] */ 530 543 xdp_rxq_info_reg(&ring->xdp_rxq,
+9 -1
drivers/net/ethernet/intel/ice/ice_main.c
··· 2898 2898 if (xdp_ring_err) 2899 2899 NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Tx resources failed"); 2900 2900 } 2901 + /* reallocate Rx queues that are used for zero-copy */ 2902 + xdp_ring_err = ice_realloc_zc_buf(vsi, true); 2903 + if (xdp_ring_err) 2904 + NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Rx resources failed"); 2901 2905 } else if (ice_is_xdp_ena_vsi(vsi) && !prog) { 2902 2906 xdp_ring_err = ice_destroy_xdp_rings(vsi); 2903 2907 if (xdp_ring_err) 2904 2908 NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Tx resources failed"); 2909 + /* reallocate Rx queues that were used for zero-copy */ 2910 + xdp_ring_err = ice_realloc_zc_buf(vsi, false); 2911 + if (xdp_ring_err) 2912 + NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Rx resources failed"); 2905 2913 } else { 2906 2914 /* safe to call even when prog == vsi->xdp_prog as 2907 2915 * dev_xdp_install in net/core/dev.c incremented prog's ··· 3918 3910 3919 3911 pf->avail_rxqs = bitmap_zalloc(pf->max_pf_rxqs, GFP_KERNEL); 3920 3912 if (!pf->avail_rxqs) { 3921 - devm_kfree(ice_pf_to_dev(pf), pf->avail_txqs); 3913 + bitmap_free(pf->avail_txqs); 3922 3914 pf->avail_txqs = NULL; 3923 3915 return -ENOMEM; 3924 3916 }
+63
drivers/net/ethernet/intel/ice/ice_xsk.c
··· 192 192 err = ice_vsi_ctrl_one_rx_ring(vsi, false, q_idx, true); 193 193 if (err) 194 194 return err; 195 + ice_clean_rx_ring(rx_ring); 195 196 196 197 ice_qvec_toggle_napi(vsi, q_vector, false); 197 198 ice_qp_clean_rings(vsi, q_idx); ··· 318 317 } 319 318 320 319 /** 320 + * ice_realloc_rx_xdp_bufs - reallocate for either XSK or normal buffer 321 + * @rx_ring: Rx ring 322 + * @pool_present: is pool for XSK present 323 + * 324 + * Try allocating memory and return ENOMEM, if failed to allocate. 325 + * If allocation was successful, substitute buffer with allocated one. 326 + * Returns 0 on success, negative on failure 327 + */ 328 + static int 329 + ice_realloc_rx_xdp_bufs(struct ice_rx_ring *rx_ring, bool pool_present) 330 + { 331 + size_t elem_size = pool_present ? sizeof(*rx_ring->xdp_buf) : 332 + sizeof(*rx_ring->rx_buf); 333 + void *sw_ring = kcalloc(rx_ring->count, elem_size, GFP_KERNEL); 334 + 335 + if (!sw_ring) 336 + return -ENOMEM; 337 + 338 + if (pool_present) { 339 + kfree(rx_ring->rx_buf); 340 + rx_ring->rx_buf = NULL; 341 + rx_ring->xdp_buf = sw_ring; 342 + } else { 343 + kfree(rx_ring->xdp_buf); 344 + rx_ring->xdp_buf = NULL; 345 + rx_ring->rx_buf = sw_ring; 346 + } 347 + 348 + return 0; 349 + } 350 + 351 + /** 352 + * ice_realloc_zc_buf - reallocate XDP ZC queue pairs 353 + * @vsi: Current VSI 354 + * @zc: is zero copy set 355 + * 356 + * Reallocate buffer for rx_rings that might be used by XSK. 357 + * XDP requires more memory, than rx_buf provides. 358 + * Returns 0 on success, negative on failure 359 + */ 360 + int ice_realloc_zc_buf(struct ice_vsi *vsi, bool zc) 361 + { 362 + struct ice_rx_ring *rx_ring; 363 + unsigned long q; 364 + 365 + for_each_set_bit(q, vsi->af_xdp_zc_qps, 366 + max_t(int, vsi->alloc_txq, vsi->alloc_rxq)) { 367 + rx_ring = vsi->rx_rings[q]; 368 + if (ice_realloc_rx_xdp_bufs(rx_ring, zc)) 369 + return -ENOMEM; 370 + } 371 + 372 + return 0; 373 + } 374 + 375 + /** 321 376 * ice_xsk_pool_setup - enable/disable a buffer pool region depending on its state 322 377 * @vsi: Current VSI 323 378 * @pool: buffer pool to enable/associate to a ring, NULL to disable ··· 402 345 if_running = netif_running(vsi->netdev) && ice_is_xdp_ena_vsi(vsi); 403 346 404 347 if (if_running) { 348 + struct ice_rx_ring *rx_ring = vsi->rx_rings[qid]; 349 + 405 350 ret = ice_qp_dis(vsi, qid); 406 351 if (ret) { 407 352 netdev_err(vsi->netdev, "ice_qp_dis error = %d\n", ret); 408 353 goto xsk_pool_if_up; 409 354 } 355 + 356 + ret = ice_realloc_rx_xdp_bufs(rx_ring, pool_present); 357 + if (ret) 358 + goto xsk_pool_if_up; 410 359 } 411 360 412 361 pool_failure = pool_present ? ice_xsk_pool_enable(vsi, pool, qid) :
+8
drivers/net/ethernet/intel/ice/ice_xsk.h
··· 27 27 void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring); 28 28 void ice_xsk_clean_xdp_ring(struct ice_tx_ring *xdp_ring); 29 29 bool ice_xmit_zc(struct ice_tx_ring *xdp_ring, u32 budget, int napi_budget); 30 + int ice_realloc_zc_buf(struct ice_vsi *vsi, bool zc); 30 31 #else 31 32 static inline bool 32 33 ice_xmit_zc(struct ice_tx_ring __always_unused *xdp_ring, ··· 73 72 74 73 static inline void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring) { } 75 74 static inline void ice_xsk_clean_xdp_ring(struct ice_tx_ring *xdp_ring) { } 75 + 76 + static inline int 77 + ice_realloc_zc_buf(struct ice_vsi __always_unused *vsi, 78 + bool __always_unused zc) 79 + { 80 + return 0; 81 + } 76 82 #endif /* CONFIG_XDP_SOCKETS */ 77 83 #endif /* !_ICE_XSK_H_ */
+2 -2
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c
··· 700 700 701 701 void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name) 702 702 { 703 - struct dentry *mvpp2_dir, *mvpp2_root; 703 + static struct dentry *mvpp2_root; 704 + struct dentry *mvpp2_dir; 704 705 int ret, i; 705 706 706 - mvpp2_root = debugfs_lookup(MVPP2_DRIVER_NAME, NULL); 707 707 if (!mvpp2_root) 708 708 mvpp2_root = debugfs_create_dir(MVPP2_DRIVER_NAME, NULL); 709 709
+1 -1
drivers/net/ethernet/mediatek/mtk_ppe.c
··· 412 412 if (entry->hash != 0xffff) { 413 413 ppe->foe_table[entry->hash].ib1 &= ~MTK_FOE_IB1_STATE; 414 414 ppe->foe_table[entry->hash].ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, 415 - MTK_FOE_STATE_BIND); 415 + MTK_FOE_STATE_UNBIND); 416 416 dma_wmb(); 417 417 } 418 418 entry->hash = 0xffff;
+3
drivers/net/ethernet/mediatek/mtk_ppe.h
··· 293 293 if (!ppe) 294 294 return; 295 295 296 + if (hash > MTK_PPE_HASH_MASK) 297 + return; 298 + 296 299 now = (u16)jiffies; 297 300 diff = now - ppe->foe_check_time[hash]; 298 301 if (diff < HZ / 10)
-2
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
··· 1135 1135 1136 1136 clk_disable_unprepare(priv->plat->stmmac_clk); 1137 1137 clk_unregister_fixed_rate(priv->plat->stmmac_clk); 1138 - 1139 - pcim_iounmap_regions(pdev, BIT(0)); 1140 1138 } 1141 1139 1142 1140 static int __maybe_unused intel_eth_pci_suspend(struct device *dev)
+3 -1
drivers/net/mdio/fwnode_mdio.c
··· 47 47 * just fall back to poll mode 48 48 */ 49 49 if (rc == -EPROBE_DEFER) 50 - rc = -ENODEV; 50 + rc = driver_deferred_probe_check_state(&phy->mdio.dev); 51 + if (rc == -EPROBE_DEFER) 52 + return rc; 51 53 52 54 if (rc > 0) { 53 55 phy->irq = rc;
+1 -7
drivers/net/phy/meson-gxl.c
··· 243 243 irq_status == INTSRC_ENERGY_DETECT) 244 244 return IRQ_HANDLED; 245 245 246 - /* Give PHY some time before MAC starts sending data. This works 247 - * around an issue where network doesn't come up properly. 248 - */ 249 - if (!(irq_status & INTSRC_LINK_DOWN)) 250 - phy_queue_state_machine(phydev, msecs_to_jiffies(100)); 251 - else 252 - phy_trigger_machine(phydev); 246 + phy_trigger_machine(phydev); 253 247 254 248 return IRQ_HANDLED; 255 249 }
+57 -7
drivers/net/phy/microchip_t1.c
··· 28 28 29 29 /* Interrupt Source Register */ 30 30 #define LAN87XX_INTERRUPT_SOURCE (0x18) 31 + #define LAN87XX_INTERRUPT_SOURCE_2 (0x08) 31 32 32 33 /* Interrupt Mask Register */ 33 34 #define LAN87XX_INTERRUPT_MASK (0x19) 34 35 #define LAN87XX_MASK_LINK_UP (0x0004) 35 36 #define LAN87XX_MASK_LINK_DOWN (0x0002) 37 + 38 + #define LAN87XX_INTERRUPT_MASK_2 (0x09) 39 + #define LAN87XX_MASK_COMM_RDY BIT(10) 36 40 37 41 /* MISC Control 1 Register */ 38 42 #define LAN87XX_CTRL_1 (0x11) ··· 428 424 int rc, val = 0; 429 425 430 426 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 431 - /* unmask all source and clear them before enable */ 432 - rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, 0x7FFF); 433 - rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); 434 - val = LAN87XX_MASK_LINK_UP | LAN87XX_MASK_LINK_DOWN; 427 + /* clear all interrupt */ 435 428 rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); 436 - } else { 437 - rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); 438 - if (rc) 429 + if (rc < 0) 439 430 return rc; 440 431 441 432 rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); 433 + if (rc < 0) 434 + return rc; 435 + 436 + rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, 437 + PHYACC_ATTR_BANK_MISC, 438 + LAN87XX_INTERRUPT_MASK_2, val); 439 + if (rc < 0) 440 + return rc; 441 + 442 + rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, 443 + PHYACC_ATTR_BANK_MISC, 444 + LAN87XX_INTERRUPT_SOURCE_2, 0); 445 + if (rc < 0) 446 + return rc; 447 + 448 + /* enable link down and comm ready interrupt */ 449 + val = LAN87XX_MASK_LINK_DOWN; 450 + rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); 451 + if (rc < 0) 452 + return rc; 453 + 454 + val = LAN87XX_MASK_COMM_RDY; 455 + rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, 456 + PHYACC_ATTR_BANK_MISC, 457 + LAN87XX_INTERRUPT_MASK_2, val); 458 + } else { 459 + rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); 460 + if (rc < 0) 461 + return rc; 462 + 463 + rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); 464 + if (rc < 0) 465 + return rc; 466 + 467 + rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, 468 + PHYACC_ATTR_BANK_MISC, 469 + LAN87XX_INTERRUPT_MASK_2, val); 470 + if (rc < 0) 471 + return rc; 472 + 473 + rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, 474 + PHYACC_ATTR_BANK_MISC, 475 + LAN87XX_INTERRUPT_SOURCE_2, 0); 442 476 } 443 477 444 478 return rc < 0 ? rc : 0; ··· 485 443 static irqreturn_t lan87xx_handle_interrupt(struct phy_device *phydev) 486 444 { 487 445 int irq_status; 446 + 447 + irq_status = access_ereg(phydev, PHYACC_ATTR_MODE_READ, 448 + PHYACC_ATTR_BANK_MISC, 449 + LAN87XX_INTERRUPT_SOURCE_2, 0); 450 + if (irq_status < 0) { 451 + phy_error(phydev); 452 + return IRQ_NONE; 453 + } 488 454 489 455 irq_status = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); 490 456 if (irq_status < 0) {
+1
drivers/net/usb/qmi_wwan.c
··· 1087 1087 {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ 1088 1088 {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */ 1089 1089 {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ 1090 + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0801)}, /* Quectel RM520N */ 1090 1091 1091 1092 /* 3. Combined interface devices matching on interface number */ 1092 1093 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
+1 -4
drivers/net/wireless/intel/iwlegacy/4965-rs.c
··· 2403 2403 /* Repeat initial/next rate. 2404 2404 * For legacy IL_NUMBER_TRY == 1, this loop will not execute. 2405 2405 * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ 2406 - while (repeat_rate > 0) { 2406 + while (repeat_rate > 0 && idx < (LINK_QUAL_MAX_RETRY_NUM - 1)) { 2407 2407 if (is_legacy(tbl_type.lq_type)) { 2408 2408 if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) 2409 2409 ant_toggle_cnt++; ··· 2422 2422 cpu_to_le32(new_rate); 2423 2423 repeat_rate--; 2424 2424 idx++; 2425 - if (idx >= LINK_QUAL_MAX_RETRY_NUM) 2426 - goto out; 2427 2425 } 2428 2426 2429 2427 il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, ··· 2466 2468 repeat_rate--; 2467 2469 } 2468 2470 2469 - out: 2470 2471 lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF; 2471 2472 lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; 2472 2473
+6 -1
drivers/net/wireless/mac80211_hwsim.c
··· 5422 5422 5423 5423 nlh = nlmsg_hdr(skb); 5424 5424 gnlh = nlmsg_data(nlh); 5425 + 5426 + if (skb->len < nlh->nlmsg_len) 5427 + return -EINVAL; 5428 + 5425 5429 err = genlmsg_parse(nlh, &hwsim_genl_family, tb, HWSIM_ATTR_MAX, 5426 5430 hwsim_genl_policy, NULL); 5427 5431 if (err) { ··· 5468 5464 spin_unlock_irqrestore(&hwsim_virtio_lock, flags); 5469 5465 5470 5466 skb->data = skb->head; 5471 - skb_set_tail_pointer(skb, len); 5467 + skb_reset_tail_pointer(skb); 5468 + skb_put(skb, len); 5472 5469 hwsim_virtio_handle_cmd(skb); 5473 5470 5474 5471 spin_lock_irqsave(&hwsim_virtio_lock, flags);
+1 -1
drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
··· 261 261 262 262 err = mt7921e_driver_own(dev); 263 263 if (err) 264 - return err; 264 + goto out; 265 265 266 266 err = mt7921_run_firmware(dev); 267 267 if (err)
+1
drivers/net/wireless/microchip/wilc1000/netdev.h
··· 245 245 u8 *rx_buffer; 246 246 u32 rx_buffer_offset; 247 247 u8 *tx_buffer; 248 + u32 *vmm_table; 248 249 249 250 struct txq_handle txq[NQUEUES]; 250 251 int txq_entries;
+33 -6
drivers/net/wireless/microchip/wilc1000/sdio.c
··· 28 28 u32 block_size; 29 29 bool isinit; 30 30 int has_thrpt_enh3; 31 + u8 *cmd53_buf; 31 32 }; 32 33 33 34 struct sdio_cmd52 { ··· 48 47 u32 count: 9; 49 48 u8 *buffer; 50 49 u32 block_size; 50 + bool use_global_buf; 51 51 }; 52 52 53 53 static const struct wilc_hif_func wilc_hif_sdio; ··· 93 91 { 94 92 struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); 95 93 int size, ret; 94 + struct wilc_sdio *sdio_priv = wilc->bus_data; 95 + u8 *buf = cmd->buffer; 96 96 97 97 sdio_claim_host(func); 98 98 ··· 105 101 else 106 102 size = cmd->count; 107 103 104 + if (cmd->use_global_buf) { 105 + if (size > sizeof(u32)) 106 + return -EINVAL; 107 + 108 + buf = sdio_priv->cmd53_buf; 109 + } 110 + 108 111 if (cmd->read_write) { /* write */ 109 - ret = sdio_memcpy_toio(func, cmd->address, 110 - (void *)cmd->buffer, size); 112 + if (cmd->use_global_buf) 113 + memcpy(buf, cmd->buffer, size); 114 + 115 + ret = sdio_memcpy_toio(func, cmd->address, buf, size); 111 116 } else { /* read */ 112 - ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, 113 - cmd->address, size); 117 + ret = sdio_memcpy_fromio(func, buf, cmd->address, size); 118 + 119 + if (cmd->use_global_buf) 120 + memcpy(cmd->buffer, buf, size); 114 121 } 115 122 116 123 sdio_release_host(func); ··· 142 127 sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL); 143 128 if (!sdio_priv) 144 129 return -ENOMEM; 130 + 131 + sdio_priv->cmd53_buf = kzalloc(sizeof(u32), GFP_KERNEL); 132 + if (!sdio_priv->cmd53_buf) { 133 + ret = -ENOMEM; 134 + goto free; 135 + } 145 136 146 137 ret = wilc_cfg80211_init(&wilc, &func->dev, WILC_HIF_SDIO, 147 138 &wilc_hif_sdio); ··· 182 161 irq_dispose_mapping(wilc->dev_irq_num); 183 162 wilc_netdev_cleanup(wilc); 184 163 free: 164 + kfree(sdio_priv->cmd53_buf); 185 165 kfree(sdio_priv); 186 166 return ret; 187 167 } ··· 194 172 195 173 clk_disable_unprepare(wilc->rtc_clk); 196 174 wilc_netdev_cleanup(wilc); 175 + kfree(sdio_priv->cmd53_buf); 197 176 kfree(sdio_priv); 198 177 } 199 178 ··· 398 375 cmd.address = WILC_SDIO_FBR_DATA_REG; 399 376 cmd.block_mode = 0; 400 377 cmd.increment = 1; 401 - cmd.count = 4; 378 + cmd.count = sizeof(u32); 402 379 cmd.buffer = (u8 *)&data; 380 + cmd.use_global_buf = true; 403 381 cmd.block_size = sdio_priv->block_size; 404 382 ret = wilc_sdio_cmd53(wilc, &cmd); 405 383 if (ret) ··· 438 414 nblk = size / block_size; 439 415 nleft = size % block_size; 440 416 417 + cmd.use_global_buf = false; 441 418 if (nblk > 0) { 442 419 cmd.block_mode = 1; 443 420 cmd.increment = 1; ··· 517 492 cmd.address = WILC_SDIO_FBR_DATA_REG; 518 493 cmd.block_mode = 0; 519 494 cmd.increment = 1; 520 - cmd.count = 4; 495 + cmd.count = sizeof(u32); 521 496 cmd.buffer = (u8 *)data; 497 + cmd.use_global_buf = true; 522 498 523 499 cmd.block_size = sdio_priv->block_size; 524 500 ret = wilc_sdio_cmd53(wilc, &cmd); ··· 561 535 nblk = size / block_size; 562 536 nleft = size % block_size; 563 537 538 + cmd.use_global_buf = false; 564 539 if (nblk > 0) { 565 540 cmd.block_mode = 1; 566 541 cmd.increment = 1;
+13 -2
drivers/net/wireless/microchip/wilc1000/wlan.c
··· 714 714 int ret = 0; 715 715 int counter; 716 716 int timeout; 717 - u32 vmm_table[WILC_VMM_TBL_SIZE]; 717 + u32 *vmm_table = wilc->vmm_table; 718 718 u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0}; 719 719 const struct wilc_hif_func *func; 720 720 int srcu_idx; ··· 1252 1252 while ((rqe = wilc_wlan_rxq_remove(wilc))) 1253 1253 kfree(rqe); 1254 1254 1255 + kfree(wilc->vmm_table); 1256 + wilc->vmm_table = NULL; 1255 1257 kfree(wilc->rx_buffer); 1256 1258 wilc->rx_buffer = NULL; 1257 1259 kfree(wilc->tx_buffer); ··· 1491 1489 goto fail; 1492 1490 } 1493 1491 1492 + if (!wilc->vmm_table) 1493 + wilc->vmm_table = kzalloc(WILC_VMM_TBL_SIZE, GFP_KERNEL); 1494 + 1495 + if (!wilc->vmm_table) { 1496 + ret = -ENOBUFS; 1497 + goto fail; 1498 + } 1499 + 1494 1500 if (!wilc->tx_buffer) 1495 1501 wilc->tx_buffer = kmalloc(WILC_TX_BUFF_SIZE, GFP_KERNEL); 1496 1502 ··· 1523 1513 return 0; 1524 1514 1525 1515 fail: 1526 - 1516 + kfree(wilc->vmm_table); 1517 + wilc->vmm_table = NULL; 1527 1518 kfree(wilc->rx_buffer); 1528 1519 wilc->rx_buffer = NULL; 1529 1520 kfree(wilc->tx_buffer);
+1 -1
drivers/net/xen-netback/xenbus.c
··· 256 256 unsigned int queue_index; 257 257 258 258 xen_unregister_watchers(vif); 259 - xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status"); 260 259 #ifdef CONFIG_DEBUG_FS 261 260 xenvif_debugfs_delif(vif); 262 261 #endif /* CONFIG_DEBUG_FS */ ··· 983 984 struct backend_info *be = dev_get_drvdata(&dev->dev); 984 985 985 986 unregister_hotplug_status_watch(be); 987 + xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); 986 988 if (be->vif) { 987 989 kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); 988 990 backend_disconnect(be);
+2
drivers/nvme/host/pci.c
··· 3517 3517 .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, 3518 3518 { PCI_DEVICE(0xc0a9, 0x540a), /* Crucial P2 */ 3519 3519 .driver_data = NVME_QUIRK_BOGUS_NID, }, 3520 + { PCI_DEVICE(0x1d97, 0x2263), /* Lexar NM610 */ 3521 + .driver_data = NVME_QUIRK_BOGUS_NID, }, 3520 3522 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061), 3521 3523 .driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, }, 3522 3524 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),
+1
drivers/nvme/target/auth.c
··· 196 196 if (IS_ERR(ctrl->ctrl_key)) { 197 197 ret = PTR_ERR(ctrl->ctrl_key); 198 198 ctrl->ctrl_key = NULL; 199 + goto out_free_hash; 199 200 } 200 201 pr_debug("%s: using ctrl hash %s key %*ph\n", __func__, 201 202 ctrl->ctrl_key->hash > 0 ?
+3
drivers/nvme/target/tcp.c
··· 1506 1506 goto done; 1507 1507 1508 1508 switch (sk->sk_state) { 1509 + case TCP_FIN_WAIT2: 1510 + case TCP_LAST_ACK: 1511 + break; 1509 1512 case TCP_FIN_WAIT1: 1510 1513 case TCP_CLOSE_WAIT: 1511 1514 case TCP_CLOSE:
+1 -1
drivers/peci/controller/peci-aspeed.c
··· 523 523 return PTR_ERR(priv->base); 524 524 525 525 priv->irq = platform_get_irq(pdev, 0); 526 - if (!priv->irq) 526 + if (priv->irq < 0) 527 527 return priv->irq; 528 528 529 529 ret = devm_request_irq(&pdev->dev, priv->irq, aspeed_peci_irq_handler,
+1 -2
drivers/peci/cpu.c
··· 188 188 { 189 189 struct auxiliary_device *adev = to_auxiliary_dev(dev); 190 190 191 - auxiliary_device_uninit(adev); 192 - 193 191 kfree(adev->name); 194 192 kfree(adev); 195 193 } ··· 232 234 struct auxiliary_device *adev = _adev; 233 235 234 236 auxiliary_device_delete(adev); 237 + auxiliary_device_uninit(adev); 235 238 } 236 239 237 240 static int devm_adev_add(struct device *dev, int idx)
+1 -1
drivers/perf/arm_pmu_platform.c
··· 117 117 118 118 if (num_irqs == 1) { 119 119 int irq = platform_get_irq(pdev, 0); 120 - if (irq && irq_is_percpu_devid(irq)) 120 + if ((irq > 0) && irq_is_percpu_devid(irq)) 121 121 return pmu_parse_percpu_irq(pmu, irq); 122 122 } 123 123
+31 -22
drivers/platform/mellanox/mlxreg-lc.c
··· 460 460 u32 regval; 461 461 int err; 462 462 463 - mutex_lock(&mlxreg_lc->lock); 464 - 465 463 err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, &regval); 466 464 if (err) 467 465 goto regmap_read_fail; ··· 472 474 err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_pwr, regval); 473 475 474 476 regmap_read_fail: 475 - mutex_unlock(&mlxreg_lc->lock); 476 477 return err; 477 478 } 478 479 ··· 488 491 * line card which is already has been enabled. Disabling does not affect the disabled line 489 492 * card. 490 493 */ 491 - mutex_lock(&mlxreg_lc->lock); 492 - 493 494 err = regmap_read(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, &regval); 494 495 if (err) 495 496 goto regmap_read_fail; ··· 500 505 err = regmap_write(mlxreg_lc->par_regmap, mlxreg_lc->data->reg_ena, regval); 501 506 502 507 regmap_read_fail: 503 - mutex_unlock(&mlxreg_lc->lock); 504 508 return err; 505 509 } 506 510 ··· 532 538 static void 533 539 mlxreg_lc_state_update(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) 534 540 { 541 + if (action) 542 + mlxreg_lc->state |= state; 543 + else 544 + mlxreg_lc->state &= ~state; 545 + } 546 + 547 + static void 548 + mlxreg_lc_state_update_locked(struct mlxreg_lc *mlxreg_lc, enum mlxreg_lc_state state, u8 action) 549 + { 535 550 mutex_lock(&mlxreg_lc->lock); 536 551 537 552 if (action) ··· 563 560 dev_info(mlxreg_lc->dev, "linecard#%d state %d event kind %d action %d\n", 564 561 mlxreg_lc->data->slot, mlxreg_lc->state, kind, action); 565 562 566 - if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) 563 + mutex_lock(&mlxreg_lc->lock); 564 + if (!(mlxreg_lc->state & MLXREG_LC_INITIALIZED)) { 565 + mutex_unlock(&mlxreg_lc->lock); 567 566 return 0; 567 + } 568 568 569 569 switch (kind) { 570 570 case MLXREG_HOTPLUG_LC_SYNCED: ··· 580 574 if (!(mlxreg_lc->state & MLXREG_LC_POWERED) && action) { 581 575 err = mlxreg_lc_power_on_off(mlxreg_lc, 1); 582 576 if (err) 583 - return err; 577 + goto mlxreg_lc_power_on_off_fail; 584 578 } 585 579 /* In case line card is configured - enable it. */ 586 580 if (mlxreg_lc->state & MLXREG_LC_CONFIGURED && action) ··· 594 588 /* In case line card is configured - enable it. */ 595 589 if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) 596 590 err = mlxreg_lc_enable_disable(mlxreg_lc, 1); 591 + mutex_unlock(&mlxreg_lc->lock); 597 592 return err; 598 593 } 599 594 err = mlxreg_lc_create_static_devices(mlxreg_lc, mlxreg_lc->main_devs, 600 595 mlxreg_lc->main_devs_num); 601 596 if (err) 602 - return err; 597 + goto mlxreg_lc_create_static_devices_fail; 603 598 604 599 /* In case line card is already in ready state - enable it. */ 605 600 if (mlxreg_lc->state & MLXREG_LC_CONFIGURED) ··· 626 619 default: 627 620 break; 628 621 } 622 + 623 + mlxreg_lc_power_on_off_fail: 624 + mlxreg_lc_create_static_devices_fail: 625 + mutex_unlock(&mlxreg_lc->lock); 629 626 630 627 return err; 631 628 } ··· 676 665 if (err) 677 666 goto mlxreg_lc_create_static_devices_failed; 678 667 679 - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_POWERED, 1); 668 + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_POWERED, 1); 680 669 } 681 670 682 671 /* Verify if line card is synchronized. */ ··· 687 676 /* Power on line card if necessary. */ 688 677 if (regval & mlxreg_lc->data->mask) { 689 678 mlxreg_lc->state |= MLXREG_LC_SYNCED; 690 - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_SYNCED, 1); 679 + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_SYNCED, 1); 691 680 if (mlxreg_lc->state & ~MLXREG_LC_POWERED) { 692 681 err = mlxreg_lc_power_on_off(mlxreg_lc, 1); 693 682 if (err) ··· 695 684 } 696 685 } 697 686 698 - mlxreg_lc_state_update(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); 687 + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 1); 699 688 700 689 return 0; 701 690 ··· 825 814 826 815 mutex_init(&mlxreg_lc->lock); 827 816 /* Set event notification callback. */ 828 - if (data->notifier) { 829 - data->notifier->user_handler = mlxreg_lc_event_handler; 830 - data->notifier->handle = mlxreg_lc; 831 - } 817 + data->notifier->user_handler = mlxreg_lc_event_handler; 818 + data->notifier->handle = mlxreg_lc; 819 + 832 820 data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr); 833 821 if (!data->hpdev.adapter) { 834 822 dev_err(&pdev->dev, "Failed to get adapter for bus %d\n", ··· 873 863 if (err) { 874 864 dev_err(&pdev->dev, "Failed to sync regmap for client %s at bus %d at addr 0x%02x\n", 875 865 data->hpdev.brdinfo->type, data->hpdev.nr, data->hpdev.brdinfo->addr); 876 - err = PTR_ERR(regmap); 877 866 goto regcache_sync_fail; 878 867 } 879 868 ··· 887 878 if (err) 888 879 goto mlxreg_lc_config_init_fail; 889 880 890 - return err; 881 + return 0; 891 882 892 883 mlxreg_lc_config_init_fail: 893 884 regcache_sync_fail: 894 885 regmap_write_fail: 895 886 devm_regmap_init_i2c_fail: 896 - if (data->hpdev.client) { 897 - i2c_unregister_device(data->hpdev.client); 898 - data->hpdev.client = NULL; 899 - } 887 + i2c_unregister_device(data->hpdev.client); 888 + data->hpdev.client = NULL; 900 889 i2c_new_device_fail: 901 890 i2c_put_adapter(data->hpdev.adapter); 902 891 data->hpdev.adapter = NULL; ··· 911 904 { 912 905 struct mlxreg_core_data *data = dev_get_platdata(&pdev->dev); 913 906 struct mlxreg_lc *mlxreg_lc = platform_get_drvdata(pdev); 907 + 908 + mlxreg_lc_state_update_locked(mlxreg_lc, MLXREG_LC_INITIALIZED, 0); 914 909 915 910 /* 916 911 * Probing and removing are invoked by hotplug events raised upon line card insertion and
+26 -21
drivers/platform/surface/surface_aggregator_registry.c
··· 86 86 .parent = &ssam_node_root, 87 87 }; 88 88 89 - /* HID keyboard (TID1). */ 90 - static const struct software_node ssam_node_hid_tid1_keyboard = { 89 + /* HID keyboard (SAM, TID=1). */ 90 + static const struct software_node ssam_node_hid_sam_keyboard = { 91 91 .name = "ssam:01:15:01:01:00", 92 92 .parent = &ssam_node_root, 93 93 }; 94 94 95 - /* HID pen stash (TID1; pen taken / stashed away evens). */ 96 - static const struct software_node ssam_node_hid_tid1_penstash = { 95 + /* HID pen stash (SAM, TID=1; pen taken / stashed away evens). */ 96 + static const struct software_node ssam_node_hid_sam_penstash = { 97 97 .name = "ssam:01:15:01:02:00", 98 98 .parent = &ssam_node_root, 99 99 }; 100 100 101 - /* HID touchpad (TID1). */ 102 - static const struct software_node ssam_node_hid_tid1_touchpad = { 101 + /* HID touchpad (SAM, TID=1). */ 102 + static const struct software_node ssam_node_hid_sam_touchpad = { 103 103 .name = "ssam:01:15:01:03:00", 104 104 .parent = &ssam_node_root, 105 105 }; 106 106 107 - /* HID device instance 6 (TID1, unknown HID device). */ 108 - static const struct software_node ssam_node_hid_tid1_iid6 = { 107 + /* HID device instance 6 (SAM, TID=1, HID sensor collection). */ 108 + static const struct software_node ssam_node_hid_sam_sensors = { 109 109 .name = "ssam:01:15:01:06:00", 110 110 .parent = &ssam_node_root, 111 111 }; 112 112 113 - /* HID device instance 7 (TID1, unknown HID device). */ 114 - static const struct software_node ssam_node_hid_tid1_iid7 = { 113 + /* HID device instance 7 (SAM, TID=1, UCM UCSI HID client). */ 114 + static const struct software_node ssam_node_hid_sam_ucm_ucsi = { 115 115 .name = "ssam:01:15:01:07:00", 116 116 .parent = &ssam_node_root, 117 117 }; 118 118 119 - /* HID system controls (TID1). */ 120 - static const struct software_node ssam_node_hid_tid1_sysctrl = { 119 + /* HID system controls (SAM, TID=1). */ 120 + static const struct software_node ssam_node_hid_sam_sysctrl = { 121 121 .name = "ssam:01:15:01:08:00", 122 122 .parent = &ssam_node_root, 123 123 }; ··· 182 182 .parent = &ssam_node_hub_kip, 183 183 }; 184 184 185 - /* HID device instance 5 (KIP hub, unknown HID device). */ 186 - static const struct software_node ssam_node_hid_kip_iid5 = { 185 + /* HID device instance 5 (KIP hub, type-cover firmware update). */ 186 + static const struct software_node ssam_node_hid_kip_fwupd = { 187 187 .name = "ssam:01:15:02:05:00", 188 188 .parent = &ssam_node_hub_kip, 189 189 }; ··· 241 241 &ssam_node_bat_main, 242 242 &ssam_node_tmp_pprof, 243 243 &ssam_node_pos_tablet_switch, 244 - &ssam_node_hid_tid1_keyboard, 245 - &ssam_node_hid_tid1_penstash, 246 - &ssam_node_hid_tid1_touchpad, 247 - &ssam_node_hid_tid1_iid6, 248 - &ssam_node_hid_tid1_iid7, 249 - &ssam_node_hid_tid1_sysctrl, 244 + &ssam_node_hid_sam_keyboard, 245 + &ssam_node_hid_sam_penstash, 246 + &ssam_node_hid_sam_touchpad, 247 + &ssam_node_hid_sam_sensors, 248 + &ssam_node_hid_sam_ucm_ucsi, 249 + &ssam_node_hid_sam_sysctrl, 250 250 NULL, 251 251 }; 252 252 ··· 278 278 &ssam_node_hid_kip_keyboard, 279 279 &ssam_node_hid_kip_penstash, 280 280 &ssam_node_hid_kip_touchpad, 281 - &ssam_node_hid_kip_iid5, 281 + &ssam_node_hid_kip_fwupd, 282 + &ssam_node_hid_sam_sensors, 283 + &ssam_node_hid_sam_ucm_ucsi, 282 284 NULL, 283 285 }; 284 286 ··· 326 324 327 325 /* Surface Laptop Go 1 */ 328 326 { "MSHW0118", (unsigned long)ssam_node_group_slg1 }, 327 + 328 + /* Surface Laptop Go 2 */ 329 + { "MSHW0290", (unsigned long)ssam_node_group_slg1 }, 329 330 330 331 /* Surface Laptop Studio */ 331 332 { "MSHW0123", (unsigned long)ssam_node_group_sls },
+8 -1
drivers/platform/x86/acer-wmi.c
··· 99 99 {KE_KEY, 0x22, {KEY_PROG2} }, /* Arcade */ 100 100 {KE_KEY, 0x23, {KEY_PROG3} }, /* P_Key */ 101 101 {KE_KEY, 0x24, {KEY_PROG4} }, /* Social networking_Key */ 102 + {KE_KEY, 0x27, {KEY_HELP} }, 102 103 {KE_KEY, 0x29, {KEY_PROG3} }, /* P_Key for TM8372 */ 103 104 {KE_IGNORE, 0x41, {KEY_MUTE} }, 104 105 {KE_IGNORE, 0x42, {KEY_PREVIOUSSONG} }, ··· 113 112 {KE_IGNORE, 0x48, {KEY_VOLUMEUP} }, 114 113 {KE_IGNORE, 0x49, {KEY_VOLUMEDOWN} }, 115 114 {KE_IGNORE, 0x4a, {KEY_VOLUMEDOWN} }, 116 - {KE_IGNORE, 0x61, {KEY_SWITCHVIDEOMODE} }, 115 + /* 116 + * 0x61 is KEY_SWITCHVIDEOMODE. Usually this is a duplicate input event 117 + * with the "Video Bus" input device events. But sometimes it is not 118 + * a dup. Map it to KEY_UNKNOWN instead of using KE_IGNORE so that 119 + * udev/hwdb can override it on systems where it is not a dup. 120 + */ 121 + {KE_KEY, 0x61, {KEY_UNKNOWN} }, 117 122 {KE_IGNORE, 0x62, {KEY_BRIGHTNESSUP} }, 118 123 {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} }, 119 124 {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
+5 -6
drivers/platform/x86/asus-wmi.c
··· 107 107 #define WMI_EVENT_MASK 0xFFFF 108 108 109 109 #define FAN_CURVE_POINTS 8 110 - #define FAN_CURVE_BUF_LEN (FAN_CURVE_POINTS * 2) 110 + #define FAN_CURVE_BUF_LEN 32 111 111 #define FAN_CURVE_DEV_CPU 0x00 112 112 #define FAN_CURVE_DEV_GPU 0x01 113 113 /* Mask to determine if setting temperature or percentage */ ··· 1118 1118 } 1119 1119 1120 1120 if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MICMUTE_LED)) { 1121 - asus->micmute_led.name = "asus::micmute"; 1121 + asus->micmute_led.name = "platform::micmute"; 1122 1122 asus->micmute_led.max_brightness = 1; 1123 1123 asus->micmute_led.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); 1124 1124 asus->micmute_led.brightness_set_blocking = micmute_led_set; ··· 2233 2233 curves = &asus->custom_fan_curves[fan_idx]; 2234 2234 err = asus_wmi_evaluate_method_buf(asus->dsts_id, fan_dev, mode, buf, 2235 2235 FAN_CURVE_BUF_LEN); 2236 - if (err) 2236 + if (err) { 2237 + pr_warn("%s (0x%08x) failed: %d\n", __func__, fan_dev, err); 2237 2238 return err; 2239 + } 2238 2240 2239 2241 fan_curve_copy_from_buf(curves, buf); 2240 2242 curves->device_id = fan_dev; ··· 2254 2252 2255 2253 err = fan_curve_get_factory_default(asus, fan_dev); 2256 2254 if (err) { 2257 - pr_debug("fan_curve_get_factory_default(0x%08x) failed: %d\n", 2258 - fan_dev, err); 2259 - /* Don't cause probe to fail on devices without fan-curves */ 2260 2255 return 0; 2261 2256 } 2262 2257
+16 -2
drivers/platform/x86/p2sb.c
··· 42 42 return 0; 43 43 } 44 44 45 + /* Copy resource from the first BAR of the device in question */ 45 46 static int p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem) 46 47 { 47 - /* Copy resource from the first BAR of the device in question */ 48 - *mem = pdev->resource[0]; 48 + struct resource *bar0 = &pdev->resource[0]; 49 + 50 + /* Make sure we have no dangling pointers in the output */ 51 + memset(mem, 0, sizeof(*mem)); 52 + 53 + /* 54 + * We copy only selected fields from the original resource. 55 + * Because a PCI device will be removed soon, we may not use 56 + * any allocated data, hence we may not copy any pointers. 57 + */ 58 + mem->start = bar0->start; 59 + mem->end = bar0->end; 60 + mem->flags = bar0->flags; 61 + mem->desc = bar0->desc; 62 + 49 63 return 0; 50 64 } 51 65
+1 -1
drivers/platform/x86/pmc_atom.c
··· 232 232 pm1_cnt_port = acpi_base_addr + PM1_CNT; 233 233 234 234 pm1_cnt_value = inl(pm1_cnt_port); 235 - pm1_cnt_value &= SLEEP_TYPE_MASK; 235 + pm1_cnt_value &= ~SLEEP_TYPE_MASK; 236 236 pm1_cnt_value |= SLEEP_TYPE_S5; 237 237 pm1_cnt_value |= SLEEP_ENABLE; 238 238
+3 -4
drivers/platform/x86/thinkpad_acpi.c
··· 10592 10592 /* Ensure initial values are correct */ 10593 10593 dytc_profile_refresh(); 10594 10594 10595 - /* Set AMT correctly now we know current profile */ 10596 - if ((dytc_capabilities & BIT(DYTC_FC_PSC)) && 10597 - (dytc_capabilities & BIT(DYTC_FC_AMT))) 10598 - dytc_control_amt(dytc_current_profile == PLATFORM_PROFILE_BALANCED); 10595 + /* Workaround for https://bugzilla.kernel.org/show_bug.cgi?id=216347 */ 10596 + if (dytc_capabilities & BIT(DYTC_FC_PSC)) 10597 + dytc_profile_set(NULL, PLATFORM_PROFILE_BALANCED); 10599 10598 10600 10599 return 0; 10601 10600 }
+14
drivers/platform/x86/x86-android-tablets.c
··· 663 663 }, 664 664 }; 665 665 666 + static int __init chuwi_hi8_init(void) 667 + { 668 + /* 669 + * Avoid the acpi_unregister_gsi() call in x86_acpi_irq_helper_get() 670 + * breaking the touchscreen + logging various errors when the Windows 671 + * BIOS is used. 672 + */ 673 + if (acpi_dev_present("MSSL0001", NULL, 1)) 674 + return -ENODEV; 675 + 676 + return 0; 677 + } 678 + 666 679 static const struct x86_dev_info chuwi_hi8_info __initconst = { 667 680 .i2c_client_info = chuwi_hi8_i2c_clients, 668 681 .i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients), 682 + .init = chuwi_hi8_init, 669 683 }; 670 684 671 685 #define CZC_EC_EXTRA_PORT 0x68
+38 -10
drivers/soc/bcm/brcmstb/pm/pm-arm.c
··· 684 684 const struct of_device_id *of_id = NULL; 685 685 struct device_node *dn; 686 686 void __iomem *base; 687 - int ret, i; 687 + int ret, i, s; 688 688 689 689 /* AON ctrl registers */ 690 690 base = brcmstb_ioremap_match(aon_ctrl_dt_ids, 0, NULL); 691 691 if (IS_ERR(base)) { 692 692 pr_err("error mapping AON_CTRL\n"); 693 - return PTR_ERR(base); 693 + ret = PTR_ERR(base); 694 + goto aon_err; 694 695 } 695 696 ctrl.aon_ctrl_base = base; 696 697 ··· 701 700 /* Assume standard offset */ 702 701 ctrl.aon_sram = ctrl.aon_ctrl_base + 703 702 AON_CTRL_SYSTEM_DATA_RAM_OFS; 703 + s = 0; 704 704 } else { 705 705 ctrl.aon_sram = base; 706 + s = 1; 706 707 } 707 708 708 709 writel_relaxed(0, ctrl.aon_sram + AON_REG_PANIC); ··· 714 711 (const void **)&ddr_phy_data); 715 712 if (IS_ERR(base)) { 716 713 pr_err("error mapping DDR PHY\n"); 717 - return PTR_ERR(base); 714 + ret = PTR_ERR(base); 715 + goto ddr_phy_err; 718 716 } 719 717 ctrl.support_warm_boot = ddr_phy_data->supports_warm_boot; 720 718 ctrl.pll_status_offset = ddr_phy_data->pll_status_offset; ··· 735 731 for_each_matching_node(dn, ddr_shimphy_dt_ids) { 736 732 i = ctrl.num_memc; 737 733 if (i >= MAX_NUM_MEMC) { 734 + of_node_put(dn); 738 735 pr_warn("too many MEMCs (max %d)\n", MAX_NUM_MEMC); 739 736 break; 740 737 } 741 738 742 739 base = of_io_request_and_map(dn, 0, dn->full_name); 743 740 if (IS_ERR(base)) { 741 + of_node_put(dn); 744 742 if (!ctrl.support_warm_boot) 745 743 break; 746 744 747 745 pr_err("error mapping DDR SHIMPHY %d\n", i); 748 - return PTR_ERR(base); 746 + ret = PTR_ERR(base); 747 + goto ddr_shimphy_err; 749 748 } 750 749 ctrl.memcs[i].ddr_shimphy_base = base; 751 750 ctrl.num_memc++; ··· 759 752 for_each_matching_node(dn, brcmstb_memc_of_match) { 760 753 base = of_iomap(dn, 0); 761 754 if (!base) { 755 + of_node_put(dn); 762 756 pr_err("error mapping DDR Sequencer %d\n", i); 763 - return -ENOMEM; 757 + ret = -ENOMEM; 758 + goto brcmstb_memc_err; 764 759 } 765 760 766 761 of_id = of_match_node(brcmstb_memc_of_match, dn); 767 762 if (!of_id) { 768 763 iounmap(base); 769 - return -EINVAL; 764 + of_node_put(dn); 765 + ret = -EINVAL; 766 + goto brcmstb_memc_err; 770 767 } 771 768 772 769 ddr_seq_data = of_id->data; ··· 790 779 dn = of_find_matching_node(NULL, sram_dt_ids); 791 780 if (!dn) { 792 781 pr_err("SRAM not found\n"); 793 - return -EINVAL; 782 + ret = -EINVAL; 783 + goto brcmstb_memc_err; 794 784 } 795 785 796 786 ret = brcmstb_init_sram(dn); 797 787 of_node_put(dn); 798 788 if (ret) { 799 789 pr_err("error setting up SRAM for PM\n"); 800 - return ret; 790 + goto brcmstb_memc_err; 801 791 } 802 792 803 793 ctrl.pdev = pdev; 804 794 805 795 ctrl.s3_params = kmalloc(sizeof(*ctrl.s3_params), GFP_KERNEL); 806 - if (!ctrl.s3_params) 807 - return -ENOMEM; 796 + if (!ctrl.s3_params) { 797 + ret = -ENOMEM; 798 + goto s3_params_err; 799 + } 808 800 ctrl.s3_params_pa = dma_map_single(&pdev->dev, ctrl.s3_params, 809 801 sizeof(*ctrl.s3_params), 810 802 DMA_TO_DEVICE); ··· 827 813 828 814 out: 829 815 kfree(ctrl.s3_params); 816 + s3_params_err: 817 + iounmap(ctrl.boot_sram); 818 + brcmstb_memc_err: 819 + for (i--; i >= 0; i--) 820 + iounmap(ctrl.memcs[i].ddr_ctrl); 821 + ddr_shimphy_err: 822 + for (i = 0; i < ctrl.num_memc; i++) 823 + iounmap(ctrl.memcs[i].ddr_shimphy_base); 830 824 825 + iounmap(ctrl.memcs[0].ddr_phy_base); 826 + ddr_phy_err: 827 + iounmap(ctrl.aon_ctrl_base); 828 + if (s) 829 + iounmap(ctrl.aon_sram); 830 + aon_err: 831 831 pr_warn("PM: initialization failed with code %d\n", ret); 832 832 833 833 return ret;
+1
drivers/soc/fsl/Kconfig
··· 24 24 tristate "QorIQ DPAA2 DPIO driver" 25 25 depends on FSL_MC_BUS 26 26 select SOC_BUS 27 + select FSL_GUTS 27 28 select DIMLIB 28 29 help 29 30 Driver for the DPAA2 DPIO object. A DPIO provides queue and
+4 -1
drivers/soc/imx/gpcv2.c
··· 335 335 } 336 336 } 337 337 338 + reset_control_assert(domain->reset); 339 + 338 340 /* Enable reset clocks for all devices in the domain */ 339 341 ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks); 340 342 if (ret) { ··· 344 342 goto out_regulator_disable; 345 343 } 346 344 347 - reset_control_assert(domain->reset); 345 + /* delays for reset to propagate */ 346 + udelay(5); 348 347 349 348 if (domain->bits.pxx) { 350 349 /* request the domain to power up */
-1
drivers/soc/imx/imx8m-blk-ctrl.c
··· 243 243 ret = PTR_ERR(domain->power_dev); 244 244 goto cleanup_pds; 245 245 } 246 - dev_set_name(domain->power_dev, "%s", data->name); 247 246 248 247 domain->genpd.name = data->name; 249 248 domain->genpd.power_on = imx8m_blk_ctrl_power_on;
+3 -7
drivers/soundwire/qcom.c
··· 169 169 u8 wcmd_id; 170 170 struct qcom_swrm_port_config pconfig[QCOM_SDW_MAX_PORTS]; 171 171 struct sdw_stream_runtime *sruntime[SWRM_MAX_DAIS]; 172 - enum sdw_slave_status status[SDW_MAX_DEVICES]; 172 + enum sdw_slave_status status[SDW_MAX_DEVICES + 1]; 173 173 int (*reg_read)(struct qcom_swrm_ctrl *ctrl, int reg, u32 *val); 174 174 int (*reg_write)(struct qcom_swrm_ctrl *ctrl, int reg, int val); 175 175 u32 slave_status; ··· 420 420 421 421 ctrl->reg_read(ctrl, SWRM_MCP_SLV_STATUS, &val); 422 422 423 - for (dev_num = 0; dev_num < SDW_MAX_DEVICES; dev_num++) { 423 + for (dev_num = 0; dev_num <= SDW_MAX_DEVICES; dev_num++) { 424 424 status = (val >> (dev_num * SWRM_MCP_SLV_STATUS_SZ)); 425 425 426 426 if ((status & SWRM_MCP_SLV_STATUS_MASK) == SDW_SLAVE_ALERT) { ··· 440 440 ctrl->reg_read(ctrl, SWRM_MCP_SLV_STATUS, &val); 441 441 ctrl->slave_status = val; 442 442 443 - for (i = 0; i < SDW_MAX_DEVICES; i++) { 443 + for (i = 0; i <= SDW_MAX_DEVICES; i++) { 444 444 u32 s; 445 445 446 446 s = (val >> (i * 2)); ··· 1355 1355 ctrl->bus.port_ops = &qcom_swrm_port_ops; 1356 1356 ctrl->bus.compute_params = &qcom_swrm_compute_params; 1357 1357 ctrl->bus.clk_stop_timeout = 300; 1358 - 1359 - ctrl->audio_cgcr = devm_reset_control_get_exclusive(dev, "swr_audio_cgcr"); 1360 - if (IS_ERR(ctrl->audio_cgcr)) 1361 - dev_err(dev, "Failed to get audio_cgcr reset required for soundwire-v1.6.0\n"); 1362 1358 1363 1359 ret = qcom_swrm_get_port_config(ctrl); 1364 1360 if (ret)
+1
drivers/staging/r8188eu/os_dep/os_intfs.c
··· 18 18 MODULE_DESCRIPTION("Realtek Wireless Lan Driver"); 19 19 MODULE_AUTHOR("Realtek Semiconductor Corp."); 20 20 MODULE_VERSION(DRIVERVERSION); 21 + MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin"); 21 22 22 23 #define CONFIG_BR_EXT_BRNAME "br0" 23 24 #define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */
+1
drivers/staging/r8188eu/os_dep/usb_intf.c
··· 28 28 /*=== Realtek demoboard ===*/ 29 29 {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8179)}, /* 8188EUS */ 30 30 {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ 31 + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill USB-N150 Nano */ 31 32 /*=== Customer ID ===*/ 32 33 /****** 8188EUS ********/ 33 34 {USB_DEVICE(0x07B8, 0x8179)}, /* Abocom - Abocom */
-36
drivers/staging/rtl8712/rtl8712_cmd.c
··· 117 117 kfree(pdrvcmd->pbuf); 118 118 } 119 119 120 - static u8 read_macreg_hdl(struct _adapter *padapter, u8 *pbuf) 121 - { 122 - void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd); 123 - struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; 124 - 125 - /* invoke cmd->callback function */ 126 - pcmd_callback = cmd_callback[pcmd->cmdcode].callback; 127 - if (!pcmd_callback) 128 - r8712_free_cmd_obj(pcmd); 129 - else 130 - pcmd_callback(padapter, pcmd); 131 - return H2C_SUCCESS; 132 - } 133 - 134 - static u8 write_macreg_hdl(struct _adapter *padapter, u8 *pbuf) 135 - { 136 - void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd); 137 - struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; 138 - 139 - /* invoke cmd->callback function */ 140 - pcmd_callback = cmd_callback[pcmd->cmdcode].callback; 141 - if (!pcmd_callback) 142 - r8712_free_cmd_obj(pcmd); 143 - else 144 - pcmd_callback(padapter, pcmd); 145 - return H2C_SUCCESS; 146 - } 147 - 148 120 static u8 read_bbreg_hdl(struct _adapter *padapter, u8 *pbuf) 149 121 { 150 122 struct cmd_obj *pcmd = (struct cmd_obj *)pbuf; ··· 185 213 pcmd_r = NULL; 186 214 187 215 switch (pcmd->cmdcode) { 188 - case GEN_CMD_CODE(_Read_MACREG): 189 - read_macreg_hdl(padapter, (u8 *)pcmd); 190 - pcmd_r = pcmd; 191 - break; 192 - case GEN_CMD_CODE(_Write_MACREG): 193 - write_macreg_hdl(padapter, (u8 *)pcmd); 194 - pcmd_r = pcmd; 195 - break; 196 216 case GEN_CMD_CODE(_Read_BBREG): 197 217 read_bbreg_hdl(padapter, (u8 *)pcmd); 198 218 break;
+1
drivers/tee/tee_shm.c
··· 9 9 #include <linux/sched.h> 10 10 #include <linux/slab.h> 11 11 #include <linux/tee_drv.h> 12 + #include <linux/uaccess.h> 12 13 #include <linux/uio.h> 13 14 #include "tee_private.h" 14 15
+1 -1
drivers/thunderbolt/ctl.c
··· 407 407 408 408 static int tb_async_error(const struct ctl_pkg *pkg) 409 409 { 410 - const struct cfg_error_pkg *error = (const struct cfg_error_pkg *)pkg; 410 + const struct cfg_error_pkg *error = pkg->buffer; 411 411 412 412 if (pkg->frame.eof != TB_CFG_PKG_ERROR) 413 413 return false;
+5 -1
drivers/thunderbolt/switch.c
··· 3786 3786 */ 3787 3787 int tb_switch_xhci_connect(struct tb_switch *sw) 3788 3788 { 3789 - bool usb_port1, usb_port3, xhci_port1, xhci_port3; 3790 3789 struct tb_port *port1, *port3; 3791 3790 int ret; 3791 + 3792 + if (sw->generation != 3) 3793 + return 0; 3792 3794 3793 3795 port1 = &sw->ports[1]; 3794 3796 port3 = &sw->ports[3]; 3795 3797 3796 3798 if (tb_switch_is_alpine_ridge(sw)) { 3799 + bool usb_port1, usb_port3, xhci_port1, xhci_port3; 3800 + 3797 3801 usb_port1 = tb_lc_is_usb_plugged(port1); 3798 3802 usb_port3 = tb_lc_is_usb_plugged(port3); 3799 3803 xhci_port1 = tb_lc_is_xhci_connected(port1);
+38 -47
drivers/tty/n_gsm.c
··· 248 248 bool constipated; /* Asked by remote to shut up */ 249 249 bool has_devices; /* Devices were registered */ 250 250 251 - spinlock_t tx_lock; 251 + struct mutex tx_mutex; 252 252 unsigned int tx_bytes; /* TX data outstanding */ 253 253 #define TX_THRESH_HI 8192 254 254 #define TX_THRESH_LO 2048 ··· 256 256 struct list_head tx_data_list; /* Pending data packets */ 257 257 258 258 /* Control messages */ 259 - struct timer_list kick_timer; /* Kick TX queuing on timeout */ 259 + struct delayed_work kick_timeout; /* Kick TX queuing on timeout */ 260 260 struct timer_list t2_timer; /* Retransmit timer for commands */ 261 261 int cretries; /* Command retry counter */ 262 262 struct gsm_control *pending_cmd;/* Our current pending command */ ··· 680 680 struct gsm_msg *msg; 681 681 u8 *dp; 682 682 int ocr; 683 - unsigned long flags; 684 683 685 684 msg = gsm_data_alloc(gsm, addr, 0, control); 686 685 if (!msg) ··· 701 702 702 703 gsm_print_packet("Q->", addr, cr, control, NULL, 0); 703 704 704 - spin_lock_irqsave(&gsm->tx_lock, flags); 705 + mutex_lock(&gsm->tx_mutex); 705 706 list_add_tail(&msg->list, &gsm->tx_ctrl_list); 706 707 gsm->tx_bytes += msg->len; 707 - spin_unlock_irqrestore(&gsm->tx_lock, flags); 708 + mutex_unlock(&gsm->tx_mutex); 708 709 gsmld_write_trigger(gsm); 709 710 710 711 return 0; ··· 729 730 spin_unlock_irqrestore(&dlci->lock, flags); 730 731 731 732 /* Clear data packets in MUX write queue */ 732 - spin_lock_irqsave(&gsm->tx_lock, flags); 733 + mutex_lock(&gsm->tx_mutex); 733 734 list_for_each_entry_safe(msg, nmsg, &gsm->tx_data_list, list) { 734 735 if (msg->addr != addr) 735 736 continue; ··· 737 738 list_del(&msg->list); 738 739 kfree(msg); 739 740 } 740 - spin_unlock_irqrestore(&gsm->tx_lock, flags); 741 + mutex_unlock(&gsm->tx_mutex); 741 742 } 742 743 743 744 /** ··· 1008 1009 gsm->tx_bytes += msg->len; 1009 1010 1010 1011 gsmld_write_trigger(gsm); 1011 - mod_timer(&gsm->kick_timer, jiffies + 10 * gsm->t1 * HZ / 100); 1012 + schedule_delayed_work(&gsm->kick_timeout, 10 * gsm->t1 * HZ / 100); 1012 1013 } 1013 1014 1014 1015 /** ··· 1023 1024 1024 1025 static void gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) 1025 1026 { 1026 - unsigned long flags; 1027 - spin_lock_irqsave(&dlci->gsm->tx_lock, flags); 1027 + mutex_lock(&dlci->gsm->tx_mutex); 1028 1028 __gsm_data_queue(dlci, msg); 1029 - spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags); 1029 + mutex_unlock(&dlci->gsm->tx_mutex); 1030 1030 } 1031 1031 1032 1032 /** ··· 1037 1039 * is data. Keep to the MRU of the mux. This path handles the usual tty 1038 1040 * interface which is a byte stream with optional modem data. 1039 1041 * 1040 - * Caller must hold the tx_lock of the mux. 1042 + * Caller must hold the tx_mutex of the mux. 1041 1043 */ 1042 1044 1043 1045 static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci) ··· 1097 1099 * is data. Keep to the MRU of the mux. This path handles framed data 1098 1100 * queued as skbuffs to the DLCI. 1099 1101 * 1100 - * Caller must hold the tx_lock of the mux. 1102 + * Caller must hold the tx_mutex of the mux. 1101 1103 */ 1102 1104 1103 1105 static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, ··· 1113 1115 if (dlci->adaption == 4) 1114 1116 overhead = 1; 1115 1117 1116 - /* dlci->skb is locked by tx_lock */ 1118 + /* dlci->skb is locked by tx_mutex */ 1117 1119 if (dlci->skb == NULL) { 1118 1120 dlci->skb = skb_dequeue_tail(&dlci->skb_list); 1119 1121 if (dlci->skb == NULL) ··· 1167 1169 * Push an empty frame in to the transmit queue to update the modem status 1168 1170 * bits and to transmit an optional break. 1169 1171 * 1170 - * Caller must hold the tx_lock of the mux. 1172 + * Caller must hold the tx_mutex of the mux. 1171 1173 */ 1172 1174 1173 1175 static int gsm_dlci_modem_output(struct gsm_mux *gsm, struct gsm_dlci *dlci, ··· 1281 1283 1282 1284 static void gsm_dlci_data_kick(struct gsm_dlci *dlci) 1283 1285 { 1284 - unsigned long flags; 1285 1286 int sweep; 1286 1287 1287 1288 if (dlci->constipated) 1288 1289 return; 1289 1290 1290 - spin_lock_irqsave(&dlci->gsm->tx_lock, flags); 1291 + mutex_lock(&dlci->gsm->tx_mutex); 1291 1292 /* If we have nothing running then we need to fire up */ 1292 1293 sweep = (dlci->gsm->tx_bytes < TX_THRESH_LO); 1293 1294 if (dlci->gsm->tx_bytes == 0) { ··· 1297 1300 } 1298 1301 if (sweep) 1299 1302 gsm_dlci_data_sweep(dlci->gsm); 1300 - spin_unlock_irqrestore(&dlci->gsm->tx_lock, flags); 1303 + mutex_unlock(&dlci->gsm->tx_mutex); 1301 1304 } 1302 1305 1303 1306 /* ··· 1981 1984 } 1982 1985 1983 1986 /** 1984 - * gsm_kick_timer - transmit if possible 1985 - * @t: timer contained in our gsm object 1987 + * gsm_kick_timeout - transmit if possible 1988 + * @work: work contained in our gsm object 1986 1989 * 1987 1990 * Transmit data from DLCIs if the queue is empty. We can't rely on 1988 1991 * a tty wakeup except when we filled the pipe so we need to fire off 1989 1992 * new data ourselves in other cases. 1990 1993 */ 1991 - static void gsm_kick_timer(struct timer_list *t) 1994 + static void gsm_kick_timeout(struct work_struct *work) 1992 1995 { 1993 - struct gsm_mux *gsm = from_timer(gsm, t, kick_timer); 1994 - unsigned long flags; 1996 + struct gsm_mux *gsm = container_of(work, struct gsm_mux, kick_timeout.work); 1995 1997 int sent = 0; 1996 1998 1997 - spin_lock_irqsave(&gsm->tx_lock, flags); 1999 + mutex_lock(&gsm->tx_mutex); 1998 2000 /* If we have nothing running then we need to fire up */ 1999 2001 if (gsm->tx_bytes < TX_THRESH_LO) 2000 2002 sent = gsm_dlci_data_sweep(gsm); 2001 - spin_unlock_irqrestore(&gsm->tx_lock, flags); 2003 + mutex_unlock(&gsm->tx_mutex); 2002 2004 2003 2005 if (sent && debug & 4) 2004 2006 pr_info("%s TX queue stalled\n", __func__); ··· 2454 2458 } 2455 2459 2456 2460 /* Finish outstanding timers, making sure they are done */ 2457 - del_timer_sync(&gsm->kick_timer); 2461 + cancel_delayed_work_sync(&gsm->kick_timeout); 2458 2462 del_timer_sync(&gsm->t2_timer); 2459 2463 2460 2464 /* Finish writing to ldisc */ ··· 2497 2501 if (dlci == NULL) 2498 2502 return -ENOMEM; 2499 2503 2500 - timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); 2501 - timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); 2502 - INIT_WORK(&gsm->tx_work, gsmld_write_task); 2503 - init_waitqueue_head(&gsm->event); 2504 - spin_lock_init(&gsm->control_lock); 2505 - spin_lock_init(&gsm->tx_lock); 2506 - 2507 2504 if (gsm->encoding == 0) 2508 2505 gsm->receive = gsm0_receive; 2509 2506 else ··· 2527 2538 break; 2528 2539 } 2529 2540 } 2541 + mutex_destroy(&gsm->tx_mutex); 2530 2542 mutex_destroy(&gsm->mutex); 2531 2543 kfree(gsm->txframe); 2532 2544 kfree(gsm->buf); ··· 2599 2609 } 2600 2610 spin_lock_init(&gsm->lock); 2601 2611 mutex_init(&gsm->mutex); 2612 + mutex_init(&gsm->tx_mutex); 2602 2613 kref_init(&gsm->ref); 2603 2614 INIT_LIST_HEAD(&gsm->tx_ctrl_list); 2604 2615 INIT_LIST_HEAD(&gsm->tx_data_list); 2616 + INIT_DELAYED_WORK(&gsm->kick_timeout, gsm_kick_timeout); 2617 + timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); 2618 + INIT_WORK(&gsm->tx_work, gsmld_write_task); 2619 + init_waitqueue_head(&gsm->event); 2620 + spin_lock_init(&gsm->control_lock); 2605 2621 2606 2622 gsm->t1 = T1; 2607 2623 gsm->t2 = T2; ··· 2632 2636 } 2633 2637 spin_unlock(&gsm_mux_lock); 2634 2638 if (i == MAX_MUX) { 2639 + mutex_destroy(&gsm->tx_mutex); 2635 2640 mutex_destroy(&gsm->mutex); 2636 2641 kfree(gsm->txframe); 2637 2642 kfree(gsm->buf); ··· 2788 2791 static void gsmld_write_task(struct work_struct *work) 2789 2792 { 2790 2793 struct gsm_mux *gsm = container_of(work, struct gsm_mux, tx_work); 2791 - unsigned long flags; 2792 2794 int i, ret; 2793 2795 2794 2796 /* All outstanding control channel and control messages and one data 2795 2797 * frame is sent. 2796 2798 */ 2797 2799 ret = -ENODEV; 2798 - spin_lock_irqsave(&gsm->tx_lock, flags); 2800 + mutex_lock(&gsm->tx_mutex); 2799 2801 if (gsm->tty) 2800 2802 ret = gsm_data_kick(gsm); 2801 - spin_unlock_irqrestore(&gsm->tx_lock, flags); 2803 + mutex_unlock(&gsm->tx_mutex); 2802 2804 2803 2805 if (ret >= 0) 2804 2806 for (i = 0; i < NUM_DLCI; i++) ··· 2854 2858 flags = *fp++; 2855 2859 switch (flags) { 2856 2860 case TTY_NORMAL: 2857 - gsm->receive(gsm, *cp); 2861 + if (gsm->receive) 2862 + gsm->receive(gsm, *cp); 2858 2863 break; 2859 2864 case TTY_OVERRUN: 2860 2865 case TTY_BREAK: ··· 2943 2946 2944 2947 gsmld_attach_gsm(tty, gsm); 2945 2948 2946 - timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); 2947 - timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); 2948 - INIT_WORK(&gsm->tx_work, gsmld_write_task); 2949 - 2950 2949 return 0; 2951 2950 } 2952 2951 ··· 3005 3012 const unsigned char *buf, size_t nr) 3006 3013 { 3007 3014 struct gsm_mux *gsm = tty->disc_data; 3008 - unsigned long flags; 3009 3015 int space; 3010 3016 int ret; 3011 3017 ··· 3012 3020 return -ENODEV; 3013 3021 3014 3022 ret = -ENOBUFS; 3015 - spin_lock_irqsave(&gsm->tx_lock, flags); 3023 + mutex_lock(&gsm->tx_mutex); 3016 3024 space = tty_write_room(tty); 3017 3025 if (space >= nr) 3018 3026 ret = tty->ops->write(tty, buf, nr); 3019 3027 else 3020 3028 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 3021 - spin_unlock_irqrestore(&gsm->tx_lock, flags); 3029 + mutex_unlock(&gsm->tx_mutex); 3022 3030 3023 3031 return ret; 3024 3032 } ··· 3315 3323 static void gsm_modem_upd_via_data(struct gsm_dlci *dlci, u8 brk) 3316 3324 { 3317 3325 struct gsm_mux *gsm = dlci->gsm; 3318 - unsigned long flags; 3319 3326 3320 3327 if (dlci->state != DLCI_OPEN || dlci->adaption != 2) 3321 3328 return; 3322 3329 3323 - spin_lock_irqsave(&gsm->tx_lock, flags); 3330 + mutex_lock(&gsm->tx_mutex); 3324 3331 gsm_dlci_modem_output(gsm, dlci, brk); 3325 - spin_unlock_irqrestore(&gsm->tx_lock, flags); 3332 + mutex_unlock(&gsm->tx_mutex); 3326 3333 } 3327 3334 3328 3335 /**
+1 -3
drivers/tty/serial/atmel_serial.c
··· 294 294 295 295 mode = atmel_uart_readl(port, ATMEL_US_MR); 296 296 297 - /* Resetting serial mode to RS232 (0x0) */ 298 - mode &= ~ATMEL_US_USMODE; 299 - 300 297 if (rs485conf->flags & SER_RS485_ENABLED) { 301 298 dev_dbg(port->dev, "Setting UART to RS485\n"); 302 299 if (rs485conf->flags & SER_RS485_RX_DURING_TX) ··· 303 306 304 307 atmel_uart_writel(port, ATMEL_US_TTGR, 305 308 rs485conf->delay_rts_after_send); 309 + mode &= ~ATMEL_US_USMODE; 306 310 mode |= ATMEL_US_USMODE_RS485; 307 311 } else { 308 312 dev_dbg(port->dev, "Setting UART to RS232\n");
+3 -2
drivers/tty/serial/fsl_lpuart.c
··· 1394 1394 * Note: UART is assumed to be active high. 1395 1395 */ 1396 1396 if (rs485->flags & SER_RS485_RTS_ON_SEND) 1397 - modem &= ~UARTMODEM_TXRTSPOL; 1398 - else if (rs485->flags & SER_RS485_RTS_AFTER_SEND) 1399 1397 modem |= UARTMODEM_TXRTSPOL; 1398 + else if (rs485->flags & SER_RS485_RTS_AFTER_SEND) 1399 + modem &= ~UARTMODEM_TXRTSPOL; 1400 1400 } 1401 1401 1402 1402 writeb(modem, sport->port.membase + UARTMODEM); ··· 2191 2191 uart_update_timeout(port, termios->c_cflag, baud); 2192 2192 2193 2193 /* wait transmit engin complete */ 2194 + lpuart32_write(&sport->port, 0, UARTMODIR); 2194 2195 lpuart32_wait_bit_set(&sport->port, UARTSTAT, UARTSTAT_TC); 2195 2196 2196 2197 /* disable transmit and receive */
+9 -5
drivers/tty/tty_buffer.c
··· 470 470 471 471 while (head) { 472 472 struct tty_buffer *next; 473 - unsigned char *p, *f = NULL; 474 473 unsigned int count; 475 474 476 475 /* ··· 488 489 continue; 489 490 } 490 491 491 - p = char_buf_ptr(head, head->lookahead); 492 - if (~head->flags & TTYB_NORMAL) 493 - f = flag_buf_ptr(head, head->lookahead); 492 + if (port->client_ops->lookahead_buf) { 493 + unsigned char *p, *f = NULL; 494 494 495 - port->client_ops->lookahead_buf(port, p, f, count); 495 + p = char_buf_ptr(head, head->lookahead); 496 + if (~head->flags & TTYB_NORMAL) 497 + f = flag_buf_ptr(head, head->lookahead); 498 + 499 + port->client_ops->lookahead_buf(port, p, f, count); 500 + } 501 + 496 502 head->lookahead += count; 497 503 } 498 504 }
+8 -4
drivers/tty/vt/vt.c
··· 4662 4662 console_lock(); 4663 4663 if (vc->vc_mode != KD_TEXT) 4664 4664 rc = -EINVAL; 4665 - else if (vc->vc_sw->con_font_set) 4665 + else if (vc->vc_sw->con_font_set) { 4666 + if (vc_is_sel(vc)) 4667 + clear_selection(); 4666 4668 rc = vc->vc_sw->con_font_set(vc, &font, op->flags); 4667 - else 4669 + } else 4668 4670 rc = -ENOSYS; 4669 4671 console_unlock(); 4670 4672 kfree(font.data); ··· 4693 4691 console_unlock(); 4694 4692 return -EINVAL; 4695 4693 } 4696 - if (vc->vc_sw->con_font_default) 4694 + if (vc->vc_sw->con_font_default) { 4695 + if (vc_is_sel(vc)) 4696 + clear_selection(); 4697 4697 rc = vc->vc_sw->con_font_default(vc, &font, s); 4698 - else 4698 + } else 4699 4699 rc = -ENOSYS; 4700 4700 console_unlock(); 4701 4701 if (!rc) {
+3 -1
drivers/usb/cdns3/cdns3-gadget.c
··· 1530 1530 TRB_LEN(le32_to_cpu(trb->length)); 1531 1531 1532 1532 if (priv_req->num_of_trb > 1 && 1533 - le32_to_cpu(trb->control) & TRB_SMM) 1533 + le32_to_cpu(trb->control) & TRB_SMM && 1534 + le32_to_cpu(trb->control) & TRB_CHAIN) 1534 1535 transfer_end = true; 1535 1536 1536 1537 cdns3_ep_inc_deq(priv_ep); ··· 1691 1690 ep_cfg &= ~EP_CFG_ENABLE; 1692 1691 writel(ep_cfg, &priv_dev->regs->ep_cfg); 1693 1692 priv_ep->flags &= ~EP_QUIRK_ISO_OUT_EN; 1693 + priv_ep->flags |= EP_UPDATE_EP_TRBADDR; 1694 1694 } 1695 1695 cdns3_transfer_completed(priv_dev, priv_ep); 1696 1696 } else if (!(priv_ep->flags & EP_STALLED) &&
+3
drivers/usb/class/cdc-acm.c
··· 1810 1810 { USB_DEVICE(0x09d8, 0x0320), /* Elatec GmbH TWN3 */ 1811 1811 .driver_info = NO_UNION_NORMAL, /* has misplaced union descriptor */ 1812 1812 }, 1813 + { USB_DEVICE(0x0c26, 0x0020), /* Icom ICF3400 Serie */ 1814 + .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ 1815 + }, 1813 1816 { USB_DEVICE(0x0ca6, 0xa050), /* Castles VEGA3000 */ 1814 1817 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ 1815 1818 },
+10
drivers/usb/core/hub.c
··· 6038 6038 * the reset is over (using their post_reset method). 6039 6039 * 6040 6040 * Return: The same as for usb_reset_and_verify_device(). 6041 + * However, if a reset is already in progress (for instance, if a 6042 + * driver doesn't have pre_ or post_reset() callbacks, and while 6043 + * being unbound or re-bound during the ongoing reset its disconnect() 6044 + * or probe() routine tries to perform a second, nested reset), the 6045 + * routine returns -EINPROGRESS. 6041 6046 * 6042 6047 * Note: 6043 6048 * The caller must own the device lock. For example, it's safe to use ··· 6075 6070 dev_dbg(&udev->dev, "%s for root hub!\n", __func__); 6076 6071 return -EISDIR; 6077 6072 } 6073 + 6074 + if (udev->reset_in_progress) 6075 + return -EINPROGRESS; 6076 + udev->reset_in_progress = 1; 6078 6077 6079 6078 port_dev = hub->ports[udev->portnum - 1]; 6080 6079 ··· 6144 6135 6145 6136 usb_autosuspend_device(udev); 6146 6137 memalloc_noio_restore(noio_flag); 6138 + udev->reset_in_progress = 0; 6147 6139 return ret; 6148 6140 } 6149 6141 EXPORT_SYMBOL_GPL(usb_reset_device);
+4 -4
drivers/usb/dwc2/platform.c
··· 154 154 } else if (hsotg->plat && hsotg->plat->phy_init) { 155 155 ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); 156 156 } else { 157 - ret = phy_power_on(hsotg->phy); 157 + ret = phy_init(hsotg->phy); 158 158 if (ret == 0) 159 - ret = phy_init(hsotg->phy); 159 + ret = phy_power_on(hsotg->phy); 160 160 } 161 161 162 162 return ret; ··· 188 188 } else if (hsotg->plat && hsotg->plat->phy_exit) { 189 189 ret = hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); 190 190 } else { 191 - ret = phy_exit(hsotg->phy); 191 + ret = phy_power_off(hsotg->phy); 192 192 if (ret == 0) 193 - ret = phy_power_off(hsotg->phy); 193 + ret = phy_exit(hsotg->phy); 194 194 } 195 195 if (ret) 196 196 return ret;
+12 -12
drivers/usb/dwc3/core.c
··· 833 833 { 834 834 dwc3_event_buffers_cleanup(dwc); 835 835 836 + usb_phy_set_suspend(dwc->usb2_phy, 1); 837 + usb_phy_set_suspend(dwc->usb3_phy, 1); 838 + phy_power_off(dwc->usb2_generic_phy); 839 + phy_power_off(dwc->usb3_generic_phy); 840 + 836 841 usb_phy_shutdown(dwc->usb2_phy); 837 842 usb_phy_shutdown(dwc->usb3_phy); 838 843 phy_exit(dwc->usb2_generic_phy); 839 844 phy_exit(dwc->usb3_generic_phy); 840 845 841 - usb_phy_set_suspend(dwc->usb2_phy, 1); 842 - usb_phy_set_suspend(dwc->usb3_phy, 1); 843 - phy_power_off(dwc->usb2_generic_phy); 844 - phy_power_off(dwc->usb3_generic_phy); 845 846 dwc3_clk_disable(dwc); 846 847 reset_control_assert(dwc->reset); 847 848 } ··· 1822 1821 1823 1822 platform_set_drvdata(pdev, dwc); 1824 1823 dwc3_cache_hwparams(dwc); 1825 - device_init_wakeup(&pdev->dev, of_property_read_bool(dev->of_node, "wakeup-source")); 1826 1824 1827 1825 spin_lock_init(&dwc->lock); 1828 1826 mutex_init(&dwc->mutex); ··· 1879 1879 dwc3_debugfs_exit(dwc); 1880 1880 dwc3_event_buffers_cleanup(dwc); 1881 1881 1882 - usb_phy_shutdown(dwc->usb2_phy); 1883 - usb_phy_shutdown(dwc->usb3_phy); 1884 - phy_exit(dwc->usb2_generic_phy); 1885 - phy_exit(dwc->usb3_generic_phy); 1886 - 1887 1882 usb_phy_set_suspend(dwc->usb2_phy, 1); 1888 1883 usb_phy_set_suspend(dwc->usb3_phy, 1); 1889 1884 phy_power_off(dwc->usb2_generic_phy); 1890 1885 phy_power_off(dwc->usb3_generic_phy); 1886 + 1887 + usb_phy_shutdown(dwc->usb2_phy); 1888 + usb_phy_shutdown(dwc->usb3_phy); 1889 + phy_exit(dwc->usb2_generic_phy); 1890 + phy_exit(dwc->usb3_generic_phy); 1891 1891 1892 1892 dwc3_ulpi_exit(dwc); 1893 1893 ··· 1983 1983 dwc3_core_exit(dwc); 1984 1984 break; 1985 1985 case DWC3_GCTL_PRTCAP_HOST: 1986 - if (!PMSG_IS_AUTO(msg) && !device_can_wakeup(dwc->dev)) { 1986 + if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) { 1987 1987 dwc3_core_exit(dwc); 1988 1988 break; 1989 1989 } ··· 2044 2044 spin_unlock_irqrestore(&dwc->lock, flags); 2045 2045 break; 2046 2046 case DWC3_GCTL_PRTCAP_HOST: 2047 - if (!PMSG_IS_AUTO(msg) && !device_can_wakeup(dwc->dev)) { 2047 + if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) { 2048 2048 ret = dwc3_core_init_for_resume(dwc); 2049 2049 if (ret) 2050 2050 return ret;
+4
drivers/usb/dwc3/dwc3-pci.c
··· 44 44 #define PCI_DEVICE_ID_INTEL_ADLP 0x51ee 45 45 #define PCI_DEVICE_ID_INTEL_ADLM 0x54ee 46 46 #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1 47 + #define PCI_DEVICE_ID_INTEL_RPL 0x460e 47 48 #define PCI_DEVICE_ID_INTEL_RPLS 0x7a61 48 49 #define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1 49 50 #define PCI_DEVICE_ID_INTEL_MTL 0x7e7e ··· 455 454 (kernel_ulong_t) &dwc3_pci_intel_swnode, }, 456 455 457 456 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS), 457 + (kernel_ulong_t) &dwc3_pci_intel_swnode, }, 458 + 459 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL), 458 460 (kernel_ulong_t) &dwc3_pci_intel_swnode, }, 459 461 460 462 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS),
+58 -38
drivers/usb/dwc3/dwc3-qcom.c
··· 17 17 #include <linux/of_platform.h> 18 18 #include <linux/platform_device.h> 19 19 #include <linux/phy/phy.h> 20 - #include <linux/pm_domain.h> 21 20 #include <linux/usb/of.h> 22 21 #include <linux/reset.h> 23 22 #include <linux/iopoll.h> ··· 298 299 icc_put(qcom->icc_path_apps); 299 300 } 300 301 302 + /* Only usable in contexts where the role can not change. */ 303 + static bool dwc3_qcom_is_host(struct dwc3_qcom *qcom) 304 + { 305 + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); 306 + 307 + return dwc->xhci; 308 + } 309 + 301 310 static enum usb_device_speed dwc3_qcom_read_usb2_speed(struct dwc3_qcom *qcom) 302 311 { 303 312 struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); 304 - struct usb_hcd *hcd = platform_get_drvdata(dwc->xhci); 305 313 struct usb_device *udev; 314 + struct usb_hcd __maybe_unused *hcd; 315 + 316 + /* 317 + * FIXME: Fix this layering violation. 318 + */ 319 + hcd = platform_get_drvdata(dwc->xhci); 306 320 307 321 /* 308 322 * It is possible to query the speed of all children of ··· 323 311 * currently supports only 1 port per controller. So 324 312 * this is sufficient. 325 313 */ 314 + #ifdef CONFIG_USB 326 315 udev = usb_hub_find_child(hcd->self.root_hub, 1); 327 - 316 + #else 317 + udev = NULL; 318 + #endif 328 319 if (!udev) 329 320 return USB_SPEED_UNKNOWN; 330 321 ··· 402 387 dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq, 0); 403 388 } 404 389 405 - static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) 390 + static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup) 406 391 { 407 392 u32 val; 408 393 int i, ret; ··· 421 406 if (ret) 422 407 dev_warn(qcom->dev, "failed to disable interconnect: %d\n", ret); 423 408 424 - if (device_may_wakeup(qcom->dev)) { 409 + /* 410 + * The role is stable during suspend as role switching is done from a 411 + * freezable workqueue. 412 + */ 413 + if (dwc3_qcom_is_host(qcom) && wakeup) { 425 414 qcom->usb2_speed = dwc3_qcom_read_usb2_speed(qcom); 426 415 dwc3_qcom_enable_interrupts(qcom); 427 416 } ··· 435 416 return 0; 436 417 } 437 418 438 - static int dwc3_qcom_resume(struct dwc3_qcom *qcom) 419 + static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup) 439 420 { 440 421 int ret; 441 422 int i; ··· 443 424 if (!qcom->is_suspended) 444 425 return 0; 445 426 446 - if (device_may_wakeup(qcom->dev)) 427 + if (dwc3_qcom_is_host(qcom) && wakeup) 447 428 dwc3_qcom_disable_interrupts(qcom); 448 429 449 430 for (i = 0; i < qcom->num_clocks; i++) { ··· 477 458 if (qcom->pm_suspended) 478 459 return IRQ_HANDLED; 479 460 480 - if (dwc->xhci) 461 + /* 462 + * This is safe as role switching is done from a freezable workqueue 463 + * and the wakeup interrupts are disabled as part of resume. 464 + */ 465 + if (dwc3_qcom_is_host(qcom)) 481 466 pm_runtime_resume(&dwc->xhci->dev); 482 467 483 468 return IRQ_HANDLED; ··· 780 757 781 758 static int dwc3_qcom_probe(struct platform_device *pdev) 782 759 { 783 - struct device_node *np = pdev->dev.of_node; 784 - struct device *dev = &pdev->dev; 785 - struct dwc3_qcom *qcom; 786 - struct resource *res, *parent_res = NULL; 787 - int ret, i; 788 - bool ignore_pipe_clk; 789 - struct generic_pm_domain *genpd; 760 + struct device_node *np = pdev->dev.of_node; 761 + struct device *dev = &pdev->dev; 762 + struct dwc3_qcom *qcom; 763 + struct resource *res, *parent_res = NULL; 764 + int ret, i; 765 + bool ignore_pipe_clk; 766 + bool wakeup_source; 790 767 791 768 qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL); 792 769 if (!qcom) ··· 794 771 795 772 platform_set_drvdata(pdev, qcom); 796 773 qcom->dev = &pdev->dev; 797 - 798 - genpd = pd_to_genpd(qcom->dev->pm_domain); 799 774 800 775 if (has_acpi_companion(dev)) { 801 776 qcom->acpi_pdata = acpi_device_get_match_data(dev); ··· 902 881 if (ret) 903 882 goto interconnect_exit; 904 883 905 - if (device_can_wakeup(&qcom->dwc3->dev)) { 906 - /* 907 - * Setting GENPD_FLAG_ALWAYS_ON flag takes care of keeping 908 - * genpd on in both runtime suspend and system suspend cases. 909 - */ 910 - genpd->flags |= GENPD_FLAG_ALWAYS_ON; 911 - device_init_wakeup(&pdev->dev, true); 912 - } else { 913 - genpd->flags |= GENPD_FLAG_RPM_ALWAYS_ON; 914 - } 884 + wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source"); 885 + device_init_wakeup(&pdev->dev, wakeup_source); 886 + device_init_wakeup(&qcom->dwc3->dev, wakeup_source); 915 887 916 888 qcom->is_suspended = false; 917 889 pm_runtime_set_active(dev); ··· 958 944 static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev) 959 945 { 960 946 struct dwc3_qcom *qcom = dev_get_drvdata(dev); 961 - int ret = 0; 947 + bool wakeup = device_may_wakeup(dev); 948 + int ret; 962 949 963 - ret = dwc3_qcom_suspend(qcom); 964 - if (!ret) 965 - qcom->pm_suspended = true; 950 + ret = dwc3_qcom_suspend(qcom, wakeup); 951 + if (ret) 952 + return ret; 966 953 967 - return ret; 954 + qcom->pm_suspended = true; 955 + 956 + return 0; 968 957 } 969 958 970 959 static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev) 971 960 { 972 961 struct dwc3_qcom *qcom = dev_get_drvdata(dev); 962 + bool wakeup = device_may_wakeup(dev); 973 963 int ret; 974 964 975 - ret = dwc3_qcom_resume(qcom); 976 - if (!ret) 977 - qcom->pm_suspended = false; 965 + ret = dwc3_qcom_resume(qcom, wakeup); 966 + if (ret) 967 + return ret; 978 968 979 - return ret; 969 + qcom->pm_suspended = false; 970 + 971 + return 0; 980 972 } 981 973 982 974 static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev) 983 975 { 984 976 struct dwc3_qcom *qcom = dev_get_drvdata(dev); 985 977 986 - return dwc3_qcom_suspend(qcom); 978 + return dwc3_qcom_suspend(qcom, true); 987 979 } 988 980 989 981 static int __maybe_unused dwc3_qcom_runtime_resume(struct device *dev) 990 982 { 991 983 struct dwc3_qcom *qcom = dev_get_drvdata(dev); 992 984 993 - return dwc3_qcom_resume(qcom); 985 + return dwc3_qcom_resume(qcom, true); 994 986 } 995 987 996 988 static const struct dev_pm_ops dwc3_qcom_dev_pm_ops = {
+5 -3
drivers/usb/dwc3/gadget.c
··· 2539 2539 2540 2540 is_on = !!is_on; 2541 2541 2542 - if (dwc->pullups_connected == is_on) 2543 - return 0; 2544 - 2545 2542 dwc->softconnect = is_on; 2546 2543 2547 2544 /* ··· 2559 2562 */ 2560 2563 ret = pm_runtime_get_sync(dwc->dev); 2561 2564 if (!ret || ret < 0) { 2565 + pm_runtime_put(dwc->dev); 2566 + return 0; 2567 + } 2568 + 2569 + if (dwc->pullups_connected == is_on) { 2562 2570 pm_runtime_put(dwc->dev); 2563 2571 return 0; 2564 2572 }
+11
drivers/usb/dwc3/host.c
··· 11 11 #include <linux/of.h> 12 12 #include <linux/platform_device.h> 13 13 14 + #include "../host/xhci-plat.h" 14 15 #include "core.h" 16 + 17 + static const struct xhci_plat_priv dwc3_xhci_plat_priv = { 18 + .quirks = XHCI_SKIP_PHY_INIT, 19 + }; 15 20 16 21 static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc, 17 22 int irq, char *name) ··· 97 92 goto err; 98 93 } 99 94 95 + ret = platform_device_add_data(xhci, &dwc3_xhci_plat_priv, 96 + sizeof(dwc3_xhci_plat_priv)); 97 + if (ret) 98 + goto err; 99 + 100 100 memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); 101 101 102 102 if (dwc->usb3_lpm_capable) ··· 145 135 void dwc3_host_exit(struct dwc3 *dwc) 146 136 { 147 137 platform_device_unregister(dwc->xhci); 138 + dwc->xhci = NULL; 148 139 }
+14 -2
drivers/usb/gadget/function/f_uac2.c
··· 291 291 .bInterval = 4, 292 292 }; 293 293 294 + static struct usb_ss_ep_comp_descriptor ss_ep_int_desc_comp = { 295 + .bLength = sizeof(ss_ep_int_desc_comp), 296 + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, 297 + .wBytesPerInterval = cpu_to_le16(6), 298 + }; 299 + 294 300 /* Audio Streaming OUT Interface - Alt0 */ 295 301 static struct usb_interface_descriptor std_as_out_if0_desc = { 296 302 .bLength = sizeof std_as_out_if0_desc, ··· 610 604 (struct usb_descriptor_header *)&in_feature_unit_desc, 611 605 (struct usb_descriptor_header *)&io_out_ot_desc, 612 606 613 - (struct usb_descriptor_header *)&ss_ep_int_desc, 607 + (struct usb_descriptor_header *)&ss_ep_int_desc, 608 + (struct usb_descriptor_header *)&ss_ep_int_desc_comp, 614 609 615 610 (struct usb_descriptor_header *)&std_as_out_if0_desc, 616 611 (struct usb_descriptor_header *)&std_as_out_if1_desc, ··· 807 800 struct usb_ss_ep_comp_descriptor *epout_desc_comp = NULL; 808 801 struct usb_ss_ep_comp_descriptor *epin_desc_comp = NULL; 809 802 struct usb_ss_ep_comp_descriptor *epin_fback_desc_comp = NULL; 803 + struct usb_ss_ep_comp_descriptor *ep_int_desc_comp = NULL; 810 804 struct usb_endpoint_descriptor *epout_desc; 811 805 struct usb_endpoint_descriptor *epin_desc; 812 806 struct usb_endpoint_descriptor *epin_fback_desc; ··· 835 827 epin_fback_desc = &ss_epin_fback_desc; 836 828 epin_fback_desc_comp = &ss_epin_fback_desc_comp; 837 829 ep_int_desc = &ss_ep_int_desc; 830 + ep_int_desc_comp = &ss_ep_int_desc_comp; 838 831 } 839 832 840 833 i = 0; ··· 864 855 if (EPOUT_EN(opts)) 865 856 headers[i++] = USBDHDR(&io_out_ot_desc); 866 857 867 - if (FUOUT_EN(opts) || FUIN_EN(opts)) 858 + if (FUOUT_EN(opts) || FUIN_EN(opts)) { 868 859 headers[i++] = USBDHDR(ep_int_desc); 860 + if (ep_int_desc_comp) 861 + headers[i++] = USBDHDR(ep_int_desc_comp); 862 + } 869 863 870 864 if (EPOUT_EN(opts)) { 871 865 headers[i++] = USBDHDR(&std_as_out_if0_desc);
+4 -2
drivers/usb/gadget/function/storage_common.c
··· 294 294 void store_cdrom_address(u8 *dest, int msf, u32 addr) 295 295 { 296 296 if (msf) { 297 - /* Convert to Minutes-Seconds-Frames */ 298 - addr >>= 2; /* Convert to 2048-byte frames */ 297 + /* 298 + * Convert to Minutes-Seconds-Frames. 299 + * Sector size is already set to 2048 bytes. 300 + */ 299 301 addr += 2*75; /* Lead-in occupies 2 seconds */ 300 302 dest[3] = addr % 75; /* Frames */ 301 303 addr /= 75;
+16 -10
drivers/usb/gadget/udc/core.c
··· 736 736 ret = gadget->ops->pullup(gadget, 0); 737 737 if (!ret) { 738 738 gadget->connected = 0; 739 - gadget->udc->driver->disconnect(gadget); 739 + mutex_lock(&udc_lock); 740 + if (gadget->udc->driver) 741 + gadget->udc->driver->disconnect(gadget); 742 + mutex_unlock(&udc_lock); 740 743 } 741 744 742 745 out: ··· 1492 1489 1493 1490 usb_gadget_udc_set_speed(udc, driver->max_speed); 1494 1491 1495 - mutex_lock(&udc_lock); 1496 1492 ret = driver->bind(udc->gadget, driver); 1497 1493 if (ret) 1498 1494 goto err_bind; ··· 1501 1499 goto err_start; 1502 1500 usb_gadget_enable_async_callbacks(udc); 1503 1501 usb_udc_connect_control(udc); 1504 - mutex_unlock(&udc_lock); 1505 1502 1506 1503 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); 1507 1504 return 0; ··· 1513 1512 dev_err(&udc->dev, "failed to start %s: %d\n", 1514 1513 driver->function, ret); 1515 1514 1515 + mutex_lock(&udc_lock); 1516 1516 udc->driver = NULL; 1517 1517 driver->is_bound = false; 1518 1518 mutex_unlock(&udc_lock); ··· 1531 1529 1532 1530 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); 1533 1531 1534 - mutex_lock(&udc_lock); 1535 1532 usb_gadget_disconnect(gadget); 1536 1533 usb_gadget_disable_async_callbacks(udc); 1537 1534 if (gadget->irq) ··· 1538 1537 udc->driver->unbind(gadget); 1539 1538 usb_gadget_udc_stop(udc); 1540 1539 1540 + mutex_lock(&udc_lock); 1541 1541 driver->is_bound = false; 1542 1542 udc->driver = NULL; 1543 1543 mutex_unlock(&udc_lock); ··· 1614 1612 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); 1615 1613 ssize_t ret; 1616 1614 1617 - mutex_lock(&udc_lock); 1615 + device_lock(&udc->gadget->dev); 1618 1616 if (!udc->driver) { 1619 1617 dev_err(dev, "soft-connect without a gadget driver\n"); 1620 1618 ret = -EOPNOTSUPP; ··· 1635 1633 1636 1634 ret = n; 1637 1635 out: 1638 - mutex_unlock(&udc_lock); 1636 + device_unlock(&udc->gadget->dev); 1639 1637 return ret; 1640 1638 } 1641 1639 static DEVICE_ATTR_WO(soft_connect); ··· 1654 1652 char *buf) 1655 1653 { 1656 1654 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); 1657 - struct usb_gadget_driver *drv = udc->driver; 1655 + struct usb_gadget_driver *drv; 1656 + int rc = 0; 1658 1657 1659 - if (!drv || !drv->function) 1660 - return 0; 1661 - return scnprintf(buf, PAGE_SIZE, "%s\n", drv->function); 1658 + mutex_lock(&udc_lock); 1659 + drv = udc->driver; 1660 + if (drv && drv->function) 1661 + rc = scnprintf(buf, PAGE_SIZE, "%s\n", drv->function); 1662 + mutex_unlock(&udc_lock); 1663 + return rc; 1662 1664 } 1663 1665 static DEVICE_ATTR_RO(function); 1664 1666
+12 -1
drivers/usb/host/xhci-hub.c
··· 652 652 * It will release and re-aquire the lock while calling ACPI 653 653 * method. 654 654 */ 655 - void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, 655 + static void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, 656 656 u16 index, bool on, unsigned long *flags) 657 657 __must_hold(&xhci->lock) 658 658 { ··· 1647 1647 spin_lock_irqsave(&xhci->lock, flags); 1648 1648 1649 1649 status = bus_state->resuming_ports; 1650 + 1651 + /* 1652 + * SS devices are only visible to roothub after link training completes. 1653 + * Keep polling roothubs for a grace period after xHC start 1654 + */ 1655 + if (xhci->run_graceperiod) { 1656 + if (time_before(jiffies, xhci->run_graceperiod)) 1657 + status = 1; 1658 + else 1659 + xhci->run_graceperiod = 0; 1660 + } 1650 1661 1651 1662 mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC; 1652 1663
+4 -11
drivers/usb/host/xhci-mtk-sch.c
··· 425 425 426 426 static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset) 427 427 { 428 - u32 extra_cs_count; 429 428 u32 start_ss, last_ss; 430 429 u32 start_cs, last_cs; 431 430 ··· 460 461 if (last_cs > 7) 461 462 return -ESCH_CS_OVERFLOW; 462 463 463 - if (sch_ep->ep_type == ISOC_IN_EP) 464 - extra_cs_count = (last_cs == 7) ? 1 : 2; 465 - else /* ep_type : INTR IN / INTR OUT */ 466 - extra_cs_count = 1; 467 - 468 - cs_count += extra_cs_count; 469 464 if (cs_count > 7) 470 465 cs_count = 7; /* HW limit */ 471 466 472 467 sch_ep->cs_count = cs_count; 473 - /* one for ss, the other for idle */ 474 - sch_ep->num_budget_microframes = cs_count + 2; 468 + /* ss, idle are ignored */ 469 + sch_ep->num_budget_microframes = cs_count; 475 470 476 471 /* 477 472 * if interval=1, maxp >752, num_budge_micoframe is larger ··· 764 771 if (ret) 765 772 return ret; 766 773 767 - if (ep->hcpriv) 768 - drop_ep_quirk(hcd, udev, ep); 774 + /* needn't check @ep->hcpriv, xhci_endpoint_disable set it NULL */ 775 + drop_ep_quirk(hcd, udev, ep); 769 776 770 777 return 0; 771 778 }
+8 -3
drivers/usb/host/xhci-plat.c
··· 398 398 pm_runtime_get_sync(&dev->dev); 399 399 xhci->xhc_state |= XHCI_STATE_REMOVING; 400 400 401 - usb_remove_hcd(shared_hcd); 402 - xhci->shared_hcd = NULL; 401 + if (shared_hcd) { 402 + usb_remove_hcd(shared_hcd); 403 + xhci->shared_hcd = NULL; 404 + } 405 + 403 406 usb_phy_shutdown(hcd->usb_phy); 404 407 405 408 usb_remove_hcd(hcd); 406 - usb_put_hcd(shared_hcd); 409 + 410 + if (shared_hcd) 411 + usb_put_hcd(shared_hcd); 407 412 408 413 clk_disable_unprepare(clk); 409 414 clk_disable_unprepare(reg_clk);
+5 -14
drivers/usb/host/xhci.c
··· 151 151 xhci_err(xhci, "Host took too long to start, " 152 152 "waited %u microseconds.\n", 153 153 XHCI_MAX_HALT_USEC); 154 - if (!ret) 154 + if (!ret) { 155 155 /* clear state flags. Including dying, halted or removing */ 156 156 xhci->xhc_state = 0; 157 + xhci->run_graceperiod = jiffies + msecs_to_jiffies(500); 158 + } 157 159 158 160 return ret; 159 161 } ··· 793 791 void xhci_shutdown(struct usb_hcd *hcd) 794 792 { 795 793 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 796 - unsigned long flags; 797 - int i; 798 794 799 795 if (xhci->quirks & XHCI_SPURIOUS_REBOOT) 800 796 usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev)); ··· 808 808 del_timer_sync(&xhci->shared_hcd->rh_timer); 809 809 } 810 810 811 - spin_lock_irqsave(&xhci->lock, flags); 811 + spin_lock_irq(&xhci->lock); 812 812 xhci_halt(xhci); 813 - 814 - /* Power off USB2 ports*/ 815 - for (i = 0; i < xhci->usb2_rhub.num_ports; i++) 816 - xhci_set_port_power(xhci, xhci->main_hcd, i, false, &flags); 817 - 818 - /* Power off USB3 ports*/ 819 - for (i = 0; i < xhci->usb3_rhub.num_ports; i++) 820 - xhci_set_port_power(xhci, xhci->shared_hcd, i, false, &flags); 821 - 822 813 /* Workaround for spurious wakeups at shutdown with HSW */ 823 814 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) 824 815 xhci_reset(xhci, XHCI_RESET_SHORT_USEC); 825 - spin_unlock_irqrestore(&xhci->lock, flags); 816 + spin_unlock_irq(&xhci->lock); 826 817 827 818 xhci_cleanup_msix(xhci); 828 819
+1 -3
drivers/usb/host/xhci.h
··· 1826 1826 1827 1827 /* Host controller watchdog timer structures */ 1828 1828 unsigned int xhc_state; 1829 - 1829 + unsigned long run_graceperiod; 1830 1830 u32 command; 1831 1831 struct s3_save s3; 1832 1832 /* Host controller is dying - not responding to commands. "I'm not dead yet!" ··· 2196 2196 int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); 2197 2197 int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1); 2198 2198 struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd); 2199 - void xhci_set_port_power(struct xhci_hcd *xhci, struct usb_hcd *hcd, u16 index, 2200 - bool on, unsigned long *flags); 2201 2199 2202 2200 void xhci_hc_died(struct xhci_hcd *xhci); 2203 2201
+1 -4
drivers/usb/misc/onboard_usb_hub.c
··· 71 71 { 72 72 int err; 73 73 74 - if (hub->reset_gpio) { 75 - gpiod_set_value_cansleep(hub->reset_gpio, 1); 76 - fsleep(hub->pdata->reset_us); 77 - } 74 + gpiod_set_value_cansleep(hub->reset_gpio, 1); 78 75 79 76 err = regulator_disable(hub->vdd); 80 77 if (err) {
+1 -1
drivers/usb/musb/Kconfig
··· 86 86 tristate "TUSB6010" 87 87 depends on HAS_IOMEM 88 88 depends on ARCH_OMAP2PLUS || COMPILE_TEST 89 - depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules 89 + depends on NOP_USB_XCEIV!=m || USB_MUSB_HDRC=m 90 90 91 91 config USB_MUSB_OMAP2PLUS 92 92 tristate "OMAP2430 and onwards"
+14 -2
drivers/usb/serial/ch341.c
··· 97 97 u8 mcr; 98 98 u8 msr; 99 99 u8 lcr; 100 + 100 101 unsigned long quirks; 102 + u8 version; 103 + 101 104 unsigned long break_end; 102 105 }; 103 106 ··· 253 250 /* 254 251 * CH341A buffers data until a full endpoint-size packet (32 bytes) 255 252 * has been received unless bit 7 is set. 253 + * 254 + * At least one device with version 0x27 appears to have this bit 255 + * inverted. 256 256 */ 257 - val |= BIT(7); 257 + if (priv->version > 0x27) 258 + val |= BIT(7); 258 259 259 260 r = ch341_control_out(dev, CH341_REQ_WRITE_REG, 260 261 CH341_REG_DIVISOR << 8 | CH341_REG_PRESCALER, ··· 272 265 * (stop bits, parity and word length). Version 0x30 and above use 273 266 * CH341_REG_LCR only and CH341_REG_LCR2 is always set to zero. 274 267 */ 268 + if (priv->version < 0x30) 269 + return 0; 270 + 275 271 r = ch341_control_out(dev, CH341_REQ_WRITE_REG, 276 272 CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr); 277 273 if (r) ··· 318 308 r = ch341_control_in(dev, CH341_REQ_READ_VERSION, 0, 0, buffer, size); 319 309 if (r) 320 310 return r; 321 - dev_dbg(&dev->dev, "Chip version: 0x%02x\n", buffer[0]); 311 + 312 + priv->version = buffer[0]; 313 + dev_dbg(&dev->dev, "Chip version: 0x%02x\n", priv->version); 322 314 323 315 r = ch341_control_out(dev, CH341_REQ_SERIAL_INIT, 0, 0); 324 316 if (r < 0)
+1
drivers/usb/serial/cp210x.c
··· 130 130 { USB_DEVICE(0x10C4, 0x83AA) }, /* Mark-10 Digital Force Gauge */ 131 131 { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ 132 132 { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ 133 + { USB_DEVICE(0x10C4, 0x8414) }, /* Decagon USB Cable Adapter */ 133 134 { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ 134 135 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ 135 136 { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */
+2
drivers/usb/serial/ftdi_sio.c
··· 1045 1045 /* IDS GmbH devices */ 1046 1046 { USB_DEVICE(IDS_VID, IDS_SI31A_PID) }, 1047 1047 { USB_DEVICE(IDS_VID, IDS_CM31A_PID) }, 1048 + /* Omron devices */ 1049 + { USB_DEVICE(OMRON_VID, OMRON_CS1W_CIF31_PID) }, 1048 1050 /* U-Blox devices */ 1049 1051 { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) }, 1050 1052 { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) },
+6
drivers/usb/serial/ftdi_sio_ids.h
··· 662 662 #define INFINEON_TRIBOARD_TC2X7_PID 0x0043 /* DAS JTAG TriBoard TC2X7 V1.0 */ 663 663 664 664 /* 665 + * Omron corporation (https://www.omron.com) 666 + */ 667 + #define OMRON_VID 0x0590 668 + #define OMRON_CS1W_CIF31_PID 0x00b2 669 + 670 + /* 665 671 * Acton Research Corp. 666 672 */ 667 673 #define ACTON_VID 0x0647 /* Vendor ID */
+15
drivers/usb/serial/option.c
··· 253 253 #define QUECTEL_PRODUCT_BG96 0x0296 254 254 #define QUECTEL_PRODUCT_EP06 0x0306 255 255 #define QUECTEL_PRODUCT_EM05G 0x030a 256 + #define QUECTEL_PRODUCT_EM060K 0x030b 256 257 #define QUECTEL_PRODUCT_EM12 0x0512 257 258 #define QUECTEL_PRODUCT_RM500Q 0x0800 258 259 #define QUECTEL_PRODUCT_EC200S_CN 0x6002 ··· 439 438 #define CINTERION_PRODUCT_MV31_2_RMNET 0x00b9 440 439 #define CINTERION_PRODUCT_MV32_WA 0x00f1 441 440 #define CINTERION_PRODUCT_MV32_WB 0x00f2 441 + #define CINTERION_PRODUCT_MV32_WA_RMNET 0x00f3 442 + #define CINTERION_PRODUCT_MV32_WB_RMNET 0x00f4 442 443 443 444 /* Olivetti products */ 444 445 #define OLIVETTI_VENDOR_ID 0x0b3c ··· 575 572 #define WETELECOM_PRODUCT_WMD200 0x6801 576 573 #define WETELECOM_PRODUCT_6802 0x6802 577 574 #define WETELECOM_PRODUCT_WMD300 0x6803 575 + 576 + /* OPPO products */ 577 + #define OPPO_VENDOR_ID 0x22d9 578 + #define OPPO_PRODUCT_R11 0x276c 578 579 579 580 580 581 /* Device flags */ ··· 1145 1138 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, 1146 1139 { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff), 1147 1140 .driver_info = RSVD(6) | ZLP }, 1141 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) }, 1142 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x30) }, 1143 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x40) }, 1148 1144 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff), 1149 1145 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, 1150 1146 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) }, ··· 2003 1993 .driver_info = RSVD(0)}, 2004 1994 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff), 2005 1995 .driver_info = RSVD(3)}, 1996 + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA_RMNET, 0xff), 1997 + .driver_info = RSVD(0) }, 2006 1998 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff), 2007 1999 .driver_info = RSVD(3)}, 2000 + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB_RMNET, 0xff), 2001 + .driver_info = RSVD(0) }, 2008 2002 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), 2009 2003 .driver_info = RSVD(4) }, 2010 2004 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), ··· 2169 2155 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ 2170 2156 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */ 2171 2157 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */ 2158 + { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) }, 2172 2159 { } /* Terminating entry */ 2173 2160 }; 2174 2161 MODULE_DEVICE_TABLE(usb, option_ids);
+7
drivers/usb/storage/unusual_devs.h
··· 2294 2294 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 2295 2295 US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), 2296 2296 2297 + /* Reported by Witold Lipieta <witold.lipieta@thaumatec.com> */ 2298 + UNUSUAL_DEV( 0x1fc9, 0x0117, 0x0100, 0x0100, 2299 + "NXP Semiconductors", 2300 + "PN7462AU", 2301 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 2302 + US_FL_IGNORE_RESIDUE ), 2303 + 2297 2304 /* Supplied with some Castlewood ORB removable drives */ 2298 2305 UNUSUAL_DEV( 0x2027, 0xa001, 0x0000, 0x9999, 2299 2306 "Double-H Technology",
+7
drivers/usb/storage/unusual_uas.h
··· 62 62 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 63 63 US_FL_IGNORE_UAS), 64 64 65 + /* Reported-by: Tom Hu <huxiaoying@kylinos.cn> */ 66 + UNUSUAL_DEV(0x0b05, 0x1932, 0x0000, 0x9999, 67 + "ASUS", 68 + "External HDD", 69 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 70 + US_FL_IGNORE_UAS), 71 + 65 72 /* Reported-by: David Webb <djw@noc.ac.uk> */ 66 73 UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999, 67 74 "Seagate",
+2 -2
drivers/usb/typec/altmodes/displayport.c
··· 99 99 case DP_STATUS_CON_UFP_D: 100 100 case DP_STATUS_CON_BOTH: /* NOTE: First acting as DP source */ 101 101 conf |= DP_CONF_UFP_U_AS_UFP_D; 102 - pin_assign = DP_CAP_DFP_D_PIN_ASSIGN(dp->alt->vdo) & 103 - DP_CAP_UFP_D_PIN_ASSIGN(dp->port->vdo); 102 + pin_assign = DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) & 103 + DP_CAP_PIN_ASSIGN_DFP_D(dp->port->vdo); 104 104 break; 105 105 default: 106 106 break;
+1
drivers/usb/typec/class.c
··· 2346 2346 ida_destroy(&typec_index_ida); 2347 2347 bus_unregister(&typec_bus); 2348 2348 class_unregister(&typec_mux_class); 2349 + class_unregister(&retimer_class); 2349 2350 } 2350 2351 module_exit(typec_exit); 2351 2352
+7 -2
drivers/usb/typec/mux/intel_pmc_mux.c
··· 571 571 572 572 static int is_memory(struct acpi_resource *res, void *data) 573 573 { 574 - struct resource r; 574 + struct resource_win win = {}; 575 + struct resource *r = &win.res; 575 576 576 - return !acpi_dev_resource_memory(res, &r); 577 + return !(acpi_dev_resource_memory(res, r) || 578 + acpi_dev_resource_address_space(res, &win)); 577 579 } 578 580 579 581 /* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */ ··· 585 583 586 584 /* AlderLake */ 587 585 { "INTC1079", 0x160, }, 586 + 587 + /* Meteor Lake */ 588 + { "INTC107A", 0x160, }, 588 589 {} 589 590 }; 590 591
+7
drivers/usb/typec/tcpm/tcpm.c
··· 6320 6320 struct tcpm_port *port = power_supply_get_drvdata(psy); 6321 6321 int ret; 6322 6322 6323 + /* 6324 + * All the properties below are related to USB PD. The check needs to be 6325 + * property specific when a non-pd related property is added. 6326 + */ 6327 + if (!port->pd_supported) 6328 + return -EOPNOTSUPP; 6329 + 6323 6330 switch (psp) { 6324 6331 case POWER_SUPPLY_PROP_ONLINE: 6325 6332 ret = tcpm_psy_set_online(port, val);
+24 -29
drivers/usb/typec/ucsi/ucsi.c
··· 1200 1200 return ret; 1201 1201 } 1202 1202 1203 - static void ucsi_unregister_connectors(struct ucsi *ucsi) 1204 - { 1205 - struct ucsi_connector *con; 1206 - int i; 1207 - 1208 - if (!ucsi->connector) 1209 - return; 1210 - 1211 - for (i = 0; i < ucsi->cap.num_connectors; i++) { 1212 - con = &ucsi->connector[i]; 1213 - 1214 - if (!con->wq) 1215 - break; 1216 - 1217 - cancel_work_sync(&con->work); 1218 - ucsi_unregister_partner(con); 1219 - ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON); 1220 - ucsi_unregister_port_psy(con); 1221 - destroy_workqueue(con->wq); 1222 - typec_unregister_port(con->port); 1223 - } 1224 - 1225 - kfree(ucsi->connector); 1226 - ucsi->connector = NULL; 1227 - } 1228 - 1229 1203 /** 1230 1204 * ucsi_init - Initialize UCSI interface 1231 1205 * @ucsi: UCSI to be initialized ··· 1208 1234 */ 1209 1235 static int ucsi_init(struct ucsi *ucsi) 1210 1236 { 1237 + struct ucsi_connector *con; 1211 1238 u64 command; 1212 1239 int ret; 1213 1240 int i; ··· 1239 1264 } 1240 1265 1241 1266 /* Allocate the connectors. Released in ucsi_unregister() */ 1242 - ucsi->connector = kcalloc(ucsi->cap.num_connectors, 1267 + ucsi->connector = kcalloc(ucsi->cap.num_connectors + 1, 1243 1268 sizeof(*ucsi->connector), GFP_KERNEL); 1244 1269 if (!ucsi->connector) { 1245 1270 ret = -ENOMEM; ··· 1263 1288 return 0; 1264 1289 1265 1290 err_unregister: 1266 - ucsi_unregister_connectors(ucsi); 1291 + for (con = ucsi->connector; con->port; con++) { 1292 + ucsi_unregister_partner(con); 1293 + ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON); 1294 + ucsi_unregister_port_psy(con); 1295 + if (con->wq) 1296 + destroy_workqueue(con->wq); 1297 + typec_unregister_port(con->port); 1298 + con->port = NULL; 1299 + } 1267 1300 1268 1301 err_reset: 1269 1302 memset(&ucsi->cap, 0, sizeof(ucsi->cap)); ··· 1385 1402 void ucsi_unregister(struct ucsi *ucsi) 1386 1403 { 1387 1404 u64 cmd = UCSI_SET_NOTIFICATION_ENABLE; 1405 + int i; 1388 1406 1389 1407 /* Make sure that we are not in the middle of driver initialization */ 1390 1408 cancel_delayed_work_sync(&ucsi->work); ··· 1393 1409 /* Disable notifications */ 1394 1410 ucsi->ops->async_write(ucsi, UCSI_CONTROL, &cmd, sizeof(cmd)); 1395 1411 1396 - ucsi_unregister_connectors(ucsi); 1412 + for (i = 0; i < ucsi->cap.num_connectors; i++) { 1413 + cancel_work_sync(&ucsi->connector[i].work); 1414 + ucsi_unregister_partner(&ucsi->connector[i]); 1415 + ucsi_unregister_altmodes(&ucsi->connector[i], 1416 + UCSI_RECIPIENT_CON); 1417 + ucsi_unregister_port_psy(&ucsi->connector[i]); 1418 + if (ucsi->connector[i].wq) 1419 + destroy_workqueue(ucsi->connector[i].wq); 1420 + typec_unregister_port(ucsi->connector[i].port); 1421 + } 1422 + 1423 + kfree(ucsi->connector); 1397 1424 } 1398 1425 EXPORT_SYMBOL_GPL(ucsi_unregister); 1399 1426
+6 -2
drivers/vfio/pci/vfio_pci_zdev.c
··· 151 151 if (!vdev->vdev.kvm) 152 152 return 0; 153 153 154 - return kvm_s390_pci_register_kvm(zdev, vdev->vdev.kvm); 154 + if (zpci_kvm_hook.kvm_register) 155 + return zpci_kvm_hook.kvm_register(zdev, vdev->vdev.kvm); 156 + 157 + return -ENOENT; 155 158 } 156 159 157 160 void vfio_pci_zdev_close_device(struct vfio_pci_core_device *vdev) ··· 164 161 if (!zdev || !vdev->vdev.kvm) 165 162 return; 166 163 167 - kvm_s390_pci_unregister_kvm(zdev); 164 + if (zpci_kvm_hook.kvm_unregister) 165 + zpci_kvm_hook.kvm_unregister(zdev); 168 166 }
+3
drivers/xen/grant-table.c
··· 1047 1047 size_t size; 1048 1048 int i, ret; 1049 1049 1050 + if (args->nr_pages < 0 || args->nr_pages > (INT_MAX >> PAGE_SHIFT)) 1051 + return -ENOMEM; 1052 + 1050 1053 size = args->nr_pages << PAGE_SHIFT; 1051 1054 if (args->coherent) 1052 1055 args->vaddr = dma_alloc_coherent(args->dev, size,
+1 -1
fs/afs/flock.c
··· 76 76 if (call->error == 0) { 77 77 spin_lock(&vnode->lock); 78 78 trace_afs_flock_ev(vnode, NULL, afs_flock_timestamp, 0); 79 - vnode->locked_at = call->reply_time; 79 + vnode->locked_at = call->issue_time; 80 80 afs_schedule_lock_extension(vnode); 81 81 spin_unlock(&vnode->lock); 82 82 }
+1 -1
fs/afs/fsclient.c
··· 131 131 132 132 static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry) 133 133 { 134 - return ktime_divns(call->reply_time, NSEC_PER_SEC) + expiry; 134 + return ktime_divns(call->issue_time, NSEC_PER_SEC) + expiry; 135 135 } 136 136 137 137 static void xdr_decode_AFSCallBack(const __be32 **_bp,
+1 -2
fs/afs/internal.h
··· 137 137 bool need_attention; /* T if RxRPC poked us */ 138 138 bool async; /* T if asynchronous */ 139 139 bool upgrade; /* T to request service upgrade */ 140 - bool have_reply_time; /* T if have got reply_time */ 141 140 bool intr; /* T if interruptible */ 142 141 bool unmarshalling_error; /* T if an unmarshalling error occurred */ 143 142 u16 service_id; /* Actual service ID (after upgrade) */ ··· 150 151 } __attribute__((packed)); 151 152 __be64 tmp64; 152 153 }; 153 - ktime_t reply_time; /* Time of first reply packet */ 154 + ktime_t issue_time; /* Time of issue of operation */ 154 155 }; 155 156 156 157 struct afs_call_type {
+1
fs/afs/misc.c
··· 69 69 /* Unified AFS error table */ 70 70 case UAEPERM: return -EPERM; 71 71 case UAENOENT: return -ENOENT; 72 + case UAEAGAIN: return -EAGAIN; 72 73 case UAEACCES: return -EACCES; 73 74 case UAEBUSY: return -EBUSY; 74 75 case UAEEXIST: return -EEXIST;
+1 -6
fs/afs/rxrpc.c
··· 351 351 if (call->max_lifespan) 352 352 rxrpc_kernel_set_max_life(call->net->socket, rxcall, 353 353 call->max_lifespan); 354 + call->issue_time = ktime_get_real(); 354 355 355 356 /* send the request */ 356 357 iov[0].iov_base = call->request; ··· 501 500 } 502 501 return; 503 502 } 504 - 505 - if (!call->have_reply_time && 506 - rxrpc_kernel_get_reply_time(call->net->socket, 507 - call->rxcall, 508 - &call->reply_time)) 509 - call->have_reply_time = true; 510 503 511 504 ret = call->type->deliver(call); 512 505 state = READ_ONCE(call->state);
+1 -2
fs/afs/yfsclient.c
··· 232 232 struct afs_callback *cb = &scb->callback; 233 233 ktime_t cb_expiry; 234 234 235 - cb_expiry = call->reply_time; 236 - cb_expiry = ktime_add(cb_expiry, xdr_to_u64(x->expiration_time) * 100); 235 + cb_expiry = ktime_add(call->issue_time, xdr_to_u64(x->expiration_time) * 100); 237 236 cb->expires_at = ktime_divns(cb_expiry, NSEC_PER_SEC); 238 237 scb->have_cb = true; 239 238 *_bp += xdr_size(x);
+6
fs/cifs/cifsfs.c
··· 1248 1248 lock_two_nondirectories(target_inode, src_inode); 1249 1249 1250 1250 cifs_dbg(FYI, "about to flush pages\n"); 1251 + 1252 + rc = filemap_write_and_wait_range(src_inode->i_mapping, off, 1253 + off + len - 1); 1254 + if (rc) 1255 + goto out; 1256 + 1251 1257 /* should we flush first and last page first */ 1252 1258 truncate_inode_pages(&target_inode->i_data, 0); 1253 1259
+43 -28
fs/cifs/smb2ops.c
··· 1600 1600 int chunks_copied = 0; 1601 1601 bool chunk_sizes_updated = false; 1602 1602 ssize_t bytes_written, total_bytes_written = 0; 1603 - struct inode *inode; 1604 1603 1605 1604 pcchunk = kmalloc(sizeof(struct copychunk_ioctl), GFP_KERNEL); 1606 - 1607 - /* 1608 - * We need to flush all unwritten data before we can send the 1609 - * copychunk ioctl to the server. 1610 - */ 1611 - inode = d_inode(trgtfile->dentry); 1612 - filemap_write_and_wait(inode->i_mapping); 1613 - 1614 1605 if (pcchunk == NULL) 1615 1606 return -ENOMEM; 1616 1607 ··· 3669 3678 { 3670 3679 int rc; 3671 3680 unsigned int xid; 3672 - struct inode *inode; 3681 + struct inode *inode = file_inode(file); 3673 3682 struct cifsFileInfo *cfile = file->private_data; 3674 - struct cifsInodeInfo *cifsi; 3683 + struct cifsInodeInfo *cifsi = CIFS_I(inode); 3675 3684 __le64 eof; 3685 + loff_t old_eof; 3676 3686 3677 3687 xid = get_xid(); 3678 3688 3679 - inode = d_inode(cfile->dentry); 3680 - cifsi = CIFS_I(inode); 3689 + inode_lock(inode); 3681 3690 3682 - if (off >= i_size_read(inode) || 3683 - off + len >= i_size_read(inode)) { 3691 + old_eof = i_size_read(inode); 3692 + if ((off >= old_eof) || 3693 + off + len >= old_eof) { 3684 3694 rc = -EINVAL; 3685 3695 goto out; 3686 3696 } 3687 3697 3688 - rc = smb2_copychunk_range(xid, cfile, cfile, off + len, 3689 - i_size_read(inode) - off - len, off); 3698 + filemap_invalidate_lock(inode->i_mapping); 3699 + rc = filemap_write_and_wait_range(inode->i_mapping, off, old_eof - 1); 3690 3700 if (rc < 0) 3691 - goto out; 3701 + goto out_2; 3692 3702 3693 - eof = cpu_to_le64(i_size_read(inode) - len); 3703 + truncate_pagecache_range(inode, off, old_eof); 3704 + 3705 + rc = smb2_copychunk_range(xid, cfile, cfile, off + len, 3706 + old_eof - off - len, off); 3707 + if (rc < 0) 3708 + goto out_2; 3709 + 3710 + eof = cpu_to_le64(old_eof - len); 3694 3711 rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, 3695 3712 cfile->fid.volatile_fid, cfile->pid, &eof); 3696 3713 if (rc < 0) 3697 - goto out; 3714 + goto out_2; 3698 3715 3699 3716 rc = 0; 3700 3717 3701 3718 cifsi->server_eof = i_size_read(inode) - len; 3702 3719 truncate_setsize(inode, cifsi->server_eof); 3703 3720 fscache_resize_cookie(cifs_inode_cookie(inode), cifsi->server_eof); 3721 + out_2: 3722 + filemap_invalidate_unlock(inode->i_mapping); 3704 3723 out: 3724 + inode_unlock(inode); 3705 3725 free_xid(xid); 3706 3726 return rc; 3707 3727 } ··· 3723 3721 int rc; 3724 3722 unsigned int xid; 3725 3723 struct cifsFileInfo *cfile = file->private_data; 3724 + struct inode *inode = file_inode(file); 3726 3725 __le64 eof; 3727 - __u64 count; 3726 + __u64 count, old_eof; 3728 3727 3729 3728 xid = get_xid(); 3730 3729 3731 - if (off >= i_size_read(file->f_inode)) { 3730 + inode_lock(inode); 3731 + 3732 + old_eof = i_size_read(inode); 3733 + if (off >= old_eof) { 3732 3734 rc = -EINVAL; 3733 3735 goto out; 3734 3736 } 3735 3737 3736 - count = i_size_read(file->f_inode) - off; 3737 - eof = cpu_to_le64(i_size_read(file->f_inode) + len); 3738 + count = old_eof - off; 3739 + eof = cpu_to_le64(old_eof + len); 3740 + 3741 + filemap_invalidate_lock(inode->i_mapping); 3742 + rc = filemap_write_and_wait_range(inode->i_mapping, off, old_eof + len - 1); 3743 + if (rc < 0) 3744 + goto out_2; 3745 + truncate_pagecache_range(inode, off, old_eof); 3738 3746 3739 3747 rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, 3740 3748 cfile->fid.volatile_fid, cfile->pid, &eof); 3741 3749 if (rc < 0) 3742 - goto out; 3750 + goto out_2; 3743 3751 3744 3752 rc = smb2_copychunk_range(xid, cfile, cfile, off, count, off + len); 3745 3753 if (rc < 0) 3746 - goto out; 3754 + goto out_2; 3747 3755 3748 - rc = smb3_zero_range(file, tcon, off, len, 1); 3756 + rc = smb3_zero_data(file, tcon, off, len, xid); 3749 3757 if (rc < 0) 3750 - goto out; 3758 + goto out_2; 3751 3759 3752 3760 rc = 0; 3761 + out_2: 3762 + filemap_invalidate_unlock(inode->i_mapping); 3753 3763 out: 3764 + inode_unlock(inode); 3754 3765 free_xid(xid); 3755 3766 return rc; 3756 3767 }
+7 -5
fs/cifs/smb2pdu.c
··· 965 965 } else if (rc != 0) 966 966 goto neg_exit; 967 967 968 + rc = -EIO; 968 969 if (strcmp(server->vals->version_string, 969 970 SMB3ANY_VERSION_STRING) == 0) { 970 971 if (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) { 971 972 cifs_server_dbg(VFS, 972 973 "SMB2 dialect returned but not requested\n"); 973 - return -EIO; 974 + goto neg_exit; 974 975 } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { 975 976 cifs_server_dbg(VFS, 976 977 "SMB2.1 dialect returned but not requested\n"); 977 - return -EIO; 978 + goto neg_exit; 978 979 } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) { 979 980 /* ops set to 3.0 by default for default so update */ 980 981 server->ops = &smb311_operations; ··· 986 985 if (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) { 987 986 cifs_server_dbg(VFS, 988 987 "SMB2 dialect returned but not requested\n"); 989 - return -EIO; 988 + goto neg_exit; 990 989 } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { 991 990 /* ops set to 3.0 by default for default so update */ 992 991 server->ops = &smb21_operations; ··· 1000 999 /* if requested single dialect ensure returned dialect matched */ 1001 1000 cifs_server_dbg(VFS, "Invalid 0x%x dialect returned: not requested\n", 1002 1001 le16_to_cpu(rsp->DialectRevision)); 1003 - return -EIO; 1002 + goto neg_exit; 1004 1003 } 1005 1004 1006 1005 cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode); ··· 1018 1017 else { 1019 1018 cifs_server_dbg(VFS, "Invalid dialect returned by server 0x%x\n", 1020 1019 le16_to_cpu(rsp->DialectRevision)); 1021 - rc = -EIO; 1022 1020 goto neg_exit; 1023 1021 } 1022 + 1023 + rc = 0; 1024 1024 server->dialect = le16_to_cpu(rsp->DialectRevision); 1025 1025 1026 1026 /*
+6 -2
fs/erofs/fscache.c
··· 222 222 223 223 rreq = erofs_fscache_alloc_request(folio_mapping(folio), 224 224 folio_pos(folio), folio_size(folio)); 225 - if (IS_ERR(rreq)) 225 + if (IS_ERR(rreq)) { 226 + ret = PTR_ERR(rreq); 226 227 goto out; 228 + } 227 229 228 230 return erofs_fscache_read_folios_async(mdev.m_fscache->cookie, 229 231 rreq, mdev.m_pa); ··· 303 301 304 302 rreq = erofs_fscache_alloc_request(folio_mapping(folio), 305 303 folio_pos(folio), folio_size(folio)); 306 - if (IS_ERR(rreq)) 304 + if (IS_ERR(rreq)) { 305 + ret = PTR_ERR(rreq); 307 306 goto out_unlock; 307 + } 308 308 309 309 pstart = mdev.m_pa + (pos - map.m_la); 310 310 return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,
-29
fs/erofs/internal.h
··· 195 195 atomic_t refcount; 196 196 }; 197 197 198 - #if defined(CONFIG_SMP) 199 198 static inline bool erofs_workgroup_try_to_freeze(struct erofs_workgroup *grp, 200 199 int val) 201 200 { ··· 223 224 return atomic_cond_read_relaxed(&grp->refcount, 224 225 VAL != EROFS_LOCKED_MAGIC); 225 226 } 226 - #else 227 - static inline bool erofs_workgroup_try_to_freeze(struct erofs_workgroup *grp, 228 - int val) 229 - { 230 - preempt_disable(); 231 - /* no need to spin on UP platforms, let's just disable preemption. */ 232 - if (val != atomic_read(&grp->refcount)) { 233 - preempt_enable(); 234 - return false; 235 - } 236 - return true; 237 - } 238 - 239 - static inline void erofs_workgroup_unfreeze(struct erofs_workgroup *grp, 240 - int orig_val) 241 - { 242 - preempt_enable(); 243 - } 244 - 245 - static inline int erofs_wait_on_workgroup_freezed(struct erofs_workgroup *grp) 246 - { 247 - int v = atomic_read(&grp->refcount); 248 - 249 - /* workgroup is never freezed on uniprocessor systems */ 250 - DBG_BUGON(v == EROFS_LOCKED_MAGIC); 251 - return v; 252 - } 253 - #endif /* !CONFIG_SMP */ 254 227 #endif /* !CONFIG_EROFS_FS_ZIP */ 255 228 256 229 /* we strictly follow PAGE_SIZE and no buffer head yet */
+8 -8
fs/erofs/zmap.c
··· 141 141 u8 type, headtype; 142 142 u16 clusterofs; 143 143 u16 delta[2]; 144 - erofs_blk_t pblk, compressedlcs; 144 + erofs_blk_t pblk, compressedblks; 145 145 erofs_off_t nextpackoff; 146 146 }; 147 147 ··· 192 192 DBG_BUGON(1); 193 193 return -EFSCORRUPTED; 194 194 } 195 - m->compressedlcs = m->delta[0] & 195 + m->compressedblks = m->delta[0] & 196 196 ~Z_EROFS_VLE_DI_D0_CBLKCNT; 197 197 m->delta[0] = 1; 198 198 } ··· 293 293 DBG_BUGON(1); 294 294 return -EFSCORRUPTED; 295 295 } 296 - m->compressedlcs = lo & ~Z_EROFS_VLE_DI_D0_CBLKCNT; 296 + m->compressedblks = lo & ~Z_EROFS_VLE_DI_D0_CBLKCNT; 297 297 m->delta[0] = 1; 298 298 return 0; 299 299 } else if (i + 1 != (int)vcnt) { ··· 497 497 return 0; 498 498 } 499 499 lcn = m->lcn + 1; 500 - if (m->compressedlcs) 500 + if (m->compressedblks) 501 501 goto out; 502 502 503 503 err = z_erofs_load_cluster_from_disk(m, lcn, false); ··· 506 506 507 507 /* 508 508 * If the 1st NONHEAD lcluster has already been handled initially w/o 509 - * valid compressedlcs, which means at least it mustn't be CBLKCNT, or 509 + * valid compressedblks, which means at least it mustn't be CBLKCNT, or 510 510 * an internal implemenatation error is detected. 511 511 * 512 512 * The following code can also handle it properly anyway, but let's ··· 523 523 * if the 1st NONHEAD lcluster is actually PLAIN or HEAD type 524 524 * rather than CBLKCNT, it's a 1 lcluster-sized pcluster. 525 525 */ 526 - m->compressedlcs = 1; 526 + m->compressedblks = 1 << (lclusterbits - LOG_BLOCK_SIZE); 527 527 break; 528 528 case Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD: 529 529 if (m->delta[0] != 1) 530 530 goto err_bonus_cblkcnt; 531 - if (m->compressedlcs) 531 + if (m->compressedblks) 532 532 break; 533 533 fallthrough; 534 534 default: ··· 539 539 return -EFSCORRUPTED; 540 540 } 541 541 out: 542 - map->m_plen = (u64)m->compressedlcs << lclusterbits; 542 + map->m_plen = (u64)m->compressedblks << LOG_BLOCK_SIZE; 543 543 return 0; 544 544 err_bonus_cblkcnt: 545 545 erofs_err(m->inode->i_sb,
+1
include/linux/amba/bus.h
··· 67 67 struct clk *pclk; 68 68 struct device_dma_parameters dma_parms; 69 69 unsigned int periphid; 70 + struct mutex periphid_lock; 70 71 unsigned int cid; 71 72 struct amba_cs_uci_id uci; 72 73 unsigned int irq[AMBA_NR_IRQS];
+11
include/linux/buffer_head.h
··· 138 138 static __always_inline void set_buffer_uptodate(struct buffer_head *bh) 139 139 { 140 140 /* 141 + * If somebody else already set this uptodate, they will 142 + * have done the memory barrier, and a reader will thus 143 + * see *some* valid buffer state. 144 + * 145 + * Any other serialization (with IO errors or whatever that 146 + * might clear the bit) has to come from other state (eg BH_Lock). 147 + */ 148 + if (test_bit(BH_Uptodate, &bh->b_state)) 149 + return; 150 + 151 + /* 141 152 * make it consistent with folio_mark_uptodate 142 153 * pairs with smp_load_acquire in buffer_uptodate 143 154 */
+1
include/linux/device/driver.h
··· 242 242 243 243 extern int driver_deferred_probe_timeout; 244 244 void driver_deferred_probe_add(struct device *dev); 245 + int driver_deferred_probe_check_state(struct device *dev); 245 246 void driver_init(void); 246 247 247 248 /**
+5 -3
include/linux/ieee80211.h
··· 310 310 struct ieee80211_hdr { 311 311 __le16 frame_control; 312 312 __le16 duration_id; 313 - u8 addr1[ETH_ALEN]; 314 - u8 addr2[ETH_ALEN]; 315 - u8 addr3[ETH_ALEN]; 313 + struct_group(addrs, 314 + u8 addr1[ETH_ALEN]; 315 + u8 addr2[ETH_ALEN]; 316 + u8 addr3[ETH_ALEN]; 317 + ); 316 318 __le16 seq_ctrl; 317 319 u8 addr4[ETH_ALEN]; 318 320 } __packed __aligned(2);
+4 -2
include/linux/platform_data/x86/pmc_atom.h
··· 7 7 #ifndef PMC_ATOM_H 8 8 #define PMC_ATOM_H 9 9 10 + #include <linux/bits.h> 11 + 10 12 /* ValleyView Power Control Unit PCI Device ID */ 11 13 #define PCI_DEVICE_ID_VLV_PMC 0x0F1C 12 14 /* CherryTrail Power Control Unit PCI Device ID */ ··· 141 139 #define ACPI_MMIO_REG_LEN 0x100 142 140 143 141 #define PM1_CNT 0x4 144 - #define SLEEP_TYPE_MASK 0xFFFFECFF 142 + #define SLEEP_TYPE_MASK GENMASK(12, 10) 145 143 #define SLEEP_TYPE_S5 0x1C00 146 - #define SLEEP_ENABLE 0x2000 144 + #define SLEEP_ENABLE BIT(13) 147 145 148 146 extern int pmc_atom_read(int offset, u32 *value); 149 147
+8
include/linux/serial_core.h
··· 141 141 * Locking: none. 142 142 * Interrupts: caller dependent. 143 143 * 144 + * @start_rx: ``void ()(struct uart_port *port)`` 145 + * 146 + * Start receiving characters. 147 + * 148 + * Locking: @port->lock taken. 149 + * Interrupts: locally disabled. 150 + * This call must not sleep 151 + * 144 152 * @stop_rx: ``void ()(struct uart_port *port)`` 145 153 * 146 154 * Stop receiving characters; the @port is in the process of being closed.
+21
include/linux/skbuff.h
··· 2445 2445 skb_shinfo(skb)->nr_frags = i + 1; 2446 2446 } 2447 2447 2448 + /** 2449 + * skb_fill_page_desc_noacc - initialise a paged fragment in an skb 2450 + * @skb: buffer containing fragment to be initialised 2451 + * @i: paged fragment index to initialise 2452 + * @page: the page to use for this fragment 2453 + * @off: the offset to the data with @page 2454 + * @size: the length of the data 2455 + * 2456 + * Variant of skb_fill_page_desc() which does not deal with 2457 + * pfmemalloc, if page is not owned by us. 2458 + */ 2459 + static inline void skb_fill_page_desc_noacc(struct sk_buff *skb, int i, 2460 + struct page *page, int off, 2461 + int size) 2462 + { 2463 + struct skb_shared_info *shinfo = skb_shinfo(skb); 2464 + 2465 + __skb_fill_page_desc_noacc(shinfo, i, page, off, size); 2466 + shinfo->nr_frags = i + 1; 2467 + } 2468 + 2448 2469 void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, 2449 2470 int size, unsigned int truesize); 2450 2471
+1
include/linux/udp.h
··· 70 70 * For encapsulation sockets. 71 71 */ 72 72 int (*encap_rcv)(struct sock *sk, struct sk_buff *skb); 73 + void (*encap_err_rcv)(struct sock *sk, struct sk_buff *skb, unsigned int udp_offset); 73 74 int (*encap_err_lookup)(struct sock *sk, struct sk_buff *skb); 74 75 void (*encap_destroy)(struct sock *sk); 75 76
+2
include/linux/usb.h
··· 575 575 * @devaddr: device address, XHCI: assigned by HW, others: same as devnum 576 576 * @can_submit: URBs may be submitted 577 577 * @persist_enabled: USB_PERSIST enabled for this device 578 + * @reset_in_progress: the device is being reset 578 579 * @have_langid: whether string_langid is valid 579 580 * @authorized: policy has said we can use it; 580 581 * (user space) policy determines if we authorize this device to be ··· 663 662 664 663 unsigned can_submit:1; 665 664 unsigned persist_enabled:1; 665 + unsigned reset_in_progress:1; 666 666 unsigned have_langid:1; 667 667 unsigned authorized:1; 668 668 unsigned authenticated:1;
+5
include/linux/usb/typec_dp.h
··· 73 73 #define DP_CAP_USB BIT(7) 74 74 #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8) 75 75 #define DP_CAP_UFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(23, 16)) >> 16) 76 + /* Get pin assignment taking plug & receptacle into consideration */ 77 + #define DP_CAP_PIN_ASSIGN_UFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \ 78 + DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_)) 79 + #define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \ 80 + DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_)) 76 81 77 82 /* DisplayPort Status Update VDO bits */ 78 83 #define DP_STATUS_CONNECTION(_status_) ((_status_) & 3)
-2
include/net/af_rxrpc.h
··· 66 66 void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); 67 67 bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *); 68 68 u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *); 69 - bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *, 70 - ktime_t *); 71 69 bool rxrpc_kernel_call_is_complete(struct rxrpc_call *); 72 70 void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *, 73 71 unsigned long);
+67
include/net/dropreason.h
··· 3 3 #ifndef _LINUX_DROPREASON_H 4 4 #define _LINUX_DROPREASON_H 5 5 6 + #define DEFINE_DROP_REASON(FN, FNe) \ 7 + FN(NOT_SPECIFIED) \ 8 + FN(NO_SOCKET) \ 9 + FN(PKT_TOO_SMALL) \ 10 + FN(TCP_CSUM) \ 11 + FN(SOCKET_FILTER) \ 12 + FN(UDP_CSUM) \ 13 + FN(NETFILTER_DROP) \ 14 + FN(OTHERHOST) \ 15 + FN(IP_CSUM) \ 16 + FN(IP_INHDR) \ 17 + FN(IP_RPFILTER) \ 18 + FN(UNICAST_IN_L2_MULTICAST) \ 19 + FN(XFRM_POLICY) \ 20 + FN(IP_NOPROTO) \ 21 + FN(SOCKET_RCVBUFF) \ 22 + FN(PROTO_MEM) \ 23 + FN(TCP_MD5NOTFOUND) \ 24 + FN(TCP_MD5UNEXPECTED) \ 25 + FN(TCP_MD5FAILURE) \ 26 + FN(SOCKET_BACKLOG) \ 27 + FN(TCP_FLAGS) \ 28 + FN(TCP_ZEROWINDOW) \ 29 + FN(TCP_OLD_DATA) \ 30 + FN(TCP_OVERWINDOW) \ 31 + FN(TCP_OFOMERGE) \ 32 + FN(TCP_RFC7323_PAWS) \ 33 + FN(TCP_INVALID_SEQUENCE) \ 34 + FN(TCP_RESET) \ 35 + FN(TCP_INVALID_SYN) \ 36 + FN(TCP_CLOSE) \ 37 + FN(TCP_FASTOPEN) \ 38 + FN(TCP_OLD_ACK) \ 39 + FN(TCP_TOO_OLD_ACK) \ 40 + FN(TCP_ACK_UNSENT_DATA) \ 41 + FN(TCP_OFO_QUEUE_PRUNE) \ 42 + FN(TCP_OFO_DROP) \ 43 + FN(IP_OUTNOROUTES) \ 44 + FN(BPF_CGROUP_EGRESS) \ 45 + FN(IPV6DISABLED) \ 46 + FN(NEIGH_CREATEFAIL) \ 47 + FN(NEIGH_FAILED) \ 48 + FN(NEIGH_QUEUEFULL) \ 49 + FN(NEIGH_DEAD) \ 50 + FN(TC_EGRESS) \ 51 + FN(QDISC_DROP) \ 52 + FN(CPU_BACKLOG) \ 53 + FN(XDP) \ 54 + FN(TC_INGRESS) \ 55 + FN(UNHANDLED_PROTO) \ 56 + FN(SKB_CSUM) \ 57 + FN(SKB_GSO_SEG) \ 58 + FN(SKB_UCOPY_FAULT) \ 59 + FN(DEV_HDR) \ 60 + FN(DEV_READY) \ 61 + FN(FULL_RING) \ 62 + FN(NOMEM) \ 63 + FN(HDR_TRUNC) \ 64 + FN(TAP_FILTER) \ 65 + FN(TAP_TXFILTER) \ 66 + FN(ICMP_CSUM) \ 67 + FN(INVALID_PROTO) \ 68 + FN(IP_INADDRERRORS) \ 69 + FN(IP_INNOROUTES) \ 70 + FN(PKT_TOO_BIG) \ 71 + FNe(MAX) 72 + 6 73 /** 7 74 * enum skb_drop_reason - the reasons of skb drops 8 75 *
-2
include/net/netfilter/nf_conntrack.h
··· 53 53 /* only used when new connection is allocated: */ 54 54 atomic_t count; 55 55 unsigned int expect_count; 56 - u8 sysctl_auto_assign_helper; 57 - bool auto_assign_helper_warned; 58 56 59 57 /* only used from work queues, configuration plane, and so on: */ 60 58 unsigned int users4;
-1
include/net/netns/conntrack.h
··· 101 101 u8 sysctl_log_invalid; /* Log invalid packets */ 102 102 u8 sysctl_events; 103 103 u8 sysctl_acct; 104 - u8 sysctl_auto_assign_helper; 105 104 u8 sysctl_tstamp; 106 105 u8 sysctl_checksum; 107 106
+4
include/net/udp_tunnel.h
··· 67 67 typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb); 68 68 typedef int (*udp_tunnel_encap_err_lookup_t)(struct sock *sk, 69 69 struct sk_buff *skb); 70 + typedef void (*udp_tunnel_encap_err_rcv_t)(struct sock *sk, 71 + struct sk_buff *skb, 72 + unsigned int udp_offset); 70 73 typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk); 71 74 typedef struct sk_buff *(*udp_tunnel_gro_receive_t)(struct sock *sk, 72 75 struct list_head *head, ··· 83 80 __u8 encap_type; 84 81 udp_tunnel_encap_rcv_t encap_rcv; 85 82 udp_tunnel_encap_err_lookup_t encap_err_lookup; 83 + udp_tunnel_encap_err_rcv_t encap_err_rcv; 86 84 udp_tunnel_encap_destroy_t encap_destroy; 87 85 udp_tunnel_gro_receive_t gro_receive; 88 86 udp_tunnel_gro_complete_t gro_complete;
+8
include/soc/at91/sama7-ddr.h
··· 38 38 #define DDR3PHY_DSGCR_ODTPDD_ODT0 (1 << 20) /* ODT[0] Power Down Driver */ 39 39 40 40 #define DDR3PHY_ZQ0SR0 (0x188) /* ZQ status register 0 */ 41 + #define DDR3PHY_ZQ0SR0_PDO_OFF (0) /* Pull-down output impedance select offset */ 42 + #define DDR3PHY_ZQ0SR0_PUO_OFF (5) /* Pull-up output impedance select offset */ 43 + #define DDR3PHY_ZQ0SR0_PDODT_OFF (10) /* Pull-down on-die termination impedance select offset */ 44 + #define DDR3PHY_ZQ0SRO_PUODT_OFF (15) /* Pull-up on-die termination impedance select offset */ 45 + 46 + #define DDR3PHY_DX0DLLCR (0x1CC) /* DDR3PHY DATX8 DLL Control Register */ 47 + #define DDR3PHY_DX1DLLCR (0x20C) /* DDR3PHY DATX8 DLL Control Register */ 48 + #define DDR3PHY_DXDLLCR_DLLDIS (1 << 31) /* DLL Disable */ 41 49 42 50 /* UDDRC */ 43 51 #define UDDRC_STAT (0x04) /* UDDRC Operating Mode Status Register */
+14 -1
include/trace/events/skb.h
··· 9 9 #include <linux/netdevice.h> 10 10 #include <linux/tracepoint.h> 11 11 12 + #undef FN 13 + #define FN(reason) TRACE_DEFINE_ENUM(SKB_DROP_REASON_##reason); 14 + DEFINE_DROP_REASON(FN, FN) 15 + 16 + #undef FN 17 + #undef FNe 18 + #define FN(reason) { SKB_DROP_REASON_##reason, #reason }, 19 + #define FNe(reason) { SKB_DROP_REASON_##reason, #reason } 20 + 12 21 /* 13 22 * Tracepoint for free an sk_buff: 14 23 */ ··· 44 35 45 36 TP_printk("skbaddr=%p protocol=%u location=%p reason: %s", 46 37 __entry->skbaddr, __entry->protocol, __entry->location, 47 - drop_reasons[__entry->reason]) 38 + __print_symbolic(__entry->reason, 39 + DEFINE_DROP_REASON(FN, FNe))) 48 40 ); 41 + 42 + #undef FN 43 + #undef FNe 49 44 50 45 TRACE_EVENT(consume_skb, 51 46
+6 -22
include/uapi/linux/io_uring.h
··· 71 71 __s32 splice_fd_in; 72 72 __u32 file_index; 73 73 struct { 74 - __u16 notification_idx; 75 74 __u16 addr_len; 75 + __u16 __pad3[1]; 76 76 }; 77 77 }; 78 78 union { ··· 178 178 IORING_OP_FALLOCATE, 179 179 IORING_OP_OPENAT, 180 180 IORING_OP_CLOSE, 181 - IORING_OP_RSRC_UPDATE, 182 - IORING_OP_FILES_UPDATE = IORING_OP_RSRC_UPDATE, 181 + IORING_OP_FILES_UPDATE, 183 182 IORING_OP_STATX, 184 183 IORING_OP_READ, 185 184 IORING_OP_WRITE, ··· 205 206 IORING_OP_GETXATTR, 206 207 IORING_OP_SOCKET, 207 208 IORING_OP_URING_CMD, 208 - IORING_OP_SENDZC_NOTIF, 209 + IORING_OP_SEND_ZC, 209 210 210 211 /* this goes last, obviously */ 211 212 IORING_OP_LAST, ··· 227 228 #define IORING_TIMEOUT_ETIME_SUCCESS (1U << 5) 228 229 #define IORING_TIMEOUT_CLOCK_MASK (IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME) 229 230 #define IORING_TIMEOUT_UPDATE_MASK (IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE) 230 - 231 231 /* 232 232 * sqe->splice_flags 233 233 * extends splice(2) flags ··· 279 281 * 280 282 * IORING_RECVSEND_FIXED_BUF Use registered buffers, the index is stored in 281 283 * the buf_index field. 282 - * 283 - * IORING_RECVSEND_NOTIF_FLUSH Flush a notification after a successful 284 - * successful. Only for zerocopy sends. 285 284 */ 286 285 #define IORING_RECVSEND_POLL_FIRST (1U << 0) 287 286 #define IORING_RECV_MULTISHOT (1U << 1) 288 287 #define IORING_RECVSEND_FIXED_BUF (1U << 2) 289 - #define IORING_RECVSEND_NOTIF_FLUSH (1U << 3) 290 288 291 289 /* 292 290 * accept flags stored in sqe->ioprio 293 291 */ 294 292 #define IORING_ACCEPT_MULTISHOT (1U << 0) 295 - 296 - 297 - /* 298 - * IORING_OP_RSRC_UPDATE flags 299 - */ 300 - enum { 301 - IORING_RSRC_UPDATE_FILES, 302 - IORING_RSRC_UPDATE_NOTIF, 303 - }; 304 293 305 294 /* 306 295 * IORING_OP_MSG_RING command types, stored in sqe->addr ··· 326 341 * IORING_CQE_F_BUFFER If set, the upper 16 bits are the buffer ID 327 342 * IORING_CQE_F_MORE If set, parent SQE will generate more CQE entries 328 343 * IORING_CQE_F_SOCK_NONEMPTY If set, more data to read after socket recv 344 + * IORING_CQE_F_NOTIF Set for notification CQEs. Can be used to distinct 345 + * them from sends. 329 346 */ 330 347 #define IORING_CQE_F_BUFFER (1U << 0) 331 348 #define IORING_CQE_F_MORE (1U << 1) 332 349 #define IORING_CQE_F_SOCK_NONEMPTY (1U << 2) 350 + #define IORING_CQE_F_NOTIF (1U << 3) 333 351 334 352 enum { 335 353 IORING_CQE_BUFFER_SHIFT = 16, ··· 472 484 473 485 /* register a range of fixed file slots for automatic slot allocation */ 474 486 IORING_REGISTER_FILE_ALLOC_RANGE = 25, 475 - 476 - /* zerocopy notification API */ 477 - IORING_REGISTER_NOTIFIERS = 26, 478 - IORING_UNREGISTER_NOTIFIERS = 27, 479 487 480 488 /* this goes last */ 481 489 IORING_REGISTER_LAST
+2 -12
io_uring/io_uring.c
··· 2640 2640 io_unregister_personality(ctx, index); 2641 2641 if (ctx->rings) 2642 2642 io_poll_remove_all(ctx, NULL, true); 2643 - io_notif_unregister(ctx); 2644 2643 mutex_unlock(&ctx->uring_lock); 2645 2644 2646 2645 /* failed during ring init, it couldn't have issued any requests */ ··· 3838 3839 break; 3839 3840 ret = io_register_file_alloc_range(ctx, arg); 3840 3841 break; 3841 - case IORING_REGISTER_NOTIFIERS: 3842 - ret = io_notif_register(ctx, arg, nr_args); 3843 - break; 3844 - case IORING_UNREGISTER_NOTIFIERS: 3845 - ret = -EINVAL; 3846 - if (arg || nr_args) 3847 - break; 3848 - ret = io_notif_unregister(ctx); 3849 - break; 3850 3842 default: 3851 3843 ret = -EINVAL; 3852 3844 break; ··· 3923 3933 BUILD_BUG_SQE_ELEM(42, __u16, personality); 3924 3934 BUILD_BUG_SQE_ELEM(44, __s32, splice_fd_in); 3925 3935 BUILD_BUG_SQE_ELEM(44, __u32, file_index); 3926 - BUILD_BUG_SQE_ELEM(44, __u16, notification_idx); 3927 - BUILD_BUG_SQE_ELEM(46, __u16, addr_len); 3936 + BUILD_BUG_SQE_ELEM(44, __u16, addr_len); 3937 + BUILD_BUG_SQE_ELEM(46, __u16, __pad3[0]); 3928 3938 BUILD_BUG_SQE_ELEM(48, __u64, addr3); 3929 3939 BUILD_BUG_SQE_ELEM_SIZE(48, 0, cmd); 3930 3940 BUILD_BUG_SQE_ELEM(56, __u64, __pad2);
+35 -24
io_uring/net.c
··· 65 65 struct file *file; 66 66 void __user *buf; 67 67 size_t len; 68 - u16 slot_idx; 69 68 unsigned msg_flags; 70 69 unsigned flags; 71 70 unsigned addr_len; 72 71 void __user *addr; 73 72 size_t done_io; 73 + struct io_kiocb *notif; 74 74 }; 75 75 76 76 #define IO_APOLL_MULTI_POLLED (REQ_F_APOLL_MULTISHOT | REQ_F_POLLED) ··· 879 879 return ret; 880 880 } 881 881 882 + void io_sendzc_cleanup(struct io_kiocb *req) 883 + { 884 + struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); 885 + 886 + zc->notif->flags |= REQ_F_CQE_SKIP; 887 + io_notif_flush(zc->notif); 888 + zc->notif = NULL; 889 + } 890 + 882 891 int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 883 892 { 884 893 struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); 885 894 struct io_ring_ctx *ctx = req->ctx; 895 + struct io_kiocb *notif; 886 896 887 - if (READ_ONCE(sqe->__pad2[0]) || READ_ONCE(sqe->addr3)) 897 + if (READ_ONCE(sqe->__pad2[0]) || READ_ONCE(sqe->addr3) || 898 + READ_ONCE(sqe->__pad3[0])) 899 + return -EINVAL; 900 + /* we don't support IOSQE_CQE_SKIP_SUCCESS just yet */ 901 + if (req->flags & REQ_F_CQE_SKIP) 888 902 return -EINVAL; 889 903 890 904 zc->flags = READ_ONCE(sqe->ioprio); 891 905 if (zc->flags & ~(IORING_RECVSEND_POLL_FIRST | 892 - IORING_RECVSEND_FIXED_BUF | IORING_RECVSEND_NOTIF_FLUSH)) 906 + IORING_RECVSEND_FIXED_BUF)) 893 907 return -EINVAL; 894 908 if (zc->flags & IORING_RECVSEND_FIXED_BUF) { 895 909 unsigned idx = READ_ONCE(sqe->buf_index); ··· 914 900 req->imu = READ_ONCE(ctx->user_bufs[idx]); 915 901 io_req_set_rsrc_node(req, ctx, 0); 916 902 } 903 + notif = zc->notif = io_alloc_notif(ctx); 904 + if (!notif) 905 + return -ENOMEM; 906 + notif->cqe.user_data = req->cqe.user_data; 907 + notif->cqe.res = 0; 908 + notif->cqe.flags = IORING_CQE_F_NOTIF; 909 + req->flags |= REQ_F_NEED_CLEANUP; 917 910 918 911 zc->buf = u64_to_user_ptr(READ_ONCE(sqe->addr)); 919 912 zc->len = READ_ONCE(sqe->len); 920 913 zc->msg_flags = READ_ONCE(sqe->msg_flags) | MSG_NOSIGNAL; 921 - zc->slot_idx = READ_ONCE(sqe->notification_idx); 922 914 if (zc->msg_flags & MSG_DONTWAIT) 923 915 req->flags |= REQ_F_NOWAIT; 924 916 ··· 976 956 shinfo->nr_frags = frag; 977 957 from->bvec += bi.bi_idx; 978 958 from->nr_segs -= bi.bi_idx; 979 - from->count = bi.bi_size; 959 + from->count -= copied; 980 960 from->iov_offset = bi.bi_bvec_done; 981 961 982 962 skb->data_len += copied; ··· 996 976 int io_sendzc(struct io_kiocb *req, unsigned int issue_flags) 997 977 { 998 978 struct sockaddr_storage __address, *addr = NULL; 999 - struct io_ring_ctx *ctx = req->ctx; 1000 979 struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); 1001 - struct io_notif_slot *notif_slot; 1002 - struct io_kiocb *notif; 1003 980 struct msghdr msg; 1004 981 struct iovec iov; 1005 982 struct socket *sock; 1006 - unsigned msg_flags; 983 + unsigned msg_flags, cflags; 1007 984 int ret, min_ret = 0; 1008 985 1009 986 if (!(req->flags & REQ_F_POLLED) && 1010 987 (zc->flags & IORING_RECVSEND_POLL_FIRST)) 1011 988 return -EAGAIN; 1012 - 1013 - if (issue_flags & IO_URING_F_UNLOCKED) 1014 - return -EAGAIN; 1015 989 sock = sock_from_file(req->file); 1016 990 if (unlikely(!sock)) 1017 991 return -ENOTSOCK; 1018 - 1019 - notif_slot = io_get_notif_slot(ctx, zc->slot_idx); 1020 - if (!notif_slot) 1021 - return -EINVAL; 1022 - notif = io_get_notif(ctx, notif_slot); 1023 - if (!notif) 1024 - return -ENOMEM; 1025 992 1026 993 msg.msg_name = NULL; 1027 994 msg.msg_control = NULL; ··· 1040 1033 &msg.msg_iter); 1041 1034 if (unlikely(ret)) 1042 1035 return ret; 1043 - ret = io_notif_account_mem(notif, zc->len); 1036 + ret = io_notif_account_mem(zc->notif, zc->len); 1044 1037 if (unlikely(ret)) 1045 1038 return ret; 1046 1039 } ··· 1052 1045 min_ret = iov_iter_count(&msg.msg_iter); 1053 1046 1054 1047 msg.msg_flags = msg_flags; 1055 - msg.msg_ubuf = &io_notif_to_data(notif)->uarg; 1048 + msg.msg_ubuf = &io_notif_to_data(zc->notif)->uarg; 1056 1049 msg.sg_from_iter = io_sg_from_iter; 1057 1050 ret = sock_sendmsg(sock, &msg); 1058 1051 ··· 1067 1060 req->flags |= REQ_F_PARTIAL_IO; 1068 1061 return io_setup_async_addr(req, addr, issue_flags); 1069 1062 } 1063 + if (ret < 0 && !zc->done_io) 1064 + zc->notif->flags |= REQ_F_CQE_SKIP; 1070 1065 if (ret == -ERESTARTSYS) 1071 1066 ret = -EINTR; 1072 1067 req_set_fail(req); 1073 - } else if (zc->flags & IORING_RECVSEND_NOTIF_FLUSH) { 1074 - io_notif_slot_flush_submit(notif_slot, 0); 1075 1068 } 1076 1069 1077 1070 if (ret >= 0) 1078 1071 ret += zc->done_io; 1079 1072 else if (zc->done_io) 1080 1073 ret = zc->done_io; 1081 - io_req_set_res(req, ret, 0); 1074 + 1075 + io_notif_flush(zc->notif); 1076 + req->flags &= ~REQ_F_NEED_CLEANUP; 1077 + cflags = ret >= 0 ? IORING_CQE_F_MORE : 0; 1078 + io_req_set_res(req, ret, cflags); 1082 1079 return IOU_OK; 1083 1080 } 1084 1081
+1
io_uring/net.h
··· 55 55 56 56 int io_sendzc(struct io_kiocb *req, unsigned int issue_flags); 57 57 int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); 58 + void io_sendzc_cleanup(struct io_kiocb *req); 58 59 59 60 void io_netmsg_cache_free(struct io_cache_entry *entry); 60 61 #else
+2 -81
io_uring/notif.c
··· 42 42 } 43 43 } 44 44 45 - struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx, 46 - struct io_notif_slot *slot) 45 + struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx) 47 46 __must_hold(&ctx->uring_lock) 48 47 { 49 48 struct io_kiocb *notif; ··· 58 59 io_get_task_refs(1); 59 60 notif->rsrc_node = NULL; 60 61 io_req_set_rsrc_node(notif, ctx, 0); 61 - notif->cqe.user_data = slot->tag; 62 - notif->cqe.flags = slot->seq++; 63 - notif->cqe.res = 0; 64 62 65 63 nd = io_notif_to_data(notif); 66 64 nd->account_pages = 0; 67 65 nd->uarg.flags = SKBFL_ZEROCOPY_FRAG | SKBFL_DONT_ORPHAN; 68 66 nd->uarg.callback = io_uring_tx_zerocopy_callback; 69 - /* master ref owned by io_notif_slot, will be dropped on flush */ 70 67 refcount_set(&nd->uarg.refcnt, 1); 71 68 return notif; 72 69 } 73 70 74 - void io_notif_slot_flush(struct io_notif_slot *slot) 71 + void io_notif_flush(struct io_kiocb *notif) 75 72 __must_hold(&slot->notif->ctx->uring_lock) 76 73 { 77 - struct io_kiocb *notif = slot->notif; 78 74 struct io_notif_data *nd = io_notif_to_data(notif); 79 - 80 - slot->notif = NULL; 81 75 82 76 /* drop slot's master ref */ 83 77 if (refcount_dec_and_test(&nd->uarg.refcnt)) { 84 78 notif->io_task_work.func = __io_notif_complete_tw; 85 79 io_req_task_work_add(notif); 86 80 } 87 - } 88 - 89 - __cold int io_notif_unregister(struct io_ring_ctx *ctx) 90 - __must_hold(&ctx->uring_lock) 91 - { 92 - int i; 93 - 94 - if (!ctx->notif_slots) 95 - return -ENXIO; 96 - 97 - for (i = 0; i < ctx->nr_notif_slots; i++) { 98 - struct io_notif_slot *slot = &ctx->notif_slots[i]; 99 - struct io_kiocb *notif = slot->notif; 100 - struct io_notif_data *nd; 101 - 102 - if (!notif) 103 - continue; 104 - nd = io_notif_to_data(notif); 105 - slot->notif = NULL; 106 - if (!refcount_dec_and_test(&nd->uarg.refcnt)) 107 - continue; 108 - notif->io_task_work.func = __io_notif_complete_tw; 109 - io_req_task_work_add(notif); 110 - } 111 - 112 - kvfree(ctx->notif_slots); 113 - ctx->notif_slots = NULL; 114 - ctx->nr_notif_slots = 0; 115 - return 0; 116 - } 117 - 118 - __cold int io_notif_register(struct io_ring_ctx *ctx, 119 - void __user *arg, unsigned int size) 120 - __must_hold(&ctx->uring_lock) 121 - { 122 - struct io_uring_notification_slot __user *slots; 123 - struct io_uring_notification_slot slot; 124 - struct io_uring_notification_register reg; 125 - unsigned i; 126 - 127 - if (ctx->nr_notif_slots) 128 - return -EBUSY; 129 - if (size != sizeof(reg)) 130 - return -EINVAL; 131 - if (copy_from_user(&reg, arg, sizeof(reg))) 132 - return -EFAULT; 133 - if (!reg.nr_slots || reg.nr_slots > IORING_MAX_NOTIF_SLOTS) 134 - return -EINVAL; 135 - if (reg.resv || reg.resv2 || reg.resv3) 136 - return -EINVAL; 137 - 138 - slots = u64_to_user_ptr(reg.data); 139 - ctx->notif_slots = kvcalloc(reg.nr_slots, sizeof(ctx->notif_slots[0]), 140 - GFP_KERNEL_ACCOUNT); 141 - if (!ctx->notif_slots) 142 - return -ENOMEM; 143 - 144 - for (i = 0; i < reg.nr_slots; i++, ctx->nr_notif_slots++) { 145 - struct io_notif_slot *notif_slot = &ctx->notif_slots[i]; 146 - 147 - if (copy_from_user(&slot, &slots[i], sizeof(slot))) { 148 - io_notif_unregister(ctx); 149 - return -EFAULT; 150 - } 151 - if (slot.resv[0] | slot.resv[1] | slot.resv[2]) { 152 - io_notif_unregister(ctx); 153 - return -EINVAL; 154 - } 155 - notif_slot->tag = slot.tag; 156 - } 157 - return 0; 158 81 }
+2 -52
io_uring/notif.h
··· 8 8 #include "rsrc.h" 9 9 10 10 #define IO_NOTIF_SPLICE_BATCH 32 11 - #define IORING_MAX_NOTIF_SLOTS (1U << 15) 12 11 13 12 struct io_notif_data { 14 13 struct file *file; ··· 15 16 unsigned long account_pages; 16 17 }; 17 18 18 - struct io_notif_slot { 19 - /* 20 - * Current/active notifier. A slot holds only one active notifier at a 21 - * time and keeps one reference to it. Flush releases the reference and 22 - * lazily replaces it with a new notifier. 23 - */ 24 - struct io_kiocb *notif; 25 - 26 - /* 27 - * Default ->user_data for this slot notifiers CQEs 28 - */ 29 - u64 tag; 30 - /* 31 - * Notifiers of a slot live in generations, we create a new notifier 32 - * only after flushing the previous one. Track the sequential number 33 - * for all notifiers and copy it into notifiers's cqe->cflags 34 - */ 35 - u32 seq; 36 - }; 37 - 38 - int io_notif_register(struct io_ring_ctx *ctx, 39 - void __user *arg, unsigned int size); 40 - int io_notif_unregister(struct io_ring_ctx *ctx); 41 - 42 - void io_notif_slot_flush(struct io_notif_slot *slot); 43 - struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx, 44 - struct io_notif_slot *slot); 19 + void io_notif_flush(struct io_kiocb *notif); 20 + struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx); 45 21 46 22 static inline struct io_notif_data *io_notif_to_data(struct io_kiocb *notif) 47 23 { 48 24 return io_kiocb_to_cmd(notif, struct io_notif_data); 49 - } 50 - 51 - static inline struct io_kiocb *io_get_notif(struct io_ring_ctx *ctx, 52 - struct io_notif_slot *slot) 53 - { 54 - if (!slot->notif) 55 - slot->notif = io_alloc_notif(ctx, slot); 56 - return slot->notif; 57 - } 58 - 59 - static inline struct io_notif_slot *io_get_notif_slot(struct io_ring_ctx *ctx, 60 - unsigned idx) 61 - __must_hold(&ctx->uring_lock) 62 - { 63 - if (idx >= ctx->nr_notif_slots) 64 - return NULL; 65 - idx = array_index_nospec(idx, ctx->nr_notif_slots); 66 - return &ctx->notif_slots[idx]; 67 - } 68 - 69 - static inline void io_notif_slot_flush_submit(struct io_notif_slot *slot, 70 - unsigned int issue_flags) 71 - { 72 - io_notif_slot_flush(slot); 73 25 } 74 26 75 27 static inline int io_notif_account_mem(struct io_kiocb *notif, unsigned len)
+6 -6
io_uring/opdef.c
··· 246 246 .prep = io_close_prep, 247 247 .issue = io_close, 248 248 }, 249 - [IORING_OP_RSRC_UPDATE] = { 249 + [IORING_OP_FILES_UPDATE] = { 250 250 .audit_skip = 1, 251 251 .iopoll = 1, 252 - .name = "RSRC_UPDATE", 253 - .prep = io_rsrc_update_prep, 254 - .issue = io_rsrc_update, 255 - .ioprio = 1, 252 + .name = "FILES_UPDATE", 253 + .prep = io_files_update_prep, 254 + .issue = io_files_update, 256 255 }, 257 256 [IORING_OP_STATX] = { 258 257 .audit_skip = 1, ··· 470 471 .issue = io_uring_cmd, 471 472 .prep_async = io_uring_cmd_prep_async, 472 473 }, 473 - [IORING_OP_SENDZC_NOTIF] = { 474 + [IORING_OP_SEND_ZC] = { 474 475 .name = "SENDZC_NOTIF", 475 476 .needs_file = 1, 476 477 .unbound_nonreg_file = 1, ··· 483 484 .prep = io_sendzc_prep, 484 485 .issue = io_sendzc, 485 486 .prep_async = io_sendzc_prep_async, 487 + .cleanup = io_sendzc_cleanup, 486 488 #else 487 489 .prep = io_eopnotsupp_prep, 488 490 #endif
+2 -53
io_uring/rsrc.c
··· 15 15 #include "io_uring.h" 16 16 #include "openclose.h" 17 17 #include "rsrc.h" 18 - #include "notif.h" 19 18 20 19 struct io_rsrc_update { 21 20 struct file *file; 22 21 u64 arg; 23 22 u32 nr_args; 24 23 u32 offset; 25 - int type; 26 24 }; 27 25 28 26 static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov, ··· 653 655 return -EINVAL; 654 656 } 655 657 656 - int io_rsrc_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 658 + int io_files_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) 657 659 { 658 660 struct io_rsrc_update *up = io_kiocb_to_cmd(req, struct io_rsrc_update); 659 661 ··· 667 669 if (!up->nr_args) 668 670 return -EINVAL; 669 671 up->arg = READ_ONCE(sqe->addr); 670 - up->type = READ_ONCE(sqe->ioprio); 671 672 return 0; 672 673 } 673 674 ··· 709 712 return ret; 710 713 } 711 714 712 - static int io_files_update(struct io_kiocb *req, unsigned int issue_flags) 715 + int io_files_update(struct io_kiocb *req, unsigned int issue_flags) 713 716 { 714 717 struct io_rsrc_update *up = io_kiocb_to_cmd(req, struct io_rsrc_update); 715 718 struct io_ring_ctx *ctx = req->ctx; ··· 736 739 req_set_fail(req); 737 740 io_req_set_res(req, ret, 0); 738 741 return IOU_OK; 739 - } 740 - 741 - static int io_notif_update(struct io_kiocb *req, unsigned int issue_flags) 742 - { 743 - struct io_rsrc_update *up = io_kiocb_to_cmd(req, struct io_rsrc_update); 744 - struct io_ring_ctx *ctx = req->ctx; 745 - unsigned len = up->nr_args; 746 - unsigned idx_end, idx = up->offset; 747 - int ret = 0; 748 - 749 - io_ring_submit_lock(ctx, issue_flags); 750 - if (unlikely(check_add_overflow(idx, len, &idx_end))) { 751 - ret = -EOVERFLOW; 752 - goto out; 753 - } 754 - if (unlikely(idx_end > ctx->nr_notif_slots)) { 755 - ret = -EINVAL; 756 - goto out; 757 - } 758 - 759 - for (; idx < idx_end; idx++) { 760 - struct io_notif_slot *slot = &ctx->notif_slots[idx]; 761 - 762 - if (!slot->notif) 763 - continue; 764 - if (up->arg) 765 - slot->tag = up->arg; 766 - io_notif_slot_flush_submit(slot, issue_flags); 767 - } 768 - out: 769 - io_ring_submit_unlock(ctx, issue_flags); 770 - if (ret < 0) 771 - req_set_fail(req); 772 - io_req_set_res(req, ret, 0); 773 - return IOU_OK; 774 - } 775 - 776 - int io_rsrc_update(struct io_kiocb *req, unsigned int issue_flags) 777 - { 778 - struct io_rsrc_update *up = io_kiocb_to_cmd(req, struct io_rsrc_update); 779 - 780 - switch (up->type) { 781 - case IORING_RSRC_UPDATE_FILES: 782 - return io_files_update(req, issue_flags); 783 - case IORING_RSRC_UPDATE_NOTIF: 784 - return io_notif_update(req, issue_flags); 785 - } 786 - return -EINVAL; 787 742 } 788 743 789 744 int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx,
+2 -2
io_uring/rsrc.h
··· 167 167 return &data->tags[table_idx][off]; 168 168 } 169 169 170 - int io_rsrc_update(struct io_kiocb *req, unsigned int issue_flags); 171 - int io_rsrc_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); 170 + int io_files_update(struct io_kiocb *req, unsigned int issue_flags); 171 + int io_files_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); 172 172 173 173 int __io_account_mem(struct user_struct *user, unsigned long nr_pages); 174 174
+12 -9
mm/pagewalk.c
··· 110 110 do { 111 111 again: 112 112 next = pmd_addr_end(addr, end); 113 - if (pmd_none(*pmd) || (!walk->vma && !walk->no_vma)) { 113 + if (pmd_none(*pmd)) { 114 114 if (ops->pte_hole) 115 115 err = ops->pte_hole(addr, next, depth, walk); 116 116 if (err) ··· 171 171 do { 172 172 again: 173 173 next = pud_addr_end(addr, end); 174 - if (pud_none(*pud) || (!walk->vma && !walk->no_vma)) { 174 + if (pud_none(*pud)) { 175 175 if (ops->pte_hole) 176 176 err = ops->pte_hole(addr, next, depth, walk); 177 177 if (err) ··· 366 366 struct vm_area_struct *vma = walk->vma; 367 367 const struct mm_walk_ops *ops = walk->ops; 368 368 369 - if (vma && ops->pre_vma) { 369 + if (ops->pre_vma) { 370 370 err = ops->pre_vma(start, end, walk); 371 371 if (err) 372 372 return err; 373 373 } 374 374 375 - if (vma && is_vm_hugetlb_page(vma)) { 375 + if (is_vm_hugetlb_page(vma)) { 376 376 if (ops->hugetlb_entry) 377 377 err = walk_hugetlb_range(start, end, walk); 378 378 } else 379 379 err = walk_pgd_range(start, end, walk); 380 380 381 - if (vma && ops->post_vma) 381 + if (ops->post_vma) 382 382 ops->post_vma(walk); 383 383 384 384 return err; ··· 450 450 if (!vma) { /* after the last vma */ 451 451 walk.vma = NULL; 452 452 next = end; 453 + if (ops->pte_hole) 454 + err = ops->pte_hole(start, next, -1, &walk); 453 455 } else if (start < vma->vm_start) { /* outside vma */ 454 456 walk.vma = NULL; 455 457 next = min(end, vma->vm_start); 458 + if (ops->pte_hole) 459 + err = ops->pte_hole(start, next, -1, &walk); 456 460 } else { /* inside vma */ 457 461 walk.vma = vma; 458 462 next = min(end, vma->vm_end); ··· 474 470 } 475 471 if (err < 0) 476 472 break; 477 - } 478 - if (walk.vma || walk.ops->pte_hole) 479 473 err = __walk_page_range(start, next, &walk); 474 + } 480 475 if (err) 481 476 break; 482 477 } while (start = next, start < end); ··· 504 501 if (start >= end || !walk.mm) 505 502 return -EINVAL; 506 503 507 - mmap_assert_locked(walk.mm); 504 + mmap_assert_write_locked(walk.mm); 508 505 509 - return __walk_page_range(start, end, &walk); 506 + return walk_pgd_range(start, end, &walk); 510 507 } 511 508 512 509 int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops,
+2 -2
mm/ptdump.c
··· 152 152 { 153 153 const struct ptdump_range *range = st->range; 154 154 155 - mmap_read_lock(mm); 155 + mmap_write_lock(mm); 156 156 while (range->start != range->end) { 157 157 walk_page_range_novma(mm, range->start, range->end, 158 158 &ptdump_ops, pgd, st); 159 159 range++; 160 160 } 161 - mmap_read_unlock(mm); 161 + mmap_write_unlock(mm); 162 162 163 163 /* Flush out the last page */ 164 164 st->note_page(st, 0, -1, 0);
+6 -6
net/bluetooth/hci_sync.c
··· 3018 3018 /* Read Buffer Size (ACL mtu, max pkt, etc.) */ 3019 3019 static int hci_read_buffer_size_sync(struct hci_dev *hdev) 3020 3020 { 3021 - /* Use Read LE Buffer Size V2 if supported */ 3022 - if (hdev->commands[41] & 0x20) 3023 - return __hci_cmd_sync_status(hdev, 3024 - HCI_OP_LE_READ_BUFFER_SIZE_V2, 3025 - 0, NULL, HCI_CMD_TIMEOUT); 3026 - 3027 3021 return __hci_cmd_sync_status(hdev, HCI_OP_READ_BUFFER_SIZE, 3028 3022 0, NULL, HCI_CMD_TIMEOUT); 3029 3023 } ··· 3231 3237 /* Read LE Buffer Size */ 3232 3238 static int hci_le_read_buffer_size_sync(struct hci_dev *hdev) 3233 3239 { 3240 + /* Use Read LE Buffer Size V2 if supported */ 3241 + if (hdev->commands[41] & 0x20) 3242 + return __hci_cmd_sync_status(hdev, 3243 + HCI_OP_LE_READ_BUFFER_SIZE_V2, 3244 + 0, NULL, HCI_CMD_TIMEOUT); 3245 + 3234 3246 return __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_BUFFER_SIZE, 3235 3247 0, NULL, HCI_CMD_TIMEOUT); 3236 3248 }
+2
net/bridge/br_netfilter_hooks.c
··· 384 384 /* - Bridged-and-DNAT'ed traffic doesn't 385 385 * require ip_forwarding. */ 386 386 if (rt->dst.dev == dev) { 387 + skb_dst_drop(skb); 387 388 skb_dst_set(skb, &rt->dst); 388 389 goto bridged_dnat; 389 390 } ··· 414 413 kfree_skb(skb); 415 414 return 0; 416 415 } 416 + skb_dst_drop(skb); 417 417 skb_dst_set_noref(skb, &rt->dst); 418 418 } 419 419
+1
net/bridge/br_netfilter_ipv6.c
··· 197 197 kfree_skb(skb); 198 198 return 0; 199 199 } 200 + skb_dst_drop(skb); 200 201 skb_dst_set_noref(skb, &rt->dst); 201 202 } 202 203
-1
net/core/.gitignore
··· 1 - dropreason_str.c
+1 -21
net/core/Makefile
··· 5 5 6 6 obj-y := sock.o request_sock.o skbuff.o datagram.o stream.o scm.o \ 7 7 gen_stats.o gen_estimator.o net_namespace.o secure_seq.o \ 8 - flow_dissector.o dropreason_str.o 8 + flow_dissector.o 9 9 10 10 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o 11 11 ··· 40 40 obj-$(CONFIG_BPF_SYSCALL) += sock_map.o 41 41 obj-$(CONFIG_BPF_SYSCALL) += bpf_sk_storage.o 42 42 obj-$(CONFIG_OF) += of_net.o 43 - 44 - clean-files := dropreason_str.c 45 - 46 - quiet_cmd_dropreason_str = GEN $@ 47 - cmd_dropreason_str = awk -F ',' 'BEGIN{ print "\#include <net/dropreason.h>\n"; \ 48 - print "const char * const drop_reasons[] = {" }\ 49 - /^enum skb_drop/ { dr=1; }\ 50 - /^\};/ { dr=0; }\ 51 - /^\tSKB_DROP_REASON_/ {\ 52 - if (dr) {\ 53 - sub(/\tSKB_DROP_REASON_/, "", $$1);\ 54 - printf "\t[SKB_DROP_REASON_%s] = \"%s\",\n", $$1, $$1;\ 55 - }\ 56 - }\ 57 - END{ print "};" }' $< > $@ 58 - 59 - $(obj)/dropreason_str.c: $(srctree)/include/net/dropreason.h 60 - $(call cmd,dropreason_str) 61 - 62 - $(obj)/dropreason_str.o: $(obj)/dropreason_str.c
+1 -1
net/core/datagram.c
··· 677 677 page_ref_sub(last_head, refs); 678 678 refs = 0; 679 679 } 680 - skb_fill_page_desc(skb, frag++, head, start, size); 680 + skb_fill_page_desc_noacc(skb, frag++, head, start, size); 681 681 } 682 682 if (refs) 683 683 page_ref_sub(last_head, refs);
+5 -1
net/core/skbuff.c
··· 91 91 int sysctl_max_skb_frags __read_mostly = MAX_SKB_FRAGS; 92 92 EXPORT_SYMBOL(sysctl_max_skb_frags); 93 93 94 - /* The array 'drop_reasons' is auto-generated in dropreason_str.c */ 94 + #undef FN 95 + #define FN(reason) [SKB_DROP_REASON_##reason] = #reason, 96 + const char * const drop_reasons[] = { 97 + DEFINE_DROP_REASON(FN, FN) 98 + }; 95 99 EXPORT_SYMBOL(drop_reasons); 96 100 97 101 /**
+1 -1
net/ipv4/tcp.c
··· 1015 1015 skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); 1016 1016 } else { 1017 1017 get_page(page); 1018 - skb_fill_page_desc(skb, i, page, offset, copy); 1018 + skb_fill_page_desc_noacc(skb, i, page, offset, copy); 1019 1019 } 1020 1020 1021 1021 if (!(flags & MSG_NO_SHARED_FRAGS))
+18 -7
net/ipv4/tcp_input.c
··· 2513 2513 return tp->undo_marker && (!tp->undo_retrans || tcp_packet_delayed(tp)); 2514 2514 } 2515 2515 2516 + static bool tcp_is_non_sack_preventing_reopen(struct sock *sk) 2517 + { 2518 + struct tcp_sock *tp = tcp_sk(sk); 2519 + 2520 + if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) { 2521 + /* Hold old state until something *above* high_seq 2522 + * is ACKed. For Reno it is MUST to prevent false 2523 + * fast retransmits (RFC2582). SACK TCP is safe. */ 2524 + if (!tcp_any_retrans_done(sk)) 2525 + tp->retrans_stamp = 0; 2526 + return true; 2527 + } 2528 + return false; 2529 + } 2530 + 2516 2531 /* People celebrate: "We love our President!" */ 2517 2532 static bool tcp_try_undo_recovery(struct sock *sk) 2518 2533 { ··· 2550 2535 } else if (tp->rack.reo_wnd_persist) { 2551 2536 tp->rack.reo_wnd_persist--; 2552 2537 } 2553 - if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) { 2554 - /* Hold old state until something *above* high_seq 2555 - * is ACKed. For Reno it is MUST to prevent false 2556 - * fast retransmits (RFC2582). SACK TCP is safe. */ 2557 - if (!tcp_any_retrans_done(sk)) 2558 - tp->retrans_stamp = 0; 2538 + if (tcp_is_non_sack_preventing_reopen(sk)) 2559 2539 return true; 2560 - } 2561 2540 tcp_set_ca_state(sk, TCP_CA_Open); 2562 2541 tp->is_sack_reneg = 0; 2563 2542 return false; ··· 2587 2578 NET_INC_STATS(sock_net(sk), 2588 2579 LINUX_MIB_TCPSPURIOUSRTOS); 2589 2580 inet_csk(sk)->icsk_retransmits = 0; 2581 + if (tcp_is_non_sack_preventing_reopen(sk)) 2582 + return true; 2590 2583 if (frto_undo || tcp_is_sack(tp)) { 2591 2584 tcp_set_ca_state(sk, TCP_CA_Open); 2592 2585 tp->is_sack_reneg = 0;
+2
net/ipv4/udp.c
··· 783 783 */ 784 784 if (tunnel) { 785 785 /* ...not for tunnels though: we don't have a sending socket */ 786 + if (udp_sk(sk)->encap_err_rcv) 787 + udp_sk(sk)->encap_err_rcv(sk, skb, iph->ihl << 2); 786 788 goto out; 787 789 } 788 790 if (!inet->recverr) {
+1
net/ipv4/udp_tunnel_core.c
··· 72 72 73 73 udp_sk(sk)->encap_type = cfg->encap_type; 74 74 udp_sk(sk)->encap_rcv = cfg->encap_rcv; 75 + udp_sk(sk)->encap_err_rcv = cfg->encap_err_rcv; 75 76 udp_sk(sk)->encap_err_lookup = cfg->encap_err_lookup; 76 77 udp_sk(sk)->encap_destroy = cfg->encap_destroy; 77 78 udp_sk(sk)->gro_receive = cfg->gro_receive;
+7 -3
net/ipv6/addrconf.c
··· 3557 3557 fallthrough; 3558 3558 case NETDEV_UP: 3559 3559 case NETDEV_CHANGE: 3560 - if (dev->flags & IFF_SLAVE) 3561 - break; 3562 - 3563 3560 if (idev && idev->cnf.disable_ipv6) 3564 3561 break; 3562 + 3563 + if (dev->flags & IFF_SLAVE) { 3564 + if (event == NETDEV_UP && !IS_ERR_OR_NULL(idev) && 3565 + dev->flags & IFF_UP && dev->flags & IFF_MULTICAST) 3566 + ipv6_mc_up(idev); 3567 + break; 3568 + } 3565 3569 3566 3570 if (event == NETDEV_UP) { 3567 3571 /* restore routes for permanent addresses */
+5
net/ipv6/seg6.c
··· 191 191 goto out_unlock; 192 192 } 193 193 194 + if (slen > nla_len(info->attrs[SEG6_ATTR_SECRET])) { 195 + err = -EINVAL; 196 + goto out_unlock; 197 + } 198 + 194 199 if (hinfo) { 195 200 err = seg6_hmac_info_del(net, hmackeyid); 196 201 if (err)
+4 -1
net/ipv6/udp.c
··· 616 616 } 617 617 618 618 /* Tunnels don't have an application socket: don't pass errors back */ 619 - if (tunnel) 619 + if (tunnel) { 620 + if (udp_sk(sk)->encap_err_rcv) 621 + udp_sk(sk)->encap_err_rcv(sk, skb, offset); 620 622 goto out; 623 + } 621 624 622 625 if (!np->recverr) { 623 626 if (!harderr || sk->sk_state != TCP_ESTABLISHED)
+6 -6
net/mac80211/mlme.c
··· 3443 3443 ieee80211_link_info_change_notify(sdata, &sdata->deflink, 3444 3444 BSS_CHANGED_BSSID); 3445 3445 sdata->u.mgd.flags = 0; 3446 + 3446 3447 mutex_lock(&sdata->local->mtx); 3447 3448 ieee80211_link_release_channel(&sdata->deflink); 3448 - mutex_unlock(&sdata->local->mtx); 3449 - 3450 3449 ieee80211_vif_set_links(sdata, 0); 3450 + mutex_unlock(&sdata->local->mtx); 3451 3451 } 3452 3452 3453 3453 cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss); ··· 3485 3485 sdata->u.mgd.flags = 0; 3486 3486 sdata->vif.bss_conf.mu_mimo_owner = false; 3487 3487 3488 - mutex_lock(&sdata->local->mtx); 3489 - ieee80211_link_release_channel(&sdata->deflink); 3490 - mutex_unlock(&sdata->local->mtx); 3491 - 3492 3488 if (status != ASSOC_REJECTED) { 3493 3489 struct cfg80211_assoc_failure data = { 3494 3490 .timeout = status == ASSOC_TIMEOUT, ··· 3503 3507 cfg80211_assoc_failure(sdata->dev, &data); 3504 3508 } 3505 3509 3510 + mutex_lock(&sdata->local->mtx); 3511 + ieee80211_link_release_channel(&sdata->deflink); 3506 3512 ieee80211_vif_set_links(sdata, 0); 3513 + mutex_unlock(&sdata->local->mtx); 3507 3514 } 3508 3515 3509 3516 kfree(assoc_data); ··· 6561 6562 return 0; 6562 6563 6563 6564 out_err: 6565 + ieee80211_link_release_channel(&sdata->deflink); 6564 6566 ieee80211_vif_set_links(sdata, 0); 6565 6567 return err; 6566 6568 }
+4
net/mac80211/rx.c
··· 4084 4084 .link_id = -1, 4085 4085 }; 4086 4086 struct tid_ampdu_rx *tid_agg_rx; 4087 + u8 link_id; 4087 4088 4088 4089 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); 4089 4090 if (!tid_agg_rx) ··· 4104 4103 }; 4105 4104 drv_event_callback(rx.local, rx.sdata, &event); 4106 4105 } 4106 + /* FIXME: statistics won't be right with this */ 4107 + link_id = sta->sta.valid_links ? ffs(sta->sta.valid_links) - 1 : 0; 4108 + rx.link = rcu_dereference(sta->sdata->link[link_id]); 4107 4109 4108 4110 ieee80211_rx_handlers(&rx, &frames); 4109 4111 }
+2 -2
net/mac80211/wpa.c
··· 351 351 * FC | A1 | A2 | A3 | SC | [A4] | [QC] */ 352 352 put_unaligned_be16(len_a, &aad[0]); 353 353 put_unaligned(mask_fc, (__le16 *)&aad[2]); 354 - memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN); 354 + memcpy(&aad[4], &hdr->addrs, 3 * ETH_ALEN); 355 355 356 356 /* Mask Seq#, leave Frag# */ 357 357 aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f; ··· 792 792 IEEE80211_FCTL_MOREDATA); 793 793 put_unaligned(mask_fc, (__le16 *) &aad[0]); 794 794 /* A1 || A2 || A3 */ 795 - memcpy(aad + 2, &hdr->addr1, 3 * ETH_ALEN); 795 + memcpy(aad + 2, &hdr->addrs, 3 * ETH_ALEN); 796 796 } 797 797 798 798
+1 -6
net/netfilter/nf_conntrack_core.c
··· 1782 1782 } 1783 1783 spin_unlock_bh(&nf_conntrack_expect_lock); 1784 1784 } 1785 - if (!exp) 1785 + if (!exp && tmpl) 1786 1786 __nf_ct_try_assign_helper(ct, tmpl, GFP_ATOMIC); 1787 1787 1788 1788 /* Other CPU might have obtained a pointer to this object before it was ··· 2068 2068 ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply; 2069 2069 if (ct->master || (help && !hlist_empty(&help->expectations))) 2070 2070 return; 2071 - 2072 - rcu_read_lock(); 2073 - __nf_ct_try_assign_helper(ct, NULL, GFP_ATOMIC); 2074 - rcu_read_unlock(); 2075 2071 } 2076 2072 EXPORT_SYMBOL_GPL(nf_conntrack_alter_reply); 2077 2073 ··· 2793 2797 nf_conntrack_acct_pernet_init(net); 2794 2798 nf_conntrack_tstamp_pernet_init(net); 2795 2799 nf_conntrack_ecache_pernet_init(net); 2796 - nf_conntrack_helper_pernet_init(net); 2797 2800 nf_conntrack_proto_pernet_init(net); 2798 2801 2799 2802 return 0;
+10 -70
net/netfilter/nf_conntrack_helper.c
··· 35 35 EXPORT_SYMBOL_GPL(nf_ct_helper_hsize); 36 36 static unsigned int nf_ct_helper_count __read_mostly; 37 37 38 - static bool nf_ct_auto_assign_helper __read_mostly = false; 39 - module_param_named(nf_conntrack_helper, nf_ct_auto_assign_helper, bool, 0644); 40 - MODULE_PARM_DESC(nf_conntrack_helper, 41 - "Enable automatic conntrack helper assignment (default 0)"); 42 - 43 38 static DEFINE_MUTEX(nf_ct_nat_helpers_mutex); 44 39 static struct list_head nf_ct_nat_helpers __read_mostly; 45 40 ··· 44 49 { 45 50 return (((tuple->src.l3num << 8) | tuple->dst.protonum) ^ 46 51 (__force __u16)tuple->src.u.all) % nf_ct_helper_hsize; 47 - } 48 - 49 - static struct nf_conntrack_helper * 50 - __nf_ct_helper_find(const struct nf_conntrack_tuple *tuple) 51 - { 52 - struct nf_conntrack_helper *helper; 53 - struct nf_conntrack_tuple_mask mask = { .src.u.all = htons(0xFFFF) }; 54 - unsigned int h; 55 - 56 - if (!nf_ct_helper_count) 57 - return NULL; 58 - 59 - h = helper_hash(tuple); 60 - hlist_for_each_entry_rcu(helper, &nf_ct_helper_hash[h], hnode) { 61 - if (nf_ct_tuple_src_mask_cmp(tuple, &helper->tuple, &mask)) 62 - return helper; 63 - } 64 - return NULL; 65 52 } 66 53 67 54 struct nf_conntrack_helper * ··· 186 209 } 187 210 EXPORT_SYMBOL_GPL(nf_ct_helper_ext_add); 188 211 189 - static struct nf_conntrack_helper * 190 - nf_ct_lookup_helper(struct nf_conn *ct, struct net *net) 191 - { 192 - struct nf_conntrack_net *cnet = nf_ct_pernet(net); 193 - 194 - if (!cnet->sysctl_auto_assign_helper) { 195 - if (cnet->auto_assign_helper_warned) 196 - return NULL; 197 - if (!__nf_ct_helper_find(&ct->tuplehash[IP_CT_DIR_REPLY].tuple)) 198 - return NULL; 199 - pr_info("nf_conntrack: default automatic helper assignment " 200 - "has been turned off for security reasons and CT-based " 201 - "firewall rule not found. Use the iptables CT target " 202 - "to attach helpers instead.\n"); 203 - cnet->auto_assign_helper_warned = true; 204 - return NULL; 205 - } 206 - 207 - return __nf_ct_helper_find(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); 208 - } 209 - 210 212 int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl, 211 213 gfp_t flags) 212 214 { 213 215 struct nf_conntrack_helper *helper = NULL; 214 216 struct nf_conn_help *help; 215 - struct net *net = nf_ct_net(ct); 216 217 217 218 /* We already got a helper explicitly attached. The function 218 219 * nf_conntrack_alter_reply - in case NAT is in use - asks for looking ··· 201 246 if (test_bit(IPS_HELPER_BIT, &ct->status)) 202 247 return 0; 203 248 204 - if (tmpl != NULL) { 205 - help = nfct_help(tmpl); 206 - if (help != NULL) { 207 - helper = rcu_dereference(help->helper); 208 - set_bit(IPS_HELPER_BIT, &ct->status); 209 - } 249 + if (WARN_ON_ONCE(!tmpl)) 250 + return 0; 251 + 252 + help = nfct_help(tmpl); 253 + if (help != NULL) { 254 + helper = rcu_dereference(help->helper); 255 + set_bit(IPS_HELPER_BIT, &ct->status); 210 256 } 211 257 212 258 help = nfct_help(ct); 213 259 214 260 if (helper == NULL) { 215 - helper = nf_ct_lookup_helper(ct, net); 216 - if (helper == NULL) { 217 - if (help) 218 - RCU_INIT_POINTER(help->helper, NULL); 219 - return 0; 220 - } 261 + if (help) 262 + RCU_INIT_POINTER(help->helper, NULL); 263 + return 0; 221 264 } 222 265 223 266 if (help == NULL) { ··· 497 544 mutex_unlock(&nf_ct_nat_helpers_mutex); 498 545 } 499 546 EXPORT_SYMBOL_GPL(nf_nat_helper_unregister); 500 - 501 - void nf_ct_set_auto_assign_helper_warned(struct net *net) 502 - { 503 - nf_ct_pernet(net)->auto_assign_helper_warned = true; 504 - } 505 - EXPORT_SYMBOL_GPL(nf_ct_set_auto_assign_helper_warned); 506 - 507 - void nf_conntrack_helper_pernet_init(struct net *net) 508 - { 509 - struct nf_conntrack_net *cnet = nf_ct_pernet(net); 510 - 511 - cnet->sysctl_auto_assign_helper = nf_ct_auto_assign_helper; 512 - } 513 547 514 548 int nf_conntrack_helper_init(void) 515 549 {
+3 -2
net/netfilter/nf_conntrack_irc.c
··· 194 194 195 195 /* dcc_ip can be the internal OR external (NAT'ed) IP */ 196 196 tuple = &ct->tuplehash[dir].tuple; 197 - if (tuple->src.u3.ip != dcc_ip && 198 - tuple->dst.u3.ip != dcc_ip) { 197 + if ((tuple->src.u3.ip != dcc_ip && 198 + ct->tuplehash[!dir].tuple.dst.u3.ip != dcc_ip) || 199 + dcc_port == 0) { 199 200 net_warn_ratelimited("Forged DCC command from %pI4: %pI4:%u\n", 200 201 &tuple->src.u3.ip, 201 202 &dcc_ip, dcc_port);
-5
net/netfilter/nf_conntrack_netlink.c
··· 2298 2298 ct->status |= IPS_HELPER; 2299 2299 RCU_INIT_POINTER(help->helper, helper); 2300 2300 } 2301 - } else { 2302 - /* try an implicit helper assignation */ 2303 - err = __nf_ct_try_assign_helper(ct, NULL, GFP_ATOMIC); 2304 - if (err < 0) 2305 - goto err2; 2306 2301 } 2307 2302 2308 2303 err = ctnetlink_setup_nat(ct, cda);
-10
net/netfilter/nf_conntrack_standalone.c
··· 561 561 NF_SYSCTL_CT_LOG_INVALID, 562 562 NF_SYSCTL_CT_EXPECT_MAX, 563 563 NF_SYSCTL_CT_ACCT, 564 - NF_SYSCTL_CT_HELPER, 565 564 #ifdef CONFIG_NF_CONNTRACK_EVENTS 566 565 NF_SYSCTL_CT_EVENTS, 567 566 #endif ··· 673 674 [NF_SYSCTL_CT_ACCT] = { 674 675 .procname = "nf_conntrack_acct", 675 676 .data = &init_net.ct.sysctl_acct, 676 - .maxlen = sizeof(u8), 677 - .mode = 0644, 678 - .proc_handler = proc_dou8vec_minmax, 679 - .extra1 = SYSCTL_ZERO, 680 - .extra2 = SYSCTL_ONE, 681 - }, 682 - [NF_SYSCTL_CT_HELPER] = { 683 - .procname = "nf_conntrack_helper", 684 677 .maxlen = sizeof(u8), 685 678 .mode = 0644, 686 679 .proc_handler = proc_dou8vec_minmax, ··· 1091 1100 table[NF_SYSCTL_CT_CHECKSUM].data = &net->ct.sysctl_checksum; 1092 1101 table[NF_SYSCTL_CT_LOG_INVALID].data = &net->ct.sysctl_log_invalid; 1093 1102 table[NF_SYSCTL_CT_ACCT].data = &net->ct.sysctl_acct; 1094 - table[NF_SYSCTL_CT_HELPER].data = &cnet->sysctl_auto_assign_helper; 1095 1103 #ifdef CONFIG_NF_CONNTRACK_EVENTS 1096 1104 table[NF_SYSCTL_CT_EVENTS].data = &net->ct.sysctl_events; 1097 1105 #endif
+3 -1
net/netfilter/nf_tables_api.c
··· 2166 2166 chain->flags |= NFT_CHAIN_BASE | flags; 2167 2167 basechain->policy = NF_ACCEPT; 2168 2168 if (chain->flags & NFT_CHAIN_HW_OFFLOAD && 2169 - !nft_chain_offload_support(basechain)) 2169 + !nft_chain_offload_support(basechain)) { 2170 + list_splice_init(&basechain->hook_list, &hook->list); 2170 2171 return -EOPNOTSUPP; 2172 + } 2171 2173 2172 2174 flow_block_init(&basechain->flow_block); 2173 2175
-3
net/netfilter/nft_ct.c
··· 1089 1089 if (err < 0) 1090 1090 goto err_put_helper; 1091 1091 1092 - /* Avoid the bogus warning, helper will be assigned after CT init */ 1093 - nf_ct_set_auto_assign_helper_warned(ctx->net); 1094 - 1095 1092 return 0; 1096 1093 1097 1094 err_put_helper:
+1
net/rxrpc/ar-internal.h
··· 982 982 /* 983 983 * peer_event.c 984 984 */ 985 + void rxrpc_encap_err_rcv(struct sock *sk, struct sk_buff *skb, unsigned int udp_offset); 985 986 void rxrpc_error_report(struct sock *); 986 987 void rxrpc_peer_keepalive_worker(struct work_struct *); 987 988
+1 -1
net/rxrpc/call_event.c
··· 166 166 _enter("{%d,%d}", call->tx_hard_ack, call->tx_top); 167 167 168 168 now = ktime_get_real(); 169 - max_age = ktime_sub(now, jiffies_to_usecs(call->peer->rto_j)); 169 + max_age = ktime_sub_us(now, jiffies_to_usecs(call->peer->rto_j)); 170 170 171 171 spin_lock_bh(&call->lock); 172 172
+4
net/rxrpc/local_object.c
··· 137 137 138 138 tuncfg.encap_type = UDP_ENCAP_RXRPC; 139 139 tuncfg.encap_rcv = rxrpc_input_packet; 140 + tuncfg.encap_err_rcv = rxrpc_encap_err_rcv; 140 141 tuncfg.sk_user_data = local; 141 142 setup_udp_tunnel_sock(net, local->socket, &tuncfg); 142 143 ··· 405 404 struct rxrpc_local *local = 406 405 container_of(work, struct rxrpc_local, processor); 407 406 bool again; 407 + 408 + if (local->dead) 409 + return; 408 410 409 411 trace_rxrpc_local(local->debug_id, rxrpc_local_processing, 410 412 refcount_read(&local->ref), NULL);
+258 -39
net/rxrpc/peer_event.c
··· 16 16 #include <net/sock.h> 17 17 #include <net/af_rxrpc.h> 18 18 #include <net/ip.h> 19 + #include <net/icmp.h> 19 20 #include "ar-internal.h" 20 21 22 + static void rxrpc_adjust_mtu(struct rxrpc_peer *, unsigned int); 21 23 static void rxrpc_store_error(struct rxrpc_peer *, struct sock_exterr_skb *); 22 24 static void rxrpc_distribute_error(struct rxrpc_peer *, int, 23 25 enum rxrpc_call_completion); 24 26 25 27 /* 26 - * Find the peer associated with an ICMP packet. 28 + * Find the peer associated with an ICMPv4 packet. 27 29 */ 28 30 static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local, 29 - const struct sk_buff *skb, 31 + struct sk_buff *skb, 32 + unsigned int udp_offset, 33 + unsigned int *info, 30 34 struct sockaddr_rxrpc *srx) 35 + { 36 + struct iphdr *ip, *ip0 = ip_hdr(skb); 37 + struct icmphdr *icmp = icmp_hdr(skb); 38 + struct udphdr *udp = (struct udphdr *)(skb->data + udp_offset); 39 + 40 + _enter("%u,%u,%u", ip0->protocol, icmp->type, icmp->code); 41 + 42 + switch (icmp->type) { 43 + case ICMP_DEST_UNREACH: 44 + *info = ntohs(icmp->un.frag.mtu); 45 + fallthrough; 46 + case ICMP_TIME_EXCEEDED: 47 + case ICMP_PARAMETERPROB: 48 + ip = (struct iphdr *)((void *)icmp + 8); 49 + break; 50 + default: 51 + return NULL; 52 + } 53 + 54 + memset(srx, 0, sizeof(*srx)); 55 + srx->transport_type = local->srx.transport_type; 56 + srx->transport_len = local->srx.transport_len; 57 + srx->transport.family = local->srx.transport.family; 58 + 59 + /* Can we see an ICMP4 packet on an ICMP6 listening socket? and vice 60 + * versa? 61 + */ 62 + switch (srx->transport.family) { 63 + case AF_INET: 64 + srx->transport_len = sizeof(srx->transport.sin); 65 + srx->transport.family = AF_INET; 66 + srx->transport.sin.sin_port = udp->dest; 67 + memcpy(&srx->transport.sin.sin_addr, &ip->daddr, 68 + sizeof(struct in_addr)); 69 + break; 70 + 71 + #ifdef CONFIG_AF_RXRPC_IPV6 72 + case AF_INET6: 73 + srx->transport_len = sizeof(srx->transport.sin); 74 + srx->transport.family = AF_INET; 75 + srx->transport.sin.sin_port = udp->dest; 76 + memcpy(&srx->transport.sin.sin_addr, &ip->daddr, 77 + sizeof(struct in_addr)); 78 + break; 79 + #endif 80 + 81 + default: 82 + WARN_ON_ONCE(1); 83 + return NULL; 84 + } 85 + 86 + _net("ICMP {%pISp}", &srx->transport); 87 + return rxrpc_lookup_peer_rcu(local, srx); 88 + } 89 + 90 + #ifdef CONFIG_AF_RXRPC_IPV6 91 + /* 92 + * Find the peer associated with an ICMPv6 packet. 93 + */ 94 + static struct rxrpc_peer *rxrpc_lookup_peer_icmp6_rcu(struct rxrpc_local *local, 95 + struct sk_buff *skb, 96 + unsigned int udp_offset, 97 + unsigned int *info, 98 + struct sockaddr_rxrpc *srx) 99 + { 100 + struct icmp6hdr *icmp = icmp6_hdr(skb); 101 + struct ipv6hdr *ip, *ip0 = ipv6_hdr(skb); 102 + struct udphdr *udp = (struct udphdr *)(skb->data + udp_offset); 103 + 104 + _enter("%u,%u,%u", ip0->nexthdr, icmp->icmp6_type, icmp->icmp6_code); 105 + 106 + switch (icmp->icmp6_type) { 107 + case ICMPV6_DEST_UNREACH: 108 + *info = ntohl(icmp->icmp6_mtu); 109 + fallthrough; 110 + case ICMPV6_PKT_TOOBIG: 111 + case ICMPV6_TIME_EXCEED: 112 + case ICMPV6_PARAMPROB: 113 + ip = (struct ipv6hdr *)((void *)icmp + 8); 114 + break; 115 + default: 116 + return NULL; 117 + } 118 + 119 + memset(srx, 0, sizeof(*srx)); 120 + srx->transport_type = local->srx.transport_type; 121 + srx->transport_len = local->srx.transport_len; 122 + srx->transport.family = local->srx.transport.family; 123 + 124 + /* Can we see an ICMP4 packet on an ICMP6 listening socket? and vice 125 + * versa? 126 + */ 127 + switch (srx->transport.family) { 128 + case AF_INET: 129 + _net("Rx ICMP6 on v4 sock"); 130 + srx->transport_len = sizeof(srx->transport.sin); 131 + srx->transport.family = AF_INET; 132 + srx->transport.sin.sin_port = udp->dest; 133 + memcpy(&srx->transport.sin.sin_addr, 134 + &ip->daddr.s6_addr32[3], sizeof(struct in_addr)); 135 + break; 136 + case AF_INET6: 137 + _net("Rx ICMP6"); 138 + srx->transport.sin.sin_port = udp->dest; 139 + memcpy(&srx->transport.sin6.sin6_addr, &ip->daddr, 140 + sizeof(struct in6_addr)); 141 + break; 142 + default: 143 + WARN_ON_ONCE(1); 144 + return NULL; 145 + } 146 + 147 + _net("ICMP {%pISp}", &srx->transport); 148 + return rxrpc_lookup_peer_rcu(local, srx); 149 + } 150 + #endif /* CONFIG_AF_RXRPC_IPV6 */ 151 + 152 + /* 153 + * Handle an error received on the local endpoint as a tunnel. 154 + */ 155 + void rxrpc_encap_err_rcv(struct sock *sk, struct sk_buff *skb, 156 + unsigned int udp_offset) 157 + { 158 + struct sock_extended_err ee; 159 + struct sockaddr_rxrpc srx; 160 + struct rxrpc_local *local; 161 + struct rxrpc_peer *peer; 162 + unsigned int info = 0; 163 + int err; 164 + u8 version = ip_hdr(skb)->version; 165 + u8 type = icmp_hdr(skb)->type; 166 + u8 code = icmp_hdr(skb)->code; 167 + 168 + rcu_read_lock(); 169 + local = rcu_dereference_sk_user_data(sk); 170 + if (unlikely(!local)) { 171 + rcu_read_unlock(); 172 + return; 173 + } 174 + 175 + rxrpc_new_skb(skb, rxrpc_skb_received); 176 + 177 + switch (ip_hdr(skb)->version) { 178 + case IPVERSION: 179 + peer = rxrpc_lookup_peer_icmp_rcu(local, skb, udp_offset, 180 + &info, &srx); 181 + break; 182 + #ifdef CONFIG_AF_RXRPC_IPV6 183 + case 6: 184 + peer = rxrpc_lookup_peer_icmp6_rcu(local, skb, udp_offset, 185 + &info, &srx); 186 + break; 187 + #endif 188 + default: 189 + rcu_read_unlock(); 190 + return; 191 + } 192 + 193 + if (peer && !rxrpc_get_peer_maybe(peer)) 194 + peer = NULL; 195 + if (!peer) { 196 + rcu_read_unlock(); 197 + return; 198 + } 199 + 200 + memset(&ee, 0, sizeof(ee)); 201 + 202 + switch (version) { 203 + case IPVERSION: 204 + switch (type) { 205 + case ICMP_DEST_UNREACH: 206 + switch (code) { 207 + case ICMP_FRAG_NEEDED: 208 + rxrpc_adjust_mtu(peer, info); 209 + rcu_read_unlock(); 210 + rxrpc_put_peer(peer); 211 + return; 212 + default: 213 + break; 214 + } 215 + 216 + err = EHOSTUNREACH; 217 + if (code <= NR_ICMP_UNREACH) { 218 + /* Might want to do something different with 219 + * non-fatal errors 220 + */ 221 + //harderr = icmp_err_convert[code].fatal; 222 + err = icmp_err_convert[code].errno; 223 + } 224 + break; 225 + 226 + case ICMP_TIME_EXCEEDED: 227 + err = EHOSTUNREACH; 228 + break; 229 + default: 230 + err = EPROTO; 231 + break; 232 + } 233 + 234 + ee.ee_origin = SO_EE_ORIGIN_ICMP; 235 + ee.ee_type = type; 236 + ee.ee_code = code; 237 + ee.ee_errno = err; 238 + break; 239 + 240 + #ifdef CONFIG_AF_RXRPC_IPV6 241 + case 6: 242 + switch (type) { 243 + case ICMPV6_PKT_TOOBIG: 244 + rxrpc_adjust_mtu(peer, info); 245 + rcu_read_unlock(); 246 + rxrpc_put_peer(peer); 247 + return; 248 + } 249 + 250 + icmpv6_err_convert(type, code, &err); 251 + 252 + if (err == EACCES) 253 + err = EHOSTUNREACH; 254 + 255 + ee.ee_origin = SO_EE_ORIGIN_ICMP6; 256 + ee.ee_type = type; 257 + ee.ee_code = code; 258 + ee.ee_errno = err; 259 + break; 260 + #endif 261 + } 262 + 263 + trace_rxrpc_rx_icmp(peer, &ee, &srx); 264 + 265 + rxrpc_distribute_error(peer, err, RXRPC_CALL_NETWORK_ERROR); 266 + rcu_read_unlock(); 267 + rxrpc_put_peer(peer); 268 + } 269 + 270 + /* 271 + * Find the peer associated with a local error. 272 + */ 273 + static struct rxrpc_peer *rxrpc_lookup_peer_local_rcu(struct rxrpc_local *local, 274 + const struct sk_buff *skb, 275 + struct sockaddr_rxrpc *srx) 31 276 { 32 277 struct sock_exterr_skb *serr = SKB_EXT_ERR(skb); 33 278 ··· 283 38 srx->transport_len = local->srx.transport_len; 284 39 srx->transport.family = local->srx.transport.family; 285 40 286 - /* Can we see an ICMP4 packet on an ICMP6 listening socket? and vice 287 - * versa? 288 - */ 289 41 switch (srx->transport.family) { 290 42 case AF_INET: 291 43 srx->transport_len = sizeof(srx->transport.sin); ··· 346 104 /* 347 105 * Handle an MTU/fragmentation problem. 348 106 */ 349 - static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, struct sock_exterr_skb *serr) 107 + static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, unsigned int mtu) 350 108 { 351 - u32 mtu = serr->ee.ee_info; 352 - 353 109 _net("Rx ICMP Fragmentation Needed (%d)", mtu); 354 110 355 111 /* wind down the local interface MTU */ ··· 388 148 struct sock_exterr_skb *serr; 389 149 struct sockaddr_rxrpc srx; 390 150 struct rxrpc_local *local; 391 - struct rxrpc_peer *peer; 151 + struct rxrpc_peer *peer = NULL; 392 152 struct sk_buff *skb; 393 153 394 154 rcu_read_lock(); ··· 412 172 } 413 173 rxrpc_new_skb(skb, rxrpc_skb_received); 414 174 serr = SKB_EXT_ERR(skb); 415 - if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) { 416 - _leave("UDP empty message"); 417 - rcu_read_unlock(); 418 - rxrpc_free_skb(skb, rxrpc_skb_freed); 419 - return; 175 + 176 + if (serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL) { 177 + peer = rxrpc_lookup_peer_local_rcu(local, skb, &srx); 178 + if (peer && !rxrpc_get_peer_maybe(peer)) 179 + peer = NULL; 180 + if (peer) { 181 + trace_rxrpc_rx_icmp(peer, &serr->ee, &srx); 182 + rxrpc_store_error(peer, serr); 183 + } 420 184 } 421 185 422 - peer = rxrpc_lookup_peer_icmp_rcu(local, skb, &srx); 423 - if (peer && !rxrpc_get_peer_maybe(peer)) 424 - peer = NULL; 425 - if (!peer) { 426 - rcu_read_unlock(); 427 - rxrpc_free_skb(skb, rxrpc_skb_freed); 428 - _leave(" [no peer]"); 429 - return; 430 - } 431 - 432 - trace_rxrpc_rx_icmp(peer, &serr->ee, &srx); 433 - 434 - if ((serr->ee.ee_origin == SO_EE_ORIGIN_ICMP && 435 - serr->ee.ee_type == ICMP_DEST_UNREACH && 436 - serr->ee.ee_code == ICMP_FRAG_NEEDED)) { 437 - rxrpc_adjust_mtu(peer, serr); 438 - rcu_read_unlock(); 439 - rxrpc_free_skb(skb, rxrpc_skb_freed); 440 - rxrpc_put_peer(peer); 441 - _leave(" [MTU update]"); 442 - return; 443 - } 444 - 445 - rxrpc_store_error(peer, serr); 446 186 rcu_read_unlock(); 447 187 rxrpc_free_skb(skb, rxrpc_skb_freed); 448 188 rxrpc_put_peer(peer); 449 - 450 189 _leave(""); 451 190 } 452 191
-43
net/rxrpc/recvmsg.c
··· 771 771 goto out; 772 772 } 773 773 EXPORT_SYMBOL(rxrpc_kernel_recv_data); 774 - 775 - /** 776 - * rxrpc_kernel_get_reply_time - Get timestamp on first reply packet 777 - * @sock: The socket that the call exists on 778 - * @call: The call to query 779 - * @_ts: Where to put the timestamp 780 - * 781 - * Retrieve the timestamp from the first DATA packet of the reply if it is 782 - * in the ring. Returns true if successful, false if not. 783 - */ 784 - bool rxrpc_kernel_get_reply_time(struct socket *sock, struct rxrpc_call *call, 785 - ktime_t *_ts) 786 - { 787 - struct sk_buff *skb; 788 - rxrpc_seq_t hard_ack, top, seq; 789 - bool success = false; 790 - 791 - mutex_lock(&call->user_mutex); 792 - 793 - if (READ_ONCE(call->state) != RXRPC_CALL_CLIENT_RECV_REPLY) 794 - goto out; 795 - 796 - hard_ack = call->rx_hard_ack; 797 - if (hard_ack != 0) 798 - goto out; 799 - 800 - seq = hard_ack + 1; 801 - top = smp_load_acquire(&call->rx_top); 802 - if (after(seq, top)) 803 - goto out; 804 - 805 - skb = call->rxtx_buffer[seq & RXRPC_RXTX_BUFF_MASK]; 806 - if (!skb) 807 - goto out; 808 - 809 - *_ts = skb_get_ktime(skb); 810 - success = true; 811 - 812 - out: 813 - mutex_unlock(&call->user_mutex); 814 - return success; 815 - } 816 - EXPORT_SYMBOL(rxrpc_kernel_get_reply_time);
+1 -1
net/rxrpc/rxkad.c
··· 540 540 * directly into the target buffer. 541 541 */ 542 542 sg = _sg; 543 - nsg = skb_shinfo(skb)->nr_frags; 543 + nsg = skb_shinfo(skb)->nr_frags + 1; 544 544 if (nsg <= 4) { 545 545 nsg = 4; 546 546 } else {
+8 -5
net/sched/sch_sfb.c
··· 135 135 } 136 136 } 137 137 138 - static void increment_qlen(const struct sk_buff *skb, struct sfb_sched_data *q) 138 + static void increment_qlen(const struct sfb_skb_cb *cb, struct sfb_sched_data *q) 139 139 { 140 140 u32 sfbhash; 141 141 142 - sfbhash = sfb_hash(skb, 0); 142 + sfbhash = cb->hashes[0]; 143 143 if (sfbhash) 144 144 increment_one_qlen(sfbhash, 0, q); 145 145 146 - sfbhash = sfb_hash(skb, 1); 146 + sfbhash = cb->hashes[1]; 147 147 if (sfbhash) 148 148 increment_one_qlen(sfbhash, 1, q); 149 149 } ··· 281 281 { 282 282 283 283 struct sfb_sched_data *q = qdisc_priv(sch); 284 + unsigned int len = qdisc_pkt_len(skb); 284 285 struct Qdisc *child = q->qdisc; 285 286 struct tcf_proto *fl; 287 + struct sfb_skb_cb cb; 286 288 int i; 287 289 u32 p_min = ~0; 288 290 u32 minqlen = ~0; ··· 401 399 } 402 400 403 401 enqueue: 402 + memcpy(&cb, sfb_skb_cb(skb), sizeof(cb)); 404 403 ret = qdisc_enqueue(skb, child, to_free); 405 404 if (likely(ret == NET_XMIT_SUCCESS)) { 406 - qdisc_qstats_backlog_inc(sch, skb); 405 + sch->qstats.backlog += len; 407 406 sch->q.qlen++; 408 - increment_qlen(skb, q); 407 + increment_qlen(&cb, q); 409 408 } else if (net_xmit_drop_count(ret)) { 410 409 q->stats.childdrop++; 411 410 qdisc_qstats_drop(sch);
+1
net/smc/smc_core.c
··· 757 757 lnk->lgr = lgr; 758 758 smc_lgr_hold(lgr); /* lgr_put in smcr_link_clear() */ 759 759 lnk->link_idx = link_idx; 760 + lnk->wr_rx_id_compl = 0; 760 761 smc_ibdev_cnt_inc(lnk); 761 762 smcr_copy_dev_info_to_link(lnk); 762 763 atomic_set(&lnk->conn_cnt, 0);
+2
net/smc/smc_core.h
··· 115 115 dma_addr_t wr_rx_dma_addr; /* DMA address of wr_rx_bufs */ 116 116 dma_addr_t wr_rx_v2_dma_addr; /* DMA address of v2 rx buf*/ 117 117 u64 wr_rx_id; /* seq # of last recv WR */ 118 + u64 wr_rx_id_compl; /* seq # of last completed WR */ 118 119 u32 wr_rx_cnt; /* number of WR recv buffers */ 119 120 unsigned long wr_rx_tstamp; /* jiffies when last buf rx */ 121 + wait_queue_head_t wr_rx_empty_wait; /* wait for RQ empty */ 120 122 121 123 struct ib_reg_wr wr_reg; /* WR register memory region */ 122 124 wait_queue_head_t wr_reg_wait; /* wait for wr_reg result */
+5
net/smc/smc_wr.c
··· 454 454 455 455 for (i = 0; i < num; i++) { 456 456 link = wc[i].qp->qp_context; 457 + link->wr_rx_id_compl = wc[i].wr_id; 457 458 if (wc[i].status == IB_WC_SUCCESS) { 458 459 link->wr_rx_tstamp = jiffies; 459 460 smc_wr_rx_demultiplex(&wc[i]); ··· 466 465 case IB_WC_RNR_RETRY_EXC_ERR: 467 466 case IB_WC_WR_FLUSH_ERR: 468 467 smcr_link_down_cond_sched(link); 468 + if (link->wr_rx_id_compl == link->wr_rx_id) 469 + wake_up(&link->wr_rx_empty_wait); 469 470 break; 470 471 default: 471 472 smc_wr_rx_post(link); /* refill WR RX */ ··· 642 639 return; 643 640 ibdev = lnk->smcibdev->ibdev; 644 641 642 + smc_wr_drain_cq(lnk); 645 643 smc_wr_wakeup_reg_wait(lnk); 646 644 smc_wr_wakeup_tx_wait(lnk); 647 645 ··· 893 889 atomic_set(&lnk->wr_tx_refcnt, 0); 894 890 init_waitqueue_head(&lnk->wr_reg_wait); 895 891 atomic_set(&lnk->wr_reg_refcnt, 0); 892 + init_waitqueue_head(&lnk->wr_rx_empty_wait); 896 893 return rc; 897 894 898 895 dma_unmap:
+5
net/smc/smc_wr.h
··· 73 73 wake_up_all(&link->wr_tx_wait); 74 74 } 75 75 76 + static inline void smc_wr_drain_cq(struct smc_link *lnk) 77 + { 78 + wait_event(lnk->wr_rx_empty_wait, lnk->wr_rx_id_compl == lnk->wr_rx_id); 79 + } 80 + 76 81 static inline void smc_wr_wakeup_tx_wait(struct smc_link *lnk) 77 82 { 78 83 wake_up_all(&lnk->wr_tx_wait);
+1 -1
net/tipc/monitor.c
··· 160 160 161 161 static int map_get(u64 up_map, int i) 162 162 { 163 - return (up_map & (1 << i)) >> i; 163 + return (up_map & (1ULL << i)) >> i; 164 164 } 165 165 166 166 static struct tipc_peer *peer_prev(struct tipc_peer *peer)
+1 -1
net/wireless/lib80211_crypt_ccmp.c
··· 136 136 pos = (u8 *) hdr; 137 137 aad[0] = pos[0] & 0x8f; 138 138 aad[1] = pos[1] & 0xc7; 139 - memcpy(aad + 2, hdr->addr1, 3 * ETH_ALEN); 139 + memcpy(aad + 2, &hdr->addrs, 3 * ETH_ALEN); 140 140 pos = (u8 *) & hdr->seq_ctrl; 141 141 aad[20] = pos[0] & 0x0f; 142 142 aad[21] = 0; /* all bits masked */
+12
scripts/Makefile.extrawarn
··· 47 47 48 48 ifdef CONFIG_CC_IS_CLANG 49 49 KBUILD_CFLAGS += -Wno-initializer-overrides 50 + # Clang before clang-16 would warn on default argument promotions. 51 + ifeq ($(shell [ $(CONFIG_CLANG_VERSION) -lt 160000 ] && echo y),y) 52 + # Disable -Wformat 50 53 KBUILD_CFLAGS += -Wno-format 54 + # Then re-enable flags that were part of the -Wformat group that aren't 55 + # problematic. 56 + KBUILD_CFLAGS += -Wformat-extra-args -Wformat-invalid-specifier 57 + KBUILD_CFLAGS += -Wformat-zero-length -Wnonnull 58 + # Requires clang-12+. 59 + ifeq ($(shell [ $(CONFIG_CLANG_VERSION) -ge 120000 ] && echo y),y) 60 + KBUILD_CFLAGS += -Wformat-insufficient-args 61 + endif 62 + endif 51 63 KBUILD_CFLAGS += -Wno-sign-compare 52 64 KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) 53 65 KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
+25 -23
security/landlock/fs.c
··· 150 150 /* clang-format on */ 151 151 152 152 /* 153 + * All access rights that are denied by default whether they are handled or not 154 + * by a ruleset/layer. This must be ORed with all ruleset->fs_access_masks[] 155 + * entries when we need to get the absolute handled access masks. 156 + */ 157 + /* clang-format off */ 158 + #define ACCESS_INITIALLY_DENIED ( \ 159 + LANDLOCK_ACCESS_FS_REFER) 160 + /* clang-format on */ 161 + 162 + /* 153 163 * @path: Should have been checked by get_path_from_fd(). 154 164 */ 155 165 int landlock_append_fs_rule(struct landlock_ruleset *const ruleset, ··· 177 167 return -EINVAL; 178 168 179 169 /* Transforms relative access rights to absolute ones. */ 180 - access_rights |= LANDLOCK_MASK_ACCESS_FS & ~ruleset->fs_access_masks[0]; 170 + access_rights |= 171 + LANDLOCK_MASK_ACCESS_FS & 172 + ~(ruleset->fs_access_masks[0] | ACCESS_INITIALLY_DENIED); 181 173 object = get_inode_object(d_backing_inode(path->dentry)); 182 174 if (IS_ERR(object)) 183 175 return PTR_ERR(object); ··· 289 277 static inline access_mask_t 290 278 get_handled_accesses(const struct landlock_ruleset *const domain) 291 279 { 292 - access_mask_t access_dom = 0; 293 - unsigned long access_bit; 280 + access_mask_t access_dom = ACCESS_INITIALLY_DENIED; 281 + size_t layer_level; 294 282 295 - for (access_bit = 0; access_bit < LANDLOCK_NUM_ACCESS_FS; 296 - access_bit++) { 297 - size_t layer_level; 298 - 299 - for (layer_level = 0; layer_level < domain->num_layers; 300 - layer_level++) { 301 - if (domain->fs_access_masks[layer_level] & 302 - BIT_ULL(access_bit)) { 303 - access_dom |= BIT_ULL(access_bit); 304 - break; 305 - } 306 - } 307 - } 308 - return access_dom; 283 + for (layer_level = 0; layer_level < domain->num_layers; layer_level++) 284 + access_dom |= domain->fs_access_masks[layer_level]; 285 + return access_dom & LANDLOCK_MASK_ACCESS_FS; 309 286 } 310 287 311 288 static inline access_mask_t ··· 317 316 318 317 for_each_set_bit(access_bit, &access_req, 319 318 ARRAY_SIZE(*layer_masks)) { 320 - if (domain->fs_access_masks[layer_level] & 321 - BIT_ULL(access_bit)) { 319 + /* 320 + * Artificially handles all initially denied by default 321 + * access rights. 322 + */ 323 + if (BIT_ULL(access_bit) & 324 + (domain->fs_access_masks[layer_level] | 325 + ACCESS_INITIALLY_DENIED)) { 322 326 (*layer_masks)[access_bit] |= 323 327 BIT_ULL(layer_level); 324 328 handled_accesses |= BIT_ULL(access_bit); ··· 862 856 &layer_masks_parent1, NULL, 0, 863 857 NULL, NULL); 864 858 } 865 - 866 - /* Backward compatibility: no reparenting support. */ 867 - if (!(get_handled_accesses(dom) & LANDLOCK_ACCESS_FS_REFER)) 868 - return -EXDEV; 869 859 870 860 access_request_parent1 |= LANDLOCK_ACCESS_FS_REFER; 871 861 access_request_parent2 |= LANDLOCK_ACCESS_FS_REFER;
+2 -2
tools/testing/selftests/kvm/include/x86_64/processor.h
··· 754 754 void (*handler)(struct ex_regs *)); 755 755 756 756 /* If a toddler were to say "abracadabra". */ 757 - #define KVM_EXCEPTION_MAGIC 0xabacadabaull 757 + #define KVM_EXCEPTION_MAGIC 0xabacadabaULL 758 758 759 759 /* 760 760 * KVM selftest exception fixup uses registers to coordinate with the exception ··· 786 786 "lea 1f(%%rip), %%r10\n\t" \ 787 787 "lea 2f(%%rip), %%r11\n\t" \ 788 788 "1: " insn "\n\t" \ 789 - "mov $0, %[vector]\n\t" \ 789 + "movb $0, %[vector]\n\t" \ 790 790 "jmp 3f\n\t" \ 791 791 "2:\n\t" \ 792 792 "mov %%r9b, %[vector]\n\t" \
+145 -10
tools/testing/selftests/landlock/fs_test.c
··· 4 4 * 5 5 * Copyright © 2017-2020 Mickaël Salaün <mic@digikod.net> 6 6 * Copyright © 2020 ANSSI 7 - * Copyright © 2020-2021 Microsoft Corporation 7 + * Copyright © 2020-2022 Microsoft Corporation 8 8 */ 9 9 10 10 #define _GNU_SOURCE ··· 370 370 &path_beneath, 0)); 371 371 ASSERT_EQ(EINVAL, errno); 372 372 path_beneath.allowed_access &= ~LANDLOCK_ACCESS_FS_EXECUTE; 373 + 374 + /* Tests with denied-by-default access right. */ 375 + path_beneath.allowed_access |= LANDLOCK_ACCESS_FS_REFER; 376 + ASSERT_EQ(-1, landlock_add_rule(ruleset_fd, LANDLOCK_RULE_PATH_BENEATH, 377 + &path_beneath, 0)); 378 + ASSERT_EQ(EINVAL, errno); 379 + path_beneath.allowed_access &= ~LANDLOCK_ACCESS_FS_REFER; 373 380 374 381 /* Test with unknown (64-bits) value. */ 375 382 path_beneath.allowed_access |= (1ULL << 60); ··· 1833 1826 ASSERT_EQ(0, link(file1_s1d3, file2_s1d3)); 1834 1827 } 1835 1828 1829 + static int test_rename(const char *const oldpath, const char *const newpath) 1830 + { 1831 + if (rename(oldpath, newpath)) 1832 + return errno; 1833 + return 0; 1834 + } 1835 + 1836 + static int test_exchange(const char *const oldpath, const char *const newpath) 1837 + { 1838 + if (renameat2(AT_FDCWD, oldpath, AT_FDCWD, newpath, RENAME_EXCHANGE)) 1839 + return errno; 1840 + return 0; 1841 + } 1842 + 1836 1843 TEST_F_FORK(layout1, rename_file) 1837 1844 { 1838 1845 const struct rule rules[] = { ··· 1888 1867 * to a different directory (which allows file removal). 1889 1868 */ 1890 1869 ASSERT_EQ(-1, rename(file1_s2d1, file1_s1d3)); 1891 - ASSERT_EQ(EXDEV, errno); 1870 + ASSERT_EQ(EACCES, errno); 1892 1871 ASSERT_EQ(-1, renameat2(AT_FDCWD, file1_s2d1, AT_FDCWD, file1_s1d3, 1893 1872 RENAME_EXCHANGE)); 1894 - ASSERT_EQ(EXDEV, errno); 1873 + ASSERT_EQ(EACCES, errno); 1895 1874 ASSERT_EQ(-1, renameat2(AT_FDCWD, dir_s2d2, AT_FDCWD, file1_s1d3, 1896 1875 RENAME_EXCHANGE)); 1897 1876 ASSERT_EQ(EXDEV, errno); ··· 1915 1894 ASSERT_EQ(EXDEV, errno); 1916 1895 ASSERT_EQ(0, unlink(file1_s1d3)); 1917 1896 ASSERT_EQ(-1, rename(file1_s2d1, file1_s1d3)); 1918 - ASSERT_EQ(EXDEV, errno); 1897 + ASSERT_EQ(EACCES, errno); 1919 1898 1920 1899 /* Exchanges and renames files with same parent. */ 1921 1900 ASSERT_EQ(0, renameat2(AT_FDCWD, file2_s2d3, AT_FDCWD, file1_s2d3, ··· 2033 2012 ASSERT_EQ(0, unlink(file1_s2d3)); 2034 2013 ASSERT_EQ(0, unlink(file2_s2d3)); 2035 2014 ASSERT_EQ(0, rename(dir_s1d3, dir_s2d3)); 2015 + } 2016 + 2017 + /* Checks renames beneath dir_s1d1. */ 2018 + static void refer_denied_by_default(struct __test_metadata *const _metadata, 2019 + const struct rule layer1[], 2020 + const int layer1_err, 2021 + const struct rule layer2[]) 2022 + { 2023 + int ruleset_fd; 2024 + 2025 + ASSERT_EQ(0, unlink(file1_s1d2)); 2026 + 2027 + ruleset_fd = create_ruleset(_metadata, layer1[0].access, layer1); 2028 + ASSERT_LE(0, ruleset_fd); 2029 + enforce_ruleset(_metadata, ruleset_fd); 2030 + ASSERT_EQ(0, close(ruleset_fd)); 2031 + 2032 + /* 2033 + * If the first layer handles LANDLOCK_ACCESS_FS_REFER (according to 2034 + * layer1_err), then it allows some different-parent renames and links. 2035 + */ 2036 + ASSERT_EQ(layer1_err, test_rename(file1_s1d1, file1_s1d2)); 2037 + if (layer1_err == 0) 2038 + ASSERT_EQ(layer1_err, test_rename(file1_s1d2, file1_s1d1)); 2039 + ASSERT_EQ(layer1_err, test_exchange(file2_s1d1, file2_s1d2)); 2040 + ASSERT_EQ(layer1_err, test_exchange(file2_s1d2, file2_s1d1)); 2041 + 2042 + ruleset_fd = create_ruleset(_metadata, layer2[0].access, layer2); 2043 + ASSERT_LE(0, ruleset_fd); 2044 + enforce_ruleset(_metadata, ruleset_fd); 2045 + ASSERT_EQ(0, close(ruleset_fd)); 2046 + 2047 + /* 2048 + * Now, either the first or the second layer does not handle 2049 + * LANDLOCK_ACCESS_FS_REFER, which means that any different-parent 2050 + * renames and links are denied, thus making the layer handling 2051 + * LANDLOCK_ACCESS_FS_REFER null and void. 2052 + */ 2053 + ASSERT_EQ(EXDEV, test_rename(file1_s1d1, file1_s1d2)); 2054 + ASSERT_EQ(EXDEV, test_exchange(file2_s1d1, file2_s1d2)); 2055 + ASSERT_EQ(EXDEV, test_exchange(file2_s1d2, file2_s1d1)); 2056 + } 2057 + 2058 + const struct rule layer_dir_s1d1_refer[] = { 2059 + { 2060 + .path = dir_s1d1, 2061 + .access = LANDLOCK_ACCESS_FS_REFER, 2062 + }, 2063 + {}, 2064 + }; 2065 + 2066 + const struct rule layer_dir_s1d1_execute[] = { 2067 + { 2068 + /* Matches a parent directory. */ 2069 + .path = dir_s1d1, 2070 + .access = LANDLOCK_ACCESS_FS_EXECUTE, 2071 + }, 2072 + {}, 2073 + }; 2074 + 2075 + const struct rule layer_dir_s2d1_execute[] = { 2076 + { 2077 + /* Does not match a parent directory. */ 2078 + .path = dir_s2d1, 2079 + .access = LANDLOCK_ACCESS_FS_EXECUTE, 2080 + }, 2081 + {}, 2082 + }; 2083 + 2084 + /* 2085 + * Tests precedence over renames: denied by default for different parent 2086 + * directories, *with* a rule matching a parent directory, but not directly 2087 + * denying access (with MAKE_REG nor REMOVE). 2088 + */ 2089 + TEST_F_FORK(layout1, refer_denied_by_default1) 2090 + { 2091 + refer_denied_by_default(_metadata, layer_dir_s1d1_refer, 0, 2092 + layer_dir_s1d1_execute); 2093 + } 2094 + 2095 + /* 2096 + * Same test but this time turning around the ABI version order: the first 2097 + * layer does not handle LANDLOCK_ACCESS_FS_REFER. 2098 + */ 2099 + TEST_F_FORK(layout1, refer_denied_by_default2) 2100 + { 2101 + refer_denied_by_default(_metadata, layer_dir_s1d1_execute, EXDEV, 2102 + layer_dir_s1d1_refer); 2103 + } 2104 + 2105 + /* 2106 + * Tests precedence over renames: denied by default for different parent 2107 + * directories, *without* a rule matching a parent directory, but not directly 2108 + * denying access (with MAKE_REG nor REMOVE). 2109 + */ 2110 + TEST_F_FORK(layout1, refer_denied_by_default3) 2111 + { 2112 + refer_denied_by_default(_metadata, layer_dir_s1d1_refer, 0, 2113 + layer_dir_s2d1_execute); 2114 + } 2115 + 2116 + /* 2117 + * Same test but this time turning around the ABI version order: the first 2118 + * layer does not handle LANDLOCK_ACCESS_FS_REFER. 2119 + */ 2120 + TEST_F_FORK(layout1, refer_denied_by_default4) 2121 + { 2122 + refer_denied_by_default(_metadata, layer_dir_s2d1_execute, EXDEV, 2123 + layer_dir_s1d1_refer); 2036 2124 } 2037 2125 2038 2126 TEST_F_FORK(layout1, reparent_link) ··· 2466 2336 ASSERT_EQ(EXDEV, errno); 2467 2337 2468 2338 /* 2469 - * However, moving the file2_s1d3 file below dir_s2d3 is allowed 2470 - * because it cannot inherit MAKE_REG nor MAKE_DIR rights (which are 2471 - * dedicated to directories). 2339 + * Moving the file2_s1d3 file below dir_s2d3 is denied because the 2340 + * second layer does not handle REFER, which is always denied by 2341 + * default. 2472 2342 */ 2473 - ASSERT_EQ(0, rename(file2_s1d3, file1_s2d3)); 2343 + ASSERT_EQ(-1, rename(file2_s1d3, file1_s2d3)); 2344 + ASSERT_EQ(EXDEV, errno); 2474 2345 } 2475 2346 2476 2347 TEST_F_FORK(layout1, reparent_exdev_layers_rename2) ··· 2504 2373 ASSERT_EQ(EACCES, errno); 2505 2374 ASSERT_EQ(-1, rename(file1_s1d1, file1_s2d3)); 2506 2375 ASSERT_EQ(EXDEV, errno); 2507 - /* Modify layout! */ 2508 - ASSERT_EQ(0, rename(file2_s1d2, file1_s2d3)); 2376 + /* 2377 + * Modifying the layout is now denied because the second layer does not 2378 + * handle REFER, which is always denied by default. 2379 + */ 2380 + ASSERT_EQ(-1, rename(file2_s1d2, file1_s2d3)); 2381 + ASSERT_EQ(EXDEV, errno); 2509 2382 2510 2383 /* Without REFER source, EACCES wins over EXDEV. */ 2511 2384 ASSERT_EQ(-1, rename(dir_s1d1, file1_s2d2));
+39 -64
tools/testing/selftests/net/io_uring_zerocopy_tx.c
··· 47 47 MODE_MIXED = 3, 48 48 }; 49 49 50 - static bool cfg_flush = false; 51 50 static bool cfg_cork = false; 52 51 static int cfg_mode = MODE_ZC_FIXED; 53 52 static int cfg_nr_reqs = 8; ··· 162 163 163 164 ret = syscall(__NR_io_uring_register, ring->ring_fd, 164 165 IORING_REGISTER_BUFFERS, iovecs, nr_iovecs); 165 - return (ret < 0) ? -errno : ret; 166 - } 167 - 168 - static int io_uring_register_notifications(struct io_uring *ring, 169 - unsigned nr, 170 - struct io_uring_notification_slot *slots) 171 - { 172 - int ret; 173 - struct io_uring_notification_register r = { 174 - .nr_slots = nr, 175 - .data = (unsigned long)slots, 176 - }; 177 - 178 - ret = syscall(__NR_io_uring_register, ring->ring_fd, 179 - IORING_REGISTER_NOTIFIERS, &r, sizeof(r)); 180 166 return (ret < 0) ? -errno : ret; 181 167 } 182 168 ··· 281 297 282 298 static inline void io_uring_prep_sendzc(struct io_uring_sqe *sqe, int sockfd, 283 299 const void *buf, size_t len, int flags, 284 - unsigned slot_idx, unsigned zc_flags) 300 + unsigned zc_flags) 285 301 { 286 302 io_uring_prep_send(sqe, sockfd, buf, len, flags); 287 - sqe->opcode = (__u8) IORING_OP_SENDZC_NOTIF; 288 - sqe->notification_idx = slot_idx; 303 + sqe->opcode = (__u8) IORING_OP_SEND_ZC; 289 304 sqe->ioprio = zc_flags; 290 305 } 291 306 ··· 357 374 358 375 static void do_tx(int domain, int type, int protocol) 359 376 { 360 - struct io_uring_notification_slot b[1] = {{.tag = NOTIF_TAG}}; 361 377 struct io_uring_sqe *sqe; 362 378 struct io_uring_cqe *cqe; 363 379 unsigned long packets = 0, bytes = 0; ··· 371 389 ret = io_uring_queue_init(512, &ring, 0); 372 390 if (ret) 373 391 error(1, ret, "io_uring: queue init"); 374 - 375 - ret = io_uring_register_notifications(&ring, 1, b); 376 - if (ret) 377 - error(1, ret, "io_uring: tx ctx registration"); 378 392 379 393 iov.iov_base = payload; 380 394 iov.iov_len = cfg_payload_len; ··· 387 409 for (i = 0; i < cfg_nr_reqs; i++) { 388 410 unsigned zc_flags = 0; 389 411 unsigned buf_idx = 0; 390 - unsigned slot_idx = 0; 391 412 unsigned mode = cfg_mode; 392 - unsigned msg_flags = 0; 413 + unsigned msg_flags = MSG_WAITALL; 393 414 394 415 if (cfg_mode == MODE_MIXED) 395 416 mode = rand() % 3; ··· 400 423 cfg_payload_len, msg_flags); 401 424 sqe->user_data = NONZC_TAG; 402 425 } else { 403 - if (cfg_flush) { 404 - zc_flags |= IORING_RECVSEND_NOTIF_FLUSH; 405 - compl_cqes++; 406 - } 426 + compl_cqes++; 407 427 io_uring_prep_sendzc(sqe, fd, payload, 408 428 cfg_payload_len, 409 - msg_flags, slot_idx, zc_flags); 429 + msg_flags, zc_flags); 410 430 if (mode == MODE_ZC_FIXED) { 411 431 sqe->ioprio |= IORING_RECVSEND_FIXED_BUF; 412 432 sqe->buf_index = buf_idx; ··· 416 442 if (ret != cfg_nr_reqs) 417 443 error(1, ret, "submit"); 418 444 445 + if (cfg_cork) 446 + do_setsockopt(fd, IPPROTO_UDP, UDP_CORK, 0); 419 447 for (i = 0; i < cfg_nr_reqs; i++) { 420 448 ret = io_uring_wait_cqe(&ring, &cqe); 421 449 if (ret) 422 450 error(1, ret, "wait cqe"); 423 451 424 - if (cqe->user_data == NOTIF_TAG) { 452 + if (cqe->user_data != NONZC_TAG && 453 + cqe->user_data != ZC_TAG) 454 + error(1, -EINVAL, "invalid cqe->user_data"); 455 + 456 + if (cqe->flags & IORING_CQE_F_NOTIF) { 457 + if (cqe->flags & IORING_CQE_F_MORE) 458 + error(1, -EINVAL, "invalid notif flags"); 425 459 compl_cqes--; 426 460 i--; 427 - } else if (cqe->user_data != NONZC_TAG && 428 - cqe->user_data != ZC_TAG) { 429 - error(1, cqe->res, "invalid user_data"); 430 - } else if (cqe->res <= 0 && cqe->res != -EAGAIN) { 461 + } else if (cqe->res <= 0) { 462 + if (cqe->flags & IORING_CQE_F_MORE) 463 + error(1, cqe->res, "more with a failed send"); 431 464 error(1, cqe->res, "send failed"); 432 465 } else { 433 - if (cqe->res > 0) { 434 - packets++; 435 - bytes += cqe->res; 436 - } 437 - /* failed requests don't flush */ 438 - if (cfg_flush && 439 - cqe->res <= 0 && 440 - cqe->user_data == ZC_TAG) 441 - compl_cqes--; 466 + if (cqe->user_data == ZC_TAG && 467 + !(cqe->flags & IORING_CQE_F_MORE)) 468 + error(1, cqe->res, "missing more flag"); 469 + packets++; 470 + bytes += cqe->res; 442 471 } 443 472 io_uring_cqe_seen(&ring); 444 473 } 445 - if (cfg_cork) 446 - do_setsockopt(fd, IPPROTO_UDP, UDP_CORK, 0); 447 474 } while (gettimeofday_ms() < tstop); 448 475 449 - if (close(fd)) 450 - error(1, errno, "close"); 476 + while (compl_cqes) { 477 + ret = io_uring_wait_cqe(&ring, &cqe); 478 + if (ret) 479 + error(1, ret, "wait cqe"); 480 + if (cqe->flags & IORING_CQE_F_MORE) 481 + error(1, -EINVAL, "invalid notif flags"); 482 + if (!(cqe->flags & IORING_CQE_F_NOTIF)) 483 + error(1, -EINVAL, "missing notif flag"); 484 + 485 + io_uring_cqe_seen(&ring); 486 + compl_cqes--; 487 + } 451 488 452 489 fprintf(stderr, "tx=%lu (MB=%lu), tx/s=%lu (MB/s=%lu)\n", 453 490 packets, bytes >> 20, 454 491 packets / (cfg_runtime_ms / 1000), 455 492 (bytes >> 20) / (cfg_runtime_ms / 1000)); 456 493 457 - while (compl_cqes) { 458 - ret = io_uring_wait_cqe(&ring, &cqe); 459 - if (ret) 460 - error(1, ret, "wait cqe"); 461 - io_uring_cqe_seen(&ring); 462 - compl_cqes--; 463 - } 494 + if (close(fd)) 495 + error(1, errno, "close"); 464 496 } 465 497 466 498 static void do_test(int domain, int type, int protocol) ··· 480 500 481 501 static void usage(const char *filepath) 482 502 { 483 - error(1, 0, "Usage: %s [-f] [-n<N>] [-z0] [-s<payload size>] " 484 - "(-4|-6) [-t<time s>] -D<dst_ip> udp", filepath); 503 + error(1, 0, "Usage: %s (-4|-6) (udp|tcp) -D<dst_ip> [-s<payload size>] " 504 + "[-t<time s>] [-n<batch>] [-p<port>] [-m<mode>]", filepath); 485 505 } 486 506 487 507 static void parse_opts(int argc, char **argv) ··· 499 519 usage(argv[0]); 500 520 cfg_payload_len = max_payload_len; 501 521 502 - while ((c = getopt(argc, argv, "46D:p:s:t:n:fc:m:")) != -1) { 522 + while ((c = getopt(argc, argv, "46D:p:s:t:n:c:m:")) != -1) { 503 523 switch (c) { 504 524 case '4': 505 525 if (cfg_family != PF_UNSPEC) ··· 527 547 break; 528 548 case 'n': 529 549 cfg_nr_reqs = strtoul(optarg, NULL, 0); 530 - break; 531 - case 'f': 532 - cfg_flush = 1; 533 550 break; 534 551 case 'c': 535 552 cfg_cork = strtol(optarg, NULL, 0); ··· 560 583 561 584 if (cfg_payload_len > max_payload_len) 562 585 error(1, 0, "-s: payload exceeds max (%d)", max_payload_len); 563 - if (cfg_mode == MODE_NONZC && cfg_flush) 564 - error(1, 0, "-f: only zerocopy modes support notifications"); 565 586 if (optind != argc - 1) 566 587 usage(argv[0]); 567 588 }
+3 -7
tools/testing/selftests/net/io_uring_zerocopy_tx.sh
··· 25 25 # No arguments: automated test 26 26 if [[ "$#" -eq "0" ]]; then 27 27 IPs=( "4" "6" ) 28 - protocols=( "tcp" "udp" ) 29 28 30 29 for IP in "${IPs[@]}"; do 31 - for proto in "${protocols[@]}"; do 32 - for mode in $(seq 1 3); do 33 - $0 "$IP" "$proto" -m "$mode" -t 1 -n 32 34 - $0 "$IP" "$proto" -m "$mode" -t 1 -n 32 -f 35 - $0 "$IP" "$proto" -m "$mode" -t 1 -n 32 -c -f 36 - done 30 + for mode in $(seq 1 3); do 31 + $0 "$IP" udp -m "$mode" -t 1 -n 32 32 + $0 "$IP" tcp -m "$mode" -t 1 -n 32 37 33 done 38 34 done 39 35
+26 -10
tools/testing/selftests/netfilter/nft_conntrack_helper.sh
··· 102 102 103 103 ip netns exec ${netns} conntrack -L -f $family -p tcp --dport $port 2> /dev/null |grep -q 'helper=ftp' 104 104 if [ $? -ne 0 ] ; then 105 - echo "FAIL: ${netns} did not show attached helper $message" 1>&2 106 - ret=1 105 + if [ $autoassign -eq 0 ] ;then 106 + echo "FAIL: ${netns} did not show attached helper $message" 1>&2 107 + ret=1 108 + else 109 + echo "PASS: ${netns} did not show attached helper $message" 1>&2 110 + fi 111 + else 112 + if [ $autoassign -eq 0 ] ;then 113 + echo "PASS: ${netns} connection on port $port has ftp helper attached" 1>&2 114 + else 115 + echo "FAIL: ${netns} connection on port $port has ftp helper attached" 1>&2 116 + ret=1 117 + fi 107 118 fi 108 119 109 - echo "PASS: ${netns} connection on port $port has ftp helper attached" 1>&2 110 120 return 0 111 121 } 112 122 113 123 test_helper() 114 124 { 115 125 local port=$1 116 - local msg=$2 126 + local autoassign=$2 127 + 128 + if [ $autoassign -eq 0 ] ;then 129 + msg="set via ruleset" 130 + else 131 + msg="auto-assign" 132 + fi 117 133 118 134 sleep 3 | ip netns exec ${ns2} nc -w 2 -l -p $port > /dev/null & 119 135 120 136 sleep 1 | ip netns exec ${ns1} nc -w 2 10.0.1.2 $port > /dev/null & 121 137 sleep 1 122 138 123 - check_for_helper "$ns1" "ip $msg" $port 124 - check_for_helper "$ns2" "ip $msg" $port 139 + check_for_helper "$ns1" "ip $msg" $port $autoassign 140 + check_for_helper "$ns2" "ip $msg" $port $autoassign 125 141 126 142 wait 127 143 ··· 189 173 fi 190 174 fi 191 175 192 - test_helper 2121 "set via ruleset" 193 - ip netns exec ${ns1} sysctl -q 'net.netfilter.nf_conntrack_helper=1' 194 - ip netns exec ${ns2} sysctl -q 'net.netfilter.nf_conntrack_helper=1' 195 - test_helper 21 "auto-assign" 176 + test_helper 2121 0 177 + ip netns exec ${ns1} sysctl -qe 'net.netfilter.nf_conntrack_helper=1' 178 + ip netns exec ${ns2} sysctl -qe 'net.netfilter.nf_conntrack_helper=1' 179 + test_helper 21 1 196 180 197 181 exit $ret