We need commit f8f6ae5d077a ("mm: always have io_remap_pfn_range() set pgprot_decrypted()") to be able to merge Jason's cleanup patch.
Unified · Split
| @@ -1,29 +1,29 @@ | |||
| 1 | What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/cap | 1 | What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/cap |
| 2 | Date: December 3, 2009 | 2 | Date: December 3, 2009 |
| 3 | KernelVersion: 2.6.32 | 3 | KernelVersion: 2.6.32 |
| 4 | Contact: dmaengine@vger.kernel.org | 4 | Contact: dmaengine@vger.kernel.org |
| 5 | Description: Capabilities the DMA supports.Currently there are DMA_PQ, DMA_PQ_VAL, | 5 | Description: Capabilities the DMA supports.Currently there are DMA_PQ, DMA_PQ_VAL, |
| 6 | DMA_XOR,DMA_XOR_VAL,DMA_INTERRUPT. | 6 | DMA_XOR,DMA_XOR_VAL,DMA_INTERRUPT. |
| 7 | 7 | ||
| 8 | What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_active | 8 | What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_active |
| 9 | Date: December 3, 2009 | 9 | Date: December 3, 2009 |
| 10 | KernelVersion: 2.6.32 | 10 | KernelVersion: 2.6.32 |
| 11 | Contact: dmaengine@vger.kernel.org | 11 | Contact: dmaengine@vger.kernel.org |
| 12 | Description: The number of descriptors active in the ring. | 12 | Description: The number of descriptors active in the ring. |
| 13 | 13 | ||
| 14 | What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_size | 14 | What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_size |
| 15 | Date: December 3, 2009 | 15 | Date: December 3, 2009 |
| 16 | KernelVersion: 2.6.32 | 16 | KernelVersion: 2.6.32 |
| 17 | Contact: dmaengine@vger.kernel.org | 17 | Contact: dmaengine@vger.kernel.org |
| 18 | Description: Descriptor ring size, total number of descriptors available. | 18 | Description: Descriptor ring size, total number of descriptors available. |
| 19 | 19 | ||
| 20 | What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/version | 20 | What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/version |
| 21 | Date: December 3, 2009 | 21 | Date: December 3, 2009 |
| 22 | KernelVersion: 2.6.32 | 22 | KernelVersion: 2.6.32 |
| 23 | Contact: dmaengine@vger.kernel.org | 23 | Contact: dmaengine@vger.kernel.org |
| 24 | Description: Version of ioatdma device. | 24 | Description: Version of ioatdma device. |
| 25 | 25 | ||
| 26 | What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/intr_coalesce | 26 | What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/intr_coalesce |
| 27 | Date: August 8, 2017 | 27 | Date: August 8, 2017 |
| 28 | KernelVersion: 4.14 | 28 | KernelVersion: 4.14 |
| 29 | Contact: dmaengine@vger.kernel.org | 29 | Contact: dmaengine@vger.kernel.org |
| @@ -152,7 +152,7 @@ Description: · 151 unmodified lines | |||
| 152 | When an interface is under test, it cannot be expected | 152 | When an interface is under test, it cannot be expected |
| 153 | to pass packets as normal. | 153 | to pass packets as normal. |
| 154 | 154 | ||
| 155 | What: /sys/clas/net/<iface>/duplex | 155 | What: /sys/class/net/<iface>/duplex |
| 156 | Date: October 2009 | 156 | Date: October 2009 |
| 157 | KernelVersion: 2.6.33 | 157 | KernelVersion: 2.6.33 |
| 158 | Contact: netdev@vger.kernel.org | 158 | Contact: netdev@vger.kernel.org |
| @@ -26,6 +26,10 @@ BUILDDIR = $(obj)/output · 25 unmodified lines | |||
| 26 | PDFLATEX = xelatex | 26 | PDFLATEX = xelatex |
| 27 | LATEXOPTS = -interaction=batchmode | 27 | LATEXOPTS = -interaction=batchmode |
| 28 | 28 | ||
| 29 | ifeq ($(KBUILD_VERBOSE),0) | ||
| 30 | SPHINXOPTS += "-q" | ||
| 31 | endif | ||
| 32 | |||
| 29 | # User-friendly check for sphinx-build | 33 | # User-friendly check for sphinx-build |
| 30 | HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi) | 34 | HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi) |
| 31 | 35 | ||
| @@ -107,7 +107,7 @@ for a UID/GID will prevent that UID/GID from obtaining auxiliary setid · 106 unmodified lines | |||
| 107 | privileges, such as allowing a user to set up user namespace UID/GID mappings. | 107 | privileges, such as allowing a user to set up user namespace UID/GID mappings. |
| 108 | 108 | ||
| 109 | Note on GID policies and setgroups() | 109 | Note on GID policies and setgroups() |
| 110 | ================== | 110 | ==================================== |
| 111 | In v5.9 we are adding support for limiting CAP_SETGID privileges as was done | 111 | In v5.9 we are adding support for limiting CAP_SETGID privileges as was done |
| 112 | previously for CAP_SETUID. However, for compatibility with common sandboxing | 112 | previously for CAP_SETUID. However, for compatibility with common sandboxing |
| 113 | related code conventions in userspace, we currently allow arbitrary | 113 | related code conventions in userspace, we currently allow arbitrary |
| @@ -478,7 +478,7 @@ order to ask the hardware to enter that state. Also, for each · 477 unmodified lines | |||
| 478 | statistics of the given idle state. That information is exposed by the kernel | 478 | statistics of the given idle state. That information is exposed by the kernel |
| 479 | via ``sysfs``. | 479 | via ``sysfs``. |
| 480 | 480 | ||
| 481 | For each CPU in the system, there is a :file:`/sys/devices/system/cpu<N>/cpuidle/` | 481 | For each CPU in the system, there is a :file:`/sys/devices/system/cpu/cpu<N>/cpuidle/` |
| 482 | directory in ``sysfs``, where the number ``<N>`` is assigned to the given | 482 | directory in ``sysfs``, where the number ``<N>`` is assigned to the given |
| 483 | CPU at the initialization time. That directory contains a set of subdirectories | 483 | CPU at the initialization time. That directory contains a set of subdirectories |
| 484 | called :file:`state0`, :file:`state1` and so on, up to the number of idle state | 484 | called :file:`state0`, :file:`state1` and so on, up to the number of idle state |
| @@ -494,7 +494,7 @@ object corresponding to it, as follows: · 9 unmodified lines | |||
| 494 | residency. | 494 | residency. |
| 495 | 495 | ||
| 496 | ``below`` | 496 | ``below`` |
| 497 | Total number of times this idle state had been asked for, but cerainly | 497 | Total number of times this idle state had been asked for, but certainly |
| 498 | a deeper idle state would have been a better match for the observed idle | 498 | a deeper idle state would have been a better match for the observed idle |
| 499 | duration. | 499 | duration. |
| 500 | 500 | ||
| @@ -300,6 +300,7 @@ Note: · 299 unmodified lines | |||
| 300 | 0: 0 1 2 3 4 5 6 7 | 300 | 0: 0 1 2 3 4 5 6 7 |
| 301 | RSS hash key: | 301 | RSS hash key: |
| 302 | 84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8:43:e3:c9:0c:fd:17:55:c2:3a:4d:69:ed:f1:42:89 | 302 | 84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8:43:e3:c9:0c:fd:17:55:c2:3a:4d:69:ed:f1:42:89 |
| 303 | |||
| 303 | netdev_tstamp_prequeue | 304 | netdev_tstamp_prequeue |
| 304 | ---------------------- | 305 | ---------------------- |
| 305 | 306 | ||
| @@ -148,3 +148,13 @@ SunXi family · 147 unmodified lines | |||
| 148 | * User Manual | 148 | * User Manual |
| 149 | 149 | ||
| 150 | http://dl.linux-sunxi.org/A64/Allwinner%20A64%20User%20Manual%20v1.0.pdf | 150 | http://dl.linux-sunxi.org/A64/Allwinner%20A64%20User%20Manual%20v1.0.pdf |
| 151 | |||
| 152 | - Allwinner H6 | ||
| 153 | |||
| 154 | * Datasheet | ||
| 155 | |||
| 156 | https://linux-sunxi.org/images/5/5c/Allwinner_H6_V200_Datasheet_V1.1.pdf | ||
| 157 | |||
| 158 | * User Manual | ||
| 159 | |||
| 160 | https://linux-sunxi.org/images/4/46/Allwinner_H6_V200_User_Manual_V1.1.pdf | ||
| @@ -51,7 +51,7 @@ if major >= 3: · 50 unmodified lines | |||
| 51 | support for Sphinx v3.0 and above is brand new. Be prepared for | 51 | support for Sphinx v3.0 and above is brand new. Be prepared for |
| 52 | possible issues in the generated output. | 52 | possible issues in the generated output. |
| 53 | ''') | 53 | ''') |
| 54 | if minor > 0 or patch >= 2: | 54 | if (major > 3) or (minor > 0 or patch >= 2): |
| 55 | # Sphinx c function parser is more pedantic with regards to type | 55 | # Sphinx c function parser is more pedantic with regards to type |
| 56 | # checking. Due to that, having macros at c:function cause problems. | 56 | # checking. Due to that, having macros at c:function cause problems. |
| 57 | # Those needed to be scaped by using c_id_attributes[] array | 57 | # Those needed to be scaped by using c_id_attributes[] array |
| @@ -295,11 +295,13 @@ print the number of the test and the status of the test: · 294 unmodified lines | |||
| 295 | pass:: | 295 | pass:: |
| 296 | 296 | ||
| 297 | ok 28 - kmalloc_double_kzfree | 297 | ok 28 - kmalloc_double_kzfree |
| 298 | |||
| 298 | or, if kmalloc failed:: | 299 | or, if kmalloc failed:: |
| 299 | 300 | ||
| 300 | # kmalloc_large_oob_right: ASSERTION FAILED at lib/test_kasan.c:163 | 301 | # kmalloc_large_oob_right: ASSERTION FAILED at lib/test_kasan.c:163 |
| 301 | Expected ptr is not null, but is | 302 | Expected ptr is not null, but is |
| 302 | not ok 4 - kmalloc_large_oob_right | 303 | not ok 4 - kmalloc_large_oob_right |
| 304 | |||
| 303 | or, if a KASAN report was expected, but not found:: | 305 | or, if a KASAN report was expected, but not found:: |
| 304 | 306 | ||
| 305 | # kmalloc_double_kzfree: EXPECTATION FAILED at lib/test_kasan.c:629 | 307 | # kmalloc_double_kzfree: EXPECTATION FAILED at lib/test_kasan.c:629 |
| @@ -197,7 +197,7 @@ Now add the following to ``drivers/misc/Kconfig``: · 196 unmodified lines | |||
| 197 | 197 | ||
| 198 | config MISC_EXAMPLE_TEST | 198 | config MISC_EXAMPLE_TEST |
| 199 | bool "Test for my example" | 199 | bool "Test for my example" |
| 200 | depends on MISC_EXAMPLE && KUNIT | 200 | depends on MISC_EXAMPLE && KUNIT=y |
| 201 | 201 | ||
| 202 | and the following to ``drivers/misc/Makefile``: | 202 | and the following to ``drivers/misc/Makefile``: |
| 203 | 203 | ||
| @@ -561,6 +561,11 @@ Once the kernel is built and installed, a simple · 560 unmodified lines | |||
| 561 | 561 | ||
| 562 | ...will run the tests. | 562 | ...will run the tests. |
| 563 | 563 | ||
| 564 | .. note:: | ||
| 565 | Note that you should make sure your test depends on ``KUNIT=y`` in Kconfig | ||
| 566 | if the test does not support module build. Otherwise, it will trigger | ||
| 567 | compile errors if ``CONFIG_KUNIT`` is ``m``. | ||
| 568 | |||
| 564 | Writing new tests for other architectures | 569 | Writing new tests for other architectures |
| 565 | ----------------------------------------- | 570 | ----------------------------------------- |
| 566 | 571 | ||
| @@ -4,7 +4,7 @@ Clock control registers reside in different Hi6220 system controllers, · 3 unmodified lines | |||
| 4 | please refer the following document to know more about the binding rules | 4 | please refer the following document to know more about the binding rules |
| 5 | for these system controllers: | 5 | for these system controllers: |
| 6 | 6 | ||
| 7 | Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt | 7 | Documentation/devicetree/bindings/arm/hisilicon/hisilicon.yaml |
| 8 | 8 | ||
| 9 | Required Properties: | 9 | Required Properties: |
| 10 | 10 | ||
| @@ -32,6 +32,11 @@ description: | · 31 unmodified lines | |||
| 32 | | | vint | bit | | 0 |.....|63| vintx | | 32 | | | vint | bit | | 0 |.....|63| vintx | |
| 33 | | +--------------+ +------------+ | | 33 | | +--------------+ +------------+ | |
| 34 | | | | 34 | | | |
| 35 | | Unmap | | ||
| 36 | | +--------------+ | | ||
| 37 | Unmapped events ---->| | umapidx |-------------------------> Globalevents | ||
| 38 | | +--------------+ | | ||
| 39 | | | | ||
| 35 | +-----------------------------------------+ | 40 | +-----------------------------------------+ |
| 36 | 41 | ||
| 37 | Configuration of these Intmap registers that maps global events to vint is | 42 | Configuration of these Intmap registers that maps global events to vint is |
| @@ -70,6 +75,11 @@ properties: · 32 unmodified lines | |||
| 70 | - description: | | 75 | - description: | |
| 71 | "limit" specifies the limit for translation | 76 | "limit" specifies the limit for translation |
| 72 | 77 | ||
| 78 | ti,unmapped-event-sources: | ||
| 79 | $ref: /schemas/types.yaml#definitions/phandle-array | ||
| 80 | description: | ||
| 81 | Array of phandles to DMA controllers where the unmapped events originate. | ||
| 82 | |||
| 73 | required: | 83 | required: |
| 74 | - compatible | 84 | - compatible |
| 75 | - reg | 85 | - reg |
| @@ -0,0 +1,18 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/net/can/can-controller.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: CAN Controller Generic Binding | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Marc Kleine-Budde <mkl@pengutronix.de> | ||
| 11 | |||
| 12 | properties: | ||
| 13 | $nodename: | ||
| 14 | pattern: "^can(@.*)?$" | ||
| 15 | |||
| 16 | additionalProperties: true | ||
| 17 | |||
| 18 | ... | ||
| @@ -0,0 +1,135 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/net/can/fsl,flexcan.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: | ||
| 8 | Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC). | ||
| 9 | |||
| 10 | maintainers: | ||
| 11 | - Marc Kleine-Budde <mkl@pengutronix.de> | ||
| 12 | |||
| 13 | allOf: | ||
| 14 | - $ref: can-controller.yaml# | ||
| 15 | |||
| 16 | properties: | ||
| 17 | compatible: | ||
| 18 | oneOf: | ||
| 19 | - enum: | ||
| 20 | - fsl,imx8qm-flexcan | ||
| 21 | - fsl,imx8mp-flexcan | ||
| 22 | - fsl,imx6q-flexcan | ||
| 23 | - fsl,imx53-flexcan | ||
| 24 | - fsl,imx35-flexcan | ||
| 25 | - fsl,imx28-flexcan | ||
| 26 | - fsl,imx25-flexcan | ||
| 27 | - fsl,p1010-flexcan | ||
| 28 | - fsl,vf610-flexcan | ||
| 29 | - fsl,ls1021ar2-flexcan | ||
| 30 | - fsl,lx2160ar1-flexcan | ||
| 31 | - items: | ||
| 32 | - enum: | ||
| 33 | - fsl,imx7d-flexcan | ||
| 34 | - fsl,imx6ul-flexcan | ||
| 35 | - fsl,imx6sx-flexcan | ||
| 36 | - const: fsl,imx6q-flexcan | ||
| 37 | - items: | ||
| 38 | - enum: | ||
| 39 | - fsl,ls1028ar1-flexcan | ||
| 40 | - const: fsl,lx2160ar1-flexcan | ||
| 41 | |||
| 42 | reg: | ||
| 43 | maxItems: 1 | ||
| 44 | |||
| 45 | interrupts: | ||
| 46 | maxItems: 1 | ||
| 47 | |||
| 48 | clocks: | ||
| 49 | maxItems: 2 | ||
| 50 | |||
| 51 | clock-names: | ||
| 52 | items: | ||
| 53 | - const: ipg | ||
| 54 | - const: per | ||
| 55 | |||
| 56 | clock-frequency: | ||
| 57 | description: | | ||
| 58 | The oscillator frequency driving the flexcan device, filled in by the | ||
| 59 | boot loader. This property should only be used the used operating system | ||
| 60 | doesn't support the clocks and clock-names property. | ||
| 61 | |||
| 62 | xceiver-supply: | ||
| 63 | description: Regulator that powers the CAN transceiver. | ||
| 64 | |||
| 65 | big-endian: | ||
| 66 | $ref: /schemas/types.yaml#/definitions/flag | ||
| 67 | description: | | ||
| 68 | This means the registers of FlexCAN controller are big endian. This is | ||
| 69 | optional property.i.e. if this property is not present in device tree | ||
| 70 | node then controller is assumed to be little endian. If this property is | ||
| 71 | present then controller is assumed to be big endian. | ||
| 72 | |||
| 73 | fsl,stop-mode: | ||
| 74 | description: | | ||
| 75 | Register bits of stop mode control. | ||
| 76 | |||
| 77 | The format should be as follows: | ||
| 78 | <gpr req_gpr req_bit> | ||
| 79 | gpr is the phandle to general purpose register node. | ||
| 80 | req_gpr is the gpr register offset of CAN stop request. | ||
| 81 | req_bit is the bit offset of CAN stop request. | ||
| 82 | $ref: /schemas/types.yaml#/definitions/phandle-array | ||
| 83 | items: | ||
| 84 | - description: The 'gpr' is the phandle to general purpose register node. | ||
| 85 | - description: The 'req_gpr' is the gpr register offset of CAN stop request. | ||
| 86 | maximum: 0xff | ||
| 87 | - description: The 'req_bit' is the bit offset of CAN stop request. | ||
| 88 | maximum: 0x1f | ||
| 89 | |||
| 90 | fsl,clk-source: | ||
| 91 | description: | | ||
| 92 | Select the clock source to the CAN Protocol Engine (PE). It's SoC | ||
| 93 | implementation dependent. Refer to RM for detailed definition. If this | ||
| 94 | property is not set in device tree node then driver selects clock source 1 | ||
| 95 | by default. | ||
| 96 | 0: clock source 0 (oscillator clock) | ||
| 97 | 1: clock source 1 (peripheral clock) | ||
| 98 | $ref: /schemas/types.yaml#/definitions/uint32 | ||
| 99 | default: 1 | ||
| 100 | minimum: 0 | ||
| 101 | maximum: 1 | ||
| 102 | |||
| 103 | wakeup-source: | ||
| 104 | $ref: /schemas/types.yaml#/definitions/flag | ||
| 105 | description: | ||
| 106 | Enable CAN remote wakeup. | ||
| 107 | |||
| 108 | required: | ||
| 109 | - compatible | ||
| 110 | - reg | ||
| 111 | - interrupts | ||
| 112 | |||
| 113 | additionalProperties: false | ||
| 114 | |||
| 115 | examples: | ||
| 116 | - | | ||
| 117 | can@1c000 { | ||
| 118 | compatible = "fsl,p1010-flexcan"; | ||
| 119 | reg = <0x1c000 0x1000>; | ||
| 120 | interrupts = <48 0x2>; | ||
| 121 | interrupt-parent = <&mpic>; | ||
| 122 | clock-frequency = <200000000>; | ||
| 123 | fsl,clk-source = <0>; | ||
| 124 | }; | ||
| 125 | - | | ||
| 126 | #include <dt-bindings/interrupt-controller/irq.h> | ||
| 127 | |||
| 128 | can@2090000 { | ||
| 129 | compatible = "fsl,imx6q-flexcan"; | ||
| 130 | reg = <0x02090000 0x4000>; | ||
| 131 | interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>; | ||
| 132 | clocks = <&clks 1>, <&clks 2>; | ||
| 133 | clock-names = "ipg", "per"; | ||
| 134 | fsl,stop-mode = <&gpr 0x34 28>; | ||
| 135 | }; | ||
| @@ -1,57 +0,0 @@ | |||
| 1 | Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC). | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | |||
| 5 | - compatible : Should be "fsl,<processor>-flexcan" | ||
| 6 | |||
| 7 | where <processor> is imx8qm, imx6q, imx28, imx53, imx35, imx25, p1010, | ||
| 8 | vf610, ls1021ar2, lx2160ar1, ls1028ar1. | ||
| 9 | |||
| 10 | The ls1028ar1 must be followed by lx2160ar1, e.g. | ||
| 11 | - "fsl,ls1028ar1-flexcan", "fsl,lx2160ar1-flexcan" | ||
| 12 | |||
| 13 | An implementation should also claim any of the following compatibles | ||
| 14 | that it is fully backwards compatible with: | ||
| 15 | |||
| 16 | - fsl,p1010-flexcan | ||
| 17 | |||
| 18 | - reg : Offset and length of the register set for this device | ||
| 19 | - interrupts : Interrupt tuple for this device | ||
| 20 | |||
| 21 | Optional properties: | ||
| 22 | |||
| 23 | - clock-frequency : The oscillator frequency driving the flexcan device | ||
| 24 | |||
| 25 | - xceiver-supply: Regulator that powers the CAN transceiver | ||
| 26 | |||
| 27 | - big-endian: This means the registers of FlexCAN controller are big endian. | ||
| 28 | This is optional property.i.e. if this property is not present in | ||
| 29 | device tree node then controller is assumed to be little endian. | ||
| 30 | if this property is present then controller is assumed to be big | ||
| 31 | endian. | ||
| 32 | |||
| 33 | - fsl,stop-mode: register bits of stop mode control, the format is | ||
| 34 | <&gpr req_gpr req_bit>. | ||
| 35 | gpr is the phandle to general purpose register node. | ||
| 36 | req_gpr is the gpr register offset of CAN stop request. | ||
| 37 | req_bit is the bit offset of CAN stop request. | ||
| 38 | |||
| 39 | - fsl,clk-source: Select the clock source to the CAN Protocol Engine (PE). | ||
| 40 | It's SoC Implementation dependent. Refer to RM for detailed | ||
| 41 | definition. If this property is not set in device tree node | ||
| 42 | then driver selects clock source 1 by default. | ||
| 43 | 0: clock source 0 (oscillator clock) | ||
| 44 | 1: clock source 1 (peripheral clock) | ||
| 45 | |||
| 46 | - wakeup-source: enable CAN remote wakeup | ||
| 47 | |||
| 48 | Example: | ||
| 49 | |||
| 50 | can@1c000 { | ||
| 51 | compatible = "fsl,p1010-flexcan"; | ||
| 52 | reg = <0x1c000 0x1000>; | ||
| 53 | interrupts = <48 0x2>; | ||
| 54 | interrupt-parent = <&mpic>; | ||
| 55 | clock-frequency = <200000000>; // filled in by bootloader | ||
| 56 | fsl,clk-source = <0>; // select clock source 0 for PE | ||
| 57 | }; | ||
| @@ -86,9 +86,6 @@ Other Functions · 85 unmodified lines | |||
| 86 | .. kernel-doc:: fs/dax.c | 86 | .. kernel-doc:: fs/dax.c |
| 87 | :export: | 87 | :export: |
| 88 | 88 | ||
| 89 | .. kernel-doc:: fs/direct-io.c | ||
| 90 | :export: | ||
| 91 | |||
| 92 | .. kernel-doc:: fs/libfs.c | 89 | .. kernel-doc:: fs/libfs.c |
| 93 | :export: | 90 | :export: |
| 94 | 91 | ||
| @@ -83,10 +83,6 @@ AMDGPU XGMI Support · 82 unmodified lines | |||
| 83 | =================== | 83 | =================== |
| 84 | 84 | ||
| 85 | .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 85 | .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c |
| 86 | :doc: AMDGPU XGMI Support | ||
| 87 | |||
| 88 | .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | ||
| 89 | :internal: | ||
| 90 | 86 | ||
| 91 | AMDGPU RAS Support | 87 | AMDGPU RAS Support |
| 92 | ================== | 88 | ================== |
| @@ -124,9 +120,6 @@ RAS VRAM Bad Pages sysfs Interface · 31 unmodified lines | |||
| 124 | .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 120 | .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c |
| 125 | :doc: AMDGPU RAS sysfs gpu_vram_bad_pages Interface | 121 | :doc: AMDGPU RAS sysfs gpu_vram_bad_pages Interface |
| 126 | 122 | ||
| 127 | .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | ||
| 128 | :internal: | ||
| 129 | |||
| 130 | Sample Code | 123 | Sample Code |
| 131 | ----------- | 124 | ----------- |
| 132 | Sample code for testing error injection can be found here: | 125 | Sample code for testing error injection can be found here: |
| @@ -20,7 +20,7 @@ ADM1266 is a sequencer that features voltage readback from 17 channels via an · 19 unmodified lines | |||
| 20 | integrated 12 bit SAR ADC, accessed using a PMBus interface. | 20 | integrated 12 bit SAR ADC, accessed using a PMBus interface. |
| 21 | 21 | ||
| 22 | The driver is a client driver to the core PMBus driver. Please see | 22 | The driver is a client driver to the core PMBus driver. Please see |
| 23 | Documentation/hwmon/pmbus for details on PMBus client drivers. | 23 | Documentation/hwmon/pmbus.rst for details on PMBus client drivers. |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | Sysfs entries | 26 | Sysfs entries |
| @@ -132,6 +132,7 @@ Hardware Monitoring Kernel Drivers · 131 unmodified lines | |||
| 132 | mcp3021 | 132 | mcp3021 |
| 133 | menf21bmc | 133 | menf21bmc |
| 134 | mlxreg-fan | 134 | mlxreg-fan |
| 135 | mp2975 | ||
| 135 | nct6683 | 136 | nct6683 |
| 136 | nct6775 | 137 | nct6775 |
| 137 | nct7802 | 138 | nct7802 |
| @@ -20,6 +20,7 @@ This driver implements support for Monolithic Power Systems, Inc. (MPS) · 19 unmodified lines | |||
| 20 | vendor dual-loop, digital, multi-phase controller MP2975. | 20 | vendor dual-loop, digital, multi-phase controller MP2975. |
| 21 | 21 | ||
| 22 | This device: | 22 | This device: |
| 23 | |||
| 23 | - Supports up to two power rail. | 24 | - Supports up to two power rail. |
| 24 | - Provides 8 pulse-width modulations (PWMs), and can be configured up | 25 | - Provides 8 pulse-width modulations (PWMs), and can be configured up |
| 25 | to 8-phase operation for rail 1 and up to 4-phase operation for rail | 26 | to 8-phase operation for rail 1 and up to 4-phase operation for rail |
| @@ -32,10 +33,12 @@ This device: · 6 unmodified lines | |||
| 32 | 10-mV DAC, IMVP9 mode with 5-mV DAC. | 33 | 10-mV DAC, IMVP9 mode with 5-mV DAC. |
| 33 | 34 | ||
| 34 | Device supports: | 35 | Device supports: |
| 36 | |||
| 35 | - SVID interface. | 37 | - SVID interface. |
| 36 | - AVSBus interface. | 38 | - AVSBus interface. |
| 37 | 39 | ||
| 38 | Device complaint with: | 40 | Device complaint with: |
| 41 | |||
| 39 | - PMBus rev 1.3 interface. | 42 | - PMBus rev 1.3 interface. |
| 40 | 43 | ||
| 41 | Device supports direct format for reading output current, output voltage, | 44 | Device supports direct format for reading output current, output voltage, |
| @@ -45,11 +48,14 @@ Device supports VID and direct formats for reading output voltage. · 3 unmodified lines | |||
| 45 | The below VID modes are supported: VR12, VR13, IMVP9. | 48 | The below VID modes are supported: VR12, VR13, IMVP9. |
| 46 | 49 | ||
| 47 | The driver provides the next attributes for the current: | 50 | The driver provides the next attributes for the current: |
| 51 | |||
| 48 | - for current in: input, maximum alarm; | 52 | - for current in: input, maximum alarm; |
| 49 | - for current out input, maximum alarm and highest values; | 53 | - for current out input, maximum alarm and highest values; |
| 50 | - for phase current: input and label. | 54 | - for phase current: input and label. |
| 51 | attributes. | 55 | attributes. |
| 56 | |||
| 52 | The driver exports the following attributes via the 'sysfs' files, where | 57 | The driver exports the following attributes via the 'sysfs' files, where |
| 58 | |||
| 53 | - 'n' is number of telemetry pages (from 1 to 2); | 59 | - 'n' is number of telemetry pages (from 1 to 2); |
| 54 | - 'k' is number of configured phases (from 1 to 8); | 60 | - 'k' is number of configured phases (from 1 to 8); |
| 55 | - indexes 1, 1*n for "iin"; | 61 | - indexes 1, 1*n for "iin"; |
| @@ -65,11 +71,14 @@ The driver exports the following attributes via the 'sysfs' files, where · 9 unmodified lines | |||
| 65 | **curr[1-{2n+k}]_label** | 71 | **curr[1-{2n+k}]_label** |
| 66 | 72 | ||
| 67 | The driver provides the next attributes for the voltage: | 73 | The driver provides the next attributes for the voltage: |
| 74 | |||
| 68 | - for voltage in: input, high critical threshold, high critical alarm, all only | 75 | - for voltage in: input, high critical threshold, high critical alarm, all only |
| 69 | from page 0; | 76 | from page 0; |
| 70 | - for voltage out: input, low and high critical thresholds, low and high | 77 | - for voltage out: input, low and high critical thresholds, low and high |
| 71 | critical alarms, from pages 0 and 1; | 78 | critical alarms, from pages 0 and 1; |
| 79 | |||
| 72 | The driver exports the following attributes via the 'sysfs' files, where | 80 | The driver exports the following attributes via the 'sysfs' files, where |
| 81 | |||
| 73 | - 'n' is number of telemetry pages (from 1 to 2); | 82 | - 'n' is number of telemetry pages (from 1 to 2); |
| 74 | - indexes 1 for "iin"; | 83 | - indexes 1 for "iin"; |
| 75 | - indexes n+1, n+2 for "vout"; | 84 | - indexes n+1, n+2 for "vout"; |
| @@ -87,9 +96,12 @@ The driver exports the following attributes via the 'sysfs' files, where · 11 unmodified lines | |||
| 87 | **in[2-{n+1}1_lcrit_alarm** | 96 | **in[2-{n+1}1_lcrit_alarm** |
| 88 | 97 | ||
| 89 | The driver provides the next attributes for the power: | 98 | The driver provides the next attributes for the power: |
| 99 | |||
| 90 | - for power in alarm and input. | 100 | - for power in alarm and input. |
| 91 | - for power out: highest and input. | 101 | - for power out: highest and input. |
| 102 | |||
| 92 | The driver exports the following attributes via the 'sysfs' files, where | 103 | The driver exports the following attributes via the 'sysfs' files, where |
| 104 | |||
| 93 | - 'n' is number of telemetry pages (from 1 to 2); | 105 | - 'n' is number of telemetry pages (from 1 to 2); |
| 94 | - indexes 1 for "pin"; | 106 | - indexes 1 for "pin"; |
| 95 | - indexes n+1, n+2 for "pout"; | 107 | - indexes n+1, n+2 for "pout"; |
| @@ -25,3 +25,4 @@ LEDs · 24 unmodified lines | |||
| 25 | leds-lp5562 | 25 | leds-lp5562 |
| 26 | leds-lp55xx | 26 | leds-lp55xx |
| 27 | leds-mlxcpld | 27 | leds-mlxcpld |
| 28 | leds-sc27xx | ||
| @@ -42,6 +42,7 @@ The validator tracks lock-class usage history and divides the usage into · 41 unmodified lines | |||
| 42 | (4 usages * n STATEs + 1) categories: | 42 | (4 usages * n STATEs + 1) categories: |
| 43 | 43 | ||
| 44 | where the 4 usages can be: | 44 | where the 4 usages can be: |
| 45 | |||
| 45 | - 'ever held in STATE context' | 46 | - 'ever held in STATE context' |
| 46 | - 'ever held as readlock in STATE context' | 47 | - 'ever held as readlock in STATE context' |
| 47 | - 'ever held with STATE enabled' | 48 | - 'ever held with STATE enabled' |
| @@ -49,10 +50,12 @@ where the 4 usages can be: · 1 unmodified line | |||
| 49 | 50 | ||
| 50 | where the n STATEs are coded in kernel/locking/lockdep_states.h and as of | 51 | where the n STATEs are coded in kernel/locking/lockdep_states.h and as of |
| 51 | now they include: | 52 | now they include: |
| 53 | |||
| 52 | - hardirq | 54 | - hardirq |
| 53 | - softirq | 55 | - softirq |
| 54 | 56 | ||
| 55 | where the last 1 category is: | 57 | where the last 1 category is: |
| 58 | |||
| 56 | - 'ever used' [ == !unused ] | 59 | - 'ever used' [ == !unused ] |
| 57 | 60 | ||
| 58 | When locking rules are violated, these usage bits are presented in the | 61 | When locking rules are violated, these usage bits are presented in the |
| @@ -96,9 +99,9 @@ exact case is for the lock as of the reporting time. · 37 unmodified lines | |||
| 96 | +--------------+-------------+--------------+ | 99 | +--------------+-------------+--------------+ |
| 97 | | | irq enabled | irq disabled | | 100 | | | irq enabled | irq disabled | |
| 98 | +--------------+-------------+--------------+ | 101 | +--------------+-------------+--------------+ |
| 99 | | ever in irq | ? | - | | 102 | | ever in irq | '?' | '-' | |
| 100 | +--------------+-------------+--------------+ | 103 | +--------------+-------------+--------------+ |
| 101 | | never in irq | + | . | | 104 | | never in irq | '+' | '.' | |
| 102 | +--------------+-------------+--------------+ | 105 | +--------------+-------------+--------------+ |
| 103 | 106 | ||
| 104 | The character '-' suggests irq is disabled because if otherwise the | 107 | The character '-' suggests irq is disabled because if otherwise the |
| @@ -216,7 +219,7 @@ looks like this:: · 111 unmodified lines | |||
| 216 | BD_MUTEX_PARTITION | 219 | BD_MUTEX_PARTITION |
| 217 | }; | 220 | }; |
| 218 | 221 | ||
| 219 | mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_PARTITION); | 222 | mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_PARTITION); |
| 220 | 223 | ||
| 221 | In this case the locking is done on a bdev object that is known to be a | 224 | In this case the locking is done on a bdev object that is known to be a |
| 222 | partition. | 225 | partition. |
| @@ -334,7 +337,7 @@ Troubleshooting: · 111 unmodified lines | |||
| 334 | ---------------- | 337 | ---------------- |
| 335 | 338 | ||
| 336 | The validator tracks a maximum of MAX_LOCKDEP_KEYS number of lock classes. | 339 | The validator tracks a maximum of MAX_LOCKDEP_KEYS number of lock classes. |
| 337 | Exceeding this number will trigger the following lockdep warning: | 340 | Exceeding this number will trigger the following lockdep warning:: |
| 338 | 341 | ||
| 339 | (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS)) | 342 | (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS)) |
| 340 | 343 | ||
| @@ -420,7 +423,8 @@ the critical section of another reader of the same lock instance. · 79 unmodified lines | |||
| 420 | 423 | ||
| 421 | The difference between recursive readers and non-recursive readers is because: | 424 | The difference between recursive readers and non-recursive readers is because: |
| 422 | recursive readers get blocked only by a write lock *holder*, while non-recursive | 425 | recursive readers get blocked only by a write lock *holder*, while non-recursive |
| 423 | readers could get blocked by a write lock *waiter*. Considering the follow example: | 426 | readers could get blocked by a write lock *waiter*. Considering the follow |
| 427 | example:: | ||
| 424 | 428 | ||
| 425 | TASK A: TASK B: | 429 | TASK A: TASK B: |
| 426 | 430 | ||
| @@ -448,20 +452,22 @@ There are simply four block conditions: · 21 unmodified lines | |||
| 448 | 452 | ||
| 449 | Block condition matrix, Y means the row blocks the column, and N means otherwise. | 453 | Block condition matrix, Y means the row blocks the column, and N means otherwise. |
| 450 | 454 | ||
| 451 | | E | r | R | | ||
| 452 | +---+---+---+---+ | 455 | +---+---+---+---+ |
| 453 | E | Y | Y | Y | | 456 | | | E | r | R | |
| 457 | +---+---+---+---+ | ||
| 458 | | E | Y | Y | Y | | ||
| 459 | +---+---+---+---+ | ||
| 460 | | r | Y | Y | N | | ||
| 454 | +---+---+---+---+ | 461 | +---+---+---+---+ |
| 455 | r | Y | Y | N | | 462 | | R | Y | Y | N | |
| 456 | +---+---+---+---+ | 463 | +---+---+---+---+ |
| 457 | R | Y | Y | N | | ||
| 458 | 464 | ||
| 459 | (W: writers, r: non-recursive readers, R: recursive readers) | 465 | (W: writers, r: non-recursive readers, R: recursive readers) |
| 460 | 466 | ||
| 461 | 467 | ||
| 462 | acquired recursively. Unlike non-recursive read locks, recursive read locks | 468 | acquired recursively. Unlike non-recursive read locks, recursive read locks |
| 463 | only get blocked by current write lock *holders* other than write lock | 469 | only get blocked by current write lock *holders* other than write lock |
| 464 | *waiters*, for example: | 470 | *waiters*, for example:: |
| 465 | 471 | ||
| 466 | TASK A: TASK B: | 472 | TASK A: TASK B: |
| 467 | 473 | ||
| @@ -491,7 +497,7 @@ Recursive locks don't block each other, while non-recursive locks do (this is · 23 unmodified lines | |||
| 491 | even true for two non-recursive read locks). A non-recursive lock can block the | 497 | even true for two non-recursive read locks). A non-recursive lock can block the |
| 492 | corresponding recursive lock, and vice versa. | 498 | corresponding recursive lock, and vice versa. |
| 493 | 499 | ||
| 494 | A deadlock case with recursive locks involved is as follow: | 500 | A deadlock case with recursive locks involved is as follow:: |
| 495 | 501 | ||
| 496 | TASK A: TASK B: | 502 | TASK A: TASK B: |
| 497 | 503 | ||
| @@ -510,7 +516,7 @@ because there are 3 types for lockers, there are, in theory, 9 types of lock · 12 unmodified lines | |||
| 510 | dependencies, but we can show that 4 types of lock dependencies are enough for | 516 | dependencies, but we can show that 4 types of lock dependencies are enough for |
| 511 | deadlock detection. | 517 | deadlock detection. |
| 512 | 518 | ||
| 513 | For each lock dependency: | 519 | For each lock dependency:: |
| 514 | 520 | ||
| 515 | L1 -> L2 | 521 | L1 -> L2 |
| 516 | 522 | ||
| @@ -525,20 +531,25 @@ same types). · 8 unmodified lines | |||
| 525 | With the above combination for simplification, there are 4 types of dependency edges | 531 | With the above combination for simplification, there are 4 types of dependency edges |
| 526 | in the lockdep graph: | 532 | in the lockdep graph: |
| 527 | 533 | ||
| 528 | 1) -(ER)->: exclusive writer to recursive reader dependency, "X -(ER)-> Y" means | 534 | 1) -(ER)->: |
| 535 | exclusive writer to recursive reader dependency, "X -(ER)-> Y" means | ||
| 529 | X -> Y and X is a writer and Y is a recursive reader. | 536 | X -> Y and X is a writer and Y is a recursive reader. |
| 530 | 537 | ||
| 531 | 2) -(EN)->: exclusive writer to non-recursive locker dependency, "X -(EN)-> Y" means | 538 | 2) -(EN)->: |
| 539 | exclusive writer to non-recursive locker dependency, "X -(EN)-> Y" means | ||
| 532 | X -> Y and X is a writer and Y is either a writer or non-recursive reader. | 540 | X -> Y and X is a writer and Y is either a writer or non-recursive reader. |
| 533 | 541 | ||
| 534 | 3) -(SR)->: shared reader to recursive reader dependency, "X -(SR)-> Y" means | 542 | 3) -(SR)->: |
| 543 | shared reader to recursive reader dependency, "X -(SR)-> Y" means | ||
| 535 | X -> Y and X is a reader (recursive or not) and Y is a recursive reader. | 544 | X -> Y and X is a reader (recursive or not) and Y is a recursive reader. |
| 536 | 545 | ||
| 537 | 4) -(SN)->: shared reader to non-recursive locker dependency, "X -(SN)-> Y" means | 546 | 4) -(SN)->: |
| 547 | shared reader to non-recursive locker dependency, "X -(SN)-> Y" means | ||
| 538 | X -> Y and X is a reader (recursive or not) and Y is either a writer or | 548 | X -> Y and X is a reader (recursive or not) and Y is either a writer or |
| 539 | non-recursive reader. | 549 | non-recursive reader. |
| 540 | 550 | ||
| 541 | Note that given two locks, they may have multiple dependencies between them, for example: | 551 | Note that given two locks, they may have multiple dependencies between them, |
| 552 | for example:: | ||
| 542 | 553 | ||
| 543 | TASK A: | 554 | TASK A: |
| 544 | 555 | ||
| @@ -592,11 +603,11 @@ circles that won't cause deadlocks. · 47 unmodified lines | |||
| 592 | 603 | ||
| 593 | Proof for sufficiency (Lemma 1): | 604 | Proof for sufficiency (Lemma 1): |
| 594 | 605 | ||
| 595 | Let's say we have a strong circle: | 606 | Let's say we have a strong circle:: |
| 596 | 607 | ||
| 597 | L1 -> L2 ... -> Ln -> L1 | 608 | L1 -> L2 ... -> Ln -> L1 |
| 598 | 609 | ||
| 599 | , which means we have dependencies: | 610 | , which means we have dependencies:: |
| 600 | 611 | ||
| 601 | L1 -> L2 | 612 | L1 -> L2 |
| 602 | L2 -> L3 | 613 | L2 -> L3 |
| @@ -633,7 +644,7 @@ a lock held by P2, and P2 is waiting for a lock held by P3, ... and Pn is waitin · 30 unmodified lines | |||
| 633 | for a lock held by P1. Let's name the lock Px is waiting as Lx, so since P1 is waiting | 644 | for a lock held by P1. Let's name the lock Px is waiting as Lx, so since P1 is waiting |
| 634 | for L1 and holding Ln, so we will have Ln -> L1 in the dependency graph. Similarly, | 645 | for L1 and holding Ln, so we will have Ln -> L1 in the dependency graph. Similarly, |
| 635 | we have L1 -> L2, L2 -> L3, ..., Ln-1 -> Ln in the dependency graph, which means we | 646 | we have L1 -> L2, L2 -> L3, ..., Ln-1 -> Ln in the dependency graph, which means we |
| 636 | have a circle: | 647 | have a circle:: |
| 637 | 648 | ||
| 638 | Ln -> L1 -> L2 -> ... -> Ln | 649 | Ln -> L1 -> L2 -> ... -> Ln |
| 639 | 650 | ||
| @@ -24,7 +24,6 @@ fit into other categories. · 23 unmodified lines | |||
| 24 | isl29003 | 24 | isl29003 |
| 25 | lis3lv02d | 25 | lis3lv02d |
| 26 | max6875 | 26 | max6875 |
| 27 | mic/index | ||
| 28 | pci-endpoint-test | 27 | pci-endpoint-test |
| 29 | spear-pcie-gadget | 28 | spear-pcie-gadget |
| 30 | uacce | 29 | uacce |
| @@ -70,6 +70,7 @@ The ``ice`` driver reports the following versions · 69 unmodified lines | |||
| 70 | that both the name (as reported by ``fw.app.name``) and version are | 70 | that both the name (as reported by ``fw.app.name``) and version are |
| 71 | required to uniquely identify the package. | 71 | required to uniquely identify the package. |
| 72 | * - ``fw.app.bundle_id`` | 72 | * - ``fw.app.bundle_id`` |
| 73 | - running | ||
| 73 | - 0xc0000001 | 74 | - 0xc0000001 |
| 74 | - Unique identifier for the DDP package loaded in the device. Also | 75 | - Unique identifier for the DDP package loaded in the device. Also |
| 75 | referred to as the DDP Track ID. Can be used to uniquely identify | 76 | referred to as the DDP Track ID. Can be used to uniquely identify |
| @@ -10,9 +10,9 @@ Overview / What Is J1939 · 9 unmodified lines | |||
| 10 | SAE J1939 defines a higher layer protocol on CAN. It implements a more | 10 | SAE J1939 defines a higher layer protocol on CAN. It implements a more |
| 11 | sophisticated addressing scheme and extends the maximum packet size above 8 | 11 | sophisticated addressing scheme and extends the maximum packet size above 8 |
| 12 | bytes. Several derived specifications exist, which differ from the original | 12 | bytes. Several derived specifications exist, which differ from the original |
| 13 | J1939 on the application level, like MilCAN A, NMEA2000 and especially | 13 | J1939 on the application level, like MilCAN A, NMEA2000, and especially |
| 14 | ISO-11783 (ISOBUS). This last one specifies the so-called ETP (Extended | 14 | ISO-11783 (ISOBUS). This last one specifies the so-called ETP (Extended |
| 15 | Transport Protocol) which is has been included in this implementation. This | 15 | Transport Protocol), which has been included in this implementation. This |
| 16 | results in a maximum packet size of ((2 ^ 24) - 1) * 7 bytes == 111 MiB. | 16 | results in a maximum packet size of ((2 ^ 24) - 1) * 7 bytes == 111 MiB. |
| 17 | 17 | ||
| 18 | Specifications used | 18 | Specifications used |
| @@ -32,15 +32,15 @@ sockets, we found some reasons to justify a kernel implementation for the · 13 unmodified lines | |||
| 32 | addressing and transport methods used by J1939. | 32 | addressing and transport methods used by J1939. |
| 33 | 33 | ||
| 34 | * **Addressing:** when a process on an ECU communicates via J1939, it should | 34 | * **Addressing:** when a process on an ECU communicates via J1939, it should |
| 35 | not necessarily know its source address. Although at least one process per | 35 | not necessarily know its source address. Although, at least one process per |
| 36 | ECU should know the source address. Other processes should be able to reuse | 36 | ECU should know the source address. Other processes should be able to reuse |
| 37 | that address. This way, address parameters for different processes | 37 | that address. This way, address parameters for different processes |
| 38 | cooperating for the same ECU, are not duplicated. This way of working is | 38 | cooperating for the same ECU, are not duplicated. This way of working is |
| 39 | closely related to the UNIX concept where programs do just one thing, and do | 39 | closely related to the UNIX concept, where programs do just one thing and do |
| 40 | it well. | 40 | it well. |
| 41 | 41 | ||
| 42 | * **Dynamic addressing:** Address Claiming in J1939 is time critical. | 42 | * **Dynamic addressing:** Address Claiming in J1939 is time critical. |
| 43 | Furthermore data transport should be handled properly during the address | 43 | Furthermore, data transport should be handled properly during the address |
| 44 | negotiation. Putting this functionality in the kernel eliminates it as a | 44 | negotiation. Putting this functionality in the kernel eliminates it as a |
| 45 | requirement for _every_ user space process that communicates via J1939. This | 45 | requirement for _every_ user space process that communicates via J1939. This |
| 46 | results in a consistent J1939 bus with proper addressing. | 46 | results in a consistent J1939 bus with proper addressing. |
| @@ -58,7 +58,7 @@ Therefore, these parts are left to user space. · 11 unmodified lines | |||
| 58 | 58 | ||
| 59 | The J1939 sockets operate on CAN network devices (see SocketCAN). Any J1939 | 59 | The J1939 sockets operate on CAN network devices (see SocketCAN). Any J1939 |
| 60 | user space library operating on CAN raw sockets will still operate properly. | 60 | user space library operating on CAN raw sockets will still operate properly. |
| 61 | Since such library does not communicate with the in-kernel implementation, care | 61 | Since such a library does not communicate with the in-kernel implementation, care |
| 62 | must be taken that these two do not interfere. In practice, this means they | 62 | must be taken that these two do not interfere. In practice, this means they |
| 63 | cannot share ECU addresses. A single ECU (or virtual ECU) address is used by | 63 | cannot share ECU addresses. A single ECU (or virtual ECU) address is used by |
| 64 | the library exclusively, or by the in-kernel system exclusively. | 64 | the library exclusively, or by the in-kernel system exclusively. |
| @@ -77,13 +77,13 @@ is composed as follows: · 12 unmodified lines | |||
| 77 | 8 bits : PS (PDU Specific) | 77 | 8 bits : PS (PDU Specific) |
| 78 | 78 | ||
| 79 | In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2 | 79 | In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2 |
| 80 | format (where PF >= 240). Furthermore, when using PDU2 format, the PS-field | 80 | format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field |
| 81 | contains a so-called Group Extension, which is part of the PGN. When using PDU2 | 81 | contains a so-called Group Extension, which is part of the PGN. When using PDU2 |
| 82 | format, the Group Extension is set in the PS-field. | 82 | format, the Group Extension is set in the PS-field. |
| 83 | 83 | ||
| 84 | On the other hand, when using PDU1 format, the PS-field contains a so-called | 84 | On the other hand, when using PDU1 format, the PS-field contains a so-called |
| 85 | Destination Address, which is _not_ part of the PGN. When communicating a PGN | 85 | Destination Address, which is _not_ part of the PGN. When communicating a PGN |
| 86 | from user space to kernel (or visa versa) and PDU2 format is used, the PS-field | 86 | from user space to kernel (or vice versa) and PDU2 format is used, the PS-field |
| 87 | of the PGN shall be set to zero. The Destination Address shall be set | 87 | of the PGN shall be set to zero. The Destination Address shall be set |
| 88 | elsewhere. | 88 | elsewhere. |
| 89 | 89 | ||
| @@ -96,15 +96,15 @@ Addressing · 6 unmodified lines | |||
| 96 | 96 | ||
| 97 | Both static and dynamic addressing methods can be used. | 97 | Both static and dynamic addressing methods can be used. |
| 98 | 98 | ||
| 99 | For static addresses, no extra checks are made by the kernel, and provided | 99 | For static addresses, no extra checks are made by the kernel and provided |
| 100 | addresses are considered right. This responsibility is for the OEM or system | 100 | addresses are considered right. This responsibility is for the OEM or system |
| 101 | integrator. | 101 | integrator. |
| 102 | 102 | ||
| 103 | For dynamic addressing, so-called Address Claiming, extra support is foreseen | 103 | For dynamic addressing, so-called Address Claiming, extra support is foreseen |
| 104 | in the kernel. In J1939 any ECU is known by it's 64-bit NAME. At the moment of | 104 | in the kernel. In J1939 any ECU is known by its 64-bit NAME. At the moment of |
| 105 | a successful address claim, the kernel keeps track of both NAME and source | 105 | a successful address claim, the kernel keeps track of both NAME and source |
| 106 | address being claimed. This serves as a base for filter schemes. By default, | 106 | address being claimed. This serves as a base for filter schemes. By default, |
| 107 | packets with a destination that is not locally, will be rejected. | 107 | packets with a destination that is not locally will be rejected. |
| 108 | 108 | ||
| 109 | Mixed mode packets (from a static to a dynamic address or vice versa) are | 109 | Mixed mode packets (from a static to a dynamic address or vice versa) are |
| 110 | allowed. The BSD sockets define separate API calls for getting/setting the | 110 | allowed. The BSD sockets define separate API calls for getting/setting the |
| @@ -131,31 +131,31 @@ API Calls · 20 unmodified lines | |||
| 131 | --------- | 131 | --------- |
| 132 | 132 | ||
| 133 | On CAN, you first need to open a socket for communicating over a CAN network. | 133 | On CAN, you first need to open a socket for communicating over a CAN network. |
| 134 | To use J1939, #include <linux/can/j1939.h>. From there, <linux/can.h> will be | 134 | To use J1939, ``#include <linux/can/j1939.h>``. From there, ``<linux/can.h>`` will be |
| 135 | included too. To open a socket, use: | 135 | included too. To open a socket, use: |
| 136 | 136 | ||
| 137 | .. code-block:: C | 137 | .. code-block:: C |
| 138 | 138 | ||
| 139 | s = socket(PF_CAN, SOCK_DGRAM, CAN_J1939); | 139 | s = socket(PF_CAN, SOCK_DGRAM, CAN_J1939); |
| 140 | 140 | ||
| 141 | J1939 does use SOCK_DGRAM sockets. In the J1939 specification, connections are | 141 | J1939 does use ``SOCK_DGRAM`` sockets. In the J1939 specification, connections are |
| 142 | mentioned in the context of transport protocol sessions. These still deliver | 142 | mentioned in the context of transport protocol sessions. These still deliver |
| 143 | packets to the other end (using several CAN packets). SOCK_STREAM is not | 143 | packets to the other end (using several CAN packets). ``SOCK_STREAM`` is not |
| 144 | supported. | 144 | supported. |
| 145 | 145 | ||
| 146 | After the successful creation of the socket, you would normally use the bind(2) | 146 | After the successful creation of the socket, you would normally use the ``bind(2)`` |
| 147 | and/or connect(2) system call to bind the socket to a CAN interface. After | 147 | and/or ``connect(2)`` system call to bind the socket to a CAN interface. After |
| 148 | binding and/or connecting the socket, you can read(2) and write(2) from/to the | 148 | binding and/or connecting the socket, you can ``read(2)`` and ``write(2)`` from/to the |
| 149 | socket or use send(2), sendto(2), sendmsg(2) and the recv*() counterpart | 149 | socket or use ``send(2)``, ``sendto(2)``, ``sendmsg(2)`` and the ``recv*()`` counterpart |
| 150 | operations on the socket as usual. There are also J1939 specific socket options | 150 | operations on the socket as usual. There are also J1939 specific socket options |
| 151 | described below. | 151 | described below. |
| 152 | 152 | ||
| 153 | In order to send data, a bind(2) must have been successful. bind(2) assigns a | 153 | In order to send data, a ``bind(2)`` must have been successful. ``bind(2)`` assigns a |
| 154 | local address to a socket. | 154 | local address to a socket. |
| 155 | 155 | ||
| 156 | Different from CAN is that the payload data is just the data that get send, | 156 | Different from CAN is that the payload data is just the data that get sends, |
| 157 | without it's header info. The header info is derived from the sockaddr supplied | 157 | without its header info. The header info is derived from the sockaddr supplied |
| 158 | to bind(2), connect(2), sendto(2) and recvfrom(2). A write(2) with size 4 will | 158 | to ``bind(2)``, ``connect(2)``, ``sendto(2)`` and ``recvfrom(2)``. A ``write(2)`` with size 4 will |
| 159 | result in a packet with 4 bytes. | 159 | result in a packet with 4 bytes. |
| 160 | 160 | ||
| 161 | The sockaddr structure has extensions for use with J1939 as specified below: | 161 | The sockaddr structure has extensions for use with J1939 as specified below: |
| @@ -180,47 +180,47 @@ The sockaddr structure has extensions for use with J1939 as specified below: · 18 unmodified lines | |||
| 180 | } can_addr; | 180 | } can_addr; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | can_family & can_ifindex serve the same purpose as for other SocketCAN sockets. | 183 | ``can_family`` & ``can_ifindex`` serve the same purpose as for other SocketCAN sockets. |
| 184 | 184 | ||
| 185 | can_addr.j1939.pgn specifies the PGN (max 0x3ffff). Individual bits are | 185 | ``can_addr.j1939.pgn`` specifies the PGN (max 0x3ffff). Individual bits are |
| 186 | specified above. | 186 | specified above. |
| 187 | 187 | ||
| 188 | can_addr.j1939.name contains the 64-bit J1939 NAME. | 188 | ``can_addr.j1939.name`` contains the 64-bit J1939 NAME. |
| 189 | 189 | ||
| 190 | can_addr.j1939.addr contains the address. | 190 | ``can_addr.j1939.addr`` contains the address. |
| 191 | 191 | ||
| 192 | The bind(2) system call assigns the local address, i.e. the source address when | 192 | The ``bind(2)`` system call assigns the local address, i.e. the source address when |
| 193 | sending packages. If a PGN during bind(2) is set, it's used as a RX filter. | 193 | sending packages. If a PGN during ``bind(2)`` is set, it's used as a RX filter. |
| 194 | I.e. only packets with a matching PGN are received. If an ADDR or NAME is set | 194 | I.e. only packets with a matching PGN are received. If an ADDR or NAME is set |
| 195 | it is used as a receive filter, too. It will match the destination NAME or ADDR | 195 | it is used as a receive filter, too. It will match the destination NAME or ADDR |
| 196 | of the incoming packet. The NAME filter will work only if appropriate Address | 196 | of the incoming packet. The NAME filter will work only if appropriate Address |
| 197 | Claiming for this name was done on the CAN bus and registered/cached by the | 197 | Claiming for this name was done on the CAN bus and registered/cached by the |
| 198 | kernel. | 198 | kernel. |
| 199 | 199 | ||
| 200 | On the other hand connect(2) assigns the remote address, i.e. the destination | 200 | On the other hand ``connect(2)`` assigns the remote address, i.e. the destination |
| 201 | address. The PGN from connect(2) is used as the default PGN when sending | 201 | address. The PGN from ``connect(2)`` is used as the default PGN when sending |
| 202 | packets. If ADDR or NAME is set it will be used as the default destination ADDR | 202 | packets. If ADDR or NAME is set it will be used as the default destination ADDR |
| 203 | or NAME. Further a set ADDR or NAME during connect(2) is used as a receive | 203 | or NAME. Further a set ADDR or NAME during ``connect(2)`` is used as a receive |
| 204 | filter. It will match the source NAME or ADDR of the incoming packet. | 204 | filter. It will match the source NAME or ADDR of the incoming packet. |
| 205 | 205 | ||
| 206 | Both write(2) and send(2) will send a packet with local address from bind(2) and | 206 | Both ``write(2)`` and ``send(2)`` will send a packet with local address from ``bind(2)`` and the |
| 207 | the remote address from connect(2). Use sendto(2) to overwrite the destination | 207 | remote address from ``connect(2)``. Use ``sendto(2)`` to overwrite the destination |
| 208 | address. | 208 | address. |
| 209 | 209 | ||
| 210 | If can_addr.j1939.name is set (!= 0) the NAME is looked up by the kernel and | 210 | If ``can_addr.j1939.name`` is set (!= 0) the NAME is looked up by the kernel and |
| 211 | the corresponding ADDR is used. If can_addr.j1939.name is not set (== 0), | 211 | the corresponding ADDR is used. If ``can_addr.j1939.name`` is not set (== 0), |
| 212 | can_addr.j1939.addr is used. | 212 | ``can_addr.j1939.addr`` is used. |
| 213 | 213 | ||
| 214 | When creating a socket, reasonable defaults are set. Some options can be | 214 | When creating a socket, reasonable defaults are set. Some options can be |
| 215 | modified with setsockopt(2) & getsockopt(2). | 215 | modified with ``setsockopt(2)`` & ``getsockopt(2)``. |
| 216 | 216 | ||
| 217 | RX path related options: | 217 | RX path related options: |
| 218 | 218 | ||
| 219 | - SO_J1939_FILTER - configure array of filters | 219 | - ``SO_J1939_FILTER`` - configure array of filters |
| 220 | - SO_J1939_PROMISC - disable filters set by bind(2) and connect(2) | 220 | - ``SO_J1939_PROMISC`` - disable filters set by ``bind(2)`` and ``connect(2)`` |
| 221 | 221 | ||
| 222 | By default no broadcast packets can be send or received. To enable sending or | 222 | By default no broadcast packets can be send or received. To enable sending or |
| 223 | receiving broadcast packets use the socket option SO_BROADCAST: | 223 | receiving broadcast packets use the socket option ``SO_BROADCAST``: |
| 224 | 224 | ||
| 225 | .. code-block:: C | 225 | .. code-block:: C |
| 226 | 226 | ||
| @@ -261,26 +261,26 @@ The following diagram illustrates the RX path: · 34 unmodified lines | |||
| 261 | +---------------------------+ | 261 | +---------------------------+ |
| 262 | 262 | ||
| 263 | TX path related options: | 263 | TX path related options: |
| 264 | SO_J1939_SEND_PRIO - change default send priority for the socket | 264 | ``SO_J1939_SEND_PRIO`` - change default send priority for the socket |
| 265 | 265 | ||
| 266 | Message Flags during send() and Related System Calls | 266 | Message Flags during send() and Related System Calls |
| 267 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 267 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 268 | 268 | ||
| 269 | send(2), sendto(2) and sendmsg(2) take a 'flags' argument. Currently | 269 | ``send(2)``, ``sendto(2)`` and ``sendmsg(2)`` take a 'flags' argument. Currently |
| 270 | supported flags are: | 270 | supported flags are: |
| 271 | 271 | ||
| 272 | * MSG_DONTWAIT, i.e. non-blocking operation. | 272 | * ``MSG_DONTWAIT``, i.e. non-blocking operation. |
| 273 | 273 | ||
| 274 | recvmsg(2) | 274 | recvmsg(2) |
| 275 | ^^^^^^^^^^ | 275 | ^^^^^^^^^^ |
| 276 | 276 | ||
| 277 | In most cases recvmsg(2) is needed if you want to extract more information than | 277 | In most cases ``recvmsg(2)`` is needed if you want to extract more information than |
| 278 | recvfrom(2) can provide. For example package priority and timestamp. The | 278 | ``recvfrom(2)`` can provide. For example package priority and timestamp. The |
| 279 | Destination Address, name and packet priority (if applicable) are attached to | 279 | Destination Address, name and packet priority (if applicable) are attached to |
| 280 | the msghdr in the recvmsg(2) call. They can be extracted using cmsg(3) macros, | 280 | the msghdr in the ``recvmsg(2)`` call. They can be extracted using ``cmsg(3)`` macros, |
| 281 | with cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR, | 281 | with ``cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR``, |
| 282 | SCM_J1939_DEST_NAME or SCM_J1939_PRIO. The returned data is a uint8_t for | 282 | ``SCM_J1939_DEST_NAME`` or ``SCM_J1939_PRIO``. The returned data is a ``uint8_t`` for |
| 283 | priority and dst_addr, and uint64_t for dst_name. | 283 | ``priority`` and ``dst_addr``, and ``uint64_t`` for ``dst_name``. |
| 284 | 284 | ||
| 285 | .. code-block:: C | 285 | .. code-block:: C |
| 286 | 286 | ||
| @@ -305,12 +305,12 @@ Dynamic Addressing · 18 unmodified lines | |||
| 305 | 305 | ||
| 306 | Distinction has to be made between using the claimed address and doing an | 306 | Distinction has to be made between using the claimed address and doing an |
| 307 | address claim. To use an already claimed address, one has to fill in the | 307 | address claim. To use an already claimed address, one has to fill in the |
| 308 | j1939.name member and provide it to bind(2). If the name had claimed an address | 308 | ``j1939.name`` member and provide it to ``bind(2)``. If the name had claimed an address |
| 309 | earlier, all further messages being sent will use that address. And the | 309 | earlier, all further messages being sent will use that address. And the |
| 310 | j1939.addr member will be ignored. | 310 | ``j1939.addr`` member will be ignored. |
| 311 | 311 | ||
| 312 | An exception on this is PGN 0x0ee00. This is the "Address Claim/Cannot Claim | 312 | An exception on this is PGN 0x0ee00. This is the "Address Claim/Cannot Claim |
| 313 | Address" message and the kernel will use the j1939.addr member for that PGN if | 313 | Address" message and the kernel will use the ``j1939.addr`` member for that PGN if |
| 314 | necessary. | 314 | necessary. |
| 315 | 315 | ||
| 316 | To claim an address following code example can be used: | 316 | To claim an address following code example can be used: |
| @@ -371,12 +371,12 @@ NAME can send packets. · 54 unmodified lines | |||
| 371 | 371 | ||
| 372 | If another ECU claims the address, the kernel will mark the NAME-SA expired. | 372 | If another ECU claims the address, the kernel will mark the NAME-SA expired. |
| 373 | No socket bound to the NAME can send packets (other than address claims). To | 373 | No socket bound to the NAME can send packets (other than address claims). To |
| 374 | claim another address, some socket bound to NAME, must bind(2) again, but with | 374 | claim another address, some socket bound to NAME, must ``bind(2)`` again, but with |
| 375 | only j1939.addr changed to the new SA, and must then send a valid address claim | 375 | only ``j1939.addr`` changed to the new SA, and must then send a valid address claim |
| 376 | packet. This restarts the state machine in the kernel (and any other | 376 | packet. This restarts the state machine in the kernel (and any other |
| 377 | participant on the bus) for this NAME. | 377 | participant on the bus) for this NAME. |
| 378 | 378 | ||
| 379 | can-utils also include the jacd tool, so it can be used as code example or as | 379 | ``can-utils`` also include the ``j1939acd`` tool, so it can be used as code example or as |
| 380 | default Address Claiming daemon. | 380 | default Address Claiming daemon. |
| 381 | 381 | ||
| 382 | Send Examples | 382 | Send Examples |
| @@ -403,8 +403,8 @@ Bind: · 20 unmodified lines | |||
| 403 | 403 | ||
| 404 | bind(sock, (struct sockaddr *)&baddr, sizeof(baddr)); | 404 | bind(sock, (struct sockaddr *)&baddr, sizeof(baddr)); |
| 405 | 405 | ||
| 406 | Now, the socket 'sock' is bound to the SA 0x20. Since no connect(2) was called, | 406 | Now, the socket 'sock' is bound to the SA 0x20. Since no ``connect(2)`` was called, |
| 407 | at this point we can use only sendto(2) or sendmsg(2). | 407 | at this point we can use only ``sendto(2)`` or ``sendmsg(2)``. |
| 408 | 408 | ||
| 409 | Send: | 409 | Send: |
| 410 | 410 | ||
| @@ -414,8 +414,8 @@ Send: · 3 unmodified lines | |||
| 414 | .can_family = AF_CAN, | 414 | .can_family = AF_CAN, |
| 415 | .can_addr.j1939 = { | 415 | .can_addr.j1939 = { |
| 416 | .name = J1939_NO_NAME; | 416 | .name = J1939_NO_NAME; |
| 417 | .pgn = 0x30, | 417 | .addr = 0x30, |
| 418 | .addr = 0x12300, | 418 | .pgn = 0x12300, |
| 419 | }, | 419 | }, |
| 420 | }; | 420 | }; |
| 421 | 421 | ||
| @@ -175,5 +175,4 @@ The following structures are internal to the kernel, their members are · 174 unmodified lines | |||
| 175 | translated to netlink attributes when dumped. Drivers must not overwrite | 175 | translated to netlink attributes when dumped. Drivers must not overwrite |
| 176 | the statistics they don't report with 0. | 176 | the statistics they don't report with 0. |
| 177 | 177 | ||
| 178 | .. kernel-doc:: include/linux/ethtool.h | 178 | - ethtool_pause_stats() |
| 179 | :identifiers: ethtool_pause_stats | ||
| @@ -15,6 +15,14 @@ else: · 14 unmodified lines | |||
| 15 | import re | 15 | import re |
| 16 | from itertools import chain | 16 | from itertools import chain |
| 17 | 17 | ||
| 18 | # | ||
| 19 | # Python 2 lacks re.ASCII... | ||
| 20 | # | ||
| 21 | try: | ||
| 22 | ascii_p3 = re.ASCII | ||
| 23 | except AttributeError: | ||
| 24 | ascii_p3 = 0 | ||
| 25 | |||
| 18 | # | 26 | # |
| 19 | # Regex nastiness. Of course. | 27 | # Regex nastiness. Of course. |
| 20 | # Try to identify "function()" that's not already marked up some | 28 | # Try to identify "function()" that's not already marked up some |
| @@ -22,22 +30,22 @@ from itertools import chain · 1 unmodified line | |||
| 22 | # :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last | 30 | # :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last |
| 23 | # bit tries to restrict matches to things that won't create trouble. | 31 | # bit tries to restrict matches to things that won't create trouble. |
| 24 | # | 32 | # |
| 25 | RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=re.ASCII) | 33 | RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=ascii_p3) |
| 26 | 34 | ||
| 27 | # | 35 | # |
| 28 | # Sphinx 2 uses the same :c:type role for struct, union, enum and typedef | 36 | # Sphinx 2 uses the same :c:type role for struct, union, enum and typedef |
| 29 | # | 37 | # |
| 30 | RE_generic_type = re.compile(r'\b(struct|union|enum|typedef)\s+([a-zA-Z_]\w+)', | 38 | RE_generic_type = re.compile(r'\b(struct|union|enum|typedef)\s+([a-zA-Z_]\w+)', |
| 31 | flags=re.ASCII) | 39 | flags=ascii_p3) |
| 32 | 40 | ||
| 33 | # | 41 | # |
| 34 | # Sphinx 3 uses a different C role for each one of struct, union, enum and | 42 | # Sphinx 3 uses a different C role for each one of struct, union, enum and |
| 35 | # typedef | 43 | # typedef |
| 36 | # | 44 | # |
| 37 | RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=re.ASCII) | 45 | RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=ascii_p3) |
| 38 | RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=re.ASCII) | 46 | RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=ascii_p3) |
| 39 | RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=re.ASCII) | 47 | RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=ascii_p3) |
| 40 | RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=re.ASCII) | 48 | RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=ascii_p3) |
| 41 | 49 | ||
| 42 | # | 50 | # |
| 43 | # Detects a reference to a documentation page of the form Documentation/... with | 51 | # Detects a reference to a documentation page of the form Documentation/... with |
| @@ -22,6 +22,7 @@ place where this information is gathered. · 21 unmodified lines | |||
| 22 | spec_ctrl | 22 | spec_ctrl |
| 23 | accelerators/ocxl | 23 | accelerators/ocxl |
| 24 | ioctl/index | 24 | ioctl/index |
| 25 | iommu | ||
| 25 | media/index | 26 | media/index |
| 26 | 27 | ||
| 27 | .. only:: subproject and html | 28 | .. only:: subproject and html |
| @@ -978,7 +978,7 @@ M: Michael Hennerich <Michael.Hennerich@analog.com> · 977 unmodified lines | |||
| 978 | L: linux-iio@vger.kernel.org | 978 | L: linux-iio@vger.kernel.org |
| 979 | S: Supported | 979 | S: Supported |
| 980 | W: http://ez.analog.com/community/linux-device-drivers | 980 | W: http://ez.analog.com/community/linux-device-drivers |
| 981 | F: Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.txt | 981 | F: Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml |
| 982 | F: drivers/iio/adc/ad7768-1.c | 982 | F: drivers/iio/adc/ad7768-1.c |
| 983 | 983 | ||
| 984 | ANALOG DEVICES INC AD7780 DRIVER | 984 | ANALOG DEVICES INC AD7780 DRIVER |
| @@ -3857,7 +3857,7 @@ M: Roger Quadros <rogerq@ti.com> · 2872 unmodified lines | |||
| 3857 | L: linux-usb@vger.kernel.org | 3857 | L: linux-usb@vger.kernel.org |
| 3858 | S: Maintained | 3858 | S: Maintained |
| 3859 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git | 3859 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git |
| 3860 | F: Documentation/devicetree/bindings/usb/cdns-usb3.txt | 3860 | F: Documentation/devicetree/bindings/usb/cdns,usb3.yaml |
| 3861 | F: drivers/usb/cdns3/ | 3861 | F: drivers/usb/cdns3/ |
| 3862 | 3862 | ||
| 3863 | CADET FM/AM RADIO RECEIVER DRIVER | 3863 | CADET FM/AM RADIO RECEIVER DRIVER |
| @@ -7923,7 +7923,7 @@ HISILICON LPC BUS DRIVER · 4059 unmodified lines | |||
| 7923 | M: john.garry@huawei.com | 7923 | M: john.garry@huawei.com |
| 7924 | S: Maintained | 7924 | S: Maintained |
| 7925 | W: http://www.hisilicon.com | 7925 | W: http://www.hisilicon.com |
| 7926 | F: Documentation/devicetree/bindings/arm/hisilicon/hisilicon-low-pin-count.txt | 7926 | F: Documentation/devicetree/bindings/arm/hisilicon/low-pin-count.yaml |
| 7927 | F: drivers/bus/hisi_lpc.c | 7927 | F: drivers/bus/hisi_lpc.c |
| 7928 | 7928 | ||
| 7929 | HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3) | 7929 | HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3) |
| @@ -11170,7 +11170,7 @@ F: Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt · 3240 unmodified lines | |||
| 11170 | F: drivers/input/touchscreen/melfas_mip4.c | 11170 | F: drivers/input/touchscreen/melfas_mip4.c |
| 11171 | 11171 | ||
| 11172 | MELLANOX BLUEFIELD I2C DRIVER | 11172 | MELLANOX BLUEFIELD I2C DRIVER |
| 11173 | M: Khalil Blaiech <kblaiech@mellanox.com> | 11173 | M: Khalil Blaiech <kblaiech@nvidia.com> |
| 11174 | L: linux-i2c@vger.kernel.org | 11174 | L: linux-i2c@vger.kernel.org |
| 11175 | S: Supported | 11175 | S: Supported |
| 11176 | F: drivers/i2c/busses/i2c-mlxbf.c | 11176 | F: drivers/i2c/busses/i2c-mlxbf.c |
| @@ -14534,6 +14534,14 @@ F: Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml · 3357 unmodified lines | |||
| 14534 | F: drivers/mailbox/qcom-ipcc.c | 14534 | F: drivers/mailbox/qcom-ipcc.c |
| 14535 | F: include/dt-bindings/mailbox/qcom-ipcc.h | 14535 | F: include/dt-bindings/mailbox/qcom-ipcc.h |
| 14536 | 14536 | ||
| 14537 | QUALCOMM IPQ4019 VQMMC REGULATOR DRIVER | ||
| 14538 | M: Robert Marko <robert.marko@sartura.hr> | ||
| 14539 | M: Luka Perkov <luka.perkov@sartura.hr> | ||
| 14540 | L: linux-arm-msm@vger.kernel.org | ||
| 14541 | S: Maintained | ||
| 14542 | F: Documentation/devicetree/bindings/regulator/vqmmc-ipq4019-regulator.yaml | ||
| 14543 | F: drivers/regulator/vqmmc-ipq4019-regulator.c | ||
| 14544 | |||
| 14537 | QUALCOMM RMNET DRIVER | 14545 | QUALCOMM RMNET DRIVER |
| 14538 | M: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> | 14546 | M: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> |
| 14539 | M: Sean Tranchetti <stranche@codeaurora.org> | 14547 | M: Sean Tranchetti <stranche@codeaurora.org> |
| @@ -14889,7 +14897,6 @@ RENESAS ETHERNET DRIVERS · 349 unmodified lines | |||
| 14889 | R: Sergei Shtylyov <sergei.shtylyov@gmail.com> | 14897 | R: Sergei Shtylyov <sergei.shtylyov@gmail.com> |
| 14890 | L: netdev@vger.kernel.org | 14898 | L: netdev@vger.kernel.org |
| 14891 | L: linux-renesas-soc@vger.kernel.org | 14899 | L: linux-renesas-soc@vger.kernel.org |
| 14892 | F: Documentation/devicetree/bindings/net/renesas,*.txt | ||
| 14893 | F: Documentation/devicetree/bindings/net/renesas,*.yaml | 14900 | F: Documentation/devicetree/bindings/net/renesas,*.yaml |
| 14894 | F: drivers/net/ethernet/renesas/ | 14901 | F: drivers/net/ethernet/renesas/ |
| 14895 | F: include/linux/sh_eth.h | 14902 | F: include/linux/sh_eth.h |
| @@ -18090,7 +18097,7 @@ M: Yu Chen <chenyu56@huawei.com> · 3194 unmodified lines | |||
| 18090 | M: Binghui Wang <wangbinghui@hisilicon.com> | 18097 | M: Binghui Wang <wangbinghui@hisilicon.com> |
| 18091 | L: linux-usb@vger.kernel.org | 18098 | L: linux-usb@vger.kernel.org |
| 18092 | S: Maintained | 18099 | S: Maintained |
| 18093 | F: Documentation/devicetree/bindings/phy/phy-hi3660-usb3.txt | 18100 | F: Documentation/devicetree/bindings/phy/hisilicon,hi3660-usb3.yaml |
| 18094 | F: drivers/phy/hisilicon/phy-hi3660-usb3.c | 18101 | F: drivers/phy/hisilicon/phy-hi3660-usb3.c |
| 18095 | 18102 | ||
| 18096 | USB ISP116X DRIVER | 18103 | USB ISP116X DRIVER |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 10 | 3 | PATCHLEVEL = 10 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc2 | 5 | EXTRAVERSION = -rc3 |
| 6 | NAME = Kleptomaniac Octopus | 6 | NAME = Kleptomaniac Octopus |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -67,7 +67,22 @@ · 66 unmodified lines | |||
| 67 | sr r5, [ARC_REG_LPB_CTRL] | 67 | sr r5, [ARC_REG_LPB_CTRL] |
| 68 | 1: | 68 | 1: |
| 69 | #endif /* CONFIG_ARC_LPB_DISABLE */ | 69 | #endif /* CONFIG_ARC_LPB_DISABLE */ |
| 70 | #endif | 70 | |
| 71 | /* On HSDK, CCMs need to remapped super early */ | ||
| 72 | #ifdef CONFIG_ARC_SOC_HSDK | ||
| 73 | mov r6, 0x60000000 | ||
| 74 | lr r5, [ARC_REG_ICCM_BUILD] | ||
| 75 | breq r5, 0, 1f | ||
| 76 | sr r6, [ARC_REG_AUX_ICCM] | ||
| 77 | 1: | ||
| 78 | lr r5, [ARC_REG_DCCM_BUILD] | ||
| 79 | breq r5, 0, 2f | ||
| 80 | sr r6, [ARC_REG_AUX_DCCM] | ||
| 81 | 2: | ||
| 82 | #endif /* CONFIG_ARC_SOC_HSDK */ | ||
| 83 | |||
| 84 | #endif /* CONFIG_ISA_ARCV2 */ | ||
| 85 | |||
| 71 | ; Config DSP_CTRL properly, so kernel may use integer multiply, | 86 | ; Config DSP_CTRL properly, so kernel may use integer multiply, |
| 72 | ; multiply-accumulate, and divide operations | 87 | ; multiply-accumulate, and divide operations |
| 73 | DSP_EARLY_INIT | 88 | DSP_EARLY_INIT |
| @@ -112,7 +112,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, · 111 unmodified lines | |||
| 112 | int (*consumer_fn) (unsigned int, void *), void *arg) | 112 | int (*consumer_fn) (unsigned int, void *), void *arg) |
| 113 | { | 113 | { |
| 114 | #ifdef CONFIG_ARC_DW2_UNWIND | 114 | #ifdef CONFIG_ARC_DW2_UNWIND |
| 115 | int ret = 0; | 115 | int ret = 0, cnt = 0; |
| 116 | unsigned int address; | 116 | unsigned int address; |
| 117 | struct unwind_frame_info frame_info; | 117 | struct unwind_frame_info frame_info; |
| 118 | 118 | ||
| @@ -132,6 +132,11 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, · 13 unmodified lines | |||
| 132 | break; | 132 | break; |
| 133 | 133 | ||
| 134 | frame_info.regs.r63 = frame_info.regs.r31; | 134 | frame_info.regs.r63 = frame_info.regs.r31; |
| 135 | |||
| 136 | if (cnt++ > 128) { | ||
| 137 | printk("unwinder looping too long, aborting !\n"); | ||
| 138 | return 0; | ||
| 139 | } | ||
| 135 | } | 140 | } |
| 136 | 141 | ||
| 137 | return address; /* return the last address it saw */ | 142 | return address; /* return the last address it saw */ |
| @@ -17,22 +17,6 @@ int arc_hsdk_axi_dmac_coherent __section(".data") = 0; · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | #define ARC_CCM_UNUSED_ADDR 0x60000000 | 18 | #define ARC_CCM_UNUSED_ADDR 0x60000000 |
| 19 | 19 | ||
| 20 | static void __init hsdk_init_per_cpu(unsigned int cpu) | ||
| 21 | { | ||
| 22 | /* | ||
| 23 | * By default ICCM is mapped to 0x7z while this area is used for | ||
| 24 | * kernel virtual mappings, so move it to currently unused area. | ||
| 25 | */ | ||
| 26 | if (cpuinfo_arc700[cpu].iccm.sz) | ||
| 27 | write_aux_reg(ARC_REG_AUX_ICCM, ARC_CCM_UNUSED_ADDR); | ||
| 28 | |||
| 29 | /* | ||
| 30 | * By default DCCM is mapped to 0x8z while this area is used by kernel, | ||
| 31 | * so move it to currently unused area. | ||
| 32 | */ | ||
| 33 | if (cpuinfo_arc700[cpu].dccm.sz) | ||
| 34 | write_aux_reg(ARC_REG_AUX_DCCM, ARC_CCM_UNUSED_ADDR); | ||
| 35 | } | ||
| 36 | 20 | ||
| 37 | #define ARC_PERIPHERAL_BASE 0xf0000000 | 21 | #define ARC_PERIPHERAL_BASE 0xf0000000 |
| 38 | #define CREG_BASE (ARC_PERIPHERAL_BASE + 0x1000) | 22 | #define CREG_BASE (ARC_PERIPHERAL_BASE + 0x1000) |
| @@ -339,5 +323,4 @@ static const char *hsdk_compat[] __initconst = { · 300 unmodified lines | |||
| 339 | MACHINE_START(SIMULATION, "hsdk") | 323 | MACHINE_START(SIMULATION, "hsdk") |
| 340 | .dt_compat = hsdk_compat, | 324 | .dt_compat = hsdk_compat, |
| 341 | .init_early = hsdk_init_early, | 325 | .init_early = hsdk_init_early, |
| 342 | .init_per_cpu = hsdk_init_per_cpu, | ||
| 343 | MACHINE_END | 326 | MACHINE_END |
| @@ -354,8 +354,8 @@ static void __init free_highpages(void) · 353 unmodified lines | |||
| 354 | /* set highmem page free */ | 354 | /* set highmem page free */ |
| 355 | for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, | 355 | for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, |
| 356 | &range_start, &range_end, NULL) { | 356 | &range_start, &range_end, NULL) { |
| 357 | unsigned long start = PHYS_PFN(range_start); | 357 | unsigned long start = PFN_UP(range_start); |
| 358 | unsigned long end = PHYS_PFN(range_end); | 358 | unsigned long end = PFN_DOWN(range_end); |
| 359 | 359 | ||
| 360 | /* Ignore complete lowmem entries */ | 360 | /* Ignore complete lowmem entries */ |
| 361 | if (end <= max_low) | 361 | if (end <= max_low) |
| @@ -1002,7 +1002,7 @@ config NUMA · 1001 unmodified lines | |||
| 1002 | config NODES_SHIFT | 1002 | config NODES_SHIFT |
| 1003 | int "Maximum NUMA Nodes (as a power of 2)" | 1003 | int "Maximum NUMA Nodes (as a power of 2)" |
| 1004 | range 1 10 | 1004 | range 1 10 |
| 1005 | default "2" | 1005 | default "4" |
| 1006 | depends on NEED_MULTIPLE_NODES | 1006 | depends on NEED_MULTIPLE_NODES |
| 1007 | help | 1007 | help |
| 1008 | Specify the maximum number of NUMA Nodes available on the target | 1008 | Specify the maximum number of NUMA Nodes available on the target |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | * #imm16 values used for BRK instruction generation | 10 | * #imm16 values used for BRK instruction generation |
| 11 | * 0x004: for installing kprobes | 11 | * 0x004: for installing kprobes |
| 12 | * 0x005: for installing uprobes | 12 | * 0x005: for installing uprobes |
| 13 | * 0x006: for kprobe software single-step | ||
| 13 | * Allowed values for kgdb are 0x400 - 0x7ff | 14 | * Allowed values for kgdb are 0x400 - 0x7ff |
| 14 | * 0x100: for triggering a fault on purpose (reserved) | 15 | * 0x100: for triggering a fault on purpose (reserved) |
| 15 | * 0x400: for dynamic BRK instruction | 16 | * 0x400: for dynamic BRK instruction |
| @@ -19,6 +20,7 @@ · 3 unmodified lines | |||
| 19 | */ | 20 | */ |
| 20 | #define KPROBES_BRK_IMM 0x004 | 21 | #define KPROBES_BRK_IMM 0x004 |
| 21 | #define UPROBES_BRK_IMM 0x005 | 22 | #define UPROBES_BRK_IMM 0x005 |
| 23 | #define KPROBES_BRK_SS_IMM 0x006 | ||
| 22 | #define FAULT_BRK_IMM 0x100 | 24 | #define FAULT_BRK_IMM 0x100 |
| 23 | #define KGDB_DYN_DBG_BRK_IMM 0x400 | 25 | #define KGDB_DYN_DBG_BRK_IMM 0x400 |
| 24 | #define KGDB_COMPILED_DBG_BRK_IMM 0x401 | 26 | #define KGDB_COMPILED_DBG_BRK_IMM 0x401 |
| @@ -53,6 +53,7 @@ · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | /* kprobes BRK opcodes with ESR encoding */ | 54 | /* kprobes BRK opcodes with ESR encoding */ |
| 55 | #define BRK64_OPCODE_KPROBES (AARCH64_BREAK_MON | (KPROBES_BRK_IMM << 5)) | 55 | #define BRK64_OPCODE_KPROBES (AARCH64_BREAK_MON | (KPROBES_BRK_IMM << 5)) |
| 56 | #define BRK64_OPCODE_KPROBES_SS (AARCH64_BREAK_MON | (KPROBES_BRK_SS_IMM << 5)) | ||
| 56 | /* uprobes BRK opcodes with ESR encoding */ | 57 | /* uprobes BRK opcodes with ESR encoding */ |
| 57 | #define BRK64_OPCODE_UPROBES (AARCH64_BREAK_MON | (UPROBES_BRK_IMM << 5)) | 58 | #define BRK64_OPCODE_UPROBES (AARCH64_BREAK_MON | (UPROBES_BRK_IMM << 5)) |
| 58 | 59 | ||
| @@ -16,7 +16,7 @@ · 15 unmodified lines | |||
| 16 | #include <linux/percpu.h> | 16 | #include <linux/percpu.h> |
| 17 | 17 | ||
| 18 | #define __ARCH_WANT_KPROBES_INSN_SLOT | 18 | #define __ARCH_WANT_KPROBES_INSN_SLOT |
| 19 | #define MAX_INSN_SIZE 1 | 19 | #define MAX_INSN_SIZE 2 |
| 20 | 20 | ||
| 21 | #define flush_insn_slot(p) do { } while (0) | 21 | #define flush_insn_slot(p) do { } while (0) |
| 22 | #define kretprobe_blacklist_size 0 | 22 | #define kretprobe_blacklist_size 0 |
| @@ -43,7 +43,7 @@ static void *image_load(struct kimage *image, · 42 unmodified lines | |||
| 43 | u64 flags, value; | 43 | u64 flags, value; |
| 44 | bool be_image, be_kernel; | 44 | bool be_image, be_kernel; |
| 45 | struct kexec_buf kbuf; | 45 | struct kexec_buf kbuf; |
| 46 | unsigned long text_offset; | 46 | unsigned long text_offset, kernel_segment_number; |
| 47 | struct kexec_segment *kernel_segment; | 47 | struct kexec_segment *kernel_segment; |
| 48 | int ret; | 48 | int ret; |
| 49 | 49 | ||
| @@ -88,11 +88,37 @@ static void *image_load(struct kimage *image, · 38 unmodified lines | |||
| 88 | /* Adjust kernel segment with TEXT_OFFSET */ | 88 | /* Adjust kernel segment with TEXT_OFFSET */ |
| 89 | kbuf.memsz += text_offset; | 89 | kbuf.memsz += text_offset; |
| 90 | 90 | ||
| 91 | ret = kexec_add_buffer(&kbuf); | 91 | kernel_segment_number = image->nr_segments; |
| 92 | if (ret) | 92 | |
| 93 | /* | ||
| 94 | * The location of the kernel segment may make it impossible to satisfy | ||
| 95 | * the other segment requirements, so we try repeatedly to find a | ||
| 96 | * location that will work. | ||
| 97 | */ | ||
| 98 | while ((ret = kexec_add_buffer(&kbuf)) == 0) { | ||
| 99 | /* Try to load additional data */ | ||
| 100 | kernel_segment = &image->segment[kernel_segment_number]; | ||
| 101 | ret = load_other_segments(image, kernel_segment->mem, | ||
| 102 | kernel_segment->memsz, initrd, | ||
| 103 | initrd_len, cmdline); | ||
| 104 | if (!ret) | ||
| 105 | break; | ||
| 106 | |||
| 107 | /* | ||
| 108 | * We couldn't find space for the other segments; erase the | ||
| 109 | * kernel segment and try the next available hole. | ||
| 110 | */ | ||
| 111 | image->nr_segments -= 1; | ||
| 112 | kbuf.buf_min = kernel_segment->mem + kernel_segment->memsz; | ||
| 113 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 114 | } | ||
| 115 | |||
| 116 | if (ret) { | ||
| 117 | pr_err("Could not find any suitable kernel location!"); | ||
| 93 | return ERR_PTR(ret); | 118 | return ERR_PTR(ret); |
| 119 | } | ||
| 94 | 120 | ||
| 95 | kernel_segment = &image->segment[image->nr_segments - 1]; | 121 | kernel_segment = &image->segment[kernel_segment_number]; |
| 96 | kernel_segment->mem += text_offset; | 122 | kernel_segment->mem += text_offset; |
| 97 | kernel_segment->memsz -= text_offset; | 123 | kernel_segment->memsz -= text_offset; |
| 98 | image->start = kernel_segment->mem; | 124 | image->start = kernel_segment->mem; |
| @@ -101,12 +127,7 @@ static void *image_load(struct kimage *image, · 2 unmodified lines | |||
| 101 | kernel_segment->mem, kbuf.bufsz, | 127 | kernel_segment->mem, kbuf.bufsz, |
| 102 | kernel_segment->memsz); | 128 | kernel_segment->memsz); |
| 103 | 129 | ||
| 104 | /* Load additional data */ | 130 | return 0; |
| 105 | ret = load_other_segments(image, | ||
| 106 | kernel_segment->mem, kernel_segment->memsz, | ||
| 107 | initrd, initrd_len, cmdline); | ||
| 108 | |||
| 109 | return ERR_PTR(ret); | ||
| 110 | } | 131 | } |
| 111 | 132 | ||
| 112 | #ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG | 133 | #ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG |
| @@ -240,6 +240,11 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) · 239 unmodified lines | |||
| 240 | return ret; | 240 | return ret; |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | /* | ||
| 244 | * Tries to add the initrd and DTB to the image. If it is not possible to find | ||
| 245 | * valid locations, this function will undo changes to the image and return non | ||
| 246 | * zero. | ||
| 247 | */ | ||
| 243 | int load_other_segments(struct kimage *image, | 248 | int load_other_segments(struct kimage *image, |
| 244 | unsigned long kernel_load_addr, | 249 | unsigned long kernel_load_addr, |
| 245 | unsigned long kernel_size, | 250 | unsigned long kernel_size, |
| @@ -248,7 +253,8 @@ int load_other_segments(struct kimage *image, · 2 unmodified lines | |||
| 248 | { | 253 | { |
| 249 | struct kexec_buf kbuf; | 254 | struct kexec_buf kbuf; |
| 250 | void *headers, *dtb = NULL; | 255 | void *headers, *dtb = NULL; |
| 251 | unsigned long headers_sz, initrd_load_addr = 0, dtb_len; | 256 | unsigned long headers_sz, initrd_load_addr = 0, dtb_len, |
| 257 | orig_segments = image->nr_segments; | ||
| 252 | int ret = 0; | 258 | int ret = 0; |
| 253 | 259 | ||
| 254 | kbuf.image = image; | 260 | kbuf.image = image; |
| @@ -334,6 +340,7 @@ int load_other_segments(struct kimage *image, · 79 unmodified lines | |||
| 334 | return 0; | 340 | return 0; |
| 335 | 341 | ||
| 336 | out_err: | 342 | out_err: |
| 343 | image->nr_segments = orig_segments; | ||
| 337 | vfree(dtb); | 344 | vfree(dtb); |
| 338 | return ret; | 345 | return ret; |
| 339 | } | 346 | } |
| @@ -36,25 +36,16 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); · 35 unmodified lines | |||
| 36 | static void __kprobes | 36 | static void __kprobes |
| 37 | post_kprobe_handler(struct kprobe_ctlblk *, struct pt_regs *); | 37 | post_kprobe_handler(struct kprobe_ctlblk *, struct pt_regs *); |
| 38 | 38 | ||
| 39 | static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode) | ||
| 40 | { | ||
| 41 | void *addrs[1]; | ||
| 42 | u32 insns[1]; | ||
| 43 | |||
| 44 | addrs[0] = addr; | ||
| 45 | insns[0] = opcode; | ||
| 46 | |||
| 47 | return aarch64_insn_patch_text(addrs, insns, 1); | ||
| 48 | } | ||
| 49 | |||
| 50 | static void __kprobes arch_prepare_ss_slot(struct kprobe *p) | 39 | static void __kprobes arch_prepare_ss_slot(struct kprobe *p) |
| 51 | { | 40 | { |
| 41 | kprobe_opcode_t *addr = p->ainsn.api.insn; | ||
| 42 | void *addrs[] = {addr, addr + 1}; | ||
| 43 | u32 insns[] = {p->opcode, BRK64_OPCODE_KPROBES_SS}; | ||
| 44 | |||
| 52 | /* prepare insn slot */ | 45 | /* prepare insn slot */ |
| 53 | patch_text(p->ainsn.api.insn, p->opcode); | 46 | aarch64_insn_patch_text(addrs, insns, 2); |
| 54 | 47 | ||
| 55 | flush_icache_range((uintptr_t) (p->ainsn.api.insn), | 48 | flush_icache_range((uintptr_t)addr, (uintptr_t)(addr + MAX_INSN_SIZE)); |
| 56 | (uintptr_t) (p->ainsn.api.insn) + | ||
| 57 | MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | ||
| 58 | 49 | ||
| 59 | /* | 50 | /* |
| 60 | * Needs restoring of return address after stepping xol. | 51 | * Needs restoring of return address after stepping xol. |
| @@ -128,13 +119,18 @@ void *alloc_insn_page(void) · 67 unmodified lines | |||
| 128 | /* arm kprobe: install breakpoint in text */ | 119 | /* arm kprobe: install breakpoint in text */ |
| 129 | void __kprobes arch_arm_kprobe(struct kprobe *p) | 120 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
| 130 | { | 121 | { |
| 131 | patch_text(p->addr, BRK64_OPCODE_KPROBES); | 122 | void *addr = p->addr; |
| 123 | u32 insn = BRK64_OPCODE_KPROBES; | ||
| 124 | |||
| 125 | aarch64_insn_patch_text(&addr, &insn, 1); | ||
| 132 | } | 126 | } |
| 133 | 127 | ||
| 134 | /* disarm kprobe: remove breakpoint from text */ | 128 | /* disarm kprobe: remove breakpoint from text */ |
| 135 | void __kprobes arch_disarm_kprobe(struct kprobe *p) | 129 | void __kprobes arch_disarm_kprobe(struct kprobe *p) |
| 136 | { | 130 | { |
| 137 | patch_text(p->addr, p->opcode); | 131 | void *addr = p->addr; |
| 132 | |||
| 133 | aarch64_insn_patch_text(&addr, &p->opcode, 1); | ||
| 138 | } | 134 | } |
| 139 | 135 | ||
| 140 | void __kprobes arch_remove_kprobe(struct kprobe *p) | 136 | void __kprobes arch_remove_kprobe(struct kprobe *p) |
| @@ -163,20 +159,15 @@ static void __kprobes set_current_kprobe(struct kprobe *p) · 22 unmodified lines | |||
| 163 | } | 159 | } |
| 164 | 160 | ||
| 165 | /* | 161 | /* |
| 166 | * Interrupts need to be disabled before single-step mode is set, and not | 162 | * Mask all of DAIF while executing the instruction out-of-line, to keep things |
| 167 | * reenabled until after single-step mode ends. | 163 | * simple and avoid nesting exceptions. Interrupts do have to be disabled since |
| 168 | * Without disabling interrupt on local CPU, there is a chance of | 164 | * the kprobe state is per-CPU and doesn't get migrated. |
| 169 | * interrupt occurrence in the period of exception return and start of | ||
| 170 | * out-of-line single-step, that result in wrongly single stepping | ||
| 171 | * into the interrupt handler. | ||
| 172 | */ | 165 | */ |
| 173 | static void __kprobes kprobes_save_local_irqflag(struct kprobe_ctlblk *kcb, | 166 | static void __kprobes kprobes_save_local_irqflag(struct kprobe_ctlblk *kcb, |
| 174 | struct pt_regs *regs) | 167 | struct pt_regs *regs) |
| 175 | { | 168 | { |
| 176 | kcb->saved_irqflag = regs->pstate & DAIF_MASK; | 169 | kcb->saved_irqflag = regs->pstate & DAIF_MASK; |
| 177 | regs->pstate |= PSR_I_BIT; | 170 | regs->pstate |= DAIF_MASK; |
| 178 | /* Unmask PSTATE.D for enabling software step exceptions. */ | ||
| 179 | regs->pstate &= ~PSR_D_BIT; | ||
| 180 | } | 171 | } |
| 181 | 172 | ||
| 182 | static void __kprobes kprobes_restore_local_irqflag(struct kprobe_ctlblk *kcb, | 173 | static void __kprobes kprobes_restore_local_irqflag(struct kprobe_ctlblk *kcb, |
| @@ -219,10 +210,7 @@ static void __kprobes setup_singlestep(struct kprobe *p, · 36 unmodified lines | |||
| 219 | slot = (unsigned long)p->ainsn.api.insn; | 210 | slot = (unsigned long)p->ainsn.api.insn; |
| 220 | 211 | ||
| 221 | set_ss_context(kcb, slot); /* mark pending ss */ | 212 | set_ss_context(kcb, slot); /* mark pending ss */ |
| 222 | |||
| 223 | /* IRQs and single stepping do not mix well. */ | ||
| 224 | kprobes_save_local_irqflag(kcb, regs); | 213 | kprobes_save_local_irqflag(kcb, regs); |
| 225 | kernel_enable_single_step(regs); | ||
| 226 | instruction_pointer_set(regs, slot); | 214 | instruction_pointer_set(regs, slot); |
| 227 | } else { | 215 | } else { |
| 228 | /* insn simulation */ | 216 | /* insn simulation */ |
| @@ -273,12 +261,8 @@ post_kprobe_handler(struct kprobe_ctlblk *kcb, struct pt_regs *regs) · 44 unmodified lines | |||
| 273 | } | 261 | } |
| 274 | /* call post handler */ | 262 | /* call post handler */ |
| 275 | kcb->kprobe_status = KPROBE_HIT_SSDONE; | 263 | kcb->kprobe_status = KPROBE_HIT_SSDONE; |
| 276 | if (cur->post_handler) { | 264 | if (cur->post_handler) |
| 277 | /* post_handler can hit breakpoint and single step | ||
| 278 | * again, so we enable D-flag for recursive exception. | ||
| 279 | */ | ||
| 280 | cur->post_handler(cur, regs, 0); | 265 | cur->post_handler(cur, regs, 0); |
| 281 | } | ||
| 282 | 266 | ||
| 283 | reset_current_kprobe(); | 267 | reset_current_kprobe(); |
| 284 | } | 268 | } |
| @@ -302,8 +286,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr) · 17 unmodified lines | |||
| 302 | if (!instruction_pointer(regs)) | 286 | if (!instruction_pointer(regs)) |
| 303 | BUG(); | 287 | BUG(); |
| 304 | 288 | ||
| 305 | kernel_disable_single_step(); | ||
| 306 | |||
| 307 | if (kcb->kprobe_status == KPROBE_REENTER) | 289 | if (kcb->kprobe_status == KPROBE_REENTER) |
| 308 | restore_previous_kprobe(kcb); | 290 | restore_previous_kprobe(kcb); |
| 309 | else | 291 | else |
| @@ -365,10 +347,6 @@ static void __kprobes kprobe_handler(struct pt_regs *regs) · 55 unmodified lines | |||
| 365 | * pre-handler and it returned non-zero, it will | 347 | * pre-handler and it returned non-zero, it will |
| 366 | * modify the execution path and no need to single | 348 | * modify the execution path and no need to single |
| 367 | * stepping. Let's just reset current kprobe and exit. | 349 | * stepping. Let's just reset current kprobe and exit. |
| 368 | * | ||
| 369 | * pre_handler can hit a breakpoint and can step thru | ||
| 370 | * before return, keep PSTATE D-flag enabled until | ||
| 371 | * pre_handler return back. | ||
| 372 | */ | 350 | */ |
| 373 | if (!p->pre_handler || !p->pre_handler(p, regs)) { | 351 | if (!p->pre_handler || !p->pre_handler(p, regs)) { |
| 374 | setup_singlestep(p, regs, kcb, 0); | 352 | setup_singlestep(p, regs, kcb, 0); |
| @@ -399,7 +377,7 @@ kprobe_ss_hit(struct kprobe_ctlblk *kcb, unsigned long addr) · 24 unmodified lines | |||
| 399 | } | 377 | } |
| 400 | 378 | ||
| 401 | static int __kprobes | 379 | static int __kprobes |
| 402 | kprobe_single_step_handler(struct pt_regs *regs, unsigned int esr) | 380 | kprobe_breakpoint_ss_handler(struct pt_regs *regs, unsigned int esr) |
| 403 | { | 381 | { |
| 404 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 382 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
| 405 | int retval; | 383 | int retval; |
| @@ -409,16 +387,15 @@ kprobe_single_step_handler(struct pt_regs *regs, unsigned int esr) · 3 unmodified lines | |||
| 409 | 387 | ||
| 410 | if (retval == DBG_HOOK_HANDLED) { | 388 | if (retval == DBG_HOOK_HANDLED) { |
| 411 | kprobes_restore_local_irqflag(kcb, regs); | 389 | kprobes_restore_local_irqflag(kcb, regs); |
| 412 | kernel_disable_single_step(); | ||
| 413 | |||
| 414 | post_kprobe_handler(kcb, regs); | 390 | post_kprobe_handler(kcb, regs); |
| 415 | } | 391 | } |
| 416 | 392 | ||
| 417 | return retval; | 393 | return retval; |
| 418 | } | 394 | } |
| 419 | 395 | ||
| 420 | static struct step_hook kprobes_step_hook = { | 396 | static struct break_hook kprobes_break_ss_hook = { |
| 421 | .fn = kprobe_single_step_handler, | 397 | .imm = KPROBES_BRK_SS_IMM, |
| 398 | .fn = kprobe_breakpoint_ss_handler, | ||
| 422 | }; | 399 | }; |
| 423 | 400 | ||
| 424 | static int __kprobes | 401 | static int __kprobes |
| @@ -486,7 +463,7 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p) · 61 unmodified lines | |||
| 486 | int __init arch_init_kprobes(void) | 463 | int __init arch_init_kprobes(void) |
| 487 | { | 464 | { |
| 488 | register_kernel_break_hook(&kprobes_break_hook); | 465 | register_kernel_break_hook(&kprobes_break_hook); |
| 489 | register_kernel_step_hook(&kprobes_step_hook); | 466 | register_kernel_break_hook(&kprobes_break_ss_hook); |
| 490 | 467 | ||
| 491 | return 0; | 468 | return 0; |
| 492 | } | 469 | } |
| @@ -63,7 +63,7 @@ static inline void restore_user_access(unsigned long flags) · 62 unmodified lines | |||
| 63 | static inline bool | 63 | static inline bool |
| 64 | bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write) | 64 | bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write) |
| 65 | { | 65 | { |
| 66 | return WARN(!((regs->kuap ^ MD_APG_KUAP) & 0xf0000000), | 66 | return WARN(!((regs->kuap ^ MD_APG_KUAP) & 0xff000000), |
| 67 | "Bug: fault blocked by AP register !"); | 67 | "Bug: fault blocked by AP register !"); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -33,19 +33,18 @@ · 32 unmodified lines | |||
| 33 | * respectively NA for All or X for Supervisor and no access for User. | 33 | * respectively NA for All or X for Supervisor and no access for User. |
| 34 | * Then we use the APG to say whether accesses are according to Page rules or | 34 | * Then we use the APG to say whether accesses are according to Page rules or |
| 35 | * "all Supervisor" rules (Access to all) | 35 | * "all Supervisor" rules (Access to all) |
| 36 | * Therefore, we define 2 APG groups. lsb is _PMD_USER | 36 | * _PAGE_ACCESSED is also managed via APG. When _PAGE_ACCESSED is not set, say |
| 37 | * 0 => Kernel => 01 (all accesses performed according to page definition) | 37 | * "all User" rules, that will lead to NA for all. |
| 38 | * 1 => User => 00 (all accesses performed as supervisor iaw page definition) | 38 | * Therefore, we define 4 APG groups. lsb is _PAGE_ACCESSED |
| 39 | * 2-15 => Not Used | 39 | * 0 => Kernel => 11 (all accesses performed according as user iaw page definition) |
| 40 | */ | 40 | * 1 => Kernel+Accessed => 01 (all accesses performed according to page definition) |
| 41 | #define MI_APG_INIT 0x40000000 | 41 | * 2 => User => 11 (all accesses performed according as user iaw page definition) |
| 42 | 42 | * 3 => User+Accessed => 00 (all accesses performed as supervisor iaw page definition) for INIT | |
| 43 | /* | 43 | * => 10 (all accesses performed according to swaped page definition) for KUEP |
| 44 | * 0 => Kernel => 01 (all accesses performed according to page definition) | 44 | * 4-15 => Not Used |
| 45 | * 1 => User => 10 (all accesses performed according to swaped page definition) | 45 | */ |
| 46 | * 2-15 => Not Used | 46 | #define MI_APG_INIT 0xdc000000 |
| 47 | */ | 47 | #define MI_APG_KUEP 0xde000000 |
| 48 | #define MI_APG_KUEP 0x60000000 | ||
| 49 | 48 | ||
| 50 | /* The effective page number register. When read, contains the information | 49 | /* The effective page number register. When read, contains the information |
| 51 | * about the last instruction TLB miss. When MI_RPN is written, bits in | 50 | * about the last instruction TLB miss. When MI_RPN is written, bits in |
| @@ -106,25 +105,9 @@ · 54 unmodified lines | |||
| 106 | #define MD_Ks 0x80000000 /* Should not be set */ | 105 | #define MD_Ks 0x80000000 /* Should not be set */ |
| 107 | #define MD_Kp 0x40000000 /* Should always be set */ | 106 | #define MD_Kp 0x40000000 /* Should always be set */ |
| 108 | 107 | ||
| 109 | /* | 108 | /* See explanation above at the definition of MI_APG_INIT */ |
| 110 | * All pages' PP data bits are set to either 000 or 011 or 001, which means | 109 | #define MD_APG_INIT 0xdc000000 |
| 111 | * respectively RW for Supervisor and no access for User, or RO for | 110 | #define MD_APG_KUAP 0xde000000 |
| 112 | * Supervisor and no access for user and NA for ALL. | ||
| 113 | * Then we use the APG to say whether accesses are according to Page rules or | ||
| 114 | * "all Supervisor" rules (Access to all) | ||
| 115 | * Therefore, we define 2 APG groups. lsb is _PMD_USER | ||
| 116 | * 0 => Kernel => 01 (all accesses performed according to page definition) | ||
| 117 | * 1 => User => 00 (all accesses performed as supervisor iaw page definition) | ||
| 118 | * 2-15 => Not Used | ||
| 119 | */ | ||
| 120 | #define MD_APG_INIT 0x40000000 | ||
| 121 | |||
| 122 | /* | ||
| 123 | * 0 => No user => 01 (all accesses performed according to page definition) | ||
| 124 | * 1 => User => 10 (all accesses performed according to swaped page definition) | ||
| 125 | * 2-15 => Not Used | ||
| 126 | */ | ||
| 127 | #define MD_APG_KUAP 0x60000000 | ||
| 128 | 111 | ||
| 129 | /* The effective page number register. When read, contains the information | 112 | /* The effective page number register. When read, contains the information |
| 130 | * about the last instruction TLB miss. When MD_RPN is written, bits in | 113 | * about the last instruction TLB miss. When MD_RPN is written, bits in |
| @@ -39,9 +39,9 @@ · 38 unmodified lines | |||
| 39 | * into the TLB. | 39 | * into the TLB. |
| 40 | */ | 40 | */ |
| 41 | #define _PAGE_GUARDED 0x0010 /* Copied to L1 G entry in DTLB */ | 41 | #define _PAGE_GUARDED 0x0010 /* Copied to L1 G entry in DTLB */ |
| 42 | #define _PAGE_SPECIAL 0x0020 /* SW entry */ | 42 | #define _PAGE_ACCESSED 0x0020 /* Copied to L1 APG 1 entry in I/DTLB */ |
| 43 | #define _PAGE_EXEC 0x0040 /* Copied to PP (bit 21) in ITLB */ | 43 | #define _PAGE_EXEC 0x0040 /* Copied to PP (bit 21) in ITLB */ |
| 44 | #define _PAGE_ACCESSED 0x0080 /* software: page referenced */ | 44 | #define _PAGE_SPECIAL 0x0080 /* SW entry */ |
| 45 | 45 | ||
| 46 | #define _PAGE_NA 0x0200 /* Supervisor NA, User no access */ | 46 | #define _PAGE_NA 0x0200 /* Supervisor NA, User no access */ |
| 47 | #define _PAGE_RO 0x0600 /* Supervisor RO, User no access */ | 47 | #define _PAGE_RO 0x0600 /* Supervisor RO, User no access */ |
| @@ -59,11 +59,12 @@ · 11 unmodified lines | |||
| 59 | 59 | ||
| 60 | #define _PMD_PRESENT 0x0001 | 60 | #define _PMD_PRESENT 0x0001 |
| 61 | #define _PMD_PRESENT_MASK _PMD_PRESENT | 61 | #define _PMD_PRESENT_MASK _PMD_PRESENT |
| 62 | #define _PMD_BAD 0x0fd0 | 62 | #define _PMD_BAD 0x0f90 |
| 63 | #define _PMD_PAGE_MASK 0x000c | 63 | #define _PMD_PAGE_MASK 0x000c |
| 64 | #define _PMD_PAGE_8M 0x000c | 64 | #define _PMD_PAGE_8M 0x000c |
| 65 | #define _PMD_PAGE_512K 0x0004 | 65 | #define _PMD_PAGE_512K 0x0004 |
| 66 | #define _PMD_USER 0x0020 /* APG 1 */ | 66 | #define _PMD_ACCESSED 0x0020 /* APG 1 */ |
| 67 | #define _PMD_USER 0x0040 /* APG 2 */ | ||
| 67 | 68 | ||
| 68 | #define _PTE_NONE_MASK 0 | 69 | #define _PTE_NONE_MASK 0 |
| 69 | 70 | ||
| @@ -6,6 +6,7 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | struct device; | 7 | struct device; |
| 8 | struct device_node; | 8 | struct device_node; |
| 9 | struct drmem_lmb; | ||
| 9 | 10 | ||
| 10 | #ifdef CONFIG_NUMA | 11 | #ifdef CONFIG_NUMA |
| 11 | 12 | ||
| @@ -61,6 +62,9 @@ static inline int early_cpu_to_node(int cpu) · 49 unmodified lines | |||
| 61 | */ | 62 | */ |
| 62 | return (nid < 0) ? 0 : nid; | 63 | return (nid < 0) ? 0 : nid; |
| 63 | } | 64 | } |
| 65 | |||
| 66 | int of_drconf_to_nid_single(struct drmem_lmb *lmb); | ||
| 67 | |||
| 64 | #else | 68 | #else |
| 65 | 69 | ||
| 66 | static inline int early_cpu_to_node(int cpu) { return 0; } | 70 | static inline int early_cpu_to_node(int cpu) { return 0; } |
| @@ -84,10 +88,12 @@ static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc) · 17 unmodified lines | |||
| 84 | return 0; | 88 | return 0; |
| 85 | } | 89 | } |
| 86 | 90 | ||
| 87 | #endif /* CONFIG_NUMA */ | 91 | static inline int of_drconf_to_nid_single(struct drmem_lmb *lmb) |
| 92 | { | ||
| 93 | return first_online_node; | ||
| 94 | } | ||
| 88 | 95 | ||
| 89 | struct drmem_lmb; | 96 | #endif /* CONFIG_NUMA */ |
| 90 | int of_drconf_to_nid_single(struct drmem_lmb *lmb); | ||
| 91 | 97 | ||
| 92 | #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR) | 98 | #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR) |
| 93 | extern int find_and_online_cpu_nid(int cpu); | 99 | extern int find_and_online_cpu_nid(int cpu); |
| @@ -178,7 +178,7 @@ do { \ · 177 unmodified lines | |||
| 178 | * are no aliasing issues. | 178 | * are no aliasing issues. |
| 179 | */ | 179 | */ |
| 180 | #define __put_user_asm_goto(x, addr, label, op) \ | 180 | #define __put_user_asm_goto(x, addr, label, op) \ |
| 181 | asm volatile goto( \ | 181 | asm_volatile_goto( \ |
| 182 | "1: " op "%U1%X1 %0,%1 # put_user\n" \ | 182 | "1: " op "%U1%X1 %0,%1 # put_user\n" \ |
| 183 | EX_TABLE(1b, %l2) \ | 183 | EX_TABLE(1b, %l2) \ |
| 184 | : \ | 184 | : \ |
| @@ -191,7 +191,7 @@ do { \ · 6 unmodified lines | |||
| 191 | __put_user_asm_goto(x, ptr, label, "std") | 191 | __put_user_asm_goto(x, ptr, label, "std") |
| 192 | #else /* __powerpc64__ */ | 192 | #else /* __powerpc64__ */ |
| 193 | #define __put_user_asm2_goto(x, addr, label) \ | 193 | #define __put_user_asm2_goto(x, addr, label) \ |
| 194 | asm volatile goto( \ | 194 | asm_volatile_goto( \ |
| 195 | "1: stw%X1 %0, %1\n" \ | 195 | "1: stw%X1 %0, %1\n" \ |
| 196 | "2: stw%X1 %L0, %L1\n" \ | 196 | "2: stw%X1 %L0, %L1\n" \ |
| 197 | EX_TABLE(1b, %l2) \ | 197 | EX_TABLE(1b, %l2) \ |
| @@ -264,8 +264,9 @@ static int eeh_addr_cache_show(struct seq_file *s, void *v) · 263 unmodified lines | |||
| 264 | { | 264 | { |
| 265 | struct pci_io_addr_range *piar; | 265 | struct pci_io_addr_range *piar; |
| 266 | struct rb_node *n; | 266 | struct rb_node *n; |
| 267 | unsigned long flags; | ||
| 267 | 268 | ||
| 268 | spin_lock(&pci_io_addr_cache_root.piar_lock); | 269 | spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); |
| 269 | for (n = rb_first(&pci_io_addr_cache_root.rb_root); n; n = rb_next(n)) { | 270 | for (n = rb_first(&pci_io_addr_cache_root.rb_root); n; n = rb_next(n)) { |
| 270 | piar = rb_entry(n, struct pci_io_addr_range, rb_node); | 271 | piar = rb_entry(n, struct pci_io_addr_range, rb_node); |
| 271 | 272 | ||
| @@ -273,7 +274,7 @@ static int eeh_addr_cache_show(struct seq_file *s, void *v) · 1 unmodified line | |||
| 273 | (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", | 274 | (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", |
| 274 | &piar->addr_lo, &piar->addr_hi, pci_name(piar->pcidev)); | 275 | &piar->addr_lo, &piar->addr_hi, pci_name(piar->pcidev)); |
| 275 | } | 276 | } |
| 276 | spin_unlock(&pci_io_addr_cache_root.piar_lock); | 277 | spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); |
| 277 | 278 | ||
| 278 | return 0; | 279 | return 0; |
| 279 | } | 280 | } |
| @@ -284,11 +284,7 @@ _ENTRY(saved_ksp_limit) · 283 unmodified lines | |||
| 284 | 284 | ||
| 285 | rlwimi r11, r10, 22, 20, 29 /* Compute PTE address */ | 285 | rlwimi r11, r10, 22, 20, 29 /* Compute PTE address */ |
| 286 | lwz r11, 0(r11) /* Get Linux PTE */ | 286 | lwz r11, 0(r11) /* Get Linux PTE */ |
| 287 | #ifdef CONFIG_SWAP | ||
| 288 | li r9, _PAGE_PRESENT | _PAGE_ACCESSED | 287 | li r9, _PAGE_PRESENT | _PAGE_ACCESSED |
| 289 | #else | ||
| 290 | li r9, _PAGE_PRESENT | ||
| 291 | #endif | ||
| 292 | andc. r9, r9, r11 /* Check permission */ | 288 | andc. r9, r9, r11 /* Check permission */ |
| 293 | bne 5f | 289 | bne 5f |
| 294 | 290 | ||
| @@ -369,11 +365,7 @@ _ENTRY(saved_ksp_limit) · 74 unmodified lines | |||
| 369 | 365 | ||
| 370 | rlwimi r11, r10, 22, 20, 29 /* Compute PTE address */ | 366 | rlwimi r11, r10, 22, 20, 29 /* Compute PTE address */ |
| 371 | lwz r11, 0(r11) /* Get Linux PTE */ | 367 | lwz r11, 0(r11) /* Get Linux PTE */ |
| 372 | #ifdef CONFIG_SWAP | ||
| 373 | li r9, _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | 368 | li r9, _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC |
| 374 | #else | ||
| 375 | li r9, _PAGE_PRESENT | _PAGE_EXEC | ||
| 376 | #endif | ||
| 377 | andc. r9, r9, r11 /* Check permission */ | 369 | andc. r9, r9, r11 /* Check permission */ |
| 378 | bne 5f | 370 | bne 5f |
| 379 | 371 | ||
| @@ -202,9 +202,7 @@ SystemCall: · 201 unmodified lines | |||
| 202 | 202 | ||
| 203 | InstructionTLBMiss: | 203 | InstructionTLBMiss: |
| 204 | mtspr SPRN_SPRG_SCRATCH0, r10 | 204 | mtspr SPRN_SPRG_SCRATCH0, r10 |
| 205 | #if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS) | ||
| 206 | mtspr SPRN_SPRG_SCRATCH1, r11 | 205 | mtspr SPRN_SPRG_SCRATCH1, r11 |
| 207 | #endif | ||
| 208 | 206 | ||
| 209 | /* If we are faulting a kernel address, we have to use the | 207 | /* If we are faulting a kernel address, we have to use the |
| 210 | * kernel page tables. | 208 | * kernel page tables. |
| @@ -224,25 +222,13 @@ InstructionTLBMiss: · 13 unmodified lines | |||
| 224 | 3: | 222 | 3: |
| 225 | mtcr r11 | 223 | mtcr r11 |
| 226 | #endif | 224 | #endif |
| 227 | #if defined(CONFIG_HUGETLBFS) || !defined(CONFIG_PIN_TLB_TEXT) | ||
| 228 | lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */ | 225 | lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */ |
| 229 | mtspr SPRN_MD_TWC, r11 | 226 | mtspr SPRN_MD_TWC, r11 |
| 230 | #else | ||
| 231 | lwz r10, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */ | ||
| 232 | mtspr SPRN_MI_TWC, r10 /* Set segment attributes */ | ||
| 233 | mtspr SPRN_MD_TWC, r10 | ||
| 234 | #endif | ||
| 235 | mfspr r10, SPRN_MD_TWC | 227 | mfspr r10, SPRN_MD_TWC |
| 236 | lwz r10, 0(r10) /* Get the pte */ | 228 | lwz r10, 0(r10) /* Get the pte */ |
| 237 | #if defined(CONFIG_HUGETLBFS) || !defined(CONFIG_PIN_TLB_TEXT) | 229 | rlwimi r11, r10, 0, _PAGE_GUARDED | _PAGE_ACCESSED |
| 238 | rlwimi r11, r10, 32 - 9, _PMD_PAGE_512K | 230 | rlwimi r11, r10, 32 - 9, _PMD_PAGE_512K |
| 239 | mtspr SPRN_MI_TWC, r11 | 231 | mtspr SPRN_MI_TWC, r11 |
| 240 | #endif | ||
| 241 | #ifdef CONFIG_SWAP | ||
| 242 | rlwinm r11, r10, 32-5, _PAGE_PRESENT | ||
| 243 | and r11, r11, r10 | ||
| 244 | rlwimi r10, r11, 0, _PAGE_PRESENT | ||
| 245 | #endif | ||
| 246 | /* The Linux PTE won't go exactly into the MMU TLB. | 232 | /* The Linux PTE won't go exactly into the MMU TLB. |
| 247 | * Software indicator bits 20 and 23 must be clear. | 233 | * Software indicator bits 20 and 23 must be clear. |
| 248 | * Software indicator bits 22, 24, 25, 26, and 27 must be | 234 | * Software indicator bits 22, 24, 25, 26, and 27 must be |
| @@ -256,9 +242,7 @@ InstructionTLBMiss: · 7 unmodified lines | |||
| 256 | 242 | ||
| 257 | /* Restore registers */ | 243 | /* Restore registers */ |
| 258 | 0: mfspr r10, SPRN_SPRG_SCRATCH0 | 244 | 0: mfspr r10, SPRN_SPRG_SCRATCH0 |
| 259 | #if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS) | ||
| 260 | mfspr r11, SPRN_SPRG_SCRATCH1 | 245 | mfspr r11, SPRN_SPRG_SCRATCH1 |
| 261 | #endif | ||
| 262 | rfi | 246 | rfi |
| 263 | patch_site 0b, patch__itlbmiss_exit_1 | 247 | patch_site 0b, patch__itlbmiss_exit_1 |
| 264 | 248 | ||
| @@ -268,9 +252,7 @@ InstructionTLBMiss: · 3 unmodified lines | |||
| 268 | addi r10, r10, 1 | 252 | addi r10, r10, 1 |
| 269 | stw r10, (itlb_miss_counter - PAGE_OFFSET)@l(0) | 253 | stw r10, (itlb_miss_counter - PAGE_OFFSET)@l(0) |
| 270 | mfspr r10, SPRN_SPRG_SCRATCH0 | 254 | mfspr r10, SPRN_SPRG_SCRATCH0 |
| 271 | #if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) | ||
| 272 | mfspr r11, SPRN_SPRG_SCRATCH1 | 255 | mfspr r11, SPRN_SPRG_SCRATCH1 |
| 273 | #endif | ||
| 274 | rfi | 256 | rfi |
| 275 | #endif | 257 | #endif |
| 276 | 258 | ||
| @@ -297,30 +279,16 @@ DataStoreTLBMiss: · 20 unmodified lines | |||
| 297 | mfspr r10, SPRN_MD_TWC | 279 | mfspr r10, SPRN_MD_TWC |
| 298 | lwz r10, 0(r10) /* Get the pte */ | 280 | lwz r10, 0(r10) /* Get the pte */ |
| 299 | 281 | ||
| 300 | /* Insert the Guarded flag into the TWC from the Linux PTE. | 282 | /* Insert Guarded and Accessed flags into the TWC from the Linux PTE. |
| 301 | * It is bit 27 of both the Linux PTE and the TWC (at least | 283 | * It is bit 27 of both the Linux PTE and the TWC (at least |
| 302 | * I got that right :-). It will be better when we can put | 284 | * I got that right :-). It will be better when we can put |
| 303 | * this into the Linux pgd/pmd and load it in the operation | 285 | * this into the Linux pgd/pmd and load it in the operation |
| 304 | * above. | 286 | * above. |
| 305 | */ | 287 | */ |
| 306 | rlwimi r11, r10, 0, _PAGE_GUARDED | 288 | rlwimi r11, r10, 0, _PAGE_GUARDED | _PAGE_ACCESSED |
| 307 | rlwimi r11, r10, 32 - 9, _PMD_PAGE_512K | 289 | rlwimi r11, r10, 32 - 9, _PMD_PAGE_512K |
| 308 | mtspr SPRN_MD_TWC, r11 | 290 | mtspr SPRN_MD_TWC, r11 |
| 309 | 291 | ||
| 310 | /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set. | ||
| 311 | * We also need to know if the insn is a load/store, so: | ||
| 312 | * Clear _PAGE_PRESENT and load that which will | ||
| 313 | * trap into DTLB Error with store bit set accordinly. | ||
| 314 | */ | ||
| 315 | /* PRESENT=0x1, ACCESSED=0x20 | ||
| 316 | * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5)); | ||
| 317 | * r10 = (r10 & ~PRESENT) | r11; | ||
| 318 | */ | ||
| 319 | #ifdef CONFIG_SWAP | ||
| 320 | rlwinm r11, r10, 32-5, _PAGE_PRESENT | ||
| 321 | and r11, r11, r10 | ||
| 322 | rlwimi r10, r11, 0, _PAGE_PRESENT | ||
| 323 | #endif | ||
| 324 | /* The Linux PTE won't go exactly into the MMU TLB. | 292 | /* The Linux PTE won't go exactly into the MMU TLB. |
| 325 | * Software indicator bits 24, 25, 26, and 27 must be | 293 | * Software indicator bits 24, 25, 26, and 27 must be |
| 326 | * set. All other Linux PTE bits control the behavior | 294 | * set. All other Linux PTE bits control the behavior |
| @@ -711,7 +679,7 @@ initial_mmu: · 384 unmodified lines | |||
| 711 | li r9, 4 /* up to 4 pages of 8M */ | 679 | li r9, 4 /* up to 4 pages of 8M */ |
| 712 | mtctr r9 | 680 | mtctr r9 |
| 713 | lis r9, KERNELBASE@h /* Create vaddr for TLB */ | 681 | lis r9, KERNELBASE@h /* Create vaddr for TLB */ |
| 714 | li r10, MI_PS8MEG | MI_SVALID /* Set 8M byte page */ | 682 | li r10, MI_PS8MEG | _PMD_ACCESSED | MI_SVALID |
| 715 | li r11, MI_BOOTINIT /* Create RPN for address 0 */ | 683 | li r11, MI_BOOTINIT /* Create RPN for address 0 */ |
| 716 | 1: | 684 | 1: |
| 717 | mtspr SPRN_MI_CTR, r8 /* Set instruction MMU control */ | 685 | mtspr SPRN_MI_CTR, r8 /* Set instruction MMU control */ |
| @@ -775,7 +743,7 @@ _GLOBAL(mmu_pin_tlb) · 57 unmodified lines | |||
| 775 | #ifdef CONFIG_PIN_TLB_TEXT | 743 | #ifdef CONFIG_PIN_TLB_TEXT |
| 776 | LOAD_REG_IMMEDIATE(r5, 28 << 8) | 744 | LOAD_REG_IMMEDIATE(r5, 28 << 8) |
| 777 | LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET) | 745 | LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET) |
| 778 | LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG) | 746 | LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG | _PMD_ACCESSED) |
| 779 | LOAD_REG_IMMEDIATE(r8, 0xf0 | _PAGE_RO | _PAGE_SPS | _PAGE_SH | _PAGE_PRESENT) | 747 | LOAD_REG_IMMEDIATE(r8, 0xf0 | _PAGE_RO | _PAGE_SPS | _PAGE_SH | _PAGE_PRESENT) |
| 780 | LOAD_REG_ADDR(r9, _sinittext) | 748 | LOAD_REG_ADDR(r9, _sinittext) |
| 781 | li r0, 4 | 749 | li r0, 4 |
| @@ -797,7 +765,7 @@ _GLOBAL(mmu_pin_tlb) · 15 unmodified lines | |||
| 797 | LOAD_REG_IMMEDIATE(r5, 28 << 8 | MD_TWAM) | 765 | LOAD_REG_IMMEDIATE(r5, 28 << 8 | MD_TWAM) |
| 798 | #ifdef CONFIG_PIN_TLB_DATA | 766 | #ifdef CONFIG_PIN_TLB_DATA |
| 799 | LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET) | 767 | LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET) |
| 800 | LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG) | 768 | LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG | _PMD_ACCESSED) |
| 801 | #ifdef CONFIG_PIN_TLB_IMMR | 769 | #ifdef CONFIG_PIN_TLB_IMMR |
| 802 | li r0, 3 | 770 | li r0, 3 |
| 803 | #else | 771 | #else |
| @@ -834,7 +802,7 @@ _GLOBAL(mmu_pin_tlb) · 30 unmodified lines | |||
| 834 | #endif | 802 | #endif |
| 835 | #ifdef CONFIG_PIN_TLB_IMMR | 803 | #ifdef CONFIG_PIN_TLB_IMMR |
| 836 | LOAD_REG_IMMEDIATE(r0, VIRT_IMMR_BASE | MD_EVALID) | 804 | LOAD_REG_IMMEDIATE(r0, VIRT_IMMR_BASE | MD_EVALID) |
| 837 | LOAD_REG_IMMEDIATE(r7, MD_SVALID | MD_PS512K | MD_GUARDED) | 805 | LOAD_REG_IMMEDIATE(r7, MD_SVALID | MD_PS512K | MD_GUARDED | _PMD_ACCESSED) |
| 838 | mfspr r8, SPRN_IMMR | 806 | mfspr r8, SPRN_IMMR |
| 839 | rlwinm r8, r8, 0, 0xfff80000 | 807 | rlwinm r8, r8, 0, 0xfff80000 |
| 840 | ori r8, r8, 0xf0 | _PAGE_DIRTY | _PAGE_SPS | _PAGE_SH | \ | 808 | ori r8, r8, 0xf0 | _PAGE_DIRTY | _PAGE_SPS | _PAGE_SH | \ |
| @@ -457,11 +457,7 @@ InstructionTLBMiss: · 456 unmodified lines | |||
| 457 | cmplw 0,r1,r3 | 457 | cmplw 0,r1,r3 |
| 458 | #endif | 458 | #endif |
| 459 | mfspr r2, SPRN_SPRG_PGDIR | 459 | mfspr r2, SPRN_SPRG_PGDIR |
| 460 | #ifdef CONFIG_SWAP | ||
| 461 | li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | 460 | li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC |
| 462 | #else | ||
| 463 | li r1,_PAGE_PRESENT | _PAGE_EXEC | ||
| 464 | #endif | ||
| 465 | #if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) | 461 | #if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) |
| 466 | bgt- 112f | 462 | bgt- 112f |
| 467 | lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ | 463 | lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ |
| @@ -523,11 +519,7 @@ DataLoadTLBMiss: · 55 unmodified lines | |||
| 523 | lis r1, TASK_SIZE@h /* check if kernel address */ | 519 | lis r1, TASK_SIZE@h /* check if kernel address */ |
| 524 | cmplw 0,r1,r3 | 520 | cmplw 0,r1,r3 |
| 525 | mfspr r2, SPRN_SPRG_PGDIR | 521 | mfspr r2, SPRN_SPRG_PGDIR |
| 526 | #ifdef CONFIG_SWAP | ||
| 527 | li r1, _PAGE_PRESENT | _PAGE_ACCESSED | 522 | li r1, _PAGE_PRESENT | _PAGE_ACCESSED |
| 528 | #else | ||
| 529 | li r1, _PAGE_PRESENT | ||
| 530 | #endif | ||
| 531 | bgt- 112f | 523 | bgt- 112f |
| 532 | lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ | 524 | lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ |
| 533 | addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ | 525 | addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ |
| @@ -603,11 +595,7 @@ DataStoreTLBMiss: · 69 unmodified lines | |||
| 603 | lis r1, TASK_SIZE@h /* check if kernel address */ | 595 | lis r1, TASK_SIZE@h /* check if kernel address */ |
| 604 | cmplw 0,r1,r3 | 596 | cmplw 0,r1,r3 |
| 605 | mfspr r2, SPRN_SPRG_PGDIR | 597 | mfspr r2, SPRN_SPRG_PGDIR |
| 606 | #ifdef CONFIG_SWAP | ||
| 607 | li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED | 598 | li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED |
| 608 | #else | ||
| 609 | li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | ||
| 610 | #endif | ||
| 611 | bgt- 112f | 599 | bgt- 112f |
| 612 | lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ | 600 | lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ |
| 613 | addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ | 601 | addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ |
| @@ -1393,13 +1393,14 @@ static void add_cpu_to_masks(int cpu) · 1392 unmodified lines | |||
| 1393 | /* Activate a secondary processor. */ | 1393 | /* Activate a secondary processor. */ |
| 1394 | void start_secondary(void *unused) | 1394 | void start_secondary(void *unused) |
| 1395 | { | 1395 | { |
| 1396 | unsigned int cpu = smp_processor_id(); | 1396 | unsigned int cpu = raw_smp_processor_id(); |
| 1397 | 1397 | ||
| 1398 | mmgrab(&init_mm); | 1398 | mmgrab(&init_mm); |
| 1399 | current->active_mm = &init_mm; | 1399 | current->active_mm = &init_mm; |
| 1400 | 1400 | ||
| 1401 | smp_store_cpu_info(cpu); | 1401 | smp_store_cpu_info(cpu); |
| 1402 | set_dec(tb_ticks_per_jiffy); | 1402 | set_dec(tb_ticks_per_jiffy); |
| 1403 | rcu_cpu_starting(cpu); | ||
| 1403 | preempt_disable(); | 1404 | preempt_disable(); |
| 1404 | cpu_callin_map[cpu] = 1; | 1405 | cpu_callin_map[cpu] = 1; |
| 1405 | 1406 | ||
| @@ -476,7 +476,7 @@ do { \ · 475 unmodified lines | |||
| 476 | do { \ | 476 | do { \ |
| 477 | long __kr_err; \ | 477 | long __kr_err; \ |
| 478 | \ | 478 | \ |
| 479 | __put_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \ | 479 | __put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \ |
| 480 | if (unlikely(__kr_err)) \ | 480 | if (unlikely(__kr_err)) \ |
| 481 | goto err_label; \ | 481 | goto err_label; \ |
| 482 | } while (0) | 482 | } while (0) |
| @@ -1,4 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) 2013 Linaro Limited | 3 | * Copyright (C) 2013 Linaro Limited |
| 4 | * Author: AKASHI Takahiro <takahiro.akashi@linaro.org> | 4 | * Author: AKASHI Takahiro <takahiro.akashi@linaro.org> |
| @@ -35,12 +35,17 @@ ENTRY(_start) · 34 unmodified lines | |||
| 35 | .word 0 | 35 | .word 0 |
| 36 | #endif | 36 | #endif |
| 37 | .balign 8 | 37 | .balign 8 |
| 38 | #ifdef CONFIG_RISCV_M_MODE | ||
| 39 | /* Image load offset (0MB) from start of RAM for M-mode */ | ||
| 40 | .dword 0 | ||
| 41 | #else | ||
| 38 | #if __riscv_xlen == 64 | 42 | #if __riscv_xlen == 64 |
| 39 | /* Image load offset(2MB) from start of RAM */ | 43 | /* Image load offset(2MB) from start of RAM */ |
| 40 | .dword 0x200000 | 44 | .dword 0x200000 |
| 41 | #else | 45 | #else |
| 42 | /* Image load offset(4MB) from start of RAM */ | 46 | /* Image load offset(4MB) from start of RAM */ |
| 43 | .dword 0x400000 | 47 | .dword 0x400000 |
| 48 | #endif | ||
| 44 | #endif | 49 | #endif |
| 45 | /* Effective size of kernel image */ | 50 | /* Effective size of kernel image */ |
| 46 | .dword _end - _start | 51 | .dword _end - _start |
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | vdso.lds | 2 | vdso.lds |
| 3 | *.tmp | 3 | *.tmp |
| 4 | vdso-syms.S | ||
| @@ -43,19 +43,14 @@ $(obj)/vdso.o: $(obj)/vdso.so · 42 unmodified lines | |||
| 43 | SYSCFLAGS_vdso.so.dbg = $(c_flags) | 43 | SYSCFLAGS_vdso.so.dbg = $(c_flags) |
| 44 | $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE | 44 | $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE |
| 45 | $(call if_changed,vdsold) | 45 | $(call if_changed,vdsold) |
| 46 | SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \ | ||
| 47 | -Wl,--build-id -Wl,--hash-style=both | ||
| 46 | 48 | ||
| 47 | # We also create a special relocatable object that should mirror the symbol | 49 | # We also create a special relocatable object that should mirror the symbol |
| 48 | # table and layout of the linked DSO. With ld --just-symbols we can then | 50 | # table and layout of the linked DSO. With ld --just-symbols we can then |
| 49 | # refer to these symbols in the kernel code rather than hand-coded addresses. | 51 | # refer to these symbols in the kernel code rather than hand-coded addresses. |
| 50 | 52 | $(obj)/vdso-syms.S: $(obj)/vdso.so FORCE | |
| 51 | SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \ | 53 | $(call if_changed,so2s) |
| 52 | -Wl,--build-id=sha1 -Wl,--hash-style=both | ||
| 53 | $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE | ||
| 54 | $(call if_changed,vdsold) | ||
| 55 | |||
| 56 | LDFLAGS_vdso-syms.o := -r --just-symbols | ||
| 57 | $(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE | ||
| 58 | $(call if_changed,ld) | ||
| 59 | 54 | ||
| 60 | # strip rule for the .so file | 55 | # strip rule for the .so file |
| 61 | $(obj)/%.so: OBJCOPYFLAGS := -S | 56 | $(obj)/%.so: OBJCOPYFLAGS := -S |
| @@ -73,6 +68,11 @@ quiet_cmd_vdsold = VDSOLD $@ · 11 unmodified lines | |||
| 73 | $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \ | 68 | $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \ |
| 74 | rm $@.tmp | 69 | rm $@.tmp |
| 75 | 70 | ||
| 71 | # Extracts symbol offsets from the VDSO, converting them into an assembly file | ||
| 72 | # that contains the same symbols at the same offsets. | ||
| 73 | quiet_cmd_so2s = SO2S $@ | ||
| 74 | cmd_so2s = $(NM) -D $< | $(srctree)/$(src)/so2s.sh > $@ | ||
| 75 | |||
| 76 | # install commands for the unstripped file | 76 | # install commands for the unstripped file |
| 77 | quiet_cmd_vdso_install = INSTALL $@ | 77 | quiet_cmd_vdso_install = INSTALL $@ |
| 78 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ | 78 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ |
| @@ -0,0 +1,6 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0+ | ||
| 3 | # Copyright 2020 Palmer Dabbelt <palmerdabbelt@google.com> | ||
| 4 | |||
| 5 | sed 's!\([0-9a-f]*\) T \([a-z0-9_]*\)\(@@LINUX_4.15\)*!.global \2\n.set \2,0x\1!' \ | ||
| 6 | | grep '^\.' | ||
| @@ -86,6 +86,7 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a · 85 unmodified lines | |||
| 86 | pmd_t *pmd, *pmd_k; | 86 | pmd_t *pmd, *pmd_k; |
| 87 | pte_t *pte_k; | 87 | pte_t *pte_k; |
| 88 | int index; | 88 | int index; |
| 89 | unsigned long pfn; | ||
| 89 | 90 | ||
| 90 | /* User mode accesses just cause a SIGSEGV */ | 91 | /* User mode accesses just cause a SIGSEGV */ |
| 91 | if (user_mode(regs)) | 92 | if (user_mode(regs)) |
| @@ -100,7 +101,8 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a · 8 unmodified lines | |||
| 100 | * of a task switch. | 101 | * of a task switch. |
| 101 | */ | 102 | */ |
| 102 | index = pgd_index(addr); | 103 | index = pgd_index(addr); |
| 103 | pgd = (pgd_t *)pfn_to_virt(csr_read(CSR_SATP)) + index; | 104 | pfn = csr_read(CSR_SATP) & SATP_PPN; |
| 105 | pgd = (pgd_t *)pfn_to_virt(pfn) + index; | ||
| 104 | pgd_k = init_mm.pgd + index; | 106 | pgd_k = init_mm.pgd + index; |
| 105 | 107 | ||
| 106 | if (!pgd_present(*pgd_k)) { | 108 | if (!pgd_present(*pgd_k)) { |
| @@ -154,9 +154,8 @@ disable: · 153 unmodified lines | |||
| 154 | 154 | ||
| 155 | void __init setup_bootmem(void) | 155 | void __init setup_bootmem(void) |
| 156 | { | 156 | { |
| 157 | phys_addr_t mem_size = 0; | 157 | phys_addr_t mem_start = 0; |
| 158 | phys_addr_t total_mem = 0; | 158 | phys_addr_t start, end = 0; |
| 159 | phys_addr_t mem_start, start, end = 0; | ||
| 160 | phys_addr_t vmlinux_end = __pa_symbol(&_end); | 159 | phys_addr_t vmlinux_end = __pa_symbol(&_end); |
| 161 | phys_addr_t vmlinux_start = __pa_symbol(&_start); | 160 | phys_addr_t vmlinux_start = __pa_symbol(&_start); |
| 162 | u64 i; | 161 | u64 i; |
| @@ -164,21 +163,18 @@ void __init setup_bootmem(void) · 1 unmodified line | |||
| 164 | /* Find the memory region containing the kernel */ | 163 | /* Find the memory region containing the kernel */ |
| 165 | for_each_mem_range(i, &start, &end) { | 164 | for_each_mem_range(i, &start, &end) { |
| 166 | phys_addr_t size = end - start; | 165 | phys_addr_t size = end - start; |
| 167 | if (!total_mem) | 166 | if (!mem_start) |
| 168 | mem_start = start; | 167 | mem_start = start; |
| 169 | if (start <= vmlinux_start && vmlinux_end <= end) | 168 | if (start <= vmlinux_start && vmlinux_end <= end) |
| 170 | BUG_ON(size == 0); | 169 | BUG_ON(size == 0); |
| 171 | total_mem = total_mem + size; | ||
| 172 | } | 170 | } |
| 173 | 171 | ||
| 174 | /* | 172 | /* |
| 175 | * Remove memblock from the end of usable area to the | 173 | * The maximal physical memory size is -PAGE_OFFSET. |
| 176 | * end of region | 174 | * Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed |
| 175 | * as it is unusable by kernel. | ||
| 177 | */ | 176 | */ |
| 178 | mem_size = min(total_mem, (phys_addr_t)-PAGE_OFFSET); | 177 | memblock_enforce_memory_limit(mem_start - PAGE_OFFSET); |
| 179 | if (mem_start + mem_size < end) | ||
| 180 | memblock_remove(mem_start + mem_size, | ||
| 181 | end - mem_start - mem_size); | ||
| 182 | 178 | ||
| 183 | /* Reserve from the start of the kernel to the end of the kernel */ | 179 | /* Reserve from the start of the kernel to the end of the kernel */ |
| 184 | memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); | 180 | memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); |
| @@ -297,6 +293,7 @@ pmd_t fixmap_pmd[PTRS_PER_PMD] __page_aligned_bss; · 112 unmodified lines | |||
| 297 | #define NUM_EARLY_PMDS (1UL + MAX_EARLY_MAPPING_SIZE / PGDIR_SIZE) | 293 | #define NUM_EARLY_PMDS (1UL + MAX_EARLY_MAPPING_SIZE / PGDIR_SIZE) |
| 298 | #endif | 294 | #endif |
| 299 | pmd_t early_pmd[PTRS_PER_PMD * NUM_EARLY_PMDS] __initdata __aligned(PAGE_SIZE); | 295 | pmd_t early_pmd[PTRS_PER_PMD * NUM_EARLY_PMDS] __initdata __aligned(PAGE_SIZE); |
| 296 | pmd_t early_dtb_pmd[PTRS_PER_PMD] __initdata __aligned(PAGE_SIZE); | ||
| 300 | 297 | ||
| 301 | static pmd_t *__init get_pmd_virt_early(phys_addr_t pa) | 298 | static pmd_t *__init get_pmd_virt_early(phys_addr_t pa) |
| 302 | { | 299 | { |
| @@ -494,6 +491,18 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) · 191 unmodified lines | |||
| 494 | load_pa + (va - PAGE_OFFSET), | 491 | load_pa + (va - PAGE_OFFSET), |
| 495 | map_size, PAGE_KERNEL_EXEC); | 492 | map_size, PAGE_KERNEL_EXEC); |
| 496 | 493 | ||
| 494 | #ifndef __PAGETABLE_PMD_FOLDED | ||
| 495 | /* Setup early PMD for DTB */ | ||
| 496 | create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA, | ||
| 497 | (uintptr_t)early_dtb_pmd, PGDIR_SIZE, PAGE_TABLE); | ||
| 498 | /* Create two consecutive PMD mappings for FDT early scan */ | ||
| 499 | pa = dtb_pa & ~(PMD_SIZE - 1); | ||
| 500 | create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA, | ||
| 501 | pa, PMD_SIZE, PAGE_KERNEL); | ||
| 502 | create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA + PMD_SIZE, | ||
| 503 | pa + PMD_SIZE, PMD_SIZE, PAGE_KERNEL); | ||
| 504 | dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PMD_SIZE - 1)); | ||
| 505 | #else | ||
| 497 | /* Create two consecutive PGD mappings for FDT early scan */ | 506 | /* Create two consecutive PGD mappings for FDT early scan */ |
| 498 | pa = dtb_pa & ~(PGDIR_SIZE - 1); | 507 | pa = dtb_pa & ~(PGDIR_SIZE - 1); |
| 499 | create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA, | 508 | create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA, |
| @@ -501,6 +510,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) · 1 unmodified line | |||
| 501 | create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA + PGDIR_SIZE, | 510 | create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA + PGDIR_SIZE, |
| 502 | pa + PGDIR_SIZE, PGDIR_SIZE, PAGE_KERNEL); | 511 | pa + PGDIR_SIZE, PGDIR_SIZE, PAGE_KERNEL); |
| 503 | dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PGDIR_SIZE - 1)); | 512 | dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PGDIR_SIZE - 1)); |
| 513 | #endif | ||
| 504 | dtb_early_pa = dtb_pa; | 514 | dtb_early_pa = dtb_pa; |
| 505 | 515 | ||
| 506 | /* | 516 | /* |
| @@ -93,9 +93,10 @@ CONFIG_CLEANCACHE=y · 92 unmodified lines | |||
| 93 | CONFIG_FRONTSWAP=y | 93 | CONFIG_FRONTSWAP=y |
| 94 | CONFIG_CMA_DEBUG=y | 94 | CONFIG_CMA_DEBUG=y |
| 95 | CONFIG_CMA_DEBUGFS=y | 95 | CONFIG_CMA_DEBUGFS=y |
| 96 | CONFIG_CMA_AREAS=7 | ||
| 96 | CONFIG_MEM_SOFT_DIRTY=y | 97 | CONFIG_MEM_SOFT_DIRTY=y |
| 97 | CONFIG_ZSWAP=y | 98 | CONFIG_ZSWAP=y |
| 98 | CONFIG_ZSMALLOC=m | 99 | CONFIG_ZSMALLOC=y |
| 99 | CONFIG_ZSMALLOC_STAT=y | 100 | CONFIG_ZSMALLOC_STAT=y |
| 100 | CONFIG_DEFERRED_STRUCT_PAGE_INIT=y | 101 | CONFIG_DEFERRED_STRUCT_PAGE_INIT=y |
| 101 | CONFIG_IDLE_PAGE_TRACKING=y | 102 | CONFIG_IDLE_PAGE_TRACKING=y |
| @@ -378,7 +379,6 @@ CONFIG_NETLINK_DIAG=m · 276 unmodified lines | |||
| 378 | CONFIG_CGROUP_NET_PRIO=y | 379 | CONFIG_CGROUP_NET_PRIO=y |
| 379 | CONFIG_BPF_JIT=y | 380 | CONFIG_BPF_JIT=y |
| 380 | CONFIG_NET_PKTGEN=m | 381 | CONFIG_NET_PKTGEN=m |
| 381 | # CONFIG_NET_DROP_MONITOR is not set | ||
| 382 | CONFIG_PCI=y | 382 | CONFIG_PCI=y |
| 383 | # CONFIG_PCIEASPM is not set | 383 | # CONFIG_PCIEASPM is not set |
| 384 | CONFIG_PCI_DEBUG=y | 384 | CONFIG_PCI_DEBUG=y |
| @@ -386,7 +386,7 @@ CONFIG_HOTPLUG_PCI=y · 1 unmodified line | |||
| 386 | CONFIG_HOTPLUG_PCI_S390=y | 386 | CONFIG_HOTPLUG_PCI_S390=y |
| 387 | CONFIG_DEVTMPFS=y | 387 | CONFIG_DEVTMPFS=y |
| 388 | CONFIG_CONNECTOR=y | 388 | CONFIG_CONNECTOR=y |
| 389 | CONFIG_ZRAM=m | 389 | CONFIG_ZRAM=y |
| 390 | CONFIG_BLK_DEV_LOOP=m | 390 | CONFIG_BLK_DEV_LOOP=m |
| 391 | CONFIG_BLK_DEV_CRYPTOLOOP=m | 391 | CONFIG_BLK_DEV_CRYPTOLOOP=m |
| 392 | CONFIG_BLK_DEV_DRBD=m | 392 | CONFIG_BLK_DEV_DRBD=m |
| @@ -689,6 +689,7 @@ CONFIG_CRYPTO_TEST=m · 296 unmodified lines | |||
| 689 | CONFIG_CRYPTO_DH=m | 689 | CONFIG_CRYPTO_DH=m |
| 690 | CONFIG_CRYPTO_ECDH=m | 690 | CONFIG_CRYPTO_ECDH=m |
| 691 | CONFIG_CRYPTO_ECRDSA=m | 691 | CONFIG_CRYPTO_ECRDSA=m |
| 692 | CONFIG_CRYPTO_SM2=m | ||
| 692 | CONFIG_CRYPTO_CURVE25519=m | 693 | CONFIG_CRYPTO_CURVE25519=m |
| 693 | CONFIG_CRYPTO_GCM=y | 694 | CONFIG_CRYPTO_GCM=y |
| 694 | CONFIG_CRYPTO_CHACHA20POLY1305=m | 695 | CONFIG_CRYPTO_CHACHA20POLY1305=m |
| @@ -709,7 +710,6 @@ CONFIG_CRYPTO_RMD160=m · 14 unmodified lines | |||
| 709 | CONFIG_CRYPTO_RMD256=m | 710 | CONFIG_CRYPTO_RMD256=m |
| 710 | CONFIG_CRYPTO_RMD320=m | 711 | CONFIG_CRYPTO_RMD320=m |
| 711 | CONFIG_CRYPTO_SHA3=m | 712 | CONFIG_CRYPTO_SHA3=m |
| 712 | CONFIG_CRYPTO_SM3=m | ||
| 713 | CONFIG_CRYPTO_TGR192=m | 713 | CONFIG_CRYPTO_TGR192=m |
| 714 | CONFIG_CRYPTO_WP512=m | 714 | CONFIG_CRYPTO_WP512=m |
| 715 | CONFIG_CRYPTO_AES_TI=m | 715 | CONFIG_CRYPTO_AES_TI=m |
| @@ -753,6 +753,7 @@ CONFIG_CRYPTO_DES_S390=m · 37 unmodified lines | |||
| 753 | CONFIG_CRYPTO_AES_S390=m | 753 | CONFIG_CRYPTO_AES_S390=m |
| 754 | CONFIG_CRYPTO_GHASH_S390=m | 754 | CONFIG_CRYPTO_GHASH_S390=m |
| 755 | CONFIG_CRYPTO_CRC32_S390=y | 755 | CONFIG_CRYPTO_CRC32_S390=y |
| 756 | CONFIG_CRYPTO_DEV_VIRTIO=m | ||
| 756 | CONFIG_CORDIC=m | 757 | CONFIG_CORDIC=m |
| 757 | CONFIG_CRC32_SELFTEST=y | 758 | CONFIG_CRC32_SELFTEST=y |
| 758 | CONFIG_CRC4=m | 759 | CONFIG_CRC4=m |
| @@ -829,6 +830,7 @@ CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m · 70 unmodified lines | |||
| 829 | CONFIG_FAULT_INJECTION=y | 830 | CONFIG_FAULT_INJECTION=y |
| 830 | CONFIG_FAILSLAB=y | 831 | CONFIG_FAILSLAB=y |
| 831 | CONFIG_FAIL_PAGE_ALLOC=y | 832 | CONFIG_FAIL_PAGE_ALLOC=y |
| 833 | CONFIG_FAULT_INJECTION_USERCOPY=y | ||
| 832 | CONFIG_FAIL_MAKE_REQUEST=y | 834 | CONFIG_FAIL_MAKE_REQUEST=y |
| 833 | CONFIG_FAIL_IO_TIMEOUT=y | 835 | CONFIG_FAIL_IO_TIMEOUT=y |
| 834 | CONFIG_FAIL_FUTEX=y | 836 | CONFIG_FAIL_FUTEX=y |
| @@ -87,9 +87,10 @@ CONFIG_KSM=y · 86 unmodified lines | |||
| 87 | CONFIG_TRANSPARENT_HUGEPAGE=y | 87 | CONFIG_TRANSPARENT_HUGEPAGE=y |
| 88 | CONFIG_CLEANCACHE=y | 88 | CONFIG_CLEANCACHE=y |
| 89 | CONFIG_FRONTSWAP=y | 89 | CONFIG_FRONTSWAP=y |
| 90 | CONFIG_CMA_AREAS=7 | ||
| 90 | CONFIG_MEM_SOFT_DIRTY=y | 91 | CONFIG_MEM_SOFT_DIRTY=y |
| 91 | CONFIG_ZSWAP=y | 92 | CONFIG_ZSWAP=y |
| 92 | CONFIG_ZSMALLOC=m | 93 | CONFIG_ZSMALLOC=y |
| 93 | CONFIG_ZSMALLOC_STAT=y | 94 | CONFIG_ZSMALLOC_STAT=y |
| 94 | CONFIG_DEFERRED_STRUCT_PAGE_INIT=y | 95 | CONFIG_DEFERRED_STRUCT_PAGE_INIT=y |
| 95 | CONFIG_IDLE_PAGE_TRACKING=y | 96 | CONFIG_IDLE_PAGE_TRACKING=y |
| @@ -371,7 +372,6 @@ CONFIG_NETLINK_DIAG=m · 275 unmodified lines | |||
| 371 | CONFIG_CGROUP_NET_PRIO=y | 372 | CONFIG_CGROUP_NET_PRIO=y |
| 372 | CONFIG_BPF_JIT=y | 373 | CONFIG_BPF_JIT=y |
| 373 | CONFIG_NET_PKTGEN=m | 374 | CONFIG_NET_PKTGEN=m |
| 374 | # CONFIG_NET_DROP_MONITOR is not set | ||
| 375 | CONFIG_PCI=y | 375 | CONFIG_PCI=y |
| 376 | # CONFIG_PCIEASPM is not set | 376 | # CONFIG_PCIEASPM is not set |
| 377 | CONFIG_HOTPLUG_PCI=y | 377 | CONFIG_HOTPLUG_PCI=y |
| @@ -379,7 +379,7 @@ CONFIG_HOTPLUG_PCI_S390=y · 1 unmodified line | |||
| 379 | CONFIG_UEVENT_HELPER=y | 379 | CONFIG_UEVENT_HELPER=y |
| 380 | CONFIG_DEVTMPFS=y | 380 | CONFIG_DEVTMPFS=y |
| 381 | CONFIG_CONNECTOR=y | 381 | CONFIG_CONNECTOR=y |
| 382 | CONFIG_ZRAM=m | 382 | CONFIG_ZRAM=y |
| 383 | CONFIG_BLK_DEV_LOOP=m | 383 | CONFIG_BLK_DEV_LOOP=m |
| 384 | CONFIG_BLK_DEV_CRYPTOLOOP=m | 384 | CONFIG_BLK_DEV_CRYPTOLOOP=m |
| 385 | CONFIG_BLK_DEV_DRBD=m | 385 | CONFIG_BLK_DEV_DRBD=m |
| @@ -680,6 +680,7 @@ CONFIG_CRYPTO_TEST=m · 294 unmodified lines | |||
| 680 | CONFIG_CRYPTO_DH=m | 680 | CONFIG_CRYPTO_DH=m |
| 681 | CONFIG_CRYPTO_ECDH=m | 681 | CONFIG_CRYPTO_ECDH=m |
| 682 | CONFIG_CRYPTO_ECRDSA=m | 682 | CONFIG_CRYPTO_ECRDSA=m |
| 683 | CONFIG_CRYPTO_SM2=m | ||
| 683 | CONFIG_CRYPTO_CURVE25519=m | 684 | CONFIG_CRYPTO_CURVE25519=m |
| 684 | CONFIG_CRYPTO_GCM=y | 685 | CONFIG_CRYPTO_GCM=y |
| 685 | CONFIG_CRYPTO_CHACHA20POLY1305=m | 686 | CONFIG_CRYPTO_CHACHA20POLY1305=m |
| @@ -701,7 +702,6 @@ CONFIG_CRYPTO_RMD160=m · 15 unmodified lines | |||
| 701 | CONFIG_CRYPTO_RMD256=m | 702 | CONFIG_CRYPTO_RMD256=m |
| 702 | CONFIG_CRYPTO_RMD320=m | 703 | CONFIG_CRYPTO_RMD320=m |
| 703 | CONFIG_CRYPTO_SHA3=m | 704 | CONFIG_CRYPTO_SHA3=m |
| 704 | CONFIG_CRYPTO_SM3=m | ||
| 705 | CONFIG_CRYPTO_TGR192=m | 705 | CONFIG_CRYPTO_TGR192=m |
| 706 | CONFIG_CRYPTO_WP512=m | 706 | CONFIG_CRYPTO_WP512=m |
| 707 | CONFIG_CRYPTO_AES_TI=m | 707 | CONFIG_CRYPTO_AES_TI=m |
| @@ -745,6 +745,7 @@ CONFIG_CRYPTO_DES_S390=m · 37 unmodified lines | |||
| 745 | CONFIG_CRYPTO_AES_S390=m | 745 | CONFIG_CRYPTO_AES_S390=m |
| 746 | CONFIG_CRYPTO_GHASH_S390=m | 746 | CONFIG_CRYPTO_GHASH_S390=m |
| 747 | CONFIG_CRYPTO_CRC32_S390=y | 747 | CONFIG_CRYPTO_CRC32_S390=y |
| 748 | CONFIG_CRYPTO_DEV_VIRTIO=m | ||
| 748 | CONFIG_CORDIC=m | 749 | CONFIG_CORDIC=m |
| 749 | CONFIG_PRIME_NUMBERS=m | 750 | CONFIG_PRIME_NUMBERS=m |
| 750 | CONFIG_CRC4=m | 751 | CONFIG_CRC4=m |
| @@ -17,11 +17,11 @@ CONFIG_HZ_100=y · 16 unmodified lines | |||
| 17 | # CONFIG_CHSC_SCH is not set | 17 | # CONFIG_CHSC_SCH is not set |
| 18 | # CONFIG_SCM_BUS is not set | 18 | # CONFIG_SCM_BUS is not set |
| 19 | CONFIG_CRASH_DUMP=y | 19 | CONFIG_CRASH_DUMP=y |
| 20 | # CONFIG_SECCOMP is not set | ||
| 21 | # CONFIG_PFAULT is not set | 20 | # CONFIG_PFAULT is not set |
| 22 | # CONFIG_S390_HYPFS_FS is not set | 21 | # CONFIG_S390_HYPFS_FS is not set |
| 23 | # CONFIG_VIRTUALIZATION is not set | 22 | # CONFIG_VIRTUALIZATION is not set |
| 24 | # CONFIG_S390_GUEST is not set | 23 | # CONFIG_S390_GUEST is not set |
| 24 | # CONFIG_SECCOMP is not set | ||
| 25 | CONFIG_PARTITION_ADVANCED=y | 25 | CONFIG_PARTITION_ADVANCED=y |
| 26 | CONFIG_IBM_PARTITION=y | 26 | CONFIG_IBM_PARTITION=y |
| 27 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 27 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| @@ -692,16 +692,6 @@ static inline int pud_large(pud_t pud) · 691 unmodified lines | |||
| 692 | return !!(pud_val(pud) & _REGION3_ENTRY_LARGE); | 692 | return !!(pud_val(pud) & _REGION3_ENTRY_LARGE); |
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | static inline unsigned long pud_pfn(pud_t pud) | ||
| 696 | { | ||
| 697 | unsigned long origin_mask; | ||
| 698 | |||
| 699 | origin_mask = _REGION_ENTRY_ORIGIN; | ||
| 700 | if (pud_large(pud)) | ||
| 701 | origin_mask = _REGION3_ENTRY_ORIGIN_LARGE; | ||
| 702 | return (pud_val(pud) & origin_mask) >> PAGE_SHIFT; | ||
| 703 | } | ||
| 704 | |||
| 705 | #define pmd_leaf pmd_large | 695 | #define pmd_leaf pmd_large |
| 706 | static inline int pmd_large(pmd_t pmd) | 696 | static inline int pmd_large(pmd_t pmd) |
| 707 | { | 697 | { |
| @@ -747,16 +737,6 @@ static inline int pmd_none(pmd_t pmd) · 39 unmodified lines | |||
| 747 | return pmd_val(pmd) == _SEGMENT_ENTRY_EMPTY; | 737 | return pmd_val(pmd) == _SEGMENT_ENTRY_EMPTY; |
| 748 | } | 738 | } |
| 749 | 739 | ||
| 750 | static inline unsigned long pmd_pfn(pmd_t pmd) | ||
| 751 | { | ||
| 752 | unsigned long origin_mask; | ||
| 753 | |||
| 754 | origin_mask = _SEGMENT_ENTRY_ORIGIN; | ||
| 755 | if (pmd_large(pmd)) | ||
| 756 | origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE; | ||
| 757 | return (pmd_val(pmd) & origin_mask) >> PAGE_SHIFT; | ||
| 758 | } | ||
| 759 | |||
| 760 | #define pmd_write pmd_write | 740 | #define pmd_write pmd_write |
| 761 | static inline int pmd_write(pmd_t pmd) | 741 | static inline int pmd_write(pmd_t pmd) |
| 762 | { | 742 | { |
| @@ -1238,11 +1218,39 @@ static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) · 475 unmodified lines | |||
| 1238 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) | 1218 | #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) |
| 1239 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | 1219 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) |
| 1240 | 1220 | ||
| 1241 | #define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) | ||
| 1242 | #define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN) | ||
| 1243 | #define p4d_deref(pud) (p4d_val(pud) & _REGION_ENTRY_ORIGIN) | 1221 | #define p4d_deref(pud) (p4d_val(pud) & _REGION_ENTRY_ORIGIN) |
| 1244 | #define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) | 1222 | #define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) |
| 1245 | 1223 | ||
| 1224 | static inline unsigned long pmd_deref(pmd_t pmd) | ||
| 1225 | { | ||
| 1226 | unsigned long origin_mask; | ||
| 1227 | |||
| 1228 | origin_mask = _SEGMENT_ENTRY_ORIGIN; | ||
| 1229 | if (pmd_large(pmd)) | ||
| 1230 | origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE; | ||
| 1231 | return pmd_val(pmd) & origin_mask; | ||
| 1232 | } | ||
| 1233 | |||
| 1234 | static inline unsigned long pmd_pfn(pmd_t pmd) | ||
| 1235 | { | ||
| 1236 | return pmd_deref(pmd) >> PAGE_SHIFT; | ||
| 1237 | } | ||
| 1238 | |||
| 1239 | static inline unsigned long pud_deref(pud_t pud) | ||
| 1240 | { | ||
| 1241 | unsigned long origin_mask; | ||
| 1242 | |||
| 1243 | origin_mask = _REGION_ENTRY_ORIGIN; | ||
| 1244 | if (pud_large(pud)) | ||
| 1245 | origin_mask = _REGION3_ENTRY_ORIGIN_LARGE; | ||
| 1246 | return pud_val(pud) & origin_mask; | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | static inline unsigned long pud_pfn(pud_t pud) | ||
| 1250 | { | ||
| 1251 | return pud_deref(pud) >> PAGE_SHIFT; | ||
| 1252 | } | ||
| 1253 | |||
| 1246 | /* | 1254 | /* |
| 1247 | * The pgd_offset function *always* adds the index for the top-level | 1255 | * The pgd_offset function *always* adds the index for the top-level |
| 1248 | * region/segment table. This is done to get a sequence like the | 1256 | * region/segment table. This is done to get a sequence like the |
Empty file deleted.
| @@ -61,14 +61,6 @@ int main(void) · 60 unmodified lines | |||
| 61 | BLANK(); | 61 | BLANK(); |
| 62 | OFFSET(__VDSO_GETCPU_VAL, vdso_per_cpu_data, getcpu_val); | 62 | OFFSET(__VDSO_GETCPU_VAL, vdso_per_cpu_data, getcpu_val); |
| 63 | BLANK(); | 63 | BLANK(); |
| 64 | /* constants used by the vdso */ | ||
| 65 | DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME); | ||
| 66 | DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC); | ||
| 67 | DEFINE(__CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE); | ||
| 68 | DEFINE(__CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE); | ||
| 69 | DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID); | ||
| 70 | DEFINE(__CLOCK_COARSE_RES, LOW_RES_NSEC); | ||
| 71 | BLANK(); | ||
| 72 | /* idle data offsets */ | 64 | /* idle data offsets */ |
| 73 | OFFSET(__CLOCK_IDLE_ENTER, s390_idle_data, clock_idle_enter); | 65 | OFFSET(__CLOCK_IDLE_ENTER, s390_idle_data, clock_idle_enter); |
| 74 | OFFSET(__CLOCK_IDLE_EXIT, s390_idle_data, clock_idle_exit); | 66 | OFFSET(__CLOCK_IDLE_EXIT, s390_idle_data, clock_idle_exit); |
| @@ -855,13 +855,14 @@ void __init smp_detect_cpus(void) · 854 unmodified lines | |||
| 855 | 855 | ||
| 856 | static void smp_init_secondary(void) | 856 | static void smp_init_secondary(void) |
| 857 | { | 857 | { |
| 858 | int cpu = smp_processor_id(); | 858 | int cpu = raw_smp_processor_id(); |
| 859 | 859 | ||
| 860 | S390_lowcore.last_update_clock = get_tod_clock(); | 860 | S390_lowcore.last_update_clock = get_tod_clock(); |
| 861 | restore_access_regs(S390_lowcore.access_regs_save_area); | 861 | restore_access_regs(S390_lowcore.access_regs_save_area); |
| 862 | set_cpu_flag(CIF_ASCE_PRIMARY); | 862 | set_cpu_flag(CIF_ASCE_PRIMARY); |
| 863 | set_cpu_flag(CIF_ASCE_SECONDARY); | 863 | set_cpu_flag(CIF_ASCE_SECONDARY); |
| 864 | cpu_init(); | 864 | cpu_init(); |
| 865 | rcu_cpu_starting(cpu); | ||
| 865 | preempt_disable(); | 866 | preempt_disable(); |
| 866 | init_cpu_timer(); | 867 | init_cpu_timer(); |
| 867 | vtime_init(); | 868 | vtime_init(); |
| @@ -101,6 +101,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 100 unmodified lines | |||
| 101 | if (ret) | 101 | if (ret) |
| 102 | break; | 102 | break; |
| 103 | 103 | ||
| 104 | /* the PCI function will be scanned once function 0 appears */ | ||
| 105 | if (!zdev->zbus->bus) | ||
| 106 | break; | ||
| 107 | |||
| 104 | pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); | 108 | pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); |
| 105 | if (!pdev) | 109 | if (!pdev) |
| 106 | break; | 110 | break; |
| @@ -164,6 +164,7 @@ void initialize_identity_maps(void *rmode) · 163 unmodified lines | |||
| 164 | add_identity_map(cmdline, cmdline + COMMAND_LINE_SIZE); | 164 | add_identity_map(cmdline, cmdline + COMMAND_LINE_SIZE); |
| 165 | 165 | ||
| 166 | /* Load the new page-table. */ | 166 | /* Load the new page-table. */ |
| 167 | sev_verify_cbit(top_level_pgt); | ||
| 167 | write_cr3(top_level_pgt); | 168 | write_cr3(top_level_pgt); |
| 168 | } | 169 | } |
| 169 | 170 | ||
| @@ -68,6 +68,9 @@ SYM_FUNC_START(get_sev_encryption_bit) · 67 unmodified lines | |||
| 68 | SYM_FUNC_END(get_sev_encryption_bit) | 68 | SYM_FUNC_END(get_sev_encryption_bit) |
| 69 | 69 | ||
| 70 | .code64 | 70 | .code64 |
| 71 | |||
| 72 | #include "../../kernel/sev_verify_cbit.S" | ||
| 73 | |||
| 71 | SYM_FUNC_START(set_sev_encryption_mask) | 74 | SYM_FUNC_START(set_sev_encryption_mask) |
| 72 | #ifdef CONFIG_AMD_MEM_ENCRYPT | 75 | #ifdef CONFIG_AMD_MEM_ENCRYPT |
| 73 | push %rbp | 76 | push %rbp |
| @@ -81,6 +84,19 @@ SYM_FUNC_START(set_sev_encryption_mask) · 7 unmodified lines | |||
| 81 | 84 | ||
| 82 | bts %rax, sme_me_mask(%rip) /* Create the encryption mask */ | 85 | bts %rax, sme_me_mask(%rip) /* Create the encryption mask */ |
| 83 | 86 | ||
| 87 | /* | ||
| 88 | * Read MSR_AMD64_SEV again and store it to sev_status. Can't do this in | ||
| 89 | * get_sev_encryption_bit() because this function is 32-bit code and | ||
| 90 | * shared between 64-bit and 32-bit boot path. | ||
| 91 | */ | ||
| 92 | movl $MSR_AMD64_SEV, %ecx /* Read the SEV MSR */ | ||
| 93 | rdmsr | ||
| 94 | |||
| 95 | /* Store MSR value in sev_status */ | ||
| 96 | shlq $32, %rdx | ||
| 97 | orq %rdx, %rax | ||
| 98 | movq %rax, sev_status(%rip) | ||
| 99 | |||
| 84 | .Lno_sev_mask: | 100 | .Lno_sev_mask: |
| 85 | movq %rbp, %rsp /* Restore original stack pointer */ | 101 | movq %rbp, %rsp /* Restore original stack pointer */ |
| 86 | 102 | ||
| @@ -96,5 +112,7 @@ SYM_FUNC_END(set_sev_encryption_mask) · 9 unmodified lines | |||
| 96 | 112 | ||
| 97 | #ifdef CONFIG_AMD_MEM_ENCRYPT | 113 | #ifdef CONFIG_AMD_MEM_ENCRYPT |
| 98 | .balign 8 | 114 | .balign 8 |
| 99 | SYM_DATA(sme_me_mask, .quad 0) | 115 | SYM_DATA(sme_me_mask, .quad 0) |
| 116 | SYM_DATA(sev_status, .quad 0) | ||
| 117 | SYM_DATA(sev_check_data, .quad 0) | ||
| 100 | #endif | 118 | #endif |
| @@ -159,4 +159,6 @@ void boot_page_fault(void); · 158 unmodified lines | |||
| 159 | void boot_stage1_vc(void); | 159 | void boot_stage1_vc(void); |
| 160 | void boot_stage2_vc(void); | 160 | void boot_stage2_vc(void); |
| 161 | 161 | ||
| 162 | unsigned long sev_verify_cbit(unsigned long cr3); | ||
| 163 | |||
| 162 | #endif /* BOOT_COMPRESSED_MISC_H */ | 164 | #endif /* BOOT_COMPRESSED_MISC_H */ |
| @@ -273,11 +273,15 @@ void __init hv_apic_init(void) · 272 unmodified lines | |||
| 273 | pr_info("Hyper-V: Using enlightened APIC (%s mode)", | 273 | pr_info("Hyper-V: Using enlightened APIC (%s mode)", |
| 274 | x2apic_enabled() ? "x2apic" : "xapic"); | 274 | x2apic_enabled() ? "x2apic" : "xapic"); |
| 275 | /* | 275 | /* |
| 276 | * With x2apic, architectural x2apic MSRs are equivalent to the | 276 | * When in x2apic mode, don't use the Hyper-V specific APIC |
| 277 | * respective synthetic MSRs, so there's no need to override | 277 | * accessors since the field layout in the ICR register is |
| 278 | * the apic accessors. The only exception is | 278 | * different in x2apic mode. Furthermore, the architectural |
| 279 | * hv_apic_eoi_write, because it benefits from lazy EOI when | 279 | * x2apic MSRs function just as well as the Hyper-V |
| 280 | * available, but it works for both xapic and x2apic modes. | 280 | * synthetic APIC MSRs, so there's no benefit in having |
| 281 | * separate Hyper-V accessors for x2apic mode. The only | ||
| 282 | * exception is hv_apic_eoi_write, because it benefits from | ||
| 283 | * lazy EOI when available, but the same accessor works for | ||
| 284 | * both xapic and x2apic because the field layout is the same. | ||
| 281 | */ | 285 | */ |
| 282 | apic_set_eoi_write(hv_apic_eoi_write); | 286 | apic_set_eoi_write(hv_apic_eoi_write); |
| 283 | if (!x2apic_enabled()) { | 287 | if (!x2apic_enabled()) { |
| @@ -290,6 +290,9 @@ static void __init uv_stringify(int len, char *to, char *from) · 289 unmodified lines | |||
| 290 | { | 290 | { |
| 291 | /* Relies on 'to' being NULL chars so result will be NULL terminated */ | 291 | /* Relies on 'to' being NULL chars so result will be NULL terminated */ |
| 292 | strncpy(to, from, len-1); | 292 | strncpy(to, from, len-1); |
| 293 | |||
| 294 | /* Trim trailing spaces */ | ||
| 295 | (void)strim(to); | ||
| 293 | } | 296 | } |
| 294 | 297 | ||
| 295 | /* Find UV arch type entry in UVsystab */ | 298 | /* Find UV arch type entry in UVsystab */ |
| @@ -366,7 +369,7 @@ static int __init early_get_arch_type(void) · 70 unmodified lines | |||
| 366 | return ret; | 369 | return ret; |
| 367 | } | 370 | } |
| 368 | 371 | ||
| 369 | static int __init uv_set_system_type(char *_oem_id) | 372 | static int __init uv_set_system_type(char *_oem_id, char *_oem_table_id) |
| 370 | { | 373 | { |
| 371 | /* Save OEM_ID passed from ACPI MADT */ | 374 | /* Save OEM_ID passed from ACPI MADT */ |
| 372 | uv_stringify(sizeof(oem_id), oem_id, _oem_id); | 375 | uv_stringify(sizeof(oem_id), oem_id, _oem_id); |
| @@ -386,13 +389,23 @@ static int __init uv_set_system_type(char *_oem_id) · 13 unmodified lines | |||
| 386 | /* (Not hubless), not a UV */ | 389 | /* (Not hubless), not a UV */ |
| 387 | return 0; | 390 | return 0; |
| 388 | 391 | ||
| 392 | /* Is UV hubless system */ | ||
| 393 | uv_hubless_system = 0x01; | ||
| 394 | |||
| 395 | /* UV5 Hubless */ | ||
| 396 | if (strncmp(uv_archtype, "NSGI5", 5) == 0) | ||
| 397 | uv_hubless_system |= 0x20; | ||
| 398 | |||
| 389 | /* UV4 Hubless: CH */ | 399 | /* UV4 Hubless: CH */ |
| 390 | if (strncmp(uv_archtype, "NSGI4", 5) == 0) | 400 | else if (strncmp(uv_archtype, "NSGI4", 5) == 0) |
| 391 | uv_hubless_system = 0x11; | 401 | uv_hubless_system |= 0x10; |
| 392 | 402 | ||
| 393 | /* UV3 Hubless: UV300/MC990X w/o hub */ | 403 | /* UV3 Hubless: UV300/MC990X w/o hub */ |
| 394 | else | 404 | else |
| 395 | uv_hubless_system = 0x9; | 405 | uv_hubless_system |= 0x8; |
| 406 | |||
| 407 | /* Copy APIC type */ | ||
| 408 | uv_stringify(sizeof(oem_table_id), oem_table_id, _oem_table_id); | ||
| 396 | 409 | ||
| 397 | pr_info("UV: OEM IDs %s/%s, SystemType %d, HUBLESS ID %x\n", | 410 | pr_info("UV: OEM IDs %s/%s, SystemType %d, HUBLESS ID %x\n", |
| 398 | oem_id, oem_table_id, uv_system_type, uv_hubless_system); | 411 | oem_id, oem_table_id, uv_system_type, uv_hubless_system); |
| @@ -456,7 +469,7 @@ static int __init uv_acpi_madt_oem_check(char *_oem_id, char *_oem_table_id) · 57 unmodified lines | |||
| 456 | uv_cpu_info->p_uv_hub_info = &uv_hub_info_node0; | 469 | uv_cpu_info->p_uv_hub_info = &uv_hub_info_node0; |
| 457 | 470 | ||
| 458 | /* If not UV, return. */ | 471 | /* If not UV, return. */ |
| 459 | if (likely(uv_set_system_type(_oem_id) == 0)) | 472 | if (uv_set_system_type(_oem_id, _oem_table_id) == 0) |
| 460 | return 0; | 473 | return 0; |
| 461 | 474 | ||
| 462 | /* Save and Decode OEM Table ID */ | 475 | /* Save and Decode OEM Table ID */ |
| @@ -1254,6 +1254,14 @@ static int ssb_prctl_set(struct task_struct *task, unsigned long ctrl) · 1253 unmodified lines | |||
| 1254 | return 0; | 1254 | return 0; |
| 1255 | } | 1255 | } |
| 1256 | 1256 | ||
| 1257 | static bool is_spec_ib_user_controlled(void) | ||
| 1258 | { | ||
| 1259 | return spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL || | ||
| 1260 | spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP || | ||
| 1261 | spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL || | ||
| 1262 | spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP; | ||
| 1263 | } | ||
| 1264 | |||
| 1257 | static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) | 1265 | static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) |
| 1258 | { | 1266 | { |
| 1259 | switch (ctrl) { | 1267 | switch (ctrl) { |
| @@ -1261,16 +1269,26 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) · 1 unmodified line | |||
| 1261 | if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && | 1269 | if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && |
| 1262 | spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) | 1270 | spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) |
| 1263 | return 0; | 1271 | return 0; |
| 1272 | |||
| 1264 | /* | 1273 | /* |
| 1265 | * Indirect branch speculation is always disabled in strict | 1274 | * With strict mode for both IBPB and STIBP, the instruction |
| 1266 | * mode. It can neither be enabled if it was force-disabled | 1275 | * code paths avoid checking this task flag and instead, |
| 1267 | * by a previous prctl call. | 1276 | * unconditionally run the instruction. However, STIBP and IBPB |
| 1277 | * are independent and either can be set to conditionally | ||
| 1278 | * enabled regardless of the mode of the other. | ||
| 1279 | * | ||
| 1280 | * If either is set to conditional, allow the task flag to be | ||
| 1281 | * updated, unless it was force-disabled by a previous prctl | ||
| 1282 | * call. Currently, this is possible on an AMD CPU which has the | ||
| 1283 | * feature X86_FEATURE_AMD_STIBP_ALWAYS_ON. In this case, if the | ||
| 1284 | * kernel is booted with 'spectre_v2_user=seccomp', then | ||
| 1285 | * spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP and | ||
| 1286 | * spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED. | ||
| 1268 | */ | 1287 | */ |
| 1269 | if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || | 1288 | if (!is_spec_ib_user_controlled() || |
| 1270 | spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || | ||
| 1271 | spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED || | ||
| 1272 | task_spec_ib_force_disable(task)) | 1289 | task_spec_ib_force_disable(task)) |
| 1273 | return -EPERM; | 1290 | return -EPERM; |
| 1291 | |||
| 1274 | task_clear_spec_ib_disable(task); | 1292 | task_clear_spec_ib_disable(task); |
| 1275 | task_update_spec_tif(task); | 1293 | task_update_spec_tif(task); |
| 1276 | break; | 1294 | break; |
| @@ -1283,10 +1301,10 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) · 6 unmodified lines | |||
| 1283 | if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && | 1301 | if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && |
| 1284 | spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) | 1302 | spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) |
| 1285 | return -EPERM; | 1303 | return -EPERM; |
| 1286 | if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || | 1304 | |
| 1287 | spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || | 1305 | if (!is_spec_ib_user_controlled()) |
| 1288 | spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED) | ||
| 1289 | return 0; | 1306 | return 0; |
| 1307 | |||
| 1290 | task_set_spec_ib_disable(task); | 1308 | task_set_spec_ib_disable(task); |
| 1291 | if (ctrl == PR_SPEC_FORCE_DISABLE) | 1309 | if (ctrl == PR_SPEC_FORCE_DISABLE) |
| 1292 | task_set_spec_ib_force_disable(task); | 1310 | task_set_spec_ib_force_disable(task); |
| @@ -1351,20 +1369,17 @@ static int ib_prctl_get(struct task_struct *task) · 58 unmodified lines | |||
| 1351 | if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && | 1369 | if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && |
| 1352 | spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) | 1370 | spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) |
| 1353 | return PR_SPEC_ENABLE; | 1371 | return PR_SPEC_ENABLE; |
| 1354 | else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || | 1372 | else if (is_spec_ib_user_controlled()) { |
| 1355 | spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || | ||
| 1356 | spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED) | ||
| 1357 | return PR_SPEC_DISABLE; | ||
| 1358 | else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL || | ||
| 1359 | spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP || | ||
| 1360 | spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL || | ||
| 1361 | spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP) { | ||
| 1362 | if (task_spec_ib_force_disable(task)) | 1373 | if (task_spec_ib_force_disable(task)) |
| 1363 | return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE; | 1374 | return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE; |
| 1364 | if (task_spec_ib_disable(task)) | 1375 | if (task_spec_ib_disable(task)) |
| 1365 | return PR_SPEC_PRCTL | PR_SPEC_DISABLE; | 1376 | return PR_SPEC_PRCTL | PR_SPEC_DISABLE; |
| 1366 | return PR_SPEC_PRCTL | PR_SPEC_ENABLE; | 1377 | return PR_SPEC_PRCTL | PR_SPEC_ENABLE; |
| 1367 | } else | 1378 | } else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || |
| 1379 | spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || | ||
| 1380 | spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED) | ||
| 1381 | return PR_SPEC_DISABLE; | ||
| 1382 | else | ||
| 1368 | return PR_SPEC_NOT_AFFECTED; | 1383 | return PR_SPEC_NOT_AFFECTED; |
| 1369 | } | 1384 | } |
| 1370 | 1385 | ||
| @@ -161,6 +161,21 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL) · 160 unmodified lines | |||
| 161 | 161 | ||
| 162 | /* Setup early boot stage 4-/5-level pagetables. */ | 162 | /* Setup early boot stage 4-/5-level pagetables. */ |
| 163 | addq phys_base(%rip), %rax | 163 | addq phys_base(%rip), %rax |
| 164 | |||
| 165 | /* | ||
| 166 | * For SEV guests: Verify that the C-bit is correct. A malicious | ||
| 167 | * hypervisor could lie about the C-bit position to perform a ROP | ||
| 168 | * attack on the guest by writing to the unencrypted stack and wait for | ||
| 169 | * the next RET instruction. | ||
| 170 | * %rsi carries pointer to realmode data and is callee-clobbered. Save | ||
| 171 | * and restore it. | ||
| 172 | */ | ||
| 173 | pushq %rsi | ||
| 174 | movq %rax, %rdi | ||
| 175 | call sev_verify_cbit | ||
| 176 | popq %rsi | ||
| 177 | |||
| 178 | /* Switch to new page-table */ | ||
| 164 | movq %rax, %cr3 | 179 | movq %rax, %cr3 |
| 165 | 180 | ||
| 166 | /* Ensure I am executing from virtual addresses */ | 181 | /* Ensure I am executing from virtual addresses */ |
| @@ -279,6 +294,7 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL) · 112 unmodified lines | |||
| 279 | SYM_CODE_END(secondary_startup_64) | 294 | SYM_CODE_END(secondary_startup_64) |
| 280 | 295 | ||
| 281 | #include "verify_cpu.S" | 296 | #include "verify_cpu.S" |
| 297 | #include "sev_verify_cbit.S" | ||
| 282 | 298 | ||
| 283 | #ifdef CONFIG_HOTPLUG_CPU | 299 | #ifdef CONFIG_HOTPLUG_CPU |
| 284 | /* | 300 | /* |
| @@ -178,6 +178,32 @@ void __init do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code) · 177 unmodified lines | |||
| 178 | goto fail; | 178 | goto fail; |
| 179 | regs->dx = val >> 32; | 179 | regs->dx = val >> 32; |
| 180 | 180 | ||
| 181 | /* | ||
| 182 | * This is a VC handler and the #VC is only raised when SEV-ES is | ||
| 183 | * active, which means SEV must be active too. Do sanity checks on the | ||
| 184 | * CPUID results to make sure the hypervisor does not trick the kernel | ||
| 185 | * into the no-sev path. This could map sensitive data unencrypted and | ||
| 186 | * make it accessible to the hypervisor. | ||
| 187 | * | ||
| 188 | * In particular, check for: | ||
| 189 | * - Hypervisor CPUID bit | ||
| 190 | * - Availability of CPUID leaf 0x8000001f | ||
| 191 | * - SEV CPUID bit. | ||
| 192 | * | ||
| 193 | * The hypervisor might still report the wrong C-bit position, but this | ||
| 194 | * can't be checked here. | ||
| 195 | */ | ||
| 196 | |||
| 197 | if ((fn == 1 && !(regs->cx & BIT(31)))) | ||
| 198 | /* Hypervisor bit */ | ||
| 199 | goto fail; | ||
| 200 | else if (fn == 0x80000000 && (regs->ax < 0x8000001f)) | ||
| 201 | /* SEV leaf check */ | ||
| 202 | goto fail; | ||
| 203 | else if ((fn == 0x8000001f && !(regs->ax & BIT(1)))) | ||
| 204 | /* SEV bit */ | ||
| 205 | goto fail; | ||
| 206 | |||
| 181 | /* Skip over the CPUID two-byte opcode */ | 207 | /* Skip over the CPUID two-byte opcode */ |
| 182 | regs->ip += 2; | 208 | regs->ip += 2; |
| 183 | 209 | ||
| @@ -374,8 +374,8 @@ fault: · 373 unmodified lines | |||
| 374 | return ES_EXCEPTION; | 374 | return ES_EXCEPTION; |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | static bool vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt, | 377 | static enum es_result vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt, |
| 378 | unsigned long vaddr, phys_addr_t *paddr) | 378 | unsigned long vaddr, phys_addr_t *paddr) |
| 379 | { | 379 | { |
| 380 | unsigned long va = (unsigned long)vaddr; | 380 | unsigned long va = (unsigned long)vaddr; |
| 381 | unsigned int level; | 381 | unsigned int level; |
| @@ -394,15 +394,19 @@ static bool vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt, · 12 unmodified lines | |||
| 394 | if (user_mode(ctxt->regs)) | 394 | if (user_mode(ctxt->regs)) |
| 395 | ctxt->fi.error_code |= X86_PF_USER; | 395 | ctxt->fi.error_code |= X86_PF_USER; |
| 396 | 396 | ||
| 397 | return false; | 397 | return ES_EXCEPTION; |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | if (WARN_ON_ONCE(pte_val(*pte) & _PAGE_ENC)) | ||
| 401 | /* Emulated MMIO to/from encrypted memory not supported */ | ||
| 402 | return ES_UNSUPPORTED; | ||
| 403 | |||
| 400 | pa = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT; | 404 | pa = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT; |
| 401 | pa |= va & ~page_level_mask(level); | 405 | pa |= va & ~page_level_mask(level); |
| 402 | 406 | ||
| 403 | *paddr = pa; | 407 | *paddr = pa; |
| 404 | 408 | ||
| 405 | return true; | 409 | return ES_OK; |
| 406 | } | 410 | } |
| 407 | 411 | ||
| 408 | /* Include code shared with pre-decompression boot stage */ | 412 | /* Include code shared with pre-decompression boot stage */ |
| @@ -731,6 +735,7 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt, · 322 unmodified lines | |||
| 731 | { | 735 | { |
| 732 | u64 exit_code, exit_info_1, exit_info_2; | 736 | u64 exit_code, exit_info_1, exit_info_2; |
| 733 | unsigned long ghcb_pa = __pa(ghcb); | 737 | unsigned long ghcb_pa = __pa(ghcb); |
| 738 | enum es_result res; | ||
| 734 | phys_addr_t paddr; | 739 | phys_addr_t paddr; |
| 735 | void __user *ref; | 740 | void __user *ref; |
| 736 | 741 | ||
| @@ -740,11 +745,12 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt, · 3 unmodified lines | |||
| 740 | 745 | ||
| 741 | exit_code = read ? SVM_VMGEXIT_MMIO_READ : SVM_VMGEXIT_MMIO_WRITE; | 746 | exit_code = read ? SVM_VMGEXIT_MMIO_READ : SVM_VMGEXIT_MMIO_WRITE; |
| 742 | 747 | ||
| 743 | if (!vc_slow_virt_to_phys(ghcb, ctxt, (unsigned long)ref, &paddr)) { | 748 | res = vc_slow_virt_to_phys(ghcb, ctxt, (unsigned long)ref, &paddr); |
| 744 | if (!read) | 749 | if (res != ES_OK) { |
| 750 | if (res == ES_EXCEPTION && !read) | ||
| 745 | ctxt->fi.error_code |= X86_PF_WRITE; | 751 | ctxt->fi.error_code |= X86_PF_WRITE; |
| 746 | 752 | ||
| 747 | return ES_EXCEPTION; | 753 | return res; |
| 748 | } | 754 | } |
| 749 | 755 | ||
| 750 | exit_info_1 = paddr; | 756 | exit_info_1 = paddr; |
| @@ -0,0 +1,89 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * sev_verify_cbit.S - Code for verification of the C-bit position reported | ||
| 4 | * by the Hypervisor when running with SEV enabled. | ||
| 5 | * | ||
| 6 | * Copyright (c) 2020 Joerg Roedel (jroedel@suse.de) | ||
| 7 | * | ||
| 8 | * sev_verify_cbit() is called before switching to a new long-mode page-table | ||
| 9 | * at boot. | ||
| 10 | * | ||
| 11 | * Verify that the C-bit position is correct by writing a random value to | ||
| 12 | * an encrypted memory location while on the current page-table. Then it | ||
| 13 | * switches to the new page-table to verify the memory content is still the | ||
| 14 | * same. After that it switches back to the current page-table and when the | ||
| 15 | * check succeeded it returns. If the check failed the code invalidates the | ||
| 16 | * stack pointer and goes into a hlt loop. The stack-pointer is invalidated to | ||
| 17 | * make sure no interrupt or exception can get the CPU out of the hlt loop. | ||
| 18 | * | ||
| 19 | * New page-table pointer is expected in %rdi (first parameter) | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | SYM_FUNC_START(sev_verify_cbit) | ||
| 23 | #ifdef CONFIG_AMD_MEM_ENCRYPT | ||
| 24 | /* First check if a C-bit was detected */ | ||
| 25 | movq sme_me_mask(%rip), %rsi | ||
| 26 | testq %rsi, %rsi | ||
| 27 | jz 3f | ||
| 28 | |||
| 29 | /* sme_me_mask != 0 could mean SME or SEV - Check also for SEV */ | ||
| 30 | movq sev_status(%rip), %rsi | ||
| 31 | testq %rsi, %rsi | ||
| 32 | jz 3f | ||
| 33 | |||
| 34 | /* Save CR4 in %rsi */ | ||
| 35 | movq %cr4, %rsi | ||
| 36 | |||
| 37 | /* Disable Global Pages */ | ||
| 38 | movq %rsi, %rdx | ||
| 39 | andq $(~X86_CR4_PGE), %rdx | ||
| 40 | movq %rdx, %cr4 | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Verified that running under SEV - now get a random value using | ||
| 44 | * RDRAND. This instruction is mandatory when running as an SEV guest. | ||
| 45 | * | ||
| 46 | * Don't bail out of the loop if RDRAND returns errors. It is better to | ||
| 47 | * prevent forward progress than to work with a non-random value here. | ||
| 48 | */ | ||
| 49 | 1: rdrand %rdx | ||
| 50 | jnc 1b | ||
| 51 | |||
| 52 | /* Store value to memory and keep it in %rdx */ | ||
| 53 | movq %rdx, sev_check_data(%rip) | ||
| 54 | |||
| 55 | /* Backup current %cr3 value to restore it later */ | ||
| 56 | movq %cr3, %rcx | ||
| 57 | |||
| 58 | /* Switch to new %cr3 - This might unmap the stack */ | ||
| 59 | movq %rdi, %cr3 | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Compare value in %rdx with memory location. If C-bit is incorrect | ||
| 63 | * this would read the encrypted data and make the check fail. | ||
| 64 | */ | ||
| 65 | cmpq %rdx, sev_check_data(%rip) | ||
| 66 | |||
| 67 | /* Restore old %cr3 */ | ||
| 68 | movq %rcx, %cr3 | ||
| 69 | |||
| 70 | /* Restore previous CR4 */ | ||
| 71 | movq %rsi, %cr4 | ||
| 72 | |||
| 73 | /* Check CMPQ result */ | ||
| 74 | je 3f | ||
| 75 | |||
| 76 | /* | ||
| 77 | * The check failed, prevent any forward progress to prevent ROP | ||
| 78 | * attacks, invalidate the stack and go into a hlt loop. | ||
| 79 | */ | ||
| 80 | xorq %rsp, %rsp | ||
| 81 | subq $0x1000, %rsp | ||
| 82 | 2: hlt | ||
| 83 | jmp 2b | ||
| 84 | 3: | ||
| 85 | #endif | ||
| 86 | /* Return page-table pointer */ | ||
| 87 | movq %rdi, %rax | ||
| 88 | ret | ||
| 89 | SYM_FUNC_END(sev_verify_cbit) | ||
| @@ -16,8 +16,6 @@ · 15 unmodified lines | |||
| 16 | * to a jmp to memcpy_erms which does the REP; MOVSB mem copy. | 16 | * to a jmp to memcpy_erms which does the REP; MOVSB mem copy. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | .weak memcpy | ||
| 20 | |||
| 21 | /* | 19 | /* |
| 22 | * memcpy - Copy a memory block. | 20 | * memcpy - Copy a memory block. |
| 23 | * | 21 | * |
| @@ -30,7 +28,7 @@ · 6 unmodified lines | |||
| 30 | * rax original destination | 28 | * rax original destination |
| 31 | */ | 29 | */ |
| 32 | SYM_FUNC_START_ALIAS(__memcpy) | 30 | SYM_FUNC_START_ALIAS(__memcpy) |
| 33 | SYM_FUNC_START_LOCAL(memcpy) | 31 | SYM_FUNC_START_WEAK(memcpy) |
| 34 | ALTERNATIVE_2 "jmp memcpy_orig", "", X86_FEATURE_REP_GOOD, \ | 32 | ALTERNATIVE_2 "jmp memcpy_orig", "", X86_FEATURE_REP_GOOD, \ |
| 35 | "jmp memcpy_erms", X86_FEATURE_ERMS | 33 | "jmp memcpy_erms", X86_FEATURE_ERMS |
| 36 | 34 | ||
| @@ -24,9 +24,7 @@ · 23 unmodified lines | |||
| 24 | * Output: | 24 | * Output: |
| 25 | * rax: dest | 25 | * rax: dest |
| 26 | */ | 26 | */ |
| 27 | .weak memmove | 27 | SYM_FUNC_START_WEAK(memmove) |
| 28 | |||
| 29 | SYM_FUNC_START_ALIAS(memmove) | ||
| 30 | SYM_FUNC_START(__memmove) | 28 | SYM_FUNC_START(__memmove) |
| 31 | 29 | ||
| 32 | mov %rdi, %rax | 30 | mov %rdi, %rax |
| @@ -6,8 +6,6 @@ · 5 unmodified lines | |||
| 6 | #include <asm/alternative-asm.h> | 6 | #include <asm/alternative-asm.h> |
| 7 | #include <asm/export.h> | 7 | #include <asm/export.h> |
| 8 | 8 | ||
| 9 | .weak memset | ||
| 10 | |||
| 11 | /* | 9 | /* |
| 12 | * ISO C memset - set a memory block to a byte value. This function uses fast | 10 | * ISO C memset - set a memory block to a byte value. This function uses fast |
| 13 | * string to get better performance than the original function. The code is | 11 | * string to get better performance than the original function. The code is |
| @@ -19,7 +17,7 @@ · 5 unmodified lines | |||
| 19 | * | 17 | * |
| 20 | * rax original destination | 18 | * rax original destination |
| 21 | */ | 19 | */ |
| 22 | SYM_FUNC_START_ALIAS(memset) | 20 | SYM_FUNC_START_WEAK(memset) |
| 23 | SYM_FUNC_START(__memset) | 21 | SYM_FUNC_START(__memset) |
| 24 | /* | 22 | /* |
| 25 | * Some CPUs support enhanced REP MOVSB/STOSB feature. It is recommended | 23 | * Some CPUs support enhanced REP MOVSB/STOSB feature. It is recommended |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | |||
| 39 | */ | 39 | */ |
| 40 | u64 sme_me_mask __section(".data") = 0; | 40 | u64 sme_me_mask __section(".data") = 0; |
| 41 | u64 sev_status __section(".data") = 0; | 41 | u64 sev_status __section(".data") = 0; |
| 42 | u64 sev_check_data __section(".data") = 0; | ||
| 42 | EXPORT_SYMBOL(sme_me_mask); | 43 | EXPORT_SYMBOL(sme_me_mask); |
| 43 | DEFINE_STATIC_KEY_FALSE(sev_enable_key); | 44 | DEFINE_STATIC_KEY_FALSE(sev_enable_key); |
| 44 | EXPORT_SYMBOL_GPL(sev_enable_key); | 45 | EXPORT_SYMBOL_GPL(sev_enable_key); |
| @@ -89,8 +89,8 @@ static void __init free_highpages(void) · 88 unmodified lines | |||
| 89 | /* set highmem page free */ | 89 | /* set highmem page free */ |
| 90 | for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, | 90 | for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, |
| 91 | &range_start, &range_end, NULL) { | 91 | &range_start, &range_end, NULL) { |
| 92 | unsigned long start = PHYS_PFN(range_start); | 92 | unsigned long start = PFN_UP(range_start); |
| 93 | unsigned long end = PHYS_PFN(range_end); | 93 | unsigned long end = PFN_DOWN(range_end); |
| 94 | 94 | ||
| 95 | /* Ignore complete lowmem entries */ | 95 | /* Ignore complete lowmem entries */ |
| 96 | if (end <= max_low) | 96 | if (end <= max_low) |
| @@ -773,8 +773,7 @@ static void __device_link_del(struct kref *kref) · 772 unmodified lines | |||
| 773 | dev_dbg(link->consumer, "Dropping the link to %s\n", | 773 | dev_dbg(link->consumer, "Dropping the link to %s\n", |
| 774 | dev_name(link->supplier)); | 774 | dev_name(link->supplier)); |
| 775 | 775 | ||
| 776 | if (link->flags & DL_FLAG_PM_RUNTIME) | 776 | pm_runtime_drop_link(link); |
| 777 | pm_runtime_drop_link(link->consumer); | ||
| 778 | 777 | ||
| 779 | list_del_rcu(&link->s_node); | 778 | list_del_rcu(&link->s_node); |
| 780 | list_del_rcu(&link->c_node); | 779 | list_del_rcu(&link->c_node); |
| @@ -788,8 +787,7 @@ static void __device_link_del(struct kref *kref) · 7 unmodified lines | |||
| 788 | dev_info(link->consumer, "Dropping the link to %s\n", | 787 | dev_info(link->consumer, "Dropping the link to %s\n", |
| 789 | dev_name(link->supplier)); | 788 | dev_name(link->supplier)); |
| 790 | 789 | ||
| 791 | if (link->flags & DL_FLAG_PM_RUNTIME) | 790 | pm_runtime_drop_link(link); |
| 792 | pm_runtime_drop_link(link->consumer); | ||
| 793 | 791 | ||
| 794 | list_del(&link->s_node); | 792 | list_del(&link->s_node); |
| 795 | list_del(&link->c_node); | 793 | list_del(&link->c_node); |
| @@ -1117,6 +1117,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) · 1116 unmodified lines | |||
| 1117 | 1117 | ||
| 1118 | drv = dev->driver; | 1118 | drv = dev->driver; |
| 1119 | if (drv) { | 1119 | if (drv) { |
| 1120 | pm_runtime_get_sync(dev); | ||
| 1121 | |||
| 1120 | while (device_links_busy(dev)) { | 1122 | while (device_links_busy(dev)) { |
| 1121 | __device_driver_unlock(dev, parent); | 1123 | __device_driver_unlock(dev, parent); |
| 1122 | 1124 | ||
| @@ -1128,13 +1130,12 @@ static void __device_release_driver(struct device *dev, struct device *parent) · 5 unmodified lines | |||
| 1128 | * have released the driver successfully while this one | 1130 | * have released the driver successfully while this one |
| 1129 | * was waiting, so check for that. | 1131 | * was waiting, so check for that. |
| 1130 | */ | 1132 | */ |
| 1131 | if (dev->driver != drv) | 1133 | if (dev->driver != drv) { |
| 1134 | pm_runtime_put(dev); | ||
| 1132 | return; | 1135 | return; |
| 1136 | } | ||
| 1133 | } | 1137 | } |
| 1134 | 1138 | ||
| 1135 | pm_runtime_get_sync(dev); | ||
| 1136 | pm_runtime_clean_up_links(dev); | ||
| 1137 | |||
| 1138 | driver_sysfs_remove(dev); | 1139 | driver_sysfs_remove(dev); |
| 1139 | 1140 | ||
| 1140 | if (dev->bus) | 1141 | if (dev->bus) |
| @@ -1642,42 +1642,6 @@ void pm_runtime_remove(struct device *dev) · 1641 unmodified lines | |||
| 1642 | pm_runtime_reinit(dev); | 1642 | pm_runtime_reinit(dev); |
| 1643 | } | 1643 | } |
| 1644 | 1644 | ||
| 1645 | /** | ||
| 1646 | * pm_runtime_clean_up_links - Prepare links to consumers for driver removal. | ||
| 1647 | * @dev: Device whose driver is going to be removed. | ||
| 1648 | * | ||
| 1649 | * Check links from this device to any consumers and if any of them have active | ||
| 1650 | * runtime PM references to the device, drop the usage counter of the device | ||
| 1651 | * (as many times as needed). | ||
| 1652 | * | ||
| 1653 | * Links with the DL_FLAG_MANAGED flag unset are ignored. | ||
| 1654 | * | ||
| 1655 | * Since the device is guaranteed to be runtime-active at the point this is | ||
| 1656 | * called, nothing else needs to be done here. | ||
| 1657 | * | ||
| 1658 | * Moreover, this is called after device_links_busy() has returned 'false', so | ||
| 1659 | * the status of each link is guaranteed to be DL_STATE_SUPPLIER_UNBIND and | ||
| 1660 | * therefore rpm_active can't be manipulated concurrently. | ||
| 1661 | */ | ||
| 1662 | void pm_runtime_clean_up_links(struct device *dev) | ||
| 1663 | { | ||
| 1664 | struct device_link *link; | ||
| 1665 | int idx; | ||
| 1666 | |||
| 1667 | idx = device_links_read_lock(); | ||
| 1668 | |||
| 1669 | list_for_each_entry_rcu(link, &dev->links.consumers, s_node, | ||
| 1670 | device_links_read_lock_held()) { | ||
| 1671 | if (!(link->flags & DL_FLAG_MANAGED)) | ||
| 1672 | continue; | ||
| 1673 | |||
| 1674 | while (refcount_dec_not_one(&link->rpm_active)) | ||
| 1675 | pm_runtime_put_noidle(dev); | ||
| 1676 | } | ||
| 1677 | |||
| 1678 | device_links_read_unlock(idx); | ||
| 1679 | } | ||
| 1680 | |||
| 1681 | /** | 1645 | /** |
| 1682 | * pm_runtime_get_suppliers - Resume and reference-count supplier devices. | 1646 | * pm_runtime_get_suppliers - Resume and reference-count supplier devices. |
| 1683 | * @dev: Consumer device. | 1647 | * @dev: Consumer device. |
| @@ -1729,7 +1693,7 @@ void pm_runtime_new_link(struct device *dev) · 45 unmodified lines | |||
| 1729 | spin_unlock_irq(&dev->power.lock); | 1693 | spin_unlock_irq(&dev->power.lock); |
| 1730 | } | 1694 | } |
| 1731 | 1695 | ||
| 1732 | void pm_runtime_drop_link(struct device *dev) | 1696 | static void pm_runtime_drop_link_count(struct device *dev) |
| 1733 | { | 1697 | { |
| 1734 | spin_lock_irq(&dev->power.lock); | 1698 | spin_lock_irq(&dev->power.lock); |
| 1735 | WARN_ON(dev->power.links_count == 0); | 1699 | WARN_ON(dev->power.links_count == 0); |
| @@ -1737,6 +1701,25 @@ void pm_runtime_drop_link(struct device *dev) · 1 unmodified line | |||
| 1737 | spin_unlock_irq(&dev->power.lock); | 1701 | spin_unlock_irq(&dev->power.lock); |
| 1738 | } | 1702 | } |
| 1739 | 1703 | ||
| 1704 | /** | ||
| 1705 | * pm_runtime_drop_link - Prepare for device link removal. | ||
| 1706 | * @link: Device link going away. | ||
| 1707 | * | ||
| 1708 | * Drop the link count of the consumer end of @link and decrement the supplier | ||
| 1709 | * device's runtime PM usage counter as many times as needed to drop all of the | ||
| 1710 | * PM runtime reference to it from the consumer. | ||
| 1711 | */ | ||
| 1712 | void pm_runtime_drop_link(struct device_link *link) | ||
| 1713 | { | ||
| 1714 | if (!(link->flags & DL_FLAG_PM_RUNTIME)) | ||
| 1715 | return; | ||
| 1716 | |||
| 1717 | pm_runtime_drop_link_count(link->consumer); | ||
| 1718 | |||
| 1719 | while (refcount_dec_not_one(&link->rpm_active)) | ||
| 1720 | pm_runtime_put(link->supplier); | ||
| 1721 | } | ||
| 1722 | |||
| 1740 | static bool pm_runtime_need_not_resume(struct device *dev) | 1723 | static bool pm_runtime_need_not_resume(struct device *dev) |
| 1741 | { | 1724 | { |
| 1742 | return atomic_read(&dev->power.usage_count) <= 1 && | 1725 | return atomic_read(&dev->power.usage_count) <= 1 && |
| @@ -47,7 +47,7 @@ struct nullb_device { · 46 unmodified lines | |||
| 47 | unsigned int nr_zones_closed; | 47 | unsigned int nr_zones_closed; |
| 48 | struct blk_zone *zones; | 48 | struct blk_zone *zones; |
| 49 | sector_t zone_size_sects; | 49 | sector_t zone_size_sects; |
| 50 | spinlock_t zone_dev_lock; | 50 | spinlock_t zone_lock; |
| 51 | unsigned long *zone_locks; | 51 | unsigned long *zone_locks; |
| 52 | 52 | ||
| 53 | unsigned long size; /* device size in MB */ | 53 | unsigned long size; /* device size in MB */ |
| @@ -46,11 +46,20 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q) · 45 unmodified lines | |||
| 46 | if (!dev->zones) | 46 | if (!dev->zones) |
| 47 | return -ENOMEM; | 47 | return -ENOMEM; |
| 48 | 48 | ||
| 49 | spin_lock_init(&dev->zone_dev_lock); | 49 | /* |
| 50 | dev->zone_locks = bitmap_zalloc(dev->nr_zones, GFP_KERNEL); | 50 | * With memory backing, the zone_lock spinlock needs to be temporarily |
| 51 | if (!dev->zone_locks) { | 51 | * released to avoid scheduling in atomic context. To guarantee zone |
| 52 | kvfree(dev->zones); | 52 | * information protection, use a bitmap to lock zones with |
| 53 | return -ENOMEM; | 53 | * wait_on_bit_lock_io(). Sleeping on the lock is OK as memory backing |
| 54 | * implies that the queue is marked with BLK_MQ_F_BLOCKING. | ||
| 55 | */ | ||
| 56 | spin_lock_init(&dev->zone_lock); | ||
| 57 | if (dev->memory_backed) { | ||
| 58 | dev->zone_locks = bitmap_zalloc(dev->nr_zones, GFP_KERNEL); | ||
| 59 | if (!dev->zone_locks) { | ||
| 60 | kvfree(dev->zones); | ||
| 61 | return -ENOMEM; | ||
| 62 | } | ||
| 54 | } | 63 | } |
| 55 | 64 | ||
| 56 | if (dev->zone_nr_conv >= dev->nr_zones) { | 65 | if (dev->zone_nr_conv >= dev->nr_zones) { |
| @@ -137,12 +146,17 @@ void null_free_zoned_dev(struct nullb_device *dev) · 80 unmodified lines | |||
| 137 | 146 | ||
| 138 | static inline void null_lock_zone(struct nullb_device *dev, unsigned int zno) | 147 | static inline void null_lock_zone(struct nullb_device *dev, unsigned int zno) |
| 139 | { | 148 | { |
| 140 | wait_on_bit_lock_io(dev->zone_locks, zno, TASK_UNINTERRUPTIBLE); | 149 | if (dev->memory_backed) |
| 150 | wait_on_bit_lock_io(dev->zone_locks, zno, TASK_UNINTERRUPTIBLE); | ||
| 151 | spin_lock_irq(&dev->zone_lock); | ||
| 141 | } | 152 | } |
| 142 | 153 | ||
| 143 | static inline void null_unlock_zone(struct nullb_device *dev, unsigned int zno) | 154 | static inline void null_unlock_zone(struct nullb_device *dev, unsigned int zno) |
| 144 | { | 155 | { |
| 145 | clear_and_wake_up_bit(zno, dev->zone_locks); | 156 | spin_unlock_irq(&dev->zone_lock); |
| 157 | |||
| 158 | if (dev->memory_backed) | ||
| 159 | clear_and_wake_up_bit(zno, dev->zone_locks); | ||
| 146 | } | 160 | } |
| 147 | 161 | ||
| 148 | int null_report_zones(struct gendisk *disk, sector_t sector, | 162 | int null_report_zones(struct gendisk *disk, sector_t sector, |
| @@ -322,7 +336,6 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, · 173 unmodified lines | |||
| 322 | return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors); | 336 | return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors); |
| 323 | 337 | ||
| 324 | null_lock_zone(dev, zno); | 338 | null_lock_zone(dev, zno); |
| 325 | spin_lock(&dev->zone_dev_lock); | ||
| 326 | 339 | ||
| 327 | switch (zone->cond) { | 340 | switch (zone->cond) { |
| 328 | case BLK_ZONE_COND_FULL: | 341 | case BLK_ZONE_COND_FULL: |
| @@ -375,9 +388,17 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, · 46 unmodified lines | |||
| 375 | if (zone->cond != BLK_ZONE_COND_EXP_OPEN) | 388 | if (zone->cond != BLK_ZONE_COND_EXP_OPEN) |
| 376 | zone->cond = BLK_ZONE_COND_IMP_OPEN; | 389 | zone->cond = BLK_ZONE_COND_IMP_OPEN; |
| 377 | 390 | ||
| 378 | spin_unlock(&dev->zone_dev_lock); | 391 | /* |
| 392 | * Memory backing allocation may sleep: release the zone_lock spinlock | ||
| 393 | * to avoid scheduling in atomic context. Zone operation atomicity is | ||
| 394 | * still guaranteed through the zone_locks bitmap. | ||
| 395 | */ | ||
| 396 | if (dev->memory_backed) | ||
| 397 | spin_unlock_irq(&dev->zone_lock); | ||
| 379 | ret = null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors); | 398 | ret = null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors); |
| 380 | spin_lock(&dev->zone_dev_lock); | 399 | if (dev->memory_backed) |
| 400 | spin_lock_irq(&dev->zone_lock); | ||
| 401 | |||
| 381 | if (ret != BLK_STS_OK) | 402 | if (ret != BLK_STS_OK) |
| 382 | goto unlock; | 403 | goto unlock; |
| 383 | 404 | ||
| @@ -392,7 +413,6 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, · 8 unmodified lines | |||
| 392 | ret = BLK_STS_OK; | 413 | ret = BLK_STS_OK; |
| 393 | 414 | ||
| 394 | unlock: | 415 | unlock: |
| 395 | spin_unlock(&dev->zone_dev_lock); | ||
| 396 | null_unlock_zone(dev, zno); | 416 | null_unlock_zone(dev, zno); |
| 397 | 417 | ||
| 398 | return ret; | 418 | return ret; |
| @@ -516,9 +536,7 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, · 117 unmodified lines | |||
| 516 | null_lock_zone(dev, i); | 536 | null_lock_zone(dev, i); |
| 517 | zone = &dev->zones[i]; | 537 | zone = &dev->zones[i]; |
| 518 | if (zone->cond != BLK_ZONE_COND_EMPTY) { | 538 | if (zone->cond != BLK_ZONE_COND_EMPTY) { |
| 519 | spin_lock(&dev->zone_dev_lock); | ||
| 520 | null_reset_zone(dev, zone); | 539 | null_reset_zone(dev, zone); |
| 521 | spin_unlock(&dev->zone_dev_lock); | ||
| 522 | trace_nullb_zone_op(cmd, i, zone->cond); | 540 | trace_nullb_zone_op(cmd, i, zone->cond); |
| 523 | } | 541 | } |
| 524 | null_unlock_zone(dev, i); | 542 | null_unlock_zone(dev, i); |
| @@ -530,7 +548,6 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, · 5 unmodified lines | |||
| 530 | zone = &dev->zones[zone_no]; | 548 | zone = &dev->zones[zone_no]; |
| 531 | 549 | ||
| 532 | null_lock_zone(dev, zone_no); | 550 | null_lock_zone(dev, zone_no); |
| 533 | spin_lock(&dev->zone_dev_lock); | ||
| 534 | 551 | ||
| 535 | switch (op) { | 552 | switch (op) { |
| 536 | case REQ_OP_ZONE_RESET: | 553 | case REQ_OP_ZONE_RESET: |
| @@ -550,8 +567,6 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, · 13 unmodified lines | |||
| 550 | break; | 567 | break; |
| 551 | } | 568 | } |
| 552 | 569 | ||
| 553 | spin_unlock(&dev->zone_dev_lock); | ||
| 554 | |||
| 555 | if (ret == BLK_STS_OK) | 570 | if (ret == BLK_STS_OK) |
| 556 | trace_nullb_zone_op(cmd, zone_no, zone->cond); | 571 | trace_nullb_zone_op(cmd, zone_no, zone->cond); |
| 557 | 572 | ||
| @@ -41,6 +41,11 @@ int tpm_read_log_efi(struct tpm_chip *chip) · 40 unmodified lines | |||
| 41 | log_size = log_tbl->size; | 41 | log_size = log_tbl->size; |
| 42 | memunmap(log_tbl); | 42 | memunmap(log_tbl); |
| 43 | 43 | ||
| 44 | if (!log_size) { | ||
| 45 | pr_warn("UEFI TPM log area empty\n"); | ||
| 46 | return -EIO; | ||
| 47 | } | ||
| 48 | |||
| 44 | log_tbl = memremap(efi.tpm_log, sizeof(*log_tbl) + log_size, | 49 | log_tbl = memremap(efi.tpm_log, sizeof(*log_tbl) + log_size, |
| 45 | MEMREMAP_WB); | 50 | MEMREMAP_WB); |
| 46 | if (!log_tbl) { | 51 | if (!log_tbl) { |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | |||
| 27 | #include <linux/of.h> | 27 | #include <linux/of.h> |
| 28 | #include <linux/of_device.h> | 28 | #include <linux/of_device.h> |
| 29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
| 30 | #include <linux/dmi.h> | ||
| 30 | #include "tpm.h" | 31 | #include "tpm.h" |
| 31 | #include "tpm_tis_core.h" | 32 | #include "tpm_tis_core.h" |
| 32 | 33 | ||
| @@ -49,8 +50,8 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da · 16 unmodified lines | |||
| 49 | return container_of(data, struct tpm_tis_tcg_phy, priv); | 50 | return container_of(data, struct tpm_tis_tcg_phy, priv); |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | static bool interrupts = true; | 53 | static int interrupts = -1; |
| 53 | module_param(interrupts, bool, 0444); | 54 | module_param(interrupts, int, 0444); |
| 54 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); | 55 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); |
| 55 | 56 | ||
| 56 | static bool itpm; | 57 | static bool itpm; |
| @@ -63,6 +64,28 @@ module_param(force, bool, 0444); · 6 unmodified lines | |||
| 63 | MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry"); | 64 | MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry"); |
| 64 | #endif | 65 | #endif |
| 65 | 66 | ||
| 67 | static int tpm_tis_disable_irq(const struct dmi_system_id *d) | ||
| 68 | { | ||
| 69 | if (interrupts == -1) { | ||
| 70 | pr_notice("tpm_tis: %s detected: disabling interrupts.\n", d->ident); | ||
| 71 | interrupts = 0; | ||
| 72 | } | ||
| 73 | |||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | static const struct dmi_system_id tpm_tis_dmi_table[] = { | ||
| 78 | { | ||
| 79 | .callback = tpm_tis_disable_irq, | ||
| 80 | .ident = "ThinkPad T490s", | ||
| 81 | .matches = { | ||
| 82 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
| 83 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T490s"), | ||
| 84 | }, | ||
| 85 | }, | ||
| 86 | {} | ||
| 87 | }; | ||
| 88 | |||
| 66 | #if defined(CONFIG_PNP) && defined(CONFIG_ACPI) | 89 | #if defined(CONFIG_PNP) && defined(CONFIG_ACPI) |
| 67 | static int has_hid(struct acpi_device *dev, const char *hid) | 90 | static int has_hid(struct acpi_device *dev, const char *hid) |
| 68 | { | 91 | { |
| @@ -192,6 +215,8 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info) · 123 unmodified lines | |||
| 192 | int irq = -1; | 215 | int irq = -1; |
| 193 | int rc; | 216 | int rc; |
| 194 | 217 | ||
| 218 | dmi_check_system(tpm_tis_dmi_table); | ||
| 219 | |||
| 195 | rc = check_acpi_tpm2(dev); | 220 | rc = check_acpi_tpm2(dev); |
| 196 | if (rc) | 221 | if (rc) |
| 197 | return rc; | 222 | return rc; |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | * | 7 | * |
| 8 | * This file add support for MD5 and SHA1/SHA224/SHA256/SHA384/SHA512. | 8 | * This file add support for MD5 and SHA1/SHA224/SHA256/SHA384/SHA512. |
| 9 | * | 9 | * |
| 10 | * You could find the datasheet in Documentation/arm/sunxi/README | 10 | * You could find the datasheet in Documentation/arm/sunxi.rst |
| 11 | */ | 11 | */ |
| 12 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
| 13 | #include <linux/pm_runtime.h> | 13 | #include <linux/pm_runtime.h> |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | * | 7 | * |
| 8 | * This file handle the PRNG | 8 | * This file handle the PRNG |
| 9 | * | 9 | * |
| 10 | * You could find a link for the datasheet in Documentation/arm/sunxi/README | 10 | * You could find a link for the datasheet in Documentation/arm/sunxi.rst |
| 11 | */ | 11 | */ |
| 12 | #include "sun8i-ce.h" | 12 | #include "sun8i-ce.h" |
| 13 | #include <linux/dma-mapping.h> | 13 | #include <linux/dma-mapping.h> |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | * | 7 | * |
| 8 | * This file handle the TRNG | 8 | * This file handle the TRNG |
| 9 | * | 9 | * |
| 10 | * You could find a link for the datasheet in Documentation/arm/sunxi/README | 10 | * You could find a link for the datasheet in Documentation/arm/sunxi.rst |
| 11 | */ | 11 | */ |
| 12 | #include "sun8i-ce.h" | 12 | #include "sun8i-ce.h" |
| 13 | #include <linux/dma-mapping.h> | 13 | #include <linux/dma-mapping.h> |
| @@ -217,6 +217,10 @@ enum { · 216 unmodified lines | |||
| 217 | #ifndef ASICREV_IS_VANGOGH | 217 | #ifndef ASICREV_IS_VANGOGH |
| 218 | #define ASICREV_IS_VANGOGH(eChipRev) ((eChipRev >= VANGOGH_A0) && (eChipRev < VANGOGH_UNKNOWN)) | 218 | #define ASICREV_IS_VANGOGH(eChipRev) ((eChipRev >= VANGOGH_A0) && (eChipRev < VANGOGH_UNKNOWN)) |
| 219 | #endif | 219 | #endif |
| 220 | #define GREEN_SARDINE_A0 0xA1 | ||
| 221 | #ifndef ASICREV_IS_GREEN_SARDINE | ||
| 222 | #define ASICREV_IS_GREEN_SARDINE(eChipRev) ((eChipRev >= GREEN_SARDINE_A0) && (eChipRev < 0xFF)) | ||
| 223 | #endif | ||
| 220 | 224 | ||
| 221 | /* | 225 | /* |
| 222 | * ASIC chip ID | 226 | * ASIC chip ID |
| @@ -508,21 +508,6 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, · 507 unmodified lines | |||
| 508 | if (!obj) | 508 | if (!obj) |
| 509 | return -ENOENT; | 509 | return -ENOENT; |
| 510 | 510 | ||
| 511 | /* | ||
| 512 | * Already in the desired write domain? Nothing for us to do! | ||
| 513 | * | ||
| 514 | * We apply a little bit of cunning here to catch a broader set of | ||
| 515 | * no-ops. If obj->write_domain is set, we must be in the same | ||
| 516 | * obj->read_domains, and only that domain. Therefore, if that | ||
| 517 | * obj->write_domain matches the request read_domains, we are | ||
| 518 | * already in the same read/write domain and can skip the operation, | ||
| 519 | * without having to further check the requested write_domain. | ||
| 520 | */ | ||
| 521 | if (READ_ONCE(obj->write_domain) == read_domains) { | ||
| 522 | err = 0; | ||
| 523 | goto out; | ||
| 524 | } | ||
| 525 | |||
| 526 | /* | 511 | /* |
| 527 | * Try to flush the object off the GPU without holding the lock. | 512 | * Try to flush the object off the GPU without holding the lock. |
| 528 | * We will repeat the flush holding the lock in the normal manner | 513 | * We will repeat the flush holding the lock in the normal manner |
| @@ -560,6 +545,19 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, · 31 unmodified lines | |||
| 560 | if (err) | 545 | if (err) |
| 561 | goto out; | 546 | goto out; |
| 562 | 547 | ||
| 548 | /* | ||
| 549 | * Already in the desired write domain? Nothing for us to do! | ||
| 550 | * | ||
| 551 | * We apply a little bit of cunning here to catch a broader set of | ||
| 552 | * no-ops. If obj->write_domain is set, we must be in the same | ||
| 553 | * obj->read_domains, and only that domain. Therefore, if that | ||
| 554 | * obj->write_domain matches the request read_domains, we are | ||
| 555 | * already in the same read/write domain and can skip the operation, | ||
| 556 | * without having to further check the requested write_domain. | ||
| 557 | */ | ||
| 558 | if (READ_ONCE(obj->write_domain) == read_domains) | ||
| 559 | goto out_unpin; | ||
| 560 | |||
| 563 | err = i915_gem_object_lock_interruptible(obj, NULL); | 561 | err = i915_gem_object_lock_interruptible(obj, NULL); |
| 564 | if (err) | 562 | if (err) |
| 565 | goto out_unpin; | 563 | goto out_unpin; |
| @@ -245,22 +245,14 @@ static inline u32 *gen12_emit_pipe_control(u32 *batch, u32 flags0, u32 flags1, u · 244 unmodified lines | |||
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | static inline u32 * | 247 | static inline u32 * |
| 248 | __gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1) | 248 | __gen8_emit_write_rcs(u32 *cs, u32 value, u32 offset, u32 flags0, u32 flags1) |
| 249 | { | 249 | { |
| 250 | /* We're using qword write, offset should be aligned to 8 bytes. */ | ||
| 251 | GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8)); | ||
| 252 | |||
| 253 | /* w/a for post sync ops following a GPGPU operation we | ||
| 254 | * need a prior CS_STALL, which is emitted by the flush | ||
| 255 | * following the batch. | ||
| 256 | */ | ||
| 257 | *cs++ = GFX_OP_PIPE_CONTROL(6) | flags0; | 250 | *cs++ = GFX_OP_PIPE_CONTROL(6) | flags0; |
| 258 | *cs++ = flags1 | PIPE_CONTROL_QW_WRITE | PIPE_CONTROL_GLOBAL_GTT_IVB; | 251 | *cs++ = flags1 | PIPE_CONTROL_QW_WRITE; |
| 259 | *cs++ = gtt_offset; | 252 | *cs++ = offset; |
| 260 | *cs++ = 0; | 253 | *cs++ = 0; |
| 261 | *cs++ = value; | 254 | *cs++ = value; |
| 262 | /* We're thrashing one dword of HWS. */ | 255 | *cs++ = 0; /* We're thrashing one extra dword. */ |
| 263 | *cs++ = 0; | ||
| 264 | 256 | ||
| 265 | return cs; | 257 | return cs; |
| 266 | } | 258 | } |
| @@ -268,13 +260,38 @@ __gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 f · 1 unmodified line | |||
| 268 | static inline u32* | 260 | static inline u32* |
| 269 | gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags) | 261 | gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags) |
| 270 | { | 262 | { |
| 271 | return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, 0, flags); | 263 | /* We're using qword write, offset should be aligned to 8 bytes. */ |
| 264 | GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8)); | ||
| 265 | |||
| 266 | return __gen8_emit_write_rcs(cs, | ||
| 267 | value, | ||
| 268 | gtt_offset, | ||
| 269 | 0, | ||
| 270 | flags | PIPE_CONTROL_GLOBAL_GTT_IVB); | ||
| 272 | } | 271 | } |
| 273 | 272 | ||
| 274 | static inline u32* | 273 | static inline u32* |
| 275 | gen12_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1) | 274 | gen12_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1) |
| 276 | { | 275 | { |
| 277 | return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, flags0, flags1); | 276 | /* We're using qword write, offset should be aligned to 8 bytes. */ |
| 277 | GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8)); | ||
| 278 | |||
| 279 | return __gen8_emit_write_rcs(cs, | ||
| 280 | value, | ||
| 281 | gtt_offset, | ||
| 282 | flags0, | ||
| 283 | flags1 | PIPE_CONTROL_GLOBAL_GTT_IVB); | ||
| 284 | } | ||
| 285 | |||
| 286 | static inline u32 * | ||
| 287 | __gen8_emit_flush_dw(u32 *cs, u32 value, u32 gtt_offset, u32 flags) | ||
| 288 | { | ||
| 289 | *cs++ = (MI_FLUSH_DW + 1) | flags; | ||
| 290 | *cs++ = gtt_offset; | ||
| 291 | *cs++ = 0; | ||
| 292 | *cs++ = value; | ||
| 293 | |||
| 294 | return cs; | ||
| 278 | } | 295 | } |
| 279 | 296 | ||
| 280 | static inline u32 * | 297 | static inline u32 * |
| @@ -285,12 +302,10 @@ gen8_emit_ggtt_write(u32 *cs, u32 value, u32 gtt_offset, u32 flags) · 4 unmodified lines | |||
| 285 | /* Offset should be aligned to 8 bytes for both (QW/DW) write types */ | 302 | /* Offset should be aligned to 8 bytes for both (QW/DW) write types */ |
| 286 | GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8)); | 303 | GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8)); |
| 287 | 304 | ||
| 288 | *cs++ = (MI_FLUSH_DW + 1) | MI_FLUSH_DW_OP_STOREDW | flags; | 305 | return __gen8_emit_flush_dw(cs, |
| 289 | *cs++ = gtt_offset | MI_FLUSH_DW_USE_GTT; | 306 | value, |
| 290 | *cs++ = 0; | 307 | gtt_offset | MI_FLUSH_DW_USE_GTT, |
| 291 | *cs++ = value; | 308 | flags | MI_FLUSH_DW_OP_STOREDW); |
| 292 | |||
| 293 | return cs; | ||
| 294 | } | 309 | } |
| 295 | 310 | ||
| 296 | static inline void __intel_engine_reset(struct intel_engine_cs *engine, | 311 | static inline void __intel_engine_reset(struct intel_engine_cs *engine, |
| @@ -3547,6 +3547,19 @@ static const struct intel_context_ops execlists_context_ops = { · 3546 unmodified lines | |||
| 3547 | .destroy = execlists_context_destroy, | 3547 | .destroy = execlists_context_destroy, |
| 3548 | }; | 3548 | }; |
| 3549 | 3549 | ||
| 3550 | static u32 hwsp_offset(const struct i915_request *rq) | ||
| 3551 | { | ||
| 3552 | const struct intel_timeline_cacheline *cl; | ||
| 3553 | |||
| 3554 | /* Before the request is executed, the timeline/cachline is fixed */ | ||
| 3555 | |||
| 3556 | cl = rcu_dereference_protected(rq->hwsp_cacheline, 1); | ||
| 3557 | if (cl) | ||
| 3558 | return cl->ggtt_offset; | ||
| 3559 | |||
| 3560 | return rcu_dereference_protected(rq->timeline, 1)->hwsp_offset; | ||
| 3561 | } | ||
| 3562 | |||
| 3550 | static int gen8_emit_init_breadcrumb(struct i915_request *rq) | 3563 | static int gen8_emit_init_breadcrumb(struct i915_request *rq) |
| 3551 | { | 3564 | { |
| 3552 | u32 *cs; | 3565 | u32 *cs; |
| @@ -3569,7 +3582,7 @@ static int gen8_emit_init_breadcrumb(struct i915_request *rq) · 16 unmodified lines | |||
| 3569 | *cs++ = MI_NOOP; | 3582 | *cs++ = MI_NOOP; |
| 3570 | 3583 | ||
| 3571 | *cs++ = MI_STORE_DWORD_IMM_GEN4 | MI_USE_GGTT; | 3584 | *cs++ = MI_STORE_DWORD_IMM_GEN4 | MI_USE_GGTT; |
| 3572 | *cs++ = i915_request_timeline(rq)->hwsp_offset; | 3585 | *cs++ = hwsp_offset(rq); |
| 3573 | *cs++ = 0; | 3586 | *cs++ = 0; |
| 3574 | *cs++ = rq->fence.seqno - 1; | 3587 | *cs++ = rq->fence.seqno - 1; |
| 3575 | 3588 | ||
| @@ -4886,11 +4899,9 @@ gen8_emit_fini_breadcrumb_tail(struct i915_request *request, u32 *cs) · 1310 unmodified lines | |||
| 4886 | return gen8_emit_wa_tail(request, cs); | 4899 | return gen8_emit_wa_tail(request, cs); |
| 4887 | } | 4900 | } |
| 4888 | 4901 | ||
| 4889 | static u32 *emit_xcs_breadcrumb(struct i915_request *request, u32 *cs) | 4902 | static u32 *emit_xcs_breadcrumb(struct i915_request *rq, u32 *cs) |
| 4890 | { | 4903 | { |
| 4891 | u32 addr = i915_request_active_timeline(request)->hwsp_offset; | 4904 | return gen8_emit_ggtt_write(cs, rq->fence.seqno, hwsp_offset(rq), 0); |
| 4892 | |||
| 4893 | return gen8_emit_ggtt_write(cs, request->fence.seqno, addr, 0); | ||
| 4894 | } | 4905 | } |
| 4895 | 4906 | ||
| 4896 | static u32 *gen8_emit_fini_breadcrumb(struct i915_request *rq, u32 *cs) | 4907 | static u32 *gen8_emit_fini_breadcrumb(struct i915_request *rq, u32 *cs) |
| @@ -4909,7 +4920,7 @@ static u32 *gen8_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs) · 12 unmodified lines | |||
| 4909 | /* XXX flush+write+CS_STALL all in one upsets gem_concurrent_blt:kbl */ | 4920 | /* XXX flush+write+CS_STALL all in one upsets gem_concurrent_blt:kbl */ |
| 4910 | cs = gen8_emit_ggtt_write_rcs(cs, | 4921 | cs = gen8_emit_ggtt_write_rcs(cs, |
| 4911 | request->fence.seqno, | 4922 | request->fence.seqno, |
| 4912 | i915_request_active_timeline(request)->hwsp_offset, | 4923 | hwsp_offset(request), |
| 4913 | PIPE_CONTROL_FLUSH_ENABLE | | 4924 | PIPE_CONTROL_FLUSH_ENABLE | |
| 4914 | PIPE_CONTROL_CS_STALL); | 4925 | PIPE_CONTROL_CS_STALL); |
| 4915 | 4926 | ||
| @@ -4921,7 +4932,7 @@ gen11_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs) · 5 unmodified lines | |||
| 4921 | { | 4932 | { |
| 4922 | cs = gen8_emit_ggtt_write_rcs(cs, | 4933 | cs = gen8_emit_ggtt_write_rcs(cs, |
| 4923 | request->fence.seqno, | 4934 | request->fence.seqno, |
| 4924 | i915_request_active_timeline(request)->hwsp_offset, | 4935 | hwsp_offset(request), |
| 4925 | PIPE_CONTROL_CS_STALL | | 4936 | PIPE_CONTROL_CS_STALL | |
| 4926 | PIPE_CONTROL_TILE_CACHE_FLUSH | | 4937 | PIPE_CONTROL_TILE_CACHE_FLUSH | |
| 4927 | PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH | | 4938 | PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH | |
| @@ -4983,7 +4994,9 @@ gen12_emit_fini_breadcrumb_tail(struct i915_request *request, u32 *cs) · 55 unmodified lines | |||
| 4983 | 4994 | ||
| 4984 | static u32 *gen12_emit_fini_breadcrumb(struct i915_request *rq, u32 *cs) | 4995 | static u32 *gen12_emit_fini_breadcrumb(struct i915_request *rq, u32 *cs) |
| 4985 | { | 4996 | { |
| 4986 | return gen12_emit_fini_breadcrumb_tail(rq, emit_xcs_breadcrumb(rq, cs)); | 4997 | /* XXX Stalling flush before seqno write; post-sync not */ |
| 4998 | cs = emit_xcs_breadcrumb(rq, __gen8_emit_flush_dw(cs, 0, 0, 0)); | ||
| 4999 | return gen12_emit_fini_breadcrumb_tail(rq, cs); | ||
| 4987 | } | 5000 | } |
| 4988 | 5001 | ||
| 4989 | static u32 * | 5002 | static u32 * |
| @@ -4991,7 +5004,7 @@ gen12_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs) · 1 unmodified line | |||
| 4991 | { | 5004 | { |
| 4992 | cs = gen12_emit_ggtt_write_rcs(cs, | 5005 | cs = gen12_emit_ggtt_write_rcs(cs, |
| 4993 | request->fence.seqno, | 5006 | request->fence.seqno, |
| 4994 | i915_request_active_timeline(request)->hwsp_offset, | 5007 | hwsp_offset(request), |
| 4995 | PIPE_CONTROL0_HDC_PIPELINE_FLUSH, | 5008 | PIPE_CONTROL0_HDC_PIPELINE_FLUSH, |
| 4996 | PIPE_CONTROL_CS_STALL | | 5009 | PIPE_CONTROL_CS_STALL | |
| 4997 | PIPE_CONTROL_TILE_CACHE_FLUSH | | 5010 | PIPE_CONTROL_TILE_CACHE_FLUSH | |
| @@ -188,10 +188,14 @@ cacheline_alloc(struct intel_timeline_hwsp *hwsp, unsigned int cacheline) · 187 unmodified lines | |||
| 188 | return cl; | 188 | return cl; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | static void cacheline_acquire(struct intel_timeline_cacheline *cl) | 191 | static void cacheline_acquire(struct intel_timeline_cacheline *cl, |
| 192 | u32 ggtt_offset) | ||
| 192 | { | 193 | { |
| 193 | if (cl) | 194 | if (!cl) |
| 194 | i915_active_acquire(&cl->active); | 195 | return; |
| 196 | |||
| 197 | cl->ggtt_offset = ggtt_offset; | ||
| 198 | i915_active_acquire(&cl->active); | ||
| 195 | } | 199 | } |
| 196 | 200 | ||
| 197 | static void cacheline_release(struct intel_timeline_cacheline *cl) | 201 | static void cacheline_release(struct intel_timeline_cacheline *cl) |
| @@ -340,7 +344,7 @@ int intel_timeline_pin(struct intel_timeline *tl, struct i915_gem_ww_ctx *ww) · 142 unmodified lines | |||
| 340 | GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n", | 344 | GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n", |
| 341 | tl->fence_context, tl->hwsp_offset); | 345 | tl->fence_context, tl->hwsp_offset); |
| 342 | 346 | ||
| 343 | cacheline_acquire(tl->hwsp_cacheline); | 347 | cacheline_acquire(tl->hwsp_cacheline, tl->hwsp_offset); |
| 344 | if (atomic_fetch_inc(&tl->pin_count)) { | 348 | if (atomic_fetch_inc(&tl->pin_count)) { |
| 345 | cacheline_release(tl->hwsp_cacheline); | 349 | cacheline_release(tl->hwsp_cacheline); |
| 346 | __i915_vma_unpin(tl->hwsp_ggtt); | 350 | __i915_vma_unpin(tl->hwsp_ggtt); |
| @@ -515,7 +519,7 @@ __intel_timeline_get_seqno(struct intel_timeline *tl, · 168 unmodified lines | |||
| 515 | GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n", | 519 | GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n", |
| 516 | tl->fence_context, tl->hwsp_offset); | 520 | tl->fence_context, tl->hwsp_offset); |
| 517 | 521 | ||
| 518 | cacheline_acquire(cl); | 522 | cacheline_acquire(cl, tl->hwsp_offset); |
| 519 | tl->hwsp_cacheline = cl; | 523 | tl->hwsp_cacheline = cl; |
| 520 | 524 | ||
| 521 | *seqno = timeline_advance(tl); | 525 | *seqno = timeline_advance(tl); |
| @@ -573,9 +577,7 @@ int intel_timeline_read_hwsp(struct i915_request *from, · 51 unmodified lines | |||
| 573 | if (err) | 577 | if (err) |
| 574 | goto out; | 578 | goto out; |
| 575 | 579 | ||
| 576 | *hwsp = i915_ggtt_offset(cl->hwsp->vma) + | 580 | *hwsp = cl->ggtt_offset; |
| 577 | ptr_unmask_bits(cl->vaddr, CACHELINE_BITS) * CACHELINE_BYTES; | ||
| 578 | |||
| 579 | out: | 581 | out: |
| 580 | i915_active_release(&cl->active); | 582 | i915_active_release(&cl->active); |
| 581 | return err; | 583 | return err; |
| @@ -94,6 +94,8 @@ struct intel_timeline_cacheline { · 93 unmodified lines | |||
| 94 | struct intel_timeline_hwsp *hwsp; | 94 | struct intel_timeline_hwsp *hwsp; |
| 95 | void *vaddr; | 95 | void *vaddr; |
| 96 | 96 | ||
| 97 | u32 ggtt_offset; | ||
| 98 | |||
| 97 | struct rcu_head rcu; | 99 | struct rcu_head rcu; |
| 98 | }; | 100 | }; |
| 99 | 101 | ||
| @@ -1489,7 +1489,8 @@ static int hws_pga_write(struct intel_vgpu *vgpu, unsigned int offset, · 1488 unmodified lines | |||
| 1489 | const struct intel_engine_cs *engine = | 1489 | const struct intel_engine_cs *engine = |
| 1490 | intel_gvt_render_mmio_to_engine(vgpu->gvt, offset); | 1490 | intel_gvt_render_mmio_to_engine(vgpu->gvt, offset); |
| 1491 | 1491 | ||
| 1492 | if (!intel_gvt_ggtt_validate_range(vgpu, value, I915_GTT_PAGE_SIZE)) { | 1492 | if (value != 0 && |
| 1493 | !intel_gvt_ggtt_validate_range(vgpu, value, I915_GTT_PAGE_SIZE)) { | ||
| 1493 | gvt_vgpu_err("write invalid HWSP address, reg:0x%x, value:0x%x\n", | 1494 | gvt_vgpu_err("write invalid HWSP address, reg:0x%x, value:0x%x\n", |
| 1494 | offset, value); | 1495 | offset, value); |
| 1495 | return -EINVAL; | 1496 | return -EINVAL; |
| @@ -1650,6 +1651,34 @@ static int edp_psr_imr_iir_write(struct intel_vgpu *vgpu, · 154 unmodified lines | |||
| 1650 | return 0; | 1651 | return 0; |
| 1651 | } | 1652 | } |
| 1652 | 1653 | ||
| 1654 | /** | ||
| 1655 | * FixMe: | ||
| 1656 | * If guest fills non-priv batch buffer on ApolloLake/Broxton as Mesa i965 did: | ||
| 1657 | * 717e7539124d (i965: Use a WC map and memcpy for the batch instead of pwrite.) | ||
| 1658 | * Due to the missing flush of bb filled by VM vCPU, host GPU hangs on executing | ||
| 1659 | * these MI_BATCH_BUFFER. | ||
| 1660 | * Temporarily workaround this by setting SNOOP bit for PAT3 used by PPGTT | ||
| 1661 | * PML4 PTE: PAT(0) PCD(1) PWT(1). | ||
| 1662 | * The performance is still expected to be low, will need further improvement. | ||
| 1663 | */ | ||
| 1664 | static int bxt_ppat_low_write(struct intel_vgpu *vgpu, unsigned int offset, | ||
| 1665 | void *p_data, unsigned int bytes) | ||
| 1666 | { | ||
| 1667 | u64 pat = | ||
| 1668 | GEN8_PPAT(0, CHV_PPAT_SNOOP) | | ||
| 1669 | GEN8_PPAT(1, 0) | | ||
| 1670 | GEN8_PPAT(2, 0) | | ||
| 1671 | GEN8_PPAT(3, CHV_PPAT_SNOOP) | | ||
| 1672 | GEN8_PPAT(4, CHV_PPAT_SNOOP) | | ||
| 1673 | GEN8_PPAT(5, CHV_PPAT_SNOOP) | | ||
| 1674 | GEN8_PPAT(6, CHV_PPAT_SNOOP) | | ||
| 1675 | GEN8_PPAT(7, CHV_PPAT_SNOOP); | ||
| 1676 | |||
| 1677 | vgpu_vreg(vgpu, offset) = lower_32_bits(pat); | ||
| 1678 | |||
| 1679 | return 0; | ||
| 1680 | } | ||
| 1681 | |||
| 1653 | static int guc_status_read(struct intel_vgpu *vgpu, | 1682 | static int guc_status_read(struct intel_vgpu *vgpu, |
| 1654 | unsigned int offset, void *p_data, | 1683 | unsigned int offset, void *p_data, |
| 1655 | unsigned int bytes) | 1684 | unsigned int bytes) |
| @@ -2812,7 +2841,7 @@ static int init_bdw_mmio_info(struct intel_gvt *gvt) · 1156 unmodified lines | |||
| 2812 | 2841 | ||
| 2813 | MMIO_DH(GEN6_PCODE_MAILBOX, D_BDW_PLUS, NULL, mailbox_write); | 2842 | MMIO_DH(GEN6_PCODE_MAILBOX, D_BDW_PLUS, NULL, mailbox_write); |
| 2814 | 2843 | ||
| 2815 | MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS); | 2844 | MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS & ~D_BXT); |
| 2816 | MMIO_D(GEN8_PRIVATE_PAT_HI, D_BDW_PLUS); | 2845 | MMIO_D(GEN8_PRIVATE_PAT_HI, D_BDW_PLUS); |
| 2817 | 2846 | ||
| 2818 | MMIO_D(GAMTARBMODE, D_BDW_PLUS); | 2847 | MMIO_D(GAMTARBMODE, D_BDW_PLUS); |
| @@ -3139,7 +3168,7 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 320 unmodified lines | |||
| 3139 | NULL, NULL); | 3168 | NULL, NULL); |
| 3140 | 3169 | ||
| 3141 | MMIO_DFH(GAMT_CHKN_BIT_REG, D_KBL | D_CFL, F_CMD_ACCESS, NULL, NULL); | 3170 | MMIO_DFH(GAMT_CHKN_BIT_REG, D_KBL | D_CFL, F_CMD_ACCESS, NULL, NULL); |
| 3142 | MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS); | 3171 | MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS & ~D_BXT); |
| 3143 | 3172 | ||
| 3144 | return 0; | 3173 | return 0; |
| 3145 | } | 3174 | } |
| @@ -3313,9 +3342,21 @@ static int init_bxt_mmio_info(struct intel_gvt *gvt) · 167 unmodified lines | |||
| 3313 | MMIO_D(GEN8_PUSHBUS_SHIFT, D_BXT); | 3342 | MMIO_D(GEN8_PUSHBUS_SHIFT, D_BXT); |
| 3314 | MMIO_D(GEN6_GFXPAUSE, D_BXT); | 3343 | MMIO_D(GEN6_GFXPAUSE, D_BXT); |
| 3315 | MMIO_DFH(GEN8_L3SQCREG1, D_BXT, F_CMD_ACCESS, NULL, NULL); | 3344 | MMIO_DFH(GEN8_L3SQCREG1, D_BXT, F_CMD_ACCESS, NULL, NULL); |
| 3345 | MMIO_DFH(GEN8_L3CNTLREG, D_BXT, F_CMD_ACCESS, NULL, NULL); | ||
| 3346 | MMIO_DFH(_MMIO(0x20D8), D_BXT, F_CMD_ACCESS, NULL, NULL); | ||
| 3347 | MMIO_F(GEN8_RING_CS_GPR(RENDER_RING_BASE, 0), 0x40, F_CMD_ACCESS, | ||
| 3348 | 0, 0, D_BXT, NULL, NULL); | ||
| 3349 | MMIO_F(GEN8_RING_CS_GPR(GEN6_BSD_RING_BASE, 0), 0x40, F_CMD_ACCESS, | ||
| 3350 | 0, 0, D_BXT, NULL, NULL); | ||
| 3351 | MMIO_F(GEN8_RING_CS_GPR(BLT_RING_BASE, 0), 0x40, F_CMD_ACCESS, | ||
| 3352 | 0, 0, D_BXT, NULL, NULL); | ||
| 3353 | MMIO_F(GEN8_RING_CS_GPR(VEBOX_RING_BASE, 0), 0x40, F_CMD_ACCESS, | ||
| 3354 | 0, 0, D_BXT, NULL, NULL); | ||
| 3316 | 3355 | ||
| 3317 | MMIO_DFH(GEN9_CTX_PREEMPT_REG, D_BXT, F_CMD_ACCESS, NULL, NULL); | 3356 | MMIO_DFH(GEN9_CTX_PREEMPT_REG, D_BXT, F_CMD_ACCESS, NULL, NULL); |
| 3318 | 3357 | ||
| 3358 | MMIO_DH(GEN8_PRIVATE_PAT_LO, D_BXT, NULL, bxt_ppat_low_write); | ||
| 3359 | |||
| 3319 | return 0; | 3360 | return 0; |
| 3320 | } | 3361 | } |
| 3321 | 3362 | ||
| @@ -1277,7 +1277,7 @@ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu) · 1276 unmodified lines | |||
| 1277 | 1277 | ||
| 1278 | i915_context_ppgtt_root_restore(s, i915_vm_to_ppgtt(s->shadow[0]->vm)); | 1278 | i915_context_ppgtt_root_restore(s, i915_vm_to_ppgtt(s->shadow[0]->vm)); |
| 1279 | for_each_engine(engine, vgpu->gvt->gt, id) | 1279 | for_each_engine(engine, vgpu->gvt->gt, id) |
| 1280 | intel_context_unpin(s->shadow[id]); | 1280 | intel_context_put(s->shadow[id]); |
| 1281 | 1281 | ||
| 1282 | kmem_cache_destroy(s->workloads); | 1282 | kmem_cache_destroy(s->workloads); |
| 1283 | } | 1283 | } |
| @@ -1369,11 +1369,6 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu) · 85 unmodified lines | |||
| 1369 | ce->ring = __intel_context_ring_size(ring_size); | 1369 | ce->ring = __intel_context_ring_size(ring_size); |
| 1370 | } | 1370 | } |
| 1371 | 1371 | ||
| 1372 | ret = intel_context_pin(ce); | ||
| 1373 | intel_context_put(ce); | ||
| 1374 | if (ret) | ||
| 1375 | goto out_shadow_ctx; | ||
| 1376 | |||
| 1377 | s->shadow[i] = ce; | 1372 | s->shadow[i] = ce; |
| 1378 | } | 1373 | } |
| 1379 | 1374 | ||
| @@ -1405,7 +1400,6 @@ out_shadow_ctx: · 25 unmodified lines | |||
| 1405 | if (IS_ERR(s->shadow[i])) | 1400 | if (IS_ERR(s->shadow[i])) |
| 1406 | break; | 1401 | break; |
| 1407 | 1402 | ||
| 1408 | intel_context_unpin(s->shadow[i]); | ||
| 1409 | intel_context_put(s->shadow[i]); | 1403 | intel_context_put(s->shadow[i]); |
| 1410 | } | 1404 | } |
| 1411 | i915_vm_put(&ppgtt->vm); | 1405 | i915_vm_put(&ppgtt->vm); |
| @@ -1479,6 +1473,7 @@ void intel_vgpu_destroy_workload(struct intel_vgpu_workload *workload) · 67 unmodified lines | |||
| 1479 | { | 1473 | { |
| 1480 | struct intel_vgpu_submission *s = &workload->vgpu->submission; | 1474 | struct intel_vgpu_submission *s = &workload->vgpu->submission; |
| 1481 | 1475 | ||
| 1476 | intel_context_unpin(s->shadow[workload->engine->id]); | ||
| 1482 | release_shadow_batch_buffer(workload); | 1477 | release_shadow_batch_buffer(workload); |
| 1483 | release_shadow_wa_ctx(&workload->wa_ctx); | 1478 | release_shadow_wa_ctx(&workload->wa_ctx); |
| 1484 | 1479 | ||
| @@ -1724,6 +1719,12 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu, · 239 unmodified lines | |||
| 1724 | return ERR_PTR(ret); | 1719 | return ERR_PTR(ret); |
| 1725 | } | 1720 | } |
| 1726 | 1721 | ||
| 1722 | ret = intel_context_pin(s->shadow[engine->id]); | ||
| 1723 | if (ret) { | ||
| 1724 | intel_vgpu_destroy_workload(workload); | ||
| 1725 | return ERR_PTR(ret); | ||
| 1726 | } | ||
| 1727 | |||
| 1727 | return workload; | 1728 | return workload; |
| 1728 | } | 1729 | } |
| 1729 | 1730 | ||
| @@ -314,8 +314,10 @@ static void __vma_release(struct dma_fence_work *work) · 313 unmodified lines | |||
| 314 | { | 314 | { |
| 315 | struct i915_vma_work *vw = container_of(work, typeof(*vw), base); | 315 | struct i915_vma_work *vw = container_of(work, typeof(*vw), base); |
| 316 | 316 | ||
| 317 | if (vw->pinned) | 317 | if (vw->pinned) { |
| 318 | __i915_gem_object_unpin_pages(vw->pinned); | 318 | __i915_gem_object_unpin_pages(vw->pinned); |
| 319 | i915_gem_object_put(vw->pinned); | ||
| 320 | } | ||
| 319 | 321 | ||
| 320 | i915_vm_free_pt_stash(vw->vm, &vw->stash); | 322 | i915_vm_free_pt_stash(vw->vm, &vw->stash); |
| 321 | i915_vm_put(vw->vm); | 323 | i915_vm_put(vw->vm); |
| @@ -431,7 +433,7 @@ int i915_vma_bind(struct i915_vma *vma, · 109 unmodified lines | |||
| 431 | 433 | ||
| 432 | if (vma->obj) { | 434 | if (vma->obj) { |
| 433 | __i915_gem_object_pin_pages(vma->obj); | 435 | __i915_gem_object_pin_pages(vma->obj); |
| 434 | work->pinned = vma->obj; | 436 | work->pinned = i915_gem_object_get(vma->obj); |
| 435 | } | 437 | } |
| 436 | } else { | 438 | } else { |
| 437 | vma->ops->bind_vma(vma->vm, NULL, vma, cache_level, bind_flags); | 439 | vma->ops->bind_vma(vma->vm, NULL, vma, cache_level, bind_flags); |
| @@ -111,10 +111,6 @@ static int dw_hdmi_imx_parse_dt(struct imx_hdmi *hdmi) · 110 unmodified lines | |||
| 111 | return 0; | 111 | return 0; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | static void dw_hdmi_imx_encoder_disable(struct drm_encoder *encoder) | ||
| 115 | { | ||
| 116 | } | ||
| 117 | |||
| 118 | static void dw_hdmi_imx_encoder_enable(struct drm_encoder *encoder) | 114 | static void dw_hdmi_imx_encoder_enable(struct drm_encoder *encoder) |
| 119 | { | 115 | { |
| 120 | struct imx_hdmi *hdmi = enc_to_imx_hdmi(encoder); | 116 | struct imx_hdmi *hdmi = enc_to_imx_hdmi(encoder); |
| @@ -140,7 +136,6 @@ static int dw_hdmi_imx_atomic_check(struct drm_encoder *encoder, · 19 unmodified lines | |||
| 140 | 136 | ||
| 141 | static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs = { | 137 | static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs = { |
| 142 | .enable = dw_hdmi_imx_encoder_enable, | 138 | .enable = dw_hdmi_imx_encoder_enable, |
| 143 | .disable = dw_hdmi_imx_encoder_disable, | ||
| 144 | .atomic_check = dw_hdmi_imx_atomic_check, | 139 | .atomic_check = dw_hdmi_imx_atomic_check, |
| 145 | }; | 140 | }; |
| 146 | 141 | ||
| @@ -219,15 +214,9 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, · 72 unmodified lines | |||
| 219 | hdmi->dev = &pdev->dev; | 214 | hdmi->dev = &pdev->dev; |
| 220 | encoder = &hdmi->encoder; | 215 | encoder = &hdmi->encoder; |
| 221 | 216 | ||
| 222 | encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node); | 217 | ret = imx_drm_encoder_parse_of(drm, encoder, dev->of_node); |
| 223 | /* | 218 | if (ret) |
| 224 | * If we failed to find the CRTC(s) which this encoder is | 219 | return ret; |
| 225 | * supposed to be connected to, it's because the CRTC has | ||
| 226 | * not been registered yet. Defer probing, and hope that | ||
| 227 | * the required CRTC is added later. | ||
| 228 | */ | ||
| 229 | if (encoder->possible_crtcs == 0) | ||
| 230 | return -EPROBE_DEFER; | ||
| 231 | 220 | ||
| 232 | ret = dw_hdmi_imx_parse_dt(hdmi); | 221 | ret = dw_hdmi_imx_parse_dt(hdmi); |
| 233 | if (ret < 0) | 222 | if (ret < 0) |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | #include <drm/drm_fb_helper.h> | 20 | #include <drm/drm_fb_helper.h> |
| 21 | #include <drm/drm_gem_cma_helper.h> | 21 | #include <drm/drm_gem_cma_helper.h> |
| 22 | #include <drm/drm_gem_framebuffer_helper.h> | 22 | #include <drm/drm_gem_framebuffer_helper.h> |
| 23 | #include <drm/drm_managed.h> | ||
| 23 | #include <drm/drm_of.h> | 24 | #include <drm/drm_of.h> |
| 24 | #include <drm/drm_plane_helper.h> | 25 | #include <drm/drm_plane_helper.h> |
| 25 | #include <drm/drm_probe_helper.h> | 26 | #include <drm/drm_probe_helper.h> |
| @@ -212,7 +213,9 @@ static int imx_drm_bind(struct device *dev) · 186 unmodified lines | |||
| 212 | drm->mode_config.allow_fb_modifiers = true; | 213 | drm->mode_config.allow_fb_modifiers = true; |
| 213 | drm->mode_config.normalize_zpos = true; | 214 | drm->mode_config.normalize_zpos = true; |
| 214 | 215 | ||
| 215 | drm_mode_config_init(drm); | 216 | ret = drmm_mode_config_init(drm); |
| 217 | if (ret) | ||
| 218 | return ret; | ||
| 216 | 219 | ||
| 217 | ret = drm_vblank_init(drm, MAX_CRTC); | 220 | ret = drm_vblank_init(drm, MAX_CRTC); |
| 218 | if (ret) | 221 | if (ret) |
| @@ -251,7 +254,6 @@ err_poll_fini: · 32 unmodified lines | |||
| 251 | drm_kms_helper_poll_fini(drm); | 254 | drm_kms_helper_poll_fini(drm); |
| 252 | component_unbind_all(drm->dev, drm); | 255 | component_unbind_all(drm->dev, drm); |
| 253 | err_kms: | 256 | err_kms: |
| 254 | drm_mode_config_cleanup(drm); | ||
| 255 | drm_dev_put(drm); | 257 | drm_dev_put(drm); |
| 256 | 258 | ||
| 257 | return ret; | 259 | return ret; |
| @@ -267,11 +269,9 @@ static void imx_drm_unbind(struct device *dev) · 9 unmodified lines | |||
| 267 | 269 | ||
| 268 | component_unbind_all(drm->dev, drm); | 270 | component_unbind_all(drm->dev, drm); |
| 269 | 271 | ||
| 270 | drm_mode_config_cleanup(drm); | 272 | drm_dev_put(drm); |
| 271 | 273 | ||
| 272 | dev_set_drvdata(dev, NULL); | 274 | dev_set_drvdata(dev, NULL); |
| 273 | |||
| 274 | drm_dev_put(drm); | ||
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | static const struct component_master_ops imx_drm_ops = { | 277 | static const struct component_master_ops imx_drm_ops = { |
| @@ -62,7 +62,6 @@ struct imx_ldb_channel { · 61 unmodified lines | |||
| 62 | struct i2c_adapter *ddc; | 62 | struct i2c_adapter *ddc; |
| 63 | int chno; | 63 | int chno; |
| 64 | void *edid; | 64 | void *edid; |
| 65 | int edid_len; | ||
| 66 | struct drm_display_mode mode; | 65 | struct drm_display_mode mode; |
| 67 | int mode_valid; | 66 | int mode_valid; |
| 68 | u32 bus_format; | 67 | u32 bus_format; |
| @@ -536,15 +535,14 @@ static int imx_ldb_panel_ddc(struct device *dev, · 467 unmodified lines | |||
| 536 | } | 535 | } |
| 537 | 536 | ||
| 538 | if (!channel->ddc) { | 537 | if (!channel->ddc) { |
| 538 | int edid_len; | ||
| 539 | |||
| 539 | /* if no DDC available, fallback to hardcoded EDID */ | 540 | /* if no DDC available, fallback to hardcoded EDID */ |
| 540 | dev_dbg(dev, "no ddc available\n"); | 541 | dev_dbg(dev, "no ddc available\n"); |
| 541 | 542 | ||
| 542 | edidp = of_get_property(child, "edid", | 543 | edidp = of_get_property(child, "edid", &edid_len); |
| 543 | &channel->edid_len); | ||
| 544 | if (edidp) { | 544 | if (edidp) { |
| 545 | channel->edid = kmemdup(edidp, | 545 | channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL); |
| 546 | channel->edid_len, | ||
| 547 | GFP_KERNEL); | ||
| 548 | } else if (!channel->panel) { | 546 | } else if (!channel->panel) { |
| 549 | /* fallback to display-timings node */ | 547 | /* fallback to display-timings node */ |
| 550 | ret = of_get_drm_display_mode(child, | 548 | ret = of_get_drm_display_mode(child, |
| @@ -13,7 +13,6 @@ · 12 unmodified lines | |||
| 13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/regmap.h> | 14 | #include <linux/regmap.h> |
| 15 | #include <linux/regulator/consumer.h> | 15 | #include <linux/regulator/consumer.h> |
| 16 | #include <linux/spinlock.h> | ||
| 17 | #include <linux/videodev2.h> | 16 | #include <linux/videodev2.h> |
| 18 | 17 | ||
| 19 | #include <video/imx-ipu-v3.h> | 18 | #include <video/imx-ipu-v3.h> |
| @@ -104,8 +103,6 @@ struct imx_tve { · 84 unmodified lines | |||
| 104 | struct drm_connector connector; | 103 | struct drm_connector connector; |
| 105 | struct drm_encoder encoder; | 104 | struct drm_encoder encoder; |
| 106 | struct device *dev; | 105 | struct device *dev; |
| 107 | spinlock_t lock; /* register lock */ | ||
| 108 | bool enabled; | ||
| 109 | int mode; | 106 | int mode; |
| 110 | int di_hsync_pin; | 107 | int di_hsync_pin; |
| 111 | int di_vsync_pin; | 108 | int di_vsync_pin; |
| @@ -129,30 +126,10 @@ static inline struct imx_tve *enc_to_tve(struct drm_encoder *e) · 17 unmodified lines | |||
| 129 | return container_of(e, struct imx_tve, encoder); | 126 | return container_of(e, struct imx_tve, encoder); |
| 130 | } | 127 | } |
| 131 | 128 | ||
| 132 | static void tve_lock(void *__tve) | ||
| 133 | __acquires(&tve->lock) | ||
| 134 | { | ||
| 135 | struct imx_tve *tve = __tve; | ||
| 136 | |||
| 137 | spin_lock(&tve->lock); | ||
| 138 | } | ||
| 139 | |||
| 140 | static void tve_unlock(void *__tve) | ||
| 141 | __releases(&tve->lock) | ||
| 142 | { | ||
| 143 | struct imx_tve *tve = __tve; | ||
| 144 | |||
| 145 | spin_unlock(&tve->lock); | ||
| 146 | } | ||
| 147 | |||
| 148 | static void tve_enable(struct imx_tve *tve) | 129 | static void tve_enable(struct imx_tve *tve) |
| 149 | { | 130 | { |
| 150 | if (!tve->enabled) { | 131 | clk_prepare_enable(tve->clk); |
| 151 | tve->enabled = true; | 132 | regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, TVE_EN); |
| 152 | clk_prepare_enable(tve->clk); | ||
| 153 | regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, | ||
| 154 | TVE_EN, TVE_EN); | ||
| 155 | } | ||
| 156 | 133 | ||
| 157 | /* clear interrupt status register */ | 134 | /* clear interrupt status register */ |
| 158 | regmap_write(tve->regmap, TVE_STAT_REG, 0xffffffff); | 135 | regmap_write(tve->regmap, TVE_STAT_REG, 0xffffffff); |
| @@ -169,11 +146,8 @@ static void tve_enable(struct imx_tve *tve) · 10 unmodified lines | |||
| 169 | 146 | ||
| 170 | static void tve_disable(struct imx_tve *tve) | 147 | static void tve_disable(struct imx_tve *tve) |
| 171 | { | 148 | { |
| 172 | if (tve->enabled) { | 149 | regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, 0); |
| 173 | tve->enabled = false; | 150 | clk_disable_unprepare(tve->clk); |
| 174 | regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, 0); | ||
| 175 | clk_disable_unprepare(tve->clk); | ||
| 176 | } | ||
| 177 | } | 151 | } |
| 178 | 152 | ||
| 179 | static int tve_setup_tvout(struct imx_tve *tve) | 153 | static int tve_setup_tvout(struct imx_tve *tve) |
| @@ -500,8 +474,7 @@ static struct regmap_config tve_regmap_config = { · 320 unmodified lines | |||
| 500 | 474 | ||
| 501 | .readable_reg = imx_tve_readable_reg, | 475 | .readable_reg = imx_tve_readable_reg, |
| 502 | 476 | ||
| 503 | .lock = tve_lock, | 477 | .fast_io = true, |
| 504 | .unlock = tve_unlock, | ||
| 505 | 478 | ||
| 506 | .max_register = 0xdc, | 479 | .max_register = 0xdc, |
| 507 | }; | 480 | }; |
| @@ -511,7 +484,7 @@ static const char * const imx_tve_modes[] = { · 3 unmodified lines | |||
| 511 | [TVE_MODE_VGA] = "vga", | 484 | [TVE_MODE_VGA] = "vga", |
| 512 | }; | 485 | }; |
| 513 | 486 | ||
| 514 | static const int of_get_tve_mode(struct device_node *np) | 487 | static int of_get_tve_mode(struct device_node *np) |
| 515 | { | 488 | { |
| 516 | const char *bm; | 489 | const char *bm; |
| 517 | int ret, i; | 490 | int ret, i; |
| @@ -544,7 +517,6 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) · 26 unmodified lines | |||
| 544 | memset(tve, 0, sizeof(*tve)); | 517 | memset(tve, 0, sizeof(*tve)); |
| 545 | 518 | ||
| 546 | tve->dev = dev; | 519 | tve->dev = dev; |
| 547 | spin_lock_init(&tve->lock); | ||
| 548 | 520 | ||
| 549 | ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0); | 521 | ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0); |
| 550 | if (ddc_node) { | 522 | if (ddc_node) { |
| @@ -28,7 +28,6 @@ struct imx_parallel_display { · 27 unmodified lines | |||
| 28 | struct drm_bridge bridge; | 28 | struct drm_bridge bridge; |
| 29 | struct device *dev; | 29 | struct device *dev; |
| 30 | void *edid; | 30 | void *edid; |
| 31 | int edid_len; | ||
| 32 | u32 bus_format; | 31 | u32 bus_format; |
| 33 | u32 bus_flags; | 32 | u32 bus_flags; |
| 34 | struct drm_display_mode mode; | 33 | struct drm_display_mode mode; |
| @@ -41,11 +40,6 @@ static inline struct imx_parallel_display *con_to_imxpd(struct drm_connector *c) · 6 unmodified lines | |||
| 41 | return container_of(c, struct imx_parallel_display, connector); | 40 | return container_of(c, struct imx_parallel_display, connector); |
| 42 | } | 41 | } |
| 43 | 42 | ||
| 44 | static inline struct imx_parallel_display *enc_to_imxpd(struct drm_encoder *e) | ||
| 45 | { | ||
| 46 | return container_of(e, struct imx_parallel_display, encoder); | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline struct imx_parallel_display *bridge_to_imxpd(struct drm_bridge *b) | 43 | static inline struct imx_parallel_display *bridge_to_imxpd(struct drm_bridge *b) |
| 50 | { | 44 | { |
| 51 | return container_of(b, struct imx_parallel_display, bridge); | 45 | return container_of(b, struct imx_parallel_display, bridge); |
| @@ -310,6 +304,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) · 258 unmodified lines | |||
| 310 | struct device_node *np = dev->of_node; | 304 | struct device_node *np = dev->of_node; |
| 311 | const u8 *edidp; | 305 | const u8 *edidp; |
| 312 | struct imx_parallel_display *imxpd; | 306 | struct imx_parallel_display *imxpd; |
| 307 | int edid_len; | ||
| 313 | int ret; | 308 | int ret; |
| 314 | u32 bus_format = 0; | 309 | u32 bus_format = 0; |
| 315 | const char *fmt; | 310 | const char *fmt; |
| @@ -323,9 +318,9 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) · 7 unmodified lines | |||
| 323 | if (ret && ret != -ENODEV) | 318 | if (ret && ret != -ENODEV) |
| 324 | return ret; | 319 | return ret; |
| 325 | 320 | ||
| 326 | edidp = of_get_property(np, "edid", &imxpd->edid_len); | 321 | edidp = of_get_property(np, "edid", &edid_len); |
| 327 | if (edidp) | 322 | if (edidp) |
| 328 | imxpd->edid = kmemdup(edidp, imxpd->edid_len, GFP_KERNEL); | 323 | imxpd->edid = devm_kmemdup(dev, edidp, edid_len, GFP_KERNEL); |
| 329 | 324 | ||
| 330 | ret = of_property_read_string(np, "interface-pix-fmt", &fmt); | 325 | ret = of_property_read_string(np, "interface-pix-fmt", &fmt); |
| 331 | if (!ret) { | 326 | if (!ret) { |
| @@ -349,17 +344,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) · 17 unmodified lines | |||
| 349 | return 0; | 344 | return 0; |
| 350 | } | 345 | } |
| 351 | 346 | ||
| 352 | static void imx_pd_unbind(struct device *dev, struct device *master, | ||
| 353 | void *data) | ||
| 354 | { | ||
| 355 | struct imx_parallel_display *imxpd = dev_get_drvdata(dev); | ||
| 356 | |||
| 357 | kfree(imxpd->edid); | ||
| 358 | } | ||
| 359 | |||
| 360 | static const struct component_ops imx_pd_ops = { | 347 | static const struct component_ops imx_pd_ops = { |
| 361 | .bind = imx_pd_bind, | 348 | .bind = imx_pd_bind, |
| 362 | .unbind = imx_pd_unbind, | ||
| 363 | }; | 349 | }; |
| 364 | 350 | ||
| 365 | static int imx_pd_probe(struct platform_device *pdev) | 351 | static int imx_pd_probe(struct platform_device *pdev) |
| @@ -628,6 +628,7 @@ static int panfrost_probe(struct platform_device *pdev) · 627 unmodified lines | |||
| 628 | err_out1: | 628 | err_out1: |
| 629 | pm_runtime_disable(pfdev->dev); | 629 | pm_runtime_disable(pfdev->dev); |
| 630 | panfrost_device_fini(pfdev); | 630 | panfrost_device_fini(pfdev); |
| 631 | pm_runtime_set_suspended(pfdev->dev); | ||
| 631 | err_out0: | 632 | err_out0: |
| 632 | drm_dev_put(ddev); | 633 | drm_dev_put(ddev); |
| 633 | return err; | 634 | return err; |
| @@ -642,9 +643,9 @@ static int panfrost_remove(struct platform_device *pdev) · 8 unmodified lines | |||
| 642 | panfrost_gem_shrinker_cleanup(ddev); | 643 | panfrost_gem_shrinker_cleanup(ddev); |
| 643 | 644 | ||
| 644 | pm_runtime_get_sync(pfdev->dev); | 645 | pm_runtime_get_sync(pfdev->dev); |
| 645 | panfrost_device_fini(pfdev); | ||
| 646 | pm_runtime_put_sync_suspend(pfdev->dev); | ||
| 647 | pm_runtime_disable(pfdev->dev); | 646 | pm_runtime_disable(pfdev->dev); |
| 647 | panfrost_device_fini(pfdev); | ||
| 648 | pm_runtime_set_suspended(pfdev->dev); | ||
| 648 | 649 | ||
| 649 | drm_dev_put(ddev); | 650 | drm_dev_put(ddev); |
| 650 | return 0; | 651 | return 0; |
| @@ -105,14 +105,12 @@ void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping) · 104 unmodified lines | |||
| 105 | kref_put(&mapping->refcount, panfrost_gem_mapping_release); | 105 | kref_put(&mapping->refcount, panfrost_gem_mapping_release); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo) | 108 | void panfrost_gem_teardown_mappings_locked(struct panfrost_gem_object *bo) |
| 109 | { | 109 | { |
| 110 | struct panfrost_gem_mapping *mapping; | 110 | struct panfrost_gem_mapping *mapping; |
| 111 | 111 | ||
| 112 | mutex_lock(&bo->mappings.lock); | ||
| 113 | list_for_each_entry(mapping, &bo->mappings.list, node) | 112 | list_for_each_entry(mapping, &bo->mappings.list, node) |
| 114 | panfrost_gem_teardown_mapping(mapping); | 113 | panfrost_gem_teardown_mapping(mapping); |
| 115 | mutex_unlock(&bo->mappings.lock); | ||
| 116 | } | 114 | } |
| 117 | 115 | ||
| 118 | int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv) | 116 | int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv) |
| @@ -82,7 +82,7 @@ struct panfrost_gem_mapping * · 81 unmodified lines | |||
| 82 | panfrost_gem_mapping_get(struct panfrost_gem_object *bo, | 82 | panfrost_gem_mapping_get(struct panfrost_gem_object *bo, |
| 83 | struct panfrost_file_priv *priv); | 83 | struct panfrost_file_priv *priv); |
| 84 | void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping); | 84 | void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping); |
| 85 | void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo); | 85 | void panfrost_gem_teardown_mappings_locked(struct panfrost_gem_object *bo); |
| 86 | 86 | ||
| 87 | void panfrost_gem_shrinker_init(struct drm_device *dev); | 87 | void panfrost_gem_shrinker_init(struct drm_device *dev); |
| 88 | void panfrost_gem_shrinker_cleanup(struct drm_device *dev); | 88 | void panfrost_gem_shrinker_cleanup(struct drm_device *dev); |
| @@ -40,18 +40,26 @@ static bool panfrost_gem_purge(struct drm_gem_object *obj) · 39 unmodified lines | |||
| 40 | { | 40 | { |
| 41 | struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj); | 41 | struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj); |
| 42 | struct panfrost_gem_object *bo = to_panfrost_bo(obj); | 42 | struct panfrost_gem_object *bo = to_panfrost_bo(obj); |
| 43 | bool ret = false; | ||
| 43 | 44 | ||
| 44 | if (atomic_read(&bo->gpu_usecount)) | 45 | if (atomic_read(&bo->gpu_usecount)) |
| 45 | return false; | 46 | return false; |
| 46 | 47 | ||
| 47 | if (!mutex_trylock(&shmem->pages_lock)) | 48 | if (!mutex_trylock(&bo->mappings.lock)) |
| 48 | return false; | 49 | return false; |
| 49 | 50 | ||
| 50 | panfrost_gem_teardown_mappings(bo); | 51 | if (!mutex_trylock(&shmem->pages_lock)) |
| 52 | goto unlock_mappings; | ||
| 53 | |||
| 54 | panfrost_gem_teardown_mappings_locked(bo); | ||
| 51 | drm_gem_shmem_purge_locked(obj); | 55 | drm_gem_shmem_purge_locked(obj); |
| 56 | ret = true; | ||
| 52 | 57 | ||
| 53 | mutex_unlock(&shmem->pages_lock); | 58 | mutex_unlock(&shmem->pages_lock); |
| 54 | return true; | 59 | |
| 60 | unlock_mappings: | ||
| 61 | mutex_unlock(&bo->mappings.lock); | ||
| 62 | return ret; | ||
| 55 | } | 63 | } |
| 56 | 64 | ||
| 57 | static unsigned long | 65 | static unsigned long |
| @@ -468,7 +468,7 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, · 467 unmodified lines | |||
| 468 | } | 468 | } |
| 469 | 469 | ||
| 470 | if (IS_ERR(cma_obj)) { | 470 | if (IS_ERR(cma_obj)) { |
| 471 | struct drm_printer p = drm_info_printer(vc4->dev->dev); | 471 | struct drm_printer p = drm_info_printer(vc4->base.dev); |
| 472 | DRM_ERROR("Failed to allocate from CMA:\n"); | 472 | DRM_ERROR("Failed to allocate from CMA:\n"); |
| 473 | vc4_bo_stats_print(&p, vc4); | 473 | vc4_bo_stats_print(&p, vc4); |
| 474 | return ERR_PTR(-ENOMEM); | 474 | return ERR_PTR(-ENOMEM); |
| @@ -609,7 +609,7 @@ static void vc4_bo_cache_time_work(struct work_struct *work) · 134 unmodified lines | |||
| 609 | { | 609 | { |
| 610 | struct vc4_dev *vc4 = | 610 | struct vc4_dev *vc4 = |
| 611 | container_of(work, struct vc4_dev, bo_cache.time_work); | 611 | container_of(work, struct vc4_dev, bo_cache.time_work); |
| 612 | struct drm_device *dev = vc4->dev; | 612 | struct drm_device *dev = &vc4->base; |
| 613 | 613 | ||
| 614 | mutex_lock(&vc4->bo_lock); | 614 | mutex_lock(&vc4->bo_lock); |
| 615 | vc4_bo_cache_free_old(dev); | 615 | vc4_bo_cache_free_old(dev); |
| @@ -1024,6 +1024,7 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, · 408 unmodified lines | |||
| 1024 | return 0; | 1024 | return 0; |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused); | ||
| 1027 | int vc4_bo_cache_init(struct drm_device *dev) | 1028 | int vc4_bo_cache_init(struct drm_device *dev) |
| 1028 | { | 1029 | { |
| 1029 | struct vc4_dev *vc4 = to_vc4_dev(dev); | 1030 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
| @@ -1052,10 +1053,10 @@ int vc4_bo_cache_init(struct drm_device *dev) · 22 unmodified lines | |||
| 1052 | INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); | 1053 | INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); |
| 1053 | timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0); | 1054 | timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0); |
| 1054 | 1055 | ||
| 1055 | return 0; | 1056 | return drmm_add_action_or_reset(dev, vc4_bo_cache_destroy, NULL); |
| 1056 | } | 1057 | } |
| 1057 | 1058 | ||
| 1058 | void vc4_bo_cache_destroy(struct drm_device *dev) | 1059 | static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused) |
| 1059 | { | 1060 | { |
| 1060 | struct vc4_dev *vc4 = to_vc4_dev(dev); | 1061 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
| 1061 | int i; | 1062 | int i; |
| @@ -245,37 +245,37 @@ static int vc4_drm_bind(struct device *dev) · 244 unmodified lines | |||
| 245 | 245 | ||
| 246 | dev->coherent_dma_mask = DMA_BIT_MASK(32); | 246 | dev->coherent_dma_mask = DMA_BIT_MASK(32); |
| 247 | 247 | ||
| 248 | vc4 = devm_kzalloc(dev, sizeof(*vc4), GFP_KERNEL); | ||
| 249 | if (!vc4) | ||
| 250 | return -ENOMEM; | ||
| 251 | |||
| 252 | /* If VC4 V3D is missing, don't advertise render nodes. */ | 248 | /* If VC4 V3D is missing, don't advertise render nodes. */ |
| 253 | node = of_find_matching_node_and_match(NULL, vc4_v3d_dt_match, NULL); | 249 | node = of_find_matching_node_and_match(NULL, vc4_v3d_dt_match, NULL); |
| 254 | if (!node || !of_device_is_available(node)) | 250 | if (!node || !of_device_is_available(node)) |
| 255 | vc4_drm_driver.driver_features &= ~DRIVER_RENDER; | 251 | vc4_drm_driver.driver_features &= ~DRIVER_RENDER; |
| 256 | of_node_put(node); | 252 | of_node_put(node); |
| 257 | 253 | ||
| 258 | drm = drm_dev_alloc(&vc4_drm_driver, dev); | 254 | vc4 = devm_drm_dev_alloc(dev, &vc4_drm_driver, struct vc4_dev, base); |
| 259 | if (IS_ERR(drm)) | 255 | if (IS_ERR(vc4)) |
| 260 | return PTR_ERR(drm); | 256 | return PTR_ERR(vc4); |
| 257 | |||
| 258 | drm = &vc4->base; | ||
| 261 | platform_set_drvdata(pdev, drm); | 259 | platform_set_drvdata(pdev, drm); |
| 262 | vc4->dev = drm; | ||
| 263 | drm->dev_private = vc4; | ||
| 264 | INIT_LIST_HEAD(&vc4->debugfs_list); | 260 | INIT_LIST_HEAD(&vc4->debugfs_list); |
| 265 | 261 | ||
| 266 | mutex_init(&vc4->bin_bo_lock); | 262 | mutex_init(&vc4->bin_bo_lock); |
| 267 | 263 | ||
| 268 | ret = vc4_bo_cache_init(drm); | 264 | ret = vc4_bo_cache_init(drm); |
| 269 | if (ret) | 265 | if (ret) |
| 270 | goto dev_put; | 266 | return ret; |
| 271 | 267 | ||
| 272 | drm_mode_config_init(drm); | 268 | ret = drmm_mode_config_init(drm); |
| 269 | if (ret) | ||
| 270 | return ret; | ||
| 273 | 271 | ||
| 274 | vc4_gem_init(drm); | 272 | ret = vc4_gem_init(drm); |
| 273 | if (ret) | ||
| 274 | return ret; | ||
| 275 | 275 | ||
| 276 | ret = component_bind_all(dev, drm); | 276 | ret = component_bind_all(dev, drm); |
| 277 | if (ret) | 277 | if (ret) |
| 278 | goto gem_destroy; | 278 | return ret; |
| 279 | 279 | ||
| 280 | ret = vc4_plane_create_additional_planes(drm); | 280 | ret = vc4_plane_create_additional_planes(drm); |
| 281 | if (ret) | 281 | if (ret) |
| @@ -300,30 +300,17 @@ static int vc4_drm_bind(struct device *dev) · 18 unmodified lines | |||
| 300 | 300 | ||
| 301 | unbind_all: | 301 | unbind_all: |
| 302 | component_unbind_all(dev, drm); | 302 | component_unbind_all(dev, drm); |
| 303 | gem_destroy: | 303 | |
| 304 | vc4_gem_destroy(drm); | ||
| 305 | drm_mode_config_cleanup(drm); | ||
| 306 | vc4_bo_cache_destroy(drm); | ||
| 307 | dev_put: | ||
| 308 | drm_dev_put(drm); | ||
| 309 | return ret; | 304 | return ret; |
| 310 | } | 305 | } |
| 311 | 306 | ||
| 312 | static void vc4_drm_unbind(struct device *dev) | 307 | static void vc4_drm_unbind(struct device *dev) |
| 313 | { | 308 | { |
| 314 | struct drm_device *drm = dev_get_drvdata(dev); | 309 | struct drm_device *drm = dev_get_drvdata(dev); |
| 315 | struct vc4_dev *vc4 = to_vc4_dev(drm); | ||
| 316 | 310 | ||
| 317 | drm_dev_unregister(drm); | 311 | drm_dev_unregister(drm); |
| 318 | 312 | ||
| 319 | drm_atomic_helper_shutdown(drm); | 313 | drm_atomic_helper_shutdown(drm); |
| 320 | |||
| 321 | drm_mode_config_cleanup(drm); | ||
| 322 | |||
| 323 | drm_atomic_private_obj_fini(&vc4->load_tracker); | ||
| 324 | drm_atomic_private_obj_fini(&vc4->ctm_manager); | ||
| 325 | |||
| 326 | drm_dev_put(drm); | ||
| 327 | } | 314 | } |
| 328 | 315 | ||
| 329 | static const struct component_master_ops vc4_drm_ops = { | 316 | static const struct component_master_ops vc4_drm_ops = { |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #include <drm/drm_device.h> | 14 | #include <drm/drm_device.h> |
| 15 | #include <drm/drm_encoder.h> | 15 | #include <drm/drm_encoder.h> |
| 16 | #include <drm/drm_gem_cma_helper.h> | 16 | #include <drm/drm_gem_cma_helper.h> |
| 17 | #include <drm/drm_managed.h> | ||
| 17 | #include <drm/drm_mm.h> | 18 | #include <drm/drm_mm.h> |
| 18 | #include <drm/drm_modeset_lock.h> | 19 | #include <drm/drm_modeset_lock.h> |
| 19 | 20 | ||
| @@ -71,7 +72,7 @@ struct vc4_perfmon { · 51 unmodified lines | |||
| 71 | }; | 72 | }; |
| 72 | 73 | ||
| 73 | struct vc4_dev { | 74 | struct vc4_dev { |
| 74 | struct drm_device *dev; | 75 | struct drm_device base; |
| 75 | 76 | ||
| 76 | struct vc4_hvs *hvs; | 77 | struct vc4_hvs *hvs; |
| 77 | struct vc4_v3d *v3d; | 78 | struct vc4_v3d *v3d; |
| @@ -234,7 +235,7 @@ struct vc4_dev { · 156 unmodified lines | |||
| 234 | static inline struct vc4_dev * | 235 | static inline struct vc4_dev * |
| 235 | to_vc4_dev(struct drm_device *dev) | 236 | to_vc4_dev(struct drm_device *dev) |
| 236 | { | 237 | { |
| 237 | return (struct vc4_dev *)dev->dev_private; | 238 | return container_of(dev, struct vc4_dev, base); |
| 238 | } | 239 | } |
| 239 | 240 | ||
| 240 | struct vc4_bo { | 241 | struct vc4_bo { |
| @@ -808,7 +809,6 @@ struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev, · 567 unmodified lines | |||
| 808 | struct sg_table *sgt); | 809 | struct sg_table *sgt); |
| 809 | void *vc4_prime_vmap(struct drm_gem_object *obj); | 810 | void *vc4_prime_vmap(struct drm_gem_object *obj); |
| 810 | int vc4_bo_cache_init(struct drm_device *dev); | 811 | int vc4_bo_cache_init(struct drm_device *dev); |
| 811 | void vc4_bo_cache_destroy(struct drm_device *dev); | ||
| 812 | int vc4_bo_inc_usecnt(struct vc4_bo *bo); | 812 | int vc4_bo_inc_usecnt(struct vc4_bo *bo); |
| 813 | void vc4_bo_dec_usecnt(struct vc4_bo *bo); | 813 | void vc4_bo_dec_usecnt(struct vc4_bo *bo); |
| 814 | void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo); | 814 | void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo); |
| @@ -873,8 +873,7 @@ extern struct platform_driver vc4_dsi_driver; · 58 unmodified lines | |||
| 873 | extern const struct dma_fence_ops vc4_fence_ops; | 873 | extern const struct dma_fence_ops vc4_fence_ops; |
| 874 | 874 | ||
| 875 | /* vc4_gem.c */ | 875 | /* vc4_gem.c */ |
| 876 | void vc4_gem_init(struct drm_device *dev); | 876 | int vc4_gem_init(struct drm_device *dev); |
| 877 | void vc4_gem_destroy(struct drm_device *dev); | ||
| 878 | int vc4_submit_cl_ioctl(struct drm_device *dev, void *data, | 877 | int vc4_submit_cl_ioctl(struct drm_device *dev, void *data, |
| 879 | struct drm_file *file_priv); | 878 | struct drm_file *file_priv); |
| 880 | int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, | 879 | int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, |
| @@ -314,16 +314,16 @@ vc4_reset_work(struct work_struct *work) · 313 unmodified lines | |||
| 314 | struct vc4_dev *vc4 = | 314 | struct vc4_dev *vc4 = |
| 315 | container_of(work, struct vc4_dev, hangcheck.reset_work); | 315 | container_of(work, struct vc4_dev, hangcheck.reset_work); |
| 316 | 316 | ||
| 317 | vc4_save_hang_state(vc4->dev); | 317 | vc4_save_hang_state(&vc4->base); |
| 318 | 318 | ||
| 319 | vc4_reset(vc4->dev); | 319 | vc4_reset(&vc4->base); |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | static void | 322 | static void |
| 323 | vc4_hangcheck_elapsed(struct timer_list *t) | 323 | vc4_hangcheck_elapsed(struct timer_list *t) |
| 324 | { | 324 | { |
| 325 | struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer); | 325 | struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer); |
| 326 | struct drm_device *dev = vc4->dev; | 326 | struct drm_device *dev = &vc4->base; |
| 327 | uint32_t ct0ca, ct1ca; | 327 | uint32_t ct0ca, ct1ca; |
| 328 | unsigned long irqflags; | 328 | unsigned long irqflags; |
| 329 | struct vc4_exec_info *bin_exec, *render_exec; | 329 | struct vc4_exec_info *bin_exec, *render_exec; |
| @@ -1000,7 +1000,7 @@ vc4_job_handle_completed(struct vc4_dev *vc4) · 670 unmodified lines | |||
| 1000 | list_del(&exec->head); | 1000 | list_del(&exec->head); |
| 1001 | 1001 | ||
| 1002 | spin_unlock_irqrestore(&vc4->job_lock, irqflags); | 1002 | spin_unlock_irqrestore(&vc4->job_lock, irqflags); |
| 1003 | vc4_complete_exec(vc4->dev, exec); | 1003 | vc4_complete_exec(&vc4->base, exec); |
| 1004 | spin_lock_irqsave(&vc4->job_lock, irqflags); | 1004 | spin_lock_irqsave(&vc4->job_lock, irqflags); |
| 1005 | } | 1005 | } |
| 1006 | 1006 | ||
| @@ -1258,13 +1258,13 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 251 unmodified lines | |||
| 1258 | return 0; | 1258 | return 0; |
| 1259 | 1259 | ||
| 1260 | fail: | 1260 | fail: |
| 1261 | vc4_complete_exec(vc4->dev, exec); | 1261 | vc4_complete_exec(&vc4->base, exec); |
| 1262 | 1262 | ||
| 1263 | return ret; | 1263 | return ret; |
| 1264 | } | 1264 | } |
| 1265 | 1265 | ||
| 1266 | void | 1266 | static void vc4_gem_destroy(struct drm_device *dev, void *unused); |
| 1267 | vc4_gem_init(struct drm_device *dev) | 1267 | int vc4_gem_init(struct drm_device *dev) |
| 1268 | { | 1268 | { |
| 1269 | struct vc4_dev *vc4 = to_vc4_dev(dev); | 1269 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
| 1270 | 1270 | ||
| @@ -1285,10 +1285,11 @@ vc4_gem_init(struct drm_device *dev) · 14 unmodified lines | |||
| 1285 | 1285 | ||
| 1286 | INIT_LIST_HEAD(&vc4->purgeable.list); | 1286 | INIT_LIST_HEAD(&vc4->purgeable.list); |
| 1287 | mutex_init(&vc4->purgeable.lock); | 1287 | mutex_init(&vc4->purgeable.lock); |
| 1288 | |||
| 1289 | return drmm_add_action_or_reset(dev, vc4_gem_destroy, NULL); | ||
| 1288 | } | 1290 | } |
| 1289 | 1291 | ||
| 1290 | void | 1292 | static void vc4_gem_destroy(struct drm_device *dev, void *unused) |
| 1291 | vc4_gem_destroy(struct drm_device *dev) | ||
| 1292 | { | 1293 | { |
| 1293 | struct vc4_dev *vc4 = to_vc4_dev(dev); | 1294 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
| 1294 | 1295 | ||
| @@ -562,7 +562,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) · 561 unmodified lines | |||
| 562 | { | 562 | { |
| 563 | struct platform_device *pdev = to_platform_device(dev); | 563 | struct platform_device *pdev = to_platform_device(dev); |
| 564 | struct drm_device *drm = dev_get_drvdata(master); | 564 | struct drm_device *drm = dev_get_drvdata(master); |
| 565 | struct vc4_dev *vc4 = drm->dev_private; | 565 | struct vc4_dev *vc4 = to_vc4_dev(drm); |
| 566 | struct vc4_hvs *hvs = NULL; | 566 | struct vc4_hvs *hvs = NULL; |
| 567 | int ret; | 567 | int ret; |
| 568 | u32 dispctrl; | 568 | u32 dispctrl; |
| @@ -681,7 +681,7 @@ static void vc4_hvs_unbind(struct device *dev, struct device *master, · 112 unmodified lines | |||
| 681 | void *data) | 681 | void *data) |
| 682 | { | 682 | { |
| 683 | struct drm_device *drm = dev_get_drvdata(master); | 683 | struct drm_device *drm = dev_get_drvdata(master); |
| 684 | struct vc4_dev *vc4 = drm->dev_private; | 684 | struct vc4_dev *vc4 = to_vc4_dev(drm); |
| 685 | struct vc4_hvs *hvs = vc4->hvs; | 685 | struct vc4_hvs *hvs = vc4->hvs; |
| 686 | 686 | ||
| 687 | if (drm_mm_node_allocated(&vc4->hvs->mitchell_netravali_filter)) | 687 | if (drm_mm_node_allocated(&vc4->hvs->mitchell_netravali_filter)) |
| @@ -51,7 +51,7 @@ static struct vc4_ctm_state *vc4_get_ctm_state(struct drm_atomic_state *state, · 50 unmodified lines | |||
| 51 | struct drm_private_obj *manager) | 51 | struct drm_private_obj *manager) |
| 52 | { | 52 | { |
| 53 | struct drm_device *dev = state->dev; | 53 | struct drm_device *dev = state->dev; |
| 54 | struct vc4_dev *vc4 = dev->dev_private; | 54 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
| 55 | struct drm_private_state *priv_state; | 55 | struct drm_private_state *priv_state; |
| 56 | int ret; | 56 | int ret; |
| 57 | 57 | ||
| @@ -93,6 +93,29 @@ static const struct drm_private_state_funcs vc4_ctm_state_funcs = { · 35 unmodified lines | |||
| 93 | .atomic_destroy_state = vc4_ctm_destroy_state, | 93 | .atomic_destroy_state = vc4_ctm_destroy_state, |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | static void vc4_ctm_obj_fini(struct drm_device *dev, void *unused) | ||
| 97 | { | ||
| 98 | struct vc4_dev *vc4 = to_vc4_dev(dev); | ||
| 99 | |||
| 100 | drm_atomic_private_obj_fini(&vc4->ctm_manager); | ||
| 101 | } | ||
| 102 | |||
| 103 | static int vc4_ctm_obj_init(struct vc4_dev *vc4) | ||
| 104 | { | ||
| 105 | struct vc4_ctm_state *ctm_state; | ||
| 106 | |||
| 107 | drm_modeset_lock_init(&vc4->ctm_state_lock); | ||
| 108 | |||
| 109 | ctm_state = kzalloc(sizeof(*ctm_state), GFP_KERNEL); | ||
| 110 | if (!ctm_state) | ||
| 111 | return -ENOMEM; | ||
| 112 | |||
| 113 | drm_atomic_private_obj_init(&vc4->base, &vc4->ctm_manager, &ctm_state->base, | ||
| 114 | &vc4_ctm_state_funcs); | ||
| 115 | |||
| 116 | return drmm_add_action(&vc4->base, vc4_ctm_obj_fini, NULL); | ||
| 117 | } | ||
| 118 | |||
| 96 | /* Converts a DRM S31.32 value to the HW S0.9 format. */ | 119 | /* Converts a DRM S31.32 value to the HW S0.9 format. */ |
| 97 | static u16 vc4_ctm_s31_32_to_s0_9(u64 in) | 120 | static u16 vc4_ctm_s31_32_to_s0_9(u64 in) |
| 98 | { | 121 | { |
| @@ -609,6 +632,34 @@ static const struct drm_private_state_funcs vc4_load_tracker_state_funcs = { · 510 unmodified lines | |||
| 609 | .atomic_destroy_state = vc4_load_tracker_destroy_state, | 632 | .atomic_destroy_state = vc4_load_tracker_destroy_state, |
| 610 | }; | 633 | }; |
| 611 | 634 | ||
| 635 | static void vc4_load_tracker_obj_fini(struct drm_device *dev, void *unused) | ||
| 636 | { | ||
| 637 | struct vc4_dev *vc4 = to_vc4_dev(dev); | ||
| 638 | |||
| 639 | if (!vc4->load_tracker_available) | ||
| 640 | return; | ||
| 641 | |||
| 642 | drm_atomic_private_obj_fini(&vc4->load_tracker); | ||
| 643 | } | ||
| 644 | |||
| 645 | static int vc4_load_tracker_obj_init(struct vc4_dev *vc4) | ||
| 646 | { | ||
| 647 | struct vc4_load_tracker_state *load_state; | ||
| 648 | |||
| 649 | if (!vc4->load_tracker_available) | ||
| 650 | return 0; | ||
| 651 | |||
| 652 | load_state = kzalloc(sizeof(*load_state), GFP_KERNEL); | ||
| 653 | if (!load_state) | ||
| 654 | return -ENOMEM; | ||
| 655 | |||
| 656 | drm_atomic_private_obj_init(&vc4->base, &vc4->load_tracker, | ||
| 657 | &load_state->base, | ||
| 658 | &vc4_load_tracker_state_funcs); | ||
| 659 | |||
| 660 | return drmm_add_action(&vc4->base, vc4_load_tracker_obj_fini, NULL); | ||
| 661 | } | ||
| 662 | |||
| 612 | #define NUM_OUTPUTS 6 | 663 | #define NUM_OUTPUTS 6 |
| 613 | #define NUM_CHANNELS 3 | 664 | #define NUM_CHANNELS 3 |
| 614 | 665 | ||
| @@ -711,8 +762,6 @@ static const struct drm_mode_config_funcs vc4_mode_funcs = { · 96 unmodified lines | |||
| 711 | int vc4_kms_load(struct drm_device *dev) | 762 | int vc4_kms_load(struct drm_device *dev) |
| 712 | { | 763 | { |
| 713 | struct vc4_dev *vc4 = to_vc4_dev(dev); | 764 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
| 714 | struct vc4_ctm_state *ctm_state; | ||
| 715 | struct vc4_load_tracker_state *load_state; | ||
| 716 | bool is_vc5 = of_device_is_compatible(dev->dev->of_node, | 765 | bool is_vc5 = of_device_is_compatible(dev->dev->of_node, |
| 717 | "brcm,bcm2711-vc5"); | 766 | "brcm,bcm2711-vc5"); |
| 718 | int ret; | 767 | int ret; |
| @@ -751,26 +800,13 @@ int vc4_kms_load(struct drm_device *dev) · 32 unmodified lines | |||
| 751 | dev->mode_config.async_page_flip = true; | 800 | dev->mode_config.async_page_flip = true; |
| 752 | dev->mode_config.allow_fb_modifiers = true; | 801 | dev->mode_config.allow_fb_modifiers = true; |
| 753 | 802 | ||
| 754 | drm_modeset_lock_init(&vc4->ctm_state_lock); | 803 | ret = vc4_ctm_obj_init(vc4); |
| 755 | 804 | if (ret) | |
| 756 | ctm_state = kzalloc(sizeof(*ctm_state), GFP_KERNEL); | 805 | return ret; |
| 757 | if (!ctm_state) | ||
| 758 | return -ENOMEM; | ||
| 759 | |||
| 760 | drm_atomic_private_obj_init(dev, &vc4->ctm_manager, &ctm_state->base, | ||
| 761 | &vc4_ctm_state_funcs); | ||
| 762 | |||
| 763 | if (vc4->load_tracker_available) { | ||
| 764 | load_state = kzalloc(sizeof(*load_state), GFP_KERNEL); | ||
| 765 | if (!load_state) { | ||
| 766 | drm_atomic_private_obj_fini(&vc4->ctm_manager); | ||
| 767 | return -ENOMEM; | ||
| 768 | } | ||
| 769 | 806 | ||
| 770 | drm_atomic_private_obj_init(dev, &vc4->load_tracker, | 807 | ret = vc4_load_tracker_obj_init(vc4); |
| 771 | &load_state->base, | 808 | if (ret) |
| 772 | &vc4_load_tracker_state_funcs); | 809 | return ret; |
| 773 | } | ||
| 774 | 810 | ||
| 775 | drm_mode_config_reset(dev); | 811 | drm_mode_config_reset(dev); |
| 776 | 812 | ||
| @@ -168,7 +168,7 @@ static void vc4_v3d_init_hw(struct drm_device *dev) · 167 unmodified lines | |||
| 168 | 168 | ||
| 169 | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4) | 169 | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4) |
| 170 | { | 170 | { |
| 171 | struct drm_device *dev = vc4->dev; | 171 | struct drm_device *dev = &vc4->base; |
| 172 | unsigned long irqflags; | 172 | unsigned long irqflags; |
| 173 | int slot; | 173 | int slot; |
| 174 | uint64_t seqno = 0; | 174 | uint64_t seqno = 0; |
| @@ -246,7 +246,7 @@ static int bin_bo_alloc(struct vc4_dev *vc4) · 71 unmodified lines | |||
| 246 | INIT_LIST_HEAD(&list); | 246 | INIT_LIST_HEAD(&list); |
| 247 | 247 | ||
| 248 | while (true) { | 248 | while (true) { |
| 249 | struct vc4_bo *bo = vc4_bo_create(vc4->dev, size, true, | 249 | struct vc4_bo *bo = vc4_bo_create(&vc4->base, size, true, |
| 250 | VC4_BO_TYPE_BIN); | 250 | VC4_BO_TYPE_BIN); |
| 251 | 251 | ||
| 252 | if (IS_ERR(bo)) { | 252 | if (IS_ERR(bo)) { |
| @@ -361,7 +361,7 @@ static int vc4_v3d_runtime_suspend(struct device *dev) · 108 unmodified lines | |||
| 361 | struct vc4_v3d *v3d = dev_get_drvdata(dev); | 361 | struct vc4_v3d *v3d = dev_get_drvdata(dev); |
| 362 | struct vc4_dev *vc4 = v3d->vc4; | 362 | struct vc4_dev *vc4 = v3d->vc4; |
| 363 | 363 | ||
| 364 | vc4_irq_uninstall(vc4->dev); | 364 | vc4_irq_uninstall(&vc4->base); |
| 365 | 365 | ||
| 366 | clk_disable_unprepare(v3d->clk); | 366 | clk_disable_unprepare(v3d->clk); |
| 367 | 367 | ||
| @@ -378,11 +378,11 @@ static int vc4_v3d_runtime_resume(struct device *dev) · 10 unmodified lines | |||
| 378 | if (ret != 0) | 378 | if (ret != 0) |
| 379 | return ret; | 379 | return ret; |
| 380 | 380 | ||
| 381 | vc4_v3d_init_hw(vc4->dev); | 381 | vc4_v3d_init_hw(&vc4->base); |
| 382 | 382 | ||
| 383 | /* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */ | 383 | /* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */ |
| 384 | enable_irq(vc4->dev->irq); | 384 | enable_irq(vc4->base.irq); |
| 385 | vc4_irq_postinstall(vc4->dev); | 385 | vc4_irq_postinstall(&vc4->base); |
| 386 | 386 | ||
| 387 | return 0; | 387 | return 0; |
| 388 | } | 388 | } |
| @@ -133,73 +133,6 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat) · 132 unmodified lines | |||
| 133 | } | 133 | } |
| 134 | EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace); | 134 | EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace); |
| 135 | 135 | ||
| 136 | bool ipu_pixelformat_is_planar(u32 pixelformat) | ||
| 137 | { | ||
| 138 | switch (pixelformat) { | ||
| 139 | case V4L2_PIX_FMT_YUV420: | ||
| 140 | case V4L2_PIX_FMT_YVU420: | ||
| 141 | case V4L2_PIX_FMT_YUV422P: | ||
| 142 | case V4L2_PIX_FMT_NV12: | ||
| 143 | case V4L2_PIX_FMT_NV21: | ||
| 144 | case V4L2_PIX_FMT_NV16: | ||
| 145 | case V4L2_PIX_FMT_NV61: | ||
| 146 | return true; | ||
| 147 | } | ||
| 148 | |||
| 149 | return false; | ||
| 150 | } | ||
| 151 | EXPORT_SYMBOL_GPL(ipu_pixelformat_is_planar); | ||
| 152 | |||
| 153 | enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code) | ||
| 154 | { | ||
| 155 | switch (mbus_code & 0xf000) { | ||
| 156 | case 0x1000: | ||
| 157 | return IPUV3_COLORSPACE_RGB; | ||
| 158 | case 0x2000: | ||
| 159 | return IPUV3_COLORSPACE_YUV; | ||
| 160 | default: | ||
| 161 | return IPUV3_COLORSPACE_UNKNOWN; | ||
| 162 | } | ||
| 163 | } | ||
| 164 | EXPORT_SYMBOL_GPL(ipu_mbus_code_to_colorspace); | ||
| 165 | |||
| 166 | int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat) | ||
| 167 | { | ||
| 168 | switch (pixelformat) { | ||
| 169 | case V4L2_PIX_FMT_YUV420: | ||
| 170 | case V4L2_PIX_FMT_YVU420: | ||
| 171 | case V4L2_PIX_FMT_YUV422P: | ||
| 172 | case V4L2_PIX_FMT_NV12: | ||
| 173 | case V4L2_PIX_FMT_NV21: | ||
| 174 | case V4L2_PIX_FMT_NV16: | ||
| 175 | case V4L2_PIX_FMT_NV61: | ||
| 176 | /* | ||
| 177 | * for the planar YUV formats, the stride passed to | ||
| 178 | * cpmem must be the stride in bytes of the Y plane. | ||
| 179 | * And all the planar YUV formats have an 8-bit | ||
| 180 | * Y component. | ||
| 181 | */ | ||
| 182 | return (8 * pixel_stride) >> 3; | ||
| 183 | case V4L2_PIX_FMT_RGB565: | ||
| 184 | case V4L2_PIX_FMT_YUYV: | ||
| 185 | case V4L2_PIX_FMT_UYVY: | ||
| 186 | return (16 * pixel_stride) >> 3; | ||
| 187 | case V4L2_PIX_FMT_BGR24: | ||
| 188 | case V4L2_PIX_FMT_RGB24: | ||
| 189 | return (24 * pixel_stride) >> 3; | ||
| 190 | case V4L2_PIX_FMT_BGR32: | ||
| 191 | case V4L2_PIX_FMT_RGB32: | ||
| 192 | case V4L2_PIX_FMT_XBGR32: | ||
| 193 | case V4L2_PIX_FMT_XRGB32: | ||
| 194 | return (32 * pixel_stride) >> 3; | ||
| 195 | default: | ||
| 196 | break; | ||
| 197 | } | ||
| 198 | |||
| 199 | return -EINVAL; | ||
| 200 | } | ||
| 201 | EXPORT_SYMBOL_GPL(ipu_stride_to_bytes); | ||
| 202 | |||
| 203 | int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees, | 136 | int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees, |
| 204 | bool hflip, bool vflip) | 137 | bool hflip, bool vflip) |
| 205 | { | 138 | { |
| @@ -1275,7 +1275,7 @@ static void balloon_up(struct work_struct *dummy) · 1274 unmodified lines | |||
| 1275 | 1275 | ||
| 1276 | /* Refuse to balloon below the floor. */ | 1276 | /* Refuse to balloon below the floor. */ |
| 1277 | if (avail_pages < num_pages || avail_pages - num_pages < floor) { | 1277 | if (avail_pages < num_pages || avail_pages - num_pages < floor) { |
| 1278 | pr_warn("Balloon request will be partially fulfilled. %s\n", | 1278 | pr_info("Balloon request will be partially fulfilled. %s\n", |
| 1279 | avail_pages < num_pages ? "Not enough memory." : | 1279 | avail_pages < num_pages ? "Not enough memory." : |
| 1280 | "Balloon floor reached."); | 1280 | "Balloon floor reached."); |
| 1281 | 1281 | ||
| @@ -733,7 +733,7 @@ config I2C_LPC2K · 732 unmodified lines | |||
| 733 | 733 | ||
| 734 | config I2C_MLXBF | 734 | config I2C_MLXBF |
| 735 | tristate "Mellanox BlueField I2C controller" | 735 | tristate "Mellanox BlueField I2C controller" |
| 736 | depends on ARM64 | 736 | depends on MELLANOX_PLATFORM && ARM64 |
| 737 | help | 737 | help |
| 738 | Enabling this option will add I2C SMBus support for Mellanox BlueField | 738 | Enabling this option will add I2C SMBus support for Mellanox BlueField |
| 739 | system. | 739 | system. |
| @@ -159,7 +159,6 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev) · 158 unmodified lines | |||
| 159 | u32 raw_stat, stat, enabled, tmp; | 159 | u32 raw_stat, stat, enabled, tmp; |
| 160 | u8 val = 0, slave_activity; | 160 | u8 val = 0, slave_activity; |
| 161 | 161 | ||
| 162 | regmap_read(dev->map, DW_IC_INTR_STAT, &stat); | ||
| 163 | regmap_read(dev->map, DW_IC_ENABLE, &enabled); | 162 | regmap_read(dev->map, DW_IC_ENABLE, &enabled); |
| 164 | regmap_read(dev->map, DW_IC_RAW_INTR_STAT, &raw_stat); | 163 | regmap_read(dev->map, DW_IC_RAW_INTR_STAT, &raw_stat); |
| 165 | regmap_read(dev->map, DW_IC_STATUS, &tmp); | 164 | regmap_read(dev->map, DW_IC_STATUS, &tmp); |
| @@ -168,32 +167,30 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev) · 2 unmodified lines | |||
| 168 | if (!enabled || !(raw_stat & ~DW_IC_INTR_ACTIVITY) || !dev->slave) | 167 | if (!enabled || !(raw_stat & ~DW_IC_INTR_ACTIVITY) || !dev->slave) |
| 169 | return 0; | 168 | return 0; |
| 170 | 169 | ||
| 170 | stat = i2c_dw_read_clear_intrbits_slave(dev); | ||
| 171 | dev_dbg(dev->dev, | 171 | dev_dbg(dev->dev, |
| 172 | "%#x STATUS SLAVE_ACTIVITY=%#x : RAW_INTR_STAT=%#x : INTR_STAT=%#x\n", | 172 | "%#x STATUS SLAVE_ACTIVITY=%#x : RAW_INTR_STAT=%#x : INTR_STAT=%#x\n", |
| 173 | enabled, slave_activity, raw_stat, stat); | 173 | enabled, slave_activity, raw_stat, stat); |
| 174 | 174 | ||
| 175 | if ((stat & DW_IC_INTR_RX_FULL) && (stat & DW_IC_INTR_STOP_DET)) | 175 | if (stat & DW_IC_INTR_RX_FULL) { |
| 176 | i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_REQUESTED, &val); | 176 | if (dev->status != STATUS_WRITE_IN_PROGRESS) { |
| 177 | dev->status = STATUS_WRITE_IN_PROGRESS; | ||
| 178 | i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_REQUESTED, | ||
| 179 | &val); | ||
| 180 | } | ||
| 181 | |||
| 182 | regmap_read(dev->map, DW_IC_DATA_CMD, &tmp); | ||
| 183 | val = tmp; | ||
| 184 | if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED, | ||
| 185 | &val)) | ||
| 186 | dev_vdbg(dev->dev, "Byte %X acked!", val); | ||
| 187 | } | ||
| 177 | 188 | ||
| 178 | if (stat & DW_IC_INTR_RD_REQ) { | 189 | if (stat & DW_IC_INTR_RD_REQ) { |
| 179 | if (slave_activity) { | 190 | if (slave_activity) { |
| 180 | if (stat & DW_IC_INTR_RX_FULL) { | 191 | regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp); |
| 181 | regmap_read(dev->map, DW_IC_DATA_CMD, &tmp); | 192 | |
| 182 | val = tmp; | 193 | dev->status = STATUS_READ_IN_PROGRESS; |
| 183 | |||
| 184 | if (!i2c_slave_event(dev->slave, | ||
| 185 | I2C_SLAVE_WRITE_RECEIVED, | ||
| 186 | &val)) { | ||
| 187 | dev_vdbg(dev->dev, "Byte %X acked!", | ||
| 188 | val); | ||
| 189 | } | ||
| 190 | regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp); | ||
| 191 | stat = i2c_dw_read_clear_intrbits_slave(dev); | ||
| 192 | } else { | ||
| 193 | regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp); | ||
| 194 | regmap_read(dev->map, DW_IC_CLR_RX_UNDER, &tmp); | ||
| 195 | stat = i2c_dw_read_clear_intrbits_slave(dev); | ||
| 196 | } | ||
| 197 | if (!i2c_slave_event(dev->slave, | 194 | if (!i2c_slave_event(dev->slave, |
| 198 | I2C_SLAVE_READ_REQUESTED, | 195 | I2C_SLAVE_READ_REQUESTED, |
| 199 | &val)) | 196 | &val)) |
| @@ -205,21 +202,11 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev) · 5 unmodified lines | |||
| 205 | if (!i2c_slave_event(dev->slave, I2C_SLAVE_READ_PROCESSED, | 202 | if (!i2c_slave_event(dev->slave, I2C_SLAVE_READ_PROCESSED, |
| 206 | &val)) | 203 | &val)) |
| 207 | regmap_read(dev->map, DW_IC_CLR_RX_DONE, &tmp); | 204 | regmap_read(dev->map, DW_IC_CLR_RX_DONE, &tmp); |
| 208 | |||
| 209 | i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val); | ||
| 210 | stat = i2c_dw_read_clear_intrbits_slave(dev); | ||
| 211 | return 1; | ||
| 212 | } | 205 | } |
| 213 | 206 | ||
| 214 | if (stat & DW_IC_INTR_RX_FULL) { | 207 | if (stat & DW_IC_INTR_STOP_DET) { |
| 215 | regmap_read(dev->map, DW_IC_DATA_CMD, &tmp); | 208 | dev->status = STATUS_IDLE; |
| 216 | val = tmp; | ||
| 217 | if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED, | ||
| 218 | &val)) | ||
| 219 | dev_vdbg(dev->dev, "Byte %X acked!", val); | ||
| 220 | } else { | ||
| 221 | i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val); | 209 | i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val); |
| 222 | stat = i2c_dw_read_clear_intrbits_slave(dev); | ||
| 223 | } | 210 | } |
| 224 | 211 | ||
| 225 | return 1; | 212 | return 1; |
| @@ -230,7 +217,6 @@ static irqreturn_t i2c_dw_isr_slave(int this_irq, void *dev_id) · 4 unmodified lines | |||
| 230 | struct dw_i2c_dev *dev = dev_id; | 217 | struct dw_i2c_dev *dev = dev_id; |
| 231 | int ret; | 218 | int ret; |
| 232 | 219 | ||
| 233 | i2c_dw_read_clear_intrbits_slave(dev); | ||
| 234 | ret = i2c_dw_irq_handler_slave(dev); | 220 | ret = i2c_dw_irq_handler_slave(dev); |
| 235 | if (ret > 0) | 221 | if (ret > 0) |
| 236 | complete(&dev->cmd_complete); | 222 | complete(&dev->cmd_complete); |
| @@ -62,10 +62,8 @@ · 61 unmodified lines | |||
| 62 | * Master. Default value is set to 400MHz. | 62 | * Master. Default value is set to 400MHz. |
| 63 | */ | 63 | */ |
| 64 | #define MLXBF_I2C_TYU_PLL_OUT_FREQ (400 * 1000 * 1000) | 64 | #define MLXBF_I2C_TYU_PLL_OUT_FREQ (400 * 1000 * 1000) |
| 65 | /* Reference clock for Bluefield 1 - 156 MHz. */ | 65 | /* Reference clock for Bluefield - 156 MHz. */ |
| 66 | #define MLXBF_I2C_TYU_PLL_IN_FREQ (156 * 1000 * 1000) | 66 | #define MLXBF_I2C_PLL_IN_FREQ (156 * 1000 * 1000) |
| 67 | /* Reference clock for BlueField 2 - 200 MHz. */ | ||
| 68 | #define MLXBF_I2C_YU_PLL_IN_FREQ (200 * 1000 * 1000) | ||
| 69 | 67 | ||
| 70 | /* Constant used to determine the PLL frequency. */ | 68 | /* Constant used to determine the PLL frequency. */ |
| 71 | #define MLNXBF_I2C_COREPLL_CONST 16384 | 69 | #define MLNXBF_I2C_COREPLL_CONST 16384 |
| @@ -489,44 +487,6 @@ static struct mutex mlxbf_i2c_bus_lock; · 417 unmodified lines | |||
| 489 | 487 | ||
| 490 | #define MLXBF_I2C_FREQUENCY_1GHZ 1000000000 | 488 | #define MLXBF_I2C_FREQUENCY_1GHZ 1000000000 |
| 491 | 489 | ||
| 492 | static void mlxbf_i2c_write(void __iomem *io, int reg, u32 val) | ||
| 493 | { | ||
| 494 | writel(val, io + reg); | ||
| 495 | } | ||
| 496 | |||
| 497 | static u32 mlxbf_i2c_read(void __iomem *io, int reg) | ||
| 498 | { | ||
| 499 | return readl(io + reg); | ||
| 500 | } | ||
| 501 | |||
| 502 | /* | ||
| 503 | * This function is used to read data from Master GW Data Descriptor. | ||
| 504 | * Data bytes in the Master GW Data Descriptor are shifted left so the | ||
| 505 | * data starts at the MSB of the descriptor registers as set by the | ||
| 506 | * underlying hardware. TYU_READ_DATA enables byte swapping while | ||
| 507 | * reading data bytes, and MUST be called by the SMBus read routines | ||
| 508 | * to copy data from the 32 * 32-bit HW Data registers a.k.a Master GW | ||
| 509 | * Data Descriptor. | ||
| 510 | */ | ||
| 511 | static u32 mlxbf_i2c_read_data(void __iomem *io, int reg) | ||
| 512 | { | ||
| 513 | return (u32)be32_to_cpu(mlxbf_i2c_read(io, reg)); | ||
| 514 | } | ||
| 515 | |||
| 516 | /* | ||
| 517 | * This function is used to write data to the Master GW Data Descriptor. | ||
| 518 | * Data copied to the Master GW Data Descriptor MUST be shifted left so | ||
| 519 | * the data starts at the MSB of the descriptor registers as required by | ||
| 520 | * the underlying hardware. TYU_WRITE_DATA enables byte swapping when | ||
| 521 | * writing data bytes, and MUST be called by the SMBus write routines to | ||
| 522 | * copy data to the 32 * 32-bit HW Data registers a.k.a Master GW Data | ||
| 523 | * Descriptor. | ||
| 524 | */ | ||
| 525 | static void mlxbf_i2c_write_data(void __iomem *io, int reg, u32 val) | ||
| 526 | { | ||
| 527 | mlxbf_i2c_write(io, reg, (u32)cpu_to_be32(val)); | ||
| 528 | } | ||
| 529 | |||
| 530 | /* | 490 | /* |
| 531 | * Function to poll a set of bits at a specific address; it checks whether | 491 | * Function to poll a set of bits at a specific address; it checks whether |
| 532 | * the bits are equal to zero when eq_zero is set to 'true', and not equal | 492 | * the bits are equal to zero when eq_zero is set to 'true', and not equal |
| @@ -541,7 +501,7 @@ static u32 mlxbf_smbus_poll(void __iomem *io, u32 addr, u32 mask, · 8 unmodified lines | |||
| 541 | timeout = (timeout / MLXBF_I2C_POLL_FREQ_IN_USEC) + 1; | 501 | timeout = (timeout / MLXBF_I2C_POLL_FREQ_IN_USEC) + 1; |
| 542 | 502 | ||
| 543 | do { | 503 | do { |
| 544 | bits = mlxbf_i2c_read(io, addr) & mask; | 504 | bits = readl(io + addr) & mask; |
| 545 | if (eq_zero ? bits == 0 : bits != 0) | 505 | if (eq_zero ? bits == 0 : bits != 0) |
| 546 | return eq_zero ? 1 : bits; | 506 | return eq_zero ? 1 : bits; |
| 547 | udelay(MLXBF_I2C_POLL_FREQ_IN_USEC); | 507 | udelay(MLXBF_I2C_POLL_FREQ_IN_USEC); |
| @@ -609,16 +569,16 @@ static int mlxbf_i2c_smbus_check_status(struct mlxbf_i2c_priv *priv) · 61 unmodified lines | |||
| 609 | MLXBF_I2C_SMBUS_TIMEOUT); | 569 | MLXBF_I2C_SMBUS_TIMEOUT); |
| 610 | 570 | ||
| 611 | /* Read cause status bits. */ | 571 | /* Read cause status bits. */ |
| 612 | cause_status_bits = mlxbf_i2c_read(priv->mst_cause->io, | 572 | cause_status_bits = readl(priv->mst_cause->io + |
| 613 | MLXBF_I2C_CAUSE_ARBITER); | 573 | MLXBF_I2C_CAUSE_ARBITER); |
| 614 | cause_status_bits &= MLXBF_I2C_CAUSE_MASTER_ARBITER_BITS_MASK; | 574 | cause_status_bits &= MLXBF_I2C_CAUSE_MASTER_ARBITER_BITS_MASK; |
| 615 | 575 | ||
| 616 | /* | 576 | /* |
| 617 | * Parse both Cause and Master GW bits, then return transaction status. | 577 | * Parse both Cause and Master GW bits, then return transaction status. |
| 618 | */ | 578 | */ |
| 619 | 579 | ||
| 620 | master_status_bits = mlxbf_i2c_read(priv->smbus->io, | 580 | master_status_bits = readl(priv->smbus->io + |
| 621 | MLXBF_I2C_SMBUS_MASTER_STATUS); | 581 | MLXBF_I2C_SMBUS_MASTER_STATUS); |
| 622 | master_status_bits &= MLXBF_I2C_SMBUS_MASTER_STATUS_MASK; | 582 | master_status_bits &= MLXBF_I2C_SMBUS_MASTER_STATUS_MASK; |
| 623 | 583 | ||
| 624 | if (mlxbf_i2c_smbus_transaction_success(master_status_bits, | 584 | if (mlxbf_i2c_smbus_transaction_success(master_status_bits, |
| @@ -649,10 +609,17 @@ static void mlxbf_i2c_smbus_write_data(struct mlxbf_i2c_priv *priv, · 24 unmodified lines | |||
| 649 | 609 | ||
| 650 | aligned_length = round_up(length, 4); | 610 | aligned_length = round_up(length, 4); |
| 651 | 611 | ||
| 652 | /* Copy data bytes from 4-byte aligned source buffer. */ | 612 | /* |
| 613 | * Copy data bytes from 4-byte aligned source buffer. | ||
| 614 | * Data copied to the Master GW Data Descriptor MUST be shifted | ||
| 615 | * left so the data starts at the MSB of the descriptor registers | ||
| 616 | * as required by the underlying hardware. Enable byte swapping | ||
| 617 | * when writing data bytes to the 32 * 32-bit HW Data registers | ||
| 618 | * a.k.a Master GW Data Descriptor. | ||
| 619 | */ | ||
| 653 | for (offset = 0; offset < aligned_length; offset += sizeof(u32)) { | 620 | for (offset = 0; offset < aligned_length; offset += sizeof(u32)) { |
| 654 | data32 = *((u32 *)(data + offset)); | 621 | data32 = *((u32 *)(data + offset)); |
| 655 | mlxbf_i2c_write_data(priv->smbus->io, addr + offset, data32); | 622 | iowrite32be(data32, priv->smbus->io + addr + offset); |
| 656 | } | 623 | } |
| 657 | } | 624 | } |
| 658 | 625 | ||
| @@ -664,15 +631,23 @@ static void mlxbf_i2c_smbus_read_data(struct mlxbf_i2c_priv *priv, · 5 unmodified lines | |||
| 664 | 631 | ||
| 665 | mask = sizeof(u32) - 1; | 632 | mask = sizeof(u32) - 1; |
| 666 | 633 | ||
| 634 | /* | ||
| 635 | * Data bytes in the Master GW Data Descriptor are shifted left | ||
| 636 | * so the data starts at the MSB of the descriptor registers as | ||
| 637 | * set by the underlying hardware. Enable byte swapping while | ||
| 638 | * reading data bytes from the 32 * 32-bit HW Data registers | ||
| 639 | * a.k.a Master GW Data Descriptor. | ||
| 640 | */ | ||
| 641 | |||
| 667 | for (offset = 0; offset < (length & ~mask); offset += sizeof(u32)) { | 642 | for (offset = 0; offset < (length & ~mask); offset += sizeof(u32)) { |
| 668 | data32 = mlxbf_i2c_read_data(priv->smbus->io, addr + offset); | 643 | data32 = ioread32be(priv->smbus->io + addr + offset); |
| 669 | *((u32 *)(data + offset)) = data32; | 644 | *((u32 *)(data + offset)) = data32; |
| 670 | } | 645 | } |
| 671 | 646 | ||
| 672 | if (!(length & mask)) | 647 | if (!(length & mask)) |
| 673 | return; | 648 | return; |
| 674 | 649 | ||
| 675 | data32 = mlxbf_i2c_read_data(priv->smbus->io, addr + offset); | 650 | data32 = ioread32be(priv->smbus->io + addr + offset); |
| 676 | 651 | ||
| 677 | for (byte = 0; byte < (length & mask); byte++) { | 652 | for (byte = 0; byte < (length & mask); byte++) { |
| 678 | data[offset + byte] = data32 & GENMASK(7, 0); | 653 | data[offset + byte] = data32 & GENMASK(7, 0); |
| @@ -698,16 +673,16 @@ static int mlxbf_i2c_smbus_enable(struct mlxbf_i2c_priv *priv, u8 slave, · 19 unmodified lines | |||
| 698 | command |= rol32(pec_en, MLXBF_I2C_MASTER_SEND_PEC_SHIFT); | 673 | command |= rol32(pec_en, MLXBF_I2C_MASTER_SEND_PEC_SHIFT); |
| 699 | 674 | ||
| 700 | /* Clear status bits. */ | 675 | /* Clear status bits. */ |
| 701 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_STATUS, 0x0); | 676 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_STATUS); |
| 702 | /* Set the cause data. */ | 677 | /* Set the cause data. */ |
| 703 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_CAUSE_OR_CLEAR, ~0x0); | 678 | writel(~0x0, priv->smbus->io + MLXBF_I2C_CAUSE_OR_CLEAR); |
| 704 | /* Zero PEC byte. */ | 679 | /* Zero PEC byte. */ |
| 705 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_PEC, 0x0); | 680 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_PEC); |
| 706 | /* Zero byte count. */ | 681 | /* Zero byte count. */ |
| 707 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_RS_BYTES, 0x0); | 682 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_RS_BYTES); |
| 708 | 683 | ||
| 709 | /* GW activation. */ | 684 | /* GW activation. */ |
| 710 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_GW, command); | 685 | writel(command, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_GW); |
| 711 | 686 | ||
| 712 | /* | 687 | /* |
| 713 | * Poll master status and check status bits. An ACK is sent when | 688 | * Poll master status and check status bits. An ACK is sent when |
| @@ -823,8 +798,8 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, · 109 unmodified lines | |||
| 823 | * needs to be 'manually' reset. This should be removed in | 798 | * needs to be 'manually' reset. This should be removed in |
| 824 | * next tag integration. | 799 | * next tag integration. |
| 825 | */ | 800 | */ |
| 826 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_FSM, | 801 | writel(MLXBF_I2C_SMBUS_MASTER_FSM_PS_STATE_MASK, |
| 827 | MLXBF_I2C_SMBUS_MASTER_FSM_PS_STATE_MASK); | 802 | priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_FSM); |
| 828 | } | 803 | } |
| 829 | 804 | ||
| 830 | return ret; | 805 | return ret; |
| @@ -1113,8 +1088,8 @@ static void mlxbf_i2c_set_timings(struct mlxbf_i2c_priv *priv, · 282 unmodified lines | |||
| 1113 | timer |= mlxbf_i2c_set_timer(priv, timings->scl_low, | 1088 | timer |= mlxbf_i2c_set_timer(priv, timings->scl_low, |
| 1114 | false, MLXBF_I2C_MASK_16, | 1089 | false, MLXBF_I2C_MASK_16, |
| 1115 | MLXBF_I2C_SHIFT_16); | 1090 | MLXBF_I2C_SHIFT_16); |
| 1116 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_SCL_LOW_SCL_HIGH, | 1091 | writel(timer, priv->smbus->io + |
| 1117 | timer); | 1092 | MLXBF_I2C_SMBUS_TIMER_SCL_LOW_SCL_HIGH); |
| 1118 | 1093 | ||
| 1119 | timer = mlxbf_i2c_set_timer(priv, timings->sda_rise, false, | 1094 | timer = mlxbf_i2c_set_timer(priv, timings->sda_rise, false, |
| 1120 | MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_0); | 1095 | MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_0); |
| @@ -1124,37 +1099,34 @@ static void mlxbf_i2c_set_timings(struct mlxbf_i2c_priv *priv, · 3 unmodified lines | |||
| 1124 | MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_16); | 1099 | MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_16); |
| 1125 | timer |= mlxbf_i2c_set_timer(priv, timings->scl_fall, false, | 1100 | timer |= mlxbf_i2c_set_timer(priv, timings->scl_fall, false, |
| 1126 | MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_24); | 1101 | MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_24); |
| 1127 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_FALL_RISE_SPIKE, | 1102 | writel(timer, priv->smbus->io + |
| 1128 | timer); | 1103 | MLXBF_I2C_SMBUS_TIMER_FALL_RISE_SPIKE); |
| 1129 | 1104 | ||
| 1130 | timer = mlxbf_i2c_set_timer(priv, timings->hold_start, true, | 1105 | timer = mlxbf_i2c_set_timer(priv, timings->hold_start, true, |
| 1131 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0); | 1106 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0); |
| 1132 | timer |= mlxbf_i2c_set_timer(priv, timings->hold_data, true, | 1107 | timer |= mlxbf_i2c_set_timer(priv, timings->hold_data, true, |
| 1133 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16); | 1108 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16); |
| 1134 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_THOLD, timer); | 1109 | writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_TIMER_THOLD); |
| 1135 | 1110 | ||
| 1136 | timer = mlxbf_i2c_set_timer(priv, timings->setup_start, true, | 1111 | timer = mlxbf_i2c_set_timer(priv, timings->setup_start, true, |
| 1137 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0); | 1112 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0); |
| 1138 | timer |= mlxbf_i2c_set_timer(priv, timings->setup_stop, true, | 1113 | timer |= mlxbf_i2c_set_timer(priv, timings->setup_stop, true, |
| 1139 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16); | 1114 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16); |
| 1140 | mlxbf_i2c_write(priv->smbus->io, | 1115 | writel(timer, priv->smbus->io + |
| 1141 | MLXBF_I2C_SMBUS_TIMER_TSETUP_START_STOP, timer); | 1116 | MLXBF_I2C_SMBUS_TIMER_TSETUP_START_STOP); |
| 1142 | 1117 | ||
| 1143 | timer = mlxbf_i2c_set_timer(priv, timings->setup_data, true, | 1118 | timer = mlxbf_i2c_set_timer(priv, timings->setup_data, true, |
| 1144 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0); | 1119 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0); |
| 1145 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_TSETUP_DATA, | 1120 | writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_TIMER_TSETUP_DATA); |
| 1146 | timer); | ||
| 1147 | 1121 | ||
| 1148 | timer = mlxbf_i2c_set_timer(priv, timings->buf, false, | 1122 | timer = mlxbf_i2c_set_timer(priv, timings->buf, false, |
| 1149 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0); | 1123 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0); |
| 1150 | timer |= mlxbf_i2c_set_timer(priv, timings->thigh_max, false, | 1124 | timer |= mlxbf_i2c_set_timer(priv, timings->thigh_max, false, |
| 1151 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16); | 1125 | MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16); |
| 1152 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_THIGH_MAX_TBUF, | 1126 | writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_THIGH_MAX_TBUF); |
| 1153 | timer); | ||
| 1154 | 1127 | ||
| 1155 | timer = timings->timeout; | 1128 | timer = timings->timeout; |
| 1156 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SCL_LOW_TIMEOUT, | 1129 | writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_SCL_LOW_TIMEOUT); |
| 1157 | timer); | ||
| 1158 | } | 1130 | } |
| 1159 | 1131 | ||
| 1160 | enum mlxbf_i2c_timings_config { | 1132 | enum mlxbf_i2c_timings_config { |
| @@ -1426,19 +1398,15 @@ static int mlxbf_i2c_init_master(struct platform_device *pdev, · 265 unmodified lines | |||
| 1426 | * platform firmware; disabling the bus might compromise the system | 1398 | * platform firmware; disabling the bus might compromise the system |
| 1427 | * functionality. | 1399 | * functionality. |
| 1428 | */ | 1400 | */ |
| 1429 | config_reg = mlxbf_i2c_read(gpio_res->io, | 1401 | config_reg = readl(gpio_res->io + MLXBF_I2C_GPIO_0_FUNC_EN_0); |
| 1430 | MLXBF_I2C_GPIO_0_FUNC_EN_0); | ||
| 1431 | config_reg = MLXBF_I2C_GPIO_SMBUS_GW_ASSERT_PINS(priv->bus, | 1402 | config_reg = MLXBF_I2C_GPIO_SMBUS_GW_ASSERT_PINS(priv->bus, |
| 1432 | config_reg); | 1403 | config_reg); |
| 1433 | mlxbf_i2c_write(gpio_res->io, MLXBF_I2C_GPIO_0_FUNC_EN_0, | 1404 | writel(config_reg, gpio_res->io + MLXBF_I2C_GPIO_0_FUNC_EN_0); |
| 1434 | config_reg); | ||
| 1435 | 1405 | ||
| 1436 | config_reg = mlxbf_i2c_read(gpio_res->io, | 1406 | config_reg = readl(gpio_res->io + MLXBF_I2C_GPIO_0_FORCE_OE_EN); |
| 1437 | MLXBF_I2C_GPIO_0_FORCE_OE_EN); | ||
| 1438 | config_reg = MLXBF_I2C_GPIO_SMBUS_GW_RESET_PINS(priv->bus, | 1407 | config_reg = MLXBF_I2C_GPIO_SMBUS_GW_RESET_PINS(priv->bus, |
| 1439 | config_reg); | 1408 | config_reg); |
| 1440 | mlxbf_i2c_write(gpio_res->io, MLXBF_I2C_GPIO_0_FORCE_OE_EN, | 1409 | writel(config_reg, gpio_res->io + MLXBF_I2C_GPIO_0_FORCE_OE_EN); |
| 1441 | config_reg); | ||
| 1442 | 1410 | ||
| 1443 | mutex_unlock(gpio_res->lock); | 1411 | mutex_unlock(gpio_res->lock); |
| 1444 | 1412 | ||
| @@ -1452,10 +1420,9 @@ static u64 mlxbf_calculate_freq_from_tyu(struct mlxbf_i2c_resource *corepll_res) · 7 unmodified lines | |||
| 1452 | u32 corepll_val; | 1420 | u32 corepll_val; |
| 1453 | u16 core_f; | 1421 | u16 core_f; |
| 1454 | 1422 | ||
| 1455 | pad_frequency = MLXBF_I2C_TYU_PLL_IN_FREQ; | 1423 | pad_frequency = MLXBF_I2C_PLL_IN_FREQ; |
| 1456 | 1424 | ||
| 1457 | corepll_val = mlxbf_i2c_read(corepll_res->io, | 1425 | corepll_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1); |
| 1458 | MLXBF_I2C_CORE_PLL_REG1); | ||
| 1459 | 1426 | ||
| 1460 | /* Get Core PLL configuration bits. */ | 1427 | /* Get Core PLL configuration bits. */ |
| 1461 | core_f = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT) & | 1428 | core_f = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT) & |
| @@ -1488,12 +1455,10 @@ static u64 mlxbf_calculate_freq_from_yu(struct mlxbf_i2c_resource *corepll_res) · 26 unmodified lines | |||
| 1488 | u8 core_od, core_r; | 1455 | u8 core_od, core_r; |
| 1489 | u32 core_f; | 1456 | u32 core_f; |
| 1490 | 1457 | ||
| 1491 | pad_frequency = MLXBF_I2C_YU_PLL_IN_FREQ; | 1458 | pad_frequency = MLXBF_I2C_PLL_IN_FREQ; |
| 1492 | 1459 | ||
| 1493 | corepll_reg1_val = mlxbf_i2c_read(corepll_res->io, | 1460 | corepll_reg1_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1); |
| 1494 | MLXBF_I2C_CORE_PLL_REG1); | 1461 | corepll_reg2_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG2); |
| 1495 | corepll_reg2_val = mlxbf_i2c_read(corepll_res->io, | ||
| 1496 | MLXBF_I2C_CORE_PLL_REG2); | ||
| 1497 | 1462 | ||
| 1498 | /* Get Core PLL configuration bits */ | 1463 | /* Get Core PLL configuration bits */ |
| 1499 | core_f = rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT) & | 1464 | core_f = rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT) & |
| @@ -1585,7 +1550,7 @@ static int mlxbf_slave_enable(struct mlxbf_i2c_priv *priv, u8 addr) · 85 unmodified lines | |||
| 1585 | * (7-bit address, 1 status bit (1 if enabled, 0 if not)). | 1550 | * (7-bit address, 1 status bit (1 if enabled, 0 if not)). |
| 1586 | */ | 1551 | */ |
| 1587 | for (reg = 0; reg < reg_cnt; reg++) { | 1552 | for (reg = 0; reg < reg_cnt; reg++) { |
| 1588 | slave_reg = mlxbf_i2c_read(priv->smbus->io, | 1553 | slave_reg = readl(priv->smbus->io + |
| 1589 | MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4); | 1554 | MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4); |
| 1590 | /* | 1555 | /* |
| 1591 | * Each register holds 4 slave addresses. So, we have to keep | 1556 | * Each register holds 4 slave addresses. So, we have to keep |
| @@ -1643,8 +1608,8 @@ static int mlxbf_slave_enable(struct mlxbf_i2c_priv *priv, u8 addr) · 51 unmodified lines | |||
| 1643 | 1608 | ||
| 1644 | /* Enable the slave address and update the register. */ | 1609 | /* Enable the slave address and update the register. */ |
| 1645 | slave_reg |= (1 << MLXBF_I2C_SMBUS_SLAVE_ADDR_EN_BIT) << (byte * 8); | 1610 | slave_reg |= (1 << MLXBF_I2C_SMBUS_SLAVE_ADDR_EN_BIT) << (byte * 8); |
| 1646 | mlxbf_i2c_write(priv->smbus->io, | 1611 | writel(slave_reg, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + |
| 1647 | MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4, slave_reg); | 1612 | reg * 0x4); |
| 1648 | 1613 | ||
| 1649 | return 0; | 1614 | return 0; |
| 1650 | } | 1615 | } |
| @@ -1668,7 +1633,7 @@ static int mlxbf_slave_disable(struct mlxbf_i2c_priv *priv) · 17 unmodified lines | |||
| 1668 | * (7-bit address, 1 status bit (1 if enabled, 0 if not)). | 1633 | * (7-bit address, 1 status bit (1 if enabled, 0 if not)). |
| 1669 | */ | 1634 | */ |
| 1670 | for (reg = 0; reg < reg_cnt; reg++) { | 1635 | for (reg = 0; reg < reg_cnt; reg++) { |
| 1671 | slave_reg = mlxbf_i2c_read(priv->smbus->io, | 1636 | slave_reg = readl(priv->smbus->io + |
| 1672 | MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4); | 1637 | MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4); |
| 1673 | 1638 | ||
| 1674 | /* Check whether the address slots are empty. */ | 1639 | /* Check whether the address slots are empty. */ |
| @@ -1708,8 +1673,8 @@ static int mlxbf_slave_disable(struct mlxbf_i2c_priv *priv) · 33 unmodified lines | |||
| 1708 | 1673 | ||
| 1709 | /* Cleanup the slave address slot. */ | 1674 | /* Cleanup the slave address slot. */ |
| 1710 | slave_reg &= ~(GENMASK(7, 0) << (slave_byte * 8)); | 1675 | slave_reg &= ~(GENMASK(7, 0) << (slave_byte * 8)); |
| 1711 | mlxbf_i2c_write(priv->smbus->io, | 1676 | writel(slave_reg, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + |
| 1712 | MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4, slave_reg); | 1677 | reg * 0x4); |
| 1713 | 1678 | ||
| 1714 | return 0; | 1679 | return 0; |
| 1715 | } | 1680 | } |
| @@ -1801,7 +1766,7 @@ static int mlxbf_i2c_init_slave(struct platform_device *pdev, · 85 unmodified lines | |||
| 1801 | int ret; | 1766 | int ret; |
| 1802 | 1767 | ||
| 1803 | /* Reset FSM. */ | 1768 | /* Reset FSM. */ |
| 1804 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_FSM, 0); | 1769 | writel(0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_FSM); |
| 1805 | 1770 | ||
| 1806 | /* | 1771 | /* |
| 1807 | * Enable slave cause interrupt bits. Drive | 1772 | * Enable slave cause interrupt bits. Drive |
| @@ -1810,15 +1775,13 @@ static int mlxbf_i2c_init_slave(struct platform_device *pdev, · 2 unmodified lines | |||
| 1810 | * masters issue a Read and Write, respectively. But, clear all | 1775 | * masters issue a Read and Write, respectively. But, clear all |
| 1811 | * interrupts first. | 1776 | * interrupts first. |
| 1812 | */ | 1777 | */ |
| 1813 | mlxbf_i2c_write(priv->slv_cause->io, | 1778 | writel(~0, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR); |
| 1814 | MLXBF_I2C_CAUSE_OR_CLEAR, ~0); | ||
| 1815 | int_reg = MLXBF_I2C_CAUSE_READ_WAIT_FW_RESPONSE; | 1779 | int_reg = MLXBF_I2C_CAUSE_READ_WAIT_FW_RESPONSE; |
| 1816 | int_reg |= MLXBF_I2C_CAUSE_WRITE_SUCCESS; | 1780 | int_reg |= MLXBF_I2C_CAUSE_WRITE_SUCCESS; |
| 1817 | mlxbf_i2c_write(priv->slv_cause->io, | 1781 | writel(int_reg, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_EVTEN0); |
| 1818 | MLXBF_I2C_CAUSE_OR_EVTEN0, int_reg); | ||
| 1819 | 1782 | ||
| 1820 | /* Finally, set the 'ready' bit to start handling transactions. */ | 1783 | /* Finally, set the 'ready' bit to start handling transactions. */ |
| 1821 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1); | 1784 | writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY); |
| 1822 | 1785 | ||
| 1823 | /* Initialize the cause coalesce resource. */ | 1786 | /* Initialize the cause coalesce resource. */ |
| 1824 | ret = mlxbf_i2c_init_coalesce(pdev, priv); | 1787 | ret = mlxbf_i2c_init_coalesce(pdev, priv); |
| @@ -1844,23 +1807,21 @@ static bool mlxbf_i2c_has_coalesce(struct mlxbf_i2c_priv *priv, bool *read, · 19 unmodified lines | |||
| 1844 | MLXBF_I2C_CAUSE_YU_SLAVE_BIT : | 1807 | MLXBF_I2C_CAUSE_YU_SLAVE_BIT : |
| 1845 | priv->bus + MLXBF_I2C_CAUSE_TYU_SLAVE_BIT; | 1808 | priv->bus + MLXBF_I2C_CAUSE_TYU_SLAVE_BIT; |
| 1846 | 1809 | ||
| 1847 | coalesce0_reg = mlxbf_i2c_read(priv->coalesce->io, | 1810 | coalesce0_reg = readl(priv->coalesce->io + MLXBF_I2C_CAUSE_COALESCE_0); |
| 1848 | MLXBF_I2C_CAUSE_COALESCE_0); | ||
| 1849 | is_set = coalesce0_reg & (1 << slave_shift); | 1811 | is_set = coalesce0_reg & (1 << slave_shift); |
| 1850 | 1812 | ||
| 1851 | if (!is_set) | 1813 | if (!is_set) |
| 1852 | return false; | 1814 | return false; |
| 1853 | 1815 | ||
| 1854 | /* Check the source of the interrupt, i.e. whether a Read or Write. */ | 1816 | /* Check the source of the interrupt, i.e. whether a Read or Write. */ |
| 1855 | cause_reg = mlxbf_i2c_read(priv->slv_cause->io, | 1817 | cause_reg = readl(priv->slv_cause->io + MLXBF_I2C_CAUSE_ARBITER); |
| 1856 | MLXBF_I2C_CAUSE_ARBITER); | ||
| 1857 | if (cause_reg & MLXBF_I2C_CAUSE_READ_WAIT_FW_RESPONSE) | 1818 | if (cause_reg & MLXBF_I2C_CAUSE_READ_WAIT_FW_RESPONSE) |
| 1858 | *read = true; | 1819 | *read = true; |
| 1859 | else if (cause_reg & MLXBF_I2C_CAUSE_WRITE_SUCCESS) | 1820 | else if (cause_reg & MLXBF_I2C_CAUSE_WRITE_SUCCESS) |
| 1860 | *write = true; | 1821 | *write = true; |
| 1861 | 1822 | ||
| 1862 | /* Clear cause bits. */ | 1823 | /* Clear cause bits. */ |
| 1863 | mlxbf_i2c_write(priv->slv_cause->io, MLXBF_I2C_CAUSE_OR_CLEAR, ~0x0); | 1824 | writel(~0x0, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR); |
| 1864 | 1825 | ||
| 1865 | return true; | 1826 | return true; |
| 1866 | } | 1827 | } |
| @@ -1900,8 +1861,8 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes) · 33 unmodified lines | |||
| 1900 | * address, if supplied. | 1861 | * address, if supplied. |
| 1901 | */ | 1862 | */ |
| 1902 | if (recv_bytes > 0) { | 1863 | if (recv_bytes > 0) { |
| 1903 | data32 = mlxbf_i2c_read_data(priv->smbus->io, | 1864 | data32 = ioread32be(priv->smbus->io + |
| 1904 | MLXBF_I2C_SLAVE_DATA_DESC_ADDR); | 1865 | MLXBF_I2C_SLAVE_DATA_DESC_ADDR); |
| 1905 | 1866 | ||
| 1906 | /* Parse the received bytes. */ | 1867 | /* Parse the received bytes. */ |
| 1907 | switch (recv_bytes) { | 1868 | switch (recv_bytes) { |
| @@ -1966,7 +1927,7 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes) · 58 unmodified lines | |||
| 1966 | control32 |= rol32(write_size, MLXBF_I2C_SLAVE_WRITE_BYTES_SHIFT); | 1927 | control32 |= rol32(write_size, MLXBF_I2C_SLAVE_WRITE_BYTES_SHIFT); |
| 1967 | control32 |= rol32(pec_en, MLXBF_I2C_SLAVE_SEND_PEC_SHIFT); | 1928 | control32 |= rol32(pec_en, MLXBF_I2C_SLAVE_SEND_PEC_SHIFT); |
| 1968 | 1929 | ||
| 1969 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_GW, control32); | 1930 | writel(control32, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_GW); |
| 1970 | 1931 | ||
| 1971 | /* | 1932 | /* |
| 1972 | * Wait until the transfer is completed; the driver will wait | 1933 | * Wait until the transfer is completed; the driver will wait |
| @@ -1975,10 +1936,9 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes) · 2 unmodified lines | |||
| 1975 | mlxbf_smbus_slave_wait_for_idle(priv, MLXBF_I2C_SMBUS_TIMEOUT); | 1936 | mlxbf_smbus_slave_wait_for_idle(priv, MLXBF_I2C_SMBUS_TIMEOUT); |
| 1976 | 1937 | ||
| 1977 | /* Release the Slave GW. */ | 1938 | /* Release the Slave GW. */ |
| 1978 | mlxbf_i2c_write(priv->smbus->io, | 1939 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES); |
| 1979 | MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES, 0x0); | 1940 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_PEC); |
| 1980 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_PEC, 0x0); | 1941 | writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY); |
| 1981 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1); | ||
| 1982 | 1942 | ||
| 1983 | return 0; | 1943 | return 0; |
| 1984 | } | 1944 | } |
| @@ -2023,10 +1983,9 @@ static int mlxbf_smbus_irq_recv(struct mlxbf_i2c_priv *priv, u8 recv_bytes) · 38 unmodified lines | |||
| 2023 | i2c_slave_event(slave, I2C_SLAVE_STOP, &value); | 1983 | i2c_slave_event(slave, I2C_SLAVE_STOP, &value); |
| 2024 | 1984 | ||
| 2025 | /* Release the Slave GW. */ | 1985 | /* Release the Slave GW. */ |
| 2026 | mlxbf_i2c_write(priv->smbus->io, | 1986 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES); |
| 2027 | MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES, 0x0); | 1987 | writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_PEC); |
| 2028 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_PEC, 0x0); | 1988 | writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY); |
| 2029 | mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1); | ||
| 2030 | 1989 | ||
| 2031 | return ret; | 1990 | return ret; |
| 2032 | } | 1991 | } |
| @@ -2061,8 +2020,8 @@ static irqreturn_t mlxbf_smbus_irq(int irq, void *ptr) · 28 unmodified lines | |||
| 2061 | * slave, if the higher 8 bits are sent then the slave expect N bytes | 2020 | * slave, if the higher 8 bits are sent then the slave expect N bytes |
| 2062 | * from the master. | 2021 | * from the master. |
| 2063 | */ | 2022 | */ |
| 2064 | rw_bytes_reg = mlxbf_i2c_read(priv->smbus->io, | 2023 | rw_bytes_reg = readl(priv->smbus->io + |
| 2065 | MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES); | 2024 | MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES); |
| 2066 | recv_bytes = (rw_bytes_reg >> 8) & GENMASK(7, 0); | 2025 | recv_bytes = (rw_bytes_reg >> 8) & GENMASK(7, 0); |
| 2067 | 2026 | ||
| 2068 | /* | 2027 | /* |
| @@ -2264,6 +2223,7 @@ static const struct of_device_id mlxbf_i2c_dt_ids[] = { · 195 unmodified lines | |||
| 2264 | 2223 | ||
| 2265 | MODULE_DEVICE_TABLE(of, mlxbf_i2c_dt_ids); | 2224 | MODULE_DEVICE_TABLE(of, mlxbf_i2c_dt_ids); |
| 2266 | 2225 | ||
| 2226 | #ifdef CONFIG_ACPI | ||
| 2267 | static const struct acpi_device_id mlxbf_i2c_acpi_ids[] = { | 2227 | static const struct acpi_device_id mlxbf_i2c_acpi_ids[] = { |
| 2268 | { "MLNXBF03", (kernel_ulong_t)&mlxbf_i2c_chip[MLXBF_I2C_CHIP_TYPE_1] }, | 2228 | { "MLNXBF03", (kernel_ulong_t)&mlxbf_i2c_chip[MLXBF_I2C_CHIP_TYPE_1] }, |
| 2269 | { "MLNXBF23", (kernel_ulong_t)&mlxbf_i2c_chip[MLXBF_I2C_CHIP_TYPE_2] }, | 2229 | { "MLNXBF23", (kernel_ulong_t)&mlxbf_i2c_chip[MLXBF_I2C_CHIP_TYPE_2] }, |
| @@ -2305,6 +2265,12 @@ static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv) · 35 unmodified lines | |||
| 2305 | 2265 | ||
| 2306 | return ret; | 2266 | return ret; |
| 2307 | } | 2267 | } |
| 2268 | #else | ||
| 2269 | static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv) | ||
| 2270 | { | ||
| 2271 | return -ENOENT; | ||
| 2272 | } | ||
| 2273 | #endif /* CONFIG_ACPI */ | ||
| 2308 | 2274 | ||
| 2309 | static int mlxbf_i2c_of_probe(struct device *dev, struct mlxbf_i2c_priv *priv) | 2275 | static int mlxbf_i2c_of_probe(struct device *dev, struct mlxbf_i2c_priv *priv) |
| 2310 | { | 2276 | { |
| @@ -2473,7 +2439,9 @@ static struct platform_driver mlxbf_i2c_driver = { · 162 unmodified lines | |||
| 2473 | .driver = { | 2439 | .driver = { |
| 2474 | .name = "i2c-mlxbf", | 2440 | .name = "i2c-mlxbf", |
| 2475 | .of_match_table = mlxbf_i2c_dt_ids, | 2441 | .of_match_table = mlxbf_i2c_dt_ids, |
| 2442 | #ifdef CONFIG_ACPI | ||
| 2476 | .acpi_match_table = ACPI_PTR(mlxbf_i2c_acpi_ids), | 2443 | .acpi_match_table = ACPI_PTR(mlxbf_i2c_acpi_ids), |
| 2444 | #endif /* CONFIG_ACPI */ | ||
| 2477 | }, | 2445 | }, |
| 2478 | }; | 2446 | }; |
| 2479 | 2447 | ||
| @@ -2502,5 +2470,5 @@ static void __exit mlxbf_i2c_exit(void) · 22 unmodified lines | |||
| 2502 | module_exit(mlxbf_i2c_exit); | 2470 | module_exit(mlxbf_i2c_exit); |
| 2503 | 2471 | ||
| 2504 | MODULE_DESCRIPTION("Mellanox BlueField I2C bus driver"); | 2472 | MODULE_DESCRIPTION("Mellanox BlueField I2C bus driver"); |
| 2505 | MODULE_AUTHOR("Khalil Blaiech <kblaiech@mellanox.com>"); | 2473 | MODULE_AUTHOR("Khalil Blaiech <kblaiech@nvidia.com>"); |
| 2506 | MODULE_LICENSE("GPL v2"); | 2474 | MODULE_LICENSE("GPL v2"); |
| @@ -475,6 +475,10 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) · 474 unmodified lines | |||
| 475 | { | 475 | { |
| 476 | u16 control_reg; | 476 | u16 control_reg; |
| 477 | 477 | ||
| 478 | writel(I2C_DMA_HARD_RST, i2c->pdmabase + OFFSET_RST); | ||
| 479 | udelay(50); | ||
| 480 | writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST); | ||
| 481 | |||
| 478 | mtk_i2c_writew(i2c, I2C_SOFT_RST, OFFSET_SOFTRESET); | 482 | mtk_i2c_writew(i2c, I2C_SOFT_RST, OFFSET_SOFTRESET); |
| 479 | 483 | ||
| 480 | /* Set ioconfig */ | 484 | /* Set ioconfig */ |
| @@ -529,10 +533,6 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) · 48 unmodified lines | |||
| 529 | 533 | ||
| 530 | mtk_i2c_writew(i2c, control_reg, OFFSET_CONTROL); | 534 | mtk_i2c_writew(i2c, control_reg, OFFSET_CONTROL); |
| 531 | mtk_i2c_writew(i2c, I2C_DELAY_LEN, OFFSET_DELAY_LEN); | 535 | mtk_i2c_writew(i2c, I2C_DELAY_LEN, OFFSET_DELAY_LEN); |
| 532 | |||
| 533 | writel(I2C_DMA_HARD_RST, i2c->pdmabase + OFFSET_RST); | ||
| 534 | udelay(50); | ||
| 535 | writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST); | ||
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | static const struct i2c_spec_values *mtk_i2c_get_spec(unsigned int speed) | 538 | static const struct i2c_spec_values *mtk_i2c_get_spec(unsigned int speed) |
| @@ -129,6 +129,7 @@ struct sh_mobile_i2c_data { · 128 unmodified lines | |||
| 129 | int sr; | 129 | int sr; |
| 130 | bool send_stop; | 130 | bool send_stop; |
| 131 | bool stop_after_dma; | 131 | bool stop_after_dma; |
| 132 | bool atomic_xfer; | ||
| 132 | 133 | ||
| 133 | struct resource *res; | 134 | struct resource *res; |
| 134 | struct dma_chan *dma_tx; | 135 | struct dma_chan *dma_tx; |
| @@ -330,13 +331,15 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, enum sh_mobile_i2c_op · 195 unmodified lines | |||
| 330 | ret = iic_rd(pd, ICDR); | 331 | ret = iic_rd(pd, ICDR); |
| 331 | break; | 332 | break; |
| 332 | case OP_RX_STOP: /* enable DTE interrupt, issue stop */ | 333 | case OP_RX_STOP: /* enable DTE interrupt, issue stop */ |
| 333 | iic_wr(pd, ICIC, | 334 | if (!pd->atomic_xfer) |
| 334 | ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); | 335 | iic_wr(pd, ICIC, |
| 336 | ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); | ||
| 335 | iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK); | 337 | iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK); |
| 336 | break; | 338 | break; |
| 337 | case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */ | 339 | case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */ |
| 338 | iic_wr(pd, ICIC, | 340 | if (!pd->atomic_xfer) |
| 339 | ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); | 341 | iic_wr(pd, ICIC, |
| 342 | ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); | ||
| 340 | ret = iic_rd(pd, ICDR); | 343 | ret = iic_rd(pd, ICDR); |
| 341 | iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK); | 344 | iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK); |
| 342 | break; | 345 | break; |
| @@ -429,7 +432,8 @@ static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id) · 86 unmodified lines | |||
| 429 | 432 | ||
| 430 | if (wakeup) { | 433 | if (wakeup) { |
| 431 | pd->sr |= SW_DONE; | 434 | pd->sr |= SW_DONE; |
| 432 | wake_up(&pd->wait); | 435 | if (!pd->atomic_xfer) |
| 436 | wake_up(&pd->wait); | ||
| 433 | } | 437 | } |
| 434 | 438 | ||
| 435 | /* defeat write posting to avoid spurious WAIT interrupts */ | 439 | /* defeat write posting to avoid spurious WAIT interrupts */ |
| @@ -581,6 +585,9 @@ static void start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg, · 145 unmodified lines | |||
| 581 | pd->pos = -1; | 585 | pd->pos = -1; |
| 582 | pd->sr = 0; | 586 | pd->sr = 0; |
| 583 | 587 | ||
| 588 | if (pd->atomic_xfer) | ||
| 589 | return; | ||
| 590 | |||
| 584 | pd->dma_buf = i2c_get_dma_safe_msg_buf(pd->msg, 8); | 591 | pd->dma_buf = i2c_get_dma_safe_msg_buf(pd->msg, 8); |
| 585 | if (pd->dma_buf) | 592 | if (pd->dma_buf) |
| 586 | sh_mobile_i2c_xfer_dma(pd); | 593 | sh_mobile_i2c_xfer_dma(pd); |
| @@ -637,15 +644,13 @@ static int poll_busy(struct sh_mobile_i2c_data *pd) · 50 unmodified lines | |||
| 637 | return i ? 0 : -ETIMEDOUT; | 644 | return i ? 0 : -ETIMEDOUT; |
| 638 | } | 645 | } |
| 639 | 646 | ||
| 640 | static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, | 647 | static int sh_mobile_xfer(struct sh_mobile_i2c_data *pd, |
| 641 | struct i2c_msg *msgs, | 648 | struct i2c_msg *msgs, int num) |
| 642 | int num) | ||
| 643 | { | 649 | { |
| 644 | struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter); | ||
| 645 | struct i2c_msg *msg; | 650 | struct i2c_msg *msg; |
| 646 | int err = 0; | 651 | int err = 0; |
| 647 | int i; | 652 | int i; |
| 648 | long timeout; | 653 | long time_left; |
| 649 | 654 | ||
| 650 | /* Wake up device and enable clock */ | 655 | /* Wake up device and enable clock */ |
| 651 | pm_runtime_get_sync(pd->dev); | 656 | pm_runtime_get_sync(pd->dev); |
| @@ -662,15 +667,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, · 10 unmodified lines | |||
| 662 | if (do_start) | 667 | if (do_start) |
| 663 | i2c_op(pd, OP_START); | 668 | i2c_op(pd, OP_START); |
| 664 | 669 | ||
| 665 | /* The interrupt handler takes care of the rest... */ | 670 | if (pd->atomic_xfer) { |
| 666 | timeout = wait_event_timeout(pd->wait, | 671 | unsigned long j = jiffies + pd->adap.timeout; |
| 667 | pd->sr & (ICSR_TACK | SW_DONE), | 672 | |
| 668 | adapter->timeout); | 673 | time_left = time_before_eq(jiffies, j); |
| 669 | 674 | while (time_left && | |
| 670 | /* 'stop_after_dma' tells if DMA transfer was complete */ | 675 | !(pd->sr & (ICSR_TACK | SW_DONE))) { |
| 671 | i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg, pd->stop_after_dma); | 676 | unsigned char sr = iic_rd(pd, ICSR); |
| 677 | |||
| 678 | if (sr & (ICSR_AL | ICSR_TACK | | ||
| 679 | ICSR_WAIT | ICSR_DTE)) { | ||
| 680 | sh_mobile_i2c_isr(0, pd); | ||
| 681 | udelay(150); | ||
| 682 | } else { | ||
| 683 | cpu_relax(); | ||
| 684 | } | ||
| 685 | time_left = time_before_eq(jiffies, j); | ||
| 686 | } | ||
| 687 | } else { | ||
| 688 | /* The interrupt handler takes care of the rest... */ | ||
| 689 | time_left = wait_event_timeout(pd->wait, | ||
| 690 | pd->sr & (ICSR_TACK | SW_DONE), | ||
| 691 | pd->adap.timeout); | ||
| 692 | |||
| 693 | /* 'stop_after_dma' tells if DMA xfer was complete */ | ||
| 694 | i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg, | ||
| 695 | pd->stop_after_dma); | ||
| 696 | } | ||
| 672 | 697 | ||
| 673 | if (!timeout) { | 698 | if (!time_left) { |
| 674 | dev_err(pd->dev, "Transfer request timed out\n"); | 699 | dev_err(pd->dev, "Transfer request timed out\n"); |
| 675 | if (pd->dma_direction != DMA_NONE) | 700 | if (pd->dma_direction != DMA_NONE) |
| 676 | sh_mobile_i2c_cleanup_dma(pd); | 701 | sh_mobile_i2c_cleanup_dma(pd); |
| @@ -696,14 +721,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, · 19 unmodified lines | |||
| 696 | return err ?: num; | 721 | return err ?: num; |
| 697 | } | 722 | } |
| 698 | 723 | ||
| 724 | static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, | ||
| 725 | struct i2c_msg *msgs, | ||
| 726 | int num) | ||
| 727 | { | ||
| 728 | struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter); | ||
| 729 | |||
| 730 | pd->atomic_xfer = false; | ||
| 731 | return sh_mobile_xfer(pd, msgs, num); | ||
| 732 | } | ||
| 733 | |||
| 734 | static int sh_mobile_i2c_xfer_atomic(struct i2c_adapter *adapter, | ||
| 735 | struct i2c_msg *msgs, | ||
| 736 | int num) | ||
| 737 | { | ||
| 738 | struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter); | ||
| 739 | |||
| 740 | pd->atomic_xfer = true; | ||
| 741 | return sh_mobile_xfer(pd, msgs, num); | ||
| 742 | } | ||
| 743 | |||
| 699 | static u32 sh_mobile_i2c_func(struct i2c_adapter *adapter) | 744 | static u32 sh_mobile_i2c_func(struct i2c_adapter *adapter) |
| 700 | { | 745 | { |
| 701 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; | 746 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; |
| 702 | } | 747 | } |
| 703 | 748 | ||
| 704 | static const struct i2c_algorithm sh_mobile_i2c_algorithm = { | 749 | static const struct i2c_algorithm sh_mobile_i2c_algorithm = { |
| 705 | .functionality = sh_mobile_i2c_func, | 750 | .functionality = sh_mobile_i2c_func, |
| 706 | .master_xfer = sh_mobile_i2c_xfer, | 751 | .master_xfer = sh_mobile_i2c_xfer, |
| 752 | .master_xfer_atomic = sh_mobile_i2c_xfer_atomic, | ||
| 707 | }; | 753 | }; |
| 708 | 754 | ||
| 709 | static const struct i2c_adapter_quirks sh_mobile_i2c_quirks = { | 755 | static const struct i2c_adapter_quirks sh_mobile_i2c_quirks = { |
| @@ -176,7 +176,7 @@ struct pvrdma_port_attr { · 175 unmodified lines | |||
| 176 | u8 subnet_timeout; | 176 | u8 subnet_timeout; |
| 177 | u8 init_type_reply; | 177 | u8 init_type_reply; |
| 178 | u8 active_width; | 178 | u8 active_width; |
| 179 | u16 active_speed; | 179 | u8 active_speed; |
| 180 | u8 phys_state; | 180 | u8 phys_state; |
| 181 | u8 reserved[2]; | 181 | u8 reserved[2]; |
| 182 | }; | 182 | }; |
| @@ -524,6 +524,7 @@ static noinline int check_support(struct rvt_dev_info *rdi, int verb) · 523 unmodified lines | |||
| 524 | int rvt_register_device(struct rvt_dev_info *rdi) | 524 | int rvt_register_device(struct rvt_dev_info *rdi) |
| 525 | { | 525 | { |
| 526 | int ret = 0, i; | 526 | int ret = 0, i; |
| 527 | u64 dma_mask; | ||
| 527 | 528 | ||
| 528 | if (!rdi) | 529 | if (!rdi) |
| 529 | return -EINVAL; | 530 | return -EINVAL; |
| @@ -580,8 +581,10 @@ int rvt_register_device(struct rvt_dev_info *rdi) · 50 unmodified lines | |||
| 580 | 581 | ||
| 581 | /* DMA Operations */ | 582 | /* DMA Operations */ |
| 582 | rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms; | 583 | rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms; |
| 583 | dma_set_coherent_mask(&rdi->ibdev.dev, | 584 | dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32); |
| 584 | rdi->ibdev.dev.parent->coherent_dma_mask); | 585 | ret = dma_coerce_mask_and_coherent(&rdi->ibdev.dev, dma_mask); |
| 586 | if (ret) | ||
| 587 | goto bail_wss; | ||
| 585 | 588 | ||
| 586 | /* Protection Domain */ | 589 | /* Protection Domain */ |
| 587 | spin_lock_init(&rdi->n_pds_lock); | 590 | spin_lock_init(&rdi->n_pds_lock); |
| @@ -1118,6 +1118,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) · 1117 unmodified lines | |||
| 1118 | int err; | 1118 | int err; |
| 1119 | struct ib_device *dev = &rxe->ib_dev; | 1119 | struct ib_device *dev = &rxe->ib_dev; |
| 1120 | struct crypto_shash *tfm; | 1120 | struct crypto_shash *tfm; |
| 1121 | u64 dma_mask; | ||
| 1121 | 1122 | ||
| 1122 | strlcpy(dev->node_desc, "rxe", sizeof(dev->node_desc)); | 1123 | strlcpy(dev->node_desc, "rxe", sizeof(dev->node_desc)); |
| 1123 | 1124 | ||
| @@ -1130,7 +1131,10 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) · 6 unmodified lines | |||
| 1130 | rxe->ndev->dev_addr); | 1131 | rxe->ndev->dev_addr); |
| 1131 | dev->dev.dma_parms = &rxe->dma_parms; | 1132 | dev->dev.dma_parms = &rxe->dma_parms; |
| 1132 | dma_set_max_seg_size(&dev->dev, UINT_MAX); | 1133 | dma_set_max_seg_size(&dev->dev, UINT_MAX); |
| 1133 | dma_set_coherent_mask(&dev->dev, dma_get_required_mask(&dev->dev)); | 1134 | dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32); |
| 1135 | err = dma_coerce_mask_and_coherent(&dev->dev, dma_mask); | ||
| 1136 | if (err) | ||
| 1137 | return err; | ||
| 1134 | 1138 | ||
| 1135 | dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT) | 1139 | dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT) |
| 1136 | | BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) | 1140 | | BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
| @@ -306,6 +306,7 @@ static struct siw_device *siw_device_create(struct net_device *netdev) · 305 unmodified lines | |||
| 306 | struct siw_device *sdev = NULL; | 306 | struct siw_device *sdev = NULL; |
| 307 | struct ib_device *base_dev; | 307 | struct ib_device *base_dev; |
| 308 | struct device *parent = netdev->dev.parent; | 308 | struct device *parent = netdev->dev.parent; |
| 309 | u64 dma_mask; | ||
| 309 | int rv; | 310 | int rv; |
| 310 | 311 | ||
| 311 | if (!parent) { | 312 | if (!parent) { |
| @@ -384,8 +385,10 @@ static struct siw_device *siw_device_create(struct net_device *netdev) · 72 unmodified lines | |||
| 384 | base_dev->dev.parent = parent; | 385 | base_dev->dev.parent = parent; |
| 385 | base_dev->dev.dma_parms = &sdev->dma_parms; | 386 | base_dev->dev.dma_parms = &sdev->dma_parms; |
| 386 | dma_set_max_seg_size(&base_dev->dev, UINT_MAX); | 387 | dma_set_max_seg_size(&base_dev->dev, UINT_MAX); |
| 387 | dma_set_coherent_mask(&base_dev->dev, | 388 | dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32); |
| 388 | dma_get_required_mask(&base_dev->dev)); | 389 | if (dma_coerce_mask_and_coherent(&base_dev->dev, dma_mask)) |
| 390 | goto error; | ||
| 391 | |||
| 389 | base_dev->num_comp_vectors = num_possible_cpus(); | 392 | base_dev->num_comp_vectors = num_possible_cpus(); |
| 390 | 393 | ||
| 391 | xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1); | 394 | xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1); |
| @@ -622,10 +622,11 @@ static int srpt_refresh_port(struct srpt_port *sport) · 621 unmodified lines | |||
| 622 | /** | 622 | /** |
| 623 | * srpt_unregister_mad_agent - unregister MAD callback functions | 623 | * srpt_unregister_mad_agent - unregister MAD callback functions |
| 624 | * @sdev: SRPT HCA pointer. | 624 | * @sdev: SRPT HCA pointer. |
| 625 | * @port_cnt: number of ports with registered MAD | ||
| 625 | * | 626 | * |
| 626 | * Note: It is safe to call this function more than once for the same device. | 627 | * Note: It is safe to call this function more than once for the same device. |
| 627 | */ | 628 | */ |
| 628 | static void srpt_unregister_mad_agent(struct srpt_device *sdev) | 629 | static void srpt_unregister_mad_agent(struct srpt_device *sdev, int port_cnt) |
| 629 | { | 630 | { |
| 630 | struct ib_port_modify port_modify = { | 631 | struct ib_port_modify port_modify = { |
| 631 | .clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP, | 632 | .clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP, |
| @@ -633,7 +634,7 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev) · 1 unmodified line | |||
| 633 | struct srpt_port *sport; | 634 | struct srpt_port *sport; |
| 634 | int i; | 635 | int i; |
| 635 | 636 | ||
| 636 | for (i = 1; i <= sdev->device->phys_port_cnt; i++) { | 637 | for (i = 1; i <= port_cnt; i++) { |
| 637 | sport = &sdev->port[i - 1]; | 638 | sport = &sdev->port[i - 1]; |
| 638 | WARN_ON(sport->port != i); | 639 | WARN_ON(sport->port != i); |
| 639 | if (sport->mad_agent) { | 640 | if (sport->mad_agent) { |
| @@ -3185,7 +3186,8 @@ static int srpt_add_one(struct ib_device *device) · 2545 unmodified lines | |||
| 3185 | if (ret) { | 3186 | if (ret) { |
| 3186 | pr_err("MAD registration failed for %s-%d.\n", | 3187 | pr_err("MAD registration failed for %s-%d.\n", |
| 3187 | dev_name(&sdev->device->dev), i); | 3188 | dev_name(&sdev->device->dev), i); |
| 3188 | goto err_event; | 3189 | i--; |
| 3190 | goto err_port; | ||
| 3189 | } | 3191 | } |
| 3190 | } | 3192 | } |
| 3191 | 3193 | ||
| @@ -3197,7 +3199,8 @@ static int srpt_add_one(struct ib_device *device) · 5 unmodified lines | |||
| 3197 | pr_debug("added %s.\n", dev_name(&device->dev)); | 3199 | pr_debug("added %s.\n", dev_name(&device->dev)); |
| 3198 | return 0; | 3200 | return 0; |
| 3199 | 3201 | ||
| 3200 | err_event: | 3202 | err_port: |
| 3203 | srpt_unregister_mad_agent(sdev, i); | ||
| 3201 | ib_unregister_event_handler(&sdev->event_handler); | 3204 | ib_unregister_event_handler(&sdev->event_handler); |
| 3202 | err_cm: | 3205 | err_cm: |
| 3203 | if (sdev->cm_id) | 3206 | if (sdev->cm_id) |
| @@ -3221,7 +3224,7 @@ static void srpt_remove_one(struct ib_device *device, void *client_data) · 17 unmodified lines | |||
| 3221 | struct srpt_device *sdev = client_data; | 3224 | struct srpt_device *sdev = client_data; |
| 3222 | int i; | 3225 | int i; |
| 3223 | 3226 | ||
| 3224 | srpt_unregister_mad_agent(sdev); | 3227 | srpt_unregister_mad_agent(sdev, sdev->device->phys_port_cnt); |
| 3225 | 3228 | ||
| 3226 | ib_unregister_event_handler(&sdev->event_handler); | 3229 | ib_unregister_event_handler(&sdev->event_handler); |
| 3227 | 3230 | ||
| @@ -256,6 +256,7 @@ enum rdma_ch_state { · 255 unmodified lines | |||
| 256 | * @rdma_cm: See below. | 256 | * @rdma_cm: See below. |
| 257 | * @rdma_cm.cm_id: RDMA CM ID associated with the channel. | 257 | * @rdma_cm.cm_id: RDMA CM ID associated with the channel. |
| 258 | * @cq: IB completion queue for this channel. | 258 | * @cq: IB completion queue for this channel. |
| 259 | * @cq_size: Number of CQEs in @cq. | ||
| 259 | * @zw_cqe: Zero-length write CQE. | 260 | * @zw_cqe: Zero-length write CQE. |
| 260 | * @rcu: RCU head. | 261 | * @rcu: RCU head. |
| 261 | * @kref: kref for this channel. | 262 | * @kref: kref for this channel. |
| @@ -409,7 +409,11 @@ extern bool amd_iommu_np_cache; · 408 unmodified lines | |||
| 409 | /* Only true if all IOMMUs support device IOTLBs */ | 409 | /* Only true if all IOMMUs support device IOTLBs */ |
| 410 | extern bool amd_iommu_iotlb_sup; | 410 | extern bool amd_iommu_iotlb_sup; |
| 411 | 411 | ||
| 412 | #define MAX_IRQS_PER_TABLE 256 | 412 | /* |
| 413 | * AMD IOMMU hardware only support 512 IRTEs despite | ||
| 414 | * the architectural limitation of 2048 entries. | ||
| 415 | */ | ||
| 416 | #define MAX_IRQS_PER_TABLE 512 | ||
| 413 | #define IRQ_TABLE_ALIGNMENT 128 | 417 | #define IRQ_TABLE_ALIGNMENT 128 |
| 414 | 418 | ||
| 415 | struct irq_remap_table { | 419 | struct irq_remap_table { |
| @@ -2525,6 +2525,9 @@ struct dmar_domain *find_domain(struct device *dev) · 2524 unmodified lines | |||
| 2525 | { | 2525 | { |
| 2526 | struct device_domain_info *info; | 2526 | struct device_domain_info *info; |
| 2527 | 2527 | ||
| 2528 | if (unlikely(!dev || !dev->iommu)) | ||
| 2529 | return NULL; | ||
| 2530 | |||
| 2528 | if (unlikely(attach_deferred(dev))) | 2531 | if (unlikely(attach_deferred(dev))) |
| 2529 | return NULL; | 2532 | return NULL; |
| 2530 | 2533 | ||
| @@ -279,6 +279,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, · 278 unmodified lines | |||
| 279 | struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL); | 279 | struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL); |
| 280 | struct intel_svm_dev *sdev = NULL; | 280 | struct intel_svm_dev *sdev = NULL; |
| 281 | struct dmar_domain *dmar_domain; | 281 | struct dmar_domain *dmar_domain; |
| 282 | struct device_domain_info *info; | ||
| 282 | struct intel_svm *svm = NULL; | 283 | struct intel_svm *svm = NULL; |
| 283 | int ret = 0; | 284 | int ret = 0; |
| 284 | 285 | ||
| @@ -310,6 +311,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, · 25 unmodified lines | |||
| 310 | if (data->hpasid <= 0 || data->hpasid >= PASID_MAX) | 311 | if (data->hpasid <= 0 || data->hpasid >= PASID_MAX) |
| 311 | return -EINVAL; | 312 | return -EINVAL; |
| 312 | 313 | ||
| 314 | info = get_domain_info(dev); | ||
| 315 | if (!info) | ||
| 316 | return -EINVAL; | ||
| 317 | |||
| 313 | dmar_domain = to_dmar_domain(domain); | 318 | dmar_domain = to_dmar_domain(domain); |
| 314 | 319 | ||
| 315 | mutex_lock(&pasid_mutex); | 320 | mutex_lock(&pasid_mutex); |
| @@ -357,6 +362,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, · 41 unmodified lines | |||
| 357 | goto out; | 362 | goto out; |
| 358 | } | 363 | } |
| 359 | sdev->dev = dev; | 364 | sdev->dev = dev; |
| 365 | sdev->sid = PCI_DEVID(info->bus, info->devfn); | ||
| 360 | 366 | ||
| 361 | /* Only count users if device has aux domains */ | 367 | /* Only count users if device has aux domains */ |
| 362 | if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX)) | 368 | if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX)) |
| @@ -1029,7 +1035,7 @@ no_pasid: · 666 unmodified lines | |||
| 1029 | resp.qw0 = QI_PGRP_PASID(req->pasid) | | 1035 | resp.qw0 = QI_PGRP_PASID(req->pasid) | |
| 1030 | QI_PGRP_DID(req->rid) | | 1036 | QI_PGRP_DID(req->rid) | |
| 1031 | QI_PGRP_PASID_P(req->pasid_present) | | 1037 | QI_PGRP_PASID_P(req->pasid_present) | |
| 1032 | QI_PGRP_PDP(req->pasid_present) | | 1038 | QI_PGRP_PDP(req->priv_data_present) | |
| 1033 | QI_PGRP_RESP_CODE(result) | | 1039 | QI_PGRP_RESP_CODE(result) | |
| 1034 | QI_PGRP_RESP_TYPE; | 1040 | QI_PGRP_RESP_TYPE; |
| 1035 | resp.qw1 = QI_PGRP_IDX(req->prg_index) | | 1041 | resp.qw1 = QI_PGRP_IDX(req->prg_index) | |
| @@ -2071,7 +2071,7 @@ EXPORT_SYMBOL_GPL(iommu_uapi_cache_invalidate); · 2070 unmodified lines | |||
| 2071 | 2071 | ||
| 2072 | static int iommu_check_bind_data(struct iommu_gpasid_bind_data *data) | 2072 | static int iommu_check_bind_data(struct iommu_gpasid_bind_data *data) |
| 2073 | { | 2073 | { |
| 2074 | u32 mask; | 2074 | u64 mask; |
| 2075 | int i; | 2075 | int i; |
| 2076 | 2076 | ||
| 2077 | if (data->version != IOMMU_GPASID_BIND_VERSION_1) | 2077 | if (data->version != IOMMU_GPASID_BIND_VERSION_1) |
| @@ -180,7 +180,6 @@ config IRQ_MIPS_CPU · 179 unmodified lines | |||
| 180 | select GENERIC_IRQ_CHIP | 180 | select GENERIC_IRQ_CHIP |
| 181 | select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING | 181 | select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING |
| 182 | select IRQ_DOMAIN | 182 | select IRQ_DOMAIN |
| 183 | select IRQ_DOMAIN_HIERARCHY if GENERIC_IRQ_IPI | ||
| 184 | select GENERIC_IRQ_EFFECTIVE_AFF_MASK | 183 | select GENERIC_IRQ_EFFECTIVE_AFF_MASK |
| 185 | 184 | ||
| 186 | config CLPS711X_IRQCHIP | 185 | config CLPS711X_IRQCHIP |
| @@ -315,7 +314,6 @@ config KEYSTONE_IRQ · 128 unmodified lines | |||
| 315 | config MIPS_GIC | 314 | config MIPS_GIC |
| 316 | bool | 315 | bool |
| 317 | select GENERIC_IRQ_IPI | 316 | select GENERIC_IRQ_IPI |
| 318 | select IRQ_DOMAIN_HIERARCHY | ||
| 319 | select MIPS_CM | 317 | select MIPS_CM |
| 320 | 318 | ||
| 321 | config INGENIC_IRQ | 319 | config INGENIC_IRQ |
| @@ -591,6 +589,7 @@ config LOONGSON_PCH_MSI · 269 unmodified lines | |||
| 591 | 589 | ||
| 592 | config MST_IRQ | 590 | config MST_IRQ |
| 593 | bool "MStar Interrupt Controller" | 591 | bool "MStar Interrupt Controller" |
| 592 | depends on ARCH_MEDIATEK || ARCH_MSTARV7 || COMPILE_TEST | ||
| 594 | default ARCH_MEDIATEK | 593 | default ARCH_MEDIATEK |
| 595 | select IRQ_DOMAIN | 594 | select IRQ_DOMAIN |
| 596 | select IRQ_DOMAIN_HIERARCHY | 595 | select IRQ_DOMAIN_HIERARCHY |
| @@ -244,7 +244,7 @@ static int bcm2836_cpu_dying(unsigned int cpu) · 243 unmodified lines | |||
| 244 | 244 | ||
| 245 | #define BITS_PER_MBOX 32 | 245 | #define BITS_PER_MBOX 32 |
| 246 | 246 | ||
| 247 | static void bcm2836_arm_irqchip_smp_init(void) | 247 | static void __init bcm2836_arm_irqchip_smp_init(void) |
| 248 | { | 248 | { |
| 249 | struct irq_fwspec ipi_fwspec = { | 249 | struct irq_fwspec ipi_fwspec = { |
| 250 | .fwnode = intc.domain->fwnode, | 250 | .fwnode = intc.domain->fwnode, |
| @@ -154,8 +154,8 @@ static const struct irq_domain_ops mst_intc_domain_ops = { · 153 unmodified lines | |||
| 154 | .free = irq_domain_free_irqs_common, | 154 | .free = irq_domain_free_irqs_common, |
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | int __init | 157 | static int __init mst_intc_of_init(struct device_node *dn, |
| 158 | mst_intc_of_init(struct device_node *dn, struct device_node *parent) | 158 | struct device_node *parent) |
| 159 | { | 159 | { |
| 160 | struct irq_domain *domain, *domain_parent; | 160 | struct irq_domain *domain, *domain_parent; |
| 161 | struct mst_intc_chip_data *cd; | 161 | struct mst_intc_chip_data *cd; |
| @@ -71,8 +71,7 @@ struct intc_irqpin_priv { · 70 unmodified lines | |||
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | struct intc_irqpin_config { | 73 | struct intc_irqpin_config { |
| 74 | unsigned int irlm_bit; | 74 | int irlm_bit; /* -1 if non-existent */ |
| 75 | unsigned needs_irlm:1; | ||
| 76 | }; | 75 | }; |
| 77 | 76 | ||
| 78 | static unsigned long intc_irqpin_read32(void __iomem *iomem) | 77 | static unsigned long intc_irqpin_read32(void __iomem *iomem) |
| @@ -349,11 +348,10 @@ static const struct irq_domain_ops intc_irqpin_irq_domain_ops = { · 270 unmodified lines | |||
| 349 | 348 | ||
| 350 | static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = { | 349 | static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = { |
| 351 | .irlm_bit = 23, /* ICR0.IRLM0 */ | 350 | .irlm_bit = 23, /* ICR0.IRLM0 */ |
| 352 | .needs_irlm = 1, | ||
| 353 | }; | 351 | }; |
| 354 | 352 | ||
| 355 | static const struct intc_irqpin_config intc_irqpin_rmobile = { | 353 | static const struct intc_irqpin_config intc_irqpin_rmobile = { |
| 356 | .needs_irlm = 0, | 354 | .irlm_bit = -1, |
| 357 | }; | 355 | }; |
| 358 | 356 | ||
| 359 | static const struct of_device_id intc_irqpin_dt_ids[] = { | 357 | static const struct of_device_id intc_irqpin_dt_ids[] = { |
| @@ -470,7 +468,7 @@ static int intc_irqpin_probe(struct platform_device *pdev) · 110 unmodified lines | |||
| 470 | } | 468 | } |
| 471 | 469 | ||
| 472 | /* configure "individual IRQ mode" where needed */ | 470 | /* configure "individual IRQ mode" where needed */ |
| 473 | if (config && config->needs_irlm) { | 471 | if (config && config->irlm_bit >= 0) { |
| 474 | if (io[INTC_IRQPIN_REG_IRLM]) | 472 | if (io[INTC_IRQPIN_REG_IRLM]) |
| 475 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM, | 473 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM, |
| 476 | config->irlm_bit, 1, 1); | 474 | config->irlm_bit, 1, 1); |
| @@ -99,7 +99,7 @@ static inline void plic_irq_toggle(const struct cpumask *mask, · 98 unmodified lines | |||
| 99 | struct irq_data *d, int enable) | 99 | struct irq_data *d, int enable) |
| 100 | { | 100 | { |
| 101 | int cpu; | 101 | int cpu; |
| 102 | struct plic_priv *priv = irq_get_chip_data(d->irq); | 102 | struct plic_priv *priv = irq_data_get_irq_chip_data(d); |
| 103 | 103 | ||
| 104 | writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID); | 104 | writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID); |
| 105 | for_each_cpu(cpu, mask) { | 105 | for_each_cpu(cpu, mask) { |
| @@ -115,7 +115,7 @@ static void plic_irq_unmask(struct irq_data *d) · 9 unmodified lines | |||
| 115 | { | 115 | { |
| 116 | struct cpumask amask; | 116 | struct cpumask amask; |
| 117 | unsigned int cpu; | 117 | unsigned int cpu; |
| 118 | struct plic_priv *priv = irq_get_chip_data(d->irq); | 118 | struct plic_priv *priv = irq_data_get_irq_chip_data(d); |
| 119 | 119 | ||
| 120 | cpumask_and(&amask, &priv->lmask, cpu_online_mask); | 120 | cpumask_and(&amask, &priv->lmask, cpu_online_mask); |
| 121 | cpu = cpumask_any_and(irq_data_get_affinity_mask(d), | 121 | cpu = cpumask_any_and(irq_data_get_affinity_mask(d), |
| @@ -127,7 +127,7 @@ static void plic_irq_unmask(struct irq_data *d) · 5 unmodified lines | |||
| 127 | 127 | ||
| 128 | static void plic_irq_mask(struct irq_data *d) | 128 | static void plic_irq_mask(struct irq_data *d) |
| 129 | { | 129 | { |
| 130 | struct plic_priv *priv = irq_get_chip_data(d->irq); | 130 | struct plic_priv *priv = irq_data_get_irq_chip_data(d); |
| 131 | 131 | ||
| 132 | plic_irq_toggle(&priv->lmask, d, 0); | 132 | plic_irq_toggle(&priv->lmask, d, 0); |
| 133 | } | 133 | } |
| @@ -138,7 +138,7 @@ static int plic_set_affinity(struct irq_data *d, · 4 unmodified lines | |||
| 138 | { | 138 | { |
| 139 | unsigned int cpu; | 139 | unsigned int cpu; |
| 140 | struct cpumask amask; | 140 | struct cpumask amask; |
| 141 | struct plic_priv *priv = irq_get_chip_data(d->irq); | 141 | struct plic_priv *priv = irq_data_get_irq_chip_data(d); |
| 142 | 142 | ||
| 143 | cpumask_and(&amask, &priv->lmask, mask_val); | 143 | cpumask_and(&amask, &priv->lmask, mask_val); |
| 144 | 144 | ||
| @@ -151,7 +151,7 @@ static int plic_set_affinity(struct irq_data *d, · 6 unmodified lines | |||
| 151 | return -EINVAL; | 151 | return -EINVAL; |
| 152 | 152 | ||
| 153 | plic_irq_toggle(&priv->lmask, d, 0); | 153 | plic_irq_toggle(&priv->lmask, d, 0); |
| 154 | plic_irq_toggle(cpumask_of(cpu), d, 1); | 154 | plic_irq_toggle(cpumask_of(cpu), d, !irqd_irq_masked(d)); |
| 155 | 155 | ||
| 156 | irq_data_update_effective_affinity(d, cpumask_of(cpu)); | 156 | irq_data_update_effective_affinity(d, cpumask_of(cpu)); |
| 157 | 157 | ||
| @@ -195,6 +195,10 @@ static const struct stm32_desc_irq stm32mp1_desc_irq[] = { · 194 unmodified lines | |||
| 195 | { .exti = 25, .irq_parent = 107, .chip = &stm32_exti_h_chip_direct }, | 195 | { .exti = 25, .irq_parent = 107, .chip = &stm32_exti_h_chip_direct }, |
| 196 | { .exti = 30, .irq_parent = 52, .chip = &stm32_exti_h_chip_direct }, | 196 | { .exti = 30, .irq_parent = 52, .chip = &stm32_exti_h_chip_direct }, |
| 197 | { .exti = 47, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct }, | 197 | { .exti = 47, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct }, |
| 198 | { .exti = 48, .irq_parent = 138, .chip = &stm32_exti_h_chip_direct }, | ||
| 199 | { .exti = 50, .irq_parent = 139, .chip = &stm32_exti_h_chip_direct }, | ||
| 200 | { .exti = 52, .irq_parent = 140, .chip = &stm32_exti_h_chip_direct }, | ||
| 201 | { .exti = 53, .irq_parent = 141, .chip = &stm32_exti_h_chip_direct }, | ||
| 198 | { .exti = 54, .irq_parent = 135, .chip = &stm32_exti_h_chip_direct }, | 202 | { .exti = 54, .irq_parent = 135, .chip = &stm32_exti_h_chip_direct }, |
| 199 | { .exti = 61, .irq_parent = 100, .chip = &stm32_exti_h_chip_direct }, | 203 | { .exti = 61, .irq_parent = 100, .chip = &stm32_exti_h_chip_direct }, |
| 200 | { .exti = 65, .irq_parent = 144, .chip = &stm32_exti_h_chip }, | 204 | { .exti = 65, .irq_parent = 144, .chip = &stm32_exti_h_chip }, |
| @@ -85,6 +85,17 @@ struct ti_sci_inta_vint_desc { · 84 unmodified lines | |||
| 85 | * @base: Base address of the memory mapped IO registers | 85 | * @base: Base address of the memory mapped IO registers |
| 86 | * @pdev: Pointer to platform device. | 86 | * @pdev: Pointer to platform device. |
| 87 | * @ti_sci_id: TI-SCI device identifier | 87 | * @ti_sci_id: TI-SCI device identifier |
| 88 | * @unmapped_cnt: Number of @unmapped_dev_ids entries | ||
| 89 | * @unmapped_dev_ids: Pointer to an array of TI-SCI device identifiers of | ||
| 90 | * unmapped event sources. | ||
| 91 | * Unmapped Events are not part of the Global Event Map and | ||
| 92 | * they are converted to Global event within INTA to be | ||
| 93 | * received by the same INTA to generate an interrupt. | ||
| 94 | * In case an interrupt request comes for a device which is | ||
| 95 | * generating Unmapped Event, we must use the INTA's TI-SCI | ||
| 96 | * device identifier in place of the source device | ||
| 97 | * identifier to let sysfw know where it has to program the | ||
| 98 | * Global Event number. | ||
| 88 | */ | 99 | */ |
| 89 | struct ti_sci_inta_irq_domain { | 100 | struct ti_sci_inta_irq_domain { |
| 90 | const struct ti_sci_handle *sci; | 101 | const struct ti_sci_handle *sci; |
| @@ -96,11 +107,37 @@ struct ti_sci_inta_irq_domain { · 5 unmodified lines | |||
| 96 | void __iomem *base; | 107 | void __iomem *base; |
| 97 | struct platform_device *pdev; | 108 | struct platform_device *pdev; |
| 98 | u32 ti_sci_id; | 109 | u32 ti_sci_id; |
| 110 | |||
| 111 | int unmapped_cnt; | ||
| 112 | u16 *unmapped_dev_ids; | ||
| 99 | }; | 113 | }; |
| 100 | 114 | ||
| 101 | #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \ | 115 | #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \ |
| 102 | events[i]) | 116 | events[i]) |
| 103 | 117 | ||
| 118 | static u16 ti_sci_inta_get_dev_id(struct ti_sci_inta_irq_domain *inta, u32 hwirq) | ||
| 119 | { | ||
| 120 | u16 dev_id = HWIRQ_TO_DEVID(hwirq); | ||
| 121 | int i; | ||
| 122 | |||
| 123 | if (inta->unmapped_cnt == 0) | ||
| 124 | return dev_id; | ||
| 125 | |||
| 126 | /* | ||
| 127 | * For devices sending Unmapped Events we must use the INTA's TI-SCI | ||
| 128 | * device identifier number to be able to convert it to a Global Event | ||
| 129 | * and map it to an interrupt. | ||
| 130 | */ | ||
| 131 | for (i = 0; i < inta->unmapped_cnt; i++) { | ||
| 132 | if (dev_id == inta->unmapped_dev_ids[i]) { | ||
| 133 | dev_id = inta->ti_sci_id; | ||
| 134 | break; | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 138 | return dev_id; | ||
| 139 | } | ||
| 140 | |||
| 104 | /** | 141 | /** |
| 105 | * ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs | 142 | * ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs |
| 106 | * @desc: Pointer to irq_desc corresponding to the irq | 143 | * @desc: Pointer to irq_desc corresponding to the irq |
| @@ -251,7 +288,7 @@ static struct ti_sci_inta_event_desc *ti_sci_inta_alloc_event(struct ti_sci_inta · 144 unmodified lines | |||
| 251 | u16 dev_id, dev_index; | 288 | u16 dev_id, dev_index; |
| 252 | int err; | 289 | int err; |
| 253 | 290 | ||
| 254 | dev_id = HWIRQ_TO_DEVID(hwirq); | 291 | dev_id = ti_sci_inta_get_dev_id(inta, hwirq); |
| 255 | dev_index = HWIRQ_TO_IRQID(hwirq); | 292 | dev_index = HWIRQ_TO_IRQID(hwirq); |
| 256 | 293 | ||
| 257 | event_desc = &vint_desc->events[free_bit]; | 294 | event_desc = &vint_desc->events[free_bit]; |
| @@ -352,14 +389,15 @@ static void ti_sci_inta_free_irq(struct ti_sci_inta_event_desc *event_desc, · 94 unmodified lines | |||
| 352 | { | 389 | { |
| 353 | struct ti_sci_inta_vint_desc *vint_desc; | 390 | struct ti_sci_inta_vint_desc *vint_desc; |
| 354 | struct ti_sci_inta_irq_domain *inta; | 391 | struct ti_sci_inta_irq_domain *inta; |
| 392 | u16 dev_id; | ||
| 355 | 393 | ||
| 356 | vint_desc = to_vint_desc(event_desc, event_desc->vint_bit); | 394 | vint_desc = to_vint_desc(event_desc, event_desc->vint_bit); |
| 357 | inta = vint_desc->domain->host_data; | 395 | inta = vint_desc->domain->host_data; |
| 396 | dev_id = ti_sci_inta_get_dev_id(inta, hwirq); | ||
| 358 | /* free event irq */ | 397 | /* free event irq */ |
| 359 | mutex_lock(&inta->vint_mutex); | 398 | mutex_lock(&inta->vint_mutex); |
| 360 | inta->sci->ops.rm_irq_ops.free_event_map(inta->sci, | 399 | inta->sci->ops.rm_irq_ops.free_event_map(inta->sci, |
| 361 | HWIRQ_TO_DEVID(hwirq), | 400 | dev_id, HWIRQ_TO_IRQID(hwirq), |
| 362 | HWIRQ_TO_IRQID(hwirq), | ||
| 363 | inta->ti_sci_id, | 401 | inta->ti_sci_id, |
| 364 | vint_desc->vint_id, | 402 | vint_desc->vint_id, |
| 365 | event_desc->global_event, | 403 | event_desc->global_event, |
| @@ -574,6 +612,41 @@ static struct msi_domain_info ti_sci_inta_msi_domain_info = { · 208 unmodified lines | |||
| 574 | .chip = &ti_sci_inta_msi_irq_chip, | 612 | .chip = &ti_sci_inta_msi_irq_chip, |
| 575 | }; | 613 | }; |
| 576 | 614 | ||
| 615 | static int ti_sci_inta_get_unmapped_sources(struct ti_sci_inta_irq_domain *inta) | ||
| 616 | { | ||
| 617 | struct device *dev = &inta->pdev->dev; | ||
| 618 | struct device_node *node = dev_of_node(dev); | ||
| 619 | struct of_phandle_iterator it; | ||
| 620 | int count, err, ret, i; | ||
| 621 | |||
| 622 | count = of_count_phandle_with_args(node, "ti,unmapped-event-sources", NULL); | ||
| 623 | if (count <= 0) | ||
| 624 | return 0; | ||
| 625 | |||
| 626 | inta->unmapped_dev_ids = devm_kcalloc(dev, count, | ||
| 627 | sizeof(*inta->unmapped_dev_ids), | ||
| 628 | GFP_KERNEL); | ||
| 629 | if (!inta->unmapped_dev_ids) | ||
| 630 | return -ENOMEM; | ||
| 631 | |||
| 632 | i = 0; | ||
| 633 | of_for_each_phandle(&it, err, node, "ti,unmapped-event-sources", NULL, 0) { | ||
| 634 | u32 dev_id; | ||
| 635 | |||
| 636 | ret = of_property_read_u32(it.node, "ti,sci-dev-id", &dev_id); | ||
| 637 | if (ret) { | ||
| 638 | dev_err(dev, "ti,sci-dev-id read failure for %pOFf\n", it.node); | ||
| 639 | of_node_put(it.node); | ||
| 640 | return ret; | ||
| 641 | } | ||
| 642 | inta->unmapped_dev_ids[i++] = dev_id; | ||
| 643 | } | ||
| 644 | |||
| 645 | inta->unmapped_cnt = count; | ||
| 646 | |||
| 647 | return 0; | ||
| 648 | } | ||
| 649 | |||
| 577 | static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) | 650 | static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) |
| 578 | { | 651 | { |
| 579 | struct irq_domain *parent_domain, *domain, *msi_domain; | 652 | struct irq_domain *parent_domain, *domain, *msi_domain; |
| @@ -629,6 +702,10 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) · 49 unmodified lines | |||
| 629 | if (IS_ERR(inta->base)) | 702 | if (IS_ERR(inta->base)) |
| 630 | return PTR_ERR(inta->base); | 703 | return PTR_ERR(inta->base); |
| 631 | 704 | ||
| 705 | ret = ti_sci_inta_get_unmapped_sources(inta); | ||
| 706 | if (ret) | ||
| 707 | return ret; | ||
| 708 | |||
| 632 | domain = irq_domain_add_linear(dev_of_node(dev), | 709 | domain = irq_domain_add_linear(dev_of_node(dev), |
| 633 | ti_sci_get_num_resources(inta->vint), | 710 | ti_sci_get_num_resources(inta->vint), |
| 634 | &ti_sci_inta_irq_domain_ops, inta); | 711 | &ti_sci_inta_irq_domain_ops, inta); |
| @@ -707,6 +707,30 @@ static int fsl_ifc_attach_chip(struct nand_chip *chip) · 706 unmodified lines | |||
| 707 | { | 707 | { |
| 708 | struct mtd_info *mtd = nand_to_mtd(chip); | 708 | struct mtd_info *mtd = nand_to_mtd(chip); |
| 709 | struct fsl_ifc_mtd *priv = nand_get_controller_data(chip); | 709 | struct fsl_ifc_mtd *priv = nand_get_controller_data(chip); |
| 710 | struct fsl_ifc_ctrl *ctrl = priv->ctrl; | ||
| 711 | struct fsl_ifc_global __iomem *ifc_global = ctrl->gregs; | ||
| 712 | u32 csor; | ||
| 713 | |||
| 714 | csor = ifc_in32(&ifc_global->csor_cs[priv->bank].csor); | ||
| 715 | |||
| 716 | /* Must also set CSOR_NAND_ECC_ENC_EN if DEC_EN set */ | ||
| 717 | if (csor & CSOR_NAND_ECC_DEC_EN) { | ||
| 718 | chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; | ||
| 719 | mtd_set_ooblayout(mtd, &fsl_ifc_ooblayout_ops); | ||
| 720 | |||
| 721 | /* Hardware generates ECC per 512 Bytes */ | ||
| 722 | chip->ecc.size = 512; | ||
| 723 | if ((csor & CSOR_NAND_ECC_MODE_MASK) == CSOR_NAND_ECC_MODE_4) { | ||
| 724 | chip->ecc.bytes = 8; | ||
| 725 | chip->ecc.strength = 4; | ||
| 726 | } else { | ||
| 727 | chip->ecc.bytes = 16; | ||
| 728 | chip->ecc.strength = 8; | ||
| 729 | } | ||
| 730 | } else { | ||
| 731 | chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; | ||
| 732 | chip->ecc.algo = NAND_ECC_ALGO_HAMMING; | ||
| 733 | } | ||
| 710 | 734 | ||
| 711 | dev_dbg(priv->dev, "%s: nand->numchips = %d\n", __func__, | 735 | dev_dbg(priv->dev, "%s: nand->numchips = %d\n", __func__, |
| 712 | nanddev_ntargets(&chip->base)); | 736 | nanddev_ntargets(&chip->base)); |
| @@ -910,25 +934,6 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv) · 197 unmodified lines | |||
| 910 | return -ENODEV; | 934 | return -ENODEV; |
| 911 | } | 935 | } |
| 912 | 936 | ||
| 913 | /* Must also set CSOR_NAND_ECC_ENC_EN if DEC_EN set */ | ||
| 914 | if (csor & CSOR_NAND_ECC_DEC_EN) { | ||
| 915 | chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; | ||
| 916 | mtd_set_ooblayout(mtd, &fsl_ifc_ooblayout_ops); | ||
| 917 | |||
| 918 | /* Hardware generates ECC per 512 Bytes */ | ||
| 919 | chip->ecc.size = 512; | ||
| 920 | if ((csor & CSOR_NAND_ECC_MODE_MASK) == CSOR_NAND_ECC_MODE_4) { | ||
| 921 | chip->ecc.bytes = 8; | ||
| 922 | chip->ecc.strength = 4; | ||
| 923 | } else { | ||
| 924 | chip->ecc.bytes = 16; | ||
| 925 | chip->ecc.strength = 8; | ||
| 926 | } | ||
| 927 | } else { | ||
| 928 | chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; | ||
| 929 | chip->ecc.algo = NAND_ECC_ALGO_HAMMING; | ||
| 930 | } | ||
| 931 | |||
| 932 | ret = fsl_ifc_sram_init(priv); | 937 | ret = fsl_ifc_sram_init(priv); |
| 933 | if (ret) | 938 | if (ret) |
| 934 | return ret; | 939 | return ret; |
| @@ -1681,6 +1681,11 @@ static int mxcnd_attach_chip(struct nand_chip *chip) · 1680 unmodified lines | |||
| 1681 | struct mxc_nand_host *host = nand_get_controller_data(chip); | 1681 | struct mxc_nand_host *host = nand_get_controller_data(chip); |
| 1682 | struct device *dev = mtd->dev.parent; | 1682 | struct device *dev = mtd->dev.parent; |
| 1683 | 1683 | ||
| 1684 | chip->ecc.bytes = host->devtype_data->eccbytes; | ||
| 1685 | host->eccsize = host->devtype_data->eccsize; | ||
| 1686 | chip->ecc.size = 512; | ||
| 1687 | mtd_set_ooblayout(mtd, host->devtype_data->ooblayout); | ||
| 1688 | |||
| 1684 | switch (chip->ecc.engine_type) { | 1689 | switch (chip->ecc.engine_type) { |
| 1685 | case NAND_ECC_ENGINE_TYPE_ON_HOST: | 1690 | case NAND_ECC_ENGINE_TYPE_ON_HOST: |
| 1686 | chip->ecc.read_page = mxc_nand_read_page; | 1691 | chip->ecc.read_page = mxc_nand_read_page; |
| @@ -1836,19 +1841,7 @@ static int mxcnd_probe(struct platform_device *pdev) · 149 unmodified lines | |||
| 1836 | if (host->devtype_data->axi_offset) | 1841 | if (host->devtype_data->axi_offset) |
| 1837 | host->regs_axi = host->base + host->devtype_data->axi_offset; | 1842 | host->regs_axi = host->base + host->devtype_data->axi_offset; |
| 1838 | 1843 | ||
| 1839 | this->ecc.bytes = host->devtype_data->eccbytes; | ||
| 1840 | host->eccsize = host->devtype_data->eccsize; | ||
| 1841 | |||
| 1842 | this->legacy.select_chip = host->devtype_data->select_chip; | 1844 | this->legacy.select_chip = host->devtype_data->select_chip; |
| 1843 | this->ecc.size = 512; | ||
| 1844 | mtd_set_ooblayout(mtd, host->devtype_data->ooblayout); | ||
| 1845 | |||
| 1846 | if (host->pdata.hw_ecc) { | ||
| 1847 | this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; | ||
| 1848 | } else { | ||
| 1849 | this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; | ||
| 1850 | this->ecc.algo = NAND_ECC_ALGO_HAMMING; | ||
| 1851 | } | ||
| 1852 | 1845 | ||
| 1853 | /* NAND bus width determines access functions used by upper layer */ | 1846 | /* NAND bus width determines access functions used by upper layer */ |
| 1854 | if (host->pdata.width == 2) | 1847 | if (host->pdata.width == 2) |
| @@ -1708,6 +1708,13 @@ static int stm32_fmc2_nfc_attach_chip(struct nand_chip *chip) · 1707 unmodified lines | |||
| 1708 | return -EINVAL; | 1708 | return -EINVAL; |
| 1709 | } | 1709 | } |
| 1710 | 1710 | ||
| 1711 | /* Default ECC settings in case they are not set in the device tree */ | ||
| 1712 | if (!chip->ecc.size) | ||
| 1713 | chip->ecc.size = FMC2_ECC_STEP_SIZE; | ||
| 1714 | |||
| 1715 | if (!chip->ecc.strength) | ||
| 1716 | chip->ecc.strength = FMC2_ECC_BCH8; | ||
| 1717 | |||
| 1711 | ret = nand_ecc_choose_conf(chip, &stm32_fmc2_nfc_ecc_caps, | 1718 | ret = nand_ecc_choose_conf(chip, &stm32_fmc2_nfc_ecc_caps, |
| 1712 | mtd->oobsize - FMC2_BBM_LEN); | 1719 | mtd->oobsize - FMC2_BBM_LEN); |
| 1713 | if (ret) { | 1720 | if (ret) { |
| @@ -1727,8 +1734,7 @@ static int stm32_fmc2_nfc_attach_chip(struct nand_chip *chip) · 13 unmodified lines | |||
| 1727 | 1734 | ||
| 1728 | mtd_set_ooblayout(mtd, &stm32_fmc2_nfc_ooblayout_ops); | 1735 | mtd_set_ooblayout(mtd, &stm32_fmc2_nfc_ooblayout_ops); |
| 1729 | 1736 | ||
| 1730 | if (chip->options & NAND_BUSWIDTH_16) | 1737 | stm32_fmc2_nfc_setup(chip); |
| 1731 | stm32_fmc2_nfc_set_buswidth_16(nfc, true); | ||
| 1732 | 1738 | ||
| 1733 | return 0; | 1739 | return 0; |
| 1734 | } | 1740 | } |
| @@ -1952,11 +1958,6 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev) · 217 unmodified lines | |||
| 1952 | chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE | | 1958 | chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE | |
| 1953 | NAND_USES_DMA; | 1959 | NAND_USES_DMA; |
| 1954 | 1960 | ||
| 1955 | /* Default ECC settings */ | ||
| 1956 | chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; | ||
| 1957 | chip->ecc.size = FMC2_ECC_STEP_SIZE; | ||
| 1958 | chip->ecc.strength = FMC2_ECC_BCH8; | ||
| 1959 | |||
| 1960 | /* Scan to find existence of the device */ | 1961 | /* Scan to find existence of the device */ |
| 1961 | ret = nand_scan(chip, nand->ncs); | 1962 | ret = nand_scan(chip, nand->ncs); |
| 1962 | if (ret) | 1963 | if (ret) |
| @@ -2701,11 +2701,10 @@ static void spi_nor_sfdp_init_params(struct spi_nor *nor) · 2700 unmodified lines | |||
| 2701 | 2701 | ||
| 2702 | memcpy(&sfdp_params, nor->params, sizeof(sfdp_params)); | 2702 | memcpy(&sfdp_params, nor->params, sizeof(sfdp_params)); |
| 2703 | 2703 | ||
| 2704 | if (spi_nor_parse_sfdp(nor, &sfdp_params)) { | 2704 | if (spi_nor_parse_sfdp(nor, nor->params)) { |
| 2705 | memcpy(nor->params, &sfdp_params, sizeof(*nor->params)); | ||
| 2705 | nor->addr_width = 0; | 2706 | nor->addr_width = 0; |
| 2706 | nor->flags &= ~SNOR_F_4B_OPCODES; | 2707 | nor->flags &= ~SNOR_F_4B_OPCODES; |
| 2707 | } else { | ||
| 2708 | memcpy(nor->params, &sfdp_params, sizeof(*nor->params)); | ||
| 2709 | } | 2708 | } |
| 2710 | } | 2709 | } |
| 2711 | 2710 | ||
| @@ -3009,13 +3008,15 @@ static int spi_nor_set_addr_width(struct spi_nor *nor) · 297 unmodified lines | |||
| 3009 | /* already configured from SFDP */ | 3008 | /* already configured from SFDP */ |
| 3010 | } else if (nor->info->addr_width) { | 3009 | } else if (nor->info->addr_width) { |
| 3011 | nor->addr_width = nor->info->addr_width; | 3010 | nor->addr_width = nor->info->addr_width; |
| 3012 | } else if (nor->mtd.size > 0x1000000) { | ||
| 3013 | /* enable 4-byte addressing if the device exceeds 16MiB */ | ||
| 3014 | nor->addr_width = 4; | ||
| 3015 | } else { | 3011 | } else { |
| 3016 | nor->addr_width = 3; | 3012 | nor->addr_width = 3; |
| 3017 | } | 3013 | } |
| 3018 | 3014 | ||
| 3015 | if (nor->addr_width == 3 && nor->mtd.size > 0x1000000) { | ||
| 3016 | /* enable 4-byte addressing if the device exceeds 16MiB */ | ||
| 3017 | nor->addr_width = 4; | ||
| 3018 | } | ||
| 3019 | |||
| 3019 | if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) { | 3020 | if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) { |
| 3020 | dev_dbg(nor->dev, "address width is too large: %u\n", | 3021 | dev_dbg(nor->dev, "address width is too large: %u\n", |
| 3021 | nor->addr_width); | 3022 | nor->addr_width); |
| @@ -512,9 +512,13 @@ __can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) · 511 unmodified lines | |||
| 512 | */ | 512 | */ |
| 513 | struct sk_buff *skb = priv->echo_skb[idx]; | 513 | struct sk_buff *skb = priv->echo_skb[idx]; |
| 514 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; | 514 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; |
| 515 | u8 len = cf->len; | ||
| 516 | 515 | ||
| 517 | *len_ptr = len; | 516 | /* get the real payload length for netdev statistics */ |
| 517 | if (cf->can_id & CAN_RTR_FLAG) | ||
| 518 | *len_ptr = 0; | ||
| 519 | else | ||
| 520 | *len_ptr = cf->len; | ||
| 521 | |||
| 518 | priv->echo_skb[idx] = NULL; | 522 | priv->echo_skb[idx] = NULL; |
| 519 | 523 | ||
| 520 | return skb; | 524 | return skb; |
| @@ -538,7 +542,11 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) · 17 unmodified lines | |||
| 538 | if (!skb) | 542 | if (!skb) |
| 539 | return 0; | 543 | return 0; |
| 540 | 544 | ||
| 541 | netif_rx(skb); | 545 | skb_get(skb); |
| 546 | if (netif_rx(skb) == NET_RX_SUCCESS) | ||
| 547 | dev_consume_skb_any(skb); | ||
| 548 | else | ||
| 549 | dev_kfree_skb_any(skb); | ||
| 542 | 550 | ||
| 543 | return len; | 551 | return len; |
| 544 | } | 552 | } |
| @@ -217,7 +217,7 @@ · 216 unmodified lines | |||
| 217 | * MX8MP FlexCAN3 03.00.17.01 yes yes no yes yes yes | 217 | * MX8MP FlexCAN3 03.00.17.01 yes yes no yes yes yes |
| 218 | * VF610 FlexCAN3 ? no yes no yes yes? no | 218 | * VF610 FlexCAN3 ? no yes no yes yes? no |
| 219 | * LS1021A FlexCAN2 03.00.04.00 no yes no no yes no | 219 | * LS1021A FlexCAN2 03.00.04.00 no yes no no yes no |
| 220 | * LX2160A FlexCAN3 03.00.23.00 no yes no no yes yes | 220 | * LX2160A FlexCAN3 03.00.23.00 no yes no yes yes yes |
| 221 | * | 221 | * |
| 222 | * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. | 222 | * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. |
| 223 | */ | 223 | */ |
| @@ -400,19 +400,19 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { · 176 unmodified lines | |||
| 400 | static const struct flexcan_devtype_data fsl_vf610_devtype_data = { | 400 | static const struct flexcan_devtype_data fsl_vf610_devtype_data = { |
| 401 | .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | | 401 | .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | |
| 402 | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | | 402 | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | |
| 403 | FLEXCAN_QUIRK_BROKEN_PERR_STATE, | 403 | FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_ECC, |
| 404 | }; | 404 | }; |
| 405 | 405 | ||
| 406 | static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { | 406 | static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { |
| 407 | .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | | 407 | .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | |
| 408 | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | | 408 | FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP, |
| 409 | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP, | ||
| 410 | }; | 409 | }; |
| 411 | 410 | ||
| 412 | static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { | 411 | static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { |
| 413 | .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | | 412 | .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | |
| 414 | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | | 413 | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | |
| 415 | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD, | 414 | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD | |
| 415 | FLEXCAN_QUIRK_SUPPORT_ECC, | ||
| 416 | }; | 416 | }; |
| 417 | 417 | ||
| 418 | static const struct can_bittiming_const flexcan_bittiming_const = { | 418 | static const struct can_bittiming_const flexcan_bittiming_const = { |
| @@ -2062,6 +2062,8 @@ static int flexcan_remove(struct platform_device *pdev) · 1643 unmodified lines | |||
| 2062 | { | 2062 | { |
| 2063 | struct net_device *dev = platform_get_drvdata(pdev); | 2063 | struct net_device *dev = platform_get_drvdata(pdev); |
| 2064 | 2064 | ||
| 2065 | device_set_wakeup_enable(&pdev->dev, false); | ||
| 2066 | device_set_wakeup_capable(&pdev->dev, false); | ||
| 2065 | unregister_flexcandev(dev); | 2067 | unregister_flexcandev(dev); |
| 2066 | pm_runtime_disable(&pdev->dev); | 2068 | pm_runtime_disable(&pdev->dev); |
| 2067 | free_candev(dev); | 2069 | free_candev(dev); |
| @@ -262,8 +262,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, · 261 unmodified lines | |||
| 262 | cf_len = get_can_dlc(pucan_msg_get_dlc(msg)); | 262 | cf_len = get_can_dlc(pucan_msg_get_dlc(msg)); |
| 263 | 263 | ||
| 264 | /* if this frame is an echo, */ | 264 | /* if this frame is an echo, */ |
| 265 | if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) && | 265 | if (rx_msg_flags & PUCAN_MSG_LOOPED_BACK) { |
| 266 | !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) { | ||
| 267 | unsigned long flags; | 266 | unsigned long flags; |
| 268 | 267 | ||
| 269 | spin_lock_irqsave(&priv->echo_lock, flags); | 268 | spin_lock_irqsave(&priv->echo_lock, flags); |
| @@ -277,7 +276,13 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, · 7 unmodified lines | |||
| 277 | netif_wake_queue(priv->ndev); | 276 | netif_wake_queue(priv->ndev); |
| 278 | 277 | ||
| 279 | spin_unlock_irqrestore(&priv->echo_lock, flags); | 278 | spin_unlock_irqrestore(&priv->echo_lock, flags); |
| 280 | return 0; | 279 | |
| 280 | /* if this frame is only an echo, stop here. Otherwise, | ||
| 281 | * continue to push this application self-received frame into | ||
| 282 | * its own rx queue. | ||
| 283 | */ | ||
| 284 | if (!(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) | ||
| 285 | return 0; | ||
| 281 | } | 286 | } |
| 282 | 287 | ||
| 283 | /* otherwise, it should be pushed into rx fifo */ | 288 | /* otherwise, it should be pushed into rx fifo */ |
| @@ -245,7 +245,7 @@ int can_rx_offload_queue_sorted(struct can_rx_offload *offload, · 244 unmodified lines | |||
| 245 | 245 | ||
| 246 | if (skb_queue_len(&offload->skb_queue) > | 246 | if (skb_queue_len(&offload->skb_queue) > |
| 247 | offload->skb_queue_len_max) { | 247 | offload->skb_queue_len_max) { |
| 248 | kfree_skb(skb); | 248 | dev_kfree_skb_any(skb); |
| 249 | return -ENOBUFS; | 249 | return -ENOBUFS; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| @@ -290,7 +290,7 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload, · 38 unmodified lines | |||
| 290 | { | 290 | { |
| 291 | if (skb_queue_len(&offload->skb_queue) > | 291 | if (skb_queue_len(&offload->skb_queue) > |
| 292 | offload->skb_queue_len_max) { | 292 | offload->skb_queue_len_max) { |
| 293 | kfree_skb(skb); | 293 | dev_kfree_skb_any(skb); |
| 294 | return -ENOBUFS; | 294 | return -ENOBUFS; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| @@ -75,11 +75,11 @@ static const char *__mcp251xfd_get_model_str(enum mcp251xfd_model model) · 74 unmodified lines | |||
| 75 | { | 75 | { |
| 76 | switch (model) { | 76 | switch (model) { |
| 77 | case MCP251XFD_MODEL_MCP2517FD: | 77 | case MCP251XFD_MODEL_MCP2517FD: |
| 78 | return "MCP2517FD"; break; | 78 | return "MCP2517FD"; |
| 79 | case MCP251XFD_MODEL_MCP2518FD: | 79 | case MCP251XFD_MODEL_MCP2518FD: |
| 80 | return "MCP2518FD"; break; | 80 | return "MCP2518FD"; |
| 81 | case MCP251XFD_MODEL_MCP251XFD: | 81 | case MCP251XFD_MODEL_MCP251XFD: |
| 82 | return "MCP251xFD"; break; | 82 | return "MCP251xFD"; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | return "<unknown>"; | 85 | return "<unknown>"; |
| @@ -95,21 +95,21 @@ static const char *mcp251xfd_get_mode_str(const u8 mode) · 9 unmodified lines | |||
| 95 | { | 95 | { |
| 96 | switch (mode) { | 96 | switch (mode) { |
| 97 | case MCP251XFD_REG_CON_MODE_MIXED: | 97 | case MCP251XFD_REG_CON_MODE_MIXED: |
| 98 | return "Mixed (CAN FD/CAN 2.0)"; break; | 98 | return "Mixed (CAN FD/CAN 2.0)"; |
| 99 | case MCP251XFD_REG_CON_MODE_SLEEP: | 99 | case MCP251XFD_REG_CON_MODE_SLEEP: |
| 100 | return "Sleep"; break; | 100 | return "Sleep"; |
| 101 | case MCP251XFD_REG_CON_MODE_INT_LOOPBACK: | 101 | case MCP251XFD_REG_CON_MODE_INT_LOOPBACK: |
| 102 | return "Internal Loopback"; break; | 102 | return "Internal Loopback"; |
| 103 | case MCP251XFD_REG_CON_MODE_LISTENONLY: | 103 | case MCP251XFD_REG_CON_MODE_LISTENONLY: |
| 104 | return "Listen Only"; break; | 104 | return "Listen Only"; |
| 105 | case MCP251XFD_REG_CON_MODE_CONFIG: | 105 | case MCP251XFD_REG_CON_MODE_CONFIG: |
| 106 | return "Configuration"; break; | 106 | return "Configuration"; |
| 107 | case MCP251XFD_REG_CON_MODE_EXT_LOOPBACK: | 107 | case MCP251XFD_REG_CON_MODE_EXT_LOOPBACK: |
| 108 | return "External Loopback"; break; | 108 | return "External Loopback"; |
| 109 | case MCP251XFD_REG_CON_MODE_CAN2_0: | 109 | case MCP251XFD_REG_CON_MODE_CAN2_0: |
| 110 | return "CAN 2.0"; break; | 110 | return "CAN 2.0"; |
| 111 | case MCP251XFD_REG_CON_MODE_RESTRICTED: | 111 | case MCP251XFD_REG_CON_MODE_RESTRICTED: |
| 112 | return "Restricted Operation"; break; | 112 | return "Restricted Operation"; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | return "<unknown>"; | 115 | return "<unknown>"; |
| @@ -173,7 +173,7 @@ mcp251xfd_regmap_nocrc_read(void *context, · 172 unmodified lines | |||
| 173 | memcpy(&buf_tx->cmd, reg, sizeof(buf_tx->cmd)); | 173 | memcpy(&buf_tx->cmd, reg, sizeof(buf_tx->cmd)); |
| 174 | if (MCP251XFD_SANITIZE_SPI) | 174 | if (MCP251XFD_SANITIZE_SPI) |
| 175 | memset(buf_tx->data, 0x0, val_len); | 175 | memset(buf_tx->data, 0x0, val_len); |
| 176 | }; | 176 | } |
| 177 | 177 | ||
| 178 | err = spi_sync(spi, &msg); | 178 | err = spi_sync(spi, &msg); |
| 179 | if (err) | 179 | if (err) |
| @@ -330,17 +330,17 @@ mcp251xfd_regmap_crc_read(void *context, · 150 unmodified lines | |||
| 330 | goto out; | 330 | goto out; |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | netdev_dbg(priv->ndev, | ||
| 334 | "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n", | ||
| 335 | reg, val_len, (int)val_len, buf_rx->data, | ||
| 336 | get_unaligned_be16(buf_rx->data + val_len)); | ||
| 337 | } | ||
| 338 | |||
| 339 | if (err) { | ||
| 340 | netdev_info(priv->ndev, | 333 | netdev_info(priv->ndev, |
| 341 | "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n", | 334 | "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n", |
| 342 | reg, val_len, (int)val_len, buf_rx->data, | 335 | reg, val_len, (int)val_len, buf_rx->data, |
| 343 | get_unaligned_be16(buf_rx->data + val_len)); | 336 | get_unaligned_be16(buf_rx->data + val_len)); |
| 337 | } | ||
| 338 | |||
| 339 | if (err) { | ||
| 340 | netdev_err(priv->ndev, | ||
| 341 | "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n", | ||
| 342 | reg, val_len, (int)val_len, buf_rx->data, | ||
| 343 | get_unaligned_be16(buf_rx->data + val_len)); | ||
| 344 | 344 | ||
| 345 | return err; | 345 | return err; |
| 346 | } | 346 | } |
| @@ -933,7 +933,7 @@ static int ti_hecc_probe(struct platform_device *pdev) · 932 unmodified lines | |||
| 933 | err = clk_prepare_enable(priv->clk); | 933 | err = clk_prepare_enable(priv->clk); |
| 934 | if (err) { | 934 | if (err) { |
| 935 | dev_err(&pdev->dev, "clk_prepare_enable() failed\n"); | 935 | dev_err(&pdev->dev, "clk_prepare_enable() failed\n"); |
| 936 | goto probe_exit_clk; | 936 | goto probe_exit_release_clk; |
| 937 | } | 937 | } |
| 938 | 938 | ||
| 939 | priv->offload.mailbox_read = ti_hecc_mailbox_read; | 939 | priv->offload.mailbox_read = ti_hecc_mailbox_read; |
| @@ -942,7 +942,7 @@ static int ti_hecc_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 942 | err = can_rx_offload_add_timestamp(ndev, &priv->offload); | 942 | err = can_rx_offload_add_timestamp(ndev, &priv->offload); |
| 943 | if (err) { | 943 | if (err) { |
| 944 | dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n"); | 944 | dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n"); |
| 945 | goto probe_exit_clk; | 945 | goto probe_exit_disable_clk; |
| 946 | } | 946 | } |
| 947 | 947 | ||
| 948 | err = register_candev(ndev); | 948 | err = register_candev(ndev); |
| @@ -960,7 +960,9 @@ static int ti_hecc_probe(struct platform_device *pdev) · 11 unmodified lines | |||
| 960 | 960 | ||
| 961 | probe_exit_offload: | 961 | probe_exit_offload: |
| 962 | can_rx_offload_del(&priv->offload); | 962 | can_rx_offload_del(&priv->offload); |
| 963 | probe_exit_clk: | 963 | probe_exit_disable_clk: |
| 964 | clk_disable_unprepare(priv->clk); | ||
| 965 | probe_exit_release_clk: | ||
| 964 | clk_put(priv->clk); | 966 | clk_put(priv->clk); |
| 965 | probe_exit_candev: | 967 | probe_exit_candev: |
| 966 | free_candev(ndev); | 968 | free_candev(ndev); |
| @@ -130,14 +130,55 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time) · 129 unmodified lines | |||
| 130 | /* protect from getting time before setting now */ | 130 | /* protect from getting time before setting now */ |
| 131 | if (ktime_to_ns(time_ref->tv_host)) { | 131 | if (ktime_to_ns(time_ref->tv_host)) { |
| 132 | u64 delta_us; | 132 | u64 delta_us; |
| 133 | s64 delta_ts = 0; | ||
| 134 | |||
| 135 | /* General case: dev_ts_1 < dev_ts_2 < ts, with: | ||
| 136 | * | ||
| 137 | * - dev_ts_1 = previous sync timestamp | ||
| 138 | * - dev_ts_2 = last sync timestamp | ||
| 139 | * - ts = event timestamp | ||
| 140 | * - ts_period = known sync period (theoretical) | ||
| 141 | * ~ dev_ts2 - dev_ts1 | ||
| 142 | * *but*: | ||
| 143 | * | ||
| 144 | * - time counters wrap (see adapter->ts_used_bits) | ||
| 145 | * - sometimes, dev_ts_1 < ts < dev_ts2 | ||
| 146 | * | ||
| 147 | * "normal" case (sync time counters increase): | ||
| 148 | * must take into account case when ts wraps (tsw) | ||
| 149 | * | ||
| 150 | * < ts_period > < > | ||
| 151 | * | | | | ||
| 152 | * ---+--------+----+-------0-+--+--> | ||
| 153 | * ts_dev_1 | ts_dev_2 | | ||
| 154 | * ts tsw | ||
| 155 | */ | ||
| 156 | if (time_ref->ts_dev_1 < time_ref->ts_dev_2) { | ||
| 157 | /* case when event time (tsw) wraps */ | ||
| 158 | if (ts < time_ref->ts_dev_1) | ||
| 159 | delta_ts = 1 << time_ref->adapter->ts_used_bits; | ||
| 160 | |||
| 161 | /* Otherwise, sync time counter (ts_dev_2) has wrapped: | ||
| 162 | * handle case when event time (tsn) hasn't. | ||
| 163 | * | ||
| 164 | * < ts_period > < > | ||
| 165 | * | | | | ||
| 166 | * ---+--------+--0-+---------+--+--> | ||
| 167 | * ts_dev_1 | ts_dev_2 | | ||
| 168 | * tsn ts | ||
| 169 | */ | ||
| 170 | } else if (time_ref->ts_dev_1 < ts) { | ||
| 171 | delta_ts = -(1 << time_ref->adapter->ts_used_bits); | ||
| 172 | } | ||
| 133 | 173 | ||
| 134 | delta_us = ts - time_ref->ts_dev_2; | 174 | /* add delay between last sync and event timestamps */ |
| 135 | if (ts < time_ref->ts_dev_2) | 175 | delta_ts += (signed int)(ts - time_ref->ts_dev_2); |
| 136 | delta_us &= (1 << time_ref->adapter->ts_used_bits) - 1; | ||
| 137 | 176 | ||
| 138 | delta_us += time_ref->ts_total; | 177 | /* add time from beginning to last sync */ |
| 178 | delta_ts += time_ref->ts_total; | ||
| 139 | 179 | ||
| 140 | delta_us *= time_ref->adapter->us_per_ts_scale; | 180 | /* convert ticks number into microseconds */ |
| 181 | delta_us = delta_ts * time_ref->adapter->us_per_ts_scale; | ||
| 141 | delta_us >>= time_ref->adapter->us_per_ts_shift; | 182 | delta_us >>= time_ref->adapter->us_per_ts_shift; |
| 142 | 183 | ||
| 143 | *time = ktime_add_us(time_ref->tv_host_0, delta_us); | 184 | *time = ktime_add_us(time_ref->tv_host_0, delta_us); |
| @@ -468,12 +468,18 @@ static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if, · 467 unmodified lines | |||
| 468 | struct pucan_msg *rx_msg) | 468 | struct pucan_msg *rx_msg) |
| 469 | { | 469 | { |
| 470 | struct pucan_rx_msg *rm = (struct pucan_rx_msg *)rx_msg; | 470 | struct pucan_rx_msg *rm = (struct pucan_rx_msg *)rx_msg; |
| 471 | struct peak_usb_device *dev = usb_if->dev[pucan_msg_get_channel(rm)]; | 471 | struct peak_usb_device *dev; |
| 472 | struct net_device *netdev = dev->netdev; | 472 | struct net_device *netdev; |
| 473 | struct canfd_frame *cfd; | 473 | struct canfd_frame *cfd; |
| 474 | struct sk_buff *skb; | 474 | struct sk_buff *skb; |
| 475 | const u16 rx_msg_flags = le16_to_cpu(rm->flags); | 475 | const u16 rx_msg_flags = le16_to_cpu(rm->flags); |
| 476 | 476 | ||
| 477 | if (pucan_msg_get_channel(rm) >= ARRAY_SIZE(usb_if->dev)) | ||
| 478 | return -ENOMEM; | ||
| 479 | |||
| 480 | dev = usb_if->dev[pucan_msg_get_channel(rm)]; | ||
| 481 | netdev = dev->netdev; | ||
| 482 | |||
| 477 | if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN) { | 483 | if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN) { |
| 478 | /* CANFD frame case */ | 484 | /* CANFD frame case */ |
| 479 | skb = alloc_canfd_skb(netdev, &cfd); | 485 | skb = alloc_canfd_skb(netdev, &cfd); |
| @@ -519,15 +525,21 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if, · 39 unmodified lines | |||
| 519 | struct pucan_msg *rx_msg) | 525 | struct pucan_msg *rx_msg) |
| 520 | { | 526 | { |
| 521 | struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg; | 527 | struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg; |
| 522 | struct peak_usb_device *dev = usb_if->dev[pucan_stmsg_get_channel(sm)]; | 528 | struct pcan_usb_fd_device *pdev; |
| 523 | struct pcan_usb_fd_device *pdev = | ||
| 524 | container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 525 | enum can_state new_state = CAN_STATE_ERROR_ACTIVE; | 529 | enum can_state new_state = CAN_STATE_ERROR_ACTIVE; |
| 526 | enum can_state rx_state, tx_state; | 530 | enum can_state rx_state, tx_state; |
| 527 | struct net_device *netdev = dev->netdev; | 531 | struct peak_usb_device *dev; |
| 532 | struct net_device *netdev; | ||
| 528 | struct can_frame *cf; | 533 | struct can_frame *cf; |
| 529 | struct sk_buff *skb; | 534 | struct sk_buff *skb; |
| 530 | 535 | ||
| 536 | if (pucan_stmsg_get_channel(sm) >= ARRAY_SIZE(usb_if->dev)) | ||
| 537 | return -ENOMEM; | ||
| 538 | |||
| 539 | dev = usb_if->dev[pucan_stmsg_get_channel(sm)]; | ||
| 540 | pdev = container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 541 | netdev = dev->netdev; | ||
| 542 | |||
| 531 | /* nothing should be sent while in BUS_OFF state */ | 543 | /* nothing should be sent while in BUS_OFF state */ |
| 532 | if (dev->can.state == CAN_STATE_BUS_OFF) | 544 | if (dev->can.state == CAN_STATE_BUS_OFF) |
| 533 | return 0; | 545 | return 0; |
| @@ -579,9 +591,14 @@ static int pcan_usb_fd_decode_error(struct pcan_usb_fd_if *usb_if, · 45 unmodified lines | |||
| 579 | struct pucan_msg *rx_msg) | 591 | struct pucan_msg *rx_msg) |
| 580 | { | 592 | { |
| 581 | struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg; | 593 | struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg; |
| 582 | struct peak_usb_device *dev = usb_if->dev[pucan_ermsg_get_channel(er)]; | 594 | struct pcan_usb_fd_device *pdev; |
| 583 | struct pcan_usb_fd_device *pdev = | 595 | struct peak_usb_device *dev; |
| 584 | container_of(dev, struct pcan_usb_fd_device, dev); | 596 | |
| 597 | if (pucan_ermsg_get_channel(er) >= ARRAY_SIZE(usb_if->dev)) | ||
| 598 | return -EINVAL; | ||
| 599 | |||
| 600 | dev = usb_if->dev[pucan_ermsg_get_channel(er)]; | ||
| 601 | pdev = container_of(dev, struct pcan_usb_fd_device, dev); | ||
| 585 | 602 | ||
| 586 | /* keep a trace of tx and rx error counters for later use */ | 603 | /* keep a trace of tx and rx error counters for later use */ |
| 587 | pdev->bec.txerr = er->tx_err_cnt; | 604 | pdev->bec.txerr = er->tx_err_cnt; |
| @@ -595,11 +612,17 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if, · 7 unmodified lines | |||
| 595 | struct pucan_msg *rx_msg) | 612 | struct pucan_msg *rx_msg) |
| 596 | { | 613 | { |
| 597 | struct pcan_ufd_ovr_msg *ov = (struct pcan_ufd_ovr_msg *)rx_msg; | 614 | struct pcan_ufd_ovr_msg *ov = (struct pcan_ufd_ovr_msg *)rx_msg; |
| 598 | struct peak_usb_device *dev = usb_if->dev[pufd_omsg_get_channel(ov)]; | 615 | struct peak_usb_device *dev; |
| 599 | struct net_device *netdev = dev->netdev; | 616 | struct net_device *netdev; |
| 600 | struct can_frame *cf; | 617 | struct can_frame *cf; |
| 601 | struct sk_buff *skb; | 618 | struct sk_buff *skb; |
| 602 | 619 | ||
| 620 | if (pufd_omsg_get_channel(ov) >= ARRAY_SIZE(usb_if->dev)) | ||
| 621 | return -EINVAL; | ||
| 622 | |||
| 623 | dev = usb_if->dev[pufd_omsg_get_channel(ov)]; | ||
| 624 | netdev = dev->netdev; | ||
| 625 | |||
| 603 | /* allocate an skb to store the error frame */ | 626 | /* allocate an skb to store the error frame */ |
| 604 | skb = alloc_can_err_skb(netdev, &cf); | 627 | skb = alloc_can_err_skb(netdev, &cf); |
| 605 | if (!skb) | 628 | if (!skb) |
| @@ -716,6 +739,9 @@ static int pcan_usb_fd_encode_msg(struct peak_usb_device *dev, · 110 unmodified lines | |||
| 716 | u16 tx_msg_size, tx_msg_flags; | 739 | u16 tx_msg_size, tx_msg_flags; |
| 717 | u8 can_dlc; | 740 | u8 can_dlc; |
| 718 | 741 | ||
| 742 | if (cfd->len > CANFD_MAX_DLEN) | ||
| 743 | return -EINVAL; | ||
| 744 | |||
| 719 | tx_msg_size = ALIGN(sizeof(struct pucan_tx_msg) + cfd->len, 4); | 745 | tx_msg_size = ALIGN(sizeof(struct pucan_tx_msg) + cfd->len, 4); |
| 720 | tx_msg->size = cpu_to_le16(tx_msg_size); | 746 | tx_msg->size = cpu_to_le16(tx_msg_size); |
| 721 | tx_msg->type = cpu_to_le16(PUCAN_MSG_CAN_TX); | 747 | tx_msg->type = cpu_to_le16(PUCAN_MSG_CAN_TX); |
| @@ -1395,7 +1395,7 @@ static int xcan_open(struct net_device *ndev) · 1394 unmodified lines | |||
| 1395 | if (ret < 0) { | 1395 | if (ret < 0) { |
| 1396 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", | 1396 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", |
| 1397 | __func__, ret); | 1397 | __func__, ret); |
| 1398 | return ret; | 1398 | goto err; |
| 1399 | } | 1399 | } |
| 1400 | 1400 | ||
| 1401 | ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags, | 1401 | ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags, |
| @@ -1479,6 +1479,7 @@ static int xcan_get_berr_counter(const struct net_device *ndev, · 77 unmodified lines | |||
| 1479 | if (ret < 0) { | 1479 | if (ret < 0) { |
| 1480 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", | 1480 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", |
| 1481 | __func__, ret); | 1481 | __func__, ret); |
| 1482 | pm_runtime_put(priv->dev); | ||
| 1482 | return ret; | 1483 | return ret; |
| 1483 | } | 1484 | } |
| 1484 | 1485 | ||
| @@ -1793,7 +1794,7 @@ static int xcan_probe(struct platform_device *pdev) · 308 unmodified lines | |||
| 1793 | if (ret < 0) { | 1794 | if (ret < 0) { |
| 1794 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", | 1795 | netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", |
| 1795 | __func__, ret); | 1796 | __func__, ret); |
| 1796 | goto err_pmdisable; | 1797 | goto err_disableclks; |
| 1797 | } | 1798 | } |
| 1798 | 1799 | ||
| 1799 | if (priv->read_reg(priv, XCAN_SR_OFFSET) != XCAN_SR_CONFIG_MASK) { | 1800 | if (priv->read_reg(priv, XCAN_SR_OFFSET) != XCAN_SR_CONFIG_MASK) { |
| @@ -1828,7 +1829,6 @@ static int xcan_probe(struct platform_device *pdev) · 28 unmodified lines | |||
| 1828 | 1829 | ||
| 1829 | err_disableclks: | 1830 | err_disableclks: |
| 1830 | pm_runtime_put(priv->dev); | 1831 | pm_runtime_put(priv->dev); |
| 1831 | err_pmdisable: | ||
| 1832 | pm_runtime_disable(&pdev->dev); | 1832 | pm_runtime_disable(&pdev->dev); |
| 1833 | err_free: | 1833 | err_free: |
| 1834 | free_candev(ndev); | 1834 | free_candev(ndev); |
| @@ -1219,8 +1219,8 @@ qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) · 1218 unmodified lines | |||
| 1219 | priv->port_mtu[port] = new_mtu; | 1219 | priv->port_mtu[port] = new_mtu; |
| 1220 | 1220 | ||
| 1221 | for (i = 0; i < QCA8K_NUM_PORTS; i++) | 1221 | for (i = 0; i < QCA8K_NUM_PORTS; i++) |
| 1222 | if (priv->port_mtu[port] > mtu) | 1222 | if (priv->port_mtu[i] > mtu) |
| 1223 | mtu = priv->port_mtu[port]; | 1223 | mtu = priv->port_mtu[i]; |
| 1224 | 1224 | ||
| 1225 | /* Include L2 header / FCS length */ | 1225 | /* Include L2 header / FCS length */ |
| 1226 | qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN); | 1226 | qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN); |
| @@ -1929,7 +1929,8 @@ static inline int macb_clear_csum(struct sk_buff *skb) · 1928 unmodified lines | |||
| 1929 | 1929 | ||
| 1930 | static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) | 1930 | static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) |
| 1931 | { | 1931 | { |
| 1932 | bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb); | 1932 | bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) || |
| 1933 | skb_is_nonlinear(*skb); | ||
| 1933 | int padlen = ETH_ZLEN - (*skb)->len; | 1934 | int padlen = ETH_ZLEN - (*skb)->len; |
| 1934 | int headroom = skb_headroom(*skb); | 1935 | int headroom = skb_headroom(*skb); |
| 1935 | int tailroom = skb_tailroom(*skb); | 1936 | int tailroom = skb_tailroom(*skb); |
| @@ -212,7 +212,7 @@ static struct sk_buff *alloc_ctrl_skb(struct sk_buff *skb, int len) · 211 unmodified lines | |||
| 212 | { | 212 | { |
| 213 | if (likely(skb && !skb_shared(skb) && !skb_cloned(skb))) { | 213 | if (likely(skb && !skb_shared(skb) && !skb_cloned(skb))) { |
| 214 | __skb_trim(skb, 0); | 214 | __skb_trim(skb, 0); |
| 215 | refcount_add(2, &skb->users); | 215 | refcount_inc(&skb->users); |
| 216 | } else { | 216 | } else { |
| 217 | skb = alloc_skb(len, GFP_KERNEL | __GFP_NOFAIL); | 217 | skb = alloc_skb(len, GFP_KERNEL | __GFP_NOFAIL); |
| 218 | } | 218 | } |
| @@ -383,6 +383,9 @@ int chtls_setkey(struct chtls_sock *csk, u32 keylen, · 382 unmodified lines | |||
| 383 | if (ret) | 383 | if (ret) |
| 384 | goto out_notcb; | 384 | goto out_notcb; |
| 385 | 385 | ||
| 386 | if (unlikely(csk_flag(sk, CSK_ABORT_SHUTDOWN))) | ||
| 387 | goto out_notcb; | ||
| 388 | |||
| 386 | set_wr_txq(skb, CPL_PRIORITY_DATA, csk->tlshws.txqid); | 389 | set_wr_txq(skb, CPL_PRIORITY_DATA, csk->tlshws.txqid); |
| 387 | csk->wr_credits -= DIV_ROUND_UP(len, 16); | 390 | csk->wr_credits -= DIV_ROUND_UP(len, 16); |
| 388 | csk->wr_unacked += DIV_ROUND_UP(len, 16); | 391 | csk->wr_unacked += DIV_ROUND_UP(len, 16); |
| @@ -174,12 +174,17 @@ MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms"); · 173 unmodified lines | |||
| 174 | #define DPAA_PARSE_RESULTS_SIZE sizeof(struct fman_prs_result) | 174 | #define DPAA_PARSE_RESULTS_SIZE sizeof(struct fman_prs_result) |
| 175 | #define DPAA_TIME_STAMP_SIZE 8 | 175 | #define DPAA_TIME_STAMP_SIZE 8 |
| 176 | #define DPAA_HASH_RESULTS_SIZE 8 | 176 | #define DPAA_HASH_RESULTS_SIZE 8 |
| 177 | #define DPAA_HWA_SIZE (DPAA_PARSE_RESULTS_SIZE + DPAA_TIME_STAMP_SIZE \ | ||
| 178 | + DPAA_HASH_RESULTS_SIZE) | ||
| 179 | #define DPAA_RX_PRIV_DATA_DEFAULT_SIZE (DPAA_TX_PRIV_DATA_SIZE + \ | ||
| 180 | dpaa_rx_extra_headroom) | ||
| 177 | #ifdef CONFIG_DPAA_ERRATUM_A050385 | 181 | #ifdef CONFIG_DPAA_ERRATUM_A050385 |
| 178 | #define DPAA_RX_PRIV_DATA_SIZE (DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\ | 182 | #define DPAA_RX_PRIV_DATA_A050385_SIZE (DPAA_A050385_ALIGN - DPAA_HWA_SIZE) |
| 179 | + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE)) | 183 | #define DPAA_RX_PRIV_DATA_SIZE (fman_has_errata_a050385() ? \ |
| 184 | DPAA_RX_PRIV_DATA_A050385_SIZE : \ | ||
| 185 | DPAA_RX_PRIV_DATA_DEFAULT_SIZE) | ||
| 180 | #else | 186 | #else |
| 181 | #define DPAA_RX_PRIV_DATA_SIZE (u16)(DPAA_TX_PRIV_DATA_SIZE + \ | 187 | #define DPAA_RX_PRIV_DATA_SIZE DPAA_RX_PRIV_DATA_DEFAULT_SIZE |
| 182 | dpaa_rx_extra_headroom) | ||
| 183 | #endif | 188 | #endif |
| 184 | 189 | ||
| 185 | #define DPAA_ETH_PCD_RXQ_NUM 128 | 190 | #define DPAA_ETH_PCD_RXQ_NUM 128 |
| @@ -2840,7 +2845,8 @@ out_error: · 2654 unmodified lines | |||
| 2840 | return err; | 2845 | return err; |
| 2841 | } | 2846 | } |
| 2842 | 2847 | ||
| 2843 | static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) | 2848 | static u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl, |
| 2849 | enum port_type port) | ||
| 2844 | { | 2850 | { |
| 2845 | u16 headroom; | 2851 | u16 headroom; |
| 2846 | 2852 | ||
| @@ -2854,10 +2860,12 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) · 7 unmodified lines | |||
| 2854 | * | 2860 | * |
| 2855 | * Also make sure the headroom is a multiple of data_align bytes | 2861 | * Also make sure the headroom is a multiple of data_align bytes |
| 2856 | */ | 2862 | */ |
| 2857 | headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE + | 2863 | headroom = (u16)(bl[port].priv_data_size + DPAA_HWA_SIZE); |
| 2858 | DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE); | ||
| 2859 | 2864 | ||
| 2860 | return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT); | 2865 | if (port == RX) |
| 2866 | return ALIGN(headroom, DPAA_FD_RX_DATA_ALIGNMENT); | ||
| 2867 | else | ||
| 2868 | return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT); | ||
| 2861 | } | 2869 | } |
| 2862 | 2870 | ||
| 2863 | static int dpaa_eth_probe(struct platform_device *pdev) | 2871 | static int dpaa_eth_probe(struct platform_device *pdev) |
| @@ -3025,8 +3033,8 @@ static int dpaa_eth_probe(struct platform_device *pdev) · 161 unmodified lines | |||
| 3025 | goto free_dpaa_fqs; | 3033 | goto free_dpaa_fqs; |
| 3026 | } | 3034 | } |
| 3027 | 3035 | ||
| 3028 | priv->tx_headroom = dpaa_get_headroom(&priv->buf_layout[TX]); | 3036 | priv->tx_headroom = dpaa_get_headroom(priv->buf_layout, TX); |
| 3029 | priv->rx_headroom = dpaa_get_headroom(&priv->buf_layout[RX]); | 3037 | priv->rx_headroom = dpaa_get_headroom(priv->buf_layout, RX); |
| 3030 | 3038 | ||
| 3031 | /* All real interfaces need their ports initialized */ | 3039 | /* All real interfaces need their ports initialized */ |
| 3032 | err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs, | 3040 | err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs, |
| @@ -456,6 +456,12 @@ struct bufdesc_ex { · 455 unmodified lines | |||
| 456 | */ | 456 | */ |
| 457 | #define FEC_QUIRK_HAS_FRREG (1 << 16) | 457 | #define FEC_QUIRK_HAS_FRREG (1 << 16) |
| 458 | 458 | ||
| 459 | /* Some FEC hardware blocks need the MMFR cleared at setup time to avoid | ||
| 460 | * the generation of an MII event. This must be avoided in the older | ||
| 461 | * FEC blocks where it will stop MII events being generated. | ||
| 462 | */ | ||
| 463 | #define FEC_QUIRK_CLEAR_SETUP_MII (1 << 17) | ||
| 464 | |||
| 459 | struct bufdesc_prop { | 465 | struct bufdesc_prop { |
| 460 | int qid; | 466 | int qid; |
| 461 | /* Address of Rx and Tx buffers */ | 467 | /* Address of Rx and Tx buffers */ |
| @@ -100,14 +100,14 @@ static const struct fec_devinfo fec_imx27_info = { · 99 unmodified lines | |||
| 100 | static const struct fec_devinfo fec_imx28_info = { | 100 | static const struct fec_devinfo fec_imx28_info = { |
| 101 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | | 101 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | |
| 102 | FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC | | 102 | FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC | |
| 103 | FEC_QUIRK_HAS_FRREG, | 103 | FEC_QUIRK_HAS_FRREG | FEC_QUIRK_CLEAR_SETUP_MII, |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | static const struct fec_devinfo fec_imx6q_info = { | 106 | static const struct fec_devinfo fec_imx6q_info = { |
| 107 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 107 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
| 108 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | 108 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
| 109 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | | 109 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | |
| 110 | FEC_QUIRK_HAS_RACC, | 110 | FEC_QUIRK_HAS_RACC | FEC_QUIRK_CLEAR_SETUP_MII, |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | static const struct fec_devinfo fec_mvf600_info = { | 113 | static const struct fec_devinfo fec_mvf600_info = { |
| @@ -119,7 +119,8 @@ static const struct fec_devinfo fec_imx6x_info = { · 5 unmodified lines | |||
| 119 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | 119 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
| 120 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | | 120 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | |
| 121 | FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE | | 121 | FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE | |
| 122 | FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE, | 122 | FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE | |
| 123 | FEC_QUIRK_CLEAR_SETUP_MII, | ||
| 123 | }; | 124 | }; |
| 124 | 125 | ||
| 125 | static const struct fec_devinfo fec_imx6ul_info = { | 126 | static const struct fec_devinfo fec_imx6ul_info = { |
| @@ -127,7 +128,7 @@ static const struct fec_devinfo fec_imx6ul_info = { · 1 unmodified line | |||
| 127 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | 128 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
| 128 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 | | 129 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 | |
| 129 | FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC | | 130 | FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC | |
| 130 | FEC_QUIRK_HAS_COALESCE, | 131 | FEC_QUIRK_HAS_COALESCE | FEC_QUIRK_CLEAR_SETUP_MII, |
| 131 | }; | 132 | }; |
| 132 | 133 | ||
| 133 | static struct platform_device_id fec_devtype[] = { | 134 | static struct platform_device_id fec_devtype[] = { |
| @@ -2134,15 +2135,17 @@ static int fec_enet_mii_init(struct platform_device *pdev) · 2000 unmodified lines | |||
| 2134 | if (suppress_preamble) | 2135 | if (suppress_preamble) |
| 2135 | fep->phy_speed |= BIT(7); | 2136 | fep->phy_speed |= BIT(7); |
| 2136 | 2137 | ||
| 2137 | /* Clear MMFR to avoid to generate MII event by writing MSCR. | 2138 | if (fep->quirks & FEC_QUIRK_CLEAR_SETUP_MII) { |
| 2138 | * MII event generation condition: | 2139 | /* Clear MMFR to avoid to generate MII event by writing MSCR. |
| 2139 | * - writing MSCR: | 2140 | * MII event generation condition: |
| 2140 | * - mmfr[31:0]_not_zero & mscr[7:0]_is_zero & | 2141 | * - writing MSCR: |
| 2141 | * mscr_reg_data_in[7:0] != 0 | 2142 | * - mmfr[31:0]_not_zero & mscr[7:0]_is_zero & |
| 2142 | * - writing MMFR: | 2143 | * mscr_reg_data_in[7:0] != 0 |
| 2143 | * - mscr[7:0]_not_zero | 2144 | * - writing MMFR: |
| 2144 | */ | 2145 | * - mscr[7:0]_not_zero |
| 2145 | writel(0, fep->hwp + FEC_MII_DATA); | 2146 | */ |
| 2147 | writel(0, fep->hwp + FEC_MII_DATA); | ||
| 2148 | } | ||
| 2146 | 2149 | ||
| 2147 | writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); | 2150 | writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); |
| 2148 | 2151 | ||
| @@ -1829,20 +1829,12 @@ static netdev_tx_t gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) · 1828 unmodified lines | |||
| 1829 | fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN; | 1829 | fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN; |
| 1830 | 1830 | ||
| 1831 | /* make space for additional header when fcb is needed */ | 1831 | /* make space for additional header when fcb is needed */ |
| 1832 | if (fcb_len && unlikely(skb_headroom(skb) < fcb_len)) { | 1832 | if (fcb_len) { |
| 1833 | struct sk_buff *skb_new; | 1833 | if (unlikely(skb_cow_head(skb, fcb_len))) { |
| 1834 | |||
| 1835 | skb_new = skb_realloc_headroom(skb, fcb_len); | ||
| 1836 | if (!skb_new) { | ||
| 1837 | dev->stats.tx_errors++; | 1834 | dev->stats.tx_errors++; |
| 1838 | dev_kfree_skb_any(skb); | 1835 | dev_kfree_skb_any(skb); |
| 1839 | return NETDEV_TX_OK; | 1836 | return NETDEV_TX_OK; |
| 1840 | } | 1837 | } |
| 1841 | |||
| 1842 | if (skb->sk) | ||
| 1843 | skb_set_owner_w(skb_new, skb->sk); | ||
| 1844 | dev_consume_skb_any(skb); | ||
| 1845 | skb = skb_new; | ||
| 1846 | } | 1838 | } |
| 1847 | 1839 | ||
| 1848 | /* total number of fragments in the SKB */ | 1840 | /* total number of fragments in the SKB */ |
| @@ -3380,7 +3372,7 @@ static int gfar_probe(struct platform_device *ofdev) · 1531 unmodified lines | |||
| 3380 | 3372 | ||
| 3381 | if (dev->features & NETIF_F_IP_CSUM || | 3373 | if (dev->features & NETIF_F_IP_CSUM || |
| 3382 | priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) | 3374 | priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) |
| 3383 | dev->needed_headroom = GMAC_FCB_LEN; | 3375 | dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN; |
| 3384 | 3376 | ||
| 3385 | /* Initializing some of the rx/tx queue level parameters */ | 3377 | /* Initializing some of the rx/tx queue level parameters */ |
| 3386 | for (i = 0; i < priv->num_tx_queues; i++) { | 3378 | for (i = 0; i < priv->num_tx_queues; i++) { |
| @@ -1185,18 +1185,27 @@ static int ibmvnic_open(struct net_device *netdev) · 1184 unmodified lines | |||
| 1185 | if (adapter->state != VNIC_CLOSED) { | 1185 | if (adapter->state != VNIC_CLOSED) { |
| 1186 | rc = ibmvnic_login(netdev); | 1186 | rc = ibmvnic_login(netdev); |
| 1187 | if (rc) | 1187 | if (rc) |
| 1188 | return rc; | 1188 | goto out; |
| 1189 | 1189 | ||
| 1190 | rc = init_resources(adapter); | 1190 | rc = init_resources(adapter); |
| 1191 | if (rc) { | 1191 | if (rc) { |
| 1192 | netdev_err(netdev, "failed to initialize resources\n"); | 1192 | netdev_err(netdev, "failed to initialize resources\n"); |
| 1193 | release_resources(adapter); | 1193 | release_resources(adapter); |
| 1194 | return rc; | 1194 | goto out; |
| 1195 | } | 1195 | } |
| 1196 | } | 1196 | } |
| 1197 | 1197 | ||
| 1198 | rc = __ibmvnic_open(netdev); | 1198 | rc = __ibmvnic_open(netdev); |
| 1199 | 1199 | ||
| 1200 | out: | ||
| 1201 | /* | ||
| 1202 | * If open fails due to a pending failover, set device state and | ||
| 1203 | * return. Device operation will be handled by reset routine. | ||
| 1204 | */ | ||
| 1205 | if (rc && adapter->failover_pending) { | ||
| 1206 | adapter->state = VNIC_OPEN; | ||
| 1207 | rc = 0; | ||
| 1208 | } | ||
| 1200 | return rc; | 1209 | return rc; |
| 1201 | } | 1210 | } |
| 1202 | 1211 | ||
| @@ -1922,6 +1931,13 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 719 unmodified lines | |||
| 1922 | rwi->reset_reason); | 1931 | rwi->reset_reason); |
| 1923 | 1932 | ||
| 1924 | rtnl_lock(); | 1933 | rtnl_lock(); |
| 1934 | /* | ||
| 1935 | * Now that we have the rtnl lock, clear any pending failover. | ||
| 1936 | * This will ensure ibmvnic_open() has either completed or will | ||
| 1937 | * block until failover is complete. | ||
| 1938 | */ | ||
| 1939 | if (rwi->reset_reason == VNIC_RESET_FAILOVER) | ||
| 1940 | adapter->failover_pending = false; | ||
| 1925 | 1941 | ||
| 1926 | netif_carrier_off(netdev); | 1942 | netif_carrier_off(netdev); |
| 1927 | adapter->reset_reason = rwi->reset_reason; | 1943 | adapter->reset_reason = rwi->reset_reason; |
| @@ -2202,6 +2218,13 @@ static void __ibmvnic_reset(struct work_struct *work) · 274 unmodified lines | |||
| 2202 | /* CHANGE_PARAM requestor holds rtnl_lock */ | 2218 | /* CHANGE_PARAM requestor holds rtnl_lock */ |
| 2203 | rc = do_change_param_reset(adapter, rwi, reset_state); | 2219 | rc = do_change_param_reset(adapter, rwi, reset_state); |
| 2204 | } else if (adapter->force_reset_recovery) { | 2220 | } else if (adapter->force_reset_recovery) { |
| 2221 | /* | ||
| 2222 | * Since we are doing a hard reset now, clear the | ||
| 2223 | * failover_pending flag so we don't ignore any | ||
| 2224 | * future MOBILITY or other resets. | ||
| 2225 | */ | ||
| 2226 | adapter->failover_pending = false; | ||
| 2227 | |||
| 2205 | /* Transport event occurred during previous reset */ | 2228 | /* Transport event occurred during previous reset */ |
| 2206 | if (adapter->wait_for_reset) { | 2229 | if (adapter->wait_for_reset) { |
| 2207 | /* Previous was CHANGE_PARAM; caller locked */ | 2230 | /* Previous was CHANGE_PARAM; caller locked */ |
| @@ -2266,9 +2289,15 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, · 58 unmodified lines | |||
| 2266 | unsigned long flags; | 2289 | unsigned long flags; |
| 2267 | int ret; | 2290 | int ret; |
| 2268 | 2291 | ||
| 2292 | /* | ||
| 2293 | * If failover is pending don't schedule any other reset. | ||
| 2294 | * Instead let the failover complete. If there is already a | ||
| 2295 | * a failover reset scheduled, we will detect and drop the | ||
| 2296 | * duplicate reset when walking the ->rwi_list below. | ||
| 2297 | */ | ||
| 2269 | if (adapter->state == VNIC_REMOVING || | 2298 | if (adapter->state == VNIC_REMOVING || |
| 2270 | adapter->state == VNIC_REMOVED || | 2299 | adapter->state == VNIC_REMOVED || |
| 2271 | adapter->failover_pending) { | 2300 | (adapter->failover_pending && reason != VNIC_RESET_FAILOVER)) { |
| 2272 | ret = EBUSY; | 2301 | ret = EBUSY; |
| 2273 | netdev_dbg(netdev, "Adapter removing or pending failover, skipping reset\n"); | 2302 | netdev_dbg(netdev, "Adapter removing or pending failover, skipping reset\n"); |
| 2274 | goto err; | 2303 | goto err; |
| @@ -4713,7 +4742,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 2438 unmodified lines | |||
| 4713 | case IBMVNIC_CRQ_INIT: | 4742 | case IBMVNIC_CRQ_INIT: |
| 4714 | dev_info(dev, "Partner initialized\n"); | 4743 | dev_info(dev, "Partner initialized\n"); |
| 4715 | adapter->from_passive_init = true; | 4744 | adapter->from_passive_init = true; |
| 4716 | adapter->failover_pending = false; | ||
| 4717 | if (!completion_done(&adapter->init_done)) { | 4745 | if (!completion_done(&adapter->init_done)) { |
| 4718 | complete(&adapter->init_done); | 4746 | complete(&adapter->init_done); |
| 4719 | adapter->init_done_rc = -EIO; | 4747 | adapter->init_done_rc = -EIO; |
| @@ -126,6 +126,11 @@ static int ionic_get_link_ksettings(struct net_device *netdev, · 125 unmodified lines | |||
| 126 | 126 | ||
| 127 | ethtool_link_ksettings_zero_link_mode(ks, supported); | 127 | ethtool_link_ksettings_zero_link_mode(ks, supported); |
| 128 | 128 | ||
| 129 | if (!idev->port_info) { | ||
| 130 | netdev_err(netdev, "port_info not initialized\n"); | ||
| 131 | return -EOPNOTSUPP; | ||
| 132 | } | ||
| 133 | |||
| 129 | /* The port_info data is found in a DMA space that the NIC keeps | 134 | /* The port_info data is found in a DMA space that the NIC keeps |
| 130 | * up-to-date, so there's no need to request the data from the | 135 | * up-to-date, so there's no need to request the data from the |
| 131 | * NIC, we already have it in our memory space. | 136 | * NIC, we already have it in our memory space. |
| @@ -4080,9 +4080,17 @@ err_out: · 4079 unmodified lines | |||
| 4080 | return -EIO; | 4080 | return -EIO; |
| 4081 | } | 4081 | } |
| 4082 | 4082 | ||
| 4083 | static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb) | 4083 | static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp) |
| 4084 | { | 4084 | { |
| 4085 | return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34; | 4085 | switch (tp->mac_version) { |
| 4086 | case RTL_GIGA_MAC_VER_34: | ||
| 4087 | case RTL_GIGA_MAC_VER_60: | ||
| 4088 | case RTL_GIGA_MAC_VER_61: | ||
| 4089 | case RTL_GIGA_MAC_VER_63: | ||
| 4090 | return true; | ||
| 4091 | default: | ||
| 4092 | return false; | ||
| 4093 | } | ||
| 4086 | } | 4094 | } |
| 4087 | 4095 | ||
| 4088 | static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts) | 4096 | static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts) |
| @@ -4154,7 +4162,7 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp, · 65 unmodified lines | |||
| 4154 | 4162 | ||
| 4155 | opts[1] |= transport_offset << TCPHO_SHIFT; | 4163 | opts[1] |= transport_offset << TCPHO_SHIFT; |
| 4156 | } else { | 4164 | } else { |
| 4157 | if (unlikely(rtl_test_hw_pad_bug(tp, skb))) | 4165 | if (unlikely(skb->len < ETH_ZLEN && rtl_test_hw_pad_bug(tp))) |
| 4158 | return !eth_skb_pad(skb); | 4166 | return !eth_skb_pad(skb); |
| 4159 | } | 4167 | } |
| 4160 | 4168 | ||
| @@ -625,13 +625,6 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, · 624 unmodified lines | |||
| 625 | if (ret) | 625 | if (ret) |
| 626 | return ret; | 626 | return ret; |
| 627 | 627 | ||
| 628 | if (plat->eee_usecs_rate > 0) { | ||
| 629 | u32 tx_lpi_usec; | ||
| 630 | |||
| 631 | tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1; | ||
| 632 | writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER); | ||
| 633 | } | ||
| 634 | |||
| 635 | ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); | 628 | ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); |
| 636 | if (ret < 0) | 629 | if (ret < 0) |
| 637 | return ret; | 630 | return ret; |
| @@ -641,6 +634,13 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, · 3 unmodified lines | |||
| 641 | res.wol_irq = pci_irq_vector(pdev, 0); | 634 | res.wol_irq = pci_irq_vector(pdev, 0); |
| 642 | res.irq = pci_irq_vector(pdev, 0); | 635 | res.irq = pci_irq_vector(pdev, 0); |
| 643 | 636 | ||
| 637 | if (plat->eee_usecs_rate > 0) { | ||
| 638 | u32 tx_lpi_usec; | ||
| 639 | |||
| 640 | tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1; | ||
| 641 | writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER); | ||
| 642 | } | ||
| 643 | |||
| 644 | ret = stmmac_dvr_probe(&pdev->dev, plat, &res); | 644 | ret = stmmac_dvr_probe(&pdev->dev, plat, &res); |
| 645 | if (ret) { | 645 | if (ret) { |
| 646 | pci_free_irq_vectors(pdev); | 646 | pci_free_irq_vectors(pdev); |
| @@ -4757,6 +4757,7 @@ static void stmmac_napi_add(struct net_device *dev) · 4756 unmodified lines | |||
| 4757 | 4757 | ||
| 4758 | ch->priv_data = priv; | 4758 | ch->priv_data = priv; |
| 4759 | ch->index = queue; | 4759 | ch->index = queue; |
| 4760 | spin_lock_init(&ch->lock); | ||
| 4760 | 4761 | ||
| 4761 | if (queue < priv->plat->rx_queues_to_use) { | 4762 | if (queue < priv->plat->rx_queues_to_use) { |
| 4762 | netif_napi_add(dev, &ch->rx_napi, stmmac_napi_poll_rx, | 4763 | netif_napi_add(dev, &ch->rx_napi, stmmac_napi_poll_rx, |
| @@ -728,7 +728,6 @@ int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info) · 727 unmodified lines | |||
| 728 | (1 << HWTSTAMP_TX_ON); | 728 | (1 << HWTSTAMP_TX_ON); |
| 729 | info->rx_filters = | 729 | info->rx_filters = |
| 730 | (1 << HWTSTAMP_FILTER_NONE) | | 730 | (1 << HWTSTAMP_FILTER_NONE) | |
| 731 | (1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT) | | ||
| 732 | (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); | 731 | (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); |
| 733 | return 0; | 732 | return 0; |
| 734 | } | 733 | } |
| @@ -639,13 +639,10 @@ static int cpsw_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) · 638 unmodified lines | |||
| 639 | break; | 639 | break; |
| 640 | case HWTSTAMP_FILTER_ALL: | 640 | case HWTSTAMP_FILTER_ALL: |
| 641 | case HWTSTAMP_FILTER_NTP_ALL: | 641 | case HWTSTAMP_FILTER_NTP_ALL: |
| 642 | return -ERANGE; | ||
| 643 | case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: | 642 | case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: |
| 644 | case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: | 643 | case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: |
| 645 | case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: | 644 | case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: |
| 646 | priv->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; | 645 | return -ERANGE; |
| 647 | cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; | ||
| 648 | break; | ||
| 649 | case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: | 646 | case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: |
| 650 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: | 647 | case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: |
| 651 | case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: | 648 | case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: |
| @@ -2389,7 +2389,8 @@ static int sfp_probe(struct platform_device *pdev) · 2388 unmodified lines | |||
| 2389 | continue; | 2389 | continue; |
| 2390 | 2390 | ||
| 2391 | sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]); | 2391 | sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]); |
| 2392 | if (!sfp->gpio_irq[i]) { | 2392 | if (sfp->gpio_irq[i] < 0) { |
| 2393 | sfp->gpio_irq[i] = 0; | ||
| 2393 | sfp->need_poll = true; | 2394 | sfp->need_poll = true; |
| 2394 | continue; | 2395 | continue; |
| 2395 | } | 2396 | } |
| @@ -1309,6 +1309,7 @@ static const struct usb_device_id products[] = { · 1308 unmodified lines | |||
| 1309 | {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ | 1309 | {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ |
| 1310 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | 1310 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
| 1311 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ | 1311 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ |
| 1312 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1230, 2)}, /* Telit LE910Cx */ | ||
| 1312 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */ | 1313 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */ |
| 1313 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */ | 1314 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */ |
| 1314 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */ | 1315 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */ |
| @@ -4582,8 +4582,7 @@ void nvme_start_queues(struct nvme_ctrl *ctrl) · 4581 unmodified lines | |||
| 4582 | } | 4582 | } |
| 4583 | EXPORT_SYMBOL_GPL(nvme_start_queues); | 4583 | EXPORT_SYMBOL_GPL(nvme_start_queues); |
| 4584 | 4584 | ||
| 4585 | 4585 | void nvme_sync_io_queues(struct nvme_ctrl *ctrl) | |
| 4586 | void nvme_sync_queues(struct nvme_ctrl *ctrl) | ||
| 4587 | { | 4586 | { |
| 4588 | struct nvme_ns *ns; | 4587 | struct nvme_ns *ns; |
| 4589 | 4588 | ||
| @@ -4591,7 +4590,12 @@ void nvme_sync_queues(struct nvme_ctrl *ctrl) · 1 unmodified line | |||
| 4591 | list_for_each_entry(ns, &ctrl->namespaces, list) | 4590 | list_for_each_entry(ns, &ctrl->namespaces, list) |
| 4592 | blk_sync_queue(ns->queue); | 4591 | blk_sync_queue(ns->queue); |
| 4593 | up_read(&ctrl->namespaces_rwsem); | 4592 | up_read(&ctrl->namespaces_rwsem); |
| 4593 | } | ||
| 4594 | EXPORT_SYMBOL_GPL(nvme_sync_io_queues); | ||
| 4594 | 4595 | ||
| 4596 | void nvme_sync_queues(struct nvme_ctrl *ctrl) | ||
| 4597 | { | ||
| 4598 | nvme_sync_io_queues(ctrl); | ||
| 4595 | if (ctrl->admin_q) | 4599 | if (ctrl->admin_q) |
| 4596 | blk_sync_queue(ctrl->admin_q); | 4600 | blk_sync_queue(ctrl->admin_q); |
| 4597 | } | 4601 | } |
| @@ -602,6 +602,7 @@ void nvme_stop_queues(struct nvme_ctrl *ctrl); · 601 unmodified lines | |||
| 602 | void nvme_start_queues(struct nvme_ctrl *ctrl); | 602 | void nvme_start_queues(struct nvme_ctrl *ctrl); |
| 603 | void nvme_kill_queues(struct nvme_ctrl *ctrl); | 603 | void nvme_kill_queues(struct nvme_ctrl *ctrl); |
| 604 | void nvme_sync_queues(struct nvme_ctrl *ctrl); | 604 | void nvme_sync_queues(struct nvme_ctrl *ctrl); |
| 605 | void nvme_sync_io_queues(struct nvme_ctrl *ctrl); | ||
| 605 | void nvme_unfreeze(struct nvme_ctrl *ctrl); | 606 | void nvme_unfreeze(struct nvme_ctrl *ctrl); |
| 606 | void nvme_wait_freeze(struct nvme_ctrl *ctrl); | 607 | void nvme_wait_freeze(struct nvme_ctrl *ctrl); |
| 607 | int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); | 608 | int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); |
| @@ -198,6 +198,7 @@ struct nvme_queue { · 197 unmodified lines | |||
| 198 | u32 q_depth; | 198 | u32 q_depth; |
| 199 | u16 cq_vector; | 199 | u16 cq_vector; |
| 200 | u16 sq_tail; | 200 | u16 sq_tail; |
| 201 | u16 last_sq_tail; | ||
| 201 | u16 cq_head; | 202 | u16 cq_head; |
| 202 | u16 qid; | 203 | u16 qid; |
| 203 | u8 cq_phase; | 204 | u8 cq_phase; |
| @@ -455,11 +456,24 @@ static int nvme_pci_map_queues(struct blk_mq_tag_set *set) · 251 unmodified lines | |||
| 455 | return 0; | 456 | return 0; |
| 456 | } | 457 | } |
| 457 | 458 | ||
| 458 | static inline void nvme_write_sq_db(struct nvme_queue *nvmeq) | 459 | /* |
| 460 | * Write sq tail if we are asked to, or if the next command would wrap. | ||
| 461 | */ | ||
| 462 | static inline void nvme_write_sq_db(struct nvme_queue *nvmeq, bool write_sq) | ||
| 459 | { | 463 | { |
| 464 | if (!write_sq) { | ||
| 465 | u16 next_tail = nvmeq->sq_tail + 1; | ||
| 466 | |||
| 467 | if (next_tail == nvmeq->q_depth) | ||
| 468 | next_tail = 0; | ||
| 469 | if (next_tail != nvmeq->last_sq_tail) | ||
| 470 | return; | ||
| 471 | } | ||
| 472 | |||
| 460 | if (nvme_dbbuf_update_and_check_event(nvmeq->sq_tail, | 473 | if (nvme_dbbuf_update_and_check_event(nvmeq->sq_tail, |
| 461 | nvmeq->dbbuf_sq_db, nvmeq->dbbuf_sq_ei)) | 474 | nvmeq->dbbuf_sq_db, nvmeq->dbbuf_sq_ei)) |
| 462 | writel(nvmeq->sq_tail, nvmeq->q_db); | 475 | writel(nvmeq->sq_tail, nvmeq->q_db); |
| 476 | nvmeq->last_sq_tail = nvmeq->sq_tail; | ||
| 463 | } | 477 | } |
| 464 | 478 | ||
| 465 | /** | 479 | /** |
| @@ -476,8 +490,7 @@ static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd, · 10 unmodified lines | |||
| 476 | cmd, sizeof(*cmd)); | 490 | cmd, sizeof(*cmd)); |
| 477 | if (++nvmeq->sq_tail == nvmeq->q_depth) | 491 | if (++nvmeq->sq_tail == nvmeq->q_depth) |
| 478 | nvmeq->sq_tail = 0; | 492 | nvmeq->sq_tail = 0; |
| 479 | if (write_sq) | 493 | nvme_write_sq_db(nvmeq, write_sq); |
| 480 | nvme_write_sq_db(nvmeq); | ||
| 481 | spin_unlock(&nvmeq->sq_lock); | 494 | spin_unlock(&nvmeq->sq_lock); |
| 482 | } | 495 | } |
| 483 | 496 | ||
| @@ -486,7 +499,8 @@ static void nvme_commit_rqs(struct blk_mq_hw_ctx *hctx) · 2 unmodified lines | |||
| 486 | struct nvme_queue *nvmeq = hctx->driver_data; | 499 | struct nvme_queue *nvmeq = hctx->driver_data; |
| 487 | 500 | ||
| 488 | spin_lock(&nvmeq->sq_lock); | 501 | spin_lock(&nvmeq->sq_lock); |
| 489 | nvme_write_sq_db(nvmeq); | 502 | if (nvmeq->sq_tail != nvmeq->last_sq_tail) |
| 503 | nvme_write_sq_db(nvmeq, true); | ||
| 490 | spin_unlock(&nvmeq->sq_lock); | 504 | spin_unlock(&nvmeq->sq_lock); |
| 491 | } | 505 | } |
| 492 | 506 | ||
| @@ -1496,6 +1510,7 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid) · 1003 unmodified lines | |||
| 1496 | struct nvme_dev *dev = nvmeq->dev; | 1510 | struct nvme_dev *dev = nvmeq->dev; |
| 1497 | 1511 | ||
| 1498 | nvmeq->sq_tail = 0; | 1512 | nvmeq->sq_tail = 0; |
| 1513 | nvmeq->last_sq_tail = 0; | ||
| 1499 | nvmeq->cq_head = 0; | 1514 | nvmeq->cq_head = 0; |
| 1500 | nvmeq->cq_phase = 1; | 1515 | nvmeq->cq_phase = 1; |
| 1501 | nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride]; | 1516 | nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride]; |
| @@ -122,7 +122,6 @@ struct nvme_rdma_ctrl { · 121 unmodified lines | |||
| 122 | struct sockaddr_storage src_addr; | 122 | struct sockaddr_storage src_addr; |
| 123 | 123 | ||
| 124 | struct nvme_ctrl ctrl; | 124 | struct nvme_ctrl ctrl; |
| 125 | struct mutex teardown_lock; | ||
| 126 | bool use_inline_data; | 125 | bool use_inline_data; |
| 127 | u32 io_queues[HCTX_MAX_TYPES]; | 126 | u32 io_queues[HCTX_MAX_TYPES]; |
| 128 | }; | 127 | }; |
| @@ -1010,8 +1009,8 @@ out_free_io_queues: · 881 unmodified lines | |||
| 1010 | static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, | 1009 | static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, |
| 1011 | bool remove) | 1010 | bool remove) |
| 1012 | { | 1011 | { |
| 1013 | mutex_lock(&ctrl->teardown_lock); | ||
| 1014 | blk_mq_quiesce_queue(ctrl->ctrl.admin_q); | 1012 | blk_mq_quiesce_queue(ctrl->ctrl.admin_q); |
| 1013 | blk_sync_queue(ctrl->ctrl.admin_q); | ||
| 1015 | nvme_rdma_stop_queue(&ctrl->queues[0]); | 1014 | nvme_rdma_stop_queue(&ctrl->queues[0]); |
| 1016 | if (ctrl->ctrl.admin_tagset) { | 1015 | if (ctrl->ctrl.admin_tagset) { |
| 1017 | blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset, | 1016 | blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset, |
| @@ -1021,16 +1020,15 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, · 3 unmodified lines | |||
| 1021 | if (remove) | 1020 | if (remove) |
| 1022 | blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); | 1021 | blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); |
| 1023 | nvme_rdma_destroy_admin_queue(ctrl, remove); | 1022 | nvme_rdma_destroy_admin_queue(ctrl, remove); |
| 1024 | mutex_unlock(&ctrl->teardown_lock); | ||
| 1025 | } | 1023 | } |
| 1026 | 1024 | ||
| 1027 | static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, | 1025 | static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, |
| 1028 | bool remove) | 1026 | bool remove) |
| 1029 | { | 1027 | { |
| 1030 | mutex_lock(&ctrl->teardown_lock); | ||
| 1031 | if (ctrl->ctrl.queue_count > 1) { | 1028 | if (ctrl->ctrl.queue_count > 1) { |
| 1032 | nvme_start_freeze(&ctrl->ctrl); | 1029 | nvme_start_freeze(&ctrl->ctrl); |
| 1033 | nvme_stop_queues(&ctrl->ctrl); | 1030 | nvme_stop_queues(&ctrl->ctrl); |
| 1031 | nvme_sync_io_queues(&ctrl->ctrl); | ||
| 1034 | nvme_rdma_stop_io_queues(ctrl); | 1032 | nvme_rdma_stop_io_queues(ctrl); |
| 1035 | if (ctrl->ctrl.tagset) { | 1033 | if (ctrl->ctrl.tagset) { |
| 1036 | blk_mq_tagset_busy_iter(ctrl->ctrl.tagset, | 1034 | blk_mq_tagset_busy_iter(ctrl->ctrl.tagset, |
| @@ -1041,7 +1039,6 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, · 4 unmodified lines | |||
| 1041 | nvme_start_queues(&ctrl->ctrl); | 1039 | nvme_start_queues(&ctrl->ctrl); |
| 1042 | nvme_rdma_destroy_io_queues(ctrl, remove); | 1040 | nvme_rdma_destroy_io_queues(ctrl, remove); |
| 1043 | } | 1041 | } |
| 1044 | mutex_unlock(&ctrl->teardown_lock); | ||
| 1045 | } | 1042 | } |
| 1046 | 1043 | ||
| 1047 | static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) | 1044 | static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) |
| @@ -1976,16 +1973,12 @@ static void nvme_rdma_complete_timed_out(struct request *rq) · 928 unmodified lines | |||
| 1976 | { | 1973 | { |
| 1977 | struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); | 1974 | struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); |
| 1978 | struct nvme_rdma_queue *queue = req->queue; | 1975 | struct nvme_rdma_queue *queue = req->queue; |
| 1979 | struct nvme_rdma_ctrl *ctrl = queue->ctrl; | ||
| 1980 | 1976 | ||
| 1981 | /* fence other contexts that may complete the command */ | ||
| 1982 | mutex_lock(&ctrl->teardown_lock); | ||
| 1983 | nvme_rdma_stop_queue(queue); | 1977 | nvme_rdma_stop_queue(queue); |
| 1984 | if (!blk_mq_request_completed(rq)) { | 1978 | if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) { |
| 1985 | nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; | 1979 | nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; |
| 1986 | blk_mq_complete_request(rq); | 1980 | blk_mq_complete_request(rq); |
| 1987 | } | 1981 | } |
| 1988 | mutex_unlock(&ctrl->teardown_lock); | ||
| 1989 | } | 1982 | } |
| 1990 | 1983 | ||
| 1991 | static enum blk_eh_timer_return | 1984 | static enum blk_eh_timer_return |
| @@ -2320,7 +2313,6 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, · 328 unmodified lines | |||
| 2320 | return ERR_PTR(-ENOMEM); | 2313 | return ERR_PTR(-ENOMEM); |
| 2321 | ctrl->ctrl.opts = opts; | 2314 | ctrl->ctrl.opts = opts; |
| 2322 | INIT_LIST_HEAD(&ctrl->list); | 2315 | INIT_LIST_HEAD(&ctrl->list); |
| 2323 | mutex_init(&ctrl->teardown_lock); | ||
| 2324 | 2316 | ||
| 2325 | if (!(opts->mask & NVMF_OPT_TRSVCID)) { | 2317 | if (!(opts->mask & NVMF_OPT_TRSVCID)) { |
| 2326 | opts->trsvcid = | 2318 | opts->trsvcid = |
| @@ -124,7 +124,6 @@ struct nvme_tcp_ctrl { · 123 unmodified lines | |||
| 124 | struct sockaddr_storage src_addr; | 124 | struct sockaddr_storage src_addr; |
| 125 | struct nvme_ctrl ctrl; | 125 | struct nvme_ctrl ctrl; |
| 126 | 126 | ||
| 127 | struct mutex teardown_lock; | ||
| 128 | struct work_struct err_work; | 127 | struct work_struct err_work; |
| 129 | struct delayed_work connect_work; | 128 | struct delayed_work connect_work; |
| 130 | struct nvme_tcp_request async_req; | 129 | struct nvme_tcp_request async_req; |
| @@ -1886,8 +1885,8 @@ out_free_queue: · 1755 unmodified lines | |||
| 1886 | static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, | 1885 | static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, |
| 1887 | bool remove) | 1886 | bool remove) |
| 1888 | { | 1887 | { |
| 1889 | mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 1890 | blk_mq_quiesce_queue(ctrl->admin_q); | 1888 | blk_mq_quiesce_queue(ctrl->admin_q); |
| 1889 | blk_sync_queue(ctrl->admin_q); | ||
| 1891 | nvme_tcp_stop_queue(ctrl, 0); | 1890 | nvme_tcp_stop_queue(ctrl, 0); |
| 1892 | if (ctrl->admin_tagset) { | 1891 | if (ctrl->admin_tagset) { |
| 1893 | blk_mq_tagset_busy_iter(ctrl->admin_tagset, | 1892 | blk_mq_tagset_busy_iter(ctrl->admin_tagset, |
| @@ -1897,18 +1896,17 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, · 3 unmodified lines | |||
| 1897 | if (remove) | 1896 | if (remove) |
| 1898 | blk_mq_unquiesce_queue(ctrl->admin_q); | 1897 | blk_mq_unquiesce_queue(ctrl->admin_q); |
| 1899 | nvme_tcp_destroy_admin_queue(ctrl, remove); | 1898 | nvme_tcp_destroy_admin_queue(ctrl, remove); |
| 1900 | mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 1901 | } | 1899 | } |
| 1902 | 1900 | ||
| 1903 | static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, | 1901 | static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, |
| 1904 | bool remove) | 1902 | bool remove) |
| 1905 | { | 1903 | { |
| 1906 | mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 1907 | if (ctrl->queue_count <= 1) | 1904 | if (ctrl->queue_count <= 1) |
| 1908 | goto out; | 1905 | return; |
| 1909 | blk_mq_quiesce_queue(ctrl->admin_q); | 1906 | blk_mq_quiesce_queue(ctrl->admin_q); |
| 1910 | nvme_start_freeze(ctrl); | 1907 | nvme_start_freeze(ctrl); |
| 1911 | nvme_stop_queues(ctrl); | 1908 | nvme_stop_queues(ctrl); |
| 1909 | nvme_sync_io_queues(ctrl); | ||
| 1912 | nvme_tcp_stop_io_queues(ctrl); | 1910 | nvme_tcp_stop_io_queues(ctrl); |
| 1913 | if (ctrl->tagset) { | 1911 | if (ctrl->tagset) { |
| 1914 | blk_mq_tagset_busy_iter(ctrl->tagset, | 1912 | blk_mq_tagset_busy_iter(ctrl->tagset, |
| @@ -1918,8 +1916,6 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, · 3 unmodified lines | |||
| 1918 | if (remove) | 1916 | if (remove) |
| 1919 | nvme_start_queues(ctrl); | 1917 | nvme_start_queues(ctrl); |
| 1920 | nvme_tcp_destroy_io_queues(ctrl, remove); | 1918 | nvme_tcp_destroy_io_queues(ctrl, remove); |
| 1921 | out: | ||
| 1922 | mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 1923 | } | 1919 | } |
| 1924 | 1920 | ||
| 1925 | static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl) | 1921 | static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl) |
| @@ -2171,14 +2167,11 @@ static void nvme_tcp_complete_timed_out(struct request *rq) · 245 unmodified lines | |||
| 2171 | struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); | 2167 | struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); |
| 2172 | struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; | 2168 | struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; |
| 2173 | 2169 | ||
| 2174 | /* fence other contexts that may complete the command */ | ||
| 2175 | mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 2176 | nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue)); | 2170 | nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue)); |
| 2177 | if (!blk_mq_request_completed(rq)) { | 2171 | if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) { |
| 2178 | nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; | 2172 | nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; |
| 2179 | blk_mq_complete_request(rq); | 2173 | blk_mq_complete_request(rq); |
| 2180 | } | 2174 | } |
| 2181 | mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 2182 | } | 2175 | } |
| 2183 | 2176 | ||
| 2184 | static enum blk_eh_timer_return | 2177 | static enum blk_eh_timer_return |
| @@ -2455,7 +2448,6 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, · 270 unmodified lines | |||
| 2455 | nvme_tcp_reconnect_ctrl_work); | 2448 | nvme_tcp_reconnect_ctrl_work); |
| 2456 | INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work); | 2449 | INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work); |
| 2457 | INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work); | 2450 | INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work); |
| 2458 | mutex_init(&ctrl->teardown_lock); | ||
| 2459 | 2451 | ||
| 2460 | if (!(opts->mask & NVMF_OPT_TRSVCID)) { | 2452 | if (!(opts->mask & NVMF_OPT_TRSVCID)) { |
| 2461 | opts->trsvcid = | 2453 | opts->trsvcid = |
| @@ -112,7 +112,7 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, · 111 unmodified lines | |||
| 112 | u64 dma_end = 0; | 112 | u64 dma_end = 0; |
| 113 | 113 | ||
| 114 | /* Determine the overall bounds of all DMA regions */ | 114 | /* Determine the overall bounds of all DMA regions */ |
| 115 | for (dma_start = ~0ULL; r->size; r++) { | 115 | for (dma_start = ~0; r->size; r++) { |
| 116 | /* Take lower and upper limits */ | 116 | /* Take lower and upper limits */ |
| 117 | if (r->dma_start < dma_start) | 117 | if (r->dma_start < dma_start) |
| 118 | dma_start = r->dma_start; | 118 | dma_start = r->dma_start; |
| @@ -1181,6 +1181,10 @@ static void _opp_table_kref_release(struct kref *kref) · 1180 unmodified lines | |||
| 1181 | struct opp_device *opp_dev, *temp; | 1181 | struct opp_device *opp_dev, *temp; |
| 1182 | int i; | 1182 | int i; |
| 1183 | 1183 | ||
| 1184 | /* Drop the lock as soon as we can */ | ||
| 1185 | list_del(&opp_table->node); | ||
| 1186 | mutex_unlock(&opp_table_lock); | ||
| 1187 | |||
| 1184 | _of_clear_opp_table(opp_table); | 1188 | _of_clear_opp_table(opp_table); |
| 1185 | 1189 | ||
| 1186 | /* Release clk */ | 1190 | /* Release clk */ |
| @@ -1208,10 +1212,7 @@ static void _opp_table_kref_release(struct kref *kref) · 21 unmodified lines | |||
| 1208 | 1212 | ||
| 1209 | mutex_destroy(&opp_table->genpd_virt_dev_lock); | 1213 | mutex_destroy(&opp_table->genpd_virt_dev_lock); |
| 1210 | mutex_destroy(&opp_table->lock); | 1214 | mutex_destroy(&opp_table->lock); |
| 1211 | list_del(&opp_table->node); | ||
| 1212 | kfree(opp_table); | 1215 | kfree(opp_table); |
| 1213 | |||
| 1214 | mutex_unlock(&opp_table_lock); | ||
| 1215 | } | 1216 | } |
| 1216 | 1217 | ||
| 1217 | void dev_pm_opp_put_opp_table(struct opp_table *opp_table) | 1218 | void dev_pm_opp_put_opp_table(struct opp_table *opp_table) |
| @@ -1930,7 +1931,7 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, · 712 unmodified lines | |||
| 1930 | return ERR_PTR(-EINVAL); | 1931 | return ERR_PTR(-EINVAL); |
| 1931 | 1932 | ||
| 1932 | opp_table = dev_pm_opp_get_opp_table(dev); | 1933 | opp_table = dev_pm_opp_get_opp_table(dev); |
| 1933 | if (!IS_ERR(opp_table)) | 1934 | if (IS_ERR(opp_table)) |
| 1934 | return opp_table; | 1935 | return opp_table; |
| 1935 | 1936 | ||
| 1936 | /* This should be called before OPPs are initialized */ | 1937 | /* This should be called before OPPs are initialized */ |
| @@ -944,6 +944,8 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table) · 943 unmodified lines | |||
| 944 | nr -= 2; | 944 | nr -= 2; |
| 945 | } | 945 | } |
| 946 | 946 | ||
| 947 | return 0; | ||
| 948 | |||
| 947 | remove_static_opp: | 949 | remove_static_opp: |
| 948 | _opp_remove_all_static(opp_table); | 950 | _opp_remove_all_static(opp_table); |
| 949 | 951 | ||
| @@ -586,8 +586,12 @@ void dw_pcie_setup_rc(struct pcie_port *pp) · 585 unmodified lines | |||
| 586 | * ATU, so we should not program the ATU here. | 586 | * ATU, so we should not program the ATU here. |
| 587 | */ | 587 | */ |
| 588 | if (pp->bridge->child_ops == &dw_child_pcie_ops) { | 588 | if (pp->bridge->child_ops == &dw_child_pcie_ops) { |
| 589 | struct resource_entry *entry = | 589 | struct resource_entry *tmp, *entry = NULL; |
| 590 | resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM); | 590 | |
| 591 | /* Get last memory resource entry */ | ||
| 592 | resource_list_for_each_entry(tmp, &pp->bridge->windows) | ||
| 593 | if (resource_type(tmp->res) == IORESOURCE_MEM) | ||
| 594 | entry = tmp; | ||
| 591 | 595 | ||
| 592 | dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX0, | 596 | dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX0, |
| 593 | PCIE_ATU_TYPE_MEM, entry->res->start, | 597 | PCIE_ATU_TYPE_MEM, entry->res->start, |
| @@ -958,25 +958,16 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port) · 957 unmodified lines | |||
| 958 | } | 958 | } |
| 959 | 959 | ||
| 960 | /* | 960 | /* |
| 961 | * We can't use devm_of_pci_get_host_bridge_resources() because we | 961 | * devm_of_pci_get_host_bridge_resources() only sets up translateable resources, |
| 962 | * need to parse our special DT properties encoding the MEM and IO | 962 | * so we need extra resource setup parsing our special DT properties encoding |
| 963 | * apertures. | 963 | * the MEM and IO apertures. |
| 964 | */ | 964 | */ |
| 965 | static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) | 965 | static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) |
| 966 | { | 966 | { |
| 967 | struct device *dev = &pcie->pdev->dev; | 967 | struct device *dev = &pcie->pdev->dev; |
| 968 | struct device_node *np = dev->of_node; | ||
| 969 | struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); | 968 | struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); |
| 970 | int ret; | 969 | int ret; |
| 971 | 970 | ||
| 972 | /* Get the bus range */ | ||
| 973 | ret = of_pci_parse_bus_range(np, &pcie->busn); | ||
| 974 | if (ret) { | ||
| 975 | dev_err(dev, "failed to parse bus-range property: %d\n", ret); | ||
| 976 | return ret; | ||
| 977 | } | ||
| 978 | pci_add_resource(&bridge->windows, &pcie->busn); | ||
| 979 | |||
| 980 | /* Get the PCIe memory aperture */ | 971 | /* Get the PCIe memory aperture */ |
| 981 | mvebu_mbus_get_pcie_mem_aperture(&pcie->mem); | 972 | mvebu_mbus_get_pcie_mem_aperture(&pcie->mem); |
| 982 | if (resource_size(&pcie->mem) == 0) { | 973 | if (resource_size(&pcie->mem) == 0) { |
| @@ -986,6 +977,9 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) · 3 unmodified lines | |||
| 986 | 977 | ||
| 987 | pcie->mem.name = "PCI MEM"; | 978 | pcie->mem.name = "PCI MEM"; |
| 988 | pci_add_resource(&bridge->windows, &pcie->mem); | 979 | pci_add_resource(&bridge->windows, &pcie->mem); |
| 980 | ret = devm_request_resource(dev, &iomem_resource, &pcie->mem); | ||
| 981 | if (ret) | ||
| 982 | return ret; | ||
| 989 | 983 | ||
| 990 | /* Get the PCIe IO aperture */ | 984 | /* Get the PCIe IO aperture */ |
| 991 | mvebu_mbus_get_pcie_io_aperture(&pcie->io); | 985 | mvebu_mbus_get_pcie_io_aperture(&pcie->io); |
| @@ -999,9 +993,12 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) · 7 unmodified lines | |||
| 999 | pcie->realio.name = "PCI I/O"; | 993 | pcie->realio.name = "PCI I/O"; |
| 1000 | 994 | ||
| 1001 | pci_add_resource(&bridge->windows, &pcie->realio); | 995 | pci_add_resource(&bridge->windows, &pcie->realio); |
| 996 | ret = devm_request_resource(dev, &ioport_resource, &pcie->realio); | ||
| 997 | if (ret) | ||
| 998 | return ret; | ||
| 1002 | } | 999 | } |
| 1003 | 1000 | ||
| 1004 | return devm_request_pci_bus_resources(dev, &bridge->windows); | 1001 | return 0; |
| 1005 | } | 1002 | } |
| 1006 | 1003 | ||
| 1007 | /* | 1004 | /* |
| @@ -3516,8 +3516,13 @@ void pci_acs_init(struct pci_dev *dev) · 3515 unmodified lines | |||
| 3516 | { | 3516 | { |
| 3517 | dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS); | 3517 | dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS); |
| 3518 | 3518 | ||
| 3519 | if (dev->acs_cap) | 3519 | /* |
| 3520 | pci_enable_acs(dev); | 3520 | * Attempt to enable ACS regardless of capability because some Root |
| 3521 | * Ports (e.g. those quirked with *_intel_pch_acs_*) do not have | ||
| 3522 | * the standard ACS capability but still support ACS via those | ||
| 3523 | * quirks. | ||
| 3524 | */ | ||
| 3525 | pci_enable_acs(dev); | ||
| 3521 | } | 3526 | } |
| 3522 | 3527 | ||
| 3523 | /** | 3528 | /** |
| @@ -620,7 +620,7 @@ static u64 rapl_unit_xlate(struct rapl_domain *rd, enum unit_type type, · 619 unmodified lines | |||
| 620 | case ARBITRARY_UNIT: | 620 | case ARBITRARY_UNIT: |
| 621 | default: | 621 | default: |
| 622 | return value; | 622 | return value; |
| 623 | }; | 623 | } |
| 624 | 624 | ||
| 625 | if (to_raw) | 625 | if (to_raw) |
| 626 | return div64_u64(value, units) * scale; | 626 | return div64_u64(value, units) * scale; |
| @@ -4165,6 +4165,8 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev) · 4164 unmodified lines | |||
| 4165 | ret = rdev->desc->fixed_uV; | 4165 | ret = rdev->desc->fixed_uV; |
| 4166 | } else if (rdev->supply) { | 4166 | } else if (rdev->supply) { |
| 4167 | ret = regulator_get_voltage_rdev(rdev->supply->rdev); | 4167 | ret = regulator_get_voltage_rdev(rdev->supply->rdev); |
| 4168 | } else if (rdev->supply_name) { | ||
| 4169 | return -EPROBE_DEFER; | ||
| 4168 | } else { | 4170 | } else { |
| 4169 | return -EINVAL; | 4171 | return -EINVAL; |
| 4170 | } | 4172 | } |
| @@ -680,7 +680,10 @@ static int ap_device_probe(struct device *dev) · 679 unmodified lines | |||
| 680 | { | 680 | { |
| 681 | struct ap_device *ap_dev = to_ap_dev(dev); | 681 | struct ap_device *ap_dev = to_ap_dev(dev); |
| 682 | struct ap_driver *ap_drv = to_ap_drv(dev->driver); | 682 | struct ap_driver *ap_drv = to_ap_drv(dev->driver); |
| 683 | int card, queue, devres, drvres, rc; | 683 | int card, queue, devres, drvres, rc = -ENODEV; |
| 684 | |||
| 685 | if (!get_device(dev)) | ||
| 686 | return rc; | ||
| 684 | 687 | ||
| 685 | if (is_queue_dev(dev)) { | 688 | if (is_queue_dev(dev)) { |
| 686 | /* | 689 | /* |
| @@ -697,7 +700,7 @@ static int ap_device_probe(struct device *dev) · 10 unmodified lines | |||
| 697 | mutex_unlock(&ap_perms_mutex); | 700 | mutex_unlock(&ap_perms_mutex); |
| 698 | drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT; | 701 | drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT; |
| 699 | if (!!devres != !!drvres) | 702 | if (!!devres != !!drvres) |
| 700 | return -ENODEV; | 703 | goto out; |
| 701 | } | 704 | } |
| 702 | 705 | ||
| 703 | /* Add queue/card to list of active queues/cards */ | 706 | /* Add queue/card to list of active queues/cards */ |
| @@ -718,6 +721,9 @@ static int ap_device_probe(struct device *dev) · 14 unmodified lines | |||
| 718 | ap_dev->drv = NULL; | 721 | ap_dev->drv = NULL; |
| 719 | } | 722 | } |
| 720 | 723 | ||
| 724 | out: | ||
| 725 | if (rc) | ||
| 726 | put_device(dev); | ||
| 721 | return rc; | 727 | return rc; |
| 722 | } | 728 | } |
| 723 | 729 | ||
| @@ -744,6 +750,8 @@ static int ap_device_remove(struct device *dev) · 20 unmodified lines | |||
| 744 | hash_del(&to_ap_queue(dev)->hnode); | 750 | hash_del(&to_ap_queue(dev)->hnode); |
| 745 | spin_unlock_bh(&ap_queues_lock); | 751 | spin_unlock_bh(&ap_queues_lock); |
| 746 | 752 | ||
| 753 | put_device(dev); | ||
| 754 | |||
| 747 | return 0; | 755 | return 0; |
| 748 | } | 756 | } |
| 749 | 757 | ||
| @@ -1371,6 +1379,8 @@ static inline void ap_scan_domains(struct ap_card *ac) · 621 unmodified lines | |||
| 1371 | __func__, ac->id, dom); | 1379 | __func__, ac->id, dom); |
| 1372 | goto put_dev_and_continue; | 1380 | goto put_dev_and_continue; |
| 1373 | } | 1381 | } |
| 1382 | /* get it and thus adjust reference counter */ | ||
| 1383 | get_device(dev); | ||
| 1374 | if (decfg) | 1384 | if (decfg) |
| 1375 | AP_DBF_INFO("%s(%d,%d) new (decfg) queue device created\n", | 1385 | AP_DBF_INFO("%s(%d,%d) new (decfg) queue device created\n", |
| 1376 | __func__, ac->id, dom); | 1386 | __func__, ac->id, dom); |
| @@ -35,9 +35,6 @@ MODULE_DESCRIPTION("s390 protected key interface"); · 34 unmodified lines | |||
| 35 | #define PROTKEYBLOBBUFSIZE 256 /* protected key buffer size used internal */ | 35 | #define PROTKEYBLOBBUFSIZE 256 /* protected key buffer size used internal */ |
| 36 | #define MAXAPQNSINLIST 64 /* max 64 apqns within a apqn list */ | 36 | #define MAXAPQNSINLIST 64 /* max 64 apqns within a apqn list */ |
| 37 | 37 | ||
| 38 | /* mask of available pckmo subfunctions, fetched once at module init */ | ||
| 39 | static cpacf_mask_t pckmo_functions; | ||
| 40 | |||
| 41 | /* | 38 | /* |
| 42 | * debug feature data and functions | 39 | * debug feature data and functions |
| 43 | */ | 40 | */ |
| @@ -91,6 +88,9 @@ static int pkey_clr2protkey(u32 keytype, · 47 unmodified lines | |||
| 91 | const struct pkey_clrkey *clrkey, | 88 | const struct pkey_clrkey *clrkey, |
| 92 | struct pkey_protkey *protkey) | 89 | struct pkey_protkey *protkey) |
| 93 | { | 90 | { |
| 91 | /* mask of available pckmo subfunctions */ | ||
| 92 | static cpacf_mask_t pckmo_functions; | ||
| 93 | |||
| 94 | long fc; | 94 | long fc; |
| 95 | int keysize; | 95 | int keysize; |
| 96 | u8 paramblock[64]; | 96 | u8 paramblock[64]; |
| @@ -114,11 +114,13 @@ static int pkey_clr2protkey(u32 keytype, · 17 unmodified lines | |||
| 114 | return -EINVAL; | 114 | return -EINVAL; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | /* | 117 | /* Did we already check for PCKMO ? */ |
| 118 | * Check if the needed pckmo subfunction is available. | 118 | if (!pckmo_functions.bytes[0]) { |
| 119 | * These subfunctions can be enabled/disabled by customers | 119 | /* no, so check now */ |
| 120 | * in the LPAR profile or may even change on the fly. | 120 | if (!cpacf_query(CPACF_PCKMO, &pckmo_functions)) |
| 121 | */ | 121 | return -ENODEV; |
| 122 | } | ||
| 123 | /* check for the pckmo subfunction we need now */ | ||
| 122 | if (!cpacf_test_func(&pckmo_functions, fc)) { | 124 | if (!cpacf_test_func(&pckmo_functions, fc)) { |
| 123 | DEBUG_ERR("%s pckmo functions not available\n", __func__); | 125 | DEBUG_ERR("%s pckmo functions not available\n", __func__); |
| 124 | return -ENODEV; | 126 | return -ENODEV; |
| @@ -2058,7 +2060,7 @@ static struct miscdevice pkey_dev = { · 1933 unmodified lines | |||
| 2058 | */ | 2060 | */ |
| 2059 | static int __init pkey_init(void) | 2061 | static int __init pkey_init(void) |
| 2060 | { | 2062 | { |
| 2061 | cpacf_mask_t kmc_functions; | 2063 | cpacf_mask_t func_mask; |
| 2062 | 2064 | ||
| 2063 | /* | 2065 | /* |
| 2064 | * The pckmo instruction should be available - even if we don't | 2066 | * The pckmo instruction should be available - even if we don't |
| @@ -2066,15 +2068,15 @@ static int __init pkey_init(void) · 1 unmodified line | |||
| 2066 | * is also the minimum level for the kmc instructions which | 2068 | * is also the minimum level for the kmc instructions which |
| 2067 | * are able to work with protected keys. | 2069 | * are able to work with protected keys. |
| 2068 | */ | 2070 | */ |
| 2069 | if (!cpacf_query(CPACF_PCKMO, &pckmo_functions)) | 2071 | if (!cpacf_query(CPACF_PCKMO, &func_mask)) |
| 2070 | return -ENODEV; | 2072 | return -ENODEV; |
| 2071 | 2073 | ||
| 2072 | /* check for kmc instructions available */ | 2074 | /* check for kmc instructions available */ |
| 2073 | if (!cpacf_query(CPACF_KMC, &kmc_functions)) | 2075 | if (!cpacf_query(CPACF_KMC, &func_mask)) |
| 2074 | return -ENODEV; | 2076 | return -ENODEV; |
| 2075 | if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) || | 2077 | if (!cpacf_test_func(&func_mask, CPACF_KMC_PAES_128) || |
| 2076 | !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) || | 2078 | !cpacf_test_func(&func_mask, CPACF_KMC_PAES_192) || |
| 2077 | !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256)) | 2079 | !cpacf_test_func(&func_mask, CPACF_KMC_PAES_256)) |
| 2078 | return -ENODEV; | 2080 | return -ENODEV; |
| 2079 | 2081 | ||
| 2080 | pkey_debug_init(); | 2082 | pkey_debug_init(); |
| @@ -157,11 +157,6 @@ int zcrypt_card_register(struct zcrypt_card *zc) · 156 unmodified lines | |||
| 157 | { | 157 | { |
| 158 | int rc; | 158 | int rc; |
| 159 | 159 | ||
| 160 | rc = sysfs_create_group(&zc->card->ap_dev.device.kobj, | ||
| 161 | &zcrypt_card_attr_group); | ||
| 162 | if (rc) | ||
| 163 | return rc; | ||
| 164 | |||
| 165 | spin_lock(&zcrypt_list_lock); | 160 | spin_lock(&zcrypt_list_lock); |
| 166 | list_add_tail(&zc->list, &zcrypt_card_list); | 161 | list_add_tail(&zc->list, &zcrypt_card_list); |
| 167 | spin_unlock(&zcrypt_list_lock); | 162 | spin_unlock(&zcrypt_list_lock); |
| @@ -170,6 +165,14 @@ int zcrypt_card_register(struct zcrypt_card *zc) · 2 unmodified lines | |||
| 170 | 165 | ||
| 171 | ZCRYPT_DBF(DBF_INFO, "card=%02x register online=1\n", zc->card->id); | 166 | ZCRYPT_DBF(DBF_INFO, "card=%02x register online=1\n", zc->card->id); |
| 172 | 167 | ||
| 168 | rc = sysfs_create_group(&zc->card->ap_dev.device.kobj, | ||
| 169 | &zcrypt_card_attr_group); | ||
| 170 | if (rc) { | ||
| 171 | spin_lock(&zcrypt_list_lock); | ||
| 172 | list_del_init(&zc->list); | ||
| 173 | spin_unlock(&zcrypt_list_lock); | ||
| 174 | } | ||
| 175 | |||
| 173 | return rc; | 176 | return rc; |
| 174 | } | 177 | } |
| 175 | EXPORT_SYMBOL(zcrypt_card_register); | 178 | EXPORT_SYMBOL(zcrypt_card_register); |
| @@ -180,7 +180,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq) · 179 unmodified lines | |||
| 180 | &zcrypt_queue_attr_group); | 180 | &zcrypt_queue_attr_group); |
| 181 | if (rc) | 181 | if (rc) |
| 182 | goto out; | 182 | goto out; |
| 183 | get_device(&zq->queue->ap_dev.device); | ||
| 184 | 183 | ||
| 185 | if (zq->ops->rng) { | 184 | if (zq->ops->rng) { |
| 186 | rc = zcrypt_rng_device_add(); | 185 | rc = zcrypt_rng_device_add(); |
| @@ -192,7 +191,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq) · 5 unmodified lines | |||
| 192 | out_unregister: | 191 | out_unregister: |
| 193 | sysfs_remove_group(&zq->queue->ap_dev.device.kobj, | 192 | sysfs_remove_group(&zq->queue->ap_dev.device.kobj, |
| 194 | &zcrypt_queue_attr_group); | 193 | &zcrypt_queue_attr_group); |
| 195 | put_device(&zq->queue->ap_dev.device); | ||
| 196 | out: | 194 | out: |
| 197 | spin_lock(&zcrypt_list_lock); | 195 | spin_lock(&zcrypt_list_lock); |
| 198 | list_del_init(&zq->list); | 196 | list_del_init(&zq->list); |
| @@ -220,12 +218,10 @@ void zcrypt_queue_unregister(struct zcrypt_queue *zq) · 21 unmodified lines | |||
| 220 | list_del_init(&zq->list); | 218 | list_del_init(&zq->list); |
| 221 | zcrypt_device_count--; | 219 | zcrypt_device_count--; |
| 222 | spin_unlock(&zcrypt_list_lock); | 220 | spin_unlock(&zcrypt_list_lock); |
| 223 | zcrypt_card_put(zc); | ||
| 224 | if (zq->ops->rng) | 221 | if (zq->ops->rng) |
| 225 | zcrypt_rng_device_remove(); | 222 | zcrypt_rng_device_remove(); |
| 226 | sysfs_remove_group(&zq->queue->ap_dev.device.kobj, | 223 | sysfs_remove_group(&zq->queue->ap_dev.device.kobj, |
| 227 | &zcrypt_queue_attr_group); | 224 | &zcrypt_queue_attr_group); |
| 228 | put_device(&zq->queue->ap_dev.device); | 225 | zcrypt_card_put(zc); |
| 229 | zcrypt_queue_put(zq); | ||
| 230 | } | 226 | } |
| 231 | EXPORT_SYMBOL(zcrypt_queue_unregister); | 227 | EXPORT_SYMBOL(zcrypt_queue_unregister); |
| @@ -658,8 +658,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 657 unmodified lines | |||
| 658 | rcu_read_lock(); | 658 | rcu_read_lock(); |
| 659 | list_for_each_entry_rcu(h, | 659 | list_for_each_entry_rcu(h, |
| 660 | &tmp_pg->dh_list, node) { | 660 | &tmp_pg->dh_list, node) { |
| 661 | /* h->sdev should always be valid */ | 661 | if (!h->sdev) |
| 662 | BUG_ON(!h->sdev); | 662 | continue; |
| 663 | h->sdev->access_state = desc[0]; | 663 | h->sdev->access_state = desc[0]; |
| 664 | } | 664 | } |
| 665 | rcu_read_unlock(); | 665 | rcu_read_unlock(); |
| @@ -705,7 +705,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 39 unmodified lines | |||
| 705 | pg->expiry = 0; | 705 | pg->expiry = 0; |
| 706 | rcu_read_lock(); | 706 | rcu_read_lock(); |
| 707 | list_for_each_entry_rcu(h, &pg->dh_list, node) { | 707 | list_for_each_entry_rcu(h, &pg->dh_list, node) { |
| 708 | BUG_ON(!h->sdev); | 708 | if (!h->sdev) |
| 709 | continue; | ||
| 709 | h->sdev->access_state = | 710 | h->sdev->access_state = |
| 710 | (pg->state & SCSI_ACCESS_STATE_MASK); | 711 | (pg->state & SCSI_ACCESS_STATE_MASK); |
| 711 | if (pg->pref) | 712 | if (pg->pref) |
| @@ -1147,7 +1148,6 @@ static void alua_bus_detach(struct scsi_device *sdev) · 435 unmodified lines | |||
| 1147 | spin_lock(&h->pg_lock); | 1148 | spin_lock(&h->pg_lock); |
| 1148 | pg = rcu_dereference_protected(h->pg, lockdep_is_held(&h->pg_lock)); | 1149 | pg = rcu_dereference_protected(h->pg, lockdep_is_held(&h->pg_lock)); |
| 1149 | rcu_assign_pointer(h->pg, NULL); | 1150 | rcu_assign_pointer(h->pg, NULL); |
| 1150 | h->sdev = NULL; | ||
| 1151 | spin_unlock(&h->pg_lock); | 1151 | spin_unlock(&h->pg_lock); |
| 1152 | if (pg) { | 1152 | if (pg) { |
| 1153 | spin_lock_irq(&pg->lock); | 1153 | spin_lock_irq(&pg->lock); |
| @@ -1156,6 +1156,7 @@ static void alua_bus_detach(struct scsi_device *sdev) · 2 unmodified lines | |||
| 1156 | kref_put(&pg->kref, release_port_group); | 1156 | kref_put(&pg->kref, release_port_group); |
| 1157 | } | 1157 | } |
| 1158 | sdev->handler_data = NULL; | 1158 | sdev->handler_data = NULL; |
| 1159 | synchronize_rcu(); | ||
| 1159 | kfree(h); | 1160 | kfree(h); |
| 1160 | } | 1161 | } |
| 1161 | 1162 | ||
| @@ -8855,7 +8855,7 @@ reinit_after_soft_reset: · 8854 unmodified lines | |||
| 8855 | /* hook into SCSI subsystem */ | 8855 | /* hook into SCSI subsystem */ |
| 8856 | rc = hpsa_scsi_add_host(h); | 8856 | rc = hpsa_scsi_add_host(h); |
| 8857 | if (rc) | 8857 | if (rc) |
| 8858 | goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ | 8858 | goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ |
| 8859 | 8859 | ||
| 8860 | /* Monitor the controller for firmware lockups */ | 8860 | /* Monitor the controller for firmware lockups */ |
| 8861 | h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; | 8861 | h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; |
| @@ -8870,6 +8870,8 @@ reinit_after_soft_reset: · 8 unmodified lines | |||
| 8870 | HPSA_EVENT_MONITOR_INTERVAL); | 8870 | HPSA_EVENT_MONITOR_INTERVAL); |
| 8871 | return 0; | 8871 | return 0; |
| 8872 | 8872 | ||
| 8873 | clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ | ||
| 8874 | kfree(h->lastlogicals); | ||
| 8873 | clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ | 8875 | clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ |
| 8874 | hpsa_free_performant_mode(h); | 8876 | hpsa_free_performant_mode(h); |
| 8875 | h->access.set_intr_mask(h, HPSA_INTR_OFF); | 8877 | h->access.set_intr_mask(h, HPSA_INTR_OFF); |
| @@ -1740,6 +1740,13 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget) · 1739 unmodified lines | |||
| 1740 | reply_q->irq_poll_scheduled = false; | 1740 | reply_q->irq_poll_scheduled = false; |
| 1741 | reply_q->irq_line_enable = true; | 1741 | reply_q->irq_line_enable = true; |
| 1742 | enable_irq(reply_q->os_irq); | 1742 | enable_irq(reply_q->os_irq); |
| 1743 | /* | ||
| 1744 | * Go for one more round of processing the | ||
| 1745 | * reply descriptor post queue incase if HBA | ||
| 1746 | * Firmware has posted some reply descriptors | ||
| 1747 | * while reenabling the IRQ. | ||
| 1748 | */ | ||
| 1749 | _base_process_reply_queue(reply_q); | ||
| 1743 | } | 1750 | } |
| 1744 | 1751 | ||
| 1745 | return num_entries; | 1752 | return num_entries; |
| @@ -1193,7 +1193,6 @@ static int bcm2835_spi_setup(struct spi_device *spi) · 1192 unmodified lines | |||
| 1193 | struct spi_controller *ctlr = spi->controller; | 1193 | struct spi_controller *ctlr = spi->controller; |
| 1194 | struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr); | 1194 | struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr); |
| 1195 | struct gpio_chip *chip; | 1195 | struct gpio_chip *chip; |
| 1196 | enum gpio_lookup_flags lflags; | ||
| 1197 | u32 cs; | 1196 | u32 cs; |
| 1198 | 1197 | ||
| 1199 | /* | 1198 | /* |
| @@ -1259,21 +1258,9 @@ static int bcm2835_spi_setup(struct spi_device *spi) · 59 unmodified lines | |||
| 1259 | if (!chip) | 1258 | if (!chip) |
| 1260 | return 0; | 1259 | return 0; |
| 1261 | 1260 | ||
| 1262 | /* | ||
| 1263 | * Retrieve the corresponding GPIO line used for CS. | ||
| 1264 | * The inversion semantics will be handled by the GPIO core | ||
| 1265 | * code, so we pass GPIOD_OUT_LOW for "unasserted" and | ||
| 1266 | * the correct flag for inversion semantics. The SPI_CS_HIGH | ||
| 1267 | * on spi->mode cannot be checked for polarity in this case | ||
| 1268 | * as the flag use_gpio_descriptors enforces SPI_CS_HIGH. | ||
| 1269 | */ | ||
| 1270 | if (of_property_read_bool(spi->dev.of_node, "spi-cs-high")) | ||
| 1271 | lflags = GPIO_ACTIVE_HIGH; | ||
| 1272 | else | ||
| 1273 | lflags = GPIO_ACTIVE_LOW; | ||
| 1274 | spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select, | 1261 | spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select, |
| 1275 | DRV_NAME, | 1262 | DRV_NAME, |
| 1276 | lflags, | 1263 | GPIO_LOOKUP_FLAGS_DEFAULT, |
| 1277 | GPIOD_OUT_LOW); | 1264 | GPIOD_OUT_LOW); |
| 1278 | if (IS_ERR(spi->cs_gpiod)) | 1265 | if (IS_ERR(spi->cs_gpiod)) |
| 1279 | return PTR_ERR(spi->cs_gpiod); | 1266 | return PTR_ERR(spi->cs_gpiod); |
| @@ -1080,12 +1080,11 @@ MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); · 1079 unmodified lines | |||
| 1080 | #ifdef CONFIG_PM_SLEEP | 1080 | #ifdef CONFIG_PM_SLEEP |
| 1081 | static int dspi_suspend(struct device *dev) | 1081 | static int dspi_suspend(struct device *dev) |
| 1082 | { | 1082 | { |
| 1083 | struct spi_controller *ctlr = dev_get_drvdata(dev); | 1083 | struct fsl_dspi *dspi = dev_get_drvdata(dev); |
| 1084 | struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); | ||
| 1085 | 1084 | ||
| 1086 | if (dspi->irq) | 1085 | if (dspi->irq) |
| 1087 | disable_irq(dspi->irq); | 1086 | disable_irq(dspi->irq); |
| 1088 | spi_controller_suspend(ctlr); | 1087 | spi_controller_suspend(dspi->ctlr); |
| 1089 | clk_disable_unprepare(dspi->clk); | 1088 | clk_disable_unprepare(dspi->clk); |
| 1090 | 1089 | ||
| 1091 | pinctrl_pm_select_sleep_state(dev); | 1090 | pinctrl_pm_select_sleep_state(dev); |
| @@ -1095,8 +1094,7 @@ static int dspi_suspend(struct device *dev) · 3 unmodified lines | |||
| 1095 | 1094 | ||
| 1096 | static int dspi_resume(struct device *dev) | 1095 | static int dspi_resume(struct device *dev) |
| 1097 | { | 1096 | { |
| 1098 | struct spi_controller *ctlr = dev_get_drvdata(dev); | 1097 | struct fsl_dspi *dspi = dev_get_drvdata(dev); |
| 1099 | struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); | ||
| 1100 | int ret; | 1098 | int ret; |
| 1101 | 1099 | ||
| 1102 | pinctrl_pm_select_default_state(dev); | 1100 | pinctrl_pm_select_default_state(dev); |
| @@ -1104,7 +1102,7 @@ static int dspi_resume(struct device *dev) · 1 unmodified line | |||
| 1104 | ret = clk_prepare_enable(dspi->clk); | 1102 | ret = clk_prepare_enable(dspi->clk); |
| 1105 | if (ret) | 1103 | if (ret) |
| 1106 | return ret; | 1104 | return ret; |
| 1107 | spi_controller_resume(ctlr); | 1105 | spi_controller_resume(dspi->ctlr); |
| 1108 | if (dspi->irq) | 1106 | if (dspi->irq) |
| 1109 | enable_irq(dspi->irq); | 1107 | enable_irq(dspi->irq); |
| 1110 | 1108 | ||
| @@ -1676,15 +1676,18 @@ static int spi_imx_probe(struct platform_device *pdev) · 1675 unmodified lines | |||
| 1676 | goto out_master_put; | 1676 | goto out_master_put; |
| 1677 | } | 1677 | } |
| 1678 | 1678 | ||
| 1679 | pm_runtime_enable(spi_imx->dev); | 1679 | ret = clk_prepare_enable(spi_imx->clk_per); |
| 1680 | if (ret) | ||
| 1681 | goto out_master_put; | ||
| 1682 | |||
| 1683 | ret = clk_prepare_enable(spi_imx->clk_ipg); | ||
| 1684 | if (ret) | ||
| 1685 | goto out_put_per; | ||
| 1686 | |||
| 1680 | pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT); | 1687 | pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT); |
| 1681 | pm_runtime_use_autosuspend(spi_imx->dev); | 1688 | pm_runtime_use_autosuspend(spi_imx->dev); |
| 1682 | 1689 | pm_runtime_set_active(spi_imx->dev); | |
| 1683 | ret = pm_runtime_get_sync(spi_imx->dev); | 1690 | pm_runtime_enable(spi_imx->dev); |
| 1684 | if (ret < 0) { | ||
| 1685 | dev_err(spi_imx->dev, "failed to enable clock\n"); | ||
| 1686 | goto out_runtime_pm_put; | ||
| 1687 | } | ||
| 1688 | 1691 | ||
| 1689 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per); | 1692 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per); |
| 1690 | /* | 1693 | /* |
| @@ -1722,8 +1725,12 @@ out_bitbang_start: · 31 unmodified lines | |||
| 1722 | spi_imx_sdma_exit(spi_imx); | 1725 | spi_imx_sdma_exit(spi_imx); |
| 1723 | out_runtime_pm_put: | 1726 | out_runtime_pm_put: |
| 1724 | pm_runtime_dont_use_autosuspend(spi_imx->dev); | 1727 | pm_runtime_dont_use_autosuspend(spi_imx->dev); |
| 1725 | pm_runtime_put_sync(spi_imx->dev); | 1728 | pm_runtime_set_suspended(&pdev->dev); |
| 1726 | pm_runtime_disable(spi_imx->dev); | 1729 | pm_runtime_disable(spi_imx->dev); |
| 1730 | |||
| 1731 | clk_disable_unprepare(spi_imx->clk_ipg); | ||
| 1732 | out_put_per: | ||
| 1733 | clk_disable_unprepare(spi_imx->clk_per); | ||
| 1727 | out_master_put: | 1734 | out_master_put: |
| 1728 | spi_master_put(master); | 1735 | spi_master_put(master); |
| 1729 | 1736 | ||
| @@ -24,7 +24,7 @@ description: · 23 unmodified lines | |||
| 24 | In addition, it is recommended to declare a mmc-pwrseq on SDIO host above | 24 | In addition, it is recommended to declare a mmc-pwrseq on SDIO host above |
| 25 | WFx. Without it, you may encounter issues with warm boot. The mmc-pwrseq | 25 | WFx. Without it, you may encounter issues with warm boot. The mmc-pwrseq |
| 26 | should be compatible with mmc-pwrseq-simple. Please consult | 26 | should be compatible with mmc-pwrseq-simple. Please consult |
| 27 | Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt for more | 27 | Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more |
| 28 | information. | 28 | information. |
| 29 | 29 | ||
| 30 | For SPI':' | 30 | For SPI':' |
| @@ -317,7 +317,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, · 316 unmodified lines | |||
| 317 | */ | 317 | */ |
| 318 | baud = tty_termios_baud_rate(termios); | 318 | baud = tty_termios_baud_rate(termios); |
| 319 | 319 | ||
| 320 | serial8250_do_set_termios(port, termios, old); | 320 | serial8250_do_set_termios(port, termios, NULL); |
| 321 | 321 | ||
| 322 | tty_termios_encode_baud_rate(termios, baud, baud); | 322 | tty_termios_encode_baud_rate(termios, baud, baud); |
| 323 | 323 | ||
| @@ -522,6 +522,7 @@ config SERIAL_IMX_EARLYCON · 521 unmodified lines | |||
| 522 | depends on OF | 522 | depends on OF |
| 523 | select SERIAL_EARLYCON | 523 | select SERIAL_EARLYCON |
| 524 | select SERIAL_CORE_CONSOLE | 524 | select SERIAL_CORE_CONSOLE |
| 525 | default y if SERIAL_IMX_CONSOLE | ||
| 525 | help | 526 | help |
| 526 | If you have enabled the earlycon on the Freescale IMX | 527 | If you have enabled the earlycon on the Freescale IMX |
| 527 | CPU you can make it the earlycon by answering Y to this option. | 528 | CPU you can make it the earlycon by answering Y to this option. |
| @@ -1280,6 +1280,9 @@ static int __init serial_txx9_init(void) · 1279 unmodified lines | |||
| 1280 | 1280 | ||
| 1281 | #ifdef ENABLE_SERIAL_TXX9_PCI | 1281 | #ifdef ENABLE_SERIAL_TXX9_PCI |
| 1282 | ret = pci_register_driver(&serial_txx9_pci_driver); | 1282 | ret = pci_register_driver(&serial_txx9_pci_driver); |
| 1283 | if (ret) { | ||
| 1284 | platform_driver_unregister(&serial_txx9_plat_driver); | ||
| 1285 | } | ||
| 1283 | #endif | 1286 | #endif |
| 1284 | if (ret == 0) | 1287 | if (ret == 0) |
| 1285 | goto out; | 1288 | goto out; |
| @@ -1515,10 +1515,12 @@ static void release_tty(struct tty_struct *tty, int idx) · 1514 unmodified lines | |||
| 1515 | tty->ops->shutdown(tty); | 1515 | tty->ops->shutdown(tty); |
| 1516 | tty_save_termios(tty); | 1516 | tty_save_termios(tty); |
| 1517 | tty_driver_remove_tty(tty->driver, tty); | 1517 | tty_driver_remove_tty(tty->driver, tty); |
| 1518 | tty->port->itty = NULL; | 1518 | if (tty->port) |
| 1519 | tty->port->itty = NULL; | ||
| 1519 | if (tty->link) | 1520 | if (tty->link) |
| 1520 | tty->link->port->itty = NULL; | 1521 | tty->link->port->itty = NULL; |
| 1521 | tty_buffer_cancel_work(tty->port); | 1522 | if (tty->port) |
| 1523 | tty_buffer_cancel_work(tty->port); | ||
| 1522 | if (tty->link) | 1524 | if (tty->link) |
| 1523 | tty_buffer_cancel_work(tty->link->port); | 1525 | tty_buffer_cancel_work(tty->link->port); |
| 1524 | 1526 | ||
| @@ -4704,27 +4704,6 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) · 4703 unmodified lines | |||
| 4704 | return rc; | 4704 | return rc; |
| 4705 | } | 4705 | } |
| 4706 | 4706 | ||
| 4707 | static int con_font_copy(struct vc_data *vc, struct console_font_op *op) | ||
| 4708 | { | ||
| 4709 | int con = op->height; | ||
| 4710 | int rc; | ||
| 4711 | |||
| 4712 | |||
| 4713 | console_lock(); | ||
| 4714 | if (vc->vc_mode != KD_TEXT) | ||
| 4715 | rc = -EINVAL; | ||
| 4716 | else if (!vc->vc_sw->con_font_copy) | ||
| 4717 | rc = -ENOSYS; | ||
| 4718 | else if (con < 0 || !vc_cons_allocated(con)) | ||
| 4719 | rc = -ENOTTY; | ||
| 4720 | else if (con == vc->vc_num) /* nothing to do */ | ||
| 4721 | rc = 0; | ||
| 4722 | else | ||
| 4723 | rc = vc->vc_sw->con_font_copy(vc, con); | ||
| 4724 | console_unlock(); | ||
| 4725 | return rc; | ||
| 4726 | } | ||
| 4727 | |||
| 4728 | int con_font_op(struct vc_data *vc, struct console_font_op *op) | 4707 | int con_font_op(struct vc_data *vc, struct console_font_op *op) |
| 4729 | { | 4708 | { |
| 4730 | switch (op->op) { | 4709 | switch (op->op) { |
| @@ -4735,7 +4714,8 @@ int con_font_op(struct vc_data *vc, struct console_font_op *op) · 4 unmodified lines | |||
| 4735 | case KD_FONT_OP_SET_DEFAULT: | 4714 | case KD_FONT_OP_SET_DEFAULT: |
| 4736 | return con_font_default(vc, op); | 4715 | return con_font_default(vc, op); |
| 4737 | case KD_FONT_OP_COPY: | 4716 | case KD_FONT_OP_COPY: |
| 4738 | return con_font_copy(vc, op); | 4717 | /* was buggy and never really used */ |
| 4718 | return -EINVAL; | ||
| 4739 | } | 4719 | } |
| 4740 | return -ENOSYS; | 4720 | return -ENOSYS; |
| 4741 | } | 4721 | } |
| @@ -484,7 +484,7 @@ static int vt_k_ioctl(struct tty_struct *tty, unsigned int cmd, · 483 unmodified lines | |||
| 484 | return 0; | 484 | return 0; |
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | static inline int do_fontx_ioctl(int cmd, | 487 | static inline int do_fontx_ioctl(struct vc_data *vc, int cmd, |
| 488 | struct consolefontdesc __user *user_cfd, | 488 | struct consolefontdesc __user *user_cfd, |
| 489 | struct console_font_op *op) | 489 | struct console_font_op *op) |
| 490 | { | 490 | { |
| @@ -502,15 +502,16 @@ static inline int do_fontx_ioctl(int cmd, · 11 unmodified lines | |||
| 502 | op->height = cfdarg.charheight; | 502 | op->height = cfdarg.charheight; |
| 503 | op->charcount = cfdarg.charcount; | 503 | op->charcount = cfdarg.charcount; |
| 504 | op->data = cfdarg.chardata; | 504 | op->data = cfdarg.chardata; |
| 505 | return con_font_op(vc_cons[fg_console].d, op); | 505 | return con_font_op(vc, op); |
| 506 | case GIO_FONTX: { | 506 | |
| 507 | case GIO_FONTX: | ||
| 507 | op->op = KD_FONT_OP_GET; | 508 | op->op = KD_FONT_OP_GET; |
| 508 | op->flags = KD_FONT_FLAG_OLD; | 509 | op->flags = KD_FONT_FLAG_OLD; |
| 509 | op->width = 8; | 510 | op->width = 8; |
| 510 | op->height = cfdarg.charheight; | 511 | op->height = cfdarg.charheight; |
| 511 | op->charcount = cfdarg.charcount; | 512 | op->charcount = cfdarg.charcount; |
| 512 | op->data = cfdarg.chardata; | 513 | op->data = cfdarg.chardata; |
| 513 | i = con_font_op(vc_cons[fg_console].d, op); | 514 | i = con_font_op(vc, op); |
| 514 | if (i) | 515 | if (i) |
| 515 | return i; | 516 | return i; |
| 516 | cfdarg.charheight = op->height; | 517 | cfdarg.charheight = op->height; |
| @@ -518,12 +519,11 @@ static inline int do_fontx_ioctl(int cmd, · 1 unmodified line | |||
| 518 | if (copy_to_user(user_cfd, &cfdarg, sizeof(struct consolefontdesc))) | 519 | if (copy_to_user(user_cfd, &cfdarg, sizeof(struct consolefontdesc))) |
| 519 | return -EFAULT; | 520 | return -EFAULT; |
| 520 | return 0; | 521 | return 0; |
| 521 | } | ||
| 522 | } | 522 | } |
| 523 | return -EINVAL; | 523 | return -EINVAL; |
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | static int vt_io_fontreset(struct console_font_op *op) | 526 | static int vt_io_fontreset(struct vc_data *vc, struct console_font_op *op) |
| 527 | { | 527 | { |
| 528 | int ret; | 528 | int ret; |
| 529 | 529 | ||
| @@ -537,12 +537,12 @@ static int vt_io_fontreset(struct console_font_op *op) · 7 unmodified lines | |||
| 537 | 537 | ||
| 538 | op->op = KD_FONT_OP_SET_DEFAULT; | 538 | op->op = KD_FONT_OP_SET_DEFAULT; |
| 539 | op->data = NULL; | 539 | op->data = NULL; |
| 540 | ret = con_font_op(vc_cons[fg_console].d, op); | 540 | ret = con_font_op(vc, op); |
| 541 | if (ret) | 541 | if (ret) |
| 542 | return ret; | 542 | return ret; |
| 543 | 543 | ||
| 544 | console_lock(); | 544 | console_lock(); |
| 545 | con_set_default_unimap(vc_cons[fg_console].d); | 545 | con_set_default_unimap(vc); |
| 546 | console_unlock(); | 546 | console_unlock(); |
| 547 | 547 | ||
| 548 | return 0; | 548 | return 0; |
| @@ -584,7 +584,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up, · 35 unmodified lines | |||
| 584 | op.height = 0; | 584 | op.height = 0; |
| 585 | op.charcount = 256; | 585 | op.charcount = 256; |
| 586 | op.data = up; | 586 | op.data = up; |
| 587 | return con_font_op(vc_cons[fg_console].d, &op); | 587 | return con_font_op(vc, &op); |
| 588 | 588 | ||
| 589 | case GIO_FONT: | 589 | case GIO_FONT: |
| 590 | op.op = KD_FONT_OP_GET; | 590 | op.op = KD_FONT_OP_GET; |
| @@ -593,7 +593,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up, · 2 unmodified lines | |||
| 593 | op.height = 32; | 593 | op.height = 32; |
| 594 | op.charcount = 256; | 594 | op.charcount = 256; |
| 595 | op.data = up; | 595 | op.data = up; |
| 596 | return con_font_op(vc_cons[fg_console].d, &op); | 596 | return con_font_op(vc, &op); |
| 597 | 597 | ||
| 598 | case PIO_CMAP: | 598 | case PIO_CMAP: |
| 599 | if (!perm) | 599 | if (!perm) |
| @@ -609,13 +609,13 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up, · 9 unmodified lines | |||
| 609 | 609 | ||
| 610 | fallthrough; | 610 | fallthrough; |
| 611 | case GIO_FONTX: | 611 | case GIO_FONTX: |
| 612 | return do_fontx_ioctl(cmd, up, &op); | 612 | return do_fontx_ioctl(vc, cmd, up, &op); |
| 613 | 613 | ||
| 614 | case PIO_FONTRESET: | 614 | case PIO_FONTRESET: |
| 615 | if (!perm) | 615 | if (!perm) |
| 616 | return -EPERM; | 616 | return -EPERM; |
| 617 | 617 | ||
| 618 | return vt_io_fontreset(&op); | 618 | return vt_io_fontreset(vc, &op); |
| 619 | 619 | ||
| 620 | case PIO_SCRNMAP: | 620 | case PIO_SCRNMAP: |
| 621 | if (!perm) | 621 | if (!perm) |
| @@ -1066,8 +1066,9 @@ struct compat_consolefontdesc { · 444 unmodified lines | |||
| 1066 | }; | 1066 | }; |
| 1067 | 1067 | ||
| 1068 | static inline int | 1068 | static inline int |
| 1069 | compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd, | 1069 | compat_fontx_ioctl(struct vc_data *vc, int cmd, |
| 1070 | int perm, struct console_font_op *op) | 1070 | struct compat_consolefontdesc __user *user_cfd, |
| 1071 | int perm, struct console_font_op *op) | ||
| 1071 | { | 1072 | { |
| 1072 | struct compat_consolefontdesc cfdarg; | 1073 | struct compat_consolefontdesc cfdarg; |
| 1073 | int i; | 1074 | int i; |
| @@ -1085,7 +1086,8 @@ compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd, · 11 unmodified lines | |||
| 1085 | op->height = cfdarg.charheight; | 1086 | op->height = cfdarg.charheight; |
| 1086 | op->charcount = cfdarg.charcount; | 1087 | op->charcount = cfdarg.charcount; |
| 1087 | op->data = compat_ptr(cfdarg.chardata); | 1088 | op->data = compat_ptr(cfdarg.chardata); |
| 1088 | return con_font_op(vc_cons[fg_console].d, op); | 1089 | return con_font_op(vc, op); |
| 1090 | |||
| 1089 | case GIO_FONTX: | 1091 | case GIO_FONTX: |
| 1090 | op->op = KD_FONT_OP_GET; | 1092 | op->op = KD_FONT_OP_GET; |
| 1091 | op->flags = KD_FONT_FLAG_OLD; | 1093 | op->flags = KD_FONT_FLAG_OLD; |
| @@ -1093,7 +1095,7 @@ compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd, · 1 unmodified line | |||
| 1093 | op->height = cfdarg.charheight; | 1095 | op->height = cfdarg.charheight; |
| 1094 | op->charcount = cfdarg.charcount; | 1096 | op->charcount = cfdarg.charcount; |
| 1095 | op->data = compat_ptr(cfdarg.chardata); | 1097 | op->data = compat_ptr(cfdarg.chardata); |
| 1096 | i = con_font_op(vc_cons[fg_console].d, op); | 1098 | i = con_font_op(vc, op); |
| 1097 | if (i) | 1099 | if (i) |
| 1098 | return i; | 1100 | return i; |
| 1099 | cfdarg.charheight = op->height; | 1101 | cfdarg.charheight = op->height; |
| @@ -1183,7 +1185,7 @@ long vt_compat_ioctl(struct tty_struct *tty, · 83 unmodified lines | |||
| 1183 | */ | 1185 | */ |
| 1184 | case PIO_FONTX: | 1186 | case PIO_FONTX: |
| 1185 | case GIO_FONTX: | 1187 | case GIO_FONTX: |
| 1186 | return compat_fontx_ioctl(cmd, up, perm, &op); | 1188 | return compat_fontx_ioctl(vc, cmd, up, perm, &op); |
| 1187 | 1189 | ||
| 1188 | case KDFONTOP: | 1190 | case KDFONTOP: |
| 1189 | return compat_kdfontop_ioctl(up, perm, &op, vc); | 1191 | return compat_kdfontop_ioctl(up, perm, &op, vc); |
| @@ -378,6 +378,9 @@ static const struct usb_device_id usb_quirk_list[] = { · 377 unmodified lines | |||
| 378 | { USB_DEVICE(0x0926, 0x3333), .driver_info = | 378 | { USB_DEVICE(0x0926, 0x3333), .driver_info = |
| 379 | USB_QUIRK_CONFIG_INTF_STRINGS }, | 379 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 380 | 380 | ||
| 381 | /* Kingston DataTraveler 3.0 */ | ||
| 382 | { USB_DEVICE(0x0951, 0x1666), .driver_info = USB_QUIRK_NO_LPM }, | ||
| 383 | |||
| 381 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ | 384 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ |
| 382 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, | 385 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, |
| 383 | 386 | ||
| @@ -608,10 +608,13 @@ static int dwc2_driver_probe(struct platform_device *dev) · 607 unmodified lines | |||
| 608 | #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ | 608 | #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ |
| 609 | return 0; | 609 | return 0; |
| 610 | 610 | ||
| 611 | #if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ | ||
| 612 | IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) | ||
| 611 | error_debugfs: | 613 | error_debugfs: |
| 612 | dwc2_debugfs_exit(hsotg); | 614 | dwc2_debugfs_exit(hsotg); |
| 613 | if (hsotg->hcd_enabled) | 615 | if (hsotg->hcd_enabled) |
| 614 | dwc2_hcd_remove(hsotg); | 616 | dwc2_hcd_remove(hsotg); |
| 617 | #endif | ||
| 615 | error_drd: | 618 | error_drd: |
| 616 | dwc2_drd_exit(hsotg); | 619 | dwc2_drd_exit(hsotg); |
| 617 | 620 | ||
| @@ -40,6 +40,7 @@ · 39 unmodified lines | |||
| 40 | #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee | 40 | #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee |
| 41 | #define PCI_DEVICE_ID_INTEL_TGPH 0x43ee | 41 | #define PCI_DEVICE_ID_INTEL_TGPH 0x43ee |
| 42 | #define PCI_DEVICE_ID_INTEL_JSP 0x4dee | 42 | #define PCI_DEVICE_ID_INTEL_JSP 0x4dee |
| 43 | #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1 | ||
| 43 | 44 | ||
| 44 | #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" | 45 | #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" |
| 45 | #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 | 46 | #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 |
| @@ -367,6 +368,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 321 unmodified lines | |||
| 367 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP), | 368 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP), |
| 368 | (kernel_ulong_t) &dwc3_pci_intel_properties, }, | 369 | (kernel_ulong_t) &dwc3_pci_intel_properties, }, |
| 369 | 370 | ||
| 371 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS), | ||
| 372 | (kernel_ulong_t) &dwc3_pci_intel_properties, }, | ||
| 373 | |||
| 370 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB), | 374 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB), |
| 371 | (kernel_ulong_t) &dwc3_pci_amd_properties, }, | 375 | (kernel_ulong_t) &dwc3_pci_amd_properties, }, |
| 372 | { } /* Terminating Entry */ | 376 | { } /* Terminating Entry */ |
| @@ -1058,10 +1058,11 @@ void dwc3_ep0_send_delayed_status(struct dwc3 *dwc) · 1057 unmodified lines | |||
| 1058 | { | 1058 | { |
| 1059 | unsigned int direction = !dwc->ep0_expect_in; | 1059 | unsigned int direction = !dwc->ep0_expect_in; |
| 1060 | 1060 | ||
| 1061 | dwc->delayed_status = false; | ||
| 1062 | |||
| 1061 | if (dwc->ep0state != EP0_STATUS_PHASE) | 1063 | if (dwc->ep0state != EP0_STATUS_PHASE) |
| 1062 | return; | 1064 | return; |
| 1063 | 1065 | ||
| 1064 | dwc->delayed_status = false; | ||
| 1065 | __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]); | 1066 | __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]); |
| 1066 | } | 1067 | } |
| 1067 | 1068 | ||
| @@ -564,9 +564,12 @@ static int raw_ioctl_event_fetch(struct raw_dev *dev, unsigned long value) · 563 unmodified lines | |||
| 564 | return -ENODEV; | 564 | return -ENODEV; |
| 565 | } | 565 | } |
| 566 | length = min(arg.length, event->length); | 566 | length = min(arg.length, event->length); |
| 567 | if (copy_to_user((void __user *)value, event, sizeof(*event) + length)) | 567 | if (copy_to_user((void __user *)value, event, sizeof(*event) + length)) { |
| 568 | kfree(event); | ||
| 568 | return -EFAULT; | 569 | return -EFAULT; |
| 570 | } | ||
| 569 | 571 | ||
| 572 | kfree(event); | ||
| 570 | return 0; | 573 | return 0; |
| 571 | } | 574 | } |
| 572 | 575 | ||
| @@ -1051,7 +1051,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep) · 1050 unmodified lines | |||
| 1051 | u32 bitmask; | 1051 | u32 bitmask; |
| 1052 | struct ep_queue_head *qh; | 1052 | struct ep_queue_head *qh; |
| 1053 | 1053 | ||
| 1054 | if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF)) | 1054 | if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF)) |
| 1055 | return -ENODEV; | 1055 | return -ENODEV; |
| 1056 | 1056 | ||
| 1057 | ep = container_of(_ep, struct fsl_ep, ep); | 1057 | ep = container_of(_ep, struct fsl_ep, ep); |
| @@ -1760,6 +1760,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 1759 unmodified lines | |||
| 1760 | goto err; | 1760 | goto err; |
| 1761 | } | 1761 | } |
| 1762 | 1762 | ||
| 1763 | pci_set_drvdata(pdev, dev); | ||
| 1763 | spin_lock_init(&dev->lock); | 1764 | spin_lock_init(&dev->lock); |
| 1764 | dev->pdev = pdev; | 1765 | dev->pdev = pdev; |
| 1765 | dev->gadget.ops = &goku_ops; | 1766 | dev->gadget.ops = &goku_ops; |
| @@ -1793,7 +1794,6 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 27 unmodified lines | |||
| 1793 | } | 1794 | } |
| 1794 | dev->regs = (struct goku_udc_regs __iomem *) base; | 1795 | dev->regs = (struct goku_udc_regs __iomem *) base; |
| 1795 | 1796 | ||
| 1796 | pci_set_drvdata(pdev, dev); | ||
| 1797 | INFO(dev, "%s\n", driver_desc); | 1797 | INFO(dev, "%s\n", driver_desc); |
| 1798 | INFO(dev, "version: " DRIVER_VERSION " %s\n", dmastr()); | 1798 | INFO(dev, "version: " DRIVER_VERSION " %s\n", dmastr()); |
| 1799 | INFO(dev, "irq %d, pci mem %p\n", pdev->irq, base); | 1799 | INFO(dev, "irq %d, pci mem %p\n", pdev->irq, base); |
| @@ -120,8 +120,10 @@ static int apple_mfi_fc_set_property(struct power_supply *psy, · 119 unmodified lines | |||
| 120 | dev_dbg(&mfi->udev->dev, "prop: %d\n", psp); | 120 | dev_dbg(&mfi->udev->dev, "prop: %d\n", psp); |
| 121 | 121 | ||
| 122 | ret = pm_runtime_get_sync(&mfi->udev->dev); | 122 | ret = pm_runtime_get_sync(&mfi->udev->dev); |
| 123 | if (ret < 0) | 123 | if (ret < 0) { |
| 124 | pm_runtime_put_noidle(&mfi->udev->dev); | ||
| 124 | return ret; | 125 | return ret; |
| 126 | } | ||
| 125 | 127 | ||
| 126 | switch (psp) { | 128 | switch (psp) { |
| 127 | case POWER_SUPPLY_PROP_CHARGE_TYPE: | 129 | case POWER_SUPPLY_PROP_CHARGE_TYPE: |
| @@ -564,6 +564,7 @@ static int mtu3_gadget_stop(struct usb_gadget *g) · 563 unmodified lines | |||
| 564 | 564 | ||
| 565 | spin_unlock_irqrestore(&mtu->lock, flags); | 565 | spin_unlock_irqrestore(&mtu->lock, flags); |
| 566 | 566 | ||
| 567 | synchronize_irq(mtu->irq); | ||
| 567 | return 0; | 568 | return 0; |
| 568 | } | 569 | } |
| 569 | 570 | ||
| @@ -357,11 +357,12 @@ static void cyberjack_write_bulk_callback(struct urb *urb) · 356 unmodified lines | |||
| 357 | struct device *dev = &port->dev; | 357 | struct device *dev = &port->dev; |
| 358 | int status = urb->status; | 358 | int status = urb->status; |
| 359 | unsigned long flags; | 359 | unsigned long flags; |
| 360 | bool resubmitted = false; | ||
| 360 | 361 | ||
| 361 | set_bit(0, &port->write_urbs_free); | ||
| 362 | if (status) { | 362 | if (status) { |
| 363 | dev_dbg(dev, "%s - nonzero write bulk status received: %d\n", | 363 | dev_dbg(dev, "%s - nonzero write bulk status received: %d\n", |
| 364 | __func__, status); | 364 | __func__, status); |
| 365 | set_bit(0, &port->write_urbs_free); | ||
| 365 | return; | 366 | return; |
| 366 | } | 367 | } |
| 367 | 368 | ||
| @@ -394,6 +395,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb) · 26 unmodified lines | |||
| 394 | goto exit; | 395 | goto exit; |
| 395 | } | 396 | } |
| 396 | 397 | ||
| 398 | resubmitted = true; | ||
| 399 | |||
| 397 | dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent); | 400 | dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent); |
| 398 | dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled); | 401 | dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled); |
| 399 | 402 | ||
| @@ -410,6 +413,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb) · 10 unmodified lines | |||
| 410 | 413 | ||
| 411 | exit: | 414 | exit: |
| 412 | spin_unlock_irqrestore(&priv->lock, flags); | 415 | spin_unlock_irqrestore(&priv->lock, flags); |
| 416 | if (!resubmitted) | ||
| 417 | set_bit(0, &port->write_urbs_free); | ||
| 413 | usb_serial_port_softint(port); | 418 | usb_serial_port_softint(port); |
| 414 | } | 419 | } |
| 415 | 420 | ||
| @@ -250,6 +250,7 @@ static void option_instat_callback(struct urb *urb); · 249 unmodified lines | |||
| 250 | #define QUECTEL_PRODUCT_EP06 0x0306 | 250 | #define QUECTEL_PRODUCT_EP06 0x0306 |
| 251 | #define QUECTEL_PRODUCT_EM12 0x0512 | 251 | #define QUECTEL_PRODUCT_EM12 0x0512 |
| 252 | #define QUECTEL_PRODUCT_RM500Q 0x0800 | 252 | #define QUECTEL_PRODUCT_RM500Q 0x0800 |
| 253 | #define QUECTEL_PRODUCT_EC200T 0x6026 | ||
| 253 | 254 | ||
| 254 | #define CMOTECH_VENDOR_ID 0x16d8 | 255 | #define CMOTECH_VENDOR_ID 0x16d8 |
| 255 | #define CMOTECH_PRODUCT_6001 0x6001 | 256 | #define CMOTECH_PRODUCT_6001 0x6001 |
| @@ -1117,6 +1118,7 @@ static const struct usb_device_id option_ids[] = { · 861 unmodified lines | |||
| 1117 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, | 1118 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, |
| 1118 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), | 1119 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), |
| 1119 | .driver_info = ZLP }, | 1120 | .driver_info = ZLP }, |
| 1121 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, | ||
| 1120 | 1122 | ||
| 1121 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, | 1123 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, |
| 1122 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, | 1124 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, |
| @@ -1189,6 +1191,8 @@ static const struct usb_device_id option_ids[] = { · 66 unmodified lines | |||
| 1189 | .driver_info = NCTRL(0) | RSVD(1) }, | 1191 | .driver_info = NCTRL(0) | RSVD(1) }, |
| 1190 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1054, 0xff), /* Telit FT980-KS */ | 1192 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1054, 0xff), /* Telit FT980-KS */ |
| 1191 | .driver_info = NCTRL(2) | RSVD(3) }, | 1193 | .driver_info = NCTRL(2) | RSVD(3) }, |
| 1194 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1055, 0xff), /* Telit FN980 (PCIe) */ | ||
| 1195 | .driver_info = NCTRL(0) | RSVD(1) }, | ||
| 1192 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), | 1196 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), |
| 1193 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, | 1197 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
| 1194 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), | 1198 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
| @@ -1201,6 +1205,8 @@ static const struct usb_device_id option_ids[] = { · 6 unmodified lines | |||
| 1201 | .driver_info = NCTRL(0) }, | 1205 | .driver_info = NCTRL(0) }, |
| 1202 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), | 1206 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), |
| 1203 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, | 1207 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
| 1208 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff), /* Telit LE910Cx (RNDIS) */ | ||
| 1209 | .driver_info = NCTRL(2) | RSVD(3) }, | ||
| 1204 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), | 1210 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), |
| 1205 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, | 1211 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, |
| 1206 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), | 1212 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), |
| @@ -1215,6 +1221,10 @@ static const struct usb_device_id option_ids[] = { · 8 unmodified lines | |||
| 1215 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) }, | 1221 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) }, |
| 1216 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214), | 1222 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214), |
| 1217 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, | 1223 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, |
| 1224 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1230, 0xff), /* Telit LE910Cx (rmnet) */ | ||
| 1225 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, | ||
| 1226 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1231, 0xff), /* Telit LE910Cx (RNDIS) */ | ||
| 1227 | .driver_info = NCTRL(2) | RSVD(3) }, | ||
| 1218 | { USB_DEVICE(TELIT_VENDOR_ID, 0x1260), | 1228 | { USB_DEVICE(TELIT_VENDOR_ID, 0x1260), |
| 1219 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, | 1229 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
| 1220 | { USB_DEVICE(TELIT_VENDOR_ID, 0x1261), | 1230 | { USB_DEVICE(TELIT_VENDOR_ID, 0x1261), |
| @@ -248,7 +248,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, · 247 unmodified lines | |||
| 248 | info.size = vdev->regions[info.index].size; | 248 | info.size = vdev->regions[info.index].size; |
| 249 | info.flags = vdev->regions[info.index].flags; | 249 | info.flags = vdev->regions[info.index].flags; |
| 250 | 250 | ||
| 251 | return copy_to_user((void __user *)arg, &info, minsz); | 251 | if (copy_to_user((void __user *)arg, &info, minsz)) |
| 252 | return -EFAULT; | ||
| 253 | return 0; | ||
| 252 | } | 254 | } |
| 253 | case VFIO_DEVICE_GET_IRQ_INFO: | 255 | case VFIO_DEVICE_GET_IRQ_INFO: |
| 254 | { | 256 | { |
| @@ -267,7 +269,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, · 12 unmodified lines | |||
| 267 | info.flags = VFIO_IRQ_INFO_EVENTFD; | 269 | info.flags = VFIO_IRQ_INFO_EVENTFD; |
| 268 | info.count = 1; | 270 | info.count = 1; |
| 269 | 271 | ||
| 270 | return copy_to_user((void __user *)arg, &info, minsz); | 272 | if (copy_to_user((void __user *)arg, &info, minsz)) |
| 273 | return -EFAULT; | ||
| 274 | return 0; | ||
| 271 | } | 275 | } |
| 272 | case VFIO_DEVICE_SET_IRQS: | 276 | case VFIO_DEVICE_SET_IRQS: |
| 273 | { | 277 | { |
| @@ -468,7 +472,7 @@ static int vfio_fsl_mc_mmap(void *device_data, struct vm_area_struct *vma) · 194 unmodified lines | |||
| 468 | { | 472 | { |
| 469 | struct vfio_fsl_mc_device *vdev = device_data; | 473 | struct vfio_fsl_mc_device *vdev = device_data; |
| 470 | struct fsl_mc_device *mc_dev = vdev->mc_dev; | 474 | struct fsl_mc_device *mc_dev = vdev->mc_dev; |
| 471 | int index; | 475 | unsigned int index; |
| 472 | 476 | ||
| 473 | index = vma->vm_pgoff >> (VFIO_FSL_MC_OFFSET_SHIFT - PAGE_SHIFT); | 477 | index = vma->vm_pgoff >> (VFIO_FSL_MC_OFFSET_SHIFT - PAGE_SHIFT); |
| 474 | 478 | ||
| @@ -13,7 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include "linux/fsl/mc.h" | 13 | #include "linux/fsl/mc.h" |
| 14 | #include "vfio_fsl_mc_private.h" | 14 | #include "vfio_fsl_mc_private.h" |
| 15 | 15 | ||
| 16 | int vfio_fsl_mc_irqs_allocate(struct vfio_fsl_mc_device *vdev) | 16 | static int vfio_fsl_mc_irqs_allocate(struct vfio_fsl_mc_device *vdev) |
| 17 | { | 17 | { |
| 18 | struct fsl_mc_device *mc_dev = vdev->mc_dev; | 18 | struct fsl_mc_device *mc_dev = vdev->mc_dev; |
| 19 | struct vfio_fsl_mc_irq *mc_irq; | 19 | struct vfio_fsl_mc_irq *mc_irq; |
| @@ -385,7 +385,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) · 384 unmodified lines | |||
| 385 | pdev->vendor == PCI_VENDOR_ID_INTEL && | 385 | pdev->vendor == PCI_VENDOR_ID_INTEL && |
| 386 | IS_ENABLED(CONFIG_VFIO_PCI_IGD)) { | 386 | IS_ENABLED(CONFIG_VFIO_PCI_IGD)) { |
| 387 | ret = vfio_pci_igd_init(vdev); | 387 | ret = vfio_pci_igd_init(vdev); |
| 388 | if (ret) { | 388 | if (ret && ret != -ENODEV) { |
| 389 | pci_warn(pdev, "Failed to setup Intel IGD regions\n"); | 389 | pci_warn(pdev, "Failed to setup Intel IGD regions\n"); |
| 390 | goto disable_exit; | 390 | goto disable_exit; |
| 391 | } | 391 | } |
| @@ -356,34 +356,60 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf, · 355 unmodified lines | |||
| 356 | return done; | 356 | return done; |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | static int vfio_pci_ioeventfd_handler(void *opaque, void *unused) | 359 | static void vfio_pci_ioeventfd_do_write(struct vfio_pci_ioeventfd *ioeventfd, |
| 360 | bool test_mem) | ||
| 360 | { | 361 | { |
| 361 | struct vfio_pci_ioeventfd *ioeventfd = opaque; | ||
| 362 | |||
| 363 | switch (ioeventfd->count) { | 362 | switch (ioeventfd->count) { |
| 364 | case 1: | 363 | case 1: |
| 365 | vfio_pci_iowrite8(ioeventfd->vdev, ioeventfd->test_mem, | 364 | vfio_pci_iowrite8(ioeventfd->vdev, test_mem, |
| 366 | ioeventfd->data, ioeventfd->addr); | 365 | ioeventfd->data, ioeventfd->addr); |
| 367 | break; | 366 | break; |
| 368 | case 2: | 367 | case 2: |
| 369 | vfio_pci_iowrite16(ioeventfd->vdev, ioeventfd->test_mem, | 368 | vfio_pci_iowrite16(ioeventfd->vdev, test_mem, |
| 370 | ioeventfd->data, ioeventfd->addr); | 369 | ioeventfd->data, ioeventfd->addr); |
| 371 | break; | 370 | break; |
| 372 | case 4: | 371 | case 4: |
| 373 | vfio_pci_iowrite32(ioeventfd->vdev, ioeventfd->test_mem, | 372 | vfio_pci_iowrite32(ioeventfd->vdev, test_mem, |
| 374 | ioeventfd->data, ioeventfd->addr); | 373 | ioeventfd->data, ioeventfd->addr); |
| 375 | break; | 374 | break; |
| 376 | #ifdef iowrite64 | 375 | #ifdef iowrite64 |
| 377 | case 8: | 376 | case 8: |
| 378 | vfio_pci_iowrite64(ioeventfd->vdev, ioeventfd->test_mem, | 377 | vfio_pci_iowrite64(ioeventfd->vdev, test_mem, |
| 379 | ioeventfd->data, ioeventfd->addr); | 378 | ioeventfd->data, ioeventfd->addr); |
| 380 | break; | 379 | break; |
| 381 | #endif | 380 | #endif |
| 382 | } | 381 | } |
| 382 | } | ||
| 383 | |||
| 384 | static int vfio_pci_ioeventfd_handler(void *opaque, void *unused) | ||
| 385 | { | ||
| 386 | struct vfio_pci_ioeventfd *ioeventfd = opaque; | ||
| 387 | struct vfio_pci_device *vdev = ioeventfd->vdev; | ||
| 388 | |||
| 389 | if (ioeventfd->test_mem) { | ||
| 390 | if (!down_read_trylock(&vdev->memory_lock)) | ||
| 391 | return 1; /* Lock contended, use thread */ | ||
| 392 | if (!__vfio_pci_memory_enabled(vdev)) { | ||
| 393 | up_read(&vdev->memory_lock); | ||
| 394 | return 0; | ||
| 395 | } | ||
| 396 | } | ||
| 397 | |||
| 398 | vfio_pci_ioeventfd_do_write(ioeventfd, false); | ||
| 399 | |||
| 400 | if (ioeventfd->test_mem) | ||
| 401 | up_read(&vdev->memory_lock); | ||
| 383 | 402 | ||
| 384 | return 0; | 403 | return 0; |
| 385 | } | 404 | } |
| 386 | 405 | ||
| 406 | static void vfio_pci_ioeventfd_thread(void *opaque, void *unused) | ||
| 407 | { | ||
| 408 | struct vfio_pci_ioeventfd *ioeventfd = opaque; | ||
| 409 | |||
| 410 | vfio_pci_ioeventfd_do_write(ioeventfd, ioeventfd->test_mem); | ||
| 411 | } | ||
| 412 | |||
| 387 | long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset, | 413 | long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset, |
| 388 | uint64_t data, int count, int fd) | 414 | uint64_t data, int count, int fd) |
| 389 | { | 415 | { |
| @@ -457,7 +483,8 @@ long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset, · 67 unmodified lines | |||
| 457 | ioeventfd->test_mem = vdev->pdev->resource[bar].flags & IORESOURCE_MEM; | 483 | ioeventfd->test_mem = vdev->pdev->resource[bar].flags & IORESOURCE_MEM; |
| 458 | 484 | ||
| 459 | ret = vfio_virqfd_enable(ioeventfd, vfio_pci_ioeventfd_handler, | 485 | ret = vfio_virqfd_enable(ioeventfd, vfio_pci_ioeventfd_handler, |
| 460 | NULL, NULL, &ioeventfd->virqfd, fd); | 486 | vfio_pci_ioeventfd_thread, NULL, |
| 487 | &ioeventfd->virqfd, fd); | ||
| 461 | if (ret) { | 488 | if (ret) { |
| 462 | kfree(ioeventfd); | 489 | kfree(ioeventfd); |
| 463 | goto out_unlock; | 490 | goto out_unlock; |
| @@ -267,7 +267,7 @@ static int vfio_platform_open(void *device_data) · 266 unmodified lines | |||
| 267 | 267 | ||
| 268 | ret = pm_runtime_get_sync(vdev->device); | 268 | ret = pm_runtime_get_sync(vdev->device); |
| 269 | if (ret < 0) | 269 | if (ret < 0) |
| 270 | goto err_pm; | 270 | goto err_rst; |
| 271 | 271 | ||
| 272 | ret = vfio_platform_call_reset(vdev, &extra_dbg); | 272 | ret = vfio_platform_call_reset(vdev, &extra_dbg); |
| 273 | if (ret && vdev->reset_required) { | 273 | if (ret && vdev->reset_required) { |
| @@ -284,7 +284,6 @@ static int vfio_platform_open(void *device_data) · 10 unmodified lines | |||
| 284 | 284 | ||
| 285 | err_rst: | 285 | err_rst: |
| 286 | pm_runtime_put(vdev->device); | 286 | pm_runtime_put(vdev->device); |
| 287 | err_pm: | ||
| 288 | vfio_platform_irq_cleanup(vdev); | 287 | vfio_platform_irq_cleanup(vdev); |
| 289 | err_irq: | 288 | err_irq: |
| 290 | vfio_platform_regions_cleanup(vdev); | 289 | vfio_platform_regions_cleanup(vdev); |
| @@ -1993,6 +1993,7 @@ static void vfio_iommu_iova_insert_copy(struct vfio_iommu *iommu, · 1992 unmodified lines | |||
| 1993 | 1993 | ||
| 1994 | list_splice_tail(iova_copy, iova); | 1994 | list_splice_tail(iova_copy, iova); |
| 1995 | } | 1995 | } |
| 1996 | |||
| 1996 | static int vfio_iommu_type1_attach_group(void *iommu_data, | 1997 | static int vfio_iommu_type1_attach_group(void *iommu_data, |
| 1997 | struct iommu_group *iommu_group) | 1998 | struct iommu_group *iommu_group) |
| 1998 | { | 1999 | { |
| @@ -2009,18 +2010,10 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, · 10 unmodified lines | |||
| 2009 | 2010 | ||
| 2010 | mutex_lock(&iommu->lock); | 2011 | mutex_lock(&iommu->lock); |
| 2011 | 2012 | ||
| 2012 | list_for_each_entry(d, &iommu->domain_list, next) { | 2013 | /* Check for duplicates */ |
| 2013 | if (find_iommu_group(d, iommu_group)) { | 2014 | if (vfio_iommu_find_iommu_group(iommu, iommu_group)) { |
| 2014 | mutex_unlock(&iommu->lock); | 2015 | mutex_unlock(&iommu->lock); |
| 2015 | return -EINVAL; | 2016 | return -EINVAL; |
| 2016 | } | ||
| 2017 | } | ||
| 2018 | |||
| 2019 | if (iommu->external_domain) { | ||
| 2020 | if (find_iommu_group(iommu->external_domain, iommu_group)) { | ||
| 2021 | mutex_unlock(&iommu->lock); | ||
| 2022 | return -EINVAL; | ||
| 2023 | } | ||
| 2024 | } | 2017 | } |
| 2025 | 2018 | ||
| 2026 | group = kzalloc(sizeof(*group), GFP_KERNEL); | 2019 | group = kzalloc(sizeof(*group), GFP_KERNEL); |
| @@ -148,11 +148,6 @@ static const struct xattr_handler afs_xattr_afs_acl_handler = { · 147 unmodified lines | |||
| 148 | .set = afs_xattr_set_acl, | 148 | .set = afs_xattr_set_acl, |
| 149 | }; | 149 | }; |
| 150 | 150 | ||
| 151 | static void yfs_acl_put(struct afs_operation *op) | ||
| 152 | { | ||
| 153 | yfs_free_opaque_acl(op->yacl); | ||
| 154 | } | ||
| 155 | |||
| 156 | static const struct afs_operation_ops yfs_fetch_opaque_acl_operation = { | 151 | static const struct afs_operation_ops yfs_fetch_opaque_acl_operation = { |
| 157 | .issue_yfs_rpc = yfs_fs_fetch_opaque_acl, | 152 | .issue_yfs_rpc = yfs_fs_fetch_opaque_acl, |
| 158 | .success = afs_acl_success, | 153 | .success = afs_acl_success, |
| @@ -246,7 +241,7 @@ error: · 87 unmodified lines | |||
| 246 | static const struct afs_operation_ops yfs_store_opaque_acl2_operation = { | 241 | static const struct afs_operation_ops yfs_store_opaque_acl2_operation = { |
| 247 | .issue_yfs_rpc = yfs_fs_store_opaque_acl2, | 242 | .issue_yfs_rpc = yfs_fs_store_opaque_acl2, |
| 248 | .success = afs_acl_success, | 243 | .success = afs_acl_success, |
| 249 | .put = yfs_acl_put, | 244 | .put = afs_acl_put, |
| 250 | }; | 245 | }; |
| 251 | 246 | ||
| 252 | /* | 247 | /* |
| @@ -1990,6 +1990,7 @@ void yfs_fs_store_opaque_acl2(struct afs_operation *op) · 1989 unmodified lines | |||
| 1990 | memcpy(bp, acl->data, acl->size); | 1990 | memcpy(bp, acl->data, acl->size); |
| 1991 | if (acl->size != size) | 1991 | if (acl->size != size) |
| 1992 | memset((void *)bp + acl->size, 0, size - acl->size); | 1992 | memset((void *)bp + acl->size, 0, size - acl->size); |
| 1993 | bp += size / sizeof(__be32); | ||
| 1993 | yfs_check_req(call, bp); | 1994 | yfs_check_req(call, bp); |
| 1994 | 1995 | ||
| 1995 | trace_afs_make_fs_call(call, &vp->fid); | 1996 | trace_afs_make_fs_call(call, &vp->fid); |
| @@ -4074,7 +4074,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, · 4073 unmodified lines | |||
| 4074 | vino.snap, inode); | 4074 | vino.snap, inode); |
| 4075 | 4075 | ||
| 4076 | mutex_lock(&session->s_mutex); | 4076 | mutex_lock(&session->s_mutex); |
| 4077 | session->s_seq++; | 4077 | inc_session_sequence(session); |
| 4078 | dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq, | 4078 | dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq, |
| 4079 | (unsigned)seq); | 4079 | (unsigned)seq); |
| 4080 | 4080 | ||
| @@ -4231,7 +4231,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, · 4230 unmodified lines | |||
| 4231 | dname.len, dname.name); | 4231 | dname.len, dname.name); |
| 4232 | 4232 | ||
| 4233 | mutex_lock(&session->s_mutex); | 4233 | mutex_lock(&session->s_mutex); |
| 4234 | session->s_seq++; | 4234 | inc_session_sequence(session); |
| 4235 | 4235 | ||
| 4236 | if (!inode) { | 4236 | if (!inode) { |
| 4237 | dout("handle_lease no inode %llx\n", vino.ino); | 4237 | dout("handle_lease no inode %llx\n", vino.ino); |
| @@ -4385,28 +4385,48 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc) · 147 unmodified lines | |||
| 4385 | 4385 | ||
| 4386 | bool check_session_state(struct ceph_mds_session *s) | 4386 | bool check_session_state(struct ceph_mds_session *s) |
| 4387 | { | 4387 | { |
| 4388 | if (s->s_state == CEPH_MDS_SESSION_CLOSING) { | 4388 | switch (s->s_state) { |
| 4389 | dout("resending session close request for mds%d\n", | 4389 | case CEPH_MDS_SESSION_OPEN: |
| 4390 | s->s_mds); | 4390 | if (s->s_ttl && time_after(jiffies, s->s_ttl)) { |
| 4391 | request_close_session(s); | ||
| 4392 | return false; | ||
| 4393 | } | ||
| 4394 | if (s->s_ttl && time_after(jiffies, s->s_ttl)) { | ||
| 4395 | if (s->s_state == CEPH_MDS_SESSION_OPEN) { | ||
| 4396 | s->s_state = CEPH_MDS_SESSION_HUNG; | 4391 | s->s_state = CEPH_MDS_SESSION_HUNG; |
| 4397 | pr_info("mds%d hung\n", s->s_mds); | 4392 | pr_info("mds%d hung\n", s->s_mds); |
| 4398 | } | 4393 | } |
| 4399 | } | 4394 | break; |
| 4400 | if (s->s_state == CEPH_MDS_SESSION_NEW || | 4395 | case CEPH_MDS_SESSION_CLOSING: |
| 4401 | s->s_state == CEPH_MDS_SESSION_RESTARTING || | 4396 | /* Should never reach this when we're unmounting */ |
| 4402 | s->s_state == CEPH_MDS_SESSION_CLOSED || | 4397 | WARN_ON_ONCE(true); |
| 4403 | s->s_state == CEPH_MDS_SESSION_REJECTED) | 4398 | fallthrough; |
| 4404 | /* this mds is failed or recovering, just wait */ | 4399 | case CEPH_MDS_SESSION_NEW: |
| 4400 | case CEPH_MDS_SESSION_RESTARTING: | ||
| 4401 | case CEPH_MDS_SESSION_CLOSED: | ||
| 4402 | case CEPH_MDS_SESSION_REJECTED: | ||
| 4405 | return false; | 4403 | return false; |
| 4404 | } | ||
| 4406 | 4405 | ||
| 4407 | return true; | 4406 | return true; |
| 4408 | } | 4407 | } |
| 4409 | 4408 | ||
| 4409 | /* | ||
| 4410 | * If the sequence is incremented while we're waiting on a REQUEST_CLOSE reply, | ||
| 4411 | * then we need to retransmit that request. | ||
| 4412 | */ | ||
| 4413 | void inc_session_sequence(struct ceph_mds_session *s) | ||
| 4414 | { | ||
| 4415 | lockdep_assert_held(&s->s_mutex); | ||
| 4416 | |||
| 4417 | s->s_seq++; | ||
| 4418 | |||
| 4419 | if (s->s_state == CEPH_MDS_SESSION_CLOSING) { | ||
| 4420 | int ret; | ||
| 4421 | |||
| 4422 | dout("resending session close request for mds%d\n", s->s_mds); | ||
| 4423 | ret = request_close_session(s); | ||
| 4424 | if (ret < 0) | ||
| 4425 | pr_err("unable to close session to mds%d: %d\n", | ||
| 4426 | s->s_mds, ret); | ||
| 4427 | } | ||
| 4428 | } | ||
| 4429 | |||
| 4410 | /* | 4430 | /* |
| 4411 | * delayed work -- periodically trim expired leases, renew caps with mds | 4431 | * delayed work -- periodically trim expired leases, renew caps with mds |
| 4412 | */ | 4432 | */ |
| @@ -480,6 +480,7 @@ struct ceph_mds_client { · 479 unmodified lines | |||
| 480 | extern const char *ceph_mds_op_name(int op); | 480 | extern const char *ceph_mds_op_name(int op); |
| 481 | 481 | ||
| 482 | extern bool check_session_state(struct ceph_mds_session *s); | 482 | extern bool check_session_state(struct ceph_mds_session *s); |
| 483 | void inc_session_sequence(struct ceph_mds_session *s); | ||
| 483 | 484 | ||
| 484 | extern struct ceph_mds_session * | 485 | extern struct ceph_mds_session * |
| 485 | __ceph_lookup_mds_session(struct ceph_mds_client *, int mds); | 486 | __ceph_lookup_mds_session(struct ceph_mds_client *, int mds); |
| @@ -53,7 +53,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc, · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | /* increment msg sequence number */ | 54 | /* increment msg sequence number */ |
| 55 | mutex_lock(&session->s_mutex); | 55 | mutex_lock(&session->s_mutex); |
| 56 | session->s_seq++; | 56 | inc_session_sequence(session); |
| 57 | mutex_unlock(&session->s_mutex); | 57 | mutex_unlock(&session->s_mutex); |
| 58 | 58 | ||
| 59 | /* lookup inode */ | 59 | /* lookup inode */ |
| @@ -873,7 +873,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, · 872 unmodified lines | |||
| 873 | ceph_snap_op_name(op), split, trace_len); | 873 | ceph_snap_op_name(op), split, trace_len); |
| 874 | 874 | ||
| 875 | mutex_lock(&session->s_mutex); | 875 | mutex_lock(&session->s_mutex); |
| 876 | session->s_seq++; | 876 | inc_session_sequence(session); |
| 877 | mutex_unlock(&session->s_mutex); | 877 | mutex_unlock(&session->s_mutex); |
| 878 | 878 | ||
| 879 | down_write(&mdsc->snap_rwsem); | 879 | down_write(&mdsc->snap_rwsem); |
| @@ -1078,7 +1078,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, · 1077 unmodified lines | |||
| 1078 | out_free: | 1078 | out_free: |
| 1079 | kfree(gl->gl_lksb.sb_lvbptr); | 1079 | kfree(gl->gl_lksb.sb_lvbptr); |
| 1080 | kmem_cache_free(cachep, gl); | 1080 | kmem_cache_free(cachep, gl); |
| 1081 | atomic_dec(&sdp->sd_glock_disposal); | 1081 | if (atomic_dec_and_test(&sdp->sd_glock_disposal)) |
| 1082 | wake_up(&sdp->sd_glock_wait); | ||
| 1082 | 1083 | ||
| 1083 | out: | 1084 | out: |
| 1084 | return ret; | 1085 | return ret; |
| @@ -164,6 +164,31 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) · 163 unmodified lines | |||
| 164 | GFS2_LFC_AIL_FLUSH); | 164 | GFS2_LFC_AIL_FLUSH); |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | /** | ||
| 168 | * gfs2_rgrp_metasync - sync out the metadata of a resource group | ||
| 169 | * @gl: the glock protecting the resource group | ||
| 170 | * | ||
| 171 | */ | ||
| 172 | |||
| 173 | static int gfs2_rgrp_metasync(struct gfs2_glock *gl) | ||
| 174 | { | ||
| 175 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | ||
| 176 | struct address_space *metamapping = &sdp->sd_aspace; | ||
| 177 | struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl); | ||
| 178 | const unsigned bsize = sdp->sd_sb.sb_bsize; | ||
| 179 | loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK; | ||
| 180 | loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1; | ||
| 181 | int error; | ||
| 182 | |||
| 183 | filemap_fdatawrite_range(metamapping, start, end); | ||
| 184 | error = filemap_fdatawait_range(metamapping, start, end); | ||
| 185 | WARN_ON_ONCE(error && !gfs2_withdrawn(sdp)); | ||
| 186 | mapping_set_error(metamapping, error); | ||
| 187 | if (error) | ||
| 188 | gfs2_io_error(sdp); | ||
| 189 | return error; | ||
| 190 | } | ||
| 191 | |||
| 167 | /** | 192 | /** |
| 168 | * rgrp_go_sync - sync out the metadata for this glock | 193 | * rgrp_go_sync - sync out the metadata for this glock |
| 169 | * @gl: the glock | 194 | * @gl: the glock |
| @@ -176,11 +201,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) · 6 unmodified lines | |||
| 176 | static int rgrp_go_sync(struct gfs2_glock *gl) | 201 | static int rgrp_go_sync(struct gfs2_glock *gl) |
| 177 | { | 202 | { |
| 178 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | 203 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; |
| 179 | struct address_space *mapping = &sdp->sd_aspace; | ||
| 180 | struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl); | 204 | struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl); |
| 181 | const unsigned bsize = sdp->sd_sb.sb_bsize; | ||
| 182 | loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK; | ||
| 183 | loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1; | ||
| 184 | int error; | 205 | int error; |
| 185 | 206 | ||
| 186 | if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) | 207 | if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags)) |
| @@ -189,10 +210,7 @@ static int rgrp_go_sync(struct gfs2_glock *gl) · 2 unmodified lines | |||
| 189 | 210 | ||
| 190 | gfs2_log_flush(sdp, gl, GFS2_LOG_HEAD_FLUSH_NORMAL | | 211 | gfs2_log_flush(sdp, gl, GFS2_LOG_HEAD_FLUSH_NORMAL | |
| 191 | GFS2_LFC_RGRP_GO_SYNC); | 212 | GFS2_LFC_RGRP_GO_SYNC); |
| 192 | filemap_fdatawrite_range(mapping, start, end); | 213 | error = gfs2_rgrp_metasync(gl); |
| 193 | error = filemap_fdatawait_range(mapping, start, end); | ||
| 194 | WARN_ON_ONCE(error && !gfs2_withdrawn(sdp)); | ||
| 195 | mapping_set_error(mapping, error); | ||
| 196 | if (!error) | 214 | if (!error) |
| 197 | error = gfs2_ail_empty_gl(gl); | 215 | error = gfs2_ail_empty_gl(gl); |
| 198 | gfs2_free_clones(rgd); | 216 | gfs2_free_clones(rgd); |
| @@ -266,7 +284,24 @@ static void gfs2_clear_glop_pending(struct gfs2_inode *ip) · 67 unmodified lines | |||
| 266 | } | 284 | } |
| 267 | 285 | ||
| 268 | /** | 286 | /** |
| 269 | * inode_go_sync - Sync the dirty data and/or metadata for an inode glock | 287 | * gfs2_inode_metasync - sync out the metadata of an inode |
| 288 | * @gl: the glock protecting the inode | ||
| 289 | * | ||
| 290 | */ | ||
| 291 | int gfs2_inode_metasync(struct gfs2_glock *gl) | ||
| 292 | { | ||
| 293 | struct address_space *metamapping = gfs2_glock2aspace(gl); | ||
| 294 | int error; | ||
| 295 | |||
| 296 | filemap_fdatawrite(metamapping); | ||
| 297 | error = filemap_fdatawait(metamapping); | ||
| 298 | if (error) | ||
| 299 | gfs2_io_error(gl->gl_name.ln_sbd); | ||
| 300 | return error; | ||
| 301 | } | ||
| 302 | |||
| 303 | /** | ||
| 304 | * inode_go_sync - Sync the dirty metadata of an inode | ||
| 270 | * @gl: the glock protecting the inode | 305 | * @gl: the glock protecting the inode |
| 271 | * | 306 | * |
| 272 | */ | 307 | */ |
| @@ -297,8 +332,7 @@ static int inode_go_sync(struct gfs2_glock *gl) · 24 unmodified lines | |||
| 297 | error = filemap_fdatawait(mapping); | 332 | error = filemap_fdatawait(mapping); |
| 298 | mapping_set_error(mapping, error); | 333 | mapping_set_error(mapping, error); |
| 299 | } | 334 | } |
| 300 | ret = filemap_fdatawait(metamapping); | 335 | ret = gfs2_inode_metasync(gl); |
| 301 | mapping_set_error(metamapping, ret); | ||
| 302 | if (!error) | 336 | if (!error) |
| 303 | error = ret; | 337 | error = ret; |
| 304 | gfs2_ail_empty_gl(gl); | 338 | gfs2_ail_empty_gl(gl); |
| @@ -22,6 +22,7 @@ extern const struct gfs2_glock_operations gfs2_quota_glops; · 21 unmodified lines | |||
| 22 | extern const struct gfs2_glock_operations gfs2_journal_glops; | 22 | extern const struct gfs2_glock_operations gfs2_journal_glops; |
| 23 | extern const struct gfs2_glock_operations *gfs2_glops_list[]; | 23 | extern const struct gfs2_glock_operations *gfs2_glops_list[]; |
| 24 | 24 | ||
| 25 | extern int gfs2_inode_metasync(struct gfs2_glock *gl); | ||
| 25 | extern void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync); | 26 | extern void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync); |
| 26 | 27 | ||
| 27 | #endif /* __GLOPS_DOT_H__ */ | 28 | #endif /* __GLOPS_DOT_H__ */ |
| @@ -180,7 +180,8 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type, · 179 unmodified lines | |||
| 180 | error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh); | 180 | error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh); |
| 181 | if (unlikely(error)) | 181 | if (unlikely(error)) |
| 182 | goto fail; | 182 | goto fail; |
| 183 | gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl); | 183 | if (blktype != GFS2_BLKST_UNLINKED) |
| 184 | gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl); | ||
| 184 | glock_set_object(ip->i_iopen_gh.gh_gl, ip); | 185 | glock_set_object(ip->i_iopen_gh.gh_gl, ip); |
| 185 | gfs2_glock_put(io_gl); | 186 | gfs2_glock_put(io_gl); |
| 186 | io_gl = NULL; | 187 | io_gl = NULL; |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | #include "incore.h" | 22 | #include "incore.h" |
| 23 | #include "inode.h" | 23 | #include "inode.h" |
| 24 | #include "glock.h" | 24 | #include "glock.h" |
| 25 | #include "glops.h" | ||
| 25 | #include "log.h" | 26 | #include "log.h" |
| 26 | #include "lops.h" | 27 | #include "lops.h" |
| 27 | #include "meta_io.h" | 28 | #include "meta_io.h" |
| @@ -817,41 +818,19 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start, · 789 unmodified lines | |||
| 817 | return error; | 818 | return error; |
| 818 | } | 819 | } |
| 819 | 820 | ||
| 820 | /** | ||
| 821 | * gfs2_meta_sync - Sync all buffers associated with a glock | ||
| 822 | * @gl: The glock | ||
| 823 | * | ||
| 824 | */ | ||
| 825 | |||
| 826 | void gfs2_meta_sync(struct gfs2_glock *gl) | ||
| 827 | { | ||
| 828 | struct address_space *mapping = gfs2_glock2aspace(gl); | ||
| 829 | struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; | ||
| 830 | int error; | ||
| 831 | |||
| 832 | if (mapping == NULL) | ||
| 833 | mapping = &sdp->sd_aspace; | ||
| 834 | |||
| 835 | filemap_fdatawrite(mapping); | ||
| 836 | error = filemap_fdatawait(mapping); | ||
| 837 | |||
| 838 | if (error) | ||
| 839 | gfs2_io_error(gl->gl_name.ln_sbd); | ||
| 840 | } | ||
| 841 | |||
| 842 | static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) | 821 | static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) |
| 843 | { | 822 | { |
| 844 | struct gfs2_inode *ip = GFS2_I(jd->jd_inode); | 823 | struct gfs2_inode *ip = GFS2_I(jd->jd_inode); |
| 845 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); | 824 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); |
| 846 | 825 | ||
| 847 | if (error) { | 826 | if (error) { |
| 848 | gfs2_meta_sync(ip->i_gl); | 827 | gfs2_inode_metasync(ip->i_gl); |
| 849 | return; | 828 | return; |
| 850 | } | 829 | } |
| 851 | if (pass != 1) | 830 | if (pass != 1) |
| 852 | return; | 831 | return; |
| 853 | 832 | ||
| 854 | gfs2_meta_sync(ip->i_gl); | 833 | gfs2_inode_metasync(ip->i_gl); |
| 855 | 834 | ||
| 856 | fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n", | 835 | fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n", |
| 857 | jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks); | 836 | jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks); |
| @@ -1060,14 +1039,14 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) · 202 unmodified lines | |||
| 1060 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); | 1039 | struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); |
| 1061 | 1040 | ||
| 1062 | if (error) { | 1041 | if (error) { |
| 1063 | gfs2_meta_sync(ip->i_gl); | 1042 | gfs2_inode_metasync(ip->i_gl); |
| 1064 | return; | 1043 | return; |
| 1065 | } | 1044 | } |
| 1066 | if (pass != 1) | 1045 | if (pass != 1) |
| 1067 | return; | 1046 | return; |
| 1068 | 1047 | ||
| 1069 | /* data sync? */ | 1048 | /* data sync? */ |
| 1070 | gfs2_meta_sync(ip->i_gl); | 1049 | gfs2_inode_metasync(ip->i_gl); |
| 1071 | 1050 | ||
| 1072 | fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n", | 1051 | fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n", |
| 1073 | jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks); | 1052 | jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks); |
| @@ -27,8 +27,6 @@ extern void gfs2_log_submit_bio(struct bio **biop, int opf); · 26 unmodified lines | |||
| 27 | extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); | 27 | extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); |
| 28 | extern int gfs2_find_jhead(struct gfs2_jdesc *jd, | 28 | extern int gfs2_find_jhead(struct gfs2_jdesc *jd, |
| 29 | struct gfs2_log_header_host *head, bool keep_cache); | 29 | struct gfs2_log_header_host *head, bool keep_cache); |
| 30 | extern void gfs2_meta_sync(struct gfs2_glock *gl); | ||
| 31 | |||
| 32 | static inline unsigned int buf_limit(struct gfs2_sbd *sdp) | 30 | static inline unsigned int buf_limit(struct gfs2_sbd *sdp) |
| 33 | { | 31 | { |
| 34 | unsigned int limit; | 32 | unsigned int limit; |
| @@ -633,8 +633,10 @@ static int init_statfs(struct gfs2_sbd *sdp) · 632 unmodified lines | |||
| 633 | if (IS_ERR(sdp->sd_statfs_inode)) { | 633 | if (IS_ERR(sdp->sd_statfs_inode)) { |
| 634 | error = PTR_ERR(sdp->sd_statfs_inode); | 634 | error = PTR_ERR(sdp->sd_statfs_inode); |
| 635 | fs_err(sdp, "can't read in statfs inode: %d\n", error); | 635 | fs_err(sdp, "can't read in statfs inode: %d\n", error); |
| 636 | goto fail; | 636 | goto out; |
| 637 | } | 637 | } |
| 638 | if (sdp->sd_args.ar_spectator) | ||
| 639 | goto out; | ||
| 638 | 640 | ||
| 639 | pn = gfs2_lookup_simple(master, "per_node"); | 641 | pn = gfs2_lookup_simple(master, "per_node"); |
| 640 | if (IS_ERR(pn)) { | 642 | if (IS_ERR(pn)) { |
| @@ -682,15 +684,17 @@ free_local: · 41 unmodified lines | |||
| 682 | iput(pn); | 684 | iput(pn); |
| 683 | put_statfs: | 685 | put_statfs: |
| 684 | iput(sdp->sd_statfs_inode); | 686 | iput(sdp->sd_statfs_inode); |
| 685 | fail: | 687 | out: |
| 686 | return error; | 688 | return error; |
| 687 | } | 689 | } |
| 688 | 690 | ||
| 689 | /* Uninitialize and free up memory used by the list of statfs inodes */ | 691 | /* Uninitialize and free up memory used by the list of statfs inodes */ |
| 690 | static void uninit_statfs(struct gfs2_sbd *sdp) | 692 | static void uninit_statfs(struct gfs2_sbd *sdp) |
| 691 | { | 693 | { |
| 692 | gfs2_glock_dq_uninit(&sdp->sd_sc_gh); | 694 | if (!sdp->sd_args.ar_spectator) { |
| 693 | free_local_statfs_inodes(sdp); | 695 | gfs2_glock_dq_uninit(&sdp->sd_sc_gh); |
| 696 | free_local_statfs_inodes(sdp); | ||
| 697 | } | ||
| 694 | iput(sdp->sd_statfs_inode); | 698 | iput(sdp->sd_statfs_inode); |
| 695 | } | 699 | } |
| 696 | 700 | ||
| @@ -704,7 +708,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) · 7 unmodified lines | |||
| 704 | 708 | ||
| 705 | if (undo) { | 709 | if (undo) { |
| 706 | jindex = 0; | 710 | jindex = 0; |
| 707 | goto fail_jinode_gh; | 711 | goto fail_statfs; |
| 708 | } | 712 | } |
| 709 | 713 | ||
| 710 | sdp->sd_jindex = gfs2_lookup_simple(master, "jindex"); | 714 | sdp->sd_jindex = gfs2_lookup_simple(master, "jindex"); |
| @@ -349,7 +349,7 @@ static int update_statfs_inode(struct gfs2_jdesc *jd, · 348 unmodified lines | |||
| 349 | 349 | ||
| 350 | mark_buffer_dirty(bh); | 350 | mark_buffer_dirty(bh); |
| 351 | brelse(bh); | 351 | brelse(bh); |
| 352 | gfs2_meta_sync(ip->i_gl); | 352 | gfs2_inode_metasync(ip->i_gl); |
| 353 | 353 | ||
| 354 | out: | 354 | out: |
| 355 | return error; | 355 | return error; |
| @@ -719,9 +719,9 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) · 718 unmodified lines | |||
| 719 | } | 719 | } |
| 720 | 720 | ||
| 721 | gfs2_free_clones(rgd); | 721 | gfs2_free_clones(rgd); |
| 722 | return_all_reservations(rgd); | ||
| 722 | kfree(rgd->rd_bits); | 723 | kfree(rgd->rd_bits); |
| 723 | rgd->rd_bits = NULL; | 724 | rgd->rd_bits = NULL; |
| 724 | return_all_reservations(rgd); | ||
| 725 | kmem_cache_free(gfs2_rgrpd_cachep, rgd); | 725 | kmem_cache_free(gfs2_rgrpd_cachep, rgd); |
| 726 | } | 726 | } |
| 727 | } | 727 | } |
| @@ -1370,6 +1370,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp) · 642 unmodified lines | |||
| 1370 | if (!capable(CAP_SYS_ADMIN)) | 1370 | if (!capable(CAP_SYS_ADMIN)) |
| 1371 | return -EPERM; | 1371 | return -EPERM; |
| 1372 | 1372 | ||
| 1373 | if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) | ||
| 1374 | return -EROFS; | ||
| 1375 | |||
| 1373 | if (!blk_queue_discard(q)) | 1376 | if (!blk_queue_discard(q)) |
| 1374 | return -EOPNOTSUPP; | 1377 | return -EOPNOTSUPP; |
| 1375 | 1378 | ||
| @@ -738,6 +738,7 @@ restart: · 737 unmodified lines | |||
| 738 | gfs2_jindex_free(sdp); | 738 | gfs2_jindex_free(sdp); |
| 739 | /* Take apart glock structures and buffer lists */ | 739 | /* Take apart glock structures and buffer lists */ |
| 740 | gfs2_gl_hash_clear(sdp); | 740 | gfs2_gl_hash_clear(sdp); |
| 741 | truncate_inode_pages_final(&sdp->sd_aspace); | ||
| 741 | gfs2_delete_debugfs_file(sdp); | 742 | gfs2_delete_debugfs_file(sdp); |
| 742 | /* Unmount the locking protocol */ | 743 | /* Unmount the locking protocol */ |
| 743 | gfs2_lm_unmount(sdp); | 744 | gfs2_lm_unmount(sdp); |
| @@ -482,6 +482,10 @@ static void io_impersonate_work(struct io_worker *worker, · 481 unmodified lines | |||
| 482 | current->files = work->identity->files; | 482 | current->files = work->identity->files; |
| 483 | current->nsproxy = work->identity->nsproxy; | 483 | current->nsproxy = work->identity->nsproxy; |
| 484 | task_unlock(current); | 484 | task_unlock(current); |
| 485 | if (!work->identity->files) { | ||
| 486 | /* failed grabbing files, ensure work gets cancelled */ | ||
| 487 | work->flags |= IO_WQ_WORK_CANCEL; | ||
| 488 | } | ||
| 485 | } | 489 | } |
| 486 | if ((work->flags & IO_WQ_WORK_FS) && current->fs != work->identity->fs) | 490 | if ((work->flags & IO_WQ_WORK_FS) && current->fs != work->identity->fs) |
| 487 | current->fs = work->identity->fs; | 491 | current->fs = work->identity->fs; |
| @@ -995,20 +995,33 @@ static void io_sq_thread_drop_mm(void) · 994 unmodified lines | |||
| 995 | if (mm) { | 995 | if (mm) { |
| 996 | kthread_unuse_mm(mm); | 996 | kthread_unuse_mm(mm); |
| 997 | mmput(mm); | 997 | mmput(mm); |
| 998 | current->mm = NULL; | ||
| 998 | } | 999 | } |
| 999 | } | 1000 | } |
| 1000 | 1001 | ||
| 1001 | static int __io_sq_thread_acquire_mm(struct io_ring_ctx *ctx) | 1002 | static int __io_sq_thread_acquire_mm(struct io_ring_ctx *ctx) |
| 1002 | { | 1003 | { |
| 1003 | if (!current->mm) { | 1004 | struct mm_struct *mm; |
| 1004 | if (unlikely(!(ctx->flags & IORING_SETUP_SQPOLL) || | 1005 | |
| 1005 | !ctx->sqo_task->mm || | 1006 | if (current->mm) |
| 1006 | !mmget_not_zero(ctx->sqo_task->mm))) | 1007 | return 0; |
| 1007 | return -EFAULT; | 1008 | |
| 1008 | kthread_use_mm(ctx->sqo_task->mm); | 1009 | /* Should never happen */ |
| 1010 | if (unlikely(!(ctx->flags & IORING_SETUP_SQPOLL))) | ||
| 1011 | return -EFAULT; | ||
| 1012 | |||
| 1013 | task_lock(ctx->sqo_task); | ||
| 1014 | mm = ctx->sqo_task->mm; | ||
| 1015 | if (unlikely(!mm || !mmget_not_zero(mm))) | ||
| 1016 | mm = NULL; | ||
| 1017 | task_unlock(ctx->sqo_task); | ||
| 1018 | |||
| 1019 | if (mm) { | ||
| 1020 | kthread_use_mm(mm); | ||
| 1021 | return 0; | ||
| 1009 | } | 1022 | } |
| 1010 | 1023 | ||
| 1011 | return 0; | 1024 | return -EFAULT; |
| 1012 | } | 1025 | } |
| 1013 | 1026 | ||
| 1014 | static int io_sq_thread_acquire_mm(struct io_ring_ctx *ctx, | 1027 | static int io_sq_thread_acquire_mm(struct io_ring_ctx *ctx, |
| @@ -1274,9 +1287,12 @@ static bool io_identity_cow(struct io_kiocb *req) · 259 unmodified lines | |||
| 1274 | /* add one for this request */ | 1287 | /* add one for this request */ |
| 1275 | refcount_inc(&id->count); | 1288 | refcount_inc(&id->count); |
| 1276 | 1289 | ||
| 1277 | /* drop old identity, assign new one. one ref for req, one for tctx */ | 1290 | /* drop tctx and req identity references, if needed */ |
| 1278 | if (req->work.identity != tctx->identity && | 1291 | if (tctx->identity != &tctx->__identity && |
| 1279 | refcount_sub_and_test(2, &req->work.identity->count)) | 1292 | refcount_dec_and_test(&tctx->identity->count)) |
| 1293 | kfree(tctx->identity); | ||
| 1294 | if (req->work.identity != &tctx->__identity && | ||
| 1295 | refcount_dec_and_test(&req->work.identity->count)) | ||
| 1280 | kfree(req->work.identity); | 1296 | kfree(req->work.identity); |
| 1281 | 1297 | ||
| 1282 | req->work.identity = id; | 1298 | req->work.identity = id; |
| @@ -1577,14 +1593,29 @@ static void io_cqring_mark_overflow(struct io_ring_ctx *ctx) · 294 unmodified lines | |||
| 1577 | } | 1593 | } |
| 1578 | } | 1594 | } |
| 1579 | 1595 | ||
| 1580 | static inline bool io_match_files(struct io_kiocb *req, | 1596 | static inline bool __io_match_files(struct io_kiocb *req, |
| 1581 | struct files_struct *files) | 1597 | struct files_struct *files) |
| 1582 | { | 1598 | { |
| 1599 | return ((req->flags & REQ_F_WORK_INITIALIZED) && | ||
| 1600 | (req->work.flags & IO_WQ_WORK_FILES)) && | ||
| 1601 | req->work.identity->files == files; | ||
| 1602 | } | ||
| 1603 | |||
| 1604 | static bool io_match_files(struct io_kiocb *req, | ||
| 1605 | struct files_struct *files) | ||
| 1606 | { | ||
| 1607 | struct io_kiocb *link; | ||
| 1608 | |||
| 1583 | if (!files) | 1609 | if (!files) |
| 1584 | return true; | 1610 | return true; |
| 1585 | if ((req->flags & REQ_F_WORK_INITIALIZED) && | 1611 | if (__io_match_files(req, files)) |
| 1586 | (req->work.flags & IO_WQ_WORK_FILES)) | 1612 | return true; |
| 1587 | return req->work.identity->files == files; | 1613 | if (req->flags & REQ_F_LINK_HEAD) { |
| 1614 | list_for_each_entry(link, &req->link_list, link_list) { | ||
| 1615 | if (__io_match_files(link, files)) | ||
| 1616 | return true; | ||
| 1617 | } | ||
| 1618 | } | ||
| 1588 | return false; | 1619 | return false; |
| 1589 | } | 1620 | } |
| 1590 | 1621 | ||
| @@ -1668,7 +1699,8 @@ static void __io_cqring_fill_event(struct io_kiocb *req, long res, long cflags) · 77 unmodified lines | |||
| 1668 | WRITE_ONCE(cqe->user_data, req->user_data); | 1699 | WRITE_ONCE(cqe->user_data, req->user_data); |
| 1669 | WRITE_ONCE(cqe->res, res); | 1700 | WRITE_ONCE(cqe->res, res); |
| 1670 | WRITE_ONCE(cqe->flags, cflags); | 1701 | WRITE_ONCE(cqe->flags, cflags); |
| 1671 | } else if (ctx->cq_overflow_flushed || req->task->io_uring->in_idle) { | 1702 | } else if (ctx->cq_overflow_flushed || |
| 1703 | atomic_read(&req->task->io_uring->in_idle)) { | ||
| 1672 | /* | 1704 | /* |
| 1673 | * If we're in ring overflow flush mode, or in task cancel mode, | 1705 | * If we're in ring overflow flush mode, or in task cancel mode, |
| 1674 | * then we cannot store the request for later flushing, we need | 1706 | * then we cannot store the request for later flushing, we need |
| @@ -1838,7 +1870,7 @@ static void __io_free_req(struct io_kiocb *req) · 163 unmodified lines | |||
| 1838 | io_dismantle_req(req); | 1870 | io_dismantle_req(req); |
| 1839 | 1871 | ||
| 1840 | percpu_counter_dec(&tctx->inflight); | 1872 | percpu_counter_dec(&tctx->inflight); |
| 1841 | if (tctx->in_idle) | 1873 | if (atomic_read(&tctx->in_idle)) |
| 1842 | wake_up(&tctx->wait); | 1874 | wake_up(&tctx->wait); |
| 1843 | put_task_struct(req->task); | 1875 | put_task_struct(req->task); |
| 1844 | 1876 | ||
| @@ -7695,7 +7727,8 @@ static int io_uring_alloc_task_context(struct task_struct *task) · 5850 unmodified lines | |||
| 7695 | xa_init(&tctx->xa); | 7727 | xa_init(&tctx->xa); |
| 7696 | init_waitqueue_head(&tctx->wait); | 7728 | init_waitqueue_head(&tctx->wait); |
| 7697 | tctx->last = NULL; | 7729 | tctx->last = NULL; |
| 7698 | tctx->in_idle = 0; | 7730 | atomic_set(&tctx->in_idle, 0); |
| 7731 | tctx->sqpoll = false; | ||
| 7699 | io_init_identity(&tctx->__identity); | 7732 | io_init_identity(&tctx->__identity); |
| 7700 | tctx->identity = &tctx->__identity; | 7733 | tctx->identity = &tctx->__identity; |
| 7701 | task->io_uring = tctx; | 7734 | task->io_uring = tctx; |
| @@ -8388,22 +8421,6 @@ static bool io_match_link(struct io_kiocb *preq, struct io_kiocb *req) · 686 unmodified lines | |||
| 8388 | return false; | 8421 | return false; |
| 8389 | } | 8422 | } |
| 8390 | 8423 | ||
| 8391 | static bool io_match_link_files(struct io_kiocb *req, | ||
| 8392 | struct files_struct *files) | ||
| 8393 | { | ||
| 8394 | struct io_kiocb *link; | ||
| 8395 | |||
| 8396 | if (io_match_files(req, files)) | ||
| 8397 | return true; | ||
| 8398 | if (req->flags & REQ_F_LINK_HEAD) { | ||
| 8399 | list_for_each_entry(link, &req->link_list, link_list) { | ||
| 8400 | if (io_match_files(link, files)) | ||
| 8401 | return true; | ||
| 8402 | } | ||
| 8403 | } | ||
| 8404 | return false; | ||
| 8405 | } | ||
| 8406 | |||
| 8407 | /* | 8424 | /* |
| 8408 | * We're looking to cancel 'req' because it's holding on to our files, but | 8425 | * We're looking to cancel 'req' because it's holding on to our files, but |
| 8409 | * 'req' could be a link to another request. See if it is, and cancel that | 8426 | * 'req' could be a link to another request. See if it is, and cancel that |
| @@ -8453,7 +8470,21 @@ static bool io_timeout_remove_link(struct io_ring_ctx *ctx, · 43 unmodified lines | |||
| 8453 | 8470 | ||
| 8454 | static bool io_cancel_link_cb(struct io_wq_work *work, void *data) | 8471 | static bool io_cancel_link_cb(struct io_wq_work *work, void *data) |
| 8455 | { | 8472 | { |
| 8456 | return io_match_link(container_of(work, struct io_kiocb, work), data); | 8473 | struct io_kiocb *req = container_of(work, struct io_kiocb, work); |
| 8474 | bool ret; | ||
| 8475 | |||
| 8476 | if (req->flags & REQ_F_LINK_TIMEOUT) { | ||
| 8477 | unsigned long flags; | ||
| 8478 | struct io_ring_ctx *ctx = req->ctx; | ||
| 8479 | |||
| 8480 | /* protect against races with linked timeouts */ | ||
| 8481 | spin_lock_irqsave(&ctx->completion_lock, flags); | ||
| 8482 | ret = io_match_link(req, data); | ||
| 8483 | spin_unlock_irqrestore(&ctx->completion_lock, flags); | ||
| 8484 | } else { | ||
| 8485 | ret = io_match_link(req, data); | ||
| 8486 | } | ||
| 8487 | return ret; | ||
| 8457 | } | 8488 | } |
| 8458 | 8489 | ||
| 8459 | static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) | 8490 | static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) |
| @@ -8479,6 +8510,7 @@ static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) · 19 unmodified lines | |||
| 8479 | } | 8510 | } |
| 8480 | 8511 | ||
| 8481 | static void io_cancel_defer_files(struct io_ring_ctx *ctx, | 8512 | static void io_cancel_defer_files(struct io_ring_ctx *ctx, |
| 8513 | struct task_struct *task, | ||
| 8482 | struct files_struct *files) | 8514 | struct files_struct *files) |
| 8483 | { | 8515 | { |
| 8484 | struct io_defer_entry *de = NULL; | 8516 | struct io_defer_entry *de = NULL; |
| @@ -8486,7 +8518,8 @@ static void io_cancel_defer_files(struct io_ring_ctx *ctx, · 1 unmodified line | |||
| 8486 | 8518 | ||
| 8487 | spin_lock_irq(&ctx->completion_lock); | 8519 | spin_lock_irq(&ctx->completion_lock); |
| 8488 | list_for_each_entry_reverse(de, &ctx->defer_list, list) { | 8520 | list_for_each_entry_reverse(de, &ctx->defer_list, list) { |
| 8489 | if (io_match_link_files(de->req, files)) { | 8521 | if (io_task_match(de->req, task) && |
| 8522 | io_match_files(de->req, files)) { | ||
| 8490 | list_cut_position(&list, &ctx->defer_list, &de->list); | 8523 | list_cut_position(&list, &ctx->defer_list, &de->list); |
| 8491 | break; | 8524 | break; |
| 8492 | } | 8525 | } |
| @@ -8512,7 +8545,6 @@ static bool io_uring_cancel_files(struct io_ring_ctx *ctx, · 19 unmodified lines | |||
| 8512 | if (list_empty_careful(&ctx->inflight_list)) | 8545 | if (list_empty_careful(&ctx->inflight_list)) |
| 8513 | return false; | 8546 | return false; |
| 8514 | 8547 | ||
| 8515 | io_cancel_defer_files(ctx, files); | ||
| 8516 | /* cancel all at once, should be faster than doing it one by one*/ | 8548 | /* cancel all at once, should be faster than doing it one by one*/ |
| 8517 | io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true); | 8549 | io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true); |
| 8518 | 8550 | ||
| @@ -8598,8 +8630,16 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx, · 79 unmodified lines | |||
| 8598 | { | 8630 | { |
| 8599 | struct task_struct *task = current; | 8631 | struct task_struct *task = current; |
| 8600 | 8632 | ||
| 8601 | if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) | 8633 | if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) { |
| 8602 | task = ctx->sq_data->thread; | 8634 | task = ctx->sq_data->thread; |
| 8635 | atomic_inc(&task->io_uring->in_idle); | ||
| 8636 | io_sq_thread_park(ctx->sq_data); | ||
| 8637 | } | ||
| 8638 | |||
| 8639 | if (files) | ||
| 8640 | io_cancel_defer_files(ctx, NULL, files); | ||
| 8641 | else | ||
| 8642 | io_cancel_defer_files(ctx, task, NULL); | ||
| 8603 | 8643 | ||
| 8604 | io_cqring_overflow_flush(ctx, true, task, files); | 8644 | io_cqring_overflow_flush(ctx, true, task, files); |
| 8605 | 8645 | ||
| @@ -8607,12 +8647,23 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx, · 1 unmodified line | |||
| 8607 | io_run_task_work(); | 8647 | io_run_task_work(); |
| 8608 | cond_resched(); | 8648 | cond_resched(); |
| 8609 | } | 8649 | } |
| 8650 | |||
| 8651 | if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) { | ||
| 8652 | atomic_dec(&task->io_uring->in_idle); | ||
| 8653 | /* | ||
| 8654 | * If the files that are going away are the ones in the thread | ||
| 8655 | * identity, clear them out. | ||
| 8656 | */ | ||
| 8657 | if (task->io_uring->identity->files == files) | ||
| 8658 | task->io_uring->identity->files = NULL; | ||
| 8659 | io_sq_thread_unpark(ctx->sq_data); | ||
| 8660 | } | ||
| 8610 | } | 8661 | } |
| 8611 | 8662 | ||
| 8612 | /* | 8663 | /* |
| 8613 | * Note that this task has used io_uring. We use it for cancelation purposes. | 8664 | * Note that this task has used io_uring. We use it for cancelation purposes. |
| 8614 | */ | 8665 | */ |
| 8615 | static int io_uring_add_task_file(struct file *file) | 8666 | static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file) |
| 8616 | { | 8667 | { |
| 8617 | struct io_uring_task *tctx = current->io_uring; | 8668 | struct io_uring_task *tctx = current->io_uring; |
| 8618 | 8669 | ||
| @@ -8634,6 +8685,14 @@ static int io_uring_add_task_file(struct file *file) · 15 unmodified lines | |||
| 8634 | tctx->last = file; | 8685 | tctx->last = file; |
| 8635 | } | 8686 | } |
| 8636 | 8687 | ||
| 8688 | /* | ||
| 8689 | * This is race safe in that the task itself is doing this, hence it | ||
| 8690 | * cannot be going through the exit/cancel paths at the same time. | ||
| 8691 | * This cannot be modified while exit/cancel is running. | ||
| 8692 | */ | ||
| 8693 | if (!tctx->sqpoll && (ctx->flags & IORING_SETUP_SQPOLL)) | ||
| 8694 | tctx->sqpoll = true; | ||
| 8695 | |||
| 8637 | return 0; | 8696 | return 0; |
| 8638 | } | 8697 | } |
| 8639 | 8698 | ||
| @@ -8675,7 +8734,7 @@ void __io_uring_files_cancel(struct files_struct *files) · 35 unmodified lines | |||
| 8675 | unsigned long index; | 8734 | unsigned long index; |
| 8676 | 8735 | ||
| 8677 | /* make sure overflow events are dropped */ | 8736 | /* make sure overflow events are dropped */ |
| 8678 | tctx->in_idle = true; | 8737 | atomic_inc(&tctx->in_idle); |
| 8679 | 8738 | ||
| 8680 | xa_for_each(&tctx->xa, index, file) { | 8739 | xa_for_each(&tctx->xa, index, file) { |
| 8681 | struct io_ring_ctx *ctx = file->private_data; | 8740 | struct io_ring_ctx *ctx = file->private_data; |
| @@ -8684,6 +8743,35 @@ void __io_uring_files_cancel(struct files_struct *files) · 2 unmodified lines | |||
| 8684 | if (files) | 8743 | if (files) |
| 8685 | io_uring_del_task_file(file); | 8744 | io_uring_del_task_file(file); |
| 8686 | } | 8745 | } |
| 8746 | |||
| 8747 | atomic_dec(&tctx->in_idle); | ||
| 8748 | } | ||
| 8749 | |||
| 8750 | static s64 tctx_inflight(struct io_uring_task *tctx) | ||
| 8751 | { | ||
| 8752 | unsigned long index; | ||
| 8753 | struct file *file; | ||
| 8754 | s64 inflight; | ||
| 8755 | |||
| 8756 | inflight = percpu_counter_sum(&tctx->inflight); | ||
| 8757 | if (!tctx->sqpoll) | ||
| 8758 | return inflight; | ||
| 8759 | |||
| 8760 | /* | ||
| 8761 | * If we have SQPOLL rings, then we need to iterate and find them, and | ||
| 8762 | * add the pending count for those. | ||
| 8763 | */ | ||
| 8764 | xa_for_each(&tctx->xa, index, file) { | ||
| 8765 | struct io_ring_ctx *ctx = file->private_data; | ||
| 8766 | |||
| 8767 | if (ctx->flags & IORING_SETUP_SQPOLL) { | ||
| 8768 | struct io_uring_task *__tctx = ctx->sqo_task->io_uring; | ||
| 8769 | |||
| 8770 | inflight += percpu_counter_sum(&__tctx->inflight); | ||
| 8771 | } | ||
| 8772 | } | ||
| 8773 | |||
| 8774 | return inflight; | ||
| 8687 | } | 8775 | } |
| 8688 | 8776 | ||
| 8689 | /* | 8777 | /* |
| @@ -8697,11 +8785,11 @@ void __io_uring_task_cancel(void) · 7 unmodified lines | |||
| 8697 | s64 inflight; | 8785 | s64 inflight; |
| 8698 | 8786 | ||
| 8699 | /* make sure overflow events are dropped */ | 8787 | /* make sure overflow events are dropped */ |
| 8700 | tctx->in_idle = true; | 8788 | atomic_inc(&tctx->in_idle); |
| 8701 | 8789 | ||
| 8702 | do { | 8790 | do { |
| 8703 | /* read completions before cancelations */ | 8791 | /* read completions before cancelations */ |
| 8704 | inflight = percpu_counter_sum(&tctx->inflight); | 8792 | inflight = tctx_inflight(tctx); |
| 8705 | if (!inflight) | 8793 | if (!inflight) |
| 8706 | break; | 8794 | break; |
| 8707 | __io_uring_files_cancel(NULL); | 8795 | __io_uring_files_cancel(NULL); |
| @@ -8712,13 +8800,13 @@ void __io_uring_task_cancel(void) · 4 unmodified lines | |||
| 8712 | * If we've seen completions, retry. This avoids a race where | 8800 | * If we've seen completions, retry. This avoids a race where |
| 8713 | * a completion comes in before we did prepare_to_wait(). | 8801 | * a completion comes in before we did prepare_to_wait(). |
| 8714 | */ | 8802 | */ |
| 8715 | if (inflight != percpu_counter_sum(&tctx->inflight)) | 8803 | if (inflight != tctx_inflight(tctx)) |
| 8716 | continue; | 8804 | continue; |
| 8717 | schedule(); | 8805 | schedule(); |
| 8718 | } while (1); | 8806 | } while (1); |
| 8719 | 8807 | ||
| 8720 | finish_wait(&tctx->wait, &wait); | 8808 | finish_wait(&tctx->wait, &wait); |
| 8721 | tctx->in_idle = false; | 8809 | atomic_dec(&tctx->in_idle); |
| 8722 | } | 8810 | } |
| 8723 | 8811 | ||
| 8724 | static int io_uring_flush(struct file *file, void *data) | 8812 | static int io_uring_flush(struct file *file, void *data) |
| @@ -8863,7 +8951,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 138 unmodified lines | |||
| 8863 | io_sqpoll_wait_sq(ctx); | 8951 | io_sqpoll_wait_sq(ctx); |
| 8864 | submitted = to_submit; | 8952 | submitted = to_submit; |
| 8865 | } else if (to_submit) { | 8953 | } else if (to_submit) { |
| 8866 | ret = io_uring_add_task_file(f.file); | 8954 | ret = io_uring_add_task_file(ctx, f.file); |
| 8867 | if (unlikely(ret)) | 8955 | if (unlikely(ret)) |
| 8868 | goto out; | 8956 | goto out; |
| 8869 | mutex_lock(&ctx->uring_lock); | 8957 | mutex_lock(&ctx->uring_lock); |
| @@ -8900,7 +8988,8 @@ out_fput: · 30 unmodified lines | |||
| 8900 | #ifdef CONFIG_PROC_FS | 8988 | #ifdef CONFIG_PROC_FS |
| 8901 | static int io_uring_show_cred(int id, void *p, void *data) | 8989 | static int io_uring_show_cred(int id, void *p, void *data) |
| 8902 | { | 8990 | { |
| 8903 | const struct cred *cred = p; | 8991 | struct io_identity *iod = p; |
| 8992 | const struct cred *cred = iod->creds; | ||
| 8904 | struct seq_file *m = data; | 8993 | struct seq_file *m = data; |
| 8905 | struct user_namespace *uns = seq_user_ns(m); | 8994 | struct user_namespace *uns = seq_user_ns(m); |
| 8906 | struct group_info *gi; | 8995 | struct group_info *gi; |
| @@ -9092,7 +9181,7 @@ err_fd: · 185 unmodified lines | |||
| 9092 | #if defined(CONFIG_UNIX) | 9181 | #if defined(CONFIG_UNIX) |
| 9093 | ctx->ring_sock->file = file; | 9182 | ctx->ring_sock->file = file; |
| 9094 | #endif | 9183 | #endif |
| 9095 | if (unlikely(io_uring_add_task_file(file))) { | 9184 | if (unlikely(io_uring_add_task_file(ctx, file))) { |
| 9096 | file = ERR_PTR(-ENOMEM); | 9185 | file = ERR_PTR(-ENOMEM); |
| 9097 | goto err_fd; | 9186 | goto err_fd; |
| 9098 | } | 9187 | } |
| @@ -1374,6 +1374,7 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, · 1373 unmodified lines | |||
| 1374 | WARN_ON_ONCE(!wpc->ioend && !list_empty(&submit_list)); | 1374 | WARN_ON_ONCE(!wpc->ioend && !list_empty(&submit_list)); |
| 1375 | WARN_ON_ONCE(!PageLocked(page)); | 1375 | WARN_ON_ONCE(!PageLocked(page)); |
| 1376 | WARN_ON_ONCE(PageWriteback(page)); | 1376 | WARN_ON_ONCE(PageWriteback(page)); |
| 1377 | WARN_ON_ONCE(PageDirty(page)); | ||
| 1377 | 1378 | ||
| 1378 | /* | 1379 | /* |
| 1379 | * We cannot cancel the ioend directly here on error. We may have | 1380 | * We cannot cancel the ioend directly here on error. We may have |
| @@ -1382,33 +1383,22 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, · 2 unmodified lines | |||
| 1382 | * appropriately. | 1383 | * appropriately. |
| 1383 | */ | 1384 | */ |
| 1384 | if (unlikely(error)) { | 1385 | if (unlikely(error)) { |
| 1386 | /* | ||
| 1387 | * Let the filesystem know what portion of the current page | ||
| 1388 | * failed to map. If the page wasn't been added to ioend, it | ||
| 1389 | * won't be affected by I/O completion and we must unlock it | ||
| 1390 | * now. | ||
| 1391 | */ | ||
| 1392 | if (wpc->ops->discard_page) | ||
| 1393 | wpc->ops->discard_page(page, file_offset); | ||
| 1385 | if (!count) { | 1394 | if (!count) { |
| 1386 | /* | ||
| 1387 | * If the current page hasn't been added to ioend, it | ||
| 1388 | * won't be affected by I/O completions and we must | ||
| 1389 | * discard and unlock it right here. | ||
| 1390 | */ | ||
| 1391 | if (wpc->ops->discard_page) | ||
| 1392 | wpc->ops->discard_page(page); | ||
| 1393 | ClearPageUptodate(page); | 1395 | ClearPageUptodate(page); |
| 1394 | unlock_page(page); | 1396 | unlock_page(page); |
| 1395 | goto done; | 1397 | goto done; |
| 1396 | } | 1398 | } |
| 1397 | |||
| 1398 | /* | ||
| 1399 | * If the page was not fully cleaned, we need to ensure that the | ||
| 1400 | * higher layers come back to it correctly. That means we need | ||
| 1401 | * to keep the page dirty, and for WB_SYNC_ALL writeback we need | ||
| 1402 | * to ensure the PAGECACHE_TAG_TOWRITE index mark is not removed | ||
| 1403 | * so another attempt to write this page in this writeback sweep | ||
| 1404 | * will be made. | ||
| 1405 | */ | ||
| 1406 | set_page_writeback_keepwrite(page); | ||
| 1407 | } else { | ||
| 1408 | clear_page_dirty_for_io(page); | ||
| 1409 | set_page_writeback(page); | ||
| 1410 | } | 1399 | } |
| 1411 | 1400 | ||
| 1401 | set_page_writeback(page); | ||
| 1412 | unlock_page(page); | 1402 | unlock_page(page); |
| 1413 | 1403 | ||
| 1414 | /* | 1404 | /* |
| @@ -1049,6 +1049,8 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count, · 1048 unmodified lines | |||
| 1049 | oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) / | 1049 | oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) / |
| 1050 | OOM_SCORE_ADJ_MAX; | 1050 | OOM_SCORE_ADJ_MAX; |
| 1051 | put_task_struct(task); | 1051 | put_task_struct(task); |
| 1052 | if (oom_adj > OOM_ADJUST_MAX) | ||
| 1053 | oom_adj = OOM_ADJUST_MAX; | ||
| 1052 | len = snprintf(buffer, sizeof(buffer), "%d\n", oom_adj); | 1054 | len = snprintf(buffer, sizeof(buffer), "%d\n", oom_adj); |
| 1053 | return simple_read_from_buffer(buf, count, ppos, buffer, len); | 1055 | return simple_read_from_buffer(buf, count, ppos, buffer, len); |
| 1054 | } | 1056 | } |
| @@ -19,7 +19,7 @@ static int cpuinfo_open(struct inode *inode, struct file *file) · 18 unmodified lines | |||
| 19 | static const struct proc_ops cpuinfo_proc_ops = { | 19 | static const struct proc_ops cpuinfo_proc_ops = { |
| 20 | .proc_flags = PROC_ENTRY_PERMANENT, | 20 | .proc_flags = PROC_ENTRY_PERMANENT, |
| 21 | .proc_open = cpuinfo_open, | 21 | .proc_open = cpuinfo_open, |
| 22 | .proc_read = seq_read, | 22 | .proc_read_iter = seq_read_iter, |
| 23 | .proc_lseek = seq_lseek, | 23 | .proc_lseek = seq_lseek, |
| 24 | .proc_release = seq_release, | 24 | .proc_release = seq_release, |
| 25 | }; | 25 | }; |
| @@ -590,7 +590,7 @@ static int proc_seq_release(struct inode *inode, struct file *file) · 589 unmodified lines | |||
| 590 | static const struct proc_ops proc_seq_ops = { | 590 | static const struct proc_ops proc_seq_ops = { |
| 591 | /* not permanent -- can call into arbitrary seq_operations */ | 591 | /* not permanent -- can call into arbitrary seq_operations */ |
| 592 | .proc_open = proc_seq_open, | 592 | .proc_open = proc_seq_open, |
| 593 | .proc_read = seq_read, | 593 | .proc_read_iter = seq_read_iter, |
| 594 | .proc_lseek = seq_lseek, | 594 | .proc_lseek = seq_lseek, |
| 595 | .proc_release = proc_seq_release, | 595 | .proc_release = proc_seq_release, |
| 596 | }; | 596 | }; |
| @@ -621,7 +621,7 @@ static int proc_single_open(struct inode *inode, struct file *file) · 24 unmodified lines | |||
| 621 | static const struct proc_ops proc_single_ops = { | 621 | static const struct proc_ops proc_single_ops = { |
| 622 | /* not permanent -- can call into arbitrary ->single_show */ | 622 | /* not permanent -- can call into arbitrary ->single_show */ |
| 623 | .proc_open = proc_single_open, | 623 | .proc_open = proc_single_open, |
| 624 | .proc_read = seq_read, | 624 | .proc_read_iter = seq_read_iter, |
| 625 | .proc_lseek = seq_lseek, | 625 | .proc_lseek = seq_lseek, |
| 626 | .proc_release = single_release, | 626 | .proc_release = single_release, |
| 627 | }; | 627 | }; |
| @@ -597,6 +597,7 @@ static const struct file_operations proc_iter_file_ops = { · 596 unmodified lines | |||
| 597 | .llseek = proc_reg_llseek, | 597 | .llseek = proc_reg_llseek, |
| 598 | .read_iter = proc_reg_read_iter, | 598 | .read_iter = proc_reg_read_iter, |
| 599 | .write = proc_reg_write, | 599 | .write = proc_reg_write, |
| 600 | .splice_read = generic_file_splice_read, | ||
| 600 | .poll = proc_reg_poll, | 601 | .poll = proc_reg_poll, |
| 601 | .unlocked_ioctl = proc_reg_unlocked_ioctl, | 602 | .unlocked_ioctl = proc_reg_unlocked_ioctl, |
| 602 | .mmap = proc_reg_mmap, | 603 | .mmap = proc_reg_mmap, |
| @@ -622,6 +623,7 @@ static const struct file_operations proc_reg_file_ops_compat = { · 19 unmodified lines | |||
| 622 | static const struct file_operations proc_iter_file_ops_compat = { | 623 | static const struct file_operations proc_iter_file_ops_compat = { |
| 623 | .llseek = proc_reg_llseek, | 624 | .llseek = proc_reg_llseek, |
| 624 | .read_iter = proc_reg_read_iter, | 625 | .read_iter = proc_reg_read_iter, |
| 626 | .splice_read = generic_file_splice_read, | ||
| 625 | .write = proc_reg_write, | 627 | .write = proc_reg_write, |
| 626 | .poll = proc_reg_poll, | 628 | .poll = proc_reg_poll, |
| 627 | .unlocked_ioctl = proc_reg_unlocked_ioctl, | 629 | .unlocked_ioctl = proc_reg_unlocked_ioctl, |
| @@ -226,7 +226,7 @@ static int stat_open(struct inode *inode, struct file *file) · 225 unmodified lines | |||
| 226 | static const struct proc_ops stat_proc_ops = { | 226 | static const struct proc_ops stat_proc_ops = { |
| 227 | .proc_flags = PROC_ENTRY_PERMANENT, | 227 | .proc_flags = PROC_ENTRY_PERMANENT, |
| 228 | .proc_open = stat_open, | 228 | .proc_open = stat_open, |
| 229 | .proc_read = seq_read, | 229 | .proc_read_iter = seq_read_iter, |
| 230 | .proc_lseek = seq_lseek, | 230 | .proc_lseek = seq_lseek, |
| 231 | .proc_release = single_release, | 231 | .proc_release = single_release, |
| 232 | }; | 232 | }; |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | |||
| 18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
| 19 | #include <linux/printk.h> | 19 | #include <linux/printk.h> |
| 20 | #include <linux/string_helpers.h> | 20 | #include <linux/string_helpers.h> |
| 21 | #include <linux/uio.h> | ||
| 21 | 22 | ||
| 22 | #include <linux/uaccess.h> | 23 | #include <linux/uaccess.h> |
| 23 | #include <asm/page.h> | 24 | #include <asm/page.h> |
| @@ -146,7 +147,28 @@ Eoverflow: · 122 unmodified lines | |||
| 146 | */ | 147 | */ |
| 147 | ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | 148 | ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) |
| 148 | { | 149 | { |
| 149 | struct seq_file *m = file->private_data; | 150 | struct iovec iov = { .iov_base = buf, .iov_len = size}; |
| 151 | struct kiocb kiocb; | ||
| 152 | struct iov_iter iter; | ||
| 153 | ssize_t ret; | ||
| 154 | |||
| 155 | init_sync_kiocb(&kiocb, file); | ||
| 156 | iov_iter_init(&iter, READ, &iov, 1, size); | ||
| 157 | |||
| 158 | kiocb.ki_pos = *ppos; | ||
| 159 | ret = seq_read_iter(&kiocb, &iter); | ||
| 160 | *ppos = kiocb.ki_pos; | ||
| 161 | return ret; | ||
| 162 | } | ||
| 163 | EXPORT_SYMBOL(seq_read); | ||
| 164 | |||
| 165 | /* | ||
| 166 | * Ready-made ->f_op->read_iter() | ||
| 167 | */ | ||
| 168 | ssize_t seq_read_iter(struct kiocb *iocb, struct iov_iter *iter) | ||
| 169 | { | ||
| 170 | struct seq_file *m = iocb->ki_filp->private_data; | ||
| 171 | size_t size = iov_iter_count(iter); | ||
| 150 | size_t copied = 0; | 172 | size_t copied = 0; |
| 151 | size_t n; | 173 | size_t n; |
| 152 | void *p; | 174 | void *p; |
| @@ -158,14 +180,14 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) · 5 unmodified lines | |||
| 158 | * if request is to read from zero offset, reset iterator to first | 180 | * if request is to read from zero offset, reset iterator to first |
| 159 | * record as it might have been already advanced by previous requests | 181 | * record as it might have been already advanced by previous requests |
| 160 | */ | 182 | */ |
| 161 | if (*ppos == 0) { | 183 | if (iocb->ki_pos == 0) { |
| 162 | m->index = 0; | 184 | m->index = 0; |
| 163 | m->count = 0; | 185 | m->count = 0; |
| 164 | } | 186 | } |
| 165 | 187 | ||
| 166 | /* Don't assume *ppos is where we left it */ | 188 | /* Don't assume ki_pos is where we left it */ |
| 167 | if (unlikely(*ppos != m->read_pos)) { | 189 | if (unlikely(iocb->ki_pos != m->read_pos)) { |
| 168 | while ((err = traverse(m, *ppos)) == -EAGAIN) | 190 | while ((err = traverse(m, iocb->ki_pos)) == -EAGAIN) |
| 169 | ; | 191 | ; |
| 170 | if (err) { | 192 | if (err) { |
| 171 | /* With prejudice... */ | 193 | /* With prejudice... */ |
| @@ -174,7 +196,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) · 2 unmodified lines | |||
| 174 | m->count = 0; | 196 | m->count = 0; |
| 175 | goto Done; | 197 | goto Done; |
| 176 | } else { | 198 | } else { |
| 177 | m->read_pos = *ppos; | 199 | m->read_pos = iocb->ki_pos; |
| 178 | } | 200 | } |
| 179 | } | 201 | } |
| 180 | 202 | ||
| @@ -187,13 +209,11 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) · 6 unmodified lines | |||
| 187 | /* if not empty - flush it first */ | 209 | /* if not empty - flush it first */ |
| 188 | if (m->count) { | 210 | if (m->count) { |
| 189 | n = min(m->count, size); | 211 | n = min(m->count, size); |
| 190 | err = copy_to_user(buf, m->buf + m->from, n); | 212 | if (copy_to_iter(m->buf + m->from, n, iter) != n) |
| 191 | if (err) | ||
| 192 | goto Efault; | 213 | goto Efault; |
| 193 | m->count -= n; | 214 | m->count -= n; |
| 194 | m->from += n; | 215 | m->from += n; |
| 195 | size -= n; | 216 | size -= n; |
| 196 | buf += n; | ||
| 197 | copied += n; | 217 | copied += n; |
| 198 | if (!size) | 218 | if (!size) |
| 199 | goto Done; | 219 | goto Done; |
| @@ -254,8 +274,7 @@ Fill: · 54 unmodified lines | |||
| 254 | } | 274 | } |
| 255 | m->op->stop(m, p); | 275 | m->op->stop(m, p); |
| 256 | n = min(m->count, size); | 276 | n = min(m->count, size); |
| 257 | err = copy_to_user(buf, m->buf, n); | 277 | if (copy_to_iter(m->buf, n, iter) != n) |
| 258 | if (err) | ||
| 259 | goto Efault; | 278 | goto Efault; |
| 260 | copied += n; | 279 | copied += n; |
| 261 | m->count -= n; | 280 | m->count -= n; |
| @@ -264,7 +283,7 @@ Done: · 2 unmodified lines | |||
| 264 | if (!copied) | 283 | if (!copied) |
| 265 | copied = err; | 284 | copied = err; |
| 266 | else { | 285 | else { |
| 267 | *ppos += copied; | 286 | iocb->ki_pos += copied; |
| 268 | m->read_pos += copied; | 287 | m->read_pos += copied; |
| 269 | } | 288 | } |
| 270 | mutex_unlock(&m->lock); | 289 | mutex_unlock(&m->lock); |
| @@ -276,7 +295,7 @@ Efault: · 5 unmodified lines | |||
| 276 | err = -EFAULT; | 295 | err = -EFAULT; |
| 277 | goto Done; | 296 | goto Done; |
| 278 | } | 297 | } |
| 279 | EXPORT_SYMBOL(seq_read); | 298 | EXPORT_SYMBOL(seq_read_iter); |
| 280 | 299 | ||
| 281 | /** | 300 | /** |
| 282 | * seq_lseek - ->llseek() method for sequential files. | 301 | * seq_lseek - ->llseek() method for sequential files. |
| @@ -2467,6 +2467,7 @@ xfs_defer_agfl_block( · 2466 unmodified lines | |||
| 2467 | new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno); | 2467 | new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno); |
| 2468 | new->xefi_blockcount = 1; | 2468 | new->xefi_blockcount = 1; |
| 2469 | new->xefi_oinfo = *oinfo; | 2469 | new->xefi_oinfo = *oinfo; |
| 2470 | new->xefi_skip_discard = false; | ||
| 2470 | 2471 | ||
| 2471 | trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1); | 2472 | trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1); |
| 2472 | 2473 | ||
| @@ -52,9 +52,9 @@ struct xfs_extent_free_item · 51 unmodified lines | |||
| 52 | { | 52 | { |
| 53 | xfs_fsblock_t xefi_startblock;/* starting fs block number */ | 53 | xfs_fsblock_t xefi_startblock;/* starting fs block number */ |
| 54 | xfs_extlen_t xefi_blockcount;/* number of blocks in extent */ | 54 | xfs_extlen_t xefi_blockcount;/* number of blocks in extent */ |
| 55 | bool xefi_skip_discard; | ||
| 55 | struct list_head xefi_list; | 56 | struct list_head xefi_list; |
| 56 | struct xfs_owner_info xefi_oinfo; /* extent owner */ | 57 | struct xfs_owner_info xefi_oinfo; /* extent owner */ |
| 57 | bool xefi_skip_discard; | ||
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | #define XFS_BMAP_MAX_NMAP 4 | 60 | #define XFS_BMAP_MAX_NMAP 4 |
| @@ -121,8 +121,7 @@ xchk_inode_flags( · 120 unmodified lines | |||
| 121 | goto bad; | 121 | goto bad; |
| 122 | 122 | ||
| 123 | /* rt flags require rt device */ | 123 | /* rt flags require rt device */ |
| 124 | if ((flags & (XFS_DIFLAG_REALTIME | XFS_DIFLAG_RTINHERIT)) && | 124 | if ((flags & XFS_DIFLAG_REALTIME) && !mp->m_rtdev_targp) |
| 125 | !mp->m_rtdev_targp) | ||
| 126 | goto bad; | 125 | goto bad; |
| 127 | 126 | ||
| 128 | /* new rt bitmap flag only valid for rbmino */ | 127 | /* new rt bitmap flag only valid for rbmino */ |
| @@ -346,8 +346,8 @@ xfs_map_blocks( · 345 unmodified lines | |||
| 346 | ssize_t count = i_blocksize(inode); | 346 | ssize_t count = i_blocksize(inode); |
| 347 | xfs_fileoff_t offset_fsb = XFS_B_TO_FSBT(mp, offset); | 347 | xfs_fileoff_t offset_fsb = XFS_B_TO_FSBT(mp, offset); |
| 348 | xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count); | 348 | xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count); |
| 349 | xfs_fileoff_t cow_fsb = NULLFILEOFF; | 349 | xfs_fileoff_t cow_fsb; |
| 350 | int whichfork = XFS_DATA_FORK; | 350 | int whichfork; |
| 351 | struct xfs_bmbt_irec imap; | 351 | struct xfs_bmbt_irec imap; |
| 352 | struct xfs_iext_cursor icur; | 352 | struct xfs_iext_cursor icur; |
| 353 | int retries = 0; | 353 | int retries = 0; |
| @@ -381,6 +381,8 @@ xfs_map_blocks( · 27 unmodified lines | |||
| 381 | * landed in a hole and we skip the block. | 381 | * landed in a hole and we skip the block. |
| 382 | */ | 382 | */ |
| 383 | retry: | 383 | retry: |
| 384 | cow_fsb = NULLFILEOFF; | ||
| 385 | whichfork = XFS_DATA_FORK; | ||
| 384 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 386 | xfs_ilock(ip, XFS_ILOCK_SHARED); |
| 385 | ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_BTREE || | 387 | ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_BTREE || |
| 386 | (ip->i_df.if_flags & XFS_IFEXTENTS)); | 388 | (ip->i_df.if_flags & XFS_IFEXTENTS)); |
| @@ -527,13 +529,15 @@ xfs_prepare_ioend( · 140 unmodified lines | |||
| 527 | */ | 529 | */ |
| 528 | static void | 530 | static void |
| 529 | xfs_discard_page( | 531 | xfs_discard_page( |
| 530 | struct page *page) | 532 | struct page *page, |
| 533 | loff_t fileoff) | ||
| 531 | { | 534 | { |
| 532 | struct inode *inode = page->mapping->host; | 535 | struct inode *inode = page->mapping->host; |
| 533 | struct xfs_inode *ip = XFS_I(inode); | 536 | struct xfs_inode *ip = XFS_I(inode); |
| 534 | struct xfs_mount *mp = ip->i_mount; | 537 | struct xfs_mount *mp = ip->i_mount; |
| 535 | loff_t offset = page_offset(page); | 538 | unsigned int pageoff = offset_in_page(fileoff); |
| 536 | xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, offset); | 539 | xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, fileoff); |
| 540 | xfs_fileoff_t pageoff_fsb = XFS_B_TO_FSBT(mp, pageoff); | ||
| 537 | int error; | 541 | int error; |
| 538 | 542 | ||
| 539 | if (XFS_FORCED_SHUTDOWN(mp)) | 543 | if (XFS_FORCED_SHUTDOWN(mp)) |
| @@ -541,14 +545,14 @@ xfs_discard_page( · 1 unmodified line | |||
| 541 | 545 | ||
| 542 | xfs_alert_ratelimited(mp, | 546 | xfs_alert_ratelimited(mp, |
| 543 | "page discard on page "PTR_FMT", inode 0x%llx, offset %llu.", | 547 | "page discard on page "PTR_FMT", inode 0x%llx, offset %llu.", |
| 544 | page, ip->i_ino, offset); | 548 | page, ip->i_ino, fileoff); |
| 545 | 549 | ||
| 546 | error = xfs_bmap_punch_delalloc_range(ip, start_fsb, | 550 | error = xfs_bmap_punch_delalloc_range(ip, start_fsb, |
| 547 | i_blocks_per_page(inode, page)); | 551 | i_blocks_per_page(inode, page) - pageoff_fsb); |
| 548 | if (error && !XFS_FORCED_SHUTDOWN(mp)) | 552 | if (error && !XFS_FORCED_SHUTDOWN(mp)) |
| 549 | xfs_alert(mp, "page discard unable to remove delalloc mapping."); | 553 | xfs_alert(mp, "page discard unable to remove delalloc mapping."); |
| 550 | out_invalidate: | 554 | out_invalidate: |
| 551 | iomap_invalidatepage(page, 0, PAGE_SIZE); | 555 | iomap_invalidatepage(page, pageoff, PAGE_SIZE - pageoff); |
| 552 | } | 556 | } |
| 553 | 557 | ||
| 554 | static const struct iomap_writeback_ops xfs_writeback_ops = { | 558 | static const struct iomap_writeback_ops xfs_writeback_ops = { |
| @@ -911,6 +911,16 @@ xfs_setattr_size( · 910 unmodified lines | |||
| 911 | error = iomap_zero_range(inode, oldsize, newsize - oldsize, | 911 | error = iomap_zero_range(inode, oldsize, newsize - oldsize, |
| 912 | &did_zeroing, &xfs_buffered_write_iomap_ops); | 912 | &did_zeroing, &xfs_buffered_write_iomap_ops); |
| 913 | } else { | 913 | } else { |
| 914 | /* | ||
| 915 | * iomap won't detect a dirty page over an unwritten block (or a | ||
| 916 | * cow block over a hole) and subsequently skips zeroing the | ||
| 917 | * newly post-EOF portion of the page. Flush the new EOF to | ||
| 918 | * convert the block before the pagecache truncate. | ||
| 919 | */ | ||
| 920 | error = filemap_write_and_wait_range(inode->i_mapping, newsize, | ||
| 921 | newsize); | ||
| 922 | if (error) | ||
| 923 | return error; | ||
| 914 | error = iomap_truncate_page(inode, newsize, &did_zeroing, | 924 | error = iomap_truncate_page(inode, newsize, &did_zeroing, |
| 915 | &xfs_buffered_write_iomap_ops); | 925 | &xfs_buffered_write_iomap_ops); |
| 916 | } | 926 | } |
| @@ -1502,7 +1502,8 @@ xfs_reflink_unshare( · 1501 unmodified lines | |||
| 1502 | &xfs_buffered_write_iomap_ops); | 1502 | &xfs_buffered_write_iomap_ops); |
| 1503 | if (error) | 1503 | if (error) |
| 1504 | goto out; | 1504 | goto out; |
| 1505 | error = filemap_write_and_wait(inode->i_mapping); | 1505 | |
| 1506 | error = filemap_write_and_wait_range(inode->i_mapping, offset, len); | ||
| 1506 | if (error) | 1507 | if (error) |
| 1507 | goto out; | 1508 | goto out; |
| 1508 | 1509 | ||
| @@ -252,13 +252,14 @@ static inline int kunit_run_all_tests(void) · 251 unmodified lines | |||
| 252 | } | 252 | } |
| 253 | #endif /* IS_BUILTIN(CONFIG_KUNIT) */ | 253 | #endif /* IS_BUILTIN(CONFIG_KUNIT) */ |
| 254 | 254 | ||
| 255 | #ifdef MODULE | ||
| 255 | /** | 256 | /** |
| 256 | * kunit_test_suites() - used to register one or more &struct kunit_suite | 257 | * kunit_test_suites_for_module() - used to register one or more |
| 257 | * with KUnit. | 258 | * &struct kunit_suite with KUnit. |
| 258 | * | 259 | * |
| 259 | * @suites_list...: a statically allocated list of &struct kunit_suite. | 260 | * @__suites: a statically allocated list of &struct kunit_suite. |
| 260 | * | 261 | * |
| 261 | * Registers @suites_list with the test framework. See &struct kunit_suite for | 262 | * Registers @__suites with the test framework. See &struct kunit_suite for |
| 262 | * more information. | 263 | * more information. |
| 263 | * | 264 | * |
| 264 | * If a test suite is built-in, module_init() gets translated into | 265 | * If a test suite is built-in, module_init() gets translated into |
| @@ -267,7 +268,6 @@ static inline int kunit_run_all_tests(void) · 2 unmodified lines | |||
| 267 | * module_{init|exit} functions for the builtin case when registering | 268 | * module_{init|exit} functions for the builtin case when registering |
| 268 | * suites via kunit_test_suites() below. | 269 | * suites via kunit_test_suites() below. |
| 269 | */ | 270 | */ |
| 270 | #ifdef MODULE | ||
| 271 | #define kunit_test_suites_for_module(__suites) \ | 271 | #define kunit_test_suites_for_module(__suites) \ |
| 272 | static int __init kunit_test_suites_init(void) \ | 272 | static int __init kunit_test_suites_init(void) \ |
| 273 | { \ | 273 | { \ |
| @@ -294,7 +294,7 @@ static inline int kunit_run_all_tests(void) · 20 unmodified lines | |||
| 294 | * kunit_test_suites() - used to register one or more &struct kunit_suite | 294 | * kunit_test_suites() - used to register one or more &struct kunit_suite |
| 295 | * with KUnit. | 295 | * with KUnit. |
| 296 | * | 296 | * |
| 297 | * @suites: a statically allocated list of &struct kunit_suite. | 297 | * @__suites: a statically allocated list of &struct kunit_suite. |
| 298 | * | 298 | * |
| 299 | * Registers @suites with the test framework. See &struct kunit_suite for | 299 | * Registers @suites with the test framework. See &struct kunit_suite for |
| 300 | * more information. | 300 | * more information. |
| @@ -308,10 +308,10 @@ static inline int kunit_run_all_tests(void) · 7 unmodified lines | |||
| 308 | * module. | 308 | * module. |
| 309 | * | 309 | * |
| 310 | */ | 310 | */ |
| 311 | #define kunit_test_suites(...) \ | 311 | #define kunit_test_suites(__suites...) \ |
| 312 | __kunit_test_suites(__UNIQUE_ID(array), \ | 312 | __kunit_test_suites(__UNIQUE_ID(array), \ |
| 313 | __UNIQUE_ID(suites), \ | 313 | __UNIQUE_ID(suites), \ |
| 314 | __VA_ARGS__) | 314 | ##__suites) |
| 315 | 315 | ||
| 316 | #define kunit_test_suite(suite) kunit_test_suites(&suite) | 316 | #define kunit_test_suite(suite) kunit_test_suites(&suite) |
| 317 | 317 | ||
| @@ -235,6 +235,8 @@ enum hctx_type { · 234 unmodified lines | |||
| 235 | * @flags: Zero or more BLK_MQ_F_* flags. | 235 | * @flags: Zero or more BLK_MQ_F_* flags. |
| 236 | * @driver_data: Pointer to data owned by the block driver that created this | 236 | * @driver_data: Pointer to data owned by the block driver that created this |
| 237 | * tag set. | 237 | * tag set. |
| 238 | * @active_queues_shared_sbitmap: | ||
| 239 | * number of active request queues per tag set. | ||
| 238 | * @__bitmap_tags: A shared tags sbitmap, used over all hctx's | 240 | * @__bitmap_tags: A shared tags sbitmap, used over all hctx's |
| 239 | * @__breserved_tags: | 241 | * @__breserved_tags: |
| 240 | * A shared reserved tags sbitmap, used over all hctx's | 242 | * A shared reserved tags sbitmap, used over all hctx's |
| @@ -61,21 +61,17 @@ static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk) · 60 unmodified lines | |||
| 61 | */ | 61 | */ |
| 62 | static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb) | 62 | static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb) |
| 63 | { | 63 | { |
| 64 | if (skb_shared(skb)) { | 64 | struct sk_buff *nskb; |
| 65 | struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); | ||
| 66 | 65 | ||
| 67 | if (likely(nskb)) { | 66 | nskb = skb_clone(skb, GFP_ATOMIC); |
| 68 | can_skb_set_owner(nskb, skb->sk); | 67 | if (unlikely(!nskb)) { |
| 69 | consume_skb(skb); | 68 | kfree_skb(skb); |
| 70 | return nskb; | 69 | return NULL; |
| 71 | } else { | ||
| 72 | kfree_skb(skb); | ||
| 73 | return NULL; | ||
| 74 | } | ||
| 75 | } | 70 | } |
| 76 | 71 | ||
| 77 | /* we can assume to have an unshared skb with proper owner */ | 72 | can_skb_set_owner(nskb, skb->sk); |
| 78 | return skb; | 73 | consume_skb(skb); |
| 74 | return nskb; | ||
| 79 | } | 75 | } |
| 80 | 76 | ||
| 81 | #endif /* !_CAN_SKB_H */ | 77 | #endif /* !_CAN_SKB_H */ |
| @@ -30,7 +30,8 @@ struct io_uring_task { · 29 unmodified lines | |||
| 30 | struct percpu_counter inflight; | 30 | struct percpu_counter inflight; |
| 31 | struct io_identity __identity; | 31 | struct io_identity __identity; |
| 32 | struct io_identity *identity; | 32 | struct io_identity *identity; |
| 33 | bool in_idle; | 33 | atomic_t in_idle; |
| 34 | bool sqpoll; | ||
| 34 | }; | 35 | }; |
| 35 | 36 | ||
| 36 | #if defined(CONFIG_IO_URING) | 37 | #if defined(CONFIG_IO_URING) |
| @@ -221,7 +221,7 @@ struct iomap_writeback_ops { · 220 unmodified lines | |||
| 221 | * Optional, allows the file system to discard state on a page where | 221 | * Optional, allows the file system to discard state on a page where |
| 222 | * we failed to submit any I/O. | 222 | * we failed to submit any I/O. |
| 223 | */ | 223 | */ |
| 224 | void (*discard_page)(struct page *page); | 224 | void (*discard_page)(struct page *page, loff_t fileoff); |
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | struct iomap_writepage_ctx { | 227 | struct iomap_writepage_ctx { |
| @@ -2759,6 +2759,15 @@ static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma, · 2758 unmodified lines | |||
| 2759 | return VM_FAULT_NOPAGE; | 2759 | return VM_FAULT_NOPAGE; |
| 2760 | } | 2760 | } |
| 2761 | 2761 | ||
| 2762 | #ifndef io_remap_pfn_range | ||
| 2763 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, | ||
| 2764 | unsigned long addr, unsigned long pfn, | ||
| 2765 | unsigned long size, pgprot_t prot) | ||
| 2766 | { | ||
| 2767 | return remap_pfn_range(vma, addr, pfn, size, pgprot_decrypted(prot)); | ||
| 2768 | } | ||
| 2769 | #endif | ||
| 2770 | |||
| 2762 | static inline vm_fault_t vmf_error(int err) | 2771 | static inline vm_fault_t vmf_error(int err) |
| 2763 | { | 2772 | { |
| 2764 | if (err == -ENOMEM) | 2773 | if (err == -ENOMEM) |
| @@ -24,6 +24,12 @@ struct nfnl_callback { · 23 unmodified lines | |||
| 24 | const u_int16_t attr_count; /* number of nlattr's */ | 24 | const u_int16_t attr_count; /* number of nlattr's */ |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | enum nfnl_abort_action { | ||
| 28 | NFNL_ABORT_NONE = 0, | ||
| 29 | NFNL_ABORT_AUTOLOAD, | ||
| 30 | NFNL_ABORT_VALIDATE, | ||
| 31 | }; | ||
| 32 | |||
| 27 | struct nfnetlink_subsystem { | 33 | struct nfnetlink_subsystem { |
| 28 | const char *name; | 34 | const char *name; |
| 29 | __u8 subsys_id; /* nfnetlink subsystem ID */ | 35 | __u8 subsys_id; /* nfnetlink subsystem ID */ |
| @@ -31,7 +37,8 @@ struct nfnetlink_subsystem { · 1 unmodified line | |||
| 31 | const struct nfnl_callback *cb; /* callback for individual types */ | 37 | const struct nfnl_callback *cb; /* callback for individual types */ |
| 32 | struct module *owner; | 38 | struct module *owner; |
| 33 | int (*commit)(struct net *net, struct sk_buff *skb); | 39 | int (*commit)(struct net *net, struct sk_buff *skb); |
| 34 | int (*abort)(struct net *net, struct sk_buff *skb, bool autoload); | 40 | int (*abort)(struct net *net, struct sk_buff *skb, |
| 41 | enum nfnl_abort_action action); | ||
| 35 | void (*cleanup)(struct net *net); | 42 | void (*cleanup)(struct net *net); |
| 36 | bool (*valid_genid)(struct net *net, u32 genid); | 43 | bool (*valid_genid)(struct net *net, u32 genid); |
| 37 | }; | 44 | }; |
| @@ -16,7 +16,7 @@ struct ip_rt_info { · 15 unmodified lines | |||
| 16 | u_int32_t mark; | 16 | u_int32_t mark; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned addr_type); | 19 | int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned addr_type); |
| 20 | 20 | ||
| 21 | struct nf_queue_entry; | 21 | struct nf_queue_entry; |
| 22 | 22 | ||
| @@ -42,7 +42,7 @@ struct nf_ipv6_ops { · 41 unmodified lines | |||
| 42 | #if IS_MODULE(CONFIG_IPV6) | 42 | #if IS_MODULE(CONFIG_IPV6) |
| 43 | int (*chk_addr)(struct net *net, const struct in6_addr *addr, | 43 | int (*chk_addr)(struct net *net, const struct in6_addr *addr, |
| 44 | const struct net_device *dev, int strict); | 44 | const struct net_device *dev, int strict); |
| 45 | int (*route_me_harder)(struct net *net, struct sk_buff *skb); | 45 | int (*route_me_harder)(struct net *net, struct sock *sk, struct sk_buff *skb); |
| 46 | int (*dev_get_saddr)(struct net *net, const struct net_device *dev, | 46 | int (*dev_get_saddr)(struct net *net, const struct net_device *dev, |
| 47 | const struct in6_addr *daddr, unsigned int srcprefs, | 47 | const struct in6_addr *daddr, unsigned int srcprefs, |
| 48 | struct in6_addr *saddr); | 48 | struct in6_addr *saddr); |
| @@ -143,9 +143,9 @@ static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk, · 94 unmodified lines | |||
| 143 | #endif | 143 | #endif |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb); | 146 | int ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb); |
| 147 | 147 | ||
| 148 | static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) | 148 | static inline int nf_ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb) |
| 149 | { | 149 | { |
| 150 | #if IS_MODULE(CONFIG_IPV6) | 150 | #if IS_MODULE(CONFIG_IPV6) |
| 151 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); | 151 | const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); |
| @@ -153,9 +153,9 @@ static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) · 1 unmodified line | |||
| 153 | if (!v6_ops) | 153 | if (!v6_ops) |
| 154 | return -EHOSTUNREACH; | 154 | return -EHOSTUNREACH; |
| 155 | 155 | ||
| 156 | return v6_ops->route_me_harder(net, skb); | 156 | return v6_ops->route_me_harder(net, sk, skb); |
| 157 | #elif IS_BUILTIN(CONFIG_IPV6) | 157 | #elif IS_BUILTIN(CONFIG_IPV6) |
| 158 | return ip6_route_me_harder(net, skb); | 158 | return ip6_route_me_harder(net, sk, skb); |
| 159 | #else | 159 | #else |
| 160 | return -EHOSTUNREACH; | 160 | return -EHOSTUNREACH; |
| 161 | #endif | 161 | #endif |
| @@ -344,9 +344,9 @@ static inline struct page *find_get_page_flags(struct address_space *mapping, · 343 unmodified lines | |||
| 344 | /** | 344 | /** |
| 345 | * find_lock_page - locate, pin and lock a pagecache page | 345 | * find_lock_page - locate, pin and lock a pagecache page |
| 346 | * @mapping: the address_space to search | 346 | * @mapping: the address_space to search |
| 347 | * @offset: the page index | 347 | * @index: the page index |
| 348 | * | 348 | * |
| 349 | * Looks up the page cache entry at @mapping & @offset. If there is a | 349 | * Looks up the page cache entry at @mapping & @index. If there is a |
| 350 | * page cache page, it is returned locked and with an increased | 350 | * page cache page, it is returned locked and with an increased |
| 351 | * refcount. | 351 | * refcount. |
| 352 | * | 352 | * |
| @@ -363,9 +363,9 @@ static inline struct page *find_lock_page(struct address_space *mapping, · 10 unmodified lines | |||
| 363 | /** | 363 | /** |
| 364 | * find_lock_head - Locate, pin and lock a pagecache page. | 364 | * find_lock_head - Locate, pin and lock a pagecache page. |
| 365 | * @mapping: The address_space to search. | 365 | * @mapping: The address_space to search. |
| 366 | * @offset: The page index. | 366 | * @index: The page index. |
| 367 | * | 367 | * |
| 368 | * Looks up the page cache entry at @mapping & @offset. If there is a | 368 | * Looks up the page cache entry at @mapping & @index. If there is a |
| 369 | * page cache page, its head page is returned locked and with an increased | 369 | * page cache page, its head page is returned locked and with an increased |
| 370 | * refcount. | 370 | * refcount. |
| 371 | * | 371 | * |
| @@ -1427,10 +1427,6 @@ typedef unsigned int pgtbl_mod_mask; · 1426 unmodified lines | |||
| 1427 | 1427 | ||
| 1428 | #endif /* !__ASSEMBLY__ */ | 1428 | #endif /* !__ASSEMBLY__ */ |
| 1429 | 1429 | ||
| 1430 | #ifndef io_remap_pfn_range | ||
| 1431 | #define io_remap_pfn_range remap_pfn_range | ||
| 1432 | #endif | ||
| 1433 | |||
| 1434 | #ifndef has_transparent_hugepage | 1430 | #ifndef has_transparent_hugepage |
| 1435 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 1431 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| 1436 | #define has_transparent_hugepage() 1 | 1432 | #define has_transparent_hugepage() 1 |
| @@ -147,16 +147,8 @@ typedef enum { · 146 unmodified lines | |||
| 147 | PHY_INTERFACE_MODE_MAX, | 147 | PHY_INTERFACE_MODE_MAX, |
| 148 | } phy_interface_t; | 148 | } phy_interface_t; |
| 149 | 149 | ||
| 150 | /** | 150 | /* |
| 151 | * phy_supported_speeds - return all speeds currently supported by a PHY device | 151 | * phy_supported_speeds - return all speeds currently supported by a PHY device |
| 152 | * @phy: The PHY device to return supported speeds of. | ||
| 153 | * @speeds: buffer to store supported speeds in. | ||
| 154 | * @size: size of speeds buffer. | ||
| 155 | * | ||
| 156 | * Description: Returns the number of supported speeds, and fills | ||
| 157 | * the speeds buffer with the supported speeds. If speeds buffer is | ||
| 158 | * too small to contain all currently supported speeds, will return as | ||
| 159 | * many speeds as can fit. | ||
| 160 | */ | 152 | */ |
| 161 | unsigned int phy_supported_speeds(struct phy_device *phy, | 153 | unsigned int phy_supported_speeds(struct phy_device *phy, |
| 162 | unsigned int *speeds, | 154 | unsigned int *speeds, |
| @@ -1022,14 +1014,9 @@ static inline int __phy_modify_changed(struct phy_device *phydev, u32 regnum, · 859 unmodified lines | |||
| 1022 | regnum, mask, set); | 1014 | regnum, mask, set); |
| 1023 | } | 1015 | } |
| 1024 | 1016 | ||
| 1025 | /** | 1017 | /* |
| 1026 | * phy_read_mmd - Convenience function for reading a register | 1018 | * phy_read_mmd - Convenience function for reading a register |
| 1027 | * from an MMD on a given PHY. | 1019 | * from an MMD on a given PHY. |
| 1028 | * @phydev: The phy_device struct | ||
| 1029 | * @devad: The MMD to read from | ||
| 1030 | * @regnum: The register on the MMD to read | ||
| 1031 | * | ||
| 1032 | * Same rules as for phy_read(); | ||
| 1033 | */ | 1020 | */ |
| 1034 | int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); | 1021 | int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); |
| 1035 | 1022 | ||
| @@ -1064,38 +1051,21 @@ int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); · 28 unmodified lines | |||
| 1064 | __ret; \ | 1051 | __ret; \ |
| 1065 | }) | 1052 | }) |
| 1066 | 1053 | ||
| 1067 | /** | 1054 | /* |
| 1068 | * __phy_read_mmd - Convenience function for reading a register | 1055 | * __phy_read_mmd - Convenience function for reading a register |
| 1069 | * from an MMD on a given PHY. | 1056 | * from an MMD on a given PHY. |
| 1070 | * @phydev: The phy_device struct | ||
| 1071 | * @devad: The MMD to read from | ||
| 1072 | * @regnum: The register on the MMD to read | ||
| 1073 | * | ||
| 1074 | * Same rules as for __phy_read(); | ||
| 1075 | */ | 1057 | */ |
| 1076 | int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); | 1058 | int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); |
| 1077 | 1059 | ||
| 1078 | /** | 1060 | /* |
| 1079 | * phy_write_mmd - Convenience function for writing a register | 1061 | * phy_write_mmd - Convenience function for writing a register |
| 1080 | * on an MMD on a given PHY. | 1062 | * on an MMD on a given PHY. |
| 1081 | * @phydev: The phy_device struct | ||
| 1082 | * @devad: The MMD to write to | ||
| 1083 | * @regnum: The register on the MMD to read | ||
| 1084 | * @val: value to write to @regnum | ||
| 1085 | * | ||
| 1086 | * Same rules as for phy_write(); | ||
| 1087 | */ | 1063 | */ |
| 1088 | int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val); | 1064 | int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val); |
| 1089 | 1065 | ||
| 1090 | /** | 1066 | /* |
| 1091 | * __phy_write_mmd - Convenience function for writing a register | 1067 | * __phy_write_mmd - Convenience function for writing a register |
| 1092 | * on an MMD on a given PHY. | 1068 | * on an MMD on a given PHY. |
| 1093 | * @phydev: The phy_device struct | ||
| 1094 | * @devad: The MMD to write to | ||
| 1095 | * @regnum: The register on the MMD to read | ||
| 1096 | * @val: value to write to @regnum | ||
| 1097 | * | ||
| 1098 | * Same rules as for __phy_write(); | ||
| 1099 | */ | 1069 | */ |
| 1100 | int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val); | 1070 | int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val); |
| 1101 | 1071 | ||
| @@ -54,11 +54,10 @@ extern u64 pm_runtime_autosuspend_expiration(struct device *dev); · 53 unmodified lines | |||
| 54 | extern void pm_runtime_update_max_time_suspended(struct device *dev, | 54 | extern void pm_runtime_update_max_time_suspended(struct device *dev, |
| 55 | s64 delta_ns); | 55 | s64 delta_ns); |
| 56 | extern void pm_runtime_set_memalloc_noio(struct device *dev, bool enable); | 56 | extern void pm_runtime_set_memalloc_noio(struct device *dev, bool enable); |
| 57 | extern void pm_runtime_clean_up_links(struct device *dev); | ||
| 58 | extern void pm_runtime_get_suppliers(struct device *dev); | 57 | extern void pm_runtime_get_suppliers(struct device *dev); |
| 59 | extern void pm_runtime_put_suppliers(struct device *dev); | 58 | extern void pm_runtime_put_suppliers(struct device *dev); |
| 60 | extern void pm_runtime_new_link(struct device *dev); | 59 | extern void pm_runtime_new_link(struct device *dev); |
| 61 | extern void pm_runtime_drop_link(struct device *dev); | 60 | extern void pm_runtime_drop_link(struct device_link *link); |
| 62 | 61 | ||
| 63 | /** | 62 | /** |
| 64 | * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage counter. | 63 | * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage counter. |
| @@ -276,11 +275,10 @@ static inline u64 pm_runtime_autosuspend_expiration( · 211 unmodified lines | |||
| 276 | struct device *dev) { return 0; } | 275 | struct device *dev) { return 0; } |
| 277 | static inline void pm_runtime_set_memalloc_noio(struct device *dev, | 276 | static inline void pm_runtime_set_memalloc_noio(struct device *dev, |
| 278 | bool enable){} | 277 | bool enable){} |
| 279 | static inline void pm_runtime_clean_up_links(struct device *dev) {} | ||
| 280 | static inline void pm_runtime_get_suppliers(struct device *dev) {} | 278 | static inline void pm_runtime_get_suppliers(struct device *dev) {} |
| 281 | static inline void pm_runtime_put_suppliers(struct device *dev) {} | 279 | static inline void pm_runtime_put_suppliers(struct device *dev) {} |
| 282 | static inline void pm_runtime_new_link(struct device *dev) {} | 280 | static inline void pm_runtime_new_link(struct device *dev) {} |
| 283 | static inline void pm_runtime_drop_link(struct device *dev) {} | 281 | static inline void pm_runtime_drop_link(struct device_link *link) {} |
| 284 | 282 | ||
| 285 | #endif /* !CONFIG_PM */ | 283 | #endif /* !CONFIG_PM */ |
| 286 | 284 | ||
| @@ -147,24 +147,6 @@ static inline unsigned int refcount_read(const refcount_t *r) · 146 unmodified lines | |||
| 147 | return atomic_read(&r->refs); | 147 | return atomic_read(&r->refs); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | /** | ||
| 151 | * refcount_add_not_zero - add a value to a refcount unless it is 0 | ||
| 152 | * @i: the value to add to the refcount | ||
| 153 | * @r: the refcount | ||
| 154 | * | ||
| 155 | * Will saturate at REFCOUNT_SATURATED and WARN. | ||
| 156 | * | ||
| 157 | * Provides no memory ordering, it is assumed the caller has guaranteed the | ||
| 158 | * object memory to be stable (RCU, etc.). It does provide a control dependency | ||
| 159 | * and thereby orders future stores. See the comment on top. | ||
| 160 | * | ||
| 161 | * Use of this function is not recommended for the normal reference counting | ||
| 162 | * use case in which references are taken and released one at a time. In these | ||
| 163 | * cases, refcount_inc(), or one of its variants, should instead be used to | ||
| 164 | * increment a reference count. | ||
| 165 | * | ||
| 166 | * Return: false if the passed refcount is 0, true otherwise | ||
| 167 | */ | ||
| 168 | static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, int *oldp) | 150 | static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, int *oldp) |
| 169 | { | 151 | { |
| 170 | int old = refcount_read(r); | 152 | int old = refcount_read(r); |
| @@ -183,17 +165,12 @@ static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, in · 12 unmodified lines | |||
| 183 | return old; | 165 | return old; |
| 184 | } | 166 | } |
| 185 | 167 | ||
| 186 | static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r) | ||
| 187 | { | ||
| 188 | return __refcount_add_not_zero(i, r, NULL); | ||
| 189 | } | ||
| 190 | |||
| 191 | /** | 168 | /** |
| 192 | * refcount_add - add a value to a refcount | 169 | * refcount_add_not_zero - add a value to a refcount unless it is 0 |
| 193 | * @i: the value to add to the refcount | 170 | * @i: the value to add to the refcount |
| 194 | * @r: the refcount | 171 | * @r: the refcount |
| 195 | * | 172 | * |
| 196 | * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN. | 173 | * Will saturate at REFCOUNT_SATURATED and WARN. |
| 197 | * | 174 | * |
| 198 | * Provides no memory ordering, it is assumed the caller has guaranteed the | 175 | * Provides no memory ordering, it is assumed the caller has guaranteed the |
| 199 | * object memory to be stable (RCU, etc.). It does provide a control dependency | 176 | * object memory to be stable (RCU, etc.). It does provide a control dependency |
| @@ -203,7 +180,14 @@ static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r) · 3 unmodified lines | |||
| 203 | * use case in which references are taken and released one at a time. In these | 180 | * use case in which references are taken and released one at a time. In these |
| 204 | * cases, refcount_inc(), or one of its variants, should instead be used to | 181 | * cases, refcount_inc(), or one of its variants, should instead be used to |
| 205 | * increment a reference count. | 182 | * increment a reference count. |
| 183 | * | ||
| 184 | * Return: false if the passed refcount is 0, true otherwise | ||
| 206 | */ | 185 | */ |
| 186 | static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r) | ||
| 187 | { | ||
| 188 | return __refcount_add_not_zero(i, r, NULL); | ||
| 189 | } | ||
| 190 | |||
| 207 | static inline void __refcount_add(int i, refcount_t *r, int *oldp) | 191 | static inline void __refcount_add(int i, refcount_t *r, int *oldp) |
| 208 | { | 192 | { |
| 209 | int old = atomic_fetch_add_relaxed(i, &r->refs); | 193 | int old = atomic_fetch_add_relaxed(i, &r->refs); |
| @@ -217,11 +201,32 @@ static inline void __refcount_add(int i, refcount_t *r, int *oldp) · 7 unmodified lines | |||
| 217 | refcount_warn_saturate(r, REFCOUNT_ADD_OVF); | 201 | refcount_warn_saturate(r, REFCOUNT_ADD_OVF); |
| 218 | } | 202 | } |
| 219 | 203 | ||
| 204 | /** | ||
| 205 | * refcount_add - add a value to a refcount | ||
| 206 | * @i: the value to add to the refcount | ||
| 207 | * @r: the refcount | ||
| 208 | * | ||
| 209 | * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN. | ||
| 210 | * | ||
| 211 | * Provides no memory ordering, it is assumed the caller has guaranteed the | ||
| 212 | * object memory to be stable (RCU, etc.). It does provide a control dependency | ||
| 213 | * and thereby orders future stores. See the comment on top. | ||
| 214 | * | ||
| 215 | * Use of this function is not recommended for the normal reference counting | ||
| 216 | * use case in which references are taken and released one at a time. In these | ||
| 217 | * cases, refcount_inc(), or one of its variants, should instead be used to | ||
| 218 | * increment a reference count. | ||
| 219 | */ | ||
| 220 | static inline void refcount_add(int i, refcount_t *r) | 220 | static inline void refcount_add(int i, refcount_t *r) |
| 221 | { | 221 | { |
| 222 | __refcount_add(i, r, NULL); | 222 | __refcount_add(i, r, NULL); |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp) | ||
| 226 | { | ||
| 227 | return __refcount_add_not_zero(1, r, oldp); | ||
| 228 | } | ||
| 229 | |||
| 225 | /** | 230 | /** |
| 226 | * refcount_inc_not_zero - increment a refcount unless it is 0 | 231 | * refcount_inc_not_zero - increment a refcount unless it is 0 |
| 227 | * @r: the refcount to increment | 232 | * @r: the refcount to increment |
| @@ -235,14 +240,14 @@ static inline void refcount_add(int i, refcount_t *r) · 7 unmodified lines | |||
| 235 | * | 240 | * |
| 236 | * Return: true if the increment was successful, false otherwise | 241 | * Return: true if the increment was successful, false otherwise |
| 237 | */ | 242 | */ |
| 238 | static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp) | 243 | static inline __must_check bool refcount_inc_not_zero(refcount_t *r) |
| 239 | { | 244 | { |
| 240 | return __refcount_add_not_zero(1, r, oldp); | 245 | return __refcount_inc_not_zero(r, NULL); |
| 241 | } | 246 | } |
| 242 | 247 | ||
| 243 | static inline __must_check bool refcount_inc_not_zero(refcount_t *r) | 248 | static inline void __refcount_inc(refcount_t *r, int *oldp) |
| 244 | { | 249 | { |
| 245 | return __refcount_inc_not_zero(r, NULL); | 250 | __refcount_add(1, r, oldp); |
| 246 | } | 251 | } |
| 247 | 252 | ||
| 248 | /** | 253 | /** |
| @@ -257,14 +262,27 @@ static inline __must_check bool refcount_inc_not_zero(refcount_t *r) · 8 unmodified lines | |||
| 257 | * Will WARN if the refcount is 0, as this represents a possible use-after-free | 262 | * Will WARN if the refcount is 0, as this represents a possible use-after-free |
| 258 | * condition. | 263 | * condition. |
| 259 | */ | 264 | */ |
| 260 | static inline void __refcount_inc(refcount_t *r, int *oldp) | 265 | static inline void refcount_inc(refcount_t *r) |
| 261 | { | 266 | { |
| 262 | __refcount_add(1, r, oldp); | 267 | __refcount_inc(r, NULL); |
| 263 | } | 268 | } |
| 264 | 269 | ||
| 265 | static inline void refcount_inc(refcount_t *r) | 270 | static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp) |
| 266 | { | 271 | { |
| 267 | __refcount_inc(r, NULL); | 272 | int old = atomic_fetch_sub_release(i, &r->refs); |
| 273 | |||
| 274 | if (oldp) | ||
| 275 | *oldp = old; | ||
| 276 | |||
| 277 | if (old == i) { | ||
| 278 | smp_acquire__after_ctrl_dep(); | ||
| 279 | return true; | ||
| 280 | } | ||
| 281 | |||
| 282 | if (unlikely(old < 0 || old - i < 0)) | ||
| 283 | refcount_warn_saturate(r, REFCOUNT_SUB_UAF); | ||
| 284 | |||
| 285 | return false; | ||
| 268 | } | 286 | } |
| 269 | 287 | ||
| 270 | /** | 288 | /** |
| @@ -287,27 +305,14 @@ static inline void refcount_inc(refcount_t *r) · 16 unmodified lines | |||
| 287 | * | 305 | * |
| 288 | * Return: true if the resulting refcount is 0, false otherwise | 306 | * Return: true if the resulting refcount is 0, false otherwise |
| 289 | */ | 307 | */ |
| 290 | static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp) | 308 | static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r) |
| 291 | { | 309 | { |
| 292 | int old = atomic_fetch_sub_release(i, &r->refs); | 310 | return __refcount_sub_and_test(i, r, NULL); |
| 293 | |||
| 294 | if (oldp) | ||
| 295 | *oldp = old; | ||
| 296 | |||
| 297 | if (old == i) { | ||
| 298 | smp_acquire__after_ctrl_dep(); | ||
| 299 | return true; | ||
| 300 | } | ||
| 301 | |||
| 302 | if (unlikely(old < 0 || old - i < 0)) | ||
| 303 | refcount_warn_saturate(r, REFCOUNT_SUB_UAF); | ||
| 304 | |||
| 305 | return false; | ||
| 306 | } | 311 | } |
| 307 | 312 | ||
| 308 | static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r) | 313 | static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp) |
| 309 | { | 314 | { |
| 310 | return __refcount_sub_and_test(i, r, NULL); | 315 | return __refcount_sub_and_test(1, r, oldp); |
| 311 | } | 316 | } |
| 312 | 317 | ||
| 313 | /** | 318 | /** |
| @@ -323,26 +328,11 @@ static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r) · 9 unmodified lines | |||
| 323 | * | 328 | * |
| 324 | * Return: true if the resulting refcount is 0, false otherwise | 329 | * Return: true if the resulting refcount is 0, false otherwise |
| 325 | */ | 330 | */ |
| 326 | static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp) | ||
| 327 | { | ||
| 328 | return __refcount_sub_and_test(1, r, oldp); | ||
| 329 | } | ||
| 330 | |||
| 331 | static inline __must_check bool refcount_dec_and_test(refcount_t *r) | 331 | static inline __must_check bool refcount_dec_and_test(refcount_t *r) |
| 332 | { | 332 | { |
| 333 | return __refcount_dec_and_test(r, NULL); | 333 | return __refcount_dec_and_test(r, NULL); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | /** | ||
| 337 | * refcount_dec - decrement a refcount | ||
| 338 | * @r: the refcount | ||
| 339 | * | ||
| 340 | * Similar to atomic_dec(), it will WARN on underflow and fail to decrement | ||
| 341 | * when saturated at REFCOUNT_SATURATED. | ||
| 342 | * | ||
| 343 | * Provides release memory ordering, such that prior loads and stores are done | ||
| 344 | * before. | ||
| 345 | */ | ||
| 346 | static inline void __refcount_dec(refcount_t *r, int *oldp) | 336 | static inline void __refcount_dec(refcount_t *r, int *oldp) |
| 347 | { | 337 | { |
| 348 | int old = atomic_fetch_sub_release(1, &r->refs); | 338 | int old = atomic_fetch_sub_release(1, &r->refs); |
| @@ -354,6 +344,16 @@ static inline void __refcount_dec(refcount_t *r, int *oldp) · 5 unmodified lines | |||
| 354 | refcount_warn_saturate(r, REFCOUNT_DEC_LEAK); | 344 | refcount_warn_saturate(r, REFCOUNT_DEC_LEAK); |
| 355 | } | 345 | } |
| 356 | 346 | ||
| 347 | /** | ||
| 348 | * refcount_dec - decrement a refcount | ||
| 349 | * @r: the refcount | ||
| 350 | * | ||
| 351 | * Similar to atomic_dec(), it will WARN on underflow and fail to decrement | ||
| 352 | * when saturated at REFCOUNT_SATURATED. | ||
| 353 | * | ||
| 354 | * Provides release memory ordering, such that prior loads and stores are done | ||
| 355 | * before. | ||
| 356 | */ | ||
| 357 | static inline void refcount_dec(refcount_t *r) | 357 | static inline void refcount_dec(refcount_t *r) |
| 358 | { | 358 | { |
| 359 | __refcount_dec(r, NULL); | 359 | __refcount_dec(r, NULL); |
| @@ -107,6 +107,7 @@ void seq_pad(struct seq_file *m, char c); · 106 unmodified lines | |||
| 107 | char *mangle_path(char *s, const char *p, const char *esc); | 107 | char *mangle_path(char *s, const char *p, const char *esc); |
| 108 | int seq_open(struct file *, const struct seq_operations *); | 108 | int seq_open(struct file *, const struct seq_operations *); |
| 109 | ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); | 109 | ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); |
| 110 | ssize_t seq_read_iter(struct kiocb *iocb, struct iov_iter *iter); | ||
| 110 | loff_t seq_lseek(struct file *, loff_t, int); | 111 | loff_t seq_lseek(struct file *, loff_t, int); |
| 111 | int seq_release(struct inode *, struct file *); | 112 | int seq_release(struct inode *, struct file *); |
| 112 | int seq_write(struct seq_file *seq, const void *data, size_t len); | 113 | int seq_write(struct seq_file *seq, const void *data, size_t len); |
| @@ -1444,7 +1444,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy, · 1443 unmodified lines | |||
| 1444 | enum cfg80211_station_type statype); | 1444 | enum cfg80211_station_type statype); |
| 1445 | 1445 | ||
| 1446 | /** | 1446 | /** |
| 1447 | * enum station_info_rate_flags - bitrate info flags | 1447 | * enum rate_info_flags - bitrate info flags |
| 1448 | * | 1448 | * |
| 1449 | * Used by the driver to indicate the specific rate transmission | 1449 | * Used by the driver to indicate the specific rate transmission |
| 1450 | * type for 802.11n transmissions. | 1450 | * type for 802.11n transmissions. |
| @@ -1517,7 +1517,7 @@ struct rate_info { · 66 unmodified lines | |||
| 1517 | }; | 1517 | }; |
| 1518 | 1518 | ||
| 1519 | /** | 1519 | /** |
| 1520 | * enum station_info_rate_flags - bitrate info flags | 1520 | * enum bss_param_flags - bitrate info flags |
| 1521 | * | 1521 | * |
| 1522 | * Used by the driver to indicate the specific rate transmission | 1522 | * Used by the driver to indicate the specific rate transmission |
| 1523 | * type for 802.11n transmissions. | 1523 | * type for 802.11n transmissions. |
| @@ -6467,7 +6467,8 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, · 4943 unmodified lines | |||
| 6467 | struct ieee80211_channel *channel, gfp_t gfp); | 6467 | struct ieee80211_channel *channel, gfp_t gfp); |
| 6468 | 6468 | ||
| 6469 | /** | 6469 | /** |
| 6470 | * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate | 6470 | * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer |
| 6471 | * candidate | ||
| 6471 | * | 6472 | * |
| 6472 | * @dev: network device | 6473 | * @dev: network device |
| 6473 | * @macaddr: the MAC address of the new candidate | 6474 | * @macaddr: the MAC address of the new candidate |
| @@ -7606,7 +7607,7 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate); · 1132 unmodified lines | |||
| 7606 | void cfg80211_unregister_wdev(struct wireless_dev *wdev); | 7607 | void cfg80211_unregister_wdev(struct wireless_dev *wdev); |
| 7607 | 7608 | ||
| 7608 | /** | 7609 | /** |
| 7609 | * struct cfg80211_ft_event - FT Information Elements | 7610 | * struct cfg80211_ft_event_params - FT Information Elements |
| 7610 | * @ies: FT IEs | 7611 | * @ies: FT IEs |
| 7611 | * @ies_len: length of the FT IE in bytes | 7612 | * @ies_len: length of the FT IE in bytes |
| 7612 | * @target_ap: target AP's MAC address | 7613 | * @target_ap: target AP's MAC address |
| @@ -3311,7 +3311,7 @@ enum ieee80211_roc_type { · 3310 unmodified lines | |||
| 3311 | }; | 3311 | }; |
| 3312 | 3312 | ||
| 3313 | /** | 3313 | /** |
| 3314 | * enum ieee80211_reconfig_complete_type - reconfig type | 3314 | * enum ieee80211_reconfig_type - reconfig type |
| 3315 | * | 3315 | * |
| 3316 | * This enum is used by the reconfig_complete() callback to indicate what | 3316 | * This enum is used by the reconfig_complete() callback to indicate what |
| 3317 | * reconfiguration type was completed. | 3317 | * reconfiguration type was completed. |
| @@ -6334,7 +6334,8 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, · 3016 unmodified lines | |||
| 6334 | int band, struct ieee80211_sta **sta); | 6334 | int band, struct ieee80211_sta **sta); |
| 6335 | 6335 | ||
| 6336 | /** | 6336 | /** |
| 6337 | * Sanity-check and parse the radiotap header of injected frames | 6337 | * ieee80211_parse_tx_radiotap - Sanity-check and parse the radiotap header |
| 6338 | * of injected frames | ||
| 6338 | * @skb: packet injected by userspace | 6339 | * @skb: packet injected by userspace |
| 6339 | * @dev: the &struct device of this 802.11 device | 6340 | * @dev: the &struct device of this 802.11 device |
| 6340 | */ | 6341 | */ |
| @@ -6389,7 +6390,7 @@ int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr, · 48 unmodified lines | |||
| 6389 | void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf); | 6390 | void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf); |
| 6390 | 6391 | ||
| 6391 | /** | 6392 | /** |
| 6392 | * ieee80211_tdls_oper - request userspace to perform a TDLS operation | 6393 | * ieee80211_tdls_oper_request - request userspace to perform a TDLS operation |
| 6393 | * @vif: virtual interface | 6394 | * @vif: virtual interface |
| 6394 | * @peer: the peer's destination address | 6395 | * @peer: the peer's destination address |
| 6395 | * @oper: the requested TDLS operation | 6396 | * @oper: the requested TDLS operation |
| @@ -42,7 +42,7 @@ struct snd_kcontrol_new { · 41 unmodified lines | |||
| 42 | snd_ctl_elem_iface_t iface; /* interface identifier */ | 42 | snd_ctl_elem_iface_t iface; /* interface identifier */ |
| 43 | unsigned int device; /* device/client number */ | 43 | unsigned int device; /* device/client number */ |
| 44 | unsigned int subdevice; /* subdevice (substream) number */ | 44 | unsigned int subdevice; /* subdevice (substream) number */ |
| 45 | const unsigned char *name; /* ASCII name of item */ | 45 | const char *name; /* ASCII name of item */ |
| 46 | unsigned int index; /* index of item */ | 46 | unsigned int index; /* index of item */ |
| 47 | unsigned int access; /* access rights */ | 47 | unsigned int access; /* access rights */ |
| 48 | unsigned int count; /* count of same elements */ | 48 | unsigned int count; /* count of same elements */ |
| @@ -332,7 +332,8 @@ void __snd_printk(unsigned int level, const char *file, int line, · 331 unmodified lines | |||
| 332 | #define snd_BUG() WARN(1, "BUG?\n") | 332 | #define snd_BUG() WARN(1, "BUG?\n") |
| 333 | 333 | ||
| 334 | /** | 334 | /** |
| 335 | * Suppress high rates of output when CONFIG_SND_DEBUG is enabled. | 335 | * snd_printd_ratelimit - Suppress high rates of output when |
| 336 | * CONFIG_SND_DEBUG is enabled. | ||
| 336 | */ | 337 | */ |
| 337 | #define snd_printd_ratelimit() printk_ratelimit() | 338 | #define snd_printd_ratelimit() printk_ratelimit() |
| 338 | 339 | ||
| @@ -1284,8 +1284,8 @@ snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) · 1283 unmodified lines | |||
| 1284 | } | 1284 | } |
| 1285 | 1285 | ||
| 1286 | /** | 1286 | /** |
| 1287 | * snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig. | 1287 | * snd_pcm_sgbuf_get_chunk_size - Compute the max size that fits within the |
| 1288 | * page from the given size | 1288 | * contig. page from the given size |
| 1289 | * @substream: PCM substream | 1289 | * @substream: PCM substream |
| 1290 | * @ofs: byte offset | 1290 | * @ofs: byte offset |
| 1291 | * @size: byte size to examine | 1291 | * @size: byte size to examine |
| @@ -138,6 +138,7 @@ struct icmp6hdr { · 137 unmodified lines | |||
| 138 | #define ICMPV6_HDR_FIELD 0 | 138 | #define ICMPV6_HDR_FIELD 0 |
| 139 | #define ICMPV6_UNK_NEXTHDR 1 | 139 | #define ICMPV6_UNK_NEXTHDR 1 |
| 140 | #define ICMPV6_UNK_OPTION 2 | 140 | #define ICMPV6_UNK_OPTION 2 |
| 141 | #define ICMPV6_HDR_INCOMP 3 | ||
| 141 | 142 | ||
| 142 | /* | 143 | /* |
| 143 | * constants for (set|get)sockopt | 144 | * constants for (set|get)sockopt |
| @@ -144,7 +144,7 @@ struct snd_compr_metadata { · 143 unmodified lines | |||
| 144 | __u32 value[8]; | 144 | __u32 value[8]; |
| 145 | } __attribute__((packed, aligned(4))); | 145 | } __attribute__((packed, aligned(4))); |
| 146 | 146 | ||
| 147 | /** | 147 | /* |
| 148 | * compress path ioctl definitions | 148 | * compress path ioctl definitions |
| 149 | * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP | 149 | * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP |
| 150 | * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec | 150 | * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec |
| @@ -484,9 +484,6 @@ int ipu_smfc_set_watermark(struct ipu_smfc *smfc, u32 set_level, u32 clr_level); · 483 unmodified lines | |||
| 484 | 484 | ||
| 485 | enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc); | 485 | enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc); |
| 486 | enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat); | 486 | enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat); |
| 487 | enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code); | ||
| 488 | int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat); | ||
| 489 | bool ipu_pixelformat_is_planar(u32 pixelformat); | ||
| 490 | int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees, | 487 | int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees, |
| 491 | bool hflip, bool vflip); | 488 | bool hflip, bool vflip); |
| 492 | int ipu_rot_mode_to_degrees(int *degrees, enum ipu_rotate_mode mode, | 489 | int ipu_rot_mode_to_degrees(int *degrees, enum ipu_rotate_mode mode, |
| @@ -337,10 +337,10 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs) · 336 unmodified lines | |||
| 337 | * already contains a warning when RCU is not watching, so no point | 337 | * already contains a warning when RCU is not watching, so no point |
| 338 | * in having another one here. | 338 | * in having another one here. |
| 339 | */ | 339 | */ |
| 340 | lockdep_hardirqs_off(CALLER_ADDR0); | ||
| 340 | instrumentation_begin(); | 341 | instrumentation_begin(); |
| 341 | rcu_irq_enter_check_tick(); | 342 | rcu_irq_enter_check_tick(); |
| 342 | /* Use the combo lockdep/tracing function */ | 343 | trace_hardirqs_off_finish(); |
| 343 | trace_hardirqs_off(); | ||
| 344 | instrumentation_end(); | 344 | instrumentation_end(); |
| 345 | 345 | ||
| 346 | return ret; | 346 | return ret; |
| @@ -10085,6 +10085,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, · 10084 unmodified lines | |||
| 10085 | if (token == IF_SRC_FILE || token == IF_SRC_FILEADDR) { | 10085 | if (token == IF_SRC_FILE || token == IF_SRC_FILEADDR) { |
| 10086 | int fpos = token == IF_SRC_FILE ? 2 : 1; | 10086 | int fpos = token == IF_SRC_FILE ? 2 : 1; |
| 10087 | 10087 | ||
| 10088 | kfree(filename); | ||
| 10088 | filename = match_strdup(&args[fpos]); | 10089 | filename = match_strdup(&args[fpos]); |
| 10089 | if (!filename) { | 10090 | if (!filename) { |
| 10090 | ret = -ENOMEM; | 10091 | ret = -ENOMEM; |
| @@ -10131,16 +10132,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, · 40 unmodified lines | |||
| 10131 | */ | 10132 | */ |
| 10132 | ret = -EOPNOTSUPP; | 10133 | ret = -EOPNOTSUPP; |
| 10133 | if (!event->ctx->task) | 10134 | if (!event->ctx->task) |
| 10134 | goto fail_free_name; | 10135 | goto fail; |
| 10135 | 10136 | ||
| 10136 | /* look up the path and grab its inode */ | 10137 | /* look up the path and grab its inode */ |
| 10137 | ret = kern_path(filename, LOOKUP_FOLLOW, | 10138 | ret = kern_path(filename, LOOKUP_FOLLOW, |
| 10138 | &filter->path); | 10139 | &filter->path); |
| 10139 | if (ret) | 10140 | if (ret) |
| 10140 | goto fail_free_name; | 10141 | goto fail; |
| 10141 | |||
| 10142 | kfree(filename); | ||
| 10143 | filename = NULL; | ||
| 10144 | 10142 | ||
| 10145 | ret = -EINVAL; | 10143 | ret = -EINVAL; |
| 10146 | if (!filter->path.dentry || | 10144 | if (!filter->path.dentry || |
| @@ -10160,13 +10158,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, · 13 unmodified lines | |||
| 10160 | if (state != IF_STATE_ACTION) | 10158 | if (state != IF_STATE_ACTION) |
| 10161 | goto fail; | 10159 | goto fail; |
| 10162 | 10160 | ||
| 10161 | kfree(filename); | ||
| 10163 | kfree(orig); | 10162 | kfree(orig); |
| 10164 | 10163 | ||
| 10165 | return 0; | 10164 | return 0; |
| 10166 | 10165 | ||
| 10167 | fail_free_name: | ||
| 10168 | kfree(filename); | ||
| 10169 | fail: | 10166 | fail: |
| 10167 | kfree(filename); | ||
| 10170 | free_filters_list(filters); | 10168 | free_filters_list(filters); |
| 10171 | kfree(orig); | 10169 | kfree(orig); |
| 10172 | 10170 | ||
| @@ -2167,14 +2167,9 @@ static __latent_entropy struct task_struct *copy_process( · 2166 unmodified lines | |||
| 2167 | /* ok, now we should be set up.. */ | 2167 | /* ok, now we should be set up.. */ |
| 2168 | p->pid = pid_nr(pid); | 2168 | p->pid = pid_nr(pid); |
| 2169 | if (clone_flags & CLONE_THREAD) { | 2169 | if (clone_flags & CLONE_THREAD) { |
| 2170 | p->exit_signal = -1; | ||
| 2171 | p->group_leader = current->group_leader; | 2170 | p->group_leader = current->group_leader; |
| 2172 | p->tgid = current->tgid; | 2171 | p->tgid = current->tgid; |
| 2173 | } else { | 2172 | } else { |
| 2174 | if (clone_flags & CLONE_PARENT) | ||
| 2175 | p->exit_signal = current->group_leader->exit_signal; | ||
| 2176 | else | ||
| 2177 | p->exit_signal = args->exit_signal; | ||
| 2178 | p->group_leader = p; | 2173 | p->group_leader = p; |
| 2179 | p->tgid = p->pid; | 2174 | p->tgid = p->pid; |
| 2180 | } | 2175 | } |
| @@ -2218,9 +2213,14 @@ static __latent_entropy struct task_struct *copy_process( · 37 unmodified lines | |||
| 2218 | if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) { | 2213 | if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) { |
| 2219 | p->real_parent = current->real_parent; | 2214 | p->real_parent = current->real_parent; |
| 2220 | p->parent_exec_id = current->parent_exec_id; | 2215 | p->parent_exec_id = current->parent_exec_id; |
| 2216 | if (clone_flags & CLONE_THREAD) | ||
| 2217 | p->exit_signal = -1; | ||
| 2218 | else | ||
| 2219 | p->exit_signal = current->group_leader->exit_signal; | ||
| 2221 | } else { | 2220 | } else { |
| 2222 | p->real_parent = current; | 2221 | p->real_parent = current; |
| 2223 | p->parent_exec_id = current->self_exec_id; | 2222 | p->parent_exec_id = current->self_exec_id; |
| 2223 | p->exit_signal = args->exit_signal; | ||
| 2224 | } | 2224 | } |
| 2225 | 2225 | ||
| 2226 | klp_copy_process(p); | 2226 | klp_copy_process(p); |
| @@ -2380,10 +2380,22 @@ retry: · 2379 unmodified lines | |||
| 2380 | } | 2380 | } |
| 2381 | 2381 | ||
| 2382 | /* | 2382 | /* |
| 2383 | * Since we just failed the trylock; there must be an owner. | 2383 | * The trylock just failed, so either there is an owner or |
| 2384 | * there is a higher priority waiter than this one. | ||
| 2384 | */ | 2385 | */ |
| 2385 | newowner = rt_mutex_owner(&pi_state->pi_mutex); | 2386 | newowner = rt_mutex_owner(&pi_state->pi_mutex); |
| 2386 | BUG_ON(!newowner); | 2387 | /* |
| 2388 | * If the higher priority waiter has not yet taken over the | ||
| 2389 | * rtmutex then newowner is NULL. We can't return here with | ||
| 2390 | * that state because it's inconsistent vs. the user space | ||
| 2391 | * state. So drop the locks and try again. It's a valid | ||
| 2392 | * situation and not any different from the other retry | ||
| 2393 | * conditions. | ||
| 2394 | */ | ||
| 2395 | if (unlikely(!newowner)) { | ||
| 2396 | err = -EAGAIN; | ||
| 2397 | goto handle_err; | ||
| 2398 | } | ||
| 2387 | } else { | 2399 | } else { |
| 2388 | WARN_ON_ONCE(argowner != current); | 2400 | WARN_ON_ONCE(argowner != current); |
| 2389 | if (oldowner == current) { | 2401 | if (oldowner == current) { |
| @@ -225,8 +225,7 @@ static long hung_timeout_jiffies(unsigned long last_checked, · 224 unmodified lines | |||
| 225 | * Process updating of timeout sysctl | 225 | * Process updating of timeout sysctl |
| 226 | */ | 226 | */ |
| 227 | int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, | 227 | int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, |
| 228 | void __user *buffer, | 228 | void *buffer, size_t *lenp, loff_t *ppos) |
| 229 | size_t *lenp, loff_t *ppos) | ||
| 230 | { | 229 | { |
| 231 | int ret; | 230 | int ret; |
| 232 | 231 | ||
| @@ -82,6 +82,7 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS · 81 unmodified lines | |||
| 82 | # Generic IRQ IPI support | 82 | # Generic IRQ IPI support |
| 83 | config GENERIC_IRQ_IPI | 83 | config GENERIC_IRQ_IPI |
| 84 | bool | 84 | bool |
| 85 | select IRQ_DOMAIN_HIERARCHY | ||
| 85 | 86 | ||
| 86 | # Generic MSI interrupt support | 87 | # Generic MSI interrupt support |
| 87 | config GENERIC_MSI_IRQ | 88 | config GENERIC_MSI_IRQ |
| @@ -1249,7 +1249,13 @@ __acquires(hlist_lock) · 1248 unmodified lines | |||
| 1249 | 1249 | ||
| 1250 | *head = &kretprobe_inst_table[hash]; | 1250 | *head = &kretprobe_inst_table[hash]; |
| 1251 | hlist_lock = kretprobe_table_lock_ptr(hash); | 1251 | hlist_lock = kretprobe_table_lock_ptr(hash); |
| 1252 | raw_spin_lock_irqsave(hlist_lock, *flags); | 1252 | /* |
| 1253 | * Nested is a workaround that will soon not be needed. | ||
| 1254 | * There's other protections that make sure the same lock | ||
| 1255 | * is not taken on the same CPU that lockdep is unaware of. | ||
| 1256 | * Differentiate when it is taken in NMI context. | ||
| 1257 | */ | ||
| 1258 | raw_spin_lock_irqsave_nested(hlist_lock, *flags, !!in_nmi()); | ||
| 1253 | } | 1259 | } |
| 1254 | NOKPROBE_SYMBOL(kretprobe_hash_lock); | 1260 | NOKPROBE_SYMBOL(kretprobe_hash_lock); |
| 1255 | 1261 | ||
| @@ -1258,7 +1264,13 @@ static void kretprobe_table_lock(unsigned long hash, · 2 unmodified lines | |||
| 1258 | __acquires(hlist_lock) | 1264 | __acquires(hlist_lock) |
| 1259 | { | 1265 | { |
| 1260 | raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash); | 1266 | raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash); |
| 1261 | raw_spin_lock_irqsave(hlist_lock, *flags); | 1267 | /* |
| 1268 | * Nested is a workaround that will soon not be needed. | ||
| 1269 | * There's other protections that make sure the same lock | ||
| 1270 | * is not taken on the same CPU that lockdep is unaware of. | ||
| 1271 | * Differentiate when it is taken in NMI context. | ||
| 1272 | */ | ||
| 1273 | raw_spin_lock_irqsave_nested(hlist_lock, *flags, !!in_nmi()); | ||
| 1262 | } | 1274 | } |
| 1263 | NOKPROBE_SYMBOL(kretprobe_table_lock); | 1275 | NOKPROBE_SYMBOL(kretprobe_table_lock); |
| 1264 | 1276 | ||
| @@ -2028,7 +2040,12 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs) · 763 unmodified lines | |||
| 2028 | 2040 | ||
| 2029 | /* TODO: consider to only swap the RA after the last pre_handler fired */ | 2041 | /* TODO: consider to only swap the RA after the last pre_handler fired */ |
| 2030 | hash = hash_ptr(current, KPROBE_HASH_BITS); | 2042 | hash = hash_ptr(current, KPROBE_HASH_BITS); |
| 2031 | raw_spin_lock_irqsave(&rp->lock, flags); | 2043 | /* |
| 2044 | * Nested is a workaround that will soon not be needed. | ||
| 2045 | * There's other protections that make sure the same lock | ||
| 2046 | * is not taken on the same CPU that lockdep is unaware of. | ||
| 2047 | */ | ||
| 2048 | raw_spin_lock_irqsave_nested(&rp->lock, flags, 1); | ||
| 2032 | if (!hlist_empty(&rp->free_instances)) { | 2049 | if (!hlist_empty(&rp->free_instances)) { |
| 2033 | ri = hlist_entry(rp->free_instances.first, | 2050 | ri = hlist_entry(rp->free_instances.first, |
| 2034 | struct kretprobe_instance, hlist); | 2051 | struct kretprobe_instance, hlist); |
| @@ -2039,7 +2056,7 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs) · 4 unmodified lines | |||
| 2039 | ri->task = current; | 2056 | ri->task = current; |
| 2040 | 2057 | ||
| 2041 | if (rp->entry_handler && rp->entry_handler(ri, regs)) { | 2058 | if (rp->entry_handler && rp->entry_handler(ri, regs)) { |
| 2042 | raw_spin_lock_irqsave(&rp->lock, flags); | 2059 | raw_spin_lock_irqsave_nested(&rp->lock, flags, 1); |
| 2043 | hlist_add_head(&ri->hlist, &rp->free_instances); | 2060 | hlist_add_head(&ri->hlist, &rp->free_instances); |
| 2044 | raw_spin_unlock_irqrestore(&rp->lock, flags); | 2061 | raw_spin_unlock_irqrestore(&rp->lock, flags); |
| 2045 | return 0; | 2062 | return 0; |
| @@ -897,7 +897,8 @@ void kthread_delayed_work_timer_fn(struct timer_list *t) · 896 unmodified lines | |||
| 897 | /* Move the work from worker->delayed_work_list. */ | 897 | /* Move the work from worker->delayed_work_list. */ |
| 898 | WARN_ON_ONCE(list_empty(&work->node)); | 898 | WARN_ON_ONCE(list_empty(&work->node)); |
| 899 | list_del_init(&work->node); | 899 | list_del_init(&work->node); |
| 900 | kthread_insert_work(worker, work, &worker->work_list); | 900 | if (!work->canceling) |
| 901 | kthread_insert_work(worker, work, &worker->work_list); | ||
| 901 | 902 | ||
| 902 | raw_spin_unlock_irqrestore(&worker->lock, flags); | 903 | raw_spin_unlock_irqrestore(&worker->lock, flags); |
| 903 | } | 904 | } |
| @@ -102,9 +102,12 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) · 101 unmodified lines | |||
| 102 | static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time, | 102 | static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time, |
| 103 | unsigned int next_freq) | 103 | unsigned int next_freq) |
| 104 | { | 104 | { |
| 105 | if (sg_policy->next_freq == next_freq && | 105 | if (!sg_policy->need_freq_update) { |
| 106 | !cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS)) | 106 | if (sg_policy->next_freq == next_freq) |
| 107 | return false; | 107 | return false; |
| 108 | } else { | ||
| 109 | sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS); | ||
| 110 | } | ||
| 108 | 111 | ||
| 109 | sg_policy->next_freq = next_freq; | 112 | sg_policy->next_freq = next_freq; |
| 110 | sg_policy->last_freq_update_time = time; | 113 | sg_policy->last_freq_update_time = time; |
| @@ -162,11 +165,9 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, · 51 unmodified lines | |||
| 162 | 165 | ||
| 163 | freq = map_util_freq(util, freq, max); | 166 | freq = map_util_freq(util, freq, max); |
| 164 | 167 | ||
| 165 | if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update && | 168 | if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update) |
| 166 | !cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS)) | ||
| 167 | return sg_policy->next_freq; | 169 | return sg_policy->next_freq; |
| 168 | 170 | ||
| 169 | sg_policy->need_freq_update = false; | ||
| 170 | sg_policy->cached_raw_freq = freq; | 171 | sg_policy->cached_raw_freq = freq; |
| 171 | return cpufreq_driver_resolve_freq(policy, freq); | 172 | return cpufreq_driver_resolve_freq(policy, freq); |
| 172 | } | 173 | } |
| @@ -442,7 +443,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, · 269 unmodified lines | |||
| 442 | struct sugov_policy *sg_policy = sg_cpu->sg_policy; | 443 | struct sugov_policy *sg_policy = sg_cpu->sg_policy; |
| 443 | unsigned long util, max; | 444 | unsigned long util, max; |
| 444 | unsigned int next_f; | 445 | unsigned int next_f; |
| 445 | bool busy; | ||
| 446 | unsigned int cached_freq = sg_policy->cached_raw_freq; | 446 | unsigned int cached_freq = sg_policy->cached_raw_freq; |
| 447 | 447 | ||
| 448 | sugov_iowait_boost(sg_cpu, time, flags); | 448 | sugov_iowait_boost(sg_cpu, time, flags); |
| @@ -453,9 +453,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, · 4 unmodified lines | |||
| 453 | if (!sugov_should_update_freq(sg_policy, time)) | 453 | if (!sugov_should_update_freq(sg_policy, time)) |
| 454 | return; | 454 | return; |
| 455 | 455 | ||
| 456 | /* Limits may have changed, don't skip frequency update */ | ||
| 457 | busy = !sg_policy->need_freq_update && sugov_cpu_is_busy(sg_cpu); | ||
| 458 | |||
| 459 | util = sugov_get_util(sg_cpu); | 456 | util = sugov_get_util(sg_cpu); |
| 460 | max = sg_cpu->max; | 457 | max = sg_cpu->max; |
| 461 | util = sugov_iowait_apply(sg_cpu, time, util, max); | 458 | util = sugov_iowait_apply(sg_cpu, time, util, max); |
| @@ -464,7 +461,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, · 2 unmodified lines | |||
| 464 | * Do not reduce the frequency if the CPU has not been idle | 461 | * Do not reduce the frequency if the CPU has not been idle |
| 465 | * recently, as the reduction is likely to be premature then. | 462 | * recently, as the reduction is likely to be premature then. |
| 466 | */ | 463 | */ |
| 467 | if (busy && next_f < sg_policy->next_freq) { | 464 | if (sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) { |
| 468 | next_f = sg_policy->next_freq; | 465 | next_f = sg_policy->next_freq; |
| 469 | 466 | ||
| 470 | /* Restore cached freq as next_freq has changed */ | 467 | /* Restore cached freq as next_freq has changed */ |
| @@ -829,9 +826,10 @@ static int sugov_start(struct cpufreq_policy *policy) · 358 unmodified lines | |||
| 829 | sg_policy->next_freq = 0; | 826 | sg_policy->next_freq = 0; |
| 830 | sg_policy->work_in_progress = false; | 827 | sg_policy->work_in_progress = false; |
| 831 | sg_policy->limits_changed = false; | 828 | sg_policy->limits_changed = false; |
| 832 | sg_policy->need_freq_update = false; | ||
| 833 | sg_policy->cached_raw_freq = 0; | 829 | sg_policy->cached_raw_freq = 0; |
| 834 | 830 | ||
| 831 | sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS); | ||
| 832 | |||
| 835 | for_each_cpu(cpu, policy->cpus) { | 833 | for_each_cpu(cpu, policy->cpus) { |
| 836 | struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); | 834 | struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); |
| 837 | 835 | ||
| @@ -391,16 +391,17 @@ static bool task_participate_group_stop(struct task_struct *task) · 390 unmodified lines | |||
| 391 | 391 | ||
| 392 | void task_join_group_stop(struct task_struct *task) | 392 | void task_join_group_stop(struct task_struct *task) |
| 393 | { | 393 | { |
| 394 | unsigned long mask = current->jobctl & JOBCTL_STOP_SIGMASK; | ||
| 395 | struct signal_struct *sig = current->signal; | ||
| 396 | |||
| 397 | if (sig->group_stop_count) { | ||
| 398 | sig->group_stop_count++; | ||
| 399 | mask |= JOBCTL_STOP_CONSUME; | ||
| 400 | } else if (!(sig->flags & SIGNAL_STOP_STOPPED)) | ||
| 401 | return; | ||
| 402 | |||
| 394 | /* Have the new thread join an on-going signal group stop */ | 403 | /* Have the new thread join an on-going signal group stop */ |
| 395 | unsigned long jobctl = current->jobctl; | 404 | task_set_jobctl_pending(task, mask | JOBCTL_STOP_PENDING); |
| 396 | if (jobctl & JOBCTL_STOP_PENDING) { | ||
| 397 | struct signal_struct *sig = current->signal; | ||
| 398 | unsigned long signr = jobctl & JOBCTL_STOP_SIGMASK; | ||
| 399 | unsigned long gstop = JOBCTL_STOP_PENDING | JOBCTL_STOP_CONSUME; | ||
| 400 | if (task_set_jobctl_pending(task, signr | gstop)) { | ||
| 401 | sig->group_stop_count++; | ||
| 402 | } | ||
| 403 | } | ||
| 404 | } | 405 | } |
| 405 | 406 | ||
| 406 | /* | 407 | /* |
| @@ -438,14 +438,16 @@ enum { · 437 unmodified lines | |||
| 438 | }; | 438 | }; |
| 439 | /* | 439 | /* |
| 440 | * Used for which event context the event is in. | 440 | * Used for which event context the event is in. |
| 441 | * NMI = 0 | 441 | * TRANSITION = 0 |
| 442 | * IRQ = 1 | 442 | * NMI = 1 |
| 443 | * SOFTIRQ = 2 | 443 | * IRQ = 2 |
| 444 | * NORMAL = 3 | 444 | * SOFTIRQ = 3 |
| 445 | * NORMAL = 4 | ||
| 445 | * | 446 | * |
| 446 | * See trace_recursive_lock() comment below for more details. | 447 | * See trace_recursive_lock() comment below for more details. |
| 447 | */ | 448 | */ |
| 448 | enum { | 449 | enum { |
| 450 | RB_CTX_TRANSITION, | ||
| 449 | RB_CTX_NMI, | 451 | RB_CTX_NMI, |
| 450 | RB_CTX_IRQ, | 452 | RB_CTX_IRQ, |
| 451 | RB_CTX_SOFTIRQ, | 453 | RB_CTX_SOFTIRQ, |
| @@ -3014,10 +3016,10 @@ rb_wakeups(struct trace_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer) · 2562 unmodified lines | |||
| 3014 | * a bit of overhead in something as critical as function tracing, | 3016 | * a bit of overhead in something as critical as function tracing, |
| 3015 | * we use a bitmask trick. | 3017 | * we use a bitmask trick. |
| 3016 | * | 3018 | * |
| 3017 | * bit 0 = NMI context | 3019 | * bit 1 = NMI context |
| 3018 | * bit 1 = IRQ context | 3020 | * bit 2 = IRQ context |
| 3019 | * bit 2 = SoftIRQ context | 3021 | * bit 3 = SoftIRQ context |
| 3020 | * bit 3 = normal context. | 3022 | * bit 4 = normal context. |
| 3021 | * | 3023 | * |
| 3022 | * This works because this is the order of contexts that can | 3024 | * This works because this is the order of contexts that can |
| 3023 | * preempt other contexts. A SoftIRQ never preempts an IRQ | 3025 | * preempt other contexts. A SoftIRQ never preempts an IRQ |
| @@ -3040,6 +3042,30 @@ rb_wakeups(struct trace_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer) · 16 unmodified lines | |||
| 3040 | * The least significant bit can be cleared this way, and it | 3042 | * The least significant bit can be cleared this way, and it |
| 3041 | * just so happens that it is the same bit corresponding to | 3043 | * just so happens that it is the same bit corresponding to |
| 3042 | * the current context. | 3044 | * the current context. |
| 3045 | * | ||
| 3046 | * Now the TRANSITION bit breaks the above slightly. The TRANSITION bit | ||
| 3047 | * is set when a recursion is detected at the current context, and if | ||
| 3048 | * the TRANSITION bit is already set, it will fail the recursion. | ||
| 3049 | * This is needed because there's a lag between the changing of | ||
| 3050 | * interrupt context and updating the preempt count. In this case, | ||
| 3051 | * a false positive will be found. To handle this, one extra recursion | ||
| 3052 | * is allowed, and this is done by the TRANSITION bit. If the TRANSITION | ||
| 3053 | * bit is already set, then it is considered a recursion and the function | ||
| 3054 | * ends. Otherwise, the TRANSITION bit is set, and that bit is returned. | ||
| 3055 | * | ||
| 3056 | * On the trace_recursive_unlock(), the TRANSITION bit will be the first | ||
| 3057 | * to be cleared. Even if it wasn't the context that set it. That is, | ||
| 3058 | * if an interrupt comes in while NORMAL bit is set and the ring buffer | ||
| 3059 | * is called before preempt_count() is updated, since the check will | ||
| 3060 | * be on the NORMAL bit, the TRANSITION bit will then be set. If an | ||
| 3061 | * NMI then comes in, it will set the NMI bit, but when the NMI code | ||
| 3062 | * does the trace_recursive_unlock() it will clear the TRANSTION bit | ||
| 3063 | * and leave the NMI bit set. But this is fine, because the interrupt | ||
| 3064 | * code that set the TRANSITION bit will then clear the NMI bit when it | ||
| 3065 | * calls trace_recursive_unlock(). If another NMI comes in, it will | ||
| 3066 | * set the TRANSITION bit and continue. | ||
| 3067 | * | ||
| 3068 | * Note: The TRANSITION bit only handles a single transition between context. | ||
| 3043 | */ | 3069 | */ |
| 3044 | 3070 | ||
| 3045 | static __always_inline int | 3071 | static __always_inline int |
| @@ -3055,8 +3081,16 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer) · 9 unmodified lines | |||
| 3055 | bit = pc & NMI_MASK ? RB_CTX_NMI : | 3081 | bit = pc & NMI_MASK ? RB_CTX_NMI : |
| 3056 | pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ; | 3082 | pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ; |
| 3057 | 3083 | ||
| 3058 | if (unlikely(val & (1 << (bit + cpu_buffer->nest)))) | 3084 | if (unlikely(val & (1 << (bit + cpu_buffer->nest)))) { |
| 3059 | return 1; | 3085 | /* |
| 3086 | * It is possible that this was called by transitioning | ||
| 3087 | * between interrupt context, and preempt_count() has not | ||
| 3088 | * been updated yet. In this case, use the TRANSITION bit. | ||
| 3089 | */ | ||
| 3090 | bit = RB_CTX_TRANSITION; | ||
| 3091 | if (val & (1 << (bit + cpu_buffer->nest))) | ||
| 3092 | return 1; | ||
| 3093 | } | ||
| 3060 | 3094 | ||
| 3061 | val |= (1 << (bit + cpu_buffer->nest)); | 3095 | val |= (1 << (bit + cpu_buffer->nest)); |
| 3062 | cpu_buffer->current_context = val; | 3096 | cpu_buffer->current_context = val; |
| @@ -3071,8 +3105,8 @@ trace_recursive_unlock(struct ring_buffer_per_cpu *cpu_buffer) · 8 unmodified lines | |||
| 3071 | cpu_buffer->current_context - (1 << cpu_buffer->nest); | 3105 | cpu_buffer->current_context - (1 << cpu_buffer->nest); |
| 3072 | } | 3106 | } |
| 3073 | 3107 | ||
| 3074 | /* The recursive locking above uses 4 bits */ | 3108 | /* The recursive locking above uses 5 bits */ |
| 3075 | #define NESTED_BITS 4 | 3109 | #define NESTED_BITS 5 |
| 3076 | 3110 | ||
| 3077 | /** | 3111 | /** |
| 3078 | * ring_buffer_nest_start - Allow to trace while nested | 3112 | * ring_buffer_nest_start - Allow to trace while nested |
| @@ -2750,7 +2750,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb, · 2749 unmodified lines | |||
| 2750 | /* | 2750 | /* |
| 2751 | * If tracing is off, but we have triggers enabled | 2751 | * If tracing is off, but we have triggers enabled |
| 2752 | * we still need to look at the event data. Use the temp_buffer | 2752 | * we still need to look at the event data. Use the temp_buffer |
| 2753 | * to store the trace event for the tigger to use. It's recusive | 2753 | * to store the trace event for the trigger to use. It's recursive |
| 2754 | * safe and will not be recorded anywhere. | 2754 | * safe and will not be recorded anywhere. |
| 2755 | */ | 2755 | */ |
| 2756 | if (!entry && trace_file->flags & EVENT_FILE_FL_TRIGGER_COND) { | 2756 | if (!entry && trace_file->flags & EVENT_FILE_FL_TRIGGER_COND) { |
| @@ -2952,7 +2952,7 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer, · 195 unmodified lines | |||
| 2952 | stackidx = __this_cpu_inc_return(ftrace_stack_reserve) - 1; | 2952 | stackidx = __this_cpu_inc_return(ftrace_stack_reserve) - 1; |
| 2953 | 2953 | ||
| 2954 | /* This should never happen. If it does, yell once and skip */ | 2954 | /* This should never happen. If it does, yell once and skip */ |
| 2955 | if (WARN_ON_ONCE(stackidx > FTRACE_KSTACK_NESTING)) | 2955 | if (WARN_ON_ONCE(stackidx >= FTRACE_KSTACK_NESTING)) |
| 2956 | goto out; | 2956 | goto out; |
| 2957 | 2957 | ||
| 2958 | /* | 2958 | /* |
| @@ -3132,7 +3132,7 @@ static char *get_trace_buf(void) · 173 unmodified lines | |||
| 3132 | 3132 | ||
| 3133 | /* Interrupts must see nesting incremented before we use the buffer */ | 3133 | /* Interrupts must see nesting incremented before we use the buffer */ |
| 3134 | barrier(); | 3134 | barrier(); |
| 3135 | return &buffer->buffer[buffer->nesting][0]; | 3135 | return &buffer->buffer[buffer->nesting - 1][0]; |
| 3136 | } | 3136 | } |
| 3137 | 3137 | ||
| 3138 | static void put_trace_buf(void) | 3138 | static void put_trace_buf(void) |
| @@ -637,6 +637,12 @@ enum { · 636 unmodified lines | |||
| 637 | * function is called to clear it. | 637 | * function is called to clear it. |
| 638 | */ | 638 | */ |
| 639 | TRACE_GRAPH_NOTRACE_BIT, | 639 | TRACE_GRAPH_NOTRACE_BIT, |
| 640 | |||
| 641 | /* | ||
| 642 | * When transitioning between context, the preempt_count() may | ||
| 643 | * not be correct. Allow for a single recursion to cover this case. | ||
| 644 | */ | ||
| 645 | TRACE_TRANSITION_BIT, | ||
| 640 | }; | 646 | }; |
| 641 | 647 | ||
| 642 | #define trace_recursion_set(bit) do { (current)->trace_recursion |= (1<<(bit)); } while (0) | 648 | #define trace_recursion_set(bit) do { (current)->trace_recursion |= (1<<(bit)); } while (0) |
| @@ -691,14 +697,27 @@ static __always_inline int trace_test_and_set_recursion(int start, int max) · 48 unmodified lines | |||
| 691 | return 0; | 697 | return 0; |
| 692 | 698 | ||
| 693 | bit = trace_get_context_bit() + start; | 699 | bit = trace_get_context_bit() + start; |
| 694 | if (unlikely(val & (1 << bit))) | 700 | if (unlikely(val & (1 << bit))) { |
| 695 | return -1; | 701 | /* |
| 702 | * It could be that preempt_count has not been updated during | ||
| 703 | * a switch between contexts. Allow for a single recursion. | ||
| 704 | */ | ||
| 705 | bit = TRACE_TRANSITION_BIT; | ||
| 706 | if (trace_recursion_test(bit)) | ||
| 707 | return -1; | ||
| 708 | trace_recursion_set(bit); | ||
| 709 | barrier(); | ||
| 710 | return bit + 1; | ||
| 711 | } | ||
| 712 | |||
| 713 | /* Normal check passed, clear the transition to allow it again */ | ||
| 714 | trace_recursion_clear(TRACE_TRANSITION_BIT); | ||
| 696 | 715 | ||
| 697 | val |= 1 << bit; | 716 | val |= 1 << bit; |
| 698 | current->trace_recursion = val; | 717 | current->trace_recursion = val; |
| 699 | barrier(); | 718 | barrier(); |
| 700 | 719 | ||
| 701 | return bit; | 720 | return bit + 1; |
| 702 | } | 721 | } |
| 703 | 722 | ||
| 704 | static __always_inline void trace_clear_recursion(int bit) | 723 | static __always_inline void trace_clear_recursion(int bit) |
| @@ -708,6 +727,7 @@ static __always_inline void trace_clear_recursion(int bit) · 3 unmodified lines | |||
| 708 | if (!bit) | 727 | if (!bit) |
| 709 | return; | 728 | return; |
| 710 | 729 | ||
| 730 | bit--; | ||
| 711 | bit = 1 << bit; | 731 | bit = 1 << bit; |
| 712 | val &= ~bit; | 732 | val &= ~bit; |
| 713 | 733 | ||
| @@ -584,7 +584,7 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 583 unmodified lines | |||
| 584 | { | 584 | { |
| 585 | struct synth_field *field; | 585 | struct synth_field *field; |
| 586 | const char *prefix = NULL, *field_type = argv[0], *field_name, *array; | 586 | const char *prefix = NULL, *field_type = argv[0], *field_name, *array; |
| 587 | int len, ret = 0; | 587 | int len, ret = -ENOMEM; |
| 588 | struct seq_buf s; | 588 | struct seq_buf s; |
| 589 | ssize_t size; | 589 | ssize_t size; |
| 590 | 590 | ||
| @@ -617,10 +617,9 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 26 unmodified lines | |||
| 617 | len--; | 617 | len--; |
| 618 | 618 | ||
| 619 | field->name = kmemdup_nul(field_name, len, GFP_KERNEL); | 619 | field->name = kmemdup_nul(field_name, len, GFP_KERNEL); |
| 620 | if (!field->name) { | 620 | if (!field->name) |
| 621 | ret = -ENOMEM; | ||
| 622 | goto free; | 621 | goto free; |
| 623 | } | 622 | |
| 624 | if (!is_good_name(field->name)) { | 623 | if (!is_good_name(field->name)) { |
| 625 | synth_err(SYNTH_ERR_BAD_NAME, errpos(field_name)); | 624 | synth_err(SYNTH_ERR_BAD_NAME, errpos(field_name)); |
| 626 | ret = -EINVAL; | 625 | ret = -EINVAL; |
| @@ -638,10 +637,9 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 11 unmodified lines | |||
| 638 | len += strlen(prefix); | 637 | len += strlen(prefix); |
| 639 | 638 | ||
| 640 | field->type = kzalloc(len, GFP_KERNEL); | 639 | field->type = kzalloc(len, GFP_KERNEL); |
| 641 | if (!field->type) { | 640 | if (!field->type) |
| 642 | ret = -ENOMEM; | ||
| 643 | goto free; | 641 | goto free; |
| 644 | } | 642 | |
| 645 | seq_buf_init(&s, field->type, len); | 643 | seq_buf_init(&s, field->type, len); |
| 646 | if (prefix) | 644 | if (prefix) |
| 647 | seq_buf_puts(&s, prefix); | 645 | seq_buf_puts(&s, prefix); |
| @@ -653,6 +651,7 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 5 unmodified lines | |||
| 653 | } | 651 | } |
| 654 | if (WARN_ON_ONCE(!seq_buf_buffer_left(&s))) | 652 | if (WARN_ON_ONCE(!seq_buf_buffer_left(&s))) |
| 655 | goto free; | 653 | goto free; |
| 654 | |||
| 656 | s.buffer[s.len] = '\0'; | 655 | s.buffer[s.len] = '\0'; |
| 657 | 656 | ||
| 658 | size = synth_field_size(field->type); | 657 | size = synth_field_size(field->type); |
| @@ -666,10 +665,8 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 7 unmodified lines | |||
| 666 | 665 | ||
| 667 | len = sizeof("__data_loc ") + strlen(field->type) + 1; | 666 | len = sizeof("__data_loc ") + strlen(field->type) + 1; |
| 668 | type = kzalloc(len, GFP_KERNEL); | 667 | type = kzalloc(len, GFP_KERNEL); |
| 669 | if (!type) { | 668 | if (!type) |
| 670 | ret = -ENOMEM; | ||
| 671 | goto free; | 669 | goto free; |
| 672 | } | ||
| 673 | 670 | ||
| 674 | seq_buf_init(&s, type, len); | 671 | seq_buf_init(&s, type, len); |
| 675 | seq_buf_puts(&s, "__data_loc "); | 672 | seq_buf_puts(&s, "__data_loc "); |
| @@ -492,8 +492,13 @@ trace_selftest_function_recursion(void) · 491 unmodified lines | |||
| 492 | unregister_ftrace_function(&test_rec_probe); | 492 | unregister_ftrace_function(&test_rec_probe); |
| 493 | 493 | ||
| 494 | ret = -1; | 494 | ret = -1; |
| 495 | if (trace_selftest_recursion_cnt != 1) { | 495 | /* |
| 496 | pr_cont("*callback not called once (%d)* ", | 496 | * Recursion allows for transitions between context, |
| 497 | * and may call the callback twice. | ||
| 498 | */ | ||
| 499 | if (trace_selftest_recursion_cnt != 1 && | ||
| 500 | trace_selftest_recursion_cnt != 2) { | ||
| 501 | pr_cont("*callback not called once (or twice) (%d)* ", | ||
| 497 | trace_selftest_recursion_cnt); | 502 | trace_selftest_recursion_cnt); |
| 498 | goto out; | 503 | goto out; |
| 499 | } | 504 | } |
| @@ -683,7 +683,6 @@ static int __init crc32c_test(void) · 682 unmodified lines | |||
| 683 | 683 | ||
| 684 | /* reduce OS noise */ | 684 | /* reduce OS noise */ |
| 685 | local_irq_save(flags); | 685 | local_irq_save(flags); |
| 686 | local_irq_disable(); | ||
| 687 | 686 | ||
| 688 | nsec = ktime_get_ns(); | 687 | nsec = ktime_get_ns(); |
| 689 | for (i = 0; i < 100; i++) { | 688 | for (i = 0; i < 100; i++) { |
| @@ -694,7 +693,6 @@ static int __init crc32c_test(void) · 4 unmodified lines | |||
| 694 | nsec = ktime_get_ns() - nsec; | 693 | nsec = ktime_get_ns() - nsec; |
| 695 | 694 | ||
| 696 | local_irq_restore(flags); | 695 | local_irq_restore(flags); |
| 697 | local_irq_enable(); | ||
| 698 | 696 | ||
| 699 | pr_info("crc32c: CRC_LE_BITS = %d\n", CRC_LE_BITS); | 697 | pr_info("crc32c: CRC_LE_BITS = %d\n", CRC_LE_BITS); |
| 700 | 698 | ||
| @@ -768,7 +766,6 @@ static int __init crc32_test(void) · 67 unmodified lines | |||
| 768 | 766 | ||
| 769 | /* reduce OS noise */ | 767 | /* reduce OS noise */ |
| 770 | local_irq_save(flags); | 768 | local_irq_save(flags); |
| 771 | local_irq_disable(); | ||
| 772 | 769 | ||
| 773 | nsec = ktime_get_ns(); | 770 | nsec = ktime_get_ns(); |
| 774 | for (i = 0; i < 100; i++) { | 771 | for (i = 0; i < 100; i++) { |
| @@ -783,7 +780,6 @@ static int __init crc32_test(void) · 8 unmodified lines | |||
| 783 | nsec = ktime_get_ns() - nsec; | 780 | nsec = ktime_get_ns() - nsec; |
| 784 | 781 | ||
| 785 | local_irq_restore(flags); | 782 | local_irq_restore(flags); |
| 786 | local_irq_enable(); | ||
| 787 | 783 | ||
| 788 | pr_info("crc32: CRC_LE_BITS = %d, CRC_BE BITS = %d\n", | 784 | pr_info("crc32: CRC_LE_BITS = %d, CRC_BE BITS = %d\n", |
| 789 | CRC_LE_BITS, CRC_BE_BITS); | 785 | CRC_LE_BITS, CRC_BE_BITS); |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | #define FONTDATAMAX 9216 | 9 | #define FONTDATAMAX 9216 |
| 10 | 10 | ||
| 11 | static struct font_data fontdata_10x18 = { | 11 | static const struct font_data fontdata_10x18 = { |
| 12 | { 0, 0, FONTDATAMAX, 0 }, { | 12 | { 0, 0, FONTDATAMAX, 0 }, { |
| 13 | /* 0 0x00 '^@' */ | 13 | /* 0 0x00 '^@' */ |
| 14 | 0x00, 0x00, /* 0000000000 */ | 14 | 0x00, 0x00, /* 0000000000 */ |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #define FONTDATAMAX 2560 | 4 | #define FONTDATAMAX 2560 |
| 5 | 5 | ||
| 6 | static struct font_data fontdata_6x10 = { | 6 | static const struct font_data fontdata_6x10 = { |
| 7 | { 0, 0, FONTDATAMAX, 0 }, { | 7 | { 0, 0, FONTDATAMAX, 0 }, { |
| 8 | /* 0 0x00 '^@' */ | 8 | /* 0 0x00 '^@' */ |
| 9 | 0x00, /* 00000000 */ | 9 | 0x00, /* 00000000 */ |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | 9 | ||
| 10 | #define FONTDATAMAX (11*256) | 10 | #define FONTDATAMAX (11*256) |
| 11 | 11 | ||
| 12 | static struct font_data fontdata_6x11 = { | 12 | static const struct font_data fontdata_6x11 = { |
| 13 | { 0, 0, FONTDATAMAX, 0 }, { | 13 | { 0, 0, FONTDATAMAX, 0 }, { |
| 14 | /* 0 0x00 '^@' */ | 14 | /* 0 0x00 '^@' */ |
| 15 | 0x00, /* 00000000 */ | 15 | 0x00, /* 00000000 */ |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #define FONTDATAMAX 2048 | 4 | #define FONTDATAMAX 2048 |
| 5 | 5 | ||
| 6 | static struct font_data fontdata_6x8 = { | 6 | static const struct font_data fontdata_6x8 = { |
| 7 | { 0, 0, FONTDATAMAX, 0 }, { | 7 | { 0, 0, FONTDATAMAX, 0 }, { |
| 8 | /* 0 0x00 '^@' */ | 8 | /* 0 0x00 '^@' */ |
| 9 | 0x00, /* 000000 */ | 9 | 0x00, /* 000000 */ |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | #define FONTDATAMAX 3584 | 9 | #define FONTDATAMAX 3584 |
| 10 | 10 | ||
| 11 | static struct font_data fontdata_7x14 = { | 11 | static const struct font_data fontdata_7x14 = { |
| 12 | { 0, 0, FONTDATAMAX, 0 }, { | 12 | { 0, 0, FONTDATAMAX, 0 }, { |
| 13 | /* 0 0x00 '^@' */ | 13 | /* 0 0x00 '^@' */ |
| 14 | 0x00, /* 0000000 */ | 14 | 0x00, /* 0000000 */ |
| @@ -10,7 +10,7 @@ · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | #define FONTDATAMAX 4096 | 11 | #define FONTDATAMAX 4096 |
| 12 | 12 | ||
| 13 | static struct font_data fontdata_8x16 = { | 13 | static const struct font_data fontdata_8x16 = { |
| 14 | { 0, 0, FONTDATAMAX, 0 }, { | 14 | { 0, 0, FONTDATAMAX, 0 }, { |
| 15 | /* 0 0x00 '^@' */ | 15 | /* 0 0x00 '^@' */ |
| 16 | 0x00, /* 00000000 */ | 16 | 0x00, /* 00000000 */ |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | 9 | ||
| 10 | #define FONTDATAMAX 2048 | 10 | #define FONTDATAMAX 2048 |
| 11 | 11 | ||
| 12 | static struct font_data fontdata_8x8 = { | 12 | static const struct font_data fontdata_8x8 = { |
| 13 | { 0, 0, FONTDATAMAX, 0 }, { | 13 | { 0, 0, FONTDATAMAX, 0 }, { |
| 14 | /* 0 0x00 '^@' */ | 14 | /* 0 0x00 '^@' */ |
| 15 | 0x00, /* 00000000 */ | 15 | 0x00, /* 00000000 */ |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | #define FONTDATAMAX 2048 | 6 | #define FONTDATAMAX 2048 |
| 7 | 7 | ||
| 8 | static struct font_data acorndata_8x8 = { | 8 | static const struct font_data acorndata_8x8 = { |
| 9 | { 0, 0, FONTDATAMAX, 0 }, { | 9 | { 0, 0, FONTDATAMAX, 0 }, { |
| 10 | /* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */ | 10 | /* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */ |
| 11 | /* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */ | 11 | /* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */ |
| @@ -43,7 +43,7 @@ __END__; · 42 unmodified lines | |||
| 43 | 43 | ||
| 44 | #define FONTDATAMAX 1536 | 44 | #define FONTDATAMAX 1536 |
| 45 | 45 | ||
| 46 | static struct font_data fontdata_mini_4x6 = { | 46 | static const struct font_data fontdata_mini_4x6 = { |
| 47 | { 0, 0, FONTDATAMAX, 0 }, { | 47 | { 0, 0, FONTDATAMAX, 0 }, { |
| 48 | /*{*/ | 48 | /*{*/ |
| 49 | /* Char 0: ' ' */ | 49 | /* Char 0: ' ' */ |
| @@ -14,7 +14,7 @@ · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | #define FONTDATAMAX 2048 | 15 | #define FONTDATAMAX 2048 |
| 16 | 16 | ||
| 17 | static struct font_data fontdata_pearl8x8 = { | 17 | static const struct font_data fontdata_pearl8x8 = { |
| 18 | { 0, 0, FONTDATAMAX, 0 }, { | 18 | { 0, 0, FONTDATAMAX, 0 }, { |
| 19 | /* 0 0x00 '^@' */ | 19 | /* 0 0x00 '^@' */ |
| 20 | 0x00, /* 00000000 */ | 20 | 0x00, /* 00000000 */ |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #define FONTDATAMAX 11264 | 4 | #define FONTDATAMAX 11264 |
| 5 | 5 | ||
| 6 | static struct font_data fontdata_sun12x22 = { | 6 | static const struct font_data fontdata_sun12x22 = { |
| 7 | { 0, 0, FONTDATAMAX, 0 }, { | 7 | { 0, 0, FONTDATAMAX, 0 }, { |
| 8 | /* 0 0x00 '^@' */ | 8 | /* 0 0x00 '^@' */ |
| 9 | 0x00, 0x00, /* 000000000000 */ | 9 | 0x00, 0x00, /* 000000000000 */ |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #define FONTDATAMAX 4096 | 4 | #define FONTDATAMAX 4096 |
| 5 | 5 | ||
| 6 | static struct font_data fontdata_sun8x16 = { | 6 | static const struct font_data fontdata_sun8x16 = { |
| 7 | { 0, 0, FONTDATAMAX, 0 }, { | 7 | { 0, 0, FONTDATAMAX, 0 }, { |
| 8 | /* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | 8 | /* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 9 | /* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, | 9 | /* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00, |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | #define FONTDATAMAX 16384 | 5 | #define FONTDATAMAX 16384 |
| 6 | 6 | ||
| 7 | static struct font_data fontdata_ter16x32 = { | 7 | static const struct font_data fontdata_ter16x32 = { |
| 8 | { 0, 0, FONTDATAMAX, 0 }, { | 8 | { 0, 0, FONTDATAMAX, 0 }, { |
| 9 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 9 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 10 | 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x7f, 0xfc, | 10 | 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x7f, 0xfc, |
| @@ -216,6 +216,12 @@ static void kmalloc_oob_16(struct kunit *test) · 215 unmodified lines | |||
| 216 | u64 words[2]; | 216 | u64 words[2]; |
| 217 | } *ptr1, *ptr2; | 217 | } *ptr1, *ptr2; |
| 218 | 218 | ||
| 219 | /* This test is specifically crafted for the generic mode. */ | ||
| 220 | if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) { | ||
| 221 | kunit_info(test, "CONFIG_KASAN_GENERIC required\n"); | ||
| 222 | return; | ||
| 223 | } | ||
| 224 | |||
| 219 | ptr1 = kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL); | 225 | ptr1 = kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL); |
| 220 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1); | 226 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1); |
| 221 | 227 | ||
| @@ -227,6 +233,23 @@ static void kmalloc_oob_16(struct kunit *test) · 5 unmodified lines | |||
| 227 | kfree(ptr2); | 233 | kfree(ptr2); |
| 228 | } | 234 | } |
| 229 | 235 | ||
| 236 | static void kmalloc_uaf_16(struct kunit *test) | ||
| 237 | { | ||
| 238 | struct { | ||
| 239 | u64 words[2]; | ||
| 240 | } *ptr1, *ptr2; | ||
| 241 | |||
| 242 | ptr1 = kmalloc(sizeof(*ptr1), GFP_KERNEL); | ||
| 243 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1); | ||
| 244 | |||
| 245 | ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL); | ||
| 246 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); | ||
| 247 | kfree(ptr2); | ||
| 248 | |||
| 249 | KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2); | ||
| 250 | kfree(ptr1); | ||
| 251 | } | ||
| 252 | |||
| 230 | static void kmalloc_oob_memset_2(struct kunit *test) | 253 | static void kmalloc_oob_memset_2(struct kunit *test) |
| 231 | { | 254 | { |
| 232 | char *ptr; | 255 | char *ptr; |
| @@ -429,6 +452,12 @@ static void kasan_global_oob(struct kunit *test) · 196 unmodified lines | |||
| 429 | volatile int i = 3; | 452 | volatile int i = 3; |
| 430 | char *p = &global_array[ARRAY_SIZE(global_array) + i]; | 453 | char *p = &global_array[ARRAY_SIZE(global_array) + i]; |
| 431 | 454 | ||
| 455 | /* Only generic mode instruments globals. */ | ||
| 456 | if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) { | ||
| 457 | kunit_info(test, "CONFIG_KASAN_GENERIC required"); | ||
| 458 | return; | ||
| 459 | } | ||
| 460 | |||
| 432 | KUNIT_EXPECT_KASAN_FAIL(test, *(volatile char *)p); | 461 | KUNIT_EXPECT_KASAN_FAIL(test, *(volatile char *)p); |
| 433 | } | 462 | } |
| 434 | 463 | ||
| @@ -467,6 +496,12 @@ static void kasan_alloca_oob_left(struct kunit *test) · 32 unmodified lines | |||
| 467 | char alloca_array[i]; | 496 | char alloca_array[i]; |
| 468 | char *p = alloca_array - 1; | 497 | char *p = alloca_array - 1; |
| 469 | 498 | ||
| 499 | /* Only generic mode instruments dynamic allocas. */ | ||
| 500 | if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) { | ||
| 501 | kunit_info(test, "CONFIG_KASAN_GENERIC required"); | ||
| 502 | return; | ||
| 503 | } | ||
| 504 | |||
| 470 | if (!IS_ENABLED(CONFIG_KASAN_STACK)) { | 505 | if (!IS_ENABLED(CONFIG_KASAN_STACK)) { |
| 471 | kunit_info(test, "CONFIG_KASAN_STACK is not enabled"); | 506 | kunit_info(test, "CONFIG_KASAN_STACK is not enabled"); |
| 472 | return; | 507 | return; |
| @@ -481,6 +516,12 @@ static void kasan_alloca_oob_right(struct kunit *test) · 8 unmodified lines | |||
| 481 | char alloca_array[i]; | 516 | char alloca_array[i]; |
| 482 | char *p = alloca_array + i; | 517 | char *p = alloca_array + i; |
| 483 | 518 | ||
| 519 | /* Only generic mode instruments dynamic allocas. */ | ||
| 520 | if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) { | ||
| 521 | kunit_info(test, "CONFIG_KASAN_GENERIC required"); | ||
| 522 | return; | ||
| 523 | } | ||
| 524 | |||
| 484 | if (!IS_ENABLED(CONFIG_KASAN_STACK)) { | 525 | if (!IS_ENABLED(CONFIG_KASAN_STACK)) { |
| 485 | kunit_info(test, "CONFIG_KASAN_STACK is not enabled"); | 526 | kunit_info(test, "CONFIG_KASAN_STACK is not enabled"); |
| 486 | return; | 527 | return; |
| @@ -551,6 +592,9 @@ static void kasan_memchr(struct kunit *test) · 64 unmodified lines | |||
| 551 | return; | 592 | return; |
| 552 | } | 593 | } |
| 553 | 594 | ||
| 595 | if (OOB_TAG_OFF) | ||
| 596 | size = round_up(size, OOB_TAG_OFF); | ||
| 597 | |||
| 554 | ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); | 598 | ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); |
| 555 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); | 599 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); |
| 556 | 600 | ||
| @@ -573,6 +617,9 @@ static void kasan_memcmp(struct kunit *test) · 16 unmodified lines | |||
| 573 | return; | 617 | return; |
| 574 | } | 618 | } |
| 575 | 619 | ||
| 620 | if (OOB_TAG_OFF) | ||
| 621 | size = round_up(size, OOB_TAG_OFF); | ||
| 622 | |||
| 576 | ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); | 623 | ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); |
| 577 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); | 624 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); |
| 578 | memset(arr, 0, sizeof(arr)); | 625 | memset(arr, 0, sizeof(arr)); |
| @@ -619,13 +666,50 @@ static void kasan_strings(struct kunit *test) · 40 unmodified lines | |||
| 619 | KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = strnlen(ptr, 1)); | 666 | KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = strnlen(ptr, 1)); |
| 620 | } | 667 | } |
| 621 | 668 | ||
| 622 | static void kasan_bitops(struct kunit *test) | 669 | static void kasan_bitops_modify(struct kunit *test, int nr, void *addr) |
| 670 | { | ||
| 671 | KUNIT_EXPECT_KASAN_FAIL(test, set_bit(nr, addr)); | ||
| 672 | KUNIT_EXPECT_KASAN_FAIL(test, __set_bit(nr, addr)); | ||
| 673 | KUNIT_EXPECT_KASAN_FAIL(test, clear_bit(nr, addr)); | ||
| 674 | KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit(nr, addr)); | ||
| 675 | KUNIT_EXPECT_KASAN_FAIL(test, clear_bit_unlock(nr, addr)); | ||
| 676 | KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit_unlock(nr, addr)); | ||
| 677 | KUNIT_EXPECT_KASAN_FAIL(test, change_bit(nr, addr)); | ||
| 678 | KUNIT_EXPECT_KASAN_FAIL(test, __change_bit(nr, addr)); | ||
| 679 | } | ||
| 680 | |||
| 681 | static void kasan_bitops_test_and_modify(struct kunit *test, int nr, void *addr) | ||
| 682 | { | ||
| 683 | KUNIT_EXPECT_KASAN_FAIL(test, test_and_set_bit(nr, addr)); | ||
| 684 | KUNIT_EXPECT_KASAN_FAIL(test, __test_and_set_bit(nr, addr)); | ||
| 685 | KUNIT_EXPECT_KASAN_FAIL(test, test_and_set_bit_lock(nr, addr)); | ||
| 686 | KUNIT_EXPECT_KASAN_FAIL(test, test_and_clear_bit(nr, addr)); | ||
| 687 | KUNIT_EXPECT_KASAN_FAIL(test, __test_and_clear_bit(nr, addr)); | ||
| 688 | KUNIT_EXPECT_KASAN_FAIL(test, test_and_change_bit(nr, addr)); | ||
| 689 | KUNIT_EXPECT_KASAN_FAIL(test, __test_and_change_bit(nr, addr)); | ||
| 690 | KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = test_bit(nr, addr)); | ||
| 691 | |||
| 692 | #if defined(clear_bit_unlock_is_negative_byte) | ||
| 693 | KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = | ||
| 694 | clear_bit_unlock_is_negative_byte(nr, addr)); | ||
| 695 | #endif | ||
| 696 | } | ||
| 697 | |||
| 698 | static void kasan_bitops_generic(struct kunit *test) | ||
| 623 | { | 699 | { |
| 700 | long *bits; | ||
| 701 | |||
| 702 | /* This test is specifically crafted for the generic mode. */ | ||
| 703 | if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) { | ||
| 704 | kunit_info(test, "CONFIG_KASAN_GENERIC required\n"); | ||
| 705 | return; | ||
| 706 | } | ||
| 707 | |||
| 624 | /* | 708 | /* |
| 625 | * Allocate 1 more byte, which causes kzalloc to round up to 16-bytes; | 709 | * Allocate 1 more byte, which causes kzalloc to round up to 16-bytes; |
| 626 | * this way we do not actually corrupt other memory. | 710 | * this way we do not actually corrupt other memory. |
| 627 | */ | 711 | */ |
| 628 | long *bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL); | 712 | bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL); |
| 629 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits); | 713 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits); |
| 630 | 714 | ||
| 631 | /* | 715 | /* |
| @@ -633,55 +717,34 @@ static void kasan_bitops(struct kunit *test) · 1 unmodified line | |||
| 633 | * below accesses are still out-of-bounds, since bitops are defined to | 717 | * below accesses are still out-of-bounds, since bitops are defined to |
| 634 | * operate on the whole long the bit is in. | 718 | * operate on the whole long the bit is in. |
| 635 | */ | 719 | */ |
| 636 | KUNIT_EXPECT_KASAN_FAIL(test, set_bit(BITS_PER_LONG, bits)); | 720 | kasan_bitops_modify(test, BITS_PER_LONG, bits); |
| 637 | |||
| 638 | KUNIT_EXPECT_KASAN_FAIL(test, __set_bit(BITS_PER_LONG, bits)); | ||
| 639 | |||
| 640 | KUNIT_EXPECT_KASAN_FAIL(test, clear_bit(BITS_PER_LONG, bits)); | ||
| 641 | |||
| 642 | KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit(BITS_PER_LONG, bits)); | ||
| 643 | |||
| 644 | KUNIT_EXPECT_KASAN_FAIL(test, clear_bit_unlock(BITS_PER_LONG, bits)); | ||
| 645 | |||
| 646 | KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit_unlock(BITS_PER_LONG, bits)); | ||
| 647 | |||
| 648 | KUNIT_EXPECT_KASAN_FAIL(test, change_bit(BITS_PER_LONG, bits)); | ||
| 649 | |||
| 650 | KUNIT_EXPECT_KASAN_FAIL(test, __change_bit(BITS_PER_LONG, bits)); | ||
| 651 | 721 | ||
| 652 | /* | 722 | /* |
| 653 | * Below calls try to access bit beyond allocated memory. | 723 | * Below calls try to access bit beyond allocated memory. |
| 654 | */ | 724 | */ |
| 655 | KUNIT_EXPECT_KASAN_FAIL(test, | 725 | kasan_bitops_test_and_modify(test, BITS_PER_LONG + BITS_PER_BYTE, bits); |
| 656 | test_and_set_bit(BITS_PER_LONG + BITS_PER_BYTE, bits)); | ||
| 657 | |||
| 658 | KUNIT_EXPECT_KASAN_FAIL(test, | ||
| 659 | __test_and_set_bit(BITS_PER_LONG + BITS_PER_BYTE, bits)); | ||
| 660 | |||
| 661 | KUNIT_EXPECT_KASAN_FAIL(test, | ||
| 662 | test_and_set_bit_lock(BITS_PER_LONG + BITS_PER_BYTE, bits)); | ||
| 663 | 726 | ||
| 664 | KUNIT_EXPECT_KASAN_FAIL(test, | 727 | kfree(bits); |
| 665 | test_and_clear_bit(BITS_PER_LONG + BITS_PER_BYTE, bits)); | 728 | } |
| 666 | 729 | ||
| 667 | KUNIT_EXPECT_KASAN_FAIL(test, | 730 | static void kasan_bitops_tags(struct kunit *test) |
| 668 | __test_and_clear_bit(BITS_PER_LONG + BITS_PER_BYTE, bits)); | 731 | { |
| 732 | long *bits; | ||
| 669 | 733 | ||
| 670 | KUNIT_EXPECT_KASAN_FAIL(test, | 734 | /* This test is specifically crafted for the tag-based mode. */ |
| 671 | test_and_change_bit(BITS_PER_LONG + BITS_PER_BYTE, bits)); | 735 | if (IS_ENABLED(CONFIG_KASAN_GENERIC)) { |
| 736 | kunit_info(test, "CONFIG_KASAN_SW_TAGS required\n"); | ||
| 737 | return; | ||
| 738 | } | ||
| 672 | 739 | ||
| 673 | KUNIT_EXPECT_KASAN_FAIL(test, | 740 | /* Allocation size will be rounded to up granule size, which is 16. */ |
| 674 | __test_and_change_bit(BITS_PER_LONG + BITS_PER_BYTE, bits)); | 741 | bits = kzalloc(sizeof(*bits), GFP_KERNEL); |
| 742 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits); | ||
| 675 | 743 | ||
| 676 | KUNIT_EXPECT_KASAN_FAIL(test, | 744 | /* Do the accesses past the 16 allocated bytes. */ |
| 677 | kasan_int_result = | 745 | kasan_bitops_modify(test, BITS_PER_LONG, &bits[1]); |
| 678 | test_bit(BITS_PER_LONG + BITS_PER_BYTE, bits)); | 746 | kasan_bitops_test_and_modify(test, BITS_PER_LONG + BITS_PER_BYTE, &bits[1]); |
| 679 | 747 | ||
| 680 | #if defined(clear_bit_unlock_is_negative_byte) | ||
| 681 | KUNIT_EXPECT_KASAN_FAIL(test, | ||
| 682 | kasan_int_result = clear_bit_unlock_is_negative_byte( | ||
| 683 | BITS_PER_LONG + BITS_PER_BYTE, bits)); | ||
| 684 | #endif | ||
| 685 | kfree(bits); | 748 | kfree(bits); |
| 686 | } | 749 | } |
| 687 | 750 | ||
| @@ -728,6 +791,7 @@ static struct kunit_case kasan_kunit_test_cases[] = { · 40 unmodified lines | |||
| 728 | KUNIT_CASE(kmalloc_oob_krealloc_more), | 791 | KUNIT_CASE(kmalloc_oob_krealloc_more), |
| 729 | KUNIT_CASE(kmalloc_oob_krealloc_less), | 792 | KUNIT_CASE(kmalloc_oob_krealloc_less), |
| 730 | KUNIT_CASE(kmalloc_oob_16), | 793 | KUNIT_CASE(kmalloc_oob_16), |
| 794 | KUNIT_CASE(kmalloc_uaf_16), | ||
| 731 | KUNIT_CASE(kmalloc_oob_in_memset), | 795 | KUNIT_CASE(kmalloc_oob_in_memset), |
| 732 | KUNIT_CASE(kmalloc_oob_memset_2), | 796 | KUNIT_CASE(kmalloc_oob_memset_2), |
| 733 | KUNIT_CASE(kmalloc_oob_memset_4), | 797 | KUNIT_CASE(kmalloc_oob_memset_4), |
| @@ -751,7 +815,8 @@ static struct kunit_case kasan_kunit_test_cases[] = { · 17 unmodified lines | |||
| 751 | KUNIT_CASE(kasan_memchr), | 815 | KUNIT_CASE(kasan_memchr), |
| 752 | KUNIT_CASE(kasan_memcmp), | 816 | KUNIT_CASE(kasan_memcmp), |
| 753 | KUNIT_CASE(kasan_strings), | 817 | KUNIT_CASE(kasan_strings), |
| 754 | KUNIT_CASE(kasan_bitops), | 818 | KUNIT_CASE(kasan_bitops_generic), |
| 819 | KUNIT_CASE(kasan_bitops_tags), | ||
| 755 | KUNIT_CASE(kmalloc_double_kzfree), | 820 | KUNIT_CASE(kmalloc_double_kzfree), |
| 756 | KUNIT_CASE(vmalloc_oob), | 821 | KUNIT_CASE(vmalloc_oob), |
| 757 | {} | 822 | {} |
| @@ -648,6 +648,8 @@ retry: · 647 unmodified lines | |||
| 648 | } | 648 | } |
| 649 | 649 | ||
| 650 | del += t - f; | 650 | del += t - f; |
| 651 | hugetlb_cgroup_uncharge_file_region( | ||
| 652 | resv, rg, t - f); | ||
| 651 | 653 | ||
| 652 | /* New entry for end of split region */ | 654 | /* New entry for end of split region */ |
| 653 | nrg->from = t; | 655 | nrg->from = t; |
| @@ -660,9 +662,6 @@ retry: · 6 unmodified lines | |||
| 660 | /* Original entry is trimmed */ | 662 | /* Original entry is trimmed */ |
| 661 | rg->to = f; | 663 | rg->to = f; |
| 662 | 664 | ||
| 663 | hugetlb_cgroup_uncharge_file_region( | ||
| 664 | resv, rg, nrg->to - nrg->from); | ||
| 665 | |||
| 666 | list_add(&nrg->link, &rg->link); | 665 | list_add(&nrg->link, &rg->link); |
| 667 | nrg = NULL; | 666 | nrg = NULL; |
| 668 | break; | 667 | break; |
| @@ -678,17 +677,17 @@ retry: · 9 unmodified lines | |||
| 678 | } | 677 | } |
| 679 | 678 | ||
| 680 | if (f <= rg->from) { /* Trim beginning of region */ | 679 | if (f <= rg->from) { /* Trim beginning of region */ |
| 681 | del += t - rg->from; | ||
| 682 | rg->from = t; | ||
| 683 | |||
| 684 | hugetlb_cgroup_uncharge_file_region(resv, rg, | 680 | hugetlb_cgroup_uncharge_file_region(resv, rg, |
| 685 | t - rg->from); | 681 | t - rg->from); |
| 686 | } else { /* Trim end of region */ | ||
| 687 | del += rg->to - f; | ||
| 688 | rg->to = f; | ||
| 689 | 682 | ||
| 683 | del += t - rg->from; | ||
| 684 | rg->from = t; | ||
| 685 | } else { /* Trim end of region */ | ||
| 690 | hugetlb_cgroup_uncharge_file_region(resv, rg, | 686 | hugetlb_cgroup_uncharge_file_region(resv, rg, |
| 691 | rg->to - f); | 687 | rg->to - f); |
| 688 | |||
| 689 | del += rg->to - f; | ||
| 690 | rg->to = f; | ||
| 692 | } | 691 | } |
| 693 | } | 692 | } |
| 694 | 693 | ||
| @@ -2443,6 +2442,9 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, · 1748 unmodified lines | |||
| 2443 | 2442 | ||
| 2444 | rsv_adjust = hugepage_subpool_put_pages(spool, 1); | 2443 | rsv_adjust = hugepage_subpool_put_pages(spool, 1); |
| 2445 | hugetlb_acct_memory(h, -rsv_adjust); | 2444 | hugetlb_acct_memory(h, -rsv_adjust); |
| 2445 | if (deferred_reserve) | ||
| 2446 | hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h), | ||
| 2447 | pages_per_huge_page(h), page); | ||
| 2446 | } | 2448 | } |
| 2447 | return page; | 2449 | return page; |
| 2448 | 2450 | ||
| @@ -4110,11 +4110,17 @@ static int memcg_stat_show(struct seq_file *m, void *v) · 4109 unmodified lines | |||
| 4110 | (u64)memsw * PAGE_SIZE); | 4110 | (u64)memsw * PAGE_SIZE); |
| 4111 | 4111 | ||
| 4112 | for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) { | 4112 | for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) { |
| 4113 | unsigned long nr; | ||
| 4114 | |||
| 4113 | if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account()) | 4115 | if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account()) |
| 4114 | continue; | 4116 | continue; |
| 4117 | nr = memcg_page_state(memcg, memcg1_stats[i]); | ||
| 4118 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
| 4119 | if (memcg1_stats[i] == NR_ANON_THPS) | ||
| 4120 | nr *= HPAGE_PMD_NR; | ||
| 4121 | #endif | ||
| 4115 | seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i], | 4122 | seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i], |
| 4116 | (u64)memcg_page_state(memcg, memcg1_stats[i]) * | 4123 | (u64)nr * PAGE_SIZE); |
| 4117 | PAGE_SIZE); | ||
| 4118 | } | 4124 | } |
| 4119 | 4125 | ||
| 4120 | for (i = 0; i < ARRAY_SIZE(memcg1_events); i++) | 4126 | for (i = 0; i < ARRAY_SIZE(memcg1_events); i++) |
| @@ -5339,17 +5345,22 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) · 1218 unmodified lines | |||
| 5339 | memcg->swappiness = mem_cgroup_swappiness(parent); | 5345 | memcg->swappiness = mem_cgroup_swappiness(parent); |
| 5340 | memcg->oom_kill_disable = parent->oom_kill_disable; | 5346 | memcg->oom_kill_disable = parent->oom_kill_disable; |
| 5341 | } | 5347 | } |
| 5342 | if (parent && parent->use_hierarchy) { | 5348 | if (!parent) { |
| 5349 | page_counter_init(&memcg->memory, NULL); | ||
| 5350 | page_counter_init(&memcg->swap, NULL); | ||
| 5351 | page_counter_init(&memcg->kmem, NULL); | ||
| 5352 | page_counter_init(&memcg->tcpmem, NULL); | ||
| 5353 | } else if (parent->use_hierarchy) { | ||
| 5343 | memcg->use_hierarchy = true; | 5354 | memcg->use_hierarchy = true; |
| 5344 | page_counter_init(&memcg->memory, &parent->memory); | 5355 | page_counter_init(&memcg->memory, &parent->memory); |
| 5345 | page_counter_init(&memcg->swap, &parent->swap); | 5356 | page_counter_init(&memcg->swap, &parent->swap); |
| 5346 | page_counter_init(&memcg->kmem, &parent->kmem); | 5357 | page_counter_init(&memcg->kmem, &parent->kmem); |
| 5347 | page_counter_init(&memcg->tcpmem, &parent->tcpmem); | 5358 | page_counter_init(&memcg->tcpmem, &parent->tcpmem); |
| 5348 | } else { | 5359 | } else { |
| 5349 | page_counter_init(&memcg->memory, NULL); | 5360 | page_counter_init(&memcg->memory, &root_mem_cgroup->memory); |
| 5350 | page_counter_init(&memcg->swap, NULL); | 5361 | page_counter_init(&memcg->swap, &root_mem_cgroup->swap); |
| 5351 | page_counter_init(&memcg->kmem, NULL); | 5362 | page_counter_init(&memcg->kmem, &root_mem_cgroup->kmem); |
| 5352 | page_counter_init(&memcg->tcpmem, NULL); | 5363 | page_counter_init(&memcg->tcpmem, &root_mem_cgroup->tcpmem); |
| 5353 | /* | 5364 | /* |
| 5354 | * Deeper hierachy with use_hierarchy == false doesn't make | 5365 | * Deeper hierachy with use_hierarchy == false doesn't make |
| 5355 | * much sense so let cgroup subsystem know about this | 5366 | * much sense so let cgroup subsystem know about this |
| @@ -525,7 +525,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, · 524 unmodified lines | |||
| 525 | unsigned long flags = qp->flags; | 525 | unsigned long flags = qp->flags; |
| 526 | int ret; | 526 | int ret; |
| 527 | bool has_unmovable = false; | 527 | bool has_unmovable = false; |
| 528 | pte_t *pte; | 528 | pte_t *pte, *mapped_pte; |
| 529 | spinlock_t *ptl; | 529 | spinlock_t *ptl; |
| 530 | 530 | ||
| 531 | ptl = pmd_trans_huge_lock(pmd, vma); | 531 | ptl = pmd_trans_huge_lock(pmd, vma); |
| @@ -539,7 +539,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, · 7 unmodified lines | |||
| 539 | if (pmd_trans_unstable(pmd)) | 539 | if (pmd_trans_unstable(pmd)) |
| 540 | return 0; | 540 | return 0; |
| 541 | 541 | ||
| 542 | pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); | 542 | mapped_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); |
| 543 | for (; addr != end; pte++, addr += PAGE_SIZE) { | 543 | for (; addr != end; pte++, addr += PAGE_SIZE) { |
| 544 | if (!pte_present(*pte)) | 544 | if (!pte_present(*pte)) |
| 545 | continue; | 545 | continue; |
| @@ -571,7 +571,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, · 25 unmodified lines | |||
| 571 | } else | 571 | } else |
| 572 | break; | 572 | break; |
| 573 | } | 573 | } |
| 574 | pte_unmap_unlock(pte - 1, ptl); | 574 | pte_unmap_unlock(mapped_pte, ptl); |
| 575 | cond_resched(); | 575 | cond_resched(); |
| 576 | 576 | ||
| 577 | if (has_unmovable) | 577 | if (has_unmovable) |
| @@ -41,28 +41,24 @@ EXPORT_SYMBOL_GPL(memremap_compat_align); · 40 unmodified lines | |||
| 41 | DEFINE_STATIC_KEY_FALSE(devmap_managed_key); | 41 | DEFINE_STATIC_KEY_FALSE(devmap_managed_key); |
| 42 | EXPORT_SYMBOL(devmap_managed_key); | 42 | EXPORT_SYMBOL(devmap_managed_key); |
| 43 | 43 | ||
| 44 | static void devmap_managed_enable_put(void) | 44 | static void devmap_managed_enable_put(struct dev_pagemap *pgmap) |
| 45 | { | 45 | { |
| 46 | static_branch_dec(&devmap_managed_key); | 46 | if (pgmap->type == MEMORY_DEVICE_PRIVATE || |
| 47 | pgmap->type == MEMORY_DEVICE_FS_DAX) | ||
| 48 | static_branch_dec(&devmap_managed_key); | ||
| 47 | } | 49 | } |
| 48 | 50 | ||
| 49 | static int devmap_managed_enable_get(struct dev_pagemap *pgmap) | 51 | static void devmap_managed_enable_get(struct dev_pagemap *pgmap) |
| 50 | { | 52 | { |
| 51 | if (pgmap->type == MEMORY_DEVICE_PRIVATE && | 53 | if (pgmap->type == MEMORY_DEVICE_PRIVATE || |
| 52 | (!pgmap->ops || !pgmap->ops->page_free)) { | 54 | pgmap->type == MEMORY_DEVICE_FS_DAX) |
| 53 | WARN(1, "Missing page_free method\n"); | 55 | static_branch_inc(&devmap_managed_key); |
| 54 | return -EINVAL; | ||
| 55 | } | ||
| 56 | |||
| 57 | static_branch_inc(&devmap_managed_key); | ||
| 58 | return 0; | ||
| 59 | } | 56 | } |
| 60 | #else | 57 | #else |
| 61 | static int devmap_managed_enable_get(struct dev_pagemap *pgmap) | 58 | static void devmap_managed_enable_get(struct dev_pagemap *pgmap) |
| 62 | { | 59 | { |
| 63 | return -EINVAL; | ||
| 64 | } | 60 | } |
| 65 | static void devmap_managed_enable_put(void) | 61 | static void devmap_managed_enable_put(struct dev_pagemap *pgmap) |
| 66 | { | 62 | { |
| 67 | } | 63 | } |
| 68 | #endif /* CONFIG_DEV_PAGEMAP_OPS */ | 64 | #endif /* CONFIG_DEV_PAGEMAP_OPS */ |
| @@ -169,7 +165,7 @@ void memunmap_pages(struct dev_pagemap *pgmap) · 100 unmodified lines | |||
| 169 | pageunmap_range(pgmap, i); | 165 | pageunmap_range(pgmap, i); |
| 170 | 166 | ||
| 171 | WARN_ONCE(pgmap->altmap.alloc, "failed to free all reserved pages\n"); | 167 | WARN_ONCE(pgmap->altmap.alloc, "failed to free all reserved pages\n"); |
| 172 | devmap_managed_enable_put(); | 168 | devmap_managed_enable_put(pgmap); |
| 173 | } | 169 | } |
| 174 | EXPORT_SYMBOL_GPL(memunmap_pages); | 170 | EXPORT_SYMBOL_GPL(memunmap_pages); |
| 175 | 171 | ||
| @@ -307,7 +303,6 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 131 unmodified lines | |||
| 307 | .pgprot = PAGE_KERNEL, | 303 | .pgprot = PAGE_KERNEL, |
| 308 | }; | 304 | }; |
| 309 | const int nr_range = pgmap->nr_range; | 305 | const int nr_range = pgmap->nr_range; |
| 310 | bool need_devmap_managed = true; | ||
| 311 | int error, i; | 306 | int error, i; |
| 312 | 307 | ||
| 313 | if (WARN_ONCE(!nr_range, "nr_range must be specified\n")) | 308 | if (WARN_ONCE(!nr_range, "nr_range must be specified\n")) |
| @@ -323,6 +318,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 9 unmodified lines | |||
| 323 | WARN(1, "Missing migrate_to_ram method\n"); | 318 | WARN(1, "Missing migrate_to_ram method\n"); |
| 324 | return ERR_PTR(-EINVAL); | 319 | return ERR_PTR(-EINVAL); |
| 325 | } | 320 | } |
| 321 | if (!pgmap->ops->page_free) { | ||
| 322 | WARN(1, "Missing page_free method\n"); | ||
| 323 | return ERR_PTR(-EINVAL); | ||
| 324 | } | ||
| 326 | if (!pgmap->owner) { | 325 | if (!pgmap->owner) { |
| 327 | WARN(1, "Missing owner\n"); | 326 | WARN(1, "Missing owner\n"); |
| 328 | return ERR_PTR(-EINVAL); | 327 | return ERR_PTR(-EINVAL); |
| @@ -336,11 +335,9 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 7 unmodified lines | |||
| 336 | } | 335 | } |
| 337 | break; | 336 | break; |
| 338 | case MEMORY_DEVICE_GENERIC: | 337 | case MEMORY_DEVICE_GENERIC: |
| 339 | need_devmap_managed = false; | ||
| 340 | break; | 338 | break; |
| 341 | case MEMORY_DEVICE_PCI_P2PDMA: | 339 | case MEMORY_DEVICE_PCI_P2PDMA: |
| 342 | params.pgprot = pgprot_noncached(params.pgprot); | 340 | params.pgprot = pgprot_noncached(params.pgprot); |
| 343 | need_devmap_managed = false; | ||
| 344 | break; | 341 | break; |
| 345 | default: | 342 | default: |
| 346 | WARN(1, "Invalid pgmap type %d\n", pgmap->type); | 343 | WARN(1, "Invalid pgmap type %d\n", pgmap->type); |
| @@ -364,11 +361,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 17 unmodified lines | |||
| 364 | } | 361 | } |
| 365 | } | 362 | } |
| 366 | 363 | ||
| 367 | if (need_devmap_managed) { | 364 | devmap_managed_enable_get(pgmap); |
| 368 | error = devmap_managed_enable_get(pgmap); | ||
| 369 | if (error) | ||
| 370 | return ERR_PTR(error); | ||
| 371 | } | ||
| 372 | 365 | ||
| 373 | /* | 366 | /* |
| 374 | * Clear the pgmap nr_range as it will be incremented for each | 367 | * Clear the pgmap nr_range as it will be incremented for each |
| @@ -528,7 +528,7 @@ void truncate_inode_pages_final(struct address_space *mapping) · 527 unmodified lines | |||
| 528 | } | 528 | } |
| 529 | EXPORT_SYMBOL(truncate_inode_pages_final); | 529 | EXPORT_SYMBOL(truncate_inode_pages_final); |
| 530 | 530 | ||
| 531 | unsigned long __invalidate_mapping_pages(struct address_space *mapping, | 531 | static unsigned long __invalidate_mapping_pages(struct address_space *mapping, |
| 532 | pgoff_t start, pgoff_t end, unsigned long *nr_pagevec) | 532 | pgoff_t start, pgoff_t end, unsigned long *nr_pagevec) |
| 533 | { | 533 | { |
| 534 | pgoff_t indices[PAGEVEC_SIZE]; | 534 | pgoff_t indices[PAGEVEC_SIZE]; |
| @@ -954,9 +954,8 @@ static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos) · 953 unmodified lines | |||
| 954 | { | 954 | { |
| 955 | struct lec_state *state = seq->private; | 955 | struct lec_state *state = seq->private; |
| 956 | 956 | ||
| 957 | v = lec_get_idx(state, 1); | 957 | ++*pos; |
| 958 | *pos += !!PTR_ERR(v); | 958 | return lec_get_idx(state, 1); |
| 959 | return v; | ||
| 960 | } | 959 | } |
| 961 | 960 | ||
| 962 | static int lec_seq_show(struct seq_file *seq, void *v) | 961 | static int lec_seq_show(struct seq_file *seq, void *v) |
| @@ -62,8 +62,9 @@ config CAN_ISOTP · 61 unmodified lines | |||
| 62 | communication between CAN nodes via two defined CAN Identifiers. | 62 | communication between CAN nodes via two defined CAN Identifiers. |
| 63 | As CAN frames can only transport a small amount of data bytes | 63 | As CAN frames can only transport a small amount of data bytes |
| 64 | (max. 8 bytes for 'classic' CAN and max. 64 bytes for CAN FD) this | 64 | (max. 8 bytes for 'classic' CAN and max. 64 bytes for CAN FD) this |
| 65 | segmentation is needed to transport longer PDUs as needed e.g. for | 65 | segmentation is needed to transport longer Protocol Data Units (PDU) |
| 66 | vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN traffic. | 66 | as needed e.g. for vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN |
| 67 | traffic. | ||
| 67 | This protocol driver implements data transfers according to | 68 | This protocol driver implements data transfers according to |
| 68 | ISO 15765-2:2016 for 'classic' CAN and CAN FD frame types. | 69 | ISO 15765-2:2016 for 'classic' CAN and CAN FD frame types. |
| 69 | If you want to perform automotive vehicle diagnostic services (UDS), | 70 | If you want to perform automotive vehicle diagnostic services (UDS), |
| @@ -252,14 +252,16 @@ static void isotp_rcv_skb(struct sk_buff *skb, struct sock *sk) · 251 unmodified lines | |||
| 252 | 252 | ||
| 253 | static u8 padlen(u8 datalen) | 253 | static u8 padlen(u8 datalen) |
| 254 | { | 254 | { |
| 255 | const u8 plen[] = {8, 8, 8, 8, 8, 8, 8, 8, 8, /* 0 - 8 */ | 255 | static const u8 plen[] = { |
| 256 | 12, 12, 12, 12, /* 9 - 12 */ | 256 | 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 0 - 8 */ |
| 257 | 16, 16, 16, 16, /* 13 - 16 */ | 257 | 12, 12, 12, 12, /* 9 - 12 */ |
| 258 | 20, 20, 20, 20, /* 17 - 20 */ | 258 | 16, 16, 16, 16, /* 13 - 16 */ |
| 259 | 24, 24, 24, 24, /* 21 - 24 */ | 259 | 20, 20, 20, 20, /* 17 - 20 */ |
| 260 | 32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */ | 260 | 24, 24, 24, 24, /* 21 - 24 */ |
| 261 | 48, 48, 48, 48, 48, 48, 48, 48, /* 33 - 40 */ | 261 | 32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */ |
| 262 | 48, 48, 48, 48, 48, 48, 48, 48}; /* 41 - 48 */ | 262 | 48, 48, 48, 48, 48, 48, 48, 48, /* 33 - 40 */ |
| 263 | 48, 48, 48, 48, 48, 48, 48, 48 /* 41 - 48 */ | ||
| 264 | }; | ||
| 263 | 265 | ||
| 264 | if (datalen > 48) | 266 | if (datalen > 48) |
| 265 | return 64; | 267 | return 64; |
| @@ -569,10 +571,6 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae, · 303 unmodified lines | |||
| 569 | return 0; | 571 | return 0; |
| 570 | } | 572 | } |
| 571 | 573 | ||
| 572 | /* no creation of flow control frames */ | ||
| 573 | if (so->opt.flags & CAN_ISOTP_LISTEN_MODE) | ||
| 574 | return 0; | ||
| 575 | |||
| 576 | /* perform blocksize handling, if enabled */ | 574 | /* perform blocksize handling, if enabled */ |
| 577 | if (!so->rxfc.bs || ++so->rx.bs < so->rxfc.bs) { | 575 | if (!so->rxfc.bs || ++so->rx.bs < so->rxfc.bs) { |
| 578 | /* start rx timeout watchdog */ | 576 | /* start rx timeout watchdog */ |
| @@ -581,6 +579,10 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae, · 2 unmodified lines | |||
| 581 | return 0; | 579 | return 0; |
| 582 | } | 580 | } |
| 583 | 581 | ||
| 582 | /* no creation of flow control frames */ | ||
| 583 | if (so->opt.flags & CAN_ISOTP_LISTEN_MODE) | ||
| 584 | return 0; | ||
| 585 | |||
| 584 | /* we reached the specified blocksize so->rxfc.bs */ | 586 | /* we reached the specified blocksize so->rxfc.bs */ |
| 585 | isotp_send_fc(sk, ae, ISOTP_FC_CTS); | 587 | isotp_send_fc(sk, ae, ISOTP_FC_CTS); |
| 586 | return 0; | 588 | return 0; |
| @@ -475,6 +475,12 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) · 474 unmodified lines | |||
| 475 | goto out_release_sock; | 475 | goto out_release_sock; |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | if (!(ndev->flags & IFF_UP)) { | ||
| 479 | dev_put(ndev); | ||
| 480 | ret = -ENETDOWN; | ||
| 481 | goto out_release_sock; | ||
| 482 | } | ||
| 483 | |||
| 478 | priv = j1939_netdev_start(ndev); | 484 | priv = j1939_netdev_start(ndev); |
| 479 | dev_put(ndev); | 485 | dev_put(ndev); |
| 480 | if (IS_ERR(priv)) { | 486 | if (IS_ERR(priv)) { |
| @@ -462,6 +462,9 @@ void can_init_proc(struct net *net) · 461 unmodified lines | |||
| 462 | */ | 462 | */ |
| 463 | void can_remove_proc(struct net *net) | 463 | void can_remove_proc(struct net *net) |
| 464 | { | 464 | { |
| 465 | if (!net->can.proc_dir) | ||
| 466 | return; | ||
| 467 | |||
| 465 | if (net->can.pde_stats) | 468 | if (net->can.pde_stats) |
| 466 | remove_proc_entry(CAN_PROC_STATS, net->can.proc_dir); | 469 | remove_proc_entry(CAN_PROC_STATS, net->can.proc_dir); |
| 467 | 470 | ||
| @@ -486,6 +489,5 @@ void can_remove_proc(struct net *net) · 18 unmodified lines | |||
| 486 | if (net->can.pde_rcvlist_sff) | 489 | if (net->can.pde_rcvlist_sff) |
| 487 | remove_proc_entry(CAN_PROC_RCVLIST_SFF, net->can.proc_dir); | 490 | remove_proc_entry(CAN_PROC_RCVLIST_SFF, net->can.proc_dir); |
| 488 | 491 | ||
| 489 | if (net->can.proc_dir) | 492 | remove_proc_entry("can", net->proc_net); |
| 490 | remove_proc_entry("can", net->proc_net); | ||
| 491 | } | 493 | } |
| @@ -608,9 +608,6 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, · 607 unmodified lines | |||
| 608 | ttl = ip4_dst_hoplimit(&rt->dst); | 608 | ttl = ip4_dst_hoplimit(&rt->dst); |
| 609 | } | 609 | } |
| 610 | 610 | ||
| 611 | if (!df && skb->protocol == htons(ETH_P_IP)) | ||
| 612 | df = inner_iph->frag_off & htons(IP_DF); | ||
| 613 | |||
| 614 | headroom += LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len; | 611 | headroom += LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len; |
| 615 | if (headroom > dev->needed_headroom) | 612 | if (headroom > dev->needed_headroom) |
| 616 | dev->needed_headroom = headroom; | 613 | dev->needed_headroom = headroom; |
| @@ -17,17 +17,19 @@ · 16 unmodified lines | |||
| 17 | #include <net/netfilter/nf_queue.h> | 17 | #include <net/netfilter/nf_queue.h> |
| 18 | 18 | ||
| 19 | /* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */ | 19 | /* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */ |
| 20 | int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_type) | 20 | int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int addr_type) |
| 21 | { | 21 | { |
| 22 | const struct iphdr *iph = ip_hdr(skb); | 22 | const struct iphdr *iph = ip_hdr(skb); |
| 23 | struct rtable *rt; | 23 | struct rtable *rt; |
| 24 | struct flowi4 fl4 = {}; | 24 | struct flowi4 fl4 = {}; |
| 25 | __be32 saddr = iph->saddr; | 25 | __be32 saddr = iph->saddr; |
| 26 | const struct sock *sk = skb_to_full_sk(skb); | 26 | __u8 flags; |
| 27 | __u8 flags = sk ? inet_sk_flowi_flags(sk) : 0; | ||
| 28 | struct net_device *dev = skb_dst(skb)->dev; | 27 | struct net_device *dev = skb_dst(skb)->dev; |
| 29 | unsigned int hh_len; | 28 | unsigned int hh_len; |
| 30 | 29 | ||
| 30 | sk = sk_to_full_sk(sk); | ||
| 31 | flags = sk ? inet_sk_flowi_flags(sk) : 0; | ||
| 32 | |||
| 31 | if (addr_type == RTN_UNSPEC) | 33 | if (addr_type == RTN_UNSPEC) |
| 32 | addr_type = inet_addr_type_dev_table(net, dev, saddr); | 34 | addr_type = inet_addr_type_dev_table(net, dev, saddr); |
| 33 | if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST) | 35 | if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST) |
| @@ -62,7 +62,7 @@ ipt_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state) · 61 unmodified lines | |||
| 62 | iph->daddr != daddr || | 62 | iph->daddr != daddr || |
| 63 | skb->mark != mark || | 63 | skb->mark != mark || |
| 64 | iph->tos != tos) { | 64 | iph->tos != tos) { |
| 65 | err = ip_route_me_harder(state->net, skb, RTN_UNSPEC); | 65 | err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC); |
| 66 | if (err < 0) | 66 | if (err < 0) |
| 67 | ret = NF_DROP_ERR(err); | 67 | ret = NF_DROP_ERR(err); |
| 68 | } | 68 | } |
| @@ -145,7 +145,7 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook) · 144 unmodified lines | |||
| 145 | ip4_dst_hoplimit(skb_dst(nskb))); | 145 | ip4_dst_hoplimit(skb_dst(nskb))); |
| 146 | nf_reject_ip_tcphdr_put(nskb, oldskb, oth); | 146 | nf_reject_ip_tcphdr_put(nskb, oldskb, oth); |
| 147 | 147 | ||
| 148 | if (ip_route_me_harder(net, nskb, RTN_UNSPEC)) | 148 | if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC)) |
| 149 | goto free_nskb; | 149 | goto free_nskb; |
| 150 | 150 | ||
| 151 | niph = ip_hdr(nskb); | 151 | niph = ip_hdr(nskb); |
| @@ -64,14 +64,14 @@ static int xfrm_tunnel_err(struct sk_buff *skb, u32 info) · 63 unmodified lines | |||
| 64 | static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = { | 64 | static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = { |
| 65 | .handler = xfrm_tunnel_rcv, | 65 | .handler = xfrm_tunnel_rcv, |
| 66 | .err_handler = xfrm_tunnel_err, | 66 | .err_handler = xfrm_tunnel_err, |
| 67 | .priority = 3, | 67 | .priority = 4, |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | #if IS_ENABLED(CONFIG_IPV6) | 70 | #if IS_ENABLED(CONFIG_IPV6) |
| 71 | static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = { | 71 | static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = { |
| 72 | .handler = xfrm_tunnel_rcv, | 72 | .handler = xfrm_tunnel_rcv, |
| 73 | .err_handler = xfrm_tunnel_err, | 73 | .err_handler = xfrm_tunnel_err, |
| 74 | .priority = 2, | 74 | .priority = 3, |
| 75 | }; | 75 | }; |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| @@ -158,7 +158,13 @@ static bool is_ineligible(const struct sk_buff *skb) · 157 unmodified lines | |||
| 158 | tp = skb_header_pointer(skb, | 158 | tp = skb_header_pointer(skb, |
| 159 | ptr+offsetof(struct icmp6hdr, icmp6_type), | 159 | ptr+offsetof(struct icmp6hdr, icmp6_type), |
| 160 | sizeof(_type), &_type); | 160 | sizeof(_type), &_type); |
| 161 | if (!tp || !(*tp & ICMPV6_INFOMSG_MASK)) | 161 | |
| 162 | /* Based on RFC 8200, Section 4.5 Fragment Header, return | ||
| 163 | * false if this is a fragment packet with no icmp header info. | ||
| 164 | */ | ||
| 165 | if (!tp && frag_off != 0) | ||
| 166 | return false; | ||
| 167 | else if (!tp || !(*tp & ICMPV6_INFOMSG_MASK)) | ||
| 162 | return true; | 168 | return true; |
| 163 | } | 169 | } |
| 164 | return false; | 170 | return false; |
| @@ -1271,6 +1271,8 @@ route_lookup: · 1270 unmodified lines | |||
| 1271 | if (max_headroom > dev->needed_headroom) | 1271 | if (max_headroom > dev->needed_headroom) |
| 1272 | dev->needed_headroom = max_headroom; | 1272 | dev->needed_headroom = max_headroom; |
| 1273 | 1273 | ||
| 1274 | skb_set_inner_ipproto(skb, proto); | ||
| 1275 | |||
| 1274 | err = ip6_tnl_encap(skb, t, &proto, fl6); | 1276 | err = ip6_tnl_encap(skb, t, &proto, fl6); |
| 1275 | if (err) | 1277 | if (err) |
| 1276 | return err; | 1278 | return err; |
| @@ -1280,8 +1282,6 @@ route_lookup: · 3 unmodified lines | |||
| 1280 | ipv6_push_frag_opts(skb, &opt.ops, &proto); | 1282 | ipv6_push_frag_opts(skb, &opt.ops, &proto); |
| 1281 | } | 1283 | } |
| 1282 | 1284 | ||
| 1283 | skb_set_inner_ipproto(skb, proto); | ||
| 1284 | |||
| 1285 | skb_push(skb, sizeof(struct ipv6hdr)); | 1285 | skb_push(skb, sizeof(struct ipv6hdr)); |
| 1286 | skb_reset_network_header(skb); | 1286 | skb_reset_network_header(skb); |
| 1287 | ipv6h = ipv6_hdr(skb); | 1287 | ipv6h = ipv6_hdr(skb); |
| @@ -20,10 +20,10 @@ · 19 unmodified lines | |||
| 20 | #include <net/netfilter/ipv6/nf_defrag_ipv6.h> | 20 | #include <net/netfilter/ipv6/nf_defrag_ipv6.h> |
| 21 | #include "../bridge/br_private.h" | 21 | #include "../bridge/br_private.h" |
| 22 | 22 | ||
| 23 | int ip6_route_me_harder(struct net *net, struct sk_buff *skb) | 23 | int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff *skb) |
| 24 | { | 24 | { |
| 25 | const struct ipv6hdr *iph = ipv6_hdr(skb); | 25 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
| 26 | struct sock *sk = sk_to_full_sk(skb->sk); | 26 | struct sock *sk = sk_to_full_sk(sk_partial); |
| 27 | unsigned int hh_len; | 27 | unsigned int hh_len; |
| 28 | struct dst_entry *dst; | 28 | struct dst_entry *dst; |
| 29 | int strict = (ipv6_addr_type(&iph->daddr) & | 29 | int strict = (ipv6_addr_type(&iph->daddr) & |
| @@ -84,7 +84,7 @@ static int nf_ip6_reroute(struct sk_buff *skb, · 54 unmodified lines | |||
| 84 | if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) || | 84 | if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) || |
| 85 | !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) || | 85 | !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) || |
| 86 | skb->mark != rt_info->mark) | 86 | skb->mark != rt_info->mark) |
| 87 | return ip6_route_me_harder(entry->state.net, skb); | 87 | return ip6_route_me_harder(entry->state.net, entry->state.sk, skb); |
| 88 | } | 88 | } |
| 89 | return 0; | 89 | return 0; |
| 90 | } | 90 | } |
| @@ -57,7 +57,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state) · 56 unmodified lines | |||
| 57 | skb->mark != mark || | 57 | skb->mark != mark || |
| 58 | ipv6_hdr(skb)->hop_limit != hop_limit || | 58 | ipv6_hdr(skb)->hop_limit != hop_limit || |
| 59 | flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { | 59 | flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { |
| 60 | err = ip6_route_me_harder(state->net, skb); | 60 | err = ip6_route_me_harder(state->net, state->sk, skb); |
| 61 | if (err < 0) | 61 | if (err < 0) |
| 62 | ret = NF_DROP_ERR(err); | 62 | ret = NF_DROP_ERR(err); |
| 63 | } | 63 | } |
| @@ -42,6 +42,8 @@ · 41 unmodified lines | |||
| 42 | #include <linux/skbuff.h> | 42 | #include <linux/skbuff.h> |
| 43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
| 44 | #include <linux/export.h> | 44 | #include <linux/export.h> |
| 45 | #include <linux/tcp.h> | ||
| 46 | #include <linux/udp.h> | ||
| 45 | 47 | ||
| 46 | #include <net/sock.h> | 48 | #include <net/sock.h> |
| 47 | #include <net/snmp.h> | 49 | #include <net/snmp.h> |
| @@ -322,7 +324,9 @@ static int ipv6_frag_rcv(struct sk_buff *skb) · 274 unmodified lines | |||
| 322 | struct frag_queue *fq; | 324 | struct frag_queue *fq; |
| 323 | const struct ipv6hdr *hdr = ipv6_hdr(skb); | 325 | const struct ipv6hdr *hdr = ipv6_hdr(skb); |
| 324 | struct net *net = dev_net(skb_dst(skb)->dev); | 326 | struct net *net = dev_net(skb_dst(skb)->dev); |
| 325 | int iif; | 327 | __be16 frag_off; |
| 328 | int iif, offset; | ||
| 329 | u8 nexthdr; | ||
| 326 | 330 | ||
| 327 | if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED) | 331 | if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED) |
| 328 | goto fail_hdr; | 332 | goto fail_hdr; |
| @@ -351,6 +355,33 @@ static int ipv6_frag_rcv(struct sk_buff *skb) · 22 unmodified lines | |||
| 351 | return 1; | 355 | return 1; |
| 352 | } | 356 | } |
| 353 | 357 | ||
| 358 | /* RFC 8200, Section 4.5 Fragment Header: | ||
| 359 | * If the first fragment does not include all headers through an | ||
| 360 | * Upper-Layer header, then that fragment should be discarded and | ||
| 361 | * an ICMP Parameter Problem, Code 3, message should be sent to | ||
| 362 | * the source of the fragment, with the Pointer field set to zero. | ||
| 363 | */ | ||
| 364 | nexthdr = hdr->nexthdr; | ||
| 365 | offset = ipv6_skip_exthdr(skb, skb_transport_offset(skb), &nexthdr, &frag_off); | ||
| 366 | if (offset >= 0) { | ||
| 367 | /* Check some common protocols' header */ | ||
| 368 | if (nexthdr == IPPROTO_TCP) | ||
| 369 | offset += sizeof(struct tcphdr); | ||
| 370 | else if (nexthdr == IPPROTO_UDP) | ||
| 371 | offset += sizeof(struct udphdr); | ||
| 372 | else if (nexthdr == IPPROTO_ICMPV6) | ||
| 373 | offset += sizeof(struct icmp6hdr); | ||
| 374 | else | ||
| 375 | offset += 1; | ||
| 376 | |||
| 377 | if (!(frag_off & htons(IP6_OFFSET)) && offset > skb->len) { | ||
| 378 | __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev), | ||
| 379 | IPSTATS_MIB_INHDRERRORS); | ||
| 380 | icmpv6_param_prob(skb, ICMPV6_HDR_INCOMP, 0); | ||
| 381 | return -1; | ||
| 382 | } | ||
| 383 | } | ||
| 384 | |||
| 354 | iif = skb->dev ? skb->dev->ifindex : 0; | 385 | iif = skb->dev ? skb->dev->ifindex : 0; |
| 355 | fq = fq_find(net, fhdr->identification, hdr, iif); | 386 | fq = fq_find(net, fhdr->identification, hdr, iif); |
| 356 | if (fq) { | 387 | if (fq) { |
| @@ -303,13 +303,13 @@ static const struct xfrm_type xfrm6_tunnel_type = { · 302 unmodified lines | |||
| 303 | static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = { | 303 | static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = { |
| 304 | .handler = xfrm6_tunnel_rcv, | 304 | .handler = xfrm6_tunnel_rcv, |
| 305 | .err_handler = xfrm6_tunnel_err, | 305 | .err_handler = xfrm6_tunnel_err, |
| 306 | .priority = 2, | 306 | .priority = 3, |
| 307 | }; | 307 | }; |
| 308 | 308 | ||
| 309 | static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = { | 309 | static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = { |
| 310 | .handler = xfrm6_tunnel_rcv, | 310 | .handler = xfrm6_tunnel_rcv, |
| 311 | .err_handler = xfrm6_tunnel_err, | 311 | .err_handler = xfrm6_tunnel_err, |
| 312 | .priority = 2, | 312 | .priority = 3, |
| 313 | }; | 313 | }; |
| 314 | 314 | ||
| 315 | static int __net_init xfrm6_tunnel_net_init(struct net *net) | 315 | static int __net_init xfrm6_tunnel_net_init(struct net *net) |
| @@ -5464,6 +5464,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 5463 unmodified lines | |||
| 5464 | struct cfg80211_assoc_request *req) | 5464 | struct cfg80211_assoc_request *req) |
| 5465 | { | 5465 | { |
| 5466 | bool is_6ghz = req->bss->channel->band == NL80211_BAND_6GHZ; | 5466 | bool is_6ghz = req->bss->channel->band == NL80211_BAND_6GHZ; |
| 5467 | bool is_5ghz = req->bss->channel->band == NL80211_BAND_5GHZ; | ||
| 5467 | struct ieee80211_local *local = sdata->local; | 5468 | struct ieee80211_local *local = sdata->local; |
| 5468 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 5469 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
| 5469 | struct ieee80211_bss *bss = (void *)req->bss->priv; | 5470 | struct ieee80211_bss *bss = (void *)req->bss->priv; |
| @@ -5616,7 +5617,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 146 unmodified lines | |||
| 5616 | if (vht_ie && vht_ie[1] >= sizeof(struct ieee80211_vht_cap)) | 5617 | if (vht_ie && vht_ie[1] >= sizeof(struct ieee80211_vht_cap)) |
| 5617 | memcpy(&assoc_data->ap_vht_cap, vht_ie + 2, | 5618 | memcpy(&assoc_data->ap_vht_cap, vht_ie + 2, |
| 5618 | sizeof(struct ieee80211_vht_cap)); | 5619 | sizeof(struct ieee80211_vht_cap)); |
| 5619 | else if (!is_6ghz) | 5620 | else if (is_5ghz) |
| 5620 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT | | 5621 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT | |
| 5621 | IEEE80211_STA_DISABLE_HE; | 5622 | IEEE80211_STA_DISABLE_HE; |
| 5622 | rcu_read_unlock(); | 5623 | rcu_read_unlock(); |
| @@ -258,6 +258,24 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, · 257 unmodified lines | |||
| 258 | */ | 258 | */ |
| 259 | void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) | 259 | void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) |
| 260 | { | 260 | { |
| 261 | /* | ||
| 262 | * If we had used sta_info_pre_move_state() then we might not | ||
| 263 | * have gone through the state transitions down again, so do | ||
| 264 | * it here now (and warn if it's inserted). | ||
| 265 | * | ||
| 266 | * This will clear state such as fast TX/RX that may have been | ||
| 267 | * allocated during state transitions. | ||
| 268 | */ | ||
| 269 | while (sta->sta_state > IEEE80211_STA_NONE) { | ||
| 270 | int ret; | ||
| 271 | |||
| 272 | WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED)); | ||
| 273 | |||
| 274 | ret = sta_info_move_state(sta, sta->sta_state - 1); | ||
| 275 | if (WARN_ONCE(ret, "sta_info_move_state() returned %d\n", ret)) | ||
| 276 | break; | ||
| 277 | } | ||
| 278 | |||
| 261 | if (sta->rate_ctrl) | 279 | if (sta->rate_ctrl) |
| 262 | rate_control_free_sta(sta); | 280 | rate_control_free_sta(sta); |
| 263 | 281 | ||
| @@ -785,7 +785,7 @@ int sta_info_init(struct ieee80211_local *local); · 784 unmodified lines | |||
| 785 | void sta_info_stop(struct ieee80211_local *local); | 785 | void sta_info_stop(struct ieee80211_local *local); |
| 786 | 786 | ||
| 787 | /** | 787 | /** |
| 788 | * sta_info_flush - flush matching STA entries from the STA table | 788 | * __sta_info_flush - flush matching STA entries from the STA table |
| 789 | * | 789 | * |
| 790 | * Returns the number of removed STA entries. | 790 | * Returns the number of removed STA entries. |
| 791 | * | 791 | * |
| @@ -794,6 +794,13 @@ void sta_info_stop(struct ieee80211_local *local); · 2 unmodified lines | |||
| 794 | */ | 794 | */ |
| 795 | int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans); | 795 | int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans); |
| 796 | 796 | ||
| 797 | /** | ||
| 798 | * sta_info_flush - flush matching STA entries from the STA table | ||
| 799 | * | ||
| 800 | * Returns the number of removed STA entries. | ||
| 801 | * | ||
| 802 | * @sdata: sdata to remove all stations from | ||
| 803 | */ | ||
| 797 | static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata) | 804 | static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata) |
| 798 | { | 805 | { |
| 799 | return __sta_info_flush(sdata, false); | 806 | return __sta_info_flush(sdata, false); |
| @@ -1942,19 +1942,24 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, · 1941 unmodified lines | |||
| 1942 | 1942 | ||
| 1943 | /* device xmit handlers */ | 1943 | /* device xmit handlers */ |
| 1944 | 1944 | ||
| 1945 | enum ieee80211_encrypt { | ||
| 1946 | ENCRYPT_NO, | ||
| 1947 | ENCRYPT_MGMT, | ||
| 1948 | ENCRYPT_DATA, | ||
| 1949 | }; | ||
| 1950 | |||
| 1945 | static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, | 1951 | static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, |
| 1946 | struct sk_buff *skb, | 1952 | struct sk_buff *skb, |
| 1947 | int head_need, bool may_encrypt) | 1953 | int head_need, |
| 1954 | enum ieee80211_encrypt encrypt) | ||
| 1948 | { | 1955 | { |
| 1949 | struct ieee80211_local *local = sdata->local; | 1956 | struct ieee80211_local *local = sdata->local; |
| 1950 | struct ieee80211_hdr *hdr; | ||
| 1951 | bool enc_tailroom; | 1957 | bool enc_tailroom; |
| 1952 | int tail_need = 0; | 1958 | int tail_need = 0; |
| 1953 | 1959 | ||
| 1954 | hdr = (struct ieee80211_hdr *) skb->data; | 1960 | enc_tailroom = encrypt == ENCRYPT_MGMT || |
| 1955 | enc_tailroom = may_encrypt && | 1961 | (encrypt == ENCRYPT_DATA && |
| 1956 | (sdata->crypto_tx_tailroom_needed_cnt || | 1962 | sdata->crypto_tx_tailroom_needed_cnt); |
| 1957 | ieee80211_is_mgmt(hdr->frame_control)); | ||
| 1958 | 1963 | ||
| 1959 | if (enc_tailroom) { | 1964 | if (enc_tailroom) { |
| 1960 | tail_need = IEEE80211_ENCRYPT_TAILROOM; | 1965 | tail_need = IEEE80211_ENCRYPT_TAILROOM; |
| @@ -1985,23 +1990,29 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, · 24 unmodified lines | |||
| 1985 | { | 1990 | { |
| 1986 | struct ieee80211_local *local = sdata->local; | 1991 | struct ieee80211_local *local = sdata->local; |
| 1987 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1992 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 1988 | struct ieee80211_hdr *hdr; | 1993 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
| 1989 | int headroom; | 1994 | int headroom; |
| 1990 | bool may_encrypt; | 1995 | enum ieee80211_encrypt encrypt; |
| 1991 | 1996 | ||
| 1992 | may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT); | 1997 | if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT) |
| 1998 | encrypt = ENCRYPT_NO; | ||
| 1999 | else if (ieee80211_is_mgmt(hdr->frame_control)) | ||
| 2000 | encrypt = ENCRYPT_MGMT; | ||
| 2001 | else | ||
| 2002 | encrypt = ENCRYPT_DATA; | ||
| 1993 | 2003 | ||
| 1994 | headroom = local->tx_headroom; | 2004 | headroom = local->tx_headroom; |
| 1995 | if (may_encrypt) | 2005 | if (encrypt != ENCRYPT_NO) |
| 1996 | headroom += sdata->encrypt_headroom; | 2006 | headroom += sdata->encrypt_headroom; |
| 1997 | headroom -= skb_headroom(skb); | 2007 | headroom -= skb_headroom(skb); |
| 1998 | headroom = max_t(int, 0, headroom); | 2008 | headroom = max_t(int, 0, headroom); |
| 1999 | 2009 | ||
| 2000 | if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { | 2010 | if (ieee80211_skb_resize(sdata, skb, headroom, encrypt)) { |
| 2001 | ieee80211_free_txskb(&local->hw, skb); | 2011 | ieee80211_free_txskb(&local->hw, skb); |
| 2002 | return; | 2012 | return; |
| 2003 | } | 2013 | } |
| 2004 | 2014 | ||
| 2015 | /* reload after potential resize */ | ||
| 2005 | hdr = (struct ieee80211_hdr *) skb->data; | 2016 | hdr = (struct ieee80211_hdr *) skb->data; |
| 2006 | info->control.vif = &sdata->vif; | 2017 | info->control.vif = &sdata->vif; |
| 2007 | 2018 | ||
| @@ -2828,7 +2839,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, · 820 unmodified lines | |||
| 2828 | head_need += sdata->encrypt_headroom; | 2839 | head_need += sdata->encrypt_headroom; |
| 2829 | head_need += local->tx_headroom; | 2840 | head_need += local->tx_headroom; |
| 2830 | head_need = max_t(int, 0, head_need); | 2841 | head_need = max_t(int, 0, head_need); |
| 2831 | if (ieee80211_skb_resize(sdata, skb, head_need, true)) { | 2842 | if (ieee80211_skb_resize(sdata, skb, head_need, ENCRYPT_DATA)) { |
| 2832 | ieee80211_free_txskb(&local->hw, skb); | 2843 | ieee80211_free_txskb(&local->hw, skb); |
| 2833 | skb = NULL; | 2844 | skb = NULL; |
| 2834 | return ERR_PTR(-ENOMEM); | 2845 | return ERR_PTR(-ENOMEM); |
| @@ -3502,7 +3513,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 667 unmodified lines | |||
| 3502 | if (unlikely(ieee80211_skb_resize(sdata, skb, | 3513 | if (unlikely(ieee80211_skb_resize(sdata, skb, |
| 3503 | max_t(int, extra_head + hw_headroom - | 3514 | max_t(int, extra_head + hw_headroom - |
| 3504 | skb_headroom(skb), 0), | 3515 | skb_headroom(skb), 0), |
| 3505 | false))) { | 3516 | ENCRYPT_NO))) { |
| 3506 | kfree_skb(skb); | 3517 | kfree_skb(skb); |
| 3507 | return true; | 3518 | return true; |
| 3508 | } | 3519 | } |
| @@ -3619,13 +3630,14 @@ begin: · 110 unmodified lines | |||
| 3619 | tx.skb = skb; | 3630 | tx.skb = skb; |
| 3620 | tx.sdata = vif_to_sdata(info->control.vif); | 3631 | tx.sdata = vif_to_sdata(info->control.vif); |
| 3621 | 3632 | ||
| 3622 | if (txq->sta && !(info->flags & IEEE80211_TX_CTL_INJECTED)) { | 3633 | if (txq->sta) { |
| 3623 | tx.sta = container_of(txq->sta, struct sta_info, sta); | 3634 | tx.sta = container_of(txq->sta, struct sta_info, sta); |
| 3624 | /* | 3635 | /* |
| 3625 | * Drop unicast frames to unauthorised stations unless they are | 3636 | * Drop unicast frames to unauthorised stations unless they are |
| 3626 | * EAPOL frames from the local station. | 3637 | * injected frames or EAPOL frames from the local station. |
| 3627 | */ | 3638 | */ |
| 3628 | if (unlikely(ieee80211_is_data(hdr->frame_control) && | 3639 | if (unlikely(!(info->flags & IEEE80211_TX_CTL_INJECTED) && |
| 3640 | ieee80211_is_data(hdr->frame_control) && | ||
| 3629 | !ieee80211_vif_is_mesh(&tx.sdata->vif) && | 3641 | !ieee80211_vif_is_mesh(&tx.sdata->vif) && |
| 3630 | tx.sdata->vif.type != NL80211_IFTYPE_OCB && | 3642 | tx.sdata->vif.type != NL80211_IFTYPE_OCB && |
| 3631 | !is_multicast_ether_addr(hdr->addr1) && | 3643 | !is_multicast_ether_addr(hdr->addr1) && |
| @@ -291,7 +291,7 @@ struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, · 290 unmodified lines | |||
| 291 | { | 291 | { |
| 292 | struct mptcp_sock *ret = NULL; | 292 | struct mptcp_sock *ret = NULL; |
| 293 | struct hlist_nulls_node *pos; | 293 | struct hlist_nulls_node *pos; |
| 294 | int slot, num; | 294 | int slot, num = 0; |
| 295 | 295 | ||
| 296 | for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { | 296 | for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { |
| 297 | struct token_bucket *bucket = &token_hash[slot]; | 297 | struct token_bucket *bucket = &token_hash[slot]; |
| @@ -637,13 +637,14 @@ ip_set_match_extensions(struct ip_set *set, const struct ip_set_ext *ext, · 636 unmodified lines | |||
| 637 | if (SET_WITH_COUNTER(set)) { | 637 | if (SET_WITH_COUNTER(set)) { |
| 638 | struct ip_set_counter *counter = ext_counter(data, set); | 638 | struct ip_set_counter *counter = ext_counter(data, set); |
| 639 | 639 | ||
| 640 | ip_set_update_counter(counter, ext, flags); | ||
| 641 | |||
| 640 | if (flags & IPSET_FLAG_MATCH_COUNTERS && | 642 | if (flags & IPSET_FLAG_MATCH_COUNTERS && |
| 641 | !(ip_set_match_counter(ip_set_get_packets(counter), | 643 | !(ip_set_match_counter(ip_set_get_packets(counter), |
| 642 | mext->packets, mext->packets_op) && | 644 | mext->packets, mext->packets_op) && |
| 643 | ip_set_match_counter(ip_set_get_bytes(counter), | 645 | ip_set_match_counter(ip_set_get_bytes(counter), |
| 644 | mext->bytes, mext->bytes_op))) | 646 | mext->bytes, mext->bytes_op))) |
| 645 | return false; | 647 | return false; |
| 646 | ip_set_update_counter(counter, ext, flags); | ||
| 647 | } | 648 | } |
| 648 | if (SET_WITH_SKBINFO(set)) | 649 | if (SET_WITH_SKBINFO(set)) |
| 649 | ip_set_get_skbinfo(ext_skbinfo(data, set), | 650 | ip_set_get_skbinfo(ext_skbinfo(data, set), |
| @@ -742,12 +742,12 @@ static int ip_vs_route_me_harder(struct netns_ipvs *ipvs, int af, · 741 unmodified lines | |||
| 742 | struct dst_entry *dst = skb_dst(skb); | 742 | struct dst_entry *dst = skb_dst(skb); |
| 743 | 743 | ||
| 744 | if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) && | 744 | if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) && |
| 745 | ip6_route_me_harder(ipvs->net, skb) != 0) | 745 | ip6_route_me_harder(ipvs->net, skb->sk, skb) != 0) |
| 746 | return 1; | 746 | return 1; |
| 747 | } else | 747 | } else |
| 748 | #endif | 748 | #endif |
| 749 | if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) && | 749 | if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) && |
| 750 | ip_route_me_harder(ipvs->net, skb, RTN_LOCAL) != 0) | 750 | ip_route_me_harder(ipvs->net, skb->sk, skb, RTN_LOCAL) != 0) |
| 751 | return 1; | 751 | return 1; |
| 752 | 752 | ||
| 753 | return 0; | 753 | return 0; |
| @@ -715,7 +715,7 @@ nf_nat_ipv4_local_fn(void *priv, struct sk_buff *skb, · 714 unmodified lines | |||
| 715 | 715 | ||
| 716 | if (ct->tuplehash[dir].tuple.dst.u3.ip != | 716 | if (ct->tuplehash[dir].tuple.dst.u3.ip != |
| 717 | ct->tuplehash[!dir].tuple.src.u3.ip) { | 717 | ct->tuplehash[!dir].tuple.src.u3.ip) { |
| 718 | err = ip_route_me_harder(state->net, skb, RTN_UNSPEC); | 718 | err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC); |
| 719 | if (err < 0) | 719 | if (err < 0) |
| 720 | ret = NF_DROP_ERR(err); | 720 | ret = NF_DROP_ERR(err); |
| 721 | } | 721 | } |
| @@ -953,7 +953,7 @@ nf_nat_ipv6_local_fn(void *priv, struct sk_buff *skb, · 231 unmodified lines | |||
| 953 | 953 | ||
| 954 | if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.dst.u3, | 954 | if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.dst.u3, |
| 955 | &ct->tuplehash[!dir].tuple.src.u3)) { | 955 | &ct->tuplehash[!dir].tuple.src.u3)) { |
| 956 | err = nf_ip6_route_me_harder(state->net, skb); | 956 | err = nf_ip6_route_me_harder(state->net, state->sk, skb); |
| 957 | if (err < 0) | 957 | if (err < 0) |
| 958 | ret = NF_DROP_ERR(err); | 958 | ret = NF_DROP_ERR(err); |
| 959 | } | 959 | } |
| @@ -446,7 +446,7 @@ synproxy_send_tcp(struct net *net, · 445 unmodified lines | |||
| 446 | 446 | ||
| 447 | skb_dst_set_noref(nskb, skb_dst(skb)); | 447 | skb_dst_set_noref(nskb, skb_dst(skb)); |
| 448 | nskb->protocol = htons(ETH_P_IP); | 448 | nskb->protocol = htons(ETH_P_IP); |
| 449 | if (ip_route_me_harder(net, nskb, RTN_UNSPEC)) | 449 | if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC)) |
| 450 | goto free_nskb; | 450 | goto free_nskb; |
| 451 | 451 | ||
| 452 | if (nfct) { | 452 | if (nfct) { |
| @@ -7137,7 +7137,7 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx, · 7136 unmodified lines | |||
| 7137 | GFP_KERNEL); | 7137 | GFP_KERNEL); |
| 7138 | kfree(buf); | 7138 | kfree(buf); |
| 7139 | 7139 | ||
| 7140 | if (ctx->report && | 7140 | if (!ctx->report && |
| 7141 | !nfnetlink_has_listeners(ctx->net, NFNLGRP_NFTABLES)) | 7141 | !nfnetlink_has_listeners(ctx->net, NFNLGRP_NFTABLES)) |
| 7142 | return; | 7142 | return; |
| 7143 | 7143 | ||
| @@ -7259,7 +7259,7 @@ static void nf_tables_gen_notify(struct net *net, struct sk_buff *skb, · 115 unmodified lines | |||
| 7259 | audit_log_nfcfg("?:0;?:0", 0, net->nft.base_seq, | 7259 | audit_log_nfcfg("?:0;?:0", 0, net->nft.base_seq, |
| 7260 | AUDIT_NFT_OP_GEN_REGISTER, GFP_KERNEL); | 7260 | AUDIT_NFT_OP_GEN_REGISTER, GFP_KERNEL); |
| 7261 | 7261 | ||
| 7262 | if (nlmsg_report(nlh) && | 7262 | if (!nlmsg_report(nlh) && |
| 7263 | !nfnetlink_has_listeners(net, NFNLGRP_NFTABLES)) | 7263 | !nfnetlink_has_listeners(net, NFNLGRP_NFTABLES)) |
| 7264 | return; | 7264 | return; |
| 7265 | 7265 | ||
| @@ -8053,12 +8053,16 @@ static void nf_tables_abort_release(struct nft_trans *trans) · 787 unmodified lines | |||
| 8053 | kfree(trans); | 8053 | kfree(trans); |
| 8054 | } | 8054 | } |
| 8055 | 8055 | ||
| 8056 | static int __nf_tables_abort(struct net *net, bool autoload) | 8056 | static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action) |
| 8057 | { | 8057 | { |
| 8058 | struct nft_trans *trans, *next; | 8058 | struct nft_trans *trans, *next; |
| 8059 | struct nft_trans_elem *te; | 8059 | struct nft_trans_elem *te; |
| 8060 | struct nft_hook *hook; | 8060 | struct nft_hook *hook; |
| 8061 | 8061 | ||
| 8062 | if (action == NFNL_ABORT_VALIDATE && | ||
| 8063 | nf_tables_validate(net) < 0) | ||
| 8064 | return -EAGAIN; | ||
| 8065 | |||
| 8062 | list_for_each_entry_safe_reverse(trans, next, &net->nft.commit_list, | 8066 | list_for_each_entry_safe_reverse(trans, next, &net->nft.commit_list, |
| 8063 | list) { | 8067 | list) { |
| 8064 | switch (trans->msg_type) { | 8068 | switch (trans->msg_type) { |
| @@ -8190,7 +8194,7 @@ static int __nf_tables_abort(struct net *net, bool autoload) · 125 unmodified lines | |||
| 8190 | nf_tables_abort_release(trans); | 8194 | nf_tables_abort_release(trans); |
| 8191 | } | 8195 | } |
| 8192 | 8196 | ||
| 8193 | if (autoload) | 8197 | if (action == NFNL_ABORT_AUTOLOAD) |
| 8194 | nf_tables_module_autoload(net); | 8198 | nf_tables_module_autoload(net); |
| 8195 | else | 8199 | else |
| 8196 | nf_tables_module_autoload_cleanup(net); | 8200 | nf_tables_module_autoload_cleanup(net); |
| @@ -8203,9 +8207,10 @@ static void nf_tables_cleanup(struct net *net) · 6 unmodified lines | |||
| 8203 | nft_validate_state_update(net, NFT_VALIDATE_SKIP); | 8207 | nft_validate_state_update(net, NFT_VALIDATE_SKIP); |
| 8204 | } | 8208 | } |
| 8205 | 8209 | ||
| 8206 | static int nf_tables_abort(struct net *net, struct sk_buff *skb, bool autoload) | 8210 | static int nf_tables_abort(struct net *net, struct sk_buff *skb, |
| 8211 | enum nfnl_abort_action action) | ||
| 8207 | { | 8212 | { |
| 8208 | int ret = __nf_tables_abort(net, autoload); | 8213 | int ret = __nf_tables_abort(net, action); |
| 8209 | 8214 | ||
| 8210 | mutex_unlock(&net->nft.commit_mutex); | 8215 | mutex_unlock(&net->nft.commit_mutex); |
| 8211 | 8216 | ||
| @@ -8836,7 +8841,7 @@ static void __net_exit nf_tables_exit_net(struct net *net) · 624 unmodified lines | |||
| 8836 | { | 8841 | { |
| 8837 | mutex_lock(&net->nft.commit_mutex); | 8842 | mutex_lock(&net->nft.commit_mutex); |
| 8838 | if (!list_empty(&net->nft.commit_list)) | 8843 | if (!list_empty(&net->nft.commit_list)) |
| 8839 | __nf_tables_abort(net, false); | 8844 | __nf_tables_abort(net, NFNL_ABORT_NONE); |
| 8840 | __nft_release_tables(net); | 8845 | __nft_release_tables(net); |
| 8841 | mutex_unlock(&net->nft.commit_mutex); | 8846 | mutex_unlock(&net->nft.commit_mutex); |
| 8842 | WARN_ON_ONCE(!list_empty(&net->nft.tables)); | 8847 | WARN_ON_ONCE(!list_empty(&net->nft.tables)); |
| @@ -333,7 +333,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, · 332 unmodified lines | |||
| 333 | return netlink_ack(skb, nlh, -EINVAL, NULL); | 333 | return netlink_ack(skb, nlh, -EINVAL, NULL); |
| 334 | replay: | 334 | replay: |
| 335 | status = 0; | 335 | status = 0; |
| 336 | 336 | replay_abort: | |
| 337 | skb = netlink_skb_clone(oskb, GFP_KERNEL); | 337 | skb = netlink_skb_clone(oskb, GFP_KERNEL); |
| 338 | if (!skb) | 338 | if (!skb) |
| 339 | return netlink_ack(oskb, nlh, -ENOMEM, NULL); | 339 | return netlink_ack(oskb, nlh, -ENOMEM, NULL); |
| @@ -499,7 +499,7 @@ ack: · 159 unmodified lines | |||
| 499 | } | 499 | } |
| 500 | done: | 500 | done: |
| 501 | if (status & NFNL_BATCH_REPLAY) { | 501 | if (status & NFNL_BATCH_REPLAY) { |
| 502 | ss->abort(net, oskb, true); | 502 | ss->abort(net, oskb, NFNL_ABORT_AUTOLOAD); |
| 503 | nfnl_err_reset(&err_list); | 503 | nfnl_err_reset(&err_list); |
| 504 | kfree_skb(skb); | 504 | kfree_skb(skb); |
| 505 | module_put(ss->owner); | 505 | module_put(ss->owner); |
| @@ -510,11 +510,25 @@ done: · 4 unmodified lines | |||
| 510 | status |= NFNL_BATCH_REPLAY; | 510 | status |= NFNL_BATCH_REPLAY; |
| 511 | goto done; | 511 | goto done; |
| 512 | } else if (err) { | 512 | } else if (err) { |
| 513 | ss->abort(net, oskb, false); | 513 | ss->abort(net, oskb, NFNL_ABORT_NONE); |
| 514 | netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL); | 514 | netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL); |
| 515 | } | 515 | } |
| 516 | } else { | 516 | } else { |
| 517 | ss->abort(net, oskb, false); | 517 | enum nfnl_abort_action abort_action; |
| 518 | |||
| 519 | if (status & NFNL_BATCH_FAILURE) | ||
| 520 | abort_action = NFNL_ABORT_NONE; | ||
| 521 | else | ||
| 522 | abort_action = NFNL_ABORT_VALIDATE; | ||
| 523 | |||
| 524 | err = ss->abort(net, oskb, abort_action); | ||
| 525 | if (err == -EAGAIN) { | ||
| 526 | nfnl_err_reset(&err_list); | ||
| 527 | kfree_skb(skb); | ||
| 528 | module_put(ss->owner); | ||
| 529 | status |= NFNL_BATCH_FAILURE; | ||
| 530 | goto replay_abort; | ||
| 531 | } | ||
| 518 | } | 532 | } |
| 519 | if (ss->cleanup) | 533 | if (ss->cleanup) |
| 520 | ss->cleanup(net); | 534 | ss->cleanup(net); |
| @@ -42,7 +42,7 @@ static unsigned int nf_route_table_hook4(void *priv, · 41 unmodified lines | |||
| 42 | iph->daddr != daddr || | 42 | iph->daddr != daddr || |
| 43 | skb->mark != mark || | 43 | skb->mark != mark || |
| 44 | iph->tos != tos) { | 44 | iph->tos != tos) { |
| 45 | err = ip_route_me_harder(state->net, skb, RTN_UNSPEC); | 45 | err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC); |
| 46 | if (err < 0) | 46 | if (err < 0) |
| 47 | ret = NF_DROP_ERR(err); | 47 | ret = NF_DROP_ERR(err); |
| 48 | } | 48 | } |
| @@ -92,7 +92,7 @@ static unsigned int nf_route_table_hook6(void *priv, · 43 unmodified lines | |||
| 92 | skb->mark != mark || | 92 | skb->mark != mark || |
| 93 | ipv6_hdr(skb)->hop_limit != hop_limit || | 93 | ipv6_hdr(skb)->hop_limit != hop_limit || |
| 94 | flowlabel != *((u32 *)ipv6_hdr(skb)))) { | 94 | flowlabel != *((u32 *)ipv6_hdr(skb)))) { |
| 95 | err = nf_ip6_route_me_harder(state->net, skb); | 95 | err = nf_ip6_route_me_harder(state->net, state->sk, skb); |
| 96 | if (err < 0) | 96 | if (err < 0) |
| 97 | ret = NF_DROP_ERR(err); | 97 | ret = NF_DROP_ERR(err); |
| 98 | } | 98 | } |
| @@ -191,8 +191,8 @@ static int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry · 190 unmodified lines | |||
| 191 | skb->mark == rt_info->mark && | 191 | skb->mark == rt_info->mark && |
| 192 | iph->daddr == rt_info->daddr && | 192 | iph->daddr == rt_info->daddr && |
| 193 | iph->saddr == rt_info->saddr)) | 193 | iph->saddr == rt_info->saddr)) |
| 194 | return ip_route_me_harder(entry->state.net, skb, | 194 | return ip_route_me_harder(entry->state.net, entry->state.sk, |
| 195 | RTN_UNSPEC); | 195 | skb, RTN_UNSPEC); |
| 196 | } | 196 | } |
| 197 | #endif | 197 | #endif |
| 198 | return 0; | 198 | return 0; |
| @@ -1703,13 +1703,13 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) · 1702 unmodified lines | |||
| 1703 | parms.port_no = OVSP_LOCAL; | 1703 | parms.port_no = OVSP_LOCAL; |
| 1704 | parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID]; | 1704 | parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID]; |
| 1705 | 1705 | ||
| 1706 | err = ovs_dp_change(dp, a); | ||
| 1707 | if (err) | ||
| 1708 | goto err_destroy_meters; | ||
| 1709 | |||
| 1710 | /* So far only local changes have been made, now need the lock. */ | 1706 | /* So far only local changes have been made, now need the lock. */ |
| 1711 | ovs_lock(); | 1707 | ovs_lock(); |
| 1712 | 1708 | ||
| 1709 | err = ovs_dp_change(dp, a); | ||
| 1710 | if (err) | ||
| 1711 | goto err_unlock_and_destroy_meters; | ||
| 1712 | |||
| 1713 | vport = new_vport(&parms); | 1713 | vport = new_vport(&parms); |
| 1714 | if (IS_ERR(vport)) { | 1714 | if (IS_ERR(vport)) { |
| 1715 | err = PTR_ERR(vport); | 1715 | err = PTR_ERR(vport); |
| @@ -1725,8 +1725,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) · 9 unmodified lines | |||
| 1725 | ovs_dp_reset_user_features(skb, info); | 1725 | ovs_dp_reset_user_features(skb, info); |
| 1726 | } | 1726 | } |
| 1727 | 1727 | ||
| 1728 | ovs_unlock(); | 1728 | goto err_unlock_and_destroy_meters; |
| 1729 | goto err_destroy_meters; | ||
| 1730 | } | 1729 | } |
| 1731 | 1730 | ||
| 1732 | err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, | 1731 | err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, |
| @@ -1741,7 +1740,8 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) · 8 unmodified lines | |||
| 1741 | ovs_notify(&dp_datapath_genl_family, reply, info); | 1740 | ovs_notify(&dp_datapath_genl_family, reply, info); |
| 1742 | return 0; | 1741 | return 0; |
| 1743 | 1742 | ||
| 1744 | err_destroy_meters: | 1743 | err_unlock_and_destroy_meters: |
| 1744 | ovs_unlock(); | ||
| 1745 | ovs_meters_exit(dp); | 1745 | ovs_meters_exit(dp); |
| 1746 | err_destroy_ports: | 1746 | err_destroy_ports: |
| 1747 | kfree(dp->ports); | 1747 | kfree(dp->ports); |
| @@ -390,7 +390,7 @@ static struct mask_cache *tbl_mask_cache_alloc(u32 size) · 389 unmodified lines | |||
| 390 | } | 390 | } |
| 391 | int ovs_flow_tbl_masks_cache_resize(struct flow_table *table, u32 size) | 391 | int ovs_flow_tbl_masks_cache_resize(struct flow_table *table, u32 size) |
| 392 | { | 392 | { |
| 393 | struct mask_cache *mc = rcu_dereference(table->mask_cache); | 393 | struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache); |
| 394 | struct mask_cache *new; | 394 | struct mask_cache *new; |
| 395 | 395 | ||
| 396 | if (size == mc->cache_size) | 396 | if (size == mc->cache_size) |
| @@ -1601,12 +1601,12 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, · 1600 unmodified lines | |||
| 1601 | break; | 1601 | break; |
| 1602 | 1602 | ||
| 1603 | case SCTP_CMD_INIT_FAILED: | 1603 | case SCTP_CMD_INIT_FAILED: |
| 1604 | sctp_cmd_init_failed(commands, asoc, cmd->obj.u32); | 1604 | sctp_cmd_init_failed(commands, asoc, cmd->obj.u16); |
| 1605 | break; | 1605 | break; |
| 1606 | 1606 | ||
| 1607 | case SCTP_CMD_ASSOC_FAILED: | 1607 | case SCTP_CMD_ASSOC_FAILED: |
| 1608 | sctp_cmd_assoc_failed(commands, asoc, event_type, | 1608 | sctp_cmd_assoc_failed(commands, asoc, event_type, |
| 1609 | subtype, chunk, cmd->obj.u32); | 1609 | subtype, chunk, cmd->obj.u16); |
| 1610 | break; | 1610 | break; |
| 1611 | 1611 | ||
| 1612 | case SCTP_CMD_INIT_COUNTER_INC: | 1612 | case SCTP_CMD_INIT_COUNTER_INC: |
| @@ -1250,8 +1250,7 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, · 1249 unmodified lines | |||
| 1250 | } | 1250 | } |
| 1251 | EXPORT_SYMBOL(cfg80211_stop_iface); | 1251 | EXPORT_SYMBOL(cfg80211_stop_iface); |
| 1252 | 1252 | ||
| 1253 | void cfg80211_init_wdev(struct cfg80211_registered_device *rdev, | 1253 | void cfg80211_init_wdev(struct wireless_dev *wdev) |
| 1254 | struct wireless_dev *wdev) | ||
| 1255 | { | 1254 | { |
| 1256 | mutex_init(&wdev->mtx); | 1255 | mutex_init(&wdev->mtx); |
| 1257 | INIT_LIST_HEAD(&wdev->event_list); | 1256 | INIT_LIST_HEAD(&wdev->event_list); |
| @@ -1262,6 +1261,30 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev, · 4 unmodified lines | |||
| 1262 | spin_lock_init(&wdev->pmsr_lock); | 1261 | spin_lock_init(&wdev->pmsr_lock); |
| 1263 | INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk); | 1262 | INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk); |
| 1264 | 1263 | ||
| 1264 | #ifdef CONFIG_CFG80211_WEXT | ||
| 1265 | wdev->wext.default_key = -1; | ||
| 1266 | wdev->wext.default_mgmt_key = -1; | ||
| 1267 | wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; | ||
| 1268 | #endif | ||
| 1269 | |||
| 1270 | if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT) | ||
| 1271 | wdev->ps = true; | ||
| 1272 | else | ||
| 1273 | wdev->ps = false; | ||
| 1274 | /* allow mac80211 to determine the timeout */ | ||
| 1275 | wdev->ps_timeout = -1; | ||
| 1276 | |||
| 1277 | if ((wdev->iftype == NL80211_IFTYPE_STATION || | ||
| 1278 | wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || | ||
| 1279 | wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) | ||
| 1280 | wdev->netdev->priv_flags |= IFF_DONT_BRIDGE; | ||
| 1281 | |||
| 1282 | INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk); | ||
| 1283 | } | ||
| 1284 | |||
| 1285 | void cfg80211_register_wdev(struct cfg80211_registered_device *rdev, | ||
| 1286 | struct wireless_dev *wdev) | ||
| 1287 | { | ||
| 1265 | /* | 1288 | /* |
| 1266 | * We get here also when the interface changes network namespaces, | 1289 | * We get here also when the interface changes network namespaces, |
| 1267 | * as it's registered into the new one, but we don't want it to | 1290 | * as it's registered into the new one, but we don't want it to |
| @@ -1295,6 +1318,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, · 27 unmodified lines | |||
| 1295 | switch (state) { | 1318 | switch (state) { |
| 1296 | case NETDEV_POST_INIT: | 1319 | case NETDEV_POST_INIT: |
| 1297 | SET_NETDEV_DEVTYPE(dev, &wiphy_type); | 1320 | SET_NETDEV_DEVTYPE(dev, &wiphy_type); |
| 1321 | wdev->netdev = dev; | ||
| 1322 | /* can only change netns with wiphy */ | ||
| 1323 | dev->features |= NETIF_F_NETNS_LOCAL; | ||
| 1324 | |||
| 1325 | cfg80211_init_wdev(wdev); | ||
| 1298 | break; | 1326 | break; |
| 1299 | case NETDEV_REGISTER: | 1327 | case NETDEV_REGISTER: |
| 1300 | /* | 1328 | /* |
| @@ -1302,35 +1330,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, · 1 unmodified line | |||
| 1302 | * called within code protected by it when interfaces | 1330 | * called within code protected by it when interfaces |
| 1303 | * are added with nl80211. | 1331 | * are added with nl80211. |
| 1304 | */ | 1332 | */ |
| 1305 | /* can only change netns with wiphy */ | ||
| 1306 | dev->features |= NETIF_F_NETNS_LOCAL; | ||
| 1307 | |||
| 1308 | if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj, | 1333 | if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj, |
| 1309 | "phy80211")) { | 1334 | "phy80211")) { |
| 1310 | pr_err("failed to add phy80211 symlink to netdev!\n"); | 1335 | pr_err("failed to add phy80211 symlink to netdev!\n"); |
| 1311 | } | 1336 | } |
| 1312 | wdev->netdev = dev; | ||
| 1313 | #ifdef CONFIG_CFG80211_WEXT | ||
| 1314 | wdev->wext.default_key = -1; | ||
| 1315 | wdev->wext.default_mgmt_key = -1; | ||
| 1316 | wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; | ||
| 1317 | #endif | ||
| 1318 | |||
| 1319 | if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT) | ||
| 1320 | wdev->ps = true; | ||
| 1321 | else | ||
| 1322 | wdev->ps = false; | ||
| 1323 | /* allow mac80211 to determine the timeout */ | ||
| 1324 | wdev->ps_timeout = -1; | ||
| 1325 | |||
| 1326 | if ((wdev->iftype == NL80211_IFTYPE_STATION || | ||
| 1327 | wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || | ||
| 1328 | wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) | ||
| 1329 | dev->priv_flags |= IFF_DONT_BRIDGE; | ||
| 1330 | |||
| 1331 | INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk); | ||
| 1332 | 1337 | ||
| 1333 | cfg80211_init_wdev(rdev, wdev); | 1338 | cfg80211_register_wdev(rdev, wdev); |
| 1334 | break; | 1339 | break; |
| 1335 | case NETDEV_GOING_DOWN: | 1340 | case NETDEV_GOING_DOWN: |
| 1336 | cfg80211_leave(rdev, wdev); | 1341 | cfg80211_leave(rdev, wdev); |
| @@ -209,8 +209,9 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); · 208 unmodified lines | |||
| 209 | int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, | 209 | int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, |
| 210 | struct net *net); | 210 | struct net *net); |
| 211 | 211 | ||
| 212 | void cfg80211_init_wdev(struct cfg80211_registered_device *rdev, | 212 | void cfg80211_init_wdev(struct wireless_dev *wdev); |
| 213 | struct wireless_dev *wdev); | 213 | void cfg80211_register_wdev(struct cfg80211_registered_device *rdev, |
| 214 | struct wireless_dev *wdev); | ||
| 214 | 215 | ||
| 215 | static inline void wdev_lock(struct wireless_dev *wdev) | 216 | static inline void wdev_lock(struct wireless_dev *wdev) |
| 216 | __acquires(wdev) | 217 | __acquires(wdev) |
| @@ -3885,7 +3885,8 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) · 3884 unmodified lines | |||
| 3885 | * P2P Device and NAN do not have a netdev, so don't go | 3885 | * P2P Device and NAN do not have a netdev, so don't go |
| 3886 | * through the netdev notifier and must be added here | 3886 | * through the netdev notifier and must be added here |
| 3887 | */ | 3887 | */ |
| 3888 | cfg80211_init_wdev(rdev, wdev); | 3888 | cfg80211_init_wdev(wdev); |
| 3889 | cfg80211_register_wdev(rdev, wdev); | ||
| 3889 | break; | 3890 | break; |
| 3890 | default: | 3891 | default: |
| 3891 | break; | 3892 | break; |
| @@ -3616,7 +3616,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd) · 3615 unmodified lines | |||
| 3616 | power_rule = ®_rule->power_rule; | 3616 | power_rule = ®_rule->power_rule; |
| 3617 | 3617 | ||
| 3618 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) | 3618 | if (reg_rule->flags & NL80211_RRF_AUTO_BW) |
| 3619 | snprintf(bw, sizeof(bw), "%d KHz, %d KHz AUTO", | 3619 | snprintf(bw, sizeof(bw), "%d KHz, %u KHz AUTO", |
| 3620 | freq_range->max_bandwidth_khz, | 3620 | freq_range->max_bandwidth_khz, |
| 3621 | reg_get_max_bandwidth(rd, reg_rule)); | 3621 | reg_get_max_bandwidth(rd, reg_rule)); |
| 3622 | else | 3622 | else |
| @@ -803,14 +803,14 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = { · 802 unmodified lines | |||
| 803 | .handler = xfrmi6_rcv_tunnel, | 803 | .handler = xfrmi6_rcv_tunnel, |
| 804 | .cb_handler = xfrmi_rcv_cb, | 804 | .cb_handler = xfrmi_rcv_cb, |
| 805 | .err_handler = xfrmi6_err, | 805 | .err_handler = xfrmi6_err, |
| 806 | .priority = -1, | 806 | .priority = 2, |
| 807 | }; | 807 | }; |
| 808 | 808 | ||
| 809 | static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = { | 809 | static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = { |
| 810 | .handler = xfrmi6_rcv_tunnel, | 810 | .handler = xfrmi6_rcv_tunnel, |
| 811 | .cb_handler = xfrmi_rcv_cb, | 811 | .cb_handler = xfrmi_rcv_cb, |
| 812 | .err_handler = xfrmi6_err, | 812 | .err_handler = xfrmi6_err, |
| 813 | .priority = -1, | 813 | .priority = 2, |
| 814 | }; | 814 | }; |
| 815 | #endif | 815 | #endif |
| 816 | 816 | ||
| @@ -848,14 +848,14 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = { · 31 unmodified lines | |||
| 848 | .handler = xfrmi4_rcv_tunnel, | 848 | .handler = xfrmi4_rcv_tunnel, |
| 849 | .cb_handler = xfrmi_rcv_cb, | 849 | .cb_handler = xfrmi_rcv_cb, |
| 850 | .err_handler = xfrmi4_err, | 850 | .err_handler = xfrmi4_err, |
| 851 | .priority = -1, | 851 | .priority = 3, |
| 852 | }; | 852 | }; |
| 853 | 853 | ||
| 854 | static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = { | 854 | static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = { |
| 855 | .handler = xfrmi4_rcv_tunnel, | 855 | .handler = xfrmi4_rcv_tunnel, |
| 856 | .cb_handler = xfrmi_rcv_cb, | 856 | .cb_handler = xfrmi_rcv_cb, |
| 857 | .err_handler = xfrmi4_err, | 857 | .err_handler = xfrmi4_err, |
| 858 | .priority = -1, | 858 | .priority = 2, |
| 859 | }; | 859 | }; |
| 860 | #endif | 860 | #endif |
| 861 | 861 | ||
| @@ -2004,6 +2004,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high) · 2003 unmodified lines | |||
| 2004 | int err = -ENOENT; | 2004 | int err = -ENOENT; |
| 2005 | __be32 minspi = htonl(low); | 2005 | __be32 minspi = htonl(low); |
| 2006 | __be32 maxspi = htonl(high); | 2006 | __be32 maxspi = htonl(high); |
| 2007 | __be32 newspi = 0; | ||
| 2007 | u32 mark = x->mark.v & x->mark.m; | 2008 | u32 mark = x->mark.v & x->mark.m; |
| 2008 | 2009 | ||
| 2009 | spin_lock_bh(&x->lock); | 2010 | spin_lock_bh(&x->lock); |
| @@ -2022,21 +2023,22 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high) · 12 unmodified lines | |||
| 2022 | xfrm_state_put(x0); | 2023 | xfrm_state_put(x0); |
| 2023 | goto unlock; | 2024 | goto unlock; |
| 2024 | } | 2025 | } |
| 2025 | x->id.spi = minspi; | 2026 | newspi = minspi; |
| 2026 | } else { | 2027 | } else { |
| 2027 | u32 spi = 0; | 2028 | u32 spi = 0; |
| 2028 | for (h = 0; h < high-low+1; h++) { | 2029 | for (h = 0; h < high-low+1; h++) { |
| 2029 | spi = low + prandom_u32()%(high-low+1); | 2030 | spi = low + prandom_u32()%(high-low+1); |
| 2030 | x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family); | 2031 | x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family); |
| 2031 | if (x0 == NULL) { | 2032 | if (x0 == NULL) { |
| 2032 | x->id.spi = htonl(spi); | 2033 | newspi = htonl(spi); |
| 2033 | break; | 2034 | break; |
| 2034 | } | 2035 | } |
| 2035 | xfrm_state_put(x0); | 2036 | xfrm_state_put(x0); |
| 2036 | } | 2037 | } |
| 2037 | } | 2038 | } |
| 2038 | if (x->id.spi) { | 2039 | if (newspi) { |
| 2039 | spin_lock_bh(&net->xfrm.xfrm_state_lock); | 2040 | spin_lock_bh(&net->xfrm.xfrm_state_lock); |
| 2041 | x->id.spi = newspi; | ||
| 2040 | h = xfrm_spi_hash(net, &x->id.daddr, x->id.spi, x->id.proto, x->props.family); | 2042 | h = xfrm_spi_hash(net, &x->id.daddr, x->id.spi, x->id.proto, x->props.family); |
| 2041 | hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h); | 2043 | hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h); |
| 2042 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); | 2044 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); |
| @@ -287,6 +287,8 @@ my $bondary = qr { (?<![\w\/\`\{])(?=[\w\/\`\{])|(?<=[\w\/\`\{])(?![\w\/\`\{]) } · 286 unmodified lines | |||
| 287 | sub output_rest { | 287 | sub output_rest { |
| 288 | create_labels(); | 288 | create_labels(); |
| 289 | 289 | ||
| 290 | my $part = ""; | ||
| 291 | |||
| 290 | foreach my $what (sort { | 292 | foreach my $what (sort { |
| 291 | ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") || | 293 | ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") || |
| 292 | $a cmp $b | 294 | $a cmp $b |
| @@ -306,6 +308,21 @@ sub output_rest { · 13 unmodified lines | |||
| 306 | $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; | 308 | $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; |
| 307 | 309 | ||
| 308 | if ($type ne "File") { | 310 | if ($type ne "File") { |
| 311 | my $cur_part = $what; | ||
| 312 | if ($what =~ '/') { | ||
| 313 | if ($what =~ m#^(\/?(?:[\w\-]+\/?){1,2})#) { | ||
| 314 | $cur_part = "Symbols under $1"; | ||
| 315 | $cur_part =~ s,/$,,; | ||
| 316 | } | ||
| 317 | } | ||
| 318 | |||
| 319 | if ($cur_part ne "" && $part ne $cur_part) { | ||
| 320 | $part = $cur_part; | ||
| 321 | my $bar = $part; | ||
| 322 | $bar =~ s/./-/g; | ||
| 323 | print "$part\n$bar\n\n"; | ||
| 324 | } | ||
| 325 | |||
| 309 | printf ".. _%s:\n\n", $data{$what}->{label}; | 326 | printf ".. _%s:\n\n", $data{$what}->{label}; |
| 310 | 327 | ||
| 311 | my @names = split /, /,$w; | 328 | my @names = split /, /,$w; |
| @@ -352,6 +369,12 @@ sub output_rest { · 40 unmodified lines | |||
| 352 | 369 | ||
| 353 | if (!($desc =~ /^\s*$/)) { | 370 | if (!($desc =~ /^\s*$/)) { |
| 354 | if ($description_is_rst) { | 371 | if ($description_is_rst) { |
| 372 | # Remove title markups from the description | ||
| 373 | # Having titles inside ABI files will only work if extra | ||
| 374 | # care would be taken in order to strictly follow the same | ||
| 375 | # level order for each markup. | ||
| 376 | $desc =~ s/\n[\-\*\=\^\~]+\n/\n\n/g; | ||
| 377 | |||
| 355 | # Enrich text by creating cross-references | 378 | # Enrich text by creating cross-references |
| 356 | 379 | ||
| 357 | $desc =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g; | 380 | $desc =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g; |
| @@ -1092,7 +1092,11 @@ sub output_struct_rst(%) { · 1091 unmodified lines | |||
| 1092 | print "\n\n.. c:type:: " . $name . "\n\n"; | 1092 | print "\n\n.. c:type:: " . $name . "\n\n"; |
| 1093 | } else { | 1093 | } else { |
| 1094 | my $name = $args{'struct'}; | 1094 | my $name = $args{'struct'}; |
| 1095 | print "\n\n.. c:struct:: " . $name . "\n\n"; | 1095 | if ($args{'type'} eq 'union') { |
| 1096 | print "\n\n.. c:union:: " . $name . "\n\n"; | ||
| 1097 | } else { | ||
| 1098 | print "\n\n.. c:struct:: " . $name . "\n\n"; | ||
| 1099 | } | ||
| 1096 | } | 1100 | } |
| 1097 | print_lineno($declaration_start_line); | 1101 | print_lineno($declaration_start_line); |
| 1098 | $lineprefix = " "; | 1102 | $lineprefix = " "; |
| @@ -1427,20 +1431,25 @@ sub dump_enum($$) { · 328 unmodified lines | |||
| 1427 | } | 1431 | } |
| 1428 | } | 1432 | } |
| 1429 | 1433 | ||
| 1434 | my $typedef_type = qr { ((?:\s+[\w\*]+){1,8})\s* }x; | ||
| 1435 | my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x; | ||
| 1436 | my $typedef_args = qr { \s*\((.*)\); }x; | ||
| 1437 | |||
| 1438 | my $typedef1 = qr { typedef$typedef_type\($typedef_ident\)$typedef_args }x; | ||
| 1439 | my $typedef2 = qr { typedef$typedef_type$typedef_ident$typedef_args }x; | ||
| 1440 | |||
| 1430 | sub dump_typedef($$) { | 1441 | sub dump_typedef($$) { |
| 1431 | my $x = shift; | 1442 | my $x = shift; |
| 1432 | my $file = shift; | 1443 | my $file = shift; |
| 1433 | 1444 | ||
| 1434 | $x =~ s@/\*.*?\*/@@gos; # strip comments. | 1445 | $x =~ s@/\*.*?\*/@@gos; # strip comments. |
| 1435 | 1446 | ||
| 1436 | # Parse function prototypes | 1447 | # Parse function typedef prototypes |
| 1437 | if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || | 1448 | if ($x =~ $typedef1 || $x =~ $typedef2) { |
| 1438 | $x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) { | ||
| 1439 | |||
| 1440 | # Function typedefs | ||
| 1441 | $return_type = $1; | 1449 | $return_type = $1; |
| 1442 | $declaration_name = $2; | 1450 | $declaration_name = $2; |
| 1443 | my $args = $3; | 1451 | my $args = $3; |
| 1452 | $return_type =~ s/^\s+//; | ||
| 1444 | 1453 | ||
| 1445 | create_parameterlist($args, ',', $file, $declaration_name); | 1454 | create_parameterlist($args, ',', $file, $declaration_name); |
| 1446 | 1455 | ||
| @@ -1925,8 +1925,8 @@ EXPORT_SYMBOL(snd_ctl_unregister_ioctl); · 1924 unmodified lines | |||
| 1925 | 1925 | ||
| 1926 | #ifdef CONFIG_COMPAT | 1926 | #ifdef CONFIG_COMPAT |
| 1927 | /** | 1927 | /** |
| 1928 | * snd_ctl_unregister_ioctl - de-register the device-specific compat 32bit | 1928 | * snd_ctl_unregister_ioctl_compat - de-register the device-specific compat |
| 1929 | * control-ioctls | 1929 | * 32bit control-ioctls |
| 1930 | * @fcn: ioctl callback function to unregister | 1930 | * @fcn: ioctl callback function to unregister |
| 1931 | */ | 1931 | */ |
| 1932 | int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn) | 1932 | int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn) |
| @@ -356,7 +356,8 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream) · 355 unmodified lines | |||
| 356 | EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close); | 356 | EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close); |
| 357 | 357 | ||
| 358 | /** | 358 | /** |
| 359 | * snd_dmaengine_pcm_release_chan_close - Close a dmaengine based PCM substream and release channel | 359 | * snd_dmaengine_pcm_close_release_chan - Close a dmaengine based PCM |
| 360 | * substream and release channel | ||
| 360 | * @substream: PCM substream | 361 | * @substream: PCM substream |
| 361 | * | 362 | * |
| 362 | * Releases the DMA channel associated with the PCM substream. | 363 | * Releases the DMA channel associated with the PCM substream. |
| @@ -490,7 +490,7 @@ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, · 489 unmodified lines | |||
| 490 | EXPORT_SYMBOL(snd_pcm_set_ops); | 490 | EXPORT_SYMBOL(snd_pcm_set_ops); |
| 491 | 491 | ||
| 492 | /** | 492 | /** |
| 493 | * snd_pcm_sync - set the PCM sync id | 493 | * snd_pcm_set_sync - set the PCM sync id |
| 494 | * @substream: the pcm substream | 494 | * @substream: the pcm substream |
| 495 | * | 495 | * |
| 496 | * Sets the PCM sync identifier for the card. | 496 | * Sets the PCM sync identifier for the card. |
| @@ -112,7 +112,7 @@ void snd_pcm_stream_lock(struct snd_pcm_substream *substream) · 111 unmodified lines | |||
| 112 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock); | 112 | EXPORT_SYMBOL_GPL(snd_pcm_stream_lock); |
| 113 | 113 | ||
| 114 | /** | 114 | /** |
| 115 | * snd_pcm_stream_lock - Unlock the PCM stream | 115 | * snd_pcm_stream_unlock - Unlock the PCM stream |
| 116 | * @substream: PCM substream | 116 | * @substream: PCM substream |
| 117 | * | 117 | * |
| 118 | * This unlocks the PCM stream that has been locked via snd_pcm_stream_lock(). | 118 | * This unlocks the PCM stream that has been locked via snd_pcm_stream_lock(). |
| @@ -595,7 +595,7 @@ static void snd_pcm_sync_stop(struct snd_pcm_substream *substream) · 476 unmodified lines | |||
| 595 | } | 595 | } |
| 596 | 596 | ||
| 597 | /** | 597 | /** |
| 598 | * snd_pcm_hw_param_choose - choose a configuration defined by @params | 598 | * snd_pcm_hw_params_choose - choose a configuration defined by @params |
| 599 | * @pcm: PCM instance | 599 | * @pcm: PCM instance |
| 600 | * @params: the hw_params instance | 600 | * @params: the hw_params instance |
| 601 | * | 601 | * |
| @@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, · 147 unmodified lines | |||
| 148 | return NULL; | 148 | return NULL; |
| 149 | if (bus->idx != bus_idx) | 149 | if (bus->idx != bus_idx) |
| 150 | return NULL; | 150 | return NULL; |
| 151 | if (addr < 0 || addr > 31) | ||
| 152 | return NULL; | ||
| 151 | 153 | ||
| 152 | list_for_each_entry(hlink, &bus->hlink_list, list) { | 154 | list_for_each_entry(hlink, &bus->hlink_list, list) { |
| 153 | for (i = 0; i < HDA_MAX_CODECS; i++) { | 155 | for (i = 0; i < HDA_MAX_CODECS; i++) { |
| @@ -2934,7 +2934,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) · 2933 unmodified lines | |||
| 2934 | snd_hdac_leave_pm(&codec->core); | 2934 | snd_hdac_leave_pm(&codec->core); |
| 2935 | } | 2935 | } |
| 2936 | 2936 | ||
| 2937 | static int hda_codec_runtime_suspend(struct device *dev) | 2937 | static int hda_codec_suspend(struct device *dev) |
| 2938 | { | 2938 | { |
| 2939 | struct hda_codec *codec = dev_to_hda_codec(dev); | 2939 | struct hda_codec *codec = dev_to_hda_codec(dev); |
| 2940 | unsigned int state; | 2940 | unsigned int state; |
| @@ -2953,7 +2953,7 @@ static int hda_codec_runtime_suspend(struct device *dev) · 12 unmodified lines | |||
| 2953 | return 0; | 2953 | return 0; |
| 2954 | } | 2954 | } |
| 2955 | 2955 | ||
| 2956 | static int hda_codec_runtime_resume(struct device *dev) | 2956 | static int hda_codec_resume(struct device *dev) |
| 2957 | { | 2957 | { |
| 2958 | struct hda_codec *codec = dev_to_hda_codec(dev); | 2958 | struct hda_codec *codec = dev_to_hda_codec(dev); |
| 2959 | 2959 | ||
| @@ -2967,57 +2967,70 @@ static int hda_codec_runtime_resume(struct device *dev) · 7 unmodified lines | |||
| 2967 | pm_runtime_mark_last_busy(dev); | 2967 | pm_runtime_mark_last_busy(dev); |
| 2968 | return 0; | 2968 | return 0; |
| 2969 | } | 2969 | } |
| 2970 | |||
| 2971 | static int hda_codec_runtime_suspend(struct device *dev) | ||
| 2972 | { | ||
| 2973 | return hda_codec_suspend(dev); | ||
| 2974 | } | ||
| 2975 | |||
| 2976 | static int hda_codec_runtime_resume(struct device *dev) | ||
| 2977 | { | ||
| 2978 | return hda_codec_resume(dev); | ||
| 2979 | } | ||
| 2980 | |||
| 2970 | #endif /* CONFIG_PM */ | 2981 | #endif /* CONFIG_PM */ |
| 2971 | 2982 | ||
| 2972 | #ifdef CONFIG_PM_SLEEP | 2983 | #ifdef CONFIG_PM_SLEEP |
| 2973 | static int hda_codec_force_resume(struct device *dev) | 2984 | static int hda_codec_pm_prepare(struct device *dev) |
| 2985 | { | ||
| 2986 | return pm_runtime_suspended(dev); | ||
| 2987 | } | ||
| 2988 | |||
| 2989 | static void hda_codec_pm_complete(struct device *dev) | ||
| 2974 | { | 2990 | { |
| 2975 | struct hda_codec *codec = dev_to_hda_codec(dev); | 2991 | struct hda_codec *codec = dev_to_hda_codec(dev); |
| 2976 | int ret; | ||
| 2977 | 2992 | ||
| 2978 | ret = pm_runtime_force_resume(dev); | 2993 | if (pm_runtime_suspended(dev) && (codec->jackpoll_interval || |
| 2979 | /* schedule jackpoll work for jack detection update */ | 2994 | hda_codec_need_resume(codec) || codec->forced_resume)) |
| 2980 | if (codec->jackpoll_interval || | 2995 | pm_request_resume(dev); |
| 2981 | (pm_runtime_suspended(dev) && hda_codec_need_resume(codec))) | ||
| 2982 | schedule_delayed_work(&codec->jackpoll_work, | ||
| 2983 | codec->jackpoll_interval); | ||
| 2984 | return ret; | ||
| 2985 | } | 2996 | } |
| 2986 | 2997 | ||
| 2987 | static int hda_codec_pm_suspend(struct device *dev) | 2998 | static int hda_codec_pm_suspend(struct device *dev) |
| 2988 | { | 2999 | { |
| 2989 | dev->power.power_state = PMSG_SUSPEND; | 3000 | dev->power.power_state = PMSG_SUSPEND; |
| 2990 | return pm_runtime_force_suspend(dev); | 3001 | return hda_codec_suspend(dev); |
| 2991 | } | 3002 | } |
| 2992 | 3003 | ||
| 2993 | static int hda_codec_pm_resume(struct device *dev) | 3004 | static int hda_codec_pm_resume(struct device *dev) |
| 2994 | { | 3005 | { |
| 2995 | dev->power.power_state = PMSG_RESUME; | 3006 | dev->power.power_state = PMSG_RESUME; |
| 2996 | return hda_codec_force_resume(dev); | 3007 | return hda_codec_resume(dev); |
| 2997 | } | 3008 | } |
| 2998 | 3009 | ||
| 2999 | static int hda_codec_pm_freeze(struct device *dev) | 3010 | static int hda_codec_pm_freeze(struct device *dev) |
| 3000 | { | 3011 | { |
| 3001 | dev->power.power_state = PMSG_FREEZE; | 3012 | dev->power.power_state = PMSG_FREEZE; |
| 3002 | return pm_runtime_force_suspend(dev); | 3013 | return hda_codec_suspend(dev); |
| 3003 | } | 3014 | } |
| 3004 | 3015 | ||
| 3005 | static int hda_codec_pm_thaw(struct device *dev) | 3016 | static int hda_codec_pm_thaw(struct device *dev) |
| 3006 | { | 3017 | { |
| 3007 | dev->power.power_state = PMSG_THAW; | 3018 | dev->power.power_state = PMSG_THAW; |
| 3008 | return hda_codec_force_resume(dev); | 3019 | return hda_codec_resume(dev); |
| 3009 | } | 3020 | } |
| 3010 | 3021 | ||
| 3011 | static int hda_codec_pm_restore(struct device *dev) | 3022 | static int hda_codec_pm_restore(struct device *dev) |
| 3012 | { | 3023 | { |
| 3013 | dev->power.power_state = PMSG_RESTORE; | 3024 | dev->power.power_state = PMSG_RESTORE; |
| 3014 | return hda_codec_force_resume(dev); | 3025 | return hda_codec_resume(dev); |
| 3015 | } | 3026 | } |
| 3016 | #endif /* CONFIG_PM_SLEEP */ | 3027 | #endif /* CONFIG_PM_SLEEP */ |
| 3017 | 3028 | ||
| 3018 | /* referred in hda_bind.c */ | 3029 | /* referred in hda_bind.c */ |
| 3019 | const struct dev_pm_ops hda_codec_driver_pm = { | 3030 | const struct dev_pm_ops hda_codec_driver_pm = { |
| 3020 | #ifdef CONFIG_PM_SLEEP | 3031 | #ifdef CONFIG_PM_SLEEP |
| 3032 | .prepare = hda_codec_pm_prepare, | ||
| 3033 | .complete = hda_codec_pm_complete, | ||
| 3021 | .suspend = hda_codec_pm_suspend, | 3034 | .suspend = hda_codec_pm_suspend, |
| 3022 | .resume = hda_codec_pm_resume, | 3035 | .resume = hda_codec_pm_resume, |
| 3023 | .freeze = hda_codec_pm_freeze, | 3036 | .freeze = hda_codec_pm_freeze, |
| @@ -41,7 +41,7 @@ · 40 unmodified lines | |||
| 41 | /* 24 unused */ | 41 | /* 24 unused */ |
| 42 | #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ | 42 | #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ |
| 43 | #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ | 43 | #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ |
| 44 | #define AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP (1 << 27) /* Workaround for spurious wakeups after suspend */ | 44 | /* 27 unused */ |
| 45 | #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ | 45 | #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ |
| 46 | #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ | 46 | #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ |
| 47 | #define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30) /* capture and playback use separate stream tag */ | 47 | #define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30) /* capture and playback use separate stream tag */ |
| @@ -143,6 +143,7 @@ struct azx { · 95 unmodified lines | |||
| 143 | unsigned int align_buffer_size:1; | 143 | unsigned int align_buffer_size:1; |
| 144 | unsigned int region_requested:1; | 144 | unsigned int region_requested:1; |
| 145 | unsigned int disabled:1; /* disabled by vga_switcheroo */ | 145 | unsigned int disabled:1; /* disabled by vga_switcheroo */ |
| 146 | unsigned int pm_prepared:1; | ||
| 146 | 147 | ||
| 147 | /* GTS present */ | 148 | /* GTS present */ |
| 148 | unsigned int gts_present:1; | 149 | unsigned int gts_present:1; |
| @@ -297,8 +297,7 @@ enum { · 296 unmodified lines | |||
| 297 | /* PCH for HSW/BDW; with runtime PM */ | 297 | /* PCH for HSW/BDW; with runtime PM */ |
| 298 | /* no i915 binding for this as HSW/BDW has another controller for HDMI */ | 298 | /* no i915 binding for this as HSW/BDW has another controller for HDMI */ |
| 299 | #define AZX_DCAPS_INTEL_PCH \ | 299 | #define AZX_DCAPS_INTEL_PCH \ |
| 300 | (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\ | 300 | (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME) |
| 301 | AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP) | ||
| 302 | 301 | ||
| 303 | /* HSW HDMI */ | 302 | /* HSW HDMI */ |
| 304 | #define AZX_DCAPS_INTEL_HASWELL \ | 303 | #define AZX_DCAPS_INTEL_HASWELL \ |
| @@ -985,7 +984,7 @@ static void __azx_runtime_suspend(struct azx *chip) · 680 unmodified lines | |||
| 985 | display_power(chip, false); | 984 | display_power(chip, false); |
| 986 | } | 985 | } |
| 987 | 986 | ||
| 988 | static void __azx_runtime_resume(struct azx *chip, bool from_rt) | 987 | static void __azx_runtime_resume(struct azx *chip) |
| 989 | { | 988 | { |
| 990 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | 989 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
| 991 | struct hdac_bus *bus = azx_bus(chip); | 990 | struct hdac_bus *bus = azx_bus(chip); |
| @@ -1002,7 +1001,8 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt) · 10 unmodified lines | |||
| 1002 | azx_init_pci(chip); | 1001 | azx_init_pci(chip); |
| 1003 | hda_intel_init_chip(chip, true); | 1002 | hda_intel_init_chip(chip, true); |
| 1004 | 1003 | ||
| 1005 | if (from_rt) { | 1004 | /* Avoid codec resume if runtime resume is for system suspend */ |
| 1005 | if (!chip->pm_prepared) { | ||
| 1006 | list_for_each_codec(codec, &chip->bus) { | 1006 | list_for_each_codec(codec, &chip->bus) { |
| 1007 | if (codec->relaxed_resume) | 1007 | if (codec->relaxed_resume) |
| 1008 | continue; | 1008 | continue; |
| @@ -1018,6 +1018,29 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt) · 9 unmodified lines | |||
| 1018 | } | 1018 | } |
| 1019 | 1019 | ||
| 1020 | #ifdef CONFIG_PM_SLEEP | 1020 | #ifdef CONFIG_PM_SLEEP |
| 1021 | static int azx_prepare(struct device *dev) | ||
| 1022 | { | ||
| 1023 | struct snd_card *card = dev_get_drvdata(dev); | ||
| 1024 | struct azx *chip; | ||
| 1025 | |||
| 1026 | chip = card->private_data; | ||
| 1027 | chip->pm_prepared = 1; | ||
| 1028 | |||
| 1029 | /* HDA controller always requires different WAKEEN for runtime suspend | ||
| 1030 | * and system suspend, so don't use direct-complete here. | ||
| 1031 | */ | ||
| 1032 | return 0; | ||
| 1033 | } | ||
| 1034 | |||
| 1035 | static void azx_complete(struct device *dev) | ||
| 1036 | { | ||
| 1037 | struct snd_card *card = dev_get_drvdata(dev); | ||
| 1038 | struct azx *chip; | ||
| 1039 | |||
| 1040 | chip = card->private_data; | ||
| 1041 | chip->pm_prepared = 0; | ||
| 1042 | } | ||
| 1043 | |||
| 1021 | static int azx_suspend(struct device *dev) | 1044 | static int azx_suspend(struct device *dev) |
| 1022 | { | 1045 | { |
| 1023 | struct snd_card *card = dev_get_drvdata(dev); | 1046 | struct snd_card *card = dev_get_drvdata(dev); |
| @@ -1029,15 +1052,7 @@ static int azx_suspend(struct device *dev) · 5 unmodified lines | |||
| 1029 | 1052 | ||
| 1030 | chip = card->private_data; | 1053 | chip = card->private_data; |
| 1031 | bus = azx_bus(chip); | 1054 | bus = azx_bus(chip); |
| 1032 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1055 | __azx_runtime_suspend(chip); |
| 1033 | /* An ugly workaround: direct call of __azx_runtime_suspend() and | ||
| 1034 | * __azx_runtime_resume() for old Intel platforms that suffer from | ||
| 1035 | * spurious wakeups after S3 suspend | ||
| 1036 | */ | ||
| 1037 | if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP) | ||
| 1038 | __azx_runtime_suspend(chip); | ||
| 1039 | else | ||
| 1040 | pm_runtime_force_suspend(dev); | ||
| 1041 | if (bus->irq >= 0) { | 1056 | if (bus->irq >= 0) { |
| 1042 | free_irq(bus->irq, chip); | 1057 | free_irq(bus->irq, chip); |
| 1043 | bus->irq = -1; | 1058 | bus->irq = -1; |
| @@ -1066,11 +1081,7 @@ static int azx_resume(struct device *dev) · 22 unmodified lines | |||
| 1066 | if (azx_acquire_irq(chip, 1) < 0) | 1081 | if (azx_acquire_irq(chip, 1) < 0) |
| 1067 | return -EIO; | 1082 | return -EIO; |
| 1068 | 1083 | ||
| 1069 | if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP) | 1084 | __azx_runtime_resume(chip); |
| 1070 | __azx_runtime_resume(chip, false); | ||
| 1071 | else | ||
| 1072 | pm_runtime_force_resume(dev); | ||
| 1073 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
| 1074 | 1085 | ||
| 1075 | trace_azx_resume(chip); | 1086 | trace_azx_resume(chip); |
| 1076 | return 0; | 1087 | return 0; |
| @@ -1118,10 +1129,7 @@ static int azx_runtime_suspend(struct device *dev) · 41 unmodified lines | |||
| 1118 | chip = card->private_data; | 1129 | chip = card->private_data; |
| 1119 | 1130 | ||
| 1120 | /* enable controller wake up event */ | 1131 | /* enable controller wake up event */ |
| 1121 | if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) { | 1132 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | STATESTS_INT_MASK); |
| 1122 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | | ||
| 1123 | STATESTS_INT_MASK); | ||
| 1124 | } | ||
| 1125 | 1133 | ||
| 1126 | __azx_runtime_suspend(chip); | 1134 | __azx_runtime_suspend(chip); |
| 1127 | trace_azx_runtime_suspend(chip); | 1135 | trace_azx_runtime_suspend(chip); |
| @@ -1132,18 +1140,14 @@ static int azx_runtime_resume(struct device *dev) · 4 unmodified lines | |||
| 1132 | { | 1140 | { |
| 1133 | struct snd_card *card = dev_get_drvdata(dev); | 1141 | struct snd_card *card = dev_get_drvdata(dev); |
| 1134 | struct azx *chip; | 1142 | struct azx *chip; |
| 1135 | bool from_rt = snd_power_get_state(card) == SNDRV_CTL_POWER_D0; | ||
| 1136 | 1143 | ||
| 1137 | if (!azx_is_pm_ready(card)) | 1144 | if (!azx_is_pm_ready(card)) |
| 1138 | return 0; | 1145 | return 0; |
| 1139 | chip = card->private_data; | 1146 | chip = card->private_data; |
| 1140 | __azx_runtime_resume(chip, from_rt); | 1147 | __azx_runtime_resume(chip); |
| 1141 | 1148 | ||
| 1142 | /* disable controller Wake Up event*/ | 1149 | /* disable controller Wake Up event*/ |
| 1143 | if (from_rt) { | 1150 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & ~STATESTS_INT_MASK); |
| 1144 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & | ||
| 1145 | ~STATESTS_INT_MASK); | ||
| 1146 | } | ||
| 1147 | 1151 | ||
| 1148 | trace_azx_runtime_resume(chip); | 1152 | trace_azx_runtime_resume(chip); |
| 1149 | return 0; | 1153 | return 0; |
| @@ -1177,6 +1181,8 @@ static int azx_runtime_idle(struct device *dev) · 27 unmodified lines | |||
| 1177 | static const struct dev_pm_ops azx_pm = { | 1181 | static const struct dev_pm_ops azx_pm = { |
| 1178 | SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) | 1182 | SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) |
| 1179 | #ifdef CONFIG_PM_SLEEP | 1183 | #ifdef CONFIG_PM_SLEEP |
| 1184 | .prepare = azx_prepare, | ||
| 1185 | .complete = azx_complete, | ||
| 1180 | .freeze_noirq = azx_freeze_noirq, | 1186 | .freeze_noirq = azx_freeze_noirq, |
| 1181 | .thaw_noirq = azx_thaw_noirq, | 1187 | .thaw_noirq = azx_thaw_noirq, |
| 1182 | #endif | 1188 | #endif |
| @@ -2356,6 +2362,7 @@ static int azx_probe_continue(struct azx *chip) · 1173 unmodified lines | |||
| 2356 | 2362 | ||
| 2357 | if (azx_has_pm_runtime(chip)) { | 2363 | if (azx_has_pm_runtime(chip)) { |
| 2358 | pm_runtime_use_autosuspend(&pci->dev); | 2364 | pm_runtime_use_autosuspend(&pci->dev); |
| 2365 | pm_runtime_allow(&pci->dev); | ||
| 2359 | pm_runtime_put_autosuspend(&pci->dev); | 2366 | pm_runtime_put_autosuspend(&pci->dev); |
| 2360 | } | 2367 | } |
| 2361 | 2368 | ||
| @@ -6008,6 +6008,27 @@ static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, · 6007 unmodified lines | |||
| 6008 | snd_hda_override_wcaps(codec, 0x03, 0); | 6008 | snd_hda_override_wcaps(codec, 0x03, 0); |
| 6009 | } | 6009 | } |
| 6010 | 6010 | ||
| 6011 | static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) | ||
| 6012 | { | ||
| 6013 | switch (codec->core.vendor_id) { | ||
| 6014 | case 0x10ec0274: | ||
| 6015 | case 0x10ec0294: | ||
| 6016 | case 0x10ec0225: | ||
| 6017 | case 0x10ec0295: | ||
| 6018 | case 0x10ec0299: | ||
| 6019 | alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ | ||
| 6020 | alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); | ||
| 6021 | break; | ||
| 6022 | case 0x10ec0235: | ||
| 6023 | case 0x10ec0236: | ||
| 6024 | case 0x10ec0255: | ||
| 6025 | case 0x10ec0256: | ||
| 6026 | alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ | ||
| 6027 | alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); | ||
| 6028 | break; | ||
| 6029 | } | ||
| 6030 | } | ||
| 6031 | |||
| 6011 | static void alc295_fixup_chromebook(struct hda_codec *codec, | 6032 | static void alc295_fixup_chromebook(struct hda_codec *codec, |
| 6012 | const struct hda_fixup *fix, int action) | 6033 | const struct hda_fixup *fix, int action) |
| 6013 | { | 6034 | { |
| @@ -6018,16 +6039,7 @@ static void alc295_fixup_chromebook(struct hda_codec *codec, · 4 unmodified lines | |||
| 6018 | spec->ultra_low_power = true; | 6039 | spec->ultra_low_power = true; |
| 6019 | break; | 6040 | break; |
| 6020 | case HDA_FIXUP_ACT_INIT: | 6041 | case HDA_FIXUP_ACT_INIT: |
| 6021 | switch (codec->core.vendor_id) { | 6042 | alc_combo_jack_hp_jd_restart(codec); |
| 6022 | case 0x10ec0295: | ||
| 6023 | alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ | ||
| 6024 | alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); | ||
| 6025 | break; | ||
| 6026 | case 0x10ec0236: | ||
| 6027 | alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ | ||
| 6028 | alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); | ||
| 6029 | break; | ||
| 6030 | } | ||
| 6031 | break; | 6043 | break; |
| 6032 | } | 6044 | } |
| 6033 | } | 6045 | } |
| @@ -6083,6 +6095,16 @@ static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, · 49 unmodified lines | |||
| 6083 | alc_write_coef_idx(codec, 0x65, 0x0); | 6095 | alc_write_coef_idx(codec, 0x65, 0x0); |
| 6084 | } | 6096 | } |
| 6085 | 6097 | ||
| 6098 | static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, | ||
| 6099 | const struct hda_fixup *fix, int action) | ||
| 6100 | { | ||
| 6101 | switch (action) { | ||
| 6102 | case HDA_FIXUP_ACT_INIT: | ||
| 6103 | alc_combo_jack_hp_jd_restart(codec); | ||
| 6104 | break; | ||
| 6105 | } | ||
| 6106 | } | ||
| 6107 | |||
| 6086 | /* for hda_fixup_thinkpad_acpi() */ | 6108 | /* for hda_fixup_thinkpad_acpi() */ |
| 6087 | #include "thinkpad_helper.c" | 6109 | #include "thinkpad_helper.c" |
| 6088 | 6110 | ||
| @@ -6277,6 +6299,8 @@ enum { · 188 unmodified lines | |||
| 6277 | ALC256_FIXUP_INTEL_NUC8_RUGGED, | 6299 | ALC256_FIXUP_INTEL_NUC8_RUGGED, |
| 6278 | ALC255_FIXUP_XIAOMI_HEADSET_MIC, | 6300 | ALC255_FIXUP_XIAOMI_HEADSET_MIC, |
| 6279 | ALC274_FIXUP_HP_MIC, | 6301 | ALC274_FIXUP_HP_MIC, |
| 6302 | ALC274_FIXUP_HP_HEADSET_MIC, | ||
| 6303 | ALC256_FIXUP_ASUS_HPE, | ||
| 6280 | }; | 6304 | }; |
| 6281 | 6305 | ||
| 6282 | static const struct hda_fixup alc269_fixups[] = { | 6306 | static const struct hda_fixup alc269_fixups[] = { |
| @@ -7664,6 +7688,23 @@ static const struct hda_fixup alc269_fixups[] = { · 1381 unmodified lines | |||
| 7664 | { } | 7688 | { } |
| 7665 | }, | 7689 | }, |
| 7666 | }, | 7690 | }, |
| 7691 | [ALC274_FIXUP_HP_HEADSET_MIC] = { | ||
| 7692 | .type = HDA_FIXUP_FUNC, | ||
| 7693 | .v.func = alc274_fixup_hp_headset_mic, | ||
| 7694 | .chained = true, | ||
| 7695 | .chain_id = ALC274_FIXUP_HP_MIC | ||
| 7696 | }, | ||
| 7697 | [ALC256_FIXUP_ASUS_HPE] = { | ||
| 7698 | .type = HDA_FIXUP_VERBS, | ||
| 7699 | .v.verbs = (const struct hda_verb[]) { | ||
| 7700 | /* Set EAPD high */ | ||
| 7701 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f }, | ||
| 7702 | { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 }, | ||
| 7703 | { } | ||
| 7704 | }, | ||
| 7705 | .chained = true, | ||
| 7706 | .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC | ||
| 7707 | }, | ||
| 7667 | }; | 7708 | }; |
| 7668 | 7709 | ||
| 7669 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 7710 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
| @@ -7815,7 +7856,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 145 unmodified lines | |||
| 7815 | SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), | 7856 | SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), |
| 7816 | SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), | 7857 | SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), |
| 7817 | SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT), | 7858 | SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT), |
| 7818 | SND_PCI_QUIRK(0x103c, 0x874e, "HP", ALC274_FIXUP_HP_MIC), | ||
| 7819 | SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED), | 7859 | SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED), |
| 7820 | SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED), | 7860 | SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED), |
| 7821 | SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED), | 7861 | SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED), |
| @@ -7848,6 +7888,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 26 unmodified lines | |||
| 7848 | SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), | 7888 | SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
| 7849 | SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 7889 | SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 7850 | SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), | 7890 | SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), |
| 7891 | SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), | ||
| 7851 | SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), | 7892 | SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), |
| 7852 | SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), | 7893 | SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), |
| 7853 | SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), | 7894 | SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), |
| @@ -8339,6 +8380,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 485 unmodified lines | |||
| 8339 | {0x1a, 0x90a70130}, | 8380 | {0x1a, 0x90a70130}, |
| 8340 | {0x1b, 0x90170110}, | 8381 | {0x1b, 0x90170110}, |
| 8341 | {0x21, 0x03211020}), | 8382 | {0x21, 0x03211020}), |
| 8383 | SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC, | ||
| 8384 | {0x17, 0x90170110}, | ||
| 8385 | {0x19, 0x03a11030}, | ||
| 8386 | {0x21, 0x03211020}), | ||
| 8342 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, | 8387 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, |
| 8343 | {0x12, 0x90a60130}, | 8388 | {0x12, 0x90a60130}, |
| 8344 | {0x14, 0x90170110}, | 8389 | {0x14, 0x90170110}, |
| @@ -487,7 +487,6 @@ static int mchp_spdiftx_hw_params(struct snd_pcm_substream *substream, · 486 unmodified lines | |||
| 487 | } | 487 | } |
| 488 | mchp_spdiftx_channel_status_write(dev); | 488 | mchp_spdiftx_channel_status_write(dev); |
| 489 | spin_unlock_irqrestore(&ctrl->lock, flags); | 489 | spin_unlock_irqrestore(&ctrl->lock, flags); |
| 490 | mr |= SPDIFTX_MR_VALID1 | SPDIFTX_MR_VALID2; | ||
| 491 | 490 | ||
| 492 | if (dev->gclk_enabled) { | 491 | if (dev->gclk_enabled) { |
| 493 | clk_disable_unprepare(dev->gclk); | 492 | clk_disable_unprepare(dev->gclk); |
| @@ -254,8 +254,28 @@ static const struct snd_soc_dapm_widget cs42l51_dapm_widgets[] = { · 253 unmodified lines | |||
| 254 | &cs42l51_adcr_mux_controls), | 254 | &cs42l51_adcr_mux_controls), |
| 255 | }; | 255 | }; |
| 256 | 256 | ||
| 257 | static int mclk_event(struct snd_soc_dapm_widget *w, | ||
| 258 | struct snd_kcontrol *kcontrol, int event) | ||
| 259 | { | ||
| 260 | struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); | ||
| 261 | struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(comp); | ||
| 262 | |||
| 263 | switch (event) { | ||
| 264 | case SND_SOC_DAPM_PRE_PMU: | ||
| 265 | return clk_prepare_enable(cs42l51->mclk_handle); | ||
| 266 | case SND_SOC_DAPM_POST_PMD: | ||
| 267 | /* Delay mclk shutdown to fulfill power-down sequence requirements */ | ||
| 268 | msleep(20); | ||
| 269 | clk_disable_unprepare(cs42l51->mclk_handle); | ||
| 270 | break; | ||
| 271 | } | ||
| 272 | |||
| 273 | return 0; | ||
| 274 | } | ||
| 275 | |||
| 257 | static const struct snd_soc_dapm_widget cs42l51_dapm_mclk_widgets[] = { | 276 | static const struct snd_soc_dapm_widget cs42l51_dapm_mclk_widgets[] = { |
| 258 | SND_SOC_DAPM_CLOCK_SUPPLY("MCLK") | 277 | SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, mclk_event, |
| 278 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
| 259 | }; | 279 | }; |
| 260 | 280 | ||
| 261 | static const struct snd_soc_dapm_route cs42l51_routes[] = { | 281 | static const struct snd_soc_dapm_route cs42l51_routes[] = { |
| @@ -618,7 +618,7 @@ static const char * const sb_tx8_mux_text[] = { · 617 unmodified lines | |||
| 618 | "ZERO", "RX_MIX_TX8", "DEC8", "DEC8_192" | 618 | "ZERO", "RX_MIX_TX8", "DEC8", "DEC8_192" |
| 619 | }; | 619 | }; |
| 620 | 620 | ||
| 621 | static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0); | 621 | static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400); |
| 622 | static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1); | 622 | static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1); |
| 623 | static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1); | 623 | static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1); |
| 624 | static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0); | 624 | static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0); |
| @@ -551,7 +551,7 @@ struct wcd_iir_filter_ctl { · 550 unmodified lines | |||
| 551 | struct soc_bytes_ext bytes_ext; | 551 | struct soc_bytes_ext bytes_ext; |
| 552 | }; | 552 | }; |
| 553 | 553 | ||
| 554 | static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0); | 554 | static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400); |
| 555 | static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1); | 555 | static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1); |
| 556 | static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1); | 556 | static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1); |
| 557 | static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0); | 557 | static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0); |
| @@ -1026,6 +1026,8 @@ static struct snd_soc_dai_driver wsa881x_dais[] = { · 1025 unmodified lines | |||
| 1026 | .id = 0, | 1026 | .id = 0, |
| 1027 | .playback = { | 1027 | .playback = { |
| 1028 | .stream_name = "SPKR Playback", | 1028 | .stream_name = "SPKR Playback", |
| 1029 | .rates = SNDRV_PCM_RATE_48000, | ||
| 1030 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
| 1029 | .rate_max = 48000, | 1031 | .rate_max = 48000, |
| 1030 | .rate_min = 48000, | 1032 | .rate_min = 48000, |
| 1031 | .channels_min = 1, | 1033 | .channels_min = 1, |
| @@ -15,22 +15,6 @@ config SND_SOC_INTEL_SST_TOPLEVEL · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | if SND_SOC_INTEL_SST_TOPLEVEL | 16 | if SND_SOC_INTEL_SST_TOPLEVEL |
| 17 | 17 | ||
| 18 | config SND_SST_IPC | ||
| 19 | tristate | ||
| 20 | # This option controls the IPC core for HiFi2 platforms | ||
| 21 | |||
| 22 | config SND_SST_IPC_PCI | ||
| 23 | tristate | ||
| 24 | select SND_SST_IPC | ||
| 25 | # This option controls the PCI-based IPC for HiFi2 platforms | ||
| 26 | # (Medfield, Merrifield). | ||
| 27 | |||
| 28 | config SND_SST_IPC_ACPI | ||
| 29 | tristate | ||
| 30 | select SND_SST_IPC | ||
| 31 | # This option controls the ACPI-based IPC for HiFi2 platforms | ||
| 32 | # (Baytrail, Cherrytrail) | ||
| 33 | |||
| 34 | config SND_SOC_INTEL_SST | 18 | config SND_SOC_INTEL_SST |
| 35 | tristate | 19 | tristate |
| 36 | 20 | ||
| @@ -57,7 +41,6 @@ config SND_SST_ATOM_HIFI2_PLATFORM · 20 unmodified lines | |||
| 57 | config SND_SST_ATOM_HIFI2_PLATFORM_PCI | 41 | config SND_SST_ATOM_HIFI2_PLATFORM_PCI |
| 58 | tristate "PCI HiFi2 (Merrifield) Platforms" | 42 | tristate "PCI HiFi2 (Merrifield) Platforms" |
| 59 | depends on X86 && PCI | 43 | depends on X86 && PCI |
| 60 | select SND_SST_IPC_PCI | ||
| 61 | select SND_SST_ATOM_HIFI2_PLATFORM | 44 | select SND_SST_ATOM_HIFI2_PLATFORM |
| 62 | help | 45 | help |
| 63 | If you have a Intel Merrifield/Edison platform, then | 46 | If you have a Intel Merrifield/Edison platform, then |
| @@ -70,7 +53,6 @@ config SND_SST_ATOM_HIFI2_PLATFORM_ACPI · 6 unmodified lines | |||
| 70 | tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms" | 53 | tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms" |
| 71 | default ACPI | 54 | default ACPI |
| 72 | depends on X86 && ACPI && PCI | 55 | depends on X86 && ACPI && PCI |
| 73 | select SND_SST_IPC_ACPI | ||
| 74 | select SND_SST_ATOM_HIFI2_PLATFORM | 56 | select SND_SST_ATOM_HIFI2_PLATFORM |
| 75 | select SND_SOC_ACPI_INTEL_MATCH | 57 | select SND_SOC_ACPI_INTEL_MATCH |
| 76 | select IOSF_MBI | 58 | select IOSF_MBI |
| @@ -6,4 +6,4 @@ snd-soc-sst-atom-hifi2-platform-objs := sst-mfld-platform-pcm.o \ · 5 unmodified lines | |||
| 6 | obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += snd-soc-sst-atom-hifi2-platform.o | 6 | obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += snd-soc-sst-atom-hifi2-platform.o |
| 7 | 7 | ||
| 8 | # DSP driver | 8 | # DSP driver |
| 9 | obj-$(CONFIG_SND_SST_IPC) += sst/ | 9 | obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += sst/ |
| @@ -3,6 +3,6 @@ snd-intel-sst-core-objs := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_ · 2 unmodified lines | |||
| 3 | snd-intel-sst-pci-objs += sst_pci.o | 3 | snd-intel-sst-pci-objs += sst_pci.o |
| 4 | snd-intel-sst-acpi-objs += sst_acpi.o | 4 | snd-intel-sst-acpi-objs += sst_acpi.o |
| 5 | 5 | ||
| 6 | obj-$(CONFIG_SND_SST_IPC) += snd-intel-sst-core.o | 6 | obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += snd-intel-sst-core.o |
| 7 | obj-$(CONFIG_SND_SST_IPC_PCI) += snd-intel-sst-pci.o | 7 | obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_PCI) += snd-intel-sst-pci.o |
| 8 | obj-$(CONFIG_SND_SST_IPC_ACPI) += snd-intel-sst-acpi.o | 8 | obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI) += snd-intel-sst-acpi.o |
| @@ -401,17 +401,40 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, · 400 unmodified lines | |||
| 401 | struct snd_interval *chan = hw_param_interval(params, | 401 | struct snd_interval *chan = hw_param_interval(params, |
| 402 | SNDRV_PCM_HW_PARAM_CHANNELS); | 402 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 403 | struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); | 403 | struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); |
| 404 | struct snd_soc_dpcm *dpcm = container_of( | 404 | struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL; |
| 405 | params, struct snd_soc_dpcm, hw_params); | 405 | |
| 406 | struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link; | 406 | /* |
| 407 | struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link; | 407 | * The following loop will be called only for playback stream |
| 408 | * In this platform, there is only one playback device on every SSP | ||
| 409 | */ | ||
| 410 | for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) { | ||
| 411 | rtd_dpcm = dpcm; | ||
| 412 | break; | ||
| 413 | } | ||
| 414 | |||
| 415 | /* | ||
| 416 | * This following loop will be called only for capture stream | ||
| 417 | * In this platform, there is only one capture device on every SSP | ||
| 418 | */ | ||
| 419 | for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) { | ||
| 420 | rtd_dpcm = dpcm; | ||
| 421 | break; | ||
| 422 | } | ||
| 423 | |||
| 424 | if (!rtd_dpcm) | ||
| 425 | return -EINVAL; | ||
| 426 | |||
| 427 | /* | ||
| 428 | * The above 2 loops are mutually exclusive based on the stream direction, | ||
| 429 | * thus rtd_dpcm variable will never be overwritten | ||
| 430 | */ | ||
| 408 | 431 | ||
| 409 | /* | 432 | /* |
| 410 | * The ADSP will convert the FE rate to 48k, stereo, 24 bit | 433 | * The ADSP will convert the FE rate to 48k, stereo, 24 bit |
| 411 | */ | 434 | */ |
| 412 | if (!strcmp(fe_dai_link->name, "Kbl Audio Port") || | 435 | if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") || |
| 413 | !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") || | 436 | !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") || |
| 414 | !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) { | 437 | !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) { |
| 415 | rate->min = rate->max = 48000; | 438 | rate->min = rate->max = 48000; |
| 416 | chan->min = chan->max = 2; | 439 | chan->min = chan->max = 2; |
| 417 | snd_mask_none(fmt); | 440 | snd_mask_none(fmt); |
| @@ -421,7 +444,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, · 3 unmodified lines | |||
| 421 | * The speaker on the SSP0 supports S16_LE and not S24_LE. | 444 | * The speaker on the SSP0 supports S16_LE and not S24_LE. |
| 422 | * thus changing the mask here | 445 | * thus changing the mask here |
| 423 | */ | 446 | */ |
| 424 | if (!strcmp(be_dai_link->name, "SSP0-Codec")) | 447 | if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec")) |
| 425 | snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); | 448 | snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); |
| 426 | 449 | ||
| 427 | return 0; | 450 | return 0; |
| @@ -267,9 +267,12 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti) · 266 unmodified lines | |||
| 267 | reg, (reg & CATPT_ISD_DCPWM), | 267 | reg, (reg & CATPT_ISD_DCPWM), |
| 268 | 500, 10000); | 268 | 500, 10000); |
| 269 | if (ret) { | 269 | if (ret) { |
| 270 | dev_err(cdev->dev, "await WAITI timeout\n"); | 270 | dev_warn(cdev->dev, "await WAITI timeout\n"); |
| 271 | mutex_unlock(&cdev->clk_mutex); | 271 | /* no signal - only high clock selection allowed */ |
| 272 | return ret; | 272 | if (lp) { |
| 273 | mutex_unlock(&cdev->clk_mutex); | ||
| 274 | return 0; | ||
| 275 | } | ||
| 273 | } | 276 | } |
| 274 | } | 277 | } |
| 275 | 278 | ||
| @@ -667,7 +667,17 @@ static int catpt_dai_pcm_new(struct snd_soc_pcm_runtime *rtm, · 666 unmodified lines | |||
| 667 | break; | 667 | break; |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | /* see if this is a new configuration */ | ||
| 671 | if (!memcmp(&cdev->devfmt[devfmt.iface], &devfmt, sizeof(devfmt))) | ||
| 672 | return 0; | ||
| 673 | |||
| 674 | pm_runtime_get_sync(cdev->dev); | ||
| 675 | |||
| 670 | ret = catpt_ipc_set_device_format(cdev, &devfmt); | 676 | ret = catpt_ipc_set_device_format(cdev, &devfmt); |
| 677 | |||
| 678 | pm_runtime_mark_last_busy(cdev->dev); | ||
| 679 | pm_runtime_put_autosuspend(cdev->dev); | ||
| 680 | |||
| 671 | if (ret) | 681 | if (ret) |
| 672 | return CATPT_IPC_ERROR(ret); | 682 | return CATPT_IPC_ERROR(ret); |
| 673 | 683 | ||
| @@ -630,15 +630,34 @@ static struct snd_soc_codec_conf mt8183_da7219_rt1015_codec_conf[] = { · 629 unmodified lines | |||
| 630 | }, | 630 | }, |
| 631 | }; | 631 | }; |
| 632 | 632 | ||
| 633 | static const struct snd_kcontrol_new mt8183_da7219_rt1015_snd_controls[] = { | ||
| 634 | SOC_DAPM_PIN_SWITCH("Left Spk"), | ||
| 635 | SOC_DAPM_PIN_SWITCH("Right Spk"), | ||
| 636 | }; | ||
| 637 | |||
| 638 | static const | ||
| 639 | struct snd_soc_dapm_widget mt8183_da7219_rt1015_dapm_widgets[] = { | ||
| 640 | SND_SOC_DAPM_SPK("Left Spk", NULL), | ||
| 641 | SND_SOC_DAPM_SPK("Right Spk", NULL), | ||
| 642 | SND_SOC_DAPM_PINCTRL("TDM_OUT_PINCTRL", | ||
| 643 | "aud_tdm_out_on", "aud_tdm_out_off"), | ||
| 644 | }; | ||
| 645 | |||
| 646 | static const struct snd_soc_dapm_route mt8183_da7219_rt1015_dapm_routes[] = { | ||
| 647 | {"Left Spk", NULL, "Left SPO"}, | ||
| 648 | {"Right Spk", NULL, "Right SPO"}, | ||
| 649 | {"I2S Playback", NULL, "TDM_OUT_PINCTRL"}, | ||
| 650 | }; | ||
| 651 | |||
| 633 | static struct snd_soc_card mt8183_da7219_rt1015_card = { | 652 | static struct snd_soc_card mt8183_da7219_rt1015_card = { |
| 634 | .name = "mt8183_da7219_rt1015", | 653 | .name = "mt8183_da7219_rt1015", |
| 635 | .owner = THIS_MODULE, | 654 | .owner = THIS_MODULE, |
| 636 | .controls = mt8183_da7219_max98357_snd_controls, | 655 | .controls = mt8183_da7219_rt1015_snd_controls, |
| 637 | .num_controls = ARRAY_SIZE(mt8183_da7219_max98357_snd_controls), | 656 | .num_controls = ARRAY_SIZE(mt8183_da7219_rt1015_snd_controls), |
| 638 | .dapm_widgets = mt8183_da7219_max98357_dapm_widgets, | 657 | .dapm_widgets = mt8183_da7219_rt1015_dapm_widgets, |
| 639 | .num_dapm_widgets = ARRAY_SIZE(mt8183_da7219_max98357_dapm_widgets), | 658 | .num_dapm_widgets = ARRAY_SIZE(mt8183_da7219_rt1015_dapm_widgets), |
| 640 | .dapm_routes = mt8183_da7219_max98357_dapm_routes, | 659 | .dapm_routes = mt8183_da7219_rt1015_dapm_routes, |
| 641 | .num_dapm_routes = ARRAY_SIZE(mt8183_da7219_max98357_dapm_routes), | 660 | .num_dapm_routes = ARRAY_SIZE(mt8183_da7219_rt1015_dapm_routes), |
| 642 | .dai_link = mt8183_da7219_dai_links, | 661 | .dai_link = mt8183_da7219_dai_links, |
| 643 | .num_links = ARRAY_SIZE(mt8183_da7219_dai_links), | 662 | .num_links = ARRAY_SIZE(mt8183_da7219_dai_links), |
| 644 | .aux_dev = &mt8183_da7219_max98357_headset_dev, | 663 | .aux_dev = &mt8183_da7219_max98357_headset_dev, |
| @@ -80,6 +80,12 @@ static int lpass_cpu_daiops_startup(struct snd_pcm_substream *substream, · 79 unmodified lines | |||
| 80 | dev_err(dai->dev, "error in enabling mi2s osr clk: %d\n", ret); | 80 | dev_err(dai->dev, "error in enabling mi2s osr clk: %d\n", ret); |
| 81 | return ret; | 81 | return ret; |
| 82 | } | 82 | } |
| 83 | ret = clk_prepare(drvdata->mi2s_bit_clk[dai->driver->id]); | ||
| 84 | if (ret) { | ||
| 85 | dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret); | ||
| 86 | clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); | ||
| 87 | return ret; | ||
| 88 | } | ||
| 83 | return 0; | 89 | return 0; |
| 84 | } | 90 | } |
| 85 | 91 | ||
| @@ -88,9 +94,8 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream, · 2 unmodified lines | |||
| 88 | { | 94 | { |
| 89 | struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); | 95 | struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); |
| 90 | 96 | ||
| 91 | clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]); | ||
| 92 | |||
| 93 | clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); | 97 | clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); |
| 98 | clk_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]); | ||
| 94 | } | 99 | } |
| 95 | 100 | ||
| 96 | static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, | 101 | static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, |
| @@ -303,10 +308,10 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, · 206 unmodified lines | |||
| 303 | dev_err(dai->dev, "error writing to i2sctl reg: %d\n", | 308 | dev_err(dai->dev, "error writing to i2sctl reg: %d\n", |
| 304 | ret); | 309 | ret); |
| 305 | 310 | ||
| 306 | ret = clk_prepare_enable(drvdata->mi2s_bit_clk[id]); | 311 | ret = clk_enable(drvdata->mi2s_bit_clk[id]); |
| 307 | if (ret) { | 312 | if (ret) { |
| 308 | dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret); | 313 | dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret); |
| 309 | clk_disable_unprepare(drvdata->mi2s_osr_clk[id]); | 314 | clk_disable(drvdata->mi2s_osr_clk[id]); |
| 310 | return ret; | 315 | return ret; |
| 311 | } | 316 | } |
| 312 | 317 | ||
| @@ -324,6 +329,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, · 11 unmodified lines | |||
| 324 | if (ret) | 329 | if (ret) |
| 325 | dev_err(dai->dev, "error writing to i2sctl reg: %d\n", | 330 | dev_err(dai->dev, "error writing to i2sctl reg: %d\n", |
| 326 | ret); | 331 | ret); |
| 332 | clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]); | ||
| 327 | break; | 333 | break; |
| 328 | } | 334 | } |
| 329 | 335 | ||
| @@ -188,7 +188,7 @@ static struct lpass_variant sc7180_data = { · 187 unmodified lines | |||
| 188 | .micmode = REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000), | 188 | .micmode = REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000), |
| 189 | .micmono = REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000), | 189 | .micmono = REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000), |
| 190 | .wssrc = REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000), | 190 | .wssrc = REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000), |
| 191 | .bitwidth = REG_FIELD_ID(0x1000, 0, 0, 3, 0x1000), | 191 | .bitwidth = REG_FIELD_ID(0x1000, 0, 1, 3, 0x1000), |
| 192 | 192 | ||
| 193 | .rdma_dyncclk = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000), | 193 | .rdma_dyncclk = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000), |
| 194 | .rdma_bursten = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000), | 194 | .rdma_bursten = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000), |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | #include "qdsp6/q6afe.h" | 17 | #include "qdsp6/q6afe.h" |
| 18 | #include "../codecs/rt5663.h" | 18 | #include "../codecs/rt5663.h" |
| 19 | 19 | ||
| 20 | #define DRIVER_NAME "sdm845" | ||
| 20 | #define DEFAULT_SAMPLE_RATE_48K 48000 | 21 | #define DEFAULT_SAMPLE_RATE_48K 48000 |
| 21 | #define DEFAULT_MCLK_RATE 24576000 | 22 | #define DEFAULT_MCLK_RATE 24576000 |
| 22 | #define TDM_BCLK_RATE 6144000 | 23 | #define TDM_BCLK_RATE 6144000 |
| @@ -552,6 +553,7 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev) · 529 unmodified lines | |||
| 552 | if (!data) | 553 | if (!data) |
| 553 | return -ENOMEM; | 554 | return -ENOMEM; |
| 554 | 555 | ||
| 556 | card->driver_name = DRIVER_NAME; | ||
| 555 | card->dapm_widgets = sdm845_snd_widgets; | 557 | card->dapm_widgets = sdm845_snd_widgets; |
| 556 | card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets); | 558 | card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets); |
| 557 | card->dev = dev; | 559 | card->dev = dev; |
| @@ -2341,7 +2341,7 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, · 2340 unmodified lines | |||
| 2341 | } | 2341 | } |
| 2342 | 2342 | ||
| 2343 | /** | 2343 | /** |
| 2344 | * snd_soc_unregister_dai - Unregister DAIs from the ASoC core | 2344 | * snd_soc_unregister_dais - Unregister DAIs from the ASoC core |
| 2345 | * | 2345 | * |
| 2346 | * @component: The component for which the DAIs should be unregistered | 2346 | * @component: The component for which the DAIs should be unregistered |
| 2347 | */ | 2347 | */ |
| @@ -1276,7 +1276,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, · 1275 unmodified lines | |||
| 1276 | } | 1276 | } |
| 1277 | 1277 | ||
| 1278 | /** | 1278 | /** |
| 1279 | * snd_soc_dapm_get_connected_widgets - query audio path and it's widgets. | 1279 | * snd_soc_dapm_dai_get_connected_widgets - query audio path and it's widgets. |
| 1280 | * @dai: the soc DAI. | 1280 | * @dai: the soc DAI. |
| 1281 | * @stream: stream direction. | 1281 | * @stream: stream direction. |
| 1282 | * @list: list of active widgets for this stream. | 1282 | * @list: list of active widgets for this stream. |
| @@ -118,6 +118,11 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 bar, u32 offset) · 117 unmodified lines | |||
| 118 | case SOF_IPC_EXT_CC_INFO: | 118 | case SOF_IPC_EXT_CC_INFO: |
| 119 | ret = get_cc_info(sdev, ext_hdr); | 119 | ret = get_cc_info(sdev, ext_hdr); |
| 120 | break; | 120 | break; |
| 121 | case SOF_IPC_EXT_UNUSED: | ||
| 122 | case SOF_IPC_EXT_PROBE_INFO: | ||
| 123 | case SOF_IPC_EXT_USER_ABI_INFO: | ||
| 124 | /* They are supported but we don't do anything here */ | ||
| 125 | break; | ||
| 121 | default: | 126 | default: |
| 122 | dev_warn(sdev->dev, "warning: unknown ext header type %d size 0x%x\n", | 127 | dev_warn(sdev->dev, "warning: unknown ext header type %d size 0x%x\n", |
| 123 | ext_hdr->type, ext_hdr->hdr.size); | 128 | ext_hdr->type, ext_hdr->hdr.size); |
| @@ -336,6 +336,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, · 335 unmodified lines | |||
| 336 | switch (subs->stream->chip->usb_id) { | 336 | switch (subs->stream->chip->usb_id) { |
| 337 | case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ | 337 | case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ |
| 338 | case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ | 338 | case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ |
| 339 | case USB_ID(0x22f0, 0x0006): /* Allen&Heath Qu-16 */ | ||
| 339 | ep = 0x81; | 340 | ep = 0x81; |
| 340 | ifnum = 3; | 341 | ifnum = 3; |
| 341 | goto add_sync_ep_from_ifnum; | 342 | goto add_sync_ep_from_ifnum; |
| @@ -345,6 +346,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, · 3 unmodified lines | |||
| 345 | ifnum = 2; | 346 | ifnum = 2; |
| 346 | goto add_sync_ep_from_ifnum; | 347 | goto add_sync_ep_from_ifnum; |
| 347 | case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */ | 348 | case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */ |
| 349 | case USB_ID(0x0499, 0x172a): /* Yamaha MODX */ | ||
| 348 | ep = 0x86; | 350 | ep = 0x86; |
| 349 | ifnum = 2; | 351 | ifnum = 2; |
| 350 | goto add_sync_ep_from_ifnum; | 352 | goto add_sync_ep_from_ifnum; |
| @@ -352,6 +354,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, · 1 unmodified line | |||
| 352 | ep = 0x81; | 354 | ep = 0x81; |
| 353 | ifnum = 2; | 355 | ifnum = 2; |
| 354 | goto add_sync_ep_from_ifnum; | 356 | goto add_sync_ep_from_ifnum; |
| 357 | case USB_ID(0x1686, 0xf029): /* Zoom UAC-2 */ | ||
| 358 | ep = 0x82; | ||
| 359 | ifnum = 2; | ||
| 360 | goto add_sync_ep_from_ifnum; | ||
| 355 | case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */ | 361 | case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */ |
| 356 | case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */ | 362 | case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */ |
| 357 | ep = 0x81; | 363 | ep = 0x81; |
| @@ -1800,6 +1800,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, · 1799 unmodified lines | |||
| 1800 | case 0x278b: /* Rotel? */ | 1800 | case 0x278b: /* Rotel? */ |
| 1801 | case 0x292b: /* Gustard/Ess based devices */ | 1801 | case 0x292b: /* Gustard/Ess based devices */ |
| 1802 | case 0x2ab6: /* T+A devices */ | 1802 | case 0x2ab6: /* T+A devices */ |
| 1803 | case 0x3353: /* Khadas devices */ | ||
| 1803 | case 0x3842: /* EVGA */ | 1804 | case 0x3842: /* EVGA */ |
| 1804 | case 0xc502: /* HiBy devices */ | 1805 | case 0xc502: /* HiBy devices */ |
| 1805 | if (fp->dsd_raw) | 1806 | if (fp->dsd_raw) |
| @@ -159,6 +159,21 @@ struct kvm_sync_regs { · 158 unmodified lines | |||
| 159 | struct kvm_arch_memory_slot { | 159 | struct kvm_arch_memory_slot { |
| 160 | }; | 160 | }; |
| 161 | 161 | ||
| 162 | /* | ||
| 163 | * PMU filter structure. Describe a range of events with a particular | ||
| 164 | * action. To be used with KVM_ARM_VCPU_PMU_V3_FILTER. | ||
| 165 | */ | ||
| 166 | struct kvm_pmu_event_filter { | ||
| 167 | __u16 base_event; | ||
| 168 | __u16 nevents; | ||
| 169 | |||
| 170 | #define KVM_PMU_EVENT_ALLOW 0 | ||
| 171 | #define KVM_PMU_EVENT_DENY 1 | ||
| 172 | |||
| 173 | __u8 action; | ||
| 174 | __u8 pad[3]; | ||
| 175 | }; | ||
| 176 | |||
| 162 | /* for KVM_GET/SET_VCPU_EVENTS */ | 177 | /* for KVM_GET/SET_VCPU_EVENTS */ |
| 163 | struct kvm_vcpu_events { | 178 | struct kvm_vcpu_events { |
| 164 | struct { | 179 | struct { |
| @@ -242,6 +257,15 @@ struct kvm_vcpu_events { · 77 unmodified lines | |||
| 242 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0 | 257 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0 |
| 243 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1 | 258 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1 |
| 244 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2 | 259 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2 |
| 260 | |||
| 261 | /* | ||
| 262 | * Only two states can be presented by the host kernel: | ||
| 263 | * - NOT_REQUIRED: the guest doesn't need to do anything | ||
| 264 | * - NOT_AVAIL: the guest isn't mitigated (it can still use SSBS if available) | ||
| 265 | * | ||
| 266 | * All the other values are deprecated. The host still accepts all | ||
| 267 | * values (they are ABI), but will narrow them to the above two. | ||
| 268 | */ | ||
| 245 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2) | 269 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2) |
| 246 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0 | 270 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0 |
| 247 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1 | 271 | #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1 |
| @@ -329,6 +353,7 @@ struct kvm_vcpu_events { · 81 unmodified lines | |||
| 329 | #define KVM_ARM_VCPU_PMU_V3_CTRL 0 | 353 | #define KVM_ARM_VCPU_PMU_V3_CTRL 0 |
| 330 | #define KVM_ARM_VCPU_PMU_V3_IRQ 0 | 354 | #define KVM_ARM_VCPU_PMU_V3_IRQ 0 |
| 331 | #define KVM_ARM_VCPU_PMU_V3_INIT 1 | 355 | #define KVM_ARM_VCPU_PMU_V3_INIT 1 |
| 356 | #define KVM_ARM_VCPU_PMU_V3_FILTER 2 | ||
| 332 | #define KVM_ARM_VCPU_TIMER_CTRL 1 | 357 | #define KVM_ARM_VCPU_TIMER_CTRL 1 |
| 333 | #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 | 358 | #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0 |
| 334 | #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1 | 359 | #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1 |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | |||
| 29 | { 0x13, "SIGP conditional emergency signal" }, \ | 29 | { 0x13, "SIGP conditional emergency signal" }, \ |
| 30 | { 0x15, "SIGP sense running" }, \ | 30 | { 0x15, "SIGP sense running" }, \ |
| 31 | { 0x16, "SIGP set multithreading"}, \ | 31 | { 0x16, "SIGP set multithreading"}, \ |
| 32 | { 0x17, "SIGP store additional status ait address"} | 32 | { 0x17, "SIGP store additional status at address"} |
| 33 | 33 | ||
| 34 | #define icpt_prog_codes \ | 34 | #define icpt_prog_codes \ |
| 35 | { 0x0001, "Prog Operation" }, \ | 35 | { 0x0001, "Prog Operation" }, \ |
| @@ -96,7 +96,7 @@ · 95 unmodified lines | |||
| 96 | #define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in IA32 userspace */ | 96 | #define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in IA32 userspace */ |
| 97 | #define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */ | 97 | #define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */ |
| 98 | #define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */ | 98 | #define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */ |
| 99 | /* free ( 3*32+17) */ | 99 | #define X86_FEATURE_SME_COHERENT ( 3*32+17) /* "" AMD hardware-enforced cache coherency */ |
| 100 | #define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" LFENCE synchronizes RDTSC */ | 100 | #define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" LFENCE synchronizes RDTSC */ |
| 101 | #define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */ | 101 | #define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */ |
| 102 | #define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */ | 102 | #define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */ |
| @@ -236,6 +236,7 @@ · 133 unmodified lines | |||
| 236 | #define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table access-dirty bit */ | 236 | #define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table access-dirty bit */ |
| 237 | #define X86_FEATURE_VMCALL ( 8*32+18) /* "" Hypervisor supports the VMCALL instruction */ | 237 | #define X86_FEATURE_VMCALL ( 8*32+18) /* "" Hypervisor supports the VMCALL instruction */ |
| 238 | #define X86_FEATURE_VMW_VMMCALL ( 8*32+19) /* "" VMware prefers VMMCALL hypercall instruction */ | 238 | #define X86_FEATURE_VMW_VMMCALL ( 8*32+19) /* "" VMware prefers VMMCALL hypercall instruction */ |
| 239 | #define X86_FEATURE_SEV_ES ( 8*32+20) /* AMD Secure Encrypted Virtualization - Encrypted State */ | ||
| 239 | 240 | ||
| 240 | /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */ | 241 | /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */ |
| 241 | #define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ | 242 | #define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ |
| @@ -288,6 +289,7 @@ · 46 unmodified lines | |||
| 288 | #define X86_FEATURE_FENCE_SWAPGS_USER (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */ | 289 | #define X86_FEATURE_FENCE_SWAPGS_USER (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */ |
| 289 | #define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */ | 290 | #define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */ |
| 290 | #define X86_FEATURE_SPLIT_LOCK_DETECT (11*32+ 6) /* #AC for split lock */ | 291 | #define X86_FEATURE_SPLIT_LOCK_DETECT (11*32+ 6) /* #AC for split lock */ |
| 292 | #define X86_FEATURE_PER_THREAD_MBA (11*32+ 7) /* "" Per-thread Memory Bandwidth Allocation */ | ||
| 291 | 293 | ||
| 292 | /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ | 294 | /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ |
| 293 | #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */ | 295 | #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */ |
| @@ -353,6 +355,7 @@ · 59 unmodified lines | |||
| 353 | #define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ | 355 | #define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ |
| 354 | #define X86_FEATURE_MOVDIRI (16*32+27) /* MOVDIRI instruction */ | 356 | #define X86_FEATURE_MOVDIRI (16*32+27) /* MOVDIRI instruction */ |
| 355 | #define X86_FEATURE_MOVDIR64B (16*32+28) /* MOVDIR64B instruction */ | 357 | #define X86_FEATURE_MOVDIR64B (16*32+28) /* MOVDIR64B instruction */ |
| 358 | #define X86_FEATURE_ENQCMD (16*32+29) /* ENQCMD and ENQCMDS instructions */ | ||
| 356 | 359 | ||
| 357 | /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ | 360 | /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ |
| 358 | #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ | 361 | #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ |
| @@ -368,6 +371,7 @@ · 9 unmodified lines | |||
| 368 | #define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */ | 371 | #define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */ |
| 369 | #define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */ | 372 | #define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */ |
| 370 | #define X86_FEATURE_SERIALIZE (18*32+14) /* SERIALIZE instruction */ | 373 | #define X86_FEATURE_SERIALIZE (18*32+14) /* SERIALIZE instruction */ |
| 374 | #define X86_FEATURE_TSXLDTRK (18*32+16) /* TSX Suspend Load Address Tracking */ | ||
| 371 | #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ | 375 | #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ |
| 372 | #define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */ | 376 | #define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */ |
| 373 | #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ | 377 | #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ |
| @@ -56,6 +56,12 @@ · 55 unmodified lines | |||
| 56 | # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31)) | 56 | # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31)) |
| 57 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | #ifdef CONFIG_IOMMU_SUPPORT | ||
| 60 | # define DISABLE_ENQCMD 0 | ||
| 61 | #else | ||
| 62 | # define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31)) | ||
| 63 | #endif | ||
| 64 | |||
| 59 | /* | 65 | /* |
| 60 | * Make sure to add features to the correct mask | 66 | * Make sure to add features to the correct mask |
| 61 | */ | 67 | */ |
| @@ -75,7 +81,8 @@ · 13 unmodified lines | |||
| 75 | #define DISABLED_MASK13 0 | 81 | #define DISABLED_MASK13 0 |
| 76 | #define DISABLED_MASK14 0 | 82 | #define DISABLED_MASK14 0 |
| 77 | #define DISABLED_MASK15 0 | 83 | #define DISABLED_MASK15 0 |
| 78 | #define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP) | 84 | #define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \ |
| 85 | DISABLE_ENQCMD) | ||
| 79 | #define DISABLED_MASK17 0 | 86 | #define DISABLED_MASK17 0 |
| 80 | #define DISABLED_MASK18 0 | 87 | #define DISABLED_MASK18 0 |
| 81 | #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19) | 88 | #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19) |
| @@ -257,6 +257,9 @@ · 256 unmodified lines | |||
| 257 | #define MSR_IA32_LASTINTFROMIP 0x000001dd | 257 | #define MSR_IA32_LASTINTFROMIP 0x000001dd |
| 258 | #define MSR_IA32_LASTINTTOIP 0x000001de | 258 | #define MSR_IA32_LASTINTTOIP 0x000001de |
| 259 | 259 | ||
| 260 | #define MSR_IA32_PASID 0x00000d93 | ||
| 261 | #define MSR_IA32_PASID_VALID BIT_ULL(31) | ||
| 262 | |||
| 260 | /* DEBUGCTLMSR bits (others vary by model): */ | 263 | /* DEBUGCTLMSR bits (others vary by model): */ |
| 261 | #define DEBUGCTLMSR_LBR (1UL << 0) /* last branch recording */ | 264 | #define DEBUGCTLMSR_LBR (1UL << 0) /* last branch recording */ |
| 262 | #define DEBUGCTLMSR_BTF_SHIFT 1 | 265 | #define DEBUGCTLMSR_BTF_SHIFT 1 |
| @@ -464,11 +467,15 @@ · 201 unmodified lines | |||
| 464 | #define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1) | 467 | #define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1) |
| 465 | #define MSR_AMD64_IBSCTL 0xc001103a | 468 | #define MSR_AMD64_IBSCTL 0xc001103a |
| 466 | #define MSR_AMD64_IBSBRTARGET 0xc001103b | 469 | #define MSR_AMD64_IBSBRTARGET 0xc001103b |
| 470 | #define MSR_AMD64_ICIBSEXTDCTL 0xc001103c | ||
| 467 | #define MSR_AMD64_IBSOPDATA4 0xc001103d | 471 | #define MSR_AMD64_IBSOPDATA4 0xc001103d |
| 468 | #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */ | 472 | #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */ |
| 473 | #define MSR_AMD64_SEV_ES_GHCB 0xc0010130 | ||
| 469 | #define MSR_AMD64_SEV 0xc0010131 | 474 | #define MSR_AMD64_SEV 0xc0010131 |
| 470 | #define MSR_AMD64_SEV_ENABLED_BIT 0 | 475 | #define MSR_AMD64_SEV_ENABLED_BIT 0 |
| 476 | #define MSR_AMD64_SEV_ES_ENABLED_BIT 1 | ||
| 471 | #define MSR_AMD64_SEV_ENABLED BIT_ULL(MSR_AMD64_SEV_ENABLED_BIT) | 477 | #define MSR_AMD64_SEV_ENABLED BIT_ULL(MSR_AMD64_SEV_ENABLED_BIT) |
| 478 | #define MSR_AMD64_SEV_ES_ENABLED BIT_ULL(MSR_AMD64_SEV_ES_ENABLED_BIT) | ||
| 472 | 479 | ||
| 473 | #define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f | 480 | #define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f |
| 474 | 481 | ||
| @@ -857,11 +864,14 @@ · 382 unmodified lines | |||
| 857 | #define MSR_CORE_PERF_FIXED_CTR0 0x00000309 | 864 | #define MSR_CORE_PERF_FIXED_CTR0 0x00000309 |
| 858 | #define MSR_CORE_PERF_FIXED_CTR1 0x0000030a | 865 | #define MSR_CORE_PERF_FIXED_CTR1 0x0000030a |
| 859 | #define MSR_CORE_PERF_FIXED_CTR2 0x0000030b | 866 | #define MSR_CORE_PERF_FIXED_CTR2 0x0000030b |
| 867 | #define MSR_CORE_PERF_FIXED_CTR3 0x0000030c | ||
| 860 | #define MSR_CORE_PERF_FIXED_CTR_CTRL 0x0000038d | 868 | #define MSR_CORE_PERF_FIXED_CTR_CTRL 0x0000038d |
| 861 | #define MSR_CORE_PERF_GLOBAL_STATUS 0x0000038e | 869 | #define MSR_CORE_PERF_GLOBAL_STATUS 0x0000038e |
| 862 | #define MSR_CORE_PERF_GLOBAL_CTRL 0x0000038f | 870 | #define MSR_CORE_PERF_GLOBAL_CTRL 0x0000038f |
| 863 | #define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x00000390 | 871 | #define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x00000390 |
| 864 | 872 | ||
| 873 | #define MSR_PERF_METRICS 0x00000329 | ||
| 874 | |||
| 865 | /* PERF_GLOBAL_OVF_CTL bits */ | 875 | /* PERF_GLOBAL_OVF_CTL bits */ |
| 866 | #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT 55 | 876 | #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT 55 |
| 867 | #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI (1ULL << MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT) | 877 | #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI (1ULL << MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT) |
| @@ -54,7 +54,7 @@ · 53 unmodified lines | |||
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | #ifdef CONFIG_X86_64 | 56 | #ifdef CONFIG_X86_64 |
| 57 | #ifdef CONFIG_PARAVIRT | 57 | #ifdef CONFIG_PARAVIRT_XXL |
| 58 | /* Paravirtualized systems may not have PSE or PGE available */ | 58 | /* Paravirtualized systems may not have PSE or PGE available */ |
| 59 | #define NEED_PSE 0 | 59 | #define NEED_PSE 0 |
| 60 | #define NEED_PGE 0 | 60 | #define NEED_PGE 0 |
| @@ -192,6 +192,26 @@ struct kvm_msr_list { · 191 unmodified lines | |||
| 192 | __u32 indices[0]; | 192 | __u32 indices[0]; |
| 193 | }; | 193 | }; |
| 194 | 194 | ||
| 195 | /* Maximum size of any access bitmap in bytes */ | ||
| 196 | #define KVM_MSR_FILTER_MAX_BITMAP_SIZE 0x600 | ||
| 197 | |||
| 198 | /* for KVM_X86_SET_MSR_FILTER */ | ||
| 199 | struct kvm_msr_filter_range { | ||
| 200 | #define KVM_MSR_FILTER_READ (1 << 0) | ||
| 201 | #define KVM_MSR_FILTER_WRITE (1 << 1) | ||
| 202 | __u32 flags; | ||
| 203 | __u32 nmsrs; /* number of msrs in bitmap */ | ||
| 204 | __u32 base; /* MSR index the bitmap starts at */ | ||
| 205 | __u8 *bitmap; /* a 1 bit allows the operations in flags, 0 denies */ | ||
| 206 | }; | ||
| 207 | |||
| 208 | #define KVM_MSR_FILTER_MAX_RANGES 16 | ||
| 209 | struct kvm_msr_filter { | ||
| 210 | #define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0) | ||
| 211 | #define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0) | ||
| 212 | __u32 flags; | ||
| 213 | struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES]; | ||
| 214 | }; | ||
| 195 | 215 | ||
| 196 | struct kvm_cpuid_entry { | 216 | struct kvm_cpuid_entry { |
| 197 | __u32 function; | 217 | __u32 function; |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #define SVM_EXIT_WRITE_DR6 0x036 | 29 | #define SVM_EXIT_WRITE_DR6 0x036 |
| 30 | #define SVM_EXIT_WRITE_DR7 0x037 | 30 | #define SVM_EXIT_WRITE_DR7 0x037 |
| 31 | #define SVM_EXIT_EXCP_BASE 0x040 | 31 | #define SVM_EXIT_EXCP_BASE 0x040 |
| 32 | #define SVM_EXIT_LAST_EXCP 0x05f | ||
| 32 | #define SVM_EXIT_INTR 0x060 | 33 | #define SVM_EXIT_INTR 0x060 |
| 33 | #define SVM_EXIT_NMI 0x061 | 34 | #define SVM_EXIT_NMI 0x061 |
| 34 | #define SVM_EXIT_SMI 0x062 | 35 | #define SVM_EXIT_SMI 0x062 |
| @@ -76,10 +77,21 @@ · 41 unmodified lines | |||
| 76 | #define SVM_EXIT_MWAIT_COND 0x08c | 77 | #define SVM_EXIT_MWAIT_COND 0x08c |
| 77 | #define SVM_EXIT_XSETBV 0x08d | 78 | #define SVM_EXIT_XSETBV 0x08d |
| 78 | #define SVM_EXIT_RDPRU 0x08e | 79 | #define SVM_EXIT_RDPRU 0x08e |
| 80 | #define SVM_EXIT_INVPCID 0x0a2 | ||
| 79 | #define SVM_EXIT_NPF 0x400 | 81 | #define SVM_EXIT_NPF 0x400 |
| 80 | #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 | 82 | #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 |
| 81 | #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402 | 83 | #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402 |
| 82 | 84 | ||
| 85 | /* SEV-ES software-defined VMGEXIT events */ | ||
| 86 | #define SVM_VMGEXIT_MMIO_READ 0x80000001 | ||
| 87 | #define SVM_VMGEXIT_MMIO_WRITE 0x80000002 | ||
| 88 | #define SVM_VMGEXIT_NMI_COMPLETE 0x80000003 | ||
| 89 | #define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004 | ||
| 90 | #define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005 | ||
| 91 | #define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0 | ||
| 92 | #define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1 | ||
| 93 | #define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff | ||
| 94 | |||
| 83 | #define SVM_EXIT_ERR -1 | 95 | #define SVM_EXIT_ERR -1 |
| 84 | 96 | ||
| 85 | #define SVM_EXIT_REASONS \ | 97 | #define SVM_EXIT_REASONS \ |
| @@ -171,6 +183,7 @@ · 85 unmodified lines | |||
| 171 | { SVM_EXIT_MONITOR, "monitor" }, \ | 183 | { SVM_EXIT_MONITOR, "monitor" }, \ |
| 172 | { SVM_EXIT_MWAIT, "mwait" }, \ | 184 | { SVM_EXIT_MWAIT, "mwait" }, \ |
| 173 | { SVM_EXIT_XSETBV, "xsetbv" }, \ | 185 | { SVM_EXIT_XSETBV, "xsetbv" }, \ |
| 186 | { SVM_EXIT_INVPCID, "invpcid" }, \ | ||
| 174 | { SVM_EXIT_NPF, "npf" }, \ | 187 | { SVM_EXIT_NPF, "npf" }, \ |
| 175 | { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \ | 188 | { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \ |
| 176 | { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \ | 189 | { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \ |
| @@ -185,7 +185,6 @@ int main(int argc, char *argv[]) · 184 unmodified lines | |||
| 185 | main_test_libperl(); | 185 | main_test_libperl(); |
| 186 | main_test_hello(); | 186 | main_test_hello(); |
| 187 | main_test_libelf(); | 187 | main_test_libelf(); |
| 188 | main_test_libelf_mmap(); | ||
| 189 | main_test_get_current_dir_name(); | 188 | main_test_get_current_dir_name(); |
| 190 | main_test_gettid(); | 189 | main_test_gettid(); |
| 191 | main_test_glibc(); | 190 | main_test_glibc(); |
| @@ -27,18 +27,6 @@ · 26 unmodified lines | |||
| 27 | #define __pure __attribute__((pure)) | 27 | #define __pure __attribute__((pure)) |
| 28 | #endif | 28 | #endif |
| 29 | #define noinline __attribute__((noinline)) | 29 | #define noinline __attribute__((noinline)) |
| 30 | #ifdef __has_attribute | ||
| 31 | #if __has_attribute(disable_tail_calls) | ||
| 32 | #define __no_tail_call __attribute__((disable_tail_calls)) | ||
| 33 | #endif | ||
| 34 | #endif | ||
| 35 | #ifndef __no_tail_call | ||
| 36 | #if GCC_VERSION > 40201 | ||
| 37 | #define __no_tail_call __attribute__((optimize("no-optimize-sibling-calls"))) | ||
| 38 | #else | ||
| 39 | #define __no_tail_call | ||
| 40 | #endif | ||
| 41 | #endif | ||
| 42 | #ifndef __packed | 30 | #ifndef __packed |
| 43 | #define __packed __attribute__((packed)) | 31 | #define __packed __attribute__((packed)) |
| 44 | #endif | 32 | #endif |
| @@ -47,9 +47,6 @@ · 46 unmodified lines | |||
| 47 | #ifndef noinline | 47 | #ifndef noinline |
| 48 | #define noinline | 48 | #define noinline |
| 49 | #endif | 49 | #endif |
| 50 | #ifndef __no_tail_call | ||
| 51 | #define __no_tail_call | ||
| 52 | #endif | ||
| 53 | 50 | ||
| 54 | /* Are two types/vars the same type (ignoring qualifiers)? */ | 51 | /* Are two types/vars the same type (ignoring qualifiers)? */ |
| 55 | #ifndef __same_type | 52 | #ifndef __same_type |
| @@ -857,9 +857,11 @@ __SYSCALL(__NR_openat2, sys_openat2) · 856 unmodified lines | |||
| 857 | __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd) | 857 | __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd) |
| 858 | #define __NR_faccessat2 439 | 858 | #define __NR_faccessat2 439 |
| 859 | __SYSCALL(__NR_faccessat2, sys_faccessat2) | 859 | __SYSCALL(__NR_faccessat2, sys_faccessat2) |
| 860 | #define __NR_process_madvise 440 | ||
| 861 | __SYSCALL(__NR_process_madvise, sys_process_madvise) | ||
| 860 | 862 | ||
| 861 | #undef __NR_syscalls | 863 | #undef __NR_syscalls |
| 862 | #define __NR_syscalls 440 | 864 | #define __NR_syscalls 441 |
| 863 | 865 | ||
| 864 | /* | 866 | /* |
| 865 | * 32 bit systems traditionally used different | 867 | * 32 bit systems traditionally used different |
| @@ -619,6 +619,12 @@ typedef struct drm_i915_irq_wait { · 618 unmodified lines | |||
| 619 | */ | 619 | */ |
| 620 | #define I915_PARAM_PERF_REVISION 54 | 620 | #define I915_PARAM_PERF_REVISION 54 |
| 621 | 621 | ||
| 622 | /* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of | ||
| 623 | * timeline syncobj through drm_i915_gem_execbuffer_ext_timeline_fences. See | ||
| 624 | * I915_EXEC_USE_EXTENSIONS. | ||
| 625 | */ | ||
| 626 | #define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55 | ||
| 627 | |||
| 622 | /* Must be kept compact -- no holes and well documented */ | 628 | /* Must be kept compact -- no holes and well documented */ |
| 623 | 629 | ||
| 624 | typedef struct drm_i915_getparam { | 630 | typedef struct drm_i915_getparam { |
| @@ -1046,6 +1052,38 @@ struct drm_i915_gem_exec_fence { · 421 unmodified lines | |||
| 1046 | __u32 flags; | 1052 | __u32 flags; |
| 1047 | }; | 1053 | }; |
| 1048 | 1054 | ||
| 1055 | /** | ||
| 1056 | * See drm_i915_gem_execbuffer_ext_timeline_fences. | ||
| 1057 | */ | ||
| 1058 | #define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0 | ||
| 1059 | |||
| 1060 | /** | ||
| 1061 | * This structure describes an array of drm_syncobj and associated points for | ||
| 1062 | * timeline variants of drm_syncobj. It is invalid to append this structure to | ||
| 1063 | * the execbuf if I915_EXEC_FENCE_ARRAY is set. | ||
| 1064 | */ | ||
| 1065 | struct drm_i915_gem_execbuffer_ext_timeline_fences { | ||
| 1066 | struct i915_user_extension base; | ||
| 1067 | |||
| 1068 | /** | ||
| 1069 | * Number of element in the handles_ptr & value_ptr arrays. | ||
| 1070 | */ | ||
| 1071 | __u64 fence_count; | ||
| 1072 | |||
| 1073 | /** | ||
| 1074 | * Pointer to an array of struct drm_i915_gem_exec_fence of length | ||
| 1075 | * fence_count. | ||
| 1076 | */ | ||
| 1077 | __u64 handles_ptr; | ||
| 1078 | |||
| 1079 | /** | ||
| 1080 | * Pointer to an array of u64 values of length fence_count. Values | ||
| 1081 | * must be 0 for a binary drm_syncobj. A Value of 0 for a timeline | ||
| 1082 | * drm_syncobj is invalid as it turns a drm_syncobj into a binary one. | ||
| 1083 | */ | ||
| 1084 | __u64 values_ptr; | ||
| 1085 | }; | ||
| 1086 | |||
| 1049 | struct drm_i915_gem_execbuffer2 { | 1087 | struct drm_i915_gem_execbuffer2 { |
| 1050 | /** | 1088 | /** |
| 1051 | * List of gem_exec_object2 structs | 1089 | * List of gem_exec_object2 structs |
| @@ -1062,8 +1100,14 @@ struct drm_i915_gem_execbuffer2 { · 10 unmodified lines | |||
| 1062 | __u32 num_cliprects; | 1100 | __u32 num_cliprects; |
| 1063 | /** | 1101 | /** |
| 1064 | * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY | 1102 | * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY |
| 1065 | * is not set. If I915_EXEC_FENCE_ARRAY is set, then this is a | 1103 | * & I915_EXEC_USE_EXTENSIONS are not set. |
| 1066 | * struct drm_i915_gem_exec_fence *fences. | 1104 | * |
| 1105 | * If I915_EXEC_FENCE_ARRAY is set, then this is a pointer to an array | ||
| 1106 | * of struct drm_i915_gem_exec_fence and num_cliprects is the length | ||
| 1107 | * of the array. | ||
| 1108 | * | ||
| 1109 | * If I915_EXEC_USE_EXTENSIONS is set, then this is a pointer to a | ||
| 1110 | * single struct i915_user_extension and num_cliprects is 0. | ||
| 1067 | */ | 1111 | */ |
| 1068 | __u64 cliprects_ptr; | 1112 | __u64 cliprects_ptr; |
| 1069 | #define I915_EXEC_RING_MASK (0x3f) | 1113 | #define I915_EXEC_RING_MASK (0x3f) |
| @@ -1181,7 +1225,16 @@ struct drm_i915_gem_execbuffer2 { · 111 unmodified lines | |||
| 1181 | */ | 1225 | */ |
| 1182 | #define I915_EXEC_FENCE_SUBMIT (1 << 20) | 1226 | #define I915_EXEC_FENCE_SUBMIT (1 << 20) |
| 1183 | 1227 | ||
| 1184 | #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SUBMIT << 1)) | 1228 | /* |
| 1229 | * Setting I915_EXEC_USE_EXTENSIONS implies that | ||
| 1230 | * drm_i915_gem_execbuffer2.cliprects_ptr is treated as a pointer to an linked | ||
| 1231 | * list of i915_user_extension. Each i915_user_extension node is the base of a | ||
| 1232 | * larger structure. The list of supported structures are listed in the | ||
| 1233 | * drm_i915_gem_execbuffer_ext enum. | ||
| 1234 | */ | ||
| 1235 | #define I915_EXEC_USE_EXTENSIONS (1 << 21) | ||
| 1236 | |||
| 1237 | #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_USE_EXTENSIONS << 1)) | ||
| 1185 | 1238 | ||
| 1186 | #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) | 1239 | #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) |
| 1187 | #define i915_execbuffer2_set_context_id(eb2, context) \ | 1240 | #define i915_execbuffer2_set_context_id(eb2, context) \ |
| @@ -45,7 +45,6 @@ struct fscrypt_policy_v1 { · 44 unmodified lines | |||
| 45 | __u8 flags; | 45 | __u8 flags; |
| 46 | __u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE]; | 46 | __u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE]; |
| 47 | }; | 47 | }; |
| 48 | #define fscrypt_policy fscrypt_policy_v1 | ||
| 49 | 48 | ||
| 50 | /* | 49 | /* |
| 51 | * Process-subscribed "logon" key description prefix and payload format. | 50 | * Process-subscribed "logon" key description prefix and payload format. |
| @@ -156,9 +155,9 @@ struct fscrypt_get_key_status_arg { · 104 unmodified lines | |||
| 156 | __u32 __out_reserved[13]; | 155 | __u32 __out_reserved[13]; |
| 157 | }; | 156 | }; |
| 158 | 157 | ||
| 159 | #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) | 158 | #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy_v1) |
| 160 | #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) | 159 | #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) |
| 161 | #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) | 160 | #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy_v1) |
| 162 | #define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9]) /* size + version */ | 161 | #define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9]) /* size + version */ |
| 163 | #define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg) | 162 | #define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg) |
| 164 | #define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg) | 163 | #define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg) |
| @@ -170,6 +169,7 @@ struct fscrypt_get_key_status_arg { · 5 unmodified lines | |||
| 170 | 169 | ||
| 171 | /* old names; don't add anything new here! */ | 170 | /* old names; don't add anything new here! */ |
| 172 | #ifndef __KERNEL__ | 171 | #ifndef __KERNEL__ |
| 172 | #define fscrypt_policy fscrypt_policy_v1 | ||
| 173 | #define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE | 173 | #define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE |
| 174 | #define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4 | 174 | #define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4 |
| 175 | #define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8 | 175 | #define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8 |
| @@ -248,6 +248,8 @@ struct kvm_hyperv_exit { · 247 unmodified lines | |||
| 248 | #define KVM_EXIT_IOAPIC_EOI 26 | 248 | #define KVM_EXIT_IOAPIC_EOI 26 |
| 249 | #define KVM_EXIT_HYPERV 27 | 249 | #define KVM_EXIT_HYPERV 27 |
| 250 | #define KVM_EXIT_ARM_NISV 28 | 250 | #define KVM_EXIT_ARM_NISV 28 |
| 251 | #define KVM_EXIT_X86_RDMSR 29 | ||
| 252 | #define KVM_EXIT_X86_WRMSR 30 | ||
| 251 | 253 | ||
| 252 | /* For KVM_EXIT_INTERNAL_ERROR */ | 254 | /* For KVM_EXIT_INTERNAL_ERROR */ |
| 253 | /* Emulate instruction failed. */ | 255 | /* Emulate instruction failed. */ |
| @@ -413,6 +415,17 @@ struct kvm_run { · 159 unmodified lines | |||
| 413 | __u64 esr_iss; | 415 | __u64 esr_iss; |
| 414 | __u64 fault_ipa; | 416 | __u64 fault_ipa; |
| 415 | } arm_nisv; | 417 | } arm_nisv; |
| 418 | /* KVM_EXIT_X86_RDMSR / KVM_EXIT_X86_WRMSR */ | ||
| 419 | struct { | ||
| 420 | __u8 error; /* user -> kernel */ | ||
| 421 | __u8 pad[7]; | ||
| 422 | #define KVM_MSR_EXIT_REASON_INVAL (1 << 0) | ||
| 423 | #define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1) | ||
| 424 | #define KVM_MSR_EXIT_REASON_FILTER (1 << 2) | ||
| 425 | __u32 reason; /* kernel -> user */ | ||
| 426 | __u32 index; /* kernel -> user */ | ||
| 427 | __u64 data; /* kernel <-> user */ | ||
| 428 | } msr; | ||
| 416 | /* Fix the size of the union. */ | 429 | /* Fix the size of the union. */ |
| 417 | char padding[256]; | 430 | char padding[256]; |
| 418 | }; | 431 | }; |
| @@ -1037,6 +1050,9 @@ struct kvm_ppc_resize_hpt { · 618 unmodified lines | |||
| 1037 | #define KVM_CAP_SMALLER_MAXPHYADDR 185 | 1050 | #define KVM_CAP_SMALLER_MAXPHYADDR 185 |
| 1038 | #define KVM_CAP_S390_DIAG318 186 | 1051 | #define KVM_CAP_S390_DIAG318 186 |
| 1039 | #define KVM_CAP_STEAL_TIME 187 | 1052 | #define KVM_CAP_STEAL_TIME 187 |
| 1053 | #define KVM_CAP_X86_USER_SPACE_MSR 188 | ||
| 1054 | #define KVM_CAP_X86_MSR_FILTER 189 | ||
| 1055 | #define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190 | ||
| 1040 | 1056 | ||
| 1041 | #ifdef KVM_CAP_IRQ_ROUTING | 1057 | #ifdef KVM_CAP_IRQ_ROUTING |
| 1042 | 1058 | ||
| @@ -1538,6 +1554,9 @@ struct kvm_pv_cmd { · 495 unmodified lines | |||
| 1538 | /* Available with KVM_CAP_S390_PROTECTED */ | 1554 | /* Available with KVM_CAP_S390_PROTECTED */ |
| 1539 | #define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd) | 1555 | #define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd) |
| 1540 | 1556 | ||
| 1557 | /* Available with KVM_CAP_X86_MSR_FILTER */ | ||
| 1558 | #define KVM_X86_SET_MSR_FILTER _IOW(KVMIO, 0xc6, struct kvm_msr_filter) | ||
| 1559 | |||
| 1541 | /* Secure Encrypted Virtualization command */ | 1560 | /* Secure Encrypted Virtualization command */ |
| 1542 | enum sev_cmd_id { | 1561 | enum sev_cmd_id { |
| 1543 | /* Guest initialization commands */ | 1562 | /* Guest initialization commands */ |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | |||
| 27 | #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT | 27 | #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT |
| 28 | #define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK | 28 | #define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK |
| 29 | 29 | ||
| 30 | #define MAP_HUGE_16KB HUGETLB_FLAG_ENCODE_16KB | ||
| 30 | #define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB | 31 | #define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB |
| 31 | #define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB | 32 | #define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB |
| 32 | #define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB | 33 | #define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | |||
| 16 | #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ | 16 | #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ |
| 17 | #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ | 17 | #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ |
| 18 | #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ | 18 | #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ |
| 19 | #define MS_NOSYMFOLLOW 256 /* Do not follow symlinks */ | ||
| 19 | #define MS_NOATIME 1024 /* Do not update access times. */ | 20 | #define MS_NOATIME 1024 /* Do not update access times. */ |
| 20 | #define MS_NODIRATIME 2048 /* Do not update directory access times */ | 21 | #define MS_NODIRATIME 2048 /* Do not update directory access times */ |
| 21 | #define MS_BIND 4096 | 22 | #define MS_BIND 4096 |
| @@ -1196,7 +1196,7 @@ union perf_mem_data_src { · 1195 unmodified lines | |||
| 1196 | 1196 | ||
| 1197 | #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ | 1197 | #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ |
| 1198 | /* 1 free */ | 1198 | /* 1 free */ |
| 1199 | #define PERF_MEM_SNOOPX_SHIFT 38 | 1199 | #define PERF_MEM_SNOOPX_SHIFT 38 |
| 1200 | 1200 | ||
| 1201 | /* locked instruction */ | 1201 | /* locked instruction */ |
| 1202 | #define PERF_MEM_LOCK_NA 0x01 /* not available */ | 1202 | #define PERF_MEM_LOCK_NA 0x01 /* not available */ |
| @@ -233,6 +233,15 @@ struct prctl_mm_map { · 232 unmodified lines | |||
| 233 | #define PR_SET_TAGGED_ADDR_CTRL 55 | 233 | #define PR_SET_TAGGED_ADDR_CTRL 55 |
| 234 | #define PR_GET_TAGGED_ADDR_CTRL 56 | 234 | #define PR_GET_TAGGED_ADDR_CTRL 56 |
| 235 | # define PR_TAGGED_ADDR_ENABLE (1UL << 0) | 235 | # define PR_TAGGED_ADDR_ENABLE (1UL << 0) |
| 236 | /* MTE tag check fault modes */ | ||
| 237 | # define PR_MTE_TCF_SHIFT 1 | ||
| 238 | # define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT) | ||
| 239 | # define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT) | ||
| 240 | # define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT) | ||
| 241 | # define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT) | ||
| 242 | /* MTE tag inclusion mask */ | ||
| 243 | # define PR_MTE_TAG_SHIFT 3 | ||
| 244 | # define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT) | ||
| 236 | 245 | ||
| 237 | /* Control reclaim behavior when allocating memory */ | 246 | /* Control reclaim behavior when allocating memory */ |
| 238 | #define PR_SET_IO_FLUSHER 57 | 247 | #define PR_SET_IO_FLUSHER 57 |
| @@ -146,4 +146,8 @@ · 145 unmodified lines | |||
| 146 | 146 | ||
| 147 | /* Set event fd for config interrupt*/ | 147 | /* Set event fd for config interrupt*/ |
| 148 | #define VHOST_VDPA_SET_CONFIG_CALL _IOW(VHOST_VIRTIO, 0x77, int) | 148 | #define VHOST_VDPA_SET_CONFIG_CALL _IOW(VHOST_VIRTIO, 0x77, int) |
| 149 | |||
| 150 | /* Get the valid iova range */ | ||
| 151 | #define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, \ | ||
| 152 | struct vhost_vdpa_iova_range) | ||
| 149 | #endif | 153 | #endif |
| @@ -749,6 +749,7 @@ else · 748 unmodified lines | |||
| 749 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) | 749 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) |
| 750 | PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) | 750 | PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) |
| 751 | PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) | 751 | PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) |
| 752 | PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) | ||
| 752 | PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) | 753 | PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) |
| 753 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) | 754 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
| 754 | 755 | ||
| @@ -361,12 +361,13 @@ · 360 unmodified lines | |||
| 361 | 437 common openat2 sys_openat2 | 361 | 437 common openat2 sys_openat2 |
| 362 | 438 common pidfd_getfd sys_pidfd_getfd | 362 | 438 common pidfd_getfd sys_pidfd_getfd |
| 363 | 439 common faccessat2 sys_faccessat2 | 363 | 439 common faccessat2 sys_faccessat2 |
| 364 | 440 common process_madvise sys_process_madvise | ||
| 364 | 365 | ||
| 365 | # | 366 | # |
| 366 | # x32-specific system call numbers start at 512 to avoid cache impact | 367 | # Due to a historical design error, certain syscalls are numbered differently |
| 367 | # for native 64-bit operation. The __x32_compat_sys stubs are created | 368 | # in x32 as compared to native x86_64. These syscalls have numbers 512-547. |
| 368 | # on-the-fly for compat_sys_*() compatibility system calls if X86_X32 | 369 | # Do not add new syscalls to this range. Numbers 548 and above are available |
| 369 | # is defined. | 370 | # for non-x32 use. |
| 370 | # | 371 | # |
| 371 | 512 x32 rt_sigaction compat_sys_rt_sigaction | 372 | 512 x32 rt_sigaction compat_sys_rt_sigaction |
| 372 | 513 x32 rt_sigreturn compat_sys_x32_rt_sigreturn | 373 | 513 x32 rt_sigreturn compat_sys_x32_rt_sigreturn |
| @@ -404,3 +405,5 @@ · 31 unmodified lines | |||
| 404 | 545 x32 execveat compat_sys_execveat | 405 | 545 x32 execveat compat_sys_execveat |
| 405 | 546 x32 preadv2 compat_sys_preadv64v2 | 406 | 546 x32 preadv2 compat_sys_preadv64v2 |
| 406 | 547 x32 pwritev2 compat_sys_pwritev64v2 | 407 | 547 x32 pwritev2 compat_sys_pwritev64v2 |
| 408 | # This is the end of the legacy x32 range. Numbers 548 and above are | ||
| 409 | # not special and are not to be used for x32-specific syscalls. | ||
| @@ -4639,9 +4639,9 @@ do_concat: · 4638 unmodified lines | |||
| 4639 | err = 0; | 4639 | err = 0; |
| 4640 | 4640 | ||
| 4641 | if (lists[0]) { | 4641 | if (lists[0]) { |
| 4642 | struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event", | 4642 | struct option o = { |
| 4643 | "event selector. use 'perf list' to list available events", | 4643 | .value = &trace->evlist, |
| 4644 | parse_events_option); | 4644 | }; |
| 4645 | err = parse_events_option(&o, lists[0], 0); | 4645 | err = parse_events_option(&o, lists[0], 0); |
| 4646 | } | 4646 | } |
| 4647 | out: | 4647 | out: |
| @@ -4655,9 +4655,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u · 7 unmodified lines | |||
| 4655 | { | 4655 | { |
| 4656 | struct trace *trace = opt->value; | 4656 | struct trace *trace = opt->value; |
| 4657 | 4657 | ||
| 4658 | if (!list_empty(&trace->evlist->core.entries)) | 4658 | if (!list_empty(&trace->evlist->core.entries)) { |
| 4659 | return parse_cgroups(opt, str, unset); | 4659 | struct option o = { |
| 4660 | 4660 | .value = &trace->evlist, | |
| 4661 | }; | ||
| 4662 | return parse_cgroups(&o, str, unset); | ||
| 4663 | } | ||
| 4661 | trace->cgroup = evlist__findnew_cgroup(trace->evlist, str); | 4664 | trace->cgroup = evlist__findnew_cgroup(trace->evlist, str); |
| 4662 | 4665 | ||
| 4663 | return 0; | 4666 | return 0; |
| @@ -329,7 +329,7 @@ · 328 unmodified lines | |||
| 329 | }, | 329 | }, |
| 330 | { | 330 | { |
| 331 | "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]", | 331 | "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]", |
| 332 | "MetricExpr": "( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time", | 332 | "MetricExpr": "( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time", |
| 333 | "MetricGroup": "Memory_BW;SoC", | 333 | "MetricGroup": "Memory_BW;SoC", |
| 334 | "MetricName": "DRAM_BW_Use" | 334 | "MetricName": "DRAM_BW_Use" |
| 335 | }, | 335 | }, |
| @@ -323,7 +323,7 @@ · 322 unmodified lines | |||
| 323 | }, | 323 | }, |
| 324 | { | 324 | { |
| 325 | "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]", | 325 | "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]", |
| 326 | "MetricExpr": "( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time", | 326 | "MetricExpr": "( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time", |
| 327 | "MetricGroup": "Memory_BW;SoC", | 327 | "MetricGroup": "Memory_BW;SoC", |
| 328 | "MetricName": "DRAM_BW_Use" | 328 | "MetricName": "DRAM_BW_Use" |
| 329 | }, | 329 | }, |
| @@ -95,7 +95,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) · 94 unmodified lines | |||
| 95 | return strcmp((const char *) symbol, funcs[idx]); | 95 | return strcmp((const char *) symbol, funcs[idx]); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | __no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread) | 98 | noinline int test_dwarf_unwind__thread(struct thread *thread) |
| 99 | { | 99 | { |
| 100 | struct perf_sample sample; | 100 | struct perf_sample sample; |
| 101 | unsigned long cnt = 0; | 101 | unsigned long cnt = 0; |
| @@ -126,7 +126,7 @@ __no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread) · 24 unmodified lines | |||
| 126 | 126 | ||
| 127 | static int global_unwind_retval = -INT_MAX; | 127 | static int global_unwind_retval = -INT_MAX; |
| 128 | 128 | ||
| 129 | __no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2) | 129 | noinline int test_dwarf_unwind__compare(void *p1, void *p2) |
| 130 | { | 130 | { |
| 131 | /* Any possible value should be 'thread' */ | 131 | /* Any possible value should be 'thread' */ |
| 132 | struct thread *thread = *(struct thread **)p1; | 132 | struct thread *thread = *(struct thread **)p1; |
| @@ -145,7 +145,7 @@ __no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2) · 12 unmodified lines | |||
| 145 | return p1 - p2; | 145 | return p1 - p2; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | __no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread) | 148 | noinline int test_dwarf_unwind__krava_3(struct thread *thread) |
| 149 | { | 149 | { |
| 150 | struct thread *array[2] = {thread, thread}; | 150 | struct thread *array[2] = {thread, thread}; |
| 151 | void *fp = &bsearch; | 151 | void *fp = &bsearch; |
| @@ -164,12 +164,12 @@ __no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread) · 12 unmodified lines | |||
| 164 | return global_unwind_retval; | 164 | return global_unwind_retval; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | __no_tail_call noinline int test_dwarf_unwind__krava_2(struct thread *thread) | 167 | noinline int test_dwarf_unwind__krava_2(struct thread *thread) |
| 168 | { | 168 | { |
| 169 | return test_dwarf_unwind__krava_3(thread); | 169 | return test_dwarf_unwind__krava_3(thread); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | __no_tail_call noinline int test_dwarf_unwind__krava_1(struct thread *thread) | 172 | noinline int test_dwarf_unwind__krava_1(struct thread *thread) |
| 173 | { | 173 | { |
| 174 | return test_dwarf_unwind__krava_2(thread); | 174 | return test_dwarf_unwind__krava_2(thread); |
| 175 | } | 175 | } |
| @@ -2963,7 +2963,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events, · 2962 unmodified lines | |||
| 2963 | struct popup_action actions[MAX_OPTIONS]; | 2963 | struct popup_action actions[MAX_OPTIONS]; |
| 2964 | int nr_options = 0; | 2964 | int nr_options = 0; |
| 2965 | int key = -1; | 2965 | int key = -1; |
| 2966 | char buf[64]; | 2966 | char buf[128]; |
| 2967 | int delay_secs = hbt ? hbt->refresh : 0; | 2967 | int delay_secs = hbt ? hbt->refresh : 0; |
| 2968 | 2968 | ||
| 2969 | #define HIST_BROWSER_HELP_COMMON \ | 2969 | #define HIST_BROWSER_HELP_COMMON \ |
| @@ -102,6 +102,8 @@ int build_id__sprintf(const struct build_id *build_id, char *bf) · 101 unmodified lines | |||
| 102 | const u8 *raw = build_id->data; | 102 | const u8 *raw = build_id->data; |
| 103 | size_t i; | 103 | size_t i; |
| 104 | 104 | ||
| 105 | bf[0] = 0x0; | ||
| 106 | |||
| 105 | for (i = 0; i < build_id->size; ++i) { | 107 | for (i = 0; i < build_id->size; ++i) { |
| 106 | sprintf(bid, "%02x", *raw); | 108 | sprintf(bid, "%02x", *raw); |
| 107 | ++raw; | 109 | ++raw; |
| @@ -15,6 +15,9 @@ · 14 unmodified lines | |||
| 15 | /* make sure libbpf doesn't use kernel-only integer typedefs */ | 15 | /* make sure libbpf doesn't use kernel-only integer typedefs */ |
| 16 | #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64 | 16 | #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64 |
| 17 | 17 | ||
| 18 | /* prevent accidental re-addition of reallocarray() */ | ||
| 19 | #pragma GCC poison reallocarray | ||
| 20 | |||
| 18 | /* start with 4 buckets */ | 21 | /* start with 4 buckets */ |
| 19 | #define HASHMAP_MIN_CAP_BITS 2 | 22 | #define HASHMAP_MIN_CAP_BITS 2 |
| 20 | 23 | ||
| @@ -25,6 +25,18 @@ static inline size_t hash_bits(size_t h, int bits) · 24 unmodified lines | |||
| 25 | #endif | 25 | #endif |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | /* generic C-string hashing function */ | ||
| 29 | static inline size_t str_hash(const char *s) | ||
| 30 | { | ||
| 31 | size_t h = 0; | ||
| 32 | |||
| 33 | while (*s) { | ||
| 34 | h = h * 31 + *s; | ||
| 35 | s++; | ||
| 36 | } | ||
| 37 | return h; | ||
| 38 | } | ||
| 39 | |||
| 28 | typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx); | 40 | typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx); |
| 29 | typedef bool (*hashmap_equal_fn)(const void *key1, const void *key2, void *ctx); | 41 | typedef bool (*hashmap_equal_fn)(const void *key1, const void *key2, void *ctx); |
| 30 | 42 | ||
| @@ -786,11 +786,20 @@ static int machine__process_ksymbol_unregister(struct machine *machine, · 785 unmodified lines | |||
| 786 | union perf_event *event, | 786 | union perf_event *event, |
| 787 | struct perf_sample *sample __maybe_unused) | 787 | struct perf_sample *sample __maybe_unused) |
| 788 | { | 788 | { |
| 789 | struct symbol *sym; | ||
| 789 | struct map *map; | 790 | struct map *map; |
| 790 | 791 | ||
| 791 | map = maps__find(&machine->kmaps, event->ksymbol.addr); | 792 | map = maps__find(&machine->kmaps, event->ksymbol.addr); |
| 792 | if (map) | 793 | if (!map) |
| 794 | return 0; | ||
| 795 | |||
| 796 | if (map != machine->vmlinux_map) | ||
| 793 | maps__remove(&machine->kmaps, map); | 797 | maps__remove(&machine->kmaps, map); |
| 798 | else { | ||
| 799 | sym = dso__find_symbol(map->dso, map->map_ip(map, map->start)); | ||
| 800 | if (sym) | ||
| 801 | dso__delete_symbol(map->dso, sym); | ||
| 802 | } | ||
| 794 | 803 | ||
| 795 | return 0; | 804 | return 0; |
| 796 | } | 805 | } |
| @@ -1592,7 +1592,6 @@ static void _free_command_line(wchar_t **command_line, int num) · 1591 unmodified lines | |||
| 1592 | static int python_start_script(const char *script, int argc, const char **argv) | 1592 | static int python_start_script(const char *script, int argc, const char **argv) |
| 1593 | { | 1593 | { |
| 1594 | struct tables *tables = &tables_global; | 1594 | struct tables *tables = &tables_global; |
| 1595 | PyMODINIT_FUNC (*initfunc)(void); | ||
| 1596 | #if PY_MAJOR_VERSION < 3 | 1595 | #if PY_MAJOR_VERSION < 3 |
| 1597 | const char **command_line; | 1596 | const char **command_line; |
| 1598 | #else | 1597 | #else |
| @@ -1607,20 +1606,18 @@ static int python_start_script(const char *script, int argc, const char **argv) · 8 unmodified lines | |||
| 1607 | FILE *fp; | 1606 | FILE *fp; |
| 1608 | 1607 | ||
| 1609 | #if PY_MAJOR_VERSION < 3 | 1608 | #if PY_MAJOR_VERSION < 3 |
| 1610 | initfunc = initperf_trace_context; | ||
| 1611 | command_line = malloc((argc + 1) * sizeof(const char *)); | 1609 | command_line = malloc((argc + 1) * sizeof(const char *)); |
| 1612 | command_line[0] = script; | 1610 | command_line[0] = script; |
| 1613 | for (i = 1; i < argc + 1; i++) | 1611 | for (i = 1; i < argc + 1; i++) |
| 1614 | command_line[i] = argv[i - 1]; | 1612 | command_line[i] = argv[i - 1]; |
| 1613 | PyImport_AppendInittab(name, initperf_trace_context); | ||
| 1615 | #else | 1614 | #else |
| 1616 | initfunc = PyInit_perf_trace_context; | ||
| 1617 | command_line = malloc((argc + 1) * sizeof(wchar_t *)); | 1615 | command_line = malloc((argc + 1) * sizeof(wchar_t *)); |
| 1618 | command_line[0] = Py_DecodeLocale(script, NULL); | 1616 | command_line[0] = Py_DecodeLocale(script, NULL); |
| 1619 | for (i = 1; i < argc + 1; i++) | 1617 | for (i = 1; i < argc + 1; i++) |
| 1620 | command_line[i] = Py_DecodeLocale(argv[i - 1], NULL); | 1618 | command_line[i] = Py_DecodeLocale(argv[i - 1], NULL); |
| 1619 | PyImport_AppendInittab(name, PyInit_perf_trace_context); | ||
| 1621 | #endif | 1620 | #endif |
| 1622 | |||
| 1623 | PyImport_AppendInittab(name, initfunc); | ||
| 1624 | Py_Initialize(); | 1621 | Py_Initialize(); |
| 1625 | 1622 | ||
| 1626 | #if PY_MAJOR_VERSION < 3 | 1623 | #if PY_MAJOR_VERSION < 3 |
| @@ -595,6 +595,7 @@ static void perf_event__mmap2_swap(union perf_event *event, · 594 unmodified lines | |||
| 595 | event->mmap2.maj = bswap_32(event->mmap2.maj); | 595 | event->mmap2.maj = bswap_32(event->mmap2.maj); |
| 596 | event->mmap2.min = bswap_32(event->mmap2.min); | 596 | event->mmap2.min = bswap_32(event->mmap2.min); |
| 597 | event->mmap2.ino = bswap_64(event->mmap2.ino); | 597 | event->mmap2.ino = bswap_64(event->mmap2.ino); |
| 598 | event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation); | ||
| 598 | 599 | ||
| 599 | if (sample_id_all) { | 600 | if (sample_id_all) { |
| 600 | void *data = &event->mmap2.filename; | 601 | void *data = &event->mmap2.filename; |
| @@ -710,6 +711,18 @@ static void perf_event__namespaces_swap(union perf_event *event, · 109 unmodified lines | |||
| 710 | swap_sample_id_all(event, &event->namespaces.link_info[i]); | 711 | swap_sample_id_all(event, &event->namespaces.link_info[i]); |
| 711 | } | 712 | } |
| 712 | 713 | ||
| 714 | static void perf_event__cgroup_swap(union perf_event *event, bool sample_id_all) | ||
| 715 | { | ||
| 716 | event->cgroup.id = bswap_64(event->cgroup.id); | ||
| 717 | |||
| 718 | if (sample_id_all) { | ||
| 719 | void *data = &event->cgroup.path; | ||
| 720 | |||
| 721 | data += PERF_ALIGN(strlen(data) + 1, sizeof(u64)); | ||
| 722 | swap_sample_id_all(event, data); | ||
| 723 | } | ||
| 724 | } | ||
| 725 | |||
| 713 | static u8 revbyte(u8 b) | 726 | static u8 revbyte(u8 b) |
| 714 | { | 727 | { |
| 715 | int rev = (b >> 4) | ((b & 0xf) << 4); | 728 | int rev = (b >> 4) | ((b & 0xf) << 4); |
| @@ -952,6 +965,7 @@ static perf_event__swap_op perf_event__swap_ops[] = { · 236 unmodified lines | |||
| 952 | [PERF_RECORD_SWITCH] = perf_event__switch_swap, | 965 | [PERF_RECORD_SWITCH] = perf_event__switch_swap, |
| 953 | [PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap, | 966 | [PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap, |
| 954 | [PERF_RECORD_NAMESPACES] = perf_event__namespaces_swap, | 967 | [PERF_RECORD_NAMESPACES] = perf_event__namespaces_swap, |
| 968 | [PERF_RECORD_CGROUP] = perf_event__cgroup_swap, | ||
| 955 | [PERF_RECORD_TEXT_POKE] = perf_event__text_poke_swap, | 969 | [PERF_RECORD_TEXT_POKE] = perf_event__text_poke_swap, |
| 956 | [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap, | 970 | [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap, |
| 957 | [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap, | 971 | [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap, |
| @@ -515,6 +515,13 @@ void dso__insert_symbol(struct dso *dso, struct symbol *sym) · 514 unmodified lines | |||
| 515 | } | 515 | } |
| 516 | } | 516 | } |
| 517 | 517 | ||
| 518 | void dso__delete_symbol(struct dso *dso, struct symbol *sym) | ||
| 519 | { | ||
| 520 | rb_erase_cached(&sym->rb_node, &dso->symbols); | ||
| 521 | symbol__delete(sym); | ||
| 522 | dso__reset_find_symbol_cache(dso); | ||
| 523 | } | ||
| 524 | |||
| 518 | struct symbol *dso__find_symbol(struct dso *dso, u64 addr) | 525 | struct symbol *dso__find_symbol(struct dso *dso, u64 addr) |
| 519 | { | 526 | { |
| 520 | if (dso->last_find_result.addr != addr || dso->last_find_result.symbol == NULL) { | 527 | if (dso->last_find_result.addr != addr || dso->last_find_result.symbol == NULL) { |
| @@ -131,6 +131,8 @@ int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map); · 130 unmodified lines | |||
| 131 | 131 | ||
| 132 | void dso__insert_symbol(struct dso *dso, | 132 | void dso__insert_symbol(struct dso *dso, |
| 133 | struct symbol *sym); | 133 | struct symbol *sym); |
| 134 | void dso__delete_symbol(struct dso *dso, | ||
| 135 | struct symbol *sym); | ||
| 134 | 136 | ||
| 135 | struct symbol *dso__find_symbol(struct dso *dso, u64 addr); | 137 | struct symbol *dso__find_symbol(struct dso *dso, u64 addr); |
| 136 | struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name); | 138 | struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name); |
| @@ -66,7 +66,6 @@ def isolate_kunit_output(kernel_output): · 65 unmodified lines | |||
| 66 | def raw_output(kernel_output): | 66 | def raw_output(kernel_output): |
| 67 | for line in kernel_output: | 67 | for line in kernel_output: |
| 68 | print(line) | 68 | print(line) |
| 69 | yield line | ||
| 70 | 69 | ||
| 71 | DIVIDER = '=' * 60 | 70 | DIVIDER = '=' * 60 |
| 72 | 71 | ||
| @@ -242,7 +241,7 @@ def parse_test_suite(lines: List[str], expected_suite_index: int) -> TestSuite: · 169 unmodified lines | |||
| 242 | return None | 241 | return None |
| 243 | test_suite.name = name | 242 | test_suite.name = name |
| 244 | expected_test_case_num = parse_subtest_plan(lines) | 243 | expected_test_case_num = parse_subtest_plan(lines) |
| 245 | if not expected_test_case_num: | 244 | if expected_test_case_num is None: |
| 246 | return None | 245 | return None |
| 247 | while expected_test_case_num > 0: | 246 | while expected_test_case_num > 0: |
| 248 | test_case = parse_test_case(lines) | 247 | test_case = parse_test_case(lines) |
| @@ -179,7 +179,7 @@ class KUnitParserTest(unittest.TestCase): · 178 unmodified lines | |||
| 179 | print_mock = mock.patch('builtins.print').start() | 179 | print_mock = mock.patch('builtins.print').start() |
| 180 | result = kunit_parser.parse_run_tests( | 180 | result = kunit_parser.parse_run_tests( |
| 181 | kunit_parser.isolate_kunit_output(file.readlines())) | 181 | kunit_parser.isolate_kunit_output(file.readlines())) |
| 182 | print_mock.assert_any_call(StrContains("no kunit output detected")) | 182 | print_mock.assert_any_call(StrContains('no tests run!')) |
| 183 | print_mock.stop() | 183 | print_mock.stop() |
| 184 | file.close() | 184 | file.close() |
| 185 | 185 | ||
| @@ -198,39 +198,57 @@ class KUnitParserTest(unittest.TestCase): · 12 unmodified lines | |||
| 198 | 'test_data/test_config_printk_time.log') | 198 | 'test_data/test_config_printk_time.log') |
| 199 | with open(prefix_log) as file: | 199 | with open(prefix_log) as file: |
| 200 | result = kunit_parser.parse_run_tests(file.readlines()) | 200 | result = kunit_parser.parse_run_tests(file.readlines()) |
| 201 | self.assertEqual('kunit-resource-test', result.suites[0].name) | 201 | self.assertEqual( |
| 202 | kunit_parser.TestStatus.SUCCESS, | ||
| 203 | result.status) | ||
| 204 | self.assertEqual('kunit-resource-test', result.suites[0].name) | ||
| 202 | 205 | ||
| 203 | def test_ignores_multiple_prefixes(self): | 206 | def test_ignores_multiple_prefixes(self): |
| 204 | prefix_log = get_absolute_path( | 207 | prefix_log = get_absolute_path( |
| 205 | 'test_data/test_multiple_prefixes.log') | 208 | 'test_data/test_multiple_prefixes.log') |
| 206 | with open(prefix_log) as file: | 209 | with open(prefix_log) as file: |
| 207 | result = kunit_parser.parse_run_tests(file.readlines()) | 210 | result = kunit_parser.parse_run_tests(file.readlines()) |
| 208 | self.assertEqual('kunit-resource-test', result.suites[0].name) | 211 | self.assertEqual( |
| 212 | kunit_parser.TestStatus.SUCCESS, | ||
| 213 | result.status) | ||
| 214 | self.assertEqual('kunit-resource-test', result.suites[0].name) | ||
| 209 | 215 | ||
| 210 | def test_prefix_mixed_kernel_output(self): | 216 | def test_prefix_mixed_kernel_output(self): |
| 211 | mixed_prefix_log = get_absolute_path( | 217 | mixed_prefix_log = get_absolute_path( |
| 212 | 'test_data/test_interrupted_tap_output.log') | 218 | 'test_data/test_interrupted_tap_output.log') |
| 213 | with open(mixed_prefix_log) as file: | 219 | with open(mixed_prefix_log) as file: |
| 214 | result = kunit_parser.parse_run_tests(file.readlines()) | 220 | result = kunit_parser.parse_run_tests(file.readlines()) |
| 215 | self.assertEqual('kunit-resource-test', result.suites[0].name) | 221 | self.assertEqual( |
| 222 | kunit_parser.TestStatus.SUCCESS, | ||
| 223 | result.status) | ||
| 224 | self.assertEqual('kunit-resource-test', result.suites[0].name) | ||
| 216 | 225 | ||
| 217 | def test_prefix_poundsign(self): | 226 | def test_prefix_poundsign(self): |
| 218 | pound_log = get_absolute_path('test_data/test_pound_sign.log') | 227 | pound_log = get_absolute_path('test_data/test_pound_sign.log') |
| 219 | with open(pound_log) as file: | 228 | with open(pound_log) as file: |
| 220 | result = kunit_parser.parse_run_tests(file.readlines()) | 229 | result = kunit_parser.parse_run_tests(file.readlines()) |
| 221 | self.assertEqual('kunit-resource-test', result.suites[0].name) | 230 | self.assertEqual( |
| 231 | kunit_parser.TestStatus.SUCCESS, | ||
| 232 | result.status) | ||
| 233 | self.assertEqual('kunit-resource-test', result.suites[0].name) | ||
| 222 | 234 | ||
| 223 | def test_kernel_panic_end(self): | 235 | def test_kernel_panic_end(self): |
| 224 | panic_log = get_absolute_path('test_data/test_kernel_panic_interrupt.log') | 236 | panic_log = get_absolute_path('test_data/test_kernel_panic_interrupt.log') |
| 225 | with open(panic_log) as file: | 237 | with open(panic_log) as file: |
| 226 | result = kunit_parser.parse_run_tests(file.readlines()) | 238 | result = kunit_parser.parse_run_tests(file.readlines()) |
| 227 | self.assertEqual('kunit-resource-test', result.suites[0].name) | 239 | self.assertEqual( |
| 240 | kunit_parser.TestStatus.TEST_CRASHED, | ||
| 241 | result.status) | ||
| 242 | self.assertEqual('kunit-resource-test', result.suites[0].name) | ||
| 228 | 243 | ||
| 229 | def test_pound_no_prefix(self): | 244 | def test_pound_no_prefix(self): |
| 230 | pound_log = get_absolute_path('test_data/test_pound_no_prefix.log') | 245 | pound_log = get_absolute_path('test_data/test_pound_no_prefix.log') |
| 231 | with open(pound_log) as file: | 246 | with open(pound_log) as file: |
| 232 | result = kunit_parser.parse_run_tests(file.readlines()) | 247 | result = kunit_parser.parse_run_tests(file.readlines()) |
| 233 | self.assertEqual('kunit-resource-test', result.suites[0].name) | 248 | self.assertEqual( |
| 249 | kunit_parser.TestStatus.SUCCESS, | ||
| 250 | result.status) | ||
| 251 | self.assertEqual('kunit-resource-test', result.suites[0].name) | ||
| 234 | 252 | ||
| 235 | class KUnitJsonTest(unittest.TestCase): | 253 | class KUnitJsonTest(unittest.TestCase): |
| 236 | 254 | ||
| @@ -1,6 +1,7 @@ | |||
| 1 | [ 0.060000] printk: console [mc-1] enabled | 1 | [ 0.060000] printk: console [mc-1] enabled |
| 2 | [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 | 2 | [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 |
| 3 | [ 0.060000] TAP version 14 | 3 | [ 0.060000] TAP version 14 |
| 4 | [ 0.060000] 1..3 | ||
| 4 | [ 0.060000] # Subtest: kunit-resource-test | 5 | [ 0.060000] # Subtest: kunit-resource-test |
| 5 | [ 0.060000] 1..5 | 6 | [ 0.060000] 1..5 |
| 6 | [ 0.060000] ok 1 - kunit_resource_test_init_resources | 7 | [ 0.060000] ok 1 - kunit_resource_test_init_resources |
| @@ -28,4 +29,4 @@ · 21 unmodified lines | |||
| 28 | [ 0.060000] Stack: | 29 | [ 0.060000] Stack: |
| 29 | [ 0.060000] 602086f8 601bc260 705c0000 705c0000 | 30 | [ 0.060000] 602086f8 601bc260 705c0000 705c0000 |
| 30 | [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab | 31 | [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab |
| 31 | [ 0.060000] 6005fcec 601bc260 705c0000 3000000010 | 32 | [ 0.060000] 6005fcec 601bc260 705c0000 3000000010 |
| @@ -1,6 +1,7 @@ | |||
| 1 | [ 0.060000] printk: console [mc-1] enabled | 1 | [ 0.060000] printk: console [mc-1] enabled |
| 2 | [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 | 2 | [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 |
| 3 | [ 0.060000] TAP version 14 | 3 | [ 0.060000] TAP version 14 |
| 4 | [ 0.060000] 1..3 | ||
| 4 | [ 0.060000] # Subtest: kunit-resource-test | 5 | [ 0.060000] # Subtest: kunit-resource-test |
| 5 | [ 0.060000] 1..5 | 6 | [ 0.060000] 1..5 |
| 6 | [ 0.060000] ok 1 - kunit_resource_test_init_resources | 7 | [ 0.060000] ok 1 - kunit_resource_test_init_resources |
| @@ -34,4 +35,4 @@ · 27 unmodified lines | |||
| 34 | [ 0.060000] Stack: | 35 | [ 0.060000] Stack: |
| 35 | [ 0.060000] 602086f8 601bc260 705c0000 705c0000 | 36 | [ 0.060000] 602086f8 601bc260 705c0000 705c0000 |
| 36 | [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab | 37 | [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab |
| 37 | [ 0.060000] 6005fcec 601bc260 705c0000 3000000010 | 38 | [ 0.060000] 6005fcec 601bc260 705c0000 3000000010 |
| @@ -1,6 +1,7 @@ | |||
| 1 | [ 0.060000] printk: console [mc-1] enabled | 1 | [ 0.060000] printk: console [mc-1] enabled |
| 2 | [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 | 2 | [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 |
| 3 | [ 0.060000] TAP version 14 | 3 | [ 0.060000] TAP version 14 |
| 4 | [ 0.060000] 1..3 | ||
| 4 | [ 0.060000] # Subtest: kunit-resource-test | 5 | [ 0.060000] # Subtest: kunit-resource-test |
| 5 | [ 0.060000] 1..5 | 6 | [ 0.060000] 1..5 |
| 6 | [ 0.060000] ok 1 - kunit_resource_test_init_resources | 7 | [ 0.060000] ok 1 - kunit_resource_test_init_resources |
| @@ -22,4 +23,4 @@ · 15 unmodified lines | |||
| 22 | [ 0.060000] Stack: | 23 | [ 0.060000] Stack: |
| 23 | [ 0.060000] 602086f8 601bc260 705c0000 705c0000 | 24 | [ 0.060000] 602086f8 601bc260 705c0000 705c0000 |
| 24 | [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab | 25 | [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab |
| 25 | [ 0.060000] 6005fcec 601bc260 705c0000 3000000010 | 26 | [ 0.060000] 6005fcec 601bc260 705c0000 3000000010 |
| @@ -1,6 +1,7 @@ | |||
| 1 | [ 0.060000][ T1] printk: console [mc-1] enabled | 1 | [ 0.060000][ T1] printk: console [mc-1] enabled |
| 2 | [ 0.060000][ T1] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 | 2 | [ 0.060000][ T1] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 |
| 3 | [ 0.060000][ T1] TAP version 14 | 3 | [ 0.060000][ T1] TAP version 14 |
| 4 | [ 0.060000][ T1] 1..3 | ||
| 4 | [ 0.060000][ T1] # Subtest: kunit-resource-test | 5 | [ 0.060000][ T1] # Subtest: kunit-resource-test |
| 5 | [ 0.060000][ T1] 1..5 | 6 | [ 0.060000][ T1] 1..5 |
| 6 | [ 0.060000][ T1] ok 1 - kunit_resource_test_init_resources | 7 | [ 0.060000][ T1] ok 1 - kunit_resource_test_init_resources |
| @@ -28,4 +29,4 @@ · 21 unmodified lines | |||
| 28 | [ 0.060000][ T1] Stack: | 29 | [ 0.060000][ T1] Stack: |
| 29 | [ 0.060000][ T1] 602086f8 601bc260 705c0000 705c0000 | 30 | [ 0.060000][ T1] 602086f8 601bc260 705c0000 705c0000 |
| 30 | [ 0.060000][ T1] 602086f8 6005fcec 705c0000 6002c6ab | 31 | [ 0.060000][ T1] 602086f8 6005fcec 705c0000 6002c6ab |
| 31 | [ 0.060000][ T1] 6005fcec 601bc260 705c0000 3000000010 | 32 | [ 0.060000][ T1] 6005fcec 601bc260 705c0000 3000000010 |
| @@ -1,6 +1,7 @@ | |||
| 1 | printk: console [mc-1] enabled | 1 | printk: console [mc-1] enabled |
| 2 | random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 | 2 | random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 |
| 3 | TAP version 14 | 3 | TAP version 14 |
| 4 | 1..3 | ||
| 4 | # Subtest: kunit-resource-test | 5 | # Subtest: kunit-resource-test |
| 5 | 1..5 | 6 | 1..5 |
| 6 | ok 1 - kunit_resource_test_init_resources | 7 | ok 1 - kunit_resource_test_init_resources |
| @@ -30,4 +31,4 @@ · 23 unmodified lines | |||
| 30 | Stack: | 31 | Stack: |
| 31 | 602086f8 601bc260 705c0000 705c0000 | 32 | 602086f8 601bc260 705c0000 705c0000 |
| 32 | 602086f8 6005fcec 705c0000 6002c6ab | 33 | 602086f8 6005fcec 705c0000 6002c6ab |
| 33 | 6005fcec 601bc260 705c0000 3000000010 | 34 | 6005fcec 601bc260 705c0000 3000000010 |
| @@ -1,6 +1,7 @@ | |||
| 1 | [ 0.060000] printk: console [mc-1] enabled | 1 | [ 0.060000] printk: console [mc-1] enabled |
| 2 | [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 | 2 | [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0 |
| 3 | [ 0.060000] TAP version 14 | 3 | [ 0.060000] TAP version 14 |
| 4 | [ 0.060000] 1..3 | ||
| 4 | [ 0.060000] # Subtest: kunit-resource-test | 5 | [ 0.060000] # Subtest: kunit-resource-test |
| 5 | [ 0.060000] 1..5 | 6 | [ 0.060000] 1..5 |
| 6 | [ 0.060000] ok 1 - kunit_resource_test_init_resources | 7 | [ 0.060000] ok 1 - kunit_resource_test_init_resources |
| @@ -145,7 +145,7 @@ TEST(clone3_cap_checkpoint_restore) · 144 unmodified lines | |||
| 145 | test_clone3_supported(); | 145 | test_clone3_supported(); |
| 146 | 146 | ||
| 147 | EXPECT_EQ(getuid(), 0) | 147 | EXPECT_EQ(getuid(), 0) |
| 148 | XFAIL(return, "Skipping all tests as non-root\n"); | 148 | SKIP(return, "Skipping all tests as non-root"); |
| 149 | 149 | ||
| 150 | memset(&set_tid, 0, sizeof(set_tid)); | 150 | memset(&set_tid, 0, sizeof(set_tid)); |
| 151 | 151 | ||
| @@ -44,7 +44,7 @@ TEST(close_range) · 43 unmodified lines | |||
| 44 | fd = open("/dev/null", O_RDONLY | O_CLOEXEC); | 44 | fd = open("/dev/null", O_RDONLY | O_CLOEXEC); |
| 45 | ASSERT_GE(fd, 0) { | 45 | ASSERT_GE(fd, 0) { |
| 46 | if (errno == ENOENT) | 46 | if (errno == ENOENT) |
| 47 | XFAIL(return, "Skipping test since /dev/null does not exist"); | 47 | SKIP(return, "Skipping test since /dev/null does not exist"); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | open_fds[i] = fd; | 50 | open_fds[i] = fd; |
| @@ -52,7 +52,7 @@ TEST(close_range) · 1 unmodified line | |||
| 52 | 52 | ||
| 53 | EXPECT_EQ(-1, sys_close_range(open_fds[0], open_fds[100], -1)) { | 53 | EXPECT_EQ(-1, sys_close_range(open_fds[0], open_fds[100], -1)) { |
| 54 | if (errno == ENOSYS) | 54 | if (errno == ENOSYS) |
| 55 | XFAIL(return, "close_range() syscall not supported"); | 55 | SKIP(return, "close_range() syscall not supported"); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | EXPECT_EQ(0, sys_close_range(open_fds[0], open_fds[50], 0)); | 58 | EXPECT_EQ(0, sys_close_range(open_fds[0], open_fds[50], 0)); |
| @@ -108,7 +108,7 @@ TEST(close_range_unshare) · 49 unmodified lines | |||
| 108 | fd = open("/dev/null", O_RDONLY | O_CLOEXEC); | 108 | fd = open("/dev/null", O_RDONLY | O_CLOEXEC); |
| 109 | ASSERT_GE(fd, 0) { | 109 | ASSERT_GE(fd, 0) { |
| 110 | if (errno == ENOENT) | 110 | if (errno == ENOENT) |
| 111 | XFAIL(return, "Skipping test since /dev/null does not exist"); | 111 | SKIP(return, "Skipping test since /dev/null does not exist"); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | open_fds[i] = fd; | 114 | open_fds[i] = fd; |
| @@ -197,7 +197,7 @@ TEST(close_range_unshare_capped) · 82 unmodified lines | |||
| 197 | fd = open("/dev/null", O_RDONLY | O_CLOEXEC); | 197 | fd = open("/dev/null", O_RDONLY | O_CLOEXEC); |
| 198 | ASSERT_GE(fd, 0) { | 198 | ASSERT_GE(fd, 0) { |
| 199 | if (errno == ENOENT) | 199 | if (errno == ENOENT) |
| 200 | XFAIL(return, "Skipping test since /dev/null does not exist"); | 200 | SKIP(return, "Skipping test since /dev/null does not exist"); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | open_fds[i] = fd; | 203 | open_fds[i] = fd; |
| @@ -74,7 +74,7 @@ static int __do_binderfs_test(struct __test_metadata *_metadata) · 73 unmodified lines | |||
| 74 | ret = mount(NULL, binderfs_mntpt, "binder", 0, 0); | 74 | ret = mount(NULL, binderfs_mntpt, "binder", 0, 0); |
| 75 | EXPECT_EQ(ret, 0) { | 75 | EXPECT_EQ(ret, 0) { |
| 76 | if (errno == ENODEV) | 76 | if (errno == ENODEV) |
| 77 | XFAIL(goto out, "binderfs missing"); | 77 | SKIP(goto out, "binderfs missing"); |
| 78 | TH_LOG("%s - Failed to mount binderfs", strerror(errno)); | 78 | TH_LOG("%s - Failed to mount binderfs", strerror(errno)); |
| 79 | goto rmdir; | 79 | goto rmdir; |
| 80 | } | 80 | } |
| @@ -475,10 +475,10 @@ TEST(binderfs_stress) · 394 unmodified lines | |||
| 475 | TEST(binderfs_test_privileged) | 475 | TEST(binderfs_test_privileged) |
| 476 | { | 476 | { |
| 477 | if (geteuid() != 0) | 477 | if (geteuid() != 0) |
| 478 | XFAIL(return, "Tests are not run as root. Skipping privileged tests"); | 478 | SKIP(return, "Tests are not run as root. Skipping privileged tests"); |
| 479 | 479 | ||
| 480 | if (__do_binderfs_test(_metadata)) | 480 | if (__do_binderfs_test(_metadata)) |
| 481 | XFAIL(return, "The Android binderfs filesystem is not available"); | 481 | SKIP(return, "The Android binderfs filesystem is not available"); |
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | TEST(binderfs_test_unprivileged) | 484 | TEST(binderfs_test_unprivileged) |
| @@ -511,7 +511,7 @@ TEST(binderfs_test_unprivileged) · 26 unmodified lines | |||
| 511 | ret = wait_for_pid(pid); | 511 | ret = wait_for_pid(pid); |
| 512 | if (ret) { | 512 | if (ret) { |
| 513 | if (ret == 2) | 513 | if (ret == 2) |
| 514 | XFAIL(return, "The Android binderfs filesystem is not available"); | 514 | SKIP(return, "The Android binderfs filesystem is not available"); |
| 515 | ASSERT_EQ(ret, 0) { | 515 | ASSERT_EQ(ret, 0) { |
| 516 | TH_LOG("wait_for_pid() failed"); | 516 | TH_LOG("wait_for_pid() failed"); |
| 517 | } | 517 | } |
| @@ -3282,4 +3282,99 @@ TEST(epoll60) · 3281 unmodified lines | |||
| 3282 | close(ctx.epfd); | 3282 | close(ctx.epfd); |
| 3283 | } | 3283 | } |
| 3284 | 3284 | ||
| 3285 | struct epoll61_ctx { | ||
| 3286 | int epfd; | ||
| 3287 | int evfd; | ||
| 3288 | }; | ||
| 3289 | |||
| 3290 | static void *epoll61_write_eventfd(void *ctx_) | ||
| 3291 | { | ||
| 3292 | struct epoll61_ctx *ctx = ctx_; | ||
| 3293 | int64_t l = 1; | ||
| 3294 | |||
| 3295 | usleep(10950); | ||
| 3296 | write(ctx->evfd, &l, sizeof(l)); | ||
| 3297 | return NULL; | ||
| 3298 | } | ||
| 3299 | |||
| 3300 | static void *epoll61_epoll_with_timeout(void *ctx_) | ||
| 3301 | { | ||
| 3302 | struct epoll61_ctx *ctx = ctx_; | ||
| 3303 | struct epoll_event events[1]; | ||
| 3304 | int n; | ||
| 3305 | |||
| 3306 | n = epoll_wait(ctx->epfd, events, 1, 11); | ||
| 3307 | /* | ||
| 3308 | * If epoll returned the eventfd, write on the eventfd to wake up the | ||
| 3309 | * blocking poller. | ||
| 3310 | */ | ||
| 3311 | if (n == 1) { | ||
| 3312 | int64_t l = 1; | ||
| 3313 | |||
| 3314 | write(ctx->evfd, &l, sizeof(l)); | ||
| 3315 | } | ||
| 3316 | return NULL; | ||
| 3317 | } | ||
| 3318 | |||
| 3319 | static void *epoll61_blocking_epoll(void *ctx_) | ||
| 3320 | { | ||
| 3321 | struct epoll61_ctx *ctx = ctx_; | ||
| 3322 | struct epoll_event events[1]; | ||
| 3323 | |||
| 3324 | epoll_wait(ctx->epfd, events, 1, -1); | ||
| 3325 | return NULL; | ||
| 3326 | } | ||
| 3327 | |||
| 3328 | TEST(epoll61) | ||
| 3329 | { | ||
| 3330 | struct epoll61_ctx ctx; | ||
| 3331 | struct epoll_event ev; | ||
| 3332 | int i, r; | ||
| 3333 | |||
| 3334 | ctx.epfd = epoll_create1(0); | ||
| 3335 | ASSERT_GE(ctx.epfd, 0); | ||
| 3336 | ctx.evfd = eventfd(0, EFD_NONBLOCK); | ||
| 3337 | ASSERT_GE(ctx.evfd, 0); | ||
| 3338 | |||
| 3339 | ev.events = EPOLLIN | EPOLLET | EPOLLERR | EPOLLHUP; | ||
| 3340 | ev.data.ptr = NULL; | ||
| 3341 | r = epoll_ctl(ctx.epfd, EPOLL_CTL_ADD, ctx.evfd, &ev); | ||
| 3342 | ASSERT_EQ(r, 0); | ||
| 3343 | |||
| 3344 | /* | ||
| 3345 | * We are testing a race. Repeat the test case 1000 times to make it | ||
| 3346 | * more likely to fail in case of a bug. | ||
| 3347 | */ | ||
| 3348 | for (i = 0; i < 1000; i++) { | ||
| 3349 | pthread_t threads[3]; | ||
| 3350 | int n; | ||
| 3351 | |||
| 3352 | /* | ||
| 3353 | * Start 3 threads: | ||
| 3354 | * Thread 1 sleeps for 10.9ms and writes to the evenfd. | ||
| 3355 | * Thread 2 calls epoll with a timeout of 11ms. | ||
| 3356 | * Thread 3 calls epoll with a timeout of -1. | ||
| 3357 | * | ||
| 3358 | * The eventfd write by Thread 1 should either wakeup Thread 2 | ||
| 3359 | * or Thread 3. If it wakes up Thread 2, Thread 2 writes on the | ||
| 3360 | * eventfd to wake up Thread 3. | ||
| 3361 | * | ||
| 3362 | * If no events are missed, all three threads should eventually | ||
| 3363 | * be joinable. | ||
| 3364 | */ | ||
| 3365 | ASSERT_EQ(pthread_create(&threads[0], NULL, | ||
| 3366 | epoll61_write_eventfd, &ctx), 0); | ||
| 3367 | ASSERT_EQ(pthread_create(&threads[1], NULL, | ||
| 3368 | epoll61_epoll_with_timeout, &ctx), 0); | ||
| 3369 | ASSERT_EQ(pthread_create(&threads[2], NULL, | ||
| 3370 | epoll61_blocking_epoll, &ctx), 0); | ||
| 3371 | |||
| 3372 | for (n = 0; n < ARRAY_SIZE(threads); ++n) | ||
| 3373 | ASSERT_EQ(pthread_join(threads[n], NULL), 0); | ||
| 3374 | } | ||
| 3375 | |||
| 3376 | close(ctx.epfd); | ||
| 3377 | close(ctx.evfd); | ||
| 3378 | } | ||
| 3379 | |||
| 3285 | TEST_HARNESS_MAIN | 3380 | TEST_HARNESS_MAIN |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | echo 0 > events/enable | 6 | echo 0 > events/enable |
| 7 | echo > dynamic_events | 7 | echo > dynamic_events |
| 8 | 8 | ||
| 9 | PLACE=kernel_clone | 9 | PLACE=$FUNCTION_FORK |
| 10 | 10 | ||
| 11 | echo "p:myevent1 $PLACE" >> dynamic_events | 11 | echo "p:myevent1 $PLACE" >> dynamic_events |
| 12 | echo "r:myevent2 $PLACE" >> dynamic_events | 12 | echo "r:myevent2 $PLACE" >> dynamic_events |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | echo 0 > events/enable | 6 | echo 0 > events/enable |
| 7 | echo > dynamic_events | 7 | echo > dynamic_events |
| 8 | 8 | ||
| 9 | PLACE=kernel_clone | 9 | PLACE=$FUNCTION_FORK |
| 10 | 10 | ||
| 11 | setup_events() { | 11 | setup_events() { |
| 12 | echo "p:myevent1 $PLACE" >> dynamic_events | 12 | echo "p:myevent1 $PLACE" >> dynamic_events |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | echo 0 > events/enable | 6 | echo 0 > events/enable |
| 7 | echo > dynamic_events | 7 | echo > dynamic_events |
| 8 | 8 | ||
| 9 | PLACE=kernel_clone | 9 | PLACE=$FUNCTION_FORK |
| 10 | 10 | ||
| 11 | setup_events() { | 11 | setup_events() { |
| 12 | echo "p:myevent1 $PLACE" >> dynamic_events | 12 | echo "p:myevent1 $PLACE" >> dynamic_events |
| @@ -39,7 +39,7 @@ do_test() { · 38 unmodified lines | |||
| 39 | disable_tracing | 39 | disable_tracing |
| 40 | 40 | ||
| 41 | echo do_execve* > set_ftrace_filter | 41 | echo do_execve* > set_ftrace_filter |
| 42 | echo *do_fork >> set_ftrace_filter | 42 | echo $FUNCTION_FORK >> set_ftrace_filter |
| 43 | 43 | ||
| 44 | echo $PID > set_ftrace_notrace_pid | 44 | echo $PID > set_ftrace_notrace_pid |
| 45 | echo function > current_tracer | 45 | echo function > current_tracer |
| @@ -39,7 +39,7 @@ do_test() { · 38 unmodified lines | |||
| 39 | disable_tracing | 39 | disable_tracing |
| 40 | 40 | ||
| 41 | echo do_execve* > set_ftrace_filter | 41 | echo do_execve* > set_ftrace_filter |
| 42 | echo *do_fork >> set_ftrace_filter | 42 | echo $FUNCTION_FORK >> set_ftrace_filter |
| 43 | 43 | ||
| 44 | echo $PID > set_ftrace_pid | 44 | echo $PID > set_ftrace_pid |
| 45 | echo function > current_tracer | 45 | echo function > current_tracer |
| @@ -4,9 +4,9 @@ · 3 unmodified lines | |||
| 4 | # requires: set_ftrace_filter | 4 | # requires: set_ftrace_filter |
| 5 | # flags: instance | 5 | # flags: instance |
| 6 | 6 | ||
| 7 | echo kernel_clone:stacktrace >> set_ftrace_filter | 7 | echo $FUNCTION_FORK:stacktrace >> set_ftrace_filter |
| 8 | 8 | ||
| 9 | grep -q "kernel_clone:stacktrace:unlimited" set_ftrace_filter | 9 | grep -q "$FUNCTION_FORK:stacktrace:unlimited" set_ftrace_filter |
| 10 | 10 | ||
| 11 | (echo "forked"; sleep 1) | 11 | (echo "forked"; sleep 1) |
| 12 | 12 | ||
| @@ -133,6 +133,13 @@ yield() { · 132 unmodified lines | |||
| 133 | ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1 | 133 | ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1 |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | # The fork function in the kernel was renamed from "_do_fork" to | ||
| 137 | # "kernel_fork". As older tests should still work with older kernels | ||
| 138 | # as well as newer kernels, check which version of fork is used on this | ||
| 139 | # kernel so that the tests can use the fork function for the running kernel. | ||
| 140 | FUNCTION_FORK=`(if grep '\bkernel_clone\b' /proc/kallsyms > /dev/null; then | ||
| 141 | echo kernel_clone; else echo '_do_fork'; fi)` | ||
| 142 | |||
| 136 | # Since probe event command may include backslash, explicitly use printf "%s" | 143 | # Since probe event command may include backslash, explicitly use printf "%s" |
| 137 | # to NOT interpret it. | 144 | # to NOT interpret it. |
| 138 | ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file | 145 | ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | # description: Kprobe dynamic event - adding and removing | 3 | # description: Kprobe dynamic event - adding and removing |
| 4 | # requires: kprobe_events | 4 | # requires: kprobe_events |
| 5 | 5 | ||
| 6 | echo p:myevent kernel_clone > kprobe_events | 6 | echo p:myevent $FUNCTION_FORK > kprobe_events |
| 7 | grep myevent kprobe_events | 7 | grep myevent kprobe_events |
| 8 | test -d events/kprobes/myevent | 8 | test -d events/kprobes/myevent |
| 9 | echo > kprobe_events | 9 | echo > kprobe_events |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | # description: Kprobe dynamic event - busy event check | 3 | # description: Kprobe dynamic event - busy event check |
| 4 | # requires: kprobe_events | 4 | # requires: kprobe_events |
| 5 | 5 | ||
| 6 | echo p:myevent kernel_clone > kprobe_events | 6 | echo p:myevent $FUNCTION_FORK > kprobe_events |
| 7 | test -d events/kprobes/myevent | 7 | test -d events/kprobes/myevent |
| 8 | echo 1 > events/kprobes/myevent/enable | 8 | echo 1 > events/kprobes/myevent/enable |
| 9 | echo > kprobe_events && exit_fail # this must fail | 9 | echo > kprobe_events && exit_fail # this must fail |
| @@ -3,13 +3,13 @@ · 2 unmodified lines | |||
| 3 | # description: Kprobe dynamic event with arguments | 3 | # description: Kprobe dynamic event with arguments |
| 4 | # requires: kprobe_events | 4 | # requires: kprobe_events |
| 5 | 5 | ||
| 6 | echo 'p:testprobe kernel_clone $stack $stack0 +0($stack)' > kprobe_events | 6 | echo "p:testprobe $FUNCTION_FORK \$stack \$stack0 +0(\$stack)" > kprobe_events |
| 7 | grep testprobe kprobe_events | grep -q 'arg1=\$stack arg2=\$stack0 arg3=+0(\$stack)' | 7 | grep testprobe kprobe_events | grep -q 'arg1=\$stack arg2=\$stack0 arg3=+0(\$stack)' |
| 8 | test -d events/kprobes/testprobe | 8 | test -d events/kprobes/testprobe |
| 9 | 9 | ||
| 10 | echo 1 > events/kprobes/testprobe/enable | 10 | echo 1 > events/kprobes/testprobe/enable |
| 11 | ( echo "forked") | 11 | ( echo "forked") |
| 12 | grep testprobe trace | grep 'kernel_clone' | \ | 12 | grep testprobe trace | grep "$FUNCTION_FORK" | \ |
| 13 | grep -q 'arg1=0x[[:xdigit:]]* arg2=0x[[:xdigit:]]* arg3=0x[[:xdigit:]]*$' | 13 | grep -q 'arg1=0x[[:xdigit:]]* arg2=0x[[:xdigit:]]* arg3=0x[[:xdigit:]]*$' |
| 14 | 14 | ||
| 15 | echo 0 > events/kprobes/testprobe/enable | 15 | echo 0 > events/kprobes/testprobe/enable |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | grep -A1 "fetcharg:" README | grep -q "\$comm" || exit_unsupported # this is too old | 6 | grep -A1 "fetcharg:" README | grep -q "\$comm" || exit_unsupported # this is too old |
| 7 | 7 | ||
| 8 | echo 'p:testprobe kernel_clone comm=$comm ' > kprobe_events | 8 | echo "p:testprobe $FUNCTION_FORK comm=\$comm " > kprobe_events |
| 9 | grep testprobe kprobe_events | grep -q 'comm=$comm' | 9 | grep testprobe kprobe_events | grep -q 'comm=$comm' |
| 10 | test -d events/kprobes/testprobe | 10 | test -d events/kprobes/testprobe |
| 11 | 11 | ||
| @@ -30,13 +30,13 @@ esac · 29 unmodified lines | |||
| 30 | : "Test get argument (1)" | 30 | : "Test get argument (1)" |
| 31 | echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events | 31 | echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events |
| 32 | echo 1 > events/kprobes/testprobe/enable | 32 | echo 1 > events/kprobes/testprobe/enable |
| 33 | echo "p:test kernel_clone" >> kprobe_events | 33 | echo "p:test $FUNCTION_FORK" >> kprobe_events |
| 34 | grep -qe "testprobe.* arg1=\"test\"" trace | 34 | grep -qe "testprobe.* arg1=\"test\"" trace |
| 35 | 35 | ||
| 36 | echo 0 > events/kprobes/testprobe/enable | 36 | echo 0 > events/kprobes/testprobe/enable |
| 37 | : "Test get argument (2)" | 37 | : "Test get argument (2)" |
| 38 | echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events | 38 | echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events |
| 39 | echo 1 > events/kprobes/testprobe/enable | 39 | echo 1 > events/kprobes/testprobe/enable |
| 40 | echo "p:test kernel_clone" >> kprobe_events | 40 | echo "p:test $FUNCTION_FORK" >> kprobe_events |
| 41 | grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace | 41 | grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace |
| 42 | 42 | ||
| @@ -14,12 +14,12 @@ elif ! grep "$SYMBOL\$" /proc/kallsyms; then · 13 unmodified lines | |||
| 14 | fi | 14 | fi |
| 15 | 15 | ||
| 16 | : "Test get basic types symbol argument" | 16 | : "Test get basic types symbol argument" |
| 17 | echo "p:testprobe_u kernel_clone arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events | 17 | echo "p:testprobe_u $FUNCTION_FORK arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events |
| 18 | echo "p:testprobe_s kernel_clone arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events | 18 | echo "p:testprobe_s $FUNCTION_FORK arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events |
| 19 | if grep -q "x8/16/32/64" README; then | 19 | if grep -q "x8/16/32/64" README; then |
| 20 | echo "p:testprobe_x kernel_clone arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events | 20 | echo "p:testprobe_x $FUNCTION_FORK arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events |
| 21 | fi | 21 | fi |
| 22 | echo "p:testprobe_bf kernel_clone arg1=@linux_proc_banner:b8@4/32" >> kprobe_events | 22 | echo "p:testprobe_bf $FUNCTION_FORK arg1=@linux_proc_banner:b8@4/32" >> kprobe_events |
| 23 | echo 1 > events/kprobes/enable | 23 | echo 1 > events/kprobes/enable |
| 24 | (echo "forked") | 24 | (echo "forked") |
| 25 | echo 0 > events/kprobes/enable | 25 | echo 0 > events/kprobes/enable |
| @@ -27,7 +27,7 @@ grep "testprobe_[usx]:.* arg1=.* arg2=.* arg3=.* arg4=.*" trace · 1 unmodified line | |||
| 27 | grep "testprobe_bf:.* arg1=.*" trace | 27 | grep "testprobe_bf:.* arg1=.*" trace |
| 28 | 28 | ||
| 29 | : "Test get string symbol argument" | 29 | : "Test get string symbol argument" |
| 30 | echo "p:testprobe_str kernel_clone arg1=@linux_proc_banner:string" > kprobe_events | 30 | echo "p:testprobe_str $FUNCTION_FORK arg1=@linux_proc_banner:string" > kprobe_events |
| 31 | echo 1 > events/kprobes/enable | 31 | echo 1 > events/kprobes/enable |
| 32 | (echo "forked") | 32 | (echo "forked") |
| 33 | echo 0 > events/kprobes/enable | 33 | echo 0 > events/kprobes/enable |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | # requires: kprobe_events "x8/16/32/64":README | 4 | # requires: kprobe_events "x8/16/32/64":README |
| 5 | 5 | ||
| 6 | gen_event() { # Bitsize | 6 | gen_event() { # Bitsize |
| 7 | echo "p:testprobe kernel_clone \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1" | 7 | echo "p:testprobe $FUNCTION_FORK \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1" |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | check_types() { # s-type u-type x-type bf-type width | 10 | check_types() { # s-type u-type x-type bf-type width |
| @@ -9,12 +9,16 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported · 8 unmodified lines | |||
| 9 | :;: "user-memory access syntax and ustring working on user memory";: | 9 | :;: "user-memory access syntax and ustring working on user memory";: |
| 10 | echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \ | 10 | echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \ |
| 11 | > kprobe_events | 11 | > kprobe_events |
| 12 | echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \ | ||
| 13 | >> kprobe_events | ||
| 12 | 14 | ||
| 13 | grep myevent kprobe_events | \ | 15 | grep myevent kprobe_events | \ |
| 14 | grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string' | 16 | grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string' |
| 15 | echo 1 > events/kprobes/myevent/enable | 17 | echo 1 > events/kprobes/myevent/enable |
| 18 | echo 1 > events/kprobes/myevent2/enable | ||
| 16 | echo > /dev/null | 19 | echo > /dev/null |
| 17 | echo 0 > events/kprobes/myevent/enable | 20 | echo 0 > events/kprobes/myevent/enable |
| 21 | echo 0 > events/kprobes/myevent2/enable | ||
| 18 | 22 | ||
| 19 | grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"' | 23 | grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"' |
| 20 | 24 | ||
| @@ -5,29 +5,29 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | # prepare | 6 | # prepare |
| 7 | echo nop > current_tracer | 7 | echo nop > current_tracer |
| 8 | echo kernel_clone > set_ftrace_filter | 8 | echo $FUNCTION_FORK > set_ftrace_filter |
| 9 | echo 'p:testprobe kernel_clone' > kprobe_events | 9 | echo "p:testprobe $FUNCTION_FORK" > kprobe_events |
| 10 | 10 | ||
| 11 | # kprobe on / ftrace off | 11 | # kprobe on / ftrace off |
| 12 | echo 1 > events/kprobes/testprobe/enable | 12 | echo 1 > events/kprobes/testprobe/enable |
| 13 | echo > trace | 13 | echo > trace |
| 14 | ( echo "forked") | 14 | ( echo "forked") |
| 15 | grep testprobe trace | 15 | grep testprobe trace |
| 16 | ! grep 'kernel_clone <-' trace | 16 | ! grep "$FUNCTION_FORK <-" trace |
| 17 | 17 | ||
| 18 | # kprobe on / ftrace on | 18 | # kprobe on / ftrace on |
| 19 | echo function > current_tracer | 19 | echo function > current_tracer |
| 20 | echo > trace | 20 | echo > trace |
| 21 | ( echo "forked") | 21 | ( echo "forked") |
| 22 | grep testprobe trace | 22 | grep testprobe trace |
| 23 | grep 'kernel_clone <-' trace | 23 | grep "$FUNCTION_FORK <-" trace |
| 24 | 24 | ||
| 25 | # kprobe off / ftrace on | 25 | # kprobe off / ftrace on |
| 26 | echo 0 > events/kprobes/testprobe/enable | 26 | echo 0 > events/kprobes/testprobe/enable |
| 27 | echo > trace | 27 | echo > trace |
| 28 | ( echo "forked") | 28 | ( echo "forked") |
| 29 | ! grep testprobe trace | 29 | ! grep testprobe trace |
| 30 | grep 'kernel_clone <-' trace | 30 | grep "$FUNCTION_FORK <-" trace |
| 31 | 31 | ||
| 32 | # kprobe on / ftrace on | 32 | # kprobe on / ftrace on |
| 33 | echo 1 > events/kprobes/testprobe/enable | 33 | echo 1 > events/kprobes/testprobe/enable |
| @@ -35,11 +35,11 @@ echo function > current_tracer · 1 unmodified line | |||
| 35 | echo > trace | 35 | echo > trace |
| 36 | ( echo "forked") | 36 | ( echo "forked") |
| 37 | grep testprobe trace | 37 | grep testprobe trace |
| 38 | grep 'kernel_clone <-' trace | 38 | grep "$FUNCTION_FORK <-" trace |
| 39 | 39 | ||
| 40 | # kprobe on / ftrace off | 40 | # kprobe on / ftrace off |
| 41 | echo nop > current_tracer | 41 | echo nop > current_tracer |
| 42 | echo > trace | 42 | echo > trace |
| 43 | ( echo "forked") | 43 | ( echo "forked") |
| 44 | grep testprobe trace | 44 | grep testprobe trace |
| 45 | ! grep 'kernel_clone <-' trace | 45 | ! grep "$FUNCTION_FORK <-" trace |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | # requires: kprobe_events "Create/append/":README | 4 | # requires: kprobe_events "Create/append/":README |
| 5 | 5 | ||
| 6 | # Choose 2 symbols for target | 6 | # Choose 2 symbols for target |
| 7 | SYM1=kernel_clone | 7 | SYM1=$FUNCTION_FORK |
| 8 | SYM2=do_exit | 8 | SYM2=do_exit |
| 9 | EVENT_NAME=kprobes/testevent | 9 | EVENT_NAME=kprobes/testevent |
| 10 | 10 | ||
| @@ -86,15 +86,15 @@ esac · 85 unmodified lines | |||
| 86 | 86 | ||
| 87 | # multiprobe errors | 87 | # multiprobe errors |
| 88 | if grep -q "Create/append/" README && grep -q "imm-value" README; then | 88 | if grep -q "Create/append/" README && grep -q "imm-value" README; then |
| 89 | echo 'p:kprobes/testevent kernel_clone' > kprobe_events | 89 | echo "p:kprobes/testevent $FUNCTION_FORK" > kprobe_events |
| 90 | check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE | 90 | check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE |
| 91 | 91 | ||
| 92 | # Explicitly use printf "%s" to not interpret \1 | 92 | # Explicitly use printf "%s" to not interpret \1 |
| 93 | printf "%s" 'p:kprobes/testevent kernel_clone abcd=\1' > kprobe_events | 93 | printf "%s" "p:kprobes/testevent $FUNCTION_FORK abcd=\\1" > kprobe_events |
| 94 | check_error 'p:kprobes/testevent kernel_clone ^bcd=\1' # DIFF_ARG_TYPE | 94 | check_error "p:kprobes/testevent $FUNCTION_FORK ^bcd=\\1" # DIFF_ARG_TYPE |
| 95 | check_error 'p:kprobes/testevent kernel_clone ^abcd=\1:u8' # DIFF_ARG_TYPE | 95 | check_error "p:kprobes/testevent $FUNCTION_FORK ^abcd=\\1:u8" # DIFF_ARG_TYPE |
| 96 | check_error 'p:kprobes/testevent kernel_clone ^abcd=\"foo"' # DIFF_ARG_TYPE | 96 | check_error "p:kprobes/testevent $FUNCTION_FORK ^abcd=\\\"foo\"" # DIFF_ARG_TYPE |
| 97 | check_error '^p:kprobes/testevent kernel_clone abcd=\1' # SAME_PROBE | 97 | check_error "^p:kprobes/testevent $FUNCTION_FORK abcd=\\1" # SAME_PROBE |
| 98 | fi | 98 | fi |
| 99 | 99 | ||
| 100 | # %return suffix errors | 100 | # %return suffix errors |
| @@ -4,14 +4,14 @@ · 3 unmodified lines | |||
| 4 | # requires: kprobe_events | 4 | # requires: kprobe_events |
| 5 | 5 | ||
| 6 | # Add new kretprobe event | 6 | # Add new kretprobe event |
| 7 | echo 'r:testprobe2 kernel_clone $retval' > kprobe_events | 7 | echo "r:testprobe2 $FUNCTION_FORK \$retval" > kprobe_events |
| 8 | grep testprobe2 kprobe_events | grep -q 'arg1=\$retval' | 8 | grep testprobe2 kprobe_events | grep -q 'arg1=\$retval' |
| 9 | test -d events/kprobes/testprobe2 | 9 | test -d events/kprobes/testprobe2 |
| 10 | 10 | ||
| 11 | echo 1 > events/kprobes/testprobe2/enable | 11 | echo 1 > events/kprobes/testprobe2/enable |
| 12 | ( echo "forked") | 12 | ( echo "forked") |
| 13 | 13 | ||
| 14 | cat trace | grep testprobe2 | grep -q '<- kernel_clone' | 14 | cat trace | grep testprobe2 | grep -q "<- $FUNCTION_FORK" |
| 15 | 15 | ||
| 16 | echo 0 > events/kprobes/testprobe2/enable | 16 | echo 0 > events/kprobes/testprobe2/enable |
| 17 | echo '-:testprobe2' >> kprobe_events | 17 | echo '-:testprobe2' >> kprobe_events |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | # requires: kprobe_events | 4 | # requires: kprobe_events |
| 5 | 5 | ||
| 6 | ! grep -q 'myevent' kprobe_profile | 6 | ! grep -q 'myevent' kprobe_profile |
| 7 | echo p:myevent kernel_clone > kprobe_events | 7 | echo "p:myevent $FUNCTION_FORK" > kprobe_events |
| 8 | grep -q 'myevent[[:space:]]*0[[:space:]]*0$' kprobe_profile | 8 | grep -q 'myevent[[:space:]]*0[[:space:]]*0$' kprobe_profile |
| 9 | echo 1 > events/kprobes/myevent/enable | 9 | echo 1 > events/kprobes/myevent/enable |
| 10 | ( echo "forked" ) | 10 | ( echo "forked" ) |
| @@ -126,7 +126,7 @@ · 125 unmodified lines | |||
| 126 | snprintf(_metadata->results->reason, \ | 126 | snprintf(_metadata->results->reason, \ |
| 127 | sizeof(_metadata->results->reason), fmt, ##__VA_ARGS__); \ | 127 | sizeof(_metadata->results->reason), fmt, ##__VA_ARGS__); \ |
| 128 | if (TH_LOG_ENABLED) { \ | 128 | if (TH_LOG_ENABLED) { \ |
| 129 | fprintf(TH_LOG_STREAM, "# SKIP %s\n", \ | 129 | fprintf(TH_LOG_STREAM, "# SKIP %s\n", \ |
| 130 | _metadata->results->reason); \ | 130 | _metadata->results->reason); \ |
| 131 | } \ | 131 | } \ |
| 132 | _metadata->passed = 1; \ | 132 | _metadata->passed = 1; \ |
| @@ -432,7 +432,7 @@ · 299 unmodified lines | |||
| 432 | */ | 432 | */ |
| 433 | 433 | ||
| 434 | /** | 434 | /** |
| 435 | * ASSERT_EQ(expected, seen) | 435 | * ASSERT_EQ() |
| 436 | * | 436 | * |
| 437 | * @expected: expected value | 437 | * @expected: expected value |
| 438 | * @seen: measured value | 438 | * @seen: measured value |
| @@ -443,7 +443,7 @@ · 4 unmodified lines | |||
| 443 | __EXPECT(expected, #expected, seen, #seen, ==, 1) | 443 | __EXPECT(expected, #expected, seen, #seen, ==, 1) |
| 444 | 444 | ||
| 445 | /** | 445 | /** |
| 446 | * ASSERT_NE(expected, seen) | 446 | * ASSERT_NE() |
| 447 | * | 447 | * |
| 448 | * @expected: expected value | 448 | * @expected: expected value |
| 449 | * @seen: measured value | 449 | * @seen: measured value |
| @@ -454,7 +454,7 @@ · 4 unmodified lines | |||
| 454 | __EXPECT(expected, #expected, seen, #seen, !=, 1) | 454 | __EXPECT(expected, #expected, seen, #seen, !=, 1) |
| 455 | 455 | ||
| 456 | /** | 456 | /** |
| 457 | * ASSERT_LT(expected, seen) | 457 | * ASSERT_LT() |
| 458 | * | 458 | * |
| 459 | * @expected: expected value | 459 | * @expected: expected value |
| 460 | * @seen: measured value | 460 | * @seen: measured value |
| @@ -465,7 +465,7 @@ · 4 unmodified lines | |||
| 465 | __EXPECT(expected, #expected, seen, #seen, <, 1) | 465 | __EXPECT(expected, #expected, seen, #seen, <, 1) |
| 466 | 466 | ||
| 467 | /** | 467 | /** |
| 468 | * ASSERT_LE(expected, seen) | 468 | * ASSERT_LE() |
| 469 | * | 469 | * |
| 470 | * @expected: expected value | 470 | * @expected: expected value |
| 471 | * @seen: measured value | 471 | * @seen: measured value |
| @@ -476,7 +476,7 @@ · 4 unmodified lines | |||
| 476 | __EXPECT(expected, #expected, seen, #seen, <=, 1) | 476 | __EXPECT(expected, #expected, seen, #seen, <=, 1) |
| 477 | 477 | ||
| 478 | /** | 478 | /** |
| 479 | * ASSERT_GT(expected, seen) | 479 | * ASSERT_GT() |
| 480 | * | 480 | * |
| 481 | * @expected: expected value | 481 | * @expected: expected value |
| 482 | * @seen: measured value | 482 | * @seen: measured value |
| @@ -487,7 +487,7 @@ · 4 unmodified lines | |||
| 487 | __EXPECT(expected, #expected, seen, #seen, >, 1) | 487 | __EXPECT(expected, #expected, seen, #seen, >, 1) |
| 488 | 488 | ||
| 489 | /** | 489 | /** |
| 490 | * ASSERT_GE(expected, seen) | 490 | * ASSERT_GE() |
| 491 | * | 491 | * |
| 492 | * @expected: expected value | 492 | * @expected: expected value |
| 493 | * @seen: measured value | 493 | * @seen: measured value |
| @@ -498,7 +498,7 @@ · 4 unmodified lines | |||
| 498 | __EXPECT(expected, #expected, seen, #seen, >=, 1) | 498 | __EXPECT(expected, #expected, seen, #seen, >=, 1) |
| 499 | 499 | ||
| 500 | /** | 500 | /** |
| 501 | * ASSERT_NULL(seen) | 501 | * ASSERT_NULL() |
| 502 | * | 502 | * |
| 503 | * @seen: measured value | 503 | * @seen: measured value |
| 504 | * | 504 | * |
| @@ -508,7 +508,7 @@ · 3 unmodified lines | |||
| 508 | __EXPECT(NULL, "NULL", seen, #seen, ==, 1) | 508 | __EXPECT(NULL, "NULL", seen, #seen, ==, 1) |
| 509 | 509 | ||
| 510 | /** | 510 | /** |
| 511 | * ASSERT_TRUE(seen) | 511 | * ASSERT_TRUE() |
| 512 | * | 512 | * |
| 513 | * @seen: measured value | 513 | * @seen: measured value |
| 514 | * | 514 | * |
| @@ -518,7 +518,7 @@ · 3 unmodified lines | |||
| 518 | __EXPECT(0, "0", seen, #seen, !=, 1) | 518 | __EXPECT(0, "0", seen, #seen, !=, 1) |
| 519 | 519 | ||
| 520 | /** | 520 | /** |
| 521 | * ASSERT_FALSE(seen) | 521 | * ASSERT_FALSE() |
| 522 | * | 522 | * |
| 523 | * @seen: measured value | 523 | * @seen: measured value |
| 524 | * | 524 | * |
| @@ -528,7 +528,7 @@ · 3 unmodified lines | |||
| 528 | __EXPECT(0, "0", seen, #seen, ==, 1) | 528 | __EXPECT(0, "0", seen, #seen, ==, 1) |
| 529 | 529 | ||
| 530 | /** | 530 | /** |
| 531 | * ASSERT_STREQ(expected, seen) | 531 | * ASSERT_STREQ() |
| 532 | * | 532 | * |
| 533 | * @expected: expected value | 533 | * @expected: expected value |
| 534 | * @seen: measured value | 534 | * @seen: measured value |
| @@ -539,7 +539,7 @@ · 4 unmodified lines | |||
| 539 | __EXPECT_STR(expected, seen, ==, 1) | 539 | __EXPECT_STR(expected, seen, ==, 1) |
| 540 | 540 | ||
| 541 | /** | 541 | /** |
| 542 | * ASSERT_STRNE(expected, seen) | 542 | * ASSERT_STRNE() |
| 543 | * | 543 | * |
| 544 | * @expected: expected value | 544 | * @expected: expected value |
| 545 | * @seen: measured value | 545 | * @seen: measured value |
| @@ -550,7 +550,7 @@ · 4 unmodified lines | |||
| 550 | __EXPECT_STR(expected, seen, !=, 1) | 550 | __EXPECT_STR(expected, seen, !=, 1) |
| 551 | 551 | ||
| 552 | /** | 552 | /** |
| 553 | * EXPECT_EQ(expected, seen) | 553 | * EXPECT_EQ() |
| 554 | * | 554 | * |
| 555 | * @expected: expected value | 555 | * @expected: expected value |
| 556 | * @seen: measured value | 556 | * @seen: measured value |
| @@ -561,7 +561,7 @@ · 4 unmodified lines | |||
| 561 | __EXPECT(expected, #expected, seen, #seen, ==, 0) | 561 | __EXPECT(expected, #expected, seen, #seen, ==, 0) |
| 562 | 562 | ||
| 563 | /** | 563 | /** |
| 564 | * EXPECT_NE(expected, seen) | 564 | * EXPECT_NE() |
| 565 | * | 565 | * |
| 566 | * @expected: expected value | 566 | * @expected: expected value |
| 567 | * @seen: measured value | 567 | * @seen: measured value |
| @@ -572,7 +572,7 @@ · 4 unmodified lines | |||
| 572 | __EXPECT(expected, #expected, seen, #seen, !=, 0) | 572 | __EXPECT(expected, #expected, seen, #seen, !=, 0) |
| 573 | 573 | ||
| 574 | /** | 574 | /** |
| 575 | * EXPECT_LT(expected, seen) | 575 | * EXPECT_LT() |
| 576 | * | 576 | * |
| 577 | * @expected: expected value | 577 | * @expected: expected value |
| 578 | * @seen: measured value | 578 | * @seen: measured value |
| @@ -583,7 +583,7 @@ · 4 unmodified lines | |||
| 583 | __EXPECT(expected, #expected, seen, #seen, <, 0) | 583 | __EXPECT(expected, #expected, seen, #seen, <, 0) |
| 584 | 584 | ||
| 585 | /** | 585 | /** |
| 586 | * EXPECT_LE(expected, seen) | 586 | * EXPECT_LE() |
| 587 | * | 587 | * |
| 588 | * @expected: expected value | 588 | * @expected: expected value |
| 589 | * @seen: measured value | 589 | * @seen: measured value |
| @@ -594,7 +594,7 @@ · 4 unmodified lines | |||
| 594 | __EXPECT(expected, #expected, seen, #seen, <=, 0) | 594 | __EXPECT(expected, #expected, seen, #seen, <=, 0) |
| 595 | 595 | ||
| 596 | /** | 596 | /** |
| 597 | * EXPECT_GT(expected, seen) | 597 | * EXPECT_GT() |
| 598 | * | 598 | * |
| 599 | * @expected: expected value | 599 | * @expected: expected value |
| 600 | * @seen: measured value | 600 | * @seen: measured value |
| @@ -605,7 +605,7 @@ · 4 unmodified lines | |||
| 605 | __EXPECT(expected, #expected, seen, #seen, >, 0) | 605 | __EXPECT(expected, #expected, seen, #seen, >, 0) |
| 606 | 606 | ||
| 607 | /** | 607 | /** |
| 608 | * EXPECT_GE(expected, seen) | 608 | * EXPECT_GE() |
| 609 | * | 609 | * |
| 610 | * @expected: expected value | 610 | * @expected: expected value |
| 611 | * @seen: measured value | 611 | * @seen: measured value |
| @@ -616,7 +616,7 @@ · 4 unmodified lines | |||
| 616 | __EXPECT(expected, #expected, seen, #seen, >=, 0) | 616 | __EXPECT(expected, #expected, seen, #seen, >=, 0) |
| 617 | 617 | ||
| 618 | /** | 618 | /** |
| 619 | * EXPECT_NULL(seen) | 619 | * EXPECT_NULL() |
| 620 | * | 620 | * |
| 621 | * @seen: measured value | 621 | * @seen: measured value |
| 622 | * | 622 | * |
| @@ -626,7 +626,7 @@ · 3 unmodified lines | |||
| 626 | __EXPECT(NULL, "NULL", seen, #seen, ==, 0) | 626 | __EXPECT(NULL, "NULL", seen, #seen, ==, 0) |
| 627 | 627 | ||
| 628 | /** | 628 | /** |
| 629 | * EXPECT_TRUE(seen) | 629 | * EXPECT_TRUE() |
| 630 | * | 630 | * |
| 631 | * @seen: measured value | 631 | * @seen: measured value |
| 632 | * | 632 | * |
| @@ -636,7 +636,7 @@ · 3 unmodified lines | |||
| 636 | __EXPECT(0, "0", seen, #seen, !=, 0) | 636 | __EXPECT(0, "0", seen, #seen, !=, 0) |
| 637 | 637 | ||
| 638 | /** | 638 | /** |
| 639 | * EXPECT_FALSE(seen) | 639 | * EXPECT_FALSE() |
| 640 | * | 640 | * |
| 641 | * @seen: measured value | 641 | * @seen: measured value |
| 642 | * | 642 | * |
| @@ -646,7 +646,7 @@ · 3 unmodified lines | |||
| 646 | __EXPECT(0, "0", seen, #seen, ==, 0) | 646 | __EXPECT(0, "0", seen, #seen, ==, 0) |
| 647 | 647 | ||
| 648 | /** | 648 | /** |
| 649 | * EXPECT_STREQ(expected, seen) | 649 | * EXPECT_STREQ() |
| 650 | * | 650 | * |
| 651 | * @expected: expected value | 651 | * @expected: expected value |
| 652 | * @seen: measured value | 652 | * @seen: measured value |
| @@ -657,7 +657,7 @@ · 4 unmodified lines | |||
| 657 | __EXPECT_STR(expected, seen, ==, 0) | 657 | __EXPECT_STR(expected, seen, ==, 0) |
| 658 | 658 | ||
| 659 | /** | 659 | /** |
| 660 | * EXPECT_STRNE(expected, seen) | 660 | * EXPECT_STRNE() |
| 661 | * | 661 | * |
| 662 | * @expected: expected value | 662 | * @expected: expected value |
| 663 | * @seen: measured value | 663 | * @seen: measured value |
| @@ -136,7 +136,7 @@ endif · 135 unmodified lines | |||
| 136 | ifeq ($(OVERRIDE_TARGETS),) | 136 | ifeq ($(OVERRIDE_TARGETS),) |
| 137 | LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h | 137 | LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h |
| 138 | $(OUTPUT)/%:%.c $(LOCAL_HDRS) | 138 | $(OUTPUT)/%:%.c $(LOCAL_HDRS) |
| 139 | $(LINK.c) $^ $(LDLIBS) -o $@ | 139 | $(LINK.c) $(filter-out $(LOCAL_HDRS),$^) $(LDLIBS) -o $@ |
| 140 | 140 | ||
| 141 | $(OUTPUT)/%.o:%.S | 141 | $(OUTPUT)/%.o:%.S |
| 142 | $(COMPILE.S) $^ -o $@ | 142 | $(COMPILE.S) $^ -o $@ |
| @@ -4,3 +4,4 @@ CONFIG_USER_NS=y · 3 unmodified lines | |||
| 4 | CONFIG_PID_NS=y | 4 | CONFIG_PID_NS=y |
| 5 | CONFIG_NET_NS=y | 5 | CONFIG_NET_NS=y |
| 6 | CONFIG_CGROUPS=y | 6 | CONFIG_CGROUPS=y |
| 7 | CONFIG_CHECKPOINT_RESTORE=y | ||
| @@ -204,7 +204,10 @@ TEST_F(child, fetch_fd) · 203 unmodified lines | |||
| 204 | fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); | 204 | fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0); |
| 205 | ASSERT_GE(fd, 0); | 205 | ASSERT_GE(fd, 0); |
| 206 | 206 | ||
| 207 | EXPECT_EQ(0, sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd)); | 207 | ret = sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd); |
| 208 | if (ret < 0 && errno == ENOSYS) | ||
| 209 | SKIP(return, "kcmp() syscall not supported"); | ||
| 210 | EXPECT_EQ(ret, 0); | ||
| 208 | 211 | ||
| 209 | ret = fcntl(fd, F_GETFD); | 212 | ret = fcntl(fd, F_GETFD); |
| 210 | ASSERT_GE(ret, 0); | 213 | ASSERT_GE(ret, 0); |
| @@ -6,7 +6,6 @@ · 5 unmodified lines | |||
| 6 | #include <inttypes.h> | 6 | #include <inttypes.h> |
| 7 | #include <limits.h> | 7 | #include <limits.h> |
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #include <linux/wait.h> | ||
| 10 | #include <sched.h> | 9 | #include <sched.h> |
| 11 | #include <signal.h> | 10 | #include <signal.h> |
| 12 | #include <stdbool.h> | 11 | #include <stdbool.h> |
| @@ -3,7 +3,6 @@ · 2 unmodified lines | |||
| 3 | #define _GNU_SOURCE | 3 | #define _GNU_SOURCE |
| 4 | #include <errno.h> | 4 | #include <errno.h> |
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/wait.h> | ||
| 7 | #include <poll.h> | 6 | #include <poll.h> |
| 8 | #include <signal.h> | 7 | #include <signal.h> |
| 9 | #include <stdbool.h> | 8 | #include <stdbool.h> |
| @@ -16,7 +16,6 @@ · 15 unmodified lines | |||
| 16 | #include <unistd.h> | 16 | #include <unistd.h> |
| 17 | #include <sys/socket.h> | 17 | #include <sys/socket.h> |
| 18 | #include <sys/stat.h> | 18 | #include <sys/stat.h> |
| 19 | #include <linux/kcmp.h> | ||
| 20 | 19 | ||
| 21 | #include "pidfd.h" | 20 | #include "pidfd.h" |
| 22 | #include "../clone3/clone3_selftests.h" | 21 | #include "../clone3/clone3_selftests.h" |
| @@ -330,7 +330,7 @@ static int test_pidfd_send_signal_recycled_pid_fail(void) · 329 unmodified lines | |||
| 330 | ksft_exit_fail_msg("%s test: Failed to recycle pid %d\n", | 330 | ksft_exit_fail_msg("%s test: Failed to recycle pid %d\n", |
| 331 | test_name, PID_RECYCLE); | 331 | test_name, PID_RECYCLE); |
| 332 | case PIDFD_SKIP: | 332 | case PIDFD_SKIP: |
| 333 | ksft_print_msg("%s test: Skipping test\n", test_name); | 333 | ksft_test_result_skip("%s test: Skipping test\n", test_name); |
| 334 | ret = 0; | 334 | ret = 0; |
| 335 | break; | 335 | break; |
| 336 | case PIDFD_XFAIL: | 336 | case PIDFD_XFAIL: |
| @@ -14,7 +14,6 @@ · 13 unmodified lines | |||
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ | 15 | */ |
| 16 | /* Test that /proc/loadavg correctly reports last pid in pid namespace. */ | 16 | /* Test that /proc/loadavg correctly reports last pid in pid namespace. */ |
| 17 | #define _GNU_SOURCE | ||
| 18 | #include <errno.h> | 17 | #include <errno.h> |
| 19 | #include <sched.h> | 18 | #include <sched.h> |
| 20 | #include <sys/types.h> | 19 | #include <sys/types.h> |
| @@ -13,7 +13,6 @@ · 12 unmodified lines | |||
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ | 15 | */ |
| 16 | #define _GNU_SOURCE | ||
| 17 | #include <unistd.h> | 16 | #include <unistd.h> |
| 18 | #include <sys/syscall.h> | 17 | #include <sys/syscall.h> |
| 19 | #include <sys/types.h> | 18 | #include <sys/types.h> |
| @@ -15,7 +15,6 @@ · 14 unmodified lines | |||
| 15 | */ | 15 | */ |
| 16 | // Test that values in /proc/uptime increment monotonically | 16 | // Test that values in /proc/uptime increment monotonically |
| 17 | // while shifting across CPUs. | 17 | // while shifting across CPUs. |
| 18 | #define _GNU_SOURCE | ||
| 19 | #undef NDEBUG | 18 | #undef NDEBUG |
| 20 | #include <assert.h> | 19 | #include <assert.h> |
| 21 | #include <unistd.h> | 20 | #include <unistd.h> |
| @@ -316,6 +316,14 @@ pp sleep 3 · 315 unmodified lines | |||
| 316 | n2 ping -W 1 -c 1 192.168.241.1 | 316 | n2 ping -W 1 -c 1 192.168.241.1 |
| 317 | n1 wg set wg0 peer "$pub2" persistent-keepalive 0 | 317 | n1 wg set wg0 peer "$pub2" persistent-keepalive 0 |
| 318 | 318 | ||
| 319 | # Test that sk_bound_dev_if works | ||
| 320 | n1 ping -I wg0 -c 1 -W 1 192.168.241.2 | ||
| 321 | # What about when the mark changes and the packet must be rerouted? | ||
| 322 | n1 iptables -t mangle -I OUTPUT -j MARK --set-xmark 1 | ||
| 323 | n1 ping -c 1 -W 1 192.168.241.2 # First the boring case | ||
| 324 | n1 ping -I wg0 -c 1 -W 1 192.168.241.2 # Then the sk_bound_dev_if case | ||
| 325 | n1 iptables -t mangle -D OUTPUT -j MARK --set-xmark 1 | ||
| 326 | |||
| 319 | # Test that onion routing works, even when it loops | 327 | # Test that onion routing works, even when it loops |
| 320 | n1 wg set wg0 peer "$pub3" allowed-ips 192.168.242.2/32 endpoint 192.168.241.2:5 | 328 | n1 wg set wg0 peer "$pub3" allowed-ips 192.168.242.2/32 endpoint 192.168.241.2:5 |
| 321 | ip1 addr add 192.168.242.1/24 dev wg0 | 329 | ip1 addr add 192.168.242.1/24 dev wg0 |
| @@ -18,10 +18,12 @@ CONFIG_NF_NAT=y · 17 unmodified lines | |||
| 18 | CONFIG_NETFILTER_XTABLES=y | 18 | CONFIG_NETFILTER_XTABLES=y |
| 19 | CONFIG_NETFILTER_XT_NAT=y | 19 | CONFIG_NETFILTER_XT_NAT=y |
| 20 | CONFIG_NETFILTER_XT_MATCH_LENGTH=y | 20 | CONFIG_NETFILTER_XT_MATCH_LENGTH=y |
| 21 | CONFIG_NETFILTER_XT_MARK=y | ||
| 21 | CONFIG_NF_CONNTRACK_IPV4=y | 22 | CONFIG_NF_CONNTRACK_IPV4=y |
| 22 | CONFIG_NF_NAT_IPV4=y | 23 | CONFIG_NF_NAT_IPV4=y |
| 23 | CONFIG_IP_NF_IPTABLES=y | 24 | CONFIG_IP_NF_IPTABLES=y |
| 24 | CONFIG_IP_NF_FILTER=y | 25 | CONFIG_IP_NF_FILTER=y |
| 26 | CONFIG_IP_NF_MANGLE=y | ||
| 25 | CONFIG_IP_NF_NAT=y | 27 | CONFIG_IP_NF_NAT=y |
| 26 | CONFIG_IP_ADVANCED_ROUTER=y | 28 | CONFIG_IP_ADVANCED_ROUTER=y |
| 27 | CONFIG_IP_MULTIPLE_TABLES=y | 29 | CONFIG_IP_MULTIPLE_TABLES=y |