Unified · Split
| @@ -794,6 +794,7 @@ Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer". · 793 unmodified lines | ||
| 794 | 794 | <http://www.kroah.com/log/linux/maintainer-03.html> |
| 795 | 795 | <http://www.kroah.com/log/linux/maintainer-04.html> |
| 796 | 796 | <http://www.kroah.com/log/linux/maintainer-05.html> |
| 797 | + <http://www.kroah.com/log/linux/maintainer-06.html> | |
| 797 | 798 | |
| 798 | 799 | NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people! |
| 799 | 800 | <https://lkml.org/lkml/2005/7/11/336> |
| @@ -15,6 +15,17 @@ Optional properties for main touchpad device: · 14 unmodified lines | ||
| 15 | 15 | keycode generated by each GPIO. Linux keycodes are defined in |
| 16 | 16 | <dt-bindings/input/input.h>. |
| 17 | 17 | |
| 18 | +- linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages | |
| 19 | + on GPIO bit changes. An array of up to 8 entries can be provided | |
| 20 | + indicating the Linux keycode mapped to each bit of the status byte, | |
| 21 | + starting at the LSB. Linux keycodes are defined in | |
| 22 | + <dt-bindings/input/input.h>. | |
| 23 | + | |
| 24 | + Note: the numbering of the GPIOs and the bit they start at varies between | |
| 25 | + maXTouch devices. You must either refer to the documentation, or | |
| 26 | + experiment to determine which bit corresponds to which input. Use | |
| 27 | + KEY_RESERVED for unused padding values. | |
| 28 | + | |
| 18 | 29 | Example: |
| 19 | 30 | |
| 20 | 31 | touch@4b { |
| @@ -0,0 +1,107 @@ | ||
| 1 | +* Toshiba TC3589x multi-purpose expander | |
| 2 | + | |
| 3 | +The Toshiba TC3589x series are I2C-based MFD devices which may expose the | |
| 4 | +following built-in devices: gpio, keypad, rotator (vibrator), PWM (for | |
| 5 | +e.g. LEDs or vibrators) The included models are: | |
| 6 | + | |
| 7 | +- TC35890 | |
| 8 | +- TC35892 | |
| 9 | +- TC35893 | |
| 10 | +- TC35894 | |
| 11 | +- TC35895 | |
| 12 | +- TC35896 | |
| 13 | + | |
| 14 | +Required properties: | |
| 15 | + - compatible : must be "toshiba,tc35890", "toshiba,tc35892", "toshiba,tc35893", | |
| 16 | + "toshiba,tc35894", "toshiba,tc35895" or "toshiba,tc35896" | |
| 17 | + - reg : I2C address of the device | |
| 18 | + - interrupt-parent : specifies which IRQ controller we're connected to | |
| 19 | + - interrupts : the interrupt on the parent the controller is connected to | |
| 20 | + - interrupt-controller : marks the device node as an interrupt controller | |
| 21 | + - #interrupt-cells : should be <1>, the first cell is the IRQ offset on this | |
| 22 | + TC3589x interrupt controller. | |
| 23 | + | |
| 24 | +Optional nodes: | |
| 25 | + | |
| 26 | +- GPIO | |
| 27 | + This GPIO module inside the TC3589x has 24 (TC35890, TC35892) or 20 | |
| 28 | + (other models) GPIO lines. | |
| 29 | + - compatible : must be "toshiba,tc3589x-gpio" | |
| 30 | + - interrupts : interrupt on the parent, which must be the tc3589x MFD device | |
| 31 | + - interrupt-controller : marks the device node as an interrupt controller | |
| 32 | + - #interrupt-cells : should be <2>, the first cell is the IRQ offset on this | |
| 33 | + TC3589x GPIO interrupt controller, the second cell is the interrupt flags | |
| 34 | + in accordance with <dt-bindings/interrupt-controller/irq.h>. The following | |
| 35 | + flags are valid: | |
| 36 | + - IRQ_TYPE_LEVEL_LOW | |
| 37 | + - IRQ_TYPE_LEVEL_HIGH | |
| 38 | + - IRQ_TYPE_EDGE_RISING | |
| 39 | + - IRQ_TYPE_EDGE_FALLING | |
| 40 | + - IRQ_TYPE_EDGE_BOTH | |
| 41 | + - gpio-controller : marks the device node as a GPIO controller | |
| 42 | + - #gpio-cells : should be <2>, the first cell is the GPIO offset on this | |
| 43 | + GPIO controller, the second cell is the flags. | |
| 44 | + | |
| 45 | +- Keypad | |
| 46 | + This keypad is the same on all variants, supporting up to 96 different | |
| 47 | + keys. The linux-specific properties are modeled on those already existing | |
| 48 | + in other input drivers. | |
| 49 | + - compatible : must be "toshiba,tc3589x-keypad" | |
| 50 | + - debounce-delay-ms : debounce interval in milliseconds | |
| 51 | + - keypad,num-rows : number of rows in the matrix, see | |
| 52 | + bindings/input/matrix-keymap.txt | |
| 53 | + - keypad,num-columns : number of columns in the matrix, see | |
| 54 | + bindings/input/matrix-keymap.txt | |
| 55 | + - linux,keymap: the definition can be found in | |
| 56 | + bindings/input/matrix-keymap.txt | |
| 57 | + - linux,no-autorepeat: do no enable autorepeat feature. | |
| 58 | + - linux,wakeup: use any event on keypad as wakeup event. | |
| 59 | + | |
| 60 | +Example: | |
| 61 | + | |
| 62 | +tc35893@44 { | |
| 63 | + compatible = "toshiba,tc35893"; | |
| 64 | + reg = <0x44>; | |
| 65 | + interrupt-parent = <&gpio6>; | |
| 66 | + interrupts = <26 IRQ_TYPE_EDGE_RISING>; | |
| 67 | + | |
| 68 | + interrupt-controller; | |
| 69 | + #interrupt-cells = <1>; | |
| 70 | + | |
| 71 | + tc3589x_gpio { | |
| 72 | + compatible = "toshiba,tc3589x-gpio"; | |
| 73 | + interrupts = <0>; | |
| 74 | + | |
| 75 | + interrupt-controller; | |
| 76 | + #interrupt-cells = <2>; | |
| 77 | + gpio-controller; | |
| 78 | + #gpio-cells = <2>; | |
| 79 | + }; | |
| 80 | + tc3589x_keypad { | |
| 81 | + compatible = "toshiba,tc3589x-keypad"; | |
| 82 | + interrupts = <6>; | |
| 83 | + debounce-delay-ms = <4>; | |
| 84 | + keypad,num-columns = <8>; | |
| 85 | + keypad,num-rows = <8>; | |
| 86 | + linux,no-autorepeat; | |
| 87 | + linux,wakeup; | |
| 88 | + linux,keymap = <0x0301006b | |
| 89 | + 0x04010066 | |
| 90 | + 0x06040072 | |
| 91 | + 0x040200d7 | |
| 92 | + 0x0303006a | |
| 93 | + 0x0205000e | |
| 94 | + 0x0607008b | |
| 95 | + 0x0500001c | |
| 96 | + 0x0403000b | |
| 97 | + 0x03040034 | |
| 98 | + 0x05020067 | |
| 99 | + 0x0305006c | |
| 100 | + 0x040500e7 | |
| 101 | + 0x0005009e | |
| 102 | + 0x06020073 | |
| 103 | + 0x01030039 | |
| 104 | + 0x07060069 | |
| 105 | + 0x050500d9>; | |
| 106 | + }; | |
| 107 | +}; | |
| @@ -22,7 +22,7 @@ Optional properties: · 21 unmodified lines | ||
| 22 | 22 | width of 8 is assumed. |
| 23 | 23 | |
| 24 | 24 | - ti,nand-ecc-opt: A string setting the ECC layout to use. One of: |
| 25 | − "sw" <deprecated> use "ham1" instead | |
| 25 | + "sw" 1-bit Hamming ecc code via software | |
| 26 | 26 | "hw" <deprecated> use "ham1" instead |
| 27 | 27 | "hw-romcode" <deprecated> use "ham1" instead |
| 28 | 28 | "ham1" 1-bit Hamming ecc code |
| @@ -39,6 +39,10 @@ Optional properties: · 38 unmodified lines | ||
| 39 | 39 | further clocks may be specified in derived bindings. |
| 40 | 40 | - clock-names: One name for each entry in the clocks property, the |
| 41 | 41 | first one should be "stmmaceth". |
| 42 | +- clk_ptp_ref: this is the PTP reference clock; in case of the PTP is | |
| 43 | + available this clock is used for programming the Timestamp Addend Register. | |
| 44 | + If not passed then the system clock will be used and this is fine on some | |
| 45 | + platforms. | |
| 42 | 46 | |
| 43 | 47 | Examples: |
| 44 | 48 | |
| @@ -62,7 +62,7 @@ Example: · 61 unmodified lines | ||
| 62 | 62 | #gpio-cells = <2>; |
| 63 | 63 | interrupt-controller; |
| 64 | 64 | #interrupt-cells = <2>; |
| 65 | − interrupts = <0 32 0x4>; | |
| 65 | + interrupts = <0 16 0x4>; | |
| 66 | 66 | |
| 67 | 67 | pinctrl-names = "default"; |
| 68 | 68 | pinctrl-0 = <&gsbi5_uart_default>; |
| @@ -45,8 +45,8 @@ Example: · 44 unmodified lines | ||
| 45 | 45 | infet5-supply = <&some_reg>; |
| 46 | 46 | infet6-supply = <&some_reg>; |
| 47 | 47 | infet7-supply = <&some_reg>; |
| 48 | − vsys_l1-supply = <&some_reg>; | |
| 49 | − vsys_l2-supply = <&some_reg>; | |
| 48 | + vsys-l1-supply = <&some_reg>; | |
| 49 | + vsys-l2-supply = <&some_reg>; | |
| 50 | 50 | |
| 51 | 51 | regulators { |
| 52 | 52 | dcdc1 { |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | ADI AXI-SPDIF controller |
| 2 | 2 | |
| 3 | 3 | Required properties: |
| 4 | − - compatible : Must be "adi,axi-spdif-1.00.a" | |
| 4 | + - compatible : Must be "adi,axi-spdif-tx-1.00.a" | |
| 5 | 5 | - reg : Must contain SPDIF core's registers location and length |
| 6 | 6 | - clocks : Pairs of phandle and specifier referencing the controller's clocks. |
| 7 | 7 | The controller expects two clocks, the clock used for the AXI interface and |
| @@ -56,10 +56,10 @@ The dma_buf buffer sharing API usage contains the following steps: · 55 unmodified lines | ||
| 56 | 56 | size_t size, int flags, |
| 57 | 57 | const char *exp_name) |
| 58 | 58 | |
| 59 | − If this succeeds, dma_buf_export allocates a dma_buf structure, and returns a | |
| 60 | − pointer to the same. It also associates an anonymous file with this buffer, | |
| 61 | − so it can be exported. On failure to allocate the dma_buf object, it returns | |
| 62 | − NULL. | |
| 59 | + If this succeeds, dma_buf_export_named allocates a dma_buf structure, and | |
| 60 | + returns a pointer to the same. It also associates an anonymous file with this | |
| 61 | + buffer, so it can be exported. On failure to allocate the dma_buf object, | |
| 62 | + it returns NULL. | |
| 63 | 63 | |
| 64 | 64 | 'exp_name' is the name of exporter - to facilitate information while |
| 65 | 65 | debugging. |
| @@ -76,7 +76,7 @@ The dma_buf buffer sharing API usage contains the following steps: · 10 unmodified lines | ||
| 76 | 76 | drivers and/or processes. |
| 77 | 77 | |
| 78 | 78 | Interface: |
| 79 | − int dma_buf_fd(struct dma_buf *dmabuf) | |
| 79 | + int dma_buf_fd(struct dma_buf *dmabuf, int flags) | |
| 80 | 80 | |
| 81 | 81 | This API installs an fd for the anonymous file associated with this buffer; |
| 82 | 82 | returns either 'fd', or error. |
| @@ -157,7 +157,9 @@ to request use of buffer for allocation. · 74 unmodified lines | ||
| 157 | 157 | "dma_buf->ops->" indirection from the users of this interface. |
| 158 | 158 | |
| 159 | 159 | In struct dma_buf_ops, unmap_dma_buf is defined as |
| 160 | − void (*unmap_dma_buf)(struct dma_buf_attachment *, struct sg_table *); | |
| 160 | + void (*unmap_dma_buf)(struct dma_buf_attachment *, | |
| 161 | + struct sg_table *, | |
| 162 | + enum dma_data_direction); | |
| 161 | 163 | |
| 162 | 164 | unmap_dma_buf signifies the end-of-DMA for the attachment provided. Like |
| 163 | 165 | map_dma_buf, this API also must be implemented by the exporter. |
| @@ -138,9 +138,9 @@ Installation · 137 unmodified lines | ||
| 138 | 138 | - Build, install, reboot |
| 139 | 139 | |
| 140 | 140 | The NFS/RDMA code will be enabled automatically if NFS and RDMA |
| 141 | − are turned on. The NFS/RDMA client and server are configured via the hidden | |
| 142 | − SUNRPC_XPRT_RDMA config option that depends on SUNRPC and INFINIBAND. The | |
| 143 | − value of SUNRPC_XPRT_RDMA will be: | |
| 141 | + are turned on. The NFS/RDMA client and server are configured via the | |
| 142 | + SUNRPC_XPRT_RDMA_CLIENT and SUNRPC_XPRT_RDMA_SERVER config options that both | |
| 143 | + depend on SUNRPC and INFINIBAND. The default value of both options will be: | |
| 144 | 144 | |
| 145 | 145 | - N if either SUNRPC or INFINIBAND are N, in this case the NFS/RDMA client |
| 146 | 146 | and server will not be built |
| @@ -235,8 +235,9 @@ NFS/RDMA Setup · 88 unmodified lines | ||
| 235 | 235 | |
| 236 | 236 | - Start the NFS server |
| 237 | 237 | |
| 238 | − If the NFS/RDMA server was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in | |
| 239 | − kernel config), load the RDMA transport module: | |
| 238 | + If the NFS/RDMA server was built as a module | |
| 239 | + (CONFIG_SUNRPC_XPRT_RDMA_SERVER=m in kernel config), load the RDMA | |
| 240 | + transport module: | |
| 240 | 241 | |
| 241 | 242 | $ modprobe svcrdma |
| 242 | 243 | |
| @@ -255,8 +256,9 @@ NFS/RDMA Setup · 12 unmodified lines | ||
| 255 | 256 | |
| 256 | 257 | - On the client system |
| 257 | 258 | |
| 258 | − If the NFS/RDMA client was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in | |
| 259 | − kernel config), load the RDMA client module: | |
| 259 | + If the NFS/RDMA client was built as a module | |
| 260 | + (CONFIG_SUNRPC_XPRT_RDMA_CLIENT=m in kernel config), load the RDMA client | |
| 261 | + module: | |
| 260 | 262 | |
| 261 | 263 | $ modprobe xprtrdma.ko |
| 262 | 264 | |
| @@ -235,6 +235,39 @@ be used for more than one file, you can store an arbitrary pointer in the · 234 unmodified lines | ||
| 235 | 235 | private field of the seq_file structure; that value can then be retrieved |
| 236 | 236 | by the iterator functions. |
| 237 | 237 | |
| 238 | +There is also a wrapper function to seq_open() called seq_open_private(). It | |
| 239 | +kmallocs a zero filled block of memory and stores a pointer to it in the | |
| 240 | +private field of the seq_file structure, returning 0 on success. The | |
| 241 | +block size is specified in a third parameter to the function, e.g.: | |
| 242 | + | |
| 243 | + static int ct_open(struct inode *inode, struct file *file) | |
| 244 | + { | |
| 245 | + return seq_open_private(file, &ct_seq_ops, | |
| 246 | + sizeof(struct mystruct)); | |
| 247 | + } | |
| 248 | + | |
| 249 | +There is also a variant function, __seq_open_private(), which is functionally | |
| 250 | +identical except that, if successful, it returns the pointer to the allocated | |
| 251 | +memory block, allowing further initialisation e.g.: | |
| 252 | + | |
| 253 | + static int ct_open(struct inode *inode, struct file *file) | |
| 254 | + { | |
| 255 | + struct mystruct *p = | |
| 256 | + __seq_open_private(file, &ct_seq_ops, sizeof(*p)); | |
| 257 | + | |
| 258 | + if (!p) | |
| 259 | + return -ENOMEM; | |
| 260 | + | |
| 261 | + p->foo = bar; /* initialize my stuff */ | |
| 262 | + ... | |
| 263 | + p->baz = true; | |
| 264 | + | |
| 265 | + return 0; | |
| 266 | + } | |
| 267 | + | |
| 268 | +A corresponding close function, seq_release_private() is available which | |
| 269 | +frees the memory allocated in the corresponding open. | |
| 270 | + | |
| 238 | 271 | The other operations of interest - read(), llseek(), and release() - are |
| 239 | 272 | all implemented by the seq_file code itself. So a virtual file's |
| 240 | 273 | file_operations structure will look like: |
| @@ -53,7 +53,20 @@ with IS_ERR() (they will never return a NULL pointer). -ENOENT will be returned · 52 unmodified lines | ||
| 53 | 53 | if and only if no GPIO has been assigned to the device/function/index triplet, |
| 54 | 54 | other error codes are used for cases where a GPIO has been assigned but an error |
| 55 | 55 | occurred while trying to acquire it. This is useful to discriminate between mere |
| 56 | −errors and an absence of GPIO for optional GPIO parameters. | |
| 56 | +errors and an absence of GPIO for optional GPIO parameters. For the common | |
| 57 | +pattern where a GPIO is optional, the gpiod_get_optional() and | |
| 58 | +gpiod_get_index_optional() functions can be used. These functions return NULL | |
| 59 | +instead of -ENOENT if no GPIO has been assigned to the requested function: | |
| 60 | + | |
| 61 | + | |
| 62 | + struct gpio_desc *gpiod_get_optional(struct device *dev, | |
| 63 | + const char *con_id, | |
| 64 | + enum gpiod_flags flags) | |
| 65 | + | |
| 66 | + struct gpio_desc *gpiod_get_index_optional(struct device *dev, | |
| 67 | + const char *con_id, | |
| 68 | + unsigned int index, | |
| 69 | + enum gpiod_flags flags) | |
| 57 | 70 | |
| 58 | 71 | Device-managed variants of these functions are also defined: |
| 59 | 72 | |
| @@ -65,6 +78,15 @@ Device-managed variants of these functions are also defined: · 5 unmodified lines | ||
| 65 | 78 | unsigned int idx, |
| 66 | 79 | enum gpiod_flags flags) |
| 67 | 80 | |
| 81 | + struct gpio_desc *devm_gpiod_get_optional(struct device *dev, | |
| 82 | + const char *con_id, | |
| 83 | + enum gpiod_flags flags) | |
| 84 | + | |
| 85 | + struct gpio_desc * devm_gpiod_get_index_optional(struct device *dev, | |
| 86 | + const char *con_id, | |
| 87 | + unsigned int index, | |
| 88 | + enum gpiod_flags flags) | |
| 89 | + | |
| 68 | 90 | A GPIO descriptor can be disposed of using the gpiod_put() function: |
| 69 | 91 | |
| 70 | 92 | void gpiod_put(struct gpio_desc *desc) |
| @@ -57,12 +57,12 @@ Well, you are all set up now. You can now use SMBus commands or plain · 56 unmodified lines | ||
| 57 | 57 | I2C to communicate with your device. SMBus commands are preferred if |
| 58 | 58 | the device supports them. Both are illustrated below. |
| 59 | 59 | |
| 60 | − __u8 register = 0x10; /* Device register to access */ | |
| 60 | + __u8 reg = 0x10; /* Device register to access */ | |
| 61 | 61 | __s32 res; |
| 62 | 62 | char buf[10]; |
| 63 | 63 | |
| 64 | 64 | /* Using SMBus commands */ |
| 65 | − res = i2c_smbus_read_word_data(file, register); | |
| 65 | + res = i2c_smbus_read_word_data(file, reg); | |
| 66 | 66 | if (res < 0) { |
| 67 | 67 | /* ERROR HANDLING: i2c transaction failed */ |
| 68 | 68 | } else { |
| @@ -70,11 +70,11 @@ the device supports them. Both are illustrated below. · 1 unmodified line | ||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /* Using I2C Write, equivalent of |
| 73 | − i2c_smbus_write_word_data(file, register, 0x6543) */ | |
| 74 | − buf[0] = register; | |
| 73 | + i2c_smbus_write_word_data(file, reg, 0x6543) */ | |
| 74 | + buf[0] = reg; | |
| 75 | 75 | buf[1] = 0x43; |
| 76 | 76 | buf[2] = 0x65; |
| 77 | − if (write(file, buf, 3) ! =3) { | |
| 77 | + if (write(file, buf, 3) != 3) { | |
| 78 | 78 | /* ERROR HANDLING: i2c transaction failed */ |
| 79 | 79 | } |
| 80 | 80 | |
| @@ -18,7 +18,7 @@ memory image to a dump file on the local disk, or across the network to · 17 unmodified lines | ||
| 18 | 18 | a remote system. |
| 19 | 19 | |
| 20 | 20 | Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64, |
| 21 | −and s390x architectures. | |
| 21 | +s390x and arm architectures. | |
| 22 | 22 | |
| 23 | 23 | When the system kernel boots, it reserves a small section of memory for |
| 24 | 24 | the dump-capture kernel. This ensures that ongoing Direct Memory Access |
| @@ -112,7 +112,7 @@ There are two possible methods of using Kdump. · 87 unmodified lines | ||
| 112 | 112 | 2) Or use the system kernel binary itself as dump-capture kernel and there is |
| 113 | 113 | no need to build a separate dump-capture kernel. This is possible |
| 114 | 114 | only with the architectures which support a relocatable kernel. As |
| 115 | − of today, i386, x86_64, ppc64 and ia64 architectures support relocatable | |
| 115 | + of today, i386, x86_64, ppc64, ia64 and arm architectures support relocatable | |
| 116 | 116 | kernel. |
| 117 | 117 | |
| 118 | 118 | Building a relocatable kernel is advantageous from the point of view that |
| @@ -241,6 +241,13 @@ Dump-capture kernel config options (Arch Dependent, ia64) · 122 unmodified lines | ||
| 241 | 241 | kernel will be aligned to 64Mb, so if the start address is not then |
| 242 | 242 | any space below the alignment point will be wasted. |
| 243 | 243 | |
| 244 | +Dump-capture kernel config options (Arch Dependent, arm) | |
| 245 | +---------------------------------------------------------- | |
| 246 | + | |
| 247 | +- To use a relocatable kernel, | |
| 248 | + Enable "AUTO_ZRELADDR" support under "Boot" options: | |
| 249 | + | |
| 250 | + AUTO_ZRELADDR=y | |
| 244 | 251 | |
| 245 | 252 | Extended crashkernel syntax |
| 246 | 253 | =========================== |
| @@ -256,6 +263,10 @@ The syntax is: · 9 unmodified lines | ||
| 256 | 263 | crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] |
| 257 | 264 | range=start-[end] |
| 258 | 265 | |
| 266 | +Please note, on arm, the offset is required. | |
| 267 | + crashkernel=<range1>:<size1>[,<range2>:<size2>,...]@offset | |
| 268 | + range=start-[end] | |
| 269 | + | |
| 259 | 270 | 'start' is inclusive and 'end' is exclusive. |
| 260 | 271 | |
| 261 | 272 | For example: |
| @@ -296,6 +307,12 @@ Boot into System Kernel · 34 unmodified lines | ||
| 296 | 307 | on the memory consumption of the kdump system. In general this is not |
| 297 | 308 | dependent on the memory size of the production system. |
| 298 | 309 | |
| 310 | + On arm, use "crashkernel=Y@X". Note that the start address of the kernel | |
| 311 | + will be aligned to 128MiB (0x08000000), so if the start address is not then | |
| 312 | + any space below the alignment point may be overwritten by the dump-capture kernel, | |
| 313 | + which means it is possible that the vmcore is not that precise as expected. | |
| 314 | + | |
| 315 | + | |
| 299 | 316 | Load the Dump-capture Kernel |
| 300 | 317 | ============================ |
| 301 | 318 | |
| @@ -315,7 +332,8 @@ For ia64: · 13 unmodified lines | ||
| 315 | 332 | - Use vmlinux or vmlinuz.gz |
| 316 | 333 | For s390x: |
| 317 | 334 | - Use image or bzImage |
| 318 | − | |
| 335 | +For arm: | |
| 336 | + - Use zImage | |
| 319 | 337 | |
| 320 | 338 | If you are using a uncompressed vmlinux image then use following command |
| 321 | 339 | to load dump-capture kernel. |
| @@ -331,6 +349,15 @@ to load dump-capture kernel. · 9 unmodified lines | ||
| 331 | 349 | --initrd=<initrd-for-dump-capture-kernel> \ |
| 332 | 350 | --append="root=<root-dev> <arch-specific-options>" |
| 333 | 351 | |
| 352 | +If you are using a compressed zImage, then use following command | |
| 353 | +to load dump-capture kernel. | |
| 354 | + | |
| 355 | + kexec --type zImage -p <dump-capture-kernel-bzImage> \ | |
| 356 | + --initrd=<initrd-for-dump-capture-kernel> \ | |
| 357 | + --dtb=<dtb-for-dump-capture-kernel> \ | |
| 358 | + --append="root=<root-dev> <arch-specific-options>" | |
| 359 | + | |
| 360 | + | |
| 334 | 361 | Please note, that --args-linux does not need to be specified for ia64. |
| 335 | 362 | It is planned to make this a no-op on that architecture, but for now |
| 336 | 363 | it should be omitted |
| @@ -347,6 +374,9 @@ For ppc64: · 10 unmodified lines | ||
| 347 | 374 | For s390x: |
| 348 | 375 | "1 maxcpus=1 cgroup_disable=memory" |
| 349 | 376 | |
| 377 | +For arm: | |
| 378 | + "1 maxcpus=1 reset_devices" | |
| 379 | + | |
| 350 | 380 | Notes on loading the dump-capture kernel: |
| 351 | 381 | |
| 352 | 382 | * By default, the ELF headers are stored in ELF64 format to support |
| @@ -59,7 +59,7 @@ acts similar to /dev/rtc and reacts on free-fall interrupts received · 58 unmodified lines | ||
| 59 | 59 | from the device. It supports blocking operations, poll/select and |
| 60 | 60 | fasync operation modes. You must read 1 bytes from the device. The |
| 61 | 61 | result is number of free-fall interrupts since the last successful |
| 62 | −read (or 255 if number of interrupts would not fit). See the hpfall.c | |
| 62 | +read (or 255 if number of interrupts would not fit). See the freefall.c | |
| 63 | 63 | file for an example on using the device. |
| 64 | 64 | |
| 65 | 65 | |
| @@ -143,8 +143,9 @@ This will cause the core to recalculate the total load on the regulator (based · 142 unmodified lines | ||
| 143 | 143 | on all its consumers) and change operating mode (if necessary and permitted) |
| 144 | 144 | to best match the current operating load. |
| 145 | 145 | |
| 146 | −The load_uA value can be determined from the consumers datasheet. e.g.most | |
| 147 | −datasheets have tables showing the max current consumed in certain situations. | |
| 146 | +The load_uA value can be determined from the consumer's datasheet. e.g. most | |
| 147 | +datasheets have tables showing the maximum current consumed in certain | |
| 148 | +situations. | |
| 148 | 149 | |
| 149 | 150 | Most consumers will use indirect operating mode control since they have no |
| 150 | 151 | knowledge of the regulator or whether the regulator is shared with other |
| @@ -173,7 +174,7 @@ Consumers can register interest in regulator events by calling :- · 22 unmodified lines | ||
| 173 | 174 | int regulator_register_notifier(struct regulator *regulator, |
| 174 | 175 | struct notifier_block *nb); |
| 175 | 176 | |
| 176 | −Consumers can uregister interest by calling :- | |
| 177 | +Consumers can unregister interest by calling :- | |
| 177 | 178 | |
| 178 | 179 | int regulator_unregister_notifier(struct regulator *regulator, |
| 179 | 180 | struct notifier_block *nb); |
| @@ -9,14 +9,14 @@ Safety · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | - Errors in regulator configuration can have very serious consequences |
| 11 | 11 | for the system, potentially including lasting hardware damage. |
| 12 | − - It is not possible to automatically determine the power confugration | |
| 12 | + - It is not possible to automatically determine the power configuration | |
| 13 | 13 | of the system - software-equivalent variants of the same chip may |
| 14 | − have different power requirments, and not all components with power | |
| 14 | + have different power requirements, and not all components with power | |
| 15 | 15 | requirements are visible to software. |
| 16 | 16 | |
| 17 | 17 | => The API should make no changes to the hardware state unless it has |
| 18 | − specific knowledge that these changes are safe to do perform on | |
| 19 | − this particular system. | |
| 18 | + specific knowledge that these changes are safe to perform on this | |
| 19 | + particular system. | |
| 20 | 20 | |
| 21 | 21 | Consumer use cases |
| 22 | 22 | ------------------ |
| @@ -11,7 +11,7 @@ Consider the following machine :- · 10 unmodified lines | ||
| 11 | 11 | +-> [Consumer B @ 3.3V] |
| 12 | 12 | |
| 13 | 13 | The drivers for consumers A & B must be mapped to the correct regulator in |
| 14 | −order to control their power supply. This mapping can be achieved in machine | |
| 14 | +order to control their power supplies. This mapping can be achieved in machine | |
| 15 | 15 | initialisation code by creating a struct regulator_consumer_supply for |
| 16 | 16 | each regulator. |
| 17 | 17 | |
| @@ -39,7 +39,7 @@ to the 'Vcc' supply for Consumer A. · 21 unmodified lines | ||
| 39 | 39 | |
| 40 | 40 | Constraints can now be registered by defining a struct regulator_init_data |
| 41 | 41 | for each regulator power domain. This structure also maps the consumers |
| 42 | −to their supply regulator :- | |
| 42 | +to their supply regulators :- | |
| 43 | 43 | |
| 44 | 44 | static struct regulator_init_data regulator1_data = { |
| 45 | 45 | .constraints = { |
| @@ -36,11 +36,11 @@ Some terms used in this document:- · 35 unmodified lines | ||
| 36 | 36 | Consumers can be classified into two types:- |
| 37 | 37 | |
| 38 | 38 | Static: consumer does not change its supply voltage or |
| 39 | − current limit. It only needs to enable or disable it's | |
| 39 | + current limit. It only needs to enable or disable its | |
| 40 | 40 | power supply. Its supply voltage is set by the hardware, |
| 41 | 41 | bootloader, firmware or kernel board initialisation code. |
| 42 | 42 | |
| 43 | − Dynamic: consumer needs to change it's supply voltage or | |
| 43 | + Dynamic: consumer needs to change its supply voltage or | |
| 44 | 44 | current limit to meet operation demands. |
| 45 | 45 | |
| 46 | 46 | |
| @@ -156,7 +156,7 @@ relevant to non SoC devices and is split into the following four interfaces:- · 109 unmodified lines | ||
| 156 | 156 | This interface is for machine specific code and allows the creation of |
| 157 | 157 | voltage/current domains (with constraints) for each regulator. It can |
| 158 | 158 | provide regulator constraints that will prevent device damage through |
| 159 | − overvoltage or over current caused by buggy client drivers. It also | |
| 159 | + overvoltage or overcurrent caused by buggy client drivers. It also | |
| 160 | 160 | allows the creation of a regulator tree whereby some regulators are |
| 161 | 161 | supplied by others (similar to a clock tree). |
| 162 | 162 | |
| @@ -13,7 +13,7 @@ Drivers can register a regulator by calling :- · 12 unmodified lines | ||
| 13 | 13 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, |
| 14 | 14 | const struct regulator_config *config); |
| 15 | 15 | |
| 16 | −This will register the regulators capabilities and operations to the regulator | |
| 16 | +This will register the regulator's capabilities and operations to the regulator | |
| 17 | 17 | core. |
| 18 | 18 | |
| 19 | 19 | Regulators can be unregistered by calling :- |
| @@ -23,8 +23,8 @@ void regulator_unregister(struct regulator_dev *rdev); · 3 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | Regulator Events |
| 25 | 25 | ================ |
| 26 | −Regulators can send events (e.g. over temp, under voltage, etc) to consumer | |
| 27 | −drivers by calling :- | |
| 26 | +Regulators can send events (e.g. overtemperature, undervoltage, etc) to | |
| 27 | +consumer drivers by calling :- | |
| 28 | 28 | |
| 29 | 29 | int regulator_notifier_call_chain(struct regulator_dev *rdev, |
| 30 | 30 | unsigned long event, void *data); |
| @@ -2,26 +2,26 @@ this_cpu operations · 1 unmodified line | ||
| 2 | 2 | ------------------- |
| 3 | 3 | |
| 4 | 4 | this_cpu operations are a way of optimizing access to per cpu |
| 5 | −variables associated with the *currently* executing processor through | |
| 6 | −the use of segment registers (or a dedicated register where the cpu | |
| 7 | −permanently stored the beginning of the per cpu area for a specific | |
| 8 | −processor). | |
| 5 | +variables associated with the *currently* executing processor. This is | |
| 6 | +done through the use of segment registers (or a dedicated register where | |
| 7 | +the cpu permanently stored the beginning of the per cpu area for a | |
| 8 | +specific processor). | |
| 9 | 9 | |
| 10 | −The this_cpu operations add a per cpu variable offset to the processor | |
| 11 | −specific percpu base and encode that operation in the instruction | |
| 10 | +this_cpu operations add a per cpu variable offset to the processor | |
| 11 | +specific per cpu base and encode that operation in the instruction | |
| 12 | 12 | operating on the per cpu variable. |
| 13 | 13 | |
| 14 | −This means there are no atomicity issues between the calculation of | |
| 14 | +This means that there are no atomicity issues between the calculation of | |
| 15 | 15 | the offset and the operation on the data. Therefore it is not |
| 16 | −necessary to disable preempt or interrupts to ensure that the | |
| 16 | +necessary to disable preemption or interrupts to ensure that the | |
| 17 | 17 | processor is not changed between the calculation of the address and |
| 18 | 18 | the operation on the data. |
| 19 | 19 | |
| 20 | 20 | Read-modify-write operations are of particular interest. Frequently |
| 21 | 21 | processors have special lower latency instructions that can operate |
| 22 | −without the typical synchronization overhead but still provide some | |
| 23 | −sort of relaxed atomicity guarantee. The x86 for example can execute | |
| 24 | −RMV (Read Modify Write) instructions like inc/dec/cmpxchg without the | |
| 22 | +without the typical synchronization overhead, but still provide some | |
| 23 | +sort of relaxed atomicity guarantees. The x86, for example, can execute | |
| 24 | +RMW (Read Modify Write) instructions like inc/dec/cmpxchg without the | |
| 25 | 25 | lock prefix and the associated latency penalty. |
| 26 | 26 | |
| 27 | 27 | Access to the variable without the lock prefix is not synchronized but |
| @@ -30,6 +30,38 @@ data specific to the currently executing processor. Only the current · 2 unmodified lines | ||
| 30 | 30 | processor should be accessing that variable and therefore there are no |
| 31 | 31 | concurrency issues with other processors in the system. |
| 32 | 32 | |
| 33 | +Please note that accesses by remote processors to a per cpu area are | |
| 34 | +exceptional situations and may impact performance and/or correctness | |
| 35 | +(remote write operations) of local RMW operations via this_cpu_*. | |
| 36 | + | |
| 37 | +The main use of the this_cpu operations has been to optimize counter | |
| 38 | +operations. | |
| 39 | + | |
| 40 | +The following this_cpu() operations with implied preemption protection | |
| 41 | +are defined. These operations can be used without worrying about | |
| 42 | +preemption and interrupts. | |
| 43 | + | |
| 44 | + this_cpu_add() | |
| 45 | + this_cpu_read(pcp) | |
| 46 | + this_cpu_write(pcp, val) | |
| 47 | + this_cpu_add(pcp, val) | |
| 48 | + this_cpu_and(pcp, val) | |
| 49 | + this_cpu_or(pcp, val) | |
| 50 | + this_cpu_add_return(pcp, val) | |
| 51 | + this_cpu_xchg(pcp, nval) | |
| 52 | + this_cpu_cmpxchg(pcp, oval, nval) | |
| 53 | + this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | |
| 54 | + this_cpu_sub(pcp, val) | |
| 55 | + this_cpu_inc(pcp) | |
| 56 | + this_cpu_dec(pcp) | |
| 57 | + this_cpu_sub_return(pcp, val) | |
| 58 | + this_cpu_inc_return(pcp) | |
| 59 | + this_cpu_dec_return(pcp) | |
| 60 | + | |
| 61 | + | |
| 62 | +Inner working of this_cpu operations | |
| 63 | +------------------------------------ | |
| 64 | + | |
| 33 | 65 | On x86 the fs: or the gs: segment registers contain the base of the |
| 34 | 66 | per cpu area. It is then possible to simply use the segment override |
| 35 | 67 | to relocate a per cpu relative address to the proper per cpu area for |
| @@ -48,22 +80,21 @@ results in a single instruction · 12 unmodified lines | ||
| 48 | 80 | mov ax, gs:[x] |
| 49 | 81 | |
| 50 | 82 | instead of a sequence of calculation of the address and then a fetch |
| 51 | −from that address which occurs with the percpu operations. Before | |
| 83 | +from that address which occurs with the per cpu operations. Before | |
| 52 | 84 | this_cpu_ops such sequence also required preempt disable/enable to |
| 53 | 85 | prevent the kernel from moving the thread to a different processor |
| 54 | 86 | while the calculation is performed. |
| 55 | 87 | |
| 56 | −The main use of the this_cpu operations has been to optimize counter | |
| 57 | −operations. | |
| 88 | +Consider the following this_cpu operation: | |
| 58 | 89 | |
| 59 | 90 | this_cpu_inc(x) |
| 60 | 91 | |
| 61 | −results in the following single instruction (no lock prefix!) | |
| 92 | +The above results in the following single instruction (no lock prefix!) | |
| 62 | 93 | |
| 63 | 94 | inc gs:[x] |
| 64 | 95 | |
| 65 | 96 | instead of the following operations required if there is no segment |
| 66 | −register. | |
| 97 | +register: | |
| 67 | 98 | |
| 68 | 99 | int *y; |
| 69 | 100 | int cpu; |
| @@ -73,10 +104,10 @@ register. · 3 unmodified lines | ||
| 73 | 104 | (*y)++; |
| 74 | 105 | put_cpu(); |
| 75 | 106 | |
| 76 | −Note that these operations can only be used on percpu data that is | |
| 107 | +Note that these operations can only be used on per cpu data that is | |
| 77 | 108 | reserved for a specific processor. Without disabling preemption in the |
| 78 | 109 | surrounding code this_cpu_inc() will only guarantee that one of the |
| 79 | −percpu counters is correctly incremented. However, there is no | |
| 110 | +per cpu counters is correctly incremented. However, there is no | |
| 80 | 111 | guarantee that the OS will not move the process directly before or |
| 81 | 112 | after the this_cpu instruction is executed. In general this means that |
| 82 | 113 | the value of the individual counters for each processor are |
| @@ -86,9 +117,9 @@ that is of interest. · 3 unmodified lines | ||
| 86 | 117 | Per cpu variables are used for performance reasons. Bouncing cache |
| 87 | 118 | lines can be avoided if multiple processors concurrently go through |
| 88 | 119 | the same code paths. Since each processor has its own per cpu |
| 89 | −variables no concurrent cacheline updates take place. The price that | |
| 120 | +variables no concurrent cache line updates take place. The price that | |
| 90 | 121 | has to be paid for this optimization is the need to add up the per cpu |
| 91 | −counters when the value of the counter is needed. | |
| 122 | +counters when the value of a counter is needed. | |
| 92 | 123 | |
| 93 | 124 | |
| 94 | 125 | Special operations: |
| @@ -100,33 +131,39 @@ Takes the offset of a per cpu variable (&x !) and returns the address · 5 unmodified lines | ||
| 100 | 131 | of the per cpu variable that belongs to the currently executing |
| 101 | 132 | processor. this_cpu_ptr avoids multiple steps that the common |
| 102 | 133 | get_cpu/put_cpu sequence requires. No processor number is |
| 103 | −available. Instead the offset of the local per cpu area is simply | |
| 104 | −added to the percpu offset. | |
| 134 | +available. Instead, the offset of the local per cpu area is simply | |
| 135 | +added to the per cpu offset. | |
| 105 | 136 | |
| 137 | +Note that this operation is usually used in a code segment when | |
| 138 | +preemption has been disabled. The pointer is then used to | |
| 139 | +access local per cpu data in a critical section. When preemption | |
| 140 | +is re-enabled this pointer is usually no longer useful since it may | |
| 141 | +no longer point to per cpu data of the current processor. | |
| 106 | 142 | |
| 107 | 143 | |
| 108 | 144 | Per cpu variables and offsets |
| 109 | 145 | ----------------------------- |
| 110 | 146 | |
| 111 | −Per cpu variables have *offsets* to the beginning of the percpu | |
| 147 | +Per cpu variables have *offsets* to the beginning of the per cpu | |
| 112 | 148 | area. They do not have addresses although they look like that in the |
| 113 | 149 | code. Offsets cannot be directly dereferenced. The offset must be |
| 114 | −added to a base pointer of a percpu area of a processor in order to | |
| 150 | +added to a base pointer of a per cpu area of a processor in order to | |
| 115 | 151 | form a valid address. |
| 116 | 152 | |
| 117 | 153 | Therefore the use of x or &x outside of the context of per cpu |
| 118 | 154 | operations is invalid and will generally be treated like a NULL |
| 119 | 155 | pointer dereference. |
| 120 | 156 | |
| 121 | −In the context of per cpu operations | |
| 157 | + DEFINE_PER_CPU(int, x); | |
| 122 | 158 | |
| 123 | − x is a per cpu variable. Most this_cpu operations take a cpu | |
| 124 | − variable. | |
| 159 | +In the context of per cpu operations the above implies that x is a per | |
| 160 | +cpu variable. Most this_cpu operations take a cpu variable. | |
| 125 | 161 | |
| 126 | − &x is the *offset* a per cpu variable. this_cpu_ptr() takes | |
| 127 | − the offset of a per cpu variable which makes this look a bit | |
| 128 | − strange. | |
| 162 | + int __percpu *p = &x; | |
| 129 | 163 | |
| 164 | +&x and hence p is the *offset* of a per cpu variable. this_cpu_ptr() | |
| 165 | +takes the offset of a per cpu variable which makes this look a bit | |
| 166 | +strange. | |
| 130 | 167 | |
| 131 | 168 | |
| 132 | 169 | Operations on a field of a per cpu structure |
| @@ -152,7 +189,7 @@ If we have an offset to struct s: · 19 unmodified lines | ||
| 152 | 189 | |
| 153 | 190 | struct s __percpu *ps = &p; |
| 154 | 191 | |
| 155 | − z = this_cpu_dec(ps->m); | |
| 192 | + this_cpu_dec(ps->m); | |
| 156 | 193 | |
| 157 | 194 | z = this_cpu_inc_return(ps->n); |
| 158 | 195 | |
| @@ -172,29 +209,52 @@ if we do not make use of this_cpu ops later to manipulate fields: · 13 unmodified lines | ||
| 172 | 209 | Variants of this_cpu ops |
| 173 | 210 | ------------------------- |
| 174 | 211 | |
| 175 | −this_cpu ops are interrupt safe. Some architecture do not support | |
| 212 | +this_cpu ops are interrupt safe. Some architectures do not support | |
| 176 | 213 | these per cpu local operations. In that case the operation must be |
| 177 | 214 | replaced by code that disables interrupts, then does the operations |
| 178 | −that are guaranteed to be atomic and then reenable interrupts. Doing | |
| 215 | +that are guaranteed to be atomic and then re-enable interrupts. Doing | |
| 179 | 216 | so is expensive. If there are other reasons why the scheduler cannot |
| 180 | 217 | change the processor we are executing on then there is no reason to |
| 181 | −disable interrupts. For that purpose the __this_cpu operations are | |
| 182 | −provided. For example. | |
| 183 | − | |
| 184 | − __this_cpu_inc(x); | |
| 185 | − | |
| 186 | −Will increment x and will not fallback to code that disables | |
| 218 | +disable interrupts. For that purpose the following __this_cpu operations | |
| 219 | +are provided. | |
| 220 | + | |
| 221 | +These operations have no guarantee against concurrent interrupts or | |
| 222 | +preemption. If a per cpu variable is not used in an interrupt context | |
| 223 | +and the scheduler cannot preempt, then they are safe. If any interrupts | |
| 224 | +still occur while an operation is in progress and if the interrupt too | |
| 225 | +modifies the variable, then RMW actions can not be guaranteed to be | |
| 226 | +safe. | |
| 227 | + | |
| 228 | + __this_cpu_add() | |
| 229 | + __this_cpu_read(pcp) | |
| 230 | + __this_cpu_write(pcp, val) | |
| 231 | + __this_cpu_add(pcp, val) | |
| 232 | + __this_cpu_and(pcp, val) | |
| 233 | + __this_cpu_or(pcp, val) | |
| 234 | + __this_cpu_add_return(pcp, val) | |
| 235 | + __this_cpu_xchg(pcp, nval) | |
| 236 | + __this_cpu_cmpxchg(pcp, oval, nval) | |
| 237 | + __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | |
| 238 | + __this_cpu_sub(pcp, val) | |
| 239 | + __this_cpu_inc(pcp) | |
| 240 | + __this_cpu_dec(pcp) | |
| 241 | + __this_cpu_sub_return(pcp, val) | |
| 242 | + __this_cpu_inc_return(pcp) | |
| 243 | + __this_cpu_dec_return(pcp) | |
| 244 | + | |
| 245 | + | |
| 246 | +Will increment x and will not fall-back to code that disables | |
| 187 | 247 | interrupts on platforms that cannot accomplish atomicity through |
| 188 | 248 | address relocation and a Read-Modify-Write operation in the same |
| 189 | 249 | instruction. |
| 190 | 250 | |
| 191 | 251 | |
| 192 | − | |
| 193 | 252 | &this_cpu_ptr(pp)->n vs this_cpu_ptr(&pp->n) |
| 194 | 253 | -------------------------------------------- |
| 195 | 254 | |
| 196 | 255 | The first operation takes the offset and forms an address and then |
| 197 | −adds the offset of the n field. | |
| 256 | +adds the offset of the n field. This may result in two add | |
| 257 | +instructions emitted by the compiler. | |
| 198 | 258 | |
| 199 | 259 | The second one first adds the two offsets and then does the |
| 200 | 260 | relocation. IMHO the second form looks cleaner and has an easier time |
| @@ -202,4 +262,73 @@ with (). The second form also is consistent with the way · 1 unmodified line | ||
| 202 | 262 | this_cpu_read() and friends are used. |
| 203 | 263 | |
| 204 | 264 | |
| 205 | −Christoph Lameter, April 3rd, 2013 | |
| 265 | +Remote access to per cpu data | |
| 266 | +------------------------------ | |
| 267 | + | |
| 268 | +Per cpu data structures are designed to be used by one cpu exclusively. | |
| 269 | +If you use the variables as intended, this_cpu_ops() are guaranteed to | |
| 270 | +be "atomic" as no other CPU has access to these data structures. | |
| 271 | + | |
| 272 | +There are special cases where you might need to access per cpu data | |
| 273 | +structures remotely. It is usually safe to do a remote read access | |
| 274 | +and that is frequently done to summarize counters. Remote write access | |
| 275 | +something which could be problematic because this_cpu ops do not | |
| 276 | +have lock semantics. A remote write may interfere with a this_cpu | |
| 277 | +RMW operation. | |
| 278 | + | |
| 279 | +Remote write accesses to percpu data structures are highly discouraged | |
| 280 | +unless absolutely necessary. Please consider using an IPI to wake up | |
| 281 | +the remote CPU and perform the update to its per cpu area. | |
| 282 | + | |
| 283 | +To access per-cpu data structure remotely, typically the per_cpu_ptr() | |
| 284 | +function is used: | |
| 285 | + | |
| 286 | + | |
| 287 | + DEFINE_PER_CPU(struct data, datap); | |
| 288 | + | |
| 289 | + struct data *p = per_cpu_ptr(&datap, cpu); | |
| 290 | + | |
| 291 | +This makes it explicit that we are getting ready to access a percpu | |
| 292 | +area remotely. | |
| 293 | + | |
| 294 | +You can also do the following to convert the datap offset to an address | |
| 295 | + | |
| 296 | + struct data *p = this_cpu_ptr(&datap); | |
| 297 | + | |
| 298 | +but, passing of pointers calculated via this_cpu_ptr to other cpus is | |
| 299 | +unusual and should be avoided. | |
| 300 | + | |
| 301 | +Remote access are typically only for reading the status of another cpus | |
| 302 | +per cpu data. Write accesses can cause unique problems due to the | |
| 303 | +relaxed synchronization requirements for this_cpu operations. | |
| 304 | + | |
| 305 | +One example that illustrates some concerns with write operations is | |
| 306 | +the following scenario that occurs because two per cpu variables | |
| 307 | +share a cache-line but the relaxed synchronization is applied to | |
| 308 | +only one process updating the cache-line. | |
| 309 | + | |
| 310 | +Consider the following example | |
| 311 | + | |
| 312 | + | |
| 313 | + struct test { | |
| 314 | + atomic_t a; | |
| 315 | + int b; | |
| 316 | + }; | |
| 317 | + | |
| 318 | + DEFINE_PER_CPU(struct test, onecacheline); | |
| 319 | + | |
| 320 | +There is some concern about what would happen if the field 'a' is updated | |
| 321 | +remotely from one processor and the local processor would use this_cpu ops | |
| 322 | +to update field b. Care should be taken that such simultaneous accesses to | |
| 323 | +data within the same cache line are avoided. Also costly synchronization | |
| 324 | +may be necessary. IPIs are generally recommended in such scenarios instead | |
| 325 | +of a remote write to the per cpu area of another processor. | |
| 326 | + | |
| 327 | +Even in cases where the remote writes are rare, please bear in | |
| 328 | +mind that a remote write will evict the cache line from the processor | |
| 329 | +that most likely will access it. If the processor wakes up and finds a | |
| 330 | +missing local cache line of a per cpu area, its performance and hence | |
| 331 | +the wake up times will be affected. | |
| 332 | + | |
| 333 | +Christoph Lameter, August 4th, 2014 | |
| 334 | +Pranith Kumar, Aug 2nd, 2014 | |
| @@ -35,7 +35,7 @@ invlpg instruction (or instructions _near_ it) show up high in · 34 unmodified lines | ||
| 35 | 35 | profiles. If you believe that individual invalidations being |
| 36 | 36 | called too often, you can lower the tunable: |
| 37 | 37 | |
| 38 | − /sys/debug/kernel/x86/tlb_single_page_flush_ceiling | |
| 38 | + /sys/kernel/debug/x86/tlb_single_page_flush_ceiling | |
| 39 | 39 | |
| 40 | 40 | This will cause us to do the global flush for more cases. |
| 41 | 41 | Lowering it to 0 will disable the use of the individual flushes. |
| @@ -1277,9 +1277,15 @@ F: drivers/scsi/arm/ · 1276 unmodified lines | ||
| 1277 | 1277 | ARM/Rockchip SoC support |
| 1278 | 1278 | M: Heiko Stuebner <heiko@sntech.de> |
| 1279 | 1279 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1280 | +L: linux-rockchip@lists.infradead.org | |
| 1280 | 1281 | S: Maintained |
| 1282 | +F: arch/arm/boot/dts/rk3* | |
| 1281 | 1283 | F: arch/arm/mach-rockchip/ |
| 1284 | +F: drivers/clk/rockchip/ | |
| 1285 | +F: drivers/i2c/busses/i2c-rk3x.c | |
| 1282 | 1286 | F: drivers/*/*rockchip* |
| 1287 | +F: drivers/*/*/*rockchip* | |
| 1288 | +F: sound/soc/rockchip/ | |
| 1283 | 1289 | |
| 1284 | 1290 | ARM/SAMSUNG ARM ARCHITECTURES |
| 1285 | 1291 | M: Ben Dooks <ben-linux@fluff.org> |
| @@ -2065,7 +2071,7 @@ S: Supported · 779 unmodified lines | ||
| 2065 | 2071 | F: drivers/scsi/bnx2i/ |
| 2066 | 2072 | |
| 2067 | 2073 | BROADCOM KONA GPIO DRIVER |
| 2068 | −M: Markus Mayer <markus.mayer@linaro.org> | |
| 2074 | +M: Ray Jui <rjui@broadcom.com> | |
| 2069 | 2075 | L: bcm-kernel-feedback-list@broadcom.com |
| 2070 | 2076 | S: Supported |
| 2071 | 2077 | F: drivers/gpio/gpio-bcm-kona.c |
| @@ -3121,6 +3127,17 @@ F: include/linux/host1x.h · 1049 unmodified lines | ||
| 3121 | 3127 | F: include/uapi/drm/tegra_drm.h |
| 3122 | 3128 | F: Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt |
| 3123 | 3129 | |
| 3130 | +DRM DRIVERS FOR RENESAS | |
| 3131 | +M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | |
| 3132 | +L: dri-devel@lists.freedesktop.org | |
| 3133 | +L: linux-sh@vger.kernel.org | |
| 3134 | +T: git git://people.freedesktop.org/~airlied/linux | |
| 3135 | +S: Supported | |
| 3136 | +F: drivers/gpu/drm/rcar-du/ | |
| 3137 | +F: drivers/gpu/drm/shmobile/ | |
| 3138 | +F: include/linux/platform_data/rcar-du.h | |
| 3139 | +F: include/linux/platform_data/shmob_drm.h | |
| 3140 | + | |
| 3124 | 3141 | DSBR100 USB FM RADIO DRIVER |
| 3125 | 3142 | M: Alexey Klimov <klimov.linux@gmail.com> |
| 3126 | 3143 | L: linux-media@vger.kernel.org |
| @@ -9545,6 +9562,14 @@ S: Maintained · 6418 unmodified lines | ||
| 9545 | 9562 | F: Documentation/usb/ohci.txt |
| 9546 | 9563 | F: drivers/usb/host/ohci* |
| 9547 | 9564 | |
| 9565 | +USB OVER IP DRIVER | |
| 9566 | +M: Valentina Manea <valentina.manea.m@gmail.com> | |
| 9567 | +M: Shuah Khan <shuah.kh@samsung.com> | |
| 9568 | +L: linux-usb@vger.kernel.org | |
| 9569 | +S: Maintained | |
| 9570 | +F: drivers/usb/usbip/ | |
| 9571 | +F: tools/usb/usbip/ | |
| 9572 | + | |
| 9548 | 9573 | USB PEGASUS DRIVER |
| 9549 | 9574 | M: Petko Manolov <petkan@nucleusys.com> |
| 9550 | 9575 | L: linux-usb@vger.kernel.org |
| @@ -10045,9 +10070,9 @@ F: Documentation/x86/ · 494 unmodified lines | ||
| 10045 | 10070 | F: arch/x86/ |
| 10046 | 10071 | |
| 10047 | 10072 | X86 PLATFORM DRIVERS |
| 10048 | −M: Matthew Garrett <matthew.garrett@nebula.com> | |
| 10073 | +M: Darren Hart <dvhart@infradead.org> | |
| 10049 | 10074 | L: platform-driver-x86@vger.kernel.org |
| 10050 | −T: git git://cavan.codon.org.uk/platform-drivers-x86.git | |
| 10075 | +T: git git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git | |
| 10051 | 10076 | S: Maintained |
| 10052 | 10077 | F: drivers/platform/x86/ |
| 10053 | 10078 | |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 3 |
| 2 | 2 | PATCHLEVEL = 17 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc1 | |
| 4 | +EXTRAVERSION = -rc4 | |
| 5 | 5 | NAME = Shuffling Zombie Juror |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -500,10 +500,14 @@ extern inline void writeq(u64 b, volatile void __iomem *addr) · 499 unmodified lines | ||
| 500 | 500 | #define outb_p outb |
| 501 | 501 | #define outw_p outw |
| 502 | 502 | #define outl_p outl |
| 503 | −#define readb_relaxed(addr) __raw_readb(addr) | |
| 504 | −#define readw_relaxed(addr) __raw_readw(addr) | |
| 505 | −#define readl_relaxed(addr) __raw_readl(addr) | |
| 506 | −#define readq_relaxed(addr) __raw_readq(addr) | |
| 503 | +#define readb_relaxed(addr) __raw_readb(addr) | |
| 504 | +#define readw_relaxed(addr) __raw_readw(addr) | |
| 505 | +#define readl_relaxed(addr) __raw_readl(addr) | |
| 506 | +#define readq_relaxed(addr) __raw_readq(addr) | |
| 507 | +#define writeb_relaxed(b, addr) __raw_writeb(b, addr) | |
| 508 | +#define writew_relaxed(b, addr) __raw_writew(b, addr) | |
| 509 | +#define writel_relaxed(b, addr) __raw_writel(b, addr) | |
| 510 | +#define writeq_relaxed(b, addr) __raw_writeq(b, addr) | |
| 507 | 511 | |
| 508 | 512 | #define mmiowb() |
| 509 | 513 | |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | #include <uapi/asm/unistd.h> |
| 5 | 5 | |
| 6 | −#define NR_SYSCALLS 508 | |
| 6 | +#define NR_SYSCALLS 511 | |
| 7 | 7 | |
| 8 | 8 | #define __ARCH_WANT_OLD_READDIR |
| 9 | 9 | #define __ARCH_WANT_STAT64 |
| @@ -469,5 +469,8 @@ · 468 unmodified lines | ||
| 469 | 469 | #define __NR_process_vm_writev 505 |
| 470 | 470 | #define __NR_kcmp 506 |
| 471 | 471 | #define __NR_finit_module 507 |
| 472 | +#define __NR_sched_setattr 508 | |
| 473 | +#define __NR_sched_getattr 509 | |
| 474 | +#define __NR_renameat2 510 | |
| 472 | 475 | |
| 473 | 476 | #endif /* _UAPI_ALPHA_UNISTD_H */ |
| @@ -526,6 +526,9 @@ sys_call_table: · 525 unmodified lines | ||
| 526 | 526 | .quad sys_process_vm_writev /* 505 */ |
| 527 | 527 | .quad sys_kcmp |
| 528 | 528 | .quad sys_finit_module |
| 529 | + .quad sys_sched_setattr | |
| 530 | + .quad sys_sched_getattr | |
| 531 | + .quad sys_renameat2 /* 510 */ | |
| 529 | 532 | |
| 530 | 533 | .size sys_call_table, . - sys_call_table |
| 531 | 534 | .type sys_call_table, @object |
| @@ -427,7 +427,7 @@ struct ic_inv_args { · 426 unmodified lines | ||
| 427 | 427 | |
| 428 | 428 | static void __ic_line_inv_vaddr_helper(void *info) |
| 429 | 429 | { |
| 430 | − struct ic_inv *ic_inv_args = (struct ic_inv_args *) info; | |
| 430 | + struct ic_inv_args *ic_inv = info; | |
| 431 | 431 | |
| 432 | 432 | __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz); |
| 433 | 433 | } |
| @@ -581,6 +581,7 @@ void flush_icache_range(unsigned long kstart, unsigned long kend) · 147 unmodified lines | ||
| 581 | 581 | tot_sz -= sz; |
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | +EXPORT_SYMBOL(flush_icache_range); | |
| 584 | 585 | |
| 585 | 586 | /* |
| 586 | 587 | * General purpose helper to make I and D cache lines consistent. |
| @@ -1983,8 +1983,6 @@ config XIP_PHYS_ADDR · 1982 unmodified lines | ||
| 1983 | 1983 | config KEXEC |
| 1984 | 1984 | bool "Kexec system call (EXPERIMENTAL)" |
| 1985 | 1985 | depends on (!SMP || PM_SLEEP_SMP) |
| 1986 | − select CRYPTO | |
| 1987 | − select CRYPTO_SHA256 | |
| 1988 | 1986 | help |
| 1989 | 1987 | kexec is a system call that implements the ability to shutdown your |
| 1990 | 1988 | current kernel, and to start another kernel. It is like a reboot |
| @@ -804,7 +804,7 @@ · 803 unmodified lines | ||
| 804 | 804 | |
| 805 | 805 | usb1: usb@48390000 { |
| 806 | 806 | compatible = "synopsys,dwc3"; |
| 807 | − reg = <0x48390000 0x17000>; | |
| 807 | + reg = <0x48390000 0x10000>; | |
| 808 | 808 | interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>; |
| 809 | 809 | phys = <&usb2_phy1>; |
| 810 | 810 | phy-names = "usb2-phy"; |
| @@ -826,7 +826,7 @@ · 15 unmodified lines | ||
| 826 | 826 | |
| 827 | 827 | usb2: usb@483d0000 { |
| 828 | 828 | compatible = "synopsys,dwc3"; |
| 829 | − reg = <0x483d0000 0x17000>; | |
| 829 | + reg = <0x483d0000 0x10000>; | |
| 830 | 830 | interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; |
| 831 | 831 | phys = <&usb2_phy2>; |
| 832 | 832 | phy-names = "usb2-phy"; |
| @@ -260,7 +260,7 @@ · 259 unmodified lines | ||
| 260 | 260 | status = "okay"; |
| 261 | 261 | pinctrl-names = "default"; |
| 262 | 262 | pinctrl-0 = <&i2c0_pins>; |
| 263 | − clock-frequency = <400000>; | |
| 263 | + clock-frequency = <100000>; | |
| 264 | 264 | |
| 265 | 265 | tps65218: tps65218@24 { |
| 266 | 266 | reg = <0x24>; |
| @@ -424,7 +424,7 @@ · 157 unmodified lines | ||
| 424 | 424 | ranges = <0 0 0 0x01000000>; /* minimum GPMC partition = 16MB */ |
| 425 | 425 | nand@0,0 { |
| 426 | 426 | reg = <0 0 4>; /* device IO registers */ |
| 427 | − ti,nand-ecc-opt = "bch8"; | |
| 427 | + ti,nand-ecc-opt = "bch16"; | |
| 428 | 428 | ti,elm-id = <&elm>; |
| 429 | 429 | nand-bus-width = <8>; |
| 430 | 430 | gpmc,device-width = <1>; |
| @@ -443,8 +443,6 @@ · 12 unmodified lines | ||
| 443 | 443 | gpmc,rd-cycle-ns = <40>; |
| 444 | 444 | gpmc,wr-cycle-ns = <40>; |
| 445 | 445 | gpmc,wait-pin = <0>; |
| 446 | − gpmc,wait-on-read; | |
| 447 | − gpmc,wait-on-write; | |
| 448 | 446 | gpmc,bus-turnaround-ns = <0>; |
| 449 | 447 | gpmc,cycle2cycle-delay-ns = <0>; |
| 450 | 448 | gpmc,clk-activation-ns = <0>; |
| @@ -435,13 +435,13 @@ · 434 unmodified lines | ||
| 435 | 435 | }; |
| 436 | 436 | |
| 437 | 437 | &gpmc { |
| 438 | − status = "okay"; | |
| 438 | + status = "okay"; /* Disable QSPI when enabling GPMC (NAND) */ | |
| 439 | 439 | pinctrl-names = "default"; |
| 440 | 440 | pinctrl-0 = <&nand_flash_x8>; |
| 441 | 441 | ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */ |
| 442 | 442 | nand@0,0 { |
| 443 | 443 | reg = <0 0 0>; /* CS0, offset 0 */ |
| 444 | − ti,nand-ecc-opt = "bch8"; | |
| 444 | + ti,nand-ecc-opt = "bch16"; | |
| 445 | 445 | ti,elm-id = <&elm>; |
| 446 | 446 | nand-bus-width = <8>; |
| 447 | 447 | gpmc,device-width = <1>; |
| @@ -459,8 +459,7 @@ · 11 unmodified lines | ||
| 459 | 459 | gpmc,access-ns = <30>; /* tCEA + 4*/ |
| 460 | 460 | gpmc,rd-cycle-ns = <40>; |
| 461 | 461 | gpmc,wr-cycle-ns = <40>; |
| 462 | − gpmc,wait-on-read = "true"; | |
| 463 | − gpmc,wait-on-write = "true"; | |
| 462 | + gpmc,wait-pin = <0>; | |
| 464 | 463 | gpmc,bus-turnaround-ns = <0>; |
| 465 | 464 | gpmc,cycle2cycle-delay-ns = <0>; |
| 466 | 465 | gpmc,clk-activation-ns = <0>; |
| @@ -557,7 +556,7 @@ · 90 unmodified lines | ||
| 557 | 556 | }; |
| 558 | 557 | |
| 559 | 558 | &qspi { |
| 560 | − status = "okay"; | |
| 559 | + status = "disabled"; /* Disable GPMC (NAND) when enabling QSPI */ | |
| 561 | 560 | pinctrl-names = "default"; |
| 562 | 561 | pinctrl-0 = <&qspi1_default>; |
| 563 | 562 | |
| @@ -149,7 +149,7 @@ · 148 unmodified lines | ||
| 149 | 149 | usb: usbck { |
| 150 | 150 | compatible = "atmel,at91rm9200-clk-usb"; |
| 151 | 151 | #clock-cells = <0>; |
| 152 | − atmel,clk-divisors = <1 2>; | |
| 152 | + atmel,clk-divisors = <1 2 0 0>; | |
| 153 | 153 | clocks = <&pllb>; |
| 154 | 154 | }; |
| 155 | 155 | |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | }; |
| 41 | 41 | |
| 42 | 42 | pllb: pllbck { |
| 43 | + compatible = "atmel,at91sam9g20-clk-pllb"; | |
| 43 | 44 | atmel,clk-input-range = <2000000 32000000>; |
| 44 | 45 | atmel,pll-clk-output-ranges = <30000000 100000000 0 0>; |
| 45 | 46 | }; |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | /dts-v1/; |
| 9 | 9 | |
| 10 | 10 | #include "dra74x.dtsi" |
| 11 | +#include <dt-bindings/gpio/gpio.h> | |
| 11 | 12 | |
| 12 | 13 | / { |
| 13 | 14 | model = "TI DRA742"; |
| @@ -24,9 +25,29 @@ · 10 unmodified lines | ||
| 24 | 25 | regulator-min-microvolt = <3300000>; |
| 25 | 26 | regulator-max-microvolt = <3300000>; |
| 26 | 27 | }; |
| 28 | + | |
| 29 | + vtt_fixed: fixedregulator-vtt { | |
| 30 | + compatible = "regulator-fixed"; | |
| 31 | + regulator-name = "vtt_fixed"; | |
| 32 | + regulator-min-microvolt = <1350000>; | |
| 33 | + regulator-max-microvolt = <1350000>; | |
| 34 | + regulator-always-on; | |
| 35 | + regulator-boot-on; | |
| 36 | + enable-active-high; | |
| 37 | + gpio = <&gpio7 11 GPIO_ACTIVE_HIGH>; | |
| 38 | + }; | |
| 27 | 39 | }; |
| 28 | 40 | |
| 29 | 41 | &dra7_pmx_core { |
| 42 | + pinctrl-names = "default"; | |
| 43 | + pinctrl-0 = <&vtt_pin>; | |
| 44 | + | |
| 45 | + vtt_pin: pinmux_vtt_pin { | |
| 46 | + pinctrl-single,pins = < | |
| 47 | + 0x3b4 (PIN_OUTPUT | MUX_MODE14) /* spi1_cs1.gpio7_11 */ | |
| 48 | + >; | |
| 49 | + }; | |
| 50 | + | |
| 30 | 51 | i2c1_pins: pinmux_i2c1_pins { |
| 31 | 52 | pinctrl-single,pins = < |
| 32 | 53 | 0x400 (PIN_INPUT | MUX_MODE0) /* i2c1_sda */ |
| @@ -43,20 +64,19 @@ · 10 unmodified lines | ||
| 43 | 64 | |
| 44 | 65 | i2c3_pins: pinmux_i2c3_pins { |
| 45 | 66 | pinctrl-single,pins = < |
| 46 | − 0x410 (PIN_INPUT | MUX_MODE0) /* i2c3_sda */ | |
| 47 | − 0x414 (PIN_INPUT | MUX_MODE0) /* i2c3_scl */ | |
| 67 | + 0x288 (PIN_INPUT | MUX_MODE9) /* gpio6_14.i2c3_sda */ | |
| 68 | + 0x28c (PIN_INPUT | MUX_MODE9) /* gpio6_15.i2c3_scl */ | |
| 48 | 69 | >; |
| 49 | 70 | }; |
| 50 | 71 | |
| 51 | 72 | mcspi1_pins: pinmux_mcspi1_pins { |
| 52 | 73 | pinctrl-single,pins = < |
| 53 | − 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi2_clk */ | |
| 54 | − 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi2_d1 */ | |
| 55 | − 0x3ac (PIN_INPUT | MUX_MODE0) /* spi2_d0 */ | |
| 56 | − 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs0 */ | |
| 57 | − 0x3b4 (PIN_INPUT_SLEW | MUX_MODE0) /* spi2_cs1 */ | |
| 58 | − 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs2 */ | |
| 59 | − 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi2_cs3 */ | |
| 74 | + 0x3a4 (PIN_INPUT | MUX_MODE0) /* spi1_sclk */ | |
| 75 | + 0x3a8 (PIN_INPUT | MUX_MODE0) /* spi1_d1 */ | |
| 76 | + 0x3ac (PIN_INPUT | MUX_MODE0) /* spi1_d0 */ | |
| 77 | + 0x3b0 (PIN_INPUT_SLEW | MUX_MODE0) /* spi1_cs0 */ | |
| 78 | + 0x3b8 (PIN_INPUT_SLEW | MUX_MODE6) /* spi1_cs2.hdmi1_hpd */ | |
| 79 | + 0x3bc (PIN_INPUT_SLEW | MUX_MODE6) /* spi1_cs3.hdmi1_cec */ | |
| 60 | 80 | >; |
| 61 | 81 | }; |
| 62 | 82 | |
| @@ -284,7 +304,7 @@ · 221 unmodified lines | ||
| 284 | 304 | status = "okay"; |
| 285 | 305 | pinctrl-names = "default"; |
| 286 | 306 | pinctrl-0 = <&i2c3_pins>; |
| 287 | − clock-frequency = <3400000>; | |
| 307 | + clock-frequency = <400000>; | |
| 288 | 308 | }; |
| 289 | 309 | |
| 290 | 310 | &mcspi1 { |
| @@ -483,7 +503,7 @@ · 192 unmodified lines | ||
| 483 | 503 | reg = <0x001c0000 0x00020000>; |
| 484 | 504 | }; |
| 485 | 505 | partition@7 { |
| 486 | − label = "NAND.u-boot-env"; | |
| 506 | + label = "NAND.u-boot-env.backup1"; | |
| 487 | 507 | reg = <0x001e0000 0x00020000>; |
| 488 | 508 | }; |
| 489 | 509 | partition@8 { |
| @@ -504,3 +524,8 @@ · 14 unmodified lines | ||
| 504 | 524 | &usb2_phy2 { |
| 505 | 525 | phy-supply = <&ldousb_reg>; |
| 506 | 526 | }; |
| 527 | + | |
| 528 | +&gpio7 { | |
| 529 | + ti,no-reset-on-init; | |
| 530 | + ti,no-idle-on-init; | |
| 531 | +}; | |
| @@ -245,7 +245,7 @@ · 244 unmodified lines | ||
| 245 | 245 | gpio-controller; |
| 246 | 246 | #gpio-cells = <2>; |
| 247 | 247 | interrupt-controller; |
| 248 | − #interrupt-cells = <1>; | |
| 248 | + #interrupt-cells = <2>; | |
| 249 | 249 | }; |
| 250 | 250 | |
| 251 | 251 | gpio2: gpio@48055000 { |
| @@ -256,7 +256,7 @@ · 4 unmodified lines | ||
| 256 | 256 | gpio-controller; |
| 257 | 257 | #gpio-cells = <2>; |
| 258 | 258 | interrupt-controller; |
| 259 | − #interrupt-cells = <1>; | |
| 259 | + #interrupt-cells = <2>; | |
| 260 | 260 | }; |
| 261 | 261 | |
| 262 | 262 | gpio3: gpio@48057000 { |
| @@ -267,7 +267,7 @@ · 4 unmodified lines | ||
| 267 | 267 | gpio-controller; |
| 268 | 268 | #gpio-cells = <2>; |
| 269 | 269 | interrupt-controller; |
| 270 | − #interrupt-cells = <1>; | |
| 270 | + #interrupt-cells = <2>; | |
| 271 | 271 | }; |
| 272 | 272 | |
| 273 | 273 | gpio4: gpio@48059000 { |
| @@ -278,7 +278,7 @@ · 4 unmodified lines | ||
| 278 | 278 | gpio-controller; |
| 279 | 279 | #gpio-cells = <2>; |
| 280 | 280 | interrupt-controller; |
| 281 | − #interrupt-cells = <1>; | |
| 281 | + #interrupt-cells = <2>; | |
| 282 | 282 | }; |
| 283 | 283 | |
| 284 | 284 | gpio5: gpio@4805b000 { |
| @@ -289,7 +289,7 @@ · 4 unmodified lines | ||
| 289 | 289 | gpio-controller; |
| 290 | 290 | #gpio-cells = <2>; |
| 291 | 291 | interrupt-controller; |
| 292 | − #interrupt-cells = <1>; | |
| 292 | + #interrupt-cells = <2>; | |
| 293 | 293 | }; |
| 294 | 294 | |
| 295 | 295 | gpio6: gpio@4805d000 { |
| @@ -300,7 +300,7 @@ · 4 unmodified lines | ||
| 300 | 300 | gpio-controller; |
| 301 | 301 | #gpio-cells = <2>; |
| 302 | 302 | interrupt-controller; |
| 303 | − #interrupt-cells = <1>; | |
| 303 | + #interrupt-cells = <2>; | |
| 304 | 304 | }; |
| 305 | 305 | |
| 306 | 306 | gpio7: gpio@48051000 { |
| @@ -311,7 +311,7 @@ · 4 unmodified lines | ||
| 311 | 311 | gpio-controller; |
| 312 | 312 | #gpio-cells = <2>; |
| 313 | 313 | interrupt-controller; |
| 314 | − #interrupt-cells = <1>; | |
| 314 | + #interrupt-cells = <2>; | |
| 315 | 315 | }; |
| 316 | 316 | |
| 317 | 317 | gpio8: gpio@48053000 { |
| @@ -322,7 +322,7 @@ · 4 unmodified lines | ||
| 322 | 322 | gpio-controller; |
| 323 | 323 | #gpio-cells = <2>; |
| 324 | 324 | interrupt-controller; |
| 325 | − #interrupt-cells = <1>; | |
| 325 | + #interrupt-cells = <2>; | |
| 326 | 326 | }; |
| 327 | 327 | |
| 328 | 328 | uart1: serial@4806a000 { |
| @@ -134,6 +134,8 @@ · 133 unmodified lines | ||
| 134 | 134 | i2c@13860000 { |
| 135 | 135 | pinctrl-0 = <&i2c0_bus>; |
| 136 | 136 | pinctrl-names = "default"; |
| 137 | + samsung,i2c-sda-delay = <100>; | |
| 138 | + samsung,i2c-max-bus-freq = <400000>; | |
| 137 | 139 | status = "okay"; |
| 138 | 140 | |
| 139 | 141 | usb3503: usb3503@08 { |
| @@ -148,6 +150,10 @@ · 8 unmodified lines | ||
| 148 | 150 | |
| 149 | 151 | max77686: pmic@09 { |
| 150 | 152 | compatible = "maxim,max77686"; |
| 153 | + interrupt-parent = <&gpx3>; | |
| 154 | + interrupts = <2 0>; | |
| 155 | + pinctrl-names = "default"; | |
| 156 | + pinctrl-0 = <&max77686_irq>; | |
| 151 | 157 | reg = <0x09>; |
| 152 | 158 | #clock-cells = <1>; |
| 153 | 159 | |
| @@ -368,4 +374,11 @@ · 214 unmodified lines | ||
| 368 | 374 | samsung,pins = "gpx1-3"; |
| 369 | 375 | samsung,pin-pud = <0>; |
| 370 | 376 | }; |
| 377 | + | |
| 378 | + max77686_irq: max77686-irq { | |
| 379 | + samsung,pins = "gpx3-2"; | |
| 380 | + samsung,pin-function = <0>; | |
| 381 | + samsung,pin-pud = <0>; | |
| 382 | + samsung,pin-drv = <0>; | |
| 383 | + }; | |
| 371 | 384 | }; |
| @@ -28,6 +28,12 @@ · 27 unmodified lines | ||
| 28 | 28 | MX53_PAD_CSI0_DAT9__I2C1_SCL 0x400001ec |
| 29 | 29 | >; |
| 30 | 30 | }; |
| 31 | + | |
| 32 | + pinctrl_pmic: pmicgrp { | |
| 33 | + fsl,pins = < | |
| 34 | + MX53_PAD_CSI0_DAT5__GPIO5_23 0x1e4 /* IRQ */ | |
| 35 | + >; | |
| 36 | + }; | |
| 31 | 37 | }; |
| 32 | 38 | }; |
| 33 | 39 | |
| @@ -38,6 +44,8 @@ · 4 unmodified lines | ||
| 38 | 44 | |
| 39 | 45 | pmic: mc34708@8 { |
| 40 | 46 | compatible = "fsl,mc34708"; |
| 47 | + pinctrl-names = "default"; | |
| 48 | + pinctrl-0 = <&pinctrl_pmic>; | |
| 41 | 49 | reg = <0x08>; |
| 42 | 50 | interrupt-parent = <&gpio5>; |
| 43 | 51 | interrupts = <23 0x8>; |
| @@ -731,7 +731,7 @@ · 730 unmodified lines | ||
| 731 | 731 | compatible = "fsl,imx53-vpu"; |
| 732 | 732 | reg = <0x63ff4000 0x1000>; |
| 733 | 733 | interrupts = <9>; |
| 734 | − clocks = <&clks IMX5_CLK_VPU_GATE>, | |
| 734 | + clocks = <&clks IMX5_CLK_VPU_REFERENCE_GATE>, | |
| 735 | 735 | <&clks IMX5_CLK_VPU_GATE>; |
| 736 | 736 | clock-names = "per", "ahb"; |
| 737 | 737 | resets = <&src 1>; |
| @@ -58,7 +58,7 @@ · 57 unmodified lines | ||
| 58 | 58 | |
| 59 | 59 | sound-spdif { |
| 60 | 60 | compatible = "fsl,imx-audio-spdif"; |
| 61 | − model = "imx-spdif"; | |
| 61 | + model = "On-board SPDIF"; | |
| 62 | 62 | /* IMX6 doesn't implement this yet */ |
| 63 | 63 | spdif-controller = <&spdif>; |
| 64 | 64 | spdif-out; |
| @@ -181,11 +181,13 @@ · 116 unmodified lines | ||
| 181 | 181 | }; |
| 182 | 182 | |
| 183 | 183 | &usbh1 { |
| 184 | + disable-over-current; | |
| 184 | 185 | vbus-supply = <®_usbh1_vbus>; |
| 185 | 186 | status = "okay"; |
| 186 | 187 | }; |
| 187 | 188 | |
| 188 | 189 | &usbotg { |
| 190 | + disable-over-current; | |
| 189 | 191 | pinctrl-names = "default"; |
| 190 | 192 | pinctrl-0 = <&pinctrl_hummingboard_usbotg_id>; |
| 191 | 193 | vbus-supply = <®_usbotg_vbus>; |
| @@ -119,7 +119,7 @@ · 118 unmodified lines | ||
| 119 | 119 | pinctrl-names = "default"; |
| 120 | 120 | pinctrl-0 = <&pinctrl_enet>; |
| 121 | 121 | phy-mode = "rgmii"; |
| 122 | − phy-reset-gpios = <&gpio3 23 0>; | |
| 122 | + phy-reset-gpios = <&gpio1 25 0>; | |
| 123 | 123 | phy-supply = <&vgen2_1v2_eth>; |
| 124 | 124 | status = "okay"; |
| 125 | 125 | }; |
| @@ -339,6 +339,7 @@ · 213 unmodified lines | ||
| 339 | 339 | MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 |
| 340 | 340 | MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 |
| 341 | 341 | MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 |
| 342 | + MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x1b0b0 | |
| 342 | 343 | MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 |
| 343 | 344 | >; |
| 344 | 345 | }; |
| @@ -61,7 +61,7 @@ · 60 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | sound-spdif { |
| 63 | 63 | compatible = "fsl,imx-audio-spdif"; |
| 64 | − model = "imx-spdif"; | |
| 64 | + model = "Integrated SPDIF"; | |
| 65 | 65 | /* IMX6 doesn't implement this yet */ |
| 66 | 66 | spdif-controller = <&spdif>; |
| 67 | 67 | spdif-out; |
| @@ -130,16 +130,23 @@ · 62 unmodified lines | ||
| 130 | 130 | fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; |
| 131 | 131 | }; |
| 132 | 132 | |
| 133 | + pinctrl_cubox_i_usbh1: cubox-i-usbh1 { | |
| 134 | + fsl,pins = <MX6QDL_PAD_GPIO_3__USB_H1_OC 0x1b0b0>; | |
| 135 | + }; | |
| 136 | + | |
| 133 | 137 | pinctrl_cubox_i_usbh1_vbus: cubox-i-usbh1-vbus { |
| 134 | 138 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; |
| 135 | 139 | }; |
| 136 | 140 | |
| 137 | − pinctrl_cubox_i_usbotg_id: cubox-i-usbotg-id { | |
| 141 | + pinctrl_cubox_i_usbotg: cubox-i-usbotg { | |
| 138 | 142 | /* |
| 139 | − * The Cubox-i pulls this low, but as it's pointless | |
| 143 | + * The Cubox-i pulls ID low, but as it's pointless | |
| 140 | 144 | * leaving it as a pull-up, even if it is just 10uA. |
| 141 | 145 | */ |
| 142 | − fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; | |
| 146 | + fsl,pins = < | |
| 147 | + MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059 | |
| 148 | + MX6QDL_PAD_KEY_COL4__USB_OTG_OC 0x1b0b0 | |
| 149 | + >; | |
| 143 | 150 | }; |
| 144 | 151 | |
| 145 | 152 | pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { |
| @@ -173,13 +180,15 @@ · 27 unmodified lines | ||
| 173 | 180 | }; |
| 174 | 181 | |
| 175 | 182 | &usbh1 { |
| 183 | + pinctrl-names = "default"; | |
| 184 | + pinctrl-0 = <&pinctrl_cubox_i_usbh1>; | |
| 176 | 185 | vbus-supply = <®_usbh1_vbus>; |
| 177 | 186 | status = "okay"; |
| 178 | 187 | }; |
| 179 | 188 | |
| 180 | 189 | &usbotg { |
| 181 | 190 | pinctrl-names = "default"; |
| 182 | − pinctrl-0 = <&pinctrl_cubox_i_usbotg_id>; | |
| 191 | + pinctrl-0 = <&pinctrl_cubox_i_usbotg>; | |
| 183 | 192 | vbus-supply = <®_usbotg_vbus>; |
| 184 | 193 | status = "okay"; |
| 185 | 194 | }; |
| @@ -17,7 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | enet { |
| 18 | 18 | pinctrl_microsom_enet_ar8035: microsom-enet-ar8035 { |
| 19 | 19 | fsl,pins = < |
| 20 | − MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 | |
| 20 | + MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b8b0 | |
| 21 | 21 | MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 |
| 22 | 22 | /* AR8035 reset */ |
| 23 | 23 | MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x130b0 |
| @@ -78,7 +78,7 @@ · 77 unmodified lines | ||
| 78 | 78 | #define MX6SX_PAD_GPIO1_IO07__USDHC2_WP 0x0030 0x0378 0x0870 0x1 0x1 |
| 79 | 79 | #define MX6SX_PAD_GPIO1_IO07__ENET2_MDIO 0x0030 0x0378 0x0770 0x2 0x0 |
| 80 | 80 | #define MX6SX_PAD_GPIO1_IO07__AUDMUX_MCLK 0x0030 0x0378 0x0000 0x3 0x0 |
| 81 | −#define MX6SX_PAD_GPIO1_IO07__UART1_CTS_B 0x0030 0x0378 0x082C 0x4 0x1 | |
| 81 | +#define MX6SX_PAD_GPIO1_IO07__UART1_CTS_B 0x0030 0x0378 0x0000 0x4 0x0 | |
| 82 | 82 | #define MX6SX_PAD_GPIO1_IO07__GPIO1_IO_7 0x0030 0x0378 0x0000 0x5 0x0 |
| 83 | 83 | #define MX6SX_PAD_GPIO1_IO07__SRC_EARLY_RESET 0x0030 0x0378 0x0000 0x6 0x0 |
| 84 | 84 | #define MX6SX_PAD_GPIO1_IO07__DCIC2_OUT 0x0030 0x0378 0x0000 0x7 0x0 |
| @@ -96,7 +96,7 @@ · 11 unmodified lines | ||
| 96 | 96 | #define MX6SX_PAD_GPIO1_IO09__WDOG2_WDOG_B 0x0038 0x0380 0x0000 0x1 0x0 |
| 97 | 97 | #define MX6SX_PAD_GPIO1_IO09__SDMA_EXT_EVENT_1 0x0038 0x0380 0x0820 0x2 0x0 |
| 98 | 98 | #define MX6SX_PAD_GPIO1_IO09__CCM_OUT0 0x0038 0x0380 0x0000 0x3 0x0 |
| 99 | −#define MX6SX_PAD_GPIO1_IO09__UART2_CTS_B 0x0038 0x0380 0x0834 0x4 0x1 | |
| 99 | +#define MX6SX_PAD_GPIO1_IO09__UART2_CTS_B 0x0038 0x0380 0x0000 0x4 0x0 | |
| 100 | 100 | #define MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x0038 0x0380 0x0000 0x5 0x0 |
| 101 | 101 | #define MX6SX_PAD_GPIO1_IO09__SRC_INT_BOOT 0x0038 0x0380 0x0000 0x6 0x0 |
| 102 | 102 | #define MX6SX_PAD_GPIO1_IO09__OBSERVE_MUX_OUT_4 0x0038 0x0380 0x0000 0x7 0x0 |
| @@ -213,7 +213,7 @@ · 110 unmodified lines | ||
| 213 | 213 | #define MX6SX_PAD_CSI_DATA07__ESAI_TX3_RX2 0x0068 0x03B0 0x079C 0x1 0x1 |
| 214 | 214 | #define MX6SX_PAD_CSI_DATA07__I2C4_SDA 0x0068 0x03B0 0x07C4 0x2 0x2 |
| 215 | 215 | #define MX6SX_PAD_CSI_DATA07__KPP_ROW_7 0x0068 0x03B0 0x07DC 0x3 0x0 |
| 216 | −#define MX6SX_PAD_CSI_DATA07__UART6_CTS_B 0x0068 0x03B0 0x0854 0x4 0x1 | |
| 216 | +#define MX6SX_PAD_CSI_DATA07__UART6_CTS_B 0x0068 0x03B0 0x0000 0x4 0x0 | |
| 217 | 217 | #define MX6SX_PAD_CSI_DATA07__GPIO1_IO_21 0x0068 0x03B0 0x0000 0x5 0x0 |
| 218 | 218 | #define MX6SX_PAD_CSI_DATA07__WEIM_DATA_16 0x0068 0x03B0 0x0000 0x6 0x0 |
| 219 | 219 | #define MX6SX_PAD_CSI_DATA07__DCIC1_OUT 0x0068 0x03B0 0x0000 0x7 0x0 |
| @@ -254,7 +254,7 @@ · 34 unmodified lines | ||
| 254 | 254 | #define MX6SX_PAD_CSI_VSYNC__CSI1_VSYNC 0x0078 0x03C0 0x0708 0x0 0x0 |
| 255 | 255 | #define MX6SX_PAD_CSI_VSYNC__ESAI_TX5_RX0 0x0078 0x03C0 0x07A4 0x1 0x1 |
| 256 | 256 | #define MX6SX_PAD_CSI_VSYNC__AUDMUX_AUD6_RXD 0x0078 0x03C0 0x0674 0x2 0x1 |
| 257 | −#define MX6SX_PAD_CSI_VSYNC__UART4_CTS_B 0x0078 0x03C0 0x0844 0x3 0x3 | |
| 257 | +#define MX6SX_PAD_CSI_VSYNC__UART4_CTS_B 0x0078 0x03C0 0x0000 0x3 0x0 | |
| 258 | 258 | #define MX6SX_PAD_CSI_VSYNC__MQS_RIGHT 0x0078 0x03C0 0x0000 0x4 0x0 |
| 259 | 259 | #define MX6SX_PAD_CSI_VSYNC__GPIO1_IO_25 0x0078 0x03C0 0x0000 0x5 0x0 |
| 260 | 260 | #define MX6SX_PAD_CSI_VSYNC__WEIM_DATA_24 0x0078 0x03C0 0x0000 0x6 0x0 |
| @@ -352,7 +352,7 @@ · 91 unmodified lines | ||
| 352 | 352 | #define MX6SX_PAD_ENET2_TX_CLK__ENET2_TX_CLK 0x00A0 0x03E8 0x0000 0x0 0x0 |
| 353 | 353 | #define MX6SX_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x00A0 0x03E8 0x076C 0x1 0x1 |
| 354 | 354 | #define MX6SX_PAD_ENET2_TX_CLK__I2C3_SDA 0x00A0 0x03E8 0x07BC 0x2 0x1 |
| 355 | −#define MX6SX_PAD_ENET2_TX_CLK__UART1_CTS_B 0x00A0 0x03E8 0x082C 0x3 0x3 | |
| 355 | +#define MX6SX_PAD_ENET2_TX_CLK__UART1_CTS_B 0x00A0 0x03E8 0x0000 0x3 0x0 | |
| 356 | 356 | #define MX6SX_PAD_ENET2_TX_CLK__MLB_CLK 0x00A0 0x03E8 0x07E8 0x4 0x1 |
| 357 | 357 | #define MX6SX_PAD_ENET2_TX_CLK__GPIO2_IO_9 0x00A0 0x03E8 0x0000 0x5 0x0 |
| 358 | 358 | #define MX6SX_PAD_ENET2_TX_CLK__USB_OTG2_PWR 0x00A0 0x03E8 0x0000 0x6 0x0 |
| @@ -404,7 +404,7 @@ · 45 unmodified lines | ||
| 404 | 404 | #define MX6SX_PAD_KEY_COL4__SAI2_RX_BCLK 0x00B4 0x03FC 0x0808 0x7 0x0 |
| 405 | 405 | #define MX6SX_PAD_KEY_ROW0__KPP_ROW_0 0x00B8 0x0400 0x0000 0x0 0x0 |
| 406 | 406 | #define MX6SX_PAD_KEY_ROW0__USDHC3_WP 0x00B8 0x0400 0x0000 0x1 0x0 |
| 407 | −#define MX6SX_PAD_KEY_ROW0__UART6_CTS_B 0x00B8 0x0400 0x0854 0x2 0x3 | |
| 407 | +#define MX6SX_PAD_KEY_ROW0__UART6_CTS_B 0x00B8 0x0400 0x0000 0x2 0x0 | |
| 408 | 408 | #define MX6SX_PAD_KEY_ROW0__ECSPI1_MOSI 0x00B8 0x0400 0x0718 0x3 0x0 |
| 409 | 409 | #define MX6SX_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x00B8 0x0400 0x0660 0x4 0x0 |
| 410 | 410 | #define MX6SX_PAD_KEY_ROW0__GPIO2_IO_15 0x00B8 0x0400 0x0000 0x5 0x0 |
| @@ -423,7 +423,7 @@ · 12 unmodified lines | ||
| 423 | 423 | #define MX6SX_PAD_KEY_ROW1__M4_NMI 0x00BC 0x0404 0x0000 0x8 0x0 |
| 424 | 424 | #define MX6SX_PAD_KEY_ROW2__KPP_ROW_2 0x00C0 0x0408 0x0000 0x0 0x0 |
| 425 | 425 | #define MX6SX_PAD_KEY_ROW2__USDHC4_WP 0x00C0 0x0408 0x0878 0x1 0x1 |
| 426 | −#define MX6SX_PAD_KEY_ROW2__UART5_CTS_B 0x00C0 0x0408 0x084C 0x2 0x3 | |
| 426 | +#define MX6SX_PAD_KEY_ROW2__UART5_CTS_B 0x00C0 0x0408 0x0000 0x2 0x0 | |
| 427 | 427 | #define MX6SX_PAD_KEY_ROW2__CAN1_RX 0x00C0 0x0408 0x068C 0x3 0x1 |
| 428 | 428 | #define MX6SX_PAD_KEY_ROW2__CANFD_RX1 0x00C0 0x0408 0x0694 0x4 0x1 |
| 429 | 429 | #define MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x00C0 0x0408 0x0000 0x5 0x0 |
| @@ -815,7 +815,7 @@ · 385 unmodified lines | ||
| 815 | 815 | #define MX6SX_PAD_NAND_DATA05__RAWNAND_DATA05 0x0164 0x04AC 0x0000 0x0 0x0 |
| 816 | 816 | #define MX6SX_PAD_NAND_DATA05__USDHC2_DATA5 0x0164 0x04AC 0x0000 0x1 0x0 |
| 817 | 817 | #define MX6SX_PAD_NAND_DATA05__QSPI2_B_DQS 0x0164 0x04AC 0x0000 0x2 0x0 |
| 818 | −#define MX6SX_PAD_NAND_DATA05__UART3_CTS_B 0x0164 0x04AC 0x083C 0x3 0x1 | |
| 818 | +#define MX6SX_PAD_NAND_DATA05__UART3_CTS_B 0x0164 0x04AC 0x0000 0x3 0x0 | |
| 819 | 819 | #define MX6SX_PAD_NAND_DATA05__AUDMUX_AUD4_RXC 0x0164 0x04AC 0x064C 0x4 0x0 |
| 820 | 820 | #define MX6SX_PAD_NAND_DATA05__GPIO4_IO_9 0x0164 0x04AC 0x0000 0x5 0x0 |
| 821 | 821 | #define MX6SX_PAD_NAND_DATA05__WEIM_AD_5 0x0164 0x04AC 0x0000 0x6 0x0 |
| @@ -957,7 +957,7 @@ · 135 unmodified lines | ||
| 957 | 957 | #define MX6SX_PAD_QSPI1A_SS1_B__SIM_M_HADDR_12 0x019C 0x04E4 0x0000 0x7 0x0 |
| 958 | 958 | #define MX6SX_PAD_QSPI1A_SS1_B__SDMA_DEBUG_PC_3 0x019C 0x04E4 0x0000 0x9 0x0 |
| 959 | 959 | #define MX6SX_PAD_QSPI1B_DATA0__QSPI1_B_DATA_0 0x01A0 0x04E8 0x0000 0x0 0x0 |
| 960 | −#define MX6SX_PAD_QSPI1B_DATA0__UART3_CTS_B 0x01A0 0x04E8 0x083C 0x1 0x4 | |
| 960 | +#define MX6SX_PAD_QSPI1B_DATA0__UART3_CTS_B 0x01A0 0x04E8 0x0000 0x1 0x0 | |
| 961 | 961 | #define MX6SX_PAD_QSPI1B_DATA0__ECSPI3_MOSI 0x01A0 0x04E8 0x0738 0x2 0x1 |
| 962 | 962 | #define MX6SX_PAD_QSPI1B_DATA0__ESAI_RX_FS 0x01A0 0x04E8 0x0778 0x3 0x2 |
| 963 | 963 | #define MX6SX_PAD_QSPI1B_DATA0__CSI1_DATA_22 0x01A0 0x04E8 0x06F4 0x4 0x1 |
| @@ -1236,7 +1236,7 @@ · 272 unmodified lines | ||
| 1236 | 1236 | #define MX6SX_PAD_SD1_DATA2__AUDMUX_AUD5_TXFS 0x0230 0x0578 0x0670 0x1 0x1 |
| 1237 | 1237 | #define MX6SX_PAD_SD1_DATA2__PWM3_OUT 0x0230 0x0578 0x0000 0x2 0x0 |
| 1238 | 1238 | #define MX6SX_PAD_SD1_DATA2__GPT_COMPARE2 0x0230 0x0578 0x0000 0x3 0x0 |
| 1239 | −#define MX6SX_PAD_SD1_DATA2__UART2_CTS_B 0x0230 0x0578 0x0834 0x4 0x2 | |
| 1239 | +#define MX6SX_PAD_SD1_DATA2__UART2_CTS_B 0x0230 0x0578 0x0000 0x4 0x0 | |
| 1240 | 1240 | #define MX6SX_PAD_SD1_DATA2__GPIO6_IO_4 0x0230 0x0578 0x0000 0x5 0x0 |
| 1241 | 1241 | #define MX6SX_PAD_SD1_DATA2__ECSPI4_RDY 0x0230 0x0578 0x0000 0x6 0x0 |
| 1242 | 1242 | #define MX6SX_PAD_SD1_DATA2__CCM_OUT0 0x0230 0x0578 0x0000 0x7 0x0 |
| @@ -1315,7 +1315,7 @@ · 72 unmodified lines | ||
| 1315 | 1315 | #define MX6SX_PAD_SD2_DATA3__VADC_CLAMP_CURRENT_3 0x024C 0x0594 0x0000 0x8 0x0 |
| 1316 | 1316 | #define MX6SX_PAD_SD2_DATA3__MMDC_DEBUG_31 0x024C 0x0594 0x0000 0x9 0x0 |
| 1317 | 1317 | #define MX6SX_PAD_SD3_CLK__USDHC3_CLK 0x0250 0x0598 0x0000 0x0 0x0 |
| 1318 | −#define MX6SX_PAD_SD3_CLK__UART4_CTS_B 0x0250 0x0598 0x0844 0x1 0x0 | |
| 1318 | +#define MX6SX_PAD_SD3_CLK__UART4_CTS_B 0x0250 0x0598 0x0000 0x1 0x0 | |
| 1319 | 1319 | #define MX6SX_PAD_SD3_CLK__ECSPI4_SCLK 0x0250 0x0598 0x0740 0x2 0x0 |
| 1320 | 1320 | #define MX6SX_PAD_SD3_CLK__AUDMUX_AUD6_RXFS 0x0250 0x0598 0x0680 0x3 0x0 |
| 1321 | 1321 | #define MX6SX_PAD_SD3_CLK__LCDIF2_VSYNC 0x0250 0x0598 0x0000 0x4 0x0 |
| @@ -1409,7 +1409,7 @@ · 87 unmodified lines | ||
| 1409 | 1409 | #define MX6SX_PAD_SD3_DATA7__USDHC3_DATA7 0x0274 0x05BC 0x0000 0x0 0x0 |
| 1410 | 1410 | #define MX6SX_PAD_SD3_DATA7__CAN1_RX 0x0274 0x05BC 0x068C 0x1 0x0 |
| 1411 | 1411 | #define MX6SX_PAD_SD3_DATA7__CANFD_RX1 0x0274 0x05BC 0x0694 0x2 0x0 |
| 1412 | −#define MX6SX_PAD_SD3_DATA7__UART3_CTS_B 0x0274 0x05BC 0x083C 0x3 0x3 | |
| 1412 | +#define MX6SX_PAD_SD3_DATA7__UART3_CTS_B 0x0274 0x05BC 0x0000 0x3 0x0 | |
| 1413 | 1413 | #define MX6SX_PAD_SD3_DATA7__LCDIF2_DATA_5 0x0274 0x05BC 0x0000 0x4 0x0 |
| 1414 | 1414 | #define MX6SX_PAD_SD3_DATA7__GPIO7_IO_9 0x0274 0x05BC 0x0000 0x5 0x0 |
| 1415 | 1415 | #define MX6SX_PAD_SD3_DATA7__ENET1_1588_EVENT0_IN 0x0274 0x05BC 0x0000 0x6 0x0 |
| @@ -1510,7 +1510,7 @@ · 94 unmodified lines | ||
| 1510 | 1510 | #define MX6SX_PAD_SD4_DATA6__SDMA_DEBUG_EVENT_CHANNEL_1 0x0298 0x05E0 0x0000 0x9 0x0 |
| 1511 | 1511 | #define MX6SX_PAD_SD4_DATA7__USDHC4_DATA7 0x029C 0x05E4 0x0000 0x0 0x0 |
| 1512 | 1512 | #define MX6SX_PAD_SD4_DATA7__RAWNAND_DATA08 0x029C 0x05E4 0x0000 0x1 0x0 |
| 1513 | −#define MX6SX_PAD_SD4_DATA7__UART5_CTS_B 0x029C 0x05E4 0x084C 0x2 0x1 | |
| 1513 | +#define MX6SX_PAD_SD4_DATA7__UART5_CTS_B 0x029C 0x05E4 0x0000 0x2 0x0 | |
| 1514 | 1514 | #define MX6SX_PAD_SD4_DATA7__ECSPI3_SS0 0x029C 0x05E4 0x073C 0x3 0x0 |
| 1515 | 1515 | #define MX6SX_PAD_SD4_DATA7__LCDIF2_DATA_15 0x029C 0x05E4 0x0000 0x4 0x0 |
| 1516 | 1516 | #define MX6SX_PAD_SD4_DATA7__GPIO6_IO_21 0x029C 0x05E4 0x0000 0x5 0x0 |
| @@ -292,6 +292,7 @@ · 291 unmodified lines | ||
| 292 | 292 | &uart3 { |
| 293 | 293 | pinctrl-names = "default"; |
| 294 | 294 | pinctrl-0 = <&uart3_pins>; |
| 295 | + interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>; | |
| 295 | 296 | }; |
| 296 | 297 | |
| 297 | 298 | &gpio1 { |
| @@ -353,7 +353,7 @@ · 352 unmodified lines | ||
| 353 | 353 | }; |
| 354 | 354 | |
| 355 | 355 | twl_power: power { |
| 356 | − compatible = "ti,twl4030-power-n900"; | |
| 356 | + compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off"; | |
| 357 | 357 | ti,use_poweroff; |
| 358 | 358 | }; |
| 359 | 359 | }; |
| @@ -107,7 +107,7 @@ · 106 unmodified lines | ||
| 107 | 107 | #address-cells = <1>; |
| 108 | 108 | #size-cells = <1>; |
| 109 | 109 | reg = <1 0 0x08000000>; |
| 110 | − ti,nand-ecc-opt = "ham1"; | |
| 110 | + ti,nand-ecc-opt = "sw"; | |
| 111 | 111 | nand-bus-width = <8>; |
| 112 | 112 | gpmc,cs-on-ns = <0>; |
| 113 | 113 | gpmc,cs-rd-off-ns = <36>; |
| @@ -467,6 +467,7 @@ · 466 unmodified lines | ||
| 467 | 467 | ti,bit-shift = <0x1e>; |
| 468 | 468 | reg = <0x0d00>; |
| 469 | 469 | ti,set-bit-to-disable; |
| 470 | + ti,set-rate-parent; | |
| 470 | 471 | }; |
| 471 | 472 | |
| 472 | 473 | dpll4_m6_ck: dpll4_m6_ck { |
| @@ -367,10 +367,12 @@ · 366 unmodified lines | ||
| 367 | 367 | |
| 368 | 368 | l3_iclk_div: l3_iclk_div { |
| 369 | 369 | #clock-cells = <0>; |
| 370 | − compatible = "fixed-factor-clock"; | |
| 370 | + compatible = "ti,divider-clock"; | |
| 371 | + ti,max-div = <2>; | |
| 372 | + ti,bit-shift = <4>; | |
| 373 | + reg = <0x100>; | |
| 371 | 374 | clocks = <&dpll_core_h12x2_ck>; |
| 372 | − clock-mult = <1>; | |
| 373 | − clock-div = <1>; | |
| 375 | + ti,index-power-of-two; | |
| 374 | 376 | }; |
| 375 | 377 | |
| 376 | 378 | gpu_l3_iclk: gpu_l3_iclk { |
| @@ -383,10 +385,12 @@ · 6 unmodified lines | ||
| 383 | 385 | |
| 384 | 386 | l4_root_clk_div: l4_root_clk_div { |
| 385 | 387 | #clock-cells = <0>; |
| 386 | − compatible = "fixed-factor-clock"; | |
| 388 | + compatible = "ti,divider-clock"; | |
| 389 | + ti,max-div = <2>; | |
| 390 | + ti,bit-shift = <8>; | |
| 391 | + reg = <0x100>; | |
| 387 | 392 | clocks = <&l3_iclk_div>; |
| 388 | − clock-mult = <1>; | |
| 389 | − clock-div = <1>; | |
| 393 | + ti,index-power-of-two; | |
| 390 | 394 | }; |
| 391 | 395 | |
| 392 | 396 | slimbus1_slimbus_clk: slimbus1_slimbus_clk { |
| @@ -275,11 +275,6 @@ · 274 unmodified lines | ||
| 275 | 275 | renesas,function = "msiof0"; |
| 276 | 276 | }; |
| 277 | 277 | |
| 278 | − i2c6_pins: i2c6 { | |
| 279 | − renesas,groups = "i2c6"; | |
| 280 | − renesas,function = "i2c6"; | |
| 281 | − }; | |
| 282 | − | |
| 283 | 278 | usb0_pins: usb0 { |
| 284 | 279 | renesas,groups = "usb0"; |
| 285 | 280 | renesas,function = "usb0"; |
| @@ -420,8 +415,6 @@ · 134 unmodified lines | ||
| 420 | 415 | }; |
| 421 | 416 | |
| 422 | 417 | &i2c6 { |
| 423 | − pinctrl-names = "default"; | |
| 424 | − pinctrl-0 = <&i2c6_pins>; | |
| 425 | 418 | status = "okay"; |
| 426 | 419 | clock-frequency = <100000>; |
| 427 | 420 | |
| @@ -149,6 +149,8 @@ · 148 unmodified lines | ||
| 149 | 149 | &mmc0 { /* sdmmc */ |
| 150 | 150 | num-slots = <1>; |
| 151 | 151 | status = "okay"; |
| 152 | + pinctrl-names = "default"; | |
| 153 | + pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>; | |
| 152 | 154 | vmmc-supply = <&vcc_sd0>; |
| 153 | 155 | |
| 154 | 156 | slot@0 { |
| @@ -179,6 +179,8 @@ · 178 unmodified lines | ||
| 179 | 179 | &mmc0 { |
| 180 | 180 | num-slots = <1>; |
| 181 | 181 | status = "okay"; |
| 182 | + pinctrl-names = "default"; | |
| 183 | + pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>; | |
| 182 | 184 | vmmc-supply = <&vcc_sd0>; |
| 183 | 185 | |
| 184 | 186 | slot@0 { |
| @@ -116,7 +116,6 @@ · 115 unmodified lines | ||
| 116 | 116 | msp2: msp@80117000 { |
| 117 | 117 | pinctrl-names = "default"; |
| 118 | 118 | pinctrl-0 = <&msp2_default_mode>; |
| 119 | − status = "okay"; | |
| 120 | 119 | }; |
| 121 | 120 | |
| 122 | 121 | msp3: msp@80125000 { |
| @@ -660,6 +660,8 @@ · 659 unmodified lines | ||
| 660 | 660 | clock-frequency = <100000>; |
| 661 | 661 | resets = <&apb2_rst 0>; |
| 662 | 662 | status = "disabled"; |
| 663 | + #address-cells = <1>; | |
| 664 | + #size-cells = <0>; | |
| 663 | 665 | }; |
| 664 | 666 | |
| 665 | 667 | i2c1: i2c@01c2b000 { |
| @@ -670,6 +672,8 @@ · 4 unmodified lines | ||
| 670 | 672 | clock-frequency = <100000>; |
| 671 | 673 | resets = <&apb2_rst 1>; |
| 672 | 674 | status = "disabled"; |
| 675 | + #address-cells = <1>; | |
| 676 | + #size-cells = <0>; | |
| 673 | 677 | }; |
| 674 | 678 | |
| 675 | 679 | i2c2: i2c@01c2b400 { |
| @@ -680,6 +684,8 @@ · 4 unmodified lines | ||
| 680 | 684 | clock-frequency = <100000>; |
| 681 | 685 | resets = <&apb2_rst 2>; |
| 682 | 686 | status = "disabled"; |
| 687 | + #address-cells = <1>; | |
| 688 | + #size-cells = <0>; | |
| 683 | 689 | }; |
| 684 | 690 | |
| 685 | 691 | i2c3: i2c@01c2b800 { |
| @@ -690,6 +696,8 @@ · 4 unmodified lines | ||
| 690 | 696 | clock-frequency = <100000>; |
| 691 | 697 | resets = <&apb2_rst 3>; |
| 692 | 698 | status = "disabled"; |
| 699 | + #address-cells = <1>; | |
| 700 | + #size-cells = <0>; | |
| 693 | 701 | }; |
| 694 | 702 | |
| 695 | 703 | gmac: ethernet@01c30000 { |
| @@ -423,7 +423,7 @@ · 422 unmodified lines | ||
| 423 | 423 | vcc4-supply = <&sys_3v3_reg>; |
| 424 | 424 | vcc5-supply = <&sys_3v3_reg>; |
| 425 | 425 | vcc6-supply = <&vio_reg>; |
| 426 | − vcc7-supply = <&sys_5v0_reg>; | |
| 426 | + vcc7-supply = <&charge_pump_5v0_reg>; | |
| 427 | 427 | vccio-supply = <&sys_3v3_reg>; |
| 428 | 428 | |
| 429 | 429 | regulators { |
| @@ -674,5 +674,14 @@ · 244 unmodified lines | ||
| 674 | 674 | regulator-max-microvolt = <3300000>; |
| 675 | 675 | regulator-always-on; |
| 676 | 676 | }; |
| 677 | + | |
| 678 | + charge_pump_5v0_reg: regulator@101 { | |
| 679 | + compatible = "regulator-fixed"; | |
| 680 | + reg = <101>; | |
| 681 | + regulator-name = "5v0"; | |
| 682 | + regulator-min-microvolt = <5000000>; | |
| 683 | + regulator-max-microvolt = <5000000>; | |
| 684 | + regulator-always-on; | |
| 685 | + }; | |
| 677 | 686 | }; |
| 678 | 687 | }; |
| @@ -201,7 +201,7 @@ · 200 unmodified lines | ||
| 201 | 201 | vcc4-supply = <&sys_3v3_reg>; |
| 202 | 202 | vcc5-supply = <&sys_3v3_reg>; |
| 203 | 203 | vcc6-supply = <&vio_reg>; |
| 204 | − vcc7-supply = <&sys_5v0_reg>; | |
| 204 | + vcc7-supply = <&charge_pump_5v0_reg>; | |
| 205 | 205 | vccio-supply = <&sys_3v3_reg>; |
| 206 | 206 | |
| 207 | 207 | regulators { |
| @@ -373,5 +373,14 @@ · 165 unmodified lines | ||
| 373 | 373 | regulator-max-microvolt = <3300000>; |
| 374 | 374 | regulator-always-on; |
| 375 | 375 | }; |
| 376 | + | |
| 377 | + charge_pump_5v0_reg: regulator@101 { | |
| 378 | + compatible = "regulator-fixed"; | |
| 379 | + reg = <101>; | |
| 380 | + regulator-name = "5v0"; | |
| 381 | + regulator-min-microvolt = <5000000>; | |
| 382 | + regulator-max-microvolt = <5000000>; | |
| 383 | + regulator-always-on; | |
| 384 | + }; | |
| 376 | 385 | }; |
| 377 | 386 | }; |
| @@ -83,10 +83,6 @@ · 82 unmodified lines | ||
| 83 | 83 | regulator-always-on; |
| 84 | 84 | }; |
| 85 | 85 | |
| 86 | − clk32kg: regulator-clk32kg { | |
| 87 | − compatible = "ti,twl6030-clk32kg"; | |
| 88 | − }; | |
| 89 | − | |
| 90 | 86 | twl_usb_comparator: usb-comparator { |
| 91 | 87 | compatible = "ti,twl6030-usb"; |
| 92 | 88 | interrupts = <4>, <10>; |
| @@ -168,7 +168,7 @@ · 167 unmodified lines | ||
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | 170 | pinctrl_esdhc1: esdhc1grp { |
| 171 | − fsl,fsl,pins = < | |
| 171 | + fsl,pins = < | |
| 172 | 172 | VF610_PAD_PTA24__ESDHC1_CLK 0x31ef |
| 173 | 173 | VF610_PAD_PTA25__ESDHC1_CMD 0x31ef |
| 174 | 174 | VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef |
| @@ -1443,14 +1443,14 @@ void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no) · 1442 unmodified lines | ||
| 1443 | 1443 | EXPORT_SYMBOL(edma_assign_channel_eventq); |
| 1444 | 1444 | |
| 1445 | 1445 | static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata, |
| 1446 | − struct edma *edma_cc) | |
| 1446 | + struct edma *edma_cc, int cc_id) | |
| 1447 | 1447 | { |
| 1448 | 1448 | int i; |
| 1449 | 1449 | u32 value, cccfg; |
| 1450 | 1450 | s8 (*queue_priority_map)[2]; |
| 1451 | 1451 | |
| 1452 | 1452 | /* Decode the eDMA3 configuration from CCCFG register */ |
| 1453 | − cccfg = edma_read(0, EDMA_CCCFG); | |
| 1453 | + cccfg = edma_read(cc_id, EDMA_CCCFG); | |
| 1454 | 1454 | |
| 1455 | 1455 | value = GET_NUM_REGN(cccfg); |
| 1456 | 1456 | edma_cc->num_region = BIT(value); |
| @@ -1464,7 +1464,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata, · 7 unmodified lines | ||
| 1464 | 1464 | value = GET_NUM_EVQUE(cccfg); |
| 1465 | 1465 | edma_cc->num_tc = value + 1; |
| 1466 | 1466 | |
| 1467 | − dev_dbg(dev, "eDMA3 HW configuration (cccfg: 0x%08x):\n", cccfg); | |
| 1467 | + dev_dbg(dev, "eDMA3 CC%d HW configuration (cccfg: 0x%08x):\n", cc_id, | |
| 1468 | + cccfg); | |
| 1468 | 1469 | dev_dbg(dev, "num_region: %u\n", edma_cc->num_region); |
| 1469 | 1470 | dev_dbg(dev, "num_channel: %u\n", edma_cc->num_channels); |
| 1470 | 1471 | dev_dbg(dev, "num_slot: %u\n", edma_cc->num_slots); |
| @@ -1684,7 +1685,7 @@ static int edma_probe(struct platform_device *pdev) · 213 unmodified lines | ||
| 1684 | 1685 | return -ENOMEM; |
| 1685 | 1686 | |
| 1686 | 1687 | /* Get eDMA3 configuration from IP */ |
| 1687 | − ret = edma_setup_from_hw(dev, info[j], edma_cc[j]); | |
| 1688 | + ret = edma_setup_from_hw(dev, info[j], edma_cc[j], j); | |
| 1688 | 1689 | if (ret) |
| 1689 | 1690 | return ret; |
| 1690 | 1691 | |
| @@ -472,7 +472,6 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size) · 471 unmodified lines | ||
| 472 | 472 | "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR \n\t" \ |
| 473 | 473 | "isb \n\t" \ |
| 474 | 474 | "bl v7_flush_dcache_"__stringify(level)" \n\t" \ |
| 475 | − "clrex \n\t" \ | |
| 476 | 475 | "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR \n\t" \ |
| 477 | 476 | "bic r0, r0, #(1 << 6) @ disable local coherency \n\t" \ |
| 478 | 477 | "mcr p15, 0, r0, c1, c0, 1 @ set ACTLR \n\t" \ |
| @@ -74,6 +74,7 @@ · 73 unmodified lines | ||
| 74 | 74 | #define ARM_CPU_PART_CORTEX_A12 0x4100c0d0 |
| 75 | 75 | #define ARM_CPU_PART_CORTEX_A17 0x4100c0e0 |
| 76 | 76 | #define ARM_CPU_PART_CORTEX_A15 0x4100c0f0 |
| 77 | +#define ARM_CPU_PART_MASK 0xff00fff0 | |
| 77 | 78 | |
| 78 | 79 | #define ARM_CPU_XSCALE_ARCH_MASK 0xe000 |
| 79 | 80 | #define ARM_CPU_XSCALE_ARCH_V1 0x2000 |
| @@ -179,7 +180,7 @@ static inline unsigned int __attribute_const__ read_cpuid_implementor(void) · 99 unmodified lines | ||
| 179 | 180 | */ |
| 180 | 181 | static inline unsigned int __attribute_const__ read_cpuid_part(void) |
| 181 | 182 | { |
| 182 | − return read_cpuid_id() & 0xff00fff0; | |
| 183 | + return read_cpuid_id() & ARM_CPU_PART_MASK; | |
| 183 | 184 | } |
| 184 | 185 | |
| 185 | 186 | static inline unsigned int __attribute_const__ __deprecated read_cpuid_part_number(void) |
| @@ -50,6 +50,7 @@ typedef struct user_fp elf_fpregset_t; · 49 unmodified lines | ||
| 50 | 50 | #define R_ARM_ABS32 2 |
| 51 | 51 | #define R_ARM_CALL 28 |
| 52 | 52 | #define R_ARM_JUMP24 29 |
| 53 | +#define R_ARM_TARGET1 38 | |
| 53 | 54 | #define R_ARM_V4BX 40 |
| 54 | 55 | #define R_ARM_PREL31 42 |
| 55 | 56 | #define R_ARM_MOVW_ABS_NC 43 |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/cpumask.h> |
| 9 | 9 | #include <linux/err.h> |
| 10 | 10 | |
| 11 | +#include <asm/cpu.h> | |
| 11 | 12 | #include <asm/cputype.h> |
| 12 | 13 | |
| 13 | 14 | /* |
| @@ -25,6 +26,20 @@ static inline bool is_smp(void) · 11 unmodified lines | ||
| 25 | 26 | #endif |
| 26 | 27 | } |
| 27 | 28 | |
| 29 | +/** | |
| 30 | + * smp_cpuid_part() - return part id for a given cpu | |
| 31 | + * @cpu: logical cpu id. | |
| 32 | + * | |
| 33 | + * Return: part id of logical cpu passed as argument. | |
| 34 | + */ | |
| 35 | +static inline unsigned int smp_cpuid_part(int cpu) | |
| 36 | +{ | |
| 37 | + struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpu); | |
| 38 | + | |
| 39 | + return is_smp() ? cpu_info->cpuid & ARM_CPU_PART_MASK : | |
| 40 | + read_cpuid_part(); | |
| 41 | +} | |
| 42 | + | |
| 28 | 43 | /* all SMP configurations have the extended CPUID registers */ |
| 29 | 44 | #ifndef CONFIG_MMU |
| 30 | 45 | #define tlb_ops_need_broadcast() 0 |
| @@ -208,26 +208,21 @@ · 207 unmodified lines | ||
| 208 | 208 | #endif |
| 209 | 209 | .endif |
| 210 | 210 | msr spsr_cxsf, \rpsr |
| 211 | −#if defined(CONFIG_CPU_V6) | |
| 212 | − ldr r0, [sp] | |
| 213 | − strex r1, r2, [sp] @ clear the exclusive monitor | |
| 214 | − ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr | |
| 215 | −#elif defined(CONFIG_CPU_32v6K) | |
| 216 | − clrex @ clear the exclusive monitor | |
| 217 | − ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr | |
| 218 | −#else | |
| 219 | − ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr | |
| 211 | +#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K) | |
| 212 | + @ We must avoid clrex due to Cortex-A15 erratum #830321 | |
| 213 | + sub r0, sp, #4 @ uninhabited address | |
| 214 | + strex r1, r2, [r0] @ clear the exclusive monitor | |
| 220 | 215 | #endif |
| 216 | + ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr | |
| 221 | 217 | .endm |
| 222 | 218 | |
| 223 | 219 | .macro restore_user_regs, fast = 0, offset = 0 |
| 224 | 220 | ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr |
| 225 | 221 | ldr lr, [sp, #\offset + S_PC]! @ get pc |
| 226 | 222 | msr spsr_cxsf, r1 @ save in spsr_svc |
| 227 | −#if defined(CONFIG_CPU_V6) | |
| 223 | +#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K) | |
| 224 | + @ We must avoid clrex due to Cortex-A15 erratum #830321 | |
| 228 | 225 | strex r1, r2, [sp] @ clear the exclusive monitor |
| 229 | −#elif defined(CONFIG_CPU_32v6K) | |
| 230 | − clrex @ clear the exclusive monitor | |
| 231 | 226 | #endif |
| 232 | 227 | .if \fast |
| 233 | 228 | ldmdb sp, {r1 - lr}^ @ get calling r1 - lr |
| @@ -261,7 +256,10 @@ · 27 unmodified lines | ||
| 261 | 256 | .endif |
| 262 | 257 | ldr lr, [sp, #S_SP] @ top of the stack |
| 263 | 258 | ldrd r0, r1, [sp, #S_LR] @ calling lr and pc |
| 264 | − clrex @ clear the exclusive monitor | |
| 259 | + | |
| 260 | + @ We must avoid clrex due to Cortex-A15 erratum #830321 | |
| 261 | + strex r2, r1, [sp, #S_LR] @ clear the exclusive monitor | |
| 262 | + | |
| 265 | 263 | stmdb lr!, {r0, r1, \rpsr} @ calling lr and rfe context |
| 266 | 264 | ldmia sp, {r0 - r12} |
| 267 | 265 | mov sp, lr |
| @@ -282,13 +280,16 @@ · 14 unmodified lines | ||
| 282 | 280 | .endm |
| 283 | 281 | #else /* ifdef CONFIG_CPU_V7M */ |
| 284 | 282 | .macro restore_user_regs, fast = 0, offset = 0 |
| 285 | − clrex @ clear the exclusive monitor | |
| 286 | 283 | mov r2, sp |
| 287 | 284 | load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr |
| 288 | 285 | ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr |
| 289 | 286 | ldr lr, [sp, #\offset + S_PC] @ get pc |
| 290 | 287 | add sp, sp, #\offset + S_SP |
| 291 | 288 | msr spsr_cxsf, r1 @ save in spsr_svc |
| 289 | + | |
| 290 | + @ We must avoid clrex due to Cortex-A15 erratum #830321 | |
| 291 | + strex r1, r2, [sp] @ clear the exclusive monitor | |
| 292 | + | |
| 292 | 293 | .if \fast |
| 293 | 294 | ldmdb sp, {r1 - r12} @ get calling r1 - r12 |
| 294 | 295 | .else |
| @@ -91,6 +91,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, · 90 unmodified lines | ||
| 91 | 91 | break; |
| 92 | 92 | |
| 93 | 93 | case R_ARM_ABS32: |
| 94 | + case R_ARM_TARGET1: | |
| 94 | 95 | *(u32 *)loc += sym->st_value; |
| 95 | 96 | break; |
| 96 | 97 | |
| @@ -93,6 +93,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) · 92 unmodified lines | ||
| 93 | 93 | else |
| 94 | 94 | kvm_vcpu_block(vcpu); |
| 95 | 95 | |
| 96 | + kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); | |
| 97 | + | |
| 96 | 98 | return 1; |
| 97 | 99 | } |
| 98 | 100 | |
| @@ -99,6 +99,10 @@ __do_hyp_init: · 98 unmodified lines | ||
| 99 | 99 | mrc p15, 0, r0, c10, c2, 1 |
| 100 | 100 | mcr p15, 4, r0, c10, c2, 1 |
| 101 | 101 | |
| 102 | + @ Invalidate the stale TLBs from Bootloader | |
| 103 | + mcr p15, 4, r0, c8, c7, 0 @ TLBIALLH | |
| 104 | + dsb ish | |
| 105 | + | |
| 102 | 106 | @ Set the HSCTLR to: |
| 103 | 107 | @ - ARM/THUMB exceptions: Kernel config (Thumb-2 kernel) |
| 104 | 108 | @ - Endianness: Kernel config |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/gpio.h> |
| 15 | 15 | #include <linux/of.h> |
| 16 | 16 | #include <linux/of_irq.h> |
| 17 | +#include <linux/clk-provider.h> | |
| 17 | 18 | |
| 18 | 19 | #include <asm/setup.h> |
| 19 | 20 | #include <asm/irq.h> |
| @@ -35,13 +36,21 @@ static void __init at91rm9200_dt_init_irq(void) · 15 unmodified lines | ||
| 35 | 36 | of_irq_init(irq_of_match); |
| 36 | 37 | } |
| 37 | 38 | |
| 39 | +static void __init at91rm9200_dt_timer_init(void) | |
| 40 | +{ | |
| 41 | +#if defined(CONFIG_COMMON_CLK) | |
| 42 | + of_clk_init(NULL); | |
| 43 | +#endif | |
| 44 | + at91rm9200_timer_init(); | |
| 45 | +} | |
| 46 | + | |
| 38 | 47 | static const char *at91rm9200_dt_board_compat[] __initdata = { |
| 39 | 48 | "atmel,at91rm9200", |
| 40 | 49 | NULL |
| 41 | 50 | }; |
| 42 | 51 | |
| 43 | 52 | DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") |
| 44 | − .init_time = at91rm9200_timer_init, | |
| 53 | + .init_time = at91rm9200_dt_timer_init, | |
| 45 | 54 | .map_io = at91_map_io, |
| 46 | 55 | .handle_irq = at91_aic_handle_irq, |
| 47 | 56 | .init_early = at91rm9200_dt_initialize, |
| @@ -36,5 +36,4 @@ obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | ifeq ($(CONFIG_ARCH_BRCMSTB),y) |
| 38 | 38 | obj-y += brcmstb.o |
| 39 | −obj-$(CONFIG_SMP) += headsmp-brcmstb.o platsmp-brcmstb.o | |
| 40 | 39 | endif |
| @@ -1,19 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (C) 2013-2014 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * This program is free software; you can redistribute it and/or | |
| 5 | − * modify it under the terms of the GNU General Public License as | |
| 6 | − * published by the Free Software Foundation version 2. | |
| 7 | − * | |
| 8 | − * This program is distributed "as is" WITHOUT ANY WARRANTY of any | |
| 9 | − * kind, whether express or implied; without even the implied warranty | |
| 10 | − * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11 | − * GNU General Public License for more details. | |
| 12 | − */ | |
| 13 | − | |
| 14 | −#ifndef __BRCMSTB_H__ | |
| 15 | −#define __BRCMSTB_H__ | |
| 16 | − | |
| 17 | −void brcmstb_secondary_startup(void); | |
| 18 | − | |
| 19 | −#endif /* __BRCMSTB_H__ */ | |
| @@ -1,33 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * SMP boot code for secondary CPUs | |
| 3 | − * Based on arch/arm/mach-tegra/headsmp.S | |
| 4 | − * | |
| 5 | − * Copyright (C) 2010 NVIDIA, Inc. | |
| 6 | − * Copyright (C) 2013-2014 Broadcom Corporation | |
| 7 | − * | |
| 8 | − * This program is free software; you can redistribute it and/or | |
| 9 | − * modify it under the terms of the GNU General Public License as | |
| 10 | − * published by the Free Software Foundation version 2. | |
| 11 | − * | |
| 12 | − * This program is distributed "as is" WITHOUT ANY WARRANTY of any | |
| 13 | − * kind, whether express or implied; without even the implied warranty | |
| 14 | − * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | − * GNU General Public License for more details. | |
| 16 | − */ | |
| 17 | − | |
| 18 | −#include <asm/assembler.h> | |
| 19 | −#include <linux/linkage.h> | |
| 20 | −#include <linux/init.h> | |
| 21 | − | |
| 22 | − .section ".text.head", "ax" | |
| 23 | − | |
| 24 | −ENTRY(brcmstb_secondary_startup) | |
| 25 | − /* | |
| 26 | − * Ensure CPU is in a sane state by disabling all IRQs and switching | |
| 27 | − * into SVC mode. | |
| 28 | − */ | |
| 29 | − setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r0 | |
| 30 | − | |
| 31 | − bl v7_invalidate_l1 | |
| 32 | − b secondary_startup | |
| 33 | −ENDPROC(brcmstb_secondary_startup) | |
| @@ -1,363 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Broadcom STB CPU SMP and hotplug support for ARM | |
| 3 | − * | |
| 4 | − * Copyright (C) 2013-2014 Broadcom Corporation | |
| 5 | − * | |
| 6 | − * This program is free software; you can redistribute it and/or | |
| 7 | − * modify it under the terms of the GNU General Public License as | |
| 8 | − * published by the Free Software Foundation version 2. | |
| 9 | − * | |
| 10 | − * This program is distributed "as is" WITHOUT ANY WARRANTY of any | |
| 11 | − * kind, whether express or implied; without even the implied warranty | |
| 12 | − * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | − * GNU General Public License for more details. | |
| 14 | − */ | |
| 15 | − | |
| 16 | −#include <linux/delay.h> | |
| 17 | −#include <linux/errno.h> | |
| 18 | −#include <linux/init.h> | |
| 19 | −#include <linux/io.h> | |
| 20 | −#include <linux/of_address.h> | |
| 21 | −#include <linux/of_platform.h> | |
| 22 | −#include <linux/printk.h> | |
| 23 | −#include <linux/regmap.h> | |
| 24 | −#include <linux/smp.h> | |
| 25 | −#include <linux/mfd/syscon.h> | |
| 26 | −#include <linux/spinlock.h> | |
| 27 | − | |
| 28 | −#include <asm/cacheflush.h> | |
| 29 | −#include <asm/cp15.h> | |
| 30 | −#include <asm/mach-types.h> | |
| 31 | −#include <asm/smp_plat.h> | |
| 32 | − | |
| 33 | −#include "brcmstb.h" | |
| 34 | − | |
| 35 | −enum { | |
| 36 | − ZONE_MAN_CLKEN_MASK = BIT(0), | |
| 37 | − ZONE_MAN_RESET_CNTL_MASK = BIT(1), | |
| 38 | − ZONE_MAN_MEM_PWR_MASK = BIT(4), | |
| 39 | − ZONE_RESERVED_1_MASK = BIT(5), | |
| 40 | − ZONE_MAN_ISO_CNTL_MASK = BIT(6), | |
| 41 | − ZONE_MANUAL_CONTROL_MASK = BIT(7), | |
| 42 | − ZONE_PWR_DN_REQ_MASK = BIT(9), | |
| 43 | − ZONE_PWR_UP_REQ_MASK = BIT(10), | |
| 44 | − ZONE_BLK_RST_ASSERT_MASK = BIT(12), | |
| 45 | − ZONE_PWR_OFF_STATE_MASK = BIT(25), | |
| 46 | − ZONE_PWR_ON_STATE_MASK = BIT(26), | |
| 47 | − ZONE_DPG_PWR_STATE_MASK = BIT(28), | |
| 48 | − ZONE_MEM_PWR_STATE_MASK = BIT(29), | |
| 49 | − ZONE_RESET_STATE_MASK = BIT(31), | |
| 50 | − CPU0_PWR_ZONE_CTRL_REG = 1, | |
| 51 | − CPU_RESET_CONFIG_REG = 2, | |
| 52 | −}; | |
| 53 | − | |
| 54 | −static void __iomem *cpubiuctrl_block; | |
| 55 | −static void __iomem *hif_cont_block; | |
| 56 | −static u32 cpu0_pwr_zone_ctrl_reg; | |
| 57 | −static u32 cpu_rst_cfg_reg; | |
| 58 | −static u32 hif_cont_reg; | |
| 59 | − | |
| 60 | −#ifdef CONFIG_HOTPLUG_CPU | |
| 61 | −static DEFINE_PER_CPU_ALIGNED(int, per_cpu_sw_state); | |
| 62 | − | |
| 63 | −static int per_cpu_sw_state_rd(u32 cpu) | |
| 64 | −{ | |
| 65 | − sync_cache_r(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu))); | |
| 66 | − return per_cpu(per_cpu_sw_state, cpu); | |
| 67 | −} | |
| 68 | − | |
| 69 | −static void per_cpu_sw_state_wr(u32 cpu, int val) | |
| 70 | −{ | |
| 71 | − per_cpu(per_cpu_sw_state, cpu) = val; | |
| 72 | − dmb(); | |
| 73 | − sync_cache_w(SHIFT_PERCPU_PTR(&per_cpu_sw_state, per_cpu_offset(cpu))); | |
| 74 | − dsb_sev(); | |
| 75 | −} | |
| 76 | −#else | |
| 77 | −static inline void per_cpu_sw_state_wr(u32 cpu, int val) { } | |
| 78 | −#endif | |
| 79 | − | |
| 80 | −static void __iomem *pwr_ctrl_get_base(u32 cpu) | |
| 81 | −{ | |
| 82 | − void __iomem *base = cpubiuctrl_block + cpu0_pwr_zone_ctrl_reg; | |
| 83 | − base += (cpu_logical_map(cpu) * 4); | |
| 84 | − return base; | |
| 85 | −} | |
| 86 | − | |
| 87 | −static u32 pwr_ctrl_rd(u32 cpu) | |
| 88 | −{ | |
| 89 | − void __iomem *base = pwr_ctrl_get_base(cpu); | |
| 90 | − return readl_relaxed(base); | |
| 91 | −} | |
| 92 | − | |
| 93 | −static void pwr_ctrl_wr(u32 cpu, u32 val) | |
| 94 | −{ | |
| 95 | − void __iomem *base = pwr_ctrl_get_base(cpu); | |
| 96 | − writel(val, base); | |
| 97 | −} | |
| 98 | − | |
| 99 | −static void cpu_rst_cfg_set(u32 cpu, int set) | |
| 100 | −{ | |
| 101 | − u32 val; | |
| 102 | − val = readl_relaxed(cpubiuctrl_block + cpu_rst_cfg_reg); | |
| 103 | − if (set) | |
| 104 | − val |= BIT(cpu_logical_map(cpu)); | |
| 105 | − else | |
| 106 | − val &= ~BIT(cpu_logical_map(cpu)); | |
| 107 | − writel_relaxed(val, cpubiuctrl_block + cpu_rst_cfg_reg); | |
| 108 | −} | |
| 109 | − | |
| 110 | −static void cpu_set_boot_addr(u32 cpu, unsigned long boot_addr) | |
| 111 | −{ | |
| 112 | − const int reg_ofs = cpu_logical_map(cpu) * 8; | |
| 113 | − writel_relaxed(0, hif_cont_block + hif_cont_reg + reg_ofs); | |
| 114 | − writel_relaxed(boot_addr, hif_cont_block + hif_cont_reg + 4 + reg_ofs); | |
| 115 | −} | |
| 116 | − | |
| 117 | −static void brcmstb_cpu_boot(u32 cpu) | |
| 118 | −{ | |
| 119 | − pr_info("SMP: Booting CPU%d...\n", cpu); | |
| 120 | − | |
| 121 | − /* | |
| 122 | − * set the reset vector to point to the secondary_startup | |
| 123 | − * routine | |
| 124 | − */ | |
| 125 | − cpu_set_boot_addr(cpu, virt_to_phys(brcmstb_secondary_startup)); | |
| 126 | − | |
| 127 | − /* unhalt the cpu */ | |
| 128 | − cpu_rst_cfg_set(cpu, 0); | |
| 129 | −} | |
| 130 | − | |
| 131 | −static void brcmstb_cpu_power_on(u32 cpu) | |
| 132 | −{ | |
| 133 | − /* | |
| 134 | − * The secondary cores power was cut, so we must go through | |
| 135 | − * power-on initialization. | |
| 136 | − */ | |
| 137 | − u32 tmp; | |
| 138 | − | |
| 139 | − pr_info("SMP: Powering up CPU%d...\n", cpu); | |
| 140 | − | |
| 141 | − /* Request zone power up */ | |
| 142 | − pwr_ctrl_wr(cpu, ZONE_PWR_UP_REQ_MASK); | |
| 143 | − | |
| 144 | − /* Wait for the power up FSM to complete */ | |
| 145 | − do { | |
| 146 | − tmp = pwr_ctrl_rd(cpu); | |
| 147 | − } while (!(tmp & ZONE_PWR_ON_STATE_MASK)); | |
| 148 | − | |
| 149 | − per_cpu_sw_state_wr(cpu, 1); | |
| 150 | −} | |
| 151 | − | |
| 152 | −static int brcmstb_cpu_get_power_state(u32 cpu) | |
| 153 | −{ | |
| 154 | − int tmp = pwr_ctrl_rd(cpu); | |
| 155 | − return (tmp & ZONE_RESET_STATE_MASK) ? 0 : 1; | |
| 156 | −} | |
| 157 | − | |
| 158 | −#ifdef CONFIG_HOTPLUG_CPU | |
| 159 | − | |
| 160 | −static void brcmstb_cpu_die(u32 cpu) | |
| 161 | −{ | |
| 162 | − v7_exit_coherency_flush(all); | |
| 163 | − | |
| 164 | − /* Prevent all interrupts from reaching this CPU. */ | |
| 165 | − arch_local_irq_disable(); | |
| 166 | − | |
| 167 | − /* | |
| 168 | − * Final full barrier to ensure everything before this instruction has | |
| 169 | − * quiesced. | |
| 170 | − */ | |
| 171 | − isb(); | |
| 172 | − dsb(); | |
| 173 | − | |
| 174 | − per_cpu_sw_state_wr(cpu, 0); | |
| 175 | − | |
| 176 | − /* Sit and wait to die */ | |
| 177 | − wfi(); | |
| 178 | − | |
| 179 | − /* We should never get here... */ | |
| 180 | − panic("Spurious interrupt on CPU %d received!\n", cpu); | |
| 181 | −} | |
| 182 | − | |
| 183 | −static int brcmstb_cpu_kill(u32 cpu) | |
| 184 | −{ | |
| 185 | − u32 tmp; | |
| 186 | − | |
| 187 | − pr_info("SMP: Powering down CPU%d...\n", cpu); | |
| 188 | − | |
| 189 | − while (per_cpu_sw_state_rd(cpu)) | |
| 190 | − ; | |
| 191 | − | |
| 192 | − /* Program zone reset */ | |
| 193 | − pwr_ctrl_wr(cpu, ZONE_RESET_STATE_MASK | ZONE_BLK_RST_ASSERT_MASK | | |
| 194 | − ZONE_PWR_DN_REQ_MASK); | |
| 195 | − | |
| 196 | − /* Verify zone reset */ | |
| 197 | − tmp = pwr_ctrl_rd(cpu); | |
| 198 | − if (!(tmp & ZONE_RESET_STATE_MASK)) | |
| 199 | − pr_err("%s: Zone reset bit for CPU %d not asserted!\n", | |
| 200 | − __func__, cpu); | |
| 201 | − | |
| 202 | − /* Wait for power down */ | |
| 203 | − do { | |
| 204 | − tmp = pwr_ctrl_rd(cpu); | |
| 205 | − } while (!(tmp & ZONE_PWR_OFF_STATE_MASK)); | |
| 206 | − | |
| 207 | − /* Settle-time from Broadcom-internal DVT reference code */ | |
| 208 | − udelay(7); | |
| 209 | − | |
| 210 | − /* Assert reset on the CPU */ | |
| 211 | − cpu_rst_cfg_set(cpu, 1); | |
| 212 | − | |
| 213 | − return 1; | |
| 214 | −} | |
| 215 | − | |
| 216 | −#endif /* CONFIG_HOTPLUG_CPU */ | |
| 217 | − | |
| 218 | −static int __init setup_hifcpubiuctrl_regs(struct device_node *np) | |
| 219 | −{ | |
| 220 | − int rc = 0; | |
| 221 | − char *name; | |
| 222 | − struct device_node *syscon_np = NULL; | |
| 223 | − | |
| 224 | − name = "syscon-cpu"; | |
| 225 | − | |
| 226 | − syscon_np = of_parse_phandle(np, name, 0); | |
| 227 | − if (!syscon_np) { | |
| 228 | − pr_err("can't find phandle %s\n", name); | |
| 229 | − rc = -EINVAL; | |
| 230 | − goto cleanup; | |
| 231 | − } | |
| 232 | − | |
| 233 | − cpubiuctrl_block = of_iomap(syscon_np, 0); | |
| 234 | − if (!cpubiuctrl_block) { | |
| 235 | − pr_err("iomap failed for cpubiuctrl_block\n"); | |
| 236 | − rc = -EINVAL; | |
| 237 | − goto cleanup; | |
| 238 | − } | |
| 239 | − | |
| 240 | − rc = of_property_read_u32_index(np, name, CPU0_PWR_ZONE_CTRL_REG, | |
| 241 | − &cpu0_pwr_zone_ctrl_reg); | |
| 242 | − if (rc) { | |
| 243 | − pr_err("failed to read 1st entry from %s property (%d)\n", name, | |
| 244 | − rc); | |
| 245 | − rc = -EINVAL; | |
| 246 | − goto cleanup; | |
| 247 | − } | |
| 248 | − | |
| 249 | − rc = of_property_read_u32_index(np, name, CPU_RESET_CONFIG_REG, | |
| 250 | − &cpu_rst_cfg_reg); | |
| 251 | − if (rc) { | |
| 252 | − pr_err("failed to read 2nd entry from %s property (%d)\n", name, | |
| 253 | − rc); | |
| 254 | − rc = -EINVAL; | |
| 255 | − goto cleanup; | |
| 256 | − } | |
| 257 | − | |
| 258 | −cleanup: | |
| 259 | − if (syscon_np) | |
| 260 | − of_node_put(syscon_np); | |
| 261 | − | |
| 262 | − return rc; | |
| 263 | −} | |
| 264 | − | |
| 265 | −static int __init setup_hifcont_regs(struct device_node *np) | |
| 266 | −{ | |
| 267 | − int rc = 0; | |
| 268 | − char *name; | |
| 269 | − struct device_node *syscon_np = NULL; | |
| 270 | − | |
| 271 | − name = "syscon-cont"; | |
| 272 | − | |
| 273 | − syscon_np = of_parse_phandle(np, name, 0); | |
| 274 | − if (!syscon_np) { | |
| 275 | − pr_err("can't find phandle %s\n", name); | |
| 276 | − rc = -EINVAL; | |
| 277 | − goto cleanup; | |
| 278 | − } | |
| 279 | − | |
| 280 | − hif_cont_block = of_iomap(syscon_np, 0); | |
| 281 | − if (!hif_cont_block) { | |
| 282 | − pr_err("iomap failed for hif_cont_block\n"); | |
| 283 | − rc = -EINVAL; | |
| 284 | − goto cleanup; | |
| 285 | − } | |
| 286 | − | |
| 287 | − /* offset is at top of hif_cont_block */ | |
| 288 | − hif_cont_reg = 0; | |
| 289 | − | |
| 290 | −cleanup: | |
| 291 | − if (syscon_np) | |
| 292 | − of_node_put(syscon_np); | |
| 293 | − | |
| 294 | − return rc; | |
| 295 | −} | |
| 296 | − | |
| 297 | −static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus) | |
| 298 | −{ | |
| 299 | − int rc; | |
| 300 | − struct device_node *np; | |
| 301 | − char *name; | |
| 302 | − | |
| 303 | − name = "brcm,brcmstb-smpboot"; | |
| 304 | − np = of_find_compatible_node(NULL, NULL, name); | |
| 305 | − if (!np) { | |
| 306 | − pr_err("can't find compatible node %s\n", name); | |
| 307 | − return; | |
| 308 | − } | |
| 309 | − | |
| 310 | − rc = setup_hifcpubiuctrl_regs(np); | |
| 311 | − if (rc) | |
| 312 | − return; | |
| 313 | − | |
| 314 | − rc = setup_hifcont_regs(np); | |
| 315 | − if (rc) | |
| 316 | − return; | |
| 317 | −} | |
| 318 | − | |
| 319 | −static DEFINE_SPINLOCK(boot_lock); | |
| 320 | − | |
| 321 | −static void brcmstb_secondary_init(unsigned int cpu) | |
| 322 | −{ | |
| 323 | − /* | |
| 324 | − * Synchronise with the boot thread. | |
| 325 | − */ | |
| 326 | − spin_lock(&boot_lock); | |
| 327 | − spin_unlock(&boot_lock); | |
| 328 | −} | |
| 329 | − | |
| 330 | −static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle) | |
| 331 | −{ | |
| 332 | − /* | |
| 333 | − * set synchronisation state between this boot processor | |
| 334 | − * and the secondary one | |
| 335 | − */ | |
| 336 | − spin_lock(&boot_lock); | |
| 337 | − | |
| 338 | − /* Bring up power to the core if necessary */ | |
| 339 | − if (brcmstb_cpu_get_power_state(cpu) == 0) | |
| 340 | − brcmstb_cpu_power_on(cpu); | |
| 341 | − | |
| 342 | − brcmstb_cpu_boot(cpu); | |
| 343 | − | |
| 344 | − /* | |
| 345 | − * now the secondary core is starting up let it run its | |
| 346 | − * calibrations, then wait for it to finish | |
| 347 | − */ | |
| 348 | − spin_unlock(&boot_lock); | |
| 349 | − | |
| 350 | − return 0; | |
| 351 | −} | |
| 352 | − | |
| 353 | −static struct smp_operations brcmstb_smp_ops __initdata = { | |
| 354 | − .smp_prepare_cpus = brcmstb_cpu_ctrl_setup, | |
| 355 | − .smp_secondary_init = brcmstb_secondary_init, | |
| 356 | − .smp_boot_secondary = brcmstb_boot_secondary, | |
| 357 | −#ifdef CONFIG_HOTPLUG_CPU | |
| 358 | − .cpu_kill = brcmstb_cpu_kill, | |
| 359 | − .cpu_die = brcmstb_cpu_die, | |
| 360 | −#endif | |
| 361 | −}; | |
| 362 | − | |
| 363 | −CPU_METHOD_OF_DECLARE(brcmstb_smp, "brcm,brahma-b15", &brcmstb_smp_ops); | |
| @@ -43,7 +43,6 @@ · 42 unmodified lines | ||
| 43 | 43 | "mcr p15, 0, r0, c1, c0, 0 @ set SCTLR\n\t" \ |
| 44 | 44 | "isb\n\t"\ |
| 45 | 45 | "bl v7_flush_dcache_"__stringify(level)"\n\t" \ |
| 46 | − "clrex\n\t"\ | |
| 47 | 46 | "mrc p15, 0, r0, c1, c0, 1 @ get ACTLR\n\t" \ |
| 48 | 47 | "bic r0, r0, #(1 << 6) @ disable local coherency\n\t" \ |
| 49 | 48 | /* Dummy Load of a device register to avoid Erratum 799270 */ \ |
| @@ -85,7 +85,6 @@ config SOC_IMX25 · 84 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | config SOC_IMX27 |
| 87 | 87 | bool |
| 88 | − select ARCH_HAS_OPP | |
| 89 | 88 | select CPU_ARM926T |
| 90 | 89 | select IMX_HAVE_IOMUX_V1 |
| 91 | 90 | select MXC_AVIC |
| @@ -659,7 +658,6 @@ comment "Device tree only" · 567 unmodified lines | ||
| 659 | 658 | |
| 660 | 659 | config SOC_IMX5 |
| 661 | 660 | bool |
| 662 | − select ARCH_HAS_OPP | |
| 663 | 661 | select HAVE_IMX_SRC |
| 664 | 662 | select MXC_TZIC |
| 665 | 663 | |
| @@ -93,9 +93,11 @@ obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o · 92 unmodified lines | ||
| 93 | 93 | obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o |
| 94 | 94 | obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o |
| 95 | 95 | obj-$(CONFIG_HAVE_IMX_SRC) += src.o |
| 96 | +ifdef CONFIG_SOC_IMX6 | |
| 96 | 97 | AFLAGS_headsmp.o :=-Wa,-march=armv7-a |
| 97 | 98 | obj-$(CONFIG_SMP) += headsmp.o platsmp.o |
| 98 | 99 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
| 100 | +endif | |
| 99 | 101 | obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o |
| 100 | 102 | obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o |
| 101 | 103 | obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o mach-imx6sx.o |
| @@ -194,6 +194,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) · 193 unmodified lines | ||
| 194 | 194 | clk[IMX6QDL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); |
| 195 | 195 | clk[IMX6QDL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); |
| 196 | 196 | clk[IMX6QDL_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2); |
| 197 | + if (cpu_is_imx6dl()) { | |
| 198 | + clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_fixed_factor("gpu2d_axi", "mmdc_ch0_axi_podf", 1, 1); | |
| 199 | + clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_fixed_factor("gpu3d_axi", "mmdc_ch0_axi_podf", 1, 1); | |
| 200 | + } | |
| 197 | 201 | |
| 198 | 202 | clk[IMX6QDL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); |
| 199 | 203 | clk[IMX6QDL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); |
| @@ -217,8 +221,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) · 17 unmodified lines | ||
| 217 | 221 | clk[IMX6QDL_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); |
| 218 | 222 | clk[IMX6QDL_CLK_ASRC_SEL] = imx_clk_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); |
| 219 | 223 | clk[IMX6QDL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); |
| 220 | − clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); | |
| 221 | − clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); | |
| 224 | + if (cpu_is_imx6q()) { | |
| 225 | + clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); | |
| 226 | + clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); | |
| 227 | + } | |
| 222 | 228 | clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); |
| 223 | 229 | clk[IMX6QDL_CLK_GPU3D_CORE_SEL] = imx_clk_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels)); |
| 224 | 230 | clk[IMX6QDL_CLK_GPU3D_SHADER_SEL] = imx_clk_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); |
| @@ -173,6 +173,8 @@ ENTRY(imx6_suspend) · 172 unmodified lines | ||
| 173 | 173 | ldr r6, [r11, #0x0] |
| 174 | 174 | ldr r11, [r0, #PM_INFO_MX6Q_GPC_V_OFFSET] |
| 175 | 175 | ldr r6, [r11, #0x0] |
| 176 | + ldr r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET] | |
| 177 | + ldr r6, [r11, #0x0] | |
| 176 | 178 | |
| 177 | 179 | /* use r11 to store the IO address */ |
| 178 | 180 | ldr r11, [r0, #PM_INFO_MX6Q_SRC_V_OFFSET] |
| @@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs, · 141 unmodified lines | ||
| 142 | 142 | board_nand_data.nr_parts = nr_parts; |
| 143 | 143 | board_nand_data.devsize = nand_type; |
| 144 | 144 | |
| 145 | − board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_HW; | |
| 145 | + board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_SW; | |
| 146 | 146 | gpmc_nand_init(&board_nand_data, gpmc_t); |
| 147 | 147 | } |
| 148 | 148 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ |
| @@ -49,7 +49,8 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) · 48 unmodified lines | ||
| 49 | 49 | return 0; |
| 50 | 50 | |
| 51 | 51 | /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */ |
| 52 | − if (ecc_opt == OMAP_ECC_HAM1_CODE_HW) | |
| 52 | + if (ecc_opt == OMAP_ECC_HAM1_CODE_HW || | |
| 53 | + ecc_opt == OMAP_ECC_HAM1_CODE_SW) | |
| 53 | 54 | return 1; |
| 54 | 55 | else |
| 55 | 56 | return 0; |
| @@ -1207,8 +1207,7 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p) · 1206 unmodified lines | ||
| 1207 | 1207 | } |
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | − if ((p->wait_on_read || p->wait_on_write) && | |
| 1211 | − (p->wait_pin > gpmc_nr_waitpins)) { | |
| 1210 | + if (p->wait_pin > gpmc_nr_waitpins) { | |
| 1212 | 1211 | pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin); |
| 1213 | 1212 | return -EINVAL; |
| 1214 | 1213 | } |
| @@ -1288,8 +1287,8 @@ void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p) · 73 unmodified lines | ||
| 1288 | 1287 | p->wait_on_write = of_property_read_bool(np, |
| 1289 | 1288 | "gpmc,wait-on-write"); |
| 1290 | 1289 | if (!p->wait_on_read && !p->wait_on_write) |
| 1291 | − pr_warn("%s: read/write wait monitoring not enabled!\n", | |
| 1292 | − __func__); | |
| 1290 | + pr_debug("%s: rd/wr wait monitoring not enabled!\n", | |
| 1291 | + __func__); | |
| 1293 | 1292 | } |
| 1294 | 1293 | } |
| 1295 | 1294 | |
| @@ -1403,8 +1402,11 @@ static int gpmc_probe_nand_child(struct platform_device *pdev, · 107 unmodified lines | ||
| 1403 | 1402 | pr_err("%s: ti,nand-ecc-opt not found\n", __func__); |
| 1404 | 1403 | return -ENODEV; |
| 1405 | 1404 | } |
| 1406 | − if (!strcmp(s, "ham1") || !strcmp(s, "sw") || | |
| 1407 | − !strcmp(s, "hw") || !strcmp(s, "hw-romcode")) | |
| 1405 | + | |
| 1406 | + if (!strcmp(s, "sw")) | |
| 1407 | + gpmc_nand_data->ecc_opt = OMAP_ECC_HAM1_CODE_SW; | |
| 1408 | + else if (!strcmp(s, "ham1") || | |
| 1409 | + !strcmp(s, "hw") || !strcmp(s, "hw-romcode")) | |
| 1408 | 1410 | gpmc_nand_data->ecc_opt = |
| 1409 | 1411 | OMAP_ECC_HAM1_CODE_HW; |
| 1410 | 1412 | else if (!strcmp(s, "bch4")) |
| @@ -663,7 +663,7 @@ void __init dra7xxx_check_revision(void) · 662 unmodified lines | ||
| 663 | 663 | |
| 664 | 664 | default: |
| 665 | 665 | /* Unknown default to latest silicon rev as default*/ |
| 666 | − pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n", | |
| 666 | + pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%x)\n", | |
| 667 | 667 | __func__, idcode, hawkeye, rev); |
| 668 | 668 | omap_revision = DRA752_REV_ES1_1; |
| 669 | 669 | } |
| @@ -56,7 +56,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias, · 55 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias); |
| 58 | 58 | if (!IS_ERR(r)) { |
| 59 | − dev_warn(&od->pdev->dev, | |
| 59 | + dev_dbg(&od->pdev->dev, | |
| 60 | 60 | "alias %s already exists\n", clk_alias); |
| 61 | 61 | clk_put(r); |
| 62 | 62 | return; |
| @@ -2185,6 +2185,8 @@ static int _enable(struct omap_hwmod *oh) · 2184 unmodified lines | ||
| 2185 | 2185 | oh->mux->pads_dynamic))) { |
| 2186 | 2186 | omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED); |
| 2187 | 2187 | _reconfigure_io_chain(); |
| 2188 | + } else if (oh->flags & HWMOD_FORCE_MSTANDBY) { | |
| 2189 | + _reconfigure_io_chain(); | |
| 2188 | 2190 | } |
| 2189 | 2191 | |
| 2190 | 2192 | _add_initiator_dep(oh, mpu_oh); |
| @@ -2291,6 +2293,8 @@ static int _idle(struct omap_hwmod *oh) · 100 unmodified lines | ||
| 2291 | 2293 | if (oh->mux && oh->mux->pads_dynamic) { |
| 2292 | 2294 | omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE); |
| 2293 | 2295 | _reconfigure_io_chain(); |
| 2296 | + } else if (oh->flags & HWMOD_FORCE_MSTANDBY) { | |
| 2297 | + _reconfigure_io_chain(); | |
| 2294 | 2298 | } |
| 2295 | 2299 | |
| 2296 | 2300 | oh->_state = _HWMOD_STATE_IDLE; |
| @@ -3345,6 +3349,9 @@ int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois) · 1048 unmodified lines | ||
| 3345 | 3349 | if (!ois) |
| 3346 | 3350 | return 0; |
| 3347 | 3351 | |
| 3352 | + if (ois[0] == NULL) /* Empty list */ | |
| 3353 | + return 0; | |
| 3354 | + | |
| 3348 | 3355 | if (!linkspace) { |
| 3349 | 3356 | if (_alloc_linkspace(ois)) { |
| 3350 | 3357 | pr_err("omap_hwmod: could not allocate link space\n"); |
| @@ -35,6 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | #include "i2c.h" |
| 36 | 36 | #include "mmc.h" |
| 37 | 37 | #include "wd_timer.h" |
| 38 | +#include "soc.h" | |
| 38 | 39 | |
| 39 | 40 | /* Base offset for all DRA7XX interrupts external to MPUSS */ |
| 40 | 41 | #define DRA7XX_IRQ_GIC_START 32 |
| @@ -3261,7 +3262,6 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { · 3220 unmodified lines | ||
| 3261 | 3262 | &dra7xx_l4_per3__usb_otg_ss1, |
| 3262 | 3263 | &dra7xx_l4_per3__usb_otg_ss2, |
| 3263 | 3264 | &dra7xx_l4_per3__usb_otg_ss3, |
| 3264 | − &dra7xx_l4_per3__usb_otg_ss4, | |
| 3265 | 3265 | &dra7xx_l3_main_1__vcp1, |
| 3266 | 3266 | &dra7xx_l4_per2__vcp1, |
| 3267 | 3267 | &dra7xx_l3_main_1__vcp2, |
| @@ -3270,8 +3270,26 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { · 2 unmodified lines | ||
| 3270 | 3270 | NULL, |
| 3271 | 3271 | }; |
| 3272 | 3272 | |
| 3273 | +static struct omap_hwmod_ocp_if *dra74x_hwmod_ocp_ifs[] __initdata = { | |
| 3274 | + &dra7xx_l4_per3__usb_otg_ss4, | |
| 3275 | + NULL, | |
| 3276 | +}; | |
| 3277 | + | |
| 3278 | +static struct omap_hwmod_ocp_if *dra72x_hwmod_ocp_ifs[] __initdata = { | |
| 3279 | + NULL, | |
| 3280 | +}; | |
| 3281 | + | |
| 3273 | 3282 | int __init dra7xx_hwmod_init(void) |
| 3274 | 3283 | { |
| 3284 | + int ret; | |
| 3285 | + | |
| 3275 | 3286 | omap_hwmod_init(); |
| 3276 | − return omap_hwmod_register_links(dra7xx_hwmod_ocp_ifs); | |
| 3287 | + ret = omap_hwmod_register_links(dra7xx_hwmod_ocp_ifs); | |
| 3288 | + | |
| 3289 | + if (!ret && soc_is_dra74x()) | |
| 3290 | + return omap_hwmod_register_links(dra74x_hwmod_ocp_ifs); | |
| 3291 | + else if (!ret && soc_is_dra72x()) | |
| 3292 | + return omap_hwmod_register_links(dra72x_hwmod_ocp_ifs); | |
| 3293 | + | |
| 3294 | + return ret; | |
| 3277 | 3295 | } |
| @@ -245,6 +245,8 @@ IS_AM_SUBCLASS(437x, 0x437) · 244 unmodified lines | ||
| 245 | 245 | #define soc_is_omap54xx() 0 |
| 246 | 246 | #define soc_is_omap543x() 0 |
| 247 | 247 | #define soc_is_dra7xx() 0 |
| 248 | +#define soc_is_dra74x() 0 | |
| 249 | +#define soc_is_dra72x() 0 | |
| 248 | 250 | |
| 249 | 251 | #if defined(MULTI_OMAP2) |
| 250 | 252 | # if defined(CONFIG_ARCH_OMAP2) |
| @@ -393,7 +395,11 @@ IS_OMAP_TYPE(3430, 0x3430) · 142 unmodified lines | ||
| 393 | 395 | |
| 394 | 396 | #if defined(CONFIG_SOC_DRA7XX) |
| 395 | 397 | #undef soc_is_dra7xx |
| 398 | +#undef soc_is_dra74x | |
| 399 | +#undef soc_is_dra72x | |
| 396 | 400 | #define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7")) |
| 401 | +#define soc_is_dra74x() (of_machine_is_compatible("ti,dra74")) | |
| 402 | +#define soc_is_dra72x() (of_machine_is_compatible("ti,dra72")) | |
| 397 | 403 | #endif |
| 398 | 404 | |
| 399 | 405 | /* Various silicon revisions for omap2 */ |
| @@ -75,6 +75,7 @@ config ARCH_SH7372 · 74 unmodified lines | ||
| 75 | 75 | select ARM_CPU_SUSPEND if PM || CPU_IDLE |
| 76 | 76 | select CPU_V7 |
| 77 | 77 | select SH_CLK_CPG |
| 78 | + select SH_INTC | |
| 78 | 79 | select SYS_SUPPORTS_SH_CMT |
| 79 | 80 | select SYS_SUPPORTS_SH_TMU |
| 80 | 81 | |
| @@ -85,6 +86,7 @@ config ARCH_SH73A0 · 4 unmodified lines | ||
| 85 | 86 | select CPU_V7 |
| 86 | 87 | select I2C |
| 87 | 88 | select SH_CLK_CPG |
| 89 | + select SH_INTC | |
| 88 | 90 | select RENESAS_INTC_IRQPIN |
| 89 | 91 | select SYS_SUPPORTS_SH_CMT |
| 90 | 92 | select SYS_SUPPORTS_SH_TMU |
| @@ -183,8 +183,8 @@ enum { · 182 unmodified lines | ||
| 183 | 183 | |
| 184 | 184 | static struct clk div4_clks[DIV4_NR] = { |
| 185 | 185 | [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT), |
| 186 | − [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT), | |
| 187 | − [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1de0, CLK_ENABLE_ON_INIT), | |
| 186 | + [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1df0, CLK_ENABLE_ON_INIT), | |
| 187 | + [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1df0, CLK_ENABLE_ON_INIT), | |
| 188 | 188 | }; |
| 189 | 189 | |
| 190 | 190 | /* DIV6 clocks */ |
| @@ -152,7 +152,7 @@ enum { · 151 unmodified lines | ||
| 152 | 152 | |
| 153 | 153 | static struct clk div4_clks[DIV4_NR] = { |
| 154 | 154 | [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT), |
| 155 | − [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT), | |
| 155 | + [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1df0, CLK_ENABLE_ON_INIT), | |
| 156 | 156 | }; |
| 157 | 157 | |
| 158 | 158 | /* DIV6 clocks */ |
| @@ -644,7 +644,7 @@ static struct clk_lookup lookups[] = { · 643 unmodified lines | ||
| 644 | 644 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ |
| 645 | 645 | CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */ |
| 646 | 646 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ |
| 647 | − CLKDEV_DEV_ID("0xe6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */ | |
| 647 | + CLKDEV_DEV_ID("e6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */ | |
| 648 | 648 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ |
| 649 | 649 | CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */ |
| 650 | 650 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ |
| @@ -426,9 +426,15 @@ static int ve_spc_populate_opps(uint32_t cluster) · 425 unmodified lines | ||
| 426 | 426 | |
| 427 | 427 | static int ve_init_opp_table(struct device *cpu_dev) |
| 428 | 428 | { |
| 429 | − int cluster = topology_physical_package_id(cpu_dev->id); | |
| 430 | − int idx, ret = 0, max_opp = info->num_opps[cluster]; | |
| 431 | − struct ve_spc_opp *opps = info->opps[cluster]; | |
| 429 | + int cluster; | |
| 430 | + int idx, ret = 0, max_opp; | |
| 431 | + struct ve_spc_opp *opps; | |
| 432 | + | |
| 433 | + cluster = topology_physical_package_id(cpu_dev->id); | |
| 434 | + cluster = cluster < 0 ? 0 : cluster; | |
| 435 | + | |
| 436 | + max_opp = info->num_opps[cluster]; | |
| 437 | + opps = info->opps[cluster]; | |
| 432 | 438 | |
| 433 | 439 | for (idx = 0; idx < max_opp; idx++, opps++) { |
| 434 | 440 | ret = dev_pm_opp_add(cpu_dev, opps->freq * 1000, opps->u_volt); |
| @@ -537,6 +543,8 @@ static struct clk *ve_spc_clk_register(struct device *cpu_dev) · 102 unmodified lines | ||
| 537 | 543 | spc->hw.init = &init; |
| 538 | 544 | spc->cluster = topology_physical_package_id(cpu_dev->id); |
| 539 | 545 | |
| 546 | + spc->cluster = spc->cluster < 0 ? 0 : spc->cluster; | |
| 547 | + | |
| 540 | 548 | init.name = dev_name(cpu_dev); |
| 541 | 549 | init.ops = &clk_spc_ops; |
| 542 | 550 | init.flags = CLK_IS_ROOT | CLK_GET_RATE_NOCACHE; |
| @@ -17,12 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | */ |
| 18 | 18 | .align 5 |
| 19 | 19 | ENTRY(v6_early_abort) |
| 20 | −#ifdef CONFIG_CPU_V6 | |
| 21 | − sub r1, sp, #4 @ Get unused stack location | |
| 22 | − strex r0, r1, [r1] @ Clear the exclusive monitor | |
| 23 | −#elif defined(CONFIG_CPU_32v6K) | |
| 24 | − clrex | |
| 25 | −#endif | |
| 26 | 20 | mrc p15, 0, r1, c5, c0, 0 @ get FSR |
| 27 | 21 | mrc p15, 0, r0, c6, c0, 0 @ get FAR |
| 28 | 22 | /* |
| @@ -13,12 +13,6 @@ · 12 unmodified lines | ||
| 13 | 13 | */ |
| 14 | 14 | .align 5 |
| 15 | 15 | ENTRY(v7_early_abort) |
| 16 | − /* | |
| 17 | − * The effect of data aborts on on the exclusive access monitor are | |
| 18 | − * UNPREDICTABLE. Do a CLREX to clear the state | |
| 19 | − */ | |
| 20 | − clrex | |
| 21 | − | |
| 22 | 16 | mrc p15, 0, r1, c5, c0, 0 @ get FSR |
| 23 | 17 | mrc p15, 0, r0, c6, c0, 0 @ get FAR |
| 24 | 18 | |
| @@ -150,7 +150,6 @@ static void sha2_finup(struct shash_desc *desc, const u8 *data, · 149 unmodified lines | ||
| 150 | 150 | kernel_neon_begin_partial(28); |
| 151 | 151 | sha2_ce_transform(blocks, data, sctx->state, NULL, len); |
| 152 | 152 | kernel_neon_end(); |
| 153 | − data += blocks * SHA256_BLOCK_SIZE; | |
| 154 | 153 | } |
| 155 | 154 | |
| 156 | 155 | static int sha224_finup(struct shash_desc *desc, const u8 *data, |
| @@ -79,7 +79,6 @@ static inline void decode_ctrl_reg(u32 reg, · 78 unmodified lines | ||
| 79 | 79 | */ |
| 80 | 80 | #define ARM_MAX_BRP 16 |
| 81 | 81 | #define ARM_MAX_WRP 16 |
| 82 | −#define ARM_MAX_HBP_SLOTS (ARM_MAX_BRP + ARM_MAX_WRP) | |
| 83 | 82 | |
| 84 | 83 | /* Virtual debug register bases. */ |
| 85 | 84 | #define AARCH64_DBG_REG_BVR 0 |
| @@ -139,7 +139,7 @@ extern struct task_struct *cpu_switch_to(struct task_struct *prev, · 138 unmodified lines | ||
| 139 | 139 | ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) |
| 140 | 140 | |
| 141 | 141 | #define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc) |
| 142 | −#define KSTK_ESP(tsk) ((unsigned long)task_pt_regs(tsk)->sp) | |
| 142 | +#define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk)) | |
| 143 | 143 | |
| 144 | 144 | /* |
| 145 | 145 | * Prefetching support |
| @@ -137,7 +137,7 @@ struct pt_regs { · 136 unmodified lines | ||
| 137 | 137 | (!((regs)->pstate & PSR_F_BIT)) |
| 138 | 138 | |
| 139 | 139 | #define user_stack_pointer(regs) \ |
| 140 | − (!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp) | |
| 140 | + (!compat_user_mode(regs) ? (regs)->sp : (regs)->compat_sp) | |
| 141 | 141 | |
| 142 | 142 | static inline unsigned long regs_return_value(struct pt_regs *regs) |
| 143 | 143 | { |
| @@ -465,6 +465,8 @@ static int __init arm64_enter_virtual_mode(void) · 464 unmodified lines | ||
| 465 | 465 | efi_native_runtime_setup(); |
| 466 | 466 | set_bit(EFI_RUNTIME_SERVICES, &efi.flags); |
| 467 | 467 | |
| 468 | + efi.runtime_version = efi.systab->hdr.revision; | |
| 469 | + | |
| 468 | 470 | return 0; |
| 469 | 471 | |
| 470 | 472 | err_unmap: |
| @@ -270,6 +270,7 @@ static int fpsimd_cpu_pm_notifier(struct notifier_block *self, · 269 unmodified lines | ||
| 270 | 270 | case CPU_PM_ENTER: |
| 271 | 271 | if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE)) |
| 272 | 272 | fpsimd_save_state(¤t->thread.fpsimd_state); |
| 273 | + this_cpu_write(fpsimd_last_state, NULL); | |
| 273 | 274 | break; |
| 274 | 275 | case CPU_PM_EXIT: |
| 275 | 276 | if (current->mm) |
| @@ -373,10 +373,6 @@ ENTRY(__boot_cpu_mode) · 372 unmodified lines | ||
| 373 | 373 | .long 0 |
| 374 | 374 | .popsection |
| 375 | 375 | |
| 376 | − .align 3 | |
| 377 | −2: .quad . | |
| 378 | − .quad PAGE_OFFSET | |
| 379 | − | |
| 380 | 376 | #ifdef CONFIG_SMP |
| 381 | 377 | .align 3 |
| 382 | 378 | 1: .quad . |
| @@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) · 23 unmodified lines | ||
| 24 | 24 | return regs->compat_lr; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + if ((u32)idx == PERF_REG_ARM64_SP) | |
| 28 | + return regs->sp; | |
| 29 | + | |
| 30 | + if ((u32)idx == PERF_REG_ARM64_PC) | |
| 31 | + return regs->pc; | |
| 32 | + | |
| 27 | 33 | return regs->regs[idx]; |
| 28 | 34 | } |
| 29 | 35 | |
| @@ -87,7 +87,8 @@ static void ptrace_hbptriggered(struct perf_event *bp, · 86 unmodified lines | ||
| 87 | 87 | break; |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | − for (i = ARM_MAX_BRP; i < ARM_MAX_HBP_SLOTS && !bp; ++i) { | |
| 90 | + | |
| 91 | + for (i = 0; i < ARM_MAX_WRP; ++i) { | |
| 91 | 92 | if (current->thread.debug.hbp_watch[i] == bp) { |
| 92 | 93 | info.si_errno = -((i << 1) + 1); |
| 93 | 94 | break; |
| @@ -662,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target, · 568 unmodified lines | ||
| 662 | 663 | kbuf += sizeof(reg); |
| 663 | 664 | } else { |
| 664 | 665 | ret = copy_to_user(ubuf, ®, sizeof(reg)); |
| 665 | − if (ret) | |
| 666 | + if (ret) { | |
| 667 | + ret = -EFAULT; | |
| 666 | 668 | break; |
| 669 | + } | |
| 667 | 670 | |
| 668 | 671 | ubuf += sizeof(reg); |
| 669 | 672 | } |
| @@ -701,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target, · 31 unmodified lines | ||
| 701 | 704 | kbuf += sizeof(reg); |
| 702 | 705 | } else { |
| 703 | 706 | ret = copy_from_user(®, ubuf, sizeof(reg)); |
| 704 | − if (ret) | |
| 705 | − return ret; | |
| 707 | + if (ret) { | |
| 708 | + ret = -EFAULT; | |
| 709 | + break; | |
| 710 | + } | |
| 706 | 711 | |
| 707 | 712 | ubuf += sizeof(reg); |
| 708 | 713 | } |
| @@ -78,6 +78,7 @@ unsigned int compat_elf_hwcap2 __read_mostly; · 77 unmodified lines | ||
| 78 | 78 | #endif |
| 79 | 79 | |
| 80 | 80 | static const char *cpu_name; |
| 81 | +static const char *machine_name; | |
| 81 | 82 | phys_addr_t __fdt_pointer __initdata; |
| 82 | 83 | |
| 83 | 84 | /* |
| @@ -309,6 +310,8 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) · 225 unmodified lines | ||
| 309 | 310 | while (true) |
| 310 | 311 | cpu_relax(); |
| 311 | 312 | } |
| 313 | + | |
| 314 | + machine_name = of_flat_dt_get_machine_name(); | |
| 312 | 315 | } |
| 313 | 316 | |
| 314 | 317 | /* |
| @@ -447,21 +450,10 @@ static int c_show(struct seq_file *m, void *v) · 132 unmodified lines | ||
| 447 | 450 | { |
| 448 | 451 | int i; |
| 449 | 452 | |
| 450 | − /* | |
| 451 | − * Dump out the common processor features in a single line. Userspace | |
| 452 | − * should read the hwcaps with getauxval(AT_HWCAP) rather than | |
| 453 | − * attempting to parse this. | |
| 454 | − */ | |
| 455 | − seq_puts(m, "features\t:"); | |
| 456 | − for (i = 0; hwcap_str[i]; i++) | |
| 457 | − if (elf_hwcap & (1 << i)) | |
| 458 | − seq_printf(m, " %s", hwcap_str[i]); | |
| 459 | − seq_puts(m, "\n\n"); | |
| 453 | + seq_printf(m, "Processor\t: %s rev %d (%s)\n", | |
| 454 | + cpu_name, read_cpuid_id() & 15, ELF_PLATFORM); | |
| 460 | 455 | |
| 461 | 456 | for_each_online_cpu(i) { |
| 462 | − struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i); | |
| 463 | − u32 midr = cpuinfo->reg_midr; | |
| 464 | − | |
| 465 | 457 | /* |
| 466 | 458 | * glibc reads /proc/cpuinfo to determine the number of |
| 467 | 459 | * online processors, looking for lines beginning with |
| @@ -470,13 +462,25 @@ static int c_show(struct seq_file *m, void *v) · 2 unmodified lines | ||
| 470 | 462 | #ifdef CONFIG_SMP |
| 471 | 463 | seq_printf(m, "processor\t: %d\n", i); |
| 472 | 464 | #endif |
| 473 | − seq_printf(m, "implementer\t: 0x%02x\n", | |
| 474 | − MIDR_IMPLEMENTOR(midr)); | |
| 475 | − seq_printf(m, "variant\t\t: 0x%x\n", MIDR_VARIANT(midr)); | |
| 476 | − seq_printf(m, "partnum\t\t: 0x%03x\n", MIDR_PARTNUM(midr)); | |
| 477 | − seq_printf(m, "revision\t: 0x%x\n\n", MIDR_REVISION(midr)); | |
| 478 | 465 | } |
| 479 | 466 | |
| 467 | + /* dump out the processor features */ | |
| 468 | + seq_puts(m, "Features\t: "); | |
| 469 | + | |
| 470 | + for (i = 0; hwcap_str[i]; i++) | |
| 471 | + if (elf_hwcap & (1 << i)) | |
| 472 | + seq_printf(m, "%s ", hwcap_str[i]); | |
| 473 | + | |
| 474 | + seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24); | |
| 475 | + seq_printf(m, "CPU architecture: AArch64\n"); | |
| 476 | + seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15); | |
| 477 | + seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff); | |
| 478 | + seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15); | |
| 479 | + | |
| 480 | + seq_puts(m, "\n"); | |
| 481 | + | |
| 482 | + seq_printf(m, "Hardware\t: %s\n", machine_name); | |
| 483 | + | |
| 480 | 484 | return 0; |
| 481 | 485 | } |
| 482 | 486 | |
| @@ -66,6 +66,8 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) · 65 unmodified lines | ||
| 66 | 66 | else |
| 67 | 67 | kvm_vcpu_block(vcpu); |
| 68 | 68 | |
| 69 | + kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); | |
| 70 | + | |
| 69 | 71 | return 1; |
| 70 | 72 | } |
| 71 | 73 | |
| @@ -80,6 +80,10 @@ __do_hyp_init: · 79 unmodified lines | ||
| 80 | 80 | msr mair_el2, x4 |
| 81 | 81 | isb |
| 82 | 82 | |
| 83 | + /* Invalidate the stale TLBs from Bootloader */ | |
| 84 | + tlbi alle2 | |
| 85 | + dsb sy | |
| 86 | + | |
| 83 | 87 | mrs x4, sctlr_el2 |
| 84 | 88 | and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2 |
| 85 | 89 | ldr x5, =SCTLR_EL2_FLAGS |
| @@ -68,6 +68,7 @@ void flush_icache_range(unsigned long start, unsigned long end) · 67 unmodified lines | ||
| 68 | 68 | ); |
| 69 | 69 | local_irq_restore(flags); |
| 70 | 70 | } |
| 71 | +EXPORT_SYMBOL(flush_icache_range); | |
| 71 | 72 | |
| 72 | 73 | void hexagon_clean_dcache_range(unsigned long start, unsigned long end) |
| 73 | 74 | { |
| @@ -549,8 +549,6 @@ source "drivers/sn/Kconfig" · 548 unmodified lines | ||
| 549 | 549 | config KEXEC |
| 550 | 550 | bool "kexec system call" |
| 551 | 551 | depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU) |
| 552 | − select CRYPTO | |
| 553 | − select CRYPTO_SHA256 | |
| 554 | 552 | help |
| 555 | 553 | kexec is a system call that implements the ability to shutdown your |
| 556 | 554 | current kernel, and to start another kernel. It is like a reboot |
| @@ -91,8 +91,6 @@ config MMU_SUN3 · 90 unmodified lines | ||
| 91 | 91 | config KEXEC |
| 92 | 92 | bool "kexec system call" |
| 93 | 93 | depends on M68KCLASSIC |
| 94 | − select CRYPTO | |
| 95 | − select CRYPTO_SHA256 | |
| 96 | 94 | help |
| 97 | 95 | kexec is a system call that implements the ability to shutdown your |
| 98 | 96 | current kernel, and to start another kernel. It is like a reboot |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | #include <uapi/asm/unistd.h> |
| 5 | 5 | |
| 6 | 6 | |
| 7 | −#define NR_syscalls 352 | |
| 7 | +#define NR_syscalls 354 | |
| 8 | 8 | |
| 9 | 9 | #define __ARCH_WANT_OLD_READDIR |
| 10 | 10 | #define __ARCH_WANT_OLD_STAT |
| @@ -357,5 +357,7 @@ · 356 unmodified lines | ||
| 357 | 357 | #define __NR_sched_setattr 349 |
| 358 | 358 | #define __NR_sched_getattr 350 |
| 359 | 359 | #define __NR_renameat2 351 |
| 360 | +#define __NR_getrandom 352 | |
| 361 | +#define __NR_memfd_create 353 | |
| 360 | 362 | |
| 361 | 363 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ |
| @@ -372,4 +372,6 @@ ENTRY(sys_call_table) · 371 unmodified lines | ||
| 372 | 372 | .long sys_sched_setattr |
| 373 | 373 | .long sys_sched_getattr /* 350 */ |
| 374 | 374 | .long sys_renameat2 |
| 375 | + .long sys_getrandom | |
| 376 | + .long sys_memfd_create | |
| 375 | 377 | |
| @@ -2396,8 +2396,6 @@ source "kernel/Kconfig.preempt" · 2395 unmodified lines | ||
| 2396 | 2396 | |
| 2397 | 2397 | config KEXEC |
| 2398 | 2398 | bool "Kexec system call" |
| 2399 | − select CRYPTO | |
| 2400 | − select CRYPTO_SHA256 | |
| 2401 | 2399 | help |
| 2402 | 2400 | kexec is a system call that implements the ability to shutdown your |
| 2403 | 2401 | current kernel, and to start another kernel. It is like a reboot |
| @@ -847,6 +847,7 @@ int __init db1200_dev_setup(void) · 846 unmodified lines | ||
| 847 | 847 | pr_warn("DB1200: cant get I2C close to 50MHz\n"); |
| 848 | 848 | else |
| 849 | 849 | clk_set_rate(c, pfc); |
| 850 | + clk_prepare_enable(c); | |
| 850 | 851 | clk_put(c); |
| 851 | 852 | } |
| 852 | 853 | |
| @@ -922,11 +923,6 @@ int __init db1200_dev_setup(void) · 69 unmodified lines | ||
| 922 | 923 | } |
| 923 | 924 | |
| 924 | 925 | /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ |
| 925 | − c = clk_get(NULL, "psc1_intclk"); | |
| 926 | − if (!IS_ERR(c)) { | |
| 927 | − clk_prepare_enable(c); | |
| 928 | − clk_put(c); | |
| 929 | − } | |
| 930 | 926 | __raw_writel(PSC_SEL_CLK_SERCLK, |
| 931 | 927 | (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); |
| 932 | 928 | wmb(); |
| @@ -59,12 +59,21 @@ static void bcm47xx_machine_restart(char *command) · 58 unmodified lines | ||
| 59 | 59 | switch (bcm47xx_bus_type) { |
| 60 | 60 | #ifdef CONFIG_BCM47XX_SSB |
| 61 | 61 | case BCM47XX_BUS_TYPE_SSB: |
| 62 | − ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 3); | |
| 62 | + if (bcm47xx_bus.ssb.chip_id == 0x4785) | |
| 63 | + write_c0_diag4(1 << 22); | |
| 64 | + ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1); | |
| 65 | + if (bcm47xx_bus.ssb.chip_id == 0x4785) { | |
| 66 | + __asm__ __volatile__( | |
| 67 | + ".set\tmips3\n\t" | |
| 68 | + "sync\n\t" | |
| 69 | + "wait\n\t" | |
| 70 | + ".set\tmips0"); | |
| 71 | + } | |
| 63 | 72 | break; |
| 64 | 73 | #endif |
| 65 | 74 | #ifdef CONFIG_BCM47XX_BCMA |
| 66 | 75 | case BCM47XX_BUS_TYPE_BCMA: |
| 67 | − bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 3); | |
| 76 | + bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1); | |
| 68 | 77 | break; |
| 69 | 78 | #endif |
| 70 | 79 | } |
| @@ -263,7 +263,6 @@ static uint64_t crashk_size, crashk_base; · 262 unmodified lines | ||
| 263 | 263 | static int octeon_uart; |
| 264 | 264 | |
| 265 | 265 | extern asmlinkage void handle_int(void); |
| 266 | −extern asmlinkage void plat_irq_dispatch(void); | |
| 267 | 266 | |
| 268 | 267 | /** |
| 269 | 268 | * Return non zero if we are currently running in the Octeon simulator |
| @@ -458,6 +457,18 @@ static void octeon_halt(void) · 188 unmodified lines | ||
| 458 | 457 | octeon_kill_core(NULL); |
| 459 | 458 | } |
| 460 | 459 | |
| 460 | +static char __read_mostly octeon_system_type[80]; | |
| 461 | + | |
| 462 | +static int __init init_octeon_system_type(void) | |
| 463 | +{ | |
| 464 | + snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)", | |
| 465 | + cvmx_board_type_to_string(octeon_bootinfo->board_type), | |
| 466 | + octeon_model_get_string(read_c0_prid())); | |
| 467 | + | |
| 468 | + return 0; | |
| 469 | +} | |
| 470 | +early_initcall(init_octeon_system_type); | |
| 471 | + | |
| 461 | 472 | /** |
| 462 | 473 | * Return a string representing the system type |
| 463 | 474 | * |
| @@ -465,11 +476,7 @@ static void octeon_halt(void) · 1 unmodified line | ||
| 465 | 476 | */ |
| 466 | 477 | const char *octeon_board_type_string(void) |
| 467 | 478 | { |
| 468 | − static char name[80]; | |
| 469 | − sprintf(name, "%s (%s)", | |
| 470 | − cvmx_board_type_to_string(octeon_bootinfo->board_type), | |
| 471 | − octeon_model_get_string(read_c0_prid())); | |
| 472 | − return name; | |
| 479 | + return octeon_system_type; | |
| 473 | 480 | } |
| 474 | 481 | |
| 475 | 482 | const char *get_system_type(void) |
| @@ -0,0 +1,43 @@ | ||
| 1 | +/* | |
| 2 | + * This file is subject to the terms and conditions of the GNU General Public | |
| 3 | + * License. See the file "COPYING" in the main directory of this archive | |
| 4 | + * for more details. | |
| 5 | + * | |
| 6 | + * Copyright (C) 2014, Imagination Technologies Ltd. | |
| 7 | + * | |
| 8 | + * EVA functions for generic code | |
| 9 | + */ | |
| 10 | + | |
| 11 | +#ifndef _ASM_EVA_H | |
| 12 | +#define _ASM_EVA_H | |
| 13 | + | |
| 14 | +#include <kernel-entry-init.h> | |
| 15 | + | |
| 16 | +#ifdef __ASSEMBLY__ | |
| 17 | + | |
| 18 | +#ifdef CONFIG_EVA | |
| 19 | + | |
| 20 | +/* | |
| 21 | + * EVA early init code | |
| 22 | + * | |
| 23 | + * Platforms must define their own 'platform_eva_init' macro in | |
| 24 | + * their kernel-entry-init.h header. This macro usually does the | |
| 25 | + * platform specific configuration of the segmentation registers, | |
| 26 | + * and it is normally called from assembly code. | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + | |
| 30 | +.macro eva_init | |
| 31 | +platform_eva_init | |
| 32 | +.endm | |
| 33 | + | |
| 34 | +#else | |
| 35 | + | |
| 36 | +.macro eva_init | |
| 37 | +.endm | |
| 38 | + | |
| 39 | +#endif /* CONFIG_EVA */ | |
| 40 | + | |
| 41 | +#endif /* __ASSEMBLY__ */ | |
| 42 | + | |
| 43 | +#endif | |
| @@ -49,7 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | #endif |
| 50 | 50 | #define GICBIS(reg, mask, bits) \ |
| 51 | 51 | do { u32 data; \ |
| 52 | − GICREAD((reg), data); \ | |
| 52 | + GICREAD(reg, data); \ | |
| 53 | 53 | data &= ~(mask); \ |
| 54 | 54 | data |= ((bits) & (mask)); \ |
| 55 | 55 | GICWRITE((reg), data); \ |
| @@ -26,6 +26,8 @@ static inline int irq_canonicalize(int irq) · 25 unmodified lines | ||
| 26 | 26 | #define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ |
| 27 | 27 | #endif |
| 28 | 28 | |
| 29 | +asmlinkage void plat_irq_dispatch(void); | |
| 30 | + | |
| 29 | 31 | extern void do_IRQ(unsigned int irq); |
| 30 | 32 | |
| 31 | 33 | extern void arch_init_irq(void); |
| @@ -10,14 +10,15 @@ · 9 unmodified lines | ||
| 10 | 10 | #ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H |
| 11 | 11 | #define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H |
| 12 | 12 | |
| 13 | +#include <asm/regdef.h> | |
| 14 | +#include <asm/mipsregs.h> | |
| 15 | + | |
| 13 | 16 | /* |
| 14 | 17 | * Prepare segments for EVA boot: |
| 15 | 18 | * |
| 16 | 19 | * This is in case the processor boots in legacy configuration |
| 17 | 20 | * (SI_EVAReset is de-asserted and CONFIG5.K == 0) |
| 18 | 21 | * |
| 19 | − * On entry, t1 is loaded with CP0_CONFIG | |
| 20 | − * | |
| 21 | 22 | * ========================= Mappings ============================= |
| 22 | 23 | * Virtual memory Physical memory Mapping |
| 23 | 24 | * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg) |
| @@ -30,12 +31,20 @@ · 6 unmodified lines | ||
| 30 | 31 | * |
| 31 | 32 | * |
| 32 | 33 | * Lowmem is expanded to 2GB |
| 34 | + * | |
| 35 | + * The following code uses the t0, t1, t2 and ra registers without | |
| 36 | + * previously preserving them. | |
| 37 | + * | |
| 33 | 38 | */ |
| 34 | − .macro eva_entry | |
| 39 | + .macro platform_eva_init | |
| 40 | + | |
| 41 | + .set push | |
| 42 | + .set reorder | |
| 35 | 43 | /* |
| 36 | 44 | * Get Config.K0 value and use it to program |
| 37 | 45 | * the segmentation registers |
| 38 | 46 | */ |
| 47 | + mfc0 t1, CP0_CONFIG | |
| 39 | 48 | andi t1, 0x7 /* CCA */ |
| 40 | 49 | move t2, t1 |
| 41 | 50 | ins t2, t1, 16, 3 |
| @@ -77,6 +86,8 @@ · 35 unmodified lines | ||
| 77 | 86 | mtc0 t0, $16, 5 |
| 78 | 87 | sync |
| 79 | 88 | jal mips_ihb |
| 89 | + | |
| 90 | + .set pop | |
| 80 | 91 | .endm |
| 81 | 92 | |
| 82 | 93 | .macro kernel_entry_setup |
| @@ -95,7 +106,7 @@ · 12 unmodified lines | ||
| 95 | 106 | sll t0, t0, 6 /* SC bit */ |
| 96 | 107 | bgez t0, 9f |
| 97 | 108 | |
| 98 | − eva_entry | |
| 109 | + platform_eva_init | |
| 99 | 110 | b 0f |
| 100 | 111 | 9: |
| 101 | 112 | /* Assume we came from YAMON... */ |
| @@ -127,8 +138,7 @@ nonsc_processor: · 25 unmodified lines | ||
| 127 | 138 | #ifdef CONFIG_EVA |
| 128 | 139 | sync |
| 129 | 140 | ehb |
| 130 | − mfc0 t1, CP0_CONFIG | |
| 131 | − eva_entry | |
| 141 | + platform_eva_init | |
| 132 | 142 | #endif |
| 133 | 143 | .endm |
| 134 | 144 | |
| @@ -10,13 +10,6 @@ · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | #include <asm/mach-netlogic/multi-node.h> |
| 12 | 12 | |
| 13 | −#ifdef CONFIG_SMP | |
| 14 | −#define topology_physical_package_id(cpu) cpu_to_node(cpu) | |
| 15 | −#define topology_core_id(cpu) (cpu_logical_map(cpu) / NLM_THREADS_PER_CORE) | |
| 16 | −#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu]) | |
| 17 | −#define topology_core_cpumask(cpu) cpumask_of_node(cpu_to_node(cpu)) | |
| 18 | −#endif | |
| 19 | − | |
| 20 | 13 | #include <asm-generic/topology.h> |
| 21 | 14 | |
| 22 | 15 | #endif /* _ASM_MACH_NETLOGIC_TOPOLOGY_H */ |
| @@ -122,6 +122,9 @@ do { \ · 121 unmodified lines | ||
| 122 | 122 | } \ |
| 123 | 123 | } while(0) |
| 124 | 124 | |
| 125 | +extern void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, | |
| 126 | + pte_t pteval); | |
| 127 | + | |
| 125 | 128 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) |
| 126 | 129 | |
| 127 | 130 | #define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL)) |
| @@ -145,7 +148,6 @@ static inline void set_pte(pte_t *ptep, pte_t pte) · 17 unmodified lines | ||
| 145 | 148 | } |
| 146 | 149 | } |
| 147 | 150 | } |
| 148 | −#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) | |
| 149 | 151 | |
| 150 | 152 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
| 151 | 153 | { |
| @@ -183,7 +185,6 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) · 31 unmodified lines | ||
| 183 | 185 | } |
| 184 | 186 | #endif |
| 185 | 187 | } |
| 186 | −#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) | |
| 187 | 188 | |
| 188 | 189 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
| 189 | 190 | { |
| @@ -390,15 +391,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) · 200 unmodified lines | ||
| 390 | 391 | |
| 391 | 392 | extern void __update_tlb(struct vm_area_struct *vma, unsigned long address, |
| 392 | 393 | pte_t pte); |
| 393 | −extern void __update_cache(struct vm_area_struct *vma, unsigned long address, | |
| 394 | − pte_t pte); | |
| 395 | 394 | |
| 396 | 395 | static inline void update_mmu_cache(struct vm_area_struct *vma, |
| 397 | 396 | unsigned long address, pte_t *ptep) |
| 398 | 397 | { |
| 399 | 398 | pte_t pte = *ptep; |
| 400 | 399 | __update_tlb(vma, address, pte); |
| 401 | − __update_cache(vma, address, pte); | |
| 402 | 400 | } |
| 403 | 401 | |
| 404 | 402 | static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, |
| @@ -131,10 +131,12 @@ static inline int syscall_get_arch(void) · 130 unmodified lines | ||
| 131 | 131 | { |
| 132 | 132 | int arch = EM_MIPS; |
| 133 | 133 | #ifdef CONFIG_64BIT |
| 134 | − if (!test_thread_flag(TIF_32BIT_REGS)) | |
| 134 | + if (!test_thread_flag(TIF_32BIT_REGS)) { | |
| 135 | 135 | arch |= __AUDIT_ARCH_64BIT; |
| 136 | − if (test_thread_flag(TIF_32BIT_ADDR)) | |
| 137 | − arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; | |
| 136 | + /* N32 sets only TIF_32BIT_ADDR */ | |
| 137 | + if (test_thread_flag(TIF_32BIT_ADDR)) | |
| 138 | + arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; | |
| 139 | + } | |
| 138 | 140 | #endif |
| 139 | 141 | #if defined(__LITTLE_ENDIAN) |
| 140 | 142 | arch |= __AUDIT_ARCH_LE; |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <asm/asm-offsets.h> |
| 14 | 14 | #include <asm/asmmacro.h> |
| 15 | 15 | #include <asm/cacheops.h> |
| 16 | +#include <asm/eva.h> | |
| 16 | 17 | #include <asm/mipsregs.h> |
| 17 | 18 | #include <asm/mipsmtregs.h> |
| 18 | 19 | #include <asm/pm.h> |
| @@ -166,6 +167,9 @@ dcache_done: · 147 unmodified lines | ||
| 166 | 167 | 1: jal mips_cps_core_init |
| 167 | 168 | nop |
| 168 | 169 | |
| 170 | + /* Do any EVA initialization if necessary */ | |
| 171 | + eva_init | |
| 172 | + | |
| 169 | 173 | /* |
| 170 | 174 | * Boot any other VPEs within this core that should be online, and |
| 171 | 175 | * deactivate this VPE if it should be offline. |
| @@ -558,7 +558,7 @@ static int mipspmu_get_irq(void) · 557 unmodified lines | ||
| 558 | 558 | if (mipspmu.irq >= 0) { |
| 559 | 559 | /* Request my own irq handler. */ |
| 560 | 560 | err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq, |
| 561 | − IRQF_PERCPU | IRQF_NOBALANCING, | |
| 561 | + IRQF_PERCPU | IRQF_NOBALANCING | IRQF_NO_THREAD, | |
| 562 | 562 | "mips_perf_pmu", NULL); |
| 563 | 563 | if (err) { |
| 564 | 564 | pr_warning("Unable to request IRQ%d for MIPS " |
| @@ -113,15 +113,19 @@ trace_a_syscall: · 112 unmodified lines | ||
| 113 | 113 | move s0, t2 # Save syscall pointer |
| 114 | 114 | move a0, sp |
| 115 | 115 | /* |
| 116 | − * syscall number is in v0 unless we called syscall(__NR_###) | |
| 116 | + * absolute syscall number is in v0 unless we called syscall(__NR_###) | |
| 117 | 117 | * where the real syscall number is in a0 |
| 118 | 118 | * note: NR_syscall is the first O32 syscall but the macro is |
| 119 | 119 | * only defined when compiling with -mabi=32 (CONFIG_32BIT) |
| 120 | 120 | * therefore __NR_O32_Linux is used (4000) |
| 121 | 121 | */ |
| 122 | − addiu a1, v0, __NR_O32_Linux | |
| 123 | − bnez v0, 1f /* __NR_syscall at offset 0 */ | |
| 124 | − lw a1, PT_R4(sp) | |
| 122 | + .set push | |
| 123 | + .set reorder | |
| 124 | + subu t1, v0, __NR_O32_Linux | |
| 125 | + move a1, v0 | |
| 126 | + bnez t1, 1f /* __NR_syscall at offset 0 */ | |
| 127 | + lw a1, PT_R4(sp) /* Arg1 for __NR_syscall case */ | |
| 128 | + .set pop | |
| 125 | 129 | |
| 126 | 130 | 1: jal syscall_trace_enter |
| 127 | 131 | |
| @@ -22,13 +22,13 @@ · 21 unmodified lines | ||
| 22 | 22 | static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action, |
| 23 | 23 | void *data) |
| 24 | 24 | { |
| 25 | − int fpu_enabled; | |
| 25 | + int fpu_owned; | |
| 26 | 26 | int fr = !test_thread_flag(TIF_32BIT_FPREGS); |
| 27 | 27 | |
| 28 | 28 | switch (action) { |
| 29 | 29 | case CU2_EXCEPTION: |
| 30 | 30 | preempt_disable(); |
| 31 | − fpu_enabled = read_c0_status() & ST0_CU1; | |
| 31 | + fpu_owned = __is_fpu_owner(); | |
| 32 | 32 | if (!fr) |
| 33 | 33 | set_c0_status(ST0_CU1 | ST0_CU2); |
| 34 | 34 | else |
| @@ -39,8 +39,8 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action, · 4 unmodified lines | ||
| 39 | 39 | KSTK_STATUS(current) |= ST0_FR; |
| 40 | 40 | else |
| 41 | 41 | KSTK_STATUS(current) &= ~ST0_FR; |
| 42 | − /* If FPU is enabled, we needn't init or restore fp */ | |
| 43 | − if(!fpu_enabled) { | |
| 42 | + /* If FPU is owned, we needn't init or restore fp */ | |
| 43 | + if (!fpu_owned) { | |
| 44 | 44 | set_thread_flag(TIF_USEDFPU); |
| 45 | 45 | if (!used_math()) { |
| 46 | 46 | _init_fpu(); |
| @@ -24,8 +24,6 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <asm/page.h> |
| 25 | 25 | #include <asm/pgalloc.h> |
| 26 | 26 | #include <asm/sections.h> |
| 27 | −#include <linux/bootmem.h> | |
| 28 | −#include <linux/init.h> | |
| 29 | 27 | #include <linux/irq.h> |
| 30 | 28 | #include <asm/bootinfo.h> |
| 31 | 29 | #include <asm/mc146818-time.h> |
| @@ -119,25 +119,36 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr) · 118 unmodified lines | ||
| 119 | 119 | |
| 120 | 120 | EXPORT_SYMBOL(__flush_anon_page); |
| 121 | 121 | |
| 122 | −void __update_cache(struct vm_area_struct *vma, unsigned long address, | |
| 123 | − pte_t pte) | |
| 122 | +static void mips_flush_dcache_from_pte(pte_t pteval, unsigned long address) | |
| 124 | 123 | { |
| 125 | 124 | struct page *page; |
| 126 | − unsigned long pfn, addr; | |
| 127 | − int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc; | |
| 125 | + unsigned long pfn = pte_pfn(pteval); | |
| 128 | 126 | |
| 129 | − pfn = pte_pfn(pte); | |
| 130 | 127 | if (unlikely(!pfn_valid(pfn))) |
| 131 | 128 | return; |
| 129 | + | |
| 132 | 130 | page = pfn_to_page(pfn); |
| 133 | 131 | if (page_mapping(page) && Page_dcache_dirty(page)) { |
| 134 | − addr = (unsigned long) page_address(page); | |
| 135 | − if (exec || pages_do_alias(addr, address & PAGE_MASK)) | |
| 136 | − flush_data_cache_page(addr); | |
| 132 | + unsigned long page_addr = (unsigned long) page_address(page); | |
| 133 | + | |
| 134 | + if (!cpu_has_ic_fills_f_dc || | |
| 135 | + pages_do_alias(page_addr, address & PAGE_MASK)) | |
| 136 | + flush_data_cache_page(page_addr); | |
| 137 | 137 | ClearPageDcacheDirty(page); |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | +void set_pte_at(struct mm_struct *mm, unsigned long addr, | |
| 142 | + pte_t *ptep, pte_t pteval) | |
| 143 | +{ | |
| 144 | + if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) { | |
| 145 | + if (pte_present(pteval)) | |
| 146 | + mips_flush_dcache_from_pte(pteval, addr); | |
| 147 | + } | |
| 148 | + | |
| 149 | + set_pte(ptep, pteval); | |
| 150 | +} | |
| 151 | + | |
| 141 | 152 | unsigned long _page_cachable_default; |
| 142 | 153 | EXPORT_SYMBOL(_page_cachable_default); |
| 143 | 154 | |
| @@ -35,13 +35,19 @@ fw_memblock_t * __init fw_getmdesc(int eva) · 34 unmodified lines | ||
| 35 | 35 | /* otherwise look in the environment */ |
| 36 | 36 | |
| 37 | 37 | memsize_str = fw_getenv("memsize"); |
| 38 | − if (memsize_str) | |
| 39 | − tmp = kstrtol(memsize_str, 0, &memsize); | |
| 38 | + if (memsize_str) { | |
| 39 | + tmp = kstrtoul(memsize_str, 0, &memsize); | |
| 40 | + if (tmp) | |
| 41 | + pr_warn("Failed to read the 'memsize' env variable.\n"); | |
| 42 | + } | |
| 40 | 43 | if (eva) { |
| 41 | 44 | /* Look for ememsize for EVA */ |
| 42 | 45 | ememsize_str = fw_getenv("ememsize"); |
| 43 | − if (ememsize_str) | |
| 44 | − tmp = kstrtol(ememsize_str, 0, &ememsize); | |
| 46 | + if (ememsize_str) { | |
| 47 | + tmp = kstrtoul(ememsize_str, 0, &ememsize); | |
| 48 | + if (tmp) | |
| 49 | + pr_warn("Failed to read the 'ememsize' env variable.\n"); | |
| 50 | + } | |
| 45 | 51 | } |
| 46 | 52 | if (!memsize && !ememsize) { |
| 47 | 53 | pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); |
| @@ -51,7 +51,7 @@ static inline void sec_int_dispatch(void) { do_IRQ(MSP_INT_SEC); } · 50 unmodified lines | ||
| 51 | 51 | * the range 40-71. |
| 52 | 52 | */ |
| 53 | 53 | |
| 54 | −asmlinkage void plat_irq_dispatch(struct pt_regs *regs) | |
| 54 | +asmlinkage void plat_irq_dispatch(void) | |
| 55 | 55 | { |
| 56 | 56 | u32 pending; |
| 57 | 57 | |
| @@ -399,8 +399,6 @@ config PPC64_SUPPORTS_MEMORY_FAILURE · 398 unmodified lines | ||
| 399 | 399 | config KEXEC |
| 400 | 400 | bool "kexec system call" |
| 401 | 401 | depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) |
| 402 | − select CRYPTO | |
| 403 | − select CRYPTO_SHA256 | |
| 404 | 402 | help |
| 405 | 403 | kexec is a system call that implements the ability to shutdown your |
| 406 | 404 | current kernel, and to start another kernel. It is like a reboot |
| @@ -62,10 +62,10 @@ long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp) · 61 unmodified lines | ||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | kvm->arch.hpt_cma_alloc = 0; |
| 65 | − page = kvm_alloc_hpt(1 << (order - PAGE_SHIFT)); | |
| 65 | + page = kvm_alloc_hpt(1ul << (order - PAGE_SHIFT)); | |
| 66 | 66 | if (page) { |
| 67 | 67 | hpt = (unsigned long)pfn_to_kaddr(page_to_pfn(page)); |
| 68 | − memset((void *)hpt, 0, (1 << order)); | |
| 68 | + memset((void *)hpt, 0, (1ul << order)); | |
| 69 | 69 | kvm->arch.hpt_cma_alloc = 1; |
| 70 | 70 | } |
| 71 | 71 | |
| @@ -48,8 +48,6 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC · 47 unmodified lines | ||
| 48 | 48 | |
| 49 | 49 | config KEXEC |
| 50 | 50 | def_bool y |
| 51 | − select CRYPTO | |
| 52 | − select CRYPTO_SHA256 | |
| 53 | 51 | |
| 54 | 52 | config AUDIT_ARCH |
| 55 | 53 | def_bool y |
| @@ -1127,7 +1127,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, · 1126 unmodified lines | ||
| 1127 | 1127 | unsigned long addr, pte_t *ptep) |
| 1128 | 1128 | { |
| 1129 | 1129 | pgste_t pgste; |
| 1130 | − pte_t pte; | |
| 1130 | + pte_t pte, oldpte; | |
| 1131 | 1131 | int young; |
| 1132 | 1132 | |
| 1133 | 1133 | if (mm_has_pgste(vma->vm_mm)) { |
| @@ -1135,12 +1135,13 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, · 1 unmodified line | ||
| 1135 | 1135 | pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste); |
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | − pte = *ptep; | |
| 1138 | + oldpte = pte = *ptep; | |
| 1139 | 1139 | ptep_flush_direct(vma->vm_mm, addr, ptep); |
| 1140 | 1140 | young = pte_young(pte); |
| 1141 | 1141 | pte = pte_mkold(pte); |
| 1142 | 1142 | |
| 1143 | 1143 | if (mm_has_pgste(vma->vm_mm)) { |
| 1144 | + pgste = pgste_update_all(&oldpte, pgste, vma->vm_mm); | |
| 1144 | 1145 | pgste = pgste_set_pte(ptep, pgste, pte); |
| 1145 | 1146 | pgste_set_unlock(ptep, pgste); |
| 1146 | 1147 | } else |
| @@ -1330,6 +1331,7 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma, · 183 unmodified lines | ||
| 1330 | 1331 | ptep_flush_direct(vma->vm_mm, address, ptep); |
| 1331 | 1332 | |
| 1332 | 1333 | if (mm_has_pgste(vma->vm_mm)) { |
| 1334 | + pgste_set_key(ptep, pgste, entry, vma->vm_mm); | |
| 1333 | 1335 | pgste = pgste_set_pte(ptep, pgste, entry); |
| 1334 | 1336 | pgste_set_unlock(ptep, pgste); |
| 1335 | 1337 | } else |
| @@ -283,7 +283,10 @@ · 282 unmodified lines | ||
| 283 | 283 | #define __NR_sched_setattr 345 |
| 284 | 284 | #define __NR_sched_getattr 346 |
| 285 | 285 | #define __NR_renameat2 347 |
| 286 | −#define NR_syscalls 348 | |
| 286 | +#define __NR_seccomp 348 | |
| 287 | +#define __NR_getrandom 349 | |
| 288 | +#define __NR_memfd_create 350 | |
| 289 | +#define NR_syscalls 351 | |
| 287 | 290 | |
| 288 | 291 | /* |
| 289 | 292 | * There are some system calls that are not present on 64 bit, some |
| @@ -214,3 +214,6 @@ COMPAT_SYSCALL_WRAP3(finit_module, int, fd, const char __user *, uargs, int, fla · 213 unmodified lines | ||
| 214 | 214 | COMPAT_SYSCALL_WRAP3(sched_setattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, flags); |
| 215 | 215 | COMPAT_SYSCALL_WRAP4(sched_getattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, size, unsigned int, flags); |
| 216 | 216 | COMPAT_SYSCALL_WRAP5(renameat2, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, unsigned int, flags); |
| 217 | +COMPAT_SYSCALL_WRAP3(seccomp, unsigned int, op, unsigned int, flags, const char __user *, uargs) | |
| 218 | +COMPAT_SYSCALL_WRAP3(getrandom, char __user *, buf, size_t, count, unsigned int, flags) | |
| 219 | +COMPAT_SYSCALL_WRAP2(memfd_create, const char __user *, uname, unsigned int, flags) | |
| @@ -2060,6 +2060,13 @@ void s390_reset_system(void (*func)(void *), void *data) · 2059 unmodified lines | ||
| 2060 | 2060 | S390_lowcore.program_new_psw.addr = |
| 2061 | 2061 | PSW_ADDR_AMODE | (unsigned long) s390_base_pgm_handler; |
| 2062 | 2062 | |
| 2063 | + /* | |
| 2064 | + * Clear subchannel ID and number to signal new kernel that no CCW or | |
| 2065 | + * SCSI IPL has been done (for kexec and kdump) | |
| 2066 | + */ | |
| 2067 | + S390_lowcore.subchannel_id = 0; | |
| 2068 | + S390_lowcore.subchannel_nr = 0; | |
| 2069 | + | |
| 2063 | 2070 | /* Store status at absolute zero */ |
| 2064 | 2071 | store_status(); |
| 2065 | 2072 | |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/stddef.h> |
| 25 | 25 | #include <linux/unistd.h> |
| 26 | 26 | #include <linux/ptrace.h> |
| 27 | +#include <linux/random.h> | |
| 27 | 28 | #include <linux/user.h> |
| 28 | 29 | #include <linux/tty.h> |
| 29 | 30 | #include <linux/ioport.h> |
| @@ -61,6 +62,7 @@ · 31 unmodified lines | ||
| 61 | 62 | #include <asm/diag.h> |
| 62 | 63 | #include <asm/os_info.h> |
| 63 | 64 | #include <asm/sclp.h> |
| 65 | +#include <asm/sysinfo.h> | |
| 64 | 66 | #include "entry.h" |
| 65 | 67 | |
| 66 | 68 | /* |
| @@ -766,6 +768,7 @@ static void __init setup_hwcaps(void) · 699 unmodified lines | ||
| 766 | 768 | #endif |
| 767 | 769 | |
| 768 | 770 | get_cpu_id(&cpu_id); |
| 771 | + add_device_randomness(&cpu_id, sizeof(cpu_id)); | |
| 769 | 772 | switch (cpu_id.machine) { |
| 770 | 773 | case 0x9672: |
| 771 | 774 | #if !defined(CONFIG_64BIT) |
| @@ -803,6 +806,19 @@ static void __init setup_hwcaps(void) · 31 unmodified lines | ||
| 803 | 806 | } |
| 804 | 807 | } |
| 805 | 808 | |
| 809 | +/* | |
| 810 | + * Add system information as device randomness | |
| 811 | + */ | |
| 812 | +static void __init setup_randomness(void) | |
| 813 | +{ | |
| 814 | + struct sysinfo_3_2_2 *vmms; | |
| 815 | + | |
| 816 | + vmms = (struct sysinfo_3_2_2 *) alloc_page(GFP_KERNEL); | |
| 817 | + if (vmms && stsi(vmms, 3, 2, 2) == 0 && vmms->count) | |
| 818 | + add_device_randomness(&vmms, vmms->count); | |
| 819 | + free_page((unsigned long) vmms); | |
| 820 | +} | |
| 821 | + | |
| 806 | 822 | /* |
| 807 | 823 | * Setup function called from init/main.c just after the banner |
| 808 | 824 | * was printed. |
| @@ -901,6 +917,9 @@ void __init setup_arch(char **cmdline_p) · 92 unmodified lines | ||
| 901 | 917 | |
| 902 | 918 | /* Setup zfcpdump support */ |
| 903 | 919 | setup_zfcpdump(); |
| 920 | + | |
| 921 | + /* Add system specific data to the random pool */ | |
| 922 | + setup_randomness(); | |
| 904 | 923 | } |
| 905 | 924 | |
| 906 | 925 | #ifdef CONFIG_32BIT |
| @@ -356,3 +356,6 @@ SYSCALL(sys_finit_module,sys_finit_module,compat_sys_finit_module) · 355 unmodified lines | ||
| 356 | 356 | SYSCALL(sys_sched_setattr,sys_sched_setattr,compat_sys_sched_setattr) /* 345 */ |
| 357 | 357 | SYSCALL(sys_sched_getattr,sys_sched_getattr,compat_sys_sched_getattr) |
| 358 | 358 | SYSCALL(sys_renameat2,sys_renameat2,compat_sys_renameat2) |
| 359 | +SYSCALL(sys_seccomp,sys_seccomp,compat_sys_seccomp) | |
| 360 | +SYSCALL(sys_getrandom,sys_getrandom,compat_sys_getrandom) | |
| 361 | +SYSCALL(sys_memfd_create,sys_memfd_create,compat_sys_memfd_create) /* 350 */ | |
| @@ -1317,19 +1317,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) · 1316 unmodified lines | ||
| 1317 | 1317 | return -EINVAL; |
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | − switch (kvm_run->exit_reason) { | |
| 1321 | − case KVM_EXIT_S390_SIEIC: | |
| 1322 | − case KVM_EXIT_UNKNOWN: | |
| 1323 | − case KVM_EXIT_INTR: | |
| 1324 | − case KVM_EXIT_S390_RESET: | |
| 1325 | − case KVM_EXIT_S390_UCONTROL: | |
| 1326 | − case KVM_EXIT_S390_TSCH: | |
| 1327 | − case KVM_EXIT_DEBUG: | |
| 1328 | − break; | |
| 1329 | − default: | |
| 1330 | − BUG(); | |
| 1331 | − } | |
| 1332 | − | |
| 1333 | 1320 | vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask; |
| 1334 | 1321 | vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr; |
| 1335 | 1322 | if (kvm_run->kvm_dirty_regs & KVM_SYNC_PREFIX) { |
| @@ -986,11 +986,21 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, · 985 unmodified lines | ||
| 986 | 986 | pte_t *ptep; |
| 987 | 987 | |
| 988 | 988 | down_read(&mm->mmap_sem); |
| 989 | +retry: | |
| 989 | 990 | ptep = get_locked_pte(current->mm, addr, &ptl); |
| 990 | 991 | if (unlikely(!ptep)) { |
| 991 | 992 | up_read(&mm->mmap_sem); |
| 992 | 993 | return -EFAULT; |
| 993 | 994 | } |
| 995 | + if (!(pte_val(*ptep) & _PAGE_INVALID) && | |
| 996 | + (pte_val(*ptep) & _PAGE_PROTECT)) { | |
| 997 | + pte_unmap_unlock(*ptep, ptl); | |
| 998 | + if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE)) { | |
| 999 | + up_read(&mm->mmap_sem); | |
| 1000 | + return -EFAULT; | |
| 1001 | + } | |
| 1002 | + goto retry; | |
| 1003 | + } | |
| 994 | 1004 | |
| 995 | 1005 | new = old = pgste_get_lock(ptep); |
| 996 | 1006 | pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT | |
| @@ -172,6 +172,7 @@ menu "System type" · 171 unmodified lines | ||
| 172 | 172 | # |
| 173 | 173 | config CPU_SH2 |
| 174 | 174 | bool |
| 175 | + select SH_INTC | |
| 175 | 176 | |
| 176 | 177 | config CPU_SH2A |
| 177 | 178 | bool |
| @@ -182,6 +183,7 @@ config CPU_SH3 · 4 unmodified lines | ||
| 182 | 183 | bool |
| 183 | 184 | select CPU_HAS_INTEVT |
| 184 | 185 | select CPU_HAS_SR_RB |
| 186 | + select SH_INTC | |
| 185 | 187 | select SYS_SUPPORTS_SH_TMU |
| 186 | 188 | |
| 187 | 189 | config CPU_SH4 |
| @@ -189,6 +191,7 @@ config CPU_SH4 · 1 unmodified line | ||
| 189 | 191 | select CPU_HAS_INTEVT |
| 190 | 192 | select CPU_HAS_SR_RB |
| 191 | 193 | select CPU_HAS_FPU if !CPU_SH4AL_DSP |
| 194 | + select SH_INTC | |
| 192 | 195 | select SYS_SUPPORTS_SH_TMU |
| 193 | 196 | select SYS_SUPPORTS_HUGETLBFS if MMU |
| 194 | 197 | |
| @@ -595,8 +598,6 @@ source kernel/Kconfig.hz · 400 unmodified lines | ||
| 595 | 598 | config KEXEC |
| 596 | 599 | bool "kexec system call (EXPERIMENTAL)" |
| 597 | 600 | depends on SUPERH32 && MMU |
| 598 | − select CRYPTO | |
| 599 | − select CRYPTO_SHA256 | |
| 600 | 601 | help |
| 601 | 602 | kexec is a system call that implements the ability to shutdown your |
| 602 | 603 | current kernel, and to start another kernel. It is like a reboot |
| @@ -229,6 +229,7 @@ void flush_icache_range(unsigned long start, unsigned long end) · 228 unmodified lines | ||
| 229 | 229 | |
| 230 | 230 | cacheop_on_each_cpu(local_flush_icache_range, (void *)&data, 1); |
| 231 | 231 | } |
| 232 | +EXPORT_SYMBOL(flush_icache_range); | |
| 232 | 233 | |
| 233 | 234 | void flush_icache_page(struct vm_area_struct *vma, struct page *page) |
| 234 | 235 | { |
| @@ -191,8 +191,6 @@ source "kernel/Kconfig.hz" · 190 unmodified lines | ||
| 191 | 191 | |
| 192 | 192 | config KEXEC |
| 193 | 193 | bool "kexec system call" |
| 194 | − select CRYPTO | |
| 195 | − select CRYPTO_SHA256 | |
| 196 | 194 | ---help--- |
| 197 | 195 | kexec is a system call that implements the ability to shutdown your |
| 198 | 196 | current kernel, and to start another kernel. It is like a reboot |
| @@ -183,6 +183,7 @@ void flush_icache_range(unsigned long start, unsigned long end) · 182 unmodified lines | ||
| 183 | 183 | preempt_enable(); |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | +EXPORT_SYMBOL(flush_icache_range); | |
| 186 | 187 | |
| 187 | 188 | |
| 188 | 189 | /* Called when smp_send_reschedule() triggers IRQ_RESCHEDULE. */ |
| @@ -254,7 +254,8 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set, · 253 unmodified lines | ||
| 254 | 254 | |
| 255 | 255 | err |= setup_sigframe(frame, regs, set); |
| 256 | 256 | if (err == 0) |
| 257 | − err |= setup_return(regs, &ksig->ka, frame->retcode, frame, usig); | |
| 257 | + err |= setup_return(regs, &ksig->ka, frame->retcode, frame, | |
| 258 | + ksig->sig); | |
| 258 | 259 | |
| 259 | 260 | return err; |
| 260 | 261 | } |
| @@ -276,7 +277,8 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, · 15 unmodified lines | ||
| 276 | 277 | err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp); |
| 277 | 278 | err |= setup_sigframe(&frame->sig, regs, set); |
| 278 | 279 | if (err == 0) |
| 279 | − err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame, usig); | |
| 280 | + err |= setup_return(regs, &ksig->ka, frame->sig.retcode, frame, | |
| 281 | + ksig->sig); | |
| 280 | 282 | |
| 281 | 283 | if (err == 0) { |
| 282 | 284 | /* |
| @@ -303,7 +305,6 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs, · 20 unmodified lines | ||
| 303 | 305 | int syscall) |
| 304 | 306 | { |
| 305 | 307 | struct thread_info *thread = current_thread_info(); |
| 306 | − struct task_struct *tsk = current; | |
| 307 | 308 | sigset_t *oldset = sigmask_to_save(); |
| 308 | 309 | int usig = ksig->sig; |
| 309 | 310 | int ret; |
| @@ -373,7 +374,7 @@ static void do_signal(struct pt_regs *regs, int syscall) · 63 unmodified lines | ||
| 373 | 374 | if (!user_mode(regs)) |
| 374 | 375 | return; |
| 375 | 376 | |
| 376 | − if (get_signsl(&ksig)) { | |
| 377 | + if (get_signal(&ksig)) { | |
| 377 | 378 | handle_signal(&ksig, regs, syscall); |
| 378 | 379 | return; |
| 379 | 380 | } |
| @@ -17,6 +17,4 @@ obj-$(CONFIG_IA32_EMULATION) += ia32/ · 16 unmodified lines | ||
| 17 | 17 | obj-y += platform/ |
| 18 | 18 | obj-y += net/ |
| 19 | 19 | |
| 20 | −ifeq ($(CONFIG_X86_64),y) | |
| 21 | −obj-$(CONFIG_KEXEC) += purgatory/ | |
| 22 | −endif | |
| 20 | +obj-$(CONFIG_KEXEC_FILE) += purgatory/ | |
| @@ -1585,9 +1585,6 @@ source kernel/Kconfig.hz · 1584 unmodified lines | ||
| 1585 | 1585 | |
| 1586 | 1586 | config KEXEC |
| 1587 | 1587 | bool "kexec system call" |
| 1588 | − select BUILD_BIN2C | |
| 1589 | − select CRYPTO | |
| 1590 | − select CRYPTO_SHA256 | |
| 1591 | 1588 | ---help--- |
| 1592 | 1589 | kexec is a system call that implements the ability to shutdown your |
| 1593 | 1590 | current kernel, and to start another kernel. It is like a reboot |
| @@ -1602,9 +1599,22 @@ config KEXEC · 8 unmodified lines | ||
| 1602 | 1599 | interface is strongly in flux, so no good recommendation can be |
| 1603 | 1600 | made. |
| 1604 | 1601 | |
| 1602 | +config KEXEC_FILE | |
| 1603 | + bool "kexec file based system call" | |
| 1604 | + select BUILD_BIN2C | |
| 1605 | + depends on KEXEC | |
| 1606 | + depends on X86_64 | |
| 1607 | + depends on CRYPTO=y | |
| 1608 | + depends on CRYPTO_SHA256=y | |
| 1609 | + ---help--- | |
| 1610 | + This is new version of kexec system call. This system call is | |
| 1611 | + file based and takes file descriptors as system call argument | |
| 1612 | + for kernel and initramfs as opposed to list of segments as | |
| 1613 | + accepted by previous system call. | |
| 1614 | + | |
| 1605 | 1615 | config KEXEC_VERIFY_SIG |
| 1606 | 1616 | bool "Verify kernel signature during kexec_file_load() syscall" |
| 1607 | − depends on KEXEC | |
| 1617 | + depends on KEXEC_FILE | |
| 1608 | 1618 | ---help--- |
| 1609 | 1619 | This option makes kernel signature verification mandatory for |
| 1610 | 1620 | kexec_file_load() syscall. If kernel is signature can not be |
| @@ -184,11 +184,8 @@ archheaders: · 183 unmodified lines | ||
| 184 | 184 | $(Q)$(MAKE) $(build)=arch/x86/syscalls all |
| 185 | 185 | |
| 186 | 186 | archprepare: |
| 187 | −ifeq ($(CONFIG_KEXEC),y) | |
| 188 | −# Build only for 64bit. No loaders for 32bit yet. | |
| 189 | − ifeq ($(CONFIG_X86_64),y) | |
| 187 | +ifeq ($(CONFIG_KEXEC_FILE),y) | |
| 190 | 188 | $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c |
| 191 | − endif | |
| 192 | 189 | endif |
| 193 | 190 | |
| 194 | 191 | ### |
| @@ -254,6 +251,7 @@ archclean: · 59 unmodified lines | ||
| 254 | 251 | $(Q)rm -rf $(objtree)/arch/x86_64 |
| 255 | 252 | $(Q)$(MAKE) $(clean)=$(boot) |
| 256 | 253 | $(Q)$(MAKE) $(clean)=arch/x86/tools |
| 254 | + $(Q)$(MAKE) $(clean)=arch/x86/purgatory | |
| 257 | 255 | |
| 258 | 256 | PHONY += kvmconfig |
| 259 | 257 | kvmconfig: |
| @@ -227,6 +227,8 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned · 226 unmodified lines | ||
| 227 | 227 | |
| 228 | 228 | extern void io_apic_eoi(unsigned int apic, unsigned int vector); |
| 229 | 229 | |
| 230 | +extern bool mp_should_keep_irq(struct device *dev); | |
| 231 | + | |
| 230 | 232 | #else /* !CONFIG_X86_IO_APIC */ |
| 231 | 233 | |
| 232 | 234 | #define io_apic_assign_pci_irqs 0 |
| @@ -131,8 +131,13 @@ static inline int pte_exec(pte_t pte) · 130 unmodified lines | ||
| 131 | 131 | |
| 132 | 132 | static inline int pte_special(pte_t pte) |
| 133 | 133 | { |
| 134 | − return (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_SPECIAL)) == | |
| 135 | − (_PAGE_PRESENT|_PAGE_SPECIAL); | |
| 134 | + /* | |
| 135 | + * See CONFIG_NUMA_BALANCING pte_numa in include/asm-generic/pgtable.h. | |
| 136 | + * On x86 we have _PAGE_BIT_NUMA == _PAGE_BIT_GLOBAL+1 == | |
| 137 | + * __PAGE_BIT_SOFTW1 == _PAGE_BIT_SPECIAL. | |
| 138 | + */ | |
| 139 | + return (pte_flags(pte) & _PAGE_SPECIAL) && | |
| 140 | + (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_PROTNONE)); | |
| 136 | 141 | } |
| 137 | 142 | |
| 138 | 143 | static inline unsigned long pte_pfn(pte_t pte) |
| @@ -71,6 +71,7 @@ obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o · 70 unmodified lines | ||
| 71 | 71 | obj-$(CONFIG_X86_TSC) += trace_clock.o |
| 72 | 72 | obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o |
| 73 | 73 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o |
| 74 | +obj-$(CONFIG_KEXEC_FILE) += kexec-bzimage64.o | |
| 74 | 75 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o |
| 75 | 76 | obj-y += kprobes/ |
| 76 | 77 | obj-$(CONFIG_MODULES) += module.o |
| @@ -118,5 +119,4 @@ ifeq ($(CONFIG_X86_64),y) · 41 unmodified lines | ||
| 118 | 119 | |
| 119 | 120 | obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o |
| 120 | 121 | obj-y += vsmp_64.o |
| 121 | − obj-$(CONFIG_KEXEC) += kexec-bzimage64.o | |
| 122 | 122 | endif |
| @@ -1070,6 +1070,11 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, · 1069 unmodified lines | ||
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | if (flags & IOAPIC_MAP_ALLOC) { |
| 1073 | + /* special handling for legacy IRQs */ | |
| 1074 | + if (irq < nr_legacy_irqs() && info->count == 1 && | |
| 1075 | + mp_irqdomain_map(domain, irq, pin) != 0) | |
| 1076 | + irq = -1; | |
| 1077 | + | |
| 1073 | 1078 | if (irq > 0) |
| 1074 | 1079 | info->count++; |
| 1075 | 1080 | else if (info->count == 0) |
| @@ -3896,7 +3901,15 @@ int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, · 2820 unmodified lines | ||
| 3896 | 3901 | info->polarity = 1; |
| 3897 | 3902 | } |
| 3898 | 3903 | info->node = NUMA_NO_NODE; |
| 3899 | − info->set = 1; | |
| 3904 | + | |
| 3905 | + /* | |
| 3906 | + * setup_IO_APIC_irqs() programs all legacy IRQs with default | |
| 3907 | + * trigger and polarity attributes. Don't set the flag for that | |
| 3908 | + * case so the first legacy IRQ user could reprogram the pin | |
| 3909 | + * with real trigger and polarity attributes. | |
| 3910 | + */ | |
| 3911 | + if (virq >= nr_legacy_irqs() || info->count) | |
| 3912 | + info->set = 1; | |
| 3900 | 3913 | } |
| 3901 | 3914 | set_io_apic_irq_attr(&attr, ioapic, hwirq, info->trigger, |
| 3902 | 3915 | info->polarity); |
| @@ -3946,6 +3959,18 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node) · 43 unmodified lines | ||
| 3946 | 3959 | return ret; |
| 3947 | 3960 | } |
| 3948 | 3961 | |
| 3962 | +bool mp_should_keep_irq(struct device *dev) | |
| 3963 | +{ | |
| 3964 | + if (dev->power.is_prepared) | |
| 3965 | + return true; | |
| 3966 | +#ifdef CONFIG_PM_RUNTIME | |
| 3967 | + if (dev->power.runtime_status == RPM_SUSPENDING) | |
| 3968 | + return true; | |
| 3969 | +#endif | |
| 3970 | + | |
| 3971 | + return false; | |
| 3972 | +} | |
| 3973 | + | |
| 3949 | 3974 | /* Enable IOAPIC early just for system timer */ |
| 3950 | 3975 | void __init pre_init_apic_IRQ0(void) |
| 3951 | 3976 | { |
| @@ -182,8 +182,7 @@ void native_machine_crash_shutdown(struct pt_regs *regs) · 181 unmodified lines | ||
| 182 | 182 | crash_save_cpu(regs, safe_smp_processor_id()); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | −#ifdef CONFIG_X86_64 | |
| 186 | − | |
| 185 | +#ifdef CONFIG_KEXEC_FILE | |
| 187 | 186 | static int get_nr_ram_ranges_callback(unsigned long start_pfn, |
| 188 | 187 | unsigned long nr_pfn, void *arg) |
| 189 | 188 | { |
| @@ -696,5 +695,4 @@ int crash_load_segments(struct kimage *image) · 506 unmodified lines | ||
| 696 | 695 | |
| 697 | 696 | return ret; |
| 698 | 697 | } |
| 699 | − | |
| 700 | −#endif /* CONFIG_X86_64 */ | |
| 698 | +#endif /* CONFIG_KEXEC_FILE */ | |
| @@ -683,7 +683,7 @@ END(syscall_badsys) · 682 unmodified lines | ||
| 683 | 683 | sysenter_badsys: |
| 684 | 684 | movl $-ENOSYS,%eax |
| 685 | 685 | jmp sysenter_after_call |
| 686 | −END(syscall_badsys) | |
| 686 | +END(sysenter_badsys) | |
| 687 | 687 | CFI_ENDPROC |
| 688 | 688 | |
| 689 | 689 | .macro FIXUP_ESPFIX_STACK |
| @@ -203,7 +203,7 @@ void __init native_init_IRQ(void) · 202 unmodified lines | ||
| 203 | 203 | set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | − if (!acpi_ioapic && !of_ioapic) | |
| 206 | + if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) | |
| 207 | 207 | setup_irq(2, &irq2); |
| 208 | 208 | |
| 209 | 209 | #ifdef CONFIG_X86_32 |
| @@ -25,9 +25,11 @@ · 24 unmodified lines | ||
| 25 | 25 | #include <asm/debugreg.h> |
| 26 | 26 | #include <asm/kexec-bzimage64.h> |
| 27 | 27 | |
| 28 | +#ifdef CONFIG_KEXEC_FILE | |
| 28 | 29 | static struct kexec_file_ops *kexec_file_loaders[] = { |
| 29 | 30 | &kexec_bzImage64_ops, |
| 30 | 31 | }; |
| 32 | +#endif | |
| 31 | 33 | |
| 32 | 34 | static void free_transition_pgtable(struct kimage *image) |
| 33 | 35 | { |
| @@ -178,6 +180,7 @@ static void load_segments(void) · 144 unmodified lines | ||
| 178 | 180 | ); |
| 179 | 181 | } |
| 180 | 182 | |
| 183 | +#ifdef CONFIG_KEXEC_FILE | |
| 181 | 184 | /* Update purgatory as needed after various image segments have been prepared */ |
| 182 | 185 | static int arch_update_purgatory(struct kimage *image) |
| 183 | 186 | { |
| @@ -209,6 +212,12 @@ static int arch_update_purgatory(struct kimage *image) · 25 unmodified lines | ||
| 209 | 212 | |
| 210 | 213 | return ret; |
| 211 | 214 | } |
| 215 | +#else /* !CONFIG_KEXEC_FILE */ | |
| 216 | +static inline int arch_update_purgatory(struct kimage *image) | |
| 217 | +{ | |
| 218 | + return 0; | |
| 219 | +} | |
| 220 | +#endif /* CONFIG_KEXEC_FILE */ | |
| 212 | 221 | |
| 213 | 222 | int machine_kexec_prepare(struct kimage *image) |
| 214 | 223 | { |
| @@ -329,6 +338,7 @@ void arch_crash_save_vmcoreinfo(void) · 114 unmodified lines | ||
| 329 | 338 | |
| 330 | 339 | /* arch-dependent functionality related to kexec file-based syscall */ |
| 331 | 340 | |
| 341 | +#ifdef CONFIG_KEXEC_FILE | |
| 332 | 342 | int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, |
| 333 | 343 | unsigned long buf_len) |
| 334 | 344 | { |
| @@ -522,3 +532,4 @@ overflow: · 187 unmodified lines | ||
| 522 | 532 | (int)ELF64_R_TYPE(rel[i].r_info), value); |
| 523 | 533 | return -ENOEXEC; |
| 524 | 534 | } |
| 535 | +#endif /* CONFIG_KEXEC_FILE */ | |
| @@ -68,6 +68,8 @@ static struct irqaction irq0 = { · 67 unmodified lines | ||
| 68 | 68 | |
| 69 | 69 | void __init setup_default_timer_irq(void) |
| 70 | 70 | { |
| 71 | + if (!nr_legacy_irqs()) | |
| 72 | + return; | |
| 71 | 73 | setup_irq(0, &irq0); |
| 72 | 74 | } |
| 73 | 75 | |
| @@ -49,7 +49,13 @@ void leave_mm(int cpu) · 48 unmodified lines | ||
| 49 | 49 | if (cpumask_test_cpu(cpu, mm_cpumask(active_mm))) { |
| 50 | 50 | cpumask_clear_cpu(cpu, mm_cpumask(active_mm)); |
| 51 | 51 | load_cr3(swapper_pg_dir); |
| 52 | − trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL); | |
| 52 | + /* | |
| 53 | + * This gets called in the idle path where RCU | |
| 54 | + * functions differently. Tracing normally | |
| 55 | + * uses RCU, so we have to call the tracepoint | |
| 56 | + * specially here. | |
| 57 | + */ | |
| 58 | + trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL); | |
| 53 | 59 | } |
| 54 | 60 | } |
| 55 | 61 | EXPORT_SYMBOL_GPL(leave_mm); |
| @@ -174,7 +180,7 @@ void flush_tlb_current_task(void) · 118 unmodified lines | ||
| 174 | 180 | * |
| 175 | 181 | * This is in units of pages. |
| 176 | 182 | */ |
| 177 | −unsigned long tlb_single_page_flush_ceiling = 33; | |
| 183 | +static unsigned long tlb_single_page_flush_ceiling __read_mostly = 33; | |
| 178 | 184 | |
| 179 | 185 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, |
| 180 | 186 | unsigned long end, unsigned long vmflag) |
| @@ -229,7 +229,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev) · 228 unmodified lines | ||
| 229 | 229 | |
| 230 | 230 | static void intel_mid_pci_irq_disable(struct pci_dev *dev) |
| 231 | 231 | { |
| 232 | − if (!dev->dev.power.is_prepared && dev->irq > 0) | |
| 232 | + if (!mp_should_keep_irq(&dev->dev) && dev->irq > 0) | |
| 233 | 233 | mp_unmap_irq(dev->irq); |
| 234 | 234 | } |
| 235 | 235 | |
| @@ -1256,7 +1256,7 @@ static int pirq_enable_irq(struct pci_dev *dev) · 1255 unmodified lines | ||
| 1256 | 1256 | |
| 1257 | 1257 | static void pirq_disable_irq(struct pci_dev *dev) |
| 1258 | 1258 | { |
| 1259 | − if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared && | |
| 1259 | + if (io_apic_assign_pci_irqs && !mp_should_keep_irq(&dev->dev) && | |
| 1260 | 1260 | dev->irq) { |
| 1261 | 1261 | mp_unmap_irq(dev->irq); |
| 1262 | 1262 | dev->irq = 0; |
| @@ -11,6 +11,7 @@ targets += purgatory.ro · 10 unmodified lines | ||
| 11 | 11 | # sure how to relocate those. Like kexec-tools, use custom flags. |
| 12 | 12 | |
| 13 | 13 | KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large |
| 14 | +KBUILD_CFLAGS += -m$(BITS) | |
| 14 | 15 | |
| 15 | 16 | $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE |
| 16 | 17 | $(call if_changed,ld) |
| @@ -24,7 +25,4 @@ $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE · 7 unmodified lines | ||
| 24 | 25 | $(call if_changed,bin2c) |
| 25 | 26 | |
| 26 | 27 | |
| 27 | −# No loaders for 32bits yet. | |
| 28 | −ifeq ($(CONFIG_X86_64),y) | |
| 29 | − obj-$(CONFIG_KEXEC) += kexec-purgatory.o | |
| 30 | −endif | |
| 28 | +obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o | |
| @@ -4,24 +4,23 @@ config ZONE_DMA · 3 unmodified lines | ||
| 4 | 4 | config XTENSA |
| 5 | 5 | def_bool y |
| 6 | 6 | select ARCH_WANT_FRAME_POINTERS |
| 7 | − select HAVE_IDE | |
| 8 | − select GENERIC_ATOMIC64 | |
| 9 | − select GENERIC_CLOCKEVENTS | |
| 10 | − select VIRT_TO_BUS | |
| 11 | − select GENERIC_IRQ_SHOW | |
| 12 | − select GENERIC_SCHED_CLOCK | |
| 13 | − select MODULES_USE_ELF_RELA | |
| 14 | − select GENERIC_PCI_IOMAP | |
| 15 | 7 | select ARCH_WANT_IPC_PARSE_VERSION |
| 16 | 8 | select ARCH_WANT_OPTIONAL_GPIOLIB |
| 17 | 9 | select BUILDTIME_EXTABLE_SORT |
| 18 | 10 | select CLONE_BACKWARDS |
| 19 | − select IRQ_DOMAIN | |
| 20 | − select HAVE_OPROFILE | |
| 11 | + select COMMON_CLK | |
| 12 | + select GENERIC_ATOMIC64 | |
| 13 | + select GENERIC_CLOCKEVENTS | |
| 14 | + select GENERIC_IRQ_SHOW | |
| 15 | + select GENERIC_PCI_IOMAP | |
| 16 | + select GENERIC_SCHED_CLOCK | |
| 21 | 17 | select HAVE_FUNCTION_TRACER |
| 22 | 18 | select HAVE_IRQ_TIME_ACCOUNTING |
| 19 | + select HAVE_OPROFILE | |
| 23 | 20 | select HAVE_PERF_EVENTS |
| 24 | − select COMMON_CLK | |
| 21 | + select IRQ_DOMAIN | |
| 22 | + select MODULES_USE_ELF_RELA | |
| 23 | + select VIRT_TO_BUS | |
| 25 | 24 | help |
| 26 | 25 | Xtensa processors are 32-bit RISC machines designed by Tensilica |
| 27 | 26 | primarily for embedded systems. These processors are both |
| @@ -62,7 +61,9 @@ config TRACE_IRQFLAGS_SUPPORT · 34 unmodified lines | ||
| 62 | 61 | def_bool y |
| 63 | 62 | |
| 64 | 63 | config MMU |
| 65 | − def_bool n | |
| 64 | + bool | |
| 65 | + default n if !XTENSA_VARIANT_CUSTOM | |
| 66 | + default XTENSA_VARIANT_MMU if XTENSA_VARIANT_CUSTOM | |
| 66 | 67 | |
| 67 | 68 | config VARIANT_IRQ_SWITCH |
| 68 | 69 | def_bool n |
| @@ -102,8 +103,40 @@ config XTENSA_VARIANT_S6000 · 33 unmodified lines | ||
| 102 | 103 | select VARIANT_IRQ_SWITCH |
| 103 | 104 | select ARCH_REQUIRE_GPIOLIB |
| 104 | 105 | select XTENSA_CALIBRATE_CCOUNT |
| 106 | + | |
| 107 | +config XTENSA_VARIANT_CUSTOM | |
| 108 | + bool "Custom Xtensa processor configuration" | |
| 109 | + select MAY_HAVE_SMP | |
| 110 | + select HAVE_XTENSA_GPIO32 | |
| 111 | + help | |
| 112 | + Select this variant to use a custom Xtensa processor configuration. | |
| 113 | + You will be prompted for a processor variant CORENAME. | |
| 105 | 114 | endchoice |
| 106 | 115 | |
| 116 | +config XTENSA_VARIANT_CUSTOM_NAME | |
| 117 | + string "Xtensa Processor Custom Core Variant Name" | |
| 118 | + depends on XTENSA_VARIANT_CUSTOM | |
| 119 | + help | |
| 120 | + Provide the name of a custom Xtensa processor variant. | |
| 121 | + This CORENAME selects arch/xtensa/variant/CORENAME. | |
| 122 | + Dont forget you have to select MMU if you have one. | |
| 123 | + | |
| 124 | +config XTENSA_VARIANT_NAME | |
| 125 | + string | |
| 126 | + default "dc232b" if XTENSA_VARIANT_DC232B | |
| 127 | + default "dc233c" if XTENSA_VARIANT_DC233C | |
| 128 | + default "fsf" if XTENSA_VARIANT_FSF | |
| 129 | + default "s6000" if XTENSA_VARIANT_S6000 | |
| 130 | + default XTENSA_VARIANT_CUSTOM_NAME if XTENSA_VARIANT_CUSTOM | |
| 131 | + | |
| 132 | +config XTENSA_VARIANT_MMU | |
| 133 | + bool "Core variant has a Full MMU (TLB, Pages, Protection, etc)" | |
| 134 | + depends on XTENSA_VARIANT_CUSTOM | |
| 135 | + default y | |
| 136 | + help | |
| 137 | + Build a Conventional Kernel with full MMU support, | |
| 138 | + ie: it supports a TLB with auto-loading, page protection. | |
| 139 | + | |
| 107 | 140 | config XTENSA_UNALIGNED_USER |
| 108 | 141 | bool "Unaligned memory access in use space" |
| 109 | 142 | help |
| @@ -156,13 +189,9 @@ config HOTPLUG_CPU · 46 unmodified lines | ||
| 156 | 189 | |
| 157 | 190 | Say N if you want to disable CPU hotplug. |
| 158 | 191 | |
| 159 | −config MATH_EMULATION | |
| 160 | − bool "Math emulation" | |
| 161 | − help | |
| 162 | − Can we use information of configuration file? | |
| 163 | − | |
| 164 | 192 | config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX |
| 165 | 193 | bool "Initialize Xtensa MMU inside the Linux kernel code" |
| 194 | + depends on MMU | |
| 166 | 195 | default y |
| 167 | 196 | help |
| 168 | 197 | Earlier version initialized the MMU in the exception vector |
| @@ -192,6 +221,7 @@ config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX · 23 unmodified lines | ||
| 192 | 221 | |
| 193 | 222 | config HIGHMEM |
| 194 | 223 | bool "High Memory Support" |
| 224 | + depends on MMU | |
| 195 | 225 | help |
| 196 | 226 | Linux can use the full amount of RAM in the system by |
| 197 | 227 | default. However, the default MMUv2 setup only maps the |
| @@ -208,6 +238,32 @@ config HIGHMEM · 10 unmodified lines | ||
| 208 | 238 | |
| 209 | 239 | If unsure, say Y. |
| 210 | 240 | |
| 241 | +config FAST_SYSCALL_XTENSA | |
| 242 | + bool "Enable fast atomic syscalls" | |
| 243 | + default n | |
| 244 | + help | |
| 245 | + fast_syscall_xtensa is a syscall that can make atomic operations | |
| 246 | + on UP kernel when processor has no s32c1i support. | |
| 247 | + | |
| 248 | + This syscall is deprecated. It may have issues when called with | |
| 249 | + invalid arguments. It is provided only for backwards compatibility. | |
| 250 | + Only enable it if your userspace software requires it. | |
| 251 | + | |
| 252 | + If unsure, say N. | |
| 253 | + | |
| 254 | +config FAST_SYSCALL_SPILL_REGISTERS | |
| 255 | + bool "Enable spill registers syscall" | |
| 256 | + default n | |
| 257 | + help | |
| 258 | + fast_syscall_spill_registers is a syscall that spills all active | |
| 259 | + register windows of a calling userspace task onto its stack. | |
| 260 | + | |
| 261 | + This syscall is deprecated. It may have issues when called with | |
| 262 | + invalid arguments. It is provided only for backwards compatibility. | |
| 263 | + Only enable it if your userspace software requires it. | |
| 264 | + | |
| 265 | + If unsure, say N. | |
| 266 | + | |
| 211 | 267 | endmenu |
| 212 | 268 | |
| 213 | 269 | config XTENSA_CALIBRATE_CCOUNT |
| @@ -250,12 +306,14 @@ config XTENSA_PLATFORM_ISS · 36 unmodified lines | ||
| 250 | 306 | |
| 251 | 307 | config XTENSA_PLATFORM_XT2000 |
| 252 | 308 | bool "XT2000" |
| 309 | + select HAVE_IDE | |
| 253 | 310 | help |
| 254 | 311 | XT2000 is the name of Tensilica's feature-rich emulation platform. |
| 255 | 312 | This hardware is capable of running a full Linux distribution. |
| 256 | 313 | |
| 257 | 314 | config XTENSA_PLATFORM_S6105 |
| 258 | 315 | bool "S6105" |
| 316 | + select HAVE_IDE | |
| 259 | 317 | select SERIAL_CONSOLE |
| 260 | 318 | select NO_IOPORT_MAP |
| 261 | 319 | |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | # for more details. |
| 5 | 5 | # |
| 6 | 6 | # Copyright (C) 2001 - 2005 Tensilica Inc. |
| 7 | +# Copyright (C) 2014 Cadence Design Systems Inc. | |
| 7 | 8 | # |
| 8 | 9 | # This file is included by the global makefile so that you can add your own |
| 9 | 10 | # architecture-specific flags and dependencies. Remember to do have actions |
| @@ -13,11 +14,7 @@ · 3 unmodified lines | ||
| 13 | 14 | # Core configuration. |
| 14 | 15 | # (Use VAR=<xtensa_config> to use another default compiler.) |
| 15 | 16 | |
| 16 | −variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf | |
| 17 | −variant-$(CONFIG_XTENSA_VARIANT_DC232B) := dc232b | |
| 18 | −variant-$(CONFIG_XTENSA_VARIANT_DC233C) := dc233c | |
| 19 | −variant-$(CONFIG_XTENSA_VARIANT_S6000) := s6000 | |
| 20 | −variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom | |
| 17 | +variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME)) | |
| 21 | 18 | |
| 22 | 19 | VARIANT = $(variant-y) |
| 23 | 20 | export VARIANT |
| @@ -4,8 +4,11 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | / { |
| 6 | 6 | compatible = "cdns,xtensa-kc705"; |
| 7 | + chosen { | |
| 8 | + bootargs = "earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000"; | |
| 9 | + }; | |
| 7 | 10 | memory@0 { |
| 8 | 11 | device_type = "memory"; |
| 9 | − reg = <0x00000000 0x08000000>; | |
| 12 | + reg = <0x00000000 0x38000000>; | |
| 10 | 13 | }; |
| 11 | 14 | }; |
| @@ -66,7 +66,6 @@ CONFIG_XTENSA_ARCH_LINUX_BE=y · 65 unmodified lines | ||
| 66 | 66 | CONFIG_MMU=y |
| 67 | 67 | # CONFIG_XTENSA_UNALIGNED_USER is not set |
| 68 | 68 | # CONFIG_PREEMPT is not set |
| 69 | −# CONFIG_MATH_EMULATION is not set | |
| 70 | 69 | # CONFIG_HIGHMEM is not set |
| 71 | 70 | |
| 72 | 71 | # |
| @@ -146,7 +146,6 @@ CONFIG_XTENSA_VARIANT_FSF=y · 145 unmodified lines | ||
| 146 | 146 | # CONFIG_XTENSA_VARIANT_S6000 is not set |
| 147 | 147 | # CONFIG_XTENSA_UNALIGNED_USER is not set |
| 148 | 148 | # CONFIG_PREEMPT is not set |
| 149 | −# CONFIG_MATH_EMULATION is not set | |
| 150 | 149 | CONFIG_XTENSA_CALIBRATE_CCOUNT=y |
| 151 | 150 | CONFIG_SERIAL_CONSOLE=y |
| 152 | 151 | CONFIG_XTENSA_ISS_NETWORK=y |
| @@ -308,7 +307,7 @@ CONFIG_MISC_DEVICES=y · 155 unmodified lines | ||
| 308 | 307 | # EEPROM support |
| 309 | 308 | # |
| 310 | 309 | # CONFIG_EEPROM_93CX6 is not set |
| 311 | −CONFIG_HAVE_IDE=y | |
| 310 | +# CONFIG_HAVE_IDE is not set | |
| 312 | 311 | # CONFIG_IDE is not set |
| 313 | 312 | |
| 314 | 313 | # |
| @@ -109,7 +109,6 @@ CONFIG_VARIANT_IRQ_SWITCH=y · 108 unmodified lines | ||
| 109 | 109 | CONFIG_XTENSA_VARIANT_S6000=y |
| 110 | 110 | # CONFIG_XTENSA_UNALIGNED_USER is not set |
| 111 | 111 | CONFIG_PREEMPT=y |
| 112 | −# CONFIG_MATH_EMULATION is not set | |
| 113 | 112 | # CONFIG_HIGHMEM is not set |
| 114 | 113 | CONFIG_XTENSA_CALIBRATE_CCOUNT=y |
| 115 | 114 | CONFIG_SERIAL_CONSOLE=y |
| @@ -37,6 +37,7 @@ · 36 unmodified lines | ||
| 37 | 37 | * specials for cache aliasing: |
| 38 | 38 | * |
| 39 | 39 | * __flush_invalidate_dcache_page_alias(vaddr,paddr) |
| 40 | + * __invalidate_dcache_page_alias(vaddr,paddr) | |
| 40 | 41 | * __invalidate_icache_page_alias(vaddr,paddr) |
| 41 | 42 | */ |
| 42 | 43 | |
| @@ -62,6 +63,7 @@ extern void __flush_invalidate_dcache_range(unsigned long, unsigned long); · 19 unmodified lines | ||
| 62 | 63 | |
| 63 | 64 | #if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE) |
| 64 | 65 | extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long); |
| 66 | +extern void __invalidate_dcache_page_alias(unsigned long, unsigned long); | |
| 65 | 67 | #else |
| 66 | 68 | static inline void __flush_invalidate_dcache_page_alias(unsigned long virt, |
| 67 | 69 | unsigned long phys) { } |
| @@ -23,8 +23,8 @@ · 22 unmodified lines | ||
| 23 | 23 | * Here we define all the compile-time 'special' virtual |
| 24 | 24 | * addresses. The point is to have a constant address at |
| 25 | 25 | * compile time, but to set the physical address only |
| 26 | − * in the boot process. We allocate these special addresses | |
| 27 | − * from the end of the consistent memory region backwards. | |
| 26 | + * in the boot process. We allocate these special addresses | |
| 27 | + * from the start of the consistent memory region upwards. | |
| 28 | 28 | * Also this lets us do fail-safe vmalloc(), we |
| 29 | 29 | * can guarantee that these special addresses and |
| 30 | 30 | * vmalloc()-ed addresses never overlap. |
| @@ -38,7 +38,8 @@ enum fixed_addresses { · 7 unmodified lines | ||
| 38 | 38 | #ifdef CONFIG_HIGHMEM |
| 39 | 39 | /* reserved pte's for temporary kernel mappings */ |
| 40 | 40 | FIX_KMAP_BEGIN, |
| 41 | − FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1, | |
| 41 | + FIX_KMAP_END = FIX_KMAP_BEGIN + | |
| 42 | + (KM_TYPE_NR * NR_CPUS * DCACHE_N_COLORS) - 1, | |
| 42 | 43 | #endif |
| 43 | 44 | __end_of_fixed_addresses |
| 44 | 45 | }; |
| @@ -47,7 +48,28 @@ enum fixed_addresses { · 2 unmodified lines | ||
| 47 | 48 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
| 48 | 49 | #define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK) |
| 49 | 50 | |
| 50 | −#include <asm-generic/fixmap.h> | |
| 51 | +#define __fix_to_virt(x) (FIXADDR_START + ((x) << PAGE_SHIFT)) | |
| 52 | +#define __virt_to_fix(x) (((x) - FIXADDR_START) >> PAGE_SHIFT) | |
| 53 | + | |
| 54 | +#ifndef __ASSEMBLY__ | |
| 55 | +/* | |
| 56 | + * 'index to address' translation. If anyone tries to use the idx | |
| 57 | + * directly without translation, we catch the bug with a NULL-deference | |
| 58 | + * kernel oops. Illegal ranges of incoming indices are caught too. | |
| 59 | + */ | |
| 60 | +static __always_inline unsigned long fix_to_virt(const unsigned int idx) | |
| 61 | +{ | |
| 62 | + BUILD_BUG_ON(idx >= __end_of_fixed_addresses); | |
| 63 | + return __fix_to_virt(idx); | |
| 64 | +} | |
| 65 | + | |
| 66 | +static inline unsigned long virt_to_fix(const unsigned long vaddr) | |
| 67 | +{ | |
| 68 | + BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | |
| 69 | + return __virt_to_fix(vaddr); | |
| 70 | +} | |
| 71 | + | |
| 72 | +#endif | |
| 51 | 73 | |
| 52 | 74 | #define kmap_get_fixmap_pte(vaddr) \ |
| 53 | 75 | pte_offset_kernel( \ |
| @@ -12,19 +12,55 @@ · 11 unmodified lines | ||
| 12 | 12 | #ifndef _XTENSA_HIGHMEM_H |
| 13 | 13 | #define _XTENSA_HIGHMEM_H |
| 14 | 14 | |
| 15 | +#include <linux/wait.h> | |
| 15 | 16 | #include <asm/cacheflush.h> |
| 16 | 17 | #include <asm/fixmap.h> |
| 17 | 18 | #include <asm/kmap_types.h> |
| 18 | 19 | #include <asm/pgtable.h> |
| 19 | 20 | |
| 20 | −#define PKMAP_BASE (FIXADDR_START - PMD_SIZE) | |
| 21 | −#define LAST_PKMAP PTRS_PER_PTE | |
| 21 | +#define PKMAP_BASE ((FIXADDR_START - \ | |
| 22 | + (LAST_PKMAP + 1) * PAGE_SIZE) & PMD_MASK) | |
| 23 | +#define LAST_PKMAP (PTRS_PER_PTE * DCACHE_N_COLORS) | |
| 22 | 24 | #define LAST_PKMAP_MASK (LAST_PKMAP - 1) |
| 23 | 25 | #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT) |
| 24 | 26 | #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) |
| 25 | 27 | |
| 26 | 28 | #define kmap_prot PAGE_KERNEL |
| 27 | 29 | |
| 30 | +#if DCACHE_WAY_SIZE > PAGE_SIZE | |
| 31 | +#define get_pkmap_color get_pkmap_color | |
| 32 | +static inline int get_pkmap_color(struct page *page) | |
| 33 | +{ | |
| 34 | + return DCACHE_ALIAS(page_to_phys(page)); | |
| 35 | +} | |
| 36 | + | |
| 37 | +extern unsigned int last_pkmap_nr_arr[]; | |
| 38 | + | |
| 39 | +static inline unsigned int get_next_pkmap_nr(unsigned int color) | |
| 40 | +{ | |
| 41 | + last_pkmap_nr_arr[color] = | |
| 42 | + (last_pkmap_nr_arr[color] + DCACHE_N_COLORS) & LAST_PKMAP_MASK; | |
| 43 | + return last_pkmap_nr_arr[color] + color; | |
| 44 | +} | |
| 45 | + | |
| 46 | +static inline int no_more_pkmaps(unsigned int pkmap_nr, unsigned int color) | |
| 47 | +{ | |
| 48 | + return pkmap_nr < DCACHE_N_COLORS; | |
| 49 | +} | |
| 50 | + | |
| 51 | +static inline int get_pkmap_entries_count(unsigned int color) | |
| 52 | +{ | |
| 53 | + return LAST_PKMAP / DCACHE_N_COLORS; | |
| 54 | +} | |
| 55 | + | |
| 56 | +extern wait_queue_head_t pkmap_map_wait_arr[]; | |
| 57 | + | |
| 58 | +static inline wait_queue_head_t *get_pkmap_wait_queue_head(unsigned int color) | |
| 59 | +{ | |
| 60 | + return pkmap_map_wait_arr + color; | |
| 61 | +} | |
| 62 | +#endif | |
| 63 | + | |
| 28 | 64 | extern pte_t *pkmap_page_table; |
| 29 | 65 | |
| 30 | 66 | void *kmap_high(struct page *page); |
| @@ -78,7 +78,9 @@ · 77 unmodified lines | ||
| 78 | 78 | # define DCACHE_ALIAS_EQ(a,b) ((((a) ^ (b)) & DCACHE_ALIAS_MASK) == 0) |
| 79 | 79 | #else |
| 80 | 80 | # define DCACHE_ALIAS_ORDER 0 |
| 81 | +# define DCACHE_ALIAS(a) ((void)(a), 0) | |
| 81 | 82 | #endif |
| 83 | +#define DCACHE_N_COLORS (1 << DCACHE_ALIAS_ORDER) | |
| 82 | 84 | |
| 83 | 85 | #if ICACHE_WAY_SIZE > PAGE_SIZE |
| 84 | 86 | # define ICACHE_ALIAS_ORDER (ICACHE_WAY_SHIFT - PAGE_SHIFT) |
| @@ -134,6 +136,7 @@ static inline __attribute_const__ int get_order(unsigned long size) · 49 unmodified lines | ||
| 134 | 136 | #endif |
| 135 | 137 | |
| 136 | 138 | struct page; |
| 139 | +struct vm_area_struct; | |
| 137 | 140 | extern void clear_page(void *page); |
| 138 | 141 | extern void copy_page(void *to, void *from); |
| 139 | 142 | |
| @@ -143,8 +146,15 @@ extern void copy_page(void *to, void *from); · 3 unmodified lines | ||
| 143 | 146 | */ |
| 144 | 147 | |
| 145 | 148 | #if DCACHE_WAY_SIZE > PAGE_SIZE |
| 146 | −extern void clear_user_page(void*, unsigned long, struct page*); | |
| 147 | −extern void copy_user_page(void*, void*, unsigned long, struct page*); | |
| 149 | +extern void clear_page_alias(void *vaddr, unsigned long paddr); | |
| 150 | +extern void copy_page_alias(void *to, void *from, | |
| 151 | + unsigned long to_paddr, unsigned long from_paddr); | |
| 152 | + | |
| 153 | +#define clear_user_highpage clear_user_highpage | |
| 154 | +void clear_user_highpage(struct page *page, unsigned long vaddr); | |
| 155 | +#define __HAVE_ARCH_COPY_USER_HIGHPAGE | |
| 156 | +void copy_user_highpage(struct page *to, struct page *from, | |
| 157 | + unsigned long vaddr, struct vm_area_struct *vma); | |
| 148 | 158 | #else |
| 149 | 159 | # define clear_user_page(page, vaddr, pg) clear_page(page) |
| 150 | 160 | # define copy_user_page(to, from, vaddr, pg) copy_page(to, from) |
| @@ -67,7 +67,12 @@ · 66 unmodified lines | ||
| 67 | 67 | #define VMALLOC_START 0xC0000000 |
| 68 | 68 | #define VMALLOC_END 0xC7FEFFFF |
| 69 | 69 | #define TLBTEMP_BASE_1 0xC7FF0000 |
| 70 | −#define TLBTEMP_BASE_2 0xC7FF8000 | |
| 70 | +#define TLBTEMP_BASE_2 (TLBTEMP_BASE_1 + DCACHE_WAY_SIZE) | |
| 71 | +#if 2 * DCACHE_WAY_SIZE > ICACHE_WAY_SIZE | |
| 72 | +#define TLBTEMP_SIZE (2 * DCACHE_WAY_SIZE) | |
| 73 | +#else | |
| 74 | +#define TLBTEMP_SIZE ICACHE_WAY_SIZE | |
| 75 | +#endif | |
| 71 | 76 | |
| 72 | 77 | /* |
| 73 | 78 | * For the Xtensa architecture, the PTE layout is as follows: |
| @@ -52,7 +52,12 @@ · 51 unmodified lines | ||
| 52 | 52 | */ |
| 53 | 53 | .macro get_fs ad, sp |
| 54 | 54 | GET_CURRENT(\ad,\sp) |
| 55 | +#if THREAD_CURRENT_DS > 1020 | |
| 56 | + addi \ad, \ad, TASK_THREAD | |
| 57 | + l32i \ad, \ad, THREAD_CURRENT_DS - TASK_THREAD | |
| 58 | +#else | |
| 55 | 59 | l32i \ad, \ad, THREAD_CURRENT_DS |
| 60 | +#endif | |
| 56 | 61 | .endm |
| 57 | 62 | |
| 58 | 63 | /* |
| @@ -28,17 +28,17 @@ · 27 unmodified lines | ||
| 28 | 28 | #define TCSETSW 0x5403 |
| 29 | 29 | #define TCSETSF 0x5404 |
| 30 | 30 | |
| 31 | −#define TCGETA _IOR('t', 23, struct termio) | |
| 32 | −#define TCSETA _IOW('t', 24, struct termio) | |
| 33 | −#define TCSETAW _IOW('t', 25, struct termio) | |
| 34 | −#define TCSETAF _IOW('t', 28, struct termio) | |
| 31 | +#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */ | |
| 32 | +#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */ | |
| 33 | +#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */ | |
| 34 | +#define TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */ | |
| 35 | 35 | |
| 36 | 36 | #define TCSBRK _IO('t', 29) |
| 37 | 37 | #define TCXONC _IO('t', 30) |
| 38 | 38 | #define TCFLSH _IO('t', 31) |
| 39 | 39 | |
| 40 | −#define TIOCSWINSZ _IOW('t', 103, struct winsize) | |
| 41 | −#define TIOCGWINSZ _IOR('t', 104, struct winsize) | |
| 40 | +#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */ | |
| 41 | +#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */ | |
| 42 | 42 | #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ |
| 43 | 43 | #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ |
| 44 | 44 | #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ |
| @@ -88,7 +88,6 @@ · 43 unmodified lines | ||
| 88 | 88 | #define TIOCSETD _IOW('T', 35, int) |
| 89 | 89 | #define TIOCGETD _IOR('T', 36, int) |
| 90 | 90 | #define TCSBRKP _IOW('T', 37, int) /* Needed for POSIX tcsendbreak()*/ |
| 91 | −#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* For debugging only*/ | |
| 92 | 91 | #define TIOCSBRK _IO('T', 39) /* BSD compatibility */ |
| 93 | 92 | #define TIOCCBRK _IO('T', 40) /* BSD compatibility */ |
| 94 | 93 | #define TIOCGSID _IOR('T', 41, pid_t) /* Return the session ID of FD*/ |
| @@ -114,8 +113,10 @@ · 19 unmodified lines | ||
| 114 | 113 | #define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* Get line status reg. */ |
| 115 | 114 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ |
| 116 | 115 | # define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ |
| 117 | −#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* Get multiport config */ | |
| 118 | −#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */ | |
| 116 | +#define TIOCSERGETMULTI 0x80a8545a /* Get multiport config */ | |
| 117 | + /* _IOR('T', 90, struct serial_multiport_struct) */ | |
| 118 | +#define TIOCSERSETMULTI 0x40a8545b /* Set multiport config */ | |
| 119 | + /* _IOW('T', 91, struct serial_multiport_struct) */ | |
| 119 | 120 | |
| 120 | 121 | #define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ |
| 121 | 122 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ |
| @@ -739,7 +739,10 @@ __SYSCALL(334, sys_sched_setattr, 2) · 738 unmodified lines | ||
| 739 | 739 | #define __NR_sched_getattr 335 |
| 740 | 740 | __SYSCALL(335, sys_sched_getattr, 3) |
| 741 | 741 | |
| 742 | −#define __NR_syscall_count 336 | |
| 742 | +#define __NR_renameat2 336 | |
| 743 | +__SYSCALL(336, sys_renameat2, 5) | |
| 744 | + | |
| 745 | +#define __NR_syscall_count 337 | |
| 743 | 746 | |
| 744 | 747 | /* |
| 745 | 748 | * sysxtensa syscall handler |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | * this archive for more details. |
| 9 | 9 | * |
| 10 | 10 | * Copyright (C) 2001 - 2005 Tensilica, Inc. |
| 11 | + * Copyright (C) 2014 Cadence Design Systems Inc. | |
| 11 | 12 | * |
| 12 | 13 | * Rewritten by Chris Zankel <chris@zankel.net> |
| 13 | 14 | * |
| @@ -174,6 +175,10 @@ ENTRY(fast_unaligned) · 160 unmodified lines | ||
| 174 | 175 | s32i a0, a2, PT_AREG2 |
| 175 | 176 | s32i a3, a2, PT_AREG3 |
| 176 | 177 | |
| 178 | + rsr a3, excsave1 | |
| 179 | + movi a4, fast_unaligned_fixup | |
| 180 | + s32i a4, a3, EXC_TABLE_FIXUP | |
| 181 | + | |
| 177 | 182 | /* Keep value of SAR in a0 */ |
| 178 | 183 | |
| 179 | 184 | rsr a0, sar |
| @@ -225,10 +230,6 @@ ENTRY(fast_unaligned) · 45 unmodified lines | ||
| 225 | 230 | addx8 a5, a6, a5 |
| 226 | 231 | jx a5 # jump into table |
| 227 | 232 | |
| 228 | − /* Invalid instruction, CRITICAL! */ | |
| 229 | −.Linvalid_instruction_load: | |
| 230 | − j .Linvalid_instruction | |
| 231 | − | |
| 232 | 233 | /* Load: Load memory address. */ |
| 233 | 234 | |
| 234 | 235 | .Lload: movi a3, ~3 |
| @@ -272,18 +273,6 @@ ENTRY(fast_unaligned) · 37 unmodified lines | ||
| 272 | 273 | /* Set target register. */ |
| 273 | 274 | |
| 274 | 275 | 1: |
| 275 | − | |
| 276 | −#if XCHAL_HAVE_LOOPS | |
| 277 | − rsr a5, lend # check if we reached LEND | |
| 278 | − bne a7, a5, 1f | |
| 279 | − rsr a5, lcount # and LCOUNT != 0 | |
| 280 | − beqz a5, 1f | |
| 281 | − addi a5, a5, -1 # decrement LCOUNT and set | |
| 282 | − rsr a7, lbeg # set PC to LBEGIN | |
| 283 | − wsr a5, lcount | |
| 284 | −#endif | |
| 285 | − | |
| 286 | −1: wsr a7, epc1 # skip load instruction | |
| 287 | 276 | extui a4, a4, INSN_T, 4 # extract target register |
| 288 | 277 | movi a5, .Lload_table |
| 289 | 278 | addx8 a4, a4, a5 |
| @@ -326,6 +315,35 @@ ENTRY(fast_unaligned) · 36 unmodified lines | ||
| 326 | 315 | mov a3, a14 ; _j 1f; .align 8 |
| 327 | 316 | mov a3, a15 ; _j 1f; .align 8 |
| 328 | 317 | |
| 318 | + /* We cannot handle this exception. */ | |
| 319 | + | |
| 320 | + .extern _kernel_exception | |
| 321 | +.Linvalid_instruction_load: | |
| 322 | +.Linvalid_instruction_store: | |
| 323 | + | |
| 324 | + movi a4, 0 | |
| 325 | + rsr a3, excsave1 | |
| 326 | + s32i a4, a3, EXC_TABLE_FIXUP | |
| 327 | + | |
| 328 | + /* Restore a4...a8 and SAR, set SP, and jump to default exception. */ | |
| 329 | + | |
| 330 | + l32i a8, a2, PT_AREG8 | |
| 331 | + l32i a7, a2, PT_AREG7 | |
| 332 | + l32i a6, a2, PT_AREG6 | |
| 333 | + l32i a5, a2, PT_AREG5 | |
| 334 | + l32i a4, a2, PT_AREG4 | |
| 335 | + wsr a0, sar | |
| 336 | + mov a1, a2 | |
| 337 | + | |
| 338 | + rsr a0, ps | |
| 339 | + bbsi.l a0, PS_UM_BIT, 2f # jump if user mode | |
| 340 | + | |
| 341 | + movi a0, _kernel_exception | |
| 342 | + jx a0 | |
| 343 | + | |
| 344 | +2: movi a0, _user_exception | |
| 345 | + jx a0 | |
| 346 | + | |
| 329 | 347 | 1: # a7: instruction pointer, a4: instruction, a3: value |
| 330 | 348 | |
| 331 | 349 | movi a6, 0 # mask: ffffffff:00000000 |
| @@ -353,17 +371,6 @@ ENTRY(fast_unaligned) · 21 unmodified lines | ||
| 353 | 371 | /* Get memory address */ |
| 354 | 372 | |
| 355 | 373 | 1: |
| 356 | −#if XCHAL_HAVE_LOOPS | |
| 357 | − rsr a4, lend # check if we reached LEND | |
| 358 | − bne a7, a4, 1f | |
| 359 | − rsr a4, lcount # and LCOUNT != 0 | |
| 360 | − beqz a4, 1f | |
| 361 | − addi a4, a4, -1 # decrement LCOUNT and set | |
| 362 | − rsr a7, lbeg # set PC to LBEGIN | |
| 363 | − wsr a4, lcount | |
| 364 | −#endif | |
| 365 | − | |
| 366 | −1: wsr a7, epc1 # skip store instruction | |
| 367 | 374 | movi a4, ~3 |
| 368 | 375 | and a4, a4, a8 # align memory address |
| 369 | 376 | |
| @@ -375,25 +382,25 @@ ENTRY(fast_unaligned) · 5 unmodified lines | ||
| 375 | 382 | #endif |
| 376 | 383 | |
| 377 | 384 | __ssa8r a8 |
| 378 | − __src_b a7, a5, a6 # lo-mask F..F0..0 (BE) 0..0F..F (LE) | |
| 385 | + __src_b a8, a5, a6 # lo-mask F..F0..0 (BE) 0..0F..F (LE) | |
| 379 | 386 | __src_b a6, a6, a5 # hi-mask 0..0F..F (BE) F..F0..0 (LE) |
| 380 | 387 | #ifdef UNALIGNED_USER_EXCEPTION |
| 381 | 388 | l32e a5, a4, -8 |
| 382 | 389 | #else |
| 383 | 390 | l32i a5, a4, 0 # load lower address word |
| 384 | 391 | #endif |
| 385 | − and a5, a5, a7 # mask | |
| 386 | − __sh a7, a3 # shift value | |
| 387 | − or a5, a5, a7 # or with original value | |
| 392 | + and a5, a5, a8 # mask | |
| 393 | + __sh a8, a3 # shift value | |
| 394 | + or a5, a5, a8 # or with original value | |
| 388 | 395 | #ifdef UNALIGNED_USER_EXCEPTION |
| 389 | 396 | s32e a5, a4, -8 |
| 390 | − l32e a7, a4, -4 | |
| 397 | + l32e a8, a4, -4 | |
| 391 | 398 | #else |
| 392 | 399 | s32i a5, a4, 0 # store |
| 393 | − l32i a7, a4, 4 # same for upper address word | |
| 400 | + l32i a8, a4, 4 # same for upper address word | |
| 394 | 401 | #endif |
| 395 | 402 | __sl a5, a3 |
| 396 | − and a6, a7, a6 | |
| 403 | + and a6, a8, a6 | |
| 397 | 404 | or a6, a6, a5 |
| 398 | 405 | #ifdef UNALIGNED_USER_EXCEPTION |
| 399 | 406 | s32e a6, a4, -4 |
| @@ -401,9 +408,27 @@ ENTRY(fast_unaligned) · 1 unmodified line | ||
| 401 | 408 | s32i a6, a4, 4 |
| 402 | 409 | #endif |
| 403 | 410 | |
| 404 | − /* Done. restore stack and return */ | |
| 405 | − | |
| 406 | 411 | .Lexit: |
| 412 | +#if XCHAL_HAVE_LOOPS | |
| 413 | + rsr a4, lend # check if we reached LEND | |
| 414 | + bne a7, a4, 1f | |
| 415 | + rsr a4, lcount # and LCOUNT != 0 | |
| 416 | + beqz a4, 1f | |
| 417 | + addi a4, a4, -1 # decrement LCOUNT and set | |
| 418 | + rsr a7, lbeg # set PC to LBEGIN | |
| 419 | + wsr a4, lcount | |
| 420 | +#endif | |
| 421 | + | |
| 422 | +1: wsr a7, epc1 # skip emulated instruction | |
| 423 | + | |
| 424 | + /* Update icount if we're single-stepping in userspace. */ | |
| 425 | + rsr a4, icountlevel | |
| 426 | + beqz a4, 1f | |
| 427 | + bgeui a4, LOCKLEVEL + 1, 1f | |
| 428 | + rsr a4, icount | |
| 429 | + addi a4, a4, 1 | |
| 430 | + wsr a4, icount | |
| 431 | +1: | |
| 407 | 432 | movi a4, 0 |
| 408 | 433 | rsr a3, excsave1 |
| 409 | 434 | s32i a4, a3, EXC_TABLE_FIXUP |
| @@ -424,31 +449,40 @@ ENTRY(fast_unaligned) · 14 unmodified lines | ||
| 424 | 449 | l32i a2, a2, PT_AREG2 |
| 425 | 450 | rfe |
| 426 | 451 | |
| 427 | − /* We cannot handle this exception. */ | |
| 452 | +ENDPROC(fast_unaligned) | |
| 428 | 453 | |
| 429 | − .extern _kernel_exception | |
| 430 | −.Linvalid_instruction_store: | |
| 431 | −.Linvalid_instruction: | |
| 454 | +ENTRY(fast_unaligned_fixup) | |
| 432 | 455 | |
| 433 | − /* Restore a4...a8 and SAR, set SP, and jump to default exception. */ | |
| 456 | + l32i a2, a3, EXC_TABLE_DOUBLE_SAVE | |
| 457 | + wsr a3, excsave1 | |
| 434 | 458 | |
| 435 | 459 | l32i a8, a2, PT_AREG8 |
| 436 | 460 | l32i a7, a2, PT_AREG7 |
| 437 | 461 | l32i a6, a2, PT_AREG6 |
| 438 | 462 | l32i a5, a2, PT_AREG5 |
| 439 | 463 | l32i a4, a2, PT_AREG4 |
| 464 | + l32i a0, a2, PT_AREG2 | |
| 465 | + xsr a0, depc # restore depc and a0 | |
| 440 | 466 | wsr a0, sar |
| 441 | − mov a1, a2 | |
| 467 | + | |
| 468 | + rsr a0, exccause | |
| 469 | + s32i a0, a2, PT_DEPC # mark as a regular exception | |
| 442 | 470 | |
| 443 | 471 | rsr a0, ps |
| 444 | − bbsi.l a2, PS_UM_BIT, 1f # jump if user mode | |
| 472 | + bbsi.l a0, PS_UM_BIT, 1f # jump if user mode | |
| 445 | 473 | |
| 446 | − movi a0, _kernel_exception | |
| 474 | + rsr a0, exccause | |
| 475 | + addx4 a0, a0, a3 # find entry in table | |
| 476 | + l32i a0, a0, EXC_TABLE_FAST_KERNEL # load handler | |
| 477 | + l32i a3, a2, PT_AREG3 | |
| 447 | 478 | jx a0 |
| 448 | − | |
| 449 | −1: movi a0, _user_exception | |
| 479 | +1: | |
| 480 | + rsr a0, exccause | |
| 481 | + addx4 a0, a0, a3 # find entry in table | |
| 482 | + l32i a0, a0, EXC_TABLE_FAST_USER # load handler | |
| 483 | + l32i a3, a2, PT_AREG3 | |
| 450 | 484 | jx a0 |
| 451 | 485 | |
| 452 | −ENDPROC(fast_unaligned) | |
| 486 | +ENDPROC(fast_unaligned_fixup) | |
| 453 | 487 | |
| 454 | 488 | #endif /* XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION */ |
| @@ -986,6 +986,8 @@ ENDPROC(fast_syscall_unrecoverable) · 985 unmodified lines | ||
| 986 | 986 | * j done |
| 987 | 987 | */ |
| 988 | 988 | |
| 989 | +#ifdef CONFIG_FAST_SYSCALL_XTENSA | |
| 990 | + | |
| 989 | 991 | #define TRY \ |
| 990 | 992 | .section __ex_table, "a"; \ |
| 991 | 993 | .word 66f, 67f; \ |
| @@ -1001,9 +1003,8 @@ ENTRY(fast_syscall_xtensa) · 9 unmodified lines | ||
| 1001 | 1003 | movi a7, 4 # sizeof(unsigned int) |
| 1002 | 1004 | access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp |
| 1003 | 1005 | |
| 1004 | − addi a6, a6, -1 # assuming SYS_XTENSA_ATOMIC_SET = 1 | |
| 1005 | − _bgeui a6, SYS_XTENSA_COUNT - 1, .Lill | |
| 1006 | − _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP - 1, .Lnswp | |
| 1006 | + _bgeui a6, SYS_XTENSA_COUNT, .Lill | |
| 1007 | + _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP, .Lnswp | |
| 1007 | 1008 | |
| 1008 | 1009 | /* Fall through for ATOMIC_CMP_SWP. */ |
| 1009 | 1010 | |
| @@ -1015,27 +1016,26 @@ TRY s32i a5, a3, 0 # different, modify value · 5 unmodified lines | ||
| 1015 | 1016 | l32i a7, a2, PT_AREG7 # restore a7 |
| 1016 | 1017 | l32i a0, a2, PT_AREG0 # restore a0 |
| 1017 | 1018 | movi a2, 1 # and return 1 |
| 1018 | − addi a6, a6, 1 # restore a6 (really necessary?) | |
| 1019 | 1019 | rfe |
| 1020 | 1020 | |
| 1021 | 1021 | 1: l32i a7, a2, PT_AREG7 # restore a7 |
| 1022 | 1022 | l32i a0, a2, PT_AREG0 # restore a0 |
| 1023 | 1023 | movi a2, 0 # return 0 (note that we cannot set |
| 1024 | − addi a6, a6, 1 # restore a6 (really necessary?) | |
| 1025 | 1024 | rfe |
| 1026 | 1025 | |
| 1027 | 1026 | .Lnswp: /* Atomic set, add, and exg_add. */ |
| 1028 | 1027 | |
| 1029 | 1028 | TRY l32i a7, a3, 0 # orig |
| 1029 | + addi a6, a6, -SYS_XTENSA_ATOMIC_SET | |
| 1030 | 1030 | add a0, a4, a7 # + arg |
| 1031 | 1031 | moveqz a0, a4, a6 # set |
| 1032 | + addi a6, a6, SYS_XTENSA_ATOMIC_SET | |
| 1032 | 1033 | TRY s32i a0, a3, 0 # write new value |
| 1033 | 1034 | |
| 1034 | 1035 | mov a0, a2 |
| 1035 | 1036 | mov a2, a7 |
| 1036 | 1037 | l32i a7, a0, PT_AREG7 # restore a7 |
| 1037 | 1038 | l32i a0, a0, PT_AREG0 # restore a0 |
| 1038 | − addi a6, a6, 1 # restore a6 (really necessary?) | |
| 1039 | 1039 | rfe |
| 1040 | 1040 | |
| 1041 | 1041 | CATCH |
| @@ -1044,13 +1044,25 @@ CATCH · 2 unmodified lines | ||
| 1044 | 1044 | movi a2, -EFAULT |
| 1045 | 1045 | rfe |
| 1046 | 1046 | |
| 1047 | −.Lill: l32i a7, a2, PT_AREG0 # restore a7 | |
| 1047 | +.Lill: l32i a7, a2, PT_AREG7 # restore a7 | |
| 1048 | 1048 | l32i a0, a2, PT_AREG0 # restore a0 |
| 1049 | 1049 | movi a2, -EINVAL |
| 1050 | 1050 | rfe |
| 1051 | 1051 | |
| 1052 | 1052 | ENDPROC(fast_syscall_xtensa) |
| 1053 | 1053 | |
| 1054 | +#else /* CONFIG_FAST_SYSCALL_XTENSA */ | |
| 1055 | + | |
| 1056 | +ENTRY(fast_syscall_xtensa) | |
| 1057 | + | |
| 1058 | + l32i a0, a2, PT_AREG0 # restore a0 | |
| 1059 | + movi a2, -ENOSYS | |
| 1060 | + rfe | |
| 1061 | + | |
| 1062 | +ENDPROC(fast_syscall_xtensa) | |
| 1063 | + | |
| 1064 | +#endif /* CONFIG_FAST_SYSCALL_XTENSA */ | |
| 1065 | + | |
| 1054 | 1066 | |
| 1055 | 1067 | /* fast_syscall_spill_registers. |
| 1056 | 1068 | * |
| @@ -1066,6 +1078,8 @@ ENDPROC(fast_syscall_xtensa) · 9 unmodified lines | ||
| 1066 | 1078 | * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler. |
| 1067 | 1079 | */ |
| 1068 | 1080 | |
| 1081 | +#ifdef CONFIG_FAST_SYSCALL_SPILL_REGISTERS | |
| 1082 | + | |
| 1069 | 1083 | ENTRY(fast_syscall_spill_registers) |
| 1070 | 1084 | |
| 1071 | 1085 | /* Register a FIXUP handler (pass current wb as a parameter) */ |
| @@ -1400,6 +1414,18 @@ ENTRY(fast_syscall_spill_registers_fixup_return) · 328 unmodified lines | ||
| 1400 | 1414 | |
| 1401 | 1415 | ENDPROC(fast_syscall_spill_registers_fixup_return) |
| 1402 | 1416 | |
| 1417 | +#else /* CONFIG_FAST_SYSCALL_SPILL_REGISTERS */ | |
| 1418 | + | |
| 1419 | +ENTRY(fast_syscall_spill_registers) | |
| 1420 | + | |
| 1421 | + l32i a0, a2, PT_AREG0 # restore a0 | |
| 1422 | + movi a2, -ENOSYS | |
| 1423 | + rfe | |
| 1424 | + | |
| 1425 | +ENDPROC(fast_syscall_spill_registers) | |
| 1426 | + | |
| 1427 | +#endif /* CONFIG_FAST_SYSCALL_SPILL_REGISTERS */ | |
| 1428 | + | |
| 1403 | 1429 | #ifdef CONFIG_MMU |
| 1404 | 1430 | /* |
| 1405 | 1431 | * We should never get here. Bail out! |
| @@ -1565,7 +1591,7 @@ ENTRY(fast_second_level_miss) · 159 unmodified lines | ||
| 1565 | 1591 | rsr a0, excvaddr |
| 1566 | 1592 | bltu a0, a3, 2f |
| 1567 | 1593 | |
| 1568 | − addi a1, a0, -(2 << (DCACHE_ALIAS_ORDER + PAGE_SHIFT)) | |
| 1594 | + addi a1, a0, -TLBTEMP_SIZE | |
| 1569 | 1595 | bgeu a1, a3, 2f |
| 1570 | 1596 | |
| 1571 | 1597 | /* Check if we have to restore an ITLB mapping. */ |
| @@ -1820,7 +1846,6 @@ ENTRY(_switch_to) · 248 unmodified lines | ||
| 1820 | 1846 | |
| 1821 | 1847 | entry a1, 16 |
| 1822 | 1848 | |
| 1823 | − mov a10, a2 # preserve 'prev' (a2) | |
| 1824 | 1849 | mov a11, a3 # and 'next' (a3) |
| 1825 | 1850 | |
| 1826 | 1851 | l32i a4, a2, TASK_THREAD_INFO |
| @@ -1828,8 +1853,14 @@ ENTRY(_switch_to) · 1 unmodified line | ||
| 1828 | 1853 | |
| 1829 | 1854 | save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER |
| 1830 | 1855 | |
| 1831 | − s32i a0, a10, THREAD_RA # save return address | |
| 1832 | − s32i a1, a10, THREAD_SP # save stack pointer | |
| 1856 | +#if THREAD_RA > 1020 || THREAD_SP > 1020 | |
| 1857 | + addi a10, a2, TASK_THREAD | |
| 1858 | + s32i a0, a10, THREAD_RA - TASK_THREAD # save return address | |
| 1859 | + s32i a1, a10, THREAD_SP - TASK_THREAD # save stack pointer | |
| 1860 | +#else | |
| 1861 | + s32i a0, a2, THREAD_RA # save return address | |
| 1862 | + s32i a1, a2, THREAD_SP # save stack pointer | |
| 1863 | +#endif | |
| 1833 | 1864 | |
| 1834 | 1865 | /* Disable ints while we manipulate the stack pointer. */ |
| 1835 | 1866 | |
| @@ -1870,7 +1901,6 @@ ENTRY(_switch_to) · 34 unmodified lines | ||
| 1870 | 1901 | load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER |
| 1871 | 1902 | |
| 1872 | 1903 | wsr a14, ps |
| 1873 | − mov a2, a10 # return 'prev' | |
| 1874 | 1904 | rsync |
| 1875 | 1905 | |
| 1876 | 1906 | retw |
| @@ -49,9 +49,8 @@ dma_alloc_coherent(struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag) · 48 unmodified lines | ||
| 49 | 49 | |
| 50 | 50 | /* We currently don't support coherent memory outside KSEG */ |
| 51 | 51 | |
| 52 | − if (ret < XCHAL_KSEG_CACHED_VADDR | |
| 53 | − || ret >= XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE) | |
| 54 | − BUG(); | |
| 52 | + BUG_ON(ret < XCHAL_KSEG_CACHED_VADDR || | |
| 53 | + ret > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1); | |
| 55 | 54 | |
| 56 | 55 | |
| 57 | 56 | if (ret != 0) { |
| @@ -68,10 +67,11 @@ EXPORT_SYMBOL(dma_alloc_coherent); · 10 unmodified lines | ||
| 68 | 67 | void dma_free_coherent(struct device *hwdev, size_t size, |
| 69 | 68 | void *vaddr, dma_addr_t dma_handle) |
| 70 | 69 | { |
| 71 | − long addr=(long)vaddr+XCHAL_KSEG_CACHED_VADDR-XCHAL_KSEG_BYPASS_VADDR; | |
| 70 | + unsigned long addr = (unsigned long)vaddr + | |
| 71 | + XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR; | |
| 72 | 72 | |
| 73 | − if (addr < 0 || addr >= XCHAL_KSEG_SIZE) | |
| 74 | − BUG(); | |
| 73 | + BUG_ON(addr < XCHAL_KSEG_CACHED_VADDR || | |
| 74 | + addr > XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE - 1); | |
| 75 | 75 | |
| 76 | 76 | free_pages(addr, get_order(size)); |
| 77 | 77 | } |
| @@ -571,6 +571,7 @@ void flush_icache_range(unsigned long start, unsigned long end) · 570 unmodified lines | ||
| 571 | 571 | }; |
| 572 | 572 | on_each_cpu(ipi_flush_icache_range, &fd, 1); |
| 573 | 573 | } |
| 574 | +EXPORT_SYMBOL(flush_icache_range); | |
| 574 | 575 | |
| 575 | 576 | /* ------------------------------------------------------------------------- */ |
| 576 | 577 | |
| @@ -101,9 +101,8 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = { · 100 unmodified lines | ||
| 101 | 101 | #if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION |
| 102 | 102 | #ifdef CONFIG_XTENSA_UNALIGNED_USER |
| 103 | 103 | { EXCCAUSE_UNALIGNED, USER, fast_unaligned }, |
| 104 | −#else | |
| 105 | −{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user }, | |
| 106 | 104 | #endif |
| 105 | +{ EXCCAUSE_UNALIGNED, 0, do_unaligned_user }, | |
| 107 | 106 | { EXCCAUSE_UNALIGNED, KRNL, fast_unaligned }, |
| 108 | 107 | #endif |
| 109 | 108 | #ifdef CONFIG_MMU |
| @@ -264,7 +263,6 @@ do_illegal_instruction(struct pt_regs *regs) · 154 unmodified lines | ||
| 264 | 263 | */ |
| 265 | 264 | |
| 266 | 265 | #if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION |
| 267 | −#ifndef CONFIG_XTENSA_UNALIGNED_USER | |
| 268 | 266 | void |
| 269 | 267 | do_unaligned_user (struct pt_regs *regs) |
| 270 | 268 | { |
| @@ -286,7 +284,6 @@ do_unaligned_user (struct pt_regs *regs) · 15 unmodified lines | ||
| 286 | 284 | |
| 287 | 285 | } |
| 288 | 286 | #endif |
| 289 | −#endif | |
| 290 | 287 | |
| 291 | 288 | void |
| 292 | 289 | do_debug(struct pt_regs *regs) |
| @@ -454,8 +454,14 @@ _DoubleExceptionVector_WindowOverflow: · 453 unmodified lines | ||
| 454 | 454 | s32i a0, a2, PT_DEPC |
| 455 | 455 | |
| 456 | 456 | _DoubleExceptionVector_handle_exception: |
| 457 | + addi a0, a0, -EXCCAUSE_UNALIGNED | |
| 458 | + beqz a0, 2f | |
| 457 | 459 | addx4 a0, a0, a3 |
| 458 | − l32i a0, a0, EXC_TABLE_FAST_USER | |
| 460 | + l32i a0, a0, EXC_TABLE_FAST_USER + 4 * EXCCAUSE_UNALIGNED | |
| 461 | + xsr a3, excsave1 | |
| 462 | + jx a0 | |
| 463 | +2: | |
| 464 | + movi a0, user_exception | |
| 459 | 465 | xsr a3, excsave1 |
| 460 | 466 | jx a0 |
| 461 | 467 | |
| @@ -269,13 +269,13 @@ SECTIONS · 268 unmodified lines | ||
| 269 | 269 | .UserExceptionVector.literal) |
| 270 | 270 | SECTION_VECTOR (_DoubleExceptionVector_literal, |
| 271 | 271 | .DoubleExceptionVector.literal, |
| 272 | − DOUBLEEXC_VECTOR_VADDR - 40, | |
| 272 | + DOUBLEEXC_VECTOR_VADDR - 48, | |
| 273 | 273 | SIZEOF(.UserExceptionVector.text), |
| 274 | 274 | .UserExceptionVector.text) |
| 275 | 275 | SECTION_VECTOR (_DoubleExceptionVector_text, |
| 276 | 276 | .DoubleExceptionVector.text, |
| 277 | 277 | DOUBLEEXC_VECTOR_VADDR, |
| 278 | − 40, | |
| 278 | + 48, | |
| 279 | 279 | .DoubleExceptionVector.literal) |
| 280 | 280 | |
| 281 | 281 | . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; |
| @@ -59,9 +59,68 @@ · 58 unmodified lines | ||
| 59 | 59 | * |
| 60 | 60 | */ |
| 61 | 61 | |
| 62 | −#if (DCACHE_WAY_SIZE > PAGE_SIZE) && defined(CONFIG_HIGHMEM) | |
| 63 | −#error "HIGHMEM is not supported on cores with aliasing cache." | |
| 64 | −#endif | |
| 62 | +#if (DCACHE_WAY_SIZE > PAGE_SIZE) | |
| 63 | +static inline void kmap_invalidate_coherent(struct page *page, | |
| 64 | + unsigned long vaddr) | |
| 65 | +{ | |
| 66 | + if (!DCACHE_ALIAS_EQ(page_to_phys(page), vaddr)) { | |
| 67 | + unsigned long kvaddr; | |
| 68 | + | |
| 69 | + if (!PageHighMem(page)) { | |
| 70 | + kvaddr = (unsigned long)page_to_virt(page); | |
| 71 | + | |
| 72 | + __invalidate_dcache_page(kvaddr); | |
| 73 | + } else { | |
| 74 | + kvaddr = TLBTEMP_BASE_1 + | |
| 75 | + (page_to_phys(page) & DCACHE_ALIAS_MASK); | |
| 76 | + | |
| 77 | + __invalidate_dcache_page_alias(kvaddr, | |
| 78 | + page_to_phys(page)); | |
| 79 | + } | |
| 80 | + } | |
| 81 | +} | |
| 82 | + | |
| 83 | +static inline void *coherent_kvaddr(struct page *page, unsigned long base, | |
| 84 | + unsigned long vaddr, unsigned long *paddr) | |
| 85 | +{ | |
| 86 | + if (PageHighMem(page) || !DCACHE_ALIAS_EQ(page_to_phys(page), vaddr)) { | |
| 87 | + *paddr = page_to_phys(page); | |
| 88 | + return (void *)(base + (vaddr & DCACHE_ALIAS_MASK)); | |
| 89 | + } else { | |
| 90 | + *paddr = 0; | |
| 91 | + return page_to_virt(page); | |
| 92 | + } | |
| 93 | +} | |
| 94 | + | |
| 95 | +void clear_user_highpage(struct page *page, unsigned long vaddr) | |
| 96 | +{ | |
| 97 | + unsigned long paddr; | |
| 98 | + void *kvaddr = coherent_kvaddr(page, TLBTEMP_BASE_1, vaddr, &paddr); | |
| 99 | + | |
| 100 | + pagefault_disable(); | |
| 101 | + kmap_invalidate_coherent(page, vaddr); | |
| 102 | + set_bit(PG_arch_1, &page->flags); | |
| 103 | + clear_page_alias(kvaddr, paddr); | |
| 104 | + pagefault_enable(); | |
| 105 | +} | |
| 106 | + | |
| 107 | +void copy_user_highpage(struct page *dst, struct page *src, | |
| 108 | + unsigned long vaddr, struct vm_area_struct *vma) | |
| 109 | +{ | |
| 110 | + unsigned long dst_paddr, src_paddr; | |
| 111 | + void *dst_vaddr = coherent_kvaddr(dst, TLBTEMP_BASE_1, vaddr, | |
| 112 | + &dst_paddr); | |
| 113 | + void *src_vaddr = coherent_kvaddr(src, TLBTEMP_BASE_2, vaddr, | |
| 114 | + &src_paddr); | |
| 115 | + | |
| 116 | + pagefault_disable(); | |
| 117 | + kmap_invalidate_coherent(dst, vaddr); | |
| 118 | + set_bit(PG_arch_1, &dst->flags); | |
| 119 | + copy_page_alias(dst_vaddr, src_vaddr, dst_paddr, src_paddr); | |
| 120 | + pagefault_enable(); | |
| 121 | +} | |
| 122 | + | |
| 123 | +#endif /* DCACHE_WAY_SIZE > PAGE_SIZE */ | |
| 65 | 124 | |
| 66 | 125 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK |
| 67 | 126 | |
| @@ -103,7 +162,8 @@ void flush_dcache_page(struct page *page) · 35 unmodified lines | ||
| 103 | 162 | if (!alias && !mapping) |
| 104 | 163 | return; |
| 105 | 164 | |
| 106 | − __flush_invalidate_dcache_page((long)page_address(page)); | |
| 165 | + virt = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK); | |
| 166 | + __flush_invalidate_dcache_page_alias(virt, phys); | |
| 107 | 167 | |
| 108 | 168 | virt = TLBTEMP_BASE_1 + (temp & DCACHE_ALIAS_MASK); |
| 109 | 169 | |
| @@ -168,13 +228,12 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep) · 58 unmodified lines | ||
| 168 | 228 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK |
| 169 | 229 | |
| 170 | 230 | if (!PageReserved(page) && test_bit(PG_arch_1, &page->flags)) { |
| 171 | − | |
| 172 | − unsigned long paddr = (unsigned long) page_address(page); | |
| 173 | 231 | unsigned long phys = page_to_phys(page); |
| 174 | − unsigned long tmp = TLBTEMP_BASE_1 + (addr & DCACHE_ALIAS_MASK); | |
| 175 | − | |
| 176 | − __flush_invalidate_dcache_page(paddr); | |
| 232 | + unsigned long tmp; | |
| 177 | 233 | |
| 234 | + tmp = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK); | |
| 235 | + __flush_invalidate_dcache_page_alias(tmp, phys); | |
| 236 | + tmp = TLBTEMP_BASE_1 + (addr & DCACHE_ALIAS_MASK); | |
| 178 | 237 | __flush_invalidate_dcache_page_alias(tmp, phys); |
| 179 | 238 | __invalidate_icache_page_alias(tmp, phys); |
| 180 | 239 | |
| @@ -14,23 +14,45 @@ · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | static pte_t *kmap_pte; |
| 16 | 16 | |
| 17 | +#if DCACHE_WAY_SIZE > PAGE_SIZE | |
| 18 | +unsigned int last_pkmap_nr_arr[DCACHE_N_COLORS]; | |
| 19 | +wait_queue_head_t pkmap_map_wait_arr[DCACHE_N_COLORS]; | |
| 20 | + | |
| 21 | +static void __init kmap_waitqueues_init(void) | |
| 22 | +{ | |
| 23 | + unsigned int i; | |
| 24 | + | |
| 25 | + for (i = 0; i < ARRAY_SIZE(pkmap_map_wait_arr); ++i) | |
| 26 | + init_waitqueue_head(pkmap_map_wait_arr + i); | |
| 27 | +} | |
| 28 | +#else | |
| 29 | +static inline void kmap_waitqueues_init(void) | |
| 30 | +{ | |
| 31 | +} | |
| 32 | +#endif | |
| 33 | + | |
| 34 | +static inline enum fixed_addresses kmap_idx(int type, unsigned long color) | |
| 35 | +{ | |
| 36 | + return (type + KM_TYPE_NR * smp_processor_id()) * DCACHE_N_COLORS + | |
| 37 | + color; | |
| 38 | +} | |
| 39 | + | |
| 17 | 40 | void *kmap_atomic(struct page *page) |
| 18 | 41 | { |
| 19 | 42 | enum fixed_addresses idx; |
| 20 | 43 | unsigned long vaddr; |
| 21 | − int type; | |
| 22 | 44 | |
| 23 | 45 | pagefault_disable(); |
| 24 | 46 | if (!PageHighMem(page)) |
| 25 | 47 | return page_address(page); |
| 26 | 48 | |
| 27 | − type = kmap_atomic_idx_push(); | |
| 28 | − idx = type + KM_TYPE_NR * smp_processor_id(); | |
| 49 | + idx = kmap_idx(kmap_atomic_idx_push(), | |
| 50 | + DCACHE_ALIAS(page_to_phys(page))); | |
| 29 | 51 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); |
| 30 | 52 | #ifdef CONFIG_DEBUG_HIGHMEM |
| 31 | − BUG_ON(!pte_none(*(kmap_pte - idx))); | |
| 53 | + BUG_ON(!pte_none(*(kmap_pte + idx))); | |
| 32 | 54 | #endif |
| 33 | − set_pte(kmap_pte - idx, mk_pte(page, PAGE_KERNEL_EXEC)); | |
| 55 | + set_pte(kmap_pte + idx, mk_pte(page, PAGE_KERNEL_EXEC)); | |
| 34 | 56 | |
| 35 | 57 | return (void *)vaddr; |
| 36 | 58 | } |
| @@ -38,12 +60,10 @@ EXPORT_SYMBOL(kmap_atomic); · 1 unmodified line | ||
| 38 | 60 | |
| 39 | 61 | void __kunmap_atomic(void *kvaddr) |
| 40 | 62 | { |
| 41 | − int idx, type; | |
| 42 | − | |
| 43 | 63 | if (kvaddr >= (void *)FIXADDR_START && |
| 44 | 64 | kvaddr < (void *)FIXADDR_TOP) { |
| 45 | − type = kmap_atomic_idx(); | |
| 46 | − idx = type + KM_TYPE_NR * smp_processor_id(); | |
| 65 | + int idx = kmap_idx(kmap_atomic_idx(), | |
| 66 | + DCACHE_ALIAS((unsigned long)kvaddr)); | |
| 47 | 67 | |
| 48 | 68 | /* |
| 49 | 69 | * Force other mappings to Oops if they'll try to access this |
| @@ -51,7 +71,7 @@ void __kunmap_atomic(void *kvaddr) · 1 unmodified line | ||
| 51 | 71 | * is a bad idea also, in case the page changes cacheability |
| 52 | 72 | * attributes or becomes a protected page in a hypervisor. |
| 53 | 73 | */ |
| 54 | − pte_clear(&init_mm, kvaddr, kmap_pte - idx); | |
| 74 | + pte_clear(&init_mm, kvaddr, kmap_pte + idx); | |
| 55 | 75 | local_flush_tlb_kernel_range((unsigned long)kvaddr, |
| 56 | 76 | (unsigned long)kvaddr + PAGE_SIZE); |
| 57 | 77 | |
| @@ -69,4 +89,5 @@ void __init kmap_init(void) · 11 unmodified lines | ||
| 69 | 89 | /* cache the first kmap pte */ |
| 70 | 90 | kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); |
| 71 | 91 | kmap_pte = kmap_get_fixmap_pte(kmap_vstart); |
| 92 | + kmap_waitqueues_init(); | |
| 72 | 93 | } |
| @@ -110,41 +110,24 @@ ENTRY(__tlbtemp_mapping_start) · 109 unmodified lines | ||
| 110 | 110 | #if (DCACHE_WAY_SIZE > PAGE_SIZE) |
| 111 | 111 | |
| 112 | 112 | /* |
| 113 | − * clear_user_page (void *addr, unsigned long vaddr, struct page *page) | |
| 114 | − * a2 a3 a4 | |
| 113 | + * clear_page_alias(void *addr, unsigned long paddr) | |
| 114 | + * a2 a3 | |
| 115 | 115 | */ |
| 116 | 116 | |
| 117 | −ENTRY(clear_user_page) | |
| 117 | +ENTRY(clear_page_alias) | |
| 118 | 118 | |
| 119 | 119 | entry a1, 32 |
| 120 | 120 | |
| 121 | − /* Mark page dirty and determine alias. */ | |
| 121 | + /* Skip setting up a temporary DTLB if not aliased low page. */ | |
| 122 | 122 | |
| 123 | − movi a7, (1 << PG_ARCH_1) | |
| 124 | − l32i a5, a4, PAGE_FLAGS | |
| 125 | − xor a6, a2, a3 | |
| 126 | − extui a3, a3, PAGE_SHIFT, DCACHE_ALIAS_ORDER | |
| 127 | − extui a6, a6, PAGE_SHIFT, DCACHE_ALIAS_ORDER | |
| 128 | − or a5, a5, a7 | |
| 129 | − slli a3, a3, PAGE_SHIFT | |
| 130 | − s32i a5, a4, PAGE_FLAGS | |
| 123 | + movi a5, PAGE_OFFSET | |
| 124 | + movi a6, 0 | |
| 125 | + beqz a3, 1f | |
| 131 | 126 | |
| 132 | − /* Skip setting up a temporary DTLB if not aliased. */ | |
| 133 | − | |
| 134 | − beqz a6, 1f | |
| 135 | − | |
| 136 | − /* Invalidate kernel page. */ | |
| 137 | − | |
| 138 | − mov a10, a2 | |
| 139 | − call8 __invalidate_dcache_page | |
| 140 | − | |
| 141 | − /* Setup a temporary DTLB with the color of the VPN */ | |
| 142 | − | |
| 143 | − movi a4, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff | |
| 144 | − movi a5, TLBTEMP_BASE_1 # virt | |
| 145 | − add a6, a2, a4 # ppn | |
| 146 | − add a2, a5, a3 # add 'color' | |
| 127 | + /* Setup a temporary DTLB for the addr. */ | |
| 147 | 128 | |
| 129 | + addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE) | |
| 130 | + mov a4, a2 | |
| 148 | 131 | wdtlb a6, a2 |
| 149 | 132 | dsync |
| 150 | 133 | |
| @@ -165,62 +148,43 @@ ENTRY(clear_user_page) · 14 unmodified lines | ||
| 165 | 148 | |
| 166 | 149 | /* We need to invalidate the temporary idtlb entry, if any. */ |
| 167 | 150 | |
| 168 | −1: addi a2, a2, -PAGE_SIZE | |
| 169 | − idtlb a2 | |
| 151 | +1: idtlb a4 | |
| 170 | 152 | dsync |
| 171 | 153 | |
| 172 | 154 | retw |
| 173 | 155 | |
| 174 | −ENDPROC(clear_user_page) | |
| 156 | +ENDPROC(clear_page_alias) | |
| 175 | 157 | |
| 176 | 158 | /* |
| 177 | − * copy_page_user (void *to, void *from, unsigned long vaddr, struct page *page) | |
| 178 | − * a2 a3 a4 a5 | |
| 159 | + * copy_page_alias(void *to, void *from, | |
| 160 | + * a2 a3 | |
| 161 | + * unsigned long to_paddr, unsigned long from_paddr) | |
| 162 | + * a4 a5 | |
| 179 | 163 | */ |
| 180 | 164 | |
| 181 | −ENTRY(copy_user_page) | |
| 165 | +ENTRY(copy_page_alias) | |
| 182 | 166 | |
| 183 | 167 | entry a1, 32 |
| 184 | 168 | |
| 185 | − /* Mark page dirty and determine alias for destination. */ | |
| 186 | − | |
| 187 | − movi a8, (1 << PG_ARCH_1) | |
| 188 | − l32i a9, a5, PAGE_FLAGS | |
| 189 | − xor a6, a2, a4 | |
| 190 | − xor a7, a3, a4 | |
| 191 | − extui a4, a4, PAGE_SHIFT, DCACHE_ALIAS_ORDER | |
| 192 | − extui a6, a6, PAGE_SHIFT, DCACHE_ALIAS_ORDER | |
| 193 | − extui a7, a7, PAGE_SHIFT, DCACHE_ALIAS_ORDER | |
| 194 | − or a9, a9, a8 | |
| 195 | − slli a4, a4, PAGE_SHIFT | |
| 196 | − s32i a9, a5, PAGE_FLAGS | |
| 197 | − movi a5, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff | |
| 198 | − | |
| 199 | − beqz a6, 1f | |
| 200 | − | |
| 201 | − /* Invalidate dcache */ | |
| 202 | − | |
| 203 | − mov a10, a2 | |
| 204 | − call8 __invalidate_dcache_page | |
| 169 | + /* Skip setting up a temporary DTLB for destination if not aliased. */ | |
| 205 | 170 | |
| 206 | − /* Setup a temporary DTLB with a matching color. */ | |
| 171 | + movi a6, 0 | |
| 172 | + movi a7, 0 | |
| 173 | + beqz a4, 1f | |
| 207 | 174 | |
| 208 | − movi a8, TLBTEMP_BASE_1 # base | |
| 209 | − add a6, a2, a5 # ppn | |
| 210 | − add a2, a8, a4 # add 'color' | |
| 175 | + /* Setup a temporary DTLB for destination. */ | |
| 211 | 176 | |
| 177 | + addi a6, a4, (PAGE_KERNEL | _PAGE_HW_WRITE) | |
| 212 | 178 | wdtlb a6, a2 |
| 213 | 179 | dsync |
| 214 | 180 | |
| 215 | − /* Skip setting up a temporary DTLB for destination if not aliased. */ | |
| 181 | + /* Skip setting up a temporary DTLB for source if not aliased. */ | |
| 216 | 182 | |
| 217 | −1: beqz a7, 1f | |
| 183 | +1: beqz a5, 1f | |
| 218 | 184 | |
| 219 | − /* Setup a temporary DTLB with a matching color. */ | |
| 185 | + /* Setup a temporary DTLB for source. */ | |
| 220 | 186 | |
| 221 | − movi a8, TLBTEMP_BASE_2 # base | |
| 222 | − add a7, a3, a5 # ppn | |
| 223 | − add a3, a8, a4 | |
| 187 | + addi a7, a5, PAGE_KERNEL | |
| 224 | 188 | addi a8, a3, 1 # way1 |
| 225 | 189 | |
| 226 | 190 | wdtlb a7, a8 |
| @@ -271,7 +235,7 @@ ENTRY(copy_user_page) · 44 unmodified lines | ||
| 271 | 235 | |
| 272 | 236 | retw |
| 273 | 237 | |
| 274 | −ENDPROC(copy_user_page) | |
| 238 | +ENDPROC(copy_page_alias) | |
| 275 | 239 | |
| 276 | 240 | #endif |
| 277 | 241 | |
| @@ -300,6 +264,30 @@ ENTRY(__flush_invalidate_dcache_page_alias) · 22 unmodified lines | ||
| 300 | 264 | retw |
| 301 | 265 | |
| 302 | 266 | ENDPROC(__flush_invalidate_dcache_page_alias) |
| 267 | + | |
| 268 | +/* | |
| 269 | + * void __invalidate_dcache_page_alias (addr, phys) | |
| 270 | + * a2 a3 | |
| 271 | + */ | |
| 272 | + | |
| 273 | +ENTRY(__invalidate_dcache_page_alias) | |
| 274 | + | |
| 275 | + entry sp, 16 | |
| 276 | + | |
| 277 | + movi a7, 0 # required for exception handler | |
| 278 | + addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE) | |
| 279 | + mov a4, a2 | |
| 280 | + wdtlb a6, a2 | |
| 281 | + dsync | |
| 282 | + | |
| 283 | + ___invalidate_dcache_page a2 a3 | |
| 284 | + | |
| 285 | + idtlb a4 | |
| 286 | + dsync | |
| 287 | + | |
| 288 | + retw | |
| 289 | + | |
| 290 | +ENDPROC(__invalidate_dcache_page_alias) | |
| 303 | 291 | #endif |
| 304 | 292 | |
| 305 | 293 | ENTRY(__tlbtemp_mapping_itlb) |
| @@ -18,32 +18,38 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <asm/io.h> |
| 19 | 19 | |
| 20 | 20 | #if defined(CONFIG_HIGHMEM) |
| 21 | −static void * __init init_pmd(unsigned long vaddr) | |
| 21 | +static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages) | |
| 22 | 22 | { |
| 23 | 23 | pgd_t *pgd = pgd_offset_k(vaddr); |
| 24 | 24 | pmd_t *pmd = pmd_offset(pgd, vaddr); |
| 25 | + pte_t *pte; | |
| 26 | + unsigned long i; | |
| 25 | 27 | |
| 26 | − if (pmd_none(*pmd)) { | |
| 27 | − unsigned i; | |
| 28 | − pte_t *pte = alloc_bootmem_low_pages(PAGE_SIZE); | |
| 28 | + n_pages = ALIGN(n_pages, PTRS_PER_PTE); | |
| 29 | 29 | |
| 30 | − for (i = 0; i < 1024; i++) | |
| 31 | − pte_clear(NULL, 0, pte + i); | |
| 30 | + pr_debug("%s: vaddr: 0x%08lx, n_pages: %ld\n", | |
| 31 | + __func__, vaddr, n_pages); | |
| 32 | 32 | |
| 33 | − set_pmd(pmd, __pmd(((unsigned long)pte) & PAGE_MASK)); | |
| 34 | − BUG_ON(pte != pte_offset_kernel(pmd, 0)); | |
| 35 | − pr_debug("%s: vaddr: 0x%08lx, pmd: 0x%p, pte: 0x%p\n", | |
| 36 | − __func__, vaddr, pmd, pte); | |
| 37 | − return pte; | |
| 38 | − } else { | |
| 39 | − return pte_offset_kernel(pmd, 0); | |
| 33 | + pte = alloc_bootmem_low_pages(n_pages * sizeof(pte_t)); | |
| 34 | + | |
| 35 | + for (i = 0; i < n_pages; ++i) | |
| 36 | + pte_clear(NULL, 0, pte + i); | |
| 37 | + | |
| 38 | + for (i = 0; i < n_pages; i += PTRS_PER_PTE, ++pmd) { | |
| 39 | + pte_t *cur_pte = pte + i; | |
| 40 | + | |
| 41 | + BUG_ON(!pmd_none(*pmd)); | |
| 42 | + set_pmd(pmd, __pmd(((unsigned long)cur_pte) & PAGE_MASK)); | |
| 43 | + BUG_ON(cur_pte != pte_offset_kernel(pmd, 0)); | |
| 44 | + pr_debug("%s: pmd: 0x%p, pte: 0x%p\n", | |
| 45 | + __func__, pmd, cur_pte); | |
| 40 | 46 | } |
| 47 | + return pte; | |
| 41 | 48 | } |
| 42 | 49 | |
| 43 | 50 | static void __init fixedrange_init(void) |
| 44 | 51 | { |
| 45 | − BUILD_BUG_ON(FIXADDR_SIZE > PMD_SIZE); | |
| 46 | − init_pmd(__fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK); | |
| 52 | + init_pmd(__fix_to_virt(0), __end_of_fixed_addresses); | |
| 47 | 53 | } |
| 48 | 54 | #endif |
| 49 | 55 | |
| @@ -52,7 +58,7 @@ void __init paging_init(void) · 2 unmodified lines | ||
| 52 | 58 | memset(swapper_pg_dir, 0, PAGE_SIZE); |
| 53 | 59 | #ifdef CONFIG_HIGHMEM |
| 54 | 60 | fixedrange_init(); |
| 55 | − pkmap_page_table = init_pmd(PKMAP_BASE); | |
| 61 | + pkmap_page_table = init_pmd(PKMAP_BASE, LAST_PKMAP); | |
| 56 | 62 | kmap_init(); |
| 57 | 63 | #endif |
| 58 | 64 | } |
| @@ -520,7 +520,7 @@ void bio_integrity_endio(struct bio *bio, int error) · 519 unmodified lines | ||
| 520 | 520 | */ |
| 521 | 521 | if (error) { |
| 522 | 522 | bio->bi_end_io = bip->bip_end_io; |
| 523 | − bio_endio(bio, error); | |
| 523 | + bio_endio_nodec(bio, error); | |
| 524 | 524 | |
| 525 | 525 | return; |
| 526 | 526 | } |
| @@ -1252,7 +1252,6 @@ void blk_rq_set_block_pc(struct request *rq) · 1251 unmodified lines | ||
| 1252 | 1252 | rq->__sector = (sector_t) -1; |
| 1253 | 1253 | rq->bio = rq->biotail = NULL; |
| 1254 | 1254 | memset(rq->__cmd, 0, sizeof(rq->__cmd)); |
| 1255 | − rq->cmd = rq->__cmd; | |
| 1256 | 1255 | } |
| 1257 | 1256 | EXPORT_SYMBOL(blk_rq_set_block_pc); |
| 1258 | 1257 | |
| @@ -112,18 +112,22 @@ static void blk_mq_usage_counter_release(struct percpu_ref *ref) · 111 unmodified lines | ||
| 112 | 112 | */ |
| 113 | 113 | void blk_mq_freeze_queue(struct request_queue *q) |
| 114 | 114 | { |
| 115 | + bool freeze; | |
| 116 | + | |
| 115 | 117 | spin_lock_irq(q->queue_lock); |
| 116 | − q->mq_freeze_depth++; | |
| 118 | + freeze = !q->mq_freeze_depth++; | |
| 117 | 119 | spin_unlock_irq(q->queue_lock); |
| 118 | 120 | |
| 119 | − percpu_ref_kill(&q->mq_usage_counter); | |
| 120 | − blk_mq_run_queues(q, false); | |
| 121 | + if (freeze) { | |
| 122 | + percpu_ref_kill(&q->mq_usage_counter); | |
| 123 | + blk_mq_run_queues(q, false); | |
| 124 | + } | |
| 121 | 125 | wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); |
| 122 | 126 | } |
| 123 | 127 | |
| 124 | 128 | static void blk_mq_unfreeze_queue(struct request_queue *q) |
| 125 | 129 | { |
| 126 | − bool wake = false; | |
| 130 | + bool wake; | |
| 127 | 131 | |
| 128 | 132 | spin_lock_irq(q->queue_lock); |
| 129 | 133 | wake = !--q->mq_freeze_depth; |
| @@ -172,6 +176,8 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx, · 42 unmodified lines | ||
| 172 | 176 | /* tag was already set */ |
| 173 | 177 | rq->errors = 0; |
| 174 | 178 | |
| 179 | + rq->cmd = rq->__cmd; | |
| 180 | + | |
| 175 | 181 | rq->extra_len = 0; |
| 176 | 182 | rq->sense_len = 0; |
| 177 | 183 | rq->resid_len = 0; |
| @@ -1068,13 +1074,17 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio) · 890 unmodified lines | ||
| 1068 | 1074 | blk_account_io_start(rq, 1); |
| 1069 | 1075 | } |
| 1070 | 1076 | |
| 1077 | +static inline bool hctx_allow_merges(struct blk_mq_hw_ctx *hctx) | |
| 1078 | +{ | |
| 1079 | + return (hctx->flags & BLK_MQ_F_SHOULD_MERGE) && | |
| 1080 | + !blk_queue_nomerges(hctx->queue); | |
| 1081 | +} | |
| 1082 | + | |
| 1071 | 1083 | static inline bool blk_mq_merge_queue_io(struct blk_mq_hw_ctx *hctx, |
| 1072 | 1084 | struct blk_mq_ctx *ctx, |
| 1073 | 1085 | struct request *rq, struct bio *bio) |
| 1074 | 1086 | { |
| 1075 | − struct request_queue *q = hctx->queue; | |
| 1076 | − | |
| 1077 | − if (!(hctx->flags & BLK_MQ_F_SHOULD_MERGE)) { | |
| 1087 | + if (!hctx_allow_merges(hctx)) { | |
| 1078 | 1088 | blk_mq_bio_to_request(rq, bio); |
| 1079 | 1089 | spin_lock(&ctx->lock); |
| 1080 | 1090 | insert_rq: |
| @@ -1082,6 +1092,8 @@ insert_rq: · 1 unmodified line | ||
| 1082 | 1092 | spin_unlock(&ctx->lock); |
| 1083 | 1093 | return false; |
| 1084 | 1094 | } else { |
| 1095 | + struct request_queue *q = hctx->queue; | |
| 1096 | + | |
| 1085 | 1097 | spin_lock(&ctx->lock); |
| 1086 | 1098 | if (!blk_mq_attempt_merge(q, ctx, bio)) { |
| 1087 | 1099 | blk_mq_bio_to_request(rq, bio); |
| @@ -1574,7 +1586,7 @@ static int blk_mq_init_hw_queues(struct request_queue *q, · 486 unmodified lines | ||
| 1574 | 1586 | hctx->tags = set->tags[i]; |
| 1575 | 1587 | |
| 1576 | 1588 | /* |
| 1577 | − * Allocate space for all possible cpus to avoid allocation in | |
| 1589 | + * Allocate space for all possible cpus to avoid allocation at | |
| 1578 | 1590 | * runtime |
| 1579 | 1591 | */ |
| 1580 | 1592 | hctx->ctxs = kmalloc_node(nr_cpu_ids * sizeof(void *), |
| @@ -1662,8 +1674,8 @@ static void blk_mq_map_swqueue(struct request_queue *q) · 81 unmodified lines | ||
| 1662 | 1674 | |
| 1663 | 1675 | queue_for_each_hw_ctx(q, hctx, i) { |
| 1664 | 1676 | /* |
| 1665 | − * If not software queues are mapped to this hardware queue, | |
| 1666 | − * disable it and free the request entries | |
| 1677 | + * If no software queues are mapped to this hardware queue, | |
| 1678 | + * disable it and free the request entries. | |
| 1667 | 1679 | */ |
| 1668 | 1680 | if (!hctx->nr_ctx) { |
| 1669 | 1681 | struct blk_mq_tag_set *set = q->tag_set; |
| @@ -1713,14 +1725,10 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q) · 43 unmodified lines | ||
| 1713 | 1725 | { |
| 1714 | 1726 | struct blk_mq_tag_set *set = q->tag_set; |
| 1715 | 1727 | |
| 1716 | − blk_mq_freeze_queue(q); | |
| 1717 | − | |
| 1718 | 1728 | mutex_lock(&set->tag_list_lock); |
| 1719 | 1729 | list_del_init(&q->tag_set_list); |
| 1720 | 1730 | blk_mq_update_tag_set_depth(set); |
| 1721 | 1731 | mutex_unlock(&set->tag_list_lock); |
| 1722 | − | |
| 1723 | − blk_mq_unfreeze_queue(q); | |
| 1724 | 1732 | } |
| 1725 | 1733 | |
| 1726 | 1734 | static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, |
| @@ -1272,15 +1272,22 @@ __cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) · 1271 unmodified lines | ||
| 1272 | 1272 | rb_insert_color(&cfqg->rb_node, &st->rb); |
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | +/* | |
| 1276 | + * This has to be called only on activation of cfqg | |
| 1277 | + */ | |
| 1275 | 1278 | static void |
| 1276 | 1279 | cfq_update_group_weight(struct cfq_group *cfqg) |
| 1277 | 1280 | { |
| 1278 | − BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); | |
| 1279 | − | |
| 1280 | 1281 | if (cfqg->new_weight) { |
| 1281 | 1282 | cfqg->weight = cfqg->new_weight; |
| 1282 | 1283 | cfqg->new_weight = 0; |
| 1283 | 1284 | } |
| 1285 | +} | |
| 1286 | + | |
| 1287 | +static void | |
| 1288 | +cfq_update_group_leaf_weight(struct cfq_group *cfqg) | |
| 1289 | +{ | |
| 1290 | + BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); | |
| 1284 | 1291 | |
| 1285 | 1292 | if (cfqg->new_leaf_weight) { |
| 1286 | 1293 | cfqg->leaf_weight = cfqg->new_leaf_weight; |
| @@ -1299,7 +1306,12 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) · 12 unmodified lines | ||
| 1299 | 1306 | /* add to the service tree */ |
| 1300 | 1307 | BUG_ON(!RB_EMPTY_NODE(&cfqg->rb_node)); |
| 1301 | 1308 | |
| 1302 | − cfq_update_group_weight(cfqg); | |
| 1309 | + /* | |
| 1310 | + * Update leaf_weight. We cannot update weight at this point | |
| 1311 | + * because cfqg might already have been activated and is | |
| 1312 | + * contributing its current weight to the parent's child_weight. | |
| 1313 | + */ | |
| 1314 | + cfq_update_group_leaf_weight(cfqg); | |
| 1303 | 1315 | __cfq_group_service_tree_add(st, cfqg); |
| 1304 | 1316 | |
| 1305 | 1317 | /* |
| @@ -1323,6 +1335,7 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg) · 17 unmodified lines | ||
| 1323 | 1335 | */ |
| 1324 | 1336 | while ((parent = cfqg_parent(pos))) { |
| 1325 | 1337 | if (propagate) { |
| 1338 | + cfq_update_group_weight(pos); | |
| 1326 | 1339 | propagate = !parent->nr_active++; |
| 1327 | 1340 | parent->children_weight += pos->weight; |
| 1328 | 1341 | } |
| @@ -279,7 +279,6 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, · 278 unmodified lines | ||
| 279 | 279 | r = blk_rq_unmap_user(bio); |
| 280 | 280 | if (!ret) |
| 281 | 281 | ret = r; |
| 282 | − blk_put_request(rq); | |
| 283 | 282 | |
| 284 | 283 | return ret; |
| 285 | 284 | } |
| @@ -297,8 +296,6 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, · 11 unmodified lines | ||
| 297 | 296 | |
| 298 | 297 | if (hdr->interface_id != 'S') |
| 299 | 298 | return -EINVAL; |
| 300 | − if (hdr->cmd_len > BLK_MAX_CDB) | |
| 301 | − return -EINVAL; | |
| 302 | 299 | |
| 303 | 300 | if (hdr->dxfer_len > (queue_max_hw_sectors(q) << 9)) |
| 304 | 301 | return -EIO; |
| @@ -317,16 +314,23 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, · 12 unmodified lines | ||
| 317 | 314 | if (hdr->flags & SG_FLAG_Q_AT_HEAD) |
| 318 | 315 | at_head = 1; |
| 319 | 316 | |
| 317 | + ret = -ENOMEM; | |
| 320 | 318 | rq = blk_get_request(q, writing ? WRITE : READ, GFP_KERNEL); |
| 321 | 319 | if (!rq) |
| 322 | − return -ENOMEM; | |
| 320 | + goto out; | |
| 323 | 321 | blk_rq_set_block_pc(rq); |
| 324 | 322 | |
| 325 | − if (blk_fill_sghdr_rq(q, rq, hdr, mode)) { | |
| 326 | − blk_put_request(rq); | |
| 327 | − return -EFAULT; | |
| 323 | + if (hdr->cmd_len > BLK_MAX_CDB) { | |
| 324 | + rq->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); | |
| 325 | + if (!rq->cmd) | |
| 326 | + goto out_put_request; | |
| 328 | 327 | } |
| 329 | 328 | |
| 329 | + ret = -EFAULT; | |
| 330 | + if (blk_fill_sghdr_rq(q, rq, hdr, mode)) | |
| 331 | + goto out_free_cdb; | |
| 332 | + | |
| 333 | + ret = 0; | |
| 330 | 334 | if (hdr->iovec_count) { |
| 331 | 335 | size_t iov_data_len; |
| 332 | 336 | struct iovec *iov = NULL; |
| @@ -335,7 +339,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, · 2 unmodified lines | ||
| 335 | 339 | 0, NULL, &iov); |
| 336 | 340 | if (ret < 0) { |
| 337 | 341 | kfree(iov); |
| 338 | − goto out; | |
| 342 | + goto out_free_cdb; | |
| 339 | 343 | } |
| 340 | 344 | |
| 341 | 345 | iov_data_len = ret; |
| @@ -358,7 +362,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, · 16 unmodified lines | ||
| 358 | 362 | GFP_KERNEL); |
| 359 | 363 | |
| 360 | 364 | if (ret) |
| 361 | − goto out; | |
| 365 | + goto out_free_cdb; | |
| 362 | 366 | |
| 363 | 367 | bio = rq->bio; |
| 364 | 368 | memset(sense, 0, sizeof(sense)); |
| @@ -376,9 +380,14 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, · 11 unmodified lines | ||
| 376 | 380 | |
| 377 | 381 | hdr->duration = jiffies_to_msecs(jiffies - start_time); |
| 378 | 382 | |
| 379 | − return blk_complete_sghdr_rq(rq, hdr, bio); | |
| 380 | −out: | |
| 383 | + ret = blk_complete_sghdr_rq(rq, hdr, bio); | |
| 384 | + | |
| 385 | +out_free_cdb: | |
| 386 | + if (rq->cmd != rq->__cmd) | |
| 387 | + kfree(rq->cmd); | |
| 388 | +out_put_request: | |
| 381 | 389 | blk_put_request(rq); |
| 390 | +out: | |
| 382 | 391 | return ret; |
| 383 | 392 | } |
| 384 | 393 | |
| @@ -448,6 +457,11 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, · 63 unmodified lines | ||
| 448 | 457 | } |
| 449 | 458 | |
| 450 | 459 | rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); |
| 460 | + if (!rq) { | |
| 461 | + err = -ENOMEM; | |
| 462 | + goto error; | |
| 463 | + } | |
| 464 | + blk_rq_set_block_pc(rq); | |
| 451 | 465 | |
| 452 | 466 | cmdlen = COMMAND_SIZE(opcode); |
| 453 | 467 | |
| @@ -501,7 +515,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, · 47 unmodified lines | ||
| 501 | 515 | memset(sense, 0, sizeof(sense)); |
| 502 | 516 | rq->sense = sense; |
| 503 | 517 | rq->sense_len = 0; |
| 504 | − blk_rq_set_block_pc(rq); | |
| 505 | 518 | |
| 506 | 519 | blk_execute_rq(q, disk, rq, 0); |
| 507 | 520 | |
| @@ -521,7 +534,8 @@ out: · 13 unmodified lines | ||
| 521 | 534 | |
| 522 | 535 | error: |
| 523 | 536 | kfree(buffer); |
| 524 | − blk_put_request(rq); | |
| 537 | + if (rq) | |
| 538 | + blk_put_request(rq); | |
| 525 | 539 | return err; |
| 526 | 540 | } |
| 527 | 541 | EXPORT_SYMBOL_GPL(sg_scsi_ioctl); |
| @@ -121,6 +121,7 @@ static int public_key_verify_signature_2(const struct key *key, · 120 unmodified lines | ||
| 121 | 121 | struct asymmetric_key_subtype public_key_subtype = { |
| 122 | 122 | .owner = THIS_MODULE, |
| 123 | 123 | .name = "public_key", |
| 124 | + .name_len = sizeof("public_key") - 1, | |
| 124 | 125 | .describe = public_key_describe, |
| 125 | 126 | .destroy = public_key_destroy, |
| 126 | 127 | .verify_signature = public_key_verify_signature_2, |
| @@ -128,6 +128,7 @@ static int pefile_strip_sig_wrapper(const void *pebuf, · 127 unmodified lines | ||
| 128 | 128 | { |
| 129 | 129 | struct win_certificate wrapper; |
| 130 | 130 | const u8 *pkcs7; |
| 131 | + unsigned len; | |
| 131 | 132 | |
| 132 | 133 | if (ctx->sig_len < sizeof(wrapper)) { |
| 133 | 134 | pr_debug("Signature wrapper too short\n"); |
| @@ -154,33 +155,49 @@ static int pefile_strip_sig_wrapper(const void *pebuf, · 20 unmodified lines | ||
| 154 | 155 | return -ENOTSUPP; |
| 155 | 156 | } |
| 156 | 157 | |
| 157 | − /* Looks like actual pkcs signature length is in wrapper->length. | |
| 158 | − * size obtained from data dir entries lists the total size of | |
| 159 | − * certificate table which is also aligned to octawrod boundary. | |
| 160 | − * | |
| 161 | − * So set signature length field appropriately. | |
| 158 | + /* It looks like the pkcs signature length in wrapper->length and the | |
| 159 | + * size obtained from the data dir entries, which lists the total size | |
| 160 | + * of certificate table, are both aligned to an octaword boundary, so | |
| 161 | + * we may have to deal with some padding. | |
| 162 | 162 | */ |
| 163 | 163 | ctx->sig_len = wrapper.length; |
| 164 | 164 | ctx->sig_offset += sizeof(wrapper); |
| 165 | 165 | ctx->sig_len -= sizeof(wrapper); |
| 166 | − if (ctx->sig_len == 0) { | |
| 166 | + if (ctx->sig_len < 4) { | |
| 167 | 167 | pr_debug("Signature data missing\n"); |
| 168 | 168 | return -EKEYREJECTED; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | − /* What's left should a PKCS#7 cert */ | |
| 171 | + /* What's left should be a PKCS#7 cert */ | |
| 172 | 172 | pkcs7 = pebuf + ctx->sig_offset; |
| 173 | − if (pkcs7[0] == (ASN1_CONS_BIT | ASN1_SEQ)) { | |
| 174 | − if (pkcs7[1] == 0x82 && | |
| 175 | − pkcs7[2] == (((ctx->sig_len - 4) >> 8) & 0xff) && | |
| 176 | − pkcs7[3] == ((ctx->sig_len - 4) & 0xff)) | |
| 177 | − return 0; | |
| 178 | − if (pkcs7[1] == 0x80) | |
| 179 | − return 0; | |
| 180 | − if (pkcs7[1] > 0x82) | |
| 181 | − return -EMSGSIZE; | |
| 173 | + if (pkcs7[0] != (ASN1_CONS_BIT | ASN1_SEQ)) | |
| 174 | + goto not_pkcs7; | |
| 175 | + | |
| 176 | + switch (pkcs7[1]) { | |
| 177 | + case 0 ... 0x7f: | |
| 178 | + len = pkcs7[1] + 2; | |
| 179 | + goto check_len; | |
| 180 | + case ASN1_INDEFINITE_LENGTH: | |
| 181 | + return 0; | |
| 182 | + case 0x81: | |
| 183 | + len = pkcs7[2] + 3; | |
| 184 | + goto check_len; | |
| 185 | + case 0x82: | |
| 186 | + len = ((pkcs7[2] << 8) | pkcs7[3]) + 4; | |
| 187 | + goto check_len; | |
| 188 | + case 0x83 ... 0xff: | |
| 189 | + return -EMSGSIZE; | |
| 190 | + default: | |
| 191 | + goto not_pkcs7; | |
| 182 | 192 | } |
| 183 | 193 | |
| 194 | +check_len: | |
| 195 | + if (len <= ctx->sig_len) { | |
| 196 | + /* There may be padding */ | |
| 197 | + ctx->sig_len = len; | |
| 198 | + return 0; | |
| 199 | + } | |
| 200 | +not_pkcs7: | |
| 184 | 201 | pr_debug("Signature data not PKCS#7\n"); |
| 185 | 202 | return -ELIBBAD; |
| 186 | 203 | } |
| @@ -196,6 +196,17 @@ static struct lpss_device_desc byt_i2c_dev_desc = { · 195 unmodified lines | ||
| 196 | 196 | .setup = lpss_i2c_setup, |
| 197 | 197 | }; |
| 198 | 198 | |
| 199 | +static struct lpss_shared_clock bsw_pwm_clock = { | |
| 200 | + .name = "pwm_clk", | |
| 201 | + .rate = 19200000, | |
| 202 | +}; | |
| 203 | + | |
| 204 | +static struct lpss_device_desc bsw_pwm_dev_desc = { | |
| 205 | + .clk_required = true, | |
| 206 | + .save_ctx = true, | |
| 207 | + .shared_clock = &bsw_pwm_clock, | |
| 208 | +}; | |
| 209 | + | |
| 199 | 210 | #else |
| 200 | 211 | |
| 201 | 212 | #define LPSS_ADDR(desc) (0UL) |
| @@ -225,6 +236,12 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { · 23 unmodified lines | ||
| 225 | 236 | { "INT33B2", }, |
| 226 | 237 | { "INT33FC", }, |
| 227 | 238 | |
| 239 | + /* Braswell LPSS devices */ | |
| 240 | + { "80862288", LPSS_ADDR(bsw_pwm_dev_desc) }, | |
| 241 | + { "8086228A", LPSS_ADDR(byt_uart_dev_desc) }, | |
| 242 | + { "8086228E", LPSS_ADDR(byt_spi_dev_desc) }, | |
| 243 | + { "808622C1", LPSS_ADDR(byt_i2c_dev_desc) }, | |
| 244 | + | |
| 228 | 245 | { "INT3430", LPSS_ADDR(lpt_dev_desc) }, |
| 229 | 246 | { "INT3431", LPSS_ADDR(lpt_dev_desc) }, |
| 230 | 247 | { "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) }, |
| @@ -316,6 +316,45 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, · 315 unmodified lines | ||
| 316 | 316 | acpi_ns_check_package_list(info, package, elements, count); |
| 317 | 317 | break; |
| 318 | 318 | |
| 319 | + case ACPI_PTYPE2_UUID_PAIR: | |
| 320 | + | |
| 321 | + /* The package must contain pairs of (UUID + type) */ | |
| 322 | + | |
| 323 | + if (count & 1) { | |
| 324 | + expected_count = count + 1; | |
| 325 | + goto package_too_small; | |
| 326 | + } | |
| 327 | + | |
| 328 | + while (count > 0) { | |
| 329 | + status = acpi_ns_check_object_type(info, elements, | |
| 330 | + package->ret_info. | |
| 331 | + object_type1, 0); | |
| 332 | + if (ACPI_FAILURE(status)) { | |
| 333 | + return (status); | |
| 334 | + } | |
| 335 | + | |
| 336 | + /* Validate length of the UUID buffer */ | |
| 337 | + | |
| 338 | + if ((*elements)->buffer.length != 16) { | |
| 339 | + ACPI_WARN_PREDEFINED((AE_INFO, | |
| 340 | + info->full_pathname, | |
| 341 | + info->node_flags, | |
| 342 | + "Invalid length for UUID Buffer")); | |
| 343 | + return (AE_AML_OPERAND_VALUE); | |
| 344 | + } | |
| 345 | + | |
| 346 | + status = acpi_ns_check_object_type(info, elements + 1, | |
| 347 | + package->ret_info. | |
| 348 | + object_type2, 0); | |
| 349 | + if (ACPI_FAILURE(status)) { | |
| 350 | + return (status); | |
| 351 | + } | |
| 352 | + | |
| 353 | + elements += 2; | |
| 354 | + count -= 2; | |
| 355 | + } | |
| 356 | + break; | |
| 357 | + | |
| 319 | 358 | default: |
| 320 | 359 | |
| 321 | 360 | /* Should not get here if predefined info table is correct */ |
| @@ -197,6 +197,8 @@ static bool advance_transaction(struct acpi_ec *ec) · 196 unmodified lines | ||
| 197 | 197 | t->rdata[t->ri++] = acpi_ec_read_data(ec); |
| 198 | 198 | if (t->rlen == t->ri) { |
| 199 | 199 | t->flags |= ACPI_EC_COMMAND_COMPLETE; |
| 200 | + if (t->command == ACPI_EC_COMMAND_QUERY) | |
| 201 | + pr_debug("hardware QR_EC completion\n"); | |
| 200 | 202 | wakeup = true; |
| 201 | 203 | } |
| 202 | 204 | } else |
| @@ -208,7 +210,20 @@ static bool advance_transaction(struct acpi_ec *ec) · 5 unmodified lines | ||
| 208 | 210 | } |
| 209 | 211 | return wakeup; |
| 210 | 212 | } else { |
| 211 | − if ((status & ACPI_EC_FLAG_IBF) == 0) { | |
| 213 | + /* | |
| 214 | + * There is firmware refusing to respond QR_EC when SCI_EVT | |
| 215 | + * is not set, for which case, we complete the QR_EC | |
| 216 | + * without issuing it to the firmware. | |
| 217 | + * https://bugzilla.kernel.org/show_bug.cgi?id=86211 | |
| 218 | + */ | |
| 219 | + if (!(status & ACPI_EC_FLAG_SCI) && | |
| 220 | + (t->command == ACPI_EC_COMMAND_QUERY)) { | |
| 221 | + t->flags |= ACPI_EC_COMMAND_POLL; | |
| 222 | + t->rdata[t->ri++] = 0x00; | |
| 223 | + t->flags |= ACPI_EC_COMMAND_COMPLETE; | |
| 224 | + pr_debug("software QR_EC completion\n"); | |
| 225 | + wakeup = true; | |
| 226 | + } else if ((status & ACPI_EC_FLAG_IBF) == 0) { | |
| 212 | 227 | acpi_ec_write_cmd(ec, t->command); |
| 213 | 228 | t->flags |= ACPI_EC_COMMAND_POLL; |
| 214 | 229 | } else |
| @@ -288,11 +303,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, · 73 unmodified lines | ||
| 288 | 303 | /* following two actions should be kept atomic */ |
| 289 | 304 | ec->curr = t; |
| 290 | 305 | start_transaction(ec); |
| 291 | − if (ec->curr->command == ACPI_EC_COMMAND_QUERY) | |
| 292 | − clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | |
| 293 | 306 | spin_unlock_irqrestore(&ec->lock, tmp); |
| 294 | 307 | ret = ec_poll(ec); |
| 295 | 308 | spin_lock_irqsave(&ec->lock, tmp); |
| 309 | + if (ec->curr->command == ACPI_EC_COMMAND_QUERY) | |
| 310 | + clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | |
| 296 | 311 | ec->curr = NULL; |
| 297 | 312 | spin_unlock_irqrestore(&ec->lock, tmp); |
| 298 | 313 | return ret; |
| @@ -1015,6 +1030,10 @@ static struct dmi_system_id ec_dmi_table[] __initdata = { · 716 unmodified lines | ||
| 1015 | 1030 | DMI_MATCH(DMI_SYS_VENDOR, "Quanta"), |
| 1016 | 1031 | DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL}, |
| 1017 | 1032 | { |
| 1033 | + ec_flag_msi, "Clevo W350etq", { | |
| 1034 | + DMI_MATCH(DMI_SYS_VENDOR, "CLEVO CO."), | |
| 1035 | + DMI_MATCH(DMI_PRODUCT_NAME, "W35_37ET"),}, NULL}, | |
| 1036 | + { | |
| 1018 | 1037 | ec_validate_ecdt, "ASUS hardware", { |
| 1019 | 1038 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, |
| 1020 | 1039 | { |
| @@ -484,6 +484,10 @@ void acpi_pci_irq_disable(struct pci_dev *dev) · 483 unmodified lines | ||
| 484 | 484 | /* Keep IOAPIC pin configuration when suspending */ |
| 485 | 485 | if (dev->dev.power.is_prepared) |
| 486 | 486 | return; |
| 487 | +#ifdef CONFIG_PM_RUNTIME | |
| 488 | + if (dev->dev.power.runtime_status == RPM_SUSPENDING) | |
| 489 | + return; | |
| 490 | +#endif | |
| 487 | 491 | |
| 488 | 492 | entry = acpi_pci_irq_lookup(dev, pin); |
| 489 | 493 | if (!entry) |
| @@ -1071,9 +1071,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) · 1070 unmodified lines | ||
| 1071 | 1071 | |
| 1072 | 1072 | if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { |
| 1073 | 1073 | |
| 1074 | − cpuidle_pause_and_lock(); | |
| 1075 | 1074 | /* Protect against cpu-hotplug */ |
| 1076 | 1075 | get_online_cpus(); |
| 1076 | + cpuidle_pause_and_lock(); | |
| 1077 | 1077 | |
| 1078 | 1078 | /* Disable all cpuidle devices */ |
| 1079 | 1079 | for_each_online_cpu(cpu) { |
| @@ -1100,8 +1100,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) · 20 unmodified lines | ||
| 1100 | 1100 | cpuidle_enable_device(dev); |
| 1101 | 1101 | } |
| 1102 | 1102 | } |
| 1103 | − put_online_cpus(); | |
| 1104 | 1103 | cpuidle_resume_and_unlock(); |
| 1104 | + put_online_cpus(); | |
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | return 0; |
| @@ -667,8 +667,14 @@ static ssize_t · 666 unmodified lines | ||
| 667 | 667 | acpi_device_sun_show(struct device *dev, struct device_attribute *attr, |
| 668 | 668 | char *buf) { |
| 669 | 669 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
| 670 | + acpi_status status; | |
| 671 | + unsigned long long sun; | |
| 672 | + | |
| 673 | + status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun); | |
| 674 | + if (ACPI_FAILURE(status)) | |
| 675 | + return -ENODEV; | |
| 670 | 676 | |
| 671 | − return sprintf(buf, "%lu\n", acpi_dev->pnp.sun); | |
| 677 | + return sprintf(buf, "%llu\n", sun); | |
| 672 | 678 | } |
| 673 | 679 | static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); |
| 674 | 680 | |
| @@ -690,7 +696,6 @@ static int acpi_device_setup_files(struct acpi_device *dev) · 15 unmodified lines | ||
| 690 | 696 | { |
| 691 | 697 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
| 692 | 698 | acpi_status status; |
| 693 | − unsigned long long sun; | |
| 694 | 699 | int result = 0; |
| 695 | 700 | |
| 696 | 701 | /* |
| @@ -731,14 +736,10 @@ static int acpi_device_setup_files(struct acpi_device *dev) · 34 unmodified lines | ||
| 731 | 736 | if (dev->pnp.unique_id) |
| 732 | 737 | result = device_create_file(&dev->dev, &dev_attr_uid); |
| 733 | 738 | |
| 734 | − status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun); | |
| 735 | − if (ACPI_SUCCESS(status)) { | |
| 736 | − dev->pnp.sun = (unsigned long)sun; | |
| 739 | + if (acpi_has_method(dev->handle, "_SUN")) { | |
| 737 | 740 | result = device_create_file(&dev->dev, &dev_attr_sun); |
| 738 | 741 | if (result) |
| 739 | 742 | goto end; |
| 740 | − } else { | |
| 741 | − dev->pnp.sun = (unsigned long)-1; | |
| 742 | 743 | } |
| 743 | 744 | |
| 744 | 745 | if (acpi_has_method(dev->handle, "_STA")) { |
| @@ -922,12 +923,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data) · 177 unmodified lines | ||
| 922 | 923 | device->driver->ops.notify(device, event); |
| 923 | 924 | } |
| 924 | 925 | |
| 925 | −static acpi_status acpi_device_notify_fixed(void *data) | |
| 926 | +static void acpi_device_notify_fixed(void *data) | |
| 926 | 927 | { |
| 927 | 928 | struct acpi_device *device = data; |
| 928 | 929 | |
| 929 | 930 | /* Fixed hardware devices have no handles */ |
| 930 | 931 | acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); |
| 932 | +} | |
| 933 | + | |
| 934 | +static acpi_status acpi_device_fixed_event(void *data) | |
| 935 | +{ | |
| 936 | + acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data); | |
| 931 | 937 | return AE_OK; |
| 932 | 938 | } |
| 933 | 939 | |
| @@ -938,12 +944,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device) · 4 unmodified lines | ||
| 938 | 944 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) |
| 939 | 945 | status = |
| 940 | 946 | acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, |
| 941 | − acpi_device_notify_fixed, | |
| 947 | + acpi_device_fixed_event, | |
| 942 | 948 | device); |
| 943 | 949 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) |
| 944 | 950 | status = |
| 945 | 951 | acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, |
| 946 | − acpi_device_notify_fixed, | |
| 952 | + acpi_device_fixed_event, | |
| 947 | 953 | device); |
| 948 | 954 | else |
| 949 | 955 | status = acpi_install_notify_handler(device->handle, |
| @@ -960,10 +966,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) · 10 unmodified lines | ||
| 960 | 966 | { |
| 961 | 967 | if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) |
| 962 | 968 | acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, |
| 963 | − acpi_device_notify_fixed); | |
| 969 | + acpi_device_fixed_event); | |
| 964 | 970 | else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) |
| 965 | 971 | acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, |
| 966 | − acpi_device_notify_fixed); | |
| 972 | + acpi_device_fixed_event); | |
| 967 | 973 | else |
| 968 | 974 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, |
| 969 | 975 | acpi_device_notify); |
| @@ -975,7 +981,7 @@ static int acpi_device_probe(struct device *dev) · 5 unmodified lines | ||
| 975 | 981 | struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); |
| 976 | 982 | int ret; |
| 977 | 983 | |
| 978 | − if (acpi_dev->handler) | |
| 984 | + if (acpi_dev->handler && !acpi_is_pnp_device(acpi_dev)) | |
| 979 | 985 | return -EINVAL; |
| 980 | 986 | |
| 981 | 987 | if (!acpi_drv->ops.add) |
| @@ -82,9 +82,9 @@ module_param(allow_duplicates, bool, 0644); · 81 unmodified lines | ||
| 82 | 82 | * For Windows 8 systems: used to decide if video module |
| 83 | 83 | * should skip registering backlight interface of its own. |
| 84 | 84 | */ |
| 85 | −static int use_native_backlight_param = 1; | |
| 85 | +static int use_native_backlight_param = -1; | |
| 86 | 86 | module_param_named(use_native_backlight, use_native_backlight_param, int, 0444); |
| 87 | −static bool use_native_backlight_dmi = false; | |
| 87 | +static bool use_native_backlight_dmi = true; | |
| 88 | 88 | |
| 89 | 89 | static int register_count; |
| 90 | 90 | static struct mutex video_list_lock; |
| @@ -417,6 +417,12 @@ static int __init video_set_use_native_backlight(const struct dmi_system_id *d) · 326 unmodified lines | ||
| 417 | 417 | return 0; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | +static int __init video_disable_native_backlight(const struct dmi_system_id *d) | |
| 421 | +{ | |
| 422 | + use_native_backlight_dmi = false; | |
| 423 | + return 0; | |
| 424 | +} | |
| 425 | + | |
| 420 | 426 | static struct dmi_system_id video_dmi_table[] __initdata = { |
| 421 | 427 | /* |
| 422 | 428 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
| @@ -720,6 +726,41 @@ static struct dmi_system_id video_dmi_table[] __initdata = { · 297 unmodified lines | ||
| 720 | 726 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), |
| 721 | 727 | }, |
| 722 | 728 | }, |
| 729 | + | |
| 730 | + /* | |
| 731 | + * These models have a working acpi_video backlight control, and using | |
| 732 | + * native backlight causes a regression where backlight does not work | |
| 733 | + * when userspace is not handling brightness key events. Disable | |
| 734 | + * native_backlight on these to fix this: | |
| 735 | + * https://bugzilla.kernel.org/show_bug.cgi?id=81691 | |
| 736 | + */ | |
| 737 | + { | |
| 738 | + .callback = video_disable_native_backlight, | |
| 739 | + .ident = "ThinkPad T420", | |
| 740 | + .matches = { | |
| 741 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 742 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"), | |
| 743 | + }, | |
| 744 | + }, | |
| 745 | + { | |
| 746 | + .callback = video_disable_native_backlight, | |
| 747 | + .ident = "ThinkPad T520", | |
| 748 | + .matches = { | |
| 749 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 750 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"), | |
| 751 | + }, | |
| 752 | + }, | |
| 753 | + | |
| 754 | + /* The native backlight controls do not work on some older machines */ | |
| 755 | + { | |
| 756 | + /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */ | |
| 757 | + .callback = video_disable_native_backlight, | |
| 758 | + .ident = "HP ENVY 15 Notebook", | |
| 759 | + .matches = { | |
| 760 | + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | |
| 761 | + DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"), | |
| 762 | + }, | |
| 763 | + }, | |
| 723 | 764 | {} |
| 724 | 765 | }; |
| 725 | 766 | |
| @@ -305,6 +305,14 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 304 unmodified lines | ||
| 305 | 305 | { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ |
| 306 | 306 | { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ |
| 307 | 307 | { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ |
| 308 | + { PCI_VDEVICE(INTEL, 0x8c82), board_ahci }, /* 9 Series AHCI */ | |
| 309 | + { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series AHCI */ | |
| 310 | + { PCI_VDEVICE(INTEL, 0x8c84), board_ahci }, /* 9 Series RAID */ | |
| 311 | + { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series RAID */ | |
| 312 | + { PCI_VDEVICE(INTEL, 0x8c86), board_ahci }, /* 9 Series RAID */ | |
| 313 | + { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ | |
| 314 | + { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ | |
| 315 | + { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ | |
| 308 | 316 | |
| 309 | 317 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
| 310 | 318 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| @@ -442,6 +450,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 131 unmodified lines | ||
| 442 | 450 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), |
| 443 | 451 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ |
| 444 | 452 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172), |
| 453 | + .driver_data = board_ahci_yes_fbs }, /* 88se9182 */ | |
| 454 | + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9182), | |
| 445 | 455 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ |
| 446 | 456 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), |
| 447 | 457 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ |
| @@ -1329,6 +1339,18 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 881 unmodified lines | ||
| 1329 | 1339 | else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) |
| 1330 | 1340 | ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; |
| 1331 | 1341 | |
| 1342 | + /* | |
| 1343 | + * The JMicron chip 361/363 contains one SATA controller and one | |
| 1344 | + * PATA controller,for powering on these both controllers, we must | |
| 1345 | + * follow the sequence one by one, otherwise one of them can not be | |
| 1346 | + * powered on successfully, so here we disable the async suspend | |
| 1347 | + * method for these chips. | |
| 1348 | + */ | |
| 1349 | + if (pdev->vendor == PCI_VENDOR_ID_JMICRON && | |
| 1350 | + (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 || | |
| 1351 | + pdev->device == PCI_DEVICE_ID_JMICRON_JMB361)) | |
| 1352 | + device_disable_async_suspend(&pdev->dev); | |
| 1353 | + | |
| 1332 | 1354 | /* acquire resources */ |
| 1333 | 1355 | rc = pcim_enable_device(pdev); |
| 1334 | 1356 | if (rc) |
| @@ -18,14 +18,17 @@ · 17 unmodified lines | ||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | #include <linux/ahci_platform.h> |
| 21 | −#include <linux/reset.h> | |
| 22 | 21 | #include <linux/errno.h> |
| 23 | 22 | #include <linux/kernel.h> |
| 24 | 23 | #include <linux/module.h> |
| 25 | 24 | #include <linux/of_device.h> |
| 26 | 25 | #include <linux/platform_device.h> |
| 27 | 26 | #include <linux/regulator/consumer.h> |
| 27 | +#include <linux/reset.h> | |
| 28 | + | |
| 29 | +#include <soc/tegra/fuse.h> | |
| 28 | 30 | #include <soc/tegra/pmc.h> |
| 31 | + | |
| 29 | 32 | #include "ahci.h" |
| 30 | 33 | |
| 31 | 34 | #define SATA_CONFIGURATION_0 0x180 |
| @@ -180,9 +183,12 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv) · 148 unmodified lines | ||
| 180 | 183 | |
| 181 | 184 | /* Pad calibration */ |
| 182 | 185 | |
| 183 | − /* FIXME Always use calibration 0. Change this to read the calibration | |
| 184 | − * fuse once the fuse driver has landed. */ | |
| 185 | − val = 0; | |
| 186 | + ret = tegra_fuse_readl(FUSE_SATA_CALIB, &val); | |
| 187 | + if (ret) { | |
| 188 | + dev_err(&tegra->pdev->dev, | |
| 189 | + "failed to read calibration fuse: %d\n", ret); | |
| 190 | + return ret; | |
| 191 | + } | |
| 186 | 192 | |
| 187 | 193 | calib = tegra124_pad_calibration[val & FUSE_SATA_CALIB_MASK]; |
| 188 | 194 | |
| @@ -78,6 +78,9 @@ · 77 unmodified lines | ||
| 78 | 78 | #define CFG_MEM_RAM_SHUTDOWN 0x00000070 |
| 79 | 79 | #define BLOCK_MEM_RDY 0x00000074 |
| 80 | 80 | |
| 81 | +/* Max retry for link down */ | |
| 82 | +#define MAX_LINK_DOWN_RETRY 3 | |
| 83 | + | |
| 81 | 84 | struct xgene_ahci_context { |
| 82 | 85 | struct ahci_host_priv *hpriv; |
| 83 | 86 | struct device *dev; |
| @@ -145,6 +148,14 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) · 61 unmodified lines | ||
| 145 | 148 | return rc; |
| 146 | 149 | } |
| 147 | 150 | |
| 151 | +static bool xgene_ahci_is_memram_inited(struct xgene_ahci_context *ctx) | |
| 152 | +{ | |
| 153 | + void __iomem *diagcsr = ctx->csr_diag; | |
| 154 | + | |
| 155 | + return (readl(diagcsr + CFG_MEM_RAM_SHUTDOWN) == 0 && | |
| 156 | + readl(diagcsr + BLOCK_MEM_RDY) == 0xFFFFFFFF); | |
| 157 | +} | |
| 158 | + | |
| 148 | 159 | /** |
| 149 | 160 | * xgene_ahci_read_id - Read ID data from the specified device |
| 150 | 161 | * @dev: device |
| @@ -229,8 +240,11 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel) · 78 unmodified lines | ||
| 229 | 240 | * and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will |
| 230 | 241 | * report disparity error and etc. In addition, during COMRESET, there can |
| 231 | 242 | * be error reported in the register PORT_SCR_ERR. For SERR_DISPARITY and |
| 232 | − * SERR_10B_8B_ERR, the PHY receiver line must be reseted. The following | |
| 233 | − * algorithm is followed to proper configure the hardware PHY during COMRESET: | |
| 243 | + * SERR_10B_8B_ERR, the PHY receiver line must be reseted. Also during long | |
| 244 | + * reboot cycle regression, sometimes the PHY reports link down even if the | |
| 245 | + * device is present because of speed negotiation failure. so need to retry | |
| 246 | + * the COMRESET to get the link up. The following algorithm is followed to | |
| 247 | + * proper configure the hardware PHY during COMRESET: | |
| 234 | 248 | * |
| 235 | 249 | * Alg Part 1: |
| 236 | 250 | * 1. Start the PHY at Gen3 speed (default setting) |
| @@ -246,9 +260,15 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel) · 9 unmodified lines | ||
| 246 | 260 | * Alg Part 2: |
| 247 | 261 | * 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error |
| 248 | 262 | * reported in the register PORT_SCR_ERR, then reset the PHY receiver line |
| 249 | − * 2. Go to Alg Part 3 | |
| 263 | + * 2. Go to Alg Part 4 | |
| 250 | 264 | * |
| 251 | 265 | * Alg Part 3: |
| 266 | + * 1. Check the PORT_SCR_STAT to see whether device presence detected but PHY | |
| 267 | + * communication establishment failed and maximum link down attempts are | |
| 268 | + * less than Max attempts 3 then goto Alg Part 1. | |
| 269 | + * 2. Go to Alg Part 4. | |
| 270 | + * | |
| 271 | + * Alg Part 4: | |
| 252 | 272 | * 1. Clear any pending from register PORT_SCR_ERR. |
| 253 | 273 | * |
| 254 | 274 | * NOTE: For the initial version, we will NOT support Gen1/Gen2. In addition |
| @@ -267,19 +287,27 @@ static int xgene_ahci_do_hardreset(struct ata_link *link, · 12 unmodified lines | ||
| 267 | 287 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; |
| 268 | 288 | void __iomem *port_mmio = ahci_port_base(ap); |
| 269 | 289 | struct ata_taskfile tf; |
| 290 | + int link_down_retry = 0; | |
| 270 | 291 | int rc; |
| 271 | − u32 val; | |
| 272 | − | |
| 273 | − /* clear D2H reception area to properly wait for D2H FIS */ | |
| 274 | − ata_tf_init(link->device, &tf); | |
| 275 | − tf.command = ATA_BUSY; | |
| 276 | − ata_tf_to_fis(&tf, 0, 0, d2h_fis); | |
| 277 | − rc = sata_link_hardreset(link, timing, deadline, online, | |
| 292 | + u32 val, sstatus; | |
| 293 | + | |
| 294 | + do { | |
| 295 | + /* clear D2H reception area to properly wait for D2H FIS */ | |
| 296 | + ata_tf_init(link->device, &tf); | |
| 297 | + tf.command = ATA_BUSY; | |
| 298 | + ata_tf_to_fis(&tf, 0, 0, d2h_fis); | |
| 299 | + rc = sata_link_hardreset(link, timing, deadline, online, | |
| 278 | 300 | ahci_check_ready); |
| 301 | + if (*online) { | |
| 302 | + val = readl(port_mmio + PORT_SCR_ERR); | |
| 303 | + if (val & (SERR_DISPARITY | SERR_10B_8B_ERR)) | |
| 304 | + dev_warn(ctx->dev, "link has error\n"); | |
| 305 | + break; | |
| 306 | + } | |
| 279 | 307 | |
| 280 | − val = readl(port_mmio + PORT_SCR_ERR); | |
| 281 | − if (val & (SERR_DISPARITY | SERR_10B_8B_ERR)) | |
| 282 | − dev_warn(ctx->dev, "link has error\n"); | |
| 308 | + sata_scr_read(link, SCR_STATUS, &sstatus); | |
| 309 | + } while (link_down_retry++ < MAX_LINK_DOWN_RETRY && | |
| 310 | + (sstatus & 0xff) == 0x1); | |
| 283 | 311 | |
| 284 | 312 | /* clear all errors if any pending */ |
| 285 | 313 | val = readl(port_mmio + PORT_SCR_ERR); |
| @@ -467,6 +495,11 @@ static int xgene_ahci_probe(struct platform_device *pdev) · 181 unmodified lines | ||
| 467 | 495 | return -ENODEV; |
| 468 | 496 | } |
| 469 | 497 | |
| 498 | + if (xgene_ahci_is_memram_inited(ctx)) { | |
| 499 | + dev_info(dev, "skip clock and PHY initialization\n"); | |
| 500 | + goto skip_clk_phy; | |
| 501 | + } | |
| 502 | + | |
| 470 | 503 | /* Due to errata, HW requires full toggle transition */ |
| 471 | 504 | rc = ahci_platform_enable_clks(hpriv); |
| 472 | 505 | if (rc) |
| @@ -479,7 +512,7 @@ static int xgene_ahci_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 479 | 512 | |
| 480 | 513 | /* Configure the host controller */ |
| 481 | 514 | xgene_ahci_hw_init(hpriv); |
| 482 | − | |
| 515 | +skip_clk_phy: | |
| 483 | 516 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ; |
| 484 | 517 | |
| 485 | 518 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); |
| @@ -340,6 +340,14 @@ static const struct pci_device_id piix_pci_tbl[] = { · 339 unmodified lines | ||
| 340 | 340 | { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, |
| 341 | 341 | /* SATA Controller IDE (Coleto Creek) */ |
| 342 | 342 | { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
| 343 | + /* SATA Controller IDE (9 Series) */ | |
| 344 | + { 0x8086, 0x8c88, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, | |
| 345 | + /* SATA Controller IDE (9 Series) */ | |
| 346 | + { 0x8086, 0x8c89, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, | |
| 347 | + /* SATA Controller IDE (9 Series) */ | |
| 348 | + { 0x8086, 0x8c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, | |
| 349 | + /* SATA Controller IDE (9 Series) */ | |
| 350 | + { 0x8086, 0x8c81, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, | |
| 343 | 351 | |
| 344 | 352 | { } /* terminate list */ |
| 345 | 353 | }; |
| @@ -143,6 +143,18 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i · 142 unmodified lines | ||
| 143 | 143 | }; |
| 144 | 144 | const struct ata_port_info *ppi[] = { &info, NULL }; |
| 145 | 145 | |
| 146 | + /* | |
| 147 | + * The JMicron chip 361/363 contains one SATA controller and one | |
| 148 | + * PATA controller,for powering on these both controllers, we must | |
| 149 | + * follow the sequence one by one, otherwise one of them can not be | |
| 150 | + * powered on successfully, so here we disable the async suspend | |
| 151 | + * method for these chips. | |
| 152 | + */ | |
| 153 | + if (pdev->vendor == PCI_VENDOR_ID_JMICRON && | |
| 154 | + (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 || | |
| 155 | + pdev->device == PCI_DEVICE_ID_JMICRON_JMB361)) | |
| 156 | + device_disable_async_suspend(&pdev->dev); | |
| 157 | + | |
| 146 | 158 | return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); |
| 147 | 159 | } |
| 148 | 160 | |
| @@ -146,6 +146,9 @@ struct regcache_ops { · 145 unmodified lines | ||
| 146 | 146 | enum regcache_type type; |
| 147 | 147 | int (*init)(struct regmap *map); |
| 148 | 148 | int (*exit)(struct regmap *map); |
| 149 | +#ifdef CONFIG_DEBUG_FS | |
| 150 | + void (*debugfs_init)(struct regmap *map); | |
| 151 | +#endif | |
| 149 | 152 | int (*read)(struct regmap *map, unsigned int reg, unsigned int *value); |
| 150 | 153 | int (*write)(struct regmap *map, unsigned int reg, unsigned int value); |
| 151 | 154 | int (*sync)(struct regmap *map, unsigned int min, unsigned int max); |
| @@ -194,10 +194,6 @@ static void rbtree_debugfs_init(struct regmap *map) · 193 unmodified lines | ||
| 194 | 194 | { |
| 195 | 195 | debugfs_create_file("rbtree", 0400, map->debugfs, map, &rbtree_fops); |
| 196 | 196 | } |
| 197 | −#else | |
| 198 | −static void rbtree_debugfs_init(struct regmap *map) | |
| 199 | −{ | |
| 200 | −} | |
| 201 | 197 | #endif |
| 202 | 198 | |
| 203 | 199 | static int regcache_rbtree_init(struct regmap *map) |
| @@ -222,8 +218,6 @@ static int regcache_rbtree_init(struct regmap *map) · 18 unmodified lines | ||
| 222 | 218 | goto err; |
| 223 | 219 | } |
| 224 | 220 | |
| 225 | − rbtree_debugfs_init(map); | |
| 226 | − | |
| 227 | 221 | return 0; |
| 228 | 222 | |
| 229 | 223 | err: |
| @@ -532,6 +526,9 @@ struct regcache_ops regcache_rbtree_ops = { · 302 unmodified lines | ||
| 532 | 526 | .name = "rbtree", |
| 533 | 527 | .init = regcache_rbtree_init, |
| 534 | 528 | .exit = regcache_rbtree_exit, |
| 529 | +#ifdef CONFIG_DEBUG_FS | |
| 530 | + .debugfs_init = rbtree_debugfs_init, | |
| 531 | +#endif | |
| 535 | 532 | .read = regcache_rbtree_read, |
| 536 | 533 | .write = regcache_rbtree_write, |
| 537 | 534 | .sync = regcache_rbtree_sync, |
| @@ -698,7 +698,7 @@ int regcache_sync_block(struct regmap *map, void *block, · 697 unmodified lines | ||
| 698 | 698 | unsigned int block_base, unsigned int start, |
| 699 | 699 | unsigned int end) |
| 700 | 700 | { |
| 701 | − if (regmap_can_raw_write(map)) | |
| 701 | + if (regmap_can_raw_write(map) && !map->use_single_rw) | |
| 702 | 702 | return regcache_sync_block_raw(map, block, cache_present, |
| 703 | 703 | block_base, start, end); |
| 704 | 704 | else |
| @@ -538,6 +538,9 @@ void regmap_debugfs_init(struct regmap *map, const char *name) · 537 unmodified lines | ||
| 538 | 538 | |
| 539 | 539 | next = rb_next(&range_node->node); |
| 540 | 540 | } |
| 541 | + | |
| 542 | + if (map->cache_ops && map->cache_ops->debugfs_init) | |
| 543 | + map->cache_ops->debugfs_init(map); | |
| 541 | 544 | } |
| 542 | 545 | |
| 543 | 546 | void regmap_debugfs_exit(struct regmap *map) |
| @@ -109,7 +109,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg) · 108 unmodified lines | ||
| 109 | 109 | |
| 110 | 110 | bool regmap_volatile(struct regmap *map, unsigned int reg) |
| 111 | 111 | { |
| 112 | − if (!regmap_readable(map, reg)) | |
| 112 | + if (!map->format.format_write && !regmap_readable(map, reg)) | |
| 113 | 113 | return false; |
| 114 | 114 | |
| 115 | 115 | if (map->volatile_reg) |
| @@ -282,6 +282,7 @@ static const struct pci_device_id bcma_pci_bridge_tbl[] = { · 281 unmodified lines | ||
| 282 | 282 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, |
| 283 | 283 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, |
| 284 | 284 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, |
| 285 | + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */ | |
| 285 | 286 | { 0, }, |
| 286 | 287 | }; |
| 287 | 288 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); |
| @@ -442,12 +442,15 @@ static int rd_nr; · 441 unmodified lines | ||
| 442 | 442 | int rd_size = CONFIG_BLK_DEV_RAM_SIZE; |
| 443 | 443 | static int max_part; |
| 444 | 444 | static int part_shift; |
| 445 | +static int part_show = 0; | |
| 445 | 446 | module_param(rd_nr, int, S_IRUGO); |
| 446 | 447 | MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices"); |
| 447 | 448 | module_param(rd_size, int, S_IRUGO); |
| 448 | 449 | MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes."); |
| 449 | 450 | module_param(max_part, int, S_IRUGO); |
| 450 | 451 | MODULE_PARM_DESC(max_part, "Maximum number of partitions per RAM disk"); |
| 452 | +module_param(part_show, int, S_IRUGO); | |
| 453 | +MODULE_PARM_DESC(part_show, "Control RAM disk visibility in /proc/partitions"); | |
| 451 | 454 | MODULE_LICENSE("GPL"); |
| 452 | 455 | MODULE_ALIAS_BLOCKDEV_MAJOR(RAMDISK_MAJOR); |
| 453 | 456 | MODULE_ALIAS("rd"); |
| @@ -501,7 +504,8 @@ static struct brd_device *brd_alloc(int i) · 47 unmodified lines | ||
| 501 | 504 | disk->fops = &brd_fops; |
| 502 | 505 | disk->private_data = brd; |
| 503 | 506 | disk->queue = brd->brd_queue; |
| 504 | − disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; | |
| 507 | + if (!part_show) | |
| 508 | + disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; | |
| 505 | 509 | sprintf(disk->disk_name, "ram%d", i); |
| 506 | 510 | set_capacity(disk, rd_size * 2); |
| 507 | 511 | |
| @@ -1203,7 +1203,6 @@ static struct platform_driver ace_platform_driver = { · 1202 unmodified lines | ||
| 1203 | 1203 | .probe = ace_probe, |
| 1204 | 1204 | .remove = ace_remove, |
| 1205 | 1205 | .driver = { |
| 1206 | − .owner = THIS_MODULE, | |
| 1207 | 1206 | .name = "xsysace", |
| 1208 | 1207 | .of_match_table = ace_of_match, |
| 1209 | 1208 | }, |
| @@ -378,7 +378,6 @@ static int zram_decompress_page(struct zram *zram, char *mem, u32 index) · 377 unmodified lines | ||
| 378 | 378 | /* Should NEVER happen. Return bio error if it does. */ |
| 379 | 379 | if (unlikely(ret)) { |
| 380 | 380 | pr_err("Decompression failed! err=%d, page=%u\n", ret, index); |
| 381 | − atomic64_inc(&zram->stats.failed_reads); | |
| 382 | 381 | return ret; |
| 383 | 382 | } |
| 384 | 383 | |
| @@ -547,8 +546,6 @@ out: · 162 unmodified lines | ||
| 547 | 546 | zcomp_strm_release(zram->comp, zstrm); |
| 548 | 547 | if (is_partial_io(bvec)) |
| 549 | 548 | kfree(uncmem); |
| 550 | − if (ret) | |
| 551 | − atomic64_inc(&zram->stats.failed_writes); | |
| 552 | 549 | return ret; |
| 553 | 550 | } |
| 554 | 551 | |
| @@ -566,6 +563,13 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index, · 11 unmodified lines | ||
| 566 | 563 | ret = zram_bvec_write(zram, bvec, index, offset); |
| 567 | 564 | } |
| 568 | 565 | |
| 566 | + if (unlikely(ret)) { | |
| 567 | + if (rw == READ) | |
| 568 | + atomic64_inc(&zram->stats.failed_reads); | |
| 569 | + else | |
| 570 | + atomic64_inc(&zram->stats.failed_writes); | |
| 571 | + } | |
| 572 | + | |
| 569 | 573 | return ret; |
| 570 | 574 | } |
| 571 | 575 | |
| @@ -84,7 +84,7 @@ struct zram_stats { · 83 unmodified lines | ||
| 84 | 84 | atomic64_t compr_data_size; /* compressed size of pages stored */ |
| 85 | 85 | atomic64_t num_reads; /* failed + successful */ |
| 86 | 86 | atomic64_t num_writes; /* --do-- */ |
| 87 | − atomic64_t failed_reads; /* should NEVER! happen */ | |
| 87 | + atomic64_t failed_reads; /* can happen when memory is too low */ | |
| 88 | 88 | atomic64_t failed_writes; /* can happen when memory is too low */ |
| 89 | 89 | atomic64_t invalid_io; /* non-page-aligned I/O requests */ |
| 90 | 90 | atomic64_t notify_free; /* no. of swap slot free notifications */ |
| @@ -586,6 +586,30 @@ static int arm_ccn_pmu_type_eq(u32 a, u32 b) · 585 unmodified lines | ||
| 586 | 586 | return 0; |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | +static void arm_ccn_pmu_event_destroy(struct perf_event *event) | |
| 590 | +{ | |
| 591 | + struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | |
| 592 | + struct hw_perf_event *hw = &event->hw; | |
| 593 | + | |
| 594 | + if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) { | |
| 595 | + clear_bit(CCN_IDX_PMU_CYCLE_COUNTER, ccn->dt.pmu_counters_mask); | |
| 596 | + } else { | |
| 597 | + struct arm_ccn_component *source = | |
| 598 | + ccn->dt.pmu_counters[hw->idx].source; | |
| 599 | + | |
| 600 | + if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP && | |
| 601 | + CCN_CONFIG_EVENT(event->attr.config) == | |
| 602 | + CCN_EVENT_WATCHPOINT) | |
| 603 | + clear_bit(hw->config_base, source->xp.dt_cmp_mask); | |
| 604 | + else | |
| 605 | + clear_bit(hw->config_base, source->pmu_events_mask); | |
| 606 | + clear_bit(hw->idx, ccn->dt.pmu_counters_mask); | |
| 607 | + } | |
| 608 | + | |
| 609 | + ccn->dt.pmu_counters[hw->idx].source = NULL; | |
| 610 | + ccn->dt.pmu_counters[hw->idx].event = NULL; | |
| 611 | +} | |
| 612 | + | |
| 589 | 613 | static int arm_ccn_pmu_event_init(struct perf_event *event) |
| 590 | 614 | { |
| 591 | 615 | struct arm_ccn *ccn; |
| @@ -599,6 +623,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) · 7 unmodified lines | ||
| 599 | 623 | return -ENOENT; |
| 600 | 624 | |
| 601 | 625 | ccn = pmu_to_arm_ccn(event->pmu); |
| 626 | + event->destroy = arm_ccn_pmu_event_destroy; | |
| 602 | 627 | |
| 603 | 628 | if (hw->sample_period) { |
| 604 | 629 | dev_warn(ccn->dev, "Sampling not supported!\n"); |
| @@ -662,7 +687,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) · 57 unmodified lines | ||
| 662 | 687 | } |
| 663 | 688 | if (e->num_vcs && vc >= e->num_vcs) { |
| 664 | 689 | dev_warn(ccn->dev, "Invalid vc %d for node/XP %d!\n", |
| 665 | − port, node_xp); | |
| 690 | + vc, node_xp); | |
| 666 | 691 | return -EINVAL; |
| 667 | 692 | } |
| 668 | 693 | valid = 1; |
| @@ -731,30 +756,6 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) · 62 unmodified lines | ||
| 731 | 756 | return 0; |
| 732 | 757 | } |
| 733 | 758 | |
| 734 | −static void arm_ccn_pmu_event_free(struct perf_event *event) | |
| 735 | −{ | |
| 736 | − struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | |
| 737 | − struct hw_perf_event *hw = &event->hw; | |
| 738 | − | |
| 739 | − if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) { | |
| 740 | − clear_bit(CCN_IDX_PMU_CYCLE_COUNTER, ccn->dt.pmu_counters_mask); | |
| 741 | − } else { | |
| 742 | − struct arm_ccn_component *source = | |
| 743 | − ccn->dt.pmu_counters[hw->idx].source; | |
| 744 | − | |
| 745 | − if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP && | |
| 746 | − CCN_CONFIG_EVENT(event->attr.config) == | |
| 747 | − CCN_EVENT_WATCHPOINT) | |
| 748 | − clear_bit(hw->config_base, source->xp.dt_cmp_mask); | |
| 749 | − else | |
| 750 | − clear_bit(hw->config_base, source->pmu_events_mask); | |
| 751 | − clear_bit(hw->idx, ccn->dt.pmu_counters_mask); | |
| 752 | − } | |
| 753 | − | |
| 754 | − ccn->dt.pmu_counters[hw->idx].source = NULL; | |
| 755 | − ccn->dt.pmu_counters[hw->idx].event = NULL; | |
| 756 | −} | |
| 757 | − | |
| 758 | 759 | static u64 arm_ccn_pmu_read_counter(struct arm_ccn *ccn, int idx) |
| 759 | 760 | { |
| 760 | 761 | u64 res; |
| @@ -1027,8 +1028,6 @@ static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) · 266 unmodified lines | ||
| 1027 | 1028 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) |
| 1028 | 1029 | { |
| 1029 | 1030 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); |
| 1030 | − | |
| 1031 | − arm_ccn_pmu_event_free(event); | |
| 1032 | 1031 | } |
| 1033 | 1032 | |
| 1034 | 1033 | static void arm_ccn_pmu_event_read(struct perf_event *event) |
| @@ -660,6 +660,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { · 659 unmodified lines | ||
| 660 | 660 | ICPU(0x3f, core_params), |
| 661 | 661 | ICPU(0x45, core_params), |
| 662 | 662 | ICPU(0x46, core_params), |
| 663 | + ICPU(0x4c, byt_params), | |
| 663 | 664 | ICPU(0x4f, core_params), |
| 664 | 665 | ICPU(0x56, core_params), |
| 665 | 666 | {} |
| @@ -688,7 +689,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum) · 22 unmodified lines | ||
| 688 | 689 | |
| 689 | 690 | add_timer_on(&cpu->timer, cpunum); |
| 690 | 691 | |
| 691 | − pr_info("Intel pstate controlling: cpu %d\n", cpunum); | |
| 692 | + pr_debug("Intel pstate controlling: cpu %d\n", cpunum); | |
| 692 | 693 | |
| 693 | 694 | return 0; |
| 694 | 695 | } |
| @@ -707,10 +708,6 @@ static unsigned int intel_pstate_get(unsigned int cpu_num) · 12 unmodified lines | ||
| 707 | 708 | |
| 708 | 709 | static int intel_pstate_set_policy(struct cpufreq_policy *policy) |
| 709 | 710 | { |
| 710 | − struct cpudata *cpu; | |
| 711 | − | |
| 712 | − cpu = all_cpu_data[policy->cpu]; | |
| 713 | − | |
| 714 | 711 | if (!policy->cpuinfo.max_freq) |
| 715 | 712 | return -ENODEV; |
| 716 | 713 | |
| @@ -501,7 +501,7 @@ static int check_mem_type(void __iomem *dmc_reg) · 500 unmodified lines | ||
| 501 | 501 | return val >> 8; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | −static int __init s5pv210_cpu_init(struct cpufreq_policy *policy) | |
| 504 | +static int s5pv210_cpu_init(struct cpufreq_policy *policy) | |
| 505 | 505 | { |
| 506 | 506 | unsigned long mem_type; |
| 507 | 507 | int ret; |
| @@ -138,25 +138,18 @@ static int bl_enter_powerdown(struct cpuidle_device *dev, · 137 unmodified lines | ||
| 138 | 138 | return idx; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | −static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id) | |
| 141 | +static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int part_id) | |
| 142 | 142 | { |
| 143 | − struct cpuinfo_arm *cpu_info; | |
| 144 | 143 | struct cpumask *cpumask; |
| 145 | − unsigned long cpuid; | |
| 146 | 144 | int cpu; |
| 147 | 145 | |
| 148 | 146 | cpumask = kzalloc(cpumask_size(), GFP_KERNEL); |
| 149 | 147 | if (!cpumask) |
| 150 | 148 | return -ENOMEM; |
| 151 | 149 | |
| 152 | − for_each_possible_cpu(cpu) { | |
| 153 | − cpu_info = &per_cpu(cpu_data, cpu); | |
| 154 | − cpuid = is_smp() ? cpu_info->cpuid : read_cpuid_id(); | |
| 155 | − | |
| 156 | − /* read cpu id part number */ | |
| 157 | − if ((cpuid & 0xFFF0) == cpu_id) | |
| 150 | + for_each_possible_cpu(cpu) | |
| 151 | + if (smp_cpuid_part(cpu) == part_id) | |
| 158 | 152 | cpumask_set_cpu(cpu, cpumask); |
| 159 | − } | |
| 160 | 153 | |
| 161 | 154 | drv->cpumask = cpumask; |
| 162 | 155 | |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | EXPORT_TRACEPOINT_SYMBOL(fence_annotate_wait_on); |
| 30 | 30 | EXPORT_TRACEPOINT_SYMBOL(fence_emit); |
| 31 | 31 | |
| 32 | −/** | |
| 32 | +/* | |
| 33 | 33 | * fence context counter: each execution context should have its own |
| 34 | 34 | * fence context, this allows checking if fences belong to the same |
| 35 | 35 | * context or not. One device can have multiple separate contexts, |
| @@ -481,7 +481,7 @@ EXPORT_SYMBOL_GPL(efivar_entry_remove); · 480 unmodified lines | ||
| 481 | 481 | */ |
| 482 | 482 | static void efivar_entry_list_del_unlock(struct efivar_entry *entry) |
| 483 | 483 | { |
| 484 | − WARN_ON(!spin_is_locked(&__efivars->lock)); | |
| 484 | + lockdep_assert_held(&__efivars->lock); | |
| 485 | 485 | |
| 486 | 486 | list_del(&entry->list); |
| 487 | 487 | spin_unlock_irq(&__efivars->lock); |
| @@ -507,7 +507,7 @@ int __efivar_entry_delete(struct efivar_entry *entry) · 19 unmodified lines | ||
| 507 | 507 | const struct efivar_operations *ops = __efivars->ops; |
| 508 | 508 | efi_status_t status; |
| 509 | 509 | |
| 510 | − WARN_ON(!spin_is_locked(&__efivars->lock)); | |
| 510 | + lockdep_assert_held(&__efivars->lock); | |
| 511 | 511 | |
| 512 | 512 | status = ops->set_variable(entry->var.VariableName, |
| 513 | 513 | &entry->var.VendorGuid, |
| @@ -667,7 +667,7 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, · 153 unmodified lines | ||
| 667 | 667 | int strsize1, strsize2; |
| 668 | 668 | bool found = false; |
| 669 | 669 | |
| 670 | − WARN_ON(!spin_is_locked(&__efivars->lock)); | |
| 670 | + lockdep_assert_held(&__efivars->lock); | |
| 671 | 671 | |
| 672 | 672 | list_for_each_entry_safe(entry, n, head, list) { |
| 673 | 673 | strsize1 = ucs2_strsize(name, 1024); |
| @@ -739,7 +739,7 @@ int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, · 65 unmodified lines | ||
| 739 | 739 | const struct efivar_operations *ops = __efivars->ops; |
| 740 | 740 | efi_status_t status; |
| 741 | 741 | |
| 742 | − WARN_ON(!spin_is_locked(&__efivars->lock)); | |
| 742 | + lockdep_assert_held(&__efivars->lock); | |
| 743 | 743 | |
| 744 | 744 | status = ops->get_variable(entry->var.VariableName, |
| 745 | 745 | &entry->var.VendorGuid, |
| @@ -90,7 +90,7 @@ struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, · 89 unmodified lines | ||
| 90 | 90 | struct gpio_desc **dr; |
| 91 | 91 | struct gpio_desc *desc; |
| 92 | 92 | |
| 93 | − dr = devres_alloc(devm_gpiod_release, sizeof(struct gpiod_desc *), | |
| 93 | + dr = devres_alloc(devm_gpiod_release, sizeof(struct gpio_desc *), | |
| 94 | 94 | GFP_KERNEL); |
| 95 | 95 | if (!dr) |
| 96 | 96 | return ERR_PTR(-ENOMEM); |
| @@ -241,9 +241,6 @@ static void bt8xxgpio_remove(struct pci_dev *pdev) · 240 unmodified lines | ||
| 241 | 241 | bgwrite(~0x0, BT848_INT_STAT); |
| 242 | 242 | bgwrite(0x0, BT848_GPIO_OUT_EN); |
| 243 | 243 | |
| 244 | − iounmap(bg->mmio); | |
| 245 | − release_mem_region(pci_resource_start(pdev, 0), | |
| 246 | − pci_resource_len(pdev, 0)); | |
| 247 | 244 | pci_disable_device(pdev); |
| 248 | 245 | } |
| 249 | 246 | |
| @@ -407,9 +407,27 @@ static int lp_gpio_runtime_resume(struct device *dev) · 406 unmodified lines | ||
| 407 | 407 | return 0; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | +static int lp_gpio_resume(struct device *dev) | |
| 411 | +{ | |
| 412 | + struct platform_device *pdev = to_platform_device(dev); | |
| 413 | + struct lp_gpio *lg = platform_get_drvdata(pdev); | |
| 414 | + unsigned long reg; | |
| 415 | + int i; | |
| 416 | + | |
| 417 | + /* on some hardware suspend clears input sensing, re-enable it here */ | |
| 418 | + for (i = 0; i < lg->chip.ngpio; i++) { | |
| 419 | + if (gpiochip_is_requested(&lg->chip, i) != NULL) { | |
| 420 | + reg = lp_gpio_reg(&lg->chip, i, LP_CONFIG2); | |
| 421 | + outl(inl(reg) & ~GPINDIS_BIT, reg); | |
| 422 | + } | |
| 423 | + } | |
| 424 | + return 0; | |
| 425 | +} | |
| 426 | + | |
| 410 | 427 | static const struct dev_pm_ops lp_gpio_pm_ops = { |
| 411 | 428 | .runtime_suspend = lp_gpio_runtime_suspend, |
| 412 | 429 | .runtime_resume = lp_gpio_runtime_resume, |
| 430 | + .resume = lp_gpio_resume, | |
| 413 | 431 | }; |
| 414 | 432 | |
| 415 | 433 | static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = { |
| @@ -95,6 +95,9 @@ struct zynq_gpio { · 94 unmodified lines | ||
| 95 | 95 | struct clk *clk; |
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | +static struct irq_chip zynq_gpio_level_irqchip; | |
| 99 | +static struct irq_chip zynq_gpio_edge_irqchip; | |
| 100 | + | |
| 98 | 101 | /** |
| 99 | 102 | * zynq_gpio_get_bank_pin - Get the bank number and pin number within that bank |
| 100 | 103 | * for a given pin in the GPIO device |
| @@ -410,6 +413,15 @@ static int zynq_gpio_set_irq_type(struct irq_data *irq_data, unsigned int type) · 309 unmodified lines | ||
| 410 | 413 | gpio->base_addr + ZYNQ_GPIO_INTPOL_OFFSET(bank_num)); |
| 411 | 414 | writel_relaxed(int_any, |
| 412 | 415 | gpio->base_addr + ZYNQ_GPIO_INTANY_OFFSET(bank_num)); |
| 416 | + | |
| 417 | + if (type & IRQ_TYPE_LEVEL_MASK) { | |
| 418 | + __irq_set_chip_handler_name_locked(irq_data->irq, | |
| 419 | + &zynq_gpio_level_irqchip, handle_fasteoi_irq, NULL); | |
| 420 | + } else { | |
| 421 | + __irq_set_chip_handler_name_locked(irq_data->irq, | |
| 422 | + &zynq_gpio_edge_irqchip, handle_level_irq, NULL); | |
| 423 | + } | |
| 424 | + | |
| 413 | 425 | return 0; |
| 414 | 426 | } |
| 415 | 427 | |
| @@ -424,9 +436,21 @@ static int zynq_gpio_set_wake(struct irq_data *data, unsigned int on) · 8 unmodified lines | ||
| 424 | 436 | } |
| 425 | 437 | |
| 426 | 438 | /* irq chip descriptor */ |
| 427 | −static struct irq_chip zynq_gpio_irqchip = { | |
| 439 | +static struct irq_chip zynq_gpio_level_irqchip = { | |
| 428 | 440 | .name = DRIVER_NAME, |
| 429 | 441 | .irq_enable = zynq_gpio_irq_enable, |
| 442 | + .irq_eoi = zynq_gpio_irq_ack, | |
| 443 | + .irq_mask = zynq_gpio_irq_mask, | |
| 444 | + .irq_unmask = zynq_gpio_irq_unmask, | |
| 445 | + .irq_set_type = zynq_gpio_set_irq_type, | |
| 446 | + .irq_set_wake = zynq_gpio_set_wake, | |
| 447 | + .flags = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED, | |
| 448 | +}; | |
| 449 | + | |
| 450 | +static struct irq_chip zynq_gpio_edge_irqchip = { | |
| 451 | + .name = DRIVER_NAME, | |
| 452 | + .irq_enable = zynq_gpio_irq_enable, | |
| 453 | + .irq_ack = zynq_gpio_irq_ack, | |
| 430 | 454 | .irq_mask = zynq_gpio_irq_mask, |
| 431 | 455 | .irq_unmask = zynq_gpio_irq_unmask, |
| 432 | 456 | .irq_set_type = zynq_gpio_set_irq_type, |
| @@ -469,10 +493,6 @@ static void zynq_gpio_irqhandler(unsigned int irq, struct irq_desc *desc) · 36 unmodified lines | ||
| 469 | 493 | offset); |
| 470 | 494 | generic_handle_irq(gpio_irq); |
| 471 | 495 | } |
| 472 | − | |
| 473 | − /* clear IRQ in HW */ | |
| 474 | − writel_relaxed(int_sts, gpio->base_addr + | |
| 475 | − ZYNQ_GPIO_INTSTS_OFFSET(bank_num)); | |
| 476 | 496 | } |
| 477 | 497 | } |
| 478 | 498 | |
| @@ -610,14 +630,14 @@ static int zynq_gpio_probe(struct platform_device *pdev) · 131 unmodified lines | ||
| 610 | 630 | writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr + |
| 611 | 631 | ZYNQ_GPIO_INTDIS_OFFSET(bank_num)); |
| 612 | 632 | |
| 613 | − ret = gpiochip_irqchip_add(chip, &zynq_gpio_irqchip, 0, | |
| 614 | − handle_simple_irq, IRQ_TYPE_NONE); | |
| 633 | + ret = gpiochip_irqchip_add(chip, &zynq_gpio_edge_irqchip, 0, | |
| 634 | + handle_level_irq, IRQ_TYPE_NONE); | |
| 615 | 635 | if (ret) { |
| 616 | 636 | dev_err(&pdev->dev, "Failed to add irq chip\n"); |
| 617 | 637 | goto err_rm_gpiochip; |
| 618 | 638 | } |
| 619 | 639 | |
| 620 | − gpiochip_set_chained_irqchip(chip, &zynq_gpio_irqchip, irq, | |
| 640 | + gpiochip_set_chained_irqchip(chip, &zynq_gpio_edge_irqchip, irq, | |
| 621 | 641 | zynq_gpio_irqhandler); |
| 622 | 642 | |
| 623 | 643 | pm_runtime_set_active(&pdev->dev); |
| @@ -307,7 +307,5 @@ void of_gpiochip_add(struct gpio_chip *chip) · 306 unmodified lines | ||
| 307 | 307 | void of_gpiochip_remove(struct gpio_chip *chip) |
| 308 | 308 | { |
| 309 | 309 | gpiochip_remove_pin_ranges(chip); |
| 310 | − | |
| 311 | − if (chip->of_node) | |
| 312 | − of_node_put(chip->of_node); | |
| 310 | + of_node_put(chip->of_node); | |
| 313 | 311 | } |
| @@ -99,6 +99,7 @@ static struct ast_vbios_dclk_info dclk_table[] = { · 98 unmodified lines | ||
| 99 | 99 | {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ |
| 100 | 100 | {0x77, 0x58, 0x80}, /* 17: VCLK119 */ |
| 101 | 101 | {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ |
| 102 | + {0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */ | |
| 102 | 103 | }; |
| 103 | 104 | |
| 104 | 105 | static struct ast_vbios_stdtable vbios_stdtable[] = { |
| @@ -4696,8 +4696,9 @@ int drm_mode_create_dumb_ioctl(struct drm_device *dev, · 4695 unmodified lines | ||
| 4696 | 4696 | return -EINVAL; |
| 4697 | 4697 | |
| 4698 | 4698 | /* overflow checks for 32bit size calculations */ |
| 4699 | + /* NOTE: DIV_ROUND_UP() can overflow */ | |
| 4699 | 4700 | cpp = DIV_ROUND_UP(args->bpp, 8); |
| 4700 | − if (cpp > 0xffffffffU / args->width) | |
| 4701 | + if (!cpp || cpp > 0xffffffffU / args->width) | |
| 4701 | 4702 | return -EINVAL; |
| 4702 | 4703 | stride = cpp * args->width; |
| 4703 | 4704 | if (args->height > 0xffffffffU / stride) |
| @@ -494,6 +494,36 @@ bool i915_semaphore_is_enabled(struct drm_device *dev) · 493 unmodified lines | ||
| 494 | 494 | return true; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | +void intel_hpd_cancel_work(struct drm_i915_private *dev_priv) | |
| 498 | +{ | |
| 499 | + spin_lock_irq(&dev_priv->irq_lock); | |
| 500 | + | |
| 501 | + dev_priv->long_hpd_port_mask = 0; | |
| 502 | + dev_priv->short_hpd_port_mask = 0; | |
| 503 | + dev_priv->hpd_event_bits = 0; | |
| 504 | + | |
| 505 | + spin_unlock_irq(&dev_priv->irq_lock); | |
| 506 | + | |
| 507 | + cancel_work_sync(&dev_priv->dig_port_work); | |
| 508 | + cancel_work_sync(&dev_priv->hotplug_work); | |
| 509 | + cancel_delayed_work_sync(&dev_priv->hotplug_reenable_work); | |
| 510 | +} | |
| 511 | + | |
| 512 | +static void intel_suspend_encoders(struct drm_i915_private *dev_priv) | |
| 513 | +{ | |
| 514 | + struct drm_device *dev = dev_priv->dev; | |
| 515 | + struct drm_encoder *encoder; | |
| 516 | + | |
| 517 | + drm_modeset_lock_all(dev); | |
| 518 | + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | |
| 519 | + struct intel_encoder *intel_encoder = to_intel_encoder(encoder); | |
| 520 | + | |
| 521 | + if (intel_encoder->suspend) | |
| 522 | + intel_encoder->suspend(intel_encoder); | |
| 523 | + } | |
| 524 | + drm_modeset_unlock_all(dev); | |
| 525 | +} | |
| 526 | + | |
| 497 | 527 | static int i915_drm_freeze(struct drm_device *dev) |
| 498 | 528 | { |
| 499 | 529 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -538,6 +568,9 @@ static int i915_drm_freeze(struct drm_device *dev) · 38 unmodified lines | ||
| 538 | 568 | flush_delayed_work(&dev_priv->rps.delayed_resume_work); |
| 539 | 569 | |
| 540 | 570 | intel_runtime_pm_disable_interrupts(dev); |
| 571 | + intel_hpd_cancel_work(dev_priv); | |
| 572 | + | |
| 573 | + intel_suspend_encoders(dev_priv); | |
| 541 | 574 | |
| 542 | 575 | intel_suspend_gt_powersave(dev); |
| 543 | 576 | |
| @@ -1458,7 +1458,7 @@ struct drm_i915_private { · 1457 unmodified lines | ||
| 1458 | 1458 | } hpd_mark; |
| 1459 | 1459 | } hpd_stats[HPD_NUM_PINS]; |
| 1460 | 1460 | u32 hpd_event_bits; |
| 1461 | − struct timer_list hotplug_reenable_timer; | |
| 1461 | + struct delayed_work hotplug_reenable_work; | |
| 1462 | 1462 | |
| 1463 | 1463 | struct i915_fbc fbc; |
| 1464 | 1464 | struct i915_drrs drrs; |
| @@ -2178,6 +2178,7 @@ extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv); · 713 unmodified lines | ||
| 2178 | 2178 | extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv); |
| 2179 | 2179 | extern void i915_update_gfx_val(struct drm_i915_private *dev_priv); |
| 2180 | 2180 | int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on); |
| 2181 | +void intel_hpd_cancel_work(struct drm_i915_private *dev_priv); | |
| 2181 | 2182 | |
| 2182 | 2183 | extern void intel_console_resume(struct work_struct *work); |
| 2183 | 2184 | |
| @@ -1189,8 +1189,8 @@ static void i915_hotplug_work_func(struct work_struct *work) · 1188 unmodified lines | ||
| 1189 | 1189 | * some connectors */ |
| 1190 | 1190 | if (hpd_disabled) { |
| 1191 | 1191 | drm_kms_helper_poll_enable(dev); |
| 1192 | − mod_timer(&dev_priv->hotplug_reenable_timer, | |
| 1193 | − jiffies + msecs_to_jiffies(I915_REENABLE_HOTPLUG_DELAY)); | |
| 1192 | + mod_delayed_work(system_wq, &dev_priv->hotplug_reenable_work, | |
| 1193 | + msecs_to_jiffies(I915_REENABLE_HOTPLUG_DELAY)); | |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); |
| @@ -1213,11 +1213,6 @@ static void i915_hotplug_work_func(struct work_struct *work) · 16 unmodified lines | ||
| 1213 | 1213 | drm_kms_helper_hotplug_event(dev); |
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | −static void intel_hpd_irq_uninstall(struct drm_i915_private *dev_priv) | |
| 1217 | −{ | |
| 1218 | − del_timer_sync(&dev_priv->hotplug_reenable_timer); | |
| 1219 | −} | |
| 1220 | − | |
| 1221 | 1216 | static void ironlake_rps_change_irq_handler(struct drm_device *dev) |
| 1222 | 1217 | { |
| 1223 | 1218 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -3892,8 +3887,6 @@ static void gen8_irq_uninstall(struct drm_device *dev) · 2668 unmodified lines | ||
| 3892 | 3887 | if (!dev_priv) |
| 3893 | 3888 | return; |
| 3894 | 3889 | |
| 3895 | − intel_hpd_irq_uninstall(dev_priv); | |
| 3896 | − | |
| 3897 | 3890 | gen8_irq_reset(dev); |
| 3898 | 3891 | } |
| 3899 | 3892 | |
| @@ -3908,8 +3901,6 @@ static void valleyview_irq_uninstall(struct drm_device *dev) · 8 unmodified lines | ||
| 3908 | 3901 | |
| 3909 | 3902 | I915_WRITE(VLV_MASTER_IER, 0); |
| 3910 | 3903 | |
| 3911 | − intel_hpd_irq_uninstall(dev_priv); | |
| 3912 | − | |
| 3913 | 3904 | for_each_pipe(pipe) |
| 3914 | 3905 | I915_WRITE(PIPESTAT(pipe), 0xffff); |
| 3915 | 3906 | |
| @@ -3988,8 +3979,6 @@ static void ironlake_irq_uninstall(struct drm_device *dev) · 72 unmodified lines | ||
| 3988 | 3979 | if (!dev_priv) |
| 3989 | 3980 | return; |
| 3990 | 3981 | |
| 3991 | − intel_hpd_irq_uninstall(dev_priv); | |
| 3992 | − | |
| 3993 | 3982 | ironlake_irq_reset(dev); |
| 3994 | 3983 | } |
| 3995 | 3984 | |
| @@ -4360,8 +4349,6 @@ static void i915_irq_uninstall(struct drm_device * dev) · 364 unmodified lines | ||
| 4360 | 4349 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 4361 | 4350 | int pipe; |
| 4362 | 4351 | |
| 4363 | − intel_hpd_irq_uninstall(dev_priv); | |
| 4364 | − | |
| 4365 | 4352 | if (I915_HAS_HOTPLUG(dev)) { |
| 4366 | 4353 | I915_WRITE(PORT_HOTPLUG_EN, 0); |
| 4367 | 4354 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); |
| @@ -4598,8 +4585,6 @@ static void i965_irq_uninstall(struct drm_device * dev) · 230 unmodified lines | ||
| 4598 | 4585 | if (!dev_priv) |
| 4599 | 4586 | return; |
| 4600 | 4587 | |
| 4601 | − intel_hpd_irq_uninstall(dev_priv); | |
| 4602 | − | |
| 4603 | 4588 | I915_WRITE(PORT_HOTPLUG_EN, 0); |
| 4604 | 4589 | I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT)); |
| 4605 | 4590 | |
| @@ -4615,14 +4600,18 @@ static void i965_irq_uninstall(struct drm_device * dev) · 9 unmodified lines | ||
| 4615 | 4600 | I915_WRITE(IIR, I915_READ(IIR)); |
| 4616 | 4601 | } |
| 4617 | 4602 | |
| 4618 | −static void intel_hpd_irq_reenable(unsigned long data) | |
| 4603 | +static void intel_hpd_irq_reenable(struct work_struct *work) | |
| 4619 | 4604 | { |
| 4620 | − struct drm_i915_private *dev_priv = (struct drm_i915_private *)data; | |
| 4605 | + struct drm_i915_private *dev_priv = | |
| 4606 | + container_of(work, typeof(*dev_priv), | |
| 4607 | + hotplug_reenable_work.work); | |
| 4621 | 4608 | struct drm_device *dev = dev_priv->dev; |
| 4622 | 4609 | struct drm_mode_config *mode_config = &dev->mode_config; |
| 4623 | 4610 | unsigned long irqflags; |
| 4624 | 4611 | int i; |
| 4625 | 4612 | |
| 4613 | + intel_runtime_pm_get(dev_priv); | |
| 4614 | + | |
| 4626 | 4615 | spin_lock_irqsave(&dev_priv->irq_lock, irqflags); |
| 4627 | 4616 | for (i = (HPD_NONE + 1); i < HPD_NUM_PINS; i++) { |
| 4628 | 4617 | struct drm_connector *connector; |
| @@ -4648,6 +4637,8 @@ static void intel_hpd_irq_reenable(unsigned long data) · 19 unmodified lines | ||
| 4648 | 4637 | if (dev_priv->display.hpd_irq_setup) |
| 4649 | 4638 | dev_priv->display.hpd_irq_setup(dev); |
| 4650 | 4639 | spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); |
| 4640 | + | |
| 4641 | + intel_runtime_pm_put(dev_priv); | |
| 4651 | 4642 | } |
| 4652 | 4643 | |
| 4653 | 4644 | void intel_irq_init(struct drm_device *dev) |
| @@ -4670,8 +4661,8 @@ void intel_irq_init(struct drm_device *dev) · 16 unmodified lines | ||
| 4670 | 4661 | setup_timer(&dev_priv->gpu_error.hangcheck_timer, |
| 4671 | 4662 | i915_hangcheck_elapsed, |
| 4672 | 4663 | (unsigned long) dev); |
| 4673 | − setup_timer(&dev_priv->hotplug_reenable_timer, intel_hpd_irq_reenable, | |
| 4674 | − (unsigned long) dev_priv); | |
| 4664 | + INIT_DELAYED_WORK(&dev_priv->hotplug_reenable_work, | |
| 4665 | + intel_hpd_irq_reenable); | |
| 4675 | 4666 | |
| 4676 | 4667 | pm_qos_add_request(&dev_priv->pm_qos, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE); |
| 4677 | 4668 | |
| @@ -1123,7 +1123,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) · 1122 unmodified lines | ||
| 1123 | 1123 | } |
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | −static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id) | |
| 1126 | +static int intel_no_opregion_vbt_callback(const struct dmi_system_id *id) | |
| 1127 | 1127 | { |
| 1128 | 1128 | DRM_DEBUG_KMS("Falling back to manually reading VBT from " |
| 1129 | 1129 | "VBIOS ROM for %s\n", |
| @@ -699,16 +699,21 @@ intel_crt_detect(struct drm_connector *connector, bool force) · 698 unmodified lines | ||
| 699 | 699 | goto out; |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | + drm_modeset_acquire_init(&ctx, 0); | |
| 703 | + | |
| 702 | 704 | /* for pre-945g platforms use load detect */ |
| 703 | 705 | if (intel_get_load_detect_pipe(connector, NULL, &tmp, &ctx)) { |
| 704 | 706 | if (intel_crt_detect_ddc(connector)) |
| 705 | 707 | status = connector_status_connected; |
| 706 | 708 | else |
| 707 | 709 | status = intel_crt_load_detect(crt); |
| 708 | − intel_release_load_detect_pipe(connector, &tmp, &ctx); | |
| 710 | + intel_release_load_detect_pipe(connector, &tmp); | |
| 709 | 711 | } else |
| 710 | 712 | status = connector_status_unknown; |
| 711 | 713 | |
| 714 | + drm_modeset_drop_locks(&ctx); | |
| 715 | + drm_modeset_acquire_fini(&ctx); | |
| 716 | + | |
| 712 | 717 | out: |
| 713 | 718 | intel_display_power_put(dev_priv, power_domain); |
| 714 | 719 | return status; |
| @@ -799,7 +804,7 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { · 84 unmodified lines | ||
| 799 | 804 | .destroy = intel_encoder_destroy, |
| 800 | 805 | }; |
| 801 | 806 | |
| 802 | −static int __init intel_no_crt_dmi_callback(const struct dmi_system_id *id) | |
| 807 | +static int intel_no_crt_dmi_callback(const struct dmi_system_id *id) | |
| 803 | 808 | { |
| 804 | 809 | DRM_INFO("Skipping CRT initialization for %s\n", id->ident); |
| 805 | 810 | return 1; |
| @@ -2233,6 +2233,15 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, · 2232 unmodified lines | ||
| 2233 | 2233 | if (need_vtd_wa(dev) && alignment < 256 * 1024) |
| 2234 | 2234 | alignment = 256 * 1024; |
| 2235 | 2235 | |
| 2236 | + /* | |
| 2237 | + * Global gtt pte registers are special registers which actually forward | |
| 2238 | + * writes to a chunk of system memory. Which means that there is no risk | |
| 2239 | + * that the register values disappear as soon as we call | |
| 2240 | + * intel_runtime_pm_put(), so it is correct to wrap only the | |
| 2241 | + * pin/unpin/fence and not more. | |
| 2242 | + */ | |
| 2243 | + intel_runtime_pm_get(dev_priv); | |
| 2244 | + | |
| 2236 | 2245 | dev_priv->mm.interruptible = false; |
| 2237 | 2246 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined); |
| 2238 | 2247 | if (ret) |
| @@ -2250,12 +2259,14 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, · 11 unmodified lines | ||
| 2250 | 2259 | i915_gem_object_pin_fence(obj); |
| 2251 | 2260 | |
| 2252 | 2261 | dev_priv->mm.interruptible = true; |
| 2262 | + intel_runtime_pm_put(dev_priv); | |
| 2253 | 2263 | return 0; |
| 2254 | 2264 | |
| 2255 | 2265 | err_unpin: |
| 2256 | 2266 | i915_gem_object_unpin_from_display_plane(obj); |
| 2257 | 2267 | err_interruptible: |
| 2258 | 2268 | dev_priv->mm.interruptible = true; |
| 2269 | + intel_runtime_pm_put(dev_priv); | |
| 2259 | 2270 | return ret; |
| 2260 | 2271 | } |
| 2261 | 2272 | |
| @@ -4188,10 +4199,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) · 1926 unmodified lines | ||
| 4188 | 4199 | intel_set_pch_fifo_underrun_reporting(dev, pipe, false); |
| 4189 | 4200 | |
| 4190 | 4201 | intel_disable_pipe(dev_priv, pipe); |
| 4191 | − | |
| 4192 | − if (intel_crtc->config.dp_encoder_is_mst) | |
| 4193 | − intel_ddi_set_vc_payload_alloc(crtc, false); | |
| 4194 | − | |
| 4195 | 4202 | ironlake_pfit_disable(intel_crtc); |
| 4196 | 4203 | |
| 4197 | 4204 | for_each_encoder_on_crtc(dev, crtc, encoder) |
| @@ -4256,6 +4263,9 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) · 58 unmodified lines | ||
| 4256 | 4263 | intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, false); |
| 4257 | 4264 | intel_disable_pipe(dev_priv, pipe); |
| 4258 | 4265 | |
| 4266 | + if (intel_crtc->config.dp_encoder_is_mst) | |
| 4267 | + intel_ddi_set_vc_payload_alloc(crtc, false); | |
| 4268 | + | |
| 4259 | 4269 | intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder); |
| 4260 | 4270 | |
| 4261 | 4271 | ironlake_pfit_disable(intel_crtc); |
| @@ -8240,6 +8250,15 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc, · 3978 unmodified lines | ||
| 8240 | 8250 | goto fail_locked; |
| 8241 | 8251 | } |
| 8242 | 8252 | |
| 8253 | + /* | |
| 8254 | + * Global gtt pte registers are special registers which actually | |
| 8255 | + * forward writes to a chunk of system memory. Which means that | |
| 8256 | + * there is no risk that the register values disappear as soon | |
| 8257 | + * as we call intel_runtime_pm_put(), so it is correct to wrap | |
| 8258 | + * only the pin/unpin/fence and not more. | |
| 8259 | + */ | |
| 8260 | + intel_runtime_pm_get(dev_priv); | |
| 8261 | + | |
| 8243 | 8262 | /* Note that the w/a also requires 2 PTE of padding following |
| 8244 | 8263 | * the bo. We currently fill all unused PTE with the shadow |
| 8245 | 8264 | * page and so we should always have valid PTE following the |
| @@ -8252,16 +8271,20 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc, · 6 unmodified lines | ||
| 8252 | 8271 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, NULL); |
| 8253 | 8272 | if (ret) { |
| 8254 | 8273 | DRM_DEBUG_KMS("failed to move cursor bo into the GTT\n"); |
| 8274 | + intel_runtime_pm_put(dev_priv); | |
| 8255 | 8275 | goto fail_locked; |
| 8256 | 8276 | } |
| 8257 | 8277 | |
| 8258 | 8278 | ret = i915_gem_object_put_fence(obj); |
| 8259 | 8279 | if (ret) { |
| 8260 | 8280 | DRM_DEBUG_KMS("failed to release fence for cursor"); |
| 8281 | + intel_runtime_pm_put(dev_priv); | |
| 8261 | 8282 | goto fail_unpin; |
| 8262 | 8283 | } |
| 8263 | 8284 | |
| 8264 | 8285 | addr = i915_gem_obj_ggtt_offset(obj); |
| 8286 | + | |
| 8287 | + intel_runtime_pm_put(dev_priv); | |
| 8265 | 8288 | } else { |
| 8266 | 8289 | int align = IS_I830(dev) ? 16 * 1024 : 256; |
| 8267 | 8290 | ret = i915_gem_object_attach_phys(obj, align); |
| @@ -8462,8 +8485,6 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, · 194 unmodified lines | ||
| 8462 | 8485 | connector->base.id, connector->name, |
| 8463 | 8486 | encoder->base.id, encoder->name); |
| 8464 | 8487 | |
| 8465 | − drm_modeset_acquire_init(ctx, 0); | |
| 8466 | − | |
| 8467 | 8488 | retry: |
| 8468 | 8489 | ret = drm_modeset_lock(&config->connection_mutex, ctx); |
| 8469 | 8490 | if (ret) |
| @@ -8502,10 +8523,14 @@ retry: · 32 unmodified lines | ||
| 8502 | 8523 | i++; |
| 8503 | 8524 | if (!(encoder->possible_crtcs & (1 << i))) |
| 8504 | 8525 | continue; |
| 8505 | − if (!possible_crtc->enabled) { | |
| 8506 | − crtc = possible_crtc; | |
| 8507 | − break; | |
| 8508 | − } | |
| 8526 | + if (possible_crtc->enabled) | |
| 8527 | + continue; | |
| 8528 | + /* This can occur when applying the pipe A quirk on resume. */ | |
| 8529 | + if (to_intel_crtc(possible_crtc)->new_enabled) | |
| 8530 | + continue; | |
| 8531 | + | |
| 8532 | + crtc = possible_crtc; | |
| 8533 | + break; | |
| 8509 | 8534 | } |
| 8510 | 8535 | |
| 8511 | 8536 | /* |
| @@ -8574,15 +8599,11 @@ fail_unlock: · 62 unmodified lines | ||
| 8574 | 8599 | goto retry; |
| 8575 | 8600 | } |
| 8576 | 8601 | |
| 8577 | − drm_modeset_drop_locks(ctx); | |
| 8578 | − drm_modeset_acquire_fini(ctx); | |
| 8579 | − | |
| 8580 | 8602 | return false; |
| 8581 | 8603 | } |
| 8582 | 8604 | |
| 8583 | 8605 | void intel_release_load_detect_pipe(struct drm_connector *connector, |
| 8584 | − struct intel_load_detect_pipe *old, | |
| 8585 | − struct drm_modeset_acquire_ctx *ctx) | |
| 8606 | + struct intel_load_detect_pipe *old) | |
| 8586 | 8607 | { |
| 8587 | 8608 | struct intel_encoder *intel_encoder = |
| 8588 | 8609 | intel_attached_encoder(connector); |
| @@ -8606,17 +8627,12 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, · 17 unmodified lines | ||
| 8606 | 8627 | drm_framebuffer_unreference(old->release_fb); |
| 8607 | 8628 | } |
| 8608 | 8629 | |
| 8609 | − goto unlock; | |
| 8610 | 8630 | return; |
| 8611 | 8631 | } |
| 8612 | 8632 | |
| 8613 | 8633 | /* Switch crtc and encoder back off if necessary */ |
| 8614 | 8634 | if (old->dpms_mode != DRM_MODE_DPMS_ON) |
| 8615 | 8635 | connector->funcs->dpms(connector, old->dpms_mode); |
| 8616 | − | |
| 8617 | −unlock: | |
| 8618 | − drm_modeset_drop_locks(ctx); | |
| 8619 | − drm_modeset_acquire_fini(ctx); | |
| 8620 | 8636 | } |
| 8621 | 8637 | |
| 8622 | 8638 | static int i9xx_pll_refclk(struct drm_device *dev, |
| @@ -11700,8 +11716,8 @@ intel_cursor_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, · 3077 unmodified lines | ||
| 11700 | 11716 | }; |
| 11701 | 11717 | const struct drm_rect clip = { |
| 11702 | 11718 | /* integer pixels */ |
| 11703 | − .x2 = intel_crtc->config.pipe_src_w, | |
| 11704 | − .y2 = intel_crtc->config.pipe_src_h, | |
| 11719 | + .x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w : 0, | |
| 11720 | + .y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h : 0, | |
| 11705 | 11721 | }; |
| 11706 | 11722 | bool visible; |
| 11707 | 11723 | int ret; |
| @@ -12488,6 +12504,9 @@ static struct intel_quirk intel_quirks[] = { · 780 unmodified lines | ||
| 12488 | 12504 | /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ |
| 12489 | 12505 | { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, |
| 12490 | 12506 | |
| 12507 | + /* Acer C720 Chromebook (Core i3 4005U) */ | |
| 12508 | + { 0x0a16, 0x1025, 0x0a11, quirk_backlight_present }, | |
| 12509 | + | |
| 12491 | 12510 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ |
| 12492 | 12511 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, |
| 12493 | 12512 | |
| @@ -12659,7 +12678,7 @@ static void intel_enable_pipe_a(struct drm_device *dev) · 165 unmodified lines | ||
| 12659 | 12678 | struct intel_connector *connector; |
| 12660 | 12679 | struct drm_connector *crt = NULL; |
| 12661 | 12680 | struct intel_load_detect_pipe load_detect_temp; |
| 12662 | − struct drm_modeset_acquire_ctx ctx; | |
| 12681 | + struct drm_modeset_acquire_ctx *ctx = dev->mode_config.acquire_ctx; | |
| 12663 | 12682 | |
| 12664 | 12683 | /* We can't just switch on the pipe A, we need to set things up with a |
| 12665 | 12684 | * proper mode and output configuration. As a gross hack, enable pipe A |
| @@ -12676,10 +12695,8 @@ static void intel_enable_pipe_a(struct drm_device *dev) · 10 unmodified lines | ||
| 12676 | 12695 | if (!crt) |
| 12677 | 12696 | return; |
| 12678 | 12697 | |
| 12679 | − if (intel_get_load_detect_pipe(crt, NULL, &load_detect_temp, &ctx)) | |
| 12680 | − intel_release_load_detect_pipe(crt, &load_detect_temp, &ctx); | |
| 12681 | − | |
| 12682 | − | |
| 12698 | + if (intel_get_load_detect_pipe(crt, NULL, &load_detect_temp, ctx)) | |
| 12699 | + intel_release_load_detect_pipe(crt, &load_detect_temp); | |
| 12683 | 12700 | } |
| 12684 | 12701 | |
| 12685 | 12702 | static bool |
| @@ -13112,7 +13129,7 @@ void intel_modeset_cleanup(struct drm_device *dev) · 426 unmodified lines | ||
| 13112 | 13129 | * experience fancy races otherwise. |
| 13113 | 13130 | */ |
| 13114 | 13131 | drm_irq_uninstall(dev); |
| 13115 | − cancel_work_sync(&dev_priv->hotplug_work); | |
| 13132 | + intel_hpd_cancel_work(dev_priv); | |
| 13116 | 13133 | dev_priv->pm._irqs_disabled = true; |
| 13117 | 13134 | |
| 13118 | 13135 | /* |
| @@ -3553,6 +3553,9 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) · 3552 unmodified lines | ||
| 3553 | 3553 | if (WARN_ON(!intel_encoder->base.crtc)) |
| 3554 | 3554 | return; |
| 3555 | 3555 | |
| 3556 | + if (!to_intel_crtc(intel_encoder->base.crtc)->active) | |
| 3557 | + return; | |
| 3558 | + | |
| 3556 | 3559 | /* Try to read receiver status if the link appears to be up */ |
| 3557 | 3560 | if (!intel_dp_get_link_status(intel_dp, link_status)) { |
| 3558 | 3561 | return; |
| @@ -3658,24 +3661,12 @@ ironlake_dp_detect(struct intel_dp *intel_dp) · 99 unmodified lines | ||
| 3658 | 3661 | return intel_dp_detect_dpcd(intel_dp); |
| 3659 | 3662 | } |
| 3660 | 3663 | |
| 3661 | −static enum drm_connector_status | |
| 3662 | −g4x_dp_detect(struct intel_dp *intel_dp) | |
| 3664 | +static int g4x_digital_port_connected(struct drm_device *dev, | |
| 3665 | + struct intel_digital_port *intel_dig_port) | |
| 3663 | 3666 | { |
| 3664 | − struct drm_device *dev = intel_dp_to_dev(intel_dp); | |
| 3665 | 3667 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 3666 | − struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | |
| 3667 | 3668 | uint32_t bit; |
| 3668 | 3669 | |
| 3669 | − /* Can't disconnect eDP, but you can close the lid... */ | |
| 3670 | − if (is_edp(intel_dp)) { | |
| 3671 | − enum drm_connector_status status; | |
| 3672 | − | |
| 3673 | − status = intel_panel_detect(dev); | |
| 3674 | − if (status == connector_status_unknown) | |
| 3675 | − status = connector_status_connected; | |
| 3676 | − return status; | |
| 3677 | − } | |
| 3678 | − | |
| 3679 | 3670 | if (IS_VALLEYVIEW(dev)) { |
| 3680 | 3671 | switch (intel_dig_port->port) { |
| 3681 | 3672 | case PORT_B: |
| @@ -3688,7 +3679,7 @@ g4x_dp_detect(struct intel_dp *intel_dp) · 6 unmodified lines | ||
| 3688 | 3679 | bit = PORTD_HOTPLUG_LIVE_STATUS_VLV; |
| 3689 | 3680 | break; |
| 3690 | 3681 | default: |
| 3691 | − return connector_status_unknown; | |
| 3682 | + return -EINVAL; | |
| 3692 | 3683 | } |
| 3693 | 3684 | } else { |
| 3694 | 3685 | switch (intel_dig_port->port) { |
| @@ -3702,11 +3693,36 @@ g4x_dp_detect(struct intel_dp *intel_dp) · 7 unmodified lines | ||
| 3702 | 3693 | bit = PORTD_HOTPLUG_LIVE_STATUS_G4X; |
| 3703 | 3694 | break; |
| 3704 | 3695 | default: |
| 3705 | − return connector_status_unknown; | |
| 3696 | + return -EINVAL; | |
| 3706 | 3697 | } |
| 3707 | 3698 | } |
| 3708 | 3699 | |
| 3709 | 3700 | if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0) |
| 3701 | + return 0; | |
| 3702 | + return 1; | |
| 3703 | +} | |
| 3704 | + | |
| 3705 | +static enum drm_connector_status | |
| 3706 | +g4x_dp_detect(struct intel_dp *intel_dp) | |
| 3707 | +{ | |
| 3708 | + struct drm_device *dev = intel_dp_to_dev(intel_dp); | |
| 3709 | + struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | |
| 3710 | + int ret; | |
| 3711 | + | |
| 3712 | + /* Can't disconnect eDP, but you can close the lid... */ | |
| 3713 | + if (is_edp(intel_dp)) { | |
| 3714 | + enum drm_connector_status status; | |
| 3715 | + | |
| 3716 | + status = intel_panel_detect(dev); | |
| 3717 | + if (status == connector_status_unknown) | |
| 3718 | + status = connector_status_connected; | |
| 3719 | + return status; | |
| 3720 | + } | |
| 3721 | + | |
| 3722 | + ret = g4x_digital_port_connected(dev, intel_dig_port); | |
| 3723 | + if (ret == -EINVAL) | |
| 3724 | + return connector_status_unknown; | |
| 3725 | + else if (ret == 0) | |
| 3710 | 3726 | return connector_status_disconnected; |
| 3711 | 3727 | |
| 3712 | 3728 | return intel_dp_detect_dpcd(intel_dp); |
| @@ -4003,6 +4019,16 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) · 290 unmodified lines | ||
| 4003 | 4019 | kfree(intel_dig_port); |
| 4004 | 4020 | } |
| 4005 | 4021 | |
| 4022 | +static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) | |
| 4023 | +{ | |
| 4024 | + struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); | |
| 4025 | + | |
| 4026 | + if (!is_edp(intel_dp)) | |
| 4027 | + return; | |
| 4028 | + | |
| 4029 | + edp_panel_vdd_off_sync(intel_dp); | |
| 4030 | +} | |
| 4031 | + | |
| 4006 | 4032 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) |
| 4007 | 4033 | { |
| 4008 | 4034 | intel_edp_panel_vdd_sanitize(to_intel_encoder(encoder)); |
| @@ -4037,18 +4063,30 @@ bool · 28 unmodified lines | ||
| 4037 | 4063 | intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) |
| 4038 | 4064 | { |
| 4039 | 4065 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
| 4066 | + struct intel_encoder *intel_encoder = &intel_dig_port->base; | |
| 4040 | 4067 | struct drm_device *dev = intel_dig_port->base.base.dev; |
| 4041 | 4068 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 4042 | − int ret; | |
| 4069 | + enum intel_display_power_domain power_domain; | |
| 4070 | + bool ret = true; | |
| 4071 | + | |
| 4043 | 4072 | if (intel_dig_port->base.type != INTEL_OUTPUT_EDP) |
| 4044 | 4073 | intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT; |
| 4045 | 4074 | |
| 4046 | 4075 | DRM_DEBUG_KMS("got hpd irq on port %d - %s\n", intel_dig_port->port, |
| 4047 | 4076 | long_hpd ? "long" : "short"); |
| 4048 | 4077 | |
| 4078 | + power_domain = intel_display_port_power_domain(intel_encoder); | |
| 4079 | + intel_display_power_get(dev_priv, power_domain); | |
| 4080 | + | |
| 4049 | 4081 | if (long_hpd) { |
| 4050 | − if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) | |
| 4051 | − goto mst_fail; | |
| 4082 | + | |
| 4083 | + if (HAS_PCH_SPLIT(dev)) { | |
| 4084 | + if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) | |
| 4085 | + goto mst_fail; | |
| 4086 | + } else { | |
| 4087 | + if (g4x_digital_port_connected(dev, intel_dig_port) != 1) | |
| 4088 | + goto mst_fail; | |
| 4089 | + } | |
| 4052 | 4090 | |
| 4053 | 4091 | if (!intel_dp_get_dpcd(intel_dp)) { |
| 4054 | 4092 | goto mst_fail; |
| @@ -4061,8 +4099,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · 6 unmodified lines | ||
| 4061 | 4099 | |
| 4062 | 4100 | } else { |
| 4063 | 4101 | if (intel_dp->is_mst) { |
| 4064 | − ret = intel_dp_check_mst_status(intel_dp); | |
| 4065 | − if (ret == -EINVAL) | |
| 4102 | + if (intel_dp_check_mst_status(intel_dp) == -EINVAL) | |
| 4066 | 4103 | goto mst_fail; |
| 4067 | 4104 | } |
| 4068 | 4105 | |
| @@ -4076,7 +4113,8 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · 7 unmodified lines | ||
| 4076 | 4113 | drm_modeset_unlock(&dev->mode_config.connection_mutex); |
| 4077 | 4114 | } |
| 4078 | 4115 | } |
| 4079 | − return false; | |
| 4116 | + ret = false; | |
| 4117 | + goto put_power; | |
| 4080 | 4118 | mst_fail: |
| 4081 | 4119 | /* if we were in MST mode, and device is not there get out of MST mode */ |
| 4082 | 4120 | if (intel_dp->is_mst) { |
| @@ -4084,7 +4122,10 @@ mst_fail: · 1 unmodified line | ||
| 4084 | 4122 | intel_dp->is_mst = false; |
| 4085 | 4123 | drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst); |
| 4086 | 4124 | } |
| 4087 | − return true; | |
| 4125 | +put_power: | |
| 4126 | + intel_display_power_put(dev_priv, power_domain); | |
| 4127 | + | |
| 4128 | + return ret; | |
| 4088 | 4129 | } |
| 4089 | 4130 | |
| 4090 | 4131 | /* Return which DP Port should be selected for Transcoder DP control */ |
| @@ -4722,6 +4763,7 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port) · 631 unmodified lines | ||
| 4722 | 4763 | intel_encoder->disable = intel_disable_dp; |
| 4723 | 4764 | intel_encoder->get_hw_state = intel_dp_get_hw_state; |
| 4724 | 4765 | intel_encoder->get_config = intel_dp_get_config; |
| 4766 | + intel_encoder->suspend = intel_dp_encoder_suspend; | |
| 4725 | 4767 | if (IS_CHERRYVIEW(dev)) { |
| 4726 | 4768 | intel_encoder->pre_pll_enable = chv_dp_pre_pll_enable; |
| 4727 | 4769 | intel_encoder->pre_enable = chv_pre_enable_dp; |
| @@ -153,6 +153,12 @@ struct intel_encoder { · 152 unmodified lines | ||
| 153 | 153 | * be set correctly before calling this function. */ |
| 154 | 154 | void (*get_config)(struct intel_encoder *, |
| 155 | 155 | struct intel_crtc_config *pipe_config); |
| 156 | + /* | |
| 157 | + * Called during system suspend after all pending requests for the | |
| 158 | + * encoder are flushed (for example for DP AUX transactions) and | |
| 159 | + * device interrupts are disabled. | |
| 160 | + */ | |
| 161 | + void (*suspend)(struct intel_encoder *); | |
| 156 | 162 | int crtc_mask; |
| 157 | 163 | enum hpd_pin hpd_pin; |
| 158 | 164 | }; |
| @@ -830,8 +836,7 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, · 671 unmodified lines | ||
| 830 | 836 | struct intel_load_detect_pipe *old, |
| 831 | 837 | struct drm_modeset_acquire_ctx *ctx); |
| 832 | 838 | void intel_release_load_detect_pipe(struct drm_connector *connector, |
| 833 | − struct intel_load_detect_pipe *old, | |
| 834 | − struct drm_modeset_acquire_ctx *ctx); | |
| 839 | + struct intel_load_detect_pipe *old); | |
| 835 | 840 | int intel_pin_and_fence_fb_obj(struct drm_device *dev, |
| 836 | 841 | struct drm_i915_gem_object *obj, |
| 837 | 842 | struct intel_engine_cs *pipelined); |
| @@ -538,7 +538,7 @@ static const struct drm_encoder_funcs intel_lvds_enc_funcs = { · 537 unmodified lines | ||
| 538 | 538 | .destroy = intel_encoder_destroy, |
| 539 | 539 | }; |
| 540 | 540 | |
| 541 | −static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id) | |
| 541 | +static int intel_no_lvds_dmi_callback(const struct dmi_system_id *id) | |
| 542 | 542 | { |
| 543 | 543 | DRM_INFO("Skipping LVDS initialization for %s\n", id->ident); |
| 544 | 544 | return 1; |
| @@ -801,7 +801,7 @@ static void pch_enable_backlight(struct intel_connector *connector) · 800 unmodified lines | ||
| 801 | 801 | |
| 802 | 802 | cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2); |
| 803 | 803 | if (cpu_ctl2 & BLM_PWM_ENABLE) { |
| 804 | − WARN(1, "cpu backlight already enabled\n"); | |
| 804 | + DRM_DEBUG_KMS("cpu backlight already enabled\n"); | |
| 805 | 805 | cpu_ctl2 &= ~BLM_PWM_ENABLE; |
| 806 | 806 | I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2); |
| 807 | 807 | } |
| @@ -845,7 +845,7 @@ static void i9xx_enable_backlight(struct intel_connector *connector) · 37 unmodified lines | ||
| 845 | 845 | |
| 846 | 846 | ctl = I915_READ(BLC_PWM_CTL); |
| 847 | 847 | if (ctl & BACKLIGHT_DUTY_CYCLE_MASK_PNV) { |
| 848 | − WARN(1, "backlight already enabled\n"); | |
| 848 | + DRM_DEBUG_KMS("backlight already enabled\n"); | |
| 849 | 849 | I915_WRITE(BLC_PWM_CTL, 0); |
| 850 | 850 | } |
| 851 | 851 | |
| @@ -876,7 +876,7 @@ static void i965_enable_backlight(struct intel_connector *connector) · 24 unmodified lines | ||
| 876 | 876 | |
| 877 | 877 | ctl2 = I915_READ(BLC_PWM_CTL2); |
| 878 | 878 | if (ctl2 & BLM_PWM_ENABLE) { |
| 879 | − WARN(1, "backlight already enabled\n"); | |
| 879 | + DRM_DEBUG_KMS("backlight already enabled\n"); | |
| 880 | 880 | ctl2 &= ~BLM_PWM_ENABLE; |
| 881 | 881 | I915_WRITE(BLC_PWM_CTL2, ctl2); |
| 882 | 882 | } |
| @@ -910,7 +910,7 @@ static void vlv_enable_backlight(struct intel_connector *connector) · 27 unmodified lines | ||
| 910 | 910 | |
| 911 | 911 | ctl2 = I915_READ(VLV_BLC_PWM_CTL2(pipe)); |
| 912 | 912 | if (ctl2 & BLM_PWM_ENABLE) { |
| 913 | − WARN(1, "backlight already enabled\n"); | |
| 913 | + DRM_DEBUG_KMS("backlight already enabled\n"); | |
| 914 | 914 | ctl2 &= ~BLM_PWM_ENABLE; |
| 915 | 915 | I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2); |
| 916 | 916 | } |
| @@ -1311,6 +1311,7 @@ intel_tv_detect(struct drm_connector *connector, bool force) · 1310 unmodified lines | ||
| 1311 | 1311 | { |
| 1312 | 1312 | struct drm_display_mode mode; |
| 1313 | 1313 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
| 1314 | + enum drm_connector_status status; | |
| 1314 | 1315 | int type; |
| 1315 | 1316 | |
| 1316 | 1317 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force=%d\n", |
| @@ -1323,16 +1324,24 @@ intel_tv_detect(struct drm_connector *connector, bool force) · 6 unmodified lines | ||
| 1323 | 1324 | struct intel_load_detect_pipe tmp; |
| 1324 | 1325 | struct drm_modeset_acquire_ctx ctx; |
| 1325 | 1326 | |
| 1327 | + drm_modeset_acquire_init(&ctx, 0); | |
| 1328 | + | |
| 1326 | 1329 | if (intel_get_load_detect_pipe(connector, &mode, &tmp, &ctx)) { |
| 1327 | 1330 | type = intel_tv_detect_type(intel_tv, connector); |
| 1328 | − intel_release_load_detect_pipe(connector, &tmp, &ctx); | |
| 1331 | + intel_release_load_detect_pipe(connector, &tmp); | |
| 1332 | + status = type < 0 ? | |
| 1333 | + connector_status_disconnected : | |
| 1334 | + connector_status_connected; | |
| 1329 | 1335 | } else |
| 1330 | − return connector_status_unknown; | |
| 1336 | + status = connector_status_unknown; | |
| 1337 | + | |
| 1338 | + drm_modeset_drop_locks(&ctx); | |
| 1339 | + drm_modeset_acquire_fini(&ctx); | |
| 1331 | 1340 | } else |
| 1332 | 1341 | return connector->status; |
| 1333 | 1342 | |
| 1334 | − if (type < 0) | |
| 1335 | − return connector_status_disconnected; | |
| 1343 | + if (status != connector_status_connected) | |
| 1344 | + return status; | |
| 1336 | 1345 | |
| 1337 | 1346 | intel_tv->type = type; |
| 1338 | 1347 | intel_tv_find_better_format(connector); |
| @@ -397,6 +397,7 @@ static void mdp4_crtc_prepare(struct drm_crtc *crtc) · 396 unmodified lines | ||
| 397 | 397 | struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); |
| 398 | 398 | DBG("%s", mdp4_crtc->name); |
| 399 | 399 | /* make sure we hold a ref to mdp clks while setting up mode: */ |
| 400 | + drm_crtc_vblank_get(crtc); | |
| 400 | 401 | mdp4_enable(get_kms(crtc)); |
| 401 | 402 | mdp4_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
| 402 | 403 | } |
| @@ -407,6 +408,7 @@ static void mdp4_crtc_commit(struct drm_crtc *crtc) · 4 unmodified lines | ||
| 407 | 408 | crtc_flush(crtc); |
| 408 | 409 | /* drop the ref to mdp clk's that we got in prepare: */ |
| 409 | 410 | mdp4_disable(get_kms(crtc)); |
| 411 | + drm_crtc_vblank_put(crtc); | |
| 410 | 412 | } |
| 411 | 413 | |
| 412 | 414 | static int mdp4_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, |
| @@ -974,12 +974,11 @@ static int msm_pdev_probe(struct platform_device *pdev) · 973 unmodified lines | ||
| 974 | 974 | |
| 975 | 975 | for (i = 0; i < ARRAY_SIZE(devnames); i++) { |
| 976 | 976 | struct device *dev; |
| 977 | − int ret; | |
| 978 | 977 | |
| 979 | 978 | dev = bus_find_device_by_name(&platform_bus_type, |
| 980 | 979 | NULL, devnames[i]); |
| 981 | 980 | if (!dev) { |
| 982 | − dev_info(master, "still waiting for %s\n", devnames[i]); | |
| 981 | + dev_info(&pdev->dev, "still waiting for %s\n", devnames[i]); | |
| 983 | 982 | return -EPROBE_DEFER; |
| 984 | 983 | } |
| 985 | 984 | |
| @@ -143,7 +143,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, · 142 unmodified lines | ||
| 143 | 143 | ret = msm_gem_get_iova_locked(fbdev->bo, 0, &paddr); |
| 144 | 144 | if (ret) { |
| 145 | 145 | dev_err(dev->dev, "failed to get buffer obj iova: %d\n", ret); |
| 146 | − goto fail; | |
| 146 | + goto fail_unlock; | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | fbi = framebuffer_alloc(0, dev->dev); |
| @@ -27,8 +27,8 @@ struct msm_iommu { · 26 unmodified lines | ||
| 27 | 27 | static int msm_fault_handler(struct iommu_domain *iommu, struct device *dev, |
| 28 | 28 | unsigned long iova, int flags, void *arg) |
| 29 | 29 | { |
| 30 | − DBG("*** fault: iova=%08lx, flags=%d", iova, flags); | |
| 31 | − return -ENOSYS; | |
| 30 | + pr_warn_ratelimited("*** fault: iova=%08lx, flags=%d\n", iova, flags); | |
| 31 | + return 0; | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) |
| @@ -86,7 +86,7 @@ nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) · 85 unmodified lines | ||
| 86 | 86 | sclass = nv_parent(parent)->sclass; |
| 87 | 87 | while (sclass) { |
| 88 | 88 | if (++nr < size) |
| 89 | − lclass[nr] = sclass->oclass->handle; | |
| 89 | + lclass[nr] = sclass->oclass->handle & 0xffff; | |
| 90 | 90 | sclass = sclass->sclass; |
| 91 | 91 | } |
| 92 | 92 | |
| @@ -96,7 +96,7 @@ nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) · 3 unmodified lines | ||
| 96 | 96 | if (engine && (oclass = engine->sclass)) { |
| 97 | 97 | while (oclass->ofuncs) { |
| 98 | 98 | if (++nr < size) |
| 99 | − lclass[nr] = oclass->handle; | |
| 99 | + lclass[nr] = oclass->handle & 0xffff; | |
| 100 | 100 | oclass++; |
| 101 | 101 | } |
| 102 | 102 | } |
| @@ -76,7 +76,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ · 75 unmodified lines | ||
| 76 | 76 | evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ |
| 77 | 77 | evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ |
| 78 | 78 | atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ |
| 79 | − si_blit_shaders.o radeon_prime.o radeon_uvd.o cik.o cik_blit_shaders.o \ | |
| 79 | + si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \ | |
| 80 | 80 | r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ |
| 81 | 81 | rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ |
| 82 | 82 | trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ |
| @@ -869,6 +869,9 @@ static int ci_set_thermal_temperature_range(struct radeon_device *rdev, · 868 unmodified lines | ||
| 869 | 869 | WREG32_SMC(CG_THERMAL_CTRL, tmp); |
| 870 | 870 | #endif |
| 871 | 871 | |
| 872 | + rdev->pm.dpm.thermal.min_temp = low_temp; | |
| 873 | + rdev->pm.dpm.thermal.max_temp = high_temp; | |
| 874 | + | |
| 872 | 875 | return 0; |
| 873 | 876 | } |
| 874 | 877 | |
| @@ -3483,7 +3483,7 @@ static void cik_gpu_init(struct radeon_device *rdev) · 3482 unmodified lines | ||
| 3483 | 3483 | u32 mc_shared_chmap, mc_arb_ramcfg; |
| 3484 | 3484 | u32 hdp_host_path_cntl; |
| 3485 | 3485 | u32 tmp; |
| 3486 | − int i, j, k; | |
| 3486 | + int i, j; | |
| 3487 | 3487 | |
| 3488 | 3488 | switch (rdev->family) { |
| 3489 | 3489 | case CHIP_BONAIRE: |
| @@ -3544,6 +3544,7 @@ static void cik_gpu_init(struct radeon_device *rdev) · 54 unmodified lines | ||
| 3544 | 3544 | (rdev->pdev->device == 0x130B) || |
| 3545 | 3545 | (rdev->pdev->device == 0x130E) || |
| 3546 | 3546 | (rdev->pdev->device == 0x1315) || |
| 3547 | + (rdev->pdev->device == 0x1318) || | |
| 3547 | 3548 | (rdev->pdev->device == 0x131B)) { |
| 3548 | 3549 | rdev->config.cik.max_cu_per_sh = 4; |
| 3549 | 3550 | rdev->config.cik.max_backends_per_se = 1; |
| @@ -3672,12 +3673,11 @@ static void cik_gpu_init(struct radeon_device *rdev) · 122 unmodified lines | ||
| 3672 | 3673 | rdev->config.cik.max_sh_per_se, |
| 3673 | 3674 | rdev->config.cik.max_backends_per_se); |
| 3674 | 3675 | |
| 3676 | + rdev->config.cik.active_cus = 0; | |
| 3675 | 3677 | for (i = 0; i < rdev->config.cik.max_shader_engines; i++) { |
| 3676 | 3678 | for (j = 0; j < rdev->config.cik.max_sh_per_se; j++) { |
| 3677 | − for (k = 0; k < rdev->config.cik.max_cu_per_sh; k++) { | |
| 3678 | − rdev->config.cik.active_cus += | |
| 3679 | − hweight32(cik_get_cu_active_bitmap(rdev, i, j)); | |
| 3680 | − } | |
| 3679 | + rdev->config.cik.active_cus += | |
| 3680 | + hweight32(cik_get_cu_active_bitmap(rdev, i, j)); | |
| 3681 | 3681 | } |
| 3682 | 3682 | } |
| 3683 | 3683 | |
| @@ -3801,7 +3801,7 @@ int cik_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · 117 unmodified lines | ||
| 3801 | 3801 | radeon_ring_write(ring, PACKET3(PACKET3_SET_UCONFIG_REG, 1)); |
| 3802 | 3802 | radeon_ring_write(ring, ((scratch - PACKET3_SET_UCONFIG_REG_START) >> 2)); |
| 3803 | 3803 | radeon_ring_write(ring, 0xDEADBEEF); |
| 3804 | − radeon_ring_unlock_commit(rdev, ring); | |
| 3804 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 3805 | 3805 | |
| 3806 | 3806 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 3807 | 3807 | tmp = RREG32(scratch); |
| @@ -3920,6 +3920,17 @@ void cik_fence_compute_ring_emit(struct radeon_device *rdev, · 112 unmodified lines | ||
| 3920 | 3920 | radeon_ring_write(ring, 0); |
| 3921 | 3921 | } |
| 3922 | 3922 | |
| 3923 | +/** | |
| 3924 | + * cik_semaphore_ring_emit - emit a semaphore on the CP ring | |
| 3925 | + * | |
| 3926 | + * @rdev: radeon_device pointer | |
| 3927 | + * @ring: radeon ring buffer object | |
| 3928 | + * @semaphore: radeon semaphore object | |
| 3929 | + * @emit_wait: Is this a sempahore wait? | |
| 3930 | + * | |
| 3931 | + * Emits a semaphore signal/wait packet to the CP ring and prevents the PFP | |
| 3932 | + * from running ahead of semaphore waits. | |
| 3933 | + */ | |
| 3923 | 3934 | bool cik_semaphore_ring_emit(struct radeon_device *rdev, |
| 3924 | 3935 | struct radeon_ring *ring, |
| 3925 | 3936 | struct radeon_semaphore *semaphore, |
| @@ -3932,6 +3943,12 @@ bool cik_semaphore_ring_emit(struct radeon_device *rdev, · 6 unmodified lines | ||
| 3932 | 3943 | radeon_ring_write(ring, lower_32_bits(addr)); |
| 3933 | 3944 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xffff) | sel); |
| 3934 | 3945 | |
| 3946 | + if (emit_wait && ring->idx == RADEON_RING_TYPE_GFX_INDEX) { | |
| 3947 | + /* Prevent the PFP from running ahead of the semaphore wait */ | |
| 3948 | + radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | |
| 3949 | + radeon_ring_write(ring, 0x0); | |
| 3950 | + } | |
| 3951 | + | |
| 3935 | 3952 | return true; |
| 3936 | 3953 | } |
| 3937 | 3954 | |
| @@ -4004,7 +4021,7 @@ int cik_copy_cpdma(struct radeon_device *rdev, · 66 unmodified lines | ||
| 4004 | 4021 | return r; |
| 4005 | 4022 | } |
| 4006 | 4023 | |
| 4007 | − radeon_ring_unlock_commit(rdev, ring); | |
| 4024 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 4008 | 4025 | radeon_semaphore_free(rdev, &sem, *fence); |
| 4009 | 4026 | |
| 4010 | 4027 | return r; |
| @@ -4103,7 +4120,7 @@ int cik_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) · 92 unmodified lines | ||
| 4103 | 4120 | ib.ptr[1] = ((scratch - PACKET3_SET_UCONFIG_REG_START) >> 2); |
| 4104 | 4121 | ib.ptr[2] = 0xDEADBEEF; |
| 4105 | 4122 | ib.length_dw = 3; |
| 4106 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 4123 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 4107 | 4124 | if (r) { |
| 4108 | 4125 | radeon_scratch_free(rdev, scratch); |
| 4109 | 4126 | radeon_ib_free(rdev, &ib); |
| @@ -4324,7 +4341,7 @@ static int cik_cp_gfx_start(struct radeon_device *rdev) · 214 unmodified lines | ||
| 4324 | 4341 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
| 4325 | 4342 | radeon_ring_write(ring, 0x00000010); /* VGT_OUT_DEALLOC_CNTL */ |
| 4326 | 4343 | |
| 4327 | − radeon_ring_unlock_commit(rdev, ring); | |
| 4344 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 4328 | 4345 | |
| 4329 | 4346 | return 0; |
| 4330 | 4347 | } |
| @@ -5732,20 +5749,17 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) · 1401 unmodified lines | ||
| 5732 | 5749 | WREG32(0x15D8, 0); |
| 5733 | 5750 | WREG32(0x15DC, 0); |
| 5734 | 5751 | |
| 5735 | − /* empty context1-15 */ | |
| 5736 | − /* FIXME start with 4G, once using 2 level pt switch to full | |
| 5737 | − * vm size space | |
| 5738 | − */ | |
| 5752 | + /* restore context1-15 */ | |
| 5739 | 5753 | /* set vm size, must be a multiple of 4 */ |
| 5740 | 5754 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
| 5741 | 5755 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); |
| 5742 | 5756 | for (i = 1; i < 16; i++) { |
| 5743 | 5757 | if (i < 8) |
| 5744 | 5758 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
| 5745 | − rdev->gart.table_addr >> 12); | |
| 5759 | + rdev->vm_manager.saved_table_addr[i]); | |
| 5746 | 5760 | else |
| 5747 | 5761 | WREG32(VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2), |
| 5748 | − rdev->gart.table_addr >> 12); | |
| 5762 | + rdev->vm_manager.saved_table_addr[i]); | |
| 5749 | 5763 | } |
| 5750 | 5764 | |
| 5751 | 5765 | /* enable context1-15 */ |
| @@ -5810,6 +5824,17 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) · 58 unmodified lines | ||
| 5810 | 5824 | */ |
| 5811 | 5825 | static void cik_pcie_gart_disable(struct radeon_device *rdev) |
| 5812 | 5826 | { |
| 5827 | + unsigned i; | |
| 5828 | + | |
| 5829 | + for (i = 1; i < 16; ++i) { | |
| 5830 | + uint32_t reg; | |
| 5831 | + if (i < 8) | |
| 5832 | + reg = VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2); | |
| 5833 | + else | |
| 5834 | + reg = VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2); | |
| 5835 | + rdev->vm_manager.saved_table_addr[i] = RREG32(reg); | |
| 5836 | + } | |
| 5837 | + | |
| 5813 | 5838 | /* Disable all tables */ |
| 5814 | 5839 | WREG32(VM_CONTEXT0_CNTL, 0); |
| 5815 | 5840 | WREG32(VM_CONTEXT1_CNTL, 0); |
| @@ -5958,14 +5983,14 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) · 142 unmodified lines | ||
| 5958 | 5983 | |
| 5959 | 5984 | /* update SH_MEM_* regs */ |
| 5960 | 5985 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
| 5961 | − radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | |
| 5986 | + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | | |
| 5962 | 5987 | WRITE_DATA_DST_SEL(0))); |
| 5963 | 5988 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); |
| 5964 | 5989 | radeon_ring_write(ring, 0); |
| 5965 | 5990 | radeon_ring_write(ring, VMID(vm->id)); |
| 5966 | 5991 | |
| 5967 | 5992 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 6)); |
| 5968 | − radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | |
| 5993 | + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | | |
| 5969 | 5994 | WRITE_DATA_DST_SEL(0))); |
| 5970 | 5995 | radeon_ring_write(ring, SH_MEM_BASES >> 2); |
| 5971 | 5996 | radeon_ring_write(ring, 0); |
| @@ -5976,7 +6001,7 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) · 4 unmodified lines | ||
| 5976 | 6001 | radeon_ring_write(ring, 0); /* SH_MEM_APE1_LIMIT */ |
| 5977 | 6002 | |
| 5978 | 6003 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
| 5979 | − radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | |
| 6004 | + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | | |
| 5980 | 6005 | WRITE_DATA_DST_SEL(0))); |
| 5981 | 6006 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); |
| 5982 | 6007 | radeon_ring_write(ring, 0); |
| @@ -5987,7 +6012,7 @@ void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) · 4 unmodified lines | ||
| 5987 | 6012 | |
| 5988 | 6013 | /* bits 0-15 are the VM contexts0-15 */ |
| 5989 | 6014 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
| 5990 | − radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | |
| 6015 | + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | | |
| 5991 | 6016 | WRITE_DATA_DST_SEL(0))); |
| 5992 | 6017 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
| 5993 | 6018 | radeon_ring_write(ring, 0); |
| @@ -9538,6 +9563,9 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev) · 3544 unmodified lines | ||
| 9538 | 9563 | int ret, i; |
| 9539 | 9564 | u16 tmp16; |
| 9540 | 9565 | |
| 9566 | + if (pci_is_root_bus(rdev->pdev->bus)) | |
| 9567 | + return; | |
| 9568 | + | |
| 9541 | 9569 | if (radeon_pcie_gen2 == 0) |
| 9542 | 9570 | return; |
| 9543 | 9571 | |
| @@ -9764,7 +9792,8 @@ static void cik_program_aspm(struct radeon_device *rdev) · 220 unmodified lines | ||
| 9764 | 9792 | if (orig != data) |
| 9765 | 9793 | WREG32_PCIE_PORT(PCIE_LC_LINK_WIDTH_CNTL, data); |
| 9766 | 9794 | |
| 9767 | − if (!disable_clkreq) { | |
| 9795 | + if (!disable_clkreq && | |
| 9796 | + !pci_is_root_bus(rdev->pdev->bus)) { | |
| 9768 | 9797 | struct pci_dev *root = rdev->pdev->bus->self; |
| 9769 | 9798 | u32 lnkcap; |
| 9770 | 9799 | |
| @@ -596,7 +596,7 @@ int cik_copy_dma(struct radeon_device *rdev, · 595 unmodified lines | ||
| 596 | 596 | return r; |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | − radeon_ring_unlock_commit(rdev, ring); | |
| 599 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 600 | 600 | radeon_semaphore_free(rdev, &sem, *fence); |
| 601 | 601 | |
| 602 | 602 | return r; |
| @@ -638,7 +638,7 @@ int cik_sdma_ring_test(struct radeon_device *rdev, · 35 unmodified lines | ||
| 638 | 638 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr)); |
| 639 | 639 | radeon_ring_write(ring, 1); /* number of DWs to follow */ |
| 640 | 640 | radeon_ring_write(ring, 0xDEADBEEF); |
| 641 | − radeon_ring_unlock_commit(rdev, ring); | |
| 641 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 642 | 642 | |
| 643 | 643 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 644 | 644 | tmp = readl(ptr); |
| @@ -695,7 +695,7 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) · 50 unmodified lines | ||
| 695 | 695 | ib.ptr[4] = 0xDEADBEEF; |
| 696 | 696 | ib.length_dw = 5; |
| 697 | 697 | |
| 698 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 698 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 699 | 699 | if (r) { |
| 700 | 700 | radeon_ib_free(rdev, &ib); |
| 701 | 701 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
| @@ -2869,7 +2869,7 @@ static int evergreen_cp_start(struct radeon_device *rdev) · 2868 unmodified lines | ||
| 2869 | 2869 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); |
| 2870 | 2870 | radeon_ring_write(ring, 0); |
| 2871 | 2871 | radeon_ring_write(ring, 0); |
| 2872 | − radeon_ring_unlock_commit(rdev, ring); | |
| 2872 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 2873 | 2873 | |
| 2874 | 2874 | cp_me = 0xff; |
| 2875 | 2875 | WREG32(CP_ME_CNTL, cp_me); |
| @@ -2912,7 +2912,7 @@ static int evergreen_cp_start(struct radeon_device *rdev) · 36 unmodified lines | ||
| 2912 | 2912 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
| 2913 | 2913 | radeon_ring_write(ring, 0x00000010); /* */ |
| 2914 | 2914 | |
| 2915 | − radeon_ring_unlock_commit(rdev, ring); | |
| 2915 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 2916 | 2916 | |
| 2917 | 2917 | return 0; |
| 2918 | 2918 | } |
| @@ -155,7 +155,7 @@ int evergreen_copy_dma(struct radeon_device *rdev, · 154 unmodified lines | ||
| 155 | 155 | return r; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | − radeon_ring_unlock_commit(rdev, ring); | |
| 158 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 159 | 159 | radeon_semaphore_free(rdev, &sem, *fence); |
| 160 | 160 | |
| 161 | 161 | return r; |
| @@ -1438,14 +1438,14 @@ static int kv_update_uvd_dpm(struct radeon_device *rdev, bool gate) · 1437 unmodified lines | ||
| 1438 | 1438 | return kv_enable_uvd_dpm(rdev, !gate); |
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | −static u8 kv_get_vce_boot_level(struct radeon_device *rdev) | |
| 1441 | +static u8 kv_get_vce_boot_level(struct radeon_device *rdev, u32 evclk) | |
| 1442 | 1442 | { |
| 1443 | 1443 | u8 i; |
| 1444 | 1444 | struct radeon_vce_clock_voltage_dependency_table *table = |
| 1445 | 1445 | &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; |
| 1446 | 1446 | |
| 1447 | 1447 | for (i = 0; i < table->count; i++) { |
| 1448 | − if (table->entries[i].evclk >= 0) /* XXX */ | |
| 1448 | + if (table->entries[i].evclk >= evclk) | |
| 1449 | 1449 | break; |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| @@ -1468,7 +1468,7 @@ static int kv_update_vce_dpm(struct radeon_device *rdev, · 16 unmodified lines | ||
| 1468 | 1468 | if (pi->caps_stable_p_state) |
| 1469 | 1469 | pi->vce_boot_level = table->count - 1; |
| 1470 | 1470 | else |
| 1471 | − pi->vce_boot_level = kv_get_vce_boot_level(rdev); | |
| 1471 | + pi->vce_boot_level = kv_get_vce_boot_level(rdev, radeon_new_state->evclk); | |
| 1472 | 1472 | |
| 1473 | 1473 | ret = kv_copy_bytes_to_smc(rdev, |
| 1474 | 1474 | pi->dpm_table_start + |
| @@ -2726,7 +2726,10 @@ int kv_dpm_init(struct radeon_device *rdev) · 1251 unmodified lines | ||
| 2726 | 2726 | pi->caps_sclk_ds = true; |
| 2727 | 2727 | pi->enable_auto_thermal_throttling = true; |
| 2728 | 2728 | pi->disable_nb_ps3_in_battery = false; |
| 2729 | − pi->bapm_enable = true; | |
| 2729 | + if (radeon_bapm == 0) | |
| 2730 | + pi->bapm_enable = false; | |
| 2731 | + else | |
| 2732 | + pi->bapm_enable = true; | |
| 2730 | 2733 | pi->voltage_drop_t = 0; |
| 2731 | 2734 | pi->caps_sclk_throttle_low_notification = false; |
| 2732 | 2735 | pi->caps_fps = false; /* true? */ |
| @@ -1271,7 +1271,7 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) · 1270 unmodified lines | ||
| 1271 | 1271 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i << 2), 0); |
| 1272 | 1272 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), rdev->vm_manager.max_pfn); |
| 1273 | 1273 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
| 1274 | − rdev->gart.table_addr >> 12); | |
| 1274 | + rdev->vm_manager.saved_table_addr[i]); | |
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | 1277 | /* enable context1-7 */ |
| @@ -1303,6 +1303,13 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) · 25 unmodified lines | ||
| 1303 | 1303 | |
| 1304 | 1304 | static void cayman_pcie_gart_disable(struct radeon_device *rdev) |
| 1305 | 1305 | { |
| 1306 | + unsigned i; | |
| 1307 | + | |
| 1308 | + for (i = 1; i < 8; ++i) { | |
| 1309 | + rdev->vm_manager.saved_table_addr[i] = RREG32( | |
| 1310 | + VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2)); | |
| 1311 | + } | |
| 1312 | + | |
| 1306 | 1313 | /* Disable all tables */ |
| 1307 | 1314 | WREG32(VM_CONTEXT0_CNTL, 0); |
| 1308 | 1315 | WREG32(VM_CONTEXT1_CNTL, 0); |
| @@ -1505,7 +1512,7 @@ static int cayman_cp_start(struct radeon_device *rdev) · 196 unmodified lines | ||
| 1505 | 1512 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); |
| 1506 | 1513 | radeon_ring_write(ring, 0); |
| 1507 | 1514 | radeon_ring_write(ring, 0); |
| 1508 | − radeon_ring_unlock_commit(rdev, ring); | |
| 1515 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 1509 | 1516 | |
| 1510 | 1517 | cayman_cp_enable(rdev, true); |
| 1511 | 1518 | |
| @@ -1547,7 +1554,7 @@ static int cayman_cp_start(struct radeon_device *rdev) · 35 unmodified lines | ||
| 1547 | 1554 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
| 1548 | 1555 | radeon_ring_write(ring, 0x00000010); /* */ |
| 1549 | 1556 | |
| 1550 | − radeon_ring_unlock_commit(rdev, ring); | |
| 1557 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 1551 | 1558 | |
| 1552 | 1559 | /* XXX init other rings */ |
| 1553 | 1560 | |
| @@ -925,7 +925,7 @@ int r100_copy_blit(struct radeon_device *rdev, · 924 unmodified lines | ||
| 925 | 925 | if (fence) { |
| 926 | 926 | r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX); |
| 927 | 927 | } |
| 928 | − radeon_ring_unlock_commit(rdev, ring); | |
| 928 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 929 | 929 | return r; |
| 930 | 930 | } |
| 931 | 931 | |
| @@ -958,7 +958,7 @@ void r100_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) · 26 unmodified lines | ||
| 958 | 958 | RADEON_ISYNC_ANY3D_IDLE2D | |
| 959 | 959 | RADEON_ISYNC_WAIT_IDLEGUI | |
| 960 | 960 | RADEON_ISYNC_CPSCRATCH_IDLEGUI); |
| 961 | − radeon_ring_unlock_commit(rdev, ring); | |
| 961 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | |
| @@ -3638,7 +3638,7 @@ int r100_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · 2673 unmodified lines | ||
| 3638 | 3638 | } |
| 3639 | 3639 | radeon_ring_write(ring, PACKET0(scratch, 0)); |
| 3640 | 3640 | radeon_ring_write(ring, 0xDEADBEEF); |
| 3641 | − radeon_ring_unlock_commit(rdev, ring); | |
| 3641 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 3642 | 3642 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 3643 | 3643 | tmp = RREG32(scratch); |
| 3644 | 3644 | if (tmp == 0xDEADBEEF) { |
| @@ -3700,7 +3700,7 @@ int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) · 55 unmodified lines | ||
| 3700 | 3700 | ib.ptr[6] = PACKET2(0); |
| 3701 | 3701 | ib.ptr[7] = PACKET2(0); |
| 3702 | 3702 | ib.length_dw = 8; |
| 3703 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 3703 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 3704 | 3704 | if (r) { |
| 3705 | 3705 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
| 3706 | 3706 | goto free_ib; |
| @@ -121,7 +121,7 @@ int r200_copy_dma(struct radeon_device *rdev, · 120 unmodified lines | ||
| 121 | 121 | if (fence) { |
| 122 | 122 | r = radeon_fence_emit(rdev, fence, RADEON_RING_TYPE_GFX_INDEX); |
| 123 | 123 | } |
| 124 | − radeon_ring_unlock_commit(rdev, ring); | |
| 124 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 125 | 125 | return r; |
| 126 | 126 | } |
| 127 | 127 | |
| @@ -295,7 +295,7 @@ void r300_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) · 294 unmodified lines | ||
| 295 | 295 | radeon_ring_write(ring, |
| 296 | 296 | R300_GEOMETRY_ROUND_NEAREST | |
| 297 | 297 | R300_COLOR_ROUND_NEAREST); |
| 298 | − radeon_ring_unlock_commit(rdev, ring); | |
| 298 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | static void r300_errata(struct radeon_device *rdev) |
| @@ -219,7 +219,7 @@ static void r420_cp_errata_init(struct radeon_device *rdev) · 218 unmodified lines | ||
| 219 | 219 | radeon_ring_write(ring, PACKET0(R300_CP_RESYNC_ADDR, 1)); |
| 220 | 220 | radeon_ring_write(ring, rdev->config.r300.resync_scratch); |
| 221 | 221 | radeon_ring_write(ring, 0xDEADBEEF); |
| 222 | − radeon_ring_unlock_commit(rdev, ring); | |
| 222 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | static void r420_cp_errata_fini(struct radeon_device *rdev) |
| @@ -232,7 +232,7 @@ static void r420_cp_errata_fini(struct radeon_device *rdev) · 6 unmodified lines | ||
| 232 | 232 | radeon_ring_lock(rdev, ring, 8); |
| 233 | 233 | radeon_ring_write(ring, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); |
| 234 | 234 | radeon_ring_write(ring, R300_RB3D_DC_FINISH); |
| 235 | − radeon_ring_unlock_commit(rdev, ring); | |
| 235 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 236 | 236 | radeon_scratch_free(rdev, rdev->config.r300.resync_scratch); |
| 237 | 237 | } |
| 238 | 238 | |
| @@ -1812,7 +1812,6 @@ static void r600_gpu_init(struct radeon_device *rdev) · 1811 unmodified lines | ||
| 1812 | 1812 | { |
| 1813 | 1813 | u32 tiling_config; |
| 1814 | 1814 | u32 ramcfg; |
| 1815 | − u32 cc_rb_backend_disable; | |
| 1816 | 1815 | u32 cc_gc_shader_pipe_config; |
| 1817 | 1816 | u32 tmp; |
| 1818 | 1817 | int i, j; |
| @@ -1939,29 +1938,20 @@ static void r600_gpu_init(struct radeon_device *rdev) · 120 unmodified lines | ||
| 1939 | 1938 | } |
| 1940 | 1939 | tiling_config |= BANK_SWAPS(1); |
| 1941 | 1940 | |
| 1942 | − cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000; | |
| 1943 | − tmp = R6XX_MAX_BACKENDS - | |
| 1944 | − r600_count_pipe_bits((cc_rb_backend_disable >> 16) & R6XX_MAX_BACKENDS_MASK); | |
| 1945 | − if (tmp < rdev->config.r600.max_backends) { | |
| 1946 | − rdev->config.r600.max_backends = tmp; | |
| 1947 | − } | |
| 1948 | − | |
| 1949 | 1941 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0x00ffff00; |
| 1950 | − tmp = R6XX_MAX_PIPES - | |
| 1951 | − r600_count_pipe_bits((cc_gc_shader_pipe_config >> 8) & R6XX_MAX_PIPES_MASK); | |
| 1952 | − if (tmp < rdev->config.r600.max_pipes) { | |
| 1953 | − rdev->config.r600.max_pipes = tmp; | |
| 1954 | − } | |
| 1955 | − tmp = R6XX_MAX_SIMDS - | |
| 1956 | − r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK); | |
| 1957 | − if (tmp < rdev->config.r600.max_simds) { | |
| 1958 | − rdev->config.r600.max_simds = tmp; | |
| 1959 | − } | |
| 1960 | 1942 | tmp = rdev->config.r600.max_simds - |
| 1961 | 1943 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R6XX_MAX_SIMDS_MASK); |
| 1962 | 1944 | rdev->config.r600.active_simds = tmp; |
| 1963 | 1945 | |
| 1964 | 1946 | disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R6XX_MAX_BACKENDS_MASK; |
| 1947 | + tmp = 0; | |
| 1948 | + for (i = 0; i < rdev->config.r600.max_backends; i++) | |
| 1949 | + tmp |= (1 << i); | |
| 1950 | + /* if all the backends are disabled, fix it up here */ | |
| 1951 | + if ((disabled_rb_mask & tmp) == tmp) { | |
| 1952 | + for (i = 0; i < rdev->config.r600.max_backends; i++) | |
| 1953 | + disabled_rb_mask &= ~(1 << i); | |
| 1954 | + } | |
| 1965 | 1955 | tmp = (tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; |
| 1966 | 1956 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.r600.max_backends, |
| 1967 | 1957 | R6XX_MAX_BACKENDS, disabled_rb_mask); |
| @@ -2547,7 +2537,7 @@ int r600_cp_start(struct radeon_device *rdev) · 579 unmodified lines | ||
| 2547 | 2537 | radeon_ring_write(ring, PACKET3_ME_INITIALIZE_DEVICE_ID(1)); |
| 2548 | 2538 | radeon_ring_write(ring, 0); |
| 2549 | 2539 | radeon_ring_write(ring, 0); |
| 2550 | − radeon_ring_unlock_commit(rdev, ring); | |
| 2540 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 2551 | 2541 | |
| 2552 | 2542 | cp_me = 0xff; |
| 2553 | 2543 | WREG32(R_0086D8_CP_ME_CNTL, cp_me); |
| @@ -2683,7 +2673,7 @@ int r600_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · 129 unmodified lines | ||
| 2683 | 2673 | radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
| 2684 | 2674 | radeon_ring_write(ring, ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); |
| 2685 | 2675 | radeon_ring_write(ring, 0xDEADBEEF); |
| 2686 | − radeon_ring_unlock_commit(rdev, ring); | |
| 2676 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 2687 | 2677 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 2688 | 2678 | tmp = RREG32(scratch); |
| 2689 | 2679 | if (tmp == 0xDEADBEEF) |
| @@ -2753,6 +2743,17 @@ void r600_fence_ring_emit(struct radeon_device *rdev, · 63 unmodified lines | ||
| 2753 | 2743 | } |
| 2754 | 2744 | } |
| 2755 | 2745 | |
| 2746 | +/** | |
| 2747 | + * r600_semaphore_ring_emit - emit a semaphore on the CP ring | |
| 2748 | + * | |
| 2749 | + * @rdev: radeon_device pointer | |
| 2750 | + * @ring: radeon ring buffer object | |
| 2751 | + * @semaphore: radeon semaphore object | |
| 2752 | + * @emit_wait: Is this a sempahore wait? | |
| 2753 | + * | |
| 2754 | + * Emits a semaphore signal/wait packet to the CP ring and prevents the PFP | |
| 2755 | + * from running ahead of semaphore waits. | |
| 2756 | + */ | |
| 2756 | 2757 | bool r600_semaphore_ring_emit(struct radeon_device *rdev, |
| 2757 | 2758 | struct radeon_ring *ring, |
| 2758 | 2759 | struct radeon_semaphore *semaphore, |
| @@ -2768,6 +2769,13 @@ bool r600_semaphore_ring_emit(struct radeon_device *rdev, · 9 unmodified lines | ||
| 2768 | 2769 | radeon_ring_write(ring, lower_32_bits(addr)); |
| 2769 | 2770 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); |
| 2770 | 2771 | |
| 2772 | + /* PFP_SYNC_ME packet only exists on 7xx+ */ | |
| 2773 | + if (emit_wait && (rdev->family >= CHIP_RV770)) { | |
| 2774 | + /* Prevent the PFP from running ahead of the semaphore wait */ | |
| 2775 | + radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | |
| 2776 | + radeon_ring_write(ring, 0x0); | |
| 2777 | + } | |
| 2778 | + | |
| 2771 | 2779 | return true; |
| 2772 | 2780 | } |
| 2773 | 2781 | |
| @@ -2845,7 +2853,7 @@ int r600_copy_cpdma(struct radeon_device *rdev, · 71 unmodified lines | ||
| 2845 | 2853 | return r; |
| 2846 | 2854 | } |
| 2847 | 2855 | |
| 2848 | − radeon_ring_unlock_commit(rdev, ring); | |
| 2856 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 2849 | 2857 | radeon_semaphore_free(rdev, &sem, *fence); |
| 2850 | 2858 | |
| 2851 | 2859 | return r; |
| @@ -3165,7 +3173,7 @@ int r600_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) · 313 unmodified lines | ||
| 3165 | 3173 | ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_OFFSET) >> 2); |
| 3166 | 3174 | ib.ptr[2] = 0xDEADBEEF; |
| 3167 | 3175 | ib.length_dw = 3; |
| 3168 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 3176 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 3169 | 3177 | if (r) { |
| 3170 | 3178 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
| 3171 | 3179 | goto free_ib; |
| @@ -261,7 +261,7 @@ int r600_dma_ring_test(struct radeon_device *rdev, · 260 unmodified lines | ||
| 261 | 261 | radeon_ring_write(ring, rdev->vram_scratch.gpu_addr & 0xfffffffc); |
| 262 | 262 | radeon_ring_write(ring, upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff); |
| 263 | 263 | radeon_ring_write(ring, 0xDEADBEEF); |
| 264 | − radeon_ring_unlock_commit(rdev, ring); | |
| 264 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 265 | 265 | |
| 266 | 266 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 267 | 267 | tmp = readl(ptr); |
| @@ -368,7 +368,7 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) · 100 unmodified lines | ||
| 368 | 368 | ib.ptr[3] = 0xDEADBEEF; |
| 369 | 369 | ib.length_dw = 4; |
| 370 | 370 | |
| 371 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 371 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 372 | 372 | if (r) { |
| 373 | 373 | radeon_ib_free(rdev, &ib); |
| 374 | 374 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
| @@ -493,7 +493,7 @@ int r600_copy_dma(struct radeon_device *rdev, · 118 unmodified lines | ||
| 493 | 493 | return r; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | − radeon_ring_unlock_commit(rdev, ring); | |
| 496 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 497 | 497 | radeon_semaphore_free(rdev, &sem, *fence); |
| 498 | 498 | |
| 499 | 499 | return r; |
| @@ -1597,6 +1597,7 @@ · 1596 unmodified lines | ||
| 1597 | 1597 | */ |
| 1598 | 1598 | # define PACKET3_CP_DMA_CMD_SAIC (1 << 28) |
| 1599 | 1599 | # define PACKET3_CP_DMA_CMD_DAIC (1 << 29) |
| 1600 | +#define PACKET3_PFP_SYNC_ME 0x42 /* r7xx+ only */ | |
| 1600 | 1601 | #define PACKET3_SURFACE_SYNC 0x43 |
| 1601 | 1602 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) |
| 1602 | 1603 | # define PACKET3_FULL_CACHE_ENA (1 << 20) /* r7xx+ only */ |
| @@ -105,6 +105,7 @@ extern int radeon_vm_size; · 104 unmodified lines | ||
| 105 | 105 | extern int radeon_vm_block_size; |
| 106 | 106 | extern int radeon_deep_color; |
| 107 | 107 | extern int radeon_use_pflipirq; |
| 108 | +extern int radeon_bapm; | |
| 108 | 109 | |
| 109 | 110 | /* |
| 110 | 111 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
| @@ -914,6 +915,8 @@ struct radeon_vm_manager { · 803 unmodified lines | ||
| 914 | 915 | u64 vram_base_offset; |
| 915 | 916 | /* is vm enabled? */ |
| 916 | 917 | bool enabled; |
| 918 | + /* for hw to save the PD addr on suspend/resume */ | |
| 919 | + uint32_t saved_table_addr[RADEON_NUM_VM]; | |
| 917 | 920 | }; |
| 918 | 921 | |
| 919 | 922 | /* |
| @@ -967,7 +970,7 @@ int radeon_ib_get(struct radeon_device *rdev, int ring, · 47 unmodified lines | ||
| 967 | 970 | unsigned size); |
| 968 | 971 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib); |
| 969 | 972 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, |
| 970 | − struct radeon_ib *const_ib); | |
| 973 | + struct radeon_ib *const_ib, bool hdp_flush); | |
| 971 | 974 | int radeon_ib_pool_init(struct radeon_device *rdev); |
| 972 | 975 | void radeon_ib_pool_fini(struct radeon_device *rdev); |
| 973 | 976 | int radeon_ib_ring_tests(struct radeon_device *rdev); |
| @@ -977,8 +980,10 @@ bool radeon_ring_supports_scratch_reg(struct radeon_device *rdev, · 3 unmodified lines | ||
| 977 | 980 | void radeon_ring_free_size(struct radeon_device *rdev, struct radeon_ring *cp); |
| 978 | 981 | int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); |
| 979 | 982 | int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); |
| 980 | −void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp); | |
| 981 | −void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp); | |
| 983 | +void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp, | |
| 984 | + bool hdp_flush); | |
| 985 | +void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp, | |
| 986 | + bool hdp_flush); | |
| 982 | 987 | void radeon_ring_undo(struct radeon_ring *ring); |
| 983 | 988 | void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp); |
| 984 | 989 | int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp); |
| @@ -132,7 +132,8 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) · 131 unmodified lines | ||
| 132 | 132 | * the buffers used for read only, which doubles the range |
| 133 | 133 | * to 0 to 31. 32 is reserved for the kernel driver. |
| 134 | 134 | */ |
| 135 | − priority = (r->flags & 0xf) * 2 + !!r->write_domain; | |
| 135 | + priority = (r->flags & RADEON_RELOC_PRIO_MASK) * 2 | |
| 136 | + + !!r->write_domain; | |
| 136 | 137 | |
| 137 | 138 | /* the first reloc of an UVD job is the msg and that must be in |
| 138 | 139 | VRAM, also but everything into VRAM on AGP cards to avoid |
| @@ -450,7 +451,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev, · 311 unmodified lines | ||
| 450 | 451 | radeon_vce_note_usage(rdev); |
| 451 | 452 | |
| 452 | 453 | radeon_cs_sync_rings(parser); |
| 453 | − r = radeon_ib_schedule(rdev, &parser->ib, NULL); | |
| 454 | + r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); | |
| 454 | 455 | if (r) { |
| 455 | 456 | DRM_ERROR("Failed to schedule IB !\n"); |
| 456 | 457 | } |
| @@ -541,9 +542,9 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, · 84 unmodified lines | ||
| 541 | 542 | |
| 542 | 543 | if ((rdev->family >= CHIP_TAHITI) && |
| 543 | 544 | (parser->chunk_const_ib_idx != -1)) { |
| 544 | − r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib); | |
| 545 | + r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib, true); | |
| 545 | 546 | } else { |
| 546 | − r = radeon_ib_schedule(rdev, &parser->ib, NULL); | |
| 547 | + r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); | |
| 547 | 548 | } |
| 548 | 549 | |
| 549 | 550 | out: |
| @@ -1680,8 +1680,8 @@ int radeon_gpu_reset(struct radeon_device *rdev) · 1679 unmodified lines | ||
| 1680 | 1680 | radeon_save_bios_scratch_regs(rdev); |
| 1681 | 1681 | /* block TTM */ |
| 1682 | 1682 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); |
| 1683 | − radeon_pm_suspend(rdev); | |
| 1684 | 1683 | radeon_suspend(rdev); |
| 1684 | + radeon_hpd_fini(rdev); | |
| 1685 | 1685 | |
| 1686 | 1686 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
| 1687 | 1687 | ring_sizes[i] = radeon_ring_backup(rdev, &rdev->ring[i], |
| @@ -1726,9 +1726,39 @@ retry: · 38 unmodified lines | ||
| 1726 | 1726 | } |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | − radeon_pm_resume(rdev); | |
| 1729 | + if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { | |
| 1730 | + /* do dpm late init */ | |
| 1731 | + r = radeon_pm_late_init(rdev); | |
| 1732 | + if (r) { | |
| 1733 | + rdev->pm.dpm_enabled = false; | |
| 1734 | + DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); | |
| 1735 | + } | |
| 1736 | + } else { | |
| 1737 | + /* resume old pm late */ | |
| 1738 | + radeon_pm_resume(rdev); | |
| 1739 | + } | |
| 1740 | + | |
| 1741 | + /* init dig PHYs, disp eng pll */ | |
| 1742 | + if (rdev->is_atom_bios) { | |
| 1743 | + radeon_atom_encoder_init(rdev); | |
| 1744 | + radeon_atom_disp_eng_pll_init(rdev); | |
| 1745 | + /* turn on the BL */ | |
| 1746 | + if (rdev->mode_info.bl_encoder) { | |
| 1747 | + u8 bl_level = radeon_get_backlight_level(rdev, | |
| 1748 | + rdev->mode_info.bl_encoder); | |
| 1749 | + radeon_set_backlight_level(rdev, rdev->mode_info.bl_encoder, | |
| 1750 | + bl_level); | |
| 1751 | + } | |
| 1752 | + } | |
| 1753 | + /* reset hpd state */ | |
| 1754 | + radeon_hpd_init(rdev); | |
| 1755 | + | |
| 1730 | 1756 | drm_helper_resume_force_mode(rdev->ddev); |
| 1731 | 1757 | |
| 1758 | + /* set the power state here in case we are a PX system or headless */ | |
| 1759 | + if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) | |
| 1760 | + radeon_pm_compute_clocks(rdev); | |
| 1761 | + | |
| 1732 | 1762 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); |
| 1733 | 1763 | if (r) { |
| 1734 | 1764 | /* bad news, how to tell it to userspace ? */ |
| @@ -180,6 +180,7 @@ int radeon_vm_size = 8; · 179 unmodified lines | ||
| 180 | 180 | int radeon_vm_block_size = -1; |
| 181 | 181 | int radeon_deep_color = 0; |
| 182 | 182 | int radeon_use_pflipirq = 2; |
| 183 | +int radeon_bapm = -1; | |
| 183 | 184 | |
| 184 | 185 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
| 185 | 186 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
| @@ -259,6 +260,9 @@ module_param_named(deep_color, radeon_deep_color, int, 0444); · 73 unmodified lines | ||
| 259 | 260 | MODULE_PARM_DESC(use_pflipirq, "Pflip irqs for pageflip completion (0 = disable, 1 = as fallback, 2 = exclusive (default))"); |
| 260 | 261 | module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444); |
| 261 | 262 | |
| 263 | +MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)"); | |
| 264 | +module_param_named(bapm, radeon_bapm, int, 0444); | |
| 265 | + | |
| 262 | 266 | static struct pci_device_id pciidlist[] = { |
| 263 | 267 | radeon_PCI_IDS |
| 264 | 268 | }; |
| @@ -107,6 +107,7 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib) · 106 unmodified lines | ||
| 107 | 107 | * @rdev: radeon_device pointer |
| 108 | 108 | * @ib: IB object to schedule |
| 109 | 109 | * @const_ib: Const IB to schedule (SI only) |
| 110 | + * @hdp_flush: Whether or not to perform an HDP cache flush | |
| 110 | 111 | * |
| 111 | 112 | * Schedule an IB on the associated ring (all asics). |
| 112 | 113 | * Returns 0 on success, error on failure. |
| @@ -122,7 +123,7 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib) · 9 unmodified lines | ||
| 122 | 123 | * to SI there was just a DE IB. |
| 123 | 124 | */ |
| 124 | 125 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, |
| 125 | − struct radeon_ib *const_ib) | |
| 126 | + struct radeon_ib *const_ib, bool hdp_flush) | |
| 126 | 127 | { |
| 127 | 128 | struct radeon_ring *ring = &rdev->ring[ib->ring]; |
| 128 | 129 | int r = 0; |
| @@ -176,7 +177,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, · 47 unmodified lines | ||
| 176 | 177 | if (ib->vm) |
| 177 | 178 | radeon_vm_fence(rdev, ib->vm, ib->fence); |
| 178 | 179 | |
| 179 | − radeon_ring_unlock_commit(rdev, ring); | |
| 180 | + radeon_ring_unlock_commit(rdev, ring, hdp_flush); | |
| 180 | 181 | return 0; |
| 181 | 182 | } |
| 182 | 183 | |
| @@ -460,10 +460,6 @@ static ssize_t radeon_get_dpm_state(struct device *dev, · 459 unmodified lines | ||
| 460 | 460 | struct radeon_device *rdev = ddev->dev_private; |
| 461 | 461 | enum radeon_pm_state_type pm = rdev->pm.dpm.user_state; |
| 462 | 462 | |
| 463 | − if ((rdev->flags & RADEON_IS_PX) && | |
| 464 | − (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | |
| 465 | − return snprintf(buf, PAGE_SIZE, "off\n"); | |
| 466 | − | |
| 467 | 463 | return snprintf(buf, PAGE_SIZE, "%s\n", |
| 468 | 464 | (pm == POWER_STATE_TYPE_BATTERY) ? "battery" : |
| 469 | 465 | (pm == POWER_STATE_TYPE_BALANCED) ? "balanced" : "performance"); |
| @@ -477,11 +473,6 @@ static ssize_t radeon_set_dpm_state(struct device *dev, · 7 unmodified lines | ||
| 477 | 473 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 478 | 474 | struct radeon_device *rdev = ddev->dev_private; |
| 479 | 475 | |
| 480 | − /* Can't set dpm state when the card is off */ | |
| 481 | − if ((rdev->flags & RADEON_IS_PX) && | |
| 482 | − (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | |
| 483 | − return -EINVAL; | |
| 484 | − | |
| 485 | 476 | mutex_lock(&rdev->pm.mutex); |
| 486 | 477 | if (strncmp("battery", buf, strlen("battery")) == 0) |
| 487 | 478 | rdev->pm.dpm.user_state = POWER_STATE_TYPE_BATTERY; |
| @@ -495,7 +486,12 @@ static ssize_t radeon_set_dpm_state(struct device *dev, · 7 unmodified lines | ||
| 495 | 486 | goto fail; |
| 496 | 487 | } |
| 497 | 488 | mutex_unlock(&rdev->pm.mutex); |
| 498 | − radeon_pm_compute_clocks(rdev); | |
| 489 | + | |
| 490 | + /* Can't set dpm state when the card is off */ | |
| 491 | + if (!(rdev->flags & RADEON_IS_PX) || | |
| 492 | + (ddev->switch_power_state == DRM_SWITCH_POWER_ON)) | |
| 493 | + radeon_pm_compute_clocks(rdev); | |
| 494 | + | |
| 499 | 495 | fail: |
| 500 | 496 | return count; |
| 501 | 497 | } |
| @@ -177,16 +177,18 @@ int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *ring, unsig · 176 unmodified lines | ||
| 177 | 177 | * |
| 178 | 178 | * @rdev: radeon_device pointer |
| 179 | 179 | * @ring: radeon_ring structure holding ring information |
| 180 | + * @hdp_flush: Whether or not to perform an HDP cache flush | |
| 180 | 181 | * |
| 181 | 182 | * Update the wptr (write pointer) to tell the GPU to |
| 182 | 183 | * execute new commands on the ring buffer (all asics). |
| 183 | 184 | */ |
| 184 | −void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring) | |
| 185 | +void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring, | |
| 186 | + bool hdp_flush) | |
| 185 | 187 | { |
| 186 | 188 | /* If we are emitting the HDP flush via the ring buffer, we need to |
| 187 | 189 | * do it before padding. |
| 188 | 190 | */ |
| 189 | − if (rdev->asic->ring[ring->idx]->hdp_flush) | |
| 191 | + if (hdp_flush && rdev->asic->ring[ring->idx]->hdp_flush) | |
| 190 | 192 | rdev->asic->ring[ring->idx]->hdp_flush(rdev, ring); |
| 191 | 193 | /* We pad to match fetch size */ |
| 192 | 194 | while (ring->wptr & ring->align_mask) { |
| @@ -196,7 +198,7 @@ void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring) · 3 unmodified lines | ||
| 196 | 198 | /* If we are emitting the HDP flush via MMIO, we need to do it after |
| 197 | 199 | * all CPU writes to VRAM finished. |
| 198 | 200 | */ |
| 199 | − if (rdev->asic->mmio_hdp_flush) | |
| 201 | + if (hdp_flush && rdev->asic->mmio_hdp_flush) | |
| 200 | 202 | rdev->asic->mmio_hdp_flush(rdev); |
| 201 | 203 | radeon_ring_set_wptr(rdev, ring); |
| 202 | 204 | } |
| @@ -207,12 +209,14 @@ void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring) · 4 unmodified lines | ||
| 207 | 209 | * |
| 208 | 210 | * @rdev: radeon_device pointer |
| 209 | 211 | * @ring: radeon_ring structure holding ring information |
| 212 | + * @hdp_flush: Whether or not to perform an HDP cache flush | |
| 210 | 213 | * |
| 211 | 214 | * Call radeon_ring_commit() then unlock the ring (all asics). |
| 212 | 215 | */ |
| 213 | −void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *ring) | |
| 216 | +void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *ring, | |
| 217 | + bool hdp_flush) | |
| 214 | 218 | { |
| 215 | − radeon_ring_commit(rdev, ring); | |
| 219 | + radeon_ring_commit(rdev, ring, hdp_flush); | |
| 216 | 220 | mutex_unlock(&rdev->ring_lock); |
| 217 | 221 | } |
| 218 | 222 | |
| @@ -372,7 +376,7 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring, · 153 unmodified lines | ||
| 372 | 376 | radeon_ring_write(ring, data[i]); |
| 373 | 377 | } |
| 374 | 378 | |
| 375 | − radeon_ring_unlock_commit(rdev, ring); | |
| 379 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 376 | 380 | kfree(data); |
| 377 | 381 | return 0; |
| 378 | 382 | } |
| @@ -400,9 +404,7 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig · 21 unmodified lines | ||
| 400 | 404 | /* Allocate ring buffer */ |
| 401 | 405 | if (ring->ring_obj == NULL) { |
| 402 | 406 | r = radeon_bo_create(rdev, ring->ring_size, PAGE_SIZE, true, |
| 403 | − RADEON_GEM_DOMAIN_GTT, | |
| 404 | − (rdev->flags & RADEON_IS_PCIE) ? | |
| 405 | − RADEON_GEM_GTT_WC : 0, | |
| 407 | + RADEON_GEM_DOMAIN_GTT, 0, | |
| 406 | 408 | NULL, &ring->ring_obj); |
| 407 | 409 | if (r) { |
| 408 | 410 | dev_err(rdev->dev, "(%d) ring create failed\n", r); |
| @@ -179,7 +179,7 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, · 178 unmodified lines | ||
| 179 | 179 | continue; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | − radeon_ring_commit(rdev, &rdev->ring[i]); | |
| 182 | + radeon_ring_commit(rdev, &rdev->ring[i], false); | |
| 183 | 183 | radeon_fence_note_sync(fence, ring); |
| 184 | 184 | |
| 185 | 185 | semaphore->gpu_addr += 8; |
| @@ -288,7 +288,7 @@ static int radeon_test_create_and_emit_fence(struct radeon_device *rdev, · 287 unmodified lines | ||
| 288 | 288 | return r; |
| 289 | 289 | } |
| 290 | 290 | radeon_fence_emit(rdev, fence, ring->idx); |
| 291 | − radeon_ring_unlock_commit(rdev, ring); | |
| 291 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 292 | 292 | } |
| 293 | 293 | return 0; |
| 294 | 294 | } |
| @@ -313,7 +313,7 @@ void radeon_test_ring_sync(struct radeon_device *rdev, · 18 unmodified lines | ||
| 313 | 313 | goto out_cleanup; |
| 314 | 314 | } |
| 315 | 315 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); |
| 316 | − radeon_ring_unlock_commit(rdev, ringA); | |
| 316 | + radeon_ring_unlock_commit(rdev, ringA, false); | |
| 317 | 317 | |
| 318 | 318 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fence1); |
| 319 | 319 | if (r) |
| @@ -325,7 +325,7 @@ void radeon_test_ring_sync(struct radeon_device *rdev, · 5 unmodified lines | ||
| 325 | 325 | goto out_cleanup; |
| 326 | 326 | } |
| 327 | 327 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); |
| 328 | − radeon_ring_unlock_commit(rdev, ringA); | |
| 328 | + radeon_ring_unlock_commit(rdev, ringA, false); | |
| 329 | 329 | |
| 330 | 330 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fence2); |
| 331 | 331 | if (r) |
| @@ -344,7 +344,7 @@ void radeon_test_ring_sync(struct radeon_device *rdev, · 12 unmodified lines | ||
| 344 | 344 | goto out_cleanup; |
| 345 | 345 | } |
| 346 | 346 | radeon_semaphore_emit_signal(rdev, ringB->idx, semaphore); |
| 347 | − radeon_ring_unlock_commit(rdev, ringB); | |
| 347 | + radeon_ring_unlock_commit(rdev, ringB, false); | |
| 348 | 348 | |
| 349 | 349 | r = radeon_fence_wait(fence1, false); |
| 350 | 350 | if (r) { |
| @@ -365,7 +365,7 @@ void radeon_test_ring_sync(struct radeon_device *rdev, · 14 unmodified lines | ||
| 365 | 365 | goto out_cleanup; |
| 366 | 366 | } |
| 367 | 367 | radeon_semaphore_emit_signal(rdev, ringB->idx, semaphore); |
| 368 | − radeon_ring_unlock_commit(rdev, ringB); | |
| 368 | + radeon_ring_unlock_commit(rdev, ringB, false); | |
| 369 | 369 | |
| 370 | 370 | r = radeon_fence_wait(fence2, false); |
| 371 | 371 | if (r) { |
| @@ -408,7 +408,7 @@ static void radeon_test_ring_sync2(struct radeon_device *rdev, · 36 unmodified lines | ||
| 408 | 408 | goto out_cleanup; |
| 409 | 409 | } |
| 410 | 410 | radeon_semaphore_emit_wait(rdev, ringA->idx, semaphore); |
| 411 | − radeon_ring_unlock_commit(rdev, ringA); | |
| 411 | + radeon_ring_unlock_commit(rdev, ringA, false); | |
| 412 | 412 | |
| 413 | 413 | r = radeon_test_create_and_emit_fence(rdev, ringA, &fenceA); |
| 414 | 414 | if (r) |
| @@ -420,7 +420,7 @@ static void radeon_test_ring_sync2(struct radeon_device *rdev, · 5 unmodified lines | ||
| 420 | 420 | goto out_cleanup; |
| 421 | 421 | } |
| 422 | 422 | radeon_semaphore_emit_wait(rdev, ringB->idx, semaphore); |
| 423 | − radeon_ring_unlock_commit(rdev, ringB); | |
| 423 | + radeon_ring_unlock_commit(rdev, ringB, false); | |
| 424 | 424 | r = radeon_test_create_and_emit_fence(rdev, ringB, &fenceB); |
| 425 | 425 | if (r) |
| 426 | 426 | goto out_cleanup; |
| @@ -442,7 +442,7 @@ static void radeon_test_ring_sync2(struct radeon_device *rdev, · 15 unmodified lines | ||
| 442 | 442 | goto out_cleanup; |
| 443 | 443 | } |
| 444 | 444 | radeon_semaphore_emit_signal(rdev, ringC->idx, semaphore); |
| 445 | − radeon_ring_unlock_commit(rdev, ringC); | |
| 445 | + radeon_ring_unlock_commit(rdev, ringC, false); | |
| 446 | 446 | |
| 447 | 447 | for (i = 0; i < 30; ++i) { |
| 448 | 448 | mdelay(100); |
| @@ -468,7 +468,7 @@ static void radeon_test_ring_sync2(struct radeon_device *rdev, · 19 unmodified lines | ||
| 468 | 468 | goto out_cleanup; |
| 469 | 469 | } |
| 470 | 470 | radeon_semaphore_emit_signal(rdev, ringC->idx, semaphore); |
| 471 | − radeon_ring_unlock_commit(rdev, ringC); | |
| 471 | + radeon_ring_unlock_commit(rdev, ringC, false); | |
| 472 | 472 | |
| 473 | 473 | mdelay(1000); |
| 474 | 474 | |
| @@ -646,7 +646,7 @@ static int radeon_uvd_send_msg(struct radeon_device *rdev, · 645 unmodified lines | ||
| 646 | 646 | ib.ptr[i] = PACKET2(0); |
| 647 | 647 | ib.length_dw = 16; |
| 648 | 648 | |
| 649 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 649 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 650 | 650 | if (r) |
| 651 | 651 | goto err; |
| 652 | 652 | ttm_eu_fence_buffer_objects(&ticket, &head, ib.fence); |
| @@ -368,7 +368,7 @@ int radeon_vce_get_create_msg(struct radeon_device *rdev, int ring, · 367 unmodified lines | ||
| 368 | 368 | for (i = ib.length_dw; i < ib_size_dw; ++i) |
| 369 | 369 | ib.ptr[i] = 0x0; |
| 370 | 370 | |
| 371 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 371 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 372 | 372 | if (r) { |
| 373 | 373 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
| 374 | 374 | } |
| @@ -425,7 +425,7 @@ int radeon_vce_get_destroy_msg(struct radeon_device *rdev, int ring, · 50 unmodified lines | ||
| 425 | 425 | for (i = ib.length_dw; i < ib_size_dw; ++i) |
| 426 | 426 | ib.ptr[i] = 0x0; |
| 427 | 427 | |
| 428 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 428 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 429 | 429 | if (r) { |
| 430 | 430 | DRM_ERROR("radeon: failed to schedule ib (%d).\n", r); |
| 431 | 431 | } |
| @@ -715,7 +715,7 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · 283 unmodified lines | ||
| 715 | 715 | return r; |
| 716 | 716 | } |
| 717 | 717 | radeon_ring_write(ring, VCE_CMD_END); |
| 718 | − radeon_ring_unlock_commit(rdev, ring); | |
| 718 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 719 | 719 | |
| 720 | 720 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 721 | 721 | if (vce_v1_0_get_rptr(rdev, ring) != rptr) |
| @@ -420,7 +420,7 @@ static int radeon_vm_clear_bo(struct radeon_device *rdev, · 419 unmodified lines | ||
| 420 | 420 | radeon_asic_vm_pad_ib(rdev, &ib); |
| 421 | 421 | WARN_ON(ib.length_dw > 64); |
| 422 | 422 | |
| 423 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 423 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 424 | 424 | if (r) |
| 425 | 425 | goto error; |
| 426 | 426 | |
| @@ -483,6 +483,10 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, · 56 unmodified lines | ||
| 483 | 483 | /* add a clone of the bo_va to clear the old address */ |
| 484 | 484 | struct radeon_bo_va *tmp; |
| 485 | 485 | tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); |
| 486 | + if (!tmp) { | |
| 487 | + mutex_unlock(&vm->mutex); | |
| 488 | + return -ENOMEM; | |
| 489 | + } | |
| 486 | 490 | tmp->it.start = bo_va->it.start; |
| 487 | 491 | tmp->it.last = bo_va->it.last; |
| 488 | 492 | tmp->vm = vm; |
| @@ -693,7 +697,7 @@ int radeon_vm_update_page_directory(struct radeon_device *rdev, · 204 unmodified lines | ||
| 693 | 697 | radeon_semaphore_sync_to(ib.semaphore, pd->tbo.sync_obj); |
| 694 | 698 | radeon_semaphore_sync_to(ib.semaphore, vm->last_id_use); |
| 695 | 699 | WARN_ON(ib.length_dw > ndw); |
| 696 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 700 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 697 | 701 | if (r) { |
| 698 | 702 | radeon_ib_free(rdev, &ib); |
| 699 | 703 | return r; |
| @@ -957,7 +961,7 @@ int radeon_vm_bo_update(struct radeon_device *rdev, · 257 unmodified lines | ||
| 957 | 961 | WARN_ON(ib.length_dw > ndw); |
| 958 | 962 | |
| 959 | 963 | radeon_semaphore_sync_to(ib.semaphore, vm->fence); |
| 960 | − r = radeon_ib_schedule(rdev, &ib, NULL); | |
| 964 | + r = radeon_ib_schedule(rdev, &ib, NULL, false); | |
| 961 | 965 | if (r) { |
| 962 | 966 | radeon_ib_free(rdev, &ib); |
| 963 | 967 | return r; |
| @@ -124,7 +124,7 @@ void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) · 123 unmodified lines | ||
| 124 | 124 | radeon_ring_write(ring, GEOMETRY_ROUND_NEAREST | COLOR_ROUND_NEAREST); |
| 125 | 125 | radeon_ring_write(ring, PACKET0(0x20C8, 0)); |
| 126 | 126 | radeon_ring_write(ring, 0); |
| 127 | − radeon_ring_unlock_commit(rdev, ring); | |
| 127 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | int rv515_mc_wait_for_idle(struct radeon_device *rdev) |
| @@ -1177,7 +1177,6 @@ static void rv770_gpu_init(struct radeon_device *rdev) · 1176 unmodified lines | ||
| 1177 | 1177 | u32 hdp_host_path_cntl; |
| 1178 | 1178 | u32 sq_dyn_gpr_size_simd_ab_0; |
| 1179 | 1179 | u32 gb_tiling_config = 0; |
| 1180 | − u32 cc_rb_backend_disable = 0; | |
| 1181 | 1180 | u32 cc_gc_shader_pipe_config = 0; |
| 1182 | 1181 | u32 mc_arb_ramcfg; |
| 1183 | 1182 | u32 db_debug4, tmp; |
| @@ -1311,21 +1310,7 @@ static void rv770_gpu_init(struct radeon_device *rdev) · 127 unmodified lines | ||
| 1311 | 1310 | WREG32(SPI_CONFIG_CNTL, 0); |
| 1312 | 1311 | } |
| 1313 | 1312 | |
| 1314 | − cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000; | |
| 1315 | − tmp = R7XX_MAX_BACKENDS - r600_count_pipe_bits(cc_rb_backend_disable >> 16); | |
| 1316 | − if (tmp < rdev->config.rv770.max_backends) { | |
| 1317 | − rdev->config.rv770.max_backends = tmp; | |
| 1318 | − } | |
| 1319 | − | |
| 1320 | 1313 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0xffffff00; |
| 1321 | − tmp = R7XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config >> 8) & R7XX_MAX_PIPES_MASK); | |
| 1322 | − if (tmp < rdev->config.rv770.max_pipes) { | |
| 1323 | − rdev->config.rv770.max_pipes = tmp; | |
| 1324 | − } | |
| 1325 | − tmp = R7XX_MAX_SIMDS - r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R7XX_MAX_SIMDS_MASK); | |
| 1326 | − if (tmp < rdev->config.rv770.max_simds) { | |
| 1327 | − rdev->config.rv770.max_simds = tmp; | |
| 1328 | − } | |
| 1329 | 1314 | tmp = rdev->config.rv770.max_simds - |
| 1330 | 1315 | r600_count_pipe_bits((cc_gc_shader_pipe_config >> 16) & R7XX_MAX_SIMDS_MASK); |
| 1331 | 1316 | rdev->config.rv770.active_simds = tmp; |
| @@ -1348,6 +1333,14 @@ static void rv770_gpu_init(struct radeon_device *rdev) · 16 unmodified lines | ||
| 1348 | 1333 | rdev->config.rv770.tiling_npipes = rdev->config.rv770.max_tile_pipes; |
| 1349 | 1334 | |
| 1350 | 1335 | disabled_rb_mask = (RREG32(CC_RB_BACKEND_DISABLE) >> 16) & R7XX_MAX_BACKENDS_MASK; |
| 1336 | + tmp = 0; | |
| 1337 | + for (i = 0; i < rdev->config.rv770.max_backends; i++) | |
| 1338 | + tmp |= (1 << i); | |
| 1339 | + /* if all the backends are disabled, fix it up here */ | |
| 1340 | + if ((disabled_rb_mask & tmp) == tmp) { | |
| 1341 | + for (i = 0; i < rdev->config.rv770.max_backends; i++) | |
| 1342 | + disabled_rb_mask &= ~(1 << i); | |
| 1343 | + } | |
| 1351 | 1344 | tmp = (gb_tiling_config & PIPE_TILING__MASK) >> PIPE_TILING__SHIFT; |
| 1352 | 1345 | tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.rv770.max_backends, |
| 1353 | 1346 | R7XX_MAX_BACKENDS, disabled_rb_mask); |
| @@ -90,7 +90,7 @@ int rv770_copy_dma(struct radeon_device *rdev, · 89 unmodified lines | ||
| 90 | 90 | return r; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | − radeon_ring_unlock_commit(rdev, ring); | |
| 93 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 94 | 94 | radeon_semaphore_free(rdev, &sem, *fence); |
| 95 | 95 | |
| 96 | 96 | return r; |
| @@ -3057,7 +3057,7 @@ static void si_gpu_init(struct radeon_device *rdev) · 3056 unmodified lines | ||
| 3057 | 3057 | u32 sx_debug_1; |
| 3058 | 3058 | u32 hdp_host_path_cntl; |
| 3059 | 3059 | u32 tmp; |
| 3060 | − int i, j, k; | |
| 3060 | + int i, j; | |
| 3061 | 3061 | |
| 3062 | 3062 | switch (rdev->family) { |
| 3063 | 3063 | case CHIP_TAHITI: |
| @@ -3255,12 +3255,11 @@ static void si_gpu_init(struct radeon_device *rdev) · 191 unmodified lines | ||
| 3255 | 3255 | rdev->config.si.max_sh_per_se, |
| 3256 | 3256 | rdev->config.si.max_cu_per_sh); |
| 3257 | 3257 | |
| 3258 | + rdev->config.si.active_cus = 0; | |
| 3258 | 3259 | for (i = 0; i < rdev->config.si.max_shader_engines; i++) { |
| 3259 | 3260 | for (j = 0; j < rdev->config.si.max_sh_per_se; j++) { |
| 3260 | − for (k = 0; k < rdev->config.si.max_cu_per_sh; k++) { | |
| 3261 | − rdev->config.si.active_cus += | |
| 3262 | − hweight32(si_get_cu_active_bitmap(rdev, i, j)); | |
| 3263 | − } | |
| 3261 | + rdev->config.si.active_cus += | |
| 3262 | + hweight32(si_get_cu_active_bitmap(rdev, i, j)); | |
| 3264 | 3263 | } |
| 3265 | 3264 | } |
| 3266 | 3265 | |
| @@ -3541,7 +3540,7 @@ static int si_cp_start(struct radeon_device *rdev) · 274 unmodified lines | ||
| 3541 | 3540 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); |
| 3542 | 3541 | radeon_ring_write(ring, 0xc000); |
| 3543 | 3542 | radeon_ring_write(ring, 0xe000); |
| 3544 | − radeon_ring_unlock_commit(rdev, ring); | |
| 3543 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 3545 | 3544 | |
| 3546 | 3545 | si_cp_enable(rdev, true); |
| 3547 | 3546 | |
| @@ -3570,7 +3569,7 @@ static int si_cp_start(struct radeon_device *rdev) · 22 unmodified lines | ||
| 3570 | 3569 | radeon_ring_write(ring, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ |
| 3571 | 3570 | radeon_ring_write(ring, 0x00000010); /* VGT_OUT_DEALLOC_CNTL */ |
| 3572 | 3571 | |
| 3573 | − radeon_ring_unlock_commit(rdev, ring); | |
| 3572 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 3574 | 3573 | |
| 3575 | 3574 | for (i = RADEON_RING_TYPE_GFX_INDEX; i <= CAYMAN_RING_TYPE_CP2_INDEX; ++i) { |
| 3576 | 3575 | ring = &rdev->ring[i]; |
| @@ -3580,7 +3579,7 @@ static int si_cp_start(struct radeon_device *rdev) · 3 unmodified lines | ||
| 3580 | 3579 | radeon_ring_write(ring, PACKET3_COMPUTE(PACKET3_CLEAR_STATE, 0)); |
| 3581 | 3580 | radeon_ring_write(ring, 0); |
| 3582 | 3581 | |
| 3583 | − radeon_ring_unlock_commit(rdev, ring); | |
| 3582 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 3584 | 3583 | } |
| 3585 | 3584 | |
| 3586 | 3585 | return 0; |
| @@ -4291,10 +4290,10 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) · 704 unmodified lines | ||
| 4291 | 4290 | for (i = 1; i < 16; i++) { |
| 4292 | 4291 | if (i < 8) |
| 4293 | 4292 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
| 4294 | − rdev->gart.table_addr >> 12); | |
| 4293 | + rdev->vm_manager.saved_table_addr[i]); | |
| 4295 | 4294 | else |
| 4296 | 4295 | WREG32(VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2), |
| 4297 | − rdev->gart.table_addr >> 12); | |
| 4296 | + rdev->vm_manager.saved_table_addr[i]); | |
| 4298 | 4297 | } |
| 4299 | 4298 | |
| 4300 | 4299 | /* enable context1-15 */ |
| @@ -4326,6 +4325,17 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) · 25 unmodified lines | ||
| 4326 | 4325 | |
| 4327 | 4326 | static void si_pcie_gart_disable(struct radeon_device *rdev) |
| 4328 | 4327 | { |
| 4328 | + unsigned i; | |
| 4329 | + | |
| 4330 | + for (i = 1; i < 16; ++i) { | |
| 4331 | + uint32_t reg; | |
| 4332 | + if (i < 8) | |
| 4333 | + reg = VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2); | |
| 4334 | + else | |
| 4335 | + reg = VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((i - 8) << 2); | |
| 4336 | + rdev->vm_manager.saved_table_addr[i] = RREG32(reg); | |
| 4337 | + } | |
| 4338 | + | |
| 4329 | 4339 | /* Disable all tables */ |
| 4330 | 4340 | WREG32(VM_CONTEXT0_CNTL, 0); |
| 4331 | 4341 | WREG32(VM_CONTEXT1_CNTL, 0); |
| @@ -5028,7 +5038,7 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) · 696 unmodified lines | ||
| 5028 | 5038 | |
| 5029 | 5039 | /* flush hdp cache */ |
| 5030 | 5040 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
| 5031 | − radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | |
| 5041 | + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) | | |
| 5032 | 5042 | WRITE_DATA_DST_SEL(0))); |
| 5033 | 5043 | radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2); |
| 5034 | 5044 | radeon_ring_write(ring, 0); |
| @@ -5036,7 +5046,7 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) · 1 unmodified line | ||
| 5036 | 5046 | |
| 5037 | 5047 | /* bits 0-15 are the VM contexts0-15 */ |
| 5038 | 5048 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
| 5039 | − radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | |
| 5049 | + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) | | |
| 5040 | 5050 | WRITE_DATA_DST_SEL(0))); |
| 5041 | 5051 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
| 5042 | 5052 | radeon_ring_write(ring, 0); |
| @@ -7178,6 +7188,9 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev) · 2135 unmodified lines | ||
| 7178 | 7188 | int ret, i; |
| 7179 | 7189 | u16 tmp16; |
| 7180 | 7190 | |
| 7191 | + if (pci_is_root_bus(rdev->pdev->bus)) | |
| 7192 | + return; | |
| 7193 | + | |
| 7181 | 7194 | if (radeon_pcie_gen2 == 0) |
| 7182 | 7195 | return; |
| 7183 | 7196 | |
| @@ -7455,7 +7468,8 @@ static void si_program_aspm(struct radeon_device *rdev) · 271 unmodified lines | ||
| 7455 | 7468 | if (orig != data) |
| 7456 | 7469 | WREG32_PIF_PHY1(PB1_PIF_CNTL, data); |
| 7457 | 7470 | |
| 7458 | − if (!disable_clkreq) { | |
| 7471 | + if (!disable_clkreq && | |
| 7472 | + !pci_is_root_bus(rdev->pdev->bus)) { | |
| 7459 | 7473 | struct pci_dev *root = rdev->pdev->bus->self; |
| 7460 | 7474 | u32 lnkcap; |
| 7461 | 7475 | |
| @@ -275,7 +275,7 @@ int si_copy_dma(struct radeon_device *rdev, · 274 unmodified lines | ||
| 275 | 275 | return r; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | − radeon_ring_unlock_commit(rdev, ring); | |
| 278 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 279 | 279 | radeon_semaphore_free(rdev, &sem, *fence); |
| 280 | 280 | |
| 281 | 281 | return r; |
| @@ -1874,16 +1874,22 @@ int trinity_dpm_init(struct radeon_device *rdev) · 1873 unmodified lines | ||
| 1874 | 1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
| 1875 | 1875 | pi->at[i] = TRINITY_AT_DFLT; |
| 1876 | 1876 | |
| 1877 | − /* There are stability issues reported on with | |
| 1878 | − * bapm enabled when switching between AC and battery | |
| 1879 | − * power. At the same time, some MSI boards hang | |
| 1880 | − * if it's not enabled and dpm is enabled. Just enable | |
| 1881 | − * it for MSI boards right now. | |
| 1882 | − */ | |
| 1883 | − if (rdev->pdev->subsystem_vendor == 0x1462) | |
| 1884 | − pi->enable_bapm = true; | |
| 1885 | − else | |
| 1877 | + if (radeon_bapm == -1) { | |
| 1878 | + /* There are stability issues reported on with | |
| 1879 | + * bapm enabled when switching between AC and battery | |
| 1880 | + * power. At the same time, some MSI boards hang | |
| 1881 | + * if it's not enabled and dpm is enabled. Just enable | |
| 1882 | + * it for MSI boards right now. | |
| 1883 | + */ | |
| 1884 | + if (rdev->pdev->subsystem_vendor == 0x1462) | |
| 1885 | + pi->enable_bapm = true; | |
| 1886 | + else | |
| 1887 | + pi->enable_bapm = false; | |
| 1888 | + } else if (radeon_bapm == 0) { | |
| 1886 | 1889 | pi->enable_bapm = false; |
| 1890 | + } else { | |
| 1891 | + pi->enable_bapm = true; | |
| 1892 | + } | |
| 1887 | 1893 | pi->enable_nbps_policy = true; |
| 1888 | 1894 | pi->enable_sclk_ds = true; |
| 1889 | 1895 | pi->enable_gfx_power_gating = true; |
| @@ -124,7 +124,7 @@ int uvd_v1_0_init(struct radeon_device *rdev) · 123 unmodified lines | ||
| 124 | 124 | radeon_ring_write(ring, PACKET0(UVD_SEMA_CNTL, 0)); |
| 125 | 125 | radeon_ring_write(ring, 3); |
| 126 | 126 | |
| 127 | − radeon_ring_unlock_commit(rdev, ring); | |
| 127 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 128 | 128 | |
| 129 | 129 | done: |
| 130 | 130 | /* lower clocks again */ |
| @@ -331,7 +331,7 @@ int uvd_v1_0_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · 200 unmodified lines | ||
| 331 | 331 | } |
| 332 | 332 | radeon_ring_write(ring, PACKET0(UVD_CONTEXT_ID, 0)); |
| 333 | 333 | radeon_ring_write(ring, 0xDEADBEEF); |
| 334 | − radeon_ring_unlock_commit(rdev, ring); | |
| 334 | + radeon_ring_unlock_commit(rdev, ring, false); | |
| 335 | 335 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 336 | 336 | tmp = RREG32(UVD_CONTEXT_ID); |
| 337 | 337 | if (tmp == 0xDEADBEEF) |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | config DRM_STI |
| 2 | 2 | tristate "DRM Support for STMicroelectronics SoC stiH41x Series" |
| 3 | 3 | depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM) |
| 4 | + select RESET_CONTROLLER | |
| 4 | 5 | select DRM_KMS_HELPER |
| 5 | 6 | select DRM_GEM_CMA_HELPER |
| 6 | 7 | select DRM_KMS_CMA_HELPER |
| @@ -201,8 +201,8 @@ static int sti_drm_platform_probe(struct platform_device *pdev) · 200 unmodified lines | ||
| 201 | 201 | master = platform_device_register_resndata(dev, |
| 202 | 202 | DRIVER_NAME "__master", -1, |
| 203 | 203 | NULL, 0, NULL, 0); |
| 204 | − if (!master) | |
| 205 | − return -EINVAL; | |
| 204 | + if (IS_ERR(master)) | |
| 205 | + return PTR_ERR(master); | |
| 206 | 206 | |
| 207 | 207 | platform_set_drvdata(pdev, master); |
| 208 | 208 | return 0; |
| @@ -730,16 +730,16 @@ static int sti_hda_probe(struct platform_device *pdev) · 729 unmodified lines | ||
| 730 | 730 | return -ENOMEM; |
| 731 | 731 | } |
| 732 | 732 | hda->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); |
| 733 | − if (IS_ERR(hda->regs)) | |
| 734 | − return PTR_ERR(hda->regs); | |
| 733 | + if (!hda->regs) | |
| 734 | + return -ENOMEM; | |
| 735 | 735 | |
| 736 | 736 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
| 737 | 737 | "video-dacs-ctrl"); |
| 738 | 738 | if (res) { |
| 739 | 739 | hda->video_dacs_ctrl = devm_ioremap_nocache(dev, res->start, |
| 740 | 740 | resource_size(res)); |
| 741 | − if (IS_ERR(hda->video_dacs_ctrl)) | |
| 742 | − return PTR_ERR(hda->video_dacs_ctrl); | |
| 741 | + if (!hda->video_dacs_ctrl) | |
| 742 | + return -ENOMEM; | |
| 743 | 743 | } else { |
| 744 | 744 | /* If no existing video-dacs-ctrl resource continue the probe */ |
| 745 | 745 | DRM_DEBUG_DRIVER("No video-dacs-ctrl resource\n"); |
| @@ -770,7 +770,7 @@ static int sti_hda_remove(struct platform_device *pdev) · 24 unmodified lines | ||
| 770 | 770 | return 0; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | −static struct of_device_id hda_of_match[] = { | |
| 773 | +static const struct of_device_id hda_of_match[] = { | |
| 774 | 774 | { .compatible = "st,stih416-hda", }, |
| 775 | 775 | { .compatible = "st,stih407-hda", }, |
| 776 | 776 | { /* end node */ } |
| @@ -677,7 +677,7 @@ static const struct component_ops sti_hdmi_ops = { · 676 unmodified lines | ||
| 677 | 677 | .unbind = sti_hdmi_unbind, |
| 678 | 678 | }; |
| 679 | 679 | |
| 680 | −static struct of_device_id hdmi_of_match[] = { | |
| 680 | +static const struct of_device_id hdmi_of_match[] = { | |
| 681 | 681 | { |
| 682 | 682 | .compatible = "st,stih416-hdmi", |
| 683 | 683 | .data = &tx3g0c55phy_ops, |
| @@ -713,8 +713,8 @@ static int sti_hdmi_probe(struct platform_device *pdev) · 29 unmodified lines | ||
| 713 | 713 | return -ENOMEM; |
| 714 | 714 | } |
| 715 | 715 | hdmi->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); |
| 716 | − if (IS_ERR(hdmi->regs)) | |
| 717 | − return PTR_ERR(hdmi->regs); | |
| 716 | + if (!hdmi->regs) | |
| 717 | + return -ENOMEM; | |
| 718 | 718 | |
| 719 | 719 | if (of_device_is_compatible(np, "st,stih416-hdmi")) { |
| 720 | 720 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
| @@ -725,8 +725,8 @@ static int sti_hdmi_probe(struct platform_device *pdev) · 4 unmodified lines | ||
| 725 | 725 | } |
| 726 | 726 | hdmi->syscfg = devm_ioremap_nocache(dev, res->start, |
| 727 | 727 | resource_size(res)); |
| 728 | − if (IS_ERR(hdmi->syscfg)) | |
| 729 | − return PTR_ERR(hdmi->syscfg); | |
| 728 | + if (!hdmi->syscfg) | |
| 729 | + return -ENOMEM; | |
| 730 | 730 | |
| 731 | 731 | } |
| 732 | 732 | |
| @@ -591,8 +591,8 @@ static int sti_tvout_probe(struct platform_device *pdev) · 590 unmodified lines | ||
| 591 | 591 | return -ENOMEM; |
| 592 | 592 | } |
| 593 | 593 | tvout->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); |
| 594 | − if (IS_ERR(tvout->regs)) | |
| 595 | − return PTR_ERR(tvout->regs); | |
| 594 | + if (!tvout->regs) | |
| 595 | + return -ENOMEM; | |
| 596 | 596 | |
| 597 | 597 | /* get reset resources */ |
| 598 | 598 | tvout->reset = devm_reset_control_get(dev, "tvout"); |
| @@ -624,7 +624,7 @@ static int sti_tvout_remove(struct platform_device *pdev) · 25 unmodified lines | ||
| 624 | 624 | return 0; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | −static struct of_device_id tvout_of_match[] = { | |
| 627 | +static const struct of_device_id tvout_of_match[] = { | |
| 628 | 628 | { .compatible = "st,stih416-tvout", }, |
| 629 | 629 | { .compatible = "st,stih407-tvout", }, |
| 630 | 630 | { /* end node */ } |
| @@ -450,11 +450,11 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, · 449 unmodified lines | ||
| 450 | 450 | res, |
| 451 | 451 | id_loc - sw_context->buf_start); |
| 452 | 452 | if (unlikely(ret != 0)) |
| 453 | − goto out_err; | |
| 453 | + return ret; | |
| 454 | 454 | |
| 455 | 455 | ret = vmw_resource_val_add(sw_context, res, &node); |
| 456 | 456 | if (unlikely(ret != 0)) |
| 457 | − goto out_err; | |
| 457 | + return ret; | |
| 458 | 458 | |
| 459 | 459 | if (res_type == vmw_res_context && dev_priv->has_mob && |
| 460 | 460 | node->first_usage) { |
| @@ -468,13 +468,13 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, · 7 unmodified lines | ||
| 468 | 468 | |
| 469 | 469 | ret = vmw_resource_context_res_add(dev_priv, sw_context, res); |
| 470 | 470 | if (unlikely(ret != 0)) |
| 471 | − goto out_err; | |
| 471 | + return ret; | |
| 472 | 472 | node->staged_bindings = |
| 473 | 473 | kzalloc(sizeof(*node->staged_bindings), GFP_KERNEL); |
| 474 | 474 | if (node->staged_bindings == NULL) { |
| 475 | 475 | DRM_ERROR("Failed to allocate context binding " |
| 476 | 476 | "information.\n"); |
| 477 | − goto out_err; | |
| 477 | + return -ENOMEM; | |
| 478 | 478 | } |
| 479 | 479 | INIT_LIST_HEAD(&node->staged_bindings->list); |
| 480 | 480 | } |
| @@ -482,8 +482,7 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, · 1 unmodified line | ||
| 482 | 482 | if (p_val) |
| 483 | 483 | *p_val = node; |
| 484 | 484 | |
| 485 | −out_err: | |
| 486 | − return ret; | |
| 485 | + return 0; | |
| 487 | 486 | } |
| 488 | 487 | |
| 489 | 488 | |
| @@ -180,8 +180,9 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) · 179 unmodified lines | ||
| 180 | 180 | |
| 181 | 181 | mutex_lock(&dev_priv->hw_mutex); |
| 182 | 182 | |
| 183 | + vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC); | |
| 183 | 184 | while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0) |
| 184 | − vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC); | |
| 185 | + ; | |
| 185 | 186 | |
| 186 | 187 | dev_priv->last_read_seqno = ioread32(fifo_mem + SVGA_FIFO_FENCE); |
| 187 | 188 | |
| @@ -656,7 +656,6 @@ static int logi_dj_raw_event(struct hid_device *hdev, · 655 unmodified lines | ||
| 656 | 656 | struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); |
| 657 | 657 | struct dj_report *dj_report = (struct dj_report *) data; |
| 658 | 658 | unsigned long flags; |
| 659 | − bool report_processed = false; | |
| 660 | 659 | |
| 661 | 660 | dbg_hid("%s, size:%d\n", __func__, size); |
| 662 | 661 | |
| @@ -683,34 +682,42 @@ static int logi_dj_raw_event(struct hid_device *hdev, · 20 unmodified lines | ||
| 683 | 682 | * device (via hid_input_report() ) and return 1 so hid-core does not do |
| 684 | 683 | * anything else with it. |
| 685 | 684 | */ |
| 685 | + | |
| 686 | + /* case 1) */ | |
| 687 | + if (data[0] != REPORT_ID_DJ_SHORT) | |
| 688 | + return false; | |
| 689 | + | |
| 686 | 690 | if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || |
| 687 | 691 | (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { |
| 688 | − dev_err(&hdev->dev, "%s: invalid device index:%d\n", | |
| 692 | + /* | |
| 693 | + * Device index is wrong, bail out. | |
| 694 | + * This driver can ignore safely the receiver notifications, | |
| 695 | + * so ignore those reports too. | |
| 696 | + */ | |
| 697 | + if (dj_report->device_index != DJ_RECEIVER_INDEX) | |
| 698 | + dev_err(&hdev->dev, "%s: invalid device index:%d\n", | |
| 689 | 699 | __func__, dj_report->device_index); |
| 690 | 700 | return false; |
| 691 | 701 | } |
| 692 | 702 | |
| 693 | 703 | spin_lock_irqsave(&djrcv_dev->lock, flags); |
| 694 | − if (dj_report->report_id == REPORT_ID_DJ_SHORT) { | |
| 695 | − switch (dj_report->report_type) { | |
| 696 | − case REPORT_TYPE_NOTIF_DEVICE_PAIRED: | |
| 697 | − case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: | |
| 698 | − logi_dj_recv_queue_notification(djrcv_dev, dj_report); | |
| 699 | − break; | |
| 700 | − case REPORT_TYPE_NOTIF_CONNECTION_STATUS: | |
| 701 | − if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == | |
| 702 | − STATUS_LINKLOSS) { | |
| 703 | − logi_dj_recv_forward_null_report(djrcv_dev, dj_report); | |
| 704 | − } | |
| 705 | − break; | |
| 706 | − default: | |
| 707 | − logi_dj_recv_forward_report(djrcv_dev, dj_report); | |
| 704 | + switch (dj_report->report_type) { | |
| 705 | + case REPORT_TYPE_NOTIF_DEVICE_PAIRED: | |
| 706 | + case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED: | |
| 707 | + logi_dj_recv_queue_notification(djrcv_dev, dj_report); | |
| 708 | + break; | |
| 709 | + case REPORT_TYPE_NOTIF_CONNECTION_STATUS: | |
| 710 | + if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] == | |
| 711 | + STATUS_LINKLOSS) { | |
| 712 | + logi_dj_recv_forward_null_report(djrcv_dev, dj_report); | |
| 708 | 713 | } |
| 709 | − report_processed = true; | |
| 714 | + break; | |
| 715 | + default: | |
| 716 | + logi_dj_recv_forward_report(djrcv_dev, dj_report); | |
| 710 | 717 | } |
| 711 | 718 | spin_unlock_irqrestore(&djrcv_dev->lock, flags); |
| 712 | 719 | |
| 713 | − return report_processed; | |
| 720 | + return true; | |
| 714 | 721 | } |
| 715 | 722 | |
| 716 | 723 | static int logi_dj_probe(struct hid_device *hdev, |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | #define DJ_MAX_PAIRED_DEVICES 6 |
| 29 | 29 | #define DJ_MAX_NUMBER_NOTIFICATIONS 8 |
| 30 | +#define DJ_RECEIVER_INDEX 0 | |
| 30 | 31 | #define DJ_DEVICE_INDEX_MIN 1 |
| 31 | 32 | #define DJ_DEVICE_INDEX_MAX 6 |
| 32 | 33 | |
| @@ -290,6 +290,11 @@ static int magicmouse_raw_event(struct hid_device *hdev, · 289 unmodified lines | ||
| 290 | 290 | if (size < 4 || ((size - 4) % 9) != 0) |
| 291 | 291 | return 0; |
| 292 | 292 | npoints = (size - 4) / 9; |
| 293 | + if (npoints > 15) { | |
| 294 | + hid_warn(hdev, "invalid size value (%d) for TRACKPAD_REPORT_ID\n", | |
| 295 | + size); | |
| 296 | + return 0; | |
| 297 | + } | |
| 293 | 298 | msc->ntouches = 0; |
| 294 | 299 | for (ii = 0; ii < npoints; ii++) |
| 295 | 300 | magicmouse_emit_touch(msc, ii, data + ii * 9 + 4); |
| @@ -307,6 +312,11 @@ static int magicmouse_raw_event(struct hid_device *hdev, · 11 unmodified lines | ||
| 307 | 312 | if (size < 6 || ((size - 6) % 8) != 0) |
| 308 | 313 | return 0; |
| 309 | 314 | npoints = (size - 6) / 8; |
| 315 | + if (npoints > 15) { | |
| 316 | + hid_warn(hdev, "invalid size value (%d) for MOUSE_REPORT_ID\n", | |
| 317 | + size); | |
| 318 | + return 0; | |
| 319 | + } | |
| 310 | 320 | msc->ntouches = 0; |
| 311 | 321 | for (ii = 0; ii < npoints; ii++) |
| 312 | 322 | magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); |
| @@ -350,6 +350,12 @@ static int picolcd_raw_event(struct hid_device *hdev, · 349 unmodified lines | ||
| 350 | 350 | if (!data) |
| 351 | 351 | return 1; |
| 352 | 352 | |
| 353 | + if (size > 64) { | |
| 354 | + hid_warn(hdev, "invalid size value (%d) for picolcd raw event\n", | |
| 355 | + size); | |
| 356 | + return 0; | |
| 357 | + } | |
| 358 | + | |
| 353 | 359 | if (report->id == REPORT_KEY_STATE) { |
| 354 | 360 | if (data->input_keys) |
| 355 | 361 | ret = picolcd_raw_keypad(data, report, raw_data+1, size-1); |
| @@ -309,6 +309,7 @@ static ssize_t set_convrate(struct device *dev, struct device_attribute *da, · 308 unmodified lines | ||
| 309 | 309 | data->conf |= (resol << DS1621_REG_CONFIG_RESOL_SHIFT); |
| 310 | 310 | i2c_smbus_write_byte_data(client, DS1621_REG_CONF, data->conf); |
| 311 | 311 | data->update_interval = ds1721_convrates[resol]; |
| 312 | + data->zbits = 7 - resol; | |
| 312 | 313 | mutex_unlock(&data->update_lock); |
| 313 | 314 | |
| 314 | 315 | return count; |
| @@ -101,6 +101,7 @@ struct at91_twi_dev { · 100 unmodified lines | ||
| 101 | 101 | unsigned twi_cwgr_reg; |
| 102 | 102 | struct at91_twi_pdata *pdata; |
| 103 | 103 | bool use_dma; |
| 104 | + bool recv_len_abort; | |
| 104 | 105 | struct at91_twi_dma dma; |
| 105 | 106 | }; |
| 106 | 107 | |
| @@ -267,12 +268,24 @@ static void at91_twi_read_next_byte(struct at91_twi_dev *dev) · 160 unmodified lines | ||
| 267 | 268 | *dev->buf = at91_twi_read(dev, AT91_TWI_RHR) & 0xff; |
| 268 | 269 | --dev->buf_len; |
| 269 | 270 | |
| 271 | + /* return if aborting, we only needed to read RHR to clear RXRDY*/ | |
| 272 | + if (dev->recv_len_abort) | |
| 273 | + return; | |
| 274 | + | |
| 270 | 275 | /* handle I2C_SMBUS_BLOCK_DATA */ |
| 271 | 276 | if (unlikely(dev->msg->flags & I2C_M_RECV_LEN)) { |
| 272 | − dev->msg->flags &= ~I2C_M_RECV_LEN; | |
| 273 | − dev->buf_len += *dev->buf; | |
| 274 | − dev->msg->len = dev->buf_len + 1; | |
| 275 | − dev_dbg(dev->dev, "received block length %d\n", dev->buf_len); | |
| 277 | + /* ensure length byte is a valid value */ | |
| 278 | + if (*dev->buf <= I2C_SMBUS_BLOCK_MAX && *dev->buf > 0) { | |
| 279 | + dev->msg->flags &= ~I2C_M_RECV_LEN; | |
| 280 | + dev->buf_len += *dev->buf; | |
| 281 | + dev->msg->len = dev->buf_len + 1; | |
| 282 | + dev_dbg(dev->dev, "received block length %d\n", | |
| 283 | + dev->buf_len); | |
| 284 | + } else { | |
| 285 | + /* abort and send the stop by reading one more byte */ | |
| 286 | + dev->recv_len_abort = true; | |
| 287 | + dev->buf_len = 1; | |
| 288 | + } | |
| 276 | 289 | } |
| 277 | 290 | |
| 278 | 291 | /* send stop if second but last byte has been read */ |
| @@ -421,8 +434,8 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) · 142 unmodified lines | ||
| 421 | 434 | } |
| 422 | 435 | } |
| 423 | 436 | |
| 424 | − ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, | |
| 425 | − dev->adapter.timeout); | |
| 437 | + ret = wait_for_completion_io_timeout(&dev->cmd_complete, | |
| 438 | + dev->adapter.timeout); | |
| 426 | 439 | if (ret == 0) { |
| 427 | 440 | dev_err(dev->dev, "controller timed out\n"); |
| 428 | 441 | at91_init_twi_bus(dev); |
| @@ -444,6 +457,12 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) · 15 unmodified lines | ||
| 444 | 457 | ret = -EIO; |
| 445 | 458 | goto error; |
| 446 | 459 | } |
| 460 | + if (dev->recv_len_abort) { | |
| 461 | + dev_err(dev->dev, "invalid smbus block length recvd\n"); | |
| 462 | + ret = -EPROTO; | |
| 463 | + goto error; | |
| 464 | + } | |
| 465 | + | |
| 447 | 466 | dev_dbg(dev->dev, "transfer complete\n"); |
| 448 | 467 | |
| 449 | 468 | return 0; |
| @@ -500,6 +519,7 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) · 50 unmodified lines | ||
| 500 | 519 | dev->buf_len = m_start->len; |
| 501 | 520 | dev->buf = m_start->buf; |
| 502 | 521 | dev->msg = m_start; |
| 522 | + dev->recv_len_abort = false; | |
| 503 | 523 | |
| 504 | 524 | ret = at91_do_twi_transfer(dev); |
| 505 | 525 | |
| @@ -746,8 +746,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, · 745 unmodified lines | ||
| 746 | 746 | } |
| 747 | 747 | tclk = clk_get_rate(drv_data->clk); |
| 748 | 748 | |
| 749 | − rc = of_property_read_u32(np, "clock-frequency", &bus_freq); | |
| 750 | − if (rc) | |
| 749 | + if (of_property_read_u32(np, "clock-frequency", &bus_freq)) | |
| 751 | 750 | bus_freq = 100000; /* 100kHz by default */ |
| 752 | 751 | |
| 753 | 752 | if (!mv64xxx_find_baud_factors(bus_freq, tclk, |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include <linux/platform_device.h> |
| 35 | 35 | #include <linux/pm_runtime.h> |
| 36 | 36 | #include <linux/slab.h> |
| 37 | +#include <linux/spinlock.h> | |
| 37 | 38 | |
| 38 | 39 | /* register offsets */ |
| 39 | 40 | #define ICSCR 0x00 /* slave ctrl */ |
| @@ -95,6 +96,7 @@ struct rcar_i2c_priv { · 55 unmodified lines | ||
| 95 | 96 | struct i2c_msg *msg; |
| 96 | 97 | struct clk *clk; |
| 97 | 98 | |
| 99 | + spinlock_t lock; | |
| 98 | 100 | wait_queue_head_t wait; |
| 99 | 101 | |
| 100 | 102 | int pos; |
| @@ -365,20 +367,20 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) · 264 unmodified lines | ||
| 365 | 367 | struct rcar_i2c_priv *priv = ptr; |
| 366 | 368 | u32 msr; |
| 367 | 369 | |
| 370 | + /*-------------- spin lock -----------------*/ | |
| 371 | + spin_lock(&priv->lock); | |
| 372 | + | |
| 368 | 373 | msr = rcar_i2c_read(priv, ICMSR); |
| 369 | 374 | |
| 375 | + /* Only handle interrupts that are currently enabled */ | |
| 376 | + msr &= rcar_i2c_read(priv, ICMIER); | |
| 377 | + | |
| 370 | 378 | /* Arbitration lost */ |
| 371 | 379 | if (msr & MAL) { |
| 372 | 380 | rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST)); |
| 373 | 381 | goto out; |
| 374 | 382 | } |
| 375 | 383 | |
| 376 | − /* Stop */ | |
| 377 | − if (msr & MST) { | |
| 378 | − rcar_i2c_flags_set(priv, ID_DONE); | |
| 379 | − goto out; | |
| 380 | − } | |
| 381 | − | |
| 382 | 384 | /* Nack */ |
| 383 | 385 | if (msr & MNR) { |
| 384 | 386 | /* go to stop phase */ |
| @@ -388,6 +390,12 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) · 3 unmodified lines | ||
| 388 | 390 | goto out; |
| 389 | 391 | } |
| 390 | 392 | |
| 393 | + /* Stop */ | |
| 394 | + if (msr & MST) { | |
| 395 | + rcar_i2c_flags_set(priv, ID_DONE); | |
| 396 | + goto out; | |
| 397 | + } | |
| 398 | + | |
| 391 | 399 | if (rcar_i2c_is_recv(priv)) |
| 392 | 400 | rcar_i2c_flags_set(priv, rcar_i2c_irq_recv(priv, msr)); |
| 393 | 401 | else |
| @@ -400,6 +408,9 @@ out: · 6 unmodified lines | ||
| 400 | 408 | wake_up(&priv->wait); |
| 401 | 409 | } |
| 402 | 410 | |
| 411 | + spin_unlock(&priv->lock); | |
| 412 | + /*-------------- spin unlock -----------------*/ | |
| 413 | + | |
| 403 | 414 | return IRQ_HANDLED; |
| 404 | 415 | } |
| 405 | 416 | |
| @@ -409,14 +420,21 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, · 3 unmodified lines | ||
| 409 | 420 | { |
| 410 | 421 | struct rcar_i2c_priv *priv = i2c_get_adapdata(adap); |
| 411 | 422 | struct device *dev = rcar_i2c_priv_to_dev(priv); |
| 423 | + unsigned long flags; | |
| 412 | 424 | int i, ret, timeout; |
| 413 | 425 | |
| 414 | 426 | pm_runtime_get_sync(dev); |
| 415 | 427 | |
| 428 | + /*-------------- spin lock -----------------*/ | |
| 429 | + spin_lock_irqsave(&priv->lock, flags); | |
| 430 | + | |
| 416 | 431 | rcar_i2c_init(priv); |
| 417 | 432 | /* start clock */ |
| 418 | 433 | rcar_i2c_write(priv, ICCCR, priv->icccr); |
| 419 | 434 | |
| 435 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 436 | + /*-------------- spin unlock -----------------*/ | |
| 437 | + | |
| 420 | 438 | ret = rcar_i2c_bus_barrier(priv); |
| 421 | 439 | if (ret < 0) |
| 422 | 440 | goto out; |
| @@ -428,6 +446,9 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, · 5 unmodified lines | ||
| 428 | 446 | break; |
| 429 | 447 | } |
| 430 | 448 | |
| 449 | + /*-------------- spin lock -----------------*/ | |
| 450 | + spin_lock_irqsave(&priv->lock, flags); | |
| 451 | + | |
| 431 | 452 | /* init each data */ |
| 432 | 453 | priv->msg = &msgs[i]; |
| 433 | 454 | priv->pos = 0; |
| @@ -437,6 +458,9 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, · 3 unmodified lines | ||
| 437 | 458 | |
| 438 | 459 | ret = rcar_i2c_prepare_msg(priv); |
| 439 | 460 | |
| 461 | + spin_unlock_irqrestore(&priv->lock, flags); | |
| 462 | + /*-------------- spin unlock -----------------*/ | |
| 463 | + | |
| 440 | 464 | if (ret < 0) |
| 441 | 465 | break; |
| 442 | 466 | |
| @@ -540,6 +564,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) · 97 unmodified lines | ||
| 540 | 564 | |
| 541 | 565 | irq = platform_get_irq(pdev, 0); |
| 542 | 566 | init_waitqueue_head(&priv->wait); |
| 567 | + spin_lock_init(&priv->lock); | |
| 543 | 568 | |
| 544 | 569 | adap = &priv->adap; |
| 545 | 570 | adap->nr = pdev->id; |
| @@ -323,6 +323,10 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) · 322 unmodified lines | ||
| 323 | 323 | /* ack interrupt */ |
| 324 | 324 | i2c_writel(i2c, REG_INT_MBRF, REG_IPD); |
| 325 | 325 | |
| 326 | + /* Can only handle a maximum of 32 bytes at a time */ | |
| 327 | + if (len > 32) | |
| 328 | + len = 32; | |
| 329 | + | |
| 326 | 330 | /* read the data from receive buffer */ |
| 327 | 331 | for (i = 0; i < len; ++i) { |
| 328 | 332 | if (i % 4 == 0) |
| @@ -1089,6 +1089,30 @@ static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id) · 1088 unmodified lines | ||
| 1089 | 1089 | return err; |
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | +static int mlx4_ib_tunnel_steer_add(struct ib_qp *qp, struct ib_flow_attr *flow_attr, | |
| 1093 | + u64 *reg_id) | |
| 1094 | +{ | |
| 1095 | + void *ib_flow; | |
| 1096 | + union ib_flow_spec *ib_spec; | |
| 1097 | + struct mlx4_dev *dev = to_mdev(qp->device)->dev; | |
| 1098 | + int err = 0; | |
| 1099 | + | |
| 1100 | + if (dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | |
| 1101 | + return 0; /* do nothing */ | |
| 1102 | + | |
| 1103 | + ib_flow = flow_attr + 1; | |
| 1104 | + ib_spec = (union ib_flow_spec *)ib_flow; | |
| 1105 | + | |
| 1106 | + if (ib_spec->type != IB_FLOW_SPEC_ETH || flow_attr->num_of_specs != 1) | |
| 1107 | + return 0; /* do nothing */ | |
| 1108 | + | |
| 1109 | + err = mlx4_tunnel_steer_add(to_mdev(qp->device)->dev, ib_spec->eth.val.dst_mac, | |
| 1110 | + flow_attr->port, qp->qp_num, | |
| 1111 | + MLX4_DOMAIN_UVERBS | (flow_attr->priority & 0xff), | |
| 1112 | + reg_id); | |
| 1113 | + return err; | |
| 1114 | +} | |
| 1115 | + | |
| 1092 | 1116 | static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, |
| 1093 | 1117 | struct ib_flow_attr *flow_attr, |
| 1094 | 1118 | int domain) |
| @@ -1136,6 +1160,12 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 41 unmodified lines | ||
| 1136 | 1160 | i++; |
| 1137 | 1161 | } |
| 1138 | 1162 | |
| 1163 | + if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { | |
| 1164 | + err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]); | |
| 1165 | + if (err) | |
| 1166 | + goto err_free; | |
| 1167 | + } | |
| 1168 | + | |
| 1139 | 1169 | return &mflow->ibflow; |
| 1140 | 1170 | |
| 1141 | 1171 | err_free: |
| @@ -1677,9 +1677,15 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, · 1676 unmodified lines | ||
| 1677 | 1677 | } |
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | − if (qp->ibqp.qp_type == IB_QPT_RAW_PACKET) | |
| 1680 | + if (qp->ibqp.qp_type == IB_QPT_RAW_PACKET) { | |
| 1681 | 1681 | context->pri_path.ackto = (context->pri_path.ackto & 0xf8) | |
| 1682 | 1682 | MLX4_IB_LINK_TYPE_ETH; |
| 1683 | + if (dev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { | |
| 1684 | + /* set QP to receive both tunneled & non-tunneled packets */ | |
| 1685 | + if (!(context->flags & (1 << MLX4_RSS_QPC_FLAG_OFFSET))) | |
| 1686 | + context->srqn = cpu_to_be32(7 << 28); | |
| 1687 | + } | |
| 1688 | + } | |
| 1683 | 1689 | |
| 1684 | 1690 | if (ibqp->qp_type == IB_QPT_UD && (new_state == IB_QPS_RTR)) { |
| 1685 | 1691 | int is_eth = rdma_port_get_link_layer( |
| @@ -236,6 +236,18 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) · 235 unmodified lines | ||
| 236 | 236 | } |
| 237 | 237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); |
| 238 | 238 | |
| 239 | +static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt) | |
| 240 | +{ | |
| 241 | + int i; | |
| 242 | + | |
| 243 | + for (i = 0; i < mt->num_slots; i++) { | |
| 244 | + if (!input_mt_is_used(mt, &mt->slots[i])) { | |
| 245 | + input_mt_slot(dev, i); | |
| 246 | + input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | |
| 247 | + } | |
| 248 | + } | |
| 249 | +} | |
| 250 | + | |
| 239 | 251 | /** |
| 240 | 252 | * input_mt_drop_unused() - Inactivate slots not seen in this frame |
| 241 | 253 | * @dev: input device with allocated MT slots |
| @@ -245,19 +257,11 @@ EXPORT_SYMBOL(input_mt_report_pointer_emulation); · 3 unmodified lines | ||
| 245 | 257 | void input_mt_drop_unused(struct input_dev *dev) |
| 246 | 258 | { |
| 247 | 259 | struct input_mt *mt = dev->mt; |
| 248 | − int i; | |
| 249 | 260 | |
| 250 | − if (!mt) | |
| 251 | − return; | |
| 252 | − | |
| 253 | − for (i = 0; i < mt->num_slots; i++) { | |
| 254 | − if (!input_mt_is_used(mt, &mt->slots[i])) { | |
| 255 | − input_mt_slot(dev, i); | |
| 256 | − input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | |
| 257 | − } | |
| 261 | + if (mt) { | |
| 262 | + __input_mt_drop_unused(dev, mt); | |
| 263 | + mt->frame++; | |
| 258 | 264 | } |
| 259 | − | |
| 260 | − mt->frame++; | |
| 261 | 265 | } |
| 262 | 266 | EXPORT_SYMBOL(input_mt_drop_unused); |
| 263 | 267 | |
| @@ -278,12 +282,14 @@ void input_mt_sync_frame(struct input_dev *dev) · 14 unmodified lines | ||
| 278 | 282 | return; |
| 279 | 283 | |
| 280 | 284 | if (mt->flags & INPUT_MT_DROP_UNUSED) |
| 281 | − input_mt_drop_unused(dev); | |
| 285 | + __input_mt_drop_unused(dev, mt); | |
| 282 | 286 | |
| 283 | 287 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) |
| 284 | 288 | use_count = true; |
| 285 | 289 | |
| 286 | 290 | input_mt_report_pointer_emulation(dev, use_count); |
| 291 | + | |
| 292 | + mt->frame++; | |
| 287 | 293 | } |
| 288 | 294 | EXPORT_SYMBOL(input_mt_sync_frame); |
| 289 | 295 | |
| @@ -2234,8 +2234,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) · 2233 unmodified lines | ||
| 2234 | 2234 | return 0; |
| 2235 | 2235 | } |
| 2236 | 2236 | |
| 2237 | − psmouse_info(psmouse, | |
| 2238 | − "Unknown ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); | |
| 2237 | + psmouse_dbg(psmouse, | |
| 2238 | + "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); | |
| 2239 | 2239 | |
| 2240 | 2240 | return -EINVAL; |
| 2241 | 2241 | } |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/input/mt.h> |
| 19 | 19 | #include <linux/serio.h> |
| 20 | 20 | #include <linux/libps2.h> |
| 21 | +#include <asm/unaligned.h> | |
| 21 | 22 | #include "psmouse.h" |
| 22 | 23 | #include "elantech.h" |
| 23 | 24 | |
| @@ -403,6 +404,68 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) · 379 unmodified lines | ||
| 403 | 404 | input_sync(dev); |
| 404 | 405 | } |
| 405 | 406 | |
| 407 | +static void elantech_report_trackpoint(struct psmouse *psmouse, | |
| 408 | + int packet_type) | |
| 409 | +{ | |
| 410 | + /* | |
| 411 | + * byte 0: 0 0 sx sy 0 M R L | |
| 412 | + * byte 1:~sx 0 0 0 0 0 0 0 | |
| 413 | + * byte 2:~sy 0 0 0 0 0 0 0 | |
| 414 | + * byte 3: 0 0 ~sy ~sx 0 1 1 0 | |
| 415 | + * byte 4: x7 x6 x5 x4 x3 x2 x1 x0 | |
| 416 | + * byte 5: y7 y6 y5 y4 y3 y2 y1 y0 | |
| 417 | + * | |
| 418 | + * x and y are written in two's complement spread | |
| 419 | + * over 9 bits with sx/sy the relative top bit and | |
| 420 | + * x7..x0 and y7..y0 the lower bits. | |
| 421 | + * The sign of y is opposite to what the input driver | |
| 422 | + * expects for a relative movement | |
| 423 | + */ | |
| 424 | + | |
| 425 | + struct elantech_data *etd = psmouse->private; | |
| 426 | + struct input_dev *tp_dev = etd->tp_dev; | |
| 427 | + unsigned char *packet = psmouse->packet; | |
| 428 | + int x, y; | |
| 429 | + u32 t; | |
| 430 | + | |
| 431 | + if (dev_WARN_ONCE(&psmouse->ps2dev.serio->dev, | |
| 432 | + !tp_dev, | |
| 433 | + psmouse_fmt("Unexpected trackpoint message\n"))) { | |
| 434 | + if (etd->debug == 1) | |
| 435 | + elantech_packet_dump(psmouse); | |
| 436 | + return; | |
| 437 | + } | |
| 438 | + | |
| 439 | + t = get_unaligned_le32(&packet[0]); | |
| 440 | + | |
| 441 | + switch (t & ~7U) { | |
| 442 | + case 0x06000030U: | |
| 443 | + case 0x16008020U: | |
| 444 | + case 0x26800010U: | |
| 445 | + case 0x36808000U: | |
| 446 | + x = packet[4] - (int)((packet[1]^0x80) << 1); | |
| 447 | + y = (int)((packet[2]^0x80) << 1) - packet[5]; | |
| 448 | + | |
| 449 | + input_report_key(tp_dev, BTN_LEFT, packet[0] & 0x01); | |
| 450 | + input_report_key(tp_dev, BTN_RIGHT, packet[0] & 0x02); | |
| 451 | + input_report_key(tp_dev, BTN_MIDDLE, packet[0] & 0x04); | |
| 452 | + | |
| 453 | + input_report_rel(tp_dev, REL_X, x); | |
| 454 | + input_report_rel(tp_dev, REL_Y, y); | |
| 455 | + | |
| 456 | + input_sync(tp_dev); | |
| 457 | + | |
| 458 | + break; | |
| 459 | + | |
| 460 | + default: | |
| 461 | + /* Dump unexpected packet sequences if debug=1 (default) */ | |
| 462 | + if (etd->debug == 1) | |
| 463 | + elantech_packet_dump(psmouse); | |
| 464 | + | |
| 465 | + break; | |
| 466 | + } | |
| 467 | +} | |
| 468 | + | |
| 406 | 469 | /* |
| 407 | 470 | * Interpret complete data packets and report absolute mode input events for |
| 408 | 471 | * hardware version 3. (12 byte packets for two fingers) |
| @@ -715,6 +778,8 @@ static int elantech_packet_check_v3(struct psmouse *psmouse) · 306 unmodified lines | ||
| 715 | 778 | |
| 716 | 779 | if ((packet[0] & 0x0c) == 0x0c && (packet[3] & 0xce) == 0x0c) |
| 717 | 780 | return PACKET_V3_TAIL; |
| 781 | + if ((packet[3] & 0x0f) == 0x06) | |
| 782 | + return PACKET_TRACKPOINT; | |
| 718 | 783 | } |
| 719 | 784 | |
| 720 | 785 | return PACKET_UNKNOWN; |
| @@ -791,14 +856,23 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse) · 70 unmodified lines | ||
| 791 | 856 | |
| 792 | 857 | case 3: |
| 793 | 858 | packet_type = elantech_packet_check_v3(psmouse); |
| 794 | − /* ignore debounce */ | |
| 795 | − if (packet_type == PACKET_DEBOUNCE) | |
| 796 | − return PSMOUSE_FULL_PACKET; | |
| 797 | − | |
| 798 | − if (packet_type == PACKET_UNKNOWN) | |
| 859 | + switch (packet_type) { | |
| 860 | + case PACKET_UNKNOWN: | |
| 799 | 861 | return PSMOUSE_BAD_DATA; |
| 800 | 862 | |
| 801 | − elantech_report_absolute_v3(psmouse, packet_type); | |
| 863 | + case PACKET_DEBOUNCE: | |
| 864 | + /* ignore debounce */ | |
| 865 | + break; | |
| 866 | + | |
| 867 | + case PACKET_TRACKPOINT: | |
| 868 | + elantech_report_trackpoint(psmouse, packet_type); | |
| 869 | + break; | |
| 870 | + | |
| 871 | + default: | |
| 872 | + elantech_report_absolute_v3(psmouse, packet_type); | |
| 873 | + break; | |
| 874 | + } | |
| 875 | + | |
| 802 | 876 | break; |
| 803 | 877 | |
| 804 | 878 | case 4: |
| @@ -1018,8 +1092,10 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, · 213 unmodified lines | ||
| 1018 | 1092 | * Asus UX31 0x361f00 20, 15, 0e clickpad |
| 1019 | 1093 | * Asus UX32VD 0x361f02 00, 15, 0e clickpad |
| 1020 | 1094 | * Avatar AVIU-145A2 0x361f00 ? clickpad |
| 1095 | + * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**) | |
| 1021 | 1096 | * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons |
| 1022 | 1097 | * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) |
| 1098 | + * Lenovo L530 0x350f02 b9, 15, 0c 2 hw buttons (*) | |
| 1023 | 1099 | * Samsung NF210 0x150b00 78, 14, 0a 2 hw buttons |
| 1024 | 1100 | * Samsung NP770Z5E 0x575f01 10, 15, 0f clickpad |
| 1025 | 1101 | * Samsung NP700Z5B 0x361f06 21, 15, 0f clickpad |
| @@ -1029,6 +1105,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, · 3 unmodified lines | ||
| 1029 | 1105 | * Samsung RF710 0x450f00 ? 2 hw buttons |
| 1030 | 1106 | * System76 Pangolin 0x250f01 ? 2 hw buttons |
| 1031 | 1107 | * (*) + 3 trackpoint buttons |
| 1108 | + * (**) + 0 trackpoint buttons | |
| 1109 | + * Note: Lenovo L430 and Lenovo L430 have the same fw_version/caps | |
| 1032 | 1110 | */ |
| 1033 | 1111 | static void elantech_set_buttonpad_prop(struct psmouse *psmouse) |
| 1034 | 1112 | { |
| @@ -1324,6 +1402,10 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties) · 289 unmodified lines | ||
| 1324 | 1402 | */ |
| 1325 | 1403 | static void elantech_disconnect(struct psmouse *psmouse) |
| 1326 | 1404 | { |
| 1405 | + struct elantech_data *etd = psmouse->private; | |
| 1406 | + | |
| 1407 | + if (etd->tp_dev) | |
| 1408 | + input_unregister_device(etd->tp_dev); | |
| 1327 | 1409 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, |
| 1328 | 1410 | &elantech_attr_group); |
| 1329 | 1411 | kfree(psmouse->private); |
| @@ -1438,8 +1520,10 @@ static int elantech_set_properties(struct elantech_data *etd) · 108 unmodified lines | ||
| 1438 | 1520 | int elantech_init(struct psmouse *psmouse) |
| 1439 | 1521 | { |
| 1440 | 1522 | struct elantech_data *etd; |
| 1441 | − int i, error; | |
| 1523 | + int i; | |
| 1524 | + int error = -EINVAL; | |
| 1442 | 1525 | unsigned char param[3]; |
| 1526 | + struct input_dev *tp_dev; | |
| 1443 | 1527 | |
| 1444 | 1528 | psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); |
| 1445 | 1529 | if (!etd) |
| @@ -1498,14 +1582,49 @@ int elantech_init(struct psmouse *psmouse) · 52 unmodified lines | ||
| 1498 | 1582 | goto init_fail; |
| 1499 | 1583 | } |
| 1500 | 1584 | |
| 1585 | + /* The MSB indicates the presence of the trackpoint */ | |
| 1586 | + if ((etd->capabilities[0] & 0x80) == 0x80) { | |
| 1587 | + tp_dev = input_allocate_device(); | |
| 1588 | + | |
| 1589 | + if (!tp_dev) { | |
| 1590 | + error = -ENOMEM; | |
| 1591 | + goto init_fail_tp_alloc; | |
| 1592 | + } | |
| 1593 | + | |
| 1594 | + etd->tp_dev = tp_dev; | |
| 1595 | + snprintf(etd->tp_phys, sizeof(etd->tp_phys), "%s/input1", | |
| 1596 | + psmouse->ps2dev.serio->phys); | |
| 1597 | + tp_dev->phys = etd->tp_phys; | |
| 1598 | + tp_dev->name = "Elantech PS/2 TrackPoint"; | |
| 1599 | + tp_dev->id.bustype = BUS_I8042; | |
| 1600 | + tp_dev->id.vendor = 0x0002; | |
| 1601 | + tp_dev->id.product = PSMOUSE_ELANTECH; | |
| 1602 | + tp_dev->id.version = 0x0000; | |
| 1603 | + tp_dev->dev.parent = &psmouse->ps2dev.serio->dev; | |
| 1604 | + tp_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | |
| 1605 | + tp_dev->relbit[BIT_WORD(REL_X)] = | |
| 1606 | + BIT_MASK(REL_X) | BIT_MASK(REL_Y); | |
| 1607 | + tp_dev->keybit[BIT_WORD(BTN_LEFT)] = | |
| 1608 | + BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | | |
| 1609 | + BIT_MASK(BTN_RIGHT); | |
| 1610 | + error = input_register_device(etd->tp_dev); | |
| 1611 | + if (error < 0) | |
| 1612 | + goto init_fail_tp_reg; | |
| 1613 | + } | |
| 1614 | + | |
| 1501 | 1615 | psmouse->protocol_handler = elantech_process_byte; |
| 1502 | 1616 | psmouse->disconnect = elantech_disconnect; |
| 1503 | 1617 | psmouse->reconnect = elantech_reconnect; |
| 1504 | 1618 | psmouse->pktsize = etd->hw_version > 1 ? 6 : 4; |
| 1505 | 1619 | |
| 1506 | 1620 | return 0; |
| 1507 | − | |
| 1621 | + init_fail_tp_reg: | |
| 1622 | + input_free_device(tp_dev); | |
| 1623 | + init_fail_tp_alloc: | |
| 1624 | + sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, | |
| 1625 | + &elantech_attr_group); | |
| 1508 | 1626 | init_fail: |
| 1627 | + psmouse_reset(psmouse); | |
| 1509 | 1628 | kfree(etd); |
| 1510 | − return -1; | |
| 1629 | + return error; | |
| 1511 | 1630 | } |
| @@ -94,6 +94,7 @@ · 93 unmodified lines | ||
| 94 | 94 | #define PACKET_V4_HEAD 0x05 |
| 95 | 95 | #define PACKET_V4_MOTION 0x06 |
| 96 | 96 | #define PACKET_V4_STATUS 0x07 |
| 97 | +#define PACKET_TRACKPOINT 0x08 | |
| 97 | 98 | |
| 98 | 99 | /* |
| 99 | 100 | * track up to 5 fingers for v4 hardware |
| @@ -114,6 +115,8 @@ struct finger_pos { · 14 unmodified lines | ||
| 114 | 115 | }; |
| 115 | 116 | |
| 116 | 117 | struct elantech_data { |
| 118 | + struct input_dev *tp_dev; /* Relative device for trackpoint */ | |
| 119 | + char tp_phys[32]; | |
| 117 | 120 | unsigned char reg_07; |
| 118 | 121 | unsigned char reg_10; |
| 119 | 122 | unsigned char reg_11; |
| @@ -17,7 +17,6 @@ static int i8042_aux_irq = -1; · 16 unmodified lines | ||
| 17 | 17 | #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" |
| 18 | 18 | |
| 19 | 19 | static void __iomem *kbd_iobase; |
| 20 | −static struct resource *kbd_res; | |
| 21 | 20 | |
| 22 | 21 | #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) |
| 23 | 22 | #define I8042_DATA_REG (kbd_iobase + 0x60UL) |
| @@ -44,6 +43,8 @@ static inline void i8042_write_command(int val) · 20 unmodified lines | ||
| 44 | 43 | |
| 45 | 44 | #ifdef CONFIG_PCI |
| 46 | 45 | |
| 46 | +static struct resource *kbd_res; | |
| 47 | + | |
| 47 | 48 | #define OBP_PS2KBD_NAME1 "kb_ps2" |
| 48 | 49 | #define OBP_PS2KBD_NAME2 "keyboard" |
| 49 | 50 | #define OBP_PS2MS_NAME1 "kdmouse" |
| @@ -15,10 +15,10 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/list.h> |
| 16 | 16 | #include <linux/spinlock.h> |
| 17 | 17 | #include <linux/device.h> |
| 18 | +#include <linux/timer.h> | |
| 18 | 19 | #include <linux/err.h> |
| 19 | 20 | #include <linux/ctype.h> |
| 20 | 21 | #include <linux/leds.h> |
| 21 | −#include <linux/workqueue.h> | |
| 22 | 22 | #include "leds.h" |
| 23 | 23 | |
| 24 | 24 | static struct class *leds_class; |
| @@ -97,10 +97,9 @@ static const struct attribute_group *led_groups[] = { · 72 unmodified lines | ||
| 97 | 97 | NULL, |
| 98 | 98 | }; |
| 99 | 99 | |
| 100 | −static void led_work_function(struct work_struct *ws) | |
| 100 | +static void led_timer_function(unsigned long data) | |
| 101 | 101 | { |
| 102 | − struct led_classdev *led_cdev = | |
| 103 | − container_of(ws, struct led_classdev, blink_work.work); | |
| 102 | + struct led_classdev *led_cdev = (void *)data; | |
| 104 | 103 | unsigned long brightness; |
| 105 | 104 | unsigned long delay; |
| 106 | 105 | |
| @@ -144,8 +143,7 @@ static void led_work_function(struct work_struct *ws) · 37 unmodified lines | ||
| 144 | 143 | } |
| 145 | 144 | } |
| 146 | 145 | |
| 147 | − queue_delayed_work(system_wq, &led_cdev->blink_work, | |
| 148 | − msecs_to_jiffies(delay)); | |
| 146 | + mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay)); | |
| 149 | 147 | } |
| 150 | 148 | |
| 151 | 149 | static void set_brightness_delayed(struct work_struct *ws) |
| @@ -233,7 +231,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) · 81 unmodified lines | ||
| 233 | 231 | |
| 234 | 232 | INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed); |
| 235 | 233 | |
| 236 | − INIT_DELAYED_WORK(&led_cdev->blink_work, led_work_function); | |
| 234 | + init_timer(&led_cdev->blink_timer); | |
| 235 | + led_cdev->blink_timer.function = led_timer_function; | |
| 236 | + led_cdev->blink_timer.data = (unsigned long)led_cdev; | |
| 237 | 237 | |
| 238 | 238 | #ifdef CONFIG_LEDS_TRIGGERS |
| 239 | 239 | led_trigger_set_default(led_cdev); |
| @@ -16,7 +16,6 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/module.h> |
| 17 | 17 | #include <linux/rwsem.h> |
| 18 | 18 | #include <linux/leds.h> |
| 19 | −#include <linux/workqueue.h> | |
| 20 | 19 | #include "leds.h" |
| 21 | 20 | |
| 22 | 21 | DECLARE_RWSEM(leds_list_lock); |
| @@ -52,7 +51,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev, · 29 unmodified lines | ||
| 52 | 51 | return; |
| 53 | 52 | } |
| 54 | 53 | |
| 55 | − queue_delayed_work(system_wq, &led_cdev->blink_work, 1); | |
| 54 | + mod_timer(&led_cdev->blink_timer, jiffies + 1); | |
| 56 | 55 | } |
| 57 | 56 | |
| 58 | 57 | |
| @@ -76,7 +75,7 @@ void led_blink_set(struct led_classdev *led_cdev, · 17 unmodified lines | ||
| 76 | 75 | unsigned long *delay_on, |
| 77 | 76 | unsigned long *delay_off) |
| 78 | 77 | { |
| 79 | − cancel_delayed_work_sync(&led_cdev->blink_work); | |
| 78 | + del_timer_sync(&led_cdev->blink_timer); | |
| 80 | 79 | |
| 81 | 80 | led_cdev->flags &= ~LED_BLINK_ONESHOT; |
| 82 | 81 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; |
| @@ -91,7 +90,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev, · 8 unmodified lines | ||
| 91 | 90 | int invert) |
| 92 | 91 | { |
| 93 | 92 | if ((led_cdev->flags & LED_BLINK_ONESHOT) && |
| 94 | − delayed_work_pending(&led_cdev->blink_work)) | |
| 93 | + timer_pending(&led_cdev->blink_timer)) | |
| 95 | 94 | return; |
| 96 | 95 | |
| 97 | 96 | led_cdev->flags |= LED_BLINK_ONESHOT; |
| @@ -108,7 +107,7 @@ EXPORT_SYMBOL(led_blink_set_oneshot); · 10 unmodified lines | ||
| 108 | 107 | |
| 109 | 108 | void led_stop_software_blink(struct led_classdev *led_cdev) |
| 110 | 109 | { |
| 111 | − cancel_delayed_work_sync(&led_cdev->blink_work); | |
| 110 | + del_timer_sync(&led_cdev->blink_timer); | |
| 112 | 111 | led_cdev->blink_delay_on = 0; |
| 113 | 112 | led_cdev->blink_delay_off = 0; |
| 114 | 113 | } |
| @@ -117,7 +116,7 @@ EXPORT_SYMBOL_GPL(led_stop_software_blink); · 2 unmodified lines | ||
| 117 | 116 | void led_set_brightness(struct led_classdev *led_cdev, |
| 118 | 117 | enum led_brightness brightness) |
| 119 | 118 | { |
| 120 | − /* delay brightness setting if need to stop soft-blink work */ | |
| 119 | + /* delay brightness setting if need to stop soft-blink timer */ | |
| 121 | 120 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { |
| 122 | 121 | led_cdev->delayed_set_value = brightness; |
| 123 | 122 | schedule_work(&led_cdev->set_brightness_work); |
| @@ -1688,6 +1688,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 1687 unmodified lines | ||
| 1688 | 1688 | unsigned int key_size, opt_params; |
| 1689 | 1689 | unsigned long long tmpll; |
| 1690 | 1690 | int ret; |
| 1691 | + size_t iv_size_padding; | |
| 1691 | 1692 | struct dm_arg_set as; |
| 1692 | 1693 | const char *opt_string; |
| 1693 | 1694 | char dummy; |
| @@ -1724,20 +1725,32 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 30 unmodified lines | ||
| 1724 | 1725 | |
| 1725 | 1726 | cc->dmreq_start = sizeof(struct ablkcipher_request); |
| 1726 | 1727 | cc->dmreq_start += crypto_ablkcipher_reqsize(any_tfm(cc)); |
| 1727 | − cc->dmreq_start = ALIGN(cc->dmreq_start, crypto_tfm_ctx_alignment()); | |
| 1728 | − cc->dmreq_start += crypto_ablkcipher_alignmask(any_tfm(cc)) & | |
| 1729 | − ~(crypto_tfm_ctx_alignment() - 1); | |
| 1728 | + cc->dmreq_start = ALIGN(cc->dmreq_start, __alignof__(struct dm_crypt_request)); | |
| 1729 | + | |
| 1730 | + if (crypto_ablkcipher_alignmask(any_tfm(cc)) < CRYPTO_MINALIGN) { | |
| 1731 | + /* Allocate the padding exactly */ | |
| 1732 | + iv_size_padding = -(cc->dmreq_start + sizeof(struct dm_crypt_request)) | |
| 1733 | + & crypto_ablkcipher_alignmask(any_tfm(cc)); | |
| 1734 | + } else { | |
| 1735 | + /* | |
| 1736 | + * If the cipher requires greater alignment than kmalloc | |
| 1737 | + * alignment, we don't know the exact position of the | |
| 1738 | + * initialization vector. We must assume worst case. | |
| 1739 | + */ | |
| 1740 | + iv_size_padding = crypto_ablkcipher_alignmask(any_tfm(cc)); | |
| 1741 | + } | |
| 1730 | 1742 | |
| 1731 | 1743 | cc->req_pool = mempool_create_kmalloc_pool(MIN_IOS, cc->dmreq_start + |
| 1732 | − sizeof(struct dm_crypt_request) + cc->iv_size); | |
| 1744 | + sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size); | |
| 1733 | 1745 | if (!cc->req_pool) { |
| 1734 | 1746 | ti->error = "Cannot allocate crypt request mempool"; |
| 1735 | 1747 | goto bad; |
| 1736 | 1748 | } |
| 1737 | 1749 | |
| 1738 | 1750 | cc->per_bio_data_size = ti->per_bio_data_size = |
| 1739 | − sizeof(struct dm_crypt_io) + cc->dmreq_start + | |
| 1740 | − sizeof(struct dm_crypt_request) + cc->iv_size; | |
| 1751 | + ALIGN(sizeof(struct dm_crypt_io) + cc->dmreq_start + | |
| 1752 | + sizeof(struct dm_crypt_request) + iv_size_padding + cc->iv_size, | |
| 1753 | + ARCH_KMALLOC_MINALIGN); | |
| 1741 | 1754 | |
| 1742 | 1755 | cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); |
| 1743 | 1756 | if (!cc->page_pool) { |
| @@ -1754,7 +1754,7 @@ static int ab8500_probe(struct platform_device *pdev) · 1753 unmodified lines | ||
| 1754 | 1754 | if (ret) |
| 1755 | 1755 | return ret; |
| 1756 | 1756 | |
| 1757 | −#if CONFIG_DEBUG_FS | |
| 1757 | +#ifdef CONFIG_DEBUG_FS | |
| 1758 | 1758 | /* Pass to debugfs */ |
| 1759 | 1759 | ab8500_debug_resources[0].start = ab8500->irq; |
| 1760 | 1760 | ab8500_debug_resources[0].end = ab8500->irq; |
| @@ -404,7 +404,7 @@ static int htcpld_register_chip_i2c( · 403 unmodified lines | ||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | i2c_set_clientdata(client, chip); |
| 407 | − snprintf(client->name, I2C_NAME_SIZE, "Chip_0x%d", client->addr); | |
| 407 | + snprintf(client->name, I2C_NAME_SIZE, "Chip_0x%x", client->addr); | |
| 408 | 408 | chip->client = client; |
| 409 | 409 | |
| 410 | 410 | /* Reset the chip */ |
| @@ -647,7 +647,7 @@ static int usbhs_omap_probe(struct platform_device *pdev) · 646 unmodified lines | ||
| 647 | 647 | default: |
| 648 | 648 | omap->nports = OMAP3_HS_USB_PORTS; |
| 649 | 649 | dev_dbg(dev, |
| 650 | − "USB HOST Rev:0x%d not recognized, assuming %d ports\n", | |
| 650 | + "USB HOST Rev:0x%x not recognized, assuming %d ports\n", | |
| 651 | 651 | omap->usbhs_rev, omap->nports); |
| 652 | 652 | break; |
| 653 | 653 | } |
| @@ -724,24 +724,24 @@ static struct twl4030_script *omap3_idle_scripts[] = { · 723 unmodified lines | ||
| 724 | 724 | * above. |
| 725 | 725 | */ |
| 726 | 726 | static struct twl4030_resconfig omap3_idle_rconfig[] = { |
| 727 | − TWL_REMAP_SLEEP(RES_VAUX1, DEV_GRP_NULL, 0, 0), | |
| 728 | − TWL_REMAP_SLEEP(RES_VAUX2, DEV_GRP_NULL, 0, 0), | |
| 729 | − TWL_REMAP_SLEEP(RES_VAUX3, DEV_GRP_NULL, 0, 0), | |
| 730 | − TWL_REMAP_SLEEP(RES_VAUX4, DEV_GRP_NULL, 0, 0), | |
| 731 | − TWL_REMAP_SLEEP(RES_VMMC1, DEV_GRP_NULL, 0, 0), | |
| 732 | − TWL_REMAP_SLEEP(RES_VMMC2, DEV_GRP_NULL, 0, 0), | |
| 727 | + TWL_REMAP_SLEEP(RES_VAUX1, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 728 | + TWL_REMAP_SLEEP(RES_VAUX2, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 729 | + TWL_REMAP_SLEEP(RES_VAUX3, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 730 | + TWL_REMAP_SLEEP(RES_VAUX4, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 731 | + TWL_REMAP_SLEEP(RES_VMMC1, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 732 | + TWL_REMAP_SLEEP(RES_VMMC2, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 733 | 733 | TWL_REMAP_OFF(RES_VPLL1, DEV_GRP_P1, 3, 1), |
| 734 | 734 | TWL_REMAP_SLEEP(RES_VPLL2, DEV_GRP_P1, 0, 0), |
| 735 | − TWL_REMAP_SLEEP(RES_VSIM, DEV_GRP_NULL, 0, 0), | |
| 736 | − TWL_REMAP_SLEEP(RES_VDAC, DEV_GRP_NULL, 0, 0), | |
| 735 | + TWL_REMAP_SLEEP(RES_VSIM, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 736 | + TWL_REMAP_SLEEP(RES_VDAC, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 737 | 737 | TWL_REMAP_SLEEP(RES_VINTANA1, TWL_DEV_GRP_P123, 1, 2), |
| 738 | 738 | TWL_REMAP_SLEEP(RES_VINTANA2, TWL_DEV_GRP_P123, 0, 2), |
| 739 | 739 | TWL_REMAP_SLEEP(RES_VINTDIG, TWL_DEV_GRP_P123, 1, 2), |
| 740 | 740 | TWL_REMAP_SLEEP(RES_VIO, TWL_DEV_GRP_P123, 2, 2), |
| 741 | 741 | TWL_REMAP_OFF(RES_VDD1, DEV_GRP_P1, 4, 1), |
| 742 | 742 | TWL_REMAP_OFF(RES_VDD2, DEV_GRP_P1, 3, 1), |
| 743 | − TWL_REMAP_SLEEP(RES_VUSB_1V5, DEV_GRP_NULL, 0, 0), | |
| 744 | − TWL_REMAP_SLEEP(RES_VUSB_1V8, DEV_GRP_NULL, 0, 0), | |
| 743 | + TWL_REMAP_SLEEP(RES_VUSB_1V5, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 744 | + TWL_REMAP_SLEEP(RES_VUSB_1V8, TWL4030_RESCONFIG_UNDEF, 0, 0), | |
| 745 | 745 | TWL_REMAP_SLEEP(RES_VUSB_3V1, TWL_DEV_GRP_P123, 0, 0), |
| 746 | 746 | /* Resource #20 USB charge pump skipped */ |
| 747 | 747 | TWL_REMAP_SLEEP(RES_REGEN, TWL_DEV_GRP_P123, 2, 1), |
| @@ -601,6 +601,7 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file) · 600 unmodified lines | ||
| 601 | 601 | cl->timer_count = MEI_CONNECT_TIMEOUT; |
| 602 | 602 | list_add_tail(&cb->list, &dev->ctrl_rd_list.list); |
| 603 | 603 | } else { |
| 604 | + cl->state = MEI_FILE_INITIALIZING; | |
| 604 | 605 | list_add_tail(&cb->list, &dev->ctrl_wr_list.list); |
| 605 | 606 | } |
| 606 | 607 | |
| @@ -342,9 +342,10 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) · 341 unmodified lines | ||
| 342 | 342 | ndev = (struct mei_nfc_dev *) cldev->priv_data; |
| 343 | 343 | dev = ndev->cl->dev; |
| 344 | 344 | |
| 345 | + err = -ENOMEM; | |
| 345 | 346 | mei_buf = kzalloc(length + MEI_NFC_HEADER_SIZE, GFP_KERNEL); |
| 346 | 347 | if (!mei_buf) |
| 347 | − return -ENOMEM; | |
| 348 | + goto out; | |
| 348 | 349 | |
| 349 | 350 | hdr = (struct mei_nfc_hci_hdr *) mei_buf; |
| 350 | 351 | hdr->cmd = MEI_NFC_CMD_HCI_SEND; |
| @@ -354,12 +355,9 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) · 3 unmodified lines | ||
| 354 | 355 | hdr->data_size = length; |
| 355 | 356 | |
| 356 | 357 | memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length); |
| 357 | − | |
| 358 | 358 | err = __mei_cl_send(ndev->cl, mei_buf, length + MEI_NFC_HEADER_SIZE); |
| 359 | 359 | if (err < 0) |
| 360 | − return err; | |
| 361 | − | |
| 362 | − kfree(mei_buf); | |
| 360 | + goto out; | |
| 363 | 361 | |
| 364 | 362 | if (!wait_event_interruptible_timeout(ndev->send_wq, |
| 365 | 363 | ndev->recv_req_id == ndev->req_id, HZ)) { |
| @@ -368,7 +366,8 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length) · 2 unmodified lines | ||
| 368 | 366 | } else { |
| 369 | 367 | ndev->req_id++; |
| 370 | 368 | } |
| 371 | − | |
| 369 | +out: | |
| 370 | + kfree(mei_buf); | |
| 372 | 371 | return err; |
| 373 | 372 | } |
| 374 | 373 | |
| @@ -1434,6 +1434,10 @@ static int cfi_amdstd_otp_walk(struct mtd_info *mtd, loff_t from, size_t len, · 1433 unmodified lines | ||
| 1434 | 1434 | |
| 1435 | 1435 | mutex_lock(&chip->mutex); |
| 1436 | 1436 | ret = get_chip(map, chip, base, FL_LOCKING); |
| 1437 | + if (ret) { | |
| 1438 | + mutex_unlock(&chip->mutex); | |
| 1439 | + return ret; | |
| 1440 | + } | |
| 1437 | 1441 | |
| 1438 | 1442 | /* Enter lock register command */ |
| 1439 | 1443 | cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, |
| @@ -931,7 +931,7 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const u_char *dat, · 930 unmodified lines | ||
| 931 | 931 | u32 val; |
| 932 | 932 | |
| 933 | 933 | val = readl(info->reg.gpmc_ecc_config); |
| 934 | − if (((val >> ECC_CONFIG_CS_SHIFT) & ~CS_MASK) != info->gpmc_cs) | |
| 934 | + if (((val >> ECC_CONFIG_CS_SHIFT) & CS_MASK) != info->gpmc_cs) | |
| 935 | 935 | return -EINVAL; |
| 936 | 936 | |
| 937 | 937 | /* read ecc result */ |
| @@ -1794,9 +1794,12 @@ static int omap_nand_probe(struct platform_device *pdev) · 856 unmodified lines | ||
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | 1796 | /* populate MTD interface based on ECC scheme */ |
| 1797 | − nand_chip->ecc.layout = &omap_oobinfo; | |
| 1798 | 1797 | ecclayout = &omap_oobinfo; |
| 1799 | 1798 | switch (info->ecc_opt) { |
| 1799 | + case OMAP_ECC_HAM1_CODE_SW: | |
| 1800 | + nand_chip->ecc.mode = NAND_ECC_SOFT; | |
| 1801 | + break; | |
| 1802 | + | |
| 1800 | 1803 | case OMAP_ECC_HAM1_CODE_HW: |
| 1801 | 1804 | pr_info("nand: using OMAP_ECC_HAM1_CODE_HW\n"); |
| 1802 | 1805 | nand_chip->ecc.mode = NAND_ECC_HW; |
| @@ -1848,7 +1851,7 @@ static int omap_nand_probe(struct platform_device *pdev) · 45 unmodified lines | ||
| 1848 | 1851 | nand_chip->ecc.priv = nand_bch_init(mtd, |
| 1849 | 1852 | nand_chip->ecc.size, |
| 1850 | 1853 | nand_chip->ecc.bytes, |
| 1851 | − &nand_chip->ecc.layout); | |
| 1854 | + &ecclayout); | |
| 1852 | 1855 | if (!nand_chip->ecc.priv) { |
| 1853 | 1856 | pr_err("nand: error: unable to use s/w BCH library\n"); |
| 1854 | 1857 | err = -EINVAL; |
| @@ -1923,7 +1926,7 @@ static int omap_nand_probe(struct platform_device *pdev) · 68 unmodified lines | ||
| 1923 | 1926 | nand_chip->ecc.priv = nand_bch_init(mtd, |
| 1924 | 1927 | nand_chip->ecc.size, |
| 1925 | 1928 | nand_chip->ecc.bytes, |
| 1926 | − &nand_chip->ecc.layout); | |
| 1929 | + &ecclayout); | |
| 1927 | 1930 | if (!nand_chip->ecc.priv) { |
| 1928 | 1931 | pr_err("nand: error: unable to use s/w BCH library\n"); |
| 1929 | 1932 | err = -EINVAL; |
| @@ -2012,6 +2015,9 @@ static int omap_nand_probe(struct platform_device *pdev) · 82 unmodified lines | ||
| 2012 | 2015 | goto return_error; |
| 2013 | 2016 | } |
| 2014 | 2017 | |
| 2018 | + if (info->ecc_opt == OMAP_ECC_HAM1_CODE_SW) | |
| 2019 | + goto scan_tail; | |
| 2020 | + | |
| 2015 | 2021 | /* all OOB bytes from oobfree->offset till end off OOB are free */ |
| 2016 | 2022 | ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; |
| 2017 | 2023 | /* check if NAND device's OOB is enough to store ECC signatures */ |
| @@ -2021,7 +2027,9 @@ static int omap_nand_probe(struct platform_device *pdev) · 3 unmodified lines | ||
| 2021 | 2027 | err = -EINVAL; |
| 2022 | 2028 | goto return_error; |
| 2023 | 2029 | } |
| 2030 | + nand_chip->ecc.layout = ecclayout; | |
| 2024 | 2031 | |
| 2032 | +scan_tail: | |
| 2025 | 2033 | /* second phase scan */ |
| 2026 | 2034 | if (nand_scan_tail(mtd)) { |
| 2027 | 2035 | err = -ENXIO; |
| @@ -2177,10 +2177,10 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) · 2176 unmodified lines | ||
| 2177 | 2177 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
| 2178 | 2178 | |
| 2179 | 2179 | vp->tx_ring[entry].frag[i+1].addr = |
| 2180 | − cpu_to_le32(pci_map_single( | |
| 2181 | − VORTEX_PCI(vp), | |
| 2182 | − (void *)skb_frag_address(frag), | |
| 2183 | − skb_frag_size(frag), PCI_DMA_TODEVICE)); | |
| 2180 | + cpu_to_le32(skb_frag_dma_map( | |
| 2181 | + &VORTEX_PCI(vp)->dev, | |
| 2182 | + frag, | |
| 2183 | + frag->page_offset, frag->size, DMA_TO_DEVICE)); | |
| 2184 | 2184 | |
| 2185 | 2185 | if (i == skb_shinfo(skb)->nr_frags-1) |
| 2186 | 2186 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); |
| @@ -123,6 +123,12 @@ static inline void greth_enable_tx(struct greth_private *greth) · 122 unmodified lines | ||
| 123 | 123 | GRETH_REGORIN(greth->regs->control, GRETH_TXEN); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | +static inline void greth_enable_tx_and_irq(struct greth_private *greth) | |
| 127 | +{ | |
| 128 | + wmb(); /* BDs must been written to memory before enabling TX */ | |
| 129 | + GRETH_REGORIN(greth->regs->control, GRETH_TXEN | GRETH_TXI); | |
| 130 | +} | |
| 131 | + | |
| 126 | 132 | static inline void greth_disable_tx(struct greth_private *greth) |
| 127 | 133 | { |
| 128 | 134 | GRETH_REGANDIN(greth->regs->control, ~GRETH_TXEN); |
| @@ -447,29 +453,30 @@ out: · 318 unmodified lines | ||
| 447 | 453 | return err; |
| 448 | 454 | } |
| 449 | 455 | |
| 456 | +static inline u16 greth_num_free_bds(u16 tx_last, u16 tx_next) | |
| 457 | +{ | |
| 458 | + if (tx_next < tx_last) | |
| 459 | + return (tx_last - tx_next) - 1; | |
| 460 | + else | |
| 461 | + return GRETH_TXBD_NUM - (tx_next - tx_last) - 1; | |
| 462 | +} | |
| 450 | 463 | |
| 451 | 464 | static netdev_tx_t |
| 452 | 465 | greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) |
| 453 | 466 | { |
| 454 | 467 | struct greth_private *greth = netdev_priv(dev); |
| 455 | 468 | struct greth_bd *bdp; |
| 456 | − u32 status = 0, dma_addr, ctrl; | |
| 469 | + u32 status, dma_addr; | |
| 457 | 470 | int curr_tx, nr_frags, i, err = NETDEV_TX_OK; |
| 458 | 471 | unsigned long flags; |
| 472 | + u16 tx_last; | |
| 459 | 473 | |
| 460 | 474 | nr_frags = skb_shinfo(skb)->nr_frags; |
| 475 | + tx_last = greth->tx_last; | |
| 476 | + rmb(); /* tx_last is updated by the poll task */ | |
| 461 | 477 | |
| 462 | − /* Clean TX Ring */ | |
| 463 | − greth_clean_tx_gbit(dev); | |
| 464 | − | |
| 465 | − if (greth->tx_free < nr_frags + 1) { | |
| 466 | − spin_lock_irqsave(&greth->devlock, flags);/*save from poll/irq*/ | |
| 467 | − ctrl = GRETH_REGLOAD(greth->regs->control); | |
| 468 | − /* Enable TX IRQ only if not already in poll() routine */ | |
| 469 | − if (ctrl & GRETH_RXI) | |
| 470 | − GRETH_REGSAVE(greth->regs->control, ctrl | GRETH_TXI); | |
| 478 | + if (greth_num_free_bds(tx_last, greth->tx_next) < nr_frags + 1) { | |
| 471 | 479 | netif_stop_queue(dev); |
| 472 | − spin_unlock_irqrestore(&greth->devlock, flags); | |
| 473 | 480 | err = NETDEV_TX_BUSY; |
| 474 | 481 | goto out; |
| 475 | 482 | } |
| @@ -488,6 +495,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) · 12 unmodified lines | ||
| 488 | 495 | /* Linear buf */ |
| 489 | 496 | if (nr_frags != 0) |
| 490 | 497 | status = GRETH_TXBD_MORE; |
| 498 | + else | |
| 499 | + status = GRETH_BD_IE; | |
| 491 | 500 | |
| 492 | 501 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
| 493 | 502 | status |= GRETH_TXBD_CSALL; |
| @@ -545,14 +554,12 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) · 51 unmodified lines | ||
| 545 | 554 | |
| 546 | 555 | /* Enable the descriptor chain by enabling the first descriptor */ |
| 547 | 556 | bdp = greth->tx_bd_base + greth->tx_next; |
| 548 | − greth_write_bd(&bdp->stat, greth_read_bd(&bdp->stat) | GRETH_BD_EN); | |
| 549 | − greth->tx_next = curr_tx; | |
| 550 | − greth->tx_free -= nr_frags + 1; | |
| 551 | − | |
| 552 | − wmb(); | |
| 557 | + greth_write_bd(&bdp->stat, | |
| 558 | + greth_read_bd(&bdp->stat) | GRETH_BD_EN); | |
| 553 | 559 | |
| 554 | 560 | spin_lock_irqsave(&greth->devlock, flags); /*save from poll/irq*/ |
| 555 | − greth_enable_tx(greth); | |
| 561 | + greth->tx_next = curr_tx; | |
| 562 | + greth_enable_tx_and_irq(greth); | |
| 556 | 563 | spin_unlock_irqrestore(&greth->devlock, flags); |
| 557 | 564 | |
| 558 | 565 | return NETDEV_TX_OK; |
| @@ -648,7 +655,6 @@ static void greth_clean_tx(struct net_device *dev) · 89 unmodified lines | ||
| 648 | 655 | if (greth->tx_free > 0) { |
| 649 | 656 | netif_wake_queue(dev); |
| 650 | 657 | } |
| 651 | − | |
| 652 | 658 | } |
| 653 | 659 | |
| 654 | 660 | static inline void greth_update_tx_stats(struct net_device *dev, u32 stat) |
| @@ -670,20 +676,22 @@ static void greth_clean_tx_gbit(struct net_device *dev) · 15 unmodified lines | ||
| 670 | 676 | { |
| 671 | 677 | struct greth_private *greth; |
| 672 | 678 | struct greth_bd *bdp, *bdp_last_frag; |
| 673 | − struct sk_buff *skb; | |
| 679 | + struct sk_buff *skb = NULL; | |
| 674 | 680 | u32 stat; |
| 675 | 681 | int nr_frags, i; |
| 682 | + u16 tx_last; | |
| 676 | 683 | |
| 677 | 684 | greth = netdev_priv(dev); |
| 685 | + tx_last = greth->tx_last; | |
| 678 | 686 | |
| 679 | − while (greth->tx_free < GRETH_TXBD_NUM) { | |
| 687 | + while (tx_last != greth->tx_next) { | |
| 680 | 688 | |
| 681 | − skb = greth->tx_skbuff[greth->tx_last]; | |
| 689 | + skb = greth->tx_skbuff[tx_last]; | |
| 682 | 690 | |
| 683 | 691 | nr_frags = skb_shinfo(skb)->nr_frags; |
| 684 | 692 | |
| 685 | 693 | /* We only clean fully completed SKBs */ |
| 686 | − bdp_last_frag = greth->tx_bd_base + SKIP_TX(greth->tx_last, nr_frags); | |
| 694 | + bdp_last_frag = greth->tx_bd_base + SKIP_TX(tx_last, nr_frags); | |
| 687 | 695 | |
| 688 | 696 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_TE | GRETH_INT_TX); |
| 689 | 697 | mb(); |
| @@ -692,14 +700,14 @@ static void greth_clean_tx_gbit(struct net_device *dev) · 2 unmodified lines | ||
| 692 | 700 | if (stat & GRETH_BD_EN) |
| 693 | 701 | break; |
| 694 | 702 | |
| 695 | − greth->tx_skbuff[greth->tx_last] = NULL; | |
| 703 | + greth->tx_skbuff[tx_last] = NULL; | |
| 696 | 704 | |
| 697 | 705 | greth_update_tx_stats(dev, stat); |
| 698 | 706 | dev->stats.tx_bytes += skb->len; |
| 699 | 707 | |
| 700 | − bdp = greth->tx_bd_base + greth->tx_last; | |
| 708 | + bdp = greth->tx_bd_base + tx_last; | |
| 701 | 709 | |
| 702 | − greth->tx_last = NEXT_TX(greth->tx_last); | |
| 710 | + tx_last = NEXT_TX(tx_last); | |
| 703 | 711 | |
| 704 | 712 | dma_unmap_single(greth->dev, |
| 705 | 713 | greth_read_bd(&bdp->addr), |
| @@ -708,21 +716,26 @@ static void greth_clean_tx_gbit(struct net_device *dev) · 2 unmodified lines | ||
| 708 | 716 | |
| 709 | 717 | for (i = 0; i < nr_frags; i++) { |
| 710 | 718 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
| 711 | − bdp = greth->tx_bd_base + greth->tx_last; | |
| 719 | + bdp = greth->tx_bd_base + tx_last; | |
| 712 | 720 | |
| 713 | 721 | dma_unmap_page(greth->dev, |
| 714 | 722 | greth_read_bd(&bdp->addr), |
| 715 | 723 | skb_frag_size(frag), |
| 716 | 724 | DMA_TO_DEVICE); |
| 717 | 725 | |
| 718 | − greth->tx_last = NEXT_TX(greth->tx_last); | |
| 726 | + tx_last = NEXT_TX(tx_last); | |
| 719 | 727 | } |
| 720 | − greth->tx_free += nr_frags+1; | |
| 721 | 728 | dev_kfree_skb(skb); |
| 722 | 729 | } |
| 730 | + if (skb) { /* skb is set only if the above while loop was entered */ | |
| 731 | + wmb(); | |
| 732 | + greth->tx_last = tx_last; | |
| 723 | 733 | |
| 724 | − if (netif_queue_stopped(dev) && (greth->tx_free > (MAX_SKB_FRAGS+1))) | |
| 725 | − netif_wake_queue(dev); | |
| 734 | + if (netif_queue_stopped(dev) && | |
| 735 | + (greth_num_free_bds(tx_last, greth->tx_next) > | |
| 736 | + (MAX_SKB_FRAGS+1))) | |
| 737 | + netif_wake_queue(dev); | |
| 738 | + } | |
| 726 | 739 | } |
| 727 | 740 | |
| 728 | 741 | static int greth_rx(struct net_device *dev, int limit) |
| @@ -965,16 +978,12 @@ static int greth_poll(struct napi_struct *napi, int budget) · 236 unmodified lines | ||
| 965 | 978 | greth = container_of(napi, struct greth_private, napi); |
| 966 | 979 | |
| 967 | 980 | restart_txrx_poll: |
| 968 | − if (netif_queue_stopped(greth->netdev)) { | |
| 969 | − if (greth->gbit_mac) | |
| 970 | − greth_clean_tx_gbit(greth->netdev); | |
| 971 | − else | |
| 972 | − greth_clean_tx(greth->netdev); | |
| 973 | − } | |
| 974 | − | |
| 975 | 981 | if (greth->gbit_mac) { |
| 982 | + greth_clean_tx_gbit(greth->netdev); | |
| 976 | 983 | work_done += greth_rx_gbit(greth->netdev, budget - work_done); |
| 977 | 984 | } else { |
| 985 | + if (netif_queue_stopped(greth->netdev)) | |
| 986 | + greth_clean_tx(greth->netdev); | |
| 978 | 987 | work_done += greth_rx(greth->netdev, budget - work_done); |
| 979 | 988 | } |
| 980 | 989 | |
| @@ -983,7 +992,8 @@ restart_txrx_poll: · 2 unmodified lines | ||
| 983 | 992 | spin_lock_irqsave(&greth->devlock, flags); |
| 984 | 993 | |
| 985 | 994 | ctrl = GRETH_REGLOAD(greth->regs->control); |
| 986 | − if (netif_queue_stopped(greth->netdev)) { | |
| 995 | + if ((greth->gbit_mac && (greth->tx_last != greth->tx_next)) || | |
| 996 | + (!greth->gbit_mac && netif_queue_stopped(greth->netdev))) { | |
| 987 | 997 | GRETH_REGSAVE(greth->regs->control, |
| 988 | 998 | ctrl | GRETH_TXI | GRETH_RXI); |
| 989 | 999 | mask = GRETH_INT_RX | GRETH_INT_RE | |
| @@ -107,7 +107,7 @@ struct greth_private { · 106 unmodified lines | ||
| 107 | 107 | |
| 108 | 108 | u16 tx_next; |
| 109 | 109 | u16 tx_last; |
| 110 | − u16 tx_free; | |
| 110 | + u16 tx_free; /* only used on 10/100Mbit */ | |
| 111 | 111 | u16 rx_cur; |
| 112 | 112 | |
| 113 | 113 | struct greth_regs *regs; /* Address of controller registers. */ |
| @@ -271,8 +271,8 @@ static ssize_t xpcs_reg_value_read(struct file *filp, char __user *buffer, · 270 unmodified lines | ||
| 271 | 271 | struct xgbe_prv_data *pdata = filp->private_data; |
| 272 | 272 | unsigned int value; |
| 273 | 273 | |
| 274 | − value = pdata->hw_if.read_mmd_regs(pdata, pdata->debugfs_xpcs_mmd, | |
| 275 | − pdata->debugfs_xpcs_reg); | |
| 274 | + value = XMDIO_READ(pdata, pdata->debugfs_xpcs_mmd, | |
| 275 | + pdata->debugfs_xpcs_reg); | |
| 276 | 276 | |
| 277 | 277 | return xgbe_common_read(buffer, count, ppos, value); |
| 278 | 278 | } |
| @@ -289,8 +289,8 @@ static ssize_t xpcs_reg_value_write(struct file *filp, · 10 unmodified lines | ||
| 289 | 289 | if (len < 0) |
| 290 | 290 | return len; |
| 291 | 291 | |
| 292 | − pdata->hw_if.write_mmd_regs(pdata, pdata->debugfs_xpcs_mmd, | |
| 293 | − pdata->debugfs_xpcs_reg, value); | |
| 292 | + XMDIO_WRITE(pdata, pdata->debugfs_xpcs_mmd, pdata->debugfs_xpcs_reg, | |
| 293 | + value); | |
| 294 | 294 | |
| 295 | 295 | return len; |
| 296 | 296 | } |
| @@ -347,7 +347,7 @@ static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata) · 346 unmodified lines | ||
| 347 | 347 | |
| 348 | 348 | /* Clear MAC flow control */ |
| 349 | 349 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
| 350 | − q_count = min_t(unsigned int, pdata->rx_q_count, max_q_count); | |
| 350 | + q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); | |
| 351 | 351 | reg = MAC_Q0TFCR; |
| 352 | 352 | for (i = 0; i < q_count; i++) { |
| 353 | 353 | reg_val = XGMAC_IOREAD(pdata, reg); |
| @@ -372,7 +372,7 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) · 18 unmodified lines | ||
| 372 | 372 | |
| 373 | 373 | /* Set MAC flow control */ |
| 374 | 374 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
| 375 | − q_count = min_t(unsigned int, pdata->rx_q_count, max_q_count); | |
| 375 | + q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); | |
| 376 | 376 | reg = MAC_Q0TFCR; |
| 377 | 377 | for (i = 0; i < q_count; i++) { |
| 378 | 378 | reg_val = XGMAC_IOREAD(pdata, reg); |
| @@ -508,8 +508,8 @@ static void xgbe_enable_mac_interrupts(struct xgbe_prv_data *pdata) · 129 unmodified lines | ||
| 508 | 508 | XGMAC_IOWRITE(pdata, MAC_IER, mac_ier); |
| 509 | 509 | |
| 510 | 510 | /* Enable all counter interrupts */ |
| 511 | − XGMAC_IOWRITE_BITS(pdata, MMC_RIER, ALL_INTERRUPTS, 0xff); | |
| 512 | − XGMAC_IOWRITE_BITS(pdata, MMC_TIER, ALL_INTERRUPTS, 0xff); | |
| 511 | + XGMAC_IOWRITE_BITS(pdata, MMC_RIER, ALL_INTERRUPTS, 0xffffffff); | |
| 512 | + XGMAC_IOWRITE_BITS(pdata, MMC_TIER, ALL_INTERRUPTS, 0xffffffff); | |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) |
| @@ -1632,6 +1632,9 @@ static int xgbe_flush_tx_queues(struct xgbe_prv_data *pdata) · 1116 unmodified lines | ||
| 1632 | 1632 | { |
| 1633 | 1633 | unsigned int i, count; |
| 1634 | 1634 | |
| 1635 | + if (XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) < 0x21) | |
| 1636 | + return 0; | |
| 1637 | + | |
| 1635 | 1638 | for (i = 0; i < pdata->tx_q_count; i++) |
| 1636 | 1639 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_TQOMR, FTQ, 1); |
| 1637 | 1640 | |
| @@ -1702,8 +1705,8 @@ static void xgbe_config_mtl_mode(struct xgbe_prv_data *pdata) · 64 unmodified lines | ||
| 1702 | 1705 | XGMAC_IOWRITE_BITS(pdata, MTL_OMR, RAA, MTL_RAA_SP); |
| 1703 | 1706 | } |
| 1704 | 1707 | |
| 1705 | −static unsigned int xgbe_calculate_per_queue_fifo(unsigned long fifo_size, | |
| 1706 | − unsigned char queue_count) | |
| 1708 | +static unsigned int xgbe_calculate_per_queue_fifo(unsigned int fifo_size, | |
| 1709 | + unsigned int queue_count) | |
| 1707 | 1710 | { |
| 1708 | 1711 | unsigned int q_fifo_size = 0; |
| 1709 | 1712 | enum xgbe_mtl_fifo_size p_fifo = XGMAC_MTL_FIFO_SIZE_256; |
| @@ -1747,6 +1750,10 @@ static unsigned int xgbe_calculate_per_queue_fifo(unsigned long fifo_size, · 37 unmodified lines | ||
| 1747 | 1750 | q_fifo_size = XGBE_FIFO_SIZE_KB(256); |
| 1748 | 1751 | break; |
| 1749 | 1752 | } |
| 1753 | + | |
| 1754 | + /* The configured value is not the actual amount of fifo RAM */ | |
| 1755 | + q_fifo_size = min_t(unsigned int, XGBE_FIFO_MAX, q_fifo_size); | |
| 1756 | + | |
| 1750 | 1757 | q_fifo_size = q_fifo_size / queue_count; |
| 1751 | 1758 | |
| 1752 | 1759 | /* Set the queue fifo size programmable value */ |
| @@ -1946,6 +1953,32 @@ static void xgbe_config_vlan_support(struct xgbe_prv_data *pdata) · 193 unmodified lines | ||
| 1946 | 1953 | xgbe_disable_rx_vlan_stripping(pdata); |
| 1947 | 1954 | } |
| 1948 | 1955 | |
| 1956 | +static u64 xgbe_mmc_read(struct xgbe_prv_data *pdata, unsigned int reg_lo) | |
| 1957 | +{ | |
| 1958 | + bool read_hi; | |
| 1959 | + u64 val; | |
| 1960 | + | |
| 1961 | + switch (reg_lo) { | |
| 1962 | + /* These registers are always 64 bit */ | |
| 1963 | + case MMC_TXOCTETCOUNT_GB_LO: | |
| 1964 | + case MMC_TXOCTETCOUNT_G_LO: | |
| 1965 | + case MMC_RXOCTETCOUNT_GB_LO: | |
| 1966 | + case MMC_RXOCTETCOUNT_G_LO: | |
| 1967 | + read_hi = true; | |
| 1968 | + break; | |
| 1969 | + | |
| 1970 | + default: | |
| 1971 | + read_hi = false; | |
| 1972 | + }; | |
| 1973 | + | |
| 1974 | + val = XGMAC_IOREAD(pdata, reg_lo); | |
| 1975 | + | |
| 1976 | + if (read_hi) | |
| 1977 | + val |= ((u64)XGMAC_IOREAD(pdata, reg_lo + 4) << 32); | |
| 1978 | + | |
| 1979 | + return val; | |
| 1980 | +} | |
| 1981 | + | |
| 1949 | 1982 | static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata) |
| 1950 | 1983 | { |
| 1951 | 1984 | struct xgbe_mmc_stats *stats = &pdata->mmc_stats; |
| @@ -1953,75 +1986,75 @@ static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata) · 1 unmodified line | ||
| 1953 | 1986 | |
| 1954 | 1987 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_GB)) |
| 1955 | 1988 | stats->txoctetcount_gb += |
| 1956 | − XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO); | |
| 1989 | + xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO); | |
| 1957 | 1990 | |
| 1958 | 1991 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_GB)) |
| 1959 | 1992 | stats->txframecount_gb += |
| 1960 | − XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO); | |
| 1993 | + xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO); | |
| 1961 | 1994 | |
| 1962 | 1995 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_G)) |
| 1963 | 1996 | stats->txbroadcastframes_g += |
| 1964 | − XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO); | |
| 1997 | + xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO); | |
| 1965 | 1998 | |
| 1966 | 1999 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_G)) |
| 1967 | 2000 | stats->txmulticastframes_g += |
| 1968 | − XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO); | |
| 2001 | + xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO); | |
| 1969 | 2002 | |
| 1970 | 2003 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX64OCTETS_GB)) |
| 1971 | 2004 | stats->tx64octets_gb += |
| 1972 | − XGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO); | |
| 2005 | + xgbe_mmc_read(pdata, MMC_TX64OCTETS_GB_LO); | |
| 1973 | 2006 | |
| 1974 | 2007 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX65TO127OCTETS_GB)) |
| 1975 | 2008 | stats->tx65to127octets_gb += |
| 1976 | − XGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO); | |
| 2009 | + xgbe_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO); | |
| 1977 | 2010 | |
| 1978 | 2011 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX128TO255OCTETS_GB)) |
| 1979 | 2012 | stats->tx128to255octets_gb += |
| 1980 | − XGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO); | |
| 2013 | + xgbe_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO); | |
| 1981 | 2014 | |
| 1982 | 2015 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX256TO511OCTETS_GB)) |
| 1983 | 2016 | stats->tx256to511octets_gb += |
| 1984 | − XGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO); | |
| 2017 | + xgbe_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO); | |
| 1985 | 2018 | |
| 1986 | 2019 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX512TO1023OCTETS_GB)) |
| 1987 | 2020 | stats->tx512to1023octets_gb += |
| 1988 | − XGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO); | |
| 2021 | + xgbe_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO); | |
| 1989 | 2022 | |
| 1990 | 2023 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX1024TOMAXOCTETS_GB)) |
| 1991 | 2024 | stats->tx1024tomaxoctets_gb += |
| 1992 | − XGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); | |
| 2025 | + xgbe_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); | |
| 1993 | 2026 | |
| 1994 | 2027 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNICASTFRAMES_GB)) |
| 1995 | 2028 | stats->txunicastframes_gb += |
| 1996 | − XGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO); | |
| 2029 | + xgbe_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO); | |
| 1997 | 2030 | |
| 1998 | 2031 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_GB)) |
| 1999 | 2032 | stats->txmulticastframes_gb += |
| 2000 | − XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO); | |
| 2033 | + xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO); | |
| 2001 | 2034 | |
| 2002 | 2035 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_GB)) |
| 2003 | 2036 | stats->txbroadcastframes_g += |
| 2004 | − XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO); | |
| 2037 | + xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO); | |
| 2005 | 2038 | |
| 2006 | 2039 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNDERFLOWERROR)) |
| 2007 | 2040 | stats->txunderflowerror += |
| 2008 | − XGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO); | |
| 2041 | + xgbe_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO); | |
| 2009 | 2042 | |
| 2010 | 2043 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_G)) |
| 2011 | 2044 | stats->txoctetcount_g += |
| 2012 | − XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO); | |
| 2045 | + xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO); | |
| 2013 | 2046 | |
| 2014 | 2047 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_G)) |
| 2015 | 2048 | stats->txframecount_g += |
| 2016 | − XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO); | |
| 2049 | + xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO); | |
| 2017 | 2050 | |
| 2018 | 2051 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXPAUSEFRAMES)) |
| 2019 | 2052 | stats->txpauseframes += |
| 2020 | − XGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO); | |
| 2053 | + xgbe_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO); | |
| 2021 | 2054 | |
| 2022 | 2055 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXVLANFRAMES_G)) |
| 2023 | 2056 | stats->txvlanframes_g += |
| 2024 | − XGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO); | |
| 2057 | + xgbe_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO); | |
| 2025 | 2058 | } |
| 2026 | 2059 | |
| 2027 | 2060 | static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata) |
| @@ -2031,95 +2064,95 @@ static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata) · 3 unmodified lines | ||
| 2031 | 2064 | |
| 2032 | 2065 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFRAMECOUNT_GB)) |
| 2033 | 2066 | stats->rxframecount_gb += |
| 2034 | − XGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO); | |
| 2067 | + xgbe_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO); | |
| 2035 | 2068 | |
| 2036 | 2069 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_GB)) |
| 2037 | 2070 | stats->rxoctetcount_gb += |
| 2038 | − XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO); | |
| 2071 | + xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO); | |
| 2039 | 2072 | |
| 2040 | 2073 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_G)) |
| 2041 | 2074 | stats->rxoctetcount_g += |
| 2042 | − XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO); | |
| 2075 | + xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO); | |
| 2043 | 2076 | |
| 2044 | 2077 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXBROADCASTFRAMES_G)) |
| 2045 | 2078 | stats->rxbroadcastframes_g += |
| 2046 | − XGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO); | |
| 2079 | + xgbe_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO); | |
| 2047 | 2080 | |
| 2048 | 2081 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXMULTICASTFRAMES_G)) |
| 2049 | 2082 | stats->rxmulticastframes_g += |
| 2050 | − XGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO); | |
| 2083 | + xgbe_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO); | |
| 2051 | 2084 | |
| 2052 | 2085 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXCRCERROR)) |
| 2053 | 2086 | stats->rxcrcerror += |
| 2054 | − XGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO); | |
| 2087 | + xgbe_mmc_read(pdata, MMC_RXCRCERROR_LO); | |
| 2055 | 2088 | |
| 2056 | 2089 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXRUNTERROR)) |
| 2057 | 2090 | stats->rxrunterror += |
| 2058 | − XGMAC_IOREAD(pdata, MMC_RXRUNTERROR); | |
| 2091 | + xgbe_mmc_read(pdata, MMC_RXRUNTERROR); | |
| 2059 | 2092 | |
| 2060 | 2093 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXJABBERERROR)) |
| 2061 | 2094 | stats->rxjabbererror += |
| 2062 | − XGMAC_IOREAD(pdata, MMC_RXJABBERERROR); | |
| 2095 | + xgbe_mmc_read(pdata, MMC_RXJABBERERROR); | |
| 2063 | 2096 | |
| 2064 | 2097 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNDERSIZE_G)) |
| 2065 | 2098 | stats->rxundersize_g += |
| 2066 | − XGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G); | |
| 2099 | + xgbe_mmc_read(pdata, MMC_RXUNDERSIZE_G); | |
| 2067 | 2100 | |
| 2068 | 2101 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOVERSIZE_G)) |
| 2069 | 2102 | stats->rxoversize_g += |
| 2070 | − XGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G); | |
| 2103 | + xgbe_mmc_read(pdata, MMC_RXOVERSIZE_G); | |
| 2071 | 2104 | |
| 2072 | 2105 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX64OCTETS_GB)) |
| 2073 | 2106 | stats->rx64octets_gb += |
| 2074 | − XGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO); | |
| 2107 | + xgbe_mmc_read(pdata, MMC_RX64OCTETS_GB_LO); | |
| 2075 | 2108 | |
| 2076 | 2109 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX65TO127OCTETS_GB)) |
| 2077 | 2110 | stats->rx65to127octets_gb += |
| 2078 | − XGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO); | |
| 2111 | + xgbe_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO); | |
| 2079 | 2112 | |
| 2080 | 2113 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX128TO255OCTETS_GB)) |
| 2081 | 2114 | stats->rx128to255octets_gb += |
| 2082 | − XGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO); | |
| 2115 | + xgbe_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO); | |
| 2083 | 2116 | |
| 2084 | 2117 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX256TO511OCTETS_GB)) |
| 2085 | 2118 | stats->rx256to511octets_gb += |
| 2086 | − XGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO); | |
| 2119 | + xgbe_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO); | |
| 2087 | 2120 | |
| 2088 | 2121 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX512TO1023OCTETS_GB)) |
| 2089 | 2122 | stats->rx512to1023octets_gb += |
| 2090 | − XGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO); | |
| 2123 | + xgbe_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO); | |
| 2091 | 2124 | |
| 2092 | 2125 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX1024TOMAXOCTETS_GB)) |
| 2093 | 2126 | stats->rx1024tomaxoctets_gb += |
| 2094 | − XGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); | |
| 2127 | + xgbe_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); | |
| 2095 | 2128 | |
| 2096 | 2129 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNICASTFRAMES_G)) |
| 2097 | 2130 | stats->rxunicastframes_g += |
| 2098 | − XGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO); | |
| 2131 | + xgbe_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO); | |
| 2099 | 2132 | |
| 2100 | 2133 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXLENGTHERROR)) |
| 2101 | 2134 | stats->rxlengtherror += |
| 2102 | − XGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO); | |
| 2135 | + xgbe_mmc_read(pdata, MMC_RXLENGTHERROR_LO); | |
| 2103 | 2136 | |
| 2104 | 2137 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOUTOFRANGETYPE)) |
| 2105 | 2138 | stats->rxoutofrangetype += |
| 2106 | − XGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO); | |
| 2139 | + xgbe_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO); | |
| 2107 | 2140 | |
| 2108 | 2141 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXPAUSEFRAMES)) |
| 2109 | 2142 | stats->rxpauseframes += |
| 2110 | − XGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO); | |
| 2143 | + xgbe_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO); | |
| 2111 | 2144 | |
| 2112 | 2145 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFIFOOVERFLOW)) |
| 2113 | 2146 | stats->rxfifooverflow += |
| 2114 | − XGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO); | |
| 2147 | + xgbe_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO); | |
| 2115 | 2148 | |
| 2116 | 2149 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXVLANFRAMES_GB)) |
| 2117 | 2150 | stats->rxvlanframes_gb += |
| 2118 | − XGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO); | |
| 2151 | + xgbe_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO); | |
| 2119 | 2152 | |
| 2120 | 2153 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXWATCHDOGERROR)) |
| 2121 | 2154 | stats->rxwatchdogerror += |
| 2122 | − XGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR); | |
| 2155 | + xgbe_mmc_read(pdata, MMC_RXWATCHDOGERROR); | |
| 2123 | 2156 | } |
| 2124 | 2157 | |
| 2125 | 2158 | static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata) |
| @@ -2130,127 +2163,127 @@ static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata) · 4 unmodified lines | ||
| 2130 | 2163 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 1); |
| 2131 | 2164 | |
| 2132 | 2165 | stats->txoctetcount_gb += |
| 2133 | − XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO); | |
| 2166 | + xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO); | |
| 2134 | 2167 | |
| 2135 | 2168 | stats->txframecount_gb += |
| 2136 | − XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO); | |
| 2169 | + xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO); | |
| 2137 | 2170 | |
| 2138 | 2171 | stats->txbroadcastframes_g += |
| 2139 | − XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO); | |
| 2172 | + xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO); | |
| 2140 | 2173 | |
| 2141 | 2174 | stats->txmulticastframes_g += |
| 2142 | − XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO); | |
| 2175 | + xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO); | |
| 2143 | 2176 | |
| 2144 | 2177 | stats->tx64octets_gb += |
| 2145 | − XGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO); | |
| 2178 | + xgbe_mmc_read(pdata, MMC_TX64OCTETS_GB_LO); | |
| 2146 | 2179 | |
| 2147 | 2180 | stats->tx65to127octets_gb += |
| 2148 | − XGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO); | |
| 2181 | + xgbe_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO); | |
| 2149 | 2182 | |
| 2150 | 2183 | stats->tx128to255octets_gb += |
| 2151 | − XGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO); | |
| 2184 | + xgbe_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO); | |
| 2152 | 2185 | |
| 2153 | 2186 | stats->tx256to511octets_gb += |
| 2154 | − XGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO); | |
| 2187 | + xgbe_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO); | |
| 2155 | 2188 | |
| 2156 | 2189 | stats->tx512to1023octets_gb += |
| 2157 | − XGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO); | |
| 2190 | + xgbe_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO); | |
| 2158 | 2191 | |
| 2159 | 2192 | stats->tx1024tomaxoctets_gb += |
| 2160 | − XGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); | |
| 2193 | + xgbe_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); | |
| 2161 | 2194 | |
| 2162 | 2195 | stats->txunicastframes_gb += |
| 2163 | − XGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO); | |
| 2196 | + xgbe_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO); | |
| 2164 | 2197 | |
| 2165 | 2198 | stats->txmulticastframes_gb += |
| 2166 | − XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO); | |
| 2199 | + xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO); | |
| 2167 | 2200 | |
| 2168 | 2201 | stats->txbroadcastframes_g += |
| 2169 | − XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO); | |
| 2202 | + xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO); | |
| 2170 | 2203 | |
| 2171 | 2204 | stats->txunderflowerror += |
| 2172 | − XGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO); | |
| 2205 | + xgbe_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO); | |
| 2173 | 2206 | |
| 2174 | 2207 | stats->txoctetcount_g += |
| 2175 | − XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO); | |
| 2208 | + xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO); | |
| 2176 | 2209 | |
| 2177 | 2210 | stats->txframecount_g += |
| 2178 | − XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO); | |
| 2211 | + xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO); | |
| 2179 | 2212 | |
| 2180 | 2213 | stats->txpauseframes += |
| 2181 | − XGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO); | |
| 2214 | + xgbe_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO); | |
| 2182 | 2215 | |
| 2183 | 2216 | stats->txvlanframes_g += |
| 2184 | − XGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO); | |
| 2217 | + xgbe_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO); | |
| 2185 | 2218 | |
| 2186 | 2219 | stats->rxframecount_gb += |
| 2187 | − XGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO); | |
| 2220 | + xgbe_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO); | |
| 2188 | 2221 | |
| 2189 | 2222 | stats->rxoctetcount_gb += |
| 2190 | − XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO); | |
| 2223 | + xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO); | |
| 2191 | 2224 | |
| 2192 | 2225 | stats->rxoctetcount_g += |
| 2193 | − XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO); | |
| 2226 | + xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO); | |
| 2194 | 2227 | |
| 2195 | 2228 | stats->rxbroadcastframes_g += |
| 2196 | − XGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO); | |
| 2229 | + xgbe_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO); | |
| 2197 | 2230 | |
| 2198 | 2231 | stats->rxmulticastframes_g += |
| 2199 | − XGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO); | |
| 2232 | + xgbe_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO); | |
| 2200 | 2233 | |
| 2201 | 2234 | stats->rxcrcerror += |
| 2202 | − XGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO); | |
| 2235 | + xgbe_mmc_read(pdata, MMC_RXCRCERROR_LO); | |
| 2203 | 2236 | |
| 2204 | 2237 | stats->rxrunterror += |
| 2205 | − XGMAC_IOREAD(pdata, MMC_RXRUNTERROR); | |
| 2238 | + xgbe_mmc_read(pdata, MMC_RXRUNTERROR); | |
| 2206 | 2239 | |
| 2207 | 2240 | stats->rxjabbererror += |
| 2208 | − XGMAC_IOREAD(pdata, MMC_RXJABBERERROR); | |
| 2241 | + xgbe_mmc_read(pdata, MMC_RXJABBERERROR); | |
| 2209 | 2242 | |
| 2210 | 2243 | stats->rxundersize_g += |
| 2211 | − XGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G); | |
| 2244 | + xgbe_mmc_read(pdata, MMC_RXUNDERSIZE_G); | |
| 2212 | 2245 | |
| 2213 | 2246 | stats->rxoversize_g += |
| 2214 | − XGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G); | |
| 2247 | + xgbe_mmc_read(pdata, MMC_RXOVERSIZE_G); | |
| 2215 | 2248 | |
| 2216 | 2249 | stats->rx64octets_gb += |
| 2217 | − XGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO); | |
| 2250 | + xgbe_mmc_read(pdata, MMC_RX64OCTETS_GB_LO); | |
| 2218 | 2251 | |
| 2219 | 2252 | stats->rx65to127octets_gb += |
| 2220 | − XGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO); | |
| 2253 | + xgbe_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO); | |
| 2221 | 2254 | |
| 2222 | 2255 | stats->rx128to255octets_gb += |
| 2223 | − XGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO); | |
| 2256 | + xgbe_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO); | |
| 2224 | 2257 | |
| 2225 | 2258 | stats->rx256to511octets_gb += |
| 2226 | − XGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO); | |
| 2259 | + xgbe_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO); | |
| 2227 | 2260 | |
| 2228 | 2261 | stats->rx512to1023octets_gb += |
| 2229 | − XGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO); | |
| 2262 | + xgbe_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO); | |
| 2230 | 2263 | |
| 2231 | 2264 | stats->rx1024tomaxoctets_gb += |
| 2232 | − XGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); | |
| 2265 | + xgbe_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); | |
| 2233 | 2266 | |
| 2234 | 2267 | stats->rxunicastframes_g += |
| 2235 | − XGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO); | |
| 2268 | + xgbe_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO); | |
| 2236 | 2269 | |
| 2237 | 2270 | stats->rxlengtherror += |
| 2238 | − XGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO); | |
| 2271 | + xgbe_mmc_read(pdata, MMC_RXLENGTHERROR_LO); | |
| 2239 | 2272 | |
| 2240 | 2273 | stats->rxoutofrangetype += |
| 2241 | − XGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO); | |
| 2274 | + xgbe_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO); | |
| 2242 | 2275 | |
| 2243 | 2276 | stats->rxpauseframes += |
| 2244 | − XGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO); | |
| 2277 | + xgbe_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO); | |
| 2245 | 2278 | |
| 2246 | 2279 | stats->rxfifooverflow += |
| 2247 | − XGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO); | |
| 2280 | + xgbe_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO); | |
| 2248 | 2281 | |
| 2249 | 2282 | stats->rxvlanframes_gb += |
| 2250 | − XGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO); | |
| 2283 | + xgbe_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO); | |
| 2251 | 2284 | |
| 2252 | 2285 | stats->rxwatchdogerror += |
| 2253 | − XGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR); | |
| 2286 | + xgbe_mmc_read(pdata, MMC_RXWATCHDOGERROR); | |
| 2254 | 2287 | |
| 2255 | 2288 | /* Un-freeze counters */ |
| 2256 | 2289 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 0); |
| @@ -360,6 +360,8 @@ void xgbe_get_all_hw_features(struct xgbe_prv_data *pdata) · 359 unmodified lines | ||
| 360 | 360 | |
| 361 | 361 | memset(hw_feat, 0, sizeof(*hw_feat)); |
| 362 | 362 | |
| 363 | + hw_feat->version = XGMAC_IOREAD(pdata, MAC_VR); | |
| 364 | + | |
| 363 | 365 | /* Hardware feature register 0 */ |
| 364 | 366 | hw_feat->gmii = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, GMIISEL); |
| 365 | 367 | hw_feat->vlhash = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, VLHASH); |
| @@ -361,15 +361,16 @@ static void xgbe_get_drvinfo(struct net_device *netdev, · 360 unmodified lines | ||
| 361 | 361 | struct ethtool_drvinfo *drvinfo) |
| 362 | 362 | { |
| 363 | 363 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
| 364 | + struct xgbe_hw_features *hw_feat = &pdata->hw_feat; | |
| 364 | 365 | |
| 365 | 366 | strlcpy(drvinfo->driver, XGBE_DRV_NAME, sizeof(drvinfo->driver)); |
| 366 | 367 | strlcpy(drvinfo->version, XGBE_DRV_VERSION, sizeof(drvinfo->version)); |
| 367 | 368 | strlcpy(drvinfo->bus_info, dev_name(pdata->dev), |
| 368 | 369 | sizeof(drvinfo->bus_info)); |
| 369 | 370 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d", |
| 370 | − XGMAC_IOREAD_BITS(pdata, MAC_VR, USERVER), | |
| 371 | − XGMAC_IOREAD_BITS(pdata, MAC_VR, DEVID), | |
| 372 | − XGMAC_IOREAD_BITS(pdata, MAC_VR, SNPSVER)); | |
| 371 | + XGMAC_GET_BITS(hw_feat->version, MAC_VR, USERVER), | |
| 372 | + XGMAC_GET_BITS(hw_feat->version, MAC_VR, DEVID), | |
| 373 | + XGMAC_GET_BITS(hw_feat->version, MAC_VR, SNPSVER)); | |
| 373 | 374 | drvinfo->n_stats = XGBE_STATS_COUNT; |
| 374 | 375 | } |
| 375 | 376 | |
| @@ -171,7 +171,7 @@ static struct xgbe_channel *xgbe_alloc_rings(struct xgbe_prv_data *pdata) · 170 unmodified lines | ||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if (i < pdata->rx_ring_count) { |
| 174 | − spin_lock_init(&tx_ring->lock); | |
| 174 | + spin_lock_init(&rx_ring->lock); | |
| 175 | 175 | channel->rx_ring = rx_ring++; |
| 176 | 176 | } |
| 177 | 177 | |
| @@ -182,6 +182,7 @@ · 181 unmodified lines | ||
| 182 | 182 | #define XGMAC_DRIVER_CONTEXT 1 |
| 183 | 183 | #define XGMAC_IOCTL_CONTEXT 2 |
| 184 | 184 | |
| 185 | +#define XGBE_FIFO_MAX 81920 | |
| 185 | 186 | #define XGBE_FIFO_SIZE_B(x) (x) |
| 186 | 187 | #define XGBE_FIFO_SIZE_KB(x) (x * 1024) |
| 187 | 188 | |
| @@ -524,6 +525,9 @@ struct xgbe_desc_if { · 336 unmodified lines | ||
| 524 | 525 | * or configurations are present in the device. |
| 525 | 526 | */ |
| 526 | 527 | struct xgbe_hw_features { |
| 528 | + /* HW Version */ | |
| 529 | + unsigned int version; | |
| 530 | + | |
| 527 | 531 | /* HW Feature Register0 */ |
| 528 | 532 | unsigned int gmii; /* 1000 Mbps support */ |
| 529 | 533 | unsigned int vlhash; /* VLAN Hash Filter */ |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | config NET_XGENE |
| 2 | 2 | tristate "APM X-Gene SoC Ethernet Driver" |
| 3 | + depends on HAS_DMA | |
| 3 | 4 | select PHYLIB |
| 4 | 5 | help |
| 5 | 6 | This is the Ethernet driver for the on-chip ethernet interface on the |
| @@ -84,7 +84,7 @@ config BNX2 · 83 unmodified lines | ||
| 84 | 84 | |
| 85 | 85 | config CNIC |
| 86 | 86 | tristate "QLogic CNIC support" |
| 87 | − depends on PCI | |
| 87 | + depends on PCI && (IPV6 || IPV6=n) | |
| 88 | 88 | select BNX2 |
| 89 | 89 | select UIO |
| 90 | 90 | ---help--- |
| @@ -2233,7 +2233,12 @@ struct shmem2_region { · 2232 unmodified lines | ||
| 2233 | 2233 | u32 reserved3; /* Offset 0x14C */ |
| 2234 | 2234 | u32 reserved4; /* Offset 0x150 */ |
| 2235 | 2235 | u32 link_attr_sync[PORT_MAX]; /* Offset 0x154 */ |
| 2236 | − #define LINK_ATTR_SYNC_KR2_ENABLE (1<<0) | |
| 2236 | + #define LINK_ATTR_SYNC_KR2_ENABLE 0x00000001 | |
| 2237 | + #define LINK_SFP_EEPROM_COMP_CODE_MASK 0x0000ff00 | |
| 2238 | + #define LINK_SFP_EEPROM_COMP_CODE_SHIFT 8 | |
| 2239 | + #define LINK_SFP_EEPROM_COMP_CODE_SR 0x00001000 | |
| 2240 | + #define LINK_SFP_EEPROM_COMP_CODE_LR 0x00002000 | |
| 2241 | + #define LINK_SFP_EEPROM_COMP_CODE_LRM 0x00004000 | |
| 2237 | 2242 | |
| 2238 | 2243 | u32 reserved5[2]; |
| 2239 | 2244 | u32 reserved6[PORT_MAX]; |
| @@ -154,15 +154,22 @@ typedef int (*read_sfp_module_eeprom_func_p)(struct bnx2x_phy *phy, · 153 unmodified lines | ||
| 154 | 154 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE) |
| 155 | 155 | |
| 156 | 156 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 |
| 157 | + #define SFP_EEPROM_CON_TYPE_VAL_UNKNOWN 0x0 | |
| 157 | 158 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 |
| 158 | 159 | #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21 |
| 159 | 160 | #define SFP_EEPROM_CON_TYPE_VAL_RJ45 0x22 |
| 160 | 161 | |
| 161 | 162 | |
| 162 | −#define SFP_EEPROM_COMP_CODE_ADDR 0x3 | |
| 163 | − #define SFP_EEPROM_COMP_CODE_SR_MASK (1<<4) | |
| 164 | − #define SFP_EEPROM_COMP_CODE_LR_MASK (1<<5) | |
| 165 | − #define SFP_EEPROM_COMP_CODE_LRM_MASK (1<<6) | |
| 163 | +#define SFP_EEPROM_10G_COMP_CODE_ADDR 0x3 | |
| 164 | + #define SFP_EEPROM_10G_COMP_CODE_SR_MASK (1<<4) | |
| 165 | + #define SFP_EEPROM_10G_COMP_CODE_LR_MASK (1<<5) | |
| 166 | + #define SFP_EEPROM_10G_COMP_CODE_LRM_MASK (1<<6) | |
| 167 | + | |
| 168 | +#define SFP_EEPROM_1G_COMP_CODE_ADDR 0x6 | |
| 169 | + #define SFP_EEPROM_1G_COMP_CODE_SX (1<<0) | |
| 170 | + #define SFP_EEPROM_1G_COMP_CODE_LX (1<<1) | |
| 171 | + #define SFP_EEPROM_1G_COMP_CODE_CX (1<<2) | |
| 172 | + #define SFP_EEPROM_1G_COMP_CODE_BASE_T (1<<3) | |
| 166 | 173 | |
| 167 | 174 | #define SFP_EEPROM_FC_TX_TECH_ADDR 0x8 |
| 168 | 175 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE 0x4 |
| @@ -3633,8 +3640,8 @@ static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy, · 3464 unmodified lines | ||
| 3633 | 3640 | reg_set[i].val); |
| 3634 | 3641 | |
| 3635 | 3642 | /* Start KR2 work-around timer which handles BCM8073 link-parner */ |
| 3636 | − vars->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; | |
| 3637 | − bnx2x_update_link_attr(params, vars->link_attr_sync); | |
| 3643 | + params->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; | |
| 3644 | + bnx2x_update_link_attr(params, params->link_attr_sync); | |
| 3638 | 3645 | } |
| 3639 | 3646 | |
| 3640 | 3647 | static void bnx2x_disable_kr2(struct link_params *params, |
| @@ -3666,8 +3673,8 @@ static void bnx2x_disable_kr2(struct link_params *params, · 25 unmodified lines | ||
| 3666 | 3673 | for (i = 0; i < ARRAY_SIZE(reg_set); i++) |
| 3667 | 3674 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
| 3668 | 3675 | reg_set[i].val); |
| 3669 | − vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; | |
| 3670 | − bnx2x_update_link_attr(params, vars->link_attr_sync); | |
| 3676 | + params->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; | |
| 3677 | + bnx2x_update_link_attr(params, params->link_attr_sync); | |
| 3671 | 3678 | |
| 3672 | 3679 | vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; |
| 3673 | 3680 | } |
| @@ -4810,7 +4817,7 @@ void bnx2x_link_status_update(struct link_params *params, · 1136 unmodified lines | ||
| 4810 | 4817 | ~FEATURE_CONFIG_PFC_ENABLED; |
| 4811 | 4818 | |
| 4812 | 4819 | if (SHMEM2_HAS(bp, link_attr_sync)) |
| 4813 | − vars->link_attr_sync = SHMEM2_RD(bp, | |
| 4820 | + params->link_attr_sync = SHMEM2_RD(bp, | |
| 4814 | 4821 | link_attr_sync[params->port]); |
| 4815 | 4822 | |
| 4816 | 4823 | DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", |
| @@ -8057,21 +8064,24 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, · 3240 unmodified lines | ||
| 8057 | 8064 | { |
| 8058 | 8065 | struct bnx2x *bp = params->bp; |
| 8059 | 8066 | u32 sync_offset = 0, phy_idx, media_types; |
| 8060 | − u8 gport, val[2], check_limiting_mode = 0; | |
| 8067 | + u8 val[SFP_EEPROM_FC_TX_TECH_ADDR + 1], check_limiting_mode = 0; | |
| 8061 | 8068 | *edc_mode = EDC_MODE_LIMITING; |
| 8062 | 8069 | phy->media_type = ETH_PHY_UNSPECIFIED; |
| 8063 | 8070 | /* First check for copper cable */ |
| 8064 | 8071 | if (bnx2x_read_sfp_module_eeprom(phy, |
| 8065 | 8072 | params, |
| 8066 | 8073 | I2C_DEV_ADDR_A0, |
| 8067 | − SFP_EEPROM_CON_TYPE_ADDR, | |
| 8068 | − 2, | |
| 8074 | + 0, | |
| 8075 | + SFP_EEPROM_FC_TX_TECH_ADDR + 1, | |
| 8069 | 8076 | (u8 *)val) != 0) { |
| 8070 | 8077 | DP(NETIF_MSG_LINK, "Failed to read from SFP+ module EEPROM\n"); |
| 8071 | 8078 | return -EINVAL; |
| 8072 | 8079 | } |
| 8073 | − | |
| 8074 | − switch (val[0]) { | |
| 8080 | + params->link_attr_sync &= ~LINK_SFP_EEPROM_COMP_CODE_MASK; | |
| 8081 | + params->link_attr_sync |= val[SFP_EEPROM_10G_COMP_CODE_ADDR] << | |
| 8082 | + LINK_SFP_EEPROM_COMP_CODE_SHIFT; | |
| 8083 | + bnx2x_update_link_attr(params, params->link_attr_sync); | |
| 8084 | + switch (val[SFP_EEPROM_CON_TYPE_ADDR]) { | |
| 8075 | 8085 | case SFP_EEPROM_CON_TYPE_VAL_COPPER: |
| 8076 | 8086 | { |
| 8077 | 8087 | u8 copper_module_type; |
| @@ -8079,17 +8089,7 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, · 1 unmodified line | ||
| 8079 | 8089 | /* Check if its active cable (includes SFP+ module) |
| 8080 | 8090 | * of passive cable |
| 8081 | 8091 | */ |
| 8082 | − if (bnx2x_read_sfp_module_eeprom(phy, | |
| 8083 | − params, | |
| 8084 | − I2C_DEV_ADDR_A0, | |
| 8085 | − SFP_EEPROM_FC_TX_TECH_ADDR, | |
| 8086 | − 1, | |
| 8087 | − &copper_module_type) != 0) { | |
| 8088 | − DP(NETIF_MSG_LINK, | |
| 8089 | − "Failed to read copper-cable-type" | |
| 8090 | − " from SFP+ EEPROM\n"); | |
| 8091 | − return -EINVAL; | |
| 8092 | − } | |
| 8092 | + copper_module_type = val[SFP_EEPROM_FC_TX_TECH_ADDR]; | |
| 8093 | 8093 | |
| 8094 | 8094 | if (copper_module_type & |
| 8095 | 8095 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE) { |
| @@ -8115,16 +8115,18 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, · 19 unmodified lines | ||
| 8115 | 8115 | } |
| 8116 | 8116 | break; |
| 8117 | 8117 | } |
| 8118 | + case SFP_EEPROM_CON_TYPE_VAL_UNKNOWN: | |
| 8118 | 8119 | case SFP_EEPROM_CON_TYPE_VAL_LC: |
| 8119 | 8120 | case SFP_EEPROM_CON_TYPE_VAL_RJ45: |
| 8120 | 8121 | check_limiting_mode = 1; |
| 8121 | − if ((val[1] & (SFP_EEPROM_COMP_CODE_SR_MASK | | |
| 8122 | − SFP_EEPROM_COMP_CODE_LR_MASK | | |
| 8123 | − SFP_EEPROM_COMP_CODE_LRM_MASK)) == 0) { | |
| 8122 | + if ((val[SFP_EEPROM_10G_COMP_CODE_ADDR] & | |
| 8123 | + (SFP_EEPROM_10G_COMP_CODE_SR_MASK | | |
| 8124 | + SFP_EEPROM_10G_COMP_CODE_LR_MASK | | |
| 8125 | + SFP_EEPROM_10G_COMP_CODE_LRM_MASK)) == 0) { | |
| 8124 | 8126 | DP(NETIF_MSG_LINK, "1G SFP module detected\n"); |
| 8125 | − gport = params->port; | |
| 8126 | 8127 | phy->media_type = ETH_PHY_SFP_1G_FIBER; |
| 8127 | 8128 | if (phy->req_line_speed != SPEED_1000) { |
| 8129 | + u8 gport = params->port; | |
| 8128 | 8130 | phy->req_line_speed = SPEED_1000; |
| 8129 | 8131 | if (!CHIP_IS_E1x(bp)) { |
| 8130 | 8132 | gport = BP_PATH(bp) + |
| @@ -8134,6 +8136,12 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, · 3 unmodified lines | ||
| 8134 | 8136 | "Warning: Link speed was forced to 1000Mbps. Current SFP module in port %d is not compliant with 10G Ethernet\n", |
| 8135 | 8137 | gport); |
| 8136 | 8138 | } |
| 8139 | + if (val[SFP_EEPROM_1G_COMP_CODE_ADDR] & | |
| 8140 | + SFP_EEPROM_1G_COMP_CODE_BASE_T) { | |
| 8141 | + bnx2x_sfp_set_transmitter(params, phy, 0); | |
| 8142 | + msleep(40); | |
| 8143 | + bnx2x_sfp_set_transmitter(params, phy, 1); | |
| 8144 | + } | |
| 8137 | 8145 | } else { |
| 8138 | 8146 | int idx, cfg_idx = 0; |
| 8139 | 8147 | DP(NETIF_MSG_LINK, "10G Optic module detected\n"); |
| @@ -8149,7 +8157,7 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, · 9 unmodified lines | ||
| 8149 | 8157 | break; |
| 8150 | 8158 | default: |
| 8151 | 8159 | DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n", |
| 8152 | − val[0]); | |
| 8160 | + val[SFP_EEPROM_CON_TYPE_ADDR]); | |
| 8153 | 8161 | return -EINVAL; |
| 8154 | 8162 | } |
| 8155 | 8163 | sync_offset = params->shmem_base + |
| @@ -13507,7 +13515,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, · 5351 unmodified lines | ||
| 13507 | 13515 | |
| 13508 | 13516 | sigdet = bnx2x_warpcore_get_sigdet(phy, params); |
| 13509 | 13517 | if (!sigdet) { |
| 13510 | − if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | |
| 13518 | + if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | |
| 13511 | 13519 | bnx2x_kr2_recovery(params, vars, phy); |
| 13512 | 13520 | DP(NETIF_MSG_LINK, "No sigdet\n"); |
| 13513 | 13521 | } |
| @@ -13525,7 +13533,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, · 11 unmodified lines | ||
| 13525 | 13533 | |
| 13526 | 13534 | /* CL73 has not begun yet */ |
| 13527 | 13535 | if (base_page == 0) { |
| 13528 | − if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | |
| 13536 | + if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | |
| 13529 | 13537 | bnx2x_kr2_recovery(params, vars, phy); |
| 13530 | 13538 | DP(NETIF_MSG_LINK, "No BP\n"); |
| 13531 | 13539 | } |
| @@ -13541,7 +13549,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, · 9 unmodified lines | ||
| 13541 | 13549 | ((next_page & 0xe0) == 0x20)))); |
| 13542 | 13550 | |
| 13543 | 13551 | /* In case KR2 is already disabled, check if we need to re-enable it */ |
| 13544 | − if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | |
| 13552 | + if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | |
| 13545 | 13553 | if (!not_kr2_device) { |
| 13546 | 13554 | DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, |
| 13547 | 13555 | next_page); |
| @@ -323,6 +323,9 @@ struct link_params { · 322 unmodified lines | ||
| 323 | 323 | #define LINK_FLAGS_INT_DISABLED (1<<0) |
| 324 | 324 | #define PHY_INITIALIZED (1<<1) |
| 325 | 325 | u32 lfa_base; |
| 326 | + | |
| 327 | + /* The same definitions as the shmem2 parameter */ | |
| 328 | + u32 link_attr_sync; | |
| 326 | 329 | }; |
| 327 | 330 | |
| 328 | 331 | /* Output parameters */ |
| @@ -364,8 +367,6 @@ struct link_vars { · 35 unmodified lines | ||
| 364 | 367 | u8 rx_tx_asic_rst; |
| 365 | 368 | u8 turn_to_run_wc_rt; |
| 366 | 369 | u16 rsrv2; |
| 367 | − /* The same definitions as the shmem2 parameter */ | |
| 368 | − u32 link_attr_sync; | |
| 369 | 370 | }; |
| 370 | 371 | |
| 371 | 372 | /***********************************************************/ |
| @@ -6868,6 +6868,37 @@ static void bnx2x__common_init_phy(struct bnx2x *bp) · 6867 unmodified lines | ||
| 6868 | 6868 | bnx2x_release_phy_lock(bp); |
| 6869 | 6869 | } |
| 6870 | 6870 | |
| 6871 | +static void bnx2x_config_endianity(struct bnx2x *bp, u32 val) | |
| 6872 | +{ | |
| 6873 | + REG_WR(bp, PXP2_REG_RQ_QM_ENDIAN_M, val); | |
| 6874 | + REG_WR(bp, PXP2_REG_RQ_TM_ENDIAN_M, val); | |
| 6875 | + REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, val); | |
| 6876 | + REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, val); | |
| 6877 | + REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, val); | |
| 6878 | + | |
| 6879 | + /* make sure this value is 0 */ | |
| 6880 | + REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 0); | |
| 6881 | + | |
| 6882 | + REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, val); | |
| 6883 | + REG_WR(bp, PXP2_REG_RD_TM_SWAP_MODE, val); | |
| 6884 | + REG_WR(bp, PXP2_REG_RD_SRC_SWAP_MODE, val); | |
| 6885 | + REG_WR(bp, PXP2_REG_RD_CDURD_SWAP_MODE, val); | |
| 6886 | +} | |
| 6887 | + | |
| 6888 | +static void bnx2x_set_endianity(struct bnx2x *bp) | |
| 6889 | +{ | |
| 6890 | +#ifdef __BIG_ENDIAN | |
| 6891 | + bnx2x_config_endianity(bp, 1); | |
| 6892 | +#else | |
| 6893 | + bnx2x_config_endianity(bp, 0); | |
| 6894 | +#endif | |
| 6895 | +} | |
| 6896 | + | |
| 6897 | +static void bnx2x_reset_endianity(struct bnx2x *bp) | |
| 6898 | +{ | |
| 6899 | + bnx2x_config_endianity(bp, 0); | |
| 6900 | +} | |
| 6901 | + | |
| 6871 | 6902 | /** |
| 6872 | 6903 | * bnx2x_init_hw_common - initialize the HW at the COMMON phase. |
| 6873 | 6904 | * |
| @@ -6934,23 +6965,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) · 60 unmodified lines | ||
| 6934 | 6965 | |
| 6935 | 6966 | bnx2x_init_block(bp, BLOCK_PXP2, PHASE_COMMON); |
| 6936 | 6967 | bnx2x_init_pxp(bp); |
| 6937 | − | |
| 6938 | −#ifdef __BIG_ENDIAN | |
| 6939 | − REG_WR(bp, PXP2_REG_RQ_QM_ENDIAN_M, 1); | |
| 6940 | − REG_WR(bp, PXP2_REG_RQ_TM_ENDIAN_M, 1); | |
| 6941 | − REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); | |
| 6942 | − REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); | |
| 6943 | − REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); | |
| 6944 | − /* make sure this value is 0 */ | |
| 6945 | − REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 0); | |
| 6946 | − | |
| 6947 | −/* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ | |
| 6948 | − REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); | |
| 6949 | − REG_WR(bp, PXP2_REG_RD_TM_SWAP_MODE, 1); | |
| 6950 | − REG_WR(bp, PXP2_REG_RD_SRC_SWAP_MODE, 1); | |
| 6951 | − REG_WR(bp, PXP2_REG_RD_CDURD_SWAP_MODE, 1); | |
| 6952 | −#endif | |
| 6953 | − | |
| 6968 | + bnx2x_set_endianity(bp); | |
| 6954 | 6969 | bnx2x_ilt_init_page_size(bp, INITOP_SET); |
| 6955 | 6970 | |
| 6956 | 6971 | if (CHIP_REV_IS_FPGA(bp) && CHIP_IS_E1H(bp)) |
| @@ -13440,9 +13455,15 @@ static void __bnx2x_remove(struct pci_dev *pdev, · 6483 unmodified lines | ||
| 13440 | 13455 | bnx2x_iov_remove_one(bp); |
| 13441 | 13456 | |
| 13442 | 13457 | /* Power on: we can't let PCI layer write to us while we are in D3 */ |
| 13443 | − if (IS_PF(bp)) | |
| 13458 | + if (IS_PF(bp)) { | |
| 13444 | 13459 | bnx2x_set_power_state(bp, PCI_D0); |
| 13445 | 13460 | |
| 13461 | + /* Set endianity registers to reset values in case next driver | |
| 13462 | + * boots in different endianty environment. | |
| 13463 | + */ | |
| 13464 | + bnx2x_reset_endianity(bp); | |
| 13465 | + } | |
| 13466 | + | |
| 13446 | 13467 | /* Disable MSI/MSI-X */ |
| 13447 | 13468 | bnx2x_disable_msi(bp); |
| 13448 | 13469 | |
| @@ -31,7 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <linux/if_vlan.h> |
| 32 | 32 | #include <linux/prefetch.h> |
| 33 | 33 | #include <linux/random.h> |
| 34 | −#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | |
| 34 | +#if IS_ENABLED(CONFIG_VLAN_8021Q) | |
| 35 | 35 | #define BCM_VLAN 1 |
| 36 | 36 | #endif |
| 37 | 37 | #include <net/ip.h> |
| @@ -3685,7 +3685,7 @@ static int cnic_get_v4_route(struct sockaddr_in *dst_addr, · 3647 unmodified lines | ||
| 3685 | 3685 | static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr, |
| 3686 | 3686 | struct dst_entry **dst) |
| 3687 | 3687 | { |
| 3688 | −#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE)) | |
| 3688 | +#if IS_ENABLED(CONFIG_IPV6) | |
| 3689 | 3689 | struct flowi6 fl6; |
| 3690 | 3690 | |
| 3691 | 3691 | memset(&fl6, 0, sizeof(fl6)); |
| @@ -11617,6 +11617,12 @@ static int tg3_open(struct net_device *dev) · 11616 unmodified lines | ||
| 11617 | 11617 | struct tg3 *tp = netdev_priv(dev); |
| 11618 | 11618 | int err; |
| 11619 | 11619 | |
| 11620 | + if (tp->pcierr_recovery) { | |
| 11621 | + netdev_err(dev, "Failed to open device. PCI error recovery " | |
| 11622 | + "in progress\n"); | |
| 11623 | + return -EAGAIN; | |
| 11624 | + } | |
| 11625 | + | |
| 11620 | 11626 | if (tp->fw_needed) { |
| 11621 | 11627 | err = tg3_request_firmware(tp); |
| 11622 | 11628 | if (tg3_asic_rev(tp) == ASIC_REV_57766) { |
| @@ -11674,6 +11680,12 @@ static int tg3_close(struct net_device *dev) · 51 unmodified lines | ||
| 11674 | 11680 | { |
| 11675 | 11681 | struct tg3 *tp = netdev_priv(dev); |
| 11676 | 11682 | |
| 11683 | + if (tp->pcierr_recovery) { | |
| 11684 | + netdev_err(dev, "Failed to close device. PCI error recovery " | |
| 11685 | + "in progress\n"); | |
| 11686 | + return -EAGAIN; | |
| 11687 | + } | |
| 11688 | + | |
| 11677 | 11689 | tg3_ptp_fini(tp); |
| 11678 | 11690 | |
| 11679 | 11691 | tg3_stop(tp); |
| @@ -17561,6 +17573,7 @@ static int tg3_init_one(struct pci_dev *pdev, · 5881 unmodified lines | ||
| 17561 | 17573 | tp->rx_mode = TG3_DEF_RX_MODE; |
| 17562 | 17574 | tp->tx_mode = TG3_DEF_TX_MODE; |
| 17563 | 17575 | tp->irq_sync = 1; |
| 17576 | + tp->pcierr_recovery = false; | |
| 17564 | 17577 | |
| 17565 | 17578 | if (tg3_debug > 0) |
| 17566 | 17579 | tp->msg_enable = tg3_debug; |
| @@ -18071,6 +18084,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, · 504 unmodified lines | ||
| 18071 | 18084 | |
| 18072 | 18085 | rtnl_lock(); |
| 18073 | 18086 | |
| 18087 | + tp->pcierr_recovery = true; | |
| 18088 | + | |
| 18074 | 18089 | /* We probably don't have netdev yet */ |
| 18075 | 18090 | if (!netdev || !netif_running(netdev)) |
| 18076 | 18091 | goto done; |
| @@ -18195,6 +18210,7 @@ static void tg3_io_resume(struct pci_dev *pdev) · 118 unmodified lines | ||
| 18195 | 18210 | tg3_phy_start(tp); |
| 18196 | 18211 | |
| 18197 | 18212 | done: |
| 18213 | + tp->pcierr_recovery = false; | |
| 18198 | 18214 | rtnl_unlock(); |
| 18199 | 18215 | } |
| 18200 | 18216 | |
| @@ -3407,6 +3407,7 @@ struct tg3 { · 3406 unmodified lines | ||
| 3407 | 3407 | |
| 3408 | 3408 | struct device *hwmon_dev; |
| 3409 | 3409 | bool link_up; |
| 3410 | + bool pcierr_recovery; | |
| 3410 | 3411 | }; |
| 3411 | 3412 | |
| 3412 | 3413 | /* Accessor macros for chip and asic attributes |
| @@ -2506,7 +2506,7 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb) · 2505 unmodified lines | ||
| 2506 | 2506 | * For TSO, the TCP checksum field is seeded with pseudo-header sum |
| 2507 | 2507 | * excluding the length field. |
| 2508 | 2508 | */ |
| 2509 | − if (skb->protocol == htons(ETH_P_IP)) { | |
| 2509 | + if (vlan_get_protocol(skb) == htons(ETH_P_IP)) { | |
| 2510 | 2510 | struct iphdr *iph = ip_hdr(skb); |
| 2511 | 2511 | |
| 2512 | 2512 | /* Do we really need these? */ |
| @@ -2870,12 +2870,13 @@ bnad_txq_wi_prepare(struct bnad *bnad, struct bna_tcb *tcb, · 357 unmodified lines | ||
| 2870 | 2870 | } |
| 2871 | 2871 | |
| 2872 | 2872 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
| 2873 | + __be16 net_proto = vlan_get_protocol(skb); | |
| 2873 | 2874 | u8 proto = 0; |
| 2874 | 2875 | |
| 2875 | − if (skb->protocol == htons(ETH_P_IP)) | |
| 2876 | + if (net_proto == htons(ETH_P_IP)) | |
| 2876 | 2877 | proto = ip_hdr(skb)->protocol; |
| 2877 | 2878 | #ifdef NETIF_F_IPV6_CSUM |
| 2878 | − else if (skb->protocol == htons(ETH_P_IPV6)) { | |
| 2879 | + else if (net_proto == htons(ETH_P_IPV6)) { | |
| 2879 | 2880 | /* nexthdr may not be TCP immediately. */ |
| 2880 | 2881 | proto = ipv6_hdr(skb)->nexthdr; |
| 2881 | 2882 | } |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | config NET_CALXEDA_XGMAC |
| 2 | 2 | tristate "Calxeda 1G/10G XGMAC Ethernet driver" |
| 3 | 3 | depends on HAS_IOMEM && HAS_DMA |
| 4 | + depends on ARCH_HIGHBANK || COMPILE_TEST | |
| 4 | 5 | select CRC32 |
| 5 | 6 | help |
| 6 | 7 | This is the driver for the XGMAC Ethernet IP block found on Calxeda |
| @@ -1253,7 +1253,9 @@ freeout: t4_free_sge_resources(adap); · 1252 unmodified lines | ||
| 1253 | 1253 | goto freeout; |
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | − t4_write_reg(adap, MPS_TRC_RSS_CONTROL, | |
| 1256 | + t4_write_reg(adap, is_t4(adap->params.chip) ? | |
| 1257 | + MPS_TRC_RSS_CONTROL : | |
| 1258 | + MPS_T5_TRC_RSS_CONTROL, | |
| 1257 | 1259 | RSSCONTROL(netdev2pinfo(adap->port[0])->tx_chan) | |
| 1258 | 1260 | QUEUENUMBER(s->ethrxq[0].rspq.abs_id)); |
| 1259 | 1261 | return 0; |
| @@ -1761,7 +1763,8 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs, · 501 unmodified lines | ||
| 1761 | 1763 | 0xd004, 0xd03c, |
| 1762 | 1764 | 0xdfc0, 0xdfe0, |
| 1763 | 1765 | 0xe000, 0xea7c, |
| 1764 | − 0xf000, 0x11190, | |
| 1766 | + 0xf000, 0x11110, | |
| 1767 | + 0x11118, 0x11190, | |
| 1765 | 1768 | 0x19040, 0x1906c, |
| 1766 | 1769 | 0x19078, 0x19080, |
| 1767 | 1770 | 0x1908c, 0x19124, |
| @@ -1968,7 +1971,8 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs, · 200 unmodified lines | ||
| 1968 | 1971 | 0xd004, 0xd03c, |
| 1969 | 1972 | 0xdfc0, 0xdfe0, |
| 1970 | 1973 | 0xe000, 0x11088, |
| 1971 | − 0x1109c, 0x1117c, | |
| 1974 | + 0x1109c, 0x11110, | |
| 1975 | + 0x11118, 0x1117c, | |
| 1972 | 1976 | 0x11190, 0x11204, |
| 1973 | 1977 | 0x19040, 0x1906c, |
| 1974 | 1978 | 0x19078, 0x19080, |
| @@ -5955,7 +5959,8 @@ static int adap_init0(struct adapter *adap) · 3980 unmodified lines | ||
| 5955 | 5959 | params[3] = FW_PARAM_PFVF(CQ_END); |
| 5956 | 5960 | params[4] = FW_PARAM_PFVF(OCQ_START); |
| 5957 | 5961 | params[5] = FW_PARAM_PFVF(OCQ_END); |
| 5958 | − ret = t4_query_params(adap, 0, 0, 0, 6, params, val); | |
| 5962 | + ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6, params, | |
| 5963 | + val); | |
| 5959 | 5964 | if (ret < 0) |
| 5960 | 5965 | goto bye; |
| 5961 | 5966 | adap->vres.qp.start = val[0]; |
| @@ -5967,7 +5972,8 @@ static int adap_init0(struct adapter *adap) · 5 unmodified lines | ||
| 5967 | 5972 | |
| 5968 | 5973 | params[0] = FW_PARAM_DEV(MAXORDIRD_QP); |
| 5969 | 5974 | params[1] = FW_PARAM_DEV(MAXIRD_ADAPTER); |
| 5970 | − ret = t4_query_params(adap, 0, 0, 0, 2, params, val); | |
| 5975 | + ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, | |
| 5976 | + val); | |
| 5971 | 5977 | if (ret < 0) { |
| 5972 | 5978 | adap->params.max_ordird_qp = 8; |
| 5973 | 5979 | adap->params.max_ird_adapter = 32 * adap->tids.ntids; |
| @@ -167,6 +167,34 @@ void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val) · 166 unmodified lines | ||
| 167 | 167 | t4_write_reg(adap, PCIE_CFG_SPACE_REQ, 0); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | +/* | |
| 171 | + * t4_report_fw_error - report firmware error | |
| 172 | + * @adap: the adapter | |
| 173 | + * | |
| 174 | + * The adapter firmware can indicate error conditions to the host. | |
| 175 | + * If the firmware has indicated an error, print out the reason for | |
| 176 | + * the firmware error. | |
| 177 | + */ | |
| 178 | +static void t4_report_fw_error(struct adapter *adap) | |
| 179 | +{ | |
| 180 | + static const char *const reason[] = { | |
| 181 | + "Crash", /* PCIE_FW_EVAL_CRASH */ | |
| 182 | + "During Device Preparation", /* PCIE_FW_EVAL_PREP */ | |
| 183 | + "During Device Configuration", /* PCIE_FW_EVAL_CONF */ | |
| 184 | + "During Device Initialization", /* PCIE_FW_EVAL_INIT */ | |
| 185 | + "Unexpected Event", /* PCIE_FW_EVAL_UNEXPECTEDEVENT */ | |
| 186 | + "Insufficient Airflow", /* PCIE_FW_EVAL_OVERHEAT */ | |
| 187 | + "Device Shutdown", /* PCIE_FW_EVAL_DEVICESHUTDOWN */ | |
| 188 | + "Reserved", /* reserved */ | |
| 189 | + }; | |
| 190 | + u32 pcie_fw; | |
| 191 | + | |
| 192 | + pcie_fw = t4_read_reg(adap, MA_PCIE_FW); | |
| 193 | + if (pcie_fw & FW_PCIE_FW_ERR) | |
| 194 | + dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n", | |
| 195 | + reason[FW_PCIE_FW_EVAL_GET(pcie_fw)]); | |
| 196 | +} | |
| 197 | + | |
| 170 | 198 | /* |
| 171 | 199 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. |
| 172 | 200 | */ |
| @@ -300,6 +328,7 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, · 127 unmodified lines | ||
| 300 | 328 | dump_mbox(adap, mbox, data_reg); |
| 301 | 329 | dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n", |
| 302 | 330 | *(const u8 *)cmd, mbox); |
| 331 | + t4_report_fw_error(adap); | |
| 303 | 332 | return -ETIMEDOUT; |
| 304 | 333 | } |
| 305 | 334 | |
| @@ -566,6 +595,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, · 260 unmodified lines | ||
| 566 | 595 | #define VPD_BASE 0x400 |
| 567 | 596 | #define VPD_BASE_OLD 0 |
| 568 | 597 | #define VPD_LEN 1024 |
| 598 | +#define CHELSIO_VPD_UNIQUE_ID 0x82 | |
| 569 | 599 | |
| 570 | 600 | /** |
| 571 | 601 | * t4_seeprom_wp - enable/disable EEPROM write protection |
| @@ -603,7 +633,14 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) · 31 unmodified lines | ||
| 603 | 633 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); |
| 604 | 634 | if (ret < 0) |
| 605 | 635 | goto out; |
| 606 | − addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD; | |
| 636 | + | |
| 637 | + /* The VPD shall have a unique identifier specified by the PCI SIG. | |
| 638 | + * For chelsio adapters, the identifier is 0x82. The first byte of a VPD | |
| 639 | + * shall be CHELSIO_VPD_UNIQUE_ID (0x82). The VPD programming software | |
| 640 | + * is expected to automatically put this entry at the | |
| 641 | + * beginning of the VPD. | |
| 642 | + */ | |
| 643 | + addr = *vpd == CHELSIO_VPD_UNIQUE_ID ? VPD_BASE : VPD_BASE_OLD; | |
| 607 | 644 | |
| 608 | 645 | ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); |
| 609 | 646 | if (ret < 0) |
| @@ -667,6 +704,7 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) · 57 unmodified lines | ||
| 667 | 704 | i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE); |
| 668 | 705 | memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); |
| 669 | 706 | strim(p->sn); |
| 707 | + i = pci_vpd_info_field_size(vpd + pn - PCI_VPD_INFO_FLD_HDR_SIZE); | |
| 670 | 708 | memcpy(p->pn, vpd + pn, min(i, PN_LEN)); |
| 671 | 709 | strim(p->pn); |
| 672 | 710 | |
| @@ -1394,15 +1432,18 @@ static void pcie_intr_handler(struct adapter *adapter) · 721 unmodified lines | ||
| 1394 | 1432 | |
| 1395 | 1433 | int fat; |
| 1396 | 1434 | |
| 1397 | − fat = t4_handle_intr_status(adapter, | |
| 1398 | − PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, | |
| 1399 | − sysbus_intr_info) + | |
| 1400 | − t4_handle_intr_status(adapter, | |
| 1401 | − PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, | |
| 1402 | − pcie_port_intr_info) + | |
| 1403 | − t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | |
| 1404 | − is_t4(adapter->params.chip) ? | |
| 1405 | − pcie_intr_info : t5_pcie_intr_info); | |
| 1435 | + if (is_t4(adapter->params.chip)) | |
| 1436 | + fat = t4_handle_intr_status(adapter, | |
| 1437 | + PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, | |
| 1438 | + sysbus_intr_info) + | |
| 1439 | + t4_handle_intr_status(adapter, | |
| 1440 | + PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, | |
| 1441 | + pcie_port_intr_info) + | |
| 1442 | + t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | |
| 1443 | + pcie_intr_info); | |
| 1444 | + else | |
| 1445 | + fat = t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | |
| 1446 | + t5_pcie_intr_info); | |
| 1406 | 1447 | |
| 1407 | 1448 | if (fat) |
| 1408 | 1449 | t4_fatal_err(adapter); |
| @@ -1521,6 +1562,9 @@ static void cim_intr_handler(struct adapter *adapter) · 112 unmodified lines | ||
| 1521 | 1562 | |
| 1522 | 1563 | int fat; |
| 1523 | 1564 | |
| 1565 | + if (t4_read_reg(adapter, MA_PCIE_FW) & FW_PCIE_FW_ERR) | |
| 1566 | + t4_report_fw_error(adapter); | |
| 1567 | + | |
| 1524 | 1568 | fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE, |
| 1525 | 1569 | cim_intr_info) + |
| 1526 | 1570 | t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE, |
| @@ -1768,10 +1812,16 @@ static void ma_intr_handler(struct adapter *adap) · 241 unmodified lines | ||
| 1768 | 1812 | { |
| 1769 | 1813 | u32 v, status = t4_read_reg(adap, MA_INT_CAUSE); |
| 1770 | 1814 | |
| 1771 | − if (status & MEM_PERR_INT_CAUSE) | |
| 1815 | + if (status & MEM_PERR_INT_CAUSE) { | |
| 1772 | 1816 | dev_alert(adap->pdev_dev, |
| 1773 | 1817 | "MA parity error, parity status %#x\n", |
| 1774 | 1818 | t4_read_reg(adap, MA_PARITY_ERROR_STATUS)); |
| 1819 | + if (is_t5(adap->params.chip)) | |
| 1820 | + dev_alert(adap->pdev_dev, | |
| 1821 | + "MA parity error, parity status %#x\n", | |
| 1822 | + t4_read_reg(adap, | |
| 1823 | + MA_PARITY_ERROR_STATUS2)); | |
| 1824 | + } | |
| 1775 | 1825 | if (status & MEM_WRAP_INT_CAUSE) { |
| 1776 | 1826 | v = t4_read_reg(adap, MA_INT_WRAP_STATUS); |
| 1777 | 1827 | dev_alert(adap->pdev_dev, "MA address wrap-around error by " |
| @@ -2733,12 +2783,16 @@ retry: · 955 unmodified lines | ||
| 2733 | 2783 | /* |
| 2734 | 2784 | * Issue the HELLO command to the firmware. If it's not successful |
| 2735 | 2785 | * but indicates that we got a "busy" or "timeout" condition, retry |
| 2736 | − * the HELLO until we exhaust our retry limit. | |
| 2786 | + * the HELLO until we exhaust our retry limit. If we do exceed our | |
| 2787 | + * retry limit, check to see if the firmware left us any error | |
| 2788 | + * information and report that if so. | |
| 2737 | 2789 | */ |
| 2738 | 2790 | ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); |
| 2739 | 2791 | if (ret < 0) { |
| 2740 | 2792 | if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0) |
| 2741 | 2793 | goto retry; |
| 2794 | + if (t4_read_reg(adap, MA_PCIE_FW) & FW_PCIE_FW_ERR) | |
| 2795 | + t4_report_fw_error(adap); | |
| 2742 | 2796 | return ret; |
| 2743 | 2797 | } |
| 2744 | 2798 | |
| @@ -3742,6 +3796,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) · 997 unmodified lines | ||
| 3742 | 3796 | lc->link_ok = link_ok; |
| 3743 | 3797 | lc->speed = speed; |
| 3744 | 3798 | lc->fc = fc; |
| 3799 | + lc->supported = be16_to_cpu(p->u.info.pcap); | |
| 3745 | 3800 | t4_os_link_changed(adap, port, link_ok); |
| 3746 | 3801 | } |
| 3747 | 3802 | if (mod != pi->mod_type) { |
| @@ -511,6 +511,7 @@ · 510 unmodified lines | ||
| 511 | 511 | #define MEM_WRAP_CLIENT_NUM_GET(x) (((x) & MEM_WRAP_CLIENT_NUM_MASK) >> MEM_WRAP_CLIENT_NUM_SHIFT) |
| 512 | 512 | #define MA_PCIE_FW 0x30b8 |
| 513 | 513 | #define MA_PARITY_ERROR_STATUS 0x77f4 |
| 514 | +#define MA_PARITY_ERROR_STATUS2 0x7804 | |
| 514 | 515 | |
| 515 | 516 | #define MA_EXT_MEMORY1_BAR 0x7808 |
| 516 | 517 | #define EDC_0_BASE_ADDR 0x7900 |
| @@ -959,6 +960,7 @@ · 442 unmodified lines | ||
| 959 | 960 | #define TRCMULTIFILTER 0x00000001U |
| 960 | 961 | |
| 961 | 962 | #define MPS_TRC_RSS_CONTROL 0x9808 |
| 963 | +#define MPS_T5_TRC_RSS_CONTROL 0xa00c | |
| 962 | 964 | #define RSSCONTROL_MASK 0x00ff0000U |
| 963 | 965 | #define RSSCONTROL_SHIFT 16 |
| 964 | 966 | #define RSSCONTROL(x) ((x) << RSSCONTROL_SHIFT) |
| @@ -2228,6 +2228,10 @@ struct fw_debug_cmd { · 2227 unmodified lines | ||
| 2228 | 2228 | #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT) |
| 2229 | 2229 | #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \ |
| 2230 | 2230 | FW_PCIE_FW_MASTER_MASK) |
| 2231 | +#define FW_PCIE_FW_EVAL_MASK 0x7 | |
| 2232 | +#define FW_PCIE_FW_EVAL_SHIFT 24 | |
| 2233 | +#define FW_PCIE_FW_EVAL_GET(x) (((x) >> FW_PCIE_FW_EVAL_SHIFT) & \ | |
| 2234 | + FW_PCIE_FW_EVAL_MASK) | |
| 2231 | 2235 | |
| 2232 | 2236 | struct fw_hdr { |
| 2233 | 2237 | u8 ver; |
| @@ -1994,7 +1994,7 @@ static void xmit_common(struct sk_buff *skb, struct ehea_swqe *swqe) · 1993 unmodified lines | ||
| 1994 | 1994 | { |
| 1995 | 1995 | swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT | EHEA_SWQE_CRC; |
| 1996 | 1996 | |
| 1997 | − if (skb->protocol != htons(ETH_P_IP)) | |
| 1997 | + if (vlan_get_protocol(skb) != htons(ETH_P_IP)) | |
| 1998 | 1998 | return; |
| 1999 | 1999 | |
| 2000 | 2000 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
| @@ -2674,7 +2674,8 @@ set_itr_now: · 2673 unmodified lines | ||
| 2674 | 2674 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
| 2675 | 2675 | |
| 2676 | 2676 | static int e1000_tso(struct e1000_adapter *adapter, |
| 2677 | − struct e1000_tx_ring *tx_ring, struct sk_buff *skb) | |
| 2677 | + struct e1000_tx_ring *tx_ring, struct sk_buff *skb, | |
| 2678 | + __be16 protocol) | |
| 2678 | 2679 | { |
| 2679 | 2680 | struct e1000_context_desc *context_desc; |
| 2680 | 2681 | struct e1000_buffer *buffer_info; |
| @@ -2692,7 +2693,7 @@ static int e1000_tso(struct e1000_adapter *adapter, · 11 unmodified lines | ||
| 2692 | 2693 | |
| 2693 | 2694 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
| 2694 | 2695 | mss = skb_shinfo(skb)->gso_size; |
| 2695 | − if (skb->protocol == htons(ETH_P_IP)) { | |
| 2696 | + if (protocol == htons(ETH_P_IP)) { | |
| 2696 | 2697 | struct iphdr *iph = ip_hdr(skb); |
| 2697 | 2698 | iph->tot_len = 0; |
| 2698 | 2699 | iph->check = 0; |
| @@ -2702,7 +2703,7 @@ static int e1000_tso(struct e1000_adapter *adapter, · 3 unmodified lines | ||
| 2702 | 2703 | 0); |
| 2703 | 2704 | cmd_length = E1000_TXD_CMD_IP; |
| 2704 | 2705 | ipcse = skb_transport_offset(skb) - 1; |
| 2705 | − } else if (skb->protocol == htons(ETH_P_IPV6)) { | |
| 2706 | + } else if (skb_is_gso_v6(skb)) { | |
| 2706 | 2707 | ipv6_hdr(skb)->payload_len = 0; |
| 2707 | 2708 | tcp_hdr(skb)->check = |
| 2708 | 2709 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
| @@ -2745,7 +2746,8 @@ static int e1000_tso(struct e1000_adapter *adapter, · 36 unmodified lines | ||
| 2745 | 2746 | } |
| 2746 | 2747 | |
| 2747 | 2748 | static bool e1000_tx_csum(struct e1000_adapter *adapter, |
| 2748 | − struct e1000_tx_ring *tx_ring, struct sk_buff *skb) | |
| 2749 | + struct e1000_tx_ring *tx_ring, struct sk_buff *skb, | |
| 2750 | + __be16 protocol) | |
| 2749 | 2751 | { |
| 2750 | 2752 | struct e1000_context_desc *context_desc; |
| 2751 | 2753 | struct e1000_buffer *buffer_info; |
| @@ -2756,7 +2758,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, · 4 unmodified lines | ||
| 2756 | 2758 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
| 2757 | 2759 | return false; |
| 2758 | 2760 | |
| 2759 | − switch (skb->protocol) { | |
| 2761 | + switch (protocol) { | |
| 2760 | 2762 | case cpu_to_be16(ETH_P_IP): |
| 2761 | 2763 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
| 2762 | 2764 | cmd_len |= E1000_TXD_CMD_TCP; |
| @@ -3097,6 +3099,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, · 334 unmodified lines | ||
| 3097 | 3099 | int count = 0; |
| 3098 | 3100 | int tso; |
| 3099 | 3101 | unsigned int f; |
| 3102 | + __be16 protocol = vlan_get_protocol(skb); | |
| 3100 | 3103 | |
| 3101 | 3104 | /* This goes back to the question of how to logically map a Tx queue |
| 3102 | 3105 | * to a flow. Right now, performance is impacted slightly negatively |
| @@ -3210,7 +3213,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, · 107 unmodified lines | ||
| 3210 | 3213 | |
| 3211 | 3214 | first = tx_ring->next_to_use; |
| 3212 | 3215 | |
| 3213 | − tso = e1000_tso(adapter, tx_ring, skb); | |
| 3216 | + tso = e1000_tso(adapter, tx_ring, skb, protocol); | |
| 3214 | 3217 | if (tso < 0) { |
| 3215 | 3218 | dev_kfree_skb_any(skb); |
| 3216 | 3219 | return NETDEV_TX_OK; |
| @@ -3220,10 +3223,10 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, · 3 unmodified lines | ||
| 3220 | 3223 | if (likely(hw->mac_type != e1000_82544)) |
| 3221 | 3224 | tx_ring->last_tx_tso = true; |
| 3222 | 3225 | tx_flags |= E1000_TX_FLAGS_TSO; |
| 3223 | − } else if (likely(e1000_tx_csum(adapter, tx_ring, skb))) | |
| 3226 | + } else if (likely(e1000_tx_csum(adapter, tx_ring, skb, protocol))) | |
| 3224 | 3227 | tx_flags |= E1000_TX_FLAGS_CSUM; |
| 3225 | 3228 | |
| 3226 | − if (likely(skb->protocol == htons(ETH_P_IP))) | |
| 3229 | + if (protocol == htons(ETH_P_IP)) | |
| 3227 | 3230 | tx_flags |= E1000_TX_FLAGS_IPV4; |
| 3228 | 3231 | |
| 3229 | 3232 | if (unlikely(skb->no_fcs)) |
| @@ -5164,7 +5164,8 @@ link_up: · 5163 unmodified lines | ||
| 5164 | 5164 | #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 |
| 5165 | 5165 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
| 5166 | 5166 | |
| 5167 | −static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) | |
| 5167 | +static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb, | |
| 5168 | + __be16 protocol) | |
| 5168 | 5169 | { |
| 5169 | 5170 | struct e1000_context_desc *context_desc; |
| 5170 | 5171 | struct e1000_buffer *buffer_info; |
| @@ -5183,7 +5184,7 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) · 12 unmodified lines | ||
| 5183 | 5184 | |
| 5184 | 5185 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
| 5185 | 5186 | mss = skb_shinfo(skb)->gso_size; |
| 5186 | − if (skb->protocol == htons(ETH_P_IP)) { | |
| 5187 | + if (protocol == htons(ETH_P_IP)) { | |
| 5187 | 5188 | struct iphdr *iph = ip_hdr(skb); |
| 5188 | 5189 | iph->tot_len = 0; |
| 5189 | 5190 | iph->check = 0; |
| @@ -5231,7 +5232,8 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) · 41 unmodified lines | ||
| 5231 | 5232 | return 1; |
| 5232 | 5233 | } |
| 5233 | 5234 | |
| 5234 | −static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb) | |
| 5235 | +static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb, | |
| 5236 | + __be16 protocol) | |
| 5235 | 5237 | { |
| 5236 | 5238 | struct e1000_adapter *adapter = tx_ring->adapter; |
| 5237 | 5239 | struct e1000_context_desc *context_desc; |
| @@ -5239,16 +5241,10 @@ static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb) · 1 unmodified line | ||
| 5239 | 5241 | unsigned int i; |
| 5240 | 5242 | u8 css; |
| 5241 | 5243 | u32 cmd_len = E1000_TXD_CMD_DEXT; |
| 5242 | − __be16 protocol; | |
| 5243 | 5244 | |
| 5244 | 5245 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
| 5245 | 5246 | return false; |
| 5246 | 5247 | |
| 5247 | − if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) | |
| 5248 | − protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; | |
| 5249 | − else | |
| 5250 | − protocol = skb->protocol; | |
| 5251 | − | |
| 5252 | 5248 | switch (protocol) { |
| 5253 | 5249 | case cpu_to_be16(ETH_P_IP): |
| 5254 | 5250 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
| @@ -5546,6 +5542,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, · 291 unmodified lines | ||
| 5546 | 5542 | int count = 0; |
| 5547 | 5543 | int tso; |
| 5548 | 5544 | unsigned int f; |
| 5545 | + __be16 protocol = vlan_get_protocol(skb); | |
| 5549 | 5546 | |
| 5550 | 5547 | if (test_bit(__E1000_DOWN, &adapter->state)) { |
| 5551 | 5548 | dev_kfree_skb_any(skb); |
| @@ -5620,7 +5617,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, · 68 unmodified lines | ||
| 5620 | 5617 | |
| 5621 | 5618 | first = tx_ring->next_to_use; |
| 5622 | 5619 | |
| 5623 | − tso = e1000_tso(tx_ring, skb); | |
| 5620 | + tso = e1000_tso(tx_ring, skb, protocol); | |
| 5624 | 5621 | if (tso < 0) { |
| 5625 | 5622 | dev_kfree_skb_any(skb); |
| 5626 | 5623 | return NETDEV_TX_OK; |
| @@ -5628,14 +5625,14 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, · 1 unmodified line | ||
| 5628 | 5625 | |
| 5629 | 5626 | if (tso) |
| 5630 | 5627 | tx_flags |= E1000_TX_FLAGS_TSO; |
| 5631 | − else if (e1000_tx_csum(tx_ring, skb)) | |
| 5628 | + else if (e1000_tx_csum(tx_ring, skb, protocol)) | |
| 5632 | 5629 | tx_flags |= E1000_TX_FLAGS_CSUM; |
| 5633 | 5630 | |
| 5634 | 5631 | /* Old method was to assume IPv4 packet by default if TSO was enabled. |
| 5635 | 5632 | * 82571 hardware supports TSO capabilities for IPv6 as well... |
| 5636 | 5633 | * no longer assume, we must. |
| 5637 | 5634 | */ |
| 5638 | − if (skb->protocol == htons(ETH_P_IP)) | |
| 5635 | + if (protocol == htons(ETH_P_IP)) | |
| 5639 | 5636 | tx_flags |= E1000_TX_FLAGS_IPV4; |
| 5640 | 5637 | |
| 5641 | 5638 | if (unlikely(skb->no_fcs)) |
| @@ -2323,7 +2323,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, · 2322 unmodified lines | ||
| 2323 | 2323 | goto out_drop; |
| 2324 | 2324 | |
| 2325 | 2325 | /* obtain protocol of skb */ |
| 2326 | − protocol = skb->protocol; | |
| 2326 | + protocol = vlan_get_protocol(skb); | |
| 2327 | 2327 | |
| 2328 | 2328 | /* record the location of the first descriptor for this packet */ |
| 2329 | 2329 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; |
| @@ -1599,7 +1599,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, · 1598 unmodified lines | ||
| 1599 | 1599 | goto out_drop; |
| 1600 | 1600 | |
| 1601 | 1601 | /* obtain protocol of skb */ |
| 1602 | − protocol = skb->protocol; | |
| 1602 | + protocol = vlan_get_protocol(skb); | |
| 1603 | 1603 | |
| 1604 | 1604 | /* record the location of the first descriptor for this packet */ |
| 1605 | 1605 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/mbus.h> |
| 21 | 21 | #include <linux/module.h> |
| 22 | 22 | #include <linux/interrupt.h> |
| 23 | +#include <linux/if_vlan.h> | |
| 23 | 24 | #include <net/ip.h> |
| 24 | 25 | #include <net/ipv6.h> |
| 25 | 26 | #include <linux/io.h> |
| @@ -1371,15 +1372,16 @@ static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb) · 1345 unmodified lines | ||
| 1371 | 1372 | { |
| 1372 | 1373 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
| 1373 | 1374 | int ip_hdr_len = 0; |
| 1375 | + __be16 l3_proto = vlan_get_protocol(skb); | |
| 1374 | 1376 | u8 l4_proto; |
| 1375 | 1377 | |
| 1376 | − if (skb->protocol == htons(ETH_P_IP)) { | |
| 1378 | + if (l3_proto == htons(ETH_P_IP)) { | |
| 1377 | 1379 | struct iphdr *ip4h = ip_hdr(skb); |
| 1378 | 1380 | |
| 1379 | 1381 | /* Calculate IPv4 checksum and L4 checksum */ |
| 1380 | 1382 | ip_hdr_len = ip4h->ihl; |
| 1381 | 1383 | l4_proto = ip4h->protocol; |
| 1382 | − } else if (skb->protocol == htons(ETH_P_IPV6)) { | |
| 1384 | + } else if (l3_proto == htons(ETH_P_IPV6)) { | |
| 1383 | 1385 | struct ipv6hdr *ip6h = ipv6_hdr(skb); |
| 1384 | 1386 | |
| 1385 | 1387 | /* Read l4_protocol from one of IPv6 extra headers */ |
| @@ -1390,7 +1392,7 @@ static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb) · 4 unmodified lines | ||
| 1390 | 1392 | return MVNETA_TX_L4_CSUM_NOT; |
| 1391 | 1393 | |
| 1392 | 1394 | return mvneta_txq_desc_csum(skb_network_offset(skb), |
| 1393 | − skb->protocol, ip_hdr_len, l4_proto); | |
| 1395 | + l3_proto, ip_hdr_len, l4_proto); | |
| 1394 | 1396 | } |
| 1395 | 1397 | |
| 1396 | 1398 | return MVNETA_TX_L4_CSUM_NOT; |
| @@ -474,39 +474,12 @@ static int mlx4_en_tunnel_steer_add(struct mlx4_en_priv *priv, unsigned char *ad · 473 unmodified lines | ||
| 474 | 474 | int qpn, u64 *reg_id) |
| 475 | 475 | { |
| 476 | 476 | int err; |
| 477 | − struct mlx4_spec_list spec_eth_outer = { {NULL} }; | |
| 478 | − struct mlx4_spec_list spec_vxlan = { {NULL} }; | |
| 479 | − struct mlx4_spec_list spec_eth_inner = { {NULL} }; | |
| 480 | − | |
| 481 | − struct mlx4_net_trans_rule rule = { | |
| 482 | − .queue_mode = MLX4_NET_TRANS_Q_FIFO, | |
| 483 | − .exclusive = 0, | |
| 484 | − .allow_loopback = 1, | |
| 485 | − .promisc_mode = MLX4_FS_REGULAR, | |
| 486 | − .priority = MLX4_DOMAIN_NIC, | |
| 487 | − }; | |
| 488 | − | |
| 489 | − __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); | |
| 490 | 477 | |
| 491 | 478 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
| 492 | 479 | return 0; /* do nothing */ |
| 493 | 480 | |
| 494 | − rule.port = priv->port; | |
| 495 | − rule.qpn = qpn; | |
| 496 | − INIT_LIST_HEAD(&rule.list); | |
| 497 | − | |
| 498 | − spec_eth_outer.id = MLX4_NET_TRANS_RULE_ID_ETH; | |
| 499 | − memcpy(spec_eth_outer.eth.dst_mac, addr, ETH_ALEN); | |
| 500 | − memcpy(spec_eth_outer.eth.dst_mac_msk, &mac_mask, ETH_ALEN); | |
| 501 | − | |
| 502 | − spec_vxlan.id = MLX4_NET_TRANS_RULE_ID_VXLAN; /* any vxlan header */ | |
| 503 | − spec_eth_inner.id = MLX4_NET_TRANS_RULE_ID_ETH; /* any inner eth header */ | |
| 504 | − | |
| 505 | − list_add_tail(&spec_eth_outer.list, &rule.list); | |
| 506 | − list_add_tail(&spec_vxlan.list, &rule.list); | |
| 507 | − list_add_tail(&spec_eth_inner.list, &rule.list); | |
| 508 | − | |
| 509 | − err = mlx4_flow_attach(priv->mdev->dev, &rule, reg_id); | |
| 481 | + err = mlx4_tunnel_steer_add(priv->mdev->dev, addr, priv->port, qpn, | |
| 482 | + MLX4_DOMAIN_NIC, reg_id); | |
| 510 | 483 | if (err) { |
| 511 | 484 | en_err(priv, "failed to add vxlan steering rule, err %d\n", err); |
| 512 | 485 | return err; |
| @@ -1020,6 +1020,44 @@ int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id) · 1019 unmodified lines | ||
| 1020 | 1020 | } |
| 1021 | 1021 | EXPORT_SYMBOL_GPL(mlx4_flow_detach); |
| 1022 | 1022 | |
| 1023 | +int mlx4_tunnel_steer_add(struct mlx4_dev *dev, unsigned char *addr, | |
| 1024 | + int port, int qpn, u16 prio, u64 *reg_id) | |
| 1025 | +{ | |
| 1026 | + int err; | |
| 1027 | + struct mlx4_spec_list spec_eth_outer = { {NULL} }; | |
| 1028 | + struct mlx4_spec_list spec_vxlan = { {NULL} }; | |
| 1029 | + struct mlx4_spec_list spec_eth_inner = { {NULL} }; | |
| 1030 | + | |
| 1031 | + struct mlx4_net_trans_rule rule = { | |
| 1032 | + .queue_mode = MLX4_NET_TRANS_Q_FIFO, | |
| 1033 | + .exclusive = 0, | |
| 1034 | + .allow_loopback = 1, | |
| 1035 | + .promisc_mode = MLX4_FS_REGULAR, | |
| 1036 | + }; | |
| 1037 | + | |
| 1038 | + __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); | |
| 1039 | + | |
| 1040 | + rule.port = port; | |
| 1041 | + rule.qpn = qpn; | |
| 1042 | + rule.priority = prio; | |
| 1043 | + INIT_LIST_HEAD(&rule.list); | |
| 1044 | + | |
| 1045 | + spec_eth_outer.id = MLX4_NET_TRANS_RULE_ID_ETH; | |
| 1046 | + memcpy(spec_eth_outer.eth.dst_mac, addr, ETH_ALEN); | |
| 1047 | + memcpy(spec_eth_outer.eth.dst_mac_msk, &mac_mask, ETH_ALEN); | |
| 1048 | + | |
| 1049 | + spec_vxlan.id = MLX4_NET_TRANS_RULE_ID_VXLAN; /* any vxlan header */ | |
| 1050 | + spec_eth_inner.id = MLX4_NET_TRANS_RULE_ID_ETH; /* any inner eth header */ | |
| 1051 | + | |
| 1052 | + list_add_tail(&spec_eth_outer.list, &rule.list); | |
| 1053 | + list_add_tail(&spec_vxlan.list, &rule.list); | |
| 1054 | + list_add_tail(&spec_eth_inner.list, &rule.list); | |
| 1055 | + | |
| 1056 | + err = mlx4_flow_attach(dev, &rule, reg_id); | |
| 1057 | + return err; | |
| 1058 | +} | |
| 1059 | +EXPORT_SYMBOL(mlx4_tunnel_steer_add); | |
| 1060 | + | |
| 1023 | 1061 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, |
| 1024 | 1062 | u32 max_range_qpn) |
| 1025 | 1063 | { |
| @@ -206,7 +206,7 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) · 205 unmodified lines | ||
| 206 | 206 | int rx_head = priv->rx_head; |
| 207 | 207 | int rx = 0; |
| 208 | 208 | |
| 209 | − while (1) { | |
| 209 | + while (rx < budget) { | |
| 210 | 210 | desc = priv->rx_desc_base + (RX_REG_DESC_SIZE * rx_head); |
| 211 | 211 | desc0 = readl(desc + RX_REG_OFFSET_DESC0); |
| 212 | 212 | |
| @@ -218,7 +218,7 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) · 5 unmodified lines | ||
| 218 | 218 | net_dbg_ratelimited("packet error\n"); |
| 219 | 219 | priv->stats.rx_dropped++; |
| 220 | 220 | priv->stats.rx_errors++; |
| 221 | − continue; | |
| 221 | + goto rx_next; | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | len = desc0 & RX_DESC0_FRAME_LEN_MASK; |
| @@ -226,13 +226,19 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) · 1 unmodified line | ||
| 226 | 226 | if (len > RX_BUF_SIZE) |
| 227 | 227 | len = RX_BUF_SIZE; |
| 228 | 228 | |
| 229 | − skb = build_skb(priv->rx_buf[rx_head], priv->rx_buf_size); | |
| 229 | + dma_sync_single_for_cpu(&ndev->dev, | |
| 230 | + priv->rx_mapping[rx_head], | |
| 231 | + priv->rx_buf_size, DMA_FROM_DEVICE); | |
| 232 | + skb = netdev_alloc_skb_ip_align(ndev, len); | |
| 233 | + | |
| 230 | 234 | if (unlikely(!skb)) { |
| 231 | − net_dbg_ratelimited("build_skb failed\n"); | |
| 235 | + net_dbg_ratelimited("netdev_alloc_skb_ip_align failed\n"); | |
| 232 | 236 | priv->stats.rx_dropped++; |
| 233 | 237 | priv->stats.rx_errors++; |
| 238 | + goto rx_next; | |
| 234 | 239 | } |
| 235 | 240 | |
| 241 | + memcpy(skb->data, priv->rx_buf[rx_head], len); | |
| 236 | 242 | skb_put(skb, len); |
| 237 | 243 | skb->protocol = eth_type_trans(skb, ndev); |
| 238 | 244 | napi_gro_receive(&priv->napi, skb); |
| @@ -244,18 +250,15 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) · 5 unmodified lines | ||
| 244 | 250 | if (desc0 & RX_DESC0_MULTICAST) |
| 245 | 251 | priv->stats.multicast++; |
| 246 | 252 | |
| 253 | +rx_next: | |
| 247 | 254 | writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); |
| 248 | 255 | |
| 249 | 256 | rx_head = RX_NEXT(rx_head); |
| 250 | 257 | priv->rx_head = rx_head; |
| 251 | − | |
| 252 | − if (rx >= budget) | |
| 253 | − break; | |
| 254 | 258 | } |
| 255 | 259 | |
| 256 | 260 | if (rx < budget) { |
| 257 | − napi_gro_flush(napi, false); | |
| 258 | − __napi_complete(napi); | |
| 261 | + napi_complete(napi); | |
| 259 | 262 | } |
| 260 | 263 | |
| 261 | 264 | priv->reg_imr |= RPKT_FINISH_M; |
| @@ -346,10 +349,12 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 84 unmodified lines | ||
| 346 | 349 | len = ETH_ZLEN; |
| 347 | 350 | } |
| 348 | 351 | |
| 349 | − txdes1 = readl(desc + TX_REG_OFFSET_DESC1); | |
| 350 | − txdes1 |= TX_DESC1_LTS | TX_DESC1_FTS; | |
| 351 | − txdes1 &= ~(TX_DESC1_FIFO_COMPLETE | TX_DESC1_INTR_COMPLETE); | |
| 352 | − txdes1 |= (len & TX_DESC1_BUF_SIZE_MASK); | |
| 352 | + dma_sync_single_for_device(&ndev->dev, priv->tx_mapping[tx_head], | |
| 353 | + priv->tx_buf_size, DMA_TO_DEVICE); | |
| 354 | + | |
| 355 | + txdes1 = TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK); | |
| 356 | + if (tx_head == TX_DESC_NUM_MASK) | |
| 357 | + txdes1 |= TX_DESC1_END; | |
| 353 | 358 | writel(txdes1, desc + TX_REG_OFFSET_DESC1); |
| 354 | 359 | writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); |
| 355 | 360 | |
| @@ -465,8 +470,7 @@ static int moxart_mac_probe(struct platform_device *pdev) · 109 unmodified lines | ||
| 465 | 470 | spin_lock_init(&priv->txlock); |
| 466 | 471 | |
| 467 | 472 | priv->tx_buf_size = TX_BUF_SIZE; |
| 468 | − priv->rx_buf_size = RX_BUF_SIZE + | |
| 469 | − SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | |
| 473 | + priv->rx_buf_size = RX_BUF_SIZE; | |
| 470 | 474 | |
| 471 | 475 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * |
| 472 | 476 | TX_DESC_NUM, &priv->tx_base, |
| @@ -1220,6 +1220,9 @@ static int lpc_eth_open(struct net_device *ndev) · 1219 unmodified lines | ||
| 1220 | 1220 | |
| 1221 | 1221 | __lpc_eth_clock_enable(pldat, true); |
| 1222 | 1222 | |
| 1223 | + /* Suspended PHY makes LPC ethernet core block, so resume now */ | |
| 1224 | + phy_resume(pldat->phy_dev); | |
| 1225 | + | |
| 1223 | 1226 | /* Reset and initialize */ |
| 1224 | 1227 | __lpc_eth_reset(pldat); |
| 1225 | 1228 | __lpc_eth_init(pldat); |
| @@ -2556,6 +2556,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) · 2555 unmodified lines | ||
| 2556 | 2556 | |
| 2557 | 2557 | if (skb_is_gso(skb)) { |
| 2558 | 2558 | int err; |
| 2559 | + __be16 l3_proto = vlan_get_protocol(skb); | |
| 2559 | 2560 | |
| 2560 | 2561 | err = skb_cow_head(skb, 0); |
| 2561 | 2562 | if (err < 0) |
| @@ -2572,7 +2573,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) · 10 unmodified lines | ||
| 2572 | 2573 | << OB_MAC_TRANSPORT_HDR_SHIFT); |
| 2573 | 2574 | mac_iocb_ptr->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
| 2574 | 2575 | mac_iocb_ptr->flags2 |= OB_MAC_TSO_IOCB_LSO; |
| 2575 | − if (likely(skb->protocol == htons(ETH_P_IP))) { | |
| 2576 | + if (likely(l3_proto == htons(ETH_P_IP))) { | |
| 2576 | 2577 | struct iphdr *iph = ip_hdr(skb); |
| 2577 | 2578 | iph->check = 0; |
| 2578 | 2579 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP4; |
| @@ -2580,7 +2581,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) · 1 unmodified line | ||
| 2580 | 2581 | iph->daddr, 0, |
| 2581 | 2582 | IPPROTO_TCP, |
| 2582 | 2583 | 0); |
| 2583 | − } else if (skb->protocol == htons(ETH_P_IPV6)) { | |
| 2584 | + } else if (l3_proto == htons(ETH_P_IPV6)) { | |
| 2584 | 2585 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP6; |
| 2585 | 2586 | tcp_hdr(skb)->check = |
| 2586 | 2587 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | config SH_ETH |
| 6 | 6 | tristate "Renesas SuperH Ethernet support" |
| 7 | 7 | depends on HAS_DMA |
| 8 | + depends on ARCH_SHMOBILE || SUPERH || COMPILE_TEST | |
| 8 | 9 | select CRC32 |
| 9 | 10 | select MII |
| 10 | 11 | select MDIO_BITBANG |
| @@ -28,7 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #include "stmmac.h" |
| 30 | 30 | |
| 31 | −static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |
| 31 | +static int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |
| 32 | 32 | { |
| 33 | 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; |
| 34 | 34 | unsigned int txsize = priv->dma_tx_size; |
| @@ -47,7 +47,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) · 12 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | desc->des2 = dma_map_single(priv->device, skb->data, |
| 49 | 49 | bmax, DMA_TO_DEVICE); |
| 50 | − priv->tx_skbuff_dma[entry] = desc->des2; | |
| 50 | + if (dma_mapping_error(priv->device, desc->des2)) | |
| 51 | + return -1; | |
| 52 | + priv->tx_skbuff_dma[entry].buf = desc->des2; | |
| 51 | 53 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, STMMAC_CHAIN_MODE); |
| 52 | 54 | |
| 53 | 55 | while (len != 0) { |
| @@ -59,7 +61,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) · 5 unmodified lines | ||
| 59 | 61 | desc->des2 = dma_map_single(priv->device, |
| 60 | 62 | (skb->data + bmax * i), |
| 61 | 63 | bmax, DMA_TO_DEVICE); |
| 62 | − priv->tx_skbuff_dma[entry] = desc->des2; | |
| 64 | + if (dma_mapping_error(priv->device, desc->des2)) | |
| 65 | + return -1; | |
| 66 | + priv->tx_skbuff_dma[entry].buf = desc->des2; | |
| 63 | 67 | priv->hw->desc->prepare_tx_desc(desc, 0, bmax, csum, |
| 64 | 68 | STMMAC_CHAIN_MODE); |
| 65 | 69 | priv->hw->desc->set_tx_owner(desc); |
| @@ -69,7 +73,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) · 3 unmodified lines | ||
| 69 | 73 | desc->des2 = dma_map_single(priv->device, |
| 70 | 74 | (skb->data + bmax * i), len, |
| 71 | 75 | DMA_TO_DEVICE); |
| 72 | − priv->tx_skbuff_dma[entry] = desc->des2; | |
| 76 | + if (dma_mapping_error(priv->device, desc->des2)) | |
| 77 | + return -1; | |
| 78 | + priv->tx_skbuff_dma[entry].buf = desc->des2; | |
| 73 | 79 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, |
| 74 | 80 | STMMAC_CHAIN_MODE); |
| 75 | 81 | priv->hw->desc->set_tx_owner(desc); |
| @@ -220,10 +220,10 @@ enum dma_irq_status { · 219 unmodified lines | ||
| 220 | 220 | handle_tx = 0x8, |
| 221 | 221 | }; |
| 222 | 222 | |
| 223 | −#define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 1) | |
| 224 | −#define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 2) | |
| 225 | −#define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 3) | |
| 226 | −#define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 4) | |
| 223 | +#define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 0) | |
| 224 | +#define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 1) | |
| 225 | +#define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 2) | |
| 226 | +#define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 3) | |
| 227 | 227 | |
| 228 | 228 | #define CORE_PCS_ANE_COMPLETE (1 << 5) |
| 229 | 229 | #define CORE_PCS_LINK_STATUS (1 << 6) |
| @@ -287,7 +287,7 @@ struct dma_features { · 57 unmodified lines | ||
| 287 | 287 | |
| 288 | 288 | /* Default LPI timers */ |
| 289 | 289 | #define STMMAC_DEFAULT_LIT_LS 0x3E8 |
| 290 | −#define STMMAC_DEFAULT_TWT_LS 0x0 | |
| 290 | +#define STMMAC_DEFAULT_TWT_LS 0x1E | |
| 291 | 291 | |
| 292 | 292 | #define STMMAC_CHAIN_MODE 0x1 |
| 293 | 293 | #define STMMAC_RING_MODE 0x2 |
| @@ -425,7 +425,7 @@ struct stmmac_mode_ops { · 131 unmodified lines | ||
| 425 | 425 | void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, |
| 426 | 426 | unsigned int extend_desc); |
| 427 | 427 | unsigned int (*is_jumbo_frm) (int len, int ehn_desc); |
| 428 | − unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum); | |
| 428 | + int (*jumbo_frm)(void *priv, struct sk_buff *skb, int csum); | |
| 429 | 429 | int (*set_16kib_bfsize)(int mtu); |
| 430 | 430 | void (*init_desc3)(struct dma_desc *p); |
| 431 | 431 | void (*refill_desc3) (void *priv, struct dma_desc *p); |
| @@ -445,6 +445,7 @@ struct mac_device_info { · 13 unmodified lines | ||
| 445 | 445 | int multicast_filter_bins; |
| 446 | 446 | int unicast_filter_entries; |
| 447 | 447 | int mcast_bits_log2; |
| 448 | + unsigned int rx_csum; | |
| 448 | 449 | }; |
| 449 | 450 | |
| 450 | 451 | struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins, |
| @@ -153,7 +153,7 @@ enum inter_frame_gap { · 152 unmodified lines | ||
| 153 | 153 | #define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */ |
| 154 | 154 | |
| 155 | 155 | #define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \ |
| 156 | − GMAC_CONTROL_BE) | |
| 156 | + GMAC_CONTROL_BE | GMAC_CONTROL_DCRS) | |
| 157 | 157 | |
| 158 | 158 | /* GMAC Frame Filter defines */ |
| 159 | 159 | #define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */ |
| @@ -58,7 +58,11 @@ static int dwmac1000_rx_ipc_enable(struct mac_device_info *hw) · 57 unmodified lines | ||
| 58 | 58 | void __iomem *ioaddr = hw->pcsr; |
| 59 | 59 | u32 value = readl(ioaddr + GMAC_CONTROL); |
| 60 | 60 | |
| 61 | − value |= GMAC_CONTROL_IPC; | |
| 61 | + if (hw->rx_csum) | |
| 62 | + value |= GMAC_CONTROL_IPC; | |
| 63 | + else | |
| 64 | + value &= ~GMAC_CONTROL_IPC; | |
| 65 | + | |
| 62 | 66 | writel(value, ioaddr + GMAC_CONTROL); |
| 63 | 67 | |
| 64 | 68 | value = readl(ioaddr + GMAC_CONTROL); |
| @@ -68,7 +68,7 @@ struct stmmac_counters { · 67 unmodified lines | ||
| 68 | 68 | unsigned int mmc_rx_octetcount_g; |
| 69 | 69 | unsigned int mmc_rx_broadcastframe_g; |
| 70 | 70 | unsigned int mmc_rx_multicastframe_g; |
| 71 | − unsigned int mmc_rx_crc_errror; | |
| 71 | + unsigned int mmc_rx_crc_error; | |
| 72 | 72 | unsigned int mmc_rx_align_error; |
| 73 | 73 | unsigned int mmc_rx_run_error; |
| 74 | 74 | unsigned int mmc_rx_jabber_error; |
| @@ -196,7 +196,7 @@ void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc) · 195 unmodified lines | ||
| 196 | 196 | mmc->mmc_rx_octetcount_g += readl(ioaddr + MMC_RX_OCTETCOUNT_G); |
| 197 | 197 | mmc->mmc_rx_broadcastframe_g += readl(ioaddr + MMC_RX_BROADCASTFRAME_G); |
| 198 | 198 | mmc->mmc_rx_multicastframe_g += readl(ioaddr + MMC_RX_MULTICASTFRAME_G); |
| 199 | − mmc->mmc_rx_crc_errror += readl(ioaddr + MMC_RX_CRC_ERRROR); | |
| 199 | + mmc->mmc_rx_crc_error += readl(ioaddr + MMC_RX_CRC_ERRROR); | |
| 200 | 200 | mmc->mmc_rx_align_error += readl(ioaddr + MMC_RX_ALIGN_ERROR); |
| 201 | 201 | mmc->mmc_rx_run_error += readl(ioaddr + MMC_RX_RUN_ERROR); |
| 202 | 202 | mmc->mmc_rx_jabber_error += readl(ioaddr + MMC_RX_JABBER_ERROR); |
| @@ -28,7 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #include "stmmac.h" |
| 30 | 30 | |
| 31 | −static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |
| 31 | +static int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |
| 32 | 32 | { |
| 33 | 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; |
| 34 | 34 | unsigned int txsize = priv->dma_tx_size; |
| @@ -53,7 +53,10 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) · 18 unmodified lines | ||
| 53 | 53 | |
| 54 | 54 | desc->des2 = dma_map_single(priv->device, skb->data, |
| 55 | 55 | bmax, DMA_TO_DEVICE); |
| 56 | − priv->tx_skbuff_dma[entry] = desc->des2; | |
| 56 | + if (dma_mapping_error(priv->device, desc->des2)) | |
| 57 | + return -1; | |
| 58 | + | |
| 59 | + priv->tx_skbuff_dma[entry].buf = desc->des2; | |
| 57 | 60 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
| 58 | 61 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, |
| 59 | 62 | STMMAC_RING_MODE); |
| @@ -68,7 +71,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) · 8 unmodified lines | ||
| 68 | 71 | |
| 69 | 72 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, |
| 70 | 73 | len, DMA_TO_DEVICE); |
| 71 | − priv->tx_skbuff_dma[entry] = desc->des2; | |
| 74 | + if (dma_mapping_error(priv->device, desc->des2)) | |
| 75 | + return -1; | |
| 76 | + priv->tx_skbuff_dma[entry].buf = desc->des2; | |
| 72 | 77 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
| 73 | 78 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, |
| 74 | 79 | STMMAC_RING_MODE); |
| @@ -77,7 +82,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) · 2 unmodified lines | ||
| 77 | 82 | } else { |
| 78 | 83 | desc->des2 = dma_map_single(priv->device, skb->data, |
| 79 | 84 | nopaged_len, DMA_TO_DEVICE); |
| 80 | − priv->tx_skbuff_dma[entry] = desc->des2; | |
| 85 | + if (dma_mapping_error(priv->device, desc->des2)) | |
| 86 | + return -1; | |
| 87 | + priv->tx_skbuff_dma[entry].buf = desc->des2; | |
| 81 | 88 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
| 82 | 89 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, csum, |
| 83 | 90 | STMMAC_RING_MODE); |
| @@ -34,6 +34,11 @@ · 33 unmodified lines | ||
| 34 | 34 | #include <linux/ptp_clock_kernel.h> |
| 35 | 35 | #include <linux/reset.h> |
| 36 | 36 | |
| 37 | +struct stmmac_tx_info { | |
| 38 | + dma_addr_t buf; | |
| 39 | + bool map_as_page; | |
| 40 | +}; | |
| 41 | + | |
| 37 | 42 | struct stmmac_priv { |
| 38 | 43 | /* Frequently used values are kept adjacent for cache effect */ |
| 39 | 44 | struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; |
| @@ -45,7 +50,7 @@ struct stmmac_priv { · 5 unmodified lines | ||
| 45 | 50 | u32 tx_count_frames; |
| 46 | 51 | u32 tx_coal_frames; |
| 47 | 52 | u32 tx_coal_timer; |
| 48 | − dma_addr_t *tx_skbuff_dma; | |
| 53 | + struct stmmac_tx_info *tx_skbuff_dma; | |
| 49 | 54 | dma_addr_t dma_tx_phy; |
| 50 | 55 | int tx_coalesce; |
| 51 | 56 | int hwts_tx_en; |
| @@ -105,6 +110,8 @@ struct stmmac_priv { · 53 unmodified lines | ||
| 105 | 110 | struct ptp_clock *ptp_clock; |
| 106 | 111 | struct ptp_clock_info ptp_clock_ops; |
| 107 | 112 | unsigned int default_addend; |
| 113 | + struct clk *clk_ptp_ref; | |
| 114 | + unsigned int clk_ptp_rate; | |
| 108 | 115 | u32 adv_ts; |
| 109 | 116 | int use_riwt; |
| 110 | 117 | int irq_wake; |
| @@ -175,7 +175,7 @@ static const struct stmmac_stats stmmac_mmc[] = { · 174 unmodified lines | ||
| 175 | 175 | STMMAC_MMC_STAT(mmc_rx_octetcount_g), |
| 176 | 176 | STMMAC_MMC_STAT(mmc_rx_broadcastframe_g), |
| 177 | 177 | STMMAC_MMC_STAT(mmc_rx_multicastframe_g), |
| 178 | − STMMAC_MMC_STAT(mmc_rx_crc_errror), | |
| 178 | + STMMAC_MMC_STAT(mmc_rx_crc_error), | |
| 179 | 179 | STMMAC_MMC_STAT(mmc_rx_align_error), |
| 180 | 180 | STMMAC_MMC_STAT(mmc_rx_run_error), |
| 181 | 181 | STMMAC_MMC_STAT(mmc_rx_jabber_error), |
| @@ -275,6 +275,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) · 274 unmodified lines | ||
| 275 | 275 | */ |
| 276 | 276 | bool stmmac_eee_init(struct stmmac_priv *priv) |
| 277 | 277 | { |
| 278 | + char *phy_bus_name = priv->plat->phy_bus_name; | |
| 278 | 279 | bool ret = false; |
| 279 | 280 | |
| 280 | 281 | /* Using PCS we cannot dial with the phy registers at this stage |
| @@ -284,6 +285,10 @@ bool stmmac_eee_init(struct stmmac_priv *priv) · 3 unmodified lines | ||
| 284 | 285 | (priv->pcs == STMMAC_PCS_RTBI)) |
| 285 | 286 | goto out; |
| 286 | 287 | |
| 288 | + /* Never init EEE in case of a switch is attached */ | |
| 289 | + if (phy_bus_name && (!strcmp(phy_bus_name, "fixed"))) | |
| 290 | + goto out; | |
| 291 | + | |
| 287 | 292 | /* MAC core supports the EEE feature. */ |
| 288 | 293 | if (priv->dma_cap.eee) { |
| 289 | 294 | int tx_lpi_timer = priv->tx_lpi_timer; |
| @@ -316,10 +321,9 @@ bool stmmac_eee_init(struct stmmac_priv *priv) · 26 unmodified lines | ||
| 316 | 321 | priv->hw->mac->set_eee_timer(priv->hw, |
| 317 | 322 | STMMAC_DEFAULT_LIT_LS, |
| 318 | 323 | tx_lpi_timer); |
| 319 | − } else | |
| 320 | − /* Set HW EEE according to the speed */ | |
| 321 | − priv->hw->mac->set_eee_pls(priv->hw, | |
| 322 | − priv->phydev->link); | |
| 324 | + } | |
| 325 | + /* Set HW EEE according to the speed */ | |
| 326 | + priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); | |
| 323 | 327 | |
| 324 | 328 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); |
| 325 | 329 | |
| @@ -603,16 +607,16 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 277 unmodified lines | ||
| 603 | 607 | /* calculate default added value: |
| 604 | 608 | * formula is : |
| 605 | 609 | * addend = (2^32)/freq_div_ratio; |
| 606 | − * where, freq_div_ratio = STMMAC_SYSCLOCK/50MHz | |
| 607 | − * hence, addend = ((2^32) * 50MHz)/STMMAC_SYSCLOCK; | |
| 608 | − * NOTE: STMMAC_SYSCLOCK should be >= 50MHz to | |
| 610 | + * where, freq_div_ratio = clk_ptp_ref_i/50MHz | |
| 611 | + * hence, addend = ((2^32) * 50MHz)/clk_ptp_ref_i; | |
| 612 | + * NOTE: clk_ptp_ref_i should be >= 50MHz to | |
| 609 | 613 | * achive 20ns accuracy. |
| 610 | 614 | * |
| 611 | 615 | * 2^x * y == (y << x), hence |
| 612 | 616 | * 2^32 * 50000000 ==> (50000000 << 32) |
| 613 | 617 | */ |
| 614 | 618 | temp = (u64) (50000000ULL << 32); |
| 615 | − priv->default_addend = div_u64(temp, STMMAC_SYSCLOCK); | |
| 619 | + priv->default_addend = div_u64(temp, priv->clk_ptp_rate); | |
| 616 | 620 | priv->hw->ptp->config_addend(priv->ioaddr, |
| 617 | 621 | priv->default_addend); |
| 618 | 622 | |
| @@ -638,6 +642,16 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) · 19 unmodified lines | ||
| 638 | 642 | if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) |
| 639 | 643 | return -EOPNOTSUPP; |
| 640 | 644 | |
| 645 | + /* Fall-back to main clock in case of no PTP ref is passed */ | |
| 646 | + priv->clk_ptp_ref = devm_clk_get(priv->device, "clk_ptp_ref"); | |
| 647 | + if (IS_ERR(priv->clk_ptp_ref)) { | |
| 648 | + priv->clk_ptp_rate = clk_get_rate(priv->stmmac_clk); | |
| 649 | + priv->clk_ptp_ref = NULL; | |
| 650 | + } else { | |
| 651 | + clk_prepare_enable(priv->clk_ptp_ref); | |
| 652 | + priv->clk_ptp_rate = clk_get_rate(priv->clk_ptp_ref); | |
| 653 | + } | |
| 654 | + | |
| 641 | 655 | priv->adv_ts = 0; |
| 642 | 656 | if (priv->dma_cap.atime_stamp && priv->extend_desc) |
| 643 | 657 | priv->adv_ts = 1; |
| @@ -657,6 +671,8 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) · 13 unmodified lines | ||
| 657 | 671 | |
| 658 | 672 | static void stmmac_release_ptp(struct stmmac_priv *priv) |
| 659 | 673 | { |
| 674 | + if (priv->clk_ptp_ref) | |
| 675 | + clk_disable_unprepare(priv->clk_ptp_ref); | |
| 660 | 676 | stmmac_ptp_unregister(priv); |
| 661 | 677 | } |
| 662 | 678 | |
| @@ -1061,7 +1077,8 @@ static int init_dma_desc_rings(struct net_device *dev) · 398 unmodified lines | ||
| 1061 | 1077 | else |
| 1062 | 1078 | p = priv->dma_tx + i; |
| 1063 | 1079 | p->des2 = 0; |
| 1064 | − priv->tx_skbuff_dma[i] = 0; | |
| 1080 | + priv->tx_skbuff_dma[i].buf = 0; | |
| 1081 | + priv->tx_skbuff_dma[i].map_as_page = false; | |
| 1065 | 1082 | priv->tx_skbuff[i] = NULL; |
| 1066 | 1083 | } |
| 1067 | 1084 | |
| @@ -1100,17 +1117,24 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv) · 32 unmodified lines | ||
| 1100 | 1117 | else |
| 1101 | 1118 | p = priv->dma_tx + i; |
| 1102 | 1119 | |
| 1103 | − if (priv->tx_skbuff_dma[i]) { | |
| 1104 | − dma_unmap_single(priv->device, | |
| 1105 | − priv->tx_skbuff_dma[i], | |
| 1106 | − priv->hw->desc->get_tx_len(p), | |
| 1107 | − DMA_TO_DEVICE); | |
| 1108 | − priv->tx_skbuff_dma[i] = 0; | |
| 1120 | + if (priv->tx_skbuff_dma[i].buf) { | |
| 1121 | + if (priv->tx_skbuff_dma[i].map_as_page) | |
| 1122 | + dma_unmap_page(priv->device, | |
| 1123 | + priv->tx_skbuff_dma[i].buf, | |
| 1124 | + priv->hw->desc->get_tx_len(p), | |
| 1125 | + DMA_TO_DEVICE); | |
| 1126 | + else | |
| 1127 | + dma_unmap_single(priv->device, | |
| 1128 | + priv->tx_skbuff_dma[i].buf, | |
| 1129 | + priv->hw->desc->get_tx_len(p), | |
| 1130 | + DMA_TO_DEVICE); | |
| 1109 | 1131 | } |
| 1110 | 1132 | |
| 1111 | 1133 | if (priv->tx_skbuff[i] != NULL) { |
| 1112 | 1134 | dev_kfree_skb_any(priv->tx_skbuff[i]); |
| 1113 | 1135 | priv->tx_skbuff[i] = NULL; |
| 1136 | + priv->tx_skbuff_dma[i].buf = 0; | |
| 1137 | + priv->tx_skbuff_dma[i].map_as_page = false; | |
| 1114 | 1138 | } |
| 1115 | 1139 | } |
| 1116 | 1140 | } |
| @@ -1131,7 +1155,8 @@ static int alloc_dma_desc_resources(struct stmmac_priv *priv) · 14 unmodified lines | ||
| 1131 | 1155 | if (!priv->rx_skbuff) |
| 1132 | 1156 | goto err_rx_skbuff; |
| 1133 | 1157 | |
| 1134 | − priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), | |
| 1158 | + priv->tx_skbuff_dma = kmalloc_array(txsize, | |
| 1159 | + sizeof(*priv->tx_skbuff_dma), | |
| 1135 | 1160 | GFP_KERNEL); |
| 1136 | 1161 | if (!priv->tx_skbuff_dma) |
| 1137 | 1162 | goto err_tx_skbuff_dma; |
| @@ -1293,12 +1318,19 @@ static void stmmac_tx_clean(struct stmmac_priv *priv) · 155 unmodified lines | ||
| 1293 | 1318 | pr_debug("%s: curr %d, dirty %d\n", __func__, |
| 1294 | 1319 | priv->cur_tx, priv->dirty_tx); |
| 1295 | 1320 | |
| 1296 | − if (likely(priv->tx_skbuff_dma[entry])) { | |
| 1297 | − dma_unmap_single(priv->device, | |
| 1298 | − priv->tx_skbuff_dma[entry], | |
| 1299 | − priv->hw->desc->get_tx_len(p), | |
| 1300 | − DMA_TO_DEVICE); | |
| 1301 | − priv->tx_skbuff_dma[entry] = 0; | |
| 1321 | + if (likely(priv->tx_skbuff_dma[entry].buf)) { | |
| 1322 | + if (priv->tx_skbuff_dma[entry].map_as_page) | |
| 1323 | + dma_unmap_page(priv->device, | |
| 1324 | + priv->tx_skbuff_dma[entry].buf, | |
| 1325 | + priv->hw->desc->get_tx_len(p), | |
| 1326 | + DMA_TO_DEVICE); | |
| 1327 | + else | |
| 1328 | + dma_unmap_single(priv->device, | |
| 1329 | + priv->tx_skbuff_dma[entry].buf, | |
| 1330 | + priv->hw->desc->get_tx_len(p), | |
| 1331 | + DMA_TO_DEVICE); | |
| 1332 | + priv->tx_skbuff_dma[entry].buf = 0; | |
| 1333 | + priv->tx_skbuff_dma[entry].map_as_page = false; | |
| 1302 | 1334 | } |
| 1303 | 1335 | priv->hw->mode->clean_desc3(priv, p); |
| 1304 | 1336 | |
| @@ -1637,6 +1669,13 @@ static int stmmac_hw_setup(struct net_device *dev) · 332 unmodified lines | ||
| 1637 | 1669 | /* Initialize the MAC Core */ |
| 1638 | 1670 | priv->hw->mac->core_init(priv->hw, dev->mtu); |
| 1639 | 1671 | |
| 1672 | + ret = priv->hw->mac->rx_ipc(priv->hw); | |
| 1673 | + if (!ret) { | |
| 1674 | + pr_warn(" RX IPC Checksum Offload disabled\n"); | |
| 1675 | + priv->plat->rx_coe = STMMAC_RX_COE_NONE; | |
| 1676 | + priv->hw->rx_csum = 0; | |
| 1677 | + } | |
| 1678 | + | |
| 1640 | 1679 | /* Enable the MAC Rx/Tx */ |
| 1641 | 1680 | stmmac_set_mac(priv->ioaddr, true); |
| 1642 | 1681 | |
| @@ -1887,12 +1926,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 244 unmodified lines | ||
| 1887 | 1926 | if (likely(!is_jumbo)) { |
| 1888 | 1927 | desc->des2 = dma_map_single(priv->device, skb->data, |
| 1889 | 1928 | nopaged_len, DMA_TO_DEVICE); |
| 1890 | − priv->tx_skbuff_dma[entry] = desc->des2; | |
| 1929 | + if (dma_mapping_error(priv->device, desc->des2)) | |
| 1930 | + goto dma_map_err; | |
| 1931 | + priv->tx_skbuff_dma[entry].buf = desc->des2; | |
| 1891 | 1932 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, |
| 1892 | 1933 | csum_insertion, priv->mode); |
| 1893 | 1934 | } else { |
| 1894 | 1935 | desc = first; |
| 1895 | 1936 | entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion); |
| 1937 | + if (unlikely(entry < 0)) | |
| 1938 | + goto dma_map_err; | |
| 1896 | 1939 | } |
| 1897 | 1940 | |
| 1898 | 1941 | for (i = 0; i < nfrags; i++) { |
| @@ -1908,7 +1951,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 9 unmodified lines | ||
| 1908 | 1951 | |
| 1909 | 1952 | desc->des2 = skb_frag_dma_map(priv->device, frag, 0, len, |
| 1910 | 1953 | DMA_TO_DEVICE); |
| 1911 | − priv->tx_skbuff_dma[entry] = desc->des2; | |
| 1954 | + if (dma_mapping_error(priv->device, desc->des2)) | |
| 1955 | + goto dma_map_err; /* should reuse desc w/o issues */ | |
| 1956 | + | |
| 1957 | + priv->tx_skbuff_dma[entry].buf = desc->des2; | |
| 1958 | + priv->tx_skbuff_dma[entry].map_as_page = true; | |
| 1912 | 1959 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion, |
| 1913 | 1960 | priv->mode); |
| 1914 | 1961 | wmb(); |
| @@ -1975,7 +2022,12 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 60 unmodified lines | ||
| 1975 | 2022 | priv->hw->dma->enable_dma_transmission(priv->ioaddr); |
| 1976 | 2023 | |
| 1977 | 2024 | spin_unlock(&priv->tx_lock); |
| 2025 | + return NETDEV_TX_OK; | |
| 1978 | 2026 | |
| 2027 | +dma_map_err: | |
| 2028 | + dev_err(priv->device, "Tx dma map failed\n"); | |
| 2029 | + dev_kfree_skb(skb); | |
| 2030 | + priv->dev->stats.tx_dropped++; | |
| 1979 | 2031 | return NETDEV_TX_OK; |
| 1980 | 2032 | } |
| 1981 | 2033 | |
| @@ -2028,7 +2080,12 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) · 46 unmodified lines | ||
| 2028 | 2080 | priv->rx_skbuff_dma[entry] = |
| 2029 | 2081 | dma_map_single(priv->device, skb->data, bfsize, |
| 2030 | 2082 | DMA_FROM_DEVICE); |
| 2031 | − | |
| 2083 | + if (dma_mapping_error(priv->device, | |
| 2084 | + priv->rx_skbuff_dma[entry])) { | |
| 2085 | + dev_err(priv->device, "Rx dma map failed\n"); | |
| 2086 | + dev_kfree_skb(skb); | |
| 2087 | + break; | |
| 2088 | + } | |
| 2032 | 2089 | p->des2 = priv->rx_skbuff_dma[entry]; |
| 2033 | 2090 | |
| 2034 | 2091 | priv->hw->mode->refill_desc3(priv, p); |
| @@ -2055,7 +2112,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) · 20 unmodified lines | ||
| 2055 | 2112 | unsigned int entry = priv->cur_rx % rxsize; |
| 2056 | 2113 | unsigned int next_entry; |
| 2057 | 2114 | unsigned int count = 0; |
| 2058 | − int coe = priv->plat->rx_coe; | |
| 2115 | + int coe = priv->hw->rx_csum; | |
| 2059 | 2116 | |
| 2060 | 2117 | if (netif_msg_rx_status(priv)) { |
| 2061 | 2118 | pr_debug("%s: descriptor ring:\n", __func__); |
| @@ -2276,8 +2333,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, · 214 unmodified lines | ||
| 2276 | 2333 | |
| 2277 | 2334 | if (priv->plat->rx_coe == STMMAC_RX_COE_NONE) |
| 2278 | 2335 | features &= ~NETIF_F_RXCSUM; |
| 2279 | − else if (priv->plat->rx_coe == STMMAC_RX_COE_TYPE1) | |
| 2280 | − features &= ~NETIF_F_IPV6_CSUM; | |
| 2336 | + | |
| 2281 | 2337 | if (!priv->plat->tx_coe) |
| 2282 | 2338 | features &= ~NETIF_F_ALL_CSUM; |
| 2283 | 2339 | |
| @@ -2292,6 +2348,24 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, · 8 unmodified lines | ||
| 2292 | 2348 | return features; |
| 2293 | 2349 | } |
| 2294 | 2350 | |
| 2351 | +static int stmmac_set_features(struct net_device *netdev, | |
| 2352 | + netdev_features_t features) | |
| 2353 | +{ | |
| 2354 | + struct stmmac_priv *priv = netdev_priv(netdev); | |
| 2355 | + | |
| 2356 | + /* Keep the COE Type in case of csum is supporting */ | |
| 2357 | + if (features & NETIF_F_RXCSUM) | |
| 2358 | + priv->hw->rx_csum = priv->plat->rx_coe; | |
| 2359 | + else | |
| 2360 | + priv->hw->rx_csum = 0; | |
| 2361 | + /* No check needed because rx_coe has been set before and it will be | |
| 2362 | + * fixed in case of issue. | |
| 2363 | + */ | |
| 2364 | + priv->hw->mac->rx_ipc(priv->hw); | |
| 2365 | + | |
| 2366 | + return 0; | |
| 2367 | +} | |
| 2368 | + | |
| 2295 | 2369 | /** |
| 2296 | 2370 | * stmmac_interrupt - main ISR |
| 2297 | 2371 | * @irq: interrupt number. |
| @@ -2572,6 +2646,7 @@ static const struct net_device_ops stmmac_netdev_ops = { · 274 unmodified lines | ||
| 2572 | 2646 | .ndo_stop = stmmac_release, |
| 2573 | 2647 | .ndo_change_mtu = stmmac_change_mtu, |
| 2574 | 2648 | .ndo_fix_features = stmmac_fix_features, |
| 2649 | + .ndo_set_features = stmmac_set_features, | |
| 2575 | 2650 | .ndo_set_rx_mode = stmmac_set_rx_mode, |
| 2576 | 2651 | .ndo_tx_timeout = stmmac_tx_timeout, |
| 2577 | 2652 | .ndo_do_ioctl = stmmac_ioctl, |
| @@ -2592,7 +2667,6 @@ static const struct net_device_ops stmmac_netdev_ops = { · 14 unmodified lines | ||
| 2592 | 2667 | */ |
| 2593 | 2668 | static int stmmac_hw_init(struct stmmac_priv *priv) |
| 2594 | 2669 | { |
| 2595 | − int ret; | |
| 2596 | 2670 | struct mac_device_info *mac; |
| 2597 | 2671 | |
| 2598 | 2672 | /* Identify the MAC HW device */ |
| @@ -2649,15 +2723,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv) · 50 unmodified lines | ||
| 2649 | 2723 | /* To use alternate (extended) or normal descriptor structures */ |
| 2650 | 2724 | stmmac_selec_desc_mode(priv); |
| 2651 | 2725 | |
| 2652 | − ret = priv->hw->mac->rx_ipc(priv->hw); | |
| 2653 | − if (!ret) { | |
| 2654 | − pr_warn(" RX IPC Checksum Offload not configured.\n"); | |
| 2655 | − priv->plat->rx_coe = STMMAC_RX_COE_NONE; | |
| 2656 | − } | |
| 2657 | − | |
| 2658 | − if (priv->plat->rx_coe) | |
| 2726 | + if (priv->plat->rx_coe) { | |
| 2727 | + priv->hw->rx_csum = priv->plat->rx_coe; | |
| 2659 | 2728 | pr_info(" RX Checksum Offload Engine supported (type %d)\n", |
| 2660 | 2729 | priv->plat->rx_coe); |
| 2730 | + } | |
| 2661 | 2731 | if (priv->plat->tx_coe) |
| 2662 | 2732 | pr_info(" TX Checksum insertion supported\n"); |
| 2663 | 2733 | |
| @@ -206,6 +206,7 @@ void stmmac_ptp_unregister(struct stmmac_priv *priv) · 205 unmodified lines | ||
| 206 | 206 | { |
| 207 | 207 | if (priv->ptp_clock) { |
| 208 | 208 | ptp_clock_unregister(priv->ptp_clock); |
| 209 | + priv->ptp_clock = NULL; | |
| 209 | 210 | pr_debug("Removed PTP HW clock successfully on %s\n", |
| 210 | 211 | priv->dev->name); |
| 211 | 212 | } |
| @@ -25,8 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | #ifndef __STMMAC_PTP_H__ |
| 26 | 26 | #define __STMMAC_PTP_H__ |
| 27 | 27 | |
| 28 | −#define STMMAC_SYSCLOCK 62500000 | |
| 29 | − | |
| 30 | 28 | /* IEEE 1588 PTP register offsets */ |
| 31 | 29 | #define PTP_TCR 0x0700 /* Timestamp Control Reg */ |
| 32 | 30 | #define PTP_SSIR 0x0704 /* Sub-Second Increment Reg */ |
| @@ -147,11 +147,6 @@ · 146 unmodified lines | ||
| 147 | 147 | #define PCI_MEM64BIT (2<<1) /* Base addr anywhere in 64 Bit range */ |
| 148 | 148 | #define PCI_MEMSPACE 0x00000001L /* Bit 0: Memory Space Indic. */ |
| 149 | 149 | |
| 150 | −/* PCI_BASE_2ND 32 bit 2nd Base address */ | |
| 151 | −#define PCI_IOBASE 0xffffff00L /* Bit 31..8: I/O Base address */ | |
| 152 | −#define PCI_IOSIZE 0x000000fcL /* Bit 7..2: I/O Size Requirements */ | |
| 153 | −#define PCI_IOSPACE 0x00000001L /* Bit 0: I/O Space Indicator */ | |
| 154 | − | |
| 155 | 150 | /* PCI_SUB_VID 16 bit Subsystem Vendor ID */ |
| 156 | 151 | /* PCI_SUB_ID 16 bit Subsystem ID */ |
| 157 | 152 | |
| @@ -1040,31 +1040,31 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) · 1039 unmodified lines | ||
| 1040 | 1040 | /* First check if the EEE ability is supported */ |
| 1041 | 1041 | eee_cap = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE, |
| 1042 | 1042 | MDIO_MMD_PCS, phydev->addr); |
| 1043 | − if (eee_cap < 0) | |
| 1044 | − return eee_cap; | |
| 1043 | + if (eee_cap <= 0) | |
| 1044 | + goto eee_exit_err; | |
| 1045 | 1045 | |
| 1046 | 1046 | cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); |
| 1047 | 1047 | if (!cap) |
| 1048 | − return -EPROTONOSUPPORT; | |
| 1048 | + goto eee_exit_err; | |
| 1049 | 1049 | |
| 1050 | 1050 | /* Check which link settings negotiated and verify it in |
| 1051 | 1051 | * the EEE advertising registers. |
| 1052 | 1052 | */ |
| 1053 | 1053 | eee_lp = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_LPABLE, |
| 1054 | 1054 | MDIO_MMD_AN, phydev->addr); |
| 1055 | − if (eee_lp < 0) | |
| 1056 | − return eee_lp; | |
| 1055 | + if (eee_lp <= 0) | |
| 1056 | + goto eee_exit_err; | |
| 1057 | 1057 | |
| 1058 | 1058 | eee_adv = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_ADV, |
| 1059 | 1059 | MDIO_MMD_AN, phydev->addr); |
| 1060 | − if (eee_adv < 0) | |
| 1061 | − return eee_adv; | |
| 1060 | + if (eee_adv <= 0) | |
| 1061 | + goto eee_exit_err; | |
| 1062 | 1062 | |
| 1063 | 1063 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); |
| 1064 | 1064 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); |
| 1065 | 1065 | idx = phy_find_setting(phydev->speed, phydev->duplex); |
| 1066 | 1066 | if (!(lp & adv & settings[idx].setting)) |
| 1067 | − return -EPROTONOSUPPORT; | |
| 1067 | + goto eee_exit_err; | |
| 1068 | 1068 | |
| 1069 | 1069 | if (clk_stop_enable) { |
| 1070 | 1070 | /* Configure the PHY to stop receiving xMII |
| @@ -1084,7 +1084,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) · 13 unmodified lines | ||
| 1084 | 1084 | |
| 1085 | 1085 | return 0; /* EEE supported */ |
| 1086 | 1086 | } |
| 1087 | − | |
| 1087 | +eee_exit_err: | |
| 1088 | 1088 | return -EPROTONOSUPPORT; |
| 1089 | 1089 | } |
| 1090 | 1090 | EXPORT_SYMBOL(phy_init_eee); |
| @@ -2056,7 +2056,6 @@ vmxnet3_set_mc(struct net_device *netdev) · 2055 unmodified lines | ||
| 2056 | 2056 | if (!netdev_mc_empty(netdev)) { |
| 2057 | 2057 | new_table = vmxnet3_copy_mc(netdev); |
| 2058 | 2058 | if (new_table) { |
| 2059 | − new_mode |= VMXNET3_RXM_MCAST; | |
| 2060 | 2059 | rxConf->mfTableLen = cpu_to_le16( |
| 2061 | 2060 | netdev_mc_count(netdev) * ETH_ALEN); |
| 2062 | 2061 | new_table_pa = dma_map_single( |
| @@ -2064,15 +2063,18 @@ vmxnet3_set_mc(struct net_device *netdev) · 1 unmodified line | ||
| 2064 | 2063 | new_table, |
| 2065 | 2064 | rxConf->mfTableLen, |
| 2066 | 2065 | PCI_DMA_TODEVICE); |
| 2066 | + } | |
| 2067 | + | |
| 2068 | + if (new_table_pa) { | |
| 2069 | + new_mode |= VMXNET3_RXM_MCAST; | |
| 2067 | 2070 | rxConf->mfTablePA = cpu_to_le64(new_table_pa); |
| 2068 | 2071 | } else { |
| 2069 | − netdev_info(netdev, "failed to copy mcast list" | |
| 2070 | − ", setting ALL_MULTI\n"); | |
| 2072 | + netdev_info(netdev, | |
| 2073 | + "failed to copy mcast list, setting ALL_MULTI\n"); | |
| 2071 | 2074 | new_mode |= VMXNET3_RXM_ALL_MULTI; |
| 2072 | 2075 | } |
| 2073 | 2076 | } |
| 2074 | 2077 | |
| 2075 | − | |
| 2076 | 2078 | if (!(new_mode & VMXNET3_RXM_MCAST)) { |
| 2077 | 2079 | rxConf->mfTableLen = 0; |
| 2078 | 2080 | rxConf->mfTablePA = 0; |
| @@ -2091,11 +2093,10 @@ vmxnet3_set_mc(struct net_device *netdev) · 12 unmodified lines | ||
| 2091 | 2093 | VMXNET3_CMD_UPDATE_MAC_FILTERS); |
| 2092 | 2094 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
| 2093 | 2095 | |
| 2094 | − if (new_table) { | |
| 2096 | + if (new_table_pa) | |
| 2095 | 2097 | dma_unmap_single(&adapter->pdev->dev, new_table_pa, |
| 2096 | 2098 | rxConf->mfTableLen, PCI_DMA_TODEVICE); |
| 2097 | − kfree(new_table); | |
| 2098 | − } | |
| 2099 | + kfree(new_table); | |
| 2099 | 2100 | } |
| 2100 | 2101 | |
| 2101 | 2102 | void |
| @@ -69,10 +69,10 @@ · 68 unmodified lines | ||
| 69 | 69 | /* |
| 70 | 70 | * Version numbers |
| 71 | 71 | */ |
| 72 | −#define VMXNET3_DRIVER_VERSION_STRING "1.2.0.0-k" | |
| 72 | +#define VMXNET3_DRIVER_VERSION_STRING "1.2.1.0-k" | |
| 73 | 73 | |
| 74 | 74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ |
| 75 | −#define VMXNET3_DRIVER_VERSION_NUM 0x01020000 | |
| 75 | +#define VMXNET3_DRIVER_VERSION_NUM 0x01020100 | |
| 76 | 76 | |
| 77 | 77 | #if defined(CONFIG_PCI_MSI) |
| 78 | 78 | /* RSS only makes sense if MSI-X is supported. */ |
| @@ -2423,8 +2423,6 @@ static void at76_delete_device(struct at76_priv *priv) · 2422 unmodified lines | ||
| 2423 | 2423 | |
| 2424 | 2424 | kfree_skb(priv->rx_skb); |
| 2425 | 2425 | |
| 2426 | − usb_put_dev(priv->udev); | |
| 2427 | − | |
| 2428 | 2426 | at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw", |
| 2429 | 2427 | __func__); |
| 2430 | 2428 | ieee80211_free_hw(priv->hw); |
| @@ -2558,6 +2556,7 @@ static void at76_disconnect(struct usb_interface *interface) · 127 unmodified lines | ||
| 2558 | 2556 | |
| 2559 | 2557 | wiphy_info(priv->hw->wiphy, "disconnecting\n"); |
| 2560 | 2558 | at76_delete_device(priv); |
| 2559 | + usb_put_dev(priv->udev); | |
| 2561 | 2560 | dev_info(&interface->dev, "disconnected\n"); |
| 2562 | 2561 | } |
| 2563 | 2562 | |
| @@ -253,7 +253,7 @@ static ssize_t write_file_spec_scan_ctl(struct file *file, · 252 unmodified lines | ||
| 253 | 253 | |
| 254 | 254 | if (strncmp("trigger", buf, 7) == 0) { |
| 255 | 255 | ath9k_spectral_scan_trigger(sc->hw); |
| 256 | − } else if (strncmp("background", buf, 9) == 0) { | |
| 256 | + } else if (strncmp("background", buf, 10) == 0) { | |
| 257 | 257 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_BACKGROUND); |
| 258 | 258 | ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); |
| 259 | 259 | } else if (strncmp("chanscan", buf, 8) == 0) { |
| @@ -51,7 +51,6 @@ config IWLWIFI_LEDS · 50 unmodified lines | ||
| 51 | 51 | |
| 52 | 52 | config IWLDVM |
| 53 | 53 | tristate "Intel Wireless WiFi DVM Firmware support" |
| 54 | − depends on m | |
| 55 | 54 | default IWLWIFI |
| 56 | 55 | help |
| 57 | 56 | This is the driver that supports the DVM firmware which is |
| @@ -60,7 +59,6 @@ config IWLDVM · 2 unmodified lines | ||
| 60 | 59 | |
| 61 | 60 | config IWLMVM |
| 62 | 61 | tristate "Intel Wireless WiFi MVM Firmware support" |
| 63 | − depends on m | |
| 64 | 62 | help |
| 65 | 63 | This is the driver that supports the MVM firmware which is |
| 66 | 64 | currently only available for 7260 and 3160 devices. |
| @@ -1068,6 +1068,13 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) · 1067 unmodified lines | ||
| 1068 | 1068 | /* recalculate basic rates */ |
| 1069 | 1069 | iwl_calc_basic_rates(priv, ctx); |
| 1070 | 1070 | |
| 1071 | + /* | |
| 1072 | + * force CTS-to-self frames protection if RTS-CTS is not preferred | |
| 1073 | + * one aggregation protection method | |
| 1074 | + */ | |
| 1075 | + if (!priv->hw_params.use_rts_for_aggregation) | |
| 1076 | + ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | |
| 1077 | + | |
| 1071 | 1078 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || |
| 1072 | 1079 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) |
| 1073 | 1080 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
| @@ -1473,6 +1480,11 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, · 399 unmodified lines | ||
| 1473 | 1480 | else |
| 1474 | 1481 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; |
| 1475 | 1482 | |
| 1483 | + if (bss_conf->use_cts_prot) | |
| 1484 | + ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | |
| 1485 | + else | |
| 1486 | + ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; | |
| 1487 | + | |
| 1476 | 1488 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); |
| 1477 | 1489 | |
| 1478 | 1490 | if (vif->type == NL80211_IFTYPE_AP || |
| @@ -67,8 +67,8 @@ · 66 unmodified lines | ||
| 67 | 67 | #include "iwl-agn-hw.h" |
| 68 | 68 | |
| 69 | 69 | /* Highest firmware API version supported */ |
| 70 | −#define IWL7260_UCODE_API_MAX 9 | |
| 71 | −#define IWL3160_UCODE_API_MAX 9 | |
| 70 | +#define IWL7260_UCODE_API_MAX 10 | |
| 71 | +#define IWL3160_UCODE_API_MAX 10 | |
| 72 | 72 | |
| 73 | 73 | /* Oldest version we won't warn about */ |
| 74 | 74 | #define IWL7260_UCODE_API_OK 9 |
| @@ -67,7 +67,7 @@ · 66 unmodified lines | ||
| 67 | 67 | #include "iwl-agn-hw.h" |
| 68 | 68 | |
| 69 | 69 | /* Highest firmware API version supported */ |
| 70 | −#define IWL8000_UCODE_API_MAX 9 | |
| 70 | +#define IWL8000_UCODE_API_MAX 10 | |
| 71 | 71 | |
| 72 | 72 | /* Oldest version we won't warn about */ |
| 73 | 73 | #define IWL8000_UCODE_API_OK 8 |
| @@ -101,7 +101,7 @@ static bool halbtc_legacy(struct rtl_priv *adapter) · 100 unmodified lines | ||
| 101 | 101 | |
| 102 | 102 | bool is_legacy = false; |
| 103 | 103 | |
| 104 | − if ((mac->mode == WIRELESS_MODE_B) || (mac->mode == WIRELESS_MODE_B)) | |
| 104 | + if ((mac->mode == WIRELESS_MODE_B) || (mac->mode == WIRELESS_MODE_G)) | |
| 105 | 105 | is_legacy = true; |
| 106 | 106 | |
| 107 | 107 | return is_legacy; |
| @@ -317,6 +317,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { · 316 unmodified lines | ||
| 317 | 317 | {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ |
| 318 | 318 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
| 319 | 319 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
| 320 | + {RTL_USB_DEVICE(0x0df6, 0x0070, rtl92cu_hal_cfg)}, /*Sitecom - 150N */ | |
| 320 | 321 | {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ |
| 321 | 322 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ |
| 322 | 323 | {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ |
| @@ -576,6 +576,9 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, · 575 unmodified lines | ||
| 576 | 576 | init_waitqueue_head(&queue->dealloc_wq); |
| 577 | 577 | atomic_set(&queue->inflight_packets, 0); |
| 578 | 578 | |
| 579 | + netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, | |
| 580 | + XENVIF_NAPI_WEIGHT); | |
| 581 | + | |
| 579 | 582 | if (tx_evtchn == rx_evtchn) { |
| 580 | 583 | /* feature-split-event-channels == 0 */ |
| 581 | 584 | err = bind_interdomain_evtchn_to_irqhandler( |
| @@ -629,9 +632,6 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, · 47 unmodified lines | ||
| 629 | 632 | wake_up_process(queue->task); |
| 630 | 633 | wake_up_process(queue->dealloc_task); |
| 631 | 634 | |
| 632 | − netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, | |
| 633 | − XENVIF_NAPI_WEIGHT); | |
| 634 | − | |
| 635 | 635 | return 0; |
| 636 | 636 | |
| 637 | 637 | err_rx_unbind: |
| @@ -56,7 +56,7 @@ config PCI_HOST_GENERIC · 55 unmodified lines | ||
| 56 | 56 | controller, such as the one emulated by kvmtool. |
| 57 | 57 | |
| 58 | 58 | config PCIE_SPEAR13XX |
| 59 | − tristate "STMicroelectronics SPEAr PCIe controller" | |
| 59 | + bool "STMicroelectronics SPEAr PCIe controller" | |
| 60 | 60 | depends on ARCH_SPEAR13XX |
| 61 | 61 | select PCIEPORTBUS |
| 62 | 62 | select PCIE_DW |
| @@ -620,8 +620,7 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s, · 619 unmodified lines | ||
| 620 | 620 | } else |
| 621 | 621 | seq_printf(s, " %-9s", chip->get(chip, offset) ? "hi" : "lo"); |
| 622 | 622 | |
| 623 | − if (pctldev) | |
| 624 | − mode = abx500_get_mode(pctldev, chip, offset); | |
| 623 | + mode = abx500_get_mode(pctldev, chip, offset); | |
| 625 | 624 | |
| 626 | 625 | seq_printf(s, " %s", (mode < 0) ? "unknown" : modes[mode]); |
| 627 | 626 | |
| @@ -497,10 +497,10 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = { · 496 unmodified lines | ||
| 497 | 497 | static void at91_pin_dbg(const struct device *dev, const struct at91_pmx_pin *pin) |
| 498 | 498 | { |
| 499 | 499 | if (pin->mux) { |
| 500 | − dev_dbg(dev, "pio%c%d configured as periph%c with conf = 0x%lu\n", | |
| 500 | + dev_dbg(dev, "pio%c%d configured as periph%c with conf = 0x%lx\n", | |
| 501 | 501 | pin->bank + 'A', pin->pin, pin->mux - 1 + 'A', pin->conf); |
| 502 | 502 | } else { |
| 503 | − dev_dbg(dev, "pio%c%d configured as gpio with conf = 0x%lu\n", | |
| 503 | + dev_dbg(dev, "pio%c%d configured as gpio with conf = 0x%lx\n", | |
| 504 | 504 | pin->bank + 'A', pin->pin, pin->conf); |
| 505 | 505 | } |
| 506 | 506 | } |
| @@ -438,7 +438,7 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) · 437 unmodified lines | ||
| 438 | 438 | int reg, ret, mask; |
| 439 | 439 | unsigned long flags; |
| 440 | 440 | u8 bit; |
| 441 | − u32 data; | |
| 441 | + u32 data, rmask; | |
| 442 | 442 | |
| 443 | 443 | if (iomux_num > 3) |
| 444 | 444 | return -EINVAL; |
| @@ -478,8 +478,9 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) · 33 unmodified lines | ||
| 478 | 478 | spin_lock_irqsave(&bank->slock, flags); |
| 479 | 479 | |
| 480 | 480 | data = (mask << (bit + 16)); |
| 481 | + rmask = data | (data >> 16); | |
| 481 | 482 | data |= (mux & mask) << bit; |
| 482 | − ret = regmap_write(regmap, reg, data); | |
| 483 | + ret = regmap_update_bits(regmap, reg, rmask, data); | |
| 483 | 484 | |
| 484 | 485 | spin_unlock_irqrestore(&bank->slock, flags); |
| 485 | 486 | |
| @@ -634,7 +635,7 @@ static int rk3288_set_drive(struct rockchip_pin_bank *bank, int pin_num, · 148 unmodified lines | ||
| 634 | 635 | struct regmap *regmap; |
| 635 | 636 | unsigned long flags; |
| 636 | 637 | int reg, ret, i; |
| 637 | − u32 data; | |
| 638 | + u32 data, rmask; | |
| 638 | 639 | u8 bit; |
| 639 | 640 | |
| 640 | 641 | rk3288_calc_drv_reg_and_bit(bank, pin_num, ®map, ®, &bit); |
| @@ -657,9 +658,10 @@ static int rk3288_set_drive(struct rockchip_pin_bank *bank, int pin_num, · 16 unmodified lines | ||
| 657 | 658 | |
| 658 | 659 | /* enable the write to the equivalent lower bits */ |
| 659 | 660 | data = ((1 << RK3288_DRV_BITS_PER_PIN) - 1) << (bit + 16); |
| 661 | + rmask = data | (data >> 16); | |
| 660 | 662 | data |= (ret << bit); |
| 661 | 663 | |
| 662 | − ret = regmap_write(regmap, reg, data); | |
| 664 | + ret = regmap_update_bits(regmap, reg, rmask, data); | |
| 663 | 665 | spin_unlock_irqrestore(&bank->slock, flags); |
| 664 | 666 | |
| 665 | 667 | return ret; |
| @@ -722,7 +724,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, · 56 unmodified lines | ||
| 722 | 724 | int reg, ret; |
| 723 | 725 | unsigned long flags; |
| 724 | 726 | u8 bit; |
| 725 | − u32 data; | |
| 727 | + u32 data, rmask; | |
| 726 | 728 | |
| 727 | 729 | dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n", |
| 728 | 730 | bank->bank_num, pin_num, pull); |
| @@ -750,6 +752,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, · 21 unmodified lines | ||
| 750 | 752 | |
| 751 | 753 | /* enable the write to the equivalent lower bits */ |
| 752 | 754 | data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16); |
| 755 | + rmask = data | (data >> 16); | |
| 753 | 756 | |
| 754 | 757 | switch (pull) { |
| 755 | 758 | case PIN_CONFIG_BIAS_DISABLE: |
| @@ -770,7 +773,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, · 14 unmodified lines | ||
| 770 | 773 | return -EINVAL; |
| 771 | 774 | } |
| 772 | 775 | |
| 773 | − ret = regmap_write(regmap, reg, data); | |
| 776 | + ret = regmap_update_bits(regmap, reg, rmask, data); | |
| 774 | 777 | |
| 775 | 778 | spin_unlock_irqrestore(&bank->slock, flags); |
| 776 | 779 | break; |
| @@ -680,7 +680,7 @@ static struct phy *tegra_xusb_padctl_xlate(struct device *dev, · 679 unmodified lines | ||
| 680 | 680 | if (args->args_count <= 0) |
| 681 | 681 | return ERR_PTR(-EINVAL); |
| 682 | 682 | |
| 683 | − if (index > ARRAY_SIZE(padctl->phys)) | |
| 683 | + if (index >= ARRAY_SIZE(padctl->phys)) | |
| 684 | 684 | return ERR_PTR(-EINVAL); |
| 685 | 685 | |
| 686 | 686 | return padctl->phys[index]; |
| @@ -930,7 +930,8 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev) · 243 unmodified lines | ||
| 930 | 930 | |
| 931 | 931 | padctl->provider = devm_of_phy_provider_register(&pdev->dev, |
| 932 | 932 | tegra_xusb_padctl_xlate); |
| 933 | − if (err < 0) { | |
| 933 | + if (IS_ERR(padctl->provider)) { | |
| 934 | + err = PTR_ERR(padctl->provider); | |
| 934 | 935 | dev_err(&pdev->dev, "failed to register PHYs: %d\n", err); |
| 935 | 936 | goto unregister; |
| 936 | 937 | } |
| @@ -127,14 +127,10 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) · 126 unmodified lines | ||
| 127 | 127 | struct irq_chip *chip = irq_data_get_irq_chip(irqd); |
| 128 | 128 | struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); |
| 129 | 129 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
| 130 | − struct samsung_pin_bank_type *bank_type = bank->type; | |
| 131 | 130 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
| 132 | − unsigned int pin = irqd->hwirq; | |
| 133 | − unsigned int shift = EXYNOS_EINT_CON_LEN * pin; | |
| 131 | + unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; | |
| 134 | 132 | unsigned int con, trig_type; |
| 135 | 133 | unsigned long reg_con = our_chip->eint_con + bank->eint_offset; |
| 136 | − unsigned long flags; | |
| 137 | − unsigned int mask; | |
| 138 | 134 | |
| 139 | 135 | switch (type) { |
| 140 | 136 | case IRQ_TYPE_EDGE_RISING: |
| @@ -167,8 +163,32 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) · 26 unmodified lines | ||
| 167 | 163 | con |= trig_type << shift; |
| 168 | 164 | writel(con, d->virt_base + reg_con); |
| 169 | 165 | |
| 166 | + return 0; | |
| 167 | +} | |
| 168 | + | |
| 169 | +static int exynos_irq_request_resources(struct irq_data *irqd) | |
| 170 | +{ | |
| 171 | + struct irq_chip *chip = irq_data_get_irq_chip(irqd); | |
| 172 | + struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); | |
| 173 | + struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); | |
| 174 | + struct samsung_pin_bank_type *bank_type = bank->type; | |
| 175 | + struct samsung_pinctrl_drv_data *d = bank->drvdata; | |
| 176 | + unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; | |
| 177 | + unsigned long reg_con = our_chip->eint_con + bank->eint_offset; | |
| 178 | + unsigned long flags; | |
| 179 | + unsigned int mask; | |
| 180 | + unsigned int con; | |
| 181 | + int ret; | |
| 182 | + | |
| 183 | + ret = gpio_lock_as_irq(&bank->gpio_chip, irqd->hwirq); | |
| 184 | + if (ret) { | |
| 185 | + dev_err(bank->gpio_chip.dev, "unable to lock pin %s-%lu IRQ\n", | |
| 186 | + bank->name, irqd->hwirq); | |
| 187 | + return ret; | |
| 188 | + } | |
| 189 | + | |
| 170 | 190 | reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; |
| 171 | − shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC]; | |
| 191 | + shift = irqd->hwirq * bank_type->fld_width[PINCFG_TYPE_FUNC]; | |
| 172 | 192 | mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; |
| 173 | 193 | |
| 174 | 194 | spin_lock_irqsave(&bank->slock, flags); |
| @@ -180,9 +200,42 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) · 5 unmodified lines | ||
| 180 | 200 | |
| 181 | 201 | spin_unlock_irqrestore(&bank->slock, flags); |
| 182 | 202 | |
| 203 | + exynos_irq_unmask(irqd); | |
| 204 | + | |
| 183 | 205 | return 0; |
| 184 | 206 | } |
| 185 | 207 | |
| 208 | +static void exynos_irq_release_resources(struct irq_data *irqd) | |
| 209 | +{ | |
| 210 | + struct irq_chip *chip = irq_data_get_irq_chip(irqd); | |
| 211 | + struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); | |
| 212 | + struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); | |
| 213 | + struct samsung_pin_bank_type *bank_type = bank->type; | |
| 214 | + struct samsung_pinctrl_drv_data *d = bank->drvdata; | |
| 215 | + unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; | |
| 216 | + unsigned long reg_con = our_chip->eint_con + bank->eint_offset; | |
| 217 | + unsigned long flags; | |
| 218 | + unsigned int mask; | |
| 219 | + unsigned int con; | |
| 220 | + | |
| 221 | + reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; | |
| 222 | + shift = irqd->hwirq * bank_type->fld_width[PINCFG_TYPE_FUNC]; | |
| 223 | + mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; | |
| 224 | + | |
| 225 | + exynos_irq_mask(irqd); | |
| 226 | + | |
| 227 | + spin_lock_irqsave(&bank->slock, flags); | |
| 228 | + | |
| 229 | + con = readl(d->virt_base + reg_con); | |
| 230 | + con &= ~(mask << shift); | |
| 231 | + con |= FUNC_INPUT << shift; | |
| 232 | + writel(con, d->virt_base + reg_con); | |
| 233 | + | |
| 234 | + spin_unlock_irqrestore(&bank->slock, flags); | |
| 235 | + | |
| 236 | + gpio_unlock_as_irq(&bank->gpio_chip, irqd->hwirq); | |
| 237 | +} | |
| 238 | + | |
| 186 | 239 | /* |
| 187 | 240 | * irq_chip for gpio interrupts. |
| 188 | 241 | */ |
| @@ -193,6 +246,8 @@ static struct exynos_irq_chip exynos_gpio_irq_chip = { · 4 unmodified lines | ||
| 193 | 246 | .irq_mask = exynos_irq_mask, |
| 194 | 247 | .irq_ack = exynos_irq_ack, |
| 195 | 248 | .irq_set_type = exynos_irq_set_type, |
| 249 | + .irq_request_resources = exynos_irq_request_resources, | |
| 250 | + .irq_release_resources = exynos_irq_release_resources, | |
| 196 | 251 | }, |
| 197 | 252 | .eint_con = EXYNOS_GPIO_ECON_OFFSET, |
| 198 | 253 | .eint_mask = EXYNOS_GPIO_EMASK_OFFSET, |
| @@ -336,6 +391,8 @@ static struct exynos_irq_chip exynos_wkup_irq_chip = { · 137 unmodified lines | ||
| 336 | 391 | .irq_ack = exynos_irq_ack, |
| 337 | 392 | .irq_set_type = exynos_irq_set_type, |
| 338 | 393 | .irq_set_wake = exynos_wkup_irq_set_wake, |
| 394 | + .irq_request_resources = exynos_irq_request_resources, | |
| 395 | + .irq_release_resources = exynos_irq_release_resources, | |
| 339 | 396 | }, |
| 340 | 397 | .eint_con = EXYNOS_WKUP_ECON_OFFSET, |
| 341 | 398 | .eint_mask = EXYNOS_WKUP_EMASK_OFFSET, |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <linux/gpio.h> |
| 27 | 27 | |
| 28 | 28 | /* pinmux function number for pin as gpio output line */ |
| 29 | +#define FUNC_INPUT 0x0 | |
| 29 | 30 | #define FUNC_OUTPUT 0x1 |
| 30 | 31 | |
| 31 | 32 | /** |
| @@ -4509,24 +4509,24 @@ static const char * const audio_clk_groups[] = { · 4508 unmodified lines | ||
| 4509 | 4509 | }; |
| 4510 | 4510 | |
| 4511 | 4511 | static const char * const can0_groups[] = { |
| 4512 | − "can0_data_a", | |
| 4512 | + "can0_data", | |
| 4513 | 4513 | "can0_data_b", |
| 4514 | 4514 | "can0_data_c", |
| 4515 | 4515 | "can0_data_d", |
| 4516 | 4516 | "can0_data_e", |
| 4517 | 4517 | "can0_data_f", |
| 4518 | − "can_clk_a", | |
| 4518 | + "can_clk", | |
| 4519 | 4519 | "can_clk_b", |
| 4520 | 4520 | "can_clk_c", |
| 4521 | 4521 | "can_clk_d", |
| 4522 | 4522 | }; |
| 4523 | 4523 | |
| 4524 | 4524 | static const char * const can1_groups[] = { |
| 4525 | − "can1_data_a", | |
| 4525 | + "can1_data", | |
| 4526 | 4526 | "can1_data_b", |
| 4527 | 4527 | "can1_data_c", |
| 4528 | 4528 | "can1_data_d", |
| 4529 | − "can_clk_a", | |
| 4529 | + "can_clk", | |
| 4530 | 4530 | "can_clk_b", |
| 4531 | 4531 | "can_clk_c", |
| 4532 | 4532 | "can_clk_d", |
| @@ -88,7 +88,6 @@ struct ideapad_private { · 87 unmodified lines | ||
| 88 | 88 | struct dentry *debug; |
| 89 | 89 | unsigned long cfg; |
| 90 | 90 | bool has_hw_rfkill_switch; |
| 91 | − bool has_touchpad_control; | |
| 92 | 91 | }; |
| 93 | 92 | |
| 94 | 93 | static bool no_bt_rfkill; |
| @@ -456,7 +455,7 @@ struct ideapad_rfk_data { · 361 unmodified lines | ||
| 456 | 455 | int type; |
| 457 | 456 | }; |
| 458 | 457 | |
| 459 | −const const struct ideapad_rfk_data ideapad_rfk_data[] = { | |
| 458 | +static const struct ideapad_rfk_data ideapad_rfk_data[] = { | |
| 460 | 459 | { "ideapad_wlan", CFG_WIFI_BIT, VPCCMD_W_WIFI, RFKILL_TYPE_WLAN }, |
| 461 | 460 | { "ideapad_bluetooth", CFG_BT_BIT, VPCCMD_W_BT, RFKILL_TYPE_BLUETOOTH }, |
| 462 | 461 | { "ideapad_3g", CFG_3G_BIT, VPCCMD_W_3G, RFKILL_TYPE_WWAN }, |
| @@ -767,9 +766,6 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv) · 304 unmodified lines | ||
| 767 | 766 | { |
| 768 | 767 | unsigned long value; |
| 769 | 768 | |
| 770 | − if (!priv->has_touchpad_control) | |
| 771 | − return; | |
| 772 | − | |
| 773 | 769 | /* Without reading from EC touchpad LED doesn't switch state */ |
| 774 | 770 | if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { |
| 775 | 771 | /* Some IdeaPads don't really turn off touchpad - they only |
| @@ -833,29 +829,7 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data) · 57 unmodified lines | ||
| 833 | 829 | * always results in 0 on these models, causing ideapad_laptop to wrongly |
| 834 | 830 | * report all radios as hardware-blocked. |
| 835 | 831 | */ |
| 836 | −static struct dmi_system_id no_hw_rfkill_list[] = { | |
| 837 | − { | |
| 838 | − .ident = "Lenovo Yoga 2 11 / 13 / Pro", | |
| 839 | − .matches = { | |
| 840 | − DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 841 | − DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"), | |
| 842 | − }, | |
| 843 | − }, | |
| 844 | − {} | |
| 845 | −}; | |
| 846 | − | |
| 847 | −/* | |
| 848 | − * Some models don't offer touchpad ctrl through the ideapad interface, causing | |
| 849 | − * ideapad_sync_touchpad_state to send wrong touchpad enable/disable events. | |
| 850 | − */ | |
| 851 | −static struct dmi_system_id no_touchpad_ctrl_list[] = { | |
| 852 | − { | |
| 853 | − .ident = "Lenovo Yoga 1 series", | |
| 854 | − .matches = { | |
| 855 | − DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 856 | − DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga"), | |
| 857 | − }, | |
| 858 | − }, | |
| 832 | +static const struct dmi_system_id no_hw_rfkill_list[] = { | |
| 859 | 833 | { |
| 860 | 834 | .ident = "Lenovo Yoga 2 11 / 13 / Pro", |
| 861 | 835 | .matches = { |
| @@ -889,7 +863,6 @@ static int ideapad_acpi_add(struct platform_device *pdev) · 27 unmodified lines | ||
| 889 | 863 | priv->adev = adev; |
| 890 | 864 | priv->platform_device = pdev; |
| 891 | 865 | priv->has_hw_rfkill_switch = !dmi_check_system(no_hw_rfkill_list); |
| 892 | − priv->has_touchpad_control = !dmi_check_system(no_touchpad_ctrl_list); | |
| 893 | 866 | |
| 894 | 867 | ret = ideapad_sysfs_init(priv); |
| 895 | 868 | if (ret) |
| @@ -1255,10 +1255,15 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, · 1254 unmodified lines | ||
| 1255 | 1255 | const char *buf, size_t count) |
| 1256 | 1256 | { |
| 1257 | 1257 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); |
| 1258 | − int mode = -1; | |
| 1259 | − int time = -1; | |
| 1258 | + int mode; | |
| 1259 | + int time; | |
| 1260 | + int ret; | |
| 1260 | 1261 | |
| 1261 | − if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1)) | |
| 1262 | + | |
| 1263 | + ret = kstrtoint(buf, 0, &mode); | |
| 1264 | + if (ret) | |
| 1265 | + return ret; | |
| 1266 | + if (mode != SCI_KBD_MODE_FNZ && mode != SCI_KBD_MODE_AUTO) | |
| 1262 | 1267 | return -EINVAL; |
| 1263 | 1268 | |
| 1264 | 1269 | /* Set the Keyboard Backlight Mode where: |
| @@ -1266,11 +1271,12 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, · 1 unmodified line | ||
| 1266 | 1271 | * Auto - KBD backlight turns off automatically in given time |
| 1267 | 1272 | * FN-Z - KBD backlight "toggles" when hotkey pressed |
| 1268 | 1273 | */ |
| 1269 | − if (mode != -1 && toshiba->kbd_mode != mode) { | |
| 1274 | + if (toshiba->kbd_mode != mode) { | |
| 1270 | 1275 | time = toshiba->kbd_time << HCI_MISC_SHIFT; |
| 1271 | 1276 | time = time + toshiba->kbd_mode; |
| 1272 | − if (toshiba_kbd_illum_status_set(toshiba, time) < 0) | |
| 1273 | − return -EIO; | |
| 1277 | + ret = toshiba_kbd_illum_status_set(toshiba, time); | |
| 1278 | + if (ret) | |
| 1279 | + return ret; | |
| 1274 | 1280 | toshiba->kbd_mode = mode; |
| 1275 | 1281 | } |
| 1276 | 1282 | |
| @@ -1857,9 +1863,16 @@ static int toshiba_acpi_resume(struct device *device) · 580 unmodified lines | ||
| 1857 | 1863 | { |
| 1858 | 1864 | struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device)); |
| 1859 | 1865 | u32 result; |
| 1866 | + acpi_status status; | |
| 1867 | + | |
| 1868 | + if (dev->hotkey_dev) { | |
| 1869 | + status = acpi_evaluate_object(dev->acpi_dev->handle, "ENAB", | |
| 1870 | + NULL, NULL); | |
| 1871 | + if (ACPI_FAILURE(status)) | |
| 1872 | + pr_info("Unable to re-enable hotkeys\n"); | |
| 1860 | 1873 | |
| 1861 | − if (dev->hotkey_dev) | |
| 1862 | 1874 | hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &result); |
| 1875 | + } | |
| 1863 | 1876 | |
| 1864 | 1877 | return 0; |
| 1865 | 1878 | } |
| @@ -953,6 +953,7 @@ static const struct x86_cpu_id rapl_ids[] = { · 952 unmodified lines | ||
| 953 | 953 | { X86_VENDOR_INTEL, 6, 0x3a},/* Ivy Bridge */ |
| 954 | 954 | { X86_VENDOR_INTEL, 6, 0x3c},/* Haswell */ |
| 955 | 955 | { X86_VENDOR_INTEL, 6, 0x3d},/* Broadwell */ |
| 956 | + { X86_VENDOR_INTEL, 6, 0x3f},/* Haswell */ | |
| 956 | 957 | { X86_VENDOR_INTEL, 6, 0x45},/* Haswell ULT */ |
| 957 | 958 | /* TODO: Add more CPU IDs after testing */ |
| 958 | 959 | {} |
| @@ -1166,11 +1167,10 @@ static int rapl_detect_domains(struct rapl_package *rp, int cpu) · 207 unmodified lines | ||
| 1166 | 1167 | |
| 1167 | 1168 | for (i = 0; i < RAPL_DOMAIN_MAX; i++) { |
| 1168 | 1169 | /* use physical package id to read counters */ |
| 1169 | − if (!rapl_check_domain(cpu, i)) | |
| 1170 | + if (!rapl_check_domain(cpu, i)) { | |
| 1170 | 1171 | rp->domain_map |= 1 << i; |
| 1171 | − else | |
| 1172 | − pr_warn("RAPL domain %s detection failed\n", | |
| 1173 | − rapl_domain_names[i]); | |
| 1172 | + pr_info("Found RAPL domain %s\n", rapl_domain_names[i]); | |
| 1173 | + } | |
| 1174 | 1174 | } |
| 1175 | 1175 | rp->nr_domains = bitmap_weight(&rp->domain_map, RAPL_DOMAIN_MAX); |
| 1176 | 1176 | if (!rp->nr_domains) { |
| @@ -717,12 +717,14 @@ static int s5m_rtc_probe(struct platform_device *pdev) · 716 unmodified lines | ||
| 717 | 717 | info->device_type = s5m87xx->device_type; |
| 718 | 718 | info->wtsr_smpl = s5m87xx->wtsr_smpl; |
| 719 | 719 | |
| 720 | − info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); | |
| 721 | − if (info->irq <= 0) { | |
| 722 | − ret = -EINVAL; | |
| 723 | − dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", | |
| 720 | + if (s5m87xx->irq_data) { | |
| 721 | + info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); | |
| 722 | + if (info->irq <= 0) { | |
| 723 | + ret = -EINVAL; | |
| 724 | + dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", | |
| 724 | 725 | alarm_irq); |
| 725 | − goto err; | |
| 726 | + goto err; | |
| 727 | + } | |
| 726 | 728 | } |
| 727 | 729 | |
| 728 | 730 | platform_set_drvdata(pdev, info); |
| @@ -744,6 +746,11 @@ static int s5m_rtc_probe(struct platform_device *pdev) · 15 unmodified lines | ||
| 744 | 746 | goto err; |
| 745 | 747 | } |
| 746 | 748 | |
| 749 | + if (!info->irq) { | |
| 750 | + dev_info(&pdev->dev, "Alarm IRQ not available\n"); | |
| 751 | + return 0; | |
| 752 | + } | |
| 753 | + | |
| 747 | 754 | ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, |
| 748 | 755 | s5m_rtc_alarm_irq, 0, "rtc-alarm0", |
| 749 | 756 | info); |
| @@ -802,7 +809,7 @@ static int s5m_rtc_resume(struct device *dev) · 52 unmodified lines | ||
| 802 | 809 | struct s5m_rtc_info *info = dev_get_drvdata(dev); |
| 803 | 810 | int ret = 0; |
| 804 | 811 | |
| 805 | − if (device_may_wakeup(dev)) | |
| 812 | + if (info->irq && device_may_wakeup(dev)) | |
| 806 | 813 | ret = disable_irq_wake(info->irq); |
| 807 | 814 | |
| 808 | 815 | return ret; |
| @@ -813,7 +820,7 @@ static int s5m_rtc_suspend(struct device *dev) · 4 unmodified lines | ||
| 813 | 820 | struct s5m_rtc_info *info = dev_get_drvdata(dev); |
| 814 | 821 | int ret = 0; |
| 815 | 822 | |
| 816 | − if (device_may_wakeup(dev)) | |
| 823 | + if (info->irq && device_may_wakeup(dev)) | |
| 817 | 824 | ret = enable_irq_wake(info->irq); |
| 818 | 825 | |
| 819 | 826 | return ret; |
| @@ -1035,12 +1035,26 @@ static int tty3215_write(struct tty_struct * tty, · 1034 unmodified lines | ||
| 1035 | 1035 | const unsigned char *buf, int count) |
| 1036 | 1036 | { |
| 1037 | 1037 | struct raw3215_info *raw; |
| 1038 | + int i, written; | |
| 1038 | 1039 | |
| 1039 | 1040 | if (!tty) |
| 1040 | 1041 | return 0; |
| 1041 | 1042 | raw = (struct raw3215_info *) tty->driver_data; |
| 1042 | − raw3215_write(raw, buf, count); | |
| 1043 | − return count; | |
| 1043 | + written = count; | |
| 1044 | + while (count > 0) { | |
| 1045 | + for (i = 0; i < count; i++) | |
| 1046 | + if (buf[i] == '\t' || buf[i] == '\n') | |
| 1047 | + break; | |
| 1048 | + raw3215_write(raw, buf, i); | |
| 1049 | + count -= i; | |
| 1050 | + buf += i; | |
| 1051 | + if (count > 0) { | |
| 1052 | + raw3215_putchar(raw, *buf); | |
| 1053 | + count--; | |
| 1054 | + buf++; | |
| 1055 | + } | |
| 1056 | + } | |
| 1057 | + return written; | |
| 1044 | 1058 | } |
| 1045 | 1059 | |
| 1046 | 1060 | /* |
| @@ -1188,7 +1202,7 @@ static int __init tty3215_init(void) · 141 unmodified lines | ||
| 1188 | 1202 | driver->subtype = SYSTEM_TYPE_TTY; |
| 1189 | 1203 | driver->init_termios = tty_std_termios; |
| 1190 | 1204 | driver->init_termios.c_iflag = IGNBRK | IGNPAR; |
| 1191 | − driver->init_termios.c_oflag = ONLCR | XTABS; | |
| 1205 | + driver->init_termios.c_oflag = ONLCR; | |
| 1192 | 1206 | driver->init_termios.c_lflag = ISIG; |
| 1193 | 1207 | driver->flags = TTY_DRIVER_REAL_RAW; |
| 1194 | 1208 | tty_set_operations(driver, &tty3215_ops); |
| @@ -559,7 +559,7 @@ sclp_tty_init(void) · 558 unmodified lines | ||
| 559 | 559 | driver->subtype = SYSTEM_TYPE_TTY; |
| 560 | 560 | driver->init_termios = tty_std_termios; |
| 561 | 561 | driver->init_termios.c_iflag = IGNBRK | IGNPAR; |
| 562 | − driver->init_termios.c_oflag = ONLCR | XTABS; | |
| 562 | + driver->init_termios.c_oflag = ONLCR; | |
| 563 | 563 | driver->init_termios.c_lflag = ISIG | ECHO; |
| 564 | 564 | driver->flags = TTY_DRIVER_REAL_RAW; |
| 565 | 565 | tty_set_operations(driver, &sclp_ops); |
| @@ -889,6 +889,7 @@ extern const struct attribute_group *qeth_generic_attr_groups[]; · 888 unmodified lines | ||
| 889 | 889 | extern const struct attribute_group *qeth_osn_attr_groups[]; |
| 890 | 890 | extern struct workqueue_struct *qeth_wq; |
| 891 | 891 | |
| 892 | +int qeth_card_hw_is_reachable(struct qeth_card *); | |
| 892 | 893 | const char *qeth_get_cardname_short(struct qeth_card *); |
| 893 | 894 | int qeth_realloc_buffer_pool(struct qeth_card *, int); |
| 894 | 895 | int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id); |
| @@ -73,6 +73,13 @@ static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *, int); · 72 unmodified lines | ||
| 73 | 73 | struct workqueue_struct *qeth_wq; |
| 74 | 74 | EXPORT_SYMBOL_GPL(qeth_wq); |
| 75 | 75 | |
| 76 | +int qeth_card_hw_is_reachable(struct qeth_card *card) | |
| 77 | +{ | |
| 78 | + return (card->state == CARD_STATE_SOFTSETUP) || | |
| 79 | + (card->state == CARD_STATE_UP); | |
| 80 | +} | |
| 81 | +EXPORT_SYMBOL_GPL(qeth_card_hw_is_reachable); | |
| 82 | + | |
| 76 | 83 | static void qeth_close_dev_handler(struct work_struct *work) |
| 77 | 84 | { |
| 78 | 85 | struct qeth_card *card; |
| @@ -5790,6 +5797,7 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, · 5711 unmodified lines | ||
| 5790 | 5797 | struct qeth_card *card = netdev->ml_priv; |
| 5791 | 5798 | enum qeth_link_types link_type; |
| 5792 | 5799 | struct carrier_info carrier_info; |
| 5800 | + int rc; | |
| 5793 | 5801 | u32 speed; |
| 5794 | 5802 | |
| 5795 | 5803 | if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) |
| @@ -5832,8 +5840,14 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, · 36 unmodified lines | ||
| 5832 | 5840 | /* Check if we can obtain more accurate information. */ |
| 5833 | 5841 | /* If QUERY_CARD_INFO command is not supported or fails, */ |
| 5834 | 5842 | /* just return the heuristics that was filled above. */ |
| 5835 | − if (qeth_query_card_info(card, &carrier_info) != 0) | |
| 5843 | + if (!qeth_card_hw_is_reachable(card)) | |
| 5844 | + return -ENODEV; | |
| 5845 | + rc = qeth_query_card_info(card, &carrier_info); | |
| 5846 | + if (rc == -EOPNOTSUPP) /* for old hardware, return heuristic */ | |
| 5836 | 5847 | return 0; |
| 5848 | + if (rc) /* report error from the hardware operation */ | |
| 5849 | + return rc; | |
| 5850 | + /* on success, fill in the information got from the hardware */ | |
| 5837 | 5851 | |
| 5838 | 5852 | netdev_dbg(netdev, |
| 5839 | 5853 | "card info: card_type=0x%02x, port_mode=0x%04x, port_speed=0x%08x\n", |
| @@ -5,17 +5,12 @@ · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | #include <linux/slab.h> |
| 7 | 7 | #include <asm/ebcdic.h> |
| 8 | +#include "qeth_core.h" | |
| 8 | 9 | #include "qeth_l2.h" |
| 9 | 10 | |
| 10 | 11 | #define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \ |
| 11 | 12 | struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store) |
| 12 | 13 | |
| 13 | −static int qeth_card_hw_is_reachable(struct qeth_card *card) | |
| 14 | −{ | |
| 15 | − return (card->state == CARD_STATE_SOFTSETUP) || | |
| 16 | − (card->state == CARD_STATE_UP); | |
| 17 | −} | |
| 18 | − | |
| 19 | 14 | static ssize_t qeth_bridge_port_role_state_show(struct device *dev, |
| 20 | 15 | struct device_attribute *attr, char *buf, |
| 21 | 16 | int show_state) |
| @@ -1808,7 +1808,6 @@ static int scsi_mq_prep_fn(struct request *req) · 1807 unmodified lines | ||
| 1808 | 1808 | |
| 1809 | 1809 | cmd->tag = req->tag; |
| 1810 | 1810 | |
| 1811 | − req->cmd = req->__cmd; | |
| 1812 | 1811 | cmd->cmnd = req->cmd; |
| 1813 | 1812 | cmd->prot_op = SCSI_PROT_NORMAL; |
| 1814 | 1813 | |
| @@ -1,8 +1,7 @@ | ||
| 1 | 1 | # |
| 2 | 2 | # Makefile for the SuperH specific drivers. |
| 3 | 3 | # |
| 4 | −obj-$(CONFIG_SUPERH) += intc/ | |
| 5 | −obj-$(CONFIG_ARCH_SHMOBILE_LEGACY) += intc/ | |
| 4 | +obj-$(CONFIG_SH_INTC) += intc/ | |
| 6 | 5 | ifneq ($(CONFIG_COMMON_CLK),y) |
| 7 | 6 | obj-$(CONFIG_HAVE_CLK) += clk/ |
| 8 | 7 | endif |
| @@ -1,7 +1,9 @@ | ||
| 1 | 1 | config SH_INTC |
| 2 | − def_bool y | |
| 2 | + bool | |
| 3 | 3 | select IRQ_DOMAIN |
| 4 | 4 | |
| 5 | +if SH_INTC | |
| 6 | + | |
| 5 | 7 | comment "Interrupt controller options" |
| 6 | 8 | |
| 7 | 9 | config INTC_USERIMASK |
| @@ -37,3 +39,5 @@ config INTC_MAPPING_DEBUG · 29 unmodified lines | ||
| 37 | 39 | between system IRQs and the per-controller id tables. |
| 38 | 40 | |
| 39 | 41 | If in doubt, say N. |
| 42 | + | |
| 43 | +endif | |
| @@ -945,7 +945,7 @@ static int au1550_spi_remove(struct platform_device *pdev) · 944 unmodified lines | ||
| 945 | 945 | spi_bitbang_stop(&hw->bitbang); |
| 946 | 946 | free_irq(hw->irq, hw); |
| 947 | 947 | iounmap((void __iomem *)hw->regs); |
| 948 | − release_mem_region(r->start, sizeof(psc_spi_t)); | |
| 948 | + release_mem_region(hw->ioarea->start, sizeof(psc_spi_t)); | |
| 949 | 949 | |
| 950 | 950 | if (hw->usedma) { |
| 951 | 951 | au1550_spi_dma_rxtmp_free(hw); |
| @@ -417,16 +417,16 @@ static int davinci_spi_setup(struct spi_device *spi) · 416 unmodified lines | ||
| 417 | 417 | flags, dev_name(&spi->dev)); |
| 418 | 418 | internal_cs = false; |
| 419 | 419 | } |
| 420 | − } | |
| 421 | 420 | |
| 422 | − if (retval) { | |
| 423 | − dev_err(&spi->dev, "GPIO %d setup failed (%d)\n", | |
| 424 | − spi->cs_gpio, retval); | |
| 425 | − return retval; | |
| 426 | − } | |
| 421 | + if (retval) { | |
| 422 | + dev_err(&spi->dev, "GPIO %d setup failed (%d)\n", | |
| 423 | + spi->cs_gpio, retval); | |
| 424 | + return retval; | |
| 425 | + } | |
| 427 | 426 | |
| 428 | − if (internal_cs) | |
| 429 | − set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); | |
| 427 | + if (internal_cs) | |
| 428 | + set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); | |
| 429 | + } | |
| 430 | 430 | |
| 431 | 431 | if (spi->mode & SPI_READY) |
| 432 | 432 | set_io_bits(dspi->base + SPIPC0, SPIPC0_SPIENA_MASK); |
| @@ -62,6 +62,8 @@ static int spi_pci_probe(struct pci_dev *pdev, · 61 unmodified lines | ||
| 62 | 62 | if (ret) |
| 63 | 63 | return ret; |
| 64 | 64 | |
| 65 | + dws->regs = pcim_iomap_table(pdev)[pci_bar]; | |
| 66 | + | |
| 65 | 67 | dws->bus_num = 0; |
| 66 | 68 | dws->num_cs = 4; |
| 67 | 69 | dws->irq = pdev->irq; |
| @@ -271,7 +271,7 @@ static void giveback(struct dw_spi *dws) · 270 unmodified lines | ||
| 271 | 271 | transfer_list); |
| 272 | 272 | |
| 273 | 273 | if (!last_transfer->cs_change) |
| 274 | − spi_chip_sel(dws, dws->cur_msg->spi, 0); | |
| 274 | + spi_chip_sel(dws, msg->spi, 0); | |
| 275 | 275 | |
| 276 | 276 | spi_finalize_current_message(dws->master); |
| 277 | 277 | } |
| @@ -329,7 +329,8 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi, · 328 unmodified lines | ||
| 329 | 329 | disable_fifo: |
| 330 | 330 | if (t->rx_buf != NULL) |
| 331 | 331 | chconf &= ~OMAP2_MCSPI_CHCONF_FFER; |
| 332 | − else | |
| 332 | + | |
| 333 | + if (t->tx_buf != NULL) | |
| 333 | 334 | chconf &= ~OMAP2_MCSPI_CHCONF_FFET; |
| 334 | 335 | |
| 335 | 336 | mcspi_write_chconf0(spi, chconf); |
| @@ -1074,6 +1074,7 @@ static struct acpi_device_id pxa2xx_spi_acpi_match[] = { · 1073 unmodified lines | ||
| 1074 | 1074 | { "INT3430", 0 }, |
| 1075 | 1075 | { "INT3431", 0 }, |
| 1076 | 1076 | { "80860F0E", 0 }, |
| 1077 | + { "8086228E", 0 }, | |
| 1077 | 1078 | { }, |
| 1078 | 1079 | }; |
| 1079 | 1080 | MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); |
| @@ -499,7 +499,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs) · 498 unmodified lines | ||
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /* div doesn't support odd number */ |
| 502 | − div = rs->max_freq / rs->speed; | |
| 502 | + div = max_t(u32, rs->max_freq / rs->speed, 1); | |
| 503 | 503 | div = (div + 1) & 0xfffe; |
| 504 | 504 | |
| 505 | 505 | spi_enable_chip(rs, 0); |
| @@ -678,7 +678,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) · 172 unmodified lines | ||
| 678 | 678 | rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); |
| 679 | 679 | rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); |
| 680 | 680 | rs->dma_tx.direction = DMA_MEM_TO_DEV; |
| 681 | − rs->dma_tx.direction = DMA_DEV_TO_MEM; | |
| 681 | + rs->dma_rx.direction = DMA_DEV_TO_MEM; | |
| 682 | 682 | |
| 683 | 683 | master->can_dma = rockchip_spi_can_dma; |
| 684 | 684 | master->dma_tx = rs->dma_tx.ch; |
| @@ -472,25 +472,52 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, · 471 unmodified lines | ||
| 472 | 472 | dma_cookie_t cookie; |
| 473 | 473 | int ret; |
| 474 | 474 | |
| 475 | − if (tx) { | |
| 476 | − desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx, | |
| 477 | − tx->sgl, tx->nents, DMA_TO_DEVICE, | |
| 478 | − DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | |
| 479 | − if (!desc_tx) | |
| 480 | − goto no_dma; | |
| 481 | − | |
| 482 | − irq_mask |= SPCR_SPTIE; | |
| 483 | − } | |
| 475 | + /* First prepare and submit the DMA request(s), as this may fail */ | |
| 484 | 476 | if (rx) { |
| 485 | 477 | desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx, |
| 486 | 478 | rx->sgl, rx->nents, DMA_FROM_DEVICE, |
| 487 | 479 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 488 | − if (!desc_rx) | |
| 489 | − goto no_dma; | |
| 480 | + if (!desc_rx) { | |
| 481 | + ret = -EAGAIN; | |
| 482 | + goto no_dma_rx; | |
| 483 | + } | |
| 484 | + | |
| 485 | + desc_rx->callback = rspi_dma_complete; | |
| 486 | + desc_rx->callback_param = rspi; | |
| 487 | + cookie = dmaengine_submit(desc_rx); | |
| 488 | + if (dma_submit_error(cookie)) { | |
| 489 | + ret = cookie; | |
| 490 | + goto no_dma_rx; | |
| 491 | + } | |
| 490 | 492 | |
| 491 | 493 | irq_mask |= SPCR_SPRIE; |
| 492 | 494 | } |
| 493 | 495 | |
| 496 | + if (tx) { | |
| 497 | + desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx, | |
| 498 | + tx->sgl, tx->nents, DMA_TO_DEVICE, | |
| 499 | + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | |
| 500 | + if (!desc_tx) { | |
| 501 | + ret = -EAGAIN; | |
| 502 | + goto no_dma_tx; | |
| 503 | + } | |
| 504 | + | |
| 505 | + if (rx) { | |
| 506 | + /* No callback */ | |
| 507 | + desc_tx->callback = NULL; | |
| 508 | + } else { | |
| 509 | + desc_tx->callback = rspi_dma_complete; | |
| 510 | + desc_tx->callback_param = rspi; | |
| 511 | + } | |
| 512 | + cookie = dmaengine_submit(desc_tx); | |
| 513 | + if (dma_submit_error(cookie)) { | |
| 514 | + ret = cookie; | |
| 515 | + goto no_dma_tx; | |
| 516 | + } | |
| 517 | + | |
| 518 | + irq_mask |= SPCR_SPTIE; | |
| 519 | + } | |
| 520 | + | |
| 494 | 521 | /* |
| 495 | 522 | * DMAC needs SPxIE, but if SPxIE is set, the IRQ routine will be |
| 496 | 523 | * called. So, this driver disables the IRQ while DMA transfer. |
| @@ -503,34 +530,24 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, · 6 unmodified lines | ||
| 503 | 530 | rspi_enable_irq(rspi, irq_mask); |
| 504 | 531 | rspi->dma_callbacked = 0; |
| 505 | 532 | |
| 506 | − if (rx) { | |
| 507 | − desc_rx->callback = rspi_dma_complete; | |
| 508 | − desc_rx->callback_param = rspi; | |
| 509 | − cookie = dmaengine_submit(desc_rx); | |
| 510 | − if (dma_submit_error(cookie)) | |
| 511 | − return cookie; | |
| 533 | + /* Now start DMA */ | |
| 534 | + if (rx) | |
| 512 | 535 | dma_async_issue_pending(rspi->master->dma_rx); |
| 513 | − } | |
| 514 | − if (tx) { | |
| 515 | − if (rx) { | |
| 516 | − /* No callback */ | |
| 517 | − desc_tx->callback = NULL; | |
| 518 | − } else { | |
| 519 | − desc_tx->callback = rspi_dma_complete; | |
| 520 | − desc_tx->callback_param = rspi; | |
| 521 | − } | |
| 522 | − cookie = dmaengine_submit(desc_tx); | |
| 523 | − if (dma_submit_error(cookie)) | |
| 524 | − return cookie; | |
| 536 | + if (tx) | |
| 525 | 537 | dma_async_issue_pending(rspi->master->dma_tx); |
| 526 | − } | |
| 527 | 538 | |
| 528 | 539 | ret = wait_event_interruptible_timeout(rspi->wait, |
| 529 | 540 | rspi->dma_callbacked, HZ); |
| 530 | 541 | if (ret > 0 && rspi->dma_callbacked) |
| 531 | 542 | ret = 0; |
| 532 | − else if (!ret) | |
| 543 | + else if (!ret) { | |
| 544 | + dev_err(&rspi->master->dev, "DMA timeout\n"); | |
| 533 | 545 | ret = -ETIMEDOUT; |
| 546 | + if (tx) | |
| 547 | + dmaengine_terminate_all(rspi->master->dma_tx); | |
| 548 | + if (rx) | |
| 549 | + dmaengine_terminate_all(rspi->master->dma_rx); | |
| 550 | + } | |
| 534 | 551 | |
| 535 | 552 | rspi_disable_irq(rspi, irq_mask); |
| 536 | 553 | |
| @@ -541,11 +558,16 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, · 4 unmodified lines | ||
| 541 | 558 | |
| 542 | 559 | return ret; |
| 543 | 560 | |
| 544 | −no_dma: | |
| 545 | − pr_warn_once("%s %s: DMA not available, falling back to PIO\n", | |
| 546 | − dev_driver_string(&rspi->master->dev), | |
| 547 | − dev_name(&rspi->master->dev)); | |
| 548 | − return -EAGAIN; | |
| 561 | +no_dma_tx: | |
| 562 | + if (rx) | |
| 563 | + dmaengine_terminate_all(rspi->master->dma_rx); | |
| 564 | +no_dma_rx: | |
| 565 | + if (ret == -EAGAIN) { | |
| 566 | + pr_warn_once("%s %s: DMA not available, falling back to PIO\n", | |
| 567 | + dev_driver_string(&rspi->master->dev), | |
| 568 | + dev_name(&rspi->master->dev)); | |
| 569 | + } | |
| 570 | + return ret; | |
| 549 | 571 | } |
| 550 | 572 | |
| 551 | 573 | static void rspi_receive_init(const struct rspi_data *rspi) |
| @@ -636,48 +636,38 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, · 635 unmodified lines | ||
| 636 | 636 | dma_cookie_t cookie; |
| 637 | 637 | int ret; |
| 638 | 638 | |
| 639 | − if (tx) { | |
| 640 | − ier_bits |= IER_TDREQE | IER_TDMAE; | |
| 641 | − dma_sync_single_for_device(p->master->dma_tx->device->dev, | |
| 642 | − p->tx_dma_addr, len, DMA_TO_DEVICE); | |
| 643 | − desc_tx = dmaengine_prep_slave_single(p->master->dma_tx, | |
| 644 | − p->tx_dma_addr, len, DMA_TO_DEVICE, | |
| 645 | − DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | |
| 646 | − if (!desc_tx) | |
| 647 | − return -EAGAIN; | |
| 648 | − } | |
| 649 | − | |
| 639 | + /* First prepare and submit the DMA request(s), as this may fail */ | |
| 650 | 640 | if (rx) { |
| 651 | 641 | ier_bits |= IER_RDREQE | IER_RDMAE; |
| 652 | 642 | desc_rx = dmaengine_prep_slave_single(p->master->dma_rx, |
| 653 | 643 | p->rx_dma_addr, len, DMA_FROM_DEVICE, |
| 654 | 644 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 655 | − if (!desc_rx) | |
| 656 | − return -EAGAIN; | |
| 657 | − } | |
| 658 | − | |
| 659 | − /* 1 stage FIFO watermarks for DMA */ | |
| 660 | − sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1); | |
| 661 | − | |
| 662 | − /* setup msiof transfer mode registers (32-bit words) */ | |
| 663 | − sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4); | |
| 664 | − | |
| 665 | − sh_msiof_write(p, IER, ier_bits); | |
| 666 | − | |
| 667 | − reinit_completion(&p->done); | |
| 645 | + if (!desc_rx) { | |
| 646 | + ret = -EAGAIN; | |
| 647 | + goto no_dma_rx; | |
| 648 | + } | |
| 668 | 649 | |
| 669 | − if (rx) { | |
| 670 | 650 | desc_rx->callback = sh_msiof_dma_complete; |
| 671 | 651 | desc_rx->callback_param = p; |
| 672 | 652 | cookie = dmaengine_submit(desc_rx); |
| 673 | 653 | if (dma_submit_error(cookie)) { |
| 674 | 654 | ret = cookie; |
| 675 | − goto stop_ier; | |
| 655 | + goto no_dma_rx; | |
| 676 | 656 | } |
| 677 | − dma_async_issue_pending(p->master->dma_rx); | |
| 678 | 657 | } |
| 679 | 658 | |
| 680 | 659 | if (tx) { |
| 660 | + ier_bits |= IER_TDREQE | IER_TDMAE; | |
| 661 | + dma_sync_single_for_device(p->master->dma_tx->device->dev, | |
| 662 | + p->tx_dma_addr, len, DMA_TO_DEVICE); | |
| 663 | + desc_tx = dmaengine_prep_slave_single(p->master->dma_tx, | |
| 664 | + p->tx_dma_addr, len, DMA_TO_DEVICE, | |
| 665 | + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | |
| 666 | + if (!desc_tx) { | |
| 667 | + ret = -EAGAIN; | |
| 668 | + goto no_dma_tx; | |
| 669 | + } | |
| 670 | + | |
| 681 | 671 | if (rx) { |
| 682 | 672 | /* No callback */ |
| 683 | 673 | desc_tx->callback = NULL; |
| @@ -688,15 +678,30 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, · 4 unmodified lines | ||
| 688 | 678 | cookie = dmaengine_submit(desc_tx); |
| 689 | 679 | if (dma_submit_error(cookie)) { |
| 690 | 680 | ret = cookie; |
| 691 | − goto stop_rx; | |
| 681 | + goto no_dma_tx; | |
| 692 | 682 | } |
| 693 | − dma_async_issue_pending(p->master->dma_tx); | |
| 694 | 683 | } |
| 695 | 684 | |
| 685 | + /* 1 stage FIFO watermarks for DMA */ | |
| 686 | + sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1); | |
| 687 | + | |
| 688 | + /* setup msiof transfer mode registers (32-bit words) */ | |
| 689 | + sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4); | |
| 690 | + | |
| 691 | + sh_msiof_write(p, IER, ier_bits); | |
| 692 | + | |
| 693 | + reinit_completion(&p->done); | |
| 694 | + | |
| 695 | + /* Now start DMA */ | |
| 696 | + if (rx) | |
| 697 | + dma_async_issue_pending(p->master->dma_rx); | |
| 698 | + if (tx) | |
| 699 | + dma_async_issue_pending(p->master->dma_tx); | |
| 700 | + | |
| 696 | 701 | ret = sh_msiof_spi_start(p, rx); |
| 697 | 702 | if (ret) { |
| 698 | 703 | dev_err(&p->pdev->dev, "failed to start hardware\n"); |
| 699 | − goto stop_tx; | |
| 704 | + goto stop_dma; | |
| 700 | 705 | } |
| 701 | 706 | |
| 702 | 707 | /* wait for tx fifo to be emptied / rx fifo to be filled */ |
| @@ -726,14 +731,14 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx, · 23 unmodified lines | ||
| 726 | 731 | stop_reset: |
| 727 | 732 | sh_msiof_reset_str(p); |
| 728 | 733 | sh_msiof_spi_stop(p, rx); |
| 729 | −stop_tx: | |
| 734 | +stop_dma: | |
| 730 | 735 | if (tx) |
| 731 | 736 | dmaengine_terminate_all(p->master->dma_tx); |
| 732 | −stop_rx: | |
| 737 | +no_dma_tx: | |
| 733 | 738 | if (rx) |
| 734 | 739 | dmaengine_terminate_all(p->master->dma_rx); |
| 735 | −stop_ier: | |
| 736 | 740 | sh_msiof_write(p, IER, 0); |
| 741 | +no_dma_rx: | |
| 737 | 742 | return ret; |
| 738 | 743 | } |
| 739 | 744 | |
| @@ -848,6 +848,7 @@ out: · 847 unmodified lines | ||
| 848 | 848 | |
| 849 | 849 | /** |
| 850 | 850 | * spi_finalize_current_transfer - report completion of a transfer |
| 851 | + * @master: the master reporting completion | |
| 851 | 852 | * |
| 852 | 853 | * Called by SPI drivers using the core transfer_one_message() |
| 853 | 854 | * implementation to notify it that the current interrupt driven |
| @@ -38,6 +38,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = { · 37 unmodified lines | ||
| 38 | 38 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432b) }, |
| 39 | 39 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432c) }, |
| 40 | 40 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4350) }, |
| 41 | + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4351) }, | |
| 41 | 42 | { 0, }, |
| 42 | 43 | }; |
| 43 | 44 | MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl); |
| @@ -28,8 +28,6 @@ source "drivers/staging/et131x/Kconfig" · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | source "drivers/staging/slicoss/Kconfig" |
| 30 | 30 | |
| 31 | −source "drivers/staging/usbip/Kconfig" | |
| 32 | − | |
| 33 | 31 | source "drivers/staging/wlan-ng/Kconfig" |
| 34 | 32 | |
| 35 | 33 | source "drivers/staging/comedi/Kconfig" |
| @@ -6,7 +6,6 @@ obj-$(CONFIG_STAGING) += staging.o · 5 unmodified lines | ||
| 6 | 6 | obj-y += media/ |
| 7 | 7 | obj-$(CONFIG_ET131X) += et131x/ |
| 8 | 8 | obj-$(CONFIG_SLICOSS) += slicoss/ |
| 9 | −obj-$(CONFIG_USBIP_CORE) += usbip/ | |
| 10 | 9 | obj-$(CONFIG_PRISM2_USB) += wlan-ng/ |
| 11 | 10 | obj-$(CONFIG_COMEDI) += comedi/ |
| 12 | 11 | obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/ |
| @@ -790,7 +790,7 @@ static int __init create_log(char *log_name, int size) · 789 unmodified lines | ||
| 790 | 790 | if (unlikely(ret)) { |
| 791 | 791 | pr_err("failed to register misc device for log '%s'!\n", |
| 792 | 792 | log->misc.name); |
| 793 | − goto out_free_log; | |
| 793 | + goto out_free_misc_name; | |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | pr_info("created %luK log '%s'\n", |
| @@ -798,6 +798,9 @@ static int __init create_log(char *log_name, int size) · 1 unmodified line | ||
| 798 | 798 | |
| 799 | 799 | return 0; |
| 800 | 800 | |
| 801 | +out_free_misc_name: | |
| 802 | + kfree(log->misc.name); | |
| 803 | + | |
| 801 | 804 | out_free_log: |
| 802 | 805 | kfree(log); |
| 803 | 806 | |
| @@ -1421,22 +1421,16 @@ static int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value) · 1420 unmodified lines | ||
| 1421 | 1421 | * @reg: the register to read |
| 1422 | 1422 | * @value: 16-bit value to write |
| 1423 | 1423 | */ |
| 1424 | −static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value) | |
| 1424 | +static int et131x_mii_write(struct et131x_adapter *adapter, u8 addr, u8 reg, | |
| 1425 | + u16 value) | |
| 1425 | 1426 | { |
| 1426 | 1427 | struct mac_regs __iomem *mac = &adapter->regs->mac; |
| 1427 | − struct phy_device *phydev = adapter->phydev; | |
| 1428 | 1428 | int status = 0; |
| 1429 | − u8 addr; | |
| 1430 | 1429 | u32 delay = 0; |
| 1431 | 1430 | u32 mii_addr; |
| 1432 | 1431 | u32 mii_cmd; |
| 1433 | 1432 | u32 mii_indicator; |
| 1434 | 1433 | |
| 1435 | − if (!phydev) | |
| 1436 | − return -EIO; | |
| 1437 | − | |
| 1438 | − addr = phydev->addr; | |
| 1439 | − | |
| 1440 | 1434 | /* Save a local copy of the registers we are dealing with so we can |
| 1441 | 1435 | * set them back |
| 1442 | 1436 | */ |
| @@ -1631,17 +1625,7 @@ static int et131x_mdio_write(struct mii_bus *bus, int phy_addr, · 188 unmodified lines | ||
| 1631 | 1625 | struct net_device *netdev = bus->priv; |
| 1632 | 1626 | struct et131x_adapter *adapter = netdev_priv(netdev); |
| 1633 | 1627 | |
| 1634 | − return et131x_mii_write(adapter, reg, value); | |
| 1635 | −} | |
| 1636 | − | |
| 1637 | −static int et131x_mdio_reset(struct mii_bus *bus) | |
| 1638 | −{ | |
| 1639 | − struct net_device *netdev = bus->priv; | |
| 1640 | − struct et131x_adapter *adapter = netdev_priv(netdev); | |
| 1641 | − | |
| 1642 | − et131x_mii_write(adapter, MII_BMCR, BMCR_RESET); | |
| 1643 | − | |
| 1644 | − return 0; | |
| 1628 | + return et131x_mii_write(adapter, phy_addr, reg, value); | |
| 1645 | 1629 | } |
| 1646 | 1630 | |
| 1647 | 1631 | /* et1310_phy_power_switch - PHY power control |
| @@ -1656,18 +1640,20 @@ static int et131x_mdio_reset(struct mii_bus *bus) · 8 unmodified lines | ||
| 1656 | 1640 | static void et1310_phy_power_switch(struct et131x_adapter *adapter, bool down) |
| 1657 | 1641 | { |
| 1658 | 1642 | u16 data; |
| 1643 | + struct phy_device *phydev = adapter->phydev; | |
| 1659 | 1644 | |
| 1660 | 1645 | et131x_mii_read(adapter, MII_BMCR, &data); |
| 1661 | 1646 | data &= ~BMCR_PDOWN; |
| 1662 | 1647 | if (down) |
| 1663 | 1648 | data |= BMCR_PDOWN; |
| 1664 | − et131x_mii_write(adapter, MII_BMCR, data); | |
| 1649 | + et131x_mii_write(adapter, phydev->addr, MII_BMCR, data); | |
| 1665 | 1650 | } |
| 1666 | 1651 | |
| 1667 | 1652 | /* et131x_xcvr_init - Init the phy if we are setting it into force mode */ |
| 1668 | 1653 | static void et131x_xcvr_init(struct et131x_adapter *adapter) |
| 1669 | 1654 | { |
| 1670 | 1655 | u16 lcr2; |
| 1656 | + struct phy_device *phydev = adapter->phydev; | |
| 1671 | 1657 | |
| 1672 | 1658 | /* Set the LED behavior such that LED 1 indicates speed (off = |
| 1673 | 1659 | * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates |
| @@ -1688,7 +1674,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter) · 14 unmodified lines | ||
| 1688 | 1674 | else |
| 1689 | 1675 | lcr2 |= (LED_VAL_LINKON << LED_TXRX_SHIFT); |
| 1690 | 1676 | |
| 1691 | − et131x_mii_write(adapter, PHY_LED_2, lcr2); | |
| 1677 | + et131x_mii_write(adapter, phydev->addr, PHY_LED_2, lcr2); | |
| 1692 | 1678 | } |
| 1693 | 1679 | } |
| 1694 | 1680 | |
| @@ -3643,14 +3629,14 @@ static void et131x_adjust_link(struct net_device *netdev) · 1948 unmodified lines | ||
| 3643 | 3629 | |
| 3644 | 3630 | et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, |
| 3645 | 3631 | ®ister18); |
| 3646 | − et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, | |
| 3647 | − register18 | 0x4); | |
| 3648 | − et131x_mii_write(adapter, PHY_INDEX_REG, | |
| 3632 | + et131x_mii_write(adapter, phydev->addr, | |
| 3633 | + PHY_MPHY_CONTROL_REG, register18 | 0x4); | |
| 3634 | + et131x_mii_write(adapter, phydev->addr, PHY_INDEX_REG, | |
| 3649 | 3635 | register18 | 0x8402); |
| 3650 | − et131x_mii_write(adapter, PHY_DATA_REG, | |
| 3636 | + et131x_mii_write(adapter, phydev->addr, PHY_DATA_REG, | |
| 3651 | 3637 | register18 | 511); |
| 3652 | − et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, | |
| 3653 | − register18); | |
| 3638 | + et131x_mii_write(adapter, phydev->addr, | |
| 3639 | + PHY_MPHY_CONTROL_REG, register18); | |
| 3654 | 3640 | } |
| 3655 | 3641 | |
| 3656 | 3642 | et1310_config_flow_control(adapter); |
| @@ -3662,7 +3648,8 @@ static void et131x_adjust_link(struct net_device *netdev) · 5 unmodified lines | ||
| 3662 | 3648 | et131x_mii_read(adapter, PHY_CONFIG, ®); |
| 3663 | 3649 | reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH; |
| 3664 | 3650 | reg |= ET_PHY_CONFIG_FIFO_DEPTH_32; |
| 3665 | − et131x_mii_write(adapter, PHY_CONFIG, reg); | |
| 3651 | + et131x_mii_write(adapter, phydev->addr, PHY_CONFIG, | |
| 3652 | + reg); | |
| 3666 | 3653 | } |
| 3667 | 3654 | |
| 3668 | 3655 | et131x_set_rx_dma_timer(adapter); |
| @@ -3675,14 +3662,14 @@ static void et131x_adjust_link(struct net_device *netdev) · 6 unmodified lines | ||
| 3675 | 3662 | |
| 3676 | 3663 | et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, |
| 3677 | 3664 | ®ister18); |
| 3678 | − et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, | |
| 3679 | − register18 | 0x4); | |
| 3680 | − et131x_mii_write(adapter, PHY_INDEX_REG, | |
| 3681 | − register18 | 0x8402); | |
| 3682 | − et131x_mii_write(adapter, PHY_DATA_REG, | |
| 3683 | − register18 | 511); | |
| 3684 | − et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, | |
| 3685 | − register18); | |
| 3665 | + et131x_mii_write(adapter, phydev->addr, | |
| 3666 | + PHY_MPHY_CONTROL_REG, register18 | 0x4); | |
| 3667 | + et131x_mii_write(adapter, phydev->addr, | |
| 3668 | + PHY_INDEX_REG, register18 | 0x8402); | |
| 3669 | + et131x_mii_write(adapter, phydev->addr, | |
| 3670 | + PHY_DATA_REG, register18 | 511); | |
| 3671 | + et131x_mii_write(adapter, phydev->addr, | |
| 3672 | + PHY_MPHY_CONTROL_REG, register18); | |
| 3686 | 3673 | } |
| 3687 | 3674 | |
| 3688 | 3675 | /* Free the packets being actively sent & stopped */ |
| @@ -4644,10 +4631,6 @@ static int et131x_pci_setup(struct pci_dev *pdev, · 955 unmodified lines | ||
| 4644 | 4631 | /* Copy address into the net_device struct */ |
| 4645 | 4632 | memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN); |
| 4646 | 4633 | |
| 4647 | − /* Init variable for counting how long we do not have link status */ | |
| 4648 | − adapter->boot_coma = 0; | |
| 4649 | − et1310_disable_phy_coma(adapter); | |
| 4650 | − | |
| 4651 | 4634 | rc = -ENOMEM; |
| 4652 | 4635 | |
| 4653 | 4636 | /* Setup the mii_bus struct */ |
| @@ -4663,7 +4646,6 @@ static int et131x_pci_setup(struct pci_dev *pdev, · 9 unmodified lines | ||
| 4663 | 4646 | adapter->mii_bus->priv = netdev; |
| 4664 | 4647 | adapter->mii_bus->read = et131x_mdio_read; |
| 4665 | 4648 | adapter->mii_bus->write = et131x_mdio_write; |
| 4666 | − adapter->mii_bus->reset = et131x_mdio_reset; | |
| 4667 | 4649 | adapter->mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), |
| 4668 | 4650 | GFP_KERNEL); |
| 4669 | 4651 | if (!adapter->mii_bus->irq) |
| @@ -4687,6 +4669,10 @@ static int et131x_pci_setup(struct pci_dev *pdev, · 17 unmodified lines | ||
| 4687 | 4669 | /* Setup et1310 as per the documentation */ |
| 4688 | 4670 | et131x_adapter_setup(adapter); |
| 4689 | 4671 | |
| 4672 | + /* Init variable for counting how long we do not have link status */ | |
| 4673 | + adapter->boot_coma = 0; | |
| 4674 | + et1310_disable_phy_coma(adapter); | |
| 4675 | + | |
| 4690 | 4676 | /* We can enable interrupts now |
| 4691 | 4677 | * |
| 4692 | 4678 | * NOTE - Because registration of interrupt handler is done in the |
| @@ -365,6 +365,7 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, · 364 unmodified lines | ||
| 365 | 365 | return -ENOMEM; |
| 366 | 366 | |
| 367 | 367 | strncpy(sched->ws_name, name, CFS_WS_NAME_LEN); |
| 368 | + sched->ws_name[CFS_WS_NAME_LEN - 1] = '\0'; | |
| 368 | 369 | sched->ws_cptab = cptab; |
| 369 | 370 | sched->ws_cpt = cpt; |
| 370 | 371 | |
| @@ -35,7 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | 37 | #define DEBUG_SUBSYSTEM S_CLASS |
| 38 | −# include <asm/atomic.h> | |
| 38 | +# include <linux/atomic.h> | |
| 39 | 39 | |
| 40 | 40 | #include "../include/obd_support.h" |
| 41 | 41 | #include "../include/obd_class.h" |
| @@ -43,9 +43,11 @@ static struct usb_device_id rtw_usb_id_tbl[] = { · 42 unmodified lines | ||
| 43 | 43 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ |
| 44 | 44 | /*=== Customer ID ===*/ |
| 45 | 45 | /****** 8188EUS ********/ |
| 46 | + {USB_DEVICE(0x056e, 0x4008)}, /* Elecom WDC-150SU2M */ | |
| 46 | 47 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
| 47 | 48 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
| 48 | 49 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ |
| 50 | + {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ | |
| 49 | 51 | {} /* Terminating entry */ |
| 50 | 52 | }; |
| 51 | 53 | |
| @@ -150,7 +150,26 @@ int tb_path_activate(struct tb_path *path) · 149 unmodified lines | ||
| 150 | 150 | |
| 151 | 151 | /* Activate hops. */ |
| 152 | 152 | for (i = path->path_length - 1; i >= 0; i--) { |
| 153 | − struct tb_regs_hop hop; | |
| 153 | + struct tb_regs_hop hop = { 0 }; | |
| 154 | + | |
| 155 | + /* | |
| 156 | + * We do (currently) not tear down paths setup by the firmeware. | |
| 157 | + * If a firmware device is unplugged and plugged in again then | |
| 158 | + * it can happen that we reuse some of the hops from the (now | |
| 159 | + * defunct) firmeware path. This causes the hotplug operation to | |
| 160 | + * fail (the pci device does not show up). Clearing the hop | |
| 161 | + * before overwriting it fixes the problem. | |
| 162 | + * | |
| 163 | + * Should be removed once we discover and tear down firmeware | |
| 164 | + * paths. | |
| 165 | + */ | |
| 166 | + res = tb_port_write(path->hops[i].in_port, &hop, TB_CFG_HOPS, | |
| 167 | + 2 * path->hops[i].in_hop_index, 2); | |
| 168 | + if (res) { | |
| 169 | + __tb_path_deactivate_hops(path, i); | |
| 170 | + __tb_path_deallocate_nfc(path, 0); | |
| 171 | + goto err; | |
| 172 | + } | |
| 154 | 173 | |
| 155 | 174 | /* dword 0 */ |
| 156 | 175 | hop.next_hop = path->hops[i].next_hop_index; |
| @@ -92,6 +92,8 @@ source "drivers/usb/storage/Kconfig" · 91 unmodified lines | ||
| 92 | 92 | |
| 93 | 93 | source "drivers/usb/image/Kconfig" |
| 94 | 94 | |
| 95 | +source "drivers/usb/usbip/Kconfig" | |
| 96 | + | |
| 95 | 97 | endif |
| 96 | 98 | |
| 97 | 99 | source "drivers/usb/musb/Kconfig" |
| @@ -60,3 +60,5 @@ obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/ · 59 unmodified lines | ||
| 60 | 60 | obj-$(CONFIG_USB_GADGET) += gadget/ |
| 61 | 61 | |
| 62 | 62 | obj-$(CONFIG_USB_COMMON) += common/ |
| 63 | + | |
| 64 | +obj-$(CONFIG_USBIP_CORE) += usbip/ | |
| @@ -1728,8 +1728,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) · 1727 unmodified lines | ||
| 1728 | 1728 | * - Change autosuspend delay of hub can avoid unnecessary auto |
| 1729 | 1729 | * suspend timer for hub, also may decrease power consumption |
| 1730 | 1730 | * of USB bus. |
| 1731 | + * | |
| 1732 | + * - If user has indicated to prevent autosuspend by passing | |
| 1733 | + * usbcore.autosuspend = -1 then keep autosuspend disabled. | |
| 1731 | 1734 | */ |
| 1732 | − pm_runtime_set_autosuspend_delay(&hdev->dev, 0); | |
| 1735 | +#ifdef CONFIG_PM_RUNTIME | |
| 1736 | + if (hdev->dev.power.autosuspend_delay >= 0) | |
| 1737 | + pm_runtime_set_autosuspend_delay(&hdev->dev, 0); | |
| 1738 | +#endif | |
| 1733 | 1739 | |
| 1734 | 1740 | /* |
| 1735 | 1741 | * Hubs have proper suspend/resume support, except for root hubs |
| @@ -2107,8 +2113,8 @@ void usb_disconnect(struct usb_device **pdev) · 371 unmodified lines | ||
| 2107 | 2113 | { |
| 2108 | 2114 | struct usb_port *port_dev = NULL; |
| 2109 | 2115 | struct usb_device *udev = *pdev; |
| 2110 | − struct usb_hub *hub; | |
| 2111 | − int port1; | |
| 2116 | + struct usb_hub *hub = NULL; | |
| 2117 | + int port1 = 1; | |
| 2112 | 2118 | |
| 2113 | 2119 | /* mark the device as inactive, so any further urb submissions for |
| 2114 | 2120 | * this device (and any of its children) will fail immediately. |
| @@ -4631,9 +4637,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, · 2516 unmodified lines | ||
| 4631 | 4637 | if (status != -ENODEV && |
| 4632 | 4638 | port1 != unreliable_port && |
| 4633 | 4639 | printk_ratelimit()) |
| 4634 | − dev_err(&udev->dev, "connect-debounce failed, port %d disabled\n", | |
| 4635 | − port1); | |
| 4636 | − | |
| 4640 | + dev_err(&port_dev->dev, "connect-debounce failed\n"); | |
| 4637 | 4641 | portstatus &= ~USB_PORT_STAT_CONNECTION; |
| 4638 | 4642 | unreliable_port = port1; |
| 4639 | 4643 | } else { |
| @@ -1901,7 +1901,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, · 1900 unmodified lines | ||
| 1901 | 1901 | static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg) |
| 1902 | 1902 | { |
| 1903 | 1903 | u32 dsts = readl(hsotg->regs + DSTS); |
| 1904 | − int ep0_mps = 0, ep_mps; | |
| 1904 | + int ep0_mps = 0, ep_mps = 8; | |
| 1905 | 1905 | |
| 1906 | 1906 | /* |
| 1907 | 1907 | * This should signal the finish of the enumeration phase |
| @@ -425,7 +425,7 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) · 424 unmodified lines | ||
| 425 | 425 | |
| 426 | 426 | static int dwc3_omap_extcon_register(struct dwc3_omap *omap) |
| 427 | 427 | { |
| 428 | − u32 ret; | |
| 428 | + int ret; | |
| 429 | 429 | struct device_node *node = omap->dev->of_node; |
| 430 | 430 | struct extcon_dev *edev; |
| 431 | 431 | |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | # |
| 4 | 4 | subdir-ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG |
| 5 | 5 | subdir-ccflags-$(CONFIG_USB_GADGET_VERBOSE) += -DVERBOSE_DEBUG |
| 6 | −ccflags-y += -I$(PWD)/drivers/usb/gadget/udc | |
| 6 | +ccflags-y += -Idrivers/usb/gadget/udc | |
| 7 | 7 | |
| 8 | 8 | obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o |
| 9 | 9 | libcomposite-y := usbstring.o config.o epautoconf.o |
| @@ -2,8 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | # USB peripheral controller drivers |
| 3 | 3 | # |
| 4 | 4 | |
| 5 | −ccflags-y := -I$(PWD)/drivers/usb/gadget/ | |
| 6 | −ccflags-y += -I$(PWD)/drivers/usb/gadget/udc/ | |
| 5 | +ccflags-y := -Idrivers/usb/gadget/ | |
| 6 | +ccflags-y += -Idrivers/usb/gadget/udc/ | |
| 7 | 7 | |
| 8 | 8 | # USB Functions |
| 9 | 9 | usb_f_acm-y := f_acm.o |
| @@ -1127,10 +1127,7 @@ void gether_disconnect(struct gether *link) · 1126 unmodified lines | ||
| 1127 | 1127 | |
| 1128 | 1128 | DBG(dev, "%s\n", __func__); |
| 1129 | 1129 | |
| 1130 | − netif_tx_lock(dev->net); | |
| 1131 | 1130 | netif_stop_queue(dev->net); |
| 1132 | − netif_tx_unlock(dev->net); | |
| 1133 | − | |
| 1134 | 1131 | netif_carrier_off(dev->net); |
| 1135 | 1132 | |
| 1136 | 1133 | /* disable endpoints, forcing (synchronous) completion |
| @@ -195,6 +195,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req) · 194 unmodified lines | ||
| 195 | 195 | printk(KERN_INFO "Failed to queue request (%d).\n", ret); |
| 196 | 196 | usb_ep_set_halt(ep); |
| 197 | 197 | spin_unlock_irqrestore(&video->queue.irqlock, flags); |
| 198 | + uvc_queue_cancel(queue, 0); | |
| 198 | 199 | goto requeue; |
| 199 | 200 | } |
| 200 | 201 | spin_unlock_irqrestore(&video->queue.irqlock, flags); |
| @@ -281,6 +282,7 @@ error: · 80 unmodified lines | ||
| 281 | 282 | static int |
| 282 | 283 | uvc_video_pump(struct uvc_video *video) |
| 283 | 284 | { |
| 285 | + struct uvc_video_queue *queue = &video->queue; | |
| 284 | 286 | struct usb_request *req; |
| 285 | 287 | struct uvc_buffer *buf; |
| 286 | 288 | unsigned long flags; |
| @@ -322,6 +324,7 @@ uvc_video_pump(struct uvc_video *video) · 35 unmodified lines | ||
| 322 | 324 | printk(KERN_INFO "Failed to queue request (%d)\n", ret); |
| 323 | 325 | usb_ep_set_halt(video->ep); |
| 324 | 326 | spin_unlock_irqrestore(&video->queue.irqlock, flags); |
| 327 | + uvc_queue_cancel(queue, 0); | |
| 325 | 328 | break; |
| 326 | 329 | } |
| 327 | 330 | spin_unlock_irqrestore(&video->queue.irqlock, flags); |
| @@ -2,9 +2,9 @@ · 1 unmodified line | ||
| 2 | 2 | # USB gadget drivers |
| 3 | 3 | # |
| 4 | 4 | |
| 5 | −ccflags-y := -I$(PWD)/drivers/usb/gadget/ | |
| 6 | −ccflags-y += -I$(PWD)/drivers/usb/gadget/udc/ | |
| 7 | −ccflags-y += -I$(PWD)/drivers/usb/gadget/function/ | |
| 5 | +ccflags-y := -Idrivers/usb/gadget/ | |
| 6 | +ccflags-y += -Idrivers/usb/gadget/udc/ | |
| 7 | +ccflags-y += -Idrivers/usb/gadget/function/ | |
| 8 | 8 | |
| 9 | 9 | g_zero-y := zero.o |
| 10 | 10 | g_audio-y := audio.o |
| @@ -222,10 +222,12 @@ static void dbgp_unbind(struct usb_gadget *gadget) · 221 unmodified lines | ||
| 222 | 222 | { |
| 223 | 223 | #ifdef CONFIG_USB_G_DBGP_SERIAL |
| 224 | 224 | kfree(dbgp.serial); |
| 225 | + dbgp.serial = NULL; | |
| 225 | 226 | #endif |
| 226 | 227 | if (dbgp.req) { |
| 227 | 228 | kfree(dbgp.req->buf); |
| 228 | 229 | usb_ep_free_request(gadget->ep0, dbgp.req); |
| 230 | + dbgp.req = NULL; | |
| 229 | 231 | } |
| 230 | 232 | |
| 231 | 233 | gadget->ep0->driver_data = NULL; |
| @@ -440,7 +440,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) · 439 unmodified lines | ||
| 440 | 440 | |
| 441 | 441 | value = -ENOMEM; |
| 442 | 442 | kbuf = memdup_user(buf, len); |
| 443 | − if (!kbuf) { | |
| 443 | + if (IS_ERR(kbuf)) { | |
| 444 | 444 | value = PTR_ERR(kbuf); |
| 445 | 445 | goto free1; |
| 446 | 446 | } |
| @@ -332,7 +332,7 @@ config USB_GOKU · 331 unmodified lines | ||
| 332 | 332 | gadget drivers to also be dynamically linked. |
| 333 | 333 | |
| 334 | 334 | config USB_EG20T |
| 335 | − tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC" | |
| 335 | + tristate "Intel QUARK X1000/EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC" | |
| 336 | 336 | depends on PCI |
| 337 | 337 | help |
| 338 | 338 | This is a USB device driver for EG20T PCH. |
| @@ -353,6 +353,7 @@ config USB_EG20T · 14 unmodified lines | ||
| 353 | 353 | ML7213/ML7831 is companion chip for Intel Atom E6xx series. |
| 354 | 354 | ML7213/ML7831 is completely compatible for Intel EG20T PCH. |
| 355 | 355 | |
| 356 | + This driver can be used with Intel's Quark X1000 SOC platform | |
| 356 | 357 | # |
| 357 | 358 | # LAST -- dummy/emulated controller |
| 358 | 359 | # |
| @@ -1661,7 +1661,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) · 1660 unmodified lines | ||
| 1661 | 1661 | if (dma_status) { |
| 1662 | 1662 | int i; |
| 1663 | 1663 | |
| 1664 | − for (i = 1; i < USBA_NR_DMAS; i++) | |
| 1664 | + for (i = 1; i <= USBA_NR_DMAS; i++) | |
| 1665 | 1665 | if (dma_status & (1 << i)) |
| 1666 | 1666 | usba_dma_irq(udc, &udc->usba_ep[i]); |
| 1667 | 1667 | } |
| @@ -1398,13 +1398,17 @@ static int fusb300_probe(struct platform_device *pdev) · 1397 unmodified lines | ||
| 1398 | 1398 | |
| 1399 | 1399 | /* initialize udc */ |
| 1400 | 1400 | fusb300 = kzalloc(sizeof(struct fusb300), GFP_KERNEL); |
| 1401 | − if (fusb300 == NULL) | |
| 1401 | + if (fusb300 == NULL) { | |
| 1402 | + ret = -ENOMEM; | |
| 1402 | 1403 | goto clean_up; |
| 1404 | + } | |
| 1403 | 1405 | |
| 1404 | 1406 | for (i = 0; i < FUSB300_MAX_NUM_EP; i++) { |
| 1405 | 1407 | _ep[i] = kzalloc(sizeof(struct fusb300_ep), GFP_KERNEL); |
| 1406 | − if (_ep[i] == NULL) | |
| 1408 | + if (_ep[i] == NULL) { | |
| 1409 | + ret = -ENOMEM; | |
| 1407 | 1410 | goto clean_up; |
| 1411 | + } | |
| 1408 | 1412 | fusb300->ep[i] = _ep[i]; |
| 1409 | 1413 | } |
| 1410 | 1414 | |
| @@ -343,6 +343,7 @@ struct pch_vbus_gpio_data { · 342 unmodified lines | ||
| 343 | 343 | * @setup_data: Received setup data |
| 344 | 344 | * @phys_addr: of device memory |
| 345 | 345 | * @base_addr: for mapped device memory |
| 346 | + * @bar: Indicates which PCI BAR for USB regs | |
| 346 | 347 | * @irq: IRQ line for the device |
| 347 | 348 | * @cfg_data: current cfg, intf, and alt in use |
| 348 | 349 | * @vbus_gpio: GPIO informaton for detecting VBUS |
| @@ -370,14 +371,17 @@ struct pch_udc_dev { · 21 unmodified lines | ||
| 370 | 371 | struct usb_ctrlrequest setup_data; |
| 371 | 372 | unsigned long phys_addr; |
| 372 | 373 | void __iomem *base_addr; |
| 374 | + unsigned bar; | |
| 373 | 375 | unsigned irq; |
| 374 | 376 | struct pch_udc_cfg_data cfg_data; |
| 375 | 377 | struct pch_vbus_gpio_data vbus_gpio; |
| 376 | 378 | }; |
| 377 | 379 | #define to_pch_udc(g) (container_of((g), struct pch_udc_dev, gadget)) |
| 378 | 380 | |
| 381 | +#define PCH_UDC_PCI_BAR_QUARK_X1000 0 | |
| 379 | 382 | #define PCH_UDC_PCI_BAR 1 |
| 380 | 383 | #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808 |
| 384 | +#define PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC 0x0939 | |
| 381 | 385 | #define PCI_VENDOR_ID_ROHM 0x10DB |
| 382 | 386 | #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D |
| 383 | 387 | #define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808 |
| @@ -3076,7 +3080,7 @@ static void pch_udc_remove(struct pci_dev *pdev) · 2692 unmodified lines | ||
| 3076 | 3080 | iounmap(dev->base_addr); |
| 3077 | 3081 | if (dev->mem_region) |
| 3078 | 3082 | release_mem_region(dev->phys_addr, |
| 3079 | − pci_resource_len(pdev, PCH_UDC_PCI_BAR)); | |
| 3083 | + pci_resource_len(pdev, dev->bar)); | |
| 3080 | 3084 | if (dev->active) |
| 3081 | 3085 | pci_disable_device(pdev); |
| 3082 | 3086 | kfree(dev); |
| @@ -3144,9 +3148,15 @@ static int pch_udc_probe(struct pci_dev *pdev, · 61 unmodified lines | ||
| 3144 | 3148 | dev->active = 1; |
| 3145 | 3149 | pci_set_drvdata(pdev, dev); |
| 3146 | 3150 | |
| 3151 | + /* Determine BAR based on PCI ID */ | |
| 3152 | + if (id->device == PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC) | |
| 3153 | + dev->bar = PCH_UDC_PCI_BAR_QUARK_X1000; | |
| 3154 | + else | |
| 3155 | + dev->bar = PCH_UDC_PCI_BAR; | |
| 3156 | + | |
| 3147 | 3157 | /* PCI resource allocation */ |
| 3148 | − resource = pci_resource_start(pdev, 1); | |
| 3149 | − len = pci_resource_len(pdev, 1); | |
| 3158 | + resource = pci_resource_start(pdev, dev->bar); | |
| 3159 | + len = pci_resource_len(pdev, dev->bar); | |
| 3150 | 3160 | |
| 3151 | 3161 | if (!request_mem_region(resource, len, KBUILD_MODNAME)) { |
| 3152 | 3162 | dev_err(&pdev->dev, "%s: pci device used already\n", __func__); |
| @@ -3211,6 +3221,12 @@ finished: · 58 unmodified lines | ||
| 3211 | 3221 | } |
| 3212 | 3222 | |
| 3213 | 3223 | static const struct pci_device_id pch_udc_pcidev_id[] = { |
| 3224 | + { | |
| 3225 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, | |
| 3226 | + PCI_DEVICE_ID_INTEL_QUARK_X1000_UDC), | |
| 3227 | + .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, | |
| 3228 | + .class_mask = 0xffffffff, | |
| 3229 | + }, | |
| 3214 | 3230 | { |
| 3215 | 3231 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EG20T_UDC), |
| 3216 | 3232 | .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe, |
| @@ -1868,8 +1868,8 @@ static int r8a66597_probe(struct platform_device *pdev) · 1867 unmodified lines | ||
| 1868 | 1868 | |
| 1869 | 1869 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1870 | 1870 | reg = devm_ioremap_resource(&pdev->dev, res); |
| 1871 | − if (!reg) | |
| 1872 | − return -ENODEV; | |
| 1871 | + if (IS_ERR(reg)) | |
| 1872 | + return PTR_ERR(reg); | |
| 1873 | 1873 | |
| 1874 | 1874 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
| 1875 | 1875 | irq = ires->start; |
| @@ -1230,7 +1230,7 @@ int ehci_hub_control( · 1229 unmodified lines | ||
| 1230 | 1230 | if (selector == EHSET_TEST_SINGLE_STEP_SET_FEATURE) { |
| 1231 | 1231 | spin_unlock_irqrestore(&ehci->lock, flags); |
| 1232 | 1232 | retval = ehset_single_step_set_feature(hcd, |
| 1233 | − wIndex); | |
| 1233 | + wIndex + 1); | |
| 1234 | 1234 | spin_lock_irqsave(&ehci->lock, flags); |
| 1235 | 1235 | break; |
| 1236 | 1236 | } |
| @@ -101,6 +101,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 100 unmodified lines | ||
| 101 | 101 | /* AMD PLL quirk */ |
| 102 | 102 | if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) |
| 103 | 103 | xhci->quirks |= XHCI_AMD_PLL_FIX; |
| 104 | + | |
| 105 | + if (pdev->vendor == PCI_VENDOR_ID_AMD) | |
| 106 | + xhci->quirks |= XHCI_TRUST_TX_LENGTH; | |
| 107 | + | |
| 104 | 108 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { |
| 105 | 109 | xhci->quirks |= XHCI_LPM_SUPPORT; |
| 106 | 110 | xhci->quirks |= XHCI_INTEL_HOST; |
| @@ -151,6 +155,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 44 unmodified lines | ||
| 151 | 155 | if (pdev->vendor == PCI_VENDOR_ID_VIA) |
| 152 | 156 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
| 153 | 157 | |
| 158 | + /* See https://bugzilla.kernel.org/show_bug.cgi?id=79511 */ | |
| 159 | + if (pdev->vendor == PCI_VENDOR_ID_VIA && | |
| 160 | + pdev->device == 0x3432) | |
| 161 | + xhci->quirks |= XHCI_BROKEN_STREAMS; | |
| 162 | + | |
| 154 | 163 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
| 155 | 164 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
| 156 | 165 | "QUIRK: Resetting on resume"); |
| @@ -364,32 +364,6 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci, · 363 unmodified lines | ||
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | −/* | |
| 368 | − * Find the segment that trb is in. Start searching in start_seg. | |
| 369 | − * If we must move past a segment that has a link TRB with a toggle cycle state | |
| 370 | − * bit set, then we will toggle the value pointed at by cycle_state. | |
| 371 | − */ | |
| 372 | −static struct xhci_segment *find_trb_seg( | |
| 373 | − struct xhci_segment *start_seg, | |
| 374 | − union xhci_trb *trb, int *cycle_state) | |
| 375 | −{ | |
| 376 | − struct xhci_segment *cur_seg = start_seg; | |
| 377 | − struct xhci_generic_trb *generic_trb; | |
| 378 | − | |
| 379 | − while (cur_seg->trbs > trb || | |
| 380 | − &cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) { | |
| 381 | − generic_trb = &cur_seg->trbs[TRBS_PER_SEGMENT - 1].generic; | |
| 382 | − if (generic_trb->field[3] & cpu_to_le32(LINK_TOGGLE)) | |
| 383 | − *cycle_state ^= 0x1; | |
| 384 | − cur_seg = cur_seg->next; | |
| 385 | − if (cur_seg == start_seg) | |
| 386 | − /* Looped over the entire list. Oops! */ | |
| 387 | − return NULL; | |
| 388 | − } | |
| 389 | − return cur_seg; | |
| 390 | −} | |
| 391 | − | |
| 392 | − | |
| 393 | 367 | static struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci, |
| 394 | 368 | unsigned int slot_id, unsigned int ep_index, |
| 395 | 369 | unsigned int stream_id) |
| @@ -459,9 +433,12 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, · 63 unmodified lines | ||
| 459 | 433 | struct xhci_virt_device *dev = xhci->devs[slot_id]; |
| 460 | 434 | struct xhci_virt_ep *ep = &dev->eps[ep_index]; |
| 461 | 435 | struct xhci_ring *ep_ring; |
| 462 | − struct xhci_generic_trb *trb; | |
| 436 | + struct xhci_segment *new_seg; | |
| 437 | + union xhci_trb *new_deq; | |
| 463 | 438 | dma_addr_t addr; |
| 464 | 439 | u64 hw_dequeue; |
| 440 | + bool cycle_found = false; | |
| 441 | + bool td_last_trb_found = false; | |
| 465 | 442 | |
| 466 | 443 | ep_ring = xhci_triad_to_transfer_ring(xhci, slot_id, |
| 467 | 444 | ep_index, stream_id); |
| @@ -486,45 +463,45 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, · 18 unmodified lines | ||
| 486 | 463 | hw_dequeue = le64_to_cpu(ep_ctx->deq); |
| 487 | 464 | } |
| 488 | 465 | |
| 489 | − /* Find virtual address and segment of hardware dequeue pointer */ | |
| 490 | − state->new_deq_seg = ep_ring->deq_seg; | |
| 491 | − state->new_deq_ptr = ep_ring->dequeue; | |
| 492 | − while (xhci_trb_virt_to_dma(state->new_deq_seg, state->new_deq_ptr) | |
| 493 | − != (dma_addr_t)(hw_dequeue & ~0xf)) { | |
| 494 | − next_trb(xhci, ep_ring, &state->new_deq_seg, | |
| 495 | − &state->new_deq_ptr); | |
| 496 | − if (state->new_deq_ptr == ep_ring->dequeue) { | |
| 497 | − WARN_ON(1); | |
| 498 | − return; | |
| 499 | − } | |
| 500 | − } | |
| 466 | + new_seg = ep_ring->deq_seg; | |
| 467 | + new_deq = ep_ring->dequeue; | |
| 468 | + state->new_cycle_state = hw_dequeue & 0x1; | |
| 469 | + | |
| 501 | 470 | /* |
| 502 | − * Find cycle state for last_trb, starting at old cycle state of | |
| 503 | − * hw_dequeue. If there is only one segment ring, find_trb_seg() will | |
| 504 | − * return immediately and cannot toggle the cycle state if this search | |
| 505 | − * wraps around, so add one more toggle manually in that case. | |
| 471 | + * We want to find the pointer, segment and cycle state of the new trb | |
| 472 | + * (the one after current TD's last_trb). We know the cycle state at | |
| 473 | + * hw_dequeue, so walk the ring until both hw_dequeue and last_trb are | |
| 474 | + * found. | |
| 506 | 475 | */ |
| 507 | − state->new_cycle_state = hw_dequeue & 0x1; | |
| 508 | − if (ep_ring->first_seg == ep_ring->first_seg->next && | |
| 509 | − cur_td->last_trb < state->new_deq_ptr) | |
| 510 | − state->new_cycle_state ^= 0x1; | |
| 476 | + do { | |
| 477 | + if (!cycle_found && xhci_trb_virt_to_dma(new_seg, new_deq) | |
| 478 | + == (dma_addr_t)(hw_dequeue & ~0xf)) { | |
| 479 | + cycle_found = true; | |
| 480 | + if (td_last_trb_found) | |
| 481 | + break; | |
| 482 | + } | |
| 483 | + if (new_deq == cur_td->last_trb) | |
| 484 | + td_last_trb_found = true; | |
| 511 | 485 | |
| 512 | − state->new_deq_ptr = cur_td->last_trb; | |
| 513 | − xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | |
| 514 | − "Finding segment containing last TRB in TD."); | |
| 515 | − state->new_deq_seg = find_trb_seg(state->new_deq_seg, | |
| 516 | − state->new_deq_ptr, &state->new_cycle_state); | |
| 517 | − if (!state->new_deq_seg) { | |
| 518 | − WARN_ON(1); | |
| 519 | − return; | |
| 520 | − } | |
| 486 | + if (cycle_found && | |
| 487 | + TRB_TYPE_LINK_LE32(new_deq->generic.field[3]) && | |
| 488 | + new_deq->generic.field[3] & cpu_to_le32(LINK_TOGGLE)) | |
| 489 | + state->new_cycle_state ^= 0x1; | |
| 490 | + | |
| 491 | + next_trb(xhci, ep_ring, &new_seg, &new_deq); | |
| 492 | + | |
| 493 | + /* Search wrapped around, bail out */ | |
| 494 | + if (new_deq == ep->ring->dequeue) { | |
| 495 | + xhci_err(xhci, "Error: Failed finding new dequeue state\n"); | |
| 496 | + state->new_deq_seg = NULL; | |
| 497 | + state->new_deq_ptr = NULL; | |
| 498 | + return; | |
| 499 | + } | |
| 500 | + | |
| 501 | + } while (!cycle_found || !td_last_trb_found); | |
| 521 | 502 | |
| 522 | − /* Increment to find next TRB after last_trb. Cycle if appropriate. */ | |
| 523 | − trb = &state->new_deq_ptr->generic; | |
| 524 | − if (TRB_TYPE_LINK_LE32(trb->field[3]) && | |
| 525 | − (trb->field[3] & cpu_to_le32(LINK_TOGGLE))) | |
| 526 | − state->new_cycle_state ^= 0x1; | |
| 527 | − next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr); | |
| 503 | + state->new_deq_seg = new_seg; | |
| 504 | + state->new_deq_ptr = new_deq; | |
| 528 | 505 | |
| 529 | 506 | /* Don't update the ring cycle state for the producer (us). */ |
| 530 | 507 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
| @@ -2487,7 +2464,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, · 1956 unmodified lines | ||
| 2487 | 2464 | * last TRB of the previous TD. The command completion handle |
| 2488 | 2465 | * will take care the rest. |
| 2489 | 2466 | */ |
| 2490 | − if (!event_seg && trb_comp_code == COMP_STOP_INVAL) { | |
| 2467 | + if (!event_seg && (trb_comp_code == COMP_STOP || | |
| 2468 | + trb_comp_code == COMP_STOP_INVAL)) { | |
| 2491 | 2469 | ret = 0; |
| 2492 | 2470 | goto cleanup; |
| 2493 | 2471 | } |
| @@ -2880,6 +2880,9 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, · 2879 unmodified lines | ||
| 2880 | 2880 | ep_index, ep->stopped_stream, ep->stopped_td, |
| 2881 | 2881 | &deq_state); |
| 2882 | 2882 | |
| 2883 | + if (!deq_state.new_deq_ptr || !deq_state.new_deq_seg) | |
| 2884 | + return; | |
| 2885 | + | |
| 2883 | 2886 | /* HW with the reset endpoint quirk will use the saved dequeue state to |
| 2884 | 2887 | * issue a configure endpoint command later. |
| 2885 | 2888 | */ |
| @@ -3250,6 +3250,7 @@ static const struct usb_device_id sisusb_table[] = { · 3249 unmodified lines | ||
| 3250 | 3250 | { USB_DEVICE(0x0711, 0x0918) }, |
| 3251 | 3251 | { USB_DEVICE(0x0711, 0x0920) }, |
| 3252 | 3252 | { USB_DEVICE(0x0711, 0x0950) }, |
| 3253 | + { USB_DEVICE(0x0711, 0x5200) }, | |
| 3253 | 3254 | { USB_DEVICE(0x182d, 0x021c) }, |
| 3254 | 3255 | { USB_DEVICE(0x182d, 0x0269) }, |
| 3255 | 3256 | { } |
| @@ -96,7 +96,7 @@ static bool ux500_configure_channel(struct dma_channel *channel, · 95 unmodified lines | ||
| 96 | 96 | struct musb *musb = ux500_channel->controller->private_data; |
| 97 | 97 | |
| 98 | 98 | dev_dbg(musb->controller, |
| 99 | − "packet_sz=%d, mode=%d, dma_addr=0x%llu, len=%d is_tx=%d\n", | |
| 99 | + "packet_sz=%d, mode=%d, dma_addr=0x%llx, len=%d is_tx=%d\n", | |
| 100 | 100 | packet_sz, mode, (unsigned long long) dma_addr, |
| 101 | 101 | len, ux500_channel->is_tx); |
| 102 | 102 | |
| @@ -260,10 +260,8 @@ static int gpio_vbus_probe(struct platform_device *pdev) · 259 unmodified lines | ||
| 260 | 260 | |
| 261 | 261 | gpio_vbus->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), |
| 262 | 262 | GFP_KERNEL); |
| 263 | − if (!gpio_vbus->phy.otg) { | |
| 264 | − kfree(gpio_vbus); | |
| 263 | + if (!gpio_vbus->phy.otg) | |
| 265 | 264 | return -ENOMEM; |
| 266 | − } | |
| 267 | 265 | |
| 268 | 266 | platform_set_drvdata(pdev, gpio_vbus); |
| 269 | 267 | gpio_vbus->dev = &pdev->dev; |
| @@ -1601,8 +1601,8 @@ static int msm_otg_probe(struct platform_device *pdev) · 1600 unmodified lines | ||
| 1601 | 1601 | */ |
| 1602 | 1602 | if (motg->phy_number) { |
| 1603 | 1603 | phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4); |
| 1604 | − if (IS_ERR(phy_select)) | |
| 1605 | − return PTR_ERR(phy_select); | |
| 1604 | + if (!phy_select) | |
| 1605 | + return -ENOMEM; | |
| 1606 | 1606 | /* Enable second PHY with the OTG port */ |
| 1607 | 1607 | writel(0x1, phy_select); |
| 1608 | 1608 | } |
| @@ -216,7 +216,7 @@ · 215 unmodified lines | ||
| 216 | 216 | |
| 217 | 217 | #define EXYNOS5_DRD_PHYPARAM1 (0x20) |
| 218 | 218 | |
| 219 | −#define PHYPARAM1_PCS_TXDEEMPH_MASK (0x1f << 0) | |
| 219 | +#define PHYPARAM1_PCS_TXDEEMPH_MASK (0x3f << 0) | |
| 220 | 220 | #define PHYPARAM1_PCS_TXDEEMPH (0x1c) |
| 221 | 221 | |
| 222 | 222 | #define EXYNOS5_DRD_PHYTERM (0x24) |
| @@ -232,6 +232,9 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) · 231 unmodified lines | ||
| 232 | 232 | phy = __usb_find_phy_dev(dev, &phy_bind_list, index); |
| 233 | 233 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { |
| 234 | 234 | dev_dbg(dev, "unable to find transceiver\n"); |
| 235 | + if (!IS_ERR(phy)) | |
| 236 | + phy = ERR_PTR(-ENODEV); | |
| 237 | + | |
| 235 | 238 | goto err0; |
| 236 | 239 | } |
| 237 | 240 | |
| @@ -146,6 +146,7 @@ static const struct usb_device_id id_table_combined[] = { · 145 unmodified lines | ||
| 146 | 146 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, |
| 147 | 147 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, |
| 148 | 148 | { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, |
| 149 | + { USB_DEVICE(FTDI_VID, FTDI_BM_ATOM_NANO_PID) }, | |
| 149 | 150 | { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) }, |
| 150 | 151 | { USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) }, |
| 151 | 152 | { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, |
| @@ -934,6 +935,8 @@ static const struct usb_device_id id_table_combined[] = { · 782 unmodified lines | ||
| 934 | 935 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, |
| 935 | 936 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, |
| 936 | 937 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, |
| 938 | + /* ekey Devices */ | |
| 939 | + { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, | |
| 937 | 940 | /* Infineon Devices */ |
| 938 | 941 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, |
| 939 | 942 | { } /* Terminating entry */ |
| @@ -42,6 +42,8 @@ · 41 unmodified lines | ||
| 42 | 42 | /* www.candapter.com Ewert Energy Systems CANdapter device */ |
| 43 | 43 | #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */ |
| 44 | 44 | |
| 45 | +#define FTDI_BM_ATOM_NANO_PID 0xa559 /* Basic Micro ATOM Nano USB2Serial */ | |
| 46 | + | |
| 45 | 47 | /* |
| 46 | 48 | * Texas Instruments XDS100v2 JTAG / BeagleBone A3 |
| 47 | 49 | * http://processors.wiki.ti.com/index.php/XDS100 |
| @@ -1378,3 +1380,8 @@ · 1330 unmodified lines | ||
| 1378 | 1380 | #define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */ |
| 1379 | 1381 | #define BRAINBOXES_US_160_7_PID 0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */ |
| 1380 | 1382 | #define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */ |
| 1383 | + | |
| 1384 | +/* | |
| 1385 | + * ekey biometric systems GmbH (http://ekey.net/) | |
| 1386 | + */ | |
| 1387 | +#define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ | |
| @@ -275,8 +275,12 @@ static void option_instat_callback(struct urb *urb); · 274 unmodified lines | ||
| 275 | 275 | #define ZTE_PRODUCT_MF622 0x0001 |
| 276 | 276 | #define ZTE_PRODUCT_MF628 0x0015 |
| 277 | 277 | #define ZTE_PRODUCT_MF626 0x0031 |
| 278 | −#define ZTE_PRODUCT_MC2718 0xffe8 | |
| 279 | 278 | #define ZTE_PRODUCT_AC2726 0xfff1 |
| 279 | +#define ZTE_PRODUCT_CDMA_TECH 0xfffe | |
| 280 | +#define ZTE_PRODUCT_AC8710T 0xffff | |
| 281 | +#define ZTE_PRODUCT_MC2718 0xffe8 | |
| 282 | +#define ZTE_PRODUCT_AD3812 0xffeb | |
| 283 | +#define ZTE_PRODUCT_MC2716 0xffed | |
| 280 | 284 | |
| 281 | 285 | #define BENQ_VENDOR_ID 0x04a5 |
| 282 | 286 | #define BENQ_PRODUCT_H10 0x4068 |
| @@ -494,6 +498,10 @@ static void option_instat_callback(struct urb *urb); · 211 unmodified lines | ||
| 494 | 498 | #define INOVIA_VENDOR_ID 0x20a6 |
| 495 | 499 | #define INOVIA_SEW858 0x1105 |
| 496 | 500 | |
| 501 | +/* VIA Telecom */ | |
| 502 | +#define VIATELECOM_VENDOR_ID 0x15eb | |
| 503 | +#define VIATELECOM_PRODUCT_CDS7 0x0001 | |
| 504 | + | |
| 497 | 505 | /* some devices interfaces need special handling due to a number of reasons */ |
| 498 | 506 | enum option_blacklist_reason { |
| 499 | 507 | OPTION_BLACKLIST_NONE = 0, |
| @@ -527,10 +535,18 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = { · 27 unmodified lines | ||
| 527 | 535 | .reserved = BIT(4), |
| 528 | 536 | }; |
| 529 | 537 | |
| 538 | +static const struct option_blacklist_info zte_ad3812_z_blacklist = { | |
| 539 | + .sendsetup = BIT(0) | BIT(1) | BIT(2), | |
| 540 | +}; | |
| 541 | + | |
| 530 | 542 | static const struct option_blacklist_info zte_mc2718_z_blacklist = { |
| 531 | 543 | .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), |
| 532 | 544 | }; |
| 533 | 545 | |
| 546 | +static const struct option_blacklist_info zte_mc2716_z_blacklist = { | |
| 547 | + .sendsetup = BIT(1) | BIT(2) | BIT(3), | |
| 548 | +}; | |
| 549 | + | |
| 534 | 550 | static const struct option_blacklist_info huawei_cdc12_blacklist = { |
| 535 | 551 | .reserved = BIT(1) | BIT(2), |
| 536 | 552 | }; |
| @@ -1070,6 +1086,7 @@ static const struct usb_device_id option_ids[] = { · 533 unmodified lines | ||
| 1070 | 1086 | { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, |
| 1071 | 1087 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, |
| 1072 | 1088 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
| 1089 | + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ | |
| 1073 | 1090 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
| 1074 | 1091 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ |
| 1075 | 1092 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
| @@ -1544,13 +1561,18 @@ static const struct usb_device_id option_ids[] = { · 468 unmodified lines | ||
| 1544 | 1561 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, |
| 1545 | 1562 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) }, |
| 1546 | 1563 | |
| 1547 | − /* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */ | |
| 1564 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, | |
| 1565 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | |
| 1566 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, | |
| 1548 | 1567 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), |
| 1549 | 1568 | .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, |
| 1569 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff), | |
| 1570 | + .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, | |
| 1571 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), | |
| 1572 | + .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, | |
| 1550 | 1573 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, |
| 1551 | 1574 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, |
| 1552 | 1575 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, |
| 1553 | − { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | |
| 1554 | 1576 | |
| 1555 | 1577 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, |
| 1556 | 1578 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, |
| @@ -1724,6 +1746,7 @@ static const struct usb_device_id option_ids[] = { · 167 unmodified lines | ||
| 1724 | 1746 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ |
| 1725 | 1747 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ |
| 1726 | 1748 | { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, |
| 1749 | + { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, | |
| 1727 | 1750 | { } /* Terminating entry */ |
| 1728 | 1751 | }; |
| 1729 | 1752 | MODULE_DEVICE_TABLE(usb, option_ids); |
| @@ -1916,6 +1939,8 @@ static void option_instat_callback(struct urb *urb) · 186 unmodified lines | ||
| 1916 | 1939 | dev_dbg(dev, "%s: type %x req %x\n", __func__, |
| 1917 | 1940 | req_pkt->bRequestType, req_pkt->bRequest); |
| 1918 | 1941 | } |
| 1942 | + } else if (status == -ENOENT || status == -ESHUTDOWN) { | |
| 1943 | + dev_dbg(dev, "%s: urb stopped: %d\n", __func__, status); | |
| 1919 | 1944 | } else |
| 1920 | 1945 | dev_err(dev, "%s: error %d\n", __func__, status); |
| 1921 | 1946 | |
| @@ -45,6 +45,7 @@ static const struct usb_device_id id_table[] = { · 44 unmodified lines | ||
| 45 | 45 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, |
| 46 | 46 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
| 47 | 47 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, |
| 48 | + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) }, | |
| 48 | 49 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
| 49 | 50 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
| 50 | 51 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 |
| 23 | 23 | #define PL2303_PRODUCT_ID_HCR331 0x331a |
| 24 | 24 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 |
| 25 | +#define PL2303_PRODUCT_ID_ZTEK 0xe1f1 | |
| 25 | 26 | |
| 26 | 27 | #define ATEN_VENDOR_ID 0x0557 |
| 27 | 28 | #define ATEN_VENDOR_ID2 0x0547 |
| @@ -764,29 +764,39 @@ static int usb_serial_probe(struct usb_interface *interface, · 763 unmodified lines | ||
| 764 | 764 | if (usb_endpoint_is_bulk_in(endpoint)) { |
| 765 | 765 | /* we found a bulk in endpoint */ |
| 766 | 766 | dev_dbg(ddev, "found bulk in on endpoint %d\n", i); |
| 767 | − bulk_in_endpoint[num_bulk_in] = endpoint; | |
| 768 | − ++num_bulk_in; | |
| 767 | + if (num_bulk_in < MAX_NUM_PORTS) { | |
| 768 | + bulk_in_endpoint[num_bulk_in] = endpoint; | |
| 769 | + ++num_bulk_in; | |
| 770 | + } | |
| 769 | 771 | } |
| 770 | 772 | |
| 771 | 773 | if (usb_endpoint_is_bulk_out(endpoint)) { |
| 772 | 774 | /* we found a bulk out endpoint */ |
| 773 | 775 | dev_dbg(ddev, "found bulk out on endpoint %d\n", i); |
| 774 | − bulk_out_endpoint[num_bulk_out] = endpoint; | |
| 775 | − ++num_bulk_out; | |
| 776 | + if (num_bulk_out < MAX_NUM_PORTS) { | |
| 777 | + bulk_out_endpoint[num_bulk_out] = endpoint; | |
| 778 | + ++num_bulk_out; | |
| 779 | + } | |
| 776 | 780 | } |
| 777 | 781 | |
| 778 | 782 | if (usb_endpoint_is_int_in(endpoint)) { |
| 779 | 783 | /* we found a interrupt in endpoint */ |
| 780 | 784 | dev_dbg(ddev, "found interrupt in on endpoint %d\n", i); |
| 781 | − interrupt_in_endpoint[num_interrupt_in] = endpoint; | |
| 782 | − ++num_interrupt_in; | |
| 785 | + if (num_interrupt_in < MAX_NUM_PORTS) { | |
| 786 | + interrupt_in_endpoint[num_interrupt_in] = | |
| 787 | + endpoint; | |
| 788 | + ++num_interrupt_in; | |
| 789 | + } | |
| 783 | 790 | } |
| 784 | 791 | |
| 785 | 792 | if (usb_endpoint_is_int_out(endpoint)) { |
| 786 | 793 | /* we found an interrupt out endpoint */ |
| 787 | 794 | dev_dbg(ddev, "found interrupt out on endpoint %d\n", i); |
| 788 | − interrupt_out_endpoint[num_interrupt_out] = endpoint; | |
| 789 | − ++num_interrupt_out; | |
| 795 | + if (num_interrupt_out < MAX_NUM_PORTS) { | |
| 796 | + interrupt_out_endpoint[num_interrupt_out] = | |
| 797 | + endpoint; | |
| 798 | + ++num_interrupt_out; | |
| 799 | + } | |
| 790 | 800 | } |
| 791 | 801 | } |
| 792 | 802 | |
| @@ -809,8 +819,10 @@ static int usb_serial_probe(struct usb_interface *interface, · 16 unmodified lines | ||
| 809 | 819 | if (usb_endpoint_is_int_in(endpoint)) { |
| 810 | 820 | /* we found a interrupt in endpoint */ |
| 811 | 821 | dev_dbg(ddev, "found interrupt in for Prolific device on separate interface\n"); |
| 812 | − interrupt_in_endpoint[num_interrupt_in] = endpoint; | |
| 813 | − ++num_interrupt_in; | |
| 822 | + if (num_interrupt_in < MAX_NUM_PORTS) { | |
| 823 | + interrupt_in_endpoint[num_interrupt_in] = endpoint; | |
| 824 | + ++num_interrupt_in; | |
| 825 | + } | |
| 814 | 826 | } |
| 815 | 827 | } |
| 816 | 828 | } |
| @@ -850,6 +862,11 @@ static int usb_serial_probe(struct usb_interface *interface, · 33 unmodified lines | ||
| 850 | 862 | num_ports = type->num_ports; |
| 851 | 863 | } |
| 852 | 864 | |
| 865 | + if (num_ports > MAX_NUM_PORTS) { | |
| 866 | + dev_warn(ddev, "too many ports requested: %d\n", num_ports); | |
| 867 | + num_ports = MAX_NUM_PORTS; | |
| 868 | + } | |
| 869 | + | |
| 853 | 870 | serial->num_ports = num_ports; |
| 854 | 871 | serial->num_bulk_in = num_bulk_in; |
| 855 | 872 | serial->num_bulk_out = num_bulk_out; |
| @@ -514,6 +514,10 @@ static void command_port_read_callback(struct urb *urb) · 513 unmodified lines | ||
| 514 | 514 | dev_dbg(&urb->dev->dev, "%s - command_info is NULL, exiting.\n", __func__); |
| 515 | 515 | return; |
| 516 | 516 | } |
| 517 | + if (!urb->actual_length) { | |
| 518 | + dev_dbg(&urb->dev->dev, "%s - empty response, exiting.\n", __func__); | |
| 519 | + return; | |
| 520 | + } | |
| 517 | 521 | if (status) { |
| 518 | 522 | dev_dbg(&urb->dev->dev, "%s - nonzero urb status: %d\n", __func__, status); |
| 519 | 523 | if (status != -ENOENT) |
| @@ -534,7 +538,8 @@ static void command_port_read_callback(struct urb *urb) · 14 unmodified lines | ||
| 534 | 538 | /* These are unsolicited reports from the firmware, hence no |
| 535 | 539 | waiting command to wakeup */ |
| 536 | 540 | dev_dbg(&urb->dev->dev, "%s - event received\n", __func__); |
| 537 | − } else if (data[0] == WHITEHEAT_GET_DTR_RTS) { | |
| 541 | + } else if ((data[0] == WHITEHEAT_GET_DTR_RTS) && | |
| 542 | + (urb->actual_length - 1 <= sizeof(command_info->result_buffer))) { | |
| 538 | 543 | memcpy(command_info->result_buffer, &data[1], |
| 539 | 544 | urb->actual_length - 1); |
| 540 | 545 | command_info->command_finished = WHITEHEAT_CMD_COMPLETE; |
| @@ -272,28 +272,8 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) · 271 unmodified lines | ||
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | static const struct usb_device_id id_table[] = { |
| 275 | − /* AC8710, AC8710T */ | |
| 276 | − { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffff, 0xff, 0xff, 0xff) }, | |
| 277 | − /* AC8700 */ | |
| 278 | − { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfffe, 0xff, 0xff, 0xff) }, | |
| 279 | 275 | /* MG880 */ |
| 280 | 276 | { USB_DEVICE(0x19d2, 0xfffd) }, |
| 281 | − { USB_DEVICE(0x19d2, 0xfffc) }, | |
| 282 | − { USB_DEVICE(0x19d2, 0xfffb) }, | |
| 283 | − /* AC8710_V3 */ | |
| 284 | − { USB_DEVICE(0x19d2, 0xfff6) }, | |
| 285 | − { USB_DEVICE(0x19d2, 0xfff7) }, | |
| 286 | − { USB_DEVICE(0x19d2, 0xfff8) }, | |
| 287 | − { USB_DEVICE(0x19d2, 0xfff9) }, | |
| 288 | − { USB_DEVICE(0x19d2, 0xffee) }, | |
| 289 | − /* AC2716, MC2716 */ | |
| 290 | − { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffed, 0xff, 0xff, 0xff) }, | |
| 291 | − /* AD3812 */ | |
| 292 | − { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffeb, 0xff, 0xff, 0xff) }, | |
| 293 | − { USB_DEVICE(0x19d2, 0xffec) }, | |
| 294 | − { USB_DEVICE(0x05C6, 0x3197) }, | |
| 295 | − { USB_DEVICE(0x05C6, 0x6000) }, | |
| 296 | − { USB_DEVICE(0x05C6, 0x9008) }, | |
| 297 | 277 | { }, |
| 298 | 278 | }; |
| 299 | 279 | MODULE_DEVICE_TABLE(usb, id_table); |
| @@ -922,6 +922,12 @@ UNUSUAL_DEV( 0x069b, 0x3004, 0x0001, 0x0001, · 921 unmodified lines | ||
| 922 | 922 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| 923 | 923 | US_FL_FIX_CAPACITY ), |
| 924 | 924 | |
| 925 | +UNUSUAL_DEV( 0x06ca, 0x2003, 0x0100, 0x0100, | |
| 926 | + "Newer Technology", | |
| 927 | + "uSCSI", | |
| 928 | + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | |
| 929 | + US_FL_SCM_MULT_TARG ), | |
| 930 | + | |
| 925 | 931 | /* Reported by Adrian Pilchowiec <adi1981@epf.pl> */ |
| 926 | 932 | UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x0000, |
| 927 | 933 | "RockChip", |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
| @@ -25,33 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "usbip_common.h" |
| 26 | 26 | #include "stub.h" |
| 27 | 27 | |
| 28 | −/* | |
| 29 | − * Define device IDs here if you want to explicitly limit exportable devices. | |
| 30 | − * In most cases, wildcard matching will be okay because driver binding can be | |
| 31 | − * changed dynamically by a userland program. | |
| 32 | − */ | |
| 33 | −static struct usb_device_id stub_table[] = { | |
| 34 | −#if 0 | |
| 35 | − /* just an example */ | |
| 36 | − { USB_DEVICE(0x05ac, 0x0301) }, /* Mac 1 button mouse */ | |
| 37 | − { USB_DEVICE(0x0430, 0x0009) }, /* Plat Home Keyboard */ | |
| 38 | − { USB_DEVICE(0x059b, 0x0001) }, /* Iomega USB Zip 100 */ | |
| 39 | − { USB_DEVICE(0x04b3, 0x4427) }, /* IBM USB CD-ROM */ | |
| 40 | − { USB_DEVICE(0x05a9, 0xa511) }, /* LifeView USB cam */ | |
| 41 | − { USB_DEVICE(0x55aa, 0x0201) }, /* Imation card reader */ | |
| 42 | − { USB_DEVICE(0x046d, 0x0870) }, /* Qcam Express(QV-30) */ | |
| 43 | − { USB_DEVICE(0x04bb, 0x0101) }, /* IO-DATA HD 120GB */ | |
| 44 | − { USB_DEVICE(0x04bb, 0x0904) }, /* IO-DATA USB-ET/TX */ | |
| 45 | − { USB_DEVICE(0x04bb, 0x0201) }, /* IO-DATA USB-ET/TX */ | |
| 46 | − { USB_DEVICE(0x08bb, 0x2702) }, /* ONKYO USB Speaker */ | |
| 47 | − { USB_DEVICE(0x046d, 0x08b2) }, /* Logicool Qcam 4000 Pro */ | |
| 48 | −#endif | |
| 49 | − /* magic for wild card */ | |
| 50 | − { .driver_info = 1 }, | |
| 51 | − { 0, } /* Terminating entry */ | |
| 52 | −}; | |
| 53 | −MODULE_DEVICE_TABLE(usb, stub_table); | |
| 54 | − | |
| 55 | 28 | /* |
| 56 | 29 | * usbip_status shows the status of usbip-host as long as this driver is bound |
| 57 | 30 | * to the target device. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <linux/types.h> |
| 30 | 30 | #include <linux/usb.h> |
| 31 | 31 | #include <linux/wait.h> |
| 32 | −#include "uapi/usbip.h" | |
| 32 | +#include <uapi/linux/usbip.h> | |
| 33 | 33 | |
| 34 | 34 | #define USBIP_VERSION "1.0.0" |
| 35 | 35 | |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
| @@ -2602,6 +2602,7 @@ static void wa_buf_in_cb(struct urb *urb) · 2601 unmodified lines | ||
| 2602 | 2602 | dev = &wa->usb_iface->dev; |
| 2603 | 2603 | --(wa->active_buf_in_urbs); |
| 2604 | 2604 | active_buf_in_urbs = wa->active_buf_in_urbs; |
| 2605 | + rpipe = xfer->ep->hcpriv; | |
| 2605 | 2606 | |
| 2606 | 2607 | if (usb_pipeisoc(xfer->urb->pipe)) { |
| 2607 | 2608 | struct usb_iso_packet_descriptor *iso_frame_desc = |
| @@ -2659,7 +2660,6 @@ static void wa_buf_in_cb(struct urb *urb) · 51 unmodified lines | ||
| 2659 | 2660 | resubmit_dti = (isoc_data_frame_count == |
| 2660 | 2661 | urb_frame_count); |
| 2661 | 2662 | } else if (active_buf_in_urbs == 0) { |
| 2662 | − rpipe = xfer->ep->hcpriv; | |
| 2663 | 2663 | dev_dbg(dev, |
| 2664 | 2664 | "xfer %p 0x%08X#%u: data in done (%zu bytes)\n", |
| 2665 | 2665 | xfer, wa_xfer_id(xfer), seg->index, |
| @@ -2685,7 +2685,6 @@ static void wa_buf_in_cb(struct urb *urb) · 19 unmodified lines | ||
| 2685 | 2685 | */ |
| 2686 | 2686 | resubmit_dti = wa->dti_state != WA_DTI_TRANSFER_RESULT_PENDING; |
| 2687 | 2687 | spin_lock_irqsave(&xfer->lock, flags); |
| 2688 | − rpipe = xfer->ep->hcpriv; | |
| 2689 | 2688 | if (printk_ratelimit()) |
| 2690 | 2689 | dev_err(dev, "xfer %p 0x%08X#%u: data in error %d\n", |
| 2691 | 2690 | xfer, wa_xfer_id(xfer), seg->index, |
| @@ -173,6 +173,7 @@ static int pwm_backlight_parse_dt(struct device *dev, · 172 unmodified lines | ||
| 173 | 173 | data->max_brightness--; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | + data->enable_gpio = -EINVAL; | |
| 176 | 177 | return 0; |
| 177 | 178 | } |
| 178 | 179 | |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/list.h> |
| 25 | 25 | #include <linux/amba/bus.h> |
| 26 | 26 | #include <linux/amba/clcd.h> |
| 27 | +#include <linux/bitops.h> | |
| 27 | 28 | #include <linux/clk.h> |
| 28 | 29 | #include <linux/hardirq.h> |
| 29 | 30 | #include <linux/dma-mapping.h> |
| @@ -650,6 +651,7 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) · 620 unmodified lines | ||
| 650 | 651 | { |
| 651 | 652 | struct device_node *endpoint; |
| 652 | 653 | int err; |
| 654 | + unsigned int bpp; | |
| 653 | 655 | u32 max_bandwidth; |
| 654 | 656 | u32 tft_r0b0g0[3]; |
| 655 | 657 | |
| @@ -667,11 +669,22 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) · 11 unmodified lines | ||
| 667 | 669 | |
| 668 | 670 | err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", |
| 669 | 671 | &max_bandwidth); |
| 670 | − if (!err) | |
| 671 | − fb->panel->bpp = 8 * max_bandwidth / (fb->panel->mode.xres * | |
| 672 | − fb->panel->mode.yres * fb->panel->mode.refresh); | |
| 673 | − else | |
| 674 | − fb->panel->bpp = 32; | |
| 672 | + if (!err) { | |
| 673 | + /* | |
| 674 | + * max_bandwidth is in bytes per second and pixclock in | |
| 675 | + * pico-seconds, so the maximum allowed bits per pixel is | |
| 676 | + * 8 * max_bandwidth / (PICOS2KHZ(pixclock) * 1000) | |
| 677 | + * Rearrange this calculation to avoid overflow and then ensure | |
| 678 | + * result is a valid format. | |
| 679 | + */ | |
| 680 | + bpp = max_bandwidth / (1000 / 8) | |
| 681 | + / PICOS2KHZ(fb->panel->mode.pixclock); | |
| 682 | + bpp = rounddown_pow_of_two(bpp); | |
| 683 | + if (bpp > 32) | |
| 684 | + bpp = 32; | |
| 685 | + } else | |
| 686 | + bpp = 32; | |
| 687 | + fb->panel->bpp = bpp; | |
| 675 | 688 | |
| 676 | 689 | #ifdef CONFIG_CPU_BIG_ENDIAN |
| 677 | 690 | fb->panel->cntl |= CNTL_BEBO; |
| @@ -1102,12 +1102,14 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) · 1101 unmodified lines | ||
| 1102 | 1102 | timings = of_get_display_timings(display_np); |
| 1103 | 1103 | if (!timings) { |
| 1104 | 1104 | dev_err(dev, "failed to get display timings\n"); |
| 1105 | + ret = -EINVAL; | |
| 1105 | 1106 | goto put_display_node; |
| 1106 | 1107 | } |
| 1107 | 1108 | |
| 1108 | 1109 | timings_np = of_find_node_by_name(display_np, "display-timings"); |
| 1109 | 1110 | if (!timings_np) { |
| 1110 | 1111 | dev_err(dev, "failed to find display-timings node\n"); |
| 1112 | + ret = -ENODEV; | |
| 1111 | 1113 | goto put_display_node; |
| 1112 | 1114 | } |
| 1113 | 1115 | |
| @@ -273,7 +273,7 @@ static struct chips_init_reg chips_init_xr[] = { · 272 unmodified lines | ||
| 273 | 273 | { 0xa8, 0x00 } |
| 274 | 274 | }; |
| 275 | 275 | |
| 276 | −static void __init chips_hw_init(void) | |
| 276 | +static void chips_hw_init(void) | |
| 277 | 277 | { |
| 278 | 278 | int i; |
| 279 | 279 | |
| @@ -419,7 +419,7 @@ static void lcd_cfg_horizontal_sync(int back_porch, int pulse_width, · 418 unmodified lines | ||
| 419 | 419 | { |
| 420 | 420 | u32 reg; |
| 421 | 421 | |
| 422 | − reg = lcdc_read(LCD_RASTER_TIMING_0_REG) & 0xf; | |
| 422 | + reg = lcdc_read(LCD_RASTER_TIMING_0_REG) & 0x3ff; | |
| 423 | 423 | reg |= (((back_porch-1) & 0xff) << 24) |
| 424 | 424 | | (((front_porch-1) & 0xff) << 16) |
| 425 | 425 | | (((pulse_width-1) & 0x3f) << 10); |
| @@ -236,6 +236,7 @@ timingfail: · 235 unmodified lines | ||
| 236 | 236 | if (native_mode) |
| 237 | 237 | of_node_put(native_mode); |
| 238 | 238 | display_timings_release(disp); |
| 239 | + disp = NULL; | |
| 239 | 240 | entryfail: |
| 240 | 241 | kfree(disp); |
| 241 | 242 | dispfail: |
| @@ -141,6 +141,7 @@ struct kioctx { · 140 unmodified lines | ||
| 141 | 141 | |
| 142 | 142 | struct { |
| 143 | 143 | unsigned tail; |
| 144 | + unsigned completed_events; | |
| 144 | 145 | spinlock_t completion_lock; |
| 145 | 146 | } ____cacheline_aligned_in_smp; |
| 146 | 147 | |
| @@ -792,6 +793,8 @@ void exit_aio(struct mm_struct *mm) · 645 unmodified lines | ||
| 792 | 793 | |
| 793 | 794 | for (i = 0; i < table->nr; ++i) { |
| 794 | 795 | struct kioctx *ctx = table->table[i]; |
| 796 | + struct completion requests_done = | |
| 797 | + COMPLETION_INITIALIZER_ONSTACK(requests_done); | |
| 795 | 798 | |
| 796 | 799 | if (!ctx) |
| 797 | 800 | continue; |
| @@ -803,7 +806,10 @@ void exit_aio(struct mm_struct *mm) · 5 unmodified lines | ||
| 803 | 806 | * that it needs to unmap the area, just set it to 0. |
| 804 | 807 | */ |
| 805 | 808 | ctx->mmap_size = 0; |
| 806 | − kill_ioctx(mm, ctx, NULL); | |
| 809 | + kill_ioctx(mm, ctx, &requests_done); | |
| 810 | + | |
| 811 | + /* Wait until all IO for the context are done. */ | |
| 812 | + wait_for_completion(&requests_done); | |
| 807 | 813 | } |
| 808 | 814 | |
| 809 | 815 | RCU_INIT_POINTER(mm->ioctx_table, NULL); |
| @@ -857,6 +863,68 @@ out: · 47 unmodified lines | ||
| 857 | 863 | return ret; |
| 858 | 864 | } |
| 859 | 865 | |
| 866 | +/* refill_reqs_available | |
| 867 | + * Updates the reqs_available reference counts used for tracking the | |
| 868 | + * number of free slots in the completion ring. This can be called | |
| 869 | + * from aio_complete() (to optimistically update reqs_available) or | |
| 870 | + * from aio_get_req() (the we're out of events case). It must be | |
| 871 | + * called holding ctx->completion_lock. | |
| 872 | + */ | |
| 873 | +static void refill_reqs_available(struct kioctx *ctx, unsigned head, | |
| 874 | + unsigned tail) | |
| 875 | +{ | |
| 876 | + unsigned events_in_ring, completed; | |
| 877 | + | |
| 878 | + /* Clamp head since userland can write to it. */ | |
| 879 | + head %= ctx->nr_events; | |
| 880 | + if (head <= tail) | |
| 881 | + events_in_ring = tail - head; | |
| 882 | + else | |
| 883 | + events_in_ring = ctx->nr_events - (head - tail); | |
| 884 | + | |
| 885 | + completed = ctx->completed_events; | |
| 886 | + if (events_in_ring < completed) | |
| 887 | + completed -= events_in_ring; | |
| 888 | + else | |
| 889 | + completed = 0; | |
| 890 | + | |
| 891 | + if (!completed) | |
| 892 | + return; | |
| 893 | + | |
| 894 | + ctx->completed_events -= completed; | |
| 895 | + put_reqs_available(ctx, completed); | |
| 896 | +} | |
| 897 | + | |
| 898 | +/* user_refill_reqs_available | |
| 899 | + * Called to refill reqs_available when aio_get_req() encounters an | |
| 900 | + * out of space in the completion ring. | |
| 901 | + */ | |
| 902 | +static void user_refill_reqs_available(struct kioctx *ctx) | |
| 903 | +{ | |
| 904 | + spin_lock_irq(&ctx->completion_lock); | |
| 905 | + if (ctx->completed_events) { | |
| 906 | + struct aio_ring *ring; | |
| 907 | + unsigned head; | |
| 908 | + | |
| 909 | + /* Access of ring->head may race with aio_read_events_ring() | |
| 910 | + * here, but that's okay since whether we read the old version | |
| 911 | + * or the new version, and either will be valid. The important | |
| 912 | + * part is that head cannot pass tail since we prevent | |
| 913 | + * aio_complete() from updating tail by holding | |
| 914 | + * ctx->completion_lock. Even if head is invalid, the check | |
| 915 | + * against ctx->completed_events below will make sure we do the | |
| 916 | + * safe/right thing. | |
| 917 | + */ | |
| 918 | + ring = kmap_atomic(ctx->ring_pages[0]); | |
| 919 | + head = ring->head; | |
| 920 | + kunmap_atomic(ring); | |
| 921 | + | |
| 922 | + refill_reqs_available(ctx, head, ctx->tail); | |
| 923 | + } | |
| 924 | + | |
| 925 | + spin_unlock_irq(&ctx->completion_lock); | |
| 926 | +} | |
| 927 | + | |
| 860 | 928 | /* aio_get_req |
| 861 | 929 | * Allocate a slot for an aio request. |
| 862 | 930 | * Returns NULL if no requests are free. |
| @@ -865,8 +933,11 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx) · 2 unmodified lines | ||
| 865 | 933 | { |
| 866 | 934 | struct kiocb *req; |
| 867 | 935 | |
| 868 | − if (!get_reqs_available(ctx)) | |
| 869 | − return NULL; | |
| 936 | + if (!get_reqs_available(ctx)) { | |
| 937 | + user_refill_reqs_available(ctx); | |
| 938 | + if (!get_reqs_available(ctx)) | |
| 939 | + return NULL; | |
| 940 | + } | |
| 870 | 941 | |
| 871 | 942 | req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO); |
| 872 | 943 | if (unlikely(!req)) |
| @@ -925,8 +996,8 @@ void aio_complete(struct kiocb *iocb, long res, long res2) · 52 unmodified lines | ||
| 925 | 996 | struct kioctx *ctx = iocb->ki_ctx; |
| 926 | 997 | struct aio_ring *ring; |
| 927 | 998 | struct io_event *ev_page, *event; |
| 999 | + unsigned tail, pos, head; | |
| 928 | 1000 | unsigned long flags; |
| 929 | − unsigned tail, pos; | |
| 930 | 1001 | |
| 931 | 1002 | /* |
| 932 | 1003 | * Special case handling for sync iocbs: |
| @@ -987,10 +1058,14 @@ void aio_complete(struct kiocb *iocb, long res, long res2) · 54 unmodified lines | ||
| 987 | 1058 | ctx->tail = tail; |
| 988 | 1059 | |
| 989 | 1060 | ring = kmap_atomic(ctx->ring_pages[0]); |
| 1061 | + head = ring->head; | |
| 990 | 1062 | ring->tail = tail; |
| 991 | 1063 | kunmap_atomic(ring); |
| 992 | 1064 | flush_dcache_page(ctx->ring_pages[0]); |
| 993 | 1065 | |
| 1066 | + ctx->completed_events++; | |
| 1067 | + if (ctx->completed_events > 1) | |
| 1068 | + refill_reqs_available(ctx, head, tail); | |
| 994 | 1069 | spin_unlock_irqrestore(&ctx->completion_lock, flags); |
| 995 | 1070 | |
| 996 | 1071 | pr_debug("added to ring %p at [%u]\n", iocb, tail); |
| @@ -1005,7 +1080,6 @@ void aio_complete(struct kiocb *iocb, long res, long res2) · 8 unmodified lines | ||
| 1005 | 1080 | |
| 1006 | 1081 | /* everything turned out well, dispose of the aiocb. */ |
| 1007 | 1082 | kiocb_free(iocb); |
| 1008 | − put_reqs_available(ctx, 1); | |
| 1009 | 1083 | |
| 1010 | 1084 | /* |
| 1011 | 1085 | * We have to order our ring_info tail store above and test |
| @@ -1042,6 +1116,12 @@ static long aio_read_events_ring(struct kioctx *ctx, · 30 unmodified lines | ||
| 1042 | 1116 | tail = ring->tail; |
| 1043 | 1117 | kunmap_atomic(ring); |
| 1044 | 1118 | |
| 1119 | + /* | |
| 1120 | + * Ensure that once we've read the current tail pointer, that | |
| 1121 | + * we also see the events that were stored up to the tail. | |
| 1122 | + */ | |
| 1123 | + smp_rmb(); | |
| 1124 | + | |
| 1045 | 1125 | pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events); |
| 1046 | 1126 | |
| 1047 | 1127 | if (head == tail) |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/list.h> |
| 23 | 23 | #include <linux/spinlock.h> |
| 24 | 24 | #include <linux/freezer.h> |
| 25 | −#include <linux/workqueue.h> | |
| 26 | 25 | #include "async-thread.h" |
| 27 | 26 | #include "ctree.h" |
| 28 | 27 | |
| @@ -55,8 +54,39 @@ struct btrfs_workqueue { · 26 unmodified lines | ||
| 55 | 54 | struct __btrfs_workqueue *high; |
| 56 | 55 | }; |
| 57 | 56 | |
| 58 | −static inline struct __btrfs_workqueue | |
| 59 | −*__btrfs_alloc_workqueue(const char *name, int flags, int max_active, | |
| 57 | +static void normal_work_helper(struct btrfs_work *work); | |
| 58 | + | |
| 59 | +#define BTRFS_WORK_HELPER(name) \ | |
| 60 | +void btrfs_##name(struct work_struct *arg) \ | |
| 61 | +{ \ | |
| 62 | + struct btrfs_work *work = container_of(arg, struct btrfs_work, \ | |
| 63 | + normal_work); \ | |
| 64 | + normal_work_helper(work); \ | |
| 65 | +} | |
| 66 | + | |
| 67 | +BTRFS_WORK_HELPER(worker_helper); | |
| 68 | +BTRFS_WORK_HELPER(delalloc_helper); | |
| 69 | +BTRFS_WORK_HELPER(flush_delalloc_helper); | |
| 70 | +BTRFS_WORK_HELPER(cache_helper); | |
| 71 | +BTRFS_WORK_HELPER(submit_helper); | |
| 72 | +BTRFS_WORK_HELPER(fixup_helper); | |
| 73 | +BTRFS_WORK_HELPER(endio_helper); | |
| 74 | +BTRFS_WORK_HELPER(endio_meta_helper); | |
| 75 | +BTRFS_WORK_HELPER(endio_meta_write_helper); | |
| 76 | +BTRFS_WORK_HELPER(endio_raid56_helper); | |
| 77 | +BTRFS_WORK_HELPER(rmw_helper); | |
| 78 | +BTRFS_WORK_HELPER(endio_write_helper); | |
| 79 | +BTRFS_WORK_HELPER(freespace_write_helper); | |
| 80 | +BTRFS_WORK_HELPER(delayed_meta_helper); | |
| 81 | +BTRFS_WORK_HELPER(readahead_helper); | |
| 82 | +BTRFS_WORK_HELPER(qgroup_rescan_helper); | |
| 83 | +BTRFS_WORK_HELPER(extent_refs_helper); | |
| 84 | +BTRFS_WORK_HELPER(scrub_helper); | |
| 85 | +BTRFS_WORK_HELPER(scrubwrc_helper); | |
| 86 | +BTRFS_WORK_HELPER(scrubnc_helper); | |
| 87 | + | |
| 88 | +static struct __btrfs_workqueue * | |
| 89 | +__btrfs_alloc_workqueue(const char *name, int flags, int max_active, | |
| 60 | 90 | int thresh) |
| 61 | 91 | { |
| 62 | 92 | struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS); |
| @@ -232,13 +262,11 @@ static void run_ordered_work(struct __btrfs_workqueue *wq) · 169 unmodified lines | ||
| 232 | 262 | spin_unlock_irqrestore(lock, flags); |
| 233 | 263 | } |
| 234 | 264 | |
| 235 | −static void normal_work_helper(struct work_struct *arg) | |
| 265 | +static void normal_work_helper(struct btrfs_work *work) | |
| 236 | 266 | { |
| 237 | − struct btrfs_work *work; | |
| 238 | 267 | struct __btrfs_workqueue *wq; |
| 239 | 268 | int need_order = 0; |
| 240 | 269 | |
| 241 | − work = container_of(arg, struct btrfs_work, normal_work); | |
| 242 | 270 | /* |
| 243 | 271 | * We should not touch things inside work in the following cases: |
| 244 | 272 | * 1) after work->func() if it has no ordered_free |
| @@ -262,7 +290,7 @@ static void normal_work_helper(struct work_struct *arg) · 17 unmodified lines | ||
| 262 | 290 | trace_btrfs_all_work_done(work); |
| 263 | 291 | } |
| 264 | 292 | |
| 265 | −void btrfs_init_work(struct btrfs_work *work, | |
| 293 | +void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t uniq_func, | |
| 266 | 294 | btrfs_func_t func, |
| 267 | 295 | btrfs_func_t ordered_func, |
| 268 | 296 | btrfs_func_t ordered_free) |
| @@ -270,7 +298,7 @@ void btrfs_init_work(struct btrfs_work *work, · 1 unmodified line | ||
| 270 | 298 | work->func = func; |
| 271 | 299 | work->ordered_func = ordered_func; |
| 272 | 300 | work->ordered_free = ordered_free; |
| 273 | − INIT_WORK(&work->normal_work, normal_work_helper); | |
| 301 | + INIT_WORK(&work->normal_work, uniq_func); | |
| 274 | 302 | INIT_LIST_HEAD(&work->ordered_list); |
| 275 | 303 | work->flags = 0; |
| 276 | 304 | } |
| @@ -19,12 +19,14 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #ifndef __BTRFS_ASYNC_THREAD_ |
| 21 | 21 | #define __BTRFS_ASYNC_THREAD_ |
| 22 | +#include <linux/workqueue.h> | |
| 22 | 23 | |
| 23 | 24 | struct btrfs_workqueue; |
| 24 | 25 | /* Internal use only */ |
| 25 | 26 | struct __btrfs_workqueue; |
| 26 | 27 | struct btrfs_work; |
| 27 | 28 | typedef void (*btrfs_func_t)(struct btrfs_work *arg); |
| 29 | +typedef void (*btrfs_work_func_t)(struct work_struct *arg); | |
| 28 | 30 | |
| 29 | 31 | struct btrfs_work { |
| 30 | 32 | btrfs_func_t func; |
| @@ -38,11 +40,35 @@ struct btrfs_work { · 7 unmodified lines | ||
| 38 | 40 | unsigned long flags; |
| 39 | 41 | }; |
| 40 | 42 | |
| 43 | +#define BTRFS_WORK_HELPER_PROTO(name) \ | |
| 44 | +void btrfs_##name(struct work_struct *arg) | |
| 45 | + | |
| 46 | +BTRFS_WORK_HELPER_PROTO(worker_helper); | |
| 47 | +BTRFS_WORK_HELPER_PROTO(delalloc_helper); | |
| 48 | +BTRFS_WORK_HELPER_PROTO(flush_delalloc_helper); | |
| 49 | +BTRFS_WORK_HELPER_PROTO(cache_helper); | |
| 50 | +BTRFS_WORK_HELPER_PROTO(submit_helper); | |
| 51 | +BTRFS_WORK_HELPER_PROTO(fixup_helper); | |
| 52 | +BTRFS_WORK_HELPER_PROTO(endio_helper); | |
| 53 | +BTRFS_WORK_HELPER_PROTO(endio_meta_helper); | |
| 54 | +BTRFS_WORK_HELPER_PROTO(endio_meta_write_helper); | |
| 55 | +BTRFS_WORK_HELPER_PROTO(endio_raid56_helper); | |
| 56 | +BTRFS_WORK_HELPER_PROTO(rmw_helper); | |
| 57 | +BTRFS_WORK_HELPER_PROTO(endio_write_helper); | |
| 58 | +BTRFS_WORK_HELPER_PROTO(freespace_write_helper); | |
| 59 | +BTRFS_WORK_HELPER_PROTO(delayed_meta_helper); | |
| 60 | +BTRFS_WORK_HELPER_PROTO(readahead_helper); | |
| 61 | +BTRFS_WORK_HELPER_PROTO(qgroup_rescan_helper); | |
| 62 | +BTRFS_WORK_HELPER_PROTO(extent_refs_helper); | |
| 63 | +BTRFS_WORK_HELPER_PROTO(scrub_helper); | |
| 64 | +BTRFS_WORK_HELPER_PROTO(scrubwrc_helper); | |
| 65 | +BTRFS_WORK_HELPER_PROTO(scrubnc_helper); | |
| 66 | + | |
| 41 | 67 | struct btrfs_workqueue *btrfs_alloc_workqueue(const char *name, |
| 42 | 68 | int flags, |
| 43 | 69 | int max_active, |
| 44 | 70 | int thresh); |
| 45 | −void btrfs_init_work(struct btrfs_work *work, | |
| 71 | +void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t helper, | |
| 46 | 72 | btrfs_func_t func, |
| 47 | 73 | btrfs_func_t ordered_func, |
| 48 | 74 | btrfs_func_t ordered_free); |
| @@ -1395,8 +1395,8 @@ static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root, · 1394 unmodified lines | ||
| 1395 | 1395 | return -ENOMEM; |
| 1396 | 1396 | |
| 1397 | 1397 | async_work->delayed_root = delayed_root; |
| 1398 | − btrfs_init_work(&async_work->work, btrfs_async_run_delayed_root, | |
| 1399 | − NULL, NULL); | |
| 1398 | + btrfs_init_work(&async_work->work, btrfs_delayed_meta_helper, | |
| 1399 | + btrfs_async_run_delayed_root, NULL, NULL); | |
| 1400 | 1400 | async_work->nr = nr; |
| 1401 | 1401 | |
| 1402 | 1402 | btrfs_queue_work(root->fs_info->delayed_workers, &async_work->work); |
| @@ -39,7 +39,6 @@ · 38 unmodified lines | ||
| 39 | 39 | #include "btrfs_inode.h" |
| 40 | 40 | #include "volumes.h" |
| 41 | 41 | #include "print-tree.h" |
| 42 | −#include "async-thread.h" | |
| 43 | 42 | #include "locking.h" |
| 44 | 43 | #include "tree-log.h" |
| 45 | 44 | #include "free-space-cache.h" |
| @@ -693,35 +692,41 @@ static void end_workqueue_bio(struct bio *bio, int err) · 647 unmodified lines | ||
| 693 | 692 | { |
| 694 | 693 | struct end_io_wq *end_io_wq = bio->bi_private; |
| 695 | 694 | struct btrfs_fs_info *fs_info; |
| 695 | + struct btrfs_workqueue *wq; | |
| 696 | + btrfs_work_func_t func; | |
| 696 | 697 | |
| 697 | 698 | fs_info = end_io_wq->info; |
| 698 | 699 | end_io_wq->error = err; |
| 699 | − btrfs_init_work(&end_io_wq->work, end_workqueue_fn, NULL, NULL); | |
| 700 | 700 | |
| 701 | 701 | if (bio->bi_rw & REQ_WRITE) { |
| 702 | − if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) | |
| 703 | − btrfs_queue_work(fs_info->endio_meta_write_workers, | |
| 704 | − &end_io_wq->work); | |
| 705 | − else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_FREE_SPACE) | |
| 706 | − btrfs_queue_work(fs_info->endio_freespace_worker, | |
| 707 | − &end_io_wq->work); | |
| 708 | − else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) | |
| 709 | − btrfs_queue_work(fs_info->endio_raid56_workers, | |
| 710 | − &end_io_wq->work); | |
| 711 | − else | |
| 712 | − btrfs_queue_work(fs_info->endio_write_workers, | |
| 713 | − &end_io_wq->work); | |
| 702 | + if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) { | |
| 703 | + wq = fs_info->endio_meta_write_workers; | |
| 704 | + func = btrfs_endio_meta_write_helper; | |
| 705 | + } else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_FREE_SPACE) { | |
| 706 | + wq = fs_info->endio_freespace_worker; | |
| 707 | + func = btrfs_freespace_write_helper; | |
| 708 | + } else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) { | |
| 709 | + wq = fs_info->endio_raid56_workers; | |
| 710 | + func = btrfs_endio_raid56_helper; | |
| 711 | + } else { | |
| 712 | + wq = fs_info->endio_write_workers; | |
| 713 | + func = btrfs_endio_write_helper; | |
| 714 | + } | |
| 714 | 715 | } else { |
| 715 | − if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) | |
| 716 | − btrfs_queue_work(fs_info->endio_raid56_workers, | |
| 717 | − &end_io_wq->work); | |
| 718 | − else if (end_io_wq->metadata) | |
| 719 | − btrfs_queue_work(fs_info->endio_meta_workers, | |
| 720 | − &end_io_wq->work); | |
| 721 | − else | |
| 722 | − btrfs_queue_work(fs_info->endio_workers, | |
| 723 | − &end_io_wq->work); | |
| 716 | + if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) { | |
| 717 | + wq = fs_info->endio_raid56_workers; | |
| 718 | + func = btrfs_endio_raid56_helper; | |
| 719 | + } else if (end_io_wq->metadata) { | |
| 720 | + wq = fs_info->endio_meta_workers; | |
| 721 | + func = btrfs_endio_meta_helper; | |
| 722 | + } else { | |
| 723 | + wq = fs_info->endio_workers; | |
| 724 | + func = btrfs_endio_helper; | |
| 725 | + } | |
| 724 | 726 | } |
| 727 | + | |
| 728 | + btrfs_init_work(&end_io_wq->work, func, end_workqueue_fn, NULL, NULL); | |
| 729 | + btrfs_queue_work(wq, &end_io_wq->work); | |
| 725 | 730 | } |
| 726 | 731 | |
| 727 | 732 | /* |
| @@ -828,7 +833,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, · 100 unmodified lines | ||
| 828 | 833 | async->submit_bio_start = submit_bio_start; |
| 829 | 834 | async->submit_bio_done = submit_bio_done; |
| 830 | 835 | |
| 831 | − btrfs_init_work(&async->work, run_one_async_start, | |
| 836 | + btrfs_init_work(&async->work, btrfs_worker_helper, run_one_async_start, | |
| 832 | 837 | run_one_async_done, run_one_async_free); |
| 833 | 838 | |
| 834 | 839 | async->bio_flags = bio_flags; |
| @@ -3450,7 +3455,8 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors) · 2615 unmodified lines | ||
| 3450 | 3455 | btrfs_set_stack_device_generation(dev_item, 0); |
| 3451 | 3456 | btrfs_set_stack_device_type(dev_item, dev->type); |
| 3452 | 3457 | btrfs_set_stack_device_id(dev_item, dev->devid); |
| 3453 | − btrfs_set_stack_device_total_bytes(dev_item, dev->total_bytes); | |
| 3458 | + btrfs_set_stack_device_total_bytes(dev_item, | |
| 3459 | + dev->disk_total_bytes); | |
| 3454 | 3460 | btrfs_set_stack_device_bytes_used(dev_item, dev->bytes_used); |
| 3455 | 3461 | btrfs_set_stack_device_io_align(dev_item, dev->io_align); |
| 3456 | 3462 | btrfs_set_stack_device_io_width(dev_item, dev->io_width); |
| @@ -552,7 +552,8 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, · 551 unmodified lines | ||
| 552 | 552 | caching_ctl->block_group = cache; |
| 553 | 553 | caching_ctl->progress = cache->key.objectid; |
| 554 | 554 | atomic_set(&caching_ctl->count, 1); |
| 555 | − btrfs_init_work(&caching_ctl->work, caching_thread, NULL, NULL); | |
| 555 | + btrfs_init_work(&caching_ctl->work, btrfs_cache_helper, | |
| 556 | + caching_thread, NULL, NULL); | |
| 556 | 557 | |
| 557 | 558 | spin_lock(&cache->lock); |
| 558 | 559 | /* |
| @@ -2749,8 +2750,8 @@ int btrfs_async_run_delayed_refs(struct btrfs_root *root, · 2190 unmodified lines | ||
| 2749 | 2750 | async->sync = 0; |
| 2750 | 2751 | init_completion(&async->wait); |
| 2751 | 2752 | |
| 2752 | − btrfs_init_work(&async->work, delayed_ref_async_start, | |
| 2753 | − NULL, NULL); | |
| 2753 | + btrfs_init_work(&async->work, btrfs_extent_refs_helper, | |
| 2754 | + delayed_ref_async_start, NULL, NULL); | |
| 2754 | 2755 | |
| 2755 | 2756 | btrfs_queue_work(root->fs_info->extent_workers, &async->work); |
| 2756 | 2757 | |
| @@ -3586,13 +3587,7 @@ static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) · 829 unmodified lines | ||
| 3586 | 3587 | */ |
| 3587 | 3588 | static u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags) |
| 3588 | 3589 | { |
| 3589 | − /* | |
| 3590 | − * we add in the count of missing devices because we want | |
| 3591 | − * to make sure that any RAID levels on a degraded FS | |
| 3592 | − * continue to be honored. | |
| 3593 | − */ | |
| 3594 | − u64 num_devices = root->fs_info->fs_devices->rw_devices + | |
| 3595 | − root->fs_info->fs_devices->missing_devices; | |
| 3590 | + u64 num_devices = root->fs_info->fs_devices->rw_devices; | |
| 3596 | 3591 | u64 target; |
| 3597 | 3592 | u64 tmp; |
| 3598 | 3593 | |
| @@ -8440,13 +8435,7 @@ static u64 update_block_group_flags(struct btrfs_root *root, u64 flags) · 4841 unmodified lines | ||
| 8440 | 8435 | if (stripped) |
| 8441 | 8436 | return extended_to_chunk(stripped); |
| 8442 | 8437 | |
| 8443 | − /* | |
| 8444 | − * we add in the count of missing devices because we want | |
| 8445 | − * to make sure that any RAID levels on a degraded FS | |
| 8446 | − * continue to be honored. | |
| 8447 | − */ | |
| 8448 | − num_devices = root->fs_info->fs_devices->rw_devices + | |
| 8449 | − root->fs_info->fs_devices->missing_devices; | |
| 8438 | + num_devices = root->fs_info->fs_devices->rw_devices; | |
| 8450 | 8439 | |
| 8451 | 8440 | stripped = BTRFS_BLOCK_GROUP_RAID0 | |
| 8452 | 8441 | BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 | |
| @@ -2532,6 +2532,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err) · 2531 unmodified lines | ||
| 2532 | 2532 | test_bit(BIO_UPTODATE, &bio->bi_flags); |
| 2533 | 2533 | if (err) |
| 2534 | 2534 | uptodate = 0; |
| 2535 | + offset += len; | |
| 2535 | 2536 | continue; |
| 2536 | 2537 | } |
| 2537 | 2538 | } |
| @@ -4207,8 +4208,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 1669 unmodified lines | ||
| 4207 | 4208 | return -ENOMEM; |
| 4208 | 4209 | path->leave_spinning = 1; |
| 4209 | 4210 | |
| 4210 | − start = ALIGN(start, BTRFS_I(inode)->root->sectorsize); | |
| 4211 | − len = ALIGN(len, BTRFS_I(inode)->root->sectorsize); | |
| 4211 | + start = round_down(start, BTRFS_I(inode)->root->sectorsize); | |
| 4212 | + len = round_up(max, BTRFS_I(inode)->root->sectorsize) - start; | |
| 4212 | 4213 | |
| 4213 | 4214 | /* |
| 4214 | 4215 | * lookup the last file extent. We're not using i_size here |
| @@ -1840,7 +1840,15 @@ int btrfs_release_file(struct inode *inode, struct file *filp) · 1839 unmodified lines | ||
| 1840 | 1840 | { |
| 1841 | 1841 | if (filp->private_data) |
| 1842 | 1842 | btrfs_ioctl_trans_end(filp); |
| 1843 | − filemap_flush(inode->i_mapping); | |
| 1843 | + /* | |
| 1844 | + * ordered_data_close is set by settattr when we are about to truncate | |
| 1845 | + * a file from a non-zero size to a zero size. This tries to | |
| 1846 | + * flush down new bytes that may have been written if the | |
| 1847 | + * application were using truncate to replace a file in place. | |
| 1848 | + */ | |
| 1849 | + if (test_and_clear_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, | |
| 1850 | + &BTRFS_I(inode)->runtime_flags)) | |
| 1851 | + filemap_flush(inode->i_mapping); | |
| 1844 | 1852 | return 0; |
| 1845 | 1853 | } |
| 1846 | 1854 | |
| @@ -2088,10 +2096,9 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode, · 241 unmodified lines | ||
| 2088 | 2096 | goto out; |
| 2089 | 2097 | } |
| 2090 | 2098 | |
| 2091 | − if (hole_mergeable(inode, leaf, path->slots[0]+1, offset, end)) { | |
| 2099 | + if (hole_mergeable(inode, leaf, path->slots[0], offset, end)) { | |
| 2092 | 2100 | u64 num_bytes; |
| 2093 | 2101 | |
| 2094 | − path->slots[0]++; | |
| 2095 | 2102 | key.offset = offset; |
| 2096 | 2103 | btrfs_set_item_key_safe(root, path, &key); |
| 2097 | 2104 | fi = btrfs_item_ptr(leaf, path->slots[0], |
| @@ -2216,7 +2223,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) · 118 unmodified lines | ||
| 2216 | 2223 | goto out_only_mutex; |
| 2217 | 2224 | } |
| 2218 | 2225 | |
| 2219 | − lockstart = round_up(offset , BTRFS_I(inode)->root->sectorsize); | |
| 2226 | + lockstart = round_up(offset, BTRFS_I(inode)->root->sectorsize); | |
| 2220 | 2227 | lockend = round_down(offset + len, |
| 2221 | 2228 | BTRFS_I(inode)->root->sectorsize) - 1; |
| 2222 | 2229 | same_page = ((offset >> PAGE_CACHE_SHIFT) == |
| @@ -2277,7 +2284,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) · 54 unmodified lines | ||
| 2277 | 2284 | tail_start + tail_len, 0, 1); |
| 2278 | 2285 | if (ret) |
| 2279 | 2286 | goto out_only_mutex; |
| 2280 | − } | |
| 2287 | + } | |
| 2281 | 2288 | } |
| 2282 | 2289 | } |
| 2283 | 2290 | |
| @@ -1096,8 +1096,10 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, · 1095 unmodified lines | ||
| 1096 | 1096 | async_cow->end = cur_end; |
| 1097 | 1097 | INIT_LIST_HEAD(&async_cow->extents); |
| 1098 | 1098 | |
| 1099 | − btrfs_init_work(&async_cow->work, async_cow_start, | |
| 1100 | − async_cow_submit, async_cow_free); | |
| 1099 | + btrfs_init_work(&async_cow->work, | |
| 1100 | + btrfs_delalloc_helper, | |
| 1101 | + async_cow_start, async_cow_submit, | |
| 1102 | + async_cow_free); | |
| 1101 | 1103 | |
| 1102 | 1104 | nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >> |
| 1103 | 1105 | PAGE_CACHE_SHIFT; |
| @@ -1881,7 +1883,8 @@ static int btrfs_writepage_start_hook(struct page *page, u64 start, u64 end) · 777 unmodified lines | ||
| 1881 | 1883 | |
| 1882 | 1884 | SetPageChecked(page); |
| 1883 | 1885 | page_cache_get(page); |
| 1884 | − btrfs_init_work(&fixup->work, btrfs_writepage_fixup_worker, NULL, NULL); | |
| 1886 | + btrfs_init_work(&fixup->work, btrfs_fixup_helper, | |
| 1887 | + btrfs_writepage_fixup_worker, NULL, NULL); | |
| 1885 | 1888 | fixup->page = page; |
| 1886 | 1889 | btrfs_queue_work(root->fs_info->fixup_workers, &fixup->work); |
| 1887 | 1890 | return -EBUSY; |
| @@ -2822,7 +2825,8 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, · 934 unmodified lines | ||
| 2822 | 2825 | struct inode *inode = page->mapping->host; |
| 2823 | 2826 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 2824 | 2827 | struct btrfs_ordered_extent *ordered_extent = NULL; |
| 2825 | − struct btrfs_workqueue *workers; | |
| 2828 | + struct btrfs_workqueue *wq; | |
| 2829 | + btrfs_work_func_t func; | |
| 2826 | 2830 | |
| 2827 | 2831 | trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); |
| 2828 | 2832 | |
| @@ -2831,13 +2835,17 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, · 2 unmodified lines | ||
| 2831 | 2835 | end - start + 1, uptodate)) |
| 2832 | 2836 | return 0; |
| 2833 | 2837 | |
| 2834 | − btrfs_init_work(&ordered_extent->work, finish_ordered_fn, NULL, NULL); | |
| 2838 | + if (btrfs_is_free_space_inode(inode)) { | |
| 2839 | + wq = root->fs_info->endio_freespace_worker; | |
| 2840 | + func = btrfs_freespace_write_helper; | |
| 2841 | + } else { | |
| 2842 | + wq = root->fs_info->endio_write_workers; | |
| 2843 | + func = btrfs_endio_write_helper; | |
| 2844 | + } | |
| 2835 | 2845 | |
| 2836 | − if (btrfs_is_free_space_inode(inode)) | |
| 2837 | − workers = root->fs_info->endio_freespace_worker; | |
| 2838 | − else | |
| 2839 | − workers = root->fs_info->endio_write_workers; | |
| 2840 | − btrfs_queue_work(workers, &ordered_extent->work); | |
| 2846 | + btrfs_init_work(&ordered_extent->work, func, finish_ordered_fn, NULL, | |
| 2847 | + NULL); | |
| 2848 | + btrfs_queue_work(wq, &ordered_extent->work); | |
| 2841 | 2849 | |
| 2842 | 2850 | return 0; |
| 2843 | 2851 | } |
| @@ -4674,6 +4682,11 @@ static void evict_inode_truncate_pages(struct inode *inode) · 1830 unmodified lines | ||
| 4674 | 4682 | clear_bit(EXTENT_FLAG_LOGGING, &em->flags); |
| 4675 | 4683 | remove_extent_mapping(map_tree, em); |
| 4676 | 4684 | free_extent_map(em); |
| 4685 | + if (need_resched()) { | |
| 4686 | + write_unlock(&map_tree->lock); | |
| 4687 | + cond_resched(); | |
| 4688 | + write_lock(&map_tree->lock); | |
| 4689 | + } | |
| 4677 | 4690 | } |
| 4678 | 4691 | write_unlock(&map_tree->lock); |
| 4679 | 4692 | |
| @@ -4696,6 +4709,7 @@ static void evict_inode_truncate_pages(struct inode *inode) · 16 unmodified lines | ||
| 4696 | 4709 | &cached_state, GFP_NOFS); |
| 4697 | 4710 | free_extent_state(state); |
| 4698 | 4711 | |
| 4712 | + cond_resched(); | |
| 4699 | 4713 | spin_lock(&io_tree->lock); |
| 4700 | 4714 | } |
| 4701 | 4715 | spin_unlock(&io_tree->lock); |
| @@ -5181,6 +5195,42 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) · 479 unmodified lines | ||
| 5181 | 5195 | iput(inode); |
| 5182 | 5196 | inode = ERR_PTR(ret); |
| 5183 | 5197 | } |
| 5198 | + /* | |
| 5199 | + * If orphan cleanup did remove any orphans, it means the tree | |
| 5200 | + * was modified and therefore the commit root is not the same as | |
| 5201 | + * the current root anymore. This is a problem, because send | |
| 5202 | + * uses the commit root and therefore can see inode items that | |
| 5203 | + * don't exist in the current root anymore, and for example make | |
| 5204 | + * calls to btrfs_iget, which will do tree lookups based on the | |
| 5205 | + * current root and not on the commit root. Those lookups will | |
| 5206 | + * fail, returning a -ESTALE error, and making send fail with | |
| 5207 | + * that error. So make sure a send does not see any orphans we | |
| 5208 | + * have just removed, and that it will see the same inodes | |
| 5209 | + * regardless of whether a transaction commit happened before | |
| 5210 | + * it started (meaning that the commit root will be the same as | |
| 5211 | + * the current root) or not. | |
| 5212 | + */ | |
| 5213 | + if (sub_root->node != sub_root->commit_root) { | |
| 5214 | + u64 sub_flags = btrfs_root_flags(&sub_root->root_item); | |
| 5215 | + | |
| 5216 | + if (sub_flags & BTRFS_ROOT_SUBVOL_RDONLY) { | |
| 5217 | + struct extent_buffer *eb; | |
| 5218 | + | |
| 5219 | + /* | |
| 5220 | + * Assert we can't have races between dentry | |
| 5221 | + * lookup called through the snapshot creation | |
| 5222 | + * ioctl and the VFS. | |
| 5223 | + */ | |
| 5224 | + ASSERT(mutex_is_locked(&dir->i_mutex)); | |
| 5225 | + | |
| 5226 | + down_write(&root->fs_info->commit_root_sem); | |
| 5227 | + eb = sub_root->commit_root; | |
| 5228 | + sub_root->commit_root = | |
| 5229 | + btrfs_root_node(sub_root); | |
| 5230 | + up_write(&root->fs_info->commit_root_sem); | |
| 5231 | + free_extent_buffer(eb); | |
| 5232 | + } | |
| 5233 | + } | |
| 5184 | 5234 | } |
| 5185 | 5235 | |
| 5186 | 5236 | return inode; |
| @@ -5605,6 +5655,13 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, · 418 unmodified lines | ||
| 5605 | 5655 | return ERR_PTR(-ENOMEM); |
| 5606 | 5656 | } |
| 5607 | 5657 | |
| 5658 | + /* | |
| 5659 | + * O_TMPFILE, set link count to 0, so that after this point, | |
| 5660 | + * we fill in an inode item with the correct link count. | |
| 5661 | + */ | |
| 5662 | + if (!name) | |
| 5663 | + set_nlink(inode, 0); | |
| 5664 | + | |
| 5608 | 5665 | /* |
| 5609 | 5666 | * we have to initialize this early, so we can reclaim the inode |
| 5610 | 5667 | * number if we fail afterwards in this function. |
| @@ -6097,14 +6154,14 @@ out_fail: · 486 unmodified lines | ||
| 6097 | 6154 | static int merge_extent_mapping(struct extent_map_tree *em_tree, |
| 6098 | 6155 | struct extent_map *existing, |
| 6099 | 6156 | struct extent_map *em, |
| 6100 | − u64 map_start, u64 map_len) | |
| 6157 | + u64 map_start) | |
| 6101 | 6158 | { |
| 6102 | 6159 | u64 start_diff; |
| 6103 | 6160 | |
| 6104 | 6161 | BUG_ON(map_start < em->start || map_start >= extent_map_end(em)); |
| 6105 | 6162 | start_diff = map_start - em->start; |
| 6106 | 6163 | em->start = map_start; |
| 6107 | − em->len = map_len; | |
| 6164 | + em->len = existing->start - em->start; | |
| 6108 | 6165 | if (em->block_start < EXTENT_MAP_LAST_BYTE && |
| 6109 | 6166 | !test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) { |
| 6110 | 6167 | em->block_start += start_diff; |
| @@ -6275,6 +6332,8 @@ next: · 164 unmodified lines | ||
| 6275 | 6332 | goto not_found; |
| 6276 | 6333 | if (start + len <= found_key.offset) |
| 6277 | 6334 | goto not_found; |
| 6335 | + if (start > found_key.offset) | |
| 6336 | + goto next; | |
| 6278 | 6337 | em->start = start; |
| 6279 | 6338 | em->orig_start = start; |
| 6280 | 6339 | em->len = found_key.offset - start; |
| @@ -6390,8 +6449,7 @@ insert: · 109 unmodified lines | ||
| 6390 | 6449 | em->len); |
| 6391 | 6450 | if (existing) { |
| 6392 | 6451 | err = merge_extent_mapping(em_tree, existing, |
| 6393 | − em, start, | |
| 6394 | − root->sectorsize); | |
| 6452 | + em, start); | |
| 6395 | 6453 | free_extent_map(existing); |
| 6396 | 6454 | if (err) { |
| 6397 | 6455 | free_extent_map(em); |
| @@ -7158,7 +7216,8 @@ again: · 760 unmodified lines | ||
| 7158 | 7216 | if (!ret) |
| 7159 | 7217 | goto out_test; |
| 7160 | 7218 | |
| 7161 | − btrfs_init_work(&ordered->work, finish_ordered_fn, NULL, NULL); | |
| 7219 | + btrfs_init_work(&ordered->work, btrfs_endio_write_helper, | |
| 7220 | + finish_ordered_fn, NULL, NULL); | |
| 7162 | 7221 | btrfs_queue_work(root->fs_info->endio_write_workers, |
| 7163 | 7222 | &ordered->work); |
| 7164 | 7223 | out_test: |
| @@ -7306,10 +7365,8 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, · 141 unmodified lines | ||
| 7306 | 7365 | map_length = orig_bio->bi_iter.bi_size; |
| 7307 | 7366 | ret = btrfs_map_block(root->fs_info, rw, start_sector << 9, |
| 7308 | 7367 | &map_length, NULL, 0); |
| 7309 | − if (ret) { | |
| 7310 | − bio_put(orig_bio); | |
| 7368 | + if (ret) | |
| 7311 | 7369 | return -EIO; |
| 7312 | − } | |
| 7313 | 7370 | |
| 7314 | 7371 | if (map_length >= orig_bio->bi_iter.bi_size) { |
| 7315 | 7372 | bio = orig_bio; |
| @@ -7326,6 +7383,7 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, · 10 unmodified lines | ||
| 7326 | 7383 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); |
| 7327 | 7384 | if (!bio) |
| 7328 | 7385 | return -ENOMEM; |
| 7386 | + | |
| 7329 | 7387 | bio->bi_private = dip; |
| 7330 | 7388 | bio->bi_end_io = btrfs_end_dio_bio; |
| 7331 | 7389 | atomic_inc(&dip->pending_bios); |
| @@ -7534,7 +7592,8 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, · 202 unmodified lines | ||
| 7534 | 7592 | count = iov_iter_count(iter); |
| 7535 | 7593 | if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, |
| 7536 | 7594 | &BTRFS_I(inode)->runtime_flags)) |
| 7537 | − filemap_fdatawrite_range(inode->i_mapping, offset, count); | |
| 7595 | + filemap_fdatawrite_range(inode->i_mapping, offset, | |
| 7596 | + offset + count - 1); | |
| 7538 | 7597 | |
| 7539 | 7598 | if (rw & WRITE) { |
| 7540 | 7599 | /* |
| @@ -8495,7 +8554,9 @@ struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode, · 954 unmodified lines | ||
| 8495 | 8554 | work->inode = inode; |
| 8496 | 8555 | work->wait = wait; |
| 8497 | 8556 | work->delay_iput = delay_iput; |
| 8498 | − btrfs_init_work(&work->work, btrfs_run_delalloc_work, NULL, NULL); | |
| 8557 | + WARN_ON_ONCE(!inode); | |
| 8558 | + btrfs_init_work(&work->work, btrfs_flush_delalloc_helper, | |
| 8559 | + btrfs_run_delalloc_work, NULL, NULL); | |
| 8499 | 8560 | |
| 8500 | 8561 | return work; |
| 8501 | 8562 | } |
| @@ -8979,6 +9040,14 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) · 477 unmodified lines | ||
| 8979 | 9040 | if (ret) |
| 8980 | 9041 | goto out; |
| 8981 | 9042 | |
| 9043 | + /* | |
| 9044 | + * We set number of links to 0 in btrfs_new_inode(), and here we set | |
| 9045 | + * it to 1 because d_tmpfile() will issue a warning if the count is 0, | |
| 9046 | + * through: | |
| 9047 | + * | |
| 9048 | + * d_tmpfile() -> inode_dec_link_count() -> drop_nlink() | |
| 9049 | + */ | |
| 9050 | + set_nlink(inode, 1); | |
| 8982 | 9051 | d_tmpfile(dentry, inode); |
| 8983 | 9052 | mark_inode_dirty(inode); |
| 8984 | 9053 | |
| @@ -711,39 +711,6 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, · 710 unmodified lines | ||
| 711 | 711 | if (ret) |
| 712 | 712 | goto fail; |
| 713 | 713 | |
| 714 | − ret = btrfs_orphan_cleanup(pending_snapshot->snap); | |
| 715 | − if (ret) | |
| 716 | − goto fail; | |
| 717 | − | |
| 718 | − /* | |
| 719 | − * If orphan cleanup did remove any orphans, it means the tree was | |
| 720 | − * modified and therefore the commit root is not the same as the | |
| 721 | − * current root anymore. This is a problem, because send uses the | |
| 722 | − * commit root and therefore can see inode items that don't exist | |
| 723 | − * in the current root anymore, and for example make calls to | |
| 724 | − * btrfs_iget, which will do tree lookups based on the current root | |
| 725 | − * and not on the commit root. Those lookups will fail, returning a | |
| 726 | − * -ESTALE error, and making send fail with that error. So make sure | |
| 727 | − * a send does not see any orphans we have just removed, and that it | |
| 728 | − * will see the same inodes regardless of whether a transaction | |
| 729 | − * commit happened before it started (meaning that the commit root | |
| 730 | − * will be the same as the current root) or not. | |
| 731 | − */ | |
| 732 | − if (readonly && pending_snapshot->snap->node != | |
| 733 | − pending_snapshot->snap->commit_root) { | |
| 734 | − trans = btrfs_join_transaction(pending_snapshot->snap); | |
| 735 | − if (IS_ERR(trans) && PTR_ERR(trans) != -ENOENT) { | |
| 736 | − ret = PTR_ERR(trans); | |
| 737 | − goto fail; | |
| 738 | − } | |
| 739 | − if (!IS_ERR(trans)) { | |
| 740 | − ret = btrfs_commit_transaction(trans, | |
| 741 | − pending_snapshot->snap); | |
| 742 | − if (ret) | |
| 743 | − goto fail; | |
| 744 | − } | |
| 745 | − } | |
| 746 | − | |
| 747 | 714 | inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry); |
| 748 | 715 | if (IS_ERR(inode)) { |
| 749 | 716 | ret = PTR_ERR(inode); |
| @@ -3527,7 +3494,8 @@ process_slot: · 2777 unmodified lines | ||
| 3527 | 3494 | btrfs_mark_buffer_dirty(leaf); |
| 3528 | 3495 | btrfs_release_path(path); |
| 3529 | 3496 | |
| 3530 | − last_dest_end = new_key.offset + datal; | |
| 3497 | + last_dest_end = ALIGN(new_key.offset + datal, | |
| 3498 | + root->sectorsize); | |
| 3531 | 3499 | ret = clone_finish_inode_update(trans, inode, |
| 3532 | 3500 | last_dest_end, |
| 3533 | 3501 | destoff, olen); |
| @@ -615,6 +615,7 @@ int btrfs_wait_ordered_extents(struct btrfs_root *root, int nr) · 614 unmodified lines | ||
| 615 | 615 | spin_unlock(&root->ordered_extent_lock); |
| 616 | 616 | |
| 617 | 617 | btrfs_init_work(&ordered->flush_work, |
| 618 | + btrfs_flush_delalloc_helper, | |
| 618 | 619 | btrfs_run_ordered_extent_work, NULL, NULL); |
| 619 | 620 | list_add_tail(&ordered->work_list, &works); |
| 620 | 621 | btrfs_queue_work(root->fs_info->flush_workers, |
| @@ -1973,7 +1973,7 @@ static int qgroup_subtree_accounting(struct btrfs_trans_handle *trans, · 1972 unmodified lines | ||
| 1973 | 1973 | elem.seq, &roots); |
| 1974 | 1974 | btrfs_put_tree_mod_seq(fs_info, &elem); |
| 1975 | 1975 | if (ret < 0) |
| 1976 | − return ret; | |
| 1976 | + goto out; | |
| 1977 | 1977 | |
| 1978 | 1978 | if (roots->nnodes != 1) |
| 1979 | 1979 | goto out; |
| @@ -2720,6 +2720,7 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, · 740 unmodified lines | ||
| 2720 | 2720 | memset(&fs_info->qgroup_rescan_work, 0, |
| 2721 | 2721 | sizeof(fs_info->qgroup_rescan_work)); |
| 2722 | 2722 | btrfs_init_work(&fs_info->qgroup_rescan_work, |
| 2723 | + btrfs_qgroup_rescan_helper, | |
| 2723 | 2724 | btrfs_qgroup_rescan_worker, NULL, NULL); |
| 2724 | 2725 | |
| 2725 | 2726 | if (ret) { |
| @@ -1416,7 +1416,8 @@ cleanup: · 1415 unmodified lines | ||
| 1416 | 1416 | |
| 1417 | 1417 | static void async_rmw_stripe(struct btrfs_raid_bio *rbio) |
| 1418 | 1418 | { |
| 1419 | − btrfs_init_work(&rbio->work, rmw_work, NULL, NULL); | |
| 1419 | + btrfs_init_work(&rbio->work, btrfs_rmw_helper, | |
| 1420 | + rmw_work, NULL, NULL); | |
| 1420 | 1421 | |
| 1421 | 1422 | btrfs_queue_work(rbio->fs_info->rmw_workers, |
| 1422 | 1423 | &rbio->work); |
| @@ -1424,7 +1425,8 @@ static void async_rmw_stripe(struct btrfs_raid_bio *rbio) · 1 unmodified line | ||
| 1424 | 1425 | |
| 1425 | 1426 | static void async_read_rebuild(struct btrfs_raid_bio *rbio) |
| 1426 | 1427 | { |
| 1427 | − btrfs_init_work(&rbio->work, read_rebuild_work, NULL, NULL); | |
| 1428 | + btrfs_init_work(&rbio->work, btrfs_rmw_helper, | |
| 1429 | + read_rebuild_work, NULL, NULL); | |
| 1428 | 1430 | |
| 1429 | 1431 | btrfs_queue_work(rbio->fs_info->rmw_workers, |
| 1430 | 1432 | &rbio->work); |
| @@ -1665,7 +1667,8 @@ static void btrfs_raid_unplug(struct blk_plug_cb *cb, bool from_schedule) · 234 unmodified lines | ||
| 1665 | 1667 | plug = container_of(cb, struct btrfs_plug_cb, cb); |
| 1666 | 1668 | |
| 1667 | 1669 | if (from_schedule) { |
| 1668 | − btrfs_init_work(&plug->work, unplug_work, NULL, NULL); | |
| 1670 | + btrfs_init_work(&plug->work, btrfs_rmw_helper, | |
| 1671 | + unplug_work, NULL, NULL); | |
| 1669 | 1672 | btrfs_queue_work(plug->info->rmw_workers, |
| 1670 | 1673 | &plug->work); |
| 1671 | 1674 | return; |
| @@ -798,7 +798,8 @@ static void reada_start_machine(struct btrfs_fs_info *fs_info) · 797 unmodified lines | ||
| 798 | 798 | /* FIXME we cannot handle this properly right now */ |
| 799 | 799 | BUG(); |
| 800 | 800 | } |
| 801 | − btrfs_init_work(&rmw->work, reada_start_machine_worker, NULL, NULL); | |
| 801 | + btrfs_init_work(&rmw->work, btrfs_readahead_helper, | |
| 802 | + reada_start_machine_worker, NULL, NULL); | |
| 802 | 803 | rmw->fs_info = fs_info; |
| 803 | 804 | |
| 804 | 805 | btrfs_queue_work(fs_info->readahead_workers, &rmw->work); |
| @@ -428,8 +428,8 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace) · 427 unmodified lines | ||
| 428 | 428 | sbio->index = i; |
| 429 | 429 | sbio->sctx = sctx; |
| 430 | 430 | sbio->page_count = 0; |
| 431 | − btrfs_init_work(&sbio->work, scrub_bio_end_io_worker, | |
| 432 | − NULL, NULL); | |
| 431 | + btrfs_init_work(&sbio->work, btrfs_scrub_helper, | |
| 432 | + scrub_bio_end_io_worker, NULL, NULL); | |
| 433 | 433 | |
| 434 | 434 | if (i != SCRUB_BIOS_PER_SCTX - 1) |
| 435 | 435 | sctx->bios[i]->next_free = i + 1; |
| @@ -999,8 +999,8 @@ nodatasum_case: · 563 unmodified lines | ||
| 999 | 999 | fixup_nodatasum->root = fs_info->extent_root; |
| 1000 | 1000 | fixup_nodatasum->mirror_num = failed_mirror_index + 1; |
| 1001 | 1001 | scrub_pending_trans_workers_inc(sctx); |
| 1002 | − btrfs_init_work(&fixup_nodatasum->work, scrub_fixup_nodatasum, | |
| 1003 | − NULL, NULL); | |
| 1002 | + btrfs_init_work(&fixup_nodatasum->work, btrfs_scrub_helper, | |
| 1003 | + scrub_fixup_nodatasum, NULL, NULL); | |
| 1004 | 1004 | btrfs_queue_work(fs_info->scrub_workers, |
| 1005 | 1005 | &fixup_nodatasum->work); |
| 1006 | 1006 | goto out; |
| @@ -1616,7 +1616,8 @@ static void scrub_wr_bio_end_io(struct bio *bio, int err) · 609 unmodified lines | ||
| 1616 | 1616 | sbio->err = err; |
| 1617 | 1617 | sbio->bio = bio; |
| 1618 | 1618 | |
| 1619 | − btrfs_init_work(&sbio->work, scrub_wr_bio_end_io_worker, NULL, NULL); | |
| 1619 | + btrfs_init_work(&sbio->work, btrfs_scrubwrc_helper, | |
| 1620 | + scrub_wr_bio_end_io_worker, NULL, NULL); | |
| 1620 | 1621 | btrfs_queue_work(fs_info->scrub_wr_completion_workers, &sbio->work); |
| 1621 | 1622 | } |
| 1622 | 1623 | |
| @@ -2904,6 +2905,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 1281 unmodified lines | ||
| 2904 | 2905 | struct scrub_ctx *sctx; |
| 2905 | 2906 | int ret; |
| 2906 | 2907 | struct btrfs_device *dev; |
| 2908 | + struct rcu_string *name; | |
| 2907 | 2909 | |
| 2908 | 2910 | if (btrfs_fs_closing(fs_info)) |
| 2909 | 2911 | return -EINVAL; |
| @@ -2965,6 +2967,16 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 55 unmodified lines | ||
| 2965 | 2967 | return -ENODEV; |
| 2966 | 2968 | } |
| 2967 | 2969 | |
| 2970 | + if (!is_dev_replace && !readonly && !dev->writeable) { | |
| 2971 | + mutex_unlock(&fs_info->fs_devices->device_list_mutex); | |
| 2972 | + rcu_read_lock(); | |
| 2973 | + name = rcu_dereference(dev->name); | |
| 2974 | + btrfs_err(fs_info, "scrub: device %s is not writable", | |
| 2975 | + name->str); | |
| 2976 | + rcu_read_unlock(); | |
| 2977 | + return -EROFS; | |
| 2978 | + } | |
| 2979 | + | |
| 2968 | 2980 | mutex_lock(&fs_info->scrub_lock); |
| 2969 | 2981 | if (!dev->in_fs_metadata || dev->is_tgtdev_for_dev_replace) { |
| 2970 | 2982 | mutex_unlock(&fs_info->scrub_lock); |
| @@ -3203,7 +3215,8 @@ static int copy_nocow_pages(struct scrub_ctx *sctx, u64 logical, u64 len, · 232 unmodified lines | ||
| 3203 | 3215 | nocow_ctx->len = len; |
| 3204 | 3216 | nocow_ctx->mirror_num = mirror_num; |
| 3205 | 3217 | nocow_ctx->physical_for_dev_replace = physical_for_dev_replace; |
| 3206 | − btrfs_init_work(&nocow_ctx->work, copy_nocow_pages_worker, NULL, NULL); | |
| 3218 | + btrfs_init_work(&nocow_ctx->work, btrfs_scrubnc_helper, | |
| 3219 | + copy_nocow_pages_worker, NULL, NULL); | |
| 3207 | 3220 | INIT_LIST_HEAD(&nocow_ctx->inodes); |
| 3208 | 3221 | btrfs_queue_work(fs_info->scrub_nocow_workers, |
| 3209 | 3222 | &nocow_ctx->work); |
| @@ -614,7 +614,7 @@ int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, · 613 unmodified lines | ||
| 614 | 614 | if (!fs_info->device_dir_kobj) |
| 615 | 615 | return -EINVAL; |
| 616 | 616 | |
| 617 | − if (one_device) { | |
| 617 | + if (one_device && one_device->bdev) { | |
| 618 | 618 | disk = one_device->bdev->bd_part; |
| 619 | 619 | disk_kobj = &part_to_dev(disk)->kobj; |
| 620 | 620 | |
| @@ -3298,7 +3298,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, · 3297 unmodified lines | ||
| 3298 | 3298 | struct list_head ordered_sums; |
| 3299 | 3299 | int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; |
| 3300 | 3300 | bool has_extents = false; |
| 3301 | − bool need_find_last_extent = (*last_extent == 0); | |
| 3301 | + bool need_find_last_extent = true; | |
| 3302 | 3302 | bool done = false; |
| 3303 | 3303 | |
| 3304 | 3304 | INIT_LIST_HEAD(&ordered_sums); |
| @@ -3352,8 +3352,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, · 47 unmodified lines | ||
| 3352 | 3352 | */ |
| 3353 | 3353 | if (ins_keys[i].type == BTRFS_EXTENT_DATA_KEY) { |
| 3354 | 3354 | has_extents = true; |
| 3355 | − if (need_find_last_extent && | |
| 3356 | − first_key.objectid == (u64)-1) | |
| 3355 | + if (first_key.objectid == (u64)-1) | |
| 3357 | 3356 | first_key = ins_keys[i]; |
| 3358 | 3357 | } else { |
| 3359 | 3358 | need_find_last_extent = false; |
| @@ -3427,6 +3426,16 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, · 67 unmodified lines | ||
| 3427 | 3426 | if (!has_extents) |
| 3428 | 3427 | return ret; |
| 3429 | 3428 | |
| 3429 | + if (need_find_last_extent && *last_extent == first_key.offset) { | |
| 3430 | + /* | |
| 3431 | + * We don't have any leafs between our current one and the one | |
| 3432 | + * we processed before that can have file extent items for our | |
| 3433 | + * inode (and have a generation number smaller than our current | |
| 3434 | + * transaction id). | |
| 3435 | + */ | |
| 3436 | + need_find_last_extent = false; | |
| 3437 | + } | |
| 3438 | + | |
| 3430 | 3439 | /* |
| 3431 | 3440 | * Because we use btrfs_search_forward we could skip leaves that were |
| 3432 | 3441 | * not modified and then assume *last_extent is valid when it really |
| @@ -3537,7 +3546,7 @@ fill_holes: · 104 unmodified lines | ||
| 3537 | 3546 | 0, 0); |
| 3538 | 3547 | if (ret) |
| 3539 | 3548 | break; |
| 3540 | − *last_extent = offset + len; | |
| 3549 | + *last_extent = extent_end; | |
| 3541 | 3550 | } |
| 3542 | 3551 | /* |
| 3543 | 3552 | * Need to let the callers know we dropped the path so they should |
| @@ -508,6 +508,44 @@ static noinline int device_list_add(const char *path, · 507 unmodified lines | ||
| 508 | 508 | ret = 1; |
| 509 | 509 | device->fs_devices = fs_devices; |
| 510 | 510 | } else if (!device->name || strcmp(device->name->str, path)) { |
| 511 | + /* | |
| 512 | + * When FS is already mounted. | |
| 513 | + * 1. If you are here and if the device->name is NULL that | |
| 514 | + * means this device was missing at time of FS mount. | |
| 515 | + * 2. If you are here and if the device->name is different | |
| 516 | + * from 'path' that means either | |
| 517 | + * a. The same device disappeared and reappeared with | |
| 518 | + * different name. or | |
| 519 | + * b. The missing-disk-which-was-replaced, has | |
| 520 | + * reappeared now. | |
| 521 | + * | |
| 522 | + * We must allow 1 and 2a above. But 2b would be a spurious | |
| 523 | + * and unintentional. | |
| 524 | + * | |
| 525 | + * Further in case of 1 and 2a above, the disk at 'path' | |
| 526 | + * would have missed some transaction when it was away and | |
| 527 | + * in case of 2a the stale bdev has to be updated as well. | |
| 528 | + * 2b must not be allowed at all time. | |
| 529 | + */ | |
| 530 | + | |
| 531 | + /* | |
| 532 | + * As of now don't allow update to btrfs_fs_device through | |
| 533 | + * the btrfs dev scan cli, after FS has been mounted. | |
| 534 | + */ | |
| 535 | + if (fs_devices->opened) { | |
| 536 | + return -EBUSY; | |
| 537 | + } else { | |
| 538 | + /* | |
| 539 | + * That is if the FS is _not_ mounted and if you | |
| 540 | + * are here, that means there is more than one | |
| 541 | + * disk with same uuid and devid.We keep the one | |
| 542 | + * with larger generation number or the last-in if | |
| 543 | + * generation are equal. | |
| 544 | + */ | |
| 545 | + if (found_transid < device->generation) | |
| 546 | + return -EEXIST; | |
| 547 | + } | |
| 548 | + | |
| 511 | 549 | name = rcu_string_strdup(path, GFP_NOFS); |
| 512 | 550 | if (!name) |
| 513 | 551 | return -ENOMEM; |
| @@ -519,6 +557,15 @@ static noinline int device_list_add(const char *path, · 5 unmodified lines | ||
| 519 | 557 | } |
| 520 | 558 | } |
| 521 | 559 | |
| 560 | + /* | |
| 561 | + * Unmount does not free the btrfs_device struct but would zero | |
| 562 | + * generation along with most of the other members. So just update | |
| 563 | + * it back. We need it to pick the disk with largest generation | |
| 564 | + * (as above). | |
| 565 | + */ | |
| 566 | + if (!fs_devices->opened) | |
| 567 | + device->generation = found_transid; | |
| 568 | + | |
| 522 | 569 | if (found_transid > fs_devices->latest_trans) { |
| 523 | 570 | fs_devices->latest_devid = devid; |
| 524 | 571 | fs_devices->latest_trans = found_transid; |
| @@ -1436,7 +1483,7 @@ static int btrfs_add_device(struct btrfs_trans_handle *trans, · 911 unmodified lines | ||
| 1436 | 1483 | btrfs_set_device_io_align(leaf, dev_item, device->io_align); |
| 1437 | 1484 | btrfs_set_device_io_width(leaf, dev_item, device->io_width); |
| 1438 | 1485 | btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); |
| 1439 | − btrfs_set_device_total_bytes(leaf, dev_item, device->total_bytes); | |
| 1486 | + btrfs_set_device_total_bytes(leaf, dev_item, device->disk_total_bytes); | |
| 1440 | 1487 | btrfs_set_device_bytes_used(leaf, dev_item, device->bytes_used); |
| 1441 | 1488 | btrfs_set_device_group(leaf, dev_item, 0); |
| 1442 | 1489 | btrfs_set_device_seek_speed(leaf, dev_item, 0); |
| @@ -1671,7 +1718,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) · 228 unmodified lines | ||
| 1671 | 1718 | device->fs_devices->total_devices--; |
| 1672 | 1719 | |
| 1673 | 1720 | if (device->missing) |
| 1674 | − root->fs_info->fs_devices->missing_devices--; | |
| 1721 | + device->fs_devices->missing_devices--; | |
| 1675 | 1722 | |
| 1676 | 1723 | next_device = list_entry(root->fs_info->fs_devices->devices.next, |
| 1677 | 1724 | struct btrfs_device, dev_list); |
| @@ -1801,8 +1848,12 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info, · 123 unmodified lines | ||
| 1801 | 1848 | if (srcdev->bdev) { |
| 1802 | 1849 | fs_info->fs_devices->open_devices--; |
| 1803 | 1850 | |
| 1804 | − /* zero out the old super */ | |
| 1805 | − btrfs_scratch_superblock(srcdev); | |
| 1851 | + /* | |
| 1852 | + * zero out the old super if it is not writable | |
| 1853 | + * (e.g. seed device) | |
| 1854 | + */ | |
| 1855 | + if (srcdev->writeable) | |
| 1856 | + btrfs_scratch_superblock(srcdev); | |
| 1806 | 1857 | } |
| 1807 | 1858 | |
| 1808 | 1859 | call_rcu(&srcdev->rcu, free_device); |
| @@ -1941,6 +1992,9 @@ static int btrfs_prepare_sprout(struct btrfs_root *root) · 132 unmodified lines | ||
| 1941 | 1992 | fs_devices->seeding = 0; |
| 1942 | 1993 | fs_devices->num_devices = 0; |
| 1943 | 1994 | fs_devices->open_devices = 0; |
| 1995 | + fs_devices->missing_devices = 0; | |
| 1996 | + fs_devices->num_can_discard = 0; | |
| 1997 | + fs_devices->rotating = 0; | |
| 1944 | 1998 | fs_devices->seed = seed_devices; |
| 1945 | 1999 | |
| 1946 | 2000 | generate_random_uuid(fs_devices->fsid); |
| @@ -5800,7 +5854,8 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info, · 3853 unmodified lines | ||
| 5800 | 5854 | else |
| 5801 | 5855 | generate_random_uuid(dev->uuid); |
| 5802 | 5856 | |
| 5803 | − btrfs_init_work(&dev->work, pending_bios_fn, NULL, NULL); | |
| 5857 | + btrfs_init_work(&dev->work, btrfs_submit_helper, | |
| 5858 | + pending_bios_fn, NULL, NULL); | |
| 5804 | 5859 | |
| 5805 | 5860 | return dev; |
| 5806 | 5861 | } |
| @@ -1825,7 +1825,7 @@ ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no) · 1824 unmodified lines | ||
| 1825 | 1825 | /* |
| 1826 | 1826 | * Special error return code only used by dx_probe() and its callers. |
| 1827 | 1827 | */ |
| 1828 | −#define ERR_BAD_DX_DIR -75000 | |
| 1828 | +#define ERR_BAD_DX_DIR (-(MAX_ERRNO - 1)) | |
| 1829 | 1829 | |
| 1830 | 1830 | /* |
| 1831 | 1831 | * Timeout and state flag for lazy initialization inode thread. |
| @@ -2454,6 +2454,22 @@ static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize) · 622 unmodified lines | ||
| 2454 | 2454 | up_write(&EXT4_I(inode)->i_data_sem); |
| 2455 | 2455 | } |
| 2456 | 2456 | |
| 2457 | +/* Update i_size, i_disksize. Requires i_mutex to avoid races with truncate */ | |
| 2458 | +static inline int ext4_update_inode_size(struct inode *inode, loff_t newsize) | |
| 2459 | +{ | |
| 2460 | + int changed = 0; | |
| 2461 | + | |
| 2462 | + if (newsize > inode->i_size) { | |
| 2463 | + i_size_write(inode, newsize); | |
| 2464 | + changed = 1; | |
| 2465 | + } | |
| 2466 | + if (newsize > EXT4_I(inode)->i_disksize) { | |
| 2467 | + ext4_update_i_disksize(inode, newsize); | |
| 2468 | + changed |= 2; | |
| 2469 | + } | |
| 2470 | + return changed; | |
| 2471 | +} | |
| 2472 | + | |
| 2457 | 2473 | struct ext4_group_info { |
| 2458 | 2474 | unsigned long bb_state; |
| 2459 | 2475 | struct rb_root bb_free_root; |
| @@ -4665,7 +4665,8 @@ retry: · 4664 unmodified lines | ||
| 4665 | 4665 | } |
| 4666 | 4666 | |
| 4667 | 4667 | static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, |
| 4668 | − ext4_lblk_t len, int flags, int mode) | |
| 4668 | + ext4_lblk_t len, loff_t new_size, | |
| 4669 | + int flags, int mode) | |
| 4669 | 4670 | { |
| 4670 | 4671 | struct inode *inode = file_inode(file); |
| 4671 | 4672 | handle_t *handle; |
| @@ -4674,8 +4675,10 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, · 2 unmodified lines | ||
| 4674 | 4675 | int retries = 0; |
| 4675 | 4676 | struct ext4_map_blocks map; |
| 4676 | 4677 | unsigned int credits; |
| 4678 | + loff_t epos; | |
| 4677 | 4679 | |
| 4678 | 4680 | map.m_lblk = offset; |
| 4681 | + map.m_len = len; | |
| 4679 | 4682 | /* |
| 4680 | 4683 | * Don't normalize the request if it can fit in one extent so |
| 4681 | 4684 | * that it doesn't get unnecessarily split into multiple |
| @@ -4690,9 +4693,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, · 8 unmodified lines | ||
| 4690 | 4693 | credits = ext4_chunk_trans_blocks(inode, len); |
| 4691 | 4694 | |
| 4692 | 4695 | retry: |
| 4693 | − while (ret >= 0 && ret < len) { | |
| 4694 | − map.m_lblk = map.m_lblk + ret; | |
| 4695 | − map.m_len = len = len - ret; | |
| 4696 | + while (ret >= 0 && len) { | |
| 4696 | 4697 | handle = ext4_journal_start(inode, EXT4_HT_MAP_BLOCKS, |
| 4697 | 4698 | credits); |
| 4698 | 4699 | if (IS_ERR(handle)) { |
| @@ -4709,6 +4710,21 @@ retry: · 10 unmodified lines | ||
| 4709 | 4710 | ret2 = ext4_journal_stop(handle); |
| 4710 | 4711 | break; |
| 4711 | 4712 | } |
| 4713 | + map.m_lblk += ret; | |
| 4714 | + map.m_len = len = len - ret; | |
| 4715 | + epos = (loff_t)map.m_lblk << inode->i_blkbits; | |
| 4716 | + inode->i_ctime = ext4_current_time(inode); | |
| 4717 | + if (new_size) { | |
| 4718 | + if (epos > new_size) | |
| 4719 | + epos = new_size; | |
| 4720 | + if (ext4_update_inode_size(inode, epos) & 0x1) | |
| 4721 | + inode->i_mtime = inode->i_ctime; | |
| 4722 | + } else { | |
| 4723 | + if (epos > inode->i_size) | |
| 4724 | + ext4_set_inode_flag(inode, | |
| 4725 | + EXT4_INODE_EOFBLOCKS); | |
| 4726 | + } | |
| 4727 | + ext4_mark_inode_dirty(handle, inode); | |
| 4712 | 4728 | ret2 = ext4_journal_stop(handle); |
| 4713 | 4729 | if (ret2) |
| 4714 | 4730 | break; |
| @@ -4731,7 +4747,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 16 unmodified lines | ||
| 4731 | 4747 | loff_t new_size = 0; |
| 4732 | 4748 | int ret = 0; |
| 4733 | 4749 | int flags; |
| 4734 | − int partial; | |
| 4750 | + int credits; | |
| 4751 | + int partial_begin, partial_end; | |
| 4735 | 4752 | loff_t start, end; |
| 4736 | 4753 | ext4_lblk_t lblk; |
| 4737 | 4754 | struct address_space *mapping = inode->i_mapping; |
| @@ -4771,7 +4788,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 33 unmodified lines | ||
| 4771 | 4788 | |
| 4772 | 4789 | if (start < offset || end > offset + len) |
| 4773 | 4790 | return -EINVAL; |
| 4774 | − partial = (offset + len) & ((1 << blkbits) - 1); | |
| 4791 | + partial_begin = offset & ((1 << blkbits) - 1); | |
| 4792 | + partial_end = (offset + len) & ((1 << blkbits) - 1); | |
| 4775 | 4793 | |
| 4776 | 4794 | lblk = start >> blkbits; |
| 4777 | 4795 | max_blocks = (end >> blkbits); |
| @@ -4805,7 +4823,7 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 27 unmodified lines | ||
| 4805 | 4823 | * If we have a partial block after EOF we have to allocate |
| 4806 | 4824 | * the entire block. |
| 4807 | 4825 | */ |
| 4808 | − if (partial) | |
| 4826 | + if (partial_end) | |
| 4809 | 4827 | max_blocks += 1; |
| 4810 | 4828 | } |
| 4811 | 4829 | |
| @@ -4813,6 +4831,7 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 1 unmodified line | ||
| 4813 | 4831 | |
| 4814 | 4832 | /* Now release the pages and zero block aligned part of pages*/ |
| 4815 | 4833 | truncate_pagecache_range(inode, start, end - 1); |
| 4834 | + inode->i_mtime = inode->i_ctime = ext4_current_time(inode); | |
| 4816 | 4835 | |
| 4817 | 4836 | /* Wait all existing dio workers, newcomers will block on i_mutex */ |
| 4818 | 4837 | ext4_inode_block_unlocked_dio(inode); |
| @@ -4825,13 +4844,22 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 6 unmodified lines | ||
| 4825 | 4844 | if (ret) |
| 4826 | 4845 | goto out_dio; |
| 4827 | 4846 | |
| 4828 | − ret = ext4_alloc_file_blocks(file, lblk, max_blocks, flags, | |
| 4829 | − mode); | |
| 4847 | + ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size, | |
| 4848 | + flags, mode); | |
| 4830 | 4849 | if (ret) |
| 4831 | 4850 | goto out_dio; |
| 4832 | 4851 | } |
| 4852 | + if (!partial_begin && !partial_end) | |
| 4853 | + goto out_dio; | |
| 4833 | 4854 | |
| 4834 | − handle = ext4_journal_start(inode, EXT4_HT_MISC, 4); | |
| 4855 | + /* | |
| 4856 | + * In worst case we have to writeout two nonadjacent unwritten | |
| 4857 | + * blocks and update the inode | |
| 4858 | + */ | |
| 4859 | + credits = (2 * ext4_ext_index_trans_blocks(inode, 2)) + 1; | |
| 4860 | + if (ext4_should_journal_data(inode)) | |
| 4861 | + credits += 2; | |
| 4862 | + handle = ext4_journal_start(inode, EXT4_HT_MISC, credits); | |
| 4835 | 4863 | if (IS_ERR(handle)) { |
| 4836 | 4864 | ret = PTR_ERR(handle); |
| 4837 | 4865 | ext4_std_error(inode->i_sb, ret); |
| @@ -4839,12 +4867,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 1 unmodified line | ||
| 4839 | 4867 | } |
| 4840 | 4868 | |
| 4841 | 4869 | inode->i_mtime = inode->i_ctime = ext4_current_time(inode); |
| 4842 | − | |
| 4843 | 4870 | if (new_size) { |
| 4844 | − if (new_size > i_size_read(inode)) | |
| 4845 | − i_size_write(inode, new_size); | |
| 4846 | − if (new_size > EXT4_I(inode)->i_disksize) | |
| 4847 | − ext4_update_i_disksize(inode, new_size); | |
| 4871 | + ext4_update_inode_size(inode, new_size); | |
| 4848 | 4872 | } else { |
| 4849 | 4873 | /* |
| 4850 | 4874 | * Mark that we allocate beyond EOF so the subsequent truncate |
| @@ -4853,7 +4877,6 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 2 unmodified lines | ||
| 4853 | 4877 | if ((offset + len) > i_size_read(inode)) |
| 4854 | 4878 | ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS); |
| 4855 | 4879 | } |
| 4856 | − | |
| 4857 | 4880 | ext4_mark_inode_dirty(handle, inode); |
| 4858 | 4881 | |
| 4859 | 4882 | /* Zero out partial block at the edges of the range */ |
| @@ -4880,13 +4903,11 @@ out_mutex: · 20 unmodified lines | ||
| 4880 | 4903 | long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) |
| 4881 | 4904 | { |
| 4882 | 4905 | struct inode *inode = file_inode(file); |
| 4883 | − handle_t *handle; | |
| 4884 | 4906 | loff_t new_size = 0; |
| 4885 | 4907 | unsigned int max_blocks; |
| 4886 | 4908 | int ret = 0; |
| 4887 | 4909 | int flags; |
| 4888 | 4910 | ext4_lblk_t lblk; |
| 4889 | − struct timespec tv; | |
| 4890 | 4911 | unsigned int blkbits = inode->i_blkbits; |
| 4891 | 4912 | |
| 4892 | 4913 | /* Return error if mode is not supported */ |
| @@ -4937,36 +4958,15 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) · 44 unmodified lines | ||
| 4937 | 4958 | goto out; |
| 4938 | 4959 | } |
| 4939 | 4960 | |
| 4940 | − ret = ext4_alloc_file_blocks(file, lblk, max_blocks, flags, mode); | |
| 4961 | + ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size, | |
| 4962 | + flags, mode); | |
| 4941 | 4963 | if (ret) |
| 4942 | 4964 | goto out; |
| 4943 | 4965 | |
| 4944 | − handle = ext4_journal_start(inode, EXT4_HT_INODE, 2); | |
| 4945 | − if (IS_ERR(handle)) | |
| 4946 | − goto out; | |
| 4947 | − | |
| 4948 | − tv = inode->i_ctime = ext4_current_time(inode); | |
| 4949 | − | |
| 4950 | − if (new_size) { | |
| 4951 | − if (new_size > i_size_read(inode)) { | |
| 4952 | − i_size_write(inode, new_size); | |
| 4953 | − inode->i_mtime = tv; | |
| 4954 | − } | |
| 4955 | − if (new_size > EXT4_I(inode)->i_disksize) | |
| 4956 | − ext4_update_i_disksize(inode, new_size); | |
| 4957 | − } else { | |
| 4958 | − /* | |
| 4959 | − * Mark that we allocate beyond EOF so the subsequent truncate | |
| 4960 | − * can proceed even if the new size is the same as i_size. | |
| 4961 | − */ | |
| 4962 | − if ((offset + len) > i_size_read(inode)) | |
| 4963 | − ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS); | |
| 4966 | + if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) { | |
| 4967 | + ret = jbd2_complete_transaction(EXT4_SB(inode->i_sb)->s_journal, | |
| 4968 | + EXT4_I(inode)->i_sync_tid); | |
| 4964 | 4969 | } |
| 4965 | − ext4_mark_inode_dirty(handle, inode); | |
| 4966 | − if (file->f_flags & O_SYNC) | |
| 4967 | − ext4_handle_sync(handle); | |
| 4968 | − | |
| 4969 | − ext4_journal_stop(handle); | |
| 4970 | 4970 | out: |
| 4971 | 4971 | mutex_unlock(&inode->i_mutex); |
| 4972 | 4972 | trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); |
| @@ -1055,27 +1055,11 @@ static int ext4_write_end(struct file *file, · 1054 unmodified lines | ||
| 1055 | 1055 | } else |
| 1056 | 1056 | copied = block_write_end(file, mapping, pos, |
| 1057 | 1057 | len, copied, page, fsdata); |
| 1058 | − | |
| 1059 | 1058 | /* |
| 1060 | − * No need to use i_size_read() here, the i_size | |
| 1061 | − * cannot change under us because we hole i_mutex. | |
| 1062 | − * | |
| 1063 | − * But it's important to update i_size while still holding page lock: | |
| 1059 | + * it's important to update i_size while still holding page lock: | |
| 1064 | 1060 | * page writeout could otherwise come in and zero beyond i_size. |
| 1065 | 1061 | */ |
| 1066 | − if (pos + copied > inode->i_size) { | |
| 1067 | − i_size_write(inode, pos + copied); | |
| 1068 | − i_size_changed = 1; | |
| 1069 | − } | |
| 1070 | − | |
| 1071 | − if (pos + copied > EXT4_I(inode)->i_disksize) { | |
| 1072 | − /* We need to mark inode dirty even if | |
| 1073 | − * new_i_size is less that inode->i_size | |
| 1074 | − * but greater than i_disksize. (hint delalloc) | |
| 1075 | − */ | |
| 1076 | − ext4_update_i_disksize(inode, (pos + copied)); | |
| 1077 | − i_size_changed = 1; | |
| 1078 | − } | |
| 1062 | + i_size_changed = ext4_update_inode_size(inode, pos + copied); | |
| 1079 | 1063 | unlock_page(page); |
| 1080 | 1064 | page_cache_release(page); |
| 1081 | 1065 | |
| @@ -1123,7 +1107,7 @@ static int ext4_journalled_write_end(struct file *file, · 41 unmodified lines | ||
| 1123 | 1107 | int ret = 0, ret2; |
| 1124 | 1108 | int partial = 0; |
| 1125 | 1109 | unsigned from, to; |
| 1126 | − loff_t new_i_size; | |
| 1110 | + int size_changed = 0; | |
| 1127 | 1111 | |
| 1128 | 1112 | trace_ext4_journalled_write_end(inode, pos, len, copied); |
| 1129 | 1113 | from = pos & (PAGE_CACHE_SIZE - 1); |
| @@ -1146,20 +1130,18 @@ static int ext4_journalled_write_end(struct file *file, · 16 unmodified lines | ||
| 1146 | 1130 | if (!partial) |
| 1147 | 1131 | SetPageUptodate(page); |
| 1148 | 1132 | } |
| 1149 | − new_i_size = pos + copied; | |
| 1150 | − if (new_i_size > inode->i_size) | |
| 1151 | − i_size_write(inode, pos+copied); | |
| 1133 | + size_changed = ext4_update_inode_size(inode, pos + copied); | |
| 1152 | 1134 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); |
| 1153 | 1135 | EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid; |
| 1154 | − if (new_i_size > EXT4_I(inode)->i_disksize) { | |
| 1155 | − ext4_update_i_disksize(inode, new_i_size); | |
| 1136 | + unlock_page(page); | |
| 1137 | + page_cache_release(page); | |
| 1138 | + | |
| 1139 | + if (size_changed) { | |
| 1156 | 1140 | ret2 = ext4_mark_inode_dirty(handle, inode); |
| 1157 | 1141 | if (!ret) |
| 1158 | 1142 | ret = ret2; |
| 1159 | 1143 | } |
| 1160 | 1144 | |
| 1161 | − unlock_page(page); | |
| 1162 | − page_cache_release(page); | |
| 1163 | 1145 | if (pos + len > inode->i_size && ext4_can_truncate(inode)) |
| 1164 | 1146 | /* if we have allocated more blocks and copied |
| 1165 | 1147 | * less. We will have blocks allocated outside |
| @@ -2095,6 +2077,7 @@ static int mpage_map_and_submit_extent(handle_t *handle, · 929 unmodified lines | ||
| 2095 | 2077 | struct ext4_map_blocks *map = &mpd->map; |
| 2096 | 2078 | int err; |
| 2097 | 2079 | loff_t disksize; |
| 2080 | + int progress = 0; | |
| 2098 | 2081 | |
| 2099 | 2082 | mpd->io_submit.io_end->offset = |
| 2100 | 2083 | ((loff_t)map->m_lblk) << inode->i_blkbits; |
| @@ -2111,8 +2094,11 @@ static int mpage_map_and_submit_extent(handle_t *handle, · 10 unmodified lines | ||
| 2111 | 2094 | * is non-zero, a commit should free up blocks. |
| 2112 | 2095 | */ |
| 2113 | 2096 | if ((err == -ENOMEM) || |
| 2114 | − (err == -ENOSPC && ext4_count_free_clusters(sb))) | |
| 2097 | + (err == -ENOSPC && ext4_count_free_clusters(sb))) { | |
| 2098 | + if (progress) | |
| 2099 | + goto update_disksize; | |
| 2115 | 2100 | return err; |
| 2101 | + } | |
| 2116 | 2102 | ext4_msg(sb, KERN_CRIT, |
| 2117 | 2103 | "Delayed block allocation failed for " |
| 2118 | 2104 | "inode %lu at logical offset %llu with" |
| @@ -2129,15 +2115,17 @@ static int mpage_map_and_submit_extent(handle_t *handle, · 10 unmodified lines | ||
| 2129 | 2115 | *give_up_on_write = true; |
| 2130 | 2116 | return err; |
| 2131 | 2117 | } |
| 2118 | + progress = 1; | |
| 2132 | 2119 | /* |
| 2133 | 2120 | * Update buffer state, submit mapped pages, and get us new |
| 2134 | 2121 | * extent to map |
| 2135 | 2122 | */ |
| 2136 | 2123 | err = mpage_map_and_submit_buffers(mpd); |
| 2137 | 2124 | if (err < 0) |
| 2138 | − return err; | |
| 2125 | + goto update_disksize; | |
| 2139 | 2126 | } while (map->m_len); |
| 2140 | 2127 | |
| 2128 | +update_disksize: | |
| 2141 | 2129 | /* |
| 2142 | 2130 | * Update on-disk size after IO is submitted. Races with |
| 2143 | 2131 | * truncate are avoided by checking i_size under i_data_sem. |
| @@ -1412,6 +1412,8 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, · 1411 unmodified lines | ||
| 1412 | 1412 | int last = first + count - 1; |
| 1413 | 1413 | struct super_block *sb = e4b->bd_sb; |
| 1414 | 1414 | |
| 1415 | + if (WARN_ON(count == 0)) | |
| 1416 | + return; | |
| 1415 | 1417 | BUG_ON(last >= (sb->s_blocksize << 3)); |
| 1416 | 1418 | assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group)); |
| 1417 | 1419 | /* Don't bother if the block group is corrupt. */ |
| @@ -3221,6 +3223,8 @@ static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac) · 1803 unmodified lines | ||
| 3221 | 3223 | int err; |
| 3222 | 3224 | |
| 3223 | 3225 | if (pa == NULL) { |
| 3226 | + if (ac->ac_f_ex.fe_len == 0) | |
| 3227 | + return; | |
| 3224 | 3228 | err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b); |
| 3225 | 3229 | if (err) { |
| 3226 | 3230 | /* |
| @@ -3235,6 +3239,7 @@ static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac) · 8 unmodified lines | ||
| 3235 | 3239 | mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start, |
| 3236 | 3240 | ac->ac_f_ex.fe_len); |
| 3237 | 3241 | ext4_unlock_group(ac->ac_sb, ac->ac_f_ex.fe_group); |
| 3242 | + ext4_mb_unload_buddy(&e4b); | |
| 3238 | 3243 | return; |
| 3239 | 3244 | } |
| 3240 | 3245 | if (pa->pa_type == MB_INODE_PA) |
| @@ -1227,7 +1227,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir, · 1226 unmodified lines | ||
| 1227 | 1227 | buffer */ |
| 1228 | 1228 | int num = 0; |
| 1229 | 1229 | ext4_lblk_t nblocks; |
| 1230 | − int i, err; | |
| 1230 | + int i, err = 0; | |
| 1231 | 1231 | int namelen; |
| 1232 | 1232 | |
| 1233 | 1233 | *res_dir = NULL; |
| @@ -1264,7 +1264,11 @@ static struct buffer_head * ext4_find_entry (struct inode *dir, · 30 unmodified lines | ||
| 1264 | 1264 | * return. Otherwise, fall back to doing a search the |
| 1265 | 1265 | * old fashioned way. |
| 1266 | 1266 | */ |
| 1267 | − if (bh || (err != ERR_BAD_DX_DIR)) | |
| 1267 | + if (err == -ENOENT) | |
| 1268 | + return NULL; | |
| 1269 | + if (err && err != ERR_BAD_DX_DIR) | |
| 1270 | + return ERR_PTR(err); | |
| 1271 | + if (bh) | |
| 1268 | 1272 | return bh; |
| 1269 | 1273 | dxtrace(printk(KERN_DEBUG "ext4_find_entry: dx failed, " |
| 1270 | 1274 | "falling back\n")); |
| @@ -1295,6 +1299,11 @@ restart: · 24 unmodified lines | ||
| 1295 | 1299 | } |
| 1296 | 1300 | num++; |
| 1297 | 1301 | bh = ext4_getblk(NULL, dir, b++, 0, &err); |
| 1302 | + if (unlikely(err)) { | |
| 1303 | + if (ra_max == 0) | |
| 1304 | + return ERR_PTR(err); | |
| 1305 | + break; | |
| 1306 | + } | |
| 1298 | 1307 | bh_use[ra_max] = bh; |
| 1299 | 1308 | if (bh) |
| 1300 | 1309 | ll_rw_block(READ | REQ_META | REQ_PRIO, |
| @@ -1417,6 +1426,8 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi · 116 unmodified lines | ||
| 1417 | 1426 | return ERR_PTR(-ENAMETOOLONG); |
| 1418 | 1427 | |
| 1419 | 1428 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
| 1429 | + if (IS_ERR(bh)) | |
| 1430 | + return (struct dentry *) bh; | |
| 1420 | 1431 | inode = NULL; |
| 1421 | 1432 | if (bh) { |
| 1422 | 1433 | __u32 ino = le32_to_cpu(de->inode); |
| @@ -1450,6 +1461,8 @@ struct dentry *ext4_get_parent(struct dentry *child) · 27 unmodified lines | ||
| 1450 | 1461 | struct buffer_head *bh; |
| 1451 | 1462 | |
| 1452 | 1463 | bh = ext4_find_entry(child->d_inode, &dotdot, &de, NULL); |
| 1464 | + if (IS_ERR(bh)) | |
| 1465 | + return (struct dentry *) bh; | |
| 1453 | 1466 | if (!bh) |
| 1454 | 1467 | return ERR_PTR(-ENOENT); |
| 1455 | 1468 | ino = le32_to_cpu(de->inode); |
| @@ -2727,6 +2740,8 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) · 1271 unmodified lines | ||
| 2727 | 2740 | |
| 2728 | 2741 | retval = -ENOENT; |
| 2729 | 2742 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
| 2743 | + if (IS_ERR(bh)) | |
| 2744 | + return PTR_ERR(bh); | |
| 2730 | 2745 | if (!bh) |
| 2731 | 2746 | goto end_rmdir; |
| 2732 | 2747 | |
| @@ -2794,6 +2809,8 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) · 61 unmodified lines | ||
| 2794 | 2809 | |
| 2795 | 2810 | retval = -ENOENT; |
| 2796 | 2811 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
| 2812 | + if (IS_ERR(bh)) | |
| 2813 | + return PTR_ERR(bh); | |
| 2797 | 2814 | if (!bh) |
| 2798 | 2815 | goto end_unlink; |
| 2799 | 2816 | |
| @@ -3121,6 +3138,8 @@ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, · 321 unmodified lines | ||
| 3121 | 3138 | struct ext4_dir_entry_2 *de; |
| 3122 | 3139 | |
| 3123 | 3140 | bh = ext4_find_entry(dir, d_name, &de, NULL); |
| 3141 | + if (IS_ERR(bh)) | |
| 3142 | + return PTR_ERR(bh); | |
| 3124 | 3143 | if (bh) { |
| 3125 | 3144 | retval = ext4_delete_entry(handle, dir, de, bh); |
| 3126 | 3145 | brelse(bh); |
| @@ -3128,7 +3147,8 @@ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, · 1 unmodified line | ||
| 3128 | 3147 | return retval; |
| 3129 | 3148 | } |
| 3130 | 3149 | |
| 3131 | −static void ext4_rename_delete(handle_t *handle, struct ext4_renament *ent) | |
| 3150 | +static void ext4_rename_delete(handle_t *handle, struct ext4_renament *ent, | |
| 3151 | + int force_reread) | |
| 3132 | 3152 | { |
| 3133 | 3153 | int retval; |
| 3134 | 3154 | /* |
| @@ -3140,7 +3160,8 @@ static void ext4_rename_delete(handle_t *handle, struct ext4_renament *ent) · 5 unmodified lines | ||
| 3140 | 3160 | if (le32_to_cpu(ent->de->inode) != ent->inode->i_ino || |
| 3141 | 3161 | ent->de->name_len != ent->dentry->d_name.len || |
| 3142 | 3162 | strncmp(ent->de->name, ent->dentry->d_name.name, |
| 3143 | − ent->de->name_len)) { | |
| 3163 | + ent->de->name_len) || | |
| 3164 | + force_reread) { | |
| 3144 | 3165 | retval = ext4_find_delete_entry(handle, ent->dir, |
| 3145 | 3166 | &ent->dentry->d_name); |
| 3146 | 3167 | } else { |
| @@ -3191,6 +3212,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, · 44 unmodified lines | ||
| 3191 | 3212 | .dentry = new_dentry, |
| 3192 | 3213 | .inode = new_dentry->d_inode, |
| 3193 | 3214 | }; |
| 3215 | + int force_reread; | |
| 3194 | 3216 | int retval; |
| 3195 | 3217 | |
| 3196 | 3218 | dquot_initialize(old.dir); |
| @@ -3202,6 +3224,8 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, · 5 unmodified lines | ||
| 3202 | 3224 | dquot_initialize(new.inode); |
| 3203 | 3225 | |
| 3204 | 3226 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL); |
| 3227 | + if (IS_ERR(old.bh)) | |
| 3228 | + return PTR_ERR(old.bh); | |
| 3205 | 3229 | /* |
| 3206 | 3230 | * Check for inode number is _not_ due to possible IO errors. |
| 3207 | 3231 | * We might rmdir the source, keep it as pwd of some process |
| @@ -3214,6 +3238,10 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, · 6 unmodified lines | ||
| 3214 | 3238 | |
| 3215 | 3239 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, |
| 3216 | 3240 | &new.de, &new.inlined); |
| 3241 | + if (IS_ERR(new.bh)) { | |
| 3242 | + retval = PTR_ERR(new.bh); | |
| 3243 | + goto end_rename; | |
| 3244 | + } | |
| 3217 | 3245 | if (new.bh) { |
| 3218 | 3246 | if (!new.inode) { |
| 3219 | 3247 | brelse(new.bh); |
| @@ -3246,6 +3274,15 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, · 26 unmodified lines | ||
| 3246 | 3274 | if (retval) |
| 3247 | 3275 | goto end_rename; |
| 3248 | 3276 | } |
| 3277 | + /* | |
| 3278 | + * If we're renaming a file within an inline_data dir and adding or | |
| 3279 | + * setting the new dirent causes a conversion from inline_data to | |
| 3280 | + * extents/blockmap, we need to force the dirent delete code to | |
| 3281 | + * re-read the directory, or else we end up trying to delete a dirent | |
| 3282 | + * from what is now the extent tree root (or a block map). | |
| 3283 | + */ | |
| 3284 | + force_reread = (new.dir->i_ino == old.dir->i_ino && | |
| 3285 | + ext4_test_inode_flag(new.dir, EXT4_INODE_INLINE_DATA)); | |
| 3249 | 3286 | if (!new.bh) { |
| 3250 | 3287 | retval = ext4_add_entry(handle, new.dentry, old.inode); |
| 3251 | 3288 | if (retval) |
| @@ -3256,6 +3293,9 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, · 4 unmodified lines | ||
| 3256 | 3293 | if (retval) |
| 3257 | 3294 | goto end_rename; |
| 3258 | 3295 | } |
| 3296 | + if (force_reread) | |
| 3297 | + force_reread = !ext4_test_inode_flag(new.dir, | |
| 3298 | + EXT4_INODE_INLINE_DATA); | |
| 3259 | 3299 | |
| 3260 | 3300 | /* |
| 3261 | 3301 | * Like most other Unix systems, set the ctime for inodes on a |
| @@ -3267,7 +3307,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, · 5 unmodified lines | ||
| 3267 | 3307 | /* |
| 3268 | 3308 | * ok, that's it |
| 3269 | 3309 | */ |
| 3270 | − ext4_rename_delete(handle, &old); | |
| 3310 | + ext4_rename_delete(handle, &old, force_reread); | |
| 3271 | 3311 | |
| 3272 | 3312 | if (new.inode) { |
| 3273 | 3313 | ext4_dec_count(handle, new.inode); |
| @@ -3330,6 +3370,8 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, · 56 unmodified lines | ||
| 3330 | 3370 | |
| 3331 | 3371 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, |
| 3332 | 3372 | &old.de, &old.inlined); |
| 3373 | + if (IS_ERR(old.bh)) | |
| 3374 | + return PTR_ERR(old.bh); | |
| 3333 | 3375 | /* |
| 3334 | 3376 | * Check for inode number is _not_ due to possible IO errors. |
| 3335 | 3377 | * We might rmdir the source, keep it as pwd of some process |
| @@ -3342,6 +3384,10 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, · 6 unmodified lines | ||
| 3342 | 3384 | |
| 3343 | 3385 | new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, |
| 3344 | 3386 | &new.de, &new.inlined); |
| 3387 | + if (IS_ERR(new.bh)) { | |
| 3388 | + retval = PTR_ERR(new.bh); | |
| 3389 | + goto end_rename; | |
| 3390 | + } | |
| 3345 | 3391 | |
| 3346 | 3392 | /* RENAME_EXCHANGE case: old *and* new must both exist */ |
| 3347 | 3393 | if (!new.bh || le32_to_cpu(new.de->inode) != new.inode->i_ino) |
| @@ -3181,9 +3181,9 @@ static int set_journal_csum_feature_set(struct super_block *sb) · 3180 unmodified lines | ||
| 3181 | 3181 | |
| 3182 | 3182 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, |
| 3183 | 3183 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { |
| 3184 | − /* journal checksum v2 */ | |
| 3184 | + /* journal checksum v3 */ | |
| 3185 | 3185 | compat = 0; |
| 3186 | − incompat = JBD2_FEATURE_INCOMPAT_CSUM_V2; | |
| 3186 | + incompat = JBD2_FEATURE_INCOMPAT_CSUM_V3; | |
| 3187 | 3187 | } else { |
| 3188 | 3188 | /* journal checksum v1 */ |
| 3189 | 3189 | compat = JBD2_FEATURE_COMPAT_CHECKSUM; |
| @@ -3205,6 +3205,7 @@ static int set_journal_csum_feature_set(struct super_block *sb) · 15 unmodified lines | ||
| 3205 | 3205 | jbd2_journal_clear_features(sbi->s_journal, |
| 3206 | 3206 | JBD2_FEATURE_COMPAT_CHECKSUM, 0, |
| 3207 | 3207 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | |
| 3208 | + JBD2_FEATURE_INCOMPAT_CSUM_V3 | | |
| 3208 | 3209 | JBD2_FEATURE_INCOMPAT_CSUM_V2); |
| 3209 | 3210 | } |
| 3210 | 3211 | |
| @@ -23,7 +23,7 @@ config F2FS_STAT_FS · 22 unmodified lines | ||
| 23 | 23 | mounted as f2fs. Each file shows the whole f2fs information. |
| 24 | 24 | |
| 25 | 25 | /sys/kernel/debug/f2fs/status includes: |
| 26 | − - major file system information managed by f2fs currently | |
| 26 | + - major filesystem information managed by f2fs currently | |
| 27 | 27 | - average SIT information about whole segments |
| 28 | 28 | - current memory footprint consumed by f2fs. |
| 29 | 29 | |
| @@ -68,6 +68,6 @@ config F2FS_CHECK_FS · 38 unmodified lines | ||
| 68 | 68 | bool "F2FS consistency checking feature" |
| 69 | 69 | depends on F2FS_FS |
| 70 | 70 | help |
| 71 | − Enables BUG_ONs which check the file system consistency in runtime. | |
| 71 | + Enables BUG_ONs which check the filesystem consistency in runtime. | |
| 72 | 72 | |
| 73 | 73 | If you want to improve the performance, say N. |
| @@ -160,14 +160,11 @@ static int f2fs_write_meta_page(struct page *page, · 159 unmodified lines | ||
| 160 | 160 | goto redirty_out; |
| 161 | 161 | if (wbc->for_reclaim) |
| 162 | 162 | goto redirty_out; |
| 163 | − | |
| 164 | − /* Should not write any meta pages, if any IO error was occurred */ | |
| 165 | − if (unlikely(is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG))) | |
| 166 | − goto no_write; | |
| 163 | + if (unlikely(f2fs_cp_error(sbi))) | |
| 164 | + goto redirty_out; | |
| 167 | 165 | |
| 168 | 166 | f2fs_wait_on_page_writeback(page, META); |
| 169 | 167 | write_meta_page(sbi, page); |
| 170 | −no_write: | |
| 171 | 168 | dec_page_count(sbi, F2FS_DIRTY_META); |
| 172 | 169 | unlock_page(page); |
| 173 | 170 | return 0; |
| @@ -348,7 +345,7 @@ bool exist_written_data(struct f2fs_sb_info *sbi, nid_t ino, int mode) · 174 unmodified lines | ||
| 348 | 345 | return e ? true : false; |
| 349 | 346 | } |
| 350 | 347 | |
| 351 | −static void release_dirty_inode(struct f2fs_sb_info *sbi) | |
| 348 | +void release_dirty_inode(struct f2fs_sb_info *sbi) | |
| 352 | 349 | { |
| 353 | 350 | struct ino_entry *e, *tmp; |
| 354 | 351 | int i; |
| @@ -446,8 +443,8 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) · 91 unmodified lines | ||
| 446 | 443 | struct f2fs_orphan_block *orphan_blk = NULL; |
| 447 | 444 | unsigned int nentries = 0; |
| 448 | 445 | unsigned short index; |
| 449 | − unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans + | |
| 450 | − (F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK); | |
| 446 | + unsigned short orphan_blocks = | |
| 447 | + (unsigned short)GET_ORPHAN_BLOCKS(sbi->n_orphans); | |
| 451 | 448 | struct page *page = NULL; |
| 452 | 449 | struct ino_entry *orphan = NULL; |
| 453 | 450 | |
| @@ -737,7 +734,7 @@ retry: · 283 unmodified lines | ||
| 737 | 734 | /* |
| 738 | 735 | * Freeze all the FS-operations for checkpoint. |
| 739 | 736 | */ |
| 740 | −static void block_operations(struct f2fs_sb_info *sbi) | |
| 737 | +static int block_operations(struct f2fs_sb_info *sbi) | |
| 741 | 738 | { |
| 742 | 739 | struct writeback_control wbc = { |
| 743 | 740 | .sync_mode = WB_SYNC_ALL, |
| @@ -745,6 +742,7 @@ static void block_operations(struct f2fs_sb_info *sbi) · 1 unmodified line | ||
| 745 | 742 | .for_reclaim = 0, |
| 746 | 743 | }; |
| 747 | 744 | struct blk_plug plug; |
| 745 | + int err = 0; | |
| 748 | 746 | |
| 749 | 747 | blk_start_plug(&plug); |
| 750 | 748 | |
| @@ -754,11 +752,15 @@ retry_flush_dents: · 3 unmodified lines | ||
| 754 | 752 | if (get_pages(sbi, F2FS_DIRTY_DENTS)) { |
| 755 | 753 | f2fs_unlock_all(sbi); |
| 756 | 754 | sync_dirty_dir_inodes(sbi); |
| 755 | + if (unlikely(f2fs_cp_error(sbi))) { | |
| 756 | + err = -EIO; | |
| 757 | + goto out; | |
| 758 | + } | |
| 757 | 759 | goto retry_flush_dents; |
| 758 | 760 | } |
| 759 | 761 | |
| 760 | 762 | /* |
| 761 | − * POR: we should ensure that there is no dirty node pages | |
| 763 | + * POR: we should ensure that there are no dirty node pages | |
| 762 | 764 | * until finishing nat/sit flush. |
| 763 | 765 | */ |
| 764 | 766 | retry_flush_nodes: |
| @@ -767,9 +769,16 @@ retry_flush_nodes: · 2 unmodified lines | ||
| 767 | 769 | if (get_pages(sbi, F2FS_DIRTY_NODES)) { |
| 768 | 770 | up_write(&sbi->node_write); |
| 769 | 771 | sync_node_pages(sbi, 0, &wbc); |
| 772 | + if (unlikely(f2fs_cp_error(sbi))) { | |
| 773 | + f2fs_unlock_all(sbi); | |
| 774 | + err = -EIO; | |
| 775 | + goto out; | |
| 776 | + } | |
| 770 | 777 | goto retry_flush_nodes; |
| 771 | 778 | } |
| 779 | +out: | |
| 772 | 780 | blk_finish_plug(&plug); |
| 781 | + return err; | |
| 773 | 782 | } |
| 774 | 783 | |
| 775 | 784 | static void unblock_operations(struct f2fs_sb_info *sbi) |
| @@ -813,8 +822,11 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) · 37 unmodified lines | ||
| 813 | 822 | discard_next_dnode(sbi, NEXT_FREE_BLKADDR(sbi, curseg)); |
| 814 | 823 | |
| 815 | 824 | /* Flush all the NAT/SIT pages */ |
| 816 | − while (get_pages(sbi, F2FS_DIRTY_META)) | |
| 825 | + while (get_pages(sbi, F2FS_DIRTY_META)) { | |
| 817 | 826 | sync_meta_pages(sbi, META, LONG_MAX); |
| 827 | + if (unlikely(f2fs_cp_error(sbi))) | |
| 828 | + return; | |
| 829 | + } | |
| 818 | 830 | |
| 819 | 831 | next_free_nid(sbi, &last_nid); |
| 820 | 832 | |
| @@ -825,7 +837,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) · 4 unmodified lines | ||
| 825 | 837 | ckpt->elapsed_time = cpu_to_le64(get_mtime(sbi)); |
| 826 | 838 | ckpt->valid_block_count = cpu_to_le64(valid_user_blocks(sbi)); |
| 827 | 839 | ckpt->free_segment_count = cpu_to_le32(free_segments(sbi)); |
| 828 | − for (i = 0; i < 3; i++) { | |
| 840 | + for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) { | |
| 829 | 841 | ckpt->cur_node_segno[i] = |
| 830 | 842 | cpu_to_le32(curseg_segno(sbi, i + CURSEG_HOT_NODE)); |
| 831 | 843 | ckpt->cur_node_blkoff[i] = |
| @@ -833,7 +845,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) · 1 unmodified line | ||
| 833 | 845 | ckpt->alloc_type[i + CURSEG_HOT_NODE] = |
| 834 | 846 | curseg_alloc_type(sbi, i + CURSEG_HOT_NODE); |
| 835 | 847 | } |
| 836 | − for (i = 0; i < 3; i++) { | |
| 848 | + for (i = 0; i < NR_CURSEG_DATA_TYPE; i++) { | |
| 837 | 849 | ckpt->cur_data_segno[i] = |
| 838 | 850 | cpu_to_le32(curseg_segno(sbi, i + CURSEG_HOT_DATA)); |
| 839 | 851 | ckpt->cur_data_blkoff[i] = |
| @@ -848,24 +860,23 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) · 8 unmodified lines | ||
| 848 | 860 | |
| 849 | 861 | /* 2 cp + n data seg summary + orphan inode blocks */ |
| 850 | 862 | data_sum_blocks = npages_for_summary_flush(sbi); |
| 851 | − if (data_sum_blocks < 3) | |
| 863 | + if (data_sum_blocks < NR_CURSEG_DATA_TYPE) | |
| 852 | 864 | set_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG); |
| 853 | 865 | else |
| 854 | 866 | clear_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG); |
| 855 | 867 | |
| 856 | − orphan_blocks = (sbi->n_orphans + F2FS_ORPHANS_PER_BLOCK - 1) | |
| 857 | − / F2FS_ORPHANS_PER_BLOCK; | |
| 868 | + orphan_blocks = GET_ORPHAN_BLOCKS(sbi->n_orphans); | |
| 858 | 869 | ckpt->cp_pack_start_sum = cpu_to_le32(1 + cp_payload_blks + |
| 859 | 870 | orphan_blocks); |
| 860 | 871 | |
| 861 | 872 | if (is_umount) { |
| 862 | 873 | set_ckpt_flags(ckpt, CP_UMOUNT_FLAG); |
| 863 | − ckpt->cp_pack_total_block_count = cpu_to_le32(2 + | |
| 874 | + ckpt->cp_pack_total_block_count = cpu_to_le32(F2FS_CP_PACKS+ | |
| 864 | 875 | cp_payload_blks + data_sum_blocks + |
| 865 | 876 | orphan_blocks + NR_CURSEG_NODE_TYPE); |
| 866 | 877 | } else { |
| 867 | 878 | clear_ckpt_flags(ckpt, CP_UMOUNT_FLAG); |
| 868 | − ckpt->cp_pack_total_block_count = cpu_to_le32(2 + | |
| 879 | + ckpt->cp_pack_total_block_count = cpu_to_le32(F2FS_CP_PACKS + | |
| 869 | 880 | cp_payload_blks + data_sum_blocks + |
| 870 | 881 | orphan_blocks); |
| 871 | 882 | } |
| @@ -924,6 +935,9 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) · 52 unmodified lines | ||
| 924 | 935 | /* wait for previous submitted node/meta pages writeback */ |
| 925 | 936 | wait_on_all_pages_writeback(sbi); |
| 926 | 937 | |
| 938 | + if (unlikely(f2fs_cp_error(sbi))) | |
| 939 | + return; | |
| 940 | + | |
| 927 | 941 | filemap_fdatawait_range(NODE_MAPPING(sbi), 0, LONG_MAX); |
| 928 | 942 | filemap_fdatawait_range(META_MAPPING(sbi), 0, LONG_MAX); |
| 929 | 943 | |
| @@ -934,15 +948,17 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) · 4 unmodified lines | ||
| 934 | 948 | /* Here, we only have one bio having CP pack */ |
| 935 | 949 | sync_meta_pages(sbi, META_FLUSH, LONG_MAX); |
| 936 | 950 | |
| 937 | − if (!is_set_ckpt_flags(ckpt, CP_ERROR_FLAG)) { | |
| 938 | − clear_prefree_segments(sbi); | |
| 939 | − release_dirty_inode(sbi); | |
| 940 | − F2FS_RESET_SB_DIRT(sbi); | |
| 941 | − } | |
| 951 | + release_dirty_inode(sbi); | |
| 952 | + | |
| 953 | + if (unlikely(f2fs_cp_error(sbi))) | |
| 954 | + return; | |
| 955 | + | |
| 956 | + clear_prefree_segments(sbi); | |
| 957 | + F2FS_RESET_SB_DIRT(sbi); | |
| 942 | 958 | } |
| 943 | 959 | |
| 944 | 960 | /* |
| 945 | − * We guarantee that this checkpoint procedure should not fail. | |
| 961 | + * We guarantee that this checkpoint procedure will not fail. | |
| 946 | 962 | */ |
| 947 | 963 | void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) |
| 948 | 964 | { |
| @@ -952,7 +968,13 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) · 3 unmodified lines | ||
| 952 | 968 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "start block_ops"); |
| 953 | 969 | |
| 954 | 970 | mutex_lock(&sbi->cp_mutex); |
| 955 | − block_operations(sbi); | |
| 971 | + | |
| 972 | + if (!sbi->s_dirty) | |
| 973 | + goto out; | |
| 974 | + if (unlikely(f2fs_cp_error(sbi))) | |
| 975 | + goto out; | |
| 976 | + if (block_operations(sbi)) | |
| 977 | + goto out; | |
| 956 | 978 | |
| 957 | 979 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish block_ops"); |
| 958 | 980 | |
| @@ -976,9 +998,9 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) · 17 unmodified lines | ||
| 976 | 998 | do_checkpoint(sbi, is_umount); |
| 977 | 999 | |
| 978 | 1000 | unblock_operations(sbi); |
| 979 | − mutex_unlock(&sbi->cp_mutex); | |
| 980 | − | |
| 981 | 1001 | stat_inc_cp_count(sbi->stat_info); |
| 1002 | +out: | |
| 1003 | + mutex_unlock(&sbi->cp_mutex); | |
| 982 | 1004 | trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish checkpoint"); |
| 983 | 1005 | } |
| 984 | 1006 | |
| @@ -999,8 +1021,8 @@ void init_ino_entry_info(struct f2fs_sb_info *sbi) · 14 unmodified lines | ||
| 999 | 1021 | * for cp pack we can have max 1020*504 orphan entries |
| 1000 | 1022 | */ |
| 1001 | 1023 | sbi->n_orphans = 0; |
| 1002 | − sbi->max_orphans = (sbi->blocks_per_seg - 2 - NR_CURSEG_TYPE) | |
| 1003 | − * F2FS_ORPHANS_PER_BLOCK; | |
| 1024 | + sbi->max_orphans = (sbi->blocks_per_seg - F2FS_CP_PACKS - | |
| 1025 | + NR_CURSEG_TYPE) * F2FS_ORPHANS_PER_BLOCK; | |
| 1004 | 1026 | } |
| 1005 | 1027 | |
| 1006 | 1028 | int __init create_checkpoint_caches(void) |
| @@ -53,7 +53,7 @@ static void f2fs_write_end_io(struct bio *bio, int err) · 52 unmodified lines | ||
| 53 | 53 | struct page *page = bvec->bv_page; |
| 54 | 54 | |
| 55 | 55 | if (unlikely(err)) { |
| 56 | − SetPageError(page); | |
| 56 | + set_page_dirty(page); | |
| 57 | 57 | set_bit(AS_EIO, &page->mapping->flags); |
| 58 | 58 | f2fs_stop_checkpoint(sbi); |
| 59 | 59 | } |
| @@ -691,7 +691,7 @@ get_next: · 631 unmodified lines | ||
| 691 | 691 | allocated = true; |
| 692 | 692 | blkaddr = dn.data_blkaddr; |
| 693 | 693 | } |
| 694 | − /* Give more consecutive addresses for the read ahead */ | |
| 694 | + /* Give more consecutive addresses for the readahead */ | |
| 695 | 695 | if (blkaddr == (bh_result->b_blocknr + ofs)) { |
| 696 | 696 | ofs++; |
| 697 | 697 | dn.ofs_in_node++; |
| @@ -739,7 +739,7 @@ static int f2fs_read_data_page(struct file *file, struct page *page) · 41 unmodified lines | ||
| 739 | 739 | |
| 740 | 740 | trace_f2fs_readpage(page, DATA); |
| 741 | 741 | |
| 742 | − /* If the file has inline data, try to read it directlly */ | |
| 742 | + /* If the file has inline data, try to read it directly */ | |
| 743 | 743 | if (f2fs_has_inline_data(inode)) |
| 744 | 744 | ret = f2fs_read_inline_data(inode, page); |
| 745 | 745 | else |
| @@ -836,10 +836,19 @@ write: · 90 unmodified lines | ||
| 836 | 836 | |
| 837 | 837 | /* Dentry blocks are controlled by checkpoint */ |
| 838 | 838 | if (S_ISDIR(inode->i_mode)) { |
| 839 | + if (unlikely(f2fs_cp_error(sbi))) | |
| 840 | + goto redirty_out; | |
| 839 | 841 | err = do_write_data_page(page, &fio); |
| 840 | 842 | goto done; |
| 841 | 843 | } |
| 842 | 844 | |
| 845 | + /* we should bypass data pages to proceed the kworkder jobs */ | |
| 846 | + if (unlikely(f2fs_cp_error(sbi))) { | |
| 847 | + SetPageError(page); | |
| 848 | + unlock_page(page); | |
| 849 | + return 0; | |
| 850 | + } | |
| 851 | + | |
| 843 | 852 | if (!wbc->for_reclaim) |
| 844 | 853 | need_balance_fs = true; |
| 845 | 854 | else if (has_not_enough_free_secs(sbi, 0)) |
| @@ -927,7 +936,7 @@ static void f2fs_write_failed(struct address_space *mapping, loff_t to) · 81 unmodified lines | ||
| 927 | 936 | |
| 928 | 937 | if (to > inode->i_size) { |
| 929 | 938 | truncate_pagecache(inode, inode->i_size); |
| 930 | − truncate_blocks(inode, inode->i_size); | |
| 939 | + truncate_blocks(inode, inode->i_size, true); | |
| 931 | 940 | } |
| 932 | 941 | } |
| 933 | 942 | |
| @@ -946,7 +955,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, · 12 unmodified lines | ||
| 946 | 955 | |
| 947 | 956 | f2fs_balance_fs(sbi); |
| 948 | 957 | repeat: |
| 949 | − err = f2fs_convert_inline_data(inode, pos + len); | |
| 958 | + err = f2fs_convert_inline_data(inode, pos + len, NULL); | |
| 950 | 959 | if (err) |
| 951 | 960 | goto fail; |
| 952 | 961 | |
| @@ -32,7 +32,7 @@ static void update_general_status(struct f2fs_sb_info *sbi) · 31 unmodified lines | ||
| 32 | 32 | struct f2fs_stat_info *si = F2FS_STAT(sbi); |
| 33 | 33 | int i; |
| 34 | 34 | |
| 35 | − /* valid check of the segment numbers */ | |
| 35 | + /* validation check of the segment numbers */ | |
| 36 | 36 | si->hit_ext = sbi->read_hit_ext; |
| 37 | 37 | si->total_ext = sbi->total_hit_ext; |
| 38 | 38 | si->ndirty_node = get_pages(sbi, F2FS_DIRTY_NODES); |
| @@ -152,7 +152,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi) · 113 unmodified lines | ||
| 152 | 152 | si->base_mem += NR_DIRTY_TYPE * f2fs_bitmap_size(TOTAL_SEGS(sbi)); |
| 153 | 153 | si->base_mem += f2fs_bitmap_size(TOTAL_SECS(sbi)); |
| 154 | 154 | |
| 155 | − /* buld nm */ | |
| 155 | + /* build nm */ | |
| 156 | 156 | si->base_mem += sizeof(struct f2fs_nm_info); |
| 157 | 157 | si->base_mem += __bitmap_size(sbi, NAT_BITMAP); |
| 158 | 158 | |
| @@ -124,7 +124,7 @@ static struct f2fs_dir_entry *find_in_block(struct page *dentry_page, · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | /* |
| 126 | 126 | * For the most part, it should be a bug when name_len is zero. |
| 127 | − * We stop here for figuring out where the bugs are occurred. | |
| 127 | + * We stop here for figuring out where the bugs has occurred. | |
| 128 | 128 | */ |
| 129 | 129 | f2fs_bug_on(!de->name_len); |
| 130 | 130 | |
| @@ -391,7 +391,7 @@ put_error: · 260 unmodified lines | ||
| 391 | 391 | error: |
| 392 | 392 | /* once the failed inode becomes a bad inode, i_mode is S_IFREG */ |
| 393 | 393 | truncate_inode_pages(&inode->i_data, 0); |
| 394 | − truncate_blocks(inode, 0); | |
| 394 | + truncate_blocks(inode, 0, false); | |
| 395 | 395 | remove_dirty_dir_inode(inode); |
| 396 | 396 | remove_inode_page(inode); |
| 397 | 397 | return ERR_PTR(err); |
| @@ -563,7 +563,7 @@ fail: · 165 unmodified lines | ||
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /* |
| 566 | − * It only removes the dentry from the dentry page,corresponding name | |
| 566 | + * It only removes the dentry from the dentry page, corresponding name | |
| 567 | 567 | * entry in name page does not need to be touched during deletion. |
| 568 | 568 | */ |
| 569 | 569 | void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, |
| @@ -24,7 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #define f2fs_bug_on(condition) BUG_ON(condition) |
| 25 | 25 | #define f2fs_down_write(x, y) down_write_nest_lock(x, y) |
| 26 | 26 | #else |
| 27 | −#define f2fs_bug_on(condition) | |
| 27 | +#define f2fs_bug_on(condition) WARN_ON(condition) | |
| 28 | 28 | #define f2fs_down_write(x, y) down_write(x) |
| 29 | 29 | #endif |
| 30 | 30 | |
| @@ -395,7 +395,7 @@ enum count_type { · 364 unmodified lines | ||
| 395 | 395 | }; |
| 396 | 396 | |
| 397 | 397 | /* |
| 398 | − * The below are the page types of bios used in submti_bio(). | |
| 398 | + * The below are the page types of bios used in submit_bio(). | |
| 399 | 399 | * The available types are: |
| 400 | 400 | * DATA User data pages. It operates as async mode. |
| 401 | 401 | * NODE Node pages. It operates as async mode. |
| @@ -470,7 +470,7 @@ struct f2fs_sb_info { · 68 unmodified lines | ||
| 470 | 470 | struct list_head dir_inode_list; /* dir inode list */ |
| 471 | 471 | spinlock_t dir_inode_lock; /* for dir inode list lock */ |
| 472 | 472 | |
| 473 | − /* basic file system units */ | |
| 473 | + /* basic filesystem units */ | |
| 474 | 474 | unsigned int log_sectors_per_block; /* log2 sectors per block */ |
| 475 | 475 | unsigned int log_blocksize; /* log2 block size */ |
| 476 | 476 | unsigned int blocksize; /* block size */ |
| @@ -799,7 +799,7 @@ static inline block_t __start_cp_addr(struct f2fs_sb_info *sbi) · 322 unmodified lines | ||
| 799 | 799 | |
| 800 | 800 | /* |
| 801 | 801 | * odd numbered checkpoint should at cp segment 0 |
| 802 | − * and even segent must be at cp segment 1 | |
| 802 | + * and even segment must be at cp segment 1 | |
| 803 | 803 | */ |
| 804 | 804 | if (!(ckpt_version & 1)) |
| 805 | 805 | start_addr += sbi->blocks_per_seg; |
| @@ -1096,6 +1096,11 @@ static inline int f2fs_readonly(struct super_block *sb) · 290 unmodified lines | ||
| 1096 | 1096 | return sb->s_flags & MS_RDONLY; |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | +static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi) | |
| 1100 | +{ | |
| 1101 | + return is_set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); | |
| 1102 | +} | |
| 1103 | + | |
| 1099 | 1104 | static inline void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi) |
| 1100 | 1105 | { |
| 1101 | 1106 | set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); |
| @@ -1117,7 +1122,7 @@ static inline void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi) · 15 unmodified lines | ||
| 1117 | 1122 | */ |
| 1118 | 1123 | int f2fs_sync_file(struct file *, loff_t, loff_t, int); |
| 1119 | 1124 | void truncate_data_blocks(struct dnode_of_data *); |
| 1120 | −int truncate_blocks(struct inode *, u64); | |
| 1125 | +int truncate_blocks(struct inode *, u64, bool); | |
| 1121 | 1126 | void f2fs_truncate(struct inode *); |
| 1122 | 1127 | int f2fs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
| 1123 | 1128 | int f2fs_setattr(struct dentry *, struct iattr *); |
| @@ -1202,10 +1207,8 @@ int sync_node_pages(struct f2fs_sb_info *, nid_t, struct writeback_control *); · 78 unmodified lines | ||
| 1202 | 1207 | bool alloc_nid(struct f2fs_sb_info *, nid_t *); |
| 1203 | 1208 | void alloc_nid_done(struct f2fs_sb_info *, nid_t); |
| 1204 | 1209 | void alloc_nid_failed(struct f2fs_sb_info *, nid_t); |
| 1205 | −void recover_node_page(struct f2fs_sb_info *, struct page *, | |
| 1206 | − struct f2fs_summary *, struct node_info *, block_t); | |
| 1207 | 1210 | void recover_inline_xattr(struct inode *, struct page *); |
| 1208 | −bool recover_xattr_data(struct inode *, struct page *, block_t); | |
| 1211 | +void recover_xattr_data(struct inode *, struct page *, block_t); | |
| 1209 | 1212 | int recover_inode_page(struct f2fs_sb_info *, struct page *); |
| 1210 | 1213 | int restore_node_summary(struct f2fs_sb_info *, unsigned int, |
| 1211 | 1214 | struct f2fs_summary_block *); |
| @@ -1238,8 +1241,6 @@ void write_data_page(struct page *, struct dnode_of_data *, block_t *, · 26 unmodified lines | ||
| 1238 | 1241 | void rewrite_data_page(struct page *, block_t, struct f2fs_io_info *); |
| 1239 | 1242 | void recover_data_page(struct f2fs_sb_info *, struct page *, |
| 1240 | 1243 | struct f2fs_summary *, block_t, block_t); |
| 1241 | −void rewrite_node_page(struct f2fs_sb_info *, struct page *, | |
| 1242 | − struct f2fs_summary *, block_t, block_t); | |
| 1243 | 1244 | void allocate_data_block(struct f2fs_sb_info *, struct page *, |
| 1244 | 1245 | block_t, block_t *, struct f2fs_summary *, int); |
| 1245 | 1246 | void f2fs_wait_on_page_writeback(struct page *, enum page_type); |
| @@ -1262,6 +1263,7 @@ int ra_meta_pages(struct f2fs_sb_info *, int, int, int); · 16 unmodified lines | ||
| 1262 | 1263 | long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long); |
| 1263 | 1264 | void add_dirty_inode(struct f2fs_sb_info *, nid_t, int type); |
| 1264 | 1265 | void remove_dirty_inode(struct f2fs_sb_info *, nid_t, int type); |
| 1266 | +void release_dirty_inode(struct f2fs_sb_info *); | |
| 1265 | 1267 | bool exist_written_data(struct f2fs_sb_info *, nid_t, int); |
| 1266 | 1268 | int acquire_orphan_inode(struct f2fs_sb_info *); |
| 1267 | 1269 | void release_orphan_inode(struct f2fs_sb_info *); |
| @@ -1439,8 +1441,8 @@ extern const struct inode_operations f2fs_special_inode_operations; · 171 unmodified lines | ||
| 1439 | 1441 | */ |
| 1440 | 1442 | bool f2fs_may_inline(struct inode *); |
| 1441 | 1443 | int f2fs_read_inline_data(struct inode *, struct page *); |
| 1442 | −int f2fs_convert_inline_data(struct inode *, pgoff_t); | |
| 1444 | +int f2fs_convert_inline_data(struct inode *, pgoff_t, struct page *); | |
| 1443 | 1445 | int f2fs_write_inline_data(struct inode *, struct page *, unsigned int); |
| 1444 | 1446 | void truncate_inline_data(struct inode *, u64); |
| 1445 | −int recover_inline_data(struct inode *, struct page *); | |
| 1447 | +bool recover_inline_data(struct inode *, struct page *); | |
| 1446 | 1448 | #endif |
| @@ -41,6 +41,11 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, · 40 unmodified lines | ||
| 41 | 41 | |
| 42 | 42 | sb_start_pagefault(inode->i_sb); |
| 43 | 43 | |
| 44 | + /* force to convert with normal data indices */ | |
| 45 | + err = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, page); | |
| 46 | + if (err) | |
| 47 | + goto out; | |
| 48 | + | |
| 44 | 49 | /* block allocation */ |
| 45 | 50 | f2fs_lock_op(sbi); |
| 46 | 51 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
| @@ -110,6 +115,25 @@ static int get_parent_ino(struct inode *inode, nid_t *pino) · 63 unmodified lines | ||
| 110 | 115 | return 1; |
| 111 | 116 | } |
| 112 | 117 | |
| 118 | +static inline bool need_do_checkpoint(struct inode *inode) | |
| 119 | +{ | |
| 120 | + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | |
| 121 | + bool need_cp = false; | |
| 122 | + | |
| 123 | + if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1) | |
| 124 | + need_cp = true; | |
| 125 | + else if (file_wrong_pino(inode)) | |
| 126 | + need_cp = true; | |
| 127 | + else if (!space_for_roll_forward(sbi)) | |
| 128 | + need_cp = true; | |
| 129 | + else if (!is_checkpointed_node(sbi, F2FS_I(inode)->i_pino)) | |
| 130 | + need_cp = true; | |
| 131 | + else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi))) | |
| 132 | + need_cp = true; | |
| 133 | + | |
| 134 | + return need_cp; | |
| 135 | +} | |
| 136 | + | |
| 113 | 137 | int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
| 114 | 138 | { |
| 115 | 139 | struct inode *inode = file->f_mapping->host; |
| @@ -154,23 +178,12 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 38 unmodified lines | ||
| 154 | 178 | /* guarantee free sections for fsync */ |
| 155 | 179 | f2fs_balance_fs(sbi); |
| 156 | 180 | |
| 157 | − down_read(&fi->i_sem); | |
| 158 | − | |
| 159 | 181 | /* |
| 160 | 182 | * Both of fdatasync() and fsync() are able to be recovered from |
| 161 | 183 | * sudden-power-off. |
| 162 | 184 | */ |
| 163 | − if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1) | |
| 164 | − need_cp = true; | |
| 165 | − else if (file_wrong_pino(inode)) | |
| 166 | − need_cp = true; | |
| 167 | − else if (!space_for_roll_forward(sbi)) | |
| 168 | − need_cp = true; | |
| 169 | − else if (!is_checkpointed_node(sbi, F2FS_I(inode)->i_pino)) | |
| 170 | − need_cp = true; | |
| 171 | − else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi))) | |
| 172 | − need_cp = true; | |
| 173 | − | |
| 185 | + down_read(&fi->i_sem); | |
| 186 | + need_cp = need_do_checkpoint(inode); | |
| 174 | 187 | up_read(&fi->i_sem); |
| 175 | 188 | |
| 176 | 189 | if (need_cp) { |
| @@ -288,7 +301,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence) · 111 unmodified lines | ||
| 288 | 301 | if (err && err != -ENOENT) { |
| 289 | 302 | goto fail; |
| 290 | 303 | } else if (err == -ENOENT) { |
| 291 | − /* direct node is not exist */ | |
| 304 | + /* direct node does not exists */ | |
| 292 | 305 | if (whence == SEEK_DATA) { |
| 293 | 306 | pgofs = PGOFS_OF_NEXT_DNODE(pgofs, |
| 294 | 307 | F2FS_I(inode)); |
| @@ -417,7 +430,7 @@ out: · 122 unmodified lines | ||
| 417 | 430 | f2fs_put_page(page, 1); |
| 418 | 431 | } |
| 419 | 432 | |
| 420 | −int truncate_blocks(struct inode *inode, u64 from) | |
| 433 | +int truncate_blocks(struct inode *inode, u64 from, bool lock) | |
| 421 | 434 | { |
| 422 | 435 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 423 | 436 | unsigned int blocksize = inode->i_sb->s_blocksize; |
| @@ -433,14 +446,16 @@ int truncate_blocks(struct inode *inode, u64 from) · 9 unmodified lines | ||
| 433 | 446 | free_from = (pgoff_t) |
| 434 | 447 | ((from + blocksize - 1) >> (sbi->log_blocksize)); |
| 435 | 448 | |
| 436 | − f2fs_lock_op(sbi); | |
| 449 | + if (lock) | |
| 450 | + f2fs_lock_op(sbi); | |
| 437 | 451 | |
| 438 | 452 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
| 439 | 453 | err = get_dnode_of_data(&dn, free_from, LOOKUP_NODE); |
| 440 | 454 | if (err) { |
| 441 | 455 | if (err == -ENOENT) |
| 442 | 456 | goto free_next; |
| 443 | − f2fs_unlock_op(sbi); | |
| 457 | + if (lock) | |
| 458 | + f2fs_unlock_op(sbi); | |
| 444 | 459 | trace_f2fs_truncate_blocks_exit(inode, err); |
| 445 | 460 | return err; |
| 446 | 461 | } |
| @@ -458,7 +473,8 @@ int truncate_blocks(struct inode *inode, u64 from) · 11 unmodified lines | ||
| 458 | 473 | f2fs_put_dnode(&dn); |
| 459 | 474 | free_next: |
| 460 | 475 | err = truncate_inode_blocks(inode, free_from); |
| 461 | − f2fs_unlock_op(sbi); | |
| 476 | + if (lock) | |
| 477 | + f2fs_unlock_op(sbi); | |
| 462 | 478 | done: |
| 463 | 479 | /* lastly zero out the first data page */ |
| 464 | 480 | truncate_partial_data_page(inode, from); |
| @@ -475,7 +491,7 @@ void f2fs_truncate(struct inode *inode) · 10 unmodified lines | ||
| 475 | 491 | |
| 476 | 492 | trace_f2fs_truncate(inode); |
| 477 | 493 | |
| 478 | − if (!truncate_blocks(inode, i_size_read(inode))) { | |
| 494 | + if (!truncate_blocks(inode, i_size_read(inode), true)) { | |
| 479 | 495 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
| 480 | 496 | mark_inode_dirty(inode); |
| 481 | 497 | } |
| @@ -533,7 +549,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) · 51 unmodified lines | ||
| 533 | 549 | |
| 534 | 550 | if ((attr->ia_valid & ATTR_SIZE) && |
| 535 | 551 | attr->ia_size != i_size_read(inode)) { |
| 536 | − err = f2fs_convert_inline_data(inode, attr->ia_size); | |
| 552 | + err = f2fs_convert_inline_data(inode, attr->ia_size, NULL); | |
| 537 | 553 | if (err) |
| 538 | 554 | return err; |
| 539 | 555 | |
| @@ -622,7 +638,7 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) · 82 unmodified lines | ||
| 622 | 638 | loff_t off_start, off_end; |
| 623 | 639 | int ret = 0; |
| 624 | 640 | |
| 625 | − ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1); | |
| 641 | + ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1, NULL); | |
| 626 | 642 | if (ret) |
| 627 | 643 | return ret; |
| 628 | 644 | |
| @@ -678,7 +694,7 @@ static int expand_inode_data(struct inode *inode, loff_t offset, · 49 unmodified lines | ||
| 678 | 694 | if (ret) |
| 679 | 695 | return ret; |
| 680 | 696 | |
| 681 | − ret = f2fs_convert_inline_data(inode, offset + len); | |
| 697 | + ret = f2fs_convert_inline_data(inode, offset + len, NULL); | |
| 682 | 698 | if (ret) |
| 683 | 699 | return ret; |
| 684 | 700 | |
| @@ -58,7 +58,7 @@ static int gc_thread_func(void *data) · 57 unmodified lines | ||
| 58 | 58 | * 3. IO subsystem is idle by checking the # of requests in |
| 59 | 59 | * bdev's request list. |
| 60 | 60 | * |
| 61 | − * Note) We have to avoid triggering GCs too much frequently. | |
| 61 | + * Note) We have to avoid triggering GCs frequently. | |
| 62 | 62 | * Because it is possible that some segments can be |
| 63 | 63 | * invalidated soon after by user update or deletion. |
| 64 | 64 | * So, I'd like to wait some time to collect dirty segments. |
| @@ -222,7 +222,7 @@ static unsigned int get_cb_cost(struct f2fs_sb_info *sbi, unsigned int segno) · 157 unmodified lines | ||
| 222 | 222 | |
| 223 | 223 | u = (vblocks * 100) >> sbi->log_blocks_per_seg; |
| 224 | 224 | |
| 225 | − /* Handle if the system time is changed by user */ | |
| 225 | + /* Handle if the system time has changed by the user */ | |
| 226 | 226 | if (mtime < sit_i->min_mtime) |
| 227 | 227 | sit_i->min_mtime = mtime; |
| 228 | 228 | if (mtime > sit_i->max_mtime) |
| @@ -593,7 +593,7 @@ next_step: · 364 unmodified lines | ||
| 593 | 593 | |
| 594 | 594 | if (phase == 2) { |
| 595 | 595 | inode = f2fs_iget(sb, dni.ino); |
| 596 | − if (IS_ERR(inode)) | |
| 596 | + if (IS_ERR(inode) || is_bad_inode(inode)) | |
| 597 | 597 | continue; |
| 598 | 598 | |
| 599 | 599 | start_bidx = start_bidx_of_node(nofs, F2FS_I(inode)); |
| @@ -693,7 +693,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi) · 93 unmodified lines | ||
| 693 | 693 | gc_more: |
| 694 | 694 | if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE))) |
| 695 | 695 | goto stop; |
| 696 | − if (unlikely(is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG))) | |
| 696 | + if (unlikely(f2fs_cp_error(sbi))) | |
| 697 | 697 | goto stop; |
| 698 | 698 | |
| 699 | 699 | if (gc_type == BG_GC && has_not_enough_free_secs(sbi, nfree)) { |
| @@ -91,7 +91,7 @@ static inline bool has_enough_invalid_blocks(struct f2fs_sb_info *sbi) · 90 unmodified lines | ||
| 91 | 91 | block_t invalid_user_blocks = sbi->user_block_count - |
| 92 | 92 | written_block_count(sbi); |
| 93 | 93 | /* |
| 94 | − * Background GC is triggered with the following condition. | |
| 94 | + * Background GC is triggered with the following conditions. | |
| 95 | 95 | * 1. There are a number of invalid blocks. |
| 96 | 96 | * 2. There is not enough free space. |
| 97 | 97 | */ |
| @@ -42,7 +42,8 @@ static void TEA_transform(unsigned int buf[4], unsigned int const in[]) · 41 unmodified lines | ||
| 42 | 42 | buf[1] += b1; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | −static void str2hashbuf(const char *msg, size_t len, unsigned int *buf, int num) | |
| 45 | +static void str2hashbuf(const unsigned char *msg, size_t len, | |
| 46 | + unsigned int *buf, int num) | |
| 46 | 47 | { |
| 47 | 48 | unsigned pad, val; |
| 48 | 49 | int i; |
| @@ -73,9 +74,9 @@ f2fs_hash_t f2fs_dentry_hash(const struct qstr *name_info) · 24 unmodified lines | ||
| 73 | 74 | { |
| 74 | 75 | __u32 hash; |
| 75 | 76 | f2fs_hash_t f2fs_hash; |
| 76 | − const char *p; | |
| 77 | + const unsigned char *p; | |
| 77 | 78 | __u32 in[8], buf[4]; |
| 78 | − const char *name = name_info->name; | |
| 79 | + const unsigned char *name = name_info->name; | |
| 79 | 80 | size_t len = name_info->len; |
| 80 | 81 | |
| 81 | 82 | if ((len <= 2) && (name[0] == '.') && |
| @@ -68,7 +68,7 @@ out: · 67 unmodified lines | ||
| 68 | 68 | |
| 69 | 69 | static int __f2fs_convert_inline_data(struct inode *inode, struct page *page) |
| 70 | 70 | { |
| 71 | − int err; | |
| 71 | + int err = 0; | |
| 72 | 72 | struct page *ipage; |
| 73 | 73 | struct dnode_of_data dn; |
| 74 | 74 | void *src_addr, *dst_addr; |
| @@ -86,6 +86,10 @@ static int __f2fs_convert_inline_data(struct inode *inode, struct page *page) · 11 unmodified lines | ||
| 86 | 86 | goto out; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | + /* someone else converted inline_data already */ | |
| 90 | + if (!f2fs_has_inline_data(inode)) | |
| 91 | + goto out; | |
| 92 | + | |
| 89 | 93 | /* |
| 90 | 94 | * i_addr[0] is not used for inline data, |
| 91 | 95 | * so reserving new block will not destroy inline data |
| @@ -124,9 +128,10 @@ out: · 32 unmodified lines | ||
| 124 | 128 | return err; |
| 125 | 129 | } |
| 126 | 130 | |
| 127 | −int f2fs_convert_inline_data(struct inode *inode, pgoff_t to_size) | |
| 131 | +int f2fs_convert_inline_data(struct inode *inode, pgoff_t to_size, | |
| 132 | + struct page *page) | |
| 128 | 133 | { |
| 129 | − struct page *page; | |
| 134 | + struct page *new_page = page; | |
| 130 | 135 | int err; |
| 131 | 136 | |
| 132 | 137 | if (!f2fs_has_inline_data(inode)) |
| @@ -134,17 +139,20 @@ int f2fs_convert_inline_data(struct inode *inode, pgoff_t to_size) · 1 unmodified line | ||
| 134 | 139 | else if (to_size <= MAX_INLINE_DATA) |
| 135 | 140 | return 0; |
| 136 | 141 | |
| 137 | − page = grab_cache_page(inode->i_mapping, 0); | |
| 138 | − if (!page) | |
| 139 | − return -ENOMEM; | |
| 142 | + if (!page || page->index != 0) { | |
| 143 | + new_page = grab_cache_page(inode->i_mapping, 0); | |
| 144 | + if (!new_page) | |
| 145 | + return -ENOMEM; | |
| 146 | + } | |
| 140 | 147 | |
| 141 | − err = __f2fs_convert_inline_data(inode, page); | |
| 142 | − f2fs_put_page(page, 1); | |
| 148 | + err = __f2fs_convert_inline_data(inode, new_page); | |
| 149 | + if (!page || page->index != 0) | |
| 150 | + f2fs_put_page(new_page, 1); | |
| 143 | 151 | return err; |
| 144 | 152 | } |
| 145 | 153 | |
| 146 | 154 | int f2fs_write_inline_data(struct inode *inode, |
| 147 | − struct page *page, unsigned size) | |
| 155 | + struct page *page, unsigned size) | |
| 148 | 156 | { |
| 149 | 157 | void *src_addr, *dst_addr; |
| 150 | 158 | struct page *ipage; |
| @@ -199,7 +207,7 @@ void truncate_inline_data(struct inode *inode, u64 from) · 48 unmodified lines | ||
| 199 | 207 | f2fs_put_page(ipage, 1); |
| 200 | 208 | } |
| 201 | 209 | |
| 202 | −int recover_inline_data(struct inode *inode, struct page *npage) | |
| 210 | +bool recover_inline_data(struct inode *inode, struct page *npage) | |
| 203 | 211 | { |
| 204 | 212 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 205 | 213 | struct f2fs_inode *ri = NULL; |
| @@ -218,7 +226,7 @@ int recover_inline_data(struct inode *inode, struct page *npage) · 12 unmodified lines | ||
| 218 | 226 | ri = F2FS_INODE(npage); |
| 219 | 227 | |
| 220 | 228 | if (f2fs_has_inline_data(inode) && |
| 221 | − ri && ri->i_inline & F2FS_INLINE_DATA) { | |
| 229 | + ri && (ri->i_inline & F2FS_INLINE_DATA)) { | |
| 222 | 230 | process_inline: |
| 223 | 231 | ipage = get_node_page(sbi, inode->i_ino); |
| 224 | 232 | f2fs_bug_on(IS_ERR(ipage)); |
| @@ -230,7 +238,7 @@ process_inline: · 5 unmodified lines | ||
| 230 | 238 | memcpy(dst_addr, src_addr, MAX_INLINE_DATA); |
| 231 | 239 | update_inode(inode, ipage); |
| 232 | 240 | f2fs_put_page(ipage, 1); |
| 233 | − return -1; | |
| 241 | + return true; | |
| 234 | 242 | } |
| 235 | 243 | |
| 236 | 244 | if (f2fs_has_inline_data(inode)) { |
| @@ -242,10 +250,10 @@ process_inline: · 5 unmodified lines | ||
| 242 | 250 | clear_inode_flag(F2FS_I(inode), FI_INLINE_DATA); |
| 243 | 251 | update_inode(inode, ipage); |
| 244 | 252 | f2fs_put_page(ipage, 1); |
| 245 | − } else if (ri && ri->i_inline & F2FS_INLINE_DATA) { | |
| 246 | − truncate_blocks(inode, 0); | |
| 253 | + } else if (ri && (ri->i_inline & F2FS_INLINE_DATA)) { | |
| 254 | + truncate_blocks(inode, 0, false); | |
| 247 | 255 | set_inode_flag(F2FS_I(inode), FI_INLINE_DATA); |
| 248 | 256 | goto process_inline; |
| 249 | 257 | } |
| 250 | − return 0; | |
| 258 | + return false; | |
| 251 | 259 | } |
| @@ -134,9 +134,7 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, · 133 unmodified lines | ||
| 134 | 134 | return 0; |
| 135 | 135 | out: |
| 136 | 136 | clear_nlink(inode); |
| 137 | − unlock_new_inode(inode); | |
| 138 | − make_bad_inode(inode); | |
| 139 | − iput(inode); | |
| 137 | + iget_failed(inode); | |
| 140 | 138 | alloc_nid_failed(sbi, ino); |
| 141 | 139 | return err; |
| 142 | 140 | } |
| @@ -229,7 +227,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) · 86 unmodified lines | ||
| 229 | 227 | f2fs_delete_entry(de, page, inode); |
| 230 | 228 | f2fs_unlock_op(sbi); |
| 231 | 229 | |
| 232 | − /* In order to evict this inode, we set it dirty */ | |
| 230 | + /* In order to evict this inode, we set it dirty */ | |
| 233 | 231 | mark_inode_dirty(inode); |
| 234 | 232 | fail: |
| 235 | 233 | trace_f2fs_unlink_exit(inode, err); |
| @@ -267,9 +265,7 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, · 31 unmodified lines | ||
| 267 | 265 | return err; |
| 268 | 266 | out: |
| 269 | 267 | clear_nlink(inode); |
| 270 | − unlock_new_inode(inode); | |
| 271 | − make_bad_inode(inode); | |
| 272 | − iput(inode); | |
| 268 | + iget_failed(inode); | |
| 273 | 269 | alloc_nid_failed(sbi, inode->i_ino); |
| 274 | 270 | return err; |
| 275 | 271 | } |
| @@ -308,9 +304,7 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) · 32 unmodified lines | ||
| 308 | 304 | out_fail: |
| 309 | 305 | clear_inode_flag(F2FS_I(inode), FI_INC_LINK); |
| 310 | 306 | clear_nlink(inode); |
| 311 | − unlock_new_inode(inode); | |
| 312 | − make_bad_inode(inode); | |
| 313 | − iput(inode); | |
| 307 | + iget_failed(inode); | |
| 314 | 308 | alloc_nid_failed(sbi, inode->i_ino); |
| 315 | 309 | return err; |
| 316 | 310 | } |
| @@ -354,9 +348,7 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry, · 37 unmodified lines | ||
| 354 | 348 | return 0; |
| 355 | 349 | out: |
| 356 | 350 | clear_nlink(inode); |
| 357 | − unlock_new_inode(inode); | |
| 358 | − make_bad_inode(inode); | |
| 359 | − iput(inode); | |
| 351 | + iget_failed(inode); | |
| 360 | 352 | alloc_nid_failed(sbi, inode->i_ino); |
| 361 | 353 | return err; |
| 362 | 354 | } |
| @@ -688,9 +680,7 @@ release_out: · 325 unmodified lines | ||
| 688 | 680 | out: |
| 689 | 681 | f2fs_unlock_op(sbi); |
| 690 | 682 | clear_nlink(inode); |
| 691 | − unlock_new_inode(inode); | |
| 692 | − make_bad_inode(inode); | |
| 693 | − iput(inode); | |
| 683 | + iget_failed(inode); | |
| 694 | 684 | alloc_nid_failed(sbi, inode->i_ino); |
| 695 | 685 | return err; |
| 696 | 686 | } |
| @@ -704,7 +694,6 @@ const struct inode_operations f2fs_dir_inode_operations = { · 7 unmodified lines | ||
| 704 | 694 | .mkdir = f2fs_mkdir, |
| 705 | 695 | .rmdir = f2fs_rmdir, |
| 706 | 696 | .mknod = f2fs_mknod, |
| 707 | − .rename = f2fs_rename, | |
| 708 | 697 | .rename2 = f2fs_rename2, |
| 709 | 698 | .tmpfile = f2fs_tmpfile, |
| 710 | 699 | .getattr = f2fs_getattr, |
| @@ -237,7 +237,7 @@ retry: · 236 unmodified lines | ||
| 237 | 237 | nat_get_blkaddr(e) != NULL_ADDR && |
| 238 | 238 | new_blkaddr == NEW_ADDR); |
| 239 | 239 | |
| 240 | − /* increament version no as node is removed */ | |
| 240 | + /* increment version no as node is removed */ | |
| 241 | 241 | if (nat_get_blkaddr(e) != NEW_ADDR && new_blkaddr == NULL_ADDR) { |
| 242 | 242 | unsigned char version = nat_get_version(e); |
| 243 | 243 | nat_set_version(e, inc_node_version(version)); |
| @@ -274,7 +274,7 @@ int try_to_free_nats(struct f2fs_sb_info *sbi, int nr_shrink) · 30 unmodified lines | ||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /* |
| 277 | − * This function returns always success | |
| 277 | + * This function always returns success | |
| 278 | 278 | */ |
| 279 | 279 | void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni) |
| 280 | 280 | { |
| @@ -650,7 +650,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn, · 369 unmodified lines | ||
| 650 | 650 | |
| 651 | 651 | /* get indirect nodes in the path */ |
| 652 | 652 | for (i = 0; i < idx + 1; i++) { |
| 653 | − /* refernece count'll be increased */ | |
| 653 | + /* reference count'll be increased */ | |
| 654 | 654 | pages[i] = get_node_page(sbi, nid[i]); |
| 655 | 655 | if (IS_ERR(pages[i])) { |
| 656 | 656 | err = PTR_ERR(pages[i]); |
| @@ -823,22 +823,26 @@ int truncate_xattr_node(struct inode *inode, struct page *page) · 166 unmodified lines | ||
| 823 | 823 | */ |
| 824 | 824 | void remove_inode_page(struct inode *inode) |
| 825 | 825 | { |
| 826 | − struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | |
| 827 | − struct page *page; | |
| 828 | − nid_t ino = inode->i_ino; | |
| 829 | 826 | struct dnode_of_data dn; |
| 830 | 827 | |
| 831 | − page = get_node_page(sbi, ino); | |
| 832 | − if (IS_ERR(page)) | |
| 828 | + set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino); | |
| 829 | + if (get_dnode_of_data(&dn, 0, LOOKUP_NODE)) | |
| 833 | 830 | return; |
| 834 | 831 | |
| 835 | − if (truncate_xattr_node(inode, page)) { | |
| 836 | − f2fs_put_page(page, 1); | |
| 832 | + if (truncate_xattr_node(inode, dn.inode_page)) { | |
| 833 | + f2fs_put_dnode(&dn); | |
| 837 | 834 | return; |
| 838 | 835 | } |
| 839 | − /* 0 is possible, after f2fs_new_inode() is failed */ | |
| 836 | + | |
| 837 | + /* remove potential inline_data blocks */ | |
| 838 | + if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | |
| 839 | + S_ISLNK(inode->i_mode)) | |
| 840 | + truncate_data_blocks_range(&dn, 1); | |
| 841 | + | |
| 842 | + /* 0 is possible, after f2fs_new_inode() has failed */ | |
| 840 | 843 | f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1); |
| 841 | − set_new_dnode(&dn, inode, page, page, ino); | |
| 844 | + | |
| 845 | + /* will put inode & node pages */ | |
| 842 | 846 | truncate_node(&dn); |
| 843 | 847 | } |
| 844 | 848 | |
| @@ -1129,8 +1133,11 @@ continue_unlock: · 284 unmodified lines | ||
| 1129 | 1133 | set_fsync_mark(page, 0); |
| 1130 | 1134 | set_dentry_mark(page, 0); |
| 1131 | 1135 | } |
| 1132 | − NODE_MAPPING(sbi)->a_ops->writepage(page, wbc); | |
| 1133 | − wrote++; | |
| 1136 | + | |
| 1137 | + if (NODE_MAPPING(sbi)->a_ops->writepage(page, wbc)) | |
| 1138 | + unlock_page(page); | |
| 1139 | + else | |
| 1140 | + wrote++; | |
| 1134 | 1141 | |
| 1135 | 1142 | if (--wbc->nr_to_write == 0) |
| 1136 | 1143 | break; |
| @@ -1212,6 +1219,8 @@ static int f2fs_write_node_page(struct page *page, · 75 unmodified lines | ||
| 1212 | 1219 | |
| 1213 | 1220 | if (unlikely(sbi->por_doing)) |
| 1214 | 1221 | goto redirty_out; |
| 1222 | + if (unlikely(f2fs_cp_error(sbi))) | |
| 1223 | + goto redirty_out; | |
| 1215 | 1224 | |
| 1216 | 1225 | f2fs_wait_on_page_writeback(page, NODE); |
| 1217 | 1226 | |
| @@ -1540,15 +1549,6 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid) · 322 unmodified lines | ||
| 1540 | 1549 | kmem_cache_free(free_nid_slab, i); |
| 1541 | 1550 | } |
| 1542 | 1551 | |
| 1543 | −void recover_node_page(struct f2fs_sb_info *sbi, struct page *page, | |
| 1544 | − struct f2fs_summary *sum, struct node_info *ni, | |
| 1545 | − block_t new_blkaddr) | |
| 1546 | −{ | |
| 1547 | − rewrite_node_page(sbi, page, sum, ni->blk_addr, new_blkaddr); | |
| 1548 | − set_node_addr(sbi, ni, new_blkaddr, false); | |
| 1549 | − clear_node_page_dirty(page); | |
| 1550 | −} | |
| 1551 | − | |
| 1552 | 1552 | void recover_inline_xattr(struct inode *inode, struct page *page) |
| 1553 | 1553 | { |
| 1554 | 1554 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| @@ -1557,40 +1557,33 @@ void recover_inline_xattr(struct inode *inode, struct page *page) · 2 unmodified lines | ||
| 1557 | 1557 | struct page *ipage; |
| 1558 | 1558 | struct f2fs_inode *ri; |
| 1559 | 1559 | |
| 1560 | − if (!f2fs_has_inline_xattr(inode)) | |
| 1561 | − return; | |
| 1562 | − | |
| 1563 | − if (!IS_INODE(page)) | |
| 1564 | − return; | |
| 1565 | − | |
| 1566 | − ri = F2FS_INODE(page); | |
| 1567 | − if (!(ri->i_inline & F2FS_INLINE_XATTR)) | |
| 1568 | − return; | |
| 1569 | − | |
| 1570 | 1560 | ipage = get_node_page(sbi, inode->i_ino); |
| 1571 | 1561 | f2fs_bug_on(IS_ERR(ipage)); |
| 1572 | 1562 | |
| 1563 | + ri = F2FS_INODE(page); | |
| 1564 | + if (!(ri->i_inline & F2FS_INLINE_XATTR)) { | |
| 1565 | + clear_inode_flag(F2FS_I(inode), FI_INLINE_XATTR); | |
| 1566 | + goto update_inode; | |
| 1567 | + } | |
| 1568 | + | |
| 1573 | 1569 | dst_addr = inline_xattr_addr(ipage); |
| 1574 | 1570 | src_addr = inline_xattr_addr(page); |
| 1575 | 1571 | inline_size = inline_xattr_size(inode); |
| 1576 | 1572 | |
| 1577 | 1573 | f2fs_wait_on_page_writeback(ipage, NODE); |
| 1578 | 1574 | memcpy(dst_addr, src_addr, inline_size); |
| 1579 | − | |
| 1575 | +update_inode: | |
| 1580 | 1576 | update_inode(inode, ipage); |
| 1581 | 1577 | f2fs_put_page(ipage, 1); |
| 1582 | 1578 | } |
| 1583 | 1579 | |
| 1584 | −bool recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr) | |
| 1580 | +void recover_xattr_data(struct inode *inode, struct page *page, block_t blkaddr) | |
| 1585 | 1581 | { |
| 1586 | 1582 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 1587 | 1583 | nid_t prev_xnid = F2FS_I(inode)->i_xattr_nid; |
| 1588 | 1584 | nid_t new_xnid = nid_of_node(page); |
| 1589 | 1585 | struct node_info ni; |
| 1590 | 1586 | |
| 1591 | − if (!f2fs_has_xattr_block(ofs_of_node(page))) | |
| 1592 | − return false; | |
| 1593 | − | |
| 1594 | 1587 | /* 1: invalidate the previous xattr nid */ |
| 1595 | 1588 | if (!prev_xnid) |
| 1596 | 1589 | goto recover_xnid; |
| @@ -1618,7 +1611,6 @@ recover_xnid: · 21 unmodified lines | ||
| 1618 | 1611 | set_node_addr(sbi, &ni, blkaddr, false); |
| 1619 | 1612 | |
| 1620 | 1613 | update_inode_page(inode); |
| 1621 | − return true; | |
| 1622 | 1614 | } |
| 1623 | 1615 | |
| 1624 | 1616 | int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) |
| @@ -1637,7 +1629,7 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) · 12 unmodified lines | ||
| 1637 | 1629 | if (!ipage) |
| 1638 | 1630 | return -ENOMEM; |
| 1639 | 1631 | |
| 1640 | − /* Should not use this inode from free nid list */ | |
| 1632 | + /* Should not use this inode from free nid list */ | |
| 1641 | 1633 | remove_free_nid(NM_I(sbi), ino); |
| 1642 | 1634 | |
| 1643 | 1635 | SetPageUptodate(ipage); |
| @@ -1651,6 +1643,7 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) · 7 unmodified lines | ||
| 1651 | 1643 | dst->i_blocks = cpu_to_le64(1); |
| 1652 | 1644 | dst->i_links = cpu_to_le32(1); |
| 1653 | 1645 | dst->i_xattr_nid = 0; |
| 1646 | + dst->i_inline = src->i_inline & F2FS_INLINE_XATTR; | |
| 1654 | 1647 | |
| 1655 | 1648 | new_ni = old_ni; |
| 1656 | 1649 | new_ni.ino = ino; |
| @@ -1659,13 +1652,14 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) · 2 unmodified lines | ||
| 1659 | 1652 | WARN_ON(1); |
| 1660 | 1653 | set_node_addr(sbi, &new_ni, NEW_ADDR, false); |
| 1661 | 1654 | inc_valid_inode_count(sbi); |
| 1655 | + set_page_dirty(ipage); | |
| 1662 | 1656 | f2fs_put_page(ipage, 1); |
| 1663 | 1657 | return 0; |
| 1664 | 1658 | } |
| 1665 | 1659 | |
| 1666 | 1660 | /* |
| 1667 | 1661 | * ra_sum_pages() merge contiguous pages into one bio and submit. |
| 1668 | − * these pre-readed pages are alloced in bd_inode's mapping tree. | |
| 1662 | + * these pre-read pages are allocated in bd_inode's mapping tree. | |
| 1669 | 1663 | */ |
| 1670 | 1664 | static int ra_sum_pages(struct f2fs_sb_info *sbi, struct page **pages, |
| 1671 | 1665 | int start, int nrpages) |
| @@ -1709,7 +1703,7 @@ int restore_node_summary(struct f2fs_sb_info *sbi, · 37 unmodified lines | ||
| 1709 | 1703 | for (i = 0; !err && i < last_offset; i += nrpages, addr += nrpages) { |
| 1710 | 1704 | nrpages = min(last_offset - i, bio_blocks); |
| 1711 | 1705 | |
| 1712 | − /* read ahead node pages */ | |
| 1706 | + /* readahead node pages */ | |
| 1713 | 1707 | nrpages = ra_sum_pages(sbi, pages, addr, nrpages); |
| 1714 | 1708 | if (!nrpages) |
| 1715 | 1709 | return -ENOMEM; |
| @@ -1967,7 +1961,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi) · 251 unmodified lines | ||
| 1967 | 1961 | nm_i->max_nid = NAT_ENTRY_PER_BLOCK * nat_blocks; |
| 1968 | 1962 | |
| 1969 | 1963 | /* not used nids: 0, node, meta, (and root counted as valid node) */ |
| 1970 | − nm_i->available_nids = nm_i->max_nid - 3; | |
| 1964 | + nm_i->available_nids = nm_i->max_nid - F2FS_RESERVED_NODE_NUM; | |
| 1971 | 1965 | nm_i->fcnt = 0; |
| 1972 | 1966 | nm_i->nat_cnt = 0; |
| 1973 | 1967 | nm_i->ram_thresh = DEF_RAM_THRESHOLD; |
| @@ -62,8 +62,10 @@ static int recover_dentry(struct page *ipage, struct inode *inode) · 61 unmodified lines | ||
| 62 | 62 | } |
| 63 | 63 | retry: |
| 64 | 64 | de = f2fs_find_entry(dir, &name, &page); |
| 65 | − if (de && inode->i_ino == le32_to_cpu(de->ino)) | |
| 65 | + if (de && inode->i_ino == le32_to_cpu(de->ino)) { | |
| 66 | + clear_inode_flag(F2FS_I(inode), FI_INC_LINK); | |
| 66 | 67 | goto out_unmap_put; |
| 68 | + } | |
| 67 | 69 | if (de) { |
| 68 | 70 | einode = f2fs_iget(inode->i_sb, le32_to_cpu(de->ino)); |
| 69 | 71 | if (IS_ERR(einode)) { |
| @@ -300,14 +302,19 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, · 230 unmodified lines | ||
| 300 | 302 | struct node_info ni; |
| 301 | 303 | int err = 0, recovered = 0; |
| 302 | 304 | |
| 303 | − recover_inline_xattr(inode, page); | |
| 304 | − | |
| 305 | − if (recover_inline_data(inode, page)) | |
| 305 | + /* step 1: recover xattr */ | |
| 306 | + if (IS_INODE(page)) { | |
| 307 | + recover_inline_xattr(inode, page); | |
| 308 | + } else if (f2fs_has_xattr_block(ofs_of_node(page))) { | |
| 309 | + recover_xattr_data(inode, page, blkaddr); | |
| 306 | 310 | goto out; |
| 311 | + } | |
| 307 | 312 | |
| 308 | − if (recover_xattr_data(inode, page, blkaddr)) | |
| 313 | + /* step 2: recover inline data */ | |
| 314 | + if (recover_inline_data(inode, page)) | |
| 309 | 315 | goto out; |
| 310 | 316 | |
| 317 | + /* step 3: recover data indices */ | |
| 311 | 318 | start = start_bidx_of_node(ofs_of_node(page), fi); |
| 312 | 319 | end = start + ADDRS_PER_PAGE(page, fi); |
| 313 | 320 | |
| @@ -364,8 +371,6 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, · 50 unmodified lines | ||
| 364 | 371 | fill_node_footer(dn.node_page, dn.nid, ni.ino, |
| 365 | 372 | ofs_of_node(page), false); |
| 366 | 373 | set_page_dirty(dn.node_page); |
| 367 | − | |
| 368 | − recover_node_page(sbi, dn.node_page, &sum, &ni, blkaddr); | |
| 369 | 374 | err: |
| 370 | 375 | f2fs_put_dnode(&dn); |
| 371 | 376 | f2fs_unlock_op(sbi); |
| @@ -452,6 +457,9 @@ int recover_fsync_data(struct f2fs_sb_info *sbi) · 80 unmodified lines | ||
| 452 | 457 | /* step #1: find fsynced inode numbers */ |
| 453 | 458 | sbi->por_doing = true; |
| 454 | 459 | |
| 460 | + /* prevent checkpoint */ | |
| 461 | + mutex_lock(&sbi->cp_mutex); | |
| 462 | + | |
| 455 | 463 | blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); |
| 456 | 464 | |
| 457 | 465 | err = find_fsync_dnodes(sbi, &inode_list); |
| @@ -465,7 +473,8 @@ int recover_fsync_data(struct f2fs_sb_info *sbi) · 7 unmodified lines | ||
| 465 | 473 | |
| 466 | 474 | /* step #2: recover data */ |
| 467 | 475 | err = recover_data(sbi, &inode_list, CURSEG_WARM_NODE); |
| 468 | − f2fs_bug_on(!list_empty(&inode_list)); | |
| 476 | + if (!err) | |
| 477 | + f2fs_bug_on(!list_empty(&inode_list)); | |
| 469 | 478 | out: |
| 470 | 479 | destroy_fsync_dnodes(&inode_list); |
| 471 | 480 | kmem_cache_destroy(fsync_entry_slab); |
| @@ -482,8 +491,13 @@ out: · 10 unmodified lines | ||
| 482 | 491 | /* Flush all the NAT/SIT pages */ |
| 483 | 492 | while (get_pages(sbi, F2FS_DIRTY_META)) |
| 484 | 493 | sync_meta_pages(sbi, META, LONG_MAX); |
| 494 | + set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); | |
| 495 | + mutex_unlock(&sbi->cp_mutex); | |
| 485 | 496 | } else if (need_writecp) { |
| 497 | + mutex_unlock(&sbi->cp_mutex); | |
| 486 | 498 | write_checkpoint(sbi, false); |
| 499 | + } else { | |
| 500 | + mutex_unlock(&sbi->cp_mutex); | |
| 487 | 501 | } |
| 488 | 502 | return err; |
| 489 | 503 | } |
| @@ -62,7 +62,7 @@ static inline unsigned long __reverse_ffs(unsigned long word) · 61 unmodified lines | ||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /* |
| 65 | − * __find_rev_next(_zero)_bit is copied from lib/find_next_bit.c becasue | |
| 65 | + * __find_rev_next(_zero)_bit is copied from lib/find_next_bit.c because | |
| 66 | 66 | * f2fs_set_bit makes MSB and LSB reversed in a byte. |
| 67 | 67 | * Example: |
| 68 | 68 | * LSB <--> MSB |
| @@ -808,7 +808,7 @@ static void __refresh_next_blkoff(struct f2fs_sb_info *sbi, · 739 unmodified lines | ||
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | /* |
| 811 | − * This function always allocates a used segment (from dirty seglist) by SSR | |
| 811 | + * This function always allocates a used segment(from dirty seglist) by SSR | |
| 812 | 812 | * manner, so it should recover the existing segment information of valid blocks |
| 813 | 813 | */ |
| 814 | 814 | static void change_curseg(struct f2fs_sb_info *sbi, int type, bool reuse) |
| @@ -1103,55 +1103,6 @@ void recover_data_page(struct f2fs_sb_info *sbi, · 288 unmodified lines | ||
| 1103 | 1103 | mutex_unlock(&curseg->curseg_mutex); |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | −void rewrite_node_page(struct f2fs_sb_info *sbi, | |
| 1107 | − struct page *page, struct f2fs_summary *sum, | |
| 1108 | − block_t old_blkaddr, block_t new_blkaddr) | |
| 1109 | −{ | |
| 1110 | − struct sit_info *sit_i = SIT_I(sbi); | |
| 1111 | − int type = CURSEG_WARM_NODE; | |
| 1112 | − struct curseg_info *curseg; | |
| 1113 | − unsigned int segno, old_cursegno; | |
| 1114 | − block_t next_blkaddr = next_blkaddr_of_node(page); | |
| 1115 | − unsigned int next_segno = GET_SEGNO(sbi, next_blkaddr); | |
| 1116 | − struct f2fs_io_info fio = { | |
| 1117 | − .type = NODE, | |
| 1118 | − .rw = WRITE_SYNC, | |
| 1119 | − }; | |
| 1120 | − | |
| 1121 | − curseg = CURSEG_I(sbi, type); | |
| 1122 | − | |
| 1123 | − mutex_lock(&curseg->curseg_mutex); | |
| 1124 | − mutex_lock(&sit_i->sentry_lock); | |
| 1125 | − | |
| 1126 | − segno = GET_SEGNO(sbi, new_blkaddr); | |
| 1127 | − old_cursegno = curseg->segno; | |
| 1128 | − | |
| 1129 | − /* change the current segment */ | |
| 1130 | − if (segno != curseg->segno) { | |
| 1131 | − curseg->next_segno = segno; | |
| 1132 | − change_curseg(sbi, type, true); | |
| 1133 | − } | |
| 1134 | − curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, new_blkaddr); | |
| 1135 | − __add_sum_entry(sbi, type, sum); | |
| 1136 | − | |
| 1137 | − /* change the current log to the next block addr in advance */ | |
| 1138 | − if (next_segno != segno) { | |
| 1139 | − curseg->next_segno = next_segno; | |
| 1140 | − change_curseg(sbi, type, true); | |
| 1141 | − } | |
| 1142 | − curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, next_blkaddr); | |
| 1143 | − | |
| 1144 | − /* rewrite node page */ | |
| 1145 | − set_page_writeback(page); | |
| 1146 | − f2fs_submit_page_mbio(sbi, page, new_blkaddr, &fio); | |
| 1147 | − f2fs_submit_merged_bio(sbi, NODE, WRITE); | |
| 1148 | − refresh_sit_entry(sbi, old_blkaddr, new_blkaddr); | |
| 1149 | − locate_dirty_segment(sbi, old_cursegno); | |
| 1150 | − | |
| 1151 | − mutex_unlock(&sit_i->sentry_lock); | |
| 1152 | − mutex_unlock(&curseg->curseg_mutex); | |
| 1153 | −} | |
| 1154 | − | |
| 1155 | 1106 | static inline bool is_merged_page(struct f2fs_sb_info *sbi, |
| 1156 | 1107 | struct page *page, enum page_type type) |
| 1157 | 1108 | { |
| @@ -549,7 +549,7 @@ static inline void verify_block_addr(struct f2fs_sb_info *sbi, block_t blk_addr) · 548 unmodified lines | ||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | /* |
| 552 | − * Summary block is always treated as invalid block | |
| 552 | + * Summary block is always treated as an invalid block | |
| 553 | 553 | */ |
| 554 | 554 | static inline void check_block_count(struct f2fs_sb_info *sbi, |
| 555 | 555 | int segno, struct f2fs_sit_entry *raw_sit) |
| @@ -432,9 +432,15 @@ static void f2fs_put_super(struct super_block *sb) · 431 unmodified lines | ||
| 432 | 432 | stop_gc_thread(sbi); |
| 433 | 433 | |
| 434 | 434 | /* We don't need to do checkpoint when it's clean */ |
| 435 | − if (sbi->s_dirty && get_pages(sbi, F2FS_DIRTY_NODES)) | |
| 435 | + if (sbi->s_dirty) | |
| 436 | 436 | write_checkpoint(sbi, true); |
| 437 | 437 | |
| 438 | + /* | |
| 439 | + * normally superblock is clean, so we need to release this. | |
| 440 | + * In addition, EIO will skip do checkpoint, we need this as well. | |
| 441 | + */ | |
| 442 | + release_dirty_inode(sbi); | |
| 443 | + | |
| 438 | 444 | iput(sbi->node_inode); |
| 439 | 445 | iput(sbi->meta_inode); |
| 440 | 446 | |
| @@ -457,9 +463,6 @@ int f2fs_sync_fs(struct super_block *sb, int sync) · 16 unmodified lines | ||
| 457 | 463 | |
| 458 | 464 | trace_f2fs_sync_fs(sb, sync); |
| 459 | 465 | |
| 460 | − if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) | |
| 461 | − return 0; | |
| 462 | − | |
| 463 | 466 | if (sync) { |
| 464 | 467 | mutex_lock(&sbi->gc_mutex); |
| 465 | 468 | write_checkpoint(sbi, false); |
| @@ -505,8 +508,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) · 39 unmodified lines | ||
| 505 | 508 | buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count; |
| 506 | 509 | buf->f_bavail = user_block_count - valid_user_blocks(sbi); |
| 507 | 510 | |
| 508 | − buf->f_files = sbi->total_node_count; | |
| 509 | − buf->f_ffree = sbi->total_node_count - valid_inode_count(sbi); | |
| 511 | + buf->f_files = sbi->total_node_count - F2FS_RESERVED_NODE_NUM; | |
| 512 | + buf->f_ffree = buf->f_files - valid_inode_count(sbi); | |
| 510 | 513 | |
| 511 | 514 | buf->f_namelen = F2FS_NAME_LEN; |
| 512 | 515 | buf->f_fsid.val[0] = (u32)id; |
| @@ -663,7 +666,7 @@ restore_gc: · 150 unmodified lines | ||
| 663 | 666 | if (need_restart_gc) { |
| 664 | 667 | if (start_gc_thread(sbi)) |
| 665 | 668 | f2fs_msg(sbi->sb, KERN_WARNING, |
| 666 | − "background gc thread is stop"); | |
| 669 | + "background gc thread has stopped"); | |
| 667 | 670 | } else if (need_stop_gc) { |
| 668 | 671 | stop_gc_thread(sbi); |
| 669 | 672 | } |
| @@ -812,7 +815,7 @@ static int sanity_check_ckpt(struct f2fs_sb_info *sbi) · 142 unmodified lines | ||
| 812 | 815 | if (unlikely(fsmeta >= total)) |
| 813 | 816 | return 1; |
| 814 | 817 | |
| 815 | − if (unlikely(is_set_ckpt_flags(ckpt, CP_ERROR_FLAG))) { | |
| 818 | + if (unlikely(f2fs_cp_error(sbi))) { | |
| 816 | 819 | f2fs_msg(sbi->sb, KERN_ERR, "A bug case: need to run fsck"); |
| 817 | 820 | return 1; |
| 818 | 821 | } |
| @@ -899,8 +902,10 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) · 80 unmodified lines | ||
| 899 | 902 | struct buffer_head *raw_super_buf; |
| 900 | 903 | struct inode *root; |
| 901 | 904 | long err = -EINVAL; |
| 905 | + bool retry = true; | |
| 902 | 906 | int i; |
| 903 | 907 | |
| 908 | +try_onemore: | |
| 904 | 909 | /* allocate memory for f2fs-specific super block info */ |
| 905 | 910 | sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL); |
| 906 | 911 | if (!sbi) |
| @@ -1080,9 +1085,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) · 173 unmodified lines | ||
| 1080 | 1085 | /* recover fsynced data */ |
| 1081 | 1086 | if (!test_opt(sbi, DISABLE_ROLL_FORWARD)) { |
| 1082 | 1087 | err = recover_fsync_data(sbi); |
| 1083 | − if (err) | |
| 1088 | + if (err) { | |
| 1084 | 1089 | f2fs_msg(sb, KERN_ERR, |
| 1085 | 1090 | "Cannot recover all fsync data errno=%ld", err); |
| 1091 | + goto free_kobj; | |
| 1092 | + } | |
| 1086 | 1093 | } |
| 1087 | 1094 | |
| 1088 | 1095 | /* |
| @@ -1123,6 +1130,13 @@ free_sb_buf: · 34 unmodified lines | ||
| 1123 | 1130 | brelse(raw_super_buf); |
| 1124 | 1131 | free_sbi: |
| 1125 | 1132 | kfree(sbi); |
| 1133 | + | |
| 1134 | + /* give only one another chance */ | |
| 1135 | + if (retry) { | |
| 1136 | + retry = 0; | |
| 1137 | + shrink_dcache_sb(sb); | |
| 1138 | + goto try_onemore; | |
| 1139 | + } | |
| 1126 | 1140 | return err; |
| 1127 | 1141 | } |
| 1128 | 1142 | |
| @@ -528,7 +528,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, · 527 unmodified lines | ||
| 528 | 528 | int free; |
| 529 | 529 | /* |
| 530 | 530 | * If value is NULL, it is remove operation. |
| 531 | − * In case of update operation, we caculate free. | |
| 531 | + * In case of update operation, we calculate free. | |
| 532 | 532 | */ |
| 533 | 533 | free = MIN_OFFSET(inode) - ((char *)last - (char *)base_addr); |
| 534 | 534 | if (found) |
| @@ -97,7 +97,7 @@ static void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh) · 96 unmodified lines | ||
| 97 | 97 | struct commit_header *h; |
| 98 | 98 | __u32 csum; |
| 99 | 99 | |
| 100 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 100 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 101 | 101 | return; |
| 102 | 102 | |
| 103 | 103 | h = (struct commit_header *)(bh->b_data); |
| @@ -313,11 +313,11 @@ static __u32 jbd2_checksum_data(__u32 crc32_sum, struct buffer_head *bh) · 209 unmodified lines | ||
| 313 | 313 | return checksum; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | −static void write_tag_block(int tag_bytes, journal_block_tag_t *tag, | |
| 316 | +static void write_tag_block(journal_t *j, journal_block_tag_t *tag, | |
| 317 | 317 | unsigned long long block) |
| 318 | 318 | { |
| 319 | 319 | tag->t_blocknr = cpu_to_be32(block & (u32)~0); |
| 320 | − if (tag_bytes > JBD2_TAG_SIZE32) | |
| 320 | + if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_64BIT)) | |
| 321 | 321 | tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1); |
| 322 | 322 | } |
| 323 | 323 | |
| @@ -327,7 +327,7 @@ static void jbd2_descr_block_csum_set(journal_t *j, · 3 unmodified lines | ||
| 327 | 327 | struct jbd2_journal_block_tail *tail; |
| 328 | 328 | __u32 csum; |
| 329 | 329 | |
| 330 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 330 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 331 | 331 | return; |
| 332 | 332 | |
| 333 | 333 | tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize - |
| @@ -340,12 +340,13 @@ static void jbd2_descr_block_csum_set(journal_t *j, · 6 unmodified lines | ||
| 340 | 340 | static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, |
| 341 | 341 | struct buffer_head *bh, __u32 sequence) |
| 342 | 342 | { |
| 343 | + journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag; | |
| 343 | 344 | struct page *page = bh->b_page; |
| 344 | 345 | __u8 *addr; |
| 345 | 346 | __u32 csum32; |
| 346 | 347 | __be32 seq; |
| 347 | 348 | |
| 348 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 349 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 349 | 350 | return; |
| 350 | 351 | |
| 351 | 352 | seq = cpu_to_be32(sequence); |
| @@ -355,8 +356,10 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, · 3 unmodified lines | ||
| 355 | 356 | bh->b_size); |
| 356 | 357 | kunmap_atomic(addr); |
| 357 | 358 | |
| 358 | − /* We only have space to store the lower 16 bits of the crc32c. */ | |
| 359 | − tag->t_checksum = cpu_to_be16(csum32); | |
| 359 | + if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3)) | |
| 360 | + tag3->t_checksum = cpu_to_be32(csum32); | |
| 361 | + else | |
| 362 | + tag->t_checksum = cpu_to_be16(csum32); | |
| 360 | 363 | } |
| 361 | 364 | /* |
| 362 | 365 | * jbd2_journal_commit_transaction |
| @@ -396,7 +399,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) · 33 unmodified lines | ||
| 396 | 399 | LIST_HEAD(io_bufs); |
| 397 | 400 | LIST_HEAD(log_bufs); |
| 398 | 401 | |
| 399 | − if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 402 | + if (jbd2_journal_has_csum_v2or3(journal)) | |
| 400 | 403 | csum_size = sizeof(struct jbd2_journal_block_tail); |
| 401 | 404 | |
| 402 | 405 | /* |
| @@ -690,7 +693,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) · 287 unmodified lines | ||
| 690 | 693 | tag_flag |= JBD2_FLAG_SAME_UUID; |
| 691 | 694 | |
| 692 | 695 | tag = (journal_block_tag_t *) tagp; |
| 693 | − write_tag_block(tag_bytes, tag, jh2bh(jh)->b_blocknr); | |
| 696 | + write_tag_block(journal, tag, jh2bh(jh)->b_blocknr); | |
| 694 | 697 | tag->t_flags = cpu_to_be16(tag_flag); |
| 695 | 698 | jbd2_block_tag_csum_set(journal, tag, wbuf[bufs], |
| 696 | 699 | commit_transaction->t_tid); |
| @@ -124,7 +124,7 @@ EXPORT_SYMBOL(__jbd2_debug); · 123 unmodified lines | ||
| 124 | 124 | /* Checksumming functions */ |
| 125 | 125 | static int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb) |
| 126 | 126 | { |
| 127 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 127 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 128 | 128 | return 1; |
| 129 | 129 | |
| 130 | 130 | return sb->s_checksum_type == JBD2_CRC32C_CHKSUM; |
| @@ -145,7 +145,7 @@ static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb) · 14 unmodified lines | ||
| 145 | 145 | |
| 146 | 146 | static int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb) |
| 147 | 147 | { |
| 148 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 148 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 149 | 149 | return 1; |
| 150 | 150 | |
| 151 | 151 | return sb->s_checksum == jbd2_superblock_csum(j, sb); |
| @@ -153,7 +153,7 @@ static int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb) · 1 unmodified line | ||
| 153 | 153 | |
| 154 | 154 | static void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb) |
| 155 | 155 | { |
| 156 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 156 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 157 | 157 | return; |
| 158 | 158 | |
| 159 | 159 | sb->s_checksum = jbd2_superblock_csum(j, sb); |
| @@ -1522,21 +1522,29 @@ static int journal_get_superblock(journal_t *journal) · 1362 unmodified lines | ||
| 1522 | 1522 | goto out; |
| 1523 | 1523 | } |
| 1524 | 1524 | |
| 1525 | − if (JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM) && | |
| 1526 | − JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) { | |
| 1525 | + if (jbd2_journal_has_csum_v2or3(journal) && | |
| 1526 | + JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM)) { | |
| 1527 | 1527 | /* Can't have checksum v1 and v2 on at the same time! */ |
| 1528 | 1528 | printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2 " |
| 1529 | 1529 | "at the same time!\n"); |
| 1530 | 1530 | goto out; |
| 1531 | 1531 | } |
| 1532 | 1532 | |
| 1533 | + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) && | |
| 1534 | + JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) { | |
| 1535 | + /* Can't have checksum v2 and v3 at the same time! */ | |
| 1536 | + printk(KERN_ERR "JBD2: Can't enable checksumming v2 and v3 " | |
| 1537 | + "at the same time!\n"); | |
| 1538 | + goto out; | |
| 1539 | + } | |
| 1540 | + | |
| 1533 | 1541 | if (!jbd2_verify_csum_type(journal, sb)) { |
| 1534 | 1542 | printk(KERN_ERR "JBD2: Unknown checksum type\n"); |
| 1535 | 1543 | goto out; |
| 1536 | 1544 | } |
| 1537 | 1545 | |
| 1538 | 1546 | /* Load the checksum driver */ |
| 1539 | − if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) { | |
| 1547 | + if (jbd2_journal_has_csum_v2or3(journal)) { | |
| 1540 | 1548 | journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0); |
| 1541 | 1549 | if (IS_ERR(journal->j_chksum_driver)) { |
| 1542 | 1550 | printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n"); |
| @@ -1553,7 +1561,7 @@ static int journal_get_superblock(journal_t *journal) · 10 unmodified lines | ||
| 1553 | 1561 | } |
| 1554 | 1562 | |
| 1555 | 1563 | /* Precompute checksum seed for all metadata */ |
| 1556 | − if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 1564 | + if (jbd2_journal_has_csum_v2or3(journal)) | |
| 1557 | 1565 | journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid, |
| 1558 | 1566 | sizeof(sb->s_uuid)); |
| 1559 | 1567 | |
| @@ -1813,8 +1821,14 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, · 253 unmodified lines | ||
| 1813 | 1821 | if (!jbd2_journal_check_available_features(journal, compat, ro, incompat)) |
| 1814 | 1822 | return 0; |
| 1815 | 1823 | |
| 1816 | − /* Asking for checksumming v2 and v1? Only give them v2. */ | |
| 1817 | − if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2 && | |
| 1824 | + /* If enabling v2 checksums, turn on v3 instead */ | |
| 1825 | + if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2) { | |
| 1826 | + incompat &= ~JBD2_FEATURE_INCOMPAT_CSUM_V2; | |
| 1827 | + incompat |= JBD2_FEATURE_INCOMPAT_CSUM_V3; | |
| 1828 | + } | |
| 1829 | + | |
| 1830 | + /* Asking for checksumming v3 and v1? Only give them v3. */ | |
| 1831 | + if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V3 && | |
| 1818 | 1832 | compat & JBD2_FEATURE_COMPAT_CHECKSUM) |
| 1819 | 1833 | compat &= ~JBD2_FEATURE_COMPAT_CHECKSUM; |
| 1820 | 1834 | |
| @@ -1823,8 +1837,8 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, · 2 unmodified lines | ||
| 1823 | 1837 | |
| 1824 | 1838 | sb = journal->j_superblock; |
| 1825 | 1839 | |
| 1826 | − /* If enabling v2 checksums, update superblock */ | |
| 1827 | − if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V2)) { | |
| 1840 | + /* If enabling v3 checksums, update superblock */ | |
| 1841 | + if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V3)) { | |
| 1828 | 1842 | sb->s_checksum_type = JBD2_CRC32C_CHKSUM; |
| 1829 | 1843 | sb->s_feature_compat &= |
| 1830 | 1844 | ~cpu_to_be32(JBD2_FEATURE_COMPAT_CHECKSUM); |
| @@ -1842,8 +1856,7 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, · 11 unmodified lines | ||
| 1842 | 1856 | } |
| 1843 | 1857 | |
| 1844 | 1858 | /* Precompute checksum seed for all metadata */ |
| 1845 | − if (JBD2_HAS_INCOMPAT_FEATURE(journal, | |
| 1846 | − JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 1859 | + if (jbd2_journal_has_csum_v2or3(journal)) | |
| 1847 | 1860 | journal->j_csum_seed = jbd2_chksum(journal, ~0, |
| 1848 | 1861 | sb->s_uuid, |
| 1849 | 1862 | sizeof(sb->s_uuid)); |
| @@ -1852,7 +1865,8 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, · 2 unmodified lines | ||
| 1852 | 1865 | /* If enabling v1 checksums, downgrade superblock */ |
| 1853 | 1866 | if (COMPAT_FEATURE_ON(JBD2_FEATURE_COMPAT_CHECKSUM)) |
| 1854 | 1867 | sb->s_feature_incompat &= |
| 1855 | − ~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2); | |
| 1868 | + ~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2 | | |
| 1869 | + JBD2_FEATURE_INCOMPAT_CSUM_V3); | |
| 1856 | 1870 | |
| 1857 | 1871 | sb->s_feature_compat |= cpu_to_be32(compat); |
| 1858 | 1872 | sb->s_feature_ro_compat |= cpu_to_be32(ro); |
| @@ -2165,16 +2179,20 @@ int jbd2_journal_blocks_per_page(struct inode *inode) · 306 unmodified lines | ||
| 2165 | 2179 | */ |
| 2166 | 2180 | size_t journal_tag_bytes(journal_t *journal) |
| 2167 | 2181 | { |
| 2168 | − journal_block_tag_t tag; | |
| 2169 | − size_t x = 0; | |
| 2182 | + size_t sz; | |
| 2183 | + | |
| 2184 | + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) | |
| 2185 | + return sizeof(journal_block_tag3_t); | |
| 2186 | + | |
| 2187 | + sz = sizeof(journal_block_tag_t); | |
| 2170 | 2188 | |
| 2171 | 2189 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) |
| 2172 | − x += sizeof(tag.t_checksum); | |
| 2190 | + sz += sizeof(__u16); | |
| 2173 | 2191 | |
| 2174 | 2192 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) |
| 2175 | − return x + JBD2_TAG_SIZE64; | |
| 2193 | + return sz; | |
| 2176 | 2194 | else |
| 2177 | − return x + JBD2_TAG_SIZE32; | |
| 2195 | + return sz - sizeof(__u32); | |
| 2178 | 2196 | } |
| 2179 | 2197 | |
| 2180 | 2198 | /* |
| @@ -181,7 +181,7 @@ static int jbd2_descr_block_csum_verify(journal_t *j, · 180 unmodified lines | ||
| 181 | 181 | __be32 provided; |
| 182 | 182 | __u32 calculated; |
| 183 | 183 | |
| 184 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 184 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 185 | 185 | return 1; |
| 186 | 186 | |
| 187 | 187 | tail = (struct jbd2_journal_block_tail *)(buf + j->j_blocksize - |
| @@ -205,7 +205,7 @@ static int count_tags(journal_t *journal, struct buffer_head *bh) · 17 unmodified lines | ||
| 205 | 205 | int nr = 0, size = journal->j_blocksize; |
| 206 | 206 | int tag_bytes = journal_tag_bytes(journal); |
| 207 | 207 | |
| 208 | − if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 208 | + if (jbd2_journal_has_csum_v2or3(journal)) | |
| 209 | 209 | size -= sizeof(struct jbd2_journal_block_tail); |
| 210 | 210 | |
| 211 | 211 | tagp = &bh->b_data[sizeof(journal_header_t)]; |
| @@ -338,10 +338,11 @@ int jbd2_journal_skip_recovery(journal_t *journal) · 126 unmodified lines | ||
| 338 | 338 | return err; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | −static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag_t *tag) | |
| 341 | +static inline unsigned long long read_tag_block(journal_t *journal, | |
| 342 | + journal_block_tag_t *tag) | |
| 342 | 343 | { |
| 343 | 344 | unsigned long long block = be32_to_cpu(tag->t_blocknr); |
| 344 | − if (tag_bytes > JBD2_TAG_SIZE32) | |
| 345 | + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) | |
| 345 | 346 | block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32; |
| 346 | 347 | return block; |
| 347 | 348 | } |
| @@ -384,7 +385,7 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) · 36 unmodified lines | ||
| 384 | 385 | __be32 provided; |
| 385 | 386 | __u32 calculated; |
| 386 | 387 | |
| 387 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 388 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 388 | 389 | return 1; |
| 389 | 390 | |
| 390 | 391 | h = buf; |
| @@ -399,17 +400,21 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf) · 8 unmodified lines | ||
| 399 | 400 | static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag, |
| 400 | 401 | void *buf, __u32 sequence) |
| 401 | 402 | { |
| 403 | + journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag; | |
| 402 | 404 | __u32 csum32; |
| 403 | 405 | __be32 seq; |
| 404 | 406 | |
| 405 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 407 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 406 | 408 | return 1; |
| 407 | 409 | |
| 408 | 410 | seq = cpu_to_be32(sequence); |
| 409 | 411 | csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq)); |
| 410 | 412 | csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize); |
| 411 | 413 | |
| 412 | − return tag->t_checksum == cpu_to_be16(csum32); | |
| 414 | + if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3)) | |
| 415 | + return tag3->t_checksum == cpu_to_be32(csum32); | |
| 416 | + else | |
| 417 | + return tag->t_checksum == cpu_to_be16(csum32); | |
| 413 | 418 | } |
| 414 | 419 | |
| 415 | 420 | static int do_one_pass(journal_t *journal, |
| @@ -426,6 +431,7 @@ static int do_one_pass(journal_t *journal, · 10 unmodified lines | ||
| 426 | 431 | int tag_bytes = journal_tag_bytes(journal); |
| 427 | 432 | __u32 crc32_sum = ~0; /* Transactional Checksums */ |
| 428 | 433 | int descr_csum_size = 0; |
| 434 | + int block_error = 0; | |
| 429 | 435 | |
| 430 | 436 | /* |
| 431 | 437 | * First thing is to establish what we expect to find in the log |
| @@ -512,8 +518,7 @@ static int do_one_pass(journal_t *journal, · 80 unmodified lines | ||
| 512 | 518 | switch(blocktype) { |
| 513 | 519 | case JBD2_DESCRIPTOR_BLOCK: |
| 514 | 520 | /* Verify checksum first */ |
| 515 | − if (JBD2_HAS_INCOMPAT_FEATURE(journal, | |
| 516 | − JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 521 | + if (jbd2_journal_has_csum_v2or3(journal)) | |
| 517 | 522 | descr_csum_size = |
| 518 | 523 | sizeof(struct jbd2_journal_block_tail); |
| 519 | 524 | if (descr_csum_size > 0 && |
| @@ -574,7 +579,7 @@ static int do_one_pass(journal_t *journal, · 54 unmodified lines | ||
| 574 | 579 | unsigned long long blocknr; |
| 575 | 580 | |
| 576 | 581 | J_ASSERT(obh != NULL); |
| 577 | − blocknr = read_tag_block(tag_bytes, | |
| 582 | + blocknr = read_tag_block(journal, | |
| 578 | 583 | tag); |
| 579 | 584 | |
| 580 | 585 | /* If the block has been |
| @@ -598,7 +603,8 @@ static int do_one_pass(journal_t *journal, · 17 unmodified lines | ||
| 598 | 603 | "checksum recovering " |
| 599 | 604 | "block %llu in log\n", |
| 600 | 605 | blocknr); |
| 601 | − continue; | |
| 606 | + block_error = 1; | |
| 607 | + goto skip_write; | |
| 602 | 608 | } |
| 603 | 609 | |
| 604 | 610 | /* Find a buffer for the new |
| @@ -797,7 +803,8 @@ static int do_one_pass(journal_t *journal, · 192 unmodified lines | ||
| 797 | 803 | success = -EIO; |
| 798 | 804 | } |
| 799 | 805 | } |
| 800 | − | |
| 806 | + if (block_error && success == 0) | |
| 807 | + success = -EIO; | |
| 801 | 808 | return success; |
| 802 | 809 | |
| 803 | 810 | failed: |
| @@ -811,7 +818,7 @@ static int jbd2_revoke_block_csum_verify(journal_t *j, · 7 unmodified lines | ||
| 811 | 818 | __be32 provided; |
| 812 | 819 | __u32 calculated; |
| 813 | 820 | |
| 814 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 821 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 815 | 822 | return 1; |
| 816 | 823 | |
| 817 | 824 | tail = (struct jbd2_journal_revoke_tail *)(buf + j->j_blocksize - |
| @@ -91,8 +91,8 @@ · 90 unmodified lines | ||
| 91 | 91 | #include <linux/list.h> |
| 92 | 92 | #include <linux/init.h> |
| 93 | 93 | #include <linux/bio.h> |
| 94 | −#endif | |
| 95 | 94 | #include <linux/log2.h> |
| 95 | +#endif | |
| 96 | 96 | |
| 97 | 97 | static struct kmem_cache *jbd2_revoke_record_cache; |
| 98 | 98 | static struct kmem_cache *jbd2_revoke_table_cache; |
| @@ -597,7 +597,7 @@ static void write_one_revoke_record(journal_t *journal, · 498 unmodified lines | ||
| 597 | 597 | offset = *offsetp; |
| 598 | 598 | |
| 599 | 599 | /* Do we need to leave space at the end for a checksum? */ |
| 600 | − if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 600 | + if (jbd2_journal_has_csum_v2or3(journal)) | |
| 601 | 601 | csum_size = sizeof(struct jbd2_journal_revoke_tail); |
| 602 | 602 | |
| 603 | 603 | /* Make sure we have a descriptor with space left for the record */ |
| @@ -644,7 +644,7 @@ static void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh) · 40 unmodified lines | ||
| 644 | 644 | struct jbd2_journal_revoke_tail *tail; |
| 645 | 645 | __u32 csum; |
| 646 | 646 | |
| 647 | − if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2)) | |
| 647 | + if (!jbd2_journal_has_csum_v2or3(j)) | |
| 648 | 648 | return; |
| 649 | 649 | |
| 650 | 650 | tail = (struct jbd2_journal_revoke_tail *)(bh->b_data + j->j_blocksize - |
| @@ -1619,7 +1619,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp · 1618 unmodified lines | ||
| 1619 | 1619 | smp_mb(); |
| 1620 | 1620 | error = check_conflicting_open(dentry, arg); |
| 1621 | 1621 | if (error) |
| 1622 | − locks_unlink_lock(flp); | |
| 1622 | + locks_unlink_lock(before); | |
| 1623 | 1623 | out: |
| 1624 | 1624 | if (is_deleg) |
| 1625 | 1625 | mutex_unlock(&inode->i_mutex); |
| @@ -1217,6 +1217,11 @@ static void namespace_unlock(void) · 1216 unmodified lines | ||
| 1217 | 1217 | head.first->pprev = &head.first; |
| 1218 | 1218 | INIT_HLIST_HEAD(&unmounted); |
| 1219 | 1219 | |
| 1220 | + /* undo decrements we'd done in umount_tree() */ | |
| 1221 | + hlist_for_each_entry(mnt, &head, mnt_hash) | |
| 1222 | + if (mnt->mnt_ex_mountpoint.mnt) | |
| 1223 | + mntget(mnt->mnt_ex_mountpoint.mnt); | |
| 1224 | + | |
| 1220 | 1225 | up_write(&namespace_sem); |
| 1221 | 1226 | |
| 1222 | 1227 | synchronize_rcu(); |
| @@ -1253,6 +1258,9 @@ void umount_tree(struct mount *mnt, int how) · 30 unmodified lines | ||
| 1253 | 1258 | hlist_add_head(&p->mnt_hash, &tmp_list); |
| 1254 | 1259 | } |
| 1255 | 1260 | |
| 1261 | + hlist_for_each_entry(p, &tmp_list, mnt_hash) | |
| 1262 | + list_del_init(&p->mnt_child); | |
| 1263 | + | |
| 1256 | 1264 | if (how) |
| 1257 | 1265 | propagate_umount(&tmp_list); |
| 1258 | 1266 | |
| @@ -1263,9 +1271,9 @@ void umount_tree(struct mount *mnt, int how) · 4 unmodified lines | ||
| 1263 | 1271 | p->mnt_ns = NULL; |
| 1264 | 1272 | if (how < 2) |
| 1265 | 1273 | p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; |
| 1266 | − list_del_init(&p->mnt_child); | |
| 1267 | 1274 | if (mnt_has_parent(p)) { |
| 1268 | 1275 | put_mountpoint(p->mnt_mp); |
| 1276 | + mnt_add_count(p->mnt_parent, -1); | |
| 1269 | 1277 | /* move the reference to mountpoint into ->mnt_ex_mountpoint */ |
| 1270 | 1278 | p->mnt_ex_mountpoint.dentry = p->mnt_mountpoint; |
| 1271 | 1279 | p->mnt_ex_mountpoint.mnt = &p->mnt_parent->mnt; |
| @@ -129,7 +129,10 @@ static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, · 128 unmodified lines | ||
| 129 | 129 | .rpc_argp = &args, |
| 130 | 130 | .rpc_resp = &fattr, |
| 131 | 131 | }; |
| 132 | − int status; | |
| 132 | + int status = 0; | |
| 133 | + | |
| 134 | + if (acl == NULL && (!S_ISDIR(inode->i_mode) || dfacl == NULL)) | |
| 135 | + goto out; | |
| 133 | 136 | |
| 134 | 137 | status = -EOPNOTSUPP; |
| 135 | 138 | if (!nfs_server_capable(inode, NFS_CAP_ACLS)) |
| @@ -2560,6 +2560,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) · 2559 unmodified lines | ||
| 2560 | 2560 | struct nfs4_closedata *calldata = data; |
| 2561 | 2561 | struct nfs4_state *state = calldata->state; |
| 2562 | 2562 | struct nfs_server *server = NFS_SERVER(calldata->inode); |
| 2563 | + nfs4_stateid *res_stateid = NULL; | |
| 2563 | 2564 | |
| 2564 | 2565 | dprintk("%s: begin!\n", __func__); |
| 2565 | 2566 | if (!nfs4_sequence_done(task, &calldata->res.seq_res)) |
| @@ -2570,12 +2571,12 @@ static void nfs4_close_done(struct rpc_task *task, void *data) · 4 unmodified lines | ||
| 2570 | 2571 | */ |
| 2571 | 2572 | switch (task->tk_status) { |
| 2572 | 2573 | case 0: |
| 2573 | − if (calldata->roc) | |
| 2574 | + res_stateid = &calldata->res.stateid; | |
| 2575 | + if (calldata->arg.fmode == 0 && calldata->roc) | |
| 2574 | 2576 | pnfs_roc_set_barrier(state->inode, |
| 2575 | 2577 | calldata->roc_barrier); |
| 2576 | − nfs_clear_open_stateid(state, &calldata->res.stateid, 0); | |
| 2577 | 2578 | renew_lease(server, calldata->timestamp); |
| 2578 | − goto out_release; | |
| 2579 | + break; | |
| 2579 | 2580 | case -NFS4ERR_ADMIN_REVOKED: |
| 2580 | 2581 | case -NFS4ERR_STALE_STATEID: |
| 2581 | 2582 | case -NFS4ERR_OLD_STATEID: |
| @@ -2589,7 +2590,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) · 7 unmodified lines | ||
| 2589 | 2590 | goto out_release; |
| 2590 | 2591 | } |
| 2591 | 2592 | } |
| 2592 | − nfs_clear_open_stateid(state, NULL, calldata->arg.fmode); | |
| 2593 | + nfs_clear_open_stateid(state, res_stateid, calldata->arg.fmode); | |
| 2593 | 2594 | out_release: |
| 2594 | 2595 | nfs_release_seqid(calldata->arg.seqid); |
| 2595 | 2596 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); |
| @@ -2601,6 +2602,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) · 5 unmodified lines | ||
| 2601 | 2602 | struct nfs4_closedata *calldata = data; |
| 2602 | 2603 | struct nfs4_state *state = calldata->state; |
| 2603 | 2604 | struct inode *inode = calldata->inode; |
| 2605 | + bool is_rdonly, is_wronly, is_rdwr; | |
| 2604 | 2606 | int call_close = 0; |
| 2605 | 2607 | |
| 2606 | 2608 | dprintk("%s: begin!\n", __func__); |
| @@ -2608,18 +2610,24 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) · 1 unmodified line | ||
| 2608 | 2610 | goto out_wait; |
| 2609 | 2611 | |
| 2610 | 2612 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE]; |
| 2611 | − calldata->arg.fmode = FMODE_READ|FMODE_WRITE; | |
| 2612 | 2613 | spin_lock(&state->owner->so_lock); |
| 2614 | + is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); | |
| 2615 | + is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); | |
| 2616 | + is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); | |
| 2617 | + /* Calculate the current open share mode */ | |
| 2618 | + calldata->arg.fmode = 0; | |
| 2619 | + if (is_rdonly || is_rdwr) | |
| 2620 | + calldata->arg.fmode |= FMODE_READ; | |
| 2621 | + if (is_wronly || is_rdwr) | |
| 2622 | + calldata->arg.fmode |= FMODE_WRITE; | |
| 2613 | 2623 | /* Calculate the change in open mode */ |
| 2614 | 2624 | if (state->n_rdwr == 0) { |
| 2615 | 2625 | if (state->n_rdonly == 0) { |
| 2616 | − call_close |= test_bit(NFS_O_RDONLY_STATE, &state->flags); | |
| 2617 | − call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); | |
| 2626 | + call_close |= is_rdonly || is_rdwr; | |
| 2618 | 2627 | calldata->arg.fmode &= ~FMODE_READ; |
| 2619 | 2628 | } |
| 2620 | 2629 | if (state->n_wronly == 0) { |
| 2621 | − call_close |= test_bit(NFS_O_WRONLY_STATE, &state->flags); | |
| 2622 | − call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); | |
| 2630 | + call_close |= is_wronly || is_rdwr; | |
| 2623 | 2631 | calldata->arg.fmode &= ~FMODE_WRITE; |
| 2624 | 2632 | } |
| 2625 | 2633 | } |
| @@ -116,7 +116,7 @@ __nfs_iocounter_wait(struct nfs_io_counter *c) · 115 unmodified lines | ||
| 116 | 116 | if (atomic_read(&c->io_count) == 0) |
| 117 | 117 | break; |
| 118 | 118 | ret = nfs_wait_bit_killable(&q.key); |
| 119 | − } while (atomic_read(&c->io_count) != 0); | |
| 119 | + } while (atomic_read(&c->io_count) != 0 && !ret); | |
| 120 | 120 | finish_wait(wq, &q.wait); |
| 121 | 121 | return ret; |
| 122 | 122 | } |
| @@ -139,26 +139,49 @@ nfs_iocounter_wait(struct nfs_io_counter *c) · 16 unmodified lines | ||
| 139 | 139 | /* |
| 140 | 140 | * nfs_page_group_lock - lock the head of the page group |
| 141 | 141 | * @req - request in group that is to be locked |
| 142 | + * @nonblock - if true don't block waiting for lock | |
| 142 | 143 | * |
| 143 | 144 | * this lock must be held if modifying the page group list |
| 144 | 145 | * |
| 145 | − * returns result from wait_on_bit_lock: 0 on success, < 0 on error | |
| 146 | + * return 0 on success, < 0 on error: -EDELAY if nonblocking or the | |
| 147 | + * result from wait_on_bit_lock | |
| 148 | + * | |
| 149 | + * NOTE: calling with nonblock=false should always have set the | |
| 150 | + * lock bit (see fs/buffer.c and other uses of wait_on_bit_lock | |
| 151 | + * with TASK_UNINTERRUPTIBLE), so there is no need to check the result. | |
| 146 | 152 | */ |
| 147 | 153 | int |
| 148 | −nfs_page_group_lock(struct nfs_page *req, bool wait) | |
| 154 | +nfs_page_group_lock(struct nfs_page *req, bool nonblock) | |
| 149 | 155 | { |
| 150 | 156 | struct nfs_page *head = req->wb_head; |
| 151 | − int ret; | |
| 152 | 157 | |
| 153 | 158 | WARN_ON_ONCE(head != head->wb_head); |
| 154 | 159 | |
| 155 | − do { | |
| 156 | − ret = wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK, | |
| 157 | − TASK_UNINTERRUPTIBLE); | |
| 158 | − } while (wait && ret != 0); | |
| 160 | + if (!test_and_set_bit(PG_HEADLOCK, &head->wb_flags)) | |
| 161 | + return 0; | |
| 159 | 162 | |
| 160 | − WARN_ON_ONCE(ret > 0); | |
| 161 | − return ret; | |
| 163 | + if (!nonblock) | |
| 164 | + return wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK, | |
| 165 | + TASK_UNINTERRUPTIBLE); | |
| 166 | + | |
| 167 | + return -EAGAIN; | |
| 168 | +} | |
| 169 | + | |
| 170 | +/* | |
| 171 | + * nfs_page_group_lock_wait - wait for the lock to clear, but don't grab it | |
| 172 | + * @req - a request in the group | |
| 173 | + * | |
| 174 | + * This is a blocking call to wait for the group lock to be cleared. | |
| 175 | + */ | |
| 176 | +void | |
| 177 | +nfs_page_group_lock_wait(struct nfs_page *req) | |
| 178 | +{ | |
| 179 | + struct nfs_page *head = req->wb_head; | |
| 180 | + | |
| 181 | + WARN_ON_ONCE(head != head->wb_head); | |
| 182 | + | |
| 183 | + wait_on_bit(&head->wb_flags, PG_HEADLOCK, | |
| 184 | + TASK_UNINTERRUPTIBLE); | |
| 162 | 185 | } |
| 163 | 186 | |
| 164 | 187 | /* |
| @@ -219,7 +242,7 @@ bool nfs_page_group_sync_on_bit(struct nfs_page *req, unsigned int bit) · 54 unmodified lines | ||
| 219 | 242 | { |
| 220 | 243 | bool ret; |
| 221 | 244 | |
| 222 | − nfs_page_group_lock(req, true); | |
| 245 | + nfs_page_group_lock(req, false); | |
| 223 | 246 | ret = nfs_page_group_sync_on_bit_locked(req, bit); |
| 224 | 247 | nfs_page_group_unlock(req); |
| 225 | 248 | |
| @@ -701,10 +724,11 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, · 475 unmodified lines | ||
| 701 | 724 | struct nfs_pgio_header *hdr) |
| 702 | 725 | { |
| 703 | 726 | struct nfs_page *req; |
| 704 | − struct page **pages; | |
| 727 | + struct page **pages, | |
| 728 | + *last_page; | |
| 705 | 729 | struct list_head *head = &desc->pg_list; |
| 706 | 730 | struct nfs_commit_info cinfo; |
| 707 | − unsigned int pagecount; | |
| 731 | + unsigned int pagecount, pageused; | |
| 708 | 732 | |
| 709 | 733 | pagecount = nfs_page_array_len(desc->pg_base, desc->pg_count); |
| 710 | 734 | if (!nfs_pgarray_set(&hdr->page_array, pagecount)) |
| @@ -712,12 +736,23 @@ int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, · 1 unmodified line | ||
| 712 | 736 | |
| 713 | 737 | nfs_init_cinfo(&cinfo, desc->pg_inode, desc->pg_dreq); |
| 714 | 738 | pages = hdr->page_array.pagevec; |
| 739 | + last_page = NULL; | |
| 740 | + pageused = 0; | |
| 715 | 741 | while (!list_empty(head)) { |
| 716 | 742 | req = nfs_list_entry(head->next); |
| 717 | 743 | nfs_list_remove_request(req); |
| 718 | 744 | nfs_list_add_request(req, &hdr->pages); |
| 719 | − *pages++ = req->wb_page; | |
| 745 | + | |
| 746 | + if (WARN_ON_ONCE(pageused >= pagecount)) | |
| 747 | + return nfs_pgio_error(desc, hdr); | |
| 748 | + | |
| 749 | + if (!last_page || last_page != req->wb_page) { | |
| 750 | + *pages++ = last_page = req->wb_page; | |
| 751 | + pageused++; | |
| 752 | + } | |
| 720 | 753 | } |
| 754 | + if (WARN_ON_ONCE(pageused != pagecount)) | |
| 755 | + return nfs_pgio_error(desc, hdr); | |
| 721 | 756 | |
| 722 | 757 | if ((desc->pg_ioflags & FLUSH_COND_STABLE) && |
| 723 | 758 | (desc->pg_moreio || nfs_reqs_to_commit(&cinfo))) |
| @@ -788,6 +823,14 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, · 64 unmodified lines | ||
| 788 | 823 | return false; |
| 789 | 824 | if (req_offset(req) != req_offset(prev) + prev->wb_bytes) |
| 790 | 825 | return false; |
| 826 | + if (req->wb_page == prev->wb_page) { | |
| 827 | + if (req->wb_pgbase != prev->wb_pgbase + prev->wb_bytes) | |
| 828 | + return false; | |
| 829 | + } else { | |
| 830 | + if (req->wb_pgbase != 0 || | |
| 831 | + prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE) | |
| 832 | + return false; | |
| 833 | + } | |
| 791 | 834 | } |
| 792 | 835 | size = pgio->pg_ops->pg_test(pgio, prev, req); |
| 793 | 836 | WARN_ON_ONCE(size > req->wb_bytes); |
| @@ -858,13 +901,8 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, · 64 unmodified lines | ||
| 858 | 901 | struct nfs_page *subreq; |
| 859 | 902 | unsigned int bytes_left = 0; |
| 860 | 903 | unsigned int offset, pgbase; |
| 861 | − int ret; | |
| 862 | 904 | |
| 863 | − ret = nfs_page_group_lock(req, false); | |
| 864 | − if (ret < 0) { | |
| 865 | − desc->pg_error = ret; | |
| 866 | − return 0; | |
| 867 | − } | |
| 905 | + nfs_page_group_lock(req, false); | |
| 868 | 906 | |
| 869 | 907 | subreq = req; |
| 870 | 908 | bytes_left = subreq->wb_bytes; |
| @@ -886,11 +924,7 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, · 15 unmodified lines | ||
| 886 | 924 | if (desc->pg_recoalesce) |
| 887 | 925 | return 0; |
| 888 | 926 | /* retry add_request for this subreq */ |
| 889 | − ret = nfs_page_group_lock(req, false); | |
| 890 | − if (ret < 0) { | |
| 891 | − desc->pg_error = ret; | |
| 892 | − return 0; | |
| 893 | − } | |
| 927 | + nfs_page_group_lock(req, false); | |
| 894 | 928 | continue; |
| 895 | 929 | } |
| 896 | 930 | |
| @@ -241,7 +241,7 @@ static bool nfs_page_group_covers_page(struct nfs_page *req) · 240 unmodified lines | ||
| 241 | 241 | unsigned int pos = 0; |
| 242 | 242 | unsigned int len = nfs_page_length(req->wb_page); |
| 243 | 243 | |
| 244 | − nfs_page_group_lock(req, true); | |
| 244 | + nfs_page_group_lock(req, false); | |
| 245 | 245 | |
| 246 | 246 | do { |
| 247 | 247 | tmp = nfs_page_group_search_locked(req->wb_head, pos); |
| @@ -478,10 +478,23 @@ try_again: · 230 unmodified lines | ||
| 478 | 478 | return NULL; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | − /* lock each request in the page group */ | |
| 482 | − ret = nfs_page_group_lock(head, false); | |
| 483 | − if (ret < 0) | |
| 481 | + /* holding inode lock, so always make a non-blocking call to try the | |
| 482 | + * page group lock */ | |
| 483 | + ret = nfs_page_group_lock(head, true); | |
| 484 | + if (ret < 0) { | |
| 485 | + spin_unlock(&inode->i_lock); | |
| 486 | + | |
| 487 | + if (!nonblock && ret == -EAGAIN) { | |
| 488 | + nfs_page_group_lock_wait(head); | |
| 489 | + nfs_release_request(head); | |
| 490 | + goto try_again; | |
| 491 | + } | |
| 492 | + | |
| 493 | + nfs_release_request(head); | |
| 484 | 494 | return ERR_PTR(ret); |
| 495 | + } | |
| 496 | + | |
| 497 | + /* lock each request in the page group */ | |
| 485 | 498 | subreq = head; |
| 486 | 499 | do { |
| 487 | 500 | /* |
| @@ -160,9 +160,18 @@ static void o2quo_make_decision(struct work_struct *work) · 159 unmodified lines | ||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | out: |
| 163 | − spin_unlock(&qs->qs_lock); | |
| 164 | − if (fence) | |
| 163 | + if (fence) { | |
| 164 | + spin_unlock(&qs->qs_lock); | |
| 165 | 165 | o2quo_fence_self(); |
| 166 | + } else { | |
| 167 | + mlog(ML_NOTICE, "not fencing this node, heartbeating: %d, " | |
| 168 | + "connected: %d, lowest: %d (%sreachable)\n", | |
| 169 | + qs->qs_heartbeating, qs->qs_connected, lowest_hb, | |
| 170 | + lowest_reachable ? "" : "un"); | |
| 171 | + spin_unlock(&qs->qs_lock); | |
| 172 | + | |
| 173 | + } | |
| 174 | + | |
| 166 | 175 | } |
| 167 | 176 | |
| 168 | 177 | static void o2quo_set_hold(struct o2quo_state *qs, u8 node) |
| @@ -1480,6 +1480,14 @@ static int o2net_set_nodelay(struct socket *sock) · 1479 unmodified lines | ||
| 1480 | 1480 | return ret; |
| 1481 | 1481 | } |
| 1482 | 1482 | |
| 1483 | +static int o2net_set_usertimeout(struct socket *sock) | |
| 1484 | +{ | |
| 1485 | + int user_timeout = O2NET_TCP_USER_TIMEOUT; | |
| 1486 | + | |
| 1487 | + return kernel_setsockopt(sock, SOL_TCP, TCP_USER_TIMEOUT, | |
| 1488 | + (char *)&user_timeout, sizeof(user_timeout)); | |
| 1489 | +} | |
| 1490 | + | |
| 1483 | 1491 | static void o2net_initialize_handshake(void) |
| 1484 | 1492 | { |
| 1485 | 1493 | o2net_hand->o2hb_heartbeat_timeout_ms = cpu_to_be32( |
| @@ -1536,16 +1544,20 @@ static void o2net_idle_timer(unsigned long data) · 50 unmodified lines | ||
| 1536 | 1544 | #endif |
| 1537 | 1545 | |
| 1538 | 1546 | printk(KERN_NOTICE "o2net: Connection to " SC_NODEF_FMT " has been " |
| 1539 | − "idle for %lu.%lu secs, shutting it down.\n", SC_NODEF_ARGS(sc), | |
| 1540 | − msecs / 1000, msecs % 1000); | |
| 1547 | + "idle for %lu.%lu secs.\n", | |
| 1548 | + SC_NODEF_ARGS(sc), msecs / 1000, msecs % 1000); | |
| 1541 | 1549 | |
| 1542 | − /* | |
| 1543 | − * Initialize the nn_timeout so that the next connection attempt | |
| 1544 | − * will continue in o2net_start_connect. | |
| 1550 | + /* idle timerout happen, don't shutdown the connection, but | |
| 1551 | + * make fence decision. Maybe the connection can recover before | |
| 1552 | + * the decision is made. | |
| 1545 | 1553 | */ |
| 1546 | 1554 | atomic_set(&nn->nn_timeout, 1); |
| 1555 | + o2quo_conn_err(o2net_num_from_nn(nn)); | |
| 1556 | + queue_delayed_work(o2net_wq, &nn->nn_still_up, | |
| 1557 | + msecs_to_jiffies(O2NET_QUORUM_DELAY_MS)); | |
| 1558 | + | |
| 1559 | + o2net_sc_reset_idle_timer(sc); | |
| 1547 | 1560 | |
| 1548 | − o2net_sc_queue_work(sc, &sc->sc_shutdown_work); | |
| 1549 | 1561 | } |
| 1550 | 1562 | |
| 1551 | 1563 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) |
| @@ -1560,6 +1572,15 @@ static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) · 8 unmodified lines | ||
| 1560 | 1572 | |
| 1561 | 1573 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) |
| 1562 | 1574 | { |
| 1575 | + struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); | |
| 1576 | + | |
| 1577 | + /* clear fence decision since the connection recover from timeout*/ | |
| 1578 | + if (atomic_read(&nn->nn_timeout)) { | |
| 1579 | + o2quo_conn_up(o2net_num_from_nn(nn)); | |
| 1580 | + cancel_delayed_work(&nn->nn_still_up); | |
| 1581 | + atomic_set(&nn->nn_timeout, 0); | |
| 1582 | + } | |
| 1583 | + | |
| 1563 | 1584 | /* Only push out an existing timer */ |
| 1564 | 1585 | if (timer_pending(&sc->sc_idle_timeout)) |
| 1565 | 1586 | o2net_sc_reset_idle_timer(sc); |
| @@ -1650,6 +1671,12 @@ static void o2net_start_connect(struct work_struct *work) · 84 unmodified lines | ||
| 1650 | 1671 | goto out; |
| 1651 | 1672 | } |
| 1652 | 1673 | |
| 1674 | + ret = o2net_set_usertimeout(sock); | |
| 1675 | + if (ret) { | |
| 1676 | + mlog(ML_ERROR, "set TCP_USER_TIMEOUT failed with %d\n", ret); | |
| 1677 | + goto out; | |
| 1678 | + } | |
| 1679 | + | |
| 1653 | 1680 | o2net_register_callbacks(sc->sc_sock->sk, sc); |
| 1654 | 1681 | |
| 1655 | 1682 | spin_lock(&nn->nn_lock); |
| @@ -1831,6 +1858,12 @@ static int o2net_accept_one(struct socket *sock, int *more) · 175 unmodified lines | ||
| 1831 | 1858 | goto out; |
| 1832 | 1859 | } |
| 1833 | 1860 | |
| 1861 | + ret = o2net_set_usertimeout(new_sock); | |
| 1862 | + if (ret) { | |
| 1863 | + mlog(ML_ERROR, "set TCP_USER_TIMEOUT failed with %d\n", ret); | |
| 1864 | + goto out; | |
| 1865 | + } | |
| 1866 | + | |
| 1834 | 1867 | slen = sizeof(sin); |
| 1835 | 1868 | ret = new_sock->ops->getname(new_sock, (struct sockaddr *) &sin, |
| 1836 | 1869 | &slen, 1); |
| @@ -63,6 +63,7 @@ typedef void (o2net_post_msg_handler_func)(int status, void *data, · 62 unmodified lines | ||
| 63 | 63 | #define O2NET_KEEPALIVE_DELAY_MS_DEFAULT 2000 |
| 64 | 64 | #define O2NET_IDLE_TIMEOUT_MS_DEFAULT 30000 |
| 65 | 65 | |
| 66 | +#define O2NET_TCP_USER_TIMEOUT 0x7fffffff | |
| 66 | 67 | |
| 67 | 68 | /* TODO: figure this out.... */ |
| 68 | 69 | static inline int o2net_link_down(int err, struct socket *sock) |
| @@ -35,9 +35,8 @@ · 34 unmodified lines | ||
| 35 | 35 | copy_to_user((typeof(a) __user *)b, &(a), sizeof(a)) |
| 36 | 36 | |
| 37 | 37 | /* |
| 38 | − * This call is void because we are already reporting an error that may | |
| 39 | − * be -EFAULT. The error will be returned from the ioctl(2) call. It's | |
| 40 | − * just a best-effort to tell userspace that this request caused the error. | |
| 38 | + * This is just a best-effort to tell userspace that this request | |
| 39 | + * caused the error. | |
| 41 | 40 | */ |
| 42 | 41 | static inline void o2info_set_request_error(struct ocfs2_info_request *kreq, |
| 43 | 42 | struct ocfs2_info_request __user *req) |
| @@ -146,136 +145,105 @@ bail: · 102 unmodified lines | ||
| 146 | 145 | static int ocfs2_info_handle_blocksize(struct inode *inode, |
| 147 | 146 | struct ocfs2_info_request __user *req) |
| 148 | 147 | { |
| 149 | − int status = -EFAULT; | |
| 150 | 148 | struct ocfs2_info_blocksize oib; |
| 151 | 149 | |
| 152 | 150 | if (o2info_from_user(oib, req)) |
| 153 | − goto bail; | |
| 151 | + return -EFAULT; | |
| 154 | 152 | |
| 155 | 153 | oib.ib_blocksize = inode->i_sb->s_blocksize; |
| 156 | 154 | |
| 157 | 155 | o2info_set_request_filled(&oib.ib_req); |
| 158 | 156 | |
| 159 | 157 | if (o2info_to_user(oib, req)) |
| 160 | − goto bail; | |
| 161 | − | |
| 162 | − status = 0; | |
| 163 | −bail: | |
| 164 | − if (status) | |
| 165 | − o2info_set_request_error(&oib.ib_req, req); | |
| 158 | + return -EFAULT; | |
| 166 | 159 | |
| 167 | − return status; | |
| 160 | + return 0; | |
| 168 | 161 | } |
| 169 | 162 | |
| 170 | 163 | static int ocfs2_info_handle_clustersize(struct inode *inode, |
| 171 | 164 | struct ocfs2_info_request __user *req) |
| 172 | 165 | { |
| 173 | − int status = -EFAULT; | |
| 174 | 166 | struct ocfs2_info_clustersize oic; |
| 175 | 167 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 176 | 168 | |
| 177 | 169 | if (o2info_from_user(oic, req)) |
| 178 | − goto bail; | |
| 170 | + return -EFAULT; | |
| 179 | 171 | |
| 180 | 172 | oic.ic_clustersize = osb->s_clustersize; |
| 181 | 173 | |
| 182 | 174 | o2info_set_request_filled(&oic.ic_req); |
| 183 | 175 | |
| 184 | 176 | if (o2info_to_user(oic, req)) |
| 185 | − goto bail; | |
| 186 | − | |
| 187 | − status = 0; | |
| 188 | −bail: | |
| 189 | − if (status) | |
| 190 | − o2info_set_request_error(&oic.ic_req, req); | |
| 177 | + return -EFAULT; | |
| 191 | 178 | |
| 192 | − return status; | |
| 179 | + return 0; | |
| 193 | 180 | } |
| 194 | 181 | |
| 195 | 182 | static int ocfs2_info_handle_maxslots(struct inode *inode, |
| 196 | 183 | struct ocfs2_info_request __user *req) |
| 197 | 184 | { |
| 198 | − int status = -EFAULT; | |
| 199 | 185 | struct ocfs2_info_maxslots oim; |
| 200 | 186 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 201 | 187 | |
| 202 | 188 | if (o2info_from_user(oim, req)) |
| 203 | − goto bail; | |
| 189 | + return -EFAULT; | |
| 204 | 190 | |
| 205 | 191 | oim.im_max_slots = osb->max_slots; |
| 206 | 192 | |
| 207 | 193 | o2info_set_request_filled(&oim.im_req); |
| 208 | 194 | |
| 209 | 195 | if (o2info_to_user(oim, req)) |
| 210 | − goto bail; | |
| 196 | + return -EFAULT; | |
| 211 | 197 | |
| 212 | − status = 0; | |
| 213 | −bail: | |
| 214 | − if (status) | |
| 215 | − o2info_set_request_error(&oim.im_req, req); | |
| 216 | − | |
| 217 | − return status; | |
| 198 | + return 0; | |
| 218 | 199 | } |
| 219 | 200 | |
| 220 | 201 | static int ocfs2_info_handle_label(struct inode *inode, |
| 221 | 202 | struct ocfs2_info_request __user *req) |
| 222 | 203 | { |
| 223 | − int status = -EFAULT; | |
| 224 | 204 | struct ocfs2_info_label oil; |
| 225 | 205 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 226 | 206 | |
| 227 | 207 | if (o2info_from_user(oil, req)) |
| 228 | − goto bail; | |
| 208 | + return -EFAULT; | |
| 229 | 209 | |
| 230 | 210 | memcpy(oil.il_label, osb->vol_label, OCFS2_MAX_VOL_LABEL_LEN); |
| 231 | 211 | |
| 232 | 212 | o2info_set_request_filled(&oil.il_req); |
| 233 | 213 | |
| 234 | 214 | if (o2info_to_user(oil, req)) |
| 235 | − goto bail; | |
| 215 | + return -EFAULT; | |
| 236 | 216 | |
| 237 | − status = 0; | |
| 238 | −bail: | |
| 239 | − if (status) | |
| 240 | − o2info_set_request_error(&oil.il_req, req); | |
| 241 | − | |
| 242 | − return status; | |
| 217 | + return 0; | |
| 243 | 218 | } |
| 244 | 219 | |
| 245 | 220 | static int ocfs2_info_handle_uuid(struct inode *inode, |
| 246 | 221 | struct ocfs2_info_request __user *req) |
| 247 | 222 | { |
| 248 | − int status = -EFAULT; | |
| 249 | 223 | struct ocfs2_info_uuid oiu; |
| 250 | 224 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 251 | 225 | |
| 252 | 226 | if (o2info_from_user(oiu, req)) |
| 253 | − goto bail; | |
| 227 | + return -EFAULT; | |
| 254 | 228 | |
| 255 | 229 | memcpy(oiu.iu_uuid_str, osb->uuid_str, OCFS2_TEXT_UUID_LEN + 1); |
| 256 | 230 | |
| 257 | 231 | o2info_set_request_filled(&oiu.iu_req); |
| 258 | 232 | |
| 259 | 233 | if (o2info_to_user(oiu, req)) |
| 260 | − goto bail; | |
| 261 | − | |
| 262 | − status = 0; | |
| 263 | −bail: | |
| 264 | − if (status) | |
| 265 | − o2info_set_request_error(&oiu.iu_req, req); | |
| 234 | + return -EFAULT; | |
| 266 | 235 | |
| 267 | − return status; | |
| 236 | + return 0; | |
| 268 | 237 | } |
| 269 | 238 | |
| 270 | 239 | static int ocfs2_info_handle_fs_features(struct inode *inode, |
| 271 | 240 | struct ocfs2_info_request __user *req) |
| 272 | 241 | { |
| 273 | − int status = -EFAULT; | |
| 274 | 242 | struct ocfs2_info_fs_features oif; |
| 275 | 243 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 276 | 244 | |
| 277 | 245 | if (o2info_from_user(oif, req)) |
| 278 | − goto bail; | |
| 246 | + return -EFAULT; | |
| 279 | 247 | |
| 280 | 248 | oif.if_compat_features = osb->s_feature_compat; |
| 281 | 249 | oif.if_incompat_features = osb->s_feature_incompat; |
| @@ -284,39 +252,28 @@ static int ocfs2_info_handle_fs_features(struct inode *inode, · 2 unmodified lines | ||
| 284 | 252 | o2info_set_request_filled(&oif.if_req); |
| 285 | 253 | |
| 286 | 254 | if (o2info_to_user(oif, req)) |
| 287 | − goto bail; | |
| 255 | + return -EFAULT; | |
| 288 | 256 | |
| 289 | − status = 0; | |
| 290 | −bail: | |
| 291 | − if (status) | |
| 292 | − o2info_set_request_error(&oif.if_req, req); | |
| 293 | − | |
| 294 | − return status; | |
| 257 | + return 0; | |
| 295 | 258 | } |
| 296 | 259 | |
| 297 | 260 | static int ocfs2_info_handle_journal_size(struct inode *inode, |
| 298 | 261 | struct ocfs2_info_request __user *req) |
| 299 | 262 | { |
| 300 | − int status = -EFAULT; | |
| 301 | 263 | struct ocfs2_info_journal_size oij; |
| 302 | 264 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 303 | 265 | |
| 304 | 266 | if (o2info_from_user(oij, req)) |
| 305 | − goto bail; | |
| 267 | + return -EFAULT; | |
| 306 | 268 | |
| 307 | 269 | oij.ij_journal_size = i_size_read(osb->journal->j_inode); |
| 308 | 270 | |
| 309 | 271 | o2info_set_request_filled(&oij.ij_req); |
| 310 | 272 | |
| 311 | 273 | if (o2info_to_user(oij, req)) |
| 312 | − goto bail; | |
| 274 | + return -EFAULT; | |
| 313 | 275 | |
| 314 | − status = 0; | |
| 315 | −bail: | |
| 316 | − if (status) | |
| 317 | − o2info_set_request_error(&oij.ij_req, req); | |
| 318 | − | |
| 319 | − return status; | |
| 276 | + return 0; | |
| 320 | 277 | } |
| 321 | 278 | |
| 322 | 279 | static int ocfs2_info_scan_inode_alloc(struct ocfs2_super *osb, |
| @@ -373,7 +330,7 @@ static int ocfs2_info_handle_freeinode(struct inode *inode, · 50 unmodified lines | ||
| 373 | 330 | u32 i; |
| 374 | 331 | u64 blkno = -1; |
| 375 | 332 | char namebuf[40]; |
| 376 | − int status = -EFAULT, type = INODE_ALLOC_SYSTEM_INODE; | |
| 333 | + int status, type = INODE_ALLOC_SYSTEM_INODE; | |
| 377 | 334 | struct ocfs2_info_freeinode *oifi = NULL; |
| 378 | 335 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 379 | 336 | struct inode *inode_alloc = NULL; |
| @@ -385,8 +342,10 @@ static int ocfs2_info_handle_freeinode(struct inode *inode, · 5 unmodified lines | ||
| 385 | 342 | goto out_err; |
| 386 | 343 | } |
| 387 | 344 | |
| 388 | − if (o2info_from_user(*oifi, req)) | |
| 389 | − goto bail; | |
| 345 | + if (o2info_from_user(*oifi, req)) { | |
| 346 | + status = -EFAULT; | |
| 347 | + goto out_free; | |
| 348 | + } | |
| 390 | 349 | |
| 391 | 350 | oifi->ifi_slotnum = osb->max_slots; |
| 392 | 351 | |
| @@ -424,14 +383,16 @@ static int ocfs2_info_handle_freeinode(struct inode *inode, · 31 unmodified lines | ||
| 424 | 383 | |
| 425 | 384 | o2info_set_request_filled(&oifi->ifi_req); |
| 426 | 385 | |
| 427 | − if (o2info_to_user(*oifi, req)) | |
| 428 | − goto bail; | |
| 386 | + if (o2info_to_user(*oifi, req)) { | |
| 387 | + status = -EFAULT; | |
| 388 | + goto out_free; | |
| 389 | + } | |
| 429 | 390 | |
| 430 | 391 | status = 0; |
| 431 | 392 | bail: |
| 432 | 393 | if (status) |
| 433 | 394 | o2info_set_request_error(&oifi->ifi_req, req); |
| 434 | − | |
| 395 | +out_free: | |
| 435 | 396 | kfree(oifi); |
| 436 | 397 | out_err: |
| 437 | 398 | return status; |
| @@ -658,7 +619,7 @@ static int ocfs2_info_handle_freefrag(struct inode *inode, · 220 unmodified lines | ||
| 658 | 619 | { |
| 659 | 620 | u64 blkno = -1; |
| 660 | 621 | char namebuf[40]; |
| 661 | − int status = -EFAULT, type = GLOBAL_BITMAP_SYSTEM_INODE; | |
| 622 | + int status, type = GLOBAL_BITMAP_SYSTEM_INODE; | |
| 662 | 623 | |
| 663 | 624 | struct ocfs2_info_freefrag *oiff; |
| 664 | 625 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| @@ -671,8 +632,10 @@ static int ocfs2_info_handle_freefrag(struct inode *inode, · 6 unmodified lines | ||
| 671 | 632 | goto out_err; |
| 672 | 633 | } |
| 673 | 634 | |
| 674 | − if (o2info_from_user(*oiff, req)) | |
| 675 | − goto bail; | |
| 635 | + if (o2info_from_user(*oiff, req)) { | |
| 636 | + status = -EFAULT; | |
| 637 | + goto out_free; | |
| 638 | + } | |
| 676 | 639 | /* |
| 677 | 640 | * chunksize from userspace should be power of 2. |
| 678 | 641 | */ |
| @@ -711,14 +674,14 @@ static int ocfs2_info_handle_freefrag(struct inode *inode, · 32 unmodified lines | ||
| 711 | 674 | |
| 712 | 675 | if (o2info_to_user(*oiff, req)) { |
| 713 | 676 | status = -EFAULT; |
| 714 | − goto bail; | |
| 677 | + goto out_free; | |
| 715 | 678 | } |
| 716 | 679 | |
| 717 | 680 | status = 0; |
| 718 | 681 | bail: |
| 719 | 682 | if (status) |
| 720 | 683 | o2info_set_request_error(&oiff->iff_req, req); |
| 721 | − | |
| 684 | +out_free: | |
| 722 | 685 | kfree(oiff); |
| 723 | 686 | out_err: |
| 724 | 687 | return status; |
| @@ -727,23 +690,17 @@ out_err: · 2 unmodified lines | ||
| 727 | 690 | static int ocfs2_info_handle_unknown(struct inode *inode, |
| 728 | 691 | struct ocfs2_info_request __user *req) |
| 729 | 692 | { |
| 730 | − int status = -EFAULT; | |
| 731 | 693 | struct ocfs2_info_request oir; |
| 732 | 694 | |
| 733 | 695 | if (o2info_from_user(oir, req)) |
| 734 | − goto bail; | |
| 696 | + return -EFAULT; | |
| 735 | 697 | |
| 736 | 698 | o2info_clear_request_filled(&oir); |
| 737 | 699 | |
| 738 | 700 | if (o2info_to_user(oir, req)) |
| 739 | − goto bail; | |
| 701 | + return -EFAULT; | |
| 740 | 702 | |
| 741 | − status = 0; | |
| 742 | −bail: | |
| 743 | − if (status) | |
| 744 | − o2info_set_request_error(&oir, req); | |
| 745 | − | |
| 746 | − return status; | |
| 703 | + return 0; | |
| 747 | 704 | } |
| 748 | 705 | |
| 749 | 706 | /* |
| @@ -381,6 +381,7 @@ static void __propagate_umount(struct mount *mnt) · 380 unmodified lines | ||
| 381 | 381 | * other children |
| 382 | 382 | */ |
| 383 | 383 | if (child && list_empty(&child->mnt_mounts)) { |
| 384 | + list_del_init(&child->mnt_child); | |
| 384 | 385 | hlist_del_init_rcu(&child->mnt_hash); |
| 385 | 386 | hlist_add_before_rcu(&child->mnt_hash, &mnt->mnt_hash); |
| 386 | 387 | } |
| @@ -65,7 +65,7 @@ int sync_filesystem(struct super_block *sb) · 64 unmodified lines | ||
| 65 | 65 | return ret; |
| 66 | 66 | return __sync_filesystem(sb, 1); |
| 67 | 67 | } |
| 68 | −EXPORT_SYMBOL_GPL(sync_filesystem); | |
| 68 | +EXPORT_SYMBOL(sync_filesystem); | |
| 69 | 69 | |
| 70 | 70 | static void sync_inodes_one_sb(struct super_block *sb, void *arg) |
| 71 | 71 | { |
| @@ -902,9 +902,6 @@ void ufs_evict_inode(struct inode * inode) · 901 unmodified lines | ||
| 902 | 902 | invalidate_inode_buffers(inode); |
| 903 | 903 | clear_inode(inode); |
| 904 | 904 | |
| 905 | − if (want_delete) { | |
| 906 | − lock_ufs(inode->i_sb); | |
| 907 | − ufs_free_inode (inode); | |
| 908 | − unlock_ufs(inode->i_sb); | |
| 909 | − } | |
| 905 | + if (want_delete) | |
| 906 | + ufs_free_inode(inode); | |
| 910 | 907 | } |
| @@ -126,12 +126,12 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry, · 125 unmodified lines | ||
| 126 | 126 | if (l > sb->s_blocksize) |
| 127 | 127 | goto out_notlocked; |
| 128 | 128 | |
| 129 | − lock_ufs(dir->i_sb); | |
| 130 | 129 | inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); |
| 131 | 130 | err = PTR_ERR(inode); |
| 132 | 131 | if (IS_ERR(inode)) |
| 133 | − goto out; | |
| 132 | + goto out_notlocked; | |
| 134 | 133 | |
| 134 | + lock_ufs(dir->i_sb); | |
| 135 | 135 | if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) { |
| 136 | 136 | /* slow symlink */ |
| 137 | 137 | inode->i_op = &ufs_symlink_inode_operations; |
| @@ -181,13 +181,9 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) · 43 unmodified lines | ||
| 181 | 181 | struct inode * inode; |
| 182 | 182 | int err; |
| 183 | 183 | |
| 184 | − lock_ufs(dir->i_sb); | |
| 185 | − inode_inc_link_count(dir); | |
| 186 | − | |
| 187 | 184 | inode = ufs_new_inode(dir, S_IFDIR|mode); |
| 188 | − err = PTR_ERR(inode); | |
| 189 | 185 | if (IS_ERR(inode)) |
| 190 | − goto out_dir; | |
| 186 | + return PTR_ERR(inode); | |
| 191 | 187 | |
| 192 | 188 | inode->i_op = &ufs_dir_inode_operations; |
| 193 | 189 | inode->i_fop = &ufs_dir_operations; |
| @@ -195,6 +191,9 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) · 1 unmodified line | ||
| 195 | 191 | |
| 196 | 192 | inode_inc_link_count(inode); |
| 197 | 193 | |
| 194 | + lock_ufs(dir->i_sb); | |
| 195 | + inode_inc_link_count(dir); | |
| 196 | + | |
| 198 | 197 | err = ufs_make_empty(inode, dir); |
| 199 | 198 | if (err) |
| 200 | 199 | goto out_fail; |
| @@ -212,7 +211,6 @@ out_fail: · 11 unmodified lines | ||
| 212 | 211 | inode_dec_link_count(inode); |
| 213 | 212 | inode_dec_link_count(inode); |
| 214 | 213 | iput (inode); |
| 215 | −out_dir: | |
| 216 | 214 | inode_dec_link_count(dir); |
| 217 | 215 | unlock_ufs(dir->i_sb); |
| 218 | 216 | goto out; |
| @@ -5424,7 +5424,7 @@ xfs_bmap_shift_extents( · 5423 unmodified lines | ||
| 5424 | 5424 | struct xfs_bmap_free *flist, |
| 5425 | 5425 | int num_exts) |
| 5426 | 5426 | { |
| 5427 | − struct xfs_btree_cur *cur; | |
| 5427 | + struct xfs_btree_cur *cur = NULL; | |
| 5428 | 5428 | struct xfs_bmbt_rec_host *gotp; |
| 5429 | 5429 | struct xfs_bmbt_irec got; |
| 5430 | 5430 | struct xfs_bmbt_irec left; |
| @@ -5435,7 +5435,7 @@ xfs_bmap_shift_extents( · 4 unmodified lines | ||
| 5435 | 5435 | int error = 0; |
| 5436 | 5436 | int i; |
| 5437 | 5437 | int whichfork = XFS_DATA_FORK; |
| 5438 | − int logflags; | |
| 5438 | + int logflags = 0; | |
| 5439 | 5439 | xfs_filblks_t blockcount = 0; |
| 5440 | 5440 | int total_extents; |
| 5441 | 5441 | |
| @@ -5478,16 +5478,11 @@ xfs_bmap_shift_extents( · 36 unmodified lines | ||
| 5478 | 5478 | } |
| 5479 | 5479 | } |
| 5480 | 5480 | |
| 5481 | − /* We are going to change core inode */ | |
| 5482 | − logflags = XFS_ILOG_CORE; | |
| 5483 | 5481 | if (ifp->if_flags & XFS_IFBROOT) { |
| 5484 | 5482 | cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork); |
| 5485 | 5483 | cur->bc_private.b.firstblock = *firstblock; |
| 5486 | 5484 | cur->bc_private.b.flist = flist; |
| 5487 | 5485 | cur->bc_private.b.flags = 0; |
| 5488 | − } else { | |
| 5489 | − cur = NULL; | |
| 5490 | − logflags |= XFS_ILOG_DEXT; | |
| 5491 | 5486 | } |
| 5492 | 5487 | |
| 5493 | 5488 | /* |
| @@ -5545,11 +5540,14 @@ xfs_bmap_shift_extents( · 51 unmodified lines | ||
| 5545 | 5540 | blockcount = left.br_blockcount + |
| 5546 | 5541 | got.br_blockcount; |
| 5547 | 5542 | xfs_iext_remove(ip, *current_ext, 1, 0); |
| 5543 | + logflags |= XFS_ILOG_CORE; | |
| 5548 | 5544 | if (cur) { |
| 5549 | 5545 | error = xfs_btree_delete(cur, &i); |
| 5550 | 5546 | if (error) |
| 5551 | 5547 | goto del_cursor; |
| 5552 | 5548 | XFS_WANT_CORRUPTED_GOTO(i == 1, del_cursor); |
| 5549 | + } else { | |
| 5550 | + logflags |= XFS_ILOG_DEXT; | |
| 5553 | 5551 | } |
| 5554 | 5552 | XFS_IFORK_NEXT_SET(ip, whichfork, |
| 5555 | 5553 | XFS_IFORK_NEXTENTS(ip, whichfork) - 1); |
| @@ -5575,6 +5573,7 @@ xfs_bmap_shift_extents( · 19 unmodified lines | ||
| 5575 | 5573 | got.br_startoff = startoff; |
| 5576 | 5574 | } |
| 5577 | 5575 | |
| 5576 | + logflags |= XFS_ILOG_CORE; | |
| 5578 | 5577 | if (cur) { |
| 5579 | 5578 | error = xfs_bmbt_update(cur, got.br_startoff, |
| 5580 | 5579 | got.br_startblock, |
| @@ -5582,6 +5581,8 @@ xfs_bmap_shift_extents( · 1 unmodified line | ||
| 5582 | 5581 | got.br_state); |
| 5583 | 5582 | if (error) |
| 5584 | 5583 | goto del_cursor; |
| 5584 | + } else { | |
| 5585 | + logflags |= XFS_ILOG_DEXT; | |
| 5585 | 5586 | } |
| 5586 | 5587 | |
| 5587 | 5588 | (*current_ext)++; |
| @@ -5597,6 +5598,7 @@ del_cursor: · 9 unmodified lines | ||
| 5597 | 5598 | xfs_btree_del_cursor(cur, |
| 5598 | 5599 | error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); |
| 5599 | 5600 | |
| 5600 | − xfs_trans_log_inode(tp, ip, logflags); | |
| 5601 | + if (logflags) | |
| 5602 | + xfs_trans_log_inode(tp, ip, logflags); | |
| 5601 | 5603 | return error; |
| 5602 | 5604 | } |
| @@ -1753,11 +1753,72 @@ xfs_vm_readpages( · 1752 unmodified lines | ||
| 1753 | 1753 | return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks); |
| 1754 | 1754 | } |
| 1755 | 1755 | |
| 1756 | +/* | |
| 1757 | + * This is basically a copy of __set_page_dirty_buffers() with one | |
| 1758 | + * small tweak: buffers beyond EOF do not get marked dirty. If we mark them | |
| 1759 | + * dirty, we'll never be able to clean them because we don't write buffers | |
| 1760 | + * beyond EOF, and that means we can't invalidate pages that span EOF | |
| 1761 | + * that have been marked dirty. Further, the dirty state can leak into | |
| 1762 | + * the file interior if the file is extended, resulting in all sorts of | |
| 1763 | + * bad things happening as the state does not match the underlying data. | |
| 1764 | + * | |
| 1765 | + * XXX: this really indicates that bufferheads in XFS need to die. Warts like | |
| 1766 | + * this only exist because of bufferheads and how the generic code manages them. | |
| 1767 | + */ | |
| 1768 | +STATIC int | |
| 1769 | +xfs_vm_set_page_dirty( | |
| 1770 | + struct page *page) | |
| 1771 | +{ | |
| 1772 | + struct address_space *mapping = page->mapping; | |
| 1773 | + struct inode *inode = mapping->host; | |
| 1774 | + loff_t end_offset; | |
| 1775 | + loff_t offset; | |
| 1776 | + int newly_dirty; | |
| 1777 | + | |
| 1778 | + if (unlikely(!mapping)) | |
| 1779 | + return !TestSetPageDirty(page); | |
| 1780 | + | |
| 1781 | + end_offset = i_size_read(inode); | |
| 1782 | + offset = page_offset(page); | |
| 1783 | + | |
| 1784 | + spin_lock(&mapping->private_lock); | |
| 1785 | + if (page_has_buffers(page)) { | |
| 1786 | + struct buffer_head *head = page_buffers(page); | |
| 1787 | + struct buffer_head *bh = head; | |
| 1788 | + | |
| 1789 | + do { | |
| 1790 | + if (offset < end_offset) | |
| 1791 | + set_buffer_dirty(bh); | |
| 1792 | + bh = bh->b_this_page; | |
| 1793 | + offset += 1 << inode->i_blkbits; | |
| 1794 | + } while (bh != head); | |
| 1795 | + } | |
| 1796 | + newly_dirty = !TestSetPageDirty(page); | |
| 1797 | + spin_unlock(&mapping->private_lock); | |
| 1798 | + | |
| 1799 | + if (newly_dirty) { | |
| 1800 | + /* sigh - __set_page_dirty() is static, so copy it here, too */ | |
| 1801 | + unsigned long flags; | |
| 1802 | + | |
| 1803 | + spin_lock_irqsave(&mapping->tree_lock, flags); | |
| 1804 | + if (page->mapping) { /* Race with truncate? */ | |
| 1805 | + WARN_ON_ONCE(!PageUptodate(page)); | |
| 1806 | + account_page_dirtied(page, mapping); | |
| 1807 | + radix_tree_tag_set(&mapping->page_tree, | |
| 1808 | + page_index(page), PAGECACHE_TAG_DIRTY); | |
| 1809 | + } | |
| 1810 | + spin_unlock_irqrestore(&mapping->tree_lock, flags); | |
| 1811 | + __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | |
| 1812 | + } | |
| 1813 | + return newly_dirty; | |
| 1814 | +} | |
| 1815 | + | |
| 1756 | 1816 | const struct address_space_operations xfs_address_space_operations = { |
| 1757 | 1817 | .readpage = xfs_vm_readpage, |
| 1758 | 1818 | .readpages = xfs_vm_readpages, |
| 1759 | 1819 | .writepage = xfs_vm_writepage, |
| 1760 | 1820 | .writepages = xfs_vm_writepages, |
| 1821 | + .set_page_dirty = xfs_vm_set_page_dirty, | |
| 1761 | 1822 | .releasepage = xfs_vm_releasepage, |
| 1762 | 1823 | .invalidatepage = xfs_vm_invalidatepage, |
| 1763 | 1824 | .write_begin = xfs_vm_write_begin, |
| @@ -1470,6 +1470,26 @@ xfs_collapse_file_space( · 1469 unmodified lines | ||
| 1470 | 1470 | start_fsb = XFS_B_TO_FSB(mp, offset + len); |
| 1471 | 1471 | shift_fsb = XFS_B_TO_FSB(mp, len); |
| 1472 | 1472 | |
| 1473 | + /* | |
| 1474 | + * Writeback the entire file and force remove any post-eof blocks. The | |
| 1475 | + * writeback prevents changes to the extent list via concurrent | |
| 1476 | + * writeback and the eofblocks trim prevents the extent shift algorithm | |
| 1477 | + * from running into a post-eof delalloc extent. | |
| 1478 | + * | |
| 1479 | + * XXX: This is a temporary fix until the extent shift loop below is | |
| 1480 | + * converted to use offsets and lookups within the ILOCK rather than | |
| 1481 | + * carrying around the index into the extent list for the next | |
| 1482 | + * iteration. | |
| 1483 | + */ | |
| 1484 | + error = filemap_write_and_wait(VFS_I(ip)->i_mapping); | |
| 1485 | + if (error) | |
| 1486 | + return error; | |
| 1487 | + if (xfs_can_free_eofblocks(ip, true)) { | |
| 1488 | + error = xfs_free_eofblocks(mp, ip, false); | |
| 1489 | + if (error) | |
| 1490 | + return error; | |
| 1491 | + } | |
| 1492 | + | |
| 1473 | 1493 | error = xfs_free_file_space(ip, offset, len); |
| 1474 | 1494 | if (error) |
| 1475 | 1495 | return error; |
| @@ -291,12 +291,22 @@ xfs_file_read_iter( · 290 unmodified lines | ||
| 291 | 291 | if (inode->i_mapping->nrpages) { |
| 292 | 292 | ret = filemap_write_and_wait_range( |
| 293 | 293 | VFS_I(ip)->i_mapping, |
| 294 | − pos, -1); | |
| 294 | + pos, pos + size - 1); | |
| 295 | 295 | if (ret) { |
| 296 | 296 | xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL); |
| 297 | 297 | return ret; |
| 298 | 298 | } |
| 299 | − truncate_pagecache_range(VFS_I(ip), pos, -1); | |
| 299 | + | |
| 300 | + /* | |
| 301 | + * Invalidate whole pages. This can return an error if | |
| 302 | + * we fail to invalidate a page, but this should never | |
| 303 | + * happen on XFS. Warn if it does fail. | |
| 304 | + */ | |
| 305 | + ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, | |
| 306 | + pos >> PAGE_CACHE_SHIFT, | |
| 307 | + (pos + size - 1) >> PAGE_CACHE_SHIFT); | |
| 308 | + WARN_ON_ONCE(ret); | |
| 309 | + ret = 0; | |
| 300 | 310 | } |
| 301 | 311 | xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL); |
| 302 | 312 | } |
| @@ -632,10 +642,19 @@ xfs_file_dio_aio_write( · 329 unmodified lines | ||
| 632 | 642 | |
| 633 | 643 | if (mapping->nrpages) { |
| 634 | 644 | ret = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, |
| 635 | − pos, -1); | |
| 645 | + pos, pos + count - 1); | |
| 636 | 646 | if (ret) |
| 637 | 647 | goto out; |
| 638 | − truncate_pagecache_range(VFS_I(ip), pos, -1); | |
| 648 | + /* | |
| 649 | + * Invalidate whole pages. This can return an error if | |
| 650 | + * we fail to invalidate a page, but this should never | |
| 651 | + * happen on XFS. Warn if it does fail. | |
| 652 | + */ | |
| 653 | + ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, | |
| 654 | + pos >> PAGE_CACHE_SHIFT, | |
| 655 | + (pos + count - 1) >> PAGE_CACHE_SHIFT); | |
| 656 | + WARN_ON_ONCE(ret); | |
| 657 | + ret = 0; | |
| 639 | 658 | } |
| 640 | 659 | |
| 641 | 660 | /* |
| @@ -246,7 +246,6 @@ struct acpi_device_pnp { · 245 unmodified lines | ||
| 246 | 246 | acpi_device_name device_name; /* Driver-determined */ |
| 247 | 247 | acpi_device_class device_class; /* " */ |
| 248 | 248 | union acpi_object *str_obj; /* unicode string for _STR method */ |
| 249 | − unsigned long sun; /* _SUN */ | |
| 250 | 249 | }; |
| 251 | 250 | |
| 252 | 251 | #define acpi_device_bid(d) ((d)->pnp.bus_id) |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 18 | 18 | {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 19 | 19 | {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 20 | + {0x1002, 0x1318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | |
| 20 | 21 | {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 21 | 22 | {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 22 | 23 | {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| @@ -164,8 +165,11 @@ · 141 unmodified lines | ||
| 164 | 165 | {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 165 | 166 | {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 166 | 167 | {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 168 | + {0x1002, 0x6604, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | |
| 169 | + {0x1002, 0x6605, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | |
| 167 | 170 | {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 168 | 171 | {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 172 | + {0x1002, 0x6608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | |
| 169 | 173 | {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
| 170 | 174 | {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
| 171 | 175 | {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
| @@ -175,6 +179,8 @@ · 3 unmodified lines | ||
| 175 | 179 | {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
| 176 | 180 | {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 177 | 181 | {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 182 | + {0x1002, 0x6646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | |
| 183 | + {0x1002, 0x6647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | |
| 178 | 184 | {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
| 179 | 185 | {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
| 180 | 186 | {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
| @@ -297,6 +303,7 @@ · 116 unmodified lines | ||
| 297 | 303 | {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ |
| 298 | 304 | {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 299 | 305 | {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 306 | + {0x1002, 0x682C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ | |
| 300 | 307 | {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 301 | 308 | {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 302 | 309 | {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| @@ -127,10 +127,9 @@ enum { · 126 unmodified lines | ||
| 127 | 127 | BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */ |
| 128 | 128 | |
| 129 | 129 | BLK_MQ_F_SHOULD_MERGE = 1 << 0, |
| 130 | − BLK_MQ_F_SHOULD_SORT = 1 << 1, | |
| 131 | − BLK_MQ_F_TAG_SHARED = 1 << 2, | |
| 132 | − BLK_MQ_F_SG_MERGE = 1 << 3, | |
| 133 | − BLK_MQ_F_SYSFS_UP = 1 << 4, | |
| 130 | + BLK_MQ_F_TAG_SHARED = 1 << 1, | |
| 131 | + BLK_MQ_F_SG_MERGE = 1 << 2, | |
| 132 | + BLK_MQ_F_SYSFS_UP = 1 << 3, | |
| 134 | 133 | |
| 135 | 134 | BLK_MQ_S_STOPPED = 0, |
| 136 | 135 | BLK_MQ_S_TAG_ACTIVE = 1, |
| @@ -24,6 +24,9 @@ · 23 unmodified lines | ||
| 24 | 24 | #define NULL_ADDR ((block_t)0) /* used as block_t addresses */ |
| 25 | 25 | #define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ |
| 26 | 26 | |
| 27 | +/* 0, 1(node nid), 2(meta nid) are reserved node id */ | |
| 28 | +#define F2FS_RESERVED_NODE_NUM 3 | |
| 29 | + | |
| 27 | 30 | #define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) |
| 28 | 31 | #define F2FS_NODE_INO(sbi) (sbi->node_ino_num) |
| 29 | 32 | #define F2FS_META_INO(sbi) (sbi->meta_ino_num) |
| @@ -87,6 +90,8 @@ struct f2fs_super_block { · 57 unmodified lines | ||
| 87 | 90 | #define CP_ORPHAN_PRESENT_FLAG 0x00000002 |
| 88 | 91 | #define CP_UMOUNT_FLAG 0x00000001 |
| 89 | 92 | |
| 93 | +#define F2FS_CP_PACKS 2 /* # of checkpoint packs */ | |
| 94 | + | |
| 90 | 95 | struct f2fs_checkpoint { |
| 91 | 96 | __le64 checkpoint_ver; /* checkpoint block version number */ |
| 92 | 97 | __le64 user_block_count; /* # of user blocks */ |
| @@ -123,6 +128,9 @@ struct f2fs_checkpoint { · 30 unmodified lines | ||
| 123 | 128 | */ |
| 124 | 129 | #define F2FS_ORPHANS_PER_BLOCK 1020 |
| 125 | 130 | |
| 131 | +#define GET_ORPHAN_BLOCKS(n) ((n + F2FS_ORPHANS_PER_BLOCK - 1) / \ | |
| 132 | + F2FS_ORPHANS_PER_BLOCK) | |
| 133 | + | |
| 126 | 134 | struct f2fs_orphan_block { |
| 127 | 135 | __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */ |
| 128 | 136 | __le32 reserved; /* reserved */ |
| @@ -144,6 +152,7 @@ struct f2fs_extent { · 15 unmodified lines | ||
| 144 | 152 | #define F2FS_NAME_LEN 255 |
| 145 | 153 | #define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */ |
| 146 | 154 | #define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ |
| 155 | +#define DEF_NIDS_PER_INODE 5 /* Node IDs in an Inode */ | |
| 147 | 156 | #define ADDRS_PER_INODE(fi) addrs_per_inode(fi) |
| 148 | 157 | #define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ |
| 149 | 158 | #define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ |
| @@ -163,8 +172,9 @@ struct f2fs_extent { · 13 unmodified lines | ||
| 163 | 172 | #define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ |
| 164 | 173 | F2FS_INLINE_XATTR_ADDRS - 1)) |
| 165 | 174 | |
| 166 | −#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) \ | |
| 167 | − - sizeof(__le32) * (DEF_ADDRS_PER_INODE + 5 - 1)) | |
| 175 | +#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) -\ | |
| 176 | + sizeof(__le32) * (DEF_ADDRS_PER_INODE + \ | |
| 177 | + DEF_NIDS_PER_INODE - 1)) | |
| 168 | 178 | |
| 169 | 179 | struct f2fs_inode { |
| 170 | 180 | __le16 i_mode; /* file mode */ |
| @@ -194,7 +204,7 @@ struct f2fs_inode { · 23 unmodified lines | ||
| 194 | 204 | |
| 195 | 205 | __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */ |
| 196 | 206 | |
| 197 | − __le32 i_nid[5]; /* direct(2), indirect(2), | |
| 207 | + __le32 i_nid[DEF_NIDS_PER_INODE]; /* direct(2), indirect(2), | |
| 198 | 208 | double_indirect(1) node id */ |
| 199 | 209 | } __packed; |
| 200 | 210 | |
| @@ -102,6 +102,15 @@ enum { · 101 unmodified lines | ||
| 102 | 102 | FTRACE_OPS_FL_DELETED = 1 << 8, |
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | +#ifdef CONFIG_DYNAMIC_FTRACE | |
| 106 | +/* The hash used to know what functions callbacks trace */ | |
| 107 | +struct ftrace_ops_hash { | |
| 108 | + struct ftrace_hash *notrace_hash; | |
| 109 | + struct ftrace_hash *filter_hash; | |
| 110 | + struct mutex regex_lock; | |
| 111 | +}; | |
| 112 | +#endif | |
| 113 | + | |
| 105 | 114 | /* |
| 106 | 115 | * Note, ftrace_ops can be referenced outside of RCU protection. |
| 107 | 116 | * (Although, for perf, the control ops prevent that). If ftrace_ops is |
| @@ -121,10 +130,9 @@ struct ftrace_ops { · 13 unmodified lines | ||
| 121 | 130 | int __percpu *disabled; |
| 122 | 131 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 123 | 132 | int nr_trampolines; |
| 124 | − struct ftrace_hash *notrace_hash; | |
| 125 | − struct ftrace_hash *filter_hash; | |
| 133 | + struct ftrace_ops_hash local_hash; | |
| 134 | + struct ftrace_ops_hash *func_hash; | |
| 126 | 135 | struct ftrace_hash *tramp_hash; |
| 127 | − struct mutex regex_lock; | |
| 128 | 136 | unsigned long trampoline; |
| 129 | 137 | #endif |
| 130 | 138 | }; |
| @@ -16,8 +16,6 @@ struct device; · 15 unmodified lines | ||
| 16 | 16 | */ |
| 17 | 17 | struct gpio_desc; |
| 18 | 18 | |
| 19 | −#ifdef CONFIG_GPIOLIB | |
| 20 | − | |
| 21 | 19 | #define GPIOD_FLAGS_BIT_DIR_SET BIT(0) |
| 22 | 20 | #define GPIOD_FLAGS_BIT_DIR_OUT BIT(1) |
| 23 | 21 | #define GPIOD_FLAGS_BIT_DIR_VAL BIT(2) |
| @@ -34,64 +32,38 @@ enum gpiod_flags { · 10 unmodified lines | ||
| 34 | 32 | GPIOD_FLAGS_BIT_DIR_VAL, |
| 35 | 33 | }; |
| 36 | 34 | |
| 35 | +#ifdef CONFIG_GPIOLIB | |
| 36 | + | |
| 37 | 37 | /* Acquire and dispose GPIOs */ |
| 38 | 38 | struct gpio_desc *__must_check __gpiod_get(struct device *dev, |
| 39 | 39 | const char *con_id, |
| 40 | 40 | enum gpiod_flags flags); |
| 41 | −#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags) | |
| 42 | −#define gpiod_get(varargs...) __gpiod_get(varargs, 0) | |
| 43 | 41 | struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, |
| 44 | 42 | const char *con_id, |
| 45 | 43 | unsigned int idx, |
| 46 | 44 | enum gpiod_flags flags); |
| 47 | −#define __gpiod_get_index(dev, con_id, index, flags, ...) \ | |
| 48 | − __gpiod_get_index(dev, con_id, index, flags) | |
| 49 | −#define gpiod_get_index(varargs...) __gpiod_get_index(varargs, 0) | |
| 50 | 45 | struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev, |
| 51 | 46 | const char *con_id, |
| 52 | 47 | enum gpiod_flags flags); |
| 53 | −#define __gpiod_get_optional(dev, con_id, flags, ...) \ | |
| 54 | − __gpiod_get_optional(dev, con_id, flags) | |
| 55 | −#define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, 0) | |
| 56 | 48 | struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev, |
| 57 | 49 | const char *con_id, |
| 58 | 50 | unsigned int index, |
| 59 | 51 | enum gpiod_flags flags); |
| 60 | −#define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | |
| 61 | − __gpiod_get_index_optional(dev, con_id, index, flags) | |
| 62 | −#define gpiod_get_index_optional(varargs...) \ | |
| 63 | − __gpiod_get_index_optional(varargs, 0) | |
| 64 | − | |
| 65 | 52 | void gpiod_put(struct gpio_desc *desc); |
| 66 | 53 | |
| 67 | 54 | struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev, |
| 68 | 55 | const char *con_id, |
| 69 | 56 | enum gpiod_flags flags); |
| 70 | −#define __devm_gpiod_get(dev, con_id, flags, ...) \ | |
| 71 | − __devm_gpiod_get(dev, con_id, flags) | |
| 72 | −#define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, 0) | |
| 73 | 57 | struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, |
| 74 | 58 | const char *con_id, |
| 75 | 59 | unsigned int idx, |
| 76 | 60 | enum gpiod_flags flags); |
| 77 | −#define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \ | |
| 78 | − __devm_gpiod_get_index(dev, con_id, index, flags) | |
| 79 | −#define devm_gpiod_get_index(varargs...) __devm_gpiod_get_index(varargs, 0) | |
| 80 | 61 | struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev, |
| 81 | 62 | const char *con_id, |
| 82 | 63 | enum gpiod_flags flags); |
| 83 | −#define __devm_gpiod_get_optional(dev, con_id, flags, ...) \ | |
| 84 | − __devm_gpiod_get_optional(dev, con_id, flags) | |
| 85 | −#define devm_gpiod_get_optional(varargs...) \ | |
| 86 | − __devm_gpiod_get_optional(varargs, 0) | |
| 87 | 64 | struct gpio_desc *__must_check |
| 88 | 65 | __devm_gpiod_get_index_optional(struct device *dev, const char *con_id, |
| 89 | 66 | unsigned int index, enum gpiod_flags flags); |
| 90 | −#define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | |
| 91 | − __devm_gpiod_get_index_optional(dev, con_id, index, flags) | |
| 92 | −#define devm_gpiod_get_index_optional(varargs...) \ | |
| 93 | − __devm_gpiod_get_index_optional(varargs, 0) | |
| 94 | − | |
| 95 | 67 | void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); |
| 96 | 68 | |
| 97 | 69 | int gpiod_get_direction(const struct gpio_desc *desc); |
| @@ -124,27 +96,31 @@ int desc_to_gpio(const struct gpio_desc *desc); · 26 unmodified lines | ||
| 124 | 96 | |
| 125 | 97 | #else /* CONFIG_GPIOLIB */ |
| 126 | 98 | |
| 127 | −static inline struct gpio_desc *__must_check gpiod_get(struct device *dev, | |
| 128 | − const char *con_id) | |
| 99 | +static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, | |
| 100 | + const char *con_id, | |
| 101 | + enum gpiod_flags flags) | |
| 129 | 102 | { |
| 130 | 103 | return ERR_PTR(-ENOSYS); |
| 131 | 104 | } |
| 132 | −static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |
| 133 | − const char *con_id, | |
| 134 | − unsigned int idx) | |
| 105 | +static inline struct gpio_desc *__must_check | |
| 106 | +__gpiod_get_index(struct device *dev, | |
| 107 | + const char *con_id, | |
| 108 | + unsigned int idx, | |
| 109 | + enum gpiod_flags flags) | |
| 135 | 110 | { |
| 136 | 111 | return ERR_PTR(-ENOSYS); |
| 137 | 112 | } |
| 138 | 113 | |
| 139 | 114 | static inline struct gpio_desc *__must_check |
| 140 | −gpiod_get_optional(struct device *dev, const char *con_id) | |
| 115 | +__gpiod_get_optional(struct device *dev, const char *con_id, | |
| 116 | + enum gpiod_flags flags) | |
| 141 | 117 | { |
| 142 | 118 | return ERR_PTR(-ENOSYS); |
| 143 | 119 | } |
| 144 | 120 | |
| 145 | 121 | static inline struct gpio_desc *__must_check |
| 146 | −gpiod_get_index_optional(struct device *dev, const char *con_id, | |
| 147 | − unsigned int index) | |
| 122 | +__gpiod_get_index_optional(struct device *dev, const char *con_id, | |
| 123 | + unsigned int index, enum gpiod_flags flags) | |
| 148 | 124 | { |
| 149 | 125 | return ERR_PTR(-ENOSYS); |
| 150 | 126 | } |
| @@ -157,28 +133,33 @@ static inline void gpiod_put(struct gpio_desc *desc) · 6 unmodified lines | ||
| 157 | 133 | WARN_ON(1); |
| 158 | 134 | } |
| 159 | 135 | |
| 160 | −static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, | |
| 161 | − const char *con_id) | |
| 136 | +static inline struct gpio_desc *__must_check | |
| 137 | +__devm_gpiod_get(struct device *dev, | |
| 138 | + const char *con_id, | |
| 139 | + enum gpiod_flags flags) | |
| 162 | 140 | { |
| 163 | 141 | return ERR_PTR(-ENOSYS); |
| 164 | 142 | } |
| 165 | 143 | static inline |
| 166 | −struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, | |
| 167 | − const char *con_id, | |
| 168 | − unsigned int idx) | |
| 144 | +struct gpio_desc *__must_check | |
| 145 | +__devm_gpiod_get_index(struct device *dev, | |
| 146 | + const char *con_id, | |
| 147 | + unsigned int idx, | |
| 148 | + enum gpiod_flags flags) | |
| 169 | 149 | { |
| 170 | 150 | return ERR_PTR(-ENOSYS); |
| 171 | 151 | } |
| 172 | 152 | |
| 173 | 153 | static inline struct gpio_desc *__must_check |
| 174 | −devm_gpiod_get_optional(struct device *dev, const char *con_id) | |
| 154 | +__devm_gpiod_get_optional(struct device *dev, const char *con_id, | |
| 155 | + enum gpiod_flags flags) | |
| 175 | 156 | { |
| 176 | 157 | return ERR_PTR(-ENOSYS); |
| 177 | 158 | } |
| 178 | 159 | |
| 179 | 160 | static inline struct gpio_desc *__must_check |
| 180 | −devm_gpiod_get_index_optional(struct device *dev, const char *con_id, | |
| 181 | − unsigned int index) | |
| 161 | +__devm_gpiod_get_index_optional(struct device *dev, const char *con_id, | |
| 162 | + unsigned int index, enum gpiod_flags flags) | |
| 182 | 163 | { |
| 183 | 164 | return ERR_PTR(-ENOSYS); |
| 184 | 165 | } |
| @@ -303,9 +284,43 @@ static inline int desc_to_gpio(const struct gpio_desc *desc) · 118 unmodified lines | ||
| 303 | 284 | return -EINVAL; |
| 304 | 285 | } |
| 305 | 286 | |
| 306 | − | |
| 307 | 287 | #endif /* CONFIG_GPIOLIB */ |
| 308 | 288 | |
| 289 | +/* | |
| 290 | + * Vararg-hacks! This is done to transition the kernel to always pass | |
| 291 | + * the options flags argument to the below functions. During a transition | |
| 292 | + * phase these vararg macros make both old-and-newstyle code compile, | |
| 293 | + * but when all calls to the elder API are removed, these should go away | |
| 294 | + * and the __gpiod_get() etc functions above be renamed just gpiod_get() | |
| 295 | + * etc. | |
| 296 | + */ | |
| 297 | +#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags) | |
| 298 | +#define gpiod_get(varargs...) __gpiod_get(varargs, 0) | |
| 299 | +#define __gpiod_get_index(dev, con_id, index, flags, ...) \ | |
| 300 | + __gpiod_get_index(dev, con_id, index, flags) | |
| 301 | +#define gpiod_get_index(varargs...) __gpiod_get_index(varargs, 0) | |
| 302 | +#define __gpiod_get_optional(dev, con_id, flags, ...) \ | |
| 303 | + __gpiod_get_optional(dev, con_id, flags) | |
| 304 | +#define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, 0) | |
| 305 | +#define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | |
| 306 | + __gpiod_get_index_optional(dev, con_id, index, flags) | |
| 307 | +#define gpiod_get_index_optional(varargs...) \ | |
| 308 | + __gpiod_get_index_optional(varargs, 0) | |
| 309 | +#define __devm_gpiod_get(dev, con_id, flags, ...) \ | |
| 310 | + __devm_gpiod_get(dev, con_id, flags) | |
| 311 | +#define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, 0) | |
| 312 | +#define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \ | |
| 313 | + __devm_gpiod_get_index(dev, con_id, index, flags) | |
| 314 | +#define devm_gpiod_get_index(varargs...) __devm_gpiod_get_index(varargs, 0) | |
| 315 | +#define __devm_gpiod_get_optional(dev, con_id, flags, ...) \ | |
| 316 | + __devm_gpiod_get_optional(dev, con_id, flags) | |
| 317 | +#define devm_gpiod_get_optional(varargs...) \ | |
| 318 | + __devm_gpiod_get_optional(varargs, 0) | |
| 319 | +#define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | |
| 320 | + __devm_gpiod_get_index_optional(dev, con_id, index, flags) | |
| 321 | +#define devm_gpiod_get_index_optional(varargs...) \ | |
| 322 | + __devm_gpiod_get_index_optional(varargs, 0) | |
| 323 | + | |
| 309 | 324 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) |
| 310 | 325 | |
| 311 | 326 | int gpiod_export(struct gpio_desc *desc, bool direction_may_change); |
| @@ -159,7 +159,11 @@ typedef struct journal_header_s · 158 unmodified lines | ||
| 159 | 159 | * journal_block_tag (in the descriptor). The other h_chksum* fields are |
| 160 | 160 | * not used. |
| 161 | 161 | * |
| 162 | − * Checksum v1 and v2 are mutually exclusive features. | |
| 162 | + * If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses | |
| 163 | + * journal_block_tag3_t to store a full 32-bit checksum. Everything else | |
| 164 | + * is the same as v2. | |
| 165 | + * | |
| 166 | + * Checksum v1, v2, and v3 are mutually exclusive features. | |
| 163 | 167 | */ |
| 164 | 168 | struct commit_header { |
| 165 | 169 | __be32 h_magic; |
| @@ -179,6 +183,14 @@ struct commit_header { · 13 unmodified lines | ||
| 179 | 183 | * raw struct shouldn't be used for pointer math or sizeof() - use |
| 180 | 184 | * journal_tag_bytes(journal) instead to compute this. |
| 181 | 185 | */ |
| 186 | +typedef struct journal_block_tag3_s | |
| 187 | +{ | |
| 188 | + __be32 t_blocknr; /* The on-disk block number */ | |
| 189 | + __be32 t_flags; /* See below */ | |
| 190 | + __be32 t_blocknr_high; /* most-significant high 32bits. */ | |
| 191 | + __be32 t_checksum; /* crc32c(uuid+seq+block) */ | |
| 192 | +} journal_block_tag3_t; | |
| 193 | + | |
| 182 | 194 | typedef struct journal_block_tag_s |
| 183 | 195 | { |
| 184 | 196 | __be32 t_blocknr; /* The on-disk block number */ |
| @@ -187,9 +199,6 @@ typedef struct journal_block_tag_s · 2 unmodified lines | ||
| 187 | 199 | __be32 t_blocknr_high; /* most-significant high 32bits. */ |
| 188 | 200 | } journal_block_tag_t; |
| 189 | 201 | |
| 190 | −#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high)) | |
| 191 | −#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t)) | |
| 192 | − | |
| 193 | 202 | /* Tail of descriptor block, for checksumming */ |
| 194 | 203 | struct jbd2_journal_block_tail { |
| 195 | 204 | __be32 t_checksum; /* crc32c(uuid+descr_block) */ |
| @@ -284,6 +293,7 @@ typedef struct journal_superblock_s · 88 unmodified lines | ||
| 284 | 293 | #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 |
| 285 | 294 | #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 |
| 286 | 295 | #define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008 |
| 296 | +#define JBD2_FEATURE_INCOMPAT_CSUM_V3 0x00000010 | |
| 287 | 297 | |
| 288 | 298 | /* Features known to this kernel version: */ |
| 289 | 299 | #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM |
| @@ -291,7 +301,8 @@ typedef struct journal_superblock_s · 1 unmodified line | ||
| 291 | 301 | #define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ |
| 292 | 302 | JBD2_FEATURE_INCOMPAT_64BIT | \ |
| 293 | 303 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \ |
| 294 | − JBD2_FEATURE_INCOMPAT_CSUM_V2) | |
| 304 | + JBD2_FEATURE_INCOMPAT_CSUM_V2 | \ | |
| 305 | + JBD2_FEATURE_INCOMPAT_CSUM_V3) | |
| 295 | 306 | |
| 296 | 307 | #ifdef __KERNEL__ |
| 297 | 308 | |
| @@ -1296,6 +1307,15 @@ static inline int tid_geq(tid_t x, tid_t y) · 998 unmodified lines | ||
| 1296 | 1307 | extern int jbd2_journal_blocks_per_page(struct inode *inode); |
| 1297 | 1308 | extern size_t journal_tag_bytes(journal_t *journal); |
| 1298 | 1309 | |
| 1310 | +static inline int jbd2_journal_has_csum_v2or3(journal_t *journal) | |
| 1311 | +{ | |
| 1312 | + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) || | |
| 1313 | + JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) | |
| 1314 | + return 1; | |
| 1315 | + | |
| 1316 | + return 0; | |
| 1317 | +} | |
| 1318 | + | |
| 1299 | 1319 | /* |
| 1300 | 1320 | * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for |
| 1301 | 1321 | * transaction control blocks. |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/list.h> |
| 16 | 16 | #include <linux/spinlock.h> |
| 17 | 17 | #include <linux/rwsem.h> |
| 18 | +#include <linux/timer.h> | |
| 18 | 19 | #include <linux/workqueue.h> |
| 19 | 20 | |
| 20 | 21 | struct device; |
| @@ -68,7 +69,7 @@ struct led_classdev { · 47 unmodified lines | ||
| 68 | 69 | const char *default_trigger; /* Trigger to use */ |
| 69 | 70 | |
| 70 | 71 | unsigned long blink_delay_on, blink_delay_off; |
| 71 | − struct delayed_work blink_work; | |
| 72 | + struct timer_list blink_timer; | |
| 72 | 73 | int blink_brightness; |
| 73 | 74 | |
| 74 | 75 | struct work_struct set_brightness_work; |
| @@ -1197,6 +1197,9 @@ int mlx4_map_sw_to_hw_steering_id(struct mlx4_dev *dev, · 1196 unmodified lines | ||
| 1197 | 1197 | enum mlx4_net_trans_rule_id id); |
| 1198 | 1198 | int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id); |
| 1199 | 1199 | |
| 1200 | +int mlx4_tunnel_steer_add(struct mlx4_dev *dev, unsigned char *addr, | |
| 1201 | + int port, int qpn, u16 prio, u64 *reg_id); | |
| 1202 | + | |
| 1200 | 1203 | void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, |
| 1201 | 1204 | int i, int val); |
| 1202 | 1205 | |
| @@ -949,7 +949,7 @@ static inline int jedec_feature(struct nand_chip *chip) · 948 unmodified lines | ||
| 949 | 949 | : 0; |
| 950 | 950 | } |
| 951 | 951 | |
| 952 | −/** | |
| 952 | +/* | |
| 953 | 953 | * struct nand_sdr_timings - SDR NAND chip timings |
| 954 | 954 | * |
| 955 | 955 | * This struct defines the timing requirements of a SDR NAND chip. |
| @@ -3272,7 +3272,7 @@ static inline int __dev_uc_sync(struct net_device *dev, · 3271 unmodified lines | ||
| 3272 | 3272 | } |
| 3273 | 3273 | |
| 3274 | 3274 | /** |
| 3275 | − * __dev_uc_unsync - Remove synchonized addresses from device | |
| 3275 | + * __dev_uc_unsync - Remove synchronized addresses from device | |
| 3276 | 3276 | * @dev: device to sync |
| 3277 | 3277 | * @unsync: function to call if address should be removed |
| 3278 | 3278 | * |
| @@ -3316,7 +3316,7 @@ static inline int __dev_mc_sync(struct net_device *dev, · 37 unmodified lines | ||
| 3316 | 3316 | } |
| 3317 | 3317 | |
| 3318 | 3318 | /** |
| 3319 | − * __dev_mc_unsync - Remove synchonized addresses from device | |
| 3319 | + * __dev_mc_unsync - Remove synchronized addresses from device | |
| 3320 | 3320 | * @dev: device to sync |
| 3321 | 3321 | * @unsync: function to call if address should be removed |
| 3322 | 3322 | * |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <linux/in6.h> |
| 10 | 10 | #include <linux/wait.h> |
| 11 | 11 | #include <linux/list.h> |
| 12 | +#include <linux/static_key.h> | |
| 12 | 13 | #include <uapi/linux/netfilter.h> |
| 13 | 14 | #ifdef CONFIG_NETFILTER |
| 14 | 15 | static inline int NF_DROP_GETERR(int verdict) |
| @@ -99,9 +100,9 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg); · 84 unmodified lines | ||
| 99 | 100 | |
| 100 | 101 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
| 101 | 102 | |
| 102 | −#if defined(CONFIG_JUMP_LABEL) | |
| 103 | −#include <linux/static_key.h> | |
| 103 | +#ifdef HAVE_JUMP_LABEL | |
| 104 | 104 | extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
| 105 | + | |
| 105 | 106 | static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) |
| 106 | 107 | { |
| 107 | 108 | if (__builtin_constant_p(pf) && |
| @@ -123,6 +123,7 @@ extern int nfs_wait_on_request(struct nfs_page *); · 122 unmodified lines | ||
| 123 | 123 | extern void nfs_unlock_request(struct nfs_page *req); |
| 124 | 124 | extern void nfs_unlock_and_release_request(struct nfs_page *); |
| 125 | 125 | extern int nfs_page_group_lock(struct nfs_page *, bool); |
| 126 | +extern void nfs_page_group_lock_wait(struct nfs_page *); | |
| 126 | 127 | extern void nfs_page_group_unlock(struct nfs_page *); |
| 127 | 128 | extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); |
| 128 | 129 | |
| @@ -21,8 +21,17 @@ enum nand_io { · 20 unmodified lines | ||
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | 23 | enum omap_ecc { |
| 24 | − /* 1-bit ECC calculation by GPMC, Error detection by Software */ | |
| 25 | − OMAP_ECC_HAM1_CODE_HW = 0, | |
| 24 | + /* | |
| 25 | + * 1-bit ECC: calculation and correction by SW | |
| 26 | + * ECC stored at end of spare area | |
| 27 | + */ | |
| 28 | + OMAP_ECC_HAM1_CODE_SW = 0, | |
| 29 | + | |
| 30 | + /* | |
| 31 | + * 1-bit ECC: calculation by GPMC, Error detection by Software | |
| 32 | + * ECC layout compatible with ROM code layout | |
| 33 | + */ | |
| 34 | + OMAP_ECC_HAM1_CODE_HW, | |
| 26 | 35 | /* 4-bit ECC calculation by GPMC, Error detection by Software */ |
| 27 | 36 | OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, |
| 28 | 37 | /* 4-bit ECC calculation by GPMC, Error detection by ELM */ |
| @@ -60,7 +60,7 @@ struct generic_pm_domain { · 59 unmodified lines | ||
| 60 | 60 | struct mutex lock; |
| 61 | 61 | struct dev_power_governor *gov; |
| 62 | 62 | struct work_struct power_off_work; |
| 63 | − char *name; | |
| 63 | + const char *name; | |
| 64 | 64 | unsigned int in_progress; /* Number of devices being suspended now */ |
| 65 | 65 | atomic_t sd_count; /* Number of subdomains with power "on" */ |
| 66 | 66 | enum gpd_status status; /* Current state of the domain */ |
| @@ -218,6 +218,8 @@ enum regulator_type { · 217 unmodified lines | ||
| 218 | 218 | * @linear_min_sel: Minimal selector for starting linear mapping |
| 219 | 219 | * @fixed_uV: Fixed voltage of rails. |
| 220 | 220 | * @ramp_delay: Time to settle down after voltage change (unit: uV/us) |
| 221 | + * @linear_ranges: A constant table of possible voltage ranges. | |
| 222 | + * @n_linear_ranges: Number of entries in the @linear_ranges table. | |
| 221 | 223 | * @volt_table: Voltage mapping table (if table based mapping) |
| 222 | 224 | * |
| 223 | 225 | * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ |
| @@ -85,6 +85,7 @@ struct regulator_state { · 84 unmodified lines | ||
| 85 | 85 | * bootloader then it will be enabled when the constraints are |
| 86 | 86 | * applied. |
| 87 | 87 | * @apply_uV: Apply the voltage constraint when initialising. |
| 88 | + * @ramp_disable: Disable ramp delay when initialising or when setting voltage. | |
| 88 | 89 | * |
| 89 | 90 | * @input_uV: Input voltage for regulator when supplied by another regulator. |
| 90 | 91 | * |
| @@ -62,6 +62,7 @@ to_seqno_fence(struct fence *fence) · 61 unmodified lines | ||
| 62 | 62 | * @context: the execution context this fence is a part of |
| 63 | 63 | * @seqno_ofs: the offset within @sync_buf |
| 64 | 64 | * @seqno: the sequence # to signal on |
| 65 | + * @cond: fence wait condition | |
| 65 | 66 | * @ops: the fence_ops for operations on this seqno fence |
| 66 | 67 | * |
| 67 | 68 | * This function initializes a struct seqno_fence with passed parameters, |
| @@ -253,6 +253,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 252 unmodified lines | ||
| 253 | 253 | * the device whose settings are being modified. |
| 254 | 254 | * @transfer: adds a message to the controller's transfer queue. |
| 255 | 255 | * @cleanup: frees controller-specific state |
| 256 | + * @can_dma: determine whether this master supports DMA | |
| 256 | 257 | * @queued: whether this master is providing an internal message queue |
| 257 | 258 | * @kworker: thread struct for message pump |
| 258 | 259 | * @kworker_task: pointer to task for message pump kworker thread |
| @@ -262,6 +263,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 3 unmodified lines | ||
| 262 | 263 | * @cur_msg: the currently in-flight message |
| 263 | 264 | * @cur_msg_prepared: spi_prepare_message was called for the currently |
| 264 | 265 | * in-flight message |
| 266 | + * @cur_msg_mapped: message has been mapped for DMA | |
| 265 | 267 | * @xfer_completion: used by core transfer_one_message() |
| 266 | 268 | * @busy: message pump is busy |
| 267 | 269 | * @running: message pump is running |
| @@ -299,6 +301,10 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 31 unmodified lines | ||
| 299 | 301 | * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS |
| 300 | 302 | * number. Any individual value may be -ENOENT for CS lines that |
| 301 | 303 | * are not GPIOs (driven by the SPI controller itself). |
| 304 | + * @dma_tx: DMA transmit channel | |
| 305 | + * @dma_rx: DMA receive channel | |
| 306 | + * @dummy_rx: dummy receive buffer for full-duplex devices | |
| 307 | + * @dummy_tx: dummy transmit buffer for full-duplex devices | |
| 302 | 308 | * |
| 303 | 309 | * Each SPI master controller can communicate with one or more @spi_device |
| 304 | 310 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
| @@ -632,6 +638,7 @@ struct spi_transfer { · 327 unmodified lines | ||
| 632 | 638 | * addresses for each transfer buffer |
| 633 | 639 | * @complete: called to report transaction completions |
| 634 | 640 | * @context: the argument to complete() when it's called |
| 641 | + * @frame_length: the total number of bytes in the message | |
| 635 | 642 | * @actual_length: the total number of bytes that were transferred in all |
| 636 | 643 | * successful segments |
| 637 | 644 | * @status: zero for success, else negative errno |
| @@ -183,13 +183,8 @@ static inline bool tick_nohz_full_cpu(int cpu) · 182 unmodified lines | ||
| 183 | 183 | |
| 184 | 184 | extern void tick_nohz_init(void); |
| 185 | 185 | extern void __tick_nohz_full_check(void); |
| 186 | +extern void tick_nohz_full_kick(void); | |
| 186 | 187 | extern void tick_nohz_full_kick_cpu(int cpu); |
| 187 | − | |
| 188 | −static inline void tick_nohz_full_kick(void) | |
| 189 | −{ | |
| 190 | − tick_nohz_full_kick_cpu(smp_processor_id()); | |
| 191 | −} | |
| 192 | − | |
| 193 | 188 | extern void tick_nohz_full_kick_all(void); |
| 194 | 189 | extern void __tick_nohz_task_switch(struct task_struct *tsk); |
| 195 | 190 | #else |
| @@ -464,6 +464,8 @@ struct hci_conn_params { · 463 unmodified lines | ||
| 464 | 464 | HCI_AUTO_CONN_ALWAYS, |
| 465 | 465 | HCI_AUTO_CONN_LINK_LOSS, |
| 466 | 466 | } auto_connect; |
| 467 | + | |
| 468 | + struct hci_conn *conn; | |
| 467 | 469 | }; |
| 468 | 470 | |
| 469 | 471 | extern struct list_head hci_dev_list; |
| @@ -16,7 +16,6 @@ struct netns_sysctl_lowpan { · 15 unmodified lines | ||
| 16 | 16 | struct netns_ieee802154_lowpan { |
| 17 | 17 | struct netns_sysctl_lowpan sysctl; |
| 18 | 18 | struct netns_frags frags; |
| 19 | − int max_dsize; | |
| 20 | 19 | }; |
| 21 | 20 | |
| 22 | 21 | #endif |
| @@ -167,7 +167,7 @@ struct ieee80211_reg_rule { · 166 unmodified lines | ||
| 167 | 167 | struct ieee80211_regdomain { |
| 168 | 168 | struct rcu_head rcu_head; |
| 169 | 169 | u32 n_reg_rules; |
| 170 | − char alpha2[2]; | |
| 170 | + char alpha2[3]; | |
| 171 | 171 | enum nl80211_dfs_regions dfs_region; |
| 172 | 172 | struct ieee80211_reg_rule reg_rules[]; |
| 173 | 173 | }; |
| @@ -320,6 +320,19 @@ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) · 319 unmodified lines | ||
| 320 | 320 | return asoc ? asoc->assoc_id : 0; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | +static inline enum sctp_sstat_state | |
| 324 | +sctp_assoc_to_state(const struct sctp_association *asoc) | |
| 325 | +{ | |
| 326 | + /* SCTP's uapi always had SCTP_EMPTY(=0) as a dummy state, but we | |
| 327 | + * got rid of it in kernel space. Therefore SCTP_CLOSED et al | |
| 328 | + * start at =1 in user space, but actually as =0 in kernel space. | |
| 329 | + * Now that we can not break user space and SCTP_EMPTY is exposed | |
| 330 | + * there, we need to fix it up with an ugly offset not to break | |
| 331 | + * applications. :( | |
| 332 | + */ | |
| 333 | + return asoc->state + 1; | |
| 334 | +} | |
| 335 | + | |
| 323 | 336 | /* Look up the association by its id. */ |
| 324 | 337 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); |
| 325 | 338 | |
| @@ -2171,9 +2171,7 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) · 2170 unmodified lines | ||
| 2171 | 2171 | */ |
| 2172 | 2172 | if (sock_flag(sk, SOCK_RCVTSTAMP) || |
| 2173 | 2173 | (sk->sk_tsflags & SOF_TIMESTAMPING_RX_SOFTWARE) || |
| 2174 | − (kt.tv64 && | |
| 2175 | − (sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE || | |
| 2176 | − skb_shinfo(skb)->tx_flags & SKBTX_ANY_SW_TSTAMP)) || | |
| 2174 | + (kt.tv64 && sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) || | |
| 2177 | 2175 | (hwtstamps->hwtstamp.tv64 && |
| 2178 | 2176 | (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE))) |
| 2179 | 2177 | __sock_recv_timestamp(msg, sk, skb); |
| @@ -290,7 +290,7 @@ struct wimax_dev; · 289 unmodified lines | ||
| 290 | 290 | * This operation has to be synchronous, and return only when the |
| 291 | 291 | * reset is complete. In case of having had to resort to bus/cold |
| 292 | 292 | * reset implying a device disconnection, the call is allowed to |
| 293 | − * return inmediately. | |
| 293 | + * return immediately. | |
| 294 | 294 | * NOTE: wimax_dev->mutex is NOT locked when this op is being |
| 295 | 295 | * called; however, wimax_dev->mutex_reset IS locked to ensure |
| 296 | 296 | * serialization of calls to wimax_reset(). |
| @@ -277,7 +277,7 @@ · 276 unmodified lines | ||
| 277 | 277 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ |
| 278 | 278 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
| 279 | 279 | .tlv.c = (snd_soc_bytes_tlv_callback), \ |
| 280 | − .info = snd_soc_info_bytes_ext, \ | |
| 280 | + .info = snd_soc_bytes_info_ext, \ | |
| 281 | 281 | .private_value = (unsigned long)&(struct soc_bytes_ext) \ |
| 282 | 282 | {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } |
| 283 | 283 | #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ |
| @@ -107,7 +107,7 @@ DECLARE_EVENT_CLASS(softirq, · 106 unmodified lines | ||
| 107 | 107 | * @vec_nr: softirq vector number |
| 108 | 108 | * |
| 109 | 109 | * When used in combination with the softirq_exit tracepoint |
| 110 | − * we can determine the softirq handler runtine. | |
| 110 | + * we can determine the softirq handler routine. | |
| 111 | 111 | */ |
| 112 | 112 | DEFINE_EVENT(softirq, softirq_entry, |
| 113 | 113 | |
| @@ -121,7 +121,7 @@ DEFINE_EVENT(softirq, softirq_entry, · 7 unmodified lines | ||
| 121 | 121 | * @vec_nr: softirq vector number |
| 122 | 122 | * |
| 123 | 123 | * When used in combination with the softirq_entry tracepoint |
| 124 | − * we can determine the softirq handler runtine. | |
| 124 | + * we can determine the softirq handler routine. | |
| 125 | 125 | */ |
| 126 | 126 | DEFINE_EVENT(softirq, softirq_exit, |
| 127 | 127 | |
| @@ -944,6 +944,7 @@ struct drm_radeon_cs_chunk { · 943 unmodified lines | ||
| 944 | 944 | }; |
| 945 | 945 | |
| 946 | 946 | /* drm_radeon_cs_reloc.flags */ |
| 947 | +#define RADEON_RELOC_PRIO_MASK (0xf << 0) | |
| 947 | 948 | |
| 948 | 949 | struct drm_radeon_cs_reloc { |
| 949 | 950 | uint32_t handle; |
File renamed without changes.
| @@ -13,7 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #ifndef _UAPI_LINUX_XATTR_H |
| 14 | 14 | #define _UAPI_LINUX_XATTR_H |
| 15 | 15 | |
| 16 | −#ifdef __UAPI_DEF_XATTR | |
| 16 | +#if __UAPI_DEF_XATTR | |
| 17 | 17 | #define __USE_KERNEL_XATTR_DEFS |
| 18 | 18 | |
| 19 | 19 | #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ |
| @@ -1035,6 +1035,11 @@ static void cgroup_get(struct cgroup *cgrp) · 1034 unmodified lines | ||
| 1035 | 1035 | css_get(&cgrp->self); |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | +static bool cgroup_tryget(struct cgroup *cgrp) | |
| 1039 | +{ | |
| 1040 | + return css_tryget(&cgrp->self); | |
| 1041 | +} | |
| 1042 | + | |
| 1038 | 1043 | static void cgroup_put(struct cgroup *cgrp) |
| 1039 | 1044 | { |
| 1040 | 1045 | css_put(&cgrp->self); |
| @@ -1147,7 +1152,8 @@ static struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn) · 106 unmodified lines | ||
| 1147 | 1152 | * protection against removal. Ensure @cgrp stays accessible and |
| 1148 | 1153 | * break the active_ref protection. |
| 1149 | 1154 | */ |
| 1150 | − cgroup_get(cgrp); | |
| 1155 | + if (!cgroup_tryget(cgrp)) | |
| 1156 | + return NULL; | |
| 1151 | 1157 | kernfs_break_active_protection(kn); |
| 1152 | 1158 | |
| 1153 | 1159 | mutex_lock(&cgroup_mutex); |
| @@ -3271,8 +3277,17 @@ int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts) · 2117 unmodified lines | ||
| 3271 | 3277 | { |
| 3272 | 3278 | struct cftype *cft; |
| 3273 | 3279 | |
| 3274 | − for (cft = cfts; cft && cft->name[0] != '\0'; cft++) | |
| 3275 | − cft->flags |= __CFTYPE_NOT_ON_DFL; | |
| 3280 | + /* | |
| 3281 | + * If legacy_flies_on_dfl, we want to show the legacy files on the | |
| 3282 | + * dfl hierarchy but iff the target subsystem hasn't been updated | |
| 3283 | + * for the dfl hierarchy yet. | |
| 3284 | + */ | |
| 3285 | + if (!cgroup_legacy_files_on_dfl || | |
| 3286 | + ss->dfl_cftypes != ss->legacy_cftypes) { | |
| 3287 | + for (cft = cfts; cft && cft->name[0] != '\0'; cft++) | |
| 3288 | + cft->flags |= __CFTYPE_NOT_ON_DFL; | |
| 3289 | + } | |
| 3290 | + | |
| 3276 | 3291 | return cgroup_add_cftypes(ss, cfts); |
| 3277 | 3292 | } |
55 more lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 561 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 207 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.