diff options
374 files changed, 4052 insertions, 2241 deletions
diff --git a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.txt b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.txt index 8ff65fa632fd..c06c045126fc 100644 --- a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.txt +++ b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.txt | |||
| @@ -21,7 +21,7 @@ Required properties: | |||
| 21 | - interrupts : identifier to the device interrupt | 21 | - interrupts : identifier to the device interrupt |
| 22 | - clocks : a list of phandle + clock-specifier pairs, one for each | 22 | - clocks : a list of phandle + clock-specifier pairs, one for each |
| 23 | entry in clock names. | 23 | entry in clock names. |
| 24 | - clocks-names : | 24 | - clock-names : |
| 25 | * "xtal" for external xtal clock identifier | 25 | * "xtal" for external xtal clock identifier |
| 26 | * "pclk" for the bus core clock, either the clk81 clock or the gate clock | 26 | * "pclk" for the bus core clock, either the clk81 clock or the gate clock |
| 27 | * "baud" for the source of the baudrate generator, can be either the xtal | 27 | * "baud" for the source of the baudrate generator, can be either the xtal |
diff --git a/Documentation/devicetree/bindings/serial/mvebu-uart.txt b/Documentation/devicetree/bindings/serial/mvebu-uart.txt index 2ae2fee7e023..b7e0e32b9ac6 100644 --- a/Documentation/devicetree/bindings/serial/mvebu-uart.txt +++ b/Documentation/devicetree/bindings/serial/mvebu-uart.txt | |||
| @@ -24,7 +24,7 @@ Required properties: | |||
| 24 | - Must contain two elements for the extended variant of the IP | 24 | - Must contain two elements for the extended variant of the IP |
| 25 | (marvell,armada-3700-uart-ext): "uart-tx" and "uart-rx", | 25 | (marvell,armada-3700-uart-ext): "uart-tx" and "uart-rx", |
| 26 | respectively the UART TX interrupt and the UART RX interrupt. A | 26 | respectively the UART TX interrupt and the UART RX interrupt. A |
| 27 | corresponding interrupts-names property must be defined. | 27 | corresponding interrupt-names property must be defined. |
| 28 | - For backward compatibility reasons, a single element interrupts | 28 | - For backward compatibility reasons, a single element interrupts |
| 29 | property is also supported for the standard variant of the IP, | 29 | property is also supported for the standard variant of the IP, |
| 30 | containing only the UART sum interrupt. This form is deprecated | 30 | containing only the UART sum interrupt. This form is deprecated |
diff --git a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt index ad962f4ec3aa..a006ea4d065f 100644 --- a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt +++ b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt | |||
| @@ -17,6 +17,8 @@ Required properties: | |||
| 17 | - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible UART. | 17 | - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible UART. |
| 18 | - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible UART. | 18 | - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible UART. |
| 19 | - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART. | 19 | - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART. |
| 20 | - "renesas,scif-r8a77470" for R8A77470 (RZ/G1C) SCIF compatible UART. | ||
| 21 | - "renesas,hscif-r8a77470" for R8A77470 (RZ/G1C) HSCIF compatible UART. | ||
| 20 | - "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART. | 22 | - "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART. |
| 21 | - "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART. | 23 | - "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART. |
| 22 | - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART. | 24 | - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART. |
diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt index c4c00dff4b56..bd1dd316fb23 100644 --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt | |||
| @@ -28,7 +28,10 @@ Required properties: | |||
| 28 | - interrupts: one XHCI interrupt should be described here. | 28 | - interrupts: one XHCI interrupt should be described here. |
| 29 | 29 | ||
| 30 | Optional properties: | 30 | Optional properties: |
| 31 | - clocks: reference to a clock | 31 | - clocks: reference to the clocks |
| 32 | - clock-names: mandatory if there is a second clock, in this case | ||
| 33 | the name must be "core" for the first clock and "reg" for the | ||
| 34 | second one | ||
| 32 | - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM | 35 | - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM |
| 33 | - usb3-lpm-capable: determines if platform is USB3 LPM capable | 36 | - usb3-lpm-capable: determines if platform is USB3 LPM capable |
| 34 | - quirk-broken-port-ped: set if the controller has broken port disable mechanism | 37 | - quirk-broken-port-ped: set if the controller has broken port disable mechanism |
diff --git a/Documentation/driver-api/firmware/request_firmware.rst b/Documentation/driver-api/firmware/request_firmware.rst index cf4516dfbf96..d5ec95a7195b 100644 --- a/Documentation/driver-api/firmware/request_firmware.rst +++ b/Documentation/driver-api/firmware/request_firmware.rst | |||
| @@ -17,17 +17,17 @@ an error is returned. | |||
| 17 | 17 | ||
| 18 | request_firmware | 18 | request_firmware |
| 19 | ---------------- | 19 | ---------------- |
| 20 | .. kernel-doc:: drivers/base/firmware_class.c | 20 | .. kernel-doc:: drivers/base/firmware_loader/main.c |
| 21 | :functions: request_firmware | 21 | :functions: request_firmware |
| 22 | 22 | ||
| 23 | request_firmware_direct | 23 | request_firmware_direct |
| 24 | ----------------------- | 24 | ----------------------- |
| 25 | .. kernel-doc:: drivers/base/firmware_class.c | 25 | .. kernel-doc:: drivers/base/firmware_loader/main.c |
| 26 | :functions: request_firmware_direct | 26 | :functions: request_firmware_direct |
| 27 | 27 | ||
| 28 | request_firmware_into_buf | 28 | request_firmware_into_buf |
| 29 | ------------------------- | 29 | ------------------------- |
| 30 | .. kernel-doc:: drivers/base/firmware_class.c | 30 | .. kernel-doc:: drivers/base/firmware_loader/main.c |
| 31 | :functions: request_firmware_into_buf | 31 | :functions: request_firmware_into_buf |
| 32 | 32 | ||
| 33 | Asynchronous firmware requests | 33 | Asynchronous firmware requests |
| @@ -41,7 +41,7 @@ in atomic contexts. | |||
| 41 | 41 | ||
| 42 | request_firmware_nowait | 42 | request_firmware_nowait |
| 43 | ----------------------- | 43 | ----------------------- |
| 44 | .. kernel-doc:: drivers/base/firmware_class.c | 44 | .. kernel-doc:: drivers/base/firmware_loader/main.c |
| 45 | :functions: request_firmware_nowait | 45 | :functions: request_firmware_nowait |
| 46 | 46 | ||
| 47 | Special optimizations on reboot | 47 | Special optimizations on reboot |
| @@ -50,12 +50,12 @@ Special optimizations on reboot | |||
| 50 | Some devices have an optimization in place to enable the firmware to be | 50 | Some devices have an optimization in place to enable the firmware to be |
| 51 | retained during system reboot. When such optimizations are used the driver | 51 | retained during system reboot. When such optimizations are used the driver |
| 52 | author must ensure the firmware is still available on resume from suspend, | 52 | author must ensure the firmware is still available on resume from suspend, |
| 53 | this can be done with firmware_request_cache() insted of requesting for the | 53 | this can be done with firmware_request_cache() instead of requesting for the |
| 54 | firmare to be loaded. | 54 | firmware to be loaded. |
| 55 | 55 | ||
| 56 | firmware_request_cache() | 56 | firmware_request_cache() |
| 57 | ----------------------- | 57 | ------------------------ |
| 58 | .. kernel-doc:: drivers/base/firmware_class.c | 58 | .. kernel-doc:: drivers/base/firmware_loader/main.c |
| 59 | :functions: firmware_request_cache | 59 | :functions: firmware_request_cache |
| 60 | 60 | ||
| 61 | request firmware API expected driver use | 61 | request firmware API expected driver use |
diff --git a/Documentation/driver-api/infrastructure.rst b/Documentation/driver-api/infrastructure.rst index 6d9ff316b608..bee1b9a1702f 100644 --- a/Documentation/driver-api/infrastructure.rst +++ b/Documentation/driver-api/infrastructure.rst | |||
| @@ -28,7 +28,7 @@ Device Drivers Base | |||
| 28 | .. kernel-doc:: drivers/base/node.c | 28 | .. kernel-doc:: drivers/base/node.c |
| 29 | :internal: | 29 | :internal: |
| 30 | 30 | ||
| 31 | .. kernel-doc:: drivers/base/firmware_class.c | 31 | .. kernel-doc:: drivers/base/firmware_loader/main.c |
| 32 | :export: | 32 | :export: |
| 33 | 33 | ||
| 34 | .. kernel-doc:: drivers/base/transport_class.c | 34 | .. kernel-doc:: drivers/base/transport_class.c |
diff --git a/Documentation/driver-api/usb/typec.rst b/Documentation/driver-api/usb/typec.rst index feb31946490b..48ff58095f11 100644 --- a/Documentation/driver-api/usb/typec.rst +++ b/Documentation/driver-api/usb/typec.rst | |||
| @@ -210,7 +210,7 @@ If the connector is dual-role capable, there may also be a switch for the data | |||
| 210 | role. USB Type-C Connector Class does not supply separate API for them. The | 210 | role. USB Type-C Connector Class does not supply separate API for them. The |
| 211 | port drivers can use USB Role Class API with those. | 211 | port drivers can use USB Role Class API with those. |
| 212 | 212 | ||
| 213 | Illustration of the muxes behind a connector that supports an alternate mode: | 213 | Illustration of the muxes behind a connector that supports an alternate mode:: |
| 214 | 214 | ||
| 215 | ------------------------ | 215 | ------------------------ |
| 216 | | Connector | | 216 | | Connector | |
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface index d04e6e4964ee..fbed645ccd75 100644 --- a/Documentation/i2c/dev-interface +++ b/Documentation/i2c/dev-interface | |||
| @@ -9,8 +9,8 @@ i2c adapters present on your system at a given time. i2cdetect is part of | |||
| 9 | the i2c-tools package. | 9 | the i2c-tools package. |
| 10 | 10 | ||
| 11 | I2C device files are character device files with major device number 89 | 11 | I2C device files are character device files with major device number 89 |
| 12 | and a minor device number corresponding to the number assigned as | 12 | and a minor device number corresponding to the number assigned as |
| 13 | explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ..., | 13 | explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ..., |
| 14 | i2c-10, ...). All 256 minor device numbers are reserved for i2c. | 14 | i2c-10, ...). All 256 minor device numbers are reserved for i2c. |
| 15 | 15 | ||
| 16 | 16 | ||
| @@ -23,11 +23,6 @@ First, you need to include these two headers: | |||
| 23 | #include <linux/i2c-dev.h> | 23 | #include <linux/i2c-dev.h> |
| 24 | #include <i2c/smbus.h> | 24 | #include <i2c/smbus.h> |
| 25 | 25 | ||
| 26 | (Please note that there are two files named "i2c-dev.h" out there. One is | ||
| 27 | distributed with the Linux kernel and the other one is included in the | ||
| 28 | source tree of i2c-tools. They used to be different in content but since 2012 | ||
| 29 | they're identical. You should use "linux/i2c-dev.h"). | ||
| 30 | |||
| 31 | Now, you have to decide which adapter you want to access. You should | 26 | Now, you have to decide which adapter you want to access. You should |
| 32 | inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this. | 27 | inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this. |
| 33 | Adapter numbers are assigned somewhat dynamically, so you can not | 28 | Adapter numbers are assigned somewhat dynamically, so you can not |
| @@ -38,7 +33,7 @@ Next thing, open the device file, as follows: | |||
| 38 | int file; | 33 | int file; |
| 39 | int adapter_nr = 2; /* probably dynamically determined */ | 34 | int adapter_nr = 2; /* probably dynamically determined */ |
| 40 | char filename[20]; | 35 | char filename[20]; |
| 41 | 36 | ||
| 42 | snprintf(filename, 19, "/dev/i2c-%d", adapter_nr); | 37 | snprintf(filename, 19, "/dev/i2c-%d", adapter_nr); |
| 43 | file = open(filename, O_RDWR); | 38 | file = open(filename, O_RDWR); |
| 44 | if (file < 0) { | 39 | if (file < 0) { |
| @@ -72,8 +67,10 @@ the device supports them. Both are illustrated below. | |||
| 72 | /* res contains the read word */ | 67 | /* res contains the read word */ |
| 73 | } | 68 | } |
| 74 | 69 | ||
| 75 | /* Using I2C Write, equivalent of | 70 | /* |
| 76 | i2c_smbus_write_word_data(file, reg, 0x6543) */ | 71 | * Using I2C Write, equivalent of |
| 72 | * i2c_smbus_write_word_data(file, reg, 0x6543) | ||
| 73 | */ | ||
| 77 | buf[0] = reg; | 74 | buf[0] = reg; |
| 78 | buf[1] = 0x43; | 75 | buf[1] = 0x43; |
| 79 | buf[2] = 0x65; | 76 | buf[2] = 0x65; |
| @@ -140,14 +137,14 @@ ioctl(file, I2C_RDWR, struct i2c_rdwr_ioctl_data *msgset) | |||
| 140 | set in each message, overriding the values set with the above ioctl's. | 137 | set in each message, overriding the values set with the above ioctl's. |
| 141 | 138 | ||
| 142 | ioctl(file, I2C_SMBUS, struct i2c_smbus_ioctl_data *args) | 139 | ioctl(file, I2C_SMBUS, struct i2c_smbus_ioctl_data *args) |
| 143 | Not meant to be called directly; instead, use the access functions | 140 | If possible, use the provided i2c_smbus_* methods described below instead |
| 144 | below. | 141 | of issuing direct ioctls. |
| 145 | 142 | ||
| 146 | You can do plain i2c transactions by using read(2) and write(2) calls. | 143 | You can do plain i2c transactions by using read(2) and write(2) calls. |
| 147 | You do not need to pass the address byte; instead, set it through | 144 | You do not need to pass the address byte; instead, set it through |
| 148 | ioctl I2C_SLAVE before you try to access the device. | 145 | ioctl I2C_SLAVE before you try to access the device. |
| 149 | 146 | ||
| 150 | You can do SMBus level transactions (see documentation file smbus-protocol | 147 | You can do SMBus level transactions (see documentation file smbus-protocol |
| 151 | for details) through the following functions: | 148 | for details) through the following functions: |
| 152 | __s32 i2c_smbus_write_quick(int file, __u8 value); | 149 | __s32 i2c_smbus_write_quick(int file, __u8 value); |
| 153 | __s32 i2c_smbus_read_byte(int file); | 150 | __s32 i2c_smbus_read_byte(int file); |
| @@ -158,7 +155,7 @@ for details) through the following functions: | |||
| 158 | __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value); | 155 | __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value); |
| 159 | __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value); | 156 | __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value); |
| 160 | __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values); | 157 | __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values); |
| 161 | __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length, | 158 | __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length, |
| 162 | __u8 *values); | 159 | __u8 *values); |
| 163 | All these transactions return -1 on failure; you can read errno to see | 160 | All these transactions return -1 on failure; you can read errno to see |
| 164 | what happened. The 'write' transactions return 0 on success; the | 161 | what happened. The 'write' transactions return 0 on success; the |
| @@ -166,10 +163,9 @@ what happened. The 'write' transactions return 0 on success; the | |||
| 166 | returns the number of values read. The block buffers need not be longer | 163 | returns the number of values read. The block buffers need not be longer |
| 167 | than 32 bytes. | 164 | than 32 bytes. |
| 168 | 165 | ||
| 169 | The above functions are all inline functions, that resolve to calls to | 166 | The above functions are made available by linking against the libi2c library, |
| 170 | the i2c_smbus_access function, that on its turn calls a specific ioctl | 167 | which is provided by the i2c-tools project. See: |
| 171 | with the data in a specific format. Read the source code if you | 168 | https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git/. |
| 172 | want to know what happens behind the screens. | ||
| 173 | 169 | ||
| 174 | 170 | ||
| 175 | Implementation details | 171 | Implementation details |
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt index 84bb74dcae12..7f7413e597f3 100644 --- a/Documentation/ioctl/ioctl-number.txt +++ b/Documentation/ioctl/ioctl-number.txt | |||
| @@ -217,7 +217,6 @@ Code Seq#(hex) Include File Comments | |||
| 217 | 'd' 02-40 pcmcia/ds.h conflict! | 217 | 'd' 02-40 pcmcia/ds.h conflict! |
| 218 | 'd' F0-FF linux/digi1.h | 218 | 'd' F0-FF linux/digi1.h |
| 219 | 'e' all linux/digi1.h conflict! | 219 | 'e' all linux/digi1.h conflict! |
| 220 | 'e' 00-1F drivers/net/irda/irtty-sir.h conflict! | ||
| 221 | 'f' 00-1F linux/ext2_fs.h conflict! | 220 | 'f' 00-1F linux/ext2_fs.h conflict! |
| 222 | 'f' 00-1F linux/ext3_fs.h conflict! | 221 | 'f' 00-1F linux/ext3_fs.h conflict! |
| 223 | 'f' 00-0F fs/jfs/jfs_dinode.h conflict! | 222 | 'f' 00-0F fs/jfs/jfs_dinode.h conflict! |
| @@ -247,7 +246,6 @@ Code Seq#(hex) Include File Comments | |||
| 247 | 'm' all linux/synclink.h conflict! | 246 | 'm' all linux/synclink.h conflict! |
| 248 | 'm' 00-19 drivers/message/fusion/mptctl.h conflict! | 247 | 'm' 00-19 drivers/message/fusion/mptctl.h conflict! |
| 249 | 'm' 00 drivers/scsi/megaraid/megaraid_ioctl.h conflict! | 248 | 'm' 00 drivers/scsi/megaraid/megaraid_ioctl.h conflict! |
| 250 | 'm' 00-1F net/irda/irmod.h conflict! | ||
| 251 | 'n' 00-7F linux/ncp_fs.h and fs/ncpfs/ioctl.c | 249 | 'n' 00-7F linux/ncp_fs.h and fs/ncpfs/ioctl.c |
| 252 | 'n' 80-8F uapi/linux/nilfs2_api.h NILFS2 | 250 | 'n' 80-8F uapi/linux/nilfs2_api.h NILFS2 |
| 253 | 'n' E0-FF linux/matroxfb.h matroxfb | 251 | 'n' E0-FF linux/matroxfb.h matroxfb |
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index b583a73cf95f..35ffaa281b26 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
| @@ -2126,18 +2126,3 @@ max_dgram_qlen - INTEGER | |||
| 2126 | 2126 | ||
| 2127 | Default: 10 | 2127 | Default: 10 |
| 2128 | 2128 | ||
| 2129 | |||
| 2130 | UNDOCUMENTED: | ||
| 2131 | |||
| 2132 | /proc/sys/net/irda/* | ||
| 2133 | fast_poll_increase FIXME | ||
| 2134 | warn_noreply_time FIXME | ||
| 2135 | discovery_slots FIXME | ||
| 2136 | slot_timeout FIXME | ||
| 2137 | max_baud_rate FIXME | ||
| 2138 | discovery_timeout FIXME | ||
| 2139 | lap_keepalive_time FIXME | ||
| 2140 | max_noreply_time FIXME | ||
| 2141 | max_tx_data_size FIXME | ||
| 2142 | max_tx_window FIXME | ||
| 2143 | min_tx_turn_time FIXME | ||
diff --git a/Documentation/power/suspend-and-cpuhotplug.txt b/Documentation/power/suspend-and-cpuhotplug.txt index 31abd04b9572..6f55eb960a6d 100644 --- a/Documentation/power/suspend-and-cpuhotplug.txt +++ b/Documentation/power/suspend-and-cpuhotplug.txt | |||
| @@ -168,7 +168,7 @@ update on the CPUs, as discussed below: | |||
| 168 | 168 | ||
| 169 | [Please bear in mind that the kernel requests the microcode images from | 169 | [Please bear in mind that the kernel requests the microcode images from |
| 170 | userspace, using the request_firmware() function defined in | 170 | userspace, using the request_firmware() function defined in |
| 171 | drivers/base/firmware_class.c] | 171 | drivers/base/firmware_loader/main.c] |
| 172 | 172 | ||
| 173 | 173 | ||
| 174 | a. When all the CPUs are identical: | 174 | a. When all the CPUs are identical: |
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst index 00cecf1fcba9..633be1043690 100644 --- a/Documentation/process/magic-number.rst +++ b/Documentation/process/magic-number.rst | |||
| @@ -157,8 +157,5 @@ memory management. See ``include/sound/sndmagic.h`` for complete list of them. M | |||
| 157 | OSS sound drivers have their magic numbers constructed from the soundcard PCI | 157 | OSS sound drivers have their magic numbers constructed from the soundcard PCI |
| 158 | ID - these are not listed here as well. | 158 | ID - these are not listed here as well. |
| 159 | 159 | ||
| 160 | IrDA subsystem also uses large number of own magic numbers, see | ||
| 161 | ``include/net/irda/irda.h`` for a complete list of them. | ||
| 162 | |||
| 163 | HFS is another larger user of magic numbers - you can find them in | 160 | HFS is another larger user of magic numbers - you can find them in |
| 164 | ``fs/hfs/hfs.h``. | 161 | ``fs/hfs/hfs.h``. |
diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst index e45f0786f3f9..67d9c38e95eb 100644 --- a/Documentation/trace/ftrace.rst +++ b/Documentation/trace/ftrace.rst | |||
| @@ -461,9 +461,17 @@ of ftrace. Here is a list of some of the key files: | |||
| 461 | and ticks at the same rate as the hardware clocksource. | 461 | and ticks at the same rate as the hardware clocksource. |
| 462 | 462 | ||
| 463 | boot: | 463 | boot: |
| 464 | Same as mono. Used to be a separate clock which accounted | 464 | This is the boot clock (CLOCK_BOOTTIME) and is based on the |
| 465 | for the time spent in suspend while CLOCK_MONOTONIC did | 465 | fast monotonic clock, but also accounts for time spent in |
| 466 | not. | 466 | suspend. Since the clock access is designed for use in |
| 467 | tracing in the suspend path, some side effects are possible | ||
| 468 | if clock is accessed after the suspend time is accounted before | ||
| 469 | the fast mono clock is updated. In this case, the clock update | ||
| 470 | appears to happen slightly sooner than it normally would have. | ||
| 471 | Also on 32-bit systems, it's possible that the 64-bit boot offset | ||
| 472 | sees a partial update. These effects are rare and post | ||
| 473 | processing should be able to handle them. See comments in the | ||
| 474 | ktime_get_boot_fast_ns() function for more information. | ||
| 467 | 475 | ||
| 468 | To set a clock, simply echo the clock name into this file:: | 476 | To set a clock, simply echo the clock name into this file:: |
| 469 | 477 | ||
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 1c7958b57fe9..758bf403a169 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
| @@ -1960,6 +1960,9 @@ ARM 32-bit VFP control registers have the following id bit patterns: | |||
| 1960 | ARM 64-bit FP registers have the following id bit patterns: | 1960 | ARM 64-bit FP registers have the following id bit patterns: |
| 1961 | 0x4030 0000 0012 0 <regno:12> | 1961 | 0x4030 0000 0012 0 <regno:12> |
| 1962 | 1962 | ||
| 1963 | ARM firmware pseudo-registers have the following bit pattern: | ||
| 1964 | 0x4030 0000 0014 <regno:16> | ||
| 1965 | |||
| 1963 | 1966 | ||
| 1964 | arm64 registers are mapped using the lower 32 bits. The upper 16 of | 1967 | arm64 registers are mapped using the lower 32 bits. The upper 16 of |
| 1965 | that is the register group type, or coprocessor number: | 1968 | that is the register group type, or coprocessor number: |
| @@ -1976,6 +1979,9 @@ arm64 CCSIDR registers are demultiplexed by CSSELR value: | |||
| 1976 | arm64 system registers have the following id bit patterns: | 1979 | arm64 system registers have the following id bit patterns: |
| 1977 | 0x6030 0000 0013 <op0:2> <op1:3> <crn:4> <crm:4> <op2:3> | 1980 | 0x6030 0000 0013 <op0:2> <op1:3> <crn:4> <crm:4> <op2:3> |
| 1978 | 1981 | ||
| 1982 | arm64 firmware pseudo-registers have the following bit pattern: | ||
| 1983 | 0x6030 0000 0014 <regno:16> | ||
| 1984 | |||
| 1979 | 1985 | ||
| 1980 | MIPS registers are mapped using the lower 32 bits. The upper 16 of that is | 1986 | MIPS registers are mapped using the lower 32 bits. The upper 16 of that is |
| 1981 | the register group type: | 1987 | the register group type: |
| @@ -2510,7 +2516,8 @@ Possible features: | |||
| 2510 | and execute guest code when KVM_RUN is called. | 2516 | and execute guest code when KVM_RUN is called. |
| 2511 | - KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode. | 2517 | - KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode. |
| 2512 | Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only). | 2518 | Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only). |
| 2513 | - KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 for the CPU. | 2519 | - KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 (or a future revision |
| 2520 | backward compatible with v0.2) for the CPU. | ||
| 2514 | Depends on KVM_CAP_ARM_PSCI_0_2. | 2521 | Depends on KVM_CAP_ARM_PSCI_0_2. |
| 2515 | - KVM_ARM_VCPU_PMU_V3: Emulate PMUv3 for the CPU. | 2522 | - KVM_ARM_VCPU_PMU_V3: Emulate PMUv3 for the CPU. |
| 2516 | Depends on KVM_CAP_ARM_PMU_V3. | 2523 | Depends on KVM_CAP_ARM_PMU_V3. |
diff --git a/Documentation/virtual/kvm/arm/psci.txt b/Documentation/virtual/kvm/arm/psci.txt new file mode 100644 index 000000000000..aafdab887b04 --- /dev/null +++ b/Documentation/virtual/kvm/arm/psci.txt | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | KVM implements the PSCI (Power State Coordination Interface) | ||
| 2 | specification in order to provide services such as CPU on/off, reset | ||
| 3 | and power-off to the guest. | ||
| 4 | |||
| 5 | The PSCI specification is regularly updated to provide new features, | ||
| 6 | and KVM implements these updates if they make sense from a virtualization | ||
| 7 | point of view. | ||
| 8 | |||
| 9 | This means that a guest booted on two different versions of KVM can | ||
| 10 | observe two different "firmware" revisions. This could cause issues if | ||
| 11 | a given guest is tied to a particular PSCI revision (unlikely), or if | ||
| 12 | a migration causes a different PSCI version to be exposed out of the | ||
| 13 | blue to an unsuspecting guest. | ||
| 14 | |||
| 15 | In order to remedy this situation, KVM exposes a set of "firmware | ||
| 16 | pseudo-registers" that can be manipulated using the GET/SET_ONE_REG | ||
| 17 | interface. These registers can be saved/restored by userspace, and set | ||
| 18 | to a convenient value if required. | ||
| 19 | |||
| 20 | The following register is defined: | ||
| 21 | |||
| 22 | * KVM_REG_ARM_PSCI_VERSION: | ||
| 23 | |||
| 24 | - Only valid if the vcpu has the KVM_ARM_VCPU_PSCI_0_2 feature set | ||
| 25 | (and thus has already been initialized) | ||
| 26 | - Returns the current PSCI version on GET_ONE_REG (defaulting to the | ||
| 27 | highest PSCI version implemented by KVM and compatible with v0.2) | ||
| 28 | - Allows any PSCI version implemented by KVM and compatible with | ||
| 29 | v0.2 to be set with SET_ONE_REG | ||
| 30 | - Affects the whole VM (even if the register view is per-vcpu) | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 92be777d060a..79bb02ff812f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -564,8 +564,9 @@ S: Maintained | |||
| 564 | F: drivers/media/dvb-frontends/af9033* | 564 | F: drivers/media/dvb-frontends/af9033* |
| 565 | 565 | ||
| 566 | AFFS FILE SYSTEM | 566 | AFFS FILE SYSTEM |
| 567 | M: David Sterba <dsterba@suse.com> | ||
| 567 | L: linux-fsdevel@vger.kernel.org | 568 | L: linux-fsdevel@vger.kernel.org |
| 568 | S: Orphan | 569 | S: Odd Fixes |
| 569 | F: Documentation/filesystems/affs.txt | 570 | F: Documentation/filesystems/affs.txt |
| 570 | F: fs/affs/ | 571 | F: fs/affs/ |
| 571 | 572 | ||
| @@ -905,6 +906,8 @@ ANDROID ION DRIVER | |||
| 905 | M: Laura Abbott <labbott@redhat.com> | 906 | M: Laura Abbott <labbott@redhat.com> |
| 906 | M: Sumit Semwal <sumit.semwal@linaro.org> | 907 | M: Sumit Semwal <sumit.semwal@linaro.org> |
| 907 | L: devel@driverdev.osuosl.org | 908 | L: devel@driverdev.osuosl.org |
| 909 | L: dri-devel@lists.freedesktop.org | ||
| 910 | L: linaro-mm-sig@lists.linaro.org (moderated for non-subscribers) | ||
| 908 | S: Supported | 911 | S: Supported |
| 909 | F: drivers/staging/android/ion | 912 | F: drivers/staging/android/ion |
| 910 | F: drivers/staging/android/uapi/ion.h | 913 | F: drivers/staging/android/uapi/ion.h |
| @@ -1208,7 +1211,6 @@ F: drivers/*/*alpine* | |||
| 1208 | ARM/ARTPEC MACHINE SUPPORT | 1211 | ARM/ARTPEC MACHINE SUPPORT |
| 1209 | M: Jesper Nilsson <jesper.nilsson@axis.com> | 1212 | M: Jesper Nilsson <jesper.nilsson@axis.com> |
| 1210 | M: Lars Persson <lars.persson@axis.com> | 1213 | M: Lars Persson <lars.persson@axis.com> |
| 1211 | M: Niklas Cassel <niklas.cassel@axis.com> | ||
| 1212 | S: Maintained | 1214 | S: Maintained |
| 1213 | L: linux-arm-kernel@axis.com | 1215 | L: linux-arm-kernel@axis.com |
| 1214 | F: arch/arm/mach-artpec | 1216 | F: arch/arm/mach-artpec |
| @@ -2617,7 +2619,7 @@ S: Maintained | |||
| 2617 | F: drivers/net/hamradio/baycom* | 2619 | F: drivers/net/hamradio/baycom* |
| 2618 | 2620 | ||
| 2619 | BCACHE (BLOCK LAYER CACHE) | 2621 | BCACHE (BLOCK LAYER CACHE) |
| 2620 | M: Michael Lyle <mlyle@lyle.org> | 2622 | M: Coly Li <colyli@suse.de> |
| 2621 | M: Kent Overstreet <kent.overstreet@gmail.com> | 2623 | M: Kent Overstreet <kent.overstreet@gmail.com> |
| 2622 | L: linux-bcache@vger.kernel.org | 2624 | L: linux-bcache@vger.kernel.org |
| 2623 | W: http://bcache.evilpiepirate.org | 2625 | W: http://bcache.evilpiepirate.org |
| @@ -7411,16 +7413,6 @@ S: Obsolete | |||
| 7411 | F: include/uapi/linux/ipx.h | 7413 | F: include/uapi/linux/ipx.h |
| 7412 | F: drivers/staging/ipx/ | 7414 | F: drivers/staging/ipx/ |
| 7413 | 7415 | ||
| 7414 | IRDA SUBSYSTEM | ||
| 7415 | M: Samuel Ortiz <samuel@sortiz.org> | ||
| 7416 | L: irda-users@lists.sourceforge.net (subscribers-only) | ||
| 7417 | L: netdev@vger.kernel.org | ||
| 7418 | W: http://irda.sourceforge.net/ | ||
| 7419 | S: Obsolete | ||
| 7420 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/irda-2.6.git | ||
| 7421 | F: Documentation/networking/irda.txt | ||
| 7422 | F: drivers/staging/irda/ | ||
| 7423 | |||
| 7424 | IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) | 7416 | IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) |
| 7425 | M: Marc Zyngier <marc.zyngier@arm.com> | 7417 | M: Marc Zyngier <marc.zyngier@arm.com> |
| 7426 | S: Maintained | 7418 | S: Maintained |
| @@ -7753,7 +7745,7 @@ F: arch/x86/include/asm/svm.h | |||
| 7753 | F: arch/x86/kvm/svm.c | 7745 | F: arch/x86/kvm/svm.c |
| 7754 | 7746 | ||
| 7755 | KERNEL VIRTUAL MACHINE FOR ARM (KVM/arm) | 7747 | KERNEL VIRTUAL MACHINE FOR ARM (KVM/arm) |
| 7756 | M: Christoffer Dall <christoffer.dall@linaro.org> | 7748 | M: Christoffer Dall <christoffer.dall@arm.com> |
| 7757 | M: Marc Zyngier <marc.zyngier@arm.com> | 7749 | M: Marc Zyngier <marc.zyngier@arm.com> |
| 7758 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 7750 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 7759 | L: kvmarm@lists.cs.columbia.edu | 7751 | L: kvmarm@lists.cs.columbia.edu |
| @@ -7767,7 +7759,7 @@ F: virt/kvm/arm/ | |||
| 7767 | F: include/kvm/arm_* | 7759 | F: include/kvm/arm_* |
| 7768 | 7760 | ||
| 7769 | KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64) | 7761 | KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64) |
| 7770 | M: Christoffer Dall <christoffer.dall@linaro.org> | 7762 | M: Christoffer Dall <christoffer.dall@arm.com> |
| 7771 | M: Marc Zyngier <marc.zyngier@arm.com> | 7763 | M: Marc Zyngier <marc.zyngier@arm.com> |
| 7772 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 7764 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 7773 | L: kvmarm@lists.cs.columbia.edu | 7765 | L: kvmarm@lists.cs.columbia.edu |
| @@ -10909,7 +10901,6 @@ F: drivers/pci/host/ | |||
| 10909 | F: drivers/pci/dwc/ | 10901 | F: drivers/pci/dwc/ |
| 10910 | 10902 | ||
| 10911 | PCIE DRIVER FOR AXIS ARTPEC | 10903 | PCIE DRIVER FOR AXIS ARTPEC |
| 10912 | M: Niklas Cassel <niklas.cassel@axis.com> | ||
| 10913 | M: Jesper Nilsson <jesper.nilsson@axis.com> | 10904 | M: Jesper Nilsson <jesper.nilsson@axis.com> |
| 10914 | L: linux-arm-kernel@axis.com | 10905 | L: linux-arm-kernel@axis.com |
| 10915 | L: linux-pci@vger.kernel.org | 10906 | L: linux-pci@vger.kernel.org |
| @@ -13965,7 +13956,7 @@ THUNDERBOLT DRIVER | |||
| 13965 | M: Andreas Noever <andreas.noever@gmail.com> | 13956 | M: Andreas Noever <andreas.noever@gmail.com> |
| 13966 | M: Michael Jamet <michael.jamet@intel.com> | 13957 | M: Michael Jamet <michael.jamet@intel.com> |
| 13967 | M: Mika Westerberg <mika.westerberg@linux.intel.com> | 13958 | M: Mika Westerberg <mika.westerberg@linux.intel.com> |
| 13968 | M: Yehezkel Bernat <yehezkel.bernat@intel.com> | 13959 | M: Yehezkel Bernat <YehezkelShB@gmail.com> |
| 13969 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git | 13960 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git |
| 13970 | S: Maintained | 13961 | S: Maintained |
| 13971 | F: Documentation/admin-guide/thunderbolt.rst | 13962 | F: Documentation/admin-guide/thunderbolt.rst |
| @@ -13975,7 +13966,7 @@ F: include/linux/thunderbolt.h | |||
| 13975 | THUNDERBOLT NETWORK DRIVER | 13966 | THUNDERBOLT NETWORK DRIVER |
| 13976 | M: Michael Jamet <michael.jamet@intel.com> | 13967 | M: Michael Jamet <michael.jamet@intel.com> |
| 13977 | M: Mika Westerberg <mika.westerberg@linux.intel.com> | 13968 | M: Mika Westerberg <mika.westerberg@linux.intel.com> |
| 13978 | M: Yehezkel Bernat <yehezkel.bernat@intel.com> | 13969 | M: Yehezkel Bernat <YehezkelShB@gmail.com> |
| 13979 | L: netdev@vger.kernel.org | 13970 | L: netdev@vger.kernel.org |
| 13980 | S: Maintained | 13971 | S: Maintained |
| 13981 | F: drivers/net/thunderbolt.c | 13972 | F: drivers/net/thunderbolt.c |
| @@ -2,7 +2,7 @@ | |||
| 2 | VERSION = 4 | 2 | VERSION = 4 |
| 3 | PATCHLEVEL = 17 | 3 | PATCHLEVEL = 17 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc2 | 5 | EXTRAVERSION = -rc3 |
| 6 | NAME = Fearless Coyote | 6 | NAME = Fearless Coyote |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
diff --git a/arch/arm/boot/dts/gemini-nas4220b.dts b/arch/arm/boot/dts/gemini-nas4220b.dts index 8bbb6f85d161..4785fbcc41ed 100644 --- a/arch/arm/boot/dts/gemini-nas4220b.dts +++ b/arch/arm/boot/dts/gemini-nas4220b.dts | |||
| @@ -134,37 +134,37 @@ | |||
| 134 | function = "gmii"; | 134 | function = "gmii"; |
| 135 | groups = "gmii_gmac0_grp"; | 135 | groups = "gmii_gmac0_grp"; |
| 136 | }; | 136 | }; |
| 137 | /* Settings come from OpenWRT */ | 137 | /* Settings come from OpenWRT, pins on SL3516 */ |
| 138 | conf0 { | 138 | conf0 { |
| 139 | pins = "R8 GMAC0 RXDV", "U11 GMAC1 RXDV"; | 139 | pins = "V8 GMAC0 RXDV", "T10 GMAC1 RXDV"; |
| 140 | skew-delay = <0>; | 140 | skew-delay = <0>; |
| 141 | }; | 141 | }; |
| 142 | conf1 { | 142 | conf1 { |
| 143 | pins = "T8 GMAC0 RXC", "T11 GMAC1 RXC"; | 143 | pins = "Y7 GMAC0 RXC", "Y11 GMAC1 RXC"; |
| 144 | skew-delay = <15>; | 144 | skew-delay = <15>; |
| 145 | }; | 145 | }; |
| 146 | conf2 { | 146 | conf2 { |
| 147 | pins = "P8 GMAC0 TXEN", "V11 GMAC1 TXEN"; | 147 | pins = "T8 GMAC0 TXEN", "W11 GMAC1 TXEN"; |
| 148 | skew-delay = <7>; | 148 | skew-delay = <7>; |
| 149 | }; | 149 | }; |
| 150 | conf3 { | 150 | conf3 { |
| 151 | pins = "V7 GMAC0 TXC"; | 151 | pins = "U8 GMAC0 TXC"; |
| 152 | skew-delay = <11>; | 152 | skew-delay = <11>; |
| 153 | }; | 153 | }; |
| 154 | conf4 { | 154 | conf4 { |
| 155 | pins = "P10 GMAC1 TXC"; | 155 | pins = "V11 GMAC1 TXC"; |
| 156 | skew-delay = <10>; | 156 | skew-delay = <10>; |
| 157 | }; | 157 | }; |
| 158 | conf5 { | 158 | conf5 { |
| 159 | /* The data lines all have default skew */ | 159 | /* The data lines all have default skew */ |
| 160 | pins = "U8 GMAC0 RXD0", "V8 GMAC0 RXD1", | 160 | pins = "W8 GMAC0 RXD0", "V9 GMAC0 RXD1", |
| 161 | "P9 GMAC0 RXD2", "R9 GMAC0 RXD3", | 161 | "Y8 GMAC0 RXD2", "U9 GMAC0 RXD3", |
| 162 | "U7 GMAC0 TXD0", "T7 GMAC0 TXD1", | 162 | "T7 GMAC0 TXD0", "U6 GMAC0 TXD1", |
| 163 | "R7 GMAC0 TXD2", "P7 GMAC0 TXD3", | 163 | "V7 GMAC0 TXD2", "U7 GMAC0 TXD3", |
| 164 | "R11 GMAC1 RXD0", "P11 GMAC1 RXD1", | 164 | "Y12 GMAC1 RXD0", "V12 GMAC1 RXD1", |
| 165 | "V12 GMAC1 RXD2", "U12 GMAC1 RXD3", | 165 | "T11 GMAC1 RXD2", "W12 GMAC1 RXD3", |
| 166 | "R10 GMAC1 TXD0", "T10 GMAC1 TXD1", | 166 | "U10 GMAC1 TXD0", "Y10 GMAC1 TXD1", |
| 167 | "U10 GMAC1 TXD2", "V10 GMAC1 TXD3"; | 167 | "W10 GMAC1 TXD2", "T9 GMAC1 TXD3"; |
| 168 | skew-delay = <7>; | 168 | skew-delay = <7>; |
| 169 | }; | 169 | }; |
| 170 | /* Set up drive strength on GMAC0 to 16 mA */ | 170 | /* Set up drive strength on GMAC0 to 16 mA */ |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 475904894b86..e554b6e039f3 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
| @@ -163,10 +163,10 @@ | |||
| 163 | 163 | ||
| 164 | cm2: cm2@8000 { | 164 | cm2: cm2@8000 { |
| 165 | compatible = "ti,omap4-cm2", "simple-bus"; | 165 | compatible = "ti,omap4-cm2", "simple-bus"; |
| 166 | reg = <0x8000 0x3000>; | 166 | reg = <0x8000 0x2000>; |
| 167 | #address-cells = <1>; | 167 | #address-cells = <1>; |
| 168 | #size-cells = <1>; | 168 | #size-cells = <1>; |
| 169 | ranges = <0 0x8000 0x3000>; | 169 | ranges = <0 0x8000 0x2000>; |
| 170 | 170 | ||
| 171 | cm2_clocks: clocks { | 171 | cm2_clocks: clocks { |
| 172 | #address-cells = <1>; | 172 | #address-cells = <1>; |
| @@ -250,11 +250,11 @@ | |||
| 250 | 250 | ||
| 251 | prm: prm@6000 { | 251 | prm: prm@6000 { |
| 252 | compatible = "ti,omap4-prm"; | 252 | compatible = "ti,omap4-prm"; |
| 253 | reg = <0x6000 0x3000>; | 253 | reg = <0x6000 0x2000>; |
| 254 | interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>; | 254 | interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>; |
| 255 | #address-cells = <1>; | 255 | #address-cells = <1>; |
| 256 | #size-cells = <1>; | 256 | #size-cells = <1>; |
| 257 | ranges = <0 0x6000 0x3000>; | 257 | ranges = <0 0x6000 0x2000>; |
| 258 | 258 | ||
| 259 | prm_clocks: clocks { | 259 | prm_clocks: clocks { |
| 260 | #address-cells = <1>; | 260 | #address-cells = <1>; |
diff --git a/arch/arm/configs/gemini_defconfig b/arch/arm/configs/gemini_defconfig index 2a63fa10c813..553777ac2814 100644 --- a/arch/arm/configs/gemini_defconfig +++ b/arch/arm/configs/gemini_defconfig | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
| 2 | CONFIG_SYSVIPC=y | 2 | CONFIG_SYSVIPC=y |
| 3 | CONFIG_NO_HZ_IDLE=y | 3 | CONFIG_NO_HZ_IDLE=y |
| 4 | CONFIG_HIGH_RES_TIMERS=y | ||
| 4 | CONFIG_BSD_PROCESS_ACCT=y | 5 | CONFIG_BSD_PROCESS_ACCT=y |
| 5 | CONFIG_USER_NS=y | 6 | CONFIG_USER_NS=y |
| 6 | CONFIG_RELAY=y | 7 | CONFIG_RELAY=y |
| @@ -12,15 +13,21 @@ CONFIG_ARCH_GEMINI=y | |||
| 12 | CONFIG_PCI=y | 13 | CONFIG_PCI=y |
| 13 | CONFIG_PREEMPT=y | 14 | CONFIG_PREEMPT=y |
| 14 | CONFIG_AEABI=y | 15 | CONFIG_AEABI=y |
| 16 | CONFIG_HIGHMEM=y | ||
| 17 | CONFIG_CMA=y | ||
| 15 | CONFIG_CMDLINE="console=ttyS0,115200n8" | 18 | CONFIG_CMDLINE="console=ttyS0,115200n8" |
| 16 | CONFIG_KEXEC=y | 19 | CONFIG_KEXEC=y |
| 17 | CONFIG_BINFMT_MISC=y | 20 | CONFIG_BINFMT_MISC=y |
| 18 | CONFIG_PM=y | 21 | CONFIG_PM=y |
| 22 | CONFIG_NET=y | ||
| 23 | CONFIG_UNIX=y | ||
| 24 | CONFIG_INET=y | ||
| 19 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 25 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
| 20 | CONFIG_DEVTMPFS=y | 26 | CONFIG_DEVTMPFS=y |
| 21 | CONFIG_MTD=y | 27 | CONFIG_MTD=y |
| 22 | CONFIG_MTD_BLOCK=y | 28 | CONFIG_MTD_BLOCK=y |
| 23 | CONFIG_MTD_CFI=y | 29 | CONFIG_MTD_CFI=y |
| 30 | CONFIG_MTD_JEDECPROBE=y | ||
| 24 | CONFIG_MTD_CFI_INTELEXT=y | 31 | CONFIG_MTD_CFI_INTELEXT=y |
| 25 | CONFIG_MTD_CFI_AMDSTD=y | 32 | CONFIG_MTD_CFI_AMDSTD=y |
| 26 | CONFIG_MTD_CFI_STAA=y | 33 | CONFIG_MTD_CFI_STAA=y |
| @@ -33,6 +40,11 @@ CONFIG_BLK_DEV_SD=y | |||
| 33 | # CONFIG_SCSI_LOWLEVEL is not set | 40 | # CONFIG_SCSI_LOWLEVEL is not set |
| 34 | CONFIG_ATA=y | 41 | CONFIG_ATA=y |
| 35 | CONFIG_PATA_FTIDE010=y | 42 | CONFIG_PATA_FTIDE010=y |
| 43 | CONFIG_NETDEVICES=y | ||
| 44 | CONFIG_GEMINI_ETHERNET=y | ||
| 45 | CONFIG_MDIO_BITBANG=y | ||
| 46 | CONFIG_MDIO_GPIO=y | ||
| 47 | CONFIG_REALTEK_PHY=y | ||
| 36 | CONFIG_INPUT_EVDEV=y | 48 | CONFIG_INPUT_EVDEV=y |
| 37 | CONFIG_KEYBOARD_GPIO=y | 49 | CONFIG_KEYBOARD_GPIO=y |
| 38 | # CONFIG_INPUT_MOUSE is not set | 50 | # CONFIG_INPUT_MOUSE is not set |
| @@ -43,9 +55,19 @@ CONFIG_SERIAL_8250_NR_UARTS=1 | |||
| 43 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 | 55 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 |
| 44 | CONFIG_SERIAL_OF_PLATFORM=y | 56 | CONFIG_SERIAL_OF_PLATFORM=y |
| 45 | # CONFIG_HW_RANDOM is not set | 57 | # CONFIG_HW_RANDOM is not set |
| 46 | # CONFIG_HWMON is not set | 58 | CONFIG_I2C_GPIO=y |
| 59 | CONFIG_SPI=y | ||
| 60 | CONFIG_SPI_GPIO=y | ||
| 61 | CONFIG_SENSORS_GPIO_FAN=y | ||
| 62 | CONFIG_SENSORS_LM75=y | ||
| 63 | CONFIG_THERMAL=y | ||
| 47 | CONFIG_WATCHDOG=y | 64 | CONFIG_WATCHDOG=y |
| 48 | CONFIG_GEMINI_WATCHDOG=y | 65 | CONFIG_REGULATOR=y |
| 66 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
| 67 | CONFIG_DRM=y | ||
| 68 | CONFIG_DRM_PANEL_ILITEK_IL9322=y | ||
| 69 | CONFIG_DRM_TVE200=y | ||
| 70 | CONFIG_LOGO=y | ||
| 49 | CONFIG_USB=y | 71 | CONFIG_USB=y |
| 50 | CONFIG_USB_MON=y | 72 | CONFIG_USB_MON=y |
| 51 | CONFIG_USB_FOTG210_HCD=y | 73 | CONFIG_USB_FOTG210_HCD=y |
| @@ -54,6 +76,7 @@ CONFIG_NEW_LEDS=y | |||
| 54 | CONFIG_LEDS_CLASS=y | 76 | CONFIG_LEDS_CLASS=y |
| 55 | CONFIG_LEDS_GPIO=y | 77 | CONFIG_LEDS_GPIO=y |
| 56 | CONFIG_LEDS_TRIGGERS=y | 78 | CONFIG_LEDS_TRIGGERS=y |
| 79 | CONFIG_LEDS_TRIGGER_DISK=y | ||
| 57 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | 80 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y |
| 58 | CONFIG_RTC_CLASS=y | 81 | CONFIG_RTC_CLASS=y |
| 59 | CONFIG_DMADEVICES=y | 82 | CONFIG_DMADEVICES=y |
diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig index 2620ce790db0..371fca4e1ab7 100644 --- a/arch/arm/configs/socfpga_defconfig +++ b/arch/arm/configs/socfpga_defconfig | |||
| @@ -57,6 +57,7 @@ CONFIG_MTD_M25P80=y | |||
| 57 | CONFIG_MTD_NAND=y | 57 | CONFIG_MTD_NAND=y |
| 58 | CONFIG_MTD_NAND_DENALI_DT=y | 58 | CONFIG_MTD_NAND_DENALI_DT=y |
| 59 | CONFIG_MTD_SPI_NOR=y | 59 | CONFIG_MTD_SPI_NOR=y |
| 60 | # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set | ||
| 60 | CONFIG_SPI_CADENCE_QUADSPI=y | 61 | CONFIG_SPI_CADENCE_QUADSPI=y |
| 61 | CONFIG_OF_OVERLAY=y | 62 | CONFIG_OF_OVERLAY=y |
| 62 | CONFIG_OF_CONFIGFS=y | 63 | CONFIG_OF_CONFIGFS=y |
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index c6a749568dd6..c7c28c885a19 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h | |||
| @@ -77,6 +77,9 @@ struct kvm_arch { | |||
| 77 | /* Interrupt controller */ | 77 | /* Interrupt controller */ |
| 78 | struct vgic_dist vgic; | 78 | struct vgic_dist vgic; |
| 79 | int max_vcpus; | 79 | int max_vcpus; |
| 80 | |||
| 81 | /* Mandated version of PSCI */ | ||
| 82 | u32 psci_version; | ||
| 80 | }; | 83 | }; |
| 81 | 84 | ||
| 82 | #define KVM_NR_MEM_OBJS 40 | 85 | #define KVM_NR_MEM_OBJS 40 |
diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h index 2ba95d6fe852..caae4843cb70 100644 --- a/arch/arm/include/uapi/asm/kvm.h +++ b/arch/arm/include/uapi/asm/kvm.h | |||
| @@ -195,6 +195,12 @@ struct kvm_arch_memory_slot { | |||
| 195 | #define KVM_REG_ARM_VFP_FPINST 0x1009 | 195 | #define KVM_REG_ARM_VFP_FPINST 0x1009 |
| 196 | #define KVM_REG_ARM_VFP_FPINST2 0x100A | 196 | #define KVM_REG_ARM_VFP_FPINST2 0x100A |
| 197 | 197 | ||
| 198 | /* KVM-as-firmware specific pseudo-registers */ | ||
| 199 | #define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) | ||
| 200 | #define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | \ | ||
| 201 | KVM_REG_ARM_FW | ((r) & 0xffff)) | ||
| 202 | #define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) | ||
| 203 | |||
| 198 | /* Device Control API: ARM VGIC */ | 204 | /* Device Control API: ARM VGIC */ |
| 199 | #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 | 205 | #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 |
| 200 | #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 | 206 | #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 |
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index 1e0784ebbfd6..a18f33edc471 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 23 | #include <linux/vmalloc.h> | 23 | #include <linux/vmalloc.h> |
| 24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
| 25 | #include <kvm/arm_psci.h> | ||
| 25 | #include <asm/cputype.h> | 26 | #include <asm/cputype.h> |
| 26 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
| 27 | #include <asm/kvm.h> | 28 | #include <asm/kvm.h> |
| @@ -176,6 +177,7 @@ static unsigned long num_core_regs(void) | |||
| 176 | unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu) | 177 | unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu) |
| 177 | { | 178 | { |
| 178 | return num_core_regs() + kvm_arm_num_coproc_regs(vcpu) | 179 | return num_core_regs() + kvm_arm_num_coproc_regs(vcpu) |
| 180 | + kvm_arm_get_fw_num_regs(vcpu) | ||
| 179 | + NUM_TIMER_REGS; | 181 | + NUM_TIMER_REGS; |
| 180 | } | 182 | } |
| 181 | 183 | ||
| @@ -196,6 +198,11 @@ int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices) | |||
| 196 | uindices++; | 198 | uindices++; |
| 197 | } | 199 | } |
| 198 | 200 | ||
| 201 | ret = kvm_arm_copy_fw_reg_indices(vcpu, uindices); | ||
| 202 | if (ret) | ||
| 203 | return ret; | ||
| 204 | uindices += kvm_arm_get_fw_num_regs(vcpu); | ||
| 205 | |||
| 199 | ret = copy_timer_indices(vcpu, uindices); | 206 | ret = copy_timer_indices(vcpu, uindices); |
| 200 | if (ret) | 207 | if (ret) |
| 201 | return ret; | 208 | return ret; |
| @@ -214,6 +221,9 @@ int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) | |||
| 214 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) | 221 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) |
| 215 | return get_core_reg(vcpu, reg); | 222 | return get_core_reg(vcpu, reg); |
| 216 | 223 | ||
| 224 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_FW) | ||
| 225 | return kvm_arm_get_fw_reg(vcpu, reg); | ||
| 226 | |||
| 217 | if (is_timer_reg(reg->id)) | 227 | if (is_timer_reg(reg->id)) |
| 218 | return get_timer_reg(vcpu, reg); | 228 | return get_timer_reg(vcpu, reg); |
| 219 | 229 | ||
| @@ -230,6 +240,9 @@ int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) | |||
| 230 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) | 240 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) |
| 231 | return set_core_reg(vcpu, reg); | 241 | return set_core_reg(vcpu, reg); |
| 232 | 242 | ||
| 243 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_FW) | ||
| 244 | return kvm_arm_set_fw_reg(vcpu, reg); | ||
| 245 | |||
| 233 | if (is_timer_reg(reg->id)) | 246 | if (is_timer_reg(reg->id)) |
| 234 | return set_timer_reg(vcpu, reg); | 247 | return set_timer_reg(vcpu, reg); |
| 235 | 248 | ||
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 4603c30fef73..0d9ce58bc464 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
| @@ -243,8 +243,4 @@ arch/arm/mach-omap2/pm-asm-offsets.s: arch/arm/mach-omap2/pm-asm-offsets.c | |||
| 243 | include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s FORCE | 243 | include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s FORCE |
| 244 | $(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__) | 244 | $(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__) |
| 245 | 245 | ||
| 246 | # For rule to generate ti-emif-asm-offsets.h dependency | 246 | $(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h |
| 247 | include drivers/memory/Makefile.asm-offsets | ||
| 248 | |||
| 249 | arch/arm/mach-omap2/sleep33xx.o: include/generated/ti-pm-asm-offsets.h include/generated/ti-emif-asm-offsets.h | ||
| 250 | arch/arm/mach-omap2/sleep43xx.o: include/generated/ti-pm-asm-offsets.h include/generated/ti-emif-asm-offsets.h | ||
diff --git a/arch/arm/mach-omap2/pm-asm-offsets.c b/arch/arm/mach-omap2/pm-asm-offsets.c index 6d4392da7c11..b9846b19e5e2 100644 --- a/arch/arm/mach-omap2/pm-asm-offsets.c +++ b/arch/arm/mach-omap2/pm-asm-offsets.c | |||
| @@ -7,9 +7,12 @@ | |||
| 7 | 7 | ||
| 8 | #include <linux/kbuild.h> | 8 | #include <linux/kbuild.h> |
| 9 | #include <linux/platform_data/pm33xx.h> | 9 | #include <linux/platform_data/pm33xx.h> |
| 10 | #include <linux/ti-emif-sram.h> | ||
| 10 | 11 | ||
| 11 | int main(void) | 12 | int main(void) |
| 12 | { | 13 | { |
| 14 | ti_emif_asm_offsets(); | ||
| 15 | |||
| 13 | DEFINE(AMX3_PM_WFI_FLAGS_OFFSET, | 16 | DEFINE(AMX3_PM_WFI_FLAGS_OFFSET, |
| 14 | offsetof(struct am33xx_pm_sram_data, wfi_flags)); | 17 | offsetof(struct am33xx_pm_sram_data, wfi_flags)); |
| 15 | DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET, | 18 | DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET, |
diff --git a/arch/arm/mach-omap2/sleep33xx.S b/arch/arm/mach-omap2/sleep33xx.S index 218d79930b04..322b3bb868b4 100644 --- a/arch/arm/mach-omap2/sleep33xx.S +++ b/arch/arm/mach-omap2/sleep33xx.S | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | * Dave Gerlach, Vaibhav Bedia | 6 | * Dave Gerlach, Vaibhav Bedia |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <generated/ti-emif-asm-offsets.h> | ||
| 10 | #include <generated/ti-pm-asm-offsets.h> | 9 | #include <generated/ti-pm-asm-offsets.h> |
| 11 | #include <linux/linkage.h> | 10 | #include <linux/linkage.h> |
| 12 | #include <linux/ti-emif-sram.h> | 11 | #include <linux/ti-emif-sram.h> |
diff --git a/arch/arm/mach-omap2/sleep43xx.S b/arch/arm/mach-omap2/sleep43xx.S index b24be624e8b9..8903814a6677 100644 --- a/arch/arm/mach-omap2/sleep43xx.S +++ b/arch/arm/mach-omap2/sleep43xx.S | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | * Dave Gerlach, Vaibhav Bedia | 6 | * Dave Gerlach, Vaibhav Bedia |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <generated/ti-emif-asm-offsets.h> | ||
| 10 | #include <generated/ti-pm-asm-offsets.h> | 9 | #include <generated/ti-pm-asm-offsets.h> |
| 11 | #include <linux/linkage.h> | 10 | #include <linux/linkage.h> |
| 12 | #include <linux/ti-emif-sram.h> | 11 | #include <linux/ti-emif-sram.h> |
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c index 59589a4a0d4b..885e8f12e4b9 100644 --- a/arch/arm/mach-s3c24xx/mach-jive.c +++ b/arch/arm/mach-s3c24xx/mach-jive.c | |||
| @@ -427,9 +427,9 @@ static struct gpiod_lookup_table jive_wm8750_gpiod_table = { | |||
| 427 | .dev_id = "spi_gpio", | 427 | .dev_id = "spi_gpio", |
| 428 | .table = { | 428 | .table = { |
| 429 | GPIO_LOOKUP("GPIOB", 4, | 429 | GPIO_LOOKUP("GPIOB", 4, |
| 430 | "gpio-sck", GPIO_ACTIVE_HIGH), | 430 | "sck", GPIO_ACTIVE_HIGH), |
| 431 | GPIO_LOOKUP("GPIOB", 9, | 431 | GPIO_LOOKUP("GPIOB", 9, |
| 432 | "gpio-mosi", GPIO_ACTIVE_HIGH), | 432 | "mosi", GPIO_ACTIVE_HIGH), |
| 433 | GPIO_LOOKUP("GPIOH", 10, | 433 | GPIO_LOOKUP("GPIOH", 10, |
| 434 | "cs", GPIO_ACTIVE_HIGH), | 434 | "cs", GPIO_ACTIVE_HIGH), |
| 435 | { }, | 435 | { }, |
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 15402861bb59..87f7d2f9f17c 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile | |||
| @@ -56,7 +56,11 @@ KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) | |||
| 56 | KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) | 56 | KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) |
| 57 | KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) | 57 | KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) |
| 58 | 58 | ||
| 59 | ifeq ($(cc-name),clang) | ||
| 60 | KBUILD_CFLAGS += -DCONFIG_ARCH_SUPPORTS_INT128 | ||
| 61 | else | ||
| 59 | KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128) | 62 | KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128) |
| 63 | endif | ||
| 60 | 64 | ||
| 61 | ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) | 65 | ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) |
| 62 | KBUILD_CPPFLAGS += -mbig-endian | 66 | KBUILD_CPPFLAGS += -mbig-endian |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi index 4eef36b22538..88e712ea757a 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | |||
| @@ -212,3 +212,7 @@ | |||
| 212 | pinctrl-0 = <&uart_ao_a_pins>; | 212 | pinctrl-0 = <&uart_ao_a_pins>; |
| 213 | pinctrl-names = "default"; | 213 | pinctrl-names = "default"; |
| 214 | }; | 214 | }; |
| 215 | |||
| 216 | &usb0 { | ||
| 217 | status = "okay"; | ||
| 218 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts index 22bf37404ff1..3e3eb31748a3 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | |||
| @@ -271,3 +271,15 @@ | |||
| 271 | pinctrl-0 = <&uart_ao_a_pins>; | 271 | pinctrl-0 = <&uart_ao_a_pins>; |
| 272 | pinctrl-names = "default"; | 272 | pinctrl-names = "default"; |
| 273 | }; | 273 | }; |
| 274 | |||
| 275 | &usb0 { | ||
| 276 | status = "okay"; | ||
| 277 | }; | ||
| 278 | |||
| 279 | &usb2_phy0 { | ||
| 280 | /* | ||
| 281 | * even though the schematics don't show it: | ||
| 282 | * HDMI_5V is also used as supply for the USB VBUS. | ||
| 283 | */ | ||
| 284 | phy-supply = <&hdmi_5v>; | ||
| 285 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts index 69c721a70e44..6739697be1de 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts | |||
| @@ -215,3 +215,7 @@ | |||
| 215 | pinctrl-0 = <&uart_ao_a_pins>; | 215 | pinctrl-0 = <&uart_ao_a_pins>; |
| 216 | pinctrl-names = "default"; | 216 | pinctrl-names = "default"; |
| 217 | }; | 217 | }; |
| 218 | |||
| 219 | &usb0 { | ||
| 220 | status = "okay"; | ||
| 221 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi index 0a0953fbc7d4..0cfd701809de 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | |||
| @@ -185,3 +185,7 @@ | |||
| 185 | pinctrl-0 = <&uart_ao_a_pins>; | 185 | pinctrl-0 = <&uart_ao_a_pins>; |
| 186 | pinctrl-names = "default"; | 186 | pinctrl-names = "default"; |
| 187 | }; | 187 | }; |
| 188 | |||
| 189 | &usb0 { | ||
| 190 | status = "okay"; | ||
| 191 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi index e1a39cbed8c9..dba365ed4bd5 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | |||
| @@ -20,6 +20,67 @@ | |||
| 20 | no-map; | 20 | no-map; |
| 21 | }; | 21 | }; |
| 22 | }; | 22 | }; |
| 23 | |||
| 24 | soc { | ||
| 25 | usb0: usb@c9000000 { | ||
| 26 | status = "disabled"; | ||
| 27 | compatible = "amlogic,meson-gxl-dwc3"; | ||
| 28 | #address-cells = <2>; | ||
| 29 | #size-cells = <2>; | ||
| 30 | ranges; | ||
| 31 | |||
| 32 | clocks = <&clkc CLKID_USB>; | ||
| 33 | clock-names = "usb_general"; | ||
| 34 | resets = <&reset RESET_USB_OTG>; | ||
| 35 | reset-names = "usb_otg"; | ||
| 36 | |||
| 37 | dwc3: dwc3@c9000000 { | ||
| 38 | compatible = "snps,dwc3"; | ||
| 39 | reg = <0x0 0xc9000000 0x0 0x100000>; | ||
| 40 | interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>; | ||
| 41 | dr_mode = "host"; | ||
| 42 | maximum-speed = "high-speed"; | ||
| 43 | snps,dis_u2_susphy_quirk; | ||
| 44 | phys = <&usb3_phy>, <&usb2_phy0>, <&usb2_phy1>; | ||
| 45 | }; | ||
| 46 | }; | ||
| 47 | }; | ||
| 48 | }; | ||
| 49 | |||
| 50 | &apb { | ||
| 51 | usb2_phy0: phy@78000 { | ||
| 52 | compatible = "amlogic,meson-gxl-usb2-phy"; | ||
| 53 | #phy-cells = <0>; | ||
| 54 | reg = <0x0 0x78000 0x0 0x20>; | ||
| 55 | clocks = <&clkc CLKID_USB>; | ||
| 56 | clock-names = "phy"; | ||
| 57 | resets = <&reset RESET_USB_OTG>; | ||
| 58 | reset-names = "phy"; | ||
| 59 | status = "okay"; | ||
| 60 | }; | ||
| 61 | |||
| 62 | usb2_phy1: phy@78020 { | ||
| 63 | compatible = "amlogic,meson-gxl-usb2-phy"; | ||
| 64 | #phy-cells = <0>; | ||
| 65 | reg = <0x0 0x78020 0x0 0x20>; | ||
| 66 | clocks = <&clkc CLKID_USB>; | ||
| 67 | clock-names = "phy"; | ||
| 68 | resets = <&reset RESET_USB_OTG>; | ||
| 69 | reset-names = "phy"; | ||
| 70 | status = "okay"; | ||
| 71 | }; | ||
| 72 | |||
| 73 | usb3_phy: phy@78080 { | ||
| 74 | compatible = "amlogic,meson-gxl-usb3-phy"; | ||
| 75 | #phy-cells = <0>; | ||
| 76 | reg = <0x0 0x78080 0x0 0x20>; | ||
| 77 | interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; | ||
| 78 | clocks = <&clkc CLKID_USB>, <&clkc_AO CLKID_AO_CEC_32K>; | ||
| 79 | clock-names = "phy", "peripheral"; | ||
| 80 | resets = <&reset RESET_USB_OTG>, <&reset RESET_USB_OTG>; | ||
| 81 | reset-names = "phy", "peripheral"; | ||
| 82 | status = "okay"; | ||
| 83 | }; | ||
| 23 | }; | 84 | }; |
| 24 | 85 | ||
| 25 | ðmac { | 86 | ðmac { |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts index 4fd46c1546a7..0868da476e41 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | |||
| @@ -406,3 +406,7 @@ | |||
| 406 | status = "okay"; | 406 | status = "okay"; |
| 407 | vref-supply = <&vddio_ao18>; | 407 | vref-supply = <&vddio_ao18>; |
| 408 | }; | 408 | }; |
| 409 | |||
| 410 | &usb0 { | ||
| 411 | status = "okay"; | ||
| 412 | }; | ||
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi index d076a7c425dd..247888d68a3a 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi | |||
| @@ -80,6 +80,19 @@ | |||
| 80 | }; | 80 | }; |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | &apb { | ||
| 84 | usb2_phy2: phy@78040 { | ||
| 85 | compatible = "amlogic,meson-gxl-usb2-phy"; | ||
| 86 | #phy-cells = <0>; | ||
| 87 | reg = <0x0 0x78040 0x0 0x20>; | ||
| 88 | clocks = <&clkc CLKID_USB>; | ||
| 89 | clock-names = "phy"; | ||
| 90 | resets = <&reset RESET_USB_OTG>; | ||
| 91 | reset-names = "phy"; | ||
| 92 | status = "okay"; | ||
| 93 | }; | ||
| 94 | }; | ||
| 95 | |||
| 83 | &clkc_AO { | 96 | &clkc_AO { |
| 84 | compatible = "amlogic,meson-gxm-aoclkc", "amlogic,meson-gx-aoclkc"; | 97 | compatible = "amlogic,meson-gxm-aoclkc", "amlogic,meson-gx-aoclkc"; |
| 85 | }; | 98 | }; |
| @@ -100,3 +113,7 @@ | |||
| 100 | &hdmi_tx { | 113 | &hdmi_tx { |
| 101 | compatible = "amlogic,meson-gxm-dw-hdmi", "amlogic,meson-gx-dw-hdmi"; | 114 | compatible = "amlogic,meson-gxm-dw-hdmi", "amlogic,meson-gx-dw-hdmi"; |
| 102 | }; | 115 | }; |
| 116 | |||
| 117 | &dwc3 { | ||
| 118 | phys = <&usb3_phy>, <&usb2_phy0>, <&usb2_phy1>, <&usb2_phy2>; | ||
| 119 | }; | ||
diff --git a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi index 2ac43221ddb6..69804c5f1197 100644 --- a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi +++ b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi | |||
| @@ -56,8 +56,6 @@ | |||
| 56 | 56 | ||
| 57 | gpio_keys { | 57 | gpio_keys { |
| 58 | compatible = "gpio-keys"; | 58 | compatible = "gpio-keys"; |
| 59 | #address-cells = <1>; | ||
| 60 | #size-cells = <0>; | ||
| 61 | 59 | ||
| 62 | power-button { | 60 | power-button { |
| 63 | debounce_interval = <50>; | 61 | debounce_interval = <50>; |
diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-sata.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray-sata.dtsi index 4b5465da81d8..8c68e0c26f1b 100644 --- a/arch/arm64/boot/dts/broadcom/stingray/stingray-sata.dtsi +++ b/arch/arm64/boot/dts/broadcom/stingray/stingray-sata.dtsi | |||
| @@ -36,11 +36,11 @@ | |||
| 36 | #size-cells = <1>; | 36 | #size-cells = <1>; |
| 37 | ranges = <0x0 0x0 0x67d00000 0x00800000>; | 37 | ranges = <0x0 0x0 0x67d00000 0x00800000>; |
| 38 | 38 | ||
| 39 | sata0: ahci@210000 { | 39 | sata0: ahci@0 { |
| 40 | compatible = "brcm,iproc-ahci", "generic-ahci"; | 40 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 41 | reg = <0x00210000 0x1000>; | 41 | reg = <0x00000000 0x1000>; |
| 42 | reg-names = "ahci"; | 42 | reg-names = "ahci"; |
| 43 | interrupts = <GIC_SPI 339 IRQ_TYPE_LEVEL_HIGH>; | 43 | interrupts = <GIC_SPI 321 IRQ_TYPE_LEVEL_HIGH>; |
| 44 | #address-cells = <1>; | 44 | #address-cells = <1>; |
| 45 | #size-cells = <0>; | 45 | #size-cells = <0>; |
| 46 | status = "disabled"; | 46 | status = "disabled"; |
| @@ -52,9 +52,9 @@ | |||
| 52 | }; | 52 | }; |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | sata_phy0: sata_phy@212100 { | 55 | sata_phy0: sata_phy@2100 { |
| 56 | compatible = "brcm,iproc-sr-sata-phy"; | 56 | compatible = "brcm,iproc-sr-sata-phy"; |
| 57 | reg = <0x00212100 0x1000>; | 57 | reg = <0x00002100 0x1000>; |
| 58 | reg-names = "phy"; | 58 | reg-names = "phy"; |
| 59 | #address-cells = <1>; | 59 | #address-cells = <1>; |
| 60 | #size-cells = <0>; | 60 | #size-cells = <0>; |
| @@ -66,11 +66,11 @@ | |||
| 66 | }; | 66 | }; |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | sata1: ahci@310000 { | 69 | sata1: ahci@10000 { |
| 70 | compatible = "brcm,iproc-ahci", "generic-ahci"; | 70 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 71 | reg = <0x00310000 0x1000>; | 71 | reg = <0x00010000 0x1000>; |
| 72 | reg-names = "ahci"; | 72 | reg-names = "ahci"; |
| 73 | interrupts = <GIC_SPI 347 IRQ_TYPE_LEVEL_HIGH>; | 73 | interrupts = <GIC_SPI 323 IRQ_TYPE_LEVEL_HIGH>; |
| 74 | #address-cells = <1>; | 74 | #address-cells = <1>; |
| 75 | #size-cells = <0>; | 75 | #size-cells = <0>; |
| 76 | status = "disabled"; | 76 | status = "disabled"; |
| @@ -82,9 +82,9 @@ | |||
| 82 | }; | 82 | }; |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | sata_phy1: sata_phy@312100 { | 85 | sata_phy1: sata_phy@12100 { |
| 86 | compatible = "brcm,iproc-sr-sata-phy"; | 86 | compatible = "brcm,iproc-sr-sata-phy"; |
| 87 | reg = <0x00312100 0x1000>; | 87 | reg = <0x00012100 0x1000>; |
| 88 | reg-names = "phy"; | 88 | reg-names = "phy"; |
| 89 | #address-cells = <1>; | 89 | #address-cells = <1>; |
| 90 | #size-cells = <0>; | 90 | #size-cells = <0>; |
| @@ -96,11 +96,11 @@ | |||
| 96 | }; | 96 | }; |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | sata2: ahci@120000 { | 99 | sata2: ahci@20000 { |
| 100 | compatible = "brcm,iproc-ahci", "generic-ahci"; | 100 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 101 | reg = <0x00120000 0x1000>; | 101 | reg = <0x00020000 0x1000>; |
| 102 | reg-names = "ahci"; | 102 | reg-names = "ahci"; |
| 103 | interrupts = <GIC_SPI 333 IRQ_TYPE_LEVEL_HIGH>; | 103 | interrupts = <GIC_SPI 325 IRQ_TYPE_LEVEL_HIGH>; |
| 104 | #address-cells = <1>; | 104 | #address-cells = <1>; |
| 105 | #size-cells = <0>; | 105 | #size-cells = <0>; |
| 106 | status = "disabled"; | 106 | status = "disabled"; |
| @@ -112,9 +112,9 @@ | |||
| 112 | }; | 112 | }; |
| 113 | }; | 113 | }; |
| 114 | 114 | ||
| 115 | sata_phy2: sata_phy@122100 { | 115 | sata_phy2: sata_phy@22100 { |
| 116 | compatible = "brcm,iproc-sr-sata-phy"; | 116 | compatible = "brcm,iproc-sr-sata-phy"; |
| 117 | reg = <0x00122100 0x1000>; | 117 | reg = <0x00022100 0x1000>; |
| 118 | reg-names = "phy"; | 118 | reg-names = "phy"; |
| 119 | #address-cells = <1>; | 119 | #address-cells = <1>; |
| 120 | #size-cells = <0>; | 120 | #size-cells = <0>; |
| @@ -126,11 +126,11 @@ | |||
| 126 | }; | 126 | }; |
| 127 | }; | 127 | }; |
| 128 | 128 | ||
| 129 | sata3: ahci@130000 { | 129 | sata3: ahci@30000 { |
| 130 | compatible = "brcm,iproc-ahci", "generic-ahci"; | 130 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 131 | reg = <0x00130000 0x1000>; | 131 | reg = <0x00030000 0x1000>; |
| 132 | reg-names = "ahci"; | 132 | reg-names = "ahci"; |
| 133 | interrupts = <GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>; | 133 | interrupts = <GIC_SPI 327 IRQ_TYPE_LEVEL_HIGH>; |
| 134 | #address-cells = <1>; | 134 | #address-cells = <1>; |
| 135 | #size-cells = <0>; | 135 | #size-cells = <0>; |
| 136 | status = "disabled"; | 136 | status = "disabled"; |
| @@ -142,9 +142,9 @@ | |||
| 142 | }; | 142 | }; |
| 143 | }; | 143 | }; |
| 144 | 144 | ||
| 145 | sata_phy3: sata_phy@132100 { | 145 | sata_phy3: sata_phy@32100 { |
| 146 | compatible = "brcm,iproc-sr-sata-phy"; | 146 | compatible = "brcm,iproc-sr-sata-phy"; |
| 147 | reg = <0x00132100 0x1000>; | 147 | reg = <0x00032100 0x1000>; |
| 148 | reg-names = "phy"; | 148 | reg-names = "phy"; |
| 149 | #address-cells = <1>; | 149 | #address-cells = <1>; |
| 150 | #size-cells = <0>; | 150 | #size-cells = <0>; |
| @@ -156,11 +156,11 @@ | |||
| 156 | }; | 156 | }; |
| 157 | }; | 157 | }; |
| 158 | 158 | ||
| 159 | sata4: ahci@330000 { | 159 | sata4: ahci@100000 { |
| 160 | compatible = "brcm,iproc-ahci", "generic-ahci"; | 160 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 161 | reg = <0x00330000 0x1000>; | 161 | reg = <0x00100000 0x1000>; |
| 162 | reg-names = "ahci"; | 162 | reg-names = "ahci"; |
| 163 | interrupts = <GIC_SPI 351 IRQ_TYPE_LEVEL_HIGH>; | 163 | interrupts = <GIC_SPI 329 IRQ_TYPE_LEVEL_HIGH>; |
| 164 | #address-cells = <1>; | 164 | #address-cells = <1>; |
| 165 | #size-cells = <0>; | 165 | #size-cells = <0>; |
| 166 | status = "disabled"; | 166 | status = "disabled"; |
| @@ -172,9 +172,9 @@ | |||
| 172 | }; | 172 | }; |
| 173 | }; | 173 | }; |
| 174 | 174 | ||
| 175 | sata_phy4: sata_phy@332100 { | 175 | sata_phy4: sata_phy@102100 { |
| 176 | compatible = "brcm,iproc-sr-sata-phy"; | 176 | compatible = "brcm,iproc-sr-sata-phy"; |
| 177 | reg = <0x00332100 0x1000>; | 177 | reg = <0x00102100 0x1000>; |
| 178 | reg-names = "phy"; | 178 | reg-names = "phy"; |
| 179 | #address-cells = <1>; | 179 | #address-cells = <1>; |
| 180 | #size-cells = <0>; | 180 | #size-cells = <0>; |
| @@ -186,11 +186,11 @@ | |||
| 186 | }; | 186 | }; |
| 187 | }; | 187 | }; |
| 188 | 188 | ||
| 189 | sata5: ahci@400000 { | 189 | sata5: ahci@110000 { |
| 190 | compatible = "brcm,iproc-ahci", "generic-ahci"; | 190 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 191 | reg = <0x00400000 0x1000>; | 191 | reg = <0x00110000 0x1000>; |
| 192 | reg-names = "ahci"; | 192 | reg-names = "ahci"; |
| 193 | interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>; | 193 | interrupts = <GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH>; |
| 194 | #address-cells = <1>; | 194 | #address-cells = <1>; |
| 195 | #size-cells = <0>; | 195 | #size-cells = <0>; |
| 196 | status = "disabled"; | 196 | status = "disabled"; |
| @@ -202,9 +202,9 @@ | |||
| 202 | }; | 202 | }; |
| 203 | }; | 203 | }; |
| 204 | 204 | ||
| 205 | sata_phy5: sata_phy@402100 { | 205 | sata_phy5: sata_phy@112100 { |
| 206 | compatible = "brcm,iproc-sr-sata-phy"; | 206 | compatible = "brcm,iproc-sr-sata-phy"; |
| 207 | reg = <0x00402100 0x1000>; | 207 | reg = <0x00112100 0x1000>; |
| 208 | reg-names = "phy"; | 208 | reg-names = "phy"; |
| 209 | #address-cells = <1>; | 209 | #address-cells = <1>; |
| 210 | #size-cells = <0>; | 210 | #size-cells = <0>; |
| @@ -216,11 +216,11 @@ | |||
| 216 | }; | 216 | }; |
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | sata6: ahci@410000 { | 219 | sata6: ahci@120000 { |
| 220 | compatible = "brcm,iproc-ahci", "generic-ahci"; | 220 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 221 | reg = <0x00410000 0x1000>; | 221 | reg = <0x00120000 0x1000>; |
| 222 | reg-names = "ahci"; | 222 | reg-names = "ahci"; |
| 223 | interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>; | 223 | interrupts = <GIC_SPI 333 IRQ_TYPE_LEVEL_HIGH>; |
| 224 | #address-cells = <1>; | 224 | #address-cells = <1>; |
| 225 | #size-cells = <0>; | 225 | #size-cells = <0>; |
| 226 | status = "disabled"; | 226 | status = "disabled"; |
| @@ -232,9 +232,9 @@ | |||
| 232 | }; | 232 | }; |
| 233 | }; | 233 | }; |
| 234 | 234 | ||
| 235 | sata_phy6: sata_phy@412100 { | 235 | sata_phy6: sata_phy@122100 { |
| 236 | compatible = "brcm,iproc-sr-sata-phy"; | 236 | compatible = "brcm,iproc-sr-sata-phy"; |
| 237 | reg = <0x00412100 0x1000>; | 237 | reg = <0x00122100 0x1000>; |
| 238 | reg-names = "phy"; | 238 | reg-names = "phy"; |
| 239 | #address-cells = <1>; | 239 | #address-cells = <1>; |
| 240 | #size-cells = <0>; | 240 | #size-cells = <0>; |
| @@ -246,11 +246,11 @@ | |||
| 246 | }; | 246 | }; |
| 247 | }; | 247 | }; |
| 248 | 248 | ||
| 249 | sata7: ahci@420000 { | 249 | sata7: ahci@130000 { |
| 250 | compatible = "brcm,iproc-ahci", "generic-ahci"; | 250 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 251 | reg = <0x00420000 0x1000>; | 251 | reg = <0x00130000 0x1000>; |
| 252 | reg-names = "ahci"; | 252 | reg-names = "ahci"; |
| 253 | interrupts = <GIC_SPI 357 IRQ_TYPE_LEVEL_HIGH>; | 253 | interrupts = <GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>; |
| 254 | #address-cells = <1>; | 254 | #address-cells = <1>; |
| 255 | #size-cells = <0>; | 255 | #size-cells = <0>; |
| 256 | status = "disabled"; | 256 | status = "disabled"; |
| @@ -262,9 +262,9 @@ | |||
| 262 | }; | 262 | }; |
| 263 | }; | 263 | }; |
| 264 | 264 | ||
| 265 | sata_phy7: sata_phy@422100 { | 265 | sata_phy7: sata_phy@132100 { |
| 266 | compatible = "brcm,iproc-sr-sata-phy"; | 266 | compatible = "brcm,iproc-sr-sata-phy"; |
| 267 | reg = <0x00422100 0x1000>; | 267 | reg = <0x00132100 0x1000>; |
| 268 | reg-names = "phy"; | 268 | reg-names = "phy"; |
| 269 | #address-cells = <1>; | 269 | #address-cells = <1>; |
| 270 | #size-cells = <0>; | 270 | #size-cells = <0>; |
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index ab46bc70add6..469de8acd06f 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h | |||
| @@ -75,6 +75,9 @@ struct kvm_arch { | |||
| 75 | 75 | ||
| 76 | /* Interrupt controller */ | 76 | /* Interrupt controller */ |
| 77 | struct vgic_dist vgic; | 77 | struct vgic_dist vgic; |
| 78 | |||
| 79 | /* Mandated version of PSCI */ | ||
| 80 | u32 psci_version; | ||
| 78 | }; | 81 | }; |
| 79 | 82 | ||
| 80 | #define KVM_NR_MEM_OBJS 40 | 83 | #define KVM_NR_MEM_OBJS 40 |
diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h index b6dbbe3123a9..97d0ef12e2ff 100644 --- a/arch/arm64/include/asm/module.h +++ b/arch/arm64/include/asm/module.h | |||
| @@ -39,7 +39,7 @@ struct mod_arch_specific { | |||
| 39 | u64 module_emit_plt_entry(struct module *mod, void *loc, const Elf64_Rela *rela, | 39 | u64 module_emit_plt_entry(struct module *mod, void *loc, const Elf64_Rela *rela, |
| 40 | Elf64_Sym *sym); | 40 | Elf64_Sym *sym); |
| 41 | 41 | ||
| 42 | u64 module_emit_adrp_veneer(struct module *mod, void *loc, u64 val); | 42 | u64 module_emit_veneer_for_adrp(struct module *mod, void *loc, u64 val); |
| 43 | 43 | ||
| 44 | #ifdef CONFIG_RANDOMIZE_BASE | 44 | #ifdef CONFIG_RANDOMIZE_BASE |
| 45 | extern u64 module_alloc_base; | 45 | extern u64 module_alloc_base; |
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 7e2c27e63cd8..7c4c8f318ba9 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
| @@ -230,7 +230,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte) | |||
| 230 | } | 230 | } |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | extern void __sync_icache_dcache(pte_t pteval, unsigned long addr); | 233 | extern void __sync_icache_dcache(pte_t pteval); |
| 234 | 234 | ||
| 235 | /* | 235 | /* |
| 236 | * PTE bits configuration in the presence of hardware Dirty Bit Management | 236 | * PTE bits configuration in the presence of hardware Dirty Bit Management |
| @@ -253,7 +253,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
| 253 | pte_t old_pte; | 253 | pte_t old_pte; |
| 254 | 254 | ||
| 255 | if (pte_present(pte) && pte_user_exec(pte) && !pte_special(pte)) | 255 | if (pte_present(pte) && pte_user_exec(pte) && !pte_special(pte)) |
| 256 | __sync_icache_dcache(pte, addr); | 256 | __sync_icache_dcache(pte); |
| 257 | 257 | ||
| 258 | /* | 258 | /* |
| 259 | * If the existing pte is valid, check for potential race with | 259 | * If the existing pte is valid, check for potential race with |
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 9abbf3044654..04b3256f8e6d 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h | |||
| @@ -206,6 +206,12 @@ struct kvm_arch_memory_slot { | |||
| 206 | #define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) | 206 | #define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) |
| 207 | #define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) | 207 | #define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) |
| 208 | 208 | ||
| 209 | /* KVM-as-firmware specific pseudo-registers */ | ||
| 210 | #define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT) | ||
| 211 | #define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \ | ||
| 212 | KVM_REG_ARM_FW | ((r) & 0xffff)) | ||
| 213 | #define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) | ||
| 214 | |||
| 209 | /* Device Control API: ARM VGIC */ | 215 | /* Device Control API: ARM VGIC */ |
| 210 | #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 | 216 | #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 |
| 211 | #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 | 217 | #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 |
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 536d572e5596..9d1b06d67c53 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c | |||
| @@ -868,6 +868,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, | |||
| 868 | static const struct midr_range kpti_safe_list[] = { | 868 | static const struct midr_range kpti_safe_list[] = { |
| 869 | MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2), | 869 | MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2), |
| 870 | MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN), | 870 | MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN), |
| 871 | { /* sentinel */ } | ||
| 871 | }; | 872 | }; |
| 872 | char const *str = "command line option"; | 873 | char const *str = "command line option"; |
| 873 | 874 | ||
diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c index fa3637284a3d..f0690c2ca3e0 100644 --- a/arch/arm64/kernel/module-plts.c +++ b/arch/arm64/kernel/module-plts.c | |||
| @@ -43,7 +43,7 @@ u64 module_emit_plt_entry(struct module *mod, void *loc, const Elf64_Rela *rela, | |||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | #ifdef CONFIG_ARM64_ERRATUM_843419 | 45 | #ifdef CONFIG_ARM64_ERRATUM_843419 |
| 46 | u64 module_emit_adrp_veneer(struct module *mod, void *loc, u64 val) | 46 | u64 module_emit_veneer_for_adrp(struct module *mod, void *loc, u64 val) |
| 47 | { | 47 | { |
| 48 | struct mod_plt_sec *pltsec = !in_init(mod, loc) ? &mod->arch.core : | 48 | struct mod_plt_sec *pltsec = !in_init(mod, loc) ? &mod->arch.core : |
| 49 | &mod->arch.init; | 49 | &mod->arch.init; |
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c index 719fde8dcc19..155fd91e78f4 100644 --- a/arch/arm64/kernel/module.c +++ b/arch/arm64/kernel/module.c | |||
| @@ -215,7 +215,7 @@ static int reloc_insn_adrp(struct module *mod, __le32 *place, u64 val) | |||
| 215 | insn &= ~BIT(31); | 215 | insn &= ~BIT(31); |
| 216 | } else { | 216 | } else { |
| 217 | /* out of range for ADR -> emit a veneer */ | 217 | /* out of range for ADR -> emit a veneer */ |
| 218 | val = module_emit_adrp_veneer(mod, place, val & ~0xfff); | 218 | val = module_emit_veneer_for_adrp(mod, place, val & ~0xfff); |
| 219 | if (!val) | 219 | if (!val) |
| 220 | return -ENOEXEC; | 220 | return -ENOEXEC; |
| 221 | insn = aarch64_insn_gen_branch_imm((u64)place, val, | 221 | insn = aarch64_insn_gen_branch_imm((u64)place, val, |
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 71d99af24ef2..7ff81fed46e1 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/sched/signal.h> | 25 | #include <linux/sched/signal.h> |
| 26 | #include <linux/sched/task_stack.h> | 26 | #include <linux/sched/task_stack.h> |
| 27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
| 28 | #include <linux/nospec.h> | ||
| 28 | #include <linux/smp.h> | 29 | #include <linux/smp.h> |
| 29 | #include <linux/ptrace.h> | 30 | #include <linux/ptrace.h> |
| 30 | #include <linux/user.h> | 31 | #include <linux/user.h> |
| @@ -249,15 +250,20 @@ static struct perf_event *ptrace_hbp_get_event(unsigned int note_type, | |||
| 249 | 250 | ||
| 250 | switch (note_type) { | 251 | switch (note_type) { |
| 251 | case NT_ARM_HW_BREAK: | 252 | case NT_ARM_HW_BREAK: |
| 252 | if (idx < ARM_MAX_BRP) | 253 | if (idx >= ARM_MAX_BRP) |
| 253 | bp = tsk->thread.debug.hbp_break[idx]; | 254 | goto out; |
| 255 | idx = array_index_nospec(idx, ARM_MAX_BRP); | ||
| 256 | bp = tsk->thread.debug.hbp_break[idx]; | ||
| 254 | break; | 257 | break; |
| 255 | case NT_ARM_HW_WATCH: | 258 | case NT_ARM_HW_WATCH: |
| 256 | if (idx < ARM_MAX_WRP) | 259 | if (idx >= ARM_MAX_WRP) |
| 257 | bp = tsk->thread.debug.hbp_watch[idx]; | 260 | goto out; |
| 261 | idx = array_index_nospec(idx, ARM_MAX_WRP); | ||
| 262 | bp = tsk->thread.debug.hbp_watch[idx]; | ||
| 258 | break; | 263 | break; |
| 259 | } | 264 | } |
| 260 | 265 | ||
| 266 | out: | ||
| 261 | return bp; | 267 | return bp; |
| 262 | } | 268 | } |
| 263 | 269 | ||
| @@ -1458,9 +1464,7 @@ static int compat_ptrace_gethbpregs(struct task_struct *tsk, compat_long_t num, | |||
| 1458 | { | 1464 | { |
| 1459 | int ret; | 1465 | int ret; |
| 1460 | u32 kdata; | 1466 | u32 kdata; |
| 1461 | mm_segment_t old_fs = get_fs(); | ||
| 1462 | 1467 | ||
| 1463 | set_fs(KERNEL_DS); | ||
| 1464 | /* Watchpoint */ | 1468 | /* Watchpoint */ |
| 1465 | if (num < 0) { | 1469 | if (num < 0) { |
| 1466 | ret = compat_ptrace_hbp_get(NT_ARM_HW_WATCH, tsk, num, &kdata); | 1470 | ret = compat_ptrace_hbp_get(NT_ARM_HW_WATCH, tsk, num, &kdata); |
| @@ -1471,7 +1475,6 @@ static int compat_ptrace_gethbpregs(struct task_struct *tsk, compat_long_t num, | |||
| 1471 | } else { | 1475 | } else { |
| 1472 | ret = compat_ptrace_hbp_get(NT_ARM_HW_BREAK, tsk, num, &kdata); | 1476 | ret = compat_ptrace_hbp_get(NT_ARM_HW_BREAK, tsk, num, &kdata); |
| 1473 | } | 1477 | } |
| 1474 | set_fs(old_fs); | ||
| 1475 | 1478 | ||
| 1476 | if (!ret) | 1479 | if (!ret) |
| 1477 | ret = put_user(kdata, data); | 1480 | ret = put_user(kdata, data); |
| @@ -1484,7 +1487,6 @@ static int compat_ptrace_sethbpregs(struct task_struct *tsk, compat_long_t num, | |||
| 1484 | { | 1487 | { |
| 1485 | int ret; | 1488 | int ret; |
| 1486 | u32 kdata = 0; | 1489 | u32 kdata = 0; |
| 1487 | mm_segment_t old_fs = get_fs(); | ||
| 1488 | 1490 | ||
| 1489 | if (num == 0) | 1491 | if (num == 0) |
| 1490 | return 0; | 1492 | return 0; |
| @@ -1493,12 +1495,10 @@ static int compat_ptrace_sethbpregs(struct task_struct *tsk, compat_long_t num, | |||
| 1493 | if (ret) | 1495 | if (ret) |
| 1494 | return ret; | 1496 | return ret; |
| 1495 | 1497 | ||
| 1496 | set_fs(KERNEL_DS); | ||
| 1497 | if (num < 0) | 1498 | if (num < 0) |
| 1498 | ret = compat_ptrace_hbp_set(NT_ARM_HW_WATCH, tsk, num, &kdata); | 1499 | ret = compat_ptrace_hbp_set(NT_ARM_HW_WATCH, tsk, num, &kdata); |
| 1499 | else | 1500 | else |
| 1500 | ret = compat_ptrace_hbp_set(NT_ARM_HW_BREAK, tsk, num, &kdata); | 1501 | ret = compat_ptrace_hbp_set(NT_ARM_HW_BREAK, tsk, num, &kdata); |
| 1501 | set_fs(old_fs); | ||
| 1502 | 1502 | ||
| 1503 | return ret; | 1503 | return ret; |
| 1504 | } | 1504 | } |
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 1cb2749a72bf..8bbdc17e49df 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c | |||
| @@ -277,7 +277,8 @@ void arm64_skip_faulting_instruction(struct pt_regs *regs, unsigned long size) | |||
| 277 | * If we were single stepping, we want to get the step exception after | 277 | * If we were single stepping, we want to get the step exception after |
| 278 | * we return from the trap. | 278 | * we return from the trap. |
| 279 | */ | 279 | */ |
| 280 | user_fastforward_single_step(current); | 280 | if (user_mode(regs)) |
| 281 | user_fastforward_single_step(current); | ||
| 281 | } | 282 | } |
| 282 | 283 | ||
| 283 | static LIST_HEAD(undef_hook); | 284 | static LIST_HEAD(undef_hook); |
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 959e50d2588c..56a0260ceb11 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| 26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
| 27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
| 28 | #include <kvm/arm_psci.h> | ||
| 28 | #include <asm/cputype.h> | 29 | #include <asm/cputype.h> |
| 29 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
| 30 | #include <asm/kvm.h> | 31 | #include <asm/kvm.h> |
| @@ -205,7 +206,7 @@ static int get_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) | |||
| 205 | unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu) | 206 | unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu) |
| 206 | { | 207 | { |
| 207 | return num_core_regs() + kvm_arm_num_sys_reg_descs(vcpu) | 208 | return num_core_regs() + kvm_arm_num_sys_reg_descs(vcpu) |
| 208 | + NUM_TIMER_REGS; | 209 | + kvm_arm_get_fw_num_regs(vcpu) + NUM_TIMER_REGS; |
| 209 | } | 210 | } |
| 210 | 211 | ||
| 211 | /** | 212 | /** |
| @@ -225,6 +226,11 @@ int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices) | |||
| 225 | uindices++; | 226 | uindices++; |
| 226 | } | 227 | } |
| 227 | 228 | ||
| 229 | ret = kvm_arm_copy_fw_reg_indices(vcpu, uindices); | ||
| 230 | if (ret) | ||
| 231 | return ret; | ||
| 232 | uindices += kvm_arm_get_fw_num_regs(vcpu); | ||
| 233 | |||
| 228 | ret = copy_timer_indices(vcpu, uindices); | 234 | ret = copy_timer_indices(vcpu, uindices); |
| 229 | if (ret) | 235 | if (ret) |
| 230 | return ret; | 236 | return ret; |
| @@ -243,6 +249,9 @@ int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) | |||
| 243 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) | 249 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) |
| 244 | return get_core_reg(vcpu, reg); | 250 | return get_core_reg(vcpu, reg); |
| 245 | 251 | ||
| 252 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_FW) | ||
| 253 | return kvm_arm_get_fw_reg(vcpu, reg); | ||
| 254 | |||
| 246 | if (is_timer_reg(reg->id)) | 255 | if (is_timer_reg(reg->id)) |
| 247 | return get_timer_reg(vcpu, reg); | 256 | return get_timer_reg(vcpu, reg); |
| 248 | 257 | ||
| @@ -259,6 +268,9 @@ int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) | |||
| 259 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) | 268 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) |
| 260 | return set_core_reg(vcpu, reg); | 269 | return set_core_reg(vcpu, reg); |
| 261 | 270 | ||
| 271 | if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_FW) | ||
| 272 | return kvm_arm_set_fw_reg(vcpu, reg); | ||
| 273 | |||
| 262 | if (is_timer_reg(reg->id)) | 274 | if (is_timer_reg(reg->id)) |
| 263 | return set_timer_reg(vcpu, reg); | 275 | return set_timer_reg(vcpu, reg); |
| 264 | 276 | ||
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 806b0b126a64..6e3b969391fd 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c | |||
| @@ -996,14 +996,12 @@ static u64 read_id_reg(struct sys_reg_desc const *r, bool raz) | |||
| 996 | 996 | ||
| 997 | if (id == SYS_ID_AA64PFR0_EL1) { | 997 | if (id == SYS_ID_AA64PFR0_EL1) { |
| 998 | if (val & (0xfUL << ID_AA64PFR0_SVE_SHIFT)) | 998 | if (val & (0xfUL << ID_AA64PFR0_SVE_SHIFT)) |
| 999 | pr_err_once("kvm [%i]: SVE unsupported for guests, suppressing\n", | 999 | kvm_debug("SVE unsupported for guests, suppressing\n"); |
| 1000 | task_pid_nr(current)); | ||
| 1001 | 1000 | ||
| 1002 | val &= ~(0xfUL << ID_AA64PFR0_SVE_SHIFT); | 1001 | val &= ~(0xfUL << ID_AA64PFR0_SVE_SHIFT); |
| 1003 | } else if (id == SYS_ID_AA64MMFR1_EL1) { | 1002 | } else if (id == SYS_ID_AA64MMFR1_EL1) { |
| 1004 | if (val & (0xfUL << ID_AA64MMFR1_LOR_SHIFT)) | 1003 | if (val & (0xfUL << ID_AA64MMFR1_LOR_SHIFT)) |
| 1005 | pr_err_once("kvm [%i]: LORegions unsupported for guests, suppressing\n", | 1004 | kvm_debug("LORegions unsupported for guests, suppressing\n"); |
| 1006 | task_pid_nr(current)); | ||
| 1007 | 1005 | ||
| 1008 | val &= ~(0xfUL << ID_AA64MMFR1_LOR_SHIFT); | 1006 | val &= ~(0xfUL << ID_AA64MMFR1_LOR_SHIFT); |
| 1009 | } | 1007 | } |
diff --git a/arch/arm64/lib/Makefile b/arch/arm64/lib/Makefile index 0ead8a1d1679..137710f4dac3 100644 --- a/arch/arm64/lib/Makefile +++ b/arch/arm64/lib/Makefile | |||
| @@ -19,5 +19,9 @@ CFLAGS_atomic_ll_sc.o := -fcall-used-x0 -ffixed-x1 -ffixed-x2 \ | |||
| 19 | -fcall-saved-x13 -fcall-saved-x14 -fcall-saved-x15 \ | 19 | -fcall-saved-x13 -fcall-saved-x14 -fcall-saved-x15 \ |
| 20 | -fcall-saved-x18 -fomit-frame-pointer | 20 | -fcall-saved-x18 -fomit-frame-pointer |
| 21 | CFLAGS_REMOVE_atomic_ll_sc.o := -pg | 21 | CFLAGS_REMOVE_atomic_ll_sc.o := -pg |
| 22 | GCOV_PROFILE_atomic_ll_sc.o := n | ||
| 23 | KASAN_SANITIZE_atomic_ll_sc.o := n | ||
| 24 | KCOV_INSTRUMENT_atomic_ll_sc.o := n | ||
| 25 | UBSAN_SANITIZE_atomic_ll_sc.o := n | ||
| 22 | 26 | ||
| 23 | lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o | 27 | lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o |
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index e36ed5087b5c..1059884f9a6f 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c | |||
| @@ -58,7 +58,7 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, | |||
| 58 | flush_ptrace_access(vma, page, uaddr, dst, len); | 58 | flush_ptrace_access(vma, page, uaddr, dst, len); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | void __sync_icache_dcache(pte_t pte, unsigned long addr) | 61 | void __sync_icache_dcache(pte_t pte) |
| 62 | { | 62 | { |
| 63 | struct page *page = pte_page(pte); | 63 | struct page *page = pte_page(pte); |
| 64 | 64 | ||
diff --git a/arch/powerpc/include/asm/powernv.h b/arch/powerpc/include/asm/powernv.h index d1c2d2e658cf..2f3ff7a27881 100644 --- a/arch/powerpc/include/asm/powernv.h +++ b/arch/powerpc/include/asm/powernv.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | extern void powernv_set_nmmu_ptcr(unsigned long ptcr); | 15 | extern void powernv_set_nmmu_ptcr(unsigned long ptcr); |
| 16 | extern struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, | 16 | extern struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, |
| 17 | unsigned long flags, | 17 | unsigned long flags, |
| 18 | struct npu_context *(*cb)(struct npu_context *, void *), | 18 | void (*cb)(struct npu_context *, void *), |
| 19 | void *priv); | 19 | void *priv); |
| 20 | extern void pnv_npu2_destroy_context(struct npu_context *context, | 20 | extern void pnv_npu2_destroy_context(struct npu_context *context, |
| 21 | struct pci_dev *gpdev); | 21 | struct pci_dev *gpdev); |
diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c index fe6fc63251fe..38c5b4764bfe 100644 --- a/arch/powerpc/kernel/mce_power.c +++ b/arch/powerpc/kernel/mce_power.c | |||
| @@ -441,7 +441,6 @@ static int mce_handle_ierror(struct pt_regs *regs, | |||
| 441 | if (pfn != ULONG_MAX) { | 441 | if (pfn != ULONG_MAX) { |
| 442 | *phys_addr = | 442 | *phys_addr = |
| 443 | (pfn << PAGE_SHIFT); | 443 | (pfn << PAGE_SHIFT); |
| 444 | handled = 1; | ||
| 445 | } | 444 | } |
| 446 | } | 445 | } |
| 447 | } | 446 | } |
| @@ -532,9 +531,7 @@ static int mce_handle_derror(struct pt_regs *regs, | |||
| 532 | * kernel/exception-64s.h | 531 | * kernel/exception-64s.h |
| 533 | */ | 532 | */ |
| 534 | if (get_paca()->in_mce < MAX_MCE_DEPTH) | 533 | if (get_paca()->in_mce < MAX_MCE_DEPTH) |
| 535 | if (!mce_find_instr_ea_and_pfn(regs, addr, | 534 | mce_find_instr_ea_and_pfn(regs, addr, phys_addr); |
| 536 | phys_addr)) | ||
| 537 | handled = 1; | ||
| 538 | } | 535 | } |
| 539 | found = 1; | 536 | found = 1; |
| 540 | } | 537 | } |
| @@ -572,7 +569,7 @@ static long mce_handle_error(struct pt_regs *regs, | |||
| 572 | const struct mce_ierror_table itable[]) | 569 | const struct mce_ierror_table itable[]) |
| 573 | { | 570 | { |
| 574 | struct mce_error_info mce_err = { 0 }; | 571 | struct mce_error_info mce_err = { 0 }; |
| 575 | uint64_t addr, phys_addr; | 572 | uint64_t addr, phys_addr = ULONG_MAX; |
| 576 | uint64_t srr1 = regs->msr; | 573 | uint64_t srr1 = regs->msr; |
| 577 | long handled; | 574 | long handled; |
| 578 | 575 | ||
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index e16ec7b3b427..9ca7148b5881 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
| @@ -566,10 +566,35 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) | |||
| 566 | #endif | 566 | #endif |
| 567 | 567 | ||
| 568 | #ifdef CONFIG_NMI_IPI | 568 | #ifdef CONFIG_NMI_IPI |
| 569 | static void stop_this_cpu(struct pt_regs *regs) | 569 | static void nmi_stop_this_cpu(struct pt_regs *regs) |
| 570 | #else | 570 | { |
| 571 | /* | ||
| 572 | * This is a special case because it never returns, so the NMI IPI | ||
| 573 | * handling would never mark it as done, which makes any later | ||
| 574 | * smp_send_nmi_ipi() call spin forever. Mark it done now. | ||
| 575 | * | ||
| 576 | * IRQs are already hard disabled by the smp_handle_nmi_ipi. | ||
| 577 | */ | ||
| 578 | nmi_ipi_lock(); | ||
| 579 | nmi_ipi_busy_count--; | ||
| 580 | nmi_ipi_unlock(); | ||
| 581 | |||
| 582 | /* Remove this CPU */ | ||
| 583 | set_cpu_online(smp_processor_id(), false); | ||
| 584 | |||
| 585 | spin_begin(); | ||
| 586 | while (1) | ||
| 587 | spin_cpu_relax(); | ||
| 588 | } | ||
| 589 | |||
| 590 | void smp_send_stop(void) | ||
| 591 | { | ||
| 592 | smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, nmi_stop_this_cpu, 1000000); | ||
| 593 | } | ||
| 594 | |||
| 595 | #else /* CONFIG_NMI_IPI */ | ||
| 596 | |||
| 571 | static void stop_this_cpu(void *dummy) | 597 | static void stop_this_cpu(void *dummy) |
| 572 | #endif | ||
| 573 | { | 598 | { |
| 574 | /* Remove this CPU */ | 599 | /* Remove this CPU */ |
| 575 | set_cpu_online(smp_processor_id(), false); | 600 | set_cpu_online(smp_processor_id(), false); |
| @@ -582,12 +607,22 @@ static void stop_this_cpu(void *dummy) | |||
| 582 | 607 | ||
| 583 | void smp_send_stop(void) | 608 | void smp_send_stop(void) |
| 584 | { | 609 | { |
| 585 | #ifdef CONFIG_NMI_IPI | 610 | static bool stopped = false; |
| 586 | smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, stop_this_cpu, 1000000); | 611 | |
| 587 | #else | 612 | /* |
| 613 | * Prevent waiting on csd lock from a previous smp_send_stop. | ||
| 614 | * This is racy, but in general callers try to do the right | ||
| 615 | * thing and only fire off one smp_send_stop (e.g., see | ||
| 616 | * kernel/panic.c) | ||
| 617 | */ | ||
| 618 | if (stopped) | ||
| 619 | return; | ||
| 620 | |||
| 621 | stopped = true; | ||
| 622 | |||
| 588 | smp_call_function(stop_this_cpu, NULL, 0); | 623 | smp_call_function(stop_this_cpu, NULL, 0); |
| 589 | #endif | ||
| 590 | } | 624 | } |
| 625 | #endif /* CONFIG_NMI_IPI */ | ||
| 591 | 626 | ||
| 592 | struct thread_info *current_set[NR_CPUS]; | 627 | struct thread_info *current_set[NR_CPUS]; |
| 593 | 628 | ||
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 6038e2e7aee0..876d4f294fdd 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c | |||
| @@ -305,6 +305,13 @@ void kvmppc_core_queue_fpunavail(struct kvm_vcpu *vcpu) | |||
| 305 | kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_FP_UNAVAIL); | 305 | kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_FP_UNAVAIL); |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | #ifdef CONFIG_ALTIVEC | ||
| 309 | void kvmppc_core_queue_vec_unavail(struct kvm_vcpu *vcpu) | ||
| 310 | { | ||
| 311 | kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ALTIVEC_UNAVAIL); | ||
| 312 | } | ||
| 313 | #endif | ||
| 314 | |||
| 308 | void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu) | 315 | void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu) |
| 309 | { | 316 | { |
| 310 | kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DECREMENTER); | 317 | kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DECREMENTER); |
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 737f8a4632cc..c3c39b02b2ba 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
| @@ -133,6 +133,7 @@ int __meminit arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap * | |||
| 133 | start, start + size, rc); | 133 | start, start + size, rc); |
| 134 | return -EFAULT; | 134 | return -EFAULT; |
| 135 | } | 135 | } |
| 136 | flush_inval_dcache_range(start, start + size); | ||
| 136 | 137 | ||
| 137 | return __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock); | 138 | return __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock); |
| 138 | } | 139 | } |
| @@ -159,6 +160,7 @@ int __meminit arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap | |||
| 159 | 160 | ||
| 160 | /* Remove htab bolted mappings for this section of memory */ | 161 | /* Remove htab bolted mappings for this section of memory */ |
| 161 | start = (unsigned long)__va(start); | 162 | start = (unsigned long)__va(start); |
| 163 | flush_inval_dcache_range(start, start + size); | ||
| 162 | ret = remove_section_mapping(start, start + size); | 164 | ret = remove_section_mapping(start, start + size); |
| 163 | 165 | ||
| 164 | /* Ensure all vmalloc mappings are flushed in case they also | 166 | /* Ensure all vmalloc mappings are flushed in case they also |
diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c index de470caf0784..fc222a0c2ac4 100644 --- a/arch/powerpc/platforms/powernv/memtrace.c +++ b/arch/powerpc/platforms/powernv/memtrace.c | |||
| @@ -82,19 +82,6 @@ static const struct file_operations memtrace_fops = { | |||
| 82 | .open = simple_open, | 82 | .open = simple_open, |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | static void flush_memory_region(u64 base, u64 size) | ||
| 86 | { | ||
| 87 | unsigned long line_size = ppc64_caches.l1d.size; | ||
| 88 | u64 end = base + size; | ||
| 89 | u64 addr; | ||
| 90 | |||
| 91 | base = round_down(base, line_size); | ||
| 92 | end = round_up(end, line_size); | ||
| 93 | |||
| 94 | for (addr = base; addr < end; addr += line_size) | ||
| 95 | asm volatile("dcbf 0,%0" : "=r" (addr) :: "memory"); | ||
| 96 | } | ||
| 97 | |||
| 98 | static int check_memblock_online(struct memory_block *mem, void *arg) | 85 | static int check_memblock_online(struct memory_block *mem, void *arg) |
| 99 | { | 86 | { |
| 100 | if (mem->state != MEM_ONLINE) | 87 | if (mem->state != MEM_ONLINE) |
| @@ -132,10 +119,6 @@ static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages) | |||
| 132 | walk_memory_range(start_pfn, end_pfn, (void *)MEM_OFFLINE, | 119 | walk_memory_range(start_pfn, end_pfn, (void *)MEM_OFFLINE, |
| 133 | change_memblock_state); | 120 | change_memblock_state); |
| 134 | 121 | ||
| 135 | /* RCU grace period? */ | ||
| 136 | flush_memory_region((u64)__va(start_pfn << PAGE_SHIFT), | ||
| 137 | nr_pages << PAGE_SHIFT); | ||
| 138 | |||
| 139 | lock_device_hotplug(); | 122 | lock_device_hotplug(); |
| 140 | remove_memory(nid, start_pfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT); | 123 | remove_memory(nid, start_pfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT); |
| 141 | unlock_device_hotplug(); | 124 | unlock_device_hotplug(); |
diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c index 69a4f9e8bd55..525e966dce34 100644 --- a/arch/powerpc/platforms/powernv/npu-dma.c +++ b/arch/powerpc/platforms/powernv/npu-dma.c | |||
| @@ -34,6 +34,19 @@ | |||
| 34 | #define npu_to_phb(x) container_of(x, struct pnv_phb, npu) | 34 | #define npu_to_phb(x) container_of(x, struct pnv_phb, npu) |
| 35 | 35 | ||
| 36 | /* | 36 | /* |
| 37 | * spinlock to protect initialisation of an npu_context for a particular | ||
| 38 | * mm_struct. | ||
| 39 | */ | ||
| 40 | static DEFINE_SPINLOCK(npu_context_lock); | ||
| 41 | |||
| 42 | /* | ||
| 43 | * When an address shootdown range exceeds this threshold we invalidate the | ||
| 44 | * entire TLB on the GPU for the given PID rather than each specific address in | ||
| 45 | * the range. | ||
| 46 | */ | ||
| 47 | #define ATSD_THRESHOLD (2*1024*1024) | ||
| 48 | |||
| 49 | /* | ||
| 37 | * Other types of TCE cache invalidation are not functional in the | 50 | * Other types of TCE cache invalidation are not functional in the |
| 38 | * hardware. | 51 | * hardware. |
| 39 | */ | 52 | */ |
| @@ -401,7 +414,7 @@ struct npu_context { | |||
| 401 | bool nmmu_flush; | 414 | bool nmmu_flush; |
| 402 | 415 | ||
| 403 | /* Callback to stop translation requests on a given GPU */ | 416 | /* Callback to stop translation requests on a given GPU */ |
| 404 | struct npu_context *(*release_cb)(struct npu_context *, void *); | 417 | void (*release_cb)(struct npu_context *context, void *priv); |
| 405 | 418 | ||
| 406 | /* | 419 | /* |
| 407 | * Private pointer passed to the above callback for usage by | 420 | * Private pointer passed to the above callback for usage by |
| @@ -671,11 +684,19 @@ static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn, | |||
| 671 | struct npu_context *npu_context = mn_to_npu_context(mn); | 684 | struct npu_context *npu_context = mn_to_npu_context(mn); |
| 672 | unsigned long address; | 685 | unsigned long address; |
| 673 | 686 | ||
| 674 | for (address = start; address < end; address += PAGE_SIZE) | 687 | if (end - start > ATSD_THRESHOLD) { |
| 675 | mmio_invalidate(npu_context, 1, address, false); | 688 | /* |
| 689 | * Just invalidate the entire PID if the address range is too | ||
| 690 | * large. | ||
| 691 | */ | ||
| 692 | mmio_invalidate(npu_context, 0, 0, true); | ||
| 693 | } else { | ||
| 694 | for (address = start; address < end; address += PAGE_SIZE) | ||
| 695 | mmio_invalidate(npu_context, 1, address, false); | ||
| 676 | 696 | ||
| 677 | /* Do the flush only on the final addess == end */ | 697 | /* Do the flush only on the final addess == end */ |
| 678 | mmio_invalidate(npu_context, 1, address, true); | 698 | mmio_invalidate(npu_context, 1, address, true); |
| 699 | } | ||
| 679 | } | 700 | } |
| 680 | 701 | ||
| 681 | static const struct mmu_notifier_ops nv_nmmu_notifier_ops = { | 702 | static const struct mmu_notifier_ops nv_nmmu_notifier_ops = { |
| @@ -696,11 +717,12 @@ static const struct mmu_notifier_ops nv_nmmu_notifier_ops = { | |||
| 696 | * Returns an error if there no contexts are currently available or a | 717 | * Returns an error if there no contexts are currently available or a |
| 697 | * npu_context which should be passed to pnv_npu2_handle_fault(). | 718 | * npu_context which should be passed to pnv_npu2_handle_fault(). |
| 698 | * | 719 | * |
| 699 | * mmap_sem must be held in write mode. | 720 | * mmap_sem must be held in write mode and must not be called from interrupt |
| 721 | * context. | ||
| 700 | */ | 722 | */ |
| 701 | struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, | 723 | struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, |
| 702 | unsigned long flags, | 724 | unsigned long flags, |
| 703 | struct npu_context *(*cb)(struct npu_context *, void *), | 725 | void (*cb)(struct npu_context *, void *), |
| 704 | void *priv) | 726 | void *priv) |
| 705 | { | 727 | { |
| 706 | int rc; | 728 | int rc; |
| @@ -743,7 +765,9 @@ struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, | |||
| 743 | /* | 765 | /* |
| 744 | * Setup the NPU context table for a particular GPU. These need to be | 766 | * Setup the NPU context table for a particular GPU. These need to be |
| 745 | * per-GPU as we need the tables to filter ATSDs when there are no | 767 | * per-GPU as we need the tables to filter ATSDs when there are no |
| 746 | * active contexts on a particular GPU. | 768 | * active contexts on a particular GPU. It is safe for these to be |
| 769 | * called concurrently with destroy as the OPAL call takes appropriate | ||
| 770 | * locks and refcounts on init/destroy. | ||
| 747 | */ | 771 | */ |
| 748 | rc = opal_npu_init_context(nphb->opal_id, mm->context.id, flags, | 772 | rc = opal_npu_init_context(nphb->opal_id, mm->context.id, flags, |
| 749 | PCI_DEVID(gpdev->bus->number, gpdev->devfn)); | 773 | PCI_DEVID(gpdev->bus->number, gpdev->devfn)); |
| @@ -754,8 +778,29 @@ struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, | |||
| 754 | * We store the npu pci device so we can more easily get at the | 778 | * We store the npu pci device so we can more easily get at the |
| 755 | * associated npus. | 779 | * associated npus. |
| 756 | */ | 780 | */ |
| 781 | spin_lock(&npu_context_lock); | ||
| 757 | npu_context = mm->context.npu_context; | 782 | npu_context = mm->context.npu_context; |
| 783 | if (npu_context) { | ||
| 784 | if (npu_context->release_cb != cb || | ||
| 785 | npu_context->priv != priv) { | ||
| 786 | spin_unlock(&npu_context_lock); | ||
| 787 | opal_npu_destroy_context(nphb->opal_id, mm->context.id, | ||
| 788 | PCI_DEVID(gpdev->bus->number, | ||
| 789 | gpdev->devfn)); | ||
| 790 | return ERR_PTR(-EINVAL); | ||
| 791 | } | ||
| 792 | |||
| 793 | WARN_ON(!kref_get_unless_zero(&npu_context->kref)); | ||
| 794 | } | ||
| 795 | spin_unlock(&npu_context_lock); | ||
| 796 | |||
| 758 | if (!npu_context) { | 797 | if (!npu_context) { |
| 798 | /* | ||
| 799 | * We can set up these fields without holding the | ||
| 800 | * npu_context_lock as the npu_context hasn't been returned to | ||
| 801 | * the caller meaning it can't be destroyed. Parallel allocation | ||
| 802 | * is protected against by mmap_sem. | ||
| 803 | */ | ||
| 759 | rc = -ENOMEM; | 804 | rc = -ENOMEM; |
| 760 | npu_context = kzalloc(sizeof(struct npu_context), GFP_KERNEL); | 805 | npu_context = kzalloc(sizeof(struct npu_context), GFP_KERNEL); |
| 761 | if (npu_context) { | 806 | if (npu_context) { |
| @@ -774,8 +819,6 @@ struct npu_context *pnv_npu2_init_context(struct pci_dev *gpdev, | |||
| 774 | } | 819 | } |
| 775 | 820 | ||
| 776 | mm->context.npu_context = npu_context; | 821 | mm->context.npu_context = npu_context; |
| 777 | } else { | ||
| 778 | WARN_ON(!kref_get_unless_zero(&npu_context->kref)); | ||
| 779 | } | 822 | } |
| 780 | 823 | ||
| 781 | npu_context->release_cb = cb; | 824 | npu_context->release_cb = cb; |
| @@ -814,15 +857,16 @@ static void pnv_npu2_release_context(struct kref *kref) | |||
| 814 | mm_context_remove_copro(npu_context->mm); | 857 | mm_context_remove_copro(npu_context->mm); |
| 815 | 858 | ||
| 816 | npu_context->mm->context.npu_context = NULL; | 859 | npu_context->mm->context.npu_context = NULL; |
| 817 | mmu_notifier_unregister(&npu_context->mn, | ||
| 818 | npu_context->mm); | ||
| 819 | |||
| 820 | kfree(npu_context); | ||
| 821 | } | 860 | } |
| 822 | 861 | ||
| 862 | /* | ||
| 863 | * Destroy a context on the given GPU. May free the npu_context if it is no | ||
| 864 | * longer active on any GPUs. Must not be called from interrupt context. | ||
| 865 | */ | ||
| 823 | void pnv_npu2_destroy_context(struct npu_context *npu_context, | 866 | void pnv_npu2_destroy_context(struct npu_context *npu_context, |
| 824 | struct pci_dev *gpdev) | 867 | struct pci_dev *gpdev) |
| 825 | { | 868 | { |
| 869 | int removed; | ||
| 826 | struct pnv_phb *nphb; | 870 | struct pnv_phb *nphb; |
| 827 | struct npu *npu; | 871 | struct npu *npu; |
| 828 | struct pci_dev *npdev = pnv_pci_get_npu_dev(gpdev, 0); | 872 | struct pci_dev *npdev = pnv_pci_get_npu_dev(gpdev, 0); |
| @@ -844,7 +888,21 @@ void pnv_npu2_destroy_context(struct npu_context *npu_context, | |||
| 844 | WRITE_ONCE(npu_context->npdev[npu->index][nvlink_index], NULL); | 888 | WRITE_ONCE(npu_context->npdev[npu->index][nvlink_index], NULL); |
| 845 | opal_npu_destroy_context(nphb->opal_id, npu_context->mm->context.id, | 889 | opal_npu_destroy_context(nphb->opal_id, npu_context->mm->context.id, |
| 846 | PCI_DEVID(gpdev->bus->number, gpdev->devfn)); | 890 | PCI_DEVID(gpdev->bus->number, gpdev->devfn)); |
| 847 | kref_put(&npu_context->kref, pnv_npu2_release_context); | 891 | spin_lock(&npu_context_lock); |
| 892 | removed = kref_put(&npu_context->kref, pnv_npu2_release_context); | ||
| 893 | spin_unlock(&npu_context_lock); | ||
| 894 | |||
| 895 | /* | ||
| 896 | * We need to do this outside of pnv_npu2_release_context so that it is | ||
| 897 | * outside the spinlock as mmu_notifier_destroy uses SRCU. | ||
| 898 | */ | ||
| 899 | if (removed) { | ||
| 900 | mmu_notifier_unregister(&npu_context->mn, | ||
| 901 | npu_context->mm); | ||
| 902 | |||
| 903 | kfree(npu_context); | ||
| 904 | } | ||
| 905 | |||
| 848 | } | 906 | } |
| 849 | EXPORT_SYMBOL(pnv_npu2_destroy_context); | 907 | EXPORT_SYMBOL(pnv_npu2_destroy_context); |
| 850 | 908 | ||
diff --git a/arch/powerpc/platforms/powernv/opal-rtc.c b/arch/powerpc/platforms/powernv/opal-rtc.c index f8868864f373..aa2a5139462e 100644 --- a/arch/powerpc/platforms/powernv/opal-rtc.c +++ b/arch/powerpc/platforms/powernv/opal-rtc.c | |||
| @@ -48,10 +48,12 @@ unsigned long __init opal_get_boot_time(void) | |||
| 48 | 48 | ||
| 49 | while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { | 49 | while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { |
| 50 | rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); | 50 | rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); |
| 51 | if (rc == OPAL_BUSY_EVENT) | 51 | if (rc == OPAL_BUSY_EVENT) { |
| 52 | mdelay(OPAL_BUSY_DELAY_MS); | ||
| 52 | opal_poll_events(NULL); | 53 | opal_poll_events(NULL); |
| 53 | else if (rc == OPAL_BUSY) | 54 | } else if (rc == OPAL_BUSY) { |
| 54 | mdelay(10); | 55 | mdelay(OPAL_BUSY_DELAY_MS); |
| 56 | } | ||
| 55 | } | 57 | } |
| 56 | if (rc != OPAL_SUCCESS) | 58 | if (rc != OPAL_SUCCESS) |
| 57 | return 0; | 59 | return 0; |
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 23d8acca5c90..cd4fd85fde84 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig | |||
| @@ -11,6 +11,7 @@ config RISCV | |||
| 11 | select ARCH_WANT_FRAME_POINTERS | 11 | select ARCH_WANT_FRAME_POINTERS |
| 12 | select CLONE_BACKWARDS | 12 | select CLONE_BACKWARDS |
| 13 | select COMMON_CLK | 13 | select COMMON_CLK |
| 14 | select DMA_DIRECT_OPS | ||
| 14 | select GENERIC_CLOCKEVENTS | 15 | select GENERIC_CLOCKEVENTS |
| 15 | select GENERIC_CPU_DEVICES | 16 | select GENERIC_CPU_DEVICES |
| 16 | select GENERIC_IRQ_SHOW | 17 | select GENERIC_IRQ_SHOW |
| @@ -89,9 +90,6 @@ config PGTABLE_LEVELS | |||
| 89 | config HAVE_KPROBES | 90 | config HAVE_KPROBES |
| 90 | def_bool n | 91 | def_bool n |
| 91 | 92 | ||
| 92 | config DMA_DIRECT_OPS | ||
| 93 | def_bool y | ||
| 94 | |||
| 95 | menu "Platform type" | 93 | menu "Platform type" |
| 96 | 94 | ||
| 97 | choice | 95 | choice |
diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild index 1e5fd280fb4d..4286a5f83876 100644 --- a/arch/riscv/include/asm/Kbuild +++ b/arch/riscv/include/asm/Kbuild | |||
| @@ -15,7 +15,6 @@ generic-y += fcntl.h | |||
| 15 | generic-y += futex.h | 15 | generic-y += futex.h |
| 16 | generic-y += hardirq.h | 16 | generic-y += hardirq.h |
| 17 | generic-y += hash.h | 17 | generic-y += hash.h |
| 18 | generic-y += handle_irq.h | ||
| 19 | generic-y += hw_irq.h | 18 | generic-y += hw_irq.h |
| 20 | generic-y += ioctl.h | 19 | generic-y += ioctl.h |
| 21 | generic-y += ioctls.h | 20 | generic-y += ioctls.h |
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile index 324568d33921..f6561b783b61 100644 --- a/arch/riscv/kernel/vdso/Makefile +++ b/arch/riscv/kernel/vdso/Makefile | |||
| @@ -52,7 +52,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE | |||
| 52 | # Add -lgcc so rv32 gets static muldi3 and lshrdi3 definitions. | 52 | # Add -lgcc so rv32 gets static muldi3 and lshrdi3 definitions. |
| 53 | # Make sure only to export the intended __vdso_xxx symbol offsets. | 53 | # Make sure only to export the intended __vdso_xxx symbol offsets. |
| 54 | quiet_cmd_vdsold = VDSOLD $@ | 54 | quiet_cmd_vdsold = VDSOLD $@ |
| 55 | cmd_vdsold = $(CC) $(KCFLAGS) -nostdlib $(SYSCFLAGS_$(@F)) \ | 55 | cmd_vdsold = $(CC) $(KCFLAGS) $(call cc-option, -no-pie) -nostdlib $(SYSCFLAGS_$(@F)) \ |
| 56 | -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp -lgcc && \ | 56 | -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp -lgcc && \ |
| 57 | $(CROSS_COMPILE)objcopy \ | 57 | $(CROSS_COMPILE)objcopy \ |
| 58 | $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ | 58 | $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ |
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index 83ba57533ce6..3c883c368eb0 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h | |||
| @@ -45,6 +45,9 @@ struct thread_info { | |||
| 45 | void arch_release_task_struct(struct task_struct *tsk); | 45 | void arch_release_task_struct(struct task_struct *tsk); |
| 46 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); | 46 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); |
| 47 | 47 | ||
| 48 | void arch_setup_new_exec(void); | ||
| 49 | #define arch_setup_new_exec arch_setup_new_exec | ||
| 50 | |||
| 48 | #endif | 51 | #endif |
| 49 | 52 | ||
| 50 | /* | 53 | /* |
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index 5a83be955c70..0dc8ac8548ee 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c | |||
| @@ -465,11 +465,11 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
| 465 | apply_alternatives(aseg, aseg + s->sh_size); | 465 | apply_alternatives(aseg, aseg + s->sh_size); |
| 466 | 466 | ||
| 467 | if (IS_ENABLED(CONFIG_EXPOLINE) && | 467 | if (IS_ENABLED(CONFIG_EXPOLINE) && |
| 468 | (!strcmp(".nospec_call_table", secname))) | 468 | (!strncmp(".s390_indirect", secname, 14))) |
| 469 | nospec_revert(aseg, aseg + s->sh_size); | 469 | nospec_revert(aseg, aseg + s->sh_size); |
| 470 | 470 | ||
| 471 | if (IS_ENABLED(CONFIG_EXPOLINE) && | 471 | if (IS_ENABLED(CONFIG_EXPOLINE) && |
| 472 | (!strcmp(".nospec_return_table", secname))) | 472 | (!strncmp(".s390_return", secname, 12))) |
| 473 | nospec_revert(aseg, aseg + s->sh_size); | 473 | nospec_revert(aseg, aseg + s->sh_size); |
| 474 | } | 474 | } |
| 475 | 475 | ||
diff --git a/arch/s390/kernel/perf_cpum_cf_events.c b/arch/s390/kernel/perf_cpum_cf_events.c index 5ee27dc9a10c..feebb2944882 100644 --- a/arch/s390/kernel/perf_cpum_cf_events.c +++ b/arch/s390/kernel/perf_cpum_cf_events.c | |||
| @@ -123,7 +123,7 @@ CPUMF_EVENT_ATTR(cf_zec12, L1I_OFFBOOK_L3_SOURCED_WRITES_IV, 0x00a1); | |||
| 123 | CPUMF_EVENT_ATTR(cf_zec12, TX_NC_TABORT, 0x00b1); | 123 | CPUMF_EVENT_ATTR(cf_zec12, TX_NC_TABORT, 0x00b1); |
| 124 | CPUMF_EVENT_ATTR(cf_zec12, TX_C_TABORT_NO_SPECIAL, 0x00b2); | 124 | CPUMF_EVENT_ATTR(cf_zec12, TX_C_TABORT_NO_SPECIAL, 0x00b2); |
| 125 | CPUMF_EVENT_ATTR(cf_zec12, TX_C_TABORT_SPECIAL, 0x00b3); | 125 | CPUMF_EVENT_ATTR(cf_zec12, TX_C_TABORT_SPECIAL, 0x00b3); |
| 126 | CPUMF_EVENT_ATTR(cf_z13, L1D_WRITES_RO_EXCL, 0x0080); | 126 | CPUMF_EVENT_ATTR(cf_z13, L1D_RO_EXCL_WRITES, 0x0080); |
| 127 | CPUMF_EVENT_ATTR(cf_z13, DTLB1_WRITES, 0x0081); | 127 | CPUMF_EVENT_ATTR(cf_z13, DTLB1_WRITES, 0x0081); |
| 128 | CPUMF_EVENT_ATTR(cf_z13, DTLB1_MISSES, 0x0082); | 128 | CPUMF_EVENT_ATTR(cf_z13, DTLB1_MISSES, 0x0082); |
| 129 | CPUMF_EVENT_ATTR(cf_z13, DTLB1_HPAGE_WRITES, 0x0083); | 129 | CPUMF_EVENT_ATTR(cf_z13, DTLB1_HPAGE_WRITES, 0x0083); |
| @@ -179,7 +179,7 @@ CPUMF_EVENT_ATTR(cf_z13, TX_C_TABORT_NO_SPECIAL, 0x00db); | |||
| 179 | CPUMF_EVENT_ATTR(cf_z13, TX_C_TABORT_SPECIAL, 0x00dc); | 179 | CPUMF_EVENT_ATTR(cf_z13, TX_C_TABORT_SPECIAL, 0x00dc); |
| 180 | CPUMF_EVENT_ATTR(cf_z13, MT_DIAG_CYCLES_ONE_THR_ACTIVE, 0x01c0); | 180 | CPUMF_EVENT_ATTR(cf_z13, MT_DIAG_CYCLES_ONE_THR_ACTIVE, 0x01c0); |
| 181 | CPUMF_EVENT_ATTR(cf_z13, MT_DIAG_CYCLES_TWO_THR_ACTIVE, 0x01c1); | 181 | CPUMF_EVENT_ATTR(cf_z13, MT_DIAG_CYCLES_TWO_THR_ACTIVE, 0x01c1); |
| 182 | CPUMF_EVENT_ATTR(cf_z14, L1D_WRITES_RO_EXCL, 0x0080); | 182 | CPUMF_EVENT_ATTR(cf_z14, L1D_RO_EXCL_WRITES, 0x0080); |
| 183 | CPUMF_EVENT_ATTR(cf_z14, DTLB2_WRITES, 0x0081); | 183 | CPUMF_EVENT_ATTR(cf_z14, DTLB2_WRITES, 0x0081); |
| 184 | CPUMF_EVENT_ATTR(cf_z14, DTLB2_MISSES, 0x0082); | 184 | CPUMF_EVENT_ATTR(cf_z14, DTLB2_MISSES, 0x0082); |
| 185 | CPUMF_EVENT_ATTR(cf_z14, DTLB2_HPAGE_WRITES, 0x0083); | 185 | CPUMF_EVENT_ATTR(cf_z14, DTLB2_HPAGE_WRITES, 0x0083); |
| @@ -371,7 +371,7 @@ static struct attribute *cpumcf_zec12_pmu_event_attr[] __initdata = { | |||
| 371 | }; | 371 | }; |
| 372 | 372 | ||
| 373 | static struct attribute *cpumcf_z13_pmu_event_attr[] __initdata = { | 373 | static struct attribute *cpumcf_z13_pmu_event_attr[] __initdata = { |
| 374 | CPUMF_EVENT_PTR(cf_z13, L1D_WRITES_RO_EXCL), | 374 | CPUMF_EVENT_PTR(cf_z13, L1D_RO_EXCL_WRITES), |
| 375 | CPUMF_EVENT_PTR(cf_z13, DTLB1_WRITES), | 375 | CPUMF_EVENT_PTR(cf_z13, DTLB1_WRITES), |
| 376 | CPUMF_EVENT_PTR(cf_z13, DTLB1_MISSES), | 376 | CPUMF_EVENT_PTR(cf_z13, DTLB1_MISSES), |
| 377 | CPUMF_EVENT_PTR(cf_z13, DTLB1_HPAGE_WRITES), | 377 | CPUMF_EVENT_PTR(cf_z13, DTLB1_HPAGE_WRITES), |
| @@ -431,7 +431,7 @@ static struct attribute *cpumcf_z13_pmu_event_attr[] __initdata = { | |||
| 431 | }; | 431 | }; |
| 432 | 432 | ||
| 433 | static struct attribute *cpumcf_z14_pmu_event_attr[] __initdata = { | 433 | static struct attribute *cpumcf_z14_pmu_event_attr[] __initdata = { |
| 434 | CPUMF_EVENT_PTR(cf_z14, L1D_WRITES_RO_EXCL), | 434 | CPUMF_EVENT_PTR(cf_z14, L1D_RO_EXCL_WRITES), |
| 435 | CPUMF_EVENT_PTR(cf_z14, DTLB2_WRITES), | 435 | CPUMF_EVENT_PTR(cf_z14, DTLB2_WRITES), |
| 436 | CPUMF_EVENT_PTR(cf_z14, DTLB2_MISSES), | 436 | CPUMF_EVENT_PTR(cf_z14, DTLB2_MISSES), |
| 437 | CPUMF_EVENT_PTR(cf_z14, DTLB2_HPAGE_WRITES), | 437 | CPUMF_EVENT_PTR(cf_z14, DTLB2_HPAGE_WRITES), |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 70576a2f69cf..6e758bb6cd29 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/random.h> | 29 | #include <linux/random.h> |
| 30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
| 31 | #include <linux/init_task.h> | 31 | #include <linux/init_task.h> |
| 32 | #include <asm/cpu_mf.h> | ||
| 32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
| 33 | #include <asm/processor.h> | 34 | #include <asm/processor.h> |
| 34 | #include <asm/vtimer.h> | 35 | #include <asm/vtimer.h> |
| @@ -48,6 +49,15 @@ void flush_thread(void) | |||
| 48 | { | 49 | { |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 52 | void arch_setup_new_exec(void) | ||
| 53 | { | ||
| 54 | if (S390_lowcore.current_pid != current->pid) { | ||
| 55 | S390_lowcore.current_pid = current->pid; | ||
| 56 | if (test_facility(40)) | ||
| 57 | lpp(&S390_lowcore.lpp); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 51 | void arch_release_task_struct(struct task_struct *tsk) | 61 | void arch_release_task_struct(struct task_struct *tsk) |
| 52 | { | 62 | { |
| 53 | runtime_instr_release(tsk); | 63 | runtime_instr_release(tsk); |
diff --git a/arch/s390/kernel/uprobes.c b/arch/s390/kernel/uprobes.c index d9d1f512f019..5007fac01bb5 100644 --- a/arch/s390/kernel/uprobes.c +++ b/arch/s390/kernel/uprobes.c | |||
| @@ -150,6 +150,15 @@ unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline, | |||
| 150 | return orig; | 150 | return orig; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | bool arch_uretprobe_is_alive(struct return_instance *ret, enum rp_check ctx, | ||
| 154 | struct pt_regs *regs) | ||
| 155 | { | ||
| 156 | if (ctx == RP_CHECK_CHAIN_CALL) | ||
| 157 | return user_stack_pointer(regs) <= ret->stack; | ||
| 158 | else | ||
| 159 | return user_stack_pointer(regs) < ret->stack; | ||
| 160 | } | ||
| 161 | |||
| 153 | /* Instruction Emulation */ | 162 | /* Instruction Emulation */ |
| 154 | 163 | ||
| 155 | static void adjust_psw_addr(psw_t *psw, unsigned long len) | 164 | static void adjust_psw_addr(psw_t *psw, unsigned long len) |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 00fcf81f2c56..c07f492b871a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -52,6 +52,7 @@ config X86 | |||
| 52 | select ARCH_HAS_DEVMEM_IS_ALLOWED | 52 | select ARCH_HAS_DEVMEM_IS_ALLOWED |
| 53 | select ARCH_HAS_ELF_RANDOMIZE | 53 | select ARCH_HAS_ELF_RANDOMIZE |
| 54 | select ARCH_HAS_FAST_MULTIPLIER | 54 | select ARCH_HAS_FAST_MULTIPLIER |
| 55 | select ARCH_HAS_FILTER_PGPROT | ||
| 55 | select ARCH_HAS_FORTIFY_SOURCE | 56 | select ARCH_HAS_FORTIFY_SOURCE |
| 56 | select ARCH_HAS_GCOV_PROFILE_ALL | 57 | select ARCH_HAS_GCOV_PROFILE_ALL |
| 57 | select ARCH_HAS_KCOV if X86_64 | 58 | select ARCH_HAS_KCOV if X86_64 |
| @@ -273,6 +274,9 @@ config ARCH_HAS_CPU_RELAX | |||
| 273 | config ARCH_HAS_CACHE_LINE_SIZE | 274 | config ARCH_HAS_CACHE_LINE_SIZE |
| 274 | def_bool y | 275 | def_bool y |
| 275 | 276 | ||
| 277 | config ARCH_HAS_FILTER_PGPROT | ||
| 278 | def_bool y | ||
| 279 | |||
| 276 | config HAVE_SETUP_PER_CPU_AREA | 280 | config HAVE_SETUP_PER_CPU_AREA |
| 277 | def_bool y | 281 | def_bool y |
| 278 | 282 | ||
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S index 9af927e59d49..9de7f1e1dede 100644 --- a/arch/x86/entry/entry_64_compat.S +++ b/arch/x86/entry/entry_64_compat.S | |||
| @@ -84,13 +84,13 @@ ENTRY(entry_SYSENTER_compat) | |||
| 84 | pushq %rdx /* pt_regs->dx */ | 84 | pushq %rdx /* pt_regs->dx */ |
| 85 | pushq %rcx /* pt_regs->cx */ | 85 | pushq %rcx /* pt_regs->cx */ |
| 86 | pushq $-ENOSYS /* pt_regs->ax */ | 86 | pushq $-ENOSYS /* pt_regs->ax */ |
| 87 | pushq $0 /* pt_regs->r8 = 0 */ | 87 | pushq %r8 /* pt_regs->r8 */ |
| 88 | xorl %r8d, %r8d /* nospec r8 */ | 88 | xorl %r8d, %r8d /* nospec r8 */ |
| 89 | pushq $0 /* pt_regs->r9 = 0 */ | 89 | pushq %r9 /* pt_regs->r9 */ |
| 90 | xorl %r9d, %r9d /* nospec r9 */ | 90 | xorl %r9d, %r9d /* nospec r9 */ |
| 91 | pushq $0 /* pt_regs->r10 = 0 */ | 91 | pushq %r10 /* pt_regs->r10 */ |
| 92 | xorl %r10d, %r10d /* nospec r10 */ | 92 | xorl %r10d, %r10d /* nospec r10 */ |
| 93 | pushq $0 /* pt_regs->r11 = 0 */ | 93 | pushq %r11 /* pt_regs->r11 */ |
| 94 | xorl %r11d, %r11d /* nospec r11 */ | 94 | xorl %r11d, %r11d /* nospec r11 */ |
| 95 | pushq %rbx /* pt_regs->rbx */ | 95 | pushq %rbx /* pt_regs->rbx */ |
| 96 | xorl %ebx, %ebx /* nospec rbx */ | 96 | xorl %ebx, %ebx /* nospec rbx */ |
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 607bf565a90c..707b2a96e516 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
| @@ -3339,7 +3339,8 @@ static void intel_pmu_cpu_starting(int cpu) | |||
| 3339 | 3339 | ||
| 3340 | cpuc->lbr_sel = NULL; | 3340 | cpuc->lbr_sel = NULL; |
| 3341 | 3341 | ||
| 3342 | flip_smm_bit(&x86_pmu.attr_freeze_on_smi); | 3342 | if (x86_pmu.version > 1) |
| 3343 | flip_smm_bit(&x86_pmu.attr_freeze_on_smi); | ||
| 3343 | 3344 | ||
| 3344 | if (!cpuc->shared_regs) | 3345 | if (!cpuc->shared_regs) |
| 3345 | return; | 3346 | return; |
| @@ -3502,6 +3503,8 @@ static __initconst const struct x86_pmu core_pmu = { | |||
| 3502 | .cpu_dying = intel_pmu_cpu_dying, | 3503 | .cpu_dying = intel_pmu_cpu_dying, |
| 3503 | }; | 3504 | }; |
| 3504 | 3505 | ||
| 3506 | static struct attribute *intel_pmu_attrs[]; | ||
| 3507 | |||
| 3505 | static __initconst const struct x86_pmu intel_pmu = { | 3508 | static __initconst const struct x86_pmu intel_pmu = { |
| 3506 | .name = "Intel", | 3509 | .name = "Intel", |
| 3507 | .handle_irq = intel_pmu_handle_irq, | 3510 | .handle_irq = intel_pmu_handle_irq, |
| @@ -3533,6 +3536,8 @@ static __initconst const struct x86_pmu intel_pmu = { | |||
| 3533 | .format_attrs = intel_arch3_formats_attr, | 3536 | .format_attrs = intel_arch3_formats_attr, |
| 3534 | .events_sysfs_show = intel_event_sysfs_show, | 3537 | .events_sysfs_show = intel_event_sysfs_show, |
| 3535 | 3538 | ||
| 3539 | .attrs = intel_pmu_attrs, | ||
| 3540 | |||
| 3536 | .cpu_prepare = intel_pmu_cpu_prepare, | 3541 | .cpu_prepare = intel_pmu_cpu_prepare, |
| 3537 | .cpu_starting = intel_pmu_cpu_starting, | 3542 | .cpu_starting = intel_pmu_cpu_starting, |
| 3538 | .cpu_dying = intel_pmu_cpu_dying, | 3543 | .cpu_dying = intel_pmu_cpu_dying, |
| @@ -3911,8 +3916,6 @@ __init int intel_pmu_init(void) | |||
| 3911 | 3916 | ||
| 3912 | x86_pmu.max_pebs_events = min_t(unsigned, MAX_PEBS_EVENTS, x86_pmu.num_counters); | 3917 | x86_pmu.max_pebs_events = min_t(unsigned, MAX_PEBS_EVENTS, x86_pmu.num_counters); |
| 3913 | 3918 | ||
| 3914 | |||
| 3915 | x86_pmu.attrs = intel_pmu_attrs; | ||
| 3916 | /* | 3919 | /* |
| 3917 | * Quirk: v2 perfmon does not report fixed-purpose events, so | 3920 | * Quirk: v2 perfmon does not report fixed-purpose events, so |
| 3918 | * assume at least 3 events, when not running in a hypervisor: | 3921 | * assume at least 3 events, when not running in a hypervisor: |
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index d554c11e01ff..578793e97431 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h | |||
| @@ -320,6 +320,7 @@ | |||
| 320 | #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */ | 320 | #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */ |
| 321 | #define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ | 321 | #define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ |
| 322 | #define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ | 322 | #define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ |
| 323 | #define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ | ||
| 323 | 324 | ||
| 324 | /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ | 325 | /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ |
| 325 | #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ | 326 | #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ |
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index 09ad88572746..cc8f8fcf9b4a 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h | |||
| @@ -46,7 +46,21 @@ int ftrace_int3_handler(struct pt_regs *regs); | |||
| 46 | #endif /* CONFIG_FUNCTION_TRACER */ | 46 | #endif /* CONFIG_FUNCTION_TRACER */ |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | #if !defined(__ASSEMBLY__) && !defined(COMPILE_OFFSETS) | 49 | #ifndef __ASSEMBLY__ |
| 50 | |||
| 51 | #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME | ||
| 52 | static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) | ||
| 53 | { | ||
| 54 | /* | ||
| 55 | * Compare the symbol name with the system call name. Skip the | ||
| 56 | * "__x64_sys", "__ia32_sys" or simple "sys" prefix. | ||
| 57 | */ | ||
| 58 | return !strcmp(sym + 3, name + 3) || | ||
| 59 | (!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) || | ||
| 60 | (!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3)); | ||
| 61 | } | ||
| 62 | |||
| 63 | #ifndef COMPILE_OFFSETS | ||
| 50 | 64 | ||
| 51 | #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION) | 65 | #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION) |
| 52 | #include <asm/compat.h> | 66 | #include <asm/compat.h> |
| @@ -67,6 +81,7 @@ static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) | |||
| 67 | return false; | 81 | return false; |
| 68 | } | 82 | } |
| 69 | #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */ | 83 | #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */ |
| 70 | #endif /* !__ASSEMBLY__ && !COMPILE_OFFSETS */ | 84 | #endif /* !COMPILE_OFFSETS */ |
| 85 | #endif /* !__ASSEMBLY__ */ | ||
| 71 | 86 | ||
| 72 | #endif /* _ASM_X86_FTRACE_H */ | 87 | #endif /* _ASM_X86_FTRACE_H */ |
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h index 404c5fdff859..548d90bbf919 100644 --- a/arch/x86/include/asm/irq_vectors.h +++ b/arch/x86/include/asm/irq_vectors.h | |||
| @@ -34,11 +34,6 @@ | |||
| 34 | * (0x80 is the syscall vector, 0x30-0x3f are for ISA) | 34 | * (0x80 is the syscall vector, 0x30-0x3f are for ISA) |
| 35 | */ | 35 | */ |
| 36 | #define FIRST_EXTERNAL_VECTOR 0x20 | 36 | #define FIRST_EXTERNAL_VECTOR 0x20 |
| 37 | /* | ||
| 38 | * We start allocating at 0x21 to spread out vectors evenly between | ||
| 39 | * priority levels. (0x80 is the syscall vector) | ||
| 40 | */ | ||
| 41 | #define VECTOR_OFFSET_START 1 | ||
| 42 | 37 | ||
| 43 | /* | 38 | /* |
| 44 | * Reserve the lowest usable vector (and hence lowest priority) 0x20 for | 39 | * Reserve the lowest usable vector (and hence lowest priority) 0x20 for |
| @@ -119,8 +114,6 @@ | |||
| 119 | #define FIRST_SYSTEM_VECTOR NR_VECTORS | 114 | #define FIRST_SYSTEM_VECTOR NR_VECTORS |
| 120 | #endif | 115 | #endif |
| 121 | 116 | ||
| 122 | #define FPU_IRQ 13 | ||
| 123 | |||
| 124 | /* | 117 | /* |
| 125 | * Size the maximum number of interrupts. | 118 | * Size the maximum number of interrupts. |
| 126 | * | 119 | * |
diff --git a/arch/x86/include/asm/jailhouse_para.h b/arch/x86/include/asm/jailhouse_para.h index b885a961a150..a34897aef2c2 100644 --- a/arch/x86/include/asm/jailhouse_para.h +++ b/arch/x86/include/asm/jailhouse_para.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Jailhouse paravirt detection | 4 | * Jailhouse paravirt detection |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 5f49b4ff0c24..f1633de5a675 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
| @@ -601,6 +601,11 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) | |||
| 601 | 601 | ||
| 602 | #define canon_pgprot(p) __pgprot(massage_pgprot(p)) | 602 | #define canon_pgprot(p) __pgprot(massage_pgprot(p)) |
| 603 | 603 | ||
| 604 | static inline pgprot_t arch_filter_pgprot(pgprot_t prot) | ||
| 605 | { | ||
| 606 | return canon_pgprot(prot); | ||
| 607 | } | ||
| 608 | |||
| 604 | static inline int is_new_memtype_allowed(u64 paddr, unsigned long size, | 609 | static inline int is_new_memtype_allowed(u64 paddr, unsigned long size, |
| 605 | enum page_cache_mode pcm, | 610 | enum page_cache_mode pcm, |
| 606 | enum page_cache_mode new_pcm) | 611 | enum page_cache_mode new_pcm) |
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index d5c21a382475..adb47552e6bb 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h | |||
| @@ -105,14 +105,14 @@ extern unsigned int ptrs_per_p4d; | |||
| 105 | #define LDT_PGD_ENTRY (pgtable_l5_enabled ? LDT_PGD_ENTRY_L5 : LDT_PGD_ENTRY_L4) | 105 | #define LDT_PGD_ENTRY (pgtable_l5_enabled ? LDT_PGD_ENTRY_L5 : LDT_PGD_ENTRY_L4) |
| 106 | #define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) | 106 | #define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) |
| 107 | 107 | ||
| 108 | #define __VMALLOC_BASE_L4 0xffffc90000000000 | 108 | #define __VMALLOC_BASE_L4 0xffffc90000000000UL |
| 109 | #define __VMALLOC_BASE_L5 0xffa0000000000000 | 109 | #define __VMALLOC_BASE_L5 0xffa0000000000000UL |
| 110 | 110 | ||
| 111 | #define VMALLOC_SIZE_TB_L4 32UL | 111 | #define VMALLOC_SIZE_TB_L4 32UL |
| 112 | #define VMALLOC_SIZE_TB_L5 12800UL | 112 | #define VMALLOC_SIZE_TB_L5 12800UL |
| 113 | 113 | ||
| 114 | #define __VMEMMAP_BASE_L4 0xffffea0000000000 | 114 | #define __VMEMMAP_BASE_L4 0xffffea0000000000UL |
| 115 | #define __VMEMMAP_BASE_L5 0xffd4000000000000 | 115 | #define __VMEMMAP_BASE_L5 0xffd4000000000000UL |
| 116 | 116 | ||
| 117 | #ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT | 117 | #ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT |
| 118 | # define VMALLOC_START vmalloc_base | 118 | # define VMALLOC_START vmalloc_base |
diff --git a/arch/x86/include/uapi/asm/msgbuf.h b/arch/x86/include/uapi/asm/msgbuf.h index 809134c644a6..90ab9a795b49 100644 --- a/arch/x86/include/uapi/asm/msgbuf.h +++ b/arch/x86/include/uapi/asm/msgbuf.h | |||
| @@ -1 +1,32 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | #ifndef __ASM_X64_MSGBUF_H | ||
| 3 | #define __ASM_X64_MSGBUF_H | ||
| 4 | |||
| 5 | #if !defined(__x86_64__) || !defined(__ILP32__) | ||
| 1 | #include <asm-generic/msgbuf.h> | 6 | #include <asm-generic/msgbuf.h> |
| 7 | #else | ||
| 8 | /* | ||
| 9 | * The msqid64_ds structure for x86 architecture with x32 ABI. | ||
| 10 | * | ||
| 11 | * On x86-32 and x86-64 we can just use the generic definition, but | ||
| 12 | * x32 uses the same binary layout as x86_64, which is differnet | ||
| 13 | * from other 32-bit architectures. | ||
| 14 | */ | ||
| 15 | |||
| 16 | struct msqid64_ds { | ||
| 17 | struct ipc64_perm msg_perm; | ||
| 18 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
| 19 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
| 20 | __kernel_time_t msg_ctime; /* last change time */ | ||
| 21 | __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */ | ||
| 22 | __kernel_ulong_t msg_qnum; /* number of messages in queue */ | ||
| 23 | __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */ | ||
| 24 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
| 25 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
| 26 | __kernel_ulong_t __unused4; | ||
| 27 | __kernel_ulong_t __unused5; | ||
| 28 | }; | ||
| 29 | |||
| 30 | #endif | ||
| 31 | |||
| 32 | #endif /* __ASM_GENERIC_MSGBUF_H */ | ||
diff --git a/arch/x86/include/uapi/asm/shmbuf.h b/arch/x86/include/uapi/asm/shmbuf.h index 83c05fc2de38..644421f3823b 100644 --- a/arch/x86/include/uapi/asm/shmbuf.h +++ b/arch/x86/include/uapi/asm/shmbuf.h | |||
| @@ -1 +1,43 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | #ifndef __ASM_X86_SHMBUF_H | ||
| 3 | #define __ASM_X86_SHMBUF_H | ||
| 4 | |||
| 5 | #if !defined(__x86_64__) || !defined(__ILP32__) | ||
| 1 | #include <asm-generic/shmbuf.h> | 6 | #include <asm-generic/shmbuf.h> |
| 7 | #else | ||
| 8 | /* | ||
| 9 | * The shmid64_ds structure for x86 architecture with x32 ABI. | ||
| 10 | * | ||
| 11 | * On x86-32 and x86-64 we can just use the generic definition, but | ||
| 12 | * x32 uses the same binary layout as x86_64, which is differnet | ||
| 13 | * from other 32-bit architectures. | ||
| 14 | */ | ||
| 15 | |||
| 16 | struct shmid64_ds { | ||
| 17 | struct ipc64_perm shm_perm; /* operation perms */ | ||
| 18 | size_t shm_segsz; /* size of segment (bytes) */ | ||
| 19 | __kernel_time_t shm_atime; /* last attach time */ | ||
| 20 | __kernel_time_t shm_dtime; /* last detach time */ | ||
| 21 | __kernel_time_t shm_ctime; /* last change time */ | ||
| 22 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
| 23 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
| 24 | __kernel_ulong_t shm_nattch; /* no. of current attaches */ | ||
| 25 | __kernel_ulong_t __unused4; | ||
| 26 | __kernel_ulong_t __unused5; | ||
| 27 | }; | ||
| 28 | |||
| 29 | struct shminfo64 { | ||
| 30 | __kernel_ulong_t shmmax; | ||
| 31 | __kernel_ulong_t shmmin; | ||
| 32 | __kernel_ulong_t shmmni; | ||
| 33 | __kernel_ulong_t shmseg; | ||
| 34 | __kernel_ulong_t shmall; | ||
| 35 | __kernel_ulong_t __unused1; | ||
| 36 | __kernel_ulong_t __unused2; | ||
| 37 | __kernel_ulong_t __unused3; | ||
| 38 | __kernel_ulong_t __unused4; | ||
| 39 | }; | ||
| 40 | |||
| 41 | #endif | ||
| 42 | |||
| 43 | #endif /* __ASM_X86_SHMBUF_H */ | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index b9693b80fc21..60d1897041da 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
| @@ -835,6 +835,9 @@ static const struct _tlb_table intel_tlb_table[] = { | |||
| 835 | { 0x5d, TLB_DATA_4K_4M, 256, " TLB_DATA 4 KByte and 4 MByte pages" }, | 835 | { 0x5d, TLB_DATA_4K_4M, 256, " TLB_DATA 4 KByte and 4 MByte pages" }, |
| 836 | { 0x61, TLB_INST_4K, 48, " TLB_INST 4 KByte pages, full associative" }, | 836 | { 0x61, TLB_INST_4K, 48, " TLB_INST 4 KByte pages, full associative" }, |
| 837 | { 0x63, TLB_DATA_1G, 4, " TLB_DATA 1 GByte pages, 4-way set associative" }, | 837 | { 0x63, TLB_DATA_1G, 4, " TLB_DATA 1 GByte pages, 4-way set associative" }, |
| 838 | { 0x6b, TLB_DATA_4K, 256, " TLB_DATA 4 KByte pages, 8-way associative" }, | ||
| 839 | { 0x6c, TLB_DATA_2M_4M, 128, " TLB_DATA 2 MByte or 4 MByte pages, 8-way associative" }, | ||
| 840 | { 0x6d, TLB_DATA_1G, 16, " TLB_DATA 1 GByte pages, fully associative" }, | ||
| 838 | { 0x76, TLB_INST_2M_4M, 8, " TLB_INST 2-MByte or 4-MByte pages, fully associative" }, | 841 | { 0x76, TLB_INST_2M_4M, 8, " TLB_INST 2-MByte or 4-MByte pages, fully associative" }, |
| 839 | { 0xb0, TLB_INST_4K, 128, " TLB_INST 4 KByte pages, 4-way set associative" }, | 842 | { 0xb0, TLB_INST_4K, 128, " TLB_INST 4 KByte pages, 4-way set associative" }, |
| 840 | { 0xb1, TLB_INST_2M_4M, 4, " TLB_INST 2M pages, 4-way, 8 entries or 4M pages, 4-way entries" }, | 843 | { 0xb1, TLB_INST_2M_4M, 4, " TLB_INST 2M pages, 4-way, 8 entries or 4M pages, 4-way entries" }, |
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 10c4fc2c91f8..77e201301528 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c | |||
| @@ -564,14 +564,12 @@ static int __reload_late(void *info) | |||
| 564 | apply_microcode_local(&err); | 564 | apply_microcode_local(&err); |
| 565 | spin_unlock(&update_lock); | 565 | spin_unlock(&update_lock); |
| 566 | 566 | ||
| 567 | /* siblings return UCODE_OK because their engine got updated already */ | ||
| 567 | if (err > UCODE_NFOUND) { | 568 | if (err > UCODE_NFOUND) { |
| 568 | pr_warn("Error reloading microcode on CPU %d\n", cpu); | 569 | pr_warn("Error reloading microcode on CPU %d\n", cpu); |
| 569 | return -1; | 570 | ret = -1; |
| 570 | /* siblings return UCODE_OK because their engine got updated already */ | ||
| 571 | } else if (err == UCODE_UPDATED || err == UCODE_OK) { | 571 | } else if (err == UCODE_UPDATED || err == UCODE_OK) { |
| 572 | ret = 1; | 572 | ret = 1; |
| 573 | } else { | ||
| 574 | return ret; | ||
| 575 | } | 573 | } |
| 576 | 574 | ||
| 577 | /* | 575 | /* |
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 32b8e5724f96..1c2cfa0644aa 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c | |||
| @@ -485,7 +485,6 @@ static void show_saved_mc(void) | |||
| 485 | */ | 485 | */ |
| 486 | static void save_mc_for_early(u8 *mc, unsigned int size) | 486 | static void save_mc_for_early(u8 *mc, unsigned int size) |
| 487 | { | 487 | { |
| 488 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 489 | /* Synchronization during CPU hotplug. */ | 488 | /* Synchronization during CPU hotplug. */ |
| 490 | static DEFINE_MUTEX(x86_cpu_microcode_mutex); | 489 | static DEFINE_MUTEX(x86_cpu_microcode_mutex); |
| 491 | 490 | ||
| @@ -495,7 +494,6 @@ static void save_mc_for_early(u8 *mc, unsigned int size) | |||
| 495 | show_saved_mc(); | 494 | show_saved_mc(); |
| 496 | 495 | ||
| 497 | mutex_unlock(&x86_cpu_microcode_mutex); | 496 | mutex_unlock(&x86_cpu_microcode_mutex); |
| 498 | #endif | ||
| 499 | } | 497 | } |
| 500 | 498 | ||
| 501 | static bool load_builtin_intel_microcode(struct cpio_data *cp) | 499 | static bool load_builtin_intel_microcode(struct cpio_data *cp) |
diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c index fa183a131edc..a15fe0e92cf9 100644 --- a/arch/x86/kernel/jailhouse.c +++ b/arch/x86/kernel/jailhouse.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Jailhouse paravirt_ops implementation | 3 | * Jailhouse paravirt_ops implementation |
| 4 | * | 4 | * |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 6285697b6e56..5c623dfe39d1 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <linux/init_ohci1394_dma.h> | 50 | #include <linux/init_ohci1394_dma.h> |
| 51 | #include <linux/kvm_para.h> | 51 | #include <linux/kvm_para.h> |
| 52 | #include <linux/dma-contiguous.h> | 52 | #include <linux/dma-contiguous.h> |
| 53 | #include <xen/xen.h> | ||
| 53 | 54 | ||
| 54 | #include <linux/errno.h> | 55 | #include <linux/errno.h> |
| 55 | #include <linux/kernel.h> | 56 | #include <linux/kernel.h> |
| @@ -534,6 +535,11 @@ static void __init reserve_crashkernel(void) | |||
| 534 | high = true; | 535 | high = true; |
| 535 | } | 536 | } |
| 536 | 537 | ||
| 538 | if (xen_pv_domain()) { | ||
| 539 | pr_info("Ignoring crashkernel for a Xen PV domain\n"); | ||
| 540 | return; | ||
| 541 | } | ||
| 542 | |||
| 537 | /* 0 means: find the address automatically */ | 543 | /* 0 means: find the address automatically */ |
| 538 | if (crash_base <= 0) { | 544 | if (crash_base <= 0) { |
| 539 | /* | 545 | /* |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 45175b81dd5b..0f1cbb042f49 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
| @@ -1571,6 +1571,8 @@ static inline void mwait_play_dead(void) | |||
| 1571 | void *mwait_ptr; | 1571 | void *mwait_ptr; |
| 1572 | int i; | 1572 | int i; |
| 1573 | 1573 | ||
| 1574 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) | ||
| 1575 | return; | ||
| 1574 | if (!this_cpu_has(X86_FEATURE_MWAIT)) | 1576 | if (!this_cpu_has(X86_FEATURE_MWAIT)) |
| 1575 | return; | 1577 | return; |
| 1576 | if (!this_cpu_has(X86_FEATURE_CLFLUSH)) | 1578 | if (!this_cpu_has(X86_FEATURE_CLFLUSH)) |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index aa66ccd6ed6c..c7668806163f 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
| @@ -4544,12 +4544,6 @@ static void vmx_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa) | |||
| 4544 | __vmx_flush_tlb(vcpu, to_vmx(vcpu)->vpid, invalidate_gpa); | 4544 | __vmx_flush_tlb(vcpu, to_vmx(vcpu)->vpid, invalidate_gpa); |
| 4545 | } | 4545 | } |
| 4546 | 4546 | ||
| 4547 | static void vmx_flush_tlb_ept_only(struct kvm_vcpu *vcpu) | ||
| 4548 | { | ||
| 4549 | if (enable_ept) | ||
| 4550 | vmx_flush_tlb(vcpu, true); | ||
| 4551 | } | ||
| 4552 | |||
| 4553 | static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu) | 4547 | static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu) |
| 4554 | { | 4548 | { |
| 4555 | ulong cr0_guest_owned_bits = vcpu->arch.cr0_guest_owned_bits; | 4549 | ulong cr0_guest_owned_bits = vcpu->arch.cr0_guest_owned_bits; |
| @@ -9278,7 +9272,7 @@ static void vmx_set_virtual_x2apic_mode(struct kvm_vcpu *vcpu, bool set) | |||
| 9278 | } else { | 9272 | } else { |
| 9279 | sec_exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE; | 9273 | sec_exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE; |
| 9280 | sec_exec_control |= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; | 9274 | sec_exec_control |= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; |
| 9281 | vmx_flush_tlb_ept_only(vcpu); | 9275 | vmx_flush_tlb(vcpu, true); |
| 9282 | } | 9276 | } |
| 9283 | vmcs_write32(SECONDARY_VM_EXEC_CONTROL, sec_exec_control); | 9277 | vmcs_write32(SECONDARY_VM_EXEC_CONTROL, sec_exec_control); |
| 9284 | 9278 | ||
| @@ -9306,7 +9300,7 @@ static void vmx_set_apic_access_page_addr(struct kvm_vcpu *vcpu, hpa_t hpa) | |||
| 9306 | !nested_cpu_has2(get_vmcs12(&vmx->vcpu), | 9300 | !nested_cpu_has2(get_vmcs12(&vmx->vcpu), |
| 9307 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) { | 9301 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) { |
| 9308 | vmcs_write64(APIC_ACCESS_ADDR, hpa); | 9302 | vmcs_write64(APIC_ACCESS_ADDR, hpa); |
| 9309 | vmx_flush_tlb_ept_only(vcpu); | 9303 | vmx_flush_tlb(vcpu, true); |
| 9310 | } | 9304 | } |
| 9311 | } | 9305 | } |
| 9312 | 9306 | ||
| @@ -11220,7 +11214,7 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, | |||
| 11220 | } | 11214 | } |
| 11221 | } else if (nested_cpu_has2(vmcs12, | 11215 | } else if (nested_cpu_has2(vmcs12, |
| 11222 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) { | 11216 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) { |
| 11223 | vmx_flush_tlb_ept_only(vcpu); | 11217 | vmx_flush_tlb(vcpu, true); |
| 11224 | } | 11218 | } |
| 11225 | 11219 | ||
| 11226 | /* | 11220 | /* |
| @@ -12073,7 +12067,7 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, | |||
| 12073 | } else if (!nested_cpu_has_ept(vmcs12) && | 12067 | } else if (!nested_cpu_has_ept(vmcs12) && |
| 12074 | nested_cpu_has2(vmcs12, | 12068 | nested_cpu_has2(vmcs12, |
| 12075 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) { | 12069 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) { |
| 12076 | vmx_flush_tlb_ept_only(vcpu); | 12070 | vmx_flush_tlb(vcpu, true); |
| 12077 | } | 12071 | } |
| 12078 | 12072 | ||
| 12079 | /* This is needed for same reason as it was needed in prepare_vmcs02 */ | 12073 | /* This is needed for same reason as it was needed in prepare_vmcs02 */ |
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 7d35ce672989..c9492f764902 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h | |||
| @@ -302,13 +302,6 @@ static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec) | |||
| 302 | __rem; \ | 302 | __rem; \ |
| 303 | }) | 303 | }) |
| 304 | 304 | ||
| 305 | #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) | ||
| 306 | #define KVM_X86_DISABLE_EXITS_HTL (1 << 1) | ||
| 307 | #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) | ||
| 308 | #define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \ | ||
| 309 | KVM_X86_DISABLE_EXITS_HTL | \ | ||
| 310 | KVM_X86_DISABLE_EXITS_PAUSE) | ||
| 311 | |||
| 312 | static inline bool kvm_mwait_in_guest(struct kvm *kvm) | 305 | static inline bool kvm_mwait_in_guest(struct kvm *kvm) |
| 313 | { | 306 | { |
| 314 | return kvm->arch.mwait_in_guest; | 307 | return kvm->arch.mwait_in_guest; |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 0f3d50f4c48c..3bded76e8d5c 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
| @@ -93,6 +93,18 @@ void arch_report_meminfo(struct seq_file *m) | |||
| 93 | static inline void split_page_count(int level) { } | 93 | static inline void split_page_count(int level) { } |
| 94 | #endif | 94 | #endif |
| 95 | 95 | ||
| 96 | static inline int | ||
| 97 | within(unsigned long addr, unsigned long start, unsigned long end) | ||
| 98 | { | ||
| 99 | return addr >= start && addr < end; | ||
| 100 | } | ||
| 101 | |||
| 102 | static inline int | ||
| 103 | within_inclusive(unsigned long addr, unsigned long start, unsigned long end) | ||
| 104 | { | ||
| 105 | return addr >= start && addr <= end; | ||
| 106 | } | ||
| 107 | |||
| 96 | #ifdef CONFIG_X86_64 | 108 | #ifdef CONFIG_X86_64 |
| 97 | 109 | ||
| 98 | static inline unsigned long highmap_start_pfn(void) | 110 | static inline unsigned long highmap_start_pfn(void) |
| @@ -106,20 +118,25 @@ static inline unsigned long highmap_end_pfn(void) | |||
| 106 | return __pa_symbol(roundup(_brk_end, PMD_SIZE) - 1) >> PAGE_SHIFT; | 118 | return __pa_symbol(roundup(_brk_end, PMD_SIZE) - 1) >> PAGE_SHIFT; |
| 107 | } | 119 | } |
| 108 | 120 | ||
| 109 | #endif | 121 | static bool __cpa_pfn_in_highmap(unsigned long pfn) |
| 110 | |||
| 111 | static inline int | ||
| 112 | within(unsigned long addr, unsigned long start, unsigned long end) | ||
| 113 | { | 122 | { |
| 114 | return addr >= start && addr < end; | 123 | /* |
| 124 | * Kernel text has an alias mapping at a high address, known | ||
| 125 | * here as "highmap". | ||
| 126 | */ | ||
| 127 | return within_inclusive(pfn, highmap_start_pfn(), highmap_end_pfn()); | ||
| 115 | } | 128 | } |
| 116 | 129 | ||
| 117 | static inline int | 130 | #else |
| 118 | within_inclusive(unsigned long addr, unsigned long start, unsigned long end) | 131 | |
| 132 | static bool __cpa_pfn_in_highmap(unsigned long pfn) | ||
| 119 | { | 133 | { |
| 120 | return addr >= start && addr <= end; | 134 | /* There is no highmap on 32-bit */ |
| 135 | return false; | ||
| 121 | } | 136 | } |
| 122 | 137 | ||
| 138 | #endif | ||
| 139 | |||
| 123 | /* | 140 | /* |
| 124 | * Flushing functions | 141 | * Flushing functions |
| 125 | */ | 142 | */ |
| @@ -172,7 +189,7 @@ static void __cpa_flush_all(void *arg) | |||
| 172 | 189 | ||
| 173 | static void cpa_flush_all(unsigned long cache) | 190 | static void cpa_flush_all(unsigned long cache) |
| 174 | { | 191 | { |
| 175 | BUG_ON(irqs_disabled()); | 192 | BUG_ON(irqs_disabled() && !early_boot_irqs_disabled); |
| 176 | 193 | ||
| 177 | on_each_cpu(__cpa_flush_all, (void *) cache, 1); | 194 | on_each_cpu(__cpa_flush_all, (void *) cache, 1); |
| 178 | } | 195 | } |
| @@ -236,7 +253,7 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache, | |||
| 236 | unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */ | 253 | unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */ |
| 237 | #endif | 254 | #endif |
| 238 | 255 | ||
| 239 | BUG_ON(irqs_disabled()); | 256 | BUG_ON(irqs_disabled() && !early_boot_irqs_disabled); |
| 240 | 257 | ||
| 241 | on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1); | 258 | on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1); |
| 242 | 259 | ||
| @@ -1183,6 +1200,10 @@ static int __cpa_process_fault(struct cpa_data *cpa, unsigned long vaddr, | |||
| 1183 | cpa->numpages = 1; | 1200 | cpa->numpages = 1; |
| 1184 | cpa->pfn = __pa(vaddr) >> PAGE_SHIFT; | 1201 | cpa->pfn = __pa(vaddr) >> PAGE_SHIFT; |
| 1185 | return 0; | 1202 | return 0; |
| 1203 | |||
| 1204 | } else if (__cpa_pfn_in_highmap(cpa->pfn)) { | ||
| 1205 | /* Faults in the highmap are OK, so do not warn: */ | ||
| 1206 | return -EFAULT; | ||
| 1186 | } else { | 1207 | } else { |
| 1187 | WARN(1, KERN_WARNING "CPA: called for zero pte. " | 1208 | WARN(1, KERN_WARNING "CPA: called for zero pte. " |
| 1188 | "vaddr = %lx cpa->vaddr = %lx\n", vaddr, | 1209 | "vaddr = %lx cpa->vaddr = %lx\n", vaddr, |
| @@ -1335,8 +1356,7 @@ static int cpa_process_alias(struct cpa_data *cpa) | |||
| 1335 | * to touch the high mapped kernel as well: | 1356 | * to touch the high mapped kernel as well: |
| 1336 | */ | 1357 | */ |
| 1337 | if (!within(vaddr, (unsigned long)_text, _brk_end) && | 1358 | if (!within(vaddr, (unsigned long)_text, _brk_end) && |
| 1338 | within_inclusive(cpa->pfn, highmap_start_pfn(), | 1359 | __cpa_pfn_in_highmap(cpa->pfn)) { |
| 1339 | highmap_end_pfn())) { | ||
| 1340 | unsigned long temp_cpa_vaddr = (cpa->pfn << PAGE_SHIFT) + | 1360 | unsigned long temp_cpa_vaddr = (cpa->pfn << PAGE_SHIFT) + |
| 1341 | __START_KERNEL_map - phys_base; | 1361 | __START_KERNEL_map - phys_base; |
| 1342 | alias_cpa = *cpa; | 1362 | alias_cpa = *cpa; |
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index f1fd52f449e0..4d418e705878 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c | |||
| @@ -421,6 +421,16 @@ static inline bool pti_kernel_image_global_ok(void) | |||
| 421 | if (boot_cpu_has(X86_FEATURE_K8)) | 421 | if (boot_cpu_has(X86_FEATURE_K8)) |
| 422 | return false; | 422 | return false; |
| 423 | 423 | ||
| 424 | /* | ||
| 425 | * RANDSTRUCT derives its hardening benefits from the | ||
| 426 | * attacker's lack of knowledge about the layout of kernel | ||
| 427 | * data structures. Keep the kernel image non-global in | ||
| 428 | * cases where RANDSTRUCT is in use to help keep the layout a | ||
| 429 | * secret. | ||
| 430 | */ | ||
| 431 | if (IS_ENABLED(CONFIG_GCC_PLUGIN_RANDSTRUCT)) | ||
| 432 | return false; | ||
| 433 | |||
| 424 | return true; | 434 | return true; |
| 425 | } | 435 | } |
| 426 | 436 | ||
| @@ -430,12 +440,24 @@ static inline bool pti_kernel_image_global_ok(void) | |||
| 430 | */ | 440 | */ |
| 431 | void pti_clone_kernel_text(void) | 441 | void pti_clone_kernel_text(void) |
| 432 | { | 442 | { |
| 443 | /* | ||
| 444 | * rodata is part of the kernel image and is normally | ||
| 445 | * readable on the filesystem or on the web. But, do not | ||
| 446 | * clone the areas past rodata, they might contain secrets. | ||
| 447 | */ | ||
| 433 | unsigned long start = PFN_ALIGN(_text); | 448 | unsigned long start = PFN_ALIGN(_text); |
| 434 | unsigned long end = ALIGN((unsigned long)_end, PMD_PAGE_SIZE); | 449 | unsigned long end = (unsigned long)__end_rodata_hpage_align; |
| 435 | 450 | ||
| 436 | if (!pti_kernel_image_global_ok()) | 451 | if (!pti_kernel_image_global_ok()) |
| 437 | return; | 452 | return; |
| 438 | 453 | ||
| 454 | pr_debug("mapping partial kernel image into user address space\n"); | ||
| 455 | |||
| 456 | /* | ||
| 457 | * Note that this will undo _some_ of the work that | ||
| 458 | * pti_set_kernel_image_nonglobal() did to clear the | ||
| 459 | * global bit. | ||
| 460 | */ | ||
| 439 | pti_clone_pmds(start, end, _PAGE_RW); | 461 | pti_clone_pmds(start, end, _PAGE_RW); |
| 440 | } | 462 | } |
| 441 | 463 | ||
| @@ -458,8 +480,6 @@ void pti_set_kernel_image_nonglobal(void) | |||
| 458 | if (pti_kernel_image_global_ok()) | 480 | if (pti_kernel_image_global_ok()) |
| 459 | return; | 481 | return; |
| 460 | 482 | ||
| 461 | pr_debug("set kernel image non-global\n"); | ||
| 462 | |||
| 463 | set_memory_nonglobal(start, (end - start) >> PAGE_SHIFT); | 483 | set_memory_nonglobal(start, (end - start) >> PAGE_SHIFT); |
| 464 | } | 484 | } |
| 465 | 485 | ||
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index f0ecd98509d8..771ae9730ac6 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c | |||
| @@ -4934,8 +4934,16 @@ static void bfq_prepare_request(struct request *rq, struct bio *bio) | |||
| 4934 | bool new_queue = false; | 4934 | bool new_queue = false; |
| 4935 | bool bfqq_already_existing = false, split = false; | 4935 | bool bfqq_already_existing = false, split = false; |
| 4936 | 4936 | ||
| 4937 | if (!rq->elv.icq) | 4937 | /* |
| 4938 | * Even if we don't have an icq attached, we should still clear | ||
| 4939 | * the scheduler pointers, as they might point to previously | ||
| 4940 | * allocated bic/bfqq structs. | ||
| 4941 | */ | ||
| 4942 | if (!rq->elv.icq) { | ||
| 4943 | rq->elv.priv[0] = rq->elv.priv[1] = NULL; | ||
| 4938 | return; | 4944 | return; |
| 4945 | } | ||
| 4946 | |||
| 4939 | bic = icq_to_bic(rq->elv.icq); | 4947 | bic = icq_to_bic(rq->elv.icq); |
| 4940 | 4948 | ||
| 4941 | spin_lock_irq(&bfqd->lock); | 4949 | spin_lock_irq(&bfqd->lock); |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 1c16694ae145..eb85cb87c40f 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
| @@ -1177,26 +1177,20 @@ int blkcg_init_queue(struct request_queue *q) | |||
| 1177 | 1177 | ||
| 1178 | preloaded = !radix_tree_preload(GFP_KERNEL); | 1178 | preloaded = !radix_tree_preload(GFP_KERNEL); |
| 1179 | 1179 | ||
| 1180 | /* | 1180 | /* Make sure the root blkg exists. */ |
| 1181 | * Make sure the root blkg exists and count the existing blkgs. As | ||
| 1182 | * @q is bypassing at this point, blkg_lookup_create() can't be | ||
| 1183 | * used. Open code insertion. | ||
| 1184 | */ | ||
| 1185 | rcu_read_lock(); | 1181 | rcu_read_lock(); |
| 1186 | spin_lock_irq(q->queue_lock); | 1182 | spin_lock_irq(q->queue_lock); |
| 1187 | blkg = blkg_create(&blkcg_root, q, new_blkg); | 1183 | blkg = blkg_create(&blkcg_root, q, new_blkg); |
| 1184 | if (IS_ERR(blkg)) | ||
| 1185 | goto err_unlock; | ||
| 1186 | q->root_blkg = blkg; | ||
| 1187 | q->root_rl.blkg = blkg; | ||
| 1188 | spin_unlock_irq(q->queue_lock); | 1188 | spin_unlock_irq(q->queue_lock); |
| 1189 | rcu_read_unlock(); | 1189 | rcu_read_unlock(); |
| 1190 | 1190 | ||
| 1191 | if (preloaded) | 1191 | if (preloaded) |
| 1192 | radix_tree_preload_end(); | 1192 | radix_tree_preload_end(); |
| 1193 | 1193 | ||
| 1194 | if (IS_ERR(blkg)) | ||
| 1195 | return PTR_ERR(blkg); | ||
| 1196 | |||
| 1197 | q->root_blkg = blkg; | ||
| 1198 | q->root_rl.blkg = blkg; | ||
| 1199 | |||
| 1200 | ret = blk_throtl_init(q); | 1194 | ret = blk_throtl_init(q); |
| 1201 | if (ret) { | 1195 | if (ret) { |
| 1202 | spin_lock_irq(q->queue_lock); | 1196 | spin_lock_irq(q->queue_lock); |
| @@ -1204,6 +1198,13 @@ int blkcg_init_queue(struct request_queue *q) | |||
| 1204 | spin_unlock_irq(q->queue_lock); | 1198 | spin_unlock_irq(q->queue_lock); |
| 1205 | } | 1199 | } |
| 1206 | return ret; | 1200 | return ret; |
| 1201 | |||
| 1202 | err_unlock: | ||
| 1203 | spin_unlock_irq(q->queue_lock); | ||
| 1204 | rcu_read_unlock(); | ||
| 1205 | if (preloaded) | ||
| 1206 | radix_tree_preload_end(); | ||
| 1207 | return PTR_ERR(blkg); | ||
| 1207 | } | 1208 | } |
| 1208 | 1209 | ||
| 1209 | /** | 1210 | /** |
| @@ -1410,9 +1411,6 @@ void blkcg_deactivate_policy(struct request_queue *q, | |||
| 1410 | __clear_bit(pol->plid, q->blkcg_pols); | 1411 | __clear_bit(pol->plid, q->blkcg_pols); |
| 1411 | 1412 | ||
| 1412 | list_for_each_entry(blkg, &q->blkg_list, q_node) { | 1413 | list_for_each_entry(blkg, &q->blkg_list, q_node) { |
| 1413 | /* grab blkcg lock too while removing @pd from @blkg */ | ||
| 1414 | spin_lock(&blkg->blkcg->lock); | ||
| 1415 | |||
| 1416 | if (blkg->pd[pol->plid]) { | 1414 | if (blkg->pd[pol->plid]) { |
| 1417 | if (!blkg->pd[pol->plid]->offline && | 1415 | if (!blkg->pd[pol->plid]->offline && |
| 1418 | pol->pd_offline_fn) { | 1416 | pol->pd_offline_fn) { |
| @@ -1422,8 +1420,6 @@ void blkcg_deactivate_policy(struct request_queue *q, | |||
| 1422 | pol->pd_free_fn(blkg->pd[pol->plid]); | 1420 | pol->pd_free_fn(blkg->pd[pol->plid]); |
| 1423 | blkg->pd[pol->plid] = NULL; | 1421 | blkg->pd[pol->plid] = NULL; |
| 1424 | } | 1422 | } |
| 1425 | |||
| 1426 | spin_unlock(&blkg->blkcg->lock); | ||
| 1427 | } | 1423 | } |
| 1428 | 1424 | ||
| 1429 | spin_unlock_irq(q->queue_lock); | 1425 | spin_unlock_irq(q->queue_lock); |
diff --git a/block/blk-core.c b/block/blk-core.c index 806ce2442819..85909b431eb0 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -201,6 +201,10 @@ void blk_rq_init(struct request_queue *q, struct request *rq) | |||
| 201 | rq->part = NULL; | 201 | rq->part = NULL; |
| 202 | seqcount_init(&rq->gstate_seq); | 202 | seqcount_init(&rq->gstate_seq); |
| 203 | u64_stats_init(&rq->aborted_gstate_sync); | 203 | u64_stats_init(&rq->aborted_gstate_sync); |
| 204 | /* | ||
| 205 | * See comment of blk_mq_init_request | ||
| 206 | */ | ||
| 207 | WRITE_ONCE(rq->gstate, MQ_RQ_GEN_INC); | ||
| 204 | } | 208 | } |
| 205 | EXPORT_SYMBOL(blk_rq_init); | 209 | EXPORT_SYMBOL(blk_rq_init); |
| 206 | 210 | ||
| @@ -915,7 +919,6 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags) | |||
| 915 | 919 | ||
| 916 | while (true) { | 920 | while (true) { |
| 917 | bool success = false; | 921 | bool success = false; |
| 918 | int ret; | ||
| 919 | 922 | ||
| 920 | rcu_read_lock(); | 923 | rcu_read_lock(); |
| 921 | if (percpu_ref_tryget_live(&q->q_usage_counter)) { | 924 | if (percpu_ref_tryget_live(&q->q_usage_counter)) { |
| @@ -947,14 +950,12 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags) | |||
| 947 | */ | 950 | */ |
| 948 | smp_rmb(); | 951 | smp_rmb(); |
| 949 | 952 | ||
| 950 | ret = wait_event_interruptible(q->mq_freeze_wq, | 953 | wait_event(q->mq_freeze_wq, |
| 951 | (atomic_read(&q->mq_freeze_depth) == 0 && | 954 | (atomic_read(&q->mq_freeze_depth) == 0 && |
| 952 | (preempt || !blk_queue_preempt_only(q))) || | 955 | (preempt || !blk_queue_preempt_only(q))) || |
| 953 | blk_queue_dying(q)); | 956 | blk_queue_dying(q)); |
| 954 | if (blk_queue_dying(q)) | 957 | if (blk_queue_dying(q)) |
| 955 | return -ENODEV; | 958 | return -ENODEV; |
| 956 | if (ret) | ||
| 957 | return ret; | ||
| 958 | } | 959 | } |
| 959 | } | 960 | } |
| 960 | 961 | ||
diff --git a/block/blk-mq.c b/block/blk-mq.c index 0dc9e341c2a7..c3621453ad87 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
| @@ -2042,6 +2042,13 @@ static int blk_mq_init_request(struct blk_mq_tag_set *set, struct request *rq, | |||
| 2042 | 2042 | ||
| 2043 | seqcount_init(&rq->gstate_seq); | 2043 | seqcount_init(&rq->gstate_seq); |
| 2044 | u64_stats_init(&rq->aborted_gstate_sync); | 2044 | u64_stats_init(&rq->aborted_gstate_sync); |
| 2045 | /* | ||
| 2046 | * start gstate with gen 1 instead of 0, otherwise it will be equal | ||
| 2047 | * to aborted_gstate, and be identified timed out by | ||
| 2048 | * blk_mq_terminate_expired. | ||
| 2049 | */ | ||
| 2050 | WRITE_ONCE(rq->gstate, MQ_RQ_GEN_INC); | ||
| 2051 | |||
| 2045 | return 0; | 2052 | return 0; |
| 2046 | } | 2053 | } |
| 2047 | 2054 | ||
| @@ -2329,7 +2336,7 @@ static void blk_mq_free_map_and_requests(struct blk_mq_tag_set *set, | |||
| 2329 | 2336 | ||
| 2330 | static void blk_mq_map_swqueue(struct request_queue *q) | 2337 | static void blk_mq_map_swqueue(struct request_queue *q) |
| 2331 | { | 2338 | { |
| 2332 | unsigned int i; | 2339 | unsigned int i, hctx_idx; |
| 2333 | struct blk_mq_hw_ctx *hctx; | 2340 | struct blk_mq_hw_ctx *hctx; |
| 2334 | struct blk_mq_ctx *ctx; | 2341 | struct blk_mq_ctx *ctx; |
| 2335 | struct blk_mq_tag_set *set = q->tag_set; | 2342 | struct blk_mq_tag_set *set = q->tag_set; |
| @@ -2346,8 +2353,23 @@ static void blk_mq_map_swqueue(struct request_queue *q) | |||
| 2346 | 2353 | ||
| 2347 | /* | 2354 | /* |
| 2348 | * Map software to hardware queues. | 2355 | * Map software to hardware queues. |
| 2356 | * | ||
| 2357 | * If the cpu isn't present, the cpu is mapped to first hctx. | ||
| 2349 | */ | 2358 | */ |
| 2350 | for_each_possible_cpu(i) { | 2359 | for_each_possible_cpu(i) { |
| 2360 | hctx_idx = q->mq_map[i]; | ||
| 2361 | /* unmapped hw queue can be remapped after CPU topo changed */ | ||
| 2362 | if (!set->tags[hctx_idx] && | ||
| 2363 | !__blk_mq_alloc_rq_map(set, hctx_idx)) { | ||
| 2364 | /* | ||
| 2365 | * If tags initialization fail for some hctx, | ||
| 2366 | * that hctx won't be brought online. In this | ||
| 2367 | * case, remap the current ctx to hctx[0] which | ||
| 2368 | * is guaranteed to always have tags allocated | ||
| 2369 | */ | ||
| 2370 | q->mq_map[i] = 0; | ||
| 2371 | } | ||
| 2372 | |||
| 2351 | ctx = per_cpu_ptr(q->queue_ctx, i); | 2373 | ctx = per_cpu_ptr(q->queue_ctx, i); |
| 2352 | hctx = blk_mq_map_queue(q, i); | 2374 | hctx = blk_mq_map_queue(q, i); |
| 2353 | 2375 | ||
| @@ -2359,8 +2381,21 @@ static void blk_mq_map_swqueue(struct request_queue *q) | |||
| 2359 | mutex_unlock(&q->sysfs_lock); | 2381 | mutex_unlock(&q->sysfs_lock); |
| 2360 | 2382 | ||
| 2361 | queue_for_each_hw_ctx(q, hctx, i) { | 2383 | queue_for_each_hw_ctx(q, hctx, i) { |
| 2362 | /* every hctx should get mapped by at least one CPU */ | 2384 | /* |
| 2363 | WARN_ON(!hctx->nr_ctx); | 2385 | * If no software queues are mapped to this hardware queue, |
| 2386 | * disable it and free the request entries. | ||
| 2387 | */ | ||
| 2388 | if (!hctx->nr_ctx) { | ||
| 2389 | /* Never unmap queue 0. We need it as a | ||
| 2390 | * fallback in case of a new remap fails | ||
| 2391 | * allocation | ||
| 2392 | */ | ||
| 2393 | if (i && set->tags[i]) | ||
| 2394 | blk_mq_free_map_and_requests(set, i); | ||
| 2395 | |||
| 2396 | hctx->tags = NULL; | ||
| 2397 | continue; | ||
| 2398 | } | ||
| 2364 | 2399 | ||
| 2365 | hctx->tags = set->tags[i]; | 2400 | hctx->tags = set->tags[i]; |
| 2366 | WARN_ON(!hctx->tags); | 2401 | WARN_ON(!hctx->tags); |
diff --git a/block/blk-mq.h b/block/blk-mq.h index 88c558f71819..89b5cd3a6c70 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h | |||
| @@ -7,6 +7,9 @@ | |||
| 7 | 7 | ||
| 8 | struct blk_mq_tag_set; | 8 | struct blk_mq_tag_set; |
| 9 | 9 | ||
| 10 | /** | ||
| 11 | * struct blk_mq_ctx - State for a software queue facing the submitting CPUs | ||
| 12 | */ | ||
| 10 | struct blk_mq_ctx { | 13 | struct blk_mq_ctx { |
| 11 | struct { | 14 | struct { |
| 12 | spinlock_t lock; | 15 | spinlock_t lock; |
diff --git a/crypto/api.c b/crypto/api.c index 1d5290c67108..0ee632bba064 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
| @@ -204,9 +204,14 @@ static struct crypto_alg *crypto_alg_lookup(const char *name, u32 type, | |||
| 204 | 204 | ||
| 205 | down_read(&crypto_alg_sem); | 205 | down_read(&crypto_alg_sem); |
| 206 | alg = __crypto_alg_lookup(name, type | test, mask | test); | 206 | alg = __crypto_alg_lookup(name, type | test, mask | test); |
| 207 | if (!alg && test) | 207 | if (!alg && test) { |
| 208 | alg = __crypto_alg_lookup(name, type, mask) ? | 208 | alg = __crypto_alg_lookup(name, type, mask); |
| 209 | ERR_PTR(-ELIBBAD) : NULL; | 209 | if (alg && !crypto_is_larval(alg)) { |
| 210 | /* Test failed */ | ||
| 211 | crypto_mod_put(alg); | ||
| 212 | alg = ERR_PTR(-ELIBBAD); | ||
| 213 | } | ||
| 214 | } | ||
| 210 | up_read(&crypto_alg_sem); | 215 | up_read(&crypto_alg_sem); |
| 211 | 216 | ||
| 212 | return alg; | 217 | return alg; |
diff --git a/crypto/drbg.c b/crypto/drbg.c index 4faa2781c964..466a112a4446 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c | |||
| @@ -1134,8 +1134,10 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg) | |||
| 1134 | if (!drbg) | 1134 | if (!drbg) |
| 1135 | return; | 1135 | return; |
| 1136 | kzfree(drbg->Vbuf); | 1136 | kzfree(drbg->Vbuf); |
| 1137 | drbg->Vbuf = NULL; | ||
| 1137 | drbg->V = NULL; | 1138 | drbg->V = NULL; |
| 1138 | kzfree(drbg->Cbuf); | 1139 | kzfree(drbg->Cbuf); |
| 1140 | drbg->Cbuf = NULL; | ||
| 1139 | drbg->C = NULL; | 1141 | drbg->C = NULL; |
| 1140 | kzfree(drbg->scratchpadbuf); | 1142 | kzfree(drbg->scratchpadbuf); |
| 1141 | drbg->scratchpadbuf = NULL; | 1143 | drbg->scratchpadbuf = NULL; |
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index 76fb96966f7b..2f2e737be0f8 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c | |||
| @@ -2123,6 +2123,25 @@ static int __init intel_opregion_present(void) | |||
| 2123 | return opregion; | 2123 | return opregion; |
| 2124 | } | 2124 | } |
| 2125 | 2125 | ||
| 2126 | static bool dmi_is_desktop(void) | ||
| 2127 | { | ||
| 2128 | const char *chassis_type; | ||
| 2129 | |||
| 2130 | chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE); | ||
| 2131 | if (!chassis_type) | ||
| 2132 | return false; | ||
| 2133 | |||
| 2134 | if (!strcmp(chassis_type, "3") || /* 3: Desktop */ | ||
| 2135 | !strcmp(chassis_type, "4") || /* 4: Low Profile Desktop */ | ||
| 2136 | !strcmp(chassis_type, "5") || /* 5: Pizza Box */ | ||
| 2137 | !strcmp(chassis_type, "6") || /* 6: Mini Tower */ | ||
| 2138 | !strcmp(chassis_type, "7") || /* 7: Tower */ | ||
| 2139 | !strcmp(chassis_type, "11")) /* 11: Main Server Chassis */ | ||
| 2140 | return true; | ||
| 2141 | |||
| 2142 | return false; | ||
| 2143 | } | ||
| 2144 | |||
| 2126 | int acpi_video_register(void) | 2145 | int acpi_video_register(void) |
| 2127 | { | 2146 | { |
| 2128 | int ret = 0; | 2147 | int ret = 0; |
| @@ -2143,8 +2162,12 @@ int acpi_video_register(void) | |||
| 2143 | * win8 ready (where we also prefer the native backlight driver, so | 2162 | * win8 ready (where we also prefer the native backlight driver, so |
| 2144 | * normally the acpi_video code should not register there anyways). | 2163 | * normally the acpi_video code should not register there anyways). |
| 2145 | */ | 2164 | */ |
| 2146 | if (only_lcd == -1) | 2165 | if (only_lcd == -1) { |
| 2147 | only_lcd = acpi_osi_is_win8(); | 2166 | if (dmi_is_desktop() && acpi_osi_is_win8()) |
| 2167 | only_lcd = true; | ||
| 2168 | else | ||
| 2169 | only_lcd = false; | ||
| 2170 | } | ||
| 2148 | 2171 | ||
| 2149 | dmi_check_system(video_dmi_table); | 2172 | dmi_check_system(video_dmi_table); |
| 2150 | 2173 | ||
diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c index ebb626ffb5fa..4bde16fb97d8 100644 --- a/drivers/acpi/acpi_watchdog.c +++ b/drivers/acpi/acpi_watchdog.c | |||
| @@ -12,23 +12,64 @@ | |||
| 12 | #define pr_fmt(fmt) "ACPI: watchdog: " fmt | 12 | #define pr_fmt(fmt) "ACPI: watchdog: " fmt |
| 13 | 13 | ||
| 14 | #include <linux/acpi.h> | 14 | #include <linux/acpi.h> |
| 15 | #include <linux/dmi.h> | ||
| 15 | #include <linux/ioport.h> | 16 | #include <linux/ioport.h> |
| 16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 17 | 18 | ||
| 18 | #include "internal.h" | 19 | #include "internal.h" |
| 19 | 20 | ||
| 21 | static const struct dmi_system_id acpi_watchdog_skip[] = { | ||
| 22 | { | ||
| 23 | /* | ||
| 24 | * On Lenovo Z50-70 there are two issues with the WDAT | ||
| 25 | * table. First some of the instructions use RTC SRAM | ||
| 26 | * to store persistent information. This does not work well | ||
| 27 | * with Linux RTC driver. Second, more important thing is | ||
| 28 | * that the instructions do not actually reset the system. | ||
| 29 | * | ||
| 30 | * On this particular system iTCO_wdt seems to work just | ||
| 31 | * fine so we prefer that over WDAT for now. | ||
| 32 | * | ||
| 33 | * See also https://bugzilla.kernel.org/show_bug.cgi?id=199033. | ||
| 34 | */ | ||
| 35 | .ident = "Lenovo Z50-70", | ||
| 36 | .matches = { | ||
| 37 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
| 38 | DMI_MATCH(DMI_PRODUCT_NAME, "20354"), | ||
| 39 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Z50-70"), | ||
| 40 | }, | ||
| 41 | }, | ||
| 42 | {} | ||
| 43 | }; | ||
| 44 | |||
| 45 | static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) | ||
| 46 | { | ||
| 47 | const struct acpi_table_wdat *wdat = NULL; | ||
| 48 | acpi_status status; | ||
| 49 | |||
| 50 | if (acpi_disabled) | ||
| 51 | return NULL; | ||
| 52 | |||
| 53 | if (dmi_check_system(acpi_watchdog_skip)) | ||
| 54 | return NULL; | ||
| 55 | |||
| 56 | status = acpi_get_table(ACPI_SIG_WDAT, 0, | ||
| 57 | (struct acpi_table_header **)&wdat); | ||
| 58 | if (ACPI_FAILURE(status)) { | ||
| 59 | /* It is fine if there is no WDAT */ | ||
| 60 | return NULL; | ||
| 61 | } | ||
| 62 | |||
| 63 | return wdat; | ||
| 64 | } | ||
| 65 | |||
| 20 | /** | 66 | /** |
| 21 | * Returns true if this system should prefer ACPI based watchdog instead of | 67 | * Returns true if this system should prefer ACPI based watchdog instead of |
| 22 | * the native one (which are typically the same hardware). | 68 | * the native one (which are typically the same hardware). |
| 23 | */ | 69 | */ |
| 24 | bool acpi_has_watchdog(void) | 70 | bool acpi_has_watchdog(void) |
| 25 | { | 71 | { |
| 26 | struct acpi_table_header hdr; | 72 | return !!acpi_watchdog_get_wdat(); |
| 27 | |||
| 28 | if (acpi_disabled) | ||
| 29 | return false; | ||
| 30 | |||
| 31 | return ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_WDAT, 0, &hdr)); | ||
| 32 | } | 73 | } |
| 33 | EXPORT_SYMBOL_GPL(acpi_has_watchdog); | 74 | EXPORT_SYMBOL_GPL(acpi_has_watchdog); |
| 34 | 75 | ||
| @@ -41,12 +82,10 @@ void __init acpi_watchdog_init(void) | |||
| 41 | struct platform_device *pdev; | 82 | struct platform_device *pdev; |
| 42 | struct resource *resources; | 83 | struct resource *resources; |
| 43 | size_t nresources = 0; | 84 | size_t nresources = 0; |
| 44 | acpi_status status; | ||
| 45 | int i; | 85 | int i; |
| 46 | 86 | ||
| 47 | status = acpi_get_table(ACPI_SIG_WDAT, 0, | 87 | wdat = acpi_watchdog_get_wdat(); |
| 48 | (struct acpi_table_header **)&wdat); | 88 | if (!wdat) { |
| 49 | if (ACPI_FAILURE(status)) { | ||
| 50 | /* It is fine if there is no WDAT */ | 89 | /* It is fine if there is no WDAT */ |
| 51 | return; | 90 | return; |
| 52 | } | 91 | } |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index e1eee7a60fad..f1cc4f9d31cd 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
| @@ -635,4 +635,26 @@ module_param_call(lid_init_state, | |||
| 635 | NULL, 0644); | 635 | NULL, 0644); |
| 636 | MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state"); | 636 | MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state"); |
| 637 | 637 | ||
| 638 | module_acpi_driver(acpi_button_driver); | 638 | static int acpi_button_register_driver(struct acpi_driver *driver) |
| 639 | { | ||
| 640 | /* | ||
| 641 | * Modules such as nouveau.ko and i915.ko have a link time dependency | ||
| 642 | * on acpi_lid_open(), and would therefore not be loadable on ACPI | ||
| 643 | * capable kernels booted in non-ACPI mode if the return value of | ||
| 644 | * acpi_bus_register_driver() is returned from here with ACPI disabled | ||
| 645 | * when this driver is built as a module. | ||
| 646 | */ | ||
| 647 | if (acpi_disabled) | ||
| 648 | return 0; | ||
| 649 | |||
| 650 | return acpi_bus_register_driver(driver); | ||
| 651 | } | ||
| 652 | |||
| 653 | static void acpi_button_unregister_driver(struct acpi_driver *driver) | ||
| 654 | { | ||
| 655 | if (!acpi_disabled) | ||
| 656 | acpi_bus_unregister_driver(driver); | ||
| 657 | } | ||
| 658 | |||
| 659 | module_driver(acpi_button_driver, acpi_button_register_driver, | ||
| 660 | acpi_button_unregister_driver); | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index cc234e6a6297..970dd87d347c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -2166,10 +2166,10 @@ int __init acpi_scan_init(void) | |||
| 2166 | acpi_cmos_rtc_init(); | 2166 | acpi_cmos_rtc_init(); |
| 2167 | acpi_container_init(); | 2167 | acpi_container_init(); |
| 2168 | acpi_memory_hotplug_init(); | 2168 | acpi_memory_hotplug_init(); |
| 2169 | acpi_watchdog_init(); | ||
| 2169 | acpi_pnp_init(); | 2170 | acpi_pnp_init(); |
| 2170 | acpi_int340x_thermal_init(); | 2171 | acpi_int340x_thermal_init(); |
| 2171 | acpi_amba_init(); | 2172 | acpi_amba_init(); |
| 2172 | acpi_watchdog_init(); | ||
| 2173 | acpi_init_lpit(); | 2173 | acpi_init_lpit(); |
| 2174 | 2174 | ||
| 2175 | acpi_scan_add_handler(&generic_device_handler); | 2175 | acpi_scan_add_handler(&generic_device_handler); |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 99a1a650326d..974e58457697 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
| @@ -364,6 +364,19 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { | |||
| 364 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"), | 364 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"), |
| 365 | }, | 365 | }, |
| 366 | }, | 366 | }, |
| 367 | /* | ||
| 368 | * ThinkPad X1 Tablet(2016) cannot do suspend-to-idle using | ||
| 369 | * the Low Power S0 Idle firmware interface (see | ||
| 370 | * https://bugzilla.kernel.org/show_bug.cgi?id=199057). | ||
| 371 | */ | ||
| 372 | { | ||
| 373 | .callback = init_no_lps0, | ||
| 374 | .ident = "ThinkPad X1 Tablet(2016)", | ||
| 375 | .matches = { | ||
| 376 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
| 377 | DMI_MATCH(DMI_PRODUCT_NAME, "20GGA00L00"), | ||
| 378 | }, | ||
| 379 | }, | ||
| 367 | {}, | 380 | {}, |
| 368 | }; | 381 | }; |
| 369 | 382 | ||
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 594c228d2f02..4a3ac31c07d0 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
| @@ -69,11 +69,12 @@ static ssize_t driver_override_show(struct device *_dev, | |||
| 69 | struct device_attribute *attr, char *buf) | 69 | struct device_attribute *attr, char *buf) |
| 70 | { | 70 | { |
| 71 | struct amba_device *dev = to_amba_device(_dev); | 71 | struct amba_device *dev = to_amba_device(_dev); |
| 72 | ssize_t len; | ||
| 72 | 73 | ||
| 73 | if (!dev->driver_override) | 74 | device_lock(_dev); |
| 74 | return 0; | 75 | len = sprintf(buf, "%s\n", dev->driver_override); |
| 75 | 76 | device_unlock(_dev); | |
| 76 | return sprintf(buf, "%s\n", dev->driver_override); | 77 | return len; |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | static ssize_t driver_override_store(struct device *_dev, | 80 | static ssize_t driver_override_store(struct device *_dev, |
| @@ -81,9 +82,10 @@ static ssize_t driver_override_store(struct device *_dev, | |||
| 81 | const char *buf, size_t count) | 82 | const char *buf, size_t count) |
| 82 | { | 83 | { |
| 83 | struct amba_device *dev = to_amba_device(_dev); | 84 | struct amba_device *dev = to_amba_device(_dev); |
| 84 | char *driver_override, *old = dev->driver_override, *cp; | 85 | char *driver_override, *old, *cp; |
| 85 | 86 | ||
| 86 | if (count > PATH_MAX) | 87 | /* We need to keep extra room for a newline */ |
| 88 | if (count >= (PAGE_SIZE - 1)) | ||
| 87 | return -EINVAL; | 89 | return -EINVAL; |
| 88 | 90 | ||
| 89 | driver_override = kstrndup(buf, count, GFP_KERNEL); | 91 | driver_override = kstrndup(buf, count, GFP_KERNEL); |
| @@ -94,12 +96,15 @@ static ssize_t driver_override_store(struct device *_dev, | |||
| 94 | if (cp) | 96 | if (cp) |
| 95 | *cp = '\0'; | 97 | *cp = '\0'; |
| 96 | 98 | ||
| 99 | device_lock(_dev); | ||
| 100 | old = dev->driver_override; | ||
| 97 | if (strlen(driver_override)) { | 101 | if (strlen(driver_override)) { |
| 98 | dev->driver_override = driver_override; | 102 | dev->driver_override = driver_override; |
| 99 | } else { | 103 | } else { |
| 100 | kfree(driver_override); | 104 | kfree(driver_override); |
| 101 | dev->driver_override = NULL; | 105 | dev->driver_override = NULL; |
| 102 | } | 106 | } |
| 107 | device_unlock(_dev); | ||
| 103 | 108 | ||
| 104 | kfree(old); | 109 | kfree(old); |
| 105 | 110 | ||
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 764b63a5aade..e578eee31589 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
| @@ -2839,6 +2839,14 @@ static void binder_transaction(struct binder_proc *proc, | |||
| 2839 | else | 2839 | else |
| 2840 | return_error = BR_DEAD_REPLY; | 2840 | return_error = BR_DEAD_REPLY; |
| 2841 | mutex_unlock(&context->context_mgr_node_lock); | 2841 | mutex_unlock(&context->context_mgr_node_lock); |
| 2842 | if (target_node && target_proc == proc) { | ||
| 2843 | binder_user_error("%d:%d got transaction to context manager from process owning it\n", | ||
| 2844 | proc->pid, thread->pid); | ||
| 2845 | return_error = BR_FAILED_REPLY; | ||
| 2846 | return_error_param = -EINVAL; | ||
| 2847 | return_error_line = __LINE__; | ||
| 2848 | goto err_invalid_target_handle; | ||
| 2849 | } | ||
| 2842 | } | 2850 | } |
| 2843 | if (!target_node) { | 2851 | if (!target_node) { |
| 2844 | /* | 2852 | /* |
diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c index 1e6396bb807b..597d40893862 100644 --- a/drivers/base/dma-coherent.c +++ b/drivers/base/dma-coherent.c | |||
| @@ -312,8 +312,9 @@ static int __dma_mmap_from_coherent(struct dma_coherent_mem *mem, | |||
| 312 | * This checks whether the memory was allocated from the per-device | 312 | * This checks whether the memory was allocated from the per-device |
| 313 | * coherent memory pool and if so, maps that memory to the provided vma. | 313 | * coherent memory pool and if so, maps that memory to the provided vma. |
| 314 | * | 314 | * |
| 315 | * Returns 1 if we correctly mapped the memory, or 0 if the caller should | 315 | * Returns 1 if @vaddr belongs to the device coherent pool and the caller |
| 316 | * proceed with mapping memory from generic pools. | 316 | * should return @ret, or 0 if they should proceed with mapping memory from |
| 317 | * generic areas. | ||
| 317 | */ | 318 | */ |
| 318 | int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma, | 319 | int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma, |
| 319 | void *vaddr, size_t size, int *ret) | 320 | void *vaddr, size_t size, int *ret) |
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index 3b118353ea17..d82566d6e237 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c | |||
| @@ -226,7 +226,6 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, | |||
| 226 | #ifndef CONFIG_ARCH_NO_COHERENT_DMA_MMAP | 226 | #ifndef CONFIG_ARCH_NO_COHERENT_DMA_MMAP |
| 227 | unsigned long user_count = vma_pages(vma); | 227 | unsigned long user_count = vma_pages(vma); |
| 228 | unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; | 228 | unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; |
| 229 | unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr)); | ||
| 230 | unsigned long off = vma->vm_pgoff; | 229 | unsigned long off = vma->vm_pgoff; |
| 231 | 230 | ||
| 232 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 231 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
| @@ -234,12 +233,11 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, | |||
| 234 | if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret)) | 233 | if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret)) |
| 235 | return ret; | 234 | return ret; |
| 236 | 235 | ||
| 237 | if (off < count && user_count <= (count - off)) { | 236 | if (off < count && user_count <= (count - off)) |
| 238 | ret = remap_pfn_range(vma, vma->vm_start, | 237 | ret = remap_pfn_range(vma, vma->vm_start, |
| 239 | pfn + off, | 238 | page_to_pfn(virt_to_page(cpu_addr)) + off, |
| 240 | user_count << PAGE_SHIFT, | 239 | user_count << PAGE_SHIFT, |
| 241 | vma->vm_page_prot); | 240 | vma->vm_page_prot); |
| 242 | } | ||
| 243 | #endif /* !CONFIG_ARCH_NO_COHERENT_DMA_MMAP */ | 241 | #endif /* !CONFIG_ARCH_NO_COHERENT_DMA_MMAP */ |
| 244 | 242 | ||
| 245 | return ret; | 243 | return ret; |
diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c index 31b5015b59fe..358354148dec 100644 --- a/drivers/base/firmware_loader/fallback.c +++ b/drivers/base/firmware_loader/fallback.c | |||
| @@ -537,8 +537,8 @@ exit: | |||
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | /** | 539 | /** |
| 540 | * fw_load_sysfs_fallback - load a firmware via the syfs fallback mechanism | 540 | * fw_load_sysfs_fallback - load a firmware via the sysfs fallback mechanism |
| 541 | * @fw_sysfs: firmware syfs information for the firmware to load | 541 | * @fw_sysfs: firmware sysfs information for the firmware to load |
| 542 | * @opt_flags: flags of options, FW_OPT_* | 542 | * @opt_flags: flags of options, FW_OPT_* |
| 543 | * @timeout: timeout to wait for the load | 543 | * @timeout: timeout to wait for the load |
| 544 | * | 544 | * |
diff --git a/drivers/base/firmware_loader/fallback.h b/drivers/base/firmware_loader/fallback.h index dfebc644ed35..f8255670a663 100644 --- a/drivers/base/firmware_loader/fallback.h +++ b/drivers/base/firmware_loader/fallback.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <linux/device.h> | 6 | #include <linux/device.h> |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * struct firmware_fallback_config - firmware fallback configuratioon settings | 9 | * struct firmware_fallback_config - firmware fallback configuration settings |
| 10 | * | 10 | * |
| 11 | * Helps describe and fine tune the fallback mechanism. | 11 | * Helps describe and fine tune the fallback mechanism. |
| 12 | * | 12 | * |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index c9d04497a415..5d4e31655d96 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
| @@ -451,25 +451,47 @@ static int lo_req_flush(struct loop_device *lo, struct request *rq) | |||
| 451 | static void lo_complete_rq(struct request *rq) | 451 | static void lo_complete_rq(struct request *rq) |
| 452 | { | 452 | { |
| 453 | struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); | 453 | struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); |
| 454 | blk_status_t ret = BLK_STS_OK; | ||
| 454 | 455 | ||
| 455 | if (unlikely(req_op(cmd->rq) == REQ_OP_READ && cmd->use_aio && | 456 | if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) || |
| 456 | cmd->ret >= 0 && cmd->ret < blk_rq_bytes(cmd->rq))) { | 457 | req_op(rq) != REQ_OP_READ) { |
| 457 | struct bio *bio = cmd->rq->bio; | 458 | if (cmd->ret < 0) |
| 458 | 459 | ret = BLK_STS_IOERR; | |
| 459 | bio_advance(bio, cmd->ret); | 460 | goto end_io; |
| 460 | zero_fill_bio(bio); | ||
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | blk_mq_end_request(rq, cmd->ret < 0 ? BLK_STS_IOERR : BLK_STS_OK); | 463 | /* |
| 464 | * Short READ - if we got some data, advance our request and | ||
| 465 | * retry it. If we got no data, end the rest with EIO. | ||
| 466 | */ | ||
| 467 | if (cmd->ret) { | ||
| 468 | blk_update_request(rq, BLK_STS_OK, cmd->ret); | ||
| 469 | cmd->ret = 0; | ||
| 470 | blk_mq_requeue_request(rq, true); | ||
| 471 | } else { | ||
| 472 | if (cmd->use_aio) { | ||
| 473 | struct bio *bio = rq->bio; | ||
| 474 | |||
| 475 | while (bio) { | ||
| 476 | zero_fill_bio(bio); | ||
| 477 | bio = bio->bi_next; | ||
| 478 | } | ||
| 479 | } | ||
| 480 | ret = BLK_STS_IOERR; | ||
| 481 | end_io: | ||
| 482 | blk_mq_end_request(rq, ret); | ||
| 483 | } | ||
| 464 | } | 484 | } |
| 465 | 485 | ||
| 466 | static void lo_rw_aio_do_completion(struct loop_cmd *cmd) | 486 | static void lo_rw_aio_do_completion(struct loop_cmd *cmd) |
| 467 | { | 487 | { |
| 488 | struct request *rq = blk_mq_rq_from_pdu(cmd); | ||
| 489 | |||
| 468 | if (!atomic_dec_and_test(&cmd->ref)) | 490 | if (!atomic_dec_and_test(&cmd->ref)) |
| 469 | return; | 491 | return; |
| 470 | kfree(cmd->bvec); | 492 | kfree(cmd->bvec); |
| 471 | cmd->bvec = NULL; | 493 | cmd->bvec = NULL; |
| 472 | blk_mq_complete_request(cmd->rq); | 494 | blk_mq_complete_request(rq); |
| 473 | } | 495 | } |
| 474 | 496 | ||
| 475 | static void lo_rw_aio_complete(struct kiocb *iocb, long ret, long ret2) | 497 | static void lo_rw_aio_complete(struct kiocb *iocb, long ret, long ret2) |
| @@ -487,7 +509,7 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd, | |||
| 487 | { | 509 | { |
| 488 | struct iov_iter iter; | 510 | struct iov_iter iter; |
| 489 | struct bio_vec *bvec; | 511 | struct bio_vec *bvec; |
| 490 | struct request *rq = cmd->rq; | 512 | struct request *rq = blk_mq_rq_from_pdu(cmd); |
| 491 | struct bio *bio = rq->bio; | 513 | struct bio *bio = rq->bio; |
| 492 | struct file *file = lo->lo_backing_file; | 514 | struct file *file = lo->lo_backing_file; |
| 493 | unsigned int offset; | 515 | unsigned int offset; |
| @@ -1702,15 +1724,16 @@ EXPORT_SYMBOL(loop_unregister_transfer); | |||
| 1702 | static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx, | 1724 | static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx, |
| 1703 | const struct blk_mq_queue_data *bd) | 1725 | const struct blk_mq_queue_data *bd) |
| 1704 | { | 1726 | { |
| 1705 | struct loop_cmd *cmd = blk_mq_rq_to_pdu(bd->rq); | 1727 | struct request *rq = bd->rq; |
| 1706 | struct loop_device *lo = cmd->rq->q->queuedata; | 1728 | struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); |
| 1729 | struct loop_device *lo = rq->q->queuedata; | ||
| 1707 | 1730 | ||
| 1708 | blk_mq_start_request(bd->rq); | 1731 | blk_mq_start_request(rq); |
| 1709 | 1732 | ||
| 1710 | if (lo->lo_state != Lo_bound) | 1733 | if (lo->lo_state != Lo_bound) |
| 1711 | return BLK_STS_IOERR; | 1734 | return BLK_STS_IOERR; |
| 1712 | 1735 | ||
| 1713 | switch (req_op(cmd->rq)) { | 1736 | switch (req_op(rq)) { |
| 1714 | case REQ_OP_FLUSH: | 1737 | case REQ_OP_FLUSH: |
| 1715 | case REQ_OP_DISCARD: | 1738 | case REQ_OP_DISCARD: |
| 1716 | case REQ_OP_WRITE_ZEROES: | 1739 | case REQ_OP_WRITE_ZEROES: |
| @@ -1723,8 +1746,8 @@ static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
| 1723 | 1746 | ||
| 1724 | /* always use the first bio's css */ | 1747 | /* always use the first bio's css */ |
| 1725 | #ifdef CONFIG_BLK_CGROUP | 1748 | #ifdef CONFIG_BLK_CGROUP |
| 1726 | if (cmd->use_aio && cmd->rq->bio && cmd->rq->bio->bi_css) { | 1749 | if (cmd->use_aio && rq->bio && rq->bio->bi_css) { |
| 1727 | cmd->css = cmd->rq->bio->bi_css; | 1750 | cmd->css = rq->bio->bi_css; |
| 1728 | css_get(cmd->css); | 1751 | css_get(cmd->css); |
| 1729 | } else | 1752 | } else |
| 1730 | #endif | 1753 | #endif |
| @@ -1736,8 +1759,9 @@ static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
| 1736 | 1759 | ||
| 1737 | static void loop_handle_cmd(struct loop_cmd *cmd) | 1760 | static void loop_handle_cmd(struct loop_cmd *cmd) |
| 1738 | { | 1761 | { |
| 1739 | const bool write = op_is_write(req_op(cmd->rq)); | 1762 | struct request *rq = blk_mq_rq_from_pdu(cmd); |
| 1740 | struct loop_device *lo = cmd->rq->q->queuedata; | 1763 | const bool write = op_is_write(req_op(rq)); |
| 1764 | struct loop_device *lo = rq->q->queuedata; | ||
| 1741 | int ret = 0; | 1765 | int ret = 0; |
| 1742 | 1766 | ||
| 1743 | if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) { | 1767 | if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) { |
| @@ -1745,12 +1769,12 @@ static void loop_handle_cmd(struct loop_cmd *cmd) | |||
| 1745 | goto failed; | 1769 | goto failed; |
| 1746 | } | 1770 | } |
| 1747 | 1771 | ||
| 1748 | ret = do_req_filebacked(lo, cmd->rq); | 1772 | ret = do_req_filebacked(lo, rq); |
| 1749 | failed: | 1773 | failed: |
| 1750 | /* complete non-aio request */ | 1774 | /* complete non-aio request */ |
| 1751 | if (!cmd->use_aio || ret) { | 1775 | if (!cmd->use_aio || ret) { |
| 1752 | cmd->ret = ret ? -EIO : 0; | 1776 | cmd->ret = ret ? -EIO : 0; |
| 1753 | blk_mq_complete_request(cmd->rq); | 1777 | blk_mq_complete_request(rq); |
| 1754 | } | 1778 | } |
| 1755 | } | 1779 | } |
| 1756 | 1780 | ||
| @@ -1767,9 +1791,7 @@ static int loop_init_request(struct blk_mq_tag_set *set, struct request *rq, | |||
| 1767 | { | 1791 | { |
| 1768 | struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); | 1792 | struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); |
| 1769 | 1793 | ||
| 1770 | cmd->rq = rq; | ||
| 1771 | kthread_init_work(&cmd->work, loop_queue_work); | 1794 | kthread_init_work(&cmd->work, loop_queue_work); |
| 1772 | |||
| 1773 | return 0; | 1795 | return 0; |
| 1774 | } | 1796 | } |
| 1775 | 1797 | ||
diff --git a/drivers/block/loop.h b/drivers/block/loop.h index 0f45416e4fcf..b78de9879f4f 100644 --- a/drivers/block/loop.h +++ b/drivers/block/loop.h | |||
| @@ -66,7 +66,6 @@ struct loop_device { | |||
| 66 | 66 | ||
| 67 | struct loop_cmd { | 67 | struct loop_cmd { |
| 68 | struct kthread_work work; | 68 | struct kthread_work work; |
| 69 | struct request *rq; | ||
| 70 | bool use_aio; /* use AIO interface to handle I/O */ | 69 | bool use_aio; /* use AIO interface to handle I/O */ |
| 71 | atomic_t ref; /* only for aio */ | 70 | atomic_t ref; /* only for aio */ |
| 72 | long ret; | 71 | long ret; |
diff --git a/drivers/block/swim.c b/drivers/block/swim.c index 64e066eba72e..0e31884a9519 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c | |||
| @@ -110,7 +110,7 @@ struct iwm { | |||
| 110 | /* Select values for swim_select and swim_readbit */ | 110 | /* Select values for swim_select and swim_readbit */ |
| 111 | 111 | ||
| 112 | #define READ_DATA_0 0x074 | 112 | #define READ_DATA_0 0x074 |
| 113 | #define TWOMEG_DRIVE 0x075 | 113 | #define ONEMEG_DRIVE 0x075 |
| 114 | #define SINGLE_SIDED 0x076 | 114 | #define SINGLE_SIDED 0x076 |
| 115 | #define DRIVE_PRESENT 0x077 | 115 | #define DRIVE_PRESENT 0x077 |
| 116 | #define DISK_IN 0x170 | 116 | #define DISK_IN 0x170 |
| @@ -118,9 +118,9 @@ struct iwm { | |||
| 118 | #define TRACK_ZERO 0x172 | 118 | #define TRACK_ZERO 0x172 |
| 119 | #define TACHO 0x173 | 119 | #define TACHO 0x173 |
| 120 | #define READ_DATA_1 0x174 | 120 | #define READ_DATA_1 0x174 |
| 121 | #define MFM_MODE 0x175 | 121 | #define GCR_MODE 0x175 |
| 122 | #define SEEK_COMPLETE 0x176 | 122 | #define SEEK_COMPLETE 0x176 |
| 123 | #define ONEMEG_MEDIA 0x177 | 123 | #define TWOMEG_MEDIA 0x177 |
| 124 | 124 | ||
| 125 | /* Bits in handshake register */ | 125 | /* Bits in handshake register */ |
| 126 | 126 | ||
| @@ -612,7 +612,6 @@ static void setup_medium(struct floppy_state *fs) | |||
| 612 | struct floppy_struct *g; | 612 | struct floppy_struct *g; |
| 613 | fs->disk_in = 1; | 613 | fs->disk_in = 1; |
| 614 | fs->write_protected = swim_readbit(base, WRITE_PROT); | 614 | fs->write_protected = swim_readbit(base, WRITE_PROT); |
| 615 | fs->type = swim_readbit(base, ONEMEG_MEDIA); | ||
| 616 | 615 | ||
| 617 | if (swim_track00(base)) | 616 | if (swim_track00(base)) |
| 618 | printk(KERN_ERR | 617 | printk(KERN_ERR |
| @@ -620,6 +619,9 @@ static void setup_medium(struct floppy_state *fs) | |||
| 620 | 619 | ||
| 621 | swim_track00(base); | 620 | swim_track00(base); |
| 622 | 621 | ||
| 622 | fs->type = swim_readbit(base, TWOMEG_MEDIA) ? | ||
| 623 | HD_MEDIA : DD_MEDIA; | ||
| 624 | fs->head_number = swim_readbit(base, SINGLE_SIDED) ? 1 : 2; | ||
| 623 | get_floppy_geometry(fs, 0, &g); | 625 | get_floppy_geometry(fs, 0, &g); |
| 624 | fs->total_secs = g->size; | 626 | fs->total_secs = g->size; |
| 625 | fs->secpercyl = g->head * g->sect; | 627 | fs->secpercyl = g->head * g->sect; |
| @@ -646,7 +648,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
| 646 | 648 | ||
| 647 | swim_write(base, setup, S_IBM_DRIVE | S_FCLK_DIV2); | 649 | swim_write(base, setup, S_IBM_DRIVE | S_FCLK_DIV2); |
| 648 | udelay(10); | 650 | udelay(10); |
| 649 | swim_drive(base, INTERNAL_DRIVE); | 651 | swim_drive(base, fs->location); |
| 650 | swim_motor(base, ON); | 652 | swim_motor(base, ON); |
| 651 | swim_action(base, SETMFM); | 653 | swim_action(base, SETMFM); |
| 652 | if (fs->ejected) | 654 | if (fs->ejected) |
| @@ -656,6 +658,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
| 656 | goto out; | 658 | goto out; |
| 657 | } | 659 | } |
| 658 | 660 | ||
| 661 | set_capacity(fs->disk, fs->total_secs); | ||
| 662 | |||
| 659 | if (mode & FMODE_NDELAY) | 663 | if (mode & FMODE_NDELAY) |
| 660 | return 0; | 664 | return 0; |
| 661 | 665 | ||
| @@ -727,14 +731,9 @@ static int floppy_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 727 | if (copy_to_user((void __user *) param, (void *) &floppy_type, | 731 | if (copy_to_user((void __user *) param, (void *) &floppy_type, |
| 728 | sizeof(struct floppy_struct))) | 732 | sizeof(struct floppy_struct))) |
| 729 | return -EFAULT; | 733 | return -EFAULT; |
| 730 | break; | 734 | return 0; |
| 731 | |||
| 732 | default: | ||
| 733 | printk(KERN_DEBUG "SWIM floppy_ioctl: unknown cmd %d\n", | ||
| 734 | cmd); | ||
| 735 | return -ENOSYS; | ||
| 736 | } | 735 | } |
| 737 | return 0; | 736 | return -ENOTTY; |
| 738 | } | 737 | } |
| 739 | 738 | ||
| 740 | static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) | 739 | static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
| @@ -795,7 +794,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data) | |||
| 795 | struct swim_priv *swd = data; | 794 | struct swim_priv *swd = data; |
| 796 | int drive = (*part & 3); | 795 | int drive = (*part & 3); |
| 797 | 796 | ||
| 798 | if (drive > swd->floppy_count) | 797 | if (drive >= swd->floppy_count) |
| 799 | return NULL; | 798 | return NULL; |
| 800 | 799 | ||
| 801 | *part = 0; | 800 | *part = 0; |
| @@ -813,10 +812,9 @@ static int swim_add_floppy(struct swim_priv *swd, enum drive_location location) | |||
| 813 | 812 | ||
| 814 | swim_motor(base, OFF); | 813 | swim_motor(base, OFF); |
| 815 | 814 | ||
| 816 | if (swim_readbit(base, SINGLE_SIDED)) | 815 | fs->type = HD_MEDIA; |
| 817 | fs->head_number = 1; | 816 | fs->head_number = 2; |
| 818 | else | 817 | |
| 819 | fs->head_number = 2; | ||
| 820 | fs->ref_count = 0; | 818 | fs->ref_count = 0; |
| 821 | fs->ejected = 1; | 819 | fs->ejected = 1; |
| 822 | 820 | ||
| @@ -834,10 +832,12 @@ static int swim_floppy_init(struct swim_priv *swd) | |||
| 834 | /* scan floppy drives */ | 832 | /* scan floppy drives */ |
| 835 | 833 | ||
| 836 | swim_drive(base, INTERNAL_DRIVE); | 834 | swim_drive(base, INTERNAL_DRIVE); |
| 837 | if (swim_readbit(base, DRIVE_PRESENT)) | 835 | if (swim_readbit(base, DRIVE_PRESENT) && |
| 836 | !swim_readbit(base, ONEMEG_DRIVE)) | ||
| 838 | swim_add_floppy(swd, INTERNAL_DRIVE); | 837 | swim_add_floppy(swd, INTERNAL_DRIVE); |
| 839 | swim_drive(base, EXTERNAL_DRIVE); | 838 | swim_drive(base, EXTERNAL_DRIVE); |
| 840 | if (swim_readbit(base, DRIVE_PRESENT)) | 839 | if (swim_readbit(base, DRIVE_PRESENT) && |
| 840 | !swim_readbit(base, ONEMEG_DRIVE)) | ||
| 841 | swim_add_floppy(swd, EXTERNAL_DRIVE); | 841 | swim_add_floppy(swd, EXTERNAL_DRIVE); |
| 842 | 842 | ||
| 843 | /* register floppy drives */ | 843 | /* register floppy drives */ |
| @@ -861,7 +861,6 @@ static int swim_floppy_init(struct swim_priv *swd) | |||
| 861 | &swd->lock); | 861 | &swd->lock); |
| 862 | if (!swd->unit[drive].disk->queue) { | 862 | if (!swd->unit[drive].disk->queue) { |
| 863 | err = -ENOMEM; | 863 | err = -ENOMEM; |
| 864 | put_disk(swd->unit[drive].disk); | ||
| 865 | goto exit_put_disks; | 864 | goto exit_put_disks; |
| 866 | } | 865 | } |
| 867 | blk_queue_bounce_limit(swd->unit[drive].disk->queue, | 866 | blk_queue_bounce_limit(swd->unit[drive].disk->queue, |
| @@ -911,7 +910,7 @@ static int swim_probe(struct platform_device *dev) | |||
| 911 | goto out; | 910 | goto out; |
| 912 | } | 911 | } |
| 913 | 912 | ||
| 914 | swim_base = ioremap(res->start, resource_size(res)); | 913 | swim_base = (struct swim __iomem *)res->start; |
| 915 | if (!swim_base) { | 914 | if (!swim_base) { |
| 916 | ret = -ENOMEM; | 915 | ret = -ENOMEM; |
| 917 | goto out_release_io; | 916 | goto out_release_io; |
| @@ -923,7 +922,7 @@ static int swim_probe(struct platform_device *dev) | |||
| 923 | if (!get_swim_mode(swim_base)) { | 922 | if (!get_swim_mode(swim_base)) { |
| 924 | printk(KERN_INFO "SWIM device not found !\n"); | 923 | printk(KERN_INFO "SWIM device not found !\n"); |
| 925 | ret = -ENODEV; | 924 | ret = -ENODEV; |
| 926 | goto out_iounmap; | 925 | goto out_release_io; |
| 927 | } | 926 | } |
| 928 | 927 | ||
| 929 | /* set platform driver data */ | 928 | /* set platform driver data */ |
| @@ -931,7 +930,7 @@ static int swim_probe(struct platform_device *dev) | |||
| 931 | swd = kzalloc(sizeof(struct swim_priv), GFP_KERNEL); | 930 | swd = kzalloc(sizeof(struct swim_priv), GFP_KERNEL); |
| 932 | if (!swd) { | 931 | if (!swd) { |
| 933 | ret = -ENOMEM; | 932 | ret = -ENOMEM; |
| 934 | goto out_iounmap; | 933 | goto out_release_io; |
| 935 | } | 934 | } |
| 936 | platform_set_drvdata(dev, swd); | 935 | platform_set_drvdata(dev, swd); |
| 937 | 936 | ||
| @@ -945,8 +944,6 @@ static int swim_probe(struct platform_device *dev) | |||
| 945 | 944 | ||
| 946 | out_kfree: | 945 | out_kfree: |
| 947 | kfree(swd); | 946 | kfree(swd); |
| 948 | out_iounmap: | ||
| 949 | iounmap(swim_base); | ||
| 950 | out_release_io: | 947 | out_release_io: |
| 951 | release_mem_region(res->start, resource_size(res)); | 948 | release_mem_region(res->start, resource_size(res)); |
| 952 | out: | 949 | out: |
| @@ -974,8 +971,6 @@ static int swim_remove(struct platform_device *dev) | |||
| 974 | for (drive = 0; drive < swd->floppy_count; drive++) | 971 | for (drive = 0; drive < swd->floppy_count; drive++) |
| 975 | floppy_eject(&swd->unit[drive]); | 972 | floppy_eject(&swd->unit[drive]); |
| 976 | 973 | ||
| 977 | iounmap(swd->base); | ||
| 978 | |||
| 979 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 974 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
| 980 | if (res) | 975 | if (res) |
| 981 | release_mem_region(res->start, resource_size(res)); | 976 | release_mem_region(res->start, resource_size(res)); |
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index af51015d056e..469541c1e51e 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
| @@ -148,7 +148,7 @@ struct swim3 { | |||
| 148 | #define MOTOR_ON 2 | 148 | #define MOTOR_ON 2 |
| 149 | #define RELAX 3 /* also eject in progress */ | 149 | #define RELAX 3 /* also eject in progress */ |
| 150 | #define READ_DATA_0 4 | 150 | #define READ_DATA_0 4 |
| 151 | #define TWOMEG_DRIVE 5 | 151 | #define ONEMEG_DRIVE 5 |
| 152 | #define SINGLE_SIDED 6 /* drive or diskette is 4MB type? */ | 152 | #define SINGLE_SIDED 6 /* drive or diskette is 4MB type? */ |
| 153 | #define DRIVE_PRESENT 7 | 153 | #define DRIVE_PRESENT 7 |
| 154 | #define DISK_IN 8 | 154 | #define DISK_IN 8 |
| @@ -156,9 +156,9 @@ struct swim3 { | |||
| 156 | #define TRACK_ZERO 10 | 156 | #define TRACK_ZERO 10 |
| 157 | #define TACHO 11 | 157 | #define TACHO 11 |
| 158 | #define READ_DATA_1 12 | 158 | #define READ_DATA_1 12 |
| 159 | #define MFM_MODE 13 | 159 | #define GCR_MODE 13 |
| 160 | #define SEEK_COMPLETE 14 | 160 | #define SEEK_COMPLETE 14 |
| 161 | #define ONEMEG_MEDIA 15 | 161 | #define TWOMEG_MEDIA 15 |
| 162 | 162 | ||
| 163 | /* Definitions of values used in writing and formatting */ | 163 | /* Definitions of values used in writing and formatting */ |
| 164 | #define DATA_ESCAPE 0x99 | 164 | #define DATA_ESCAPE 0x99 |
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index d1c0b60e9326..6dc177bf4c42 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig | |||
| @@ -33,6 +33,7 @@ config HISILICON_LPC | |||
| 33 | bool "Support for ISA I/O space on HiSilicon Hip06/7" | 33 | bool "Support for ISA I/O space on HiSilicon Hip06/7" |
| 34 | depends on ARM64 && (ARCH_HISI || COMPILE_TEST) | 34 | depends on ARM64 && (ARCH_HISI || COMPILE_TEST) |
| 35 | select INDIRECT_PIO | 35 | select INDIRECT_PIO |
| 36 | select MFD_CORE if ACPI | ||
| 36 | help | 37 | help |
| 37 | Driver to enable I/O access to devices attached to the Low Pin | 38 | Driver to enable I/O access to devices attached to the Low Pin |
| 38 | Count bus on the HiSilicon Hip06/7 SoC. | 39 | Count bus on the HiSilicon Hip06/7 SoC. |
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 8327478effd0..bfc566d3f31a 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
| @@ -2371,7 +2371,7 @@ static int cdrom_ioctl_media_changed(struct cdrom_device_info *cdi, | |||
| 2371 | if (!CDROM_CAN(CDC_SELECT_DISC) || arg == CDSL_CURRENT) | 2371 | if (!CDROM_CAN(CDC_SELECT_DISC) || arg == CDSL_CURRENT) |
| 2372 | return media_changed(cdi, 1); | 2372 | return media_changed(cdi, 1); |
| 2373 | 2373 | ||
| 2374 | if ((unsigned int)arg >= cdi->capacity) | 2374 | if (arg >= cdi->capacity) |
| 2375 | return -EINVAL; | 2375 | return -EINVAL; |
| 2376 | 2376 | ||
| 2377 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 2377 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 3cd3aae24d6d..cd888d4ee605 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
| @@ -261,6 +261,7 @@ | |||
| 261 | #include <linux/ptrace.h> | 261 | #include <linux/ptrace.h> |
| 262 | #include <linux/workqueue.h> | 262 | #include <linux/workqueue.h> |
| 263 | #include <linux/irq.h> | 263 | #include <linux/irq.h> |
| 264 | #include <linux/ratelimit.h> | ||
| 264 | #include <linux/syscalls.h> | 265 | #include <linux/syscalls.h> |
| 265 | #include <linux/completion.h> | 266 | #include <linux/completion.h> |
| 266 | #include <linux/uuid.h> | 267 | #include <linux/uuid.h> |
| @@ -438,6 +439,16 @@ static void _crng_backtrack_protect(struct crng_state *crng, | |||
| 438 | static void process_random_ready_list(void); | 439 | static void process_random_ready_list(void); |
| 439 | static void _get_random_bytes(void *buf, int nbytes); | 440 | static void _get_random_bytes(void *buf, int nbytes); |
| 440 | 441 | ||
| 442 | static struct ratelimit_state unseeded_warning = | ||
| 443 | RATELIMIT_STATE_INIT("warn_unseeded_randomness", HZ, 3); | ||
| 444 | static struct ratelimit_state urandom_warning = | ||
| 445 | RATELIMIT_STATE_INIT("warn_urandom_randomness", HZ, 3); | ||
| 446 | |||
| 447 | static int ratelimit_disable __read_mostly; | ||
| 448 | |||
| 449 | module_param_named(ratelimit_disable, ratelimit_disable, int, 0644); | ||
| 450 | MODULE_PARM_DESC(ratelimit_disable, "Disable random ratelimit suppression"); | ||
| 451 | |||
| 441 | /********************************************************************** | 452 | /********************************************************************** |
| 442 | * | 453 | * |
| 443 | * OS independent entropy store. Here are the functions which handle | 454 | * OS independent entropy store. Here are the functions which handle |
| @@ -789,7 +800,7 @@ static void crng_initialize(struct crng_state *crng) | |||
| 789 | } | 800 | } |
| 790 | 801 | ||
| 791 | #ifdef CONFIG_NUMA | 802 | #ifdef CONFIG_NUMA |
| 792 | static void numa_crng_init(void) | 803 | static void do_numa_crng_init(struct work_struct *work) |
| 793 | { | 804 | { |
| 794 | int i; | 805 | int i; |
| 795 | struct crng_state *crng; | 806 | struct crng_state *crng; |
| @@ -810,6 +821,13 @@ static void numa_crng_init(void) | |||
| 810 | kfree(pool); | 821 | kfree(pool); |
| 811 | } | 822 | } |
| 812 | } | 823 | } |
| 824 | |||
| 825 | static DECLARE_WORK(numa_crng_init_work, do_numa_crng_init); | ||
| 826 | |||
| 827 | static void numa_crng_init(void) | ||
| 828 | { | ||
| 829 | schedule_work(&numa_crng_init_work); | ||
| 830 | } | ||
| 813 | #else | 831 | #else |
| 814 | static void numa_crng_init(void) {} | 832 | static void numa_crng_init(void) {} |
| 815 | #endif | 833 | #endif |
| @@ -925,6 +943,18 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) | |||
| 925 | process_random_ready_list(); | 943 | process_random_ready_list(); |
| 926 | wake_up_interruptible(&crng_init_wait); | 944 | wake_up_interruptible(&crng_init_wait); |
| 927 | pr_notice("random: crng init done\n"); | 945 | pr_notice("random: crng init done\n"); |
| 946 | if (unseeded_warning.missed) { | ||
| 947 | pr_notice("random: %d get_random_xx warning(s) missed " | ||
| 948 | "due to ratelimiting\n", | ||
| 949 | unseeded_warning.missed); | ||
| 950 | unseeded_warning.missed = 0; | ||
| 951 | } | ||
| 952 | if (urandom_warning.missed) { | ||
| 953 | pr_notice("random: %d urandom warning(s) missed " | ||
| 954 | "due to ratelimiting\n", | ||
| 955 | urandom_warning.missed); | ||
| 956 | urandom_warning.missed = 0; | ||
| 957 | } | ||
| 928 | } | 958 | } |
| 929 | } | 959 | } |
| 930 | 960 | ||
| @@ -1565,8 +1595,9 @@ static void _warn_unseeded_randomness(const char *func_name, void *caller, | |||
| 1565 | #ifndef CONFIG_WARN_ALL_UNSEEDED_RANDOM | 1595 | #ifndef CONFIG_WARN_ALL_UNSEEDED_RANDOM |
| 1566 | print_once = true; | 1596 | print_once = true; |
| 1567 | #endif | 1597 | #endif |
| 1568 | pr_notice("random: %s called from %pS with crng_init=%d\n", | 1598 | if (__ratelimit(&unseeded_warning)) |
| 1569 | func_name, caller, crng_init); | 1599 | pr_notice("random: %s called from %pS with crng_init=%d\n", |
| 1600 | func_name, caller, crng_init); | ||
| 1570 | } | 1601 | } |
| 1571 | 1602 | ||
| 1572 | /* | 1603 | /* |
| @@ -1760,6 +1791,10 @@ static int rand_initialize(void) | |||
| 1760 | init_std_data(&blocking_pool); | 1791 | init_std_data(&blocking_pool); |
| 1761 | crng_initialize(&primary_crng); | 1792 | crng_initialize(&primary_crng); |
| 1762 | crng_global_init_time = jiffies; | 1793 | crng_global_init_time = jiffies; |
| 1794 | if (ratelimit_disable) { | ||
| 1795 | urandom_warning.interval = 0; | ||
| 1796 | unseeded_warning.interval = 0; | ||
| 1797 | } | ||
| 1763 | return 0; | 1798 | return 0; |
| 1764 | } | 1799 | } |
| 1765 | early_initcall(rand_initialize); | 1800 | early_initcall(rand_initialize); |
| @@ -1827,9 +1862,10 @@ urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | |||
| 1827 | 1862 | ||
| 1828 | if (!crng_ready() && maxwarn > 0) { | 1863 | if (!crng_ready() && maxwarn > 0) { |
| 1829 | maxwarn--; | 1864 | maxwarn--; |
| 1830 | printk(KERN_NOTICE "random: %s: uninitialized urandom read " | 1865 | if (__ratelimit(&urandom_warning)) |
| 1831 | "(%zd bytes read)\n", | 1866 | printk(KERN_NOTICE "random: %s: uninitialized " |
| 1832 | current->comm, nbytes); | 1867 | "urandom read (%zd bytes read)\n", |
| 1868 | current->comm, nbytes); | ||
| 1833 | spin_lock_irqsave(&primary_crng.lock, flags); | 1869 | spin_lock_irqsave(&primary_crng.lock, flags); |
| 1834 | crng_init_cnt = 0; | 1870 | crng_init_cnt = 0; |
| 1835 | spin_unlock_irqrestore(&primary_crng.lock, flags); | 1871 | spin_unlock_irqrestore(&primary_crng.lock, flags); |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 468f06134012..21085515814f 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -422,7 +422,7 @@ static void reclaim_dma_bufs(void) | |||
| 422 | } | 422 | } |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, | 425 | static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size, |
| 426 | int pages) | 426 | int pages) |
| 427 | { | 427 | { |
| 428 | struct port_buffer *buf; | 428 | struct port_buffer *buf; |
| @@ -445,16 +445,16 @@ static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, | |||
| 445 | return buf; | 445 | return buf; |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | if (is_rproc_serial(vq->vdev)) { | 448 | if (is_rproc_serial(vdev)) { |
| 449 | /* | 449 | /* |
| 450 | * Allocate DMA memory from ancestor. When a virtio | 450 | * Allocate DMA memory from ancestor. When a virtio |
| 451 | * device is created by remoteproc, the DMA memory is | 451 | * device is created by remoteproc, the DMA memory is |
| 452 | * associated with the grandparent device: | 452 | * associated with the grandparent device: |
| 453 | * vdev => rproc => platform-dev. | 453 | * vdev => rproc => platform-dev. |
| 454 | */ | 454 | */ |
| 455 | if (!vq->vdev->dev.parent || !vq->vdev->dev.parent->parent) | 455 | if (!vdev->dev.parent || !vdev->dev.parent->parent) |
| 456 | goto free_buf; | 456 | goto free_buf; |
| 457 | buf->dev = vq->vdev->dev.parent->parent; | 457 | buf->dev = vdev->dev.parent->parent; |
| 458 | 458 | ||
| 459 | /* Increase device refcnt to avoid freeing it */ | 459 | /* Increase device refcnt to avoid freeing it */ |
| 460 | get_device(buf->dev); | 460 | get_device(buf->dev); |
| @@ -838,7 +838,7 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, | |||
| 838 | 838 | ||
| 839 | count = min((size_t)(32 * 1024), count); | 839 | count = min((size_t)(32 * 1024), count); |
| 840 | 840 | ||
| 841 | buf = alloc_buf(port->out_vq, count, 0); | 841 | buf = alloc_buf(port->portdev->vdev, count, 0); |
| 842 | if (!buf) | 842 | if (!buf) |
| 843 | return -ENOMEM; | 843 | return -ENOMEM; |
| 844 | 844 | ||
| @@ -957,7 +957,7 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
| 957 | if (ret < 0) | 957 | if (ret < 0) |
| 958 | goto error_out; | 958 | goto error_out; |
| 959 | 959 | ||
| 960 | buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); | 960 | buf = alloc_buf(port->portdev->vdev, 0, pipe->nrbufs); |
| 961 | if (!buf) { | 961 | if (!buf) { |
| 962 | ret = -ENOMEM; | 962 | ret = -ENOMEM; |
| 963 | goto error_out; | 963 | goto error_out; |
| @@ -1374,7 +1374,7 @@ static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock) | |||
| 1374 | 1374 | ||
| 1375 | nr_added_bufs = 0; | 1375 | nr_added_bufs = 0; |
| 1376 | do { | 1376 | do { |
| 1377 | buf = alloc_buf(vq, PAGE_SIZE, 0); | 1377 | buf = alloc_buf(vq->vdev, PAGE_SIZE, 0); |
| 1378 | if (!buf) | 1378 | if (!buf) |
| 1379 | break; | 1379 | break; |
| 1380 | 1380 | ||
| @@ -1402,7 +1402,6 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
| 1402 | { | 1402 | { |
| 1403 | char debugfs_name[16]; | 1403 | char debugfs_name[16]; |
| 1404 | struct port *port; | 1404 | struct port *port; |
| 1405 | struct port_buffer *buf; | ||
| 1406 | dev_t devt; | 1405 | dev_t devt; |
| 1407 | unsigned int nr_added_bufs; | 1406 | unsigned int nr_added_bufs; |
| 1408 | int err; | 1407 | int err; |
| @@ -1513,8 +1512,6 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
| 1513 | return 0; | 1512 | return 0; |
| 1514 | 1513 | ||
| 1515 | free_inbufs: | 1514 | free_inbufs: |
| 1516 | while ((buf = virtqueue_detach_unused_buf(port->in_vq))) | ||
| 1517 | free_buf(buf, true); | ||
| 1518 | free_device: | 1515 | free_device: |
| 1519 | device_destroy(pdrvdata.class, port->dev->devt); | 1516 | device_destroy(pdrvdata.class, port->dev->devt); |
| 1520 | free_cdev: | 1517 | free_cdev: |
| @@ -1539,34 +1536,14 @@ static void remove_port(struct kref *kref) | |||
| 1539 | 1536 | ||
| 1540 | static void remove_port_data(struct port *port) | 1537 | static void remove_port_data(struct port *port) |
| 1541 | { | 1538 | { |
| 1542 | struct port_buffer *buf; | ||
| 1543 | |||
| 1544 | spin_lock_irq(&port->inbuf_lock); | 1539 | spin_lock_irq(&port->inbuf_lock); |
| 1545 | /* Remove unused data this port might have received. */ | 1540 | /* Remove unused data this port might have received. */ |
| 1546 | discard_port_data(port); | 1541 | discard_port_data(port); |
| 1547 | spin_unlock_irq(&port->inbuf_lock); | 1542 | spin_unlock_irq(&port->inbuf_lock); |
| 1548 | 1543 | ||
| 1549 | /* Remove buffers we queued up for the Host to send us data in. */ | ||
| 1550 | do { | ||
| 1551 | spin_lock_irq(&port->inbuf_lock); | ||
| 1552 | buf = virtqueue_detach_unused_buf(port->in_vq); | ||
| 1553 | spin_unlock_irq(&port->inbuf_lock); | ||
| 1554 | if (buf) | ||
| 1555 | free_buf(buf, true); | ||
| 1556 | } while (buf); | ||
| 1557 | |||
| 1558 | spin_lock_irq(&port->outvq_lock); | 1544 | spin_lock_irq(&port->outvq_lock); |
| 1559 | reclaim_consumed_buffers(port); | 1545 | reclaim_consumed_buffers(port); |
| 1560 | spin_unlock_irq(&port->outvq_lock); | 1546 | spin_unlock_irq(&port->outvq_lock); |
| 1561 | |||
| 1562 | /* Free pending buffers from the out-queue. */ | ||
| 1563 | do { | ||
| 1564 | spin_lock_irq(&port->outvq_lock); | ||
| 1565 | buf = virtqueue_detach_unused_buf(port->out_vq); | ||
| 1566 | spin_unlock_irq(&port->outvq_lock); | ||
| 1567 | if (buf) | ||
| 1568 | free_buf(buf, true); | ||
| 1569 | } while (buf); | ||
| 1570 | } | 1547 | } |
| 1571 | 1548 | ||
| 1572 | /* | 1549 | /* |
| @@ -1791,13 +1768,24 @@ static void control_work_handler(struct work_struct *work) | |||
| 1791 | spin_unlock(&portdev->c_ivq_lock); | 1768 | spin_unlock(&portdev->c_ivq_lock); |
| 1792 | } | 1769 | } |
| 1793 | 1770 | ||
| 1771 | static void flush_bufs(struct virtqueue *vq, bool can_sleep) | ||
| 1772 | { | ||
| 1773 | struct port_buffer *buf; | ||
| 1774 | unsigned int len; | ||
| 1775 | |||
| 1776 | while ((buf = virtqueue_get_buf(vq, &len))) | ||
| 1777 | free_buf(buf, can_sleep); | ||
| 1778 | } | ||
| 1779 | |||
| 1794 | static void out_intr(struct virtqueue *vq) | 1780 | static void out_intr(struct virtqueue *vq) |
| 1795 | { | 1781 | { |
| 1796 | struct port *port; | 1782 | struct port *port; |
| 1797 | 1783 | ||
| 1798 | port = find_port_by_vq(vq->vdev->priv, vq); | 1784 | port = find_port_by_vq(vq->vdev->priv, vq); |
| 1799 | if (!port) | 1785 | if (!port) { |
| 1786 | flush_bufs(vq, false); | ||
| 1800 | return; | 1787 | return; |
| 1788 | } | ||
| 1801 | 1789 | ||
| 1802 | wake_up_interruptible(&port->waitqueue); | 1790 | wake_up_interruptible(&port->waitqueue); |
| 1803 | } | 1791 | } |
| @@ -1808,8 +1796,10 @@ static void in_intr(struct virtqueue *vq) | |||
| 1808 | unsigned long flags; | 1796 | unsigned long flags; |
| 1809 | 1797 | ||
| 1810 | port = find_port_by_vq(vq->vdev->priv, vq); | 1798 | port = find_port_by_vq(vq->vdev->priv, vq); |
| 1811 | if (!port) | 1799 | if (!port) { |
| 1800 | flush_bufs(vq, false); | ||
| 1812 | return; | 1801 | return; |
| 1802 | } | ||
| 1813 | 1803 | ||
| 1814 | spin_lock_irqsave(&port->inbuf_lock, flags); | 1804 | spin_lock_irqsave(&port->inbuf_lock, flags); |
| 1815 | port->inbuf = get_inbuf(port); | 1805 | port->inbuf = get_inbuf(port); |
| @@ -1984,24 +1974,54 @@ static const struct file_operations portdev_fops = { | |||
| 1984 | 1974 | ||
| 1985 | static void remove_vqs(struct ports_device *portdev) | 1975 | static void remove_vqs(struct ports_device *portdev) |
| 1986 | { | 1976 | { |
| 1977 | struct virtqueue *vq; | ||
| 1978 | |||
| 1979 | virtio_device_for_each_vq(portdev->vdev, vq) { | ||
| 1980 | struct port_buffer *buf; | ||
| 1981 | |||
| 1982 | flush_bufs(vq, true); | ||
| 1983 | while ((buf = virtqueue_detach_unused_buf(vq))) | ||
| 1984 | free_buf(buf, true); | ||
| 1985 | } | ||
| 1987 | portdev->vdev->config->del_vqs(portdev->vdev); | 1986 | portdev->vdev->config->del_vqs(portdev->vdev); |
| 1988 | kfree(portdev->in_vqs); | 1987 | kfree(portdev->in_vqs); |
| 1989 | kfree(portdev->out_vqs); | 1988 | kfree(portdev->out_vqs); |
| 1990 | } | 1989 | } |
| 1991 | 1990 | ||
| 1992 | static void remove_controlq_data(struct ports_device *portdev) | 1991 | static void virtcons_remove(struct virtio_device *vdev) |
| 1993 | { | 1992 | { |
| 1994 | struct port_buffer *buf; | 1993 | struct ports_device *portdev; |
| 1995 | unsigned int len; | 1994 | struct port *port, *port2; |
| 1996 | 1995 | ||
| 1997 | if (!use_multiport(portdev)) | 1996 | portdev = vdev->priv; |
| 1998 | return; | ||
| 1999 | 1997 | ||
| 2000 | while ((buf = virtqueue_get_buf(portdev->c_ivq, &len))) | 1998 | spin_lock_irq(&pdrvdata_lock); |
| 2001 | free_buf(buf, true); | 1999 | list_del(&portdev->list); |
| 2000 | spin_unlock_irq(&pdrvdata_lock); | ||
| 2002 | 2001 | ||
| 2003 | while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq))) | 2002 | /* Disable interrupts for vqs */ |
| 2004 | free_buf(buf, true); | 2003 | vdev->config->reset(vdev); |
| 2004 | /* Finish up work that's lined up */ | ||
| 2005 | if (use_multiport(portdev)) | ||
| 2006 | cancel_work_sync(&portdev->control_work); | ||
| 2007 | else | ||
| 2008 | cancel_work_sync(&portdev->config_work); | ||
| 2009 | |||
| 2010 | list_for_each_entry_safe(port, port2, &portdev->ports, list) | ||
| 2011 | unplug_port(port); | ||
| 2012 | |||
| 2013 | unregister_chrdev(portdev->chr_major, "virtio-portsdev"); | ||
| 2014 | |||
| 2015 | /* | ||
| 2016 | * When yanking out a device, we immediately lose the | ||
| 2017 | * (device-side) queues. So there's no point in keeping the | ||
| 2018 | * guest side around till we drop our final reference. This | ||
| 2019 | * also means that any ports which are in an open state will | ||
| 2020 | * have to just stop using the port, as the vqs are going | ||
| 2021 | * away. | ||
| 2022 | */ | ||
| 2023 | remove_vqs(portdev); | ||
| 2024 | kfree(portdev); | ||
| 2005 | } | 2025 | } |
| 2006 | 2026 | ||
| 2007 | /* | 2027 | /* |
| @@ -2070,6 +2090,7 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
| 2070 | 2090 | ||
| 2071 | spin_lock_init(&portdev->ports_lock); | 2091 | spin_lock_init(&portdev->ports_lock); |
| 2072 | INIT_LIST_HEAD(&portdev->ports); | 2092 | INIT_LIST_HEAD(&portdev->ports); |
| 2093 | INIT_LIST_HEAD(&portdev->list); | ||
| 2073 | 2094 | ||
| 2074 | virtio_device_ready(portdev->vdev); | 2095 | virtio_device_ready(portdev->vdev); |
| 2075 | 2096 | ||
| @@ -2087,8 +2108,15 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
| 2087 | if (!nr_added_bufs) { | 2108 | if (!nr_added_bufs) { |
| 2088 | dev_err(&vdev->dev, | 2109 | dev_err(&vdev->dev, |
| 2089 | "Error allocating buffers for control queue\n"); | 2110 | "Error allocating buffers for control queue\n"); |
| 2090 | err = -ENOMEM; | 2111 | /* |
| 2091 | goto free_vqs; | 2112 | * The host might want to notify mgmt sw about device |
| 2113 | * add failure. | ||
| 2114 | */ | ||
| 2115 | __send_control_msg(portdev, VIRTIO_CONSOLE_BAD_ID, | ||
| 2116 | VIRTIO_CONSOLE_DEVICE_READY, 0); | ||
| 2117 | /* Device was functional: we need full cleanup. */ | ||
| 2118 | virtcons_remove(vdev); | ||
| 2119 | return -ENOMEM; | ||
| 2092 | } | 2120 | } |
| 2093 | } else { | 2121 | } else { |
| 2094 | /* | 2122 | /* |
| @@ -2119,11 +2147,6 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
| 2119 | 2147 | ||
| 2120 | return 0; | 2148 | return 0; |
| 2121 | 2149 | ||
| 2122 | free_vqs: | ||
| 2123 | /* The host might want to notify mgmt sw about device add failure */ | ||
| 2124 | __send_control_msg(portdev, VIRTIO_CONSOLE_BAD_ID, | ||
| 2125 | VIRTIO_CONSOLE_DEVICE_READY, 0); | ||
| 2126 | remove_vqs(portdev); | ||
| 2127 | free_chrdev: | 2150 | free_chrdev: |
| 2128 | unregister_chrdev(portdev->chr_major, "virtio-portsdev"); | 2151 | unregister_chrdev(portdev->chr_major, "virtio-portsdev"); |
| 2129 | free: | 2152 | free: |
| @@ -2132,43 +2155,6 @@ fail: | |||
| 2132 | return err; | 2155 | return err; |
| 2133 | } | 2156 | } |
| 2134 | 2157 | ||
| 2135 | static void virtcons_remove(struct virtio_device *vdev) | ||
| 2136 | { | ||
| 2137 | struct ports_device *portdev; | ||
| 2138 | struct port *port, *port2; | ||
| 2139 | |||
| 2140 | portdev = vdev->priv; | ||
| 2141 | |||
| 2142 | spin_lock_irq(&pdrvdata_lock); | ||
| 2143 | list_del(&portdev->list); | ||
| 2144 | spin_unlock_irq(&pdrvdata_lock); | ||
| 2145 | |||
| 2146 | /* Disable interrupts for vqs */ | ||
| 2147 | vdev->config->reset(vdev); | ||
| 2148 | /* Finish up work that's lined up */ | ||
| 2149 | if (use_multiport(portdev)) | ||
| 2150 | cancel_work_sync(&portdev->control_work); | ||
| 2151 | else | ||
| 2152 | cancel_work_sync(&portdev->config_work); | ||
| 2153 | |||
| 2154 | list_for_each_entry_safe(port, port2, &portdev->ports, list) | ||
| 2155 | unplug_port(port); | ||
| 2156 | |||
| 2157 | unregister_chrdev(portdev->chr_major, "virtio-portsdev"); | ||
| 2158 | |||
| 2159 | /* | ||
| 2160 | * When yanking out a device, we immediately lose the | ||
| 2161 | * (device-side) queues. So there's no point in keeping the | ||
| 2162 | * guest side around till we drop our final reference. This | ||
| 2163 | * also means that any ports which are in an open state will | ||
| 2164 | * have to just stop using the port, as the vqs are going | ||
| 2165 | * away. | ||
| 2166 | */ | ||
| 2167 | remove_controlq_data(portdev); | ||
| 2168 | remove_vqs(portdev); | ||
| 2169 | kfree(portdev); | ||
| 2170 | } | ||
| 2171 | |||
| 2172 | static struct virtio_device_id id_table[] = { | 2158 | static struct virtio_device_id id_table[] = { |
| 2173 | { VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID }, | 2159 | { VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID }, |
| 2174 | { 0 }, | 2160 | { 0 }, |
| @@ -2209,7 +2195,6 @@ static int virtcons_freeze(struct virtio_device *vdev) | |||
| 2209 | */ | 2195 | */ |
| 2210 | if (use_multiport(portdev)) | 2196 | if (use_multiport(portdev)) |
| 2211 | virtqueue_disable_cb(portdev->c_ivq); | 2197 | virtqueue_disable_cb(portdev->c_ivq); |
| 2212 | remove_controlq_data(portdev); | ||
| 2213 | 2198 | ||
| 2214 | list_for_each_entry(port, &portdev->ports, list) { | 2199 | list_for_each_entry(port, &portdev->ports, list) { |
| 2215 | virtqueue_disable_cb(port->in_vq); | 2200 | virtqueue_disable_cb(port->in_vq); |
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 7f56fe5183f2..de55c7d57438 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
| @@ -71,16 +71,6 @@ config ARM_BRCMSTB_AVS_CPUFREQ | |||
| 71 | 71 | ||
| 72 | Say Y, if you have a Broadcom SoC with AVS support for DFS or DVFS. | 72 | Say Y, if you have a Broadcom SoC with AVS support for DFS or DVFS. |
| 73 | 73 | ||
| 74 | config ARM_BRCMSTB_AVS_CPUFREQ_DEBUG | ||
| 75 | bool "Broadcom STB AVS CPUfreq driver sysfs debug capability" | ||
| 76 | depends on ARM_BRCMSTB_AVS_CPUFREQ | ||
| 77 | help | ||
| 78 | Enabling this option turns on debug support via sysfs under | ||
| 79 | /sys/kernel/debug/brcmstb-avs-cpufreq. It is possible to read all and | ||
| 80 | write some AVS mailbox registers through sysfs entries. | ||
| 81 | |||
| 82 | If in doubt, say N. | ||
| 83 | |||
| 84 | config ARM_EXYNOS5440_CPUFREQ | 74 | config ARM_EXYNOS5440_CPUFREQ |
| 85 | tristate "SAMSUNG EXYNOS5440" | 75 | tristate "SAMSUNG EXYNOS5440" |
| 86 | depends on SOC_EXYNOS5440 | 76 | depends on SOC_EXYNOS5440 |
diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c index 6cdac1aaf23c..b07559b9ed99 100644 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c | |||
| @@ -49,13 +49,6 @@ | |||
| 49 | #include <linux/platform_device.h> | 49 | #include <linux/platform_device.h> |
| 50 | #include <linux/semaphore.h> | 50 | #include <linux/semaphore.h> |
| 51 | 51 | ||
| 52 | #ifdef CONFIG_ARM_BRCMSTB_AVS_CPUFREQ_DEBUG | ||
| 53 | #include <linux/ctype.h> | ||
| 54 | #include <linux/debugfs.h> | ||
| 55 | #include <linux/slab.h> | ||
| 56 | #include <linux/uaccess.h> | ||
| 57 | #endif | ||
| 58 | |||
| 59 | /* Max number of arguments AVS calls take */ | 52 | /* Max number of arguments AVS calls take */ |
| 60 | #define AVS_MAX_CMD_ARGS 4 | 53 | #define AVS_MAX_CMD_ARGS 4 |
| 61 | /* | 54 | /* |
| @@ -182,88 +175,11 @@ struct private_data { | |||
| 182 | void __iomem *base; | 175 | void __iomem *base; |
| 183 | void __iomem *avs_intr_base; | 176 | void __iomem *avs_intr_base; |
| 184 | struct device *dev; | 177 | struct device *dev; |
| 185 | #ifdef CONFIG_ARM_BRCMSTB_AVS_CPUFREQ_DEBUG | ||
| 186 | struct dentry *debugfs; | ||
| 187 | #endif | ||
| 188 | struct completion done; | 178 | struct completion done; |
| 189 | struct semaphore sem; | 179 | struct semaphore sem; |
| 190 | struct pmap pmap; | 180 | struct pmap pmap; |
| 191 | }; | 181 | }; |
| 192 | 182 | ||
| 193 | #ifdef CONFIG_ARM_BRCMSTB_AVS_CPUFREQ_DEBUG | ||
| 194 | |||
| 195 | enum debugfs_format { | ||
| 196 | DEBUGFS_NORMAL, | ||
| 197 | DEBUGFS_FLOAT, | ||
| 198 | DEBUGFS_REV, | ||
| 199 | }; | ||
| 200 | |||
| 201 | struct debugfs_data { | ||
| 202 | struct debugfs_entry *entry; | ||
| 203 | struct private_data *priv; | ||
| 204 | }; | ||
| 205 | |||
| 206 | struct debugfs_entry { | ||
| 207 | char *name; | ||
| 208 | u32 offset; | ||
| 209 | fmode_t mode; | ||
| 210 | enum debugfs_format format; | ||
| 211 | }; | ||
| 212 | |||
| 213 | #define DEBUGFS_ENTRY(name, mode, format) { \ | ||
| 214 | #name, AVS_MBOX_##name, mode, format \ | ||
| 215 | } | ||
| 216 | |||
| 217 | /* | ||
| 218 | * These are used for debugfs only. Otherwise we use AVS_MBOX_PARAM() directly. | ||
| 219 | */ | ||
| 220 | #define AVS_MBOX_PARAM1 AVS_MBOX_PARAM(0) | ||
| 221 | #define AVS_MBOX_PARAM2 AVS_MBOX_PARAM(1) | ||
| 222 | #define AVS_MBOX_PARAM3 AVS_MBOX_PARAM(2) | ||
| 223 | #define AVS_MBOX_PARAM4 AVS_MBOX_PARAM(3) | ||
| 224 | |||
| 225 | /* | ||
| 226 | * This table stores the name, access permissions and offset for each hardware | ||
| 227 | * register and is used to generate debugfs entries. | ||
| 228 | */ | ||
| 229 | static struct debugfs_entry debugfs_entries[] = { | ||
| 230 | DEBUGFS_ENTRY(COMMAND, S_IWUSR, DEBUGFS_NORMAL), | ||
| 231 | DEBUGFS_ENTRY(STATUS, S_IWUSR, DEBUGFS_NORMAL), | ||
| 232 | DEBUGFS_ENTRY(VOLTAGE0, 0, DEBUGFS_FLOAT), | ||
| 233 | DEBUGFS_ENTRY(TEMP0, 0, DEBUGFS_FLOAT), | ||
| 234 | DEBUGFS_ENTRY(PV0, 0, DEBUGFS_FLOAT), | ||
| 235 | DEBUGFS_ENTRY(MV0, 0, DEBUGFS_FLOAT), | ||
| 236 | DEBUGFS_ENTRY(PARAM1, S_IWUSR, DEBUGFS_NORMAL), | ||
| 237 | DEBUGFS_ENTRY(PARAM2, S_IWUSR, DEBUGFS_NORMAL), | ||
| 238 | DEBUGFS_ENTRY(PARAM3, S_IWUSR, DEBUGFS_NORMAL), | ||
| 239 | DEBUGFS_ENTRY(PARAM4, S_IWUSR, DEBUGFS_NORMAL), | ||
| 240 | DEBUGFS_ENTRY(REVISION, 0, DEBUGFS_REV), | ||
| 241 | DEBUGFS_ENTRY(PSTATE, 0, DEBUGFS_NORMAL), | ||
| 242 | DEBUGFS_ENTRY(HEARTBEAT, 0, DEBUGFS_NORMAL), | ||
| 243 | DEBUGFS_ENTRY(MAGIC, S_IWUSR, DEBUGFS_NORMAL), | ||
| 244 | DEBUGFS_ENTRY(SIGMA_HVT, 0, DEBUGFS_NORMAL), | ||
| 245 | DEBUGFS_ENTRY(SIGMA_SVT, 0, DEBUGFS_NORMAL), | ||
| 246 | DEBUGFS_ENTRY(VOLTAGE1, 0, DEBUGFS_FLOAT), | ||
| 247 | DEBUGFS_ENTRY(TEMP1, 0, DEBUGFS_FLOAT), | ||
| 248 | DEBUGFS_ENTRY(PV1, 0, DEBUGFS_FLOAT), | ||
| 249 | DEBUGFS_ENTRY(MV1, 0, DEBUGFS_FLOAT), | ||
| 250 | DEBUGFS_ENTRY(FREQUENCY, 0, DEBUGFS_NORMAL), | ||
| 251 | }; | ||
| 252 | |||
| 253 | static int brcm_avs_target_index(struct cpufreq_policy *, unsigned int); | ||
| 254 | |||
| 255 | static char *__strtolower(char *s) | ||
| 256 | { | ||
| 257 | char *p; | ||
| 258 | |||
| 259 | for (p = s; *p; p++) | ||
| 260 | *p = tolower(*p); | ||
| 261 | |||
| 262 | return s; | ||
| 263 | } | ||
| 264 | |||
| 265 | #endif /* CONFIG_ARM_BRCMSTB_AVS_CPUFREQ_DEBUG */ | ||
| 266 | |||
| 267 | static void __iomem *__map_region(const char *name) | 183 | static void __iomem *__map_region(const char *name) |
| 268 | { | 184 | { |
| 269 | struct device_node *np; | 185 | struct device_node *np; |
| @@ -516,238 +432,6 @@ brcm_avs_get_freq_table(struct device *dev, struct private_data *priv) | |||
| 516 | return table; | 432 | return table; |
| 517 | } | 433 | } |
| 518 | 434 | ||
| 519 | #ifdef CONFIG_ARM_BRCMSTB_AVS_CPUFREQ_DEBUG | ||
| 520 | |||
| 521 | #define MANT(x) (unsigned int)(abs((x)) / 1000) | ||
| 522 | #define FRAC(x) (unsigned int)(abs((x)) - abs((x)) / 1000 * 1000) | ||
| 523 | |||
| 524 | static int brcm_avs_debug_show(struct seq_file *s, void *data) | ||
| 525 | { | ||
| 526 | struct debugfs_data *dbgfs = s->private; | ||
| 527 | void __iomem *base; | ||
| 528 | u32 val, offset; | ||
| 529 | |||
| 530 | if (!dbgfs) { | ||
| 531 | seq_puts(s, "No device pointer\n"); | ||
| 532 | return 0; | ||
| 533 | } | ||
| 534 | |||
| 535 | base = dbgfs->priv->base; | ||
| 536 | offset = dbgfs->entry->offset; | ||
| 537 | val = readl(base + offset); | ||
| 538 | switch (dbgfs->entry->format) { | ||
| 539 | case DEBUGFS_NORMAL: | ||
| 540 | seq_printf(s, "%u\n", val); | ||
| 541 | break; | ||
| 542 | case DEBUGFS_FLOAT: | ||
| 543 | seq_printf(s, "%d.%03d\n", MANT(val), FRAC(val)); | ||
| 544 | break; | ||
| 545 | case DEBUGFS_REV: | ||
| 546 | seq_printf(s, "%c.%c.%c.%c\n", (val >> 24 & 0xff), | ||
| 547 | (val >> 16 & 0xff), (val >> 8 & 0xff), | ||
| 548 | val & 0xff); | ||
| 549 | break; | ||
| 550 | } | ||
| 551 | seq_printf(s, "0x%08x\n", val); | ||
| 552 | |||
| 553 | return 0; | ||
| 554 | } | ||
| 555 | |||
| 556 | #undef MANT | ||
| 557 | #undef FRAC | ||
| 558 | |||
| 559 | static ssize_t brcm_avs_seq_write(struct file *file, const char __user *buf, | ||
| 560 | size_t size, loff_t *ppos) | ||
| 561 | { | ||
| 562 | struct seq_file *s = file->private_data; | ||
| 563 | struct debugfs_data *dbgfs = s->private; | ||
| 564 | struct private_data *priv = dbgfs->priv; | ||
| 565 | void __iomem *base, *avs_intr_base; | ||
| 566 | bool use_issue_command = false; | ||
| 567 | unsigned long val, offset; | ||
| 568 | char str[128]; | ||
| 569 | int ret; | ||
| 570 | char *str_ptr = str; | ||
| 571 | |||
| 572 | if (size >= sizeof(str)) | ||
| 573 | return -E2BIG; | ||
| 574 | |||
| 575 | memset(str, 0, sizeof(str)); | ||
| 576 | ret = copy_from_user(str, buf, size); | ||
| 577 | if (ret) | ||
| 578 | return ret; | ||
| 579 | |||
| 580 | base = priv->base; | ||
| 581 | avs_intr_base = priv->avs_intr_base; | ||
| 582 | offset = dbgfs->entry->offset; | ||
| 583 | /* | ||
| 584 | * Special case writing to "command" entry only: if the string starts | ||
| 585 | * with a 'c', we use the driver's __issue_avs_command() function. | ||
| 586 | * Otherwise, we perform a raw write. This should allow testing of raw | ||
| 587 | * access as well as using the higher level function. (Raw access | ||
| 588 | * doesn't clear the firmware return status after issuing the command.) | ||
| 589 | */ | ||
| 590 | if (str_ptr[0] == 'c' && offset == AVS_MBOX_COMMAND) { | ||
| 591 | use_issue_command = true; | ||
| 592 | str_ptr++; | ||
| 593 | } | ||
| 594 | if (kstrtoul(str_ptr, 0, &val) != 0) | ||
| 595 | return -EINVAL; | ||
| 596 | |||
| 597 | /* | ||
| 598 | * Setting the P-state is a special case. We need to update the CPU | ||
| 599 | * frequency we report. | ||
| 600 | */ | ||
| 601 | if (val == AVS_CMD_SET_PSTATE) { | ||
| 602 | struct cpufreq_policy *policy; | ||
| 603 | unsigned int pstate; | ||
| 604 | |||
| 605 | policy = cpufreq_cpu_get(smp_processor_id()); | ||
| 606 | /* Read back the P-state we are about to set */ | ||
| 607 | pstate = readl(base + AVS_MBOX_PARAM(0)); | ||
| 608 | if (use_issue_command) { | ||
| 609 | ret = brcm_avs_target_index(policy, pstate); | ||
| 610 | return ret ? ret : size; | ||
| 611 | } | ||
| 612 | policy->cur = policy->freq_table[pstate].frequency; | ||
| 613 | } | ||
| 614 | |||
| 615 | if (use_issue_command) { | ||
| 616 | ret = __issue_avs_command(priv, val, false, NULL); | ||
| 617 | } else { | ||
| 618 | /* Locking here is not perfect, but is only for debug. */ | ||
| 619 | ret = down_interruptible(&priv->sem); | ||
| 620 | if (ret) | ||
| 621 | return ret; | ||
| 622 | |||
| 623 | writel(val, base + offset); | ||
| 624 | /* We have to wake up the firmware to process a command. */ | ||
| 625 | if (offset == AVS_MBOX_COMMAND) | ||
| 626 | writel(AVS_CPU_L2_INT_MASK, | ||
| 627 | avs_intr_base + AVS_CPU_L2_SET0); | ||
| 628 | up(&priv->sem); | ||
| 629 | } | ||
| 630 | |||
| 631 | return ret ? ret : size; | ||
| 632 | } | ||
| 633 | |||
| 634 | static struct debugfs_entry *__find_debugfs_entry(const char *name) | ||
| 635 | { | ||
| 636 | int i; | ||
| 637 | |||
| 638 | for (i = 0; i < ARRAY_SIZE(debugfs_entries); i++) | ||
| 639 | if (strcasecmp(debugfs_entries[i].name, name) == 0) | ||
| 640 | return &debugfs_entries[i]; | ||
| 641 | |||
| 642 | return NULL; | ||
| 643 | } | ||
| 644 | |||
| 645 | static int brcm_avs_debug_open(struct inode *inode, struct file *file) | ||
| 646 | { | ||
| 647 | struct debugfs_data *data; | ||
| 648 | fmode_t fmode; | ||
| 649 | int ret; | ||
| 650 | |||
| 651 | /* | ||
| 652 | * seq_open(), which is called by single_open(), clears "write" access. | ||
| 653 | * We need write access to some files, so we preserve our access mode | ||
| 654 | * and restore it. | ||
| 655 | */ | ||
| 656 | fmode = file->f_mode; | ||
| 657 | /* | ||
| 658 | * Check access permissions even for root. We don't want to be writing | ||
| 659 | * to read-only registers. Access for regular users has already been | ||
| 660 | * checked by the VFS layer. | ||
| 661 | */ | ||
| 662 | if ((fmode & FMODE_WRITER) && !(inode->i_mode & S_IWUSR)) | ||
| 663 | return -EACCES; | ||
| 664 | |||
| 665 | data = kmalloc(sizeof(*data), GFP_KERNEL); | ||
| 666 | if (!data) | ||
| 667 | return -ENOMEM; | ||
| 668 | /* | ||
| 669 | * We use the same file system operations for all our debug files. To | ||
| 670 | * produce specific output, we look up the file name upon opening a | ||
| 671 | * debugfs entry and map it to a memory offset. This offset is then used | ||
| 672 | * in the generic "show" function to read a specific register. | ||
| 673 | */ | ||
| 674 | data->entry = __find_debugfs_entry(file->f_path.dentry->d_iname); | ||
| 675 | data->priv = inode->i_private; | ||
| 676 | |||
| 677 | ret = single_open(file, brcm_avs_debug_show, data); | ||
| 678 | if (ret) | ||
| 679 | kfree(data); | ||
| 680 | file->f_mode = fmode; | ||
| 681 | |||
| 682 | return ret; | ||
| 683 | } | ||
| 684 | |||
| 685 | static int brcm_avs_debug_release(struct inode *inode, struct file *file) | ||
| 686 | { | ||
| 687 | struct seq_file *seq_priv = file->private_data; | ||
| 688 | struct debugfs_data *data = seq_priv->private; | ||
| 689 | |||
| 690 | kfree(data); | ||
| 691 | return single_release(inode, file); | ||
| 692 | } | ||
| 693 | |||
| 694 | static const struct file_operations brcm_avs_debug_ops = { | ||
| 695 | .open = brcm_avs_debug_open, | ||
| 696 | .read = seq_read, | ||
| 697 | .write = brcm_avs_seq_write, | ||
| 698 | .llseek = seq_lseek, | ||
| 699 | .release = brcm_avs_debug_release, | ||
| 700 | }; | ||
| 701 | |||
| 702 | static void brcm_avs_cpufreq_debug_init(struct platform_device *pdev) | ||
| 703 | { | ||
| 704 | struct private_data *priv = platform_get_drvdata(pdev); | ||
| 705 | struct dentry *dir; | ||
| 706 | int i; | ||
| 707 | |||
| 708 | if (!priv) | ||
| 709 | return; | ||
| 710 | |||
| 711 | dir = debugfs_create_dir(BRCM_AVS_CPUFREQ_NAME, NULL); | ||
| 712 | if (IS_ERR_OR_NULL(dir)) | ||
| 713 | return; | ||
| 714 | priv->debugfs = dir; | ||
| 715 | |||
| 716 | for (i = 0; i < ARRAY_SIZE(debugfs_entries); i++) { | ||
| 717 | /* | ||
| 718 | * The DEBUGFS_ENTRY macro generates uppercase strings. We | ||
| 719 | * convert them to lowercase before creating the debugfs | ||
| 720 | * entries. | ||
| 721 | */ | ||
| 722 | char *entry = __strtolower(debugfs_entries[i].name); | ||
| 723 | fmode_t mode = debugfs_entries[i].mode; | ||
| 724 | |||
| 725 | if (!debugfs_create_file(entry, S_IFREG | S_IRUGO | mode, | ||
| 726 | dir, priv, &brcm_avs_debug_ops)) { | ||
| 727 | priv->debugfs = NULL; | ||
| 728 | debugfs_remove_recursive(dir); | ||
| 729 | break; | ||
| 730 | } | ||
| 731 | } | ||
| 732 | } | ||
| 733 | |||
| 734 | static void brcm_avs_cpufreq_debug_exit(struct platform_device *pdev) | ||
| 735 | { | ||
| 736 | struct private_data *priv = platform_get_drvdata(pdev); | ||
| 737 | |||
| 738 | if (priv && priv->debugfs) { | ||
| 739 | debugfs_remove_recursive(priv->debugfs); | ||
| 740 | priv->debugfs = NULL; | ||
| 741 | } | ||
| 742 | } | ||
| 743 | |||
| 744 | #else | ||
| 745 | |||
| 746 | static void brcm_avs_cpufreq_debug_init(struct platform_device *pdev) {} | ||
| 747 | static void brcm_avs_cpufreq_debug_exit(struct platform_device *pdev) {} | ||
| 748 | |||
| 749 | #endif /* CONFIG_ARM_BRCMSTB_AVS_CPUFREQ_DEBUG */ | ||
| 750 | |||
| 751 | /* | 435 | /* |
| 752 | * To ensure the right firmware is running we need to | 436 | * To ensure the right firmware is running we need to |
| 753 | * - check the MAGIC matches what we expect | 437 | * - check the MAGIC matches what we expect |
| @@ -1016,11 +700,8 @@ static int brcm_avs_cpufreq_probe(struct platform_device *pdev) | |||
| 1016 | return ret; | 700 | return ret; |
| 1017 | 701 | ||
| 1018 | brcm_avs_driver.driver_data = pdev; | 702 | brcm_avs_driver.driver_data = pdev; |
| 1019 | ret = cpufreq_register_driver(&brcm_avs_driver); | ||
| 1020 | if (!ret) | ||
| 1021 | brcm_avs_cpufreq_debug_init(pdev); | ||
| 1022 | 703 | ||
| 1023 | return ret; | 704 | return cpufreq_register_driver(&brcm_avs_driver); |
| 1024 | } | 705 | } |
| 1025 | 706 | ||
| 1026 | static int brcm_avs_cpufreq_remove(struct platform_device *pdev) | 707 | static int brcm_avs_cpufreq_remove(struct platform_device *pdev) |
| @@ -1032,8 +713,6 @@ static int brcm_avs_cpufreq_remove(struct platform_device *pdev) | |||
| 1032 | if (ret) | 713 | if (ret) |
| 1033 | return ret; | 714 | return ret; |
| 1034 | 715 | ||
| 1035 | brcm_avs_cpufreq_debug_exit(pdev); | ||
| 1036 | |||
| 1037 | priv = platform_get_drvdata(pdev); | 716 | priv = platform_get_drvdata(pdev); |
| 1038 | iounmap(priv->base); | 717 | iounmap(priv->base); |
| 1039 | iounmap(priv->avs_intr_base); | 718 | iounmap(priv->avs_intr_base); |
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index 0591874856d3..54edaec1e608 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c | |||
| @@ -679,6 +679,16 @@ void gpstate_timer_handler(struct timer_list *t) | |||
| 679 | 679 | ||
| 680 | if (!spin_trylock(&gpstates->gpstate_lock)) | 680 | if (!spin_trylock(&gpstates->gpstate_lock)) |
| 681 | return; | 681 | return; |
| 682 | /* | ||
| 683 | * If the timer has migrated to the different cpu then bring | ||
| 684 | * it back to one of the policy->cpus | ||
| 685 | */ | ||
| 686 | if (!cpumask_test_cpu(raw_smp_processor_id(), policy->cpus)) { | ||
| 687 | gpstates->timer.expires = jiffies + msecs_to_jiffies(1); | ||
| 688 | add_timer_on(&gpstates->timer, cpumask_first(policy->cpus)); | ||
| 689 | spin_unlock(&gpstates->gpstate_lock); | ||
| 690 | return; | ||
| 691 | } | ||
| 682 | 692 | ||
| 683 | /* | 693 | /* |
| 684 | * If PMCR was last updated was using fast_swtich then | 694 | * If PMCR was last updated was using fast_swtich then |
| @@ -718,10 +728,8 @@ void gpstate_timer_handler(struct timer_list *t) | |||
| 718 | if (gpstate_idx != gpstates->last_lpstate_idx) | 728 | if (gpstate_idx != gpstates->last_lpstate_idx) |
| 719 | queue_gpstate_timer(gpstates); | 729 | queue_gpstate_timer(gpstates); |
| 720 | 730 | ||
| 731 | set_pstate(&freq_data); | ||
| 721 | spin_unlock(&gpstates->gpstate_lock); | 732 | spin_unlock(&gpstates->gpstate_lock); |
| 722 | |||
| 723 | /* Timer may get migrated to a different cpu on cpu hot unplug */ | ||
| 724 | smp_call_function_any(policy->cpus, set_pstate, &freq_data, 1); | ||
| 725 | } | 733 | } |
| 726 | 734 | ||
| 727 | /* | 735 | /* |
diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index e6f17825db79..2b90606452a2 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c | |||
| @@ -284,7 +284,7 @@ scmi_clock_info_get(const struct scmi_handle *handle, u32 clk_id) | |||
| 284 | struct clock_info *ci = handle->clk_priv; | 284 | struct clock_info *ci = handle->clk_priv; |
| 285 | struct scmi_clock_info *clk = ci->clk + clk_id; | 285 | struct scmi_clock_info *clk = ci->clk + clk_id; |
| 286 | 286 | ||
| 287 | if (!clk->name || !clk->name[0]) | 287 | if (!clk->name[0]) |
| 288 | return NULL; | 288 | return NULL; |
| 289 | 289 | ||
| 290 | return clk; | 290 | return clk; |
diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c index 14f14efdf0d5..06d212a3d49d 100644 --- a/drivers/fpga/altera-ps-spi.c +++ b/drivers/fpga/altera-ps-spi.c | |||
| @@ -249,7 +249,7 @@ static int altera_ps_probe(struct spi_device *spi) | |||
| 249 | 249 | ||
| 250 | conf->data = of_id->data; | 250 | conf->data = of_id->data; |
| 251 | conf->spi = spi; | 251 | conf->spi = spi; |
| 252 | conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_HIGH); | 252 | conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_LOW); |
| 253 | if (IS_ERR(conf->config)) { | 253 | if (IS_ERR(conf->config)) { |
| 254 | dev_err(&spi->dev, "Failed to get config gpio: %ld\n", | 254 | dev_err(&spi->dev, "Failed to get config gpio: %ld\n", |
| 255 | PTR_ERR(conf->config)); | 255 | PTR_ERR(conf->config)); |
diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c index 498d5948d1a8..9837c8d69e69 100644 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c | |||
| @@ -56,7 +56,9 @@ static int dumb_vga_get_modes(struct drm_connector *connector) | |||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | drm_mode_connector_update_edid_property(connector, edid); | 58 | drm_mode_connector_update_edid_property(connector, edid); |
| 59 | return drm_add_edid_modes(connector, edid); | 59 | ret = drm_add_edid_modes(connector, edid); |
| 60 | kfree(edid); | ||
| 61 | return ret; | ||
| 60 | 62 | ||
| 61 | fallback: | 63 | fallback: |
| 62 | /* | 64 | /* |
diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c index fc8b2c6e3508..32d24c69da3c 100644 --- a/drivers/gpu/drm/i915/intel_cdclk.c +++ b/drivers/gpu/drm/i915/intel_cdclk.c | |||
| @@ -2140,10 +2140,22 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state) | |||
| 2140 | } | 2140 | } |
| 2141 | } | 2141 | } |
| 2142 | 2142 | ||
| 2143 | /* According to BSpec, "The CD clock frequency must be at least twice | 2143 | /* |
| 2144 | * According to BSpec, "The CD clock frequency must be at least twice | ||
| 2144 | * the frequency of the Azalia BCLK." and BCLK is 96 MHz by default. | 2145 | * the frequency of the Azalia BCLK." and BCLK is 96 MHz by default. |
| 2146 | * | ||
| 2147 | * FIXME: Check the actual, not default, BCLK being used. | ||
| 2148 | * | ||
| 2149 | * FIXME: This does not depend on ->has_audio because the higher CDCLK | ||
| 2150 | * is required for audio probe, also when there are no audio capable | ||
| 2151 | * displays connected at probe time. This leads to unnecessarily high | ||
| 2152 | * CDCLK when audio is not required. | ||
| 2153 | * | ||
| 2154 | * FIXME: This limit is only applied when there are displays connected | ||
| 2155 | * at probe time. If we probe without displays, we'll still end up using | ||
| 2156 | * the platform minimum CDCLK, failing audio probe. | ||
| 2145 | */ | 2157 | */ |
| 2146 | if (crtc_state->has_audio && INTEL_GEN(dev_priv) >= 9) | 2158 | if (INTEL_GEN(dev_priv) >= 9) |
| 2147 | min_cdclk = max(2 * 96000, min_cdclk); | 2159 | min_cdclk = max(2 * 96000, min_cdclk); |
| 2148 | 2160 | ||
| 2149 | /* | 2161 | /* |
diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c index 41e6c75a7f3c..f9550ea46c26 100644 --- a/drivers/gpu/drm/i915/intel_csr.c +++ b/drivers/gpu/drm/i915/intel_csr.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | #define I915_CSR_GLK "i915/glk_dmc_ver1_04.bin" | 37 | #define I915_CSR_GLK "i915/glk_dmc_ver1_04.bin" |
| 38 | MODULE_FIRMWARE(I915_CSR_GLK); | ||
| 38 | #define GLK_CSR_VERSION_REQUIRED CSR_VERSION(1, 4) | 39 | #define GLK_CSR_VERSION_REQUIRED CSR_VERSION(1, 4) |
| 39 | 40 | ||
| 40 | #define I915_CSR_CNL "i915/cnl_dmc_ver1_07.bin" | 41 | #define I915_CSR_CNL "i915/cnl_dmc_ver1_07.bin" |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index d4368589b355..a80fbad9be0f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
| @@ -49,12 +49,12 @@ | |||
| 49 | * check the condition before the timeout. | 49 | * check the condition before the timeout. |
| 50 | */ | 50 | */ |
| 51 | #define __wait_for(OP, COND, US, Wmin, Wmax) ({ \ | 51 | #define __wait_for(OP, COND, US, Wmin, Wmax) ({ \ |
| 52 | unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \ | 52 | const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ |
| 53 | long wait__ = (Wmin); /* recommended min for usleep is 10 us */ \ | 53 | long wait__ = (Wmin); /* recommended min for usleep is 10 us */ \ |
| 54 | int ret__; \ | 54 | int ret__; \ |
| 55 | might_sleep(); \ | 55 | might_sleep(); \ |
| 56 | for (;;) { \ | 56 | for (;;) { \ |
| 57 | bool expired__ = time_after(jiffies, timeout__); \ | 57 | const bool expired__ = ktime_after(ktime_get_raw(), end__); \ |
| 58 | OP; \ | 58 | OP; \ |
| 59 | if (COND) { \ | 59 | if (COND) { \ |
| 60 | ret__ = 0; \ | 60 | ret__ = 0; \ |
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 6f12adc06365..6467a5cc2ca3 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
| @@ -806,7 +806,7 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev) | |||
| 806 | return; | 806 | return; |
| 807 | 807 | ||
| 808 | intel_fbdev_sync(ifbdev); | 808 | intel_fbdev_sync(ifbdev); |
| 809 | if (ifbdev->vma) | 809 | if (ifbdev->vma || ifbdev->helper.deferred_setup) |
| 810 | drm_fb_helper_hotplug_event(&ifbdev->helper); | 810 | drm_fb_helper_hotplug_event(&ifbdev->helper); |
| 811 | } | 811 | } |
| 812 | 812 | ||
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c index 53ea564f971e..66de4b2dc8b7 100644 --- a/drivers/gpu/drm/i915/intel_runtime_pm.c +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c | |||
| @@ -641,19 +641,18 @@ void skl_enable_dc6(struct drm_i915_private *dev_priv) | |||
| 641 | 641 | ||
| 642 | DRM_DEBUG_KMS("Enabling DC6\n"); | 642 | DRM_DEBUG_KMS("Enabling DC6\n"); |
| 643 | 643 | ||
| 644 | gen9_set_dc_state(dev_priv, DC_STATE_EN_UPTO_DC6); | 644 | /* Wa Display #1183: skl,kbl,cfl */ |
| 645 | if (IS_GEN9_BC(dev_priv)) | ||
| 646 | I915_WRITE(GEN8_CHICKEN_DCPR_1, I915_READ(GEN8_CHICKEN_DCPR_1) | | ||
| 647 | SKL_SELECT_ALTERNATE_DC_EXIT); | ||
| 645 | 648 | ||
| 649 | gen9_set_dc_state(dev_priv, DC_STATE_EN_UPTO_DC6); | ||
| 646 | } | 650 | } |
| 647 | 651 | ||
| 648 | void skl_disable_dc6(struct drm_i915_private *dev_priv) | 652 | void skl_disable_dc6(struct drm_i915_private *dev_priv) |
| 649 | { | 653 | { |
| 650 | DRM_DEBUG_KMS("Disabling DC6\n"); | 654 | DRM_DEBUG_KMS("Disabling DC6\n"); |
| 651 | 655 | ||
| 652 | /* Wa Display #1183: skl,kbl,cfl */ | ||
| 653 | if (IS_GEN9_BC(dev_priv)) | ||
| 654 | I915_WRITE(GEN8_CHICKEN_DCPR_1, I915_READ(GEN8_CHICKEN_DCPR_1) | | ||
| 655 | SKL_SELECT_ALTERNATE_DC_EXIT); | ||
| 656 | |||
| 657 | gen9_set_dc_state(dev_priv, DC_STATE_DISABLE); | 656 | gen9_set_dc_state(dev_priv, DC_STATE_DISABLE); |
| 658 | } | 657 | } |
| 659 | 658 | ||
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index bf4667481935..c61dff594195 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c | |||
| @@ -760,6 +760,7 @@ static irqreturn_t vc4_crtc_irq_handler(int irq, void *data) | |||
| 760 | struct vc4_async_flip_state { | 760 | struct vc4_async_flip_state { |
| 761 | struct drm_crtc *crtc; | 761 | struct drm_crtc *crtc; |
| 762 | struct drm_framebuffer *fb; | 762 | struct drm_framebuffer *fb; |
| 763 | struct drm_framebuffer *old_fb; | ||
| 763 | struct drm_pending_vblank_event *event; | 764 | struct drm_pending_vblank_event *event; |
| 764 | 765 | ||
| 765 | struct vc4_seqno_cb cb; | 766 | struct vc4_seqno_cb cb; |
| @@ -789,6 +790,23 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) | |||
| 789 | 790 | ||
| 790 | drm_crtc_vblank_put(crtc); | 791 | drm_crtc_vblank_put(crtc); |
| 791 | drm_framebuffer_put(flip_state->fb); | 792 | drm_framebuffer_put(flip_state->fb); |
| 793 | |||
| 794 | /* Decrement the BO usecnt in order to keep the inc/dec calls balanced | ||
| 795 | * when the planes are updated through the async update path. | ||
| 796 | * FIXME: we should move to generic async-page-flip when it's | ||
| 797 | * available, so that we can get rid of this hand-made cleanup_fb() | ||
| 798 | * logic. | ||
| 799 | */ | ||
| 800 | if (flip_state->old_fb) { | ||
| 801 | struct drm_gem_cma_object *cma_bo; | ||
| 802 | struct vc4_bo *bo; | ||
| 803 | |||
| 804 | cma_bo = drm_fb_cma_get_gem_obj(flip_state->old_fb, 0); | ||
| 805 | bo = to_vc4_bo(&cma_bo->base); | ||
| 806 | vc4_bo_dec_usecnt(bo); | ||
| 807 | drm_framebuffer_put(flip_state->old_fb); | ||
| 808 | } | ||
| 809 | |||
| 792 | kfree(flip_state); | 810 | kfree(flip_state); |
| 793 | 811 | ||
| 794 | up(&vc4->async_modeset); | 812 | up(&vc4->async_modeset); |
| @@ -813,9 +831,22 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, | |||
| 813 | struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0); | 831 | struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0); |
| 814 | struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); | 832 | struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); |
| 815 | 833 | ||
| 834 | /* Increment the BO usecnt here, so that we never end up with an | ||
| 835 | * unbalanced number of vc4_bo_{dec,inc}_usecnt() calls when the | ||
| 836 | * plane is later updated through the non-async path. | ||
| 837 | * FIXME: we should move to generic async-page-flip when it's | ||
| 838 | * available, so that we can get rid of this hand-made prepare_fb() | ||
| 839 | * logic. | ||
| 840 | */ | ||
| 841 | ret = vc4_bo_inc_usecnt(bo); | ||
| 842 | if (ret) | ||
| 843 | return ret; | ||
| 844 | |||
| 816 | flip_state = kzalloc(sizeof(*flip_state), GFP_KERNEL); | 845 | flip_state = kzalloc(sizeof(*flip_state), GFP_KERNEL); |
| 817 | if (!flip_state) | 846 | if (!flip_state) { |
| 847 | vc4_bo_dec_usecnt(bo); | ||
| 818 | return -ENOMEM; | 848 | return -ENOMEM; |
| 849 | } | ||
| 819 | 850 | ||
| 820 | drm_framebuffer_get(fb); | 851 | drm_framebuffer_get(fb); |
| 821 | flip_state->fb = fb; | 852 | flip_state->fb = fb; |
| @@ -826,10 +857,23 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, | |||
| 826 | ret = down_interruptible(&vc4->async_modeset); | 857 | ret = down_interruptible(&vc4->async_modeset); |
| 827 | if (ret) { | 858 | if (ret) { |
| 828 | drm_framebuffer_put(fb); | 859 | drm_framebuffer_put(fb); |
| 860 | vc4_bo_dec_usecnt(bo); | ||
| 829 | kfree(flip_state); | 861 | kfree(flip_state); |
| 830 | return ret; | 862 | return ret; |
| 831 | } | 863 | } |
| 832 | 864 | ||
| 865 | /* Save the current FB before it's replaced by the new one in | ||
| 866 | * drm_atomic_set_fb_for_plane(). We'll need the old FB in | ||
| 867 | * vc4_async_page_flip_complete() to decrement the BO usecnt and keep | ||
| 868 | * it consistent. | ||
| 869 | * FIXME: we should move to generic async-page-flip when it's | ||
| 870 | * available, so that we can get rid of this hand-made cleanup_fb() | ||
| 871 | * logic. | ||
| 872 | */ | ||
| 873 | flip_state->old_fb = plane->state->fb; | ||
| 874 | if (flip_state->old_fb) | ||
| 875 | drm_framebuffer_get(flip_state->old_fb); | ||
| 876 | |||
| 833 | WARN_ON(drm_crtc_vblank_get(crtc) != 0); | 877 | WARN_ON(drm_crtc_vblank_get(crtc) != 0); |
| 834 | 878 | ||
| 835 | /* Immediately update the plane's legacy fb pointer, so that later | 879 | /* Immediately update the plane's legacy fb pointer, so that later |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index 051a72eecb24..d2cc55e21374 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
| @@ -40,6 +40,10 @@ static DEFINE_MUTEX(nb_smu_ind_mutex); | |||
| 40 | #define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463 | 40 | #define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463 |
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | #ifndef PCI_DEVICE_ID_AMD_17H_RR_NB | ||
| 44 | #define PCI_DEVICE_ID_AMD_17H_RR_NB 0x15d0 | ||
| 45 | #endif | ||
| 46 | |||
| 43 | /* CPUID function 0x80000001, ebx */ | 47 | /* CPUID function 0x80000001, ebx */ |
| 44 | #define CPUID_PKGTYPE_MASK 0xf0000000 | 48 | #define CPUID_PKGTYPE_MASK 0xf0000000 |
| 45 | #define CPUID_PKGTYPE_F 0x00000000 | 49 | #define CPUID_PKGTYPE_F 0x00000000 |
| @@ -72,6 +76,7 @@ struct k10temp_data { | |||
| 72 | struct pci_dev *pdev; | 76 | struct pci_dev *pdev; |
| 73 | void (*read_tempreg)(struct pci_dev *pdev, u32 *regval); | 77 | void (*read_tempreg)(struct pci_dev *pdev, u32 *regval); |
| 74 | int temp_offset; | 78 | int temp_offset; |
| 79 | u32 temp_adjust_mask; | ||
| 75 | }; | 80 | }; |
| 76 | 81 | ||
| 77 | struct tctl_offset { | 82 | struct tctl_offset { |
| @@ -84,6 +89,7 @@ static const struct tctl_offset tctl_offset_table[] = { | |||
| 84 | { 0x17, "AMD Ryzen 5 1600X", 20000 }, | 89 | { 0x17, "AMD Ryzen 5 1600X", 20000 }, |
| 85 | { 0x17, "AMD Ryzen 7 1700X", 20000 }, | 90 | { 0x17, "AMD Ryzen 7 1700X", 20000 }, |
| 86 | { 0x17, "AMD Ryzen 7 1800X", 20000 }, | 91 | { 0x17, "AMD Ryzen 7 1800X", 20000 }, |
| 92 | { 0x17, "AMD Ryzen 7 2700X", 10000 }, | ||
| 87 | { 0x17, "AMD Ryzen Threadripper 1950X", 27000 }, | 93 | { 0x17, "AMD Ryzen Threadripper 1950X", 27000 }, |
| 88 | { 0x17, "AMD Ryzen Threadripper 1920X", 27000 }, | 94 | { 0x17, "AMD Ryzen Threadripper 1920X", 27000 }, |
| 89 | { 0x17, "AMD Ryzen Threadripper 1900X", 27000 }, | 95 | { 0x17, "AMD Ryzen Threadripper 1900X", 27000 }, |
| @@ -129,6 +135,8 @@ static ssize_t temp1_input_show(struct device *dev, | |||
| 129 | 135 | ||
| 130 | data->read_tempreg(data->pdev, ®val); | 136 | data->read_tempreg(data->pdev, ®val); |
| 131 | temp = (regval >> 21) * 125; | 137 | temp = (regval >> 21) * 125; |
| 138 | if (regval & data->temp_adjust_mask) | ||
| 139 | temp -= 49000; | ||
| 132 | if (temp > data->temp_offset) | 140 | if (temp > data->temp_offset) |
| 133 | temp -= data->temp_offset; | 141 | temp -= data->temp_offset; |
| 134 | else | 142 | else |
| @@ -259,12 +267,14 @@ static int k10temp_probe(struct pci_dev *pdev, | |||
| 259 | data->pdev = pdev; | 267 | data->pdev = pdev; |
| 260 | 268 | ||
| 261 | if (boot_cpu_data.x86 == 0x15 && (boot_cpu_data.x86_model == 0x60 || | 269 | if (boot_cpu_data.x86 == 0x15 && (boot_cpu_data.x86_model == 0x60 || |
| 262 | boot_cpu_data.x86_model == 0x70)) | 270 | boot_cpu_data.x86_model == 0x70)) { |
| 263 | data->read_tempreg = read_tempreg_nb_f15; | 271 | data->read_tempreg = read_tempreg_nb_f15; |
| 264 | else if (boot_cpu_data.x86 == 0x17) | 272 | } else if (boot_cpu_data.x86 == 0x17) { |
| 273 | data->temp_adjust_mask = 0x80000; | ||
| 265 | data->read_tempreg = read_tempreg_nb_f17; | 274 | data->read_tempreg = read_tempreg_nb_f17; |
| 266 | else | 275 | } else { |
| 267 | data->read_tempreg = read_tempreg_pci; | 276 | data->read_tempreg = read_tempreg_pci; |
| 277 | } | ||
| 268 | 278 | ||
| 269 | for (i = 0; i < ARRAY_SIZE(tctl_offset_table); i++) { | 279 | for (i = 0; i < ARRAY_SIZE(tctl_offset_table); i++) { |
| 270 | const struct tctl_offset *entry = &tctl_offset_table[i]; | 280 | const struct tctl_offset *entry = &tctl_offset_table[i]; |
| @@ -292,6 +302,7 @@ static const struct pci_device_id k10temp_id_table[] = { | |||
| 292 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, | 302 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, |
| 293 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, | 303 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, |
| 294 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, | 304 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, |
| 305 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_RR_NB) }, | ||
| 295 | {} | 306 | {} |
| 296 | }; | 307 | }; |
| 297 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); | 308 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); |
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c index 8b0bc4fc06e8..b0bc77bf2cd9 100644 --- a/drivers/hwmon/nct6683.c +++ b/drivers/hwmon/nct6683.c | |||
| @@ -1380,8 +1380,8 @@ static int __init nct6683_find(int sioaddr, struct nct6683_sio_data *sio_data) | |||
| 1380 | /* Activate logical device if needed */ | 1380 | /* Activate logical device if needed */ |
| 1381 | val = superio_inb(sioaddr, SIO_REG_ENABLE); | 1381 | val = superio_inb(sioaddr, SIO_REG_ENABLE); |
| 1382 | if (!(val & 0x01)) { | 1382 | if (!(val & 0x01)) { |
| 1383 | pr_err("EC is disabled\n"); | 1383 | pr_warn("Forcibly enabling EC access. Data may be unusable.\n"); |
| 1384 | goto fail; | 1384 | superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); |
| 1385 | } | 1385 | } |
| 1386 | 1386 | ||
| 1387 | superio_exit(sioaddr); | 1387 | superio_exit(sioaddr); |
diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 363bf56eb0f2..91976b6ca300 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c | |||
| @@ -170,7 +170,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) | |||
| 170 | scmi_chip_info.info = ptr_scmi_ci; | 170 | scmi_chip_info.info = ptr_scmi_ci; |
| 171 | chip_info = &scmi_chip_info; | 171 | chip_info = &scmi_chip_info; |
| 172 | 172 | ||
| 173 | for (type = 0; type < hwmon_max && nr_count[type]; type++) { | 173 | for (type = 0; type < hwmon_max; type++) { |
| 174 | if (!nr_count[type]) | ||
| 175 | continue; | ||
| 176 | |||
| 174 | scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type], | 177 | scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type], |
| 175 | type, hwmon_attributes[type]); | 178 | type, hwmon_attributes[type]); |
| 176 | *ptr_scmi_ci++ = scmi_hwmon_chan++; | 179 | *ptr_scmi_ci++ = scmi_hwmon_chan++; |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index c4865b08d7fb..8d21b9825d71 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
| @@ -707,7 +707,6 @@ config I2C_MPC | |||
| 707 | config I2C_MT65XX | 707 | config I2C_MT65XX |
| 708 | tristate "MediaTek I2C adapter" | 708 | tristate "MediaTek I2C adapter" |
| 709 | depends on ARCH_MEDIATEK || COMPILE_TEST | 709 | depends on ARCH_MEDIATEK || COMPILE_TEST |
| 710 | depends on HAS_DMA | ||
| 711 | help | 710 | help |
| 712 | This selects the MediaTek(R) Integrated Inter Circuit bus driver | 711 | This selects the MediaTek(R) Integrated Inter Circuit bus driver |
| 713 | for MT65xx and MT81xx. | 712 | for MT65xx and MT81xx. |
| @@ -885,7 +884,6 @@ config I2C_SH7760 | |||
| 885 | 884 | ||
| 886 | config I2C_SH_MOBILE | 885 | config I2C_SH_MOBILE |
| 887 | tristate "SuperH Mobile I2C Controller" | 886 | tristate "SuperH Mobile I2C Controller" |
| 888 | depends on HAS_DMA | ||
| 889 | depends on ARCH_SHMOBILE || ARCH_RENESAS || COMPILE_TEST | 887 | depends on ARCH_SHMOBILE || ARCH_RENESAS || COMPILE_TEST |
| 890 | help | 888 | help |
| 891 | If you say yes to this option, support will be included for the | 889 | If you say yes to this option, support will be included for the |
| @@ -1098,7 +1096,6 @@ config I2C_XLP9XX | |||
| 1098 | 1096 | ||
| 1099 | config I2C_RCAR | 1097 | config I2C_RCAR |
| 1100 | tristate "Renesas R-Car I2C Controller" | 1098 | tristate "Renesas R-Car I2C Controller" |
| 1101 | depends on HAS_DMA | ||
| 1102 | depends on ARCH_RENESAS || COMPILE_TEST | 1099 | depends on ARCH_RENESAS || COMPILE_TEST |
| 1103 | select I2C_SLAVE | 1100 | select I2C_SLAVE |
| 1104 | help | 1101 | help |
diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c index 25fcc3c1e32b..4053259bccb8 100644 --- a/drivers/i2c/busses/i2c-sprd.c +++ b/drivers/i2c/busses/i2c-sprd.c | |||
| @@ -86,6 +86,7 @@ struct sprd_i2c { | |||
| 86 | u32 count; | 86 | u32 count; |
| 87 | int irq; | 87 | int irq; |
| 88 | int err; | 88 | int err; |
| 89 | bool is_suspended; | ||
| 89 | }; | 90 | }; |
| 90 | 91 | ||
| 91 | static void sprd_i2c_set_count(struct sprd_i2c *i2c_dev, u32 count) | 92 | static void sprd_i2c_set_count(struct sprd_i2c *i2c_dev, u32 count) |
| @@ -283,6 +284,9 @@ static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap, | |||
| 283 | struct sprd_i2c *i2c_dev = i2c_adap->algo_data; | 284 | struct sprd_i2c *i2c_dev = i2c_adap->algo_data; |
| 284 | int im, ret; | 285 | int im, ret; |
| 285 | 286 | ||
| 287 | if (i2c_dev->is_suspended) | ||
| 288 | return -EBUSY; | ||
| 289 | |||
| 286 | ret = pm_runtime_get_sync(i2c_dev->dev); | 290 | ret = pm_runtime_get_sync(i2c_dev->dev); |
| 287 | if (ret < 0) | 291 | if (ret < 0) |
| 288 | return ret; | 292 | return ret; |
| @@ -364,13 +368,12 @@ static irqreturn_t sprd_i2c_isr_thread(int irq, void *dev_id) | |||
| 364 | struct sprd_i2c *i2c_dev = dev_id; | 368 | struct sprd_i2c *i2c_dev = dev_id; |
| 365 | struct i2c_msg *msg = i2c_dev->msg; | 369 | struct i2c_msg *msg = i2c_dev->msg; |
| 366 | bool ack = !(readl(i2c_dev->base + I2C_STATUS) & I2C_RX_ACK); | 370 | bool ack = !(readl(i2c_dev->base + I2C_STATUS) & I2C_RX_ACK); |
| 367 | u32 i2c_count = readl(i2c_dev->base + I2C_COUNT); | ||
| 368 | u32 i2c_tran; | 371 | u32 i2c_tran; |
| 369 | 372 | ||
| 370 | if (msg->flags & I2C_M_RD) | 373 | if (msg->flags & I2C_M_RD) |
| 371 | i2c_tran = i2c_dev->count >= I2C_FIFO_FULL_THLD; | 374 | i2c_tran = i2c_dev->count >= I2C_FIFO_FULL_THLD; |
| 372 | else | 375 | else |
| 373 | i2c_tran = i2c_count; | 376 | i2c_tran = i2c_dev->count; |
| 374 | 377 | ||
| 375 | /* | 378 | /* |
| 376 | * If we got one ACK from slave when writing data, and we did not | 379 | * If we got one ACK from slave when writing data, and we did not |
| @@ -408,14 +411,13 @@ static irqreturn_t sprd_i2c_isr(int irq, void *dev_id) | |||
| 408 | { | 411 | { |
| 409 | struct sprd_i2c *i2c_dev = dev_id; | 412 | struct sprd_i2c *i2c_dev = dev_id; |
| 410 | struct i2c_msg *msg = i2c_dev->msg; | 413 | struct i2c_msg *msg = i2c_dev->msg; |
| 411 | u32 i2c_count = readl(i2c_dev->base + I2C_COUNT); | ||
| 412 | bool ack = !(readl(i2c_dev->base + I2C_STATUS) & I2C_RX_ACK); | 414 | bool ack = !(readl(i2c_dev->base + I2C_STATUS) & I2C_RX_ACK); |
| 413 | u32 i2c_tran; | 415 | u32 i2c_tran; |
| 414 | 416 | ||
| 415 | if (msg->flags & I2C_M_RD) | 417 | if (msg->flags & I2C_M_RD) |
| 416 | i2c_tran = i2c_dev->count >= I2C_FIFO_FULL_THLD; | 418 | i2c_tran = i2c_dev->count >= I2C_FIFO_FULL_THLD; |
| 417 | else | 419 | else |
| 418 | i2c_tran = i2c_count; | 420 | i2c_tran = i2c_dev->count; |
| 419 | 421 | ||
| 420 | /* | 422 | /* |
| 421 | * If we did not get one ACK from slave when writing data, then we | 423 | * If we did not get one ACK from slave when writing data, then we |
| @@ -586,11 +588,23 @@ static int sprd_i2c_remove(struct platform_device *pdev) | |||
| 586 | 588 | ||
| 587 | static int __maybe_unused sprd_i2c_suspend_noirq(struct device *pdev) | 589 | static int __maybe_unused sprd_i2c_suspend_noirq(struct device *pdev) |
| 588 | { | 590 | { |
| 591 | struct sprd_i2c *i2c_dev = dev_get_drvdata(pdev); | ||
| 592 | |||
| 593 | i2c_lock_adapter(&i2c_dev->adap); | ||
| 594 | i2c_dev->is_suspended = true; | ||
| 595 | i2c_unlock_adapter(&i2c_dev->adap); | ||
| 596 | |||
| 589 | return pm_runtime_force_suspend(pdev); | 597 | return pm_runtime_force_suspend(pdev); |
| 590 | } | 598 | } |
| 591 | 599 | ||
| 592 | static int __maybe_unused sprd_i2c_resume_noirq(struct device *pdev) | 600 | static int __maybe_unused sprd_i2c_resume_noirq(struct device *pdev) |
| 593 | { | 601 | { |
| 602 | struct sprd_i2c *i2c_dev = dev_get_drvdata(pdev); | ||
| 603 | |||
| 604 | i2c_lock_adapter(&i2c_dev->adap); | ||
| 605 | i2c_dev->is_suspended = false; | ||
| 606 | i2c_unlock_adapter(&i2c_dev->adap); | ||
| 607 | |||
| 594 | return pm_runtime_force_resume(pdev); | 608 | return pm_runtime_force_resume(pdev); |
| 595 | } | 609 | } |
| 596 | 610 | ||
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 036a03f0d0a6..1667b6e7674f 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
| @@ -280,7 +280,7 @@ static noinline int i2cdev_ioctl_rdwr(struct i2c_client *client, | |||
| 280 | */ | 280 | */ |
| 281 | if (msgs[i].flags & I2C_M_RECV_LEN) { | 281 | if (msgs[i].flags & I2C_M_RECV_LEN) { |
| 282 | if (!(msgs[i].flags & I2C_M_RD) || | 282 | if (!(msgs[i].flags & I2C_M_RD) || |
| 283 | msgs[i].buf[0] < 1 || | 283 | msgs[i].len < 1 || msgs[i].buf[0] < 1 || |
| 284 | msgs[i].len < msgs[i].buf[0] + | 284 | msgs[i].len < msgs[i].buf[0] + |
| 285 | I2C_SMBUS_BLOCK_MAX) { | 285 | I2C_SMBUS_BLOCK_MAX) { |
| 286 | res = -EINVAL; | 286 | res = -EINVAL; |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 46115a392098..c81c79d01d93 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | enum evdev_clock_type { | 31 | enum evdev_clock_type { |
| 32 | EV_CLK_REAL = 0, | 32 | EV_CLK_REAL = 0, |
| 33 | EV_CLK_MONO, | 33 | EV_CLK_MONO, |
| 34 | EV_CLK_BOOT, | ||
| 34 | EV_CLK_MAX | 35 | EV_CLK_MAX |
| 35 | }; | 36 | }; |
| 36 | 37 | ||
| @@ -197,10 +198,12 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) | |||
| 197 | case CLOCK_REALTIME: | 198 | case CLOCK_REALTIME: |
| 198 | clk_type = EV_CLK_REAL; | 199 | clk_type = EV_CLK_REAL; |
| 199 | break; | 200 | break; |
| 200 | case CLOCK_BOOTTIME: | ||
| 201 | case CLOCK_MONOTONIC: | 201 | case CLOCK_MONOTONIC: |
| 202 | clk_type = EV_CLK_MONO; | 202 | clk_type = EV_CLK_MONO; |
| 203 | break; | 203 | break; |
| 204 | case CLOCK_BOOTTIME: | ||
| 205 | clk_type = EV_CLK_BOOT; | ||
| 206 | break; | ||
| 204 | default: | 207 | default: |
| 205 | return -EINVAL; | 208 | return -EINVAL; |
| 206 | } | 209 | } |
| @@ -311,6 +314,8 @@ static void evdev_events(struct input_handle *handle, | |||
| 311 | 314 | ||
| 312 | ev_time[EV_CLK_MONO] = ktime_get(); | 315 | ev_time[EV_CLK_MONO] = ktime_get(); |
| 313 | ev_time[EV_CLK_REAL] = ktime_mono_to_real(ev_time[EV_CLK_MONO]); | 316 | ev_time[EV_CLK_REAL] = ktime_mono_to_real(ev_time[EV_CLK_MONO]); |
| 317 | ev_time[EV_CLK_BOOT] = ktime_mono_to_any(ev_time[EV_CLK_MONO], | ||
| 318 | TK_OFFS_BOOT); | ||
| 314 | 319 | ||
| 315 | rcu_read_lock(); | 320 | rcu_read_lock(); |
| 316 | 321 | ||
diff --git a/drivers/memory/emif-asm-offsets.c b/drivers/memory/emif-asm-offsets.c index 71a89d5d3efd..db8043019ec6 100644 --- a/drivers/memory/emif-asm-offsets.c +++ b/drivers/memory/emif-asm-offsets.c | |||
| @@ -16,77 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | int main(void) | 17 | int main(void) |
| 18 | { | 18 | { |
| 19 | DEFINE(EMIF_SDCFG_VAL_OFFSET, | 19 | ti_emif_asm_offsets(); |
| 20 | offsetof(struct emif_regs_amx3, emif_sdcfg_val)); | ||
| 21 | DEFINE(EMIF_TIMING1_VAL_OFFSET, | ||
| 22 | offsetof(struct emif_regs_amx3, emif_timing1_val)); | ||
| 23 | DEFINE(EMIF_TIMING2_VAL_OFFSET, | ||
| 24 | offsetof(struct emif_regs_amx3, emif_timing2_val)); | ||
| 25 | DEFINE(EMIF_TIMING3_VAL_OFFSET, | ||
| 26 | offsetof(struct emif_regs_amx3, emif_timing3_val)); | ||
| 27 | DEFINE(EMIF_REF_CTRL_VAL_OFFSET, | ||
| 28 | offsetof(struct emif_regs_amx3, emif_ref_ctrl_val)); | ||
| 29 | DEFINE(EMIF_ZQCFG_VAL_OFFSET, | ||
| 30 | offsetof(struct emif_regs_amx3, emif_zqcfg_val)); | ||
| 31 | DEFINE(EMIF_PMCR_VAL_OFFSET, | ||
| 32 | offsetof(struct emif_regs_amx3, emif_pmcr_val)); | ||
| 33 | DEFINE(EMIF_PMCR_SHDW_VAL_OFFSET, | ||
| 34 | offsetof(struct emif_regs_amx3, emif_pmcr_shdw_val)); | ||
| 35 | DEFINE(EMIF_RD_WR_LEVEL_RAMP_CTRL_OFFSET, | ||
| 36 | offsetof(struct emif_regs_amx3, emif_rd_wr_level_ramp_ctrl)); | ||
| 37 | DEFINE(EMIF_RD_WR_EXEC_THRESH_OFFSET, | ||
| 38 | offsetof(struct emif_regs_amx3, emif_rd_wr_exec_thresh)); | ||
| 39 | DEFINE(EMIF_COS_CONFIG_OFFSET, | ||
| 40 | offsetof(struct emif_regs_amx3, emif_cos_config)); | ||
| 41 | DEFINE(EMIF_PRIORITY_TO_COS_MAPPING_OFFSET, | ||
| 42 | offsetof(struct emif_regs_amx3, emif_priority_to_cos_mapping)); | ||
| 43 | DEFINE(EMIF_CONNECT_ID_SERV_1_MAP_OFFSET, | ||
| 44 | offsetof(struct emif_regs_amx3, emif_connect_id_serv_1_map)); | ||
| 45 | DEFINE(EMIF_CONNECT_ID_SERV_2_MAP_OFFSET, | ||
| 46 | offsetof(struct emif_regs_amx3, emif_connect_id_serv_2_map)); | ||
| 47 | DEFINE(EMIF_OCP_CONFIG_VAL_OFFSET, | ||
| 48 | offsetof(struct emif_regs_amx3, emif_ocp_config_val)); | ||
| 49 | DEFINE(EMIF_LPDDR2_NVM_TIM_OFFSET, | ||
| 50 | offsetof(struct emif_regs_amx3, emif_lpddr2_nvm_tim)); | ||
| 51 | DEFINE(EMIF_LPDDR2_NVM_TIM_SHDW_OFFSET, | ||
| 52 | offsetof(struct emif_regs_amx3, emif_lpddr2_nvm_tim_shdw)); | ||
| 53 | DEFINE(EMIF_DLL_CALIB_CTRL_VAL_OFFSET, | ||
| 54 | offsetof(struct emif_regs_amx3, emif_dll_calib_ctrl_val)); | ||
| 55 | DEFINE(EMIF_DLL_CALIB_CTRL_VAL_SHDW_OFFSET, | ||
| 56 | offsetof(struct emif_regs_amx3, emif_dll_calib_ctrl_val_shdw)); | ||
| 57 | DEFINE(EMIF_DDR_PHY_CTLR_1_OFFSET, | ||
| 58 | offsetof(struct emif_regs_amx3, emif_ddr_phy_ctlr_1)); | ||
| 59 | DEFINE(EMIF_EXT_PHY_CTRL_VALS_OFFSET, | ||
| 60 | offsetof(struct emif_regs_amx3, emif_ext_phy_ctrl_vals)); | ||
| 61 | DEFINE(EMIF_REGS_AMX3_SIZE, sizeof(struct emif_regs_amx3)); | ||
| 62 | |||
| 63 | BLANK(); | ||
| 64 | |||
| 65 | DEFINE(EMIF_PM_BASE_ADDR_VIRT_OFFSET, | ||
| 66 | offsetof(struct ti_emif_pm_data, ti_emif_base_addr_virt)); | ||
| 67 | DEFINE(EMIF_PM_BASE_ADDR_PHYS_OFFSET, | ||
| 68 | offsetof(struct ti_emif_pm_data, ti_emif_base_addr_phys)); | ||
| 69 | DEFINE(EMIF_PM_CONFIG_OFFSET, | ||
| 70 | offsetof(struct ti_emif_pm_data, ti_emif_sram_config)); | ||
| 71 | DEFINE(EMIF_PM_REGS_VIRT_OFFSET, | ||
| 72 | offsetof(struct ti_emif_pm_data, regs_virt)); | ||
| 73 | DEFINE(EMIF_PM_REGS_PHYS_OFFSET, | ||
| 74 | offsetof(struct ti_emif_pm_data, regs_phys)); | ||
| 75 | DEFINE(EMIF_PM_DATA_SIZE, sizeof(struct ti_emif_pm_data)); | ||
| 76 | |||
| 77 | BLANK(); | ||
| 78 | |||
| 79 | DEFINE(EMIF_PM_SAVE_CONTEXT_OFFSET, | ||
| 80 | offsetof(struct ti_emif_pm_functions, save_context)); | ||
| 81 | DEFINE(EMIF_PM_RESTORE_CONTEXT_OFFSET, | ||
| 82 | offsetof(struct ti_emif_pm_functions, restore_context)); | ||
| 83 | DEFINE(EMIF_PM_ENTER_SR_OFFSET, | ||
| 84 | offsetof(struct ti_emif_pm_functions, enter_sr)); | ||
| 85 | DEFINE(EMIF_PM_EXIT_SR_OFFSET, | ||
| 86 | offsetof(struct ti_emif_pm_functions, exit_sr)); | ||
| 87 | DEFINE(EMIF_PM_ABORT_SR_OFFSET, | ||
| 88 | offsetof(struct ti_emif_pm_functions, abort_sr)); | ||
| 89 | DEFINE(EMIF_PM_FUNCTIONS_SIZE, sizeof(struct ti_emif_pm_functions)); | ||
| 90 | 20 | ||
| 91 | return 0; | 21 | return 0; |
| 92 | } | 22 | } |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 231f3a1e27bf..86503f60468f 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
| @@ -1994,6 +1994,7 @@ static struct scsi_host_template mptsas_driver_template = { | |||
| 1994 | .cmd_per_lun = 7, | 1994 | .cmd_per_lun = 7, |
| 1995 | .use_clustering = ENABLE_CLUSTERING, | 1995 | .use_clustering = ENABLE_CLUSTERING, |
| 1996 | .shost_attrs = mptscsih_host_attrs, | 1996 | .shost_attrs = mptscsih_host_attrs, |
| 1997 | .no_write_same = 1, | ||
| 1997 | }; | 1998 | }; |
| 1998 | 1999 | ||
| 1999 | static int mptsas_get_linkerrors(struct sas_phy *phy) | 2000 | static int mptsas_get_linkerrors(struct sas_phy *phy) |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index d4c07b85f18e..f5695be14499 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
| @@ -45,6 +45,7 @@ | |||
| 45 | #define I82802AB 0x00ad | 45 | #define I82802AB 0x00ad |
| 46 | #define I82802AC 0x00ac | 46 | #define I82802AC 0x00ac |
| 47 | #define PF38F4476 0x881c | 47 | #define PF38F4476 0x881c |
| 48 | #define M28F00AP30 0x8963 | ||
| 48 | /* STMicroelectronics chips */ | 49 | /* STMicroelectronics chips */ |
| 49 | #define M50LPW080 0x002F | 50 | #define M50LPW080 0x002F |
| 50 | #define M50FLW080A 0x0080 | 51 | #define M50FLW080A 0x0080 |
| @@ -375,6 +376,17 @@ static void cfi_fixup_major_minor(struct cfi_private *cfi, | |||
| 375 | extp->MinorVersion = '1'; | 376 | extp->MinorVersion = '1'; |
| 376 | } | 377 | } |
| 377 | 378 | ||
| 379 | static int cfi_is_micron_28F00AP30(struct cfi_private *cfi, struct flchip *chip) | ||
| 380 | { | ||
| 381 | /* | ||
| 382 | * Micron(was Numonyx) 1Gbit bottom boot are buggy w.r.t | ||
| 383 | * Erase Supend for their small Erase Blocks(0x8000) | ||
| 384 | */ | ||
| 385 | if (cfi->mfr == CFI_MFR_INTEL && cfi->id == M28F00AP30) | ||
| 386 | return 1; | ||
| 387 | return 0; | ||
| 388 | } | ||
| 389 | |||
| 378 | static inline struct cfi_pri_intelext * | 390 | static inline struct cfi_pri_intelext * |
| 379 | read_pri_intelext(struct map_info *map, __u16 adr) | 391 | read_pri_intelext(struct map_info *map, __u16 adr) |
| 380 | { | 392 | { |
| @@ -831,21 +843,30 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long | |||
| 831 | (mode == FL_WRITING && (cfip->SuspendCmdSupport & 1)))) | 843 | (mode == FL_WRITING && (cfip->SuspendCmdSupport & 1)))) |
| 832 | goto sleep; | 844 | goto sleep; |
| 833 | 845 | ||
| 846 | /* Do not allow suspend iff read/write to EB address */ | ||
| 847 | if ((adr & chip->in_progress_block_mask) == | ||
| 848 | chip->in_progress_block_addr) | ||
| 849 | goto sleep; | ||
| 850 | |||
| 851 | /* do not suspend small EBs, buggy Micron Chips */ | ||
| 852 | if (cfi_is_micron_28F00AP30(cfi, chip) && | ||
| 853 | (chip->in_progress_block_mask == ~(0x8000-1))) | ||
| 854 | goto sleep; | ||
| 834 | 855 | ||
| 835 | /* Erase suspend */ | 856 | /* Erase suspend */ |
| 836 | map_write(map, CMD(0xB0), adr); | 857 | map_write(map, CMD(0xB0), chip->in_progress_block_addr); |
| 837 | 858 | ||
| 838 | /* If the flash has finished erasing, then 'erase suspend' | 859 | /* If the flash has finished erasing, then 'erase suspend' |
| 839 | * appears to make some (28F320) flash devices switch to | 860 | * appears to make some (28F320) flash devices switch to |
| 840 | * 'read' mode. Make sure that we switch to 'read status' | 861 | * 'read' mode. Make sure that we switch to 'read status' |
| 841 | * mode so we get the right data. --rmk | 862 | * mode so we get the right data. --rmk |
| 842 | */ | 863 | */ |
| 843 | map_write(map, CMD(0x70), adr); | 864 | map_write(map, CMD(0x70), chip->in_progress_block_addr); |
| 844 | chip->oldstate = FL_ERASING; | 865 | chip->oldstate = FL_ERASING; |
| 845 | chip->state = FL_ERASE_SUSPENDING; | 866 | chip->state = FL_ERASE_SUSPENDING; |
| 846 | chip->erase_suspended = 1; | 867 | chip->erase_suspended = 1; |
| 847 | for (;;) { | 868 | for (;;) { |
| 848 | status = map_read(map, adr); | 869 | status = map_read(map, chip->in_progress_block_addr); |
| 849 | if (map_word_andequal(map, status, status_OK, status_OK)) | 870 | if (map_word_andequal(map, status, status_OK, status_OK)) |
| 850 | break; | 871 | break; |
| 851 | 872 | ||
| @@ -1041,8 +1062,8 @@ static void put_chip(struct map_info *map, struct flchip *chip, unsigned long ad | |||
| 1041 | sending the 0x70 (Read Status) command to an erasing | 1062 | sending the 0x70 (Read Status) command to an erasing |
| 1042 | chip and expecting it to be ignored, that's what we | 1063 | chip and expecting it to be ignored, that's what we |
| 1043 | do. */ | 1064 | do. */ |
| 1044 | map_write(map, CMD(0xd0), adr); | 1065 | map_write(map, CMD(0xd0), chip->in_progress_block_addr); |
| 1045 | map_write(map, CMD(0x70), adr); | 1066 | map_write(map, CMD(0x70), chip->in_progress_block_addr); |
| 1046 | chip->oldstate = FL_READY; | 1067 | chip->oldstate = FL_READY; |
| 1047 | chip->state = FL_ERASING; | 1068 | chip->state = FL_ERASING; |
| 1048 | break; | 1069 | break; |
| @@ -1933,6 +1954,8 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
| 1933 | map_write(map, CMD(0xD0), adr); | 1954 | map_write(map, CMD(0xD0), adr); |
| 1934 | chip->state = FL_ERASING; | 1955 | chip->state = FL_ERASING; |
| 1935 | chip->erase_suspended = 0; | 1956 | chip->erase_suspended = 0; |
| 1957 | chip->in_progress_block_addr = adr; | ||
| 1958 | chip->in_progress_block_mask = ~(len - 1); | ||
| 1936 | 1959 | ||
| 1937 | ret = INVAL_CACHE_AND_WAIT(map, chip, adr, | 1960 | ret = INVAL_CACHE_AND_WAIT(map, chip, adr, |
| 1938 | adr, len, | 1961 | adr, len, |
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 668e2cbc155b..692902df2598 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
| @@ -816,9 +816,10 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr | |||
| 816 | (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)))) | 816 | (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)))) |
| 817 | goto sleep; | 817 | goto sleep; |
| 818 | 818 | ||
| 819 | /* We could check to see if we're trying to access the sector | 819 | /* Do not allow suspend iff read/write to EB address */ |
| 820 | * that is currently being erased. However, no user will try | 820 | if ((adr & chip->in_progress_block_mask) == |
| 821 | * anything like that so we just wait for the timeout. */ | 821 | chip->in_progress_block_addr) |
| 822 | goto sleep; | ||
| 822 | 823 | ||
| 823 | /* Erase suspend */ | 824 | /* Erase suspend */ |
| 824 | /* It's harmless to issue the Erase-Suspend and Erase-Resume | 825 | /* It's harmless to issue the Erase-Suspend and Erase-Resume |
| @@ -2267,6 +2268,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) | |||
| 2267 | chip->state = FL_ERASING; | 2268 | chip->state = FL_ERASING; |
| 2268 | chip->erase_suspended = 0; | 2269 | chip->erase_suspended = 0; |
| 2269 | chip->in_progress_block_addr = adr; | 2270 | chip->in_progress_block_addr = adr; |
| 2271 | chip->in_progress_block_mask = ~(map->size - 1); | ||
| 2270 | 2272 | ||
| 2271 | INVALIDATE_CACHE_UDELAY(map, chip, | 2273 | INVALIDATE_CACHE_UDELAY(map, chip, |
| 2272 | adr, map->size, | 2274 | adr, map->size, |
| @@ -2356,6 +2358,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
| 2356 | chip->state = FL_ERASING; | 2358 | chip->state = FL_ERASING; |
| 2357 | chip->erase_suspended = 0; | 2359 | chip->erase_suspended = 0; |
| 2358 | chip->in_progress_block_addr = adr; | 2360 | chip->in_progress_block_addr = adr; |
| 2361 | chip->in_progress_block_mask = ~(len - 1); | ||
| 2359 | 2362 | ||
| 2360 | INVALIDATE_CACHE_UDELAY(map, chip, | 2363 | INVALIDATE_CACHE_UDELAY(map, chip, |
| 2361 | adr, len, | 2364 | adr, len, |
diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index d0cd6f8635d7..9c9f8936b63b 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c | |||
| @@ -162,7 +162,6 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo) | |||
| 162 | ret = nanddev_erase(nand, &pos); | 162 | ret = nanddev_erase(nand, &pos); |
| 163 | if (ret) { | 163 | if (ret) { |
| 164 | einfo->fail_addr = nanddev_pos_to_offs(nand, &pos); | 164 | einfo->fail_addr = nanddev_pos_to_offs(nand, &pos); |
| 165 | einfo->state = MTD_ERASE_FAILED; | ||
| 166 | 165 | ||
| 167 | return ret; | 166 | return ret; |
| 168 | } | 167 | } |
| @@ -170,8 +169,6 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo) | |||
| 170 | nanddev_pos_next_eraseblock(nand, &pos); | 169 | nanddev_pos_next_eraseblock(nand, &pos); |
| 171 | } | 170 | } |
| 172 | 171 | ||
| 173 | einfo->state = MTD_ERASE_DONE; | ||
| 174 | |||
| 175 | return 0; | 172 | return 0; |
| 176 | } | 173 | } |
| 177 | EXPORT_SYMBOL_GPL(nanddev_mtd_erase); | 174 | EXPORT_SYMBOL_GPL(nanddev_mtd_erase); |
diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c index 10e953218948..1d779a35ac8e 100644 --- a/drivers/mtd/nand/raw/marvell_nand.c +++ b/drivers/mtd/nand/raw/marvell_nand.c | |||
| @@ -2299,29 +2299,20 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc, | |||
| 2299 | /* | 2299 | /* |
| 2300 | * The legacy "num-cs" property indicates the number of CS on the only | 2300 | * The legacy "num-cs" property indicates the number of CS on the only |
| 2301 | * chip connected to the controller (legacy bindings does not support | 2301 | * chip connected to the controller (legacy bindings does not support |
| 2302 | * more than one chip). CS are only incremented one by one while the RB | 2302 | * more than one chip). The CS and RB pins are always the #0. |
| 2303 | * pin is always the #0. | ||
| 2304 | * | 2303 | * |
| 2305 | * When not using legacy bindings, a couple of "reg" and "nand-rb" | 2304 | * When not using legacy bindings, a couple of "reg" and "nand-rb" |
| 2306 | * properties must be filled. For each chip, expressed as a subnode, | 2305 | * properties must be filled. For each chip, expressed as a subnode, |
| 2307 | * "reg" points to the CS lines and "nand-rb" to the RB line. | 2306 | * "reg" points to the CS lines and "nand-rb" to the RB line. |
| 2308 | */ | 2307 | */ |
| 2309 | if (pdata) { | 2308 | if (pdata || nfc->caps->legacy_of_bindings) { |
| 2310 | nsels = 1; | 2309 | nsels = 1; |
| 2311 | } else if (nfc->caps->legacy_of_bindings && | 2310 | } else { |
| 2312 | !of_get_property(np, "num-cs", &nsels)) { | 2311 | nsels = of_property_count_elems_of_size(np, "reg", sizeof(u32)); |
| 2313 | dev_err(dev, "missing num-cs property\n"); | 2312 | if (nsels <= 0) { |
| 2314 | return -EINVAL; | 2313 | dev_err(dev, "missing/invalid reg property\n"); |
| 2315 | } else if (!of_get_property(np, "reg", &nsels)) { | 2314 | return -EINVAL; |
| 2316 | dev_err(dev, "missing reg property\n"); | 2315 | } |
| 2317 | return -EINVAL; | ||
| 2318 | } | ||
| 2319 | |||
| 2320 | if (!pdata) | ||
| 2321 | nsels /= sizeof(u32); | ||
| 2322 | if (!nsels) { | ||
| 2323 | dev_err(dev, "invalid reg property size\n"); | ||
| 2324 | return -EINVAL; | ||
| 2325 | } | 2316 | } |
| 2326 | 2317 | ||
| 2327 | /* Alloc the nand chip structure */ | 2318 | /* Alloc the nand chip structure */ |
diff --git a/drivers/mtd/nand/raw/tango_nand.c b/drivers/mtd/nand/raw/tango_nand.c index f54518ffb36a..f2052fae21c7 100644 --- a/drivers/mtd/nand/raw/tango_nand.c +++ b/drivers/mtd/nand/raw/tango_nand.c | |||
| @@ -645,7 +645,7 @@ static int tango_nand_probe(struct platform_device *pdev) | |||
| 645 | 645 | ||
| 646 | writel_relaxed(MODE_RAW, nfc->pbus_base + PBUS_PAD_MODE); | 646 | writel_relaxed(MODE_RAW, nfc->pbus_base + PBUS_PAD_MODE); |
| 647 | 647 | ||
| 648 | clk = clk_get(&pdev->dev, NULL); | 648 | clk = devm_clk_get(&pdev->dev, NULL); |
| 649 | if (IS_ERR(clk)) | 649 | if (IS_ERR(clk)) |
| 650 | return PTR_ERR(clk); | 650 | return PTR_ERR(clk); |
| 651 | 651 | ||
diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c index 4b8e9183489a..5872f31eaa60 100644 --- a/drivers/mtd/spi-nor/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/cadence-quadspi.c | |||
| @@ -501,7 +501,9 @@ static int cqspi_indirect_read_execute(struct spi_nor *nor, u8 *rxbuf, | |||
| 501 | void __iomem *reg_base = cqspi->iobase; | 501 | void __iomem *reg_base = cqspi->iobase; |
| 502 | void __iomem *ahb_base = cqspi->ahb_base; | 502 | void __iomem *ahb_base = cqspi->ahb_base; |
| 503 | unsigned int remaining = n_rx; | 503 | unsigned int remaining = n_rx; |
| 504 | unsigned int mod_bytes = n_rx % 4; | ||
| 504 | unsigned int bytes_to_read = 0; | 505 | unsigned int bytes_to_read = 0; |
| 506 | u8 *rxbuf_end = rxbuf + n_rx; | ||
| 505 | int ret = 0; | 507 | int ret = 0; |
| 506 | 508 | ||
| 507 | writel(from_addr, reg_base + CQSPI_REG_INDIRECTRDSTARTADDR); | 509 | writel(from_addr, reg_base + CQSPI_REG_INDIRECTRDSTARTADDR); |
| @@ -530,11 +532,24 @@ static int cqspi_indirect_read_execute(struct spi_nor *nor, u8 *rxbuf, | |||
| 530 | } | 532 | } |
| 531 | 533 | ||
| 532 | while (bytes_to_read != 0) { | 534 | while (bytes_to_read != 0) { |
| 535 | unsigned int word_remain = round_down(remaining, 4); | ||
| 536 | |||
| 533 | bytes_to_read *= cqspi->fifo_width; | 537 | bytes_to_read *= cqspi->fifo_width; |
| 534 | bytes_to_read = bytes_to_read > remaining ? | 538 | bytes_to_read = bytes_to_read > remaining ? |
| 535 | remaining : bytes_to_read; | 539 | remaining : bytes_to_read; |
| 536 | ioread32_rep(ahb_base, rxbuf, | 540 | bytes_to_read = round_down(bytes_to_read, 4); |
| 537 | DIV_ROUND_UP(bytes_to_read, 4)); | 541 | /* Read 4 byte word chunks then single bytes */ |
| 542 | if (bytes_to_read) { | ||
| 543 | ioread32_rep(ahb_base, rxbuf, | ||
| 544 | (bytes_to_read / 4)); | ||
| 545 | } else if (!word_remain && mod_bytes) { | ||
| 546 | unsigned int temp = ioread32(ahb_base); | ||
| 547 | |||
| 548 | bytes_to_read = mod_bytes; | ||
| 549 | memcpy(rxbuf, &temp, min((unsigned int) | ||
| 550 | (rxbuf_end - rxbuf), | ||
| 551 | bytes_to_read)); | ||
| 552 | } | ||
| 538 | rxbuf += bytes_to_read; | 553 | rxbuf += bytes_to_read; |
| 539 | remaining -= bytes_to_read; | 554 | remaining -= bytes_to_read; |
| 540 | bytes_to_read = cqspi_get_rd_sram_level(cqspi); | 555 | bytes_to_read = cqspi_get_rd_sram_level(cqspi); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b7b113018853..718e4914e3a0 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -1660,8 +1660,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, | |||
| 1660 | } /* switch(bond_mode) */ | 1660 | } /* switch(bond_mode) */ |
| 1661 | 1661 | ||
| 1662 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1662 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 1663 | slave_dev->npinfo = bond->dev->npinfo; | 1663 | if (bond->dev->npinfo) { |
| 1664 | if (slave_dev->npinfo) { | ||
| 1665 | if (slave_enable_netpoll(new_slave)) { | 1664 | if (slave_enable_netpoll(new_slave)) { |
| 1666 | netdev_info(bond_dev, "master_dev is using netpoll, but new slave device does not support netpoll\n"); | 1665 | netdev_info(bond_dev, "master_dev is using netpoll, but new slave device does not support netpoll\n"); |
| 1667 | res = -EBUSY; | 1666 | res = -EBUSY; |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h index 7ea72ef11a55..d272dc6984ac 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h | |||
| @@ -1321,6 +1321,10 @@ | |||
| 1321 | #define MDIO_VEND2_AN_STAT 0x8002 | 1321 | #define MDIO_VEND2_AN_STAT 0x8002 |
| 1322 | #endif | 1322 | #endif |
| 1323 | 1323 | ||
| 1324 | #ifndef MDIO_VEND2_PMA_CDR_CONTROL | ||
| 1325 | #define MDIO_VEND2_PMA_CDR_CONTROL 0x8056 | ||
| 1326 | #endif | ||
| 1327 | |||
| 1324 | #ifndef MDIO_CTRL1_SPEED1G | 1328 | #ifndef MDIO_CTRL1_SPEED1G |
| 1325 | #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100) | 1329 | #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100) |
| 1326 | #endif | 1330 | #endif |
| @@ -1369,6 +1373,10 @@ | |||
| 1369 | #define XGBE_AN_CL37_TX_CONFIG_MASK 0x08 | 1373 | #define XGBE_AN_CL37_TX_CONFIG_MASK 0x08 |
| 1370 | #define XGBE_AN_CL37_MII_CTRL_8BIT 0x0100 | 1374 | #define XGBE_AN_CL37_MII_CTRL_8BIT 0x0100 |
| 1371 | 1375 | ||
| 1376 | #define XGBE_PMA_CDR_TRACK_EN_MASK 0x01 | ||
| 1377 | #define XGBE_PMA_CDR_TRACK_EN_OFF 0x00 | ||
| 1378 | #define XGBE_PMA_CDR_TRACK_EN_ON 0x01 | ||
| 1379 | |||
| 1372 | /* Bit setting and getting macros | 1380 | /* Bit setting and getting macros |
| 1373 | * The get macro will extract the current bit field value from within | 1381 | * The get macro will extract the current bit field value from within |
| 1374 | * the variable | 1382 | * the variable |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c index 7d128be61310..b91143947ed2 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | |||
| @@ -519,6 +519,22 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata) | |||
| 519 | "debugfs_create_file failed\n"); | 519 | "debugfs_create_file failed\n"); |
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | if (pdata->vdata->an_cdr_workaround) { | ||
| 523 | pfile = debugfs_create_bool("an_cdr_workaround", 0600, | ||
| 524 | pdata->xgbe_debugfs, | ||
| 525 | &pdata->debugfs_an_cdr_workaround); | ||
| 526 | if (!pfile) | ||
| 527 | netdev_err(pdata->netdev, | ||
| 528 | "debugfs_create_bool failed\n"); | ||
| 529 | |||
| 530 | pfile = debugfs_create_bool("an_cdr_track_early", 0600, | ||
| 531 | pdata->xgbe_debugfs, | ||
| 532 | &pdata->debugfs_an_cdr_track_early); | ||
| 533 | if (!pfile) | ||
| 534 | netdev_err(pdata->netdev, | ||
| 535 | "debugfs_create_bool failed\n"); | ||
| 536 | } | ||
| 537 | |||
| 522 | kfree(buf); | 538 | kfree(buf); |
| 523 | } | 539 | } |
| 524 | 540 | ||
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index 795e556d4a3f..441d0973957b 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c | |||
| @@ -349,6 +349,7 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) | |||
| 349 | XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1); | 349 | XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1); |
| 350 | 350 | ||
| 351 | /* Call MDIO/PHY initialization routine */ | 351 | /* Call MDIO/PHY initialization routine */ |
| 352 | pdata->debugfs_an_cdr_workaround = pdata->vdata->an_cdr_workaround; | ||
| 352 | ret = pdata->phy_if.phy_init(pdata); | 353 | ret = pdata->phy_if.phy_init(pdata); |
| 353 | if (ret) | 354 | if (ret) |
| 354 | return ret; | 355 | return ret; |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c index 072b9f664597..1b45cd73a258 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | |||
| @@ -432,11 +432,16 @@ static void xgbe_an73_disable(struct xgbe_prv_data *pdata) | |||
| 432 | xgbe_an73_set(pdata, false, false); | 432 | xgbe_an73_set(pdata, false, false); |
| 433 | xgbe_an73_disable_interrupts(pdata); | 433 | xgbe_an73_disable_interrupts(pdata); |
| 434 | 434 | ||
| 435 | pdata->an_start = 0; | ||
| 436 | |||
| 435 | netif_dbg(pdata, link, pdata->netdev, "CL73 AN disabled\n"); | 437 | netif_dbg(pdata, link, pdata->netdev, "CL73 AN disabled\n"); |
| 436 | } | 438 | } |
| 437 | 439 | ||
| 438 | static void xgbe_an_restart(struct xgbe_prv_data *pdata) | 440 | static void xgbe_an_restart(struct xgbe_prv_data *pdata) |
| 439 | { | 441 | { |
| 442 | if (pdata->phy_if.phy_impl.an_pre) | ||
| 443 | pdata->phy_if.phy_impl.an_pre(pdata); | ||
| 444 | |||
| 440 | switch (pdata->an_mode) { | 445 | switch (pdata->an_mode) { |
| 441 | case XGBE_AN_MODE_CL73: | 446 | case XGBE_AN_MODE_CL73: |
| 442 | case XGBE_AN_MODE_CL73_REDRV: | 447 | case XGBE_AN_MODE_CL73_REDRV: |
| @@ -453,6 +458,9 @@ static void xgbe_an_restart(struct xgbe_prv_data *pdata) | |||
| 453 | 458 | ||
| 454 | static void xgbe_an_disable(struct xgbe_prv_data *pdata) | 459 | static void xgbe_an_disable(struct xgbe_prv_data *pdata) |
| 455 | { | 460 | { |
| 461 | if (pdata->phy_if.phy_impl.an_post) | ||
| 462 | pdata->phy_if.phy_impl.an_post(pdata); | ||
| 463 | |||
| 456 | switch (pdata->an_mode) { | 464 | switch (pdata->an_mode) { |
| 457 | case XGBE_AN_MODE_CL73: | 465 | case XGBE_AN_MODE_CL73: |
| 458 | case XGBE_AN_MODE_CL73_REDRV: | 466 | case XGBE_AN_MODE_CL73_REDRV: |
| @@ -505,11 +513,11 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata, | |||
| 505 | XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, | 513 | XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, |
| 506 | reg); | 514 | reg); |
| 507 | 515 | ||
| 508 | if (pdata->phy_if.phy_impl.kr_training_post) | ||
| 509 | pdata->phy_if.phy_impl.kr_training_post(pdata); | ||
| 510 | |||
| 511 | netif_dbg(pdata, link, pdata->netdev, | 516 | netif_dbg(pdata, link, pdata->netdev, |
| 512 | "KR training initiated\n"); | 517 | "KR training initiated\n"); |
| 518 | |||
| 519 | if (pdata->phy_if.phy_impl.kr_training_post) | ||
| 520 | pdata->phy_if.phy_impl.kr_training_post(pdata); | ||
| 513 | } | 521 | } |
| 514 | 522 | ||
| 515 | return XGBE_AN_PAGE_RECEIVED; | 523 | return XGBE_AN_PAGE_RECEIVED; |
| @@ -637,11 +645,11 @@ static enum xgbe_an xgbe_an73_incompat_link(struct xgbe_prv_data *pdata) | |||
| 637 | return XGBE_AN_NO_LINK; | 645 | return XGBE_AN_NO_LINK; |
| 638 | } | 646 | } |
| 639 | 647 | ||
| 640 | xgbe_an73_disable(pdata); | 648 | xgbe_an_disable(pdata); |
| 641 | 649 | ||
| 642 | xgbe_switch_mode(pdata); | 650 | xgbe_switch_mode(pdata); |
| 643 | 651 | ||
| 644 | xgbe_an73_restart(pdata); | 652 | xgbe_an_restart(pdata); |
| 645 | 653 | ||
| 646 | return XGBE_AN_INCOMPAT_LINK; | 654 | return XGBE_AN_INCOMPAT_LINK; |
| 647 | } | 655 | } |
| @@ -820,6 +828,9 @@ static void xgbe_an37_state_machine(struct xgbe_prv_data *pdata) | |||
| 820 | pdata->an_result = pdata->an_state; | 828 | pdata->an_result = pdata->an_state; |
| 821 | pdata->an_state = XGBE_AN_READY; | 829 | pdata->an_state = XGBE_AN_READY; |
| 822 | 830 | ||
| 831 | if (pdata->phy_if.phy_impl.an_post) | ||
| 832 | pdata->phy_if.phy_impl.an_post(pdata); | ||
| 833 | |||
| 823 | netif_dbg(pdata, link, pdata->netdev, "CL37 AN result: %s\n", | 834 | netif_dbg(pdata, link, pdata->netdev, "CL37 AN result: %s\n", |
| 824 | xgbe_state_as_string(pdata->an_result)); | 835 | xgbe_state_as_string(pdata->an_result)); |
| 825 | } | 836 | } |
| @@ -903,6 +914,9 @@ again: | |||
| 903 | pdata->kx_state = XGBE_RX_BPA; | 914 | pdata->kx_state = XGBE_RX_BPA; |
| 904 | pdata->an_start = 0; | 915 | pdata->an_start = 0; |
| 905 | 916 | ||
| 917 | if (pdata->phy_if.phy_impl.an_post) | ||
| 918 | pdata->phy_if.phy_impl.an_post(pdata); | ||
| 919 | |||
| 906 | netif_dbg(pdata, link, pdata->netdev, "CL73 AN result: %s\n", | 920 | netif_dbg(pdata, link, pdata->netdev, "CL73 AN result: %s\n", |
| 907 | xgbe_state_as_string(pdata->an_result)); | 921 | xgbe_state_as_string(pdata->an_result)); |
| 908 | } | 922 | } |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c index eb23f9ba1a9a..82d1f416ee2a 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c | |||
| @@ -456,6 +456,7 @@ static const struct xgbe_version_data xgbe_v2a = { | |||
| 456 | .irq_reissue_support = 1, | 456 | .irq_reissue_support = 1, |
| 457 | .tx_desc_prefetch = 5, | 457 | .tx_desc_prefetch = 5, |
| 458 | .rx_desc_prefetch = 5, | 458 | .rx_desc_prefetch = 5, |
| 459 | .an_cdr_workaround = 1, | ||
| 459 | }; | 460 | }; |
| 460 | 461 | ||
| 461 | static const struct xgbe_version_data xgbe_v2b = { | 462 | static const struct xgbe_version_data xgbe_v2b = { |
| @@ -470,6 +471,7 @@ static const struct xgbe_version_data xgbe_v2b = { | |||
| 470 | .irq_reissue_support = 1, | 471 | .irq_reissue_support = 1, |
| 471 | .tx_desc_prefetch = 5, | 472 | .tx_desc_prefetch = 5, |
| 472 | .rx_desc_prefetch = 5, | 473 | .rx_desc_prefetch = 5, |
| 474 | .an_cdr_workaround = 1, | ||
| 473 | }; | 475 | }; |
| 474 | 476 | ||
| 475 | static const struct pci_device_id xgbe_pci_table[] = { | 477 | static const struct pci_device_id xgbe_pci_table[] = { |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 3304a291aa96..aac884314000 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | |||
| @@ -147,6 +147,14 @@ | |||
| 147 | /* Rate-change complete wait/retry count */ | 147 | /* Rate-change complete wait/retry count */ |
| 148 | #define XGBE_RATECHANGE_COUNT 500 | 148 | #define XGBE_RATECHANGE_COUNT 500 |
| 149 | 149 | ||
| 150 | /* CDR delay values for KR support (in usec) */ | ||
| 151 | #define XGBE_CDR_DELAY_INIT 10000 | ||
| 152 | #define XGBE_CDR_DELAY_INC 10000 | ||
| 153 | #define XGBE_CDR_DELAY_MAX 100000 | ||
| 154 | |||
| 155 | /* RRC frequency during link status check */ | ||
| 156 | #define XGBE_RRC_FREQUENCY 10 | ||
| 157 | |||
| 150 | enum xgbe_port_mode { | 158 | enum xgbe_port_mode { |
| 151 | XGBE_PORT_MODE_RSVD = 0, | 159 | XGBE_PORT_MODE_RSVD = 0, |
| 152 | XGBE_PORT_MODE_BACKPLANE, | 160 | XGBE_PORT_MODE_BACKPLANE, |
| @@ -245,6 +253,10 @@ enum xgbe_sfp_speed { | |||
| 245 | #define XGBE_SFP_BASE_VENDOR_SN 4 | 253 | #define XGBE_SFP_BASE_VENDOR_SN 4 |
| 246 | #define XGBE_SFP_BASE_VENDOR_SN_LEN 16 | 254 | #define XGBE_SFP_BASE_VENDOR_SN_LEN 16 |
| 247 | 255 | ||
| 256 | #define XGBE_SFP_EXTD_OPT1 1 | ||
| 257 | #define XGBE_SFP_EXTD_OPT1_RX_LOS BIT(1) | ||
| 258 | #define XGBE_SFP_EXTD_OPT1_TX_FAULT BIT(3) | ||
| 259 | |||
| 248 | #define XGBE_SFP_EXTD_DIAG 28 | 260 | #define XGBE_SFP_EXTD_DIAG 28 |
| 249 | #define XGBE_SFP_EXTD_DIAG_ADDR_CHANGE BIT(2) | 261 | #define XGBE_SFP_EXTD_DIAG_ADDR_CHANGE BIT(2) |
| 250 | 262 | ||
| @@ -324,6 +336,7 @@ struct xgbe_phy_data { | |||
| 324 | 336 | ||
| 325 | unsigned int sfp_gpio_address; | 337 | unsigned int sfp_gpio_address; |
| 326 | unsigned int sfp_gpio_mask; | 338 | unsigned int sfp_gpio_mask; |
| 339 | unsigned int sfp_gpio_inputs; | ||
| 327 | unsigned int sfp_gpio_rx_los; | 340 | unsigned int sfp_gpio_rx_los; |
| 328 | unsigned int sfp_gpio_tx_fault; | 341 | unsigned int sfp_gpio_tx_fault; |
| 329 | unsigned int sfp_gpio_mod_absent; | 342 | unsigned int sfp_gpio_mod_absent; |
| @@ -355,6 +368,10 @@ struct xgbe_phy_data { | |||
| 355 | unsigned int redrv_addr; | 368 | unsigned int redrv_addr; |
| 356 | unsigned int redrv_lane; | 369 | unsigned int redrv_lane; |
| 357 | unsigned int redrv_model; | 370 | unsigned int redrv_model; |
| 371 | |||
| 372 | /* KR AN support */ | ||
| 373 | unsigned int phy_cdr_notrack; | ||
| 374 | unsigned int phy_cdr_delay; | ||
| 358 | }; | 375 | }; |
| 359 | 376 | ||
| 360 | /* I2C, MDIO and GPIO lines are muxed, so only one device at a time */ | 377 | /* I2C, MDIO and GPIO lines are muxed, so only one device at a time */ |
| @@ -974,6 +991,49 @@ static void xgbe_phy_sfp_external_phy(struct xgbe_prv_data *pdata) | |||
| 974 | phy_data->sfp_phy_avail = 1; | 991 | phy_data->sfp_phy_avail = 1; |
| 975 | } | 992 | } |
| 976 | 993 | ||
| 994 | static bool xgbe_phy_check_sfp_rx_los(struct xgbe_phy_data *phy_data) | ||
| 995 | { | ||
| 996 | u8 *sfp_extd = phy_data->sfp_eeprom.extd; | ||
| 997 | |||
| 998 | if (!(sfp_extd[XGBE_SFP_EXTD_OPT1] & XGBE_SFP_EXTD_OPT1_RX_LOS)) | ||
| 999 | return false; | ||
| 1000 | |||
| 1001 | if (phy_data->sfp_gpio_mask & XGBE_GPIO_NO_RX_LOS) | ||
| 1002 | return false; | ||
| 1003 | |||
| 1004 | if (phy_data->sfp_gpio_inputs & (1 << phy_data->sfp_gpio_rx_los)) | ||
| 1005 | return true; | ||
| 1006 | |||
| 1007 | return false; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | static bool xgbe_phy_check_sfp_tx_fault(struct xgbe_phy_data *phy_data) | ||
| 1011 | { | ||
| 1012 | u8 *sfp_extd = phy_data->sfp_eeprom.extd; | ||
| 1013 | |||
| 1014 | if (!(sfp_extd[XGBE_SFP_EXTD_OPT1] & XGBE_SFP_EXTD_OPT1_TX_FAULT)) | ||
| 1015 | return false; | ||
| 1016 | |||
| 1017 | if (phy_data->sfp_gpio_mask & XGBE_GPIO_NO_TX_FAULT) | ||
| 1018 | return false; | ||
| 1019 | |||
| 1020 | if (phy_data->sfp_gpio_inputs & (1 << phy_data->sfp_gpio_tx_fault)) | ||
| 1021 | return true; | ||
| 1022 | |||
| 1023 | return false; | ||
| 1024 | } | ||
| 1025 | |||
| 1026 | static bool xgbe_phy_check_sfp_mod_absent(struct xgbe_phy_data *phy_data) | ||
| 1027 | { | ||
| 1028 | if (phy_data->sfp_gpio_mask & XGBE_GPIO_NO_MOD_ABSENT) | ||
| 1029 | return false; | ||
| 1030 | |||
| 1031 | if (phy_data->sfp_gpio_inputs & (1 << phy_data->sfp_gpio_mod_absent)) | ||
| 1032 | return true; | ||
| 1033 | |||
| 1034 | return false; | ||
| 1035 | } | ||
| 1036 | |||
| 977 | static bool xgbe_phy_belfuse_parse_quirks(struct xgbe_prv_data *pdata) | 1037 | static bool xgbe_phy_belfuse_parse_quirks(struct xgbe_prv_data *pdata) |
| 978 | { | 1038 | { |
| 979 | struct xgbe_phy_data *phy_data = pdata->phy_data; | 1039 | struct xgbe_phy_data *phy_data = pdata->phy_data; |
| @@ -1019,6 +1079,10 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata) | |||
| 1019 | if (sfp_base[XGBE_SFP_BASE_EXT_ID] != XGBE_SFP_EXT_ID_SFP) | 1079 | if (sfp_base[XGBE_SFP_BASE_EXT_ID] != XGBE_SFP_EXT_ID_SFP) |
| 1020 | return; | 1080 | return; |
| 1021 | 1081 | ||
| 1082 | /* Update transceiver signals (eeprom extd/options) */ | ||
| 1083 | phy_data->sfp_tx_fault = xgbe_phy_check_sfp_tx_fault(phy_data); | ||
| 1084 | phy_data->sfp_rx_los = xgbe_phy_check_sfp_rx_los(phy_data); | ||
| 1085 | |||
| 1022 | if (xgbe_phy_sfp_parse_quirks(pdata)) | 1086 | if (xgbe_phy_sfp_parse_quirks(pdata)) |
| 1023 | return; | 1087 | return; |
| 1024 | 1088 | ||
| @@ -1184,7 +1248,6 @@ put: | |||
| 1184 | static void xgbe_phy_sfp_signals(struct xgbe_prv_data *pdata) | 1248 | static void xgbe_phy_sfp_signals(struct xgbe_prv_data *pdata) |
| 1185 | { | 1249 | { |
| 1186 | struct xgbe_phy_data *phy_data = pdata->phy_data; | 1250 | struct xgbe_phy_data *phy_data = pdata->phy_data; |
| 1187 | unsigned int gpio_input; | ||
| 1188 | u8 gpio_reg, gpio_ports[2]; | 1251 | u8 gpio_reg, gpio_ports[2]; |
| 1189 | int ret; | 1252 | int ret; |
| 1190 | 1253 | ||
| @@ -1199,23 +1262,9 @@ static void xgbe_phy_sfp_signals(struct xgbe_prv_data *pdata) | |||
| 1199 | return; | 1262 | return; |
| 1200 | } | 1263 | } |
| 1201 | 1264 | ||
| 1202 | gpio_input = (gpio_ports[1] << 8) | gpio_ports[0]; | 1265 | phy_data->sfp_gpio_inputs = (gpio_ports[1] << 8) | gpio_ports[0]; |
| 1203 | |||
| 1204 | if (phy_data->sfp_gpio_mask & XGBE_GPIO_NO_MOD_ABSENT) { | ||
| 1205 | /* No GPIO, just assume the module is present for now */ | ||
| 1206 | phy_data->sfp_mod_absent = 0; | ||
| 1207 | } else { | ||
| 1208 | if (!(gpio_input & (1 << phy_data->sfp_gpio_mod_absent))) | ||
| 1209 | phy_data->sfp_mod_absent = 0; | ||
| 1210 | } | ||
| 1211 | |||
| 1212 | if (!(phy_data->sfp_gpio_mask & XGBE_GPIO_NO_RX_LOS) && | ||
| 1213 | (gpio_input & (1 << phy_data->sfp_gpio_rx_los))) | ||
| 1214 | phy_data->sfp_rx_los = 1; | ||
| 1215 | 1266 | ||
| 1216 | if (!(phy_data->sfp_gpio_mask & XGBE_GPIO_NO_TX_FAULT) && | 1267 | phy_data->sfp_mod_absent = xgbe_phy_check_sfp_mod_absent(phy_data); |
| 1217 | (gpio_input & (1 << phy_data->sfp_gpio_tx_fault))) | ||
| 1218 | phy_data->sfp_tx_fault = 1; | ||
| 1219 | } | 1268 | } |
| 1220 | 1269 | ||
| 1221 | static void xgbe_phy_sfp_mod_absent(struct xgbe_prv_data *pdata) | 1270 | static void xgbe_phy_sfp_mod_absent(struct xgbe_prv_data *pdata) |
| @@ -2361,7 +2410,7 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart) | |||
| 2361 | return 1; | 2410 | return 1; |
| 2362 | 2411 | ||
| 2363 | /* No link, attempt a receiver reset cycle */ | 2412 | /* No link, attempt a receiver reset cycle */ |
| 2364 | if (phy_data->rrc_count++) { | 2413 | if (phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) { |
| 2365 | phy_data->rrc_count = 0; | 2414 | phy_data->rrc_count = 0; |
| 2366 | xgbe_phy_rrc(pdata); | 2415 | xgbe_phy_rrc(pdata); |
| 2367 | } | 2416 | } |
| @@ -2669,6 +2718,103 @@ static bool xgbe_phy_port_enabled(struct xgbe_prv_data *pdata) | |||
| 2669 | return true; | 2718 | return true; |
| 2670 | } | 2719 | } |
| 2671 | 2720 | ||
| 2721 | static void xgbe_phy_cdr_track(struct xgbe_prv_data *pdata) | ||
| 2722 | { | ||
| 2723 | struct xgbe_phy_data *phy_data = pdata->phy_data; | ||
| 2724 | |||
| 2725 | if (!pdata->debugfs_an_cdr_workaround) | ||
| 2726 | return; | ||
| 2727 | |||
| 2728 | if (!phy_data->phy_cdr_notrack) | ||
| 2729 | return; | ||
| 2730 | |||
| 2731 | usleep_range(phy_data->phy_cdr_delay, | ||
| 2732 | phy_data->phy_cdr_delay + 500); | ||
| 2733 | |||
| 2734 | XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_CDR_CONTROL, | ||
| 2735 | XGBE_PMA_CDR_TRACK_EN_MASK, | ||
| 2736 | XGBE_PMA_CDR_TRACK_EN_ON); | ||
| 2737 | |||
| 2738 | phy_data->phy_cdr_notrack = 0; | ||
| 2739 | } | ||
| 2740 | |||
| 2741 | static void xgbe_phy_cdr_notrack(struct xgbe_prv_data *pdata) | ||
| 2742 | { | ||
| 2743 | struct xgbe_phy_data *phy_data = pdata->phy_data; | ||
| 2744 | |||
| 2745 | if (!pdata->debugfs_an_cdr_workaround) | ||
| 2746 | return; | ||
| 2747 | |||
| 2748 | if (phy_data->phy_cdr_notrack) | ||
| 2749 | return; | ||
| 2750 | |||
| 2751 | XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_CDR_CONTROL, | ||
| 2752 | XGBE_PMA_CDR_TRACK_EN_MASK, | ||
| 2753 | XGBE_PMA_CDR_TRACK_EN_OFF); | ||
| 2754 | |||
| 2755 | xgbe_phy_rrc(pdata); | ||
| 2756 | |||
| 2757 | phy_data->phy_cdr_notrack = 1; | ||
| 2758 | } | ||
| 2759 | |||
| 2760 | static void xgbe_phy_kr_training_post(struct xgbe_prv_data *pdata) | ||
| 2761 | { | ||
| 2762 | if (!pdata->debugfs_an_cdr_track_early) | ||
| 2763 | xgbe_phy_cdr_track(pdata); | ||
| 2764 | } | ||
| 2765 | |||
| 2766 | static void xgbe_phy_kr_training_pre(struct xgbe_prv_data *pdata) | ||
| 2767 | { | ||
| 2768 | if (pdata->debugfs_an_cdr_track_early) | ||
| 2769 | xgbe_phy_cdr_track(pdata); | ||
| 2770 | } | ||
| 2771 | |||
| 2772 | static void xgbe_phy_an_post(struct xgbe_prv_data *pdata) | ||
| 2773 | { | ||
| 2774 | struct xgbe_phy_data *phy_data = pdata->phy_data; | ||
| 2775 | |||
| 2776 | switch (pdata->an_mode) { | ||
| 2777 | case XGBE_AN_MODE_CL73: | ||
| 2778 | case XGBE_AN_MODE_CL73_REDRV: | ||
| 2779 | if (phy_data->cur_mode != XGBE_MODE_KR) | ||
| 2780 | break; | ||
| 2781 | |||
| 2782 | xgbe_phy_cdr_track(pdata); | ||
| 2783 | |||
| 2784 | switch (pdata->an_result) { | ||
| 2785 | case XGBE_AN_READY: | ||
| 2786 | case XGBE_AN_COMPLETE: | ||
| 2787 | break; | ||
| 2788 | default: | ||
| 2789 | if (phy_data->phy_cdr_delay < XGBE_CDR_DELAY_MAX) | ||
| 2790 | phy_data->phy_cdr_delay += XGBE_CDR_DELAY_INC; | ||
| 2791 | else | ||
| 2792 | phy_data->phy_cdr_delay = XGBE_CDR_DELAY_INIT; | ||
| 2793 | break; | ||
| 2794 | } | ||
| 2795 | break; | ||
| 2796 | default: | ||
| 2797 | break; | ||
| 2798 | } | ||
| 2799 | } | ||
| 2800 | |||
| 2801 | static void xgbe_phy_an_pre(struct xgbe_prv_data *pdata) | ||
| 2802 | { | ||
| 2803 | struct xgbe_phy_data *phy_data = pdata->phy_data; | ||
| 2804 | |||
| 2805 | switch (pdata->an_mode) { | ||
| 2806 | case XGBE_AN_MODE_CL73: | ||
| 2807 | case XGBE_AN_MODE_CL73_REDRV: | ||
| 2808 | if (phy_data->cur_mode != XGBE_MODE_KR) | ||
| 2809 | break; | ||
| 2810 | |||
| 2811 | xgbe_phy_cdr_notrack(pdata); | ||
| 2812 | break; | ||
| 2813 | default: | ||
| 2814 | break; | ||
| 2815 | } | ||
| 2816 | } | ||
| 2817 | |||
| 2672 | static void xgbe_phy_stop(struct xgbe_prv_data *pdata) | 2818 | static void xgbe_phy_stop(struct xgbe_prv_data *pdata) |
| 2673 | { | 2819 | { |
| 2674 | struct xgbe_phy_data *phy_data = pdata->phy_data; | 2820 | struct xgbe_phy_data *phy_data = pdata->phy_data; |
| @@ -2680,6 +2826,9 @@ static void xgbe_phy_stop(struct xgbe_prv_data *pdata) | |||
| 2680 | xgbe_phy_sfp_reset(phy_data); | 2826 | xgbe_phy_sfp_reset(phy_data); |
| 2681 | xgbe_phy_sfp_mod_absent(pdata); | 2827 | xgbe_phy_sfp_mod_absent(pdata); |
| 2682 | 2828 | ||
| 2829 | /* Reset CDR support */ | ||
| 2830 | xgbe_phy_cdr_track(pdata); | ||
| 2831 | |||
| 2683 | /* Power off the PHY */ | 2832 | /* Power off the PHY */ |
| 2684 | xgbe_phy_power_off(pdata); | 2833 | xgbe_phy_power_off(pdata); |
| 2685 | 2834 | ||
| @@ -2712,6 +2861,9 @@ static int xgbe_phy_start(struct xgbe_prv_data *pdata) | |||
| 2712 | /* Start in highest supported mode */ | 2861 | /* Start in highest supported mode */ |
| 2713 | xgbe_phy_set_mode(pdata, phy_data->start_mode); | 2862 | xgbe_phy_set_mode(pdata, phy_data->start_mode); |
| 2714 | 2863 | ||
| 2864 | /* Reset CDR support */ | ||
| 2865 | xgbe_phy_cdr_track(pdata); | ||
| 2866 | |||
| 2715 | /* After starting the I2C controller, we can check for an SFP */ | 2867 | /* After starting the I2C controller, we can check for an SFP */ |
| 2716 | switch (phy_data->port_mode) { | 2868 | switch (phy_data->port_mode) { |
| 2717 | case XGBE_PORT_MODE_SFP: | 2869 | case XGBE_PORT_MODE_SFP: |
| @@ -3019,6 +3171,8 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) | |||
| 3019 | } | 3171 | } |
| 3020 | } | 3172 | } |
| 3021 | 3173 | ||
| 3174 | phy_data->phy_cdr_delay = XGBE_CDR_DELAY_INIT; | ||
| 3175 | |||
| 3022 | /* Register for driving external PHYs */ | 3176 | /* Register for driving external PHYs */ |
| 3023 | mii = devm_mdiobus_alloc(pdata->dev); | 3177 | mii = devm_mdiobus_alloc(pdata->dev); |
| 3024 | if (!mii) { | 3178 | if (!mii) { |
| @@ -3071,4 +3225,10 @@ void xgbe_init_function_ptrs_phy_v2(struct xgbe_phy_if *phy_if) | |||
| 3071 | phy_impl->an_advertising = xgbe_phy_an_advertising; | 3225 | phy_impl->an_advertising = xgbe_phy_an_advertising; |
| 3072 | 3226 | ||
| 3073 | phy_impl->an_outcome = xgbe_phy_an_outcome; | 3227 | phy_impl->an_outcome = xgbe_phy_an_outcome; |
| 3228 | |||
| 3229 | phy_impl->an_pre = xgbe_phy_an_pre; | ||
| 3230 | phy_impl->an_post = xgbe_phy_an_post; | ||
| 3231 | |||
| 3232 | phy_impl->kr_training_pre = xgbe_phy_kr_training_pre; | ||
| 3233 | phy_impl->kr_training_post = xgbe_phy_kr_training_post; | ||
| 3074 | } | 3234 | } |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h index ad102c8bac7b..95d4b56448c6 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h | |||
| @@ -833,6 +833,7 @@ struct xgbe_hw_if { | |||
| 833 | /* This structure represents implementation specific routines for an | 833 | /* This structure represents implementation specific routines for an |
| 834 | * implementation of a PHY. All routines are required unless noted below. | 834 | * implementation of a PHY. All routines are required unless noted below. |
| 835 | * Optional routines: | 835 | * Optional routines: |
| 836 | * an_pre, an_post | ||
| 836 | * kr_training_pre, kr_training_post | 837 | * kr_training_pre, kr_training_post |
| 837 | */ | 838 | */ |
| 838 | struct xgbe_phy_impl_if { | 839 | struct xgbe_phy_impl_if { |
| @@ -875,6 +876,10 @@ struct xgbe_phy_impl_if { | |||
| 875 | /* Process results of auto-negotiation */ | 876 | /* Process results of auto-negotiation */ |
| 876 | enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *); | 877 | enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *); |
| 877 | 878 | ||
| 879 | /* Pre/Post auto-negotiation support */ | ||
| 880 | void (*an_pre)(struct xgbe_prv_data *); | ||
| 881 | void (*an_post)(struct xgbe_prv_data *); | ||
| 882 | |||
| 878 | /* Pre/Post KR training enablement support */ | 883 | /* Pre/Post KR training enablement support */ |
| 879 | void (*kr_training_pre)(struct xgbe_prv_data *); | 884 | void (*kr_training_pre)(struct xgbe_prv_data *); |
| 880 | void (*kr_training_post)(struct xgbe_prv_data *); | 885 | void (*kr_training_post)(struct xgbe_prv_data *); |
| @@ -989,6 +994,7 @@ struct xgbe_version_data { | |||
| 989 | unsigned int irq_reissue_support; | 994 | unsigned int irq_reissue_support; |
| 990 | unsigned int tx_desc_prefetch; | 995 | unsigned int tx_desc_prefetch; |
| 991 | unsigned int rx_desc_prefetch; | 996 | unsigned int rx_desc_prefetch; |
| 997 | unsigned int an_cdr_workaround; | ||
| 992 | }; | 998 | }; |
| 993 | 999 | ||
| 994 | struct xgbe_vxlan_data { | 1000 | struct xgbe_vxlan_data { |
| @@ -1257,6 +1263,9 @@ struct xgbe_prv_data { | |||
| 1257 | unsigned int debugfs_xprop_reg; | 1263 | unsigned int debugfs_xprop_reg; |
| 1258 | 1264 | ||
| 1259 | unsigned int debugfs_xi2c_reg; | 1265 | unsigned int debugfs_xi2c_reg; |
| 1266 | |||
| 1267 | bool debugfs_an_cdr_workaround; | ||
| 1268 | bool debugfs_an_cdr_track_early; | ||
| 1260 | }; | 1269 | }; |
| 1261 | 1270 | ||
| 1262 | /* Function prototypes*/ | 1271 | /* Function prototypes*/ |
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 2df01ad98df7..6e8d6a6f6aaf 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c | |||
| @@ -1128,7 +1128,7 @@ static void clean_rx_pools(struct ibmvnic_adapter *adapter) | |||
| 1128 | if (!adapter->rx_pool) | 1128 | if (!adapter->rx_pool) |
| 1129 | return; | 1129 | return; |
| 1130 | 1130 | ||
| 1131 | rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs); | 1131 | rx_scrqs = adapter->num_active_rx_pools; |
| 1132 | rx_entries = adapter->req_rx_add_entries_per_subcrq; | 1132 | rx_entries = adapter->req_rx_add_entries_per_subcrq; |
| 1133 | 1133 | ||
| 1134 | /* Free any remaining skbs in the rx buffer pools */ | 1134 | /* Free any remaining skbs in the rx buffer pools */ |
| @@ -1177,7 +1177,7 @@ static void clean_tx_pools(struct ibmvnic_adapter *adapter) | |||
| 1177 | if (!adapter->tx_pool || !adapter->tso_pool) | 1177 | if (!adapter->tx_pool || !adapter->tso_pool) |
| 1178 | return; | 1178 | return; |
| 1179 | 1179 | ||
| 1180 | tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); | 1180 | tx_scrqs = adapter->num_active_tx_pools; |
| 1181 | 1181 | ||
| 1182 | /* Free any remaining skbs in the tx buffer pools */ | 1182 | /* Free any remaining skbs in the tx buffer pools */ |
| 1183 | for (i = 0; i < tx_scrqs; i++) { | 1183 | for (i = 0; i < tx_scrqs; i++) { |
diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h index 5b13ca1bd85f..7dc5f045e969 100644 --- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | |||
| @@ -586,7 +586,7 @@ struct ice_sw_rule_lg_act { | |||
| 586 | #define ICE_LG_ACT_MIRROR_VSI_ID_S 3 | 586 | #define ICE_LG_ACT_MIRROR_VSI_ID_S 3 |
| 587 | #define ICE_LG_ACT_MIRROR_VSI_ID_M (0x3FF << ICE_LG_ACT_MIRROR_VSI_ID_S) | 587 | #define ICE_LG_ACT_MIRROR_VSI_ID_M (0x3FF << ICE_LG_ACT_MIRROR_VSI_ID_S) |
| 588 | 588 | ||
| 589 | /* Action type = 5 - Large Action */ | 589 | /* Action type = 5 - Generic Value */ |
| 590 | #define ICE_LG_ACT_GENERIC 0x5 | 590 | #define ICE_LG_ACT_GENERIC 0x5 |
| 591 | #define ICE_LG_ACT_GENERIC_VALUE_S 3 | 591 | #define ICE_LG_ACT_GENERIC_VALUE_S 3 |
| 592 | #define ICE_LG_ACT_GENERIC_VALUE_M (0xFFFF << ICE_LG_ACT_GENERIC_VALUE_S) | 592 | #define ICE_LG_ACT_GENERIC_VALUE_M (0xFFFF << ICE_LG_ACT_GENERIC_VALUE_S) |
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 21977ec984c4..71d032cc5fa7 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c | |||
| @@ -78,6 +78,7 @@ ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size, | |||
| 78 | struct ice_aq_desc desc; | 78 | struct ice_aq_desc desc; |
| 79 | enum ice_status status; | 79 | enum ice_status status; |
| 80 | u16 flags; | 80 | u16 flags; |
| 81 | u8 i; | ||
| 81 | 82 | ||
| 82 | cmd = &desc.params.mac_read; | 83 | cmd = &desc.params.mac_read; |
| 83 | 84 | ||
| @@ -98,8 +99,16 @@ ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size, | |||
| 98 | return ICE_ERR_CFG; | 99 | return ICE_ERR_CFG; |
| 99 | } | 100 | } |
| 100 | 101 | ||
| 101 | ether_addr_copy(hw->port_info->mac.lan_addr, resp->mac_addr); | 102 | /* A single port can report up to two (LAN and WoL) addresses */ |
| 102 | ether_addr_copy(hw->port_info->mac.perm_addr, resp->mac_addr); | 103 | for (i = 0; i < cmd->num_addr; i++) |
| 104 | if (resp[i].addr_type == ICE_AQC_MAN_MAC_ADDR_TYPE_LAN) { | ||
| 105 | ether_addr_copy(hw->port_info->mac.lan_addr, | ||
| 106 | resp[i].mac_addr); | ||
| 107 | ether_addr_copy(hw->port_info->mac.perm_addr, | ||
| 108 | resp[i].mac_addr); | ||
| 109 | break; | ||
| 110 | } | ||
| 111 | |||
| 103 | return 0; | 112 | return 0; |
| 104 | } | 113 | } |
| 105 | 114 | ||
| @@ -464,9 +473,12 @@ enum ice_status ice_init_hw(struct ice_hw *hw) | |||
| 464 | if (status) | 473 | if (status) |
| 465 | goto err_unroll_sched; | 474 | goto err_unroll_sched; |
| 466 | 475 | ||
| 467 | /* Get port MAC information */ | 476 | /* Get MAC information */ |
| 468 | mac_buf_len = sizeof(struct ice_aqc_manage_mac_read_resp); | 477 | /* A single port can report up to two (LAN and WoL) addresses */ |
| 469 | mac_buf = devm_kzalloc(ice_hw_to_dev(hw), mac_buf_len, GFP_KERNEL); | 478 | mac_buf = devm_kcalloc(ice_hw_to_dev(hw), 2, |
| 479 | sizeof(struct ice_aqc_manage_mac_read_resp), | ||
| 480 | GFP_KERNEL); | ||
| 481 | mac_buf_len = 2 * sizeof(struct ice_aqc_manage_mac_read_resp); | ||
| 470 | 482 | ||
| 471 | if (!mac_buf) { | 483 | if (!mac_buf) { |
| 472 | status = ICE_ERR_NO_MEMORY; | 484 | status = ICE_ERR_NO_MEMORY; |
diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h index 1b9e2ef48a9d..499904874b3f 100644 --- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h +++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h | |||
| @@ -121,8 +121,6 @@ | |||
| 121 | #define PFINT_FW_CTL_CAUSE_ENA_S 30 | 121 | #define PFINT_FW_CTL_CAUSE_ENA_S 30 |
| 122 | #define PFINT_FW_CTL_CAUSE_ENA_M BIT(PFINT_FW_CTL_CAUSE_ENA_S) | 122 | #define PFINT_FW_CTL_CAUSE_ENA_M BIT(PFINT_FW_CTL_CAUSE_ENA_S) |
| 123 | #define PFINT_OICR 0x0016CA00 | 123 | #define PFINT_OICR 0x0016CA00 |
| 124 | #define PFINT_OICR_INTEVENT_S 0 | ||
| 125 | #define PFINT_OICR_INTEVENT_M BIT(PFINT_OICR_INTEVENT_S) | ||
| 126 | #define PFINT_OICR_HLP_RDY_S 14 | 124 | #define PFINT_OICR_HLP_RDY_S 14 |
| 127 | #define PFINT_OICR_HLP_RDY_M BIT(PFINT_OICR_HLP_RDY_S) | 125 | #define PFINT_OICR_HLP_RDY_M BIT(PFINT_OICR_HLP_RDY_S) |
| 128 | #define PFINT_OICR_CPM_RDY_S 15 | 126 | #define PFINT_OICR_CPM_RDY_S 15 |
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 210b7910f1cd..5299caf55a7f 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c | |||
| @@ -1722,9 +1722,6 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data) | |||
| 1722 | oicr = rd32(hw, PFINT_OICR); | 1722 | oicr = rd32(hw, PFINT_OICR); |
| 1723 | ena_mask = rd32(hw, PFINT_OICR_ENA); | 1723 | ena_mask = rd32(hw, PFINT_OICR_ENA); |
| 1724 | 1724 | ||
| 1725 | if (!(oicr & PFINT_OICR_INTEVENT_M)) | ||
| 1726 | goto ena_intr; | ||
| 1727 | |||
| 1728 | if (oicr & PFINT_OICR_GRST_M) { | 1725 | if (oicr & PFINT_OICR_GRST_M) { |
| 1729 | u32 reset; | 1726 | u32 reset; |
| 1730 | /* we have a reset warning */ | 1727 | /* we have a reset warning */ |
| @@ -1782,7 +1779,6 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data) | |||
| 1782 | } | 1779 | } |
| 1783 | ret = IRQ_HANDLED; | 1780 | ret = IRQ_HANDLED; |
| 1784 | 1781 | ||
| 1785 | ena_intr: | ||
| 1786 | /* re-enable interrupt causes that are not handled during this pass */ | 1782 | /* re-enable interrupt causes that are not handled during this pass */ |
| 1787 | wr32(hw, PFINT_OICR_ENA, ena_mask); | 1783 | wr32(hw, PFINT_OICR_ENA, ena_mask); |
| 1788 | if (!test_bit(__ICE_DOWN, pf->state)) { | 1784 | if (!test_bit(__ICE_DOWN, pf->state)) { |
diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c index f16ff3e4a840..2e6c1d92cc88 100644 --- a/drivers/net/ethernet/intel/ice/ice_sched.c +++ b/drivers/net/ethernet/intel/ice/ice_sched.c | |||
| @@ -751,14 +751,14 @@ ice_sched_add_nodes_to_layer(struct ice_port_info *pi, | |||
| 751 | u16 num_added = 0; | 751 | u16 num_added = 0; |
| 752 | u32 temp; | 752 | u32 temp; |
| 753 | 753 | ||
| 754 | *num_nodes_added = 0; | ||
| 755 | |||
| 754 | if (!num_nodes) | 756 | if (!num_nodes) |
| 755 | return status; | 757 | return status; |
| 756 | 758 | ||
| 757 | if (!parent || layer < hw->sw_entry_point_layer) | 759 | if (!parent || layer < hw->sw_entry_point_layer) |
| 758 | return ICE_ERR_PARAM; | 760 | return ICE_ERR_PARAM; |
| 759 | 761 | ||
| 760 | *num_nodes_added = 0; | ||
| 761 | |||
| 762 | /* max children per node per layer */ | 762 | /* max children per node per layer */ |
| 763 | max_child_nodes = | 763 | max_child_nodes = |
| 764 | le16_to_cpu(hw->layer_info[parent->tx_sched_layer].max_children); | 764 | le16_to_cpu(hw->layer_info[parent->tx_sched_layer].max_children); |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index c1c0bc30a16d..cce7ada89255 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
| @@ -1700,7 +1700,22 @@ static void igb_configure_cbs(struct igb_adapter *adapter, int queue, | |||
| 1700 | WARN_ON(hw->mac.type != e1000_i210); | 1700 | WARN_ON(hw->mac.type != e1000_i210); |
| 1701 | WARN_ON(queue < 0 || queue > 1); | 1701 | WARN_ON(queue < 0 || queue > 1); |
| 1702 | 1702 | ||
| 1703 | if (enable) { | 1703 | if (enable || queue == 0) { |
| 1704 | /* i210 does not allow the queue 0 to be in the Strict | ||
| 1705 | * Priority mode while the Qav mode is enabled, so, | ||
| 1706 | * instead of disabling strict priority mode, we give | ||
| 1707 | * queue 0 the maximum of credits possible. | ||
| 1708 | * | ||
| 1709 | * See section 8.12.19 of the i210 datasheet, "Note: | ||
| 1710 | * Queue0 QueueMode must be set to 1b when | ||
| 1711 | * TransmitMode is set to Qav." | ||
| 1712 | */ | ||
| 1713 | if (queue == 0 && !enable) { | ||
| 1714 | /* max "linkspeed" idleslope in kbps */ | ||
| 1715 | idleslope = 1000000; | ||
| 1716 | hicredit = ETH_FRAME_LEN; | ||
| 1717 | } | ||
| 1718 | |||
| 1704 | set_tx_desc_fetch_prio(hw, queue, TX_QUEUE_PRIO_HIGH); | 1719 | set_tx_desc_fetch_prio(hw, queue, TX_QUEUE_PRIO_HIGH); |
| 1705 | set_queue_mode(hw, queue, QUEUE_MODE_STREAM_RESERVATION); | 1720 | set_queue_mode(hw, queue, QUEUE_MODE_STREAM_RESERVATION); |
| 1706 | 1721 | ||
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 3d9033f26eff..e3d04f226d57 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
| @@ -3420,7 +3420,7 @@ static int ixgbevf_setup_all_tx_resources(struct ixgbevf_adapter *adapter) | |||
| 3420 | if (!err) | 3420 | if (!err) |
| 3421 | continue; | 3421 | continue; |
| 3422 | hw_dbg(&adapter->hw, "Allocation for XDP Queue %u failed\n", j); | 3422 | hw_dbg(&adapter->hw, "Allocation for XDP Queue %u failed\n", j); |
| 3423 | break; | 3423 | goto err_setup_tx; |
| 3424 | } | 3424 | } |
| 3425 | 3425 | ||
| 3426 | return 0; | 3426 | return 0; |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 83ce229f4eb7..63036d9bf3e6 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
| @@ -3999,29 +3999,6 @@ static void efx_ef10_prepare_flr(struct efx_nic *efx) | |||
| 3999 | atomic_set(&efx->active_queues, 0); | 3999 | atomic_set(&efx->active_queues, 0); |
| 4000 | } | 4000 | } |
| 4001 | 4001 | ||
| 4002 | static bool efx_ef10_filter_equal(const struct efx_filter_spec *left, | ||
| 4003 | const struct efx_filter_spec *right) | ||
| 4004 | { | ||
| 4005 | if ((left->match_flags ^ right->match_flags) | | ||
| 4006 | ((left->flags ^ right->flags) & | ||
| 4007 | (EFX_FILTER_FLAG_RX | EFX_FILTER_FLAG_TX))) | ||
| 4008 | return false; | ||
| 4009 | |||
| 4010 | return memcmp(&left->outer_vid, &right->outer_vid, | ||
| 4011 | sizeof(struct efx_filter_spec) - | ||
| 4012 | offsetof(struct efx_filter_spec, outer_vid)) == 0; | ||
| 4013 | } | ||
| 4014 | |||
| 4015 | static unsigned int efx_ef10_filter_hash(const struct efx_filter_spec *spec) | ||
| 4016 | { | ||
| 4017 | BUILD_BUG_ON(offsetof(struct efx_filter_spec, outer_vid) & 3); | ||
| 4018 | return jhash2((const u32 *)&spec->outer_vid, | ||
| 4019 | (sizeof(struct efx_filter_spec) - | ||
| 4020 | offsetof(struct efx_filter_spec, outer_vid)) / 4, | ||
| 4021 | 0); | ||
| 4022 | /* XXX should we randomise the initval? */ | ||
| 4023 | } | ||
| 4024 | |||
| 4025 | /* Decide whether a filter should be exclusive or else should allow | 4002 | /* Decide whether a filter should be exclusive or else should allow |
| 4026 | * delivery to additional recipients. Currently we decide that | 4003 | * delivery to additional recipients. Currently we decide that |
| 4027 | * filters for specific local unicast MAC and IP addresses are | 4004 | * filters for specific local unicast MAC and IP addresses are |
| @@ -4346,7 +4323,7 @@ static s32 efx_ef10_filter_insert(struct efx_nic *efx, | |||
| 4346 | goto out_unlock; | 4323 | goto out_unlock; |
| 4347 | match_pri = rc; | 4324 | match_pri = rc; |
| 4348 | 4325 | ||
| 4349 | hash = efx_ef10_filter_hash(spec); | 4326 | hash = efx_filter_spec_hash(spec); |
| 4350 | is_mc_recip = efx_filter_is_mc_recipient(spec); | 4327 | is_mc_recip = efx_filter_is_mc_recipient(spec); |
| 4351 | if (is_mc_recip) | 4328 | if (is_mc_recip) |
| 4352 | bitmap_zero(mc_rem_map, EFX_EF10_FILTER_SEARCH_LIMIT); | 4329 | bitmap_zero(mc_rem_map, EFX_EF10_FILTER_SEARCH_LIMIT); |
| @@ -4378,7 +4355,7 @@ static s32 efx_ef10_filter_insert(struct efx_nic *efx, | |||
| 4378 | if (!saved_spec) { | 4355 | if (!saved_spec) { |
| 4379 | if (ins_index < 0) | 4356 | if (ins_index < 0) |
| 4380 | ins_index = i; | 4357 | ins_index = i; |
| 4381 | } else if (efx_ef10_filter_equal(spec, saved_spec)) { | 4358 | } else if (efx_filter_spec_equal(spec, saved_spec)) { |
| 4382 | if (spec->priority < saved_spec->priority && | 4359 | if (spec->priority < saved_spec->priority && |
| 4383 | spec->priority != EFX_FILTER_PRI_AUTO) { | 4360 | spec->priority != EFX_FILTER_PRI_AUTO) { |
| 4384 | rc = -EPERM; | 4361 | rc = -EPERM; |
| @@ -4762,27 +4739,62 @@ static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx, | |||
| 4762 | static bool efx_ef10_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, | 4739 | static bool efx_ef10_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, |
| 4763 | unsigned int filter_idx) | 4740 | unsigned int filter_idx) |
| 4764 | { | 4741 | { |
| 4742 | struct efx_filter_spec *spec, saved_spec; | ||
| 4765 | struct efx_ef10_filter_table *table; | 4743 | struct efx_ef10_filter_table *table; |
| 4766 | struct efx_filter_spec *spec; | 4744 | struct efx_arfs_rule *rule = NULL; |
| 4767 | bool ret; | 4745 | bool ret = true, force = false; |
| 4746 | u16 arfs_id; | ||
| 4768 | 4747 | ||
| 4769 | down_read(&efx->filter_sem); | 4748 | down_read(&efx->filter_sem); |
| 4770 | table = efx->filter_state; | 4749 | table = efx->filter_state; |
| 4771 | down_write(&table->lock); | 4750 | down_write(&table->lock); |
| 4772 | spec = efx_ef10_filter_entry_spec(table, filter_idx); | 4751 | spec = efx_ef10_filter_entry_spec(table, filter_idx); |
| 4773 | 4752 | ||
| 4774 | if (!spec || spec->priority != EFX_FILTER_PRI_HINT) { | 4753 | if (!spec || spec->priority != EFX_FILTER_PRI_HINT) |
| 4775 | ret = true; | ||
| 4776 | goto out_unlock; | 4754 | goto out_unlock; |
| 4777 | } | ||
| 4778 | 4755 | ||
| 4779 | if (!rps_may_expire_flow(efx->net_dev, spec->dmaq_id, flow_id, 0)) { | 4756 | spin_lock_bh(&efx->rps_hash_lock); |
| 4780 | ret = false; | 4757 | if (!efx->rps_hash_table) { |
| 4781 | goto out_unlock; | 4758 | /* In the absence of the table, we always return 0 to ARFS. */ |
| 4759 | arfs_id = 0; | ||
| 4760 | } else { | ||
| 4761 | rule = efx_rps_hash_find(efx, spec); | ||
| 4762 | if (!rule) | ||
| 4763 | /* ARFS table doesn't know of this filter, so remove it */ | ||
| 4764 | goto expire; | ||
| 4765 | arfs_id = rule->arfs_id; | ||
| 4766 | ret = efx_rps_check_rule(rule, filter_idx, &force); | ||
| 4767 | if (force) | ||
| 4768 | goto expire; | ||
| 4769 | if (!ret) { | ||
| 4770 | spin_unlock_bh(&efx->rps_hash_lock); | ||
| 4771 | goto out_unlock; | ||
| 4772 | } | ||
| 4782 | } | 4773 | } |
| 4783 | 4774 | if (!rps_may_expire_flow(efx->net_dev, spec->dmaq_id, flow_id, arfs_id)) | |
| 4775 | ret = false; | ||
| 4776 | else if (rule) | ||
| 4777 | rule->filter_id = EFX_ARFS_FILTER_ID_REMOVING; | ||
| 4778 | expire: | ||
| 4779 | saved_spec = *spec; /* remove operation will kfree spec */ | ||
| 4780 | spin_unlock_bh(&efx->rps_hash_lock); | ||
| 4781 | /* At this point (since we dropped the lock), another thread might queue | ||
| 4782 | * up a fresh insertion request (but the actual insertion will be held | ||
| 4783 | * up by our possession of the filter table lock). In that case, it | ||
| 4784 | * will set rule->filter_id to EFX_ARFS_FILTER_ID_PENDING, meaning that | ||
| 4785 | * the rule is not removed by efx_rps_hash_del() below. | ||
| 4786 | */ | ||
| 4784 | ret = efx_ef10_filter_remove_internal(efx, 1U << spec->priority, | 4787 | ret = efx_ef10_filter_remove_internal(efx, 1U << spec->priority, |
| 4785 | filter_idx, true) == 0; | 4788 | filter_idx, true) == 0; |
| 4789 | /* While we can't safely dereference rule (we dropped the lock), we can | ||
| 4790 | * still test it for NULL. | ||
| 4791 | */ | ||
| 4792 | if (ret && rule) { | ||
| 4793 | /* Expiring, so remove entry from ARFS table */ | ||
| 4794 | spin_lock_bh(&efx->rps_hash_lock); | ||
| 4795 | efx_rps_hash_del(efx, &saved_spec); | ||
| 4796 | spin_unlock_bh(&efx->rps_hash_lock); | ||
| 4797 | } | ||
| 4786 | out_unlock: | 4798 | out_unlock: |
| 4787 | up_write(&table->lock); | 4799 | up_write(&table->lock); |
| 4788 | up_read(&efx->filter_sem); | 4800 | up_read(&efx->filter_sem); |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 692dd729ee2a..a4ebd8715494 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
| @@ -3027,6 +3027,10 @@ static int efx_init_struct(struct efx_nic *efx, | |||
| 3027 | mutex_init(&efx->mac_lock); | 3027 | mutex_init(&efx->mac_lock); |
| 3028 | #ifdef CONFIG_RFS_ACCEL | 3028 | #ifdef CONFIG_RFS_ACCEL |
| 3029 | mutex_init(&efx->rps_mutex); | 3029 | mutex_init(&efx->rps_mutex); |
| 3030 | spin_lock_init(&efx->rps_hash_lock); | ||
| 3031 | /* Failure to allocate is not fatal, but may degrade ARFS performance */ | ||
| 3032 | efx->rps_hash_table = kcalloc(EFX_ARFS_HASH_TABLE_SIZE, | ||
| 3033 | sizeof(*efx->rps_hash_table), GFP_KERNEL); | ||
| 3030 | #endif | 3034 | #endif |
| 3031 | efx->phy_op = &efx_dummy_phy_operations; | 3035 | efx->phy_op = &efx_dummy_phy_operations; |
| 3032 | efx->mdio.dev = net_dev; | 3036 | efx->mdio.dev = net_dev; |
| @@ -3070,6 +3074,10 @@ static void efx_fini_struct(struct efx_nic *efx) | |||
| 3070 | { | 3074 | { |
| 3071 | int i; | 3075 | int i; |
| 3072 | 3076 | ||
| 3077 | #ifdef CONFIG_RFS_ACCEL | ||
| 3078 | kfree(efx->rps_hash_table); | ||
| 3079 | #endif | ||
| 3080 | |||
| 3073 | for (i = 0; i < EFX_MAX_CHANNELS; i++) | 3081 | for (i = 0; i < EFX_MAX_CHANNELS; i++) |
| 3074 | kfree(efx->channel[i]); | 3082 | kfree(efx->channel[i]); |
| 3075 | 3083 | ||
| @@ -3092,6 +3100,141 @@ void efx_update_sw_stats(struct efx_nic *efx, u64 *stats) | |||
| 3092 | stats[GENERIC_STAT_rx_noskb_drops] = atomic_read(&efx->n_rx_noskb_drops); | 3100 | stats[GENERIC_STAT_rx_noskb_drops] = atomic_read(&efx->n_rx_noskb_drops); |
| 3093 | } | 3101 | } |
| 3094 | 3102 | ||
| 3103 | bool efx_filter_spec_equal(const struct efx_filter_spec *left, | ||
| 3104 | const struct efx_filter_spec *right) | ||
| 3105 | { | ||
| 3106 | if ((left->match_flags ^ right->match_flags) | | ||
| 3107 | ((left->flags ^ right->flags) & | ||
| 3108 | (EFX_FILTER_FLAG_RX | EFX_FILTER_FLAG_TX))) | ||
| 3109 | return false; | ||
| 3110 | |||
| 3111 | return memcmp(&left->outer_vid, &right->outer_vid, | ||
| 3112 | sizeof(struct efx_filter_spec) - | ||
| 3113 | offsetof(struct efx_filter_spec, outer_vid)) == 0; | ||
| 3114 | } | ||
| 3115 | |||
| 3116 | u32 efx_filter_spec_hash(const struct efx_filter_spec *spec) | ||
| 3117 | { | ||
| 3118 | BUILD_BUG_ON(offsetof(struct efx_filter_spec, outer_vid) & 3); | ||
| 3119 | return jhash2((const u32 *)&spec->outer_vid, | ||
| 3120 | (sizeof(struct efx_filter_spec) - | ||
| 3121 | offsetof(struct efx_filter_spec, outer_vid)) / 4, | ||
| 3122 | 0); | ||
| 3123 | } | ||
| 3124 | |||
| 3125 | #ifdef CONFIG_RFS_ACCEL | ||
| 3126 | bool efx_rps_check_rule(struct efx_arfs_rule *rule, unsigned int filter_idx, | ||
| 3127 | bool *force) | ||
| 3128 | { | ||
| 3129 | if (rule->filter_id == EFX_ARFS_FILTER_ID_PENDING) { | ||
| 3130 | /* ARFS is currently updating this entry, leave it */ | ||
| 3131 | return false; | ||
| 3132 | } | ||
| 3133 | if (rule->filter_id == EFX_ARFS_FILTER_ID_ERROR) { | ||
| 3134 | /* ARFS tried and failed to update this, so it's probably out | ||
| 3135 | * of date. Remove the filter and the ARFS rule entry. | ||
| 3136 | */ | ||
| 3137 | rule->filter_id = EFX_ARFS_FILTER_ID_REMOVING; | ||
| 3138 | *force = true; | ||
| 3139 | return true; | ||
| 3140 | } else if (WARN_ON(rule->filter_id != filter_idx)) { /* can't happen */ | ||
| 3141 | /* ARFS has moved on, so old filter is not needed. Since we did | ||
| 3142 | * not mark the rule with EFX_ARFS_FILTER_ID_REMOVING, it will | ||
| 3143 | * not be removed by efx_rps_hash_del() subsequently. | ||
| 3144 | */ | ||
| 3145 | *force = true; | ||
| 3146 | return true; | ||
| 3147 | } | ||
| 3148 | /* Remove it iff ARFS wants to. */ | ||
| 3149 | return true; | ||
| 3150 | } | ||
| 3151 | |||
| 3152 | struct hlist_head *efx_rps_hash_bucket(struct efx_nic *efx, | ||
| 3153 | const struct efx_filter_spec *spec) | ||
| 3154 | { | ||
| 3155 | u32 hash = efx_filter_spec_hash(spec); | ||
| 3156 | |||
| 3157 | WARN_ON(!spin_is_locked(&efx->rps_hash_lock)); | ||
| 3158 | if (!efx->rps_hash_table) | ||
| 3159 | return NULL; | ||
| 3160 | return &efx->rps_hash_table[hash % EFX_ARFS_HASH_TABLE_SIZE]; | ||
| 3161 | } | ||
| 3162 | |||
| 3163 | struct efx_arfs_rule *efx_rps_hash_find(struct efx_nic *efx, | ||
| 3164 | const struct efx_filter_spec *spec) | ||
| 3165 | { | ||
| 3166 | struct efx_arfs_rule *rule; | ||
| 3167 | struct hlist_head *head; | ||
| 3168 | struct hlist_node *node; | ||
| 3169 | |||
| 3170 | head = efx_rps_hash_bucket(efx, spec); | ||
| 3171 | if (!head) | ||
| 3172 | return NULL; | ||
| 3173 | hlist_for_each(node, head) { | ||
| 3174 | rule = container_of(node, struct efx_arfs_rule, node); | ||
| 3175 | if (efx_filter_spec_equal(spec, &rule->spec)) | ||
| 3176 | return rule; | ||
| 3177 | } | ||
| 3178 | return NULL; | ||
| 3179 | } | ||
| 3180 | |||
| 3181 | struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, | ||
| 3182 | const struct efx_filter_spec *spec, | ||
| 3183 | bool *new) | ||
| 3184 | { | ||
| 3185 | struct efx_arfs_rule *rule; | ||
| 3186 | struct hlist_head *head; | ||
| 3187 | struct hlist_node *node; | ||
| 3188 | |||
| 3189 | head = efx_rps_hash_bucket(efx, spec); | ||
| 3190 | if (!head) | ||
| 3191 | return NULL; | ||
| 3192 | hlist_for_each(node, head) { | ||
| 3193 | rule = container_of(node, struct efx_arfs_rule, node); | ||
| 3194 | if (efx_filter_spec_equal(spec, &rule->spec)) { | ||
| 3195 | *new = false; | ||
| 3196 | return rule; | ||
| 3197 | } | ||
| 3198 | } | ||
| 3199 | rule = kmalloc(sizeof(*rule), GFP_ATOMIC); | ||
| 3200 | *new = true; | ||
| 3201 | if (rule) { | ||
| 3202 | memcpy(&rule->spec, spec, sizeof(rule->spec)); | ||
| 3203 | hlist_add_head(&rule->node, head); | ||
| 3204 | } | ||
| 3205 | return rule; | ||
| 3206 | } | ||
| 3207 | |||
| 3208 | void efx_rps_hash_del(struct efx_nic *efx, const struct efx_filter_spec *spec) | ||
| 3209 | { | ||
| 3210 | struct efx_arfs_rule *rule; | ||
| 3211 | struct hlist_head *head; | ||
| 3212 | struct hlist_node *node; | ||
| 3213 | |||
| 3214 | head = efx_rps_hash_bucket(efx, spec); | ||
| 3215 | if (WARN_ON(!head)) | ||
| 3216 | return; | ||
| 3217 | hlist_for_each(node, head) { | ||
| 3218 | rule = container_of(node, struct efx_arfs_rule, node); | ||
| 3219 | if (efx_filter_spec_equal(spec, &rule->spec)) { | ||
| 3220 | /* Someone already reused the entry. We know that if | ||
| 3221 | * this check doesn't fire (i.e. filter_id == REMOVING) | ||
| 3222 | * then the REMOVING mark was put there by our caller, | ||
| 3223 | * because caller is holding a lock on filter table and | ||
| 3224 | * only holders of that lock set REMOVING. | ||
| 3225 | */ | ||
| 3226 | if (rule->filter_id != EFX_ARFS_FILTER_ID_REMOVING) | ||
| 3227 | return; | ||
| 3228 | hlist_del(node); | ||
| 3229 | kfree(rule); | ||
| 3230 | return; | ||
| 3231 | } | ||
| 3232 | } | ||
| 3233 | /* We didn't find it. */ | ||
| 3234 | WARN_ON(1); | ||
| 3235 | } | ||
| 3236 | #endif | ||
| 3237 | |||
| 3095 | /* RSS contexts. We're using linked lists and crappy O(n) algorithms, because | 3238 | /* RSS contexts. We're using linked lists and crappy O(n) algorithms, because |
| 3096 | * (a) this is an infrequent control-plane operation and (b) n is small (max 64) | 3239 | * (a) this is an infrequent control-plane operation and (b) n is small (max 64) |
| 3097 | */ | 3240 | */ |
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h index a3140e16fcef..3f759ebdcf10 100644 --- a/drivers/net/ethernet/sfc/efx.h +++ b/drivers/net/ethernet/sfc/efx.h | |||
| @@ -186,6 +186,27 @@ static inline void efx_filter_rfs_expire(struct work_struct *data) {} | |||
| 186 | #endif | 186 | #endif |
| 187 | bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec); | 187 | bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec); |
| 188 | 188 | ||
| 189 | bool efx_filter_spec_equal(const struct efx_filter_spec *left, | ||
| 190 | const struct efx_filter_spec *right); | ||
| 191 | u32 efx_filter_spec_hash(const struct efx_filter_spec *spec); | ||
| 192 | |||
| 193 | #ifdef CONFIG_RFS_ACCEL | ||
| 194 | bool efx_rps_check_rule(struct efx_arfs_rule *rule, unsigned int filter_idx, | ||
| 195 | bool *force); | ||
| 196 | |||
| 197 | struct efx_arfs_rule *efx_rps_hash_find(struct efx_nic *efx, | ||
| 198 | const struct efx_filter_spec *spec); | ||
| 199 | |||
| 200 | /* @new is written to indicate if entry was newly added (true) or if an old | ||
| 201 | * entry was found and returned (false). | ||
| 202 | */ | ||
| 203 | struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, | ||
| 204 | const struct efx_filter_spec *spec, | ||
| 205 | bool *new); | ||
| 206 | |||
| 207 | void efx_rps_hash_del(struct efx_nic *efx, const struct efx_filter_spec *spec); | ||
| 208 | #endif | ||
| 209 | |||
| 189 | /* RSS contexts */ | 210 | /* RSS contexts */ |
| 190 | struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx); | 211 | struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx); |
| 191 | struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id); | 212 | struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id); |
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index 7174ef5e5c5e..c72adf8b52ea 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c | |||
| @@ -2905,18 +2905,45 @@ bool efx_farch_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id, | |||
| 2905 | { | 2905 | { |
| 2906 | struct efx_farch_filter_state *state = efx->filter_state; | 2906 | struct efx_farch_filter_state *state = efx->filter_state; |
| 2907 | struct efx_farch_filter_table *table; | 2907 | struct efx_farch_filter_table *table; |
| 2908 | bool ret = false; | 2908 | bool ret = false, force = false; |
| 2909 | u16 arfs_id; | ||
| 2909 | 2910 | ||
| 2910 | down_write(&state->lock); | 2911 | down_write(&state->lock); |
| 2912 | spin_lock_bh(&efx->rps_hash_lock); | ||
| 2911 | table = &state->table[EFX_FARCH_FILTER_TABLE_RX_IP]; | 2913 | table = &state->table[EFX_FARCH_FILTER_TABLE_RX_IP]; |
| 2912 | if (test_bit(index, table->used_bitmap) && | 2914 | if (test_bit(index, table->used_bitmap) && |
| 2913 | table->spec[index].priority == EFX_FILTER_PRI_HINT && | 2915 | table->spec[index].priority == EFX_FILTER_PRI_HINT) { |
| 2914 | rps_may_expire_flow(efx->net_dev, table->spec[index].dmaq_id, | 2916 | struct efx_arfs_rule *rule = NULL; |
| 2915 | flow_id, 0)) { | 2917 | struct efx_filter_spec spec; |
| 2916 | efx_farch_filter_table_clear_entry(efx, table, index); | 2918 | |
| 2917 | ret = true; | 2919 | efx_farch_filter_to_gen_spec(&spec, &table->spec[index]); |
| 2920 | if (!efx->rps_hash_table) { | ||
| 2921 | /* In the absence of the table, we always returned 0 to | ||
| 2922 | * ARFS, so use the same to query it. | ||
| 2923 | */ | ||
| 2924 | arfs_id = 0; | ||
| 2925 | } else { | ||
| 2926 | rule = efx_rps_hash_find(efx, &spec); | ||
| 2927 | if (!rule) { | ||
| 2928 | /* ARFS table doesn't know of this filter, remove it */ | ||
| 2929 | force = true; | ||
| 2930 | } else { | ||
| 2931 | arfs_id = rule->arfs_id; | ||
| 2932 | if (!efx_rps_check_rule(rule, index, &force)) | ||
| 2933 | goto out_unlock; | ||
| 2934 | } | ||
| 2935 | } | ||
| 2936 | if (force || rps_may_expire_flow(efx->net_dev, spec.dmaq_id, | ||
| 2937 | flow_id, arfs_id)) { | ||
| 2938 | if (rule) | ||
| 2939 | rule->filter_id = EFX_ARFS_FILTER_ID_REMOVING; | ||
| 2940 | efx_rps_hash_del(efx, &spec); | ||
| 2941 | efx_farch_filter_table_clear_entry(efx, table, index); | ||
| 2942 | ret = true; | ||
| 2943 | } | ||
| 2918 | } | 2944 | } |
| 2919 | 2945 | out_unlock: | |
| 2946 | spin_unlock_bh(&efx->rps_hash_lock); | ||
| 2920 | up_write(&state->lock); | 2947 | up_write(&state->lock); |
| 2921 | return ret; | 2948 | return ret; |
| 2922 | } | 2949 | } |
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index eea3808b3f25..65568925c3ef 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
| @@ -734,6 +734,35 @@ struct efx_rss_context { | |||
| 734 | }; | 734 | }; |
| 735 | 735 | ||
| 736 | #ifdef CONFIG_RFS_ACCEL | 736 | #ifdef CONFIG_RFS_ACCEL |
| 737 | /* Order of these is important, since filter_id >= %EFX_ARFS_FILTER_ID_PENDING | ||
| 738 | * is used to test if filter does or will exist. | ||
| 739 | */ | ||
| 740 | #define EFX_ARFS_FILTER_ID_PENDING -1 | ||
| 741 | #define EFX_ARFS_FILTER_ID_ERROR -2 | ||
| 742 | #define EFX_ARFS_FILTER_ID_REMOVING -3 | ||
| 743 | /** | ||
| 744 | * struct efx_arfs_rule - record of an ARFS filter and its IDs | ||
| 745 | * @node: linkage into hash table | ||
| 746 | * @spec: details of the filter (used as key for hash table). Use efx->type to | ||
| 747 | * determine which member to use. | ||
| 748 | * @rxq_index: channel to which the filter will steer traffic. | ||
| 749 | * @arfs_id: filter ID which was returned to ARFS | ||
| 750 | * @filter_id: index in software filter table. May be | ||
| 751 | * %EFX_ARFS_FILTER_ID_PENDING if filter was not inserted yet, | ||
| 752 | * %EFX_ARFS_FILTER_ID_ERROR if filter insertion failed, or | ||
| 753 | * %EFX_ARFS_FILTER_ID_REMOVING if expiry is currently removing the filter. | ||
| 754 | */ | ||
| 755 | struct efx_arfs_rule { | ||
| 756 | struct hlist_node node; | ||
| 757 | struct efx_filter_spec spec; | ||
| 758 | u16 rxq_index; | ||
| 759 | u16 arfs_id; | ||
| 760 | s32 filter_id; | ||
| 761 | }; | ||
| 762 | |||
| 763 | /* Size chosen so that the table is one page (4kB) */ | ||
| 764 | #define EFX_ARFS_HASH_TABLE_SIZE 512 | ||
| 765 | |||
| 737 | /** | 766 | /** |
| 738 | * struct efx_async_filter_insertion - Request to asynchronously insert a filter | 767 | * struct efx_async_filter_insertion - Request to asynchronously insert a filter |
| 739 | * @net_dev: Reference to the netdevice | 768 | * @net_dev: Reference to the netdevice |
| @@ -873,6 +902,10 @@ struct efx_async_filter_insertion { | |||
| 873 | * @rps_expire_channel's @rps_flow_id | 902 | * @rps_expire_channel's @rps_flow_id |
| 874 | * @rps_slot_map: bitmap of in-flight entries in @rps_slot | 903 | * @rps_slot_map: bitmap of in-flight entries in @rps_slot |
| 875 | * @rps_slot: array of ARFS insertion requests for efx_filter_rfs_work() | 904 | * @rps_slot: array of ARFS insertion requests for efx_filter_rfs_work() |
| 905 | * @rps_hash_lock: Protects ARFS filter mapping state (@rps_hash_table and | ||
| 906 | * @rps_next_id). | ||
| 907 | * @rps_hash_table: Mapping between ARFS filters and their various IDs | ||
| 908 | * @rps_next_id: next arfs_id for an ARFS filter | ||
| 876 | * @active_queues: Count of RX and TX queues that haven't been flushed and drained. | 909 | * @active_queues: Count of RX and TX queues that haven't been flushed and drained. |
| 877 | * @rxq_flush_pending: Count of number of receive queues that need to be flushed. | 910 | * @rxq_flush_pending: Count of number of receive queues that need to be flushed. |
| 878 | * Decremented when the efx_flush_rx_queue() is called. | 911 | * Decremented when the efx_flush_rx_queue() is called. |
| @@ -1029,6 +1062,9 @@ struct efx_nic { | |||
| 1029 | unsigned int rps_expire_index; | 1062 | unsigned int rps_expire_index; |
| 1030 | unsigned long rps_slot_map; | 1063 | unsigned long rps_slot_map; |
| 1031 | struct efx_async_filter_insertion rps_slot[EFX_RPS_MAX_IN_FLIGHT]; | 1064 | struct efx_async_filter_insertion rps_slot[EFX_RPS_MAX_IN_FLIGHT]; |
| 1065 | spinlock_t rps_hash_lock; | ||
| 1066 | struct hlist_head *rps_hash_table; | ||
| 1067 | u32 rps_next_id; | ||
| 1032 | #endif | 1068 | #endif |
| 1033 | 1069 | ||
| 1034 | atomic_t active_queues; | 1070 | atomic_t active_queues; |
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 9c593c661cbf..64a94f242027 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c | |||
| @@ -834,9 +834,29 @@ static void efx_filter_rfs_work(struct work_struct *data) | |||
| 834 | struct efx_nic *efx = netdev_priv(req->net_dev); | 834 | struct efx_nic *efx = netdev_priv(req->net_dev); |
| 835 | struct efx_channel *channel = efx_get_channel(efx, req->rxq_index); | 835 | struct efx_channel *channel = efx_get_channel(efx, req->rxq_index); |
| 836 | int slot_idx = req - efx->rps_slot; | 836 | int slot_idx = req - efx->rps_slot; |
| 837 | struct efx_arfs_rule *rule; | ||
| 838 | u16 arfs_id = 0; | ||
| 837 | int rc; | 839 | int rc; |
| 838 | 840 | ||
| 839 | rc = efx->type->filter_insert(efx, &req->spec, true); | 841 | rc = efx->type->filter_insert(efx, &req->spec, true); |
| 842 | if (efx->rps_hash_table) { | ||
| 843 | spin_lock_bh(&efx->rps_hash_lock); | ||
| 844 | rule = efx_rps_hash_find(efx, &req->spec); | ||
| 845 | /* The rule might have already gone, if someone else's request | ||
| 846 | * for the same spec was already worked and then expired before | ||
| 847 | * we got around to our work. In that case we have nothing | ||
| 848 | * tying us to an arfs_id, meaning that as soon as the filter | ||
| 849 | * is considered for expiry it will be removed. | ||
| 850 | */ | ||
| 851 | if (rule) { | ||
| 852 | if (rc < 0) | ||
| 853 | rule->filter_id = EFX_ARFS_FILTER_ID_ERROR; | ||
| 854 | else | ||
| 855 | rule->filter_id = rc; | ||
| 856 | arfs_id = rule->arfs_id; | ||
| 857 | } | ||
| 858 | spin_unlock_bh(&efx->rps_hash_lock); | ||
| 859 | } | ||
| 840 | if (rc >= 0) { | 860 | if (rc >= 0) { |
| 841 | /* Remember this so we can check whether to expire the filter | 861 | /* Remember this so we can check whether to expire the filter |
| 842 | * later. | 862 | * later. |
| @@ -848,18 +868,18 @@ static void efx_filter_rfs_work(struct work_struct *data) | |||
| 848 | 868 | ||
| 849 | if (req->spec.ether_type == htons(ETH_P_IP)) | 869 | if (req->spec.ether_type == htons(ETH_P_IP)) |
| 850 | netif_info(efx, rx_status, efx->net_dev, | 870 | netif_info(efx, rx_status, efx->net_dev, |
| 851 | "steering %s %pI4:%u:%pI4:%u to queue %u [flow %u filter %d]\n", | 871 | "steering %s %pI4:%u:%pI4:%u to queue %u [flow %u filter %d id %u]\n", |
| 852 | (req->spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", | 872 | (req->spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", |
| 853 | req->spec.rem_host, ntohs(req->spec.rem_port), | 873 | req->spec.rem_host, ntohs(req->spec.rem_port), |
| 854 | req->spec.loc_host, ntohs(req->spec.loc_port), | 874 | req->spec.loc_host, ntohs(req->spec.loc_port), |
| 855 | req->rxq_index, req->flow_id, rc); | 875 | req->rxq_index, req->flow_id, rc, arfs_id); |
| 856 | else | 876 | else |
| 857 | netif_info(efx, rx_status, efx->net_dev, | 877 | netif_info(efx, rx_status, efx->net_dev, |
| 858 | "steering %s [%pI6]:%u:[%pI6]:%u to queue %u [flow %u filter %d]\n", | 878 | "steering %s [%pI6]:%u:[%pI6]:%u to queue %u [flow %u filter %d id %u]\n", |
| 859 | (req->spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", | 879 | (req->spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", |
| 860 | req->spec.rem_host, ntohs(req->spec.rem_port), | 880 | req->spec.rem_host, ntohs(req->spec.rem_port), |
| 861 | req->spec.loc_host, ntohs(req->spec.loc_port), | 881 | req->spec.loc_host, ntohs(req->spec.loc_port), |
| 862 | req->rxq_index, req->flow_id, rc); | 882 | req->rxq_index, req->flow_id, rc, arfs_id); |
| 863 | } | 883 | } |
| 864 | 884 | ||
| 865 | /* Release references */ | 885 | /* Release references */ |
| @@ -872,8 +892,10 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, | |||
| 872 | { | 892 | { |
| 873 | struct efx_nic *efx = netdev_priv(net_dev); | 893 | struct efx_nic *efx = netdev_priv(net_dev); |
| 874 | struct efx_async_filter_insertion *req; | 894 | struct efx_async_filter_insertion *req; |
| 895 | struct efx_arfs_rule *rule; | ||
| 875 | struct flow_keys fk; | 896 | struct flow_keys fk; |
| 876 | int slot_idx; | 897 | int slot_idx; |
| 898 | bool new; | ||
| 877 | int rc; | 899 | int rc; |
| 878 | 900 | ||
| 879 | /* find a free slot */ | 901 | /* find a free slot */ |
| @@ -926,12 +948,42 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, | |||
| 926 | req->spec.rem_port = fk.ports.src; | 948 | req->spec.rem_port = fk.ports.src; |
| 927 | req->spec.loc_port = fk.ports.dst; | 949 | req->spec.loc_port = fk.ports.dst; |
| 928 | 950 | ||
| 951 | if (efx->rps_hash_table) { | ||
| 952 | /* Add it to ARFS hash table */ | ||
| 953 | spin_lock(&efx->rps_hash_lock); | ||
| 954 | rule = efx_rps_hash_add(efx, &req->spec, &new); | ||
| 955 | if (!rule) { | ||
| 956 | rc = -ENOMEM; | ||
| 957 | goto out_unlock; | ||
| 958 | } | ||
| 959 | if (new) | ||
| 960 | rule->arfs_id = efx->rps_next_id++ % RPS_NO_FILTER; | ||
| 961 | rc = rule->arfs_id; | ||
| 962 | /* Skip if existing or pending filter already does the right thing */ | ||
| 963 | if (!new && rule->rxq_index == rxq_index && | ||
| 964 | rule->filter_id >= EFX_ARFS_FILTER_ID_PENDING) | ||
| 965 | goto out_unlock; | ||
| 966 | rule->rxq_index = rxq_index; | ||
| 967 | rule->filter_id = EFX_ARFS_FILTER_ID_PENDING; | ||
| 968 | spin_unlock(&efx->rps_hash_lock); | ||
| 969 | } else { | ||
| 970 | /* Without an ARFS hash table, we just use arfs_id 0 for all | ||
| 971 | * filters. This means if multiple flows hash to the same | ||
| 972 | * flow_id, all but the most recently touched will be eligible | ||
| 973 | * for expiry. | ||
| 974 | */ | ||
| 975 | rc = 0; | ||
| 976 | } | ||
| 977 | |||
| 978 | /* Queue the request */ | ||
| 929 | dev_hold(req->net_dev = net_dev); | 979 | dev_hold(req->net_dev = net_dev); |
| 930 | INIT_WORK(&req->work, efx_filter_rfs_work); | 980 | INIT_WORK(&req->work, efx_filter_rfs_work); |
| 931 | req->rxq_index = rxq_index; | 981 | req->rxq_index = rxq_index; |
| 932 | req->flow_id = flow_id; | 982 | req->flow_id = flow_id; |
| 933 | schedule_work(&req->work); | 983 | schedule_work(&req->work); |
| 934 | return 0; | 984 | return rc; |
| 985 | out_unlock: | ||
| 986 | spin_unlock(&efx->rps_hash_lock); | ||
| 935 | out_clear: | 987 | out_clear: |
| 936 | clear_bit(slot_idx, &efx->rps_slot_map); | 988 | clear_bit(slot_idx, &efx->rps_slot_map); |
| 937 | return rc; | 989 | return rc; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 30371274409d..74f828412055 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
| @@ -129,7 +129,7 @@ do { \ | |||
| 129 | 129 | ||
| 130 | #define RX_PRIORITY_MAPPING 0x76543210 | 130 | #define RX_PRIORITY_MAPPING 0x76543210 |
| 131 | #define TX_PRIORITY_MAPPING 0x33221100 | 131 | #define TX_PRIORITY_MAPPING 0x33221100 |
| 132 | #define CPDMA_TX_PRIORITY_MAP 0x01234567 | 132 | #define CPDMA_TX_PRIORITY_MAP 0x76543210 |
| 133 | 133 | ||
| 134 | #define CPSW_VLAN_AWARE BIT(1) | 134 | #define CPSW_VLAN_AWARE BIT(1) |
| 135 | #define CPSW_RX_VLAN_ENCAP BIT(2) | 135 | #define CPSW_RX_VLAN_ENCAP BIT(2) |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index c22e8e383247..25e2a099b71c 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -1393,6 +1393,15 @@ static int m88e1318_set_wol(struct phy_device *phydev, | |||
| 1393 | if (err < 0) | 1393 | if (err < 0) |
| 1394 | goto error; | 1394 | goto error; |
| 1395 | 1395 | ||
| 1396 | /* If WOL event happened once, the LED[2] interrupt pin | ||
| 1397 | * will not be cleared unless we reading the interrupt status | ||
| 1398 | * register. If interrupts are in use, the normal interrupt | ||
| 1399 | * handling will clear the WOL event. Clear the WOL event | ||
| 1400 | * before enabling it if !phy_interrupt_is_valid() | ||
| 1401 | */ | ||
| 1402 | if (!phy_interrupt_is_valid(phydev)) | ||
| 1403 | phy_read(phydev, MII_M1011_IEVENT); | ||
| 1404 | |||
| 1396 | /* Enable the WOL interrupt */ | 1405 | /* Enable the WOL interrupt */ |
| 1397 | err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0, | 1406 | err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0, |
| 1398 | MII_88E1318S_PHY_CSIER_WOL_EIE); | 1407 | MII_88E1318S_PHY_CSIER_WOL_EIE); |
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 1483bc7b01e1..7df07337d69c 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
| @@ -620,6 +620,10 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
| 620 | lock_sock(sk); | 620 | lock_sock(sk); |
| 621 | 621 | ||
| 622 | error = -EINVAL; | 622 | error = -EINVAL; |
| 623 | |||
| 624 | if (sockaddr_len != sizeof(struct sockaddr_pppox)) | ||
| 625 | goto end; | ||
| 626 | |||
| 623 | if (sp->sa_protocol != PX_PROTO_OE) | 627 | if (sp->sa_protocol != PX_PROTO_OE) |
| 624 | goto end; | 628 | goto end; |
| 625 | 629 | ||
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index acbe84967834..ddb6bf85a59c 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
| @@ -1072,14 +1072,11 @@ static void team_port_leave(struct team *team, struct team_port *port) | |||
| 1072 | } | 1072 | } |
| 1073 | 1073 | ||
| 1074 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1074 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 1075 | static int team_port_enable_netpoll(struct team *team, struct team_port *port) | 1075 | static int __team_port_enable_netpoll(struct team_port *port) |
| 1076 | { | 1076 | { |
| 1077 | struct netpoll *np; | 1077 | struct netpoll *np; |
| 1078 | int err; | 1078 | int err; |
| 1079 | 1079 | ||
| 1080 | if (!team->dev->npinfo) | ||
| 1081 | return 0; | ||
| 1082 | |||
| 1083 | np = kzalloc(sizeof(*np), GFP_KERNEL); | 1080 | np = kzalloc(sizeof(*np), GFP_KERNEL); |
| 1084 | if (!np) | 1081 | if (!np) |
| 1085 | return -ENOMEM; | 1082 | return -ENOMEM; |
| @@ -1093,6 +1090,14 @@ static int team_port_enable_netpoll(struct team *team, struct team_port *port) | |||
| 1093 | return err; | 1090 | return err; |
| 1094 | } | 1091 | } |
| 1095 | 1092 | ||
| 1093 | static int team_port_enable_netpoll(struct team_port *port) | ||
| 1094 | { | ||
| 1095 | if (!port->team->dev->npinfo) | ||
| 1096 | return 0; | ||
| 1097 | |||
| 1098 | return __team_port_enable_netpoll(port); | ||
| 1099 | } | ||
| 1100 | |||
| 1096 | static void team_port_disable_netpoll(struct team_port *port) | 1101 | static void team_port_disable_netpoll(struct team_port *port) |
| 1097 | { | 1102 | { |
| 1098 | struct netpoll *np = port->np; | 1103 | struct netpoll *np = port->np; |
| @@ -1107,7 +1112,7 @@ static void team_port_disable_netpoll(struct team_port *port) | |||
| 1107 | kfree(np); | 1112 | kfree(np); |
| 1108 | } | 1113 | } |
| 1109 | #else | 1114 | #else |
| 1110 | static int team_port_enable_netpoll(struct team *team, struct team_port *port) | 1115 | static int team_port_enable_netpoll(struct team_port *port) |
| 1111 | { | 1116 | { |
| 1112 | return 0; | 1117 | return 0; |
| 1113 | } | 1118 | } |
| @@ -1221,7 +1226,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev, | |||
| 1221 | goto err_vids_add; | 1226 | goto err_vids_add; |
| 1222 | } | 1227 | } |
| 1223 | 1228 | ||
| 1224 | err = team_port_enable_netpoll(team, port); | 1229 | err = team_port_enable_netpoll(port); |
| 1225 | if (err) { | 1230 | if (err) { |
| 1226 | netdev_err(dev, "Failed to enable netpoll on device %s\n", | 1231 | netdev_err(dev, "Failed to enable netpoll on device %s\n", |
| 1227 | portname); | 1232 | portname); |
| @@ -1918,7 +1923,7 @@ static int team_netpoll_setup(struct net_device *dev, | |||
| 1918 | 1923 | ||
| 1919 | mutex_lock(&team->lock); | 1924 | mutex_lock(&team->lock); |
| 1920 | list_for_each_entry(port, &team->port_list, list) { | 1925 | list_for_each_entry(port, &team->port_list, list) { |
| 1921 | err = team_port_enable_netpoll(team, port); | 1926 | err = __team_port_enable_netpoll(port); |
| 1922 | if (err) { | 1927 | if (err) { |
| 1923 | __team_netpoll_cleanup(team); | 1928 | __team_netpoll_cleanup(team); |
| 1924 | break; | 1929 | break; |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 84aa9d676375..6da20b9688f7 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
| @@ -942,7 +942,7 @@ int __init early_init_dt_scan_chosen_stdout(void) | |||
| 942 | int offset; | 942 | int offset; |
| 943 | const char *p, *q, *options = NULL; | 943 | const char *p, *q, *options = NULL; |
| 944 | int l; | 944 | int l; |
| 945 | const struct earlycon_id *match; | 945 | const struct earlycon_id **p_match; |
| 946 | const void *fdt = initial_boot_params; | 946 | const void *fdt = initial_boot_params; |
| 947 | 947 | ||
| 948 | offset = fdt_path_offset(fdt, "/chosen"); | 948 | offset = fdt_path_offset(fdt, "/chosen"); |
| @@ -969,7 +969,10 @@ int __init early_init_dt_scan_chosen_stdout(void) | |||
| 969 | return 0; | 969 | return 0; |
| 970 | } | 970 | } |
| 971 | 971 | ||
| 972 | for (match = __earlycon_table; match < __earlycon_table_end; match++) { | 972 | for (p_match = __earlycon_table; p_match < __earlycon_table_end; |
| 973 | p_match++) { | ||
| 974 | const struct earlycon_id *match = *p_match; | ||
| 975 | |||
| 973 | if (!match->compatible[0]) | 976 | if (!match->compatible[0]) |
| 974 | continue; | 977 | continue; |
| 975 | 978 | ||
diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c index a6b88c7f6e3e..d2970a009eb5 100644 --- a/drivers/pci/dwc/pcie-kirin.c +++ b/drivers/pci/dwc/pcie-kirin.c | |||
| @@ -486,7 +486,7 @@ static int kirin_pcie_probe(struct platform_device *pdev) | |||
| 486 | return ret; | 486 | return ret; |
| 487 | 487 | ||
| 488 | kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node, | 488 | kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node, |
| 489 | "reset-gpio", 0); | 489 | "reset-gpios", 0); |
| 490 | if (kirin_pcie->gpio_id_reset < 0) | 490 | if (kirin_pcie->gpio_id_reset < 0) |
| 491 | return -ENODEV; | 491 | return -ENODEV; |
| 492 | 492 | ||
diff --git a/drivers/pci/host/pci-aardvark.c b/drivers/pci/host/pci-aardvark.c index b04d37b3c5de..9abf549631b4 100644 --- a/drivers/pci/host/pci-aardvark.c +++ b/drivers/pci/host/pci-aardvark.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #define PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SZ_SHIFT 5 | 29 | #define PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SZ_SHIFT 5 |
| 30 | #define PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE (0 << 11) | 30 | #define PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE (0 << 11) |
| 31 | #define PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT 12 | 31 | #define PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT 12 |
| 32 | #define PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SZ 0x2 | ||
| 32 | #define PCIE_CORE_LINK_CTRL_STAT_REG 0xd0 | 33 | #define PCIE_CORE_LINK_CTRL_STAT_REG 0xd0 |
| 33 | #define PCIE_CORE_LINK_L0S_ENTRY BIT(0) | 34 | #define PCIE_CORE_LINK_L0S_ENTRY BIT(0) |
| 34 | #define PCIE_CORE_LINK_TRAINING BIT(5) | 35 | #define PCIE_CORE_LINK_TRAINING BIT(5) |
| @@ -100,7 +101,8 @@ | |||
| 100 | #define PCIE_ISR1_MASK_REG (CONTROL_BASE_ADDR + 0x4C) | 101 | #define PCIE_ISR1_MASK_REG (CONTROL_BASE_ADDR + 0x4C) |
| 101 | #define PCIE_ISR1_POWER_STATE_CHANGE BIT(4) | 102 | #define PCIE_ISR1_POWER_STATE_CHANGE BIT(4) |
| 102 | #define PCIE_ISR1_FLUSH BIT(5) | 103 | #define PCIE_ISR1_FLUSH BIT(5) |
| 103 | #define PCIE_ISR1_ALL_MASK GENMASK(5, 4) | 104 | #define PCIE_ISR1_INTX_ASSERT(val) BIT(8 + (val)) |
| 105 | #define PCIE_ISR1_ALL_MASK GENMASK(11, 4) | ||
| 104 | #define PCIE_MSI_ADDR_LOW_REG (CONTROL_BASE_ADDR + 0x50) | 106 | #define PCIE_MSI_ADDR_LOW_REG (CONTROL_BASE_ADDR + 0x50) |
| 105 | #define PCIE_MSI_ADDR_HIGH_REG (CONTROL_BASE_ADDR + 0x54) | 107 | #define PCIE_MSI_ADDR_HIGH_REG (CONTROL_BASE_ADDR + 0x54) |
| 106 | #define PCIE_MSI_STATUS_REG (CONTROL_BASE_ADDR + 0x58) | 108 | #define PCIE_MSI_STATUS_REG (CONTROL_BASE_ADDR + 0x58) |
| @@ -172,8 +174,6 @@ | |||
| 172 | #define PCIE_CONFIG_WR_TYPE0 0xa | 174 | #define PCIE_CONFIG_WR_TYPE0 0xa |
| 173 | #define PCIE_CONFIG_WR_TYPE1 0xb | 175 | #define PCIE_CONFIG_WR_TYPE1 0xb |
| 174 | 176 | ||
| 175 | /* PCI_BDF shifts 8bit, so we need extra 4bit shift */ | ||
| 176 | #define PCIE_BDF(dev) (dev << 4) | ||
| 177 | #define PCIE_CONF_BUS(bus) (((bus) & 0xff) << 20) | 177 | #define PCIE_CONF_BUS(bus) (((bus) & 0xff) << 20) |
| 178 | #define PCIE_CONF_DEV(dev) (((dev) & 0x1f) << 15) | 178 | #define PCIE_CONF_DEV(dev) (((dev) & 0x1f) << 15) |
| 179 | #define PCIE_CONF_FUNC(fun) (((fun) & 0x7) << 12) | 179 | #define PCIE_CONF_FUNC(fun) (((fun) & 0x7) << 12) |
| @@ -296,7 +296,8 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) | |||
| 296 | reg = PCIE_CORE_DEV_CTRL_STATS_RELAX_ORDER_DISABLE | | 296 | reg = PCIE_CORE_DEV_CTRL_STATS_RELAX_ORDER_DISABLE | |
| 297 | (7 << PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SZ_SHIFT) | | 297 | (7 << PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SZ_SHIFT) | |
| 298 | PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE | | 298 | PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE | |
| 299 | PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT; | 299 | (PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SZ << |
| 300 | PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT); | ||
| 300 | advk_writel(pcie, reg, PCIE_CORE_DEV_CTRL_STATS_REG); | 301 | advk_writel(pcie, reg, PCIE_CORE_DEV_CTRL_STATS_REG); |
| 301 | 302 | ||
| 302 | /* Program PCIe Control 2 to disable strict ordering */ | 303 | /* Program PCIe Control 2 to disable strict ordering */ |
| @@ -437,7 +438,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, | |||
| 437 | u32 reg; | 438 | u32 reg; |
| 438 | int ret; | 439 | int ret; |
| 439 | 440 | ||
| 440 | if (PCI_SLOT(devfn) != 0) { | 441 | if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0) { |
| 441 | *val = 0xffffffff; | 442 | *val = 0xffffffff; |
| 442 | return PCIBIOS_DEVICE_NOT_FOUND; | 443 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 443 | } | 444 | } |
| @@ -456,7 +457,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, | |||
| 456 | advk_writel(pcie, reg, PIO_CTRL); | 457 | advk_writel(pcie, reg, PIO_CTRL); |
| 457 | 458 | ||
| 458 | /* Program the address registers */ | 459 | /* Program the address registers */ |
| 459 | reg = PCIE_BDF(devfn) | PCIE_CONF_REG(where); | 460 | reg = PCIE_CONF_ADDR(bus->number, devfn, where); |
| 460 | advk_writel(pcie, reg, PIO_ADDR_LS); | 461 | advk_writel(pcie, reg, PIO_ADDR_LS); |
| 461 | advk_writel(pcie, 0, PIO_ADDR_MS); | 462 | advk_writel(pcie, 0, PIO_ADDR_MS); |
| 462 | 463 | ||
| @@ -491,7 +492,7 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, | |||
| 491 | int offset; | 492 | int offset; |
| 492 | int ret; | 493 | int ret; |
| 493 | 494 | ||
| 494 | if (PCI_SLOT(devfn) != 0) | 495 | if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0) |
| 495 | return PCIBIOS_DEVICE_NOT_FOUND; | 496 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 496 | 497 | ||
| 497 | if (where % size) | 498 | if (where % size) |
| @@ -609,9 +610,9 @@ static void advk_pcie_irq_mask(struct irq_data *d) | |||
| 609 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | 610 | irq_hw_number_t hwirq = irqd_to_hwirq(d); |
| 610 | u32 mask; | 611 | u32 mask; |
| 611 | 612 | ||
| 612 | mask = advk_readl(pcie, PCIE_ISR0_MASK_REG); | 613 | mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); |
| 613 | mask |= PCIE_ISR0_INTX_ASSERT(hwirq); | 614 | mask |= PCIE_ISR1_INTX_ASSERT(hwirq); |
| 614 | advk_writel(pcie, mask, PCIE_ISR0_MASK_REG); | 615 | advk_writel(pcie, mask, PCIE_ISR1_MASK_REG); |
| 615 | } | 616 | } |
| 616 | 617 | ||
| 617 | static void advk_pcie_irq_unmask(struct irq_data *d) | 618 | static void advk_pcie_irq_unmask(struct irq_data *d) |
| @@ -620,9 +621,9 @@ static void advk_pcie_irq_unmask(struct irq_data *d) | |||
| 620 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | 621 | irq_hw_number_t hwirq = irqd_to_hwirq(d); |
| 621 | u32 mask; | 622 | u32 mask; |
| 622 | 623 | ||
| 623 | mask = advk_readl(pcie, PCIE_ISR0_MASK_REG); | 624 | mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); |
| 624 | mask &= ~PCIE_ISR0_INTX_ASSERT(hwirq); | 625 | mask &= ~PCIE_ISR1_INTX_ASSERT(hwirq); |
| 625 | advk_writel(pcie, mask, PCIE_ISR0_MASK_REG); | 626 | advk_writel(pcie, mask, PCIE_ISR1_MASK_REG); |
| 626 | } | 627 | } |
| 627 | 628 | ||
| 628 | static int advk_pcie_irq_map(struct irq_domain *h, | 629 | static int advk_pcie_irq_map(struct irq_domain *h, |
| @@ -765,29 +766,35 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie) | |||
| 765 | 766 | ||
| 766 | static void advk_pcie_handle_int(struct advk_pcie *pcie) | 767 | static void advk_pcie_handle_int(struct advk_pcie *pcie) |
| 767 | { | 768 | { |
| 768 | u32 val, mask, status; | 769 | u32 isr0_val, isr0_mask, isr0_status; |
| 770 | u32 isr1_val, isr1_mask, isr1_status; | ||
| 769 | int i, virq; | 771 | int i, virq; |
| 770 | 772 | ||
| 771 | val = advk_readl(pcie, PCIE_ISR0_REG); | 773 | isr0_val = advk_readl(pcie, PCIE_ISR0_REG); |
| 772 | mask = advk_readl(pcie, PCIE_ISR0_MASK_REG); | 774 | isr0_mask = advk_readl(pcie, PCIE_ISR0_MASK_REG); |
| 773 | status = val & ((~mask) & PCIE_ISR0_ALL_MASK); | 775 | isr0_status = isr0_val & ((~isr0_mask) & PCIE_ISR0_ALL_MASK); |
| 776 | |||
| 777 | isr1_val = advk_readl(pcie, PCIE_ISR1_REG); | ||
| 778 | isr1_mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); | ||
| 779 | isr1_status = isr1_val & ((~isr1_mask) & PCIE_ISR1_ALL_MASK); | ||
| 774 | 780 | ||
| 775 | if (!status) { | 781 | if (!isr0_status && !isr1_status) { |
| 776 | advk_writel(pcie, val, PCIE_ISR0_REG); | 782 | advk_writel(pcie, isr0_val, PCIE_ISR0_REG); |
| 783 | advk_writel(pcie, isr1_val, PCIE_ISR1_REG); | ||
| 777 | return; | 784 | return; |
| 778 | } | 785 | } |
| 779 | 786 | ||
| 780 | /* Process MSI interrupts */ | 787 | /* Process MSI interrupts */ |
| 781 | if (status & PCIE_ISR0_MSI_INT_PENDING) | 788 | if (isr0_status & PCIE_ISR0_MSI_INT_PENDING) |
| 782 | advk_pcie_handle_msi(pcie); | 789 | advk_pcie_handle_msi(pcie); |
| 783 | 790 | ||
| 784 | /* Process legacy interrupts */ | 791 | /* Process legacy interrupts */ |
| 785 | for (i = 0; i < PCI_NUM_INTX; i++) { | 792 | for (i = 0; i < PCI_NUM_INTX; i++) { |
| 786 | if (!(status & PCIE_ISR0_INTX_ASSERT(i))) | 793 | if (!(isr1_status & PCIE_ISR1_INTX_ASSERT(i))) |
| 787 | continue; | 794 | continue; |
| 788 | 795 | ||
| 789 | advk_writel(pcie, PCIE_ISR0_INTX_ASSERT(i), | 796 | advk_writel(pcie, PCIE_ISR1_INTX_ASSERT(i), |
| 790 | PCIE_ISR0_REG); | 797 | PCIE_ISR1_REG); |
| 791 | 798 | ||
| 792 | virq = irq_find_mapping(pcie->irq_domain, i); | 799 | virq = irq_find_mapping(pcie->irq_domain, i); |
| 793 | generic_handle_irq(virq); | 800 | generic_handle_irq(virq); |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 6ace47099fc5..b9a131137e64 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
| @@ -958,10 +958,11 @@ static int pci_pm_freeze(struct device *dev) | |||
| 958 | * devices should not be touched during freeze/thaw transitions, | 958 | * devices should not be touched during freeze/thaw transitions, |
| 959 | * however. | 959 | * however. |
| 960 | */ | 960 | */ |
| 961 | if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) | 961 | if (!dev_pm_smart_suspend_and_suspended(dev)) { |
| 962 | pm_runtime_resume(dev); | 962 | pm_runtime_resume(dev); |
| 963 | pci_dev->state_saved = false; | ||
| 964 | } | ||
| 963 | 965 | ||
| 964 | pci_dev->state_saved = false; | ||
| 965 | if (pm->freeze) { | 966 | if (pm->freeze) { |
| 966 | int error; | 967 | int error; |
| 967 | 968 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e597655a5643..a04197ce767d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -5273,11 +5273,11 @@ void pcie_print_link_status(struct pci_dev *dev) | |||
| 5273 | bw_avail = pcie_bandwidth_available(dev, &limiting_dev, &speed, &width); | 5273 | bw_avail = pcie_bandwidth_available(dev, &limiting_dev, &speed, &width); |
| 5274 | 5274 | ||
| 5275 | if (bw_avail >= bw_cap) | 5275 | if (bw_avail >= bw_cap) |
| 5276 | pci_info(dev, "%u.%03u Gb/s available bandwidth (%s x%d link)\n", | 5276 | pci_info(dev, "%u.%03u Gb/s available PCIe bandwidth (%s x%d link)\n", |
| 5277 | bw_cap / 1000, bw_cap % 1000, | 5277 | bw_cap / 1000, bw_cap % 1000, |
| 5278 | PCIE_SPEED2STR(speed_cap), width_cap); | 5278 | PCIE_SPEED2STR(speed_cap), width_cap); |
| 5279 | else | 5279 | else |
| 5280 | pci_info(dev, "%u.%03u Gb/s available bandwidth, limited by %s x%d link at %s (capable of %u.%03u Gb/s with %s x%d link)\n", | 5280 | pci_info(dev, "%u.%03u Gb/s available PCIe bandwidth, limited by %s x%d link at %s (capable of %u.%03u Gb/s with %s x%d link)\n", |
| 5281 | bw_avail / 1000, bw_avail % 1000, | 5281 | bw_avail / 1000, bw_avail % 1000, |
| 5282 | PCIE_SPEED2STR(speed), width, | 5282 | PCIE_SPEED2STR(speed), width, |
| 5283 | limiting_dev ? pci_name(limiting_dev) : "<unknown>", | 5283 | limiting_dev ? pci_name(limiting_dev) : "<unknown>", |
diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c index 304e891e35fc..60f2250fd96b 100644 --- a/drivers/rtc/rtc-opal.c +++ b/drivers/rtc/rtc-opal.c | |||
| @@ -57,7 +57,7 @@ static void tm_to_opal(struct rtc_time *tm, u32 *y_m_d, u64 *h_m_s_ms) | |||
| 57 | 57 | ||
| 58 | static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm) | 58 | static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm) |
| 59 | { | 59 | { |
| 60 | long rc = OPAL_BUSY; | 60 | s64 rc = OPAL_BUSY; |
| 61 | int retries = 10; | 61 | int retries = 10; |
| 62 | u32 y_m_d; | 62 | u32 y_m_d; |
| 63 | u64 h_m_s_ms; | 63 | u64 h_m_s_ms; |
| @@ -66,13 +66,17 @@ static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm) | |||
| 66 | 66 | ||
| 67 | while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { | 67 | while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { |
| 68 | rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); | 68 | rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); |
| 69 | if (rc == OPAL_BUSY_EVENT) | 69 | if (rc == OPAL_BUSY_EVENT) { |
| 70 | msleep(OPAL_BUSY_DELAY_MS); | ||
| 70 | opal_poll_events(NULL); | 71 | opal_poll_events(NULL); |
| 71 | else if (retries-- && (rc == OPAL_HARDWARE | 72 | } else if (rc == OPAL_BUSY) { |
| 72 | || rc == OPAL_INTERNAL_ERROR)) | 73 | msleep(OPAL_BUSY_DELAY_MS); |
| 73 | msleep(10); | 74 | } else if (rc == OPAL_HARDWARE || rc == OPAL_INTERNAL_ERROR) { |
| 74 | else if (rc != OPAL_BUSY && rc != OPAL_BUSY_EVENT) | 75 | if (retries--) { |
| 75 | break; | 76 | msleep(10); /* Wait 10ms before retry */ |
| 77 | rc = OPAL_BUSY; /* go around again */ | ||
| 78 | } | ||
| 79 | } | ||
| 76 | } | 80 | } |
| 77 | 81 | ||
| 78 | if (rc != OPAL_SUCCESS) | 82 | if (rc != OPAL_SUCCESS) |
| @@ -87,21 +91,26 @@ static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm) | |||
| 87 | 91 | ||
| 88 | static int opal_set_rtc_time(struct device *dev, struct rtc_time *tm) | 92 | static int opal_set_rtc_time(struct device *dev, struct rtc_time *tm) |
| 89 | { | 93 | { |
| 90 | long rc = OPAL_BUSY; | 94 | s64 rc = OPAL_BUSY; |
| 91 | int retries = 10; | 95 | int retries = 10; |
| 92 | u32 y_m_d = 0; | 96 | u32 y_m_d = 0; |
| 93 | u64 h_m_s_ms = 0; | 97 | u64 h_m_s_ms = 0; |
| 94 | 98 | ||
| 95 | tm_to_opal(tm, &y_m_d, &h_m_s_ms); | 99 | tm_to_opal(tm, &y_m_d, &h_m_s_ms); |
| 100 | |||
| 96 | while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { | 101 | while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { |
| 97 | rc = opal_rtc_write(y_m_d, h_m_s_ms); | 102 | rc = opal_rtc_write(y_m_d, h_m_s_ms); |
| 98 | if (rc == OPAL_BUSY_EVENT) | 103 | if (rc == OPAL_BUSY_EVENT) { |
| 104 | msleep(OPAL_BUSY_DELAY_MS); | ||
| 99 | opal_poll_events(NULL); | 105 | opal_poll_events(NULL); |
| 100 | else if (retries-- && (rc == OPAL_HARDWARE | 106 | } else if (rc == OPAL_BUSY) { |
| 101 | || rc == OPAL_INTERNAL_ERROR)) | 107 | msleep(OPAL_BUSY_DELAY_MS); |
| 102 | msleep(10); | 108 | } else if (rc == OPAL_HARDWARE || rc == OPAL_INTERNAL_ERROR) { |
| 103 | else if (rc != OPAL_BUSY && rc != OPAL_BUSY_EVENT) | 109 | if (retries--) { |
| 104 | break; | 110 | msleep(10); /* Wait 10ms before retry */ |
| 111 | rc = OPAL_BUSY; /* go around again */ | ||
| 112 | } | ||
| 113 | } | ||
| 105 | } | 114 | } |
| 106 | 115 | ||
| 107 | return rc == OPAL_SUCCESS ? 0 : -EIO; | 116 | return rc == OPAL_SUCCESS ? 0 : -EIO; |
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c index 62f5f04d8f61..5e963fe0e38d 100644 --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c | |||
| @@ -592,13 +592,22 @@ static int _schedule_lcu_update(struct alias_lcu *lcu, | |||
| 592 | int dasd_alias_add_device(struct dasd_device *device) | 592 | int dasd_alias_add_device(struct dasd_device *device) |
| 593 | { | 593 | { |
| 594 | struct dasd_eckd_private *private = device->private; | 594 | struct dasd_eckd_private *private = device->private; |
| 595 | struct alias_lcu *lcu; | 595 | __u8 uaddr = private->uid.real_unit_addr; |
| 596 | struct alias_lcu *lcu = private->lcu; | ||
| 596 | unsigned long flags; | 597 | unsigned long flags; |
| 597 | int rc; | 598 | int rc; |
| 598 | 599 | ||
| 599 | lcu = private->lcu; | ||
| 600 | rc = 0; | 600 | rc = 0; |
| 601 | spin_lock_irqsave(&lcu->lock, flags); | 601 | spin_lock_irqsave(&lcu->lock, flags); |
| 602 | /* | ||
| 603 | * Check if device and lcu type differ. If so, the uac data may be | ||
| 604 | * outdated and needs to be updated. | ||
| 605 | */ | ||
| 606 | if (private->uid.type != lcu->uac->unit[uaddr].ua_type) { | ||
| 607 | lcu->flags |= UPDATE_PENDING; | ||
| 608 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", | ||
| 609 | "uid type mismatch - trigger rescan"); | ||
| 610 | } | ||
| 602 | if (!(lcu->flags & UPDATE_PENDING)) { | 611 | if (!(lcu->flags & UPDATE_PENDING)) { |
| 603 | rc = _add_device_to_lcu(lcu, device, device); | 612 | rc = _add_device_to_lcu(lcu, device, device); |
| 604 | if (rc) | 613 | if (rc) |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 6652a49a49b1..9029804dcd22 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
| @@ -452,6 +452,7 @@ static void chsc_process_sei_link_incident(struct chsc_sei_nt0_area *sei_area) | |||
| 452 | 452 | ||
| 453 | static void chsc_process_sei_res_acc(struct chsc_sei_nt0_area *sei_area) | 453 | static void chsc_process_sei_res_acc(struct chsc_sei_nt0_area *sei_area) |
| 454 | { | 454 | { |
| 455 | struct channel_path *chp; | ||
| 455 | struct chp_link link; | 456 | struct chp_link link; |
| 456 | struct chp_id chpid; | 457 | struct chp_id chpid; |
| 457 | int status; | 458 | int status; |
| @@ -464,10 +465,17 @@ static void chsc_process_sei_res_acc(struct chsc_sei_nt0_area *sei_area) | |||
| 464 | chpid.id = sei_area->rsid; | 465 | chpid.id = sei_area->rsid; |
| 465 | /* allocate a new channel path structure, if needed */ | 466 | /* allocate a new channel path structure, if needed */ |
| 466 | status = chp_get_status(chpid); | 467 | status = chp_get_status(chpid); |
| 467 | if (status < 0) | 468 | if (!status) |
| 468 | chp_new(chpid); | ||
| 469 | else if (!status) | ||
| 470 | return; | 469 | return; |
| 470 | |||
| 471 | if (status < 0) { | ||
| 472 | chp_new(chpid); | ||
| 473 | } else { | ||
| 474 | chp = chpid_to_chp(chpid); | ||
| 475 | mutex_lock(&chp->lock); | ||
| 476 | chp_update_desc(chp); | ||
| 477 | mutex_unlock(&chp->lock); | ||
| 478 | } | ||
| 471 | memset(&link, 0, sizeof(struct chp_link)); | 479 | memset(&link, 0, sizeof(struct chp_link)); |
| 472 | link.chpid = chpid; | 480 | link.chpid = chpid; |
| 473 | if ((sei_area->vf & 0xc0) != 0) { | 481 | if ((sei_area->vf & 0xc0) != 0) { |
diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c index ff6963ad6e39..3c800642134e 100644 --- a/drivers/s390/cio/vfio_ccw_fsm.c +++ b/drivers/s390/cio/vfio_ccw_fsm.c | |||
| @@ -20,12 +20,12 @@ static int fsm_io_helper(struct vfio_ccw_private *private) | |||
| 20 | int ccode; | 20 | int ccode; |
| 21 | __u8 lpm; | 21 | __u8 lpm; |
| 22 | unsigned long flags; | 22 | unsigned long flags; |
| 23 | int ret; | ||
| 23 | 24 | ||
| 24 | sch = private->sch; | 25 | sch = private->sch; |
| 25 | 26 | ||
| 26 | spin_lock_irqsave(sch->lock, flags); | 27 | spin_lock_irqsave(sch->lock, flags); |
| 27 | private->state = VFIO_CCW_STATE_BUSY; | 28 | private->state = VFIO_CCW_STATE_BUSY; |
| 28 | spin_unlock_irqrestore(sch->lock, flags); | ||
| 29 | 29 | ||
| 30 | orb = cp_get_orb(&private->cp, (u32)(addr_t)sch, sch->lpm); | 30 | orb = cp_get_orb(&private->cp, (u32)(addr_t)sch, sch->lpm); |
| 31 | 31 | ||
| @@ -38,10 +38,12 @@ static int fsm_io_helper(struct vfio_ccw_private *private) | |||
| 38 | * Initialize device status information | 38 | * Initialize device status information |
| 39 | */ | 39 | */ |
| 40 | sch->schib.scsw.cmd.actl |= SCSW_ACTL_START_PEND; | 40 | sch->schib.scsw.cmd.actl |= SCSW_ACTL_START_PEND; |
| 41 | return 0; | 41 | ret = 0; |
| 42 | break; | ||
| 42 | case 1: /* Status pending */ | 43 | case 1: /* Status pending */ |
| 43 | case 2: /* Busy */ | 44 | case 2: /* Busy */ |
| 44 | return -EBUSY; | 45 | ret = -EBUSY; |
| 46 | break; | ||
| 45 | case 3: /* Device/path not operational */ | 47 | case 3: /* Device/path not operational */ |
| 46 | { | 48 | { |
| 47 | lpm = orb->cmd.lpm; | 49 | lpm = orb->cmd.lpm; |
| @@ -51,13 +53,16 @@ static int fsm_io_helper(struct vfio_ccw_private *private) | |||
| 51 | sch->lpm = 0; | 53 | sch->lpm = 0; |
| 52 | 54 | ||
| 53 | if (cio_update_schib(sch)) | 55 | if (cio_update_schib(sch)) |
| 54 | return -ENODEV; | 56 | ret = -ENODEV; |
| 55 | 57 | else | |
| 56 | return sch->lpm ? -EACCES : -ENODEV; | 58 | ret = sch->lpm ? -EACCES : -ENODEV; |
| 59 | break; | ||
| 57 | } | 60 | } |
| 58 | default: | 61 | default: |
| 59 | return ccode; | 62 | ret = ccode; |
| 60 | } | 63 | } |
| 64 | spin_unlock_irqrestore(sch->lock, flags); | ||
| 65 | return ret; | ||
| 61 | } | 66 | } |
| 62 | 67 | ||
| 63 | static void fsm_notoper(struct vfio_ccw_private *private, | 68 | static void fsm_notoper(struct vfio_ccw_private *private, |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 4326715dc13e..78b98b3e7efa 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
| @@ -557,7 +557,6 @@ enum qeth_prot_versions { | |||
| 557 | enum qeth_cmd_buffer_state { | 557 | enum qeth_cmd_buffer_state { |
| 558 | BUF_STATE_FREE, | 558 | BUF_STATE_FREE, |
| 559 | BUF_STATE_LOCKED, | 559 | BUF_STATE_LOCKED, |
| 560 | BUF_STATE_PROCESSED, | ||
| 561 | }; | 560 | }; |
| 562 | 561 | ||
| 563 | enum qeth_cq { | 562 | enum qeth_cq { |
| @@ -601,7 +600,6 @@ struct qeth_channel { | |||
| 601 | struct qeth_cmd_buffer iob[QETH_CMD_BUFFER_NO]; | 600 | struct qeth_cmd_buffer iob[QETH_CMD_BUFFER_NO]; |
| 602 | atomic_t irq_pending; | 601 | atomic_t irq_pending; |
| 603 | int io_buf_no; | 602 | int io_buf_no; |
| 604 | int buf_no; | ||
| 605 | }; | 603 | }; |
| 606 | 604 | ||
| 607 | /** | 605 | /** |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 04fefa5bb08d..dffd820731f2 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
| @@ -706,7 +706,6 @@ void qeth_clear_ipacmd_list(struct qeth_card *card) | |||
| 706 | qeth_put_reply(reply); | 706 | qeth_put_reply(reply); |
| 707 | } | 707 | } |
| 708 | spin_unlock_irqrestore(&card->lock, flags); | 708 | spin_unlock_irqrestore(&card->lock, flags); |
| 709 | atomic_set(&card->write.irq_pending, 0); | ||
| 710 | } | 709 | } |
| 711 | EXPORT_SYMBOL_GPL(qeth_clear_ipacmd_list); | 710 | EXPORT_SYMBOL_GPL(qeth_clear_ipacmd_list); |
| 712 | 711 | ||
| @@ -818,7 +817,6 @@ void qeth_clear_cmd_buffers(struct qeth_channel *channel) | |||
| 818 | 817 | ||
| 819 | for (cnt = 0; cnt < QETH_CMD_BUFFER_NO; cnt++) | 818 | for (cnt = 0; cnt < QETH_CMD_BUFFER_NO; cnt++) |
| 820 | qeth_release_buffer(channel, &channel->iob[cnt]); | 819 | qeth_release_buffer(channel, &channel->iob[cnt]); |
| 821 | channel->buf_no = 0; | ||
| 822 | channel->io_buf_no = 0; | 820 | channel->io_buf_no = 0; |
| 823 | } | 821 | } |
| 824 | EXPORT_SYMBOL_GPL(qeth_clear_cmd_buffers); | 822 | EXPORT_SYMBOL_GPL(qeth_clear_cmd_buffers); |
| @@ -924,7 +922,6 @@ static int qeth_setup_channel(struct qeth_channel *channel) | |||
| 924 | kfree(channel->iob[cnt].data); | 922 | kfree(channel->iob[cnt].data); |
| 925 | return -ENOMEM; | 923 | return -ENOMEM; |
| 926 | } | 924 | } |
| 927 | channel->buf_no = 0; | ||
| 928 | channel->io_buf_no = 0; | 925 | channel->io_buf_no = 0; |
| 929 | atomic_set(&channel->irq_pending, 0); | 926 | atomic_set(&channel->irq_pending, 0); |
| 930 | spin_lock_init(&channel->iob_lock); | 927 | spin_lock_init(&channel->iob_lock); |
| @@ -1100,16 +1097,9 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, | |||
| 1100 | { | 1097 | { |
| 1101 | int rc; | 1098 | int rc; |
| 1102 | int cstat, dstat; | 1099 | int cstat, dstat; |
| 1103 | struct qeth_cmd_buffer *buffer; | 1100 | struct qeth_cmd_buffer *iob = NULL; |
| 1104 | struct qeth_channel *channel; | 1101 | struct qeth_channel *channel; |
| 1105 | struct qeth_card *card; | 1102 | struct qeth_card *card; |
| 1106 | struct qeth_cmd_buffer *iob; | ||
| 1107 | __u8 index; | ||
| 1108 | |||
| 1109 | if (__qeth_check_irb_error(cdev, intparm, irb)) | ||
| 1110 | return; | ||
| 1111 | cstat = irb->scsw.cmd.cstat; | ||
| 1112 | dstat = irb->scsw.cmd.dstat; | ||
| 1113 | 1103 | ||
| 1114 | card = CARD_FROM_CDEV(cdev); | 1104 | card = CARD_FROM_CDEV(cdev); |
| 1115 | if (!card) | 1105 | if (!card) |
| @@ -1127,6 +1117,19 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, | |||
| 1127 | channel = &card->data; | 1117 | channel = &card->data; |
| 1128 | QETH_CARD_TEXT(card, 5, "data"); | 1118 | QETH_CARD_TEXT(card, 5, "data"); |
| 1129 | } | 1119 | } |
| 1120 | |||
| 1121 | if (qeth_intparm_is_iob(intparm)) | ||
| 1122 | iob = (struct qeth_cmd_buffer *) __va((addr_t)intparm); | ||
| 1123 | |||
| 1124 | if (__qeth_check_irb_error(cdev, intparm, irb)) { | ||
| 1125 | /* IO was terminated, free its resources. */ | ||
| 1126 | if (iob) | ||
| 1127 | qeth_release_buffer(iob->channel, iob); | ||
| 1128 | atomic_set(&channel->irq_pending, 0); | ||
| 1129 | wake_up(&card->wait_q); | ||
| 1130 | return; | ||
| 1131 | } | ||
| 1132 | |||
| 1130 | atomic_set(&channel->irq_pending, 0); | 1133 | atomic_set(&channel->irq_pending, 0); |
| 1131 | 1134 | ||
| 1132 | if (irb->scsw.cmd.fctl & (SCSW_FCTL_CLEAR_FUNC)) | 1135 | if (irb->scsw.cmd.fctl & (SCSW_FCTL_CLEAR_FUNC)) |
| @@ -1150,6 +1153,10 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, | |||
| 1150 | /* we don't have to handle this further */ | 1153 | /* we don't have to handle this further */ |
| 1151 | intparm = 0; | 1154 | intparm = 0; |
| 1152 | } | 1155 | } |
| 1156 | |||
| 1157 | cstat = irb->scsw.cmd.cstat; | ||
| 1158 | dstat = irb->scsw.cmd.dstat; | ||
| 1159 | |||
| 1153 | if ((dstat & DEV_STAT_UNIT_EXCEP) || | 1160 | if ((dstat & DEV_STAT_UNIT_EXCEP) || |
| 1154 | (dstat & DEV_STAT_UNIT_CHECK) || | 1161 | (dstat & DEV_STAT_UNIT_CHECK) || |
| 1155 | (cstat)) { | 1162 | (cstat)) { |
| @@ -1182,25 +1189,15 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, | |||
| 1182 | channel->state = CH_STATE_RCD_DONE; | 1189 | channel->state = CH_STATE_RCD_DONE; |
| 1183 | goto out; | 1190 | goto out; |
| 1184 | } | 1191 | } |
| 1185 | if (intparm) { | ||
| 1186 | buffer = (struct qeth_cmd_buffer *) __va((addr_t)intparm); | ||
| 1187 | buffer->state = BUF_STATE_PROCESSED; | ||
| 1188 | } | ||
| 1189 | if (channel == &card->data) | 1192 | if (channel == &card->data) |
| 1190 | return; | 1193 | return; |
| 1191 | if (channel == &card->read && | 1194 | if (channel == &card->read && |
| 1192 | channel->state == CH_STATE_UP) | 1195 | channel->state == CH_STATE_UP) |
| 1193 | __qeth_issue_next_read(card); | 1196 | __qeth_issue_next_read(card); |
| 1194 | 1197 | ||
| 1195 | iob = channel->iob; | 1198 | if (iob && iob->callback) |
| 1196 | index = channel->buf_no; | 1199 | iob->callback(iob->channel, iob); |
| 1197 | while (iob[index].state == BUF_STATE_PROCESSED) { | ||
| 1198 | if (iob[index].callback != NULL) | ||
| 1199 | iob[index].callback(channel, iob + index); | ||
| 1200 | 1200 | ||
| 1201 | index = (index + 1) % QETH_CMD_BUFFER_NO; | ||
| 1202 | } | ||
| 1203 | channel->buf_no = index; | ||
| 1204 | out: | 1201 | out: |
| 1205 | wake_up(&card->wait_q); | 1202 | wake_up(&card->wait_q); |
| 1206 | return; | 1203 | return; |
| @@ -1870,8 +1867,8 @@ static int qeth_idx_activate_get_answer(struct qeth_channel *channel, | |||
| 1870 | atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0); | 1867 | atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0); |
| 1871 | QETH_DBF_TEXT(SETUP, 6, "noirqpnd"); | 1868 | QETH_DBF_TEXT(SETUP, 6, "noirqpnd"); |
| 1872 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 1869 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
| 1873 | rc = ccw_device_start(channel->ccwdev, | 1870 | rc = ccw_device_start_timeout(channel->ccwdev, &channel->ccw, |
| 1874 | &channel->ccw, (addr_t) iob, 0, 0); | 1871 | (addr_t) iob, 0, 0, QETH_TIMEOUT); |
| 1875 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); | 1872 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); |
| 1876 | 1873 | ||
| 1877 | if (rc) { | 1874 | if (rc) { |
| @@ -1888,7 +1885,6 @@ static int qeth_idx_activate_get_answer(struct qeth_channel *channel, | |||
| 1888 | if (channel->state != CH_STATE_UP) { | 1885 | if (channel->state != CH_STATE_UP) { |
| 1889 | rc = -ETIME; | 1886 | rc = -ETIME; |
| 1890 | QETH_DBF_TEXT_(SETUP, 2, "3err%d", rc); | 1887 | QETH_DBF_TEXT_(SETUP, 2, "3err%d", rc); |
| 1891 | qeth_clear_cmd_buffers(channel); | ||
| 1892 | } else | 1888 | } else |
| 1893 | rc = 0; | 1889 | rc = 0; |
| 1894 | return rc; | 1890 | return rc; |
| @@ -1942,8 +1938,8 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel, | |||
| 1942 | atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0); | 1938 | atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0); |
| 1943 | QETH_DBF_TEXT(SETUP, 6, "noirqpnd"); | 1939 | QETH_DBF_TEXT(SETUP, 6, "noirqpnd"); |
| 1944 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 1940 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
| 1945 | rc = ccw_device_start(channel->ccwdev, | 1941 | rc = ccw_device_start_timeout(channel->ccwdev, &channel->ccw, |
| 1946 | &channel->ccw, (addr_t) iob, 0, 0); | 1942 | (addr_t) iob, 0, 0, QETH_TIMEOUT); |
| 1947 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); | 1943 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); |
| 1948 | 1944 | ||
| 1949 | if (rc) { | 1945 | if (rc) { |
| @@ -1964,7 +1960,6 @@ static int qeth_idx_activate_channel(struct qeth_channel *channel, | |||
| 1964 | QETH_DBF_MESSAGE(2, "%s IDX activate timed out\n", | 1960 | QETH_DBF_MESSAGE(2, "%s IDX activate timed out\n", |
| 1965 | dev_name(&channel->ccwdev->dev)); | 1961 | dev_name(&channel->ccwdev->dev)); |
| 1966 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", -ETIME); | 1962 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", -ETIME); |
| 1967 | qeth_clear_cmd_buffers(channel); | ||
| 1968 | return -ETIME; | 1963 | return -ETIME; |
| 1969 | } | 1964 | } |
| 1970 | return qeth_idx_activate_get_answer(channel, idx_reply_cb); | 1965 | return qeth_idx_activate_get_answer(channel, idx_reply_cb); |
| @@ -2166,8 +2161,8 @@ int qeth_send_control_data(struct qeth_card *card, int len, | |||
| 2166 | 2161 | ||
| 2167 | QETH_CARD_TEXT(card, 6, "noirqpnd"); | 2162 | QETH_CARD_TEXT(card, 6, "noirqpnd"); |
| 2168 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); | 2163 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); |
| 2169 | rc = ccw_device_start(card->write.ccwdev, &card->write.ccw, | 2164 | rc = ccw_device_start_timeout(CARD_WDEV(card), &card->write.ccw, |
| 2170 | (addr_t) iob, 0, 0); | 2165 | (addr_t) iob, 0, 0, event_timeout); |
| 2171 | spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); | 2166 | spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); |
| 2172 | if (rc) { | 2167 | if (rc) { |
| 2173 | QETH_DBF_MESSAGE(2, "%s qeth_send_control_data: " | 2168 | QETH_DBF_MESSAGE(2, "%s qeth_send_control_data: " |
| @@ -2199,8 +2194,6 @@ int qeth_send_control_data(struct qeth_card *card, int len, | |||
| 2199 | } | 2194 | } |
| 2200 | } | 2195 | } |
| 2201 | 2196 | ||
| 2202 | if (reply->rc == -EIO) | ||
| 2203 | goto error; | ||
| 2204 | rc = reply->rc; | 2197 | rc = reply->rc; |
| 2205 | qeth_put_reply(reply); | 2198 | qeth_put_reply(reply); |
| 2206 | return rc; | 2199 | return rc; |
| @@ -2211,10 +2204,6 @@ time_err: | |||
| 2211 | list_del_init(&reply->list); | 2204 | list_del_init(&reply->list); |
| 2212 | spin_unlock_irqrestore(&reply->card->lock, flags); | 2205 | spin_unlock_irqrestore(&reply->card->lock, flags); |
| 2213 | atomic_inc(&reply->received); | 2206 | atomic_inc(&reply->received); |
| 2214 | error: | ||
| 2215 | atomic_set(&card->write.irq_pending, 0); | ||
| 2216 | qeth_release_buffer(iob->channel, iob); | ||
| 2217 | card->write.buf_no = (card->write.buf_no + 1) % QETH_CMD_BUFFER_NO; | ||
| 2218 | rc = reply->rc; | 2207 | rc = reply->rc; |
| 2219 | qeth_put_reply(reply); | 2208 | qeth_put_reply(reply); |
| 2220 | return rc; | 2209 | return rc; |
| @@ -3033,28 +3022,23 @@ static int qeth_send_startlan(struct qeth_card *card) | |||
| 3033 | return rc; | 3022 | return rc; |
| 3034 | } | 3023 | } |
| 3035 | 3024 | ||
| 3036 | static int qeth_default_setadapterparms_cb(struct qeth_card *card, | 3025 | static int qeth_setadpparms_inspect_rc(struct qeth_ipa_cmd *cmd) |
| 3037 | struct qeth_reply *reply, unsigned long data) | ||
| 3038 | { | 3026 | { |
| 3039 | struct qeth_ipa_cmd *cmd; | 3027 | if (!cmd->hdr.return_code) |
| 3040 | |||
| 3041 | QETH_CARD_TEXT(card, 4, "defadpcb"); | ||
| 3042 | |||
| 3043 | cmd = (struct qeth_ipa_cmd *) data; | ||
| 3044 | if (cmd->hdr.return_code == 0) | ||
| 3045 | cmd->hdr.return_code = | 3028 | cmd->hdr.return_code = |
| 3046 | cmd->data.setadapterparms.hdr.return_code; | 3029 | cmd->data.setadapterparms.hdr.return_code; |
| 3047 | return 0; | 3030 | return cmd->hdr.return_code; |
| 3048 | } | 3031 | } |
| 3049 | 3032 | ||
| 3050 | static int qeth_query_setadapterparms_cb(struct qeth_card *card, | 3033 | static int qeth_query_setadapterparms_cb(struct qeth_card *card, |
| 3051 | struct qeth_reply *reply, unsigned long data) | 3034 | struct qeth_reply *reply, unsigned long data) |
| 3052 | { | 3035 | { |
| 3053 | struct qeth_ipa_cmd *cmd; | 3036 | struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data; |
| 3054 | 3037 | ||
| 3055 | QETH_CARD_TEXT(card, 3, "quyadpcb"); | 3038 | QETH_CARD_TEXT(card, 3, "quyadpcb"); |
| 3039 | if (qeth_setadpparms_inspect_rc(cmd)) | ||
| 3040 | return 0; | ||
| 3056 | 3041 | ||
| 3057 | cmd = (struct qeth_ipa_cmd *) data; | ||
| 3058 | if (cmd->data.setadapterparms.data.query_cmds_supp.lan_type & 0x7f) { | 3042 | if (cmd->data.setadapterparms.data.query_cmds_supp.lan_type & 0x7f) { |
| 3059 | card->info.link_type = | 3043 | card->info.link_type = |
| 3060 | cmd->data.setadapterparms.data.query_cmds_supp.lan_type; | 3044 | cmd->data.setadapterparms.data.query_cmds_supp.lan_type; |
| @@ -3062,7 +3046,7 @@ static int qeth_query_setadapterparms_cb(struct qeth_card *card, | |||
| 3062 | } | 3046 | } |
| 3063 | card->options.adp.supported_funcs = | 3047 | card->options.adp.supported_funcs = |
| 3064 | cmd->data.setadapterparms.data.query_cmds_supp.supported_cmds; | 3048 | cmd->data.setadapterparms.data.query_cmds_supp.supported_cmds; |
| 3065 | return qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd); | 3049 | return 0; |
| 3066 | } | 3050 | } |
| 3067 | 3051 | ||
| 3068 | static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card, | 3052 | static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card, |
| @@ -3154,22 +3138,20 @@ EXPORT_SYMBOL_GPL(qeth_query_ipassists); | |||
| 3154 | static int qeth_query_switch_attributes_cb(struct qeth_card *card, | 3138 | static int qeth_query_switch_attributes_cb(struct qeth_card *card, |
| 3155 | struct qeth_reply *reply, unsigned long data) | 3139 | struct qeth_reply *reply, unsigned long data) |
| 3156 | { | 3140 | { |
| 3157 | struct qeth_ipa_cmd *cmd; | 3141 | struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data; |
| 3158 | struct qeth_switch_info *sw_info; | ||
| 3159 | struct qeth_query_switch_attributes *attrs; | 3142 | struct qeth_query_switch_attributes *attrs; |
| 3143 | struct qeth_switch_info *sw_info; | ||
| 3160 | 3144 | ||
| 3161 | QETH_CARD_TEXT(card, 2, "qswiatcb"); | 3145 | QETH_CARD_TEXT(card, 2, "qswiatcb"); |
| 3162 | cmd = (struct qeth_ipa_cmd *) data; | 3146 | if (qeth_setadpparms_inspect_rc(cmd)) |
| 3163 | sw_info = (struct qeth_switch_info *)reply->param; | 3147 | return 0; |
| 3164 | if (cmd->data.setadapterparms.hdr.return_code == 0) { | ||
| 3165 | attrs = &cmd->data.setadapterparms.data.query_switch_attributes; | ||
| 3166 | sw_info->capabilities = attrs->capabilities; | ||
| 3167 | sw_info->settings = attrs->settings; | ||
| 3168 | QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities, | ||
| 3169 | sw_info->settings); | ||
| 3170 | } | ||
| 3171 | qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); | ||
| 3172 | 3148 | ||
| 3149 | sw_info = (struct qeth_switch_info *)reply->param; | ||
| 3150 | attrs = &cmd->data.setadapterparms.data.query_switch_attributes; | ||
| 3151 | sw_info->capabilities = attrs->capabilities; | ||
| 3152 | sw_info->settings = attrs->settings; | ||
| 3153 | QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities, | ||
| 3154 | sw_info->settings); | ||
| 3173 | return 0; | 3155 | return 0; |
| 3174 | } | 3156 | } |
| 3175 | 3157 | ||
| @@ -4207,16 +4189,13 @@ EXPORT_SYMBOL_GPL(qeth_do_send_packet); | |||
| 4207 | static int qeth_setadp_promisc_mode_cb(struct qeth_card *card, | 4189 | static int qeth_setadp_promisc_mode_cb(struct qeth_card *card, |
| 4208 | struct qeth_reply *reply, unsigned long data) | 4190 | struct qeth_reply *reply, unsigned long data) |
| 4209 | { | 4191 | { |
| 4210 | struct qeth_ipa_cmd *cmd; | 4192 | struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data; |
| 4211 | struct qeth_ipacmd_setadpparms *setparms; | 4193 | struct qeth_ipacmd_setadpparms *setparms; |
| 4212 | 4194 | ||
| 4213 | QETH_CARD_TEXT(card, 4, "prmadpcb"); | 4195 | QETH_CARD_TEXT(card, 4, "prmadpcb"); |
| 4214 | 4196 | ||
| 4215 | cmd = (struct qeth_ipa_cmd *) data; | ||
| 4216 | setparms = &(cmd->data.setadapterparms); | 4197 | setparms = &(cmd->data.setadapterparms); |
| 4217 | 4198 | if (qeth_setadpparms_inspect_rc(cmd)) { | |
| 4218 | qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd); | ||
| 4219 | if (cmd->hdr.return_code) { | ||
| 4220 | QETH_CARD_TEXT_(card, 4, "prmrc%x", cmd->hdr.return_code); | 4199 | QETH_CARD_TEXT_(card, 4, "prmrc%x", cmd->hdr.return_code); |
| 4221 | setparms->data.mode = SET_PROMISC_MODE_OFF; | 4200 | setparms->data.mode = SET_PROMISC_MODE_OFF; |
| 4222 | } | 4201 | } |
| @@ -4286,18 +4265,18 @@ EXPORT_SYMBOL_GPL(qeth_get_stats); | |||
| 4286 | static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, | 4265 | static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, |
| 4287 | struct qeth_reply *reply, unsigned long data) | 4266 | struct qeth_reply *reply, unsigned long data) |
| 4288 | { | 4267 | { |
| 4289 | struct qeth_ipa_cmd *cmd; | 4268 | struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data; |
| 4290 | 4269 | ||
| 4291 | QETH_CARD_TEXT(card, 4, "chgmaccb"); | 4270 | QETH_CARD_TEXT(card, 4, "chgmaccb"); |
| 4271 | if (qeth_setadpparms_inspect_rc(cmd)) | ||
| 4272 | return 0; | ||
| 4292 | 4273 | ||
| 4293 | cmd = (struct qeth_ipa_cmd *) data; | ||
| 4294 | if (!card->options.layer2 || | 4274 | if (!card->options.layer2 || |
| 4295 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { | 4275 | !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) { |
| 4296 | ether_addr_copy(card->dev->dev_addr, | 4276 | ether_addr_copy(card->dev->dev_addr, |
| 4297 | cmd->data.setadapterparms.data.change_addr.addr); | 4277 | cmd->data.setadapterparms.data.change_addr.addr); |
| 4298 | card->info.mac_bits |= QETH_LAYER2_MAC_READ; | 4278 | card->info.mac_bits |= QETH_LAYER2_MAC_READ; |
| 4299 | } | 4279 | } |
| 4300 | qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); | ||
| 4301 | return 0; | 4280 | return 0; |
| 4302 | } | 4281 | } |
| 4303 | 4282 | ||
| @@ -4328,13 +4307,15 @@ EXPORT_SYMBOL_GPL(qeth_setadpparms_change_macaddr); | |||
| 4328 | static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card, | 4307 | static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card, |
| 4329 | struct qeth_reply *reply, unsigned long data) | 4308 | struct qeth_reply *reply, unsigned long data) |
| 4330 | { | 4309 | { |
| 4331 | struct qeth_ipa_cmd *cmd; | 4310 | struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data; |
| 4332 | struct qeth_set_access_ctrl *access_ctrl_req; | 4311 | struct qeth_set_access_ctrl *access_ctrl_req; |
| 4333 | int fallback = *(int *)reply->param; | 4312 | int fallback = *(int *)reply->param; |
| 4334 | 4313 | ||
| 4335 | QETH_CARD_TEXT(card, 4, "setaccb"); | 4314 | QETH_CARD_TEXT(card, 4, "setaccb"); |
| 4315 | if (cmd->hdr.return_code) | ||
| 4316 | return 0; | ||
| 4317 | qeth_setadpparms_inspect_rc(cmd); | ||
| 4336 | 4318 | ||
| 4337 | cmd = (struct qeth_ipa_cmd *) data; | ||
| 4338 | access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl; | 4319 | access_ctrl_req = &cmd->data.setadapterparms.data.set_access_ctrl; |
| 4339 | QETH_DBF_TEXT_(SETUP, 2, "setaccb"); | 4320 | QETH_DBF_TEXT_(SETUP, 2, "setaccb"); |
| 4340 | QETH_DBF_TEXT_(SETUP, 2, "%s", card->gdev->dev.kobj.name); | 4321 | QETH_DBF_TEXT_(SETUP, 2, "%s", card->gdev->dev.kobj.name); |
| @@ -4407,7 +4388,6 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card, | |||
| 4407 | card->options.isolation = card->options.prev_isolation; | 4388 | card->options.isolation = card->options.prev_isolation; |
| 4408 | break; | 4389 | break; |
| 4409 | } | 4390 | } |
| 4410 | qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); | ||
| 4411 | return 0; | 4391 | return 0; |
| 4412 | } | 4392 | } |
| 4413 | 4393 | ||
| @@ -4695,14 +4675,15 @@ out: | |||
| 4695 | static int qeth_setadpparms_query_oat_cb(struct qeth_card *card, | 4675 | static int qeth_setadpparms_query_oat_cb(struct qeth_card *card, |
| 4696 | struct qeth_reply *reply, unsigned long data) | 4676 | struct qeth_reply *reply, unsigned long data) |
| 4697 | { | 4677 | { |
| 4698 | struct qeth_ipa_cmd *cmd; | 4678 | struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data; |
| 4699 | struct qeth_qoat_priv *priv; | 4679 | struct qeth_qoat_priv *priv; |
| 4700 | char *resdata; | 4680 | char *resdata; |
| 4701 | int resdatalen; | 4681 | int resdatalen; |
| 4702 | 4682 | ||
| 4703 | QETH_CARD_TEXT(card, 3, "qoatcb"); | 4683 | QETH_CARD_TEXT(card, 3, "qoatcb"); |
| 4684 | if (qeth_setadpparms_inspect_rc(cmd)) | ||
| 4685 | return 0; | ||
| 4704 | 4686 | ||
| 4705 | cmd = (struct qeth_ipa_cmd *)data; | ||
| 4706 | priv = (struct qeth_qoat_priv *)reply->param; | 4687 | priv = (struct qeth_qoat_priv *)reply->param; |
| 4707 | resdatalen = cmd->data.setadapterparms.hdr.cmdlength; | 4688 | resdatalen = cmd->data.setadapterparms.hdr.cmdlength; |
| 4708 | resdata = (char *)data + 28; | 4689 | resdata = (char *)data + 28; |
| @@ -4796,21 +4777,18 @@ out: | |||
| 4796 | static int qeth_query_card_info_cb(struct qeth_card *card, | 4777 | static int qeth_query_card_info_cb(struct qeth_card *card, |
| 4797 | struct qeth_reply *reply, unsigned long data) | 4778 | struct qeth_reply *reply, unsigned long data) |
| 4798 | { | 4779 | { |
| 4799 | struct qeth_ipa_cmd *cmd; | 4780 | struct carrier_info *carrier_info = (struct carrier_info *)reply->param; |
| 4781 | struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *)data; | ||
| 4800 | struct qeth_query_card_info *card_info; | 4782 | struct qeth_query_card_info *card_info; |
| 4801 | struct carrier_info *carrier_info; | ||
| 4802 | 4783 | ||
| 4803 | QETH_CARD_TEXT(card, 2, "qcrdincb"); | 4784 | QETH_CARD_TEXT(card, 2, "qcrdincb"); |
| 4804 | carrier_info = (struct carrier_info *)reply->param; | 4785 | if (qeth_setadpparms_inspect_rc(cmd)) |
| 4805 | cmd = (struct qeth_ipa_cmd *)data; | 4786 | return 0; |
| 4806 | card_info = &cmd->data.setadapterparms.data.card_info; | ||
| 4807 | if (cmd->data.setadapterparms.hdr.return_code == 0) { | ||
| 4808 | carrier_info->card_type = card_info->card_type; | ||
| 4809 | carrier_info->port_mode = card_info->port_mode; | ||
| 4810 | carrier_info->port_speed = card_info->port_speed; | ||
| 4811 | } | ||
| 4812 | 4787 | ||
| 4813 | qeth_default_setadapterparms_cb(card, reply, (unsigned long) cmd); | 4788 | card_info = &cmd->data.setadapterparms.data.card_info; |
| 4789 | carrier_info->card_type = card_info->card_type; | ||
| 4790 | carrier_info->port_mode = card_info->port_mode; | ||
| 4791 | carrier_info->port_speed = card_info->port_speed; | ||
| 4814 | return 0; | 4792 | return 0; |
| 4815 | } | 4793 | } |
| 4816 | 4794 | ||
| @@ -4857,7 +4835,7 @@ int qeth_vm_request_mac(struct qeth_card *card) | |||
| 4857 | goto out; | 4835 | goto out; |
| 4858 | } | 4836 | } |
| 4859 | 4837 | ||
| 4860 | ccw_device_get_id(CARD_DDEV(card), &id); | 4838 | ccw_device_get_id(CARD_RDEV(card), &id); |
| 4861 | request->resp_buf_len = sizeof(*response); | 4839 | request->resp_buf_len = sizeof(*response); |
| 4862 | request->resp_version = DIAG26C_VERSION2; | 4840 | request->resp_version = DIAG26C_VERSION2; |
| 4863 | request->op_code = DIAG26C_GET_MAC; | 4841 | request->op_code = DIAG26C_GET_MAC; |
| @@ -6563,10 +6541,14 @@ static int __init qeth_core_init(void) | |||
| 6563 | mutex_init(&qeth_mod_mutex); | 6541 | mutex_init(&qeth_mod_mutex); |
| 6564 | 6542 | ||
| 6565 | qeth_wq = create_singlethread_workqueue("qeth_wq"); | 6543 | qeth_wq = create_singlethread_workqueue("qeth_wq"); |
| 6544 | if (!qeth_wq) { | ||
| 6545 | rc = -ENOMEM; | ||
| 6546 | goto out_err; | ||
| 6547 | } | ||
| 6566 | 6548 | ||
| 6567 | rc = qeth_register_dbf_views(); | 6549 | rc = qeth_register_dbf_views(); |
| 6568 | if (rc) | 6550 | if (rc) |
| 6569 | goto out_err; | 6551 | goto dbf_err; |
| 6570 | qeth_core_root_dev = root_device_register("qeth"); | 6552 | qeth_core_root_dev = root_device_register("qeth"); |
| 6571 | rc = PTR_ERR_OR_ZERO(qeth_core_root_dev); | 6553 | rc = PTR_ERR_OR_ZERO(qeth_core_root_dev); |
| 6572 | if (rc) | 6554 | if (rc) |
| @@ -6603,6 +6585,8 @@ slab_err: | |||
| 6603 | root_device_unregister(qeth_core_root_dev); | 6585 | root_device_unregister(qeth_core_root_dev); |
| 6604 | register_err: | 6586 | register_err: |
| 6605 | qeth_unregister_dbf_views(); | 6587 | qeth_unregister_dbf_views(); |
| 6588 | dbf_err: | ||
| 6589 | destroy_workqueue(qeth_wq); | ||
| 6606 | out_err: | 6590 | out_err: |
| 6607 | pr_err("Initializing the qeth device driver failed\n"); | 6591 | pr_err("Initializing the qeth device driver failed\n"); |
| 6608 | return rc; | 6592 | return rc; |
diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h index 619f897b4bb0..f4d1ec0b8f5a 100644 --- a/drivers/s390/net/qeth_core_mpc.h +++ b/drivers/s390/net/qeth_core_mpc.h | |||
| @@ -35,6 +35,18 @@ extern unsigned char IPA_PDU_HEADER[]; | |||
| 35 | #define QETH_HALT_CHANNEL_PARM -11 | 35 | #define QETH_HALT_CHANNEL_PARM -11 |
| 36 | #define QETH_RCD_PARM -12 | 36 | #define QETH_RCD_PARM -12 |
| 37 | 37 | ||
| 38 | static inline bool qeth_intparm_is_iob(unsigned long intparm) | ||
| 39 | { | ||
| 40 | switch (intparm) { | ||
| 41 | case QETH_CLEAR_CHANNEL_PARM: | ||
| 42 | case QETH_HALT_CHANNEL_PARM: | ||
| 43 | case QETH_RCD_PARM: | ||
| 44 | case 0: | ||
| 45 | return false; | ||
| 46 | } | ||
| 47 | return true; | ||
| 48 | } | ||
| 49 | |||
| 38 | /*****************************************************************************/ | 50 | /*****************************************************************************/ |
| 39 | /* IP Assist related definitions */ | 51 | /* IP Assist related definitions */ |
| 40 | /*****************************************************************************/ | 52 | /*****************************************************************************/ |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 2ad6f12f3d49..b8079f2a65b3 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
| @@ -121,13 +121,10 @@ static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac) | |||
| 121 | QETH_CARD_TEXT(card, 2, "L2Setmac"); | 121 | QETH_CARD_TEXT(card, 2, "L2Setmac"); |
| 122 | rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC); | 122 | rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC); |
| 123 | if (rc == 0) { | 123 | if (rc == 0) { |
| 124 | card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; | ||
| 125 | ether_addr_copy(card->dev->dev_addr, mac); | ||
| 126 | dev_info(&card->gdev->dev, | 124 | dev_info(&card->gdev->dev, |
| 127 | "MAC address %pM successfully registered on device %s\n", | 125 | "MAC address %pM successfully registered on device %s\n", |
| 128 | card->dev->dev_addr, card->dev->name); | 126 | mac, card->dev->name); |
| 129 | } else { | 127 | } else { |
| 130 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; | ||
| 131 | switch (rc) { | 128 | switch (rc) { |
| 132 | case -EEXIST: | 129 | case -EEXIST: |
| 133 | dev_warn(&card->gdev->dev, | 130 | dev_warn(&card->gdev->dev, |
| @@ -142,19 +139,6 @@ static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac) | |||
| 142 | return rc; | 139 | return rc; |
| 143 | } | 140 | } |
| 144 | 141 | ||
| 145 | static int qeth_l2_send_delmac(struct qeth_card *card, __u8 *mac) | ||
| 146 | { | ||
| 147 | int rc; | ||
| 148 | |||
| 149 | QETH_CARD_TEXT(card, 2, "L2Delmac"); | ||
| 150 | if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED)) | ||
| 151 | return 0; | ||
| 152 | rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELVMAC); | ||
| 153 | if (rc == 0) | ||
| 154 | card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; | ||
| 155 | return rc; | ||
| 156 | } | ||
| 157 | |||
| 158 | static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac) | 142 | static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac) |
| 159 | { | 143 | { |
| 160 | enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ? | 144 | enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ? |
| @@ -519,6 +503,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) | |||
| 519 | { | 503 | { |
| 520 | struct sockaddr *addr = p; | 504 | struct sockaddr *addr = p; |
| 521 | struct qeth_card *card = dev->ml_priv; | 505 | struct qeth_card *card = dev->ml_priv; |
| 506 | u8 old_addr[ETH_ALEN]; | ||
| 522 | int rc = 0; | 507 | int rc = 0; |
| 523 | 508 | ||
| 524 | QETH_CARD_TEXT(card, 3, "setmac"); | 509 | QETH_CARD_TEXT(card, 3, "setmac"); |
| @@ -530,14 +515,35 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) | |||
| 530 | return -EOPNOTSUPP; | 515 | return -EOPNOTSUPP; |
| 531 | } | 516 | } |
| 532 | QETH_CARD_HEX(card, 3, addr->sa_data, ETH_ALEN); | 517 | QETH_CARD_HEX(card, 3, addr->sa_data, ETH_ALEN); |
| 518 | if (!is_valid_ether_addr(addr->sa_data)) | ||
| 519 | return -EADDRNOTAVAIL; | ||
| 520 | |||
| 533 | if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) { | 521 | if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) { |
| 534 | QETH_CARD_TEXT(card, 3, "setmcREC"); | 522 | QETH_CARD_TEXT(card, 3, "setmcREC"); |
| 535 | return -ERESTARTSYS; | 523 | return -ERESTARTSYS; |
| 536 | } | 524 | } |
| 537 | rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]); | 525 | |
| 538 | if (!rc || (rc == -ENOENT)) | 526 | if (!qeth_card_hw_is_reachable(card)) { |
| 539 | rc = qeth_l2_send_setmac(card, addr->sa_data); | 527 | ether_addr_copy(dev->dev_addr, addr->sa_data); |
| 540 | return rc ? -EINVAL : 0; | 528 | return 0; |
| 529 | } | ||
| 530 | |||
| 531 | /* don't register the same address twice */ | ||
| 532 | if (ether_addr_equal_64bits(dev->dev_addr, addr->sa_data) && | ||
| 533 | (card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED)) | ||
| 534 | return 0; | ||
| 535 | |||
| 536 | /* add the new address, switch over, drop the old */ | ||
| 537 | rc = qeth_l2_send_setmac(card, addr->sa_data); | ||
| 538 | if (rc) | ||
| 539 | return rc; | ||
| 540 | ether_addr_copy(old_addr, dev->dev_addr); | ||
| 541 | ether_addr_copy(dev->dev_addr, addr->sa_data); | ||
| 542 | |||
| 543 | if (card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED) | ||
| 544 | qeth_l2_remove_mac(card, old_addr); | ||
| 545 | card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; | ||
| 546 | return 0; | ||
| 541 | } | 547 | } |
| 542 | 548 | ||
| 543 | static void qeth_promisc_to_bridge(struct qeth_card *card) | 549 | static void qeth_promisc_to_bridge(struct qeth_card *card) |
| @@ -1067,8 +1073,9 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
| 1067 | goto out_remove; | 1073 | goto out_remove; |
| 1068 | } | 1074 | } |
| 1069 | 1075 | ||
| 1070 | if (card->info.type != QETH_CARD_TYPE_OSN) | 1076 | if (card->info.type != QETH_CARD_TYPE_OSN && |
| 1071 | qeth_l2_send_setmac(card, &card->dev->dev_addr[0]); | 1077 | !qeth_l2_send_setmac(card, card->dev->dev_addr)) |
| 1078 | card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; | ||
| 1072 | 1079 | ||
| 1073 | if (qeth_is_diagass_supported(card, QETH_DIAGS_CMD_TRAP)) { | 1080 | if (qeth_is_diagass_supported(card, QETH_DIAGS_CMD_TRAP)) { |
| 1074 | if (card->info.hwtrap && | 1081 | if (card->info.hwtrap && |
| @@ -1338,8 +1345,8 @@ static int qeth_osn_send_control_data(struct qeth_card *card, int len, | |||
| 1338 | qeth_prepare_control_data(card, len, iob); | 1345 | qeth_prepare_control_data(card, len, iob); |
| 1339 | QETH_CARD_TEXT(card, 6, "osnoirqp"); | 1346 | QETH_CARD_TEXT(card, 6, "osnoirqp"); |
| 1340 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); | 1347 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); |
| 1341 | rc = ccw_device_start(card->write.ccwdev, &card->write.ccw, | 1348 | rc = ccw_device_start_timeout(CARD_WDEV(card), &card->write.ccw, |
| 1342 | (addr_t) iob, 0, 0); | 1349 | (addr_t) iob, 0, 0, QETH_IPA_TIMEOUT); |
| 1343 | spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); | 1350 | spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); |
| 1344 | if (rc) { | 1351 | if (rc) { |
| 1345 | QETH_DBF_MESSAGE(2, "qeth_osn_send_control_data: " | 1352 | QETH_DBF_MESSAGE(2, "qeth_osn_send_control_data: " |
diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index abddde11982b..98597b59c12a 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c | |||
| @@ -296,7 +296,7 @@ int fnic_get_stats_data(struct stats_debug_info *debug, | |||
| 296 | "Number of Abort FW Timeouts: %lld\n" | 296 | "Number of Abort FW Timeouts: %lld\n" |
| 297 | "Number of Abort IO NOT Found: %lld\n" | 297 | "Number of Abort IO NOT Found: %lld\n" |
| 298 | 298 | ||
| 299 | "Abord issued times: \n" | 299 | "Abort issued times: \n" |
| 300 | " < 6 sec : %lld\n" | 300 | " < 6 sec : %lld\n" |
| 301 | " 6 sec - 20 sec : %lld\n" | 301 | " 6 sec - 20 sec : %lld\n" |
| 302 | " 20 sec - 30 sec : %lld\n" | 302 | " 20 sec - 30 sec : %lld\n" |
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index ce97cde3b41c..f4d988dd1e9d 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c | |||
| @@ -1124,12 +1124,12 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) | |||
| 1124 | goto fail_fw_init; | 1124 | goto fail_fw_init; |
| 1125 | } | 1125 | } |
| 1126 | 1126 | ||
| 1127 | ret = 0; | 1127 | return 0; |
| 1128 | 1128 | ||
| 1129 | fail_fw_init: | 1129 | fail_fw_init: |
| 1130 | dev_err(&instance->pdev->dev, | 1130 | dev_err(&instance->pdev->dev, |
| 1131 | "Init cmd return status %s for SCSI host %d\n", | 1131 | "Init cmd return status FAILED for SCSI host %d\n", |
| 1132 | ret ? "FAILED" : "SUCCESS", instance->host->host_no); | 1132 | instance->host->host_no); |
| 1133 | 1133 | ||
| 1134 | return ret; | 1134 | return ret; |
| 1135 | } | 1135 | } |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 9ef5e3b810f6..656c98e116a9 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
| @@ -234,11 +234,13 @@ static const char *sdebug_version_date = "20180128"; | |||
| 234 | #define F_INV_OP 0x200 | 234 | #define F_INV_OP 0x200 |
| 235 | #define F_FAKE_RW 0x400 | 235 | #define F_FAKE_RW 0x400 |
| 236 | #define F_M_ACCESS 0x800 /* media access */ | 236 | #define F_M_ACCESS 0x800 /* media access */ |
| 237 | #define F_LONG_DELAY 0x1000 | 237 | #define F_SSU_DELAY 0x1000 |
| 238 | #define F_SYNC_DELAY 0x2000 | ||
| 238 | 239 | ||
| 239 | #define FF_RESPOND (F_RL_WLUN_OK | F_SKIP_UA | F_DELAY_OVERR) | 240 | #define FF_RESPOND (F_RL_WLUN_OK | F_SKIP_UA | F_DELAY_OVERR) |
| 240 | #define FF_MEDIA_IO (F_M_ACCESS | F_FAKE_RW) | 241 | #define FF_MEDIA_IO (F_M_ACCESS | F_FAKE_RW) |
| 241 | #define FF_SA (F_SA_HIGH | F_SA_LOW) | 242 | #define FF_SA (F_SA_HIGH | F_SA_LOW) |
| 243 | #define F_LONG_DELAY (F_SSU_DELAY | F_SYNC_DELAY) | ||
| 242 | 244 | ||
| 243 | #define SDEBUG_MAX_PARTS 4 | 245 | #define SDEBUG_MAX_PARTS 4 |
| 244 | 246 | ||
| @@ -510,7 +512,7 @@ static const struct opcode_info_t release_iarr[] = { | |||
| 510 | }; | 512 | }; |
| 511 | 513 | ||
| 512 | static const struct opcode_info_t sync_cache_iarr[] = { | 514 | static const struct opcode_info_t sync_cache_iarr[] = { |
| 513 | {0, 0x91, 0, F_LONG_DELAY | F_M_ACCESS, resp_sync_cache, NULL, | 515 | {0, 0x91, 0, F_SYNC_DELAY | F_M_ACCESS, resp_sync_cache, NULL, |
| 514 | {16, 0x6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 516 | {16, 0x6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 515 | 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc7} }, /* SYNC_CACHE (16) */ | 517 | 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc7} }, /* SYNC_CACHE (16) */ |
| 516 | }; | 518 | }; |
| @@ -553,7 +555,7 @@ static const struct opcode_info_t opcode_info_arr[SDEB_I_LAST_ELEMENT + 1] = { | |||
| 553 | resp_write_dt0, write_iarr, /* WRITE(16) */ | 555 | resp_write_dt0, write_iarr, /* WRITE(16) */ |
| 554 | {16, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 556 | {16, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 555 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7} }, | 557 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7} }, |
| 556 | {0, 0x1b, 0, F_LONG_DELAY, resp_start_stop, NULL,/* START STOP UNIT */ | 558 | {0, 0x1b, 0, F_SSU_DELAY, resp_start_stop, NULL,/* START STOP UNIT */ |
| 557 | {6, 0x1, 0, 0xf, 0xf7, 0xc7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, | 559 | {6, 0x1, 0, 0xf, 0xf7, 0xc7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }, |
| 558 | {ARRAY_SIZE(sa_in_16_iarr), 0x9e, 0x10, F_SA_LOW | F_D_IN, | 560 | {ARRAY_SIZE(sa_in_16_iarr), 0x9e, 0x10, F_SA_LOW | F_D_IN, |
| 559 | resp_readcap16, sa_in_16_iarr, /* SA_IN(16), READ CAPACITY(16) */ | 561 | resp_readcap16, sa_in_16_iarr, /* SA_IN(16), READ CAPACITY(16) */ |
| @@ -606,7 +608,7 @@ static const struct opcode_info_t opcode_info_arr[SDEB_I_LAST_ELEMENT + 1] = { | |||
| 606 | resp_write_same_10, write_same_iarr, /* WRITE SAME(10) */ | 608 | resp_write_same_10, write_same_iarr, /* WRITE SAME(10) */ |
| 607 | {10, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xc7, 0, | 609 | {10, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xc7, 0, |
| 608 | 0, 0, 0, 0, 0} }, | 610 | 0, 0, 0, 0, 0} }, |
| 609 | {ARRAY_SIZE(sync_cache_iarr), 0x35, 0, F_LONG_DELAY | F_M_ACCESS, | 611 | {ARRAY_SIZE(sync_cache_iarr), 0x35, 0, F_SYNC_DELAY | F_M_ACCESS, |
| 610 | resp_sync_cache, sync_cache_iarr, | 612 | resp_sync_cache, sync_cache_iarr, |
| 611 | {10, 0x7, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xc7, 0, 0, | 613 | {10, 0x7, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xc7, 0, 0, |
| 612 | 0, 0, 0, 0} }, /* SYNC_CACHE (10) */ | 614 | 0, 0, 0, 0} }, /* SYNC_CACHE (10) */ |
| @@ -667,6 +669,7 @@ static bool sdebug_strict = DEF_STRICT; | |||
| 667 | static bool sdebug_any_injecting_opt; | 669 | static bool sdebug_any_injecting_opt; |
| 668 | static bool sdebug_verbose; | 670 | static bool sdebug_verbose; |
| 669 | static bool have_dif_prot; | 671 | static bool have_dif_prot; |
| 672 | static bool write_since_sync; | ||
| 670 | static bool sdebug_statistics = DEF_STATISTICS; | 673 | static bool sdebug_statistics = DEF_STATISTICS; |
| 671 | 674 | ||
| 672 | static unsigned int sdebug_store_sectors; | 675 | static unsigned int sdebug_store_sectors; |
| @@ -1607,6 +1610,7 @@ static int resp_start_stop(struct scsi_cmnd *scp, | |||
| 1607 | { | 1610 | { |
| 1608 | unsigned char *cmd = scp->cmnd; | 1611 | unsigned char *cmd = scp->cmnd; |
| 1609 | int power_cond, stop; | 1612 | int power_cond, stop; |
| 1613 | bool changing; | ||
| 1610 | 1614 | ||
| 1611 | power_cond = (cmd[4] & 0xf0) >> 4; | 1615 | power_cond = (cmd[4] & 0xf0) >> 4; |
| 1612 | if (power_cond) { | 1616 | if (power_cond) { |
| @@ -1614,8 +1618,12 @@ static int resp_start_stop(struct scsi_cmnd *scp, | |||
| 1614 | return check_condition_result; | 1618 | return check_condition_result; |
| 1615 | } | 1619 | } |
| 1616 | stop = !(cmd[4] & 1); | 1620 | stop = !(cmd[4] & 1); |
| 1621 | changing = atomic_read(&devip->stopped) == !stop; | ||
| 1617 | atomic_xchg(&devip->stopped, stop); | 1622 | atomic_xchg(&devip->stopped, stop); |
| 1618 | return (cmd[1] & 0x1) ? SDEG_RES_IMMED_MASK : 0; /* check IMMED bit */ | 1623 | if (!changing || cmd[1] & 0x1) /* state unchanged or IMMED set */ |
| 1624 | return SDEG_RES_IMMED_MASK; | ||
| 1625 | else | ||
| 1626 | return 0; | ||
| 1619 | } | 1627 | } |
| 1620 | 1628 | ||
| 1621 | static sector_t get_sdebug_capacity(void) | 1629 | static sector_t get_sdebug_capacity(void) |
| @@ -2473,6 +2481,7 @@ static int do_device_access(struct scsi_cmnd *scmd, u32 sg_skip, u64 lba, | |||
| 2473 | if (do_write) { | 2481 | if (do_write) { |
| 2474 | sdb = scsi_out(scmd); | 2482 | sdb = scsi_out(scmd); |
| 2475 | dir = DMA_TO_DEVICE; | 2483 | dir = DMA_TO_DEVICE; |
| 2484 | write_since_sync = true; | ||
| 2476 | } else { | 2485 | } else { |
| 2477 | sdb = scsi_in(scmd); | 2486 | sdb = scsi_in(scmd); |
| 2478 | dir = DMA_FROM_DEVICE; | 2487 | dir = DMA_FROM_DEVICE; |
| @@ -3583,6 +3592,7 @@ static int resp_get_lba_status(struct scsi_cmnd *scp, | |||
| 3583 | static int resp_sync_cache(struct scsi_cmnd *scp, | 3592 | static int resp_sync_cache(struct scsi_cmnd *scp, |
| 3584 | struct sdebug_dev_info *devip) | 3593 | struct sdebug_dev_info *devip) |
| 3585 | { | 3594 | { |
| 3595 | int res = 0; | ||
| 3586 | u64 lba; | 3596 | u64 lba; |
| 3587 | u32 num_blocks; | 3597 | u32 num_blocks; |
| 3588 | u8 *cmd = scp->cmnd; | 3598 | u8 *cmd = scp->cmnd; |
| @@ -3598,7 +3608,11 @@ static int resp_sync_cache(struct scsi_cmnd *scp, | |||
| 3598 | mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); | 3608 | mk_sense_buffer(scp, ILLEGAL_REQUEST, LBA_OUT_OF_RANGE, 0); |
| 3599 | return check_condition_result; | 3609 | return check_condition_result; |
| 3600 | } | 3610 | } |
| 3601 | return (cmd[1] & 0x2) ? SDEG_RES_IMMED_MASK : 0; /* check IMMED bit */ | 3611 | if (!write_since_sync || cmd[1] & 0x2) |
| 3612 | res = SDEG_RES_IMMED_MASK; | ||
| 3613 | else /* delay if write_since_sync and IMMED clear */ | ||
| 3614 | write_since_sync = false; | ||
| 3615 | return res; | ||
| 3602 | } | 3616 | } |
| 3603 | 3617 | ||
| 3604 | #define RL_BUCKET_ELEMS 8 | 3618 | #define RL_BUCKET_ELEMS 8 |
| @@ -5777,13 +5791,14 @@ fini: | |||
| 5777 | return schedule_resp(scp, devip, errsts, pfp, 0, 0); | 5791 | return schedule_resp(scp, devip, errsts, pfp, 0, 0); |
| 5778 | else if ((sdebug_jdelay || sdebug_ndelay) && (flags & F_LONG_DELAY)) { | 5792 | else if ((sdebug_jdelay || sdebug_ndelay) && (flags & F_LONG_DELAY)) { |
| 5779 | /* | 5793 | /* |
| 5780 | * If any delay is active, want F_LONG_DELAY to be at least 1 | 5794 | * If any delay is active, for F_SSU_DELAY want at least 1 |
| 5781 | * second and if sdebug_jdelay>0 want a long delay of that | 5795 | * second and if sdebug_jdelay>0 want a long delay of that |
| 5782 | * many seconds. | 5796 | * many seconds; for F_SYNC_DELAY want 1/20 of that. |
| 5783 | */ | 5797 | */ |
| 5784 | int jdelay = (sdebug_jdelay < 2) ? 1 : sdebug_jdelay; | 5798 | int jdelay = (sdebug_jdelay < 2) ? 1 : sdebug_jdelay; |
| 5799 | int denom = (flags & F_SYNC_DELAY) ? 20 : 1; | ||
| 5785 | 5800 | ||
| 5786 | jdelay = mult_frac(USER_HZ * jdelay, HZ, USER_HZ); | 5801 | jdelay = mult_frac(USER_HZ * jdelay, HZ, denom * USER_HZ); |
| 5787 | return schedule_resp(scp, devip, errsts, pfp, jdelay, 0); | 5802 | return schedule_resp(scp, devip, errsts, pfp, jdelay, 0); |
| 5788 | } else | 5803 | } else |
| 5789 | return schedule_resp(scp, devip, errsts, pfp, sdebug_jdelay, | 5804 | return schedule_resp(scp, devip, errsts, pfp, sdebug_jdelay, |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index f4b52b44b966..65f6c94f2e9b 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
| @@ -2322,6 +2322,12 @@ iscsi_multicast_skb(struct sk_buff *skb, uint32_t group, gfp_t gfp) | |||
| 2322 | return nlmsg_multicast(nls, skb, 0, group, gfp); | 2322 | return nlmsg_multicast(nls, skb, 0, group, gfp); |
| 2323 | } | 2323 | } |
| 2324 | 2324 | ||
| 2325 | static int | ||
| 2326 | iscsi_unicast_skb(struct sk_buff *skb, u32 portid) | ||
| 2327 | { | ||
| 2328 | return nlmsg_unicast(nls, skb, portid); | ||
| 2329 | } | ||
| 2330 | |||
| 2325 | int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | 2331 | int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, |
| 2326 | char *data, uint32_t data_size) | 2332 | char *data, uint32_t data_size) |
| 2327 | { | 2333 | { |
| @@ -2524,14 +2530,11 @@ void iscsi_ping_comp_event(uint32_t host_no, struct iscsi_transport *transport, | |||
| 2524 | EXPORT_SYMBOL_GPL(iscsi_ping_comp_event); | 2530 | EXPORT_SYMBOL_GPL(iscsi_ping_comp_event); |
| 2525 | 2531 | ||
| 2526 | static int | 2532 | static int |
| 2527 | iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi, | 2533 | iscsi_if_send_reply(u32 portid, int type, void *payload, int size) |
| 2528 | void *payload, int size) | ||
| 2529 | { | 2534 | { |
| 2530 | struct sk_buff *skb; | 2535 | struct sk_buff *skb; |
| 2531 | struct nlmsghdr *nlh; | 2536 | struct nlmsghdr *nlh; |
| 2532 | int len = nlmsg_total_size(size); | 2537 | int len = nlmsg_total_size(size); |
| 2533 | int flags = multi ? NLM_F_MULTI : 0; | ||
| 2534 | int t = done ? NLMSG_DONE : type; | ||
| 2535 | 2538 | ||
| 2536 | skb = alloc_skb(len, GFP_ATOMIC); | 2539 | skb = alloc_skb(len, GFP_ATOMIC); |
| 2537 | if (!skb) { | 2540 | if (!skb) { |
| @@ -2539,10 +2542,9 @@ iscsi_if_send_reply(uint32_t group, int seq, int type, int done, int multi, | |||
| 2539 | return -ENOMEM; | 2542 | return -ENOMEM; |
| 2540 | } | 2543 | } |
| 2541 | 2544 | ||
| 2542 | nlh = __nlmsg_put(skb, 0, 0, t, (len - sizeof(*nlh)), 0); | 2545 | nlh = __nlmsg_put(skb, 0, 0, type, (len - sizeof(*nlh)), 0); |
| 2543 | nlh->nlmsg_flags = flags; | ||
| 2544 | memcpy(nlmsg_data(nlh), payload, size); | 2546 | memcpy(nlmsg_data(nlh), payload, size); |
| 2545 | return iscsi_multicast_skb(skb, group, GFP_ATOMIC); | 2547 | return iscsi_unicast_skb(skb, portid); |
| 2546 | } | 2548 | } |
| 2547 | 2549 | ||
| 2548 | static int | 2550 | static int |
| @@ -3470,6 +3472,7 @@ static int | |||
| 3470 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) | 3472 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) |
| 3471 | { | 3473 | { |
| 3472 | int err = 0; | 3474 | int err = 0; |
| 3475 | u32 portid; | ||
| 3473 | struct iscsi_uevent *ev = nlmsg_data(nlh); | 3476 | struct iscsi_uevent *ev = nlmsg_data(nlh); |
| 3474 | struct iscsi_transport *transport = NULL; | 3477 | struct iscsi_transport *transport = NULL; |
| 3475 | struct iscsi_internal *priv; | 3478 | struct iscsi_internal *priv; |
| @@ -3490,10 +3493,12 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) | |||
| 3490 | if (!try_module_get(transport->owner)) | 3493 | if (!try_module_get(transport->owner)) |
| 3491 | return -EINVAL; | 3494 | return -EINVAL; |
| 3492 | 3495 | ||
| 3496 | portid = NETLINK_CB(skb).portid; | ||
| 3497 | |||
| 3493 | switch (nlh->nlmsg_type) { | 3498 | switch (nlh->nlmsg_type) { |
| 3494 | case ISCSI_UEVENT_CREATE_SESSION: | 3499 | case ISCSI_UEVENT_CREATE_SESSION: |
| 3495 | err = iscsi_if_create_session(priv, ep, ev, | 3500 | err = iscsi_if_create_session(priv, ep, ev, |
| 3496 | NETLINK_CB(skb).portid, | 3501 | portid, |
| 3497 | ev->u.c_session.initial_cmdsn, | 3502 | ev->u.c_session.initial_cmdsn, |
| 3498 | ev->u.c_session.cmds_max, | 3503 | ev->u.c_session.cmds_max, |
| 3499 | ev->u.c_session.queue_depth); | 3504 | ev->u.c_session.queue_depth); |
| @@ -3506,7 +3511,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) | |||
| 3506 | } | 3511 | } |
| 3507 | 3512 | ||
| 3508 | err = iscsi_if_create_session(priv, ep, ev, | 3513 | err = iscsi_if_create_session(priv, ep, ev, |
| 3509 | NETLINK_CB(skb).portid, | 3514 | portid, |
| 3510 | ev->u.c_bound_session.initial_cmdsn, | 3515 | ev->u.c_bound_session.initial_cmdsn, |
| 3511 | ev->u.c_bound_session.cmds_max, | 3516 | ev->u.c_bound_session.cmds_max, |
| 3512 | ev->u.c_bound_session.queue_depth); | 3517 | ev->u.c_bound_session.queue_depth); |
| @@ -3664,6 +3669,8 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) | |||
| 3664 | static void | 3669 | static void |
| 3665 | iscsi_if_rx(struct sk_buff *skb) | 3670 | iscsi_if_rx(struct sk_buff *skb) |
| 3666 | { | 3671 | { |
| 3672 | u32 portid = NETLINK_CB(skb).portid; | ||
| 3673 | |||
| 3667 | mutex_lock(&rx_queue_mutex); | 3674 | mutex_lock(&rx_queue_mutex); |
| 3668 | while (skb->len >= NLMSG_HDRLEN) { | 3675 | while (skb->len >= NLMSG_HDRLEN) { |
| 3669 | int err; | 3676 | int err; |
| @@ -3699,8 +3706,8 @@ iscsi_if_rx(struct sk_buff *skb) | |||
| 3699 | break; | 3706 | break; |
| 3700 | if (ev->type == ISCSI_UEVENT_GET_CHAP && !err) | 3707 | if (ev->type == ISCSI_UEVENT_GET_CHAP && !err) |
| 3701 | break; | 3708 | break; |
| 3702 | err = iscsi_if_send_reply(group, nlh->nlmsg_seq, | 3709 | err = iscsi_if_send_reply(portid, nlh->nlmsg_type, |
| 3703 | nlh->nlmsg_type, 0, 0, ev, sizeof(*ev)); | 3710 | ev, sizeof(*ev)); |
| 3704 | } while (err < 0 && err != -ECONNREFUSED && err != -ESRCH); | 3711 | } while (err < 0 && err != -ECONNREFUSED && err != -ESRCH); |
| 3705 | skb_pull(skb, rlen); | 3712 | skb_pull(skb, rlen); |
| 3706 | } | 3713 | } |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a6201e696ab9..9421d9877730 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -2121,6 +2121,8 @@ sd_spinup_disk(struct scsi_disk *sdkp) | |||
| 2121 | break; /* standby */ | 2121 | break; /* standby */ |
| 2122 | if (sshdr.asc == 4 && sshdr.ascq == 0xc) | 2122 | if (sshdr.asc == 4 && sshdr.ascq == 0xc) |
| 2123 | break; /* unavailable */ | 2123 | break; /* unavailable */ |
| 2124 | if (sshdr.asc == 4 && sshdr.ascq == 0x1b) | ||
| 2125 | break; /* sanitize in progress */ | ||
| 2124 | /* | 2126 | /* |
| 2125 | * Issue command to spin up drive when not ready | 2127 | * Issue command to spin up drive when not ready |
| 2126 | */ | 2128 | */ |
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 41df75eea57b..210407cd2341 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c | |||
| @@ -400,8 +400,10 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf) | |||
| 400 | * | 400 | * |
| 401 | * Check that all zones of the device are equal. The last zone can however | 401 | * Check that all zones of the device are equal. The last zone can however |
| 402 | * be smaller. The zone size must also be a power of two number of LBAs. | 402 | * be smaller. The zone size must also be a power of two number of LBAs. |
| 403 | * | ||
| 404 | * Returns the zone size in bytes upon success or an error code upon failure. | ||
| 403 | */ | 405 | */ |
| 404 | static int sd_zbc_check_zone_size(struct scsi_disk *sdkp) | 406 | static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp) |
| 405 | { | 407 | { |
| 406 | u64 zone_blocks = 0; | 408 | u64 zone_blocks = 0; |
| 407 | sector_t block = 0; | 409 | sector_t block = 0; |
| @@ -412,8 +414,6 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp) | |||
| 412 | int ret; | 414 | int ret; |
| 413 | u8 same; | 415 | u8 same; |
| 414 | 416 | ||
| 415 | sdkp->zone_blocks = 0; | ||
| 416 | |||
| 417 | /* Get a buffer */ | 417 | /* Get a buffer */ |
| 418 | buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL); | 418 | buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL); |
| 419 | if (!buf) | 419 | if (!buf) |
| @@ -445,16 +445,17 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp) | |||
| 445 | 445 | ||
| 446 | /* Parse zone descriptors */ | 446 | /* Parse zone descriptors */ |
| 447 | while (rec < buf + buf_len) { | 447 | while (rec < buf + buf_len) { |
| 448 | zone_blocks = get_unaligned_be64(&rec[8]); | 448 | u64 this_zone_blocks = get_unaligned_be64(&rec[8]); |
| 449 | if (sdkp->zone_blocks == 0) { | 449 | |
| 450 | sdkp->zone_blocks = zone_blocks; | 450 | if (zone_blocks == 0) { |
| 451 | } else if (zone_blocks != sdkp->zone_blocks && | 451 | zone_blocks = this_zone_blocks; |
| 452 | (block + zone_blocks < sdkp->capacity | 452 | } else if (this_zone_blocks != zone_blocks && |
| 453 | || zone_blocks > sdkp->zone_blocks)) { | 453 | (block + this_zone_blocks < sdkp->capacity |
| 454 | zone_blocks = 0; | 454 | || this_zone_blocks > zone_blocks)) { |
| 455 | this_zone_blocks = 0; | ||
| 455 | goto out; | 456 | goto out; |
| 456 | } | 457 | } |
| 457 | block += zone_blocks; | 458 | block += this_zone_blocks; |
| 458 | rec += 64; | 459 | rec += 64; |
| 459 | } | 460 | } |
| 460 | 461 | ||
| @@ -467,8 +468,6 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp) | |||
| 467 | 468 | ||
| 468 | } while (block < sdkp->capacity); | 469 | } while (block < sdkp->capacity); |
| 469 | 470 | ||
| 470 | zone_blocks = sdkp->zone_blocks; | ||
| 471 | |||
| 472 | out: | 471 | out: |
| 473 | if (!zone_blocks) { | 472 | if (!zone_blocks) { |
| 474 | if (sdkp->first_scan) | 473 | if (sdkp->first_scan) |
| @@ -488,8 +487,7 @@ out: | |||
| 488 | "Zone size too large\n"); | 487 | "Zone size too large\n"); |
| 489 | ret = -ENODEV; | 488 | ret = -ENODEV; |
| 490 | } else { | 489 | } else { |
| 491 | sdkp->zone_blocks = zone_blocks; | 490 | ret = zone_blocks; |
| 492 | sdkp->zone_shift = ilog2(zone_blocks); | ||
| 493 | } | 491 | } |
| 494 | 492 | ||
| 495 | out_free: | 493 | out_free: |
| @@ -500,15 +498,14 @@ out_free: | |||
| 500 | 498 | ||
| 501 | /** | 499 | /** |
| 502 | * sd_zbc_alloc_zone_bitmap - Allocate a zone bitmap (one bit per zone). | 500 | * sd_zbc_alloc_zone_bitmap - Allocate a zone bitmap (one bit per zone). |
| 503 | * @sdkp: The disk of the bitmap | 501 | * @nr_zones: Number of zones to allocate space for. |
| 502 | * @numa_node: NUMA node to allocate the memory from. | ||
| 504 | */ | 503 | */ |
| 505 | static inline unsigned long *sd_zbc_alloc_zone_bitmap(struct scsi_disk *sdkp) | 504 | static inline unsigned long * |
| 505 | sd_zbc_alloc_zone_bitmap(u32 nr_zones, int numa_node) | ||
| 506 | { | 506 | { |
| 507 | struct request_queue *q = sdkp->disk->queue; | 507 | return kzalloc_node(BITS_TO_LONGS(nr_zones) * sizeof(unsigned long), |
| 508 | 508 | GFP_KERNEL, numa_node); | |
| 509 | return kzalloc_node(BITS_TO_LONGS(sdkp->nr_zones) | ||
| 510 | * sizeof(unsigned long), | ||
| 511 | GFP_KERNEL, q->node); | ||
| 512 | } | 509 | } |
| 513 | 510 | ||
| 514 | /** | 511 | /** |
| @@ -516,6 +513,7 @@ static inline unsigned long *sd_zbc_alloc_zone_bitmap(struct scsi_disk *sdkp) | |||
| 516 | * @sdkp: disk used | 513 | * @sdkp: disk used |
| 517 | * @buf: report reply buffer | 514 | * @buf: report reply buffer |
| 518 | * @buflen: length of @buf | 515 | * @buflen: length of @buf |
| 516 | * @zone_shift: logarithm base 2 of the number of blocks in a zone | ||
| 519 | * @seq_zones_bitmap: bitmap of sequential zones to set | 517 | * @seq_zones_bitmap: bitmap of sequential zones to set |
| 520 | * | 518 | * |
| 521 | * Parse reported zone descriptors in @buf to identify sequential zones and | 519 | * Parse reported zone descriptors in @buf to identify sequential zones and |
| @@ -525,7 +523,7 @@ static inline unsigned long *sd_zbc_alloc_zone_bitmap(struct scsi_disk *sdkp) | |||
| 525 | * Return the LBA after the last zone reported. | 523 | * Return the LBA after the last zone reported. |
| 526 | */ | 524 | */ |
| 527 | static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf, | 525 | static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf, |
| 528 | unsigned int buflen, | 526 | unsigned int buflen, u32 zone_shift, |
| 529 | unsigned long *seq_zones_bitmap) | 527 | unsigned long *seq_zones_bitmap) |
| 530 | { | 528 | { |
| 531 | sector_t lba, next_lba = sdkp->capacity; | 529 | sector_t lba, next_lba = sdkp->capacity; |
| @@ -544,7 +542,7 @@ static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf, | |||
| 544 | if (type != ZBC_ZONE_TYPE_CONV && | 542 | if (type != ZBC_ZONE_TYPE_CONV && |
| 545 | cond != ZBC_ZONE_COND_READONLY && | 543 | cond != ZBC_ZONE_COND_READONLY && |
| 546 | cond != ZBC_ZONE_COND_OFFLINE) | 544 | cond != ZBC_ZONE_COND_OFFLINE) |
| 547 | set_bit(lba >> sdkp->zone_shift, seq_zones_bitmap); | 545 | set_bit(lba >> zone_shift, seq_zones_bitmap); |
| 548 | next_lba = lba + get_unaligned_be64(&rec[8]); | 546 | next_lba = lba + get_unaligned_be64(&rec[8]); |
| 549 | rec += 64; | 547 | rec += 64; |
| 550 | } | 548 | } |
| @@ -553,12 +551,16 @@ static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf, | |||
| 553 | } | 551 | } |
| 554 | 552 | ||
| 555 | /** | 553 | /** |
| 556 | * sd_zbc_setup_seq_zones_bitmap - Initialize the disk seq zone bitmap. | 554 | * sd_zbc_setup_seq_zones_bitmap - Initialize a seq zone bitmap. |
| 557 | * @sdkp: target disk | 555 | * @sdkp: target disk |
| 556 | * @zone_shift: logarithm base 2 of the number of blocks in a zone | ||
| 557 | * @nr_zones: number of zones to set up a seq zone bitmap for | ||
| 558 | * | 558 | * |
| 559 | * Allocate a zone bitmap and initialize it by identifying sequential zones. | 559 | * Allocate a zone bitmap and initialize it by identifying sequential zones. |
| 560 | */ | 560 | */ |
| 561 | static int sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp) | 561 | static unsigned long * |
| 562 | sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp, u32 zone_shift, | ||
| 563 | u32 nr_zones) | ||
| 562 | { | 564 | { |
| 563 | struct request_queue *q = sdkp->disk->queue; | 565 | struct request_queue *q = sdkp->disk->queue; |
| 564 | unsigned long *seq_zones_bitmap; | 566 | unsigned long *seq_zones_bitmap; |
| @@ -566,9 +568,9 @@ static int sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp) | |||
| 566 | unsigned char *buf; | 568 | unsigned char *buf; |
| 567 | int ret = -ENOMEM; | 569 | int ret = -ENOMEM; |
| 568 | 570 | ||
| 569 | seq_zones_bitmap = sd_zbc_alloc_zone_bitmap(sdkp); | 571 | seq_zones_bitmap = sd_zbc_alloc_zone_bitmap(nr_zones, q->node); |
| 570 | if (!seq_zones_bitmap) | 572 | if (!seq_zones_bitmap) |
| 571 | return -ENOMEM; | 573 | return ERR_PTR(-ENOMEM); |
| 572 | 574 | ||
| 573 | buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL); | 575 | buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL); |
| 574 | if (!buf) | 576 | if (!buf) |
| @@ -579,7 +581,7 @@ static int sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp) | |||
| 579 | if (ret) | 581 | if (ret) |
| 580 | goto out; | 582 | goto out; |
| 581 | lba = sd_zbc_get_seq_zones(sdkp, buf, SD_ZBC_BUF_SIZE, | 583 | lba = sd_zbc_get_seq_zones(sdkp, buf, SD_ZBC_BUF_SIZE, |
| 582 | seq_zones_bitmap); | 584 | zone_shift, seq_zones_bitmap); |
| 583 | } | 585 | } |
| 584 | 586 | ||
| 585 | if (lba != sdkp->capacity) { | 587 | if (lba != sdkp->capacity) { |
| @@ -591,12 +593,9 @@ out: | |||
| 591 | kfree(buf); | 593 | kfree(buf); |
| 592 | if (ret) { | 594 | if (ret) { |
| 593 | kfree(seq_zones_bitmap); | 595 | kfree(seq_zones_bitmap); |
| 594 | return ret; | 596 | return ERR_PTR(ret); |
| 595 | } | 597 | } |
| 596 | 598 | return seq_zones_bitmap; | |
| 597 | q->seq_zones_bitmap = seq_zones_bitmap; | ||
| 598 | |||
| 599 | return 0; | ||
| 600 | } | 599 | } |
| 601 | 600 | ||
| 602 | static void sd_zbc_cleanup(struct scsi_disk *sdkp) | 601 | static void sd_zbc_cleanup(struct scsi_disk *sdkp) |
| @@ -612,44 +611,64 @@ static void sd_zbc_cleanup(struct scsi_disk *sdkp) | |||
| 612 | q->nr_zones = 0; | 611 | q->nr_zones = 0; |
| 613 | } | 612 | } |
| 614 | 613 | ||
| 615 | static int sd_zbc_setup(struct scsi_disk *sdkp) | 614 | static int sd_zbc_setup(struct scsi_disk *sdkp, u32 zone_blocks) |
| 616 | { | 615 | { |
| 617 | struct request_queue *q = sdkp->disk->queue; | 616 | struct request_queue *q = sdkp->disk->queue; |
| 617 | u32 zone_shift = ilog2(zone_blocks); | ||
| 618 | u32 nr_zones; | ||
| 618 | int ret; | 619 | int ret; |
| 619 | 620 | ||
| 620 | /* READ16/WRITE16 is mandatory for ZBC disks */ | ||
| 621 | sdkp->device->use_16_for_rw = 1; | ||
| 622 | sdkp->device->use_10_for_rw = 0; | ||
| 623 | |||
| 624 | /* chunk_sectors indicates the zone size */ | 621 | /* chunk_sectors indicates the zone size */ |
| 625 | blk_queue_chunk_sectors(sdkp->disk->queue, | 622 | blk_queue_chunk_sectors(q, |
| 626 | logical_to_sectors(sdkp->device, sdkp->zone_blocks)); | 623 | logical_to_sectors(sdkp->device, zone_blocks)); |
| 627 | sdkp->nr_zones = | 624 | nr_zones = round_up(sdkp->capacity, zone_blocks) >> zone_shift; |
| 628 | round_up(sdkp->capacity, sdkp->zone_blocks) >> sdkp->zone_shift; | ||
| 629 | 625 | ||
| 630 | /* | 626 | /* |
| 631 | * Initialize the device request queue information if the number | 627 | * Initialize the device request queue information if the number |
| 632 | * of zones changed. | 628 | * of zones changed. |
| 633 | */ | 629 | */ |
| 634 | if (sdkp->nr_zones != q->nr_zones) { | 630 | if (nr_zones != sdkp->nr_zones || nr_zones != q->nr_zones) { |
| 635 | 631 | unsigned long *seq_zones_wlock = NULL, *seq_zones_bitmap = NULL; | |
| 636 | sd_zbc_cleanup(sdkp); | 632 | size_t zone_bitmap_size; |
| 637 | 633 | ||
| 638 | q->nr_zones = sdkp->nr_zones; | 634 | if (nr_zones) { |
| 639 | if (sdkp->nr_zones) { | 635 | seq_zones_wlock = sd_zbc_alloc_zone_bitmap(nr_zones, |
| 640 | q->seq_zones_wlock = sd_zbc_alloc_zone_bitmap(sdkp); | 636 | q->node); |
| 641 | if (!q->seq_zones_wlock) { | 637 | if (!seq_zones_wlock) { |
| 642 | ret = -ENOMEM; | 638 | ret = -ENOMEM; |
| 643 | goto err; | 639 | goto err; |
| 644 | } | 640 | } |
| 645 | 641 | ||
| 646 | ret = sd_zbc_setup_seq_zones_bitmap(sdkp); | 642 | seq_zones_bitmap = sd_zbc_setup_seq_zones_bitmap(sdkp, |
| 647 | if (ret) { | 643 | zone_shift, nr_zones); |
| 648 | sd_zbc_cleanup(sdkp); | 644 | if (IS_ERR(seq_zones_bitmap)) { |
| 645 | ret = PTR_ERR(seq_zones_bitmap); | ||
| 646 | kfree(seq_zones_wlock); | ||
| 649 | goto err; | 647 | goto err; |
| 650 | } | 648 | } |
| 651 | } | 649 | } |
| 652 | 650 | zone_bitmap_size = BITS_TO_LONGS(nr_zones) * | |
| 651 | sizeof(unsigned long); | ||
| 652 | blk_mq_freeze_queue(q); | ||
| 653 | if (q->nr_zones != nr_zones) { | ||
| 654 | /* READ16/WRITE16 is mandatory for ZBC disks */ | ||
| 655 | sdkp->device->use_16_for_rw = 1; | ||
| 656 | sdkp->device->use_10_for_rw = 0; | ||
| 657 | |||
| 658 | sdkp->zone_blocks = zone_blocks; | ||
| 659 | sdkp->zone_shift = zone_shift; | ||
| 660 | sdkp->nr_zones = nr_zones; | ||
| 661 | q->nr_zones = nr_zones; | ||
| 662 | swap(q->seq_zones_wlock, seq_zones_wlock); | ||
| 663 | swap(q->seq_zones_bitmap, seq_zones_bitmap); | ||
| 664 | } else if (memcmp(q->seq_zones_bitmap, seq_zones_bitmap, | ||
| 665 | zone_bitmap_size) != 0) { | ||
| 666 | memcpy(q->seq_zones_bitmap, seq_zones_bitmap, | ||
| 667 | zone_bitmap_size); | ||
| 668 | } | ||
| 669 | blk_mq_unfreeze_queue(q); | ||
| 670 | kfree(seq_zones_wlock); | ||
| 671 | kfree(seq_zones_bitmap); | ||
| 653 | } | 672 | } |
| 654 | 673 | ||
| 655 | return 0; | 674 | return 0; |
| @@ -661,6 +680,7 @@ err: | |||
| 661 | 680 | ||
| 662 | int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) | 681 | int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) |
| 663 | { | 682 | { |
| 683 | int64_t zone_blocks; | ||
| 664 | int ret; | 684 | int ret; |
| 665 | 685 | ||
| 666 | if (!sd_is_zoned(sdkp)) | 686 | if (!sd_is_zoned(sdkp)) |
| @@ -697,12 +717,16 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) | |||
| 697 | * Check zone size: only devices with a constant zone size (except | 717 | * Check zone size: only devices with a constant zone size (except |
| 698 | * an eventual last runt zone) that is a power of 2 are supported. | 718 | * an eventual last runt zone) that is a power of 2 are supported. |
| 699 | */ | 719 | */ |
| 700 | ret = sd_zbc_check_zone_size(sdkp); | 720 | zone_blocks = sd_zbc_check_zone_size(sdkp); |
| 701 | if (ret) | 721 | ret = -EFBIG; |
| 722 | if (zone_blocks != (u32)zone_blocks) | ||
| 723 | goto err; | ||
| 724 | ret = zone_blocks; | ||
| 725 | if (ret < 0) | ||
| 702 | goto err; | 726 | goto err; |
| 703 | 727 | ||
| 704 | /* The drive satisfies the kernel restrictions: set it up */ | 728 | /* The drive satisfies the kernel restrictions: set it up */ |
| 705 | ret = sd_zbc_setup(sdkp); | 729 | ret = sd_zbc_setup(sdkp, zone_blocks); |
| 706 | if (ret) | 730 | if (ret) |
| 707 | goto err; | 731 | goto err; |
| 708 | 732 | ||
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c5b1bf1cadcb..00e79057f870 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
| @@ -276,6 +276,35 @@ static inline void ufshcd_remove_non_printable(char *val) | |||
| 276 | *val = ' '; | 276 | *val = ' '; |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag, | ||
| 280 | const char *str) | ||
| 281 | { | ||
| 282 | struct utp_upiu_req *rq = hba->lrb[tag].ucd_req_ptr; | ||
| 283 | |||
| 284 | trace_ufshcd_upiu(dev_name(hba->dev), str, &rq->header, &rq->sc.cdb); | ||
| 285 | } | ||
| 286 | |||
| 287 | static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba, unsigned int tag, | ||
| 288 | const char *str) | ||
| 289 | { | ||
| 290 | struct utp_upiu_req *rq = hba->lrb[tag].ucd_req_ptr; | ||
| 291 | |||
| 292 | trace_ufshcd_upiu(dev_name(hba->dev), str, &rq->header, &rq->qr); | ||
| 293 | } | ||
| 294 | |||
| 295 | static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag, | ||
| 296 | const char *str) | ||
| 297 | { | ||
| 298 | struct utp_task_req_desc *descp; | ||
| 299 | struct utp_upiu_task_req *task_req; | ||
| 300 | int off = (int)tag - hba->nutrs; | ||
| 301 | |||
| 302 | descp = &hba->utmrdl_base_addr[off]; | ||
| 303 | task_req = (struct utp_upiu_task_req *)descp->task_req_upiu; | ||
| 304 | trace_ufshcd_upiu(dev_name(hba->dev), str, &task_req->header, | ||
| 305 | &task_req->input_param1); | ||
| 306 | } | ||
| 307 | |||
| 279 | static void ufshcd_add_command_trace(struct ufs_hba *hba, | 308 | static void ufshcd_add_command_trace(struct ufs_hba *hba, |
| 280 | unsigned int tag, const char *str) | 309 | unsigned int tag, const char *str) |
| 281 | { | 310 | { |
| @@ -285,6 +314,9 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, | |||
| 285 | struct ufshcd_lrb *lrbp; | 314 | struct ufshcd_lrb *lrbp; |
| 286 | int transfer_len = -1; | 315 | int transfer_len = -1; |
| 287 | 316 | ||
| 317 | /* trace UPIU also */ | ||
| 318 | ufshcd_add_cmd_upiu_trace(hba, tag, str); | ||
| 319 | |||
| 288 | if (!trace_ufshcd_command_enabled()) | 320 | if (!trace_ufshcd_command_enabled()) |
| 289 | return; | 321 | return; |
| 290 | 322 | ||
| @@ -2550,6 +2582,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, | |||
| 2550 | 2582 | ||
| 2551 | hba->dev_cmd.complete = &wait; | 2583 | hba->dev_cmd.complete = &wait; |
| 2552 | 2584 | ||
| 2585 | ufshcd_add_query_upiu_trace(hba, tag, "query_send"); | ||
| 2553 | /* Make sure descriptors are ready before ringing the doorbell */ | 2586 | /* Make sure descriptors are ready before ringing the doorbell */ |
| 2554 | wmb(); | 2587 | wmb(); |
| 2555 | spin_lock_irqsave(hba->host->host_lock, flags); | 2588 | spin_lock_irqsave(hba->host->host_lock, flags); |
| @@ -2559,6 +2592,9 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, | |||
| 2559 | 2592 | ||
| 2560 | err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout); | 2593 | err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout); |
| 2561 | 2594 | ||
| 2595 | ufshcd_add_query_upiu_trace(hba, tag, | ||
| 2596 | err ? "query_complete_err" : "query_complete"); | ||
| 2597 | |||
| 2562 | out_put_tag: | 2598 | out_put_tag: |
| 2563 | ufshcd_put_dev_cmd_tag(hba, tag); | 2599 | ufshcd_put_dev_cmd_tag(hba, tag); |
| 2564 | wake_up(&hba->dev_cmd.tag_wq); | 2600 | wake_up(&hba->dev_cmd.tag_wq); |
| @@ -5443,11 +5479,14 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, | |||
| 5443 | 5479 | ||
| 5444 | spin_unlock_irqrestore(host->host_lock, flags); | 5480 | spin_unlock_irqrestore(host->host_lock, flags); |
| 5445 | 5481 | ||
| 5482 | ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_send"); | ||
| 5483 | |||
| 5446 | /* wait until the task management command is completed */ | 5484 | /* wait until the task management command is completed */ |
| 5447 | err = wait_event_timeout(hba->tm_wq, | 5485 | err = wait_event_timeout(hba->tm_wq, |
| 5448 | test_bit(free_slot, &hba->tm_condition), | 5486 | test_bit(free_slot, &hba->tm_condition), |
| 5449 | msecs_to_jiffies(TM_CMD_TIMEOUT)); | 5487 | msecs_to_jiffies(TM_CMD_TIMEOUT)); |
| 5450 | if (!err) { | 5488 | if (!err) { |
| 5489 | ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete_err"); | ||
| 5451 | dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n", | 5490 | dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n", |
| 5452 | __func__, tm_function); | 5491 | __func__, tm_function); |
| 5453 | if (ufshcd_clear_tm_cmd(hba, free_slot)) | 5492 | if (ufshcd_clear_tm_cmd(hba, free_slot)) |
| @@ -5456,6 +5495,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, | |||
| 5456 | err = -ETIMEDOUT; | 5495 | err = -ETIMEDOUT; |
| 5457 | } else { | 5496 | } else { |
| 5458 | err = ufshcd_task_req_compl(hba, free_slot, tm_response); | 5497 | err = ufshcd_task_req_compl(hba, free_slot, tm_response); |
| 5498 | ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete"); | ||
| 5459 | } | 5499 | } |
| 5460 | 5500 | ||
| 5461 | clear_bit(free_slot, &hba->tm_condition); | 5501 | clear_bit(free_slot, &hba->tm_condition); |
diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c index 884419c37e84..457ea1f8db30 100644 --- a/drivers/slimbus/messaging.c +++ b/drivers/slimbus/messaging.c | |||
| @@ -183,7 +183,7 @@ static u16 slim_slicesize(int code) | |||
| 183 | 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7 | 183 | 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7 |
| 184 | }; | 184 | }; |
| 185 | 185 | ||
| 186 | clamp(code, 1, (int)ARRAY_SIZE(sizetocode)); | 186 | code = clamp(code, 1, (int)ARRAY_SIZE(sizetocode)); |
| 187 | 187 | ||
| 188 | return sizetocode[code - 1]; | 188 | return sizetocode[code - 1]; |
| 189 | } | 189 | } |
diff --git a/drivers/soc/bcm/raspberrypi-power.c b/drivers/soc/bcm/raspberrypi-power.c index fe96a8b956fb..f7ed1187518b 100644 --- a/drivers/soc/bcm/raspberrypi-power.c +++ b/drivers/soc/bcm/raspberrypi-power.c | |||
| @@ -45,7 +45,7 @@ struct rpi_power_domains { | |||
| 45 | struct rpi_power_domain_packet { | 45 | struct rpi_power_domain_packet { |
| 46 | u32 domain; | 46 | u32 domain; |
| 47 | u32 on; | 47 | u32 on; |
| 48 | } __packet; | 48 | }; |
| 49 | 49 | ||
| 50 | /* | 50 | /* |
| 51 | * Asks the firmware to enable or disable power on a specific power | 51 | * Asks the firmware to enable or disable power on a specific power |
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6b5300ca44a6..885f5fcead77 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c | |||
| @@ -1390,7 +1390,7 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif, | |||
| 1390 | } | 1390 | } |
| 1391 | 1391 | ||
| 1392 | if (hif_drv->usr_conn_req.ies) { | 1392 | if (hif_drv->usr_conn_req.ies) { |
| 1393 | conn_info.req_ies = kmemdup(conn_info.req_ies, | 1393 | conn_info.req_ies = kmemdup(hif_drv->usr_conn_req.ies, |
| 1394 | hif_drv->usr_conn_req.ies_len, | 1394 | hif_drv->usr_conn_req.ies_len, |
| 1395 | GFP_KERNEL); | 1395 | GFP_KERNEL); |
| 1396 | if (conn_info.req_ies) | 1396 | if (conn_info.req_ies) |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 0d99b242e82e..6cb933ecc084 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
| @@ -890,6 +890,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
| 890 | bytes = min(bytes, data_len); | 890 | bytes = min(bytes, data_len); |
| 891 | 891 | ||
| 892 | if (!bio) { | 892 | if (!bio) { |
| 893 | new_bio: | ||
| 893 | nr_vecs = min_t(int, BIO_MAX_PAGES, nr_pages); | 894 | nr_vecs = min_t(int, BIO_MAX_PAGES, nr_pages); |
| 894 | nr_pages -= nr_vecs; | 895 | nr_pages -= nr_vecs; |
| 895 | /* | 896 | /* |
| @@ -931,6 +932,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
| 931 | * be allocated with pscsi_get_bio() above. | 932 | * be allocated with pscsi_get_bio() above. |
| 932 | */ | 933 | */ |
| 933 | bio = NULL; | 934 | bio = NULL; |
| 935 | goto new_bio; | ||
| 934 | } | 936 | } |
| 935 | 937 | ||
| 936 | data_len -= bytes; | 938 | data_len -= bytes; |
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 3b3e1f6632d7..1dbe27c9946c 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
| @@ -121,6 +121,9 @@ struct gsm_dlci { | |||
| 121 | struct mutex mutex; | 121 | struct mutex mutex; |
| 122 | 122 | ||
| 123 | /* Link layer */ | 123 | /* Link layer */ |
| 124 | int mode; | ||
| 125 | #define DLCI_MODE_ABM 0 /* Normal Asynchronous Balanced Mode */ | ||
| 126 | #define DLCI_MODE_ADM 1 /* Asynchronous Disconnected Mode */ | ||
| 124 | spinlock_t lock; /* Protects the internal state */ | 127 | spinlock_t lock; /* Protects the internal state */ |
| 125 | struct timer_list t1; /* Retransmit timer for SABM and UA */ | 128 | struct timer_list t1; /* Retransmit timer for SABM and UA */ |
| 126 | int retries; | 129 | int retries; |
| @@ -1364,7 +1367,13 @@ retry: | |||
| 1364 | ctrl->data = data; | 1367 | ctrl->data = data; |
| 1365 | ctrl->len = clen; | 1368 | ctrl->len = clen; |
| 1366 | gsm->pending_cmd = ctrl; | 1369 | gsm->pending_cmd = ctrl; |
| 1367 | gsm->cretries = gsm->n2; | 1370 | |
| 1371 | /* If DLCI0 is in ADM mode skip retries, it won't respond */ | ||
| 1372 | if (gsm->dlci[0]->mode == DLCI_MODE_ADM) | ||
| 1373 | gsm->cretries = 1; | ||
| 1374 | else | ||
| 1375 | gsm->cretries = gsm->n2; | ||
| 1376 | |||
| 1368 | mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100); | 1377 | mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100); |
| 1369 | gsm_control_transmit(gsm, ctrl); | 1378 | gsm_control_transmit(gsm, ctrl); |
| 1370 | spin_unlock_irqrestore(&gsm->control_lock, flags); | 1379 | spin_unlock_irqrestore(&gsm->control_lock, flags); |
| @@ -1472,6 +1481,7 @@ static void gsm_dlci_t1(struct timer_list *t) | |||
| 1472 | if (debug & 8) | 1481 | if (debug & 8) |
| 1473 | pr_info("DLCI %d opening in ADM mode.\n", | 1482 | pr_info("DLCI %d opening in ADM mode.\n", |
| 1474 | dlci->addr); | 1483 | dlci->addr); |
| 1484 | dlci->mode = DLCI_MODE_ADM; | ||
| 1475 | gsm_dlci_open(dlci); | 1485 | gsm_dlci_open(dlci); |
| 1476 | } else { | 1486 | } else { |
| 1477 | gsm_dlci_close(dlci); | 1487 | gsm_dlci_close(dlci); |
| @@ -2861,11 +2871,22 @@ static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk) | |||
| 2861 | static int gsm_carrier_raised(struct tty_port *port) | 2871 | static int gsm_carrier_raised(struct tty_port *port) |
| 2862 | { | 2872 | { |
| 2863 | struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port); | 2873 | struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port); |
| 2874 | struct gsm_mux *gsm = dlci->gsm; | ||
| 2875 | |||
| 2864 | /* Not yet open so no carrier info */ | 2876 | /* Not yet open so no carrier info */ |
| 2865 | if (dlci->state != DLCI_OPEN) | 2877 | if (dlci->state != DLCI_OPEN) |
| 2866 | return 0; | 2878 | return 0; |
| 2867 | if (debug & 2) | 2879 | if (debug & 2) |
| 2868 | return 1; | 2880 | return 1; |
| 2881 | |||
| 2882 | /* | ||
| 2883 | * Basic mode with control channel in ADM mode may not respond | ||
| 2884 | * to CMD_MSC at all and modem_rx is empty. | ||
| 2885 | */ | ||
| 2886 | if (gsm->encoding == 0 && gsm->dlci[0]->mode == DLCI_MODE_ADM && | ||
| 2887 | !dlci->modem_rx) | ||
| 2888 | return 1; | ||
| 2889 | |||
| 2869 | return dlci->modem_rx & TIOCM_CD; | 2890 | return dlci->modem_rx & TIOCM_CD; |
| 2870 | } | 2891 | } |
| 2871 | 2892 | ||
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index a24278380fec..22683393a0f2 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c | |||
| @@ -169,7 +169,7 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match) | |||
| 169 | */ | 169 | */ |
| 170 | int __init setup_earlycon(char *buf) | 170 | int __init setup_earlycon(char *buf) |
| 171 | { | 171 | { |
| 172 | const struct earlycon_id *match; | 172 | const struct earlycon_id **p_match; |
| 173 | 173 | ||
| 174 | if (!buf || !buf[0]) | 174 | if (!buf || !buf[0]) |
| 175 | return -EINVAL; | 175 | return -EINVAL; |
| @@ -177,7 +177,9 @@ int __init setup_earlycon(char *buf) | |||
| 177 | if (early_con.flags & CON_ENABLED) | 177 | if (early_con.flags & CON_ENABLED) |
| 178 | return -EALREADY; | 178 | return -EALREADY; |
| 179 | 179 | ||
| 180 | for (match = __earlycon_table; match < __earlycon_table_end; match++) { | 180 | for (p_match = __earlycon_table; p_match < __earlycon_table_end; |
| 181 | p_match++) { | ||
| 182 | const struct earlycon_id *match = *p_match; | ||
| 181 | size_t len = strlen(match->name); | 183 | size_t len = strlen(match->name); |
| 182 | 184 | ||
| 183 | if (strncmp(buf, match->name, len)) | 185 | if (strncmp(buf, match->name, len)) |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 91f3a1a5cb7f..c2fc6bef7a6f 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
| @@ -316,7 +316,7 @@ static u32 imx_uart_readl(struct imx_port *sport, u32 offset) | |||
| 316 | * differ from the value that was last written. As it only | 316 | * differ from the value that was last written. As it only |
| 317 | * clears after being set, reread conditionally. | 317 | * clears after being set, reread conditionally. |
| 318 | */ | 318 | */ |
| 319 | if (sport->ucr2 & UCR2_SRST) | 319 | if (!(sport->ucr2 & UCR2_SRST)) |
| 320 | sport->ucr2 = readl(sport->port.membase + offset); | 320 | sport->ucr2 = readl(sport->port.membase + offset); |
| 321 | return sport->ucr2; | 321 | return sport->ucr2; |
| 322 | break; | 322 | break; |
| @@ -1833,6 +1833,11 @@ static int imx_uart_rs485_config(struct uart_port *port, | |||
| 1833 | rs485conf->flags &= ~SER_RS485_ENABLED; | 1833 | rs485conf->flags &= ~SER_RS485_ENABLED; |
| 1834 | 1834 | ||
| 1835 | if (rs485conf->flags & SER_RS485_ENABLED) { | 1835 | if (rs485conf->flags & SER_RS485_ENABLED) { |
| 1836 | /* Enable receiver if low-active RTS signal is requested */ | ||
| 1837 | if (sport->have_rtscts && !sport->have_rtsgpio && | ||
| 1838 | !(rs485conf->flags & SER_RS485_RTS_ON_SEND)) | ||
| 1839 | rs485conf->flags |= SER_RS485_RX_DURING_TX; | ||
| 1840 | |||
| 1836 | /* disable transmitter */ | 1841 | /* disable transmitter */ |
| 1837 | ucr2 = imx_uart_readl(sport, UCR2); | 1842 | ucr2 = imx_uart_readl(sport, UCR2); |
| 1838 | if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND) | 1843 | if (rs485conf->flags & SER_RS485_RTS_AFTER_SEND) |
| @@ -2265,6 +2270,18 @@ static int imx_uart_probe(struct platform_device *pdev) | |||
| 2265 | (!sport->have_rtscts && !sport->have_rtsgpio)) | 2270 | (!sport->have_rtscts && !sport->have_rtsgpio)) |
| 2266 | dev_err(&pdev->dev, "no RTS control, disabling rs485\n"); | 2271 | dev_err(&pdev->dev, "no RTS control, disabling rs485\n"); |
| 2267 | 2272 | ||
| 2273 | /* | ||
| 2274 | * If using the i.MX UART RTS/CTS control then the RTS (CTS_B) | ||
| 2275 | * signal cannot be set low during transmission in case the | ||
| 2276 | * receiver is off (limitation of the i.MX UART IP). | ||
| 2277 | */ | ||
| 2278 | if (sport->port.rs485.flags & SER_RS485_ENABLED && | ||
| 2279 | sport->have_rtscts && !sport->have_rtsgpio && | ||
| 2280 | (!(sport->port.rs485.flags & SER_RS485_RTS_ON_SEND) && | ||
| 2281 | !(sport->port.rs485.flags & SER_RS485_RX_DURING_TX))) | ||
| 2282 | dev_err(&pdev->dev, | ||
| 2283 | "low-active RTS not possible when receiver is off, enabling receiver\n"); | ||
| 2284 | |||
| 2268 | imx_uart_rs485_config(&sport->port, &sport->port.rs485); | 2285 | imx_uart_rs485_config(&sport->port, &sport->port.rs485); |
| 2269 | 2286 | ||
| 2270 | /* Disable interrupts before requesting them */ | 2287 | /* Disable interrupts before requesting them */ |
diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c index 750e5645dc85..f503fab1e268 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c | |||
| @@ -495,7 +495,6 @@ static void mvebu_uart_set_termios(struct uart_port *port, | |||
| 495 | termios->c_iflag |= old->c_iflag & ~(INPCK | IGNPAR); | 495 | termios->c_iflag |= old->c_iflag & ~(INPCK | IGNPAR); |
| 496 | termios->c_cflag &= CREAD | CBAUD; | 496 | termios->c_cflag &= CREAD | CBAUD; |
| 497 | termios->c_cflag |= old->c_cflag & ~(CREAD | CBAUD); | 497 | termios->c_cflag |= old->c_cflag & ~(CREAD | CBAUD); |
| 498 | termios->c_lflag = old->c_lflag; | ||
| 499 | } | 498 | } |
| 500 | 499 | ||
| 501 | spin_unlock_irqrestore(&port->lock, flags); | 500 | spin_unlock_irqrestore(&port->lock, flags); |
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 65ff669373d4..a1b3eb04cb32 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c | |||
| @@ -1022,6 +1022,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) | |||
| 1022 | struct qcom_geni_serial_port *port; | 1022 | struct qcom_geni_serial_port *port; |
| 1023 | struct uart_port *uport; | 1023 | struct uart_port *uport; |
| 1024 | struct resource *res; | 1024 | struct resource *res; |
| 1025 | int irq; | ||
| 1025 | 1026 | ||
| 1026 | if (pdev->dev.of_node) | 1027 | if (pdev->dev.of_node) |
| 1027 | line = of_alias_get_id(pdev->dev.of_node, "serial"); | 1028 | line = of_alias_get_id(pdev->dev.of_node, "serial"); |
| @@ -1061,11 +1062,12 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) | |||
| 1061 | port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; | 1062 | port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; |
| 1062 | port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; | 1063 | port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; |
| 1063 | 1064 | ||
| 1064 | uport->irq = platform_get_irq(pdev, 0); | 1065 | irq = platform_get_irq(pdev, 0); |
| 1065 | if (uport->irq < 0) { | 1066 | if (irq < 0) { |
| 1066 | dev_err(&pdev->dev, "Failed to get IRQ %d\n", uport->irq); | 1067 | dev_err(&pdev->dev, "Failed to get IRQ %d\n", irq); |
| 1067 | return uport->irq; | 1068 | return irq; |
| 1068 | } | 1069 | } |
| 1070 | uport->irq = irq; | ||
| 1069 | 1071 | ||
| 1070 | uport->private_data = &qcom_geni_console_driver; | 1072 | uport->private_data = &qcom_geni_console_driver; |
| 1071 | platform_set_drvdata(pdev, port); | 1073 | platform_set_drvdata(pdev, port); |
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index abcb4d09a2d8..bd72dd843338 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
| @@ -1181,7 +1181,7 @@ static int __init cdns_early_console_setup(struct earlycon_device *device, | |||
| 1181 | /* only set baud if specified on command line - otherwise | 1181 | /* only set baud if specified on command line - otherwise |
| 1182 | * assume it has been initialized by a boot loader. | 1182 | * assume it has been initialized by a boot loader. |
| 1183 | */ | 1183 | */ |
| 1184 | if (device->baud) { | 1184 | if (port->uartclk && device->baud) { |
| 1185 | u32 cd = 0, bdiv = 0; | 1185 | u32 cd = 0, bdiv = 0; |
| 1186 | u32 mr; | 1186 | u32 mr; |
| 1187 | int div8; | 1187 | int div8; |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 63114ea35ec1..7c838b90a31d 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
| @@ -2816,7 +2816,10 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx) | |||
| 2816 | 2816 | ||
| 2817 | kref_init(&tty->kref); | 2817 | kref_init(&tty->kref); |
| 2818 | tty->magic = TTY_MAGIC; | 2818 | tty->magic = TTY_MAGIC; |
| 2819 | tty_ldisc_init(tty); | 2819 | if (tty_ldisc_init(tty)) { |
| 2820 | kfree(tty); | ||
| 2821 | return NULL; | ||
| 2822 | } | ||
| 2820 | tty->session = NULL; | 2823 | tty->session = NULL; |
| 2821 | tty->pgrp = NULL; | 2824 | tty->pgrp = NULL; |
| 2822 | mutex_init(&tty->legacy_mutex); | 2825 | mutex_init(&tty->legacy_mutex); |
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 050f4d650891..fb7329ab2b37 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
| @@ -176,12 +176,11 @@ static struct tty_ldisc *tty_ldisc_get(struct tty_struct *tty, int disc) | |||
| 176 | return ERR_CAST(ldops); | 176 | return ERR_CAST(ldops); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | ld = kmalloc(sizeof(struct tty_ldisc), GFP_KERNEL); | 179 | /* |
| 180 | if (ld == NULL) { | 180 | * There is no way to handle allocation failure of only 16 bytes. |
| 181 | put_ldops(ldops); | 181 | * Let's simplify error handling and save more memory. |
| 182 | return ERR_PTR(-ENOMEM); | 182 | */ |
| 183 | } | 183 | ld = kmalloc(sizeof(struct tty_ldisc), GFP_KERNEL | __GFP_NOFAIL); |
| 184 | |||
| 185 | ld->ops = ldops; | 184 | ld->ops = ldops; |
| 186 | ld->tty = tty; | 185 | ld->tty = tty; |
| 187 | 186 | ||
| @@ -527,19 +526,16 @@ static int tty_ldisc_failto(struct tty_struct *tty, int ld) | |||
| 527 | static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) | 526 | static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) |
| 528 | { | 527 | { |
| 529 | /* There is an outstanding reference here so this is safe */ | 528 | /* There is an outstanding reference here so this is safe */ |
| 530 | old = tty_ldisc_get(tty, old->ops->num); | 529 | if (tty_ldisc_failto(tty, old->ops->num) < 0) { |
| 531 | WARN_ON(IS_ERR(old)); | 530 | const char *name = tty_name(tty); |
| 532 | tty->ldisc = old; | 531 | |
| 533 | tty_set_termios_ldisc(tty, old->ops->num); | 532 | pr_warn("Falling back ldisc for %s.\n", name); |
| 534 | if (tty_ldisc_open(tty, old) < 0) { | ||
| 535 | tty_ldisc_put(old); | ||
| 536 | /* The traditional behaviour is to fall back to N_TTY, we | 533 | /* The traditional behaviour is to fall back to N_TTY, we |
| 537 | want to avoid falling back to N_NULL unless we have no | 534 | want to avoid falling back to N_NULL unless we have no |
| 538 | choice to avoid the risk of breaking anything */ | 535 | choice to avoid the risk of breaking anything */ |
| 539 | if (tty_ldisc_failto(tty, N_TTY) < 0 && | 536 | if (tty_ldisc_failto(tty, N_TTY) < 0 && |
| 540 | tty_ldisc_failto(tty, N_NULL) < 0) | 537 | tty_ldisc_failto(tty, N_NULL) < 0) |
| 541 | panic("Couldn't open N_NULL ldisc for %s.", | 538 | panic("Couldn't open N_NULL ldisc for %s.", name); |
| 542 | tty_name(tty)); | ||
| 543 | } | 539 | } |
| 544 | } | 540 | } |
| 545 | 541 | ||
| @@ -824,12 +820,13 @@ EXPORT_SYMBOL_GPL(tty_ldisc_release); | |||
| 824 | * the tty structure is not completely set up when this call is made. | 820 | * the tty structure is not completely set up when this call is made. |
| 825 | */ | 821 | */ |
| 826 | 822 | ||
| 827 | void tty_ldisc_init(struct tty_struct *tty) | 823 | int tty_ldisc_init(struct tty_struct *tty) |
| 828 | { | 824 | { |
| 829 | struct tty_ldisc *ld = tty_ldisc_get(tty, N_TTY); | 825 | struct tty_ldisc *ld = tty_ldisc_get(tty, N_TTY); |
| 830 | if (IS_ERR(ld)) | 826 | if (IS_ERR(ld)) |
| 831 | panic("n_tty: init_tty"); | 827 | return PTR_ERR(ld); |
| 832 | tty->ldisc = ld; | 828 | tty->ldisc = ld; |
| 829 | return 0; | ||
| 833 | } | 830 | } |
| 834 | 831 | ||
| 835 | /** | 832 | /** |
diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index f695a7e8c314..c690d100adcd 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | * # echo -n "ed963694-e847-4b2a-85af-bc9cfc11d6f3" \ | 19 | * # echo -n "ed963694-e847-4b2a-85af-bc9cfc11d6f3" \ |
| 20 | * > /sys/bus/vmbus/drivers/uio_hv_generic/bind | 20 | * > /sys/bus/vmbus/drivers/uio_hv_generic/bind |
| 21 | */ | 21 | */ |
| 22 | 22 | #define DEBUG 1 | |
| 23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 24 | 24 | ||
| 25 | #include <linux/device.h> | 25 | #include <linux/device.h> |
| @@ -94,10 +94,11 @@ hv_uio_irqcontrol(struct uio_info *info, s32 irq_state) | |||
| 94 | */ | 94 | */ |
| 95 | static void hv_uio_channel_cb(void *context) | 95 | static void hv_uio_channel_cb(void *context) |
| 96 | { | 96 | { |
| 97 | struct hv_uio_private_data *pdata = context; | 97 | struct vmbus_channel *chan = context; |
| 98 | struct hv_device *dev = pdata->device; | 98 | struct hv_device *hv_dev = chan->device_obj; |
| 99 | struct hv_uio_private_data *pdata = hv_get_drvdata(hv_dev); | ||
| 99 | 100 | ||
| 100 | dev->channel->inbound.ring_buffer->interrupt_mask = 1; | 101 | chan->inbound.ring_buffer->interrupt_mask = 1; |
| 101 | virt_mb(); | 102 | virt_mb(); |
| 102 | 103 | ||
| 103 | uio_event_notify(&pdata->info); | 104 | uio_event_notify(&pdata->info); |
| @@ -121,78 +122,46 @@ static void hv_uio_rescind(struct vmbus_channel *channel) | |||
| 121 | uio_event_notify(&pdata->info); | 122 | uio_event_notify(&pdata->info); |
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | /* | 125 | /* Sysfs API to allow mmap of the ring buffers |
| 125 | * Handle fault when looking for sub channel ring buffer | 126 | * The ring buffer is allocated as contiguous memory by vmbus_open |
| 126 | * Subchannel ring buffer is same as resource 0 which is main ring buffer | ||
| 127 | * This is derived from uio_vma_fault | ||
| 128 | */ | 127 | */ |
| 129 | static int hv_uio_vma_fault(struct vm_fault *vmf) | ||
| 130 | { | ||
| 131 | struct vm_area_struct *vma = vmf->vma; | ||
| 132 | void *ring_buffer = vma->vm_private_data; | ||
| 133 | struct page *page; | ||
| 134 | void *addr; | ||
| 135 | |||
| 136 | addr = ring_buffer + (vmf->pgoff << PAGE_SHIFT); | ||
| 137 | page = virt_to_page(addr); | ||
| 138 | get_page(page); | ||
| 139 | vmf->page = page; | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 143 | static const struct vm_operations_struct hv_uio_vm_ops = { | ||
| 144 | .fault = hv_uio_vma_fault, | ||
| 145 | }; | ||
| 146 | |||
| 147 | /* Sysfs API to allow mmap of the ring buffers */ | ||
| 148 | static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj, | 128 | static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj, |
| 149 | struct bin_attribute *attr, | 129 | struct bin_attribute *attr, |
| 150 | struct vm_area_struct *vma) | 130 | struct vm_area_struct *vma) |
| 151 | { | 131 | { |
| 152 | struct vmbus_channel *channel | 132 | struct vmbus_channel *channel |
| 153 | = container_of(kobj, struct vmbus_channel, kobj); | 133 | = container_of(kobj, struct vmbus_channel, kobj); |
| 154 | unsigned long requested_pages, actual_pages; | 134 | struct hv_device *dev = channel->primary_channel->device_obj; |
| 155 | 135 | u16 q_idx = channel->offermsg.offer.sub_channel_index; | |
| 156 | if (vma->vm_end < vma->vm_start) | ||
| 157 | return -EINVAL; | ||
| 158 | |||
| 159 | /* only allow 0 for now */ | ||
| 160 | if (vma->vm_pgoff > 0) | ||
| 161 | return -EINVAL; | ||
| 162 | 136 | ||
| 163 | requested_pages = vma_pages(vma); | 137 | dev_dbg(&dev->device, "mmap channel %u pages %#lx at %#lx\n", |
| 164 | actual_pages = 2 * HV_RING_SIZE; | 138 | q_idx, vma_pages(vma), vma->vm_pgoff); |
| 165 | if (requested_pages > actual_pages) | ||
| 166 | return -EINVAL; | ||
| 167 | 139 | ||
| 168 | vma->vm_private_data = channel->ringbuffer_pages; | 140 | return vm_iomap_memory(vma, virt_to_phys(channel->ringbuffer_pages), |
| 169 | vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; | 141 | channel->ringbuffer_pagecount << PAGE_SHIFT); |
| 170 | vma->vm_ops = &hv_uio_vm_ops; | ||
| 171 | return 0; | ||
| 172 | } | 142 | } |
| 173 | 143 | ||
| 174 | static struct bin_attribute ring_buffer_bin_attr __ro_after_init = { | 144 | static const struct bin_attribute ring_buffer_bin_attr = { |
| 175 | .attr = { | 145 | .attr = { |
| 176 | .name = "ring", | 146 | .name = "ring", |
| 177 | .mode = 0600, | 147 | .mode = 0600, |
| 178 | /* size is set at init time */ | ||
| 179 | }, | 148 | }, |
| 149 | .size = 2 * HV_RING_SIZE * PAGE_SIZE, | ||
| 180 | .mmap = hv_uio_ring_mmap, | 150 | .mmap = hv_uio_ring_mmap, |
| 181 | }; | 151 | }; |
| 182 | 152 | ||
| 183 | /* Callback from VMBUS subystem when new channel created. */ | 153 | /* Callback from VMBUS subsystem when new channel created. */ |
| 184 | static void | 154 | static void |
| 185 | hv_uio_new_channel(struct vmbus_channel *new_sc) | 155 | hv_uio_new_channel(struct vmbus_channel *new_sc) |
| 186 | { | 156 | { |
| 187 | struct hv_device *hv_dev = new_sc->primary_channel->device_obj; | 157 | struct hv_device *hv_dev = new_sc->primary_channel->device_obj; |
| 188 | struct device *device = &hv_dev->device; | 158 | struct device *device = &hv_dev->device; |
| 189 | struct hv_uio_private_data *pdata = hv_get_drvdata(hv_dev); | ||
| 190 | const size_t ring_bytes = HV_RING_SIZE * PAGE_SIZE; | 159 | const size_t ring_bytes = HV_RING_SIZE * PAGE_SIZE; |
| 191 | int ret; | 160 | int ret; |
| 192 | 161 | ||
| 193 | /* Create host communication ring */ | 162 | /* Create host communication ring */ |
| 194 | ret = vmbus_open(new_sc, ring_bytes, ring_bytes, NULL, 0, | 163 | ret = vmbus_open(new_sc, ring_bytes, ring_bytes, NULL, 0, |
| 195 | hv_uio_channel_cb, pdata); | 164 | hv_uio_channel_cb, new_sc); |
| 196 | if (ret) { | 165 | if (ret) { |
| 197 | dev_err(device, "vmbus_open subchannel failed: %d\n", ret); | 166 | dev_err(device, "vmbus_open subchannel failed: %d\n", ret); |
| 198 | return; | 167 | return; |
| @@ -234,7 +203,7 @@ hv_uio_probe(struct hv_device *dev, | |||
| 234 | 203 | ||
| 235 | ret = vmbus_open(dev->channel, HV_RING_SIZE * PAGE_SIZE, | 204 | ret = vmbus_open(dev->channel, HV_RING_SIZE * PAGE_SIZE, |
| 236 | HV_RING_SIZE * PAGE_SIZE, NULL, 0, | 205 | HV_RING_SIZE * PAGE_SIZE, NULL, 0, |
| 237 | hv_uio_channel_cb, pdata); | 206 | hv_uio_channel_cb, dev->channel); |
| 238 | if (ret) | 207 | if (ret) |
| 239 | goto fail; | 208 | goto fail; |
| 240 | 209 | ||
| @@ -326,6 +295,11 @@ hv_uio_probe(struct hv_device *dev, | |||
| 326 | vmbus_set_chn_rescind_callback(dev->channel, hv_uio_rescind); | 295 | vmbus_set_chn_rescind_callback(dev->channel, hv_uio_rescind); |
| 327 | vmbus_set_sc_create_callback(dev->channel, hv_uio_new_channel); | 296 | vmbus_set_sc_create_callback(dev->channel, hv_uio_new_channel); |
| 328 | 297 | ||
| 298 | ret = sysfs_create_bin_file(&dev->channel->kobj, &ring_buffer_bin_attr); | ||
| 299 | if (ret) | ||
| 300 | dev_notice(&dev->device, | ||
| 301 | "sysfs create ring bin file failed; %d\n", ret); | ||
| 302 | |||
| 329 | hv_set_drvdata(dev, pdata); | 303 | hv_set_drvdata(dev, pdata); |
| 330 | 304 | ||
| 331 | return 0; | 305 | return 0; |
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 75f7fb151f71..987fc5ba6321 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
| @@ -207,5 +207,6 @@ config USB_ULPI_BUS | |||
| 207 | 207 | ||
| 208 | config USB_ROLE_SWITCH | 208 | config USB_ROLE_SWITCH |
| 209 | tristate | 209 | tristate |
| 210 | select USB_COMMON | ||
| 210 | 211 | ||
| 211 | endif # USB_SUPPORT | 212 | endif # USB_SUPPORT |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 777036ae6367..0a42c5df3c0f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -2262,7 +2262,8 @@ int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg) | |||
| 2262 | hcd->state = HC_STATE_SUSPENDED; | 2262 | hcd->state = HC_STATE_SUSPENDED; |
| 2263 | 2263 | ||
| 2264 | if (!PMSG_IS_AUTO(msg)) | 2264 | if (!PMSG_IS_AUTO(msg)) |
| 2265 | usb_phy_roothub_power_off(hcd->phy_roothub); | 2265 | usb_phy_roothub_suspend(hcd->self.sysdev, |
| 2266 | hcd->phy_roothub); | ||
| 2266 | 2267 | ||
| 2267 | /* Did we race with a root-hub wakeup event? */ | 2268 | /* Did we race with a root-hub wakeup event? */ |
| 2268 | if (rhdev->do_remote_wakeup) { | 2269 | if (rhdev->do_remote_wakeup) { |
| @@ -2302,7 +2303,8 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
| 2302 | } | 2303 | } |
| 2303 | 2304 | ||
| 2304 | if (!PMSG_IS_AUTO(msg)) { | 2305 | if (!PMSG_IS_AUTO(msg)) { |
| 2305 | status = usb_phy_roothub_power_on(hcd->phy_roothub); | 2306 | status = usb_phy_roothub_resume(hcd->self.sysdev, |
| 2307 | hcd->phy_roothub); | ||
| 2306 | if (status) | 2308 | if (status) |
| 2307 | return status; | 2309 | return status; |
| 2308 | } | 2310 | } |
| @@ -2344,7 +2346,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
| 2344 | } | 2346 | } |
| 2345 | } else { | 2347 | } else { |
| 2346 | hcd->state = old_state; | 2348 | hcd->state = old_state; |
| 2347 | usb_phy_roothub_power_off(hcd->phy_roothub); | 2349 | usb_phy_roothub_suspend(hcd->self.sysdev, hcd->phy_roothub); |
| 2348 | dev_dbg(&rhdev->dev, "bus %s fail, err %d\n", | 2350 | dev_dbg(&rhdev->dev, "bus %s fail, err %d\n", |
| 2349 | "resume", status); | 2351 | "resume", status); |
| 2350 | if (status != -ESHUTDOWN) | 2352 | if (status != -ESHUTDOWN) |
| @@ -2377,6 +2379,7 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd) | |||
| 2377 | 2379 | ||
| 2378 | spin_lock_irqsave (&hcd_root_hub_lock, flags); | 2380 | spin_lock_irqsave (&hcd_root_hub_lock, flags); |
| 2379 | if (hcd->rh_registered) { | 2381 | if (hcd->rh_registered) { |
| 2382 | pm_wakeup_event(&hcd->self.root_hub->dev, 0); | ||
| 2380 | set_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); | 2383 | set_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); |
| 2381 | queue_work(pm_wq, &hcd->wakeup_work); | 2384 | queue_work(pm_wq, &hcd->wakeup_work); |
| 2382 | } | 2385 | } |
| @@ -2758,12 +2761,16 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
| 2758 | } | 2761 | } |
| 2759 | 2762 | ||
| 2760 | if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { | 2763 | if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { |
| 2761 | hcd->phy_roothub = usb_phy_roothub_init(hcd->self.sysdev); | 2764 | hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); |
| 2762 | if (IS_ERR(hcd->phy_roothub)) { | 2765 | if (IS_ERR(hcd->phy_roothub)) { |
| 2763 | retval = PTR_ERR(hcd->phy_roothub); | 2766 | retval = PTR_ERR(hcd->phy_roothub); |
| 2764 | goto err_phy_roothub_init; | 2767 | goto err_phy_roothub_alloc; |
| 2765 | } | 2768 | } |
| 2766 | 2769 | ||
| 2770 | retval = usb_phy_roothub_init(hcd->phy_roothub); | ||
| 2771 | if (retval) | ||
| 2772 | goto err_phy_roothub_alloc; | ||
| 2773 | |||
| 2767 | retval = usb_phy_roothub_power_on(hcd->phy_roothub); | 2774 | retval = usb_phy_roothub_power_on(hcd->phy_roothub); |
| 2768 | if (retval) | 2775 | if (retval) |
| 2769 | goto err_usb_phy_roothub_power_on; | 2776 | goto err_usb_phy_roothub_power_on; |
| @@ -2936,7 +2943,7 @@ err_create_buf: | |||
| 2936 | usb_phy_roothub_power_off(hcd->phy_roothub); | 2943 | usb_phy_roothub_power_off(hcd->phy_roothub); |
| 2937 | err_usb_phy_roothub_power_on: | 2944 | err_usb_phy_roothub_power_on: |
| 2938 | usb_phy_roothub_exit(hcd->phy_roothub); | 2945 | usb_phy_roothub_exit(hcd->phy_roothub); |
| 2939 | err_phy_roothub_init: | 2946 | err_phy_roothub_alloc: |
| 2940 | if (hcd->remove_phy && hcd->usb_phy) { | 2947 | if (hcd->remove_phy && hcd->usb_phy) { |
| 2941 | usb_phy_shutdown(hcd->usb_phy); | 2948 | usb_phy_shutdown(hcd->usb_phy); |
| 2942 | usb_put_phy(hcd->usb_phy); | 2949 | usb_put_phy(hcd->usb_phy); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index f6ea16e9f6bb..aa9968d90a48 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -653,12 +653,17 @@ void usb_wakeup_notification(struct usb_device *hdev, | |||
| 653 | unsigned int portnum) | 653 | unsigned int portnum) |
| 654 | { | 654 | { |
| 655 | struct usb_hub *hub; | 655 | struct usb_hub *hub; |
| 656 | struct usb_port *port_dev; | ||
| 656 | 657 | ||
| 657 | if (!hdev) | 658 | if (!hdev) |
| 658 | return; | 659 | return; |
| 659 | 660 | ||
| 660 | hub = usb_hub_to_struct_hub(hdev); | 661 | hub = usb_hub_to_struct_hub(hdev); |
| 661 | if (hub) { | 662 | if (hub) { |
| 663 | port_dev = hub->ports[portnum - 1]; | ||
| 664 | if (port_dev && port_dev->child) | ||
| 665 | pm_wakeup_event(&port_dev->child->dev, 0); | ||
| 666 | |||
| 662 | set_bit(portnum, hub->wakeup_bits); | 667 | set_bit(portnum, hub->wakeup_bits); |
| 663 | kick_hub_wq(hub); | 668 | kick_hub_wq(hub); |
| 664 | } | 669 | } |
| @@ -3434,8 +3439,11 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) | |||
| 3434 | 3439 | ||
| 3435 | /* Skip the initial Clear-Suspend step for a remote wakeup */ | 3440 | /* Skip the initial Clear-Suspend step for a remote wakeup */ |
| 3436 | status = hub_port_status(hub, port1, &portstatus, &portchange); | 3441 | status = hub_port_status(hub, port1, &portstatus, &portchange); |
| 3437 | if (status == 0 && !port_is_suspended(hub, portstatus)) | 3442 | if (status == 0 && !port_is_suspended(hub, portstatus)) { |
| 3443 | if (portchange & USB_PORT_STAT_C_SUSPEND) | ||
| 3444 | pm_wakeup_event(&udev->dev, 0); | ||
| 3438 | goto SuspendCleared; | 3445 | goto SuspendCleared; |
| 3446 | } | ||
| 3439 | 3447 | ||
| 3440 | /* see 7.1.7.7; affects power usage, but not budgeting */ | 3448 | /* see 7.1.7.7; affects power usage, but not budgeting */ |
| 3441 | if (hub_is_superspeed(hub->hdev)) | 3449 | if (hub_is_superspeed(hub->hdev)) |
diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c index 09b7c43c0ea4..9879767452a2 100644 --- a/drivers/usb/core/phy.c +++ b/drivers/usb/core/phy.c | |||
| @@ -19,19 +19,6 @@ struct usb_phy_roothub { | |||
| 19 | struct list_head list; | 19 | struct list_head list; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | static struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev) | ||
| 23 | { | ||
| 24 | struct usb_phy_roothub *roothub_entry; | ||
| 25 | |||
| 26 | roothub_entry = devm_kzalloc(dev, sizeof(*roothub_entry), GFP_KERNEL); | ||
| 27 | if (!roothub_entry) | ||
| 28 | return ERR_PTR(-ENOMEM); | ||
| 29 | |||
| 30 | INIT_LIST_HEAD(&roothub_entry->list); | ||
| 31 | |||
| 32 | return roothub_entry; | ||
| 33 | } | ||
| 34 | |||
| 35 | static int usb_phy_roothub_add_phy(struct device *dev, int index, | 22 | static int usb_phy_roothub_add_phy(struct device *dev, int index, |
| 36 | struct list_head *list) | 23 | struct list_head *list) |
| 37 | { | 24 | { |
| @@ -45,9 +32,11 @@ static int usb_phy_roothub_add_phy(struct device *dev, int index, | |||
| 45 | return PTR_ERR(phy); | 32 | return PTR_ERR(phy); |
| 46 | } | 33 | } |
| 47 | 34 | ||
| 48 | roothub_entry = usb_phy_roothub_alloc(dev); | 35 | roothub_entry = devm_kzalloc(dev, sizeof(*roothub_entry), GFP_KERNEL); |
| 49 | if (IS_ERR(roothub_entry)) | 36 | if (!roothub_entry) |
| 50 | return PTR_ERR(roothub_entry); | 37 | return -ENOMEM; |
| 38 | |||
| 39 | INIT_LIST_HEAD(&roothub_entry->list); | ||
| 51 | 40 | ||
| 52 | roothub_entry->phy = phy; | 41 | roothub_entry->phy = phy; |
| 53 | 42 | ||
| @@ -56,28 +45,44 @@ static int usb_phy_roothub_add_phy(struct device *dev, int index, | |||
| 56 | return 0; | 45 | return 0; |
| 57 | } | 46 | } |
| 58 | 47 | ||
| 59 | struct usb_phy_roothub *usb_phy_roothub_init(struct device *dev) | 48 | struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev) |
| 60 | { | 49 | { |
| 61 | struct usb_phy_roothub *phy_roothub; | 50 | struct usb_phy_roothub *phy_roothub; |
| 62 | struct usb_phy_roothub *roothub_entry; | ||
| 63 | struct list_head *head; | ||
| 64 | int i, num_phys, err; | 51 | int i, num_phys, err; |
| 65 | 52 | ||
| 53 | if (!IS_ENABLED(CONFIG_GENERIC_PHY)) | ||
| 54 | return NULL; | ||
| 55 | |||
| 66 | num_phys = of_count_phandle_with_args(dev->of_node, "phys", | 56 | num_phys = of_count_phandle_with_args(dev->of_node, "phys", |
| 67 | "#phy-cells"); | 57 | "#phy-cells"); |
| 68 | if (num_phys <= 0) | 58 | if (num_phys <= 0) |
| 69 | return NULL; | 59 | return NULL; |
| 70 | 60 | ||
| 71 | phy_roothub = usb_phy_roothub_alloc(dev); | 61 | phy_roothub = devm_kzalloc(dev, sizeof(*phy_roothub), GFP_KERNEL); |
| 72 | if (IS_ERR(phy_roothub)) | 62 | if (!phy_roothub) |
| 73 | return phy_roothub; | 63 | return ERR_PTR(-ENOMEM); |
| 64 | |||
| 65 | INIT_LIST_HEAD(&phy_roothub->list); | ||
| 74 | 66 | ||
| 75 | for (i = 0; i < num_phys; i++) { | 67 | for (i = 0; i < num_phys; i++) { |
| 76 | err = usb_phy_roothub_add_phy(dev, i, &phy_roothub->list); | 68 | err = usb_phy_roothub_add_phy(dev, i, &phy_roothub->list); |
| 77 | if (err) | 69 | if (err) |
| 78 | goto err_out; | 70 | return ERR_PTR(err); |
| 79 | } | 71 | } |
| 80 | 72 | ||
| 73 | return phy_roothub; | ||
| 74 | } | ||
| 75 | EXPORT_SYMBOL_GPL(usb_phy_roothub_alloc); | ||
| 76 | |||
| 77 | int usb_phy_roothub_init(struct usb_phy_roothub *phy_roothub) | ||
| 78 | { | ||
| 79 | struct usb_phy_roothub *roothub_entry; | ||
| 80 | struct list_head *head; | ||
| 81 | int err; | ||
| 82 | |||
| 83 | if (!phy_roothub) | ||
| 84 | return 0; | ||
| 85 | |||
| 81 | head = &phy_roothub->list; | 86 | head = &phy_roothub->list; |
| 82 | 87 | ||
| 83 | list_for_each_entry(roothub_entry, head, list) { | 88 | list_for_each_entry(roothub_entry, head, list) { |
| @@ -86,14 +91,13 @@ struct usb_phy_roothub *usb_phy_roothub_init(struct device *dev) | |||
| 86 | goto err_exit_phys; | 91 | goto err_exit_phys; |
| 87 | } | 92 | } |
| 88 | 93 | ||
| 89 | return phy_roothub; | 94 | return 0; |
| 90 | 95 | ||
| 91 | err_exit_phys: | 96 | err_exit_phys: |
| 92 | list_for_each_entry_continue_reverse(roothub_entry, head, list) | 97 | list_for_each_entry_continue_reverse(roothub_entry, head, list) |
| 93 | phy_exit(roothub_entry->phy); | 98 | phy_exit(roothub_entry->phy); |
| 94 | 99 | ||
| 95 | err_out: | 100 | return err; |
| 96 | return ERR_PTR(err); | ||
| 97 | } | 101 | } |
| 98 | EXPORT_SYMBOL_GPL(usb_phy_roothub_init); | 102 | EXPORT_SYMBOL_GPL(usb_phy_roothub_init); |
| 99 | 103 | ||
| @@ -111,7 +115,7 @@ int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub) | |||
| 111 | list_for_each_entry(roothub_entry, head, list) { | 115 | list_for_each_entry(roothub_entry, head, list) { |
| 112 | err = phy_exit(roothub_entry->phy); | 116 | err = phy_exit(roothub_entry->phy); |
| 113 | if (err) | 117 | if (err) |
| 114 | ret = ret; | 118 | ret = err; |
| 115 | } | 119 | } |
| 116 | 120 | ||
| 117 | return ret; | 121 | return ret; |
| @@ -156,3 +160,38 @@ void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub) | |||
| 156 | phy_power_off(roothub_entry->phy); | 160 | phy_power_off(roothub_entry->phy); |
| 157 | } | 161 | } |
| 158 | EXPORT_SYMBOL_GPL(usb_phy_roothub_power_off); | 162 | EXPORT_SYMBOL_GPL(usb_phy_roothub_power_off); |
| 163 | |||
| 164 | int usb_phy_roothub_suspend(struct device *controller_dev, | ||
| 165 | struct usb_phy_roothub *phy_roothub) | ||
| 166 | { | ||
| 167 | usb_phy_roothub_power_off(phy_roothub); | ||
| 168 | |||
| 169 | /* keep the PHYs initialized so the device can wake up the system */ | ||
| 170 | if (device_may_wakeup(controller_dev)) | ||
| 171 | return 0; | ||
| 172 | |||
| 173 | return usb_phy_roothub_exit(phy_roothub); | ||
| 174 | } | ||
| 175 | EXPORT_SYMBOL_GPL(usb_phy_roothub_suspend); | ||
| 176 | |||
| 177 | int usb_phy_roothub_resume(struct device *controller_dev, | ||
| 178 | struct usb_phy_roothub *phy_roothub) | ||
| 179 | { | ||
| 180 | int err; | ||
| 181 | |||
| 182 | /* if the device can't wake up the system _exit was called */ | ||
| 183 | if (!device_may_wakeup(controller_dev)) { | ||
| 184 | err = usb_phy_roothub_init(phy_roothub); | ||
| 185 | if (err) | ||
| 186 | return err; | ||
| 187 | } | ||
| 188 | |||
| 189 | err = usb_phy_roothub_power_on(phy_roothub); | ||
| 190 | |||
| 191 | /* undo _init if _power_on failed */ | ||
| 192 | if (err && !device_may_wakeup(controller_dev)) | ||
| 193 | usb_phy_roothub_exit(phy_roothub); | ||
| 194 | |||
| 195 | return err; | ||
| 196 | } | ||
| 197 | EXPORT_SYMBOL_GPL(usb_phy_roothub_resume); | ||
diff --git a/drivers/usb/core/phy.h b/drivers/usb/core/phy.h index 6fde59bfbff8..88a3c037e9df 100644 --- a/drivers/usb/core/phy.h +++ b/drivers/usb/core/phy.h | |||
| @@ -1,7 +1,27 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0+ */ | ||
| 2 | /* | ||
| 3 | * USB roothub wrapper | ||
| 4 | * | ||
| 5 | * Copyright (C) 2018 Martin Blumenstingl <martin.blumenstingl@googlemail.com> | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef __USB_CORE_PHY_H_ | ||
| 9 | #define __USB_CORE_PHY_H_ | ||
| 10 | |||
| 11 | struct device; | ||
| 1 | struct usb_phy_roothub; | 12 | struct usb_phy_roothub; |
| 2 | 13 | ||
| 3 | struct usb_phy_roothub *usb_phy_roothub_init(struct device *dev); | 14 | struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev); |
| 15 | |||
| 16 | int usb_phy_roothub_init(struct usb_phy_roothub *phy_roothub); | ||
| 4 | int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub); | 17 | int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub); |
| 5 | 18 | ||
| 6 | int usb_phy_roothub_power_on(struct usb_phy_roothub *phy_roothub); | 19 | int usb_phy_roothub_power_on(struct usb_phy_roothub *phy_roothub); |
| 7 | void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub); | 20 | void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub); |
| 21 | |||
| 22 | int usb_phy_roothub_suspend(struct device *controller_dev, | ||
| 23 | struct usb_phy_roothub *phy_roothub); | ||
| 24 | int usb_phy_roothub_resume(struct device *controller_dev, | ||
| 25 | struct usb_phy_roothub *phy_roothub); | ||
| 26 | |||
| 27 | #endif /* __USB_CORE_PHY_H_ */ | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 920f48a49a87..c55def2f1320 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
| @@ -186,6 +186,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
| 186 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = | 186 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = |
| 187 | USB_QUIRK_STRING_FETCH_255 }, | 187 | USB_QUIRK_STRING_FETCH_255 }, |
| 188 | 188 | ||
| 189 | /* HP v222w 16GB Mini USB Drive */ | ||
| 190 | { USB_DEVICE(0x03f0, 0x3f40), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
| 191 | |||
| 189 | /* Creative SB Audigy 2 NX */ | 192 | /* Creative SB Audigy 2 NX */ |
| 190 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, | 193 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 191 | 194 | ||
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c index 48779c44c361..eb494ec547e8 100644 --- a/drivers/usb/host/xhci-dbgtty.c +++ b/drivers/usb/host/xhci-dbgtty.c | |||
| @@ -320,9 +320,11 @@ int xhci_dbc_tty_register_driver(struct xhci_hcd *xhci) | |||
| 320 | 320 | ||
| 321 | void xhci_dbc_tty_unregister_driver(void) | 321 | void xhci_dbc_tty_unregister_driver(void) |
| 322 | { | 322 | { |
| 323 | tty_unregister_driver(dbc_tty_driver); | 323 | if (dbc_tty_driver) { |
| 324 | put_tty_driver(dbc_tty_driver); | 324 | tty_unregister_driver(dbc_tty_driver); |
| 325 | dbc_tty_driver = NULL; | 325 | put_tty_driver(dbc_tty_driver); |
| 326 | dbc_tty_driver = NULL; | ||
| 327 | } | ||
| 326 | } | 328 | } |
| 327 | 329 | ||
| 328 | static void dbc_rx_push(unsigned long _port) | 330 | static void dbc_rx_push(unsigned long _port) |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index f17b7eab66cf..85ffda85f8ab 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
| @@ -126,7 +126,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
| 126 | if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) | 126 | if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) |
| 127 | xhci->quirks |= XHCI_AMD_PLL_FIX; | 127 | xhci->quirks |= XHCI_AMD_PLL_FIX; |
| 128 | 128 | ||
| 129 | if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43bb) | 129 | if (pdev->vendor == PCI_VENDOR_ID_AMD && |
| 130 | (pdev->device == 0x15e0 || | ||
| 131 | pdev->device == 0x15e1 || | ||
| 132 | pdev->device == 0x43bb)) | ||
| 130 | xhci->quirks |= XHCI_SUSPEND_DELAY; | 133 | xhci->quirks |= XHCI_SUSPEND_DELAY; |
| 131 | 134 | ||
| 132 | if (pdev->vendor == PCI_VENDOR_ID_AMD) | 135 | if (pdev->vendor == PCI_VENDOR_ID_AMD) |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index df327dcc2bac..c1b22fc64e38 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
| @@ -157,6 +157,7 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
| 157 | struct resource *res; | 157 | struct resource *res; |
| 158 | struct usb_hcd *hcd; | 158 | struct usb_hcd *hcd; |
| 159 | struct clk *clk; | 159 | struct clk *clk; |
| 160 | struct clk *reg_clk; | ||
| 160 | int ret; | 161 | int ret; |
| 161 | int irq; | 162 | int irq; |
| 162 | 163 | ||
| @@ -226,17 +227,27 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
| 226 | hcd->rsrc_len = resource_size(res); | 227 | hcd->rsrc_len = resource_size(res); |
| 227 | 228 | ||
| 228 | /* | 229 | /* |
| 229 | * Not all platforms have a clk so it is not an error if the | 230 | * Not all platforms have clks so it is not an error if the |
| 230 | * clock does not exists. | 231 | * clock do not exist. |
| 231 | */ | 232 | */ |
| 233 | reg_clk = devm_clk_get(&pdev->dev, "reg"); | ||
| 234 | if (!IS_ERR(reg_clk)) { | ||
| 235 | ret = clk_prepare_enable(reg_clk); | ||
| 236 | if (ret) | ||
| 237 | goto put_hcd; | ||
| 238 | } else if (PTR_ERR(reg_clk) == -EPROBE_DEFER) { | ||
| 239 | ret = -EPROBE_DEFER; | ||
| 240 | goto put_hcd; | ||
| 241 | } | ||
| 242 | |||
| 232 | clk = devm_clk_get(&pdev->dev, NULL); | 243 | clk = devm_clk_get(&pdev->dev, NULL); |
| 233 | if (!IS_ERR(clk)) { | 244 | if (!IS_ERR(clk)) { |
| 234 | ret = clk_prepare_enable(clk); | 245 | ret = clk_prepare_enable(clk); |
| 235 | if (ret) | 246 | if (ret) |
| 236 | goto put_hcd; | 247 | goto disable_reg_clk; |
| 237 | } else if (PTR_ERR(clk) == -EPROBE_DEFER) { | 248 | } else if (PTR_ERR(clk) == -EPROBE_DEFER) { |
| 238 | ret = -EPROBE_DEFER; | 249 | ret = -EPROBE_DEFER; |
| 239 | goto put_hcd; | 250 | goto disable_reg_clk; |
| 240 | } | 251 | } |
| 241 | 252 | ||
| 242 | xhci = hcd_to_xhci(hcd); | 253 | xhci = hcd_to_xhci(hcd); |
| @@ -252,6 +263,7 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
| 252 | device_wakeup_enable(hcd->self.controller); | 263 | device_wakeup_enable(hcd->self.controller); |
| 253 | 264 | ||
| 254 | xhci->clk = clk; | 265 | xhci->clk = clk; |
| 266 | xhci->reg_clk = reg_clk; | ||
| 255 | xhci->main_hcd = hcd; | 267 | xhci->main_hcd = hcd; |
| 256 | xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, | 268 | xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, |
| 257 | dev_name(&pdev->dev), hcd); | 269 | dev_name(&pdev->dev), hcd); |
| @@ -320,8 +332,10 @@ put_usb3_hcd: | |||
| 320 | usb_put_hcd(xhci->shared_hcd); | 332 | usb_put_hcd(xhci->shared_hcd); |
| 321 | 333 | ||
| 322 | disable_clk: | 334 | disable_clk: |
| 323 | if (!IS_ERR(clk)) | 335 | clk_disable_unprepare(clk); |
| 324 | clk_disable_unprepare(clk); | 336 | |
| 337 | disable_reg_clk: | ||
| 338 | clk_disable_unprepare(reg_clk); | ||
| 325 | 339 | ||
| 326 | put_hcd: | 340 | put_hcd: |
| 327 | usb_put_hcd(hcd); | 341 | usb_put_hcd(hcd); |
| @@ -338,6 +352,7 @@ static int xhci_plat_remove(struct platform_device *dev) | |||
| 338 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 352 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
| 339 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 353 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 340 | struct clk *clk = xhci->clk; | 354 | struct clk *clk = xhci->clk; |
| 355 | struct clk *reg_clk = xhci->reg_clk; | ||
| 341 | 356 | ||
| 342 | xhci->xhc_state |= XHCI_STATE_REMOVING; | 357 | xhci->xhc_state |= XHCI_STATE_REMOVING; |
| 343 | 358 | ||
| @@ -347,8 +362,8 @@ static int xhci_plat_remove(struct platform_device *dev) | |||
| 347 | usb_remove_hcd(hcd); | 362 | usb_remove_hcd(hcd); |
| 348 | usb_put_hcd(xhci->shared_hcd); | 363 | usb_put_hcd(xhci->shared_hcd); |
| 349 | 364 | ||
| 350 | if (!IS_ERR(clk)) | 365 | clk_disable_unprepare(clk); |
| 351 | clk_disable_unprepare(clk); | 366 | clk_disable_unprepare(reg_clk); |
| 352 | usb_put_hcd(hcd); | 367 | usb_put_hcd(hcd); |
| 353 | 368 | ||
| 354 | pm_runtime_set_suspended(&dev->dev); | 369 | pm_runtime_set_suspended(&dev->dev); |
| @@ -420,7 +435,6 @@ MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match); | |||
| 420 | static struct platform_driver usb_xhci_driver = { | 435 | static struct platform_driver usb_xhci_driver = { |
| 421 | .probe = xhci_plat_probe, | 436 | .probe = xhci_plat_probe, |
| 422 | .remove = xhci_plat_remove, | 437 | .remove = xhci_plat_remove, |
| 423 | .shutdown = usb_hcd_platform_shutdown, | ||
| 424 | .driver = { | 438 | .driver = { |
| 425 | .name = "xhci-hcd", | 439 | .name = "xhci-hcd", |
| 426 | .pm = &xhci_plat_pm_ops, | 440 | .pm = &xhci_plat_pm_ops, |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 05c909b04f14..6dfc4867dbcf 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
| @@ -1729,8 +1729,9 @@ struct xhci_hcd { | |||
| 1729 | int page_shift; | 1729 | int page_shift; |
| 1730 | /* msi-x vectors */ | 1730 | /* msi-x vectors */ |
| 1731 | int msix_count; | 1731 | int msix_count; |
| 1732 | /* optional clock */ | 1732 | /* optional clocks */ |
| 1733 | struct clk *clk; | 1733 | struct clk *clk; |
| 1734 | struct clk *reg_clk; | ||
| 1734 | /* data structures */ | 1735 | /* data structures */ |
| 1735 | struct xhci_device_context_array *dcbaa; | 1736 | struct xhci_device_context_array *dcbaa; |
| 1736 | struct xhci_ring *cmd_ring; | 1737 | struct xhci_ring *cmd_ring; |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 05a679d5e3a2..6a60bc0490c5 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
| @@ -451,7 +451,6 @@ static int dsps_musb_init(struct musb *musb) | |||
| 451 | if (!rev) | 451 | if (!rev) |
| 452 | return -ENODEV; | 452 | return -ENODEV; |
| 453 | 453 | ||
| 454 | usb_phy_init(musb->xceiv); | ||
| 455 | if (IS_ERR(musb->phy)) { | 454 | if (IS_ERR(musb->phy)) { |
| 456 | musb->phy = NULL; | 455 | musb->phy = NULL; |
| 457 | } else { | 456 | } else { |
| @@ -501,7 +500,6 @@ static int dsps_musb_exit(struct musb *musb) | |||
| 501 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 500 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
| 502 | 501 | ||
| 503 | del_timer_sync(&musb->dev_timer); | 502 | del_timer_sync(&musb->dev_timer); |
| 504 | usb_phy_shutdown(musb->xceiv); | ||
| 505 | phy_power_off(musb->phy); | 503 | phy_power_off(musb->phy); |
| 506 | phy_exit(musb->phy); | 504 | phy_exit(musb->phy); |
| 507 | debugfs_remove_recursive(glue->dbgfs_root); | 505 | debugfs_remove_recursive(glue->dbgfs_root); |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 3a8451a15f7f..4fa372c845e1 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
| @@ -2754,6 +2754,7 @@ int musb_host_setup(struct musb *musb, int power_budget) | |||
| 2754 | hcd->self.otg_port = 1; | 2754 | hcd->self.otg_port = 1; |
| 2755 | musb->xceiv->otg->host = &hcd->self; | 2755 | musb->xceiv->otg->host = &hcd->self; |
| 2756 | hcd->power_budget = 2 * (power_budget ? : 250); | 2756 | hcd->power_budget = 2 * (power_budget ? : 250); |
| 2757 | hcd->skip_phy_initialization = 1; | ||
| 2757 | 2758 | ||
| 2758 | ret = usb_add_hcd(hcd, 0, 0); | 2759 | ret = usb_add_hcd(hcd, 0, 0); |
| 2759 | if (ret < 0) | 2760 | if (ret < 0) |
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index a646820f5a78..533f127c30ad 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
| @@ -62,6 +62,7 @@ config USB_SERIAL_SIMPLE | |||
| 62 | - Fundamental Software dongle. | 62 | - Fundamental Software dongle. |
| 63 | - Google USB serial devices | 63 | - Google USB serial devices |
| 64 | - HP4x calculators | 64 | - HP4x calculators |
| 65 | - Libtransistor USB console | ||
| 65 | - a number of Motorola phones | 66 | - a number of Motorola phones |
| 66 | - Motorola Tetra devices | 67 | - Motorola Tetra devices |
| 67 | - Novatel Wireless GPS receivers | 68 | - Novatel Wireless GPS receivers |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index de1e759dd512..eb6c26cbe579 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
| @@ -214,6 +214,7 @@ static const struct usb_device_id id_table[] = { | |||
| 214 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ | 214 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
| 215 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ | 215 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ |
| 216 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ | 216 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ |
| 217 | { USB_DEVICE(0x3923, 0x7A0B) }, /* National Instruments USB Serial Console */ | ||
| 217 | { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ | 218 | { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ |
| 218 | { } /* Terminating Entry */ | 219 | { } /* Terminating Entry */ |
| 219 | }; | 220 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 87202ad5a50d..7ea221d42dba 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -1898,7 +1898,8 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial) | |||
| 1898 | return ftdi_jtag_probe(serial); | 1898 | return ftdi_jtag_probe(serial); |
| 1899 | 1899 | ||
| 1900 | if (udev->product && | 1900 | if (udev->product && |
| 1901 | (!strcmp(udev->product, "BeagleBone/XDS100V2") || | 1901 | (!strcmp(udev->product, "Arrow USB Blaster") || |
| 1902 | !strcmp(udev->product, "BeagleBone/XDS100V2") || | ||
| 1902 | !strcmp(udev->product, "SNAP Connect E10"))) | 1903 | !strcmp(udev->product, "SNAP Connect E10"))) |
| 1903 | return ftdi_jtag_probe(serial); | 1904 | return ftdi_jtag_probe(serial); |
| 1904 | 1905 | ||
diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c index 4ef79e29cb26..40864c2bd9dc 100644 --- a/drivers/usb/serial/usb-serial-simple.c +++ b/drivers/usb/serial/usb-serial-simple.c | |||
| @@ -63,6 +63,11 @@ DEVICE(flashloader, FLASHLOADER_IDS); | |||
| 63 | 0x01) } | 63 | 0x01) } |
| 64 | DEVICE(google, GOOGLE_IDS); | 64 | DEVICE(google, GOOGLE_IDS); |
| 65 | 65 | ||
| 66 | /* Libtransistor USB console */ | ||
| 67 | #define LIBTRANSISTOR_IDS() \ | ||
| 68 | { USB_DEVICE(0x1209, 0x8b00) } | ||
| 69 | DEVICE(libtransistor, LIBTRANSISTOR_IDS); | ||
| 70 | |||
| 66 | /* ViVOpay USB Serial Driver */ | 71 | /* ViVOpay USB Serial Driver */ |
| 67 | #define VIVOPAY_IDS() \ | 72 | #define VIVOPAY_IDS() \ |
| 68 | { USB_DEVICE(0x1d5f, 0x1004) } /* ViVOpay 8800 */ | 73 | { USB_DEVICE(0x1d5f, 0x1004) } /* ViVOpay 8800 */ |
| @@ -110,6 +115,7 @@ static struct usb_serial_driver * const serial_drivers[] = { | |||
| 110 | &funsoft_device, | 115 | &funsoft_device, |
| 111 | &flashloader_device, | 116 | &flashloader_device, |
| 112 | &google_device, | 117 | &google_device, |
| 118 | &libtransistor_device, | ||
| 113 | &vivopay_device, | 119 | &vivopay_device, |
| 114 | &moto_modem_device, | 120 | &moto_modem_device, |
| 115 | &motorola_tetra_device, | 121 | &motorola_tetra_device, |
| @@ -126,6 +132,7 @@ static const struct usb_device_id id_table[] = { | |||
| 126 | FUNSOFT_IDS(), | 132 | FUNSOFT_IDS(), |
| 127 | FLASHLOADER_IDS(), | 133 | FLASHLOADER_IDS(), |
| 128 | GOOGLE_IDS(), | 134 | GOOGLE_IDS(), |
| 135 | LIBTRANSISTOR_IDS(), | ||
| 129 | VIVOPAY_IDS(), | 136 | VIVOPAY_IDS(), |
| 130 | MOTO_IDS(), | 137 | MOTO_IDS(), |
| 131 | MOTOROLA_TETRA_IDS(), | 138 | MOTOROLA_TETRA_IDS(), |
diff --git a/drivers/usb/typec/ucsi/Makefile b/drivers/usb/typec/ucsi/Makefile index b57891c1fd31..7afbea512207 100644 --- a/drivers/usb/typec/ucsi/Makefile +++ b/drivers/usb/typec/ucsi/Makefile | |||
| @@ -5,6 +5,6 @@ obj-$(CONFIG_TYPEC_UCSI) += typec_ucsi.o | |||
| 5 | 5 | ||
| 6 | typec_ucsi-y := ucsi.o | 6 | typec_ucsi-y := ucsi.o |
| 7 | 7 | ||
| 8 | typec_ucsi-$(CONFIG_FTRACE) += trace.o | 8 | typec_ucsi-$(CONFIG_TRACING) += trace.o |
| 9 | 9 | ||
| 10 | obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o | 10 | obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o |
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index bf0977fbd100..bd5cca5632b3 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | * difficult to estimate the time it takes for the system to process the command | 28 | * difficult to estimate the time it takes for the system to process the command |
| 29 | * before it is actually passed to the PPM. | 29 | * before it is actually passed to the PPM. |
| 30 | */ | 30 | */ |
| 31 | #define UCSI_TIMEOUT_MS 1000 | 31 | #define UCSI_TIMEOUT_MS 5000 |
| 32 | 32 | ||
| 33 | /* | 33 | /* |
| 34 | * UCSI_SWAP_TIMEOUT_MS - Timeout for role swap requests | 34 | * UCSI_SWAP_TIMEOUT_MS - Timeout for role swap requests |
diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c index c31c8402a0c5..d41d0cdeec0f 100644 --- a/drivers/usb/usbip/stub_main.c +++ b/drivers/usb/usbip/stub_main.c | |||
| @@ -186,7 +186,12 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf, | |||
| 186 | if (!bid) | 186 | if (!bid) |
| 187 | return -ENODEV; | 187 | return -ENODEV; |
| 188 | 188 | ||
| 189 | /* device_attach() callers should hold parent lock for USB */ | ||
| 190 | if (bid->udev->dev.parent) | ||
| 191 | device_lock(bid->udev->dev.parent); | ||
| 189 | ret = device_attach(&bid->udev->dev); | 192 | ret = device_attach(&bid->udev->dev); |
| 193 | if (bid->udev->dev.parent) | ||
| 194 | device_unlock(bid->udev->dev.parent); | ||
| 190 | if (ret < 0) { | 195 | if (ret < 0) { |
| 191 | dev_err(&bid->udev->dev, "rebind failed\n"); | 196 | dev_err(&bid->udev->dev, "rebind failed\n"); |
| 192 | return ret; | 197 | return ret; |
diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h index 473fb8a87289..bf8afe9b5883 100644 --- a/drivers/usb/usbip/usbip_common.h +++ b/drivers/usb/usbip/usbip_common.h | |||
| @@ -243,7 +243,7 @@ enum usbip_side { | |||
| 243 | #define VUDC_EVENT_ERROR_USB (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) | 243 | #define VUDC_EVENT_ERROR_USB (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) |
| 244 | #define VUDC_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) | 244 | #define VUDC_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) |
| 245 | 245 | ||
| 246 | #define VDEV_EVENT_REMOVED (USBIP_EH_SHUTDOWN | USBIP_EH_BYE) | 246 | #define VDEV_EVENT_REMOVED (USBIP_EH_SHUTDOWN | USBIP_EH_RESET | USBIP_EH_BYE) |
| 247 | #define VDEV_EVENT_DOWN (USBIP_EH_SHUTDOWN | USBIP_EH_RESET) | 247 | #define VDEV_EVENT_DOWN (USBIP_EH_SHUTDOWN | USBIP_EH_RESET) |
| 248 | #define VDEV_EVENT_ERROR_TCP (USBIP_EH_SHUTDOWN | USBIP_EH_RESET) | 248 | #define VDEV_EVENT_ERROR_TCP (USBIP_EH_SHUTDOWN | USBIP_EH_RESET) |
| 249 | #define VDEV_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) | 249 | #define VDEV_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) |
diff --git a/drivers/usb/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c index 5b4c0864ad92..5d88917c9631 100644 --- a/drivers/usb/usbip/usbip_event.c +++ b/drivers/usb/usbip/usbip_event.c | |||
| @@ -91,10 +91,6 @@ static void event_handler(struct work_struct *work) | |||
| 91 | unset_event(ud, USBIP_EH_UNUSABLE); | 91 | unset_event(ud, USBIP_EH_UNUSABLE); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | /* Stop the error handler. */ | ||
| 95 | if (ud->event & USBIP_EH_BYE) | ||
| 96 | usbip_dbg_eh("removed %p\n", ud); | ||
| 97 | |||
| 98 | wake_up(&ud->eh_waitq); | 94 | wake_up(&ud->eh_waitq); |
| 99 | } | 95 | } |
| 100 | } | 96 | } |
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index 20e3d4609583..d11f3f8dad40 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c | |||
| @@ -354,6 +354,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 354 | usbip_dbg_vhci_rh(" ClearHubFeature\n"); | 354 | usbip_dbg_vhci_rh(" ClearHubFeature\n"); |
| 355 | break; | 355 | break; |
| 356 | case ClearPortFeature: | 356 | case ClearPortFeature: |
| 357 | if (rhport < 0) | ||
| 358 | goto error; | ||
| 357 | switch (wValue) { | 359 | switch (wValue) { |
| 358 | case USB_PORT_FEAT_SUSPEND: | 360 | case USB_PORT_FEAT_SUSPEND: |
| 359 | if (hcd->speed == HCD_USB3) { | 361 | if (hcd->speed == HCD_USB3) { |
| @@ -511,11 +513,16 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 511 | goto error; | 513 | goto error; |
| 512 | } | 514 | } |
| 513 | 515 | ||
| 516 | if (rhport < 0) | ||
| 517 | goto error; | ||
| 518 | |||
| 514 | vhci_hcd->port_status[rhport] |= USB_PORT_STAT_SUSPEND; | 519 | vhci_hcd->port_status[rhport] |= USB_PORT_STAT_SUSPEND; |
| 515 | break; | 520 | break; |
| 516 | case USB_PORT_FEAT_POWER: | 521 | case USB_PORT_FEAT_POWER: |
| 517 | usbip_dbg_vhci_rh( | 522 | usbip_dbg_vhci_rh( |
| 518 | " SetPortFeature: USB_PORT_FEAT_POWER\n"); | 523 | " SetPortFeature: USB_PORT_FEAT_POWER\n"); |
| 524 | if (rhport < 0) | ||
| 525 | goto error; | ||
| 519 | if (hcd->speed == HCD_USB3) | 526 | if (hcd->speed == HCD_USB3) |
| 520 | vhci_hcd->port_status[rhport] |= USB_SS_PORT_STAT_POWER; | 527 | vhci_hcd->port_status[rhport] |= USB_SS_PORT_STAT_POWER; |
| 521 | else | 528 | else |
| @@ -524,6 +531,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 524 | case USB_PORT_FEAT_BH_PORT_RESET: | 531 | case USB_PORT_FEAT_BH_PORT_RESET: |
| 525 | usbip_dbg_vhci_rh( | 532 | usbip_dbg_vhci_rh( |
| 526 | " SetPortFeature: USB_PORT_FEAT_BH_PORT_RESET\n"); | 533 | " SetPortFeature: USB_PORT_FEAT_BH_PORT_RESET\n"); |
| 534 | if (rhport < 0) | ||
| 535 | goto error; | ||
| 527 | /* Applicable only for USB3.0 hub */ | 536 | /* Applicable only for USB3.0 hub */ |
| 528 | if (hcd->speed != HCD_USB3) { | 537 | if (hcd->speed != HCD_USB3) { |
| 529 | pr_err("USB_PORT_FEAT_BH_PORT_RESET req not " | 538 | pr_err("USB_PORT_FEAT_BH_PORT_RESET req not " |
| @@ -534,6 +543,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 534 | case USB_PORT_FEAT_RESET: | 543 | case USB_PORT_FEAT_RESET: |
| 535 | usbip_dbg_vhci_rh( | 544 | usbip_dbg_vhci_rh( |
| 536 | " SetPortFeature: USB_PORT_FEAT_RESET\n"); | 545 | " SetPortFeature: USB_PORT_FEAT_RESET\n"); |
| 546 | if (rhport < 0) | ||
| 547 | goto error; | ||
| 537 | /* if it's already enabled, disable */ | 548 | /* if it's already enabled, disable */ |
| 538 | if (hcd->speed == HCD_USB3) { | 549 | if (hcd->speed == HCD_USB3) { |
| 539 | vhci_hcd->port_status[rhport] = 0; | 550 | vhci_hcd->port_status[rhport] = 0; |
| @@ -554,6 +565,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 554 | default: | 565 | default: |
| 555 | usbip_dbg_vhci_rh(" SetPortFeature: default %d\n", | 566 | usbip_dbg_vhci_rh(" SetPortFeature: default %d\n", |
| 556 | wValue); | 567 | wValue); |
| 568 | if (rhport < 0) | ||
| 569 | goto error; | ||
| 557 | if (hcd->speed == HCD_USB3) { | 570 | if (hcd->speed == HCD_USB3) { |
| 558 | if ((vhci_hcd->port_status[rhport] & | 571 | if ((vhci_hcd->port_status[rhport] & |
| 559 | USB_SS_PORT_STAT_POWER) != 0) { | 572 | USB_SS_PORT_STAT_POWER) != 0) { |
diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c index 190dbf8cfcb5..2f3856a95856 100644 --- a/drivers/virt/vboxguest/vboxguest_core.c +++ b/drivers/virt/vboxguest/vboxguest_core.c | |||
| @@ -114,7 +114,7 @@ static void vbg_guest_mappings_init(struct vbg_dev *gdev) | |||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | out: | 116 | out: |
| 117 | kfree(req); | 117 | vbg_req_free(req, sizeof(*req)); |
| 118 | kfree(pages); | 118 | kfree(pages); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| @@ -144,7 +144,7 @@ static void vbg_guest_mappings_exit(struct vbg_dev *gdev) | |||
| 144 | 144 | ||
| 145 | rc = vbg_req_perform(gdev, req); | 145 | rc = vbg_req_perform(gdev, req); |
| 146 | 146 | ||
| 147 | kfree(req); | 147 | vbg_req_free(req, sizeof(*req)); |
| 148 | 148 | ||
| 149 | if (rc < 0) { | 149 | if (rc < 0) { |
| 150 | vbg_err("%s error: %d\n", __func__, rc); | 150 | vbg_err("%s error: %d\n", __func__, rc); |
| @@ -214,8 +214,8 @@ static int vbg_report_guest_info(struct vbg_dev *gdev) | |||
| 214 | ret = vbg_status_code_to_errno(rc); | 214 | ret = vbg_status_code_to_errno(rc); |
| 215 | 215 | ||
| 216 | out_free: | 216 | out_free: |
| 217 | kfree(req2); | 217 | vbg_req_free(req2, sizeof(*req2)); |
| 218 | kfree(req1); | 218 | vbg_req_free(req1, sizeof(*req1)); |
| 219 | return ret; | 219 | return ret; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| @@ -245,7 +245,7 @@ static int vbg_report_driver_status(struct vbg_dev *gdev, bool active) | |||
| 245 | if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */ | 245 | if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */ |
| 246 | rc = VINF_SUCCESS; | 246 | rc = VINF_SUCCESS; |
| 247 | 247 | ||
| 248 | kfree(req); | 248 | vbg_req_free(req, sizeof(*req)); |
| 249 | 249 | ||
| 250 | return vbg_status_code_to_errno(rc); | 250 | return vbg_status_code_to_errno(rc); |
| 251 | } | 251 | } |
| @@ -431,7 +431,7 @@ static int vbg_heartbeat_host_config(struct vbg_dev *gdev, bool enabled) | |||
| 431 | rc = vbg_req_perform(gdev, req); | 431 | rc = vbg_req_perform(gdev, req); |
| 432 | do_div(req->interval_ns, 1000000); /* ns -> ms */ | 432 | do_div(req->interval_ns, 1000000); /* ns -> ms */ |
| 433 | gdev->heartbeat_interval_ms = req->interval_ns; | 433 | gdev->heartbeat_interval_ms = req->interval_ns; |
| 434 | kfree(req); | 434 | vbg_req_free(req, sizeof(*req)); |
| 435 | 435 | ||
| 436 | return vbg_status_code_to_errno(rc); | 436 | return vbg_status_code_to_errno(rc); |
| 437 | } | 437 | } |
| @@ -454,12 +454,6 @@ static int vbg_heartbeat_init(struct vbg_dev *gdev) | |||
| 454 | if (ret < 0) | 454 | if (ret < 0) |
| 455 | return ret; | 455 | return ret; |
| 456 | 456 | ||
| 457 | /* | ||
| 458 | * Preallocate the request to use it from the timer callback because: | ||
| 459 | * 1) on Windows vbg_req_alloc must be called at IRQL <= APC_LEVEL | ||
| 460 | * and the timer callback runs at DISPATCH_LEVEL; | ||
| 461 | * 2) avoid repeated allocations. | ||
| 462 | */ | ||
| 463 | gdev->guest_heartbeat_req = vbg_req_alloc( | 457 | gdev->guest_heartbeat_req = vbg_req_alloc( |
| 464 | sizeof(*gdev->guest_heartbeat_req), | 458 | sizeof(*gdev->guest_heartbeat_req), |
| 465 | VMMDEVREQ_GUEST_HEARTBEAT); | 459 | VMMDEVREQ_GUEST_HEARTBEAT); |
| @@ -481,8 +475,8 @@ static void vbg_heartbeat_exit(struct vbg_dev *gdev) | |||
| 481 | { | 475 | { |
| 482 | del_timer_sync(&gdev->heartbeat_timer); | 476 | del_timer_sync(&gdev->heartbeat_timer); |
| 483 | vbg_heartbeat_host_config(gdev, false); | 477 | vbg_heartbeat_host_config(gdev, false); |
| 484 | kfree(gdev->guest_heartbeat_req); | 478 | vbg_req_free(gdev->guest_heartbeat_req, |
| 485 | 479 | sizeof(*gdev->guest_heartbeat_req)); | |
| 486 | } | 480 | } |
| 487 | 481 | ||
| 488 | /** | 482 | /** |
| @@ -543,7 +537,7 @@ static int vbg_reset_host_event_filter(struct vbg_dev *gdev, | |||
| 543 | if (rc < 0) | 537 | if (rc < 0) |
| 544 | vbg_err("%s error, rc: %d\n", __func__, rc); | 538 | vbg_err("%s error, rc: %d\n", __func__, rc); |
| 545 | 539 | ||
| 546 | kfree(req); | 540 | vbg_req_free(req, sizeof(*req)); |
| 547 | return vbg_status_code_to_errno(rc); | 541 | return vbg_status_code_to_errno(rc); |
| 548 | } | 542 | } |
| 549 | 543 | ||
| @@ -617,7 +611,7 @@ static int vbg_set_session_event_filter(struct vbg_dev *gdev, | |||
| 617 | 611 | ||
| 618 | out: | 612 | out: |
| 619 | mutex_unlock(&gdev->session_mutex); | 613 | mutex_unlock(&gdev->session_mutex); |
| 620 | kfree(req); | 614 | vbg_req_free(req, sizeof(*req)); |
| 621 | 615 | ||
| 622 | return ret; | 616 | return ret; |
| 623 | } | 617 | } |
| @@ -642,7 +636,7 @@ static int vbg_reset_host_capabilities(struct vbg_dev *gdev) | |||
| 642 | if (rc < 0) | 636 | if (rc < 0) |
| 643 | vbg_err("%s error, rc: %d\n", __func__, rc); | 637 | vbg_err("%s error, rc: %d\n", __func__, rc); |
| 644 | 638 | ||
| 645 | kfree(req); | 639 | vbg_req_free(req, sizeof(*req)); |
| 646 | return vbg_status_code_to_errno(rc); | 640 | return vbg_status_code_to_errno(rc); |
| 647 | } | 641 | } |
| 648 | 642 | ||
| @@ -712,7 +706,7 @@ static int vbg_set_session_capabilities(struct vbg_dev *gdev, | |||
| 712 | 706 | ||
| 713 | out: | 707 | out: |
| 714 | mutex_unlock(&gdev->session_mutex); | 708 | mutex_unlock(&gdev->session_mutex); |
| 715 | kfree(req); | 709 | vbg_req_free(req, sizeof(*req)); |
| 716 | 710 | ||
| 717 | return ret; | 711 | return ret; |
| 718 | } | 712 | } |
| @@ -733,8 +727,10 @@ static int vbg_query_host_version(struct vbg_dev *gdev) | |||
| 733 | 727 | ||
| 734 | rc = vbg_req_perform(gdev, req); | 728 | rc = vbg_req_perform(gdev, req); |
| 735 | ret = vbg_status_code_to_errno(rc); | 729 | ret = vbg_status_code_to_errno(rc); |
| 736 | if (ret) | 730 | if (ret) { |
| 731 | vbg_err("%s error: %d\n", __func__, rc); | ||
| 737 | goto out; | 732 | goto out; |
| 733 | } | ||
| 738 | 734 | ||
| 739 | snprintf(gdev->host_version, sizeof(gdev->host_version), "%u.%u.%ur%u", | 735 | snprintf(gdev->host_version, sizeof(gdev->host_version), "%u.%u.%ur%u", |
| 740 | req->major, req->minor, req->build, req->revision); | 736 | req->major, req->minor, req->build, req->revision); |
| @@ -749,7 +745,7 @@ static int vbg_query_host_version(struct vbg_dev *gdev) | |||
| 749 | } | 745 | } |
| 750 | 746 | ||
| 751 | out: | 747 | out: |
| 752 | kfree(req); | 748 | vbg_req_free(req, sizeof(*req)); |
| 753 | return ret; | 749 | return ret; |
| 754 | } | 750 | } |
| 755 | 751 | ||
| @@ -847,11 +843,16 @@ int vbg_core_init(struct vbg_dev *gdev, u32 fixed_events) | |||
| 847 | return 0; | 843 | return 0; |
| 848 | 844 | ||
| 849 | err_free_reqs: | 845 | err_free_reqs: |
| 850 | kfree(gdev->mouse_status_req); | 846 | vbg_req_free(gdev->mouse_status_req, |
| 851 | kfree(gdev->ack_events_req); | 847 | sizeof(*gdev->mouse_status_req)); |
| 852 | kfree(gdev->cancel_req); | 848 | vbg_req_free(gdev->ack_events_req, |
| 853 | kfree(gdev->mem_balloon.change_req); | 849 | sizeof(*gdev->ack_events_req)); |
| 854 | kfree(gdev->mem_balloon.get_req); | 850 | vbg_req_free(gdev->cancel_req, |
| 851 | sizeof(*gdev->cancel_req)); | ||
| 852 | vbg_req_free(gdev->mem_balloon.change_req, | ||
| 853 | sizeof(*gdev->mem_balloon.change_req)); | ||
| 854 | vbg_req_free(gdev->mem_balloon.get_req, | ||
| 855 | sizeof(*gdev->mem_balloon.get_req)); | ||
| 855 | return ret; | 856 | return ret; |
| 856 | } | 857 | } |
| 857 | 858 | ||
| @@ -872,11 +873,16 @@ void vbg_core_exit(struct vbg_dev *gdev) | |||
| 872 | vbg_reset_host_capabilities(gdev); | 873 | vbg_reset_host_capabilities(gdev); |
| 873 | vbg_core_set_mouse_status(gdev, 0); | 874 | vbg_core_set_mouse_status(gdev, 0); |
| 874 | 875 | ||
| 875 | kfree(gdev->mouse_status_req); | 876 | vbg_req_free(gdev->mouse_status_req, |
| 876 | kfree(gdev->ack_events_req); | 877 | sizeof(*gdev->mouse_status_req)); |
| 877 | kfree(gdev->cancel_req); | 878 | vbg_req_free(gdev->ack_events_req, |
| 878 | kfree(gdev->mem_balloon.change_req); | 879 | sizeof(*gdev->ack_events_req)); |
| 879 | kfree(gdev->mem_balloon.get_req); | 880 | vbg_req_free(gdev->cancel_req, |
| 881 | sizeof(*gdev->cancel_req)); | ||
| 882 | vbg_req_free(gdev->mem_balloon.change_req, | ||
| 883 | sizeof(*gdev->mem_balloon.change_req)); | ||
| 884 | vbg_req_free(gdev->mem_balloon.get_req, | ||
| 885 | sizeof(*gdev->mem_balloon.get_req)); | ||
| 880 | } | 886 | } |
| 881 | 887 | ||
| 882 | /** | 888 | /** |
| @@ -1415,7 +1421,7 @@ static int vbg_ioctl_write_core_dump(struct vbg_dev *gdev, | |||
| 1415 | req->flags = dump->u.in.flags; | 1421 | req->flags = dump->u.in.flags; |
| 1416 | dump->hdr.rc = vbg_req_perform(gdev, req); | 1422 | dump->hdr.rc = vbg_req_perform(gdev, req); |
| 1417 | 1423 | ||
| 1418 | kfree(req); | 1424 | vbg_req_free(req, sizeof(*req)); |
| 1419 | return 0; | 1425 | return 0; |
| 1420 | } | 1426 | } |
| 1421 | 1427 | ||
| @@ -1513,7 +1519,7 @@ int vbg_core_set_mouse_status(struct vbg_dev *gdev, u32 features) | |||
| 1513 | if (rc < 0) | 1519 | if (rc < 0) |
| 1514 | vbg_err("%s error, rc: %d\n", __func__, rc); | 1520 | vbg_err("%s error, rc: %d\n", __func__, rc); |
| 1515 | 1521 | ||
| 1516 | kfree(req); | 1522 | vbg_req_free(req, sizeof(*req)); |
| 1517 | return vbg_status_code_to_errno(rc); | 1523 | return vbg_status_code_to_errno(rc); |
| 1518 | } | 1524 | } |
| 1519 | 1525 | ||
diff --git a/drivers/virt/vboxguest/vboxguest_core.h b/drivers/virt/vboxguest/vboxguest_core.h index 6c784bf4fa6d..7ad9ec45bfa9 100644 --- a/drivers/virt/vboxguest/vboxguest_core.h +++ b/drivers/virt/vboxguest/vboxguest_core.h | |||
| @@ -171,4 +171,13 @@ irqreturn_t vbg_core_isr(int irq, void *dev_id); | |||
| 171 | 171 | ||
| 172 | void vbg_linux_mouse_event(struct vbg_dev *gdev); | 172 | void vbg_linux_mouse_event(struct vbg_dev *gdev); |
| 173 | 173 | ||
| 174 | /* Private (non exported) functions form vboxguest_utils.c */ | ||
| 175 | void *vbg_req_alloc(size_t len, enum vmmdev_request_type req_type); | ||
| 176 | void vbg_req_free(void *req, size_t len); | ||
| 177 | int vbg_req_perform(struct vbg_dev *gdev, void *req); | ||
| 178 | int vbg_hgcm_call32( | ||
| 179 | struct vbg_dev *gdev, u32 client_id, u32 function, u32 timeout_ms, | ||
| 180 | struct vmmdev_hgcm_function_parameter32 *parm32, u32 parm_count, | ||
| 181 | int *vbox_status); | ||
| 182 | |||
| 174 | #endif | 183 | #endif |
diff --git a/drivers/virt/vboxguest/vboxguest_linux.c b/drivers/virt/vboxguest/vboxguest_linux.c index 82e280d38cc2..398d22693234 100644 --- a/drivers/virt/vboxguest/vboxguest_linux.c +++ b/drivers/virt/vboxguest/vboxguest_linux.c | |||
| @@ -87,6 +87,7 @@ static long vbg_misc_device_ioctl(struct file *filp, unsigned int req, | |||
| 87 | struct vbg_session *session = filp->private_data; | 87 | struct vbg_session *session = filp->private_data; |
| 88 | size_t returned_size, size; | 88 | size_t returned_size, size; |
| 89 | struct vbg_ioctl_hdr hdr; | 89 | struct vbg_ioctl_hdr hdr; |
| 90 | bool is_vmmdev_req; | ||
| 90 | int ret = 0; | 91 | int ret = 0; |
| 91 | void *buf; | 92 | void *buf; |
| 92 | 93 | ||
| @@ -106,8 +107,17 @@ static long vbg_misc_device_ioctl(struct file *filp, unsigned int req, | |||
| 106 | if (size > SZ_16M) | 107 | if (size > SZ_16M) |
| 107 | return -E2BIG; | 108 | return -E2BIG; |
| 108 | 109 | ||
| 109 | /* __GFP_DMA32 because IOCTL_VMMDEV_REQUEST passes this to the host */ | 110 | /* |
| 110 | buf = kmalloc(size, GFP_KERNEL | __GFP_DMA32); | 111 | * IOCTL_VMMDEV_REQUEST needs the buffer to be below 4G to avoid |
| 112 | * the need for a bounce-buffer and another copy later on. | ||
| 113 | */ | ||
| 114 | is_vmmdev_req = (req & ~IOCSIZE_MASK) == VBG_IOCTL_VMMDEV_REQUEST(0) || | ||
| 115 | req == VBG_IOCTL_VMMDEV_REQUEST_BIG; | ||
| 116 | |||
| 117 | if (is_vmmdev_req) | ||
| 118 | buf = vbg_req_alloc(size, VBG_IOCTL_HDR_TYPE_DEFAULT); | ||
| 119 | else | ||
| 120 | buf = kmalloc(size, GFP_KERNEL); | ||
| 111 | if (!buf) | 121 | if (!buf) |
| 112 | return -ENOMEM; | 122 | return -ENOMEM; |
| 113 | 123 | ||
| @@ -132,7 +142,10 @@ static long vbg_misc_device_ioctl(struct file *filp, unsigned int req, | |||
| 132 | ret = -EFAULT; | 142 | ret = -EFAULT; |
| 133 | 143 | ||
| 134 | out: | 144 | out: |
| 135 | kfree(buf); | 145 | if (is_vmmdev_req) |
| 146 | vbg_req_free(buf, size); | ||
| 147 | else | ||
| 148 | kfree(buf); | ||
| 136 | 149 | ||
| 137 | return ret; | 150 | return ret; |
| 138 | } | 151 | } |
diff --git a/drivers/virt/vboxguest/vboxguest_utils.c b/drivers/virt/vboxguest/vboxguest_utils.c index 0f0dab8023cf..bf4474214b4d 100644 --- a/drivers/virt/vboxguest/vboxguest_utils.c +++ b/drivers/virt/vboxguest/vboxguest_utils.c | |||
| @@ -65,8 +65,9 @@ VBG_LOG(vbg_debug, pr_debug); | |||
| 65 | void *vbg_req_alloc(size_t len, enum vmmdev_request_type req_type) | 65 | void *vbg_req_alloc(size_t len, enum vmmdev_request_type req_type) |
| 66 | { | 66 | { |
| 67 | struct vmmdev_request_header *req; | 67 | struct vmmdev_request_header *req; |
| 68 | int order = get_order(PAGE_ALIGN(len)); | ||
| 68 | 69 | ||
| 69 | req = kmalloc(len, GFP_KERNEL | __GFP_DMA32); | 70 | req = (void *)__get_free_pages(GFP_KERNEL | GFP_DMA32, order); |
| 70 | if (!req) | 71 | if (!req) |
| 71 | return NULL; | 72 | return NULL; |
| 72 | 73 | ||
| @@ -82,6 +83,14 @@ void *vbg_req_alloc(size_t len, enum vmmdev_request_type req_type) | |||
| 82 | return req; | 83 | return req; |
| 83 | } | 84 | } |
| 84 | 85 | ||
| 86 | void vbg_req_free(void *req, size_t len) | ||
| 87 | { | ||
| 88 | if (!req) | ||
| 89 | return; | ||
| 90 | |||
| 91 | free_pages((unsigned long)req, get_order(PAGE_ALIGN(len))); | ||
| 92 | } | ||
| 93 | |||
| 85 | /* Note this function returns a VBox status code, not a negative errno!! */ | 94 | /* Note this function returns a VBox status code, not a negative errno!! */ |
| 86 | int vbg_req_perform(struct vbg_dev *gdev, void *req) | 95 | int vbg_req_perform(struct vbg_dev *gdev, void *req) |
| 87 | { | 96 | { |
| @@ -137,7 +146,7 @@ int vbg_hgcm_connect(struct vbg_dev *gdev, | |||
| 137 | rc = hgcm_connect->header.result; | 146 | rc = hgcm_connect->header.result; |
| 138 | } | 147 | } |
| 139 | 148 | ||
| 140 | kfree(hgcm_connect); | 149 | vbg_req_free(hgcm_connect, sizeof(*hgcm_connect)); |
| 141 | 150 | ||
| 142 | *vbox_status = rc; | 151 | *vbox_status = rc; |
| 143 | return 0; | 152 | return 0; |
| @@ -166,7 +175,7 @@ int vbg_hgcm_disconnect(struct vbg_dev *gdev, u32 client_id, int *vbox_status) | |||
| 166 | if (rc >= 0) | 175 | if (rc >= 0) |
| 167 | rc = hgcm_disconnect->header.result; | 176 | rc = hgcm_disconnect->header.result; |
| 168 | 177 | ||
| 169 | kfree(hgcm_disconnect); | 178 | vbg_req_free(hgcm_disconnect, sizeof(*hgcm_disconnect)); |
| 170 | 179 | ||
| 171 | *vbox_status = rc; | 180 | *vbox_status = rc; |
| 172 | return 0; | 181 | return 0; |
| @@ -623,7 +632,7 @@ int vbg_hgcm_call(struct vbg_dev *gdev, u32 client_id, u32 function, | |||
| 623 | } | 632 | } |
| 624 | 633 | ||
| 625 | if (!leak_it) | 634 | if (!leak_it) |
| 626 | kfree(call); | 635 | vbg_req_free(call, size); |
| 627 | 636 | ||
| 628 | free_bounce_bufs: | 637 | free_bounce_bufs: |
| 629 | if (bounce_bufs) { | 638 | if (bounce_bufs) { |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 7e72348639e4..315f7e63e7cc 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
| @@ -228,7 +228,15 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, | |||
| 228 | 228 | ||
| 229 | static bool ceph_vxattrcb_quota_exists(struct ceph_inode_info *ci) | 229 | static bool ceph_vxattrcb_quota_exists(struct ceph_inode_info *ci) |
| 230 | { | 230 | { |
| 231 | return (ci->i_max_files || ci->i_max_bytes); | 231 | bool ret = false; |
| 232 | spin_lock(&ci->i_ceph_lock); | ||
| 233 | if ((ci->i_max_files || ci->i_max_bytes) && | ||
| 234 | ci->i_vino.snap == CEPH_NOSNAP && | ||
| 235 | ci->i_snap_realm && | ||
| 236 | ci->i_snap_realm->ino == ci->i_vino.ino) | ||
| 237 | ret = true; | ||
| 238 | spin_unlock(&ci->i_ceph_lock); | ||
| 239 | return ret; | ||
| 232 | } | 240 | } |
| 233 | 241 | ||
| 234 | static size_t ceph_vxattrcb_quota(struct ceph_inode_info *ci, char *val, | 242 | static size_t ceph_vxattrcb_quota(struct ceph_inode_info *ci, char *val, |
| @@ -1008,14 +1016,19 @@ int __ceph_setxattr(struct inode *inode, const char *name, | |||
| 1008 | char *newval = NULL; | 1016 | char *newval = NULL; |
| 1009 | struct ceph_inode_xattr *xattr = NULL; | 1017 | struct ceph_inode_xattr *xattr = NULL; |
| 1010 | int required_blob_size; | 1018 | int required_blob_size; |
| 1019 | bool check_realm = false; | ||
| 1011 | bool lock_snap_rwsem = false; | 1020 | bool lock_snap_rwsem = false; |
| 1012 | 1021 | ||
| 1013 | if (ceph_snap(inode) != CEPH_NOSNAP) | 1022 | if (ceph_snap(inode) != CEPH_NOSNAP) |
| 1014 | return -EROFS; | 1023 | return -EROFS; |
| 1015 | 1024 | ||
| 1016 | vxattr = ceph_match_vxattr(inode, name); | 1025 | vxattr = ceph_match_vxattr(inode, name); |
| 1017 | if (vxattr && vxattr->readonly) | 1026 | if (vxattr) { |
| 1018 | return -EOPNOTSUPP; | 1027 | if (vxattr->readonly) |
| 1028 | return -EOPNOTSUPP; | ||
| 1029 | if (value && !strncmp(vxattr->name, "ceph.quota", 10)) | ||
| 1030 | check_realm = true; | ||
| 1031 | } | ||
| 1019 | 1032 | ||
| 1020 | /* pass any unhandled ceph.* xattrs through to the MDS */ | 1033 | /* pass any unhandled ceph.* xattrs through to the MDS */ |
| 1021 | if (!strncmp(name, XATTR_CEPH_PREFIX, XATTR_CEPH_PREFIX_LEN)) | 1034 | if (!strncmp(name, XATTR_CEPH_PREFIX, XATTR_CEPH_PREFIX_LEN)) |
| @@ -1109,6 +1122,15 @@ do_sync_unlocked: | |||
| 1109 | err = -EBUSY; | 1122 | err = -EBUSY; |
| 1110 | } else { | 1123 | } else { |
| 1111 | err = ceph_sync_setxattr(inode, name, value, size, flags); | 1124 | err = ceph_sync_setxattr(inode, name, value, size, flags); |
| 1125 | if (err >= 0 && check_realm) { | ||
| 1126 | /* check if snaprealm was created for quota inode */ | ||
| 1127 | spin_lock(&ci->i_ceph_lock); | ||
| 1128 | if ((ci->i_max_files || ci->i_max_bytes) && | ||
| 1129 | !(ci->i_snap_realm && | ||
| 1130 | ci->i_snap_realm->ino == ci->i_vino.ino)) | ||
| 1131 | err = -EOPNOTSUPP; | ||
| 1132 | spin_unlock(&ci->i_ceph_lock); | ||
| 1133 | } | ||
| 1112 | } | 1134 | } |
| 1113 | out: | 1135 | out: |
| 1114 | ceph_free_cap_flush(prealloc_cf); | 1136 | ceph_free_cap_flush(prealloc_cf); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 6d3e40d7029c..1529a088383d 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
| @@ -455,6 +455,9 @@ cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required) | |||
| 455 | server->sign = true; | 455 | server->sign = true; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | if (cifs_rdma_enabled(server) && server->sign) | ||
| 459 | cifs_dbg(VFS, "Signing is enabled, and RDMA read/write will be disabled"); | ||
| 460 | |||
| 458 | return 0; | 461 | return 0; |
| 459 | } | 462 | } |
| 460 | 463 | ||
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e8830f076a7f..a5aa158d535a 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -2959,6 +2959,22 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) | |||
| 2959 | } | 2959 | } |
| 2960 | } | 2960 | } |
| 2961 | 2961 | ||
| 2962 | if (volume_info->seal) { | ||
| 2963 | if (ses->server->vals->protocol_id == 0) { | ||
| 2964 | cifs_dbg(VFS, | ||
| 2965 | "SMB3 or later required for encryption\n"); | ||
| 2966 | rc = -EOPNOTSUPP; | ||
| 2967 | goto out_fail; | ||
| 2968 | } else if (tcon->ses->server->capabilities & | ||
| 2969 | SMB2_GLOBAL_CAP_ENCRYPTION) | ||
| 2970 | tcon->seal = true; | ||
| 2971 | else { | ||
| 2972 | cifs_dbg(VFS, "Encryption is not supported on share\n"); | ||
| 2973 | rc = -EOPNOTSUPP; | ||
| 2974 | goto out_fail; | ||
| 2975 | } | ||
| 2976 | } | ||
| 2977 | |||
| 2962 | /* | 2978 | /* |
| 2963 | * BB Do we need to wrap session_mutex around this TCon call and Unix | 2979 | * BB Do we need to wrap session_mutex around this TCon call and Unix |
| 2964 | * SetFS as we do on SessSetup and reconnect? | 2980 | * SetFS as we do on SessSetup and reconnect? |
| @@ -3007,22 +3023,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) | |||
| 3007 | tcon->use_resilient = true; | 3023 | tcon->use_resilient = true; |
| 3008 | } | 3024 | } |
| 3009 | 3025 | ||
| 3010 | if (volume_info->seal) { | ||
| 3011 | if (ses->server->vals->protocol_id == 0) { | ||
| 3012 | cifs_dbg(VFS, | ||
| 3013 | "SMB3 or later required for encryption\n"); | ||
| 3014 | rc = -EOPNOTSUPP; | ||
| 3015 | goto out_fail; | ||
| 3016 | } else if (tcon->ses->server->capabilities & | ||
| 3017 | SMB2_GLOBAL_CAP_ENCRYPTION) | ||
| 3018 | tcon->seal = true; | ||
| 3019 | else { | ||
| 3020 | cifs_dbg(VFS, "Encryption is not supported on share\n"); | ||
| 3021 | rc = -EOPNOTSUPP; | ||
| 3022 | goto out_fail; | ||
| 3023 | } | ||
| 3024 | } | ||
| 3025 | |||
| 3026 | /* | 3026 | /* |
| 3027 | * We can have only one retry value for a connection to a share so for | 3027 | * We can have only one retry value for a connection to a share so for |
| 3028 | * resources mounted more than once to the same server share the last | 3028 | * resources mounted more than once to the same server share the last |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 38ebf3f357d2..b76b85881dcc 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
| @@ -252,9 +252,14 @@ smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info) | |||
| 252 | wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE; | 252 | wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE; |
| 253 | wsize = min_t(unsigned int, wsize, server->max_write); | 253 | wsize = min_t(unsigned int, wsize, server->max_write); |
| 254 | #ifdef CONFIG_CIFS_SMB_DIRECT | 254 | #ifdef CONFIG_CIFS_SMB_DIRECT |
| 255 | if (server->rdma) | 255 | if (server->rdma) { |
| 256 | wsize = min_t(unsigned int, | 256 | if (server->sign) |
| 257 | wsize = min_t(unsigned int, | ||
| 258 | wsize, server->smbd_conn->max_fragmented_send_size); | ||
| 259 | else | ||
| 260 | wsize = min_t(unsigned int, | ||
| 257 | wsize, server->smbd_conn->max_readwrite_size); | 261 | wsize, server->smbd_conn->max_readwrite_size); |
| 262 | } | ||
| 258 | #endif | 263 | #endif |
| 259 | if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) | 264 | if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) |
| 260 | wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE); | 265 | wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE); |
| @@ -272,9 +277,14 @@ smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info) | |||
| 272 | rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE; | 277 | rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE; |
| 273 | rsize = min_t(unsigned int, rsize, server->max_read); | 278 | rsize = min_t(unsigned int, rsize, server->max_read); |
| 274 | #ifdef CONFIG_CIFS_SMB_DIRECT | 279 | #ifdef CONFIG_CIFS_SMB_DIRECT |
| 275 | if (server->rdma) | 280 | if (server->rdma) { |
| 276 | rsize = min_t(unsigned int, | 281 | if (server->sign) |
| 282 | rsize = min_t(unsigned int, | ||
| 283 | rsize, server->smbd_conn->max_fragmented_recv_size); | ||
| 284 | else | ||
| 285 | rsize = min_t(unsigned int, | ||
| 277 | rsize, server->smbd_conn->max_readwrite_size); | 286 | rsize, server->smbd_conn->max_readwrite_size); |
| 287 | } | ||
| 278 | #endif | 288 | #endif |
| 279 | 289 | ||
| 280 | if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) | 290 | if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0f044c4a2dc9..60db51bae0e3 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
| @@ -383,10 +383,10 @@ static void | |||
| 383 | build_encrypt_ctxt(struct smb2_encryption_neg_context *pneg_ctxt) | 383 | build_encrypt_ctxt(struct smb2_encryption_neg_context *pneg_ctxt) |
| 384 | { | 384 | { |
| 385 | pneg_ctxt->ContextType = SMB2_ENCRYPTION_CAPABILITIES; | 385 | pneg_ctxt->ContextType = SMB2_ENCRYPTION_CAPABILITIES; |
| 386 | pneg_ctxt->DataLength = cpu_to_le16(6); | 386 | pneg_ctxt->DataLength = cpu_to_le16(4); /* Cipher Count + le16 cipher */ |
| 387 | pneg_ctxt->CipherCount = cpu_to_le16(2); | 387 | pneg_ctxt->CipherCount = cpu_to_le16(1); |
| 388 | pneg_ctxt->Ciphers[0] = SMB2_ENCRYPTION_AES128_GCM; | 388 | /* pneg_ctxt->Ciphers[0] = SMB2_ENCRYPTION_AES128_GCM;*/ /* not supported yet */ |
| 389 | pneg_ctxt->Ciphers[1] = SMB2_ENCRYPTION_AES128_CCM; | 389 | pneg_ctxt->Ciphers[0] = SMB2_ENCRYPTION_AES128_CCM; |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | static void | 392 | static void |
| @@ -444,6 +444,7 @@ static int decode_encrypt_ctx(struct TCP_Server_Info *server, | |||
| 444 | return -EINVAL; | 444 | return -EINVAL; |
| 445 | } | 445 | } |
| 446 | server->cipher_type = ctxt->Ciphers[0]; | 446 | server->cipher_type = ctxt->Ciphers[0]; |
| 447 | server->capabilities |= SMB2_GLOBAL_CAP_ENCRYPTION; | ||
| 447 | return 0; | 448 | return 0; |
| 448 | } | 449 | } |
| 449 | 450 | ||
| @@ -2590,7 +2591,7 @@ smb2_new_read_req(void **buf, unsigned int *total_len, | |||
| 2590 | * If we want to do a RDMA write, fill in and append | 2591 | * If we want to do a RDMA write, fill in and append |
| 2591 | * smbd_buffer_descriptor_v1 to the end of read request | 2592 | * smbd_buffer_descriptor_v1 to the end of read request |
| 2592 | */ | 2593 | */ |
| 2593 | if (server->rdma && rdata && | 2594 | if (server->rdma && rdata && !server->sign && |
| 2594 | rdata->bytes >= server->smbd_conn->rdma_readwrite_threshold) { | 2595 | rdata->bytes >= server->smbd_conn->rdma_readwrite_threshold) { |
| 2595 | 2596 | ||
| 2596 | struct smbd_buffer_descriptor_v1 *v1; | 2597 | struct smbd_buffer_descriptor_v1 *v1; |
| @@ -2968,7 +2969,7 @@ smb2_async_writev(struct cifs_writedata *wdata, | |||
| 2968 | * If we want to do a server RDMA read, fill in and append | 2969 | * If we want to do a server RDMA read, fill in and append |
| 2969 | * smbd_buffer_descriptor_v1 to the end of write request | 2970 | * smbd_buffer_descriptor_v1 to the end of write request |
| 2970 | */ | 2971 | */ |
| 2971 | if (server->rdma && wdata->bytes >= | 2972 | if (server->rdma && !server->sign && wdata->bytes >= |
| 2972 | server->smbd_conn->rdma_readwrite_threshold) { | 2973 | server->smbd_conn->rdma_readwrite_threshold) { |
| 2973 | 2974 | ||
| 2974 | struct smbd_buffer_descriptor_v1 *v1; | 2975 | struct smbd_buffer_descriptor_v1 *v1; |
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 6093e5142b2b..d28f358022c5 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h | |||
| @@ -297,7 +297,7 @@ struct smb2_encryption_neg_context { | |||
| 297 | __le16 DataLength; | 297 | __le16 DataLength; |
| 298 | __le32 Reserved; | 298 | __le32 Reserved; |
| 299 | __le16 CipherCount; /* AES-128-GCM and AES-128-CCM */ | 299 | __le16 CipherCount; /* AES-128-GCM and AES-128-CCM */ |
| 300 | __le16 Ciphers[2]; /* Ciphers[0] since only one used now */ | 300 | __le16 Ciphers[1]; /* Ciphers[0] since only one used now */ |
| 301 | } __packed; | 301 | } __packed; |
| 302 | 302 | ||
| 303 | struct smb2_negotiate_rsp { | 303 | struct smb2_negotiate_rsp { |
diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 87817ddcc096..c62f7c95683c 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c | |||
| @@ -2086,7 +2086,7 @@ int smbd_send(struct smbd_connection *info, struct smb_rqst *rqst) | |||
| 2086 | int start, i, j; | 2086 | int start, i, j; |
| 2087 | int max_iov_size = | 2087 | int max_iov_size = |
| 2088 | info->max_send_size - sizeof(struct smbd_data_transfer); | 2088 | info->max_send_size - sizeof(struct smbd_data_transfer); |
| 2089 | struct kvec iov[SMBDIRECT_MAX_SGE]; | 2089 | struct kvec *iov; |
| 2090 | int rc; | 2090 | int rc; |
| 2091 | 2091 | ||
| 2092 | info->smbd_send_pending++; | 2092 | info->smbd_send_pending++; |
| @@ -2096,32 +2096,20 @@ int smbd_send(struct smbd_connection *info, struct smb_rqst *rqst) | |||
| 2096 | } | 2096 | } |
| 2097 | 2097 | ||
| 2098 | /* | 2098 | /* |
| 2099 | * This usually means a configuration error | 2099 | * Skip the RFC1002 length defined in MS-SMB2 section 2.1 |
| 2100 | * We use RDMA read/write for packet size > rdma_readwrite_threshold | 2100 | * It is used only for TCP transport in the iov[0] |
| 2101 | * as long as it's properly configured we should never get into this | ||
| 2102 | * situation | ||
| 2103 | */ | ||
| 2104 | if (rqst->rq_nvec + rqst->rq_npages > SMBDIRECT_MAX_SGE) { | ||
| 2105 | log_write(ERR, "maximum send segment %x exceeding %x\n", | ||
| 2106 | rqst->rq_nvec + rqst->rq_npages, SMBDIRECT_MAX_SGE); | ||
| 2107 | rc = -EINVAL; | ||
| 2108 | goto done; | ||
| 2109 | } | ||
| 2110 | |||
| 2111 | /* | ||
| 2112 | * Remove the RFC1002 length defined in MS-SMB2 section 2.1 | ||
| 2113 | * It is used only for TCP transport | ||
| 2114 | * In future we may want to add a transport layer under protocol | 2101 | * In future we may want to add a transport layer under protocol |
| 2115 | * layer so this will only be issued to TCP transport | 2102 | * layer so this will only be issued to TCP transport |
| 2116 | */ | 2103 | */ |
| 2117 | iov[0].iov_base = (char *)rqst->rq_iov[0].iov_base + 4; | 2104 | |
| 2118 | iov[0].iov_len = rqst->rq_iov[0].iov_len - 4; | 2105 | if (rqst->rq_iov[0].iov_len != 4) { |
| 2119 | buflen += iov[0].iov_len; | 2106 | log_write(ERR, "expected the pdu length in 1st iov, but got %zu\n", rqst->rq_iov[0].iov_len); |
| 2107 | return -EINVAL; | ||
| 2108 | } | ||
| 2109 | iov = &rqst->rq_iov[1]; | ||
| 2120 | 2110 | ||
| 2121 | /* total up iov array first */ | 2111 | /* total up iov array first */ |
| 2122 | for (i = 1; i < rqst->rq_nvec; i++) { | 2112 | for (i = 0; i < rqst->rq_nvec-1; i++) { |
| 2123 | iov[i].iov_base = rqst->rq_iov[i].iov_base; | ||
| 2124 | iov[i].iov_len = rqst->rq_iov[i].iov_len; | ||
| 2125 | buflen += iov[i].iov_len; | 2113 | buflen += iov[i].iov_len; |
| 2126 | } | 2114 | } |
| 2127 | 2115 | ||
| @@ -2198,14 +2186,14 @@ int smbd_send(struct smbd_connection *info, struct smb_rqst *rqst) | |||
| 2198 | goto done; | 2186 | goto done; |
| 2199 | } | 2187 | } |
| 2200 | i++; | 2188 | i++; |
| 2201 | if (i == rqst->rq_nvec) | 2189 | if (i == rqst->rq_nvec-1) |
| 2202 | break; | 2190 | break; |
| 2203 | } | 2191 | } |
| 2204 | start = i; | 2192 | start = i; |
| 2205 | buflen = 0; | 2193 | buflen = 0; |
| 2206 | } else { | 2194 | } else { |
| 2207 | i++; | 2195 | i++; |
| 2208 | if (i == rqst->rq_nvec) { | 2196 | if (i == rqst->rq_nvec-1) { |
| 2209 | /* send out all remaining vecs */ | 2197 | /* send out all remaining vecs */ |
| 2210 | remaining_data_length -= buflen; | 2198 | remaining_data_length -= buflen; |
| 2211 | log_write(INFO, | 2199 | log_write(INFO, |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 8f6f25918229..927226a2122f 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
| @@ -753,7 +753,7 @@ cifs_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
| 753 | goto out; | 753 | goto out; |
| 754 | 754 | ||
| 755 | #ifdef CONFIG_CIFS_SMB311 | 755 | #ifdef CONFIG_CIFS_SMB311 |
| 756 | if (ses->status == CifsNew) | 756 | if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) |
| 757 | smb311_update_preauth_hash(ses, rqst->rq_iov+1, | 757 | smb311_update_preauth_hash(ses, rqst->rq_iov+1, |
| 758 | rqst->rq_nvec-1); | 758 | rqst->rq_nvec-1); |
| 759 | #endif | 759 | #endif |
| @@ -798,7 +798,7 @@ cifs_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
| 798 | *resp_buf_type = CIFS_SMALL_BUFFER; | 798 | *resp_buf_type = CIFS_SMALL_BUFFER; |
| 799 | 799 | ||
| 800 | #ifdef CONFIG_CIFS_SMB311 | 800 | #ifdef CONFIG_CIFS_SMB311 |
| 801 | if (ses->status == CifsNew) { | 801 | if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) { |
| 802 | struct kvec iov = { | 802 | struct kvec iov = { |
| 803 | .iov_base = buf + 4, | 803 | .iov_base = buf + 4, |
| 804 | .iov_len = get_rfc1002_length(buf) | 804 | .iov_len = get_rfc1002_length(buf) |
| @@ -834,8 +834,11 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, | |||
| 834 | if (n_vec + 1 > CIFS_MAX_IOV_SIZE) { | 834 | if (n_vec + 1 > CIFS_MAX_IOV_SIZE) { |
| 835 | new_iov = kmalloc(sizeof(struct kvec) * (n_vec + 1), | 835 | new_iov = kmalloc(sizeof(struct kvec) * (n_vec + 1), |
| 836 | GFP_KERNEL); | 836 | GFP_KERNEL); |
| 837 | if (!new_iov) | 837 | if (!new_iov) { |
| 838 | /* otherwise cifs_send_recv below sets resp_buf_type */ | ||
| 839 | *resp_buf_type = CIFS_NO_BUFFER; | ||
| 838 | return -ENOMEM; | 840 | return -ENOMEM; |
| 841 | } | ||
| 839 | } else | 842 | } else |
| 840 | new_iov = s_iov; | 843 | new_iov = s_iov; |
| 841 | 844 | ||
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index a33d8fb1bf2a..508b905d744d 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
| @@ -321,6 +321,7 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb, | |||
| 321 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 321 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
| 322 | ext4_grpblk_t offset; | 322 | ext4_grpblk_t offset; |
| 323 | ext4_grpblk_t next_zero_bit; | 323 | ext4_grpblk_t next_zero_bit; |
| 324 | ext4_grpblk_t max_bit = EXT4_CLUSTERS_PER_GROUP(sb); | ||
| 324 | ext4_fsblk_t blk; | 325 | ext4_fsblk_t blk; |
| 325 | ext4_fsblk_t group_first_block; | 326 | ext4_fsblk_t group_first_block; |
| 326 | 327 | ||
| @@ -338,7 +339,7 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb, | |||
| 338 | /* check whether block bitmap block number is set */ | 339 | /* check whether block bitmap block number is set */ |
| 339 | blk = ext4_block_bitmap(sb, desc); | 340 | blk = ext4_block_bitmap(sb, desc); |
| 340 | offset = blk - group_first_block; | 341 | offset = blk - group_first_block; |
| 341 | if (offset < 0 || EXT4_B2C(sbi, offset) >= sb->s_blocksize || | 342 | if (offset < 0 || EXT4_B2C(sbi, offset) >= max_bit || |
| 342 | !ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data)) | 343 | !ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data)) |
| 343 | /* bad block bitmap */ | 344 | /* bad block bitmap */ |
| 344 | return blk; | 345 | return blk; |
| @@ -346,7 +347,7 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb, | |||
| 346 | /* check whether the inode bitmap block number is set */ | 347 | /* check whether the inode bitmap block number is set */ |
| 347 | blk = ext4_inode_bitmap(sb, desc); | 348 | blk = ext4_inode_bitmap(sb, desc); |
| 348 | offset = blk - group_first_block; | 349 | offset = blk - group_first_block; |
| 349 | if (offset < 0 || EXT4_B2C(sbi, offset) >= sb->s_blocksize || | 350 | if (offset < 0 || EXT4_B2C(sbi, offset) >= max_bit || |
| 350 | !ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data)) | 351 | !ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data)) |
| 351 | /* bad block bitmap */ | 352 | /* bad block bitmap */ |
| 352 | return blk; | 353 | return blk; |
| @@ -354,8 +355,8 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb, | |||
| 354 | /* check whether the inode table block number is set */ | 355 | /* check whether the inode table block number is set */ |
| 355 | blk = ext4_inode_table(sb, desc); | 356 | blk = ext4_inode_table(sb, desc); |
| 356 | offset = blk - group_first_block; | 357 | offset = blk - group_first_block; |
| 357 | if (offset < 0 || EXT4_B2C(sbi, offset) >= sb->s_blocksize || | 358 | if (offset < 0 || EXT4_B2C(sbi, offset) >= max_bit || |
| 358 | EXT4_B2C(sbi, offset + sbi->s_itb_per_group) >= sb->s_blocksize) | 359 | EXT4_B2C(sbi, offset + sbi->s_itb_per_group) >= max_bit) |
| 359 | return blk; | 360 | return blk; |
| 360 | next_zero_bit = ext4_find_next_zero_bit(bh->b_data, | 361 | next_zero_bit = ext4_find_next_zero_bit(bh->b_data, |
| 361 | EXT4_B2C(sbi, offset + sbi->s_itb_per_group), | 362 | EXT4_B2C(sbi, offset + sbi->s_itb_per_group), |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 0a7315961bac..c969275ce3ee 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
| @@ -5329,8 +5329,9 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle, | |||
| 5329 | stop = le32_to_cpu(extent->ee_block); | 5329 | stop = le32_to_cpu(extent->ee_block); |
| 5330 | 5330 | ||
| 5331 | /* | 5331 | /* |
| 5332 | * In case of left shift, Don't start shifting extents until we make | 5332 | * For left shifts, make sure the hole on the left is big enough to |
| 5333 | * sure the hole is big enough to accommodate the shift. | 5333 | * accommodate the shift. For right shifts, make sure the last extent |
| 5334 | * won't be shifted beyond EXT_MAX_BLOCKS. | ||
| 5334 | */ | 5335 | */ |
| 5335 | if (SHIFT == SHIFT_LEFT) { | 5336 | if (SHIFT == SHIFT_LEFT) { |
| 5336 | path = ext4_find_extent(inode, start - 1, &path, | 5337 | path = ext4_find_extent(inode, start - 1, &path, |
| @@ -5350,9 +5351,14 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle, | |||
| 5350 | 5351 | ||
| 5351 | if ((start == ex_start && shift > ex_start) || | 5352 | if ((start == ex_start && shift > ex_start) || |
| 5352 | (shift > start - ex_end)) { | 5353 | (shift > start - ex_end)) { |
| 5353 | ext4_ext_drop_refs(path); | 5354 | ret = -EINVAL; |
| 5354 | kfree(path); | 5355 | goto out; |
| 5355 | return -EINVAL; | 5356 | } |
| 5357 | } else { | ||
| 5358 | if (shift > EXT_MAX_BLOCKS - | ||
| 5359 | (stop + ext4_ext_get_actual_len(extent))) { | ||
| 5360 | ret = -EINVAL; | ||
| 5361 | goto out; | ||
| 5356 | } | 5362 | } |
| 5357 | } | 5363 | } |
| 5358 | 5364 | ||
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 185f7e61f4cf..eb104e8476f0 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -5886,5 +5886,6 @@ static void __exit ext4_exit_fs(void) | |||
| 5886 | MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); | 5886 | MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); |
| 5887 | MODULE_DESCRIPTION("Fourth Extended Filesystem"); | 5887 | MODULE_DESCRIPTION("Fourth Extended Filesystem"); |
| 5888 | MODULE_LICENSE("GPL"); | 5888 | MODULE_LICENSE("GPL"); |
| 5889 | MODULE_SOFTDEP("pre: crc32c"); | ||
| 5889 | module_init(ext4_init_fs) | 5890 | module_init(ext4_init_fs) |
| 5890 | module_exit(ext4_exit_fs) | 5891 | module_exit(ext4_exit_fs) |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index ac311037d7a5..8aa453784402 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
| @@ -532,6 +532,7 @@ int jbd2_journal_start_reserved(handle_t *handle, unsigned int type, | |||
| 532 | */ | 532 | */ |
| 533 | ret = start_this_handle(journal, handle, GFP_NOFS); | 533 | ret = start_this_handle(journal, handle, GFP_NOFS); |
| 534 | if (ret < 0) { | 534 | if (ret < 0) { |
| 535 | handle->h_journal = journal; | ||
| 535 | jbd2_journal_free_reserved(handle); | 536 | jbd2_journal_free_reserved(handle); |
| 536 | return ret; | 537 | return ret; |
| 537 | } | 538 | } |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 278841c75b97..af240573e482 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -188,7 +188,7 @@ | |||
| 188 | #endif | 188 | #endif |
| 189 | 189 | ||
| 190 | #ifdef CONFIG_SERIAL_EARLYCON | 190 | #ifdef CONFIG_SERIAL_EARLYCON |
| 191 | #define EARLYCON_TABLE() STRUCT_ALIGN(); \ | 191 | #define EARLYCON_TABLE() . = ALIGN(8); \ |
| 192 | VMLINUX_SYMBOL(__earlycon_table) = .; \ | 192 | VMLINUX_SYMBOL(__earlycon_table) = .; \ |
| 193 | KEEP(*(__earlycon_table)) \ | 193 | KEEP(*(__earlycon_table)) \ |
| 194 | VMLINUX_SYMBOL(__earlycon_table_end) = .; | 194 | VMLINUX_SYMBOL(__earlycon_table_end) = .; |
diff --git a/include/kvm/arm_psci.h b/include/kvm/arm_psci.h index e518e4e3dfb5..4b1548129fa2 100644 --- a/include/kvm/arm_psci.h +++ b/include/kvm/arm_psci.h | |||
| @@ -37,10 +37,15 @@ static inline int kvm_psci_version(struct kvm_vcpu *vcpu, struct kvm *kvm) | |||
| 37 | * Our PSCI implementation stays the same across versions from | 37 | * Our PSCI implementation stays the same across versions from |
| 38 | * v0.2 onward, only adding the few mandatory functions (such | 38 | * v0.2 onward, only adding the few mandatory functions (such |
| 39 | * as FEATURES with 1.0) that are required by newer | 39 | * as FEATURES with 1.0) that are required by newer |
| 40 | * revisions. It is thus safe to return the latest. | 40 | * revisions. It is thus safe to return the latest, unless |
| 41 | * userspace has instructed us otherwise. | ||
| 41 | */ | 42 | */ |
| 42 | if (test_bit(KVM_ARM_VCPU_PSCI_0_2, vcpu->arch.features)) | 43 | if (test_bit(KVM_ARM_VCPU_PSCI_0_2, vcpu->arch.features)) { |
| 44 | if (vcpu->kvm->arch.psci_version) | ||
| 45 | return vcpu->kvm->arch.psci_version; | ||
| 46 | |||
| 43 | return KVM_ARM_PSCI_LATEST; | 47 | return KVM_ARM_PSCI_LATEST; |
| 48 | } | ||
| 44 | 49 | ||
| 45 | return KVM_ARM_PSCI_0_1; | 50 | return KVM_ARM_PSCI_0_1; |
| 46 | } | 51 | } |
| @@ -48,4 +53,11 @@ static inline int kvm_psci_version(struct kvm_vcpu *vcpu, struct kvm *kvm) | |||
| 48 | 53 | ||
| 49 | int kvm_hvc_call_handler(struct kvm_vcpu *vcpu); | 54 | int kvm_hvc_call_handler(struct kvm_vcpu *vcpu); |
| 50 | 55 | ||
| 56 | struct kvm_one_reg; | ||
| 57 | |||
| 58 | int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu); | ||
| 59 | int kvm_arm_copy_fw_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices); | ||
| 60 | int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg); | ||
| 61 | int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg); | ||
| 62 | |||
| 51 | #endif /* __KVM_ARM_PSCI_H__ */ | 63 | #endif /* __KVM_ARM_PSCI_H__ */ |
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index e3986f4b3461..ebc34a5686dc 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h | |||
| @@ -9,6 +9,9 @@ | |||
| 9 | struct blk_mq_tags; | 9 | struct blk_mq_tags; |
| 10 | struct blk_flush_queue; | 10 | struct blk_flush_queue; |
| 11 | 11 | ||
| 12 | /** | ||
| 13 | * struct blk_mq_hw_ctx - State for a hardware queue facing the hardware block device | ||
| 14 | */ | ||
| 12 | struct blk_mq_hw_ctx { | 15 | struct blk_mq_hw_ctx { |
| 13 | struct { | 16 | struct { |
| 14 | spinlock_t lock; | 17 | spinlock_t lock; |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 9af3e0f430bc..5c4eee043191 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -605,6 +605,11 @@ struct request_queue { | |||
| 605 | * initialized by the low level device driver (e.g. scsi/sd.c). | 605 | * initialized by the low level device driver (e.g. scsi/sd.c). |
| 606 | * Stacking drivers (device mappers) may or may not initialize | 606 | * Stacking drivers (device mappers) may or may not initialize |
| 607 | * these fields. | 607 | * these fields. |
| 608 | * | ||
| 609 | * Reads of this information must be protected with blk_queue_enter() / | ||
| 610 | * blk_queue_exit(). Modifying this information is only allowed while | ||
| 611 | * no requests are being processed. See also blk_mq_freeze_queue() and | ||
| 612 | * blk_mq_unfreeze_queue(). | ||
| 608 | */ | 613 | */ |
| 609 | unsigned int nr_zones; | 614 | unsigned int nr_zones; |
| 610 | unsigned long *seq_zones_bitmap; | 615 | unsigned long *seq_zones_bitmap; |
| @@ -737,6 +742,7 @@ bool blk_queue_flag_test_and_clear(unsigned int flag, struct request_queue *q); | |||
| 737 | #define blk_queue_quiesced(q) test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags) | 742 | #define blk_queue_quiesced(q) test_bit(QUEUE_FLAG_QUIESCED, &(q)->queue_flags) |
| 738 | #define blk_queue_preempt_only(q) \ | 743 | #define blk_queue_preempt_only(q) \ |
| 739 | test_bit(QUEUE_FLAG_PREEMPT_ONLY, &(q)->queue_flags) | 744 | test_bit(QUEUE_FLAG_PREEMPT_ONLY, &(q)->queue_flags) |
| 745 | #define blk_queue_fua(q) test_bit(QUEUE_FLAG_FUA, &(q)->queue_flags) | ||
| 740 | 746 | ||
| 741 | extern int blk_set_preempt_only(struct request_queue *q); | 747 | extern int blk_set_preempt_only(struct request_queue *q); |
| 742 | extern void blk_clear_preempt_only(struct request_queue *q); | 748 | extern void blk_clear_preempt_only(struct request_queue *q); |
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 95a7abd0ee92..486e65e3db26 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h | |||
| @@ -339,8 +339,8 @@ int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, | |||
| 339 | void bpf_prog_array_delete_safe(struct bpf_prog_array __rcu *progs, | 339 | void bpf_prog_array_delete_safe(struct bpf_prog_array __rcu *progs, |
| 340 | struct bpf_prog *old_prog); | 340 | struct bpf_prog *old_prog); |
| 341 | int bpf_prog_array_copy_info(struct bpf_prog_array __rcu *array, | 341 | int bpf_prog_array_copy_info(struct bpf_prog_array __rcu *array, |
| 342 | __u32 __user *prog_ids, u32 request_cnt, | 342 | u32 *prog_ids, u32 request_cnt, |
| 343 | __u32 __user *prog_cnt); | 343 | u32 *prog_cnt); |
| 344 | int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, | 344 | int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, |
| 345 | struct bpf_prog *exclude_prog, | 345 | struct bpf_prog *exclude_prog, |
| 346 | struct bpf_prog *include_prog, | 346 | struct bpf_prog *include_prog, |
diff --git a/include/linux/device.h b/include/linux/device.h index 0059b99e1f25..477956990f5e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -256,7 +256,9 @@ enum probe_type { | |||
| 256 | * automatically. | 256 | * automatically. |
| 257 | * @pm: Power management operations of the device which matched | 257 | * @pm: Power management operations of the device which matched |
| 258 | * this driver. | 258 | * this driver. |
| 259 | * @coredump: Called through sysfs to initiate a device coredump. | 259 | * @coredump: Called when sysfs entry is written to. The device driver |
| 260 | * is expected to call the dev_coredump API resulting in a | ||
| 261 | * uevent. | ||
| 260 | * @p: Driver core's private data, no one other than the driver | 262 | * @p: Driver core's private data, no one other than the driver |
| 261 | * core can touch this. | 263 | * core can touch this. |
| 262 | * | 264 | * |
| @@ -288,7 +290,7 @@ struct device_driver { | |||
| 288 | const struct attribute_group **groups; | 290 | const struct attribute_group **groups; |
| 289 | 291 | ||
| 290 | const struct dev_pm_ops *pm; | 292 | const struct dev_pm_ops *pm; |
| 291 | int (*coredump) (struct device *dev); | 293 | void (*coredump) (struct device *dev); |
| 292 | 294 | ||
| 293 | struct driver_private *p; | 295 | struct driver_private *p; |
| 294 | }; | 296 | }; |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index ebe41811ed34..b32cd2062f18 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
| @@ -310,6 +310,8 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, | |||
| 310 | * fields should be ignored (use %__ETHTOOL_LINK_MODE_MASK_NBITS | 310 | * fields should be ignored (use %__ETHTOOL_LINK_MODE_MASK_NBITS |
| 311 | * instead of the latter), any change to them will be overwritten | 311 | * instead of the latter), any change to them will be overwritten |
| 312 | * by kernel. Returns a negative error code or zero. | 312 | * by kernel. Returns a negative error code or zero. |
| 313 | * @get_fecparam: Get the network device Forward Error Correction parameters. | ||
| 314 | * @set_fecparam: Set the network device Forward Error Correction parameters. | ||
| 313 | * | 315 | * |
| 314 | * All operations are optional (i.e. the function pointer may be set | 316 | * All operations are optional (i.e. the function pointer may be set |
| 315 | * to %NULL) and callers must take this into account. Callers must | 317 | * to %NULL) and callers must take this into account. Callers must |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index e0c95c9f1e29..e64c0294f50b 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
| @@ -217,12 +217,10 @@ struct fsnotify_mark_connector { | |||
| 217 | union { /* Object pointer [lock] */ | 217 | union { /* Object pointer [lock] */ |
| 218 | struct inode *inode; | 218 | struct inode *inode; |
| 219 | struct vfsmount *mnt; | 219 | struct vfsmount *mnt; |
| 220 | }; | ||
| 221 | union { | ||
| 222 | struct hlist_head list; | ||
| 223 | /* Used listing heads to free after srcu period expires */ | 220 | /* Used listing heads to free after srcu period expires */ |
| 224 | struct fsnotify_mark_connector *destroy_next; | 221 | struct fsnotify_mark_connector *destroy_next; |
| 225 | }; | 222 | }; |
| 223 | struct hlist_head list; | ||
| 226 | }; | 224 | }; |
| 227 | 225 | ||
| 228 | /* | 226 | /* |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index a2656c3ebe81..3892e9c8b2de 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -161,9 +161,11 @@ struct hrtimer_clock_base { | |||
| 161 | enum hrtimer_base_type { | 161 | enum hrtimer_base_type { |
| 162 | HRTIMER_BASE_MONOTONIC, | 162 | HRTIMER_BASE_MONOTONIC, |
| 163 | HRTIMER_BASE_REALTIME, | 163 | HRTIMER_BASE_REALTIME, |
| 164 | HRTIMER_BASE_BOOTTIME, | ||
| 164 | HRTIMER_BASE_TAI, | 165 | HRTIMER_BASE_TAI, |
| 165 | HRTIMER_BASE_MONOTONIC_SOFT, | 166 | HRTIMER_BASE_MONOTONIC_SOFT, |
| 166 | HRTIMER_BASE_REALTIME_SOFT, | 167 | HRTIMER_BASE_REALTIME_SOFT, |
| 168 | HRTIMER_BASE_BOOTTIME_SOFT, | ||
| 167 | HRTIMER_BASE_TAI_SOFT, | 169 | HRTIMER_BASE_TAI_SOFT, |
| 168 | HRTIMER_MAX_CLOCK_BASES, | 170 | HRTIMER_MAX_CLOCK_BASES, |
| 169 | }; | 171 | }; |
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index b63fa457febd..3529683f691e 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
| @@ -85,6 +85,7 @@ struct flchip { | |||
| 85 | unsigned int write_suspended:1; | 85 | unsigned int write_suspended:1; |
| 86 | unsigned int erase_suspended:1; | 86 | unsigned int erase_suspended:1; |
| 87 | unsigned long in_progress_block_addr; | 87 | unsigned long in_progress_block_addr; |
| 88 | unsigned long in_progress_block_mask; | ||
| 88 | 89 | ||
| 89 | struct mutex mutex; | 90 | struct mutex mutex; |
| 90 | wait_queue_head_t wq; /* Wait on here when we're waiting for the chip | 91 | wait_queue_head_t wq; /* Wait on here when we're waiting for the chip |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 1d356105f25a..b4c9fda9d833 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -351,10 +351,10 @@ struct earlycon_id { | |||
| 351 | char name[16]; | 351 | char name[16]; |
| 352 | char compatible[128]; | 352 | char compatible[128]; |
| 353 | int (*setup)(struct earlycon_device *, const char *options); | 353 | int (*setup)(struct earlycon_device *, const char *options); |
| 354 | } __aligned(32); | 354 | }; |
| 355 | 355 | ||
| 356 | extern const struct earlycon_id __earlycon_table[]; | 356 | extern const struct earlycon_id *__earlycon_table[]; |
| 357 | extern const struct earlycon_id __earlycon_table_end[]; | 357 | extern const struct earlycon_id *__earlycon_table_end[]; |
| 358 | 358 | ||
| 359 | #if defined(CONFIG_SERIAL_EARLYCON) && !defined(MODULE) | 359 | #if defined(CONFIG_SERIAL_EARLYCON) && !defined(MODULE) |
| 360 | #define EARLYCON_USED_OR_UNUSED __used | 360 | #define EARLYCON_USED_OR_UNUSED __used |
| @@ -362,12 +362,19 @@ extern const struct earlycon_id __earlycon_table_end[]; | |||
| 362 | #define EARLYCON_USED_OR_UNUSED __maybe_unused | 362 | #define EARLYCON_USED_OR_UNUSED __maybe_unused |
| 363 | #endif | 363 | #endif |
| 364 | 364 | ||
| 365 | #define OF_EARLYCON_DECLARE(_name, compat, fn) \ | 365 | #define _OF_EARLYCON_DECLARE(_name, compat, fn, unique_id) \ |
| 366 | static const struct earlycon_id __UNIQUE_ID(__earlycon_##_name) \ | 366 | static const struct earlycon_id unique_id \ |
| 367 | EARLYCON_USED_OR_UNUSED __section(__earlycon_table) \ | 367 | EARLYCON_USED_OR_UNUSED __initconst \ |
| 368 | = { .name = __stringify(_name), \ | 368 | = { .name = __stringify(_name), \ |
| 369 | .compatible = compat, \ | 369 | .compatible = compat, \ |
| 370 | .setup = fn } | 370 | .setup = fn }; \ |
| 371 | static const struct earlycon_id EARLYCON_USED_OR_UNUSED \ | ||
| 372 | __section(__earlycon_table) \ | ||
| 373 | * const __PASTE(__p, unique_id) = &unique_id | ||
| 374 | |||
| 375 | #define OF_EARLYCON_DECLARE(_name, compat, fn) \ | ||
| 376 | _OF_EARLYCON_DECLARE(_name, compat, fn, \ | ||
| 377 | __UNIQUE_ID(__earlycon_##_name)) | ||
| 371 | 378 | ||
| 372 | #define EARLYCON_DECLARE(_name, fn) OF_EARLYCON_DECLARE(_name, "", fn) | 379 | #define EARLYCON_DECLARE(_name, fn) OF_EARLYCON_DECLARE(_name, "", fn) |
| 373 | 380 | ||
diff --git a/include/linux/stringhash.h b/include/linux/stringhash.h index e8f0f852968f..c0c5c5b73dc0 100644 --- a/include/linux/stringhash.h +++ b/include/linux/stringhash.h | |||
| @@ -50,9 +50,9 @@ partial_name_hash(unsigned long c, unsigned long prevhash) | |||
| 50 | * losing bits). This also has the property (wanted by the dcache) | 50 | * losing bits). This also has the property (wanted by the dcache) |
| 51 | * that the msbits make a good hash table index. | 51 | * that the msbits make a good hash table index. |
| 52 | */ | 52 | */ |
| 53 | static inline unsigned long end_name_hash(unsigned long hash) | 53 | static inline unsigned int end_name_hash(unsigned long hash) |
| 54 | { | 54 | { |
| 55 | return __hash_32((unsigned int)hash); | 55 | return hash_long(hash, 32); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | /* | 58 | /* |
diff --git a/include/linux/ti-emif-sram.h b/include/linux/ti-emif-sram.h index 45bc6b376492..53604b087f2c 100644 --- a/include/linux/ti-emif-sram.h +++ b/include/linux/ti-emif-sram.h | |||
| @@ -60,6 +60,81 @@ struct ti_emif_pm_functions { | |||
| 60 | u32 abort_sr; | 60 | u32 abort_sr; |
| 61 | } __packed __aligned(8); | 61 | } __packed __aligned(8); |
| 62 | 62 | ||
| 63 | static inline void ti_emif_asm_offsets(void) | ||
| 64 | { | ||
| 65 | DEFINE(EMIF_SDCFG_VAL_OFFSET, | ||
| 66 | offsetof(struct emif_regs_amx3, emif_sdcfg_val)); | ||
| 67 | DEFINE(EMIF_TIMING1_VAL_OFFSET, | ||
| 68 | offsetof(struct emif_regs_amx3, emif_timing1_val)); | ||
| 69 | DEFINE(EMIF_TIMING2_VAL_OFFSET, | ||
| 70 | offsetof(struct emif_regs_amx3, emif_timing2_val)); | ||
| 71 | DEFINE(EMIF_TIMING3_VAL_OFFSET, | ||
| 72 | offsetof(struct emif_regs_amx3, emif_timing3_val)); | ||
| 73 | DEFINE(EMIF_REF_CTRL_VAL_OFFSET, | ||
| 74 | offsetof(struct emif_regs_amx3, emif_ref_ctrl_val)); | ||
| 75 | DEFINE(EMIF_ZQCFG_VAL_OFFSET, | ||
| 76 | offsetof(struct emif_regs_amx3, emif_zqcfg_val)); | ||
| 77 | DEFINE(EMIF_PMCR_VAL_OFFSET, | ||
| 78 | offsetof(struct emif_regs_amx3, emif_pmcr_val)); | ||
| 79 | DEFINE(EMIF_PMCR_SHDW_VAL_OFFSET, | ||
| 80 | offsetof(struct emif_regs_amx3, emif_pmcr_shdw_val)); | ||
| 81 | DEFINE(EMIF_RD_WR_LEVEL_RAMP_CTRL_OFFSET, | ||
| 82 | offsetof(struct emif_regs_amx3, emif_rd_wr_level_ramp_ctrl)); | ||
| 83 | DEFINE(EMIF_RD_WR_EXEC_THRESH_OFFSET, | ||
| 84 | offsetof(struct emif_regs_amx3, emif_rd_wr_exec_thresh)); | ||
| 85 | DEFINE(EMIF_COS_CONFIG_OFFSET, | ||
| 86 | offsetof(struct emif_regs_amx3, emif_cos_config)); | ||
| 87 | DEFINE(EMIF_PRIORITY_TO_COS_MAPPING_OFFSET, | ||
| 88 | offsetof(struct emif_regs_amx3, emif_priority_to_cos_mapping)); | ||
| 89 | DEFINE(EMIF_CONNECT_ID_SERV_1_MAP_OFFSET, | ||
| 90 | offsetof(struct emif_regs_amx3, emif_connect_id_serv_1_map)); | ||
| 91 | DEFINE(EMIF_CONNECT_ID_SERV_2_MAP_OFFSET, | ||
| 92 | offsetof(struct emif_regs_amx3, emif_connect_id_serv_2_map)); | ||
| 93 | DEFINE(EMIF_OCP_CONFIG_VAL_OFFSET, | ||
| 94 | offsetof(struct emif_regs_amx3, emif_ocp_config_val)); | ||
| 95 | DEFINE(EMIF_LPDDR2_NVM_TIM_OFFSET, | ||
| 96 | offsetof(struct emif_regs_amx3, emif_lpddr2_nvm_tim)); | ||
| 97 | DEFINE(EMIF_LPDDR2_NVM_TIM_SHDW_OFFSET, | ||
| 98 | offsetof(struct emif_regs_amx3, emif_lpddr2_nvm_tim_shdw)); | ||
| 99 | DEFINE(EMIF_DLL_CALIB_CTRL_VAL_OFFSET, | ||
| 100 | offsetof(struct emif_regs_amx3, emif_dll_calib_ctrl_val)); | ||
| 101 | DEFINE(EMIF_DLL_CALIB_CTRL_VAL_SHDW_OFFSET, | ||
| 102 | offsetof(struct emif_regs_amx3, emif_dll_calib_ctrl_val_shdw)); | ||
| 103 | DEFINE(EMIF_DDR_PHY_CTLR_1_OFFSET, | ||
| 104 | offsetof(struct emif_regs_amx3, emif_ddr_phy_ctlr_1)); | ||
| 105 | DEFINE(EMIF_EXT_PHY_CTRL_VALS_OFFSET, | ||
| 106 | offsetof(struct emif_regs_amx3, emif_ext_phy_ctrl_vals)); | ||
| 107 | DEFINE(EMIF_REGS_AMX3_SIZE, sizeof(struct emif_regs_amx3)); | ||
| 108 | |||
| 109 | BLANK(); | ||
| 110 | |||
| 111 | DEFINE(EMIF_PM_BASE_ADDR_VIRT_OFFSET, | ||
| 112 | offsetof(struct ti_emif_pm_data, ti_emif_base_addr_virt)); | ||
| 113 | DEFINE(EMIF_PM_BASE_ADDR_PHYS_OFFSET, | ||
| 114 | offsetof(struct ti_emif_pm_data, ti_emif_base_addr_phys)); | ||
| 115 | DEFINE(EMIF_PM_CONFIG_OFFSET, | ||
| 116 | offsetof(struct ti_emif_pm_data, ti_emif_sram_config)); | ||
| 117 | DEFINE(EMIF_PM_REGS_VIRT_OFFSET, | ||
| 118 | offsetof(struct ti_emif_pm_data, regs_virt)); | ||
| 119 | DEFINE(EMIF_PM_REGS_PHYS_OFFSET, | ||
| 120 | offsetof(struct ti_emif_pm_data, regs_phys)); | ||
| 121 | DEFINE(EMIF_PM_DATA_SIZE, sizeof(struct ti_emif_pm_data)); | ||
| 122 | |||
| 123 | BLANK(); | ||
| 124 | |||
| 125 | DEFINE(EMIF_PM_SAVE_CONTEXT_OFFSET, | ||
| 126 | offsetof(struct ti_emif_pm_functions, save_context)); | ||
| 127 | DEFINE(EMIF_PM_RESTORE_CONTEXT_OFFSET, | ||
| 128 | offsetof(struct ti_emif_pm_functions, restore_context)); | ||
| 129 | DEFINE(EMIF_PM_ENTER_SR_OFFSET, | ||
| 130 | offsetof(struct ti_emif_pm_functions, enter_sr)); | ||
| 131 | DEFINE(EMIF_PM_EXIT_SR_OFFSET, | ||
| 132 | offsetof(struct ti_emif_pm_functions, exit_sr)); | ||
| 133 | DEFINE(EMIF_PM_ABORT_SR_OFFSET, | ||
| 134 | offsetof(struct ti_emif_pm_functions, abort_sr)); | ||
| 135 | DEFINE(EMIF_PM_FUNCTIONS_SIZE, sizeof(struct ti_emif_pm_functions)); | ||
| 136 | } | ||
| 137 | |||
| 63 | struct gen_pool; | 138 | struct gen_pool; |
| 64 | 139 | ||
| 65 | int ti_emif_copy_pm_function_table(struct gen_pool *sram_pool, void *dst); | 140 | int ti_emif_copy_pm_function_table(struct gen_pool *sram_pool, void *dst); |
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index 4b3dca173e89..7acb953298a7 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h | |||
| @@ -52,7 +52,6 @@ struct tk_read_base { | |||
| 52 | * @offs_real: Offset clock monotonic -> clock realtime | 52 | * @offs_real: Offset clock monotonic -> clock realtime |
| 53 | * @offs_boot: Offset clock monotonic -> clock boottime | 53 | * @offs_boot: Offset clock monotonic -> clock boottime |
| 54 | * @offs_tai: Offset clock monotonic -> clock tai | 54 | * @offs_tai: Offset clock monotonic -> clock tai |
| 55 | * @time_suspended: Accumulated suspend time | ||
| 56 | * @tai_offset: The current UTC to TAI offset in seconds | 55 | * @tai_offset: The current UTC to TAI offset in seconds |
| 57 | * @clock_was_set_seq: The sequence number of clock was set events | 56 | * @clock_was_set_seq: The sequence number of clock was set events |
| 58 | * @cs_was_changed_seq: The sequence number of clocksource change events | 57 | * @cs_was_changed_seq: The sequence number of clocksource change events |
| @@ -95,7 +94,6 @@ struct timekeeper { | |||
| 95 | ktime_t offs_real; | 94 | ktime_t offs_real; |
| 96 | ktime_t offs_boot; | 95 | ktime_t offs_boot; |
| 97 | ktime_t offs_tai; | 96 | ktime_t offs_tai; |
| 98 | ktime_t time_suspended; | ||
| 99 | s32 tai_offset; | 97 | s32 tai_offset; |
| 100 | unsigned int clock_was_set_seq; | 98 | unsigned int clock_was_set_seq; |
| 101 | u8 cs_was_changed_seq; | 99 | u8 cs_was_changed_seq; |
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 9737fbec7019..588a0e4b1ab9 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
| @@ -33,25 +33,20 @@ extern void ktime_get_ts64(struct timespec64 *ts); | |||
| 33 | extern time64_t ktime_get_seconds(void); | 33 | extern time64_t ktime_get_seconds(void); |
| 34 | extern time64_t __ktime_get_real_seconds(void); | 34 | extern time64_t __ktime_get_real_seconds(void); |
| 35 | extern time64_t ktime_get_real_seconds(void); | 35 | extern time64_t ktime_get_real_seconds(void); |
| 36 | extern void ktime_get_active_ts64(struct timespec64 *ts); | ||
| 37 | 36 | ||
| 38 | extern int __getnstimeofday64(struct timespec64 *tv); | 37 | extern int __getnstimeofday64(struct timespec64 *tv); |
| 39 | extern void getnstimeofday64(struct timespec64 *tv); | 38 | extern void getnstimeofday64(struct timespec64 *tv); |
| 40 | extern void getboottime64(struct timespec64 *ts); | 39 | extern void getboottime64(struct timespec64 *ts); |
| 41 | 40 | ||
| 42 | #define ktime_get_real_ts64(ts) getnstimeofday64(ts) | 41 | #define ktime_get_real_ts64(ts) getnstimeofday64(ts) |
| 43 | |||
| 44 | /* Clock BOOTTIME compatibility wrappers */ | ||
| 45 | static inline void get_monotonic_boottime64(struct timespec64 *ts) | ||
| 46 | { | ||
| 47 | ktime_get_ts64(ts); | ||
| 48 | } | ||
| 49 | 42 | ||
| 50 | /* | 43 | /* |
| 51 | * ktime_t based interfaces | 44 | * ktime_t based interfaces |
| 52 | */ | 45 | */ |
| 46 | |||
| 53 | enum tk_offsets { | 47 | enum tk_offsets { |
| 54 | TK_OFFS_REAL, | 48 | TK_OFFS_REAL, |
| 49 | TK_OFFS_BOOT, | ||
| 55 | TK_OFFS_TAI, | 50 | TK_OFFS_TAI, |
| 56 | TK_OFFS_MAX, | 51 | TK_OFFS_MAX, |
| 57 | }; | 52 | }; |
| @@ -62,10 +57,6 @@ extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs); | |||
| 62 | extern ktime_t ktime_get_raw(void); | 57 | extern ktime_t ktime_get_raw(void); |
| 63 | extern u32 ktime_get_resolution_ns(void); | 58 | extern u32 ktime_get_resolution_ns(void); |
| 64 | 59 | ||
| 65 | /* Clock BOOTTIME compatibility wrappers */ | ||
| 66 | static inline ktime_t ktime_get_boottime(void) { return ktime_get(); } | ||
| 67 | static inline u64 ktime_get_boot_ns(void) { return ktime_get(); } | ||
| 68 | |||
| 69 | /** | 60 | /** |
| 70 | * ktime_get_real - get the real (wall-) time in ktime_t format | 61 | * ktime_get_real - get the real (wall-) time in ktime_t format |
| 71 | */ | 62 | */ |
| @@ -75,6 +66,17 @@ static inline ktime_t ktime_get_real(void) | |||
| 75 | } | 66 | } |
| 76 | 67 | ||
| 77 | /** | 68 | /** |
| 69 | * ktime_get_boottime - Returns monotonic time since boot in ktime_t format | ||
| 70 | * | ||
| 71 | * This is similar to CLOCK_MONTONIC/ktime_get, but also includes the | ||
| 72 | * time spent in suspend. | ||
| 73 | */ | ||
| 74 | static inline ktime_t ktime_get_boottime(void) | ||
| 75 | { | ||
| 76 | return ktime_get_with_offset(TK_OFFS_BOOT); | ||
| 77 | } | ||
| 78 | |||
| 79 | /** | ||
| 78 | * ktime_get_clocktai - Returns the TAI time of day in ktime_t format | 80 | * ktime_get_clocktai - Returns the TAI time of day in ktime_t format |
| 79 | */ | 81 | */ |
| 80 | static inline ktime_t ktime_get_clocktai(void) | 82 | static inline ktime_t ktime_get_clocktai(void) |
| @@ -100,6 +102,11 @@ static inline u64 ktime_get_real_ns(void) | |||
| 100 | return ktime_to_ns(ktime_get_real()); | 102 | return ktime_to_ns(ktime_get_real()); |
| 101 | } | 103 | } |
| 102 | 104 | ||
| 105 | static inline u64 ktime_get_boot_ns(void) | ||
| 106 | { | ||
| 107 | return ktime_to_ns(ktime_get_boottime()); | ||
| 108 | } | ||
| 109 | |||
| 103 | static inline u64 ktime_get_tai_ns(void) | 110 | static inline u64 ktime_get_tai_ns(void) |
| 104 | { | 111 | { |
| 105 | return ktime_to_ns(ktime_get_clocktai()); | 112 | return ktime_to_ns(ktime_get_clocktai()); |
| @@ -112,11 +119,17 @@ static inline u64 ktime_get_raw_ns(void) | |||
| 112 | 119 | ||
| 113 | extern u64 ktime_get_mono_fast_ns(void); | 120 | extern u64 ktime_get_mono_fast_ns(void); |
| 114 | extern u64 ktime_get_raw_fast_ns(void); | 121 | extern u64 ktime_get_raw_fast_ns(void); |
| 122 | extern u64 ktime_get_boot_fast_ns(void); | ||
| 115 | extern u64 ktime_get_real_fast_ns(void); | 123 | extern u64 ktime_get_real_fast_ns(void); |
| 116 | 124 | ||
| 117 | /* | 125 | /* |
| 118 | * timespec64 interfaces utilizing the ktime based ones | 126 | * timespec64 interfaces utilizing the ktime based ones |
| 119 | */ | 127 | */ |
| 128 | static inline void get_monotonic_boottime64(struct timespec64 *ts) | ||
| 129 | { | ||
| 130 | *ts = ktime_to_timespec64(ktime_get_boottime()); | ||
| 131 | } | ||
| 132 | |||
| 120 | static inline void timekeeping_clocktai64(struct timespec64 *ts) | 133 | static inline void timekeeping_clocktai64(struct timespec64 *ts) |
| 121 | { | 134 | { |
| 122 | *ts = ktime_to_timespec64(ktime_get_clocktai()); | 135 | *ts = ktime_to_timespec64(ktime_get_clocktai()); |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 47f8af22f216..1dd587ba6d88 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -701,7 +701,7 @@ extern int tty_unregister_ldisc(int disc); | |||
| 701 | extern int tty_set_ldisc(struct tty_struct *tty, int disc); | 701 | extern int tty_set_ldisc(struct tty_struct *tty, int disc); |
| 702 | extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty); | 702 | extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty); |
| 703 | extern void tty_ldisc_release(struct tty_struct *tty); | 703 | extern void tty_ldisc_release(struct tty_struct *tty); |
| 704 | extern void tty_ldisc_init(struct tty_struct *tty); | 704 | extern int __must_check tty_ldisc_init(struct tty_struct *tty); |
| 705 | extern void tty_ldisc_deinit(struct tty_struct *tty); | 705 | extern void tty_ldisc_deinit(struct tty_struct *tty); |
| 706 | extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, | 706 | extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, |
| 707 | char *f, int count); | 707 | char *f, int count); |
diff --git a/include/linux/vbox_utils.h b/include/linux/vbox_utils.h index c71def6b310f..a240ed2a0372 100644 --- a/include/linux/vbox_utils.h +++ b/include/linux/vbox_utils.h | |||
| @@ -24,24 +24,6 @@ __printf(1, 2) void vbg_debug(const char *fmt, ...); | |||
| 24 | #define vbg_debug pr_debug | 24 | #define vbg_debug pr_debug |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | /** | ||
| 28 | * Allocate memory for generic request and initialize the request header. | ||
| 29 | * | ||
| 30 | * Return: the allocated memory | ||
| 31 | * @len: Size of memory block required for the request. | ||
| 32 | * @req_type: The generic request type. | ||
| 33 | */ | ||
| 34 | void *vbg_req_alloc(size_t len, enum vmmdev_request_type req_type); | ||
| 35 | |||
| 36 | /** | ||
| 37 | * Perform a generic request. | ||
| 38 | * | ||
| 39 | * Return: VBox status code | ||
| 40 | * @gdev: The Guest extension device. | ||
| 41 | * @req: Pointer to the request structure. | ||
| 42 | */ | ||
| 43 | int vbg_req_perform(struct vbg_dev *gdev, void *req); | ||
| 44 | |||
| 45 | int vbg_hgcm_connect(struct vbg_dev *gdev, | 27 | int vbg_hgcm_connect(struct vbg_dev *gdev, |
| 46 | struct vmmdev_hgcm_service_location *loc, | 28 | struct vmmdev_hgcm_service_location *loc, |
| 47 | u32 *client_id, int *vbox_status); | 29 | u32 *client_id, int *vbox_status); |
| @@ -52,11 +34,6 @@ int vbg_hgcm_call(struct vbg_dev *gdev, u32 client_id, u32 function, | |||
| 52 | u32 timeout_ms, struct vmmdev_hgcm_function_parameter *parms, | 34 | u32 timeout_ms, struct vmmdev_hgcm_function_parameter *parms, |
| 53 | u32 parm_count, int *vbox_status); | 35 | u32 parm_count, int *vbox_status); |
| 54 | 36 | ||
| 55 | int vbg_hgcm_call32( | ||
| 56 | struct vbg_dev *gdev, u32 client_id, u32 function, u32 timeout_ms, | ||
| 57 | struct vmmdev_hgcm_function_parameter32 *parm32, u32 parm_count, | ||
| 58 | int *vbox_status); | ||
| 59 | |||
| 60 | /** | 37 | /** |
| 61 | * Convert a VirtualBox status code to a standard Linux kernel return value. | 38 | * Convert a VirtualBox status code to a standard Linux kernel return value. |
| 62 | * Return: 0 or negative errno value. | 39 | * Return: 0 or negative errno value. |
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 988c7355bc22..fa1b5da2804e 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
| @@ -157,6 +157,9 @@ int virtio_device_freeze(struct virtio_device *dev); | |||
| 157 | int virtio_device_restore(struct virtio_device *dev); | 157 | int virtio_device_restore(struct virtio_device *dev); |
| 158 | #endif | 158 | #endif |
| 159 | 159 | ||
| 160 | #define virtio_device_for_each_vq(vdev, vq) \ | ||
| 161 | list_for_each_entry(vq, &vdev->vqs, list) | ||
| 162 | |||
| 160 | /** | 163 | /** |
| 161 | * virtio_driver - operations for a virtio I/O driver | 164 | * virtio_driver - operations for a virtio I/O driver |
| 162 | * @driver: underlying device driver (populate name and owner). | 165 | * @driver: underlying device driver (populate name and owner). |
diff --git a/include/net/ife.h b/include/net/ife.h index 44b9c00f7223..e117617e3c34 100644 --- a/include/net/ife.h +++ b/include/net/ife.h | |||
| @@ -12,7 +12,8 @@ | |||
| 12 | void *ife_encode(struct sk_buff *skb, u16 metalen); | 12 | void *ife_encode(struct sk_buff *skb, u16 metalen); |
| 13 | void *ife_decode(struct sk_buff *skb, u16 *metalen); | 13 | void *ife_decode(struct sk_buff *skb, u16 *metalen); |
| 14 | 14 | ||
| 15 | void *ife_tlv_meta_decode(void *skbdata, u16 *attrtype, u16 *dlen, u16 *totlen); | 15 | void *ife_tlv_meta_decode(void *skbdata, const void *ifehdr_end, u16 *attrtype, |
| 16 | u16 *dlen, u16 *totlen); | ||
| 16 | int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, | 17 | int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, |
| 17 | const void *dval); | 18 | const void *dval); |
| 18 | 19 | ||
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index 5c40f118c0fa..df528a623548 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h | |||
| @@ -97,6 +97,7 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb) | |||
| 97 | 97 | ||
| 98 | struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, | 98 | struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, |
| 99 | struct proto *prot, int kern); | 99 | struct proto *prot, int kern); |
| 100 | void llc_sk_stop_all_timers(struct sock *sk, bool sync); | ||
| 100 | void llc_sk_free(struct sock *sk); | 101 | void llc_sk_free(struct sock *sk); |
| 101 | 102 | ||
| 102 | void llc_sk_reset(struct sock *sk); | 103 | void llc_sk_reset(struct sock *sk); |
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index 04e0679767f6..e03bd9d41fa8 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h | |||
| @@ -11,8 +11,6 @@ struct scsi_sense_hdr; | |||
| 11 | extern void scsi_print_command(struct scsi_cmnd *); | 11 | extern void scsi_print_command(struct scsi_cmnd *); |
| 12 | extern size_t __scsi_format_command(char *, size_t, | 12 | extern size_t __scsi_format_command(char *, size_t, |
| 13 | const unsigned char *, size_t); | 13 | const unsigned char *, size_t); |
| 14 | extern void scsi_show_extd_sense(const struct scsi_device *, const char *, | ||
| 15 | unsigned char, unsigned char); | ||
| 16 | extern void scsi_print_sense_hdr(const struct scsi_device *, const char *, | 14 | extern void scsi_print_sense_hdr(const struct scsi_device *, const char *, |
| 17 | const struct scsi_sense_hdr *); | 15 | const struct scsi_sense_hdr *); |
| 18 | extern void scsi_print_sense(const struct scsi_cmnd *); | 16 | extern void scsi_print_sense(const struct scsi_cmnd *); |
diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h index 50df5b28d2c9..8ee8991aa099 100644 --- a/include/soc/bcm2835/raspberrypi-firmware.h +++ b/include/soc/bcm2835/raspberrypi-firmware.h | |||
| @@ -143,13 +143,13 @@ struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); | |||
| 143 | static inline int rpi_firmware_property(struct rpi_firmware *fw, u32 tag, | 143 | static inline int rpi_firmware_property(struct rpi_firmware *fw, u32 tag, |
| 144 | void *data, size_t len) | 144 | void *data, size_t len) |
| 145 | { | 145 | { |
| 146 | return 0; | 146 | return -ENOSYS; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | static inline int rpi_firmware_property_list(struct rpi_firmware *fw, | 149 | static inline int rpi_firmware_property_list(struct rpi_firmware *fw, |
| 150 | void *data, size_t tag_size) | 150 | void *data, size_t tag_size) |
| 151 | { | 151 | { |
| 152 | return 0; | 152 | return -ENOSYS; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) | 155 | static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) |
diff --git a/include/sound/control.h b/include/sound/control.h index ca13a44ae9d4..6011a58d3e20 100644 --- a/include/sound/control.h +++ b/include/sound/control.h | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
| 26 | #include <linux/nospec.h> | ||
| 26 | #include <sound/asound.h> | 27 | #include <sound/asound.h> |
| 27 | 28 | ||
| 28 | #define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data) | 29 | #define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data) |
| @@ -148,12 +149,14 @@ int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type); | |||
| 148 | 149 | ||
| 149 | static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) | 150 | static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) |
| 150 | { | 151 | { |
| 151 | return id->numid - kctl->id.numid; | 152 | unsigned int ioff = id->numid - kctl->id.numid; |
| 153 | return array_index_nospec(ioff, kctl->count); | ||
| 152 | } | 154 | } |
| 153 | 155 | ||
| 154 | static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) | 156 | static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) |
| 155 | { | 157 | { |
| 156 | return id->index - kctl->id.index; | 158 | unsigned int ioff = id->index - kctl->id.index; |
| 159 | return array_index_nospec(ioff, kctl->count); | ||
| 157 | } | 160 | } |
| 158 | 161 | ||
| 159 | static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) | 162 | static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) |
diff --git a/include/trace/events/ufs.h b/include/trace/events/ufs.h index bf6f82673492..f8260e5c79ad 100644 --- a/include/trace/events/ufs.h +++ b/include/trace/events/ufs.h | |||
| @@ -257,6 +257,33 @@ TRACE_EVENT(ufshcd_command, | |||
| 257 | ) | 257 | ) |
| 258 | ); | 258 | ); |
| 259 | 259 | ||
| 260 | TRACE_EVENT(ufshcd_upiu, | ||
| 261 | TP_PROTO(const char *dev_name, const char *str, void *hdr, void *tsf), | ||
| 262 | |||
| 263 | TP_ARGS(dev_name, str, hdr, tsf), | ||
| 264 | |||
| 265 | TP_STRUCT__entry( | ||
| 266 | __string(dev_name, dev_name) | ||
| 267 | __string(str, str) | ||
| 268 | __array(unsigned char, hdr, 12) | ||
| 269 | __array(unsigned char, tsf, 16) | ||
| 270 | ), | ||
| 271 | |||
| 272 | TP_fast_assign( | ||
| 273 | __assign_str(dev_name, dev_name); | ||
| 274 | __assign_str(str, str); | ||
| 275 | memcpy(__entry->hdr, hdr, sizeof(__entry->hdr)); | ||
| 276 | memcpy(__entry->tsf, tsf, sizeof(__entry->tsf)); | ||
| 277 | ), | ||
| 278 | |||
| 279 | TP_printk( | ||
| 280 | "%s: %s: HDR:%s, CDB:%s", | ||
| 281 | __get_str(str), __get_str(dev_name), | ||
| 282 | __print_hex(__entry->hdr, sizeof(__entry->hdr)), | ||
| 283 | __print_hex(__entry->tsf, sizeof(__entry->tsf)) | ||
| 284 | ) | ||
| 285 | ); | ||
| 286 | |||
| 260 | #endif /* if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ) */ | 287 | #endif /* if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ) */ |
| 261 | 288 | ||
| 262 | /* This part must be outside protection */ | 289 | /* This part must be outside protection */ |
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h index 2f057a494d93..9a761bc6a251 100644 --- a/include/trace/events/workqueue.h +++ b/include/trace/events/workqueue.h | |||
| @@ -25,6 +25,8 @@ DECLARE_EVENT_CLASS(workqueue_work, | |||
| 25 | TP_printk("work struct %p", __entry->work) | 25 | TP_printk("work struct %p", __entry->work) |
| 26 | ); | 26 | ); |
| 27 | 27 | ||
| 28 | struct pool_workqueue; | ||
| 29 | |||
| 28 | /** | 30 | /** |
| 29 | * workqueue_queue_work - called when a work gets queued | 31 | * workqueue_queue_work - called when a work gets queued |
| 30 | * @req_cpu: the requested cpu | 32 | * @req_cpu: the requested cpu |
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 1065006c9bf5..b02c41e53d56 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h | |||
| @@ -676,6 +676,13 @@ struct kvm_ioeventfd { | |||
| 676 | __u8 pad[36]; | 676 | __u8 pad[36]; |
| 677 | }; | 677 | }; |
| 678 | 678 | ||
| 679 | #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) | ||
| 680 | #define KVM_X86_DISABLE_EXITS_HTL (1 << 1) | ||
| 681 | #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) | ||
| 682 | #define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \ | ||
| 683 | KVM_X86_DISABLE_EXITS_HTL | \ | ||
| 684 | KVM_X86_DISABLE_EXITS_PAUSE) | ||
| 685 | |||
| 679 | /* for KVM_ENABLE_CAP */ | 686 | /* for KVM_ENABLE_CAP */ |
| 680 | struct kvm_enable_cap { | 687 | struct kvm_enable_cap { |
| 681 | /* in */ | 688 | /* in */ |
diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h index 0f272818a4d2..6b58371b1f0d 100644 --- a/include/uapi/linux/sysctl.h +++ b/include/uapi/linux/sysctl.h | |||
| @@ -780,24 +780,6 @@ enum { | |||
| 780 | NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5, | 780 | NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5, |
| 781 | }; | 781 | }; |
| 782 | 782 | ||
| 783 | /* proc/sys/net/irda */ | ||
| 784 | enum { | ||
| 785 | NET_IRDA_DISCOVERY=1, | ||
| 786 | NET_IRDA_DEVNAME=2, | ||
| 787 | NET_IRDA_DEBUG=3, | ||
| 788 | NET_IRDA_FAST_POLL=4, | ||
| 789 | NET_IRDA_DISCOVERY_SLOTS=5, | ||
| 790 | NET_IRDA_DISCOVERY_TIMEOUT=6, | ||
| 791 | NET_IRDA_SLOT_TIMEOUT=7, | ||
| 792 | NET_IRDA_MAX_BAUD_RATE=8, | ||
| 793 | NET_IRDA_MIN_TX_TURN_TIME=9, | ||
| 794 | NET_IRDA_MAX_TX_DATA_SIZE=10, | ||
| 795 | NET_IRDA_MAX_TX_WINDOW=11, | ||
| 796 | NET_IRDA_MAX_NOREPLY_TIME=12, | ||
| 797 | NET_IRDA_WARN_NOREPLY_TIME=13, | ||
| 798 | NET_IRDA_LAP_KEEPALIVE_TIME=14, | ||
| 799 | }; | ||
| 800 | |||
| 801 | 783 | ||
| 802 | /* CTL_FS names: */ | 784 | /* CTL_FS names: */ |
| 803 | enum | 785 | enum |
diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h index 16a296612ba4..4c0338ea308a 100644 --- a/include/uapi/linux/time.h +++ b/include/uapi/linux/time.h | |||
| @@ -73,7 +73,6 @@ struct __kernel_old_timeval { | |||
| 73 | */ | 73 | */ |
| 74 | #define CLOCK_SGI_CYCLE 10 | 74 | #define CLOCK_SGI_CYCLE 10 |
| 75 | #define CLOCK_TAI 11 | 75 | #define CLOCK_TAI 11 |
| 76 | #define CLOCK_MONOTONIC_ACTIVE 12 | ||
| 77 | 76 | ||
| 78 | #define MAX_CLOCKS 16 | 77 | #define MAX_CLOCKS 16 |
| 79 | #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) | 78 | #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) |
diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h index 40297a3181ed..13b8cb563892 100644 --- a/include/uapi/linux/virtio_balloon.h +++ b/include/uapi/linux/virtio_balloon.h | |||
| @@ -57,6 +57,21 @@ struct virtio_balloon_config { | |||
| 57 | #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */ | 57 | #define VIRTIO_BALLOON_S_HTLB_PGFAIL 9 /* Hugetlb page allocation failures */ |
| 58 | #define VIRTIO_BALLOON_S_NR 10 | 58 | #define VIRTIO_BALLOON_S_NR 10 |
| 59 | 59 | ||
| 60 | #define VIRTIO_BALLOON_S_NAMES_WITH_PREFIX(VIRTIO_BALLOON_S_NAMES_prefix) { \ | ||
| 61 | VIRTIO_BALLOON_S_NAMES_prefix "swap-in", \ | ||
| 62 | VIRTIO_BALLOON_S_NAMES_prefix "swap-out", \ | ||
| 63 | VIRTIO_BALLOON_S_NAMES_prefix "major-faults", \ | ||
| 64 | VIRTIO_BALLOON_S_NAMES_prefix "minor-faults", \ | ||
| 65 | VIRTIO_BALLOON_S_NAMES_prefix "free-memory", \ | ||
| 66 | VIRTIO_BALLOON_S_NAMES_prefix "total-memory", \ | ||
| 67 | VIRTIO_BALLOON_S_NAMES_prefix "available-memory", \ | ||
| 68 | VIRTIO_BALLOON_S_NAMES_prefix "disk-caches", \ | ||
| 69 | VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-allocations", \ | ||
| 70 | VIRTIO_BALLOON_S_NAMES_prefix "hugetlb-failures" \ | ||
| 71 | } | ||
| 72 | |||
| 73 | #define VIRTIO_BALLOON_S_NAMES VIRTIO_BALLOON_S_NAMES_WITH_PREFIX("") | ||
| 74 | |||
| 60 | /* | 75 | /* |
| 61 | * Memory statistics structure. | 76 | * Memory statistics structure. |
| 62 | * Driver fills an array of these structures and passes to device. | 77 | * Driver fills an array of these structures and passes to device. |
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index d315b393abdd..ba03ec39efb3 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
| @@ -1572,13 +1572,32 @@ int bpf_prog_array_length(struct bpf_prog_array __rcu *progs) | |||
| 1572 | return cnt; | 1572 | return cnt; |
| 1573 | } | 1573 | } |
| 1574 | 1574 | ||
| 1575 | static bool bpf_prog_array_copy_core(struct bpf_prog **prog, | ||
| 1576 | u32 *prog_ids, | ||
| 1577 | u32 request_cnt) | ||
| 1578 | { | ||
| 1579 | int i = 0; | ||
| 1580 | |||
| 1581 | for (; *prog; prog++) { | ||
| 1582 | if (*prog == &dummy_bpf_prog.prog) | ||
| 1583 | continue; | ||
| 1584 | prog_ids[i] = (*prog)->aux->id; | ||
| 1585 | if (++i == request_cnt) { | ||
| 1586 | prog++; | ||
| 1587 | break; | ||
| 1588 | } | ||
| 1589 | } | ||
| 1590 | |||
| 1591 | return !!(*prog); | ||
| 1592 | } | ||
| 1593 | |||
| 1575 | int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, | 1594 | int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, |
| 1576 | __u32 __user *prog_ids, u32 cnt) | 1595 | __u32 __user *prog_ids, u32 cnt) |
| 1577 | { | 1596 | { |
| 1578 | struct bpf_prog **prog; | 1597 | struct bpf_prog **prog; |
| 1579 | unsigned long err = 0; | 1598 | unsigned long err = 0; |
| 1580 | u32 i = 0, *ids; | ||
| 1581 | bool nospc; | 1599 | bool nospc; |
| 1600 | u32 *ids; | ||
| 1582 | 1601 | ||
| 1583 | /* users of this function are doing: | 1602 | /* users of this function are doing: |
| 1584 | * cnt = bpf_prog_array_length(); | 1603 | * cnt = bpf_prog_array_length(); |
| @@ -1595,16 +1614,7 @@ int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs, | |||
| 1595 | return -ENOMEM; | 1614 | return -ENOMEM; |
| 1596 | rcu_read_lock(); | 1615 | rcu_read_lock(); |
| 1597 | prog = rcu_dereference(progs)->progs; | 1616 | prog = rcu_dereference(progs)->progs; |
| 1598 | for (; *prog; prog++) { | 1617 | nospc = bpf_prog_array_copy_core(prog, ids, cnt); |
| 1599 | if (*prog == &dummy_bpf_prog.prog) | ||
| 1600 | continue; | ||
| 1601 | ids[i] = (*prog)->aux->id; | ||
| 1602 | if (++i == cnt) { | ||
| 1603 | prog++; | ||
| 1604 | break; | ||
| 1605 | } | ||
| 1606 | } | ||
| 1607 | nospc = !!(*prog); | ||
| 1608 | rcu_read_unlock(); | 1618 | rcu_read_unlock(); |
| 1609 | err = copy_to_user(prog_ids, ids, cnt * sizeof(u32)); | 1619 | err = copy_to_user(prog_ids, ids, cnt * sizeof(u32)); |
| 1610 | kfree(ids); | 1620 | kfree(ids); |
| @@ -1683,22 +1693,25 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array, | |||
| 1683 | } | 1693 | } |
| 1684 | 1694 | ||
| 1685 | int bpf_prog_array_copy_info(struct bpf_prog_array __rcu *array, | 1695 | int bpf_prog_array_copy_info(struct bpf_prog_array __rcu *array, |
| 1686 | __u32 __user *prog_ids, u32 request_cnt, | 1696 | u32 *prog_ids, u32 request_cnt, |
| 1687 | __u32 __user *prog_cnt) | 1697 | u32 *prog_cnt) |
| 1688 | { | 1698 | { |
| 1699 | struct bpf_prog **prog; | ||
| 1689 | u32 cnt = 0; | 1700 | u32 cnt = 0; |
| 1690 | 1701 | ||
| 1691 | if (array) | 1702 | if (array) |
| 1692 | cnt = bpf_prog_array_length(array); | 1703 | cnt = bpf_prog_array_length(array); |
| 1693 | 1704 | ||
| 1694 | if (copy_to_user(prog_cnt, &cnt, sizeof(cnt))) | 1705 | *prog_cnt = cnt; |
| 1695 | return -EFAULT; | ||
| 1696 | 1706 | ||
| 1697 | /* return early if user requested only program count or nothing to copy */ | 1707 | /* return early if user requested only program count or nothing to copy */ |
| 1698 | if (!request_cnt || !cnt) | 1708 | if (!request_cnt || !cnt) |
| 1699 | return 0; | 1709 | return 0; |
| 1700 | 1710 | ||
| 1701 | return bpf_prog_array_copy_to_user(array, prog_ids, request_cnt); | 1711 | /* this function is called under trace/bpf_trace.c: bpf_event_mutex */ |
| 1712 | prog = rcu_dereference_check(array, 1)->progs; | ||
| 1713 | return bpf_prog_array_copy_core(prog, prog_ids, request_cnt) ? -ENOSPC | ||
| 1714 | : 0; | ||
| 1702 | } | 1715 | } |
| 1703 | 1716 | ||
| 1704 | static void bpf_prog_free_deferred(struct work_struct *work) | 1717 | static void bpf_prog_free_deferred(struct work_struct *work) |
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 8dd9210d7db7..a3b21385e947 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c | |||
| @@ -1442,9 +1442,6 @@ static struct bpf_map *sock_map_alloc(union bpf_attr *attr) | |||
| 1442 | attr->value_size != 4 || attr->map_flags & ~SOCK_CREATE_FLAG_MASK) | 1442 | attr->value_size != 4 || attr->map_flags & ~SOCK_CREATE_FLAG_MASK) |
| 1443 | return ERR_PTR(-EINVAL); | 1443 | return ERR_PTR(-EINVAL); |
| 1444 | 1444 | ||
| 1445 | if (attr->value_size > KMALLOC_MAX_SIZE) | ||
| 1446 | return ERR_PTR(-E2BIG); | ||
| 1447 | |||
| 1448 | err = bpf_tcp_ulp_register(); | 1445 | err = bpf_tcp_ulp_register(); |
| 1449 | if (err && err != -EEXIST) | 1446 | if (err && err != -EEXIST) |
| 1450 | return ERR_PTR(err); | 1447 | return ERR_PTR(err); |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 102160ff5c66..ea619021d901 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
| @@ -2428,7 +2428,7 @@ static int kprobe_blacklist_seq_show(struct seq_file *m, void *v) | |||
| 2428 | struct kprobe_blacklist_entry *ent = | 2428 | struct kprobe_blacklist_entry *ent = |
| 2429 | list_entry(v, struct kprobe_blacklist_entry, list); | 2429 | list_entry(v, struct kprobe_blacklist_entry, list); |
| 2430 | 2430 | ||
| 2431 | seq_printf(m, "0x%p-0x%p\t%ps\n", (void *)ent->start_addr, | 2431 | seq_printf(m, "0x%px-0x%px\t%ps\n", (void *)ent->start_addr, |
| 2432 | (void *)ent->end_addr, (void *)ent->start_addr); | 2432 | (void *)ent->end_addr, (void *)ent->start_addr); |
| 2433 | return 0; | 2433 | return 0; |
| 2434 | } | 2434 | } |
diff --git a/kernel/module.c b/kernel/module.c index a6e43a5806a1..ce8066b88178 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -1472,7 +1472,8 @@ static ssize_t module_sect_show(struct module_attribute *mattr, | |||
| 1472 | { | 1472 | { |
| 1473 | struct module_sect_attr *sattr = | 1473 | struct module_sect_attr *sattr = |
| 1474 | container_of(mattr, struct module_sect_attr, mattr); | 1474 | container_of(mattr, struct module_sect_attr, mattr); |
| 1475 | return sprintf(buf, "0x%pK\n", (void *)sattr->address); | 1475 | return sprintf(buf, "0x%px\n", kptr_restrict < 2 ? |
| 1476 | (void *)sattr->address : NULL); | ||
| 1476 | } | 1477 | } |
| 1477 | 1478 | ||
| 1478 | static void free_sect_attrs(struct module_sect_attrs *sect_attrs) | 1479 | static void free_sect_attrs(struct module_sect_attrs *sect_attrs) |
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c index e8c0dab4fd65..07148b497451 100644 --- a/kernel/sysctl_binary.c +++ b/kernel/sysctl_binary.c | |||
| @@ -704,24 +704,6 @@ static const struct bin_table bin_net_netfilter_table[] = { | |||
| 704 | {} | 704 | {} |
| 705 | }; | 705 | }; |
| 706 | 706 | ||
| 707 | static const struct bin_table bin_net_irda_table[] = { | ||
| 708 | { CTL_INT, NET_IRDA_DISCOVERY, "discovery" }, | ||
| 709 | { CTL_STR, NET_IRDA_DEVNAME, "devname" }, | ||
| 710 | { CTL_INT, NET_IRDA_DEBUG, "debug" }, | ||
| 711 | { CTL_INT, NET_IRDA_FAST_POLL, "fast_poll_increase" }, | ||
| 712 | { CTL_INT, NET_IRDA_DISCOVERY_SLOTS, "discovery_slots" }, | ||
| 713 | { CTL_INT, NET_IRDA_DISCOVERY_TIMEOUT, "discovery_timeout" }, | ||
| 714 | { CTL_INT, NET_IRDA_SLOT_TIMEOUT, "slot_timeout" }, | ||
| 715 | { CTL_INT, NET_IRDA_MAX_BAUD_RATE, "max_baud_rate" }, | ||
| 716 | { CTL_INT, NET_IRDA_MIN_TX_TURN_TIME, "min_tx_turn_time" }, | ||
| 717 | { CTL_INT, NET_IRDA_MAX_TX_DATA_SIZE, "max_tx_data_size" }, | ||
| 718 | { CTL_INT, NET_IRDA_MAX_TX_WINDOW, "max_tx_window" }, | ||
| 719 | { CTL_INT, NET_IRDA_MAX_NOREPLY_TIME, "max_noreply_time" }, | ||
| 720 | { CTL_INT, NET_IRDA_WARN_NOREPLY_TIME, "warn_noreply_time" }, | ||
| 721 | { CTL_INT, NET_IRDA_LAP_KEEPALIVE_TIME, "lap_keepalive_time" }, | ||
| 722 | {} | ||
| 723 | }; | ||
| 724 | |||
| 725 | static const struct bin_table bin_net_table[] = { | 707 | static const struct bin_table bin_net_table[] = { |
| 726 | { CTL_DIR, NET_CORE, "core", bin_net_core_table }, | 708 | { CTL_DIR, NET_CORE, "core", bin_net_core_table }, |
| 727 | /* NET_ETHER not used */ | 709 | /* NET_ETHER not used */ |
| @@ -743,7 +725,7 @@ static const struct bin_table bin_net_table[] = { | |||
| 743 | { CTL_DIR, NET_LLC, "llc", bin_net_llc_table }, | 725 | { CTL_DIR, NET_LLC, "llc", bin_net_llc_table }, |
| 744 | { CTL_DIR, NET_NETFILTER, "netfilter", bin_net_netfilter_table }, | 726 | { CTL_DIR, NET_NETFILTER, "netfilter", bin_net_netfilter_table }, |
| 745 | /* NET_DCCP "dccp" no longer used */ | 727 | /* NET_DCCP "dccp" no longer used */ |
| 746 | { CTL_DIR, NET_IRDA, "irda", bin_net_irda_table }, | 728 | /* NET_IRDA "irda" no longer used */ |
| 747 | { CTL_INT, 2089, "nf_conntrack_max" }, | 729 | { CTL_INT, 2089, "nf_conntrack_max" }, |
| 748 | {} | 730 | {} |
| 749 | }; | 731 | }; |
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index eda1210ce50f..14e858753d76 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
| @@ -91,6 +91,11 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = | |||
| 91 | .get_time = &ktime_get_real, | 91 | .get_time = &ktime_get_real, |
| 92 | }, | 92 | }, |
| 93 | { | 93 | { |
| 94 | .index = HRTIMER_BASE_BOOTTIME, | ||
| 95 | .clockid = CLOCK_BOOTTIME, | ||
| 96 | .get_time = &ktime_get_boottime, | ||
| 97 | }, | ||
| 98 | { | ||
| 94 | .index = HRTIMER_BASE_TAI, | 99 | .index = HRTIMER_BASE_TAI, |
| 95 | .clockid = CLOCK_TAI, | 100 | .clockid = CLOCK_TAI, |
| 96 | .get_time = &ktime_get_clocktai, | 101 | .get_time = &ktime_get_clocktai, |
| @@ -106,6 +111,11 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = | |||
| 106 | .get_time = &ktime_get_real, | 111 | .get_time = &ktime_get_real, |
| 107 | }, | 112 | }, |
| 108 | { | 113 | { |
| 114 | .index = HRTIMER_BASE_BOOTTIME_SOFT, | ||
| 115 | .clockid = CLOCK_BOOTTIME, | ||
| 116 | .get_time = &ktime_get_boottime, | ||
| 117 | }, | ||
| 118 | { | ||
| 109 | .index = HRTIMER_BASE_TAI_SOFT, | 119 | .index = HRTIMER_BASE_TAI_SOFT, |
| 110 | .clockid = CLOCK_TAI, | 120 | .clockid = CLOCK_TAI, |
| 111 | .get_time = &ktime_get_clocktai, | 121 | .get_time = &ktime_get_clocktai, |
| @@ -119,7 +129,7 @@ static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = { | |||
| 119 | 129 | ||
| 120 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, | 130 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, |
| 121 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, | 131 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, |
| 122 | [CLOCK_BOOTTIME] = HRTIMER_BASE_MONOTONIC, | 132 | [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME, |
| 123 | [CLOCK_TAI] = HRTIMER_BASE_TAI, | 133 | [CLOCK_TAI] = HRTIMER_BASE_TAI, |
| 124 | }; | 134 | }; |
| 125 | 135 | ||
| @@ -571,12 +581,14 @@ __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base, unsigned int active_ | |||
| 571 | static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base) | 581 | static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base) |
| 572 | { | 582 | { |
| 573 | ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset; | 583 | ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset; |
| 584 | ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset; | ||
| 574 | ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI].offset; | 585 | ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI].offset; |
| 575 | 586 | ||
| 576 | ktime_t now = ktime_get_update_offsets_now(&base->clock_was_set_seq, | 587 | ktime_t now = ktime_get_update_offsets_now(&base->clock_was_set_seq, |
| 577 | offs_real, offs_tai); | 588 | offs_real, offs_boot, offs_tai); |
| 578 | 589 | ||
| 579 | base->clock_base[HRTIMER_BASE_REALTIME_SOFT].offset = *offs_real; | 590 | base->clock_base[HRTIMER_BASE_REALTIME_SOFT].offset = *offs_real; |
| 591 | base->clock_base[HRTIMER_BASE_BOOTTIME_SOFT].offset = *offs_boot; | ||
| 580 | base->clock_base[HRTIMER_BASE_TAI_SOFT].offset = *offs_tai; | 592 | base->clock_base[HRTIMER_BASE_TAI_SOFT].offset = *offs_tai; |
| 581 | 593 | ||
| 582 | return now; | 594 | return now; |
diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c index e0dbae98db9d..69a937c3cd81 100644 --- a/kernel/time/posix-stubs.c +++ b/kernel/time/posix-stubs.c | |||
| @@ -83,8 +83,6 @@ int do_clock_gettime(clockid_t which_clock, struct timespec64 *tp) | |||
| 83 | case CLOCK_BOOTTIME: | 83 | case CLOCK_BOOTTIME: |
| 84 | get_monotonic_boottime64(tp); | 84 | get_monotonic_boottime64(tp); |
| 85 | break; | 85 | break; |
| 86 | case CLOCK_MONOTONIC_ACTIVE: | ||
| 87 | ktime_get_active_ts64(tp); | ||
| 88 | default: | 86 | default: |
| 89 | return -EINVAL; | 87 | return -EINVAL; |
| 90 | } | 88 | } |
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index b6899b5060bd..10b7186d0638 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c | |||
| @@ -252,16 +252,15 @@ static int posix_get_coarse_res(const clockid_t which_clock, struct timespec64 * | |||
| 252 | return 0; | 252 | return 0; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | static int posix_get_tai(clockid_t which_clock, struct timespec64 *tp) | 255 | static int posix_get_boottime(const clockid_t which_clock, struct timespec64 *tp) |
| 256 | { | 256 | { |
| 257 | timekeeping_clocktai64(tp); | 257 | get_monotonic_boottime64(tp); |
| 258 | return 0; | 258 | return 0; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | static int posix_get_monotonic_active(clockid_t which_clock, | 261 | static int posix_get_tai(clockid_t which_clock, struct timespec64 *tp) |
| 262 | struct timespec64 *tp) | ||
| 263 | { | 262 | { |
| 264 | ktime_get_active_ts64(tp); | 263 | timekeeping_clocktai64(tp); |
| 265 | return 0; | 264 | return 0; |
| 266 | } | 265 | } |
| 267 | 266 | ||
| @@ -1317,9 +1316,19 @@ static const struct k_clock clock_tai = { | |||
| 1317 | .timer_arm = common_hrtimer_arm, | 1316 | .timer_arm = common_hrtimer_arm, |
| 1318 | }; | 1317 | }; |
| 1319 | 1318 | ||
| 1320 | static const struct k_clock clock_monotonic_active = { | 1319 | static const struct k_clock clock_boottime = { |
| 1321 | .clock_getres = posix_get_hrtimer_res, | 1320 | .clock_getres = posix_get_hrtimer_res, |
| 1322 | .clock_get = posix_get_monotonic_active, | 1321 | .clock_get = posix_get_boottime, |
| 1322 | .nsleep = common_nsleep, | ||
| 1323 | .timer_create = common_timer_create, | ||
| 1324 | .timer_set = common_timer_set, | ||
| 1325 | .timer_get = common_timer_get, | ||
| 1326 | .timer_del = common_timer_del, | ||
| 1327 | .timer_rearm = common_hrtimer_rearm, | ||
| 1328 | .timer_forward = common_hrtimer_forward, | ||
| 1329 | .timer_remaining = common_hrtimer_remaining, | ||
| 1330 | .timer_try_to_cancel = common_hrtimer_try_to_cancel, | ||
| 1331 | .timer_arm = common_hrtimer_arm, | ||
| 1323 | }; | 1332 | }; |
| 1324 | 1333 | ||
| 1325 | static const struct k_clock * const posix_clocks[] = { | 1334 | static const struct k_clock * const posix_clocks[] = { |
| @@ -1330,11 +1339,10 @@ static const struct k_clock * const posix_clocks[] = { | |||
| 1330 | [CLOCK_MONOTONIC_RAW] = &clock_monotonic_raw, | 1339 | [CLOCK_MONOTONIC_RAW] = &clock_monotonic_raw, |
| 1331 | [CLOCK_REALTIME_COARSE] = &clock_realtime_coarse, | 1340 | [CLOCK_REALTIME_COARSE] = &clock_realtime_coarse, |
| 1332 | [CLOCK_MONOTONIC_COARSE] = &clock_monotonic_coarse, | 1341 | [CLOCK_MONOTONIC_COARSE] = &clock_monotonic_coarse, |
| 1333 | [CLOCK_BOOTTIME] = &clock_monotonic, | 1342 | [CLOCK_BOOTTIME] = &clock_boottime, |
| 1334 | [CLOCK_REALTIME_ALARM] = &alarm_clock, | 1343 | [CLOCK_REALTIME_ALARM] = &alarm_clock, |
| 1335 | [CLOCK_BOOTTIME_ALARM] = &alarm_clock, | 1344 | [CLOCK_BOOTTIME_ALARM] = &alarm_clock, |
| 1336 | [CLOCK_TAI] = &clock_tai, | 1345 | [CLOCK_TAI] = &clock_tai, |
| 1337 | [CLOCK_MONOTONIC_ACTIVE] = &clock_monotonic_active, | ||
| 1338 | }; | 1346 | }; |
| 1339 | 1347 | ||
| 1340 | static const struct k_clock *clockid_to_kclock(const clockid_t id) | 1348 | static const struct k_clock *clockid_to_kclock(const clockid_t id) |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 099572ca4a8f..49edc1c4f3e6 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
| @@ -419,19 +419,6 @@ void tick_suspend_local(void) | |||
| 419 | clockevents_shutdown(td->evtdev); | 419 | clockevents_shutdown(td->evtdev); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | static void tick_forward_next_period(void) | ||
| 423 | { | ||
| 424 | ktime_t delta, now = ktime_get(); | ||
| 425 | u64 n; | ||
| 426 | |||
| 427 | delta = ktime_sub(now, tick_next_period); | ||
| 428 | n = ktime_divns(delta, tick_period); | ||
| 429 | tick_next_period += n * tick_period; | ||
| 430 | if (tick_next_period < now) | ||
| 431 | tick_next_period += tick_period; | ||
| 432 | tick_sched_forward_next_period(); | ||
| 433 | } | ||
| 434 | |||
| 435 | /** | 422 | /** |
| 436 | * tick_resume_local - Resume the local tick device | 423 | * tick_resume_local - Resume the local tick device |
| 437 | * | 424 | * |
| @@ -444,8 +431,6 @@ void tick_resume_local(void) | |||
| 444 | struct tick_device *td = this_cpu_ptr(&tick_cpu_device); | 431 | struct tick_device *td = this_cpu_ptr(&tick_cpu_device); |
| 445 | bool broadcast = tick_resume_check_broadcast(); | 432 | bool broadcast = tick_resume_check_broadcast(); |
| 446 | 433 | ||
| 447 | tick_forward_next_period(); | ||
| 448 | |||
| 449 | clockevents_tick_resume(td->evtdev); | 434 | clockevents_tick_resume(td->evtdev); |
| 450 | if (!broadcast) { | 435 | if (!broadcast) { |
| 451 | if (td->mode == TICKDEV_MODE_PERIODIC) | 436 | if (td->mode == TICKDEV_MODE_PERIODIC) |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 21efab7485ca..e277284c2831 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
| @@ -141,12 +141,6 @@ static inline void tick_check_oneshot_broadcast_this_cpu(void) { } | |||
| 141 | static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_possible(); } | 141 | static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_possible(); } |
| 142 | #endif /* !(BROADCAST && ONESHOT) */ | 142 | #endif /* !(BROADCAST && ONESHOT) */ |
| 143 | 143 | ||
| 144 | #if defined(CONFIG_NO_HZ_COMMON) || defined(CONFIG_HIGH_RES_TIMERS) | ||
| 145 | extern void tick_sched_forward_next_period(void); | ||
| 146 | #else | ||
| 147 | static inline void tick_sched_forward_next_period(void) { } | ||
| 148 | #endif | ||
| 149 | |||
| 150 | /* NO_HZ_FULL internal */ | 144 | /* NO_HZ_FULL internal */ |
| 151 | #ifdef CONFIG_NO_HZ_FULL | 145 | #ifdef CONFIG_NO_HZ_FULL |
| 152 | extern void tick_nohz_init(void); | 146 | extern void tick_nohz_init(void); |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 646645e981f9..da9455a6b42b 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
| @@ -52,15 +52,6 @@ struct tick_sched *tick_get_tick_sched(int cpu) | |||
| 52 | static ktime_t last_jiffies_update; | 52 | static ktime_t last_jiffies_update; |
| 53 | 53 | ||
| 54 | /* | 54 | /* |
| 55 | * Called after resume. Make sure that jiffies are not fast forwarded due to | ||
| 56 | * clock monotonic being forwarded by the suspended time. | ||
| 57 | */ | ||
| 58 | void tick_sched_forward_next_period(void) | ||
| 59 | { | ||
| 60 | last_jiffies_update = tick_next_period; | ||
| 61 | } | ||
| 62 | |||
| 63 | /* | ||
| 64 | * Must be called with interrupts disabled ! | 55 | * Must be called with interrupts disabled ! |
| 65 | */ | 56 | */ |
| 66 | static void tick_do_update_jiffies64(ktime_t now) | 57 | static void tick_do_update_jiffies64(ktime_t now) |
| @@ -804,12 +795,12 @@ static void tick_nohz_stop_tick(struct tick_sched *ts, int cpu) | |||
| 804 | return; | 795 | return; |
| 805 | } | 796 | } |
| 806 | 797 | ||
| 807 | hrtimer_set_expires(&ts->sched_timer, tick); | 798 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { |
| 808 | 799 | hrtimer_start(&ts->sched_timer, tick, HRTIMER_MODE_ABS_PINNED); | |
| 809 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) | 800 | } else { |
| 810 | hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED); | 801 | hrtimer_set_expires(&ts->sched_timer, tick); |
| 811 | else | ||
| 812 | tick_program_event(tick, 1); | 802 | tick_program_event(tick, 1); |
| 803 | } | ||
| 813 | } | 804 | } |
| 814 | 805 | ||
| 815 | static void tick_nohz_retain_tick(struct tick_sched *ts) | 806 | static void tick_nohz_retain_tick(struct tick_sched *ts) |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index dcf7f20fcd12..49cbceef5deb 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -138,12 +138,7 @@ static void tk_set_wall_to_mono(struct timekeeper *tk, struct timespec64 wtm) | |||
| 138 | 138 | ||
| 139 | static inline void tk_update_sleep_time(struct timekeeper *tk, ktime_t delta) | 139 | static inline void tk_update_sleep_time(struct timekeeper *tk, ktime_t delta) |
| 140 | { | 140 | { |
| 141 | /* Update both bases so mono and raw stay coupled. */ | 141 | tk->offs_boot = ktime_add(tk->offs_boot, delta); |
| 142 | tk->tkr_mono.base += delta; | ||
| 143 | tk->tkr_raw.base += delta; | ||
| 144 | |||
| 145 | /* Accumulate time spent in suspend */ | ||
| 146 | tk->time_suspended += delta; | ||
| 147 | } | 142 | } |
| 148 | 143 | ||
| 149 | /* | 144 | /* |
| @@ -473,6 +468,36 @@ u64 ktime_get_raw_fast_ns(void) | |||
| 473 | } | 468 | } |
| 474 | EXPORT_SYMBOL_GPL(ktime_get_raw_fast_ns); | 469 | EXPORT_SYMBOL_GPL(ktime_get_raw_fast_ns); |
| 475 | 470 | ||
| 471 | /** | ||
| 472 | * ktime_get_boot_fast_ns - NMI safe and fast access to boot clock. | ||
| 473 | * | ||
| 474 | * To keep it NMI safe since we're accessing from tracing, we're not using a | ||
| 475 | * separate timekeeper with updates to monotonic clock and boot offset | ||
| 476 | * protected with seqlocks. This has the following minor side effects: | ||
| 477 | * | ||
| 478 | * (1) Its possible that a timestamp be taken after the boot offset is updated | ||
| 479 | * but before the timekeeper is updated. If this happens, the new boot offset | ||
| 480 | * is added to the old timekeeping making the clock appear to update slightly | ||
| 481 | * earlier: | ||
| 482 | * CPU 0 CPU 1 | ||
| 483 | * timekeeping_inject_sleeptime64() | ||
| 484 | * __timekeeping_inject_sleeptime(tk, delta); | ||
| 485 | * timestamp(); | ||
| 486 | * timekeeping_update(tk, TK_CLEAR_NTP...); | ||
| 487 | * | ||
| 488 | * (2) On 32-bit systems, the 64-bit boot offset (tk->offs_boot) may be | ||
| 489 | * partially updated. Since the tk->offs_boot update is a rare event, this | ||
| 490 | * should be a rare occurrence which postprocessing should be able to handle. | ||
| 491 | */ | ||
| 492 | u64 notrace ktime_get_boot_fast_ns(void) | ||
| 493 | { | ||
| 494 | struct timekeeper *tk = &tk_core.timekeeper; | ||
| 495 | |||
| 496 | return (ktime_get_mono_fast_ns() + ktime_to_ns(tk->offs_boot)); | ||
| 497 | } | ||
| 498 | EXPORT_SYMBOL_GPL(ktime_get_boot_fast_ns); | ||
| 499 | |||
| 500 | |||
| 476 | /* | 501 | /* |
| 477 | * See comment for __ktime_get_fast_ns() vs. timestamp ordering | 502 | * See comment for __ktime_get_fast_ns() vs. timestamp ordering |
| 478 | */ | 503 | */ |
| @@ -764,6 +789,7 @@ EXPORT_SYMBOL_GPL(ktime_get_resolution_ns); | |||
| 764 | 789 | ||
| 765 | static ktime_t *offsets[TK_OFFS_MAX] = { | 790 | static ktime_t *offsets[TK_OFFS_MAX] = { |
| 766 | [TK_OFFS_REAL] = &tk_core.timekeeper.offs_real, | 791 | [TK_OFFS_REAL] = &tk_core.timekeeper.offs_real, |
| 792 | [TK_OFFS_BOOT] = &tk_core.timekeeper.offs_boot, | ||
| 767 | [TK_OFFS_TAI] = &tk_core.timekeeper.offs_tai, | 793 | [TK_OFFS_TAI] = &tk_core.timekeeper.offs_tai, |
| 768 | }; | 794 | }; |
| 769 | 795 | ||
| @@ -861,39 +887,6 @@ void ktime_get_ts64(struct timespec64 *ts) | |||
| 861 | EXPORT_SYMBOL_GPL(ktime_get_ts64); | 887 | EXPORT_SYMBOL_GPL(ktime_get_ts64); |
| 862 | 888 | ||
| 863 | /** | 889 | /** |
| 864 | * ktime_get_active_ts64 - Get the active non-suspended monotonic clock | ||
| 865 | * @ts: pointer to timespec variable | ||
| 866 | * | ||
| 867 | * The function calculates the monotonic clock from the realtime clock and | ||
| 868 | * the wall_to_monotonic offset, subtracts the accumulated suspend time and | ||
| 869 | * stores the result in normalized timespec64 format in the variable | ||
| 870 | * pointed to by @ts. | ||
| 871 | */ | ||
| 872 | void ktime_get_active_ts64(struct timespec64 *ts) | ||
| 873 | { | ||
| 874 | struct timekeeper *tk = &tk_core.timekeeper; | ||
| 875 | struct timespec64 tomono, tsusp; | ||
| 876 | u64 nsec, nssusp; | ||
| 877 | unsigned int seq; | ||
| 878 | |||
| 879 | WARN_ON(timekeeping_suspended); | ||
| 880 | |||
| 881 | do { | ||
| 882 | seq = read_seqcount_begin(&tk_core.seq); | ||
| 883 | ts->tv_sec = tk->xtime_sec; | ||
| 884 | nsec = timekeeping_get_ns(&tk->tkr_mono); | ||
| 885 | tomono = tk->wall_to_monotonic; | ||
| 886 | nssusp = tk->time_suspended; | ||
| 887 | } while (read_seqcount_retry(&tk_core.seq, seq)); | ||
| 888 | |||
| 889 | ts->tv_sec += tomono.tv_sec; | ||
| 890 | ts->tv_nsec = 0; | ||
| 891 | timespec64_add_ns(ts, nsec + tomono.tv_nsec); | ||
| 892 | tsusp = ns_to_timespec64(nssusp); | ||
| 893 | *ts = timespec64_sub(*ts, tsusp); | ||
| 894 | } | ||
| 895 | |||
| 896 | /** | ||
| 897 | * ktime_get_seconds - Get the seconds portion of CLOCK_MONOTONIC | 890 | * ktime_get_seconds - Get the seconds portion of CLOCK_MONOTONIC |
| 898 | * | 891 | * |
| 899 | * Returns the seconds portion of CLOCK_MONOTONIC with a single non | 892 | * Returns the seconds portion of CLOCK_MONOTONIC with a single non |
| @@ -1593,6 +1586,7 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk, | |||
| 1593 | return; | 1586 | return; |
| 1594 | } | 1587 | } |
| 1595 | tk_xtime_add(tk, delta); | 1588 | tk_xtime_add(tk, delta); |
| 1589 | tk_set_wall_to_mono(tk, timespec64_sub(tk->wall_to_monotonic, *delta)); | ||
| 1596 | tk_update_sleep_time(tk, timespec64_to_ktime(*delta)); | 1590 | tk_update_sleep_time(tk, timespec64_to_ktime(*delta)); |
| 1597 | tk_debug_account_sleep_time(delta); | 1591 | tk_debug_account_sleep_time(delta); |
| 1598 | } | 1592 | } |
| @@ -2125,7 +2119,7 @@ out: | |||
| 2125 | void getboottime64(struct timespec64 *ts) | 2119 | void getboottime64(struct timespec64 *ts) |
| 2126 | { | 2120 | { |
| 2127 | struct timekeeper *tk = &tk_core.timekeeper; | 2121 | struct timekeeper *tk = &tk_core.timekeeper; |
| 2128 | ktime_t t = ktime_sub(tk->offs_real, tk->time_suspended); | 2122 | ktime_t t = ktime_sub(tk->offs_real, tk->offs_boot); |
| 2129 | 2123 | ||
| 2130 | *ts = ktime_to_timespec64(t); | 2124 | *ts = ktime_to_timespec64(t); |
| 2131 | } | 2125 | } |
| @@ -2188,6 +2182,7 @@ void do_timer(unsigned long ticks) | |||
| 2188 | * ktime_get_update_offsets_now - hrtimer helper | 2182 | * ktime_get_update_offsets_now - hrtimer helper |
| 2189 | * @cwsseq: pointer to check and store the clock was set sequence number | 2183 | * @cwsseq: pointer to check and store the clock was set sequence number |
| 2190 | * @offs_real: pointer to storage for monotonic -> realtime offset | 2184 | * @offs_real: pointer to storage for monotonic -> realtime offset |
| 2185 | * @offs_boot: pointer to storage for monotonic -> boottime offset | ||
| 2191 | * @offs_tai: pointer to storage for monotonic -> clock tai offset | 2186 | * @offs_tai: pointer to storage for monotonic -> clock tai offset |
| 2192 | * | 2187 | * |
| 2193 | * Returns current monotonic time and updates the offsets if the | 2188 | * Returns current monotonic time and updates the offsets if the |
| @@ -2197,7 +2192,7 @@ void do_timer(unsigned long ticks) | |||
| 2197 | * Called from hrtimer_interrupt() or retrigger_next_event() | 2192 | * Called from hrtimer_interrupt() or retrigger_next_event() |
| 2198 | */ | 2193 | */ |
| 2199 | ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real, | 2194 | ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real, |
| 2200 | ktime_t *offs_tai) | 2195 | ktime_t *offs_boot, ktime_t *offs_tai) |
| 2201 | { | 2196 | { |
| 2202 | struct timekeeper *tk = &tk_core.timekeeper; | 2197 | struct timekeeper *tk = &tk_core.timekeeper; |
| 2203 | unsigned int seq; | 2198 | unsigned int seq; |
| @@ -2214,6 +2209,7 @@ ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real, | |||
| 2214 | if (*cwsseq != tk->clock_was_set_seq) { | 2209 | if (*cwsseq != tk->clock_was_set_seq) { |
| 2215 | *cwsseq = tk->clock_was_set_seq; | 2210 | *cwsseq = tk->clock_was_set_seq; |
| 2216 | *offs_real = tk->offs_real; | 2211 | *offs_real = tk->offs_real; |
| 2212 | *offs_boot = tk->offs_boot; | ||
| 2217 | *offs_tai = tk->offs_tai; | 2213 | *offs_tai = tk->offs_tai; |
| 2218 | } | 2214 | } |
| 2219 | 2215 | ||
diff --git a/kernel/time/timekeeping.h b/kernel/time/timekeeping.h index 79b67f5e0343..7a9b4eb7a1d5 100644 --- a/kernel/time/timekeeping.h +++ b/kernel/time/timekeeping.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | */ | 6 | */ |
| 7 | extern ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, | 7 | extern ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, |
| 8 | ktime_t *offs_real, | 8 | ktime_t *offs_real, |
| 9 | ktime_t *offs_boot, | ||
| 9 | ktime_t *offs_tai); | 10 | ktime_t *offs_tai); |
| 10 | 11 | ||
| 11 | extern int timekeeping_valid_for_hres(void); | 12 | extern int timekeeping_valid_for_hres(void); |
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index d88e96d4e12c..56ba0f2a01db 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c | |||
| @@ -977,6 +977,7 @@ int perf_event_query_prog_array(struct perf_event *event, void __user *info) | |||
| 977 | { | 977 | { |
| 978 | struct perf_event_query_bpf __user *uquery = info; | 978 | struct perf_event_query_bpf __user *uquery = info; |
| 979 | struct perf_event_query_bpf query = {}; | 979 | struct perf_event_query_bpf query = {}; |
| 980 | u32 *ids, prog_cnt, ids_len; | ||
| 980 | int ret; | 981 | int ret; |
| 981 | 982 | ||
| 982 | if (!capable(CAP_SYS_ADMIN)) | 983 | if (!capable(CAP_SYS_ADMIN)) |
| @@ -985,16 +986,32 @@ int perf_event_query_prog_array(struct perf_event *event, void __user *info) | |||
| 985 | return -EINVAL; | 986 | return -EINVAL; |
| 986 | if (copy_from_user(&query, uquery, sizeof(query))) | 987 | if (copy_from_user(&query, uquery, sizeof(query))) |
| 987 | return -EFAULT; | 988 | return -EFAULT; |
| 988 | if (query.ids_len > BPF_TRACE_MAX_PROGS) | 989 | |
| 990 | ids_len = query.ids_len; | ||
| 991 | if (ids_len > BPF_TRACE_MAX_PROGS) | ||
| 989 | return -E2BIG; | 992 | return -E2BIG; |
| 993 | ids = kcalloc(ids_len, sizeof(u32), GFP_USER | __GFP_NOWARN); | ||
| 994 | if (!ids) | ||
| 995 | return -ENOMEM; | ||
| 996 | /* | ||
| 997 | * The above kcalloc returns ZERO_SIZE_PTR when ids_len = 0, which | ||
| 998 | * is required when user only wants to check for uquery->prog_cnt. | ||
| 999 | * There is no need to check for it since the case is handled | ||
| 1000 | * gracefully in bpf_prog_array_copy_info. | ||
| 1001 | */ | ||
| 990 | 1002 | ||
| 991 | mutex_lock(&bpf_event_mutex); | 1003 | mutex_lock(&bpf_event_mutex); |
| 992 | ret = bpf_prog_array_copy_info(event->tp_event->prog_array, | 1004 | ret = bpf_prog_array_copy_info(event->tp_event->prog_array, |
| 993 | uquery->ids, | 1005 | ids, |
| 994 | query.ids_len, | 1006 | ids_len, |
| 995 | &uquery->prog_cnt); | 1007 | &prog_cnt); |
| 996 | mutex_unlock(&bpf_event_mutex); | 1008 | mutex_unlock(&bpf_event_mutex); |
| 997 | 1009 | ||
| 1010 | if (copy_to_user(&uquery->prog_cnt, &prog_cnt, sizeof(prog_cnt)) || | ||
| 1011 | copy_to_user(uquery->ids, ids, ids_len * sizeof(u32))) | ||
| 1012 | ret = -EFAULT; | ||
| 1013 | |||
| 1014 | kfree(ids); | ||
| 998 | return ret; | 1015 | return ret; |
| 999 | } | 1016 | } |
| 1000 | 1017 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index dfbcf9ee1447..414d7210b2ec 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -1165,7 +1165,7 @@ static struct { | |||
| 1165 | { trace_clock, "perf", 1 }, | 1165 | { trace_clock, "perf", 1 }, |
| 1166 | { ktime_get_mono_fast_ns, "mono", 1 }, | 1166 | { ktime_get_mono_fast_ns, "mono", 1 }, |
| 1167 | { ktime_get_raw_fast_ns, "mono_raw", 1 }, | 1167 | { ktime_get_raw_fast_ns, "mono_raw", 1 }, |
| 1168 | { ktime_get_mono_fast_ns, "boot", 1 }, | 1168 | { ktime_get_boot_fast_ns, "boot", 1 }, |
| 1169 | ARCH_TRACE_CLOCKS | 1169 | ARCH_TRACE_CLOCKS |
| 1170 | }; | 1170 | }; |
| 1171 | 1171 | ||
diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h index e954ae3d82c0..e3a658bac10f 100644 --- a/kernel/trace/trace_entries.h +++ b/kernel/trace/trace_entries.h | |||
| @@ -356,7 +356,7 @@ FTRACE_ENTRY(hwlat, hwlat_entry, | |||
| 356 | __field( unsigned int, seqnum ) | 356 | __field( unsigned int, seqnum ) |
| 357 | ), | 357 | ), |
| 358 | 358 | ||
| 359 | F_printk("cnt:%u\tts:%010llu.%010lu\tinner:%llu\touter:%llunmi-ts:%llu\tnmi-count:%u\n", | 359 | F_printk("cnt:%u\tts:%010llu.%010lu\tinner:%llu\touter:%llu\tnmi-ts:%llu\tnmi-count:%u\n", |
| 360 | __entry->seqnum, | 360 | __entry->seqnum, |
| 361 | __entry->tv_sec, | 361 | __entry->tv_sec, |
| 362 | __entry->tv_nsec, | 362 | __entry->tv_nsec, |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 9b4716bb8bb0..1f951b3df60c 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
| @@ -1499,14 +1499,14 @@ static int process_preds(struct trace_event_call *call, | |||
| 1499 | return ret; | 1499 | return ret; |
| 1500 | } | 1500 | } |
| 1501 | 1501 | ||
| 1502 | if (!nr_preds) { | 1502 | if (!nr_preds) |
| 1503 | prog = NULL; | 1503 | return -EINVAL; |
| 1504 | } else { | 1504 | |
| 1505 | prog = predicate_parse(filter_string, nr_parens, nr_preds, | 1505 | prog = predicate_parse(filter_string, nr_parens, nr_preds, |
| 1506 | parse_pred, call, pe); | 1506 | parse_pred, call, pe); |
| 1507 | if (IS_ERR(prog)) | 1507 | if (IS_ERR(prog)) |
| 1508 | return PTR_ERR(prog); | 1508 | return PTR_ERR(prog); |
| 1509 | } | 1509 | |
| 1510 | rcu_assign_pointer(filter->prog, prog); | 1510 | rcu_assign_pointer(filter->prog, prog); |
| 1511 | return 0; | 1511 | return 0; |
| 1512 | } | 1512 | } |
diff --git a/lib/dma-direct.c b/lib/dma-direct.c index c0bba30fef0a..bbfb229aa067 100644 --- a/lib/dma-direct.c +++ b/lib/dma-direct.c | |||
| @@ -84,7 +84,8 @@ again: | |||
| 84 | __free_pages(page, page_order); | 84 | __free_pages(page, page_order); |
| 85 | page = NULL; | 85 | page = NULL; |
| 86 | 86 | ||
| 87 | if (dev->coherent_dma_mask < DMA_BIT_MASK(32) && | 87 | if (IS_ENABLED(CONFIG_ZONE_DMA) && |
| 88 | dev->coherent_dma_mask < DMA_BIT_MASK(32) && | ||
| 88 | !(gfp & GFP_DMA)) { | 89 | !(gfp & GFP_DMA)) { |
| 89 | gfp = (gfp & ~GFP_DMA32) | GFP_DMA; | 90 | gfp = (gfp & ~GFP_DMA32) | GFP_DMA; |
| 90 | goto again; | 91 | goto again; |
diff --git a/lib/kobject.c b/lib/kobject.c index e1d1f290bf35..18989b5b3b56 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -233,13 +233,12 @@ static int kobject_add_internal(struct kobject *kobj) | |||
| 233 | 233 | ||
| 234 | /* be noisy on error issues */ | 234 | /* be noisy on error issues */ |
| 235 | if (error == -EEXIST) | 235 | if (error == -EEXIST) |
| 236 | WARN(1, | 236 | pr_err("%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n", |
| 237 | "%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n", | 237 | __func__, kobject_name(kobj)); |
| 238 | __func__, kobject_name(kobj)); | ||
| 239 | else | 238 | else |
| 240 | WARN(1, "%s failed for %s (error: %d parent: %s)\n", | 239 | pr_err("%s failed for %s (error: %d parent: %s)\n", |
| 241 | __func__, kobject_name(kobj), error, | 240 | __func__, kobject_name(kobj), error, |
| 242 | parent ? kobject_name(parent) : "'none'"); | 241 | parent ? kobject_name(parent) : "'none'"); |
| 243 | } else | 242 | } else |
| 244 | kobj->state_in_sysfs = 1; | 243 | kobj->state_in_sysfs = 1; |
| 245 | 244 | ||
| @@ -100,11 +100,20 @@ pgprot_t protection_map[16] __ro_after_init = { | |||
| 100 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 | 100 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| 103 | #ifndef CONFIG_ARCH_HAS_FILTER_PGPROT | ||
| 104 | static inline pgprot_t arch_filter_pgprot(pgprot_t prot) | ||
| 105 | { | ||
| 106 | return prot; | ||
| 107 | } | ||
| 108 | #endif | ||
| 109 | |||
| 103 | pgprot_t vm_get_page_prot(unsigned long vm_flags) | 110 | pgprot_t vm_get_page_prot(unsigned long vm_flags) |
| 104 | { | 111 | { |
| 105 | return __pgprot(pgprot_val(protection_map[vm_flags & | 112 | pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags & |
| 106 | (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) | | 113 | (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) | |
| 107 | pgprot_val(arch_vm_get_page_prot(vm_flags))); | 114 | pgprot_val(arch_vm_get_page_prot(vm_flags))); |
| 115 | |||
| 116 | return arch_filter_pgprot(ret); | ||
| 108 | } | 117 | } |
| 109 | EXPORT_SYMBOL(vm_get_page_prot); | 118 | EXPORT_SYMBOL(vm_get_page_prot); |
| 110 | 119 | ||
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 032e0fe45940..28a4c3490359 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
| @@ -1825,13 +1825,14 @@ static int compat_table_info(const struct ebt_table_info *info, | |||
| 1825 | { | 1825 | { |
| 1826 | unsigned int size = info->entries_size; | 1826 | unsigned int size = info->entries_size; |
| 1827 | const void *entries = info->entries; | 1827 | const void *entries = info->entries; |
| 1828 | int ret; | ||
| 1829 | 1828 | ||
| 1830 | newinfo->entries_size = size; | 1829 | newinfo->entries_size = size; |
| 1831 | 1830 | if (info->nentries) { | |
| 1832 | ret = xt_compat_init_offsets(NFPROTO_BRIDGE, info->nentries); | 1831 | int ret = xt_compat_init_offsets(NFPROTO_BRIDGE, |
| 1833 | if (ret) | 1832 | info->nentries); |
| 1834 | return ret; | 1833 | if (ret) |
| 1834 | return ret; | ||
| 1835 | } | ||
| 1835 | 1836 | ||
| 1836 | return EBT_ENTRY_ITERATE(entries, size, compat_calc_entry, info, | 1837 | return EBT_ENTRY_ITERATE(entries, size, compat_calc_entry, info, |
| 1837 | entries, newinfo); | 1838 | entries, newinfo); |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index fcb40c12b1f8..3b3d33ea9ed8 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
| @@ -2569,6 +2569,11 @@ static int try_write(struct ceph_connection *con) | |||
| 2569 | int ret = 1; | 2569 | int ret = 1; |
| 2570 | 2570 | ||
| 2571 | dout("try_write start %p state %lu\n", con, con->state); | 2571 | dout("try_write start %p state %lu\n", con, con->state); |
| 2572 | if (con->state != CON_STATE_PREOPEN && | ||
| 2573 | con->state != CON_STATE_CONNECTING && | ||
| 2574 | con->state != CON_STATE_NEGOTIATING && | ||
| 2575 | con->state != CON_STATE_OPEN) | ||
| 2576 | return 0; | ||
| 2572 | 2577 | ||
| 2573 | more: | 2578 | more: |
| 2574 | dout("try_write out_kvec_bytes %d\n", con->out_kvec_bytes); | 2579 | dout("try_write out_kvec_bytes %d\n", con->out_kvec_bytes); |
| @@ -2594,6 +2599,8 @@ more: | |||
| 2594 | } | 2599 | } |
| 2595 | 2600 | ||
| 2596 | more_kvec: | 2601 | more_kvec: |
| 2602 | BUG_ON(!con->sock); | ||
| 2603 | |||
| 2597 | /* kvec data queued? */ | 2604 | /* kvec data queued? */ |
| 2598 | if (con->out_kvec_left) { | 2605 | if (con->out_kvec_left) { |
| 2599 | ret = write_partial_kvec(con); | 2606 | ret = write_partial_kvec(con); |
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index b3dac24412d3..21ac6e3b96bb 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
| @@ -209,6 +209,14 @@ static void reopen_session(struct ceph_mon_client *monc) | |||
| 209 | __open_session(monc); | 209 | __open_session(monc); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | static void un_backoff(struct ceph_mon_client *monc) | ||
| 213 | { | ||
| 214 | monc->hunt_mult /= 2; /* reduce by 50% */ | ||
| 215 | if (monc->hunt_mult < 1) | ||
| 216 | monc->hunt_mult = 1; | ||
| 217 | dout("%s hunt_mult now %d\n", __func__, monc->hunt_mult); | ||
| 218 | } | ||
| 219 | |||
| 212 | /* | 220 | /* |
| 213 | * Reschedule delayed work timer. | 221 | * Reschedule delayed work timer. |
| 214 | */ | 222 | */ |
| @@ -963,6 +971,7 @@ static void delayed_work(struct work_struct *work) | |||
| 963 | if (!monc->hunting) { | 971 | if (!monc->hunting) { |
| 964 | ceph_con_keepalive(&monc->con); | 972 | ceph_con_keepalive(&monc->con); |
| 965 | __validate_auth(monc); | 973 | __validate_auth(monc); |
| 974 | un_backoff(monc); | ||
| 966 | } | 975 | } |
| 967 | 976 | ||
| 968 | if (is_auth && | 977 | if (is_auth && |
| @@ -1123,9 +1132,8 @@ static void finish_hunting(struct ceph_mon_client *monc) | |||
| 1123 | dout("%s found mon%d\n", __func__, monc->cur_mon); | 1132 | dout("%s found mon%d\n", __func__, monc->cur_mon); |
| 1124 | monc->hunting = false; | 1133 | monc->hunting = false; |
| 1125 | monc->had_a_connection = true; | 1134 | monc->had_a_connection = true; |
| 1126 | monc->hunt_mult /= 2; /* reduce by 50% */ | 1135 | un_backoff(monc); |
| 1127 | if (monc->hunt_mult < 1) | 1136 | __schedule_delayed(monc); |
| 1128 | monc->hunt_mult = 1; | ||
| 1129 | } | 1137 | } |
| 1130 | } | 1138 | } |
| 1131 | 1139 | ||
diff --git a/net/ife/ife.c b/net/ife/ife.c index 7d1ec76e7f43..13bbf8cb6a39 100644 --- a/net/ife/ife.c +++ b/net/ife/ife.c | |||
| @@ -69,6 +69,9 @@ void *ife_decode(struct sk_buff *skb, u16 *metalen) | |||
| 69 | int total_pull; | 69 | int total_pull; |
| 70 | u16 ifehdrln; | 70 | u16 ifehdrln; |
| 71 | 71 | ||
| 72 | if (!pskb_may_pull(skb, skb->dev->hard_header_len + IFE_METAHDRLEN)) | ||
| 73 | return NULL; | ||
| 74 | |||
| 72 | ifehdr = (struct ifeheadr *) (skb->data + skb->dev->hard_header_len); | 75 | ifehdr = (struct ifeheadr *) (skb->data + skb->dev->hard_header_len); |
| 73 | ifehdrln = ntohs(ifehdr->metalen); | 76 | ifehdrln = ntohs(ifehdr->metalen); |
| 74 | total_pull = skb->dev->hard_header_len + ifehdrln; | 77 | total_pull = skb->dev->hard_header_len + ifehdrln; |
| @@ -92,12 +95,43 @@ struct meta_tlvhdr { | |||
| 92 | __be16 len; | 95 | __be16 len; |
| 93 | }; | 96 | }; |
| 94 | 97 | ||
| 98 | static bool __ife_tlv_meta_valid(const unsigned char *skbdata, | ||
| 99 | const unsigned char *ifehdr_end) | ||
| 100 | { | ||
| 101 | const struct meta_tlvhdr *tlv; | ||
| 102 | u16 tlvlen; | ||
| 103 | |||
| 104 | if (unlikely(skbdata + sizeof(*tlv) > ifehdr_end)) | ||
| 105 | return false; | ||
| 106 | |||
| 107 | tlv = (const struct meta_tlvhdr *)skbdata; | ||
| 108 | tlvlen = ntohs(tlv->len); | ||
| 109 | |||
| 110 | /* tlv length field is inc header, check on minimum */ | ||
| 111 | if (tlvlen < NLA_HDRLEN) | ||
| 112 | return false; | ||
| 113 | |||
| 114 | /* overflow by NLA_ALIGN check */ | ||
| 115 | if (NLA_ALIGN(tlvlen) < tlvlen) | ||
| 116 | return false; | ||
| 117 | |||
| 118 | if (unlikely(skbdata + NLA_ALIGN(tlvlen) > ifehdr_end)) | ||
| 119 | return false; | ||
| 120 | |||
| 121 | return true; | ||
| 122 | } | ||
| 123 | |||
| 95 | /* Caller takes care of presenting data in network order | 124 | /* Caller takes care of presenting data in network order |
| 96 | */ | 125 | */ |
| 97 | void *ife_tlv_meta_decode(void *skbdata, u16 *attrtype, u16 *dlen, u16 *totlen) | 126 | void *ife_tlv_meta_decode(void *skbdata, const void *ifehdr_end, u16 *attrtype, |
| 127 | u16 *dlen, u16 *totlen) | ||
| 98 | { | 128 | { |
| 99 | struct meta_tlvhdr *tlv = (struct meta_tlvhdr *) skbdata; | 129 | struct meta_tlvhdr *tlv; |
| 130 | |||
| 131 | if (!__ife_tlv_meta_valid(skbdata, ifehdr_end)) | ||
| 132 | return NULL; | ||
| 100 | 133 | ||
| 134 | tlv = (struct meta_tlvhdr *)skbdata; | ||
| 101 | *dlen = ntohs(tlv->len) - NLA_HDRLEN; | 135 | *dlen = ntohs(tlv->len) - NLA_HDRLEN; |
| 102 | *attrtype = ntohs(tlv->type); | 136 | *attrtype = ntohs(tlv->type); |
| 103 | 137 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 367def6ddeda..e51c644484dc 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -3868,11 +3868,8 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th) | |||
| 3868 | int length = (th->doff << 2) - sizeof(*th); | 3868 | int length = (th->doff << 2) - sizeof(*th); |
| 3869 | const u8 *ptr = (const u8 *)(th + 1); | 3869 | const u8 *ptr = (const u8 *)(th + 1); |
| 3870 | 3870 | ||
| 3871 | /* If the TCP option is too short, we can short cut */ | 3871 | /* If not enough data remaining, we can short cut */ |
| 3872 | if (length < TCPOLEN_MD5SIG) | 3872 | while (length >= TCPOLEN_MD5SIG) { |
| 3873 | return NULL; | ||
| 3874 | |||
| 3875 | while (length > 0) { | ||
| 3876 | int opcode = *ptr++; | 3873 | int opcode = *ptr++; |
| 3877 | int opsize; | 3874 | int opsize; |
| 3878 | 3875 | ||
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index ccbfa83e4bb0..ce77bcc2490c 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig | |||
| @@ -48,6 +48,34 @@ config NFT_CHAIN_ROUTE_IPV6 | |||
| 48 | fields such as the source, destination, flowlabel, hop-limit and | 48 | fields such as the source, destination, flowlabel, hop-limit and |
| 49 | the packet mark. | 49 | the packet mark. |
| 50 | 50 | ||
| 51 | if NF_NAT_IPV6 | ||
| 52 | |||
| 53 | config NFT_CHAIN_NAT_IPV6 | ||
| 54 | tristate "IPv6 nf_tables nat chain support" | ||
| 55 | help | ||
| 56 | This option enables the "nat" chain for IPv6 in nf_tables. This | ||
| 57 | chain type is used to perform Network Address Translation (NAT) | ||
| 58 | packet transformations such as the source, destination address and | ||
| 59 | source and destination ports. | ||
| 60 | |||
| 61 | config NFT_MASQ_IPV6 | ||
| 62 | tristate "IPv6 masquerade support for nf_tables" | ||
| 63 | depends on NFT_MASQ | ||
| 64 | select NF_NAT_MASQUERADE_IPV6 | ||
| 65 | help | ||
| 66 | This is the expression that provides IPv4 masquerading support for | ||
| 67 | nf_tables. | ||
| 68 | |||
| 69 | config NFT_REDIR_IPV6 | ||
| 70 | tristate "IPv6 redirect support for nf_tables" | ||
| 71 | depends on NFT_REDIR | ||
| 72 | select NF_NAT_REDIRECT | ||
| 73 | help | ||
| 74 | This is the expression that provides IPv4 redirect support for | ||
| 75 | nf_tables. | ||
| 76 | |||
| 77 | endif # NF_NAT_IPV6 | ||
| 78 | |||
| 51 | config NFT_REJECT_IPV6 | 79 | config NFT_REJECT_IPV6 |
| 52 | select NF_REJECT_IPV6 | 80 | select NF_REJECT_IPV6 |
| 53 | default NFT_REJECT | 81 | default NFT_REJECT |
| @@ -107,39 +135,12 @@ config NF_NAT_IPV6 | |||
| 107 | 135 | ||
| 108 | if NF_NAT_IPV6 | 136 | if NF_NAT_IPV6 |
| 109 | 137 | ||
| 110 | config NFT_CHAIN_NAT_IPV6 | ||
| 111 | depends on NF_TABLES_IPV6 | ||
| 112 | tristate "IPv6 nf_tables nat chain support" | ||
| 113 | help | ||
| 114 | This option enables the "nat" chain for IPv6 in nf_tables. This | ||
| 115 | chain type is used to perform Network Address Translation (NAT) | ||
| 116 | packet transformations such as the source, destination address and | ||
| 117 | source and destination ports. | ||
| 118 | |||
| 119 | config NF_NAT_MASQUERADE_IPV6 | 138 | config NF_NAT_MASQUERADE_IPV6 |
| 120 | tristate "IPv6 masquerade support" | 139 | tristate "IPv6 masquerade support" |
| 121 | help | 140 | help |
| 122 | This is the kernel functionality to provide NAT in the masquerade | 141 | This is the kernel functionality to provide NAT in the masquerade |
| 123 | flavour (automatic source address selection) for IPv6. | 142 | flavour (automatic source address selection) for IPv6. |
| 124 | 143 | ||
| 125 | config NFT_MASQ_IPV6 | ||
| 126 | tristate "IPv6 masquerade support for nf_tables" | ||
| 127 | depends on NF_TABLES_IPV6 | ||
| 128 | depends on NFT_MASQ | ||
| 129 | select NF_NAT_MASQUERADE_IPV6 | ||
| 130 | help | ||
| 131 | This is the expression that provides IPv4 masquerading support for | ||
| 132 | nf_tables. | ||
| 133 | |||
| 134 | config NFT_REDIR_IPV6 | ||
| 135 | tristate "IPv6 redirect support for nf_tables" | ||
| 136 | depends on NF_TABLES_IPV6 | ||
| 137 | depends on NFT_REDIR | ||
| 138 | select NF_NAT_REDIRECT | ||
| 139 | help | ||
| 140 | This is the expression that provides IPv4 redirect support for | ||
| 141 | nf_tables. | ||
| 142 | |||
| 143 | endif # NF_NAT_IPV6 | 144 | endif # NF_NAT_IPV6 |
| 144 | 145 | ||
| 145 | config IP6_NF_IPTABLES | 146 | config IP6_NF_IPTABLES |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 49b954d6d0fa..cde7d8251377 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -3975,6 +3975,7 @@ void rt6_mtu_change(struct net_device *dev, unsigned int mtu) | |||
| 3975 | 3975 | ||
| 3976 | static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { | 3976 | static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { |
| 3977 | [RTA_GATEWAY] = { .len = sizeof(struct in6_addr) }, | 3977 | [RTA_GATEWAY] = { .len = sizeof(struct in6_addr) }, |
| 3978 | [RTA_PREFSRC] = { .len = sizeof(struct in6_addr) }, | ||
| 3978 | [RTA_OIF] = { .type = NLA_U32 }, | 3979 | [RTA_OIF] = { .type = NLA_U32 }, |
| 3979 | [RTA_IIF] = { .type = NLA_U32 }, | 3980 | [RTA_IIF] = { .type = NLA_U32 }, |
| 3980 | [RTA_PRIORITY] = { .type = NLA_U32 }, | 3981 | [RTA_PRIORITY] = { .type = NLA_U32 }, |
| @@ -3986,6 +3987,7 @@ static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { | |||
| 3986 | [RTA_EXPIRES] = { .type = NLA_U32 }, | 3987 | [RTA_EXPIRES] = { .type = NLA_U32 }, |
| 3987 | [RTA_UID] = { .type = NLA_U32 }, | 3988 | [RTA_UID] = { .type = NLA_U32 }, |
| 3988 | [RTA_MARK] = { .type = NLA_U32 }, | 3989 | [RTA_MARK] = { .type = NLA_U32 }, |
| 3990 | [RTA_TABLE] = { .type = NLA_U32 }, | ||
| 3989 | }; | 3991 | }; |
| 3990 | 3992 | ||
| 3991 | static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, | 3993 | static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, |
diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c index f343e6f0fc95..5fe139484919 100644 --- a/net/ipv6/seg6_iptunnel.c +++ b/net/ipv6/seg6_iptunnel.c | |||
| @@ -136,7 +136,7 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, int proto) | |||
| 136 | isrh->nexthdr = proto; | 136 | isrh->nexthdr = proto; |
| 137 | 137 | ||
| 138 | hdr->daddr = isrh->segments[isrh->first_segment]; | 138 | hdr->daddr = isrh->segments[isrh->first_segment]; |
| 139 | set_tun_src(net, ip6_dst_idev(dst)->dev, &hdr->daddr, &hdr->saddr); | 139 | set_tun_src(net, dst->dev, &hdr->daddr, &hdr->saddr); |
| 140 | 140 | ||
| 141 | #ifdef CONFIG_IPV6_SEG6_HMAC | 141 | #ifdef CONFIG_IPV6_SEG6_HMAC |
| 142 | if (sr_has_hmac(isrh)) { | 142 | if (sr_has_hmac(isrh)) { |
diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c index b8f9d45bfeb1..7f1e842ef05a 100644 --- a/net/l2tp/l2tp_debugfs.c +++ b/net/l2tp/l2tp_debugfs.c | |||
| @@ -106,8 +106,11 @@ static void l2tp_dfs_seq_stop(struct seq_file *p, void *v) | |||
| 106 | return; | 106 | return; |
| 107 | 107 | ||
| 108 | /* Drop reference taken by last invocation of l2tp_dfs_next_tunnel() */ | 108 | /* Drop reference taken by last invocation of l2tp_dfs_next_tunnel() */ |
| 109 | if (pd->tunnel) | 109 | if (pd->tunnel) { |
| 110 | l2tp_tunnel_dec_refcount(pd->tunnel); | 110 | l2tp_tunnel_dec_refcount(pd->tunnel); |
| 111 | pd->tunnel = NULL; | ||
| 112 | pd->session = NULL; | ||
| 113 | } | ||
| 111 | } | 114 | } |
| 112 | 115 | ||
| 113 | static void l2tp_dfs_seq_tunnel_show(struct seq_file *m, void *v) | 116 | static void l2tp_dfs_seq_tunnel_show(struct seq_file *m, void *v) |
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 7d0c963680e6..1fd9e145076a 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
| @@ -619,6 +619,13 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
| 619 | lock_sock(sk); | 619 | lock_sock(sk); |
| 620 | 620 | ||
| 621 | error = -EINVAL; | 621 | error = -EINVAL; |
| 622 | |||
| 623 | if (sockaddr_len != sizeof(struct sockaddr_pppol2tp) && | ||
| 624 | sockaddr_len != sizeof(struct sockaddr_pppol2tpv3) && | ||
| 625 | sockaddr_len != sizeof(struct sockaddr_pppol2tpin6) && | ||
| 626 | sockaddr_len != sizeof(struct sockaddr_pppol2tpv3in6)) | ||
| 627 | goto end; | ||
| 628 | |||
| 622 | if (sp->sa_protocol != PX_PROTO_OL2TP) | 629 | if (sp->sa_protocol != PX_PROTO_OL2TP) |
| 623 | goto end; | 630 | goto end; |
| 624 | 631 | ||
| @@ -1618,8 +1625,11 @@ static void pppol2tp_seq_stop(struct seq_file *p, void *v) | |||
| 1618 | return; | 1625 | return; |
| 1619 | 1626 | ||
| 1620 | /* Drop reference taken by last invocation of pppol2tp_next_tunnel() */ | 1627 | /* Drop reference taken by last invocation of pppol2tp_next_tunnel() */ |
| 1621 | if (pd->tunnel) | 1628 | if (pd->tunnel) { |
| 1622 | l2tp_tunnel_dec_refcount(pd->tunnel); | 1629 | l2tp_tunnel_dec_refcount(pd->tunnel); |
| 1630 | pd->tunnel = NULL; | ||
| 1631 | pd->session = NULL; | ||
| 1632 | } | ||
| 1623 | } | 1633 | } |
| 1624 | 1634 | ||
| 1625 | static void pppol2tp_seq_tunnel_show(struct seq_file *m, void *v) | 1635 | static void pppol2tp_seq_tunnel_show(struct seq_file *m, void *v) |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 6d29b2b94e84..cb80ebb38311 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
| @@ -189,7 +189,6 @@ static int llc_ui_release(struct socket *sock) | |||
| 189 | { | 189 | { |
| 190 | struct sock *sk = sock->sk; | 190 | struct sock *sk = sock->sk; |
| 191 | struct llc_sock *llc; | 191 | struct llc_sock *llc; |
| 192 | struct llc_sap *sap; | ||
| 193 | 192 | ||
| 194 | if (unlikely(sk == NULL)) | 193 | if (unlikely(sk == NULL)) |
| 195 | goto out; | 194 | goto out; |
| @@ -200,15 +199,19 @@ static int llc_ui_release(struct socket *sock) | |||
| 200 | llc->laddr.lsap, llc->daddr.lsap); | 199 | llc->laddr.lsap, llc->daddr.lsap); |
| 201 | if (!llc_send_disc(sk)) | 200 | if (!llc_send_disc(sk)) |
| 202 | llc_ui_wait_for_disc(sk, sk->sk_rcvtimeo); | 201 | llc_ui_wait_for_disc(sk, sk->sk_rcvtimeo); |
| 203 | sap = llc->sap; | 202 | if (!sock_flag(sk, SOCK_ZAPPED)) { |
| 204 | /* Hold this for release_sock(), so that llc_backlog_rcv() could still | 203 | struct llc_sap *sap = llc->sap; |
| 205 | * use it. | 204 | |
| 206 | */ | 205 | /* Hold this for release_sock(), so that llc_backlog_rcv() |
| 207 | llc_sap_hold(sap); | 206 | * could still use it. |
| 208 | if (!sock_flag(sk, SOCK_ZAPPED)) | 207 | */ |
| 208 | llc_sap_hold(sap); | ||
| 209 | llc_sap_remove_socket(llc->sap, sk); | 209 | llc_sap_remove_socket(llc->sap, sk); |
| 210 | release_sock(sk); | 210 | release_sock(sk); |
| 211 | llc_sap_put(sap); | 211 | llc_sap_put(sap); |
| 212 | } else { | ||
| 213 | release_sock(sk); | ||
| 214 | } | ||
| 212 | if (llc->dev) | 215 | if (llc->dev) |
| 213 | dev_put(llc->dev); | 216 | dev_put(llc->dev); |
| 214 | sock_put(sk); | 217 | sock_put(sk); |
diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c index 163121192aca..4d78375f9872 100644 --- a/net/llc/llc_c_ac.c +++ b/net/llc/llc_c_ac.c | |||
| @@ -1099,14 +1099,7 @@ int llc_conn_ac_inc_tx_win_size(struct sock *sk, struct sk_buff *skb) | |||
| 1099 | 1099 | ||
| 1100 | int llc_conn_ac_stop_all_timers(struct sock *sk, struct sk_buff *skb) | 1100 | int llc_conn_ac_stop_all_timers(struct sock *sk, struct sk_buff *skb) |
| 1101 | { | 1101 | { |
| 1102 | struct llc_sock *llc = llc_sk(sk); | 1102 | llc_sk_stop_all_timers(sk, false); |
| 1103 | |||
| 1104 | del_timer(&llc->pf_cycle_timer.timer); | ||
| 1105 | del_timer(&llc->ack_timer.timer); | ||
| 1106 | del_timer(&llc->rej_sent_timer.timer); | ||
| 1107 | del_timer(&llc->busy_state_timer.timer); | ||
| 1108 | llc->ack_must_be_send = 0; | ||
| 1109 | llc->ack_pf = 0; | ||
| 1110 | return 0; | 1103 | return 0; |
| 1111 | } | 1104 | } |
| 1112 | 1105 | ||
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index 110e32bcb399..c0ac522b48a1 100644 --- a/net/llc/llc_conn.c +++ b/net/llc/llc_conn.c | |||
| @@ -961,6 +961,26 @@ out: | |||
| 961 | return sk; | 961 | return sk; |
| 962 | } | 962 | } |
| 963 | 963 | ||
| 964 | void llc_sk_stop_all_timers(struct sock *sk, bool sync) | ||
| 965 | { | ||
| 966 | struct llc_sock *llc = llc_sk(sk); | ||
| 967 | |||
| 968 | if (sync) { | ||
| 969 | del_timer_sync(&llc->pf_cycle_timer.timer); | ||
| 970 | del_timer_sync(&llc->ack_timer.timer); | ||
| 971 | del_timer_sync(&llc->rej_sent_timer.timer); | ||
| 972 | del_timer_sync(&llc->busy_state_timer.timer); | ||
| 973 | } else { | ||
| 974 | del_timer(&llc->pf_cycle_timer.timer); | ||
| 975 | del_timer(&llc->ack_timer.timer); | ||
| 976 | del_timer(&llc->rej_sent_timer.timer); | ||
| 977 | del_timer(&llc->busy_state_timer.timer); | ||
| 978 | } | ||
| 979 | |||
| 980 | llc->ack_must_be_send = 0; | ||
| 981 | llc->ack_pf = 0; | ||
| 982 | } | ||
| 983 | |||
| 964 | /** | 984 | /** |
| 965 | * llc_sk_free - Frees a LLC socket | 985 | * llc_sk_free - Frees a LLC socket |
| 966 | * @sk - socket to free | 986 | * @sk - socket to free |
| @@ -973,7 +993,7 @@ void llc_sk_free(struct sock *sk) | |||
| 973 | 993 | ||
| 974 | llc->state = LLC_CONN_OUT_OF_SVC; | 994 | llc->state = LLC_CONN_OUT_OF_SVC; |
| 975 | /* Stop all (possibly) running timers */ | 995 | /* Stop all (possibly) running timers */ |
| 976 | llc_conn_ac_stop_all_timers(sk, NULL); | 996 | llc_sk_stop_all_timers(sk, true); |
| 977 | #ifdef DEBUG_LLC_CONN_ALLOC | 997 | #ifdef DEBUG_LLC_CONN_ALLOC |
| 978 | printk(KERN_INFO "%s: unackq=%d, txq=%d\n", __func__, | 998 | printk(KERN_INFO "%s: unackq=%d, txq=%d\n", __func__, |
| 979 | skb_queue_len(&llc->pdu_unack_q), | 999 | skb_queue_len(&llc->pdu_unack_q), |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index 704b3832dbad..44d8a55e9721 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
| @@ -594,6 +594,7 @@ config NFT_QUOTA | |||
| 594 | config NFT_REJECT | 594 | config NFT_REJECT |
| 595 | default m if NETFILTER_ADVANCED=n | 595 | default m if NETFILTER_ADVANCED=n |
| 596 | tristate "Netfilter nf_tables reject support" | 596 | tristate "Netfilter nf_tables reject support" |
| 597 | depends on !NF_TABLES_INET || (IPV6!=m || m) | ||
| 597 | help | 598 | help |
| 598 | This option adds the "reject" expression that you can use to | 599 | This option adds the "reject" expression that you can use to |
| 599 | explicitly deny and notify via TCP reset/ICMP informational errors | 600 | explicitly deny and notify via TCP reset/ICMP informational errors |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 5ebde4b15810..f36098887ad0 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
| @@ -2384,11 +2384,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
| 2384 | strlcpy(cfg.mcast_ifn, dm->mcast_ifn, | 2384 | strlcpy(cfg.mcast_ifn, dm->mcast_ifn, |
| 2385 | sizeof(cfg.mcast_ifn)); | 2385 | sizeof(cfg.mcast_ifn)); |
| 2386 | cfg.syncid = dm->syncid; | 2386 | cfg.syncid = dm->syncid; |
| 2387 | rtnl_lock(); | ||
| 2388 | mutex_lock(&ipvs->sync_mutex); | ||
| 2389 | ret = start_sync_thread(ipvs, &cfg, dm->state); | 2387 | ret = start_sync_thread(ipvs, &cfg, dm->state); |
| 2390 | mutex_unlock(&ipvs->sync_mutex); | ||
| 2391 | rtnl_unlock(); | ||
| 2392 | } else { | 2388 | } else { |
| 2393 | mutex_lock(&ipvs->sync_mutex); | 2389 | mutex_lock(&ipvs->sync_mutex); |
| 2394 | ret = stop_sync_thread(ipvs, dm->state); | 2390 | ret = stop_sync_thread(ipvs, dm->state); |
| @@ -3481,12 +3477,8 @@ static int ip_vs_genl_new_daemon(struct netns_ipvs *ipvs, struct nlattr **attrs) | |||
| 3481 | if (ipvs->mixed_address_family_dests > 0) | 3477 | if (ipvs->mixed_address_family_dests > 0) |
| 3482 | return -EINVAL; | 3478 | return -EINVAL; |
| 3483 | 3479 | ||
| 3484 | rtnl_lock(); | ||
| 3485 | mutex_lock(&ipvs->sync_mutex); | ||
| 3486 | ret = start_sync_thread(ipvs, &c, | 3480 | ret = start_sync_thread(ipvs, &c, |
| 3487 | nla_get_u32(attrs[IPVS_DAEMON_ATTR_STATE])); | 3481 | nla_get_u32(attrs[IPVS_DAEMON_ATTR_STATE])); |
| 3488 | mutex_unlock(&ipvs->sync_mutex); | ||
| 3489 | rtnl_unlock(); | ||
| 3490 | return ret; | 3482 | return ret; |
| 3491 | } | 3483 | } |
| 3492 | 3484 | ||
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index fbaf3bd05b2e..001501e25625 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | #include <linux/kthread.h> | 49 | #include <linux/kthread.h> |
| 50 | #include <linux/wait.h> | 50 | #include <linux/wait.h> |
| 51 | #include <linux/kernel.h> | 51 | #include <linux/kernel.h> |
| 52 | #include <linux/sched/signal.h> | ||
| 52 | 53 | ||
| 53 | #include <asm/unaligned.h> /* Used for ntoh_seq and hton_seq */ | 54 | #include <asm/unaligned.h> /* Used for ntoh_seq and hton_seq */ |
| 54 | 55 | ||
| @@ -1360,15 +1361,9 @@ static void set_mcast_pmtudisc(struct sock *sk, int val) | |||
| 1360 | /* | 1361 | /* |
| 1361 | * Specifiy default interface for outgoing multicasts | 1362 | * Specifiy default interface for outgoing multicasts |
| 1362 | */ | 1363 | */ |
| 1363 | static int set_mcast_if(struct sock *sk, char *ifname) | 1364 | static int set_mcast_if(struct sock *sk, struct net_device *dev) |
| 1364 | { | 1365 | { |
| 1365 | struct net_device *dev; | ||
| 1366 | struct inet_sock *inet = inet_sk(sk); | 1366 | struct inet_sock *inet = inet_sk(sk); |
| 1367 | struct net *net = sock_net(sk); | ||
| 1368 | |||
| 1369 | dev = __dev_get_by_name(net, ifname); | ||
| 1370 | if (!dev) | ||
| 1371 | return -ENODEV; | ||
| 1372 | 1367 | ||
| 1373 | if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if) | 1368 | if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if) |
| 1374 | return -EINVAL; | 1369 | return -EINVAL; |
| @@ -1396,19 +1391,14 @@ static int set_mcast_if(struct sock *sk, char *ifname) | |||
| 1396 | * in the in_addr structure passed in as a parameter. | 1391 | * in the in_addr structure passed in as a parameter. |
| 1397 | */ | 1392 | */ |
| 1398 | static int | 1393 | static int |
| 1399 | join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname) | 1394 | join_mcast_group(struct sock *sk, struct in_addr *addr, struct net_device *dev) |
| 1400 | { | 1395 | { |
| 1401 | struct net *net = sock_net(sk); | ||
| 1402 | struct ip_mreqn mreq; | 1396 | struct ip_mreqn mreq; |
| 1403 | struct net_device *dev; | ||
| 1404 | int ret; | 1397 | int ret; |
| 1405 | 1398 | ||
| 1406 | memset(&mreq, 0, sizeof(mreq)); | 1399 | memset(&mreq, 0, sizeof(mreq)); |
| 1407 | memcpy(&mreq.imr_multiaddr, addr, sizeof(struct in_addr)); | 1400 | memcpy(&mreq.imr_multiaddr, addr, sizeof(struct in_addr)); |
| 1408 | 1401 | ||
| 1409 | dev = __dev_get_by_name(net, ifname); | ||
| 1410 | if (!dev) | ||
| 1411 | return -ENODEV; | ||
| 1412 | if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if) | 1402 | if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if) |
| 1413 | return -EINVAL; | 1403 | return -EINVAL; |
| 1414 | 1404 | ||
| @@ -1423,15 +1413,10 @@ join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname) | |||
| 1423 | 1413 | ||
| 1424 | #ifdef CONFIG_IP_VS_IPV6 | 1414 | #ifdef CONFIG_IP_VS_IPV6 |
| 1425 | static int join_mcast_group6(struct sock *sk, struct in6_addr *addr, | 1415 | static int join_mcast_group6(struct sock *sk, struct in6_addr *addr, |
| 1426 | char *ifname) | 1416 | struct net_device *dev) |
| 1427 | { | 1417 | { |
| 1428 | struct net *net = sock_net(sk); | ||
| 1429 | struct net_device *dev; | ||
| 1430 | int ret; | 1418 | int ret; |
| 1431 | 1419 | ||
| 1432 | dev = __dev_get_by_name(net, ifname); | ||
| 1433 | if (!dev) | ||
| 1434 | return -ENODEV; | ||
| 1435 | if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if) | 1420 | if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if) |
| 1436 | return -EINVAL; | 1421 | return -EINVAL; |
| 1437 | 1422 | ||
| @@ -1443,24 +1428,18 @@ static int join_mcast_group6(struct sock *sk, struct in6_addr *addr, | |||
| 1443 | } | 1428 | } |
| 1444 | #endif | 1429 | #endif |
| 1445 | 1430 | ||
| 1446 | static int bind_mcastif_addr(struct socket *sock, char *ifname) | 1431 | static int bind_mcastif_addr(struct socket *sock, struct net_device *dev) |
| 1447 | { | 1432 | { |
| 1448 | struct net *net = sock_net(sock->sk); | ||
| 1449 | struct net_device *dev; | ||
| 1450 | __be32 addr; | 1433 | __be32 addr; |
| 1451 | struct sockaddr_in sin; | 1434 | struct sockaddr_in sin; |
| 1452 | 1435 | ||
| 1453 | dev = __dev_get_by_name(net, ifname); | ||
| 1454 | if (!dev) | ||
| 1455 | return -ENODEV; | ||
| 1456 | |||
| 1457 | addr = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE); | 1436 | addr = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE); |
| 1458 | if (!addr) | 1437 | if (!addr) |
| 1459 | pr_err("You probably need to specify IP address on " | 1438 | pr_err("You probably need to specify IP address on " |
| 1460 | "multicast interface.\n"); | 1439 | "multicast interface.\n"); |
| 1461 | 1440 | ||
| 1462 | IP_VS_DBG(7, "binding socket with (%s) %pI4\n", | 1441 | IP_VS_DBG(7, "binding socket with (%s) %pI4\n", |
| 1463 | ifname, &addr); | 1442 | dev->name, &addr); |
| 1464 | 1443 | ||
| 1465 | /* Now bind the socket with the address of multicast interface */ | 1444 | /* Now bind the socket with the address of multicast interface */ |
| 1466 | sin.sin_family = AF_INET; | 1445 | sin.sin_family = AF_INET; |
| @@ -1493,7 +1472,8 @@ static void get_mcast_sockaddr(union ipvs_sockaddr *sa, int *salen, | |||
| 1493 | /* | 1472 | /* |
| 1494 | * Set up sending multicast socket over UDP | 1473 | * Set up sending multicast socket over UDP |
| 1495 | */ | 1474 | */ |
| 1496 | static struct socket *make_send_sock(struct netns_ipvs *ipvs, int id) | 1475 | static int make_send_sock(struct netns_ipvs *ipvs, int id, |
| 1476 | struct net_device *dev, struct socket **sock_ret) | ||
| 1497 | { | 1477 | { |
| 1498 | /* multicast addr */ | 1478 | /* multicast addr */ |
| 1499 | union ipvs_sockaddr mcast_addr; | 1479 | union ipvs_sockaddr mcast_addr; |
| @@ -1505,9 +1485,10 @@ static struct socket *make_send_sock(struct netns_ipvs *ipvs, int id) | |||
| 1505 | IPPROTO_UDP, &sock); | 1485 | IPPROTO_UDP, &sock); |
| 1506 | if (result < 0) { | 1486 | if (result < 0) { |
| 1507 | pr_err("Error during creation of socket; terminating\n"); | 1487 | pr_err("Error during creation of socket; terminating\n"); |
| 1508 | return ERR_PTR(result); | 1488 | goto error; |
| 1509 | } | 1489 | } |
| 1510 | result = set_mcast_if(sock->sk, ipvs->mcfg.mcast_ifn); | 1490 | *sock_ret = sock; |
| 1491 | result = set_mcast_if(sock->sk, dev); | ||
| 1511 | if (result < 0) { | 1492 | if (result < 0) { |
| 1512 | pr_err("Error setting outbound mcast interface\n"); | 1493 | pr_err("Error setting outbound mcast interface\n"); |
| 1513 | goto error; | 1494 | goto error; |
| @@ -1522,7 +1503,7 @@ static struct socket *make_send_sock(struct netns_ipvs *ipvs, int id) | |||
| 1522 | set_sock_size(sock->sk, 1, result); | 1503 | set_sock_size(sock->sk, 1, result); |
| 1523 | 1504 | ||
| 1524 | if (AF_INET == ipvs->mcfg.mcast_af) | 1505 | if (AF_INET == ipvs->mcfg.mcast_af) |
| 1525 | result = bind_mcastif_addr(sock, ipvs->mcfg.mcast_ifn); | 1506 | result = bind_mcastif_addr(sock, dev); |
| 1526 | else | 1507 | else |
| 1527 | result = 0; | 1508 | result = 0; |
| 1528 | if (result < 0) { | 1509 | if (result < 0) { |
| @@ -1538,19 +1519,18 @@ static struct socket *make_send_sock(struct netns_ipvs *ipvs, int id) | |||
| 1538 | goto error; | 1519 | goto error; |
| 1539 | } | 1520 | } |
| 1540 | 1521 | ||
| 1541 | return sock; | 1522 | return 0; |
| 1542 | 1523 | ||
| 1543 | error: | 1524 | error: |
| 1544 | sock_release(sock); | 1525 | return result; |
| 1545 | return ERR_PTR(result); | ||
| 1546 | } | 1526 | } |
| 1547 | 1527 | ||
| 1548 | 1528 | ||
| 1549 | /* | 1529 | /* |
| 1550 | * Set up receiving multicast socket over UDP | 1530 | * Set up receiving multicast socket over UDP |
| 1551 | */ | 1531 | */ |
| 1552 | static struct socket *make_receive_sock(struct netns_ipvs *ipvs, int id, | 1532 | static int make_receive_sock(struct netns_ipvs *ipvs, int id, |
| 1553 | int ifindex) | 1533 | struct net_device *dev, struct socket **sock_ret) |
| 1554 | { | 1534 | { |
| 1555 | /* multicast addr */ | 1535 | /* multicast addr */ |
| 1556 | union ipvs_sockaddr mcast_addr; | 1536 | union ipvs_sockaddr mcast_addr; |
| @@ -1562,8 +1542,9 @@ static struct socket *make_receive_sock(struct netns_ipvs *ipvs, int id, | |||
| 1562 | IPPROTO_UDP, &sock); | 1542 | IPPROTO_UDP, &sock); |
| 1563 | if (result < 0) { | 1543 | if (result < 0) { |
| 1564 | pr_err("Error during creation of socket; terminating\n"); | 1544 | pr_err("Error during creation of socket; terminating\n"); |
| 1565 | return ERR_PTR(result); | 1545 | goto error; |
| 1566 | } | 1546 | } |
| 1547 | *sock_ret = sock; | ||
| 1567 | /* it is equivalent to the REUSEADDR option in user-space */ | 1548 | /* it is equivalent to the REUSEADDR option in user-space */ |
| 1568 | sock->sk->sk_reuse = SK_CAN_REUSE; | 1549 | sock->sk->sk_reuse = SK_CAN_REUSE; |
| 1569 | result = sysctl_sync_sock_size(ipvs); | 1550 | result = sysctl_sync_sock_size(ipvs); |
| @@ -1571,7 +1552,7 @@ static struct socket *make_receive_sock(struct netns_ipvs *ipvs, int id, | |||
| 1571 | set_sock_size(sock->sk, 0, result); | 1552 | set_sock_size(sock->sk, 0, result); |
| 1572 | 1553 | ||
| 1573 | get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->bcfg, id); | 1554 | get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->bcfg, id); |
| 1574 | sock->sk->sk_bound_dev_if = ifindex; | 1555 | sock->sk->sk_bound_dev_if = dev->ifindex; |
| 1575 | result = sock->ops->bind(sock, (struct sockaddr *)&mcast_addr, salen); | 1556 | result = sock->ops->bind(sock, (struct sockaddr *)&mcast_addr, salen); |
| 1576 | if (result < 0) { | 1557 | if (result < 0) { |
| 1577 | pr_err("Error binding to the multicast addr\n"); | 1558 | pr_err("Error binding to the multicast addr\n"); |
| @@ -1582,21 +1563,20 @@ static struct socket *make_receive_sock(struct netns_ipvs *ipvs, int id, | |||
| 1582 | #ifdef CONFIG_IP_VS_IPV6 | 1563 | #ifdef CONFIG_IP_VS_IPV6 |
| 1583 | if (ipvs->bcfg.mcast_af == AF_INET6) | 1564 | if (ipvs->bcfg.mcast_af == AF_INET6) |
| 1584 | result = join_mcast_group6(sock->sk, &mcast_addr.in6.sin6_addr, | 1565 | result = join_mcast_group6(sock->sk, &mcast_addr.in6.sin6_addr, |
| 1585 | ipvs->bcfg.mcast_ifn); | 1566 | dev); |
| 1586 | else | 1567 | else |
| 1587 | #endif | 1568 | #endif |
| 1588 | result = join_mcast_group(sock->sk, &mcast_addr.in.sin_addr, | 1569 | result = join_mcast_group(sock->sk, &mcast_addr.in.sin_addr, |
| 1589 | ipvs->bcfg.mcast_ifn); | 1570 | dev); |
| 1590 | if (result < 0) { | 1571 | if (result < 0) { |
| 1591 | pr_err("Error joining to the multicast group\n"); | 1572 | pr_err("Error joining to the multicast group\n"); |
| 1592 | goto error; | 1573 | goto error; |
| 1593 | } | 1574 | } |
| 1594 | 1575 | ||
| 1595 | return sock; | 1576 | return 0; |
| 1596 | 1577 | ||
| 1597 | error: | 1578 | error: |
| 1598 | sock_release(sock); | 1579 | return result; |
| 1599 | return ERR_PTR(result); | ||
| 1600 | } | 1580 | } |
| 1601 | 1581 | ||
| 1602 | 1582 | ||
| @@ -1778,13 +1758,12 @@ static int sync_thread_backup(void *data) | |||
| 1778 | int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c, | 1758 | int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c, |
| 1779 | int state) | 1759 | int state) |
| 1780 | { | 1760 | { |
| 1781 | struct ip_vs_sync_thread_data *tinfo; | 1761 | struct ip_vs_sync_thread_data *tinfo = NULL; |
| 1782 | struct task_struct **array = NULL, *task; | 1762 | struct task_struct **array = NULL, *task; |
| 1783 | struct socket *sock; | ||
| 1784 | struct net_device *dev; | 1763 | struct net_device *dev; |
| 1785 | char *name; | 1764 | char *name; |
| 1786 | int (*threadfn)(void *data); | 1765 | int (*threadfn)(void *data); |
| 1787 | int id, count, hlen; | 1766 | int id = 0, count, hlen; |
| 1788 | int result = -ENOMEM; | 1767 | int result = -ENOMEM; |
| 1789 | u16 mtu, min_mtu; | 1768 | u16 mtu, min_mtu; |
| 1790 | 1769 | ||
| @@ -1792,6 +1771,18 @@ int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c, | |||
| 1792 | IP_VS_DBG(7, "Each ip_vs_sync_conn entry needs %zd bytes\n", | 1771 | IP_VS_DBG(7, "Each ip_vs_sync_conn entry needs %zd bytes\n", |
| 1793 | sizeof(struct ip_vs_sync_conn_v0)); | 1772 | sizeof(struct ip_vs_sync_conn_v0)); |
| 1794 | 1773 | ||
| 1774 | /* Do not hold one mutex and then to block on another */ | ||
| 1775 | for (;;) { | ||
| 1776 | rtnl_lock(); | ||
| 1777 | if (mutex_trylock(&ipvs->sync_mutex)) | ||
| 1778 | break; | ||
| 1779 | rtnl_unlock(); | ||
| 1780 | mutex_lock(&ipvs->sync_mutex); | ||
| 1781 | if (rtnl_trylock()) | ||
| 1782 | break; | ||
| 1783 | mutex_unlock(&ipvs->sync_mutex); | ||
| 1784 | } | ||
| 1785 | |||
| 1795 | if (!ipvs->sync_state) { | 1786 | if (!ipvs->sync_state) { |
| 1796 | count = clamp(sysctl_sync_ports(ipvs), 1, IPVS_SYNC_PORTS_MAX); | 1787 | count = clamp(sysctl_sync_ports(ipvs), 1, IPVS_SYNC_PORTS_MAX); |
| 1797 | ipvs->threads_mask = count - 1; | 1788 | ipvs->threads_mask = count - 1; |
| @@ -1810,7 +1801,8 @@ int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c, | |||
| 1810 | dev = __dev_get_by_name(ipvs->net, c->mcast_ifn); | 1801 | dev = __dev_get_by_name(ipvs->net, c->mcast_ifn); |
| 1811 | if (!dev) { | 1802 | if (!dev) { |
| 1812 | pr_err("Unknown mcast interface: %s\n", c->mcast_ifn); | 1803 | pr_err("Unknown mcast interface: %s\n", c->mcast_ifn); |
| 1813 | return -ENODEV; | 1804 | result = -ENODEV; |
| 1805 | goto out_early; | ||
| 1814 | } | 1806 | } |
| 1815 | hlen = (AF_INET6 == c->mcast_af) ? | 1807 | hlen = (AF_INET6 == c->mcast_af) ? |
| 1816 | sizeof(struct ipv6hdr) + sizeof(struct udphdr) : | 1808 | sizeof(struct ipv6hdr) + sizeof(struct udphdr) : |
| @@ -1827,26 +1819,30 @@ int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c, | |||
| 1827 | c->sync_maxlen = mtu - hlen; | 1819 | c->sync_maxlen = mtu - hlen; |
| 1828 | 1820 | ||
| 1829 | if (state == IP_VS_STATE_MASTER) { | 1821 | if (state == IP_VS_STATE_MASTER) { |
| 1822 | result = -EEXIST; | ||
| 1830 | if (ipvs->ms) | 1823 | if (ipvs->ms) |
| 1831 | return -EEXIST; | 1824 | goto out_early; |
| 1832 | 1825 | ||
| 1833 | ipvs->mcfg = *c; | 1826 | ipvs->mcfg = *c; |
| 1834 | name = "ipvs-m:%d:%d"; | 1827 | name = "ipvs-m:%d:%d"; |
| 1835 | threadfn = sync_thread_master; | 1828 | threadfn = sync_thread_master; |
| 1836 | } else if (state == IP_VS_STATE_BACKUP) { | 1829 | } else if (state == IP_VS_STATE_BACKUP) { |
| 1830 | result = -EEXIST; | ||
| 1837 | if (ipvs->backup_threads) | 1831 | if (ipvs->backup_threads) |
| 1838 | return -EEXIST; | 1832 | goto out_early; |
| 1839 | 1833 | ||
| 1840 | ipvs->bcfg = *c; | 1834 | ipvs->bcfg = *c; |
| 1841 | name = "ipvs-b:%d:%d"; | 1835 | name = "ipvs-b:%d:%d"; |
| 1842 | threadfn = sync_thread_backup; | 1836 | threadfn = sync_thread_backup; |
| 1843 | } else { | 1837 | } else { |
| 1844 | return -EINVAL; | 1838 | result = -EINVAL; |
| 1839 | goto out_early; | ||
| 1845 | } | 1840 | } |
| 1846 | 1841 | ||
| 1847 | if (state == IP_VS_STATE_MASTER) { | 1842 | if (state == IP_VS_STATE_MASTER) { |
| 1848 | struct ipvs_master_sync_state *ms; | 1843 | struct ipvs_master_sync_state *ms; |
| 1849 | 1844 | ||
| 1845 | result = -ENOMEM; | ||
| 1850 | ipvs->ms = kcalloc(count, sizeof(ipvs->ms[0]), GFP_KERNEL); | 1846 | ipvs->ms = kcalloc(count, sizeof(ipvs->ms[0]), GFP_KERNEL); |
| 1851 | if (!ipvs->ms) | 1847 | if (!ipvs->ms) |
| 1852 | goto out; | 1848 | goto out; |
| @@ -1862,39 +1858,38 @@ int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c, | |||
| 1862 | } else { | 1858 | } else { |
| 1863 | array = kcalloc(count, sizeof(struct task_struct *), | 1859 | array = kcalloc(count, sizeof(struct task_struct *), |
| 1864 | GFP_KERNEL); | 1860 | GFP_KERNEL); |
| 1861 | result = -ENOMEM; | ||
| 1865 | if (!array) | 1862 | if (!array) |
| 1866 | goto out; | 1863 | goto out; |
| 1867 | } | 1864 | } |
| 1868 | 1865 | ||
| 1869 | tinfo = NULL; | ||
| 1870 | for (id = 0; id < count; id++) { | 1866 | for (id = 0; id < count; id++) { |
| 1871 | if (state == IP_VS_STATE_MASTER) | 1867 | result = -ENOMEM; |
| 1872 | sock = make_send_sock(ipvs, id); | ||
| 1873 | else | ||
| 1874 | sock = make_receive_sock(ipvs, id, dev->ifindex); | ||
| 1875 | if (IS_ERR(sock)) { | ||
| 1876 | result = PTR_ERR(sock); | ||
| 1877 | goto outtinfo; | ||
| 1878 | } | ||
| 1879 | tinfo = kmalloc(sizeof(*tinfo), GFP_KERNEL); | 1868 | tinfo = kmalloc(sizeof(*tinfo), GFP_KERNEL); |
| 1880 | if (!tinfo) | 1869 | if (!tinfo) |
| 1881 | goto outsocket; | 1870 | goto out; |
| 1882 | tinfo->ipvs = ipvs; | 1871 | tinfo->ipvs = ipvs; |
| 1883 | tinfo->sock = sock; | 1872 | tinfo->sock = NULL; |
| 1884 | if (state == IP_VS_STATE_BACKUP) { | 1873 | if (state == IP_VS_STATE_BACKUP) { |
| 1885 | tinfo->buf = kmalloc(ipvs->bcfg.sync_maxlen, | 1874 | tinfo->buf = kmalloc(ipvs->bcfg.sync_maxlen, |
| 1886 | GFP_KERNEL); | 1875 | GFP_KERNEL); |
| 1887 | if (!tinfo->buf) | 1876 | if (!tinfo->buf) |
| 1888 | goto outtinfo; | 1877 | goto out; |
| 1889 | } else { | 1878 | } else { |
| 1890 | tinfo->buf = NULL; | 1879 | tinfo->buf = NULL; |
| 1891 | } | 1880 | } |
| 1892 | tinfo->id = id; | 1881 | tinfo->id = id; |
| 1882 | if (state == IP_VS_STATE_MASTER) | ||
| 1883 | result = make_send_sock(ipvs, id, dev, &tinfo->sock); | ||
| 1884 | else | ||
| 1885 | result = make_receive_sock(ipvs, id, dev, &tinfo->sock); | ||
| 1886 | if (result < 0) | ||
| 1887 | goto out; | ||
| 1893 | 1888 | ||
| 1894 | task = kthread_run(threadfn, tinfo, name, ipvs->gen, id); | 1889 | task = kthread_run(threadfn, tinfo, name, ipvs->gen, id); |
| 1895 | if (IS_ERR(task)) { | 1890 | if (IS_ERR(task)) { |
| 1896 | result = PTR_ERR(task); | 1891 | result = PTR_ERR(task); |
| 1897 | goto outtinfo; | 1892 | goto out; |
| 1898 | } | 1893 | } |
| 1899 | tinfo = NULL; | 1894 | tinfo = NULL; |
| 1900 | if (state == IP_VS_STATE_MASTER) | 1895 | if (state == IP_VS_STATE_MASTER) |
| @@ -1911,20 +1906,20 @@ int start_sync_thread(struct netns_ipvs *ipvs, struct ipvs_sync_daemon_cfg *c, | |||
| 1911 | ipvs->sync_state |= state; | 1906 | ipvs->sync_state |= state; |
| 1912 | spin_unlock_bh(&ipvs->sync_buff_lock); | 1907 | spin_unlock_bh(&ipvs->sync_buff_lock); |
| 1913 | 1908 | ||
| 1909 | mutex_unlock(&ipvs->sync_mutex); | ||
| 1910 | rtnl_unlock(); | ||
| 1911 | |||
| 1914 | /* increase the module use count */ | 1912 | /* increase the module use count */ |
| 1915 | ip_vs_use_count_inc(); | 1913 | ip_vs_use_count_inc(); |
| 1916 | 1914 | ||
| 1917 | return 0; | 1915 | return 0; |
| 1918 | 1916 | ||
| 1919 | outsocket: | 1917 | out: |
| 1920 | sock_release(sock); | 1918 | /* We do not need RTNL lock anymore, release it here so that |
| 1921 | 1919 | * sock_release below and in the kthreads can use rtnl_lock | |
| 1922 | outtinfo: | 1920 | * to leave the mcast group. |
| 1923 | if (tinfo) { | 1921 | */ |
| 1924 | sock_release(tinfo->sock); | 1922 | rtnl_unlock(); |
| 1925 | kfree(tinfo->buf); | ||
| 1926 | kfree(tinfo); | ||
| 1927 | } | ||
| 1928 | count = id; | 1923 | count = id; |
| 1929 | while (count-- > 0) { | 1924 | while (count-- > 0) { |
| 1930 | if (state == IP_VS_STATE_MASTER) | 1925 | if (state == IP_VS_STATE_MASTER) |
| @@ -1932,13 +1927,23 @@ outtinfo: | |||
| 1932 | else | 1927 | else |
| 1933 | kthread_stop(array[count]); | 1928 | kthread_stop(array[count]); |
| 1934 | } | 1929 | } |
| 1935 | kfree(array); | ||
| 1936 | |||
| 1937 | out: | ||
| 1938 | if (!(ipvs->sync_state & IP_VS_STATE_MASTER)) { | 1930 | if (!(ipvs->sync_state & IP_VS_STATE_MASTER)) { |
| 1939 | kfree(ipvs->ms); | 1931 | kfree(ipvs->ms); |
| 1940 | ipvs->ms = NULL; | 1932 | ipvs->ms = NULL; |
| 1941 | } | 1933 | } |
| 1934 | mutex_unlock(&ipvs->sync_mutex); | ||
| 1935 | if (tinfo) { | ||
| 1936 | if (tinfo->sock) | ||
| 1937 | sock_release(tinfo->sock); | ||
| 1938 | kfree(tinfo->buf); | ||
| 1939 | kfree(tinfo); | ||
| 1940 | } | ||
| 1941 | kfree(array); | ||
| 1942 | return result; | ||
| 1943 | |||
| 1944 | out_early: | ||
| 1945 | mutex_unlock(&ipvs->sync_mutex); | ||
| 1946 | rtnl_unlock(); | ||
| 1942 | return result; | 1947 | return result; |
| 1943 | } | 1948 | } |
| 1944 | 1949 | ||
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index 8ef21d9f9a00..4b2b3d53acfc 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c | |||
| @@ -252,7 +252,7 @@ static inline int expect_clash(const struct nf_conntrack_expect *a, | |||
| 252 | static inline int expect_matches(const struct nf_conntrack_expect *a, | 252 | static inline int expect_matches(const struct nf_conntrack_expect *a, |
| 253 | const struct nf_conntrack_expect *b) | 253 | const struct nf_conntrack_expect *b) |
| 254 | { | 254 | { |
| 255 | return a->master == b->master && a->class == b->class && | 255 | return a->master == b->master && |
| 256 | nf_ct_tuple_equal(&a->tuple, &b->tuple) && | 256 | nf_ct_tuple_equal(&a->tuple, &b->tuple) && |
| 257 | nf_ct_tuple_mask_equal(&a->mask, &b->mask) && | 257 | nf_ct_tuple_mask_equal(&a->mask, &b->mask) && |
| 258 | net_eq(nf_ct_net(a->master), nf_ct_net(b->master)) && | 258 | net_eq(nf_ct_net(a->master), nf_ct_net(b->master)) && |
| @@ -421,6 +421,9 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect) | |||
| 421 | h = nf_ct_expect_dst_hash(net, &expect->tuple); | 421 | h = nf_ct_expect_dst_hash(net, &expect->tuple); |
| 422 | hlist_for_each_entry_safe(i, next, &nf_ct_expect_hash[h], hnode) { | 422 | hlist_for_each_entry_safe(i, next, &nf_ct_expect_hash[h], hnode) { |
| 423 | if (expect_matches(i, expect)) { | 423 | if (expect_matches(i, expect)) { |
| 424 | if (i->class != expect->class) | ||
| 425 | return -EALREADY; | ||
| 426 | |||
| 424 | if (nf_ct_remove_expect(i)) | 427 | if (nf_ct_remove_expect(i)) |
| 425 | break; | 428 | break; |
| 426 | } else if (expect_clash(i, expect)) { | 429 | } else if (expect_clash(i, expect)) { |
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c index 9fe0ddc333fb..277bbfe26478 100644 --- a/net/netfilter/nf_conntrack_extend.c +++ b/net/netfilter/nf_conntrack_extend.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ | 10 | */ |
| 11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| 12 | #include <linux/kmemleak.h> | ||
| 12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 13 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
| 14 | #include <linux/rcupdate.h> | 15 | #include <linux/rcupdate.h> |
| @@ -71,6 +72,7 @@ void *nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) | |||
| 71 | rcu_read_unlock(); | 72 | rcu_read_unlock(); |
| 72 | 73 | ||
| 73 | alloc = max(newlen, NF_CT_EXT_PREALLOC); | 74 | alloc = max(newlen, NF_CT_EXT_PREALLOC); |
| 75 | kmemleak_not_leak(old); | ||
| 74 | new = __krealloc(old, alloc, gfp); | 76 | new = __krealloc(old, alloc, gfp); |
| 75 | if (!new) | 77 | if (!new) |
| 76 | return NULL; | 78 | return NULL; |
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c index 4dbb5bad4363..908e51e2dc2b 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c | |||
| @@ -938,11 +938,19 @@ static int set_expected_rtp_rtcp(struct sk_buff *skb, unsigned int protoff, | |||
| 938 | datalen, rtp_exp, rtcp_exp, | 938 | datalen, rtp_exp, rtcp_exp, |
| 939 | mediaoff, medialen, daddr); | 939 | mediaoff, medialen, daddr); |
| 940 | else { | 940 | else { |
| 941 | if (nf_ct_expect_related(rtp_exp) == 0) { | 941 | /* -EALREADY handling works around end-points that send |
| 942 | if (nf_ct_expect_related(rtcp_exp) != 0) | 942 | * SDP messages with identical port but different media type, |
| 943 | nf_ct_unexpect_related(rtp_exp); | 943 | * we pretend expectation was set up. |
| 944 | else | 944 | */ |
| 945 | int errp = nf_ct_expect_related(rtp_exp); | ||
| 946 | |||
| 947 | if (errp == 0 || errp == -EALREADY) { | ||
| 948 | int errcp = nf_ct_expect_related(rtcp_exp); | ||
| 949 | |||
| 950 | if (errcp == 0 || errcp == -EALREADY) | ||
| 945 | ret = NF_ACCEPT; | 951 | ret = NF_ACCEPT; |
| 952 | else if (errp == 0) | ||
| 953 | nf_ct_unexpect_related(rtp_exp); | ||
| 946 | } | 954 | } |
| 947 | } | 955 | } |
| 948 | nf_ct_expect_put(rtcp_exp); | 956 | nf_ct_expect_put(rtcp_exp); |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 9134cc429ad4..04d4e3772584 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
| @@ -2361,41 +2361,46 @@ static int nf_tables_newrule(struct net *net, struct sock *nlsk, | |||
| 2361 | } | 2361 | } |
| 2362 | 2362 | ||
| 2363 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { | 2363 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { |
| 2364 | if (nft_is_active_next(net, old_rule)) { | 2364 | if (!nft_is_active_next(net, old_rule)) { |
| 2365 | trans = nft_trans_rule_add(&ctx, NFT_MSG_DELRULE, | ||
| 2366 | old_rule); | ||
| 2367 | if (trans == NULL) { | ||
| 2368 | err = -ENOMEM; | ||
| 2369 | goto err2; | ||
| 2370 | } | ||
| 2371 | nft_deactivate_next(net, old_rule); | ||
| 2372 | chain->use--; | ||
| 2373 | list_add_tail_rcu(&rule->list, &old_rule->list); | ||
| 2374 | } else { | ||
| 2375 | err = -ENOENT; | 2365 | err = -ENOENT; |
| 2376 | goto err2; | 2366 | goto err2; |
| 2377 | } | 2367 | } |
| 2378 | } else if (nlh->nlmsg_flags & NLM_F_APPEND) | 2368 | trans = nft_trans_rule_add(&ctx, NFT_MSG_DELRULE, |
| 2379 | if (old_rule) | 2369 | old_rule); |
| 2380 | list_add_rcu(&rule->list, &old_rule->list); | 2370 | if (trans == NULL) { |
| 2381 | else | 2371 | err = -ENOMEM; |
| 2382 | list_add_tail_rcu(&rule->list, &chain->rules); | 2372 | goto err2; |
| 2383 | else { | 2373 | } |
| 2384 | if (old_rule) | 2374 | nft_deactivate_next(net, old_rule); |
| 2385 | list_add_tail_rcu(&rule->list, &old_rule->list); | 2375 | chain->use--; |
| 2386 | else | ||
| 2387 | list_add_rcu(&rule->list, &chain->rules); | ||
| 2388 | } | ||
| 2389 | 2376 | ||
| 2390 | if (nft_trans_rule_add(&ctx, NFT_MSG_NEWRULE, rule) == NULL) { | 2377 | if (nft_trans_rule_add(&ctx, NFT_MSG_NEWRULE, rule) == NULL) { |
| 2391 | err = -ENOMEM; | 2378 | err = -ENOMEM; |
| 2392 | goto err3; | 2379 | goto err2; |
| 2380 | } | ||
| 2381 | |||
| 2382 | list_add_tail_rcu(&rule->list, &old_rule->list); | ||
| 2383 | } else { | ||
| 2384 | if (nft_trans_rule_add(&ctx, NFT_MSG_NEWRULE, rule) == NULL) { | ||
| 2385 | err = -ENOMEM; | ||
| 2386 | goto err2; | ||
| 2387 | } | ||
| 2388 | |||
| 2389 | if (nlh->nlmsg_flags & NLM_F_APPEND) { | ||
| 2390 | if (old_rule) | ||
| 2391 | list_add_rcu(&rule->list, &old_rule->list); | ||
| 2392 | else | ||
| 2393 | list_add_tail_rcu(&rule->list, &chain->rules); | ||
| 2394 | } else { | ||
| 2395 | if (old_rule) | ||
| 2396 | list_add_tail_rcu(&rule->list, &old_rule->list); | ||
| 2397 | else | ||
| 2398 | list_add_rcu(&rule->list, &chain->rules); | ||
| 2399 | } | ||
| 2393 | } | 2400 | } |
| 2394 | chain->use++; | 2401 | chain->use++; |
| 2395 | return 0; | 2402 | return 0; |
| 2396 | 2403 | ||
| 2397 | err3: | ||
| 2398 | list_del_rcu(&rule->list); | ||
| 2399 | err2: | 2404 | err2: |
| 2400 | nf_tables_rule_destroy(&ctx, rule); | 2405 | nf_tables_rule_destroy(&ctx, rule); |
| 2401 | err1: | 2406 | err1: |
| @@ -3207,18 +3212,20 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, | |||
| 3207 | 3212 | ||
| 3208 | err = ops->init(set, &desc, nla); | 3213 | err = ops->init(set, &desc, nla); |
| 3209 | if (err < 0) | 3214 | if (err < 0) |
| 3210 | goto err2; | 3215 | goto err3; |
| 3211 | 3216 | ||
| 3212 | err = nft_trans_set_add(&ctx, NFT_MSG_NEWSET, set); | 3217 | err = nft_trans_set_add(&ctx, NFT_MSG_NEWSET, set); |
| 3213 | if (err < 0) | 3218 | if (err < 0) |
| 3214 | goto err3; | 3219 | goto err4; |
| 3215 | 3220 | ||
| 3216 | list_add_tail_rcu(&set->list, &table->sets); | 3221 | list_add_tail_rcu(&set->list, &table->sets); |
| 3217 | table->use++; | 3222 | table->use++; |
| 3218 | return 0; | 3223 | return 0; |
| 3219 | 3224 | ||
| 3220 | err3: | 3225 | err4: |
| 3221 | ops->destroy(set); | 3226 | ops->destroy(set); |
| 3227 | err3: | ||
| 3228 | kfree(set->name); | ||
| 3222 | err2: | 3229 | err2: |
| 3223 | kvfree(set); | 3230 | kvfree(set); |
| 3224 | err1: | 3231 | err1: |
| @@ -5738,7 +5745,7 @@ static void nft_chain_commit_update(struct nft_trans *trans) | |||
| 5738 | struct nft_base_chain *basechain; | 5745 | struct nft_base_chain *basechain; |
| 5739 | 5746 | ||
| 5740 | if (nft_trans_chain_name(trans)) | 5747 | if (nft_trans_chain_name(trans)) |
| 5741 | strcpy(trans->ctx.chain->name, nft_trans_chain_name(trans)); | 5748 | swap(trans->ctx.chain->name, nft_trans_chain_name(trans)); |
| 5742 | 5749 | ||
| 5743 | if (!nft_is_base_chain(trans->ctx.chain)) | 5750 | if (!nft_is_base_chain(trans->ctx.chain)) |
| 5744 | return; | 5751 | return; |
diff --git a/net/netfilter/xt_connmark.c b/net/netfilter/xt_connmark.c index 773da82190dc..94df000abb92 100644 --- a/net/netfilter/xt_connmark.c +++ b/net/netfilter/xt_connmark.c | |||
| @@ -36,11 +36,10 @@ MODULE_ALIAS("ipt_connmark"); | |||
| 36 | MODULE_ALIAS("ip6t_connmark"); | 36 | MODULE_ALIAS("ip6t_connmark"); |
| 37 | 37 | ||
| 38 | static unsigned int | 38 | static unsigned int |
| 39 | connmark_tg_shift(struct sk_buff *skb, | 39 | connmark_tg_shift(struct sk_buff *skb, const struct xt_connmark_tginfo2 *info) |
| 40 | const struct xt_connmark_tginfo1 *info, | ||
| 41 | u8 shift_bits, u8 shift_dir) | ||
| 42 | { | 40 | { |
| 43 | enum ip_conntrack_info ctinfo; | 41 | enum ip_conntrack_info ctinfo; |
| 42 | u_int32_t new_targetmark; | ||
| 44 | struct nf_conn *ct; | 43 | struct nf_conn *ct; |
| 45 | u_int32_t newmark; | 44 | u_int32_t newmark; |
| 46 | 45 | ||
| @@ -51,34 +50,39 @@ connmark_tg_shift(struct sk_buff *skb, | |||
| 51 | switch (info->mode) { | 50 | switch (info->mode) { |
| 52 | case XT_CONNMARK_SET: | 51 | case XT_CONNMARK_SET: |
| 53 | newmark = (ct->mark & ~info->ctmask) ^ info->ctmark; | 52 | newmark = (ct->mark & ~info->ctmask) ^ info->ctmark; |
| 54 | if (shift_dir == D_SHIFT_RIGHT) | 53 | if (info->shift_dir == D_SHIFT_RIGHT) |
| 55 | newmark >>= shift_bits; | 54 | newmark >>= info->shift_bits; |
| 56 | else | 55 | else |
| 57 | newmark <<= shift_bits; | 56 | newmark <<= info->shift_bits; |
| 57 | |||
| 58 | if (ct->mark != newmark) { | 58 | if (ct->mark != newmark) { |
| 59 | ct->mark = newmark; | 59 | ct->mark = newmark; |
| 60 | nf_conntrack_event_cache(IPCT_MARK, ct); | 60 | nf_conntrack_event_cache(IPCT_MARK, ct); |
| 61 | } | 61 | } |
| 62 | break; | 62 | break; |
| 63 | case XT_CONNMARK_SAVE: | 63 | case XT_CONNMARK_SAVE: |
| 64 | newmark = (ct->mark & ~info->ctmask) ^ | 64 | new_targetmark = (skb->mark & info->nfmask); |
| 65 | (skb->mark & info->nfmask); | 65 | if (info->shift_dir == D_SHIFT_RIGHT) |
| 66 | if (shift_dir == D_SHIFT_RIGHT) | 66 | new_targetmark >>= info->shift_bits; |
| 67 | newmark >>= shift_bits; | ||
| 68 | else | 67 | else |
| 69 | newmark <<= shift_bits; | 68 | new_targetmark <<= info->shift_bits; |
| 69 | |||
| 70 | newmark = (ct->mark & ~info->ctmask) ^ | ||
| 71 | new_targetmark; | ||
| 70 | if (ct->mark != newmark) { | 72 | if (ct->mark != newmark) { |
| 71 | ct->mark = newmark; | 73 | ct->mark = newmark; |
| 72 | nf_conntrack_event_cache(IPCT_MARK, ct); | 74 | nf_conntrack_event_cache(IPCT_MARK, ct); |
| 73 | } | 75 | } |
| 74 | break; | 76 | break; |
| 75 | case XT_CONNMARK_RESTORE: | 77 | case XT_CONNMARK_RESTORE: |
| 76 | newmark = (skb->mark & ~info->nfmask) ^ | 78 | new_targetmark = (ct->mark & info->ctmask); |
| 77 | (ct->mark & info->ctmask); | 79 | if (info->shift_dir == D_SHIFT_RIGHT) |
| 78 | if (shift_dir == D_SHIFT_RIGHT) | 80 | new_targetmark >>= info->shift_bits; |
| 79 | newmark >>= shift_bits; | ||
| 80 | else | 81 | else |
| 81 | newmark <<= shift_bits; | 82 | new_targetmark <<= info->shift_bits; |
| 83 | |||
| 84 | newmark = (skb->mark & ~info->nfmask) ^ | ||
| 85 | new_targetmark; | ||
| 82 | skb->mark = newmark; | 86 | skb->mark = newmark; |
| 83 | break; | 87 | break; |
| 84 | } | 88 | } |
| @@ -89,8 +93,14 @@ static unsigned int | |||
| 89 | connmark_tg(struct sk_buff *skb, const struct xt_action_param *par) | 93 | connmark_tg(struct sk_buff *skb, const struct xt_action_param *par) |
| 90 | { | 94 | { |
| 91 | const struct xt_connmark_tginfo1 *info = par->targinfo; | 95 | const struct xt_connmark_tginfo1 *info = par->targinfo; |
| 92 | 96 | const struct xt_connmark_tginfo2 info2 = { | |
| 93 | return connmark_tg_shift(skb, info, 0, 0); | 97 | .ctmark = info->ctmark, |
| 98 | .ctmask = info->ctmask, | ||
| 99 | .nfmask = info->nfmask, | ||
| 100 | .mode = info->mode, | ||
| 101 | }; | ||
| 102 | |||
| 103 | return connmark_tg_shift(skb, &info2); | ||
| 94 | } | 104 | } |
| 95 | 105 | ||
| 96 | static unsigned int | 106 | static unsigned int |
| @@ -98,8 +108,7 @@ connmark_tg_v2(struct sk_buff *skb, const struct xt_action_param *par) | |||
| 98 | { | 108 | { |
| 99 | const struct xt_connmark_tginfo2 *info = par->targinfo; | 109 | const struct xt_connmark_tginfo2 *info = par->targinfo; |
| 100 | 110 | ||
| 101 | return connmark_tg_shift(skb, (const struct xt_connmark_tginfo1 *)info, | 111 | return connmark_tg_shift(skb, info); |
| 102 | info->shift_bits, info->shift_dir); | ||
| 103 | } | 112 | } |
| 104 | 113 | ||
| 105 | static int connmark_tg_check(const struct xt_tgchk_param *par) | 114 | static int connmark_tg_check(const struct xt_tgchk_param *par) |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index c31b0687396a..01f3515cada0 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
| @@ -329,11 +329,11 @@ static void packet_pick_tx_queue(struct net_device *dev, struct sk_buff *skb) | |||
| 329 | skb_set_queue_mapping(skb, queue_index); | 329 | skb_set_queue_mapping(skb, queue_index); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | /* register_prot_hook must be invoked with the po->bind_lock held, | 332 | /* __register_prot_hook must be invoked through register_prot_hook |
| 333 | * or from a context in which asynchronous accesses to the packet | 333 | * or from a context in which asynchronous accesses to the packet |
| 334 | * socket is not possible (packet_create()). | 334 | * socket is not possible (packet_create()). |
| 335 | */ | 335 | */ |
| 336 | static void register_prot_hook(struct sock *sk) | 336 | static void __register_prot_hook(struct sock *sk) |
| 337 | { | 337 | { |
| 338 | struct packet_sock *po = pkt_sk(sk); | 338 | struct packet_sock *po = pkt_sk(sk); |
| 339 | 339 | ||
| @@ -348,8 +348,13 @@ static void register_prot_hook(struct sock *sk) | |||
| 348 | } | 348 | } |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | /* {,__}unregister_prot_hook() must be invoked with the po->bind_lock | 351 | static void register_prot_hook(struct sock *sk) |
| 352 | * held. If the sync parameter is true, we will temporarily drop | 352 | { |
| 353 | lockdep_assert_held_once(&pkt_sk(sk)->bind_lock); | ||
| 354 | __register_prot_hook(sk); | ||
| 355 | } | ||
| 356 | |||
| 357 | /* If the sync parameter is true, we will temporarily drop | ||
| 353 | * the po->bind_lock and do a synchronize_net to make sure no | 358 | * the po->bind_lock and do a synchronize_net to make sure no |
| 354 | * asynchronous packet processing paths still refer to the elements | 359 | * asynchronous packet processing paths still refer to the elements |
| 355 | * of po->prot_hook. If the sync parameter is false, it is the | 360 | * of po->prot_hook. If the sync parameter is false, it is the |
| @@ -359,6 +364,8 @@ static void __unregister_prot_hook(struct sock *sk, bool sync) | |||
| 359 | { | 364 | { |
| 360 | struct packet_sock *po = pkt_sk(sk); | 365 | struct packet_sock *po = pkt_sk(sk); |
| 361 | 366 | ||
| 367 | lockdep_assert_held_once(&po->bind_lock); | ||
| 368 | |||
| 362 | po->running = 0; | 369 | po->running = 0; |
| 363 | 370 | ||
| 364 | if (po->fanout) | 371 | if (po->fanout) |
| @@ -3252,7 +3259,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol, | |||
| 3252 | 3259 | ||
| 3253 | if (proto) { | 3260 | if (proto) { |
| 3254 | po->prot_hook.type = proto; | 3261 | po->prot_hook.type = proto; |
| 3255 | register_prot_hook(sk); | 3262 | __register_prot_hook(sk); |
| 3256 | } | 3263 | } |
| 3257 | 3264 | ||
| 3258 | mutex_lock(&net->packet.sklist_lock); | 3265 | mutex_lock(&net->packet.sklist_lock); |
| @@ -3732,12 +3739,18 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
| 3732 | 3739 | ||
| 3733 | if (optlen != sizeof(val)) | 3740 | if (optlen != sizeof(val)) |
| 3734 | return -EINVAL; | 3741 | return -EINVAL; |
| 3735 | if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) | ||
| 3736 | return -EBUSY; | ||
| 3737 | if (copy_from_user(&val, optval, sizeof(val))) | 3742 | if (copy_from_user(&val, optval, sizeof(val))) |
| 3738 | return -EFAULT; | 3743 | return -EFAULT; |
| 3739 | po->tp_loss = !!val; | 3744 | |
| 3740 | return 0; | 3745 | lock_sock(sk); |
| 3746 | if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { | ||
| 3747 | ret = -EBUSY; | ||
| 3748 | } else { | ||
| 3749 | po->tp_loss = !!val; | ||
| 3750 | ret = 0; | ||
| 3751 | } | ||
| 3752 | release_sock(sk); | ||
| 3753 | return ret; | ||
| 3741 | } | 3754 | } |
| 3742 | case PACKET_AUXDATA: | 3755 | case PACKET_AUXDATA: |
| 3743 | { | 3756 | { |
| @@ -3748,7 +3761,9 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
| 3748 | if (copy_from_user(&val, optval, sizeof(val))) | 3761 | if (copy_from_user(&val, optval, sizeof(val))) |
| 3749 | return -EFAULT; | 3762 | return -EFAULT; |
| 3750 | 3763 | ||
| 3764 | lock_sock(sk); | ||
| 3751 | po->auxdata = !!val; | 3765 | po->auxdata = !!val; |
| 3766 | release_sock(sk); | ||
| 3752 | return 0; | 3767 | return 0; |
| 3753 | } | 3768 | } |
| 3754 | case PACKET_ORIGDEV: | 3769 | case PACKET_ORIGDEV: |
| @@ -3760,7 +3775,9 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
| 3760 | if (copy_from_user(&val, optval, sizeof(val))) | 3775 | if (copy_from_user(&val, optval, sizeof(val))) |
| 3761 | return -EFAULT; | 3776 | return -EFAULT; |
| 3762 | 3777 | ||
| 3778 | lock_sock(sk); | ||
| 3763 | po->origdev = !!val; | 3779 | po->origdev = !!val; |
| 3780 | release_sock(sk); | ||
| 3764 | return 0; | 3781 | return 0; |
| 3765 | } | 3782 | } |
| 3766 | case PACKET_VNET_HDR: | 3783 | case PACKET_VNET_HDR: |
| @@ -3769,15 +3786,20 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
| 3769 | 3786 | ||
| 3770 | if (sock->type != SOCK_RAW) | 3787 | if (sock->type != SOCK_RAW) |
| 3771 | return -EINVAL; | 3788 | return -EINVAL; |
| 3772 | if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) | ||
| 3773 | return -EBUSY; | ||
| 3774 | if (optlen < sizeof(val)) | 3789 | if (optlen < sizeof(val)) |
| 3775 | return -EINVAL; | 3790 | return -EINVAL; |
| 3776 | if (copy_from_user(&val, optval, sizeof(val))) | 3791 | if (copy_from_user(&val, optval, sizeof(val))) |
| 3777 | return -EFAULT; | 3792 | return -EFAULT; |
| 3778 | 3793 | ||
| 3779 | po->has_vnet_hdr = !!val; | 3794 | lock_sock(sk); |
| 3780 | return 0; | 3795 | if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { |
| 3796 | ret = -EBUSY; | ||
| 3797 | } else { | ||
| 3798 | po->has_vnet_hdr = !!val; | ||
| 3799 | ret = 0; | ||
| 3800 | } | ||
| 3801 | release_sock(sk); | ||
| 3802 | return ret; | ||
| 3781 | } | 3803 | } |
| 3782 | case PACKET_TIMESTAMP: | 3804 | case PACKET_TIMESTAMP: |
| 3783 | { | 3805 | { |
| @@ -3815,11 +3837,17 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
| 3815 | 3837 | ||
| 3816 | if (optlen != sizeof(val)) | 3838 | if (optlen != sizeof(val)) |
| 3817 | return -EINVAL; | 3839 | return -EINVAL; |
| 3818 | if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) | ||
| 3819 | return -EBUSY; | ||
| 3820 | if (copy_from_user(&val, optval, sizeof(val))) | 3840 | if (copy_from_user(&val, optval, sizeof(val))) |
| 3821 | return -EFAULT; | 3841 | return -EFAULT; |
| 3822 | po->tp_tx_has_off = !!val; | 3842 | |
| 3843 | lock_sock(sk); | ||
| 3844 | if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { | ||
| 3845 | ret = -EBUSY; | ||
| 3846 | } else { | ||
| 3847 | po->tp_tx_has_off = !!val; | ||
| 3848 | ret = 0; | ||
| 3849 | } | ||
| 3850 | release_sock(sk); | ||
| 3823 | return 0; | 3851 | return 0; |
| 3824 | } | 3852 | } |
| 3825 | case PACKET_QDISC_BYPASS: | 3853 | case PACKET_QDISC_BYPASS: |
diff --git a/net/packet/internal.h b/net/packet/internal.h index a1d2b2319ae9..3bb7c5fb3bff 100644 --- a/net/packet/internal.h +++ b/net/packet/internal.h | |||
| @@ -112,10 +112,12 @@ struct packet_sock { | |||
| 112 | int copy_thresh; | 112 | int copy_thresh; |
| 113 | spinlock_t bind_lock; | 113 | spinlock_t bind_lock; |
| 114 | struct mutex pg_vec_lock; | 114 | struct mutex pg_vec_lock; |
| 115 | unsigned int running:1, /* prot_hook is attached*/ | 115 | unsigned int running; /* bind_lock must be held */ |
| 116 | auxdata:1, | 116 | unsigned int auxdata:1, /* writer must hold sock lock */ |
| 117 | origdev:1, | 117 | origdev:1, |
| 118 | has_vnet_hdr:1; | 118 | has_vnet_hdr:1, |
| 119 | tp_loss:1, | ||
| 120 | tp_tx_has_off:1; | ||
| 119 | int pressure; | 121 | int pressure; |
| 120 | int ifindex; /* bound device */ | 122 | int ifindex; /* bound device */ |
| 121 | __be16 num; | 123 | __be16 num; |
| @@ -125,8 +127,6 @@ struct packet_sock { | |||
| 125 | enum tpacket_versions tp_version; | 127 | enum tpacket_versions tp_version; |
| 126 | unsigned int tp_hdrlen; | 128 | unsigned int tp_hdrlen; |
| 127 | unsigned int tp_reserve; | 129 | unsigned int tp_reserve; |
| 128 | unsigned int tp_loss:1; | ||
| 129 | unsigned int tp_tx_has_off:1; | ||
| 130 | unsigned int tp_tstamp; | 130 | unsigned int tp_tstamp; |
| 131 | struct net_device __rcu *cached_dev; | 131 | struct net_device __rcu *cached_dev; |
| 132 | int (*xmit)(struct sk_buff *skb); | 132 | int (*xmit)(struct sk_buff *skb); |
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index a5994cf0512b..8527cfdc446d 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c | |||
| @@ -652,7 +652,7 @@ static int find_decode_metaid(struct sk_buff *skb, struct tcf_ife_info *ife, | |||
| 652 | } | 652 | } |
| 653 | } | 653 | } |
| 654 | 654 | ||
| 655 | return 0; | 655 | return -ENOENT; |
| 656 | } | 656 | } |
| 657 | 657 | ||
| 658 | static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a, | 658 | static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a, |
| @@ -682,7 +682,12 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a, | |||
| 682 | u16 mtype; | 682 | u16 mtype; |
| 683 | u16 dlen; | 683 | u16 dlen; |
| 684 | 684 | ||
| 685 | curr_data = ife_tlv_meta_decode(tlv_data, &mtype, &dlen, NULL); | 685 | curr_data = ife_tlv_meta_decode(tlv_data, ifehdr_end, &mtype, |
| 686 | &dlen, NULL); | ||
| 687 | if (!curr_data) { | ||
| 688 | qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats)); | ||
| 689 | return TC_ACT_SHOT; | ||
| 690 | } | ||
| 686 | 691 | ||
| 687 | if (find_decode_metaid(skb, ife, mtype, dlen, curr_data)) { | 692 | if (find_decode_metaid(skb, ife, mtype, dlen, curr_data)) { |
| 688 | /* abuse overlimits to count when we receive metadata | 693 | /* abuse overlimits to count when we receive metadata |
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c index 805b139756db..092bebc70048 100644 --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c | |||
| @@ -67,7 +67,7 @@ static void strp_abort_strp(struct strparser *strp, int err) | |||
| 67 | 67 | ||
| 68 | static void strp_start_timer(struct strparser *strp, long timeo) | 68 | static void strp_start_timer(struct strparser *strp, long timeo) |
| 69 | { | 69 | { |
| 70 | if (timeo) | 70 | if (timeo && timeo != LONG_MAX) |
| 71 | mod_delayed_work(strp_wq, &strp->msg_timer_work, timeo); | 71 | mod_delayed_work(strp_wq, &strp->msg_timer_work, timeo); |
| 72 | } | 72 | } |
| 73 | 73 | ||
diff --git a/security/commoncap.c b/security/commoncap.c index 48620c93d697..1ce701fcb3f3 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
| @@ -449,6 +449,8 @@ int cap_inode_getsecurity(struct inode *inode, const char *name, void **buffer, | |||
| 449 | magic |= VFS_CAP_FLAGS_EFFECTIVE; | 449 | magic |= VFS_CAP_FLAGS_EFFECTIVE; |
| 450 | memcpy(&cap->data, &nscap->data, sizeof(__le32) * 2 * VFS_CAP_U32); | 450 | memcpy(&cap->data, &nscap->data, sizeof(__le32) * 2 * VFS_CAP_U32); |
| 451 | cap->magic_etc = cpu_to_le32(magic); | 451 | cap->magic_etc = cpu_to_le32(magic); |
| 452 | } else { | ||
| 453 | size = -ENOMEM; | ||
| 452 | } | 454 | } |
| 453 | } | 455 | } |
| 454 | kfree(tmpbuf); | 456 | kfree(tmpbuf); |
diff --git a/sound/core/control.c b/sound/core/control.c index 69734b0eafd0..9aa15bfc7936 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
| @@ -1492,7 +1492,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, | |||
| 1492 | int op_flag) | 1492 | int op_flag) |
| 1493 | { | 1493 | { |
| 1494 | struct snd_ctl_tlv header; | 1494 | struct snd_ctl_tlv header; |
| 1495 | unsigned int *container; | 1495 | unsigned int __user *container; |
| 1496 | unsigned int container_size; | 1496 | unsigned int container_size; |
| 1497 | struct snd_kcontrol *kctl; | 1497 | struct snd_kcontrol *kctl; |
| 1498 | struct snd_ctl_elem_id id; | 1498 | struct snd_ctl_elem_id id; |
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index b719d0bd833e..06d7c40af570 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c | |||
| @@ -27,10 +27,11 @@ static int snd_pcm_ioctl_delay_compat(struct snd_pcm_substream *substream, | |||
| 27 | s32 __user *src) | 27 | s32 __user *src) |
| 28 | { | 28 | { |
| 29 | snd_pcm_sframes_t delay; | 29 | snd_pcm_sframes_t delay; |
| 30 | int err; | ||
| 30 | 31 | ||
| 31 | delay = snd_pcm_delay(substream); | 32 | err = snd_pcm_delay(substream, &delay); |
| 32 | if (delay < 0) | 33 | if (err) |
| 33 | return delay; | 34 | return err; |
| 34 | if (put_user(delay, src)) | 35 | if (put_user(delay, src)) |
| 35 | return -EFAULT; | 36 | return -EFAULT; |
| 36 | return 0; | 37 | return 0; |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 35ffccea94c3..0e875d5a9e86 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
| @@ -2692,7 +2692,8 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream) | |||
| 2692 | return err; | 2692 | return err; |
| 2693 | } | 2693 | } |
| 2694 | 2694 | ||
| 2695 | static snd_pcm_sframes_t snd_pcm_delay(struct snd_pcm_substream *substream) | 2695 | static int snd_pcm_delay(struct snd_pcm_substream *substream, |
| 2696 | snd_pcm_sframes_t *delay) | ||
| 2696 | { | 2697 | { |
| 2697 | struct snd_pcm_runtime *runtime = substream->runtime; | 2698 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 2698 | int err; | 2699 | int err; |
| @@ -2708,7 +2709,9 @@ static snd_pcm_sframes_t snd_pcm_delay(struct snd_pcm_substream *substream) | |||
| 2708 | n += runtime->delay; | 2709 | n += runtime->delay; |
| 2709 | } | 2710 | } |
| 2710 | snd_pcm_stream_unlock_irq(substream); | 2711 | snd_pcm_stream_unlock_irq(substream); |
| 2711 | return err < 0 ? err : n; | 2712 | if (!err) |
| 2713 | *delay = n; | ||
| 2714 | return err; | ||
| 2712 | } | 2715 | } |
| 2713 | 2716 | ||
| 2714 | static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, | 2717 | static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, |
| @@ -2751,6 +2754,7 @@ static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, | |||
| 2751 | sync_ptr.s.status.hw_ptr = status->hw_ptr; | 2754 | sync_ptr.s.status.hw_ptr = status->hw_ptr; |
| 2752 | sync_ptr.s.status.tstamp = status->tstamp; | 2755 | sync_ptr.s.status.tstamp = status->tstamp; |
| 2753 | sync_ptr.s.status.suspended_state = status->suspended_state; | 2756 | sync_ptr.s.status.suspended_state = status->suspended_state; |
| 2757 | sync_ptr.s.status.audio_tstamp = status->audio_tstamp; | ||
| 2754 | snd_pcm_stream_unlock_irq(substream); | 2758 | snd_pcm_stream_unlock_irq(substream); |
| 2755 | if (copy_to_user(_sync_ptr, &sync_ptr, sizeof(sync_ptr))) | 2759 | if (copy_to_user(_sync_ptr, &sync_ptr, sizeof(sync_ptr))) |
| 2756 | return -EFAULT; | 2760 | return -EFAULT; |
| @@ -2916,11 +2920,13 @@ static int snd_pcm_common_ioctl(struct file *file, | |||
| 2916 | return snd_pcm_hwsync(substream); | 2920 | return snd_pcm_hwsync(substream); |
| 2917 | case SNDRV_PCM_IOCTL_DELAY: | 2921 | case SNDRV_PCM_IOCTL_DELAY: |
| 2918 | { | 2922 | { |
| 2919 | snd_pcm_sframes_t delay = snd_pcm_delay(substream); | 2923 | snd_pcm_sframes_t delay; |
| 2920 | snd_pcm_sframes_t __user *res = arg; | 2924 | snd_pcm_sframes_t __user *res = arg; |
| 2925 | int err; | ||
| 2921 | 2926 | ||
| 2922 | if (delay < 0) | 2927 | err = snd_pcm_delay(substream, &delay); |
| 2923 | return delay; | 2928 | if (err) |
| 2929 | return err; | ||
| 2924 | if (put_user(delay, res)) | 2930 | if (put_user(delay, res)) |
| 2925 | return -EFAULT; | 2931 | return -EFAULT; |
| 2926 | return 0; | 2932 | return 0; |
| @@ -3008,13 +3014,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, | |||
| 3008 | case SNDRV_PCM_IOCTL_DROP: | 3014 | case SNDRV_PCM_IOCTL_DROP: |
| 3009 | return snd_pcm_drop(substream); | 3015 | return snd_pcm_drop(substream); |
| 3010 | case SNDRV_PCM_IOCTL_DELAY: | 3016 | case SNDRV_PCM_IOCTL_DELAY: |
| 3011 | { | 3017 | return snd_pcm_delay(substream, frames); |
| 3012 | result = snd_pcm_delay(substream); | ||
| 3013 | if (result < 0) | ||
| 3014 | return result; | ||
| 3015 | *frames = result; | ||
| 3016 | return 0; | ||
| 3017 | } | ||
| 3018 | default: | 3018 | default: |
| 3019 | return -EINVAL; | 3019 | return -EINVAL; |
| 3020 | } | 3020 | } |
| @@ -3234,7 +3234,7 @@ static __poll_t snd_pcm_capture_poll(struct file *file, poll_table * wait) | |||
| 3234 | /* | 3234 | /* |
| 3235 | * mmap status record | 3235 | * mmap status record |
| 3236 | */ | 3236 | */ |
| 3237 | static int snd_pcm_mmap_status_fault(struct vm_fault *vmf) | 3237 | static vm_fault_t snd_pcm_mmap_status_fault(struct vm_fault *vmf) |
| 3238 | { | 3238 | { |
| 3239 | struct snd_pcm_substream *substream = vmf->vma->vm_private_data; | 3239 | struct snd_pcm_substream *substream = vmf->vma->vm_private_data; |
| 3240 | struct snd_pcm_runtime *runtime; | 3240 | struct snd_pcm_runtime *runtime; |
| @@ -3270,7 +3270,7 @@ static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file | |||
| 3270 | /* | 3270 | /* |
| 3271 | * mmap control record | 3271 | * mmap control record |
| 3272 | */ | 3272 | */ |
| 3273 | static int snd_pcm_mmap_control_fault(struct vm_fault *vmf) | 3273 | static vm_fault_t snd_pcm_mmap_control_fault(struct vm_fault *vmf) |
| 3274 | { | 3274 | { |
| 3275 | struct snd_pcm_substream *substream = vmf->vma->vm_private_data; | 3275 | struct snd_pcm_substream *substream = vmf->vma->vm_private_data; |
| 3276 | struct snd_pcm_runtime *runtime; | 3276 | struct snd_pcm_runtime *runtime; |
| @@ -3359,7 +3359,7 @@ snd_pcm_default_page_ops(struct snd_pcm_substream *substream, unsigned long ofs) | |||
| 3359 | /* | 3359 | /* |
| 3360 | * fault callback for mmapping a RAM page | 3360 | * fault callback for mmapping a RAM page |
| 3361 | */ | 3361 | */ |
| 3362 | static int snd_pcm_mmap_data_fault(struct vm_fault *vmf) | 3362 | static vm_fault_t snd_pcm_mmap_data_fault(struct vm_fault *vmf) |
| 3363 | { | 3363 | { |
| 3364 | struct snd_pcm_substream *substream = vmf->vma->vm_private_data; | 3364 | struct snd_pcm_substream *substream = vmf->vma->vm_private_data; |
| 3365 | struct snd_pcm_runtime *runtime; | 3365 | struct snd_pcm_runtime *runtime; |
diff --git a/sound/core/seq/oss/seq_oss_event.c b/sound/core/seq/oss/seq_oss_event.c index c3908862bc8b..86ca584c27b2 100644 --- a/sound/core/seq/oss/seq_oss_event.c +++ b/sound/core/seq/oss/seq_oss_event.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <sound/seq_oss_legacy.h> | 26 | #include <sound/seq_oss_legacy.h> |
| 27 | #include "seq_oss_readq.h" | 27 | #include "seq_oss_readq.h" |
| 28 | #include "seq_oss_writeq.h" | 28 | #include "seq_oss_writeq.h" |
| 29 | #include <linux/nospec.h> | ||
| 29 | 30 | ||
| 30 | 31 | ||
| 31 | /* | 32 | /* |
| @@ -287,10 +288,10 @@ note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, st | |||
| 287 | { | 288 | { |
| 288 | struct seq_oss_synthinfo *info; | 289 | struct seq_oss_synthinfo *info; |
| 289 | 290 | ||
| 290 | if (!snd_seq_oss_synth_is_valid(dp, dev)) | 291 | info = snd_seq_oss_synth_info(dp, dev); |
| 292 | if (!info) | ||
| 291 | return -ENXIO; | 293 | return -ENXIO; |
| 292 | 294 | ||
| 293 | info = &dp->synths[dev]; | ||
| 294 | switch (info->arg.event_passing) { | 295 | switch (info->arg.event_passing) { |
| 295 | case SNDRV_SEQ_OSS_PROCESS_EVENTS: | 296 | case SNDRV_SEQ_OSS_PROCESS_EVENTS: |
| 296 | if (! info->ch || ch < 0 || ch >= info->nr_voices) { | 297 | if (! info->ch || ch < 0 || ch >= info->nr_voices) { |
| @@ -298,6 +299,7 @@ note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, st | |||
| 298 | return set_note_event(dp, dev, SNDRV_SEQ_EVENT_NOTEON, ch, note, vel, ev); | 299 | return set_note_event(dp, dev, SNDRV_SEQ_EVENT_NOTEON, ch, note, vel, ev); |
| 299 | } | 300 | } |
| 300 | 301 | ||
| 302 | ch = array_index_nospec(ch, info->nr_voices); | ||
| 301 | if (note == 255 && info->ch[ch].note >= 0) { | 303 | if (note == 255 && info->ch[ch].note >= 0) { |
| 302 | /* volume control */ | 304 | /* volume control */ |
| 303 | int type; | 305 | int type; |
| @@ -347,10 +349,10 @@ note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, s | |||
| 347 | { | 349 | { |
| 348 | struct seq_oss_synthinfo *info; | 350 | struct seq_oss_synthinfo *info; |
| 349 | 351 | ||
| 350 | if (!snd_seq_oss_synth_is_valid(dp, dev)) | 352 | info = snd_seq_oss_synth_info(dp, dev); |
| 353 | if (!info) | ||
| 351 | return -ENXIO; | 354 | return -ENXIO; |
| 352 | 355 | ||
| 353 | info = &dp->synths[dev]; | ||
| 354 | switch (info->arg.event_passing) { | 356 | switch (info->arg.event_passing) { |
| 355 | case SNDRV_SEQ_OSS_PROCESS_EVENTS: | 357 | case SNDRV_SEQ_OSS_PROCESS_EVENTS: |
| 356 | if (! info->ch || ch < 0 || ch >= info->nr_voices) { | 358 | if (! info->ch || ch < 0 || ch >= info->nr_voices) { |
| @@ -358,6 +360,7 @@ note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, s | |||
| 358 | return set_note_event(dp, dev, SNDRV_SEQ_EVENT_NOTEON, ch, note, vel, ev); | 360 | return set_note_event(dp, dev, SNDRV_SEQ_EVENT_NOTEON, ch, note, vel, ev); |
| 359 | } | 361 | } |
| 360 | 362 | ||
| 363 | ch = array_index_nospec(ch, info->nr_voices); | ||
| 361 | if (info->ch[ch].note >= 0) { | 364 | if (info->ch[ch].note >= 0) { |
| 362 | note = info->ch[ch].note; | 365 | note = info->ch[ch].note; |
| 363 | info->ch[ch].vel = 0; | 366 | info->ch[ch].vel = 0; |
| @@ -381,7 +384,7 @@ note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, s | |||
| 381 | static int | 384 | static int |
| 382 | set_note_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int note, int vel, struct snd_seq_event *ev) | 385 | set_note_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int note, int vel, struct snd_seq_event *ev) |
| 383 | { | 386 | { |
| 384 | if (! snd_seq_oss_synth_is_valid(dp, dev)) | 387 | if (!snd_seq_oss_synth_info(dp, dev)) |
| 385 | return -ENXIO; | 388 | return -ENXIO; |
| 386 | 389 | ||
| 387 | ev->type = type; | 390 | ev->type = type; |
| @@ -399,7 +402,7 @@ set_note_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int note, | |||
| 399 | static int | 402 | static int |
| 400 | set_control_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int param, int val, struct snd_seq_event *ev) | 403 | set_control_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int param, int val, struct snd_seq_event *ev) |
| 401 | { | 404 | { |
| 402 | if (! snd_seq_oss_synth_is_valid(dp, dev)) | 405 | if (!snd_seq_oss_synth_info(dp, dev)) |
| 403 | return -ENXIO; | 406 | return -ENXIO; |
| 404 | 407 | ||
| 405 | ev->type = type; | 408 | ev->type = type; |
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c index b30b2139e3f0..9debd1b8fd28 100644 --- a/sound/core/seq/oss/seq_oss_midi.c +++ b/sound/core/seq/oss/seq_oss_midi.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include "../seq_lock.h" | 29 | #include "../seq_lock.h" |
| 30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
| 31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
| 32 | #include <linux/nospec.h> | ||
| 32 | 33 | ||
| 33 | 34 | ||
| 34 | /* | 35 | /* |
| @@ -315,6 +316,7 @@ get_mididev(struct seq_oss_devinfo *dp, int dev) | |||
| 315 | { | 316 | { |
| 316 | if (dev < 0 || dev >= dp->max_mididev) | 317 | if (dev < 0 || dev >= dp->max_mididev) |
| 317 | return NULL; | 318 | return NULL; |
| 319 | dev = array_index_nospec(dev, dp->max_mididev); | ||
| 318 | return get_mdev(dev); | 320 | return get_mdev(dev); |
| 319 | } | 321 | } |
| 320 | 322 | ||
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index cd0e0ebbfdb1..278ebb993122 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 29 | #include <linux/nospec.h> | ||
| 29 | 30 | ||
| 30 | /* | 31 | /* |
| 31 | * constants | 32 | * constants |
| @@ -339,17 +340,13 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp) | |||
| 339 | dp->max_synthdev = 0; | 340 | dp->max_synthdev = 0; |
| 340 | } | 341 | } |
| 341 | 342 | ||
| 342 | /* | 343 | static struct seq_oss_synthinfo * |
| 343 | * check if the specified device is MIDI mapped device | 344 | get_synthinfo_nospec(struct seq_oss_devinfo *dp, int dev) |
| 344 | */ | ||
| 345 | static int | ||
| 346 | is_midi_dev(struct seq_oss_devinfo *dp, int dev) | ||
| 347 | { | 345 | { |
| 348 | if (dev < 0 || dev >= dp->max_synthdev) | 346 | if (dev < 0 || dev >= dp->max_synthdev) |
| 349 | return 0; | 347 | return NULL; |
| 350 | if (dp->synths[dev].is_midi) | 348 | dev = array_index_nospec(dev, SNDRV_SEQ_OSS_MAX_SYNTH_DEVS); |
| 351 | return 1; | 349 | return &dp->synths[dev]; |
| 352 | return 0; | ||
| 353 | } | 350 | } |
| 354 | 351 | ||
| 355 | /* | 352 | /* |
| @@ -359,14 +356,20 @@ static struct seq_oss_synth * | |||
| 359 | get_synthdev(struct seq_oss_devinfo *dp, int dev) | 356 | get_synthdev(struct seq_oss_devinfo *dp, int dev) |
| 360 | { | 357 | { |
| 361 | struct seq_oss_synth *rec; | 358 | struct seq_oss_synth *rec; |
| 362 | if (dev < 0 || dev >= dp->max_synthdev) | 359 | struct seq_oss_synthinfo *info = get_synthinfo_nospec(dp, dev); |
| 363 | return NULL; | 360 | |
| 364 | if (! dp->synths[dev].opened) | 361 | if (!info) |
| 365 | return NULL; | 362 | return NULL; |
| 366 | if (dp->synths[dev].is_midi) | 363 | if (!info->opened) |
| 367 | return &midi_synth_dev; | ||
| 368 | if ((rec = get_sdev(dev)) == NULL) | ||
| 369 | return NULL; | 364 | return NULL; |
| 365 | if (info->is_midi) { | ||
| 366 | rec = &midi_synth_dev; | ||
| 367 | snd_use_lock_use(&rec->use_lock); | ||
| 368 | } else { | ||
| 369 | rec = get_sdev(dev); | ||
| 370 | if (!rec) | ||
| 371 | return NULL; | ||
| 372 | } | ||
| 370 | if (! rec->opened) { | 373 | if (! rec->opened) { |
| 371 | snd_use_lock_free(&rec->use_lock); | 374 | snd_use_lock_free(&rec->use_lock); |
| 372 | return NULL; | 375 | return NULL; |
| @@ -402,10 +405,8 @@ snd_seq_oss_synth_reset(struct seq_oss_devinfo *dp, int dev) | |||
| 402 | struct seq_oss_synth *rec; | 405 | struct seq_oss_synth *rec; |
| 403 | struct seq_oss_synthinfo *info; | 406 | struct seq_oss_synthinfo *info; |
| 404 | 407 | ||
| 405 | if (snd_BUG_ON(dev < 0 || dev >= dp->max_synthdev)) | 408 | info = get_synthinfo_nospec(dp, dev); |
| 406 | return; | 409 | if (!info || !info->opened) |
| 407 | info = &dp->synths[dev]; | ||
| 408 | if (! info->opened) | ||
| 409 | return; | 410 | return; |
| 410 | if (info->sysex) | 411 | if (info->sysex) |
| 411 | info->sysex->len = 0; /* reset sysex */ | 412 | info->sysex->len = 0; /* reset sysex */ |
| @@ -454,12 +455,14 @@ snd_seq_oss_synth_load_patch(struct seq_oss_devinfo *dp, int dev, int fmt, | |||
| 454 | const char __user *buf, int p, int c) | 455 | const char __user *buf, int p, int c) |
| 455 | { | 456 | { |
| 456 | struct seq_oss_synth *rec; | 457 | struct seq_oss_synth *rec; |
| 458 | struct seq_oss_synthinfo *info; | ||
| 457 | int rc; | 459 | int rc; |
| 458 | 460 | ||
| 459 | if (dev < 0 || dev >= dp->max_synthdev) | 461 | info = get_synthinfo_nospec(dp, dev); |
| 462 | if (!info) | ||
| 460 | return -ENXIO; | 463 | return -ENXIO; |
| 461 | 464 | ||
| 462 | if (is_midi_dev(dp, dev)) | 465 | if (info->is_midi) |
| 463 | return 0; | 466 | return 0; |
| 464 | if ((rec = get_synthdev(dp, dev)) == NULL) | 467 | if ((rec = get_synthdev(dp, dev)) == NULL) |
| 465 | return -ENXIO; | 468 | return -ENXIO; |
| @@ -467,24 +470,25 @@ snd_seq_oss_synth_load_patch(struct seq_oss_devinfo *dp, int dev, int fmt, | |||
| 467 | if (rec->oper.load_patch == NULL) | 470 | if (rec->oper.load_patch == NULL) |
| 468 | rc = -ENXIO; | 471 | rc = -ENXIO; |
| 469 | else | 472 | else |
| 470 | rc = rec->oper.load_patch(&dp->synths[dev].arg, fmt, buf, p, c); | 473 | rc = rec->oper.load_patch(&info->arg, fmt, buf, p, c); |
| 471 | snd_use_lock_free(&rec->use_lock); | 474 | snd_use_lock_free(&rec->use_lock); |
| 472 | return rc; | 475 | return rc; |
| 473 | } | 476 | } |
| 474 | 477 | ||
| 475 | /* | 478 | /* |
| 476 | * check if the device is valid synth device | 479 | * check if the device is valid synth device and return the synth info |
| 477 | */ | 480 | */ |
| 478 | int | 481 | struct seq_oss_synthinfo * |
| 479 | snd_seq_oss_synth_is_valid(struct seq_oss_devinfo *dp, int dev) | 482 | snd_seq_oss_synth_info(struct seq_oss_devinfo *dp, int dev) |
| 480 | { | 483 | { |
| 481 | struct seq_oss_synth *rec; | 484 | struct seq_oss_synth *rec; |
| 485 | |||
| 482 | rec = get_synthdev(dp, dev); | 486 | rec = get_synthdev(dp, dev); |
| 483 | if (rec) { | 487 | if (rec) { |
| 484 | snd_use_lock_free(&rec->use_lock); | 488 | snd_use_lock_free(&rec->use_lock); |
| 485 | return 1; | 489 | return get_synthinfo_nospec(dp, dev); |
| 486 | } | 490 | } |
| 487 | return 0; | 491 | return NULL; |
| 488 | } | 492 | } |
| 489 | 493 | ||
| 490 | 494 | ||
| @@ -499,16 +503,18 @@ snd_seq_oss_synth_sysex(struct seq_oss_devinfo *dp, int dev, unsigned char *buf, | |||
| 499 | int i, send; | 503 | int i, send; |
| 500 | unsigned char *dest; | 504 | unsigned char *dest; |
| 501 | struct seq_oss_synth_sysex *sysex; | 505 | struct seq_oss_synth_sysex *sysex; |
| 506 | struct seq_oss_synthinfo *info; | ||
| 502 | 507 | ||
| 503 | if (! snd_seq_oss_synth_is_valid(dp, dev)) | 508 | info = snd_seq_oss_synth_info(dp, dev); |
| 509 | if (!info) | ||
| 504 | return -ENXIO; | 510 | return -ENXIO; |
| 505 | 511 | ||
| 506 | sysex = dp->synths[dev].sysex; | 512 | sysex = info->sysex; |
| 507 | if (sysex == NULL) { | 513 | if (sysex == NULL) { |
| 508 | sysex = kzalloc(sizeof(*sysex), GFP_KERNEL); | 514 | sysex = kzalloc(sizeof(*sysex), GFP_KERNEL); |
| 509 | if (sysex == NULL) | 515 | if (sysex == NULL) |
| 510 | return -ENOMEM; | 516 | return -ENOMEM; |
| 511 | dp->synths[dev].sysex = sysex; | 517 | info->sysex = sysex; |
| 512 | } | 518 | } |
| 513 | 519 | ||
| 514 | send = 0; | 520 | send = 0; |
| @@ -553,10 +559,12 @@ snd_seq_oss_synth_sysex(struct seq_oss_devinfo *dp, int dev, unsigned char *buf, | |||
| 553 | int | 559 | int |
| 554 | snd_seq_oss_synth_addr(struct seq_oss_devinfo *dp, int dev, struct snd_seq_event *ev) | 560 | snd_seq_oss_synth_addr(struct seq_oss_devinfo *dp, int dev, struct snd_seq_event *ev) |
| 555 | { | 561 | { |
| 556 | if (! snd_seq_oss_synth_is_valid(dp, dev)) | 562 | struct seq_oss_synthinfo *info = snd_seq_oss_synth_info(dp, dev); |
| 563 | |||
| 564 | if (!info) | ||
| 557 | return -EINVAL; | 565 | return -EINVAL; |
| 558 | snd_seq_oss_fill_addr(dp, ev, dp->synths[dev].arg.addr.client, | 566 | snd_seq_oss_fill_addr(dp, ev, info->arg.addr.client, |
| 559 | dp->synths[dev].arg.addr.port); | 567 | info->arg.addr.port); |
| 560 | return 0; | 568 | return 0; |
| 561 | } | 569 | } |
| 562 | 570 | ||
| @@ -568,16 +576,18 @@ int | |||
| 568 | snd_seq_oss_synth_ioctl(struct seq_oss_devinfo *dp, int dev, unsigned int cmd, unsigned long addr) | 576 | snd_seq_oss_synth_ioctl(struct seq_oss_devinfo *dp, int dev, unsigned int cmd, unsigned long addr) |
| 569 | { | 577 | { |
| 570 | struct seq_oss_synth *rec; | 578 | struct seq_oss_synth *rec; |
| 579 | struct seq_oss_synthinfo *info; | ||
| 571 | int rc; | 580 | int rc; |
| 572 | 581 | ||
| 573 | if (is_midi_dev(dp, dev)) | 582 | info = get_synthinfo_nospec(dp, dev); |
| 583 | if (!info || info->is_midi) | ||
| 574 | return -ENXIO; | 584 | return -ENXIO; |
| 575 | if ((rec = get_synthdev(dp, dev)) == NULL) | 585 | if ((rec = get_synthdev(dp, dev)) == NULL) |
| 576 | return -ENXIO; | 586 | return -ENXIO; |
| 577 | if (rec->oper.ioctl == NULL) | 587 | if (rec->oper.ioctl == NULL) |
| 578 | rc = -ENXIO; | 588 | rc = -ENXIO; |
| 579 | else | 589 | else |
| 580 | rc = rec->oper.ioctl(&dp->synths[dev].arg, cmd, addr); | 590 | rc = rec->oper.ioctl(&info->arg, cmd, addr); |
| 581 | snd_use_lock_free(&rec->use_lock); | 591 | snd_use_lock_free(&rec->use_lock); |
| 582 | return rc; | 592 | return rc; |
| 583 | } | 593 | } |
| @@ -589,7 +599,10 @@ snd_seq_oss_synth_ioctl(struct seq_oss_devinfo *dp, int dev, unsigned int cmd, u | |||
| 589 | int | 599 | int |
| 590 | snd_seq_oss_synth_raw_event(struct seq_oss_devinfo *dp, int dev, unsigned char *data, struct snd_seq_event *ev) | 600 | snd_seq_oss_synth_raw_event(struct seq_oss_devinfo *dp, int dev, unsigned char *data, struct snd_seq_event *ev) |
| 591 | { | 601 | { |
| 592 | if (! snd_seq_oss_synth_is_valid(dp, dev) || is_midi_dev(dp, dev)) | 602 | struct seq_oss_synthinfo *info; |
| 603 | |||
| 604 | info = snd_seq_oss_synth_info(dp, dev); | ||
| 605 | if (!info || info->is_midi) | ||
| 593 | return -ENXIO; | 606 | return -ENXIO; |
| 594 | ev->type = SNDRV_SEQ_EVENT_OSS; | 607 | ev->type = SNDRV_SEQ_EVENT_OSS; |
| 595 | memcpy(ev->data.raw8.d, data, 8); | 608 | memcpy(ev->data.raw8.d, data, 8); |
diff --git a/sound/core/seq/oss/seq_oss_synth.h b/sound/core/seq/oss/seq_oss_synth.h index 74ac55f166b6..a63f9e22974d 100644 --- a/sound/core/seq/oss/seq_oss_synth.h +++ b/sound/core/seq/oss/seq_oss_synth.h | |||
| @@ -37,7 +37,8 @@ void snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp); | |||
| 37 | void snd_seq_oss_synth_reset(struct seq_oss_devinfo *dp, int dev); | 37 | void snd_seq_oss_synth_reset(struct seq_oss_devinfo *dp, int dev); |
| 38 | int snd_seq_oss_synth_load_patch(struct seq_oss_devinfo *dp, int dev, int fmt, | 38 | int snd_seq_oss_synth_load_patch(struct seq_oss_devinfo *dp, int dev, int fmt, |
| 39 | const char __user *buf, int p, int c); | 39 | const char __user *buf, int p, int c); |
| 40 | int snd_seq_oss_synth_is_valid(struct seq_oss_devinfo *dp, int dev); | 40 | struct seq_oss_synthinfo *snd_seq_oss_synth_info(struct seq_oss_devinfo *dp, |
| 41 | int dev); | ||
| 41 | int snd_seq_oss_synth_sysex(struct seq_oss_devinfo *dp, int dev, unsigned char *buf, | 42 | int snd_seq_oss_synth_sysex(struct seq_oss_devinfo *dp, int dev, unsigned char *buf, |
| 42 | struct snd_seq_event *ev); | 43 | struct snd_seq_event *ev); |
| 43 | int snd_seq_oss_synth_addr(struct seq_oss_devinfo *dp, int dev, struct snd_seq_event *ev); | 44 | int snd_seq_oss_synth_addr(struct seq_oss_devinfo *dp, int dev, struct snd_seq_event *ev); |
diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index ddcc1a325a61..42920a243328 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synth.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/export.h> | 23 | #include <linux/export.h> |
| 24 | #include <linux/nospec.h> | ||
| 24 | #include <sound/opl3.h> | 25 | #include <sound/opl3.h> |
| 25 | #include <sound/asound_fm.h> | 26 | #include <sound/asound_fm.h> |
| 26 | 27 | ||
| @@ -448,7 +449,7 @@ static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * v | |||
| 448 | { | 449 | { |
| 449 | unsigned short reg_side; | 450 | unsigned short reg_side; |
| 450 | unsigned char op_offset; | 451 | unsigned char op_offset; |
| 451 | unsigned char voice_offset; | 452 | unsigned char voice_offset, voice_op; |
| 452 | 453 | ||
| 453 | unsigned short opl3_reg; | 454 | unsigned short opl3_reg; |
| 454 | unsigned char reg_val; | 455 | unsigned char reg_val; |
| @@ -473,7 +474,9 @@ static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * v | |||
| 473 | voice_offset = voice->voice - MAX_OPL2_VOICES; | 474 | voice_offset = voice->voice - MAX_OPL2_VOICES; |
| 474 | } | 475 | } |
| 475 | /* Get register offset of operator */ | 476 | /* Get register offset of operator */ |
| 476 | op_offset = snd_opl3_regmap[voice_offset][voice->op]; | 477 | voice_offset = array_index_nospec(voice_offset, MAX_OPL2_VOICES); |
| 478 | voice_op = array_index_nospec(voice->op, 4); | ||
| 479 | op_offset = snd_opl3_regmap[voice_offset][voice_op]; | ||
| 477 | 480 | ||
| 478 | reg_val = 0x00; | 481 | reg_val = 0x00; |
| 479 | /* Set amplitude modulation (tremolo) effect */ | 482 | /* Set amplitude modulation (tremolo) effect */ |
diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c index 8573289c381e..928a255bfc35 100644 --- a/sound/firewire/dice/dice-stream.c +++ b/sound/firewire/dice/dice-stream.c | |||
| @@ -435,7 +435,7 @@ int snd_dice_stream_init_duplex(struct snd_dice *dice) | |||
| 435 | err = init_stream(dice, AMDTP_IN_STREAM, i); | 435 | err = init_stream(dice, AMDTP_IN_STREAM, i); |
| 436 | if (err < 0) { | 436 | if (err < 0) { |
| 437 | for (; i >= 0; i--) | 437 | for (; i >= 0; i--) |
| 438 | destroy_stream(dice, AMDTP_OUT_STREAM, i); | 438 | destroy_stream(dice, AMDTP_IN_STREAM, i); |
| 439 | goto end; | 439 | goto end; |
| 440 | } | 440 | } |
| 441 | } | 441 | } |
diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c index 4ddb4cdd054b..96bb01b6b751 100644 --- a/sound/firewire/dice/dice.c +++ b/sound/firewire/dice/dice.c | |||
| @@ -14,7 +14,7 @@ MODULE_LICENSE("GPL v2"); | |||
| 14 | #define OUI_WEISS 0x001c6a | 14 | #define OUI_WEISS 0x001c6a |
| 15 | #define OUI_LOUD 0x000ff2 | 15 | #define OUI_LOUD 0x000ff2 |
| 16 | #define OUI_FOCUSRITE 0x00130e | 16 | #define OUI_FOCUSRITE 0x00130e |
| 17 | #define OUI_TCELECTRONIC 0x001486 | 17 | #define OUI_TCELECTRONIC 0x000166 |
| 18 | 18 | ||
| 19 | #define DICE_CATEGORY_ID 0x04 | 19 | #define DICE_CATEGORY_ID 0x04 |
| 20 | #define WEISS_CATEGORY_ID 0x00 | 20 | #define WEISS_CATEGORY_ID 0x00 |
diff --git a/sound/pci/asihpi/hpimsginit.c b/sound/pci/asihpi/hpimsginit.c index 7eb617175fde..a31a70dccecf 100644 --- a/sound/pci/asihpi/hpimsginit.c +++ b/sound/pci/asihpi/hpimsginit.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include "hpi_internal.h" | 24 | #include "hpi_internal.h" |
| 25 | #include "hpimsginit.h" | 25 | #include "hpimsginit.h" |
| 26 | #include <linux/nospec.h> | ||
| 26 | 27 | ||
| 27 | /* The actual message size for each object type */ | 28 | /* The actual message size for each object type */ |
| 28 | static u16 msg_size[HPI_OBJ_MAXINDEX + 1] = HPI_MESSAGE_SIZE_BY_OBJECT; | 29 | static u16 msg_size[HPI_OBJ_MAXINDEX + 1] = HPI_MESSAGE_SIZE_BY_OBJECT; |
| @@ -39,10 +40,12 @@ static void hpi_init_message(struct hpi_message *phm, u16 object, | |||
| 39 | { | 40 | { |
| 40 | u16 size; | 41 | u16 size; |
| 41 | 42 | ||
| 42 | if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) | 43 | if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) { |
| 44 | object = array_index_nospec(object, HPI_OBJ_MAXINDEX + 1); | ||
| 43 | size = msg_size[object]; | 45 | size = msg_size[object]; |
| 44 | else | 46 | } else { |
| 45 | size = sizeof(*phm); | 47 | size = sizeof(*phm); |
| 48 | } | ||
| 46 | 49 | ||
| 47 | memset(phm, 0, size); | 50 | memset(phm, 0, size); |
| 48 | phm->size = size; | 51 | phm->size = size; |
| @@ -66,10 +69,12 @@ void hpi_init_response(struct hpi_response *phr, u16 object, u16 function, | |||
| 66 | { | 69 | { |
| 67 | u16 size; | 70 | u16 size; |
| 68 | 71 | ||
| 69 | if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) | 72 | if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) { |
| 73 | object = array_index_nospec(object, HPI_OBJ_MAXINDEX + 1); | ||
| 70 | size = res_size[object]; | 74 | size = res_size[object]; |
| 71 | else | 75 | } else { |
| 72 | size = sizeof(*phr); | 76 | size = sizeof(*phr); |
| 77 | } | ||
| 73 | 78 | ||
| 74 | memset(phr, 0, sizeof(*phr)); | 79 | memset(phr, 0, sizeof(*phr)); |
| 75 | phr->size = size; | 80 | phr->size = size; |
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 5badd08e1d69..b1a2a7ea4172 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/stringify.h> | 33 | #include <linux/stringify.h> |
| 34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
| 35 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
| 36 | #include <linux/nospec.h> | ||
| 36 | 37 | ||
| 37 | #ifdef MODULE_FIRMWARE | 38 | #ifdef MODULE_FIRMWARE |
| 38 | MODULE_FIRMWARE("asihpi/dsp5000.bin"); | 39 | MODULE_FIRMWARE("asihpi/dsp5000.bin"); |
| @@ -186,7 +187,8 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 186 | struct hpi_adapter *pa = NULL; | 187 | struct hpi_adapter *pa = NULL; |
| 187 | 188 | ||
| 188 | if (hm->h.adapter_index < ARRAY_SIZE(adapters)) | 189 | if (hm->h.adapter_index < ARRAY_SIZE(adapters)) |
| 189 | pa = &adapters[hm->h.adapter_index]; | 190 | pa = &adapters[array_index_nospec(hm->h.adapter_index, |
| 191 | ARRAY_SIZE(adapters))]; | ||
| 190 | 192 | ||
| 191 | if (!pa || !pa->adapter || !pa->adapter->type) { | 193 | if (!pa || !pa->adapter || !pa->adapter->type) { |
| 192 | hpi_init_response(&hr->r0, hm->h.object, | 194 | hpi_init_response(&hr->r0, hm->h.object, |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 57df06e76968..cc009a4a3d1d 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
| 24 | #include <linux/nospec.h> | ||
| 24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
| 25 | #include "hda_codec.h" | 26 | #include "hda_codec.h" |
| 26 | #include "hda_local.h" | 27 | #include "hda_local.h" |
| @@ -51,7 +52,16 @@ static int get_wcap_ioctl(struct hda_codec *codec, | |||
| 51 | 52 | ||
| 52 | if (get_user(verb, &arg->verb)) | 53 | if (get_user(verb, &arg->verb)) |
| 53 | return -EFAULT; | 54 | return -EFAULT; |
| 54 | res = get_wcaps(codec, verb >> 24); | 55 | /* open-code get_wcaps(verb>>24) with nospec */ |
| 56 | verb >>= 24; | ||
| 57 | if (verb < codec->core.start_nid || | ||
| 58 | verb >= codec->core.start_nid + codec->core.num_nodes) { | ||
| 59 | res = 0; | ||
| 60 | } else { | ||
| 61 | verb -= codec->core.start_nid; | ||
| 62 | verb = array_index_nospec(verb, codec->core.num_nodes); | ||
| 63 | res = codec->wcaps[verb]; | ||
| 64 | } | ||
| 55 | if (put_user(res, &arg->res)) | 65 | if (put_user(res, &arg->res)) |
| 56 | return -EFAULT; | 66 | return -EFAULT; |
| 57 | return 0; | 67 | return 0; |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index b4f1b6e88305..7d7eb1354eee 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
| @@ -1383,6 +1383,8 @@ static void hdmi_pcm_setup_pin(struct hdmi_spec *spec, | |||
| 1383 | pcm = get_pcm_rec(spec, per_pin->pcm_idx); | 1383 | pcm = get_pcm_rec(spec, per_pin->pcm_idx); |
| 1384 | else | 1384 | else |
| 1385 | return; | 1385 | return; |
| 1386 | if (!pcm->pcm) | ||
| 1387 | return; | ||
| 1386 | if (!test_bit(per_pin->pcm_idx, &spec->pcm_in_use)) | 1388 | if (!test_bit(per_pin->pcm_idx, &spec->pcm_in_use)) |
| 1387 | return; | 1389 | return; |
| 1388 | 1390 | ||
| @@ -2151,8 +2153,13 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) | |||
| 2151 | int dev, err; | 2153 | int dev, err; |
| 2152 | int pin_idx, pcm_idx; | 2154 | int pin_idx, pcm_idx; |
| 2153 | 2155 | ||
| 2154 | |||
| 2155 | for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) { | 2156 | for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) { |
| 2157 | if (!get_pcm_rec(spec, pcm_idx)->pcm) { | ||
| 2158 | /* no PCM: mark this for skipping permanently */ | ||
| 2159 | set_bit(pcm_idx, &spec->pcm_bitmap); | ||
| 2160 | continue; | ||
| 2161 | } | ||
| 2162 | |||
| 2156 | err = generic_hdmi_build_jack(codec, pcm_idx); | 2163 | err = generic_hdmi_build_jack(codec, pcm_idx); |
| 2157 | if (err < 0) | 2164 | if (err < 0) |
| 2158 | return err; | 2165 | return err; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index fc77bf7a1544..8c238e51bb5a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -331,6 +331,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) | |||
| 331 | /* fallthrough */ | 331 | /* fallthrough */ |
| 332 | case 0x10ec0215: | 332 | case 0x10ec0215: |
| 333 | case 0x10ec0233: | 333 | case 0x10ec0233: |
| 334 | case 0x10ec0235: | ||
| 334 | case 0x10ec0236: | 335 | case 0x10ec0236: |
| 335 | case 0x10ec0255: | 336 | case 0x10ec0255: |
| 336 | case 0x10ec0256: | 337 | case 0x10ec0256: |
| @@ -6575,6 +6576,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
| 6575 | SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), | 6576 | SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
| 6576 | SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), | 6577 | SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
| 6577 | SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), | 6578 | SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
| 6579 | SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), | ||
| 6578 | SND_PCI_QUIRK(0x17aa, 0x3138, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), | 6580 | SND_PCI_QUIRK(0x17aa, 0x3138, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
| 6579 | SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), | 6581 | SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
| 6580 | SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), | 6582 | SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
| @@ -7160,8 +7162,11 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 7160 | case 0x10ec0298: | 7162 | case 0x10ec0298: |
| 7161 | spec->codec_variant = ALC269_TYPE_ALC298; | 7163 | spec->codec_variant = ALC269_TYPE_ALC298; |
| 7162 | break; | 7164 | break; |
| 7165 | case 0x10ec0235: | ||
| 7163 | case 0x10ec0255: | 7166 | case 0x10ec0255: |
| 7164 | spec->codec_variant = ALC269_TYPE_ALC255; | 7167 | spec->codec_variant = ALC269_TYPE_ALC255; |
| 7168 | spec->shutup = alc256_shutup; | ||
| 7169 | spec->init_hook = alc256_init; | ||
| 7165 | break; | 7170 | break; |
| 7166 | case 0x10ec0236: | 7171 | case 0x10ec0236: |
| 7167 | case 0x10ec0256: | 7172 | case 0x10ec0256: |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 4c59983158e0..11b5b5e0e058 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
| @@ -137,6 +137,7 @@ | |||
| 137 | #include <linux/pci.h> | 137 | #include <linux/pci.h> |
| 138 | #include <linux/math64.h> | 138 | #include <linux/math64.h> |
| 139 | #include <linux/io.h> | 139 | #include <linux/io.h> |
| 140 | #include <linux/nospec.h> | ||
| 140 | 141 | ||
| 141 | #include <sound/core.h> | 142 | #include <sound/core.h> |
| 142 | #include <sound/control.h> | 143 | #include <sound/control.h> |
| @@ -5698,40 +5699,43 @@ static int snd_hdspm_channel_info(struct snd_pcm_substream *substream, | |||
| 5698 | struct snd_pcm_channel_info *info) | 5699 | struct snd_pcm_channel_info *info) |
| 5699 | { | 5700 | { |
| 5700 | struct hdspm *hdspm = snd_pcm_substream_chip(substream); | 5701 | struct hdspm *hdspm = snd_pcm_substream_chip(substream); |
| 5702 | unsigned int channel = info->channel; | ||
| 5701 | 5703 | ||
| 5702 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 5704 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 5703 | if (snd_BUG_ON(info->channel >= hdspm->max_channels_out)) { | 5705 | if (snd_BUG_ON(channel >= hdspm->max_channels_out)) { |
| 5704 | dev_info(hdspm->card->dev, | 5706 | dev_info(hdspm->card->dev, |
| 5705 | "snd_hdspm_channel_info: output channel out of range (%d)\n", | 5707 | "snd_hdspm_channel_info: output channel out of range (%d)\n", |
| 5706 | info->channel); | 5708 | channel); |
| 5707 | return -EINVAL; | 5709 | return -EINVAL; |
| 5708 | } | 5710 | } |
| 5709 | 5711 | ||
| 5710 | if (hdspm->channel_map_out[info->channel] < 0) { | 5712 | channel = array_index_nospec(channel, hdspm->max_channels_out); |
| 5713 | if (hdspm->channel_map_out[channel] < 0) { | ||
| 5711 | dev_info(hdspm->card->dev, | 5714 | dev_info(hdspm->card->dev, |
| 5712 | "snd_hdspm_channel_info: output channel %d mapped out\n", | 5715 | "snd_hdspm_channel_info: output channel %d mapped out\n", |
| 5713 | info->channel); | 5716 | channel); |
| 5714 | return -EINVAL; | 5717 | return -EINVAL; |
| 5715 | } | 5718 | } |
| 5716 | 5719 | ||
| 5717 | info->offset = hdspm->channel_map_out[info->channel] * | 5720 | info->offset = hdspm->channel_map_out[channel] * |
| 5718 | HDSPM_CHANNEL_BUFFER_BYTES; | 5721 | HDSPM_CHANNEL_BUFFER_BYTES; |
| 5719 | } else { | 5722 | } else { |
| 5720 | if (snd_BUG_ON(info->channel >= hdspm->max_channels_in)) { | 5723 | if (snd_BUG_ON(channel >= hdspm->max_channels_in)) { |
| 5721 | dev_info(hdspm->card->dev, | 5724 | dev_info(hdspm->card->dev, |
| 5722 | "snd_hdspm_channel_info: input channel out of range (%d)\n", | 5725 | "snd_hdspm_channel_info: input channel out of range (%d)\n", |
| 5723 | info->channel); | 5726 | channel); |
| 5724 | return -EINVAL; | 5727 | return -EINVAL; |
| 5725 | } | 5728 | } |
| 5726 | 5729 | ||
| 5727 | if (hdspm->channel_map_in[info->channel] < 0) { | 5730 | channel = array_index_nospec(channel, hdspm->max_channels_in); |
| 5731 | if (hdspm->channel_map_in[channel] < 0) { | ||
| 5728 | dev_info(hdspm->card->dev, | 5732 | dev_info(hdspm->card->dev, |
| 5729 | "snd_hdspm_channel_info: input channel %d mapped out\n", | 5733 | "snd_hdspm_channel_info: input channel %d mapped out\n", |
| 5730 | info->channel); | 5734 | channel); |
| 5731 | return -EINVAL; | 5735 | return -EINVAL; |
| 5732 | } | 5736 | } |
| 5733 | 5737 | ||
| 5734 | info->offset = hdspm->channel_map_in[info->channel] * | 5738 | info->offset = hdspm->channel_map_in[channel] * |
| 5735 | HDSPM_CHANNEL_BUFFER_BYTES; | 5739 | HDSPM_CHANNEL_BUFFER_BYTES; |
| 5736 | } | 5740 | } |
| 5737 | 5741 | ||
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index df648b1d9217..edd765e22377 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
| 29 | #include <linux/nospec.h> | ||
| 29 | 30 | ||
| 30 | #include <sound/core.h> | 31 | #include <sound/core.h> |
| 31 | #include <sound/control.h> | 32 | #include <sound/control.h> |
| @@ -2071,9 +2072,10 @@ static int snd_rme9652_channel_info(struct snd_pcm_substream *substream, | |||
| 2071 | if (snd_BUG_ON(info->channel >= RME9652_NCHANNELS)) | 2072 | if (snd_BUG_ON(info->channel >= RME9652_NCHANNELS)) |
| 2072 | return -EINVAL; | 2073 | return -EINVAL; |
| 2073 | 2074 | ||
| 2074 | if ((chn = rme9652->channel_map[info->channel]) < 0) { | 2075 | chn = rme9652->channel_map[array_index_nospec(info->channel, |
| 2076 | RME9652_NCHANNELS)]; | ||
| 2077 | if (chn < 0) | ||
| 2075 | return -EINVAL; | 2078 | return -EINVAL; |
| 2076 | } | ||
| 2077 | 2079 | ||
| 2078 | info->offset = chn * RME9652_CHANNEL_BUFFER_BYTES; | 2080 | info->offset = chn * RME9652_CHANNEL_BUFFER_BYTES; |
| 2079 | info->first = 0; | 2081 | info->first = 0; |
diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index b205c782e494..f41560ecbcd1 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | #define DUAL_CHANNEL 2 | 43 | #define DUAL_CHANNEL 2 |
| 44 | 44 | ||
| 45 | static struct snd_soc_jack cz_jack; | 45 | static struct snd_soc_jack cz_jack; |
| 46 | struct clk *da7219_dai_clk; | 46 | static struct clk *da7219_dai_clk; |
| 47 | 47 | ||
| 48 | static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) | 48 | static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) |
| 49 | { | 49 | { |
diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c index 80c2a06285bb..12bf24c26818 100644 --- a/sound/soc/codecs/adau17x1.c +++ b/sound/soc/codecs/adau17x1.c | |||
| @@ -502,7 +502,7 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream, | |||
| 502 | } | 502 | } |
| 503 | 503 | ||
| 504 | if (adau->sigmadsp) { | 504 | if (adau->sigmadsp) { |
| 505 | ret = adau17x1_setup_firmware(adau, params_rate(params)); | 505 | ret = adau17x1_setup_firmware(component, params_rate(params)); |
| 506 | if (ret < 0) | 506 | if (ret < 0) |
| 507 | return ret; | 507 | return ret; |
| 508 | } | 508 | } |
| @@ -835,26 +835,40 @@ bool adau17x1_volatile_register(struct device *dev, unsigned int reg) | |||
| 835 | } | 835 | } |
| 836 | EXPORT_SYMBOL_GPL(adau17x1_volatile_register); | 836 | EXPORT_SYMBOL_GPL(adau17x1_volatile_register); |
| 837 | 837 | ||
| 838 | int adau17x1_setup_firmware(struct adau *adau, unsigned int rate) | 838 | int adau17x1_setup_firmware(struct snd_soc_component *component, |
| 839 | unsigned int rate) | ||
| 839 | { | 840 | { |
| 840 | int ret; | 841 | int ret; |
| 841 | int dspsr; | 842 | int dspsr, dsp_run; |
| 843 | struct adau *adau = snd_soc_component_get_drvdata(component); | ||
| 844 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | ||
| 845 | |||
| 846 | snd_soc_dapm_mutex_lock(dapm); | ||
| 842 | 847 | ||
| 843 | ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr); | 848 | ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr); |
| 844 | if (ret) | 849 | if (ret) |
| 845 | return ret; | 850 | goto err; |
| 851 | |||
| 852 | ret = regmap_read(adau->regmap, ADAU17X1_DSP_RUN, &dsp_run); | ||
| 853 | if (ret) | ||
| 854 | goto err; | ||
| 846 | 855 | ||
| 847 | regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1); | 856 | regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1); |
| 848 | regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf); | 857 | regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf); |
| 858 | regmap_write(adau->regmap, ADAU17X1_DSP_RUN, 0); | ||
| 849 | 859 | ||
| 850 | ret = sigmadsp_setup(adau->sigmadsp, rate); | 860 | ret = sigmadsp_setup(adau->sigmadsp, rate); |
| 851 | if (ret) { | 861 | if (ret) { |
| 852 | regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0); | 862 | regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0); |
| 853 | return ret; | 863 | goto err; |
| 854 | } | 864 | } |
| 855 | regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr); | 865 | regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr); |
| 866 | regmap_write(adau->regmap, ADAU17X1_DSP_RUN, dsp_run); | ||
| 856 | 867 | ||
| 857 | return 0; | 868 | err: |
| 869 | snd_soc_dapm_mutex_unlock(dapm); | ||
| 870 | |||
| 871 | return ret; | ||
| 858 | } | 872 | } |
| 859 | EXPORT_SYMBOL_GPL(adau17x1_setup_firmware); | 873 | EXPORT_SYMBOL_GPL(adau17x1_setup_firmware); |
| 860 | 874 | ||
diff --git a/sound/soc/codecs/adau17x1.h b/sound/soc/codecs/adau17x1.h index a7b1cb770814..e6fe87beec07 100644 --- a/sound/soc/codecs/adau17x1.h +++ b/sound/soc/codecs/adau17x1.h | |||
| @@ -68,7 +68,8 @@ int adau17x1_resume(struct snd_soc_component *component); | |||
| 68 | 68 | ||
| 69 | extern const struct snd_soc_dai_ops adau17x1_dai_ops; | 69 | extern const struct snd_soc_dai_ops adau17x1_dai_ops; |
| 70 | 70 | ||
| 71 | int adau17x1_setup_firmware(struct adau *adau, unsigned int rate); | 71 | int adau17x1_setup_firmware(struct snd_soc_component *component, |
| 72 | unsigned int rate); | ||
| 72 | bool adau17x1_has_dsp(struct adau *adau); | 73 | bool adau17x1_has_dsp(struct adau *adau); |
| 73 | 74 | ||
| 74 | #define ADAU17X1_CLOCK_CONTROL 0x4000 | 75 | #define ADAU17X1_CLOCK_CONTROL 0x4000 |
diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 12ee83d52405..b7cf7cce95fe 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c | |||
| @@ -1187,7 +1187,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) | |||
| 1187 | return irq; | 1187 | return irq; |
| 1188 | } | 1188 | } |
| 1189 | 1189 | ||
| 1190 | ret = devm_request_irq(dev, irq, pm8916_mbhc_switch_irq_handler, | 1190 | ret = devm_request_threaded_irq(dev, irq, NULL, |
| 1191 | pm8916_mbhc_switch_irq_handler, | ||
| 1191 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | | 1192 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | |
| 1192 | IRQF_ONESHOT, | 1193 | IRQF_ONESHOT, |
| 1193 | "mbhc switch irq", priv); | 1194 | "mbhc switch irq", priv); |
| @@ -1201,7 +1202,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) | |||
| 1201 | return irq; | 1202 | return irq; |
| 1202 | } | 1203 | } |
| 1203 | 1204 | ||
| 1204 | ret = devm_request_irq(dev, irq, mbhc_btn_press_irq_handler, | 1205 | ret = devm_request_threaded_irq(dev, irq, NULL, |
| 1206 | mbhc_btn_press_irq_handler, | ||
| 1205 | IRQF_TRIGGER_RISING | | 1207 | IRQF_TRIGGER_RISING | |
| 1206 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 1208 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 1207 | "mbhc btn press irq", priv); | 1209 | "mbhc btn press irq", priv); |
| @@ -1214,7 +1216,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) | |||
| 1214 | return irq; | 1216 | return irq; |
| 1215 | } | 1217 | } |
| 1216 | 1218 | ||
| 1217 | ret = devm_request_irq(dev, irq, mbhc_btn_release_irq_handler, | 1219 | ret = devm_request_threaded_irq(dev, irq, NULL, |
| 1220 | mbhc_btn_release_irq_handler, | ||
| 1218 | IRQF_TRIGGER_RISING | | 1221 | IRQF_TRIGGER_RISING | |
| 1219 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 1222 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 1220 | "mbhc btn release irq", priv); | 1223 | "mbhc btn release irq", priv); |
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c index e8a66b03faab..1570b91bf018 100644 --- a/sound/soc/codecs/rt5514.c +++ b/sound/soc/codecs/rt5514.c | |||
| @@ -89,6 +89,7 @@ static const struct reg_default rt5514_reg[] = { | |||
| 89 | {RT5514_PLL3_CALIB_CTRL5, 0x40220012}, | 89 | {RT5514_PLL3_CALIB_CTRL5, 0x40220012}, |
| 90 | {RT5514_DELAY_BUF_CTRL1, 0x7fff006a}, | 90 | {RT5514_DELAY_BUF_CTRL1, 0x7fff006a}, |
| 91 | {RT5514_DELAY_BUF_CTRL3, 0x00000000}, | 91 | {RT5514_DELAY_BUF_CTRL3, 0x00000000}, |
| 92 | {RT5514_ASRC_IN_CTRL1, 0x00000003}, | ||
| 92 | {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f}, | 93 | {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f}, |
| 93 | {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f}, | 94 | {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f}, |
| 94 | {RT5514_DOWNFILTER0_CTRL3, 0x10000362}, | 95 | {RT5514_DOWNFILTER0_CTRL3, 0x10000362}, |
| @@ -181,6 +182,7 @@ static bool rt5514_readable_register(struct device *dev, unsigned int reg) | |||
| 181 | case RT5514_PLL3_CALIB_CTRL5: | 182 | case RT5514_PLL3_CALIB_CTRL5: |
| 182 | case RT5514_DELAY_BUF_CTRL1: | 183 | case RT5514_DELAY_BUF_CTRL1: |
| 183 | case RT5514_DELAY_BUF_CTRL3: | 184 | case RT5514_DELAY_BUF_CTRL3: |
| 185 | case RT5514_ASRC_IN_CTRL1: | ||
| 184 | case RT5514_DOWNFILTER0_CTRL1: | 186 | case RT5514_DOWNFILTER0_CTRL1: |
| 185 | case RT5514_DOWNFILTER0_CTRL2: | 187 | case RT5514_DOWNFILTER0_CTRL2: |
| 186 | case RT5514_DOWNFILTER0_CTRL3: | 188 | case RT5514_DOWNFILTER0_CTRL3: |
| @@ -238,6 +240,7 @@ static bool rt5514_i2c_readable_register(struct device *dev, | |||
| 238 | case RT5514_DSP_MAPPING | RT5514_PLL3_CALIB_CTRL5: | 240 | case RT5514_DSP_MAPPING | RT5514_PLL3_CALIB_CTRL5: |
| 239 | case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL1: | 241 | case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL1: |
| 240 | case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL3: | 242 | case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL3: |
| 243 | case RT5514_DSP_MAPPING | RT5514_ASRC_IN_CTRL1: | ||
| 241 | case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL1: | 244 | case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL1: |
| 242 | case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL2: | 245 | case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL2: |
| 243 | case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL3: | 246 | case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL3: |
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 40a700493f4c..da8fd98c7f51 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c | |||
| @@ -144,6 +144,13 @@ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, | |||
| 144 | 144 | ||
| 145 | psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; | 145 | psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; |
| 146 | 146 | ||
| 147 | /* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */ | ||
| 148 | if (ratio <= 256) { | ||
| 149 | pm = ratio; | ||
| 150 | fp = 1; | ||
| 151 | goto out; | ||
| 152 | } | ||
| 153 | |||
| 147 | /* Set the max fluctuation -- 0.1% of the max devisor */ | 154 | /* Set the max fluctuation -- 0.1% of the max devisor */ |
| 148 | savesub = (psr ? 1 : 8) * 256 * maxfp / 1000; | 155 | savesub = (psr ? 1 : 8) * 256 * maxfp / 1000; |
| 149 | 156 | ||
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 0823b08923b5..89df2d9f63d7 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
| @@ -217,6 +217,7 @@ struct fsl_ssi_soc_data { | |||
| 217 | * @dai_fmt: DAI configuration this device is currently used with | 217 | * @dai_fmt: DAI configuration this device is currently used with |
| 218 | * @streams: Mask of current active streams: BIT(TX) and BIT(RX) | 218 | * @streams: Mask of current active streams: BIT(TX) and BIT(RX) |
| 219 | * @i2s_net: I2S and Network mode configurations of SCR register | 219 | * @i2s_net: I2S and Network mode configurations of SCR register |
| 220 | * (this is the initial settings based on the DAI format) | ||
| 220 | * @synchronous: Use synchronous mode - both of TX and RX use STCK and SFCK | 221 | * @synchronous: Use synchronous mode - both of TX and RX use STCK and SFCK |
| 221 | * @use_dma: DMA is used or FIQ with stream filter | 222 | * @use_dma: DMA is used or FIQ with stream filter |
| 222 | * @use_dual_fifo: DMA with support for dual FIFO mode | 223 | * @use_dual_fifo: DMA with support for dual FIFO mode |
| @@ -829,16 +830,23 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, | |||
| 829 | } | 830 | } |
| 830 | 831 | ||
| 831 | if (!fsl_ssi_is_ac97(ssi)) { | 832 | if (!fsl_ssi_is_ac97(ssi)) { |
| 833 | /* | ||
| 834 | * Keep the ssi->i2s_net intact while having a local variable | ||
| 835 | * to override settings for special use cases. Otherwise, the | ||
| 836 | * ssi->i2s_net will lose the settings for regular use cases. | ||
| 837 | */ | ||
| 838 | u8 i2s_net = ssi->i2s_net; | ||
| 839 | |||
| 832 | /* Normal + Network mode to send 16-bit data in 32-bit frames */ | 840 | /* Normal + Network mode to send 16-bit data in 32-bit frames */ |
| 833 | if (fsl_ssi_is_i2s_cbm_cfs(ssi) && sample_size == 16) | 841 | if (fsl_ssi_is_i2s_cbm_cfs(ssi) && sample_size == 16) |
| 834 | ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET; | 842 | i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET; |
| 835 | 843 | ||
| 836 | /* Use Normal mode to send mono data at 1st slot of 2 slots */ | 844 | /* Use Normal mode to send mono data at 1st slot of 2 slots */ |
| 837 | if (channels == 1) | 845 | if (channels == 1) |
| 838 | ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL; | 846 | i2s_net = SSI_SCR_I2S_MODE_NORMAL; |
| 839 | 847 | ||
| 840 | regmap_update_bits(regs, REG_SSI_SCR, | 848 | regmap_update_bits(regs, REG_SSI_SCR, |
| 841 | SSI_SCR_I2S_NET_MASK, ssi->i2s_net); | 849 | SSI_SCR_I2S_NET_MASK, i2s_net); |
| 842 | } | 850 | } |
| 843 | 851 | ||
| 844 | /* In synchronous mode, the SSI uses STCCR for capture */ | 852 | /* In synchronous mode, the SSI uses STCCR for capture */ |
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index ceb105cbd461..addac2a8e52a 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig | |||
| @@ -72,24 +72,28 @@ config SND_SOC_INTEL_BAYTRAIL | |||
| 72 | for Baytrail Chromebooks but this option is now deprecated and is | 72 | for Baytrail Chromebooks but this option is now deprecated and is |
| 73 | not recommended, use SND_SST_ATOM_HIFI2_PLATFORM instead. | 73 | not recommended, use SND_SST_ATOM_HIFI2_PLATFORM instead. |
| 74 | 74 | ||
| 75 | config SND_SST_ATOM_HIFI2_PLATFORM | ||
| 76 | tristate | ||
| 77 | select SND_SOC_COMPRESS | ||
| 78 | |||
| 75 | config SND_SST_ATOM_HIFI2_PLATFORM_PCI | 79 | config SND_SST_ATOM_HIFI2_PLATFORM_PCI |
| 76 | tristate "PCI HiFi2 (Medfield, Merrifield) Platforms" | 80 | tristate "PCI HiFi2 (Merrifield) Platforms" |
| 77 | depends on X86 && PCI | 81 | depends on X86 && PCI |
| 78 | select SND_SST_IPC_PCI | 82 | select SND_SST_IPC_PCI |
| 79 | select SND_SOC_COMPRESS | 83 | select SND_SST_ATOM_HIFI2_PLATFORM |
| 80 | help | 84 | help |
| 81 | If you have a Intel Medfield or Merrifield/Edison platform, then | 85 | If you have a Intel Merrifield/Edison platform, then |
| 82 | enable this option by saying Y or m. Distros will typically not | 86 | enable this option by saying Y or m. Distros will typically not |
| 83 | enable this option: Medfield devices are not available to | 87 | enable this option: while Merrifield/Edison can run a mainline |
| 84 | developers and while Merrifield/Edison can run a mainline kernel with | 88 | kernel with limited functionality it will require a firmware file |
| 85 | limited functionality it will require a firmware file which | 89 | which is not in the standard firmware tree |
| 86 | is not in the standard firmware tree | ||
| 87 | 90 | ||
| 88 | config SND_SST_ATOM_HIFI2_PLATFORM | 91 | config SND_SST_ATOM_HIFI2_PLATFORM_ACPI |
| 89 | tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms" | 92 | tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms" |
| 93 | default ACPI | ||
| 90 | depends on X86 && ACPI | 94 | depends on X86 && ACPI |
| 91 | select SND_SST_IPC_ACPI | 95 | select SND_SST_IPC_ACPI |
| 92 | select SND_SOC_COMPRESS | 96 | select SND_SST_ATOM_HIFI2_PLATFORM |
| 93 | select SND_SOC_ACPI_INTEL_MATCH | 97 | select SND_SOC_ACPI_INTEL_MATCH |
| 94 | select IOSF_MBI | 98 | select IOSF_MBI |
| 95 | help | 99 | help |
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 09db2aec12a3..b2f5d2fa354d 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c | |||
| @@ -281,7 +281,7 @@ static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream, | |||
| 281 | static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, | 281 | static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, |
| 282 | unsigned int freq) | 282 | unsigned int freq) |
| 283 | { | 283 | { |
| 284 | struct clk *parent_clk; | 284 | struct clk *parent_clk, *mux; |
| 285 | char *parent_clk_name; | 285 | char *parent_clk_name; |
| 286 | int ret = 0; | 286 | int ret = 0; |
| 287 | 287 | ||
| @@ -329,14 +329,21 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, | |||
| 329 | return -ENODEV; | 329 | return -ENODEV; |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | mux = clk_get_parent(dmic->fclk); | ||
| 333 | if (IS_ERR(mux)) { | ||
| 334 | dev_err(dmic->dev, "can't get fck mux parent\n"); | ||
| 335 | clk_put(parent_clk); | ||
| 336 | return -ENODEV; | ||
| 337 | } | ||
| 338 | |||
| 332 | mutex_lock(&dmic->mutex); | 339 | mutex_lock(&dmic->mutex); |
| 333 | if (dmic->active) { | 340 | if (dmic->active) { |
| 334 | /* disable clock while reparenting */ | 341 | /* disable clock while reparenting */ |
| 335 | pm_runtime_put_sync(dmic->dev); | 342 | pm_runtime_put_sync(dmic->dev); |
| 336 | ret = clk_set_parent(dmic->fclk, parent_clk); | 343 | ret = clk_set_parent(mux, parent_clk); |
| 337 | pm_runtime_get_sync(dmic->dev); | 344 | pm_runtime_get_sync(dmic->dev); |
| 338 | } else { | 345 | } else { |
| 339 | ret = clk_set_parent(dmic->fclk, parent_clk); | 346 | ret = clk_set_parent(mux, parent_clk); |
| 340 | } | 347 | } |
| 341 | mutex_unlock(&dmic->mutex); | 348 | mutex_unlock(&dmic->mutex); |
| 342 | 349 | ||
| @@ -349,6 +356,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, | |||
| 349 | dmic->fclk_freq = freq; | 356 | dmic->fclk_freq = freq; |
| 350 | 357 | ||
| 351 | err_busy: | 358 | err_busy: |
| 359 | clk_put(mux); | ||
| 352 | clk_put(parent_clk); | 360 | clk_put(parent_clk); |
| 353 | 361 | ||
| 354 | return ret; | 362 | return ret; |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 6a76688a8ba9..94f081b93258 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
| @@ -1536,7 +1536,7 @@ static int rsnd_remove(struct platform_device *pdev) | |||
| 1536 | return ret; | 1536 | return ret; |
| 1537 | } | 1537 | } |
| 1538 | 1538 | ||
| 1539 | static int rsnd_suspend(struct device *dev) | 1539 | static int __maybe_unused rsnd_suspend(struct device *dev) |
| 1540 | { | 1540 | { |
| 1541 | struct rsnd_priv *priv = dev_get_drvdata(dev); | 1541 | struct rsnd_priv *priv = dev_get_drvdata(dev); |
| 1542 | 1542 | ||
| @@ -1545,7 +1545,7 @@ static int rsnd_suspend(struct device *dev) | |||
| 1545 | return 0; | 1545 | return 0; |
| 1546 | } | 1546 | } |
| 1547 | 1547 | ||
| 1548 | static int rsnd_resume(struct device *dev) | 1548 | static int __maybe_unused rsnd_resume(struct device *dev) |
| 1549 | { | 1549 | { |
| 1550 | struct rsnd_priv *priv = dev_get_drvdata(dev); | 1550 | struct rsnd_priv *priv = dev_get_drvdata(dev); |
| 1551 | 1551 | ||
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index fa27d0fca6dc..986b8b2f90fb 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c | |||
| @@ -513,7 +513,7 @@ static void remove_widget(struct snd_soc_component *comp, | |||
| 513 | */ | 513 | */ |
| 514 | if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) { | 514 | if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) { |
| 515 | /* enumerated widget mixer */ | 515 | /* enumerated widget mixer */ |
| 516 | for (i = 0; i < w->num_kcontrols; i++) { | 516 | for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) { |
| 517 | struct snd_kcontrol *kcontrol = w->kcontrols[i]; | 517 | struct snd_kcontrol *kcontrol = w->kcontrols[i]; |
| 518 | struct soc_enum *se = | 518 | struct soc_enum *se = |
| 519 | (struct soc_enum *)kcontrol->private_value; | 519 | (struct soc_enum *)kcontrol->private_value; |
| @@ -530,7 +530,7 @@ static void remove_widget(struct snd_soc_component *comp, | |||
| 530 | } | 530 | } |
| 531 | } else { | 531 | } else { |
| 532 | /* volume mixer or bytes controls */ | 532 | /* volume mixer or bytes controls */ |
| 533 | for (i = 0; i < w->num_kcontrols; i++) { | 533 | for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) { |
| 534 | struct snd_kcontrol *kcontrol = w->kcontrols[i]; | 534 | struct snd_kcontrol *kcontrol = w->kcontrols[i]; |
| 535 | 535 | ||
| 536 | if (dobj->widget.kcontrol_type | 536 | if (dobj->widget.kcontrol_type |
| @@ -1325,8 +1325,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create( | |||
| 1325 | ec->hdr.name); | 1325 | ec->hdr.name); |
| 1326 | 1326 | ||
| 1327 | kc[i].name = kstrdup(ec->hdr.name, GFP_KERNEL); | 1327 | kc[i].name = kstrdup(ec->hdr.name, GFP_KERNEL); |
| 1328 | if (kc[i].name == NULL) | 1328 | if (kc[i].name == NULL) { |
| 1329 | kfree(se); | ||
| 1329 | goto err_se; | 1330 | goto err_se; |
| 1331 | } | ||
| 1330 | kc[i].private_value = (long)se; | 1332 | kc[i].private_value = (long)se; |
| 1331 | kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 1333 | kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
| 1332 | kc[i].access = ec->hdr.access; | 1334 | kc[i].access = ec->hdr.access; |
| @@ -1442,8 +1444,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create( | |||
| 1442 | be->hdr.name, be->hdr.access); | 1444 | be->hdr.name, be->hdr.access); |
| 1443 | 1445 | ||
| 1444 | kc[i].name = kstrdup(be->hdr.name, GFP_KERNEL); | 1446 | kc[i].name = kstrdup(be->hdr.name, GFP_KERNEL); |
| 1445 | if (kc[i].name == NULL) | 1447 | if (kc[i].name == NULL) { |
| 1448 | kfree(sbe); | ||
| 1446 | goto err; | 1449 | goto err; |
| 1450 | } | ||
| 1447 | kc[i].private_value = (long)sbe; | 1451 | kc[i].private_value = (long)sbe; |
| 1448 | kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 1452 | kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
| 1449 | kc[i].access = be->hdr.access; | 1453 | kc[i].access = be->hdr.access; |
| @@ -2576,7 +2580,7 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index) | |||
| 2576 | 2580 | ||
| 2577 | /* match index */ | 2581 | /* match index */ |
| 2578 | if (dobj->index != index && | 2582 | if (dobj->index != index && |
| 2579 | dobj->index != SND_SOC_TPLG_INDEX_ALL) | 2583 | index != SND_SOC_TPLG_INDEX_ALL) |
| 2580 | continue; | 2584 | continue; |
| 2581 | 2585 | ||
| 2582 | switch (dobj->type) { | 2586 | switch (dobj->type) { |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 301ad61ed426..344d7b069d59 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
| @@ -1776,7 +1776,8 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, | |||
| 1776 | build_feature_ctl(state, _ftr, ch_bits, control, | 1776 | build_feature_ctl(state, _ftr, ch_bits, control, |
| 1777 | &iterm, unitid, ch_read_only); | 1777 | &iterm, unitid, ch_read_only); |
| 1778 | if (uac_v2v3_control_is_readable(master_bits, control)) | 1778 | if (uac_v2v3_control_is_readable(master_bits, control)) |
| 1779 | build_feature_ctl(state, _ftr, 0, i, &iterm, unitid, | 1779 | build_feature_ctl(state, _ftr, 0, control, |
| 1780 | &iterm, unitid, | ||
| 1780 | !uac_v2v3_control_is_writeable(master_bits, | 1781 | !uac_v2v3_control_is_writeable(master_bits, |
| 1781 | control)); | 1782 | control)); |
| 1782 | } | 1783 | } |
| @@ -1859,7 +1860,7 @@ static int parse_audio_input_terminal(struct mixer_build *state, int unitid, | |||
| 1859 | check_input_term(state, d->bTerminalID, &iterm); | 1860 | check_input_term(state, d->bTerminalID, &iterm); |
| 1860 | if (state->mixer->protocol == UAC_VERSION_2) { | 1861 | if (state->mixer->protocol == UAC_VERSION_2) { |
| 1861 | /* Check for jack detection. */ | 1862 | /* Check for jack detection. */ |
| 1862 | if (uac_v2v3_control_is_readable(d->bmControls, | 1863 | if (uac_v2v3_control_is_readable(le16_to_cpu(d->bmControls), |
| 1863 | UAC2_TE_CONNECTOR)) { | 1864 | UAC2_TE_CONNECTOR)) { |
| 1864 | build_connector_control(state, &iterm, true); | 1865 | build_connector_control(state, &iterm, true); |
| 1865 | } | 1866 | } |
| @@ -2561,7 +2562,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
| 2561 | if (err < 0 && err != -EINVAL) | 2562 | if (err < 0 && err != -EINVAL) |
| 2562 | return err; | 2563 | return err; |
| 2563 | 2564 | ||
| 2564 | if (uac_v2v3_control_is_readable(desc->bmControls, | 2565 | if (uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls), |
| 2565 | UAC2_TE_CONNECTOR)) { | 2566 | UAC2_TE_CONNECTOR)) { |
| 2566 | build_connector_control(&state, &state.oterm, | 2567 | build_connector_control(&state, &state.oterm, |
| 2567 | false); | 2568 | false); |
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c index 9038b2e7df73..eaa03acd4686 100644 --- a/sound/usb/mixer_maps.c +++ b/sound/usb/mixer_maps.c | |||
| @@ -353,8 +353,11 @@ static struct usbmix_name_map bose_companion5_map[] = { | |||
| 353 | /* | 353 | /* |
| 354 | * Dell usb dock with ALC4020 codec had a firmware problem where it got | 354 | * Dell usb dock with ALC4020 codec had a firmware problem where it got |
| 355 | * screwed up when zero volume is passed; just skip it as a workaround | 355 | * screwed up when zero volume is passed; just skip it as a workaround |
| 356 | * | ||
| 357 | * Also the extension unit gives an access error, so skip it as well. | ||
| 356 | */ | 358 | */ |
| 357 | static const struct usbmix_name_map dell_alc4020_map[] = { | 359 | static const struct usbmix_name_map dell_alc4020_map[] = { |
| 360 | { 4, NULL }, /* extension unit */ | ||
| 358 | { 16, NULL }, | 361 | { 16, NULL }, |
| 359 | { 19, NULL }, | 362 | { 19, NULL }, |
| 360 | { 0 } | 363 | { 0 } |
diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 6a8f5843334e..956be9f7c72a 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c | |||
| @@ -349,7 +349,7 @@ snd_pcm_chmap_elem *convert_chmap_v3(struct uac3_cluster_header_descriptor | |||
| 349 | * TODO: this conversion is not complete, update it | 349 | * TODO: this conversion is not complete, update it |
| 350 | * after adding UAC3 values to asound.h | 350 | * after adding UAC3 values to asound.h |
| 351 | */ | 351 | */ |
| 352 | switch (is->bChPurpose) { | 352 | switch (is->bChRelationship) { |
| 353 | case UAC3_CH_MONO: | 353 | case UAC3_CH_MONO: |
| 354 | map = SNDRV_CHMAP_MONO; | 354 | map = SNDRV_CHMAP_MONO; |
| 355 | break; | 355 | break; |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index ebcab5c5465d..8082f7b077f1 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
| @@ -139,7 +139,7 @@ static void usb_stream_hwdep_vm_open(struct vm_area_struct *area) | |||
| 139 | snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count)); | 139 | snd_printdd(KERN_DEBUG "%i\n", atomic_read(&us122l->mmap_count)); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static int usb_stream_hwdep_vm_fault(struct vm_fault *vmf) | 142 | static vm_fault_t usb_stream_hwdep_vm_fault(struct vm_fault *vmf) |
| 143 | { | 143 | { |
| 144 | unsigned long offset; | 144 | unsigned long offset; |
| 145 | struct page *page; | 145 | struct page *page; |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index d8bd7c99b48c..c1dd9a7b48df 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | #include "usbusx2y.h" | 31 | #include "usbusx2y.h" |
| 32 | #include "usX2Yhwdep.h" | 32 | #include "usX2Yhwdep.h" |
| 33 | 33 | ||
| 34 | static int snd_us428ctls_vm_fault(struct vm_fault *vmf) | 34 | static vm_fault_t snd_us428ctls_vm_fault(struct vm_fault *vmf) |
| 35 | { | 35 | { |
| 36 | unsigned long offset; | 36 | unsigned long offset; |
| 37 | struct page * page; | 37 | struct page * page; |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 0d050528a4e1..4fd9276b8e50 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
| @@ -652,7 +652,7 @@ static void snd_usX2Y_hwdep_pcm_vm_close(struct vm_area_struct *area) | |||
| 652 | } | 652 | } |
| 653 | 653 | ||
| 654 | 654 | ||
| 655 | static int snd_usX2Y_hwdep_pcm_vm_fault(struct vm_fault *vmf) | 655 | static vm_fault_t snd_usX2Y_hwdep_pcm_vm_fault(struct vm_fault *vmf) |
| 656 | { | 656 | { |
| 657 | unsigned long offset; | 657 | unsigned long offset; |
| 658 | void *vaddr; | 658 | void *vaddr; |
diff --git a/tools/perf/Documentation/perf-mem.txt b/tools/perf/Documentation/perf-mem.txt index 8806ed5f3802..f8d2167cf3e7 100644 --- a/tools/perf/Documentation/perf-mem.txt +++ b/tools/perf/Documentation/perf-mem.txt | |||
| @@ -28,29 +28,46 @@ OPTIONS | |||
| 28 | <command>...:: | 28 | <command>...:: |
| 29 | Any command you can specify in a shell. | 29 | Any command you can specify in a shell. |
| 30 | 30 | ||
| 31 | -i:: | ||
| 32 | --input=<file>:: | ||
| 33 | Input file name. | ||
| 34 | |||
| 31 | -f:: | 35 | -f:: |
| 32 | --force:: | 36 | --force:: |
| 33 | Don't do ownership validation | 37 | Don't do ownership validation |
| 34 | 38 | ||
| 35 | -t:: | 39 | -t:: |
| 36 | --type=:: | 40 | --type=<type>:: |
| 37 | Select the memory operation type: load or store (default: load,store) | 41 | Select the memory operation type: load or store (default: load,store) |
| 38 | 42 | ||
| 39 | -D:: | 43 | -D:: |
| 40 | --dump-raw-samples=:: | 44 | --dump-raw-samples:: |
| 41 | Dump the raw decoded samples on the screen in a format that is easy to parse with | 45 | Dump the raw decoded samples on the screen in a format that is easy to parse with |
| 42 | one sample per line. | 46 | one sample per line. |
| 43 | 47 | ||
| 44 | -x:: | 48 | -x:: |
| 45 | --field-separator:: | 49 | --field-separator=<separator>:: |
| 46 | Specify the field separator used when dump raw samples (-D option). By default, | 50 | Specify the field separator used when dump raw samples (-D option). By default, |
| 47 | The separator is the space character. | 51 | The separator is the space character. |
| 48 | 52 | ||
| 49 | -C:: | 53 | -C:: |
| 50 | --cpu-list:: | 54 | --cpu=<cpu>:: |
| 51 | Restrict dump of raw samples to those provided via this option. Note that the same | 55 | Monitor only on the list of CPUs provided. Multiple CPUs can be provided as a |
| 52 | option can be passed in record mode. It will be interpreted the same way as perf | 56 | comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2. Default |
| 53 | record. | 57 | is to monitor all CPUS. |
| 58 | -U:: | ||
| 59 | --hide-unresolved:: | ||
| 60 | Only display entries resolved to a symbol. | ||
| 61 | |||
| 62 | -p:: | ||
| 63 | --phys-data:: | ||
| 64 | Record/Report sample physical addresses | ||
| 65 | |||
| 66 | RECORD OPTIONS | ||
| 67 | -------------- | ||
| 68 | -e:: | ||
| 69 | --event <event>:: | ||
| 70 | Event selector. Use 'perf mem record -e list' to list available events. | ||
| 54 | 71 | ||
| 55 | -K:: | 72 | -K:: |
| 56 | --all-kernel:: | 73 | --all-kernel:: |
| @@ -60,12 +77,12 @@ OPTIONS | |||
| 60 | --all-user:: | 77 | --all-user:: |
| 61 | Configure all used events to run in user space. | 78 | Configure all used events to run in user space. |
| 62 | 79 | ||
| 63 | --ldload:: | 80 | -v:: |
| 64 | Specify desired latency for loads event. | 81 | --verbose:: |
| 82 | Be more verbose (show counter open errors, etc) | ||
| 65 | 83 | ||
| 66 | -p:: | 84 | --ldlat <n>:: |
| 67 | --phys-data:: | 85 | Specify desired latency for loads event. |
| 68 | Record/Report sample physical addresses | ||
| 69 | 86 | ||
| 70 | In addition, for report all perf report options are valid, and for record | 87 | In addition, for report all perf report options are valid, and for record |
| 71 | all perf record options. | 88 | all perf record options. |
diff --git a/tools/perf/arch/s390/util/auxtrace.c b/tools/perf/arch/s390/util/auxtrace.c index 6cb48e4cffd9..3afe8256eff2 100644 --- a/tools/perf/arch/s390/util/auxtrace.c +++ b/tools/perf/arch/s390/util/auxtrace.c | |||
| @@ -87,6 +87,7 @@ struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist, | |||
| 87 | struct perf_evsel *pos; | 87 | struct perf_evsel *pos; |
| 88 | int diagnose = 0; | 88 | int diagnose = 0; |
| 89 | 89 | ||
| 90 | *err = 0; | ||
| 90 | if (evlist->nr_entries == 0) | 91 | if (evlist->nr_entries == 0) |
| 91 | return NULL; | 92 | return NULL; |
| 92 | 93 | ||
diff --git a/tools/perf/arch/s390/util/header.c b/tools/perf/arch/s390/util/header.c index a4c30f1c70be..163b92f33998 100644 --- a/tools/perf/arch/s390/util/header.c +++ b/tools/perf/arch/s390/util/header.c | |||
| @@ -146,21 +146,3 @@ char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused) | |||
| 146 | zfree(&buf); | 146 | zfree(&buf); |
| 147 | return buf; | 147 | return buf; |
| 148 | } | 148 | } |
| 149 | |||
| 150 | /* | ||
| 151 | * Compare the cpuid string returned by get_cpuid() function | ||
| 152 | * with the name generated by the jevents file read from | ||
| 153 | * pmu-events/arch/s390/mapfile.csv. | ||
| 154 | * | ||
| 155 | * Parameter mapcpuid is the cpuid as stored in the | ||
| 156 | * pmu-events/arch/s390/mapfile.csv. This is just the type number. | ||
| 157 | * Parameter cpuid is the cpuid returned by function get_cpuid(). | ||
| 158 | */ | ||
| 159 | int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid) | ||
| 160 | { | ||
| 161 | char *cp = strchr(cpuid, ','); | ||
| 162 | |||
| 163 | if (cp == NULL) | ||
| 164 | return -1; | ||
| 165 | return strncmp(cp + 1, mapcpuid, strlen(mapcpuid)); | ||
| 166 | } | ||
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 147a27e8c937..f17dc601b0f3 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
| @@ -172,6 +172,7 @@ static bool interval_count; | |||
| 172 | static const char *output_name; | 172 | static const char *output_name; |
| 173 | static int output_fd; | 173 | static int output_fd; |
| 174 | static int print_free_counters_hint; | 174 | static int print_free_counters_hint; |
| 175 | static int print_mixed_hw_group_error; | ||
| 175 | 176 | ||
| 176 | struct perf_stat { | 177 | struct perf_stat { |
| 177 | bool record; | 178 | bool record; |
| @@ -1126,6 +1127,30 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg) | |||
| 1126 | fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); | 1127 | fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); |
| 1127 | } | 1128 | } |
| 1128 | 1129 | ||
| 1130 | static bool is_mixed_hw_group(struct perf_evsel *counter) | ||
| 1131 | { | ||
| 1132 | struct perf_evlist *evlist = counter->evlist; | ||
| 1133 | u32 pmu_type = counter->attr.type; | ||
| 1134 | struct perf_evsel *pos; | ||
| 1135 | |||
| 1136 | if (counter->nr_members < 2) | ||
| 1137 | return false; | ||
| 1138 | |||
| 1139 | evlist__for_each_entry(evlist, pos) { | ||
| 1140 | /* software events can be part of any hardware group */ | ||
| 1141 | if (pos->attr.type == PERF_TYPE_SOFTWARE) | ||
| 1142 | continue; | ||
| 1143 | if (pmu_type == PERF_TYPE_SOFTWARE) { | ||
| 1144 | pmu_type = pos->attr.type; | ||
| 1145 | continue; | ||
| 1146 | } | ||
| 1147 | if (pmu_type != pos->attr.type) | ||
| 1148 | return true; | ||
| 1149 | } | ||
| 1150 | |||
| 1151 | return false; | ||
| 1152 | } | ||
| 1153 | |||
| 1129 | static void printout(int id, int nr, struct perf_evsel *counter, double uval, | 1154 | static void printout(int id, int nr, struct perf_evsel *counter, double uval, |
| 1130 | char *prefix, u64 run, u64 ena, double noise, | 1155 | char *prefix, u64 run, u64 ena, double noise, |
| 1131 | struct runtime_stat *st) | 1156 | struct runtime_stat *st) |
| @@ -1178,8 +1203,11 @@ static void printout(int id, int nr, struct perf_evsel *counter, double uval, | |||
| 1178 | counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, | 1203 | counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, |
| 1179 | csv_sep); | 1204 | csv_sep); |
| 1180 | 1205 | ||
| 1181 | if (counter->supported) | 1206 | if (counter->supported) { |
| 1182 | print_free_counters_hint = 1; | 1207 | print_free_counters_hint = 1; |
| 1208 | if (is_mixed_hw_group(counter)) | ||
| 1209 | print_mixed_hw_group_error = 1; | ||
| 1210 | } | ||
| 1183 | 1211 | ||
| 1184 | fprintf(stat_config.output, "%-*s%s", | 1212 | fprintf(stat_config.output, "%-*s%s", |
| 1185 | csv_output ? 0 : unit_width, | 1213 | csv_output ? 0 : unit_width, |
| @@ -1256,7 +1284,8 @@ static void uniquify_event_name(struct perf_evsel *counter) | |||
| 1256 | char *new_name; | 1284 | char *new_name; |
| 1257 | char *config; | 1285 | char *config; |
| 1258 | 1286 | ||
| 1259 | if (!counter->pmu_name || !strncmp(counter->name, counter->pmu_name, | 1287 | if (counter->uniquified_name || |
| 1288 | !counter->pmu_name || !strncmp(counter->name, counter->pmu_name, | ||
| 1260 | strlen(counter->pmu_name))) | 1289 | strlen(counter->pmu_name))) |
| 1261 | return; | 1290 | return; |
| 1262 | 1291 | ||
| @@ -1274,6 +1303,8 @@ static void uniquify_event_name(struct perf_evsel *counter) | |||
| 1274 | counter->name = new_name; | 1303 | counter->name = new_name; |
| 1275 | } | 1304 | } |
| 1276 | } | 1305 | } |
| 1306 | |||
| 1307 | counter->uniquified_name = true; | ||
| 1277 | } | 1308 | } |
| 1278 | 1309 | ||
| 1279 | static void collect_all_aliases(struct perf_evsel *counter, | 1310 | static void collect_all_aliases(struct perf_evsel *counter, |
| @@ -1757,6 +1788,11 @@ static void print_footer(void) | |||
| 1757 | " echo 0 > /proc/sys/kernel/nmi_watchdog\n" | 1788 | " echo 0 > /proc/sys/kernel/nmi_watchdog\n" |
| 1758 | " perf stat ...\n" | 1789 | " perf stat ...\n" |
| 1759 | " echo 1 > /proc/sys/kernel/nmi_watchdog\n"); | 1790 | " echo 1 > /proc/sys/kernel/nmi_watchdog\n"); |
| 1791 | |||
| 1792 | if (print_mixed_hw_group_error) | ||
| 1793 | fprintf(output, | ||
| 1794 | "The events in group usually have to be from " | ||
| 1795 | "the same PMU. Try reorganizing the group.\n"); | ||
| 1760 | } | 1796 | } |
| 1761 | 1797 | ||
| 1762 | static void print_counters(struct timespec *ts, int argc, const char **argv) | 1798 | static void print_counters(struct timespec *ts, int argc, const char **argv) |
diff --git a/tools/perf/pmu-events/arch/s390/mapfile.csv b/tools/perf/pmu-events/arch/s390/mapfile.csv index ca7682748a4b..78bcf7f8e206 100644 --- a/tools/perf/pmu-events/arch/s390/mapfile.csv +++ b/tools/perf/pmu-events/arch/s390/mapfile.csv | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | Family-model,Version,Filename,EventType | 1 | Family-model,Version,Filename,EventType |
| 2 | 209[78],1,cf_z10,core | 2 | ^IBM.209[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z10,core |
| 3 | 281[78],1,cf_z196,core | 3 | ^IBM.281[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z196,core |
| 4 | 282[78],1,cf_zec12,core | 4 | ^IBM.282[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_zec12,core |
| 5 | 296[45],1,cf_z13,core | 5 | ^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13,core |
| 6 | 3906,3,cf_z14,core | 6 | ^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14,core |
diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling index f906b793196f..8a33ca4f9e1f 100644 --- a/tools/perf/tests/attr/test-record-group-sampling +++ b/tools/perf/tests/attr/test-record-group-sampling | |||
| @@ -35,3 +35,6 @@ inherit=0 | |||
| 35 | # sampling disabled | 35 | # sampling disabled |
| 36 | sample_freq=0 | 36 | sample_freq=0 |
| 37 | sample_period=0 | 37 | sample_period=0 |
| 38 | freq=0 | ||
| 39 | write_backward=0 | ||
| 40 | sample_id_all=0 | ||
diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh index 1ecc1f0ff84a..016882dbbc16 100755 --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh | |||
| @@ -19,12 +19,10 @@ trace_libc_inet_pton_backtrace() { | |||
| 19 | expected[1]=".*inet_pton[[:space:]]\($libc\)$" | 19 | expected[1]=".*inet_pton[[:space:]]\($libc\)$" |
| 20 | case "$(uname -m)" in | 20 | case "$(uname -m)" in |
| 21 | s390x) | 21 | s390x) |
| 22 | eventattr='call-graph=dwarf' | 22 | eventattr='call-graph=dwarf,max-stack=4' |
| 23 | expected[2]="gaih_inet.*[[:space:]]\($libc|inlined\)$" | 23 | expected[2]="gaih_inet.*[[:space:]]\($libc|inlined\)$" |
| 24 | expected[3]="__GI_getaddrinfo[[:space:]]\($libc|inlined\)$" | 24 | expected[3]="(__GI_)?getaddrinfo[[:space:]]\($libc|inlined\)$" |
| 25 | expected[4]="main[[:space:]]\(.*/bin/ping.*\)$" | 25 | expected[4]="main[[:space:]]\(.*/bin/ping.*\)$" |
| 26 | expected[5]="__libc_start_main[[:space:]]\($libc\)$" | ||
| 27 | expected[6]="_start[[:space:]]\(.*/bin/ping.*\)$" | ||
| 28 | ;; | 26 | ;; |
| 29 | *) | 27 | *) |
| 30 | eventattr='max-stack=3' | 28 | eventattr='max-stack=3' |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 3e87486c28fe..4cd2cf93f726 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
| @@ -930,8 +930,11 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, | |||
| 930 | * than leader in case leader 'leads' the sampling. | 930 | * than leader in case leader 'leads' the sampling. |
| 931 | */ | 931 | */ |
| 932 | if ((leader != evsel) && leader->sample_read) { | 932 | if ((leader != evsel) && leader->sample_read) { |
| 933 | attr->sample_freq = 0; | 933 | attr->freq = 0; |
| 934 | attr->sample_period = 0; | 934 | attr->sample_freq = 0; |
| 935 | attr->sample_period = 0; | ||
| 936 | attr->write_backward = 0; | ||
| 937 | attr->sample_id_all = 0; | ||
| 935 | } | 938 | } |
| 936 | 939 | ||
| 937 | if (opts->no_samples) | 940 | if (opts->no_samples) |
| @@ -1922,7 +1925,8 @@ try_fallback: | |||
| 1922 | goto fallback_missing_features; | 1925 | goto fallback_missing_features; |
| 1923 | } else if (!perf_missing_features.group_read && | 1926 | } else if (!perf_missing_features.group_read && |
| 1924 | evsel->attr.inherit && | 1927 | evsel->attr.inherit && |
| 1925 | (evsel->attr.read_format & PERF_FORMAT_GROUP)) { | 1928 | (evsel->attr.read_format & PERF_FORMAT_GROUP) && |
| 1929 | perf_evsel__is_group_leader(evsel)) { | ||
| 1926 | perf_missing_features.group_read = true; | 1930 | perf_missing_features.group_read = true; |
| 1927 | pr_debug2("switching off group read\n"); | 1931 | pr_debug2("switching off group read\n"); |
| 1928 | goto fallback_missing_features; | 1932 | goto fallback_missing_features; |
| @@ -2754,8 +2758,14 @@ bool perf_evsel__fallback(struct perf_evsel *evsel, int err, | |||
| 2754 | (paranoid = perf_event_paranoid()) > 1) { | 2758 | (paranoid = perf_event_paranoid()) > 1) { |
| 2755 | const char *name = perf_evsel__name(evsel); | 2759 | const char *name = perf_evsel__name(evsel); |
| 2756 | char *new_name; | 2760 | char *new_name; |
| 2761 | const char *sep = ":"; | ||
| 2757 | 2762 | ||
| 2758 | if (asprintf(&new_name, "%s%su", name, strchr(name, ':') ? "" : ":") < 0) | 2763 | /* Is there already the separator in the name. */ |
| 2764 | if (strchr(name, '/') || | ||
| 2765 | strchr(name, ':')) | ||
| 2766 | sep = ""; | ||
| 2767 | |||
| 2768 | if (asprintf(&new_name, "%s%su", name, sep) < 0) | ||
| 2759 | return false; | 2769 | return false; |
| 2760 | 2770 | ||
| 2761 | if (evsel->name) | 2771 | if (evsel->name) |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index d3ee3af618ef..92ec009a292d 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
| @@ -115,6 +115,7 @@ struct perf_evsel { | |||
| 115 | unsigned int sample_size; | 115 | unsigned int sample_size; |
| 116 | int id_pos; | 116 | int id_pos; |
| 117 | int is_pos; | 117 | int is_pos; |
| 118 | bool uniquified_name; | ||
| 118 | bool snapshot; | 119 | bool snapshot; |
| 119 | bool supported; | 120 | bool supported; |
| 120 | bool needs_swap; | 121 | bool needs_swap; |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 2eca8478e24f..32d50492505d 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
| @@ -1019,13 +1019,6 @@ int machine__load_vmlinux_path(struct machine *machine, enum map_type type) | |||
| 1019 | return ret; | 1019 | return ret; |
| 1020 | } | 1020 | } |
| 1021 | 1021 | ||
| 1022 | static void map_groups__fixup_end(struct map_groups *mg) | ||
| 1023 | { | ||
| 1024 | int i; | ||
| 1025 | for (i = 0; i < MAP__NR_TYPES; ++i) | ||
| 1026 | __map_groups__fixup_end(mg, i); | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | static char *get_kernel_version(const char *root_dir) | 1022 | static char *get_kernel_version(const char *root_dir) |
| 1030 | { | 1023 | { |
| 1031 | char version[PATH_MAX]; | 1024 | char version[PATH_MAX]; |
| @@ -1233,6 +1226,7 @@ int machine__create_kernel_maps(struct machine *machine) | |||
| 1233 | { | 1226 | { |
| 1234 | struct dso *kernel = machine__get_kernel(machine); | 1227 | struct dso *kernel = machine__get_kernel(machine); |
| 1235 | const char *name = NULL; | 1228 | const char *name = NULL; |
| 1229 | struct map *map; | ||
| 1236 | u64 addr = 0; | 1230 | u64 addr = 0; |
| 1237 | int ret; | 1231 | int ret; |
| 1238 | 1232 | ||
| @@ -1259,13 +1253,25 @@ int machine__create_kernel_maps(struct machine *machine) | |||
| 1259 | machine__destroy_kernel_maps(machine); | 1253 | machine__destroy_kernel_maps(machine); |
| 1260 | return -1; | 1254 | return -1; |
| 1261 | } | 1255 | } |
| 1262 | machine__set_kernel_mmap(machine, addr, 0); | 1256 | |
| 1257 | /* we have a real start address now, so re-order the kmaps */ | ||
| 1258 | map = machine__kernel_map(machine); | ||
| 1259 | |||
| 1260 | map__get(map); | ||
| 1261 | map_groups__remove(&machine->kmaps, map); | ||
| 1262 | |||
| 1263 | /* assume it's the last in the kmaps */ | ||
| 1264 | machine__set_kernel_mmap(machine, addr, ~0ULL); | ||
| 1265 | |||
| 1266 | map_groups__insert(&machine->kmaps, map); | ||
| 1267 | map__put(map); | ||
| 1263 | } | 1268 | } |
| 1264 | 1269 | ||
| 1265 | /* | 1270 | /* update end address of the kernel map using adjacent module address */ |
| 1266 | * Now that we have all the maps created, just set the ->end of them: | 1271 | map = map__next(machine__kernel_map(machine)); |
| 1267 | */ | 1272 | if (map) |
| 1268 | map_groups__fixup_end(&machine->kmaps); | 1273 | machine__set_kernel_mmap(machine, addr, map->start); |
| 1274 | |||
| 1269 | return 0; | 1275 | return 0; |
| 1270 | } | 1276 | } |
| 1271 | 1277 | ||
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 7afeb80cc39e..d14464c42714 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y | |||
| @@ -224,15 +224,15 @@ event_def: event_pmu | | |||
| 224 | event_bpf_file | 224 | event_bpf_file |
| 225 | 225 | ||
| 226 | event_pmu: | 226 | event_pmu: |
| 227 | PE_NAME opt_event_config | 227 | PE_NAME '/' event_config '/' |
| 228 | { | 228 | { |
| 229 | struct list_head *list, *orig_terms, *terms; | 229 | struct list_head *list, *orig_terms, *terms; |
| 230 | 230 | ||
| 231 | if (parse_events_copy_term_list($2, &orig_terms)) | 231 | if (parse_events_copy_term_list($3, &orig_terms)) |
| 232 | YYABORT; | 232 | YYABORT; |
| 233 | 233 | ||
| 234 | ALLOC_LIST(list); | 234 | ALLOC_LIST(list); |
| 235 | if (parse_events_add_pmu(_parse_state, list, $1, $2, false)) { | 235 | if (parse_events_add_pmu(_parse_state, list, $1, $3, false)) { |
| 236 | struct perf_pmu *pmu = NULL; | 236 | struct perf_pmu *pmu = NULL; |
| 237 | int ok = 0; | 237 | int ok = 0; |
| 238 | char *pattern; | 238 | char *pattern; |
| @@ -262,7 +262,7 @@ PE_NAME opt_event_config | |||
| 262 | if (!ok) | 262 | if (!ok) |
| 263 | YYABORT; | 263 | YYABORT; |
| 264 | } | 264 | } |
| 265 | parse_events_terms__delete($2); | 265 | parse_events_terms__delete($3); |
| 266 | parse_events_terms__delete(orig_terms); | 266 | parse_events_terms__delete(orig_terms); |
| 267 | $$ = list; | 267 | $$ = list; |
| 268 | } | 268 | } |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 61a5e5027338..d2fb597c9a8c 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c | |||
| @@ -539,9 +539,10 @@ static bool pmu_is_uncore(const char *name) | |||
| 539 | 539 | ||
| 540 | /* | 540 | /* |
| 541 | * PMU CORE devices have different name other than cpu in sysfs on some | 541 | * PMU CORE devices have different name other than cpu in sysfs on some |
| 542 | * platforms. looking for possible sysfs files to identify as core device. | 542 | * platforms. |
| 543 | * Looking for possible sysfs files to identify the arm core device. | ||
| 543 | */ | 544 | */ |
| 544 | static int is_pmu_core(const char *name) | 545 | static int is_arm_pmu_core(const char *name) |
| 545 | { | 546 | { |
| 546 | struct stat st; | 547 | struct stat st; |
| 547 | char path[PATH_MAX]; | 548 | char path[PATH_MAX]; |
| @@ -550,12 +551,6 @@ static int is_pmu_core(const char *name) | |||
| 550 | if (!sysfs) | 551 | if (!sysfs) |
| 551 | return 0; | 552 | return 0; |
| 552 | 553 | ||
| 553 | /* Look for cpu sysfs (x86 and others) */ | ||
| 554 | scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs); | ||
| 555 | if ((stat(path, &st) == 0) && | ||
| 556 | (strncmp(name, "cpu", strlen("cpu")) == 0)) | ||
| 557 | return 1; | ||
| 558 | |||
| 559 | /* Look for cpu sysfs (specific to arm) */ | 554 | /* Look for cpu sysfs (specific to arm) */ |
| 560 | scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus", | 555 | scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus", |
| 561 | sysfs, name); | 556 | sysfs, name); |
| @@ -586,7 +581,7 @@ char * __weak get_cpuid_str(struct perf_pmu *pmu __maybe_unused) | |||
| 586 | * cpuid string generated on this platform. | 581 | * cpuid string generated on this platform. |
| 587 | * Otherwise return non-zero. | 582 | * Otherwise return non-zero. |
| 588 | */ | 583 | */ |
| 589 | int __weak strcmp_cpuid_str(const char *mapcpuid, const char *cpuid) | 584 | int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid) |
| 590 | { | 585 | { |
| 591 | regex_t re; | 586 | regex_t re; |
| 592 | regmatch_t pmatch[1]; | 587 | regmatch_t pmatch[1]; |
| @@ -668,6 +663,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) | |||
| 668 | struct pmu_events_map *map; | 663 | struct pmu_events_map *map; |
| 669 | struct pmu_event *pe; | 664 | struct pmu_event *pe; |
| 670 | const char *name = pmu->name; | 665 | const char *name = pmu->name; |
| 666 | const char *pname; | ||
| 671 | 667 | ||
| 672 | map = perf_pmu__find_map(pmu); | 668 | map = perf_pmu__find_map(pmu); |
| 673 | if (!map) | 669 | if (!map) |
| @@ -686,11 +682,9 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) | |||
| 686 | break; | 682 | break; |
| 687 | } | 683 | } |
| 688 | 684 | ||
| 689 | if (!is_pmu_core(name)) { | 685 | if (!is_arm_pmu_core(name)) { |
| 690 | /* check for uncore devices */ | 686 | pname = pe->pmu ? pe->pmu : "cpu"; |
| 691 | if (pe->pmu == NULL) | 687 | if (strncmp(pname, name, strlen(pname))) |
| 692 | continue; | ||
| 693 | if (strncmp(pe->pmu, name, strlen(pe->pmu))) | ||
| 694 | continue; | 688 | continue; |
| 695 | } | 689 | } |
| 696 | 690 | ||
diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore index 9cf83f895d98..5e1ab2f0eb79 100644 --- a/tools/testing/selftests/bpf/.gitignore +++ b/tools/testing/selftests/bpf/.gitignore | |||
| @@ -12,3 +12,6 @@ test_tcpbpf_user | |||
| 12 | test_verifier_log | 12 | test_verifier_log |
| 13 | feature | 13 | feature |
| 14 | test_libbpf_open | 14 | test_libbpf_open |
| 15 | test_sock | ||
| 16 | test_sock_addr | ||
| 17 | urandom_read | ||
diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c index 73bb20cfb9b7..f4d99fabc56d 100644 --- a/tools/testing/selftests/bpf/test_sock.c +++ b/tools/testing/selftests/bpf/test_sock.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <bpf/bpf.h> | 13 | #include <bpf/bpf.h> |
| 14 | 14 | ||
| 15 | #include "cgroup_helpers.h" | 15 | #include "cgroup_helpers.h" |
| 16 | #include "bpf_rlimit.h" | ||
| 16 | 17 | ||
| 17 | #ifndef ARRAY_SIZE | 18 | #ifndef ARRAY_SIZE |
| 18 | # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 19 | # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
diff --git a/tools/testing/selftests/bpf/test_sock_addr.c b/tools/testing/selftests/bpf/test_sock_addr.c index d488f20926e8..2950f80ba7fb 100644 --- a/tools/testing/selftests/bpf/test_sock_addr.c +++ b/tools/testing/selftests/bpf/test_sock_addr.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <bpf/libbpf.h> | 15 | #include <bpf/libbpf.h> |
| 16 | 16 | ||
| 17 | #include "cgroup_helpers.h" | 17 | #include "cgroup_helpers.h" |
| 18 | #include "bpf_rlimit.h" | ||
| 18 | 19 | ||
| 19 | #define CG_PATH "/foo" | 20 | #define CG_PATH "/foo" |
| 20 | #define CONNECT4_PROG_PATH "./connect4_prog.o" | 21 | #define CONNECT4_PROG_PATH "./connect4_prog.o" |
diff --git a/tools/testing/selftests/bpf/test_sock_addr.sh b/tools/testing/selftests/bpf/test_sock_addr.sh index c6e1dcf992c4..9832a875a828 100755 --- a/tools/testing/selftests/bpf/test_sock_addr.sh +++ b/tools/testing/selftests/bpf/test_sock_addr.sh | |||
| @@ -4,7 +4,7 @@ set -eu | |||
| 4 | 4 | ||
| 5 | ping_once() | 5 | ping_once() |
| 6 | { | 6 | { |
| 7 | ping -q -c 1 -W 1 ${1%%/*} >/dev/null 2>&1 | 7 | ping -${1} -q -c 1 -W 1 ${2%%/*} >/dev/null 2>&1 |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | wait_for_ip() | 10 | wait_for_ip() |
| @@ -13,7 +13,7 @@ wait_for_ip() | |||
| 13 | echo -n "Wait for testing IPv4/IPv6 to become available " | 13 | echo -n "Wait for testing IPv4/IPv6 to become available " |
| 14 | for _i in $(seq ${MAX_PING_TRIES}); do | 14 | for _i in $(seq ${MAX_PING_TRIES}); do |
| 15 | echo -n "." | 15 | echo -n "." |
| 16 | if ping_once ${TEST_IPv4} && ping_once ${TEST_IPv6}; then | 16 | if ping_once 4 ${TEST_IPv4} && ping_once 6 ${TEST_IPv6}; then |
| 17 | echo " OK" | 17 | echo " OK" |
| 18 | return | 18 | return |
| 19 | fi | 19 | fi |
diff --git a/tools/testing/selftests/firmware/Makefile b/tools/testing/selftests/firmware/Makefile index 826f38d5dd19..261c81f08606 100644 --- a/tools/testing/selftests/firmware/Makefile +++ b/tools/testing/selftests/firmware/Makefile | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | all: | 4 | all: |
| 5 | 5 | ||
| 6 | TEST_PROGS := fw_run_tests.sh | 6 | TEST_PROGS := fw_run_tests.sh |
| 7 | TEST_FILES := fw_fallback.sh fw_filesystem.sh fw_lib.sh | ||
| 7 | 8 | ||
| 8 | include ../lib.mk | 9 | include ../lib.mk |
| 9 | 10 | ||
diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh index 9ea31b57d71a..962d7f4ac627 100755 --- a/tools/testing/selftests/firmware/fw_lib.sh +++ b/tools/testing/selftests/firmware/fw_lib.sh | |||
| @@ -154,11 +154,13 @@ test_finish() | |||
| 154 | if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then | 154 | if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then |
| 155 | echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout | 155 | echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout |
| 156 | fi | 156 | fi |
| 157 | if [ "$OLD_FWPATH" = "" ]; then | ||
| 158 | OLD_FWPATH=" " | ||
| 159 | fi | ||
| 160 | if [ "$TEST_REQS_FW_SET_CUSTOM_PATH" = "yes" ]; then | 157 | if [ "$TEST_REQS_FW_SET_CUSTOM_PATH" = "yes" ]; then |
| 161 | echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path | 158 | if [ "$OLD_FWPATH" = "" ]; then |
| 159 | # A zero-length write won't work; write a null byte | ||
| 160 | printf '\000' >/sys/module/firmware_class/parameters/path | ||
| 161 | else | ||
| 162 | echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path | ||
| 163 | fi | ||
| 162 | fi | 164 | fi |
| 163 | if [ -f $FW ]; then | 165 | if [ -f $FW ]; then |
| 164 | rm -f "$FW" | 166 | rm -f "$FW" |
diff --git a/tools/testing/selftests/firmware/fw_run_tests.sh b/tools/testing/selftests/firmware/fw_run_tests.sh index 06d638e9dc62..cffdd4eb0a57 100755 --- a/tools/testing/selftests/firmware/fw_run_tests.sh +++ b/tools/testing/selftests/firmware/fw_run_tests.sh | |||
| @@ -66,5 +66,5 @@ if [ -f $FW_FORCE_SYSFS_FALLBACK ]; then | |||
| 66 | run_test_config_0003 | 66 | run_test_config_0003 |
| 67 | else | 67 | else |
| 68 | echo "Running basic kernel configuration, working with your config" | 68 | echo "Running basic kernel configuration, working with your config" |
| 69 | run_test | 69 | run_tests |
| 70 | fi | 70 | fi |
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc index 786dce7e48be..2aabab363cfb 100644 --- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc | |||
| @@ -29,7 +29,7 @@ do_reset | |||
| 29 | 29 | ||
| 30 | echo "Test extended error support" | 30 | echo "Test extended error support" |
| 31 | echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger | 31 | echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger |
| 32 | echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger &>/dev/null | 32 | ! echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger 2> /dev/null |
| 33 | if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then | 33 | if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then |
| 34 | fail "Failed to generate extended error in histogram" | 34 | fail "Failed to generate extended error in histogram" |
| 35 | fi | 35 | fi |
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc new file mode 100644 index 000000000000..c193dce611a2 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # description: event trigger - test multiple actions on hist trigger | ||
| 3 | |||
| 4 | |||
| 5 | do_reset() { | ||
| 6 | reset_trigger | ||
| 7 | echo > set_event | ||
| 8 | clear_trace | ||
| 9 | } | ||
| 10 | |||
| 11 | fail() { #msg | ||
| 12 | do_reset | ||
| 13 | echo $1 | ||
| 14 | exit_fail | ||
| 15 | } | ||
| 16 | |||
| 17 | if [ ! -f set_event ]; then | ||
| 18 | echo "event tracing is not supported" | ||
| 19 | exit_unsupported | ||
| 20 | fi | ||
| 21 | |||
| 22 | if [ ! -f synthetic_events ]; then | ||
| 23 | echo "synthetic event is not supported" | ||
| 24 | exit_unsupported | ||
| 25 | fi | ||
| 26 | |||
| 27 | clear_synthetic_events | ||
| 28 | reset_tracer | ||
| 29 | do_reset | ||
| 30 | |||
| 31 | echo "Test multiple actions on hist trigger" | ||
| 32 | echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events | ||
| 33 | TRIGGER1=events/sched/sched_wakeup/trigger | ||
| 34 | TRIGGER2=events/sched/sched_switch/trigger | ||
| 35 | |||
| 36 | echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' > $TRIGGER1 | ||
| 37 | echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0 if next_comm=="cyclictest"' >> $TRIGGER2 | ||
| 38 | echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest"' >> $TRIGGER2 | ||
| 39 | echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> $TRIGGER2 | ||
| 40 | echo 'hist:keys=next_pid if next_comm=="cyclictest"' >> $TRIGGER2 | ||
| 41 | |||
| 42 | do_reset | ||
| 43 | |||
| 44 | exit 0 | ||
diff --git a/tools/testing/selftests/x86/test_syscall_vdso.c b/tools/testing/selftests/x86/test_syscall_vdso.c index 40370354d4c1..c9c3281077bc 100644 --- a/tools/testing/selftests/x86/test_syscall_vdso.c +++ b/tools/testing/selftests/x86/test_syscall_vdso.c | |||
| @@ -100,12 +100,19 @@ asm ( | |||
| 100 | " shl $32, %r8\n" | 100 | " shl $32, %r8\n" |
| 101 | " orq $0x7f7f7f7f, %r8\n" | 101 | " orq $0x7f7f7f7f, %r8\n" |
| 102 | " movq %r8, %r9\n" | 102 | " movq %r8, %r9\n" |
| 103 | " movq %r8, %r10\n" | 103 | " incq %r9\n" |
| 104 | " movq %r8, %r11\n" | 104 | " movq %r9, %r10\n" |
| 105 | " movq %r8, %r12\n" | 105 | " incq %r10\n" |
| 106 | " movq %r8, %r13\n" | 106 | " movq %r10, %r11\n" |
| 107 | " movq %r8, %r14\n" | 107 | " incq %r11\n" |
| 108 | " movq %r8, %r15\n" | 108 | " movq %r11, %r12\n" |
| 109 | " incq %r12\n" | ||
| 110 | " movq %r12, %r13\n" | ||
| 111 | " incq %r13\n" | ||
| 112 | " movq %r13, %r14\n" | ||
| 113 | " incq %r14\n" | ||
| 114 | " movq %r14, %r15\n" | ||
| 115 | " incq %r15\n" | ||
| 109 | " ret\n" | 116 | " ret\n" |
| 110 | " .code32\n" | 117 | " .code32\n" |
| 111 | " .popsection\n" | 118 | " .popsection\n" |
| @@ -128,12 +135,13 @@ int check_regs64(void) | |||
| 128 | int err = 0; | 135 | int err = 0; |
| 129 | int num = 8; | 136 | int num = 8; |
| 130 | uint64_t *r64 = ®s64.r8; | 137 | uint64_t *r64 = ®s64.r8; |
| 138 | uint64_t expected = 0x7f7f7f7f7f7f7f7fULL; | ||
| 131 | 139 | ||
| 132 | if (!kernel_is_64bit) | 140 | if (!kernel_is_64bit) |
| 133 | return 0; | 141 | return 0; |
| 134 | 142 | ||
| 135 | do { | 143 | do { |
| 136 | if (*r64 == 0x7f7f7f7f7f7f7f7fULL) | 144 | if (*r64 == expected++) |
| 137 | continue; /* register did not change */ | 145 | continue; /* register did not change */ |
| 138 | if (syscall_addr != (long)&int80) { | 146 | if (syscall_addr != (long)&int80) { |
| 139 | /* | 147 | /* |
| @@ -147,18 +155,17 @@ int check_regs64(void) | |||
| 147 | continue; | 155 | continue; |
| 148 | } | 156 | } |
| 149 | } else { | 157 | } else { |
| 150 | /* INT80 syscall entrypoint can be used by | 158 | /* |
| 159 | * INT80 syscall entrypoint can be used by | ||
| 151 | * 64-bit programs too, unlike SYSCALL/SYSENTER. | 160 | * 64-bit programs too, unlike SYSCALL/SYSENTER. |
| 152 | * Therefore it must preserve R12+ | 161 | * Therefore it must preserve R12+ |
| 153 | * (they are callee-saved registers in 64-bit C ABI). | 162 | * (they are callee-saved registers in 64-bit C ABI). |
| 154 | * | 163 | * |
| 155 | * This was probably historically not intended, | 164 | * Starting in Linux 4.17 (and any kernel that |
| 156 | * but R8..11 are clobbered (cleared to 0). | 165 | * backports the change), R8..11 are preserved. |
| 157 | * IOW: they are the only registers which aren't | 166 | * Historically (and probably unintentionally), they |
| 158 | * preserved across INT80 syscall. | 167 | * were clobbered or zeroed. |
| 159 | */ | 168 | */ |
| 160 | if (*r64 == 0 && num <= 11) | ||
| 161 | continue; | ||
| 162 | } | 169 | } |
| 163 | printf("[FAIL]\tR%d has changed:%016llx\n", num, *r64); | 170 | printf("[FAIL]\tR%d has changed:%016llx\n", num, *r64); |
| 164 | err++; | 171 | err++; |
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index dba629c5f8ac..a4c1b76240df 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c | |||
| @@ -63,7 +63,7 @@ static DEFINE_PER_CPU(struct kvm_vcpu *, kvm_arm_running_vcpu); | |||
| 63 | static atomic64_t kvm_vmid_gen = ATOMIC64_INIT(1); | 63 | static atomic64_t kvm_vmid_gen = ATOMIC64_INIT(1); |
| 64 | static u32 kvm_next_vmid; | 64 | static u32 kvm_next_vmid; |
| 65 | static unsigned int kvm_vmid_bits __read_mostly; | 65 | static unsigned int kvm_vmid_bits __read_mostly; |
| 66 | static DEFINE_SPINLOCK(kvm_vmid_lock); | 66 | static DEFINE_RWLOCK(kvm_vmid_lock); |
| 67 | 67 | ||
| 68 | static bool vgic_present; | 68 | static bool vgic_present; |
| 69 | 69 | ||
| @@ -473,11 +473,16 @@ static void update_vttbr(struct kvm *kvm) | |||
| 473 | { | 473 | { |
| 474 | phys_addr_t pgd_phys; | 474 | phys_addr_t pgd_phys; |
| 475 | u64 vmid; | 475 | u64 vmid; |
| 476 | bool new_gen; | ||
| 476 | 477 | ||
| 477 | if (!need_new_vmid_gen(kvm)) | 478 | read_lock(&kvm_vmid_lock); |
| 479 | new_gen = need_new_vmid_gen(kvm); | ||
| 480 | read_unlock(&kvm_vmid_lock); | ||
| 481 | |||
| 482 | if (!new_gen) | ||
| 478 | return; | 483 | return; |
| 479 | 484 | ||
| 480 | spin_lock(&kvm_vmid_lock); | 485 | write_lock(&kvm_vmid_lock); |
| 481 | 486 | ||
| 482 | /* | 487 | /* |
| 483 | * We need to re-check the vmid_gen here to ensure that if another vcpu | 488 | * We need to re-check the vmid_gen here to ensure that if another vcpu |
| @@ -485,7 +490,7 @@ static void update_vttbr(struct kvm *kvm) | |||
| 485 | * use the same vmid. | 490 | * use the same vmid. |
| 486 | */ | 491 | */ |
| 487 | if (!need_new_vmid_gen(kvm)) { | 492 | if (!need_new_vmid_gen(kvm)) { |
| 488 | spin_unlock(&kvm_vmid_lock); | 493 | write_unlock(&kvm_vmid_lock); |
| 489 | return; | 494 | return; |
| 490 | } | 495 | } |
| 491 | 496 | ||
| @@ -519,7 +524,7 @@ static void update_vttbr(struct kvm *kvm) | |||
| 519 | vmid = ((u64)(kvm->arch.vmid) << VTTBR_VMID_SHIFT) & VTTBR_VMID_MASK(kvm_vmid_bits); | 524 | vmid = ((u64)(kvm->arch.vmid) << VTTBR_VMID_SHIFT) & VTTBR_VMID_MASK(kvm_vmid_bits); |
| 520 | kvm->arch.vttbr = kvm_phys_to_vttbr(pgd_phys) | vmid; | 525 | kvm->arch.vttbr = kvm_phys_to_vttbr(pgd_phys) | vmid; |
| 521 | 526 | ||
| 522 | spin_unlock(&kvm_vmid_lock); | 527 | write_unlock(&kvm_vmid_lock); |
| 523 | } | 528 | } |
| 524 | 529 | ||
| 525 | static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) | 530 | static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) |
diff --git a/virt/kvm/arm/psci.c b/virt/kvm/arm/psci.c index 6919352cbf15..c4762bef13c6 100644 --- a/virt/kvm/arm/psci.c +++ b/virt/kvm/arm/psci.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/arm-smccc.h> | 18 | #include <linux/arm-smccc.h> |
| 19 | #include <linux/preempt.h> | 19 | #include <linux/preempt.h> |
| 20 | #include <linux/kvm_host.h> | 20 | #include <linux/kvm_host.h> |
| 21 | #include <linux/uaccess.h> | ||
| 21 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
| 22 | 23 | ||
| 23 | #include <asm/cputype.h> | 24 | #include <asm/cputype.h> |
| @@ -427,3 +428,62 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) | |||
| 427 | smccc_set_retval(vcpu, val, 0, 0, 0); | 428 | smccc_set_retval(vcpu, val, 0, 0, 0); |
| 428 | return 1; | 429 | return 1; |
| 429 | } | 430 | } |
| 431 | |||
| 432 | int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu) | ||
| 433 | { | ||
| 434 | return 1; /* PSCI version */ | ||
| 435 | } | ||
| 436 | |||
| 437 | int kvm_arm_copy_fw_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices) | ||
| 438 | { | ||
| 439 | if (put_user(KVM_REG_ARM_PSCI_VERSION, uindices)) | ||
| 440 | return -EFAULT; | ||
| 441 | |||
| 442 | return 0; | ||
| 443 | } | ||
| 444 | |||
| 445 | int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) | ||
| 446 | { | ||
| 447 | if (reg->id == KVM_REG_ARM_PSCI_VERSION) { | ||
| 448 | void __user *uaddr = (void __user *)(long)reg->addr; | ||
| 449 | u64 val; | ||
| 450 | |||
| 451 | val = kvm_psci_version(vcpu, vcpu->kvm); | ||
| 452 | if (copy_to_user(uaddr, &val, KVM_REG_SIZE(reg->id))) | ||
| 453 | return -EFAULT; | ||
| 454 | |||
| 455 | return 0; | ||
| 456 | } | ||
| 457 | |||
| 458 | return -EINVAL; | ||
| 459 | } | ||
| 460 | |||
| 461 | int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) | ||
| 462 | { | ||
| 463 | if (reg->id == KVM_REG_ARM_PSCI_VERSION) { | ||
| 464 | void __user *uaddr = (void __user *)(long)reg->addr; | ||
| 465 | bool wants_02; | ||
| 466 | u64 val; | ||
| 467 | |||
| 468 | if (copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id))) | ||
| 469 | return -EFAULT; | ||
| 470 | |||
| 471 | wants_02 = test_bit(KVM_ARM_VCPU_PSCI_0_2, vcpu->arch.features); | ||
| 472 | |||
| 473 | switch (val) { | ||
| 474 | case KVM_ARM_PSCI_0_1: | ||
| 475 | if (wants_02) | ||
| 476 | return -EINVAL; | ||
| 477 | vcpu->kvm->arch.psci_version = val; | ||
| 478 | return 0; | ||
| 479 | case KVM_ARM_PSCI_0_2: | ||
| 480 | case KVM_ARM_PSCI_1_0: | ||
| 481 | if (!wants_02) | ||
| 482 | return -EINVAL; | ||
| 483 | vcpu->kvm->arch.psci_version = val; | ||
| 484 | return 0; | ||
| 485 | } | ||
| 486 | } | ||
| 487 | |||
| 488 | return -EINVAL; | ||
| 489 | } | ||
diff --git a/virt/kvm/arm/vgic/vgic-mmio-v2.c b/virt/kvm/arm/vgic/vgic-mmio-v2.c index e21e2f49b005..ffc587bf4742 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v2.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v2.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | #include <linux/irqchip/arm-gic.h> | 14 | #include <linux/irqchip/arm-gic.h> |
| 15 | #include <linux/kvm.h> | 15 | #include <linux/kvm.h> |
| 16 | #include <linux/kvm_host.h> | 16 | #include <linux/kvm_host.h> |
| 17 | #include <linux/nospec.h> | ||
| 18 | |||
| 17 | #include <kvm/iodev.h> | 19 | #include <kvm/iodev.h> |
| 18 | #include <kvm/arm_vgic.h> | 20 | #include <kvm/arm_vgic.h> |
| 19 | 21 | ||
| @@ -324,6 +326,9 @@ static unsigned long vgic_mmio_read_apr(struct kvm_vcpu *vcpu, | |||
| 324 | 326 | ||
| 325 | if (n > vgic_v3_max_apr_idx(vcpu)) | 327 | if (n > vgic_v3_max_apr_idx(vcpu)) |
| 326 | return 0; | 328 | return 0; |
| 329 | |||
| 330 | n = array_index_nospec(n, 4); | ||
| 331 | |||
| 327 | /* GICv3 only uses ICH_AP1Rn for memory mapped (GICv2) guests */ | 332 | /* GICv3 only uses ICH_AP1Rn for memory mapped (GICv2) guests */ |
| 328 | return vgicv3->vgic_ap1r[n]; | 333 | return vgicv3->vgic_ap1r[n]; |
| 329 | } | 334 | } |
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index e74baec76361..702936cbe173 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c | |||
| @@ -14,11 +14,13 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <linux/interrupt.h> | ||
| 18 | #include <linux/irq.h> | ||
| 17 | #include <linux/kvm.h> | 19 | #include <linux/kvm.h> |
| 18 | #include <linux/kvm_host.h> | 20 | #include <linux/kvm_host.h> |
| 19 | #include <linux/list_sort.h> | 21 | #include <linux/list_sort.h> |
| 20 | #include <linux/interrupt.h> | 22 | #include <linux/nospec.h> |
| 21 | #include <linux/irq.h> | 23 | |
| 22 | #include <asm/kvm_hyp.h> | 24 | #include <asm/kvm_hyp.h> |
| 23 | 25 | ||
| 24 | #include "vgic.h" | 26 | #include "vgic.h" |
| @@ -101,12 +103,16 @@ struct vgic_irq *vgic_get_irq(struct kvm *kvm, struct kvm_vcpu *vcpu, | |||
| 101 | u32 intid) | 103 | u32 intid) |
| 102 | { | 104 | { |
| 103 | /* SGIs and PPIs */ | 105 | /* SGIs and PPIs */ |
| 104 | if (intid <= VGIC_MAX_PRIVATE) | 106 | if (intid <= VGIC_MAX_PRIVATE) { |
| 107 | intid = array_index_nospec(intid, VGIC_MAX_PRIVATE); | ||
| 105 | return &vcpu->arch.vgic_cpu.private_irqs[intid]; | 108 | return &vcpu->arch.vgic_cpu.private_irqs[intid]; |
| 109 | } | ||
| 106 | 110 | ||
| 107 | /* SPIs */ | 111 | /* SPIs */ |
| 108 | if (intid <= VGIC_MAX_SPI) | 112 | if (intid <= VGIC_MAX_SPI) { |
| 113 | intid = array_index_nospec(intid, VGIC_MAX_SPI); | ||
| 109 | return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS]; | 114 | return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS]; |
| 115 | } | ||
| 110 | 116 | ||
| 111 | /* LPIs */ | 117 | /* LPIs */ |
| 112 | if (intid >= VGIC_MIN_LPI) | 118 | if (intid >= VGIC_MIN_LPI) |
| @@ -594,6 +600,7 @@ retry: | |||
| 594 | 600 | ||
| 595 | list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) { | 601 | list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) { |
| 596 | struct kvm_vcpu *target_vcpu, *vcpuA, *vcpuB; | 602 | struct kvm_vcpu *target_vcpu, *vcpuA, *vcpuB; |
| 603 | bool target_vcpu_needs_kick = false; | ||
| 597 | 604 | ||
| 598 | spin_lock(&irq->irq_lock); | 605 | spin_lock(&irq->irq_lock); |
| 599 | 606 | ||
| @@ -664,11 +671,18 @@ retry: | |||
| 664 | list_del(&irq->ap_list); | 671 | list_del(&irq->ap_list); |
| 665 | irq->vcpu = target_vcpu; | 672 | irq->vcpu = target_vcpu; |
| 666 | list_add_tail(&irq->ap_list, &new_cpu->ap_list_head); | 673 | list_add_tail(&irq->ap_list, &new_cpu->ap_list_head); |
| 674 | target_vcpu_needs_kick = true; | ||
| 667 | } | 675 | } |
| 668 | 676 | ||
| 669 | spin_unlock(&irq->irq_lock); | 677 | spin_unlock(&irq->irq_lock); |
| 670 | spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock); | 678 | spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock); |
| 671 | spin_unlock_irqrestore(&vcpuA->arch.vgic_cpu.ap_list_lock, flags); | 679 | spin_unlock_irqrestore(&vcpuA->arch.vgic_cpu.ap_list_lock, flags); |
| 680 | |||
| 681 | if (target_vcpu_needs_kick) { | ||
| 682 | kvm_make_request(KVM_REQ_IRQ_PENDING, target_vcpu); | ||
| 683 | kvm_vcpu_kick(target_vcpu); | ||
| 684 | } | ||
| 685 | |||
| 672 | goto retry; | 686 | goto retry; |
| 673 | } | 687 | } |
| 674 | 688 | ||
