Unified · Split
| @@ -1637,6 +1637,10 @@ S: Panoramastrasse 18 · 1636 unmodified lines | ||
| 1637 | 1637 | S: D-69126 Heidelberg |
| 1638 | 1638 | S: Germany |
| 1639 | 1639 | |
| 1640 | +N: Simon Horman | |
| 1641 | +M: horms@verge.net.au | |
| 1642 | +D: Renesas ARM/ARM64 SoC maintainer | |
| 1643 | + | |
| 1640 | 1644 | N: Christopher Horn |
| 1641 | 1645 | E: chorn@warwick.net |
| 1642 | 1646 | D: Miscellaneous sysctl hacks |
| @@ -615,8 +615,8 @@ on an IO device and is an example of this type. · 614 unmodified lines | ||
| 615 | 615 | Protections |
| 616 | 616 | ----------- |
| 617 | 617 | |
| 618 | −A cgroup is protected to be allocated upto the configured amount of | |
| 619 | −the resource if the usages of all its ancestors are under their | |
| 618 | +A cgroup is protected upto the configured amount of the resource | |
| 619 | +as long as the usages of all its ancestors are under their | |
| 620 | 620 | protected levels. Protections can be hard guarantees or best effort |
| 621 | 621 | soft boundaries. Protections can also be over-committed in which case |
| 622 | 622 | only upto the amount available to the parent is protected among |
| @@ -1096,7 +1096,10 @@ PAGE_SIZE multiple when read back. · 473 unmodified lines | ||
| 1096 | 1096 | is within its effective min boundary, the cgroup's memory |
| 1097 | 1097 | won't be reclaimed under any conditions. If there is no |
| 1098 | 1098 | unprotected reclaimable memory available, OOM killer |
| 1099 | − is invoked. | |
| 1099 | + is invoked. Above the effective min boundary (or | |
| 1100 | + effective low boundary if it is higher), pages are reclaimed | |
| 1101 | + proportionally to the overage, reducing reclaim pressure for | |
| 1102 | + smaller overages. | |
| 1100 | 1103 | |
| 1101 | 1104 | Effective min boundary is limited by memory.min values of |
| 1102 | 1105 | all ancestor cgroups. If there is memory.min overcommitment |
| @@ -1118,7 +1121,10 @@ PAGE_SIZE multiple when read back. · 15 unmodified lines | ||
| 1118 | 1121 | Best-effort memory protection. If the memory usage of a |
| 1119 | 1122 | cgroup is within its effective low boundary, the cgroup's |
| 1120 | 1123 | memory won't be reclaimed unless memory can be reclaimed |
| 1121 | − from unprotected cgroups. | |
| 1124 | + from unprotected cgroups. Above the effective low boundary (or | |
| 1125 | + effective min boundary if it is higher), pages are reclaimed | |
| 1126 | + proportionally to the overage, reducing reclaim pressure for | |
| 1127 | + smaller overages. | |
| 1122 | 1128 | |
| 1123 | 1129 | Effective low boundary is limited by memory.low values of |
| 1124 | 1130 | all ancestor cgroups. If there is memory.low overcommitment |
| @@ -2482,8 +2488,10 @@ system performance due to overreclaim, to the point where the feature · 1357 unmodified lines | ||
| 2482 | 2488 | becomes self-defeating. |
| 2483 | 2489 | |
| 2484 | 2490 | The memory.low boundary on the other hand is a top-down allocated |
| 2485 | −reserve. A cgroup enjoys reclaim protection when it's within its low, | |
| 2486 | −which makes delegation of subtrees possible. | |
| 2491 | +reserve. A cgroup enjoys reclaim protection when it's within its | |
| 2492 | +effective low, which makes delegation of subtrees possible. It also | |
| 2493 | +enjoys having reclaim pressure proportional to its overage when | |
| 2494 | +above its effective low. | |
| 2487 | 2495 | |
| 2488 | 2496 | The original high boundary, the hard limit, is defined as a strict |
| 2489 | 2497 | limit that can not budge, even if the OOM killer has to be called. |
| @@ -5302,6 +5302,10 @@ · 5301 unmodified lines | ||
| 5302 | 5302 | the unplug protocol |
| 5303 | 5303 | never -- do not unplug even if version check succeeds |
| 5304 | 5304 | |
| 5305 | + xen_legacy_crash [X86,XEN] | |
| 5306 | + Crash from Xen panic notifier, without executing late | |
| 5307 | + panic() code such as dumping handler. | |
| 5308 | + | |
| 5305 | 5309 | xen_nopvspin [X86,XEN] |
| 5306 | 5310 | Disables the ticketlock slowpath using Xen PV |
| 5307 | 5311 | optimizations. |
| @@ -154,11 +154,18 @@ return virtual addresses to userspace from a 48-bit range. · 153 unmodified lines | ||
| 154 | 154 | |
| 155 | 155 | Software can "opt-in" to receiving VAs from a 52-bit space by |
| 156 | 156 | specifying an mmap hint parameter that is larger than 48-bit. |
| 157 | + | |
| 157 | 158 | For example: |
| 158 | − maybe_high_address = mmap(~0UL, size, prot, flags,...); | |
| 159 | + | |
| 160 | +.. code-block:: c | |
| 161 | + | |
| 162 | + maybe_high_address = mmap(~0UL, size, prot, flags,...); | |
| 159 | 163 | |
| 160 | 164 | It is also possible to build a debug kernel that returns addresses |
| 161 | 165 | from a 52-bit space by enabling the following kernel config options: |
| 166 | + | |
| 167 | +.. code-block:: sh | |
| 168 | + | |
| 162 | 169 | CONFIG_EXPERT=y && CONFIG_ARM64_FORCE_52BIT=y |
| 163 | 170 | |
| 164 | 171 | Note that this option is only intended for debugging applications |
| @@ -38,6 +38,7 @@ Core utilities · 37 unmodified lines | ||
| 38 | 38 | protection-keys |
| 39 | 39 | ../RCU/index |
| 40 | 40 | gcc-plugins |
| 41 | + symbol-namespaces | |
| 41 | 42 | |
| 42 | 43 | |
| 43 | 44 | Interfaces for kernel debugging |
| @@ -98,6 +98,10 @@ limited. The actual limit depends on the hardware and the kernel · 97 unmodified lines | ||
| 98 | 98 | configuration, but it is a good practice to use `kmalloc` for objects |
| 99 | 99 | smaller than page size. |
| 100 | 100 | |
| 101 | +The address of a chunk allocated with `kmalloc` is aligned to at least | |
| 102 | +ARCH_KMALLOC_MINALIGN bytes. For sizes which are a power of two, the | |
| 103 | +alignment is also guaranteed to be at least the respective size. | |
| 104 | + | |
| 101 | 105 | For large allocations you can use :c:func:`vmalloc` and |
| 102 | 106 | :c:func:`vzalloc`, or directly request pages from the page |
| 103 | 107 | allocator. The memory allocated by `vmalloc` and related functions is |
File renamed without changes.
| @@ -41,6 +41,9 @@ smaller binary while the latter is 1.1 - 2 times faster. · 40 unmodified lines | ||
| 41 | 41 | Both KASAN modes work with both SLUB and SLAB memory allocators. |
| 42 | 42 | For better bug detection and nicer reporting, enable CONFIG_STACKTRACE. |
| 43 | 43 | |
| 44 | +To augment reports with last allocation and freeing stack of the physical page, | |
| 45 | +it is recommended to enable also CONFIG_PAGE_OWNER and boot with page_owner=on. | |
| 46 | + | |
| 44 | 47 | To disable instrumentation for specific files or directories, add a line |
| 45 | 48 | similar to the following to the respective kernel Makefile: |
| 46 | 49 | |
| @@ -89,6 +89,22 @@ To build, save output files in a separate directory with KBUILD_OUTPUT :: · 88 unmodified lines | ||
| 89 | 89 | |
| 90 | 90 | $ export KBUILD_OUTPUT=/tmp/kselftest; make TARGETS="size timers" kselftest |
| 91 | 91 | |
| 92 | +Additionally you can use the "SKIP_TARGETS" variable on the make command | |
| 93 | +line to specify one or more targets to exclude from the TARGETS list. | |
| 94 | + | |
| 95 | +To run all tests but a single subsystem:: | |
| 96 | + | |
| 97 | + $ make -C tools/testing/selftests SKIP_TARGETS=ptrace run_tests | |
| 98 | + | |
| 99 | +You can specify multiple tests to skip:: | |
| 100 | + | |
| 101 | + $ make SKIP_TARGETS="size timers" kselftest | |
| 102 | + | |
| 103 | +You can also specify a restricted list of tests to run together with a | |
| 104 | +dedicated skiplist:: | |
| 105 | + | |
| 106 | + $ make TARGETS="bpf breakpoints size timers" SKIP_TARGETS=bpf kselftest | |
| 107 | + | |
| 92 | 108 | See the top-level tools/testing/selftests/Makefile for the list of all |
| 93 | 109 | possible targets. |
| 94 | 110 | |
| @@ -85,4 +85,5 @@ examples: · 84 unmodified lines | ||
| 85 | 85 | <&pd IMX_SC_R_DSP_RAM>; |
| 86 | 86 | mbox-names = "txdb0", "txdb1", "rxdb0", "rxdb1"; |
| 87 | 87 | mboxes = <&lsio_mu13 2 0>, <&lsio_mu13 2 1>, <&lsio_mu13 3 0>, <&lsio_mu13 3 1>; |
| 88 | + memory-region = <&dsp_reserved>; | |
| 88 | 89 | }; |
| @@ -43,13 +43,9 @@ properties: · 42 unmodified lines | ||
| 43 | 43 | |
| 44 | 44 | dvdd-supply: |
| 45 | 45 | description: DVdd voltage supply |
| 46 | − items: | |
| 47 | − - const: dvdd | |
| 48 | 46 | |
| 49 | 47 | avdd-supply: |
| 50 | 48 | description: AVdd voltage supply |
| 51 | − items: | |
| 52 | − - const: avdd | |
| 53 | 49 | |
| 54 | 50 | adi,rejection-60-Hz-enable: |
| 55 | 51 | description: | |
| @@ -99,6 +95,9 @@ required: · 43 unmodified lines | ||
| 99 | 95 | examples: |
| 100 | 96 | - | |
| 101 | 97 | spi0 { |
| 98 | + #address-cells = <1>; | |
| 99 | + #size-cells = <0>; | |
| 100 | + | |
| 102 | 101 | adc@0 { |
| 103 | 102 | compatible = "adi,ad7192"; |
| 104 | 103 | reg = <0>; |
| @@ -73,7 +73,6 @@ properties: · 72 unmodified lines | ||
| 73 | 73 | - rc-genius-tvgo-a11mce |
| 74 | 74 | - rc-gotview7135 |
| 75 | 75 | - rc-hauppauge |
| 76 | − - rc-hauppauge | |
| 77 | 76 | - rc-hisi-poplar |
| 78 | 77 | - rc-hisi-tv-demo |
| 79 | 78 | - rc-imon-mce |
| @@ -37,7 +37,7 @@ properties: · 36 unmodified lines | ||
| 37 | 37 | - description: exclusive PHY reset line |
| 38 | 38 | - description: shared reset line between the PCIe PHY and PCIe controller |
| 39 | 39 | |
| 40 | − resets-names: | |
| 40 | + reset-names: | |
| 41 | 41 | items: |
| 42 | 42 | - const: phy |
| 43 | 43 | - const: pcie |
| @@ -26,6 +26,8 @@ Required properties: · 25 unmodified lines | ||
| 26 | 26 | - "renesas,hscif-r8a77470" for R8A77470 (RZ/G1C) HSCIF compatible UART. |
| 27 | 27 | - "renesas,scif-r8a774a1" for R8A774A1 (RZ/G2M) SCIF compatible UART. |
| 28 | 28 | - "renesas,hscif-r8a774a1" for R8A774A1 (RZ/G2M) HSCIF compatible UART. |
| 29 | + - "renesas,scif-r8a774b1" for R8A774B1 (RZ/G2N) SCIF compatible UART. | |
| 30 | + - "renesas,hscif-r8a774b1" for R8A774B1 (RZ/G2N) HSCIF compatible UART. | |
| 29 | 31 | - "renesas,scif-r8a774c0" for R8A774C0 (RZ/G2E) SCIF compatible UART. |
| 30 | 32 | - "renesas,hscif-r8a774c0" for R8A774C0 (RZ/G2E) HSCIF compatible UART. |
| 31 | 33 | - "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART. |
| @@ -85,8 +85,8 @@ A child node must exist to represent the core DWC2 IP block. The name of · 84 unmodified lines | ||
| 85 | 85 | the node is not important. The content of the node is defined in dwc2.txt. |
| 86 | 86 | |
| 87 | 87 | PHY documentation is provided in the following places: |
| 88 | −- Documentation/devicetree/bindings/phy/meson-g12a-usb2-phy.txt | |
| 89 | −- Documentation/devicetree/bindings/phy/meson-g12a-usb3-pcie-phy.txt | |
| 88 | +- Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb2-phy.yaml | |
| 89 | +- Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb3-pcie-phy.yaml | |
| 90 | 90 | |
| 91 | 91 | Example device nodes: |
| 92 | 92 | usb: usb@ffe09000 { |
| @@ -63,7 +63,11 @@ properties: · 62 unmodified lines | ||
| 63 | 63 | description: |
| 64 | 64 | Set this flag to force EHCI reset after resume. |
| 65 | 65 | |
| 66 | − phys: true | |
| 66 | + phys: | |
| 67 | + description: PHY specifier for the USB PHY | |
| 68 | + | |
| 69 | + phy-names: | |
| 70 | + const: usb | |
| 67 | 71 | |
| 68 | 72 | required: |
| 69 | 73 | - compatible |
| @@ -89,6 +93,7 @@ examples: · 19 unmodified lines | ||
| 89 | 93 | interrupts = <39>; |
| 90 | 94 | clocks = <&ahb_gates 1>; |
| 91 | 95 | phys = <&usbphy 1>; |
| 96 | + phy-names = "usb"; | |
| 92 | 97 | }; |
| 93 | 98 | |
| 94 | 99 | ... |
| @@ -67,7 +67,11 @@ properties: · 66 unmodified lines | ||
| 67 | 67 | description: |
| 68 | 68 | Overrides the detected port count |
| 69 | 69 | |
| 70 | − phys: true | |
| 70 | + phys: | |
| 71 | + description: PHY specifier for the USB PHY | |
| 72 | + | |
| 73 | + phy-names: | |
| 74 | + const: usb | |
| 71 | 75 | |
| 72 | 76 | required: |
| 73 | 77 | - compatible |
| @@ -84,6 +88,7 @@ examples: · 10 unmodified lines | ||
| 84 | 88 | interrupts = <64>; |
| 85 | 89 | clocks = <&usb_clk 6>, <&ahb_gates 2>; |
| 86 | 90 | phys = <&usbphy 1>; |
| 91 | + phy-names = "usb"; | |
| 87 | 92 | }; |
| 88 | 93 | |
| 89 | 94 | ... |
| @@ -33,7 +33,7 @@ Required properties: · 32 unmodified lines | ||
| 33 | 33 | "dma_ck": dma_bus clock for data transfer by DMA, |
| 34 | 34 | "xhci_ck": controller clock |
| 35 | 35 | |
| 36 | − - phys : see usb-hcd.txt in the current directory | |
| 36 | + - phys : see usb-hcd.yaml in the current directory | |
| 37 | 37 | |
| 38 | 38 | Optional properties: |
| 39 | 39 | - wakeup-source : enable USB remote wakeup; |
| @@ -53,7 +53,7 @@ Optional properties: · 13 unmodified lines | ||
| 53 | 53 | See: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt |
| 54 | 54 | - imod-interval-ns: default interrupt moderation interval is 5000ns |
| 55 | 55 | |
| 56 | −additionally the properties from usb-hcd.txt (in the current directory) are | |
| 56 | +additionally the properties from usb-hcd.yaml (in the current directory) are | |
| 57 | 57 | supported. |
| 58 | 58 | |
| 59 | 59 | Example: |
| @@ -17,7 +17,7 @@ Required properties: · 16 unmodified lines | ||
| 17 | 17 | - clock-names : must contain "sys_ck" for clock of controller, |
| 18 | 18 | the following clocks are optional: |
| 19 | 19 | "ref_ck", "mcu_ck" and "dma_ck"; |
| 20 | − - phys : see usb-hcd.txt in the current directory | |
| 20 | + - phys : see usb-hcd.yaml in the current directory | |
| 21 | 21 | - dr_mode : should be one of "host", "peripheral" or "otg", |
| 22 | 22 | refer to usb/generic.txt |
| 23 | 23 | |
| @@ -60,7 +60,7 @@ Optional properties: · 36 unmodified lines | ||
| 60 | 60 | - mediatek,u3p-dis-msk : mask to disable u3ports, bit0 for u3port0, |
| 61 | 61 | bit1 for u3port1, ... etc; |
| 62 | 62 | |
| 63 | −additionally the properties from usb-hcd.txt (in the current directory) are | |
| 63 | +additionally the properties from usb-hcd.yaml (in the current directory) are | |
| 64 | 64 | supported. |
| 65 | 65 | |
| 66 | 66 | Sub-nodes: |
| @@ -18,8 +18,13 @@ properties: · 17 unmodified lines | ||
| 18 | 18 | description: |
| 19 | 19 | List of all the USB PHYs on this HCD |
| 20 | 20 | |
| 21 | + phy-names: | |
| 22 | + description: | |
| 23 | + Name specifier for the USB PHY | |
| 24 | + | |
| 21 | 25 | examples: |
| 22 | 26 | - | |
| 23 | 27 | usb { |
| 24 | 28 | phys = <&usb2_phy1>, <&usb3_phy1>; |
| 29 | + phy-names = "usb"; | |
| 25 | 30 | }; |
| @@ -6,7 +6,7 @@ Required properties: · 5 unmodified lines | ||
| 6 | 6 | - reg : Should contain 1 register ranges(address and length) |
| 7 | 7 | - interrupts : UHCI controller interrupt |
| 8 | 8 | |
| 9 | −additionally the properties from usb-hcd.txt (in the current directory) are | |
| 9 | +additionally the properties from usb-hcd.yaml (in the current directory) are | |
| 10 | 10 | supported. |
| 11 | 11 | |
| 12 | 12 | Example: |
| @@ -41,9 +41,9 @@ Optional properties: · 40 unmodified lines | ||
| 41 | 41 | - usb3-lpm-capable: determines if platform is USB3 LPM capable |
| 42 | 42 | - quirk-broken-port-ped: set if the controller has broken port disable mechanism |
| 43 | 43 | - imod-interval-ns: default interrupt moderation interval is 5000ns |
| 44 | − - phys : see usb-hcd.txt in the current directory | |
| 44 | + - phys : see usb-hcd.yaml in the current directory | |
| 45 | 45 | |
| 46 | −additionally the properties from usb-hcd.txt (in the current directory) are | |
| 46 | +additionally the properties from usb-hcd.yaml (in the current directory) are | |
| 47 | 47 | supported. |
| 48 | 48 | |
| 49 | 49 | |
| @@ -7,6 +7,7 @@ Linux Hardware Monitoring · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | hwmon-kernel-api |
| 9 | 9 | pmbus-core |
| 10 | + inspur-ipsps1 | |
| 10 | 11 | submitting-patches |
| 11 | 12 | sysfs-interface |
| 12 | 13 | userspace-tools |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | Kernel driver inspur-ipsps1 |
| 2 | −======================= | |
| 2 | +=========================== | |
| 3 | 3 | |
| 4 | 4 | Supported chips: |
| 5 | 5 | |
| @@ -21,10 +21,17 @@ Supported chips: · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | * AMD Family 14h processors: "Brazos" (C/E/G/Z-Series) |
| 23 | 23 | |
| 24 | −* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri", "Carrizo" | |
| 24 | +* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri", | |
| 25 | + "Carrizo", "Stoney Ridge", "Bristol Ridge" | |
| 25 | 26 | |
| 26 | 27 | * AMD Family 16h processors: "Kabini", "Mullins" |
| 27 | 28 | |
| 29 | +* AMD Family 17h processors: "Zen", "Zen 2" | |
| 30 | + | |
| 31 | +* AMD Family 18h processors: "Hygon Dhyana" | |
| 32 | + | |
| 33 | +* AMD Family 19h processors: "Zen 3" | |
| 34 | + | |
| 28 | 35 | Prefix: 'k10temp' |
| 29 | 36 | |
| 30 | 37 | Addresses scanned: PCI space |
| @@ -110,3 +117,12 @@ The maximum value for Tctl is available in the file temp1_max. · 79 unmodified lines | ||
| 110 | 117 | If the BIOS has enabled hardware temperature control, the threshold at |
| 111 | 118 | which the processor will throttle itself to avoid damage is available in |
| 112 | 119 | temp1_crit and temp1_crit_hyst. |
| 120 | + | |
| 121 | +On some AMD CPUs, there is a difference between the die temperature (Tdie) and | |
| 122 | +the reported temperature (Tctl). Tdie is the real measured temperature, and | |
| 123 | +Tctl is used for fan control. While Tctl is always available as temp1_input, | |
| 124 | +the driver exports Tdie temperature as temp2_input for those CPUs which support | |
| 125 | +it. | |
| 126 | + | |
| 127 | +Models from 17h family report relative temperature, the driver aims to | |
| 128 | +compensate and report the real temperature. | |
| @@ -954,11 +954,6 @@ When kbuild executes, the following steps are followed (roughly): · 953 unmodified lines | ||
| 954 | 954 | |
| 955 | 955 | From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). |
| 956 | 956 | |
| 957 | − KBUILD_ARFLAGS Options for $(AR) when creating archives | |
| 958 | − | |
| 959 | − $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic | |
| 960 | − mode) if this option is supported by $(AR). | |
| 961 | − | |
| 962 | 957 | KBUILD_LDS |
| 963 | 958 | |
| 964 | 959 | The linker script with full path. Assigned by the top-level Makefile. |
| @@ -498,10 +498,11 @@ build. · 497 unmodified lines | ||
| 498 | 498 | will be written containing all exported symbols that were not |
| 499 | 499 | defined in the kernel. |
| 500 | 500 | |
| 501 | −--- 6.3 Symbols From Another External Module | |
| 501 | +6.3 Symbols From Another External Module | |
| 502 | +---------------------------------------- | |
| 502 | 503 | |
| 503 | 504 | Sometimes, an external module uses exported symbols from |
| 504 | − another external module. kbuild needs to have full knowledge of | |
| 505 | + another external module. Kbuild needs to have full knowledge of | |
| 505 | 506 | all symbols to avoid spitting out warnings about undefined |
| 506 | 507 | symbols. Three solutions exist for this situation. |
| 507 | 508 | |
| @@ -521,7 +522,7 @@ build. · 13 unmodified lines | ||
| 521 | 522 | The top-level kbuild file would then look like:: |
| 522 | 523 | |
| 523 | 524 | #./Kbuild (or ./Makefile): |
| 524 | − obj-y := foo/ bar/ | |
| 525 | + obj-m := foo/ bar/ | |
| 525 | 526 | |
| 526 | 527 | And executing:: |
| 527 | 528 | |
| @@ -16,16 +16,21 @@ the kernel may be unreproducible, and how to avoid them. · 15 unmodified lines | ||
| 16 | 16 | Timestamps |
| 17 | 17 | ---------- |
| 18 | 18 | |
| 19 | −The kernel embeds a timestamp in two places: | |
| 19 | +The kernel embeds timestamps in three places: | |
| 20 | 20 | |
| 21 | 21 | * The version string exposed by ``uname()`` and included in |
| 22 | 22 | ``/proc/version`` |
| 23 | 23 | |
| 24 | 24 | * File timestamps in the embedded initramfs |
| 25 | 25 | |
| 26 | −By default the timestamp is the current time. This must be overridden | |
| 27 | −using the `KBUILD_BUILD_TIMESTAMP`_ variable. If you are building | |
| 28 | −from a git commit, you could use its commit date. | |
| 26 | +* If enabled via ``CONFIG_IKHEADERS``, file timestamps of kernel | |
| 27 | + headers embedded in the kernel or respective module, | |
| 28 | + exposed via ``/sys/kernel/kheaders.tar.xz`` | |
| 29 | + | |
| 30 | +By default the timestamp is the current time and in the case of | |
| 31 | +``kheaders`` the various files' modification times. This must | |
| 32 | +be overridden using the `KBUILD_BUILD_TIMESTAMP`_ variable. | |
| 33 | +If you are building from a git commit, you could use its commit date. | |
| 29 | 34 | |
| 30 | 35 | The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros, |
| 31 | 36 | and enables warnings if they are used. If you incorporate external |
| @@ -23,6 +23,7 @@ Contents: · 22 unmodified lines | ||
| 23 | 23 | intel/ice |
| 24 | 24 | google/gve |
| 25 | 25 | mellanox/mlx5 |
| 26 | + netronome/nfp | |
| 26 | 27 | pensando/ionic |
| 27 | 28 | |
| 28 | 29 | .. only:: subproject and html |
| @@ -272,7 +272,7 @@ supported flags are: · 271 unmodified lines | ||
| 272 | 272 | * MSG_DONTWAIT, i.e. non-blocking operation. |
| 273 | 273 | |
| 274 | 274 | recvmsg(2) |
| 275 | −^^^^^^^^^ | |
| 275 | +^^^^^^^^^^ | |
| 276 | 276 | |
| 277 | 277 | In most cases recvmsg(2) is needed if you want to extract more information than |
| 278 | 278 | recvfrom(2) can provide. For example package priority and timestamp. The |
| @@ -56,7 +56,7 @@ instead of ``double-indenting`` the ``case`` labels. E.g.: · 55 unmodified lines | ||
| 56 | 56 | case 'K': |
| 57 | 57 | case 'k': |
| 58 | 58 | mem <<= 10; |
| 59 | − /* fall through */ | |
| 59 | + fallthrough; | |
| 60 | 60 | default: |
| 61 | 61 | break; |
| 62 | 62 | } |
| @@ -122,14 +122,27 @@ memory adjacent to the stack (when built without `CONFIG_VMAP_STACK=y`) · 121 unmodified lines | ||
| 122 | 122 | |
| 123 | 123 | Implicit switch case fall-through |
| 124 | 124 | --------------------------------- |
| 125 | −The C language allows switch cases to "fall through" when | |
| 126 | −a "break" statement is missing at the end of a case. This, | |
| 127 | −however, introduces ambiguity in the code, as it's not always | |
| 128 | −clear if the missing break is intentional or a bug. As there | |
| 129 | −have been a long list of flaws `due to missing "break" statements | |
| 125 | +The C language allows switch cases to "fall-through" when a "break" statement | |
| 126 | +is missing at the end of a case. This, however, introduces ambiguity in the | |
| 127 | +code, as it's not always clear if the missing break is intentional or a bug. | |
| 128 | + | |
| 129 | +As there have been a long list of flaws `due to missing "break" statements | |
| 130 | 130 | <https://cwe.mitre.org/data/definitions/484.html>`_, we no longer allow |
| 131 | −"implicit fall-through". In order to identify an intentional fall-through | |
| 132 | −case, we have adopted the marking used by static analyzers: a comment | |
| 133 | −saying `/* Fall through */`. Once the C++17 `__attribute__((fallthrough))` | |
| 134 | −is more widely handled by C compilers, static analyzers, and IDEs, we can | |
| 135 | −switch to using that instead. | |
| 131 | +"implicit fall-through". | |
| 132 | + | |
| 133 | +In order to identify intentional fall-through cases, we have adopted a | |
| 134 | +pseudo-keyword macro 'fallthrough' which expands to gcc's extension | |
| 135 | +__attribute__((__fallthrough__)). `Statement Attributes | |
| 136 | +<https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html>`_ | |
| 137 | + | |
| 138 | +When the C17/C18 [[fallthrough]] syntax is more commonly supported by | |
| 139 | +C compilers, static analyzers, and IDEs, we can switch to using that syntax | |
| 140 | +for the macro pseudo-keyword. | |
| 141 | + | |
| 142 | +All switch/case blocks must end in one of: | |
| 143 | + | |
| 144 | + break; | |
| 145 | + fallthrough; | |
| 146 | + continue; | |
| 147 | + goto <label>; | |
| 148 | + return [expression]; | |
| @@ -1,109 +0,0 @@ | ||
| 1 | −============ | |
| 2 | −Diamonds Rio | |
| 3 | −============ | |
| 4 | − | |
| 5 | −Copyright (C) 1999, 2000 Bruce Tenison | |
| 6 | − | |
| 7 | −Portions Copyright (C) 1999, 2000 David Nelson | |
| 8 | − | |
| 9 | −Thanks to David Nelson for guidance and the usage of the scanner.txt | |
| 10 | −and scanner.c files to model our driver and this informative file. | |
| 11 | − | |
| 12 | −Mar. 2, 2000 | |
| 13 | − | |
| 14 | −Changes | |
| 15 | −======= | |
| 16 | − | |
| 17 | −- Initial Revision | |
| 18 | − | |
| 19 | − | |
| 20 | −Overview | |
| 21 | −======== | |
| 22 | − | |
| 23 | −This README will address issues regarding how to configure the kernel | |
| 24 | −to access a RIO 500 mp3 player. | |
| 25 | −Before I explain how to use this to access the Rio500 please be warned: | |
| 26 | − | |
| 27 | −.. warning:: | |
| 28 | − | |
| 29 | − Please note that this software is still under development. The authors | |
| 30 | − are in no way responsible for any damage that may occur, no matter how | |
| 31 | − inconsequential. | |
| 32 | − | |
| 33 | −It seems that the Rio has a problem when sending .mp3 with low batteries. | |
| 34 | −I suggest when the batteries are low and you want to transfer stuff that you | |
| 35 | −replace it with a fresh one. In my case, what happened is I lost two 16kb | |
| 36 | −blocks (they are no longer usable to store information to it). But I don't | |
| 37 | −know if that's normal or not; it could simply be a problem with the flash | |
| 38 | −memory. | |
| 39 | − | |
| 40 | −In an extreme case, I left my Rio playing overnight and the batteries wore | |
| 41 | −down to nothing and appear to have corrupted the flash memory. My RIO | |
| 42 | −needed to be replaced as a result. Diamond tech support is aware of the | |
| 43 | −problem. Do NOT allow your batteries to wear down to nothing before | |
| 44 | −changing them. It appears RIO 500 firmware does not handle low battery | |
| 45 | −power well at all. | |
| 46 | − | |
| 47 | −On systems with OHCI controllers, the kernel OHCI code appears to have | |
| 48 | −power on problems with some chipsets. If you are having problems | |
| 49 | −connecting to your RIO 500, try turning it on first and then plugging it | |
| 50 | −into the USB cable. | |
| 51 | − | |
| 52 | −Contact Information | |
| 53 | −------------------- | |
| 54 | − | |
| 55 | − The main page for the project is hosted at sourceforge.net in the following | |
| 56 | − URL: <http://rio500.sourceforge.net>. You can also go to the project's | |
| 57 | − sourceforge home page at: <http://sourceforge.net/projects/rio500/>. | |
| 58 | − There is also a mailing list: rio500-users@lists.sourceforge.net | |
| 59 | − | |
| 60 | −Authors | |
| 61 | −------- | |
| 62 | − | |
| 63 | −Most of the code was written by Cesar Miquel <miquel@df.uba.ar>. Keith | |
| 64 | −Clayton <kclayton@jps.net> is incharge of the PPC port and making sure | |
| 65 | −things work there. Bruce Tenison <btenison@dibbs.net> is adding support | |
| 66 | −for .fon files and also does testing. The program will mostly sure be | |
| 67 | −re-written and Pete Ikusz along with the rest will re-design it. I would | |
| 68 | −also like to thank Tri Nguyen <tmn_3022000@hotmail.com> who provided use | |
| 69 | −with some important information regarding the communication with the Rio. | |
| 70 | − | |
| 71 | −Additional Information and userspace tools | |
| 72 | − | |
| 73 | − http://rio500.sourceforge.net/ | |
| 74 | − | |
| 75 | − | |
| 76 | −Requirements | |
| 77 | −============ | |
| 78 | − | |
| 79 | −A host with a USB port running a Linux kernel with RIO 500 support enabled. | |
| 80 | − | |
| 81 | −The driver is a module called rio500, which should be automatically loaded | |
| 82 | −as you plug in your device. If that fails you can manually load it with | |
| 83 | − | |
| 84 | − modprobe rio500 | |
| 85 | − | |
| 86 | −Udev should automatically create a device node as soon as plug in your device. | |
| 87 | −If that fails, you can manually add a device for the USB rio500:: | |
| 88 | − | |
| 89 | − mknod /dev/usb/rio500 c 180 64 | |
| 90 | − | |
| 91 | −In that case, set appropriate permissions for /dev/usb/rio500 (don't forget | |
| 92 | −about group and world permissions). Both read and write permissions are | |
| 93 | −required for proper operation. | |
| 94 | − | |
| 95 | −That's it. The Rio500 Utils at: http://rio500.sourceforge.net should | |
| 96 | −be able to access the rio500. | |
| 97 | − | |
| 98 | −Limits | |
| 99 | −====== | |
| 100 | − | |
| 101 | −You can use only a single rio500 device at a time with your computer. | |
| 102 | − | |
| 103 | −Bugs | |
| 104 | −==== | |
| 105 | − | |
| 106 | −If you encounter any problems feel free to drop me an email. | |
| 107 | − | |
| 108 | −Bruce Tenison | |
| 109 | −btenison@dibbs.net | |
| @@ -2165,12 +2165,10 @@ F: arch/arm64/boot/dts/realtek/ · 2164 unmodified lines | ||
| 2165 | 2165 | F: Documentation/devicetree/bindings/arm/realtek.yaml |
| 2166 | 2166 | |
| 2167 | 2167 | ARM/RENESAS ARM64 ARCHITECTURE |
| 2168 | −M: Simon Horman <horms@verge.net.au> | |
| 2169 | 2168 | M: Geert Uytterhoeven <geert+renesas@glider.be> |
| 2170 | 2169 | M: Magnus Damm <magnus.damm@gmail.com> |
| 2171 | 2170 | L: linux-renesas-soc@vger.kernel.org |
| 2172 | 2171 | Q: http://patchwork.kernel.org/project/linux-renesas-soc/list/ |
| 2173 | −T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next | |
| 2174 | 2172 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next |
| 2175 | 2173 | S: Supported |
| 2176 | 2174 | F: arch/arm64/boot/dts/renesas/ |
| @@ -2282,12 +2280,10 @@ S: Maintained · 105 unmodified lines | ||
| 2282 | 2280 | F: drivers/media/platform/s5p-mfc/ |
| 2283 | 2281 | |
| 2284 | 2282 | ARM/SHMOBILE ARM ARCHITECTURE |
| 2285 | −M: Simon Horman <horms@verge.net.au> | |
| 2286 | 2283 | M: Geert Uytterhoeven <geert+renesas@glider.be> |
| 2287 | 2284 | M: Magnus Damm <magnus.damm@gmail.com> |
| 2288 | 2285 | L: linux-renesas-soc@vger.kernel.org |
| 2289 | 2286 | Q: http://patchwork.kernel.org/project/linux-renesas-soc/list/ |
| 2290 | −T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next | |
| 2291 | 2287 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next |
| 2292 | 2288 | S: Supported |
| 2293 | 2289 | F: arch/arm/boot/dts/emev2* |
| @@ -9187,6 +9183,7 @@ M: Pavel Machek <pavel@ucw.cz> · 6893 unmodified lines | ||
| 9187 | 9183 | R: Dan Murphy <dmurphy@ti.com> |
| 9188 | 9184 | L: linux-leds@vger.kernel.org |
| 9189 | 9185 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git |
| 9186 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git | |
| 9190 | 9187 | S: Maintained |
| 9191 | 9188 | F: Documentation/devicetree/bindings/leds/ |
| 9192 | 9189 | F: drivers/leds/ |
| @@ -11547,6 +11544,7 @@ NSDEPS · 2354 unmodified lines | ||
| 11547 | 11544 | M: Matthias Maennich <maennich@google.com> |
| 11548 | 11545 | S: Maintained |
| 11549 | 11546 | F: scripts/nsdeps |
| 11547 | +F: Documentation/core-api/symbol-namespaces.rst | |
| 11550 | 11548 | |
| 11551 | 11549 | NTB AMD DRIVER |
| 11552 | 11550 | M: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> |
| @@ -16766,13 +16764,6 @@ W: http://www.linux-usb.org/usbnet · 5213 unmodified lines | ||
| 16766 | 16764 | S: Maintained |
| 16767 | 16765 | F: drivers/net/usb/dm9601.c |
| 16768 | 16766 | |
| 16769 | −USB DIAMOND RIO500 DRIVER | |
| 16770 | −M: Cesar Miquel <miquel@df.uba.ar> | |
| 16771 | −L: rio500-users@lists.sourceforge.net | |
| 16772 | −W: http://rio500.sourceforge.net | |
| 16773 | −S: Maintained | |
| 16774 | −F: drivers/usb/misc/rio500* | |
| 16775 | − | |
| 16776 | 16767 | USB EHCI DRIVER |
| 16777 | 16768 | M: Alan Stern <stern@rowland.harvard.edu> |
| 16778 | 16769 | L: linux-usb@vger.kernel.org |
| @@ -2,8 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 5 |
| 3 | 3 | PATCHLEVEL = 4 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc1 | |
| 6 | −NAME = Bobtail Squid | |
| 5 | +EXTRAVERSION = -rc3 | |
| 6 | +NAME = Nesting Opossum | |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| 9 | 9 | # To see a list of typical targets execute "make help" |
| @@ -206,24 +206,8 @@ ifndef KBUILD_CHECKSRC · 196 unmodified lines | ||
| 206 | 206 | KBUILD_CHECKSRC = 0 |
| 207 | 207 | endif |
| 208 | 208 | |
| 209 | −# Use make M=dir to specify directory of external module to build | |
| 210 | −# Old syntax make ... SUBDIRS=$PWD is still supported | |
| 211 | −# Setting the environment variable KBUILD_EXTMOD take precedence | |
| 212 | −ifdef SUBDIRS | |
| 213 | − $(warning ================= WARNING ================) | |
| 214 | − $(warning 'SUBDIRS' will be removed after Linux 5.3) | |
| 215 | − $(warning ) | |
| 216 | − $(warning If you are building an individual subdirectory) | |
| 217 | − $(warning in the kernel tree, you can do like this:) | |
| 218 | − $(warning $$ make path/to/dir/you/want/to/build/) | |
| 219 | − $(warning (Do not forget the trailing slash)) | |
| 220 | − $(warning ) | |
| 221 | − $(warning If you are building an external module,) | |
| 222 | − $(warning Please use 'M=' or 'KBUILD_EXTMOD' instead) | |
| 223 | − $(warning ==========================================) | |
| 224 | − KBUILD_EXTMOD ?= $(SUBDIRS) | |
| 225 | −endif | |
| 226 | − | |
| 209 | +# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the | |
| 210 | +# directory of external module to build. Setting M= takes precedence. | |
| 227 | 211 | ifeq ("$(origin M)", "command line") |
| 228 | 212 | KBUILD_EXTMOD := $(M) |
| 229 | 213 | endif |
| @@ -498,7 +482,6 @@ export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN · 268 unmodified lines | ||
| 498 | 482 | export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE |
| 499 | 483 | export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE |
| 500 | 484 | export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL |
| 501 | −export KBUILD_ARFLAGS | |
| 502 | 485 | |
| 503 | 486 | # Files to ignore in find ... statements |
| 504 | 487 | |
| @@ -616,7 +599,7 @@ endif · 111 unmodified lines | ||
| 616 | 599 | # in addition to whatever we do anyway. |
| 617 | 600 | # Just "make" or "make all" shall build modules as well |
| 618 | 601 | |
| 619 | −ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) | |
| 602 | +ifneq ($(filter all _all modules nsdeps,$(MAKECMDGOALS)),) | |
| 620 | 603 | KBUILD_MODULES := 1 |
| 621 | 604 | endif |
| 622 | 605 | |
| @@ -914,9 +897,6 @@ ifdef CONFIG_RETPOLINE · 291 unmodified lines | ||
| 914 | 897 | KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) |
| 915 | 898 | endif |
| 916 | 899 | |
| 917 | −# use the deterministic mode of AR if available | |
| 918 | −KBUILD_ARFLAGS := $(call ar-option,D) | |
| 919 | − | |
| 920 | 900 | include scripts/Makefile.kasan |
| 921 | 901 | include scripts/Makefile.extrawarn |
| 922 | 902 | include scripts/Makefile.ubsan |
| @@ -1237,9 +1217,8 @@ PHONY += kselftest · 314 unmodified lines | ||
| 1237 | 1217 | kselftest: |
| 1238 | 1218 | $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests |
| 1239 | 1219 | |
| 1240 | −PHONY += kselftest-clean | |
| 1241 | −kselftest-clean: | |
| 1242 | − $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean | |
| 1220 | +kselftest-%: FORCE | |
| 1221 | + $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $* | |
| 1243 | 1222 | |
| 1244 | 1223 | PHONY += kselftest-merge |
| 1245 | 1224 | kselftest-merge: |
| @@ -432,7 +432,7 @@ · 431 unmodified lines | ||
| 432 | 432 | pinctrl-0 = <&mmc0_pins_default>; |
| 433 | 433 | }; |
| 434 | 434 | |
| 435 | −&gpio0 { | |
| 435 | +&gpio0_target { | |
| 436 | 436 | /* Do not idle the GPIO used for holding the VTT regulator */ |
| 437 | 437 | ti,no-reset-on-init; |
| 438 | 438 | ti,no-idle-on-init; |
| @@ -127,7 +127,7 @@ · 126 unmodified lines | ||
| 127 | 127 | ranges = <0x0 0x5000 0x1000>; |
| 128 | 128 | }; |
| 129 | 129 | |
| 130 | − target-module@7000 { /* 0x44e07000, ap 14 20.0 */ | |
| 130 | + gpio0_target: target-module@7000 { /* 0x44e07000, ap 14 20.0 */ | |
| 131 | 131 | compatible = "ti,sysc-omap2", "ti,sysc"; |
| 132 | 132 | ti,hwmods = "gpio1"; |
| 133 | 133 | reg = <0x7000 0x4>, |
| @@ -2038,7 +2038,9 @@ · 1904 unmodified lines | ||
| 2038 | 2038 | reg = <0xe000 0x4>, |
| 2039 | 2039 | <0xe054 0x4>; |
| 2040 | 2040 | reg-names = "rev", "sysc"; |
| 2041 | − ti,sysc-midle ; | |
| 2041 | + ti,sysc-midle = <SYSC_IDLE_FORCE>, | |
| 2042 | + <SYSC_IDLE_NO>, | |
| 2043 | + <SYSC_IDLE_SMART>; | |
| 2042 | 2044 | ti,sysc-sidle = <SYSC_IDLE_FORCE>, |
| 2043 | 2045 | <SYSC_IDLE_NO>, |
| 2044 | 2046 | <SYSC_IDLE_SMART>; |
| @@ -337,6 +337,8 @@ · 336 unmodified lines | ||
| 337 | 337 | ti,hwmods = "dss_dispc"; |
| 338 | 338 | clocks = <&disp_clk>; |
| 339 | 339 | clock-names = "fck"; |
| 340 | + | |
| 341 | + max-memory-bandwidth = <230000000>; | |
| 340 | 342 | }; |
| 341 | 343 | |
| 342 | 344 | rfbi: rfbi@4832a800 { |
| @@ -2732,7 +2732,7 @@ · 2731 unmodified lines | ||
| 2732 | 2732 | interrupt-names = "tx", "rx"; |
| 2733 | 2733 | dmas = <&edma_xbar 129 1>, <&edma_xbar 128 1>; |
| 2734 | 2734 | dma-names = "tx", "rx"; |
| 2735 | − clocks = <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 22>, | |
| 2735 | + clocks = <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 0>, | |
| 2736 | 2736 | <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 24>, |
| 2737 | 2737 | <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 28>; |
| 2738 | 2738 | clock-names = "fck", "ahclkx", "ahclkr"; |
| @@ -2768,8 +2768,8 @@ · 29 unmodified lines | ||
| 2768 | 2768 | interrupt-names = "tx", "rx"; |
| 2769 | 2769 | dmas = <&edma_xbar 131 1>, <&edma_xbar 130 1>; |
| 2770 | 2770 | dma-names = "tx", "rx"; |
| 2771 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 22>, | |
| 2772 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 24>, | |
| 2771 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 0>, | |
| 2772 | + <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 24>, | |
| 2773 | 2773 | <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 28>; |
| 2774 | 2774 | clock-names = "fck", "ahclkx", "ahclkr"; |
| 2775 | 2775 | status = "disabled"; |
| @@ -2786,9 +2786,8 @@ · 10 unmodified lines | ||
| 2786 | 2786 | <SYSC_IDLE_SMART>; |
| 2787 | 2787 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2788 | 2788 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 0>, |
| 2789 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>, | |
| 2790 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 28>; | |
| 2791 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2789 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>; | |
| 2790 | + clock-names = "fck", "ahclkx"; | |
| 2792 | 2791 | #address-cells = <1>; |
| 2793 | 2792 | #size-cells = <1>; |
| 2794 | 2793 | ranges = <0x0 0x68000 0x2000>, |
| @@ -2804,7 +2803,7 @@ · 9 unmodified lines | ||
| 2804 | 2803 | interrupt-names = "tx", "rx"; |
| 2805 | 2804 | dmas = <&edma_xbar 133 1>, <&edma_xbar 132 1>; |
| 2806 | 2805 | dma-names = "tx", "rx"; |
| 2807 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 22>, | |
| 2806 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 0>, | |
| 2808 | 2807 | <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>; |
| 2809 | 2808 | clock-names = "fck", "ahclkx"; |
| 2810 | 2809 | status = "disabled"; |
| @@ -2821,9 +2820,8 @@ · 10 unmodified lines | ||
| 2821 | 2820 | <SYSC_IDLE_SMART>; |
| 2822 | 2821 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2823 | 2822 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 0>, |
| 2824 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>, | |
| 2825 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 28>; | |
| 2826 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2823 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>; | |
| 2824 | + clock-names = "fck", "ahclkx"; | |
| 2827 | 2825 | #address-cells = <1>; |
| 2828 | 2826 | #size-cells = <1>; |
| 2829 | 2827 | ranges = <0x0 0x6c000 0x2000>, |
| @@ -2839,7 +2837,7 @@ · 9 unmodified lines | ||
| 2839 | 2837 | interrupt-names = "tx", "rx"; |
| 2840 | 2838 | dmas = <&edma_xbar 135 1>, <&edma_xbar 134 1>; |
| 2841 | 2839 | dma-names = "tx", "rx"; |
| 2842 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 22>, | |
| 2840 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 0>, | |
| 2843 | 2841 | <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>; |
| 2844 | 2842 | clock-names = "fck", "ahclkx"; |
| 2845 | 2843 | status = "disabled"; |
| @@ -2856,9 +2854,8 @@ · 10 unmodified lines | ||
| 2856 | 2854 | <SYSC_IDLE_SMART>; |
| 2857 | 2855 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2858 | 2856 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 0>, |
| 2859 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>, | |
| 2860 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 28>; | |
| 2861 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2857 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>; | |
| 2858 | + clock-names = "fck", "ahclkx"; | |
| 2862 | 2859 | #address-cells = <1>; |
| 2863 | 2860 | #size-cells = <1>; |
| 2864 | 2861 | ranges = <0x0 0x70000 0x2000>, |
| @@ -2874,7 +2871,7 @@ · 9 unmodified lines | ||
| 2874 | 2871 | interrupt-names = "tx", "rx"; |
| 2875 | 2872 | dmas = <&edma_xbar 137 1>, <&edma_xbar 136 1>; |
| 2876 | 2873 | dma-names = "tx", "rx"; |
| 2877 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 22>, | |
| 2874 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 0>, | |
| 2878 | 2875 | <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>; |
| 2879 | 2876 | clock-names = "fck", "ahclkx"; |
| 2880 | 2877 | status = "disabled"; |
| @@ -2891,9 +2888,8 @@ · 10 unmodified lines | ||
| 2891 | 2888 | <SYSC_IDLE_SMART>; |
| 2892 | 2889 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2893 | 2890 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 0>, |
| 2894 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>, | |
| 2895 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 28>; | |
| 2896 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2891 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>; | |
| 2892 | + clock-names = "fck", "ahclkx"; | |
| 2897 | 2893 | #address-cells = <1>; |
| 2898 | 2894 | #size-cells = <1>; |
| 2899 | 2895 | ranges = <0x0 0x74000 0x2000>, |
| @@ -2909,7 +2905,7 @@ · 9 unmodified lines | ||
| 2909 | 2905 | interrupt-names = "tx", "rx"; |
| 2910 | 2906 | dmas = <&edma_xbar 139 1>, <&edma_xbar 138 1>; |
| 2911 | 2907 | dma-names = "tx", "rx"; |
| 2912 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 22>, | |
| 2908 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 0>, | |
| 2913 | 2909 | <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>; |
| 2914 | 2910 | clock-names = "fck", "ahclkx"; |
| 2915 | 2911 | status = "disabled"; |
| @@ -2926,9 +2922,8 @@ · 10 unmodified lines | ||
| 2926 | 2922 | <SYSC_IDLE_SMART>; |
| 2927 | 2923 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2928 | 2924 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 0>, |
| 2929 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>, | |
| 2930 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 28>; | |
| 2931 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2925 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>; | |
| 2926 | + clock-names = "fck", "ahclkx"; | |
| 2932 | 2927 | #address-cells = <1>; |
| 2933 | 2928 | #size-cells = <1>; |
| 2934 | 2929 | ranges = <0x0 0x78000 0x2000>, |
| @@ -2944,7 +2939,7 @@ · 9 unmodified lines | ||
| 2944 | 2939 | interrupt-names = "tx", "rx"; |
| 2945 | 2940 | dmas = <&edma_xbar 141 1>, <&edma_xbar 140 1>; |
| 2946 | 2941 | dma-names = "tx", "rx"; |
| 2947 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 22>, | |
| 2942 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 0>, | |
| 2948 | 2943 | <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>; |
| 2949 | 2944 | clock-names = "fck", "ahclkx"; |
| 2950 | 2945 | status = "disabled"; |
| @@ -2961,9 +2956,8 @@ · 10 unmodified lines | ||
| 2961 | 2956 | <SYSC_IDLE_SMART>; |
| 2962 | 2957 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2963 | 2958 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 0>, |
| 2964 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>, | |
| 2965 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 28>; | |
| 2966 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2959 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>; | |
| 2960 | + clock-names = "fck", "ahclkx"; | |
| 2967 | 2961 | #address-cells = <1>; |
| 2968 | 2962 | #size-cells = <1>; |
| 2969 | 2963 | ranges = <0x0 0x7c000 0x2000>, |
| @@ -2979,7 +2973,7 @@ · 9 unmodified lines | ||
| 2979 | 2973 | interrupt-names = "tx", "rx"; |
| 2980 | 2974 | dmas = <&edma_xbar 143 1>, <&edma_xbar 142 1>; |
| 2981 | 2975 | dma-names = "tx", "rx"; |
| 2982 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 22>, | |
| 2976 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 0>, | |
| 2983 | 2977 | <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>; |
| 2984 | 2978 | clock-names = "fck", "ahclkx"; |
| 2985 | 2979 | status = "disabled"; |
| @@ -124,6 +124,7 @@ · 123 unmodified lines | ||
| 124 | 124 | spi-max-frequency = <100000>; |
| 125 | 125 | spi-cpol; |
| 126 | 126 | spi-cpha; |
| 127 | + spi-cs-high; | |
| 127 | 128 | |
| 128 | 129 | backlight= <&backlight>; |
| 129 | 130 | label = "lcd"; |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <dt-bindings/mfd/dbx500-prcmu.h> |
| 9 | 9 | #include <dt-bindings/arm/ux500_pm_domains.h> |
| 10 | 10 | #include <dt-bindings/gpio/gpio.h> |
| 11 | +#include <dt-bindings/thermal/thermal.h> | |
| 11 | 12 | |
| 12 | 13 | / { |
| 13 | 14 | #address-cells = <1>; |
| @@ -59,8 +60,12 @@ · 45 unmodified lines | ||
| 59 | 60 | * cooling. |
| 60 | 61 | */ |
| 61 | 62 | cpu_thermal: cpu-thermal { |
| 62 | − polling-delay-passive = <0>; | |
| 63 | − polling-delay = <1000>; | |
| 63 | + polling-delay-passive = <250>; | |
| 64 | + /* | |
| 65 | + * This sensor fires interrupts to update the thermal | |
| 66 | + * zone, so no polling is needed. | |
| 67 | + */ | |
| 68 | + polling-delay = <0>; | |
| 64 | 69 | |
| 65 | 70 | thermal-sensors = <&thermal>; |
| 66 | 71 | |
| @@ -79,7 +84,7 @@ · 12 unmodified lines | ||
| 79 | 84 | |
| 80 | 85 | cooling-maps { |
| 81 | 86 | trip = <&cpu_alert>; |
| 82 | − cooling-device = <&CPU0 0 2>; | |
| 87 | + cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; | |
| 83 | 88 | contribution = <100>; |
| 84 | 89 | }; |
| 85 | 90 | }; |
| @@ -520,6 +520,7 @@ · 519 unmodified lines | ||
| 520 | 520 | interrupts = <39>; |
| 521 | 521 | clocks = <&ccu CLK_AHB_EHCI0>; |
| 522 | 522 | phys = <&usbphy 1>; |
| 523 | + phy-names = "usb"; | |
| 523 | 524 | status = "disabled"; |
| 524 | 525 | }; |
| 525 | 526 | |
| @@ -529,6 +530,7 @@ · 3 unmodified lines | ||
| 529 | 530 | interrupts = <64>; |
| 530 | 531 | clocks = <&ccu CLK_USB_OHCI0>, <&ccu CLK_AHB_OHCI0>; |
| 531 | 532 | phys = <&usbphy 1>; |
| 533 | + phy-names = "usb"; | |
| 532 | 534 | status = "disabled"; |
| 533 | 535 | }; |
| 534 | 536 | |
| @@ -608,6 +610,7 @@ · 73 unmodified lines | ||
| 608 | 610 | interrupts = <40>; |
| 609 | 611 | clocks = <&ccu CLK_AHB_EHCI1>; |
| 610 | 612 | phys = <&usbphy 2>; |
| 613 | + phy-names = "usb"; | |
| 611 | 614 | status = "disabled"; |
| 612 | 615 | }; |
| 613 | 616 | |
| @@ -617,6 +620,7 @@ · 3 unmodified lines | ||
| 617 | 620 | interrupts = <65>; |
| 618 | 621 | clocks = <&ccu CLK_USB_OHCI1>, <&ccu CLK_AHB_OHCI1>; |
| 619 | 622 | phys = <&usbphy 2>; |
| 623 | + phy-names = "usb"; | |
| 620 | 624 | status = "disabled"; |
| 621 | 625 | }; |
| 622 | 626 | |
| @@ -391,6 +391,7 @@ · 390 unmodified lines | ||
| 391 | 391 | interrupts = <39>; |
| 392 | 392 | clocks = <&ccu CLK_AHB_EHCI>; |
| 393 | 393 | phys = <&usbphy 1>; |
| 394 | + phy-names = "usb"; | |
| 394 | 395 | status = "disabled"; |
| 395 | 396 | }; |
| 396 | 397 | |
| @@ -400,6 +401,7 @@ · 3 unmodified lines | ||
| 400 | 401 | interrupts = <40>; |
| 401 | 402 | clocks = <&ccu CLK_USB_OHCI>, <&ccu CLK_AHB_OHCI>; |
| 402 | 403 | phys = <&usbphy 1>; |
| 404 | + phy-names = "usb"; | |
| 403 | 405 | status = "disabled"; |
| 404 | 406 | }; |
| 405 | 407 | |
| @@ -545,6 +545,7 @@ · 544 unmodified lines | ||
| 545 | 545 | clocks = <&ccu CLK_AHB1_EHCI0>; |
| 546 | 546 | resets = <&ccu RST_AHB1_EHCI0>; |
| 547 | 547 | phys = <&usbphy 1>; |
| 548 | + phy-names = "usb"; | |
| 548 | 549 | status = "disabled"; |
| 549 | 550 | }; |
| 550 | 551 | |
| @@ -555,6 +556,7 @@ · 4 unmodified lines | ||
| 555 | 556 | clocks = <&ccu CLK_AHB1_OHCI0>, <&ccu CLK_USB_OHCI0>; |
| 556 | 557 | resets = <&ccu RST_AHB1_OHCI0>; |
| 557 | 558 | phys = <&usbphy 1>; |
| 559 | + phy-names = "usb"; | |
| 558 | 560 | status = "disabled"; |
| 559 | 561 | }; |
| 560 | 562 | |
| @@ -565,6 +567,7 @@ · 4 unmodified lines | ||
| 565 | 567 | clocks = <&ccu CLK_AHB1_EHCI1>; |
| 566 | 568 | resets = <&ccu RST_AHB1_EHCI1>; |
| 567 | 569 | phys = <&usbphy 2>; |
| 570 | + phy-names = "usb"; | |
| 568 | 571 | status = "disabled"; |
| 569 | 572 | }; |
| 570 | 573 | |
| @@ -575,6 +578,7 @@ · 4 unmodified lines | ||
| 575 | 578 | clocks = <&ccu CLK_AHB1_OHCI1>, <&ccu CLK_USB_OHCI1>; |
| 576 | 579 | resets = <&ccu RST_AHB1_OHCI1>; |
| 577 | 580 | phys = <&usbphy 2>; |
| 581 | + phy-names = "usb"; | |
| 578 | 582 | status = "disabled"; |
| 579 | 583 | }; |
| 580 | 584 | |
| @@ -623,6 +623,7 @@ · 622 unmodified lines | ||
| 623 | 623 | interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; |
| 624 | 624 | clocks = <&ccu CLK_AHB_EHCI0>; |
| 625 | 625 | phys = <&usbphy 1>; |
| 626 | + phy-names = "usb"; | |
| 626 | 627 | status = "disabled"; |
| 627 | 628 | }; |
| 628 | 629 | |
| @@ -632,6 +633,7 @@ · 3 unmodified lines | ||
| 632 | 633 | interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; |
| 633 | 634 | clocks = <&ccu CLK_USB_OHCI0>, <&ccu CLK_AHB_OHCI0>; |
| 634 | 635 | phys = <&usbphy 1>; |
| 636 | + phy-names = "usb"; | |
| 635 | 637 | status = "disabled"; |
| 636 | 638 | }; |
| 637 | 639 | |
| @@ -714,6 +716,7 @@ · 76 unmodified lines | ||
| 714 | 716 | interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; |
| 715 | 717 | clocks = <&ccu CLK_AHB_EHCI1>; |
| 716 | 718 | phys = <&usbphy 2>; |
| 719 | + phy-names = "usb"; | |
| 717 | 720 | status = "disabled"; |
| 718 | 721 | }; |
| 719 | 722 | |
| @@ -723,6 +726,7 @@ · 3 unmodified lines | ||
| 723 | 726 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; |
| 724 | 727 | clocks = <&ccu CLK_USB_OHCI1>, <&ccu CLK_AHB_OHCI1>; |
| 725 | 728 | phys = <&usbphy 2>; |
| 729 | + phy-names = "usb"; | |
| 726 | 730 | status = "disabled"; |
| 727 | 731 | }; |
| 728 | 732 | |
| @@ -307,6 +307,7 @@ · 306 unmodified lines | ||
| 307 | 307 | clocks = <&ccu CLK_BUS_EHCI>; |
| 308 | 308 | resets = <&ccu RST_BUS_EHCI>; |
| 309 | 309 | phys = <&usbphy 1>; |
| 310 | + phy-names = "usb"; | |
| 310 | 311 | status = "disabled"; |
| 311 | 312 | }; |
| 312 | 313 | |
| @@ -317,6 +318,7 @@ · 4 unmodified lines | ||
| 317 | 318 | clocks = <&ccu CLK_BUS_OHCI>, <&ccu CLK_USB_OHCI>; |
| 318 | 319 | resets = <&ccu RST_BUS_OHCI>; |
| 319 | 320 | phys = <&usbphy 1>; |
| 321 | + phy-names = "usb"; | |
| 320 | 322 | status = "disabled"; |
| 321 | 323 | }; |
| 322 | 324 | |
| @@ -632,6 +632,7 @@ · 631 unmodified lines | ||
| 632 | 632 | clocks = <&ccu CLK_BUS_EHCI0>; |
| 633 | 633 | resets = <&ccu RST_BUS_EHCI0>; |
| 634 | 634 | phys = <&usbphy 1>; |
| 635 | + phy-names = "usb"; | |
| 635 | 636 | status = "disabled"; |
| 636 | 637 | }; |
| 637 | 638 | |
| @@ -643,6 +644,7 @@ · 5 unmodified lines | ||
| 643 | 644 | clocks = <&ccu CLK_BUS_OHCI0>, <&ccu CLK_USB_OHCI0>; |
| 644 | 645 | resets = <&ccu RST_BUS_OHCI0>; |
| 645 | 646 | phys = <&usbphy 1>; |
| 647 | + phy-names = "usb"; | |
| 646 | 648 | status = "disabled"; |
| 647 | 649 | }; |
| 648 | 650 | |
| @@ -654,6 +656,7 @@ · 5 unmodified lines | ||
| 654 | 656 | clocks = <&ccu CLK_BUS_EHCI1>; |
| 655 | 657 | resets = <&ccu RST_BUS_EHCI1>; |
| 656 | 658 | phys = <&usbphy 2>; |
| 659 | + phy-names = "usb"; | |
| 657 | 660 | status = "disabled"; |
| 658 | 661 | }; |
| 659 | 662 | |
| @@ -273,6 +273,7 @@ · 272 unmodified lines | ||
| 273 | 273 | clocks = <&ccu CLK_BUS_EHCI1>; |
| 274 | 274 | resets = <&ccu RST_BUS_EHCI1>; |
| 275 | 275 | phys = <&usbphy 1>; |
| 276 | + phy-names = "usb"; | |
| 276 | 277 | status = "disabled"; |
| 277 | 278 | }; |
| 278 | 279 | |
| @@ -284,6 +285,7 @@ · 5 unmodified lines | ||
| 284 | 285 | <&ccu CLK_USB_OHCI1>; |
| 285 | 286 | resets = <&ccu RST_BUS_OHCI1>; |
| 286 | 287 | phys = <&usbphy 1>; |
| 288 | + phy-names = "usb"; | |
| 287 | 289 | status = "disabled"; |
| 288 | 290 | }; |
| 289 | 291 | |
| @@ -294,6 +296,7 @@ · 4 unmodified lines | ||
| 294 | 296 | clocks = <&ccu CLK_BUS_EHCI2>; |
| 295 | 297 | resets = <&ccu RST_BUS_EHCI2>; |
| 296 | 298 | phys = <&usbphy 2>; |
| 299 | + phy-names = "usb"; | |
| 297 | 300 | status = "disabled"; |
| 298 | 301 | }; |
| 299 | 302 | |
| @@ -305,6 +308,7 @@ · 5 unmodified lines | ||
| 305 | 308 | <&ccu CLK_USB_OHCI2>; |
| 306 | 309 | resets = <&ccu RST_BUS_OHCI2>; |
| 307 | 310 | phys = <&usbphy 2>; |
| 311 | + phy-names = "usb"; | |
| 308 | 312 | status = "disabled"; |
| 309 | 313 | }; |
| 310 | 314 | |
| @@ -346,6 +346,7 @@ · 345 unmodified lines | ||
| 346 | 346 | clocks = <&usb_clocks CLK_BUS_HCI0>; |
| 347 | 347 | resets = <&usb_clocks RST_USB0_HCI>; |
| 348 | 348 | phys = <&usbphy1>; |
| 349 | + phy-names = "usb"; | |
| 349 | 350 | status = "disabled"; |
| 350 | 351 | }; |
| 351 | 352 | |
| @@ -357,6 +358,7 @@ · 5 unmodified lines | ||
| 357 | 358 | <&usb_clocks CLK_USB_OHCI0>; |
| 358 | 359 | resets = <&usb_clocks RST_USB0_HCI>; |
| 359 | 360 | phys = <&usbphy1>; |
| 361 | + phy-names = "usb"; | |
| 360 | 362 | status = "disabled"; |
| 361 | 363 | }; |
| 362 | 364 | |
| @@ -378,6 +380,7 @@ · 15 unmodified lines | ||
| 378 | 380 | clocks = <&usb_clocks CLK_BUS_HCI1>; |
| 379 | 381 | resets = <&usb_clocks RST_USB1_HCI>; |
| 380 | 382 | phys = <&usbphy2>; |
| 383 | + phy-names = "usb"; | |
| 381 | 384 | status = "disabled"; |
| 382 | 385 | }; |
| 383 | 386 | |
| @@ -407,6 +410,7 @@ · 23 unmodified lines | ||
| 407 | 410 | clocks = <&usb_clocks CLK_BUS_HCI2>; |
| 408 | 411 | resets = <&usb_clocks RST_USB2_HCI>; |
| 409 | 412 | phys = <&usbphy3>; |
| 413 | + phy-names = "usb"; | |
| 410 | 414 | status = "disabled"; |
| 411 | 415 | }; |
| 412 | 416 | |
| @@ -418,6 +422,7 @@ · 5 unmodified lines | ||
| 418 | 422 | <&usb_clocks CLK_USB_OHCI2>; |
| 419 | 423 | resets = <&usb_clocks RST_USB2_HCI>; |
| 420 | 424 | phys = <&usbphy3>; |
| 425 | + phy-names = "usb"; | |
| 421 | 426 | status = "disabled"; |
| 422 | 427 | }; |
| 423 | 428 | |
| @@ -304,6 +304,7 @@ · 303 unmodified lines | ||
| 304 | 304 | clocks = <&ccu CLK_BUS_EHCI1>, <&ccu CLK_BUS_OHCI1>; |
| 305 | 305 | resets = <&ccu RST_BUS_EHCI1>, <&ccu RST_BUS_OHCI1>; |
| 306 | 306 | phys = <&usbphy 1>; |
| 307 | + phy-names = "usb"; | |
| 307 | 308 | status = "disabled"; |
| 308 | 309 | }; |
| 309 | 310 | |
| @@ -315,6 +316,7 @@ · 5 unmodified lines | ||
| 315 | 316 | <&ccu CLK_USB_OHCI1>; |
| 316 | 317 | resets = <&ccu RST_BUS_EHCI1>, <&ccu RST_BUS_OHCI1>; |
| 317 | 318 | phys = <&usbphy 1>; |
| 319 | + phy-names = "usb"; | |
| 318 | 320 | status = "disabled"; |
| 319 | 321 | }; |
| 320 | 322 | |
| @@ -325,6 +327,7 @@ · 4 unmodified lines | ||
| 325 | 327 | clocks = <&ccu CLK_BUS_EHCI2>, <&ccu CLK_BUS_OHCI2>; |
| 326 | 328 | resets = <&ccu RST_BUS_EHCI2>, <&ccu RST_BUS_OHCI2>; |
| 327 | 329 | phys = <&usbphy 2>; |
| 330 | + phy-names = "usb"; | |
| 328 | 331 | status = "disabled"; |
| 329 | 332 | }; |
| 330 | 333 | |
| @@ -336,6 +339,7 @@ · 5 unmodified lines | ||
| 336 | 339 | <&ccu CLK_USB_OHCI2>; |
| 337 | 340 | resets = <&ccu RST_BUS_EHCI2>, <&ccu RST_BUS_OHCI2>; |
| 338 | 341 | phys = <&usbphy 2>; |
| 342 | + phy-names = "usb"; | |
| 339 | 343 | status = "disabled"; |
| 340 | 344 | }; |
| 341 | 345 | |
| @@ -346,6 +350,7 @@ · 4 unmodified lines | ||
| 346 | 350 | clocks = <&ccu CLK_BUS_EHCI3>, <&ccu CLK_BUS_OHCI3>; |
| 347 | 351 | resets = <&ccu RST_BUS_EHCI3>, <&ccu RST_BUS_OHCI3>; |
| 348 | 352 | phys = <&usbphy 3>; |
| 353 | + phy-names = "usb"; | |
| 349 | 354 | status = "disabled"; |
| 350 | 355 | }; |
| 351 | 356 | |
| @@ -357,6 +362,7 @@ · 5 unmodified lines | ||
| 357 | 362 | <&ccu CLK_USB_OHCI3>; |
| 358 | 363 | resets = <&ccu RST_BUS_EHCI3>, <&ccu RST_BUS_OHCI3>; |
| 359 | 364 | phys = <&usbphy 3>; |
| 365 | + phy-names = "usb"; | |
| 360 | 366 | status = "disabled"; |
| 361 | 367 | }; |
| 362 | 368 | |
| @@ -91,7 +91,6 @@ CONFIG_USB_SERIAL_PL2303=m · 90 unmodified lines | ||
| 91 | 91 | CONFIG_USB_SERIAL_CYBERJACK=m |
| 92 | 92 | CONFIG_USB_SERIAL_XIRCOM=m |
| 93 | 93 | CONFIG_USB_SERIAL_OMNINET=m |
| 94 | −CONFIG_USB_RIO500=m | |
| 95 | 94 | CONFIG_EXT2_FS=m |
| 96 | 95 | CONFIG_EXT3_FS=m |
| 97 | 96 | CONFIG_MSDOS_FS=y |
| @@ -195,7 +195,6 @@ CONFIG_USB_SERIAL_XIRCOM=m · 194 unmodified lines | ||
| 195 | 195 | CONFIG_USB_SERIAL_OMNINET=m |
| 196 | 196 | CONFIG_USB_EMI62=m |
| 197 | 197 | CONFIG_USB_EMI26=m |
| 198 | −CONFIG_USB_RIO500=m | |
| 199 | 198 | CONFIG_USB_LEGOTOWER=m |
| 200 | 199 | CONFIG_USB_LCD=m |
| 201 | 200 | CONFIG_USB_CYTHERM=m |
| @@ -228,7 +228,7 @@ CONFIG_RTC_DRV_OMAP=m · 227 unmodified lines | ||
| 228 | 228 | CONFIG_DMADEVICES=y |
| 229 | 229 | CONFIG_TI_EDMA=y |
| 230 | 230 | CONFIG_COMMON_CLK_PWM=m |
| 231 | −CONFIG_REMOTEPROC=m | |
| 231 | +CONFIG_REMOTEPROC=y | |
| 232 | 232 | CONFIG_DA8XX_REMOTEPROC=m |
| 233 | 233 | CONFIG_MEMORY=y |
| 234 | 234 | CONFIG_TI_AEMIF=m |
| @@ -415,7 +415,7 @@ CONFIG_SPI_SH_MSIOF=m · 414 unmodified lines | ||
| 415 | 415 | CONFIG_SPI_SH_HSPI=y |
| 416 | 416 | CONFIG_SPI_SIRF=y |
| 417 | 417 | CONFIG_SPI_STM32=m |
| 418 | −CONFIG_SPI_STM32_QSPI=m | |
| 418 | +CONFIG_SPI_STM32_QSPI=y | |
| 419 | 419 | CONFIG_SPI_SUN4I=y |
| 420 | 420 | CONFIG_SPI_SUN6I=y |
| 421 | 421 | CONFIG_SPI_TEGRA114=y |
| @@ -933,7 +933,7 @@ CONFIG_BCM2835_MBOX=y · 511 unmodified lines | ||
| 933 | 933 | CONFIG_ROCKCHIP_IOMMU=y |
| 934 | 934 | CONFIG_TEGRA_IOMMU_GART=y |
| 935 | 935 | CONFIG_TEGRA_IOMMU_SMMU=y |
| 936 | −CONFIG_REMOTEPROC=m | |
| 936 | +CONFIG_REMOTEPROC=y | |
| 937 | 937 | CONFIG_ST_REMOTEPROC=m |
| 938 | 938 | CONFIG_RPMSG_VIRTIO=m |
| 939 | 939 | CONFIG_ASPEED_LPC_CTRL=m |
| @@ -364,6 +364,7 @@ CONFIG_DRM_OMAP_PANEL_TPO_TD043MTEA1=m · 363 unmodified lines | ||
| 364 | 364 | CONFIG_DRM_OMAP_PANEL_NEC_NL8048HL11=m |
| 365 | 365 | CONFIG_DRM_TILCDC=m |
| 366 | 366 | CONFIG_DRM_PANEL_SIMPLE=m |
| 367 | +CONFIG_DRM_TI_TFP410=m | |
| 367 | 368 | CONFIG_FB=y |
| 368 | 369 | CONFIG_FIRMWARE_EDID=y |
| 369 | 370 | CONFIG_FB_MODE_HELPERS=y |
| @@ -423,6 +424,7 @@ CONFIG_USB_SERIAL_GENERIC=y · 53 unmodified lines | ||
| 423 | 424 | CONFIG_USB_SERIAL_SIMPLE=m |
| 424 | 425 | CONFIG_USB_SERIAL_FTDI_SIO=m |
| 425 | 426 | CONFIG_USB_SERIAL_PL2303=m |
| 427 | +CONFIG_USB_SERIAL_OPTION=m | |
| 426 | 428 | CONFIG_USB_TEST=m |
| 427 | 429 | CONFIG_NOP_USB_XCEIV=m |
| 428 | 430 | CONFIG_AM335X_PHY_USB=m |
| @@ -460,6 +462,7 @@ CONFIG_MMC_SDHCI_OMAP=y · 31 unmodified lines | ||
| 460 | 462 | CONFIG_NEW_LEDS=y |
| 461 | 463 | CONFIG_LEDS_CLASS=m |
| 462 | 464 | CONFIG_LEDS_CPCAP=m |
| 465 | +CONFIG_LEDS_LM3532=m | |
| 463 | 466 | CONFIG_LEDS_GPIO=m |
| 464 | 467 | CONFIG_LEDS_PCA963X=m |
| 465 | 468 | CONFIG_LEDS_PWM=m |
| @@ -481,7 +484,7 @@ CONFIG_RTC_DRV_OMAP=m · 15 unmodified lines | ||
| 481 | 484 | CONFIG_RTC_DRV_CPCAP=m |
| 482 | 485 | CONFIG_DMADEVICES=y |
| 483 | 486 | CONFIG_OMAP_IOMMU=y |
| 484 | −CONFIG_REMOTEPROC=m | |
| 487 | +CONFIG_REMOTEPROC=y | |
| 485 | 488 | CONFIG_OMAP_REMOTEPROC=m |
| 486 | 489 | CONFIG_WKUP_M3_RPROC=m |
| 487 | 490 | CONFIG_SOC_TI=y |
| @@ -581,7 +581,6 @@ CONFIG_USB_SERIAL_XIRCOM=m · 580 unmodified lines | ||
| 581 | 581 | CONFIG_USB_SERIAL_OMNINET=m |
| 582 | 582 | CONFIG_USB_EMI62=m |
| 583 | 583 | CONFIG_USB_EMI26=m |
| 584 | −CONFIG_USB_RIO500=m | |
| 585 | 584 | CONFIG_USB_LEGOTOWER=m |
| 586 | 585 | CONFIG_USB_LCD=m |
| 587 | 586 | CONFIG_USB_CYTHERM=m |
| @@ -327,7 +327,6 @@ CONFIG_USB_EMI62=m · 326 unmodified lines | ||
| 327 | 327 | CONFIG_USB_EMI26=m |
| 328 | 328 | CONFIG_USB_ADUTUX=m |
| 329 | 329 | CONFIG_USB_SEVSEG=m |
| 330 | −CONFIG_USB_RIO500=m | |
| 331 | 330 | CONFIG_USB_LEGOTOWER=m |
| 332 | 331 | CONFIG_USB_LCD=m |
| 333 | 332 | CONFIG_USB_CYPRESS_CY7C63=m |
| @@ -189,7 +189,6 @@ CONFIG_USB_SERIAL_XIRCOM=m · 188 unmodified lines | ||
| 189 | 189 | CONFIG_USB_SERIAL_OMNINET=m |
| 190 | 190 | CONFIG_USB_EMI62=m |
| 191 | 191 | CONFIG_USB_EMI26=m |
| 192 | −CONFIG_USB_RIO500=m | |
| 193 | 192 | CONFIG_USB_LEGOTOWER=m |
| 194 | 193 | CONFIG_USB_LCD=m |
| 195 | 194 | CONFIG_USB_CYTHERM=m |
| @@ -98,6 +98,7 @@ config CRYPTO_AES_ARM_CE · 97 unmodified lines | ||
| 98 | 98 | tristate "Accelerated AES using ARMv8 Crypto Extensions" |
| 99 | 99 | depends on KERNEL_MODE_NEON |
| 100 | 100 | select CRYPTO_BLKCIPHER |
| 101 | + select CRYPTO_LIB_AES | |
| 101 | 102 | select CRYPTO_SIMD |
| 102 | 103 | help |
| 103 | 104 | Use an implementation of AES in CBC, CTR and XTS modes that uses |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <asm/assembler.h> |
| 10 | 10 | |
| 11 | 11 | .text |
| 12 | + .arch armv8-a | |
| 12 | 13 | .fpu crypto-neon-fp-armv8 |
| 13 | 14 | .align 3 |
| 14 | 15 | |
| @@ -1,6 +0,0 @@ | ||
| 1 | −#ifndef _ASM_XEN_OPS_H | |
| 2 | −#define _ASM_XEN_OPS_H | |
| 3 | − | |
| 4 | −void xen_efi_runtime_setup(void); | |
| 5 | − | |
| 6 | −#endif /* _ASM_XEN_OPS_H */ | |
| @@ -763,7 +763,8 @@ static struct omap_hwmod_class_sysconfig am33xx_timer_sysc = { · 762 unmodified lines | ||
| 763 | 763 | .rev_offs = 0x0000, |
| 764 | 764 | .sysc_offs = 0x0010, |
| 765 | 765 | .syss_offs = 0x0014, |
| 766 | − .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), | |
| 766 | + .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | | |
| 767 | + SYSC_HAS_RESET_STATUS, | |
| 767 | 768 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | |
| 768 | 769 | SIDLE_SMART_WKUP), |
| 769 | 770 | .sysc_fields = &omap_hwmod_sysc_type2, |
| @@ -231,8 +231,9 @@ static struct omap_hwmod am33xx_control_hwmod = { · 230 unmodified lines | ||
| 231 | 231 | static struct omap_hwmod_class_sysconfig lcdc_sysc = { |
| 232 | 232 | .rev_offs = 0x0, |
| 233 | 233 | .sysc_offs = 0x54, |
| 234 | − .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE), | |
| 235 | − .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), | |
| 234 | + .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE, | |
| 235 | + .idlemodes = SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | |
| 236 | + MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART, | |
| 236 | 237 | .sysc_fields = &omap_hwmod_sysc_type2, |
| 237 | 238 | }; |
| 238 | 239 | |
| @@ -74,83 +74,6 @@ int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused) · 73 unmodified lines | ||
| 74 | 74 | return 0; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | −/* | |
| 78 | − * This API is to be called during init to set the various voltage | |
| 79 | − * domains to the voltage as per the opp table. Typically we boot up | |
| 80 | − * at the nominal voltage. So this function finds out the rate of | |
| 81 | − * the clock associated with the voltage domain, finds out the correct | |
| 82 | − * opp entry and sets the voltage domain to the voltage specified | |
| 83 | − * in the opp entry | |
| 84 | − */ | |
| 85 | −static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | |
| 86 | − const char *oh_name) | |
| 87 | −{ | |
| 88 | − struct voltagedomain *voltdm; | |
| 89 | − struct clk *clk; | |
| 90 | − struct dev_pm_opp *opp; | |
| 91 | − unsigned long freq, bootup_volt; | |
| 92 | − struct device *dev; | |
| 93 | − | |
| 94 | − if (!vdd_name || !clk_name || !oh_name) { | |
| 95 | − pr_err("%s: invalid parameters\n", __func__); | |
| 96 | − goto exit; | |
| 97 | − } | |
| 98 | − | |
| 99 | − if (!strncmp(oh_name, "mpu", 3)) | |
| 100 | − /* | |
| 101 | − * All current OMAPs share voltage rail and clock | |
| 102 | − * source, so CPU0 is used to represent the MPU-SS. | |
| 103 | − */ | |
| 104 | − dev = get_cpu_device(0); | |
| 105 | − else | |
| 106 | − dev = omap_device_get_by_hwmod_name(oh_name); | |
| 107 | − | |
| 108 | − if (IS_ERR(dev)) { | |
| 109 | − pr_err("%s: Unable to get dev pointer for hwmod %s\n", | |
| 110 | − __func__, oh_name); | |
| 111 | − goto exit; | |
| 112 | − } | |
| 113 | − | |
| 114 | − voltdm = voltdm_lookup(vdd_name); | |
| 115 | − if (!voltdm) { | |
| 116 | − pr_err("%s: unable to get vdd pointer for vdd_%s\n", | |
| 117 | − __func__, vdd_name); | |
| 118 | − goto exit; | |
| 119 | − } | |
| 120 | − | |
| 121 | − clk = clk_get(NULL, clk_name); | |
| 122 | − if (IS_ERR(clk)) { | |
| 123 | − pr_err("%s: unable to get clk %s\n", __func__, clk_name); | |
| 124 | − goto exit; | |
| 125 | − } | |
| 126 | − | |
| 127 | − freq = clk_get_rate(clk); | |
| 128 | − clk_put(clk); | |
| 129 | − | |
| 130 | − opp = dev_pm_opp_find_freq_ceil(dev, &freq); | |
| 131 | − if (IS_ERR(opp)) { | |
| 132 | − pr_err("%s: unable to find boot up OPP for vdd_%s\n", | |
| 133 | − __func__, vdd_name); | |
| 134 | − goto exit; | |
| 135 | − } | |
| 136 | − | |
| 137 | − bootup_volt = dev_pm_opp_get_voltage(opp); | |
| 138 | − dev_pm_opp_put(opp); | |
| 139 | − | |
| 140 | − if (!bootup_volt) { | |
| 141 | − pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n", | |
| 142 | − __func__, vdd_name); | |
| 143 | − goto exit; | |
| 144 | − } | |
| 145 | − | |
| 146 | − voltdm_scale(voltdm, bootup_volt); | |
| 147 | − return 0; | |
| 148 | − | |
| 149 | −exit: | |
| 150 | − pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name); | |
| 151 | − return -EINVAL; | |
| 152 | −} | |
| 153 | − | |
| 154 | 77 | #ifdef CONFIG_SUSPEND |
| 155 | 78 | static int omap_pm_enter(suspend_state_t suspend_state) |
| 156 | 79 | { |
| @@ -208,25 +131,6 @@ void omap_common_suspend_init(void *pm_suspend) · 51 unmodified lines | ||
| 208 | 131 | } |
| 209 | 132 | #endif /* CONFIG_SUSPEND */ |
| 210 | 133 | |
| 211 | −static void __init omap3_init_voltages(void) | |
| 212 | −{ | |
| 213 | − if (!soc_is_omap34xx()) | |
| 214 | − return; | |
| 215 | − | |
| 216 | − omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu"); | |
| 217 | − omap2_set_init_voltage("core", "l3_ick", "l3_main"); | |
| 218 | −} | |
| 219 | − | |
| 220 | −static void __init omap4_init_voltages(void) | |
| 221 | −{ | |
| 222 | − if (!soc_is_omap44xx()) | |
| 223 | − return; | |
| 224 | − | |
| 225 | − omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu"); | |
| 226 | − omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1"); | |
| 227 | − omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva"); | |
| 228 | −} | |
| 229 | − | |
| 230 | 134 | int __maybe_unused omap_pm_nop_init(void) |
| 231 | 135 | { |
| 232 | 136 | return 0; |
| @@ -246,10 +150,6 @@ int __init omap2_common_pm_late_init(void) · 13 unmodified lines | ||
| 246 | 150 | omap4_twl_init(); |
| 247 | 151 | omap_voltage_late_init(); |
| 248 | 152 | |
| 249 | − /* Initialize the voltages */ | |
| 250 | − omap3_init_voltages(); | |
| 251 | − omap4_init_voltages(); | |
| 252 | − | |
| 253 | 153 | /* Smartreflex device init */ |
| 254 | 154 | omap_devinit_smartreflex(); |
| 255 | 155 | |
| @@ -1,3 +1,2 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o |
| 3 | −obj-$(CONFIG_XEN_EFI) += efi.o | |
| @@ -1,28 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * Copyright (c) 2015, Linaro Limited, Shannon Zhao | |
| 4 | − */ | |
| 5 | − | |
| 6 | −#include <linux/efi.h> | |
| 7 | −#include <xen/xen-ops.h> | |
| 8 | −#include <asm/xen/xen-ops.h> | |
| 9 | − | |
| 10 | −/* Set XEN EFI runtime services function pointers. Other fields of struct efi, | |
| 11 | − * e.g. efi.systab, will be set like normal EFI. | |
| 12 | − */ | |
| 13 | −void __init xen_efi_runtime_setup(void) | |
| 14 | −{ | |
| 15 | − efi.get_time = xen_efi_get_time; | |
| 16 | − efi.set_time = xen_efi_set_time; | |
| 17 | − efi.get_wakeup_time = xen_efi_get_wakeup_time; | |
| 18 | − efi.set_wakeup_time = xen_efi_set_wakeup_time; | |
| 19 | − efi.get_variable = xen_efi_get_variable; | |
| 20 | − efi.get_next_variable = xen_efi_get_next_variable; | |
| 21 | − efi.set_variable = xen_efi_set_variable; | |
| 22 | − efi.query_variable_info = xen_efi_query_variable_info; | |
| 23 | − efi.update_capsule = xen_efi_update_capsule; | |
| 24 | − efi.query_capsule_caps = xen_efi_query_capsule_caps; | |
| 25 | − efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; | |
| 26 | − efi.reset_system = xen_efi_reset_system; | |
| 27 | −} | |
| 28 | −EXPORT_SYMBOL_GPL(xen_efi_runtime_setup); | |
| @@ -15,7 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <xen/xen-ops.h> |
| 16 | 16 | #include <asm/xen/hypervisor.h> |
| 17 | 17 | #include <asm/xen/hypercall.h> |
| 18 | −#include <asm/xen/xen-ops.h> | |
| 19 | 18 | #include <asm/system_misc.h> |
| 20 | 19 | #include <asm/efi.h> |
| 21 | 20 | #include <linux/interrupt.h> |
| @@ -437,7 +436,7 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op); · 415 unmodified lines | ||
| 437 | 436 | EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op); |
| 438 | 437 | EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op); |
| 439 | 438 | EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op); |
| 440 | −EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op); | |
| 439 | +EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw); | |
| 441 | 440 | EXPORT_SYMBOL_GPL(HYPERVISOR_multicall); |
| 442 | 441 | EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist); |
| 443 | 442 | EXPORT_SYMBOL_GPL(HYPERVISOR_dm_op); |
| @@ -28,7 +28,10 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order) · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | for_each_memblock(memory, reg) { |
| 30 | 30 | if (reg->base < (phys_addr_t)0xffffffff) { |
| 31 | − flags |= __GFP_DMA; | |
| 31 | + if (IS_ENABLED(CONFIG_ZONE_DMA32)) | |
| 32 | + flags |= __GFP_DMA32; | |
| 33 | + else | |
| 34 | + flags |= __GFP_DMA; | |
| 32 | 35 | break; |
| 33 | 36 | } |
| 34 | 37 | } |
| @@ -110,7 +110,6 @@ config ARM64 · 109 unmodified lines | ||
| 110 | 110 | select GENERIC_STRNLEN_USER |
| 111 | 111 | select GENERIC_TIME_VSYSCALL |
| 112 | 112 | select GENERIC_GETTIMEOFDAY |
| 113 | − select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT) | |
| 114 | 113 | select HANDLE_DOMAIN_IRQ |
| 115 | 114 | select HARDIRQS_SW_RESEND |
| 116 | 115 | select HAVE_PCI |
| @@ -1159,7 +1158,7 @@ menuconfig COMPAT · 1042 unmodified lines | ||
| 1159 | 1158 | if COMPAT |
| 1160 | 1159 | |
| 1161 | 1160 | config KUSER_HELPERS |
| 1162 | − bool "Enable kuser helpers page for 32 bit applications" | |
| 1161 | + bool "Enable kuser helpers page for 32-bit applications" | |
| 1163 | 1162 | default y |
| 1164 | 1163 | help |
| 1165 | 1164 | Warning: disabling this option may break 32-bit user programs. |
| @@ -1185,6 +1184,18 @@ config KUSER_HELPERS · 19 unmodified lines | ||
| 1185 | 1184 | Say N here only if you are absolutely certain that you do not |
| 1186 | 1185 | need these helpers; otherwise, the safe option is to say Y. |
| 1187 | 1186 | |
| 1187 | +config COMPAT_VDSO | |
| 1188 | + bool "Enable vDSO for 32-bit applications" | |
| 1189 | + depends on !CPU_BIG_ENDIAN && "$(CROSS_COMPILE_COMPAT)" != "" | |
| 1190 | + select GENERIC_COMPAT_VDSO | |
| 1191 | + default y | |
| 1192 | + help | |
| 1193 | + Place in the process address space of 32-bit applications an | |
| 1194 | + ELF shared object providing fast implementations of gettimeofday | |
| 1195 | + and clock_gettime. | |
| 1196 | + | |
| 1197 | + You must have a 32-bit build of glibc 2.22 or later for programs | |
| 1198 | + to seamlessly take advantage of this. | |
| 1188 | 1199 | |
| 1189 | 1200 | menuconfig ARMV8_DEPRECATED |
| 1190 | 1201 | bool "Emulate deprecated/obsolete ARMv8 instructions" |
| @@ -53,22 +53,6 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable) · 52 unmodified lines | ||
| 53 | 53 | endif |
| 54 | 54 | endif |
| 55 | 55 | |
| 56 | −ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y) | |
| 57 | − CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%) | |
| 58 | − | |
| 59 | − ifeq ($(CONFIG_CC_IS_CLANG), y) | |
| 60 | − $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built) | |
| 61 | − else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),) | |
| 62 | − $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built) | |
| 63 | − else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),) | |
| 64 | − $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT) | |
| 65 | − else | |
| 66 | − export CROSS_COMPILE_COMPAT | |
| 67 | − export CONFIG_COMPAT_VDSO := y | |
| 68 | − compat_vdso := -DCONFIG_COMPAT_VDSO=1 | |
| 69 | − endif | |
| 70 | −endif | |
| 71 | − | |
| 72 | 56 | KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) \ |
| 73 | 57 | $(compat_vdso) $(cc_has_k_constraint) |
| 74 | 58 | KBUILD_CFLAGS += -fno-asynchronous-unwind-tables |
| @@ -104,6 +104,7 @@ · 103 unmodified lines | ||
| 104 | 104 | |
| 105 | 105 | &ehci0 { |
| 106 | 106 | phys = <&usbphy 0>; |
| 107 | + phy-names = "usb"; | |
| 107 | 108 | status = "okay"; |
| 108 | 109 | }; |
| 109 | 110 | |
| @@ -150,6 +151,7 @@ · 40 unmodified lines | ||
| 150 | 151 | |
| 151 | 152 | &ohci0 { |
| 152 | 153 | phys = <&usbphy 0>; |
| 154 | + phy-names = "usb"; | |
| 153 | 155 | status = "okay"; |
| 154 | 156 | }; |
| 155 | 157 | |
| @@ -553,6 +553,7 @@ · 552 unmodified lines | ||
| 553 | 553 | resets = <&ccu RST_BUS_OHCI1>, |
| 554 | 554 | <&ccu RST_BUS_EHCI1>; |
| 555 | 555 | phys = <&usbphy 1>; |
| 556 | + phy-names = "usb"; | |
| 556 | 557 | status = "disabled"; |
| 557 | 558 | }; |
| 558 | 559 | |
| @@ -564,6 +565,7 @@ · 5 unmodified lines | ||
| 564 | 565 | <&ccu CLK_USB_OHCI1>; |
| 565 | 566 | resets = <&ccu RST_BUS_OHCI1>; |
| 566 | 567 | phys = <&usbphy 1>; |
| 568 | + phy-names = "usb"; | |
| 567 | 569 | status = "disabled"; |
| 568 | 570 | }; |
| 569 | 571 | |
| @@ -547,6 +547,7 @@ · 546 unmodified lines | ||
| 547 | 547 | resets = <&ccu RST_BUS_OHCI3>, |
| 548 | 548 | <&ccu RST_BUS_EHCI3>; |
| 549 | 549 | phys = <&usb2phy 3>; |
| 550 | + phy-names = "usb"; | |
| 550 | 551 | status = "disabled"; |
| 551 | 552 | }; |
| 552 | 553 | |
| @@ -558,6 +559,7 @@ · 5 unmodified lines | ||
| 558 | 559 | <&ccu CLK_USB_OHCI3>; |
| 559 | 560 | resets = <&ccu RST_BUS_OHCI3>; |
| 560 | 561 | phys = <&usb2phy 3>; |
| 562 | + phy-names = "usb"; | |
| 561 | 563 | status = "disabled"; |
| 562 | 564 | }; |
| 563 | 565 | |
| @@ -723,7 +723,7 @@ CONFIG_TEGRA_IOMMU_SMMU=y · 722 unmodified lines | ||
| 723 | 723 | CONFIG_ARM_SMMU=y |
| 724 | 724 | CONFIG_ARM_SMMU_V3=y |
| 725 | 725 | CONFIG_QCOM_IOMMU=y |
| 726 | −CONFIG_REMOTEPROC=m | |
| 726 | +CONFIG_REMOTEPROC=y | |
| 727 | 727 | CONFIG_QCOM_Q6V5_MSS=m |
| 728 | 728 | CONFIG_QCOM_Q6V5_PAS=m |
| 729 | 729 | CONFIG_QCOM_SYSMON=m |
| @@ -321,7 +321,8 @@ static inline s64 __lse_atomic64_dec_if_positive(atomic64_t *v) · 320 unmodified lines | ||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | #define __CMPXCHG_CASE(w, sfx, name, sz, mb, cl...) \ |
| 324 | −static inline u##sz __lse__cmpxchg_case_##name##sz(volatile void *ptr, \ | |
| 324 | +static __always_inline u##sz \ | |
| 325 | +__lse__cmpxchg_case_##name##sz(volatile void *ptr, \ | |
| 325 | 326 | u##sz old, \ |
| 326 | 327 | u##sz new) \ |
| 327 | 328 | { \ |
| @@ -362,7 +363,8 @@ __CMPXCHG_CASE(x, , mb_, 64, al, "memory") · 34 unmodified lines | ||
| 362 | 363 | #undef __CMPXCHG_CASE |
| 363 | 364 | |
| 364 | 365 | #define __CMPXCHG_DBL(name, mb, cl...) \ |
| 365 | −static inline long __lse__cmpxchg_double##name(unsigned long old1, \ | |
| 366 | +static __always_inline long \ | |
| 367 | +__lse__cmpxchg_double##name(unsigned long old1, \ | |
| 366 | 368 | unsigned long old2, \ |
| 367 | 369 | unsigned long new1, \ |
| 368 | 370 | unsigned long new2, \ |
| @@ -47,30 +47,6 @@ · 46 unmodified lines | ||
| 47 | 47 | #define read_sysreg_el2(r) read_sysreg_elx(r, _EL2, _EL1) |
| 48 | 48 | #define write_sysreg_el2(v,r) write_sysreg_elx(v, r, _EL2, _EL1) |
| 49 | 49 | |
| 50 | −/** | |
| 51 | − * hyp_alternate_select - Generates patchable code sequences that are | |
| 52 | − * used to switch between two implementations of a function, depending | |
| 53 | − * on the availability of a feature. | |
| 54 | − * | |
| 55 | − * @fname: a symbol name that will be defined as a function returning a | |
| 56 | − * function pointer whose type will match @orig and @alt | |
| 57 | − * @orig: A pointer to the default function, as returned by @fname when | |
| 58 | − * @cond doesn't hold | |
| 59 | − * @alt: A pointer to the alternate function, as returned by @fname | |
| 60 | − * when @cond holds | |
| 61 | − * @cond: a CPU feature (as described in asm/cpufeature.h) | |
| 62 | − */ | |
| 63 | −#define hyp_alternate_select(fname, orig, alt, cond) \ | |
| 64 | −typeof(orig) * __hyp_text fname(void) \ | |
| 65 | −{ \ | |
| 66 | − typeof(alt) *val = orig; \ | |
| 67 | − asm volatile(ALTERNATIVE("nop \n", \ | |
| 68 | − "mov %0, %1 \n", \ | |
| 69 | − cond) \ | |
| 70 | − : "+r" (val) : "r" (alt)); \ | |
| 71 | − return val; \ | |
| 72 | −} | |
| 73 | − | |
| 74 | 50 | int __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu); |
| 75 | 51 | |
| 76 | 52 | void __vgic_v3_save_state(struct kvm_vcpu *vcpu); |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory") |
| 22 | 22 | |
| 23 | −#if __LINUX_ARM_ARCH__ >= 8 | |
| 23 | +#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD) | |
| 24 | 24 | #define aarch32_smp_mb() dmb(ish) |
| 25 | 25 | #define aarch32_smp_rmb() dmb(ishld) |
| 26 | 26 | #define aarch32_smp_wmb() dmb(ishst) |
| @@ -1,33 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | −/* | |
| 3 | − * Copyright (C) 2012 ARM Limited | |
| 4 | − */ | |
| 5 | −#ifndef __ASM_VDSO_DATAPAGE_H | |
| 6 | −#define __ASM_VDSO_DATAPAGE_H | |
| 7 | − | |
| 8 | −#ifndef __ASSEMBLY__ | |
| 9 | − | |
| 10 | −struct vdso_data { | |
| 11 | − __u64 cs_cycle_last; /* Timebase at clocksource init */ | |
| 12 | − __u64 raw_time_sec; /* Raw time */ | |
| 13 | − __u64 raw_time_nsec; | |
| 14 | − __u64 xtime_clock_sec; /* Kernel time */ | |
| 15 | − __u64 xtime_clock_nsec; | |
| 16 | − __u64 xtime_coarse_sec; /* Coarse time */ | |
| 17 | − __u64 xtime_coarse_nsec; | |
| 18 | − __u64 wtm_clock_sec; /* Wall to monotonic time */ | |
| 19 | − __u64 wtm_clock_nsec; | |
| 20 | − __u32 tb_seq_count; /* Timebase sequence counter */ | |
| 21 | − /* cs_* members must be adjacent and in this order (ldp accesses) */ | |
| 22 | − __u32 cs_mono_mult; /* NTP-adjusted clocksource multiplier */ | |
| 23 | − __u32 cs_shift; /* Clocksource shift (mono = raw) */ | |
| 24 | − __u32 cs_raw_mult; /* Raw clocksource multiplier */ | |
| 25 | − __u32 tz_minuteswest; /* Whacky timezone stuff */ | |
| 26 | − __u32 tz_dsttime; | |
| 27 | − __u32 use_syscall; | |
| 28 | − __u32 hrtimer_res; | |
| 29 | −}; | |
| 30 | − | |
| 31 | −#endif /* !__ASSEMBLY__ */ | |
| 32 | − | |
| 33 | −#endif /* __ASM_VDSO_DATAPAGE_H */ | |
| @@ -1,7 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef _ASM_XEN_OPS_H | |
| 3 | −#define _ASM_XEN_OPS_H | |
| 4 | − | |
| 5 | −void xen_efi_runtime_setup(void); | |
| 6 | − | |
| 7 | −#endif /* _ASM_XEN_OPS_H */ | |
| @@ -174,6 +174,9 @@ static void __init register_insn_emulation(struct insn_emulation_ops *ops) · 173 unmodified lines | ||
| 174 | 174 | struct insn_emulation *insn; |
| 175 | 175 | |
| 176 | 176 | insn = kzalloc(sizeof(*insn), GFP_KERNEL); |
| 177 | + if (!insn) | |
| 178 | + return; | |
| 179 | + | |
| 177 | 180 | insn->ops = ops; |
| 178 | 181 | insn->min = INSN_UNDEF; |
| 179 | 182 | |
| @@ -233,6 +236,8 @@ static void __init register_insn_emulation_sysctl(void) · 53 unmodified lines | ||
| 233 | 236 | |
| 234 | 237 | insns_sysctl = kcalloc(nr_insn_emulated + 1, sizeof(*sysctl), |
| 235 | 238 | GFP_KERNEL); |
| 239 | + if (!insns_sysctl) | |
| 240 | + return; | |
| 236 | 241 | |
| 237 | 242 | raw_spin_lock_irqsave(&insn_emulation_lock, flags); |
| 238 | 243 | list_for_each_entry(insn, &insn_emulation, node) { |
| @@ -128,8 +128,8 @@ static void install_bp_hardening_cb(bp_hardening_cb_t fn, · 127 unmodified lines | ||
| 128 | 128 | int cpu, slot = -1; |
| 129 | 129 | |
| 130 | 130 | /* |
| 131 | − * enable_smccc_arch_workaround_1() passes NULL for the hyp_vecs | |
| 132 | − * start/end if we're a guest. Skip the hyp-vectors work. | |
| 131 | + * detect_harden_bp_fw() passes NULL for the hyp_vecs start/end if | |
| 132 | + * we're a guest. Skip the hyp-vectors work. | |
| 133 | 133 | */ |
| 134 | 134 | if (!hyp_vecs_start) { |
| 135 | 135 | __this_cpu_write(bp_hardening_data.fn, fn); |
| @@ -136,6 +136,7 @@ static const struct arm64_ftr_bits ftr_id_aa64isar0[] = { · 135 unmodified lines | ||
| 136 | 136 | |
| 137 | 137 | static const struct arm64_ftr_bits ftr_id_aa64isar1[] = { |
| 138 | 138 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR1_SB_SHIFT, 4, 0), |
| 139 | + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR1_FRINTTS_SHIFT, 4, 0), | |
| 139 | 140 | ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH), |
| 140 | 141 | FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR1_GPI_SHIFT, 4, 0), |
| 141 | 142 | ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH), |
| @@ -775,6 +775,7 @@ el0_sync_compat: · 774 unmodified lines | ||
| 775 | 775 | b.ge el0_dbg |
| 776 | 776 | b el0_inv |
| 777 | 777 | el0_svc_compat: |
| 778 | + gic_prio_kentry_setup tmp=x1 | |
| 778 | 779 | mov x0, sp |
| 779 | 780 | bl el0_svc_compat_handler |
| 780 | 781 | b ret_to_user |
| @@ -121,10 +121,16 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) · 120 unmodified lines | ||
| 121 | 121 | |
| 122 | 122 | /* |
| 123 | 123 | * Ensure updated trampoline is visible to instruction |
| 124 | − * fetch before we patch in the branch. | |
| 124 | + * fetch before we patch in the branch. Although the | |
| 125 | + * architecture doesn't require an IPI in this case, | |
| 126 | + * Neoverse-N1 erratum #1542419 does require one | |
| 127 | + * if the TLB maintenance in module_enable_ro() is | |
| 128 | + * skipped due to rodata_enabled. It doesn't seem worth | |
| 129 | + * it to make it conditional given that this is | |
| 130 | + * certainly not a fast-path. | |
| 125 | 131 | */ |
| 126 | − __flush_icache_range((unsigned long)&dst[0], | |
| 127 | − (unsigned long)&dst[1]); | |
| 132 | + flush_icache_range((unsigned long)&dst[0], | |
| 133 | + (unsigned long)&dst[1]); | |
| 128 | 134 | } |
| 129 | 135 | addr = (unsigned long)dst; |
| 130 | 136 | #else /* CONFIG_ARM64_MODULE_PLTS */ |
| @@ -332,22 +332,27 @@ void arch_release_task_struct(struct task_struct *tsk) · 331 unmodified lines | ||
| 332 | 332 | fpsimd_release_task(tsk); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | −/* | |
| 336 | − * src and dst may temporarily have aliased sve_state after task_struct | |
| 337 | − * is copied. We cannot fix this properly here, because src may have | |
| 338 | − * live SVE state and dst's thread_info may not exist yet, so tweaking | |
| 339 | − * either src's or dst's TIF_SVE is not safe. | |
| 340 | − * | |
| 341 | − * The unaliasing is done in copy_thread() instead. This works because | |
| 342 | − * dst is not schedulable or traceable until both of these functions | |
| 343 | − * have been called. | |
| 344 | − */ | |
| 345 | 335 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
| 346 | 336 | { |
| 347 | 337 | if (current->mm) |
| 348 | 338 | fpsimd_preserve_current_state(); |
| 349 | 339 | *dst = *src; |
| 350 | 340 | |
| 341 | + /* We rely on the above assignment to initialize dst's thread_flags: */ | |
| 342 | + BUILD_BUG_ON(!IS_ENABLED(CONFIG_THREAD_INFO_IN_TASK)); | |
| 343 | + | |
| 344 | + /* | |
| 345 | + * Detach src's sve_state (if any) from dst so that it does not | |
| 346 | + * get erroneously used or freed prematurely. dst's sve_state | |
| 347 | + * will be allocated on demand later on if dst uses SVE. | |
| 348 | + * For consistency, also clear TIF_SVE here: this could be done | |
| 349 | + * later in copy_process(), but to avoid tripping up future | |
| 350 | + * maintainers it is best not to leave TIF_SVE and sve_state in | |
| 351 | + * an inconsistent state, even temporarily. | |
| 352 | + */ | |
| 353 | + dst->thread.sve_state = NULL; | |
| 354 | + clear_tsk_thread_flag(dst, TIF_SVE); | |
| 355 | + | |
| 351 | 356 | return 0; |
| 352 | 357 | } |
| 353 | 358 | |
| @@ -360,13 +365,6 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, · 6 unmodified lines | ||
| 360 | 365 | |
| 361 | 366 | memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); |
| 362 | 367 | |
| 363 | − /* | |
| 364 | − * Unalias p->thread.sve_state (if any) from the parent task | |
| 365 | − * and disable discard SVE state for p: | |
| 366 | − */ | |
| 367 | − clear_tsk_thread_flag(p, TIF_SVE); | |
| 368 | − p->thread.sve_state = NULL; | |
| 369 | − | |
| 370 | 368 | /* |
| 371 | 369 | * In case p was allocated the same task_struct pointer as some |
| 372 | 370 | * other recently-exited task, make sure p is disassociated from |
Empty file deleted.
| @@ -8,15 +8,21 @@ · 7 unmodified lines | ||
| 8 | 8 | ARCH_REL_TYPE_ABS := R_ARM_JUMP_SLOT|R_ARM_GLOB_DAT|R_ARM_ABS32 |
| 9 | 9 | include $(srctree)/lib/vdso/Makefile |
| 10 | 10 | |
| 11 | −COMPATCC := $(CROSS_COMPILE_COMPAT)gcc | |
| 11 | +# Same as cc-*option, but using CC_COMPAT instead of CC | |
| 12 | +ifeq ($(CONFIG_CC_IS_CLANG), y) | |
| 13 | +CC_COMPAT ?= $(CC) | |
| 14 | +else | |
| 15 | +CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc | |
| 16 | +endif | |
| 12 | 17 | |
| 13 | −# Same as cc-*option, but using COMPATCC instead of CC | |
| 14 | 18 | cc32-option = $(call try-run,\ |
| 15 | − $(COMPATCC) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) | |
| 19 | + $(CC_COMPAT) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) | |
| 16 | 20 | cc32-disable-warning = $(call try-run,\ |
| 17 | − $(COMPATCC) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) | |
| 21 | + $(CC_COMPAT) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) | |
| 18 | 22 | cc32-ldoption = $(call try-run,\ |
| 19 | − $(COMPATCC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) | |
| 23 | + $(CC_COMPAT) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) | |
| 24 | +cc32-as-instr = $(call try-run,\ | |
| 25 | + printf "%b\n" "$(1)" | $(CC_COMPAT) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) | |
| 20 | 26 | |
| 21 | 27 | # We cannot use the global flags to compile the vDSO files, the main reason |
| 22 | 28 | # being that the 32-bit compiler may be older than the main (64-bit) compiler |
| @@ -25,22 +31,21 @@ cc32-ldoption = $(call try-run,\ · 2 unmodified lines | ||
| 25 | 31 | # arm64 one. |
| 26 | 32 | # As a result we set our own flags here. |
| 27 | 33 | |
| 28 | −# From top-level Makefile | |
| 29 | −# NOSTDINC_FLAGS | |
| 30 | −VDSO_CPPFLAGS := -nostdinc -isystem $(shell $(COMPATCC) -print-file-name=include) | |
| 34 | +# KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile | |
| 35 | +VDSO_CPPFLAGS := -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include) | |
| 31 | 36 | VDSO_CPPFLAGS += $(LINUXINCLUDE) |
| 32 | −VDSO_CPPFLAGS += $(KBUILD_CPPFLAGS) | |
| 33 | 37 | |
| 34 | 38 | # Common C and assembly flags |
| 35 | 39 | # From top-level Makefile |
| 36 | 40 | VDSO_CAFLAGS := $(VDSO_CPPFLAGS) |
| 41 | +ifneq ($(shell $(CC_COMPAT) --version 2>&1 | head -n 1 | grep clang),) | |
| 42 | +VDSO_CAFLAGS += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%)) | |
| 43 | +endif | |
| 44 | + | |
| 37 | 45 | VDSO_CAFLAGS += $(call cc32-option,-fno-PIE) |
| 38 | 46 | ifdef CONFIG_DEBUG_INFO |
| 39 | 47 | VDSO_CAFLAGS += -g |
| 40 | 48 | endif |
| 41 | −ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(COMPATCC)), y) | |
| 42 | −VDSO_CAFLAGS += -DCC_HAVE_ASM_GOTO | |
| 43 | −endif | |
| 44 | 49 | |
| 45 | 50 | # From arm Makefile |
| 46 | 51 | VDSO_CAFLAGS += $(call cc32-option,-fno-dwarf2-cfi-asm) |
| @@ -55,6 +60,7 @@ endif · 8 unmodified lines | ||
| 55 | 60 | VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector |
| 56 | 61 | VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING |
| 57 | 62 | |
| 63 | + | |
| 58 | 64 | # Try to compile for ARMv8. If the compiler is too old and doesn't support it, |
| 59 | 65 | # fall back to v7. There is no easy way to check for what architecture the code |
| 60 | 66 | # is being compiled, so define a macro specifying that (see arch/arm/Makefile). |
| @@ -91,6 +97,12 @@ VDSO_CFLAGS += -Wno-int-to-pointer-cast · 30 unmodified lines | ||
| 91 | 97 | VDSO_AFLAGS := $(VDSO_CAFLAGS) |
| 92 | 98 | VDSO_AFLAGS += -D__ASSEMBLY__ |
| 93 | 99 | |
| 100 | +# Check for binutils support for dmb ishld | |
| 101 | +dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1) | |
| 102 | + | |
| 103 | +VDSO_CFLAGS += $(dmbinstr) | |
| 104 | +VDSO_AFLAGS += $(dmbinstr) | |
| 105 | + | |
| 94 | 106 | VDSO_LDFLAGS := $(VDSO_CPPFLAGS) |
| 95 | 107 | # From arm vDSO Makefile |
| 96 | 108 | VDSO_LDFLAGS += -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 |
| @@ -159,14 +171,14 @@ quiet_cmd_vdsold_and_vdso_check = LD32 $@ · 62 unmodified lines | ||
| 159 | 171 | cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check) |
| 160 | 172 | |
| 161 | 173 | quiet_cmd_vdsold = LD32 $@ |
| 162 | − cmd_vdsold = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \ | |
| 174 | + cmd_vdsold = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \ | |
| 163 | 175 | -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@ |
| 164 | 176 | quiet_cmd_vdsocc = CC32 $@ |
| 165 | − cmd_vdsocc = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) -c -o $@ $< | |
| 177 | + cmd_vdsocc = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) -c -o $@ $< | |
| 166 | 178 | quiet_cmd_vdsocc_gettimeofday = CC32 $@ |
| 167 | − cmd_vdsocc_gettimeofday = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) $(VDSO_CFLAGS_gettimeofday_o) -c -o $@ $< | |
| 179 | + cmd_vdsocc_gettimeofday = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) $(VDSO_CFLAGS_gettimeofday_o) -c -o $@ $< | |
| 168 | 180 | quiet_cmd_vdsoas = AS32 $@ |
| 169 | − cmd_vdsoas = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_AFLAGS) -c -o $@ $< | |
| 181 | + cmd_vdsoas = $(CC_COMPAT) -Wp,-MD,$(depfile) $(VDSO_AFLAGS) -c -o $@ $< | |
| 170 | 182 | |
| 171 | 183 | quiet_cmd_vdsomunge = MUNGE $@ |
| 172 | 184 | cmd_vdsomunge = $(obj)/$(munge) $< $@ |
| @@ -229,20 +229,6 @@ static void __hyp_text __hyp_vgic_restore_state(struct kvm_vcpu *vcpu) · 228 unmodified lines | ||
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | −static bool __hyp_text __true_value(void) | |
| 233 | −{ | |
| 234 | − return true; | |
| 235 | −} | |
| 236 | − | |
| 237 | −static bool __hyp_text __false_value(void) | |
| 238 | −{ | |
| 239 | − return false; | |
| 240 | −} | |
| 241 | − | |
| 242 | −static hyp_alternate_select(__check_arm_834220, | |
| 243 | − __false_value, __true_value, | |
| 244 | − ARM64_WORKAROUND_834220); | |
| 245 | − | |
| 246 | 232 | static bool __hyp_text __translate_far_to_hpfar(u64 far, u64 *hpfar) |
| 247 | 233 | { |
| 248 | 234 | u64 par, tmp; |
| @@ -298,7 +284,8 @@ static bool __hyp_text __populate_fault_info(struct kvm_vcpu *vcpu) · 49 unmodified lines | ||
| 298 | 284 | * resolve the IPA using the AT instruction. |
| 299 | 285 | */ |
| 300 | 286 | if (!(esr & ESR_ELx_S1PTW) && |
| 301 | − (__check_arm_834220()() || (esr & ESR_ELx_FSC_TYPE) == FSC_PERM)) { | |
| 287 | + (cpus_have_const_cap(ARM64_WORKAROUND_834220) || | |
| 288 | + (esr & ESR_ELx_FSC_TYPE) == FSC_PERM)) { | |
| 302 | 289 | if (!__translate_far_to_hpfar(far, &hpfar)) |
| 303 | 290 | return false; |
| 304 | 291 | } else { |
| @@ -67,10 +67,14 @@ static void __hyp_text __tlb_switch_to_guest_nvhe(struct kvm *kvm, · 66 unmodified lines | ||
| 67 | 67 | isb(); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | −static hyp_alternate_select(__tlb_switch_to_guest, | |
| 71 | − __tlb_switch_to_guest_nvhe, | |
| 72 | − __tlb_switch_to_guest_vhe, | |
| 73 | − ARM64_HAS_VIRT_HOST_EXTN); | |
| 70 | +static void __hyp_text __tlb_switch_to_guest(struct kvm *kvm, | |
| 71 | + struct tlb_inv_context *cxt) | |
| 72 | +{ | |
| 73 | + if (has_vhe()) | |
| 74 | + __tlb_switch_to_guest_vhe(kvm, cxt); | |
| 75 | + else | |
| 76 | + __tlb_switch_to_guest_nvhe(kvm, cxt); | |
| 77 | +} | |
| 74 | 78 | |
| 75 | 79 | static void __hyp_text __tlb_switch_to_host_vhe(struct kvm *kvm, |
| 76 | 80 | struct tlb_inv_context *cxt) |
| @@ -98,10 +102,14 @@ static void __hyp_text __tlb_switch_to_host_nvhe(struct kvm *kvm, · 21 unmodified lines | ||
| 98 | 102 | write_sysreg(0, vttbr_el2); |
| 99 | 103 | } |
| 100 | 104 | |
| 101 | −static hyp_alternate_select(__tlb_switch_to_host, | |
| 102 | − __tlb_switch_to_host_nvhe, | |
| 103 | − __tlb_switch_to_host_vhe, | |
| 104 | − ARM64_HAS_VIRT_HOST_EXTN); | |
| 105 | +static void __hyp_text __tlb_switch_to_host(struct kvm *kvm, | |
| 106 | + struct tlb_inv_context *cxt) | |
| 107 | +{ | |
| 108 | + if (has_vhe()) | |
| 109 | + __tlb_switch_to_host_vhe(kvm, cxt); | |
| 110 | + else | |
| 111 | + __tlb_switch_to_host_nvhe(kvm, cxt); | |
| 112 | +} | |
| 105 | 113 | |
| 106 | 114 | void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) |
| 107 | 115 | { |
| @@ -111,7 +119,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) · 3 unmodified lines | ||
| 111 | 119 | |
| 112 | 120 | /* Switch to requested VMID */ |
| 113 | 121 | kvm = kern_hyp_va(kvm); |
| 114 | − __tlb_switch_to_guest()(kvm, &cxt); | |
| 122 | + __tlb_switch_to_guest(kvm, &cxt); | |
| 115 | 123 | |
| 116 | 124 | /* |
| 117 | 125 | * We could do so much better if we had the VA as well. |
| @@ -154,7 +162,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) · 36 unmodified lines | ||
| 154 | 162 | if (!has_vhe() && icache_is_vpipt()) |
| 155 | 163 | __flush_icache_all(); |
| 156 | 164 | |
| 157 | − __tlb_switch_to_host()(kvm, &cxt); | |
| 165 | + __tlb_switch_to_host(kvm, &cxt); | |
| 158 | 166 | } |
| 159 | 167 | |
| 160 | 168 | void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) |
| @@ -165,13 +173,13 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) · 4 unmodified lines | ||
| 165 | 173 | |
| 166 | 174 | /* Switch to requested VMID */ |
| 167 | 175 | kvm = kern_hyp_va(kvm); |
| 168 | − __tlb_switch_to_guest()(kvm, &cxt); | |
| 176 | + __tlb_switch_to_guest(kvm, &cxt); | |
| 169 | 177 | |
| 170 | 178 | __tlbi(vmalls12e1is); |
| 171 | 179 | dsb(ish); |
| 172 | 180 | isb(); |
| 173 | 181 | |
| 174 | − __tlb_switch_to_host()(kvm, &cxt); | |
| 182 | + __tlb_switch_to_host(kvm, &cxt); | |
| 175 | 183 | } |
| 176 | 184 | |
| 177 | 185 | void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) |
| @@ -180,13 +188,13 @@ void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) · 2 unmodified lines | ||
| 180 | 188 | struct tlb_inv_context cxt; |
| 181 | 189 | |
| 182 | 190 | /* Switch to requested VMID */ |
| 183 | − __tlb_switch_to_guest()(kvm, &cxt); | |
| 191 | + __tlb_switch_to_guest(kvm, &cxt); | |
| 184 | 192 | |
| 185 | 193 | __tlbi(vmalle1); |
| 186 | 194 | dsb(nsh); |
| 187 | 195 | isb(); |
| 188 | 196 | |
| 189 | − __tlb_switch_to_host()(kvm, &cxt); | |
| 197 | + __tlb_switch_to_host(kvm, &cxt); | |
| 190 | 198 | } |
| 191 | 199 | |
| 192 | 200 | void __hyp_text __kvm_flush_vm_context(void) |
| @@ -113,6 +113,15 @@ static inline bool is_ttbr1_addr(unsigned long addr) · 112 unmodified lines | ||
| 113 | 113 | return arch_kasan_reset_tag(addr) >= PAGE_OFFSET; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | +static inline unsigned long mm_to_pgd_phys(struct mm_struct *mm) | |
| 117 | +{ | |
| 118 | + /* Either init_pg_dir or swapper_pg_dir */ | |
| 119 | + if (mm == &init_mm) | |
| 120 | + return __pa_symbol(mm->pgd); | |
| 121 | + | |
| 122 | + return (unsigned long)virt_to_phys(mm->pgd); | |
| 123 | +} | |
| 124 | + | |
| 116 | 125 | /* |
| 117 | 126 | * Dump out the page tables associated with 'addr' in the currently active mm. |
| 118 | 127 | */ |
| @@ -141,7 +150,7 @@ static void show_pte(unsigned long addr) · 22 unmodified lines | ||
| 141 | 150 | |
| 142 | 151 | pr_alert("%s pgtable: %luk pages, %llu-bit VAs, pgdp=%016lx\n", |
| 143 | 152 | mm == &init_mm ? "swapper" : "user", PAGE_SIZE / SZ_1K, |
| 144 | − vabits_actual, (unsigned long)virt_to_phys(mm->pgd)); | |
| 153 | + vabits_actual, mm_to_pgd_phys(mm)); | |
| 145 | 154 | pgdp = pgd_offset(mm, addr); |
| 146 | 155 | pgd = READ_ONCE(*pgdp); |
| 147 | 156 | pr_alert("[%016lx] pgd=%016llx", addr, pgd_val(pgd)); |
| @@ -266,7 +275,7 @@ static bool __kprobes is_spurious_el1_translation_fault(unsigned long addr, · 118 unmodified lines | ||
| 266 | 275 | * If we got a different type of fault from the AT instruction, |
| 267 | 276 | * treat the translation fault as spurious. |
| 268 | 277 | */ |
| 269 | − dfsc = FIELD_PREP(SYS_PAR_EL1_FST, par); | |
| 278 | + dfsc = FIELD_GET(SYS_PAR_EL1_FST, par); | |
| 270 | 279 | return (dfsc & ESR_ELx_FSC_TYPE) != ESR_ELx_FSC_FAULT; |
| 271 | 280 | } |
| 272 | 281 | |
| @@ -1,4 +1,3 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o) |
| 3 | 3 | obj-y := xen-arm.o hypercall.o |
| 4 | −obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o) | |
| @@ -99,7 +99,7 @@ · 98 unmodified lines | ||
| 99 | 99 | |
| 100 | 100 | miscintc: interrupt-controller@18060010 { |
| 101 | 101 | compatible = "qca,ar7240-misc-intc"; |
| 102 | − reg = <0x18060010 0x4>; | |
| 102 | + reg = <0x18060010 0x8>; | |
| 103 | 103 | |
| 104 | 104 | interrupt-parent = <&cpuintc>; |
| 105 | 105 | interrupts = <6>; |
| @@ -571,7 +571,6 @@ CONFIG_USB_SERIAL_OMNINET=m · 570 unmodified lines | ||
| 571 | 571 | CONFIG_USB_EMI62=m |
| 572 | 572 | CONFIG_USB_EMI26=m |
| 573 | 573 | CONFIG_USB_ADUTUX=m |
| 574 | −CONFIG_USB_RIO500=m | |
| 575 | 574 | CONFIG_USB_LEGOTOWER=m |
| 576 | 575 | CONFIG_USB_LCD=m |
| 577 | 576 | CONFIG_USB_CYPRESS_CY7C63=m |
| @@ -314,7 +314,6 @@ CONFIG_USB_SERIAL_SAFE_PADDED=y · 313 unmodified lines | ||
| 314 | 314 | CONFIG_USB_SERIAL_CYBERJACK=m |
| 315 | 315 | CONFIG_USB_SERIAL_XIRCOM=m |
| 316 | 316 | CONFIG_USB_SERIAL_OMNINET=m |
| 317 | −CONFIG_USB_RIO500=m | |
| 318 | 317 | CONFIG_USB_LEGOTOWER=m |
| 319 | 318 | CONFIG_USB_LCD=m |
| 320 | 319 | CONFIG_USB_CYTHERM=m |
| @@ -160,7 +160,6 @@ void __init prom_meminit(void) · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | void __init prom_free_prom_memory(void) |
| 162 | 162 | { |
| 163 | − unsigned long addr; | |
| 164 | 163 | int i; |
| 165 | 164 | |
| 166 | 165 | if (prom_flags & PROM_FLAG_DONT_FREE_TEMP) |
| @@ -43,7 +43,7 @@ · 42 unmodified lines | ||
| 43 | 43 | |
| 44 | 44 | /* O32 stack has to be 8-byte aligned. */ |
| 45 | 45 | static u64 o32_stk[4096]; |
| 46 | −#define O32_STK &o32_stk[sizeof(o32_stk)] | |
| 46 | +#define O32_STK (&o32_stk[ARRAY_SIZE(o32_stk)]) | |
| 47 | 47 | |
| 48 | 48 | #define __PROM_O32(fun, arg) fun arg __asm__(#fun); \ |
| 49 | 49 | __asm__(#fun " = call_o32") |
| @@ -77,8 +77,8 @@ extern unsigned long __xchg_called_with_bad_pointer(void) · 76 unmodified lines | ||
| 77 | 77 | extern unsigned long __xchg_small(volatile void *ptr, unsigned long val, |
| 78 | 78 | unsigned int size); |
| 79 | 79 | |
| 80 | −static inline unsigned long __xchg(volatile void *ptr, unsigned long x, | |
| 81 | − int size) | |
| 80 | +static __always_inline | |
| 81 | +unsigned long __xchg(volatile void *ptr, unsigned long x, int size) | |
| 82 | 82 | { |
| 83 | 83 | switch (size) { |
| 84 | 84 | case 1: |
| @@ -153,8 +153,9 @@ static inline unsigned long __xchg(volatile void *ptr, unsigned long x, · 68 unmodified lines | ||
| 153 | 153 | extern unsigned long __cmpxchg_small(volatile void *ptr, unsigned long old, |
| 154 | 154 | unsigned long new, unsigned int size); |
| 155 | 155 | |
| 156 | −static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | |
| 157 | − unsigned long new, unsigned int size) | |
| 156 | +static __always_inline | |
| 157 | +unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | |
| 158 | + unsigned long new, unsigned int size) | |
| 158 | 159 | { |
| 159 | 160 | switch (size) { |
| 160 | 161 | case 1: |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <asm/octeon/octeon-feature.h> |
| 37 | 37 | |
| 38 | 38 | #include <asm/octeon/cvmx-ipd-defs.h> |
| 39 | +#include <asm/octeon/cvmx-pip-defs.h> | |
| 39 | 40 | |
| 40 | 41 | enum cvmx_ipd_mode { |
| 41 | 42 | CVMX_IPD_OPC_MODE_STT = 0LL, /* All blocks DRAM, not cached in L2 */ |
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | # endif |
| 53 | 53 | #define __ARCH_WANT_SYS_FORK |
| 54 | 54 | #define __ARCH_WANT_SYS_CLONE |
| 55 | +#define __ARCH_WANT_SYS_CLONE3 | |
| 55 | 56 | |
| 56 | 57 | /* whitelists for checksyscalls */ |
| 57 | 58 | #define __IGNORE_fadvise64_64 |
| @@ -6,5 +6,16 @@ · 5 unmodified lines | ||
| 6 | 6 | #define HWCAP_MIPS_R6 (1 << 0) |
| 7 | 7 | #define HWCAP_MIPS_MSA (1 << 1) |
| 8 | 8 | #define HWCAP_MIPS_CRC32 (1 << 2) |
| 9 | +#define HWCAP_MIPS_MIPS16 (1 << 3) | |
| 10 | +#define HWCAP_MIPS_MDMX (1 << 4) | |
| 11 | +#define HWCAP_MIPS_MIPS3D (1 << 5) | |
| 12 | +#define HWCAP_MIPS_SMARTMIPS (1 << 6) | |
| 13 | +#define HWCAP_MIPS_DSP (1 << 7) | |
| 14 | +#define HWCAP_MIPS_DSP2 (1 << 8) | |
| 15 | +#define HWCAP_MIPS_DSP3 (1 << 9) | |
| 16 | +#define HWCAP_MIPS_MIPS16E2 (1 << 10) | |
| 17 | +#define HWCAP_LOONGSON_MMI (1 << 11) | |
| 18 | +#define HWCAP_LOONGSON_EXT (1 << 12) | |
| 19 | +#define HWCAP_LOONGSON_EXT2 (1 << 13) | |
| 9 | 20 | |
| 10 | 21 | #endif /* _UAPI_ASM_HWCAP_H */ |
| @@ -24,7 +24,8 @@ static char r4kwar[] __initdata = · 23 unmodified lines | ||
| 24 | 24 | static char daddiwar[] __initdata = |
| 25 | 25 | "Enable CPU_DADDI_WORKAROUNDS to rectify."; |
| 26 | 26 | |
| 27 | −static inline void align_mod(const int align, const int mod) | |
| 27 | +static __always_inline __init | |
| 28 | +void align_mod(const int align, const int mod) | |
| 28 | 29 | { |
| 29 | 30 | asm volatile( |
| 30 | 31 | ".set push\n\t" |
| @@ -38,8 +39,9 @@ static inline void align_mod(const int align, const int mod) · 7 unmodified lines | ||
| 38 | 39 | : "n"(align), "n"(mod)); |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | −static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w, | |
| 42 | − const int align, const int mod) | |
| 42 | +static __always_inline __init | |
| 43 | +void mult_sh_align_mod(long *v1, long *v2, long *w, | |
| 44 | + const int align, const int mod) | |
| 43 | 45 | { |
| 44 | 46 | unsigned long flags; |
| 45 | 47 | int m1, m2; |
| @@ -113,7 +115,7 @@ static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w, · 67 unmodified lines | ||
| 113 | 115 | *w = lw; |
| 114 | 116 | } |
| 115 | 117 | |
| 116 | −static inline void check_mult_sh(void) | |
| 118 | +static __always_inline __init void check_mult_sh(void) | |
| 117 | 119 | { |
| 118 | 120 | long v1[8], v2[8], w[8]; |
| 119 | 121 | int bug, fix, i; |
| @@ -176,7 +178,7 @@ asmlinkage void __init do_daddi_ov(struct pt_regs *regs) · 56 unmodified lines | ||
| 176 | 178 | exception_exit(prev_state); |
| 177 | 179 | } |
| 178 | 180 | |
| 179 | −static inline void check_daddi(void) | |
| 181 | +static __init void check_daddi(void) | |
| 180 | 182 | { |
| 181 | 183 | extern asmlinkage void handle_daddi_ov(void); |
| 182 | 184 | unsigned long flags; |
| @@ -242,7 +244,7 @@ static inline void check_daddi(void) · 59 unmodified lines | ||
| 242 | 244 | |
| 243 | 245 | int daddiu_bug = IS_ENABLED(CONFIG_CPU_MIPSR6) ? 0 : -1; |
| 244 | 246 | |
| 245 | −static inline void check_daddiu(void) | |
| 247 | +static __init void check_daddiu(void) | |
| 246 | 248 | { |
| 247 | 249 | long v, w, tmp; |
| 248 | 250 | |
| @@ -2180,6 +2180,39 @@ void cpu_probe(void) · 2179 unmodified lines | ||
| 2180 | 2180 | elf_hwcap |= HWCAP_MIPS_MSA; |
| 2181 | 2181 | } |
| 2182 | 2182 | |
| 2183 | + if (cpu_has_mips16) | |
| 2184 | + elf_hwcap |= HWCAP_MIPS_MIPS16; | |
| 2185 | + | |
| 2186 | + if (cpu_has_mdmx) | |
| 2187 | + elf_hwcap |= HWCAP_MIPS_MDMX; | |
| 2188 | + | |
| 2189 | + if (cpu_has_mips3d) | |
| 2190 | + elf_hwcap |= HWCAP_MIPS_MIPS3D; | |
| 2191 | + | |
| 2192 | + if (cpu_has_smartmips) | |
| 2193 | + elf_hwcap |= HWCAP_MIPS_SMARTMIPS; | |
| 2194 | + | |
| 2195 | + if (cpu_has_dsp) | |
| 2196 | + elf_hwcap |= HWCAP_MIPS_DSP; | |
| 2197 | + | |
| 2198 | + if (cpu_has_dsp2) | |
| 2199 | + elf_hwcap |= HWCAP_MIPS_DSP2; | |
| 2200 | + | |
| 2201 | + if (cpu_has_dsp3) | |
| 2202 | + elf_hwcap |= HWCAP_MIPS_DSP3; | |
| 2203 | + | |
| 2204 | + if (cpu_has_mips16e2) | |
| 2205 | + elf_hwcap |= HWCAP_MIPS_MIPS16E2; | |
| 2206 | + | |
| 2207 | + if (cpu_has_loongson_mmi) | |
| 2208 | + elf_hwcap |= HWCAP_LOONGSON_MMI; | |
| 2209 | + | |
| 2210 | + if (cpu_has_loongson_ext) | |
| 2211 | + elf_hwcap |= HWCAP_LOONGSON_EXT; | |
| 2212 | + | |
| 2213 | + if (cpu_has_loongson_ext2) | |
| 2214 | + elf_hwcap |= HWCAP_LOONGSON_EXT2; | |
| 2215 | + | |
| 2183 | 2216 | if (cpu_has_vz) |
| 2184 | 2217 | cpu_probe_vz(c); |
| 2185 | 2218 | |
| @@ -108,6 +108,9 @@ void __init add_memory_region(phys_addr_t start, phys_addr_t size, long type) · 107 unmodified lines | ||
| 108 | 108 | return; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | + if (start < PHYS_OFFSET) | |
| 112 | + return; | |
| 113 | + | |
| 111 | 114 | memblock_add(start, size); |
| 112 | 115 | /* Reserve any memory except the ordinary RAM ranges. */ |
| 113 | 116 | switch (type) { |
| @@ -321,7 +324,7 @@ static void __init bootmem_init(void) · 207 unmodified lines | ||
| 321 | 324 | * Reserve any memory between the start of RAM and PHYS_OFFSET |
| 322 | 325 | */ |
| 323 | 326 | if (ramstart > PHYS_OFFSET) |
| 324 | − memblock_reserve(PHYS_OFFSET, PFN_UP(ramstart) - PHYS_OFFSET); | |
| 327 | + memblock_reserve(PHYS_OFFSET, ramstart - PHYS_OFFSET); | |
| 325 | 328 | |
| 326 | 329 | if (PFN_UP(ramstart) > ARCH_PFN_OFFSET) { |
| 327 | 330 | pr_info("Wasting %lu bytes for tracking %lu unused pages\n", |
| @@ -80,6 +80,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len, · 79 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | save_static_function(sys_fork); |
| 82 | 82 | save_static_function(sys_clone); |
| 83 | +save_static_function(sys_clone3); | |
| 83 | 84 | |
| 84 | 85 | SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) |
| 85 | 86 | { |
| @@ -373,4 +373,4 @@ · 372 unmodified lines | ||
| 373 | 373 | 432 n32 fsmount sys_fsmount |
| 374 | 374 | 433 n32 fspick sys_fspick |
| 375 | 375 | 434 n32 pidfd_open sys_pidfd_open |
| 376 | −# 435 reserved for clone3 | |
| 376 | +435 n32 clone3 __sys_clone3 | |
| @@ -349,4 +349,4 @@ · 348 unmodified lines | ||
| 349 | 349 | 432 n64 fsmount sys_fsmount |
| 350 | 350 | 433 n64 fspick sys_fspick |
| 351 | 351 | 434 n64 pidfd_open sys_pidfd_open |
| 352 | −# 435 reserved for clone3 | |
| 352 | +435 n64 clone3 __sys_clone3 | |
| @@ -422,4 +422,4 @@ · 421 unmodified lines | ||
| 422 | 422 | 432 o32 fsmount sys_fsmount |
| 423 | 423 | 433 o32 fspick sys_fspick |
| 424 | 424 | 434 o32 pidfd_open sys_pidfd_open |
| 425 | −# 435 reserved for clone3 | |
| 425 | +435 o32 clone3 __sys_clone3 | |
| @@ -66,6 +66,10 @@ else · 65 unmodified lines | ||
| 66 | 66 | $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) |
| 67 | 67 | endif |
| 68 | 68 | |
| 69 | +# Some -march= flags enable MMI instructions, and GCC complains about that | |
| 70 | +# support being enabled alongside -msoft-float. Thus explicitly disable MMI. | |
| 71 | +cflags-y += $(call cc-option,-mno-loongson-mmi) | |
| 72 | + | |
| 69 | 73 | # |
| 70 | 74 | # Loongson Machines' Support |
| 71 | 75 | # |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | */ |
| 4 | 4 | #include <linux/fs.h> |
| 5 | 5 | #include <linux/fcntl.h> |
| 6 | +#include <linux/memblock.h> | |
| 6 | 7 | #include <linux/mm.h> |
| 7 | 8 | |
| 8 | 9 | #include <asm/bootinfo.h> |
| @@ -64,24 +65,22 @@ void __init prom_init_memory(void) · 55 unmodified lines | ||
| 64 | 65 | node_id = loongson_memmap->map[i].node_id; |
| 65 | 66 | mem_type = loongson_memmap->map[i].mem_type; |
| 66 | 67 | |
| 67 | − if (node_id == 0) { | |
| 68 | − switch (mem_type) { | |
| 69 | − case SYSTEM_RAM_LOW: | |
| 70 | − add_memory_region(loongson_memmap->map[i].mem_start, | |
| 71 | − (u64)loongson_memmap->map[i].mem_size << 20, | |
| 72 | − BOOT_MEM_RAM); | |
| 73 | − break; | |
| 74 | − case SYSTEM_RAM_HIGH: | |
| 75 | − add_memory_region(loongson_memmap->map[i].mem_start, | |
| 76 | − (u64)loongson_memmap->map[i].mem_size << 20, | |
| 77 | − BOOT_MEM_RAM); | |
| 78 | − break; | |
| 79 | − case SYSTEM_RAM_RESERVED: | |
| 80 | − add_memory_region(loongson_memmap->map[i].mem_start, | |
| 81 | − (u64)loongson_memmap->map[i].mem_size << 20, | |
| 82 | − BOOT_MEM_RESERVED); | |
| 83 | − break; | |
| 84 | − } | |
| 68 | + if (node_id != 0) | |
| 69 | + continue; | |
| 70 | + | |
| 71 | + switch (mem_type) { | |
| 72 | + case SYSTEM_RAM_LOW: | |
| 73 | + memblock_add(loongson_memmap->map[i].mem_start, | |
| 74 | + (u64)loongson_memmap->map[i].mem_size << 20); | |
| 75 | + break; | |
| 76 | + case SYSTEM_RAM_HIGH: | |
| 77 | + memblock_add(loongson_memmap->map[i].mem_start, | |
| 78 | + (u64)loongson_memmap->map[i].mem_size << 20); | |
| 79 | + break; | |
| 80 | + case SYSTEM_RAM_RESERVED: | |
| 81 | + memblock_reserve(loongson_memmap->map[i].mem_start, | |
| 82 | + (u64)loongson_memmap->map[i].mem_size << 20); | |
| 83 | + break; | |
| 85 | 84 | } |
| 86 | 85 | } |
| 87 | 86 | } |
| @@ -110,7 +110,7 @@ static int __init serial_init(void) · 109 unmodified lines | ||
| 110 | 110 | } |
| 111 | 111 | module_init(serial_init); |
| 112 | 112 | |
| 113 | −static void __init serial_exit(void) | |
| 113 | +static void __exit serial_exit(void) | |
| 114 | 114 | { |
| 115 | 115 | platform_device_unregister(&uart8250_device); |
| 116 | 116 | } |
| @@ -142,8 +142,6 @@ static void __init szmem(unsigned int node) · 141 unmodified lines | ||
| 142 | 142 | (u32)node_id, mem_type, mem_start, mem_size); |
| 143 | 143 | pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", |
| 144 | 144 | start_pfn, end_pfn, num_physpages); |
| 145 | − add_memory_region((node_id << 44) + mem_start, | |
| 146 | − (u64)mem_size << 20, BOOT_MEM_RAM); | |
| 147 | 145 | memblock_add_node(PFN_PHYS(start_pfn), |
| 148 | 146 | PFN_PHYS(end_pfn - start_pfn), node); |
| 149 | 147 | break; |
| @@ -156,16 +154,12 @@ static void __init szmem(unsigned int node) · 6 unmodified lines | ||
| 156 | 154 | (u32)node_id, mem_type, mem_start, mem_size); |
| 157 | 155 | pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", |
| 158 | 156 | start_pfn, end_pfn, num_physpages); |
| 159 | − add_memory_region((node_id << 44) + mem_start, | |
| 160 | − (u64)mem_size << 20, BOOT_MEM_RAM); | |
| 161 | 157 | memblock_add_node(PFN_PHYS(start_pfn), |
| 162 | 158 | PFN_PHYS(end_pfn - start_pfn), node); |
| 163 | 159 | break; |
| 164 | 160 | case SYSTEM_RAM_RESERVED: |
| 165 | 161 | pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n", |
| 166 | 162 | (u32)node_id, mem_type, mem_start, mem_size); |
| 167 | − add_memory_region((node_id << 44) + mem_start, | |
| 168 | − (u64)mem_size << 20, BOOT_MEM_RESERVED); | |
| 169 | 163 | memblock_reserve(((node_id << 44) + mem_start), |
| 170 | 164 | mem_size << 20); |
| 171 | 165 | break; |
| @@ -191,8 +185,6 @@ static void __init node_mem_init(unsigned int node) · 19 unmodified lines | ||
| 191 | 185 | NODE_DATA(node)->node_start_pfn = start_pfn; |
| 192 | 186 | NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; |
| 193 | 187 | |
| 194 | − free_bootmem_with_active_regions(node, end_pfn); | |
| 195 | − | |
| 196 | 188 | if (node == 0) { |
| 197 | 189 | /* kernel end address */ |
| 198 | 190 | unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end)); |
| @@ -209,8 +201,6 @@ static void __init node_mem_init(unsigned int node) · 10 unmodified lines | ||
| 209 | 201 | memblock_reserve((node_addrspace_offset | 0xfe000000), |
| 210 | 202 | 32 << 20); |
| 211 | 203 | } |
| 212 | − | |
| 213 | − sparse_memory_present_with_active_regions(node); | |
| 214 | 204 | } |
| 215 | 205 | |
| 216 | 206 | static __init void prom_meminit(void) |
| @@ -227,6 +217,7 @@ static __init void prom_meminit(void) · 10 unmodified lines | ||
| 227 | 217 | cpumask_clear(&__node_data[(node)]->cpumask); |
| 228 | 218 | } |
| 229 | 219 | } |
| 220 | + memblocks_present(); | |
| 230 | 221 | max_low_pfn = PHYS_PFN(memblock_end_of_DRAM()); |
| 231 | 222 | |
| 232 | 223 | for (cpu = 0; cpu < loongson_sysconf.nr_cpus; cpu++) { |
| @@ -61,6 +61,7 @@ int init_debug = 1; · 60 unmodified lines | ||
| 61 | 61 | /* memory blocks */ |
| 62 | 62 | struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS]; |
| 63 | 63 | |
| 64 | +#define MAX_PROM_MEM 5 | |
| 64 | 65 | static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata; |
| 65 | 66 | static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata; |
| 66 | 67 | static unsigned int nr_prom_mem __initdata; |
| @@ -358,7 +359,7 @@ void __init prom_meminit(void) · 291 unmodified lines | ||
| 358 | 359 | p++; |
| 359 | 360 | |
| 360 | 361 | if (type == BOOT_MEM_ROM_DATA) { |
| 361 | − if (nr_prom_mem >= 5) { | |
| 362 | + if (nr_prom_mem >= MAX_PROM_MEM) { | |
| 362 | 363 | pr_err("Too many ROM DATA regions"); |
| 363 | 364 | continue; |
| 364 | 365 | } |
| @@ -377,7 +378,6 @@ void __init prom_free_prom_memory(void) · 12 unmodified lines | ||
| 377 | 378 | char *ptr; |
| 378 | 379 | int len = 0; |
| 379 | 380 | int i; |
| 380 | − unsigned long addr; | |
| 381 | 381 | |
| 382 | 382 | /* |
| 383 | 383 | * preserve environment variables and command line from pmon/bbload |
| @@ -15,6 +15,7 @@ ccflags-vdso := \ · 14 unmodified lines | ||
| 15 | 15 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ |
| 16 | 16 | $(filter -march=%,$(KBUILD_CFLAGS)) \ |
| 17 | 17 | $(filter -m%-float,$(KBUILD_CFLAGS)) \ |
| 18 | + $(filter -mno-loongson-%,$(KBUILD_CFLAGS)) \ | |
| 18 | 19 | -D__VDSO__ |
| 19 | 20 | |
| 20 | 21 | ifdef CONFIG_CC_IS_CLANG |
| @@ -59,7 +60,7 @@ CFLAGS_REMOVE_vgettimeofday.o = -pg · 38 unmodified lines | ||
| 59 | 60 | ifndef CONFIG_CPU_MIPSR6 |
| 60 | 61 | ifeq ($(call ld-ifversion, -lt, 225000000, y),y) |
| 61 | 62 | $(warning MIPS VDSO requires binutils >= 2.25) |
| 62 | − obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y)) | |
| 63 | + obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y)) | |
| 63 | 64 | ccflags-vdso += -DDISABLE_MIPS_VDSO |
| 64 | 65 | endif |
| 65 | 66 | endif |
| @@ -1,269 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * Copyright (C) 2015 Imagination Technologies | |
| 4 | − * Author: Alex Smith <alex.smith@imgtec.com> | |
| 5 | − */ | |
| 6 | − | |
| 7 | −#include "vdso.h" | |
| 8 | − | |
| 9 | −#include <linux/compiler.h> | |
| 10 | −#include <linux/time.h> | |
| 11 | − | |
| 12 | −#include <asm/clocksource.h> | |
| 13 | −#include <asm/io.h> | |
| 14 | −#include <asm/unistd.h> | |
| 15 | −#include <asm/vdso.h> | |
| 16 | − | |
| 17 | −#ifdef CONFIG_MIPS_CLOCK_VSYSCALL | |
| 18 | − | |
| 19 | −static __always_inline long gettimeofday_fallback(struct timeval *_tv, | |
| 20 | − struct timezone *_tz) | |
| 21 | −{ | |
| 22 | − register struct timezone *tz asm("a1") = _tz; | |
| 23 | − register struct timeval *tv asm("a0") = _tv; | |
| 24 | − register long ret asm("v0"); | |
| 25 | − register long nr asm("v0") = __NR_gettimeofday; | |
| 26 | − register long error asm("a3"); | |
| 27 | − | |
| 28 | − asm volatile( | |
| 29 | − " syscall\n" | |
| 30 | − : "=r" (ret), "=r" (error) | |
| 31 | − : "r" (tv), "r" (tz), "r" (nr) | |
| 32 | − : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", | |
| 33 | − "$14", "$15", "$24", "$25", "hi", "lo", "memory"); | |
| 34 | − | |
| 35 | − return error ? -ret : ret; | |
| 36 | −} | |
| 37 | − | |
| 38 | −#endif | |
| 39 | − | |
| 40 | −static __always_inline long clock_gettime_fallback(clockid_t _clkid, | |
| 41 | − struct timespec *_ts) | |
| 42 | −{ | |
| 43 | − register struct timespec *ts asm("a1") = _ts; | |
| 44 | − register clockid_t clkid asm("a0") = _clkid; | |
| 45 | − register long ret asm("v0"); | |
| 46 | − register long nr asm("v0") = __NR_clock_gettime; | |
| 47 | − register long error asm("a3"); | |
| 48 | − | |
| 49 | − asm volatile( | |
| 50 | − " syscall\n" | |
| 51 | − : "=r" (ret), "=r" (error) | |
| 52 | − : "r" (clkid), "r" (ts), "r" (nr) | |
| 53 | − : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", | |
| 54 | − "$14", "$15", "$24", "$25", "hi", "lo", "memory"); | |
| 55 | − | |
| 56 | − return error ? -ret : ret; | |
| 57 | −} | |
| 58 | − | |
| 59 | −static __always_inline int do_realtime_coarse(struct timespec *ts, | |
| 60 | − const union mips_vdso_data *data) | |
| 61 | −{ | |
| 62 | − u32 start_seq; | |
| 63 | − | |
| 64 | − do { | |
| 65 | − start_seq = vdso_data_read_begin(data); | |
| 66 | − | |
| 67 | − ts->tv_sec = data->xtime_sec; | |
| 68 | − ts->tv_nsec = data->xtime_nsec >> data->cs_shift; | |
| 69 | − } while (vdso_data_read_retry(data, start_seq)); | |
| 70 | − | |
| 71 | − return 0; | |
| 72 | −} | |
| 73 | − | |
| 74 | −static __always_inline int do_monotonic_coarse(struct timespec *ts, | |
| 75 | − const union mips_vdso_data *data) | |
| 76 | −{ | |
| 77 | − u32 start_seq; | |
| 78 | − u64 to_mono_sec; | |
| 79 | − u64 to_mono_nsec; | |
| 80 | − | |
| 81 | − do { | |
| 82 | − start_seq = vdso_data_read_begin(data); | |
| 83 | − | |
| 84 | − ts->tv_sec = data->xtime_sec; | |
| 85 | − ts->tv_nsec = data->xtime_nsec >> data->cs_shift; | |
| 86 | − | |
| 87 | − to_mono_sec = data->wall_to_mono_sec; | |
| 88 | − to_mono_nsec = data->wall_to_mono_nsec; | |
| 89 | − } while (vdso_data_read_retry(data, start_seq)); | |
| 90 | − | |
| 91 | − ts->tv_sec += to_mono_sec; | |
| 92 | − timespec_add_ns(ts, to_mono_nsec); | |
| 93 | − | |
| 94 | − return 0; | |
| 95 | −} | |
| 96 | − | |
| 97 | −#ifdef CONFIG_CSRC_R4K | |
| 98 | − | |
| 99 | −static __always_inline u64 read_r4k_count(void) | |
| 100 | −{ | |
| 101 | − unsigned int count; | |
| 102 | − | |
| 103 | − __asm__ __volatile__( | |
| 104 | − " .set push\n" | |
| 105 | − " .set mips32r2\n" | |
| 106 | − " rdhwr %0, $2\n" | |
| 107 | − " .set pop\n" | |
| 108 | − : "=r" (count)); | |
| 109 | − | |
| 110 | − return count; | |
| 111 | −} | |
| 112 | − | |
| 113 | −#endif | |
| 114 | − | |
| 115 | −#ifdef CONFIG_CLKSRC_MIPS_GIC | |
| 116 | − | |
| 117 | −static __always_inline u64 read_gic_count(const union mips_vdso_data *data) | |
| 118 | −{ | |
| 119 | − void __iomem *gic = get_gic(data); | |
| 120 | − u32 hi, hi2, lo; | |
| 121 | − | |
| 122 | − do { | |
| 123 | − hi = __raw_readl(gic + sizeof(lo)); | |
| 124 | − lo = __raw_readl(gic); | |
| 125 | − hi2 = __raw_readl(gic + sizeof(lo)); | |
| 126 | − } while (hi2 != hi); | |
| 127 | − | |
| 128 | − return (((u64)hi) << 32) + lo; | |
| 129 | −} | |
| 130 | − | |
| 131 | −#endif | |
| 132 | − | |
| 133 | −static __always_inline u64 get_ns(const union mips_vdso_data *data) | |
| 134 | −{ | |
| 135 | − u64 cycle_now, delta, nsec; | |
| 136 | − | |
| 137 | − switch (data->clock_mode) { | |
| 138 | −#ifdef CONFIG_CSRC_R4K | |
| 139 | − case VDSO_CLOCK_R4K: | |
| 140 | − cycle_now = read_r4k_count(); | |
| 141 | − break; | |
| 142 | −#endif | |
| 143 | −#ifdef CONFIG_CLKSRC_MIPS_GIC | |
| 144 | − case VDSO_CLOCK_GIC: | |
| 145 | − cycle_now = read_gic_count(data); | |
| 146 | − break; | |
| 147 | −#endif | |
| 148 | − default: | |
| 149 | − return 0; | |
| 150 | − } | |
| 151 | − | |
| 152 | − delta = (cycle_now - data->cs_cycle_last) & data->cs_mask; | |
| 153 | − | |
| 154 | − nsec = (delta * data->cs_mult) + data->xtime_nsec; | |
| 155 | − nsec >>= data->cs_shift; | |
| 156 | − | |
| 157 | − return nsec; | |
| 158 | −} | |
| 159 | − | |
| 160 | −static __always_inline int do_realtime(struct timespec *ts, | |
| 161 | − const union mips_vdso_data *data) | |
| 162 | −{ | |
| 163 | − u32 start_seq; | |
| 164 | − u64 ns; | |
| 165 | − | |
| 166 | − do { | |
| 167 | − start_seq = vdso_data_read_begin(data); | |
| 168 | − | |
| 169 | − if (data->clock_mode == VDSO_CLOCK_NONE) | |
| 170 | − return -ENOSYS; | |
| 171 | − | |
| 172 | − ts->tv_sec = data->xtime_sec; | |
| 173 | − ns = get_ns(data); | |
| 174 | − } while (vdso_data_read_retry(data, start_seq)); | |
| 175 | − | |
| 176 | − ts->tv_nsec = 0; | |
| 177 | − timespec_add_ns(ts, ns); | |
| 178 | − | |
| 179 | − return 0; | |
| 180 | −} | |
| 181 | − | |
| 182 | −static __always_inline int do_monotonic(struct timespec *ts, | |
| 183 | − const union mips_vdso_data *data) | |
| 184 | −{ | |
| 185 | − u32 start_seq; | |
| 186 | − u64 ns; | |
| 187 | − u64 to_mono_sec; | |
| 188 | − u64 to_mono_nsec; | |
| 189 | − | |
| 190 | − do { | |
| 191 | − start_seq = vdso_data_read_begin(data); | |
| 192 | − | |
| 193 | − if (data->clock_mode == VDSO_CLOCK_NONE) | |
| 194 | − return -ENOSYS; | |
| 195 | − | |
| 196 | − ts->tv_sec = data->xtime_sec; | |
| 197 | − ns = get_ns(data); | |
| 198 | − | |
| 199 | − to_mono_sec = data->wall_to_mono_sec; | |
| 200 | − to_mono_nsec = data->wall_to_mono_nsec; | |
| 201 | − } while (vdso_data_read_retry(data, start_seq)); | |
| 202 | − | |
| 203 | − ts->tv_sec += to_mono_sec; | |
| 204 | − ts->tv_nsec = 0; | |
| 205 | − timespec_add_ns(ts, ns + to_mono_nsec); | |
| 206 | − | |
| 207 | − return 0; | |
| 208 | −} | |
| 209 | − | |
| 210 | −#ifdef CONFIG_MIPS_CLOCK_VSYSCALL | |
| 211 | − | |
| 212 | −/* | |
| 213 | − * This is behind the ifdef so that we don't provide the symbol when there's no | |
| 214 | − * possibility of there being a usable clocksource, because there's nothing we | |
| 215 | − * can do without it. When libc fails the symbol lookup it should fall back on | |
| 216 | − * the standard syscall path. | |
| 217 | − */ | |
| 218 | −int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) | |
| 219 | −{ | |
| 220 | − const union mips_vdso_data *data = get_vdso_data(); | |
| 221 | − struct timespec ts; | |
| 222 | − int ret; | |
| 223 | − | |
| 224 | − ret = do_realtime(&ts, data); | |
| 225 | − if (ret) | |
| 226 | − return gettimeofday_fallback(tv, tz); | |
| 227 | − | |
| 228 | − if (tv) { | |
| 229 | − tv->tv_sec = ts.tv_sec; | |
| 230 | − tv->tv_usec = ts.tv_nsec / 1000; | |
| 231 | − } | |
| 232 | − | |
| 233 | − if (tz) { | |
| 234 | − tz->tz_minuteswest = data->tz_minuteswest; | |
| 235 | − tz->tz_dsttime = data->tz_dsttime; | |
| 236 | − } | |
| 237 | − | |
| 238 | − return 0; | |
| 239 | −} | |
| 240 | − | |
| 241 | −#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ | |
| 242 | − | |
| 243 | −int __vdso_clock_gettime(clockid_t clkid, struct timespec *ts) | |
| 244 | −{ | |
| 245 | − const union mips_vdso_data *data = get_vdso_data(); | |
| 246 | − int ret = -1; | |
| 247 | − | |
| 248 | − switch (clkid) { | |
| 249 | − case CLOCK_REALTIME_COARSE: | |
| 250 | − ret = do_realtime_coarse(ts, data); | |
| 251 | − break; | |
| 252 | − case CLOCK_MONOTONIC_COARSE: | |
| 253 | − ret = do_monotonic_coarse(ts, data); | |
| 254 | − break; | |
| 255 | − case CLOCK_REALTIME: | |
| 256 | − ret = do_realtime(ts, data); | |
| 257 | − break; | |
| 258 | − case CLOCK_MONOTONIC: | |
| 259 | − ret = do_monotonic(ts, data); | |
| 260 | − break; | |
| 261 | − default: | |
| 262 | − break; | |
| 263 | − } | |
| 264 | − | |
| 265 | − if (ret) | |
| 266 | − ret = clock_gettime_fallback(clkid, ts); | |
| 267 | − | |
| 268 | − return ret; | |
| 269 | −} | |
| @@ -50,7 +50,7 @@ endif · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc |
| 52 | 52 | |
| 53 | −BOOTARFLAGS := -cr$(KBUILD_ARFLAGS) | |
| 53 | +BOOTARFLAGS := -crD | |
| 54 | 54 | |
| 55 | 55 | ifdef CONFIG_CC_IS_CLANG |
| 56 | 56 | BOOTCFLAGS += $(CLANG_FLAGS) |
| @@ -35,6 +35,10 @@ static inline void radix__flush_all_lpid(unsigned int lpid) · 34 unmodified lines | ||
| 35 | 35 | { |
| 36 | 36 | WARN_ON(1); |
| 37 | 37 | } |
| 38 | +static inline void radix__flush_all_lpid_guest(unsigned int lpid) | |
| 39 | +{ | |
| 40 | + WARN_ON(1); | |
| 41 | +} | |
| 38 | 42 | #endif |
| 39 | 43 | |
| 40 | 44 | extern void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma, |
| @@ -36,8 +36,8 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "book3s.h" |
| 37 | 37 | #include "trace.h" |
| 38 | 38 | |
| 39 | −#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM | |
| 40 | −#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU | |
| 39 | +#define VM_STAT(x, ...) offsetof(struct kvm, stat.x), KVM_STAT_VM, ## __VA_ARGS__ | |
| 40 | +#define VCPU_STAT(x, ...) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, ## __VA_ARGS__ | |
| 41 | 41 | |
| 42 | 42 | /* #define EXIT_DEBUG */ |
| 43 | 43 | |
| @@ -69,8 +69,8 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { · 25 unmodified lines | ||
| 69 | 69 | { "pthru_all", VCPU_STAT(pthru_all) }, |
| 70 | 70 | { "pthru_host", VCPU_STAT(pthru_host) }, |
| 71 | 71 | { "pthru_bad_aff", VCPU_STAT(pthru_bad_aff) }, |
| 72 | − { "largepages_2M", VM_STAT(num_2M_pages) }, | |
| 73 | − { "largepages_1G", VM_STAT(num_1G_pages) }, | |
| 72 | + { "largepages_2M", VM_STAT(num_2M_pages, .mode = 0444) }, | |
| 73 | + { "largepages_1G", VM_STAT(num_1G_pages, .mode = 0444) }, | |
| 74 | 74 | { NULL } |
| 75 | 75 | }; |
| 76 | 76 | |
| @@ -1921,6 +1921,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 1920 unmodified lines | ||
| 1921 | 1921 | mtspr SPRN_PCR, r6 |
| 1922 | 1922 | 18: |
| 1923 | 1923 | /* Signal secondary CPUs to continue */ |
| 1924 | + li r0, 0 | |
| 1924 | 1925 | stb r0,VCORE_IN_GUEST(r5) |
| 1925 | 1926 | 19: lis r8,0x7fff /* MAX_INT@h */ |
| 1926 | 1927 | mtspr SPRN_HDEC,r8 |
| @@ -761,6 +761,7 @@ static int spufs_init_fs_context(struct fs_context *fc) · 760 unmodified lines | ||
| 761 | 761 | ctx->gid = current_gid(); |
| 762 | 762 | ctx->mode = 0755; |
| 763 | 763 | |
| 764 | + fc->fs_private = ctx; | |
| 764 | 765 | fc->s_fs_info = sbi; |
| 765 | 766 | fc->ops = &spufs_context_ops; |
| 766 | 767 | return 0; |
| @@ -1419,6 +1419,9 @@ void __init pseries_lpar_read_hblkrm_characteristics(void) · 1418 unmodified lines | ||
| 1419 | 1419 | unsigned char local_buffer[SPLPAR_TLB_BIC_MAXLENGTH]; |
| 1420 | 1420 | int call_status, len, idx, bpsize; |
| 1421 | 1421 | |
| 1422 | + if (!firmware_has_feature(FW_FEATURE_BLOCK_REMOVE)) | |
| 1423 | + return; | |
| 1424 | + | |
| 1422 | 1425 | spin_lock(&rtas_data_buf_lock); |
| 1423 | 1426 | memset(rtas_data_buf, 0, RTAS_DATA_BUF_SIZE); |
| 1424 | 1427 | call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1, |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | #define REG_L __REG_SEL(ld, lw) |
| 24 | 24 | #define REG_S __REG_SEL(sd, sw) |
| 25 | +#define REG_SC __REG_SEL(sc.d, sc.w) | |
| 25 | 26 | #define SZREG __REG_SEL(8, 4) |
| 26 | 27 | #define LGREG __REG_SEL(3, 2) |
| 27 | 28 | |
| @@ -98,7 +98,26 @@ _save_context: · 97 unmodified lines | ||
| 98 | 98 | */ |
| 99 | 99 | .macro RESTORE_ALL |
| 100 | 100 | REG_L a0, PT_SSTATUS(sp) |
| 101 | − REG_L a2, PT_SEPC(sp) | |
| 101 | + /* | |
| 102 | + * The current load reservation is effectively part of the processor's | |
| 103 | + * state, in the sense that load reservations cannot be shared between | |
| 104 | + * different hart contexts. We can't actually save and restore a load | |
| 105 | + * reservation, so instead here we clear any existing reservation -- | |
| 106 | + * it's always legal for implementations to clear load reservations at | |
| 107 | + * any point (as long as the forward progress guarantee is kept, but | |
| 108 | + * we'll ignore that here). | |
| 109 | + * | |
| 110 | + * Dangling load reservations can be the result of taking a trap in the | |
| 111 | + * middle of an LR/SC sequence, but can also be the result of a taken | |
| 112 | + * forward branch around an SC -- which is how we implement CAS. As a | |
| 113 | + * result we need to clear reservations between the last CAS and the | |
| 114 | + * jump back to the new context. While it is unlikely the store | |
| 115 | + * completes, implementations are allowed to expand reservations to be | |
| 116 | + * arbitrarily large. | |
| 117 | + */ | |
| 118 | + REG_L a2, PT_SEPC(sp) | |
| 119 | + REG_SC x0, a2, PT_SEPC(sp) | |
| 120 | + | |
| 102 | 121 | csrw CSR_SSTATUS, a0 |
| 103 | 122 | csrw CSR_SEPC, a2 |
| 104 | 123 | |
| @@ -254,12 +273,11 @@ restore_all: · 149 unmodified lines | ||
| 254 | 273 | resume_kernel: |
| 255 | 274 | REG_L s0, TASK_TI_PREEMPT_COUNT(tp) |
| 256 | 275 | bnez s0, restore_all |
| 257 | −need_resched: | |
| 258 | 276 | REG_L s0, TASK_TI_FLAGS(tp) |
| 259 | 277 | andi s0, s0, _TIF_NEED_RESCHED |
| 260 | 278 | beqz s0, restore_all |
| 261 | 279 | call preempt_schedule_irq |
| 262 | − j need_resched | |
| 280 | + j restore_all | |
| 263 | 281 | #endif |
| 264 | 282 | |
| 265 | 283 | work_pending: |
| @@ -124,24 +124,24 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | asmlinkage void do_trap_break(struct pt_regs *regs) |
| 126 | 126 | { |
| 127 | −#ifdef CONFIG_GENERIC_BUG | |
| 128 | 127 | if (!user_mode(regs)) { |
| 129 | 128 | enum bug_trap_type type; |
| 130 | 129 | |
| 131 | 130 | type = report_bug(regs->sepc, regs); |
| 132 | 131 | switch (type) { |
| 133 | − case BUG_TRAP_TYPE_NONE: | |
| 134 | − break; | |
| 132 | +#ifdef CONFIG_GENERIC_BUG | |
| 135 | 133 | case BUG_TRAP_TYPE_WARN: |
| 136 | 134 | regs->sepc += get_break_insn_length(regs->sepc); |
| 137 | − break; | |
| 135 | + return; | |
| 138 | 136 | case BUG_TRAP_TYPE_BUG: |
| 137 | +#endif /* CONFIG_GENERIC_BUG */ | |
| 138 | + default: | |
| 139 | 139 | die(regs, "Kernel BUG"); |
| 140 | 140 | } |
| 141 | + } else { | |
| 142 | + force_sig_fault(SIGTRAP, TRAP_BRKPT, | |
| 143 | + (void __user *)(regs->sepc)); | |
| 141 | 144 | } |
| 142 | −#endif /* CONFIG_GENERIC_BUG */ | |
| 143 | − | |
| 144 | − force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)(regs->sepc)); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | #ifdef CONFIG_GENERIC_BUG |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/swap.h> |
| 12 | 12 | #include <linux/sizes.h> |
| 13 | 13 | #include <linux/of_fdt.h> |
| 14 | +#include <linux/libfdt.h> | |
| 14 | 15 | |
| 15 | 16 | #include <asm/fixmap.h> |
| 16 | 17 | #include <asm/tlbflush.h> |
| @@ -82,6 +83,8 @@ disable: · 65 unmodified lines | ||
| 82 | 83 | } |
| 83 | 84 | #endif /* CONFIG_BLK_DEV_INITRD */ |
| 84 | 85 | |
| 86 | +static phys_addr_t dtb_early_pa __initdata; | |
| 87 | + | |
| 85 | 88 | void __init setup_bootmem(void) |
| 86 | 89 | { |
| 87 | 90 | struct memblock_region *reg; |
| @@ -117,7 +120,12 @@ void __init setup_bootmem(void) · 29 unmodified lines | ||
| 117 | 120 | setup_initrd(); |
| 118 | 121 | #endif /* CONFIG_BLK_DEV_INITRD */ |
| 119 | 122 | |
| 120 | − early_init_fdt_reserve_self(); | |
| 123 | + /* | |
| 124 | + * Avoid using early_init_fdt_reserve_self() since __pa() does | |
| 125 | + * not work for DTB pointers that are fixmap addresses | |
| 126 | + */ | |
| 127 | + memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va)); | |
| 128 | + | |
| 121 | 129 | early_init_fdt_scan_reserved_mem(); |
| 122 | 130 | memblock_allow_resize(); |
| 123 | 131 | memblock_dump_all(); |
| @@ -393,6 +401,8 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) · 269 unmodified lines | ||
| 393 | 401 | |
| 394 | 402 | /* Save pointer to DTB for early FDT parsing */ |
| 395 | 403 | dtb_early_va = (void *)fix_to_virt(FIX_FDT) + (dtb_pa & ~PAGE_MASK); |
| 404 | + /* Save physical address for memblock reservation */ | |
| 405 | + dtb_early_pa = dtb_pa; | |
| 396 | 406 | } |
| 397 | 407 | |
| 398 | 408 | static void __init setup_vm_final(void) |
| @@ -44,6 +44,7 @@ CONFIG_NR_CPUS=512 · 43 unmodified lines | ||
| 44 | 44 | CONFIG_NUMA=y |
| 45 | 45 | CONFIG_HZ_100=y |
| 46 | 46 | CONFIG_KEXEC_FILE=y |
| 47 | +CONFIG_KEXEC_SIG=y | |
| 47 | 48 | CONFIG_EXPOLINE=y |
| 48 | 49 | CONFIG_EXPOLINE_AUTO=y |
| 49 | 50 | CONFIG_CHSC_SCH=y |
| @@ -69,12 +70,13 @@ CONFIG_MODULE_UNLOAD=y · 19 unmodified lines | ||
| 69 | 70 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 70 | 71 | CONFIG_MODVERSIONS=y |
| 71 | 72 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 72 | −CONFIG_MODULE_SIG=y | |
| 73 | 73 | CONFIG_MODULE_SIG_SHA256=y |
| 74 | +CONFIG_UNUSED_SYMBOLS=y | |
| 74 | 75 | CONFIG_BLK_DEV_INTEGRITY=y |
| 75 | 76 | CONFIG_BLK_DEV_THROTTLING=y |
| 76 | 77 | CONFIG_BLK_WBT=y |
| 77 | 78 | CONFIG_BLK_CGROUP_IOLATENCY=y |
| 79 | +CONFIG_BLK_CGROUP_IOCOST=y | |
| 78 | 80 | CONFIG_PARTITION_ADVANCED=y |
| 79 | 81 | CONFIG_IBM_PARTITION=y |
| 80 | 82 | CONFIG_BSD_DISKLABEL=y |
| @@ -370,6 +372,7 @@ CONFIG_NETLINK_DIAG=m · 289 unmodified lines | ||
| 370 | 372 | CONFIG_CGROUP_NET_PRIO=y |
| 371 | 373 | CONFIG_BPF_JIT=y |
| 372 | 374 | CONFIG_NET_PKTGEN=m |
| 375 | +# CONFIG_NET_DROP_MONITOR is not set | |
| 373 | 376 | CONFIG_PCI=y |
| 374 | 377 | CONFIG_PCI_DEBUG=y |
| 375 | 378 | CONFIG_HOTPLUG_PCI=y |
| @@ -424,6 +427,7 @@ CONFIG_DM_CRYPT=m · 48 unmodified lines | ||
| 424 | 427 | CONFIG_DM_SNAPSHOT=m |
| 425 | 428 | CONFIG_DM_THIN_PROVISIONING=m |
| 426 | 429 | CONFIG_DM_WRITECACHE=m |
| 430 | +CONFIG_DM_CLONE=m | |
| 427 | 431 | CONFIG_DM_MIRROR=m |
| 428 | 432 | CONFIG_DM_LOG_USERSPACE=m |
| 429 | 433 | CONFIG_DM_RAID=m |
| @@ -435,6 +439,7 @@ CONFIG_DM_DELAY=m · 5 unmodified lines | ||
| 435 | 439 | CONFIG_DM_UEVENT=y |
| 436 | 440 | CONFIG_DM_FLAKEY=m |
| 437 | 441 | CONFIG_DM_VERITY=m |
| 442 | +CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y | |
| 438 | 443 | CONFIG_DM_SWITCH=m |
| 439 | 444 | CONFIG_NETDEVICES=y |
| 440 | 445 | CONFIG_BONDING=m |
| @@ -489,6 +494,7 @@ CONFIG_MLX5_CORE_EN=y · 48 unmodified lines | ||
| 489 | 494 | # CONFIG_NET_VENDOR_NVIDIA is not set |
| 490 | 495 | # CONFIG_NET_VENDOR_OKI is not set |
| 491 | 496 | # CONFIG_NET_VENDOR_PACKET_ENGINES is not set |
| 497 | +# CONFIG_NET_VENDOR_PENSANDO is not set | |
| 492 | 498 | # CONFIG_NET_VENDOR_QLOGIC is not set |
| 493 | 499 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 494 | 500 | # CONFIG_NET_VENDOR_RDC is not set |
| @@ -538,15 +544,16 @@ CONFIG_WATCHDOG=y · 43 unmodified lines | ||
| 538 | 544 | CONFIG_WATCHDOG_NOWAYOUT=y |
| 539 | 545 | CONFIG_SOFT_WATCHDOG=m |
| 540 | 546 | CONFIG_DIAG288_WATCHDOG=m |
| 541 | −CONFIG_DRM=y | |
| 542 | −CONFIG_DRM_VIRTIO_GPU=y | |
| 547 | +CONFIG_FB=y | |
| 543 | 548 | CONFIG_FRAMEBUFFER_CONSOLE=y |
| 549 | +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | |
| 544 | 550 | # CONFIG_HID is not set |
| 545 | 551 | # CONFIG_USB_SUPPORT is not set |
| 546 | 552 | CONFIG_INFINIBAND=m |
| 547 | 553 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 548 | 554 | CONFIG_MLX4_INFINIBAND=m |
| 549 | 555 | CONFIG_MLX5_INFINIBAND=m |
| 556 | +CONFIG_SYNC_FILE=y | |
| 550 | 557 | CONFIG_VFIO=m |
| 551 | 558 | CONFIG_VFIO_PCI=m |
| 552 | 559 | CONFIG_VFIO_MDEV=m |
| @@ -580,6 +587,8 @@ CONFIG_NILFS2_FS=m · 27 unmodified lines | ||
| 580 | 587 | CONFIG_FS_DAX=y |
| 581 | 588 | CONFIG_EXPORTFS_BLOCK_OPS=y |
| 582 | 589 | CONFIG_FS_ENCRYPTION=y |
| 590 | +CONFIG_FS_VERITY=y | |
| 591 | +CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y | |
| 583 | 592 | CONFIG_FANOTIFY=y |
| 584 | 593 | CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y |
| 585 | 594 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| @@ -589,6 +598,7 @@ CONFIG_QFMT_V2=m · 3 unmodified lines | ||
| 589 | 598 | CONFIG_AUTOFS4_FS=m |
| 590 | 599 | CONFIG_FUSE_FS=y |
| 591 | 600 | CONFIG_CUSE=m |
| 601 | +CONFIG_VIRTIO_FS=m | |
| 592 | 602 | CONFIG_OVERLAY_FS=m |
| 593 | 603 | CONFIG_FSCACHE=m |
| 594 | 604 | CONFIG_CACHEFILES=m |
| @@ -648,12 +658,15 @@ CONFIG_FORTIFY_SOURCE=y · 53 unmodified lines | ||
| 648 | 658 | CONFIG_SECURITY_SELINUX=y |
| 649 | 659 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 650 | 660 | CONFIG_SECURITY_SELINUX_DISABLE=y |
| 661 | +CONFIG_SECURITY_LOCKDOWN_LSM=y | |
| 662 | +CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y | |
| 651 | 663 | CONFIG_INTEGRITY_SIGNATURE=y |
| 652 | 664 | CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y |
| 653 | 665 | CONFIG_IMA=y |
| 654 | 666 | CONFIG_IMA_DEFAULT_HASH_SHA256=y |
| 655 | 667 | CONFIG_IMA_WRITE_POLICY=y |
| 656 | 668 | CONFIG_IMA_APPRAISE=y |
| 669 | +CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor" | |
| 657 | 670 | CONFIG_CRYPTO_USER=m |
| 658 | 671 | # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set |
| 659 | 672 | CONFIG_CRYPTO_PCRYPT=m |
| @@ -664,10 +677,6 @@ CONFIG_CRYPTO_ECDH=m · 4 unmodified lines | ||
| 664 | 677 | CONFIG_CRYPTO_ECRDSA=m |
| 665 | 678 | CONFIG_CRYPTO_CHACHA20POLY1305=m |
| 666 | 679 | CONFIG_CRYPTO_AEGIS128=m |
| 667 | −CONFIG_CRYPTO_AEGIS128L=m | |
| 668 | −CONFIG_CRYPTO_AEGIS256=m | |
| 669 | −CONFIG_CRYPTO_MORUS640=m | |
| 670 | −CONFIG_CRYPTO_MORUS1280=m | |
| 671 | 680 | CONFIG_CRYPTO_CFB=m |
| 672 | 681 | CONFIG_CRYPTO_LRW=m |
| 673 | 682 | CONFIG_CRYPTO_PCBC=m |
| @@ -739,7 +748,6 @@ CONFIG_DEBUG_INFO=y · 65 unmodified lines | ||
| 739 | 748 | CONFIG_DEBUG_INFO_DWARF4=y |
| 740 | 749 | CONFIG_GDB_SCRIPTS=y |
| 741 | 750 | CONFIG_FRAME_WARN=1024 |
| 742 | −CONFIG_UNUSED_SYMBOLS=y | |
| 743 | 751 | CONFIG_HEADERS_INSTALL=y |
| 744 | 752 | CONFIG_HEADERS_CHECK=y |
| 745 | 753 | CONFIG_DEBUG_SECTION_MISMATCH=y |
| @@ -44,6 +44,7 @@ CONFIG_NUMA=y · 43 unmodified lines | ||
| 44 | 44 | # CONFIG_NUMA_EMU is not set |
| 45 | 45 | CONFIG_HZ_100=y |
| 46 | 46 | CONFIG_KEXEC_FILE=y |
| 47 | +CONFIG_KEXEC_SIG=y | |
| 47 | 48 | CONFIG_EXPOLINE=y |
| 48 | 49 | CONFIG_EXPOLINE_AUTO=y |
| 49 | 50 | CONFIG_CHSC_SCH=y |
| @@ -66,11 +67,12 @@ CONFIG_MODULE_UNLOAD=y · 16 unmodified lines | ||
| 66 | 67 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 67 | 68 | CONFIG_MODVERSIONS=y |
| 68 | 69 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 69 | −CONFIG_MODULE_SIG=y | |
| 70 | 70 | CONFIG_MODULE_SIG_SHA256=y |
| 71 | +CONFIG_UNUSED_SYMBOLS=y | |
| 71 | 72 | CONFIG_BLK_DEV_THROTTLING=y |
| 72 | 73 | CONFIG_BLK_WBT=y |
| 73 | 74 | CONFIG_BLK_CGROUP_IOLATENCY=y |
| 75 | +CONFIG_BLK_CGROUP_IOCOST=y | |
| 74 | 76 | CONFIG_PARTITION_ADVANCED=y |
| 75 | 77 | CONFIG_IBM_PARTITION=y |
| 76 | 78 | CONFIG_BSD_DISKLABEL=y |
| @@ -363,6 +365,7 @@ CONFIG_NETLINK_DIAG=m · 286 unmodified lines | ||
| 363 | 365 | CONFIG_CGROUP_NET_PRIO=y |
| 364 | 366 | CONFIG_BPF_JIT=y |
| 365 | 367 | CONFIG_NET_PKTGEN=m |
| 368 | +# CONFIG_NET_DROP_MONITOR is not set | |
| 366 | 369 | CONFIG_PCI=y |
| 367 | 370 | CONFIG_HOTPLUG_PCI=y |
| 368 | 371 | CONFIG_HOTPLUG_PCI_S390=y |
| @@ -418,6 +421,7 @@ CONFIG_DM_CRYPT=m · 49 unmodified lines | ||
| 418 | 421 | CONFIG_DM_SNAPSHOT=m |
| 419 | 422 | CONFIG_DM_THIN_PROVISIONING=m |
| 420 | 423 | CONFIG_DM_WRITECACHE=m |
| 424 | +CONFIG_DM_CLONE=m | |
| 421 | 425 | CONFIG_DM_MIRROR=m |
| 422 | 426 | CONFIG_DM_LOG_USERSPACE=m |
| 423 | 427 | CONFIG_DM_RAID=m |
| @@ -429,6 +433,7 @@ CONFIG_DM_DELAY=m · 5 unmodified lines | ||
| 429 | 433 | CONFIG_DM_UEVENT=y |
| 430 | 434 | CONFIG_DM_FLAKEY=m |
| 431 | 435 | CONFIG_DM_VERITY=m |
| 436 | +CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y | |
| 432 | 437 | CONFIG_DM_SWITCH=m |
| 433 | 438 | CONFIG_DM_INTEGRITY=m |
| 434 | 439 | CONFIG_NETDEVICES=y |
| @@ -484,6 +489,7 @@ CONFIG_MLX5_CORE_EN=y · 49 unmodified lines | ||
| 484 | 489 | # CONFIG_NET_VENDOR_NVIDIA is not set |
| 485 | 490 | # CONFIG_NET_VENDOR_OKI is not set |
| 486 | 491 | # CONFIG_NET_VENDOR_PACKET_ENGINES is not set |
| 492 | +# CONFIG_NET_VENDOR_PENSANDO is not set | |
| 487 | 493 | # CONFIG_NET_VENDOR_QLOGIC is not set |
| 488 | 494 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 489 | 495 | # CONFIG_NET_VENDOR_RDC is not set |
| @@ -533,16 +539,16 @@ CONFIG_WATCHDOG_CORE=y · 43 unmodified lines | ||
| 533 | 539 | CONFIG_WATCHDOG_NOWAYOUT=y |
| 534 | 540 | CONFIG_SOFT_WATCHDOG=m |
| 535 | 541 | CONFIG_DIAG288_WATCHDOG=m |
| 536 | −CONFIG_DRM=y | |
| 537 | −CONFIG_DRM_VIRTIO_GPU=y | |
| 538 | −# CONFIG_BACKLIGHT_CLASS_DEVICE is not set | |
| 542 | +CONFIG_FB=y | |
| 539 | 543 | CONFIG_FRAMEBUFFER_CONSOLE=y |
| 544 | +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | |
| 540 | 545 | # CONFIG_HID is not set |
| 541 | 546 | # CONFIG_USB_SUPPORT is not set |
| 542 | 547 | CONFIG_INFINIBAND=m |
| 543 | 548 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 544 | 549 | CONFIG_MLX4_INFINIBAND=m |
| 545 | 550 | CONFIG_MLX5_INFINIBAND=m |
| 551 | +CONFIG_SYNC_FILE=y | |
| 546 | 552 | CONFIG_VFIO=m |
| 547 | 553 | CONFIG_VFIO_PCI=m |
| 548 | 554 | CONFIG_VFIO_MDEV=m |
| @@ -573,6 +579,8 @@ CONFIG_NILFS2_FS=m · 24 unmodified lines | ||
| 573 | 579 | CONFIG_FS_DAX=y |
| 574 | 580 | CONFIG_EXPORTFS_BLOCK_OPS=y |
| 575 | 581 | CONFIG_FS_ENCRYPTION=y |
| 582 | +CONFIG_FS_VERITY=y | |
| 583 | +CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y | |
| 576 | 584 | CONFIG_FANOTIFY=y |
| 577 | 585 | CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y |
| 578 | 586 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| @@ -581,6 +589,7 @@ CONFIG_QFMT_V2=m · 2 unmodified lines | ||
| 581 | 589 | CONFIG_AUTOFS4_FS=m |
| 582 | 590 | CONFIG_FUSE_FS=y |
| 583 | 591 | CONFIG_CUSE=m |
| 592 | +CONFIG_VIRTIO_FS=m | |
| 584 | 593 | CONFIG_OVERLAY_FS=m |
| 585 | 594 | CONFIG_FSCACHE=m |
| 586 | 595 | CONFIG_CACHEFILES=m |
| @@ -639,12 +648,15 @@ CONFIG_SECURITY_NETWORK=y · 52 unmodified lines | ||
| 639 | 648 | CONFIG_SECURITY_SELINUX=y |
| 640 | 649 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 641 | 650 | CONFIG_SECURITY_SELINUX_DISABLE=y |
| 651 | +CONFIG_SECURITY_LOCKDOWN_LSM=y | |
| 652 | +CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y | |
| 642 | 653 | CONFIG_INTEGRITY_SIGNATURE=y |
| 643 | 654 | CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y |
| 644 | 655 | CONFIG_IMA=y |
| 645 | 656 | CONFIG_IMA_DEFAULT_HASH_SHA256=y |
| 646 | 657 | CONFIG_IMA_WRITE_POLICY=y |
| 647 | 658 | CONFIG_IMA_APPRAISE=y |
| 659 | +CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor" | |
| 648 | 660 | CONFIG_CRYPTO_FIPS=y |
| 649 | 661 | CONFIG_CRYPTO_USER=m |
| 650 | 662 | # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set |
| @@ -656,10 +668,6 @@ CONFIG_CRYPTO_ECDH=m · 5 unmodified lines | ||
| 656 | 668 | CONFIG_CRYPTO_ECRDSA=m |
| 657 | 669 | CONFIG_CRYPTO_CHACHA20POLY1305=m |
| 658 | 670 | CONFIG_CRYPTO_AEGIS128=m |
| 659 | −CONFIG_CRYPTO_AEGIS128L=m | |
| 660 | −CONFIG_CRYPTO_AEGIS256=m | |
| 661 | −CONFIG_CRYPTO_MORUS640=m | |
| 662 | −CONFIG_CRYPTO_MORUS1280=m | |
| 663 | 671 | CONFIG_CRYPTO_CFB=m |
| 664 | 672 | CONFIG_CRYPTO_LRW=m |
| 665 | 673 | CONFIG_CRYPTO_OFB=m |
| @@ -727,7 +735,6 @@ CONFIG_DEBUG_INFO=y · 61 unmodified lines | ||
| 727 | 735 | CONFIG_DEBUG_INFO_DWARF4=y |
| 728 | 736 | CONFIG_GDB_SCRIPTS=y |
| 729 | 737 | CONFIG_FRAME_WARN=1024 |
| 730 | −CONFIG_UNUSED_SYMBOLS=y | |
| 731 | 738 | CONFIG_DEBUG_SECTION_MISMATCH=y |
| 732 | 739 | CONFIG_MAGIC_SYSRQ=y |
| 733 | 740 | CONFIG_DEBUG_MEMORY_INIT=y |
| @@ -61,7 +61,7 @@ CONFIG_RAW_DRIVER=y · 60 unmodified lines | ||
| 61 | 61 | CONFIG_CONFIGFS_FS=y |
| 62 | 62 | # CONFIG_MISC_FILESYSTEMS is not set |
| 63 | 63 | # CONFIG_NETWORK_FILESYSTEMS is not set |
| 64 | −# CONFIG_DIMLIB is not set | |
| 64 | +CONFIG_LSM="yama,loadpin,safesetid,integrity" | |
| 65 | 65 | CONFIG_PRINTK_TIME=y |
| 66 | 66 | CONFIG_DEBUG_INFO=y |
| 67 | 67 | CONFIG_DEBUG_FS=y |
| @@ -41,7 +41,7 @@ __ATOMIC_OPS(__atomic64_xor, long, "laxg") · 40 unmodified lines | ||
| 41 | 41 | #undef __ATOMIC_OP |
| 42 | 42 | |
| 43 | 43 | #define __ATOMIC_CONST_OP(op_name, op_type, op_string, op_barrier) \ |
| 44 | −static inline void op_name(op_type val, op_type *ptr) \ | |
| 44 | +static __always_inline void op_name(op_type val, op_type *ptr) \ | |
| 45 | 45 | { \ |
| 46 | 46 | asm volatile( \ |
| 47 | 47 | op_string " %[ptr],%[val]\n" \ |
| @@ -56,7 +56,7 @@ __bitops_byte(unsigned long nr, volatile unsigned long *ptr) · 55 unmodified lines | ||
| 56 | 56 | return ((unsigned char *)ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | −static inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr) | |
| 59 | +static __always_inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr) | |
| 60 | 60 | { |
| 61 | 61 | unsigned long *addr = __bitops_word(nr, ptr); |
| 62 | 62 | unsigned long mask; |
| @@ -77,7 +77,7 @@ static inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr) · 14 unmodified lines | ||
| 77 | 77 | __atomic64_or(mask, (long *)addr); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | −static inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr) | |
| 80 | +static __always_inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr) | |
| 81 | 81 | { |
| 82 | 82 | unsigned long *addr = __bitops_word(nr, ptr); |
| 83 | 83 | unsigned long mask; |
| @@ -98,8 +98,8 @@ static inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr) · 14 unmodified lines | ||
| 98 | 98 | __atomic64_and(mask, (long *)addr); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | −static inline void arch_change_bit(unsigned long nr, | |
| 102 | − volatile unsigned long *ptr) | |
| 101 | +static __always_inline void arch_change_bit(unsigned long nr, | |
| 102 | + volatile unsigned long *ptr) | |
| 103 | 103 | { |
| 104 | 104 | unsigned long *addr = __bitops_word(nr, ptr); |
| 105 | 105 | unsigned long mask; |
| @@ -171,7 +171,7 @@ typedef struct { unsigned char bytes[16]; } cpacf_mask_t; · 170 unmodified lines | ||
| 171 | 171 | * |
| 172 | 172 | * Returns 1 if @func is available for @opcode, 0 otherwise |
| 173 | 173 | */ |
| 174 | −static inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask) | |
| 174 | +static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask) | |
| 175 | 175 | { |
| 176 | 176 | register unsigned long r0 asm("0") = 0; /* query function */ |
| 177 | 177 | register unsigned long r1 asm("1") = (unsigned long) mask; |
| @@ -28,6 +28,8 @@ asm(".include \"asm/cpu_mf-insn.h\"\n"); · 27 unmodified lines | ||
| 28 | 28 | CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \ |
| 29 | 29 | CPU_MF_INT_SF_LSDA) |
| 30 | 30 | |
| 31 | +#define CPU_MF_SF_RIBM_NOTAV 0x1 /* Sampling unavailable */ | |
| 32 | + | |
| 31 | 33 | /* CPU measurement facility support */ |
| 32 | 34 | static inline int cpum_cf_avail(void) |
| 33 | 35 | { |
| @@ -69,7 +71,8 @@ struct hws_qsi_info_block { /* Bit(s) */ · 35 unmodified lines | ||
| 69 | 71 | unsigned long max_sampl_rate; /* 16-23: maximum sampling interval*/ |
| 70 | 72 | unsigned long tear; /* 24-31: TEAR contents */ |
| 71 | 73 | unsigned long dear; /* 32-39: DEAR contents */ |
| 72 | − unsigned int rsvrd0; /* 40-43: reserved */ | |
| 74 | + unsigned int rsvrd0:24; /* 40-42: reserved */ | |
| 75 | + unsigned int ribm:8; /* 43: Reserved by IBM */ | |
| 73 | 76 | unsigned int cpu_speed; /* 44-47: CPU speed */ |
| 74 | 77 | unsigned long long rsvrd1; /* 48-55: reserved */ |
| 75 | 78 | unsigned long long rsvrd2; /* 56-63: reserved */ |
| @@ -220,7 +223,8 @@ enum stcctm_ctr_set { · 144 unmodified lines | ||
| 220 | 223 | MT_DIAG = 5, |
| 221 | 224 | MT_DIAG_CLEARING = 9, /* clears loss-of-MT-ctr-data alert */ |
| 222 | 225 | }; |
| 223 | −static inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest) | |
| 226 | + | |
| 227 | +static __always_inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest) | |
| 224 | 228 | { |
| 225 | 229 | int cc; |
| 226 | 230 | |
| @@ -12,8 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <asm/page.h> |
| 13 | 13 | #include <asm/pgtable.h> |
| 14 | 14 | |
| 15 | − | |
| 16 | −#define is_hugepage_only_range(mm, addr, len) 0 | |
| 17 | 15 | #define hugetlb_free_pgd_range free_pgd_range |
| 18 | 16 | #define hugepages_supported() (MACHINE_HAS_EDAT1) |
| 19 | 17 | |
| @@ -23,6 +21,13 @@ pte_t huge_ptep_get(pte_t *ptep); · 3 unmodified lines | ||
| 23 | 21 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, |
| 24 | 22 | unsigned long addr, pte_t *ptep); |
| 25 | 23 | |
| 24 | +static inline bool is_hugepage_only_range(struct mm_struct *mm, | |
| 25 | + unsigned long addr, | |
| 26 | + unsigned long len) | |
| 27 | +{ | |
| 28 | + return false; | |
| 29 | +} | |
| 30 | + | |
| 26 | 31 | /* |
| 27 | 32 | * If the arch doesn't supply something else, assume that hugepage |
| 28 | 33 | * size aligned regions are ok without further preparation. |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | * We use a brcl 0,2 instruction for jump labels at compile time so it |
| 21 | 21 | * can be easily distinguished from a hotpatch generated instruction. |
| 22 | 22 | */ |
| 23 | −static inline bool arch_static_branch(struct static_key *key, bool branch) | |
| 23 | +static __always_inline bool arch_static_branch(struct static_key *key, bool branch) | |
| 24 | 24 | { |
| 25 | 25 | asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n" |
| 26 | 26 | ".pushsection __jump_table,\"aw\"\n" |
| @@ -34,7 +34,7 @@ label: · 7 unmodified lines | ||
| 34 | 34 | return true; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | −static inline bool arch_static_branch_jump(struct static_key *key, bool branch) | |
| 37 | +static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) | |
| 38 | 38 | { |
| 39 | 39 | asm_volatile_goto("0: brcl 15,%l[label]\n" |
| 40 | 40 | ".pushsection __jump_table,\"aw\"\n" |
| @@ -997,9 +997,9 @@ static inline pte_t pte_mkhuge(pte_t pte) · 996 unmodified lines | ||
| 997 | 997 | #define IPTE_NODAT 0x400 |
| 998 | 998 | #define IPTE_GUEST_ASCE 0x800 |
| 999 | 999 | |
| 1000 | −static inline void __ptep_ipte(unsigned long address, pte_t *ptep, | |
| 1001 | − unsigned long opt, unsigned long asce, | |
| 1002 | − int local) | |
| 1000 | +static __always_inline void __ptep_ipte(unsigned long address, pte_t *ptep, | |
| 1001 | + unsigned long opt, unsigned long asce, | |
| 1002 | + int local) | |
| 1003 | 1003 | { |
| 1004 | 1004 | unsigned long pto = (unsigned long) ptep; |
| 1005 | 1005 | |
| @@ -1020,8 +1020,8 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep, · 14 unmodified lines | ||
| 1020 | 1020 | : [r1] "a" (pto), [m4] "i" (local) : "memory"); |
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | −static inline void __ptep_ipte_range(unsigned long address, int nr, | |
| 1024 | − pte_t *ptep, int local) | |
| 1023 | +static __always_inline void __ptep_ipte_range(unsigned long address, int nr, | |
| 1024 | + pte_t *ptep, int local) | |
| 1025 | 1025 | { |
| 1026 | 1026 | unsigned long pto = (unsigned long) ptep; |
| 1027 | 1027 | |
| @@ -1269,7 +1269,8 @@ static inline pte_t *pte_offset(pmd_t *pmd, unsigned long address) · 241 unmodified lines | ||
| 1269 | 1269 | |
| 1270 | 1270 | #define pte_offset_kernel(pmd, address) pte_offset(pmd, address) |
| 1271 | 1271 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) |
| 1272 | −#define pte_unmap(pte) do { } while (0) | |
| 1272 | + | |
| 1273 | +static inline void pte_unmap(pte_t *pte) { } | |
| 1273 | 1274 | |
| 1274 | 1275 | static inline bool gup_fast_permitted(unsigned long start, unsigned long end) |
| 1275 | 1276 | { |
| @@ -1435,9 +1436,9 @@ static inline void __pmdp_csp(pmd_t *pmdp) · 159 unmodified lines | ||
| 1435 | 1436 | #define IDTE_NODAT 0x1000 |
| 1436 | 1437 | #define IDTE_GUEST_ASCE 0x2000 |
| 1437 | 1438 | |
| 1438 | −static inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp, | |
| 1439 | − unsigned long opt, unsigned long asce, | |
| 1440 | − int local) | |
| 1439 | +static __always_inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp, | |
| 1440 | + unsigned long opt, unsigned long asce, | |
| 1441 | + int local) | |
| 1441 | 1442 | { |
| 1442 | 1443 | unsigned long sto; |
| 1443 | 1444 | |
| @@ -1461,9 +1462,9 @@ static inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp, · 17 unmodified lines | ||
| 1461 | 1462 | } |
| 1462 | 1463 | } |
| 1463 | 1464 | |
| 1464 | −static inline void __pudp_idte(unsigned long addr, pud_t *pudp, | |
| 1465 | − unsigned long opt, unsigned long asce, | |
| 1466 | − int local) | |
| 1465 | +static __always_inline void __pudp_idte(unsigned long addr, pud_t *pudp, | |
| 1466 | + unsigned long opt, unsigned long asce, | |
| 1467 | + int local) | |
| 1467 | 1468 | { |
| 1468 | 1469 | unsigned long r3o; |
| 1469 | 1470 | |
| @@ -111,7 +111,7 @@ struct qib { · 110 unmodified lines | ||
| 111 | 111 | /* private: */ |
| 112 | 112 | u8 res[88]; |
| 113 | 113 | /* public: */ |
| 114 | − u8 parm[QDIO_MAX_BUFFERS_PER_Q]; | |
| 114 | + u8 parm[128]; | |
| 115 | 115 | } __attribute__ ((packed, aligned(256))); |
| 116 | 116 | |
| 117 | 117 | /** |
| @@ -83,7 +83,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n); · 82 unmodified lines | ||
| 83 | 83 | __rc; \ |
| 84 | 84 | }) |
| 85 | 85 | |
| 86 | −static inline int __put_user_fn(void *x, void __user *ptr, unsigned long size) | |
| 86 | +static __always_inline int __put_user_fn(void *x, void __user *ptr, unsigned long size) | |
| 87 | 87 | { |
| 88 | 88 | unsigned long spec = 0x010000UL; |
| 89 | 89 | int rc; |
| @@ -113,7 +113,7 @@ static inline int __put_user_fn(void *x, void __user *ptr, unsigned long size) · 23 unmodified lines | ||
| 113 | 113 | return rc; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | −static inline int __get_user_fn(void *x, const void __user *ptr, unsigned long size) | |
| 116 | +static __always_inline int __get_user_fn(void *x, const void __user *ptr, unsigned long size) | |
| 117 | 117 | { |
| 118 | 118 | unsigned long spec = 0x01UL; |
| 119 | 119 | int rc; |
| @@ -390,7 +390,7 @@ static size_t cf_diag_getctrset(struct cf_ctrset_entry *ctrdata, int ctrset, · 389 unmodified lines | ||
| 390 | 390 | |
| 391 | 391 | debug_sprintf_event(cf_diag_dbg, 6, |
| 392 | 392 | "%s ctrset %d ctrset_size %zu cfvn %d csvn %d" |
| 393 | − " need %zd rc:%d\n", | |
| 393 | + " need %zd rc %d\n", | |
| 394 | 394 | __func__, ctrset, ctrset_size, cpuhw->info.cfvn, |
| 395 | 395 | cpuhw->info.csvn, need, rc); |
| 396 | 396 | return need; |
| @@ -567,7 +567,7 @@ static int cf_diag_add(struct perf_event *event, int flags) · 170 unmodified lines | ||
| 567 | 567 | int err = 0; |
| 568 | 568 | |
| 569 | 569 | debug_sprintf_event(cf_diag_dbg, 5, |
| 570 | − "%s event %p cpu %d flags %#x cpuhw:%p\n", | |
| 570 | + "%s event %p cpu %d flags %#x cpuhw %p\n", | |
| 571 | 571 | __func__, event, event->cpu, flags, cpuhw); |
| 572 | 572 | |
| 573 | 573 | if (cpuhw->flags & PMU_F_IN_USE) { |
| @@ -803,6 +803,12 @@ static int __hw_perf_event_init(struct perf_event *event) · 802 unmodified lines | ||
| 803 | 803 | goto out; |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | + if (si.ribm & CPU_MF_SF_RIBM_NOTAV) { | |
| 807 | + pr_warn("CPU Measurement Facility sampling is temporarily not available\n"); | |
| 808 | + err = -EBUSY; | |
| 809 | + goto out; | |
| 810 | + } | |
| 811 | + | |
| 806 | 812 | /* Always enable basic sampling */ |
| 807 | 813 | SAMPL_FLAGS(hwc) = PERF_CPUM_SF_BASIC_MODE; |
| 808 | 814 | |
| @@ -895,7 +901,7 @@ static int cpumsf_pmu_event_init(struct perf_event *event) · 86 unmodified lines | ||
| 895 | 901 | |
| 896 | 902 | /* Check online status of the CPU to which the event is pinned */ |
| 897 | 903 | if (event->cpu >= 0 && !cpu_online(event->cpu)) |
| 898 | − return -ENODEV; | |
| 904 | + return -ENODEV; | |
| 899 | 905 | |
| 900 | 906 | /* Force reset of idle/hv excludes regardless of what the |
| 901 | 907 | * user requested. |
| @@ -332,7 +332,7 @@ static inline int plo_test_bit(unsigned char nr) · 331 unmodified lines | ||
| 332 | 332 | return cc == 0; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | −static inline void __insn32_query(unsigned int opcode, u8 query[32]) | |
| 335 | +static __always_inline void __insn32_query(unsigned int opcode, u8 *query) | |
| 336 | 336 | { |
| 337 | 337 | register unsigned long r0 asm("0") = 0; /* query function */ |
| 338 | 338 | register unsigned long r1 asm("1") = (unsigned long) query; |
| @@ -340,9 +340,9 @@ static inline void __insn32_query(unsigned int opcode, u8 query[32]) · 1 unmodified line | ||
| 340 | 340 | asm volatile( |
| 341 | 341 | /* Parameter regs are ignored */ |
| 342 | 342 | " .insn rrf,%[opc] << 16,2,4,6,0\n" |
| 343 | − : "=m" (*query) | |
| 343 | + : | |
| 344 | 344 | : "d" (r0), "a" (r1), [opc] "i" (opcode) |
| 345 | − : "cc"); | |
| 345 | + : "cc", "memory"); | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | #define INSN_SORTL 0xb938 |
| @@ -66,7 +66,7 @@ static inline int clp_get_ilp(unsigned long *ilp) · 65 unmodified lines | ||
| 66 | 66 | /* |
| 67 | 67 | * Call Logical Processor with c=0, the give constant lps and an lpcb request. |
| 68 | 68 | */ |
| 69 | −static inline int clp_req(void *data, unsigned int lps) | |
| 69 | +static __always_inline int clp_req(void *data, unsigned int lps) | |
| 70 | 70 | { |
| 71 | 71 | struct { u8 _[CLP_BLK_SIZE]; } *req = data; |
| 72 | 72 | u64 ignored; |
| @@ -5,12 +5,14 @@ · 4 unmodified lines | ||
| 5 | 5 | #include <linux/init.h> |
| 6 | 6 | #include <linux/slab.h> |
| 7 | 7 | #include <linux/delay.h> |
| 8 | +#include <linux/jiffies.h> | |
| 8 | 9 | #include <asm/apicdef.h> |
| 9 | 10 | #include <asm/nmi.h> |
| 10 | 11 | |
| 11 | 12 | #include "../perf_event.h" |
| 12 | 13 | |
| 13 | −static DEFINE_PER_CPU(unsigned int, perf_nmi_counter); | |
| 14 | +static DEFINE_PER_CPU(unsigned long, perf_nmi_tstamp); | |
| 15 | +static unsigned long perf_nmi_window; | |
| 14 | 16 | |
| 15 | 17 | static __initconst const u64 amd_hw_cache_event_ids |
| 16 | 18 | [PERF_COUNT_HW_CACHE_MAX] |
| @@ -641,11 +643,12 @@ static void amd_pmu_disable_event(struct perf_event *event) · 624 unmodified lines | ||
| 641 | 643 | * handler when multiple PMCs are active or PMC overflow while handling some |
| 642 | 644 | * other source of an NMI. |
| 643 | 645 | * |
| 644 | − * Attempt to mitigate this by using the number of active PMCs to determine | |
| 645 | − * whether to return NMI_HANDLED if the perf NMI handler did not handle/reset | |
| 646 | − * any PMCs. The per-CPU perf_nmi_counter variable is set to a minimum of the | |
| 647 | − * number of active PMCs or 2. The value of 2 is used in case an NMI does not | |
| 648 | − * arrive at the LAPIC in time to be collapsed into an already pending NMI. | |
| 646 | + * Attempt to mitigate this by creating an NMI window in which un-handled NMIs | |
| 647 | + * received during this window will be claimed. This prevents extending the | |
| 648 | + * window past when it is possible that latent NMIs should be received. The | |
| 649 | + * per-CPU perf_nmi_tstamp will be set to the window end time whenever perf has | |
| 650 | + * handled a counter. When an un-handled NMI is received, it will be claimed | |
| 651 | + * only if arriving within that window. | |
| 649 | 652 | */ |
| 650 | 653 | static int amd_pmu_handle_irq(struct pt_regs *regs) |
| 651 | 654 | { |
| @@ -663,21 +666,19 @@ static int amd_pmu_handle_irq(struct pt_regs *regs) · 11 unmodified lines | ||
| 663 | 666 | handled = x86_pmu_handle_irq(regs); |
| 664 | 667 | |
| 665 | 668 | /* |
| 666 | − * If a counter was handled, record the number of possible remaining | |
| 667 | − * NMIs that can occur. | |
| 669 | + * If a counter was handled, record a timestamp such that un-handled | |
| 670 | + * NMIs will be claimed if arriving within that window. | |
| 668 | 671 | */ |
| 669 | 672 | if (handled) { |
| 670 | − this_cpu_write(perf_nmi_counter, | |
| 671 | − min_t(unsigned int, 2, active)); | |
| 673 | + this_cpu_write(perf_nmi_tstamp, | |
| 674 | + jiffies + perf_nmi_window); | |
| 672 | 675 | |
| 673 | 676 | return handled; |
| 674 | 677 | } |
| 675 | 678 | |
| 676 | − if (!this_cpu_read(perf_nmi_counter)) | |
| 679 | + if (time_after(jiffies, this_cpu_read(perf_nmi_tstamp))) | |
| 677 | 680 | return NMI_DONE; |
| 678 | 681 | |
| 679 | − this_cpu_dec(perf_nmi_counter); | |
| 680 | − | |
| 681 | 682 | return NMI_HANDLED; |
| 682 | 683 | } |
| 683 | 684 | |
| @@ -909,6 +910,9 @@ static int __init amd_core_pmu_init(void) · 225 unmodified lines | ||
| 909 | 910 | if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) |
| 910 | 911 | return 0; |
| 911 | 912 | |
| 913 | + /* Avoid calulating the value each time in the NMI handler */ | |
| 914 | + perf_nmi_window = msecs_to_jiffies(100); | |
| 915 | + | |
| 912 | 916 | switch (boot_cpu_data.x86) { |
| 913 | 917 | case 0x15: |
| 914 | 918 | pr_cont("Fam15h "); |
| @@ -4983,6 +4983,8 @@ __init int intel_pmu_init(void) · 4982 unmodified lines | ||
| 4983 | 4983 | case INTEL_FAM6_SKYLAKE: |
| 4984 | 4984 | case INTEL_FAM6_KABYLAKE_L: |
| 4985 | 4985 | case INTEL_FAM6_KABYLAKE: |
| 4986 | + case INTEL_FAM6_COMETLAKE_L: | |
| 4987 | + case INTEL_FAM6_COMETLAKE: | |
| 4986 | 4988 | x86_add_quirk(intel_pebs_isolation_quirk); |
| 4987 | 4989 | x86_pmu.late_ack = true; |
| 4988 | 4990 | memcpy(hw_cache_event_ids, skl_hw_cache_event_ids, sizeof(hw_cache_event_ids)); |
| @@ -5031,6 +5033,8 @@ __init int intel_pmu_init(void) · 42 unmodified lines | ||
| 5031 | 5033 | /* fall through */ |
| 5032 | 5034 | case INTEL_FAM6_ICELAKE_L: |
| 5033 | 5035 | case INTEL_FAM6_ICELAKE: |
| 5036 | + case INTEL_FAM6_TIGERLAKE_L: | |
| 5037 | + case INTEL_FAM6_TIGERLAKE: | |
| 5034 | 5038 | x86_pmu.late_ack = true; |
| 5035 | 5039 | memcpy(hw_cache_event_ids, skl_hw_cache_event_ids, sizeof(hw_cache_event_ids)); |
| 5036 | 5040 | memcpy(hw_cache_extra_regs, skl_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); |
| @@ -45,46 +45,49 @@ · 44 unmodified lines | ||
| 45 | 45 | * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter |
| 46 | 46 | * perf code: 0x01 |
| 47 | 47 | * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM, |
| 48 | − CNL | |
| 48 | + * CNL,KBL,CML | |
| 49 | 49 | * Scope: Core |
| 50 | 50 | * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter |
| 51 | 51 | * perf code: 0x02 |
| 52 | 52 | * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, |
| 53 | − * SKL,KNL,GLM,CNL | |
| 53 | + * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL | |
| 54 | 54 | * Scope: Core |
| 55 | 55 | * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter |
| 56 | 56 | * perf code: 0x03 |
| 57 | − * Available model: SNB,IVB,HSW,BDW,SKL,CNL | |
| 57 | + * Available model: SNB,IVB,HSW,BDW,SKL,CNL,KBL,CML, | |
| 58 | + * ICL,TGL | |
| 58 | 59 | * Scope: Core |
| 59 | 60 | * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. |
| 60 | 61 | * perf code: 0x00 |
| 61 | − * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL | |
| 62 | + * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL, | |
| 63 | + * KBL,CML,ICL,TGL | |
| 62 | 64 | * Scope: Package (physical package) |
| 63 | 65 | * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. |
| 64 | 66 | * perf code: 0x01 |
| 65 | 67 | * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL, |
| 66 | − * GLM,CNL | |
| 68 | + * GLM,CNL,KBL,CML,ICL,TGL | |
| 67 | 69 | * Scope: Package (physical package) |
| 68 | 70 | * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. |
| 69 | 71 | * perf code: 0x02 |
| 70 | 72 | * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW |
| 71 | − * SKL,KNL,GLM,CNL | |
| 73 | + * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL | |
| 72 | 74 | * Scope: Package (physical package) |
| 73 | 75 | * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. |
| 74 | 76 | * perf code: 0x03 |
| 75 | − * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,CNL | |
| 77 | + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,CNL, | |
| 78 | + * KBL,CML,ICL,TGL | |
| 76 | 79 | * Scope: Package (physical package) |
| 77 | 80 | * MSR_PKG_C8_RESIDENCY: Package C8 Residency Counter. |
| 78 | 81 | * perf code: 0x04 |
| 79 | − * Available model: HSW ULT,KBL,CNL | |
| 82 | + * Available model: HSW ULT,KBL,CNL,CML,ICL,TGL | |
| 80 | 83 | * Scope: Package (physical package) |
| 81 | 84 | * MSR_PKG_C9_RESIDENCY: Package C9 Residency Counter. |
| 82 | 85 | * perf code: 0x05 |
| 83 | − * Available model: HSW ULT,KBL,CNL | |
| 86 | + * Available model: HSW ULT,KBL,CNL,CML,ICL,TGL | |
| 84 | 87 | * Scope: Package (physical package) |
| 85 | 88 | * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter. |
| 86 | 89 | * perf code: 0x06 |
| 87 | − * Available model: HSW ULT,KBL,GLM,CNL | |
| 90 | + * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL | |
| 88 | 91 | * Scope: Package (physical package) |
| 89 | 92 | * |
| 90 | 93 | */ |
| @@ -544,6 +547,19 @@ static const struct cstate_model cnl_cstates __initconst = { · 453 unmodified lines | ||
| 544 | 547 | BIT(PERF_CSTATE_PKG_C10_RES), |
| 545 | 548 | }; |
| 546 | 549 | |
| 550 | +static const struct cstate_model icl_cstates __initconst = { | |
| 551 | + .core_events = BIT(PERF_CSTATE_CORE_C6_RES) | | |
| 552 | + BIT(PERF_CSTATE_CORE_C7_RES), | |
| 553 | + | |
| 554 | + .pkg_events = BIT(PERF_CSTATE_PKG_C2_RES) | | |
| 555 | + BIT(PERF_CSTATE_PKG_C3_RES) | | |
| 556 | + BIT(PERF_CSTATE_PKG_C6_RES) | | |
| 557 | + BIT(PERF_CSTATE_PKG_C7_RES) | | |
| 558 | + BIT(PERF_CSTATE_PKG_C8_RES) | | |
| 559 | + BIT(PERF_CSTATE_PKG_C9_RES) | | |
| 560 | + BIT(PERF_CSTATE_PKG_C10_RES), | |
| 561 | +}; | |
| 562 | + | |
| 547 | 563 | static const struct cstate_model slm_cstates __initconst = { |
| 548 | 564 | .core_events = BIT(PERF_CSTATE_CORE_C1_RES) | |
| 549 | 565 | BIT(PERF_CSTATE_CORE_C6_RES), |
| @@ -614,6 +630,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = { · 64 unmodified lines | ||
| 614 | 630 | |
| 615 | 631 | X86_CSTATES_MODEL(INTEL_FAM6_KABYLAKE_L, hswult_cstates), |
| 616 | 632 | X86_CSTATES_MODEL(INTEL_FAM6_KABYLAKE, hswult_cstates), |
| 633 | + X86_CSTATES_MODEL(INTEL_FAM6_COMETLAKE_L, hswult_cstates), | |
| 634 | + X86_CSTATES_MODEL(INTEL_FAM6_COMETLAKE, hswult_cstates), | |
| 617 | 635 | |
| 618 | 636 | X86_CSTATES_MODEL(INTEL_FAM6_CANNONLAKE_L, cnl_cstates), |
| 619 | 637 | |
| @@ -625,8 +643,10 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = { · 5 unmodified lines | ||
| 625 | 643 | |
| 626 | 644 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates), |
| 627 | 645 | |
| 628 | − X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, snb_cstates), | |
| 629 | − X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, snb_cstates), | |
| 646 | + X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, icl_cstates), | |
| 647 | + X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, icl_cstates), | |
| 648 | + X86_CSTATES_MODEL(INTEL_FAM6_TIGERLAKE_L, icl_cstates), | |
| 649 | + X86_CSTATES_MODEL(INTEL_FAM6_TIGERLAKE, icl_cstates), | |
| 630 | 650 | { }, |
| 631 | 651 | }; |
| 632 | 652 | MODULE_DEVICE_TABLE(x86cpu, intel_cstates_match); |
| @@ -89,7 +89,14 @@ static bool test_intel(int idx, void *data) · 88 unmodified lines | ||
| 89 | 89 | case INTEL_FAM6_SKYLAKE_X: |
| 90 | 90 | case INTEL_FAM6_KABYLAKE_L: |
| 91 | 91 | case INTEL_FAM6_KABYLAKE: |
| 92 | + case INTEL_FAM6_COMETLAKE_L: | |
| 93 | + case INTEL_FAM6_COMETLAKE: | |
| 92 | 94 | case INTEL_FAM6_ICELAKE_L: |
| 95 | + case INTEL_FAM6_ICELAKE: | |
| 96 | + case INTEL_FAM6_ICELAKE_X: | |
| 97 | + case INTEL_FAM6_ICELAKE_D: | |
| 98 | + case INTEL_FAM6_TIGERLAKE_L: | |
| 99 | + case INTEL_FAM6_TIGERLAKE: | |
| 93 | 100 | if (idx == PERF_MSR_SMI || idx == PERF_MSR_PPERF) |
| 94 | 101 | return true; |
| 95 | 102 | break; |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | 2 | |
| 3 | 3 | #ifndef _ASM_X86_CPU_ENTRY_AREA_H |
| 4 | 4 | #define _ASM_X86_CPU_ENTRY_AREA_H |
| @@ -83,6 +83,9 @@ · 82 unmodified lines | ||
| 83 | 83 | #define INTEL_FAM6_TIGERLAKE_L 0x8C |
| 84 | 84 | #define INTEL_FAM6_TIGERLAKE 0x8D |
| 85 | 85 | |
| 86 | +#define INTEL_FAM6_COMETLAKE 0xA5 | |
| 87 | +#define INTEL_FAM6_COMETLAKE_L 0xA6 | |
| 88 | + | |
| 86 | 89 | /* "Small Core" Processors (Atom) */ |
| 87 | 90 | |
| 88 | 91 | #define INTEL_FAM6_ATOM_BONNELL 0x1C /* Diamondville, Pineview */ |
| @@ -219,13 +219,6 @@ enum { · 218 unmodified lines | ||
| 219 | 219 | PFERR_WRITE_MASK | \ |
| 220 | 220 | PFERR_PRESENT_MASK) |
| 221 | 221 | |
| 222 | −/* | |
| 223 | − * The mask used to denote special SPTEs, which can be either MMIO SPTEs or | |
| 224 | − * Access Tracking SPTEs. We use bit 62 instead of bit 63 to avoid conflicting | |
| 225 | − * with the SVE bit in EPT PTEs. | |
| 226 | − */ | |
| 227 | −#define SPTE_SPECIAL_MASK (1ULL << 62) | |
| 228 | − | |
| 229 | 222 | /* apic attention bits */ |
| 230 | 223 | #define KVM_APIC_CHECK_VAPIC 0 |
| 231 | 224 | /* |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #define MWAIT_ECX_INTERRUPT_BREAK 0x1 |
| 22 | 22 | #define MWAITX_ECX_TIMER_ENABLE BIT(1) |
| 23 | 23 | #define MWAITX_MAX_LOOPS ((u32)-1) |
| 24 | −#define MWAITX_DISABLE_CSTATES 0xf | |
| 24 | +#define MWAITX_DISABLE_CSTATES 0xf0 | |
| 25 | 25 | |
| 26 | 26 | static inline void __monitor(const void *eax, unsigned long ecx, |
| 27 | 27 | unsigned long edx) |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | 2 | #ifndef _ASM_X86_PTI_H |
| 3 | 3 | #define _ASM_X86_PTI_H |
| 4 | 4 | #ifndef __ASSEMBLY__ |
| @@ -734,5 +734,28 @@ do { \ · 733 unmodified lines | ||
| 734 | 734 | if (unlikely(__gu_err)) goto err_label; \ |
| 735 | 735 | } while (0) |
| 736 | 736 | |
| 737 | +/* | |
| 738 | + * We want the unsafe accessors to always be inlined and use | |
| 739 | + * the error labels - thus the macro games. | |
| 740 | + */ | |
| 741 | +#define unsafe_copy_loop(dst, src, len, type, label) \ | |
| 742 | + while (len >= sizeof(type)) { \ | |
| 743 | + unsafe_put_user(*(type *)src,(type __user *)dst,label); \ | |
| 744 | + dst += sizeof(type); \ | |
| 745 | + src += sizeof(type); \ | |
| 746 | + len -= sizeof(type); \ | |
| 747 | + } | |
| 748 | + | |
| 749 | +#define unsafe_copy_to_user(_dst,_src,_len,label) \ | |
| 750 | +do { \ | |
| 751 | + char __user *__ucu_dst = (_dst); \ | |
| 752 | + const char *__ucu_src = (_src); \ | |
| 753 | + size_t __ucu_len = (_len); \ | |
| 754 | + unsafe_copy_loop(__ucu_dst, __ucu_src, __ucu_len, u64, label); \ | |
| 755 | + unsafe_copy_loop(__ucu_dst, __ucu_src, __ucu_len, u32, label); \ | |
| 756 | + unsafe_copy_loop(__ucu_dst, __ucu_src, __ucu_len, u16, label); \ | |
| 757 | + unsafe_copy_loop(__ucu_dst, __ucu_src, __ucu_len, u8, label); \ | |
| 758 | +} while (0) | |
| 759 | + | |
| 737 | 760 | #endif /* _ASM_X86_UACCESS_H */ |
| 738 | 761 | |
| @@ -49,7 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | #define VMWARE_CMD_VCPU_RESERVED 31 |
| 50 | 50 | |
| 51 | 51 | #define VMWARE_PORT(cmd, eax, ebx, ecx, edx) \ |
| 52 | − __asm__("inl (%%dx)" : \ | |
| 52 | + __asm__("inl (%%dx), %%eax" : \ | |
| 53 | 53 | "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) : \ |
| 54 | 54 | "a"(VMWARE_HYPERVISOR_MAGIC), \ |
| 55 | 55 | "c"(VMWARE_CMD_##cmd), \ |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | 2 | // |
| 3 | 3 | // Code shared between 32 and 64 bit |
| 4 | 4 | |
| @@ -485,6 +485,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, · 484 unmodified lines | ||
| 485 | 485 | |
| 486 | 486 | /* cpuid 0x80000008.ebx */ |
| 487 | 487 | const u32 kvm_cpuid_8000_0008_ebx_x86_features = |
| 488 | + F(CLZERO) | F(XSAVEERPTR) | | |
| 488 | 489 | F(WBNOINVD) | F(AMD_IBPB) | F(AMD_IBRS) | F(AMD_SSBD) | F(VIRT_SSBD) | |
| 489 | 490 | F(AMD_SSB_NO) | F(AMD_STIBP) | F(AMD_STIBP_ALWAYS_ON); |
| 490 | 491 | |
| @@ -618,16 +619,20 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, · 127 unmodified lines | ||
| 618 | 619 | */ |
| 619 | 620 | case 0x1f: |
| 620 | 621 | case 0xb: { |
| 621 | − int i, level_type; | |
| 622 | + int i; | |
| 622 | 623 | |
| 623 | − /* read more entries until level_type is zero */ | |
| 624 | − for (i = 1; ; ++i) { | |
| 624 | + /* | |
| 625 | + * We filled in entry[0] for CPUID(EAX=<function>, | |
| 626 | + * ECX=00H) above. If its level type (ECX[15:8]) is | |
| 627 | + * zero, then the leaf is unimplemented, and we're | |
| 628 | + * done. Otherwise, continue to populate entries | |
| 629 | + * until the level type (ECX[15:8]) of the previously | |
| 630 | + * added entry is zero. | |
| 631 | + */ | |
| 632 | + for (i = 1; entry[i - 1].ecx & 0xff00; ++i) { | |
| 625 | 633 | if (*nent >= maxnent) |
| 626 | 634 | goto out; |
| 627 | 635 | |
| 628 | − level_type = entry[i - 1].ecx & 0xff00; | |
| 629 | − if (!level_type) | |
| 630 | − break; | |
| 631 | 636 | do_host_cpuid(&entry[i], function, i); |
| 632 | 637 | ++*nent; |
| 633 | 638 | } |
| @@ -969,53 +974,66 @@ struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, · 335 unmodified lines | ||
| 969 | 974 | EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry); |
| 970 | 975 | |
| 971 | 976 | /* |
| 972 | − * If no match is found, check whether we exceed the vCPU's limit | |
| 973 | − * and return the content of the highest valid _standard_ leaf instead. | |
| 974 | − * This is to satisfy the CPUID specification. | |
| 977 | + * If the basic or extended CPUID leaf requested is higher than the | |
| 978 | + * maximum supported basic or extended leaf, respectively, then it is | |
| 979 | + * out of range. | |
| 975 | 980 | */ |
| 976 | −static struct kvm_cpuid_entry2* check_cpuid_limit(struct kvm_vcpu *vcpu, | |
| 977 | − u32 function, u32 index) | |
| 981 | +static bool cpuid_function_in_range(struct kvm_vcpu *vcpu, u32 function) | |
| 978 | 982 | { |
| 979 | − struct kvm_cpuid_entry2 *maxlevel; | |
| 980 | − | |
| 981 | − maxlevel = kvm_find_cpuid_entry(vcpu, function & 0x80000000, 0); | |
| 982 | − if (!maxlevel || maxlevel->eax >= function) | |
| 983 | − return NULL; | |
| 984 | − if (function & 0x80000000) { | |
| 985 | − maxlevel = kvm_find_cpuid_entry(vcpu, 0, 0); | |
| 986 | − if (!maxlevel) | |
| 987 | − return NULL; | |
| 988 | − } | |
| 989 | − return kvm_find_cpuid_entry(vcpu, maxlevel->eax, index); | |
| 983 | + struct kvm_cpuid_entry2 *max; | |
| 984 | + | |
| 985 | + max = kvm_find_cpuid_entry(vcpu, function & 0x80000000, 0); | |
| 986 | + return max && function <= max->eax; | |
| 990 | 987 | } |
| 991 | 988 | |
| 992 | 989 | bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, |
| 993 | 990 | u32 *ecx, u32 *edx, bool check_limit) |
| 994 | 991 | { |
| 995 | 992 | u32 function = *eax, index = *ecx; |
| 996 | − struct kvm_cpuid_entry2 *best; | |
| 997 | − bool entry_found = true; | |
| 998 | − | |
| 999 | − best = kvm_find_cpuid_entry(vcpu, function, index); | |
| 1000 | − | |
| 1001 | − if (!best) { | |
| 1002 | − entry_found = false; | |
| 1003 | − if (!check_limit) | |
| 1004 | − goto out; | |
| 993 | + struct kvm_cpuid_entry2 *entry; | |
| 994 | + struct kvm_cpuid_entry2 *max; | |
| 995 | + bool found; | |
| 1005 | 996 | |
| 1006 | − best = check_cpuid_limit(vcpu, function, index); | |
| 997 | + entry = kvm_find_cpuid_entry(vcpu, function, index); | |
| 998 | + found = entry; | |
| 999 | + /* | |
| 1000 | + * Intel CPUID semantics treats any query for an out-of-range | |
| 1001 | + * leaf as if the highest basic leaf (i.e. CPUID.0H:EAX) were | |
| 1002 | + * requested. AMD CPUID semantics returns all zeroes for any | |
| 1003 | + * undefined leaf, whether or not the leaf is in range. | |
| 1004 | + */ | |
| 1005 | + if (!entry && check_limit && !guest_cpuid_is_amd(vcpu) && | |
| 1006 | + !cpuid_function_in_range(vcpu, function)) { | |
| 1007 | + max = kvm_find_cpuid_entry(vcpu, 0, 0); | |
| 1008 | + if (max) { | |
| 1009 | + function = max->eax; | |
| 1010 | + entry = kvm_find_cpuid_entry(vcpu, function, index); | |
| 1011 | + } | |
| 1007 | 1012 | } |
| 1008 | − | |
| 1009 | −out: | |
| 1010 | − if (best) { | |
| 1011 | − *eax = best->eax; | |
| 1012 | − *ebx = best->ebx; | |
| 1013 | − *ecx = best->ecx; | |
| 1014 | − *edx = best->edx; | |
| 1015 | − } else | |
| 1013 | + if (entry) { | |
| 1014 | + *eax = entry->eax; | |
| 1015 | + *ebx = entry->ebx; | |
| 1016 | + *ecx = entry->ecx; | |
| 1017 | + *edx = entry->edx; | |
| 1018 | + } else { | |
| 1016 | 1019 | *eax = *ebx = *ecx = *edx = 0; |
| 1017 | − trace_kvm_cpuid(function, *eax, *ebx, *ecx, *edx, entry_found); | |
| 1018 | − return entry_found; | |
| 1020 | + /* | |
| 1021 | + * When leaf 0BH or 1FH is defined, CL is pass-through | |
| 1022 | + * and EDX is always the x2APIC ID, even for undefined | |
| 1023 | + * subleaves. Index 1 will exist iff the leaf is | |
| 1024 | + * implemented, so we pass through CL iff leaf 1 | |
| 1025 | + * exists. EDX can be copied from any existing index. | |
| 1026 | + */ | |
| 1027 | + if (function == 0xb || function == 0x1f) { | |
| 1028 | + entry = kvm_find_cpuid_entry(vcpu, function, 1); | |
| 1029 | + if (entry) { | |
| 1030 | + *ecx = index & 0xff; | |
| 1031 | + *edx = entry->edx; | |
| 1032 | + } | |
| 1033 | + } | |
| 1034 | + } | |
| 1035 | + trace_kvm_cpuid(function, *eax, *ebx, *ecx, *edx, found); | |
| 1036 | + return found; | |
| 1019 | 1037 | } |
| 1020 | 1038 | EXPORT_SYMBOL_GPL(kvm_cpuid); |
| 1021 | 1039 | |
| @@ -66,9 +66,10 @@ · 65 unmodified lines | ||
| 66 | 66 | #define X2APIC_BROADCAST 0xFFFFFFFFul |
| 67 | 67 | |
| 68 | 68 | static bool lapic_timer_advance_dynamic __read_mostly; |
| 69 | −#define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100 | |
| 70 | −#define LAPIC_TIMER_ADVANCE_ADJUST_MAX 5000 | |
| 71 | −#define LAPIC_TIMER_ADVANCE_ADJUST_INIT 1000 | |
| 69 | +#define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100 /* clock cycles */ | |
| 70 | +#define LAPIC_TIMER_ADVANCE_ADJUST_MAX 10000 /* clock cycles */ | |
| 71 | +#define LAPIC_TIMER_ADVANCE_NS_INIT 1000 | |
| 72 | +#define LAPIC_TIMER_ADVANCE_NS_MAX 5000 | |
| 72 | 73 | /* step-by-step approximation to mitigate fluctuation */ |
| 73 | 74 | #define LAPIC_TIMER_ADVANCE_ADJUST_STEP 8 |
| 74 | 75 | |
| @@ -1504,8 +1505,8 @@ static inline void adjust_lapic_timer_advance(struct kvm_vcpu *vcpu, · 1429 unmodified lines | ||
| 1504 | 1505 | timer_advance_ns += ns/LAPIC_TIMER_ADVANCE_ADJUST_STEP; |
| 1505 | 1506 | } |
| 1506 | 1507 | |
| 1507 | − if (unlikely(timer_advance_ns > LAPIC_TIMER_ADVANCE_ADJUST_MAX)) | |
| 1508 | − timer_advance_ns = LAPIC_TIMER_ADVANCE_ADJUST_INIT; | |
| 1508 | + if (unlikely(timer_advance_ns > LAPIC_TIMER_ADVANCE_NS_MAX)) | |
| 1509 | + timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT; | |
| 1509 | 1510 | apic->lapic_timer.timer_advance_ns = timer_advance_ns; |
| 1510 | 1511 | } |
| 1511 | 1512 | |
| @@ -2302,7 +2303,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns) · 790 unmodified lines | ||
| 2302 | 2303 | HRTIMER_MODE_ABS_HARD); |
| 2303 | 2304 | apic->lapic_timer.timer.function = apic_timer_fn; |
| 2304 | 2305 | if (timer_advance_ns == -1) { |
| 2305 | − apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_ADJUST_INIT; | |
| 2306 | + apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT; | |
| 2306 | 2307 | lapic_timer_advance_dynamic = true; |
| 2307 | 2308 | } else { |
| 2308 | 2309 | apic->lapic_timer.timer_advance_ns = timer_advance_ns; |
| @@ -83,7 +83,17 @@ module_param(dbg, bool, 0644); · 82 unmodified lines | ||
| 83 | 83 | #define PTE_PREFETCH_NUM 8 |
| 84 | 84 | |
| 85 | 85 | #define PT_FIRST_AVAIL_BITS_SHIFT 10 |
| 86 | −#define PT64_SECOND_AVAIL_BITS_SHIFT 52 | |
| 86 | +#define PT64_SECOND_AVAIL_BITS_SHIFT 54 | |
| 87 | + | |
| 88 | +/* | |
| 89 | + * The mask used to denote special SPTEs, which can be either MMIO SPTEs or | |
| 90 | + * Access Tracking SPTEs. | |
| 91 | + */ | |
| 92 | +#define SPTE_SPECIAL_MASK (3ULL << 52) | |
| 93 | +#define SPTE_AD_ENABLED_MASK (0ULL << 52) | |
| 94 | +#define SPTE_AD_DISABLED_MASK (1ULL << 52) | |
| 95 | +#define SPTE_AD_WRPROT_ONLY_MASK (2ULL << 52) | |
| 96 | +#define SPTE_MMIO_MASK (3ULL << 52) | |
| 87 | 97 | |
| 88 | 98 | #define PT64_LEVEL_BITS 9 |
| 89 | 99 | |
| @@ -219,12 +229,11 @@ static u64 __read_mostly shadow_present_mask; · 129 unmodified lines | ||
| 219 | 229 | static u64 __read_mostly shadow_me_mask; |
| 220 | 230 | |
| 221 | 231 | /* |
| 222 | − * SPTEs used by MMUs without A/D bits are marked with shadow_acc_track_value. | |
| 223 | − * Non-present SPTEs with shadow_acc_track_value set are in place for access | |
| 224 | − * tracking. | |
| 232 | + * SPTEs used by MMUs without A/D bits are marked with SPTE_AD_DISABLED_MASK; | |
| 233 | + * shadow_acc_track_mask is the set of bits to be cleared in non-accessed | |
| 234 | + * pages. | |
| 225 | 235 | */ |
| 226 | 236 | static u64 __read_mostly shadow_acc_track_mask; |
| 227 | −static const u64 shadow_acc_track_value = SPTE_SPECIAL_MASK; | |
| 228 | 237 | |
| 229 | 238 | /* |
| 230 | 239 | * The mask/shift to use for saving the original R/X bits when marking the PTE |
| @@ -304,7 +313,7 @@ void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask, u64 mmio_value, u64 access_mask) · 73 unmodified lines | ||
| 304 | 313 | { |
| 305 | 314 | BUG_ON((u64)(unsigned)access_mask != access_mask); |
| 306 | 315 | BUG_ON((mmio_mask & mmio_value) != mmio_value); |
| 307 | − shadow_mmio_value = mmio_value | SPTE_SPECIAL_MASK; | |
| 316 | + shadow_mmio_value = mmio_value | SPTE_MMIO_MASK; | |
| 308 | 317 | shadow_mmio_mask = mmio_mask | SPTE_SPECIAL_MASK; |
| 309 | 318 | shadow_mmio_access_mask = access_mask; |
| 310 | 319 | } |
| @@ -320,10 +329,27 @@ static inline bool sp_ad_disabled(struct kvm_mmu_page *sp) · 9 unmodified lines | ||
| 320 | 329 | return sp->role.ad_disabled; |
| 321 | 330 | } |
| 322 | 331 | |
| 332 | +static inline bool kvm_vcpu_ad_need_write_protect(struct kvm_vcpu *vcpu) | |
| 333 | +{ | |
| 334 | + /* | |
| 335 | + * When using the EPT page-modification log, the GPAs in the log | |
| 336 | + * would come from L2 rather than L1. Therefore, we need to rely | |
| 337 | + * on write protection to record dirty pages. This also bypasses | |
| 338 | + * PML, since writes now result in a vmexit. | |
| 339 | + */ | |
| 340 | + return vcpu->arch.mmu == &vcpu->arch.guest_mmu; | |
| 341 | +} | |
| 342 | + | |
| 323 | 343 | static inline bool spte_ad_enabled(u64 spte) |
| 324 | 344 | { |
| 325 | 345 | MMU_WARN_ON(is_mmio_spte(spte)); |
| 326 | − return !(spte & shadow_acc_track_value); | |
| 346 | + return (spte & SPTE_SPECIAL_MASK) != SPTE_AD_DISABLED_MASK; | |
| 347 | +} | |
| 348 | + | |
| 349 | +static inline bool spte_ad_need_write_protect(u64 spte) | |
| 350 | +{ | |
| 351 | + MMU_WARN_ON(is_mmio_spte(spte)); | |
| 352 | + return (spte & SPTE_SPECIAL_MASK) != SPTE_AD_ENABLED_MASK; | |
| 327 | 353 | } |
| 328 | 354 | |
| 329 | 355 | static inline u64 spte_shadow_accessed_mask(u64 spte) |
| @@ -461,7 +487,7 @@ void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, · 131 unmodified lines | ||
| 461 | 487 | { |
| 462 | 488 | BUG_ON(!dirty_mask != !accessed_mask); |
| 463 | 489 | BUG_ON(!accessed_mask && !acc_track_mask); |
| 464 | − BUG_ON(acc_track_mask & shadow_acc_track_value); | |
| 490 | + BUG_ON(acc_track_mask & SPTE_SPECIAL_MASK); | |
| 465 | 491 | |
| 466 | 492 | shadow_user_mask = user_mask; |
| 467 | 493 | shadow_accessed_mask = accessed_mask; |
| @@ -1589,16 +1615,16 @@ static bool spte_clear_dirty(u64 *sptep) · 1121 unmodified lines | ||
| 1589 | 1615 | |
| 1590 | 1616 | rmap_printk("rmap_clear_dirty: spte %p %llx\n", sptep, *sptep); |
| 1591 | 1617 | |
| 1618 | + MMU_WARN_ON(!spte_ad_enabled(spte)); | |
| 1592 | 1619 | spte &= ~shadow_dirty_mask; |
| 1593 | − | |
| 1594 | 1620 | return mmu_spte_update(sptep, spte); |
| 1595 | 1621 | } |
| 1596 | 1622 | |
| 1597 | −static bool wrprot_ad_disabled_spte(u64 *sptep) | |
| 1623 | +static bool spte_wrprot_for_clear_dirty(u64 *sptep) | |
| 1598 | 1624 | { |
| 1599 | 1625 | bool was_writable = test_and_clear_bit(PT_WRITABLE_SHIFT, |
| 1600 | 1626 | (unsigned long *)sptep); |
| 1601 | − if (was_writable) | |
| 1627 | + if (was_writable && !spte_ad_enabled(*sptep)) | |
| 1602 | 1628 | kvm_set_pfn_dirty(spte_to_pfn(*sptep)); |
| 1603 | 1629 | |
| 1604 | 1630 | return was_writable; |
| @@ -1617,10 +1643,10 @@ static bool __rmap_clear_dirty(struct kvm *kvm, struct kvm_rmap_head *rmap_head) · 12 unmodified lines | ||
| 1617 | 1643 | bool flush = false; |
| 1618 | 1644 | |
| 1619 | 1645 | for_each_rmap_spte(rmap_head, &iter, sptep) |
| 1620 | − if (spte_ad_enabled(*sptep)) | |
| 1621 | − flush |= spte_clear_dirty(sptep); | |
| 1646 | + if (spte_ad_need_write_protect(*sptep)) | |
| 1647 | + flush |= spte_wrprot_for_clear_dirty(sptep); | |
| 1622 | 1648 | else |
| 1623 | − flush |= wrprot_ad_disabled_spte(sptep); | |
| 1649 | + flush |= spte_clear_dirty(sptep); | |
| 1624 | 1650 | |
| 1625 | 1651 | return flush; |
| 1626 | 1652 | } |
| @@ -1631,6 +1657,11 @@ static bool spte_set_dirty(u64 *sptep) · 4 unmodified lines | ||
| 1631 | 1657 | |
| 1632 | 1658 | rmap_printk("rmap_set_dirty: spte %p %llx\n", sptep, *sptep); |
| 1633 | 1659 | |
| 1660 | + /* | |
| 1661 | + * Similar to the !kvm_x86_ops->slot_disable_log_dirty case, | |
| 1662 | + * do not bother adding back write access to pages marked | |
| 1663 | + * SPTE_AD_WRPROT_ONLY_MASK. | |
| 1664 | + */ | |
| 1634 | 1665 | spte |= shadow_dirty_mask; |
| 1635 | 1666 | |
| 1636 | 1667 | return mmu_spte_update(sptep, spte); |
| @@ -2622,7 +2653,7 @@ static void link_shadow_page(struct kvm_vcpu *vcpu, u64 *sptep, · 985 unmodified lines | ||
| 2622 | 2653 | shadow_user_mask | shadow_x_mask | shadow_me_mask; |
| 2623 | 2654 | |
| 2624 | 2655 | if (sp_ad_disabled(sp)) |
| 2625 | − spte |= shadow_acc_track_value; | |
| 2656 | + spte |= SPTE_AD_DISABLED_MASK; | |
| 2626 | 2657 | else |
| 2627 | 2658 | spte |= shadow_accessed_mask; |
| 2628 | 2659 | |
| @@ -2968,7 +2999,9 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, · 339 unmodified lines | ||
| 2968 | 2999 | |
| 2969 | 3000 | sp = page_header(__pa(sptep)); |
| 2970 | 3001 | if (sp_ad_disabled(sp)) |
| 2971 | − spte |= shadow_acc_track_value; | |
| 3002 | + spte |= SPTE_AD_DISABLED_MASK; | |
| 3003 | + else if (kvm_vcpu_ad_need_write_protect(vcpu)) | |
| 3004 | + spte |= SPTE_AD_WRPROT_ONLY_MASK; | |
| 2972 | 3005 | |
| 2973 | 3006 | /* |
| 2974 | 3007 | * For the EPT case, shadow_present_mask is 0 if hardware |
| @@ -2610,7 +2610,7 @@ static int nested_check_vm_entry_controls(struct kvm_vcpu *vcpu, · 2609 unmodified lines | ||
| 2610 | 2610 | |
| 2611 | 2611 | /* VM-entry exception error code */ |
| 2612 | 2612 | if (CC(has_error_code && |
| 2613 | − vmcs12->vm_entry_exception_error_code & GENMASK(31, 15))) | |
| 2613 | + vmcs12->vm_entry_exception_error_code & GENMASK(31, 16))) | |
| 2614 | 2614 | return -EINVAL; |
| 2615 | 2615 | |
| 2616 | 2616 | /* VM-entry interruption-info field: reserved bits */ |
| @@ -262,6 +262,7 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 261 unmodified lines | ||
| 262 | 262 | static void intel_pmu_refresh(struct kvm_vcpu *vcpu) |
| 263 | 263 | { |
| 264 | 264 | struct kvm_pmu *pmu = vcpu_to_pmu(vcpu); |
| 265 | + struct x86_pmu_capability x86_pmu; | |
| 265 | 266 | struct kvm_cpuid_entry2 *entry; |
| 266 | 267 | union cpuid10_eax eax; |
| 267 | 268 | union cpuid10_edx edx; |
| @@ -283,8 +284,10 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) · 15 unmodified lines | ||
| 283 | 284 | if (!pmu->version) |
| 284 | 285 | return; |
| 285 | 286 | |
| 287 | + perf_get_x86_pmu_capability(&x86_pmu); | |
| 288 | + | |
| 286 | 289 | pmu->nr_arch_gp_counters = min_t(int, eax.split.num_counters, |
| 287 | − INTEL_PMC_MAX_GENERIC); | |
| 290 | + x86_pmu.num_counters_gp); | |
| 288 | 291 | pmu->counter_bitmask[KVM_PMC_GP] = ((u64)1 << eax.split.bit_width) - 1; |
| 289 | 292 | pmu->available_event_types = ~entry->ebx & |
| 290 | 293 | ((1ull << eax.split.mask_length) - 1); |
| @@ -294,7 +297,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) · 3 unmodified lines | ||
| 294 | 297 | } else { |
| 295 | 298 | pmu->nr_arch_fixed_counters = |
| 296 | 299 | min_t(int, edx.split.num_counters_fixed, |
| 297 | − INTEL_PMC_MAX_FIXED); | |
| 300 | + x86_pmu.num_counters_fixed); | |
| 298 | 301 | pmu->counter_bitmask[KVM_PMC_FIXED] = |
| 299 | 302 | ((u64)1 << edx.split.bit_width_fixed) - 1; |
| 300 | 303 | } |
| @@ -209,6 +209,11 @@ static int vmx_setup_l1d_flush(enum vmx_l1d_flush_state l1tf) · 208 unmodified lines | ||
| 209 | 209 | struct page *page; |
| 210 | 210 | unsigned int i; |
| 211 | 211 | |
| 212 | + if (!boot_cpu_has_bug(X86_BUG_L1TF)) { | |
| 213 | + l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NOT_REQUIRED; | |
| 214 | + return 0; | |
| 215 | + } | |
| 216 | + | |
| 212 | 217 | if (!enable_ept) { |
| 213 | 218 | l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_EPT_DISABLED; |
| 214 | 219 | return 0; |
| @@ -7995,12 +8000,10 @@ static int __init vmx_init(void) · 7780 unmodified lines | ||
| 7995 | 8000 | * contain 'auto' which will be turned into the default 'cond' |
| 7996 | 8001 | * mitigation mode. |
| 7997 | 8002 | */ |
| 7998 | − if (boot_cpu_has(X86_BUG_L1TF)) { | |
| 7999 | − r = vmx_setup_l1d_flush(vmentry_l1d_flush_param); | |
| 8000 | − if (r) { | |
| 8001 | − vmx_exit(); | |
| 8002 | − return r; | |
| 8003 | − } | |
| 8003 | + r = vmx_setup_l1d_flush(vmentry_l1d_flush_param); | |
| 8004 | + if (r) { | |
| 8005 | + vmx_exit(); | |
| 8006 | + return r; | |
| 8004 | 8007 | } |
| 8005 | 8008 | |
| 8006 | 8009 | #ifdef CONFIG_KEXEC_CORE |
| @@ -92,8 +92,8 @@ u64 __read_mostly efer_reserved_bits = ~((u64)(EFER_SCE | EFER_LME | EFER_LMA)); · 91 unmodified lines | ||
| 92 | 92 | static u64 __read_mostly efer_reserved_bits = ~((u64)EFER_SCE); |
| 93 | 93 | #endif |
| 94 | 94 | |
| 95 | −#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM | |
| 96 | −#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU | |
| 95 | +#define VM_STAT(x, ...) offsetof(struct kvm, stat.x), KVM_STAT_VM, ## __VA_ARGS__ | |
| 96 | +#define VCPU_STAT(x, ...) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, ## __VA_ARGS__ | |
| 97 | 97 | |
| 98 | 98 | #define KVM_X2APIC_API_VALID_FLAGS (KVM_X2APIC_API_USE_32BIT_IDS | \ |
| 99 | 99 | KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK) |
| @@ -212,7 +212,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { · 112 unmodified lines | ||
| 212 | 212 | { "mmu_cache_miss", VM_STAT(mmu_cache_miss) }, |
| 213 | 213 | { "mmu_unsync", VM_STAT(mmu_unsync) }, |
| 214 | 214 | { "remote_tlb_flush", VM_STAT(remote_tlb_flush) }, |
| 215 | − { "largepages", VM_STAT(lpages) }, | |
| 215 | + { "largepages", VM_STAT(lpages, .mode = 0444) }, | |
| 216 | 216 | { "max_mmu_page_hash_collisions", |
| 217 | 217 | VM_STAT(max_mmu_page_hash_collisions) }, |
| 218 | 218 | { NULL } |
| @@ -885,34 +885,42 @@ int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) · 666 unmodified lines | ||
| 885 | 885 | } |
| 886 | 886 | EXPORT_SYMBOL_GPL(kvm_set_xcr); |
| 887 | 887 | |
| 888 | −int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |
| 888 | +static int kvm_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |
| 889 | 889 | { |
| 890 | − unsigned long old_cr4 = kvm_read_cr4(vcpu); | |
| 891 | − unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE | | |
| 892 | − X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE; | |
| 893 | − | |
| 894 | 890 | if (cr4 & CR4_RESERVED_BITS) |
| 895 | − return 1; | |
| 891 | + return -EINVAL; | |
| 896 | 892 | |
| 897 | 893 | if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) && (cr4 & X86_CR4_OSXSAVE)) |
| 898 | − return 1; | |
| 894 | + return -EINVAL; | |
| 899 | 895 | |
| 900 | 896 | if (!guest_cpuid_has(vcpu, X86_FEATURE_SMEP) && (cr4 & X86_CR4_SMEP)) |
| 901 | − return 1; | |
| 897 | + return -EINVAL; | |
| 902 | 898 | |
| 903 | 899 | if (!guest_cpuid_has(vcpu, X86_FEATURE_SMAP) && (cr4 & X86_CR4_SMAP)) |
| 904 | − return 1; | |
| 900 | + return -EINVAL; | |
| 905 | 901 | |
| 906 | 902 | if (!guest_cpuid_has(vcpu, X86_FEATURE_FSGSBASE) && (cr4 & X86_CR4_FSGSBASE)) |
| 907 | − return 1; | |
| 903 | + return -EINVAL; | |
| 908 | 904 | |
| 909 | 905 | if (!guest_cpuid_has(vcpu, X86_FEATURE_PKU) && (cr4 & X86_CR4_PKE)) |
| 910 | − return 1; | |
| 906 | + return -EINVAL; | |
| 911 | 907 | |
| 912 | 908 | if (!guest_cpuid_has(vcpu, X86_FEATURE_LA57) && (cr4 & X86_CR4_LA57)) |
| 913 | − return 1; | |
| 909 | + return -EINVAL; | |
| 914 | 910 | |
| 915 | 911 | if (!guest_cpuid_has(vcpu, X86_FEATURE_UMIP) && (cr4 & X86_CR4_UMIP)) |
| 912 | + return -EINVAL; | |
| 913 | + | |
| 914 | + return 0; | |
| 915 | +} | |
| 916 | + | |
| 917 | +int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |
| 918 | +{ | |
| 919 | + unsigned long old_cr4 = kvm_read_cr4(vcpu); | |
| 920 | + unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE | | |
| 921 | + X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE; | |
| 922 | + | |
| 923 | + if (kvm_valid_cr4(vcpu, cr4)) | |
| 916 | 924 | return 1; |
| 917 | 925 | |
| 918 | 926 | if (is_long_mode(vcpu)) { |
| @@ -1161,13 +1169,6 @@ static u32 msrs_to_save[] = { · 242 unmodified lines | ||
| 1161 | 1169 | MSR_ARCH_PERFMON_PERFCTR0 + 12, MSR_ARCH_PERFMON_PERFCTR0 + 13, |
| 1162 | 1170 | MSR_ARCH_PERFMON_PERFCTR0 + 14, MSR_ARCH_PERFMON_PERFCTR0 + 15, |
| 1163 | 1171 | MSR_ARCH_PERFMON_PERFCTR0 + 16, MSR_ARCH_PERFMON_PERFCTR0 + 17, |
| 1164 | − MSR_ARCH_PERFMON_PERFCTR0 + 18, MSR_ARCH_PERFMON_PERFCTR0 + 19, | |
| 1165 | − MSR_ARCH_PERFMON_PERFCTR0 + 20, MSR_ARCH_PERFMON_PERFCTR0 + 21, | |
| 1166 | − MSR_ARCH_PERFMON_PERFCTR0 + 22, MSR_ARCH_PERFMON_PERFCTR0 + 23, | |
| 1167 | − MSR_ARCH_PERFMON_PERFCTR0 + 24, MSR_ARCH_PERFMON_PERFCTR0 + 25, | |
| 1168 | − MSR_ARCH_PERFMON_PERFCTR0 + 26, MSR_ARCH_PERFMON_PERFCTR0 + 27, | |
| 1169 | − MSR_ARCH_PERFMON_PERFCTR0 + 28, MSR_ARCH_PERFMON_PERFCTR0 + 29, | |
| 1170 | − MSR_ARCH_PERFMON_PERFCTR0 + 30, MSR_ARCH_PERFMON_PERFCTR0 + 31, | |
| 1171 | 1172 | MSR_ARCH_PERFMON_EVENTSEL0, MSR_ARCH_PERFMON_EVENTSEL1, |
| 1172 | 1173 | MSR_ARCH_PERFMON_EVENTSEL0 + 2, MSR_ARCH_PERFMON_EVENTSEL0 + 3, |
| 1173 | 1174 | MSR_ARCH_PERFMON_EVENTSEL0 + 4, MSR_ARCH_PERFMON_EVENTSEL0 + 5, |
| @@ -1177,13 +1178,6 @@ static u32 msrs_to_save[] = { · 3 unmodified lines | ||
| 1177 | 1178 | MSR_ARCH_PERFMON_EVENTSEL0 + 12, MSR_ARCH_PERFMON_EVENTSEL0 + 13, |
| 1178 | 1179 | MSR_ARCH_PERFMON_EVENTSEL0 + 14, MSR_ARCH_PERFMON_EVENTSEL0 + 15, |
| 1179 | 1180 | MSR_ARCH_PERFMON_EVENTSEL0 + 16, MSR_ARCH_PERFMON_EVENTSEL0 + 17, |
| 1180 | − MSR_ARCH_PERFMON_EVENTSEL0 + 18, MSR_ARCH_PERFMON_EVENTSEL0 + 19, | |
| 1181 | − MSR_ARCH_PERFMON_EVENTSEL0 + 20, MSR_ARCH_PERFMON_EVENTSEL0 + 21, | |
| 1182 | − MSR_ARCH_PERFMON_EVENTSEL0 + 22, MSR_ARCH_PERFMON_EVENTSEL0 + 23, | |
| 1183 | − MSR_ARCH_PERFMON_EVENTSEL0 + 24, MSR_ARCH_PERFMON_EVENTSEL0 + 25, | |
| 1184 | − MSR_ARCH_PERFMON_EVENTSEL0 + 26, MSR_ARCH_PERFMON_EVENTSEL0 + 27, | |
| 1185 | − MSR_ARCH_PERFMON_EVENTSEL0 + 28, MSR_ARCH_PERFMON_EVENTSEL0 + 29, | |
| 1186 | − MSR_ARCH_PERFMON_EVENTSEL0 + 30, MSR_ARCH_PERFMON_EVENTSEL0 + 31, | |
| 1187 | 1181 | }; |
| 1188 | 1182 | |
| 1189 | 1183 | static unsigned num_msrs_to_save; |
| @@ -5097,13 +5091,14 @@ out: · 3907 unmodified lines | ||
| 5097 | 5091 | |
| 5098 | 5092 | static void kvm_init_msr_list(void) |
| 5099 | 5093 | { |
| 5094 | + struct x86_pmu_capability x86_pmu; | |
| 5100 | 5095 | u32 dummy[2]; |
| 5101 | 5096 | unsigned i, j; |
| 5102 | 5097 | |
| 5103 | 5098 | BUILD_BUG_ON_MSG(INTEL_PMC_MAX_FIXED != 4, |
| 5104 | 5099 | "Please update the fixed PMCs in msrs_to_save[]"); |
| 5105 | − BUILD_BUG_ON_MSG(INTEL_PMC_MAX_GENERIC != 32, | |
| 5106 | − "Please update the generic perfctr/eventsel MSRs in msrs_to_save[]"); | |
| 5100 | + | |
| 5101 | + perf_get_x86_pmu_capability(&x86_pmu); | |
| 5107 | 5102 | |
| 5108 | 5103 | for (i = j = 0; i < ARRAY_SIZE(msrs_to_save); i++) { |
| 5109 | 5104 | if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0) |
| @@ -5145,6 +5140,15 @@ static void kvm_init_msr_list(void) · 35 unmodified lines | ||
| 5145 | 5140 | intel_pt_validate_hw_cap(PT_CAP_num_address_ranges) * 2) |
| 5146 | 5141 | continue; |
| 5147 | 5142 | break; |
| 5143 | + case MSR_ARCH_PERFMON_PERFCTR0 ... MSR_ARCH_PERFMON_PERFCTR0 + 17: | |
| 5144 | + if (msrs_to_save[i] - MSR_ARCH_PERFMON_PERFCTR0 >= | |
| 5145 | + min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp)) | |
| 5146 | + continue; | |
| 5147 | + break; | |
| 5148 | + case MSR_ARCH_PERFMON_EVENTSEL0 ... MSR_ARCH_PERFMON_EVENTSEL0 + 17: | |
| 5149 | + if (msrs_to_save[i] - MSR_ARCH_PERFMON_EVENTSEL0 >= | |
| 5150 | + min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp)) | |
| 5151 | + continue; | |
| 5148 | 5152 | } |
| 5149 | 5153 | default: |
| 5150 | 5154 | break; |
| @@ -8714,10 +8718,6 @@ EXPORT_SYMBOL_GPL(kvm_task_switch); · 3563 unmodified lines | ||
| 8714 | 8718 | |
| 8715 | 8719 | static int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) |
| 8716 | 8720 | { |
| 8717 | − if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) && | |
| 8718 | − (sregs->cr4 & X86_CR4_OSXSAVE)) | |
| 8719 | − return -EINVAL; | |
| 8720 | − | |
| 8721 | 8721 | if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG)) { |
| 8722 | 8722 | /* |
| 8723 | 8723 | * When EFER.LME and CR0.PG are set, the processor is in |
| @@ -8736,7 +8736,7 @@ static int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) · 12 unmodified lines | ||
| 8736 | 8736 | return -EINVAL; |
| 8737 | 8737 | } |
| 8738 | 8738 | |
| 8739 | − return 0; | |
| 8739 | + return kvm_valid_cr4(vcpu, sregs->cr4); | |
| 8740 | 8740 | } |
| 8741 | 8741 | |
| 8742 | 8742 | static int __set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) |
| @@ -113,8 +113,8 @@ static void delay_mwaitx(unsigned long __loops) · 112 unmodified lines | ||
| 113 | 113 | __monitorx(raw_cpu_ptr(&cpu_tss_rw), 0, 0); |
| 114 | 114 | |
| 115 | 115 | /* |
| 116 | − * AMD, like Intel, supports the EAX hint and EAX=0xf | |
| 117 | − * means, do not enter any deep C-state and we use it | |
| 116 | + * AMD, like Intel's MWAIT version, supports the EAX hint and | |
| 117 | + * EAX=0xf0 means, do not enter any deep C-state and we use it | |
| 118 | 118 | * here in delay() to minimize wakeup latency. |
| 119 | 119 | */ |
| 120 | 120 | __mwaitx(MWAITX_DISABLE_CSTATES, delay, MWAITX_ECX_TIMER_ENABLE); |
| @@ -917,9 +917,6 @@ static void __init kexec_enter_virtual_mode(void) · 916 unmodified lines | ||
| 917 | 917 | |
| 918 | 918 | if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX)) |
| 919 | 919 | runtime_code_page_mkexec(); |
| 920 | − | |
| 921 | − /* clean DUMMY object */ | |
| 922 | − efi_delete_dummy_variable(); | |
| 923 | 920 | #endif |
| 924 | 921 | } |
| 925 | 922 | |
| @@ -57,19 +57,7 @@ static efi_system_table_t __init *xen_efi_probe(void) · 56 unmodified lines | ||
| 57 | 57 | return NULL; |
| 58 | 58 | |
| 59 | 59 | /* Here we know that Xen runs on EFI platform. */ |
| 60 | − | |
| 61 | − efi.get_time = xen_efi_get_time; | |
| 62 | − efi.set_time = xen_efi_set_time; | |
| 63 | − efi.get_wakeup_time = xen_efi_get_wakeup_time; | |
| 64 | − efi.set_wakeup_time = xen_efi_set_wakeup_time; | |
| 65 | − efi.get_variable = xen_efi_get_variable; | |
| 66 | − efi.get_next_variable = xen_efi_get_next_variable; | |
| 67 | − efi.set_variable = xen_efi_set_variable; | |
| 68 | − efi.query_variable_info = xen_efi_query_variable_info; | |
| 69 | − efi.update_capsule = xen_efi_update_capsule; | |
| 70 | − efi.query_capsule_caps = xen_efi_query_capsule_caps; | |
| 71 | − efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; | |
| 72 | − efi.reset_system = xen_efi_reset_system; | |
| 60 | + xen_efi_runtime_setup(); | |
| 73 | 61 | |
| 74 | 62 | efi_systab_xen.tables = info->cfg.addr; |
| 75 | 63 | efi_systab_xen.nr_tables = info->cfg.nent; |
| @@ -269,19 +269,41 @@ void xen_reboot(int reason) · 268 unmodified lines | ||
| 269 | 269 | BUG(); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | +static int reboot_reason = SHUTDOWN_reboot; | |
| 273 | +static bool xen_legacy_crash; | |
| 272 | 274 | void xen_emergency_restart(void) |
| 273 | 275 | { |
| 274 | − xen_reboot(SHUTDOWN_reboot); | |
| 276 | + xen_reboot(reboot_reason); | |
| 275 | 277 | } |
| 276 | 278 | |
| 277 | 279 | static int |
| 278 | 280 | xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr) |
| 279 | 281 | { |
| 280 | − if (!kexec_crash_loaded()) | |
| 281 | − xen_reboot(SHUTDOWN_crash); | |
| 282 | + if (!kexec_crash_loaded()) { | |
| 283 | + if (xen_legacy_crash) | |
| 284 | + xen_reboot(SHUTDOWN_crash); | |
| 285 | + | |
| 286 | + reboot_reason = SHUTDOWN_crash; | |
| 287 | + | |
| 288 | + /* | |
| 289 | + * If panic_timeout==0 then we are supposed to wait forever. | |
| 290 | + * However, to preserve original dom0 behavior we have to drop | |
| 291 | + * into hypervisor. (domU behavior is controlled by its | |
| 292 | + * config file) | |
| 293 | + */ | |
| 294 | + if (panic_timeout == 0) | |
| 295 | + panic_timeout = -1; | |
| 296 | + } | |
| 282 | 297 | return NOTIFY_DONE; |
| 283 | 298 | } |
| 284 | 299 | |
| 300 | +static int __init parse_xen_legacy_crash(char *arg) | |
| 301 | +{ | |
| 302 | + xen_legacy_crash = true; | |
| 303 | + return 0; | |
| 304 | +} | |
| 305 | +early_param("xen_legacy_crash", parse_xen_legacy_crash); | |
| 306 | + | |
| 285 | 307 | static struct notifier_block xen_panic_block = { |
| 286 | 308 | .notifier_call = xen_panic_event, |
| 287 | 309 | .priority = INT_MIN |
| @@ -1992,10 +1992,14 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 1991 unmodified lines | ||
| 1992 | 1992 | /* bypass scheduler for flush rq */ |
| 1993 | 1993 | blk_insert_flush(rq); |
| 1994 | 1994 | blk_mq_run_hw_queue(data.hctx, true); |
| 1995 | − } else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs)) { | |
| 1995 | + } else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs || | |
| 1996 | + !blk_queue_nonrot(q))) { | |
| 1996 | 1997 | /* |
| 1997 | 1998 | * Use plugging if we have a ->commit_rqs() hook as well, as |
| 1998 | 1999 | * we know the driver uses bd->last in a smart fashion. |
| 2000 | + * | |
| 2001 | + * Use normal plugging if this disk is slow HDD, as sequential | |
| 2002 | + * IO may benefit a lot from plug merging. | |
| 1999 | 2003 | */ |
| 2000 | 2004 | unsigned int request_count = plug->rq_count; |
| 2001 | 2005 | struct request *last = NULL; |
| @@ -2012,6 +2016,8 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 10 unmodified lines | ||
| 2012 | 2016 | } |
| 2013 | 2017 | |
| 2014 | 2018 | blk_add_rq_to_plug(plug, rq); |
| 2019 | + } else if (q->elevator) { | |
| 2020 | + blk_mq_sched_insert_request(rq, false, true, true); | |
| 2015 | 2021 | } else if (plug && !blk_queue_nomerges(q)) { |
| 2016 | 2022 | /* |
| 2017 | 2023 | * We do limited plugging. If the bio can be merged, do that. |
| @@ -2035,8 +2041,8 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 17 unmodified lines | ||
| 2035 | 2041 | blk_mq_try_issue_directly(data.hctx, same_queue_rq, |
| 2036 | 2042 | &cookie); |
| 2037 | 2043 | } |
| 2038 | − } else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator && | |
| 2039 | − !data.hctx->dispatch_busy)) { | |
| 2044 | + } else if ((q->nr_hw_queues > 1 && is_sync) || | |
| 2045 | + !data.hctx->dispatch_busy) { | |
| 2040 | 2046 | blk_mq_try_issue_directly(data.hctx, rq, &cookie); |
| 2041 | 2047 | } else { |
| 2042 | 2048 | blk_mq_sched_insert_request(rq, false, true, true); |
| @@ -160,24 +160,27 @@ bool rq_depth_calc_max_depth(struct rq_depth *rqd) · 159 unmodified lines | ||
| 160 | 160 | return ret; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | −void rq_depth_scale_up(struct rq_depth *rqd) | |
| 163 | +/* Returns true on success and false if scaling up wasn't possible */ | |
| 164 | +bool rq_depth_scale_up(struct rq_depth *rqd) | |
| 164 | 165 | { |
| 165 | 166 | /* |
| 166 | 167 | * Hit max in previous round, stop here |
| 167 | 168 | */ |
| 168 | 169 | if (rqd->scaled_max) |
| 169 | − return; | |
| 170 | + return false; | |
| 170 | 171 | |
| 171 | 172 | rqd->scale_step--; |
| 172 | 173 | |
| 173 | 174 | rqd->scaled_max = rq_depth_calc_max_depth(rqd); |
| 175 | + return true; | |
| 174 | 176 | } |
| 175 | 177 | |
| 176 | 178 | /* |
| 177 | 179 | * Scale rwb down. If 'hard_throttle' is set, do it quicker, since we |
| 178 | − * had a latency violation. | |
| 180 | + * had a latency violation. Returns true on success and returns false if | |
| 181 | + * scaling down wasn't possible. | |
| 179 | 182 | */ |
| 180 | −void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle) | |
| 183 | +bool rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle) | |
| 181 | 184 | { |
| 182 | 185 | /* |
| 183 | 186 | * Stop scaling down when we've hit the limit. This also prevents |
| @@ -185,7 +188,7 @@ void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle) · 1 unmodified line | ||
| 185 | 188 | * keep up. |
| 186 | 189 | */ |
| 187 | 190 | if (rqd->max_depth == 1) |
| 188 | − return; | |
| 191 | + return false; | |
| 189 | 192 | |
| 190 | 193 | if (rqd->scale_step < 0 && hard_throttle) |
| 191 | 194 | rqd->scale_step = 0; |
| @@ -194,6 +197,7 @@ void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle) · 2 unmodified lines | ||
| 194 | 197 | |
| 195 | 198 | rqd->scaled_max = false; |
| 196 | 199 | rq_depth_calc_max_depth(rqd); |
| 200 | + return true; | |
| 197 | 201 | } |
| 198 | 202 | |
| 199 | 203 | struct rq_qos_wait_data { |
| @@ -130,8 +130,8 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data, · 129 unmodified lines | ||
| 130 | 130 | acquire_inflight_cb_t *acquire_inflight_cb, |
| 131 | 131 | cleanup_cb_t *cleanup_cb); |
| 132 | 132 | bool rq_wait_inc_below(struct rq_wait *rq_wait, unsigned int limit); |
| 133 | −void rq_depth_scale_up(struct rq_depth *rqd); | |
| 134 | −void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle); | |
| 133 | +bool rq_depth_scale_up(struct rq_depth *rqd); | |
| 134 | +bool rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle); | |
| 135 | 135 | bool rq_depth_calc_max_depth(struct rq_depth *rqd); |
| 136 | 136 | |
| 137 | 137 | void __rq_qos_cleanup(struct rq_qos *rqos, struct bio *bio); |
| @@ -308,7 +308,8 @@ static void calc_wb_limits(struct rq_wb *rwb) · 307 unmodified lines | ||
| 308 | 308 | |
| 309 | 309 | static void scale_up(struct rq_wb *rwb) |
| 310 | 310 | { |
| 311 | − rq_depth_scale_up(&rwb->rq_depth); | |
| 311 | + if (!rq_depth_scale_up(&rwb->rq_depth)) | |
| 312 | + return; | |
| 312 | 313 | calc_wb_limits(rwb); |
| 313 | 314 | rwb->unknown_cnt = 0; |
| 314 | 315 | rwb_wake_all(rwb); |
| @@ -317,7 +318,8 @@ static void scale_up(struct rq_wb *rwb) · 2 unmodified lines | ||
| 317 | 318 | |
| 318 | 319 | static void scale_down(struct rq_wb *rwb, bool hard_throttle) |
| 319 | 320 | { |
| 320 | − rq_depth_scale_down(&rwb->rq_depth, hard_throttle); | |
| 321 | + if (!rq_depth_scale_down(&rwb->rq_depth, hard_throttle)) | |
| 322 | + return; | |
| 321 | 323 | calc_wb_limits(rwb); |
| 322 | 324 | rwb->unknown_cnt = 0; |
| 323 | 325 | rwb_trace_step(rwb, "scale down"); |
| @@ -129,7 +129,7 @@ static const u8 opaluid[][OPAL_UID_LENGTH] = { · 128 unmodified lines | ||
| 129 | 129 | { 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x84, 0x01 }, |
| 130 | 130 | |
| 131 | 131 | /* tables */ |
| 132 | − [OPAL_TABLE_TABLE] | |
| 132 | + [OPAL_TABLE_TABLE] = | |
| 133 | 133 | { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01 }, |
| 134 | 134 | [OPAL_LOCKINGRANGE_GLOBAL] = |
| 135 | 135 | { 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x01 }, |
| @@ -372,8 +372,8 @@ static void check_geometry(struct opal_dev *dev, const void *data) · 236 unmodified lines | ||
| 372 | 372 | { |
| 373 | 373 | const struct d0_geometry_features *geo = data; |
| 374 | 374 | |
| 375 | − dev->align = geo->alignment_granularity; | |
| 376 | − dev->lowest_lba = geo->lowest_aligned_lba; | |
| 375 | + dev->align = be64_to_cpu(geo->alignment_granularity); | |
| 376 | + dev->lowest_lba = be64_to_cpu(geo->lowest_aligned_lba); | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | static int execute_step(struct opal_dev *dev, |
| @@ -57,6 +57,7 @@ · 56 unmodified lines | ||
| 57 | 57 | #include <linux/sched/signal.h> |
| 58 | 58 | #include <linux/sched/mm.h> |
| 59 | 59 | #include <linux/seq_file.h> |
| 60 | +#include <linux/string.h> | |
| 60 | 61 | #include <linux/uaccess.h> |
| 61 | 62 | #include <linux/pid_namespace.h> |
| 62 | 63 | #include <linux/security.h> |
| @@ -66,6 +67,7 @@ · 3 unmodified lines | ||
| 66 | 67 | #include <linux/task_work.h> |
| 67 | 68 | |
| 68 | 69 | #include <uapi/linux/android/binder.h> |
| 70 | +#include <uapi/linux/android/binderfs.h> | |
| 69 | 71 | |
| 70 | 72 | #include <asm/cacheflush.h> |
| 71 | 73 | |
| @@ -2876,7 +2878,7 @@ static void binder_transaction(struct binder_proc *proc, · 2804 unmodified lines | ||
| 2876 | 2878 | e->target_handle = tr->target.handle; |
| 2877 | 2879 | e->data_size = tr->data_size; |
| 2878 | 2880 | e->offsets_size = tr->offsets_size; |
| 2879 | − e->context_name = proc->context->name; | |
| 2881 | + strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME); | |
| 2880 | 2882 | |
| 2881 | 2883 | if (reply) { |
| 2882 | 2884 | binder_inner_proc_lock(proc); |
| @@ -156,7 +156,7 @@ static struct binder_buffer *binder_alloc_prepare_to_free_locked( · 155 unmodified lines | ||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | − * binder_alloc_buffer_lookup() - get buffer given user ptr | |
| 159 | + * binder_alloc_prepare_to_free() - get buffer given user ptr | |
| 160 | 160 | * @alloc: binder_alloc for this proc |
| 161 | 161 | * @user_ptr: User pointer to buffer data |
| 162 | 162 | * |
| @@ -130,7 +130,7 @@ struct binder_transaction_log_entry { · 129 unmodified lines | ||
| 130 | 130 | int return_error_line; |
| 131 | 131 | uint32_t return_error; |
| 132 | 132 | uint32_t return_error_param; |
| 133 | − const char *context_name; | |
| 133 | + char context_name[BINDERFS_MAX_NAME + 1]; | |
| 134 | 134 | }; |
| 135 | 135 | |
| 136 | 136 | struct binder_transaction_log { |
| @@ -4791,27 +4791,6 @@ void ata_scsi_hotplug(struct work_struct *work) · 4790 unmodified lines | ||
| 4791 | 4791 | return; |
| 4792 | 4792 | } |
| 4793 | 4793 | |
| 4794 | − /* | |
| 4795 | − * XXX - UGLY HACK | |
| 4796 | − * | |
| 4797 | − * The block layer suspend/resume path is fundamentally broken due | |
| 4798 | − * to freezable kthreads and workqueue and may deadlock if a block | |
| 4799 | − * device gets removed while resume is in progress. I don't know | |
| 4800 | − * what the solution is short of removing freezable kthreads and | |
| 4801 | − * workqueues altogether. | |
| 4802 | − * | |
| 4803 | − * The following is an ugly hack to avoid kicking off device | |
| 4804 | − * removal while freezer is active. This is a joke but does avoid | |
| 4805 | − * this particular deadlock scenario. | |
| 4806 | − * | |
| 4807 | − * https://bugzilla.kernel.org/show_bug.cgi?id=62801 | |
| 4808 | − * http://marc.info/?l=linux-kernel&m=138695698516487 | |
| 4809 | − */ | |
| 4810 | −#ifdef CONFIG_FREEZER | |
| 4811 | − while (pm_freezing) | |
| 4812 | − msleep(10); | |
| 4813 | −#endif | |
| 4814 | − | |
| 4815 | 4794 | DPRINTK("ENTER\n"); |
| 4816 | 4795 | mutex_lock(&ap->scsi_scan_mutex); |
| 4817 | 4796 | |
| @@ -241,12 +241,8 @@ struct resource *platform_get_resource_byname(struct platform_device *dev, · 240 unmodified lines | ||
| 241 | 241 | } |
| 242 | 242 | EXPORT_SYMBOL_GPL(platform_get_resource_byname); |
| 243 | 243 | |
| 244 | −/** | |
| 245 | − * platform_get_irq_byname - get an IRQ for a device by name | |
| 246 | − * @dev: platform device | |
| 247 | − * @name: IRQ name | |
| 248 | − */ | |
| 249 | −int platform_get_irq_byname(struct platform_device *dev, const char *name) | |
| 244 | +static int __platform_get_irq_byname(struct platform_device *dev, | |
| 245 | + const char *name) | |
| 250 | 246 | { |
| 251 | 247 | struct resource *r; |
| 252 | 248 | |
| @@ -262,11 +258,47 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name) · 9 unmodified lines | ||
| 262 | 258 | if (r) |
| 263 | 259 | return r->start; |
| 264 | 260 | |
| 265 | − dev_err(&dev->dev, "IRQ %s not found\n", name); | |
| 266 | 261 | return -ENXIO; |
| 267 | 262 | } |
| 263 | + | |
| 264 | +/** | |
| 265 | + * platform_get_irq_byname - get an IRQ for a device by name | |
| 266 | + * @dev: platform device | |
| 267 | + * @name: IRQ name | |
| 268 | + * | |
| 269 | + * Get an IRQ like platform_get_irq(), but then by name rather then by index. | |
| 270 | + * | |
| 271 | + * Return: IRQ number on success, negative error number on failure. | |
| 272 | + */ | |
| 273 | +int platform_get_irq_byname(struct platform_device *dev, const char *name) | |
| 274 | +{ | |
| 275 | + int ret; | |
| 276 | + | |
| 277 | + ret = __platform_get_irq_byname(dev, name); | |
| 278 | + if (ret < 0 && ret != -EPROBE_DEFER) | |
| 279 | + dev_err(&dev->dev, "IRQ %s not found\n", name); | |
| 280 | + | |
| 281 | + return ret; | |
| 282 | +} | |
| 268 | 283 | EXPORT_SYMBOL_GPL(platform_get_irq_byname); |
| 269 | 284 | |
| 285 | +/** | |
| 286 | + * platform_get_irq_byname_optional - get an optional IRQ for a device by name | |
| 287 | + * @dev: platform device | |
| 288 | + * @name: IRQ name | |
| 289 | + * | |
| 290 | + * Get an optional IRQ by name like platform_get_irq_byname(). Except that it | |
| 291 | + * does not print an error message if an IRQ can not be obtained. | |
| 292 | + * | |
| 293 | + * Return: IRQ number on success, negative error number on failure. | |
| 294 | + */ | |
| 295 | +int platform_get_irq_byname_optional(struct platform_device *dev, | |
| 296 | + const char *name) | |
| 297 | +{ | |
| 298 | + return __platform_get_irq_byname(dev, name); | |
| 299 | +} | |
| 300 | +EXPORT_SYMBOL_GPL(platform_get_irq_byname_optional); | |
| 301 | + | |
| 270 | 302 | /** |
| 271 | 303 | * platform_add_devices - add a numbers of platform devices |
| 272 | 304 | * @devs: array of platform devices to add |
| @@ -994,6 +994,16 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, · 993 unmodified lines | ||
| 994 | 994 | if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync) |
| 995 | 995 | blk_queue_write_cache(lo->lo_queue, true, false); |
| 996 | 996 | |
| 997 | + if (io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev) { | |
| 998 | + /* In case of direct I/O, match underlying block size */ | |
| 999 | + unsigned short bsize = bdev_logical_block_size( | |
| 1000 | + inode->i_sb->s_bdev); | |
| 1001 | + | |
| 1002 | + blk_queue_logical_block_size(lo->lo_queue, bsize); | |
| 1003 | + blk_queue_physical_block_size(lo->lo_queue, bsize); | |
| 1004 | + blk_queue_io_min(lo->lo_queue, bsize); | |
| 1005 | + } | |
| 1006 | + | |
| 997 | 1007 | loop_update_rotational(lo); |
| 998 | 1008 | loop_update_dio(lo); |
| 999 | 1009 | set_capacity(lo->lo_disk, size); |
| @@ -248,8 +248,8 @@ static void nbd_put(struct nbd_device *nbd) · 247 unmodified lines | ||
| 248 | 248 | if (refcount_dec_and_mutex_lock(&nbd->refs, |
| 249 | 249 | &nbd_index_mutex)) { |
| 250 | 250 | idr_remove(&nbd_index_idr, nbd->index); |
| 251 | − mutex_unlock(&nbd_index_mutex); | |
| 252 | 251 | nbd_dev_remove(nbd); |
| 252 | + mutex_unlock(&nbd_index_mutex); | |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| @@ -142,8 +142,7 @@ static blk_status_t null_zone_reset(struct nullb_cmd *cmd, sector_t sector) · 141 unmodified lines | ||
| 142 | 142 | zone->wp = zone->start; |
| 143 | 143 | break; |
| 144 | 144 | default: |
| 145 | − cmd->error = BLK_STS_NOTSUPP; | |
| 146 | − break; | |
| 145 | + return BLK_STS_NOTSUPP; | |
| 147 | 146 | } |
| 148 | 147 | return BLK_STS_OK; |
| 149 | 148 | } |
| @@ -683,7 +683,7 @@ static const struct omap_clkctrl_reg_data dra7_l4per2_clkctrl_regs[] __initconst · 682 unmodified lines | ||
| 683 | 683 | { DRA7_L4PER2_MCASP2_CLKCTRL, dra7_mcasp2_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0154:22" }, |
| 684 | 684 | { DRA7_L4PER2_MCASP3_CLKCTRL, dra7_mcasp3_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:015c:22" }, |
| 685 | 685 | { DRA7_L4PER2_MCASP5_CLKCTRL, dra7_mcasp5_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:016c:22" }, |
| 686 | − { DRA7_L4PER2_MCASP8_CLKCTRL, dra7_mcasp8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0184:24" }, | |
| 686 | + { DRA7_L4PER2_MCASP8_CLKCTRL, dra7_mcasp8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0184:22" }, | |
| 687 | 687 | { DRA7_L4PER2_MCASP4_CLKCTRL, dra7_mcasp4_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:018c:22" }, |
| 688 | 688 | { DRA7_L4PER2_UART7_CLKCTRL, dra7_uart7_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:01c4:24" }, |
| 689 | 689 | { DRA7_L4PER2_UART8_CLKCTRL, dra7_uart8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:01d4:24" }, |
| @@ -828,8 +828,8 @@ static struct ti_dt_clk dra7xx_clks[] = { · 138 unmodified lines | ||
| 828 | 828 | DT_CLK(NULL, "mcasp6_aux_gfclk_mux", "l4per2-clkctrl:01f8:22"), |
| 829 | 829 | DT_CLK(NULL, "mcasp7_ahclkx_mux", "l4per2-clkctrl:01fc:24"), |
| 830 | 830 | DT_CLK(NULL, "mcasp7_aux_gfclk_mux", "l4per2-clkctrl:01fc:22"), |
| 831 | − DT_CLK(NULL, "mcasp8_ahclkx_mux", "l4per2-clkctrl:0184:22"), | |
| 832 | − DT_CLK(NULL, "mcasp8_aux_gfclk_mux", "l4per2-clkctrl:0184:24"), | |
| 831 | + DT_CLK(NULL, "mcasp8_ahclkx_mux", "l4per2-clkctrl:0184:24"), | |
| 832 | + DT_CLK(NULL, "mcasp8_aux_gfclk_mux", "l4per2-clkctrl:0184:22"), | |
| 833 | 833 | DT_CLK(NULL, "mmc1_clk32k", "l3init-clkctrl:0008:8"), |
| 834 | 834 | DT_CLK(NULL, "mmc1_fclk_div", "l3init-clkctrl:0008:25"), |
| 835 | 835 | DT_CLK(NULL, "mmc1_fclk_mux", "l3init-clkctrl:0008:24"), |
| @@ -381,7 +381,7 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, · 380 unmodified lines | ||
| 381 | 381 | printk("%s""vendor_id: 0x%04x, device_id: 0x%04x\n", pfx, |
| 382 | 382 | pcie->device_id.vendor_id, pcie->device_id.device_id); |
| 383 | 383 | p = pcie->device_id.class_code; |
| 384 | − printk("%s""class_code: %02x%02x%02x\n", pfx, p[0], p[1], p[2]); | |
| 384 | + printk("%s""class_code: %02x%02x%02x\n", pfx, p[2], p[1], p[0]); | |
| 385 | 385 | } |
| 386 | 386 | if (pcie->validation_bits & CPER_PCIE_VALID_SERIAL_NUMBER) |
| 387 | 387 | printk("%s""serial number: 0x%04x, 0x%04x\n", pfx, |
| @@ -267,6 +267,9 @@ static __init int efivar_ssdt_load(void) · 266 unmodified lines | ||
| 267 | 267 | void *data; |
| 268 | 268 | int ret; |
| 269 | 269 | |
| 270 | + if (!efivar_ssdt[0]) | |
| 271 | + return 0; | |
| 272 | + | |
| 270 | 273 | ret = efivar_init(efivar_ssdt_iter, &entries, true, &entries); |
| 271 | 274 | |
| 272 | 275 | list_for_each_entry_safe(entry, aux, &entries, list) { |
| @@ -76,7 +76,7 @@ static u16 checksum(void) · 75 unmodified lines | ||
| 76 | 76 | return chksum; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | −int __init efi_rci2_sysfs_init(void) | |
| 79 | +static int __init efi_rci2_sysfs_init(void) | |
| 80 | 80 | { |
| 81 | 81 | struct kobject *tables_kobj; |
| 82 | 82 | int ret = -ENOMEM; |
| @@ -40,7 +40,7 @@ int __init efi_tpm_eventlog_init(void) · 39 unmodified lines | ||
| 40 | 40 | { |
| 41 | 41 | struct linux_efi_tpm_eventlog *log_tbl; |
| 42 | 42 | struct efi_tcg2_final_events_table *final_tbl; |
| 43 | − unsigned int tbl_size; | |
| 43 | + int tbl_size; | |
| 44 | 44 | int ret = 0; |
| 45 | 45 | |
| 46 | 46 | if (efi.tpm_log == EFI_INVALID_TABLE_ADDR) { |
| @@ -75,16 +75,28 @@ int __init efi_tpm_eventlog_init(void) · 28 unmodified lines | ||
| 75 | 75 | goto out; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | − tbl_size = tpm2_calc_event_log_size((void *)efi.tpm_final_log | |
| 79 | − + sizeof(final_tbl->version) | |
| 80 | − + sizeof(final_tbl->nr_events), | |
| 81 | − final_tbl->nr_events, | |
| 82 | − log_tbl->log); | |
| 78 | + tbl_size = 0; | |
| 79 | + if (final_tbl->nr_events != 0) { | |
| 80 | + void *events = (void *)efi.tpm_final_log | |
| 81 | + + sizeof(final_tbl->version) | |
| 82 | + + sizeof(final_tbl->nr_events); | |
| 83 | + | |
| 84 | + tbl_size = tpm2_calc_event_log_size(events, | |
| 85 | + final_tbl->nr_events, | |
| 86 | + log_tbl->log); | |
| 87 | + } | |
| 88 | + | |
| 89 | + if (tbl_size < 0) { | |
| 90 | + pr_err(FW_BUG "Failed to parse event in TPM Final Events Log\n"); | |
| 91 | + goto out_calc; | |
| 92 | + } | |
| 93 | + | |
| 83 | 94 | memblock_reserve((unsigned long)final_tbl, |
| 84 | 95 | tbl_size + sizeof(*final_tbl)); |
| 85 | − early_memunmap(final_tbl, sizeof(*final_tbl)); | |
| 86 | 96 | efi_tpm_final_log_size = tbl_size; |
| 87 | 97 | |
| 98 | +out_calc: | |
| 99 | + early_memunmap(final_tbl, sizeof(*final_tbl)); | |
| 88 | 100 | out: |
| 89 | 101 | early_memunmap(log_tbl, sizeof(*log_tbl)); |
| 90 | 102 | return ret; |
| @@ -52,7 +52,7 @@ static int vpd_decode_entry(const u32 max_len, const u8 *input_buf, · 51 unmodified lines | ||
| 52 | 52 | if (max_len - consumed < *entry_len) |
| 53 | 53 | return VPD_FAIL; |
| 54 | 54 | |
| 55 | − consumed += decoded_len; | |
| 55 | + consumed += *entry_len; | |
| 56 | 56 | *_consumed = consumed; |
| 57 | 57 | return VPD_OK; |
| 58 | 58 | } |
| @@ -530,11 +530,12 @@ static void sprd_eic_handle_one_type(struct gpio_chip *chip) · 529 unmodified lines | ||
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | for_each_set_bit(n, ®, SPRD_EIC_PER_BANK_NR) { |
| 533 | − girq = irq_find_mapping(chip->irq.domain, | |
| 534 | − bank * SPRD_EIC_PER_BANK_NR + n); | |
| 533 | + u32 offset = bank * SPRD_EIC_PER_BANK_NR + n; | |
| 534 | + | |
| 535 | + girq = irq_find_mapping(chip->irq.domain, offset); | |
| 535 | 536 | |
| 536 | 537 | generic_handle_irq(girq); |
| 537 | − sprd_eic_toggle_trigger(chip, girq, n); | |
| 538 | + sprd_eic_toggle_trigger(chip, girq, offset); | |
| 538 | 539 | } |
| 539 | 540 | } |
| 540 | 541 | } |
| @@ -192,13 +192,13 @@ static int max77620_gpio_set_debounce(struct max77620_gpio *mgpio, · 191 unmodified lines | ||
| 192 | 192 | case 0: |
| 193 | 193 | val = MAX77620_CNFG_GPIO_DBNC_None; |
| 194 | 194 | break; |
| 195 | − case 1 ... 8: | |
| 195 | + case 1000 ... 8000: | |
| 196 | 196 | val = MAX77620_CNFG_GPIO_DBNC_8ms; |
| 197 | 197 | break; |
| 198 | − case 9 ... 16: | |
| 198 | + case 9000 ... 16000: | |
| 199 | 199 | val = MAX77620_CNFG_GPIO_DBNC_16ms; |
| 200 | 200 | break; |
| 201 | − case 17 ... 32: | |
| 201 | + case 17000 ... 32000: | |
| 202 | 202 | val = MAX77620_CNFG_GPIO_DBNC_32ms; |
| 203 | 203 | break; |
| 204 | 204 | default: |
| @@ -317,7 +317,7 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, · 316 unmodified lines | ||
| 317 | 317 | transitory = flags & OF_GPIO_TRANSITORY; |
| 318 | 318 | |
| 319 | 319 | ret = gpiod_request(desc, label); |
| 320 | − if (ret == -EBUSY && (flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE)) | |
| 320 | + if (ret == -EBUSY && (dflags & GPIOD_FLAGS_BIT_NONEXCLUSIVE)) | |
| 321 | 321 | return desc; |
| 322 | 322 | if (ret) |
| 323 | 323 | return ERR_PTR(ret); |
| @@ -3070,8 +3070,10 @@ int gpiod_direction_output(struct gpio_desc *desc, int value) · 3069 unmodified lines | ||
| 3070 | 3070 | if (!ret) |
| 3071 | 3071 | goto set_output_value; |
| 3072 | 3072 | /* Emulate open drain by not actively driving the line high */ |
| 3073 | − if (value) | |
| 3074 | − return gpiod_direction_input(desc); | |
| 3073 | + if (value) { | |
| 3074 | + ret = gpiod_direction_input(desc); | |
| 3075 | + goto set_output_flag; | |
| 3076 | + } | |
| 3075 | 3077 | } |
| 3076 | 3078 | else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) { |
| 3077 | 3079 | ret = gpio_set_config(gc, gpio_chip_hwgpio(desc), |
| @@ -3079,8 +3081,10 @@ int gpiod_direction_output(struct gpio_desc *desc, int value) · 1 unmodified line | ||
| 3079 | 3081 | if (!ret) |
| 3080 | 3082 | goto set_output_value; |
| 3081 | 3083 | /* Emulate open source by not actively driving the line low */ |
| 3082 | − if (!value) | |
| 3083 | − return gpiod_direction_input(desc); | |
| 3084 | + if (!value) { | |
| 3085 | + ret = gpiod_direction_input(desc); | |
| 3086 | + goto set_output_flag; | |
| 3087 | + } | |
| 3084 | 3088 | } else { |
| 3085 | 3089 | gpio_set_config(gc, gpio_chip_hwgpio(desc), |
| 3086 | 3090 | PIN_CONFIG_DRIVE_PUSH_PULL); |
| @@ -3088,6 +3092,17 @@ int gpiod_direction_output(struct gpio_desc *desc, int value) · 1 unmodified line | ||
| 3088 | 3092 | |
| 3089 | 3093 | set_output_value: |
| 3090 | 3094 | return gpiod_direction_output_raw_commit(desc, value); |
| 3095 | + | |
| 3096 | +set_output_flag: | |
| 3097 | + /* | |
| 3098 | + * When emulating open-source or open-drain functionalities by not | |
| 3099 | + * actively driving the line (setting mode to input) we still need to | |
| 3100 | + * set the IS_OUT flag or otherwise we won't be able to set the line | |
| 3101 | + * value anymore. | |
| 3102 | + */ | |
| 3103 | + if (ret == 0) | |
| 3104 | + set_bit(FLAG_IS_OUT, &desc->flags); | |
| 3105 | + return ret; | |
| 3091 | 3106 | } |
| 3092 | 3107 | EXPORT_SYMBOL_GPL(gpiod_direction_output); |
| 3093 | 3108 | |
| @@ -3448,8 +3463,6 @@ static void gpio_set_open_drain_value_commit(struct gpio_desc *desc, bool value) · 354 unmodified lines | ||
| 3448 | 3463 | |
| 3449 | 3464 | if (value) { |
| 3450 | 3465 | ret = chip->direction_input(chip, offset); |
| 3451 | − if (!ret) | |
| 3452 | − clear_bit(FLAG_IS_OUT, &desc->flags); | |
| 3453 | 3466 | } else { |
| 3454 | 3467 | ret = chip->direction_output(chip, offset, 0); |
| 3455 | 3468 | if (!ret) |
| @@ -3479,8 +3492,6 @@ static void gpio_set_open_source_value_commit(struct gpio_desc *desc, bool value · 23 unmodified lines | ||
| 3479 | 3492 | set_bit(FLAG_IS_OUT, &desc->flags); |
| 3480 | 3493 | } else { |
| 3481 | 3494 | ret = chip->direction_input(chip, offset); |
| 3482 | − if (!ret) | |
| 3483 | − clear_bit(FLAG_IS_OUT, &desc->flags); | |
| 3484 | 3495 | } |
| 3485 | 3496 | trace_gpio_direction(desc_to_gpio(desc), !value, ret); |
| 3486 | 3497 | if (ret < 0) |
| @@ -54,7 +54,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ · 53 unmodified lines | ||
| 54 | 54 | amdgpu_gtt_mgr.o amdgpu_vram_mgr.o amdgpu_virt.o amdgpu_atomfirmware.o \ |
| 55 | 55 | amdgpu_vf_error.o amdgpu_sched.o amdgpu_debugfs.o amdgpu_ids.o \ |
| 56 | 56 | amdgpu_gmc.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ |
| 57 | − amdgpu_vm_sdma.o amdgpu_pmu.o amdgpu_discovery.o amdgpu_ras_eeprom.o smu_v11_0_i2c.o | |
| 57 | + amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o smu_v11_0_i2c.o | |
| 58 | 58 | |
| 59 | 59 | amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o |
| 60 | 60 | |
| @@ -189,7 +189,7 @@ static int acp_hw_init(void *handle) · 188 unmodified lines | ||
| 189 | 189 | u32 val = 0; |
| 190 | 190 | u32 count = 0; |
| 191 | 191 | struct device *dev; |
| 192 | − struct i2s_platform_data *i2s_pdata; | |
| 192 | + struct i2s_platform_data *i2s_pdata = NULL; | |
| 193 | 193 | |
| 194 | 194 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 195 | 195 | |
| @@ -231,20 +231,21 @@ static int acp_hw_init(void *handle) · 35 unmodified lines | ||
| 231 | 231 | adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell), |
| 232 | 232 | GFP_KERNEL); |
| 233 | 233 | |
| 234 | − if (adev->acp.acp_cell == NULL) | |
| 235 | − return -ENOMEM; | |
| 234 | + if (adev->acp.acp_cell == NULL) { | |
| 235 | + r = -ENOMEM; | |
| 236 | + goto failure; | |
| 237 | + } | |
| 236 | 238 | |
| 237 | 239 | adev->acp.acp_res = kcalloc(5, sizeof(struct resource), GFP_KERNEL); |
| 238 | 240 | if (adev->acp.acp_res == NULL) { |
| 239 | − kfree(adev->acp.acp_cell); | |
| 240 | − return -ENOMEM; | |
| 241 | + r = -ENOMEM; | |
| 242 | + goto failure; | |
| 241 | 243 | } |
| 242 | 244 | |
| 243 | 245 | i2s_pdata = kcalloc(3, sizeof(struct i2s_platform_data), GFP_KERNEL); |
| 244 | 246 | if (i2s_pdata == NULL) { |
| 245 | − kfree(adev->acp.acp_res); | |
| 246 | − kfree(adev->acp.acp_cell); | |
| 247 | − return -ENOMEM; | |
| 247 | + r = -ENOMEM; | |
| 248 | + goto failure; | |
| 248 | 249 | } |
| 249 | 250 | |
| 250 | 251 | switch (adev->asic_type) { |
| @@ -341,14 +342,14 @@ static int acp_hw_init(void *handle) · 90 unmodified lines | ||
| 341 | 342 | r = mfd_add_hotplug_devices(adev->acp.parent, adev->acp.acp_cell, |
| 342 | 343 | ACP_DEVS); |
| 343 | 344 | if (r) |
| 344 | − return r; | |
| 345 | + goto failure; | |
| 345 | 346 | |
| 346 | 347 | for (i = 0; i < ACP_DEVS ; i++) { |
| 347 | 348 | dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); |
| 348 | 349 | r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev); |
| 349 | 350 | if (r) { |
| 350 | 351 | dev_err(dev, "Failed to add dev to genpd\n"); |
| 351 | − return r; | |
| 352 | + goto failure; | |
| 352 | 353 | } |
| 353 | 354 | } |
| 354 | 355 | |
| @@ -367,7 +368,8 @@ static int acp_hw_init(void *handle) · 12 unmodified lines | ||
| 367 | 368 | break; |
| 368 | 369 | if (--count == 0) { |
| 369 | 370 | dev_err(&adev->pdev->dev, "Failed to reset ACP\n"); |
| 370 | − return -ETIMEDOUT; | |
| 371 | + r = -ETIMEDOUT; | |
| 372 | + goto failure; | |
| 371 | 373 | } |
| 372 | 374 | udelay(100); |
| 373 | 375 | } |
| @@ -384,7 +386,8 @@ static int acp_hw_init(void *handle) · 10 unmodified lines | ||
| 384 | 386 | break; |
| 385 | 387 | if (--count == 0) { |
| 386 | 388 | dev_err(&adev->pdev->dev, "Failed to reset ACP\n"); |
| 387 | − return -ETIMEDOUT; | |
| 389 | + r = -ETIMEDOUT; | |
| 390 | + goto failure; | |
| 388 | 391 | } |
| 389 | 392 | udelay(100); |
| 390 | 393 | } |
| @@ -393,6 +396,13 @@ static int acp_hw_init(void *handle) · 2 unmodified lines | ||
| 393 | 396 | val &= ~ACP_SOFT_RESET__SoftResetAud_MASK; |
| 394 | 397 | cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val); |
| 395 | 398 | return 0; |
| 399 | + | |
| 400 | +failure: | |
| 401 | + kfree(i2s_pdata); | |
| 402 | + kfree(adev->acp.acp_res); | |
| 403 | + kfree(adev->acp.acp_cell); | |
| 404 | + kfree(adev->acp.acp_genpd); | |
| 405 | + return r; | |
| 396 | 406 | } |
| 397 | 407 | |
| 398 | 408 | /** |
| @@ -270,7 +270,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, · 269 unmodified lines | ||
| 270 | 270 | |
| 271 | 271 | r = amdgpu_bo_create_list_entry_array(&args->in, &info); |
| 272 | 272 | if (r) |
| 273 | − goto error_free; | |
| 273 | + return r; | |
| 274 | 274 | |
| 275 | 275 | switch (args->in.operation) { |
| 276 | 276 | case AMDGPU_BO_LIST_OP_CREATE: |
| @@ -283,8 +283,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, · 6 unmodified lines | ||
| 283 | 283 | r = idr_alloc(&fpriv->bo_list_handles, list, 1, 0, GFP_KERNEL); |
| 284 | 284 | mutex_unlock(&fpriv->bo_list_lock); |
| 285 | 285 | if (r < 0) { |
| 286 | − amdgpu_bo_list_put(list); | |
| 287 | − return r; | |
| 286 | + goto error_put_list; | |
| 288 | 287 | } |
| 289 | 288 | |
| 290 | 289 | handle = r; |
| @@ -306,9 +305,8 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, · 15 unmodified lines | ||
| 306 | 305 | mutex_unlock(&fpriv->bo_list_lock); |
| 307 | 306 | |
| 308 | 307 | if (IS_ERR(old)) { |
| 309 | − amdgpu_bo_list_put(list); | |
| 310 | 308 | r = PTR_ERR(old); |
| 311 | − goto error_free; | |
| 309 | + goto error_put_list; | |
| 312 | 310 | } |
| 313 | 311 | |
| 314 | 312 | amdgpu_bo_list_put(old); |
| @@ -325,8 +323,10 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, · 10 unmodified lines | ||
| 325 | 323 | |
| 326 | 324 | return 0; |
| 327 | 325 | |
| 326 | +error_put_list: | |
| 327 | + amdgpu_bo_list_put(list); | |
| 328 | + | |
| 328 | 329 | error_free: |
| 329 | − if (info) | |
| 330 | − kvfree(info); | |
| 330 | + kvfree(info); | |
| 331 | 331 | return r; |
| 332 | 332 | } |
| @@ -81,9 +81,10 @@ · 80 unmodified lines | ||
| 81 | 81 | * - 3.32.0 - Add syncobj timeline support to AMDGPU_CS. |
| 82 | 82 | * - 3.33.0 - Fixes for GDS ENOMEM failures in AMDGPU_CS. |
| 83 | 83 | * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches |
| 84 | + * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask | |
| 84 | 85 | */ |
| 85 | 86 | #define KMS_DRIVER_MAJOR 3 |
| 86 | −#define KMS_DRIVER_MINOR 34 | |
| 87 | +#define KMS_DRIVER_MINOR 35 | |
| 87 | 88 | #define KMS_DRIVER_PATCHLEVEL 0 |
| 88 | 89 | |
| 89 | 90 | #define AMDGPU_MAX_TIMEOUT_PARAM_LENTH 256 |
| @@ -165,6 +165,7 @@ struct amdgpu_gfx_config { · 164 unmodified lines | ||
| 165 | 165 | uint32_t num_sc_per_sh; |
| 166 | 166 | uint32_t num_packer_per_sc; |
| 167 | 167 | uint32_t pa_sc_tile_steering_override; |
| 168 | + uint64_t tcc_disabled_mask; | |
| 168 | 169 | }; |
| 169 | 170 | |
| 170 | 171 | struct amdgpu_cu_info { |
| @@ -787,6 +787,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 786 unmodified lines | ||
| 787 | 787 | dev_info.pa_sc_tile_steering_override = |
| 788 | 788 | adev->gfx.config.pa_sc_tile_steering_override; |
| 789 | 789 | |
| 790 | + dev_info.tcc_disabled_mask = adev->gfx.config.tcc_disabled_mask; | |
| 791 | + | |
| 790 | 792 | return copy_to_user(out, &dev_info, |
| 791 | 793 | min((size_t)size, sizeof(dev_info))) ? -EFAULT : 0; |
| 792 | 794 | } |
| @@ -603,14 +603,12 @@ void amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev, · 602 unmodified lines | ||
| 603 | 603 | struct ttm_bo_global *glob = adev->mman.bdev.glob; |
| 604 | 604 | struct amdgpu_vm_bo_base *bo_base; |
| 605 | 605 | |
| 606 | −#if 0 | |
| 607 | 606 | if (vm->bulk_moveable) { |
| 608 | 607 | spin_lock(&glob->lru_lock); |
| 609 | 608 | ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move); |
| 610 | 609 | spin_unlock(&glob->lru_lock); |
| 611 | 610 | return; |
| 612 | 611 | } |
| 613 | −#endif | |
| 614 | 612 | |
| 615 | 613 | memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move)); |
| 616 | 614 | |
| @@ -1691,6 +1691,17 @@ static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev) · 1690 unmodified lines | ||
| 1691 | 1691 | } |
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | +static void gfx_v10_0_get_tcc_info(struct amdgpu_device *adev) | |
| 1695 | +{ | |
| 1696 | + /* TCCs are global (not instanced). */ | |
| 1697 | + uint32_t tcc_disable = RREG32_SOC15(GC, 0, mmCGTS_TCC_DISABLE) | | |
| 1698 | + RREG32_SOC15(GC, 0, mmCGTS_USER_TCC_DISABLE); | |
| 1699 | + | |
| 1700 | + adev->gfx.config.tcc_disabled_mask = | |
| 1701 | + REG_GET_FIELD(tcc_disable, CGTS_TCC_DISABLE, TCC_DISABLE) | | |
| 1702 | + (REG_GET_FIELD(tcc_disable, CGTS_TCC_DISABLE, HI_TCC_DISABLE) << 16); | |
| 1703 | +} | |
| 1704 | + | |
| 1694 | 1705 | static void gfx_v10_0_constants_init(struct amdgpu_device *adev) |
| 1695 | 1706 | { |
| 1696 | 1707 | u32 tmp; |
| @@ -1702,6 +1713,7 @@ static void gfx_v10_0_constants_init(struct amdgpu_device *adev) · 5 unmodified lines | ||
| 1702 | 1713 | |
| 1703 | 1714 | gfx_v10_0_setup_rb(adev); |
| 1704 | 1715 | gfx_v10_0_get_cu_info(adev, &adev->gfx.cu_info); |
| 1716 | + gfx_v10_0_get_tcc_info(adev); | |
| 1705 | 1717 | adev->gfx.config.pa_sc_tile_steering_override = |
| 1706 | 1718 | gfx_v10_0_init_pa_sc_tile_steering_override(adev); |
| 1707 | 1719 | |
| @@ -317,10 +317,12 @@ static int nv_asic_reset(struct amdgpu_device *adev) · 316 unmodified lines | ||
| 317 | 317 | struct smu_context *smu = &adev->smu; |
| 318 | 318 | |
| 319 | 319 | if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { |
| 320 | − amdgpu_inc_vram_lost(adev); | |
| 320 | + if (!adev->in_suspend) | |
| 321 | + amdgpu_inc_vram_lost(adev); | |
| 321 | 322 | ret = smu_baco_reset(smu); |
| 322 | 323 | } else { |
| 323 | − amdgpu_inc_vram_lost(adev); | |
| 324 | + if (!adev->in_suspend) | |
| 325 | + amdgpu_inc_vram_lost(adev); | |
| 324 | 326 | ret = nv_asic_mode1_reset(adev); |
| 325 | 327 | } |
| 326 | 328 | |
| @@ -558,12 +558,14 @@ static int soc15_asic_reset(struct amdgpu_device *adev) · 557 unmodified lines | ||
| 558 | 558 | { |
| 559 | 559 | switch (soc15_asic_reset_method(adev)) { |
| 560 | 560 | case AMD_RESET_METHOD_BACO: |
| 561 | − amdgpu_inc_vram_lost(adev); | |
| 561 | + if (!adev->in_suspend) | |
| 562 | + amdgpu_inc_vram_lost(adev); | |
| 562 | 563 | return soc15_asic_baco_reset(adev); |
| 563 | 564 | case AMD_RESET_METHOD_MODE2: |
| 564 | 565 | return soc15_mode2_reset(adev); |
| 565 | 566 | default: |
| 566 | − amdgpu_inc_vram_lost(adev); | |
| 567 | + if (!adev->in_suspend) | |
| 568 | + amdgpu_inc_vram_lost(adev); | |
| 567 | 569 | return soc15_asic_mode1_reset(adev); |
| 568 | 570 | } |
| 569 | 571 | } |
| @@ -771,8 +773,6 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 201 unmodified lines | ||
| 771 | 773 | #if defined(CONFIG_DRM_AMD_DC) |
| 772 | 774 | else if (amdgpu_device_has_dc_support(adev)) |
| 773 | 775 | amdgpu_device_ip_block_add(adev, &dm_ip_block); |
| 774 | −#else | |
| 775 | −# warning "Enable CONFIG_DRM_AMD_DC for display support on SOC15." | |
| 776 | 776 | #endif |
| 777 | 777 | amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); |
| 778 | 778 | break; |
| @@ -2385,8 +2385,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 2384 unmodified lines | ||
| 2385 | 2385 | |
| 2386 | 2386 | if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY) |
| 2387 | 2387 | dm->dc->debug.disable_stutter = amdgpu_pp_feature_mask & PP_STUTTER_MODE ? false : true; |
| 2388 | − if (adev->asic_type == CHIP_RENOIR) | |
| 2389 | − dm->dc->debug.disable_stutter = true; | |
| 2390 | 2388 | |
| 2391 | 2389 | return 0; |
| 2392 | 2390 | fail: |
| @@ -6019,7 +6017,9 @@ static void amdgpu_dm_enable_crtc_interrupts(struct drm_device *dev, · 3626 unmodified lines | ||
| 6019 | 6017 | struct drm_crtc *crtc; |
| 6020 | 6018 | struct drm_crtc_state *old_crtc_state, *new_crtc_state; |
| 6021 | 6019 | int i; |
| 6020 | +#ifdef CONFIG_DEBUG_FS | |
| 6022 | 6021 | enum amdgpu_dm_pipe_crc_source source; |
| 6022 | +#endif | |
| 6023 | 6023 | |
| 6024 | 6024 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, |
| 6025 | 6025 | new_crtc_state, i) { |
| @@ -668,6 +668,7 @@ struct clock_source *dce100_clock_source_create( · 667 unmodified lines | ||
| 668 | 668 | return &clk_src->base; |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | + kfree(clk_src); | |
| 671 | 672 | BREAK_TO_DEBUGGER(); |
| 672 | 673 | return NULL; |
| 673 | 674 | } |
| @@ -714,6 +714,7 @@ struct clock_source *dce110_clock_source_create( · 713 unmodified lines | ||
| 714 | 714 | return &clk_src->base; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | + kfree(clk_src); | |
| 717 | 718 | BREAK_TO_DEBUGGER(); |
| 718 | 719 | return NULL; |
| 719 | 720 | } |
| @@ -687,6 +687,7 @@ struct clock_source *dce112_clock_source_create( · 686 unmodified lines | ||
| 687 | 687 | return &clk_src->base; |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | + kfree(clk_src); | |
| 690 | 691 | BREAK_TO_DEBUGGER(); |
| 691 | 692 | return NULL; |
| 692 | 693 | } |
| @@ -500,6 +500,7 @@ static struct clock_source *dce120_clock_source_create( · 499 unmodified lines | ||
| 500 | 500 | return &clk_src->base; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | + kfree(clk_src); | |
| 503 | 504 | BREAK_TO_DEBUGGER(); |
| 504 | 505 | return NULL; |
| 505 | 506 | } |
| @@ -701,6 +701,7 @@ struct clock_source *dce80_clock_source_create( · 700 unmodified lines | ||
| 701 | 701 | return &clk_src->base; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | + kfree(clk_src); | |
| 704 | 705 | BREAK_TO_DEBUGGER(); |
| 705 | 706 | return NULL; |
| 706 | 707 | } |
| @@ -786,6 +786,7 @@ struct clock_source *dcn10_clock_source_create( · 785 unmodified lines | ||
| 786 | 786 | return &clk_src->base; |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | + kfree(clk_src); | |
| 789 | 790 | BREAK_TO_DEBUGGER(); |
| 790 | 791 | return NULL; |
| 791 | 792 | } |
| @@ -1077,6 +1077,7 @@ struct clock_source *dcn20_clock_source_create( · 1076 unmodified lines | ||
| 1077 | 1077 | return &clk_src->base; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | + kfree(clk_src); | |
| 1080 | 1081 | BREAK_TO_DEBUGGER(); |
| 1081 | 1082 | return NULL; |
| 1082 | 1083 | } |
| @@ -3,7 +3,17 @@ · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | DCN21 = dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o |
| 5 | 5 | |
| 6 | −CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 | |
| 6 | +ifneq ($(call cc-option, -mpreferred-stack-boundary=4),) | |
| 7 | + cc_stack_align := -mpreferred-stack-boundary=4 | |
| 8 | +else ifneq ($(call cc-option, -mstack-alignment=16),) | |
| 9 | + cc_stack_align := -mstack-alignment=16 | |
| 10 | +endif | |
| 11 | + | |
| 12 | +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse $(cc_stack_align) | |
| 13 | + | |
| 14 | +ifdef CONFIG_CC_IS_CLANG | |
| 15 | +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2 | |
| 16 | +endif | |
| 7 | 17 | |
| 8 | 18 | AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21)) |
| 9 | 19 | |
| @@ -39,9 +39,6 @@ · 38 unmodified lines | ||
| 39 | 39 | * ways. Unless there is something clearly wrong with it the code should |
| 40 | 40 | * remain as-is as it provides us with a guarantee from HW that it is correct. |
| 41 | 41 | */ |
| 42 | − | |
| 43 | −typedef unsigned int uint; | |
| 44 | − | |
| 45 | 42 | typedef struct { |
| 46 | 43 | double DPPCLK; |
| 47 | 44 | double DISPCLK; |
| @@ -4774,7 +4771,7 @@ void dml21_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l · 4726 unmodified lines | ||
| 4774 | 4771 | mode_lib->vba.MaximumReadBandwidthWithoutPrefetch = 0.0; |
| 4775 | 4772 | mode_lib->vba.MaximumReadBandwidthWithPrefetch = 0.0; |
| 4776 | 4773 | for (k = 0; k <= mode_lib->vba.NumberOfActivePlanes - 1; k++) { |
| 4777 | − uint m; | |
| 4774 | + unsigned int m; | |
| 4778 | 4775 | |
| 4779 | 4776 | locals->cursor_bw[k] = 0; |
| 4780 | 4777 | locals->cursor_bw_pre[k] = 0; |
| @@ -5285,7 +5282,7 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport( · 504 unmodified lines | ||
| 5285 | 5282 | double SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank; |
| 5286 | 5283 | double FullDETBufferingTimeYStutterCriticalPlane = 0; |
| 5287 | 5284 | double TimeToFinishSwathTransferStutterCriticalPlane = 0; |
| 5288 | − uint k, j; | |
| 5285 | + unsigned int k, j; | |
| 5289 | 5286 | |
| 5290 | 5287 | mode_lib->vba.TotalActiveDPP = 0; |
| 5291 | 5288 | mode_lib->vba.TotalDCCActiveDPP = 0; |
| @@ -5507,7 +5504,7 @@ static void CalculateDCFCLKDeepSleep( · 215 unmodified lines | ||
| 5507 | 5504 | double DPPCLK[], |
| 5508 | 5505 | double *DCFCLKDeepSleep) |
| 5509 | 5506 | { |
| 5510 | − uint k; | |
| 5507 | + unsigned int k; | |
| 5511 | 5508 | double DisplayPipeLineDeliveryTimeLuma; |
| 5512 | 5509 | double DisplayPipeLineDeliveryTimeChroma; |
| 5513 | 5510 | //double DCFCLKDeepSleepPerPlane[DC__NUM_DPP__MAX]; |
| @@ -5727,7 +5724,7 @@ static void CalculatePixelDeliveryTimes( · 213 unmodified lines | ||
| 5727 | 5724 | double DisplayPipeRequestDeliveryTimeChromaPrefetch[]) |
| 5728 | 5725 | { |
| 5729 | 5726 | double req_per_swath_ub; |
| 5730 | − uint k; | |
| 5727 | + unsigned int k; | |
| 5731 | 5728 | |
| 5732 | 5729 | for (k = 0; k < NumberOfActivePlanes; ++k) { |
| 5733 | 5730 | if (VRatio[k] <= 1) { |
| @@ -5869,7 +5866,7 @@ static void CalculateMetaAndPTETimes( · 135 unmodified lines | ||
| 5869 | 5866 | unsigned int dpte_groups_per_row_chroma_ub; |
| 5870 | 5867 | unsigned int num_group_per_lower_vm_stage; |
| 5871 | 5868 | unsigned int num_req_per_lower_vm_stage; |
| 5872 | − uint k; | |
| 5869 | + unsigned int k; | |
| 5873 | 5870 | |
| 5874 | 5871 | for (k = 0; k < NumberOfActivePlanes; ++k) { |
| 5875 | 5872 | if (GPUVMEnable == true) { |
| @@ -843,6 +843,8 @@ static int smu_sw_init(void *handle) · 842 unmodified lines | ||
| 843 | 843 | smu->smu_baco.state = SMU_BACO_STATE_EXIT; |
| 844 | 844 | smu->smu_baco.platform_support = false; |
| 845 | 845 | |
| 846 | + mutex_init(&smu->sensor_lock); | |
| 847 | + | |
| 846 | 848 | smu->watermarks_bitmap = 0; |
| 847 | 849 | smu->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 848 | 850 | smu->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| @@ -1018,6 +1018,7 @@ static int arcturus_read_sensor(struct smu_context *smu, · 1017 unmodified lines | ||
| 1018 | 1018 | if (!data || !size) |
| 1019 | 1019 | return -EINVAL; |
| 1020 | 1020 | |
| 1021 | + mutex_lock(&smu->sensor_lock); | |
| 1021 | 1022 | switch (sensor) { |
| 1022 | 1023 | case AMDGPU_PP_SENSOR_MAX_FAN_RPM: |
| 1023 | 1024 | *(uint32_t *)data = pptable->FanMaximumRpm; |
| @@ -1044,6 +1045,7 @@ static int arcturus_read_sensor(struct smu_context *smu, · 20 unmodified lines | ||
| 1044 | 1045 | default: |
| 1045 | 1046 | ret = smu_smc_read_sensor(smu, sensor, data, size); |
| 1046 | 1047 | } |
| 1048 | + mutex_unlock(&smu->sensor_lock); | |
| 1047 | 1049 | |
| 1048 | 1050 | return ret; |
| 1049 | 1051 | } |
| @@ -344,6 +344,7 @@ struct smu_context · 343 unmodified lines | ||
| 344 | 344 | const struct smu_funcs *funcs; |
| 345 | 345 | const struct pptable_funcs *ppt_funcs; |
| 346 | 346 | struct mutex mutex; |
| 347 | + struct mutex sensor_lock; | |
| 347 | 348 | uint64_t pool_size; |
| 348 | 349 | |
| 349 | 350 | struct smu_table_context smu_table; |
| @@ -547,7 +547,7 @@ static int navi10_get_metrics_table(struct smu_context *smu, · 546 unmodified lines | ||
| 547 | 547 | struct smu_table_context *smu_table= &smu->smu_table; |
| 548 | 548 | int ret = 0; |
| 549 | 549 | |
| 550 | − if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + HZ / 1000)) { | |
| 550 | + if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(100))) { | |
| 551 | 551 | ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, |
| 552 | 552 | (void *)smu_table->metrics_table, false); |
| 553 | 553 | if (ret) { |
| @@ -1386,6 +1386,7 @@ static int navi10_read_sensor(struct smu_context *smu, · 832 unmodified lines | ||
| 1386 | 1386 | if(!data || !size) |
| 1387 | 1387 | return -EINVAL; |
| 1388 | 1388 | |
| 1389 | + mutex_lock(&smu->sensor_lock); | |
| 1389 | 1390 | switch (sensor) { |
| 1390 | 1391 | case AMDGPU_PP_SENSOR_MAX_FAN_RPM: |
| 1391 | 1392 | *(uint32_t *)data = pptable->FanMaximumRpm; |
| @@ -1409,6 +1410,7 @@ static int navi10_read_sensor(struct smu_context *smu, · 17 unmodified lines | ||
| 1409 | 1410 | default: |
| 1410 | 1411 | ret = smu_smc_read_sensor(smu, sensor, data, size); |
| 1411 | 1412 | } |
| 1413 | + mutex_unlock(&smu->sensor_lock); | |
| 1412 | 1414 | |
| 1413 | 1415 | return ret; |
| 1414 | 1416 | } |
| @@ -3023,6 +3023,7 @@ static int vega20_read_sensor(struct smu_context *smu, · 3022 unmodified lines | ||
| 3023 | 3023 | if(!data || !size) |
| 3024 | 3024 | return -EINVAL; |
| 3025 | 3025 | |
| 3026 | + mutex_lock(&smu->sensor_lock); | |
| 3026 | 3027 | switch (sensor) { |
| 3027 | 3028 | case AMDGPU_PP_SENSOR_MAX_FAN_RPM: |
| 3028 | 3029 | *(uint32_t *)data = pptable->FanMaximumRpm; |
| @@ -3048,6 +3049,7 @@ static int vega20_read_sensor(struct smu_context *smu, · 19 unmodified lines | ||
| 3048 | 3049 | default: |
| 3049 | 3050 | ret = smu_smc_read_sensor(smu, sensor, data, size); |
| 3050 | 3051 | } |
| 3052 | + mutex_unlock(&smu->sensor_lock); | |
| 3051 | 3053 | |
| 3052 | 3054 | return ret; |
| 3053 | 3055 | } |
| @@ -43,9 +43,8 @@ komeda_wb_encoder_atomic_check(struct drm_encoder *encoder, · 42 unmodified lines | ||
| 43 | 43 | struct komeda_data_flow_cfg dflow; |
| 44 | 44 | int err; |
| 45 | 45 | |
| 46 | − if (!writeback_job || !writeback_job->fb) { | |
| 46 | + if (!writeback_job) | |
| 47 | 47 | return 0; |
| 48 | − } | |
| 49 | 48 | |
| 50 | 49 | if (!crtc_st->active) { |
| 51 | 50 | DRM_DEBUG_ATOMIC("Cannot write the composition result out on a inactive CRTC.\n"); |
| @@ -166,8 +165,10 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, · 114 unmodified lines | ||
| 166 | 165 | &komeda_wb_encoder_helper_funcs, |
| 167 | 166 | formats, n_formats); |
| 168 | 167 | komeda_put_fourcc_list(formats); |
| 169 | − if (err) | |
| 168 | + if (err) { | |
| 169 | + kfree(kwb_conn); | |
| 170 | 170 | return err; |
| 171 | + } | |
| 171 | 172 | |
| 172 | 173 | drm_connector_helper_add(&wb_conn->base, &komeda_wb_conn_helper_funcs); |
| 173 | 174 | |
| @@ -131,7 +131,7 @@ malidp_mw_encoder_atomic_check(struct drm_encoder *encoder, · 130 unmodified lines | ||
| 131 | 131 | struct drm_framebuffer *fb; |
| 132 | 132 | int i, n_planes; |
| 133 | 133 | |
| 134 | − if (!conn_state->writeback_job || !conn_state->writeback_job->fb) | |
| 134 | + if (!conn_state->writeback_job) | |
| 135 | 135 | return 0; |
| 136 | 136 | |
| 137 | 137 | fb = conn_state->writeback_job->fb; |
| @@ -248,7 +248,7 @@ void malidp_mw_atomic_commit(struct drm_device *drm, · 110 unmodified lines | ||
| 248 | 248 | |
| 249 | 249 | mw_state = to_mw_state(conn_state); |
| 250 | 250 | |
| 251 | − if (conn_state->writeback_job && conn_state->writeback_job->fb) { | |
| 251 | + if (conn_state->writeback_job) { | |
| 252 | 252 | struct drm_framebuffer *fb = conn_state->writeback_job->fb; |
| 253 | 253 | |
| 254 | 254 | DRM_DEV_DEBUG_DRIVER(drm->dev, |
| @@ -728,6 +728,8 @@ static int tc_set_video_mode(struct tc_data *tc, · 727 unmodified lines | ||
| 728 | 728 | int lower_margin = mode->vsync_start - mode->vdisplay; |
| 729 | 729 | int vsync_len = mode->vsync_end - mode->vsync_start; |
| 730 | 730 | u32 dp0_syncval; |
| 731 | + u32 bits_per_pixel = 24; | |
| 732 | + u32 in_bw, out_bw; | |
| 731 | 733 | |
| 732 | 734 | /* |
| 733 | 735 | * Recommended maximum number of symbols transferred in a transfer unit: |
| @@ -735,7 +737,10 @@ static int tc_set_video_mode(struct tc_data *tc, · 1 unmodified line | ||
| 735 | 737 | * (output active video bandwidth in bytes)) |
| 736 | 738 | * Must be less than tu_size. |
| 737 | 739 | */ |
| 738 | − max_tu_symbol = TU_SIZE_RECOMMENDED - 1; | |
| 740 | + | |
| 741 | + in_bw = mode->clock * bits_per_pixel / 8; | |
| 742 | + out_bw = tc->link.base.num_lanes * tc->link.base.rate; | |
| 743 | + max_tu_symbol = DIV_ROUND_UP(in_bw * TU_SIZE_RECOMMENDED, out_bw); | |
| 739 | 744 | |
| 740 | 745 | dev_dbg(tc->dev, "set mode %dx%d\n", |
| 741 | 746 | mode->hdisplay, mode->vdisplay); |
| @@ -430,10 +430,15 @@ static int drm_atomic_connector_check(struct drm_connector *connector, · 429 unmodified lines | ||
| 430 | 430 | return -EINVAL; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | − if (writeback_job->out_fence && !writeback_job->fb) { | |
| 434 | − DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n", | |
| 435 | − connector->base.id, connector->name); | |
| 436 | − return -EINVAL; | |
| 433 | + if (!writeback_job->fb) { | |
| 434 | + if (writeback_job->out_fence) { | |
| 435 | + DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n", | |
| 436 | + connector->base.id, connector->name); | |
| 437 | + return -EINVAL; | |
| 438 | + } | |
| 439 | + | |
| 440 | + drm_writeback_cleanup_job(writeback_job); | |
| 441 | + state->writeback_job = NULL; | |
| 437 | 442 | } |
| 438 | 443 | |
| 439 | 444 | return 0; |
| @@ -324,6 +324,9 @@ void drm_writeback_cleanup_job(struct drm_writeback_job *job) · 323 unmodified lines | ||
| 324 | 324 | if (job->fb) |
| 325 | 325 | drm_framebuffer_put(job->fb); |
| 326 | 326 | |
| 327 | + if (job->out_fence) | |
| 328 | + dma_fence_put(job->out_fence); | |
| 329 | + | |
| 327 | 330 | kfree(job); |
| 328 | 331 | } |
| 329 | 332 | EXPORT_SYMBOL(drm_writeback_cleanup_job); |
| @@ -366,25 +369,29 @@ drm_writeback_signal_completion(struct drm_writeback_connector *wb_connector, · 36 unmodified lines | ||
| 366 | 369 | { |
| 367 | 370 | unsigned long flags; |
| 368 | 371 | struct drm_writeback_job *job; |
| 372 | + struct dma_fence *out_fence; | |
| 369 | 373 | |
| 370 | 374 | spin_lock_irqsave(&wb_connector->job_lock, flags); |
| 371 | 375 | job = list_first_entry_or_null(&wb_connector->job_queue, |
| 372 | 376 | struct drm_writeback_job, |
| 373 | 377 | list_entry); |
| 374 | − if (job) { | |
| 378 | + if (job) | |
| 375 | 379 | list_del(&job->list_entry); |
| 376 | − if (job->out_fence) { | |
| 377 | − if (status) | |
| 378 | − dma_fence_set_error(job->out_fence, status); | |
| 379 | − dma_fence_signal(job->out_fence); | |
| 380 | − dma_fence_put(job->out_fence); | |
| 381 | − } | |
| 382 | − } | |
| 380 | + | |
| 383 | 381 | spin_unlock_irqrestore(&wb_connector->job_lock, flags); |
| 384 | 382 | |
| 385 | 383 | if (WARN_ON(!job)) |
| 386 | 384 | return; |
| 387 | 385 | |
| 386 | + out_fence = job->out_fence; | |
| 387 | + if (out_fence) { | |
| 388 | + if (status) | |
| 389 | + dma_fence_set_error(out_fence, status); | |
| 390 | + dma_fence_signal(out_fence); | |
| 391 | + dma_fence_put(out_fence); | |
| 392 | + job->out_fence = NULL; | |
| 393 | + } | |
| 394 | + | |
| 388 | 395 | INIT_WORK(&job->cleanup_work, cleanup_work); |
| 389 | 396 | queue_work(system_long_wq, &job->cleanup_work); |
| 390 | 397 | } |
| @@ -3280,7 +3280,20 @@ static int skl_max_plane_width(const struct drm_framebuffer *fb, · 3279 unmodified lines | ||
| 3280 | 3280 | switch (fb->modifier) { |
| 3281 | 3281 | case DRM_FORMAT_MOD_LINEAR: |
| 3282 | 3282 | case I915_FORMAT_MOD_X_TILED: |
| 3283 | − return 4096; | |
| 3283 | + /* | |
| 3284 | + * Validated limit is 4k, but has 5k should | |
| 3285 | + * work apart from the following features: | |
| 3286 | + * - Ytile (already limited to 4k) | |
| 3287 | + * - FP16 (already limited to 4k) | |
| 3288 | + * - render compression (already limited to 4k) | |
| 3289 | + * - KVMR sprite and cursor (don't care) | |
| 3290 | + * - horizontal panning (TODO verify this) | |
| 3291 | + * - pipe and plane scaling (TODO verify this) | |
| 3292 | + */ | |
| 3293 | + if (cpp == 8) | |
| 3294 | + return 4096; | |
| 3295 | + else | |
| 3296 | + return 5120; | |
| 3284 | 3297 | case I915_FORMAT_MOD_Y_TILED_CCS: |
| 3285 | 3298 | case I915_FORMAT_MOD_Yf_TILED_CCS: |
| 3286 | 3299 | /* FIXME AUX plane? */ |
| @@ -7261,7 +7274,7 @@ retry: · 3974 unmodified lines | ||
| 7261 | 7274 | pipe_config->fdi_lanes = lane; |
| 7262 | 7275 | |
| 7263 | 7276 | intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock, |
| 7264 | − link_bw, &pipe_config->fdi_m_n, false); | |
| 7277 | + link_bw, &pipe_config->fdi_m_n, false, false); | |
| 7265 | 7278 | |
| 7266 | 7279 | ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config); |
| 7267 | 7280 | if (ret == -EDEADLK) |
| @@ -7508,11 +7521,15 @@ void · 240 unmodified lines | ||
| 7508 | 7521 | intel_link_compute_m_n(u16 bits_per_pixel, int nlanes, |
| 7509 | 7522 | int pixel_clock, int link_clock, |
| 7510 | 7523 | struct intel_link_m_n *m_n, |
| 7511 | − bool constant_n) | |
| 7524 | + bool constant_n, bool fec_enable) | |
| 7512 | 7525 | { |
| 7513 | − m_n->tu = 64; | |
| 7526 | + u32 data_clock = bits_per_pixel * pixel_clock; | |
| 7514 | 7527 | |
| 7515 | − compute_m_n(bits_per_pixel * pixel_clock, | |
| 7528 | + if (fec_enable) | |
| 7529 | + data_clock = intel_dp_mode_to_fec_clock(data_clock); | |
| 7530 | + | |
| 7531 | + m_n->tu = 64; | |
| 7532 | + compute_m_n(data_clock, | |
| 7516 | 7533 | link_clock * nlanes * 8, |
| 7517 | 7534 | &m_n->gmch_m, &m_n->gmch_n, |
| 7518 | 7535 | constant_n); |
| @@ -414,7 +414,7 @@ enum phy_fia { · 413 unmodified lines | ||
| 414 | 414 | void intel_link_compute_m_n(u16 bpp, int nlanes, |
| 415 | 415 | int pixel_clock, int link_clock, |
| 416 | 416 | struct intel_link_m_n *m_n, |
| 417 | − bool constant_n); | |
| 417 | + bool constant_n, bool fec_enable); | |
| 418 | 418 | bool is_ccs_modifier(u64 modifier); |
| 419 | 419 | void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv); |
| 420 | 420 | u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv, |
| @@ -78,8 +78,8 @@ · 77 unmodified lines | ||
| 78 | 78 | #define DP_DSC_MAX_ENC_THROUGHPUT_0 340000 |
| 79 | 79 | #define DP_DSC_MAX_ENC_THROUGHPUT_1 400000 |
| 80 | 80 | |
| 81 | −/* DP DSC FEC Overhead factor = (100 - 2.4)/100 */ | |
| 82 | −#define DP_DSC_FEC_OVERHEAD_FACTOR 976 | |
| 81 | +/* DP DSC FEC Overhead factor = 1/(0.972261) */ | |
| 82 | +#define DP_DSC_FEC_OVERHEAD_FACTOR 972261 | |
| 83 | 83 | |
| 84 | 84 | /* Compliance test status bits */ |
| 85 | 85 | #define INTEL_DP_RESOLUTION_SHIFT_MASK 0 |
| @@ -494,6 +494,97 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, · 408 unmodified lines | ||
| 494 | 494 | return 0; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | +u32 intel_dp_mode_to_fec_clock(u32 mode_clock) | |
| 498 | +{ | |
| 499 | + return div_u64(mul_u32_u32(mode_clock, 1000000U), | |
| 500 | + DP_DSC_FEC_OVERHEAD_FACTOR); | |
| 501 | +} | |
| 502 | + | |
| 503 | +static u16 intel_dp_dsc_get_output_bpp(u32 link_clock, u32 lane_count, | |
| 504 | + u32 mode_clock, u32 mode_hdisplay) | |
| 505 | +{ | |
| 506 | + u32 bits_per_pixel, max_bpp_small_joiner_ram; | |
| 507 | + int i; | |
| 508 | + | |
| 509 | + /* | |
| 510 | + * Available Link Bandwidth(Kbits/sec) = (NumberOfLanes)* | |
| 511 | + * (LinkSymbolClock)* 8 * (TimeSlotsPerMTP) | |
| 512 | + * for SST -> TimeSlotsPerMTP is 1, | |
| 513 | + * for MST -> TimeSlotsPerMTP has to be calculated | |
| 514 | + */ | |
| 515 | + bits_per_pixel = (link_clock * lane_count * 8) / | |
| 516 | + intel_dp_mode_to_fec_clock(mode_clock); | |
| 517 | + DRM_DEBUG_KMS("Max link bpp: %u\n", bits_per_pixel); | |
| 518 | + | |
| 519 | + /* Small Joiner Check: output bpp <= joiner RAM (bits) / Horiz. width */ | |
| 520 | + max_bpp_small_joiner_ram = DP_DSC_MAX_SMALL_JOINER_RAM_BUFFER / mode_hdisplay; | |
| 521 | + DRM_DEBUG_KMS("Max small joiner bpp: %u\n", max_bpp_small_joiner_ram); | |
| 522 | + | |
| 523 | + /* | |
| 524 | + * Greatest allowed DSC BPP = MIN (output BPP from available Link BW | |
| 525 | + * check, output bpp from small joiner RAM check) | |
| 526 | + */ | |
| 527 | + bits_per_pixel = min(bits_per_pixel, max_bpp_small_joiner_ram); | |
| 528 | + | |
| 529 | + /* Error out if the max bpp is less than smallest allowed valid bpp */ | |
| 530 | + if (bits_per_pixel < valid_dsc_bpp[0]) { | |
| 531 | + DRM_DEBUG_KMS("Unsupported BPP %u, min %u\n", | |
| 532 | + bits_per_pixel, valid_dsc_bpp[0]); | |
| 533 | + return 0; | |
| 534 | + } | |
| 535 | + | |
| 536 | + /* Find the nearest match in the array of known BPPs from VESA */ | |
| 537 | + for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp) - 1; i++) { | |
| 538 | + if (bits_per_pixel < valid_dsc_bpp[i + 1]) | |
| 539 | + break; | |
| 540 | + } | |
| 541 | + bits_per_pixel = valid_dsc_bpp[i]; | |
| 542 | + | |
| 543 | + /* | |
| 544 | + * Compressed BPP in U6.4 format so multiply by 16, for Gen 11, | |
| 545 | + * fractional part is 0 | |
| 546 | + */ | |
| 547 | + return bits_per_pixel << 4; | |
| 548 | +} | |
| 549 | + | |
| 550 | +static u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, | |
| 551 | + int mode_clock, int mode_hdisplay) | |
| 552 | +{ | |
| 553 | + u8 min_slice_count, i; | |
| 554 | + int max_slice_width; | |
| 555 | + | |
| 556 | + if (mode_clock <= DP_DSC_PEAK_PIXEL_RATE) | |
| 557 | + min_slice_count = DIV_ROUND_UP(mode_clock, | |
| 558 | + DP_DSC_MAX_ENC_THROUGHPUT_0); | |
| 559 | + else | |
| 560 | + min_slice_count = DIV_ROUND_UP(mode_clock, | |
| 561 | + DP_DSC_MAX_ENC_THROUGHPUT_1); | |
| 562 | + | |
| 563 | + max_slice_width = drm_dp_dsc_sink_max_slice_width(intel_dp->dsc_dpcd); | |
| 564 | + if (max_slice_width < DP_DSC_MIN_SLICE_WIDTH_VALUE) { | |
| 565 | + DRM_DEBUG_KMS("Unsupported slice width %d by DP DSC Sink device\n", | |
| 566 | + max_slice_width); | |
| 567 | + return 0; | |
| 568 | + } | |
| 569 | + /* Also take into account max slice width */ | |
| 570 | + min_slice_count = min_t(u8, min_slice_count, | |
| 571 | + DIV_ROUND_UP(mode_hdisplay, | |
| 572 | + max_slice_width)); | |
| 573 | + | |
| 574 | + /* Find the closest match to the valid slice count values */ | |
| 575 | + for (i = 0; i < ARRAY_SIZE(valid_dsc_slicecount); i++) { | |
| 576 | + if (valid_dsc_slicecount[i] > | |
| 577 | + drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd, | |
| 578 | + false)) | |
| 579 | + break; | |
| 580 | + if (min_slice_count <= valid_dsc_slicecount[i]) | |
| 581 | + return valid_dsc_slicecount[i]; | |
| 582 | + } | |
| 583 | + | |
| 584 | + DRM_DEBUG_KMS("Unsupported Slice Count %d\n", min_slice_count); | |
| 585 | + return 0; | |
| 586 | +} | |
| 587 | + | |
| 497 | 588 | static enum drm_mode_status |
| 498 | 589 | intel_dp_mode_valid(struct drm_connector *connector, |
| 499 | 590 | struct drm_display_mode *mode) |
| @@ -2226,7 +2317,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, · 1726 unmodified lines | ||
| 2226 | 2317 | adjusted_mode->crtc_clock, |
| 2227 | 2318 | pipe_config->port_clock, |
| 2228 | 2319 | &pipe_config->dp_m_n, |
| 2229 | − constant_n); | |
| 2320 | + constant_n, pipe_config->fec_enable); | |
| 2230 | 2321 | |
| 2231 | 2322 | if (intel_connector->panel.downclock_mode != NULL && |
| 2232 | 2323 | dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) { |
| @@ -2236,7 +2327,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, · 3 unmodified lines | ||
| 2236 | 2327 | intel_connector->panel.downclock_mode->clock, |
| 2237 | 2328 | pipe_config->port_clock, |
| 2238 | 2329 | &pipe_config->dp_m2_n2, |
| 2239 | − constant_n); | |
| 2330 | + constant_n, pipe_config->fec_enable); | |
| 2240 | 2331 | } |
| 2241 | 2332 | |
| 2242 | 2333 | if (!HAS_DDI(dev_priv)) |
| @@ -4323,91 +4414,6 @@ intel_dp_get_sink_irq_esi(struct intel_dp *intel_dp, u8 *sink_irq_vector) · 2080 unmodified lines | ||
| 4323 | 4414 | DP_DPRX_ESI_LEN; |
| 4324 | 4415 | } |
| 4325 | 4416 | |
| 4326 | −u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count, | |
| 4327 | − int mode_clock, int mode_hdisplay) | |
| 4328 | −{ | |
| 4329 | − u16 bits_per_pixel, max_bpp_small_joiner_ram; | |
| 4330 | − int i; | |
| 4331 | − | |
| 4332 | − /* | |
| 4333 | − * Available Link Bandwidth(Kbits/sec) = (NumberOfLanes)* | |
| 4334 | − * (LinkSymbolClock)* 8 * ((100-FECOverhead)/100)*(TimeSlotsPerMTP) | |
| 4335 | − * FECOverhead = 2.4%, for SST -> TimeSlotsPerMTP is 1, | |
| 4336 | − * for MST -> TimeSlotsPerMTP has to be calculated | |
| 4337 | − */ | |
| 4338 | − bits_per_pixel = (link_clock * lane_count * 8 * | |
| 4339 | − DP_DSC_FEC_OVERHEAD_FACTOR) / | |
| 4340 | − mode_clock; | |
| 4341 | − | |
| 4342 | − /* Small Joiner Check: output bpp <= joiner RAM (bits) / Horiz. width */ | |
| 4343 | − max_bpp_small_joiner_ram = DP_DSC_MAX_SMALL_JOINER_RAM_BUFFER / | |
| 4344 | − mode_hdisplay; | |
| 4345 | − | |
| 4346 | − /* | |
| 4347 | − * Greatest allowed DSC BPP = MIN (output BPP from avaialble Link BW | |
| 4348 | − * check, output bpp from small joiner RAM check) | |
| 4349 | − */ | |
| 4350 | − bits_per_pixel = min(bits_per_pixel, max_bpp_small_joiner_ram); | |
| 4351 | − | |
| 4352 | − /* Error out if the max bpp is less than smallest allowed valid bpp */ | |
| 4353 | − if (bits_per_pixel < valid_dsc_bpp[0]) { | |
| 4354 | − DRM_DEBUG_KMS("Unsupported BPP %d\n", bits_per_pixel); | |
| 4355 | − return 0; | |
| 4356 | − } | |
| 4357 | − | |
| 4358 | − /* Find the nearest match in the array of known BPPs from VESA */ | |
| 4359 | − for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp) - 1; i++) { | |
| 4360 | − if (bits_per_pixel < valid_dsc_bpp[i + 1]) | |
| 4361 | − break; | |
| 4362 | − } | |
| 4363 | − bits_per_pixel = valid_dsc_bpp[i]; | |
| 4364 | − | |
| 4365 | − /* | |
| 4366 | − * Compressed BPP in U6.4 format so multiply by 16, for Gen 11, | |
| 4367 | − * fractional part is 0 | |
| 4368 | − */ | |
| 4369 | − return bits_per_pixel << 4; | |
| 4370 | −} | |
| 4371 | − | |
| 4372 | −u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, | |
| 4373 | − int mode_clock, | |
| 4374 | − int mode_hdisplay) | |
| 4375 | −{ | |
| 4376 | − u8 min_slice_count, i; | |
| 4377 | − int max_slice_width; | |
| 4378 | − | |
| 4379 | − if (mode_clock <= DP_DSC_PEAK_PIXEL_RATE) | |
| 4380 | − min_slice_count = DIV_ROUND_UP(mode_clock, | |
| 4381 | − DP_DSC_MAX_ENC_THROUGHPUT_0); | |
| 4382 | − else | |
| 4383 | − min_slice_count = DIV_ROUND_UP(mode_clock, | |
| 4384 | − DP_DSC_MAX_ENC_THROUGHPUT_1); | |
| 4385 | − | |
| 4386 | − max_slice_width = drm_dp_dsc_sink_max_slice_width(intel_dp->dsc_dpcd); | |
| 4387 | − if (max_slice_width < DP_DSC_MIN_SLICE_WIDTH_VALUE) { | |
| 4388 | − DRM_DEBUG_KMS("Unsupported slice width %d by DP DSC Sink device\n", | |
| 4389 | − max_slice_width); | |
| 4390 | − return 0; | |
| 4391 | − } | |
| 4392 | − /* Also take into account max slice width */ | |
| 4393 | − min_slice_count = min_t(u8, min_slice_count, | |
| 4394 | − DIV_ROUND_UP(mode_hdisplay, | |
| 4395 | − max_slice_width)); | |
| 4396 | − | |
| 4397 | − /* Find the closest match to the valid slice count values */ | |
| 4398 | − for (i = 0; i < ARRAY_SIZE(valid_dsc_slicecount); i++) { | |
| 4399 | − if (valid_dsc_slicecount[i] > | |
| 4400 | − drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd, | |
| 4401 | − false)) | |
| 4402 | − break; | |
| 4403 | − if (min_slice_count <= valid_dsc_slicecount[i]) | |
| 4404 | − return valid_dsc_slicecount[i]; | |
| 4405 | − } | |
| 4406 | − | |
| 4407 | − DRM_DEBUG_KMS("Unsupported Slice Count %d\n", min_slice_count); | |
| 4408 | − return 0; | |
| 4409 | −} | |
| 4410 | − | |
| 4411 | 4417 | static void |
| 4412 | 4418 | intel_pixel_encoding_setup_vsc(struct intel_dp *intel_dp, |
| 4413 | 4419 | const struct intel_crtc_state *crtc_state) |
| @@ -102,10 +102,6 @@ bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp); · 101 unmodified lines | ||
| 102 | 102 | bool intel_dp_source_supports_hbr3(struct intel_dp *intel_dp); |
| 103 | 103 | bool |
| 104 | 104 | intel_dp_get_link_status(struct intel_dp *intel_dp, u8 *link_status); |
| 105 | −u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count, | |
| 106 | − int mode_clock, int mode_hdisplay); | |
| 107 | −u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, int mode_clock, | |
| 108 | − int mode_hdisplay); | |
| 109 | 105 | |
| 110 | 106 | bool intel_dp_read_dpcd(struct intel_dp *intel_dp); |
| 111 | 107 | bool intel_dp_get_colorimetry_status(struct intel_dp *intel_dp); |
| @@ -118,4 +114,6 @@ static inline unsigned int intel_dp_unused_lane_mask(int lane_count) · 6 unmodified lines | ||
| 118 | 114 | return ~((1 << lane_count) - 1) & 0xf; |
| 119 | 115 | } |
| 120 | 116 | |
| 117 | +u32 intel_dp_mode_to_fec_clock(u32 mode_clock); | |
| 118 | + | |
| 121 | 119 | #endif /* __INTEL_DP_H__ */ |
| @@ -81,7 +81,7 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, · 80 unmodified lines | ||
| 81 | 81 | adjusted_mode->crtc_clock, |
| 82 | 82 | crtc_state->port_clock, |
| 83 | 83 | &crtc_state->dp_m_n, |
| 84 | − constant_n); | |
| 84 | + constant_n, crtc_state->fec_enable); | |
| 85 | 85 | crtc_state->dp_m_n.tu = slots; |
| 86 | 86 | |
| 87 | 87 | return 0; |
| @@ -615,7 +615,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum · 527 unmodified lines | ||
| 615 | 615 | intel_encoder->type = INTEL_OUTPUT_DP_MST; |
| 616 | 616 | intel_encoder->power_domain = intel_dig_port->base.power_domain; |
| 617 | 617 | intel_encoder->port = intel_dig_port->base.port; |
| 618 | − intel_encoder->crtc_mask = BIT(pipe); | |
| 618 | + intel_encoder->crtc_mask = 0x7; | |
| 619 | 619 | intel_encoder->cloneable = 0; |
| 620 | 620 | |
| 621 | 621 | intel_encoder->compute_config = intel_dp_mst_compute_config; |
| @@ -1528,6 +1528,7 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, · 1527 unmodified lines | ||
| 1528 | 1528 | int src_x, src_w, src_h, crtc_w, crtc_h; |
| 1529 | 1529 | const struct drm_display_mode *adjusted_mode = |
| 1530 | 1530 | &crtc_state->base.adjusted_mode; |
| 1531 | + unsigned int stride = plane_state->color_plane[0].stride; | |
| 1531 | 1532 | unsigned int cpp = fb->format->cpp[0]; |
| 1532 | 1533 | unsigned int width_bytes; |
| 1533 | 1534 | int min_width, min_height; |
| @@ -1569,9 +1570,9 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, · 35 unmodified lines | ||
| 1569 | 1570 | return -EINVAL; |
| 1570 | 1571 | } |
| 1571 | 1572 | |
| 1572 | − if (width_bytes > 4096 || fb->pitches[0] > 4096) { | |
| 1573 | + if (stride > 4096) { | |
| 1573 | 1574 | DRM_DEBUG_KMS("Stride (%u) exceeds hardware max with scaling (%u)\n", |
| 1574 | − fb->pitches[0], 4096); | |
| 1575 | + stride, 4096); | |
| 1575 | 1576 | return -EINVAL; |
| 1576 | 1577 | } |
| 1577 | 1578 | |
| @@ -245,11 +245,9 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf) · 244 unmodified lines | ||
| 245 | 245 | |
| 246 | 246 | wakeref = intel_runtime_pm_get(rpm); |
| 247 | 247 | |
| 248 | − srcu = intel_gt_reset_trylock(ggtt->vm.gt); | |
| 249 | − if (srcu < 0) { | |
| 250 | − ret = srcu; | |
| 248 | + ret = intel_gt_reset_trylock(ggtt->vm.gt, &srcu); | |
| 249 | + if (ret) | |
| 251 | 250 | goto err_rpm; |
| 252 | − } | |
| 253 | 251 | |
| 254 | 252 | ret = i915_mutex_lock_interruptible(dev); |
| 255 | 253 | if (ret) |
| @@ -318,7 +316,11 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf) · 62 unmodified lines | ||
| 318 | 316 | intel_wakeref_auto(&i915->ggtt.userfault_wakeref, |
| 319 | 317 | msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)); |
| 320 | 318 | |
| 321 | − i915_vma_set_ggtt_write(vma); | |
| 319 | + if (write) { | |
| 320 | + GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj)); | |
| 321 | + i915_vma_set_ggtt_write(vma); | |
| 322 | + obj->mm.dirty = true; | |
| 323 | + } | |
| 322 | 324 | |
| 323 | 325 | err_fence: |
| 324 | 326 | i915_vma_unpin_fence(vma); |
| @@ -241,9 +241,6 @@ void i915_gem_resume(struct drm_i915_private *i915) · 240 unmodified lines | ||
| 241 | 241 | mutex_lock(&i915->drm.struct_mutex); |
| 242 | 242 | intel_uncore_forcewake_get(&i915->uncore, FORCEWAKE_ALL); |
| 243 | 243 | |
| 244 | − i915_gem_restore_gtt_mappings(i915); | |
| 245 | − i915_gem_restore_fences(i915); | |
| 246 | − | |
| 247 | 244 | if (i915_gem_init_hw(i915)) |
| 248 | 245 | goto err_wedged; |
| 249 | 246 | |
| @@ -136,6 +136,20 @@ execlists_active(const struct intel_engine_execlists *execlists) · 135 unmodified lines | ||
| 136 | 136 | return READ_ONCE(*execlists->active); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | +static inline void | |
| 140 | +execlists_active_lock_bh(struct intel_engine_execlists *execlists) | |
| 141 | +{ | |
| 142 | + local_bh_disable(); /* prevent local softirq and lock recursion */ | |
| 143 | + tasklet_lock(&execlists->tasklet); | |
| 144 | +} | |
| 145 | + | |
| 146 | +static inline void | |
| 147 | +execlists_active_unlock_bh(struct intel_engine_execlists *execlists) | |
| 148 | +{ | |
| 149 | + tasklet_unlock(&execlists->tasklet); | |
| 150 | + local_bh_enable(); /* restore softirq, and kick ksoftirqd! */ | |
| 151 | +} | |
| 152 | + | |
| 139 | 153 | struct i915_request * |
| 140 | 154 | execlists_unwind_incomplete_requests(struct intel_engine_execlists *execlists); |
| 141 | 155 | |
| @@ -1197,9 +1197,7 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine, · 1196 unmodified lines | ||
| 1197 | 1197 | struct drm_printer *m) |
| 1198 | 1198 | { |
| 1199 | 1199 | struct drm_i915_private *dev_priv = engine->i915; |
| 1200 | − const struct intel_engine_execlists * const execlists = | |
| 1201 | − &engine->execlists; | |
| 1202 | − unsigned long flags; | |
| 1200 | + struct intel_engine_execlists * const execlists = &engine->execlists; | |
| 1203 | 1201 | u64 addr; |
| 1204 | 1202 | |
| 1205 | 1203 | if (engine->id == RENDER_CLASS && IS_GEN_RANGE(dev_priv, 4, 7)) |
| @@ -1281,7 +1279,7 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine, · 75 unmodified lines | ||
| 1281 | 1279 | idx, hws[idx * 2], hws[idx * 2 + 1]); |
| 1282 | 1280 | } |
| 1283 | 1281 | |
| 1284 | − spin_lock_irqsave(&engine->active.lock, flags); | |
| 1282 | + execlists_active_lock_bh(execlists); | |
| 1285 | 1283 | for (port = execlists->active; (rq = *port); port++) { |
| 1286 | 1284 | char hdr[80]; |
| 1287 | 1285 | int len; |
| @@ -1309,7 +1307,7 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine, · 21 unmodified lines | ||
| 1309 | 1307 | hwsp_seqno(rq)); |
| 1310 | 1308 | print_request(m, rq, hdr); |
| 1311 | 1309 | } |
| 1312 | − spin_unlock_irqrestore(&engine->active.lock, flags); | |
| 1310 | + execlists_active_unlock_bh(execlists); | |
| 1313 | 1311 | } else if (INTEL_GEN(dev_priv) > 6) { |
| 1314 | 1312 | drm_printf(m, "\tPP_DIR_BASE: 0x%08x\n", |
| 1315 | 1313 | ENGINE_READ(engine, RING_PP_DIR_BASE)); |
| @@ -1440,8 +1438,8 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine) · 124 unmodified lines | ||
| 1440 | 1438 | if (!intel_engine_supports_stats(engine)) |
| 1441 | 1439 | return -ENODEV; |
| 1442 | 1440 | |
| 1443 | − spin_lock_irqsave(&engine->active.lock, flags); | |
| 1444 | − write_seqlock(&engine->stats.lock); | |
| 1441 | + execlists_active_lock_bh(execlists); | |
| 1442 | + write_seqlock_irqsave(&engine->stats.lock, flags); | |
| 1445 | 1443 | |
| 1446 | 1444 | if (unlikely(engine->stats.enabled == ~0)) { |
| 1447 | 1445 | err = -EBUSY; |
| @@ -1469,8 +1467,8 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine) · 21 unmodified lines | ||
| 1469 | 1467 | } |
| 1470 | 1468 | |
| 1471 | 1469 | unlock: |
| 1472 | − write_sequnlock(&engine->stats.lock); | |
| 1473 | − spin_unlock_irqrestore(&engine->active.lock, flags); | |
| 1470 | + write_sequnlock_irqrestore(&engine->stats.lock, flags); | |
| 1471 | + execlists_active_unlock_bh(execlists); | |
| 1474 | 1472 | |
| 1475 | 1473 | return err; |
| 1476 | 1474 | } |
| @@ -631,7 +631,6 @@ execlists_schedule_out(struct i915_request *rq) · 630 unmodified lines | ||
| 631 | 631 | struct intel_engine_cs *cur, *old; |
| 632 | 632 | |
| 633 | 633 | trace_i915_request_out(rq); |
| 634 | − GEM_BUG_ON(intel_context_inflight(ce) != rq->engine); | |
| 635 | 634 | |
| 636 | 635 | old = READ_ONCE(ce->inflight); |
| 637 | 636 | do |
| @@ -797,6 +796,17 @@ static bool can_merge_rq(const struct i915_request *prev, · 159 unmodified lines | ||
| 797 | 796 | GEM_BUG_ON(prev == next); |
| 798 | 797 | GEM_BUG_ON(!assert_priority_queue(prev, next)); |
| 799 | 798 | |
| 799 | + /* | |
| 800 | + * We do not submit known completed requests. Therefore if the next | |
| 801 | + * request is already completed, we can pretend to merge it in | |
| 802 | + * with the previous context (and we will skip updating the ELSP | |
| 803 | + * and tracking). Thus hopefully keeping the ELSP full with active | |
| 804 | + * contexts, despite the best efforts of preempt-to-busy to confuse | |
| 805 | + * us. | |
| 806 | + */ | |
| 807 | + if (i915_request_completed(next)) | |
| 808 | + return true; | |
| 809 | + | |
| 800 | 810 | if (!can_merge_ctx(prev->hw_context, next->hw_context)) |
| 801 | 811 | return false; |
| 802 | 812 | |
| @@ -893,7 +903,7 @@ static void virtual_xfer_breadcrumbs(struct virtual_engine *ve, · 90 unmodified lines | ||
| 893 | 903 | static struct i915_request * |
| 894 | 904 | last_active(const struct intel_engine_execlists *execlists) |
| 895 | 905 | { |
| 896 | − struct i915_request * const *last = execlists->active; | |
| 906 | + struct i915_request * const *last = READ_ONCE(execlists->active); | |
| 897 | 907 | |
| 898 | 908 | while (*last && i915_request_completed(*last)) |
| 899 | 909 | last++; |
| @@ -1172,21 +1182,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 272 unmodified lines | ||
| 1172 | 1182 | continue; |
| 1173 | 1183 | } |
| 1174 | 1184 | |
| 1175 | − if (i915_request_completed(rq)) { | |
| 1176 | − ve->request = NULL; | |
| 1177 | − ve->base.execlists.queue_priority_hint = INT_MIN; | |
| 1178 | − rb_erase_cached(rb, &execlists->virtual); | |
| 1179 | − RB_CLEAR_NODE(rb); | |
| 1180 | − | |
| 1181 | − rq->engine = engine; | |
| 1182 | − __i915_request_submit(rq); | |
| 1183 | − | |
| 1184 | − spin_unlock(&ve->base.active.lock); | |
| 1185 | − | |
| 1186 | − rb = rb_first_cached(&execlists->virtual); | |
| 1187 | − continue; | |
| 1188 | − } | |
| 1189 | − | |
| 1190 | 1185 | if (last && !can_merge_rq(last, rq)) { |
| 1191 | 1186 | spin_unlock(&ve->base.active.lock); |
| 1192 | 1187 | return; /* leave this for another */ |
| @@ -1237,11 +1232,23 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 44 unmodified lines | ||
| 1237 | 1232 | GEM_BUG_ON(ve->siblings[0] != engine); |
| 1238 | 1233 | } |
| 1239 | 1234 | |
| 1240 | − __i915_request_submit(rq); | |
| 1241 | − if (!i915_request_completed(rq)) { | |
| 1235 | + if (__i915_request_submit(rq)) { | |
| 1242 | 1236 | submit = true; |
| 1243 | 1237 | last = rq; |
| 1244 | 1238 | } |
| 1239 | + | |
| 1240 | + /* | |
| 1241 | + * Hmm, we have a bunch of virtual engine requests, | |
| 1242 | + * but the first one was already completed (thanks | |
| 1243 | + * preempt-to-busy!). Keep looking at the veng queue | |
| 1244 | + * until we have no more relevant requests (i.e. | |
| 1245 | + * the normal submit queue has higher priority). | |
| 1246 | + */ | |
| 1247 | + if (!submit) { | |
| 1248 | + spin_unlock(&ve->base.active.lock); | |
| 1249 | + rb = rb_first_cached(&execlists->virtual); | |
| 1250 | + continue; | |
| 1251 | + } | |
| 1245 | 1252 | } |
| 1246 | 1253 | |
| 1247 | 1254 | spin_unlock(&ve->base.active.lock); |
| @@ -1254,8 +1261,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 6 unmodified lines | ||
| 1254 | 1261 | int i; |
| 1255 | 1262 | |
| 1256 | 1263 | priolist_for_each_request_consume(rq, rn, p, i) { |
| 1257 | − if (i915_request_completed(rq)) | |
| 1258 | − goto skip; | |
| 1264 | + bool merge = true; | |
| 1259 | 1265 | |
| 1260 | 1266 | /* |
| 1261 | 1267 | * Can we combine this request with the current port? |
| @@ -1296,14 +1302,23 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 34 unmodified lines | ||
| 1296 | 1302 | ctx_single_port_submission(rq->hw_context)) |
| 1297 | 1303 | goto done; |
| 1298 | 1304 | |
| 1299 | − *port = execlists_schedule_in(last, port - execlists->pending); | |
| 1300 | − port++; | |
| 1305 | + merge = false; | |
| 1301 | 1306 | } |
| 1302 | 1307 | |
| 1303 | − last = rq; | |
| 1304 | − submit = true; | |
| 1305 | −skip: | |
| 1306 | − __i915_request_submit(rq); | |
| 1308 | + if (__i915_request_submit(rq)) { | |
| 1309 | + if (!merge) { | |
| 1310 | + *port = execlists_schedule_in(last, port - execlists->pending); | |
| 1311 | + port++; | |
| 1312 | + last = NULL; | |
| 1313 | + } | |
| 1314 | + | |
| 1315 | + GEM_BUG_ON(last && | |
| 1316 | + !can_merge_ctx(last->hw_context, | |
| 1317 | + rq->hw_context)); | |
| 1318 | + | |
| 1319 | + submit = true; | |
| 1320 | + last = rq; | |
| 1321 | + } | |
| 1307 | 1322 | } |
| 1308 | 1323 | |
| 1309 | 1324 | rb_erase_cached(&p->node, &execlists->queue); |
| @@ -1593,8 +1608,11 @@ static void process_csb(struct intel_engine_cs *engine) · 283 unmodified lines | ||
| 1593 | 1608 | static void __execlists_submission_tasklet(struct intel_engine_cs *const engine) |
| 1594 | 1609 | { |
| 1595 | 1610 | lockdep_assert_held(&engine->active.lock); |
| 1596 | − if (!engine->execlists.pending[0]) | |
| 1611 | + if (!engine->execlists.pending[0]) { | |
| 1612 | + rcu_read_lock(); /* protect peeking at execlists->active */ | |
| 1597 | 1613 | execlists_dequeue(engine); |
| 1614 | + rcu_read_unlock(); | |
| 1615 | + } | |
| 1598 | 1616 | } |
| 1599 | 1617 | |
| 1600 | 1618 | /* |
| @@ -2399,10 +2417,14 @@ static void reset_csb_pointers(struct intel_engine_cs *engine) · 798 unmodified lines | ||
| 2399 | 2417 | |
| 2400 | 2418 | static struct i915_request *active_request(struct i915_request *rq) |
| 2401 | 2419 | { |
| 2402 | − const struct list_head * const list = &rq->timeline->requests; | |
| 2403 | 2420 | const struct intel_context * const ce = rq->hw_context; |
| 2404 | 2421 | struct i915_request *active = NULL; |
| 2422 | + struct list_head *list; | |
| 2423 | + | |
| 2424 | + if (!i915_request_is_active(rq)) /* unwound, but incomplete! */ | |
| 2425 | + return rq; | |
| 2405 | 2426 | |
| 2427 | + list = &rq->timeline->requests; | |
| 2406 | 2428 | list_for_each_entry_from_reverse(rq, list, link) { |
| 2407 | 2429 | if (i915_request_completed(rq)) |
| 2408 | 2430 | break; |
| @@ -2565,7 +2587,6 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) · 156 unmodified lines | ||
| 2565 | 2587 | int i; |
| 2566 | 2588 | |
| 2567 | 2589 | priolist_for_each_request_consume(rq, rn, p, i) { |
| 2568 | − list_del_init(&rq->sched.link); | |
| 2569 | 2590 | __i915_request_submit(rq); |
| 2570 | 2591 | dma_fence_set_error(&rq->fence, -EIO); |
| 2571 | 2592 | i915_request_mark_complete(rq); |
| @@ -3631,18 +3652,22 @@ static void · 1059 unmodified lines | ||
| 3631 | 3652 | virtual_bond_execute(struct i915_request *rq, struct dma_fence *signal) |
| 3632 | 3653 | { |
| 3633 | 3654 | struct virtual_engine *ve = to_virtual_engine(rq->engine); |
| 3655 | + intel_engine_mask_t allowed, exec; | |
| 3634 | 3656 | struct ve_bond *bond; |
| 3635 | 3657 | |
| 3658 | + allowed = ~to_request(signal)->engine->mask; | |
| 3659 | + | |
| 3636 | 3660 | bond = virtual_find_bond(ve, to_request(signal)->engine); |
| 3637 | − if (bond) { | |
| 3638 | − intel_engine_mask_t old, new, cmp; | |
| 3661 | + if (bond) | |
| 3662 | + allowed &= bond->sibling_mask; | |
| 3639 | 3663 | |
| 3640 | − cmp = READ_ONCE(rq->execution_mask); | |
| 3641 | − do { | |
| 3642 | − old = cmp; | |
| 3643 | − new = cmp & bond->sibling_mask; | |
| 3644 | − } while ((cmp = cmpxchg(&rq->execution_mask, old, new)) != old); | |
| 3645 | − } | |
| 3664 | + /* Restrict the bonded request to run on only the available engines */ | |
| 3665 | + exec = READ_ONCE(rq->execution_mask); | |
| 3666 | + while (!try_cmpxchg(&rq->execution_mask, &exec, exec & allowed)) | |
| 3667 | + ; | |
| 3668 | + | |
| 3669 | + /* Prevent the master from being re-run on the bonded engines */ | |
| 3670 | + to_request(signal)->execution_mask &= ~allowed; | |
| 3646 | 3671 | } |
| 3647 | 3672 | |
| 3648 | 3673 | struct intel_context * |
| @@ -42,11 +42,10 @@ static void engine_skip_context(struct i915_request *rq) · 41 unmodified lines | ||
| 42 | 42 | struct intel_engine_cs *engine = rq->engine; |
| 43 | 43 | struct i915_gem_context *hung_ctx = rq->gem_context; |
| 44 | 44 | |
| 45 | − lockdep_assert_held(&engine->active.lock); | |
| 46 | − | |
| 47 | 45 | if (!i915_request_is_active(rq)) |
| 48 | 46 | return; |
| 49 | 47 | |
| 48 | + lockdep_assert_held(&engine->active.lock); | |
| 50 | 49 | list_for_each_entry_continue(rq, &engine->active.requests, sched.link) |
| 51 | 50 | if (rq->gem_context == hung_ctx) |
| 52 | 51 | i915_request_skip(rq, -EIO); |
| @@ -123,7 +122,6 @@ void __i915_request_reset(struct i915_request *rq, bool guilty) · 70 unmodified lines | ||
| 123 | 122 | rq->fence.seqno, |
| 124 | 123 | yesno(guilty)); |
| 125 | 124 | |
| 126 | − lockdep_assert_held(&rq->engine->active.lock); | |
| 127 | 125 | GEM_BUG_ON(i915_request_completed(rq)); |
| 128 | 126 | |
| 129 | 127 | if (guilty) { |
| @@ -1214,10 +1212,8 @@ out: · 1084 unmodified lines | ||
| 1214 | 1212 | intel_runtime_pm_put(>->i915->runtime_pm, wakeref); |
| 1215 | 1213 | } |
| 1216 | 1214 | |
| 1217 | −int intel_gt_reset_trylock(struct intel_gt *gt) | |
| 1215 | +int intel_gt_reset_trylock(struct intel_gt *gt, int *srcu) | |
| 1218 | 1216 | { |
| 1219 | − int srcu; | |
| 1220 | − | |
| 1221 | 1217 | might_lock(>->reset.backoff_srcu); |
| 1222 | 1218 | might_sleep(); |
| 1223 | 1219 | |
| @@ -1232,10 +1228,10 @@ int intel_gt_reset_trylock(struct intel_gt *gt) · 8 unmodified lines | ||
| 1232 | 1228 | |
| 1233 | 1229 | rcu_read_lock(); |
| 1234 | 1230 | } |
| 1235 | − srcu = srcu_read_lock(>->reset.backoff_srcu); | |
| 1231 | + *srcu = srcu_read_lock(>->reset.backoff_srcu); | |
| 1236 | 1232 | rcu_read_unlock(); |
| 1237 | 1233 | |
| 1238 | − return srcu; | |
| 1234 | + return 0; | |
| 1239 | 1235 | } |
| 1240 | 1236 | |
| 1241 | 1237 | void intel_gt_reset_unlock(struct intel_gt *gt, int tag) |
| @@ -38,7 +38,7 @@ int intel_engine_reset(struct intel_engine_cs *engine, · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | void __i915_request_reset(struct i915_request *rq, bool guilty); |
| 40 | 40 | |
| 41 | −int __must_check intel_gt_reset_trylock(struct intel_gt *gt); | |
| 41 | +int __must_check intel_gt_reset_trylock(struct intel_gt *gt, int *srcu); | |
| 42 | 42 | void intel_gt_reset_unlock(struct intel_gt *gt, int tag); |
| 43 | 43 | |
| 44 | 44 | void intel_gt_set_wedged(struct intel_gt *gt); |
| @@ -1573,7 +1573,7 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags) · 1572 unmodified lines | ||
| 1573 | 1573 | struct intel_engine_cs *engine = rq->engine; |
| 1574 | 1574 | enum intel_engine_id id; |
| 1575 | 1575 | const int num_engines = |
| 1576 | − IS_HSW_GT1(i915) ? RUNTIME_INFO(i915)->num_engines - 1 : 0; | |
| 1576 | + IS_HASWELL(i915) ? RUNTIME_INFO(i915)->num_engines - 1 : 0; | |
| 1577 | 1577 | bool force_restore = false; |
| 1578 | 1578 | int len; |
| 1579 | 1579 | u32 *cs; |
| @@ -1063,6 +1063,9 @@ static void gen9_whitelist_build(struct i915_wa_list *w) · 1062 unmodified lines | ||
| 1063 | 1063 | |
| 1064 | 1064 | /* WaAllowUMDToModifyHDCChicken1:skl,bxt,kbl,glk,cfl */ |
| 1065 | 1065 | whitelist_reg(w, GEN8_HDC_CHICKEN1); |
| 1066 | + | |
| 1067 | + /* WaSendPushConstantsFromMMIO:skl,bxt */ | |
| 1068 | + whitelist_reg(w, COMMON_SLICE_CHICKEN2); | |
| 1066 | 1069 | } |
| 1067 | 1070 | |
| 1068 | 1071 | static void skl_whitelist_build(struct intel_engine_cs *engine) |
| @@ -1924,6 +1924,11 @@ static int i915_drm_resume(struct drm_device *dev) · 1923 unmodified lines | ||
| 1924 | 1924 | if (ret) |
| 1925 | 1925 | DRM_ERROR("failed to re-enable GGTT\n"); |
| 1926 | 1926 | |
| 1927 | + mutex_lock(&dev_priv->drm.struct_mutex); | |
| 1928 | + i915_gem_restore_gtt_mappings(dev_priv); | |
| 1929 | + i915_gem_restore_fences(dev_priv); | |
| 1930 | + mutex_unlock(&dev_priv->drm.struct_mutex); | |
| 1931 | + | |
| 1927 | 1932 | intel_csr_ucode_resume(dev_priv); |
| 1928 | 1933 | |
| 1929 | 1934 | i915_restore_state(dev_priv); |
| @@ -77,6 +77,12 @@ struct drm_i915_private; · 76 unmodified lines | ||
| 77 | 77 | |
| 78 | 78 | #define I915_GEM_IDLE_TIMEOUT (HZ / 5) |
| 79 | 79 | |
| 80 | +static inline void tasklet_lock(struct tasklet_struct *t) | |
| 81 | +{ | |
| 82 | + while (!tasklet_trylock(t)) | |
| 83 | + cpu_relax(); | |
| 84 | +} | |
| 85 | + | |
| 80 | 86 | static inline void __tasklet_disable_sync_once(struct tasklet_struct *t) |
| 81 | 87 | { |
| 82 | 88 | if (!atomic_fetch_inc(&t->count)) |
| @@ -194,6 +194,27 @@ static void free_capture_list(struct i915_request *request) · 193 unmodified lines | ||
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | +static void remove_from_engine(struct i915_request *rq) | |
| 198 | +{ | |
| 199 | + struct intel_engine_cs *engine, *locked; | |
| 200 | + | |
| 201 | + /* | |
| 202 | + * Virtual engines complicate acquiring the engine timeline lock, | |
| 203 | + * as their rq->engine pointer is not stable until under that | |
| 204 | + * engine lock. The simple ploy we use is to take the lock then | |
| 205 | + * check that the rq still belongs to the newly locked engine. | |
| 206 | + */ | |
| 207 | + locked = READ_ONCE(rq->engine); | |
| 208 | + spin_lock(&locked->active.lock); | |
| 209 | + while (unlikely(locked != (engine = READ_ONCE(rq->engine)))) { | |
| 210 | + spin_unlock(&locked->active.lock); | |
| 211 | + spin_lock(&engine->active.lock); | |
| 212 | + locked = engine; | |
| 213 | + } | |
| 214 | + list_del(&rq->sched.link); | |
| 215 | + spin_unlock(&locked->active.lock); | |
| 216 | +} | |
| 217 | + | |
| 197 | 218 | static bool i915_request_retire(struct i915_request *rq) |
| 198 | 219 | { |
| 199 | 220 | struct i915_active_request *active, *next; |
| @@ -259,9 +280,7 @@ static bool i915_request_retire(struct i915_request *rq) · 59 unmodified lines | ||
| 259 | 280 | * request that we have removed from the HW and put back on a run |
| 260 | 281 | * queue. |
| 261 | 282 | */ |
| 262 | − spin_lock(&rq->engine->active.lock); | |
| 263 | − list_del(&rq->sched.link); | |
| 264 | − spin_unlock(&rq->engine->active.lock); | |
| 283 | + remove_from_engine(rq); | |
| 265 | 284 | |
| 266 | 285 | spin_lock(&rq->lock); |
| 267 | 286 | i915_request_mark_complete(rq); |
| @@ -358,9 +377,10 @@ __i915_request_await_execution(struct i915_request *rq, · 90 unmodified lines | ||
| 358 | 377 | return 0; |
| 359 | 378 | } |
| 360 | 379 | |
| 361 | −void __i915_request_submit(struct i915_request *request) | |
| 380 | +bool __i915_request_submit(struct i915_request *request) | |
| 362 | 381 | { |
| 363 | 382 | struct intel_engine_cs *engine = request->engine; |
| 383 | + bool result = false; | |
| 364 | 384 | |
| 365 | 385 | GEM_TRACE("%s fence %llx:%lld, current %d\n", |
| 366 | 386 | engine->name, |
| @@ -370,6 +390,25 @@ void __i915_request_submit(struct i915_request *request) · 3 unmodified lines | ||
| 370 | 390 | GEM_BUG_ON(!irqs_disabled()); |
| 371 | 391 | lockdep_assert_held(&engine->active.lock); |
| 372 | 392 | |
| 393 | + /* | |
| 394 | + * With the advent of preempt-to-busy, we frequently encounter | |
| 395 | + * requests that we have unsubmitted from HW, but left running | |
| 396 | + * until the next ack and so have completed in the meantime. On | |
| 397 | + * resubmission of that completed request, we can skip | |
| 398 | + * updating the payload, and execlists can even skip submitting | |
| 399 | + * the request. | |
| 400 | + * | |
| 401 | + * We must remove the request from the caller's priority queue, | |
| 402 | + * and the caller must only call us when the request is in their | |
| 403 | + * priority queue, under the active.lock. This ensures that the | |
| 404 | + * request has *not* yet been retired and we can safely move | |
| 405 | + * the request into the engine->active.list where it will be | |
| 406 | + * dropped upon retiring. (Otherwise if resubmit a *retired* | |
| 407 | + * request, this would be a horrible use-after-free.) | |
| 408 | + */ | |
| 409 | + if (i915_request_completed(request)) | |
| 410 | + goto xfer; | |
| 411 | + | |
| 373 | 412 | if (i915_gem_context_is_banned(request->gem_context)) |
| 374 | 413 | i915_request_skip(request, -EIO); |
| 375 | 414 | |
| @@ -393,13 +432,18 @@ void __i915_request_submit(struct i915_request *request) · 17 unmodified lines | ||
| 393 | 432 | i915_sw_fence_signaled(&request->semaphore)) |
| 394 | 433 | engine->saturated |= request->sched.semaphores; |
| 395 | 434 | |
| 396 | − /* We may be recursing from the signal callback of another i915 fence */ | |
| 397 | − spin_lock_nested(&request->lock, SINGLE_DEPTH_NESTING); | |
| 435 | + engine->emit_fini_breadcrumb(request, | |
| 436 | + request->ring->vaddr + request->postfix); | |
| 398 | 437 | |
| 399 | − list_move_tail(&request->sched.link, &engine->active.requests); | |
| 438 | + trace_i915_request_execute(request); | |
| 439 | + engine->serial++; | |
| 440 | + result = true; | |
| 441 | + | |
| 442 | +xfer: /* We may be recursing from the signal callback of another i915 fence */ | |
| 443 | + spin_lock_nested(&request->lock, SINGLE_DEPTH_NESTING); | |
| 400 | 444 | |
| 401 | − GEM_BUG_ON(test_bit(I915_FENCE_FLAG_ACTIVE, &request->fence.flags)); | |
| 402 | − set_bit(I915_FENCE_FLAG_ACTIVE, &request->fence.flags); | |
| 445 | + if (!test_and_set_bit(I915_FENCE_FLAG_ACTIVE, &request->fence.flags)) | |
| 446 | + list_move_tail(&request->sched.link, &engine->active.requests); | |
| 403 | 447 | |
| 404 | 448 | if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &request->fence.flags) && |
| 405 | 449 | !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &request->fence.flags) && |
| @@ -410,12 +454,7 @@ void __i915_request_submit(struct i915_request *request) · 4 unmodified lines | ||
| 410 | 454 | |
| 411 | 455 | spin_unlock(&request->lock); |
| 412 | 456 | |
| 413 | − engine->emit_fini_breadcrumb(request, | |
| 414 | − request->ring->vaddr + request->postfix); | |
| 415 | − | |
| 416 | − engine->serial++; | |
| 417 | − | |
| 418 | − trace_i915_request_execute(request); | |
| 457 | + return result; | |
| 419 | 458 | } |
| 420 | 459 | |
| 421 | 460 | void i915_request_submit(struct i915_request *request) |
| @@ -292,7 +292,7 @@ int i915_request_await_execution(struct i915_request *rq, · 291 unmodified lines | ||
| 292 | 292 | |
| 293 | 293 | void i915_request_add(struct i915_request *rq); |
| 294 | 294 | |
| 295 | −void __i915_request_submit(struct i915_request *request); | |
| 295 | +bool __i915_request_submit(struct i915_request *request); | |
| 296 | 296 | void i915_request_submit(struct i915_request *request); |
| 297 | 297 | |
| 298 | 298 | void i915_request_skip(struct i915_request *request, int error); |
| @@ -69,6 +69,7 @@ intel_pch_type(const struct drm_i915_private *dev_priv, unsigned short id) · 68 unmodified lines | ||
| 69 | 69 | WARN_ON(!IS_CANNONLAKE(dev_priv) && !IS_COFFEELAKE(dev_priv)); |
| 70 | 70 | return PCH_CNP; |
| 71 | 71 | case INTEL_PCH_CMP_DEVICE_ID_TYPE: |
| 72 | + case INTEL_PCH_CMP2_DEVICE_ID_TYPE: | |
| 72 | 73 | DRM_DEBUG_KMS("Found Comet Lake PCH (CMP)\n"); |
| 73 | 74 | WARN_ON(!IS_COFFEELAKE(dev_priv)); |
| 74 | 75 | /* CometPoint is CNP Compatible */ |
| @@ -41,6 +41,7 @@ enum intel_pch { · 40 unmodified lines | ||
| 41 | 41 | #define INTEL_PCH_CNP_DEVICE_ID_TYPE 0xA300 |
| 42 | 42 | #define INTEL_PCH_CNP_LP_DEVICE_ID_TYPE 0x9D80 |
| 43 | 43 | #define INTEL_PCH_CMP_DEVICE_ID_TYPE 0x0280 |
| 44 | +#define INTEL_PCH_CMP2_DEVICE_ID_TYPE 0x0680 | |
| 44 | 45 | #define INTEL_PCH_ICP_DEVICE_ID_TYPE 0x3480 |
| 45 | 46 | #define INTEL_PCH_MCC_DEVICE_ID_TYPE 0x4B00 |
| 46 | 47 | #define INTEL_PCH_MCC2_DEVICE_ID_TYPE 0x3880 |
| @@ -118,6 +118,12 @@ static void pm_resume(struct drm_i915_private *i915) · 117 unmodified lines | ||
| 118 | 118 | with_intel_runtime_pm(&i915->runtime_pm, wakeref) { |
| 119 | 119 | intel_gt_sanitize(&i915->gt, false); |
| 120 | 120 | i915_gem_sanitize(i915); |
| 121 | + | |
| 122 | + mutex_lock(&i915->drm.struct_mutex); | |
| 123 | + i915_gem_restore_gtt_mappings(i915); | |
| 124 | + i915_gem_restore_fences(i915); | |
| 125 | + mutex_unlock(&i915->drm.struct_mutex); | |
| 126 | + | |
| 121 | 127 | i915_gem_resume(i915); |
| 122 | 128 | } |
| 123 | 129 | } |
| @@ -1083,7 +1083,7 @@ static const struct dss_features omap34xx_dss_feats = { · 1082 unmodified lines | ||
| 1083 | 1083 | |
| 1084 | 1084 | static const struct dss_features omap3630_dss_feats = { |
| 1085 | 1085 | .model = DSS_MODEL_OMAP3, |
| 1086 | − .fck_div_max = 32, | |
| 1086 | + .fck_div_max = 31, | |
| 1087 | 1087 | .fck_freq_max = 173000000, |
| 1088 | 1088 | .dss_fck_multiplier = 1, |
| 1089 | 1089 | .parent_clk_name = "dpll4_ck", |
| @@ -220,9 +220,17 @@ static const struct of_device_id lb035q02_of_match[] = { · 219 unmodified lines | ||
| 220 | 220 | |
| 221 | 221 | MODULE_DEVICE_TABLE(of, lb035q02_of_match); |
| 222 | 222 | |
| 223 | +static const struct spi_device_id lb035q02_ids[] = { | |
| 224 | + { "lb035q02", 0 }, | |
| 225 | + { /* sentinel */ } | |
| 226 | +}; | |
| 227 | + | |
| 228 | +MODULE_DEVICE_TABLE(spi, lb035q02_ids); | |
| 229 | + | |
| 223 | 230 | static struct spi_driver lb035q02_driver = { |
| 224 | 231 | .probe = lb035q02_probe, |
| 225 | 232 | .remove = lb035q02_remove, |
| 233 | + .id_table = lb035q02_ids, | |
| 226 | 234 | .driver = { |
| 227 | 235 | .name = "panel-lg-lb035q02", |
| 228 | 236 | .of_match_table = lb035q02_of_match, |
| @@ -231,7 +239,6 @@ static struct spi_driver lb035q02_driver = { · 2 unmodified lines | ||
| 231 | 239 | |
| 232 | 240 | module_spi_driver(lb035q02_driver); |
| 233 | 241 | |
| 234 | −MODULE_ALIAS("spi:lgphilips,lb035q02"); | |
| 235 | 242 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); |
| 236 | 243 | MODULE_DESCRIPTION("LG.Philips LB035Q02 LCD Panel driver"); |
| 237 | 244 | MODULE_LICENSE("GPL"); |
| @@ -230,9 +230,17 @@ static const struct of_device_id nl8048_of_match[] = { · 229 unmodified lines | ||
| 230 | 230 | |
| 231 | 231 | MODULE_DEVICE_TABLE(of, nl8048_of_match); |
| 232 | 232 | |
| 233 | +static const struct spi_device_id nl8048_ids[] = { | |
| 234 | + { "nl8048hl11", 0 }, | |
| 235 | + { /* sentinel */ } | |
| 236 | +}; | |
| 237 | + | |
| 238 | +MODULE_DEVICE_TABLE(spi, nl8048_ids); | |
| 239 | + | |
| 233 | 240 | static struct spi_driver nl8048_driver = { |
| 234 | 241 | .probe = nl8048_probe, |
| 235 | 242 | .remove = nl8048_remove, |
| 243 | + .id_table = nl8048_ids, | |
| 236 | 244 | .driver = { |
| 237 | 245 | .name = "panel-nec-nl8048hl11", |
| 238 | 246 | .pm = &nl8048_pm_ops, |
| @@ -242,7 +250,6 @@ static struct spi_driver nl8048_driver = { · 3 unmodified lines | ||
| 242 | 250 | |
| 243 | 251 | module_spi_driver(nl8048_driver); |
| 244 | 252 | |
| 245 | −MODULE_ALIAS("spi:nec,nl8048hl11"); | |
| 246 | 253 | MODULE_AUTHOR("Erik Gilling <konkers@android.com>"); |
| 247 | 254 | MODULE_DESCRIPTION("NEC-NL8048HL11 Driver"); |
| 248 | 255 | MODULE_LICENSE("GPL"); |
| @@ -684,9 +684,17 @@ static const struct of_device_id acx565akm_of_match[] = { · 683 unmodified lines | ||
| 684 | 684 | |
| 685 | 685 | MODULE_DEVICE_TABLE(of, acx565akm_of_match); |
| 686 | 686 | |
| 687 | +static const struct spi_device_id acx565akm_ids[] = { | |
| 688 | + { "acx565akm", 0 }, | |
| 689 | + { /* sentinel */ } | |
| 690 | +}; | |
| 691 | + | |
| 692 | +MODULE_DEVICE_TABLE(spi, acx565akm_ids); | |
| 693 | + | |
| 687 | 694 | static struct spi_driver acx565akm_driver = { |
| 688 | 695 | .probe = acx565akm_probe, |
| 689 | 696 | .remove = acx565akm_remove, |
| 697 | + .id_table = acx565akm_ids, | |
| 690 | 698 | .driver = { |
| 691 | 699 | .name = "panel-sony-acx565akm", |
| 692 | 700 | .of_match_table = acx565akm_of_match, |
| @@ -695,7 +703,6 @@ static struct spi_driver acx565akm_driver = { · 2 unmodified lines | ||
| 695 | 703 | |
| 696 | 704 | module_spi_driver(acx565akm_driver); |
| 697 | 705 | |
| 698 | −MODULE_ALIAS("spi:sony,acx565akm"); | |
| 699 | 706 | MODULE_AUTHOR("Nokia Corporation"); |
| 700 | 707 | MODULE_DESCRIPTION("Sony ACX565AKM LCD Panel Driver"); |
| 701 | 708 | MODULE_LICENSE("GPL"); |
| @@ -375,8 +375,7 @@ static const struct of_device_id td028ttec1_of_match[] = { · 374 unmodified lines | ||
| 375 | 375 | MODULE_DEVICE_TABLE(of, td028ttec1_of_match); |
| 376 | 376 | |
| 377 | 377 | static const struct spi_device_id td028ttec1_ids[] = { |
| 378 | − { "tpo,td028ttec1", 0}, | |
| 379 | − { "toppoly,td028ttec1", 0 }, | |
| 378 | + { "td028ttec1", 0 }, | |
| 380 | 379 | { /* sentinel */ } |
| 381 | 380 | }; |
| 382 | 381 | |
| @@ -491,9 +491,17 @@ static const struct of_device_id td043mtea1_of_match[] = { · 490 unmodified lines | ||
| 491 | 491 | |
| 492 | 492 | MODULE_DEVICE_TABLE(of, td043mtea1_of_match); |
| 493 | 493 | |
| 494 | +static const struct spi_device_id td043mtea1_ids[] = { | |
| 495 | + { "td043mtea1", 0 }, | |
| 496 | + { /* sentinel */ } | |
| 497 | +}; | |
| 498 | + | |
| 499 | +MODULE_DEVICE_TABLE(spi, td043mtea1_ids); | |
| 500 | + | |
| 494 | 501 | static struct spi_driver td043mtea1_driver = { |
| 495 | 502 | .probe = td043mtea1_probe, |
| 496 | 503 | .remove = td043mtea1_remove, |
| 504 | + .id_table = td043mtea1_ids, | |
| 497 | 505 | .driver = { |
| 498 | 506 | .name = "panel-tpo-td043mtea1", |
| 499 | 507 | .pm = &td043mtea1_pm_ops, |
| @@ -503,7 +511,6 @@ static struct spi_driver td043mtea1_driver = { · 3 unmodified lines | ||
| 503 | 511 | |
| 504 | 512 | module_spi_driver(td043mtea1_driver); |
| 505 | 513 | |
| 506 | −MODULE_ALIAS("spi:tpo,td043mtea1"); | |
| 507 | 514 | MODULE_AUTHOR("Gražvydas Ignotas <notasas@gmail.com>"); |
| 508 | 515 | MODULE_DESCRIPTION("TPO TD043MTEA1 Panel Driver"); |
| 509 | 516 | MODULE_LICENSE("GPL"); |
| @@ -147,7 +147,7 @@ static int rcar_du_wb_enc_atomic_check(struct drm_encoder *encoder, · 146 unmodified lines | ||
| 147 | 147 | struct drm_device *dev = encoder->dev; |
| 148 | 148 | struct drm_framebuffer *fb; |
| 149 | 149 | |
| 150 | − if (!conn_state->writeback_job || !conn_state->writeback_job->fb) | |
| 150 | + if (!conn_state->writeback_job) | |
| 151 | 151 | return 0; |
| 152 | 152 | |
| 153 | 153 | fb = conn_state->writeback_job->fb; |
| @@ -221,7 +221,7 @@ void rcar_du_writeback_setup(struct rcar_du_crtc *rcrtc, · 67 unmodified lines | ||
| 221 | 221 | unsigned int i; |
| 222 | 222 | |
| 223 | 223 | state = rcrtc->writeback.base.state; |
| 224 | − if (!state || !state->writeback_job || !state->writeback_job->fb) | |
| 224 | + if (!state || !state->writeback_job) | |
| 225 | 225 | return; |
| 226 | 226 | |
| 227 | 227 | fb = state->writeback_job->fb; |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/gpio.h> |
| 8 | 8 | #include <linux/mod_devicetable.h> |
| 9 | 9 | #include <linux/of_gpio.h> |
| 10 | +#include <linux/pinctrl/consumer.h> | |
| 10 | 11 | #include <linux/platform_device.h> |
| 11 | 12 | |
| 12 | 13 | #include <drm/drm_atomic_helper.h> |
| @@ -231,7 +231,7 @@ static int vc4_txp_connector_atomic_check(struct drm_connector *conn, · 230 unmodified lines | ||
| 231 | 231 | int i; |
| 232 | 232 | |
| 233 | 233 | conn_state = drm_atomic_get_new_connector_state(state, conn); |
| 234 | − if (!conn_state->writeback_job || !conn_state->writeback_job->fb) | |
| 234 | + if (!conn_state->writeback_job) | |
| 235 | 235 | return 0; |
| 236 | 236 | |
| 237 | 237 | crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); |
| @@ -271,8 +271,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn, · 33 unmodified lines | ||
| 271 | 271 | u32 ctrl; |
| 272 | 272 | int i; |
| 273 | 273 | |
| 274 | − if (WARN_ON(!conn_state->writeback_job || | |
| 275 | − !conn_state->writeback_job->fb)) | |
| 274 | + if (WARN_ON(!conn_state->writeback_job)) | |
| 276 | 275 | return; |
| 277 | 276 | |
| 278 | 277 | mode = &conn_state->crtc->state->adjusted_mode; |
| @@ -718,17 +718,9 @@ static int xen_drv_probe(struct xenbus_device *xb_dev, · 717 unmodified lines | ||
| 718 | 718 | struct device *dev = &xb_dev->dev; |
| 719 | 719 | int ret; |
| 720 | 720 | |
| 721 | − /* | |
| 722 | − * The device is not spawn from a device tree, so arch_setup_dma_ops | |
| 723 | − * is not called, thus leaving the device with dummy DMA ops. | |
| 724 | − * This makes the device return error on PRIME buffer import, which | |
| 725 | − * is not correct: to fix this call of_dma_configure() with a NULL | |
| 726 | − * node to set default DMA ops. | |
| 727 | − */ | |
| 728 | − dev->coherent_dma_mask = DMA_BIT_MASK(32); | |
| 729 | − ret = of_dma_configure(dev, NULL, true); | |
| 721 | + ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64)); | |
| 730 | 722 | if (ret < 0) { |
| 731 | − DRM_ERROR("Cannot setup DMA ops, ret %d", ret); | |
| 723 | + DRM_ERROR("Cannot setup DMA mask, ret %d", ret); | |
| 732 | 724 | return ret; |
| 733 | 725 | } |
| 734 | 726 | |
| @@ -314,60 +314,24 @@ static void mousevsc_on_receive(struct hv_device *device, · 313 unmodified lines | ||
| 314 | 314 | |
| 315 | 315 | static void mousevsc_on_channel_callback(void *context) |
| 316 | 316 | { |
| 317 | − const int packet_size = 0x100; | |
| 318 | − int ret; | |
| 319 | 317 | struct hv_device *device = context; |
| 320 | − u32 bytes_recvd; | |
| 321 | − u64 req_id; | |
| 322 | 318 | struct vmpacket_descriptor *desc; |
| 323 | − unsigned char *buffer; | |
| 324 | − int bufferlen = packet_size; | |
| 325 | − | |
| 326 | − buffer = kmalloc(bufferlen, GFP_ATOMIC); | |
| 327 | − if (!buffer) | |
| 328 | − return; | |
| 329 | − | |
| 330 | − do { | |
| 331 | − ret = vmbus_recvpacket_raw(device->channel, buffer, | |
| 332 | − bufferlen, &bytes_recvd, &req_id); | |
| 333 | − | |
| 334 | − switch (ret) { | |
| 335 | − case 0: | |
| 336 | − if (bytes_recvd <= 0) { | |
| 337 | − kfree(buffer); | |
| 338 | − return; | |
| 339 | − } | |
| 340 | − desc = (struct vmpacket_descriptor *)buffer; | |
| 341 | − | |
| 342 | − switch (desc->type) { | |
| 343 | − case VM_PKT_COMP: | |
| 344 | − break; | |
| 345 | − | |
| 346 | − case VM_PKT_DATA_INBAND: | |
| 347 | − mousevsc_on_receive(device, desc); | |
| 348 | − break; | |
| 349 | − | |
| 350 | − default: | |
| 351 | − pr_err("unhandled packet type %d, tid %llx len %d\n", | |
| 352 | − desc->type, req_id, bytes_recvd); | |
| 353 | − break; | |
| 354 | − } | |
| 355 | 319 | |
| 320 | + foreach_vmbus_pkt(desc, device->channel) { | |
| 321 | + switch (desc->type) { | |
| 322 | + case VM_PKT_COMP: | |
| 356 | 323 | break; |
| 357 | 324 | |
| 358 | − case -ENOBUFS: | |
| 359 | − kfree(buffer); | |
| 360 | − /* Handle large packet */ | |
| 361 | − bufferlen = bytes_recvd; | |
| 362 | − buffer = kmalloc(bytes_recvd, GFP_ATOMIC); | |
| 363 | − | |
| 364 | − if (!buffer) | |
| 365 | − return; | |
| 325 | + case VM_PKT_DATA_INBAND: | |
| 326 | + mousevsc_on_receive(device, desc); | |
| 327 | + break; | |
| 366 | 328 | |
| 329 | + default: | |
| 330 | + pr_err("Unhandled packet type %d, tid %llx len %d\n", | |
| 331 | + desc->type, desc->trans_id, desc->len8 * 8); | |
| 367 | 332 | break; |
| 368 | 333 | } |
| 369 | − } while (1); | |
| 370 | − | |
| 334 | + } | |
| 371 | 335 | } |
| 372 | 336 | |
| 373 | 337 | static int mousevsc_connect_to_vsp(struct hv_device *device) |
| @@ -912,6 +912,7 @@ static void vmbus_shutdown(struct device *child_device) · 911 unmodified lines | ||
| 912 | 912 | drv->shutdown(dev); |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | +#ifdef CONFIG_PM_SLEEP | |
| 915 | 916 | /* |
| 916 | 917 | * vmbus_suspend - Suspend a vmbus device |
| 917 | 918 | */ |
| @@ -949,6 +950,7 @@ static int vmbus_resume(struct device *child_device) · 31 unmodified lines | ||
| 949 | 950 | |
| 950 | 951 | return drv->resume(dev); |
| 951 | 952 | } |
| 953 | +#endif /* CONFIG_PM_SLEEP */ | |
| 952 | 954 | |
| 953 | 955 | /* |
| 954 | 956 | * vmbus_device_release - Final callback release of the vmbus child device |
| @@ -1070,6 +1072,7 @@ msg_handled: · 115 unmodified lines | ||
| 1070 | 1072 | vmbus_signal_eom(msg, message_type); |
| 1071 | 1073 | } |
| 1072 | 1074 | |
| 1075 | +#ifdef CONFIG_PM_SLEEP | |
| 1073 | 1076 | /* |
| 1074 | 1077 | * Fake RESCIND_CHANNEL messages to clean up hv_sock channels by force for |
| 1075 | 1078 | * hibernation, because hv_sock connections can not persist across hibernation. |
| @@ -1105,6 +1108,7 @@ static void vmbus_force_channel_rescinded(struct vmbus_channel *channel) · 29 unmodified lines | ||
| 1105 | 1108 | vmbus_connection.work_queue, |
| 1106 | 1109 | &ctx->work); |
| 1107 | 1110 | } |
| 1111 | +#endif /* CONFIG_PM_SLEEP */ | |
| 1108 | 1112 | |
| 1109 | 1113 | /* |
| 1110 | 1114 | * Direct callback for channels using other deferred processing |
| @@ -2125,6 +2129,7 @@ acpi_walk_err: · 1014 unmodified lines | ||
| 2125 | 2129 | return ret_val; |
| 2126 | 2130 | } |
| 2127 | 2131 | |
| 2132 | +#ifdef CONFIG_PM_SLEEP | |
| 2128 | 2133 | static int vmbus_bus_suspend(struct device *dev) |
| 2129 | 2134 | { |
| 2130 | 2135 | struct vmbus_channel *channel, *sc; |
| @@ -2247,6 +2252,7 @@ static int vmbus_bus_resume(struct device *dev) · 116 unmodified lines | ||
| 2247 | 2252 | |
| 2248 | 2253 | return 0; |
| 2249 | 2254 | } |
| 2255 | +#endif /* CONFIG_PM_SLEEP */ | |
| 2250 | 2256 | |
| 2251 | 2257 | static const struct acpi_device_id vmbus_acpi_device_ids[] = { |
| 2252 | 2258 | {"VMBUS", 0}, |
| @@ -99,6 +99,8 @@ struct nct7904_data { · 98 unmodified lines | ||
| 99 | 99 | u8 enable_dts; |
| 100 | 100 | u8 has_dts; |
| 101 | 101 | u8 temp_mode; /* 0: TR mode, 1: TD mode */ |
| 102 | + u8 fan_alarm[2]; | |
| 103 | + u8 vsen_alarm[3]; | |
| 102 | 104 | }; |
| 103 | 105 | |
| 104 | 106 | /* Access functions */ |
| @@ -214,7 +216,15 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel, · 109 unmodified lines | ||
| 214 | 216 | SMI_STS5_REG + (channel >> 3)); |
| 215 | 217 | if (ret < 0) |
| 216 | 218 | return ret; |
| 217 | − *val = (ret >> (channel & 0x07)) & 1; | |
| 219 | + if (!data->fan_alarm[channel >> 3]) | |
| 220 | + data->fan_alarm[channel >> 3] = ret & 0xff; | |
| 221 | + else | |
| 222 | + /* If there is new alarm showing up */ | |
| 223 | + data->fan_alarm[channel >> 3] |= (ret & 0xff); | |
| 224 | + *val = (data->fan_alarm[channel >> 3] >> (channel & 0x07)) & 1; | |
| 225 | + /* Needs to clean the alarm if alarm existing */ | |
| 226 | + if (*val) | |
| 227 | + data->fan_alarm[channel >> 3] ^= 1 << (channel & 0x07); | |
| 218 | 228 | return 0; |
| 219 | 229 | default: |
| 220 | 230 | return -EOPNOTSUPP; |
| @@ -298,7 +308,15 @@ static int nct7904_read_in(struct device *dev, u32 attr, int channel, · 77 unmodified lines | ||
| 298 | 308 | SMI_STS1_REG + (index >> 3)); |
| 299 | 309 | if (ret < 0) |
| 300 | 310 | return ret; |
| 301 | − *val = (ret >> (index & 0x07)) & 1; | |
| 311 | + if (!data->vsen_alarm[index >> 3]) | |
| 312 | + data->vsen_alarm[index >> 3] = ret & 0xff; | |
| 313 | + else | |
| 314 | + /* If there is new alarm showing up */ | |
| 315 | + data->vsen_alarm[index >> 3] |= (ret & 0xff); | |
| 316 | + *val = (data->vsen_alarm[index >> 3] >> (index & 0x07)) & 1; | |
| 317 | + /* Needs to clean the alarm if alarm existing */ | |
| 318 | + if (*val) | |
| 319 | + data->vsen_alarm[index >> 3] ^= 1 << (index & 0x07); | |
| 302 | 320 | return 0; |
| 303 | 321 | default: |
| 304 | 322 | return -EOPNOTSUPP; |
| @@ -915,12 +933,15 @@ static int nct7904_probe(struct i2c_client *client, · 610 unmodified lines | ||
| 915 | 933 | |
| 916 | 934 | data->temp_mode = 0; |
| 917 | 935 | for (i = 0; i < 4; i++) { |
| 918 | − val = (ret & (0x03 << i)) >> (i * 2); | |
| 936 | + val = (ret >> (i * 2)) & 0x03; | |
| 919 | 937 | bit = (1 << i); |
| 920 | − if (val == 0) | |
| 938 | + if (val == 0) { | |
| 921 | 939 | data->tcpu_mask &= ~bit; |
| 922 | − else if (val == 0x1 || val == 0x2) | |
| 923 | − data->temp_mode |= bit; | |
| 940 | + } else { | |
| 941 | + if (val == 0x1 || val == 0x2) | |
| 942 | + data->temp_mode |= bit; | |
| 943 | + data->vsen_mask &= ~(0x06 << (i * 2)); | |
| 944 | + } | |
| 924 | 945 | } |
| 925 | 946 | |
| 926 | 947 | /* PECI */ |
| @@ -474,12 +474,17 @@ static int adxl372_configure_fifo(struct adxl372_state *st) · 473 unmodified lines | ||
| 474 | 474 | if (ret < 0) |
| 475 | 475 | return ret; |
| 476 | 476 | |
| 477 | − fifo_samples = st->watermark & 0xFF; | |
| 477 | + /* | |
| 478 | + * watermark stores the number of sets; we need to write the FIFO | |
| 479 | + * registers with the number of samples | |
| 480 | + */ | |
| 481 | + fifo_samples = (st->watermark * st->fifo_set_size); | |
| 478 | 482 | fifo_ctl = ADXL372_FIFO_CTL_FORMAT_MODE(st->fifo_format) | |
| 479 | 483 | ADXL372_FIFO_CTL_MODE_MODE(st->fifo_mode) | |
| 480 | − ADXL372_FIFO_CTL_SAMPLES_MODE(st->watermark); | |
| 484 | + ADXL372_FIFO_CTL_SAMPLES_MODE(fifo_samples); | |
| 481 | 485 | |
| 482 | − ret = regmap_write(st->regmap, ADXL372_FIFO_SAMPLES, fifo_samples); | |
| 486 | + ret = regmap_write(st->regmap, | |
| 487 | + ADXL372_FIFO_SAMPLES, fifo_samples & 0xFF); | |
| 483 | 488 | if (ret < 0) |
| 484 | 489 | return ret; |
| 485 | 490 | |
| @@ -548,8 +553,7 @@ static irqreturn_t adxl372_trigger_handler(int irq, void *p) · 62 unmodified lines | ||
| 548 | 553 | goto err; |
| 549 | 554 | |
| 550 | 555 | /* Each sample is 2 bytes */ |
| 551 | − for (i = 0; i < fifo_entries * sizeof(u16); | |
| 552 | − i += st->fifo_set_size * sizeof(u16)) | |
| 556 | + for (i = 0; i < fifo_entries; i += st->fifo_set_size) | |
| 553 | 557 | iio_push_to_buffers(indio_dev, &st->fifo_buf[i]); |
| 554 | 558 | } |
| 555 | 559 | err: |
| @@ -571,6 +575,14 @@ static int adxl372_setup(struct adxl372_state *st) · 15 unmodified lines | ||
| 571 | 575 | return -ENODEV; |
| 572 | 576 | } |
| 573 | 577 | |
| 578 | + /* | |
| 579 | + * Perform a software reset to make sure the device is in a consistent | |
| 580 | + * state after start up. | |
| 581 | + */ | |
| 582 | + ret = regmap_write(st->regmap, ADXL372_RESET, ADXL372_RESET_CODE); | |
| 583 | + if (ret < 0) | |
| 584 | + return ret; | |
| 585 | + | |
| 574 | 586 | ret = adxl372_set_op_mode(st, ADXL372_STANDBY); |
| 575 | 587 | if (ret < 0) |
| 576 | 588 | return ret; |
| @@ -117,7 +117,7 @@ · 116 unmodified lines | ||
| 117 | 117 | #define BMC150_ACCEL_SLEEP_1_SEC 0x0F |
| 118 | 118 | |
| 119 | 119 | #define BMC150_ACCEL_REG_TEMP 0x08 |
| 120 | −#define BMC150_ACCEL_TEMP_CENTER_VAL 24 | |
| 120 | +#define BMC150_ACCEL_TEMP_CENTER_VAL 23 | |
| 121 | 121 | |
| 122 | 122 | #define BMC150_ACCEL_AXIS_TO_REG(axis) (BMC150_ACCEL_REG_XOUT_L + (axis * 2)) |
| 123 | 123 | #define BMC150_AUTO_SUSPEND_DELAY_MS 2000 |
| @@ -810,10 +810,10 @@ static int ad799x_probe(struct i2c_client *client, · 809 unmodified lines | ||
| 810 | 810 | |
| 811 | 811 | ret = ad799x_write_config(st, st->chip_config->default_config); |
| 812 | 812 | if (ret < 0) |
| 813 | − goto error_disable_reg; | |
| 813 | + goto error_disable_vref; | |
| 814 | 814 | ret = ad799x_read_config(st); |
| 815 | 815 | if (ret < 0) |
| 816 | − goto error_disable_reg; | |
| 816 | + goto error_disable_vref; | |
| 817 | 817 | st->config = ret; |
| 818 | 818 | |
| 819 | 819 | ret = iio_triggered_buffer_setup(indio_dev, NULL, |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | +#include <linux/dmi.h> | |
| 10 | 11 | #include <linux/module.h> |
| 11 | 12 | #include <linux/kernel.h> |
| 12 | 13 | #include <linux/device.h> |
| @@ -25,6 +26,11 @@ · 12 unmodified lines | ||
| 25 | 26 | #define AXP288_ADC_EN_MASK 0xF0 |
| 26 | 27 | #define AXP288_ADC_TS_ENABLE 0x01 |
| 27 | 28 | |
| 29 | +#define AXP288_ADC_TS_BIAS_MASK GENMASK(5, 4) | |
| 30 | +#define AXP288_ADC_TS_BIAS_20UA (0 << 4) | |
| 31 | +#define AXP288_ADC_TS_BIAS_40UA (1 << 4) | |
| 32 | +#define AXP288_ADC_TS_BIAS_60UA (2 << 4) | |
| 33 | +#define AXP288_ADC_TS_BIAS_80UA (3 << 4) | |
| 28 | 34 | #define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0) |
| 29 | 35 | #define AXP288_ADC_TS_CURRENT_OFF (0 << 0) |
| 30 | 36 | #define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0) |
| @@ -177,10 +183,36 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, · 146 unmodified lines | ||
| 177 | 183 | return ret; |
| 178 | 184 | } |
| 179 | 185 | |
| 186 | +/* | |
| 187 | + * We rely on the machine's firmware to correctly setup the TS pin bias current | |
| 188 | + * at boot. This lists systems with broken fw where we need to set it ourselves. | |
| 189 | + */ | |
| 190 | +static const struct dmi_system_id axp288_adc_ts_bias_override[] = { | |
| 191 | + { | |
| 192 | + /* Lenovo Ideapad 100S (11 inch) */ | |
| 193 | + .matches = { | |
| 194 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 195 | + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad 100S-11IBY"), | |
| 196 | + }, | |
| 197 | + .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA, | |
| 198 | + }, | |
| 199 | + {} | |
| 200 | +}; | |
| 201 | + | |
| 180 | 202 | static int axp288_adc_initialize(struct axp288_adc_info *info) |
| 181 | 203 | { |
| 204 | + const struct dmi_system_id *bias_override; | |
| 182 | 205 | int ret, adc_enable_val; |
| 183 | 206 | |
| 207 | + bias_override = dmi_first_match(axp288_adc_ts_bias_override); | |
| 208 | + if (bias_override) { | |
| 209 | + ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, | |
| 210 | + AXP288_ADC_TS_BIAS_MASK, | |
| 211 | + (uintptr_t)bias_override->driver_data); | |
| 212 | + if (ret) | |
| 213 | + return ret; | |
| 214 | + } | |
| 215 | + | |
| 184 | 216 | /* |
| 185 | 217 | * Determine if the TS pin is enabled and set the TS current-source |
| 186 | 218 | * accordingly. |
| @@ -100,14 +100,14 @@ struct hx711_data { · 99 unmodified lines | ||
| 100 | 100 | |
| 101 | 101 | static int hx711_cycle(struct hx711_data *hx711_data) |
| 102 | 102 | { |
| 103 | − int val; | |
| 103 | + unsigned long flags; | |
| 104 | 104 | |
| 105 | 105 | /* |
| 106 | 106 | * if preempted for more then 60us while PD_SCK is high: |
| 107 | 107 | * hx711 is going in reset |
| 108 | 108 | * ==> measuring is false |
| 109 | 109 | */ |
| 110 | − preempt_disable(); | |
| 110 | + local_irq_save(flags); | |
| 111 | 111 | gpiod_set_value(hx711_data->gpiod_pd_sck, 1); |
| 112 | 112 | |
| 113 | 113 | /* |
| @@ -117,7 +117,6 @@ static int hx711_cycle(struct hx711_data *hx711_data) · 3 unmodified lines | ||
| 117 | 117 | */ |
| 118 | 118 | ndelay(hx711_data->data_ready_delay_ns); |
| 119 | 119 | |
| 120 | − val = gpiod_get_value(hx711_data->gpiod_dout); | |
| 121 | 120 | /* |
| 122 | 121 | * here we are not waiting for 0.2 us as suggested by the datasheet, |
| 123 | 122 | * because the oscilloscope showed in a test scenario |
| @@ -125,7 +124,7 @@ static int hx711_cycle(struct hx711_data *hx711_data) · 1 unmodified line | ||
| 125 | 124 | * and 0.56 us for PD_SCK low on TI Sitara with 800 MHz |
| 126 | 125 | */ |
| 127 | 126 | gpiod_set_value(hx711_data->gpiod_pd_sck, 0); |
| 128 | − preempt_enable(); | |
| 127 | + local_irq_restore(flags); | |
| 129 | 128 | |
| 130 | 129 | /* |
| 131 | 130 | * make it a square wave for addressing cases with capacitance on |
| @@ -133,7 +132,8 @@ static int hx711_cycle(struct hx711_data *hx711_data) · 1 unmodified line | ||
| 133 | 132 | */ |
| 134 | 133 | ndelay(hx711_data->data_ready_delay_ns); |
| 135 | 134 | |
| 136 | − return val; | |
| 135 | + /* sample as late as possible */ | |
| 136 | + return gpiod_get_value(hx711_data->gpiod_dout); | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | static int hx711_read(struct hx711_data *hx711_data) |
| @@ -1219,6 +1219,11 @@ static int meson_sar_adc_probe(struct platform_device *pdev) · 1218 unmodified lines | ||
| 1219 | 1219 | if (IS_ERR(base)) |
| 1220 | 1220 | return PTR_ERR(base); |
| 1221 | 1221 | |
| 1222 | + priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, | |
| 1223 | + priv->param->regmap_config); | |
| 1224 | + if (IS_ERR(priv->regmap)) | |
| 1225 | + return PTR_ERR(priv->regmap); | |
| 1226 | + | |
| 1222 | 1227 | irq = irq_of_parse_and_map(pdev->dev.of_node, 0); |
| 1223 | 1228 | if (!irq) |
| 1224 | 1229 | return -EINVAL; |
| @@ -1228,11 +1233,6 @@ static int meson_sar_adc_probe(struct platform_device *pdev) · 3 unmodified lines | ||
| 1228 | 1233 | if (ret) |
| 1229 | 1234 | return ret; |
| 1230 | 1235 | |
| 1231 | − priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, | |
| 1232 | − priv->param->regmap_config); | |
| 1233 | − if (IS_ERR(priv->regmap)) | |
| 1234 | − return PTR_ERR(priv->regmap); | |
| 1235 | − | |
| 1236 | 1236 | priv->clkin = devm_clk_get(&pdev->dev, "clkin"); |
| 1237 | 1237 | if (IS_ERR(priv->clkin)) { |
| 1238 | 1238 | dev_err(&pdev->dev, "failed to get clkin\n"); |
| @@ -24,33 +24,6 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | #include "stm32-adc-core.h" |
| 26 | 26 | |
| 27 | −/* STM32F4 - common registers for all ADC instances: 1, 2 & 3 */ | |
| 28 | −#define STM32F4_ADC_CSR (STM32_ADCX_COMN_OFFSET + 0x00) | |
| 29 | −#define STM32F4_ADC_CCR (STM32_ADCX_COMN_OFFSET + 0x04) | |
| 30 | − | |
| 31 | −/* STM32F4_ADC_CSR - bit fields */ | |
| 32 | −#define STM32F4_EOC3 BIT(17) | |
| 33 | −#define STM32F4_EOC2 BIT(9) | |
| 34 | −#define STM32F4_EOC1 BIT(1) | |
| 35 | − | |
| 36 | −/* STM32F4_ADC_CCR - bit fields */ | |
| 37 | −#define STM32F4_ADC_ADCPRE_SHIFT 16 | |
| 38 | −#define STM32F4_ADC_ADCPRE_MASK GENMASK(17, 16) | |
| 39 | − | |
| 40 | −/* STM32H7 - common registers for all ADC instances */ | |
| 41 | −#define STM32H7_ADC_CSR (STM32_ADCX_COMN_OFFSET + 0x00) | |
| 42 | −#define STM32H7_ADC_CCR (STM32_ADCX_COMN_OFFSET + 0x08) | |
| 43 | − | |
| 44 | −/* STM32H7_ADC_CSR - bit fields */ | |
| 45 | −#define STM32H7_EOC_SLV BIT(18) | |
| 46 | −#define STM32H7_EOC_MST BIT(2) | |
| 47 | − | |
| 48 | −/* STM32H7_ADC_CCR - bit fields */ | |
| 49 | −#define STM32H7_PRESC_SHIFT 18 | |
| 50 | −#define STM32H7_PRESC_MASK GENMASK(21, 18) | |
| 51 | −#define STM32H7_CKMODE_SHIFT 16 | |
| 52 | −#define STM32H7_CKMODE_MASK GENMASK(17, 16) | |
| 53 | − | |
| 54 | 27 | #define STM32_ADC_CORE_SLEEP_DELAY_MS 2000 |
| 55 | 28 | |
| 56 | 29 | /* SYSCFG registers */ |
| @@ -71,6 +44,8 @@ · 14 unmodified lines | ||
| 71 | 44 | * @eoc1: adc1 end of conversion flag in @csr |
| 72 | 45 | * @eoc2: adc2 end of conversion flag in @csr |
| 73 | 46 | * @eoc3: adc3 end of conversion flag in @csr |
| 47 | + * @ier: interrupt enable register offset for each adc | |
| 48 | + * @eocie_msk: end of conversion interrupt enable mask in @ier | |
| 74 | 49 | */ |
| 75 | 50 | struct stm32_adc_common_regs { |
| 76 | 51 | u32 csr; |
| @@ -78,6 +53,8 @@ struct stm32_adc_common_regs { · 1 unmodified line | ||
| 78 | 53 | u32 eoc1_msk; |
| 79 | 54 | u32 eoc2_msk; |
| 80 | 55 | u32 eoc3_msk; |
| 56 | + u32 ier; | |
| 57 | + u32 eocie_msk; | |
| 81 | 58 | }; |
| 82 | 59 | |
| 83 | 60 | struct stm32_adc_priv; |
| @@ -303,6 +280,8 @@ static const struct stm32_adc_common_regs stm32f4_adc_common_regs = { · 219 unmodified lines | ||
| 303 | 280 | .eoc1_msk = STM32F4_EOC1, |
| 304 | 281 | .eoc2_msk = STM32F4_EOC2, |
| 305 | 282 | .eoc3_msk = STM32F4_EOC3, |
| 283 | + .ier = STM32F4_ADC_CR1, | |
| 284 | + .eocie_msk = STM32F4_EOCIE, | |
| 306 | 285 | }; |
| 307 | 286 | |
| 308 | 287 | /* STM32H7 common registers definitions */ |
| @@ -311,8 +290,24 @@ static const struct stm32_adc_common_regs stm32h7_adc_common_regs = { · 2 unmodified lines | ||
| 311 | 290 | .ccr = STM32H7_ADC_CCR, |
| 312 | 291 | .eoc1_msk = STM32H7_EOC_MST, |
| 313 | 292 | .eoc2_msk = STM32H7_EOC_SLV, |
| 293 | + .ier = STM32H7_ADC_IER, | |
| 294 | + .eocie_msk = STM32H7_EOCIE, | |
| 295 | +}; | |
| 296 | + | |
| 297 | +static const unsigned int stm32_adc_offset[STM32_ADC_MAX_ADCS] = { | |
| 298 | + 0, STM32_ADC_OFFSET, STM32_ADC_OFFSET * 2, | |
| 314 | 299 | }; |
| 315 | 300 | |
| 301 | +static unsigned int stm32_adc_eoc_enabled(struct stm32_adc_priv *priv, | |
| 302 | + unsigned int adc) | |
| 303 | +{ | |
| 304 | + u32 ier, offset = stm32_adc_offset[adc]; | |
| 305 | + | |
| 306 | + ier = readl_relaxed(priv->common.base + offset + priv->cfg->regs->ier); | |
| 307 | + | |
| 308 | + return ier & priv->cfg->regs->eocie_msk; | |
| 309 | +} | |
| 310 | + | |
| 316 | 311 | /* ADC common interrupt for all instances */ |
| 317 | 312 | static void stm32_adc_irq_handler(struct irq_desc *desc) |
| 318 | 313 | { |
| @@ -323,13 +318,28 @@ static void stm32_adc_irq_handler(struct irq_desc *desc) · 4 unmodified lines | ||
| 323 | 318 | chained_irq_enter(chip, desc); |
| 324 | 319 | status = readl_relaxed(priv->common.base + priv->cfg->regs->csr); |
| 325 | 320 | |
| 326 | − if (status & priv->cfg->regs->eoc1_msk) | |
| 321 | + /* | |
| 322 | + * End of conversion may be handled by using IRQ or DMA. There may be a | |
| 323 | + * race here when two conversions complete at the same time on several | |
| 324 | + * ADCs. EOC may be read 'set' for several ADCs, with: | |
| 325 | + * - an ADC configured to use DMA (EOC triggers the DMA request, and | |
| 326 | + * is then automatically cleared by DR read in hardware) | |
| 327 | + * - an ADC configured to use IRQs (EOCIE bit is set. The handler must | |
| 328 | + * be called in this case) | |
| 329 | + * So both EOC status bit in CSR and EOCIE control bit must be checked | |
| 330 | + * before invoking the interrupt handler (e.g. call ISR only for | |
| 331 | + * IRQ-enabled ADCs). | |
| 332 | + */ | |
| 333 | + if (status & priv->cfg->regs->eoc1_msk && | |
| 334 | + stm32_adc_eoc_enabled(priv, 0)) | |
| 327 | 335 | generic_handle_irq(irq_find_mapping(priv->domain, 0)); |
| 328 | 336 | |
| 329 | − if (status & priv->cfg->regs->eoc2_msk) | |
| 337 | + if (status & priv->cfg->regs->eoc2_msk && | |
| 338 | + stm32_adc_eoc_enabled(priv, 1)) | |
| 330 | 339 | generic_handle_irq(irq_find_mapping(priv->domain, 1)); |
| 331 | 340 | |
| 332 | − if (status & priv->cfg->regs->eoc3_msk) | |
| 341 | + if (status & priv->cfg->regs->eoc3_msk && | |
| 342 | + stm32_adc_eoc_enabled(priv, 2)) | |
| 333 | 343 | generic_handle_irq(irq_find_mapping(priv->domain, 2)); |
| 334 | 344 | |
| 335 | 345 | chained_irq_exit(chip, desc); |
| @@ -25,8 +25,145 @@ · 24 unmodified lines | ||
| 25 | 25 | * -------------------------------------------------------- |
| 26 | 26 | */ |
| 27 | 27 | #define STM32_ADC_MAX_ADCS 3 |
| 28 | +#define STM32_ADC_OFFSET 0x100 | |
| 28 | 29 | #define STM32_ADCX_COMN_OFFSET 0x300 |
| 29 | 30 | |
| 31 | +/* STM32F4 - Registers for each ADC instance */ | |
| 32 | +#define STM32F4_ADC_SR 0x00 | |
| 33 | +#define STM32F4_ADC_CR1 0x04 | |
| 34 | +#define STM32F4_ADC_CR2 0x08 | |
| 35 | +#define STM32F4_ADC_SMPR1 0x0C | |
| 36 | +#define STM32F4_ADC_SMPR2 0x10 | |
| 37 | +#define STM32F4_ADC_HTR 0x24 | |
| 38 | +#define STM32F4_ADC_LTR 0x28 | |
| 39 | +#define STM32F4_ADC_SQR1 0x2C | |
| 40 | +#define STM32F4_ADC_SQR2 0x30 | |
| 41 | +#define STM32F4_ADC_SQR3 0x34 | |
| 42 | +#define STM32F4_ADC_JSQR 0x38 | |
| 43 | +#define STM32F4_ADC_JDR1 0x3C | |
| 44 | +#define STM32F4_ADC_JDR2 0x40 | |
| 45 | +#define STM32F4_ADC_JDR3 0x44 | |
| 46 | +#define STM32F4_ADC_JDR4 0x48 | |
| 47 | +#define STM32F4_ADC_DR 0x4C | |
| 48 | + | |
| 49 | +/* STM32F4 - common registers for all ADC instances: 1, 2 & 3 */ | |
| 50 | +#define STM32F4_ADC_CSR (STM32_ADCX_COMN_OFFSET + 0x00) | |
| 51 | +#define STM32F4_ADC_CCR (STM32_ADCX_COMN_OFFSET + 0x04) | |
| 52 | + | |
| 53 | +/* STM32F4_ADC_SR - bit fields */ | |
| 54 | +#define STM32F4_STRT BIT(4) | |
| 55 | +#define STM32F4_EOC BIT(1) | |
| 56 | + | |
| 57 | +/* STM32F4_ADC_CR1 - bit fields */ | |
| 58 | +#define STM32F4_RES_SHIFT 24 | |
| 59 | +#define STM32F4_RES_MASK GENMASK(25, 24) | |
| 60 | +#define STM32F4_SCAN BIT(8) | |
| 61 | +#define STM32F4_EOCIE BIT(5) | |
| 62 | + | |
| 63 | +/* STM32F4_ADC_CR2 - bit fields */ | |
| 64 | +#define STM32F4_SWSTART BIT(30) | |
| 65 | +#define STM32F4_EXTEN_SHIFT 28 | |
| 66 | +#define STM32F4_EXTEN_MASK GENMASK(29, 28) | |
| 67 | +#define STM32F4_EXTSEL_SHIFT 24 | |
| 68 | +#define STM32F4_EXTSEL_MASK GENMASK(27, 24) | |
| 69 | +#define STM32F4_EOCS BIT(10) | |
| 70 | +#define STM32F4_DDS BIT(9) | |
| 71 | +#define STM32F4_DMA BIT(8) | |
| 72 | +#define STM32F4_ADON BIT(0) | |
| 73 | + | |
| 74 | +/* STM32F4_ADC_CSR - bit fields */ | |
| 75 | +#define STM32F4_EOC3 BIT(17) | |
| 76 | +#define STM32F4_EOC2 BIT(9) | |
| 77 | +#define STM32F4_EOC1 BIT(1) | |
| 78 | + | |
| 79 | +/* STM32F4_ADC_CCR - bit fields */ | |
| 80 | +#define STM32F4_ADC_ADCPRE_SHIFT 16 | |
| 81 | +#define STM32F4_ADC_ADCPRE_MASK GENMASK(17, 16) | |
| 82 | + | |
| 83 | +/* STM32H7 - Registers for each ADC instance */ | |
| 84 | +#define STM32H7_ADC_ISR 0x00 | |
| 85 | +#define STM32H7_ADC_IER 0x04 | |
| 86 | +#define STM32H7_ADC_CR 0x08 | |
| 87 | +#define STM32H7_ADC_CFGR 0x0C | |
| 88 | +#define STM32H7_ADC_SMPR1 0x14 | |
| 89 | +#define STM32H7_ADC_SMPR2 0x18 | |
| 90 | +#define STM32H7_ADC_PCSEL 0x1C | |
| 91 | +#define STM32H7_ADC_SQR1 0x30 | |
| 92 | +#define STM32H7_ADC_SQR2 0x34 | |
| 93 | +#define STM32H7_ADC_SQR3 0x38 | |
| 94 | +#define STM32H7_ADC_SQR4 0x3C | |
| 95 | +#define STM32H7_ADC_DR 0x40 | |
| 96 | +#define STM32H7_ADC_DIFSEL 0xC0 | |
| 97 | +#define STM32H7_ADC_CALFACT 0xC4 | |
| 98 | +#define STM32H7_ADC_CALFACT2 0xC8 | |
| 99 | + | |
| 100 | +/* STM32H7 - common registers for all ADC instances */ | |
| 101 | +#define STM32H7_ADC_CSR (STM32_ADCX_COMN_OFFSET + 0x00) | |
| 102 | +#define STM32H7_ADC_CCR (STM32_ADCX_COMN_OFFSET + 0x08) | |
| 103 | + | |
| 104 | +/* STM32H7_ADC_ISR - bit fields */ | |
| 105 | +#define STM32MP1_VREGREADY BIT(12) | |
| 106 | +#define STM32H7_EOC BIT(2) | |
| 107 | +#define STM32H7_ADRDY BIT(0) | |
| 108 | + | |
| 109 | +/* STM32H7_ADC_IER - bit fields */ | |
| 110 | +#define STM32H7_EOCIE STM32H7_EOC | |
| 111 | + | |
| 112 | +/* STM32H7_ADC_CR - bit fields */ | |
| 113 | +#define STM32H7_ADCAL BIT(31) | |
| 114 | +#define STM32H7_ADCALDIF BIT(30) | |
| 115 | +#define STM32H7_DEEPPWD BIT(29) | |
| 116 | +#define STM32H7_ADVREGEN BIT(28) | |
| 117 | +#define STM32H7_LINCALRDYW6 BIT(27) | |
| 118 | +#define STM32H7_LINCALRDYW5 BIT(26) | |
| 119 | +#define STM32H7_LINCALRDYW4 BIT(25) | |
| 120 | +#define STM32H7_LINCALRDYW3 BIT(24) | |
| 121 | +#define STM32H7_LINCALRDYW2 BIT(23) | |
| 122 | +#define STM32H7_LINCALRDYW1 BIT(22) | |
| 123 | +#define STM32H7_ADCALLIN BIT(16) | |
| 124 | +#define STM32H7_BOOST BIT(8) | |
| 125 | +#define STM32H7_ADSTP BIT(4) | |
| 126 | +#define STM32H7_ADSTART BIT(2) | |
| 127 | +#define STM32H7_ADDIS BIT(1) | |
| 128 | +#define STM32H7_ADEN BIT(0) | |
| 129 | + | |
| 130 | +/* STM32H7_ADC_CFGR bit fields */ | |
| 131 | +#define STM32H7_EXTEN_SHIFT 10 | |
| 132 | +#define STM32H7_EXTEN_MASK GENMASK(11, 10) | |
| 133 | +#define STM32H7_EXTSEL_SHIFT 5 | |
| 134 | +#define STM32H7_EXTSEL_MASK GENMASK(9, 5) | |
| 135 | +#define STM32H7_RES_SHIFT 2 | |
| 136 | +#define STM32H7_RES_MASK GENMASK(4, 2) | |
| 137 | +#define STM32H7_DMNGT_SHIFT 0 | |
| 138 | +#define STM32H7_DMNGT_MASK GENMASK(1, 0) | |
| 139 | + | |
| 140 | +enum stm32h7_adc_dmngt { | |
| 141 | + STM32H7_DMNGT_DR_ONLY, /* Regular data in DR only */ | |
| 142 | + STM32H7_DMNGT_DMA_ONESHOT, /* DMA one shot mode */ | |
| 143 | + STM32H7_DMNGT_DFSDM, /* DFSDM mode */ | |
| 144 | + STM32H7_DMNGT_DMA_CIRC, /* DMA circular mode */ | |
| 145 | +}; | |
| 146 | + | |
| 147 | +/* STM32H7_ADC_CALFACT - bit fields */ | |
| 148 | +#define STM32H7_CALFACT_D_SHIFT 16 | |
| 149 | +#define STM32H7_CALFACT_D_MASK GENMASK(26, 16) | |
| 150 | +#define STM32H7_CALFACT_S_SHIFT 0 | |
| 151 | +#define STM32H7_CALFACT_S_MASK GENMASK(10, 0) | |
| 152 | + | |
| 153 | +/* STM32H7_ADC_CALFACT2 - bit fields */ | |
| 154 | +#define STM32H7_LINCALFACT_SHIFT 0 | |
| 155 | +#define STM32H7_LINCALFACT_MASK GENMASK(29, 0) | |
| 156 | + | |
| 157 | +/* STM32H7_ADC_CSR - bit fields */ | |
| 158 | +#define STM32H7_EOC_SLV BIT(18) | |
| 159 | +#define STM32H7_EOC_MST BIT(2) | |
| 160 | + | |
| 161 | +/* STM32H7_ADC_CCR - bit fields */ | |
| 162 | +#define STM32H7_PRESC_SHIFT 18 | |
| 163 | +#define STM32H7_PRESC_MASK GENMASK(21, 18) | |
| 164 | +#define STM32H7_CKMODE_SHIFT 16 | |
| 165 | +#define STM32H7_CKMODE_MASK GENMASK(17, 16) | |
| 166 | + | |
| 30 | 167 | /** |
| 31 | 168 | * struct stm32_adc_common - stm32 ADC driver common data (for all instances) |
| 32 | 169 | * @base: control registers base cpu addr |
| @@ -28,115 +28,6 @@ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #include "stm32-adc-core.h" |
| 30 | 30 | |
| 31 | −/* STM32F4 - Registers for each ADC instance */ | |
| 32 | −#define STM32F4_ADC_SR 0x00 | |
| 33 | −#define STM32F4_ADC_CR1 0x04 | |
| 34 | −#define STM32F4_ADC_CR2 0x08 | |
| 35 | −#define STM32F4_ADC_SMPR1 0x0C | |
| 36 | −#define STM32F4_ADC_SMPR2 0x10 | |
| 37 | −#define STM32F4_ADC_HTR 0x24 | |
| 38 | −#define STM32F4_ADC_LTR 0x28 | |
| 39 | −#define STM32F4_ADC_SQR1 0x2C | |
| 40 | −#define STM32F4_ADC_SQR2 0x30 | |
| 41 | −#define STM32F4_ADC_SQR3 0x34 | |
| 42 | −#define STM32F4_ADC_JSQR 0x38 | |
| 43 | −#define STM32F4_ADC_JDR1 0x3C | |
| 44 | −#define STM32F4_ADC_JDR2 0x40 | |
| 45 | −#define STM32F4_ADC_JDR3 0x44 | |
| 46 | −#define STM32F4_ADC_JDR4 0x48 | |
| 47 | −#define STM32F4_ADC_DR 0x4C | |
| 48 | − | |
| 49 | −/* STM32F4_ADC_SR - bit fields */ | |
| 50 | −#define STM32F4_STRT BIT(4) | |
| 51 | −#define STM32F4_EOC BIT(1) | |
| 52 | − | |
| 53 | −/* STM32F4_ADC_CR1 - bit fields */ | |
| 54 | −#define STM32F4_RES_SHIFT 24 | |
| 55 | −#define STM32F4_RES_MASK GENMASK(25, 24) | |
| 56 | −#define STM32F4_SCAN BIT(8) | |
| 57 | −#define STM32F4_EOCIE BIT(5) | |
| 58 | − | |
| 59 | −/* STM32F4_ADC_CR2 - bit fields */ | |
| 60 | −#define STM32F4_SWSTART BIT(30) | |
| 61 | −#define STM32F4_EXTEN_SHIFT 28 | |
| 62 | −#define STM32F4_EXTEN_MASK GENMASK(29, 28) | |
| 63 | −#define STM32F4_EXTSEL_SHIFT 24 | |
| 64 | −#define STM32F4_EXTSEL_MASK GENMASK(27, 24) | |
| 65 | −#define STM32F4_EOCS BIT(10) | |
| 66 | −#define STM32F4_DDS BIT(9) | |
| 67 | −#define STM32F4_DMA BIT(8) | |
| 68 | −#define STM32F4_ADON BIT(0) | |
| 69 | − | |
| 70 | −/* STM32H7 - Registers for each ADC instance */ | |
| 71 | −#define STM32H7_ADC_ISR 0x00 | |
| 72 | −#define STM32H7_ADC_IER 0x04 | |
| 73 | −#define STM32H7_ADC_CR 0x08 | |
| 74 | −#define STM32H7_ADC_CFGR 0x0C | |
| 75 | −#define STM32H7_ADC_SMPR1 0x14 | |
| 76 | −#define STM32H7_ADC_SMPR2 0x18 | |
| 77 | −#define STM32H7_ADC_PCSEL 0x1C | |
| 78 | −#define STM32H7_ADC_SQR1 0x30 | |
| 79 | −#define STM32H7_ADC_SQR2 0x34 | |
| 80 | −#define STM32H7_ADC_SQR3 0x38 | |
| 81 | −#define STM32H7_ADC_SQR4 0x3C | |
| 82 | −#define STM32H7_ADC_DR 0x40 | |
| 83 | −#define STM32H7_ADC_DIFSEL 0xC0 | |
| 84 | −#define STM32H7_ADC_CALFACT 0xC4 | |
| 85 | −#define STM32H7_ADC_CALFACT2 0xC8 | |
| 86 | − | |
| 87 | −/* STM32H7_ADC_ISR - bit fields */ | |
| 88 | −#define STM32MP1_VREGREADY BIT(12) | |
| 89 | −#define STM32H7_EOC BIT(2) | |
| 90 | −#define STM32H7_ADRDY BIT(0) | |
| 91 | − | |
| 92 | −/* STM32H7_ADC_IER - bit fields */ | |
| 93 | −#define STM32H7_EOCIE STM32H7_EOC | |
| 94 | − | |
| 95 | −/* STM32H7_ADC_CR - bit fields */ | |
| 96 | −#define STM32H7_ADCAL BIT(31) | |
| 97 | −#define STM32H7_ADCALDIF BIT(30) | |
| 98 | −#define STM32H7_DEEPPWD BIT(29) | |
| 99 | −#define STM32H7_ADVREGEN BIT(28) | |
| 100 | −#define STM32H7_LINCALRDYW6 BIT(27) | |
| 101 | −#define STM32H7_LINCALRDYW5 BIT(26) | |
| 102 | −#define STM32H7_LINCALRDYW4 BIT(25) | |
| 103 | −#define STM32H7_LINCALRDYW3 BIT(24) | |
| 104 | −#define STM32H7_LINCALRDYW2 BIT(23) | |
| 105 | −#define STM32H7_LINCALRDYW1 BIT(22) | |
| 106 | −#define STM32H7_ADCALLIN BIT(16) | |
| 107 | −#define STM32H7_BOOST BIT(8) | |
| 108 | −#define STM32H7_ADSTP BIT(4) | |
| 109 | −#define STM32H7_ADSTART BIT(2) | |
| 110 | −#define STM32H7_ADDIS BIT(1) | |
| 111 | −#define STM32H7_ADEN BIT(0) | |
| 112 | − | |
| 113 | −/* STM32H7_ADC_CFGR bit fields */ | |
| 114 | −#define STM32H7_EXTEN_SHIFT 10 | |
| 115 | −#define STM32H7_EXTEN_MASK GENMASK(11, 10) | |
| 116 | −#define STM32H7_EXTSEL_SHIFT 5 | |
| 117 | −#define STM32H7_EXTSEL_MASK GENMASK(9, 5) | |
| 118 | −#define STM32H7_RES_SHIFT 2 | |
| 119 | −#define STM32H7_RES_MASK GENMASK(4, 2) | |
| 120 | −#define STM32H7_DMNGT_SHIFT 0 | |
| 121 | −#define STM32H7_DMNGT_MASK GENMASK(1, 0) | |
| 122 | − | |
| 123 | −enum stm32h7_adc_dmngt { | |
| 124 | − STM32H7_DMNGT_DR_ONLY, /* Regular data in DR only */ | |
| 125 | − STM32H7_DMNGT_DMA_ONESHOT, /* DMA one shot mode */ | |
| 126 | − STM32H7_DMNGT_DFSDM, /* DFSDM mode */ | |
| 127 | − STM32H7_DMNGT_DMA_CIRC, /* DMA circular mode */ | |
| 128 | −}; | |
| 129 | − | |
| 130 | −/* STM32H7_ADC_CALFACT - bit fields */ | |
| 131 | −#define STM32H7_CALFACT_D_SHIFT 16 | |
| 132 | −#define STM32H7_CALFACT_D_MASK GENMASK(26, 16) | |
| 133 | −#define STM32H7_CALFACT_S_SHIFT 0 | |
| 134 | −#define STM32H7_CALFACT_S_MASK GENMASK(10, 0) | |
| 135 | − | |
| 136 | −/* STM32H7_ADC_CALFACT2 - bit fields */ | |
| 137 | −#define STM32H7_LINCALFACT_SHIFT 0 | |
| 138 | −#define STM32H7_LINCALFACT_MASK GENMASK(29, 0) | |
| 139 | − | |
| 140 | 31 | /* Number of linear calibration shadow registers / LINCALRDYW control bits */ |
| 141 | 32 | #define STM32H7_LINCALFACT_NUM 6 |
| 142 | 33 | |
| @@ -35,8 +35,11 @@ static int adis_update_scan_mode_burst(struct iio_dev *indio_dev, · 34 unmodified lines | ||
| 35 | 35 | return -ENOMEM; |
| 36 | 36 | |
| 37 | 37 | adis->buffer = kzalloc(burst_length + sizeof(u16), GFP_KERNEL); |
| 38 | − if (!adis->buffer) | |
| 38 | + if (!adis->buffer) { | |
| 39 | + kfree(adis->xfer); | |
| 40 | + adis->xfer = NULL; | |
| 39 | 41 | return -ENOMEM; |
| 42 | + } | |
| 40 | 43 | |
| 41 | 44 | tx = adis->buffer + burst_length; |
| 42 | 45 | tx[0] = ADIS_READ_REG(adis->burst->reg_cmd); |
| @@ -78,8 +81,11 @@ int adis_update_scan_mode(struct iio_dev *indio_dev, · 35 unmodified lines | ||
| 78 | 81 | return -ENOMEM; |
| 79 | 82 | |
| 80 | 83 | adis->buffer = kcalloc(indio_dev->scan_bytes, 2, GFP_KERNEL); |
| 81 | − if (!adis->buffer) | |
| 84 | + if (!adis->buffer) { | |
| 85 | + kfree(adis->xfer); | |
| 86 | + adis->xfer = NULL; | |
| 82 | 87 | return -ENOMEM; |
| 88 | + } | |
| 83 | 89 | |
| 84 | 90 | rx = adis->buffer; |
| 85 | 91 | tx = rx + scan_count; |
| @@ -99,7 +99,9 @@ struct st_lsm6dsx_fs { · 98 unmodified lines | ||
| 99 | 99 | #define ST_LSM6DSX_FS_LIST_SIZE 4 |
| 100 | 100 | struct st_lsm6dsx_fs_table_entry { |
| 101 | 101 | struct st_lsm6dsx_reg reg; |
| 102 | + | |
| 102 | 103 | struct st_lsm6dsx_fs fs_avl[ST_LSM6DSX_FS_LIST_SIZE]; |
| 104 | + int fs_len; | |
| 103 | 105 | }; |
| 104 | 106 | |
| 105 | 107 | /** |
| @@ -145,6 +145,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 144 unmodified lines | ||
| 145 | 145 | .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, |
| 146 | 146 | .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, |
| 147 | 147 | .fs_avl[3] = { IIO_G_TO_M_S_2(732), 0x1 }, |
| 148 | + .fs_len = 4, | |
| 148 | 149 | }, |
| 149 | 150 | [ST_LSM6DSX_ID_GYRO] = { |
| 150 | 151 | .reg = { |
| @@ -154,6 +155,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 3 unmodified lines | ||
| 154 | 155 | .fs_avl[0] = { IIO_DEGREE_TO_RAD(245), 0x0 }, |
| 155 | 156 | .fs_avl[1] = { IIO_DEGREE_TO_RAD(500), 0x1 }, |
| 156 | 157 | .fs_avl[2] = { IIO_DEGREE_TO_RAD(2000), 0x3 }, |
| 158 | + .fs_len = 3, | |
| 157 | 159 | }, |
| 158 | 160 | }, |
| 159 | 161 | }, |
| @@ -215,6 +217,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 55 unmodified lines | ||
| 215 | 217 | .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, |
| 216 | 218 | .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, |
| 217 | 219 | .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, |
| 220 | + .fs_len = 4, | |
| 218 | 221 | }, |
| 219 | 222 | [ST_LSM6DSX_ID_GYRO] = { |
| 220 | 223 | .reg = { |
| @@ -225,6 +228,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 4 unmodified lines | ||
| 225 | 228 | .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, |
| 226 | 229 | .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, |
| 227 | 230 | .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, |
| 231 | + .fs_len = 4, | |
| 228 | 232 | }, |
| 229 | 233 | }, |
| 230 | 234 | .decimator = { |
| @@ -327,6 +331,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 96 unmodified lines | ||
| 327 | 331 | .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, |
| 328 | 332 | .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, |
| 329 | 333 | .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, |
| 334 | + .fs_len = 4, | |
| 330 | 335 | }, |
| 331 | 336 | [ST_LSM6DSX_ID_GYRO] = { |
| 332 | 337 | .reg = { |
| @@ -337,6 +342,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 4 unmodified lines | ||
| 337 | 342 | .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, |
| 338 | 343 | .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, |
| 339 | 344 | .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, |
| 345 | + .fs_len = 4, | |
| 340 | 346 | }, |
| 341 | 347 | }, |
| 342 | 348 | .decimator = { |
| @@ -448,6 +454,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 105 unmodified lines | ||
| 448 | 454 | .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, |
| 449 | 455 | .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, |
| 450 | 456 | .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, |
| 457 | + .fs_len = 4, | |
| 451 | 458 | }, |
| 452 | 459 | [ST_LSM6DSX_ID_GYRO] = { |
| 453 | 460 | .reg = { |
| @@ -458,6 +465,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 4 unmodified lines | ||
| 458 | 465 | .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, |
| 459 | 466 | .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, |
| 460 | 467 | .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, |
| 468 | + .fs_len = 4, | |
| 461 | 469 | }, |
| 462 | 470 | }, |
| 463 | 471 | .decimator = { |
| @@ -563,6 +571,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 99 unmodified lines | ||
| 563 | 571 | .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, |
| 564 | 572 | .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, |
| 565 | 573 | .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, |
| 574 | + .fs_len = 4, | |
| 566 | 575 | }, |
| 567 | 576 | [ST_LSM6DSX_ID_GYRO] = { |
| 568 | 577 | .reg = { |
| @@ -573,6 +582,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 4 unmodified lines | ||
| 573 | 582 | .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, |
| 574 | 583 | .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, |
| 575 | 584 | .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, |
| 585 | + .fs_len = 4, | |
| 576 | 586 | }, |
| 577 | 587 | }, |
| 578 | 588 | .batch = { |
| @@ -693,6 +703,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 114 unmodified lines | ||
| 693 | 703 | .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, |
| 694 | 704 | .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, |
| 695 | 705 | .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, |
| 706 | + .fs_len = 4, | |
| 696 | 707 | }, |
| 697 | 708 | [ST_LSM6DSX_ID_GYRO] = { |
| 698 | 709 | .reg = { |
| @@ -703,6 +714,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 4 unmodified lines | ||
| 703 | 714 | .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, |
| 704 | 715 | .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, |
| 705 | 716 | .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, |
| 717 | + .fs_len = 4, | |
| 706 | 718 | }, |
| 707 | 719 | }, |
| 708 | 720 | .batch = { |
| @@ -800,6 +812,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 91 unmodified lines | ||
| 800 | 812 | .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, |
| 801 | 813 | .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, |
| 802 | 814 | .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, |
| 815 | + .fs_len = 4, | |
| 803 | 816 | }, |
| 804 | 817 | [ST_LSM6DSX_ID_GYRO] = { |
| 805 | 818 | .reg = { |
| @@ -810,6 +823,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { · 4 unmodified lines | ||
| 810 | 823 | .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, |
| 811 | 824 | .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, |
| 812 | 825 | .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, |
| 826 | + .fs_len = 4, | |
| 813 | 827 | }, |
| 814 | 828 | }, |
| 815 | 829 | .batch = { |
| @@ -933,11 +947,12 @@ static int st_lsm6dsx_set_full_scale(struct st_lsm6dsx_sensor *sensor, · 117 unmodified lines | ||
| 933 | 947 | int i, err; |
| 934 | 948 | |
| 935 | 949 | fs_table = &sensor->hw->settings->fs_table[sensor->id]; |
| 936 | − for (i = 0; i < ST_LSM6DSX_FS_LIST_SIZE; i++) | |
| 950 | + for (i = 0; i < fs_table->fs_len; i++) { | |
| 937 | 951 | if (fs_table->fs_avl[i].gain == gain) |
| 938 | 952 | break; |
| 953 | + } | |
| 939 | 954 | |
| 940 | − if (i == ST_LSM6DSX_FS_LIST_SIZE) | |
| 955 | + if (i == fs_table->fs_len) | |
| 941 | 956 | return -EINVAL; |
| 942 | 957 | |
| 943 | 958 | data = ST_LSM6DSX_SHIFT_VAL(fs_table->fs_avl[i].val, |
| @@ -1196,18 +1211,13 @@ static ssize_t st_lsm6dsx_sysfs_scale_avail(struct device *dev, · 252 unmodified lines | ||
| 1196 | 1211 | { |
| 1197 | 1212 | struct st_lsm6dsx_sensor *sensor = iio_priv(dev_get_drvdata(dev)); |
| 1198 | 1213 | const struct st_lsm6dsx_fs_table_entry *fs_table; |
| 1199 | − enum st_lsm6dsx_sensor_id id = sensor->id; | |
| 1200 | 1214 | struct st_lsm6dsx_hw *hw = sensor->hw; |
| 1201 | 1215 | int i, len = 0; |
| 1202 | 1216 | |
| 1203 | − fs_table = &hw->settings->fs_table[id]; | |
| 1204 | − for (i = 0; i < ST_LSM6DSX_FS_LIST_SIZE; i++) { | |
| 1205 | − if (!fs_table->fs_avl[i].gain) | |
| 1206 | − break; | |
| 1207 | − | |
| 1217 | + fs_table = &hw->settings->fs_table[sensor->id]; | |
| 1218 | + for (i = 0; i < fs_table->fs_len; i++) | |
| 1208 | 1219 | len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", |
| 1209 | 1220 | fs_table->fs_avl[i].gain); |
| 1210 | − } | |
| 1211 | 1221 | buf[len - 1] = '\n'; |
| 1212 | 1222 | |
| 1213 | 1223 | return len; |
| @@ -61,6 +61,7 @@ static const struct st_lsm6dsx_ext_dev_settings st_lsm6dsx_ext_dev_table[] = { · 60 unmodified lines | ||
| 61 | 61 | .gain = 1500, |
| 62 | 62 | .val = 0x0, |
| 63 | 63 | }, /* 1500 uG/LSB */ |
| 64 | + .fs_len = 1, | |
| 64 | 65 | }, |
| 65 | 66 | .temp_comp = { |
| 66 | 67 | .addr = 0x60, |
| @@ -92,9 +93,11 @@ static const struct st_lsm6dsx_ext_dev_settings st_lsm6dsx_ext_dev_table[] = { · 25 unmodified lines | ||
| 92 | 93 | static void st_lsm6dsx_shub_wait_complete(struct st_lsm6dsx_hw *hw) |
| 93 | 94 | { |
| 94 | 95 | struct st_lsm6dsx_sensor *sensor; |
| 96 | + u16 odr; | |
| 95 | 97 | |
| 96 | 98 | sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]); |
| 97 | − msleep((2000U / sensor->odr) + 1); | |
| 99 | + odr = (hw->enable_mask & BIT(ST_LSM6DSX_ID_ACC)) ? sensor->odr : 13; | |
| 100 | + msleep((2000U / odr) + 1); | |
| 98 | 101 | } |
| 99 | 102 | |
| 100 | 103 | /** |
| @@ -555,13 +558,9 @@ static ssize_t st_lsm6dsx_shub_scale_avail(struct device *dev, · 454 unmodified lines | ||
| 555 | 558 | int i, len = 0; |
| 556 | 559 | |
| 557 | 560 | settings = sensor->ext_info.settings; |
| 558 | − for (i = 0; i < ST_LSM6DSX_FS_LIST_SIZE; i++) { | |
| 559 | − u16 val = settings->fs_table.fs_avl[i].gain; | |
| 560 | − | |
| 561 | − if (val > 0) | |
| 562 | − len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", | |
| 563 | − val); | |
| 564 | − } | |
| 561 | + for (i = 0; i < settings->fs_table.fs_len; i++) | |
| 562 | + len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", | |
| 563 | + settings->fs_table.fs_avl[i].gain); | |
| 565 | 564 | buf[len - 1] = '\n'; |
| 566 | 565 | |
| 567 | 566 | return len; |
| @@ -314,6 +314,7 @@ config MAX44009 · 313 unmodified lines | ||
| 314 | 314 | config NOA1305 |
| 315 | 315 | tristate "ON Semiconductor NOA1305 ambient light sensor" |
| 316 | 316 | depends on I2C |
| 317 | + select REGMAP_I2C | |
| 317 | 318 | help |
| 318 | 319 | Say Y here if you want to build support for the ON Semiconductor |
| 319 | 320 | NOA1305 ambient light sensor. |
| @@ -686,6 +686,7 @@ static irqreturn_t opt3001_irq(int irq, void *_iio) · 685 unmodified lines | ||
| 686 | 686 | struct iio_dev *iio = _iio; |
| 687 | 687 | struct opt3001 *opt = iio_priv(iio); |
| 688 | 688 | int ret; |
| 689 | + bool wake_result_ready_queue = false; | |
| 689 | 690 | |
| 690 | 691 | if (!opt->ok_to_ignore_lock) |
| 691 | 692 | mutex_lock(&opt->lock); |
| @@ -720,13 +721,16 @@ static irqreturn_t opt3001_irq(int irq, void *_iio) · 28 unmodified lines | ||
| 720 | 721 | } |
| 721 | 722 | opt->result = ret; |
| 722 | 723 | opt->result_ready = true; |
| 723 | − wake_up(&opt->result_ready_queue); | |
| 724 | + wake_result_ready_queue = true; | |
| 724 | 725 | } |
| 725 | 726 | |
| 726 | 727 | out: |
| 727 | 728 | if (!opt->ok_to_ignore_lock) |
| 728 | 729 | mutex_unlock(&opt->lock); |
| 729 | 730 | |
| 731 | + if (wake_result_ready_queue) | |
| 732 | + wake_up(&opt->result_ready_queue); | |
| 733 | + | |
| 730 | 734 | return IRQ_HANDLED; |
| 731 | 735 | } |
| 732 | 736 | |
| @@ -398,19 +398,23 @@ static int vcnl4000_probe(struct i2c_client *client, · 397 unmodified lines | ||
| 398 | 398 | static const struct of_device_id vcnl_4000_of_match[] = { |
| 399 | 399 | { |
| 400 | 400 | .compatible = "vishay,vcnl4000", |
| 401 | − .data = "VCNL4000", | |
| 401 | + .data = (void *)VCNL4000, | |
| 402 | 402 | }, |
| 403 | 403 | { |
| 404 | 404 | .compatible = "vishay,vcnl4010", |
| 405 | − .data = "VCNL4010", | |
| 405 | + .data = (void *)VCNL4010, | |
| 406 | 406 | }, |
| 407 | 407 | { |
| 408 | − .compatible = "vishay,vcnl4010", | |
| 409 | − .data = "VCNL4020", | |
| 408 | + .compatible = "vishay,vcnl4020", | |
| 409 | + .data = (void *)VCNL4010, | |
| 410 | + }, | |
| 411 | + { | |
| 412 | + .compatible = "vishay,vcnl4040", | |
| 413 | + .data = (void *)VCNL4040, | |
| 410 | 414 | }, |
| 411 | 415 | { |
| 412 | 416 | .compatible = "vishay,vcnl4200", |
| 413 | − .data = "VCNL4200", | |
| 417 | + .data = (void *)VCNL4200, | |
| 414 | 418 | }, |
| 415 | 419 | {}, |
| 416 | 420 | }; |
| @@ -4399,6 +4399,7 @@ error2: · 4398 unmodified lines | ||
| 4399 | 4399 | error1: |
| 4400 | 4400 | port_modify.set_port_cap_mask = 0; |
| 4401 | 4401 | port_modify.clr_port_cap_mask = IB_PORT_CM_SUP; |
| 4402 | + kfree(port); | |
| 4402 | 4403 | while (--i) { |
| 4403 | 4404 | if (!rdma_cap_ib_cm(ib_device, i)) |
| 4404 | 4405 | continue; |
| @@ -4407,6 +4408,7 @@ error1: · 2 unmodified lines | ||
| 4407 | 4408 | ib_modify_port(ib_device, port->port_num, 0, &port_modify); |
| 4408 | 4409 | ib_unregister_mad_agent(port->mad_agent); |
| 4409 | 4410 | cm_remove_port_fs(port); |
| 4411 | + kfree(port); | |
| 4410 | 4412 | } |
| 4411 | 4413 | free: |
| 4412 | 4414 | kfree(cm_dev); |
| @@ -4460,6 +4462,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data) · 47 unmodified lines | ||
| 4460 | 4462 | spin_unlock_irq(&cm.state_lock); |
| 4461 | 4463 | ib_unregister_mad_agent(cur_mad_agent); |
| 4462 | 4464 | cm_remove_port_fs(port); |
| 4465 | + kfree(port); | |
| 4463 | 4466 | } |
| 4464 | 4467 | |
| 4465 | 4468 | kfree(cm_dev); |
| @@ -2396,9 +2396,10 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id, · 2395 unmodified lines | ||
| 2396 | 2396 | conn_id->cm_id.iw = NULL; |
| 2397 | 2397 | cma_exch(conn_id, RDMA_CM_DESTROYING); |
| 2398 | 2398 | mutex_unlock(&conn_id->handler_mutex); |
| 2399 | + mutex_unlock(&listen_id->handler_mutex); | |
| 2399 | 2400 | cma_deref_id(conn_id); |
| 2400 | 2401 | rdma_destroy_id(&conn_id->id); |
| 2401 | − goto out; | |
| 2402 | + return ret; | |
| 2402 | 2403 | } |
| 2403 | 2404 | |
| 2404 | 2405 | mutex_unlock(&conn_id->handler_mutex); |
| @@ -1987,8 +1987,6 @@ static int iw_query_port(struct ib_device *device, · 1986 unmodified lines | ||
| 1987 | 1987 | if (!netdev) |
| 1988 | 1988 | return -ENODEV; |
| 1989 | 1989 | |
| 1990 | − dev_put(netdev); | |
| 1991 | − | |
| 1992 | 1990 | port_attr->max_mtu = IB_MTU_4096; |
| 1993 | 1991 | port_attr->active_mtu = ib_mtu_int_to_enum(netdev->mtu); |
| 1994 | 1992 | |
| @@ -1996,19 +1994,22 @@ static int iw_query_port(struct ib_device *device, · 1 unmodified line | ||
| 1996 | 1994 | port_attr->state = IB_PORT_DOWN; |
| 1997 | 1995 | port_attr->phys_state = IB_PORT_PHYS_STATE_DISABLED; |
| 1998 | 1996 | } else { |
| 1999 | − inetdev = in_dev_get(netdev); | |
| 1997 | + rcu_read_lock(); | |
| 1998 | + inetdev = __in_dev_get_rcu(netdev); | |
| 2000 | 1999 | |
| 2001 | 2000 | if (inetdev && inetdev->ifa_list) { |
| 2002 | 2001 | port_attr->state = IB_PORT_ACTIVE; |
| 2003 | 2002 | port_attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP; |
| 2004 | − in_dev_put(inetdev); | |
| 2005 | 2003 | } else { |
| 2006 | 2004 | port_attr->state = IB_PORT_INIT; |
| 2007 | 2005 | port_attr->phys_state = |
| 2008 | 2006 | IB_PORT_PHYS_STATE_PORT_CONFIGURATION_TRAINING; |
| 2009 | 2007 | } |
| 2008 | + | |
| 2009 | + rcu_read_unlock(); | |
| 2010 | 2010 | } |
| 2011 | 2011 | |
| 2012 | + dev_put(netdev); | |
| 2012 | 2013 | err = device->ops.query_port(device, port_num, port_attr); |
| 2013 | 2014 | if (err) |
| 2014 | 2015 | return err; |
| @@ -1230,7 +1230,7 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 1229 unmodified lines | ||
| 1230 | 1230 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
| 1231 | 1231 | if (!msg) { |
| 1232 | 1232 | ret = -ENOMEM; |
| 1233 | − goto err; | |
| 1233 | + goto err_get; | |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | 1236 | nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq, |
| @@ -1787,10 +1787,6 @@ static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 550 unmodified lines | ||
| 1787 | 1787 | |
| 1788 | 1788 | cntn = nla_get_u32(tb[RDMA_NLDEV_ATTR_STAT_COUNTER_ID]); |
| 1789 | 1789 | qpn = nla_get_u32(tb[RDMA_NLDEV_ATTR_RES_LQPN]); |
| 1790 | − ret = rdma_counter_unbind_qpn(device, port, qpn, cntn); | |
| 1791 | − if (ret) | |
| 1792 | − goto err_unbind; | |
| 1793 | − | |
| 1794 | 1790 | if (fill_nldev_handle(msg, device) || |
| 1795 | 1791 | nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, port) || |
| 1796 | 1792 | nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_COUNTER_ID, cntn) || |
| @@ -1799,13 +1795,15 @@ static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 2 unmodified lines | ||
| 1799 | 1795 | goto err_fill; |
| 1800 | 1796 | } |
| 1801 | 1797 | |
| 1798 | + ret = rdma_counter_unbind_qpn(device, port, qpn, cntn); | |
| 1799 | + if (ret) | |
| 1800 | + goto err_fill; | |
| 1801 | + | |
| 1802 | 1802 | nlmsg_end(msg, nlh); |
| 1803 | 1803 | ib_device_put(device); |
| 1804 | 1804 | return rdma_nl_unicast(sock_net(skb->sk), msg, NETLINK_CB(skb).portid); |
| 1805 | 1805 | |
| 1806 | 1806 | err_fill: |
| 1807 | − rdma_counter_bind_qpn(device, port, qpn, cntn); | |
| 1808 | −err_unbind: | |
| 1809 | 1807 | nlmsg_free(msg); |
| 1810 | 1808 | err: |
| 1811 | 1809 | ib_device_put(device); |
| @@ -426,7 +426,7 @@ int ib_create_qp_security(struct ib_qp *qp, struct ib_device *dev) · 425 unmodified lines | ||
| 426 | 426 | int ret; |
| 427 | 427 | |
| 428 | 428 | rdma_for_each_port (dev, i) { |
| 429 | − is_ib = rdma_protocol_ib(dev, i++); | |
| 429 | + is_ib = rdma_protocol_ib(dev, i); | |
| 430 | 430 | if (is_ib) |
| 431 | 431 | break; |
| 432 | 432 | } |
| @@ -451,8 +451,10 @@ void ib_umem_odp_release(struct ib_umem_odp *umem_odp) · 450 unmodified lines | ||
| 451 | 451 | * that the hardware will not attempt to access the MR any more. |
| 452 | 452 | */ |
| 453 | 453 | if (!umem_odp->is_implicit_odp) { |
| 454 | + mutex_lock(&umem_odp->umem_mutex); | |
| 454 | 455 | ib_umem_odp_unmap_dma_pages(umem_odp, ib_umem_start(umem_odp), |
| 455 | 456 | ib_umem_end(umem_odp)); |
| 457 | + mutex_unlock(&umem_odp->umem_mutex); | |
| 456 | 458 | kvfree(umem_odp->dma_list); |
| 457 | 459 | kvfree(umem_odp->page_list); |
| 458 | 460 | } |
| @@ -719,6 +721,8 @@ void ib_umem_odp_unmap_dma_pages(struct ib_umem_odp *umem_odp, u64 virt, · 260 unmodified lines | ||
| 719 | 721 | u64 addr; |
| 720 | 722 | struct ib_device *dev = umem_odp->umem.ibdev; |
| 721 | 723 | |
| 724 | + lockdep_assert_held(&umem_odp->umem_mutex); | |
| 725 | + | |
| 722 | 726 | virt = max_t(u64, virt, ib_umem_start(umem_odp)); |
| 723 | 727 | bound = min_t(u64, bound, ib_umem_end(umem_odp)); |
| 724 | 728 | /* Note that during the run of this function, the |
| @@ -726,7 +730,6 @@ void ib_umem_odp_unmap_dma_pages(struct ib_umem_odp *umem_odp, u64 virt, · 1 unmodified line | ||
| 726 | 730 | * faults from completion. We might be racing with other |
| 727 | 731 | * invalidations, so we must make sure we free each page only |
| 728 | 732 | * once. */ |
| 729 | − mutex_lock(&umem_odp->umem_mutex); | |
| 730 | 733 | for (addr = virt; addr < bound; addr += BIT(umem_odp->page_shift)) { |
| 731 | 734 | idx = (addr - ib_umem_start(umem_odp)) >> umem_odp->page_shift; |
| 732 | 735 | if (umem_odp->page_list[idx]) { |
| @@ -757,7 +760,6 @@ void ib_umem_odp_unmap_dma_pages(struct ib_umem_odp *umem_odp, u64 virt, · 24 unmodified lines | ||
| 757 | 760 | umem_odp->npages--; |
| 758 | 761 | } |
| 759 | 762 | } |
| 760 | − mutex_unlock(&umem_odp->umem_mutex); | |
| 761 | 763 | } |
| 762 | 764 | EXPORT_SYMBOL(ib_umem_odp_unmap_dma_pages); |
| 763 | 765 | |
| @@ -242,10 +242,13 @@ static void set_ep_sin6_addrs(struct c4iw_ep *ep, · 241 unmodified lines | ||
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | −static int dump_qp(struct c4iw_qp *qp, struct c4iw_debugfs_data *qpd) | |
| 245 | +static int dump_qp(unsigned long id, struct c4iw_qp *qp, | |
| 246 | + struct c4iw_debugfs_data *qpd) | |
| 246 | 247 | { |
| 247 | 248 | int space; |
| 248 | 249 | int cc; |
| 250 | + if (id != qp->wq.sq.qid) | |
| 251 | + return 0; | |
| 249 | 252 | |
| 250 | 253 | space = qpd->bufsize - qpd->pos - 1; |
| 251 | 254 | if (space == 0) |
| @@ -350,7 +353,7 @@ static int qp_open(struct inode *inode, struct file *file) · 98 unmodified lines | ||
| 350 | 353 | |
| 351 | 354 | xa_lock_irq(&qpd->devp->qps); |
| 352 | 355 | xa_for_each(&qpd->devp->qps, index, qp) |
| 353 | − dump_qp(qp, qpd); | |
| 356 | + dump_qp(index, qp, qpd); | |
| 354 | 357 | xa_unlock_irq(&qpd->devp->qps); |
| 355 | 358 | |
| 356 | 359 | qpd->buf[qpd->pos++] = 0; |
| @@ -275,13 +275,17 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, · 274 unmodified lines | ||
| 275 | 275 | struct sk_buff *skb, struct c4iw_wr_wait *wr_waitp) |
| 276 | 276 | { |
| 277 | 277 | int err; |
| 278 | − struct fw_ri_tpte tpt; | |
| 278 | + struct fw_ri_tpte *tpt; | |
| 279 | 279 | u32 stag_idx; |
| 280 | 280 | static atomic_t key; |
| 281 | 281 | |
| 282 | 282 | if (c4iw_fatal_error(rdev)) |
| 283 | 283 | return -EIO; |
| 284 | 284 | |
| 285 | + tpt = kmalloc(sizeof(*tpt), GFP_KERNEL); | |
| 286 | + if (!tpt) | |
| 287 | + return -ENOMEM; | |
| 288 | + | |
| 285 | 289 | stag_state = stag_state > 0; |
| 286 | 290 | stag_idx = (*stag) >> 8; |
| 287 | 291 | |
| @@ -291,6 +295,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, · 3 unmodified lines | ||
| 291 | 295 | mutex_lock(&rdev->stats.lock); |
| 292 | 296 | rdev->stats.stag.fail++; |
| 293 | 297 | mutex_unlock(&rdev->stats.lock); |
| 298 | + kfree(tpt); | |
| 294 | 299 | return -ENOMEM; |
| 295 | 300 | } |
| 296 | 301 | mutex_lock(&rdev->stats.lock); |
| @@ -305,28 +310,28 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, · 8 unmodified lines | ||
| 305 | 310 | |
| 306 | 311 | /* write TPT entry */ |
| 307 | 312 | if (reset_tpt_entry) |
| 308 | − memset(&tpt, 0, sizeof(tpt)); | |
| 313 | + memset(tpt, 0, sizeof(*tpt)); | |
| 309 | 314 | else { |
| 310 | − tpt.valid_to_pdid = cpu_to_be32(FW_RI_TPTE_VALID_F | | |
| 315 | + tpt->valid_to_pdid = cpu_to_be32(FW_RI_TPTE_VALID_F | | |
| 311 | 316 | FW_RI_TPTE_STAGKEY_V((*stag & FW_RI_TPTE_STAGKEY_M)) | |
| 312 | 317 | FW_RI_TPTE_STAGSTATE_V(stag_state) | |
| 313 | 318 | FW_RI_TPTE_STAGTYPE_V(type) | FW_RI_TPTE_PDID_V(pdid)); |
| 314 | − tpt.locread_to_qpid = cpu_to_be32(FW_RI_TPTE_PERM_V(perm) | | |
| 319 | + tpt->locread_to_qpid = cpu_to_be32(FW_RI_TPTE_PERM_V(perm) | | |
| 315 | 320 | (bind_enabled ? FW_RI_TPTE_MWBINDEN_F : 0) | |
| 316 | 321 | FW_RI_TPTE_ADDRTYPE_V((zbva ? FW_RI_ZERO_BASED_TO : |
| 317 | 322 | FW_RI_VA_BASED_TO))| |
| 318 | 323 | FW_RI_TPTE_PS_V(page_size)); |
| 319 | − tpt.nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32( | |
| 324 | + tpt->nosnoop_pbladdr = !pbl_size ? 0 : cpu_to_be32( | |
| 320 | 325 | FW_RI_TPTE_PBLADDR_V(PBL_OFF(rdev, pbl_addr)>>3)); |
| 321 | − tpt.len_lo = cpu_to_be32((u32)(len & 0xffffffffUL)); | |
| 322 | − tpt.va_hi = cpu_to_be32((u32)(to >> 32)); | |
| 323 | − tpt.va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL)); | |
| 324 | − tpt.dca_mwbcnt_pstag = cpu_to_be32(0); | |
| 325 | − tpt.len_hi = cpu_to_be32((u32)(len >> 32)); | |
| 326 | + tpt->len_lo = cpu_to_be32((u32)(len & 0xffffffffUL)); | |
| 327 | + tpt->va_hi = cpu_to_be32((u32)(to >> 32)); | |
| 328 | + tpt->va_lo_fbo = cpu_to_be32((u32)(to & 0xffffffffUL)); | |
| 329 | + tpt->dca_mwbcnt_pstag = cpu_to_be32(0); | |
| 330 | + tpt->len_hi = cpu_to_be32((u32)(len >> 32)); | |
| 326 | 331 | } |
| 327 | 332 | err = write_adapter_mem(rdev, stag_idx + |
| 328 | 333 | (rdev->lldi.vr->stag.start >> 5), |
| 329 | − sizeof(tpt), &tpt, skb, wr_waitp); | |
| 334 | + sizeof(*tpt), tpt, skb, wr_waitp); | |
| 330 | 335 | |
| 331 | 336 | if (reset_tpt_entry) { |
| 332 | 337 | c4iw_put_resource(&rdev->resource.tpt_table, stag_idx); |
| @@ -334,6 +339,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, · 1 unmodified line | ||
| 334 | 339 | rdev->stats.stag.cur -= 32; |
| 335 | 340 | mutex_unlock(&rdev->stats.lock); |
| 336 | 341 | } |
| 342 | + kfree(tpt); | |
| 337 | 343 | return err; |
| 338 | 344 | } |
| 339 | 345 | |
| @@ -2737,15 +2737,11 @@ int c4iw_create_srq(struct ib_srq *ib_srq, struct ib_srq_init_attr *attrs, · 2736 unmodified lines | ||
| 2737 | 2737 | if (CHELSIO_CHIP_VERSION(rhp->rdev.lldi.adapter_type) > CHELSIO_T6) |
| 2738 | 2738 | srq->flags = T4_SRQ_LIMIT_SUPPORT; |
| 2739 | 2739 | |
| 2740 | − ret = xa_insert_irq(&rhp->qps, srq->wq.qid, srq, GFP_KERNEL); | |
| 2741 | − if (ret) | |
| 2742 | − goto err_free_queue; | |
| 2743 | − | |
| 2744 | 2740 | if (udata) { |
| 2745 | 2741 | srq_key_mm = kmalloc(sizeof(*srq_key_mm), GFP_KERNEL); |
| 2746 | 2742 | if (!srq_key_mm) { |
| 2747 | 2743 | ret = -ENOMEM; |
| 2748 | − goto err_remove_handle; | |
| 2744 | + goto err_free_queue; | |
| 2749 | 2745 | } |
| 2750 | 2746 | srq_db_key_mm = kmalloc(sizeof(*srq_db_key_mm), GFP_KERNEL); |
| 2751 | 2747 | if (!srq_db_key_mm) { |
| @@ -2789,8 +2785,6 @@ err_free_srq_db_key_mm: · 37 unmodified lines | ||
| 2789 | 2785 | kfree(srq_db_key_mm); |
| 2790 | 2786 | err_free_srq_key_mm: |
| 2791 | 2787 | kfree(srq_key_mm); |
| 2792 | −err_remove_handle: | |
| 2793 | − xa_erase_irq(&rhp->qps, srq->wq.qid); | |
| 2794 | 2788 | err_free_queue: |
| 2795 | 2789 | free_srq_queue(srq, ucontext ? &ucontext->uctx : &rhp->rdev.uctx, |
| 2796 | 2790 | srq->wr_waitp); |
| @@ -2813,8 +2807,6 @@ void c4iw_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata) · 16 unmodified lines | ||
| 2813 | 2807 | rhp = srq->rhp; |
| 2814 | 2808 | |
| 2815 | 2809 | pr_debug("%s id %d\n", __func__, srq->wq.qid); |
| 2816 | − | |
| 2817 | − xa_erase_irq(&rhp->qps, srq->wq.qid); | |
| 2818 | 2810 | ucontext = rdma_udata_to_drv_context(udata, struct c4iw_ucontext, |
| 2819 | 2811 | ibucontext); |
| 2820 | 2812 | free_srq_queue(srq, ucontext ? &ucontext->uctx : &rhp->rdev.uctx, |
| @@ -1526,8 +1526,11 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) · 1525 unmodified lines | ||
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | 1528 | ret = rhashtable_init(tmp_sdma_rht, &sdma_rht_params); |
| 1529 | − if (ret < 0) | |
| 1529 | + if (ret < 0) { | |
| 1530 | + kfree(tmp_sdma_rht); | |
| 1530 | 1531 | goto bail; |
| 1532 | + } | |
| 1533 | + | |
| 1531 | 1534 | dd->sdma_rht = tmp_sdma_rht; |
| 1532 | 1535 | |
| 1533 | 1536 | dd_dev_info(dd, "SDMA num_sdma: %u\n", dd->num_sdma); |
| @@ -2773,6 +2773,10 @@ int i40iw_register_rdma_device(struct i40iw_device *iwdev) · 2772 unmodified lines | ||
| 2773 | 2773 | return -ENOMEM; |
| 2774 | 2774 | iwibdev = iwdev->iwibdev; |
| 2775 | 2775 | rdma_set_device_sysfs_group(&iwibdev->ibdev, &i40iw_attr_group); |
| 2776 | + ret = ib_device_set_netdev(&iwibdev->ibdev, iwdev->netdev, 1); | |
| 2777 | + if (ret) | |
| 2778 | + goto error; | |
| 2779 | + | |
| 2776 | 2780 | ret = ib_register_device(&iwibdev->ibdev, "i40iw%d"); |
| 2777 | 2781 | if (ret) |
| 2778 | 2782 | goto error; |
| @@ -1298,29 +1298,6 @@ static int devx_handle_mkey_create(struct mlx5_ib_dev *dev, · 1297 unmodified lines | ||
| 1298 | 1298 | return 0; |
| 1299 | 1299 | } |
| 1300 | 1300 | |
| 1301 | −static void devx_free_indirect_mkey(struct rcu_head *rcu) | |
| 1302 | −{ | |
| 1303 | − kfree(container_of(rcu, struct devx_obj, devx_mr.rcu)); | |
| 1304 | −} | |
| 1305 | − | |
| 1306 | −/* This function to delete from the radix tree needs to be called before | |
| 1307 | − * destroying the underlying mkey. Otherwise a race might occur in case that | |
| 1308 | − * other thread will get the same mkey before this one will be deleted, | |
| 1309 | − * in that case it will fail via inserting to the tree its own data. | |
| 1310 | − * | |
| 1311 | − * Note: | |
| 1312 | − * An error in the destroy is not expected unless there is some other indirect | |
| 1313 | − * mkey which points to this one. In a kernel cleanup flow it will be just | |
| 1314 | − * destroyed in the iterative destruction call. In a user flow, in case | |
| 1315 | − * the application didn't close in the expected order it's its own problem, | |
| 1316 | − * the mkey won't be part of the tree, in both cases the kernel is safe. | |
| 1317 | − */ | |
| 1318 | −static void devx_cleanup_mkey(struct devx_obj *obj) | |
| 1319 | −{ | |
| 1320 | − xa_erase(&obj->ib_dev->mdev->priv.mkey_table, | |
| 1321 | − mlx5_base_mkey(obj->devx_mr.mmkey.key)); | |
| 1322 | −} | |
| 1323 | − | |
| 1324 | 1301 | static void devx_cleanup_subscription(struct mlx5_ib_dev *dev, |
| 1325 | 1302 | struct devx_event_subscription *sub) |
| 1326 | 1303 | { |
| @@ -1362,8 +1339,16 @@ static int devx_obj_cleanup(struct ib_uobject *uobject, · 35 unmodified lines | ||
| 1362 | 1339 | int ret; |
| 1363 | 1340 | |
| 1364 | 1341 | dev = mlx5_udata_to_mdev(&attrs->driver_udata); |
| 1365 | − if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY) | |
| 1366 | − devx_cleanup_mkey(obj); | |
| 1342 | + if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY) { | |
| 1343 | + /* | |
| 1344 | + * The pagefault_single_data_segment() does commands against | |
| 1345 | + * the mmkey, we must wait for that to stop before freeing the | |
| 1346 | + * mkey, as another allocation could get the same mkey #. | |
| 1347 | + */ | |
| 1348 | + xa_erase(&obj->ib_dev->mdev->priv.mkey_table, | |
| 1349 | + mlx5_base_mkey(obj->devx_mr.mmkey.key)); | |
| 1350 | + synchronize_srcu(&dev->mr_srcu); | |
| 1351 | + } | |
| 1367 | 1352 | |
| 1368 | 1353 | if (obj->flags & DEVX_OBJ_FLAGS_DCT) |
| 1369 | 1354 | ret = mlx5_core_destroy_dct(obj->ib_dev->mdev, &obj->core_dct); |
| @@ -1382,12 +1367,6 @@ static int devx_obj_cleanup(struct ib_uobject *uobject, · 12 unmodified lines | ||
| 1382 | 1367 | devx_cleanup_subscription(dev, sub_entry); |
| 1383 | 1368 | mutex_unlock(&devx_event_table->event_xa_lock); |
| 1384 | 1369 | |
| 1385 | − if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY) { | |
| 1386 | − call_srcu(&dev->mr_srcu, &obj->devx_mr.rcu, | |
| 1387 | − devx_free_indirect_mkey); | |
| 1388 | − return ret; | |
| 1389 | − } | |
| 1390 | − | |
| 1391 | 1370 | kfree(obj); |
| 1392 | 1371 | return ret; |
| 1393 | 1372 | } |
| @@ -1491,26 +1470,21 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)( · 97 unmodified lines | ||
| 1491 | 1470 | &obj_id); |
| 1492 | 1471 | WARN_ON(obj->dinlen > MLX5_MAX_DESTROY_INBOX_SIZE_DW * sizeof(u32)); |
| 1493 | 1472 | |
| 1494 | − if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY) { | |
| 1495 | − err = devx_handle_mkey_indirect(obj, dev, cmd_in, cmd_out); | |
| 1496 | − if (err) | |
| 1497 | − goto obj_destroy; | |
| 1498 | − } | |
| 1499 | − | |
| 1500 | 1473 | err = uverbs_copy_to(attrs, MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_OUT, cmd_out, cmd_out_len); |
| 1501 | 1474 | if (err) |
| 1502 | − goto err_copy; | |
| 1475 | + goto obj_destroy; | |
| 1503 | 1476 | |
| 1504 | 1477 | if (opcode == MLX5_CMD_OP_CREATE_GENERAL_OBJECT) |
| 1505 | 1478 | obj_type = MLX5_GET(general_obj_in_cmd_hdr, cmd_in, obj_type); |
| 1506 | − | |
| 1507 | 1479 | obj->obj_id = get_enc_obj_id(opcode | obj_type << 16, obj_id); |
| 1508 | 1480 | |
| 1481 | + if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY) { | |
| 1482 | + err = devx_handle_mkey_indirect(obj, dev, cmd_in, cmd_out); | |
| 1483 | + if (err) | |
| 1484 | + goto obj_destroy; | |
| 1485 | + } | |
| 1509 | 1486 | return 0; |
| 1510 | 1487 | |
| 1511 | −err_copy: | |
| 1512 | − if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY) | |
| 1513 | − devx_cleanup_mkey(obj); | |
| 1514 | 1488 | obj_destroy: |
| 1515 | 1489 | if (obj->flags & DEVX_OBJ_FLAGS_DCT) |
| 1516 | 1490 | mlx5_core_destroy_dct(obj->ib_dev->mdev, &obj->core_dct); |
| @@ -606,7 +606,7 @@ struct mlx5_ib_mr { · 605 unmodified lines | ||
| 606 | 606 | struct mlx5_ib_dev *dev; |
| 607 | 607 | u32 out[MLX5_ST_SZ_DW(create_mkey_out)]; |
| 608 | 608 | struct mlx5_core_sig_ctx *sig; |
| 609 | − int live; | |
| 609 | + unsigned int live; | |
| 610 | 610 | void *descs_alloc; |
| 611 | 611 | int access_flags; /* Needed for rereg MR */ |
| 612 | 612 | |
| @@ -639,7 +639,6 @@ struct mlx5_ib_mw { · 26 unmodified lines | ||
| 639 | 639 | struct mlx5_ib_devx_mr { |
| 640 | 640 | struct mlx5_core_mkey mmkey; |
| 641 | 641 | int ndescs; |
| 642 | − struct rcu_head rcu; | |
| 643 | 642 | }; |
| 644 | 643 | |
| 645 | 644 | struct mlx5_ib_umr_context { |
| @@ -84,32 +84,6 @@ static bool use_umr_mtt_update(struct mlx5_ib_mr *mr, u64 start, u64 length) · 83 unmodified lines | ||
| 84 | 84 | length + (start & (MLX5_ADAPTER_PAGE_SIZE - 1)); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | −static void update_odp_mr(struct mlx5_ib_mr *mr) | |
| 88 | −{ | |
| 89 | − if (is_odp_mr(mr)) { | |
| 90 | − /* | |
| 91 | − * This barrier prevents the compiler from moving the | |
| 92 | − * setting of umem->odp_data->private to point to our | |
| 93 | − * MR, before reg_umr finished, to ensure that the MR | |
| 94 | − * initialization have finished before starting to | |
| 95 | − * handle invalidations. | |
| 96 | − */ | |
| 97 | − smp_wmb(); | |
| 98 | − to_ib_umem_odp(mr->umem)->private = mr; | |
| 99 | − /* | |
| 100 | − * Make sure we will see the new | |
| 101 | − * umem->odp_data->private value in the invalidation | |
| 102 | − * routines, before we can get page faults on the | |
| 103 | − * MR. Page faults can happen once we put the MR in | |
| 104 | − * the tree, below this line. Without the barrier, | |
| 105 | − * there can be a fault handling and an invalidation | |
| 106 | − * before umem->odp_data->private == mr is visible to | |
| 107 | − * the invalidation handler. | |
| 108 | − */ | |
| 109 | − smp_wmb(); | |
| 110 | − } | |
| 111 | −} | |
| 112 | − | |
| 113 | 87 | static void reg_mr_callback(int status, struct mlx5_async_work *context) |
| 114 | 88 | { |
| 115 | 89 | struct mlx5_ib_mr *mr = |
| @@ -1346,8 +1320,6 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, · 1230 unmodified lines | ||
| 1346 | 1320 | mr->umem = umem; |
| 1347 | 1321 | set_mr_fields(dev, mr, npages, length, access_flags); |
| 1348 | 1322 | |
| 1349 | − update_odp_mr(mr); | |
| 1350 | − | |
| 1351 | 1323 | if (use_umr) { |
| 1352 | 1324 | int update_xlt_flags = MLX5_IB_UPD_XLT_ENABLE; |
| 1353 | 1325 | |
| @@ -1363,10 +1335,12 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, · 9 unmodified lines | ||
| 1363 | 1335 | } |
| 1364 | 1336 | } |
| 1365 | 1337 | |
| 1366 | − if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) { | |
| 1367 | − mr->live = 1; | |
| 1338 | + if (is_odp_mr(mr)) { | |
| 1339 | + to_ib_umem_odp(mr->umem)->private = mr; | |
| 1368 | 1340 | atomic_set(&mr->num_pending_prefetch, 0); |
| 1369 | 1341 | } |
| 1342 | + if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) | |
| 1343 | + smp_store_release(&mr->live, 1); | |
| 1370 | 1344 | |
| 1371 | 1345 | return &mr->ibmr; |
| 1372 | 1346 | error: |
| @@ -1441,6 +1415,9 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, · 68 unmodified lines | ||
| 1441 | 1415 | if (!mr->umem) |
| 1442 | 1416 | return -EINVAL; |
| 1443 | 1417 | |
| 1418 | + if (is_odp_mr(mr)) | |
| 1419 | + return -EOPNOTSUPP; | |
| 1420 | + | |
| 1444 | 1421 | if (flags & IB_MR_REREG_TRANS) { |
| 1445 | 1422 | addr = virt_addr; |
| 1446 | 1423 | len = length; |
| @@ -1486,8 +1463,6 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, · 39 unmodified lines | ||
| 1486 | 1463 | } |
| 1487 | 1464 | |
| 1488 | 1465 | mr->allocated_from_cache = 0; |
| 1489 | − if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) | |
| 1490 | − mr->live = 1; | |
| 1491 | 1466 | } else { |
| 1492 | 1467 | /* |
| 1493 | 1468 | * Send a UMR WQE |
| @@ -1516,7 +1491,6 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start, · 22 unmodified lines | ||
| 1516 | 1491 | |
| 1517 | 1492 | set_mr_fields(dev, mr, npages, len, access_flags); |
| 1518 | 1493 | |
| 1519 | − update_odp_mr(mr); | |
| 1520 | 1494 | return 0; |
| 1521 | 1495 | |
| 1522 | 1496 | err: |
| @@ -1607,15 +1581,16 @@ static void dereg_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) · 84 unmodified lines | ||
| 1607 | 1581 | /* Prevent new page faults and |
| 1608 | 1582 | * prefetch requests from succeeding |
| 1609 | 1583 | */ |
| 1610 | − mr->live = 0; | |
| 1584 | + WRITE_ONCE(mr->live, 0); | |
| 1585 | + | |
| 1586 | + /* Wait for all running page-fault handlers to finish. */ | |
| 1587 | + synchronize_srcu(&dev->mr_srcu); | |
| 1611 | 1588 | |
| 1612 | 1589 | /* dequeue pending prefetch requests for the mr */ |
| 1613 | 1590 | if (atomic_read(&mr->num_pending_prefetch)) |
| 1614 | 1591 | flush_workqueue(system_unbound_wq); |
| 1615 | 1592 | WARN_ON(atomic_read(&mr->num_pending_prefetch)); |
| 1616 | 1593 | |
| 1617 | − /* Wait for all running page-fault handlers to finish. */ | |
| 1618 | − synchronize_srcu(&dev->mr_srcu); | |
| 1619 | 1594 | /* Destroy all page mappings */ |
| 1620 | 1595 | if (!umem_odp->is_implicit_odp) |
| 1621 | 1596 | mlx5_ib_invalidate_range(umem_odp, |
| @@ -1987,14 +1962,25 @@ free: · 365 unmodified lines | ||
| 1987 | 1962 | |
| 1988 | 1963 | int mlx5_ib_dealloc_mw(struct ib_mw *mw) |
| 1989 | 1964 | { |
| 1965 | + struct mlx5_ib_dev *dev = to_mdev(mw->device); | |
| 1990 | 1966 | struct mlx5_ib_mw *mmw = to_mmw(mw); |
| 1991 | 1967 | int err; |
| 1992 | 1968 | |
| 1993 | − err = mlx5_core_destroy_mkey((to_mdev(mw->device))->mdev, | |
| 1994 | − &mmw->mmkey); | |
| 1995 | − if (!err) | |
| 1996 | − kfree(mmw); | |
| 1997 | − return err; | |
| 1969 | + if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING)) { | |
| 1970 | + xa_erase(&dev->mdev->priv.mkey_table, | |
| 1971 | + mlx5_base_mkey(mmw->mmkey.key)); | |
| 1972 | + /* | |
| 1973 | + * pagefault_single_data_segment() may be accessing mmw under | |
| 1974 | + * SRCU if the user bound an ODP MR to this MW. | |
| 1975 | + */ | |
| 1976 | + synchronize_srcu(&dev->mr_srcu); | |
| 1977 | + } | |
| 1978 | + | |
| 1979 | + err = mlx5_core_destroy_mkey(dev->mdev, &mmw->mmkey); | |
| 1980 | + if (err) | |
| 1981 | + return err; | |
| 1982 | + kfree(mmw); | |
| 1983 | + return 0; | |
| 1998 | 1984 | } |
| 1999 | 1985 | |
| 2000 | 1986 | int mlx5_ib_check_mr_status(struct ib_mr *ibmr, u32 check_mask, |
| @@ -178,6 +178,29 @@ void mlx5_odp_populate_klm(struct mlx5_klm *pklm, size_t offset, · 177 unmodified lines | ||
| 178 | 178 | return; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | + /* | |
| 182 | + * The locking here is pretty subtle. Ideally the implicit children | |
| 183 | + * list would be protected by the umem_mutex, however that is not | |
| 184 | + * possible. Instead this uses a weaker update-then-lock pattern: | |
| 185 | + * | |
| 186 | + * srcu_read_lock() | |
| 187 | + * <change children list> | |
| 188 | + * mutex_lock(umem_mutex) | |
| 189 | + * mlx5_ib_update_xlt() | |
| 190 | + * mutex_unlock(umem_mutex) | |
| 191 | + * destroy lkey | |
| 192 | + * | |
| 193 | + * ie any change the children list must be followed by the locked | |
| 194 | + * update_xlt before destroying. | |
| 195 | + * | |
| 196 | + * The umem_mutex provides the acquire/release semantic needed to make | |
| 197 | + * the children list visible to a racing thread. While SRCU is not | |
| 198 | + * technically required, using it gives consistent use of the SRCU | |
| 199 | + * locking around the children list. | |
| 200 | + */ | |
| 201 | + lockdep_assert_held(&to_ib_umem_odp(mr->umem)->umem_mutex); | |
| 202 | + lockdep_assert_held(&mr->dev->mr_srcu); | |
| 203 | + | |
| 181 | 204 | odp = odp_lookup(offset * MLX5_IMR_MTT_SIZE, |
| 182 | 205 | nentries * MLX5_IMR_MTT_SIZE, mr); |
| 183 | 206 | |
| @@ -202,15 +225,22 @@ static void mr_leaf_free_action(struct work_struct *work) · 18 unmodified lines | ||
| 202 | 225 | struct ib_umem_odp *odp = container_of(work, struct ib_umem_odp, work); |
| 203 | 226 | int idx = ib_umem_start(odp) >> MLX5_IMR_MTT_SHIFT; |
| 204 | 227 | struct mlx5_ib_mr *mr = odp->private, *imr = mr->parent; |
| 228 | + struct ib_umem_odp *odp_imr = to_ib_umem_odp(imr->umem); | |
| 229 | + int srcu_key; | |
| 205 | 230 | |
| 206 | 231 | mr->parent = NULL; |
| 207 | 232 | synchronize_srcu(&mr->dev->mr_srcu); |
| 208 | 233 | |
| 209 | − ib_umem_odp_release(odp); | |
| 210 | − if (imr->live) | |
| 234 | + if (smp_load_acquire(&imr->live)) { | |
| 235 | + srcu_key = srcu_read_lock(&mr->dev->mr_srcu); | |
| 236 | + mutex_lock(&odp_imr->umem_mutex); | |
| 211 | 237 | mlx5_ib_update_xlt(imr, idx, 1, 0, |
| 212 | 238 | MLX5_IB_UPD_XLT_INDIRECT | |
| 213 | 239 | MLX5_IB_UPD_XLT_ATOMIC); |
| 240 | + mutex_unlock(&odp_imr->umem_mutex); | |
| 241 | + srcu_read_unlock(&mr->dev->mr_srcu, srcu_key); | |
| 242 | + } | |
| 243 | + ib_umem_odp_release(odp); | |
| 214 | 244 | mlx5_mr_cache_free(mr->dev, mr); |
| 215 | 245 | |
| 216 | 246 | if (atomic_dec_and_test(&imr->num_leaf_free)) |
| @@ -278,7 +308,6 @@ void mlx5_ib_invalidate_range(struct ib_umem_odp *umem_odp, unsigned long start, · 61 unmodified lines | ||
| 278 | 308 | idx - blk_start_idx + 1, 0, |
| 279 | 309 | MLX5_IB_UPD_XLT_ZAP | |
| 280 | 310 | MLX5_IB_UPD_XLT_ATOMIC); |
| 281 | − mutex_unlock(&umem_odp->umem_mutex); | |
| 282 | 311 | /* |
| 283 | 312 | * We are now sure that the device will not access the |
| 284 | 313 | * memory. We can safely unmap it, and mark it as dirty if |
| @@ -289,10 +318,12 @@ void mlx5_ib_invalidate_range(struct ib_umem_odp *umem_odp, unsigned long start, · 4 unmodified lines | ||
| 289 | 318 | |
| 290 | 319 | if (unlikely(!umem_odp->npages && mr->parent && |
| 291 | 320 | !umem_odp->dying)) { |
| 292 | − WRITE_ONCE(umem_odp->dying, 1); | |
| 321 | + WRITE_ONCE(mr->live, 0); | |
| 322 | + umem_odp->dying = 1; | |
| 293 | 323 | atomic_inc(&mr->parent->num_leaf_free); |
| 294 | 324 | schedule_work(&umem_odp->work); |
| 295 | 325 | } |
| 326 | + mutex_unlock(&umem_odp->umem_mutex); | |
| 296 | 327 | } |
| 297 | 328 | |
| 298 | 329 | void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev) |
| @@ -429,8 +460,6 @@ static struct mlx5_ib_mr *implicit_mr_alloc(struct ib_pd *pd, · 130 unmodified lines | ||
| 429 | 460 | mr->ibmr.lkey = mr->mmkey.key; |
| 430 | 461 | mr->ibmr.rkey = mr->mmkey.key; |
| 431 | 462 | |
| 432 | − mr->live = 1; | |
| 433 | − | |
| 434 | 463 | mlx5_ib_dbg(dev, "key %x dev %p mr %p\n", |
| 435 | 464 | mr->mmkey.key, dev->mdev, mr); |
| 436 | 465 | |
| @@ -484,6 +513,8 @@ next_mr: · 47 unmodified lines | ||
| 484 | 513 | mtt->parent = mr; |
| 485 | 514 | INIT_WORK(&odp->work, mr_leaf_free_action); |
| 486 | 515 | |
| 516 | + smp_store_release(&mtt->live, 1); | |
| 517 | + | |
| 487 | 518 | if (!nentries) |
| 488 | 519 | start_idx = addr >> MLX5_IMR_MTT_SHIFT; |
| 489 | 520 | nentries++; |
| @@ -536,6 +567,7 @@ struct mlx5_ib_mr *mlx5_ib_alloc_implicit_mr(struct mlx5_ib_pd *pd, · 46 unmodified lines | ||
| 536 | 567 | init_waitqueue_head(&imr->q_leaf_free); |
| 537 | 568 | atomic_set(&imr->num_leaf_free, 0); |
| 538 | 569 | atomic_set(&imr->num_pending_prefetch, 0); |
| 570 | + smp_store_release(&imr->live, 1); | |
| 539 | 571 | |
| 540 | 572 | return imr; |
| 541 | 573 | } |
| @@ -555,15 +587,19 @@ void mlx5_ib_free_implicit_mr(struct mlx5_ib_mr *imr) · 13 unmodified lines | ||
| 555 | 587 | if (mr->parent != imr) |
| 556 | 588 | continue; |
| 557 | 589 | |
| 590 | + mutex_lock(&umem_odp->umem_mutex); | |
| 558 | 591 | ib_umem_odp_unmap_dma_pages(umem_odp, ib_umem_start(umem_odp), |
| 559 | 592 | ib_umem_end(umem_odp)); |
| 560 | 593 | |
| 561 | − if (umem_odp->dying) | |
| 594 | + if (umem_odp->dying) { | |
| 595 | + mutex_unlock(&umem_odp->umem_mutex); | |
| 562 | 596 | continue; |
| 597 | + } | |
| 563 | 598 | |
| 564 | − WRITE_ONCE(umem_odp->dying, 1); | |
| 599 | + umem_odp->dying = 1; | |
| 565 | 600 | atomic_inc(&imr->num_leaf_free); |
| 566 | 601 | schedule_work(&umem_odp->work); |
| 602 | + mutex_unlock(&umem_odp->umem_mutex); | |
| 567 | 603 | } |
| 568 | 604 | up_read(&per_mm->umem_rwsem); |
| 569 | 605 | |
| @@ -773,7 +809,7 @@ next_mr: · 203 unmodified lines | ||
| 773 | 809 | switch (mmkey->type) { |
| 774 | 810 | case MLX5_MKEY_MR: |
| 775 | 811 | mr = container_of(mmkey, struct mlx5_ib_mr, mmkey); |
| 776 | − if (!mr->live || !mr->ibmr.pd) { | |
| 812 | + if (!smp_load_acquire(&mr->live) || !mr->ibmr.pd) { | |
| 777 | 813 | mlx5_ib_dbg(dev, "got dead MR\n"); |
| 778 | 814 | ret = -EFAULT; |
| 779 | 815 | goto srcu_unlock; |
| @@ -1641,12 +1677,12 @@ static bool num_pending_prefetch_inc(struct ib_pd *pd, · 861 unmodified lines | ||
| 1641 | 1677 | |
| 1642 | 1678 | mr = container_of(mmkey, struct mlx5_ib_mr, mmkey); |
| 1643 | 1679 | |
| 1644 | − if (mr->ibmr.pd != pd) { | |
| 1680 | + if (!smp_load_acquire(&mr->live)) { | |
| 1645 | 1681 | ret = false; |
| 1646 | 1682 | break; |
| 1647 | 1683 | } |
| 1648 | 1684 | |
| 1649 | − if (!mr->live) { | |
| 1685 | + if (mr->ibmr.pd != pd) { | |
| 1650 | 1686 | ret = false; |
| 1651 | 1687 | break; |
| 1652 | 1688 | } |
| @@ -230,8 +230,6 @@ static void pvrdma_free_srq(struct pvrdma_dev *dev, struct pvrdma_srq *srq) · 229 unmodified lines | ||
| 230 | 230 | |
| 231 | 231 | pvrdma_page_dir_cleanup(dev, &srq->pdir); |
| 232 | 232 | |
| 233 | − kfree(srq); | |
| 234 | − | |
| 235 | 233 | atomic_dec(&dev->num_srqs); |
| 236 | 234 | } |
| 237 | 235 | |
| @@ -182,12 +182,19 @@ void siw_qp_llp_close(struct siw_qp *qp) · 181 unmodified lines | ||
| 182 | 182 | */ |
| 183 | 183 | void siw_qp_llp_write_space(struct sock *sk) |
| 184 | 184 | { |
| 185 | − struct siw_cep *cep = sk_to_cep(sk); | |
| 185 | + struct siw_cep *cep; | |
| 186 | 186 | |
| 187 | − cep->sk_write_space(sk); | |
| 187 | + read_lock(&sk->sk_callback_lock); | |
| 188 | + | |
| 189 | + cep = sk_to_cep(sk); | |
| 190 | + if (cep) { | |
| 191 | + cep->sk_write_space(sk); | |
| 188 | 192 | |
| 189 | − if (!test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) | |
| 190 | − (void)siw_sq_start(cep->qp); | |
| 193 | + if (!test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) | |
| 194 | + (void)siw_sq_start(cep->qp); | |
| 195 | + } | |
| 196 | + | |
| 197 | + read_unlock(&sk->sk_callback_lock); | |
| 191 | 198 | } |
| 192 | 199 | |
| 193 | 200 | static int siw_qp_readq_init(struct siw_qp *qp, int irq_size, int orq_size) |
| @@ -643,8 +643,7 @@ static int v4l_stk_release(struct file *fp) · 642 unmodified lines | ||
| 643 | 643 | dev->owner = NULL; |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | − if (is_present(dev)) | |
| 647 | − usb_autopm_put_interface(dev->interface); | |
| 646 | + usb_autopm_put_interface(dev->interface); | |
| 648 | 647 | mutex_unlock(&dev->lock); |
| 649 | 648 | return v4l2_fh_release(fp); |
| 650 | 649 | } |
| @@ -527,6 +527,7 @@ static int fastrpc_dma_buf_attach(struct dma_buf *dmabuf, · 526 unmodified lines | ||
| 527 | 527 | FASTRPC_PHYS(buffer->phys), buffer->size); |
| 528 | 528 | if (ret < 0) { |
| 529 | 529 | dev_err(buffer->dev, "failed to get scatterlist from DMA API\n"); |
| 530 | + kfree(a); | |
| 530 | 531 | return -EINVAL; |
| 531 | 532 | } |
| 532 | 533 | |
| @@ -218,13 +218,21 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev) · 217 unmodified lines | ||
| 218 | 218 | { |
| 219 | 219 | int ret; |
| 220 | 220 | |
| 221 | + /* No need to enable the client if nothing is needed from it */ | |
| 222 | + if (!cldev->bus->fw_f_fw_ver_supported && | |
| 223 | + !cldev->bus->hbm_f_os_supported) | |
| 224 | + return; | |
| 225 | + | |
| 221 | 226 | ret = mei_cldev_enable(cldev); |
| 222 | 227 | if (ret) |
| 223 | 228 | return; |
| 224 | 229 | |
| 225 | − ret = mei_fwver(cldev); | |
| 226 | − if (ret < 0) | |
| 227 | − dev_err(&cldev->dev, "FW version command failed %d\n", ret); | |
| 230 | + if (cldev->bus->fw_f_fw_ver_supported) { | |
| 231 | + ret = mei_fwver(cldev); | |
| 232 | + if (ret < 0) | |
| 233 | + dev_err(&cldev->dev, "FW version command failed %d\n", | |
| 234 | + ret); | |
| 235 | + } | |
| 228 | 236 | |
| 229 | 237 | if (cldev->bus->hbm_f_os_supported) { |
| 230 | 238 | ret = mei_osver(cldev); |
| @@ -79,6 +79,9 @@ · 78 unmodified lines | ||
| 79 | 79 | #define MEI_DEV_ID_CNP_H 0xA360 /* Cannon Point H */ |
| 80 | 80 | #define MEI_DEV_ID_CNP_H_4 0xA364 /* Cannon Point H 4 (iTouch) */ |
| 81 | 81 | |
| 82 | +#define MEI_DEV_ID_CMP_LP 0x02e0 /* Comet Point LP */ | |
| 83 | +#define MEI_DEV_ID_CMP_LP_3 0x02e4 /* Comet Point LP 3 (iTouch) */ | |
| 84 | + | |
| 82 | 85 | #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ |
| 83 | 86 | |
| 84 | 87 | #define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */ |
| @@ -1355,6 +1355,8 @@ static bool mei_me_fw_type_sps(struct pci_dev *pdev) · 1354 unmodified lines | ||
| 1355 | 1355 | #define MEI_CFG_FW_SPS \ |
| 1356 | 1356 | .quirk_probe = mei_me_fw_type_sps |
| 1357 | 1357 | |
| 1358 | +#define MEI_CFG_FW_VER_SUPP \ | |
| 1359 | + .fw_ver_supported = 1 | |
| 1358 | 1360 | |
| 1359 | 1361 | #define MEI_CFG_ICH_HFS \ |
| 1360 | 1362 | .fw_status.count = 0 |
| @@ -1392,31 +1394,41 @@ static const struct mei_cfg mei_me_ich10_cfg = { · 31 unmodified lines | ||
| 1392 | 1394 | MEI_CFG_ICH10_HFS, |
| 1393 | 1395 | }; |
| 1394 | 1396 | |
| 1395 | −/* PCH devices */ | |
| 1396 | −static const struct mei_cfg mei_me_pch_cfg = { | |
| 1397 | +/* PCH6 devices */ | |
| 1398 | +static const struct mei_cfg mei_me_pch6_cfg = { | |
| 1397 | 1399 | MEI_CFG_PCH_HFS, |
| 1398 | 1400 | }; |
| 1399 | 1401 | |
| 1402 | +/* PCH7 devices */ | |
| 1403 | +static const struct mei_cfg mei_me_pch7_cfg = { | |
| 1404 | + MEI_CFG_PCH_HFS, | |
| 1405 | + MEI_CFG_FW_VER_SUPP, | |
| 1406 | +}; | |
| 1407 | + | |
| 1400 | 1408 | /* PCH Cougar Point and Patsburg with quirk for Node Manager exclusion */ |
| 1401 | 1409 | static const struct mei_cfg mei_me_pch_cpt_pbg_cfg = { |
| 1402 | 1410 | MEI_CFG_PCH_HFS, |
| 1411 | + MEI_CFG_FW_VER_SUPP, | |
| 1403 | 1412 | MEI_CFG_FW_NM, |
| 1404 | 1413 | }; |
| 1405 | 1414 | |
| 1406 | 1415 | /* PCH8 Lynx Point and newer devices */ |
| 1407 | 1416 | static const struct mei_cfg mei_me_pch8_cfg = { |
| 1408 | 1417 | MEI_CFG_PCH8_HFS, |
| 1418 | + MEI_CFG_FW_VER_SUPP, | |
| 1409 | 1419 | }; |
| 1410 | 1420 | |
| 1411 | 1421 | /* PCH8 Lynx Point with quirk for SPS Firmware exclusion */ |
| 1412 | 1422 | static const struct mei_cfg mei_me_pch8_sps_cfg = { |
| 1413 | 1423 | MEI_CFG_PCH8_HFS, |
| 1424 | + MEI_CFG_FW_VER_SUPP, | |
| 1414 | 1425 | MEI_CFG_FW_SPS, |
| 1415 | 1426 | }; |
| 1416 | 1427 | |
| 1417 | 1428 | /* Cannon Lake and newer devices */ |
| 1418 | 1429 | static const struct mei_cfg mei_me_pch12_cfg = { |
| 1419 | 1430 | MEI_CFG_PCH8_HFS, |
| 1431 | + MEI_CFG_FW_VER_SUPP, | |
| 1420 | 1432 | MEI_CFG_DMA_128, |
| 1421 | 1433 | }; |
| 1422 | 1434 | |
| @@ -1428,7 +1440,8 @@ static const struct mei_cfg *const mei_cfg_list[] = { · 5 unmodified lines | ||
| 1428 | 1440 | [MEI_ME_UNDEF_CFG] = NULL, |
| 1429 | 1441 | [MEI_ME_ICH_CFG] = &mei_me_ich_cfg, |
| 1430 | 1442 | [MEI_ME_ICH10_CFG] = &mei_me_ich10_cfg, |
| 1431 | − [MEI_ME_PCH_CFG] = &mei_me_pch_cfg, | |
| 1443 | + [MEI_ME_PCH6_CFG] = &mei_me_pch6_cfg, | |
| 1444 | + [MEI_ME_PCH7_CFG] = &mei_me_pch7_cfg, | |
| 1432 | 1445 | [MEI_ME_PCH_CPT_PBG_CFG] = &mei_me_pch_cpt_pbg_cfg, |
| 1433 | 1446 | [MEI_ME_PCH8_CFG] = &mei_me_pch8_cfg, |
| 1434 | 1447 | [MEI_ME_PCH8_SPS_CFG] = &mei_me_pch8_sps_cfg, |
| @@ -1473,6 +1486,8 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev, · 38 unmodified lines | ||
| 1473 | 1486 | mei_device_init(dev, &pdev->dev, &mei_me_hw_ops); |
| 1474 | 1487 | hw->cfg = cfg; |
| 1475 | 1488 | |
| 1489 | + dev->fw_f_fw_ver_supported = cfg->fw_ver_supported; | |
| 1490 | + | |
| 1476 | 1491 | return dev; |
| 1477 | 1492 | } |
| 1478 | 1493 | |
| @@ -20,11 +20,13 @@ · 19 unmodified lines | ||
| 20 | 20 | * @fw_status: FW status |
| 21 | 21 | * @quirk_probe: device exclusion quirk |
| 22 | 22 | * @dma_size: device DMA buffers size |
| 23 | + * @fw_ver_supported: is fw version retrievable from FW | |
| 23 | 24 | */ |
| 24 | 25 | struct mei_cfg { |
| 25 | 26 | const struct mei_fw_status fw_status; |
| 26 | 27 | bool (*quirk_probe)(struct pci_dev *pdev); |
| 27 | 28 | size_t dma_size[DMA_DSCR_NUM]; |
| 29 | + u32 fw_ver_supported:1; | |
| 28 | 30 | }; |
| 29 | 31 | |
| 30 | 32 | |
| @@ -62,7 +64,8 @@ struct mei_me_hw { · 31 unmodified lines | ||
| 62 | 64 | * @MEI_ME_UNDEF_CFG: Lower sentinel. |
| 63 | 65 | * @MEI_ME_ICH_CFG: I/O Controller Hub legacy devices. |
| 64 | 66 | * @MEI_ME_ICH10_CFG: I/O Controller Hub platforms Gen10 |
| 65 | − * @MEI_ME_PCH_CFG: Platform Controller Hub platforms (Up to Gen8). | |
| 67 | + * @MEI_ME_PCH6_CFG: Platform Controller Hub platforms (Gen6). | |
| 68 | + * @MEI_ME_PCH7_CFG: Platform Controller Hub platforms (Gen7). | |
| 66 | 69 | * @MEI_ME_PCH_CPT_PBG_CFG:Platform Controller Hub workstations |
| 67 | 70 | * with quirk for Node Manager exclusion. |
| 68 | 71 | * @MEI_ME_PCH8_CFG: Platform Controller Hub Gen8 and newer |
| @@ -77,7 +80,8 @@ enum mei_cfg_idx { · 8 unmodified lines | ||
| 77 | 80 | MEI_ME_UNDEF_CFG, |
| 78 | 81 | MEI_ME_ICH_CFG, |
| 79 | 82 | MEI_ME_ICH10_CFG, |
| 80 | − MEI_ME_PCH_CFG, | |
| 83 | + MEI_ME_PCH6_CFG, | |
| 84 | + MEI_ME_PCH7_CFG, | |
| 81 | 85 | MEI_ME_PCH_CPT_PBG_CFG, |
| 82 | 86 | MEI_ME_PCH8_CFG, |
| 83 | 87 | MEI_ME_PCH8_SPS_CFG, |
| @@ -426,6 +426,8 @@ struct mei_fw_version { · 425 unmodified lines | ||
| 426 | 426 | * |
| 427 | 427 | * @fw_ver : FW versions |
| 428 | 428 | * |
| 429 | + * @fw_f_fw_ver_supported : fw feature: fw version supported | |
| 430 | + * | |
| 429 | 431 | * @me_clients_rwsem: rw lock over me_clients list |
| 430 | 432 | * @me_clients : list of FW clients |
| 431 | 433 | * @me_clients_map : FW clients bit map |
| @@ -506,6 +508,8 @@ struct mei_device { · 74 unmodified lines | ||
| 506 | 508 | |
| 507 | 509 | struct mei_fw_version fw_ver[MEI_MAX_FW_VER_BLOCKS]; |
| 508 | 510 | |
| 511 | + unsigned int fw_f_fw_ver_supported:1; | |
| 512 | + | |
| 509 | 513 | struct rw_semaphore me_clients_rwsem; |
| 510 | 514 | struct list_head me_clients; |
| 511 | 515 | DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX); |
| @@ -61,13 +61,13 @@ static const struct pci_device_id mei_me_pci_tbl[] = { · 60 unmodified lines | ||
| 61 | 61 | {MEI_PCI_DEVICE(MEI_DEV_ID_ICH10_3, MEI_ME_ICH10_CFG)}, |
| 62 | 62 | {MEI_PCI_DEVICE(MEI_DEV_ID_ICH10_4, MEI_ME_ICH10_CFG)}, |
| 63 | 63 | |
| 64 | − {MEI_PCI_DEVICE(MEI_DEV_ID_IBXPK_1, MEI_ME_PCH_CFG)}, | |
| 65 | − {MEI_PCI_DEVICE(MEI_DEV_ID_IBXPK_2, MEI_ME_PCH_CFG)}, | |
| 64 | + {MEI_PCI_DEVICE(MEI_DEV_ID_IBXPK_1, MEI_ME_PCH6_CFG)}, | |
| 65 | + {MEI_PCI_DEVICE(MEI_DEV_ID_IBXPK_2, MEI_ME_PCH6_CFG)}, | |
| 66 | 66 | {MEI_PCI_DEVICE(MEI_DEV_ID_CPT_1, MEI_ME_PCH_CPT_PBG_CFG)}, |
| 67 | 67 | {MEI_PCI_DEVICE(MEI_DEV_ID_PBG_1, MEI_ME_PCH_CPT_PBG_CFG)}, |
| 68 | − {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_1, MEI_ME_PCH_CFG)}, | |
| 69 | − {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_2, MEI_ME_PCH_CFG)}, | |
| 70 | − {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_3, MEI_ME_PCH_CFG)}, | |
| 68 | + {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_1, MEI_ME_PCH7_CFG)}, | |
| 69 | + {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_2, MEI_ME_PCH7_CFG)}, | |
| 70 | + {MEI_PCI_DEVICE(MEI_DEV_ID_PPT_3, MEI_ME_PCH7_CFG)}, | |
| 71 | 71 | {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_H, MEI_ME_PCH8_SPS_CFG)}, |
| 72 | 72 | {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_W, MEI_ME_PCH8_SPS_CFG)}, |
| 73 | 73 | {MEI_PCI_DEVICE(MEI_DEV_ID_LPT_LP, MEI_ME_PCH8_CFG)}, |
| @@ -96,6 +96,9 @@ static const struct pci_device_id mei_me_pci_tbl[] = { · 22 unmodified lines | ||
| 96 | 96 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H, MEI_ME_PCH12_CFG)}, |
| 97 | 97 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H_4, MEI_ME_PCH8_CFG)}, |
| 98 | 98 | |
| 99 | + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP, MEI_ME_PCH12_CFG)}, | |
| 100 | + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP_3, MEI_ME_PCH8_CFG)}, | |
| 101 | + | |
| 99 | 102 | {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, |
| 100 | 103 | |
| 101 | 104 | {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH12_CFG)}, |
| @@ -134,16 +134,15 @@ static void au_write_buf16(struct nand_chip *this, const u_char *buf, int len) · 133 unmodified lines | ||
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | 136 | * au_read_buf16 - read chip data into buffer |
| 137 | − * @mtd: MTD device structure | |
| 137 | + * @this: NAND chip object | |
| 138 | 138 | * @buf: buffer to store date |
| 139 | 139 | * @len: number of bytes to read |
| 140 | 140 | * |
| 141 | 141 | * read function for 16bit buswidth |
| 142 | 142 | */ |
| 143 | −static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len) | |
| 143 | +static void au_read_buf16(struct nand_chip *this, u_char *buf, int len) | |
| 144 | 144 | { |
| 145 | 145 | int i; |
| 146 | − struct nand_chip *this = mtd_to_nand(mtd); | |
| 147 | 146 | u16 *p = (u16 *) buf; |
| 148 | 147 | len >>= 1; |
| 149 | 148 | |
| @@ -487,7 +487,7 @@ static int write_sr(struct spi_nor *nor, u8 val) · 486 unmodified lines | ||
| 487 | 487 | SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_WRSR, 1), |
| 488 | 488 | SPI_MEM_OP_NO_ADDR, |
| 489 | 489 | SPI_MEM_OP_NO_DUMMY, |
| 490 | − SPI_MEM_OP_DATA_IN(1, nor->bouncebuf, 1)); | |
| 490 | + SPI_MEM_OP_DATA_OUT(1, nor->bouncebuf, 1)); | |
| 491 | 491 | |
| 492 | 492 | return spi_mem_exec_op(nor->spimem, &op); |
| 493 | 493 | } |
| @@ -705,7 +705,7 @@ qca8k_setup(struct dsa_switch *ds) · 704 unmodified lines | ||
| 705 | 705 | BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S); |
| 706 | 706 | |
| 707 | 707 | /* Setup connection between CPU port & user ports */ |
| 708 | − for (i = 0; i < DSA_MAX_PORTS; i++) { | |
| 708 | + for (i = 0; i < QCA8K_NUM_PORTS; i++) { | |
| 709 | 709 | /* CPU port gets connected to all user ports of the switch */ |
| 710 | 710 | if (dsa_is_cpu_port(ds, i)) { |
| 711 | 711 | qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT), |
| @@ -1077,7 +1077,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) · 365 unmodified lines | ||
| 1077 | 1077 | if (id != QCA8K_ID_QCA8337) |
| 1078 | 1078 | return -ENODEV; |
| 1079 | 1079 | |
| 1080 | − priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS); | |
| 1080 | + priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS); | |
| 1081 | 1081 | if (!priv->ds) |
| 1082 | 1082 | return -ENOMEM; |
| 1083 | 1083 | |
| @@ -339,10 +339,12 @@ int rtl8366_vlan_prepare(struct dsa_switch *ds, int port, · 338 unmodified lines | ||
| 339 | 339 | const struct switchdev_obj_port_vlan *vlan) |
| 340 | 340 | { |
| 341 | 341 | struct realtek_smi *smi = ds->priv; |
| 342 | + u16 vid; | |
| 342 | 343 | int ret; |
| 343 | 344 | |
| 344 | − if (!smi->ops->is_vlan_valid(smi, port)) | |
| 345 | − return -EINVAL; | |
| 345 | + for (vid = vlan->vid_begin; vid < vlan->vid_end; vid++) | |
| 346 | + if (!smi->ops->is_vlan_valid(smi, vid)) | |
| 347 | + return -EINVAL; | |
| 346 | 348 | |
| 347 | 349 | dev_info(smi->dev, "prepare VLANs %04x..%04x\n", |
| 348 | 350 | vlan->vid_begin, vlan->vid_end); |
| @@ -370,8 +372,9 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, · 21 unmodified lines | ||
| 370 | 372 | u16 vid; |
| 371 | 373 | int ret; |
| 372 | 374 | |
| 373 | − if (!smi->ops->is_vlan_valid(smi, port)) | |
| 374 | − return; | |
| 375 | + for (vid = vlan->vid_begin; vid < vlan->vid_end; vid++) | |
| 376 | + if (!smi->ops->is_vlan_valid(smi, vid)) | |
| 377 | + return; | |
| 375 | 378 | |
| 376 | 379 | dev_info(smi->dev, "add VLAN on port %d, %s, %s\n", |
| 377 | 380 | port, |
| @@ -507,7 +507,8 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 506 unmodified lines | ||
| 507 | 507 | irq = of_irq_get(intc, 0); |
| 508 | 508 | if (irq <= 0) { |
| 509 | 509 | dev_err(smi->dev, "failed to get parent IRQ\n"); |
| 510 | − return irq ? irq : -EINVAL; | |
| 510 | + ret = irq ? irq : -EINVAL; | |
| 511 | + goto out_put_node; | |
| 511 | 512 | } |
| 512 | 513 | |
| 513 | 514 | /* This clears the IRQ status register */ |
| @@ -515,7 +516,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line | ||
| 515 | 516 | &val); |
| 516 | 517 | if (ret) { |
| 517 | 518 | dev_err(smi->dev, "can't read interrupt status\n"); |
| 518 | − return ret; | |
| 519 | + goto out_put_node; | |
| 519 | 520 | } |
| 520 | 521 | |
| 521 | 522 | /* Fetch IRQ edge information from the descriptor */ |
| @@ -537,7 +538,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 15 unmodified lines | ||
| 537 | 538 | val); |
| 538 | 539 | if (ret) { |
| 539 | 540 | dev_err(smi->dev, "could not configure IRQ polarity\n"); |
| 540 | − return ret; | |
| 541 | + goto out_put_node; | |
| 541 | 542 | } |
| 542 | 543 | |
| 543 | 544 | ret = devm_request_threaded_irq(smi->dev, irq, NULL, |
| @@ -545,7 +546,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line | ||
| 545 | 546 | "RTL8366RB", smi); |
| 546 | 547 | if (ret) { |
| 547 | 548 | dev_err(smi->dev, "unable to request irq: %d\n", ret); |
| 548 | − return ret; | |
| 549 | + goto out_put_node; | |
| 549 | 550 | } |
| 550 | 551 | smi->irqdomain = irq_domain_add_linear(intc, |
| 551 | 552 | RTL8366RB_NUM_INTERRUPT, |
| @@ -553,12 +554,15 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line | ||
| 553 | 554 | smi); |
| 554 | 555 | if (!smi->irqdomain) { |
| 555 | 556 | dev_err(smi->dev, "failed to create IRQ domain\n"); |
| 556 | − return -EINVAL; | |
| 557 | + ret = -EINVAL; | |
| 558 | + goto out_put_node; | |
| 557 | 559 | } |
| 558 | 560 | for (i = 0; i < smi->num_ports; i++) |
| 559 | 561 | irq_set_parent(irq_create_mapping(smi->irqdomain, i), irq); |
| 560 | 562 | |
| 561 | − return 0; | |
| 563 | +out_put_node: | |
| 564 | + of_node_put(intc); | |
| 565 | + return ret; | |
| 562 | 566 | } |
| 563 | 567 | |
| 564 | 568 | static int rtl8366rb_set_addr(struct realtek_smi *smi) |
| @@ -1897,7 +1897,9 @@ static int sja1105_set_ageing_time(struct dsa_switch *ds, · 1896 unmodified lines | ||
| 1897 | 1897 | return sja1105_static_config_reload(priv); |
| 1898 | 1898 | } |
| 1899 | 1899 | |
| 1900 | −/* Caller must hold priv->tagger_data.meta_lock */ | |
| 1900 | +/* Must be called only with priv->tagger_data.state bit | |
| 1901 | + * SJA1105_HWTS_RX_EN cleared | |
| 1902 | + */ | |
| 1901 | 1903 | static int sja1105_change_rxtstamping(struct sja1105_private *priv, |
| 1902 | 1904 | bool on) |
| 1903 | 1905 | { |
| @@ -1954,16 +1956,17 @@ static int sja1105_hwtstamp_set(struct dsa_switch *ds, int port, · 50 unmodified lines | ||
| 1954 | 1956 | break; |
| 1955 | 1957 | } |
| 1956 | 1958 | |
| 1957 | − if (rx_on != priv->tagger_data.hwts_rx_en) { | |
| 1958 | − spin_lock(&priv->tagger_data.meta_lock); | |
| 1959 | + if (rx_on != test_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state)) { | |
| 1960 | + clear_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state); | |
| 1961 | + | |
| 1959 | 1962 | rc = sja1105_change_rxtstamping(priv, rx_on); |
| 1960 | − spin_unlock(&priv->tagger_data.meta_lock); | |
| 1961 | 1963 | if (rc < 0) { |
| 1962 | 1964 | dev_err(ds->dev, |
| 1963 | 1965 | "Failed to change RX timestamping: %d\n", rc); |
| 1964 | − return -EFAULT; | |
| 1966 | + return rc; | |
| 1965 | 1967 | } |
| 1966 | − priv->tagger_data.hwts_rx_en = rx_on; | |
| 1968 | + if (rx_on) | |
| 1969 | + set_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state); | |
| 1967 | 1970 | } |
| 1968 | 1971 | |
| 1969 | 1972 | if (copy_to_user(ifr->ifr_data, &config, sizeof(config))) |
| @@ -1982,7 +1985,7 @@ static int sja1105_hwtstamp_get(struct dsa_switch *ds, int port, · 12 unmodified lines | ||
| 1982 | 1985 | config.tx_type = HWTSTAMP_TX_ON; |
| 1983 | 1986 | else |
| 1984 | 1987 | config.tx_type = HWTSTAMP_TX_OFF; |
| 1985 | − if (priv->tagger_data.hwts_rx_en) | |
| 1988 | + if (test_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state)) | |
| 1986 | 1989 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; |
| 1987 | 1990 | else |
| 1988 | 1991 | config.rx_filter = HWTSTAMP_FILTER_NONE; |
| @@ -2005,12 +2008,12 @@ static void sja1105_rxtstamp_work(struct work_struct *work) · 16 unmodified lines | ||
| 2005 | 2008 | |
| 2006 | 2009 | mutex_lock(&priv->ptp_lock); |
| 2007 | 2010 | |
| 2008 | − now = priv->tstamp_cc.read(&priv->tstamp_cc); | |
| 2009 | − | |
| 2010 | 2011 | while ((skb = skb_dequeue(&data->skb_rxtstamp_queue)) != NULL) { |
| 2011 | 2012 | struct skb_shared_hwtstamps *shwt = skb_hwtstamps(skb); |
| 2012 | 2013 | u64 ts; |
| 2013 | 2014 | |
| 2015 | + now = priv->tstamp_cc.read(&priv->tstamp_cc); | |
| 2016 | + | |
| 2014 | 2017 | *shwt = (struct skb_shared_hwtstamps) {0}; |
| 2015 | 2018 | |
| 2016 | 2019 | ts = SJA1105_SKB_CB(skb)->meta_tstamp; |
| @@ -2031,7 +2034,7 @@ static bool sja1105_port_rxtstamp(struct dsa_switch *ds, int port, · 14 unmodified lines | ||
| 2031 | 2034 | struct sja1105_private *priv = ds->priv; |
| 2032 | 2035 | struct sja1105_tagger_data *data = &priv->tagger_data; |
| 2033 | 2036 | |
| 2034 | − if (!data->hwts_rx_en) | |
| 2037 | + if (!test_bit(SJA1105_HWTS_RX_EN, &data->state)) | |
| 2035 | 2038 | return false; |
| 2036 | 2039 | |
| 2037 | 2040 | /* We need to read the full PTP clock to reconstruct the Rx |
| @@ -2201,6 +2204,7 @@ static int sja1105_probe(struct spi_device *spi) · 163 unmodified lines | ||
| 2201 | 2204 | tagger_data = &priv->tagger_data; |
| 2202 | 2205 | skb_queue_head_init(&tagger_data->skb_rxtstamp_queue); |
| 2203 | 2206 | INIT_WORK(&tagger_data->rxtstamp_work, sja1105_rxtstamp_work); |
| 2207 | + spin_lock_init(&tagger_data->meta_lock); | |
| 2204 | 2208 | |
| 2205 | 2209 | /* Connections between dsa_port and sja1105_port */ |
| 2206 | 2210 | for (i = 0; i < SJA1105_NUM_PORTS; i++) { |
| @@ -409,7 +409,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv) · 408 unmodified lines | ||
| 409 | 409 | rc = static_config_buf_prepare_for_upload(priv, config_buf, buf_len); |
| 410 | 410 | if (rc < 0) { |
| 411 | 411 | dev_err(dev, "Invalid config, cannot upload\n"); |
| 412 | − return -EINVAL; | |
| 412 | + rc = -EINVAL; | |
| 413 | + goto out; | |
| 413 | 414 | } |
| 414 | 415 | /* Prevent PHY jabbering during switch reset by inhibiting |
| 415 | 416 | * Tx on all ports and waiting for current packet to drain. |
| @@ -418,7 +419,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv) · 2 unmodified lines | ||
| 418 | 419 | rc = sja1105_inhibit_tx(priv, port_bitmap, true); |
| 419 | 420 | if (rc < 0) { |
| 420 | 421 | dev_err(dev, "Failed to inhibit Tx on ports\n"); |
| 421 | − return -ENXIO; | |
| 422 | + rc = -ENXIO; | |
| 423 | + goto out; | |
| 422 | 424 | } |
| 423 | 425 | /* Wait for an eventual egress packet to finish transmission |
| 424 | 426 | * (reach IFG). It is guaranteed that a second one will not |
| @@ -526,7 +526,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) · 525 unmodified lines | ||
| 526 | 526 | struct device *dev = &ag->pdev->dev; |
| 527 | 527 | struct net_device *ndev = ag->ndev; |
| 528 | 528 | static struct mii_bus *mii_bus; |
| 529 | − struct device_node *np; | |
| 529 | + struct device_node *np, *mnp; | |
| 530 | 530 | int err; |
| 531 | 531 | |
| 532 | 532 | np = dev->of_node; |
| @@ -571,7 +571,9 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) · 38 unmodified lines | ||
| 571 | 571 | msleep(200); |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | − err = of_mdiobus_register(mii_bus, np); | |
| 574 | + mnp = of_get_child_by_name(np, "mdio"); | |
| 575 | + err = of_mdiobus_register(mii_bus, mnp); | |
| 576 | + of_node_put(mnp); | |
| 575 | 577 | if (err) |
| 576 | 578 | goto mdio_err_put_clk; |
| 577 | 579 | |
| @@ -137,13 +137,12 @@ static int uldrx_handler(struct sge_rspq *q, const __be64 *rsp, · 136 unmodified lines | ||
| 137 | 137 | static int alloc_uld_rxqs(struct adapter *adap, |
| 138 | 138 | struct sge_uld_rxq_info *rxq_info, bool lro) |
| 139 | 139 | { |
| 140 | − struct sge *s = &adap->sge; | |
| 141 | 140 | unsigned int nq = rxq_info->nrxq + rxq_info->nciq; |
| 141 | + int i, err, msi_idx, que_idx = 0, bmap_idx = 0; | |
| 142 | 142 | struct sge_ofld_rxq *q = rxq_info->uldrxq; |
| 143 | 143 | unsigned short *ids = rxq_info->rspq_id; |
| 144 | − unsigned int bmap_idx = 0; | |
| 144 | + struct sge *s = &adap->sge; | |
| 145 | 145 | unsigned int per_chan; |
| 146 | − int i, err, msi_idx, que_idx = 0; | |
| 147 | 146 | |
| 148 | 147 | per_chan = rxq_info->nrxq / adap->params.nports; |
| 149 | 148 | |
| @@ -161,6 +160,10 @@ static int alloc_uld_rxqs(struct adapter *adap, · 11 unmodified lines | ||
| 161 | 160 | |
| 162 | 161 | if (msi_idx >= 0) { |
| 163 | 162 | bmap_idx = get_msix_idx_from_bmap(adap); |
| 163 | + if (bmap_idx < 0) { | |
| 164 | + err = -ENOSPC; | |
| 165 | + goto freeout; | |
| 166 | + } | |
| 164 | 167 | msi_idx = adap->msix_info_ulds[bmap_idx].idx; |
| 165 | 168 | } |
| 166 | 169 | err = t4_sge_alloc_rxq(adap, &q->rspq, false, |
| @@ -148,11 +148,15 @@ static int mdio_sc_cfg_reg_write(struct hns_mdio_device *mdio_dev, · 147 unmodified lines | ||
| 148 | 148 | { |
| 149 | 149 | u32 time_cnt; |
| 150 | 150 | u32 reg_value; |
| 151 | + int ret; | |
| 151 | 152 | |
| 152 | 153 | regmap_write(mdio_dev->subctrl_vbase, cfg_reg, set_val); |
| 153 | 154 | |
| 154 | 155 | for (time_cnt = MDIO_TIMEOUT; time_cnt; time_cnt--) { |
| 155 | − regmap_read(mdio_dev->subctrl_vbase, st_reg, ®_value); | |
| 156 | + ret = regmap_read(mdio_dev->subctrl_vbase, st_reg, ®_value); | |
| 157 | + if (ret) | |
| 158 | + return ret; | |
| 159 | + | |
| 156 | 160 | reg_value &= st_msk; |
| 157 | 161 | if ((!!check_st) == (!!reg_value)) |
| 158 | 162 | break; |
| @@ -112,17 +112,11 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, · 111 unmodified lines | ||
| 112 | 112 | u32 out[MLX5_ST_SZ_DW(destroy_mkey_out)] = {0}; |
| 113 | 113 | u32 in[MLX5_ST_SZ_DW(destroy_mkey_in)] = {0}; |
| 114 | 114 | struct xarray *mkeys = &dev->priv.mkey_table; |
| 115 | − struct mlx5_core_mkey *deleted_mkey; | |
| 116 | 115 | unsigned long flags; |
| 117 | 116 | |
| 118 | 117 | xa_lock_irqsave(mkeys, flags); |
| 119 | − deleted_mkey = __xa_erase(mkeys, mlx5_base_mkey(mkey->key)); | |
| 118 | + __xa_erase(mkeys, mlx5_base_mkey(mkey->key)); | |
| 120 | 119 | xa_unlock_irqrestore(mkeys, flags); |
| 121 | − if (!deleted_mkey) { | |
| 122 | − mlx5_core_dbg(dev, "failed xarray delete of mkey 0x%x\n", | |
| 123 | − mlx5_base_mkey(mkey->key)); | |
| 124 | − return -ENOENT; | |
| 125 | − } | |
| 126 | 120 | |
| 127 | 121 | MLX5_SET(destroy_mkey_in, in, opcode, MLX5_CMD_OP_DESTROY_MKEY); |
| 128 | 122 | MLX5_SET(destroy_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key)); |
| @@ -137,7 +137,8 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool, · 136 unmodified lines | ||
| 137 | 137 | |
| 138 | 138 | icm_mr->icm_start_addr = icm_mr->dm.addr; |
| 139 | 139 | |
| 140 | − align_diff = icm_mr->icm_start_addr % align_base; | |
| 140 | + /* align_base is always a power of 2 */ | |
| 141 | + align_diff = icm_mr->icm_start_addr & (align_base - 1); | |
| 141 | 142 | if (align_diff) |
| 142 | 143 | icm_mr->used_length = align_base - align_diff; |
| 143 | 144 | |
| @@ -388,13 +388,14 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 387 unmodified lines | ||
| 388 | 388 | continue; |
| 389 | 389 | |
| 390 | 390 | phy = of_phy_find_device(phy_node); |
| 391 | + of_node_put(phy_node); | |
| 391 | 392 | if (!phy) |
| 392 | 393 | continue; |
| 393 | 394 | |
| 394 | 395 | err = ocelot_probe_port(ocelot, port, regs, phy); |
| 395 | 396 | if (err) { |
| 396 | 397 | of_node_put(portnp); |
| 397 | − return err; | |
| 398 | + goto out_put_ports; | |
| 398 | 399 | } |
| 399 | 400 | |
| 400 | 401 | phy_mode = of_get_phy_mode(portnp); |
| @@ -422,7 +423,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 21 unmodified lines | ||
| 422 | 423 | "invalid phy mode for port%d, (Q)SGMII only\n", |
| 423 | 424 | port); |
| 424 | 425 | of_node_put(portnp); |
| 425 | − return -EINVAL; | |
| 426 | + err = -EINVAL; | |
| 427 | + goto out_put_ports; | |
| 426 | 428 | } |
| 427 | 429 | |
| 428 | 430 | serdes = devm_of_phy_get(ocelot->dev, portnp, NULL); |
| @@ -435,7 +437,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 435 | 437 | "missing SerDes phys for port%d\n", |
| 436 | 438 | port); |
| 437 | 439 | |
| 438 | − goto err_probe_ports; | |
| 440 | + of_node_put(portnp); | |
| 441 | + goto out_put_ports; | |
| 439 | 442 | } |
| 440 | 443 | |
| 441 | 444 | ocelot->ports[port]->serdes = serdes; |
| @@ -447,9 +450,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 5 unmodified lines | ||
| 447 | 450 | |
| 448 | 451 | dev_info(&pdev->dev, "Ocelot switch probed\n"); |
| 449 | 452 | |
| 450 | − return 0; | |
| 451 | − | |
| 452 | −err_probe_ports: | |
| 453 | +out_put_ports: | |
| 454 | + of_node_put(ports); | |
| 453 | 455 | return err; |
| 454 | 456 | } |
| 455 | 457 | |
| @@ -20,6 +20,7 @@ if NET_VENDOR_PENSANDO · 19 unmodified lines | ||
| 20 | 20 | config IONIC |
| 21 | 21 | tristate "Pensando Ethernet IONIC Support" |
| 22 | 22 | depends on 64BIT && PCI |
| 23 | + select NET_DEVLINK | |
| 23 | 24 | help |
| 24 | 25 | This enables the support for the Pensando family of Ethernet |
| 25 | 26 | adapters. More specific information on this driver can be |
| @@ -2787,6 +2787,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) · 2786 unmodified lines | ||
| 2787 | 2787 | netdev_err(qdev->ndev, |
| 2788 | 2788 | "PCI mapping failed with error: %d\n", |
| 2789 | 2789 | err); |
| 2790 | + dev_kfree_skb_irq(skb); | |
| 2790 | 2791 | ql_free_large_buffers(qdev); |
| 2791 | 2792 | return -ENOMEM; |
| 2792 | 2793 | } |
| @@ -282,7 +282,6 @@ struct netsec_desc_ring { · 281 unmodified lines | ||
| 282 | 282 | void *vaddr; |
| 283 | 283 | u16 head, tail; |
| 284 | 284 | u16 xdp_xmit; /* netsec_xdp_xmit packets */ |
| 285 | − bool is_xdp; | |
| 286 | 285 | struct page_pool *page_pool; |
| 287 | 286 | struct xdp_rxq_info xdp_rxq; |
| 288 | 287 | spinlock_t lock; /* XDP tx queue locking */ |
| @@ -634,8 +633,7 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv) · 345 unmodified lines | ||
| 634 | 633 | unsigned int bytes; |
| 635 | 634 | int cnt = 0; |
| 636 | 635 | |
| 637 | − if (dring->is_xdp) | |
| 638 | − spin_lock(&dring->lock); | |
| 636 | + spin_lock(&dring->lock); | |
| 639 | 637 | |
| 640 | 638 | bytes = 0; |
| 641 | 639 | entry = dring->vaddr + DESC_SZ * tail; |
| @@ -682,8 +680,8 @@ next: · 40 unmodified lines | ||
| 682 | 680 | entry = dring->vaddr + DESC_SZ * tail; |
| 683 | 681 | cnt++; |
| 684 | 682 | } |
| 685 | − if (dring->is_xdp) | |
| 686 | − spin_unlock(&dring->lock); | |
| 683 | + | |
| 684 | + spin_unlock(&dring->lock); | |
| 687 | 685 | |
| 688 | 686 | if (!cnt) |
| 689 | 687 | return false; |
| @@ -799,9 +797,6 @@ static void netsec_set_tx_de(struct netsec_priv *priv, · 109 unmodified lines | ||
| 799 | 797 | de->data_buf_addr_lw = lower_32_bits(desc->dma_addr); |
| 800 | 798 | de->buf_len_info = (tx_ctrl->tcp_seg_len << 16) | desc->len; |
| 801 | 799 | de->attr = attr; |
| 802 | − /* under spin_lock if using XDP */ | |
| 803 | − if (!dring->is_xdp) | |
| 804 | − dma_wmb(); | |
| 805 | 800 | |
| 806 | 801 | dring->desc[idx] = *desc; |
| 807 | 802 | if (desc->buf_type == TYPE_NETSEC_SKB) |
| @@ -1123,12 +1118,10 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 315 unmodified lines | ||
| 1123 | 1118 | u16 tso_seg_len = 0; |
| 1124 | 1119 | int filled; |
| 1125 | 1120 | |
| 1126 | − if (dring->is_xdp) | |
| 1127 | − spin_lock_bh(&dring->lock); | |
| 1121 | + spin_lock_bh(&dring->lock); | |
| 1128 | 1122 | filled = netsec_desc_used(dring); |
| 1129 | 1123 | if (netsec_check_stop_tx(priv, filled)) { |
| 1130 | − if (dring->is_xdp) | |
| 1131 | − spin_unlock_bh(&dring->lock); | |
| 1124 | + spin_unlock_bh(&dring->lock); | |
| 1132 | 1125 | net_warn_ratelimited("%s %s Tx queue full\n", |
| 1133 | 1126 | dev_name(priv->dev), ndev->name); |
| 1134 | 1127 | return NETDEV_TX_BUSY; |
| @@ -1161,8 +1154,7 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 26 unmodified lines | ||
| 1161 | 1154 | tx_desc.dma_addr = dma_map_single(priv->dev, skb->data, |
| 1162 | 1155 | skb_headlen(skb), DMA_TO_DEVICE); |
| 1163 | 1156 | if (dma_mapping_error(priv->dev, tx_desc.dma_addr)) { |
| 1164 | − if (dring->is_xdp) | |
| 1165 | − spin_unlock_bh(&dring->lock); | |
| 1157 | + spin_unlock_bh(&dring->lock); | |
| 1166 | 1158 | netif_err(priv, drv, priv->ndev, |
| 1167 | 1159 | "%s: DMA mapping failed\n", __func__); |
| 1168 | 1160 | ndev->stats.tx_dropped++; |
| @@ -1177,8 +1169,7 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 8 unmodified lines | ||
| 1177 | 1169 | netdev_sent_queue(priv->ndev, skb->len); |
| 1178 | 1170 | |
| 1179 | 1171 | netsec_set_tx_de(priv, dring, &tx_ctrl, &tx_desc, skb); |
| 1180 | − if (dring->is_xdp) | |
| 1181 | − spin_unlock_bh(&dring->lock); | |
| 1172 | + spin_unlock_bh(&dring->lock); | |
| 1182 | 1173 | netsec_write(priv, NETSEC_REG_NRM_TX_PKTCNT, 1); /* submit another tx */ |
| 1183 | 1174 | |
| 1184 | 1175 | return NETDEV_TX_OK; |
| @@ -1262,7 +1253,6 @@ err: · 77 unmodified lines | ||
| 1262 | 1253 | static void netsec_setup_tx_dring(struct netsec_priv *priv) |
| 1263 | 1254 | { |
| 1264 | 1255 | struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_TX]; |
| 1265 | − struct bpf_prog *xdp_prog = READ_ONCE(priv->xdp_prog); | |
| 1266 | 1256 | int i; |
| 1267 | 1257 | |
| 1268 | 1258 | for (i = 0; i < DESC_NUM; i++) { |
| @@ -1275,12 +1265,6 @@ static void netsec_setup_tx_dring(struct netsec_priv *priv) · 6 unmodified lines | ||
| 1275 | 1265 | */ |
| 1276 | 1266 | de->attr = 1U << NETSEC_TX_SHIFT_OWN_FIELD; |
| 1277 | 1267 | } |
| 1278 | − | |
| 1279 | − if (xdp_prog) | |
| 1280 | − dring->is_xdp = true; | |
| 1281 | − else | |
| 1282 | − dring->is_xdp = false; | |
| 1283 | − | |
| 1284 | 1268 | } |
| 1285 | 1269 | |
| 1286 | 1270 | static int netsec_setup_rx_dring(struct netsec_priv *priv) |
| @@ -401,8 +401,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 400 unmodified lines | ||
| 401 | 401 | int numhashregs = (hw->multicast_filter_bins >> 5); |
| 402 | 402 | int mcbitslog2 = hw->mcast_bits_log2; |
| 403 | 403 | unsigned int value; |
| 404 | + u32 mc_filter[8]; | |
| 404 | 405 | int i; |
| 405 | 406 | |
| 407 | + memset(mc_filter, 0, sizeof(mc_filter)); | |
| 408 | + | |
| 406 | 409 | value = readl(ioaddr + GMAC_PACKET_FILTER); |
| 407 | 410 | value &= ~GMAC_PACKET_FILTER_HMC; |
| 408 | 411 | value &= ~GMAC_PACKET_FILTER_HPF; |
| @@ -416,16 +419,13 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 7 unmodified lines | ||
| 416 | 419 | /* Pass all multi */ |
| 417 | 420 | value |= GMAC_PACKET_FILTER_PM; |
| 418 | 421 | /* Set all the bits of the HASH tab */ |
| 419 | − for (i = 0; i < numhashregs; i++) | |
| 420 | − writel(0xffffffff, ioaddr + GMAC_HASH_TAB(i)); | |
| 422 | + memset(mc_filter, 0xff, sizeof(mc_filter)); | |
| 421 | 423 | } else if (!netdev_mc_empty(dev)) { |
| 422 | 424 | struct netdev_hw_addr *ha; |
| 423 | − u32 mc_filter[8]; | |
| 424 | 425 | |
| 425 | 426 | /* Hash filter for multicast */ |
| 426 | 427 | value |= GMAC_PACKET_FILTER_HMC; |
| 427 | 428 | |
| 428 | − memset(mc_filter, 0, sizeof(mc_filter)); | |
| 429 | 429 | netdev_for_each_mc_addr(ha, dev) { |
| 430 | 430 | /* The upper n bits of the calculated CRC are used to |
| 431 | 431 | * index the contents of the hash table. The number of |
| @@ -440,10 +440,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 8 unmodified lines | ||
| 440 | 440 | */ |
| 441 | 441 | mc_filter[bit_nr >> 5] |= (1 << (bit_nr & 0x1f)); |
| 442 | 442 | } |
| 443 | − for (i = 0; i < numhashregs; i++) | |
| 444 | − writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i)); | |
| 445 | 443 | } |
| 446 | 444 | |
| 445 | + for (i = 0; i < numhashregs; i++) | |
| 446 | + writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i)); | |
| 447 | + | |
| 447 | 448 | value |= GMAC_PACKET_FILTER_HPF; |
| 448 | 449 | |
| 449 | 450 | /* Handle multiple unicast addresses */ |
| @@ -84,7 +84,7 @@ · 83 unmodified lines | ||
| 84 | 84 | #define XGMAC_TSIE BIT(12) |
| 85 | 85 | #define XGMAC_LPIIE BIT(5) |
| 86 | 86 | #define XGMAC_PMTIE BIT(4) |
| 87 | −#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE | XGMAC_TSIE) | |
| 87 | +#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE) | |
| 88 | 88 | #define XGMAC_Qx_TX_FLOW_CTRL(x) (0x00000070 + (x) * 4) |
| 89 | 89 | #define XGMAC_PT GENMASK(31, 16) |
| 90 | 90 | #define XGMAC_PT_SHIFT 16 |
| @@ -122,6 +122,7 @@ · 31 unmodified lines | ||
| 122 | 122 | #define XGMAC_HWFEAT_GMIISEL BIT(1) |
| 123 | 123 | #define XGMAC_HW_FEATURE1 0x00000120 |
| 124 | 124 | #define XGMAC_HWFEAT_L3L4FNUM GENMASK(30, 27) |
| 125 | +#define XGMAC_HWFEAT_HASHTBLSZ GENMASK(25, 24) | |
| 125 | 126 | #define XGMAC_HWFEAT_RSSEN BIT(20) |
| 126 | 127 | #define XGMAC_HWFEAT_TSOEN BIT(18) |
| 127 | 128 | #define XGMAC_HWFEAT_SPHEN BIT(17) |
| @@ -472,7 +472,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw, · 471 unmodified lines | ||
| 472 | 472 | dwxgmac2_set_mchash(ioaddr, mc_filter, mcbitslog2); |
| 473 | 473 | |
| 474 | 474 | /* Handle multiple unicast addresses */ |
| 475 | − if (netdev_uc_count(dev) > XGMAC_ADDR_MAX) { | |
| 475 | + if (netdev_uc_count(dev) > hw->unicast_filter_entries) { | |
| 476 | 476 | value |= XGMAC_FILTER_PR; |
| 477 | 477 | } else { |
| 478 | 478 | struct netdev_hw_addr *ha; |
| @@ -523,8 +523,8 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, · 44 unmodified lines | ||
| 523 | 523 | struct stmmac_rss *cfg, u32 num_rxq) |
| 524 | 524 | { |
| 525 | 525 | void __iomem *ioaddr = hw->pcsr; |
| 526 | + u32 value, *key; | |
| 526 | 527 | int i, ret; |
| 527 | − u32 value; | |
| 528 | 528 | |
| 529 | 529 | value = readl(ioaddr + XGMAC_RSS_CTRL); |
| 530 | 530 | if (!cfg || !cfg->enable) { |
| @@ -533,8 +533,9 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, · 2 unmodified lines | ||
| 533 | 533 | return 0; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | − for (i = 0; i < (sizeof(cfg->key) / sizeof(u32)); i++) { | |
| 537 | − ret = dwxgmac2_rss_write_reg(ioaddr, true, i, cfg->key[i]); | |
| 536 | + key = (u32 *)cfg->key; | |
| 537 | + for (i = 0; i < (ARRAY_SIZE(cfg->key) / sizeof(u32)); i++) { | |
| 538 | + ret = dwxgmac2_rss_write_reg(ioaddr, true, i, key[i]); | |
| 538 | 539 | if (ret) |
| 539 | 540 | return ret; |
| 540 | 541 | } |
| @@ -380,6 +380,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, · 379 unmodified lines | ||
| 380 | 380 | /* MAC HW feature 1 */ |
| 381 | 381 | hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1); |
| 382 | 382 | dma_cap->l3l4fnum = (hw_cap & XGMAC_HWFEAT_L3L4FNUM) >> 27; |
| 383 | + dma_cap->hash_tb_sz = (hw_cap & XGMAC_HWFEAT_HASHTBLSZ) >> 24; | |
| 383 | 384 | dma_cap->rssen = (hw_cap & XGMAC_HWFEAT_RSSEN) >> 20; |
| 384 | 385 | dma_cap->tsoen = (hw_cap & XGMAC_HWFEAT_TSOEN) >> 18; |
| 385 | 386 | dma_cap->sphen = (hw_cap & XGMAC_HWFEAT_SPHEN) >> 17; |
| @@ -629,6 +629,7 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) · 628 unmodified lines | ||
| 629 | 629 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; |
| 630 | 630 | ptp_v2 = PTP_TCR_TSVER2ENA; |
| 631 | 631 | snap_type_sel = PTP_TCR_SNAPTYPSEL_1; |
| 632 | + ts_event_en = PTP_TCR_TSEVNTENA; | |
| 632 | 633 | ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; |
| 633 | 634 | ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; |
| 634 | 635 | ptp_over_ethernet = PTP_TCR_TSIPENA; |
| @@ -4715,11 +4716,9 @@ int stmmac_suspend(struct device *dev) · 4080 unmodified lines | ||
| 4715 | 4716 | if (!ndev || !netif_running(ndev)) |
| 4716 | 4717 | return 0; |
| 4717 | 4718 | |
| 4718 | − mutex_lock(&priv->lock); | |
| 4719 | + phylink_mac_change(priv->phylink, false); | |
| 4719 | 4720 | |
| 4720 | − rtnl_lock(); | |
| 4721 | − phylink_stop(priv->phylink); | |
| 4722 | − rtnl_unlock(); | |
| 4721 | + mutex_lock(&priv->lock); | |
| 4723 | 4722 | |
| 4724 | 4723 | netif_device_detach(ndev); |
| 4725 | 4724 | stmmac_stop_all_queues(priv); |
| @@ -4734,6 +4733,12 @@ int stmmac_suspend(struct device *dev) · 8 unmodified lines | ||
| 4734 | 4733 | stmmac_pmt(priv, priv->hw, priv->wolopts); |
| 4735 | 4734 | priv->irq_wake = 1; |
| 4736 | 4735 | } else { |
| 4736 | + mutex_unlock(&priv->lock); | |
| 4737 | + rtnl_lock(); | |
| 4738 | + phylink_stop(priv->phylink); | |
| 4739 | + rtnl_unlock(); | |
| 4740 | + mutex_lock(&priv->lock); | |
| 4741 | + | |
| 4737 | 4742 | stmmac_mac_set(priv, priv->ioaddr, false); |
| 4738 | 4743 | pinctrl_pm_select_sleep_state(priv->device); |
| 4739 | 4744 | /* Disable clock in case of PWM is off */ |
| @@ -4824,12 +4829,16 @@ int stmmac_resume(struct device *dev) · 84 unmodified lines | ||
| 4824 | 4829 | |
| 4825 | 4830 | stmmac_start_all_queues(priv); |
| 4826 | 4831 | |
| 4827 | − rtnl_lock(); | |
| 4828 | − phylink_start(priv->phylink); | |
| 4829 | − rtnl_unlock(); | |
| 4830 | − | |
| 4831 | 4832 | mutex_unlock(&priv->lock); |
| 4832 | 4833 | |
| 4834 | + if (!device_may_wakeup(priv->device)) { | |
| 4835 | + rtnl_lock(); | |
| 4836 | + phylink_start(priv->phylink); | |
| 4837 | + rtnl_unlock(); | |
| 4838 | + } | |
| 4839 | + | |
| 4840 | + phylink_mac_change(priv->phylink, true); | |
| 4841 | + | |
| 4833 | 4842 | return 0; |
| 4834 | 4843 | } |
| 4835 | 4844 | EXPORT_SYMBOL_GPL(stmmac_resume); |
| @@ -1564,10 +1564,6 @@ static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue) · 1563 unmodified lines | ||
| 1564 | 1564 | struct stmmac_packet_attrs attr = { }; |
| 1565 | 1565 | int size = priv->dma_buf_sz; |
| 1566 | 1566 | |
| 1567 | − /* Only XGMAC has SW support for multiple RX descs in same packet */ | |
| 1568 | − if (priv->plat->has_xgmac) | |
| 1569 | − size = priv->dev->max_mtu; | |
| 1570 | − | |
| 1571 | 1567 | attr.dst = priv->dev->dev_addr; |
| 1572 | 1568 | attr.max_size = size - ETH_FCS_LEN; |
| 1573 | 1569 | attr.queue_mapping = queue; |
| @@ -1137,10 +1137,11 @@ static void atusb_disconnect(struct usb_interface *interface) · 1136 unmodified lines | ||
| 1137 | 1137 | |
| 1138 | 1138 | ieee802154_unregister_hw(atusb->hw); |
| 1139 | 1139 | |
| 1140 | + usb_put_dev(atusb->usb_dev); | |
| 1141 | + | |
| 1140 | 1142 | ieee802154_free_hw(atusb->hw); |
| 1141 | 1143 | |
| 1142 | 1144 | usb_set_intfdata(interface, NULL); |
| 1143 | − usb_put_dev(atusb->usb_dev); | |
| 1144 | 1145 | |
| 1145 | 1146 | pr_debug("%s done\n", __func__); |
| 1146 | 1147 | } |
| @@ -3145,12 +3145,12 @@ static int ca8210_probe(struct spi_device *spi_device) · 3144 unmodified lines | ||
| 3145 | 3145 | goto error; |
| 3146 | 3146 | } |
| 3147 | 3147 | |
| 3148 | + priv->spi->dev.platform_data = pdata; | |
| 3148 | 3149 | ret = ca8210_get_platform_data(priv->spi, pdata); |
| 3149 | 3150 | if (ret) { |
| 3150 | 3151 | dev_crit(&spi_device->dev, "ca8210_get_platform_data failed\n"); |
| 3151 | 3152 | goto error; |
| 3152 | 3153 | } |
| 3153 | − priv->spi->dev.platform_data = pdata; | |
| 3154 | 3154 | |
| 3155 | 3155 | ret = ca8210_dev_com_init(priv); |
| 3156 | 3156 | if (ret) { |
| @@ -800,7 +800,7 @@ mcr20a_handle_rx_read_buf_complete(void *context) · 799 unmodified lines | ||
| 800 | 800 | if (!skb) |
| 801 | 801 | return; |
| 802 | 802 | |
| 803 | − memcpy(skb_put(skb, len), lp->rx_buf, len); | |
| 803 | + __skb_put_data(skb, lp->rx_buf, len); | |
| 804 | 804 | ieee802154_rx_irqsafe(lp->hw, skb, lp->rx_lqi[0]); |
| 805 | 805 | |
| 806 | 806 | print_hex_dump_debug("mcr20a rx: ", DUMP_PREFIX_OFFSET, 16, 1, |
| @@ -15,6 +15,15 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/of_gpio.h> |
| 16 | 16 | #include <linux/gpio/consumer.h> |
| 17 | 17 | |
| 18 | +#define AT803X_SPECIFIC_STATUS 0x11 | |
| 19 | +#define AT803X_SS_SPEED_MASK (3 << 14) | |
| 20 | +#define AT803X_SS_SPEED_1000 (2 << 14) | |
| 21 | +#define AT803X_SS_SPEED_100 (1 << 14) | |
| 22 | +#define AT803X_SS_SPEED_10 (0 << 14) | |
| 23 | +#define AT803X_SS_DUPLEX BIT(13) | |
| 24 | +#define AT803X_SS_SPEED_DUPLEX_RESOLVED BIT(11) | |
| 25 | +#define AT803X_SS_MDIX BIT(6) | |
| 26 | + | |
| 18 | 27 | #define AT803X_INTR_ENABLE 0x12 |
| 19 | 28 | #define AT803X_INTR_ENABLE_AUTONEG_ERR BIT(15) |
| 20 | 29 | #define AT803X_INTR_ENABLE_SPEED_CHANGED BIT(14) |
| @@ -357,6 +366,64 @@ static int at803x_aneg_done(struct phy_device *phydev) · 336 unmodified lines | ||
| 357 | 366 | return aneg_done; |
| 358 | 367 | } |
| 359 | 368 | |
| 369 | +static int at803x_read_status(struct phy_device *phydev) | |
| 370 | +{ | |
| 371 | + int ss, err, old_link = phydev->link; | |
| 372 | + | |
| 373 | + /* Update the link, but return if there was an error */ | |
| 374 | + err = genphy_update_link(phydev); | |
| 375 | + if (err) | |
| 376 | + return err; | |
| 377 | + | |
| 378 | + /* why bother the PHY if nothing can have changed */ | |
| 379 | + if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) | |
| 380 | + return 0; | |
| 381 | + | |
| 382 | + phydev->speed = SPEED_UNKNOWN; | |
| 383 | + phydev->duplex = DUPLEX_UNKNOWN; | |
| 384 | + phydev->pause = 0; | |
| 385 | + phydev->asym_pause = 0; | |
| 386 | + | |
| 387 | + err = genphy_read_lpa(phydev); | |
| 388 | + if (err < 0) | |
| 389 | + return err; | |
| 390 | + | |
| 391 | + /* Read the AT8035 PHY-Specific Status register, which indicates the | |
| 392 | + * speed and duplex that the PHY is actually using, irrespective of | |
| 393 | + * whether we are in autoneg mode or not. | |
| 394 | + */ | |
| 395 | + ss = phy_read(phydev, AT803X_SPECIFIC_STATUS); | |
| 396 | + if (ss < 0) | |
| 397 | + return ss; | |
| 398 | + | |
| 399 | + if (ss & AT803X_SS_SPEED_DUPLEX_RESOLVED) { | |
| 400 | + switch (ss & AT803X_SS_SPEED_MASK) { | |
| 401 | + case AT803X_SS_SPEED_10: | |
| 402 | + phydev->speed = SPEED_10; | |
| 403 | + break; | |
| 404 | + case AT803X_SS_SPEED_100: | |
| 405 | + phydev->speed = SPEED_100; | |
| 406 | + break; | |
| 407 | + case AT803X_SS_SPEED_1000: | |
| 408 | + phydev->speed = SPEED_1000; | |
| 409 | + break; | |
| 410 | + } | |
| 411 | + if (ss & AT803X_SS_DUPLEX) | |
| 412 | + phydev->duplex = DUPLEX_FULL; | |
| 413 | + else | |
| 414 | + phydev->duplex = DUPLEX_HALF; | |
| 415 | + if (ss & AT803X_SS_MDIX) | |
| 416 | + phydev->mdix = ETH_TP_MDI_X; | |
| 417 | + else | |
| 418 | + phydev->mdix = ETH_TP_MDI; | |
| 419 | + } | |
| 420 | + | |
| 421 | + if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) | |
| 422 | + phy_resolve_aneg_pause(phydev); | |
| 423 | + | |
| 424 | + return 0; | |
| 425 | +} | |
| 426 | + | |
| 360 | 427 | static struct phy_driver at803x_driver[] = { |
| 361 | 428 | { |
| 362 | 429 | /* ATHEROS 8035 */ |
| @@ -370,6 +437,7 @@ static struct phy_driver at803x_driver[] = { · 7 unmodified lines | ||
| 370 | 437 | .suspend = at803x_suspend, |
| 371 | 438 | .resume = at803x_resume, |
| 372 | 439 | /* PHY_GBIT_FEATURES */ |
| 440 | + .read_status = at803x_read_status, | |
| 373 | 441 | .ack_interrupt = at803x_ack_interrupt, |
| 374 | 442 | .config_intr = at803x_config_intr, |
| 375 | 443 | }, { |
| @@ -399,6 +467,7 @@ static struct phy_driver at803x_driver[] = { · 23 unmodified lines | ||
| 399 | 467 | .suspend = at803x_suspend, |
| 400 | 468 | .resume = at803x_resume, |
| 401 | 469 | /* PHY_GBIT_FEATURES */ |
| 470 | + .read_status = at803x_read_status, | |
| 402 | 471 | .aneg_done = at803x_aneg_done, |
| 403 | 472 | .ack_interrupt = &at803x_ack_interrupt, |
| 404 | 473 | .config_intr = &at803x_config_intr, |
| @@ -121,7 +121,7 @@ void mdio_device_reset(struct mdio_device *mdiodev, int value) · 120 unmodified lines | ||
| 121 | 121 | return; |
| 122 | 122 | |
| 123 | 123 | if (mdiodev->reset_gpio) |
| 124 | − gpiod_set_value(mdiodev->reset_gpio, value); | |
| 124 | + gpiod_set_value_cansleep(mdiodev->reset_gpio, value); | |
| 125 | 125 | |
| 126 | 126 | if (mdiodev->reset_ctrl) { |
| 127 | 127 | if (value) |
| @@ -283,6 +283,18 @@ void of_set_phy_eee_broken(struct phy_device *phydev) · 282 unmodified lines | ||
| 283 | 283 | phydev->eee_broken_modes = broken; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | +void phy_resolve_aneg_pause(struct phy_device *phydev) | |
| 287 | +{ | |
| 288 | + if (phydev->duplex == DUPLEX_FULL) { | |
| 289 | + phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, | |
| 290 | + phydev->lp_advertising); | |
| 291 | + phydev->asym_pause = linkmode_test_bit( | |
| 292 | + ETHTOOL_LINK_MODE_Asym_Pause_BIT, | |
| 293 | + phydev->lp_advertising); | |
| 294 | + } | |
| 295 | +} | |
| 296 | +EXPORT_SYMBOL_GPL(phy_resolve_aneg_pause); | |
| 297 | + | |
| 286 | 298 | /** |
| 287 | 299 | * phy_resolve_aneg_linkmode - resolve the advertisements into phy settings |
| 288 | 300 | * @phydev: The phy_device struct |
| @@ -305,13 +317,7 @@ void phy_resolve_aneg_linkmode(struct phy_device *phydev) · 16 unmodified lines | ||
| 305 | 317 | break; |
| 306 | 318 | } |
| 307 | 319 | |
| 308 | − if (phydev->duplex == DUPLEX_FULL) { | |
| 309 | − phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, | |
| 310 | − phydev->lp_advertising); | |
| 311 | − phydev->asym_pause = linkmode_test_bit( | |
| 312 | − ETHTOOL_LINK_MODE_Asym_Pause_BIT, | |
| 313 | − phydev->lp_advertising); | |
| 314 | − } | |
| 320 | + phy_resolve_aneg_pause(phydev); | |
| 315 | 321 | } |
| 316 | 322 | EXPORT_SYMBOL_GPL(phy_resolve_aneg_linkmode); |
| 317 | 323 | |
| @@ -457,6 +457,11 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) · 456 unmodified lines | ||
| 457 | 457 | val); |
| 458 | 458 | change_autoneg = true; |
| 459 | 459 | break; |
| 460 | + case MII_CTRL1000: | |
| 461 | + mii_ctrl1000_mod_linkmode_adv_t(phydev->advertising, | |
| 462 | + val); | |
| 463 | + change_autoneg = true; | |
| 464 | + break; | |
| 460 | 465 | default: |
| 461 | 466 | /* do nothing */ |
| 462 | 467 | break; |
| @@ -1783,32 +1783,9 @@ done: · 1782 unmodified lines | ||
| 1783 | 1783 | } |
| 1784 | 1784 | EXPORT_SYMBOL(genphy_update_link); |
| 1785 | 1785 | |
| 1786 | −/** | |
| 1787 | − * genphy_read_status - check the link status and update current link state | |
| 1788 | − * @phydev: target phy_device struct | |
| 1789 | − * | |
| 1790 | − * Description: Check the link, then figure out the current state | |
| 1791 | − * by comparing what we advertise with what the link partner | |
| 1792 | − * advertises. Start by checking the gigabit possibilities, | |
| 1793 | − * then move on to 10/100. | |
| 1794 | − */ | |
| 1795 | −int genphy_read_status(struct phy_device *phydev) | |
| 1786 | +int genphy_read_lpa(struct phy_device *phydev) | |
| 1796 | 1787 | { |
| 1797 | − int lpa, lpagb, err, old_link = phydev->link; | |
| 1798 | − | |
| 1799 | − /* Update the link, but return if there was an error */ | |
| 1800 | − err = genphy_update_link(phydev); | |
| 1801 | − if (err) | |
| 1802 | − return err; | |
| 1803 | − | |
| 1804 | − /* why bother the PHY if nothing can have changed */ | |
| 1805 | − if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) | |
| 1806 | − return 0; | |
| 1807 | − | |
| 1808 | − phydev->speed = SPEED_UNKNOWN; | |
| 1809 | − phydev->duplex = DUPLEX_UNKNOWN; | |
| 1810 | − phydev->pause = 0; | |
| 1811 | − phydev->asym_pause = 0; | |
| 1788 | + int lpa, lpagb; | |
| 1812 | 1789 | |
| 1813 | 1790 | if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { |
| 1814 | 1791 | if (phydev->is_gigabit_capable) { |
| @@ -1838,6 +1815,44 @@ int genphy_read_status(struct phy_device *phydev) · 23 unmodified lines | ||
| 1838 | 1815 | return lpa; |
| 1839 | 1816 | |
| 1840 | 1817 | mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); |
| 1818 | + } | |
| 1819 | + | |
| 1820 | + return 0; | |
| 1821 | +} | |
| 1822 | +EXPORT_SYMBOL(genphy_read_lpa); | |
| 1823 | + | |
| 1824 | +/** | |
| 1825 | + * genphy_read_status - check the link status and update current link state | |
| 1826 | + * @phydev: target phy_device struct | |
| 1827 | + * | |
| 1828 | + * Description: Check the link, then figure out the current state | |
| 1829 | + * by comparing what we advertise with what the link partner | |
| 1830 | + * advertises. Start by checking the gigabit possibilities, | |
| 1831 | + * then move on to 10/100. | |
| 1832 | + */ | |
| 1833 | +int genphy_read_status(struct phy_device *phydev) | |
| 1834 | +{ | |
| 1835 | + int err, old_link = phydev->link; | |
| 1836 | + | |
| 1837 | + /* Update the link, but return if there was an error */ | |
| 1838 | + err = genphy_update_link(phydev); | |
| 1839 | + if (err) | |
| 1840 | + return err; | |
| 1841 | + | |
| 1842 | + /* why bother the PHY if nothing can have changed */ | |
| 1843 | + if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) | |
| 1844 | + return 0; | |
| 1845 | + | |
| 1846 | + phydev->speed = SPEED_UNKNOWN; | |
| 1847 | + phydev->duplex = DUPLEX_UNKNOWN; | |
| 1848 | + phydev->pause = 0; | |
| 1849 | + phydev->asym_pause = 0; | |
| 1850 | + | |
| 1851 | + err = genphy_read_lpa(phydev); | |
| 1852 | + if (err < 0) | |
| 1853 | + return err; | |
| 1854 | + | |
| 1855 | + if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { | |
| 1841 | 1856 | phy_resolve_aneg_linkmode(phydev); |
| 1842 | 1857 | } else if (phydev->autoneg == AUTONEG_DISABLE) { |
| 1843 | 1858 | int bmcr = phy_read(phydev, MII_BMCR); |
| @@ -238,7 +238,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) · 237 unmodified lines | ||
| 238 | 238 | skb_dst_drop(skb); |
| 239 | 239 | skb_dst_set(skb, &rt->dst); |
| 240 | 240 | |
| 241 | − nf_reset(skb); | |
| 241 | + nf_reset_ct(skb); | |
| 242 | 242 | |
| 243 | 243 | skb->ip_summed = CHECKSUM_NONE; |
| 244 | 244 | ip_select_ident(net, skb, NULL); |
| @@ -358,7 +358,7 @@ static int pptp_rcv(struct sk_buff *skb) · 113 unmodified lines | ||
| 358 | 358 | po = lookup_chan(htons(header->call_id), iph->saddr); |
| 359 | 359 | if (po) { |
| 360 | 360 | skb_dst_drop(skb); |
| 361 | − nf_reset(skb); | |
| 361 | + nf_reset_ct(skb); | |
| 362 | 362 | return sk_receive_skb(sk_pppox(po), skb, 0); |
| 363 | 363 | } |
| 364 | 364 | drop: |
| @@ -1104,7 +1104,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) · 1103 unmodified lines | ||
| 1104 | 1104 | */ |
| 1105 | 1105 | skb_orphan(skb); |
| 1106 | 1106 | |
| 1107 | − nf_reset(skb); | |
| 1107 | + nf_reset_ct(skb); | |
| 1108 | 1108 | |
| 1109 | 1109 | if (ptr_ring_produce(&tfile->tx_ring, skb)) |
| 1110 | 1110 | goto drop; |
| @@ -2620,14 +2620,18 @@ static struct hso_device *hso_create_bulk_serial_device( · 2619 unmodified lines | ||
| 2620 | 2620 | */ |
| 2621 | 2621 | if (serial->tiocmget) { |
| 2622 | 2622 | tiocmget = serial->tiocmget; |
| 2623 | + tiocmget->endp = hso_get_ep(interface, | |
| 2624 | + USB_ENDPOINT_XFER_INT, | |
| 2625 | + USB_DIR_IN); | |
| 2626 | + if (!tiocmget->endp) { | |
| 2627 | + dev_err(&interface->dev, "Failed to find INT IN ep\n"); | |
| 2628 | + goto exit; | |
| 2629 | + } | |
| 2630 | + | |
| 2623 | 2631 | tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL); |
| 2624 | 2632 | if (tiocmget->urb) { |
| 2625 | 2633 | mutex_init(&tiocmget->mutex); |
| 2626 | 2634 | init_waitqueue_head(&tiocmget->waitq); |
| 2627 | − tiocmget->endp = hso_get_ep( | |
| 2628 | − interface, | |
| 2629 | − USB_ENDPOINT_XFER_INT, | |
| 2630 | − USB_DIR_IN); | |
| 2631 | 2635 | } else |
| 2632 | 2636 | hso_free_tiomget(serial); |
| 2633 | 2637 | } |
| @@ -1350,6 +1350,7 @@ static const struct usb_device_id products[] = { · 1349 unmodified lines | ||
| 1350 | 1350 | {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
| 1351 | 1351 | {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
| 1352 | 1352 | {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/ |
| 1353 | + {QMI_QUIRK_SET_DTR(0x1e2d, 0x00b0, 4)}, /* Cinterion CLS8 */ | |
| 1353 | 1354 | {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 1354 | 1355 | {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ |
| 1355 | 1356 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
| @@ -4799,10 +4799,9 @@ static int rtl8152_reset_resume(struct usb_interface *intf) · 4798 unmodified lines | ||
| 4799 | 4799 | struct r8152 *tp = usb_get_intfdata(intf); |
| 4800 | 4800 | |
| 4801 | 4801 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
| 4802 | − mutex_lock(&tp->control); | |
| 4803 | 4802 | tp->rtl_ops.init(tp); |
| 4804 | 4803 | queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0); |
| 4805 | − mutex_unlock(&tp->control); | |
| 4804 | + set_ethernet_addr(tp); | |
| 4806 | 4805 | return rtl8152_resume(intf); |
| 4807 | 4806 | } |
| 4808 | 4807 | |
| @@ -1585,7 +1585,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 1584 unmodified lines | ||
| 1585 | 1585 | /* Don't wait up for transmitted skbs to be freed. */ |
| 1586 | 1586 | if (!use_napi) { |
| 1587 | 1587 | skb_orphan(skb); |
| 1588 | − nf_reset(skb); | |
| 1588 | + nf_reset_ct(skb); | |
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | 1591 | /* If running out of space, stop queue to avoid getting packets that we |
| @@ -366,7 +366,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk, · 365 unmodified lines | ||
| 366 | 366 | struct neighbour *neigh; |
| 367 | 367 | int ret; |
| 368 | 368 | |
| 369 | − nf_reset(skb); | |
| 369 | + nf_reset_ct(skb); | |
| 370 | 370 | |
| 371 | 371 | skb->protocol = htons(ETH_P_IPV6); |
| 372 | 372 | skb->dev = dev; |
| @@ -459,7 +459,7 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev, · 86 unmodified lines | ||
| 459 | 459 | |
| 460 | 460 | /* reset skb device */ |
| 461 | 461 | if (likely(err == 1)) |
| 462 | − nf_reset(skb); | |
| 462 | + nf_reset_ct(skb); | |
| 463 | 463 | else |
| 464 | 464 | skb = NULL; |
| 465 | 465 | |
| @@ -560,7 +560,7 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s · 94 unmodified lines | ||
| 560 | 560 | bool is_v6gw = false; |
| 561 | 561 | int ret = -EINVAL; |
| 562 | 562 | |
| 563 | − nf_reset(skb); | |
| 563 | + nf_reset_ct(skb); | |
| 564 | 564 | |
| 565 | 565 | /* Be paranoid, rather than too clever. */ |
| 566 | 566 | if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { |
| @@ -670,7 +670,7 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev, · 103 unmodified lines | ||
| 670 | 670 | |
| 671 | 671 | /* reset skb device */ |
| 672 | 672 | if (likely(err == 1)) |
| 673 | − nf_reset(skb); | |
| 673 | + nf_reset_ct(skb); | |
| 674 | 674 | else |
| 675 | 675 | skb = NULL; |
| 676 | 676 | |
| @@ -1261,8 +1261,8 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw, · 1260 unmodified lines | ||
| 1261 | 1261 | skb_orphan(skb); |
| 1262 | 1262 | skb_dst_drop(skb); |
| 1263 | 1263 | skb->mark = 0; |
| 1264 | − secpath_reset(skb); | |
| 1265 | − nf_reset(skb); | |
| 1264 | + skb_ext_reset(skb); | |
| 1265 | + nf_reset_ct(skb); | |
| 1266 | 1266 | |
| 1267 | 1267 | /* |
| 1268 | 1268 | * Get absolute mactime here so all HWs RX at the "same time", and |
| @@ -887,9 +887,9 @@ static int xennet_set_skb_gso(struct sk_buff *skb, · 886 unmodified lines | ||
| 887 | 887 | return 0; |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | −static RING_IDX xennet_fill_frags(struct netfront_queue *queue, | |
| 891 | − struct sk_buff *skb, | |
| 892 | − struct sk_buff_head *list) | |
| 890 | +static int xennet_fill_frags(struct netfront_queue *queue, | |
| 891 | + struct sk_buff *skb, | |
| 892 | + struct sk_buff_head *list) | |
| 893 | 893 | { |
| 894 | 894 | RING_IDX cons = queue->rx.rsp_cons; |
| 895 | 895 | struct sk_buff *nskb; |
| @@ -908,7 +908,7 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, · 12 unmodified lines | ||
| 908 | 908 | if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) { |
| 909 | 909 | queue->rx.rsp_cons = ++cons + skb_queue_len(list); |
| 910 | 910 | kfree_skb(nskb); |
| 911 | − return ~0U; | |
| 911 | + return -ENOENT; | |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
| @@ -919,7 +919,9 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, · 4 unmodified lines | ||
| 919 | 919 | kfree_skb(nskb); |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | − return cons; | |
| 922 | + queue->rx.rsp_cons = cons; | |
| 923 | + | |
| 924 | + return 0; | |
| 923 | 925 | } |
| 924 | 926 | |
| 925 | 927 | static int checksum_setup(struct net_device *dev, struct sk_buff *skb) |
| @@ -1045,8 +1047,7 @@ err: · 119 unmodified lines | ||
| 1045 | 1047 | skb->data_len = rx->status; |
| 1046 | 1048 | skb->len += rx->status; |
| 1047 | 1049 | |
| 1048 | − i = xennet_fill_frags(queue, skb, &tmpq); | |
| 1049 | − if (unlikely(i == ~0U)) | |
| 1050 | + if (unlikely(xennet_fill_frags(queue, skb, &tmpq))) | |
| 1050 | 1051 | goto err; |
| 1051 | 1052 | |
| 1052 | 1053 | if (rx->flags & XEN_NETRXF_csum_blank) |
| @@ -1056,7 +1057,7 @@ err: · 3 unmodified lines | ||
| 1056 | 1057 | |
| 1057 | 1058 | __skb_queue_tail(&rxq, skb); |
| 1058 | 1059 | |
| 1059 | − queue->rx.rsp_cons = ++i; | |
| 1060 | + i = ++queue->rx.rsp_cons; | |
| 1060 | 1061 | work_done++; |
| 1061 | 1062 | } |
| 1062 | 1063 | |
| @@ -102,10 +102,13 @@ static void nvme_set_queue_dying(struct nvme_ns *ns) · 101 unmodified lines | ||
| 102 | 102 | */ |
| 103 | 103 | if (!ns->disk || test_and_set_bit(NVME_NS_DEAD, &ns->flags)) |
| 104 | 104 | return; |
| 105 | − revalidate_disk(ns->disk); | |
| 106 | 105 | blk_set_queue_dying(ns->queue); |
| 107 | 106 | /* Forcibly unquiesce queues to avoid blocking dispatch */ |
| 108 | 107 | blk_mq_unquiesce_queue(ns->queue); |
| 108 | + /* | |
| 109 | + * Revalidate after unblocking dispatchers that may be holding bd_butex | |
| 110 | + */ | |
| 111 | + revalidate_disk(ns->disk); | |
| 109 | 112 | } |
| 110 | 113 | |
| 111 | 114 | static void nvme_queue_scan(struct nvme_ctrl *ctrl) |
| @@ -847,7 +850,7 @@ out: · 735 unmodified lines | ||
| 847 | 850 | static int nvme_submit_user_cmd(struct request_queue *q, |
| 848 | 851 | struct nvme_command *cmd, void __user *ubuffer, |
| 849 | 852 | unsigned bufflen, void __user *meta_buffer, unsigned meta_len, |
| 850 | − u32 meta_seed, u32 *result, unsigned timeout) | |
| 853 | + u32 meta_seed, u64 *result, unsigned timeout) | |
| 851 | 854 | { |
| 852 | 855 | bool write = nvme_is_write(cmd); |
| 853 | 856 | struct nvme_ns *ns = q->queuedata; |
| @@ -888,7 +891,7 @@ static int nvme_submit_user_cmd(struct request_queue *q, · 34 unmodified lines | ||
| 888 | 891 | else |
| 889 | 892 | ret = nvme_req(req)->status; |
| 890 | 893 | if (result) |
| 891 | − *result = le32_to_cpu(nvme_req(req)->result.u32); | |
| 894 | + *result = le64_to_cpu(nvme_req(req)->result.u64); | |
| 892 | 895 | if (meta && !ret && !write) { |
| 893 | 896 | if (copy_to_user(meta_buffer, meta, meta_len)) |
| 894 | 897 | ret = -EFAULT; |
| @@ -1335,6 +1338,54 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, · 440 unmodified lines | ||
| 1335 | 1338 | struct nvme_command c; |
| 1336 | 1339 | unsigned timeout = 0; |
| 1337 | 1340 | u32 effects; |
| 1341 | + u64 result; | |
| 1342 | + int status; | |
| 1343 | + | |
| 1344 | + if (!capable(CAP_SYS_ADMIN)) | |
| 1345 | + return -EACCES; | |
| 1346 | + if (copy_from_user(&cmd, ucmd, sizeof(cmd))) | |
| 1347 | + return -EFAULT; | |
| 1348 | + if (cmd.flags) | |
| 1349 | + return -EINVAL; | |
| 1350 | + | |
| 1351 | + memset(&c, 0, sizeof(c)); | |
| 1352 | + c.common.opcode = cmd.opcode; | |
| 1353 | + c.common.flags = cmd.flags; | |
| 1354 | + c.common.nsid = cpu_to_le32(cmd.nsid); | |
| 1355 | + c.common.cdw2[0] = cpu_to_le32(cmd.cdw2); | |
| 1356 | + c.common.cdw2[1] = cpu_to_le32(cmd.cdw3); | |
| 1357 | + c.common.cdw10 = cpu_to_le32(cmd.cdw10); | |
| 1358 | + c.common.cdw11 = cpu_to_le32(cmd.cdw11); | |
| 1359 | + c.common.cdw12 = cpu_to_le32(cmd.cdw12); | |
| 1360 | + c.common.cdw13 = cpu_to_le32(cmd.cdw13); | |
| 1361 | + c.common.cdw14 = cpu_to_le32(cmd.cdw14); | |
| 1362 | + c.common.cdw15 = cpu_to_le32(cmd.cdw15); | |
| 1363 | + | |
| 1364 | + if (cmd.timeout_ms) | |
| 1365 | + timeout = msecs_to_jiffies(cmd.timeout_ms); | |
| 1366 | + | |
| 1367 | + effects = nvme_passthru_start(ctrl, ns, cmd.opcode); | |
| 1368 | + status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c, | |
| 1369 | + (void __user *)(uintptr_t)cmd.addr, cmd.data_len, | |
| 1370 | + (void __user *)(uintptr_t)cmd.metadata, | |
| 1371 | + cmd.metadata_len, 0, &result, timeout); | |
| 1372 | + nvme_passthru_end(ctrl, effects); | |
| 1373 | + | |
| 1374 | + if (status >= 0) { | |
| 1375 | + if (put_user(result, &ucmd->result)) | |
| 1376 | + return -EFAULT; | |
| 1377 | + } | |
| 1378 | + | |
| 1379 | + return status; | |
| 1380 | +} | |
| 1381 | + | |
| 1382 | +static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns, | |
| 1383 | + struct nvme_passthru_cmd64 __user *ucmd) | |
| 1384 | +{ | |
| 1385 | + struct nvme_passthru_cmd64 cmd; | |
| 1386 | + struct nvme_command c; | |
| 1387 | + unsigned timeout = 0; | |
| 1388 | + u32 effects; | |
| 1338 | 1389 | int status; |
| 1339 | 1390 | |
| 1340 | 1391 | if (!capable(CAP_SYS_ADMIN)) |
| @@ -1405,6 +1456,41 @@ static void nvme_put_ns_from_disk(struct nvme_ns_head *head, int idx) · 64 unmodified lines | ||
| 1405 | 1456 | srcu_read_unlock(&head->srcu, idx); |
| 1406 | 1457 | } |
| 1407 | 1458 | |
| 1459 | +static bool is_ctrl_ioctl(unsigned int cmd) | |
| 1460 | +{ | |
| 1461 | + if (cmd == NVME_IOCTL_ADMIN_CMD || cmd == NVME_IOCTL_ADMIN64_CMD) | |
| 1462 | + return true; | |
| 1463 | + if (is_sed_ioctl(cmd)) | |
| 1464 | + return true; | |
| 1465 | + return false; | |
| 1466 | +} | |
| 1467 | + | |
| 1468 | +static int nvme_handle_ctrl_ioctl(struct nvme_ns *ns, unsigned int cmd, | |
| 1469 | + void __user *argp, | |
| 1470 | + struct nvme_ns_head *head, | |
| 1471 | + int srcu_idx) | |
| 1472 | +{ | |
| 1473 | + struct nvme_ctrl *ctrl = ns->ctrl; | |
| 1474 | + int ret; | |
| 1475 | + | |
| 1476 | + nvme_get_ctrl(ns->ctrl); | |
| 1477 | + nvme_put_ns_from_disk(head, srcu_idx); | |
| 1478 | + | |
| 1479 | + switch (cmd) { | |
| 1480 | + case NVME_IOCTL_ADMIN_CMD: | |
| 1481 | + ret = nvme_user_cmd(ctrl, NULL, argp); | |
| 1482 | + break; | |
| 1483 | + case NVME_IOCTL_ADMIN64_CMD: | |
| 1484 | + ret = nvme_user_cmd64(ctrl, NULL, argp); | |
| 1485 | + break; | |
| 1486 | + default: | |
| 1487 | + ret = sed_ioctl(ctrl->opal_dev, cmd, argp); | |
| 1488 | + break; | |
| 1489 | + } | |
| 1490 | + nvme_put_ctrl(ctrl); | |
| 1491 | + return ret; | |
| 1492 | +} | |
| 1493 | + | |
| 1408 | 1494 | static int nvme_ioctl(struct block_device *bdev, fmode_t mode, |
| 1409 | 1495 | unsigned int cmd, unsigned long arg) |
| 1410 | 1496 | { |
| @@ -1422,20 +1508,8 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, · 11 unmodified lines | ||
| 1422 | 1508 | * seperately and drop the ns SRCU reference early. This avoids a |
| 1423 | 1509 | * deadlock when deleting namespaces using the passthrough interface. |
| 1424 | 1510 | */ |
| 1425 | − if (cmd == NVME_IOCTL_ADMIN_CMD || is_sed_ioctl(cmd)) { | |
| 1426 | − struct nvme_ctrl *ctrl = ns->ctrl; | |
| 1427 | − | |
| 1428 | − nvme_get_ctrl(ns->ctrl); | |
| 1429 | − nvme_put_ns_from_disk(head, srcu_idx); | |
| 1430 | − | |
| 1431 | − if (cmd == NVME_IOCTL_ADMIN_CMD) | |
| 1432 | − ret = nvme_user_cmd(ctrl, NULL, argp); | |
| 1433 | − else | |
| 1434 | − ret = sed_ioctl(ctrl->opal_dev, cmd, argp); | |
| 1435 | − | |
| 1436 | − nvme_put_ctrl(ctrl); | |
| 1437 | − return ret; | |
| 1438 | − } | |
| 1511 | + if (is_ctrl_ioctl(cmd)) | |
| 1512 | + return nvme_handle_ctrl_ioctl(ns, cmd, argp, head, srcu_idx); | |
| 1439 | 1513 | |
| 1440 | 1514 | switch (cmd) { |
| 1441 | 1515 | case NVME_IOCTL_ID: |
| @@ -1448,6 +1522,9 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, · 6 unmodified lines | ||
| 1448 | 1522 | case NVME_IOCTL_SUBMIT_IO: |
| 1449 | 1523 | ret = nvme_submit_io(ns, argp); |
| 1450 | 1524 | break; |
| 1525 | + case NVME_IOCTL_IO64_CMD: | |
| 1526 | + ret = nvme_user_cmd64(ns->ctrl, ns, argp); | |
| 1527 | + break; | |
| 1451 | 1528 | default: |
| 1452 | 1529 | if (ns->ndev) |
| 1453 | 1530 | ret = nvme_nvm_ioctl(ns, cmd, arg); |
| @@ -2289,6 +2366,16 @@ static const struct nvme_core_quirk_entry core_quirks[] = { · 835 unmodified lines | ||
| 2289 | 2366 | .vid = 0x14a4, |
| 2290 | 2367 | .fr = "22301111", |
| 2291 | 2368 | .quirks = NVME_QUIRK_SIMPLE_SUSPEND, |
| 2369 | + }, | |
| 2370 | + { | |
| 2371 | + /* | |
| 2372 | + * This Kingston E8FK11.T firmware version has no interrupt | |
| 2373 | + * after resume with actions related to suspend to idle | |
| 2374 | + * https://bugzilla.kernel.org/show_bug.cgi?id=204887 | |
| 2375 | + */ | |
| 2376 | + .vid = 0x2646, | |
| 2377 | + .fr = "E8FK11.T", | |
| 2378 | + .quirks = NVME_QUIRK_SIMPLE_SUSPEND, | |
| 2292 | 2379 | } |
| 2293 | 2380 | }; |
| 2294 | 2381 | |
| @@ -2540,8 +2627,9 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 245 unmodified lines | ||
| 2540 | 2627 | list_add_tail(&subsys->entry, &nvme_subsystems); |
| 2541 | 2628 | } |
| 2542 | 2629 | |
| 2543 | − if (sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj, | |
| 2544 | − dev_name(ctrl->device))) { | |
| 2630 | + ret = sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj, | |
| 2631 | + dev_name(ctrl->device)); | |
| 2632 | + if (ret) { | |
| 2545 | 2633 | dev_err(ctrl->device, |
| 2546 | 2634 | "failed to create sysfs link from subsystem.\n"); |
| 2547 | 2635 | goto out_put_subsystem; |
| @@ -2838,6 +2926,8 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd, · 290 unmodified lines | ||
| 2838 | 2926 | switch (cmd) { |
| 2839 | 2927 | case NVME_IOCTL_ADMIN_CMD: |
| 2840 | 2928 | return nvme_user_cmd(ctrl, NULL, argp); |
| 2929 | + case NVME_IOCTL_ADMIN64_CMD: | |
| 2930 | + return nvme_user_cmd64(ctrl, NULL, argp); | |
| 2841 | 2931 | case NVME_IOCTL_IO_CMD: |
| 2842 | 2932 | return nvme_dev_user_cmd(ctrl, argp); |
| 2843 | 2933 | case NVME_IOCTL_RESET: |
| @@ -3045,6 +3135,8 @@ static DEVICE_ATTR(field, S_IRUGO, field##_show, NULL); · 201 unmodified lines | ||
| 3045 | 3135 | |
| 3046 | 3136 | nvme_show_int_function(cntlid); |
| 3047 | 3137 | nvme_show_int_function(numa_node); |
| 3138 | +nvme_show_int_function(queue_count); | |
| 3139 | +nvme_show_int_function(sqsize); | |
| 3048 | 3140 | |
| 3049 | 3141 | static ssize_t nvme_sysfs_delete(struct device *dev, |
| 3050 | 3142 | struct device_attribute *attr, const char *buf, |
| @@ -3125,6 +3217,8 @@ static struct attribute *nvme_dev_attrs[] = { · 74 unmodified lines | ||
| 3125 | 3217 | &dev_attr_address.attr, |
| 3126 | 3218 | &dev_attr_state.attr, |
| 3127 | 3219 | &dev_attr_numa_node.attr, |
| 3220 | + &dev_attr_queue_count.attr, | |
| 3221 | + &dev_attr_sqsize.attr, | |
| 3128 | 3222 | NULL |
| 3129 | 3223 | }; |
| 3130 | 3224 | |
| @@ -221,6 +221,7 @@ struct nvme_ctrl { · 220 unmodified lines | ||
| 221 | 221 | u16 oacs; |
| 222 | 222 | u16 nssa; |
| 223 | 223 | u16 nr_streams; |
| 224 | + u16 sqsize; | |
| 224 | 225 | u32 max_namespaces; |
| 225 | 226 | atomic_t abort_limit; |
| 226 | 227 | u8 vwc; |
| @@ -269,7 +270,6 @@ struct nvme_ctrl { · 42 unmodified lines | ||
| 269 | 270 | u16 hmmaxd; |
| 270 | 271 | |
| 271 | 272 | /* Fabrics only */ |
| 272 | − u16 sqsize; | |
| 273 | 273 | u32 ioccsz; |
| 274 | 274 | u32 iorcsz; |
| 275 | 275 | u16 icdoff; |
| @@ -2946,11 +2946,21 @@ static int nvme_suspend(struct device *dev) · 2945 unmodified lines | ||
| 2946 | 2946 | if (ret < 0) |
| 2947 | 2947 | goto unfreeze; |
| 2948 | 2948 | |
| 2949 | + /* | |
| 2950 | + * A saved state prevents pci pm from generically controlling the | |
| 2951 | + * device's power. If we're using protocol specific settings, we don't | |
| 2952 | + * want pci interfering. | |
| 2953 | + */ | |
| 2954 | + pci_save_state(pdev); | |
| 2955 | + | |
| 2949 | 2956 | ret = nvme_set_power_state(ctrl, ctrl->npss); |
| 2950 | 2957 | if (ret < 0) |
| 2951 | 2958 | goto unfreeze; |
| 2952 | 2959 | |
| 2953 | 2960 | if (ret) { |
| 2961 | + /* discard the saved state */ | |
| 2962 | + pci_load_saved_state(pdev, NULL); | |
| 2963 | + | |
| 2954 | 2964 | /* |
| 2955 | 2965 | * Clearing npss forces a controller reset on resume. The |
| 2956 | 2966 | * correct value will be resdicovered then. |
| @@ -2958,14 +2968,7 @@ static int nvme_suspend(struct device *dev) · 1 unmodified line | ||
| 2958 | 2968 | nvme_dev_disable(ndev, true); |
| 2959 | 2969 | ctrl->npss = 0; |
| 2960 | 2970 | ret = 0; |
| 2961 | − goto unfreeze; | |
| 2962 | 2971 | } |
| 2963 | − /* | |
| 2964 | − * A saved state prevents pci pm from generically controlling the | |
| 2965 | − * device's power. If we're using protocol specific settings, we don't | |
| 2966 | − * want pci interfering. | |
| 2967 | − */ | |
| 2968 | − pci_save_state(pdev); | |
| 2969 | 2972 | unfreeze: |
| 2970 | 2973 | nvme_unfreeze(ctrl); |
| 2971 | 2974 | return ret; |
| @@ -3090,6 +3093,9 @@ static const struct pci_device_id nvme_id_table[] = { · 118 unmodified lines | ||
| 3090 | 3093 | .driver_data = NVME_QUIRK_LIGHTNVM, }, |
| 3091 | 3094 | { PCI_DEVICE(0x10ec, 0x5762), /* ADATA SX6000LNP */ |
| 3092 | 3095 | .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, |
| 3096 | + { PCI_DEVICE(0x1cc1, 0x8201), /* ADATA SX8200PNP 512GB */ | |
| 3097 | + .driver_data = NVME_QUIRK_NO_DEEPEST_PS | | |
| 3098 | + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, | |
| 3093 | 3099 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, |
| 3094 | 3100 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, |
| 3095 | 3101 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) }, |
| @@ -427,7 +427,7 @@ static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) · 426 unmodified lines | ||
| 427 | 427 | static int nvme_rdma_get_max_fr_pages(struct ib_device *ibdev) |
| 428 | 428 | { |
| 429 | 429 | return min_t(u32, NVME_RDMA_MAX_SEGMENTS, |
| 430 | − ibdev->attrs.max_fast_reg_page_list_len); | |
| 430 | + ibdev->attrs.max_fast_reg_page_list_len - 1); | |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) |
| @@ -437,7 +437,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) · 3 unmodified lines | ||
| 437 | 437 | const int cq_factor = send_wr_factor + 1; /* + RECV */ |
| 438 | 438 | int comp_vector, idx = nvme_rdma_queue_idx(queue); |
| 439 | 439 | enum ib_poll_context poll_ctx; |
| 440 | − int ret; | |
| 440 | + int ret, pages_per_mr; | |
| 441 | 441 | |
| 442 | 442 | queue->device = nvme_rdma_find_get_device(queue->cm_id); |
| 443 | 443 | if (!queue->device) { |
| @@ -479,10 +479,16 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) · 35 unmodified lines | ||
| 479 | 479 | goto out_destroy_qp; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | + /* | |
| 483 | + * Currently we don't use SG_GAPS MR's so if the first entry is | |
| 484 | + * misaligned we'll end up using two entries for a single data page, | |
| 485 | + * so one additional entry is required. | |
| 486 | + */ | |
| 487 | + pages_per_mr = nvme_rdma_get_max_fr_pages(ibdev) + 1; | |
| 482 | 488 | ret = ib_mr_pool_init(queue->qp, &queue->qp->rdma_mrs, |
| 483 | 489 | queue->queue_size, |
| 484 | 490 | IB_MR_TYPE_MEM_REG, |
| 485 | − nvme_rdma_get_max_fr_pages(ibdev), 0); | |
| 491 | + pages_per_mr, 0); | |
| 486 | 492 | if (ret) { |
| 487 | 493 | dev_err(queue->ctrl->ctrl.device, |
| 488 | 494 | "failed to initialize MR pool sized %d for QID %d\n", |
| @@ -614,7 +620,8 @@ static int nvme_rdma_start_queue(struct nvme_rdma_ctrl *ctrl, int idx) · 125 unmodified lines | ||
| 614 | 620 | if (!ret) { |
| 615 | 621 | set_bit(NVME_RDMA_Q_LIVE, &queue->flags); |
| 616 | 622 | } else { |
| 617 | − __nvme_rdma_stop_queue(queue); | |
| 623 | + if (test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) | |
| 624 | + __nvme_rdma_stop_queue(queue); | |
| 618 | 625 | dev_info(ctrl->ctrl.device, |
| 619 | 626 | "failed to connect queue: %d ret=%d\n", idx, ret); |
| 620 | 627 | } |
| @@ -820,8 +827,8 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, · 199 unmodified lines | ||
| 820 | 827 | if (error) |
| 821 | 828 | goto out_stop_queue; |
| 822 | 829 | |
| 823 | − ctrl->ctrl.max_hw_sectors = | |
| 824 | − (ctrl->max_fr_pages - 1) << (ilog2(SZ_4K) - 9); | |
| 830 | + ctrl->ctrl.max_segments = ctrl->max_fr_pages; | |
| 831 | + ctrl->ctrl.max_hw_sectors = ctrl->max_fr_pages << (ilog2(SZ_4K) - 9); | |
| 825 | 832 | |
| 826 | 833 | blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); |
| 827 | 834 | |
| @@ -1042,7 +1042,7 @@ static void nvme_tcp_io_work(struct work_struct *w) · 1041 unmodified lines | ||
| 1042 | 1042 | { |
| 1043 | 1043 | struct nvme_tcp_queue *queue = |
| 1044 | 1044 | container_of(w, struct nvme_tcp_queue, io_work); |
| 1045 | − unsigned long start = jiffies + msecs_to_jiffies(1); | |
| 1045 | + unsigned long deadline = jiffies + msecs_to_jiffies(1); | |
| 1046 | 1046 | |
| 1047 | 1047 | do { |
| 1048 | 1048 | bool pending = false; |
| @@ -1067,7 +1067,7 @@ static void nvme_tcp_io_work(struct work_struct *w) · 18 unmodified lines | ||
| 1067 | 1067 | if (!pending) |
| 1068 | 1068 | return; |
| 1069 | 1069 | |
| 1070 | − } while (time_after(jiffies, start)); /* quota is exhausted */ | |
| 1070 | + } while (!time_after(jiffies, deadline)); /* quota is exhausted */ | |
| 1071 | 1071 | |
| 1072 | 1072 | queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); |
| 1073 | 1073 | } |
| @@ -11,10 +11,10 @@ · 10 unmodified lines | ||
| 11 | 11 | void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) |
| 12 | 12 | { |
| 13 | 13 | const struct queue_limits *ql = &bdev_get_queue(bdev)->limits; |
| 14 | − /* Number of physical blocks per logical block. */ | |
| 15 | − const u32 ppl = ql->physical_block_size / ql->logical_block_size; | |
| 16 | − /* Physical blocks per logical block, 0's based. */ | |
| 17 | − const __le16 ppl0b = to0based(ppl); | |
| 14 | + /* Number of logical blocks per physical block. */ | |
| 15 | + const u32 lpp = ql->physical_block_size / ql->logical_block_size; | |
| 16 | + /* Logical blocks per physical block, 0's based. */ | |
| 17 | + const __le16 lpp0b = to0based(lpp); | |
| 18 | 18 | |
| 19 | 19 | /* |
| 20 | 20 | * For NVMe 1.2 and later, bit 1 indicates that the fields NAWUN, |
| @@ -25,9 +25,9 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) · 4 unmodified lines | ||
| 25 | 25 | * field from the identify controller data structure should be used. |
| 26 | 26 | */ |
| 27 | 27 | id->nsfeat |= 1 << 1; |
| 28 | − id->nawun = ppl0b; | |
| 29 | − id->nawupf = ppl0b; | |
| 30 | − id->nacwu = ppl0b; | |
| 28 | + id->nawun = lpp0b; | |
| 29 | + id->nawupf = lpp0b; | |
| 30 | + id->nacwu = lpp0b; | |
| 31 | 31 | |
| 32 | 32 | /* |
| 33 | 33 | * Bit 4 indicates that the fields NPWG, NPWA, NPDG, NPDA, and |
| @@ -36,7 +36,7 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) · 2 unmodified lines | ||
| 36 | 36 | */ |
| 37 | 37 | id->nsfeat |= 1 << 4; |
| 38 | 38 | /* NPWG = Namespace Preferred Write Granularity. 0's based */ |
| 39 | − id->npwg = ppl0b; | |
| 39 | + id->npwg = lpp0b; | |
| 40 | 40 | /* NPWA = Namespace Preferred Write Alignment. 0's based */ |
| 41 | 41 | id->npwa = id->npwg; |
| 42 | 42 | /* NPDG = Namespace Preferred Deallocate Granularity. 0's based */ |
| @@ -348,8 +348,7 @@ static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd) · 347 unmodified lines | ||
| 348 | 348 | |
| 349 | 349 | return 0; |
| 350 | 350 | err: |
| 351 | − if (cmd->req.sg_cnt) | |
| 352 | − sgl_free(cmd->req.sg); | |
| 351 | + sgl_free(cmd->req.sg); | |
| 353 | 352 | return NVME_SC_INTERNAL; |
| 354 | 353 | } |
| 355 | 354 | |
| @@ -554,8 +553,7 @@ static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd) · 198 unmodified lines | ||
| 554 | 553 | |
| 555 | 554 | if (queue->nvme_sq.sqhd_disabled) { |
| 556 | 555 | kfree(cmd->iov); |
| 557 | − if (cmd->req.sg_cnt) | |
| 558 | − sgl_free(cmd->req.sg); | |
| 556 | + sgl_free(cmd->req.sg); | |
| 559 | 557 | } |
| 560 | 558 | |
| 561 | 559 | return 1; |
| @@ -586,8 +584,7 @@ static int nvmet_try_send_response(struct nvmet_tcp_cmd *cmd, · 24 unmodified lines | ||
| 586 | 584 | return -EAGAIN; |
| 587 | 585 | |
| 588 | 586 | kfree(cmd->iov); |
| 589 | − if (cmd->req.sg_cnt) | |
| 590 | − sgl_free(cmd->req.sg); | |
| 587 | + sgl_free(cmd->req.sg); | |
| 591 | 588 | cmd->queue->snd_cmd = NULL; |
| 592 | 589 | nvmet_tcp_put_cmd(cmd); |
| 593 | 590 | return 1; |
| @@ -1310,8 +1307,7 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd) · 716 unmodified lines | ||
| 1310 | 1307 | nvmet_req_uninit(&cmd->req); |
| 1311 | 1308 | nvmet_tcp_unmap_pdu_iovec(cmd); |
| 1312 | 1309 | kfree(cmd->iov); |
| 1313 | − if (cmd->req.sg_cnt) | |
| 1314 | − sgl_free(cmd->req.sg); | |
| 1310 | + sgl_free(cmd->req.sg); | |
| 1315 | 1311 | } |
| 1316 | 1312 | |
| 1317 | 1313 | static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue) |
| @@ -507,6 +507,8 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base, · 506 unmodified lines | ||
| 507 | 507 | ptp_qoriq->regs.etts_regs = base + ETTS_REGS_OFFSET; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | + spin_lock_init(&ptp_qoriq->lock); | |
| 511 | + | |
| 510 | 512 | ktime_get_real_ts64(&now); |
| 511 | 513 | ptp_qoriq_settime(&ptp_qoriq->caps, &now); |
| 512 | 514 | |
| @@ -514,7 +516,6 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base, · 1 unmodified line | ||
| 514 | 516 | (ptp_qoriq->tclk_period & TCLK_PERIOD_MASK) << TCLK_PERIOD_SHIFT | |
| 515 | 517 | (ptp_qoriq->cksel & CKSEL_MASK) << CKSEL_SHIFT; |
| 516 | 518 | |
| 517 | − spin_lock_init(&ptp_qoriq->lock); | |
| 518 | 519 | spin_lock_irqsave(&ptp_qoriq->lock, flags); |
| 519 | 520 | |
| 520 | 521 | regs = &ptp_qoriq->regs; |
| @@ -1553,8 +1553,8 @@ static int dasd_eckd_read_vol_info(struct dasd_device *device) · 1552 unmodified lines | ||
| 1553 | 1553 | if (rc == 0) { |
| 1554 | 1554 | memcpy(&private->vsq, vsq, sizeof(*vsq)); |
| 1555 | 1555 | } else { |
| 1556 | − dev_warn(&device->cdev->dev, | |
| 1557 | − "Reading the volume storage information failed with rc=%d\n", rc); | |
| 1556 | + DBF_EVENT_DEVID(DBF_WARNING, device->cdev, | |
| 1557 | + "Reading the volume storage information failed with rc=%d", rc); | |
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | if (useglobal) |
| @@ -1737,8 +1737,8 @@ static int dasd_eckd_read_ext_pool_info(struct dasd_device *device) · 176 unmodified lines | ||
| 1737 | 1737 | if (rc == 0) { |
| 1738 | 1738 | dasd_eckd_cpy_ext_pool_data(device, lcq); |
| 1739 | 1739 | } else { |
| 1740 | − dev_warn(&device->cdev->dev, | |
| 1741 | − "Reading the logical configuration failed with rc=%d\n", rc); | |
| 1740 | + DBF_EVENT_DEVID(DBF_WARNING, device->cdev, | |
| 1741 | + "Reading the logical configuration failed with rc=%d", rc); | |
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | 1744 | dasd_sfree_request(cqr, cqr->memdev); |
| @@ -2020,14 +2020,10 @@ dasd_eckd_check_characteristics(struct dasd_device *device) · 275 unmodified lines | ||
| 2020 | 2020 | dasd_eckd_read_features(device); |
| 2021 | 2021 | |
| 2022 | 2022 | /* Read Volume Information */ |
| 2023 | − rc = dasd_eckd_read_vol_info(device); | |
| 2024 | − if (rc) | |
| 2025 | − goto out_err3; | |
| 2023 | + dasd_eckd_read_vol_info(device); | |
| 2026 | 2024 | |
| 2027 | 2025 | /* Read Extent Pool Information */ |
| 2028 | − rc = dasd_eckd_read_ext_pool_info(device); | |
| 2029 | − if (rc) | |
| 2030 | − goto out_err3; | |
| 2026 | + dasd_eckd_read_ext_pool_info(device); | |
| 2031 | 2027 | |
| 2032 | 2028 | /* Read Device Characteristics */ |
| 2033 | 2029 | rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC, |
| @@ -2059,9 +2055,6 @@ dasd_eckd_check_characteristics(struct dasd_device *device) · 25 unmodified lines | ||
| 2059 | 2055 | if (readonly) |
| 2060 | 2056 | set_bit(DASD_FLAG_DEVICE_RO, &device->flags); |
| 2061 | 2057 | |
| 2062 | − if (dasd_eckd_is_ese(device)) | |
| 2063 | − dasd_set_feature(device->cdev, DASD_FEATURE_DISCARD, 1); | |
| 2064 | − | |
| 2065 | 2058 | dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " |
| 2066 | 2059 | "with %d cylinders, %d heads, %d sectors%s\n", |
| 2067 | 2060 | private->rdc_data.dev_type, |
| @@ -3695,14 +3688,6 @@ static int dasd_eckd_release_space(struct dasd_device *device, · 1627 unmodified lines | ||
| 3695 | 3688 | return -EINVAL; |
| 3696 | 3689 | } |
| 3697 | 3690 | |
| 3698 | −static struct dasd_ccw_req * | |
| 3699 | −dasd_eckd_build_cp_discard(struct dasd_device *device, struct dasd_block *block, | |
| 3700 | − struct request *req, sector_t first_trk, | |
| 3701 | − sector_t last_trk) | |
| 3702 | −{ | |
| 3703 | − return dasd_eckd_dso_ras(device, block, req, first_trk, last_trk, 1); | |
| 3704 | −} | |
| 3705 | − | |
| 3706 | 3691 | static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single( |
| 3707 | 3692 | struct dasd_device *startdev, |
| 3708 | 3693 | struct dasd_block *block, |
| @@ -4447,10 +4432,6 @@ static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, · 738 unmodified lines | ||
| 4447 | 4432 | cmdwtd = private->features.feature[12] & 0x40; |
| 4448 | 4433 | use_prefix = private->features.feature[8] & 0x01; |
| 4449 | 4434 | |
| 4450 | − if (req_op(req) == REQ_OP_DISCARD) | |
| 4451 | − return dasd_eckd_build_cp_discard(startdev, block, req, | |
| 4452 | − first_trk, last_trk); | |
| 4453 | − | |
| 4454 | 4435 | cqr = NULL; |
| 4455 | 4436 | if (cdlspecial || dasd_page_cache) { |
| 4456 | 4437 | /* do nothing, just fall through to the cmd mode single case */ |
| @@ -4729,14 +4710,12 @@ static struct dasd_ccw_req *dasd_eckd_build_alias_cp(struct dasd_device *base, · 272 unmodified lines | ||
| 4729 | 4710 | struct dasd_block *block, |
| 4730 | 4711 | struct request *req) |
| 4731 | 4712 | { |
| 4732 | − struct dasd_device *startdev = NULL; | |
| 4733 | 4713 | struct dasd_eckd_private *private; |
| 4734 | − struct dasd_ccw_req *cqr; | |
| 4714 | + struct dasd_device *startdev; | |
| 4735 | 4715 | unsigned long flags; |
| 4716 | + struct dasd_ccw_req *cqr; | |
| 4736 | 4717 | |
| 4737 | − /* Discard requests can only be processed on base devices */ | |
| 4738 | − if (req_op(req) != REQ_OP_DISCARD) | |
| 4739 | − startdev = dasd_alias_get_start_dev(base); | |
| 4718 | + startdev = dasd_alias_get_start_dev(base); | |
| 4740 | 4719 | if (!startdev) |
| 4741 | 4720 | startdev = base; |
| 4742 | 4721 | private = startdev->private; |
| @@ -5663,14 +5642,10 @@ static int dasd_eckd_restore_device(struct dasd_device *device) · 920 unmodified lines | ||
| 5663 | 5642 | dasd_eckd_read_features(device); |
| 5664 | 5643 | |
| 5665 | 5644 | /* Read Volume Information */ |
| 5666 | − rc = dasd_eckd_read_vol_info(device); | |
| 5667 | − if (rc) | |
| 5668 | − goto out_err2; | |
| 5645 | + dasd_eckd_read_vol_info(device); | |
| 5669 | 5646 | |
| 5670 | 5647 | /* Read Extent Pool Information */ |
| 5671 | − rc = dasd_eckd_read_ext_pool_info(device); | |
| 5672 | − if (rc) | |
| 5673 | − goto out_err2; | |
| 5648 | + dasd_eckd_read_ext_pool_info(device); | |
| 5674 | 5649 | |
| 5675 | 5650 | /* Read Device Characteristics */ |
| 5676 | 5651 | rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC, |
| @@ -6521,20 +6496,8 @@ static void dasd_eckd_setup_blk_queue(struct dasd_block *block) · 844 unmodified lines | ||
| 6521 | 6496 | unsigned int logical_block_size = block->bp_block; |
| 6522 | 6497 | struct request_queue *q = block->request_queue; |
| 6523 | 6498 | struct dasd_device *device = block->base; |
| 6524 | − struct dasd_eckd_private *private; | |
| 6525 | − unsigned int max_discard_sectors; | |
| 6526 | − unsigned int max_bytes; | |
| 6527 | − unsigned int ext_bytes; /* Extent Size in Bytes */ | |
| 6528 | − int recs_per_trk; | |
| 6529 | − int trks_per_cyl; | |
| 6530 | − int ext_limit; | |
| 6531 | − int ext_size; /* Extent Size in Cylinders */ | |
| 6532 | 6499 | int max; |
| 6533 | 6500 | |
| 6534 | − private = device->private; | |
| 6535 | − trks_per_cyl = private->rdc_data.trk_per_cyl; | |
| 6536 | − recs_per_trk = recs_per_track(&private->rdc_data, 0, logical_block_size); | |
| 6537 | − | |
| 6538 | 6501 | if (device->features & DASD_FEATURE_USERAW) { |
| 6539 | 6502 | /* |
| 6540 | 6503 | * the max_blocks value for raw_track access is 256 |
| @@ -6555,28 +6518,6 @@ static void dasd_eckd_setup_blk_queue(struct dasd_block *block) · 14 unmodified lines | ||
| 6555 | 6518 | /* With page sized segments each segment can be translated into one idaw/tidaw */ |
| 6556 | 6519 | blk_queue_max_segment_size(q, PAGE_SIZE); |
| 6557 | 6520 | blk_queue_segment_boundary(q, PAGE_SIZE - 1); |
| 6558 | − | |
| 6559 | − if (dasd_eckd_is_ese(device)) { | |
| 6560 | − /* | |
| 6561 | − * Depending on the extent size, up to UINT_MAX bytes can be | |
| 6562 | − * accepted. However, neither DASD_ECKD_RAS_EXTS_MAX nor the | |
| 6563 | − * device limits should be exceeded. | |
| 6564 | − */ | |
| 6565 | − ext_size = dasd_eckd_ext_size(device); | |
| 6566 | − ext_limit = min(private->real_cyl / ext_size, DASD_ECKD_RAS_EXTS_MAX); | |
| 6567 | − ext_bytes = ext_size * trks_per_cyl * recs_per_trk * | |
| 6568 | − logical_block_size; | |
| 6569 | − max_bytes = UINT_MAX - (UINT_MAX % ext_bytes); | |
| 6570 | − if (max_bytes / ext_bytes > ext_limit) | |
| 6571 | − max_bytes = ext_bytes * ext_limit; | |
| 6572 | − | |
| 6573 | − max_discard_sectors = max_bytes / 512; | |
| 6574 | − | |
| 6575 | − blk_queue_max_discard_sectors(q, max_discard_sectors); | |
| 6576 | − blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); | |
| 6577 | − q->limits.discard_granularity = ext_bytes; | |
| 6578 | − q->limits.discard_alignment = ext_bytes; | |
| 6579 | − } | |
| 6580 | 6521 | } |
| 6581 | 6522 | |
| 6582 | 6523 | static struct ccw_driver dasd_eckd_driver = { |
| @@ -113,6 +113,7 @@ struct subchannel { · 112 unmodified lines | ||
| 113 | 113 | enum sch_todo todo; |
| 114 | 114 | struct work_struct todo_work; |
| 115 | 115 | struct schib_config config; |
| 116 | + u64 dma_mask; | |
| 116 | 117 | char *driver_override; /* Driver name to force a match */ |
| 117 | 118 | } __attribute__ ((aligned(8))); |
| 118 | 119 | |
| @@ -232,7 +232,12 @@ struct subchannel *css_alloc_subchannel(struct subchannel_id schid, · 231 unmodified lines | ||
| 232 | 232 | * belong to a subchannel need to fit 31 bit width (e.g. ccw). |
| 233 | 233 | */ |
| 234 | 234 | sch->dev.coherent_dma_mask = DMA_BIT_MASK(31); |
| 235 | − sch->dev.dma_mask = &sch->dev.coherent_dma_mask; | |
| 235 | + /* | |
| 236 | + * But we don't have such restrictions imposed on the stuff that | |
| 237 | + * is handled by the streaming API. | |
| 238 | + */ | |
| 239 | + sch->dma_mask = DMA_BIT_MASK(64); | |
| 240 | + sch->dev.dma_mask = &sch->dma_mask; | |
| 236 | 241 | return sch; |
| 237 | 242 | |
| 238 | 243 | err: |
| @@ -710,7 +710,7 @@ static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch) · 709 unmodified lines | ||
| 710 | 710 | if (!cdev->private) |
| 711 | 711 | goto err_priv; |
| 712 | 712 | cdev->dev.coherent_dma_mask = sch->dev.coherent_dma_mask; |
| 713 | − cdev->dev.dma_mask = &cdev->dev.coherent_dma_mask; | |
| 713 | + cdev->dev.dma_mask = sch->dev.dma_mask; | |
| 714 | 714 | dma_pool = cio_gp_dma_create(&cdev->dev, 1); |
| 715 | 715 | if (!dma_pool) |
| 716 | 716 | goto err_dma_pool; |
| @@ -113,7 +113,7 @@ static void set_impl_params(struct qdio_irq *irq_ptr, · 112 unmodified lines | ||
| 113 | 113 | irq_ptr->qib.pfmt = qib_param_field_format; |
| 114 | 114 | if (qib_param_field) |
| 115 | 115 | memcpy(irq_ptr->qib.parm, qib_param_field, |
| 116 | − QDIO_MAX_BUFFERS_PER_Q); | |
| 116 | + sizeof(irq_ptr->qib.parm)); | |
| 117 | 117 | |
| 118 | 118 | if (!input_slib_elements) |
| 119 | 119 | goto output; |
| @@ -4715,8 +4715,7 @@ static int qeth_qdio_establish(struct qeth_card *card) · 4714 unmodified lines | ||
| 4715 | 4715 | |
| 4716 | 4716 | QETH_CARD_TEXT(card, 2, "qdioest"); |
| 4717 | 4717 | |
| 4718 | − qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q, | |
| 4719 | − GFP_KERNEL); | |
| 4718 | + qib_param_field = kzalloc(FIELD_SIZEOF(struct qib, parm), GFP_KERNEL); | |
| 4720 | 4719 | if (!qib_param_field) { |
| 4721 | 4720 | rc = -ENOMEM; |
| 4722 | 4721 | goto out_free_nothing; |
| @@ -1923,6 +1923,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, · 1922 unmodified lines | ||
| 1923 | 1923 | struct fcoe_fcp_rsp_payload *fcp_rsp; |
| 1924 | 1924 | struct bnx2fc_rport *tgt = io_req->tgt; |
| 1925 | 1925 | struct scsi_cmnd *sc_cmd; |
| 1926 | + u16 scope = 0, qualifier = 0; | |
| 1926 | 1927 | |
| 1927 | 1928 | /* scsi_cmd_cmpl is called with tgt lock held */ |
| 1928 | 1929 | |
| @@ -1990,12 +1991,30 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, · 61 unmodified lines | ||
| 1990 | 1991 | |
| 1991 | 1992 | if (io_req->cdb_status == SAM_STAT_TASK_SET_FULL || |
| 1992 | 1993 | io_req->cdb_status == SAM_STAT_BUSY) { |
| 1993 | − /* Set the jiffies + retry_delay_timer * 100ms | |
| 1994 | − for the rport/tgt */ | |
| 1995 | − tgt->retry_delay_timestamp = jiffies + | |
| 1996 | − fcp_rsp->retry_delay_timer * HZ / 10; | |
| 1994 | + /* Newer array firmware with BUSY or | |
| 1995 | + * TASK_SET_FULL may return a status that needs | |
| 1996 | + * the scope bits masked. | |
| 1997 | + * Or a huge delay timestamp up to 27 minutes | |
| 1998 | + * can result. | |
| 1999 | + */ | |
| 2000 | + if (fcp_rsp->retry_delay_timer) { | |
| 2001 | + /* Upper 2 bits */ | |
| 2002 | + scope = fcp_rsp->retry_delay_timer | |
| 2003 | + & 0xC000; | |
| 2004 | + /* Lower 14 bits */ | |
| 2005 | + qualifier = fcp_rsp->retry_delay_timer | |
| 2006 | + & 0x3FFF; | |
| 2007 | + } | |
| 2008 | + if (scope > 0 && qualifier > 0 && | |
| 2009 | + qualifier <= 0x3FEF) { | |
| 2010 | + /* Set the jiffies + | |
| 2011 | + * retry_delay_timer * 100ms | |
| 2012 | + * for the rport/tgt | |
| 2013 | + */ | |
| 2014 | + tgt->retry_delay_timestamp = jiffies + | |
| 2015 | + (qualifier * HZ / 10); | |
| 2016 | + } | |
| 1997 | 2017 | } |
| 1998 | − | |
| 1999 | 2018 | } |
| 2000 | 2019 | if (io_req->fcp_resid) |
| 2001 | 2020 | scsi_set_resid(sc_cmd, io_req->fcp_resid); |
| @@ -3683,7 +3683,7 @@ void hisi_sas_debugfs_work_handler(struct work_struct *work) · 3682 unmodified lines | ||
| 3683 | 3683 | } |
| 3684 | 3684 | EXPORT_SYMBOL_GPL(hisi_sas_debugfs_work_handler); |
| 3685 | 3685 | |
| 3686 | −void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba) | |
| 3686 | +static void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba) | |
| 3687 | 3687 | { |
| 3688 | 3688 | struct device *dev = hisi_hba->dev; |
| 3689 | 3689 | int i; |
| @@ -3705,7 +3705,7 @@ void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba) · 15 unmodified lines | ||
| 3705 | 3705 | devm_kfree(dev, hisi_hba->debugfs_port_reg[i]); |
| 3706 | 3706 | } |
| 3707 | 3707 | |
| 3708 | −int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba) | |
| 3708 | +static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba) | |
| 3709 | 3709 | { |
| 3710 | 3710 | const struct hisi_sas_hw *hw = hisi_hba->hw; |
| 3711 | 3711 | struct device *dev = hisi_hba->dev; |
| @@ -3796,7 +3796,7 @@ fail: · 84 unmodified lines | ||
| 3796 | 3796 | return -ENOMEM; |
| 3797 | 3797 | } |
| 3798 | 3798 | |
| 3799 | −void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba) | |
| 3799 | +static void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba) | |
| 3800 | 3800 | { |
| 3801 | 3801 | hisi_hba->debugfs_bist_dentry = |
| 3802 | 3802 | debugfs_create_dir("bist", hisi_hba->debugfs_dir); |
| @@ -4183,11 +4183,11 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 4182 unmodified lines | ||
| 4183 | 4183 | */ |
| 4184 | 4184 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ && |
| 4185 | 4185 | pdev->subsystem_device == 0xC000) |
| 4186 | − return -ENODEV; | |
| 4186 | + goto out_disable_device; | |
| 4187 | 4187 | /* Now check the magic signature byte */ |
| 4188 | 4188 | pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic); |
| 4189 | 4189 | if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE) |
| 4190 | − return -ENODEV; | |
| 4190 | + goto out_disable_device; | |
| 4191 | 4191 | /* Ok it is probably a megaraid */ |
| 4192 | 4192 | } |
| 4193 | 4193 | |
| @@ -596,7 +596,7 @@ static void qedf_dcbx_handler(void *dev, struct qed_dcbx_get *get, u32 mib_type) · 595 unmodified lines | ||
| 596 | 596 | tmp_prio = get->operational.app_prio.fcoe; |
| 597 | 597 | if (qedf_default_prio > -1) |
| 598 | 598 | qedf->prio = qedf_default_prio; |
| 599 | − else if (tmp_prio < 0 || tmp_prio > 7) { | |
| 599 | + else if (tmp_prio > 7) { | |
| 600 | 600 | QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, |
| 601 | 601 | "FIP/FCoE prio %d out of range, setting to %d.\n", |
| 602 | 602 | tmp_prio, QEDF_DEFAULT_PRIO); |
| @@ -2920,6 +2920,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) · 2919 unmodified lines | ||
| 2920 | 2920 | struct qla_hw_data *ha = vha->hw; |
| 2921 | 2921 | uint16_t id = vha->vp_idx; |
| 2922 | 2922 | |
| 2923 | + set_bit(VPORT_DELETE, &vha->dpc_flags); | |
| 2924 | + | |
| 2923 | 2925 | while (test_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags) || |
| 2924 | 2926 | test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags)) |
| 2925 | 2927 | msleep(1000); |
| @@ -2396,6 +2396,7 @@ typedef struct fc_port { · 2395 unmodified lines | ||
| 2396 | 2396 | unsigned int query:1; |
| 2397 | 2397 | unsigned int id_changed:1; |
| 2398 | 2398 | unsigned int scan_needed:1; |
| 2399 | + unsigned int n2n_flag:1; | |
| 2399 | 2400 | |
| 2400 | 2401 | struct completion nvme_del_done; |
| 2401 | 2402 | uint32_t nvme_prli_service_param; |
| @@ -2446,7 +2447,6 @@ typedef struct fc_port { · 44 unmodified lines | ||
| 2446 | 2447 | uint8_t fc4_type; |
| 2447 | 2448 | uint8_t fc4f_nvme; |
| 2448 | 2449 | uint8_t scan_state; |
| 2449 | − uint8_t n2n_flag; | |
| 2450 | 2450 | |
| 2451 | 2451 | unsigned long last_queue_full; |
| 2452 | 2452 | unsigned long last_ramp_up; |
| @@ -3036,6 +3036,7 @@ enum scan_flags_t { · 583 unmodified lines | ||
| 3036 | 3036 | enum fc4type_t { |
| 3037 | 3037 | FS_FC4TYPE_FCP = BIT_0, |
| 3038 | 3038 | FS_FC4TYPE_NVME = BIT_1, |
| 3039 | + FS_FCP_IS_N2N = BIT_7, | |
| 3039 | 3040 | }; |
| 3040 | 3041 | |
| 3041 | 3042 | struct fab_scan_rp { |
| @@ -4394,6 +4395,7 @@ typedef struct scsi_qla_host { · 1352 unmodified lines | ||
| 4394 | 4395 | #define IOCB_WORK_ACTIVE 31 |
| 4395 | 4396 | #define SET_ZIO_THRESHOLD_NEEDED 32 |
| 4396 | 4397 | #define ISP_ABORT_TO_ROM 33 |
| 4398 | +#define VPORT_DELETE 34 | |
| 4397 | 4399 | |
| 4398 | 4400 | unsigned long pci_flags; |
| 4399 | 4401 | #define PFLG_DISCONNECTED 0 /* PCI device removed */ |
| @@ -3102,7 +3102,8 @@ int qla24xx_post_gpnid_work(struct scsi_qla_host *vha, port_id_t *id) · 3101 unmodified lines | ||
| 3102 | 3102 | { |
| 3103 | 3103 | struct qla_work_evt *e; |
| 3104 | 3104 | |
| 3105 | − if (test_bit(UNLOADING, &vha->dpc_flags)) | |
| 3105 | + if (test_bit(UNLOADING, &vha->dpc_flags) || | |
| 3106 | + (vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags))) | |
| 3106 | 3107 | return 0; |
| 3107 | 3108 | |
| 3108 | 3109 | e = qla2x00_alloc_work(vha, QLA_EVT_GPNID); |
| @@ -746,12 +746,15 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, · 745 unmodified lines | ||
| 746 | 746 | break; |
| 747 | 747 | default: |
| 748 | 748 | if ((id.b24 != fcport->d_id.b24 && |
| 749 | − fcport->d_id.b24) || | |
| 749 | + fcport->d_id.b24 && | |
| 750 | + fcport->loop_id != FC_NO_LOOP_ID) || | |
| 750 | 751 | (fcport->loop_id != FC_NO_LOOP_ID && |
| 751 | 752 | fcport->loop_id != loop_id)) { |
| 752 | 753 | ql_dbg(ql_dbg_disc, vha, 0x20e3, |
| 753 | 754 | "%s %d %8phC post del sess\n", |
| 754 | 755 | __func__, __LINE__, fcport->port_name); |
| 756 | + if (fcport->n2n_flag) | |
| 757 | + fcport->d_id.b24 = 0; | |
| 755 | 758 | qlt_schedule_sess_for_deletion(fcport); |
| 756 | 759 | return; |
| 757 | 760 | } |
| @@ -759,6 +762,8 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, · 1 unmodified line | ||
| 759 | 762 | } |
| 760 | 763 | |
| 761 | 764 | fcport->loop_id = loop_id; |
| 765 | + if (fcport->n2n_flag) | |
| 766 | + fcport->d_id.b24 = id.b24; | |
| 762 | 767 | |
| 763 | 768 | wwn = wwn_to_u64(fcport->port_name); |
| 764 | 769 | qlt_find_sess_invalidate_other(vha, wwn, |
| @@ -972,7 +977,7 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res) · 207 unmodified lines | ||
| 972 | 977 | wwn = wwn_to_u64(e->port_name); |
| 973 | 978 | |
| 974 | 979 | ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0x20e8, |
| 975 | − "%s %8phC %02x:%02x:%02x state %d/%d lid %x \n", | |
| 980 | + "%s %8phC %02x:%02x:%02x CLS %x/%x lid %x \n", | |
| 976 | 981 | __func__, (void *)&wwn, e->port_id[2], e->port_id[1], |
| 977 | 982 | e->port_id[0], e->current_login_state, e->last_login_state, |
| 978 | 983 | (loop_id & 0x7fff)); |
| @@ -1499,7 +1504,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) · 520 unmodified lines | ||
| 1499 | 1504 | (fcport->fw_login_state == DSC_LS_PRLI_PEND))) |
| 1500 | 1505 | return 0; |
| 1501 | 1506 | |
| 1502 | − if (fcport->fw_login_state == DSC_LS_PLOGI_COMP) { | |
| 1507 | + if (fcport->fw_login_state == DSC_LS_PLOGI_COMP && | |
| 1508 | + !N2N_TOPO(vha->hw)) { | |
| 1503 | 1509 | if (time_before_eq(jiffies, fcport->plogi_nack_done_deadline)) { |
| 1504 | 1510 | set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
| 1505 | 1511 | return 0; |
| @@ -1570,8 +1576,9 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) · 64 unmodified lines | ||
| 1570 | 1576 | qla24xx_post_gpdb_work(vha, fcport, 0); |
| 1571 | 1577 | } else { |
| 1572 | 1578 | ql_dbg(ql_dbg_disc, vha, 0x2118, |
| 1573 | − "%s %d %8phC post NVMe PRLI\n", | |
| 1574 | − __func__, __LINE__, fcport->port_name); | |
| 1579 | + "%s %d %8phC post %s PRLI\n", | |
| 1580 | + __func__, __LINE__, fcport->port_name, | |
| 1581 | + fcport->fc4f_nvme ? "NVME" : "FC"); | |
| 1575 | 1582 | qla24xx_post_prli_work(vha, fcport); |
| 1576 | 1583 | } |
| 1577 | 1584 | break; |
| @@ -1853,17 +1860,38 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea) · 275 unmodified lines | ||
| 1853 | 1860 | break; |
| 1854 | 1861 | } |
| 1855 | 1862 | |
| 1856 | − if (ea->fcport->n2n_flag) { | |
| 1863 | + if (ea->fcport->fc4f_nvme) { | |
| 1857 | 1864 | ql_dbg(ql_dbg_disc, vha, 0x2118, |
| 1858 | 1865 | "%s %d %8phC post fc4 prli\n", |
| 1859 | 1866 | __func__, __LINE__, ea->fcport->port_name); |
| 1860 | 1867 | ea->fcport->fc4f_nvme = 0; |
| 1861 | − ea->fcport->n2n_flag = 0; | |
| 1862 | 1868 | qla24xx_post_prli_work(vha, ea->fcport); |
| 1869 | + return; | |
| 1870 | + } | |
| 1871 | + | |
| 1872 | + /* at this point both PRLI NVME & PRLI FCP failed */ | |
| 1873 | + if (N2N_TOPO(vha->hw)) { | |
| 1874 | + if (ea->fcport->n2n_link_reset_cnt < 3) { | |
| 1875 | + ea->fcport->n2n_link_reset_cnt++; | |
| 1876 | + /* | |
| 1877 | + * remote port is not sending Plogi. Reset | |
| 1878 | + * link to kick start his state machine | |
| 1879 | + */ | |
| 1880 | + set_bit(N2N_LINK_RESET, &vha->dpc_flags); | |
| 1881 | + } else { | |
| 1882 | + ql_log(ql_log_warn, vha, 0x2119, | |
| 1883 | + "%s %d %8phC Unable to reconnect\n", | |
| 1884 | + __func__, __LINE__, ea->fcport->port_name); | |
| 1885 | + } | |
| 1886 | + } else { | |
| 1887 | + /* | |
| 1888 | + * switch connect. login failed. Take connection | |
| 1889 | + * down and allow relogin to retrigger | |
| 1890 | + */ | |
| 1891 | + ea->fcport->flags &= ~FCF_ASYNC_SENT; | |
| 1892 | + ea->fcport->keep_nport_handle = 0; | |
| 1893 | + qlt_schedule_sess_for_deletion(ea->fcport); | |
| 1863 | 1894 | } |
| 1864 | − ql_dbg(ql_dbg_disc, vha, 0x2119, | |
| 1865 | − "%s %d %8phC unhandle event of %x\n", | |
| 1866 | − __func__, __LINE__, ea->fcport->port_name, ea->data[0]); | |
| 1867 | 1895 | break; |
| 1868 | 1896 | } |
| 1869 | 1897 | } |
| @@ -3190,7 +3218,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) · 1320 unmodified lines | ||
| 3190 | 3218 | |
| 3191 | 3219 | for (j = 0; j < 2; j++, fwdt++) { |
| 3192 | 3220 | if (!fwdt->template) { |
| 3193 | − ql_log(ql_log_warn, vha, 0x00ba, | |
| 3221 | + ql_dbg(ql_dbg_init, vha, 0x00ba, | |
| 3194 | 3222 | "-> fwdt%u no template\n", j); |
| 3195 | 3223 | continue; |
| 3196 | 3224 | } |
| @@ -4986,28 +5014,47 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) · 1789 unmodified lines | ||
| 4986 | 5014 | unsigned long flags; |
| 4987 | 5015 | |
| 4988 | 5016 | /* Inititae N2N login. */ |
| 4989 | − if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) { | |
| 4990 | − /* borrowing */ | |
| 4991 | − u32 *bp, i, sz; | |
| 4992 | − | |
| 4993 | − memset(ha->init_cb, 0, ha->init_cb_size); | |
| 4994 | − sz = min_t(int, sizeof(struct els_plogi_payload), | |
| 4995 | − ha->init_cb_size); | |
| 4996 | − rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma, | |
| 4997 | − (void *)ha->init_cb, sz); | |
| 4998 | − if (rval == QLA_SUCCESS) { | |
| 4999 | − bp = (uint32_t *)ha->init_cb; | |
| 5000 | − for (i = 0; i < sz/4 ; i++, bp++) | |
| 5001 | − *bp = cpu_to_be32(*bp); | |
| 5017 | + if (N2N_TOPO(ha)) { | |
| 5018 | + if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) { | |
| 5019 | + /* borrowing */ | |
| 5020 | + u32 *bp, i, sz; | |
| 5021 | + | |
| 5022 | + memset(ha->init_cb, 0, ha->init_cb_size); | |
| 5023 | + sz = min_t(int, sizeof(struct els_plogi_payload), | |
| 5024 | + ha->init_cb_size); | |
| 5025 | + rval = qla24xx_get_port_login_templ(vha, | |
| 5026 | + ha->init_cb_dma, (void *)ha->init_cb, sz); | |
| 5027 | + if (rval == QLA_SUCCESS) { | |
| 5028 | + bp = (uint32_t *)ha->init_cb; | |
| 5029 | + for (i = 0; i < sz/4 ; i++, bp++) | |
| 5030 | + *bp = cpu_to_be32(*bp); | |
| 5002 | 5031 | |
| 5003 | − memcpy(&ha->plogi_els_payld.data, (void *)ha->init_cb, | |
| 5004 | − sizeof(ha->plogi_els_payld.data)); | |
| 5005 | − set_bit(RELOGIN_NEEDED, &vha->dpc_flags); | |
| 5006 | − } else { | |
| 5007 | − ql_dbg(ql_dbg_init, vha, 0x00d1, | |
| 5008 | − "PLOGI ELS param read fail.\n"); | |
| 5032 | + memcpy(&ha->plogi_els_payld.data, | |
| 5033 | + (void *)ha->init_cb, | |
| 5034 | + sizeof(ha->plogi_els_payld.data)); | |
| 5035 | + set_bit(RELOGIN_NEEDED, &vha->dpc_flags); | |
| 5036 | + } else { | |
| 5037 | + ql_dbg(ql_dbg_init, vha, 0x00d1, | |
| 5038 | + "PLOGI ELS param read fail.\n"); | |
| 5039 | + goto skip_login; | |
| 5040 | + } | |
| 5041 | + } | |
| 5042 | + | |
| 5043 | + list_for_each_entry(fcport, &vha->vp_fcports, list) { | |
| 5044 | + if (fcport->n2n_flag) { | |
| 5045 | + qla24xx_fcport_handle_login(vha, fcport); | |
| 5046 | + return QLA_SUCCESS; | |
| 5047 | + } | |
| 5048 | + } | |
| 5049 | +skip_login: | |
| 5050 | + spin_lock_irqsave(&vha->work_lock, flags); | |
| 5051 | + vha->scan.scan_retry++; | |
| 5052 | + spin_unlock_irqrestore(&vha->work_lock, flags); | |
| 5053 | + | |
| 5054 | + if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { | |
| 5055 | + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); | |
| 5056 | + set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); | |
| 5009 | 5057 | } |
| 5010 | − return QLA_SUCCESS; | |
| 5011 | 5058 | } |
| 5012 | 5059 | |
| 5013 | 5060 | found_devs = 0; |
| @@ -2656,9 +2656,10 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) · 2655 unmodified lines | ||
| 2656 | 2656 | els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa; |
| 2657 | 2657 | els_iocb->port_id[1] = sp->fcport->d_id.b.area; |
| 2658 | 2658 | els_iocb->port_id[2] = sp->fcport->d_id.b.domain; |
| 2659 | − els_iocb->s_id[0] = vha->d_id.b.al_pa; | |
| 2660 | − els_iocb->s_id[1] = vha->d_id.b.area; | |
| 2661 | − els_iocb->s_id[2] = vha->d_id.b.domain; | |
| 2659 | + /* For SID the byte order is different than DID */ | |
| 2660 | + els_iocb->s_id[1] = vha->d_id.b.al_pa; | |
| 2661 | + els_iocb->s_id[2] = vha->d_id.b.area; | |
| 2662 | + els_iocb->s_id[0] = vha->d_id.b.domain; | |
| 2662 | 2663 | |
| 2663 | 2664 | if (elsio->u.els_logo.els_cmd == ELS_DCMD_PLOGI) { |
| 2664 | 2665 | els_iocb->control_flags = 0; |
| @@ -2249,7 +2249,7 @@ qla2x00_lip_reset(scsi_qla_host_t *vha) · 2248 unmodified lines | ||
| 2249 | 2249 | mbx_cmd_t mc; |
| 2250 | 2250 | mbx_cmd_t *mcp = &mc; |
| 2251 | 2251 | |
| 2252 | − ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x105a, | |
| 2252 | + ql_dbg(ql_dbg_disc, vha, 0x105a, | |
| 2253 | 2253 | "Entered %s.\n", __func__); |
| 2254 | 2254 | |
| 2255 | 2255 | if (IS_CNA_CAPABLE(vha->hw)) { |
| @@ -3883,14 +3883,24 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 1627 unmodified lines | ||
| 3883 | 3883 | case TOPO_N2N: |
| 3884 | 3884 | ha->current_topology = ISP_CFG_N; |
| 3885 | 3885 | spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); |
| 3886 | + list_for_each_entry(fcport, &vha->vp_fcports, list) { | |
| 3887 | + fcport->scan_state = QLA_FCPORT_SCAN; | |
| 3888 | + fcport->n2n_flag = 0; | |
| 3889 | + } | |
| 3890 | + | |
| 3886 | 3891 | fcport = qla2x00_find_fcport_by_wwpn(vha, |
| 3887 | 3892 | rptid_entry->u.f1.port_name, 1); |
| 3888 | 3893 | spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); |
| 3889 | 3894 | |
| 3890 | 3895 | if (fcport) { |
| 3891 | 3896 | fcport->plogi_nack_done_deadline = jiffies + HZ; |
| 3892 | − fcport->dm_login_expire = jiffies + 3*HZ; | |
| 3897 | + fcport->dm_login_expire = jiffies + 2*HZ; | |
| 3893 | 3898 | fcport->scan_state = QLA_FCPORT_FOUND; |
| 3899 | + fcport->n2n_flag = 1; | |
| 3900 | + fcport->keep_nport_handle = 1; | |
| 3901 | + if (vha->flags.nvme_enabled) | |
| 3902 | + fcport->fc4f_nvme = 1; | |
| 3903 | + | |
| 3894 | 3904 | switch (fcport->disc_state) { |
| 3895 | 3905 | case DSC_DELETED: |
| 3896 | 3906 | set_bit(RELOGIN_NEEDED, |
| @@ -3924,7 +3934,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 27 unmodified lines | ||
| 3924 | 3934 | rptid_entry->u.f1.port_name, |
| 3925 | 3935 | rptid_entry->u.f1.node_name, |
| 3926 | 3936 | NULL, |
| 3927 | − FC4_TYPE_UNKNOWN); | |
| 3937 | + FS_FCP_IS_N2N); | |
| 3928 | 3938 | } |
| 3929 | 3939 | |
| 3930 | 3940 | /* if our portname is higher then initiate N2N login */ |
| @@ -4023,6 +4033,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 92 unmodified lines | ||
| 4023 | 4033 | |
| 4024 | 4034 | list_for_each_entry(fcport, &vha->vp_fcports, list) { |
| 4025 | 4035 | fcport->scan_state = QLA_FCPORT_SCAN; |
| 4036 | + fcport->n2n_flag = 0; | |
| 4026 | 4037 | } |
| 4027 | 4038 | |
| 4028 | 4039 | fcport = qla2x00_find_fcport_by_wwpn(vha, |
| @@ -4032,6 +4043,14 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 3 unmodified lines | ||
| 4032 | 4043 | fcport->login_retry = vha->hw->login_retry_count; |
| 4033 | 4044 | fcport->plogi_nack_done_deadline = jiffies + HZ; |
| 4034 | 4045 | fcport->scan_state = QLA_FCPORT_FOUND; |
| 4046 | + fcport->keep_nport_handle = 1; | |
| 4047 | + fcport->n2n_flag = 1; | |
| 4048 | + fcport->d_id.b.domain = | |
| 4049 | + rptid_entry->u.f2.remote_nport_id[2]; | |
| 4050 | + fcport->d_id.b.area = | |
| 4051 | + rptid_entry->u.f2.remote_nport_id[1]; | |
| 4052 | + fcport->d_id.b.al_pa = | |
| 4053 | + rptid_entry->u.f2.remote_nport_id[0]; | |
| 4035 | 4054 | } |
| 4036 | 4055 | } |
| 4037 | 4056 | } |
| @@ -66,6 +66,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) · 65 unmodified lines | ||
| 66 | 66 | uint16_t vp_id; |
| 67 | 67 | struct qla_hw_data *ha = vha->hw; |
| 68 | 68 | unsigned long flags = 0; |
| 69 | + u8 i; | |
| 69 | 70 | |
| 70 | 71 | mutex_lock(&ha->vport_lock); |
| 71 | 72 | /* |
| @@ -75,8 +76,9 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) · 3 unmodified lines | ||
| 75 | 76 | * ensures no active vp_list traversal while the vport is removed |
| 76 | 77 | * from the queue) |
| 77 | 78 | */ |
| 78 | − wait_event_timeout(vha->vref_waitq, !atomic_read(&vha->vref_count), | |
| 79 | − 10*HZ); | |
| 79 | + for (i = 0; i < 10 && atomic_read(&vha->vref_count); i++) | |
| 80 | + wait_event_timeout(vha->vref_waitq, | |
| 81 | + atomic_read(&vha->vref_count), HZ); | |
| 80 | 82 | |
| 81 | 83 | spin_lock_irqsave(&ha->vport_slock, flags); |
| 82 | 84 | if (atomic_read(&vha->vref_count)) { |
| @@ -262,6 +264,9 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) · 179 unmodified lines | ||
| 262 | 264 | spin_lock_irqsave(&ha->vport_slock, flags); |
| 263 | 265 | list_for_each_entry(vha, &ha->vp_list, list) { |
| 264 | 266 | if (vha->vp_idx) { |
| 267 | + if (test_bit(VPORT_DELETE, &vha->dpc_flags)) | |
| 268 | + continue; | |
| 269 | + | |
| 265 | 270 | atomic_inc(&vha->vref_count); |
| 266 | 271 | spin_unlock_irqrestore(&ha->vport_slock, flags); |
| 267 | 272 | |
| @@ -300,6 +305,20 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) · 32 unmodified lines | ||
| 300 | 305 | int |
| 301 | 306 | qla2x00_vp_abort_isp(scsi_qla_host_t *vha) |
| 302 | 307 | { |
| 308 | + fc_port_t *fcport; | |
| 309 | + | |
| 310 | + /* | |
| 311 | + * To exclusively reset vport, we need to log it out first. | |
| 312 | + * Note: This control_vp can fail if ISP reset is already | |
| 313 | + * issued, this is expected, as the vp would be already | |
| 314 | + * logged out due to ISP reset. | |
| 315 | + */ | |
| 316 | + if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) { | |
| 317 | + qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); | |
| 318 | + list_for_each_entry(fcport, &vha->vp_fcports, list) | |
| 319 | + fcport->logout_on_delete = 0; | |
| 320 | + } | |
| 321 | + | |
| 303 | 322 | /* |
| 304 | 323 | * Physical port will do most of the abort and recovery work. We can |
| 305 | 324 | * just treat it as a loop down |
| @@ -312,16 +331,9 @@ qla2x00_vp_abort_isp(scsi_qla_host_t *vha) · 6 unmodified lines | ||
| 312 | 331 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); |
| 313 | 332 | } |
| 314 | 333 | |
| 315 | − /* | |
| 316 | − * To exclusively reset vport, we need to log it out first. Note: this | |
| 317 | − * control_vp can fail if ISP reset is already issued, this is | |
| 318 | − * expected, as the vp would be already logged out due to ISP reset. | |
| 319 | − */ | |
| 320 | − if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) | |
| 321 | − qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); | |
| 322 | − | |
| 323 | 334 | ql_dbg(ql_dbg_taskm, vha, 0x801d, |
| 324 | 335 | "Scheduling enable of Vport %d.\n", vha->vp_idx); |
| 336 | + | |
| 325 | 337 | return qla24xx_enable_vp(vha); |
| 326 | 338 | } |
| 327 | 339 | |
| @@ -1115,9 +1115,15 @@ static inline int test_fcport_count(scsi_qla_host_t *vha) · 1114 unmodified lines | ||
| 1115 | 1115 | void |
| 1116 | 1116 | qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha) |
| 1117 | 1117 | { |
| 1118 | + u8 i; | |
| 1119 | + | |
| 1118 | 1120 | qla2x00_mark_all_devices_lost(vha, 0); |
| 1119 | 1121 | |
| 1120 | − wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha), 10*HZ); | |
| 1122 | + for (i = 0; i < 10; i++) | |
| 1123 | + wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha), | |
| 1124 | + HZ); | |
| 1125 | + | |
| 1126 | + flush_workqueue(vha->hw->wq); | |
| 1121 | 1127 | } |
| 1122 | 1128 | |
| 1123 | 1129 | /* |
| @@ -5036,6 +5042,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) · 3912 unmodified lines | ||
| 5036 | 5042 | |
| 5037 | 5043 | memcpy(fcport->port_name, e->u.new_sess.port_name, |
| 5038 | 5044 | WWN_SIZE); |
| 5045 | + | |
| 5046 | + if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) | |
| 5047 | + fcport->n2n_flag = 1; | |
| 5048 | + | |
| 5039 | 5049 | } else { |
| 5040 | 5050 | ql_dbg(ql_dbg_disc, vha, 0xffff, |
| 5041 | 5051 | "%s %8phC mem alloc fail.\n", |
| @@ -5134,11 +5144,9 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) · 92 unmodified lines | ||
| 5134 | 5144 | if (dfcp) |
| 5135 | 5145 | qlt_schedule_sess_for_deletion(tfcp); |
| 5136 | 5146 | |
| 5137 | − | |
| 5138 | − if (N2N_TOPO(vha->hw)) | |
| 5139 | − fcport->flags &= ~FCF_FABRIC_DEVICE; | |
| 5140 | − | |
| 5141 | 5147 | if (N2N_TOPO(vha->hw)) { |
| 5148 | + fcport->flags &= ~FCF_FABRIC_DEVICE; | |
| 5149 | + fcport->keep_nport_handle = 1; | |
| 5142 | 5150 | if (vha->flags.nvme_enabled) { |
| 5143 | 5151 | fcport->fc4f_nvme = 1; |
| 5144 | 5152 | fcport->n2n_flag = 1; |
| @@ -953,7 +953,7 @@ void qlt_free_session_done(struct work_struct *work) · 952 unmodified lines | ||
| 953 | 953 | struct qla_hw_data *ha = vha->hw; |
| 954 | 954 | unsigned long flags; |
| 955 | 955 | bool logout_started = false; |
| 956 | − scsi_qla_host_t *base_vha; | |
| 956 | + scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | |
| 957 | 957 | struct qlt_plogi_ack_t *own = |
| 958 | 958 | sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN]; |
| 959 | 959 | |
| @@ -1020,6 +1020,7 @@ void qlt_free_session_done(struct work_struct *work) · 60 unmodified lines | ||
| 1020 | 1020 | |
| 1021 | 1021 | if (logout_started) { |
| 1022 | 1022 | bool traced = false; |
| 1023 | + u16 cnt = 0; | |
| 1023 | 1024 | |
| 1024 | 1025 | while (!READ_ONCE(sess->logout_completed)) { |
| 1025 | 1026 | if (!traced) { |
| @@ -1029,6 +1030,9 @@ void qlt_free_session_done(struct work_struct *work) · 3 unmodified lines | ||
| 1029 | 1030 | traced = true; |
| 1030 | 1031 | } |
| 1031 | 1032 | msleep(100); |
| 1033 | + cnt++; | |
| 1034 | + if (cnt > 200) | |
| 1035 | + break; | |
| 1032 | 1036 | } |
| 1033 | 1037 | |
| 1034 | 1038 | ql_dbg(ql_dbg_disc, vha, 0xf087, |
| @@ -1101,6 +1105,7 @@ void qlt_free_session_done(struct work_struct *work) · 66 unmodified lines | ||
| 1101 | 1105 | } |
| 1102 | 1106 | |
| 1103 | 1107 | spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
| 1108 | + sess->free_pending = 0; | |
| 1104 | 1109 | |
| 1105 | 1110 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf001, |
| 1106 | 1111 | "Unregistration of sess %p %8phC finished fcp_cnt %d\n", |
| @@ -1109,17 +1114,9 @@ void qlt_free_session_done(struct work_struct *work) · 2 unmodified lines | ||
| 1109 | 1114 | if (tgt && (tgt->sess_count == 0)) |
| 1110 | 1115 | wake_up_all(&tgt->waitQ); |
| 1111 | 1116 | |
| 1112 | − if (vha->fcport_count == 0) | |
| 1113 | − wake_up_all(&vha->fcport_waitQ); | |
| 1114 | − | |
| 1115 | − base_vha = pci_get_drvdata(ha->pdev); | |
| 1116 | − | |
| 1117 | − sess->free_pending = 0; | |
| 1118 | − | |
| 1119 | − if (test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags)) | |
| 1120 | − return; | |
| 1121 | − | |
| 1122 | − if ((!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) { | |
| 1117 | + if (!test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags) && | |
| 1118 | + !(vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags)) && | |
| 1119 | + (!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) { | |
| 1123 | 1120 | switch (vha->host->active_mode) { |
| 1124 | 1121 | case MODE_INITIATOR: |
| 1125 | 1122 | case MODE_DUAL: |
| @@ -1132,6 +1129,9 @@ void qlt_free_session_done(struct work_struct *work) · 6 unmodified lines | ||
| 1132 | 1129 | break; |
| 1133 | 1130 | } |
| 1134 | 1131 | } |
| 1132 | + | |
| 1133 | + if (vha->fcport_count == 0) | |
| 1134 | + wake_up_all(&vha->fcport_waitQ); | |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | /* ha->tgt.sess_lock supposed to be held on entry */ |
| @@ -1161,7 +1161,7 @@ void qlt_unreg_sess(struct fc_port *sess) · 23 unmodified lines | ||
| 1161 | 1161 | sess->last_login_gen = sess->login_gen; |
| 1162 | 1162 | |
| 1163 | 1163 | INIT_WORK(&sess->free_work, qlt_free_session_done); |
| 1164 | − schedule_work(&sess->free_work); | |
| 1164 | + queue_work(sess->vha->hw->wq, &sess->free_work); | |
| 1165 | 1165 | } |
| 1166 | 1166 | EXPORT_SYMBOL(qlt_unreg_sess); |
| 1167 | 1167 | |
| @@ -1837,8 +1837,7 @@ static int storvsc_probe(struct hv_device *device, · 1836 unmodified lines | ||
| 1837 | 1837 | /* |
| 1838 | 1838 | * Set the number of HW queues we are supporting. |
| 1839 | 1839 | */ |
| 1840 | − if (stor_device->num_sc != 0) | |
| 1841 | − host->nr_hw_queues = stor_device->num_sc + 1; | |
| 1840 | + host->nr_hw_queues = num_present_cpus(); | |
| 1842 | 1841 | |
| 1843 | 1842 | /* |
| 1844 | 1843 | * Set the error handler work queue. |
| @@ -8143,6 +8143,9 @@ int ufshcd_shutdown(struct ufs_hba *hba) · 8142 unmodified lines | ||
| 8143 | 8143 | { |
| 8144 | 8144 | int ret = 0; |
| 8145 | 8145 | |
| 8146 | + if (!hba->is_powered) | |
| 8147 | + goto out; | |
| 8148 | + | |
| 8146 | 8149 | if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) |
| 8147 | 8150 | goto out; |
| 8148 | 8151 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +# SPDX-License-Identifier: GPL-2.0 | |
| 1 | 2 | config EXFAT_FS |
| 2 | 3 | tristate "exFAT fs support" |
| 3 | 4 | depends on BLOCK |
| @@ -6,7 +7,7 @@ config EXFAT_FS · 2 unmodified lines | ||
| 6 | 7 | This adds support for the exFAT file system. |
| 7 | 8 | |
| 8 | 9 | config EXFAT_DONT_MOUNT_VFAT |
| 9 | − bool "Prohibit mounting of fat/vfat filesysems by exFAT" | |
| 10 | + bool "Prohibit mounting of fat/vfat filesystems by exFAT" | |
| 10 | 11 | depends on EXFAT_FS |
| 11 | 12 | default y |
| 12 | 13 | help |
| @@ -1,4 +1,4 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0 | |
| 1 | +# SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | 2 | |
| 3 | 3 | obj-$(CONFIG_EXFAT_FS) += exfat.o |
| 4 | 4 | |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. |
| 4 | 4 | */ |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. |
| 4 | 4 | */ |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. |
| 4 | 4 | */ |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. |
| 4 | 4 | */ |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. |
| 4 | 4 | */ |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. |
| 4 | 4 | */ |
| @@ -7,6 +7,7 @@ · 2 unmodified lines | ||
| 7 | 7 | #include <linux/init.h> |
| 8 | 8 | #include <linux/time.h> |
| 9 | 9 | #include <linux/slab.h> |
| 10 | +#include <linux/mm.h> | |
| 10 | 11 | #include <linux/seq_file.h> |
| 11 | 12 | #include <linux/pagemap.h> |
| 12 | 13 | #include <linux/mpage.h> |
| @@ -3450,7 +3451,7 @@ static void exfat_free_super(struct exfat_sb_info *sbi) · 3437 unmodified lines | ||
| 3450 | 3451 | kfree(sbi->options.iocharset); |
| 3451 | 3452 | /* mutex_init is in exfat_fill_super function. only for 3.7+ */ |
| 3452 | 3453 | mutex_destroy(&sbi->s_lock); |
| 3453 | − kfree(sbi); | |
| 3454 | + kvfree(sbi); | |
| 3454 | 3455 | } |
| 3455 | 3456 | |
| 3456 | 3457 | static void exfat_put_super(struct super_block *sb) |
| @@ -3845,7 +3846,7 @@ static int exfat_fill_super(struct super_block *sb, void *data, int silent) · 388 unmodified lines | ||
| 3845 | 3846 | * the filesystem, since we're only just about to mount |
| 3846 | 3847 | * it and have no inodes etc active! |
| 3847 | 3848 | */ |
| 3848 | − sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL); | |
| 3849 | + sbi = kvzalloc(sizeof(*sbi), GFP_KERNEL); | |
| 3849 | 3850 | if (!sbi) |
| 3850 | 3851 | return -ENOMEM; |
| 3851 | 3852 | mutex_init(&sbi->s_lock); |
| @@ -1,4 +1,4 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. |
| 4 | 4 | */ |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | menuconfig FB_TFT |
| 3 | 3 | tristate "Support for small TFT LCD display modules" |
| 4 | − depends on FB && SPI | |
| 4 | + depends on FB && SPI && OF | |
| 5 | 5 | depends on GPIOLIB || COMPILE_TEST |
| 6 | 6 | select FB_SYS_FILLRECT |
| 7 | 7 | select FB_SYS_COPYAREA |
| @@ -199,13 +199,3 @@ config FB_TFT_WATTEROTT · 191 unmodified lines | ||
| 199 | 199 | depends on FB_TFT |
| 200 | 200 | help |
| 201 | 201 | Generic Framebuffer support for WATTEROTT |
| 202 | − | |
| 203 | −config FB_FLEX | |
| 204 | − tristate "Generic FB driver for TFT LCD displays" | |
| 205 | − depends on FB_TFT | |
| 206 | − help | |
| 207 | − Generic Framebuffer support for TFT LCD displays. | |
| 208 | − | |
| 209 | −config FB_TFT_FBTFT_DEVICE | |
| 210 | − tristate "Module to for adding FBTFT devices" | |
| 211 | − depends on FB_TFT | |
| @@ -36,7 +36,3 @@ obj-$(CONFIG_FB_TFT_UC1611) += fb_uc1611.o · 35 unmodified lines | ||
| 36 | 36 | obj-$(CONFIG_FB_TFT_UC1701) += fb_uc1701.o |
| 37 | 37 | obj-$(CONFIG_FB_TFT_UPD161704) += fb_upd161704.o |
| 38 | 38 | obj-$(CONFIG_FB_TFT_WATTEROTT) += fb_watterott.o |
| 39 | −obj-$(CONFIG_FB_FLEX) += flexfb.o | |
| 40 | − | |
| 41 | −# Device modules | |
| 42 | −obj-$(CONFIG_FB_TFT_FBTFT_DEVICE) += fbtft_device.o | |
| @@ -714,7 +714,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, · 713 unmodified lines | ||
| 714 | 714 | if (par->gamma.curves && gamma) { |
| 715 | 715 | if (fbtft_gamma_parse_str(par, par->gamma.curves, gamma, |
| 716 | 716 | strlen(gamma))) |
| 717 | − goto alloc_fail; | |
| 717 | + goto release_framebuf; | |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | /* Transmit buffer */ |
| @@ -731,7 +731,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, · 10 unmodified lines | ||
| 731 | 731 | if (txbuflen > 0) { |
| 732 | 732 | txbuf = devm_kzalloc(par->info->device, txbuflen, GFP_KERNEL); |
| 733 | 733 | if (!txbuf) |
| 734 | − goto alloc_fail; | |
| 734 | + goto release_framebuf; | |
| 735 | 735 | par->txbuf.buf = txbuf; |
| 736 | 736 | par->txbuf.len = txbuflen; |
| 737 | 737 | } |
| @@ -753,6 +753,9 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, · 15 unmodified lines | ||
| 753 | 753 | |
| 754 | 754 | return info; |
| 755 | 755 | |
| 756 | +release_framebuf: | |
| 757 | + framebuffer_release(info); | |
| 758 | + | |
| 756 | 759 | alloc_fail: |
| 757 | 760 | vfree(vmem); |
| 758 | 761 | |
| @@ -1,1261 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | −/* | |
| 3 | − * | |
| 4 | − * Copyright (C) 2013, Noralf Tronnes | |
| 5 | − */ | |
| 6 | − | |
| 7 | −#define pr_fmt(fmt) "fbtft_device: " fmt | |
| 8 | −#include <linux/module.h> | |
| 9 | −#include <linux/kernel.h> | |
| 10 | −#include <linux/init.h> | |
| 11 | −#include <linux/gpio/consumer.h> | |
| 12 | −#include <linux/spi/spi.h> | |
| 13 | −#include <video/mipi_display.h> | |
| 14 | − | |
| 15 | −#include "fbtft.h" | |
| 16 | − | |
| 17 | −#define MAX_GPIOS 32 | |
| 18 | − | |
| 19 | −static struct spi_device *spi_device; | |
| 20 | −static struct platform_device *p_device; | |
| 21 | − | |
| 22 | −static char *name; | |
| 23 | −module_param(name, charp, 0000); | |
| 24 | −MODULE_PARM_DESC(name, | |
| 25 | − "Devicename (required). name=list => list all supported devices."); | |
| 26 | − | |
| 27 | −static unsigned int rotate; | |
| 28 | −module_param(rotate, uint, 0000); | |
| 29 | −MODULE_PARM_DESC(rotate, | |
| 30 | − "Angle to rotate display counter clockwise: 0, 90, 180, 270"); | |
| 31 | − | |
| 32 | −static unsigned int busnum; | |
| 33 | −module_param(busnum, uint, 0000); | |
| 34 | −MODULE_PARM_DESC(busnum, "SPI bus number (default=0)"); | |
| 35 | − | |
| 36 | −static unsigned int cs; | |
| 37 | −module_param(cs, uint, 0000); | |
| 38 | −MODULE_PARM_DESC(cs, "SPI chip select (default=0)"); | |
| 39 | − | |
| 40 | −static unsigned int speed; | |
| 41 | −module_param(speed, uint, 0000); | |
| 42 | −MODULE_PARM_DESC(speed, "SPI speed (override device default)"); | |
| 43 | − | |
| 44 | −static int mode = -1; | |
| 45 | −module_param(mode, int, 0000); | |
| 46 | −MODULE_PARM_DESC(mode, "SPI mode (override device default)"); | |
| 47 | − | |
| 48 | −static unsigned int fps; | |
| 49 | −module_param(fps, uint, 0000); | |
| 50 | −MODULE_PARM_DESC(fps, "Frames per second (override driver default)"); | |
| 51 | − | |
| 52 | −static char *gamma; | |
| 53 | −module_param(gamma, charp, 0000); | |
| 54 | −MODULE_PARM_DESC(gamma, | |
| 55 | − "String representation of Gamma Curve(s). Driver specific."); | |
| 56 | − | |
| 57 | −static int txbuflen; | |
| 58 | −module_param(txbuflen, int, 0000); | |
| 59 | −MODULE_PARM_DESC(txbuflen, "txbuflen (override driver default)"); | |
| 60 | − | |
| 61 | −static int bgr = -1; | |
| 62 | −module_param(bgr, int, 0000); | |
| 63 | −MODULE_PARM_DESC(bgr, | |
| 64 | − "BGR bit (supported by some drivers)."); | |
| 65 | − | |
| 66 | −static unsigned int startbyte; | |
| 67 | −module_param(startbyte, uint, 0000); | |
| 68 | −MODULE_PARM_DESC(startbyte, "Sets the Start byte used by some SPI displays."); | |
| 69 | − | |
| 70 | −static bool custom; | |
| 71 | −module_param(custom, bool, 0000); | |
| 72 | −MODULE_PARM_DESC(custom, "Add a custom display device. Use speed= argument to make it a SPI device, else platform_device"); | |
| 73 | − | |
| 74 | −static unsigned int width; | |
| 75 | −module_param(width, uint, 0000); | |
| 76 | −MODULE_PARM_DESC(width, "Display width, used with the custom argument"); | |
| 77 | − | |
| 78 | −static unsigned int height; | |
| 79 | −module_param(height, uint, 0000); | |
| 80 | −MODULE_PARM_DESC(height, "Display height, used with the custom argument"); | |
| 81 | − | |
| 82 | −static unsigned int buswidth = 8; | |
| 83 | −module_param(buswidth, uint, 0000); | |
| 84 | −MODULE_PARM_DESC(buswidth, "Display bus width, used with the custom argument"); | |
| 85 | − | |
| 86 | −static s16 init[FBTFT_MAX_INIT_SEQUENCE]; | |
| 87 | −static int init_num; | |
| 88 | −module_param_array(init, short, &init_num, 0000); | |
| 89 | −MODULE_PARM_DESC(init, "Init sequence, used with the custom argument"); | |
| 90 | − | |
| 91 | −static unsigned long debug; | |
| 92 | −module_param(debug, ulong, 0000); | |
| 93 | −MODULE_PARM_DESC(debug, | |
| 94 | − "level: 0-7 (the remaining 29 bits is for advanced usage)"); | |
| 95 | − | |
| 96 | −static unsigned int verbose = 3; | |
| 97 | −module_param(verbose, uint, 0000); | |
| 98 | −MODULE_PARM_DESC(verbose, | |
| 99 | − "0 silent, >1 show devices, >2 show devices before (default=3)"); | |
| 100 | − | |
| 101 | −struct fbtft_device_display { | |
| 102 | − char *name; | |
| 103 | − struct spi_board_info *spi; | |
| 104 | − struct platform_device *pdev; | |
| 105 | −}; | |
| 106 | − | |
| 107 | −static void fbtft_device_pdev_release(struct device *dev); | |
| 108 | − | |
| 109 | −static int write_gpio16_wr_slow(struct fbtft_par *par, void *buf, size_t len); | |
| 110 | −static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par, | |
| 111 | − int xs, int ys, int xe, int ye); | |
| 112 | − | |
| 113 | −#define ADAFRUIT18_GAMMA \ | |
| 114 | − "02 1c 07 12 37 32 29 2d 29 25 2B 39 00 01 03 10\n" \ | |
| 115 | − "03 1d 07 06 2E 2C 29 2D 2E 2E 37 3F 00 00 02 10" | |
| 116 | − | |
| 117 | −#define CBERRY28_GAMMA \ | |
| 118 | − "D0 00 14 15 13 2C 42 43 4E 09 16 14 18 21\n" \ | |
| 119 | − "D0 00 14 15 13 0B 43 55 53 0C 17 14 23 20" | |
| 120 | − | |
| 121 | −static const s16 cberry28_init_sequence[] = { | |
| 122 | − /* turn off sleep mode */ | |
| 123 | − -1, MIPI_DCS_EXIT_SLEEP_MODE, | |
| 124 | − -2, 120, | |
| 125 | − | |
| 126 | − /* set pixel format to RGB-565 */ | |
| 127 | − -1, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT, | |
| 128 | − | |
| 129 | − -1, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33, | |
| 130 | − | |
| 131 | − /* | |
| 132 | − * VGH = 13.26V | |
| 133 | − * VGL = -10.43V | |
| 134 | − */ | |
| 135 | − -1, 0xB7, 0x35, | |
| 136 | − | |
| 137 | − /* | |
| 138 | − * VDV and VRH register values come from command write | |
| 139 | − * (instead of NVM) | |
| 140 | − */ | |
| 141 | − -1, 0xC2, 0x01, 0xFF, | |
| 142 | − | |
| 143 | − /* | |
| 144 | − * VAP = 4.7V + (VCOM + VCOM offset + 0.5 * VDV) | |
| 145 | − * VAN = -4.7V + (VCOM + VCOM offset + 0.5 * VDV) | |
| 146 | − */ | |
| 147 | − -1, 0xC3, 0x17, | |
| 148 | − | |
| 149 | − /* VDV = 0V */ | |
| 150 | − -1, 0xC4, 0x20, | |
| 151 | − | |
| 152 | − /* VCOM = 0.675V */ | |
| 153 | − -1, 0xBB, 0x17, | |
| 154 | − | |
| 155 | − /* VCOM offset = 0V */ | |
| 156 | − -1, 0xC5, 0x20, | |
| 157 | − | |
| 158 | − /* | |
| 159 | − * AVDD = 6.8V | |
| 160 | − * AVCL = -4.8V | |
| 161 | − * VDS = 2.3V | |
| 162 | − */ | |
| 163 | − -1, 0xD0, 0xA4, 0xA1, | |
| 164 | − | |
| 165 | − -1, MIPI_DCS_SET_DISPLAY_ON, | |
| 166 | − | |
| 167 | − -3, | |
| 168 | −}; | |
| 169 | − | |
| 170 | −static const s16 hy28b_init_sequence[] = { | |
| 171 | − -1, 0x00e7, 0x0010, -1, 0x0000, 0x0001, | |
| 172 | − -1, 0x0001, 0x0100, -1, 0x0002, 0x0700, | |
| 173 | − -1, 0x0003, 0x1030, -1, 0x0004, 0x0000, | |
| 174 | − -1, 0x0008, 0x0207, -1, 0x0009, 0x0000, | |
| 175 | − -1, 0x000a, 0x0000, -1, 0x000c, 0x0001, | |
| 176 | − -1, 0x000d, 0x0000, -1, 0x000f, 0x0000, | |
| 177 | − -1, 0x0010, 0x0000, -1, 0x0011, 0x0007, | |
| 178 | − -1, 0x0012, 0x0000, -1, 0x0013, 0x0000, | |
| 179 | − -2, 50, -1, 0x0010, 0x1590, -1, 0x0011, | |
| 180 | − 0x0227, -2, 50, -1, 0x0012, 0x009c, -2, 50, | |
| 181 | − -1, 0x0013, 0x1900, -1, 0x0029, 0x0023, | |
| 182 | − -1, 0x002b, 0x000e, -2, 50, | |
| 183 | − -1, 0x0020, 0x0000, -1, 0x0021, 0x0000, | |
| 184 | − -2, 50, -1, 0x0050, 0x0000, | |
| 185 | − -1, 0x0051, 0x00ef, -1, 0x0052, 0x0000, | |
| 186 | − -1, 0x0053, 0x013f, -1, 0x0060, 0xa700, | |
| 187 | − -1, 0x0061, 0x0001, -1, 0x006a, 0x0000, | |
| 188 | − -1, 0x0080, 0x0000, -1, 0x0081, 0x0000, | |
| 189 | − -1, 0x0082, 0x0000, -1, 0x0083, 0x0000, | |
| 190 | − -1, 0x0084, 0x0000, -1, 0x0085, 0x0000, | |
| 191 | − -1, 0x0090, 0x0010, -1, 0x0092, 0x0000, | |
| 192 | − -1, 0x0093, 0x0003, -1, 0x0095, 0x0110, | |
| 193 | − -1, 0x0097, 0x0000, -1, 0x0098, 0x0000, | |
| 194 | − -1, 0x0007, 0x0133, -1, 0x0020, 0x0000, | |
| 195 | − -1, 0x0021, 0x0000, -2, 100, -3 }; | |
| 196 | − | |
| 197 | −#define HY28B_GAMMA \ | |
| 198 | − "04 1F 4 7 7 0 7 7 6 0\n" \ | |
| 199 | − "0F 00 1 7 4 0 0 0 6 7" | |
| 200 | − | |
| 201 | −static const s16 pitft_init_sequence[] = { | |
| 202 | − -1, MIPI_DCS_SOFT_RESET, | |
| 203 | − -2, 5, | |
| 204 | − -1, MIPI_DCS_SET_DISPLAY_OFF, | |
| 205 | − -1, 0xEF, 0x03, 0x80, 0x02, | |
| 206 | − -1, 0xCF, 0x00, 0xC1, 0x30, | |
| 207 | − -1, 0xED, 0x64, 0x03, 0x12, 0x81, | |
| 208 | − -1, 0xE8, 0x85, 0x00, 0x78, | |
| 209 | − -1, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02, | |
| 210 | − -1, 0xF7, 0x20, | |
| 211 | − -1, 0xEA, 0x00, 0x00, | |
| 212 | − -1, 0xC0, 0x23, | |
| 213 | − -1, 0xC1, 0x10, | |
| 214 | − -1, 0xC5, 0x3E, 0x28, | |
| 215 | − -1, 0xC7, 0x86, | |
| 216 | − -1, MIPI_DCS_SET_PIXEL_FORMAT, 0x55, | |
| 217 | − -1, 0xB1, 0x00, 0x18, | |
| 218 | − -1, 0xB6, 0x08, 0x82, 0x27, | |
| 219 | − -1, 0xF2, 0x00, | |
| 220 | − -1, MIPI_DCS_SET_GAMMA_CURVE, 0x01, | |
| 221 | − -1, 0xE0, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, | |
| 222 | − 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, | |
| 223 | − -1, 0xE1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, | |
| 224 | − 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, | |
| 225 | − -1, MIPI_DCS_EXIT_SLEEP_MODE, | |
| 226 | − -2, 100, | |
| 227 | − -1, MIPI_DCS_SET_DISPLAY_ON, | |
| 228 | − -2, 20, | |
| 229 | − -3 | |
| 230 | −}; | |
| 231 | − | |
| 232 | −static const s16 waveshare32b_init_sequence[] = { | |
| 233 | − -1, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02, | |
| 234 | − -1, 0xCF, 0x00, 0xC1, 0x30, | |
| 235 | − -1, 0xE8, 0x85, 0x00, 0x78, | |
| 236 | − -1, 0xEA, 0x00, 0x00, | |
| 237 | − -1, 0xED, 0x64, 0x03, 0x12, 0x81, | |
| 238 | − -1, 0xF7, 0x20, | |
| 239 | − -1, 0xC0, 0x23, | |
| 240 | − -1, 0xC1, 0x10, | |
| 241 | − -1, 0xC5, 0x3E, 0x28, | |
| 242 | − -1, 0xC7, 0x86, | |
| 243 | − -1, MIPI_DCS_SET_ADDRESS_MODE, 0x28, | |
| 244 | − -1, MIPI_DCS_SET_PIXEL_FORMAT, 0x55, | |
| 245 | − -1, 0xB1, 0x00, 0x18, | |
| 246 | − -1, 0xB6, 0x08, 0x82, 0x27, | |
| 247 | − -1, 0xF2, 0x00, | |
| 248 | − -1, MIPI_DCS_SET_GAMMA_CURVE, 0x01, | |
| 249 | − -1, 0xE0, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, | |
| 250 | − 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, | |
| 251 | − -1, 0xE1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, | |
| 252 | − 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, | |
| 253 | − -1, MIPI_DCS_EXIT_SLEEP_MODE, | |
| 254 | − -2, 120, | |
| 255 | − -1, MIPI_DCS_SET_DISPLAY_ON, | |
| 256 | − -1, MIPI_DCS_WRITE_MEMORY_START, | |
| 257 | − -3 | |
| 258 | −}; | |
| 259 | − | |
| 260 | −#define PIOLED_GAMMA "0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 " \ | |
| 261 | − "2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 " \ | |
| 262 | − "3 3 3 4 4 4 4 4 4 4 4 4 4 4 4" | |
| 263 | − | |
| 264 | −/* Supported displays in alphabetical order */ | |
| 265 | −static struct fbtft_device_display displays[] = { | |
| 266 | − { | |
| 267 | − .name = "adafruit18", | |
| 268 | − .spi = &(struct spi_board_info) { | |
| 269 | − .modalias = "fb_st7735r", | |
| 270 | − .max_speed_hz = 32000000, | |
| 271 | − .mode = SPI_MODE_0, | |
| 272 | − .platform_data = &(struct fbtft_platform_data) { | |
| 273 | − .display = { | |
| 274 | − .buswidth = 8, | |
| 275 | − .backlight = 1, | |
| 276 | − }, | |
| 277 | − .gamma = ADAFRUIT18_GAMMA, | |
| 278 | − } | |
| 279 | − } | |
| 280 | − }, { | |
| 281 | − .name = "adafruit18_green", | |
| 282 | − .spi = &(struct spi_board_info) { | |
| 283 | − .modalias = "fb_st7735r", | |
| 284 | − .max_speed_hz = 4000000, | |
| 285 | − .mode = SPI_MODE_0, | |
| 286 | − .platform_data = &(struct fbtft_platform_data) { | |
| 287 | − .display = { | |
| 288 | − .buswidth = 8, | |
| 289 | − .backlight = 1, | |
| 290 | − .fbtftops.set_addr_win = | |
| 291 | − adafruit18_green_tab_set_addr_win, | |
| 292 | − }, | |
| 293 | − .bgr = true, | |
| 294 | − .gamma = ADAFRUIT18_GAMMA, | |
| 295 | − } | |
| 296 | − } | |
| 297 | − }, { | |
| 298 | − .name = "adafruit22", | |
| 299 | − .spi = &(struct spi_board_info) { | |
| 300 | − .modalias = "fb_hx8340bn", | |
| 301 | − .max_speed_hz = 32000000, | |
| 302 | − .mode = SPI_MODE_0, | |
| 303 | − .platform_data = &(struct fbtft_platform_data) { | |
| 304 | − .display = { | |
| 305 | − .buswidth = 9, | |
| 306 | − .backlight = 1, | |
| 307 | − }, | |
| 308 | − .bgr = true, | |
| 309 | − } | |
| 310 | − } | |
| 311 | − }, { | |
| 312 | − .name = "adafruit22a", | |
| 313 | − .spi = &(struct spi_board_info) { | |
| 314 | − .modalias = "fb_ili9340", | |
| 315 | − .max_speed_hz = 32000000, | |
| 316 | − .mode = SPI_MODE_0, | |
| 317 | − .platform_data = &(struct fbtft_platform_data) { | |
| 318 | − .display = { | |
| 319 | − .buswidth = 8, | |
| 320 | − .backlight = 1, | |
| 321 | − }, | |
| 322 | − .bgr = true, | |
| 323 | − } | |
| 324 | − } | |
| 325 | − }, { | |
| 326 | − .name = "adafruit28", | |
| 327 | − .spi = &(struct spi_board_info) { | |
| 328 | − .modalias = "fb_ili9341", | |
| 329 | − .max_speed_hz = 32000000, | |
| 330 | − .mode = SPI_MODE_0, | |
| 331 | − .platform_data = &(struct fbtft_platform_data) { | |
| 332 | − .display = { | |
| 333 | − .buswidth = 8, | |
| 334 | − .backlight = 1, | |
| 335 | − }, | |
| 336 | − .bgr = true, | |
| 337 | − } | |
| 338 | − } | |
| 339 | − }, { | |
| 340 | − .name = "adafruit13m", | |
| 341 | − .spi = &(struct spi_board_info) { | |
| 342 | − .modalias = "fb_ssd1306", | |
| 343 | − .max_speed_hz = 16000000, | |
| 344 | − .mode = SPI_MODE_0, | |
| 345 | − .platform_data = &(struct fbtft_platform_data) { | |
| 346 | − .display = { | |
| 347 | − .buswidth = 8, | |
| 348 | − }, | |
| 349 | − } | |
| 350 | − } | |
| 351 | − }, { | |
| 352 | − .name = "admatec_c-berry28", | |
| 353 | − .spi = &(struct spi_board_info) { | |
| 354 | − .modalias = "fb_st7789v", | |
| 355 | − .max_speed_hz = 48000000, | |
| 356 | − .mode = SPI_MODE_0, | |
| 357 | − .platform_data = &(struct fbtft_platform_data) { | |
| 358 | − .display = { | |
| 359 | − .buswidth = 8, | |
| 360 | − .backlight = 1, | |
| 361 | − .init_sequence = cberry28_init_sequence, | |
| 362 | − }, | |
| 363 | − .gamma = CBERRY28_GAMMA, | |
| 364 | − } | |
| 365 | − } | |
| 366 | − }, { | |
| 367 | − .name = "agm1264k-fl", | |
| 368 | − .pdev = &(struct platform_device) { | |
| 369 | − .name = "fb_agm1264k-fl", | |
| 370 | − .id = 0, | |
| 371 | − .dev = { | |
| 372 | − .release = fbtft_device_pdev_release, | |
| 373 | − .platform_data = &(struct fbtft_platform_data) { | |
| 374 | − .display = { | |
| 375 | − .buswidth = 8, | |
| 376 | − .backlight = FBTFT_ONBOARD_BACKLIGHT, | |
| 377 | − }, | |
| 378 | − }, | |
| 379 | − } | |
| 380 | − } | |
| 381 | − }, { | |
| 382 | − .name = "dogs102", | |
| 383 | − .spi = &(struct spi_board_info) { | |
| 384 | − .modalias = "fb_uc1701", | |
| 385 | − .max_speed_hz = 8000000, | |
| 386 | − .mode = SPI_MODE_0, | |
| 387 | − .platform_data = &(struct fbtft_platform_data) { | |
| 388 | − .display = { | |
| 389 | − .buswidth = 8, | |
| 390 | − }, | |
| 391 | − .bgr = true, | |
| 392 | − } | |
| 393 | − } | |
| 394 | − }, { | |
| 395 | − .name = "er_tftm050_2", | |
| 396 | − .spi = &(struct spi_board_info) { | |
| 397 | − .modalias = "fb_ra8875", | |
| 398 | − .max_speed_hz = 5000000, | |
| 399 | − .mode = SPI_MODE_3, | |
| 400 | − .platform_data = &(struct fbtft_platform_data) { | |
| 401 | − .display = { | |
| 402 | − .buswidth = 8, | |
| 403 | − .backlight = 1, | |
| 404 | − .width = 480, | |
| 405 | − .height = 272, | |
| 406 | − }, | |
| 407 | − .bgr = true, | |
| 408 | − } | |
| 409 | − } | |
| 410 | − }, { | |
| 411 | − .name = "er_tftm070_5", | |
| 412 | − .spi = &(struct spi_board_info) { | |
| 413 | − .modalias = "fb_ra8875", | |
| 414 | − .max_speed_hz = 5000000, | |
| 415 | − .mode = SPI_MODE_3, | |
| 416 | − .platform_data = &(struct fbtft_platform_data) { | |
| 417 | − .display = { | |
| 418 | − .buswidth = 8, | |
| 419 | − .backlight = 1, | |
| 420 | − .width = 800, | |
| 421 | − .height = 480, | |
| 422 | − }, | |
| 423 | − .bgr = true, | |
| 424 | − } | |
| 425 | − } | |
| 426 | − }, { | |
| 427 | − .name = "ew24ha0", | |
| 428 | − .spi = &(struct spi_board_info) { | |
| 429 | − .modalias = "fb_uc1611", | |
| 430 | − .max_speed_hz = 32000000, | |
| 431 | − .mode = SPI_MODE_3, | |
| 432 | − .platform_data = &(struct fbtft_platform_data) { | |
| 433 | − .display = { | |
| 434 | − .buswidth = 8, | |
| 435 | − }, | |
| 436 | − } | |
| 437 | − } | |
| 438 | − }, { | |
| 439 | − .name = "ew24ha0_9bit", | |
| 440 | − .spi = &(struct spi_board_info) { | |
| 441 | − .modalias = "fb_uc1611", | |
| 442 | − .max_speed_hz = 32000000, | |
| 443 | − .mode = SPI_MODE_3, | |
| 444 | − .platform_data = &(struct fbtft_platform_data) { | |
| 445 | − .display = { | |
| 446 | − .buswidth = 9, | |
| 447 | − }, | |
| 448 | − } | |
| 449 | − } | |
| 450 | − }, { | |
| 451 | − .name = "flexfb", | |
| 452 | − .spi = &(struct spi_board_info) { | |
| 453 | − .modalias = "flexfb", | |
| 454 | − .max_speed_hz = 32000000, | |
| 455 | − .mode = SPI_MODE_0, | |
| 456 | − } | |
| 457 | − }, { | |
| 458 | − .name = "flexpfb", | |
| 459 | − .pdev = &(struct platform_device) { | |
| 460 | − .name = "flexpfb", | |
| 461 | − .id = 0, | |
| 462 | − .dev = { | |
| 463 | − .release = fbtft_device_pdev_release, | |
| 464 | − } | |
| 465 | − } | |
| 466 | − }, { | |
| 467 | − .name = "freetronicsoled128", | |
| 468 | − .spi = &(struct spi_board_info) { | |
| 469 | − .modalias = "fb_ssd1351", | |
| 470 | − .max_speed_hz = 20000000, | |
| 471 | − .mode = SPI_MODE_0, | |
| 472 | − .platform_data = &(struct fbtft_platform_data) { | |
| 473 | − .display = { | |
| 474 | − .buswidth = 8, | |
| 475 | − .backlight = FBTFT_ONBOARD_BACKLIGHT, | |
| 476 | − }, | |
| 477 | − .bgr = true, | |
| 478 | − } | |
| 479 | − } | |
| 480 | − }, { | |
| 481 | − .name = "hx8353d", | |
| 482 | − .spi = &(struct spi_board_info) { | |
| 483 | − .modalias = "fb_hx8353d", | |
| 484 | − .max_speed_hz = 16000000, | |
| 485 | − .mode = SPI_MODE_0, | |
| 486 | − .platform_data = &(struct fbtft_platform_data) { | |
| 487 | − .display = { | |
| 488 | − .buswidth = 8, | |
| 489 | − .backlight = 1, | |
| 490 | − }, | |
| 491 | − } | |
| 492 | − } | |
| 493 | − }, { | |
| 494 | − .name = "hy28a", | |
| 495 | − .spi = &(struct spi_board_info) { | |
| 496 | − .modalias = "fb_ili9320", | |
| 497 | − .max_speed_hz = 32000000, | |
| 498 | − .mode = SPI_MODE_3, | |
| 499 | − .platform_data = &(struct fbtft_platform_data) { | |
| 500 | − .display = { | |
| 501 | − .buswidth = 8, | |
| 502 | − .backlight = 1, | |
| 503 | − }, | |
| 504 | − .startbyte = 0x70, | |
| 505 | − .bgr = true, | |
| 506 | − } | |
| 507 | − } | |
| 508 | − }, { | |
| 509 | − .name = "hy28b", | |
| 510 | − .spi = &(struct spi_board_info) { | |
| 511 | − .modalias = "fb_ili9325", | |
| 512 | − .max_speed_hz = 48000000, | |
| 513 | − .mode = SPI_MODE_3, | |
| 514 | − .platform_data = &(struct fbtft_platform_data) { | |
| 515 | − .display = { | |
| 516 | − .buswidth = 8, | |
| 517 | − .backlight = 1, | |
| 518 | − .init_sequence = hy28b_init_sequence, | |
| 519 | − }, | |
| 520 | − .startbyte = 0x70, | |
| 521 | − .bgr = true, | |
| 522 | − .fps = 50, | |
| 523 | − .gamma = HY28B_GAMMA, | |
| 524 | − } | |
| 525 | − } | |
| 526 | − }, { | |
| 527 | − .name = "ili9481", | |
| 528 | − .spi = &(struct spi_board_info) { | |
| 529 | − .modalias = "fb_ili9481", | |
| 530 | − .max_speed_hz = 32000000, | |
| 531 | − .mode = SPI_MODE_0, | |
| 532 | − .platform_data = &(struct fbtft_platform_data) { | |
| 533 | − .display = { | |
| 534 | − .regwidth = 16, | |
| 535 | − .buswidth = 8, | |
| 536 | − .backlight = 1, | |
| 537 | − }, | |
| 538 | − .bgr = true, | |
| 539 | − } | |
| 540 | − } | |
| 541 | − }, { | |
| 542 | − .name = "itdb24", | |
| 543 | − .pdev = &(struct platform_device) { | |
| 544 | − .name = "fb_s6d1121", | |
| 545 | − .id = 0, | |
| 546 | − .dev = { | |
| 547 | − .release = fbtft_device_pdev_release, | |
| 548 | − .platform_data = &(struct fbtft_platform_data) { | |
| 549 | − .display = { | |
| 550 | − .buswidth = 8, | |
| 551 | − .backlight = 1, | |
| 552 | − }, | |
| 553 | − .bgr = false, | |
| 554 | − }, | |
| 555 | − } | |
| 556 | − } | |
| 557 | − }, { | |
| 558 | − .name = "itdb28", | |
| 559 | − .pdev = &(struct platform_device) { | |
| 560 | − .name = "fb_ili9325", | |
| 561 | − .id = 0, | |
| 562 | − .dev = { | |
| 563 | − .release = fbtft_device_pdev_release, | |
| 564 | − .platform_data = &(struct fbtft_platform_data) { | |
| 565 | − .display = { | |
| 566 | − .buswidth = 8, | |
| 567 | − .backlight = 1, | |
| 568 | − }, | |
| 569 | − .bgr = true, | |
| 570 | − }, | |
| 571 | − } | |
| 572 | − } | |
| 573 | − }, { | |
| 574 | − .name = "itdb28_spi", | |
| 575 | − .spi = &(struct spi_board_info) { | |
| 576 | − .modalias = "fb_ili9325", | |
| 577 | − .max_speed_hz = 32000000, | |
| 578 | − .mode = SPI_MODE_0, | |
| 579 | − .platform_data = &(struct fbtft_platform_data) { | |
| 580 | − .display = { | |
| 581 | − .buswidth = 8, | |
| 582 | − .backlight = 1, | |
| 583 | − }, | |
| 584 | − .bgr = true, | |
| 585 | − } | |
| 586 | − } | |
| 587 | − }, { | |
| 588 | − .name = "mi0283qt-2", | |
| 589 | − .spi = &(struct spi_board_info) { | |
| 590 | − .modalias = "fb_hx8347d", | |
| 591 | − .max_speed_hz = 32000000, | |
| 592 | − .mode = SPI_MODE_0, | |
| 593 | − .platform_data = &(struct fbtft_platform_data) { | |
| 594 | − .display = { | |
| 595 | − .buswidth = 8, | |
| 596 | − .backlight = 1, | |
| 597 | − }, | |
| 598 | − .startbyte = 0x70, | |
| 599 | − .bgr = true, | |
| 600 | − } | |
| 601 | − } | |
| 602 | − }, { | |
| 603 | − .name = "mi0283qt-9a", | |
| 604 | − .spi = &(struct spi_board_info) { | |
| 605 | − .modalias = "fb_ili9341", | |
| 606 | − .max_speed_hz = 32000000, | |
| 607 | − .mode = SPI_MODE_0, | |
| 608 | − .platform_data = &(struct fbtft_platform_data) { | |
| 609 | − .display = { | |
| 610 | − .buswidth = 9, | |
| 611 | − .backlight = 1, | |
| 612 | − }, | |
| 613 | − .bgr = true, | |
| 614 | − } | |
| 615 | − } | |
| 616 | − }, { | |
| 617 | − .name = "mi0283qt-v2", | |
| 618 | − .spi = &(struct spi_board_info) { | |
| 619 | − .modalias = "fb_watterott", | |
| 620 | − .max_speed_hz = 4000000, | |
| 621 | − .mode = SPI_MODE_3, | |
| 622 | − .platform_data = &(struct fbtft_platform_data) { | |
| 623 | − } | |
| 624 | − } | |
| 625 | − }, { | |
| 626 | − .name = "nokia3310", | |
| 627 | − .spi = &(struct spi_board_info) { | |
| 628 | − .modalias = "fb_pcd8544", | |
| 629 | − .max_speed_hz = 400000, | |
| 630 | − .mode = SPI_MODE_0, | |
| 631 | − .platform_data = &(struct fbtft_platform_data) { | |
| 632 | − .display = { | |
| 633 | − .buswidth = 8, | |
| 634 | − }, | |
| 635 | − } | |
| 636 | − } | |
| 637 | − }, { | |
| 638 | − .name = "nokia3310a", | |
| 639 | − .spi = &(struct spi_board_info) { | |
| 640 | − .modalias = "fb_tls8204", | |
| 641 | − .max_speed_hz = 1000000, | |
| 642 | − .mode = SPI_MODE_0, | |
| 643 | − .platform_data = &(struct fbtft_platform_data) { | |
| 644 | − .display = { | |
| 645 | − .buswidth = 8, | |
| 646 | − }, | |
| 647 | − } | |
| 648 | − } | |
| 649 | − }, { | |
| 650 | − .name = "nokia5110", | |
| 651 | − .spi = &(struct spi_board_info) { | |
| 652 | − .modalias = "fb_ili9163", | |
| 653 | − .max_speed_hz = 12000000, | |
| 654 | − .mode = SPI_MODE_0, | |
| 655 | − .platform_data = &(struct fbtft_platform_data) { | |
| 656 | − .display = { | |
| 657 | − .buswidth = 8, | |
| 658 | − .backlight = 1, | |
| 659 | − }, | |
| 660 | − .bgr = true, | |
| 661 | − } | |
| 662 | − } | |
| 663 | − }, { | |
| 664 | − .name = "piscreen", | |
| 665 | − .spi = &(struct spi_board_info) { | |
| 666 | − .modalias = "fb_ili9486", | |
| 667 | − .max_speed_hz = 32000000, | |
| 668 | − .mode = SPI_MODE_0, | |
| 669 | − .platform_data = &(struct fbtft_platform_data) { | |
| 670 | − .display = { | |
| 671 | − .regwidth = 16, | |
| 672 | − .buswidth = 8, | |
| 673 | − .backlight = 1, | |
| 674 | − }, | |
| 675 | − .bgr = true, | |
| 676 | − } | |
| 677 | − } | |
| 678 | − }, { | |
| 679 | − .name = "pitft", | |
| 680 | − .spi = &(struct spi_board_info) { | |
| 681 | − .modalias = "fb_ili9340", | |
| 682 | − .max_speed_hz = 32000000, | |
| 683 | − .mode = SPI_MODE_0, | |
| 684 | − .chip_select = 0, | |
| 685 | − .platform_data = &(struct fbtft_platform_data) { | |
| 686 | − .display = { | |
| 687 | − .buswidth = 8, | |
| 688 | − .backlight = 1, | |
| 689 | − .init_sequence = pitft_init_sequence, | |
| 690 | − }, | |
| 691 | − .bgr = true, | |
| 692 | − } | |
| 693 | − } | |
| 694 | − }, { | |
| 695 | − .name = "pioled", | |
| 696 | − .spi = &(struct spi_board_info) { | |
| 697 | − .modalias = "fb_ssd1351", | |
| 698 | − .max_speed_hz = 20000000, | |
| 699 | − .mode = SPI_MODE_0, | |
| 700 | − .platform_data = &(struct fbtft_platform_data) { | |
| 701 | − .display = { | |
| 702 | − .buswidth = 8, | |
| 703 | − }, | |
| 704 | − .bgr = true, | |
| 705 | − .gamma = PIOLED_GAMMA | |
| 706 | − } | |
| 707 | − } | |
| 708 | − }, { | |
| 709 | − .name = "rpi-display", | |
| 710 | − .spi = &(struct spi_board_info) { | |
| 711 | − .modalias = "fb_ili9341", | |
| 712 | − .max_speed_hz = 32000000, | |
| 713 | − .mode = SPI_MODE_0, | |
| 714 | − .platform_data = &(struct fbtft_platform_data) { | |
| 715 | − .display = { | |
| 716 | − .buswidth = 8, | |
| 717 | − .backlight = 1, | |
| 718 | − }, | |
| 719 | − .bgr = true, | |
| 720 | − } | |
| 721 | − } | |
| 722 | − }, { | |
| 723 | − .name = "s6d02a1", | |
| 724 | − .spi = &(struct spi_board_info) { | |
| 725 | − .modalias = "fb_s6d02a1", | |
| 726 | − .max_speed_hz = 32000000, | |
| 727 | − .mode = SPI_MODE_0, | |
| 728 | − .platform_data = &(struct fbtft_platform_data) { | |
| 729 | − .display = { | |
| 730 | − .buswidth = 8, | |
| 731 | − .backlight = 1, | |
| 732 | − }, | |
| 733 | − .bgr = true, | |
| 734 | − } | |
| 735 | − } | |
| 736 | − }, { | |
| 737 | − .name = "sainsmart18", | |
| 738 | − .spi = &(struct spi_board_info) { | |
| 739 | − .modalias = "fb_st7735r", | |
| 740 | − .max_speed_hz = 32000000, | |
| 741 | − .mode = SPI_MODE_0, | |
| 742 | − .platform_data = &(struct fbtft_platform_data) { | |
| 743 | − .display = { | |
| 744 | − .buswidth = 8, | |
| 745 | − }, | |
| 746 | − } | |
| 747 | − } | |
| 748 | − }, { | |
| 749 | − .name = "sainsmart32", | |
| 750 | − .pdev = &(struct platform_device) { | |
| 751 | − .name = "fb_ssd1289", | |
| 752 | − .id = 0, | |
| 753 | − .dev = { | |
| 754 | − .release = fbtft_device_pdev_release, | |
| 755 | − .platform_data = &(struct fbtft_platform_data) { | |
| 756 | − .display = { | |
| 757 | − .buswidth = 16, | |
| 758 | − .txbuflen = -2, /* disable buffer */ | |
| 759 | − .backlight = 1, | |
| 760 | − .fbtftops.write = write_gpio16_wr_slow, | |
| 761 | − }, | |
| 762 | − .bgr = true, | |
| 763 | − }, | |
| 764 | − }, | |
| 765 | − } | |
| 766 | − }, { | |
| 767 | − .name = "sainsmart32_fast", | |
| 768 | − .pdev = &(struct platform_device) { | |
| 769 | − .name = "fb_ssd1289", | |
| 770 | − .id = 0, | |
| 771 | − .dev = { | |
| 772 | − .release = fbtft_device_pdev_release, | |
| 773 | − .platform_data = &(struct fbtft_platform_data) { | |
| 774 | − .display = { | |
| 775 | − .buswidth = 16, | |
| 776 | − .txbuflen = -2, /* disable buffer */ | |
| 777 | − .backlight = 1, | |
| 778 | − }, | |
| 779 | − .bgr = true, | |
| 780 | − }, | |
| 781 | − }, | |
| 782 | − } | |
| 783 | − }, { | |
| 784 | − .name = "sainsmart32_latched", | |
| 785 | − .pdev = &(struct platform_device) { | |
| 786 | − .name = "fb_ssd1289", | |
| 787 | − .id = 0, | |
| 788 | − .dev = { | |
| 789 | − .release = fbtft_device_pdev_release, | |
| 790 | − .platform_data = &(struct fbtft_platform_data) { | |
| 791 | − .display = { | |
| 792 | − .buswidth = 16, | |
| 793 | − .txbuflen = -2, /* disable buffer */ | |
| 794 | − .backlight = 1, | |
| 795 | − .fbtftops.write = | |
| 796 | − fbtft_write_gpio16_wr_latched, | |
| 797 | − }, | |
| 798 | − .bgr = true, | |
| 799 | − }, | |
| 800 | − }, | |
| 801 | − } | |
| 802 | − }, { | |
| 803 | − .name = "sainsmart32_spi", | |
| 804 | − .spi = &(struct spi_board_info) { | |
| 805 | − .modalias = "fb_ssd1289", | |
| 806 | − .max_speed_hz = 16000000, | |
| 807 | − .mode = SPI_MODE_0, | |
| 808 | − .platform_data = &(struct fbtft_platform_data) { | |
| 809 | − .display = { | |
| 810 | − .buswidth = 8, | |
| 811 | − .backlight = 1, | |
| 812 | − }, | |
| 813 | − .bgr = true, | |
| 814 | − } | |
| 815 | − } | |
| 816 | − }, { | |
| 817 | − .name = "spidev", | |
| 818 | − .spi = &(struct spi_board_info) { | |
| 819 | − .modalias = "spidev", | |
| 820 | − .max_speed_hz = 500000, | |
| 821 | − .bus_num = 0, | |
| 822 | − .chip_select = 0, | |
| 823 | − .mode = SPI_MODE_0, | |
| 824 | − .platform_data = &(struct fbtft_platform_data) { | |
| 825 | − } | |
| 826 | − } | |
| 827 | − }, { | |
| 828 | − .name = "ssd1331", | |
| 829 | − .spi = &(struct spi_board_info) { | |
| 830 | − .modalias = "fb_ssd1331", | |
| 831 | − .max_speed_hz = 20000000, | |
| 832 | − .mode = SPI_MODE_3, | |
| 833 | − .platform_data = &(struct fbtft_platform_data) { | |
| 834 | − .display = { | |
| 835 | − .buswidth = 8, | |
| 836 | − }, | |
| 837 | − } | |
| 838 | − } | |
| 839 | − }, { | |
| 840 | − .name = "tinylcd35", | |
| 841 | − .spi = &(struct spi_board_info) { | |
| 842 | − .modalias = "fb_tinylcd", | |
| 843 | − .max_speed_hz = 32000000, | |
| 844 | − .mode = SPI_MODE_0, | |
| 845 | − .platform_data = &(struct fbtft_platform_data) { | |
| 846 | − .display = { | |
| 847 | − .buswidth = 8, | |
| 848 | − .backlight = 1, | |
| 849 | − }, | |
| 850 | − .bgr = true, | |
| 851 | − } | |
| 852 | − } | |
| 853 | − }, { | |
| 854 | − .name = "tm022hdh26", | |
| 855 | − .spi = &(struct spi_board_info) { | |
| 856 | − .modalias = "fb_ili9341", | |
| 857 | − .max_speed_hz = 32000000, | |
| 858 | − .mode = SPI_MODE_0, | |
| 859 | − .platform_data = &(struct fbtft_platform_data) { | |
| 860 | − .display = { | |
| 861 | − .buswidth = 8, | |
| 862 | − .backlight = 1, | |
| 863 | − }, | |
| 864 | − .bgr = true, | |
| 865 | − } | |
| 866 | − } | |
| 867 | − }, { | |
| 868 | − .name = "tontec35_9481", /* boards before 02 July 2014 */ | |
| 869 | − .spi = &(struct spi_board_info) { | |
| 870 | − .modalias = "fb_ili9481", | |
| 871 | − .max_speed_hz = 128000000, | |
| 872 | − .mode = SPI_MODE_3, | |
| 873 | − .platform_data = &(struct fbtft_platform_data) { | |
| 874 | − .display = { | |
| 875 | − .buswidth = 8, | |
| 876 | − .backlight = 1, | |
| 877 | − }, | |
| 878 | − .bgr = true, | |
| 879 | − } | |
| 880 | − } | |
| 881 | − }, { | |
| 882 | − .name = "tontec35_9486", /* boards after 02 July 2014 */ | |
| 883 | − .spi = &(struct spi_board_info) { | |
| 884 | − .modalias = "fb_ili9486", | |
| 885 | − .max_speed_hz = 128000000, | |
| 886 | − .mode = SPI_MODE_3, | |
| 887 | − .platform_data = &(struct fbtft_platform_data) { | |
| 888 | − .display = { | |
| 889 | − .buswidth = 8, | |
| 890 | − .backlight = 1, | |
| 891 | − }, | |
| 892 | − .bgr = true, | |
| 893 | − } | |
| 894 | − } | |
| 895 | − }, { | |
| 896 | − .name = "upd161704", | |
| 897 | − .spi = &(struct spi_board_info) { | |
| 898 | − .modalias = "fb_upd161704", | |
| 899 | − .max_speed_hz = 32000000, | |
| 900 | − .mode = SPI_MODE_0, | |
| 901 | − .platform_data = &(struct fbtft_platform_data) { | |
| 902 | − .display = { | |
| 903 | − .buswidth = 8, | |
| 904 | − }, | |
| 905 | − } | |
| 906 | − } | |
| 907 | − }, { | |
| 908 | − .name = "waveshare32b", | |
| 909 | − .spi = &(struct spi_board_info) { | |
| 910 | − .modalias = "fb_ili9340", | |
| 911 | − .max_speed_hz = 48000000, | |
| 912 | − .mode = SPI_MODE_0, | |
| 913 | − .platform_data = &(struct fbtft_platform_data) { | |
| 914 | − .display = { | |
| 915 | − .buswidth = 8, | |
| 916 | − .backlight = 1, | |
| 917 | − .init_sequence = | |
| 918 | − waveshare32b_init_sequence, | |
| 919 | − }, | |
| 920 | − .bgr = true, | |
| 921 | − } | |
| 922 | − } | |
| 923 | − }, { | |
| 924 | − .name = "waveshare22", | |
| 925 | − .spi = &(struct spi_board_info) { | |
| 926 | − .modalias = "fb_bd663474", | |
| 927 | − .max_speed_hz = 32000000, | |
| 928 | − .mode = SPI_MODE_3, | |
| 929 | − .platform_data = &(struct fbtft_platform_data) { | |
| 930 | − .display = { | |
| 931 | − .buswidth = 8, | |
| 932 | − }, | |
| 933 | − } | |
| 934 | − } | |
| 935 | − }, { | |
| 936 | − /* This should be the last item. | |
| 937 | − * Used with the custom argument | |
| 938 | − */ | |
| 939 | − .name = "", | |
| 940 | − .spi = &(struct spi_board_info) { | |
| 941 | − .modalias = "", | |
| 942 | − .max_speed_hz = 0, | |
| 943 | − .mode = SPI_MODE_0, | |
| 944 | − .platform_data = &(struct fbtft_platform_data) { | |
| 945 | − } | |
| 946 | − }, | |
| 947 | − .pdev = &(struct platform_device) { | |
| 948 | − .name = "", | |
| 949 | − .id = 0, | |
| 950 | − .dev = { | |
| 951 | − .release = fbtft_device_pdev_release, | |
| 952 | − .platform_data = &(struct fbtft_platform_data) { | |
| 953 | − }, | |
| 954 | − }, | |
| 955 | − }, | |
| 956 | − } | |
| 957 | −}; | |
| 958 | − | |
| 959 | −static int write_gpio16_wr_slow(struct fbtft_par *par, void *buf, size_t len) | |
| 960 | −{ | |
| 961 | − u16 data; | |
| 962 | − int i; | |
| 963 | −#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO | |
| 964 | − static u16 prev_data; | |
| 965 | −#endif | |
| 966 | − | |
| 967 | − fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, | |
| 968 | − "%s(len=%zu): ", __func__, len); | |
| 969 | − | |
| 970 | − while (len) { | |
| 971 | − data = *(u16 *)buf; | |
| 972 | − | |
| 973 | − /* Start writing by pulling down /WR */ | |
| 974 | − gpiod_set_value(par->gpio.wr, 0); | |
| 975 | − | |
| 976 | − /* Set data */ | |
| 977 | −#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO | |
| 978 | − if (data == prev_data) { | |
| 979 | − gpiod_set_value(par->gpio.wr, 0); /* used as delay */ | |
| 980 | − } else { | |
| 981 | − for (i = 0; i < 16; i++) { | |
| 982 | − if ((data & 1) != (prev_data & 1)) | |
| 983 | − gpiod_set_value(par->gpio.db[i], | |
| 984 | − data & 1); | |
| 985 | − data >>= 1; | |
| 986 | − prev_data >>= 1; | |
| 987 | − } | |
| 988 | − } | |
| 989 | −#else | |
| 990 | − for (i = 0; i < 16; i++) { | |
| 991 | − gpiod_set_value(par->gpio.db[i], data & 1); | |
| 992 | − data >>= 1; | |
| 993 | − } | |
| 994 | −#endif | |
| 995 | − | |
| 996 | − /* Pullup /WR */ | |
| 997 | − gpiod_set_value(par->gpio.wr, 1); | |
| 998 | − | |
| 999 | −#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO | |
| 1000 | − prev_data = *(u16 *)buf; | |
| 1001 | −#endif | |
| 1002 | − buf += 2; | |
| 1003 | − len -= 2; | |
| 1004 | − } | |
| 1005 | − | |
| 1006 | − return 0; | |
| 1007 | −} | |
| 1008 | − | |
| 1009 | −static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par, | |
| 1010 | − int xs, int ys, int xe, int ye) | |
| 1011 | −{ | |
| 1012 | − write_reg(par, 0x2A, 0, xs + 2, 0, xe + 2); | |
| 1013 | − write_reg(par, 0x2B, 0, ys + 1, 0, ye + 1); | |
| 1014 | − write_reg(par, 0x2C); | |
| 1015 | −} | |
| 1016 | − | |
| 1017 | −static void fbtft_device_pdev_release(struct device *dev) | |
| 1018 | −{ | |
| 1019 | −/* Needed to silence this message: | |
| 1020 | − * Device 'xxx' does not have a release() function, | |
| 1021 | − * it is broken and must be fixed | |
| 1022 | − */ | |
| 1023 | −} | |
| 1024 | − | |
| 1025 | −static int spi_device_found(struct device *dev, void *data) | |
| 1026 | −{ | |
| 1027 | − struct spi_device *spi = to_spi_device(dev); | |
| 1028 | − | |
| 1029 | − dev_info(dev, "%s %s %dkHz %d bits mode=0x%02X\n", spi->modalias, | |
| 1030 | − dev_name(dev), spi->max_speed_hz / 1000, spi->bits_per_word, | |
| 1031 | − spi->mode); | |
| 1032 | − | |
| 1033 | − return 0; | |
| 1034 | −} | |
| 1035 | − | |
| 1036 | −static void pr_spi_devices(void) | |
| 1037 | −{ | |
| 1038 | − pr_debug("SPI devices registered:\n"); | |
| 1039 | − bus_for_each_dev(&spi_bus_type, NULL, NULL, spi_device_found); | |
| 1040 | −} | |
| 1041 | − | |
| 1042 | −static int p_device_found(struct device *dev, void *data) | |
| 1043 | −{ | |
| 1044 | − struct platform_device | |
| 1045 | − *pdev = to_platform_device(dev); | |
| 1046 | − | |
| 1047 | − if (strstr(pdev->name, "fb")) | |
| 1048 | − dev_info(dev, "%s id=%d pdata? %s\n", pdev->name, pdev->id, | |
| 1049 | − pdev->dev.platform_data ? "yes" : "no"); | |
| 1050 | − | |
| 1051 | − return 0; | |
| 1052 | −} | |
| 1053 | − | |
| 1054 | −static void pr_p_devices(void) | |
| 1055 | −{ | |
| 1056 | − pr_debug("'fb' Platform devices registered:\n"); | |
| 1057 | − bus_for_each_dev(&platform_bus_type, NULL, NULL, p_device_found); | |
| 1058 | −} | |
| 1059 | − | |
| 1060 | −#ifdef MODULE | |
| 1061 | −static void fbtft_device_spi_delete(struct spi_master *master, unsigned int cs) | |
| 1062 | −{ | |
| 1063 | − struct device *dev; | |
| 1064 | − char str[32]; | |
| 1065 | − | |
| 1066 | − snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), cs); | |
| 1067 | − | |
| 1068 | − dev = bus_find_device_by_name(&spi_bus_type, NULL, str); | |
| 1069 | − if (dev) { | |
| 1070 | − if (verbose) | |
| 1071 | − dev_info(dev, "Deleting %s\n", str); | |
| 1072 | − device_del(dev); | |
| 1073 | − } | |
| 1074 | −} | |
| 1075 | − | |
| 1076 | −static int fbtft_device_spi_device_register(struct spi_board_info *spi) | |
| 1077 | −{ | |
| 1078 | − struct spi_master *master; | |
| 1079 | − | |
| 1080 | − master = spi_busnum_to_master(spi->bus_num); | |
| 1081 | − if (!master) { | |
| 1082 | − pr_err("spi_busnum_to_master(%d) returned NULL\n", | |
| 1083 | − spi->bus_num); | |
| 1084 | − return -EINVAL; | |
| 1085 | − } | |
| 1086 | − /* make sure it's available */ | |
| 1087 | − fbtft_device_spi_delete(master, spi->chip_select); | |
| 1088 | − spi_device = spi_new_device(master, spi); | |
| 1089 | − put_device(&master->dev); | |
| 1090 | − if (!spi_device) { | |
| 1091 | − dev_err(&master->dev, "spi_new_device() returned NULL\n"); | |
| 1092 | − return -EPERM; | |
| 1093 | − } | |
| 1094 | − return 0; | |
| 1095 | −} | |
| 1096 | −#else | |
| 1097 | −static int fbtft_device_spi_device_register(struct spi_board_info *spi) | |
| 1098 | −{ | |
| 1099 | − return spi_register_board_info(spi, 1); | |
| 1100 | −} | |
| 1101 | −#endif | |
| 1102 | − | |
| 1103 | −static int __init fbtft_device_init(void) | |
| 1104 | −{ | |
| 1105 | − struct spi_board_info *spi = NULL; | |
| 1106 | − struct fbtft_platform_data *pdata; | |
| 1107 | − bool found = false; | |
| 1108 | − int i = 0; | |
| 1109 | − int ret = 0; | |
| 1110 | − | |
| 1111 | − if (!name) { | |
| 1112 | −#ifdef MODULE | |
| 1113 | − pr_err("missing module parameter: 'name'\n"); | |
| 1114 | − return -EINVAL; | |
| 1115 | −#else | |
| 1116 | − return 0; | |
| 1117 | −#endif | |
| 1118 | − } | |
| 1119 | − | |
| 1120 | − if (init_num > FBTFT_MAX_INIT_SEQUENCE) { | |
| 1121 | − pr_err("init parameter: exceeded max array size: %d\n", | |
| 1122 | − FBTFT_MAX_INIT_SEQUENCE); | |
| 1123 | − return -EINVAL; | |
| 1124 | − } | |
| 1125 | − | |
| 1126 | − if (verbose > 2) { | |
| 1127 | − pr_spi_devices(); /* print list of registered SPI devices */ | |
| 1128 | − pr_p_devices(); /* print list of 'fb' platform devices */ | |
| 1129 | − } | |
| 1130 | − | |
| 1131 | − pr_debug("name='%s', busnum=%d, cs=%d\n", name, busnum, cs); | |
| 1132 | − | |
| 1133 | − if (rotate > 0 && rotate < 4) { | |
| 1134 | − rotate = (4 - rotate) * 90; | |
| 1135 | − pr_warn("argument 'rotate' should be an angle. Values 1-3 is deprecated. Setting it to %d.\n", | |
| 1136 | − rotate); | |
| 1137 | − } | |
| 1138 | − if (rotate != 0 && rotate != 90 && rotate != 180 && rotate != 270) { | |
| 1139 | − pr_warn("argument 'rotate' illegal value: %d. Setting it to 0.\n", | |
| 1140 | − rotate); | |
| 1141 | − rotate = 0; | |
| 1142 | − } | |
| 1143 | − | |
| 1144 | − /* name=list lists all supported displays */ | |
| 1145 | − if (strcmp(name, "list") == 0) { | |
| 1146 | − pr_info("Supported displays:\n"); | |
| 1147 | − | |
| 1148 | − for (i = 0; i < ARRAY_SIZE(displays); i++) | |
| 1149 | − pr_info("%s\n", displays[i].name); | |
| 1150 | − return -ECANCELED; | |
| 1151 | − } | |
| 1152 | − | |
| 1153 | − if (custom) { | |
| 1154 | − i = ARRAY_SIZE(displays) - 1; | |
| 1155 | − displays[i].name = name; | |
| 1156 | − if (speed == 0) { | |
| 1157 | − displays[i].pdev->name = name; | |
| 1158 | − displays[i].spi = NULL; | |
| 1159 | − } else { | |
| 1160 | − size_t len; | |
| 1161 | − | |
| 1162 | − len = strlcpy(displays[i].spi->modalias, name, | |
| 1163 | − SPI_NAME_SIZE); | |
| 1164 | − if (len >= SPI_NAME_SIZE) | |
| 1165 | − pr_warn("modalias (name) truncated to: %s\n", | |
| 1166 | − displays[i].spi->modalias); | |
| 1167 | − displays[i].pdev = NULL; | |
| 1168 | − } | |
| 1169 | − } | |
| 1170 | − | |
| 1171 | − for (i = 0; i < ARRAY_SIZE(displays); i++) { | |
| 1172 | − if (strncmp(name, displays[i].name, SPI_NAME_SIZE) == 0) { | |
| 1173 | − if (displays[i].spi) { | |
| 1174 | − spi = displays[i].spi; | |
| 1175 | − spi->chip_select = cs; | |
| 1176 | − spi->bus_num = busnum; | |
| 1177 | − if (speed) | |
| 1178 | − spi->max_speed_hz = speed; | |
| 1179 | − if (mode != -1) | |
| 1180 | − spi->mode = mode; | |
| 1181 | − pdata = (void *)spi->platform_data; | |
| 1182 | − } else if (displays[i].pdev) { | |
| 1183 | − p_device = displays[i].pdev; | |
| 1184 | − pdata = p_device->dev.platform_data; | |
| 1185 | − } else { | |
| 1186 | − pr_err("broken displays array\n"); | |
| 1187 | − return -EINVAL; | |
| 1188 | − } | |
| 1189 | − | |
| 1190 | − pdata->rotate = rotate; | |
| 1191 | − if (bgr == 0) | |
| 1192 | − pdata->bgr = false; | |
| 1193 | − else if (bgr == 1) | |
| 1194 | − pdata->bgr = true; | |
| 1195 | − if (startbyte) | |
| 1196 | − pdata->startbyte = startbyte; | |
| 1197 | − if (gamma) | |
| 1198 | − pdata->gamma = gamma; | |
| 1199 | − pdata->display.debug = debug; | |
| 1200 | − if (fps) | |
| 1201 | − pdata->fps = fps; | |
| 1202 | − if (txbuflen) | |
| 1203 | − pdata->txbuflen = txbuflen; | |
| 1204 | − if (init_num) | |
| 1205 | − pdata->display.init_sequence = init; | |
| 1206 | − if (custom) { | |
| 1207 | − pdata->display.width = width; | |
| 1208 | − pdata->display.height = height; | |
| 1209 | − pdata->display.buswidth = buswidth; | |
| 1210 | − pdata->display.backlight = 1; | |
| 1211 | − } | |
| 1212 | − | |
| 1213 | − if (displays[i].spi) { | |
| 1214 | − ret = fbtft_device_spi_device_register(spi); | |
| 1215 | − if (ret) { | |
| 1216 | − pr_err("failed to register SPI device\n"); | |
| 1217 | − return ret; | |
| 1218 | − } | |
| 1219 | − } else { | |
| 1220 | − ret = platform_device_register(p_device); | |
| 1221 | − if (ret < 0) { | |
| 1222 | − pr_err("platform_device_register() returned %d\n", | |
| 1223 | − ret); | |
| 1224 | − return ret; | |
| 1225 | − } | |
| 1226 | − } | |
| 1227 | − found = true; | |
| 1228 | − break; | |
| 1229 | − } | |
| 1230 | − } | |
| 1231 | − | |
| 1232 | − if (!found) { | |
| 1233 | − pr_err("display not supported: '%s'\n", name); | |
| 1234 | − return -EINVAL; | |
| 1235 | − } | |
| 1236 | − | |
| 1237 | − if (spi_device && (verbose > 1)) | |
| 1238 | − pr_spi_devices(); | |
| 1239 | − if (p_device && (verbose > 1)) | |
| 1240 | − pr_p_devices(); | |
| 1241 | − | |
| 1242 | − return 0; | |
| 1243 | −} | |
| 1244 | − | |
| 1245 | −static void __exit fbtft_device_exit(void) | |
| 1246 | −{ | |
| 1247 | − if (spi_device) { | |
| 1248 | − device_del(&spi_device->dev); | |
| 1249 | − kfree(spi_device); | |
| 1250 | − } | |
| 1251 | − | |
| 1252 | − if (p_device) | |
| 1253 | − platform_device_unregister(p_device); | |
| 1254 | −} | |
| 1255 | − | |
| 1256 | −arch_initcall(fbtft_device_init); | |
| 1257 | −module_exit(fbtft_device_exit); | |
| 1258 | − | |
| 1259 | −MODULE_DESCRIPTION("Add a FBTFT device."); | |
| 1260 | −MODULE_AUTHOR("Noralf Tronnes"); | |
| 1261 | −MODULE_LICENSE("GPL"); | |
| @@ -1,851 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | −/* | |
| 3 | − * Generic FB driver for TFT LCD displays | |
| 4 | − * | |
| 5 | − * Copyright (C) 2013 Noralf Tronnes | |
| 6 | − */ | |
| 7 | − | |
| 8 | −#include <linux/module.h> | |
| 9 | −#include <linux/kernel.h> | |
| 10 | −#include <linux/init.h> | |
| 11 | −#include <linux/vmalloc.h> | |
| 12 | −#include <linux/gpio/consumer.h> | |
| 13 | −#include <linux/spi/spi.h> | |
| 14 | −#include <linux/delay.h> | |
| 15 | − | |
| 16 | −#include "fbtft.h" | |
| 17 | − | |
| 18 | −#define DRVNAME "flexfb" | |
| 19 | − | |
| 20 | −static char *chip; | |
| 21 | −module_param(chip, charp, 0000); | |
| 22 | −MODULE_PARM_DESC(chip, "LCD controller"); | |
| 23 | − | |
| 24 | −static unsigned int width; | |
| 25 | −module_param(width, uint, 0000); | |
| 26 | −MODULE_PARM_DESC(width, "Display width"); | |
| 27 | − | |
| 28 | −static unsigned int height; | |
| 29 | −module_param(height, uint, 0000); | |
| 30 | −MODULE_PARM_DESC(height, "Display height"); | |
| 31 | − | |
| 32 | −static s16 init[512]; | |
| 33 | −static int init_num; | |
| 34 | −module_param_array(init, short, &init_num, 0000); | |
| 35 | −MODULE_PARM_DESC(init, "Init sequence"); | |
| 36 | − | |
| 37 | −static unsigned int setaddrwin; | |
| 38 | −module_param(setaddrwin, uint, 0000); | |
| 39 | −MODULE_PARM_DESC(setaddrwin, "Which set_addr_win() implementation to use"); | |
| 40 | − | |
| 41 | −static unsigned int buswidth = 8; | |
| 42 | −module_param(buswidth, uint, 0000); | |
| 43 | −MODULE_PARM_DESC(buswidth, "Width of databus (default: 8)"); | |
| 44 | − | |
| 45 | −static unsigned int regwidth = 8; | |
| 46 | −module_param(regwidth, uint, 0000); | |
| 47 | −MODULE_PARM_DESC(regwidth, "Width of controller register (default: 8)"); | |
| 48 | − | |
| 49 | −static bool nobacklight; | |
| 50 | −module_param(nobacklight, bool, 0000); | |
| 51 | −MODULE_PARM_DESC(nobacklight, "Turn off backlight functionality."); | |
| 52 | − | |
| 53 | −static bool latched; | |
| 54 | −module_param(latched, bool, 0000); | |
| 55 | −MODULE_PARM_DESC(latched, "Use with latched 16-bit databus"); | |
| 56 | − | |
| 57 | −static const s16 *initp; | |
| 58 | −static int initp_num; | |
| 59 | − | |
| 60 | −/* default init sequences */ | |
| 61 | −static const s16 st7735r_init[] = { | |
| 62 | − -1, 0x01, | |
| 63 | − -2, 150, | |
| 64 | − -1, 0x11, | |
| 65 | − -2, 500, | |
| 66 | − -1, 0xB1, 0x01, 0x2C, 0x2D, | |
| 67 | − -1, 0xB2, 0x01, 0x2C, 0x2D, | |
| 68 | − -1, 0xB3, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, | |
| 69 | − -1, 0xB4, 0x07, | |
| 70 | − -1, 0xC0, 0xA2, 0x02, 0x84, | |
| 71 | − -1, 0xC1, 0xC5, | |
| 72 | − -1, 0xC2, 0x0A, 0x00, | |
| 73 | − -1, 0xC3, 0x8A, 0x2A, | |
| 74 | − -1, 0xC4, 0x8A, 0xEE, | |
| 75 | − -1, 0xC5, 0x0E, | |
| 76 | − -1, 0x20, | |
| 77 | − -1, 0x36, 0xC0, | |
| 78 | − -1, 0x3A, 0x05, | |
| 79 | − -1, 0xE0, 0x0f, 0x1a, 0x0f, 0x18, 0x2f, 0x28, 0x20, 0x22, | |
| 80 | − 0x1f, 0x1b, 0x23, 0x37, 0x00, 0x07, 0x02, 0x10, | |
| 81 | − -1, 0xE1, 0x0f, 0x1b, 0x0f, 0x17, 0x33, 0x2c, 0x29, 0x2e, | |
| 82 | − 0x30, 0x30, 0x39, 0x3f, 0x00, 0x07, 0x03, 0x10, | |
| 83 | − -1, 0x29, | |
| 84 | − -2, 100, | |
| 85 | − -1, 0x13, | |
| 86 | − -2, 10, | |
| 87 | − -3 | |
| 88 | −}; | |
| 89 | − | |
| 90 | −static const s16 ssd1289_init[] = { | |
| 91 | − -1, 0x00, 0x0001, | |
| 92 | − -1, 0x03, 0xA8A4, | |
| 93 | − -1, 0x0C, 0x0000, | |
| 94 | − -1, 0x0D, 0x080C, | |
| 95 | − -1, 0x0E, 0x2B00, | |
| 96 | − -1, 0x1E, 0x00B7, | |
| 97 | − -1, 0x01, 0x2B3F, | |
| 98 | − -1, 0x02, 0x0600, | |
| 99 | − -1, 0x10, 0x0000, | |
| 100 | − -1, 0x11, 0x6070, | |
| 101 | − -1, 0x05, 0x0000, | |
| 102 | − -1, 0x06, 0x0000, | |
| 103 | − -1, 0x16, 0xEF1C, | |
| 104 | − -1, 0x17, 0x0003, | |
| 105 | − -1, 0x07, 0x0233, | |
| 106 | − -1, 0x0B, 0x0000, | |
| 107 | − -1, 0x0F, 0x0000, | |
| 108 | − -1, 0x41, 0x0000, | |
| 109 | − -1, 0x42, 0x0000, | |
| 110 | − -1, 0x48, 0x0000, | |
| 111 | − -1, 0x49, 0x013F, | |
| 112 | − -1, 0x4A, 0x0000, | |
| 113 | − -1, 0x4B, 0x0000, | |
| 114 | − -1, 0x44, 0xEF00, | |
| 115 | − -1, 0x45, 0x0000, | |
| 116 | − -1, 0x46, 0x013F, | |
| 117 | − -1, 0x30, 0x0707, | |
| 118 | − -1, 0x31, 0x0204, | |
| 119 | − -1, 0x32, 0x0204, | |
| 120 | − -1, 0x33, 0x0502, | |
| 121 | − -1, 0x34, 0x0507, | |
| 122 | − -1, 0x35, 0x0204, | |
| 123 | − -1, 0x36, 0x0204, | |
| 124 | − -1, 0x37, 0x0502, | |
| 125 | − -1, 0x3A, 0x0302, | |
| 126 | − -1, 0x3B, 0x0302, | |
| 127 | − -1, 0x23, 0x0000, | |
| 128 | − -1, 0x24, 0x0000, | |
| 129 | − -1, 0x25, 0x8000, | |
| 130 | − -1, 0x4f, 0x0000, | |
| 131 | − -1, 0x4e, 0x0000, | |
| 132 | − -1, 0x22, | |
| 133 | − -3 | |
| 134 | −}; | |
| 135 | − | |
| 136 | −static const s16 hx8340bn_init[] = { | |
| 137 | − -1, 0xC1, 0xFF, 0x83, 0x40, | |
| 138 | − -1, 0x11, | |
| 139 | − -2, 150, | |
| 140 | − -1, 0xCA, 0x70, 0x00, 0xD9, | |
| 141 | − -1, 0xB0, 0x01, 0x11, | |
| 142 | − -1, 0xC9, 0x90, 0x49, 0x10, 0x28, 0x28, 0x10, 0x00, 0x06, | |
| 143 | − -2, 20, | |
| 144 | − -1, 0xC2, 0x60, 0x71, 0x01, 0x0E, 0x05, 0x02, 0x09, 0x31, 0x0A, | |
| 145 | − -1, 0xC3, 0x67, 0x30, 0x61, 0x17, 0x48, 0x07, 0x05, 0x33, | |
| 146 | − -2, 10, | |
| 147 | − -1, 0xB5, 0x35, 0x20, 0x45, | |
| 148 | − -1, 0xB4, 0x33, 0x25, 0x4C, | |
| 149 | − -2, 10, | |
| 150 | − -1, 0x3A, 0x05, | |
| 151 | − -1, 0x29, | |
| 152 | − -2, 10, | |
| 153 | − -3 | |
| 154 | −}; | |
| 155 | − | |
| 156 | −static const s16 ili9225_init[] = { | |
| 157 | − -1, 0x0001, 0x011C, | |
| 158 | − -1, 0x0002, 0x0100, | |
| 159 | − -1, 0x0003, 0x1030, | |
| 160 | − -1, 0x0008, 0x0808, | |
| 161 | − -1, 0x000C, 0x0000, | |
| 162 | − -1, 0x000F, 0x0A01, | |
| 163 | − -1, 0x0020, 0x0000, | |
| 164 | − -1, 0x0021, 0x0000, | |
| 165 | − -2, 50, | |
| 166 | − -1, 0x0010, 0x0A00, | |
| 167 | − -1, 0x0011, 0x1038, | |
| 168 | − -2, 50, | |
| 169 | − -1, 0x0012, 0x1121, | |
| 170 | − -1, 0x0013, 0x004E, | |
| 171 | − -1, 0x0014, 0x676F, | |
| 172 | − -1, 0x0030, 0x0000, | |
| 173 | − -1, 0x0031, 0x00DB, | |
| 174 | − -1, 0x0032, 0x0000, | |
| 175 | − -1, 0x0033, 0x0000, | |
| 176 | − -1, 0x0034, 0x00DB, | |
| 177 | − -1, 0x0035, 0x0000, | |
| 178 | − -1, 0x0036, 0x00AF, | |
| 179 | − -1, 0x0037, 0x0000, | |
| 180 | − -1, 0x0038, 0x00DB, | |
| 181 | − -1, 0x0039, 0x0000, | |
| 182 | − -1, 0x0050, 0x0000, | |
| 183 | − -1, 0x0051, 0x060A, | |
| 184 | − -1, 0x0052, 0x0D0A, | |
| 185 | − -1, 0x0053, 0x0303, | |
| 186 | − -1, 0x0054, 0x0A0D, | |
| 187 | − -1, 0x0055, 0x0A06, | |
| 188 | − -1, 0x0056, 0x0000, | |
| 189 | − -1, 0x0057, 0x0303, | |
| 190 | − -1, 0x0058, 0x0000, | |
| 191 | − -1, 0x0059, 0x0000, | |
| 192 | − -2, 50, | |
| 193 | − -1, 0x0007, 0x1017, | |
| 194 | − -2, 50, | |
| 195 | − -3 | |
| 196 | −}; | |
| 197 | − | |
| 198 | −static const s16 ili9320_init[] = { | |
| 199 | − -1, 0x00E5, 0x8000, | |
| 200 | − -1, 0x0000, 0x0001, | |
| 201 | − -1, 0x0001, 0x0100, | |
| 202 | − -1, 0x0002, 0x0700, | |
| 203 | − -1, 0x0003, 0x1030, | |
| 204 | − -1, 0x0004, 0x0000, | |
| 205 | − -1, 0x0008, 0x0202, | |
| 206 | − -1, 0x0009, 0x0000, | |
| 207 | − -1, 0x000A, 0x0000, | |
| 208 | − -1, 0x000C, 0x0000, | |
| 209 | − -1, 0x000D, 0x0000, | |
| 210 | − -1, 0x000F, 0x0000, | |
| 211 | − -1, 0x0010, 0x0000, | |
| 212 | − -1, 0x0011, 0x0007, | |
| 213 | − -1, 0x0012, 0x0000, | |
| 214 | − -1, 0x0013, 0x0000, | |
| 215 | − -2, 200, | |
| 216 | − -1, 0x0010, 0x17B0, | |
| 217 | − -1, 0x0011, 0x0031, | |
| 218 | − -2, 50, | |
| 219 | − -1, 0x0012, 0x0138, | |
| 220 | − -2, 50, | |
| 221 | − -1, 0x0013, 0x1800, | |
| 222 | − -1, 0x0029, 0x0008, | |
| 223 | − -2, 50, | |
| 224 | − -1, 0x0020, 0x0000, | |
| 225 | − -1, 0x0021, 0x0000, | |
| 226 | − -1, 0x0030, 0x0000, | |
| 227 | − -1, 0x0031, 0x0505, | |
| 228 | − -1, 0x0032, 0x0004, | |
| 229 | − -1, 0x0035, 0x0006, | |
| 230 | − -1, 0x0036, 0x0707, | |
| 231 | − -1, 0x0037, 0x0105, | |
| 232 | − -1, 0x0038, 0x0002, | |
| 233 | − -1, 0x0039, 0x0707, | |
| 234 | − -1, 0x003C, 0x0704, | |
| 235 | − -1, 0x003D, 0x0807, | |
| 236 | − -1, 0x0050, 0x0000, | |
| 237 | − -1, 0x0051, 0x00EF, | |
| 238 | − -1, 0x0052, 0x0000, | |
| 239 | − -1, 0x0053, 0x013F, | |
| 240 | − -1, 0x0060, 0x2700, | |
| 241 | − -1, 0x0061, 0x0001, | |
| 242 | − -1, 0x006A, 0x0000, | |
| 243 | − -1, 0x0080, 0x0000, | |
| 244 | − -1, 0x0081, 0x0000, | |
| 245 | − -1, 0x0082, 0x0000, | |
| 246 | − -1, 0x0083, 0x0000, | |
| 247 | − -1, 0x0084, 0x0000, | |
| 248 | − -1, 0x0085, 0x0000, | |
| 249 | − -1, 0x0090, 0x0010, | |
| 250 | − -1, 0x0092, 0x0000, | |
| 251 | − -1, 0x0093, 0x0003, | |
| 252 | − -1, 0x0095, 0x0110, | |
| 253 | − -1, 0x0097, 0x0000, | |
| 254 | − -1, 0x0098, 0x0000, | |
| 255 | − -1, 0x0007, 0x0173, | |
| 256 | − -3 | |
| 257 | −}; | |
| 258 | − | |
| 259 | −static const s16 ili9325_init[] = { | |
| 260 | − -1, 0x00E3, 0x3008, | |
| 261 | − -1, 0x00E7, 0x0012, | |
| 262 | − -1, 0x00EF, 0x1231, | |
| 263 | − -1, 0x0001, 0x0100, | |
| 264 | − -1, 0x0002, 0x0700, | |
| 265 | − -1, 0x0003, 0x1030, | |
| 266 | − -1, 0x0004, 0x0000, | |
| 267 | − -1, 0x0008, 0x0207, | |
| 268 | − -1, 0x0009, 0x0000, | |
| 269 | − -1, 0x000A, 0x0000, | |
| 270 | − -1, 0x000C, 0x0000, | |
| 271 | − -1, 0x000D, 0x0000, | |
| 272 | − -1, 0x000F, 0x0000, | |
| 273 | − -1, 0x0010, 0x0000, | |
| 274 | − -1, 0x0011, 0x0007, | |
| 275 | − -1, 0x0012, 0x0000, | |
| 276 | − -1, 0x0013, 0x0000, | |
| 277 | − -2, 200, | |
| 278 | − -1, 0x0010, 0x1690, | |
| 279 | − -1, 0x0011, 0x0223, | |
| 280 | − -2, 50, | |
| 281 | − -1, 0x0012, 0x000D, | |
| 282 | − -2, 50, | |
| 283 | − -1, 0x0013, 0x1200, | |
| 284 | − -1, 0x0029, 0x000A, | |
| 285 | − -1, 0x002B, 0x000C, | |
| 286 | − -2, 50, | |
| 287 | − -1, 0x0020, 0x0000, | |
| 288 | − -1, 0x0021, 0x0000, | |
| 289 | − -1, 0x0030, 0x0000, | |
| 290 | − -1, 0x0031, 0x0506, | |
| 291 | − -1, 0x0032, 0x0104, | |
| 292 | − -1, 0x0035, 0x0207, | |
| 293 | − -1, 0x0036, 0x000F, | |
| 294 | − -1, 0x0037, 0x0306, | |
| 295 | − -1, 0x0038, 0x0102, | |
| 296 | − -1, 0x0039, 0x0707, | |
| 297 | − -1, 0x003C, 0x0702, | |
| 298 | − -1, 0x003D, 0x1604, | |
| 299 | − -1, 0x0050, 0x0000, | |
| 300 | − -1, 0x0051, 0x00EF, | |
| 301 | − -1, 0x0052, 0x0000, | |
| 302 | − -1, 0x0053, 0x013F, | |
| 303 | − -1, 0x0060, 0xA700, | |
| 304 | − -1, 0x0061, 0x0001, | |
| 305 | − -1, 0x006A, 0x0000, | |
| 306 | − -1, 0x0080, 0x0000, | |
| 307 | − -1, 0x0081, 0x0000, | |
| 308 | − -1, 0x0082, 0x0000, | |
| 309 | − -1, 0x0083, 0x0000, | |
| 310 | − -1, 0x0084, 0x0000, | |
| 311 | − -1, 0x0085, 0x0000, | |
| 312 | − -1, 0x0090, 0x0010, | |
| 313 | − -1, 0x0092, 0x0600, | |
| 314 | − -1, 0x0007, 0x0133, | |
| 315 | − -3 | |
| 316 | −}; | |
| 317 | − | |
| 318 | −static const s16 ili9341_init[] = { | |
| 319 | − -1, 0x28, | |
| 320 | − -2, 20, | |
| 321 | − -1, 0xCF, 0x00, 0x83, 0x30, | |
| 322 | − -1, 0xED, 0x64, 0x03, 0x12, 0x81, | |
| 323 | − -1, 0xE8, 0x85, 0x01, 0x79, | |
| 324 | − -1, 0xCB, 0x39, 0x2c, 0x00, 0x34, 0x02, | |
| 325 | − -1, 0xF7, 0x20, | |
| 326 | − -1, 0xEA, 0x00, 0x00, | |
| 327 | − -1, 0xC0, 0x26, | |
| 328 | − -1, 0xC1, 0x11, | |
| 329 | − -1, 0xC5, 0x35, 0x3E, | |
| 330 | − -1, 0xC7, 0xBE, | |
| 331 | − -1, 0xB1, 0x00, 0x1B, | |
| 332 | − -1, 0xB6, 0x0a, 0x82, 0x27, 0x00, | |
| 333 | − -1, 0xB7, 0x07, | |
| 334 | − -1, 0x3A, 0x55, | |
| 335 | − -1, 0x36, 0x48, | |
| 336 | − -1, 0x11, | |
| 337 | − -2, 120, | |
| 338 | − -1, 0x29, | |
| 339 | − -2, 20, | |
| 340 | − -3 | |
| 341 | −}; | |
| 342 | − | |
| 343 | −static const s16 ssd1351_init[] = { | |
| 344 | − -1, 0xfd, 0x12, | |
| 345 | − -1, 0xfd, 0xb1, | |
| 346 | − -1, 0xae, | |
| 347 | − -1, 0xb3, 0xf1, | |
| 348 | − -1, 0xca, 0x7f, | |
| 349 | − -1, 0xa0, 0x74, | |
| 350 | − -1, 0x15, 0x00, 0x7f, | |
| 351 | − -1, 0x75, 0x00, 0x7f, | |
| 352 | − -1, 0xa1, 0x00, | |
| 353 | − -1, 0xa2, 0x00, | |
| 354 | − -1, 0xb5, 0x00, | |
| 355 | − -1, 0xab, 0x01, | |
| 356 | − -1, 0xb1, 0x32, | |
| 357 | − -1, 0xb4, 0xa0, 0xb5, 0x55, | |
| 358 | − -1, 0xbb, 0x17, | |
| 359 | − -1, 0xbe, 0x05, | |
| 360 | − -1, 0xc1, 0xc8, 0x80, 0xc8, | |
| 361 | − -1, 0xc7, 0x0f, | |
| 362 | − -1, 0xb6, 0x01, | |
| 363 | − -1, 0xa6, | |
| 364 | − -1, 0xaf, | |
| 365 | − -3 | |
| 366 | −}; | |
| 367 | − | |
| 368 | −/** | |
| 369 | − * struct flexfb_lcd_controller - Describes the LCD controller properties | |
| 370 | − * @name: Model name of the chip | |
| 371 | − * @width: Width of display in pixels | |
| 372 | − * @height: Height of display in pixels | |
| 373 | − * @setaddrwin: Which set_addr_win() implementation to use | |
| 374 | − * @regwidth: LCD Controller Register width in bits | |
| 375 | − * @init_seq: LCD initialization sequence | |
| 376 | − * @init_seq_sz: Size of LCD initialization sequence | |
| 377 | − */ | |
| 378 | −struct flexfb_lcd_controller { | |
| 379 | − const char *name; | |
| 380 | − unsigned int width; | |
| 381 | − unsigned int height; | |
| 382 | − unsigned int setaddrwin; | |
| 383 | − unsigned int regwidth; | |
| 384 | − const s16 *init_seq; | |
| 385 | − int init_seq_sz; | |
| 386 | −}; | |
| 387 | − | |
| 388 | −static const struct flexfb_lcd_controller flexfb_chip_table[] = { | |
| 389 | − { | |
| 390 | − .name = "st7735r", | |
| 391 | − .width = 120, | |
| 392 | − .height = 160, | |
| 393 | − .init_seq = st7735r_init, | |
| 394 | − .init_seq_sz = ARRAY_SIZE(st7735r_init), | |
| 395 | − }, | |
| 396 | − { | |
| 397 | − .name = "hx8340bn", | |
| 398 | − .width = 176, | |
| 399 | − .height = 220, | |
| 400 | − .init_seq = hx8340bn_init, | |
| 401 | − .init_seq_sz = ARRAY_SIZE(hx8340bn_init), | |
| 402 | − }, | |
| 403 | − { | |
| 404 | − .name = "ili9225", | |
| 405 | − .width = 176, | |
| 406 | − .height = 220, | |
| 407 | − .regwidth = 16, | |
| 408 | − .init_seq = ili9225_init, | |
| 409 | − .init_seq_sz = ARRAY_SIZE(ili9225_init), | |
| 410 | − }, | |
| 411 | − { | |
| 412 | − .name = "ili9320", | |
| 413 | − .width = 240, | |
| 414 | − .height = 320, | |
| 415 | − .setaddrwin = 1, | |
| 416 | − .regwidth = 16, | |
| 417 | − .init_seq = ili9320_init, | |
| 418 | − .init_seq_sz = ARRAY_SIZE(ili9320_init), | |
| 419 | − }, | |
| 420 | − { | |
| 421 | − .name = "ili9325", | |
| 422 | − .width = 240, | |
| 423 | − .height = 320, | |
| 424 | − .setaddrwin = 1, | |
| 425 | − .regwidth = 16, | |
| 426 | − .init_seq = ili9325_init, | |
| 427 | − .init_seq_sz = ARRAY_SIZE(ili9325_init), | |
| 428 | − }, | |
| 429 | − { | |
| 430 | − .name = "ili9341", | |
| 431 | − .width = 240, | |
| 432 | − .height = 320, | |
| 433 | − .init_seq = ili9341_init, | |
| 434 | − .init_seq_sz = ARRAY_SIZE(ili9341_init), | |
| 435 | − }, | |
| 436 | − { | |
| 437 | − .name = "ssd1289", | |
| 438 | − .width = 240, | |
| 439 | − .height = 320, | |
| 440 | − .setaddrwin = 2, | |
| 441 | − .regwidth = 16, | |
| 442 | − .init_seq = ssd1289_init, | |
| 443 | − .init_seq_sz = ARRAY_SIZE(ssd1289_init), | |
| 444 | − }, | |
| 445 | − { | |
| 446 | − .name = "ssd1351", | |
| 447 | − .width = 128, | |
| 448 | − .height = 128, | |
| 449 | − .setaddrwin = 3, | |
| 450 | − .init_seq = ssd1351_init, | |
| 451 | − .init_seq_sz = ARRAY_SIZE(ssd1351_init), | |
| 452 | − }, | |
| 453 | −}; | |
| 454 | − | |
| 455 | −/* ili9320, ili9325 */ | |
| 456 | −static void flexfb_set_addr_win_1(struct fbtft_par *par, | |
| 457 | − int xs, int ys, int xe, int ye) | |
| 458 | −{ | |
| 459 | − switch (par->info->var.rotate) { | |
| 460 | − /* R20h = Horizontal GRAM Start Address */ | |
| 461 | − /* R21h = Vertical GRAM Start Address */ | |
| 462 | − case 0: | |
| 463 | − write_reg(par, 0x0020, xs); | |
| 464 | − write_reg(par, 0x0021, ys); | |
| 465 | − break; | |
| 466 | − case 180: | |
| 467 | − write_reg(par, 0x0020, width - 1 - xs); | |
| 468 | − write_reg(par, 0x0021, height - 1 - ys); | |
| 469 | − break; | |
| 470 | − case 270: | |
| 471 | − write_reg(par, 0x0020, width - 1 - ys); | |
| 472 | − write_reg(par, 0x0021, xs); | |
| 473 | − break; | |
| 474 | − case 90: | |
| 475 | − write_reg(par, 0x0020, ys); | |
| 476 | − write_reg(par, 0x0021, height - 1 - xs); | |
| 477 | − break; | |
| 478 | − } | |
| 479 | − write_reg(par, 0x0022); /* Write Data to GRAM */ | |
| 480 | −} | |
| 481 | − | |
| 482 | −/* ssd1289 */ | |
| 483 | −static void flexfb_set_addr_win_2(struct fbtft_par *par, | |
| 484 | − int xs, int ys, int xe, int ye) | |
| 485 | −{ | |
| 486 | − switch (par->info->var.rotate) { | |
| 487 | − /* R4Eh - Set GDDRAM X address counter */ | |
| 488 | − /* R4Fh - Set GDDRAM Y address counter */ | |
| 489 | − case 0: | |
| 490 | − write_reg(par, 0x4e, xs); | |
| 491 | − write_reg(par, 0x4f, ys); | |
| 492 | − break; | |
| 493 | − case 180: | |
| 494 | − write_reg(par, 0x4e, par->info->var.xres - 1 - xs); | |
| 495 | − write_reg(par, 0x4f, par->info->var.yres - 1 - ys); | |
| 496 | − break; | |
| 497 | − case 270: | |
| 498 | − write_reg(par, 0x4e, par->info->var.yres - 1 - ys); | |
| 499 | − write_reg(par, 0x4f, xs); | |
| 500 | − break; | |
| 501 | − case 90: | |
| 502 | − write_reg(par, 0x4e, ys); | |
| 503 | − write_reg(par, 0x4f, par->info->var.xres - 1 - xs); | |
| 504 | − break; | |
| 505 | − } | |
| 506 | − | |
| 507 | − /* R22h - RAM data write */ | |
| 508 | − write_reg(par, 0x22, 0); | |
| 509 | −} | |
| 510 | − | |
| 511 | −/* ssd1351 */ | |
| 512 | −static void set_addr_win_3(struct fbtft_par *par, | |
| 513 | − int xs, int ys, int xe, int ye) | |
| 514 | −{ | |
| 515 | − write_reg(par, 0x15, xs, xe); | |
| 516 | − write_reg(par, 0x75, ys, ye); | |
| 517 | − write_reg(par, 0x5C); | |
| 518 | −} | |
| 519 | − | |
| 520 | −static int flexfb_verify_gpios_dc(struct fbtft_par *par) | |
| 521 | −{ | |
| 522 | − fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); | |
| 523 | − | |
| 524 | − if (!par->gpio.dc) { | |
| 525 | − dev_err(par->info->device, | |
| 526 | − "Missing info about 'dc' gpio. Aborting.\n"); | |
| 527 | − return -EINVAL; | |
| 528 | − } | |
| 529 | − | |
| 530 | − return 0; | |
| 531 | −} | |
| 532 | − | |
| 533 | −static int flexfb_verify_gpios_db(struct fbtft_par *par) | |
| 534 | −{ | |
| 535 | − int i; | |
| 536 | − int num_db = buswidth; | |
| 537 | − | |
| 538 | − fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); | |
| 539 | − | |
| 540 | − if (!par->gpio.dc) { | |
| 541 | − dev_err(par->info->device, "Missing info about 'dc' gpio. Aborting.\n"); | |
| 542 | − return -EINVAL; | |
| 543 | − } | |
| 544 | − if (!par->gpio.wr) { | |
| 545 | − dev_err(par->info->device, "Missing info about 'wr' gpio. Aborting.\n"); | |
| 546 | − return -EINVAL; | |
| 547 | − } | |
| 548 | − if (latched && !par->gpio.latch) { | |
| 549 | − dev_err(par->info->device, "Missing info about 'latch' gpio. Aborting.\n"); | |
| 550 | − return -EINVAL; | |
| 551 | − } | |
| 552 | − if (latched) | |
| 553 | − num_db = buswidth / 2; | |
| 554 | − for (i = 0; i < num_db; i++) { | |
| 555 | − if (!par->gpio.db[i]) { | |
| 556 | − dev_err(par->info->device, | |
| 557 | − "Missing info about 'db%02d' gpio. Aborting.\n", | |
| 558 | − i); | |
| 559 | − return -EINVAL; | |
| 560 | − } | |
| 561 | − } | |
| 562 | − | |
| 563 | − return 0; | |
| 564 | −} | |
| 565 | − | |
| 566 | −static void flexfb_chip_load_param(const struct flexfb_lcd_controller *chip) | |
| 567 | −{ | |
| 568 | − if (!width) | |
| 569 | − width = chip->width; | |
| 570 | − if (!height) | |
| 571 | − height = chip->height; | |
| 572 | − setaddrwin = chip->setaddrwin; | |
| 573 | − if (chip->regwidth) | |
| 574 | − regwidth = chip->regwidth; | |
| 575 | − if (!init_num) { | |
| 576 | − initp = chip->init_seq; | |
| 577 | − initp_num = chip->init_seq_sz; | |
| 578 | − } | |
| 579 | −} | |
| 580 | − | |
| 581 | −static struct fbtft_display flex_display = { }; | |
| 582 | − | |
| 583 | −static int flexfb_chip_init(const struct device *dev) | |
| 584 | −{ | |
| 585 | − int i; | |
| 586 | − | |
| 587 | − for (i = 0; i < ARRAY_SIZE(flexfb_chip_table); i++) | |
| 588 | − if (!strcmp(chip, flexfb_chip_table[i].name)) { | |
| 589 | − flexfb_chip_load_param(&flexfb_chip_table[i]); | |
| 590 | − return 0; | |
| 591 | − } | |
| 592 | − | |
| 593 | − dev_err(dev, "chip=%s is not supported\n", chip); | |
| 594 | − | |
| 595 | − return -EINVAL; | |
| 596 | −} | |
| 597 | − | |
| 598 | −static int flexfb_probe_common(struct spi_device *sdev, | |
| 599 | − struct platform_device *pdev) | |
| 600 | −{ | |
| 601 | − struct device *dev; | |
| 602 | − struct fb_info *info; | |
| 603 | − struct fbtft_par *par; | |
| 604 | − int ret; | |
| 605 | − | |
| 606 | − initp = init; | |
| 607 | − initp_num = init_num; | |
| 608 | − | |
| 609 | − if (sdev) | |
| 610 | − dev = &sdev->dev; | |
| 611 | − else | |
| 612 | − dev = &pdev->dev; | |
| 613 | − | |
| 614 | − fbtft_init_dbg(dev, "%s(%s)\n", __func__, | |
| 615 | − sdev ? "'SPI device'" : "'Platform device'"); | |
| 616 | − | |
| 617 | − if (chip) { | |
| 618 | − ret = flexfb_chip_init(dev); | |
| 619 | − if (ret) | |
| 620 | − return ret; | |
| 621 | − } | |
| 622 | − | |
| 623 | − if (width == 0 || height == 0) { | |
| 624 | − dev_err(dev, "argument(s) missing: width and height has to be set.\n"); | |
| 625 | − return -EINVAL; | |
| 626 | − } | |
| 627 | − flex_display.width = width; | |
| 628 | − flex_display.height = height; | |
| 629 | − fbtft_init_dbg(dev, "Display resolution: %dx%d\n", width, height); | |
| 630 | − fbtft_init_dbg(dev, "chip = %s\n", chip ? chip : "not set"); | |
| 631 | − fbtft_init_dbg(dev, "setaddrwin = %d\n", setaddrwin); | |
| 632 | − fbtft_init_dbg(dev, "regwidth = %d\n", regwidth); | |
| 633 | − fbtft_init_dbg(dev, "buswidth = %d\n", buswidth); | |
| 634 | − | |
| 635 | − info = fbtft_framebuffer_alloc(&flex_display, dev, dev->platform_data); | |
| 636 | − if (!info) | |
| 637 | − return -ENOMEM; | |
| 638 | − | |
| 639 | − par = info->par; | |
| 640 | − if (sdev) | |
| 641 | − par->spi = sdev; | |
| 642 | − else | |
| 643 | − par->pdev = pdev; | |
| 644 | − if (!par->init_sequence) | |
| 645 | − par->init_sequence = initp; | |
| 646 | − par->fbtftops.init_display = fbtft_init_display; | |
| 647 | − | |
| 648 | − /* registerwrite functions */ | |
| 649 | − switch (regwidth) { | |
| 650 | − case 8: | |
| 651 | − par->fbtftops.write_register = fbtft_write_reg8_bus8; | |
| 652 | − break; | |
| 653 | − case 16: | |
| 654 | − par->fbtftops.write_register = fbtft_write_reg16_bus8; | |
| 655 | − break; | |
| 656 | − default: | |
| 657 | − dev_err(dev, | |
| 658 | − "argument 'regwidth': %d is not supported.\n", | |
| 659 | − regwidth); | |
| 660 | − return -EINVAL; | |
| 661 | − } | |
| 662 | − | |
| 663 | − /* bus functions */ | |
| 664 | − if (sdev) { | |
| 665 | − par->fbtftops.write = fbtft_write_spi; | |
| 666 | − switch (buswidth) { | |
| 667 | − case 8: | |
| 668 | − par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; | |
| 669 | − if (!par->startbyte) | |
| 670 | − par->fbtftops.verify_gpios = flexfb_verify_gpios_dc; | |
| 671 | − break; | |
| 672 | − case 9: | |
| 673 | − if (regwidth == 16) { | |
| 674 | − dev_err(dev, "argument 'regwidth': %d is not supported with buswidth=%d and SPI.\n", | |
| 675 | − regwidth, buswidth); | |
| 676 | − return -EINVAL; | |
| 677 | − } | |
| 678 | − par->fbtftops.write_register = fbtft_write_reg8_bus9; | |
| 679 | − par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; | |
| 680 | − if (par->spi->master->bits_per_word_mask | |
| 681 | − & SPI_BPW_MASK(9)) { | |
| 682 | − par->spi->bits_per_word = 9; | |
| 683 | − break; | |
| 684 | − } | |
| 685 | − | |
| 686 | − dev_warn(dev, | |
| 687 | − "9-bit SPI not available, emulating using 8-bit.\n"); | |
| 688 | − /* allocate buffer with room for dc bits */ | |
| 689 | − par->extra = devm_kzalloc(par->info->device, | |
| 690 | − par->txbuf.len | |
| 691 | − + (par->txbuf.len / 8) + 8, | |
| 692 | − GFP_KERNEL); | |
| 693 | − if (!par->extra) { | |
| 694 | − ret = -ENOMEM; | |
| 695 | − goto out_release; | |
| 696 | − } | |
| 697 | − par->fbtftops.write = fbtft_write_spi_emulate_9; | |
| 698 | − | |
| 699 | − break; | |
| 700 | − default: | |
| 701 | − dev_err(dev, | |
| 702 | − "argument 'buswidth': %d is not supported with SPI.\n", | |
| 703 | − buswidth); | |
| 704 | − return -EINVAL; | |
| 705 | − } | |
| 706 | − } else { | |
| 707 | − par->fbtftops.verify_gpios = flexfb_verify_gpios_db; | |
| 708 | − switch (buswidth) { | |
| 709 | − case 8: | |
| 710 | − par->fbtftops.write = fbtft_write_gpio8_wr; | |
| 711 | − par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; | |
| 712 | − break; | |
| 713 | − case 16: | |
| 714 | − par->fbtftops.write_register = fbtft_write_reg16_bus16; | |
| 715 | − if (latched) | |
| 716 | − par->fbtftops.write = fbtft_write_gpio16_wr_latched; | |
| 717 | − else | |
| 718 | − par->fbtftops.write = fbtft_write_gpio16_wr; | |
| 719 | − par->fbtftops.write_vmem = fbtft_write_vmem16_bus16; | |
| 720 | − break; | |
| 721 | − default: | |
| 722 | − dev_err(dev, | |
| 723 | − "argument 'buswidth': %d is not supported with parallel.\n", | |
| 724 | − buswidth); | |
| 725 | − return -EINVAL; | |
| 726 | − } | |
| 727 | − } | |
| 728 | − | |
| 729 | − /* set_addr_win function */ | |
| 730 | − switch (setaddrwin) { | |
| 731 | − case 0: | |
| 732 | − /* use default */ | |
| 733 | − break; | |
| 734 | − case 1: | |
| 735 | − par->fbtftops.set_addr_win = flexfb_set_addr_win_1; | |
| 736 | − break; | |
| 737 | − case 2: | |
| 738 | − par->fbtftops.set_addr_win = flexfb_set_addr_win_2; | |
| 739 | − break; | |
| 740 | − case 3: | |
| 741 | − par->fbtftops.set_addr_win = set_addr_win_3; | |
| 742 | − break; | |
| 743 | − default: | |
| 744 | − dev_err(dev, "argument 'setaddrwin': unknown value %d.\n", | |
| 745 | − setaddrwin); | |
| 746 | − return -EINVAL; | |
| 747 | − } | |
| 748 | − | |
| 749 | − if (!nobacklight) | |
| 750 | − par->fbtftops.register_backlight = fbtft_register_backlight; | |
| 751 | − | |
| 752 | − ret = fbtft_register_framebuffer(info); | |
| 753 | − if (ret < 0) | |
| 754 | − goto out_release; | |
| 755 | − | |
| 756 | − return 0; | |
| 757 | − | |
| 758 | −out_release: | |
| 759 | − fbtft_framebuffer_release(info); | |
| 760 | − | |
| 761 | − return ret; | |
| 762 | −} | |
| 763 | − | |
| 764 | −static int flexfb_remove_common(struct device *dev, struct fb_info *info) | |
| 765 | −{ | |
| 766 | − struct fbtft_par *par; | |
| 767 | − | |
| 768 | − if (!info) | |
| 769 | − return -EINVAL; | |
| 770 | − par = info->par; | |
| 771 | − if (par) | |
| 772 | − fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, "%s()\n", | |
| 773 | − __func__); | |
| 774 | − fbtft_unregister_framebuffer(info); | |
| 775 | − fbtft_framebuffer_release(info); | |
| 776 | − | |
| 777 | − return 0; | |
| 778 | −} | |
| 779 | − | |
| 780 | −static int flexfb_probe_spi(struct spi_device *spi) | |
| 781 | −{ | |
| 782 | − return flexfb_probe_common(spi, NULL); | |
| 783 | −} | |
| 784 | − | |
| 785 | −static int flexfb_remove_spi(struct spi_device *spi) | |
| 786 | −{ | |
| 787 | − struct fb_info *info = spi_get_drvdata(spi); | |
| 788 | − | |
| 789 | − return flexfb_remove_common(&spi->dev, info); | |
| 790 | −} | |
| 791 | − | |
| 792 | −static int flexfb_probe_pdev(struct platform_device *pdev) | |
| 793 | −{ | |
| 794 | − return flexfb_probe_common(NULL, pdev); | |
| 795 | −} | |
| 796 | − | |
| 797 | −static int flexfb_remove_pdev(struct platform_device *pdev) | |
| 798 | −{ | |
| 799 | − struct fb_info *info = platform_get_drvdata(pdev); | |
| 800 | − | |
| 801 | − return flexfb_remove_common(&pdev->dev, info); | |
| 802 | −} | |
| 803 | − | |
| 804 | −static struct spi_driver flexfb_spi_driver = { | |
| 805 | − .driver = { | |
| 806 | − .name = DRVNAME, | |
| 807 | − }, | |
| 808 | − .probe = flexfb_probe_spi, | |
| 809 | − .remove = flexfb_remove_spi, | |
| 810 | −}; | |
| 811 | − | |
| 812 | −static const struct platform_device_id flexfb_platform_ids[] = { | |
| 813 | − { "flexpfb", 0 }, | |
| 814 | − { }, | |
| 815 | −}; | |
| 816 | −MODULE_DEVICE_TABLE(platform, flexfb_platform_ids); | |
| 817 | − | |
| 818 | −static struct platform_driver flexfb_platform_driver = { | |
| 819 | − .driver = { | |
| 820 | − .name = DRVNAME, | |
| 821 | − }, | |
| 822 | − .id_table = flexfb_platform_ids, | |
| 823 | − .probe = flexfb_probe_pdev, | |
| 824 | − .remove = flexfb_remove_pdev, | |
| 825 | −}; | |
| 826 | − | |
| 827 | −static int __init flexfb_init(void) | |
| 828 | −{ | |
| 829 | − int ret, ret2; | |
| 830 | − | |
| 831 | − ret = spi_register_driver(&flexfb_spi_driver); | |
| 832 | − ret2 = platform_driver_register(&flexfb_platform_driver); | |
| 833 | − if (ret < 0) | |
| 834 | − return ret; | |
| 835 | − return ret2; | |
| 836 | −} | |
| 837 | − | |
| 838 | −static void __exit flexfb_exit(void) | |
| 839 | −{ | |
| 840 | − spi_unregister_driver(&flexfb_spi_driver); | |
| 841 | − platform_driver_unregister(&flexfb_platform_driver); | |
| 842 | −} | |
| 843 | − | |
| 844 | −/* ------------------------------------------------------------------------- */ | |
| 845 | − | |
| 846 | −module_init(flexfb_init); | |
| 847 | −module_exit(flexfb_exit); | |
| 848 | − | |
| 849 | −MODULE_DESCRIPTION("Generic FB driver for TFT LCD displays"); | |
| 850 | −MODULE_AUTHOR("Noralf Tronnes"); | |
| 851 | −MODULE_LICENSE("GPL"); | |
| @@ -261,11 +261,11 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) · 260 unmodified lines | ||
| 261 | 261 | /* Build the PKO buffer pointer */ |
| 262 | 262 | hw_buffer.u64 = 0; |
| 263 | 263 | if (skb_shinfo(skb)->nr_frags == 0) { |
| 264 | − hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)skb->data); | |
| 264 | + hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data); | |
| 265 | 265 | hw_buffer.s.pool = 0; |
| 266 | 266 | hw_buffer.s.size = skb->len; |
| 267 | 267 | } else { |
| 268 | − hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)skb->data); | |
| 268 | + hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data); | |
| 269 | 269 | hw_buffer.s.pool = 0; |
| 270 | 270 | hw_buffer.s.size = skb_headlen(skb); |
| 271 | 271 | CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64; |
| @@ -273,11 +273,12 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) · 1 unmodified line | ||
| 273 | 273 | skb_frag_t *fs = skb_shinfo(skb)->frags + i; |
| 274 | 274 | |
| 275 | 275 | hw_buffer.s.addr = |
| 276 | − XKPHYS_TO_PHYS((u64)skb_frag_address(fs)); | |
| 276 | + XKPHYS_TO_PHYS((uintptr_t)skb_frag_address(fs)); | |
| 277 | 277 | hw_buffer.s.size = skb_frag_size(fs); |
| 278 | 278 | CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64; |
| 279 | 279 | } |
| 280 | − hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)CVM_OCT_SKB_CB(skb)); | |
| 280 | + hw_buffer.s.addr = | |
| 281 | + XKPHYS_TO_PHYS((uintptr_t)CVM_OCT_SKB_CB(skb)); | |
| 281 | 282 | hw_buffer.s.size = skb_shinfo(skb)->nr_frags + 1; |
| 282 | 283 | pko_command.s.segs = skb_shinfo(skb)->nr_frags + 1; |
| 283 | 284 | pko_command.s.gather = 1; |
| @@ -349,10 +350,8 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) · 65 unmodified lines | ||
| 349 | 350 | */ |
| 350 | 351 | dst_release(skb_dst(skb)); |
| 351 | 352 | skb_dst_set(skb, NULL); |
| 352 | −#ifdef CONFIG_XFRM | |
| 353 | − secpath_reset(skb); | |
| 354 | −#endif | |
| 355 | − nf_reset(skb); | |
| 353 | + skb_ext_reset(skb); | |
| 354 | + nf_reset_ct(skb); | |
| 356 | 355 | |
| 357 | 356 | #ifdef CONFIG_NET_SCHED |
| 358 | 357 | skb->tc_index = 0; |
| @@ -1202,7 +1202,7 @@ static inline int cvmx_wqe_get_grp(cvmx_wqe_t *work) · 1201 unmodified lines | ||
| 1202 | 1202 | |
| 1203 | 1203 | static inline void *cvmx_phys_to_ptr(uint64_t physical_address) |
| 1204 | 1204 | { |
| 1205 | − return (void *)(physical_address); | |
| 1205 | + return (void *)(uintptr_t)(physical_address); | |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | static inline uint64_t cvmx_ptr_to_phys(void *ptr) |
| @@ -409,7 +409,7 @@ static int odm_ARFBRefresh_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_inf · 408 unmodified lines | ||
| 409 | 409 | pRaInfo->PTModeSS = 3; |
| 410 | 410 | else if (pRaInfo->HighestRate > 0x0b) |
| 411 | 411 | pRaInfo->PTModeSS = 2; |
| 412 | − else if (pRaInfo->HighestRate > 0x0b) | |
| 412 | + else if (pRaInfo->HighestRate > 0x03) | |
| 413 | 413 | pRaInfo->PTModeSS = 1; |
| 414 | 414 | else |
| 415 | 415 | pRaInfo->PTModeSS = 0; |
| @@ -348,8 +348,10 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, · 347 unmodified lines | ||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | padapter->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL); |
| 351 | − if (!padapter->HalData) | |
| 352 | − DBG_88E("cant not alloc memory for HAL DATA\n"); | |
| 351 | + if (!padapter->HalData) { | |
| 352 | + DBG_88E("Failed to allocate memory for HAL data\n"); | |
| 353 | + goto free_adapter; | |
| 354 | + } | |
| 353 | 355 | |
| 354 | 356 | /* step read_chip_version */ |
| 355 | 357 | rtw_hal_read_chip_version(padapter); |
| @@ -0,0 +1,369 @@ | ||
| 1 | +What: /sys/accessibility/speakup/attrib_bleep | |
| 2 | +KernelVersion: 2.6 | |
| 3 | +Contact: speakup@linux-speakup.org | |
| 4 | +Description: Beeps the PC speaker when there is an attribute change such as | |
| 5 | + foreground or background color when using speakup review | |
| 6 | + commands. One = on, zero = off. | |
| 7 | + | |
| 8 | +What: /sys/accessibility/speakup/bell_pos | |
| 9 | +KernelVersion: 2.6 | |
| 10 | +Contact: speakup@linux-speakup.org | |
| 11 | +Description: This works much like a typewriter bell. If for example 72 is | |
| 12 | + echoed to bell_pos, it will beep the PC speaker when typing on | |
| 13 | + a line past character 72. | |
| 14 | + | |
| 15 | +What: /sys/accessibility/speakup/bleeps | |
| 16 | +KernelVersion: 2.6 | |
| 17 | +Contact: speakup@linux-speakup.org | |
| 18 | +Description: This controls whether one hears beeps through the PC speaker | |
| 19 | + when using speakup's review commands. | |
| 20 | + TODO: what values does it accept? | |
| 21 | + | |
| 22 | +What: /sys/accessibility/speakup/bleep_time | |
| 23 | +KernelVersion: 2.6 | |
| 24 | +Contact: speakup@linux-speakup.org | |
| 25 | +Description: This controls the duration of the PC speaker beeps speakup | |
| 26 | + produces. | |
| 27 | + TODO: What are the units? Jiffies? | |
| 28 | + | |
| 29 | +What: /sys/accessibility/speakup/cursor_time | |
| 30 | +KernelVersion: 2.6 | |
| 31 | +Contact: speakup@linux-speakup.org | |
| 32 | +Description: This controls cursor delay when using arrow keys. When a | |
| 33 | + connection is very slow, with the default setting, when moving | |
| 34 | + with the arrows, or backspacing etc. speakup says the incorrect | |
| 35 | + characters. Set this to a higher value to adjust for the delay | |
| 36 | + and better synchronisation between cursor position and speech. | |
| 37 | + | |
| 38 | +What: /sys/accessibility/speakup/delimiters | |
| 39 | +KernelVersion: 2.6 | |
| 40 | +Contact: speakup@linux-speakup.org | |
| 41 | +Description: Delimit a word from speakup. | |
| 42 | + TODO: add more info | |
| 43 | + | |
| 44 | +What: /sys/accessibility/speakup/ex_num | |
| 45 | +KernelVersion: 2.6 | |
| 46 | +Contact: speakup@linux-speakup.org | |
| 47 | +Description: TODO: | |
| 48 | + | |
| 49 | +What: /sys/accessibility/speakup/key_echo | |
| 50 | +KernelVersion: 2.6 | |
| 51 | +Contact: speakup@linux-speakup.org | |
| 52 | +Description: Controls if speakup speaks keys when they are typed. One = on, | |
| 53 | + zero = off or don't echo keys. | |
| 54 | + | |
| 55 | +What: /sys/accessibility/speakup/keymap | |
| 56 | +KernelVersion: 2.6 | |
| 57 | +Contact: speakup@linux-speakup.org | |
| 58 | +Description: Speakup keymap remaps keys to Speakup functions. | |
| 59 | + It uses a binary | |
| 60 | + format. A special program called genmap is needed to compile a | |
| 61 | + textual keymap into the binary format which is then loaded into | |
| 62 | + /sys/accessibility/speakup/keymap. | |
| 63 | + | |
| 64 | +What: /sys/accessibility/speakup/no_interrupt | |
| 65 | +KernelVersion: 2.6 | |
| 66 | +Contact: speakup@linux-speakup.org | |
| 67 | +Description: Controls if typing interrupts output from speakup. With | |
| 68 | + no_interrupt set to zero, typing on the keyboard will interrupt | |
| 69 | + speakup if for example | |
| 70 | + the say screen command is used before the | |
| 71 | + entire screen is read. | |
| 72 | + With no_interrupt set to one, if the say | |
| 73 | + screen command is used, and one then types on the keyboard, | |
| 74 | + speakup will continue to say the whole screen regardless until | |
| 75 | + it finishes. | |
| 76 | + | |
| 77 | +What: /sys/accessibility/speakup/punc_all | |
| 78 | +KernelVersion: 2.6 | |
| 79 | +Contact: speakup@linux-speakup.org | |
| 80 | +Description: This is a list of all the punctuation speakup should speak when | |
| 81 | + punc_level is set to four. | |
| 82 | + | |
| 83 | +What: /sys/accessibility/speakup/punc_level | |
| 84 | +KernelVersion: 2.6 | |
| 85 | +Contact: speakup@linux-speakup.org | |
| 86 | +Description: Controls the level of punctuation spoken as the screen is | |
| 87 | + displayed, not reviewed. Levels range from zero no punctuation, | |
| 88 | + to four, all punctuation. One corresponds to punc_some, two | |
| 89 | + corresponds to punc_most, and three as well as four both | |
| 90 | + correspond to punc_all. Some hardware synthesizers may have | |
| 91 | + different levels each corresponding to three and four for | |
| 92 | + punc_level. Also note that if punc_level is set to zero, and | |
| 93 | + key_echo is set to one, typed punctuation is still spoken as it | |
| 94 | + is typed. | |
| 95 | + | |
| 96 | +What: /sys/accessibility/speakup/punc_most | |
| 97 | +KernelVersion: 2.6 | |
| 98 | +Contact: speakup@linux-speakup.org | |
| 99 | +Description: This is a list of all the punctuation speakup should speak when | |
| 100 | + punc_level is set to two. | |
| 101 | + | |
| 102 | +What: /sys/accessibility/speakup/punc_some | |
| 103 | +KernelVersion: 2.6 | |
| 104 | +Contact: speakup@linux-speakup.org | |
| 105 | +Description: This is a list of all the punctuation speakup should speak when | |
| 106 | + punc_level is set to one. | |
| 107 | + | |
| 108 | +What: /sys/accessibility/speakup/reading_punc | |
| 109 | +KernelVersion: 2.6 | |
| 110 | +Contact: speakup@linux-speakup.org | |
| 111 | +Description: Almost the same as punc_level, the differences being that | |
| 112 | + reading_punc controls the level of punctuation when reviewing | |
| 113 | + the screen with speakup's screen review commands. The other | |
| 114 | + difference is that reading_punc set to three speaks punc_all, | |
| 115 | + and reading_punc set to four speaks all punctuation, including | |
| 116 | + spaces. | |
| 117 | + | |
| 118 | +What: /sys/accessibility/speakup/repeats | |
| 119 | +KernelVersion: 2.6 | |
| 120 | +Contact: speakup@linux-speakup.org | |
| 121 | +Description: A list of characters speakup repeats. Normally, when there are | |
| 122 | + more than three characters in a row, speakup | |
| 123 | + just reads three of | |
| 124 | + those characters. For example, "......" would be read as dot, | |
| 125 | + dot, dot. If a . is added to the list of characters in repeats, | |
| 126 | + "......" would be read as dot, dot, dot, times six. | |
| 127 | + | |
| 128 | +What: /sys/accessibility/speakup/say_control | |
| 129 | +KernelVersion: 2.6 | |
| 130 | +Contact: speakup@linux-speakup.org | |
| 131 | +Description: If set to one, speakup speaks shift, alt and control when those | |
| 132 | + keys are pressed. If say_control is set to zero, shift, ctrl, | |
| 133 | + and alt are not spoken when they are pressed. | |
| 134 | + | |
| 135 | +What: /sys/accessibility/speakup/say_word_ctl | |
| 136 | +KernelVersion: 2.6 | |
| 137 | +Contact: speakup@linux-speakup.org | |
| 138 | +Description: TODO: | |
| 139 | + | |
| 140 | +What: /sys/accessibility/speakup/silent | |
| 141 | +KernelVersion: 2.6 | |
| 142 | +Contact: speakup@linux-speakup.org | |
| 143 | +Description: TODO: | |
| 144 | + | |
| 145 | +What: /sys/accessibility/speakup/spell_delay | |
| 146 | +KernelVersion: 2.6 | |
| 147 | +Contact: speakup@linux-speakup.org | |
| 148 | +Description: This controls how fast a word is spelled | |
| 149 | + when speakup's say word | |
| 150 | + review command is pressed twice quickly to speak the current | |
| 151 | + word being reviewed. Zero just speaks the letters one after | |
| 152 | + another, while values one through four | |
| 153 | + seem to introduce more of | |
| 154 | + a pause between the spelling of each letter by speakup. | |
| 155 | + | |
| 156 | +What: /sys/accessibility/speakup/synth | |
| 157 | +KernelVersion: 2.6 | |
| 158 | +Contact: speakup@linux-speakup.org | |
| 159 | +Description: Gets or sets the synthesizer driver currently in use. Reading | |
| 160 | + synth returns the synthesizer driver currently in use. Writing | |
| 161 | + synth switches to the given synthesizer driver, provided it is | |
| 162 | + either built into the kernel, or already loaded as a module. | |
| 163 | + | |
| 164 | +What: /sys/accessibility/speakup/synth_direct | |
| 165 | +KernelVersion: 2.6 | |
| 166 | +Contact: speakup@linux-speakup.org | |
| 167 | +Description: Sends whatever is written to synth_direct | |
| 168 | + directly to the speech synthesizer in use, bypassing speakup. | |
| 169 | + This could be used to make the synthesizer speak | |
| 170 | + a string, or to | |
| 171 | + send control sequences to the synthesizer to change how the | |
| 172 | + synthesizer behaves. | |
| 173 | + | |
| 174 | +What: /sys/accessibility/speakup/version | |
| 175 | +KernelVersion: 2.6 | |
| 176 | +Contact: speakup@linux-speakup.org | |
| 177 | +Description: Reading version returns the version of speakup, and the version | |
| 178 | + of the synthesizer driver currently in use. | |
| 179 | + | |
| 180 | +What: /sys/accessibility/speakup/i18n/announcements | |
| 181 | +KernelVersion: 2.6 | |
| 182 | +Contact: speakup@linux-speakup.org | |
| 183 | +Description: This file contains various general announcements, most of which | |
| 184 | + cannot be categorized. You will find messages such as "You | |
| 185 | + killed Speakup", "I'm alive", "leaving help", "parked", | |
| 186 | + "unparked", and others. You will also find the names of the | |
| 187 | + screen edges and cursor tracking modes here. | |
| 188 | + | |
| 189 | +What: /sys/accessibility/speakup/i18n/chartab | |
| 190 | +KernelVersion: 2.6 | |
| 191 | +Contact: speakup@linux-speakup.org | |
| 192 | +Description: TODO | |
| 193 | + | |
| 194 | +What: /sys/accessibility/speakup/i18n/ctl_keys | |
| 195 | +KernelVersion: 2.6 | |
| 196 | +Contact: speakup@linux-speakup.org | |
| 197 | +Description: Here, you will find names of control keys. These are used with | |
| 198 | + Speakup's say_control feature. | |
| 199 | + | |
| 200 | +What: /sys/accessibility/speakup/i18n/function_names | |
| 201 | +KernelVersion: 2.6 | |
| 202 | +Contact: speakup@linux-speakup.org | |
| 203 | +Description: Here, you will find a list of names for Speakup functions. | |
| 204 | + These are used by the help system. For example, suppose that | |
| 205 | + you have activated help mode, and you pressed | |
| 206 | + keypad 3. Speakup | |
| 207 | + says: "keypad 3 is character, say next." | |
| 208 | + The message "character, say next" names a Speakup function, and | |
| 209 | + it comes from this function_names file. | |
| 210 | + | |
| 211 | +What: /sys/accessibility/speakup/i18n/states | |
| 212 | +KernelVersion: 2.6 | |
| 213 | +Contact: speakup@linux-speakup.org | |
| 214 | +Description: This file contains names for key states. | |
| 215 | + Again, these are part of the help system. For instance, if you | |
| 216 | + had pressed speakup + keypad 3, you would hear: | |
| 217 | + "speakup keypad 3 is go to bottom edge." | |
| 218 | + The speakup key is depressed, so the name of the key state is | |
| 219 | + speakup. | |
| 220 | + This part of the message comes from the states collection. | |
| 221 | + | |
| 222 | +What: /sys/accessibility/speakup/i18n/characters | |
| 223 | +KernelVersion: 2.6 | |
| 224 | +Contact: speakup@linux-speakup.org | |
| 225 | +Description: Through this sys entry, Speakup gives you the ability to change | |
| 226 | + how Speakup pronounces a given character. You could, for | |
| 227 | + example, change how some punctuation characters are spoken. You | |
| 228 | + can even change how Speakup will pronounce certain letters. For | |
| 229 | + further details see '12. Changing the Pronunciation of | |
| 230 | + Characters' in Speakup User's Guide (file spkguide.txt in | |
| 231 | + source). | |
| 232 | + | |
| 233 | +What: /sys/accessibility/speakup/i18n/colors | |
| 234 | +KernelVersion: 2.6 | |
| 235 | +Contact: speakup@linux-speakup.org | |
| 236 | +Description: When you use the "say attributes" function, Speakup says the | |
| 237 | + name of the foreground and background colors. These names come | |
| 238 | + from the i18n/colors file. | |
| 239 | + | |
| 240 | +What: /sys/accessibility/speakup/i18n/formatted | |
| 241 | +KernelVersion: 2.6 | |
| 242 | +Contact: speakup@linux-speakup.org | |
| 243 | +Description: This group of messages contains embedded formatting codes, to | |
| 244 | + specify the type and width of displayed data. If you change | |
| 245 | + these, you must preserve all of the formatting codes, and they | |
| 246 | + must appear in the order used by the default messages. | |
| 247 | + | |
| 248 | +What: /sys/accessibility/speakup/i18n/key_names | |
| 249 | +KernelVersion: 2.6 | |
| 250 | +Contact: speakup@linux-speakup.org | |
| 251 | +Description: Again, key_names is used by Speakup's help system. In the | |
| 252 | + previous example, Speakup said that you pressed "keypad 3." | |
| 253 | + This name came from the key_names file. | |
| 254 | + | |
| 255 | +What: /sys/accessibility/speakup/<synth-name>/ | |
| 256 | +KernelVersion: 2.6 | |
| 257 | +Contact: speakup@linux-speakup.org | |
| 258 | +Description: In `/sys/accessibility/speakup` is a directory corresponding to | |
| 259 | + the synthesizer driver currently in use (E.G) `soft` for the | |
| 260 | + soft driver. This directory contains files which control the | |
| 261 | + speech synthesizer itself, | |
| 262 | + as opposed to controlling the speakup | |
| 263 | + screen reader. The parameters in this directory have the same | |
| 264 | + names and functions across all | |
| 265 | + supported synthesizers. The range | |
| 266 | + of values for freq, pitch, rate, and vol is the same for all | |
| 267 | + supported synthesizers, with the given range being internally | |
| 268 | + mapped by the driver to more or less fit the range of values | |
| 269 | + supported for a given parameter by the individual synthesizer. | |
| 270 | + Below is a description of values and parameters for soft | |
| 271 | + synthesizer, which is currently the most commonly used. | |
| 272 | + | |
| 273 | +What: /sys/accessibility/speakup/soft/caps_start | |
| 274 | +KernelVersion: 2.6 | |
| 275 | +Contact: speakup@linux-speakup.org | |
| 276 | +Description: This is the string that is sent to the synthesizer to cause it | |
| 277 | + to start speaking uppercase letters. For the soft synthesizer | |
| 278 | + and most others, this causes the pitch of the voice to rise | |
| 279 | + above the currently set pitch. | |
| 280 | + | |
| 281 | +What: /sys/accessibility/speakup/soft/caps_stop | |
| 282 | +KernelVersion: 2.6 | |
| 283 | +Contact: speakup@linux-speakup.org | |
| 284 | +Description: This is the string sent to the synthesizer to cause it to stop | |
| 285 | + speaking uppercase letters. In the case of the soft synthesizer | |
| 286 | + and most others, this returns the pitch of the voice | |
| 287 | + down to the | |
| 288 | + currently set pitch. | |
| 289 | + | |
| 290 | +What: /sys/accessibility/speakup/soft/delay_time | |
| 291 | +KernelVersion: 2.6 | |
| 292 | +Contact: speakup@linux-speakup.org | |
| 293 | +Description: TODO: | |
| 294 | + | |
| 295 | +What: /sys/accessibility/speakup/soft/direct | |
| 296 | +KernelVersion: 2.6 | |
| 297 | +Contact: speakup@linux-speakup.org | |
| 298 | +Description: Controls if punctuation is spoken by speakup, or by the | |
| 299 | + synthesizer. | |
| 300 | + For example, speakup speaks ">" as "greater", while | |
| 301 | + the espeak synthesizer used by the soft driver speaks "greater | |
| 302 | + than". Zero lets speakup speak the punctuation. One lets the | |
| 303 | + synthesizer itself speak punctuation. | |
| 304 | + | |
| 305 | +What: /sys/accessibility/speakup/soft/freq | |
| 306 | +KernelVersion: 2.6 | |
| 307 | +Contact: speakup@linux-speakup.org | |
| 308 | +Description: Gets or sets the frequency of the speech synthesizer. Range is | |
| 309 | + 0-9. | |
| 310 | + | |
| 311 | +What: /sys/accessibility/speakup/soft/full_time | |
| 312 | +KernelVersion: 2.6 | |
| 313 | +Contact: speakup@linux-speakup.org | |
| 314 | +Description: TODO: | |
| 315 | + | |
| 316 | +What: /sys/accessibility/speakup/soft/jiffy_delta | |
| 317 | +KernelVersion: 2.6 | |
| 318 | +Contact: speakup@linux-speakup.org | |
| 319 | +Description: This controls how many jiffys the kernel gives to the | |
| 320 | + synthesizer. Setting this too high can make a system unstable, | |
| 321 | + or even crash it. | |
| 322 | + | |
| 323 | +What: /sys/accessibility/speakup/soft/pitch | |
| 324 | +KernelVersion: 2.6 | |
| 325 | +Contact: speakup@linux-speakup.org | |
| 326 | +Description: Gets or sets the pitch of the synthesizer. The range is 0-9. | |
| 327 | + | |
| 328 | +What: /sys/accessibility/speakup/soft/punct | |
| 329 | +KernelVersion: 2.6 | |
| 330 | +Contact: speakup@linux-speakup.org | |
| 331 | +Description: Gets or sets the amount of punctuation spoken by the | |
| 332 | + synthesizer. The range for the soft driver seems to be 0-2. | |
| 333 | + TODO: How is this related to speakup's punc_level, or | |
| 334 | + reading_punc. | |
| 335 | + | |
| 336 | +What: /sys/accessibility/speakup/soft/rate | |
| 337 | +KernelVersion: 2.6 | |
| 338 | +Contact: speakup@linux-speakup.org | |
| 339 | +Description: Gets or sets the rate of the synthesizer. Range is from zero | |
| 340 | + slowest, to nine fastest. | |
| 341 | + | |
| 342 | +What: /sys/accessibility/speakup/soft/tone | |
| 343 | +KernelVersion: 2.6 | |
| 344 | +Contact: speakup@linux-speakup.org | |
| 345 | +Description: Gets or sets the tone of the speech synthesizer. The range for | |
| 346 | + the soft driver seems to be 0-2. This seems to make no | |
| 347 | + difference if using espeak and the espeakup connector. | |
| 348 | + TODO: does espeakup support different tonalities? | |
| 349 | + | |
| 350 | +What: /sys/accessibility/speakup/soft/trigger_time | |
| 351 | +KernelVersion: 2.6 | |
| 352 | +Contact: speakup@linux-speakup.org | |
| 353 | +Description: TODO: | |
| 354 | + | |
| 355 | +What: /sys/accessibility/speakup/soft/voice | |
| 356 | +KernelVersion: 2.6 | |
| 357 | +Contact: speakup@linux-speakup.org | |
| 358 | +Description: Gets or sets the voice used by the synthesizer if the | |
| 359 | + synthesizer can speak in more than one voice. The range for the | |
| 360 | + soft driver is 0-7. Note that while espeak supports multiple | |
| 361 | + voices, this parameter will not set the voice when the espeakup | |
| 362 | + connector is used between speakup and espeak. | |
| 363 | + | |
| 364 | +What: /sys/accessibility/speakup/soft/vol | |
| 365 | +KernelVersion: 2.6 | |
| 366 | +Contact: speakup@linux-speakup.org | |
| 367 | +Description: Gets or sets the volume of the speech synthesizer. Range is 0-9, | |
| 368 | + with zero being the softest, and nine being the loudest. | |
| 369 | + | |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | static const struct snd_pcm_hardware snd_bcm2835_playback_hw = { |
| 13 | 13 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
| 14 | 14 | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | |
| 15 | − SNDRV_PCM_INFO_DRAIN_TRIGGER | SNDRV_PCM_INFO_SYNC_APPLPTR), | |
| 15 | + SNDRV_PCM_INFO_SYNC_APPLPTR), | |
| 16 | 16 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, |
| 17 | 17 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
| 18 | 18 | .rate_min = 8000, |
| @@ -29,7 +29,7 @@ static const struct snd_pcm_hardware snd_bcm2835_playback_hw = { · 10 unmodified lines | ||
| 29 | 29 | static const struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { |
| 30 | 30 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
| 31 | 31 | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | |
| 32 | − SNDRV_PCM_INFO_DRAIN_TRIGGER | SNDRV_PCM_INFO_SYNC_APPLPTR), | |
| 32 | + SNDRV_PCM_INFO_SYNC_APPLPTR), | |
| 33 | 33 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 34 | 34 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | |
| 35 | 35 | SNDRV_PCM_RATE_48000, |
| @@ -289,6 +289,7 @@ int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream) · 288 unmodified lines | ||
| 289 | 289 | VC_AUDIO_MSG_TYPE_STOP, false); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | +/* FIXME: this doesn't seem working as expected for "draining" */ | |
| 292 | 293 | int bcm2835_audio_drain(struct bcm2835_alsa_stream *alsa_stream) |
| 293 | 294 | { |
| 294 | 295 | struct vc_audio_msg m = { |
| @@ -1748,8 +1748,10 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) · 1747 unmodified lines | ||
| 1748 | 1748 | |
| 1749 | 1749 | priv->hw->max_signal = 100; |
| 1750 | 1750 | |
| 1751 | − if (vnt_init(priv)) | |
| 1751 | + if (vnt_init(priv)) { | |
| 1752 | + device_free_info(priv); | |
| 1752 | 1753 | return -ENODEV; |
| 1754 | + } | |
| 1753 | 1755 | |
| 1754 | 1756 | device_print_info(priv); |
| 1755 | 1757 | pci_set_drvdata(pcid, priv); |
| @@ -968,6 +968,11 @@ static int __init n_hdlc_init(void) · 967 unmodified lines | ||
| 968 | 968 | |
| 969 | 969 | } /* end of init_module() */ |
| 970 | 970 | |
| 971 | +#ifdef CONFIG_SPARC | |
| 972 | +#undef __exitdata | |
| 973 | +#define __exitdata | |
| 974 | +#endif | |
| 975 | + | |
| 971 | 976 | static const char hdlc_unregister_ok[] __exitdata = |
| 972 | 977 | KERN_INFO "N_HDLC: line discipline unregistered\n"; |
| 973 | 978 | static const char hdlc_unregister_fail[] __exitdata = |
| @@ -141,7 +141,7 @@ static void omap8250_set_mctrl(struct uart_port *port, unsigned int mctrl) · 140 unmodified lines | ||
| 141 | 141 | |
| 142 | 142 | serial8250_do_set_mctrl(port, mctrl); |
| 143 | 143 | |
| 144 | − if (!up->gpios) { | |
| 144 | + if (!mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS)) { | |
| 145 | 145 | /* |
| 146 | 146 | * Turn off autoRTS if RTS is lowered and restore autoRTS |
| 147 | 147 | * setting if RTS is raised |
| @@ -456,7 +456,8 @@ static void omap_8250_set_termios(struct uart_port *port, · 308 unmodified lines | ||
| 456 | 456 | up->port.status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS | UPSTAT_AUTOXOFF); |
| 457 | 457 | |
| 458 | 458 | if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW && |
| 459 | − !up->gpios) { | |
| 459 | + !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS) && | |
| 460 | + !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_CTS)) { | |
| 460 | 461 | /* Enable AUTOCTS (autoRTS is enabled when RTS is raised) */ |
| 461 | 462 | up->port.status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS; |
| 462 | 463 | priv->efr |= UART_EFR_CTS; |
| @@ -1032,6 +1032,7 @@ config SERIAL_SIFIVE_CONSOLE · 1031 unmodified lines | ||
| 1032 | 1032 | bool "Console on SiFive UART" |
| 1033 | 1033 | depends on SERIAL_SIFIVE=y |
| 1034 | 1034 | select SERIAL_CORE_CONSOLE |
| 1035 | + select SERIAL_EARLYCON | |
| 1035 | 1036 | help |
| 1036 | 1037 | Select this option if you would like to use a SiFive UART as the |
| 1037 | 1038 | system console. |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | * Freescale linflexuart serial port driver |
| 4 | 4 | * |
| 5 | 5 | * Copyright 2012-2016 Freescale Semiconductor, Inc. |
| 6 | − * Copyright 2017-2018 NXP | |
| 6 | + * Copyright 2017-2019 NXP | |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #if defined(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE) && \ |
| @@ -246,12 +246,14 @@ static irqreturn_t linflex_rxint(int irq, void *dev_id) · 236 unmodified lines | ||
| 246 | 246 | struct tty_port *port = &sport->state->port; |
| 247 | 247 | unsigned long flags, status; |
| 248 | 248 | unsigned char rx; |
| 249 | + bool brk; | |
| 249 | 250 | |
| 250 | 251 | spin_lock_irqsave(&sport->lock, flags); |
| 251 | 252 | |
| 252 | 253 | status = readl(sport->membase + UARTSR); |
| 253 | 254 | while (status & LINFLEXD_UARTSR_RMB) { |
| 254 | 255 | rx = readb(sport->membase + BDRM); |
| 256 | + brk = false; | |
| 255 | 257 | flg = TTY_NORMAL; |
| 256 | 258 | sport->icount.rx++; |
| 257 | 259 | |
| @@ -261,8 +263,11 @@ static irqreturn_t linflex_rxint(int irq, void *dev_id) · 3 unmodified lines | ||
| 261 | 263 | status |= LINFLEXD_UARTSR_SZF; |
| 262 | 264 | if (status & LINFLEXD_UARTSR_BOF) |
| 263 | 265 | status |= LINFLEXD_UARTSR_BOF; |
| 264 | − if (status & LINFLEXD_UARTSR_FEF) | |
| 266 | + if (status & LINFLEXD_UARTSR_FEF) { | |
| 267 | + if (!rx) | |
| 268 | + brk = true; | |
| 265 | 269 | status |= LINFLEXD_UARTSR_FEF; |
| 270 | + } | |
| 266 | 271 | if (status & LINFLEXD_UARTSR_PE) |
| 267 | 272 | status |= LINFLEXD_UARTSR_PE; |
| 268 | 273 | } |
| @@ -271,13 +276,15 @@ static irqreturn_t linflex_rxint(int irq, void *dev_id) · 2 unmodified lines | ||
| 271 | 276 | sport->membase + UARTSR); |
| 272 | 277 | status = readl(sport->membase + UARTSR); |
| 273 | 278 | |
| 274 | − if (uart_handle_sysrq_char(sport, (unsigned char)rx)) | |
| 275 | − continue; | |
| 276 | − | |
| 279 | + if (brk) { | |
| 280 | + uart_handle_break(sport); | |
| 281 | + } else { | |
| 277 | 282 | #ifdef SUPPORT_SYSRQ |
| 278 | − sport->sysrq = 0; | |
| 283 | + if (uart_handle_sysrq_char(sport, (unsigned char)rx)) | |
| 284 | + continue; | |
| 279 | 285 | #endif |
| 280 | − tty_insert_flip_char(port, rx, flg); | |
| 286 | + tty_insert_flip_char(port, rx, flg); | |
| 287 | + } | |
| 281 | 288 | } |
| 282 | 289 | |
| 283 | 290 | spin_unlock_irqrestore(&sport->lock, flags); |
| @@ -548,7 +548,7 @@ static void lpuart_flush_buffer(struct uart_port *port) · 547 unmodified lines | ||
| 548 | 548 | val |= UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH; |
| 549 | 549 | lpuart32_write(&sport->port, val, UARTFIFO); |
| 550 | 550 | } else { |
| 551 | − val = readb(sport->port.membase + UARTPFIFO); | |
| 551 | + val = readb(sport->port.membase + UARTCFIFO); | |
| 552 | 552 | val |= UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH; |
| 553 | 553 | writeb(val, sport->port.membase + UARTCFIFO); |
| 554 | 554 | } |
| @@ -2222,8 +2222,8 @@ static int imx_uart_probe(struct platform_device *pdev) · 2221 unmodified lines | ||
| 2222 | 2222 | return PTR_ERR(base); |
| 2223 | 2223 | |
| 2224 | 2224 | rxirq = platform_get_irq(pdev, 0); |
| 2225 | − txirq = platform_get_irq(pdev, 1); | |
| 2226 | − rtsirq = platform_get_irq(pdev, 2); | |
| 2225 | + txirq = platform_get_irq_optional(pdev, 1); | |
| 2226 | + rtsirq = platform_get_irq_optional(pdev, 2); | |
| 2227 | 2227 | |
| 2228 | 2228 | sport->port.dev = &pdev->dev; |
| 2229 | 2229 | sport->port.mapbase = res->start; |
| @@ -740,7 +740,7 @@ static int __init owl_uart_init(void) · 739 unmodified lines | ||
| 740 | 740 | return ret; |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | −static void __init owl_uart_exit(void) | |
| 743 | +static void __exit owl_uart_exit(void) | |
| 744 | 744 | { |
| 745 | 745 | platform_driver_unregister(&owl_uart_platform_driver); |
| 746 | 746 | uart_unregister_driver(&owl_uart_driver); |
| @@ -815,7 +815,7 @@ static int __init rda_uart_init(void) · 814 unmodified lines | ||
| 815 | 815 | return ret; |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | −static void __init rda_uart_exit(void) | |
| 818 | +static void __exit rda_uart_exit(void) | |
| 819 | 819 | { |
| 820 | 820 | platform_driver_unregister(&rda_uart_platform_driver); |
| 821 | 821 | uart_unregister_driver(&rda_uart_driver); |
| @@ -1964,8 +1964,10 @@ uart_get_console(struct uart_port *ports, int nr, struct console *co) · 1963 unmodified lines | ||
| 1964 | 1964 | * console=<name>,io|mmio|mmio16|mmio32|mmio32be|mmio32native,<addr>,<options> |
| 1965 | 1965 | * |
| 1966 | 1966 | * The optional form |
| 1967 | + * | |
| 1967 | 1968 | * earlycon=<name>,0x<addr>,<options> |
| 1968 | 1969 | * console=<name>,0x<addr>,<options> |
| 1970 | + * | |
| 1969 | 1971 | * is also accepted; the returned @iotype will be UPIO_MEM. |
| 1970 | 1972 | * |
| 1971 | 1973 | * Returns 0 on success or -EINVAL on failure |
| @@ -66,6 +66,9 @@ EXPORT_SYMBOL_GPL(mctrl_gpio_set); · 65 unmodified lines | ||
| 66 | 66 | struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, |
| 67 | 67 | enum mctrl_gpio_idx gidx) |
| 68 | 68 | { |
| 69 | + if (gpios == NULL) | |
| 70 | + return NULL; | |
| 71 | + | |
| 69 | 72 | return gpios->gpio[gidx]; |
| 70 | 73 | } |
| 71 | 74 | EXPORT_SYMBOL_GPL(mctrl_gpio_to_gpiod); |
| @@ -2894,8 +2894,12 @@ static int sci_init_single(struct platform_device *dev, · 2893 unmodified lines | ||
| 2894 | 2894 | port->mapbase = res->start; |
| 2895 | 2895 | sci_port->reg_size = resource_size(res); |
| 2896 | 2896 | |
| 2897 | − for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) | |
| 2898 | − sci_port->irqs[i] = platform_get_irq(dev, i); | |
| 2897 | + for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) { | |
| 2898 | + if (i) | |
| 2899 | + sci_port->irqs[i] = platform_get_irq_optional(dev, i); | |
| 2900 | + else | |
| 2901 | + sci_port->irqs[i] = platform_get_irq(dev, i); | |
| 2902 | + } | |
| 2899 | 2903 | |
| 2900 | 2904 | /* The SCI generates several interrupts. They can be muxed together or |
| 2901 | 2905 | * connected to different interrupt lines. In the muxed case only one |
| @@ -897,7 +897,8 @@ static int __init ulite_init(void) · 896 unmodified lines | ||
| 897 | 897 | static void __exit ulite_exit(void) |
| 898 | 898 | { |
| 899 | 899 | platform_driver_unregister(&ulite_platform_driver); |
| 900 | − uart_unregister_driver(&ulite_uart_driver); | |
| 900 | + if (ulite_uart_driver.state) | |
| 901 | + uart_unregister_driver(&ulite_uart_driver); | |
| 901 | 902 | } |
| 902 | 903 | |
| 903 | 904 | module_init(ulite_init); |
| @@ -1550,7 +1550,6 @@ static int cdns_uart_probe(struct platform_device *pdev) · 1549 unmodified lines | ||
| 1550 | 1550 | goto err_out_id; |
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | − uartps_major = cdns_uart_uart_driver->tty_driver->major; | |
| 1554 | 1553 | cdns_uart_data->cdns_uart_driver = cdns_uart_uart_driver; |
| 1555 | 1554 | |
| 1556 | 1555 | /* |
| @@ -1680,6 +1679,7 @@ static int cdns_uart_probe(struct platform_device *pdev) · 123 unmodified lines | ||
| 1680 | 1679 | console_port = NULL; |
| 1681 | 1680 | #endif |
| 1682 | 1681 | |
| 1682 | + uartps_major = cdns_uart_uart_driver->tty_driver->major; | |
| 1683 | 1683 | cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node, |
| 1684 | 1684 | "cts-override"); |
| 1685 | 1685 | return 0; |
| @@ -1741,6 +1741,12 @@ static int cdns_uart_remove(struct platform_device *pdev) · 55 unmodified lines | ||
| 1741 | 1741 | console_port = NULL; |
| 1742 | 1742 | #endif |
| 1743 | 1743 | |
| 1744 | + /* If this is last instance major number should be initialized */ | |
| 1745 | + mutex_lock(&bitmap_lock); | |
| 1746 | + if (bitmap_empty(bitmap, MAX_UART_INSTANCES)) | |
| 1747 | + uartps_major = 0; | |
| 1748 | + mutex_unlock(&bitmap_lock); | |
| 1749 | + | |
| 1744 | 1750 | uart_unregister_driver(cdns_uart_data->cdns_uart_driver); |
| 1745 | 1751 | return rc; |
| 1746 | 1752 | } |
| @@ -159,8 +159,9 @@ static int cdns3_pci_probe(struct pci_dev *pdev, · 158 unmodified lines | ||
| 159 | 159 | wrap->plat_dev = platform_device_register_full(&plat_info); |
| 160 | 160 | if (IS_ERR(wrap->plat_dev)) { |
| 161 | 161 | pci_disable_device(pdev); |
| 162 | + err = PTR_ERR(wrap->plat_dev); | |
| 162 | 163 | kfree(wrap); |
| 163 | − return PTR_ERR(wrap->plat_dev); | |
| 164 | + return err; | |
| 164 | 165 | } |
| 165 | 166 | } |
| 166 | 167 | |
| @@ -160,10 +160,28 @@ static int cdns3_core_init_role(struct cdns3 *cdns) · 159 unmodified lines | ||
| 160 | 160 | if (ret) |
| 161 | 161 | goto err; |
| 162 | 162 | |
| 163 | − if (cdns->dr_mode != USB_DR_MODE_OTG) { | |
| 163 | + /* Initialize idle role to start with */ | |
| 164 | + ret = cdns3_role_start(cdns, USB_ROLE_NONE); | |
| 165 | + if (ret) | |
| 166 | + goto err; | |
| 167 | + | |
| 168 | + switch (cdns->dr_mode) { | |
| 169 | + case USB_DR_MODE_UNKNOWN: | |
| 170 | + case USB_DR_MODE_OTG: | |
| 164 | 171 | ret = cdns3_hw_role_switch(cdns); |
| 165 | 172 | if (ret) |
| 166 | 173 | goto err; |
| 174 | + break; | |
| 175 | + case USB_DR_MODE_PERIPHERAL: | |
| 176 | + ret = cdns3_role_start(cdns, USB_ROLE_DEVICE); | |
| 177 | + if (ret) | |
| 178 | + goto err; | |
| 179 | + break; | |
| 180 | + case USB_DR_MODE_HOST: | |
| 181 | + ret = cdns3_role_start(cdns, USB_ROLE_HOST); | |
| 182 | + if (ret) | |
| 183 | + goto err; | |
| 184 | + break; | |
| 167 | 185 | } |
| 168 | 186 | |
| 169 | 187 | return ret; |
| @@ -234,9 +234,11 @@ static int cdns3_req_ep0_set_address(struct cdns3_device *priv_dev, · 233 unmodified lines | ||
| 234 | 234 | static int cdns3_req_ep0_get_status(struct cdns3_device *priv_dev, |
| 235 | 235 | struct usb_ctrlrequest *ctrl) |
| 236 | 236 | { |
| 237 | + struct cdns3_endpoint *priv_ep; | |
| 237 | 238 | __le16 *response_pkt; |
| 238 | 239 | u16 usb_status = 0; |
| 239 | 240 | u32 recip; |
| 241 | + u8 index; | |
| 240 | 242 | |
| 241 | 243 | recip = ctrl->bRequestType & USB_RECIP_MASK; |
| 242 | 244 | |
| @@ -262,9 +264,13 @@ static int cdns3_req_ep0_get_status(struct cdns3_device *priv_dev, · 19 unmodified lines | ||
| 262 | 264 | case USB_RECIP_INTERFACE: |
| 263 | 265 | return cdns3_ep0_delegate_req(priv_dev, ctrl); |
| 264 | 266 | case USB_RECIP_ENDPOINT: |
| 265 | − /* check if endpoint is stalled */ | |
| 267 | + index = cdns3_ep_addr_to_index(ctrl->wIndex); | |
| 268 | + priv_ep = priv_dev->eps[index]; | |
| 269 | + | |
| 270 | + /* check if endpoint is stalled or stall is pending */ | |
| 266 | 271 | cdns3_select_ep(priv_dev, ctrl->wIndex); |
| 267 | − if (EP_STS_STALL(readl(&priv_dev->regs->ep_sts))) | |
| 272 | + if (EP_STS_STALL(readl(&priv_dev->regs->ep_sts)) || | |
| 273 | + (priv_ep->flags & EP_STALL_PENDING)) | |
| 268 | 274 | usb_status = BIT(USB_ENDPOINT_HALT); |
| 269 | 275 | break; |
| 270 | 276 | default: |
| @@ -332,7 +338,7 @@ static int cdns3_ep0_feature_handle_device(struct cdns3_device *priv_dev, · 61 unmodified lines | ||
| 332 | 338 | * for sending status stage. |
| 333 | 339 | * This time should be less then 3ms. |
| 334 | 340 | */ |
| 335 | − usleep_range(1000, 2000); | |
| 341 | + mdelay(1); | |
| 336 | 342 | cdns3_set_register_bit(&priv_dev->regs->usb_cmd, |
| 337 | 343 | USB_CMD_STMODE | |
| 338 | 344 | USB_STS_TMODE_SEL(tmode - 1)); |
| @@ -2571,6 +2571,7 @@ static int cdns3_gadget_start(struct cdns3 *cdns) · 2570 unmodified lines | ||
| 2571 | 2571 | switch (max_speed) { |
| 2572 | 2572 | case USB_SPEED_FULL: |
| 2573 | 2573 | writel(USB_CONF_SFORCE_FS, &priv_dev->regs->usb_conf); |
| 2574 | + writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); | |
| 2574 | 2575 | break; |
| 2575 | 2576 | case USB_SPEED_HIGH: |
| 2576 | 2577 | writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); |
| @@ -2662,6 +2663,13 @@ static int __cdns3_gadget_init(struct cdns3 *cdns) · 85 unmodified lines | ||
| 2662 | 2663 | { |
| 2663 | 2664 | int ret = 0; |
| 2664 | 2665 | |
| 2666 | + /* Ensure 32-bit DMA Mask in case we switched back from Host mode */ | |
| 2667 | + ret = dma_set_mask_and_coherent(cdns->dev, DMA_BIT_MASK(32)); | |
| 2668 | + if (ret) { | |
| 2669 | + dev_err(cdns->dev, "Failed to set dma mask: %d\n", ret); | |
| 2670 | + return ret; | |
| 2671 | + } | |
| 2672 | + | |
| 2665 | 2673 | cdns3_drd_switch_gadget(cdns, 1); |
| 2666 | 2674 | pm_runtime_get_sync(cdns->dev); |
| 2667 | 2675 | |
| @@ -461,10 +461,12 @@ static int usblp_release(struct inode *inode, struct file *file) · 460 unmodified lines | ||
| 461 | 461 | |
| 462 | 462 | mutex_lock(&usblp_mutex); |
| 463 | 463 | usblp->used = 0; |
| 464 | − if (usblp->present) { | |
| 464 | + if (usblp->present) | |
| 465 | 465 | usblp_unlink_urbs(usblp); |
| 466 | − usb_autopm_put_interface(usblp->intf); | |
| 467 | − } else /* finish cleanup from disconnect */ | |
| 466 | + | |
| 467 | + usb_autopm_put_interface(usblp->intf); | |
| 468 | + | |
| 469 | + if (!usblp->present) /* finish cleanup from disconnect */ | |
| 468 | 470 | usblp_cleanup(usblp); |
| 469 | 471 | mutex_unlock(&usblp_mutex); |
| 470 | 472 | return 0; |
| @@ -139,14 +139,14 @@ static int dwc3_otg_get_irq(struct dwc3 *dwc) · 138 unmodified lines | ||
| 139 | 139 | struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); |
| 140 | 140 | int irq; |
| 141 | 141 | |
| 142 | − irq = platform_get_irq_byname(dwc3_pdev, "otg"); | |
| 142 | + irq = platform_get_irq_byname_optional(dwc3_pdev, "otg"); | |
| 143 | 143 | if (irq > 0) |
| 144 | 144 | goto out; |
| 145 | 145 | |
| 146 | 146 | if (irq == -EPROBE_DEFER) |
| 147 | 147 | goto out; |
| 148 | 148 | |
| 149 | − irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3"); | |
| 149 | + irq = platform_get_irq_byname_optional(dwc3_pdev, "dwc_usb3"); | |
| 150 | 150 | if (irq > 0) |
| 151 | 151 | goto out; |
| 152 | 152 | |
| @@ -157,9 +157,6 @@ static int dwc3_otg_get_irq(struct dwc3 *dwc) · 4 unmodified lines | ||
| 157 | 157 | if (irq > 0) |
| 158 | 158 | goto out; |
| 159 | 159 | |
| 160 | − if (irq != -EPROBE_DEFER) | |
| 161 | − dev_err(dwc->dev, "missing OTG IRQ\n"); | |
| 162 | − | |
| 163 | 160 | if (!irq) |
| 164 | 161 | irq = -EINVAL; |
| 165 | 162 | |
| @@ -3264,14 +3264,14 @@ static int dwc3_gadget_get_irq(struct dwc3 *dwc) · 3263 unmodified lines | ||
| 3264 | 3264 | struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); |
| 3265 | 3265 | int irq; |
| 3266 | 3266 | |
| 3267 | − irq = platform_get_irq_byname(dwc3_pdev, "peripheral"); | |
| 3267 | + irq = platform_get_irq_byname_optional(dwc3_pdev, "peripheral"); | |
| 3268 | 3268 | if (irq > 0) |
| 3269 | 3269 | goto out; |
| 3270 | 3270 | |
| 3271 | 3271 | if (irq == -EPROBE_DEFER) |
| 3272 | 3272 | goto out; |
| 3273 | 3273 | |
| 3274 | − irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3"); | |
| 3274 | + irq = platform_get_irq_byname_optional(dwc3_pdev, "dwc_usb3"); | |
| 3275 | 3275 | if (irq > 0) |
| 3276 | 3276 | goto out; |
| 3277 | 3277 | |
| @@ -3282,9 +3282,6 @@ static int dwc3_gadget_get_irq(struct dwc3 *dwc) · 4 unmodified lines | ||
| 3282 | 3282 | if (irq > 0) |
| 3283 | 3283 | goto out; |
| 3284 | 3284 | |
| 3285 | − if (irq != -EPROBE_DEFER) | |
| 3286 | − dev_err(dwc->dev, "missing peripheral IRQ\n"); | |
| 3287 | − | |
| 3288 | 3285 | if (!irq) |
| 3289 | 3286 | irq = -EINVAL; |
| 3290 | 3287 | |
| @@ -16,14 +16,14 @@ static int dwc3_host_get_irq(struct dwc3 *dwc) · 15 unmodified lines | ||
| 16 | 16 | struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); |
| 17 | 17 | int irq; |
| 18 | 18 | |
| 19 | − irq = platform_get_irq_byname(dwc3_pdev, "host"); | |
| 19 | + irq = platform_get_irq_byname_optional(dwc3_pdev, "host"); | |
| 20 | 20 | if (irq > 0) |
| 21 | 21 | goto out; |
| 22 | 22 | |
| 23 | 23 | if (irq == -EPROBE_DEFER) |
| 24 | 24 | goto out; |
| 25 | 25 | |
| 26 | − irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3"); | |
| 26 | + irq = platform_get_irq_byname_optional(dwc3_pdev, "dwc_usb3"); | |
| 27 | 27 | if (irq > 0) |
| 28 | 28 | goto out; |
| 29 | 29 | |
| @@ -34,9 +34,6 @@ static int dwc3_host_get_irq(struct dwc3 *dwc) · 4 unmodified lines | ||
| 34 | 34 | if (irq > 0) |
| 35 | 35 | goto out; |
| 36 | 36 | |
| 37 | − if (irq != -EPROBE_DEFER) | |
| 38 | − dev_err(dwc->dev, "missing host IRQ\n"); | |
| 39 | − | |
| 40 | 37 | if (!irq) |
| 41 | 38 | irq = -EINVAL; |
| 42 | 39 | |
| @@ -45,7 +45,7 @@ config USB_AT91 · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | config USB_LPC32XX |
| 47 | 47 | tristate "LPC32XX USB Peripheral Controller" |
| 48 | − depends on ARCH_LPC32XX | |
| 48 | + depends on ARCH_LPC32XX || COMPILE_TEST | |
| 49 | 49 | depends on I2C |
| 50 | 50 | select USB_ISP1301 |
| 51 | 51 | help |
| @@ -48,6 +48,7 @@ · 47 unmodified lines | ||
| 48 | 48 | #define DRIVER_VERSION "02 May 2005" |
| 49 | 49 | |
| 50 | 50 | #define POWER_BUDGET 500 /* in mA; use 8 for low-power port testing */ |
| 51 | +#define POWER_BUDGET_3 900 /* in mA */ | |
| 51 | 52 | |
| 52 | 53 | static const char driver_name[] = "dummy_hcd"; |
| 53 | 54 | static const char driver_desc[] = "USB Host+Gadget Emulator"; |
| @@ -2432,7 +2433,7 @@ static int dummy_start_ss(struct dummy_hcd *dum_hcd) · 2378 unmodified lines | ||
| 2432 | 2433 | dum_hcd->rh_state = DUMMY_RH_RUNNING; |
| 2433 | 2434 | dum_hcd->stream_en_ep = 0; |
| 2434 | 2435 | INIT_LIST_HEAD(&dum_hcd->urbp_list); |
| 2435 | − dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET; | |
| 2436 | + dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET_3; | |
| 2436 | 2437 | dummy_hcd_to_hcd(dum_hcd)->state = HC_STATE_RUNNING; |
| 2437 | 2438 | dummy_hcd_to_hcd(dum_hcd)->uses_new_polling = 1; |
| 2438 | 2439 | #ifdef CONFIG_USB_OTG |
| @@ -1151,7 +1151,7 @@ static void udc_pop_fifo(struct lpc32xx_udc *udc, u8 *data, u32 bytes) · 1150 unmodified lines | ||
| 1151 | 1151 | u32 *p32, tmp, cbytes; |
| 1152 | 1152 | |
| 1153 | 1153 | /* Use optimal data transfer method based on source address and size */ |
| 1154 | − switch (((u32) data) & 0x3) { | |
| 1154 | + switch (((uintptr_t) data) & 0x3) { | |
| 1155 | 1155 | case 0: /* 32-bit aligned */ |
| 1156 | 1156 | p32 = (u32 *) data; |
| 1157 | 1157 | cbytes = (bytes & ~0x3); |
| @@ -1252,7 +1252,7 @@ static void udc_stuff_fifo(struct lpc32xx_udc *udc, u8 *data, u32 bytes) · 94 unmodified lines | ||
| 1252 | 1252 | u32 *p32, tmp, cbytes; |
| 1253 | 1253 | |
| 1254 | 1254 | /* Use optimal data transfer method based on source address and size */ |
| 1255 | − switch (((u32) data) & 0x3) { | |
| 1255 | + switch (((uintptr_t) data) & 0x3) { | |
| 1256 | 1256 | case 0: /* 32-bit aligned */ |
| 1257 | 1257 | p32 = (u32 *) data; |
| 1258 | 1258 | cbytes = (bytes & ~0x3); |
| @@ -57,6 +57,7 @@ static int xhci_create_intel_xhci_sw_pdev(struct xhci_hcd *xhci, u32 cap_offset) · 56 unmodified lines | ||
| 57 | 57 | ret = platform_device_add_properties(pdev, role_switch_props); |
| 58 | 58 | if (ret) { |
| 59 | 59 | dev_err(dev, "failed to register device properties\n"); |
| 60 | + platform_device_put(pdev); | |
| 60 | 61 | return ret; |
| 61 | 62 | } |
| 62 | 63 | } |
| @@ -3202,10 +3202,10 @@ static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len, · 3201 unmodified lines | ||
| 3202 | 3202 | if (usb_urb_dir_out(urb)) { |
| 3203 | 3203 | len = sg_pcopy_to_buffer(urb->sg, urb->num_sgs, |
| 3204 | 3204 | seg->bounce_buf, new_buff_len, enqd_len); |
| 3205 | − if (len != seg->bounce_len) | |
| 3205 | + if (len != new_buff_len) | |
| 3206 | 3206 | xhci_warn(xhci, |
| 3207 | 3207 | "WARN Wrong bounce buffer write length: %zu != %d\n", |
| 3208 | − len, seg->bounce_len); | |
| 3208 | + len, new_buff_len); | |
| 3209 | 3209 | seg->bounce_dma = dma_map_single(dev, seg->bounce_buf, |
| 3210 | 3210 | max_pkt, DMA_TO_DEVICE); |
| 3211 | 3211 | } else { |
| @@ -1032,7 +1032,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) · 1031 unmodified lines | ||
| 1032 | 1032 | writel(command, &xhci->op_regs->command); |
| 1033 | 1033 | xhci->broken_suspend = 0; |
| 1034 | 1034 | if (xhci_handshake(&xhci->op_regs->status, |
| 1035 | − STS_SAVE, 0, 10 * 1000)) { | |
| 1035 | + STS_SAVE, 0, 20 * 1000)) { | |
| 1036 | 1036 | /* |
| 1037 | 1037 | * AMD SNPS xHC 3.0 occasionally does not clear the |
| 1038 | 1038 | * SSS bit of USBSTS and when driver tries to poll |
| @@ -1108,6 +1108,18 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 69 unmodified lines | ||
| 1108 | 1108 | hibernated = true; |
| 1109 | 1109 | |
| 1110 | 1110 | if (!hibernated) { |
| 1111 | + /* | |
| 1112 | + * Some controllers might lose power during suspend, so wait | |
| 1113 | + * for controller not ready bit to clear, just as in xHC init. | |
| 1114 | + */ | |
| 1115 | + retval = xhci_handshake(&xhci->op_regs->status, | |
| 1116 | + STS_CNR, 0, 10 * 1000 * 1000); | |
| 1117 | + if (retval) { | |
| 1118 | + xhci_warn(xhci, "Controller not ready at resume %d\n", | |
| 1119 | + retval); | |
| 1120 | + spin_unlock_irq(&xhci->lock); | |
| 1121 | + return retval; | |
| 1122 | + } | |
| 1111 | 1123 | /* step 1: restore register */ |
| 1112 | 1124 | xhci_restore_registers(xhci); |
| 1113 | 1125 | /* step 2: initialize command ring buffer */ |
| @@ -3083,6 +3095,7 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, · 1969 unmodified lines | ||
| 3083 | 3095 | unsigned int ep_index; |
| 3084 | 3096 | unsigned long flags; |
| 3085 | 3097 | u32 ep_flag; |
| 3098 | + int err; | |
| 3086 | 3099 | |
| 3087 | 3100 | xhci = hcd_to_xhci(hcd); |
| 3088 | 3101 | if (!host_ep->hcpriv) |
| @@ -3142,7 +3155,17 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, · 53 unmodified lines | ||
| 3142 | 3155 | xhci_free_command(xhci, cfg_cmd); |
| 3143 | 3156 | goto cleanup; |
| 3144 | 3157 | } |
| 3145 | − xhci_queue_stop_endpoint(xhci, stop_cmd, udev->slot_id, ep_index, 0); | |
| 3158 | + | |
| 3159 | + err = xhci_queue_stop_endpoint(xhci, stop_cmd, udev->slot_id, | |
| 3160 | + ep_index, 0); | |
| 3161 | + if (err < 0) { | |
| 3162 | + spin_unlock_irqrestore(&xhci->lock, flags); | |
| 3163 | + xhci_free_command(xhci, cfg_cmd); | |
| 3164 | + xhci_dbg(xhci, "%s: Failed to queue stop ep command, %d ", | |
| 3165 | + __func__, err); | |
| 3166 | + goto cleanup; | |
| 3167 | + } | |
| 3168 | + | |
| 3146 | 3169 | xhci_ring_cmd_db(xhci); |
| 3147 | 3170 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 3148 | 3171 | |
| @@ -3156,8 +3179,16 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, · 7 unmodified lines | ||
| 3156 | 3179 | ctrl_ctx, ep_flag, ep_flag); |
| 3157 | 3180 | xhci_endpoint_copy(xhci, cfg_cmd->in_ctx, vdev->out_ctx, ep_index); |
| 3158 | 3181 | |
| 3159 | − xhci_queue_configure_endpoint(xhci, cfg_cmd, cfg_cmd->in_ctx->dma, | |
| 3182 | + err = xhci_queue_configure_endpoint(xhci, cfg_cmd, cfg_cmd->in_ctx->dma, | |
| 3160 | 3183 | udev->slot_id, false); |
| 3184 | + if (err < 0) { | |
| 3185 | + spin_unlock_irqrestore(&xhci->lock, flags); | |
| 3186 | + xhci_free_command(xhci, cfg_cmd); | |
| 3187 | + xhci_dbg(xhci, "%s: Failed to queue config ep command, %d ", | |
| 3188 | + __func__, err); | |
| 3189 | + goto cleanup; | |
| 3190 | + } | |
| 3191 | + | |
| 3161 | 3192 | xhci_ring_cmd_db(xhci); |
| 3162 | 3193 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 3163 | 3194 | |
| @@ -4674,12 +4705,12 @@ static int xhci_update_timeout_for_endpoint(struct xhci_hcd *xhci, · 1510 unmodified lines | ||
| 4674 | 4705 | alt_timeout = xhci_call_host_update_timeout_for_endpoint(xhci, udev, |
| 4675 | 4706 | desc, state, timeout); |
| 4676 | 4707 | |
| 4677 | − /* If we found we can't enable hub-initiated LPM, or | |
| 4708 | + /* If we found we can't enable hub-initiated LPM, and | |
| 4678 | 4709 | * the U1 or U2 exit latency was too high to allow |
| 4679 | − * device-initiated LPM as well, just stop searching. | |
| 4710 | + * device-initiated LPM as well, then we will disable LPM | |
| 4711 | + * for this device, so stop searching any further. | |
| 4680 | 4712 | */ |
| 4681 | − if (alt_timeout == USB3_LPM_DISABLED || | |
| 4682 | − alt_timeout == USB3_LPM_DEVICE_INITIATED) { | |
| 4713 | + if (alt_timeout == USB3_LPM_DISABLED) { | |
| 4683 | 4714 | *timeout = alt_timeout; |
| 4684 | 4715 | return -E2BIG; |
| 4685 | 4716 | } |
| @@ -4790,10 +4821,12 @@ static u16 xhci_calculate_lpm_timeout(struct usb_hcd *hcd, · 104 unmodified lines | ||
| 4790 | 4821 | if (intf->dev.driver) { |
| 4791 | 4822 | driver = to_usb_driver(intf->dev.driver); |
| 4792 | 4823 | if (driver && driver->disable_hub_initiated_lpm) { |
| 4793 | − dev_dbg(&udev->dev, "Hub-initiated %s disabled " | |
| 4794 | − "at request of driver %s\n", | |
| 4795 | − state_name, driver->name); | |
| 4796 | − return xhci_get_timeout_no_hub_lpm(udev, state); | |
| 4824 | + dev_dbg(&udev->dev, "Hub-initiated %s disabled at request of driver %s\n", | |
| 4825 | + state_name, driver->name); | |
| 4826 | + timeout = xhci_get_timeout_no_hub_lpm(udev, | |
| 4827 | + state); | |
| 4828 | + if (timeout == USB3_LPM_DISABLED) | |
| 4829 | + return timeout; | |
| 4797 | 4830 | } |
| 4798 | 4831 | } |
| 4799 | 4832 | |
| @@ -5077,11 +5110,18 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) · 277 unmodified lines | ||
| 5077 | 5110 | hcd->has_tt = 1; |
| 5078 | 5111 | } else { |
| 5079 | 5112 | /* |
| 5080 | − * Some 3.1 hosts return sbrn 0x30, use xhci supported protocol | |
| 5081 | − * minor revision instead of sbrn. Minor revision is a two digit | |
| 5082 | − * BCD containing minor and sub-minor numbers, only show minor. | |
| 5113 | + * Early xHCI 1.1 spec did not mention USB 3.1 capable hosts | |
| 5114 | + * should return 0x31 for sbrn, or that the minor revision | |
| 5115 | + * is a two digit BCD containig minor and sub-minor numbers. | |
| 5116 | + * This was later clarified in xHCI 1.2. | |
| 5117 | + * | |
| 5118 | + * Some USB 3.1 capable hosts therefore have sbrn 0x30, and | |
| 5119 | + * minor revision set to 0x1 instead of 0x10. | |
| 5083 | 5120 | */ |
| 5084 | − minor_rev = xhci->usb3_rhub.min_rev / 0x10; | |
| 5121 | + if (xhci->usb3_rhub.min_rev == 0x1) | |
| 5122 | + minor_rev = 1; | |
| 5123 | + else | |
| 5124 | + minor_rev = xhci->usb3_rhub.min_rev / 0x10; | |
| 5085 | 5125 | |
| 5086 | 5126 | switch (minor_rev) { |
| 5087 | 5127 | case 2: |
| @@ -5198,8 +5238,16 @@ static void xhci_clear_tt_buffer_complete(struct usb_hcd *hcd, · 110 unmodified lines | ||
| 5198 | 5238 | unsigned int ep_index; |
| 5199 | 5239 | unsigned long flags; |
| 5200 | 5240 | |
| 5241 | + /* | |
| 5242 | + * udev might be NULL if tt buffer is cleared during a failed device | |
| 5243 | + * enumeration due to a halted control endpoint. Usb core might | |
| 5244 | + * have allocated a new udev for the next enumeration attempt. | |
| 5245 | + */ | |
| 5246 | + | |
| 5201 | 5247 | xhci = hcd_to_xhci(hcd); |
| 5202 | 5248 | udev = (struct usb_device *)ep->hcpriv; |
| 5249 | + if (!udev) | |
| 5250 | + return; | |
| 5203 | 5251 | slot_id = udev->slot_id; |
| 5204 | 5252 | ep_index = xhci_get_endpoint_index(&ep->desc); |
| 5205 | 5253 | |
| @@ -716,6 +716,10 @@ static int mts_usb_probe(struct usb_interface *intf, · 715 unmodified lines | ||
| 716 | 716 | |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | + if (ep_in_current != &ep_in_set[2]) { | |
| 720 | + MTS_WARNING("couldn't find two input bulk endpoints. Bailing out.\n"); | |
| 721 | + return -ENODEV; | |
| 722 | + } | |
| 719 | 723 | |
| 720 | 724 | if ( ep_out == -1 ) { |
| 721 | 725 | MTS_WARNING( "couldn't find an output bulk endpoint. Bailing out.\n" ); |
| @@ -47,16 +47,6 @@ config USB_SEVSEG · 46 unmodified lines | ||
| 47 | 47 | To compile this driver as a module, choose M here: the |
| 48 | 48 | module will be called usbsevseg. |
| 49 | 49 | |
| 50 | −config USB_RIO500 | |
| 51 | − tristate "USB Diamond Rio500 support" | |
| 52 | − help | |
| 53 | − Say Y here if you want to connect a USB Rio500 mp3 player to your | |
| 54 | − computer's USB port. Please read <file:Documentation/usb/rio.rst> | |
| 55 | − for more information. | |
| 56 | − | |
| 57 | − To compile this driver as a module, choose M here: the | |
| 58 | − module will be called rio500. | |
| 59 | − | |
| 60 | 50 | config USB_LEGOTOWER |
| 61 | 51 | tristate "USB Lego Infrared Tower support" |
| 62 | 52 | help |
| @@ -17,7 +17,6 @@ obj-$(CONFIG_USB_ISIGHTFW) += isight_firmware.o · 16 unmodified lines | ||
| 17 | 17 | obj-$(CONFIG_USB_LCD) += usblcd.o |
| 18 | 18 | obj-$(CONFIG_USB_LD) += ldusb.o |
| 19 | 19 | obj-$(CONFIG_USB_LEGOTOWER) += legousbtower.o |
| 20 | −obj-$(CONFIG_USB_RIO500) += rio500.o | |
| 21 | 20 | obj-$(CONFIG_USB_TEST) += usbtest.o |
| 22 | 21 | obj-$(CONFIG_USB_EHSET_TEST_FIXTURE) += ehset.o |
| 23 | 22 | obj-$(CONFIG_USB_TRANCEVIBRATOR) += trancevibrator.o |
| @@ -75,6 +75,7 @@ struct adu_device { · 74 unmodified lines | ||
| 75 | 75 | char serial_number[8]; |
| 76 | 76 | |
| 77 | 77 | int open_count; /* number of times this port has been opened */ |
| 78 | + unsigned long disconnected:1; | |
| 78 | 79 | |
| 79 | 80 | char *read_buffer_primary; |
| 80 | 81 | int read_buffer_length; |
| @@ -116,7 +117,7 @@ static void adu_abort_transfers(struct adu_device *dev) · 35 unmodified lines | ||
| 116 | 117 | { |
| 117 | 118 | unsigned long flags; |
| 118 | 119 | |
| 119 | − if (dev->udev == NULL) | |
| 120 | + if (dev->disconnected) | |
| 120 | 121 | return; |
| 121 | 122 | |
| 122 | 123 | /* shutdown transfer */ |
| @@ -148,6 +149,7 @@ static void adu_delete(struct adu_device *dev) · 25 unmodified lines | ||
| 148 | 149 | kfree(dev->read_buffer_secondary); |
| 149 | 150 | kfree(dev->interrupt_in_buffer); |
| 150 | 151 | kfree(dev->interrupt_out_buffer); |
| 152 | + usb_put_dev(dev->udev); | |
| 151 | 153 | kfree(dev); |
| 152 | 154 | } |
| 153 | 155 | |
| @@ -243,7 +245,7 @@ static int adu_open(struct inode *inode, struct file *file) · 89 unmodified lines | ||
| 243 | 245 | } |
| 244 | 246 | |
| 245 | 247 | dev = usb_get_intfdata(interface); |
| 246 | − if (!dev || !dev->udev) { | |
| 248 | + if (!dev) { | |
| 247 | 249 | retval = -ENODEV; |
| 248 | 250 | goto exit_no_device; |
| 249 | 251 | } |
| @@ -326,7 +328,7 @@ static int adu_release(struct inode *inode, struct file *file) · 76 unmodified lines | ||
| 326 | 328 | } |
| 327 | 329 | |
| 328 | 330 | adu_release_internal(dev); |
| 329 | − if (dev->udev == NULL) { | |
| 331 | + if (dev->disconnected) { | |
| 330 | 332 | /* the device was unplugged before the file was released */ |
| 331 | 333 | if (!dev->open_count) /* ... and we're the last user */ |
| 332 | 334 | adu_delete(dev); |
| @@ -354,7 +356,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, · 21 unmodified lines | ||
| 354 | 356 | return -ERESTARTSYS; |
| 355 | 357 | |
| 356 | 358 | /* verify that the device wasn't unplugged */ |
| 357 | − if (dev->udev == NULL) { | |
| 359 | + if (dev->disconnected) { | |
| 358 | 360 | retval = -ENODEV; |
| 359 | 361 | pr_err("No device or device unplugged %d\n", retval); |
| 360 | 362 | goto exit; |
| @@ -518,7 +520,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, · 157 unmodified lines | ||
| 518 | 520 | goto exit_nolock; |
| 519 | 521 | |
| 520 | 522 | /* verify that the device wasn't unplugged */ |
| 521 | − if (dev->udev == NULL) { | |
| 523 | + if (dev->disconnected) { | |
| 522 | 524 | retval = -ENODEV; |
| 523 | 525 | pr_err("No device or device unplugged %d\n", retval); |
| 524 | 526 | goto exit; |
| @@ -663,7 +665,7 @@ static int adu_probe(struct usb_interface *interface, · 138 unmodified lines | ||
| 663 | 665 | |
| 664 | 666 | mutex_init(&dev->mtx); |
| 665 | 667 | spin_lock_init(&dev->buflock); |
| 666 | − dev->udev = udev; | |
| 668 | + dev->udev = usb_get_dev(udev); | |
| 667 | 669 | init_waitqueue_head(&dev->read_wait); |
| 668 | 670 | init_waitqueue_head(&dev->write_wait); |
| 669 | 671 | |
| @@ -762,14 +764,18 @@ static void adu_disconnect(struct usb_interface *interface) · 92 unmodified lines | ||
| 762 | 764 | |
| 763 | 765 | dev = usb_get_intfdata(interface); |
| 764 | 766 | |
| 765 | − mutex_lock(&dev->mtx); /* not interruptible */ | |
| 766 | − dev->udev = NULL; /* poison */ | |
| 767 | 767 | usb_deregister_dev(interface, &adu_class); |
| 768 | − mutex_unlock(&dev->mtx); | |
| 768 | + | |
| 769 | + usb_poison_urb(dev->interrupt_in_urb); | |
| 770 | + usb_poison_urb(dev->interrupt_out_urb); | |
| 769 | 771 | |
| 770 | 772 | mutex_lock(&adutux_mutex); |
| 771 | 773 | usb_set_intfdata(interface, NULL); |
| 772 | 774 | |
| 775 | + mutex_lock(&dev->mtx); /* not interruptible */ | |
| 776 | + dev->disconnected = 1; | |
| 777 | + mutex_unlock(&dev->mtx); | |
| 778 | + | |
| 773 | 779 | /* if the device is not opened, then we clean up right now */ |
| 774 | 780 | if (!dev->open_count) |
| 775 | 781 | adu_delete(dev); |
| @@ -98,6 +98,7 @@ static void chaoskey_free(struct chaoskey *dev) · 97 unmodified lines | ||
| 98 | 98 | usb_free_urb(dev->urb); |
| 99 | 99 | kfree(dev->name); |
| 100 | 100 | kfree(dev->buf); |
| 101 | + usb_put_intf(dev->interface); | |
| 101 | 102 | kfree(dev); |
| 102 | 103 | } |
| 103 | 104 | } |
| @@ -145,6 +146,8 @@ static int chaoskey_probe(struct usb_interface *interface, · 41 unmodified lines | ||
| 145 | 146 | if (dev == NULL) |
| 146 | 147 | goto out; |
| 147 | 148 | |
| 149 | + dev->interface = usb_get_intf(interface); | |
| 150 | + | |
| 148 | 151 | dev->buf = kmalloc(size, GFP_KERNEL); |
| 149 | 152 | |
| 150 | 153 | if (dev->buf == NULL) |
| @@ -174,8 +177,6 @@ static int chaoskey_probe(struct usb_interface *interface, · 23 unmodified lines | ||
| 174 | 177 | goto out; |
| 175 | 178 | } |
| 176 | 179 | |
| 177 | − dev->interface = interface; | |
| 178 | − | |
| 179 | 180 | dev->in_ep = in_ep; |
| 180 | 181 | |
| 181 | 182 | if (le16_to_cpu(udev->descriptor.idVendor) != ALEA_VENDOR_ID) |
| @@ -54,11 +54,7 @@ MODULE_AUTHOR(DRIVER_AUTHOR); · 53 unmodified lines | ||
| 54 | 54 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 55 | 55 | MODULE_LICENSE("GPL"); |
| 56 | 56 | |
| 57 | −/* Module parameters */ | |
| 58 | −static DEFINE_MUTEX(iowarrior_mutex); | |
| 59 | − | |
| 60 | 57 | static struct usb_driver iowarrior_driver; |
| 61 | −static DEFINE_MUTEX(iowarrior_open_disc_lock); | |
| 62 | 58 | |
| 63 | 59 | /*--------------*/ |
| 64 | 60 | /* data */ |
| @@ -87,6 +83,7 @@ struct iowarrior { · 22 unmodified lines | ||
| 87 | 83 | char chip_serial[9]; /* the serial number string of the chip connected */ |
| 88 | 84 | int report_size; /* number of bytes in a report */ |
| 89 | 85 | u16 product_id; |
| 86 | + struct usb_anchor submitted; | |
| 90 | 87 | }; |
| 91 | 88 | |
| 92 | 89 | /*--------------*/ |
| @@ -243,6 +240,7 @@ static inline void iowarrior_delete(struct iowarrior *dev) · 150 unmodified lines | ||
| 243 | 240 | kfree(dev->int_in_buffer); |
| 244 | 241 | usb_free_urb(dev->int_in_urb); |
| 245 | 242 | kfree(dev->read_queue); |
| 243 | + usb_put_intf(dev->interface); | |
| 246 | 244 | kfree(dev); |
| 247 | 245 | } |
| 248 | 246 | |
| @@ -424,11 +422,13 @@ static ssize_t iowarrior_write(struct file *file, · 175 unmodified lines | ||
| 424 | 422 | retval = -EFAULT; |
| 425 | 423 | goto error; |
| 426 | 424 | } |
| 425 | + usb_anchor_urb(int_out_urb, &dev->submitted); | |
| 427 | 426 | retval = usb_submit_urb(int_out_urb, GFP_KERNEL); |
| 428 | 427 | if (retval) { |
| 429 | 428 | dev_dbg(&dev->interface->dev, |
| 430 | 429 | "submit error %d for urb nr.%d\n", |
| 431 | 430 | retval, atomic_read(&dev->write_busy)); |
| 431 | + usb_unanchor_urb(int_out_urb); | |
| 432 | 432 | goto error; |
| 433 | 433 | } |
| 434 | 434 | /* submit was ok */ |
| @@ -477,8 +477,6 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, · 42 unmodified lines | ||
| 477 | 477 | if (!buffer) |
| 478 | 478 | return -ENOMEM; |
| 479 | 479 | |
| 480 | − /* lock this object */ | |
| 481 | − mutex_lock(&iowarrior_mutex); | |
| 482 | 480 | mutex_lock(&dev->mutex); |
| 483 | 481 | |
| 484 | 482 | /* verify that the device wasn't unplugged */ |
| @@ -571,7 +569,6 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, · 86 unmodified lines | ||
| 571 | 569 | error_out: |
| 572 | 570 | /* unlock the device */ |
| 573 | 571 | mutex_unlock(&dev->mutex); |
| 574 | − mutex_unlock(&iowarrior_mutex); | |
| 575 | 572 | kfree(buffer); |
| 576 | 573 | return retval; |
| 577 | 574 | } |
| @@ -586,27 +583,20 @@ static int iowarrior_open(struct inode *inode, struct file *file) · 8 unmodified lines | ||
| 586 | 583 | int subminor; |
| 587 | 584 | int retval = 0; |
| 588 | 585 | |
| 589 | − mutex_lock(&iowarrior_mutex); | |
| 590 | 586 | subminor = iminor(inode); |
| 591 | 587 | |
| 592 | 588 | interface = usb_find_interface(&iowarrior_driver, subminor); |
| 593 | 589 | if (!interface) { |
| 594 | − mutex_unlock(&iowarrior_mutex); | |
| 595 | − printk(KERN_ERR "%s - error, can't find device for minor %d\n", | |
| 590 | + pr_err("%s - error, can't find device for minor %d\n", | |
| 596 | 591 | __func__, subminor); |
| 597 | 592 | return -ENODEV; |
| 598 | 593 | } |
| 599 | 594 | |
| 600 | − mutex_lock(&iowarrior_open_disc_lock); | |
| 601 | 595 | dev = usb_get_intfdata(interface); |
| 602 | − if (!dev) { | |
| 603 | − mutex_unlock(&iowarrior_open_disc_lock); | |
| 604 | − mutex_unlock(&iowarrior_mutex); | |
| 596 | + if (!dev) | |
| 605 | 597 | return -ENODEV; |
| 606 | − } | |
| 607 | 598 | |
| 608 | 599 | mutex_lock(&dev->mutex); |
| 609 | − mutex_unlock(&iowarrior_open_disc_lock); | |
| 610 | 600 | |
| 611 | 601 | /* Only one process can open each device, no sharing. */ |
| 612 | 602 | if (dev->opened) { |
| @@ -628,7 +618,6 @@ static int iowarrior_open(struct inode *inode, struct file *file) · 15 unmodified lines | ||
| 628 | 618 | |
| 629 | 619 | out: |
| 630 | 620 | mutex_unlock(&dev->mutex); |
| 631 | − mutex_unlock(&iowarrior_mutex); | |
| 632 | 621 | return retval; |
| 633 | 622 | } |
| 634 | 623 | |
| @@ -764,11 +753,13 @@ static int iowarrior_probe(struct usb_interface *interface, · 129 unmodified lines | ||
| 764 | 753 | init_waitqueue_head(&dev->write_wait); |
| 765 | 754 | |
| 766 | 755 | dev->udev = udev; |
| 767 | − dev->interface = interface; | |
| 756 | + dev->interface = usb_get_intf(interface); | |
| 768 | 757 | |
| 769 | 758 | iface_desc = interface->cur_altsetting; |
| 770 | 759 | dev->product_id = le16_to_cpu(udev->descriptor.idProduct); |
| 771 | 760 | |
| 761 | + init_usb_anchor(&dev->submitted); | |
| 762 | + | |
| 772 | 763 | res = usb_find_last_int_in_endpoint(iface_desc, &dev->int_in_endpoint); |
| 773 | 764 | if (res) { |
| 774 | 765 | dev_err(&interface->dev, "no interrupt-in endpoint found\n"); |
| @@ -836,7 +827,6 @@ static int iowarrior_probe(struct usb_interface *interface, · 61 unmodified lines | ||
| 836 | 827 | if (retval) { |
| 837 | 828 | /* something prevented us from registering this driver */ |
| 838 | 829 | dev_err(&interface->dev, "Not able to get a minor for this device.\n"); |
| 839 | − usb_set_intfdata(interface, NULL); | |
| 840 | 830 | goto error; |
| 841 | 831 | } |
| 842 | 832 | |
| @@ -860,26 +850,15 @@ error: · 17 unmodified lines | ||
| 860 | 850 | */ |
| 861 | 851 | static void iowarrior_disconnect(struct usb_interface *interface) |
| 862 | 852 | { |
| 863 | − struct iowarrior *dev; | |
| 864 | − int minor; | |
| 865 | − | |
| 866 | − dev = usb_get_intfdata(interface); | |
| 867 | − mutex_lock(&iowarrior_open_disc_lock); | |
| 868 | − usb_set_intfdata(interface, NULL); | |
| 869 | − /* prevent device read, write and ioctl */ | |
| 870 | − dev->present = 0; | |
| 871 | − | |
| 872 | − minor = dev->minor; | |
| 873 | − mutex_unlock(&iowarrior_open_disc_lock); | |
| 874 | − /* give back our minor - this will call close() locks need to be dropped at this point*/ | |
| 853 | + struct iowarrior *dev = usb_get_intfdata(interface); | |
| 854 | + int minor = dev->minor; | |
| 875 | 855 | |
| 876 | 856 | usb_deregister_dev(interface, &iowarrior_class); |
| 877 | 857 | |
| 878 | 858 | mutex_lock(&dev->mutex); |
| 879 | 859 | |
| 880 | 860 | /* prevent device read, write and ioctl */ |
| 881 | − | |
| 882 | − mutex_unlock(&dev->mutex); | |
| 861 | + dev->present = 0; | |
| 883 | 862 | |
| 884 | 863 | if (dev->opened) { |
| 885 | 864 | /* There is a process that holds a filedescriptor to the device , |
| @@ -887,10 +866,13 @@ static void iowarrior_disconnect(struct usb_interface *interface) · 1 unmodified line | ||
| 887 | 866 | Deleting the device is postponed until close() was called. |
| 888 | 867 | */ |
| 889 | 868 | usb_kill_urb(dev->int_in_urb); |
| 869 | + usb_kill_anchored_urbs(&dev->submitted); | |
| 890 | 870 | wake_up_interruptible(&dev->read_wait); |
| 891 | 871 | wake_up_interruptible(&dev->write_wait); |
| 872 | + mutex_unlock(&dev->mutex); | |
| 892 | 873 | } else { |
| 893 | 874 | /* no process is using the device, cleanup now */ |
| 875 | + mutex_unlock(&dev->mutex); | |
| 894 | 876 | iowarrior_delete(dev); |
| 895 | 877 | } |
| 896 | 878 | |
| @@ -153,6 +153,7 @@ MODULE_PARM_DESC(min_interrupt_out_interval, "Minimum interrupt out interval in · 152 unmodified lines | ||
| 153 | 153 | struct ld_usb { |
| 154 | 154 | struct mutex mutex; /* locks this structure */ |
| 155 | 155 | struct usb_interface *intf; /* save off the usb interface pointer */ |
| 156 | + unsigned long disconnected:1; | |
| 156 | 157 | |
| 157 | 158 | int open_count; /* number of times this port has been opened */ |
| 158 | 159 | |
| @@ -192,12 +193,10 @@ static void ld_usb_abort_transfers(struct ld_usb *dev) · 33 unmodified lines | ||
| 192 | 193 | /* shutdown transfer */ |
| 193 | 194 | if (dev->interrupt_in_running) { |
| 194 | 195 | dev->interrupt_in_running = 0; |
| 195 | − if (dev->intf) | |
| 196 | − usb_kill_urb(dev->interrupt_in_urb); | |
| 196 | + usb_kill_urb(dev->interrupt_in_urb); | |
| 197 | 197 | } |
| 198 | 198 | if (dev->interrupt_out_busy) |
| 199 | − if (dev->intf) | |
| 200 | − usb_kill_urb(dev->interrupt_out_urb); | |
| 199 | + usb_kill_urb(dev->interrupt_out_urb); | |
| 201 | 200 | } |
| 202 | 201 | |
| 203 | 202 | /** |
| @@ -205,8 +204,6 @@ static void ld_usb_abort_transfers(struct ld_usb *dev) · 1 unmodified line | ||
| 205 | 204 | */ |
| 206 | 205 | static void ld_usb_delete(struct ld_usb *dev) |
| 207 | 206 | { |
| 208 | − ld_usb_abort_transfers(dev); | |
| 209 | − | |
| 210 | 207 | /* free data structures */ |
| 211 | 208 | usb_free_urb(dev->interrupt_in_urb); |
| 212 | 209 | usb_free_urb(dev->interrupt_out_urb); |
| @@ -263,7 +260,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) · 50 unmodified lines | ||
| 263 | 260 | |
| 264 | 261 | resubmit: |
| 265 | 262 | /* resubmit if we're still running */ |
| 266 | − if (dev->interrupt_in_running && !dev->buffer_overflow && dev->intf) { | |
| 263 | + if (dev->interrupt_in_running && !dev->buffer_overflow) { | |
| 267 | 264 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); |
| 268 | 265 | if (retval) { |
| 269 | 266 | dev_err(&dev->intf->dev, |
| @@ -392,7 +389,7 @@ static int ld_usb_release(struct inode *inode, struct file *file) · 122 unmodified lines | ||
| 392 | 389 | retval = -ENODEV; |
| 393 | 390 | goto unlock_exit; |
| 394 | 391 | } |
| 395 | − if (dev->intf == NULL) { | |
| 392 | + if (dev->disconnected) { | |
| 396 | 393 | /* the device was unplugged before the file was released */ |
| 397 | 394 | mutex_unlock(&dev->mutex); |
| 398 | 395 | /* unlock here as ld_usb_delete frees dev */ |
| @@ -423,7 +420,7 @@ static __poll_t ld_usb_poll(struct file *file, poll_table *wait) · 24 unmodified lines | ||
| 423 | 420 | |
| 424 | 421 | dev = file->private_data; |
| 425 | 422 | |
| 426 | − if (!dev->intf) | |
| 423 | + if (dev->disconnected) | |
| 427 | 424 | return EPOLLERR | EPOLLHUP; |
| 428 | 425 | |
| 429 | 426 | poll_wait(file, &dev->read_wait, wait); |
| @@ -462,7 +459,7 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, · 32 unmodified lines | ||
| 462 | 459 | } |
| 463 | 460 | |
| 464 | 461 | /* verify that the device wasn't unplugged */ |
| 465 | − if (dev->intf == NULL) { | |
| 462 | + if (dev->disconnected) { | |
| 466 | 463 | retval = -ENODEV; |
| 467 | 464 | printk(KERN_ERR "ldusb: No device or device unplugged %d\n", retval); |
| 468 | 465 | goto unlock_exit; |
| @@ -542,7 +539,7 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, · 73 unmodified lines | ||
| 542 | 539 | } |
| 543 | 540 | |
| 544 | 541 | /* verify that the device wasn't unplugged */ |
| 545 | − if (dev->intf == NULL) { | |
| 542 | + if (dev->disconnected) { | |
| 546 | 543 | retval = -ENODEV; |
| 547 | 544 | printk(KERN_ERR "ldusb: No device or device unplugged %d\n", retval); |
| 548 | 545 | goto unlock_exit; |
| @@ -764,6 +761,9 @@ static void ld_usb_disconnect(struct usb_interface *intf) · 215 unmodified lines | ||
| 764 | 761 | /* give back our minor */ |
| 765 | 762 | usb_deregister_dev(intf, &ld_usb_class); |
| 766 | 763 | |
| 764 | + usb_poison_urb(dev->interrupt_in_urb); | |
| 765 | + usb_poison_urb(dev->interrupt_out_urb); | |
| 766 | + | |
| 767 | 767 | mutex_lock(&dev->mutex); |
| 768 | 768 | |
| 769 | 769 | /* if the device is not opened, then we clean up right now */ |
| @@ -771,7 +771,7 @@ static void ld_usb_disconnect(struct usb_interface *intf) · 1 unmodified line | ||
| 771 | 771 | mutex_unlock(&dev->mutex); |
| 772 | 772 | ld_usb_delete(dev); |
| 773 | 773 | } else { |
| 774 | − dev->intf = NULL; | |
| 774 | + dev->disconnected = 1; | |
| 775 | 775 | /* wake up pollers */ |
| 776 | 776 | wake_up_interruptible_all(&dev->read_wait); |
| 777 | 777 | wake_up_interruptible_all(&dev->write_wait); |
| @@ -179,7 +179,6 @@ static const struct usb_device_id tower_table[] = { · 178 unmodified lines | ||
| 179 | 179 | }; |
| 180 | 180 | |
| 181 | 181 | MODULE_DEVICE_TABLE (usb, tower_table); |
| 182 | −static DEFINE_MUTEX(open_disc_mutex); | |
| 183 | 182 | |
| 184 | 183 | #define LEGO_USB_TOWER_MINOR_BASE 160 |
| 185 | 184 | |
| @@ -191,6 +190,7 @@ struct lego_usb_tower { · 5 unmodified lines | ||
| 191 | 190 | unsigned char minor; /* the starting minor number for this device */ |
| 192 | 191 | |
| 193 | 192 | int open_count; /* number of times this port has been opened */ |
| 193 | + unsigned long disconnected:1; | |
| 194 | 194 | |
| 195 | 195 | char* read_buffer; |
| 196 | 196 | size_t read_buffer_length; /* this much came in */ |
| @@ -290,14 +290,13 @@ static inline void lego_usb_tower_debug_data(struct device *dev, · 93 unmodified lines | ||
| 290 | 290 | */ |
| 291 | 291 | static inline void tower_delete (struct lego_usb_tower *dev) |
| 292 | 292 | { |
| 293 | − tower_abort_transfers (dev); | |
| 294 | − | |
| 295 | 293 | /* free data structures */ |
| 296 | 294 | usb_free_urb(dev->interrupt_in_urb); |
| 297 | 295 | usb_free_urb(dev->interrupt_out_urb); |
| 298 | 296 | kfree (dev->read_buffer); |
| 299 | 297 | kfree (dev->interrupt_in_buffer); |
| 300 | 298 | kfree (dev->interrupt_out_buffer); |
| 299 | + usb_put_dev(dev->udev); | |
| 301 | 300 | kfree (dev); |
| 302 | 301 | } |
| 303 | 302 | |
| @@ -332,18 +331,14 @@ static int tower_open (struct inode *inode, struct file *file) · 28 unmodified lines | ||
| 332 | 331 | goto exit; |
| 333 | 332 | } |
| 334 | 333 | |
| 335 | − mutex_lock(&open_disc_mutex); | |
| 336 | 334 | dev = usb_get_intfdata(interface); |
| 337 | − | |
| 338 | 335 | if (!dev) { |
| 339 | − mutex_unlock(&open_disc_mutex); | |
| 340 | 336 | retval = -ENODEV; |
| 341 | 337 | goto exit; |
| 342 | 338 | } |
| 343 | 339 | |
| 344 | 340 | /* lock this device */ |
| 345 | 341 | if (mutex_lock_interruptible(&dev->lock)) { |
| 346 | − mutex_unlock(&open_disc_mutex); | |
| 347 | 342 | retval = -ERESTARTSYS; |
| 348 | 343 | goto exit; |
| 349 | 344 | } |
| @@ -351,12 +346,9 @@ static int tower_open (struct inode *inode, struct file *file) · 1 unmodified line | ||
| 351 | 346 | |
| 352 | 347 | /* allow opening only once */ |
| 353 | 348 | if (dev->open_count) { |
| 354 | − mutex_unlock(&open_disc_mutex); | |
| 355 | 349 | retval = -EBUSY; |
| 356 | 350 | goto unlock_exit; |
| 357 | 351 | } |
| 358 | − dev->open_count = 1; | |
| 359 | − mutex_unlock(&open_disc_mutex); | |
| 360 | 352 | |
| 361 | 353 | /* reset the tower */ |
| 362 | 354 | result = usb_control_msg (dev->udev, |
| @@ -396,13 +388,14 @@ static int tower_open (struct inode *inode, struct file *file) · 33 unmodified lines | ||
| 396 | 388 | dev_err(&dev->udev->dev, |
| 397 | 389 | "Couldn't submit interrupt_in_urb %d\n", retval); |
| 398 | 390 | dev->interrupt_in_running = 0; |
| 399 | − dev->open_count = 0; | |
| 400 | 391 | goto unlock_exit; |
| 401 | 392 | } |
| 402 | 393 | |
| 403 | 394 | /* save device in the file's private structure */ |
| 404 | 395 | file->private_data = dev; |
| 405 | 396 | |
| 397 | + dev->open_count = 1; | |
| 398 | + | |
| 406 | 399 | unlock_exit: |
| 407 | 400 | mutex_unlock(&dev->lock); |
| 408 | 401 | |
| @@ -423,10 +416,9 @@ static int tower_release (struct inode *inode, struct file *file) · 14 unmodified lines | ||
| 423 | 416 | |
| 424 | 417 | if (dev == NULL) { |
| 425 | 418 | retval = -ENODEV; |
| 426 | − goto exit_nolock; | |
| 419 | + goto exit; | |
| 427 | 420 | } |
| 428 | 421 | |
| 429 | − mutex_lock(&open_disc_mutex); | |
| 430 | 422 | if (mutex_lock_interruptible(&dev->lock)) { |
| 431 | 423 | retval = -ERESTARTSYS; |
| 432 | 424 | goto exit; |
| @@ -438,7 +430,8 @@ static int tower_release (struct inode *inode, struct file *file) · 5 unmodified lines | ||
| 438 | 430 | retval = -ENODEV; |
| 439 | 431 | goto unlock_exit; |
| 440 | 432 | } |
| 441 | − if (dev->udev == NULL) { | |
| 433 | + | |
| 434 | + if (dev->disconnected) { | |
| 442 | 435 | /* the device was unplugged before the file was released */ |
| 443 | 436 | |
| 444 | 437 | /* unlock here as tower_delete frees dev */ |
| @@ -456,10 +449,7 @@ static int tower_release (struct inode *inode, struct file *file) · 11 unmodified lines | ||
| 456 | 449 | |
| 457 | 450 | unlock_exit: |
| 458 | 451 | mutex_unlock(&dev->lock); |
| 459 | − | |
| 460 | 452 | exit: |
| 461 | − mutex_unlock(&open_disc_mutex); | |
| 462 | −exit_nolock: | |
| 463 | 453 | return retval; |
| 464 | 454 | } |
| 465 | 455 | |
| @@ -477,10 +467,9 @@ static void tower_abort_transfers (struct lego_usb_tower *dev) · 11 unmodified lines | ||
| 477 | 467 | if (dev->interrupt_in_running) { |
| 478 | 468 | dev->interrupt_in_running = 0; |
| 479 | 469 | mb(); |
| 480 | − if (dev->udev) | |
| 481 | − usb_kill_urb (dev->interrupt_in_urb); | |
| 470 | + usb_kill_urb(dev->interrupt_in_urb); | |
| 482 | 471 | } |
| 483 | − if (dev->interrupt_out_busy && dev->udev) | |
| 472 | + if (dev->interrupt_out_busy) | |
| 484 | 473 | usb_kill_urb(dev->interrupt_out_urb); |
| 485 | 474 | } |
| 486 | 475 | |
| @@ -516,7 +505,7 @@ static __poll_t tower_poll (struct file *file, poll_table *wait) · 29 unmodified lines | ||
| 516 | 505 | |
| 517 | 506 | dev = file->private_data; |
| 518 | 507 | |
| 519 | − if (!dev->udev) | |
| 508 | + if (dev->disconnected) | |
| 520 | 509 | return EPOLLERR | EPOLLHUP; |
| 521 | 510 | |
| 522 | 511 | poll_wait(file, &dev->read_wait, wait); |
| @@ -563,7 +552,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, · 40 unmodified lines | ||
| 563 | 552 | } |
| 564 | 553 | |
| 565 | 554 | /* verify that the device wasn't unplugged */ |
| 566 | − if (dev->udev == NULL) { | |
| 555 | + if (dev->disconnected) { | |
| 567 | 556 | retval = -ENODEV; |
| 568 | 557 | pr_err("No device or device unplugged %d\n", retval); |
| 569 | 558 | goto unlock_exit; |
| @@ -649,7 +638,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t · 79 unmodified lines | ||
| 649 | 638 | } |
| 650 | 639 | |
| 651 | 640 | /* verify that the device wasn't unplugged */ |
| 652 | − if (dev->udev == NULL) { | |
| 641 | + if (dev->disconnected) { | |
| 653 | 642 | retval = -ENODEV; |
| 654 | 643 | pr_err("No device or device unplugged %d\n", retval); |
| 655 | 644 | goto unlock_exit; |
| @@ -759,7 +748,7 @@ static void tower_interrupt_in_callback (struct urb *urb) · 103 unmodified lines | ||
| 759 | 748 | |
| 760 | 749 | resubmit: |
| 761 | 750 | /* resubmit if we're still running */ |
| 762 | − if (dev->interrupt_in_running && dev->udev) { | |
| 751 | + if (dev->interrupt_in_running) { | |
| 763 | 752 | retval = usb_submit_urb (dev->interrupt_in_urb, GFP_ATOMIC); |
| 764 | 753 | if (retval) |
| 765 | 754 | dev_err(&dev->udev->dev, |
| @@ -822,8 +811,9 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device · 56 unmodified lines | ||
| 822 | 811 | |
| 823 | 812 | mutex_init(&dev->lock); |
| 824 | 813 | |
| 825 | − dev->udev = udev; | |
| 814 | + dev->udev = usb_get_dev(udev); | |
| 826 | 815 | dev->open_count = 0; |
| 816 | + dev->disconnected = 0; | |
| 827 | 817 | |
| 828 | 818 | dev->read_buffer = NULL; |
| 829 | 819 | dev->read_buffer_length = 0; |
| @@ -891,8 +881,10 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device · 61 unmodified lines | ||
| 891 | 881 | get_version_reply, |
| 892 | 882 | sizeof(*get_version_reply), |
| 893 | 883 | 1000); |
| 894 | − if (result < 0) { | |
| 895 | − dev_err(idev, "LEGO USB Tower get version control request failed\n"); | |
| 884 | + if (result < sizeof(*get_version_reply)) { | |
| 885 | + if (result >= 0) | |
| 886 | + result = -EIO; | |
| 887 | + dev_err(idev, "get version request failed: %d\n", result); | |
| 896 | 888 | retval = result; |
| 897 | 889 | goto error; |
| 898 | 890 | } |
| @@ -910,7 +902,6 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device · 11 unmodified lines | ||
| 910 | 902 | if (retval) { |
| 911 | 903 | /* something prevented us from registering this driver */ |
| 912 | 904 | dev_err(idev, "Not able to get a minor for this device.\n"); |
| 913 | − usb_set_intfdata (interface, NULL); | |
| 914 | 905 | goto error; |
| 915 | 906 | } |
| 916 | 907 | dev->minor = interface->minor; |
| @@ -942,23 +933,24 @@ static void tower_disconnect (struct usb_interface *interface) · 25 unmodified lines | ||
| 942 | 933 | int minor; |
| 943 | 934 | |
| 944 | 935 | dev = usb_get_intfdata (interface); |
| 945 | − mutex_lock(&open_disc_mutex); | |
| 946 | − usb_set_intfdata (interface, NULL); | |
| 947 | 936 | |
| 948 | 937 | minor = dev->minor; |
| 949 | 938 | |
| 950 | − /* give back our minor */ | |
| 939 | + /* give back our minor and prevent further open() */ | |
| 951 | 940 | usb_deregister_dev (interface, &tower_class); |
| 952 | 941 | |
| 942 | + /* stop I/O */ | |
| 943 | + usb_poison_urb(dev->interrupt_in_urb); | |
| 944 | + usb_poison_urb(dev->interrupt_out_urb); | |
| 945 | + | |
| 953 | 946 | mutex_lock(&dev->lock); |
| 954 | − mutex_unlock(&open_disc_mutex); | |
| 955 | 947 | |
| 956 | 948 | /* if the device is not opened, then we clean up right now */ |
| 957 | 949 | if (!dev->open_count) { |
| 958 | 950 | mutex_unlock(&dev->lock); |
| 959 | 951 | tower_delete (dev); |
| 960 | 952 | } else { |
| 961 | − dev->udev = NULL; | |
| 953 | + dev->disconnected = 1; | |
| 962 | 954 | /* wake up pollers */ |
| 963 | 955 | wake_up_interruptible_all(&dev->read_wait); |
| 964 | 956 | wake_up_interruptible_all(&dev->write_wait); |
| @@ -1,554 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | −/* -*- linux-c -*- */ | |
| 3 | − | |
| 4 | −/* | |
| 5 | − * Driver for USB Rio 500 | |
| 6 | − * | |
| 7 | − * Cesar Miquel (miquel@df.uba.ar) | |
| 8 | − * | |
| 9 | − * based on hp_scanner.c by David E. Nelson (dnelson@jump.net) | |
| 10 | − * | |
| 11 | − * Based upon mouse.c (Brad Keryan) and printer.c (Michael Gee). | |
| 12 | − * | |
| 13 | − * Changelog: | |
| 14 | − * 30/05/2003 replaced lock/unlock kernel with up/down | |
| 15 | − * Daniele Bellucci bellucda@tiscali.it | |
| 16 | − * */ | |
| 17 | − | |
| 18 | −#include <linux/module.h> | |
| 19 | −#include <linux/kernel.h> | |
| 20 | −#include <linux/signal.h> | |
| 21 | −#include <linux/sched/signal.h> | |
| 22 | −#include <linux/mutex.h> | |
| 23 | −#include <linux/errno.h> | |
| 24 | −#include <linux/random.h> | |
| 25 | −#include <linux/poll.h> | |
| 26 | −#include <linux/slab.h> | |
| 27 | −#include <linux/spinlock.h> | |
| 28 | −#include <linux/usb.h> | |
| 29 | −#include <linux/wait.h> | |
| 30 | − | |
| 31 | −#include "rio500_usb.h" | |
| 32 | − | |
| 33 | −#define DRIVER_AUTHOR "Cesar Miquel <miquel@df.uba.ar>" | |
| 34 | −#define DRIVER_DESC "USB Rio 500 driver" | |
| 35 | − | |
| 36 | −#define RIO_MINOR 64 | |
| 37 | − | |
| 38 | −/* stall/wait timeout for rio */ | |
| 39 | −#define NAK_TIMEOUT (HZ) | |
| 40 | − | |
| 41 | −#define IBUF_SIZE 0x1000 | |
| 42 | − | |
| 43 | −/* Size of the rio buffer */ | |
| 44 | −#define OBUF_SIZE 0x10000 | |
| 45 | − | |
| 46 | −struct rio_usb_data { | |
| 47 | − struct usb_device *rio_dev; /* init: probe_rio */ | |
| 48 | − unsigned int ifnum; /* Interface number of the USB device */ | |
| 49 | − int isopen; /* nz if open */ | |
| 50 | − int present; /* Device is present on the bus */ | |
| 51 | − char *obuf, *ibuf; /* transfer buffers */ | |
| 52 | − char bulk_in_ep, bulk_out_ep; /* Endpoint assignments */ | |
| 53 | − wait_queue_head_t wait_q; /* for timeouts */ | |
| 54 | −}; | |
| 55 | − | |
| 56 | −static DEFINE_MUTEX(rio500_mutex); | |
| 57 | −static struct rio_usb_data rio_instance; | |
| 58 | − | |
| 59 | −static int open_rio(struct inode *inode, struct file *file) | |
| 60 | −{ | |
| 61 | − struct rio_usb_data *rio = &rio_instance; | |
| 62 | − | |
| 63 | − /* against disconnect() */ | |
| 64 | − mutex_lock(&rio500_mutex); | |
| 65 | − | |
| 66 | − if (rio->isopen || !rio->present) { | |
| 67 | − mutex_unlock(&rio500_mutex); | |
| 68 | − return -EBUSY; | |
| 69 | − } | |
| 70 | − rio->isopen = 1; | |
| 71 | − | |
| 72 | − init_waitqueue_head(&rio->wait_q); | |
| 73 | − | |
| 74 | − | |
| 75 | − dev_info(&rio->rio_dev->dev, "Rio opened.\n"); | |
| 76 | − mutex_unlock(&rio500_mutex); | |
| 77 | − | |
| 78 | − return 0; | |
| 79 | −} | |
| 80 | − | |
| 81 | −static int close_rio(struct inode *inode, struct file *file) | |
| 82 | −{ | |
| 83 | − struct rio_usb_data *rio = &rio_instance; | |
| 84 | − | |
| 85 | − /* against disconnect() */ | |
| 86 | − mutex_lock(&rio500_mutex); | |
| 87 | − | |
| 88 | − rio->isopen = 0; | |
| 89 | − if (!rio->present) { | |
| 90 | − /* cleanup has been delayed */ | |
| 91 | − kfree(rio->ibuf); | |
| 92 | − kfree(rio->obuf); | |
| 93 | − rio->ibuf = NULL; | |
| 94 | − rio->obuf = NULL; | |
| 95 | − } else { | |
| 96 | − dev_info(&rio->rio_dev->dev, "Rio closed.\n"); | |
| 97 | − } | |
| 98 | − mutex_unlock(&rio500_mutex); | |
| 99 | − return 0; | |
| 100 | −} | |
| 101 | − | |
| 102 | −static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |
| 103 | −{ | |
| 104 | − struct RioCommand rio_cmd; | |
| 105 | − struct rio_usb_data *rio = &rio_instance; | |
| 106 | − void __user *data; | |
| 107 | − unsigned char *buffer; | |
| 108 | − int result, requesttype; | |
| 109 | − int retries; | |
| 110 | − int retval=0; | |
| 111 | − | |
| 112 | − mutex_lock(&rio500_mutex); | |
| 113 | − /* Sanity check to make sure rio is connected, powered, etc */ | |
| 114 | − if (rio->present == 0 || rio->rio_dev == NULL) { | |
| 115 | − retval = -ENODEV; | |
| 116 | − goto err_out; | |
| 117 | − } | |
| 118 | − | |
| 119 | − switch (cmd) { | |
| 120 | − case RIO_RECV_COMMAND: | |
| 121 | − data = (void __user *) arg; | |
| 122 | − if (data == NULL) | |
| 123 | − break; | |
| 124 | − if (copy_from_user(&rio_cmd, data, sizeof(struct RioCommand))) { | |
| 125 | − retval = -EFAULT; | |
| 126 | − goto err_out; | |
| 127 | − } | |
| 128 | − if (rio_cmd.length < 0 || rio_cmd.length > PAGE_SIZE) { | |
| 129 | − retval = -EINVAL; | |
| 130 | − goto err_out; | |
| 131 | − } | |
| 132 | − buffer = (unsigned char *) __get_free_page(GFP_KERNEL); | |
| 133 | − if (buffer == NULL) { | |
| 134 | − retval = -ENOMEM; | |
| 135 | − goto err_out; | |
| 136 | − } | |
| 137 | − if (copy_from_user(buffer, rio_cmd.buffer, rio_cmd.length)) { | |
| 138 | − retval = -EFAULT; | |
| 139 | − free_page((unsigned long) buffer); | |
| 140 | − goto err_out; | |
| 141 | − } | |
| 142 | − | |
| 143 | − requesttype = rio_cmd.requesttype | USB_DIR_IN | | |
| 144 | − USB_TYPE_VENDOR | USB_RECIP_DEVICE; | |
| 145 | − dev_dbg(&rio->rio_dev->dev, | |
| 146 | − "sending command:reqtype=%0x req=%0x value=%0x index=%0x len=%0x\n", | |
| 147 | − requesttype, rio_cmd.request, rio_cmd.value, | |
| 148 | − rio_cmd.index, rio_cmd.length); | |
| 149 | − /* Send rio control message */ | |
| 150 | − retries = 3; | |
| 151 | − while (retries) { | |
| 152 | − result = usb_control_msg(rio->rio_dev, | |
| 153 | − usb_rcvctrlpipe(rio-> rio_dev, 0), | |
| 154 | − rio_cmd.request, | |
| 155 | − requesttype, | |
| 156 | − rio_cmd.value, | |
| 157 | − rio_cmd.index, buffer, | |
| 158 | − rio_cmd.length, | |
| 159 | − jiffies_to_msecs(rio_cmd.timeout)); | |
| 160 | − if (result == -ETIMEDOUT) | |
| 161 | − retries--; | |
| 162 | − else if (result < 0) { | |
| 163 | − dev_err(&rio->rio_dev->dev, | |
| 164 | − "Error executing ioctrl. code = %d\n", | |
| 165 | − result); | |
| 166 | − retries = 0; | |
| 167 | − } else { | |
| 168 | − dev_dbg(&rio->rio_dev->dev, | |
| 169 | − "Executed ioctl. Result = %d (data=%02x)\n", | |
| 170 | − result, buffer[0]); | |
| 171 | − if (copy_to_user(rio_cmd.buffer, buffer, | |
| 172 | − rio_cmd.length)) { | |
| 173 | − free_page((unsigned long) buffer); | |
| 174 | − retval = -EFAULT; | |
| 175 | − goto err_out; | |
| 176 | − } | |
| 177 | − retries = 0; | |
| 178 | − } | |
| 179 | − | |
| 180 | − /* rio_cmd.buffer contains a raw stream of single byte | |
| 181 | − data which has been returned from rio. Data is | |
| 182 | − interpreted at application level. For data that | |
| 183 | − will be cast to data types longer than 1 byte, data | |
| 184 | − will be little_endian and will potentially need to | |
| 185 | − be swapped at the app level */ | |
| 186 | − | |
| 187 | − } | |
| 188 | − free_page((unsigned long) buffer); | |
| 189 | − break; | |
| 190 | − | |
| 191 | − case RIO_SEND_COMMAND: | |
| 192 | − data = (void __user *) arg; | |
| 193 | − if (data == NULL) | |
| 194 | − break; | |
| 195 | − if (copy_from_user(&rio_cmd, data, sizeof(struct RioCommand))) { | |
| 196 | − retval = -EFAULT; | |
| 197 | − goto err_out; | |
| 198 | − } | |
| 199 | − if (rio_cmd.length < 0 || rio_cmd.length > PAGE_SIZE) { | |
| 200 | − retval = -EINVAL; | |
| 201 | − goto err_out; | |
| 202 | − } | |
| 203 | − buffer = (unsigned char *) __get_free_page(GFP_KERNEL); | |
| 204 | − if (buffer == NULL) { | |
| 205 | − retval = -ENOMEM; | |
| 206 | − goto err_out; | |
| 207 | − } | |
| 208 | − if (copy_from_user(buffer, rio_cmd.buffer, rio_cmd.length)) { | |
| 209 | − free_page((unsigned long)buffer); | |
| 210 | − retval = -EFAULT; | |
| 211 | − goto err_out; | |
| 212 | − } | |
| 213 | − | |
| 214 | − requesttype = rio_cmd.requesttype | USB_DIR_OUT | | |
| 215 | − USB_TYPE_VENDOR | USB_RECIP_DEVICE; | |
| 216 | − dev_dbg(&rio->rio_dev->dev, | |
| 217 | − "sending command: reqtype=%0x req=%0x value=%0x index=%0x len=%0x\n", | |
| 218 | − requesttype, rio_cmd.request, rio_cmd.value, | |
| 219 | − rio_cmd.index, rio_cmd.length); | |
| 220 | − /* Send rio control message */ | |
| 221 | − retries = 3; | |
| 222 | − while (retries) { | |
| 223 | − result = usb_control_msg(rio->rio_dev, | |
| 224 | − usb_sndctrlpipe(rio-> rio_dev, 0), | |
| 225 | − rio_cmd.request, | |
| 226 | − requesttype, | |
| 227 | − rio_cmd.value, | |
| 228 | − rio_cmd.index, buffer, | |
| 229 | − rio_cmd.length, | |
| 230 | − jiffies_to_msecs(rio_cmd.timeout)); | |
| 231 | − if (result == -ETIMEDOUT) | |
| 232 | − retries--; | |
| 233 | − else if (result < 0) { | |
| 234 | − dev_err(&rio->rio_dev->dev, | |
| 235 | − "Error executing ioctrl. code = %d\n", | |
| 236 | − result); | |
| 237 | − retries = 0; | |
| 238 | − } else { | |
| 239 | − dev_dbg(&rio->rio_dev->dev, | |
| 240 | − "Executed ioctl. Result = %d\n", result); | |
| 241 | − retries = 0; | |
| 242 | − | |
| 243 | − } | |
| 244 | − | |
| 245 | − } | |
| 246 | − free_page((unsigned long) buffer); | |
| 247 | − break; | |
| 248 | − | |
| 249 | − default: | |
| 250 | − retval = -ENOTTY; | |
| 251 | − break; | |
| 252 | − } | |
| 253 | − | |
| 254 | − | |
| 255 | −err_out: | |
| 256 | − mutex_unlock(&rio500_mutex); | |
| 257 | − return retval; | |
| 258 | −} | |
| 259 | − | |
| 260 | −static ssize_t | |
| 261 | −write_rio(struct file *file, const char __user *buffer, | |
| 262 | − size_t count, loff_t * ppos) | |
| 263 | −{ | |
| 264 | − DEFINE_WAIT(wait); | |
| 265 | − struct rio_usb_data *rio = &rio_instance; | |
| 266 | − | |
| 267 | − unsigned long copy_size; | |
| 268 | − unsigned long bytes_written = 0; | |
| 269 | − unsigned int partial; | |
| 270 | − | |
| 271 | − int result = 0; | |
| 272 | − int maxretry; | |
| 273 | − int errn = 0; | |
| 274 | − int intr; | |
| 275 | − | |
| 276 | − intr = mutex_lock_interruptible(&rio500_mutex); | |
| 277 | − if (intr) | |
| 278 | − return -EINTR; | |
| 279 | − /* Sanity check to make sure rio is connected, powered, etc */ | |
| 280 | − if (rio->present == 0 || rio->rio_dev == NULL) { | |
| 281 | − mutex_unlock(&rio500_mutex); | |
| 282 | − return -ENODEV; | |
| 283 | − } | |
| 284 | − | |
| 285 | − | |
| 286 | − | |
| 287 | − do { | |
| 288 | − unsigned long thistime; | |
| 289 | − char *obuf = rio->obuf; | |
| 290 | − | |
| 291 | − thistime = copy_size = | |
| 292 | − (count >= OBUF_SIZE) ? OBUF_SIZE : count; | |
| 293 | − if (copy_from_user(rio->obuf, buffer, copy_size)) { | |
| 294 | − errn = -EFAULT; | |
| 295 | − goto error; | |
| 296 | − } | |
| 297 | − maxretry = 5; | |
| 298 | − while (thistime) { | |
| 299 | − if (!rio->rio_dev) { | |
| 300 | − errn = -ENODEV; | |
| 301 | − goto error; | |
| 302 | − } | |
| 303 | − if (signal_pending(current)) { | |
| 304 | − mutex_unlock(&rio500_mutex); | |
| 305 | − return bytes_written ? bytes_written : -EINTR; | |
| 306 | − } | |
| 307 | − | |
| 308 | − result = usb_bulk_msg(rio->rio_dev, | |
| 309 | − usb_sndbulkpipe(rio->rio_dev, 2), | |
| 310 | − obuf, thistime, &partial, 5000); | |
| 311 | − | |
| 312 | − dev_dbg(&rio->rio_dev->dev, | |
| 313 | − "write stats: result:%d thistime:%lu partial:%u\n", | |
| 314 | − result, thistime, partial); | |
| 315 | − | |
| 316 | − if (result == -ETIMEDOUT) { /* NAK - so hold for a while */ | |
| 317 | − if (!maxretry--) { | |
| 318 | − errn = -ETIME; | |
| 319 | − goto error; | |
| 320 | − } | |
| 321 | − prepare_to_wait(&rio->wait_q, &wait, TASK_INTERRUPTIBLE); | |
| 322 | − schedule_timeout(NAK_TIMEOUT); | |
| 323 | − finish_wait(&rio->wait_q, &wait); | |
| 324 | − continue; | |
| 325 | − } else if (!result && partial) { | |
| 326 | − obuf += partial; | |
| 327 | − thistime -= partial; | |
| 328 | − } else | |
| 329 | − break; | |
| 330 | − } | |
| 331 | − if (result) { | |
| 332 | − dev_err(&rio->rio_dev->dev, "Write Whoops - %x\n", | |
| 333 | − result); | |
| 334 | − errn = -EIO; | |
| 335 | − goto error; | |
| 336 | − } | |
| 337 | − bytes_written += copy_size; | |
| 338 | − count -= copy_size; | |
| 339 | − buffer += copy_size; | |
| 340 | − } while (count > 0); | |
| 341 | − | |
| 342 | − mutex_unlock(&rio500_mutex); | |
| 343 | − | |
| 344 | − return bytes_written ? bytes_written : -EIO; | |
| 345 | − | |
| 346 | −error: | |
| 347 | − mutex_unlock(&rio500_mutex); | |
| 348 | − return errn; | |
| 349 | −} | |
| 350 | − | |
| 351 | −static ssize_t | |
| 352 | −read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) | |
| 353 | −{ | |
| 354 | − DEFINE_WAIT(wait); | |
| 355 | − struct rio_usb_data *rio = &rio_instance; | |
| 356 | − ssize_t read_count; | |
| 357 | − unsigned int partial; | |
| 358 | − int this_read; | |
| 359 | − int result; | |
| 360 | − int maxretry = 10; | |
| 361 | − char *ibuf; | |
| 362 | − int intr; | |
| 363 | − | |
| 364 | − intr = mutex_lock_interruptible(&rio500_mutex); | |
| 365 | − if (intr) | |
| 366 | − return -EINTR; | |
| 367 | − /* Sanity check to make sure rio is connected, powered, etc */ | |
| 368 | − if (rio->present == 0 || rio->rio_dev == NULL) { | |
| 369 | − mutex_unlock(&rio500_mutex); | |
| 370 | − return -ENODEV; | |
| 371 | − } | |
| 372 | − | |
| 373 | − ibuf = rio->ibuf; | |
| 374 | − | |
| 375 | − read_count = 0; | |
| 376 | − | |
| 377 | − | |
| 378 | − while (count > 0) { | |
| 379 | − if (signal_pending(current)) { | |
| 380 | − mutex_unlock(&rio500_mutex); | |
| 381 | − return read_count ? read_count : -EINTR; | |
| 382 | − } | |
| 383 | − if (!rio->rio_dev) { | |
| 384 | − mutex_unlock(&rio500_mutex); | |
| 385 | − return -ENODEV; | |
| 386 | − } | |
| 387 | − this_read = (count >= IBUF_SIZE) ? IBUF_SIZE : count; | |
| 388 | − | |
| 389 | − result = usb_bulk_msg(rio->rio_dev, | |
| 390 | − usb_rcvbulkpipe(rio->rio_dev, 1), | |
| 391 | − ibuf, this_read, &partial, | |
| 392 | − 8000); | |
| 393 | − | |
| 394 | − dev_dbg(&rio->rio_dev->dev, | |
| 395 | − "read stats: result:%d this_read:%u partial:%u\n", | |
| 396 | − result, this_read, partial); | |
| 397 | − | |
| 398 | − if (partial) { | |
| 399 | − count = this_read = partial; | |
| 400 | − } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15 ??? */ | |
| 401 | − if (!maxretry--) { | |
| 402 | − mutex_unlock(&rio500_mutex); | |
| 403 | − dev_err(&rio->rio_dev->dev, | |
| 404 | − "read_rio: maxretry timeout\n"); | |
| 405 | − return -ETIME; | |
| 406 | − } | |
| 407 | − prepare_to_wait(&rio->wait_q, &wait, TASK_INTERRUPTIBLE); | |
| 408 | − schedule_timeout(NAK_TIMEOUT); | |
| 409 | − finish_wait(&rio->wait_q, &wait); | |
| 410 | − continue; | |
| 411 | − } else if (result != -EREMOTEIO) { | |
| 412 | − mutex_unlock(&rio500_mutex); | |
| 413 | − dev_err(&rio->rio_dev->dev, | |
| 414 | − "Read Whoops - result:%d partial:%u this_read:%u\n", | |
| 415 | − result, partial, this_read); | |
| 416 | − return -EIO; | |
| 417 | − } else { | |
| 418 | − mutex_unlock(&rio500_mutex); | |
| 419 | − return (0); | |
| 420 | − } | |
| 421 | − | |
| 422 | − if (this_read) { | |
| 423 | − if (copy_to_user(buffer, ibuf, this_read)) { | |
| 424 | − mutex_unlock(&rio500_mutex); | |
| 425 | − return -EFAULT; | |
| 426 | − } | |
| 427 | − count -= this_read; | |
| 428 | − read_count += this_read; | |
| 429 | − buffer += this_read; | |
| 430 | − } | |
| 431 | − } | |
| 432 | − mutex_unlock(&rio500_mutex); | |
| 433 | − return read_count; | |
| 434 | −} | |
| 435 | − | |
| 436 | −static const struct file_operations usb_rio_fops = { | |
| 437 | − .owner = THIS_MODULE, | |
| 438 | − .read = read_rio, | |
| 439 | − .write = write_rio, | |
| 440 | − .unlocked_ioctl = ioctl_rio, | |
| 441 | − .open = open_rio, | |
| 442 | − .release = close_rio, | |
| 443 | − .llseek = noop_llseek, | |
| 444 | −}; | |
| 445 | − | |
| 446 | −static struct usb_class_driver usb_rio_class = { | |
| 447 | − .name = "rio500%d", | |
| 448 | − .fops = &usb_rio_fops, | |
| 449 | − .minor_base = RIO_MINOR, | |
| 450 | −}; | |
| 451 | − | |
| 452 | −static int probe_rio(struct usb_interface *intf, | |
| 453 | − const struct usb_device_id *id) | |
| 454 | −{ | |
| 455 | − struct usb_device *dev = interface_to_usbdev(intf); | |
| 456 | − struct rio_usb_data *rio = &rio_instance; | |
| 457 | − int retval = -ENOMEM; | |
| 458 | − char *ibuf, *obuf; | |
| 459 | − | |
| 460 | − if (rio->present) { | |
| 461 | − dev_info(&intf->dev, "Second USB Rio at address %d refused\n", dev->devnum); | |
| 462 | − return -EBUSY; | |
| 463 | − } | |
| 464 | − dev_info(&intf->dev, "USB Rio found at address %d\n", dev->devnum); | |
| 465 | − | |
| 466 | − obuf = kmalloc(OBUF_SIZE, GFP_KERNEL); | |
| 467 | − if (!obuf) { | |
| 468 | − dev_err(&dev->dev, | |
| 469 | − "probe_rio: Not enough memory for the output buffer\n"); | |
| 470 | − goto err_obuf; | |
| 471 | − } | |
| 472 | − dev_dbg(&intf->dev, "obuf address: %p\n", obuf); | |
| 473 | − | |
| 474 | − ibuf = kmalloc(IBUF_SIZE, GFP_KERNEL); | |
| 475 | − if (!ibuf) { | |
| 476 | − dev_err(&dev->dev, | |
| 477 | − "probe_rio: Not enough memory for the input buffer\n"); | |
| 478 | − goto err_ibuf; | |
| 479 | − } | |
| 480 | − dev_dbg(&intf->dev, "ibuf address: %p\n", ibuf); | |
| 481 | − | |
| 482 | − mutex_lock(&rio500_mutex); | |
| 483 | − rio->rio_dev = dev; | |
| 484 | − rio->ibuf = ibuf; | |
| 485 | − rio->obuf = obuf; | |
| 486 | − rio->present = 1; | |
| 487 | − mutex_unlock(&rio500_mutex); | |
| 488 | − | |
| 489 | − retval = usb_register_dev(intf, &usb_rio_class); | |
| 490 | − if (retval) { | |
| 491 | − dev_err(&dev->dev, | |
| 492 | − "Not able to get a minor for this device.\n"); | |
| 493 | − goto err_register; | |
| 494 | − } | |
| 495 | − | |
| 496 | − usb_set_intfdata(intf, rio); | |
| 497 | − return retval; | |
| 498 | − | |
| 499 | − err_register: | |
| 500 | − mutex_lock(&rio500_mutex); | |
| 501 | − rio->present = 0; | |
| 502 | − mutex_unlock(&rio500_mutex); | |
| 503 | − err_ibuf: | |
| 504 | − kfree(obuf); | |
| 505 | − err_obuf: | |
| 506 | − return retval; | |
| 507 | −} | |
| 508 | − | |
| 509 | −static void disconnect_rio(struct usb_interface *intf) | |
| 510 | −{ | |
| 511 | − struct rio_usb_data *rio = usb_get_intfdata (intf); | |
| 512 | − | |
| 513 | − usb_set_intfdata (intf, NULL); | |
| 514 | − if (rio) { | |
| 515 | − usb_deregister_dev(intf, &usb_rio_class); | |
| 516 | − | |
| 517 | − mutex_lock(&rio500_mutex); | |
| 518 | − if (rio->isopen) { | |
| 519 | − rio->isopen = 0; | |
| 520 | − /* better let it finish - the release will do whats needed */ | |
| 521 | − rio->rio_dev = NULL; | |
| 522 | − mutex_unlock(&rio500_mutex); | |
| 523 | − return; | |
| 524 | − } | |
| 525 | − kfree(rio->ibuf); | |
| 526 | − kfree(rio->obuf); | |
| 527 | − | |
| 528 | − dev_info(&intf->dev, "USB Rio disconnected.\n"); | |
| 529 | − | |
| 530 | − rio->present = 0; | |
| 531 | − mutex_unlock(&rio500_mutex); | |
| 532 | − } | |
| 533 | −} | |
| 534 | − | |
| 535 | −static const struct usb_device_id rio_table[] = { | |
| 536 | − { USB_DEVICE(0x0841, 1) }, /* Rio 500 */ | |
| 537 | − { } /* Terminating entry */ | |
| 538 | −}; | |
| 539 | − | |
| 540 | −MODULE_DEVICE_TABLE (usb, rio_table); | |
| 541 | − | |
| 542 | −static struct usb_driver rio_driver = { | |
| 543 | − .name = "rio500", | |
| 544 | − .probe = probe_rio, | |
| 545 | − .disconnect = disconnect_rio, | |
| 546 | − .id_table = rio_table, | |
| 547 | −}; | |
| 548 | − | |
| 549 | −module_usb_driver(rio_driver); | |
| 550 | − | |
| 551 | −MODULE_AUTHOR( DRIVER_AUTHOR ); | |
| 552 | −MODULE_DESCRIPTION( DRIVER_DESC ); | |
| 553 | −MODULE_LICENSE("GPL"); | |
| 554 | − | |
| @@ -1,20 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | −/* ---------------------------------------------------------------------- | |
| 3 | − Copyright (C) 2000 Cesar Miquel (miquel@df.uba.ar) | |
| 4 | − ---------------------------------------------------------------------- */ | |
| 5 | − | |
| 6 | −#define RIO_SEND_COMMAND 0x1 | |
| 7 | −#define RIO_RECV_COMMAND 0x2 | |
| 8 | − | |
| 9 | −#define RIO_DIR_OUT 0x0 | |
| 10 | −#define RIO_DIR_IN 0x1 | |
| 11 | − | |
| 12 | −struct RioCommand { | |
| 13 | − short length; | |
| 14 | − int request; | |
| 15 | − int requesttype; | |
| 16 | − int value; | |
| 17 | − int index; | |
| 18 | − void __user *buffer; | |
| 19 | − int timeout; | |
| 20 | −}; | |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/slab.h> |
| 19 | 19 | #include <linux/errno.h> |
| 20 | 20 | #include <linux/mutex.h> |
| 21 | +#include <linux/rwsem.h> | |
| 21 | 22 | #include <linux/uaccess.h> |
| 22 | 23 | #include <linux/usb.h> |
| 23 | 24 | |
| @@ -29,16 +30,12 @@ · 5 unmodified lines | ||
| 29 | 30 | #define IOCTL_GET_DRV_VERSION 2 |
| 30 | 31 | |
| 31 | 32 | |
| 32 | −static DEFINE_MUTEX(lcd_mutex); | |
| 33 | 33 | static const struct usb_device_id id_table[] = { |
| 34 | 34 | { .idVendor = 0x10D2, .match_flags = USB_DEVICE_ID_MATCH_VENDOR, }, |
| 35 | 35 | { }, |
| 36 | 36 | }; |
| 37 | 37 | MODULE_DEVICE_TABLE(usb, id_table); |
| 38 | 38 | |
| 39 | −static DEFINE_MUTEX(open_disc_mutex); | |
| 40 | − | |
| 41 | − | |
| 42 | 39 | struct usb_lcd { |
| 43 | 40 | struct usb_device *udev; /* init: probe_lcd */ |
| 44 | 41 | struct usb_interface *interface; /* the interface for |
| @@ -57,6 +54,8 @@ struct usb_lcd { · 12 unmodified lines | ||
| 57 | 54 | using up all RAM */ |
| 58 | 55 | struct usb_anchor submitted; /* URBs to wait for |
| 59 | 56 | before suspend */ |
| 57 | + struct rw_semaphore io_rwsem; | |
| 58 | + unsigned long disconnected:1; | |
| 60 | 59 | }; |
| 61 | 60 | #define to_lcd_dev(d) container_of(d, struct usb_lcd, kref) |
| 62 | 61 | |
| @@ -81,40 +80,29 @@ static int lcd_open(struct inode *inode, struct file *file) · 18 unmodified lines | ||
| 81 | 80 | struct usb_interface *interface; |
| 82 | 81 | int subminor, r; |
| 83 | 82 | |
| 84 | − mutex_lock(&lcd_mutex); | |
| 85 | 83 | subminor = iminor(inode); |
| 86 | 84 | |
| 87 | 85 | interface = usb_find_interface(&lcd_driver, subminor); |
| 88 | 86 | if (!interface) { |
| 89 | − mutex_unlock(&lcd_mutex); | |
| 90 | − printk(KERN_ERR "USBLCD: %s - error, can't find device for minor %d\n", | |
| 87 | + pr_err("USBLCD: %s - error, can't find device for minor %d\n", | |
| 91 | 88 | __func__, subminor); |
| 92 | 89 | return -ENODEV; |
| 93 | 90 | } |
| 94 | 91 | |
| 95 | − mutex_lock(&open_disc_mutex); | |
| 96 | 92 | dev = usb_get_intfdata(interface); |
| 97 | − if (!dev) { | |
| 98 | − mutex_unlock(&open_disc_mutex); | |
| 99 | − mutex_unlock(&lcd_mutex); | |
| 100 | − return -ENODEV; | |
| 101 | − } | |
| 102 | 93 | |
| 103 | 94 | /* increment our usage count for the device */ |
| 104 | 95 | kref_get(&dev->kref); |
| 105 | − mutex_unlock(&open_disc_mutex); | |
| 106 | 96 | |
| 107 | 97 | /* grab a power reference */ |
| 108 | 98 | r = usb_autopm_get_interface(interface); |
| 109 | 99 | if (r < 0) { |
| 110 | 100 | kref_put(&dev->kref, lcd_delete); |
| 111 | − mutex_unlock(&lcd_mutex); | |
| 112 | 101 | return r; |
| 113 | 102 | } |
| 114 | 103 | |
| 115 | 104 | /* save our object in the file's private structure */ |
| 116 | 105 | file->private_data = dev; |
| 117 | − mutex_unlock(&lcd_mutex); | |
| 118 | 106 | |
| 119 | 107 | return 0; |
| 120 | 108 | } |
| @@ -142,6 +130,13 @@ static ssize_t lcd_read(struct file *file, char __user * buffer, · 21 unmodified lines | ||
| 142 | 130 | |
| 143 | 131 | dev = file->private_data; |
| 144 | 132 | |
| 133 | + down_read(&dev->io_rwsem); | |
| 134 | + | |
| 135 | + if (dev->disconnected) { | |
| 136 | + retval = -ENODEV; | |
| 137 | + goto out_up_io; | |
| 138 | + } | |
| 139 | + | |
| 145 | 140 | /* do a blocking bulk read to get data from the device */ |
| 146 | 141 | retval = usb_bulk_msg(dev->udev, |
| 147 | 142 | usb_rcvbulkpipe(dev->udev, |
| @@ -158,6 +153,9 @@ static ssize_t lcd_read(struct file *file, char __user * buffer, · 10 unmodified lines | ||
| 158 | 153 | retval = bytes_read; |
| 159 | 154 | } |
| 160 | 155 | |
| 156 | +out_up_io: | |
| 157 | + up_read(&dev->io_rwsem); | |
| 158 | + | |
| 161 | 159 | return retval; |
| 162 | 160 | } |
| 163 | 161 | |
| @@ -173,14 +171,12 @@ static long lcd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 9 unmodified lines | ||
| 173 | 171 | |
| 174 | 172 | switch (cmd) { |
| 175 | 173 | case IOCTL_GET_HARD_VERSION: |
| 176 | − mutex_lock(&lcd_mutex); | |
| 177 | 174 | bcdDevice = le16_to_cpu((dev->udev)->descriptor.bcdDevice); |
| 178 | 175 | sprintf(buf, "%1d%1d.%1d%1d", |
| 179 | 176 | (bcdDevice & 0xF000)>>12, |
| 180 | 177 | (bcdDevice & 0xF00)>>8, |
| 181 | 178 | (bcdDevice & 0xF0)>>4, |
| 182 | 179 | (bcdDevice & 0xF)); |
| 183 | − mutex_unlock(&lcd_mutex); | |
| 184 | 180 | if (copy_to_user((void __user *)arg, buf, strlen(buf)) != 0) |
| 185 | 181 | return -EFAULT; |
| 186 | 182 | break; |
| @@ -237,11 +233,18 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, · 50 unmodified lines | ||
| 237 | 233 | if (r < 0) |
| 238 | 234 | return -EINTR; |
| 239 | 235 | |
| 236 | + down_read(&dev->io_rwsem); | |
| 237 | + | |
| 238 | + if (dev->disconnected) { | |
| 239 | + retval = -ENODEV; | |
| 240 | + goto err_up_io; | |
| 241 | + } | |
| 242 | + | |
| 240 | 243 | /* create a urb, and a buffer for it, and copy the data to the urb */ |
| 241 | 244 | urb = usb_alloc_urb(0, GFP_KERNEL); |
| 242 | 245 | if (!urb) { |
| 243 | 246 | retval = -ENOMEM; |
| 244 | − goto err_no_buf; | |
| 247 | + goto err_up_io; | |
| 245 | 248 | } |
| 246 | 249 | |
| 247 | 250 | buf = usb_alloc_coherent(dev->udev, count, GFP_KERNEL, |
| @@ -278,6 +281,7 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, · 30 unmodified lines | ||
| 278 | 281 | the USB core will eventually free it entirely */ |
| 279 | 282 | usb_free_urb(urb); |
| 280 | 283 | |
| 284 | + up_read(&dev->io_rwsem); | |
| 281 | 285 | exit: |
| 282 | 286 | return count; |
| 283 | 287 | error_unanchor: |
| @@ -285,7 +289,8 @@ error_unanchor: · 1 unmodified line | ||
| 285 | 289 | error: |
| 286 | 290 | usb_free_coherent(dev->udev, count, buf, urb->transfer_dma); |
| 287 | 291 | usb_free_urb(urb); |
| 288 | −err_no_buf: | |
| 292 | +err_up_io: | |
| 293 | + up_read(&dev->io_rwsem); | |
| 289 | 294 | up(&dev->limit_sem); |
| 290 | 295 | return retval; |
| 291 | 296 | } |
| @@ -325,6 +330,7 @@ static int lcd_probe(struct usb_interface *interface, · 33 unmodified lines | ||
| 325 | 330 | |
| 326 | 331 | kref_init(&dev->kref); |
| 327 | 332 | sema_init(&dev->limit_sem, USB_LCD_CONCURRENT_WRITES); |
| 333 | + init_rwsem(&dev->io_rwsem); | |
| 328 | 334 | init_usb_anchor(&dev->submitted); |
| 329 | 335 | |
| 330 | 336 | dev->udev = usb_get_dev(interface_to_usbdev(interface)); |
| @@ -365,7 +371,6 @@ static int lcd_probe(struct usb_interface *interface, · 34 unmodified lines | ||
| 365 | 371 | /* something prevented us from registering this driver */ |
| 366 | 372 | dev_err(&interface->dev, |
| 367 | 373 | "Not able to get a minor for this device.\n"); |
| 368 | − usb_set_intfdata(interface, NULL); | |
| 369 | 374 | goto error; |
| 370 | 375 | } |
| 371 | 376 | |
| @@ -411,17 +416,18 @@ static int lcd_resume(struct usb_interface *intf) · 39 unmodified lines | ||
| 411 | 416 | |
| 412 | 417 | static void lcd_disconnect(struct usb_interface *interface) |
| 413 | 418 | { |
| 414 | − struct usb_lcd *dev; | |
| 419 | + struct usb_lcd *dev = usb_get_intfdata(interface); | |
| 415 | 420 | int minor = interface->minor; |
| 416 | 421 | |
| 417 | − mutex_lock(&open_disc_mutex); | |
| 418 | − dev = usb_get_intfdata(interface); | |
| 419 | − usb_set_intfdata(interface, NULL); | |
| 420 | − mutex_unlock(&open_disc_mutex); | |
| 421 | − | |
| 422 | 422 | /* give back our minor */ |
| 423 | 423 | usb_deregister_dev(interface, &lcd_class); |
| 424 | 424 | |
| 425 | + down_write(&dev->io_rwsem); | |
| 426 | + dev->disconnected = 1; | |
| 427 | + up_write(&dev->io_rwsem); | |
| 428 | + | |
| 429 | + usb_kill_anchored_urbs(&dev->submitted); | |
| 430 | + | |
| 425 | 431 | /* decrement our usage count */ |
| 426 | 432 | kref_put(&dev->kref, lcd_delete); |
| 427 | 433 | |
| @@ -60,6 +60,7 @@ struct usb_yurex { · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | struct kref kref; |
| 62 | 62 | struct mutex io_mutex; |
| 63 | + unsigned long disconnected:1; | |
| 63 | 64 | struct fasync_struct *async_queue; |
| 64 | 65 | wait_queue_head_t waitq; |
| 65 | 66 | |
| @@ -107,6 +108,7 @@ static void yurex_delete(struct kref *kref) · 41 unmodified lines | ||
| 107 | 108 | dev->int_buffer, dev->urb->transfer_dma); |
| 108 | 109 | usb_free_urb(dev->urb); |
| 109 | 110 | } |
| 111 | + usb_put_intf(dev->interface); | |
| 110 | 112 | usb_put_dev(dev->udev); |
| 111 | 113 | kfree(dev); |
| 112 | 114 | } |
| @@ -132,6 +134,7 @@ static void yurex_interrupt(struct urb *urb) · 19 unmodified lines | ||
| 132 | 134 | switch (status) { |
| 133 | 135 | case 0: /*success*/ |
| 134 | 136 | break; |
| 137 | + /* The device is terminated or messed up, give up */ | |
| 135 | 138 | case -EOVERFLOW: |
| 136 | 139 | dev_err(&dev->interface->dev, |
| 137 | 140 | "%s - overflow with length %d, actual length is %d\n", |
| @@ -140,12 +143,13 @@ static void yurex_interrupt(struct urb *urb) · 2 unmodified lines | ||
| 140 | 143 | case -ENOENT: |
| 141 | 144 | case -ESHUTDOWN: |
| 142 | 145 | case -EILSEQ: |
| 143 | − /* The device is terminated, clean up */ | |
| 146 | + case -EPROTO: | |
| 147 | + case -ETIME: | |
| 144 | 148 | return; |
| 145 | 149 | default: |
| 146 | 150 | dev_err(&dev->interface->dev, |
| 147 | 151 | "%s - unknown status received: %d\n", __func__, status); |
| 148 | − goto exit; | |
| 152 | + return; | |
| 149 | 153 | } |
| 150 | 154 | |
| 151 | 155 | /* handle received message */ |
| @@ -177,7 +181,6 @@ static void yurex_interrupt(struct urb *urb) · 25 unmodified lines | ||
| 177 | 181 | break; |
| 178 | 182 | } |
| 179 | 183 | |
| 180 | −exit: | |
| 181 | 184 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); |
| 182 | 185 | if (retval) { |
| 183 | 186 | dev_err(&dev->interface->dev, "%s - usb_submit_urb failed: %d\n", |
| @@ -204,7 +207,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ · 20 unmodified lines | ||
| 204 | 207 | init_waitqueue_head(&dev->waitq); |
| 205 | 208 | |
| 206 | 209 | dev->udev = usb_get_dev(interface_to_usbdev(interface)); |
| 207 | − dev->interface = interface; | |
| 210 | + dev->interface = usb_get_intf(interface); | |
| 208 | 211 | |
| 209 | 212 | /* set up the endpoint information */ |
| 210 | 213 | iface_desc = interface->cur_altsetting; |
| @@ -315,8 +318,9 @@ static void yurex_disconnect(struct usb_interface *interface) · 104 unmodified lines | ||
| 315 | 318 | |
| 316 | 319 | /* prevent more I/O from starting */ |
| 317 | 320 | usb_poison_urb(dev->urb); |
| 321 | + usb_poison_urb(dev->cntl_urb); | |
| 318 | 322 | mutex_lock(&dev->io_mutex); |
| 319 | − dev->interface = NULL; | |
| 323 | + dev->disconnected = 1; | |
| 320 | 324 | mutex_unlock(&dev->io_mutex); |
| 321 | 325 | |
| 322 | 326 | /* wakeup waiters */ |
| @@ -404,7 +408,7 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, · 81 unmodified lines | ||
| 404 | 408 | dev = file->private_data; |
| 405 | 409 | |
| 406 | 410 | mutex_lock(&dev->io_mutex); |
| 407 | − if (!dev->interface) { /* already disconnected */ | |
| 411 | + if (dev->disconnected) { /* already disconnected */ | |
| 408 | 412 | mutex_unlock(&dev->io_mutex); |
| 409 | 413 | return -ENODEV; |
| 410 | 414 | } |
| @@ -439,7 +443,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, · 28 unmodified lines | ||
| 439 | 443 | goto error; |
| 440 | 444 | |
| 441 | 445 | mutex_lock(&dev->io_mutex); |
| 442 | − if (!dev->interface) { /* already disconnected */ | |
| 446 | + if (dev->disconnected) { /* already disconnected */ | |
| 443 | 447 | mutex_unlock(&dev->io_mutex); |
| 444 | 448 | retval = -ENODEV; |
| 445 | 449 | goto error; |
| @@ -211,6 +211,7 @@ struct usbhs_priv; · 210 unmodified lines | ||
| 211 | 211 | /* DCPCTR */ |
| 212 | 212 | #define BSTS (1 << 15) /* Buffer Status */ |
| 213 | 213 | #define SUREQ (1 << 14) /* Sending SETUP Token */ |
| 214 | +#define INBUFM (1 << 14) /* (PIPEnCTR) Transfer Buffer Monitor */ | |
| 214 | 215 | #define CSSTS (1 << 12) /* CSSTS Status */ |
| 215 | 216 | #define ACLRM (1 << 9) /* Buffer Auto-Clear Mode */ |
| 216 | 217 | #define SQCLR (1 << 8) /* Toggle Bit Clear */ |
| @@ -89,7 +89,7 @@ static void __usbhsf_pkt_del(struct usbhs_pkt *pkt) · 88 unmodified lines | ||
| 89 | 89 | list_del_init(&pkt->node); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | −static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe) | |
| 92 | +struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe) | |
| 93 | 93 | { |
| 94 | 94 | return list_first_entry_or_null(&pipe->list, struct usbhs_pkt, node); |
| 95 | 95 | } |
| @@ -97,5 +97,6 @@ void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt, · 96 unmodified lines | ||
| 97 | 97 | void *buf, int len, int zero, int sequence); |
| 98 | 98 | struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt); |
| 99 | 99 | void usbhs_pkt_start(struct usbhs_pipe *pipe); |
| 100 | +struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe); | |
| 100 | 101 | |
| 101 | 102 | #endif /* RENESAS_USB_FIFO_H */ |
| @@ -722,8 +722,7 @@ static int __usbhsg_ep_set_halt_wedge(struct usb_ep *ep, int halt, int wedge) · 721 unmodified lines | ||
| 722 | 722 | struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); |
| 723 | 723 | struct device *dev = usbhsg_gpriv_to_dev(gpriv); |
| 724 | 724 | unsigned long flags; |
| 725 | − | |
| 726 | − usbhsg_pipe_disable(uep); | |
| 725 | + int ret = 0; | |
| 727 | 726 | |
| 728 | 727 | dev_dbg(dev, "set halt %d (pipe %d)\n", |
| 729 | 728 | halt, usbhs_pipe_number(pipe)); |
| @@ -731,6 +730,18 @@ static int __usbhsg_ep_set_halt_wedge(struct usb_ep *ep, int halt, int wedge) · 1 unmodified line | ||
| 731 | 730 | /******************** spin lock ********************/ |
| 732 | 731 | usbhs_lock(priv, flags); |
| 733 | 732 | |
| 733 | + /* | |
| 734 | + * According to usb_ep_set_halt()'s description, this function should | |
| 735 | + * return -EAGAIN if the IN endpoint has any queue or data. Note | |
| 736 | + * that the usbhs_pipe_is_dir_in() returns false if the pipe is an | |
| 737 | + * IN endpoint in the gadget mode. | |
| 738 | + */ | |
| 739 | + if (!usbhs_pipe_is_dir_in(pipe) && (__usbhsf_pkt_get(pipe) || | |
| 740 | + usbhs_pipe_contains_transmittable_data(pipe))) { | |
| 741 | + ret = -EAGAIN; | |
| 742 | + goto out; | |
| 743 | + } | |
| 744 | + | |
| 734 | 745 | if (halt) |
| 735 | 746 | usbhs_pipe_stall(pipe); |
| 736 | 747 | else |
| @@ -741,10 +752,11 @@ static int __usbhsg_ep_set_halt_wedge(struct usb_ep *ep, int halt, int wedge) · 4 unmodified lines | ||
| 741 | 752 | else |
| 742 | 753 | usbhsg_status_clr(gpriv, USBHSG_STATUS_WEDGE); |
| 743 | 754 | |
| 755 | +out: | |
| 744 | 756 | usbhs_unlock(priv, flags); |
| 745 | 757 | /******************** spin unlock ******************/ |
| 746 | 758 | |
| 747 | − return 0; | |
| 759 | + return ret; | |
| 748 | 760 | } |
| 749 | 761 | |
| 750 | 762 | static int usbhsg_ep_set_halt(struct usb_ep *ep, int value) |
| @@ -277,6 +277,21 @@ int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe) · 276 unmodified lines | ||
| 277 | 277 | return -EBUSY; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | +bool usbhs_pipe_contains_transmittable_data(struct usbhs_pipe *pipe) | |
| 281 | +{ | |
| 282 | + u16 val; | |
| 283 | + | |
| 284 | + /* Do not support for DCP pipe */ | |
| 285 | + if (usbhs_pipe_is_dcp(pipe)) | |
| 286 | + return false; | |
| 287 | + | |
| 288 | + val = usbhsp_pipectrl_get(pipe); | |
| 289 | + if (val & INBUFM) | |
| 290 | + return true; | |
| 291 | + | |
| 292 | + return false; | |
| 293 | +} | |
| 294 | + | |
| 280 | 295 | /* |
| 281 | 296 | * PID ctrl |
| 282 | 297 | */ |
| @@ -83,6 +83,7 @@ void usbhs_pipe_clear(struct usbhs_pipe *pipe); · 82 unmodified lines | ||
| 83 | 83 | void usbhs_pipe_clear_without_sequence(struct usbhs_pipe *pipe, |
| 84 | 84 | int needs_bfre, int bfre_enable); |
| 85 | 85 | int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe); |
| 86 | +bool usbhs_pipe_contains_transmittable_data(struct usbhs_pipe *pipe); | |
| 86 | 87 | void usbhs_pipe_enable(struct usbhs_pipe *pipe); |
| 87 | 88 | void usbhs_pipe_disable(struct usbhs_pipe *pipe); |
| 88 | 89 | void usbhs_pipe_stall(struct usbhs_pipe *pipe); |
| @@ -1030,6 +1030,9 @@ static const struct usb_device_id id_table_combined[] = { · 1029 unmodified lines | ||
| 1030 | 1030 | /* EZPrototypes devices */ |
| 1031 | 1031 | { USB_DEVICE(EZPROTOTYPES_VID, HJELMSLUND_USB485_ISO_PID) }, |
| 1032 | 1032 | { USB_DEVICE_INTERFACE_NUMBER(UNJO_VID, UNJO_ISODEBUG_V1_PID, 1) }, |
| 1033 | + /* Sienna devices */ | |
| 1034 | + { USB_DEVICE(FTDI_VID, FTDI_SIENNA_PID) }, | |
| 1035 | + { USB_DEVICE(ECHELON_VID, ECHELON_U20_PID) }, | |
| 1033 | 1036 | { } /* Terminating entry */ |
| 1034 | 1037 | }; |
| 1035 | 1038 | |
| @@ -39,6 +39,9 @@ · 38 unmodified lines | ||
| 39 | 39 | |
| 40 | 40 | #define FTDI_LUMEL_PD12_PID 0x6002 |
| 41 | 41 | |
| 42 | +/* Sienna Serial Interface by Secyourit GmbH */ | |
| 43 | +#define FTDI_SIENNA_PID 0x8348 | |
| 44 | + | |
| 42 | 45 | /* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */ |
| 43 | 46 | #define CYBER_CORTEX_AV_PID 0x8698 |
| 44 | 47 | |
| @@ -688,6 +691,12 @@ · 643 unmodified lines | ||
| 688 | 691 | #define BANDB_TTL3USB9M_PID 0xAC50 |
| 689 | 692 | #define BANDB_ZZ_PROG1_USB_PID 0xBA02 |
| 690 | 693 | |
| 694 | +/* | |
| 695 | + * Echelon USB Serial Interface | |
| 696 | + */ | |
| 697 | +#define ECHELON_VID 0x0920 | |
| 698 | +#define ECHELON_U20_PID 0x7500 | |
| 699 | + | |
| 691 | 700 | /* |
| 692 | 701 | * Intrepid Control Systems (http://www.intrepidcs.com/) ValueCAN and NeoVI |
| 693 | 702 | */ |
| @@ -1741,8 +1741,8 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint, · 1740 unmodified lines | ||
| 1741 | 1741 | |
| 1742 | 1742 | ep_desc = find_ep(serial, endpoint); |
| 1743 | 1743 | if (!ep_desc) { |
| 1744 | − /* leak the urb, something's wrong and the callers don't care */ | |
| 1745 | − return urb; | |
| 1744 | + usb_free_urb(urb); | |
| 1745 | + return NULL; | |
| 1746 | 1746 | } |
| 1747 | 1747 | if (usb_endpoint_xfer_int(ep_desc)) { |
| 1748 | 1748 | ep_type_name = "INT"; |
| @@ -419,6 +419,7 @@ static void option_instat_callback(struct urb *urb); · 418 unmodified lines | ||
| 419 | 419 | #define CINTERION_PRODUCT_PH8_AUDIO 0x0083 |
| 420 | 420 | #define CINTERION_PRODUCT_AHXX_2RMNET 0x0084 |
| 421 | 421 | #define CINTERION_PRODUCT_AHXX_AUDIO 0x0085 |
| 422 | +#define CINTERION_PRODUCT_CLS8 0x00b0 | |
| 422 | 423 | |
| 423 | 424 | /* Olivetti products */ |
| 424 | 425 | #define OLIVETTI_VENDOR_ID 0x0b3c |
| @@ -1154,6 +1155,14 @@ static const struct usb_device_id option_ids[] = { · 729 unmodified lines | ||
| 1154 | 1155 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, |
| 1155 | 1156 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff), |
| 1156 | 1157 | .driver_info = RSVD(0) | RSVD(1) | NCTRL(2) | RSVD(3) }, |
| 1158 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1050, 0xff), /* Telit FN980 (rmnet) */ | |
| 1159 | + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, | |
| 1160 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1051, 0xff), /* Telit FN980 (MBIM) */ | |
| 1161 | + .driver_info = NCTRL(0) | RSVD(1) }, | |
| 1162 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1052, 0xff), /* Telit FN980 (RNDIS) */ | |
| 1163 | + .driver_info = NCTRL(2) | RSVD(3) }, | |
| 1164 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1053, 0xff), /* Telit FN980 (ECM) */ | |
| 1165 | + .driver_info = NCTRL(0) | RSVD(1) }, | |
| 1157 | 1166 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), |
| 1158 | 1167 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
| 1159 | 1168 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
| @@ -1847,6 +1856,8 @@ static const struct usb_device_id option_ids[] = { · 687 unmodified lines | ||
| 1847 | 1856 | .driver_info = RSVD(4) }, |
| 1848 | 1857 | { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_2RMNET, 0xff) }, |
| 1849 | 1858 | { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) }, |
| 1859 | + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_CLS8, 0xff), | |
| 1860 | + .driver_info = RSVD(0) | RSVD(4) }, | |
| 1850 | 1861 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, |
| 1851 | 1862 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
| 1852 | 1863 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, |
| @@ -314,10 +314,7 @@ static void serial_cleanup(struct tty_struct *tty) · 313 unmodified lines | ||
| 314 | 314 | serial = port->serial; |
| 315 | 315 | owner = serial->type->driver.owner; |
| 316 | 316 | |
| 317 | − mutex_lock(&serial->disc_mutex); | |
| 318 | − if (!serial->disconnected) | |
| 319 | − usb_autopm_put_interface(serial->interface); | |
| 320 | − mutex_unlock(&serial->disc_mutex); | |
| 317 | + usb_autopm_put_interface(serial->interface); | |
| 321 | 318 | |
| 322 | 319 | usb_serial_put(serial); |
| 323 | 320 | module_put(owner); |
| @@ -4409,18 +4409,20 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, · 4408 unmodified lines | ||
| 4409 | 4409 | /* USB data support is optional */ |
| 4410 | 4410 | ret = fwnode_property_read_string(fwnode, "data-role", &cap_str); |
| 4411 | 4411 | if (ret == 0) { |
| 4412 | − port->typec_caps.data = typec_find_port_data_role(cap_str); | |
| 4413 | − if (port->typec_caps.data < 0) | |
| 4414 | − return -EINVAL; | |
| 4412 | + ret = typec_find_port_data_role(cap_str); | |
| 4413 | + if (ret < 0) | |
| 4414 | + return ret; | |
| 4415 | + port->typec_caps.data = ret; | |
| 4415 | 4416 | } |
| 4416 | 4417 | |
| 4417 | 4418 | ret = fwnode_property_read_string(fwnode, "power-role", &cap_str); |
| 4418 | 4419 | if (ret < 0) |
| 4419 | 4420 | return ret; |
| 4420 | 4421 | |
| 4421 | − port->typec_caps.type = typec_find_port_power_role(cap_str); | |
| 4422 | − if (port->typec_caps.type < 0) | |
| 4423 | − return -EINVAL; | |
| 4422 | + ret = typec_find_port_power_role(cap_str); | |
| 4423 | + if (ret < 0) | |
| 4424 | + return ret; | |
| 4425 | + port->typec_caps.type = ret; | |
| 4424 | 4426 | port->port_type = port->typec_caps.type; |
| 4425 | 4427 | |
| 4426 | 4428 | if (port->port_type == TYPEC_PORT_SNK) |
| @@ -75,6 +75,8 @@ static int ucsi_displayport_enter(struct typec_altmode *alt) · 74 unmodified lines | ||
| 75 | 75 | |
| 76 | 76 | if (cur != 0xff) { |
| 77 | 77 | mutex_unlock(&dp->con->lock); |
| 78 | + if (dp->con->port_altmode[cur] == alt) | |
| 79 | + return 0; | |
| 78 | 80 | return -EBUSY; |
| 79 | 81 | } |
| 80 | 82 | |
| @@ -195,7 +195,6 @@ struct ucsi_ccg { · 194 unmodified lines | ||
| 195 | 195 | |
| 196 | 196 | /* fw build with vendor information */ |
| 197 | 197 | u16 fw_build; |
| 198 | − bool run_isr; /* flag to call ISR routine during resume */ | |
| 199 | 198 | struct work_struct pm_work; |
| 200 | 199 | }; |
| 201 | 200 | |
| @@ -224,18 +223,6 @@ static int ccg_read(struct ucsi_ccg *uc, u16 rab, u8 *data, u32 len) · 22 unmodified lines | ||
| 224 | 223 | if (quirks && quirks->max_read_len) |
| 225 | 224 | max_read_len = quirks->max_read_len; |
| 226 | 225 | |
| 227 | − if (uc->fw_build == CCG_FW_BUILD_NVIDIA && | |
| 228 | − uc->fw_version <= CCG_OLD_FW_VERSION) { | |
| 229 | − mutex_lock(&uc->lock); | |
| 230 | − /* | |
| 231 | − * Do not schedule pm_work to run ISR in | |
| 232 | − * ucsi_ccg_runtime_resume() after pm_runtime_get_sync() | |
| 233 | − * since we are already in ISR path. | |
| 234 | − */ | |
| 235 | − uc->run_isr = false; | |
| 236 | − mutex_unlock(&uc->lock); | |
| 237 | − } | |
| 238 | − | |
| 239 | 226 | pm_runtime_get_sync(uc->dev); |
| 240 | 227 | while (rem_len > 0) { |
| 241 | 228 | msgs[1].buf = &data[len - rem_len]; |
| @@ -278,18 +265,6 @@ static int ccg_write(struct ucsi_ccg *uc, u16 rab, u8 *data, u32 len) · 36 unmodified lines | ||
| 278 | 265 | msgs[0].len = len + sizeof(rab); |
| 279 | 266 | msgs[0].buf = buf; |
| 280 | 267 | |
| 281 | − if (uc->fw_build == CCG_FW_BUILD_NVIDIA && | |
| 282 | − uc->fw_version <= CCG_OLD_FW_VERSION) { | |
| 283 | − mutex_lock(&uc->lock); | |
| 284 | − /* | |
| 285 | − * Do not schedule pm_work to run ISR in | |
| 286 | − * ucsi_ccg_runtime_resume() after pm_runtime_get_sync() | |
| 287 | − * since we are already in ISR path. | |
| 288 | − */ | |
| 289 | − uc->run_isr = false; | |
| 290 | − mutex_unlock(&uc->lock); | |
| 291 | − } | |
| 292 | − | |
| 293 | 268 | pm_runtime_get_sync(uc->dev); |
| 294 | 269 | status = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); |
| 295 | 270 | if (status < 0) { |
| @@ -1130,7 +1105,6 @@ static int ucsi_ccg_probe(struct i2c_client *client, · 834 unmodified lines | ||
| 1130 | 1105 | uc->ppm.sync = ucsi_ccg_sync; |
| 1131 | 1106 | uc->dev = dev; |
| 1132 | 1107 | uc->client = client; |
| 1133 | − uc->run_isr = true; | |
| 1134 | 1108 | mutex_init(&uc->lock); |
| 1135 | 1109 | INIT_WORK(&uc->work, ccg_update_firmware); |
| 1136 | 1110 | INIT_WORK(&uc->pm_work, ccg_pm_workaround_work); |
| @@ -1188,6 +1162,8 @@ static int ucsi_ccg_probe(struct i2c_client *client, · 51 unmodified lines | ||
| 1188 | 1162 | |
| 1189 | 1163 | pm_runtime_set_active(uc->dev); |
| 1190 | 1164 | pm_runtime_enable(uc->dev); |
| 1165 | + pm_runtime_use_autosuspend(uc->dev); | |
| 1166 | + pm_runtime_set_autosuspend_delay(uc->dev, 5000); | |
| 1191 | 1167 | pm_runtime_idle(uc->dev); |
| 1192 | 1168 | |
| 1193 | 1169 | return 0; |
| @@ -1229,7 +1205,6 @@ static int ucsi_ccg_runtime_resume(struct device *dev) · 35 unmodified lines | ||
| 1229 | 1205 | { |
| 1230 | 1206 | struct i2c_client *client = to_i2c_client(dev); |
| 1231 | 1207 | struct ucsi_ccg *uc = i2c_get_clientdata(client); |
| 1232 | − bool schedule = true; | |
| 1233 | 1208 | |
| 1234 | 1209 | /* |
| 1235 | 1210 | * Firmware version 3.1.10 or earlier, built for NVIDIA has known issue |
| @@ -1237,17 +1212,8 @@ static int ucsi_ccg_runtime_resume(struct device *dev) · 1 unmodified line | ||
| 1237 | 1212 | * Schedule a work to call ISR as a workaround. |
| 1238 | 1213 | */ |
| 1239 | 1214 | if (uc->fw_build == CCG_FW_BUILD_NVIDIA && |
| 1240 | − uc->fw_version <= CCG_OLD_FW_VERSION) { | |
| 1241 | − mutex_lock(&uc->lock); | |
| 1242 | − if (!uc->run_isr) { | |
| 1243 | − uc->run_isr = true; | |
| 1244 | − schedule = false; | |
| 1245 | − } | |
| 1246 | − mutex_unlock(&uc->lock); | |
| 1247 | − | |
| 1248 | − if (schedule) | |
| 1249 | − schedule_work(&uc->pm_work); | |
| 1250 | − } | |
| 1215 | + uc->fw_version <= CCG_OLD_FW_VERSION) | |
| 1216 | + schedule_work(&uc->pm_work); | |
| 1251 | 1217 | |
| 1252 | 1218 | return 0; |
| 1253 | 1219 | } |
| @@ -61,6 +61,7 @@ struct usb_skel { · 60 unmodified lines | ||
| 61 | 61 | spinlock_t err_lock; /* lock for errors */ |
| 62 | 62 | struct kref kref; |
| 63 | 63 | struct mutex io_mutex; /* synchronize I/O with disconnect */ |
| 64 | + unsigned long disconnected:1; | |
| 64 | 65 | wait_queue_head_t bulk_in_wait; /* to wait for an ongoing read */ |
| 65 | 66 | }; |
| 66 | 67 | #define to_skel_dev(d) container_of(d, struct usb_skel, kref) |
| @@ -73,6 +74,7 @@ static void skel_delete(struct kref *kref) · 6 unmodified lines | ||
| 73 | 74 | struct usb_skel *dev = to_skel_dev(kref); |
| 74 | 75 | |
| 75 | 76 | usb_free_urb(dev->bulk_in_urb); |
| 77 | + usb_put_intf(dev->interface); | |
| 76 | 78 | usb_put_dev(dev->udev); |
| 77 | 79 | kfree(dev->bulk_in_buffer); |
| 78 | 80 | kfree(dev); |
| @@ -124,10 +126,7 @@ static int skel_release(struct inode *inode, struct file *file) · 45 unmodified lines | ||
| 124 | 126 | return -ENODEV; |
| 125 | 127 | |
| 126 | 128 | /* allow the device to be autosuspended */ |
| 127 | − mutex_lock(&dev->io_mutex); | |
| 128 | − if (dev->interface) | |
| 129 | − usb_autopm_put_interface(dev->interface); | |
| 130 | − mutex_unlock(&dev->io_mutex); | |
| 129 | + usb_autopm_put_interface(dev->interface); | |
| 131 | 130 | |
| 132 | 131 | /* decrement the count on our device */ |
| 133 | 132 | kref_put(&dev->kref, skel_delete); |
| @@ -231,8 +230,7 @@ static ssize_t skel_read(struct file *file, char *buffer, size_t count, · 97 unmodified lines | ||
| 231 | 230 | |
| 232 | 231 | dev = file->private_data; |
| 233 | 232 | |
| 234 | − /* if we cannot read at all, return EOF */ | |
| 235 | − if (!dev->bulk_in_urb || !count) | |
| 233 | + if (!count) | |
| 236 | 234 | return 0; |
| 237 | 235 | |
| 238 | 236 | /* no concurrent readers */ |
| @@ -240,7 +238,7 @@ static ssize_t skel_read(struct file *file, char *buffer, size_t count, · 1 unmodified line | ||
| 240 | 238 | if (rv < 0) |
| 241 | 239 | return rv; |
| 242 | 240 | |
| 243 | − if (!dev->interface) { /* disconnect() was called */ | |
| 241 | + if (dev->disconnected) { /* disconnect() was called */ | |
| 244 | 242 | rv = -ENODEV; |
| 245 | 243 | goto exit; |
| 246 | 244 | } |
| @@ -422,7 +420,7 @@ static ssize_t skel_write(struct file *file, const char *user_buffer, · 175 unmodified lines | ||
| 422 | 420 | |
| 423 | 421 | /* this lock makes sure we don't submit URBs to gone devices */ |
| 424 | 422 | mutex_lock(&dev->io_mutex); |
| 425 | − if (!dev->interface) { /* disconnect() was called */ | |
| 423 | + if (dev->disconnected) { /* disconnect() was called */ | |
| 426 | 424 | mutex_unlock(&dev->io_mutex); |
| 427 | 425 | retval = -ENODEV; |
| 428 | 426 | goto error; |
| @@ -507,7 +505,7 @@ static int skel_probe(struct usb_interface *interface, · 78 unmodified lines | ||
| 507 | 505 | init_waitqueue_head(&dev->bulk_in_wait); |
| 508 | 506 | |
| 509 | 507 | dev->udev = usb_get_dev(interface_to_usbdev(interface)); |
| 510 | − dev->interface = interface; | |
| 508 | + dev->interface = usb_get_intf(interface); | |
| 511 | 509 | |
| 512 | 510 | /* set up the endpoint information */ |
| 513 | 511 | /* use only the first bulk-in and bulk-out endpoints */ |
| @@ -573,9 +571,10 @@ static void skel_disconnect(struct usb_interface *interface) · 59 unmodified lines | ||
| 573 | 571 | |
| 574 | 572 | /* prevent more I/O from starting */ |
| 575 | 573 | mutex_lock(&dev->io_mutex); |
| 576 | − dev->interface = NULL; | |
| 574 | + dev->disconnected = 1; | |
| 577 | 575 | mutex_unlock(&dev->io_mutex); |
| 578 | 576 | |
| 577 | + usb_kill_urb(dev->bulk_in_urb); | |
| 579 | 578 | usb_kill_anchored_urbs(&dev->submitted); |
| 580 | 579 | |
| 581 | 580 | /* decrement our usage count */ |
| @@ -1195,12 +1195,12 @@ static int vhci_start(struct usb_hcd *hcd) · 1194 unmodified lines | ||
| 1195 | 1195 | if (id == 0 && usb_hcd_is_primary_hcd(hcd)) { |
| 1196 | 1196 | err = vhci_init_attr_group(); |
| 1197 | 1197 | if (err) { |
| 1198 | − pr_err("init attr group\n"); | |
| 1198 | + dev_err(hcd_dev(hcd), "init attr group failed, err = %d\n", err); | |
| 1199 | 1199 | return err; |
| 1200 | 1200 | } |
| 1201 | 1201 | err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group); |
| 1202 | 1202 | if (err) { |
| 1203 | − pr_err("create sysfs files\n"); | |
| 1203 | + dev_err(hcd_dev(hcd), "create sysfs files failed, err = %d\n", err); | |
| 1204 | 1204 | vhci_finish_attr_group(); |
| 1205 | 1205 | return err; |
| 1206 | 1206 | } |
| @@ -18,23 +18,6 @@ obj-$(CONFIG_SPU_BASE) += logo_spe_clut224.o · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | # How to generate logo's |
| 20 | 20 | |
| 21 | −# Use logo-cfiles to retrieve list of .c files to be built | |
| 22 | −logo-cfiles = $(notdir $(patsubst %.$(2), %.c, \ | |
| 23 | − $(wildcard $(srctree)/$(src)/*$(1).$(2)))) | |
| 24 | − | |
| 25 | − | |
| 26 | −# Mono logos | |
| 27 | −extra-y += $(call logo-cfiles,_mono,pbm) | |
| 28 | − | |
| 29 | −# VGA16 logos | |
| 30 | −extra-y += $(call logo-cfiles,_vga16,ppm) | |
| 31 | − | |
| 32 | −# 224 Logos | |
| 33 | −extra-y += $(call logo-cfiles,_clut224,ppm) | |
| 34 | − | |
| 35 | −# Gray 256 | |
| 36 | −extra-y += $(call logo-cfiles,_gray256,pgm) | |
| 37 | − | |
| 38 | 21 | pnmtologo := scripts/pnmtologo |
| 39 | 22 | |
| 40 | 23 | # Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..." |
| @@ -55,5 +38,5 @@ $(obj)/%_clut224.c: $(src)/%_clut224.ppm $(pnmtologo) FORCE · 14 unmodified lines | ||
| 55 | 38 | $(obj)/%_gray256.c: $(src)/%_gray256.pgm $(pnmtologo) FORCE |
| 56 | 39 | $(call if_changed,logo) |
| 57 | 40 | |
| 58 | −# Files generated that shall be removed upon make clean | |
| 59 | −clean-files := *.o *_mono.c *_vga16.c *_clut224.c *_gray256.c | |
| 41 | +# generated C files | |
| 42 | +targets += *_mono.c *_vga16.c *_clut224.c *_gray256.c | |
| @@ -220,6 +220,8 @@ static int hgcm_call_preprocess_linaddr( · 219 unmodified lines | ||
| 220 | 220 | if (!bounce_buf) |
| 221 | 221 | return -ENOMEM; |
| 222 | 222 | |
| 223 | + *bounce_buf_ret = bounce_buf; | |
| 224 | + | |
| 223 | 225 | if (copy_in) { |
| 224 | 226 | ret = copy_from_user(bounce_buf, (void __user *)buf, len); |
| 225 | 227 | if (ret) |
| @@ -228,7 +230,6 @@ static int hgcm_call_preprocess_linaddr( · 2 unmodified lines | ||
| 228 | 230 | memset(bounce_buf, 0, len); |
| 229 | 231 | } |
| 230 | 232 | |
| 231 | − *bounce_buf_ret = bounce_buf; | |
| 232 | 233 | hgcm_call_add_pagelist_size(bounce_buf, len, extra); |
| 233 | 234 | return 0; |
| 234 | 235 | } |
| @@ -103,6 +103,7 @@ config W1_SLAVE_DS2438 · 102 unmodified lines | ||
| 103 | 103 | |
| 104 | 104 | config W1_SLAVE_DS250X |
| 105 | 105 | tristate "512b/1kb/16kb EPROM family support" |
| 106 | + select CRC16 | |
| 106 | 107 | help |
| 107 | 108 | Say Y here if you want to use a 1-wire |
| 108 | 109 | 512b/1kb/16kb EPROM family device (DS250x). |
| @@ -156,8 +156,10 @@ static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); · 155 unmodified lines | ||
| 156 | 156 | (GFP_HIGHUSER | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC) |
| 157 | 157 | |
| 158 | 158 | /* balloon_append: add the given page to the balloon. */ |
| 159 | −static void __balloon_append(struct page *page) | |
| 159 | +static void balloon_append(struct page *page) | |
| 160 | 160 | { |
| 161 | + __SetPageOffline(page); | |
| 162 | + | |
| 161 | 163 | /* Lowmem is re-populated first, so highmem pages go at list tail. */ |
| 162 | 164 | if (PageHighMem(page)) { |
| 163 | 165 | list_add_tail(&page->lru, &ballooned_pages); |
| @@ -169,11 +171,6 @@ static void __balloon_append(struct page *page) · 5 unmodified lines | ||
| 169 | 171 | wake_up(&balloon_wq); |
| 170 | 172 | } |
| 171 | 173 | |
| 172 | −static void balloon_append(struct page *page) | |
| 173 | −{ | |
| 174 | − __balloon_append(page); | |
| 175 | −} | |
| 176 | − | |
| 177 | 174 | /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ |
| 178 | 175 | static struct page *balloon_retrieve(bool require_lowmem) |
| 179 | 176 | { |
| @@ -192,6 +189,7 @@ static struct page *balloon_retrieve(bool require_lowmem) · 12 unmodified lines | ||
| 192 | 189 | else |
| 193 | 190 | balloon_stats.balloon_low--; |
| 194 | 191 | |
| 192 | + __ClearPageOffline(page); | |
| 195 | 193 | return page; |
| 196 | 194 | } |
| 197 | 195 | |
| @@ -377,8 +375,7 @@ static void xen_online_page(struct page *page, unsigned int order) · 179 unmodified lines | ||
| 377 | 375 | for (i = 0; i < size; i++) { |
| 378 | 376 | p = pfn_to_page(start_pfn + i); |
| 379 | 377 | __online_page_set_limits(p); |
| 380 | − __SetPageOffline(p); | |
| 381 | − __balloon_append(p); | |
| 378 | + balloon_append(p); | |
| 382 | 379 | } |
| 383 | 380 | mutex_unlock(&balloon_mutex); |
| 384 | 381 | } |
| @@ -444,7 +441,6 @@ static enum bp_state increase_reservation(unsigned long nr_pages) · 59 unmodified lines | ||
| 444 | 441 | xenmem_reservation_va_mapping_update(1, &page, &frame_list[i]); |
| 445 | 442 | |
| 446 | 443 | /* Relinquish the page back to the allocator. */ |
| 447 | − __ClearPageOffline(page); | |
| 448 | 444 | free_reserved_page(page); |
| 449 | 445 | } |
| 450 | 446 | |
| @@ -471,7 +467,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 20 unmodified lines | ||
| 471 | 467 | state = BP_EAGAIN; |
| 472 | 468 | break; |
| 473 | 469 | } |
| 474 | − __SetPageOffline(page); | |
| 475 | 470 | adjust_managed_page_count(page, -1); |
| 476 | 471 | xenmem_reservation_scrub_page(page); |
| 477 | 472 | list_add(&page->lru, &pages); |
| @@ -611,7 +606,6 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) · 133 unmodified lines | ||
| 611 | 606 | while (pgno < nr_pages) { |
| 612 | 607 | page = balloon_retrieve(true); |
| 613 | 608 | if (page) { |
| 614 | − __ClearPageOffline(page); | |
| 615 | 609 | pages[pgno++] = page; |
| 616 | 610 | #ifdef CONFIG_XEN_HAVE_PVMMU |
| 617 | 611 | /* |
| @@ -653,10 +647,8 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) · 35 unmodified lines | ||
| 653 | 647 | mutex_lock(&balloon_mutex); |
| 654 | 648 | |
| 655 | 649 | for (i = 0; i < nr_pages; i++) { |
| 656 | − if (pages[i]) { | |
| 657 | − __SetPageOffline(pages[i]); | |
| 650 | + if (pages[i]) | |
| 658 | 651 | balloon_append(pages[i]); |
| 659 | − } | |
| 660 | 652 | } |
| 661 | 653 | |
| 662 | 654 | balloon_stats.target_unpopulated -= nr_pages; |
| @@ -674,7 +666,6 @@ static void __init balloon_add_region(unsigned long start_pfn, · 11 unmodified lines | ||
| 674 | 666 | unsigned long pages) |
| 675 | 667 | { |
| 676 | 668 | unsigned long pfn, extra_pfn_end; |
| 677 | − struct page *page; | |
| 678 | 669 | |
| 679 | 670 | /* |
| 680 | 671 | * If the amount of usable memory has been limited (e.g., with |
| @@ -684,11 +675,10 @@ static void __init balloon_add_region(unsigned long start_pfn, · 3 unmodified lines | ||
| 684 | 675 | extra_pfn_end = min(max_pfn, start_pfn + pages); |
| 685 | 676 | |
| 686 | 677 | for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) { |
| 687 | − page = pfn_to_page(pfn); | |
| 688 | 678 | /* totalram_pages and totalhigh_pages do not |
| 689 | 679 | include the boot-time balloon extension, so |
| 690 | 680 | don't subtract from it. */ |
| 691 | − __balloon_append(page); | |
| 681 | + balloon_append(pfn_to_page(pfn)); | |
| 692 | 682 | } |
| 693 | 683 | |
| 694 | 684 | balloon_stats.total_pages += extra_pfn_end - start_pfn; |
| @@ -40,7 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | #define efi_data(op) (op.u.efi_runtime_call) |
| 42 | 42 | |
| 43 | −efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) | |
| 43 | +static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) | |
| 44 | 44 | { |
| 45 | 45 | struct xen_platform_op op = INIT_EFI_OP(get_time); |
| 46 | 46 | |
| @@ -61,9 +61,8 @@ efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) · 14 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | return efi_data(op).status; |
| 63 | 63 | } |
| 64 | −EXPORT_SYMBOL_GPL(xen_efi_get_time); | |
| 65 | 64 | |
| 66 | −efi_status_t xen_efi_set_time(efi_time_t *tm) | |
| 65 | +static efi_status_t xen_efi_set_time(efi_time_t *tm) | |
| 67 | 66 | { |
| 68 | 67 | struct xen_platform_op op = INIT_EFI_OP(set_time); |
| 69 | 68 | |
| @@ -75,10 +74,10 @@ efi_status_t xen_efi_set_time(efi_time_t *tm) · 5 unmodified lines | ||
| 75 | 74 | |
| 76 | 75 | return efi_data(op).status; |
| 77 | 76 | } |
| 78 | −EXPORT_SYMBOL_GPL(xen_efi_set_time); | |
| 79 | 77 | |
| 80 | −efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, | |
| 81 | − efi_time_t *tm) | |
| 78 | +static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, | |
| 79 | + efi_bool_t *pending, | |
| 80 | + efi_time_t *tm) | |
| 82 | 81 | { |
| 83 | 82 | struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time); |
| 84 | 83 | |
| @@ -98,9 +97,8 @@ efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, · 13 unmodified lines | ||
| 98 | 97 | |
| 99 | 98 | return efi_data(op).status; |
| 100 | 99 | } |
| 101 | −EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time); | |
| 102 | 100 | |
| 103 | −efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) | |
| 101 | +static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) | |
| 104 | 102 | { |
| 105 | 103 | struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time); |
| 106 | 104 | |
| @@ -117,11 +115,10 @@ efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) · 10 unmodified lines | ||
| 117 | 115 | |
| 118 | 116 | return efi_data(op).status; |
| 119 | 117 | } |
| 120 | −EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time); | |
| 121 | 118 | |
| 122 | −efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 123 | − u32 *attr, unsigned long *data_size, | |
| 124 | − void *data) | |
| 119 | +static efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 120 | + u32 *attr, unsigned long *data_size, | |
| 121 | + void *data) | |
| 125 | 122 | { |
| 126 | 123 | struct xen_platform_op op = INIT_EFI_OP(get_variable); |
| 127 | 124 | |
| @@ -141,11 +138,10 @@ efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, · 13 unmodified lines | ||
| 141 | 138 | |
| 142 | 139 | return efi_data(op).status; |
| 143 | 140 | } |
| 144 | −EXPORT_SYMBOL_GPL(xen_efi_get_variable); | |
| 145 | 141 | |
| 146 | −efi_status_t xen_efi_get_next_variable(unsigned long *name_size, | |
| 147 | − efi_char16_t *name, | |
| 148 | − efi_guid_t *vendor) | |
| 142 | +static efi_status_t xen_efi_get_next_variable(unsigned long *name_size, | |
| 143 | + efi_char16_t *name, | |
| 144 | + efi_guid_t *vendor) | |
| 149 | 145 | { |
| 150 | 146 | struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name); |
| 151 | 147 | |
| @@ -165,11 +161,10 @@ efi_status_t xen_efi_get_next_variable(unsigned long *name_size, · 13 unmodified lines | ||
| 165 | 161 | |
| 166 | 162 | return efi_data(op).status; |
| 167 | 163 | } |
| 168 | −EXPORT_SYMBOL_GPL(xen_efi_get_next_variable); | |
| 169 | 164 | |
| 170 | −efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 171 | − u32 attr, unsigned long data_size, | |
| 172 | − void *data) | |
| 165 | +static efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 166 | + u32 attr, unsigned long data_size, | |
| 167 | + void *data) | |
| 173 | 168 | { |
| 174 | 169 | struct xen_platform_op op = INIT_EFI_OP(set_variable); |
| 175 | 170 | |
| @@ -186,11 +181,10 @@ efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, · 10 unmodified lines | ||
| 186 | 181 | |
| 187 | 182 | return efi_data(op).status; |
| 188 | 183 | } |
| 189 | −EXPORT_SYMBOL_GPL(xen_efi_set_variable); | |
| 190 | 184 | |
| 191 | −efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, | |
| 192 | − u64 *remaining_space, | |
| 193 | − u64 *max_variable_size) | |
| 185 | +static efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, | |
| 186 | + u64 *remaining_space, | |
| 187 | + u64 *max_variable_size) | |
| 194 | 188 | { |
| 195 | 189 | struct xen_platform_op op = INIT_EFI_OP(query_variable_info); |
| 196 | 190 | |
| @@ -208,9 +202,8 @@ efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, · 11 unmodified lines | ||
| 208 | 202 | |
| 209 | 203 | return efi_data(op).status; |
| 210 | 204 | } |
| 211 | −EXPORT_SYMBOL_GPL(xen_efi_query_variable_info); | |
| 212 | 205 | |
| 213 | −efi_status_t xen_efi_get_next_high_mono_count(u32 *count) | |
| 206 | +static efi_status_t xen_efi_get_next_high_mono_count(u32 *count) | |
| 214 | 207 | { |
| 215 | 208 | struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count); |
| 216 | 209 | |
| @@ -221,10 +214,9 @@ efi_status_t xen_efi_get_next_high_mono_count(u32 *count) · 4 unmodified lines | ||
| 221 | 214 | |
| 222 | 215 | return efi_data(op).status; |
| 223 | 216 | } |
| 224 | −EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count); | |
| 225 | 217 | |
| 226 | −efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, | |
| 227 | − unsigned long count, unsigned long sg_list) | |
| 218 | +static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, | |
| 219 | + unsigned long count, unsigned long sg_list) | |
| 228 | 220 | { |
| 229 | 221 | struct xen_platform_op op = INIT_EFI_OP(update_capsule); |
| 230 | 222 | |
| @@ -241,11 +233,9 @@ efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, · 10 unmodified lines | ||
| 241 | 233 | |
| 242 | 234 | return efi_data(op).status; |
| 243 | 235 | } |
| 244 | −EXPORT_SYMBOL_GPL(xen_efi_update_capsule); | |
| 245 | 236 | |
| 246 | −efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, | |
| 247 | − unsigned long count, u64 *max_size, | |
| 248 | − int *reset_type) | |
| 237 | +static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, | |
| 238 | + unsigned long count, u64 *max_size, int *reset_type) | |
| 249 | 239 | { |
| 250 | 240 | struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities); |
| 251 | 241 | |
| @@ -264,10 +254,9 @@ efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, · 12 unmodified lines | ||
| 264 | 254 | |
| 265 | 255 | return efi_data(op).status; |
| 266 | 256 | } |
| 267 | −EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps); | |
| 268 | 257 | |
| 269 | −void xen_efi_reset_system(int reset_type, efi_status_t status, | |
| 270 | − unsigned long data_size, efi_char16_t *data) | |
| 258 | +static void xen_efi_reset_system(int reset_type, efi_status_t status, | |
| 259 | + unsigned long data_size, efi_char16_t *data) | |
| 271 | 260 | { |
| 272 | 261 | switch (reset_type) { |
| 273 | 262 | case EFI_RESET_COLD: |
| @@ -281,4 +270,25 @@ void xen_efi_reset_system(int reset_type, efi_status_t status, · 7 unmodified lines | ||
| 281 | 270 | BUG(); |
| 282 | 271 | } |
| 283 | 272 | } |
| 284 | −EXPORT_SYMBOL_GPL(xen_efi_reset_system); | |
| 273 | + | |
| 274 | +/* | |
| 275 | + * Set XEN EFI runtime services function pointers. Other fields of struct efi, | |
| 276 | + * e.g. efi.systab, will be set like normal EFI. | |
| 277 | + */ | |
| 278 | +void __init xen_efi_runtime_setup(void) | |
| 279 | +{ | |
| 280 | + efi.get_time = xen_efi_get_time; | |
| 281 | + efi.set_time = xen_efi_set_time; | |
| 282 | + efi.get_wakeup_time = xen_efi_get_wakeup_time; | |
| 283 | + efi.set_wakeup_time = xen_efi_set_wakeup_time; | |
| 284 | + efi.get_variable = xen_efi_get_variable; | |
| 285 | + efi.get_next_variable = xen_efi_get_next_variable; | |
| 286 | + efi.set_variable = xen_efi_set_variable; | |
| 287 | + efi.set_variable_nonblocking = xen_efi_set_variable; | |
| 288 | + efi.query_variable_info = xen_efi_query_variable_info; | |
| 289 | + efi.query_variable_info_nonblocking = xen_efi_query_variable_info; | |
| 290 | + efi.update_capsule = xen_efi_update_capsule; | |
| 291 | + efi.query_capsule_caps = xen_efi_query_capsule_caps; | |
| 292 | + efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; | |
| 293 | + efi.reset_system = xen_efi_reset_system; | |
| 294 | +} | |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | #define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt |
| 24 | 24 | |
| 25 | +#include <linux/dma-mapping.h> | |
| 25 | 26 | #include <linux/module.h> |
| 26 | 27 | #include <linux/kernel.h> |
| 27 | 28 | #include <linux/init.h> |
| @@ -34,9 +35,6 @@ · 6 unmodified lines | ||
| 34 | 35 | #include <linux/slab.h> |
| 35 | 36 | #include <linux/highmem.h> |
| 36 | 37 | #include <linux/refcount.h> |
| 37 | −#ifdef CONFIG_XEN_GRANT_DMA_ALLOC | |
| 38 | −#include <linux/of_device.h> | |
| 39 | −#endif | |
| 40 | 38 | |
| 41 | 39 | #include <xen/xen.h> |
| 42 | 40 | #include <xen/grant_table.h> |
| @@ -625,14 +623,7 @@ static int gntdev_open(struct inode *inode, struct file *flip) · 582 unmodified lines | ||
| 625 | 623 | flip->private_data = priv; |
| 626 | 624 | #ifdef CONFIG_XEN_GRANT_DMA_ALLOC |
| 627 | 625 | priv->dma_dev = gntdev_miscdev.this_device; |
| 628 | − | |
| 629 | − /* | |
| 630 | − * The device is not spawn from a device tree, so arch_setup_dma_ops | |
| 631 | − * is not called, thus leaving the device with dummy DMA ops. | |
| 632 | − * Fix this by calling of_dma_configure() with a NULL node to set | |
| 633 | − * default DMA ops. | |
| 634 | − */ | |
| 635 | − of_dma_configure(priv->dma_dev, NULL, true); | |
| 626 | + dma_coerce_mask_and_coherent(priv->dma_dev, DMA_BIT_MASK(64)); | |
| 636 | 627 | #endif |
| 637 | 628 | pr_debug("priv %p\n", priv); |
| 638 | 629 | |
| @@ -1363,8 +1363,7 @@ static int gnttab_setup(void) · 1362 unmodified lines | ||
| 1363 | 1363 | if (xen_feature(XENFEAT_auto_translated_physmap) && gnttab_shared.addr == NULL) { |
| 1364 | 1364 | gnttab_shared.addr = xen_auto_xlat_grant_frames.vaddr; |
| 1365 | 1365 | if (gnttab_shared.addr == NULL) { |
| 1366 | − pr_warn("gnttab share frames (addr=0x%08lx) is not mapped!\n", | |
| 1367 | − (unsigned long)xen_auto_xlat_grant_frames.vaddr); | |
| 1366 | + pr_warn("gnttab share frames is not mapped!\n"); | |
| 1368 | 1367 | return -ENOMEM; |
| 1369 | 1368 | } |
| 1370 | 1369 | } |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | #include <linux/string.h> |
| 56 | 56 | #include <linux/slab.h> |
| 57 | 57 | #include <linux/miscdevice.h> |
| 58 | +#include <linux/workqueue.h> | |
| 58 | 59 | |
| 59 | 60 | #include <xen/xenbus.h> |
| 60 | 61 | #include <xen/xen.h> |
| @@ -116,6 +117,8 @@ struct xenbus_file_priv { · 55 unmodified lines | ||
| 116 | 117 | wait_queue_head_t read_waitq; |
| 117 | 118 | |
| 118 | 119 | struct kref kref; |
| 120 | + | |
| 121 | + struct work_struct wq; | |
| 119 | 122 | }; |
| 120 | 123 | |
| 121 | 124 | /* Read out any raw xenbus messages queued up. */ |
| @@ -300,14 +303,14 @@ static void watch_fired(struct xenbus_watch *watch, · 178 unmodified lines | ||
| 300 | 303 | mutex_unlock(&adap->dev_data->reply_mutex); |
| 301 | 304 | } |
| 302 | 305 | |
| 303 | −static void xenbus_file_free(struct kref *kref) | |
| 306 | +static void xenbus_worker(struct work_struct *wq) | |
| 304 | 307 | { |
| 305 | 308 | struct xenbus_file_priv *u; |
| 306 | 309 | struct xenbus_transaction_holder *trans, *tmp; |
| 307 | 310 | struct watch_adapter *watch, *tmp_watch; |
| 308 | 311 | struct read_buffer *rb, *tmp_rb; |
| 309 | 312 | |
| 310 | − u = container_of(kref, struct xenbus_file_priv, kref); | |
| 313 | + u = container_of(wq, struct xenbus_file_priv, wq); | |
| 311 | 314 | |
| 312 | 315 | /* |
| 313 | 316 | * No need for locking here because there are no other users, |
| @@ -333,6 +336,18 @@ static void xenbus_file_free(struct kref *kref) · 19 unmodified lines | ||
| 333 | 336 | kfree(u); |
| 334 | 337 | } |
| 335 | 338 | |
| 339 | +static void xenbus_file_free(struct kref *kref) | |
| 340 | +{ | |
| 341 | + struct xenbus_file_priv *u; | |
| 342 | + | |
| 343 | + /* | |
| 344 | + * We might be called in xenbus_thread(). | |
| 345 | + * Use workqueue to avoid deadlock. | |
| 346 | + */ | |
| 347 | + u = container_of(kref, struct xenbus_file_priv, kref); | |
| 348 | + schedule_work(&u->wq); | |
| 349 | +} | |
| 350 | + | |
| 336 | 351 | static struct xenbus_transaction_holder *xenbus_get_transaction( |
| 337 | 352 | struct xenbus_file_priv *u, uint32_t tx_id) |
| 338 | 353 | { |
| @@ -650,6 +665,7 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) · 311 unmodified lines | ||
| 650 | 665 | INIT_LIST_HEAD(&u->watches); |
| 651 | 666 | INIT_LIST_HEAD(&u->read_buffers); |
| 652 | 667 | init_waitqueue_head(&u->read_waitq); |
| 668 | + INIT_WORK(&u->wq, xenbus_worker); | |
| 653 | 669 | |
| 654 | 670 | mutex_init(&u->reply_mutex); |
| 655 | 671 | mutex_init(&u->msgbuffer_mutex); |
| @@ -879,7 +879,7 @@ out_free_interp: · 878 unmodified lines | ||
| 879 | 879 | the correct location in memory. */ |
| 880 | 880 | for(i = 0, elf_ppnt = elf_phdata; |
| 881 | 881 | i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { |
| 882 | − int elf_prot, elf_flags, elf_fixed = MAP_FIXED_NOREPLACE; | |
| 882 | + int elf_prot, elf_flags; | |
| 883 | 883 | unsigned long k, vaddr; |
| 884 | 884 | unsigned long total_size = 0; |
| 885 | 885 | |
| @@ -911,13 +911,6 @@ out_free_interp: · 25 unmodified lines | ||
| 911 | 911 | */ |
| 912 | 912 | } |
| 913 | 913 | } |
| 914 | − | |
| 915 | − /* | |
| 916 | − * Some binaries have overlapping elf segments and then | |
| 917 | − * we have to forcefully map over an existing mapping | |
| 918 | − * e.g. over this newly established brk mapping. | |
| 919 | − */ | |
| 920 | − elf_fixed = MAP_FIXED; | |
| 921 | 914 | } |
| 922 | 915 | |
| 923 | 916 | elf_prot = make_prot(elf_ppnt->p_flags); |
| @@ -930,7 +923,7 @@ out_free_interp: · 6 unmodified lines | ||
| 930 | 923 | * the ET_DYN load_addr calculations, proceed normally. |
| 931 | 924 | */ |
| 932 | 925 | if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) { |
| 933 | − elf_flags |= elf_fixed; | |
| 926 | + elf_flags |= MAP_FIXED; | |
| 934 | 927 | } else if (loc->elf_ex.e_type == ET_DYN) { |
| 935 | 928 | /* |
| 936 | 929 | * This logic is run once for the first LOAD Program |
| @@ -966,7 +959,7 @@ out_free_interp: · 29 unmodified lines | ||
| 966 | 959 | load_bias = ELF_ET_DYN_BASE; |
| 967 | 960 | if (current->flags & PF_RANDOMIZE) |
| 968 | 961 | load_bias += arch_mmap_rnd(); |
| 969 | − elf_flags |= elf_fixed; | |
| 962 | + elf_flags |= MAP_FIXED; | |
| 970 | 963 | } else |
| 971 | 964 | load_bias = 0; |
| 972 | 965 | |
| @@ -1591,7 +1591,6 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, · 1590 unmodified lines | ||
| 1591 | 1591 | struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); |
| 1592 | 1592 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 1593 | 1593 | struct page **pages = NULL; |
| 1594 | − struct extent_state *cached_state = NULL; | |
| 1595 | 1594 | struct extent_changeset *data_reserved = NULL; |
| 1596 | 1595 | u64 release_bytes = 0; |
| 1597 | 1596 | u64 lockstart; |
| @@ -1611,6 +1610,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, · 13 unmodified lines | ||
| 1611 | 1610 | return -ENOMEM; |
| 1612 | 1611 | |
| 1613 | 1612 | while (iov_iter_count(i) > 0) { |
| 1613 | + struct extent_state *cached_state = NULL; | |
| 1614 | 1614 | size_t offset = offset_in_page(pos); |
| 1615 | 1615 | size_t sector_offset; |
| 1616 | 1616 | size_t write_bytes = min(iov_iter_count(i), |
| @@ -1758,9 +1758,20 @@ again: · 141 unmodified lines | ||
| 1758 | 1758 | if (copied > 0) |
| 1759 | 1759 | ret = btrfs_dirty_pages(inode, pages, dirty_pages, |
| 1760 | 1760 | pos, copied, &cached_state); |
| 1761 | + | |
| 1762 | + /* | |
| 1763 | + * If we have not locked the extent range, because the range's | |
| 1764 | + * start offset is >= i_size, we might still have a non-NULL | |
| 1765 | + * cached extent state, acquired while marking the extent range | |
| 1766 | + * as delalloc through btrfs_dirty_pages(). Therefore free any | |
| 1767 | + * possible cached extent state to avoid a memory leak. | |
| 1768 | + */ | |
| 1761 | 1769 | if (extents_locked) |
| 1762 | 1770 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, |
| 1763 | 1771 | lockstart, lockend, &cached_state); |
| 1772 | + else | |
| 1773 | + free_extent_state(cached_state); | |
| 1774 | + | |
| 1764 | 1775 | btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes, |
| 1765 | 1776 | true); |
| 1766 | 1777 | if (ret) { |
| @@ -6305,13 +6305,16 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, · 6304 unmodified lines | ||
| 6305 | 6305 | u32 sizes[2]; |
| 6306 | 6306 | int nitems = name ? 2 : 1; |
| 6307 | 6307 | unsigned long ptr; |
| 6308 | + unsigned int nofs_flag; | |
| 6308 | 6309 | int ret; |
| 6309 | 6310 | |
| 6310 | 6311 | path = btrfs_alloc_path(); |
| 6311 | 6312 | if (!path) |
| 6312 | 6313 | return ERR_PTR(-ENOMEM); |
| 6313 | 6314 | |
| 6315 | + nofs_flag = memalloc_nofs_save(); | |
| 6314 | 6316 | inode = new_inode(fs_info->sb); |
| 6317 | + memalloc_nofs_restore(nofs_flag); | |
| 6315 | 6318 | if (!inode) { |
| 6316 | 6319 | btrfs_free_path(path); |
| 6317 | 6320 | return ERR_PTR(-ENOMEM); |
| @@ -500,7 +500,7 @@ static int process_leaf(struct btrfs_root *root, · 499 unmodified lines | ||
| 500 | 500 | struct btrfs_extent_data_ref *dref; |
| 501 | 501 | struct btrfs_shared_data_ref *sref; |
| 502 | 502 | u32 count; |
| 503 | − int i = 0, tree_block_level = 0, ret; | |
| 503 | + int i = 0, tree_block_level = 0, ret = 0; | |
| 504 | 504 | struct btrfs_key key; |
| 505 | 505 | int nritems = btrfs_header_nritems(leaf); |
| 506 | 506 | |
| @@ -5085,7 +5085,7 @@ static int clone_range(struct send_ctx *sctx, · 5084 unmodified lines | ||
| 5085 | 5085 | struct btrfs_path *path; |
| 5086 | 5086 | struct btrfs_key key; |
| 5087 | 5087 | int ret; |
| 5088 | − u64 clone_src_i_size; | |
| 5088 | + u64 clone_src_i_size = 0; | |
| 5089 | 5089 | |
| 5090 | 5090 | /* |
| 5091 | 5091 | * Prevent cloning from a zero offset with a length matching the sector |
| @@ -2932,7 +2932,8 @@ out: · 2931 unmodified lines | ||
| 2932 | 2932 | * in the tree of log roots |
| 2933 | 2933 | */ |
| 2934 | 2934 | static int update_log_root(struct btrfs_trans_handle *trans, |
| 2935 | − struct btrfs_root *log) | |
| 2935 | + struct btrfs_root *log, | |
| 2936 | + struct btrfs_root_item *root_item) | |
| 2936 | 2937 | { |
| 2937 | 2938 | struct btrfs_fs_info *fs_info = log->fs_info; |
| 2938 | 2939 | int ret; |
| @@ -2940,10 +2941,10 @@ static int update_log_root(struct btrfs_trans_handle *trans, · 1 unmodified line | ||
| 2940 | 2941 | if (log->log_transid == 1) { |
| 2941 | 2942 | /* insert root item on the first sync */ |
| 2942 | 2943 | ret = btrfs_insert_root(trans, fs_info->log_root_tree, |
| 2943 | − &log->root_key, &log->root_item); | |
| 2944 | + &log->root_key, root_item); | |
| 2944 | 2945 | } else { |
| 2945 | 2946 | ret = btrfs_update_root(trans, fs_info->log_root_tree, |
| 2946 | − &log->root_key, &log->root_item); | |
| 2947 | + &log->root_key, root_item); | |
| 2947 | 2948 | } |
| 2948 | 2949 | return ret; |
| 2949 | 2950 | } |
| @@ -3041,6 +3042,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, · 91 unmodified lines | ||
| 3041 | 3042 | struct btrfs_fs_info *fs_info = root->fs_info; |
| 3042 | 3043 | struct btrfs_root *log = root->log_root; |
| 3043 | 3044 | struct btrfs_root *log_root_tree = fs_info->log_root_tree; |
| 3045 | + struct btrfs_root_item new_root_item; | |
| 3044 | 3046 | int log_transid = 0; |
| 3045 | 3047 | struct btrfs_log_ctx root_log_ctx; |
| 3046 | 3048 | struct blk_plug plug; |
| @@ -3104,17 +3106,25 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, · 57 unmodified lines | ||
| 3104 | 3106 | goto out; |
| 3105 | 3107 | } |
| 3106 | 3108 | |
| 3109 | + /* | |
| 3110 | + * We _must_ update under the root->log_mutex in order to make sure we | |
| 3111 | + * have a consistent view of the log root we are trying to commit at | |
| 3112 | + * this moment. | |
| 3113 | + * | |
| 3114 | + * We _must_ copy this into a local copy, because we are not holding the | |
| 3115 | + * log_root_tree->log_mutex yet. This is important because when we | |
| 3116 | + * commit the log_root_tree we must have a consistent view of the | |
| 3117 | + * log_root_tree when we update the super block to point at the | |
| 3118 | + * log_root_tree bytenr. If we update the log_root_tree here we'll race | |
| 3119 | + * with the commit and possibly point at the new block which we may not | |
| 3120 | + * have written out. | |
| 3121 | + */ | |
| 3107 | 3122 | btrfs_set_root_node(&log->root_item, log->node); |
| 3123 | + memcpy(&new_root_item, &log->root_item, sizeof(new_root_item)); | |
| 3108 | 3124 | |
| 3109 | 3125 | root->log_transid++; |
| 3110 | 3126 | log->log_transid = root->log_transid; |
| 3111 | 3127 | root->log_start_pid = 0; |
| 3112 | − /* | |
| 3113 | − * Update or create log root item under the root's log_mutex to prevent | |
| 3114 | − * races with concurrent log syncs that can lead to failure to update | |
| 3115 | − * log root item because it was not created yet. | |
| 3116 | − */ | |
| 3117 | − ret = update_log_root(trans, log); | |
| 3118 | 3128 | /* |
| 3119 | 3129 | * IO has been started, blocks of the log tree have WRITTEN flag set |
| 3120 | 3130 | * in their headers. new modifications of the log will be written to |
| @@ -3135,6 +3145,14 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, · 14 unmodified lines | ||
| 3135 | 3145 | mutex_unlock(&log_root_tree->log_mutex); |
| 3136 | 3146 | |
| 3137 | 3147 | mutex_lock(&log_root_tree->log_mutex); |
| 3148 | + | |
| 3149 | + /* | |
| 3150 | + * Now we are safe to update the log_root_tree because we're under the | |
| 3151 | + * log_mutex, and we're a current writer so we're holding the commit | |
| 3152 | + * open until we drop the log_mutex. | |
| 3153 | + */ | |
| 3154 | + ret = update_log_root(trans, log, &new_root_item); | |
| 3155 | + | |
| 3138 | 3156 | if (atomic_dec_and_test(&log_root_tree->log_writers)) { |
| 3139 | 3157 | /* atomic_dec_and_test implies a barrier */ |
| 3140 | 3158 | cond_wake_up_nomb(&log_root_tree->log_writer_wait); |
| @@ -3845,7 +3845,11 @@ static int alloc_profile_is_valid(u64 flags, int extended) · 3844 unmodified lines | ||
| 3845 | 3845 | return !extended; /* "0" is valid for usual profiles */ |
| 3846 | 3846 | |
| 3847 | 3847 | /* true if exactly one bit set */ |
| 3848 | − return is_power_of_2(flags); | |
| 3848 | + /* | |
| 3849 | + * Don't use is_power_of_2(unsigned long) because it won't work | |
| 3850 | + * for the single profile (1ULL << 48) on 32-bit CPUs. | |
| 3851 | + */ | |
| 3852 | + return flags != 0 && (flags & (flags - 1)) == 0; | |
| 3849 | 3853 | } |
| 3850 | 3854 | |
| 3851 | 3855 | static inline int balance_need_close(struct btrfs_fs_info *fs_info) |
| @@ -169,18 +169,26 @@ cifs_read_super(struct super_block *sb) · 168 unmodified lines | ||
| 169 | 169 | else |
| 170 | 170 | sb->s_maxbytes = MAX_NON_LFS; |
| 171 | 171 | |
| 172 | − /* BB FIXME fix time_gran to be larger for LANMAN sessions */ | |
| 173 | − sb->s_time_gran = 100; | |
| 174 | − | |
| 175 | − if (tcon->unix_ext) { | |
| 176 | − ts = cifs_NTtimeToUnix(0); | |
| 172 | + /* Some very old servers like DOS and OS/2 used 2 second granularity */ | |
| 173 | + if ((tcon->ses->server->vals->protocol_id == SMB10_PROT_ID) && | |
| 174 | + ((tcon->ses->capabilities & | |
| 175 | + tcon->ses->server->vals->cap_nt_find) == 0) && | |
| 176 | + !tcon->unix_ext) { | |
| 177 | + sb->s_time_gran = 1000000000; /* 1 second is max allowed gran */ | |
| 178 | + ts = cnvrtDosUnixTm(cpu_to_le16(SMB_DATE_MIN), 0, 0); | |
| 177 | 179 | sb->s_time_min = ts.tv_sec; |
| 178 | − ts = cifs_NTtimeToUnix(cpu_to_le64(S64_MAX)); | |
| 180 | + ts = cnvrtDosUnixTm(cpu_to_le16(SMB_DATE_MAX), | |
| 181 | + cpu_to_le16(SMB_TIME_MAX), 0); | |
| 179 | 182 | sb->s_time_max = ts.tv_sec; |
| 180 | 183 | } else { |
| 181 | − ts = cnvrtDosUnixTm(cpu_to_le16(SMB_DATE_MIN), 0, 0); | |
| 184 | + /* | |
| 185 | + * Almost every server, including all SMB2+, uses DCE TIME | |
| 186 | + * ie 100 nanosecond units, since 1601. See MS-DTYP and MS-FSCC | |
| 187 | + */ | |
| 188 | + sb->s_time_gran = 100; | |
| 189 | + ts = cifs_NTtimeToUnix(0); | |
| 182 | 190 | sb->s_time_min = ts.tv_sec; |
| 183 | − ts = cnvrtDosUnixTm(cpu_to_le16(SMB_DATE_MAX), cpu_to_le16(SMB_TIME_MAX), 0); | |
| 191 | + ts = cifs_NTtimeToUnix(cpu_to_le64(S64_MAX)); | |
| 184 | 192 | sb->s_time_max = ts.tv_sec; |
| 185 | 193 | } |
| 186 | 194 | |
| @@ -1210,7 +1210,7 @@ struct cifs_search_info { · 1209 unmodified lines | ||
| 1210 | 1210 | bool smallBuf:1; /* so we know which buf_release function to call */ |
| 1211 | 1211 | }; |
| 1212 | 1212 | |
| 1213 | −#define ACL_NO_MODE -1 | |
| 1213 | +#define ACL_NO_MODE ((umode_t)(-1)) | |
| 1214 | 1214 | struct cifs_open_parms { |
| 1215 | 1215 | struct cifs_tcon *tcon; |
| 1216 | 1216 | struct cifs_sb_info *cifs_sb; |
| @@ -4264,7 +4264,7 @@ static int mount_get_conns(struct smb_vol *vol, struct cifs_sb_info *cifs_sb, · 4263 unmodified lines | ||
| 4264 | 4264 | server->ops->qfs_tcon(*xid, tcon); |
| 4265 | 4265 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE) { |
| 4266 | 4266 | if (tcon->fsDevInfo.DeviceCharacteristics & |
| 4267 | − FILE_READ_ONLY_DEVICE) | |
| 4267 | + cpu_to_le32(FILE_READ_ONLY_DEVICE)) | |
| 4268 | 4268 | cifs_dbg(VFS, "mounted to read only share\n"); |
| 4269 | 4269 | else if ((cifs_sb->mnt_cifs_flags & |
| 4270 | 4270 | CIFS_MOUNT_RW_CACHE) == 0) |
| @@ -4445,7 +4445,7 @@ static int setup_dfs_tgt_conn(const char *path, · 174 unmodified lines | ||
| 4445 | 4445 | int rc; |
| 4446 | 4446 | struct dfs_info3_param ref = {0}; |
| 4447 | 4447 | char *mdata = NULL, *fake_devname = NULL; |
| 4448 | − struct smb_vol fake_vol = {0}; | |
| 4448 | + struct smb_vol fake_vol = {NULL}; | |
| 4449 | 4449 | |
| 4450 | 4450 | cifs_dbg(FYI, "%s: dfs path: %s\n", __func__, path); |
| 4451 | 4451 | |
| @@ -738,10 +738,16 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, · 737 unmodified lines | ||
| 738 | 738 | static int |
| 739 | 739 | cifs_d_revalidate(struct dentry *direntry, unsigned int flags) |
| 740 | 740 | { |
| 741 | + struct inode *inode; | |
| 742 | + | |
| 741 | 743 | if (flags & LOOKUP_RCU) |
| 742 | 744 | return -ECHILD; |
| 743 | 745 | |
| 744 | 746 | if (d_really_is_positive(direntry)) { |
| 747 | + inode = d_inode(direntry); | |
| 748 | + if ((flags & LOOKUP_REVAL) && !CIFS_CACHE_READ(CIFS_I(inode))) | |
| 749 | + CIFS_I(inode)->time = 0; /* force reval */ | |
| 750 | + | |
| 745 | 751 | if (cifs_revalidate_dentry(direntry)) |
| 746 | 752 | return 0; |
| 747 | 753 | else { |
| @@ -752,7 +758,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags) · 4 unmodified lines | ||
| 752 | 758 | * attributes will have been updated by |
| 753 | 759 | * cifs_revalidate_dentry(). |
| 754 | 760 | */ |
| 755 | − if (IS_AUTOMOUNT(d_inode(direntry)) && | |
| 761 | + if (IS_AUTOMOUNT(inode) && | |
| 756 | 762 | !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) { |
| 757 | 763 | spin_lock(&direntry->d_lock); |
| 758 | 764 | direntry->d_flags |= DCACHE_NEED_AUTOMOUNT; |
| @@ -253,6 +253,12 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, · 252 unmodified lines | ||
| 253 | 253 | rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb, |
| 254 | 254 | xid, fid); |
| 255 | 255 | |
| 256 | + if (rc) { | |
| 257 | + server->ops->close(xid, tcon, fid); | |
| 258 | + if (rc == -ESTALE) | |
| 259 | + rc = -EOPENSTALE; | |
| 260 | + } | |
| 261 | + | |
| 256 | 262 | out: |
| 257 | 263 | kfree(buf); |
| 258 | 264 | return rc; |
| @@ -1840,13 +1846,12 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode, · 1581 unmodified lines | ||
| 1840 | 1846 | { |
| 1841 | 1847 | struct cifsFileInfo *open_file = NULL; |
| 1842 | 1848 | struct cifs_sb_info *cifs_sb = CIFS_SB(cifs_inode->vfs_inode.i_sb); |
| 1843 | − struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); | |
| 1844 | 1849 | |
| 1845 | 1850 | /* only filter by fsuid on multiuser mounts */ |
| 1846 | 1851 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)) |
| 1847 | 1852 | fsuid_only = false; |
| 1848 | 1853 | |
| 1849 | − spin_lock(&tcon->open_file_lock); | |
| 1854 | + spin_lock(&cifs_inode->open_file_lock); | |
| 1850 | 1855 | /* we could simply get the first_list_entry since write-only entries |
| 1851 | 1856 | are always at the end of the list but since the first entry might |
| 1852 | 1857 | have a close pending, we go through the whole list */ |
| @@ -1858,7 +1863,7 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode, · 5 unmodified lines | ||
| 1858 | 1863 | /* found a good file */ |
| 1859 | 1864 | /* lock it so it will not be closed on us */ |
| 1860 | 1865 | cifsFileInfo_get(open_file); |
| 1861 | − spin_unlock(&tcon->open_file_lock); | |
| 1866 | + spin_unlock(&cifs_inode->open_file_lock); | |
| 1862 | 1867 | return open_file; |
| 1863 | 1868 | } /* else might as well continue, and look for |
| 1864 | 1869 | another, or simply have the caller reopen it |
| @@ -1866,7 +1871,7 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode, · 1 unmodified line | ||
| 1866 | 1871 | } else /* write only file */ |
| 1867 | 1872 | break; /* write only files are last so must be done */ |
| 1868 | 1873 | } |
| 1869 | − spin_unlock(&tcon->open_file_lock); | |
| 1874 | + spin_unlock(&cifs_inode->open_file_lock); | |
| 1870 | 1875 | return NULL; |
| 1871 | 1876 | } |
| 1872 | 1877 | |
| @@ -1877,7 +1882,6 @@ cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only, · 4 unmodified lines | ||
| 1877 | 1882 | { |
| 1878 | 1883 | struct cifsFileInfo *open_file, *inv_file = NULL; |
| 1879 | 1884 | struct cifs_sb_info *cifs_sb; |
| 1880 | − struct cifs_tcon *tcon; | |
| 1881 | 1885 | bool any_available = false; |
| 1882 | 1886 | int rc = -EBADF; |
| 1883 | 1887 | unsigned int refind = 0; |
| @@ -1897,16 +1901,15 @@ cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only, · 13 unmodified lines | ||
| 1897 | 1901 | } |
| 1898 | 1902 | |
| 1899 | 1903 | cifs_sb = CIFS_SB(cifs_inode->vfs_inode.i_sb); |
| 1900 | − tcon = cifs_sb_master_tcon(cifs_sb); | |
| 1901 | 1904 | |
| 1902 | 1905 | /* only filter by fsuid on multiuser mounts */ |
| 1903 | 1906 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)) |
| 1904 | 1907 | fsuid_only = false; |
| 1905 | 1908 | |
| 1906 | − spin_lock(&tcon->open_file_lock); | |
| 1909 | + spin_lock(&cifs_inode->open_file_lock); | |
| 1907 | 1910 | refind_writable: |
| 1908 | 1911 | if (refind > MAX_REOPEN_ATT) { |
| 1909 | − spin_unlock(&tcon->open_file_lock); | |
| 1912 | + spin_unlock(&cifs_inode->open_file_lock); | |
| 1910 | 1913 | return rc; |
| 1911 | 1914 | } |
| 1912 | 1915 | list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { |
| @@ -1918,7 +1921,7 @@ refind_writable: · 5 unmodified lines | ||
| 1918 | 1921 | if (!open_file->invalidHandle) { |
| 1919 | 1922 | /* found a good writable file */ |
| 1920 | 1923 | cifsFileInfo_get(open_file); |
| 1921 | − spin_unlock(&tcon->open_file_lock); | |
| 1924 | + spin_unlock(&cifs_inode->open_file_lock); | |
| 1922 | 1925 | *ret_file = open_file; |
| 1923 | 1926 | return 0; |
| 1924 | 1927 | } else { |
| @@ -1938,7 +1941,7 @@ refind_writable: · 13 unmodified lines | ||
| 1938 | 1941 | cifsFileInfo_get(inv_file); |
| 1939 | 1942 | } |
| 1940 | 1943 | |
| 1941 | − spin_unlock(&tcon->open_file_lock); | |
| 1944 | + spin_unlock(&cifs_inode->open_file_lock); | |
| 1942 | 1945 | |
| 1943 | 1946 | if (inv_file) { |
| 1944 | 1947 | rc = cifs_reopen_file(inv_file, false); |
| @@ -1953,7 +1956,7 @@ refind_writable: · 8 unmodified lines | ||
| 1953 | 1956 | cifsFileInfo_put(inv_file); |
| 1954 | 1957 | ++refind; |
| 1955 | 1958 | inv_file = NULL; |
| 1956 | − spin_lock(&tcon->open_file_lock); | |
| 1959 | + spin_lock(&cifs_inode->open_file_lock); | |
| 1957 | 1960 | goto refind_writable; |
| 1958 | 1961 | } |
| 1959 | 1962 | |
| @@ -4461,17 +4464,15 @@ static int cifs_readpage(struct file *file, struct page *page) · 2501 unmodified lines | ||
| 4461 | 4464 | static int is_inode_writable(struct cifsInodeInfo *cifs_inode) |
| 4462 | 4465 | { |
| 4463 | 4466 | struct cifsFileInfo *open_file; |
| 4464 | − struct cifs_tcon *tcon = | |
| 4465 | − cifs_sb_master_tcon(CIFS_SB(cifs_inode->vfs_inode.i_sb)); | |
| 4466 | 4467 | |
| 4467 | − spin_lock(&tcon->open_file_lock); | |
| 4468 | + spin_lock(&cifs_inode->open_file_lock); | |
| 4468 | 4469 | list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { |
| 4469 | 4470 | if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) { |
| 4470 | − spin_unlock(&tcon->open_file_lock); | |
| 4471 | + spin_unlock(&cifs_inode->open_file_lock); | |
| 4471 | 4472 | return 1; |
| 4472 | 4473 | } |
| 4473 | 4474 | } |
| 4474 | − spin_unlock(&tcon->open_file_lock); | |
| 4475 | + spin_unlock(&cifs_inode->open_file_lock); | |
| 4475 | 4476 | return 0; |
| 4476 | 4477 | } |
| 4477 | 4478 | |
| @@ -414,6 +414,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, · 413 unmodified lines | ||
| 414 | 414 | /* if uniqueid is different, return error */ |
| 415 | 415 | if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM && |
| 416 | 416 | CIFS_I(*pinode)->uniqueid != fattr.cf_uniqueid)) { |
| 417 | + CIFS_I(*pinode)->time = 0; /* force reval */ | |
| 417 | 418 | rc = -ESTALE; |
| 418 | 419 | goto cgiiu_exit; |
| 419 | 420 | } |
| @@ -421,6 +422,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, · 1 unmodified line | ||
| 421 | 422 | /* if filetype is different, return error */ |
| 422 | 423 | if (unlikely(((*pinode)->i_mode & S_IFMT) != |
| 423 | 424 | (fattr.cf_mode & S_IFMT))) { |
| 425 | + CIFS_I(*pinode)->time = 0; /* force reval */ | |
| 424 | 426 | rc = -ESTALE; |
| 425 | 427 | goto cgiiu_exit; |
| 426 | 428 | } |
| @@ -933,6 +935,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, · 506 unmodified lines | ||
| 933 | 935 | /* if uniqueid is different, return error */ |
| 934 | 936 | if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM && |
| 935 | 937 | CIFS_I(*inode)->uniqueid != fattr.cf_uniqueid)) { |
| 938 | + CIFS_I(*inode)->time = 0; /* force reval */ | |
| 936 | 939 | rc = -ESTALE; |
| 937 | 940 | goto cgii_exit; |
| 938 | 941 | } |
| @@ -940,6 +943,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, · 1 unmodified line | ||
| 940 | 943 | /* if filetype is different, return error */ |
| 941 | 944 | if (unlikely(((*inode)->i_mode & S_IFMT) != |
| 942 | 945 | (fattr.cf_mode & S_IFMT))) { |
| 946 | + CIFS_I(*inode)->time = 0; /* force reval */ | |
| 943 | 947 | rc = -ESTALE; |
| 944 | 948 | goto cgii_exit; |
| 945 | 949 | } |
| @@ -117,10 +117,6 @@ static const struct smb_to_posix_error mapping_table_ERRSRV[] = { · 116 unmodified lines | ||
| 117 | 117 | {0, 0} |
| 118 | 118 | }; |
| 119 | 119 | |
| 120 | −static const struct smb_to_posix_error mapping_table_ERRHRD[] = { | |
| 121 | − {0, 0} | |
| 122 | −}; | |
| 123 | − | |
| 124 | 120 | /* |
| 125 | 121 | * Convert a string containing text IPv4 or IPv6 address to binary form. |
| 126 | 122 | * |
| @@ -751,8 +751,8 @@ add_posix_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode) · 750 unmodified lines | ||
| 751 | 751 | unsigned int num = *num_iovec; |
| 752 | 752 | |
| 753 | 753 | iov[num].iov_base = create_posix_buf(mode); |
| 754 | − if (mode == -1) | |
| 755 | − cifs_dbg(VFS, "illegal mode\n"); /* BB REMOVEME */ | |
| 754 | + if (mode == ACL_NO_MODE) | |
| 755 | + cifs_dbg(FYI, "illegal mode\n"); | |
| 756 | 756 | if (iov[num].iov_base == NULL) |
| 757 | 757 | return -ENOMEM; |
| 758 | 758 | iov[num].iov_len = sizeof(struct create_posix); |
| @@ -2521,11 +2521,8 @@ SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, __u8 *oplock, · 1762 unmodified lines | ||
| 2521 | 2521 | return rc; |
| 2522 | 2522 | } |
| 2523 | 2523 | |
| 2524 | − /* TODO: add handling for the mode on create */ | |
| 2525 | − if (oparms->disposition == FILE_CREATE) | |
| 2526 | − cifs_dbg(VFS, "mode is 0x%x\n", oparms->mode); /* BB REMOVEME */ | |
| 2527 | − | |
| 2528 | − if ((oparms->disposition == FILE_CREATE) && (oparms->mode != -1)) { | |
| 2524 | + if ((oparms->disposition == FILE_CREATE) && | |
| 2525 | + (oparms->mode != ACL_NO_MODE)) { | |
| 2529 | 2526 | if (n_iov > 2) { |
| 2530 | 2527 | struct create_context *ccontext = |
| 2531 | 2528 | (struct create_context *)iov[n_iov-1].iov_base; |
| @@ -3217,7 +3214,8 @@ SMB2_notify_init(const unsigned int xid, struct smb_rqst *rqst, · 685 unmodified lines | ||
| 3217 | 3214 | |
| 3218 | 3215 | req->PersistentFileId = persistent_fid; |
| 3219 | 3216 | req->VolatileFileId = volatile_fid; |
| 3220 | − req->OutputBufferLength = SMB2_MAX_BUFFER_SIZE - MAX_SMB2_HDR_SIZE; | |
| 3217 | + req->OutputBufferLength = | |
| 3218 | + cpu_to_le32(SMB2_MAX_BUFFER_SIZE - MAX_SMB2_HDR_SIZE); | |
| 3221 | 3219 | req->CompletionFilter = cpu_to_le32(completion_filter); |
| 3222 | 3220 | if (watch_tree) |
| 3223 | 3221 | req->Flags = cpu_to_le16(SMB2_WATCH_TREE); |
| @@ -150,6 +150,10 @@ extern int SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, · 149 unmodified lines | ||
| 150 | 150 | bool is_fsctl, char *in_data, u32 indatalen, |
| 151 | 151 | __u32 max_response_size); |
| 152 | 152 | extern void SMB2_ioctl_free(struct smb_rqst *rqst); |
| 153 | +extern int SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon, | |
| 154 | + u64 persistent_fid, u64 volatile_fid, bool watch_tree, | |
| 155 | + u32 completion_filter); | |
| 156 | + | |
| 153 | 157 | extern int SMB2_close(const unsigned int xid, struct cifs_tcon *tcon, |
| 154 | 158 | u64 persistent_file_id, u64 volatile_file_id); |
| 155 | 159 | extern int SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon, |
| @@ -241,9 +241,8 @@ void dio_warn_stale_pagecache(struct file *filp) · 240 unmodified lines | ||
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | −/** | |
| 244 | +/* | |
| 245 | 245 | * dio_complete() - called when all DIO BIO I/O has been completed |
| 246 | − * @offset: the byte offset in the file of the completed operation | |
| 247 | 246 | * |
| 248 | 247 | * This drops i_dio_count, lets interested parties know that a DIO operation |
| 249 | 248 | * has completed, and calculates the resulting return code for the operation. |
| @@ -5835,7 +5835,7 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id, · 5834 unmodified lines | ||
| 5835 | 5835 | /* Don't account quota for quota files to avoid recursion */ |
| 5836 | 5836 | qf_inode->i_flags |= S_NOQUOTA; |
| 5837 | 5837 | lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA); |
| 5838 | − err = dquot_enable(qf_inode, type, format_id, flags); | |
| 5838 | + err = dquot_load_quota_inode(qf_inode, type, format_id, flags); | |
| 5839 | 5839 | if (err) |
| 5840 | 5840 | lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL); |
| 5841 | 5841 | iput(qf_inode); |
| @@ -1932,7 +1932,7 @@ static int f2fs_quota_enable(struct super_block *sb, int type, int format_id, · 1931 unmodified lines | ||
| 1932 | 1932 | |
| 1933 | 1933 | /* Don't account quota for quota files to avoid recursion */ |
| 1934 | 1934 | qf_inode->i_flags |= S_NOQUOTA; |
| 1935 | − err = dquot_enable(qf_inode, type, format_id, flags); | |
| 1935 | + err = dquot_load_quota_inode(qf_inode, type, format_id, flags); | |
| 1936 | 1936 | iput(qf_inode); |
| 1937 | 1937 | return err; |
| 1938 | 1938 | } |
| @@ -164,8 +164,13 @@ static void finish_writeback_work(struct bdi_writeback *wb, · 163 unmodified lines | ||
| 164 | 164 | |
| 165 | 165 | if (work->auto_free) |
| 166 | 166 | kfree(work); |
| 167 | − if (done && atomic_dec_and_test(&done->cnt)) | |
| 168 | − wake_up_all(done->waitq); | |
| 167 | + if (done) { | |
| 168 | + wait_queue_head_t *waitq = done->waitq; | |
| 169 | + | |
| 170 | + /* @done can't be accessed after the following dec */ | |
| 171 | + if (atomic_dec_and_test(&done->cnt)) | |
| 172 | + wake_up_all(waitq); | |
| 173 | + } | |
| 169 | 174 | } |
| 170 | 175 | |
| 171 | 176 | static void wb_queue_work(struct bdi_writeback *wb, |
| @@ -900,7 +905,7 @@ restart: · 728 unmodified lines | ||
| 900 | 905 | * cgroup_writeback_by_id - initiate cgroup writeback from bdi and memcg IDs |
| 901 | 906 | * @bdi_id: target bdi id |
| 902 | 907 | * @memcg_id: target memcg css id |
| 903 | − * @nr_pages: number of pages to write, 0 for best-effort dirty flushing | |
| 908 | + * @nr: number of pages to write, 0 for best-effort dirty flushing | |
| 904 | 909 | * @reason: reason why some writeback work initiated |
| 905 | 910 | * @done: target wb_completion |
| 906 | 911 | * |
| @@ -415,27 +415,27 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 414 unmodified lines | ||
| 415 | 415 | return ctx; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | +static inline bool __io_sequence_defer(struct io_ring_ctx *ctx, | |
| 419 | + struct io_kiocb *req) | |
| 420 | +{ | |
| 421 | + return req->sequence != ctx->cached_cq_tail + ctx->rings->sq_dropped; | |
| 422 | +} | |
| 423 | + | |
| 418 | 424 | static inline bool io_sequence_defer(struct io_ring_ctx *ctx, |
| 419 | 425 | struct io_kiocb *req) |
| 420 | 426 | { |
| 421 | − /* timeout requests always honor sequence */ | |
| 422 | − if (!(req->flags & REQ_F_TIMEOUT) && | |
| 423 | − (req->flags & (REQ_F_IO_DRAIN|REQ_F_IO_DRAINED)) != REQ_F_IO_DRAIN) | |
| 427 | + if ((req->flags & (REQ_F_IO_DRAIN|REQ_F_IO_DRAINED)) != REQ_F_IO_DRAIN) | |
| 424 | 428 | return false; |
| 425 | 429 | |
| 426 | − return req->sequence != ctx->cached_cq_tail + ctx->rings->sq_dropped; | |
| 430 | + return __io_sequence_defer(ctx, req); | |
| 427 | 431 | } |
| 428 | 432 | |
| 429 | −static struct io_kiocb *__io_get_deferred_req(struct io_ring_ctx *ctx, | |
| 430 | − struct list_head *list) | |
| 433 | +static struct io_kiocb *io_get_deferred_req(struct io_ring_ctx *ctx) | |
| 431 | 434 | { |
| 432 | 435 | struct io_kiocb *req; |
| 433 | 436 | |
| 434 | − if (list_empty(list)) | |
| 435 | − return NULL; | |
| 436 | − | |
| 437 | − req = list_first_entry(list, struct io_kiocb, list); | |
| 438 | − if (!io_sequence_defer(ctx, req)) { | |
| 437 | + req = list_first_entry_or_null(&ctx->defer_list, struct io_kiocb, list); | |
| 438 | + if (req && !io_sequence_defer(ctx, req)) { | |
| 439 | 439 | list_del_init(&req->list); |
| 440 | 440 | return req; |
| 441 | 441 | } |
| @@ -443,14 +443,17 @@ static struct io_kiocb *__io_get_deferred_req(struct io_ring_ctx *ctx, · 1 unmodified line | ||
| 443 | 443 | return NULL; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | −static struct io_kiocb *io_get_deferred_req(struct io_ring_ctx *ctx) | |
| 447 | −{ | |
| 448 | − return __io_get_deferred_req(ctx, &ctx->defer_list); | |
| 449 | −} | |
| 450 | − | |
| 451 | 446 | static struct io_kiocb *io_get_timeout_req(struct io_ring_ctx *ctx) |
| 452 | 447 | { |
| 453 | − return __io_get_deferred_req(ctx, &ctx->timeout_list); | |
| 448 | + struct io_kiocb *req; | |
| 449 | + | |
| 450 | + req = list_first_entry_or_null(&ctx->timeout_list, struct io_kiocb, list); | |
| 451 | + if (req && !__io_sequence_defer(ctx, req)) { | |
| 452 | + list_del_init(&req->list); | |
| 453 | + return req; | |
| 454 | + } | |
| 455 | + | |
| 456 | + return NULL; | |
| 454 | 457 | } |
| 455 | 458 | |
| 456 | 459 | static void __io_commit_cqring(struct io_ring_ctx *ctx) |
| @@ -591,14 +594,6 @@ static void io_cqring_add_event(struct io_ring_ctx *ctx, u64 user_data, · 134 unmodified lines | ||
| 591 | 594 | io_cqring_ev_posted(ctx); |
| 592 | 595 | } |
| 593 | 596 | |
| 594 | −static void io_ring_drop_ctx_refs(struct io_ring_ctx *ctx, unsigned refs) | |
| 595 | −{ | |
| 596 | − percpu_ref_put_many(&ctx->refs, refs); | |
| 597 | − | |
| 598 | − if (waitqueue_active(&ctx->wait)) | |
| 599 | − wake_up(&ctx->wait); | |
| 600 | −} | |
| 601 | − | |
| 602 | 597 | static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx, |
| 603 | 598 | struct io_submit_state *state) |
| 604 | 599 | { |
| @@ -646,7 +641,7 @@ static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx, · 41 unmodified lines | ||
| 646 | 641 | req->result = 0; |
| 647 | 642 | return req; |
| 648 | 643 | out: |
| 649 | − io_ring_drop_ctx_refs(ctx, 1); | |
| 644 | + percpu_ref_put(&ctx->refs); | |
| 650 | 645 | return NULL; |
| 651 | 646 | } |
| 652 | 647 | |
| @@ -654,7 +649,7 @@ static void io_free_req_many(struct io_ring_ctx *ctx, void **reqs, int *nr) · 1 unmodified line | ||
| 654 | 649 | { |
| 655 | 650 | if (*nr) { |
| 656 | 651 | kmem_cache_free_bulk(req_cachep, *nr, reqs); |
| 657 | − io_ring_drop_ctx_refs(ctx, *nr); | |
| 652 | + percpu_ref_put_many(&ctx->refs, *nr); | |
| 658 | 653 | *nr = 0; |
| 659 | 654 | } |
| 660 | 655 | } |
| @@ -663,7 +658,7 @@ static void __io_free_req(struct io_kiocb *req) · 2 unmodified lines | ||
| 663 | 658 | { |
| 664 | 659 | if (req->file && !(req->flags & REQ_F_FIXED_FILE)) |
| 665 | 660 | fput(req->file); |
| 666 | − io_ring_drop_ctx_refs(req->ctx, 1); | |
| 661 | + percpu_ref_put(&req->ctx->refs); | |
| 667 | 662 | kmem_cache_free(req_cachep, req); |
| 668 | 663 | } |
| 669 | 664 | |
| @@ -1892,15 +1887,15 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 1222 unmodified lines | ||
| 1892 | 1887 | unsigned count, req_dist, tail_index; |
| 1893 | 1888 | struct io_ring_ctx *ctx = req->ctx; |
| 1894 | 1889 | struct list_head *entry; |
| 1895 | − struct timespec ts; | |
| 1890 | + struct timespec64 ts; | |
| 1896 | 1891 | |
| 1897 | 1892 | if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) |
| 1898 | 1893 | return -EINVAL; |
| 1899 | 1894 | if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->timeout_flags || |
| 1900 | 1895 | sqe->len != 1) |
| 1901 | 1896 | return -EINVAL; |
| 1902 | − if (copy_from_user(&ts, (void __user *) (unsigned long) sqe->addr, | |
| 1903 | − sizeof(ts))) | |
| 1897 | + | |
| 1898 | + if (get_timespec64(&ts, u64_to_user_ptr(sqe->addr))) | |
| 1904 | 1899 | return -EFAULT; |
| 1905 | 1900 | |
| 1906 | 1901 | /* |
| @@ -1934,7 +1929,7 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 27 unmodified lines | ||
| 1934 | 1929 | |
| 1935 | 1930 | hrtimer_init(&req->timeout.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
| 1936 | 1931 | req->timeout.timer.function = io_timeout_fn; |
| 1937 | − hrtimer_start(&req->timeout.timer, timespec_to_ktime(ts), | |
| 1932 | + hrtimer_start(&req->timeout.timer, timespec64_to_ktime(ts), | |
| 1938 | 1933 | HRTIMER_MODE_REL); |
| 1939 | 1934 | return 0; |
| 1940 | 1935 | } |
| @@ -2761,7 +2756,7 @@ out: · 820 unmodified lines | ||
| 2761 | 2756 | |
| 2762 | 2757 | if (link) |
| 2763 | 2758 | io_queue_link_head(ctx, link, &link->submit, shadow_req, |
| 2764 | − block_for_last); | |
| 2759 | + !block_for_last); | |
| 2765 | 2760 | if (statep) |
| 2766 | 2761 | io_submit_state_end(statep); |
| 2767 | 2762 | |
| @@ -2920,8 +2915,12 @@ static void io_finish_async(struct io_ring_ctx *ctx) · 152 unmodified lines | ||
| 2920 | 2915 | static void io_destruct_skb(struct sk_buff *skb) |
| 2921 | 2916 | { |
| 2922 | 2917 | struct io_ring_ctx *ctx = skb->sk->sk_user_data; |
| 2918 | + int i; | |
| 2919 | + | |
| 2920 | + for (i = 0; i < ARRAY_SIZE(ctx->sqo_wq); i++) | |
| 2921 | + if (ctx->sqo_wq[i]) | |
| 2922 | + flush_workqueue(ctx->sqo_wq[i]); | |
| 2923 | 2923 | |
| 2924 | − io_finish_async(ctx); | |
| 2925 | 2924 | unix_destruct_scm(skb); |
| 2926 | 2925 | } |
| 2927 | 2926 | |
| @@ -3630,7 +3629,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 702 unmodified lines | ||
| 3630 | 3629 | } |
| 3631 | 3630 | } |
| 3632 | 3631 | |
| 3633 | − io_ring_drop_ctx_refs(ctx, 1); | |
| 3632 | + percpu_ref_put(&ctx->refs); | |
| 3634 | 3633 | out_fput: |
| 3635 | 3634 | fdput(f); |
| 3636 | 3635 | return submitted ? submitted : ret; |
| @@ -89,58 +89,45 @@ int dcache_dir_close(struct inode *inode, struct file *file) · 88 unmodified lines | ||
| 89 | 89 | EXPORT_SYMBOL(dcache_dir_close); |
| 90 | 90 | |
| 91 | 91 | /* parent is locked at least shared */ |
| 92 | −static struct dentry *next_positive(struct dentry *parent, | |
| 93 | − struct list_head *from, | |
| 94 | − int count) | |
| 92 | +/* | |
| 93 | + * Returns an element of siblings' list. | |
| 94 | + * We are looking for <count>th positive after <p>; if | |
| 95 | + * found, dentry is grabbed and returned to caller. | |
| 96 | + * If no such element exists, NULL is returned. | |
| 97 | + */ | |
| 98 | +static struct dentry *scan_positives(struct dentry *cursor, | |
| 99 | + struct list_head *p, | |
| 100 | + loff_t count, | |
| 101 | + struct dentry *last) | |
| 95 | 102 | { |
| 96 | − unsigned *seq = &parent->d_inode->i_dir_seq, n; | |
| 97 | − struct dentry *res; | |
| 98 | − struct list_head *p; | |
| 99 | − bool skipped; | |
| 100 | − int i; | |
| 103 | + struct dentry *dentry = cursor->d_parent, *found = NULL; | |
| 101 | 104 | |
| 102 | −retry: | |
| 103 | − i = count; | |
| 104 | − skipped = false; | |
| 105 | − n = smp_load_acquire(seq) & ~1; | |
| 106 | − res = NULL; | |
| 107 | − rcu_read_lock(); | |
| 108 | − for (p = from->next; p != &parent->d_subdirs; p = p->next) { | |
| 105 | + spin_lock(&dentry->d_lock); | |
| 106 | + while ((p = p->next) != &dentry->d_subdirs) { | |
| 109 | 107 | struct dentry *d = list_entry(p, struct dentry, d_child); |
| 110 | − if (!simple_positive(d)) { | |
| 111 | − skipped = true; | |
| 112 | − } else if (!--i) { | |
| 113 | − res = d; | |
| 114 | − break; | |
| 108 | + // we must at least skip cursors, to avoid livelocks | |
| 109 | + if (d->d_flags & DCACHE_DENTRY_CURSOR) | |
| 110 | + continue; | |
| 111 | + if (simple_positive(d) && !--count) { | |
| 112 | + spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED); | |
| 113 | + if (simple_positive(d)) | |
| 114 | + found = dget_dlock(d); | |
| 115 | + spin_unlock(&d->d_lock); | |
| 116 | + if (likely(found)) | |
| 117 | + break; | |
| 118 | + count = 1; | |
| 119 | + } | |
| 120 | + if (need_resched()) { | |
| 121 | + list_move(&cursor->d_child, p); | |
| 122 | + p = &cursor->d_child; | |
| 123 | + spin_unlock(&dentry->d_lock); | |
| 124 | + cond_resched(); | |
| 125 | + spin_lock(&dentry->d_lock); | |
| 115 | 126 | } |
| 116 | 127 | } |
| 117 | − rcu_read_unlock(); | |
| 118 | − if (skipped) { | |
| 119 | − smp_rmb(); | |
| 120 | − if (unlikely(*seq != n)) | |
| 121 | − goto retry; | |
| 122 | − } | |
| 123 | − return res; | |
| 124 | −} | |
| 125 | − | |
| 126 | −static void move_cursor(struct dentry *cursor, struct list_head *after) | |
| 127 | −{ | |
| 128 | − struct dentry *parent = cursor->d_parent; | |
| 129 | − unsigned n, *seq = &parent->d_inode->i_dir_seq; | |
| 130 | − spin_lock(&parent->d_lock); | |
| 131 | − for (;;) { | |
| 132 | − n = *seq; | |
| 133 | − if (!(n & 1) && cmpxchg(seq, n, n + 1) == n) | |
| 134 | − break; | |
| 135 | − cpu_relax(); | |
| 136 | − } | |
| 137 | − __list_del(cursor->d_child.prev, cursor->d_child.next); | |
| 138 | − if (after) | |
| 139 | − list_add(&cursor->d_child, after); | |
| 140 | − else | |
| 141 | − list_add_tail(&cursor->d_child, &parent->d_subdirs); | |
| 142 | − smp_store_release(seq, n + 2); | |
| 143 | − spin_unlock(&parent->d_lock); | |
| 128 | + spin_unlock(&dentry->d_lock); | |
| 129 | + dput(last); | |
| 130 | + return found; | |
| 144 | 131 | } |
| 145 | 132 | |
| 146 | 133 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) |
| @@ -158,17 +145,25 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) · 11 unmodified lines | ||
| 158 | 145 | return -EINVAL; |
| 159 | 146 | } |
| 160 | 147 | if (offset != file->f_pos) { |
| 148 | + struct dentry *cursor = file->private_data; | |
| 149 | + struct dentry *to = NULL; | |
| 150 | + | |
| 151 | + inode_lock_shared(dentry->d_inode); | |
| 152 | + | |
| 153 | + if (offset > 2) | |
| 154 | + to = scan_positives(cursor, &dentry->d_subdirs, | |
| 155 | + offset - 2, NULL); | |
| 156 | + spin_lock(&dentry->d_lock); | |
| 157 | + if (to) | |
| 158 | + list_move(&cursor->d_child, &to->d_child); | |
| 159 | + else | |
| 160 | + list_del_init(&cursor->d_child); | |
| 161 | + spin_unlock(&dentry->d_lock); | |
| 162 | + dput(to); | |
| 163 | + | |
| 161 | 164 | file->f_pos = offset; |
| 162 | − if (file->f_pos >= 2) { | |
| 163 | − struct dentry *cursor = file->private_data; | |
| 164 | − struct dentry *to; | |
| 165 | − loff_t n = file->f_pos - 2; | |
| 166 | − | |
| 167 | − inode_lock_shared(dentry->d_inode); | |
| 168 | − to = next_positive(dentry, &dentry->d_subdirs, n); | |
| 169 | − move_cursor(cursor, to ? &to->d_child : NULL); | |
| 170 | − inode_unlock_shared(dentry->d_inode); | |
| 171 | − } | |
| 165 | + | |
| 166 | + inode_unlock_shared(dentry->d_inode); | |
| 172 | 167 | } |
| 173 | 168 | return offset; |
| 174 | 169 | } |
| @@ -190,25 +185,35 @@ int dcache_readdir(struct file *file, struct dir_context *ctx) · 15 unmodified lines | ||
| 190 | 185 | { |
| 191 | 186 | struct dentry *dentry = file->f_path.dentry; |
| 192 | 187 | struct dentry *cursor = file->private_data; |
| 193 | − struct list_head *p = &cursor->d_child; | |
| 194 | − struct dentry *next; | |
| 195 | − bool moved = false; | |
| 188 | + struct list_head *anchor = &dentry->d_subdirs; | |
| 189 | + struct dentry *next = NULL; | |
| 190 | + struct list_head *p; | |
| 196 | 191 | |
| 197 | 192 | if (!dir_emit_dots(file, ctx)) |
| 198 | 193 | return 0; |
| 199 | 194 | |
| 200 | 195 | if (ctx->pos == 2) |
| 201 | − p = &dentry->d_subdirs; | |
| 202 | − while ((next = next_positive(dentry, p, 1)) != NULL) { | |
| 196 | + p = anchor; | |
| 197 | + else if (!list_empty(&cursor->d_child)) | |
| 198 | + p = &cursor->d_child; | |
| 199 | + else | |
| 200 | + return 0; | |
| 201 | + | |
| 202 | + while ((next = scan_positives(cursor, p, 1, next)) != NULL) { | |
| 203 | 203 | if (!dir_emit(ctx, next->d_name.name, next->d_name.len, |
| 204 | 204 | d_inode(next)->i_ino, dt_type(d_inode(next)))) |
| 205 | 205 | break; |
| 206 | − moved = true; | |
| 207 | − p = &next->d_child; | |
| 208 | 206 | ctx->pos++; |
| 207 | + p = &next->d_child; | |
| 209 | 208 | } |
| 210 | − if (moved) | |
| 211 | − move_cursor(cursor, p); | |
| 209 | + spin_lock(&dentry->d_lock); | |
| 210 | + if (next) | |
| 211 | + list_move_tail(&cursor->d_child, &next->d_child); | |
| 212 | + else | |
| 213 | + list_del_init(&cursor->d_child); | |
| 214 | + spin_unlock(&dentry->d_lock); | |
| 215 | + dput(next); | |
| 216 | + | |
| 212 | 217 | return 0; |
| 213 | 218 | } |
| 214 | 219 | EXPORT_SYMBOL(dcache_readdir); |
| @@ -468,8 +473,7 @@ EXPORT_SYMBOL(simple_write_begin); · 253 unmodified lines | ||
| 468 | 473 | |
| 469 | 474 | /** |
| 470 | 475 | * simple_write_end - .write_end helper for non-block-device FSes |
| 471 | − * @available: See .write_end of address_space_operations | |
| 472 | − * @file: " | |
| 476 | + * @file: See .write_end of address_space_operations | |
| 473 | 477 | * @mapping: " |
| 474 | 478 | * @pos: " |
| 475 | 479 | * @len: " |
| @@ -64,13 +64,6 @@ · 63 unmodified lines | ||
| 64 | 64 | |
| 65 | 65 | static struct kmem_cache *nfs_direct_cachep; |
| 66 | 66 | |
| 67 | −/* | |
| 68 | − * This represents a set of asynchronous requests that we're waiting on | |
| 69 | − */ | |
| 70 | −struct nfs_direct_mirror { | |
| 71 | − ssize_t count; | |
| 72 | −}; | |
| 73 | − | |
| 74 | 67 | struct nfs_direct_req { |
| 75 | 68 | struct kref kref; /* release manager */ |
| 76 | 69 | |
| @@ -84,9 +77,6 @@ struct nfs_direct_req { · 7 unmodified lines | ||
| 84 | 77 | atomic_t io_count; /* i/os we're waiting for */ |
| 85 | 78 | spinlock_t lock; /* protect completion state */ |
| 86 | 79 | |
| 87 | − struct nfs_direct_mirror mirrors[NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX]; | |
| 88 | − int mirror_count; | |
| 89 | − | |
| 90 | 80 | loff_t io_start; /* Start offset for I/O */ |
| 91 | 81 | ssize_t count, /* bytes actually processed */ |
| 92 | 82 | max_count, /* max expected count */ |
| @@ -123,32 +113,42 @@ static inline int put_dreq(struct nfs_direct_req *dreq) · 30 unmodified lines | ||
| 123 | 113 | } |
| 124 | 114 | |
| 125 | 115 | static void |
| 126 | −nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr) | |
| 116 | +nfs_direct_handle_truncated(struct nfs_direct_req *dreq, | |
| 117 | + const struct nfs_pgio_header *hdr, | |
| 118 | + ssize_t dreq_len) | |
| 127 | 119 | { |
| 128 | − int i; | |
| 129 | − ssize_t count; | |
| 120 | + if (!(test_bit(NFS_IOHDR_ERROR, &hdr->flags) || | |
| 121 | + test_bit(NFS_IOHDR_EOF, &hdr->flags))) | |
| 122 | + return; | |
| 123 | + if (dreq->max_count >= dreq_len) { | |
| 124 | + dreq->max_count = dreq_len; | |
| 125 | + if (dreq->count > dreq_len) | |
| 126 | + dreq->count = dreq_len; | |
| 127 | + | |
| 128 | + if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) | |
| 129 | + dreq->error = hdr->error; | |
| 130 | + else /* Clear outstanding error if this is EOF */ | |
| 131 | + dreq->error = 0; | |
| 132 | + } | |
| 133 | +} | |
| 130 | 134 | |
| 131 | − WARN_ON_ONCE(dreq->count >= dreq->max_count); | |
| 135 | +static void | |
| 136 | +nfs_direct_count_bytes(struct nfs_direct_req *dreq, | |
| 137 | + const struct nfs_pgio_header *hdr) | |
| 138 | +{ | |
| 139 | + loff_t hdr_end = hdr->io_start + hdr->good_bytes; | |
| 140 | + ssize_t dreq_len = 0; | |
| 132 | 141 | |
| 133 | − if (dreq->mirror_count == 1) { | |
| 134 | − dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes; | |
| 135 | − dreq->count += hdr->good_bytes; | |
| 136 | − } else { | |
| 137 | − /* mirrored writes */ | |
| 138 | − count = dreq->mirrors[hdr->pgio_mirror_idx].count; | |
| 139 | − if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) { | |
| 140 | − count = hdr->io_start + hdr->good_bytes - dreq->io_start; | |
| 141 | − dreq->mirrors[hdr->pgio_mirror_idx].count = count; | |
| 142 | − } | |
| 143 | − /* update the dreq->count by finding the minimum agreed count from all | |
| 144 | − * mirrors */ | |
| 145 | − count = dreq->mirrors[0].count; | |
| 142 | + if (hdr_end > dreq->io_start) | |
| 143 | + dreq_len = hdr_end - dreq->io_start; | |
| 146 | 144 | |
| 147 | − for (i = 1; i < dreq->mirror_count; i++) | |
| 148 | − count = min(count, dreq->mirrors[i].count); | |
| 145 | + nfs_direct_handle_truncated(dreq, hdr, dreq_len); | |
| 149 | 146 | |
| 150 | − dreq->count = count; | |
| 151 | − } | |
| 147 | + if (dreq_len > dreq->max_count) | |
| 148 | + dreq_len = dreq->max_count; | |
| 149 | + | |
| 150 | + if (dreq->count < dreq_len) | |
| 151 | + dreq->count = dreq_len; | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /* |
| @@ -293,18 +293,6 @@ void nfs_init_cinfo_from_dreq(struct nfs_commit_info *cinfo, · 138 unmodified lines | ||
| 293 | 293 | cinfo->completion_ops = &nfs_direct_commit_completion_ops; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | −static inline void nfs_direct_setup_mirroring(struct nfs_direct_req *dreq, | |
| 297 | − struct nfs_pageio_descriptor *pgio, | |
| 298 | − struct nfs_page *req) | |
| 299 | −{ | |
| 300 | − int mirror_count = 1; | |
| 301 | − | |
| 302 | − if (pgio->pg_ops->pg_get_mirror_count) | |
| 303 | − mirror_count = pgio->pg_ops->pg_get_mirror_count(pgio, req); | |
| 304 | − | |
| 305 | − dreq->mirror_count = mirror_count; | |
| 306 | −} | |
| 307 | − | |
| 308 | 296 | static inline struct nfs_direct_req *nfs_direct_req_alloc(void) |
| 309 | 297 | { |
| 310 | 298 | struct nfs_direct_req *dreq; |
| @@ -319,7 +307,6 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void) · 8 unmodified lines | ||
| 319 | 307 | INIT_LIST_HEAD(&dreq->mds_cinfo.list); |
| 320 | 308 | dreq->verf.committed = NFS_INVALID_STABLE_HOW; /* not set yet */ |
| 321 | 309 | INIT_WORK(&dreq->work, nfs_direct_write_schedule_work); |
| 322 | − dreq->mirror_count = 1; | |
| 323 | 310 | spin_lock_init(&dreq->lock); |
| 324 | 311 | |
| 325 | 312 | return dreq; |
| @@ -402,20 +389,12 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) · 76 unmodified lines | ||
| 402 | 389 | struct nfs_direct_req *dreq = hdr->dreq; |
| 403 | 390 | |
| 404 | 391 | spin_lock(&dreq->lock); |
| 405 | − if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) | |
| 406 | − dreq->error = hdr->error; | |
| 407 | − | |
| 408 | 392 | if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) { |
| 409 | 393 | spin_unlock(&dreq->lock); |
| 410 | 394 | goto out_put; |
| 411 | 395 | } |
| 412 | 396 | |
| 413 | − if (hdr->good_bytes != 0) | |
| 414 | − nfs_direct_good_bytes(dreq, hdr); | |
| 415 | − | |
| 416 | − if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) | |
| 417 | − dreq->error = 0; | |
| 418 | − | |
| 397 | + nfs_direct_count_bytes(dreq, hdr); | |
| 419 | 398 | spin_unlock(&dreq->lock); |
| 420 | 399 | |
| 421 | 400 | while (!list_empty(&hdr->pages)) { |
| @@ -646,29 +625,22 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) · 224 unmodified lines | ||
| 646 | 625 | LIST_HEAD(reqs); |
| 647 | 626 | struct nfs_commit_info cinfo; |
| 648 | 627 | LIST_HEAD(failed); |
| 649 | − int i; | |
| 650 | 628 | |
| 651 | 629 | nfs_init_cinfo_from_dreq(&cinfo, dreq); |
| 652 | 630 | nfs_direct_write_scan_commit_list(dreq->inode, &reqs, &cinfo); |
| 653 | 631 | |
| 654 | 632 | dreq->count = 0; |
| 633 | + dreq->max_count = 0; | |
| 634 | + list_for_each_entry(req, &reqs, wb_list) | |
| 635 | + dreq->max_count += req->wb_bytes; | |
| 655 | 636 | dreq->verf.committed = NFS_INVALID_STABLE_HOW; |
| 656 | 637 | nfs_clear_pnfs_ds_commit_verifiers(&dreq->ds_cinfo); |
| 657 | − for (i = 0; i < dreq->mirror_count; i++) | |
| 658 | − dreq->mirrors[i].count = 0; | |
| 659 | 638 | get_dreq(dreq); |
| 660 | 639 | |
| 661 | 640 | nfs_pageio_init_write(&desc, dreq->inode, FLUSH_STABLE, false, |
| 662 | 641 | &nfs_direct_write_completion_ops); |
| 663 | 642 | desc.pg_dreq = dreq; |
| 664 | 643 | |
| 665 | − req = nfs_list_entry(reqs.next); | |
| 666 | − nfs_direct_setup_mirroring(dreq, &desc, req); | |
| 667 | − if (desc.pg_error < 0) { | |
| 668 | − list_splice_init(&reqs, &failed); | |
| 669 | − goto out_failed; | |
| 670 | − } | |
| 671 | − | |
| 672 | 644 | list_for_each_entry_safe(req, tmp, &reqs, wb_list) { |
| 673 | 645 | /* Bump the transmission count */ |
| 674 | 646 | req->wb_nio++; |
| @@ -686,7 +658,6 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) · 11 unmodified lines | ||
| 686 | 658 | } |
| 687 | 659 | nfs_pageio_complete(&desc); |
| 688 | 660 | |
| 689 | −out_failed: | |
| 690 | 661 | while (!list_empty(&failed)) { |
| 691 | 662 | req = nfs_list_entry(failed.next); |
| 692 | 663 | nfs_list_remove_request(req); |
| @@ -791,17 +762,13 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) · 98 unmodified lines | ||
| 791 | 762 | nfs_init_cinfo_from_dreq(&cinfo, dreq); |
| 792 | 763 | |
| 793 | 764 | spin_lock(&dreq->lock); |
| 794 | − | |
| 795 | − if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) | |
| 796 | − dreq->error = hdr->error; | |
| 797 | − | |
| 798 | 765 | if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) { |
| 799 | 766 | spin_unlock(&dreq->lock); |
| 800 | 767 | goto out_put; |
| 801 | 768 | } |
| 802 | 769 | |
| 770 | + nfs_direct_count_bytes(dreq, hdr); | |
| 803 | 771 | if (hdr->good_bytes != 0) { |
| 804 | − nfs_direct_good_bytes(dreq, hdr); | |
| 805 | 772 | if (nfs_write_need_commit(hdr)) { |
| 806 | 773 | if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) |
| 807 | 774 | request_commit = true; |
| @@ -923,7 +890,6 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, · 115 unmodified lines | ||
| 923 | 890 | break; |
| 924 | 891 | } |
| 925 | 892 | |
| 926 | − nfs_direct_setup_mirroring(dreq, &desc, req); | |
| 927 | 893 | if (desc.pg_error < 0) { |
| 928 | 894 | nfs_free_request(req); |
| 929 | 895 | result = desc.pg_error; |
| @@ -6106,6 +6106,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, · 6105 unmodified lines | ||
| 6106 | 6106 | |
| 6107 | 6107 | status = nfs4_call_sync_custom(&task_setup_data); |
| 6108 | 6108 | if (setclientid.sc_cred) { |
| 6109 | + kfree(clp->cl_acceptor); | |
| 6109 | 6110 | clp->cl_acceptor = rpcauth_stringify_acceptor(setclientid.sc_cred); |
| 6110 | 6111 | put_rpccred(setclientid.sc_cred); |
| 6111 | 6112 | } |
| @@ -786,7 +786,6 @@ static void nfs_inode_remove_request(struct nfs_page *req) · 785 unmodified lines | ||
| 786 | 786 | struct nfs_inode *nfsi = NFS_I(inode); |
| 787 | 787 | struct nfs_page *head; |
| 788 | 788 | |
| 789 | − atomic_long_dec(&nfsi->nrequests); | |
| 790 | 789 | if (nfs_page_group_sync_on_bit(req, PG_REMOVE)) { |
| 791 | 790 | head = req->wb_head; |
| 792 | 791 | |
| @@ -799,8 +798,10 @@ static void nfs_inode_remove_request(struct nfs_page *req) · 6 unmodified lines | ||
| 799 | 798 | spin_unlock(&mapping->private_lock); |
| 800 | 799 | } |
| 801 | 800 | |
| 802 | − if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) | |
| 801 | + if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) { | |
| 803 | 802 | nfs_release_request(req); |
| 803 | + atomic_long_dec(&nfsi->nrequests); | |
| 804 | + } | |
| 804 | 805 | } |
| 805 | 806 | |
| 806 | 807 | static void |
| @@ -2049,7 +2049,8 @@ out_write_size: · 2048 unmodified lines | ||
| 2049 | 2049 | inode->i_mtime = inode->i_ctime = current_time(inode); |
| 2050 | 2050 | di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); |
| 2051 | 2051 | di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); |
| 2052 | − ocfs2_update_inode_fsync_trans(handle, inode, 1); | |
| 2052 | + if (handle) | |
| 2053 | + ocfs2_update_inode_fsync_trans(handle, inode, 1); | |
| 2053 | 2054 | } |
| 2054 | 2055 | if (handle) |
| 2055 | 2056 | ocfs2_journal_dirty(handle, wc->w_di_bh); |
| @@ -2146,13 +2147,30 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock, · 90 unmodified lines | ||
| 2146 | 2147 | struct ocfs2_dio_write_ctxt *dwc = NULL; |
| 2147 | 2148 | struct buffer_head *di_bh = NULL; |
| 2148 | 2149 | u64 p_blkno; |
| 2149 | − loff_t pos = iblock << inode->i_sb->s_blocksize_bits; | |
| 2150 | + unsigned int i_blkbits = inode->i_sb->s_blocksize_bits; | |
| 2151 | + loff_t pos = iblock << i_blkbits; | |
| 2152 | + sector_t endblk = (i_size_read(inode) - 1) >> i_blkbits; | |
| 2150 | 2153 | unsigned len, total_len = bh_result->b_size; |
| 2151 | 2154 | int ret = 0, first_get_block = 0; |
| 2152 | 2155 | |
| 2153 | 2156 | len = osb->s_clustersize - (pos & (osb->s_clustersize - 1)); |
| 2154 | 2157 | len = min(total_len, len); |
| 2155 | 2158 | |
| 2159 | + /* | |
| 2160 | + * bh_result->b_size is count in get_more_blocks according to write | |
| 2161 | + * "pos" and "end", we need map twice to return different buffer state: | |
| 2162 | + * 1. area in file size, not set NEW; | |
| 2163 | + * 2. area out file size, set NEW. | |
| 2164 | + * | |
| 2165 | + * iblock endblk | |
| 2166 | + * |--------|---------|---------|--------- | |
| 2167 | + * |<-------area in file------->| | |
| 2168 | + */ | |
| 2169 | + | |
| 2170 | + if ((iblock <= endblk) && | |
| 2171 | + ((iblock + ((len - 1) >> i_blkbits)) > endblk)) | |
| 2172 | + len = (endblk - iblock + 1) << i_blkbits; | |
| 2173 | + | |
| 2156 | 2174 | mlog(0, "get block of %lu at %llu:%u req %u\n", |
| 2157 | 2175 | inode->i_ino, pos, len, total_len); |
| 2158 | 2176 | |
| @@ -2236,6 +2254,9 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock, · 77 unmodified lines | ||
| 2236 | 2254 | if (desc->c_needs_zero) |
| 2237 | 2255 | set_buffer_new(bh_result); |
| 2238 | 2256 | |
| 2257 | + if (iblock > endblk) | |
| 2258 | + set_buffer_new(bh_result); | |
| 2259 | + | |
| 2239 | 2260 | /* May sleep in end_io. It should not happen in a irq context. So defer |
| 2240 | 2261 | * it to dio work queue. */ |
| 2241 | 2262 | set_buffer_defer_completion(bh_result); |
| @@ -283,7 +283,7 @@ static int ocfs2_info_scan_inode_alloc(struct ocfs2_super *osb, · 282 unmodified lines | ||
| 283 | 283 | if (inode_alloc) |
| 284 | 284 | inode_lock(inode_alloc); |
| 285 | 285 | |
| 286 | − if (o2info_coherent(&fi->ifi_req)) { | |
| 286 | + if (inode_alloc && o2info_coherent(&fi->ifi_req)) { | |
| 287 | 287 | status = ocfs2_inode_lock(inode_alloc, &bh, 0); |
| 288 | 288 | if (status < 0) { |
| 289 | 289 | mlog_errno(status); |
| @@ -926,8 +926,8 @@ static int ocfs2_enable_quotas(struct ocfs2_super *osb) · 925 unmodified lines | ||
| 926 | 926 | status = -ENOENT; |
| 927 | 927 | goto out_quota_off; |
| 928 | 928 | } |
| 929 | − status = dquot_enable(inode[type], type, QFMT_OCFS2, | |
| 930 | − DQUOT_USAGE_ENABLED); | |
| 929 | + status = dquot_load_quota_inode(inode[type], type, QFMT_OCFS2, | |
| 930 | + DQUOT_USAGE_ENABLED); | |
| 931 | 931 | if (status < 0) |
| 932 | 932 | goto out_quota_off; |
| 933 | 933 | } |
| @@ -1490,18 +1490,6 @@ static int ocfs2_xa_check_space(struct ocfs2_xa_loc *loc, · 1489 unmodified lines | ||
| 1490 | 1490 | return loc->xl_ops->xlo_check_space(loc, xi); |
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | −static void ocfs2_xa_add_entry(struct ocfs2_xa_loc *loc, u32 name_hash) | |
| 1494 | −{ | |
| 1495 | − loc->xl_ops->xlo_add_entry(loc, name_hash); | |
| 1496 | − loc->xl_entry->xe_name_hash = cpu_to_le32(name_hash); | |
| 1497 | − /* | |
| 1498 | − * We can't leave the new entry's xe_name_offset at zero or | |
| 1499 | − * add_namevalue() will go nuts. We set it to the size of our | |
| 1500 | − * storage so that it can never be less than any other entry. | |
| 1501 | − */ | |
| 1502 | − loc->xl_entry->xe_name_offset = cpu_to_le16(loc->xl_size); | |
| 1503 | −} | |
| 1504 | − | |
| 1505 | 1493 | static void ocfs2_xa_add_namevalue(struct ocfs2_xa_loc *loc, |
| 1506 | 1494 | struct ocfs2_xattr_info *xi) |
| 1507 | 1495 | { |
| @@ -2133,29 +2121,31 @@ static int ocfs2_xa_prepare_entry(struct ocfs2_xa_loc *loc, · 625 unmodified lines | ||
| 2133 | 2121 | if (rc) |
| 2134 | 2122 | goto out; |
| 2135 | 2123 | |
| 2136 | − if (loc->xl_entry) { | |
| 2137 | − if (ocfs2_xa_can_reuse_entry(loc, xi)) { | |
| 2138 | − orig_value_size = loc->xl_entry->xe_value_size; | |
| 2139 | − rc = ocfs2_xa_reuse_entry(loc, xi, ctxt); | |
| 2140 | − if (rc) | |
| 2141 | − goto out; | |
| 2142 | − goto alloc_value; | |
| 2143 | − } | |
| 2124 | + if (!loc->xl_entry) { | |
| 2125 | + rc = -EINVAL; | |
| 2126 | + goto out; | |
| 2127 | + } | |
| 2144 | 2128 | |
| 2145 | − if (!ocfs2_xattr_is_local(loc->xl_entry)) { | |
| 2146 | − orig_clusters = ocfs2_xa_value_clusters(loc); | |
| 2147 | − rc = ocfs2_xa_value_truncate(loc, 0, ctxt); | |
| 2148 | − if (rc) { | |
| 2149 | − mlog_errno(rc); | |
| 2150 | − ocfs2_xa_cleanup_value_truncate(loc, | |
| 2151 | − "overwriting", | |
| 2152 | − orig_clusters); | |
| 2153 | − goto out; | |
| 2154 | − } | |
| 2129 | + if (ocfs2_xa_can_reuse_entry(loc, xi)) { | |
| 2130 | + orig_value_size = loc->xl_entry->xe_value_size; | |
| 2131 | + rc = ocfs2_xa_reuse_entry(loc, xi, ctxt); | |
| 2132 | + if (rc) | |
| 2133 | + goto out; | |
| 2134 | + goto alloc_value; | |
| 2135 | + } | |
| 2136 | + | |
| 2137 | + if (!ocfs2_xattr_is_local(loc->xl_entry)) { | |
| 2138 | + orig_clusters = ocfs2_xa_value_clusters(loc); | |
| 2139 | + rc = ocfs2_xa_value_truncate(loc, 0, ctxt); | |
| 2140 | + if (rc) { | |
| 2141 | + mlog_errno(rc); | |
| 2142 | + ocfs2_xa_cleanup_value_truncate(loc, | |
| 2143 | + "overwriting", | |
| 2144 | + orig_clusters); | |
| 2145 | + goto out; | |
| 2155 | 2146 | } |
| 2156 | − ocfs2_xa_wipe_namevalue(loc); | |
| 2157 | − } else | |
| 2158 | − ocfs2_xa_add_entry(loc, name_hash); | |
| 2147 | + } | |
| 2148 | + ocfs2_xa_wipe_namevalue(loc); | |
| 2159 | 2149 | |
| 2160 | 2150 | /* |
| 2161 | 2151 | * If we get here, we have a blank entry. Fill it. We grow our |
| @@ -2161,14 +2161,29 @@ int dquot_file_open(struct inode *inode, struct file *file) · 2160 unmodified lines | ||
| 2161 | 2161 | } |
| 2162 | 2162 | EXPORT_SYMBOL(dquot_file_open); |
| 2163 | 2163 | |
| 2164 | +static void vfs_cleanup_quota_inode(struct super_block *sb, int type) | |
| 2165 | +{ | |
| 2166 | + struct quota_info *dqopt = sb_dqopt(sb); | |
| 2167 | + struct inode *inode = dqopt->files[type]; | |
| 2168 | + | |
| 2169 | + if (!inode) | |
| 2170 | + return; | |
| 2171 | + if (!(dqopt->flags & DQUOT_QUOTA_SYS_FILE)) { | |
| 2172 | + inode_lock(inode); | |
| 2173 | + inode->i_flags &= ~S_NOQUOTA; | |
| 2174 | + inode_unlock(inode); | |
| 2175 | + } | |
| 2176 | + dqopt->files[type] = NULL; | |
| 2177 | + iput(inode); | |
| 2178 | +} | |
| 2179 | + | |
| 2164 | 2180 | /* |
| 2165 | 2181 | * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) |
| 2166 | 2182 | */ |
| 2167 | 2183 | int dquot_disable(struct super_block *sb, int type, unsigned int flags) |
| 2168 | 2184 | { |
| 2169 | − int cnt, ret = 0; | |
| 2185 | + int cnt; | |
| 2170 | 2186 | struct quota_info *dqopt = sb_dqopt(sb); |
| 2171 | − struct inode *toputinode[MAXQUOTAS]; | |
| 2172 | 2187 | |
| 2173 | 2188 | /* s_umount should be held in exclusive mode */ |
| 2174 | 2189 | if (WARN_ON_ONCE(down_read_trylock(&sb->s_umount))) |
| @@ -2190,7 +2205,6 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags) · 15 unmodified lines | ||
| 2190 | 2205 | return 0; |
| 2191 | 2206 | |
| 2192 | 2207 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { |
| 2193 | − toputinode[cnt] = NULL; | |
| 2194 | 2208 | if (type != -1 && cnt != type) |
| 2195 | 2209 | continue; |
| 2196 | 2210 | if (!sb_has_quota_loaded(sb, cnt)) |
| @@ -2210,8 +2224,7 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags) · 13 unmodified lines | ||
| 2210 | 2224 | dqopt->flags &= ~dquot_state_flag( |
| 2211 | 2225 | DQUOT_SUSPENDED, cnt); |
| 2212 | 2226 | spin_unlock(&dq_state_lock); |
| 2213 | − iput(dqopt->files[cnt]); | |
| 2214 | − dqopt->files[cnt] = NULL; | |
| 2227 | + vfs_cleanup_quota_inode(sb, cnt); | |
| 2215 | 2228 | continue; |
| 2216 | 2229 | } |
| 2217 | 2230 | spin_unlock(&dq_state_lock); |
| @@ -2233,10 +2246,6 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags) · 15 unmodified lines | ||
| 2233 | 2246 | if (dqopt->ops[cnt]->free_file_info) |
| 2234 | 2247 | dqopt->ops[cnt]->free_file_info(sb, cnt); |
| 2235 | 2248 | put_quota_format(dqopt->info[cnt].dqi_format); |
| 2236 | − | |
| 2237 | − toputinode[cnt] = dqopt->files[cnt]; | |
| 2238 | − if (!sb_has_quota_loaded(sb, cnt)) | |
| 2239 | − dqopt->files[cnt] = NULL; | |
| 2240 | 2249 | dqopt->info[cnt].dqi_flags = 0; |
| 2241 | 2250 | dqopt->info[cnt].dqi_igrace = 0; |
| 2242 | 2251 | dqopt->info[cnt].dqi_bgrace = 0; |
| @@ -2258,32 +2267,22 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags) · 15 unmodified lines | ||
| 2258 | 2267 | * must also discard the blockdev buffers so that we see the |
| 2259 | 2268 | * changes done by userspace on the next quotaon() */ |
| 2260 | 2269 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) |
| 2261 | − /* This can happen when suspending quotas on remount-ro... */ | |
| 2262 | − if (toputinode[cnt] && !sb_has_quota_loaded(sb, cnt)) { | |
| 2263 | − inode_lock(toputinode[cnt]); | |
| 2264 | − toputinode[cnt]->i_flags &= ~S_NOQUOTA; | |
| 2265 | − truncate_inode_pages(&toputinode[cnt]->i_data, 0); | |
| 2266 | − inode_unlock(toputinode[cnt]); | |
| 2267 | − mark_inode_dirty_sync(toputinode[cnt]); | |
| 2270 | + if (!sb_has_quota_loaded(sb, cnt) && dqopt->files[cnt]) { | |
| 2271 | + inode_lock(dqopt->files[cnt]); | |
| 2272 | + truncate_inode_pages(&dqopt->files[cnt]->i_data, 0); | |
| 2273 | + inode_unlock(dqopt->files[cnt]); | |
| 2268 | 2274 | } |
| 2269 | 2275 | if (sb->s_bdev) |
| 2270 | 2276 | invalidate_bdev(sb->s_bdev); |
| 2271 | 2277 | put_inodes: |
| 2278 | + /* We are done when suspending quotas */ | |
| 2279 | + if (flags & DQUOT_SUSPENDED) | |
| 2280 | + return 0; | |
| 2281 | + | |
| 2272 | 2282 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) |
| 2273 | − if (toputinode[cnt]) { | |
| 2274 | − /* On remount RO, we keep the inode pointer so that we | |
| 2275 | − * can reenable quota on the subsequent remount RW. We | |
| 2276 | − * have to check 'flags' variable and not use sb_has_ | |
| 2277 | − * function because another quotaon / quotaoff could | |
| 2278 | − * change global state before we got here. We refuse | |
| 2279 | − * to suspend quotas when there is pending delete on | |
| 2280 | − * the quota file... */ | |
| 2281 | − if (!(flags & DQUOT_SUSPENDED)) | |
| 2282 | − iput(toputinode[cnt]); | |
| 2283 | − else if (!toputinode[cnt]->i_nlink) | |
| 2284 | − ret = -EBUSY; | |
| 2285 | − } | |
| 2286 | − return ret; | |
| 2283 | + if (!sb_has_quota_loaded(sb, cnt)) | |
| 2284 | + vfs_cleanup_quota_inode(sb, cnt); | |
| 2285 | + return 0; | |
| 2287 | 2286 | } |
| 2288 | 2287 | EXPORT_SYMBOL(dquot_disable); |
| 2289 | 2288 | |
| @@ -2298,28 +2297,52 @@ EXPORT_SYMBOL(dquot_quota_off); · 8 unmodified lines | ||
| 2298 | 2297 | * Turn quotas on on a device |
| 2299 | 2298 | */ |
| 2300 | 2299 | |
| 2301 | −/* | |
| 2302 | − * Helper function to turn quotas on when we already have the inode of | |
| 2303 | − * quota file and no quota information is loaded. | |
| 2304 | − */ | |
| 2305 | −static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, | |
| 2300 | +static int vfs_setup_quota_inode(struct inode *inode, int type) | |
| 2301 | +{ | |
| 2302 | + struct super_block *sb = inode->i_sb; | |
| 2303 | + struct quota_info *dqopt = sb_dqopt(sb); | |
| 2304 | + | |
| 2305 | + if (!S_ISREG(inode->i_mode)) | |
| 2306 | + return -EACCES; | |
| 2307 | + if (IS_RDONLY(inode)) | |
| 2308 | + return -EROFS; | |
| 2309 | + if (sb_has_quota_loaded(sb, type)) | |
| 2310 | + return -EBUSY; | |
| 2311 | + | |
| 2312 | + dqopt->files[type] = igrab(inode); | |
| 2313 | + if (!dqopt->files[type]) | |
| 2314 | + return -EIO; | |
| 2315 | + if (!(dqopt->flags & DQUOT_QUOTA_SYS_FILE)) { | |
| 2316 | + /* We don't want quota and atime on quota files (deadlocks | |
| 2317 | + * possible) Also nobody should write to the file - we use | |
| 2318 | + * special IO operations which ignore the immutable bit. */ | |
| 2319 | + inode_lock(inode); | |
| 2320 | + inode->i_flags |= S_NOQUOTA; | |
| 2321 | + inode_unlock(inode); | |
| 2322 | + /* | |
| 2323 | + * When S_NOQUOTA is set, remove dquot references as no more | |
| 2324 | + * references can be added | |
| 2325 | + */ | |
| 2326 | + __dquot_drop(inode); | |
| 2327 | + } | |
| 2328 | + return 0; | |
| 2329 | +} | |
| 2330 | + | |
| 2331 | +int dquot_load_quota_sb(struct super_block *sb, int type, int format_id, | |
| 2306 | 2332 | unsigned int flags) |
| 2307 | 2333 | { |
| 2308 | 2334 | struct quota_format_type *fmt = find_quota_format(format_id); |
| 2309 | − struct super_block *sb = inode->i_sb; | |
| 2310 | 2335 | struct quota_info *dqopt = sb_dqopt(sb); |
| 2311 | 2336 | int error; |
| 2312 | 2337 | |
| 2338 | + /* Just unsuspend quotas? */ | |
| 2339 | + BUG_ON(flags & DQUOT_SUSPENDED); | |
| 2340 | + /* s_umount should be held in exclusive mode */ | |
| 2341 | + if (WARN_ON_ONCE(down_read_trylock(&sb->s_umount))) | |
| 2342 | + up_read(&sb->s_umount); | |
| 2343 | + | |
| 2313 | 2344 | if (!fmt) |
| 2314 | 2345 | return -ESRCH; |
| 2315 | − if (!S_ISREG(inode->i_mode)) { | |
| 2316 | − error = -EACCES; | |
| 2317 | − goto out_fmt; | |
| 2318 | − } | |
| 2319 | − if (IS_RDONLY(inode)) { | |
| 2320 | − error = -EROFS; | |
| 2321 | − goto out_fmt; | |
| 2322 | − } | |
| 2323 | 2346 | if (!sb->s_op->quota_write || !sb->s_op->quota_read || |
| 2324 | 2347 | (type == PRJQUOTA && sb->dq_op->get_projid == NULL)) { |
| 2325 | 2348 | error = -EINVAL; |
| @@ -2351,27 +2374,9 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, · 25 unmodified lines | ||
| 2351 | 2374 | invalidate_bdev(sb->s_bdev); |
| 2352 | 2375 | } |
| 2353 | 2376 | |
| 2354 | − if (!(dqopt->flags & DQUOT_QUOTA_SYS_FILE)) { | |
| 2355 | − /* We don't want quota and atime on quota files (deadlocks | |
| 2356 | − * possible) Also nobody should write to the file - we use | |
| 2357 | − * special IO operations which ignore the immutable bit. */ | |
| 2358 | − inode_lock(inode); | |
| 2359 | − inode->i_flags |= S_NOQUOTA; | |
| 2360 | − inode_unlock(inode); | |
| 2361 | − /* | |
| 2362 | − * When S_NOQUOTA is set, remove dquot references as no more | |
| 2363 | − * references can be added | |
| 2364 | − */ | |
| 2365 | − __dquot_drop(inode); | |
| 2366 | − } | |
| 2367 | − | |
| 2368 | − error = -EIO; | |
| 2369 | − dqopt->files[type] = igrab(inode); | |
| 2370 | − if (!dqopt->files[type]) | |
| 2371 | − goto out_file_flags; | |
| 2372 | 2377 | error = -EINVAL; |
| 2373 | 2378 | if (!fmt->qf_ops->check_quota_file(sb, type)) |
| 2374 | − goto out_file_init; | |
| 2379 | + goto out_fmt; | |
| 2375 | 2380 | |
| 2376 | 2381 | dqopt->ops[type] = fmt->qf_ops; |
| 2377 | 2382 | dqopt->info[type].dqi_format = fmt; |
| @@ -2379,7 +2384,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, · 1 unmodified line | ||
| 2379 | 2384 | INIT_LIST_HEAD(&dqopt->info[type].dqi_dirty_list); |
| 2380 | 2385 | error = dqopt->ops[type]->read_file_info(sb, type); |
| 2381 | 2386 | if (error < 0) |
| 2382 | − goto out_file_init; | |
| 2387 | + goto out_fmt; | |
| 2383 | 2388 | if (dqopt->flags & DQUOT_QUOTA_SYS_FILE) { |
| 2384 | 2389 | spin_lock(&dq_data_lock); |
| 2385 | 2390 | dqopt->info[type].dqi_flags |= DQF_SYS_FILE; |
| @@ -2394,24 +2399,36 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, · 8 unmodified lines | ||
| 2394 | 2399 | dquot_disable(sb, type, flags); |
| 2395 | 2400 | |
| 2396 | 2401 | return error; |
| 2397 | −out_file_init: | |
| 2398 | − dqopt->files[type] = NULL; | |
| 2399 | − iput(inode); | |
| 2400 | −out_file_flags: | |
| 2401 | − inode_lock(inode); | |
| 2402 | − inode->i_flags &= ~S_NOQUOTA; | |
| 2403 | − inode_unlock(inode); | |
| 2404 | 2402 | out_fmt: |
| 2405 | 2403 | put_quota_format(fmt); |
| 2406 | 2404 | |
| 2407 | 2405 | return error; |
| 2408 | 2406 | } |
| 2407 | +EXPORT_SYMBOL(dquot_load_quota_sb); | |
| 2408 | + | |
| 2409 | +/* | |
| 2410 | + * More powerful function for turning on quotas on given quota inode allowing | |
| 2411 | + * setting of individual quota flags | |
| 2412 | + */ | |
| 2413 | +int dquot_load_quota_inode(struct inode *inode, int type, int format_id, | |
| 2414 | + unsigned int flags) | |
| 2415 | +{ | |
| 2416 | + int err; | |
| 2417 | + | |
| 2418 | + err = vfs_setup_quota_inode(inode, type); | |
| 2419 | + if (err < 0) | |
| 2420 | + return err; | |
| 2421 | + err = dquot_load_quota_sb(inode->i_sb, type, format_id, flags); | |
| 2422 | + if (err < 0) | |
| 2423 | + vfs_cleanup_quota_inode(inode->i_sb, type); | |
| 2424 | + return err; | |
| 2425 | +} | |
| 2426 | +EXPORT_SYMBOL(dquot_load_quota_inode); | |
| 2409 | 2427 | |
| 2410 | 2428 | /* Reenable quotas on remount RW */ |
| 2411 | 2429 | int dquot_resume(struct super_block *sb, int type) |
| 2412 | 2430 | { |
| 2413 | 2431 | struct quota_info *dqopt = sb_dqopt(sb); |
| 2414 | − struct inode *inode; | |
| 2415 | 2432 | int ret = 0, cnt; |
| 2416 | 2433 | unsigned int flags; |
| 2417 | 2434 | |
| @@ -2425,8 +2442,6 @@ int dquot_resume(struct super_block *sb, int type) · 7 unmodified lines | ||
| 2425 | 2442 | if (!sb_has_quota_suspended(sb, cnt)) |
| 2426 | 2443 | continue; |
| 2427 | 2444 | |
| 2428 | − inode = dqopt->files[cnt]; | |
| 2429 | − dqopt->files[cnt] = NULL; | |
| 2430 | 2445 | spin_lock(&dq_state_lock); |
| 2431 | 2446 | flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED | |
| 2432 | 2447 | DQUOT_LIMITS_ENABLED, |
| @@ -2435,9 +2450,10 @@ int dquot_resume(struct super_block *sb, int type) · 2 unmodified lines | ||
| 2435 | 2450 | spin_unlock(&dq_state_lock); |
| 2436 | 2451 | |
| 2437 | 2452 | flags = dquot_generic_flag(flags, cnt); |
| 2438 | − ret = vfs_load_quota_inode(inode, cnt, | |
| 2439 | − dqopt->info[cnt].dqi_fmt_id, flags); | |
| 2440 | − iput(inode); | |
| 2453 | + ret = dquot_load_quota_sb(sb, cnt, dqopt->info[cnt].dqi_fmt_id, | |
| 2454 | + flags); | |
| 2455 | + if (ret < 0) | |
| 2456 | + vfs_cleanup_quota_inode(sb, type); | |
| 2441 | 2457 | } |
| 2442 | 2458 | |
| 2443 | 2459 | return ret; |
| @@ -2454,48 +2470,13 @@ int dquot_quota_on(struct super_block *sb, int type, int format_id, · 10 unmodified lines | ||
| 2454 | 2470 | if (path->dentry->d_sb != sb) |
| 2455 | 2471 | error = -EXDEV; |
| 2456 | 2472 | else |
| 2457 | − error = vfs_load_quota_inode(d_inode(path->dentry), type, | |
| 2473 | + error = dquot_load_quota_inode(d_inode(path->dentry), type, | |
| 2458 | 2474 | format_id, DQUOT_USAGE_ENABLED | |
| 2459 | 2475 | DQUOT_LIMITS_ENABLED); |
| 2460 | 2476 | return error; |
| 2461 | 2477 | } |
| 2462 | 2478 | EXPORT_SYMBOL(dquot_quota_on); |
| 2463 | 2479 | |
| 2464 | −/* | |
| 2465 | − * More powerful function for turning on quotas allowing setting | |
| 2466 | − * of individual quota flags | |
| 2467 | − */ | |
| 2468 | −int dquot_enable(struct inode *inode, int type, int format_id, | |
| 2469 | − unsigned int flags) | |
| 2470 | −{ | |
| 2471 | − struct super_block *sb = inode->i_sb; | |
| 2472 | − | |
| 2473 | − /* Just unsuspend quotas? */ | |
| 2474 | − BUG_ON(flags & DQUOT_SUSPENDED); | |
| 2475 | − /* s_umount should be held in exclusive mode */ | |
| 2476 | − if (WARN_ON_ONCE(down_read_trylock(&sb->s_umount))) | |
| 2477 | − up_read(&sb->s_umount); | |
| 2478 | − | |
| 2479 | − if (!flags) | |
| 2480 | − return 0; | |
| 2481 | − /* Just updating flags needed? */ | |
| 2482 | − if (sb_has_quota_loaded(sb, type)) { | |
| 2483 | − if (flags & DQUOT_USAGE_ENABLED && | |
| 2484 | − sb_has_quota_usage_enabled(sb, type)) | |
| 2485 | − return -EBUSY; | |
| 2486 | − if (flags & DQUOT_LIMITS_ENABLED && | |
| 2487 | − sb_has_quota_limits_enabled(sb, type)) | |
| 2488 | − return -EBUSY; | |
| 2489 | − spin_lock(&dq_state_lock); | |
| 2490 | − sb_dqopt(sb)->flags |= dquot_state_flag(flags, type); | |
| 2491 | − spin_unlock(&dq_state_lock); | |
| 2492 | − return 0; | |
| 2493 | − } | |
| 2494 | − | |
| 2495 | − return vfs_load_quota_inode(inode, type, format_id, flags); | |
| 2496 | −} | |
| 2497 | −EXPORT_SYMBOL(dquot_enable); | |
| 2498 | − | |
| 2499 | 2480 | /* |
| 2500 | 2481 | * This function is used when filesystem needs to initialize quotas |
| 2501 | 2482 | * during mount time. |
| @@ -2517,7 +2498,7 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name, · 15 unmodified lines | ||
| 2517 | 2498 | |
| 2518 | 2499 | error = security_quota_on(dentry); |
| 2519 | 2500 | if (!error) |
| 2520 | − error = vfs_load_quota_inode(d_inode(dentry), type, format_id, | |
| 2501 | + error = dquot_load_quota_inode(d_inode(dentry), type, format_id, | |
| 2521 | 2502 | DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); |
| 2522 | 2503 | |
| 2523 | 2504 | out: |
| @@ -2542,13 +2523,17 @@ static int dquot_quota_enable(struct super_block *sb, unsigned int flags) · 18 unmodified lines | ||
| 2542 | 2523 | if (!(flags & qtype_enforce_flag(type))) |
| 2543 | 2524 | continue; |
| 2544 | 2525 | /* Can't enforce without accounting */ |
| 2545 | − if (!sb_has_quota_usage_enabled(sb, type)) | |
| 2546 | − return -EINVAL; | |
| 2547 | − ret = dquot_enable(dqopt->files[type], type, | |
| 2548 | − dqopt->info[type].dqi_fmt_id, | |
| 2549 | − DQUOT_LIMITS_ENABLED); | |
| 2550 | − if (ret < 0) | |
| 2526 | + if (!sb_has_quota_usage_enabled(sb, type)) { | |
| 2527 | + ret = -EINVAL; | |
| 2528 | + goto out_err; | |
| 2529 | + } | |
| 2530 | + if (sb_has_quota_limits_enabled(sb, type)) { | |
| 2531 | + ret = -EBUSY; | |
| 2551 | 2532 | goto out_err; |
| 2533 | + } | |
| 2534 | + spin_lock(&dq_state_lock); | |
| 2535 | + dqopt->flags |= dquot_state_flag(DQUOT_LIMITS_ENABLED, type); | |
| 2536 | + spin_unlock(&dq_state_lock); | |
| 2552 | 2537 | } |
| 2553 | 2538 | return 0; |
| 2554 | 2539 | out_err: |
| @@ -2598,10 +2583,12 @@ static int dquot_quota_disable(struct super_block *sb, unsigned int flags) · 43 unmodified lines | ||
| 2598 | 2583 | out_err: |
| 2599 | 2584 | /* Backout enforcement disabling we already did */ |
| 2600 | 2585 | for (type--; type >= 0; type--) { |
| 2601 | − if (flags & qtype_enforce_flag(type)) | |
| 2602 | − dquot_enable(dqopt->files[type], type, | |
| 2603 | − dqopt->info[type].dqi_fmt_id, | |
| 2604 | − DQUOT_LIMITS_ENABLED); | |
| 2586 | + if (flags & qtype_enforce_flag(type)) { | |
| 2587 | + spin_lock(&dq_state_lock); | |
| 2588 | + dqopt->flags |= | |
| 2589 | + dquot_state_flag(DQUOT_LIMITS_ENABLED, type); | |
| 2590 | + spin_unlock(&dq_state_lock); | |
| 2591 | + } | |
| 2605 | 2592 | } |
| 2606 | 2593 | return ret; |
| 2607 | 2594 | } |
| @@ -2799,8 +2786,10 @@ int dquot_get_state(struct super_block *sb, struct qc_state *state) · 191 unmodified lines | ||
| 2799 | 2786 | tstate->flags |= QCI_LIMITS_ENFORCED; |
| 2800 | 2787 | tstate->spc_timelimit = mi->dqi_bgrace; |
| 2801 | 2788 | tstate->ino_timelimit = mi->dqi_igrace; |
| 2802 | − tstate->ino = dqopt->files[type]->i_ino; | |
| 2803 | − tstate->blocks = dqopt->files[type]->i_blocks; | |
| 2789 | + if (dqopt->files[type]) { | |
| 2790 | + tstate->ino = dqopt->files[type]->i_ino; | |
| 2791 | + tstate->blocks = dqopt->files[type]->i_blocks; | |
| 2792 | + } | |
| 2804 | 2793 | tstate->nextents = 1; /* We don't know... */ |
| 2805 | 2794 | spin_unlock(&dq_data_lock); |
| 2806 | 2795 | } |
| @@ -20,9 +20,23 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/syscalls.h> |
| 21 | 21 | #include <linux/unistd.h> |
| 22 | 22 | #include <linux/compat.h> |
| 23 | − | |
| 24 | 23 | #include <linux/uaccess.h> |
| 25 | 24 | |
| 25 | +#include <asm/unaligned.h> | |
| 26 | + | |
| 27 | +/* | |
| 28 | + * Note the "unsafe_put_user() semantics: we goto a | |
| 29 | + * label for errors. | |
| 30 | + */ | |
| 31 | +#define unsafe_copy_dirent_name(_dst, _src, _len, label) do { \ | |
| 32 | + char __user *dst = (_dst); \ | |
| 33 | + const char *src = (_src); \ | |
| 34 | + size_t len = (_len); \ | |
| 35 | + unsafe_put_user(0, dst+len, label); \ | |
| 36 | + unsafe_copy_to_user(dst, src, len, label); \ | |
| 37 | +} while (0) | |
| 38 | + | |
| 39 | + | |
| 26 | 40 | int iterate_dir(struct file *file, struct dir_context *ctx) |
| 27 | 41 | { |
| 28 | 42 | struct inode *inode = file_inode(file); |
| @@ -64,6 +78,40 @@ out: · 35 unmodified lines | ||
| 64 | 78 | } |
| 65 | 79 | EXPORT_SYMBOL(iterate_dir); |
| 66 | 80 | |
| 81 | +/* | |
| 82 | + * POSIX says that a dirent name cannot contain NULL or a '/'. | |
| 83 | + * | |
| 84 | + * It's not 100% clear what we should really do in this case. | |
| 85 | + * The filesystem is clearly corrupted, but returning a hard | |
| 86 | + * error means that you now don't see any of the other names | |
| 87 | + * either, so that isn't a perfect alternative. | |
| 88 | + * | |
| 89 | + * And if you return an error, what error do you use? Several | |
| 90 | + * filesystems seem to have decided on EUCLEAN being the error | |
| 91 | + * code for EFSCORRUPTED, and that may be the error to use. Or | |
| 92 | + * just EIO, which is perhaps more obvious to users. | |
| 93 | + * | |
| 94 | + * In order to see the other file names in the directory, the | |
| 95 | + * caller might want to make this a "soft" error: skip the | |
| 96 | + * entry, and return the error at the end instead. | |
| 97 | + * | |
| 98 | + * Note that this should likely do a "memchr(name, 0, len)" | |
| 99 | + * check too, since that would be filesystem corruption as | |
| 100 | + * well. However, that case can't actually confuse user space, | |
| 101 | + * which has to do a strlen() on the name anyway to find the | |
| 102 | + * filename length, and the above "soft error" worry means | |
| 103 | + * that it's probably better left alone until we have that | |
| 104 | + * issue clarified. | |
| 105 | + */ | |
| 106 | +static int verify_dirent_name(const char *name, int len) | |
| 107 | +{ | |
| 108 | + if (WARN_ON_ONCE(!len)) | |
| 109 | + return -EIO; | |
| 110 | + if (WARN_ON_ONCE(memchr(name, '/', len))) | |
| 111 | + return -EIO; | |
| 112 | + return 0; | |
| 113 | +} | |
| 114 | + | |
| 67 | 115 | /* |
| 68 | 116 | * Traditional linux readdir() handling.. |
| 69 | 117 | * |
| @@ -173,6 +221,9 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, · 103 unmodified lines | ||
| 173 | 221 | int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2, |
| 174 | 222 | sizeof(long)); |
| 175 | 223 | |
| 224 | + buf->error = verify_dirent_name(name, namlen); | |
| 225 | + if (unlikely(buf->error)) | |
| 226 | + return buf->error; | |
| 176 | 227 | buf->error = -EINVAL; /* only used if we fail.. */ |
| 177 | 228 | if (reclen > buf->count) |
| 178 | 229 | return -EINVAL; |
| @@ -182,28 +233,31 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, · 3 unmodified lines | ||
| 182 | 233 | return -EOVERFLOW; |
| 183 | 234 | } |
| 184 | 235 | dirent = buf->previous; |
| 185 | − if (dirent) { | |
| 186 | − if (signal_pending(current)) | |
| 187 | − return -EINTR; | |
| 188 | − if (__put_user(offset, &dirent->d_off)) | |
| 189 | − goto efault; | |
| 190 | − } | |
| 191 | − dirent = buf->current_dir; | |
| 192 | − if (__put_user(d_ino, &dirent->d_ino)) | |
| 193 | − goto efault; | |
| 194 | − if (__put_user(reclen, &dirent->d_reclen)) | |
| 195 | − goto efault; | |
| 196 | − if (copy_to_user(dirent->d_name, name, namlen)) | |
| 197 | − goto efault; | |
| 198 | − if (__put_user(0, dirent->d_name + namlen)) | |
| 199 | − goto efault; | |
| 200 | − if (__put_user(d_type, (char __user *) dirent + reclen - 1)) | |
| 236 | + if (dirent && signal_pending(current)) | |
| 237 | + return -EINTR; | |
| 238 | + | |
| 239 | + /* | |
| 240 | + * Note! This range-checks 'previous' (which may be NULL). | |
| 241 | + * The real range was checked in getdents | |
| 242 | + */ | |
| 243 | + if (!user_access_begin(dirent, sizeof(*dirent))) | |
| 201 | 244 | goto efault; |
| 245 | + if (dirent) | |
| 246 | + unsafe_put_user(offset, &dirent->d_off, efault_end); | |
| 247 | + dirent = buf->current_dir; | |
| 248 | + unsafe_put_user(d_ino, &dirent->d_ino, efault_end); | |
| 249 | + unsafe_put_user(reclen, &dirent->d_reclen, efault_end); | |
| 250 | + unsafe_put_user(d_type, (char __user *) dirent + reclen - 1, efault_end); | |
| 251 | + unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end); | |
| 252 | + user_access_end(); | |
| 253 | + | |
| 202 | 254 | buf->previous = dirent; |
| 203 | 255 | dirent = (void __user *)dirent + reclen; |
| 204 | 256 | buf->current_dir = dirent; |
| 205 | 257 | buf->count -= reclen; |
| 206 | 258 | return 0; |
| 259 | +efault_end: | |
| 260 | + user_access_end(); | |
| 207 | 261 | efault: |
| 208 | 262 | buf->error = -EFAULT; |
| 209 | 263 | return -EFAULT; |
| @@ -259,34 +313,38 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen, · 49 unmodified lines | ||
| 259 | 313 | int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, |
| 260 | 314 | sizeof(u64)); |
| 261 | 315 | |
| 316 | + buf->error = verify_dirent_name(name, namlen); | |
| 317 | + if (unlikely(buf->error)) | |
| 318 | + return buf->error; | |
| 262 | 319 | buf->error = -EINVAL; /* only used if we fail.. */ |
| 263 | 320 | if (reclen > buf->count) |
| 264 | 321 | return -EINVAL; |
| 265 | 322 | dirent = buf->previous; |
| 266 | − if (dirent) { | |
| 267 | − if (signal_pending(current)) | |
| 268 | − return -EINTR; | |
| 269 | − if (__put_user(offset, &dirent->d_off)) | |
| 270 | − goto efault; | |
| 271 | − } | |
| 272 | − dirent = buf->current_dir; | |
| 273 | − if (__put_user(ino, &dirent->d_ino)) | |
| 274 | − goto efault; | |
| 275 | − if (__put_user(0, &dirent->d_off)) | |
| 276 | − goto efault; | |
| 277 | − if (__put_user(reclen, &dirent->d_reclen)) | |
| 278 | − goto efault; | |
| 279 | − if (__put_user(d_type, &dirent->d_type)) | |
| 280 | − goto efault; | |
| 281 | − if (copy_to_user(dirent->d_name, name, namlen)) | |
| 282 | − goto efault; | |
| 283 | − if (__put_user(0, dirent->d_name + namlen)) | |
| 323 | + if (dirent && signal_pending(current)) | |
| 324 | + return -EINTR; | |
| 325 | + | |
| 326 | + /* | |
| 327 | + * Note! This range-checks 'previous' (which may be NULL). | |
| 328 | + * The real range was checked in getdents | |
| 329 | + */ | |
| 330 | + if (!user_access_begin(dirent, sizeof(*dirent))) | |
| 284 | 331 | goto efault; |
| 332 | + if (dirent) | |
| 333 | + unsafe_put_user(offset, &dirent->d_off, efault_end); | |
| 334 | + dirent = buf->current_dir; | |
| 335 | + unsafe_put_user(ino, &dirent->d_ino, efault_end); | |
| 336 | + unsafe_put_user(reclen, &dirent->d_reclen, efault_end); | |
| 337 | + unsafe_put_user(d_type, &dirent->d_type, efault_end); | |
| 338 | + unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end); | |
| 339 | + user_access_end(); | |
| 340 | + | |
| 285 | 341 | buf->previous = dirent; |
| 286 | 342 | dirent = (void __user *)dirent + reclen; |
| 287 | 343 | buf->current_dir = dirent; |
| 288 | 344 | buf->count -= reclen; |
| 289 | 345 | return 0; |
| 346 | +efault_end: | |
| 347 | + user_access_end(); | |
| 290 | 348 | efault: |
| 291 | 349 | buf->error = -EFAULT; |
| 292 | 350 | return -EFAULT; |
| @@ -1300,6 +1300,7 @@ int get_tree_bdev(struct fs_context *fc, · 1299 unmodified lines | ||
| 1300 | 1300 | mutex_lock(&bdev->bd_fsfreeze_mutex); |
| 1301 | 1301 | if (bdev->bd_fsfreeze_count > 0) { |
| 1302 | 1302 | mutex_unlock(&bdev->bd_fsfreeze_mutex); |
| 1303 | + blkdev_put(bdev, mode); | |
| 1303 | 1304 | warnf(fc, "%pg: Can't mount, blockdev is frozen", bdev); |
| 1304 | 1305 | return -EBUSY; |
| 1305 | 1306 | } |
| @@ -1308,8 +1309,10 @@ int get_tree_bdev(struct fs_context *fc, · 2 unmodified lines | ||
| 1308 | 1309 | fc->sget_key = bdev; |
| 1309 | 1310 | s = sget_fc(fc, test_bdev_super_fc, set_bdev_super_fc); |
| 1310 | 1311 | mutex_unlock(&bdev->bd_fsfreeze_mutex); |
| 1311 | − if (IS_ERR(s)) | |
| 1312 | + if (IS_ERR(s)) { | |
| 1313 | + blkdev_put(bdev, mode); | |
| 1312 | 1314 | return PTR_ERR(s); |
| 1315 | + } | |
| 1313 | 1316 | |
| 1314 | 1317 | if (s->s_root) { |
| 1315 | 1318 | /* Don't summarily change the RO/RW state. */ |
| @@ -16,11 +16,11 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/namei.h> |
| 17 | 17 | #include <linux/tracefs.h> |
| 18 | 18 | #include <linux/fsnotify.h> |
| 19 | +#include <linux/security.h> | |
| 19 | 20 | #include <linux/seq_file.h> |
| 20 | 21 | #include <linux/parser.h> |
| 21 | 22 | #include <linux/magic.h> |
| 22 | 23 | #include <linux/slab.h> |
| 23 | −#include <linux/security.h> | |
| 24 | 24 | |
| 25 | 25 | #define TRACEFS_DEFAULT_MODE 0700 |
| 26 | 26 | |
| @@ -28,25 +28,6 @@ static struct vfsmount *tracefs_mount; · 1 unmodified line | ||
| 28 | 28 | static int tracefs_mount_count; |
| 29 | 29 | static bool tracefs_registered; |
| 30 | 30 | |
| 31 | −static int default_open_file(struct inode *inode, struct file *filp) | |
| 32 | −{ | |
| 33 | − struct dentry *dentry = filp->f_path.dentry; | |
| 34 | − struct file_operations *real_fops; | |
| 35 | − int ret; | |
| 36 | − | |
| 37 | − if (!dentry) | |
| 38 | − return -EINVAL; | |
| 39 | − | |
| 40 | − ret = security_locked_down(LOCKDOWN_TRACEFS); | |
| 41 | − if (ret) | |
| 42 | − return ret; | |
| 43 | − | |
| 44 | − real_fops = dentry->d_fsdata; | |
| 45 | − if (!real_fops->open) | |
| 46 | − return 0; | |
| 47 | − return real_fops->open(inode, filp); | |
| 48 | −} | |
| 49 | − | |
| 50 | 31 | static ssize_t default_read_file(struct file *file, char __user *buf, |
| 51 | 32 | size_t count, loff_t *ppos) |
| 52 | 33 | { |
| @@ -241,12 +222,6 @@ static int tracefs_apply_options(struct super_block *sb) · 188 unmodified lines | ||
| 241 | 222 | return 0; |
| 242 | 223 | } |
| 243 | 224 | |
| 244 | −static void tracefs_destroy_inode(struct inode *inode) | |
| 245 | −{ | |
| 246 | − if (S_ISREG(inode->i_mode)) | |
| 247 | − kfree(inode->i_fop); | |
| 248 | −} | |
| 249 | − | |
| 250 | 225 | static int tracefs_remount(struct super_block *sb, int *flags, char *data) |
| 251 | 226 | { |
| 252 | 227 | int err; |
| @@ -283,7 +258,6 @@ static int tracefs_show_options(struct seq_file *m, struct dentry *root) · 30 unmodified lines | ||
| 283 | 258 | static const struct super_operations tracefs_super_operations = { |
| 284 | 259 | .statfs = simple_statfs, |
| 285 | 260 | .remount_fs = tracefs_remount, |
| 286 | − .destroy_inode = tracefs_destroy_inode, | |
| 287 | 261 | .show_options = tracefs_show_options, |
| 288 | 262 | }; |
| 289 | 263 | |
| @@ -414,10 +388,12 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, · 124 unmodified lines | ||
| 414 | 388 | struct dentry *parent, void *data, |
| 415 | 389 | const struct file_operations *fops) |
| 416 | 390 | { |
| 417 | − struct file_operations *proxy_fops; | |
| 418 | 391 | struct dentry *dentry; |
| 419 | 392 | struct inode *inode; |
| 420 | 393 | |
| 394 | + if (security_locked_down(LOCKDOWN_TRACEFS)) | |
| 395 | + return NULL; | |
| 396 | + | |
| 421 | 397 | if (!(mode & S_IFMT)) |
| 422 | 398 | mode |= S_IFREG; |
| 423 | 399 | BUG_ON(!S_ISREG(mode)); |
| @@ -430,20 +406,8 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, · 6 unmodified lines | ||
| 430 | 406 | if (unlikely(!inode)) |
| 431 | 407 | return failed_creating(dentry); |
| 432 | 408 | |
| 433 | − proxy_fops = kzalloc(sizeof(struct file_operations), GFP_KERNEL); | |
| 434 | − if (unlikely(!proxy_fops)) { | |
| 435 | − iput(inode); | |
| 436 | − return failed_creating(dentry); | |
| 437 | − } | |
| 438 | − | |
| 439 | − if (!fops) | |
| 440 | − fops = &tracefs_file_operations; | |
| 441 | − | |
| 442 | − dentry->d_fsdata = (void *)fops; | |
| 443 | − memcpy(proxy_fops, fops, sizeof(*proxy_fops)); | |
| 444 | − proxy_fops->open = default_open_file; | |
| 445 | 409 | inode->i_mode = mode; |
| 446 | − inode->i_fop = proxy_fops; | |
| 410 | + inode->i_fop = fops ? fops : &tracefs_file_operations; | |
| 447 | 411 | inode->i_private = data; |
| 448 | 412 | d_instantiate(dentry, inode); |
| 449 | 413 | fsnotify_create(dentry->d_parent->d_inode, dentry); |
| @@ -28,12 +28,11 @@ xfs_get_aghdr_buf( · 27 unmodified lines | ||
| 28 | 28 | struct xfs_mount *mp, |
| 29 | 29 | xfs_daddr_t blkno, |
| 30 | 30 | size_t numblks, |
| 31 | − int flags, | |
| 32 | 31 | const struct xfs_buf_ops *ops) |
| 33 | 32 | { |
| 34 | 33 | struct xfs_buf *bp; |
| 35 | 34 | |
| 36 | − bp = xfs_buf_get_uncached(mp->m_ddev_targp, numblks, flags); | |
| 35 | + bp = xfs_buf_get_uncached(mp->m_ddev_targp, numblks, 0); | |
| 37 | 36 | if (!bp) |
| 38 | 37 | return NULL; |
| 39 | 38 | |
| @@ -345,7 +344,7 @@ xfs_ag_init_hdr( · 305 unmodified lines | ||
| 345 | 344 | { |
| 346 | 345 | struct xfs_buf *bp; |
| 347 | 346 | |
| 348 | − bp = xfs_get_aghdr_buf(mp, id->daddr, id->numblks, 0, ops); | |
| 347 | + bp = xfs_get_aghdr_buf(mp, id->daddr, id->numblks, ops); | |
| 349 | 348 | if (!bp) |
| 350 | 349 | return -ENOMEM; |
| 351 | 350 | |
| @@ -826,32 +826,17 @@ xfs_attr_shortform_to_leaf( · 825 unmodified lines | ||
| 826 | 826 | sf = (xfs_attr_shortform_t *)tmpbuffer; |
| 827 | 827 | |
| 828 | 828 | xfs_idata_realloc(dp, -size, XFS_ATTR_FORK); |
| 829 | − xfs_bmap_local_to_extents_empty(dp, XFS_ATTR_FORK); | |
| 829 | + xfs_bmap_local_to_extents_empty(args->trans, dp, XFS_ATTR_FORK); | |
| 830 | 830 | |
| 831 | 831 | bp = NULL; |
| 832 | 832 | error = xfs_da_grow_inode(args, &blkno); |
| 833 | − if (error) { | |
| 834 | − /* | |
| 835 | − * If we hit an IO error middle of the transaction inside | |
| 836 | − * grow_inode(), we may have inconsistent data. Bail out. | |
| 837 | − */ | |
| 838 | − if (error == -EIO) | |
| 839 | − goto out; | |
| 840 | − xfs_idata_realloc(dp, size, XFS_ATTR_FORK); /* try to put */ | |
| 841 | − memcpy(ifp->if_u1.if_data, tmpbuffer, size); /* it back */ | |
| 833 | + if (error) | |
| 842 | 834 | goto out; |
| 843 | − } | |
| 844 | 835 | |
| 845 | 836 | ASSERT(blkno == 0); |
| 846 | 837 | error = xfs_attr3_leaf_create(args, blkno, &bp); |
| 847 | − if (error) { | |
| 848 | − /* xfs_attr3_leaf_create may not have instantiated a block */ | |
| 849 | − if (bp && (xfs_da_shrink_inode(args, 0, bp) != 0)) | |
| 850 | − goto out; | |
| 851 | − xfs_idata_realloc(dp, size, XFS_ATTR_FORK); /* try to put */ | |
| 852 | − memcpy(ifp->if_u1.if_data, tmpbuffer, size); /* it back */ | |
| 838 | + if (error) | |
| 853 | 839 | goto out; |
| 854 | − } | |
| 855 | 840 | |
| 856 | 841 | memset((char *)&nargs, 0, sizeof(nargs)); |
| 857 | 842 | nargs.dp = dp; |
| @@ -792,6 +792,7 @@ out_root_realloc: · 791 unmodified lines | ||
| 792 | 792 | */ |
| 793 | 793 | void |
| 794 | 794 | xfs_bmap_local_to_extents_empty( |
| 795 | + struct xfs_trans *tp, | |
| 795 | 796 | struct xfs_inode *ip, |
| 796 | 797 | int whichfork) |
| 797 | 798 | { |
| @@ -808,6 +809,7 @@ xfs_bmap_local_to_extents_empty( · 10 unmodified lines | ||
| 808 | 809 | ifp->if_u1.if_root = NULL; |
| 809 | 810 | ifp->if_height = 0; |
| 810 | 811 | XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS); |
| 812 | + xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | |
| 811 | 813 | } |
| 812 | 814 | |
| 813 | 815 | |
| @@ -840,7 +842,7 @@ xfs_bmap_local_to_extents( · 26 unmodified lines | ||
| 840 | 842 | ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL); |
| 841 | 843 | |
| 842 | 844 | if (!ifp->if_bytes) { |
| 843 | − xfs_bmap_local_to_extents_empty(ip, whichfork); | |
| 845 | + xfs_bmap_local_to_extents_empty(tp, ip, whichfork); | |
| 844 | 846 | flags = XFS_ILOG_CORE; |
| 845 | 847 | goto done; |
| 846 | 848 | } |
| @@ -887,7 +889,7 @@ xfs_bmap_local_to_extents( · 40 unmodified lines | ||
| 887 | 889 | |
| 888 | 890 | /* account for the change in fork size */ |
| 889 | 891 | xfs_idata_realloc(ip, -ifp->if_bytes, whichfork); |
| 890 | − xfs_bmap_local_to_extents_empty(ip, whichfork); | |
| 892 | + xfs_bmap_local_to_extents_empty(tp, ip, whichfork); | |
| 891 | 893 | flags |= XFS_ILOG_CORE; |
| 892 | 894 | |
| 893 | 895 | ifp->if_u1.if_root = NULL; |
| @@ -182,7 +182,8 @@ void xfs_trim_extent(struct xfs_bmbt_irec *irec, xfs_fileoff_t bno, · 181 unmodified lines | ||
| 182 | 182 | xfs_filblks_t len); |
| 183 | 183 | int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd); |
| 184 | 184 | int xfs_bmap_set_attrforkoff(struct xfs_inode *ip, int size, int *version); |
| 185 | −void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork); | |
| 185 | +void xfs_bmap_local_to_extents_empty(struct xfs_trans *tp, | |
| 186 | + struct xfs_inode *ip, int whichfork); | |
| 186 | 187 | void __xfs_bmap_add_free(struct xfs_trans *tp, xfs_fsblock_t bno, |
| 187 | 188 | xfs_filblks_t len, const struct xfs_owner_info *oinfo, |
| 188 | 189 | bool skip_discard); |
| @@ -1096,7 +1096,7 @@ xfs_dir2_sf_to_block( · 1095 unmodified lines | ||
| 1096 | 1096 | memcpy(sfp, oldsfp, ifp->if_bytes); |
| 1097 | 1097 | |
| 1098 | 1098 | xfs_idata_realloc(dp, -ifp->if_bytes, XFS_DATA_FORK); |
| 1099 | − xfs_bmap_local_to_extents_empty(dp, XFS_DATA_FORK); | |
| 1099 | + xfs_bmap_local_to_extents_empty(tp, dp, XFS_DATA_FORK); | |
| 1100 | 1100 | dp->i_d.di_size = 0; |
| 1101 | 1101 | |
| 1102 | 1102 | /* |
| @@ -341,7 +341,6 @@ xchk_refcountbt_rec( · 340 unmodified lines | ||
| 341 | 341 | xfs_extlen_t len; |
| 342 | 342 | xfs_nlink_t refcount; |
| 343 | 343 | bool has_cowflag; |
| 344 | − int error = 0; | |
| 345 | 344 | |
| 346 | 345 | bno = be32_to_cpu(rec->refc.rc_startblock); |
| 347 | 346 | len = be32_to_cpu(rec->refc.rc_blockcount); |
| @@ -366,7 +365,7 @@ xchk_refcountbt_rec( · 18 unmodified lines | ||
| 366 | 365 | |
| 367 | 366 | xchk_refcountbt_xref(bs->sc, bno, len, refcount); |
| 368 | 367 | |
| 369 | − return error; | |
| 368 | + return 0; | |
| 370 | 369 | } |
| 371 | 370 | |
| 372 | 371 | /* Make sure we have as many refc blocks as the rmap says. */ |
| @@ -864,6 +864,7 @@ xfs_alloc_file_space( · 863 unmodified lines | ||
| 864 | 864 | xfs_filblks_t allocatesize_fsb; |
| 865 | 865 | xfs_extlen_t extsz, temp; |
| 866 | 866 | xfs_fileoff_t startoffset_fsb; |
| 867 | + xfs_fileoff_t endoffset_fsb; | |
| 867 | 868 | int nimaps; |
| 868 | 869 | int quota_flag; |
| 869 | 870 | int rt; |
| @@ -891,7 +892,8 @@ xfs_alloc_file_space( · 21 unmodified lines | ||
| 891 | 892 | imapp = &imaps[0]; |
| 892 | 893 | nimaps = 1; |
| 893 | 894 | startoffset_fsb = XFS_B_TO_FSBT(mp, offset); |
| 894 | − allocatesize_fsb = XFS_B_TO_FSB(mp, count); | |
| 895 | + endoffset_fsb = XFS_B_TO_FSB(mp, offset + count); | |
| 896 | + allocatesize_fsb = endoffset_fsb - startoffset_fsb; | |
| 895 | 897 | |
| 896 | 898 | /* |
| 897 | 899 | * Allocate file space until done or until there is an error |
| @@ -345,6 +345,15 @@ xfs_buf_allocate_memory( · 344 unmodified lines | ||
| 345 | 345 | unsigned short page_count, i; |
| 346 | 346 | xfs_off_t start, end; |
| 347 | 347 | int error; |
| 348 | + xfs_km_flags_t kmflag_mask = 0; | |
| 349 | + | |
| 350 | + /* | |
| 351 | + * assure zeroed buffer for non-read cases. | |
| 352 | + */ | |
| 353 | + if (!(flags & XBF_READ)) { | |
| 354 | + kmflag_mask |= KM_ZERO; | |
| 355 | + gfp_mask |= __GFP_ZERO; | |
| 356 | + } | |
| 348 | 357 | |
| 349 | 358 | /* |
| 350 | 359 | * for buffers that are contained within a single page, just allocate |
| @@ -354,7 +363,8 @@ xfs_buf_allocate_memory( · 3 unmodified lines | ||
| 354 | 363 | size = BBTOB(bp->b_length); |
| 355 | 364 | if (size < PAGE_SIZE) { |
| 356 | 365 | int align_mask = xfs_buftarg_dma_alignment(bp->b_target); |
| 357 | − bp->b_addr = kmem_alloc_io(size, align_mask, KM_NOFS); | |
| 366 | + bp->b_addr = kmem_alloc_io(size, align_mask, | |
| 367 | + KM_NOFS | kmflag_mask); | |
| 358 | 368 | if (!bp->b_addr) { |
| 359 | 369 | /* low memory - use alloc_page loop instead */ |
| 360 | 370 | goto use_alloc_page; |
| @@ -1443,7 +1443,7 @@ xlog_alloc_log( · 1442 unmodified lines | ||
| 1443 | 1443 | prev_iclog = iclog; |
| 1444 | 1444 | |
| 1445 | 1445 | iclog->ic_data = kmem_alloc_io(log->l_iclog_size, align_mask, |
| 1446 | − KM_MAYFAIL); | |
| 1446 | + KM_MAYFAIL | KM_ZERO); | |
| 1447 | 1447 | if (!iclog->ic_data) |
| 1448 | 1448 | goto out_free_iclog; |
| 1449 | 1449 | #ifdef DEBUG |
| @@ -127,7 +127,7 @@ xlog_alloc_buffer( · 126 unmodified lines | ||
| 127 | 127 | if (nbblks > 1 && log->l_sectBBsize > 1) |
| 128 | 128 | nbblks += log->l_sectBBsize; |
| 129 | 129 | nbblks = round_up(nbblks, log->l_sectBBsize); |
| 130 | − return kmem_alloc_io(BBTOB(nbblks), align_mask, KM_MAYFAIL); | |
| 130 | + return kmem_alloc_io(BBTOB(nbblks), align_mask, KM_MAYFAIL | KM_ZERO); | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /* |
| @@ -326,10 +326,11 @@ static inline int bitmap_equal(const unsigned long *src1, · 325 unmodified lines | ||
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /** |
| 329 | − * bitmap_or_equal - Check whether the or of two bitnaps is equal to a third | |
| 329 | + * bitmap_or_equal - Check whether the or of two bitmaps is equal to a third | |
| 330 | 330 | * @src1: Pointer to bitmap 1 |
| 331 | 331 | * @src2: Pointer to bitmap 2 will be or'ed with bitmap 1 |
| 332 | 332 | * @src3: Pointer to bitmap 3. Compare to the result of *@src1 | *@src2 |
| 333 | + * @nbits: number of bits in each of these bitmaps | |
| 333 | 334 | * |
| 334 | 335 | * Returns: True if (*@src1 | *@src2) == *@src3, false otherwise |
| 335 | 336 | */ |
| @@ -4,6 +4,13 @@ · 3 unmodified lines | ||
| 4 | 4 | #include <asm/types.h> |
| 5 | 5 | #include <linux/bits.h> |
| 6 | 6 | |
| 7 | +/* Set bits in the first 'n' bytes when loaded from memory */ | |
| 8 | +#ifdef __LITTLE_ENDIAN | |
| 9 | +# define aligned_byte_mask(n) ((1UL << 8*(n))-1) | |
| 10 | +#else | |
| 11 | +# define aligned_byte_mask(n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n))) | |
| 12 | +#endif | |
| 13 | + | |
| 7 | 14 | #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) |
| 8 | 15 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) |
| 9 | 16 | |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | # define __GCC4_has_attribute___noclone__ 1 |
| 41 | 41 | # define __GCC4_has_attribute___nonstring__ 0 |
| 42 | 42 | # define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8) |
| 43 | +# define __GCC4_has_attribute___fallthrough__ 0 | |
| 43 | 44 | #endif |
| 44 | 45 | |
| 45 | 46 | /* |
| @@ -185,6 +186,22 @@ · 139 unmodified lines | ||
| 185 | 186 | # define __noclone |
| 186 | 187 | #endif |
| 187 | 188 | |
| 189 | +/* | |
| 190 | + * Add the pseudo keyword 'fallthrough' so case statement blocks | |
| 191 | + * must end with any of these keywords: | |
| 192 | + * break; | |
| 193 | + * fallthrough; | |
| 194 | + * goto <label>; | |
| 195 | + * return [expression]; | |
| 196 | + * | |
| 197 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes | |
| 198 | + */ | |
| 199 | +#if __has_attribute(__fallthrough__) | |
| 200 | +# define fallthrough __attribute__((__fallthrough__)) | |
| 201 | +#else | |
| 202 | +# define fallthrough do {} while (0) /* fallthrough */ | |
| 203 | +#endif | |
| 204 | + | |
| 188 | 205 | /* |
| 189 | 206 | * Note the missing underscores. |
| 190 | 207 | * |
| @@ -31,6 +31,8 @@ · 30 unmodified lines | ||
| 31 | 31 | #define SJA1105_META_SMAC 0x222222222222ull |
| 32 | 32 | #define SJA1105_META_DMAC 0x0180C200000Eull |
| 33 | 33 | |
| 34 | +#define SJA1105_HWTS_RX_EN 0 | |
| 35 | + | |
| 34 | 36 | /* Global tagger data: each struct sja1105_port has a reference to |
| 35 | 37 | * the structure defined in struct sja1105_private. |
| 36 | 38 | */ |
| @@ -42,7 +44,7 @@ struct sja1105_tagger_data { · 5 unmodified lines | ||
| 42 | 44 | * from taggers running on multiple ports on SMP systems |
| 43 | 45 | */ |
| 44 | 46 | spinlock_t meta_lock; |
| 45 | − bool hwts_rx_en; | |
| 47 | + unsigned long state; | |
| 46 | 48 | }; |
| 47 | 49 | |
| 48 | 50 | struct sja1105_skb_cb { |
| @@ -52,10 +52,10 @@ extern struct module __this_module; · 51 unmodified lines | ||
| 52 | 52 | __ADDRESSABLE(sym) \ |
| 53 | 53 | asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ |
| 54 | 54 | " .balign 4 \n" \ |
| 55 | − "__ksymtab_" #sym NS_SEPARATOR #ns ": \n" \ | |
| 55 | + "__ksymtab_" #ns NS_SEPARATOR #sym ": \n" \ | |
| 56 | 56 | " .long " #sym "- . \n" \ |
| 57 | 57 | " .long __kstrtab_" #sym "- . \n" \ |
| 58 | − " .long __kstrtab_ns_" #sym "- . \n" \ | |
| 58 | + " .long __kstrtabns_" #sym "- . \n" \ | |
| 59 | 59 | " .previous \n") |
| 60 | 60 | |
| 61 | 61 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| @@ -76,10 +76,10 @@ struct kernel_symbol { · 14 unmodified lines | ||
| 76 | 76 | #else |
| 77 | 77 | #define __KSYMTAB_ENTRY_NS(sym, sec, ns) \ |
| 78 | 78 | static const struct kernel_symbol __ksymtab_##sym##__##ns \ |
| 79 | − asm("__ksymtab_" #sym NS_SEPARATOR #ns) \ | |
| 79 | + asm("__ksymtab_" #ns NS_SEPARATOR #sym) \ | |
| 80 | 80 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ |
| 81 | 81 | __aligned(sizeof(void *)) \ |
| 82 | − = { (unsigned long)&sym, __kstrtab_##sym, __kstrtab_ns_##sym } | |
| 82 | + = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } | |
| 83 | 83 | |
| 84 | 84 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| 85 | 85 | static const struct kernel_symbol __ksymtab_##sym \ |
| @@ -112,7 +112,7 @@ struct kernel_symbol { · 26 unmodified lines | ||
| 112 | 112 | /* For every exported symbol, place a struct in the __ksymtab section */ |
| 113 | 113 | #define ___EXPORT_SYMBOL_NS(sym, sec, ns) \ |
| 114 | 114 | ___export_symbol_common(sym, sec); \ |
| 115 | − static const char __kstrtab_ns_##sym[] \ | |
| 115 | + static const char __kstrtabns_##sym[] \ | |
| 116 | 116 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ |
| 117 | 117 | = #ns; \ |
| 118 | 118 | __KSYMTAB_ENTRY_NS(sym, sec, ns) |
| @@ -235,7 +235,7 @@ enum hwmon_power_attributes { · 234 unmodified lines | ||
| 235 | 235 | #define HWMON_P_LABEL BIT(hwmon_power_label) |
| 236 | 236 | #define HWMON_P_ALARM BIT(hwmon_power_alarm) |
| 237 | 237 | #define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm) |
| 238 | −#define HWMON_P_MIN_ALARM BIT(hwmon_power_max_alarm) | |
| 238 | +#define HWMON_P_MIN_ALARM BIT(hwmon_power_min_alarm) | |
| 239 | 239 | #define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm) |
| 240 | 240 | #define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm) |
| 241 | 241 | #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm) |
| @@ -1090,6 +1090,7 @@ enum kvm_stat_kind { · 1089 unmodified lines | ||
| 1090 | 1090 | |
| 1091 | 1091 | struct kvm_stat_data { |
| 1092 | 1092 | int offset; |
| 1093 | + int mode; | |
| 1093 | 1094 | struct kvm *kvm; |
| 1094 | 1095 | }; |
| 1095 | 1096 | |
| @@ -1097,6 +1098,7 @@ struct kvm_stats_debugfs_item { · 1 unmodified line | ||
| 1097 | 1098 | const char *name; |
| 1098 | 1099 | int offset; |
| 1099 | 1100 | enum kvm_stat_kind kind; |
| 1101 | + int mode; | |
| 1100 | 1102 | }; |
| 1101 | 1103 | extern struct kvm_stats_debugfs_item debugfs_entries[]; |
| 1102 | 1104 | extern struct dentry *kvm_debugfs_dir; |
| @@ -247,7 +247,7 @@ extern void led_set_brightness(struct led_classdev *led_cdev, · 246 unmodified lines | ||
| 247 | 247 | /** |
| 248 | 248 | * led_set_brightness_sync - set LED brightness synchronously |
| 249 | 249 | * @led_cdev: the LED to set |
| 250 | − * @brightness: the brightness to set it to | |
| 250 | + * @value: the brightness to set it to | |
| 251 | 251 | * |
| 252 | 252 | * Set an LED's brightness immediately. This function will block |
| 253 | 253 | * the caller for the time required for accessing device registers, |
| @@ -301,8 +301,7 @@ extern void led_sysfs_enable(struct led_classdev *led_cdev); · 47 unmodified lines | ||
| 301 | 301 | /** |
| 302 | 302 | * led_compose_name - compose LED class device name |
| 303 | 303 | * @dev: LED controller device object |
| 304 | − * @child: child fwnode_handle describing a LED or a group of synchronized LEDs; | |
| 305 | − * it must be provided only for fwnode based LEDs | |
| 304 | + * @init_data: the LED class device initialization data | |
| 306 | 305 | * @led_classdev_name: composed LED class device name |
| 307 | 306 | * |
| 308 | 307 | * Create LED class device name basing on the provided init_data argument. |
| @@ -356,6 +356,19 @@ static inline bool mem_cgroup_disabled(void) · 355 unmodified lines | ||
| 356 | 356 | return !cgroup_subsys_enabled(memory_cgrp_subsys); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | +static inline unsigned long mem_cgroup_protection(struct mem_cgroup *memcg, | |
| 360 | + bool in_low_reclaim) | |
| 361 | +{ | |
| 362 | + if (mem_cgroup_disabled()) | |
| 363 | + return 0; | |
| 364 | + | |
| 365 | + if (in_low_reclaim) | |
| 366 | + return READ_ONCE(memcg->memory.emin); | |
| 367 | + | |
| 368 | + return max(READ_ONCE(memcg->memory.emin), | |
| 369 | + READ_ONCE(memcg->memory.elow)); | |
| 370 | +} | |
| 371 | + | |
| 359 | 372 | enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, |
| 360 | 373 | struct mem_cgroup *memcg); |
| 361 | 374 | |
| @@ -537,6 +550,8 @@ void mem_cgroup_handle_over_high(void); · 175 unmodified lines | ||
| 537 | 550 | |
| 538 | 551 | unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg); |
| 539 | 552 | |
| 553 | +unsigned long mem_cgroup_size(struct mem_cgroup *memcg); | |
| 554 | + | |
| 540 | 555 | void mem_cgroup_print_oom_context(struct mem_cgroup *memcg, |
| 541 | 556 | struct task_struct *p); |
| 542 | 557 | |
| @@ -829,6 +844,12 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm, · 286 unmodified lines | ||
| 829 | 844 | { |
| 830 | 845 | } |
| 831 | 846 | |
| 847 | +static inline unsigned long mem_cgroup_protection(struct mem_cgroup *memcg, | |
| 848 | + bool in_low_reclaim) | |
| 849 | +{ | |
| 850 | + return 0; | |
| 851 | +} | |
| 852 | + | |
| 832 | 853 | static inline enum mem_cgroup_protection mem_cgroup_protected( |
| 833 | 854 | struct mem_cgroup *root, struct mem_cgroup *memcg) |
| 834 | 855 | { |
| @@ -968,6 +989,11 @@ static inline unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg) · 133 unmodified lines | ||
| 968 | 989 | return 0; |
| 969 | 990 | } |
| 970 | 991 | |
| 992 | +static inline unsigned long mem_cgroup_size(struct mem_cgroup *memcg) | |
| 993 | +{ | |
| 994 | + return 0; | |
| 995 | +} | |
| 996 | + | |
| 971 | 997 | static inline void |
| 972 | 998 | mem_cgroup_print_oom_context(struct mem_cgroup *memcg, struct task_struct *p) |
| 973 | 999 | { |
| @@ -1264,6 +1290,9 @@ void mem_cgroup_track_foreign_dirty_slowpath(struct page *page, · 290 unmodified lines | ||
| 1264 | 1290 | static inline void mem_cgroup_track_foreign_dirty(struct page *page, |
| 1265 | 1291 | struct bdi_writeback *wb) |
| 1266 | 1292 | { |
| 1293 | + if (mem_cgroup_disabled()) | |
| 1294 | + return; | |
| 1295 | + | |
| 1267 | 1296 | if (unlikely(&page->mem_cgroup->css != wb->memcg_css)) |
| 1268 | 1297 | mem_cgroup_track_foreign_dirty_slowpath(page, wb); |
| 1269 | 1298 | } |
| @@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising, · 454 unmodified lines | ||
| 455 | 455 | lp_advertising, lpa & LPA_LPACK); |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | +static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising, | |
| 459 | + u32 ctrl1000) | |
| 460 | +{ | |
| 461 | + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising, | |
| 462 | + ctrl1000 & ADVERTISE_1000HALF); | |
| 463 | + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising, | |
| 464 | + ctrl1000 & ADVERTISE_1000FULL); | |
| 465 | +} | |
| 466 | + | |
| 458 | 467 | /** |
| 459 | 468 | * linkmode_adv_to_lcl_adv_t |
| 460 | 469 | * @advertising:pointer to linkmode advertising |
| @@ -18,7 +18,7 @@ struct page_ext_operations { · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | enum page_ext_flags { |
| 20 | 20 | PAGE_EXT_OWNER, |
| 21 | − PAGE_EXT_OWNER_ACTIVE, | |
| 21 | + PAGE_EXT_OWNER_ALLOCATED, | |
| 22 | 22 | #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT) |
| 23 | 23 | PAGE_EXT_YOUNG, |
| 24 | 24 | PAGE_EXT_IDLE, |
| @@ -36,6 +36,7 @@ struct page_ext { · 11 unmodified lines | ||
| 36 | 36 | unsigned long flags; |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | +extern unsigned long page_ext_size; | |
| 39 | 40 | extern void pgdat_page_ext_init(struct pglist_data *pgdat); |
| 40 | 41 | |
| 41 | 42 | #ifdef CONFIG_SPARSEMEM |
| @@ -52,6 +53,13 @@ static inline void page_ext_init(void) · 10 unmodified lines | ||
| 52 | 53 | |
| 53 | 54 | struct page_ext *lookup_page_ext(const struct page *page); |
| 54 | 55 | |
| 56 | +static inline struct page_ext *page_ext_next(struct page_ext *curr) | |
| 57 | +{ | |
| 58 | + void *next = curr; | |
| 59 | + next += page_ext_size; | |
| 60 | + return next; | |
| 61 | +} | |
| 62 | + | |
| 55 | 63 | #else /* !CONFIG_PAGE_EXTENSION */ |
| 56 | 64 | struct page_ext; |
| 57 | 65 | |
| @@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 677 unmodified lines | ||
| 678 | 678 | return phydev->state >= PHY_UP; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | +void phy_resolve_aneg_pause(struct phy_device *phydev); | |
| 681 | 682 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); |
| 682 | 683 | |
| 683 | 684 | /** |
| @@ -1076,6 +1077,7 @@ int genphy_config_eee_advert(struct phy_device *phydev); · 392 unmodified lines | ||
| 1076 | 1077 | int __genphy_config_aneg(struct phy_device *phydev, bool changed); |
| 1077 | 1078 | int genphy_aneg_done(struct phy_device *phydev); |
| 1078 | 1079 | int genphy_update_link(struct phy_device *phydev); |
| 1080 | +int genphy_read_lpa(struct phy_device *phydev); | |
| 1079 | 1081 | int genphy_read_status(struct phy_device *phydev); |
| 1080 | 1082 | int genphy_suspend(struct phy_device *phydev); |
| 1081 | 1083 | int genphy_resume(struct phy_device *phydev); |
| @@ -64,6 +64,8 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, · 63 unmodified lines | ||
| 64 | 64 | unsigned int, |
| 65 | 65 | const char *); |
| 66 | 66 | extern int platform_get_irq_byname(struct platform_device *, const char *); |
| 67 | +extern int platform_get_irq_byname_optional(struct platform_device *dev, | |
| 68 | + const char *name); | |
| 67 | 69 | extern int platform_add_devices(struct platform_device **, int); |
| 68 | 70 | |
| 69 | 71 | struct platform_device_info { |
| @@ -97,7 +97,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot); · 96 unmodified lines | ||
| 97 | 97 | |
| 98 | 98 | int dquot_file_open(struct inode *inode, struct file *file); |
| 99 | 99 | |
| 100 | −int dquot_enable(struct inode *inode, int type, int format_id, | |
| 100 | +int dquot_load_quota_sb(struct super_block *sb, int type, int format_id, | |
| 101 | + unsigned int flags); | |
| 102 | +int dquot_load_quota_inode(struct inode *inode, int type, int format_id, | |
| 101 | 103 | unsigned int flags); |
| 102 | 104 | int dquot_quota_on(struct super_block *sb, int type, int format_id, |
| 103 | 105 | const struct path *path); |
| @@ -4160,15 +4160,12 @@ static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} · 4159 unmodified lines | ||
| 4160 | 4160 | static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} |
| 4161 | 4161 | #endif /* CONFIG_SKB_EXTENSIONS */ |
| 4162 | 4162 | |
| 4163 | −static inline void nf_reset(struct sk_buff *skb) | |
| 4163 | +static inline void nf_reset_ct(struct sk_buff *skb) | |
| 4164 | 4164 | { |
| 4165 | 4165 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 4166 | 4166 | nf_conntrack_put(skb_nfct(skb)); |
| 4167 | 4167 | skb->_nfct = 0; |
| 4168 | 4168 | #endif |
| 4169 | −#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) | |
| 4170 | − skb_ext_del(skb, SKB_EXT_BRIDGE_NF); | |
| 4171 | −#endif | |
| 4172 | 4169 | } |
| 4173 | 4170 | |
| 4174 | 4171 | static inline void nf_reset_trace(struct sk_buff *skb) |
| @@ -493,6 +493,10 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) · 492 unmodified lines | ||
| 493 | 493 | * kmalloc is the normal method of allocating memory |
| 494 | 494 | * for objects smaller than page size in the kernel. |
| 495 | 495 | * |
| 496 | + * The allocated object address is aligned to at least ARCH_KMALLOC_MINALIGN | |
| 497 | + * bytes. For @size of power of two bytes, the alignment is also guaranteed | |
| 498 | + * to be at least to the size. | |
| 499 | + * | |
| 496 | 500 | * The @flags argument may be one of the GFP flags defined at |
| 497 | 501 | * include/linux/gfp.h and described at |
| 498 | 502 | * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>` |
| @@ -227,7 +227,26 @@ static inline bool strstarts(const char *str, const char *prefix) · 226 unmodified lines | ||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | size_t memweight(const void *ptr, size_t bytes); |
| 230 | −void memzero_explicit(void *s, size_t count); | |
| 230 | + | |
| 231 | +/** | |
| 232 | + * memzero_explicit - Fill a region of memory (e.g. sensitive | |
| 233 | + * keying data) with 0s. | |
| 234 | + * @s: Pointer to the start of the area. | |
| 235 | + * @count: The size of the area. | |
| 236 | + * | |
| 237 | + * Note: usually using memset() is just fine (!), but in cases | |
| 238 | + * where clearing out _local_ data at the end of a scope is | |
| 239 | + * necessary, memzero_explicit() should be used instead in | |
| 240 | + * order to prevent the compiler from optimising away zeroing. | |
| 241 | + * | |
| 242 | + * memzero_explicit() doesn't need an arch-specific version as | |
| 243 | + * it just invokes the one of memset() implicitly. | |
| 244 | + */ | |
| 245 | +static inline void memzero_explicit(void *s, size_t count) | |
| 246 | +{ | |
| 247 | + memset(s, 0, count); | |
| 248 | + barrier_data(s); | |
| 249 | +} | |
| 231 | 250 | |
| 232 | 251 | /** |
| 233 | 252 | * kbasename - return the last part of a pathname. |
| @@ -61,6 +61,7 @@ struct sock_xprt { · 60 unmodified lines | ||
| 61 | 61 | struct mutex recv_mutex; |
| 62 | 62 | struct sockaddr_storage srcaddr; |
| 63 | 63 | unsigned short srcport; |
| 64 | + int xprt_err; | |
| 64 | 65 | |
| 65 | 66 | /* |
| 66 | 67 | * UDP socket buffer size parameters |
| @@ -152,7 +152,7 @@ struct tcg_algorithm_info { · 151 unmodified lines | ||
| 152 | 152 | * total. Once we've done this we know the offset of the data length field, |
| 153 | 153 | * and can calculate the total size of the event. |
| 154 | 154 | * |
| 155 | − * Return: size of the event on success, <0 on failure | |
| 155 | + * Return: size of the event on success, 0 on failure | |
| 156 | 156 | */ |
| 157 | 157 | |
| 158 | 158 | static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, |
| @@ -170,6 +170,7 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 11 unmodified lines | ||
| 170 | 170 | u16 halg; |
| 171 | 171 | int i; |
| 172 | 172 | int j; |
| 173 | + u32 count, event_type; | |
| 173 | 174 | |
| 174 | 175 | marker = event; |
| 175 | 176 | marker_start = marker; |
| @@ -190,16 +191,22 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 14 unmodified lines | ||
| 190 | 191 | } |
| 191 | 192 | |
| 192 | 193 | event = (struct tcg_pcr_event2_head *)mapping; |
| 194 | + /* | |
| 195 | + * The loop below will unmap these fields if the log is larger than | |
| 196 | + * one page, so save them here for reference: | |
| 197 | + */ | |
| 198 | + count = READ_ONCE(event->count); | |
| 199 | + event_type = READ_ONCE(event->event_type); | |
| 193 | 200 | |
| 194 | 201 | efispecid = (struct tcg_efi_specid_event_head *)event_header->event; |
| 195 | 202 | |
| 196 | 203 | /* Check if event is malformed. */ |
| 197 | − if (event->count > efispecid->num_algs) { | |
| 204 | + if (count > efispecid->num_algs) { | |
| 198 | 205 | size = 0; |
| 199 | 206 | goto out; |
| 200 | 207 | } |
| 201 | 208 | |
| 202 | − for (i = 0; i < event->count; i++) { | |
| 209 | + for (i = 0; i < count; i++) { | |
| 203 | 210 | halg_size = sizeof(event->digests[i].alg_id); |
| 204 | 211 | |
| 205 | 212 | /* Map the digest's algorithm identifier */ |
| @@ -256,8 +263,9 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 50 unmodified lines | ||
| 256 | 263 | + event_field->event_size; |
| 257 | 264 | size = marker - marker_start; |
| 258 | 265 | |
| 259 | − if ((event->event_type == 0) && (event_field->event_size == 0)) | |
| 266 | + if (event_type == 0 && event_field->event_size == 0) | |
| 260 | 267 | size = 0; |
| 268 | + | |
| 261 | 269 | out: |
| 262 | 270 | if (do_mapping) |
| 263 | 271 | TPM_MEMUNMAP(mapping, mapping_size); |
| @@ -231,6 +231,76 @@ __copy_from_user_inatomic_nocache(void *to, const void __user *from, · 230 unmodified lines | ||
| 231 | 231 | |
| 232 | 232 | #endif /* ARCH_HAS_NOCACHE_UACCESS */ |
| 233 | 233 | |
| 234 | +extern __must_check int check_zeroed_user(const void __user *from, size_t size); | |
| 235 | + | |
| 236 | +/** | |
| 237 | + * copy_struct_from_user: copy a struct from userspace | |
| 238 | + * @dst: Destination address, in kernel space. This buffer must be @ksize | |
| 239 | + * bytes long. | |
| 240 | + * @ksize: Size of @dst struct. | |
| 241 | + * @src: Source address, in userspace. | |
| 242 | + * @usize: (Alleged) size of @src struct. | |
| 243 | + * | |
| 244 | + * Copies a struct from userspace to kernel space, in a way that guarantees | |
| 245 | + * backwards-compatibility for struct syscall arguments (as long as future | |
| 246 | + * struct extensions are made such that all new fields are *appended* to the | |
| 247 | + * old struct, and zeroed-out new fields have the same meaning as the old | |
| 248 | + * struct). | |
| 249 | + * | |
| 250 | + * @ksize is just sizeof(*dst), and @usize should've been passed by userspace. | |
| 251 | + * The recommended usage is something like the following: | |
| 252 | + * | |
| 253 | + * SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize) | |
| 254 | + * { | |
| 255 | + * int err; | |
| 256 | + * struct foo karg = {}; | |
| 257 | + * | |
| 258 | + * if (usize > PAGE_SIZE) | |
| 259 | + * return -E2BIG; | |
| 260 | + * if (usize < FOO_SIZE_VER0) | |
| 261 | + * return -EINVAL; | |
| 262 | + * | |
| 263 | + * err = copy_struct_from_user(&karg, sizeof(karg), uarg, usize); | |
| 264 | + * if (err) | |
| 265 | + * return err; | |
| 266 | + * | |
| 267 | + * // ... | |
| 268 | + * } | |
| 269 | + * | |
| 270 | + * There are three cases to consider: | |
| 271 | + * * If @usize == @ksize, then it's copied verbatim. | |
| 272 | + * * If @usize < @ksize, then the userspace has passed an old struct to a | |
| 273 | + * newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize) | |
| 274 | + * are to be zero-filled. | |
| 275 | + * * If @usize > @ksize, then the userspace has passed a new struct to an | |
| 276 | + * older kernel. The trailing bytes unknown to the kernel (@usize - @ksize) | |
| 277 | + * are checked to ensure they are zeroed, otherwise -E2BIG is returned. | |
| 278 | + * | |
| 279 | + * Returns (in all cases, some data may have been copied): | |
| 280 | + * * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src. | |
| 281 | + * * -EFAULT: access to userspace failed. | |
| 282 | + */ | |
| 283 | +static __always_inline __must_check int | |
| 284 | +copy_struct_from_user(void *dst, size_t ksize, const void __user *src, | |
| 285 | + size_t usize) | |
| 286 | +{ | |
| 287 | + size_t size = min(ksize, usize); | |
| 288 | + size_t rest = max(ksize, usize) - size; | |
| 289 | + | |
| 290 | + /* Deal with trailing bytes. */ | |
| 291 | + if (usize < ksize) { | |
| 292 | + memset(dst + size, 0, rest); | |
| 293 | + } else if (usize > ksize) { | |
| 294 | + int ret = check_zeroed_user(src + size, rest); | |
| 295 | + if (ret <= 0) | |
| 296 | + return ret ?: -E2BIG; | |
| 297 | + } | |
| 298 | + /* Copy the interoperable parts of the struct. */ | |
| 299 | + if (copy_from_user(dst, src, size)) | |
| 300 | + return -EFAULT; | |
| 301 | + return 0; | |
| 302 | +} | |
| 303 | + | |
| 234 | 304 | /* |
| 235 | 305 | * probe_kernel_read(): safely attempt to read from a location |
| 236 | 306 | * @dst: pointer to the buffer that shall take the data |
| @@ -285,8 +355,10 @@ extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count); · 48 unmodified lines | ||
| 285 | 355 | #ifndef user_access_begin |
| 286 | 356 | #define user_access_begin(ptr,len) access_ok(ptr, len) |
| 287 | 357 | #define user_access_end() do { } while (0) |
| 288 | −#define unsafe_get_user(x, ptr, err) do { if (unlikely(__get_user(x, ptr))) goto err; } while (0) | |
| 289 | −#define unsafe_put_user(x, ptr, err) do { if (unlikely(__put_user(x, ptr))) goto err; } while (0) | |
| 358 | +#define unsafe_op_wrap(op, err) do { if (unlikely(op)) goto err; } while (0) | |
| 359 | +#define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e) | |
| 360 | +#define unsafe_put_user(x,p,e) unsafe_op_wrap(__put_user(x,p),e) | |
| 361 | +#define unsafe_copy_to_user(d,s,l,e) unsafe_op_wrap(__copy_to_user(d,s,l),e) | |
| 290 | 362 | static inline unsigned long user_access_save(void) { return 0UL; } |
| 291 | 363 | static inline void user_access_restore(unsigned long flags) { } |
| 292 | 364 | #endif |
| @@ -230,8 +230,8 @@ static inline int xa_err(void *entry) · 229 unmodified lines | ||
| 230 | 230 | * This structure is used either directly or via the XA_LIMIT() macro |
| 231 | 231 | * to communicate the range of IDs that are valid for allocation. |
| 232 | 232 | * Two common ranges are predefined for you: |
| 233 | − * * xa_limit_32b - [0 - UINT_MAX] | |
| 234 | − * * xa_limit_31b - [0 - INT_MAX] | |
| 233 | + * * xa_limit_32b - [0 - UINT_MAX] | |
| 234 | + * * xa_limit_31b - [0 - INT_MAX] | |
| 235 | 235 | */ |
| 236 | 236 | struct xa_limit { |
| 237 | 237 | u32 max; |
| @@ -1068,7 +1068,7 @@ TRACE_EVENT(rxrpc_recvmsg, · 1067 unmodified lines | ||
| 1068 | 1068 | ), |
| 1069 | 1069 | |
| 1070 | 1070 | TP_fast_assign( |
| 1071 | − __entry->call = call->debug_id; | |
| 1071 | + __entry->call = call ? call->debug_id : 0; | |
| 1072 | 1072 | __entry->why = why; |
| 1073 | 1073 | __entry->seq = seq; |
| 1074 | 1074 | __entry->offset = offset; |
| @@ -1003,6 +1003,8 @@ struct drm_amdgpu_info_device { · 1002 unmodified lines | ||
| 1003 | 1003 | __u64 high_va_max; |
| 1004 | 1004 | /* gfx10 pa_sc_tile_steering_override */ |
| 1005 | 1005 | __u32 pa_sc_tile_steering_override; |
| 1006 | + /* disabled TCCs */ | |
| 1007 | + __u64 tcc_disabled_mask; | |
| 1006 | 1008 | }; |
| 1007 | 1009 | |
| 1008 | 1010 | struct drm_amdgpu_info_hw_ip { |
| @@ -45,6 +45,27 @@ struct nvme_passthru_cmd { · 44 unmodified lines | ||
| 45 | 45 | __u32 result; |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | +struct nvme_passthru_cmd64 { | |
| 49 | + __u8 opcode; | |
| 50 | + __u8 flags; | |
| 51 | + __u16 rsvd1; | |
| 52 | + __u32 nsid; | |
| 53 | + __u32 cdw2; | |
| 54 | + __u32 cdw3; | |
| 55 | + __u64 metadata; | |
| 56 | + __u64 addr; | |
| 57 | + __u32 metadata_len; | |
| 58 | + __u32 data_len; | |
| 59 | + __u32 cdw10; | |
| 60 | + __u32 cdw11; | |
| 61 | + __u32 cdw12; | |
| 62 | + __u32 cdw13; | |
| 63 | + __u32 cdw14; | |
| 64 | + __u32 cdw15; | |
| 65 | + __u32 timeout_ms; | |
| 66 | + __u64 result; | |
| 67 | +}; | |
| 68 | + | |
| 48 | 69 | #define nvme_admin_cmd nvme_passthru_cmd |
| 49 | 70 | |
| 50 | 71 | #define NVME_IOCTL_ID _IO('N', 0x40) |
| @@ -54,5 +75,7 @@ struct nvme_passthru_cmd { · 3 unmodified lines | ||
| 54 | 75 | #define NVME_IOCTL_RESET _IO('N', 0x44) |
| 55 | 76 | #define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45) |
| 56 | 77 | #define NVME_IOCTL_RESCAN _IO('N', 0x46) |
| 78 | +#define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64) | |
| 79 | +#define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64) | |
| 57 | 80 | |
| 58 | 81 | #endif /* _UAPI_LINUX_NVME_IOCTL_H */ |
| @@ -35,6 +35,9 @@ · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | */ |
| 37 | 37 | |
| 38 | +#ifndef _UAPI_LINUX_PG_H | |
| 39 | +#define _UAPI_LINUX_PG_H | |
| 40 | + | |
| 38 | 41 | #define PG_MAGIC 'P' |
| 39 | 42 | #define PG_RESET 'Z' |
| 40 | 43 | #define PG_COMMAND 'C' |
| @@ -61,4 +64,4 @@ struct pg_read_hdr { · 20 unmodified lines | ||
| 61 | 64 | |
| 62 | 65 | }; |
| 63 | 66 | |
| 64 | −/* end of pg.h */ | |
| 67 | +#endif /* _UAPI_LINUX_PG_H */ | |
| @@ -33,8 +33,31 @@ · 32 unmodified lines | ||
| 33 | 33 | #define CLONE_NEWNET 0x40000000 /* New network namespace */ |
| 34 | 34 | #define CLONE_IO 0x80000000 /* Clone io context */ |
| 35 | 35 | |
| 36 | −/* | |
| 37 | − * Arguments for the clone3 syscall | |
| 36 | +#ifndef __ASSEMBLY__ | |
| 37 | +/** | |
| 38 | + * struct clone_args - arguments for the clone3 syscall | |
| 39 | + * @flags: Flags for the new process as listed above. | |
| 40 | + * All flags are valid except for CSIGNAL and | |
| 41 | + * CLONE_DETACHED. | |
| 42 | + * @pidfd: If CLONE_PIDFD is set, a pidfd will be | |
| 43 | + * returned in this argument. | |
| 44 | + * @child_tid: If CLONE_CHILD_SETTID is set, the TID of the | |
| 45 | + * child process will be returned in the child's | |
| 46 | + * memory. | |
| 47 | + * @parent_tid: If CLONE_PARENT_SETTID is set, the TID of | |
| 48 | + * the child process will be returned in the | |
| 49 | + * parent's memory. | |
| 50 | + * @exit_signal: The exit_signal the parent process will be | |
| 51 | + * sent when the child exits. | |
| 52 | + * @stack: Specify the location of the stack for the | |
| 53 | + * child process. | |
| 54 | + * @stack_size: The size of the stack for the child process. | |
| 55 | + * @tls: If CLONE_SETTLS is set, the tls descriptor | |
| 56 | + * is set to tls. | |
| 57 | + * | |
| 58 | + * The structure is versioned by size and thus extensible. | |
| 59 | + * New struct members must go at the end of the struct and | |
| 60 | + * must be properly 64bit aligned. | |
| 38 | 61 | */ |
| 39 | 62 | struct clone_args { |
| 40 | 63 | __aligned_u64 flags; |
| @@ -46,6 +69,9 @@ struct clone_args { · 5 unmodified lines | ||
| 46 | 69 | __aligned_u64 stack_size; |
| 47 | 70 | __aligned_u64 tls; |
| 48 | 71 | }; |
| 72 | +#endif | |
| 73 | + | |
| 74 | +#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */ | |
| 49 | 75 | |
| 50 | 76 | /* |
| 51 | 77 | * Scheduling policies |
| @@ -291,6 +291,6 @@ · 290 unmodified lines | ||
| 291 | 291 | #define PORT_SUNIX 121 |
| 292 | 292 | |
| 293 | 293 | /* Freescale Linflex UART */ |
| 294 | −#define PORT_LINFLEXUART 121 | |
| 294 | +#define PORT_LINFLEXUART 122 | |
| 295 | 295 | |
| 296 | 296 | #endif /* _UAPILINUX_SERIAL_CORE_H */ |
| @@ -212,30 +212,7 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr, · 211 unmodified lines | ||
| 212 | 212 | |
| 213 | 213 | bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); |
| 214 | 214 | |
| 215 | −efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc); | |
| 216 | −efi_status_t xen_efi_set_time(efi_time_t *tm); | |
| 217 | −efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, | |
| 218 | − efi_time_t *tm); | |
| 219 | −efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm); | |
| 220 | −efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 221 | − u32 *attr, unsigned long *data_size, | |
| 222 | − void *data); | |
| 223 | −efi_status_t xen_efi_get_next_variable(unsigned long *name_size, | |
| 224 | − efi_char16_t *name, efi_guid_t *vendor); | |
| 225 | −efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 226 | − u32 attr, unsigned long data_size, | |
| 227 | − void *data); | |
| 228 | −efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, | |
| 229 | − u64 *remaining_space, | |
| 230 | − u64 *max_variable_size); | |
| 231 | −efi_status_t xen_efi_get_next_high_mono_count(u32 *count); | |
| 232 | −efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, | |
| 233 | − unsigned long count, unsigned long sg_list); | |
| 234 | −efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, | |
| 235 | − unsigned long count, u64 *max_size, | |
| 236 | − int *reset_type); | |
| 237 | −void xen_efi_reset_system(int reset_type, efi_status_t status, | |
| 238 | − unsigned long data_size, efi_char16_t *data); | |
| 215 | +void xen_efi_runtime_setup(void); | |
| 239 | 216 | |
| 240 | 217 | |
| 241 | 218 | #ifdef CONFIG_PREEMPT |
| @@ -87,9 +87,9 @@ void *dma_common_contiguous_remap(struct page *page, size_t size, · 86 unmodified lines | ||
| 87 | 87 | */ |
| 88 | 88 | void dma_common_free_remap(void *cpu_addr, size_t size) |
| 89 | 89 | { |
| 90 | − struct page **pages = dma_common_find_pages(cpu_addr); | |
| 90 | + struct vm_struct *area = find_vm_area(cpu_addr); | |
| 91 | 91 | |
| 92 | − if (!pages) { | |
| 92 | + if (!area || area->flags != VM_DMA_COHERENT) { | |
| 93 | 93 | WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr); |
| 94 | 94 | return; |
| 95 | 95 | } |
| @@ -3779,11 +3779,23 @@ static void rotate_ctx(struct perf_event_context *ctx, struct perf_event *event) · 3778 unmodified lines | ||
| 3779 | 3779 | perf_event_groups_insert(&ctx->flexible_groups, event); |
| 3780 | 3780 | } |
| 3781 | 3781 | |
| 3782 | +/* pick an event from the flexible_groups to rotate */ | |
| 3782 | 3783 | static inline struct perf_event * |
| 3783 | −ctx_first_active(struct perf_event_context *ctx) | |
| 3784 | +ctx_event_to_rotate(struct perf_event_context *ctx) | |
| 3784 | 3785 | { |
| 3785 | − return list_first_entry_or_null(&ctx->flexible_active, | |
| 3786 | − struct perf_event, active_list); | |
| 3786 | + struct perf_event *event; | |
| 3787 | + | |
| 3788 | + /* pick the first active flexible event */ | |
| 3789 | + event = list_first_entry_or_null(&ctx->flexible_active, | |
| 3790 | + struct perf_event, active_list); | |
| 3791 | + | |
| 3792 | + /* if no active flexible event, pick the first event */ | |
| 3793 | + if (!event) { | |
| 3794 | + event = rb_entry_safe(rb_first(&ctx->flexible_groups.tree), | |
| 3795 | + typeof(*event), group_node); | |
| 3796 | + } | |
| 3797 | + | |
| 3798 | + return event; | |
| 3787 | 3799 | } |
| 3788 | 3800 | |
| 3789 | 3801 | static bool perf_rotate_context(struct perf_cpu_context *cpuctx) |
| @@ -3808,9 +3820,9 @@ static bool perf_rotate_context(struct perf_cpu_context *cpuctx) · 18 unmodified lines | ||
| 3808 | 3820 | perf_pmu_disable(cpuctx->ctx.pmu); |
| 3809 | 3821 | |
| 3810 | 3822 | if (task_rotate) |
| 3811 | − task_event = ctx_first_active(task_ctx); | |
| 3823 | + task_event = ctx_event_to_rotate(task_ctx); | |
| 3812 | 3824 | if (cpu_rotate) |
| 3813 | − cpu_event = ctx_first_active(&cpuctx->ctx); | |
| 3825 | + cpu_event = ctx_event_to_rotate(&cpuctx->ctx); | |
| 3814 | 3826 | |
| 3815 | 3827 | /* |
| 3816 | 3828 | * As per the order given at ctx_resched() first 'pop' task flexible |
| @@ -5668,7 +5680,8 @@ again: · 1851 unmodified lines | ||
| 5668 | 5680 | * undo the VM accounting. |
| 5669 | 5681 | */ |
| 5670 | 5682 | |
| 5671 | − atomic_long_sub((size >> PAGE_SHIFT) + 1, &mmap_user->locked_vm); | |
| 5683 | + atomic_long_sub((size >> PAGE_SHIFT) + 1 - mmap_locked, | |
| 5684 | + &mmap_user->locked_vm); | |
| 5672 | 5685 | atomic64_sub(mmap_locked, &vma->vm_mm->pinned_vm); |
| 5673 | 5686 | free_uid(mmap_user); |
| 5674 | 5687 | |
| @@ -5812,8 +5825,20 @@ accounting: · 137 unmodified lines | ||
| 5812 | 5825 | |
| 5813 | 5826 | user_locked = atomic_long_read(&user->locked_vm) + user_extra; |
| 5814 | 5827 | |
| 5815 | − if (user_locked > user_lock_limit) | |
| 5828 | + if (user_locked <= user_lock_limit) { | |
| 5829 | + /* charge all to locked_vm */ | |
| 5830 | + } else if (atomic_long_read(&user->locked_vm) >= user_lock_limit) { | |
| 5831 | + /* charge all to pinned_vm */ | |
| 5832 | + extra = user_extra; | |
| 5833 | + user_extra = 0; | |
| 5834 | + } else { | |
| 5835 | + /* | |
| 5836 | + * charge locked_vm until it hits user_lock_limit; | |
| 5837 | + * charge the rest from pinned_vm | |
| 5838 | + */ | |
| 5816 | 5839 | extra = user_locked - user_lock_limit; |
| 5840 | + user_extra -= extra; | |
| 5841 | + } | |
| 5817 | 5842 | |
| 5818 | 5843 | lock_limit = rlimit(RLIMIT_MEMLOCK); |
| 5819 | 5844 | lock_limit >>= PAGE_SHIFT; |
| @@ -10586,55 +10611,26 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr, · 4766 unmodified lines | ||
| 10586 | 10611 | u32 size; |
| 10587 | 10612 | int ret; |
| 10588 | 10613 | |
| 10589 | − if (!access_ok(uattr, PERF_ATTR_SIZE_VER0)) | |
| 10590 | − return -EFAULT; | |
| 10591 | − | |
| 10592 | − /* | |
| 10593 | − * zero the full structure, so that a short copy will be nice. | |
| 10594 | − */ | |
| 10614 | + /* Zero the full structure, so that a short copy will be nice. */ | |
| 10595 | 10615 | memset(attr, 0, sizeof(*attr)); |
| 10596 | 10616 | |
| 10597 | 10617 | ret = get_user(size, &uattr->size); |
| 10598 | 10618 | if (ret) |
| 10599 | 10619 | return ret; |
| 10600 | 10620 | |
| 10601 | − if (size > PAGE_SIZE) /* silly large */ | |
| 10602 | − goto err_size; | |
| 10603 | − | |
| 10604 | − if (!size) /* abi compat */ | |
| 10621 | + /* ABI compatibility quirk: */ | |
| 10622 | + if (!size) | |
| 10605 | 10623 | size = PERF_ATTR_SIZE_VER0; |
| 10606 | − | |
| 10607 | − if (size < PERF_ATTR_SIZE_VER0) | |
| 10624 | + if (size < PERF_ATTR_SIZE_VER0 || size > PAGE_SIZE) | |
| 10608 | 10625 | goto err_size; |
| 10609 | 10626 | |
| 10610 | − /* | |
| 10611 | − * If we're handed a bigger struct than we know of, | |
| 10612 | − * ensure all the unknown bits are 0 - i.e. new | |
| 10613 | − * user-space does not rely on any kernel feature | |
| 10614 | − * extensions we dont know about yet. | |
| 10615 | − */ | |
| 10616 | − if (size > sizeof(*attr)) { | |
| 10617 | − unsigned char __user *addr; | |
| 10618 | − unsigned char __user *end; | |
| 10619 | − unsigned char val; | |
| 10620 | − | |
| 10621 | − addr = (void __user *)uattr + sizeof(*attr); | |
| 10622 | − end = (void __user *)uattr + size; | |
| 10623 | − | |
| 10624 | − for (; addr < end; addr++) { | |
| 10625 | − ret = get_user(val, addr); | |
| 10626 | − if (ret) | |
| 10627 | − return ret; | |
| 10628 | − if (val) | |
| 10629 | − goto err_size; | |
| 10630 | − } | |
| 10631 | − size = sizeof(*attr); | |
| 10627 | + ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size); | |
| 10628 | + if (ret) { | |
| 10629 | + if (ret == -E2BIG) | |
| 10630 | + goto err_size; | |
| 10631 | + return ret; | |
| 10632 | 10632 | } |
| 10633 | 10633 | |
| 10634 | − ret = copy_from_user(attr, uattr, size); | |
| 10635 | − if (ret) | |
| 10636 | − return -EFAULT; | |
| 10637 | − | |
| 10638 | 10634 | attr->size = size; |
| 10639 | 10635 | |
| 10640 | 10636 | if (attr->__reserved_1) |
| @@ -11891,6 +11887,10 @@ static int inherit_group(struct perf_event *parent_event, · 1250 unmodified lines | ||
| 11891 | 11887 | child, leader, child_ctx); |
| 11892 | 11888 | if (IS_ERR(child_ctr)) |
| 11893 | 11889 | return PTR_ERR(child_ctr); |
| 11890 | + | |
| 11891 | + if (sub->aux_event == parent_event && | |
| 11892 | + !perf_get_aux_event(child_ctr, leader)) | |
| 11893 | + return -EINVAL; | |
| 11894 | 11894 | } |
| 11895 | 11895 | return 0; |
| 11896 | 11896 | } |
| @@ -2525,39 +2525,19 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, · 2524 unmodified lines | ||
| 2525 | 2525 | #ifdef __ARCH_WANT_SYS_CLONE3 |
| 2526 | 2526 | noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, |
| 2527 | 2527 | struct clone_args __user *uargs, |
| 2528 | − size_t size) | |
| 2528 | + size_t usize) | |
| 2529 | 2529 | { |
| 2530 | + int err; | |
| 2530 | 2531 | struct clone_args args; |
| 2531 | 2532 | |
| 2532 | − if (unlikely(size > PAGE_SIZE)) | |
| 2533 | + if (unlikely(usize > PAGE_SIZE)) | |
| 2533 | 2534 | return -E2BIG; |
| 2534 | − | |
| 2535 | − if (unlikely(size < sizeof(struct clone_args))) | |
| 2535 | + if (unlikely(usize < CLONE_ARGS_SIZE_VER0)) | |
| 2536 | 2536 | return -EINVAL; |
| 2537 | 2537 | |
| 2538 | − if (unlikely(!access_ok(uargs, size))) | |
| 2539 | − return -EFAULT; | |
| 2540 | − | |
| 2541 | − if (size > sizeof(struct clone_args)) { | |
| 2542 | − unsigned char __user *addr; | |
| 2543 | − unsigned char __user *end; | |
| 2544 | − unsigned char val; | |
| 2545 | − | |
| 2546 | − addr = (void __user *)uargs + sizeof(struct clone_args); | |
| 2547 | − end = (void __user *)uargs + size; | |
| 2548 | − | |
| 2549 | − for (; addr < end; addr++) { | |
| 2550 | − if (get_user(val, addr)) | |
| 2551 | − return -EFAULT; | |
| 2552 | − if (val) | |
| 2553 | − return -E2BIG; | |
| 2554 | − } | |
| 2555 | − | |
| 2556 | − size = sizeof(struct clone_args); | |
| 2557 | − } | |
| 2558 | − | |
| 2559 | − if (copy_from_user(&args, uargs, size)) | |
| 2560 | − return -EFAULT; | |
| 2538 | + err = copy_struct_from_user(&args, sizeof(args), uargs, usize); | |
| 2539 | + if (err) | |
| 2540 | + return err; | |
| 2561 | 2541 | |
| 2562 | 2542 | /* |
| 2563 | 2543 | * Verify that higher 32bits of exit_signal are unset and that |
| @@ -2604,6 +2584,17 @@ static bool clone3_args_valid(const struct kernel_clone_args *kargs) · 40 unmodified lines | ||
| 2604 | 2584 | return true; |
| 2605 | 2585 | } |
| 2606 | 2586 | |
| 2587 | +/** | |
| 2588 | + * clone3 - create a new process with specific properties | |
| 2589 | + * @uargs: argument structure | |
| 2590 | + * @size: size of @uargs | |
| 2591 | + * | |
| 2592 | + * clone3() is the extensible successor to clone()/clone2(). | |
| 2593 | + * It takes a struct as argument that is versioned by its size. | |
| 2594 | + * | |
| 2595 | + * Return: On success, a positive PID for the child process. | |
| 2596 | + * On error, a negative errno number. | |
| 2597 | + */ | |
| 2607 | 2598 | SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size) |
| 2608 | 2599 | { |
| 2609 | 2600 | int err; |
| @@ -2934,7 +2925,7 @@ int sysctl_max_threads(struct ctl_table *table, int write, · 324 unmodified lines | ||
| 2934 | 2925 | struct ctl_table t; |
| 2935 | 2926 | int ret; |
| 2936 | 2927 | int threads = max_threads; |
| 2937 | − int min = MIN_THREADS; | |
| 2928 | + int min = 1; | |
| 2938 | 2929 | int max = MAX_THREADS; |
| 2939 | 2930 | |
| 2940 | 2931 | t = *table; |
| @@ -2946,7 +2937,7 @@ int sysctl_max_threads(struct ctl_table *table, int write, · 5 unmodified lines | ||
| 2946 | 2937 | if (ret || !write) |
| 2947 | 2938 | return ret; |
| 2948 | 2939 | |
| 2949 | − set_max_threads(threads); | |
| 2940 | + max_threads = threads; | |
| 2950 | 2941 | |
| 2951 | 2942 | return 0; |
| 2952 | 2943 | } |
| @@ -22,12 +22,6 @@ EXPORT_SYMBOL(system_freezing_cnt); · 21 unmodified lines | ||
| 22 | 22 | bool pm_freezing; |
| 23 | 23 | bool pm_nosig_freezing; |
| 24 | 24 | |
| 25 | −/* | |
| 26 | − * Temporary export for the deadlock workaround in ata_scsi_hotplug(). | |
| 27 | − * Remove once the hack becomes unnecessary. | |
| 28 | − */ | |
| 29 | −EXPORT_SYMBOL_GPL(pm_freezing); | |
| 30 | − | |
| 31 | 25 | /* protects freezing and frozen transitions */ |
| 32 | 26 | static DEFINE_SPINLOCK(freezer_lock); |
| 33 | 27 | |
| @@ -71,7 +71,10 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 · 70 unmodified lines | ||
| 71 | 71 | find $cpio_dir -type f -print0 | |
| 72 | 72 | xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;' |
| 73 | 73 | |
| 74 | −tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null | |
| 74 | +# Create archive and try to normalize metadata for reproducibility | |
| 75 | +tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ | |
| 76 | + --owner=0 --group=0 --sort=name --numeric-owner \ | |
| 77 | + -Jcf $tarfile -C $cpio_dir/ . > /dev/null | |
| 75 | 78 | |
| 76 | 79 | echo "$src_files_md5" > kernel/kheaders.md5 |
| 77 | 80 | echo "$obj_files_md5" >> kernel/kheaders.md5 |
| @@ -180,6 +180,7 @@ void panic(const char *fmt, ...) · 179 unmodified lines | ||
| 180 | 180 | * after setting panic_cpu) from invoking panic() again. |
| 181 | 181 | */ |
| 182 | 182 | local_irq_disable(); |
| 183 | + preempt_disable_notrace(); | |
| 183 | 184 | |
| 184 | 185 | /* |
| 185 | 186 | * It's possible to come here directly from a panic-assertion and |
| @@ -5106,9 +5106,6 @@ static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *a · 5105 unmodified lines | ||
| 5106 | 5106 | u32 size; |
| 5107 | 5107 | int ret; |
| 5108 | 5108 | |
| 5109 | − if (!access_ok(uattr, SCHED_ATTR_SIZE_VER0)) | |
| 5110 | − return -EFAULT; | |
| 5111 | − | |
| 5112 | 5109 | /* Zero the full structure, so that a short copy will be nice: */ |
| 5113 | 5110 | memset(attr, 0, sizeof(*attr)); |
| 5114 | 5111 | |
| @@ -5116,45 +5113,19 @@ static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *a · 1 unmodified line | ||
| 5116 | 5113 | if (ret) |
| 5117 | 5114 | return ret; |
| 5118 | 5115 | |
| 5119 | − /* Bail out on silly large: */ | |
| 5120 | − if (size > PAGE_SIZE) | |
| 5121 | − goto err_size; | |
| 5122 | − | |
| 5123 | 5116 | /* ABI compatibility quirk: */ |
| 5124 | 5117 | if (!size) |
| 5125 | 5118 | size = SCHED_ATTR_SIZE_VER0; |
| 5126 | − | |
| 5127 | − if (size < SCHED_ATTR_SIZE_VER0) | |
| 5119 | + if (size < SCHED_ATTR_SIZE_VER0 || size > PAGE_SIZE) | |
| 5128 | 5120 | goto err_size; |
| 5129 | 5121 | |
| 5130 | − /* | |
| 5131 | − * If we're handed a bigger struct than we know of, | |
| 5132 | − * ensure all the unknown bits are 0 - i.e. new | |
| 5133 | − * user-space does not rely on any kernel feature | |
| 5134 | − * extensions we dont know about yet. | |
| 5135 | − */ | |
| 5136 | − if (size > sizeof(*attr)) { | |
| 5137 | − unsigned char __user *addr; | |
| 5138 | − unsigned char __user *end; | |
| 5139 | − unsigned char val; | |
| 5140 | − | |
| 5141 | − addr = (void __user *)uattr + sizeof(*attr); | |
| 5142 | − end = (void __user *)uattr + size; | |
| 5143 | − | |
| 5144 | − for (; addr < end; addr++) { | |
| 5145 | − ret = get_user(val, addr); | |
| 5146 | − if (ret) | |
| 5147 | − return ret; | |
| 5148 | − if (val) | |
| 5149 | − goto err_size; | |
| 5150 | − } | |
| 5151 | − size = sizeof(*attr); | |
| 5122 | + ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size); | |
| 5123 | + if (ret) { | |
| 5124 | + if (ret == -E2BIG) | |
| 5125 | + goto err_size; | |
| 5126 | + return ret; | |
| 5152 | 5127 | } |
| 5153 | 5128 | |
| 5154 | − ret = copy_from_user(attr, uattr, size); | |
| 5155 | − if (ret) | |
| 5156 | − return -EFAULT; | |
| 5157 | − | |
| 5158 | 5129 | if ((attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) && |
| 5159 | 5130 | size < SCHED_ATTR_SIZE_VER1) |
| 5160 | 5131 | return -EINVAL; |
| @@ -5354,7 +5325,7 @@ sched_attr_copy_to_user(struct sched_attr __user *uattr, · 193 unmodified lines | ||
| 5354 | 5325 | * sys_sched_getattr - similar to sched_getparam, but with sched_attr |
| 5355 | 5326 | * @pid: the pid in question. |
| 5356 | 5327 | * @uattr: structure containing the extended parameters. |
| 5357 | − * @usize: sizeof(attr) that user-space knows about, for forwards and backwards compatibility. | |
| 5328 | + * @usize: sizeof(attr) for fwd/bwd comp. | |
| 5358 | 5329 | * @flags: for future extension. |
| 5359 | 5330 | */ |
| 5360 | 5331 | SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr, |
| @@ -740,7 +740,7 @@ void vtime_account_system(struct task_struct *tsk) · 739 unmodified lines | ||
| 740 | 740 | |
| 741 | 741 | write_seqcount_begin(&vtime->seqcount); |
| 742 | 742 | /* We might have scheduled out from guest path */ |
| 743 | − if (current->flags & PF_VCPU) | |
| 743 | + if (tsk->flags & PF_VCPU) | |
| 744 | 744 | vtime_account_guest(tsk, vtime); |
| 745 | 745 | else |
| 746 | 746 | __vtime_account_system(tsk, vtime); |
| @@ -783,7 +783,7 @@ void vtime_guest_enter(struct task_struct *tsk) · 36 unmodified lines | ||
| 783 | 783 | */ |
| 784 | 784 | write_seqcount_begin(&vtime->seqcount); |
| 785 | 785 | __vtime_account_system(tsk, vtime); |
| 786 | − current->flags |= PF_VCPU; | |
| 786 | + tsk->flags |= PF_VCPU; | |
| 787 | 787 | write_seqcount_end(&vtime->seqcount); |
| 788 | 788 | } |
| 789 | 789 | EXPORT_SYMBOL_GPL(vtime_guest_enter); |
| @@ -794,7 +794,7 @@ void vtime_guest_exit(struct task_struct *tsk) · 4 unmodified lines | ||
| 794 | 794 | |
| 795 | 795 | write_seqcount_begin(&vtime->seqcount); |
| 796 | 796 | vtime_account_guest(tsk, vtime); |
| 797 | − current->flags &= ~PF_VCPU; | |
| 797 | + tsk->flags &= ~PF_VCPU; | |
| 798 | 798 | write_seqcount_end(&vtime->seqcount); |
| 799 | 799 | } |
| 800 | 800 | EXPORT_SYMBOL_GPL(vtime_guest_exit); |
| @@ -4926,20 +4926,28 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) · 4925 unmodified lines | ||
| 4926 | 4926 | if (++count > 3) { |
| 4927 | 4927 | u64 new, old = ktime_to_ns(cfs_b->period); |
| 4928 | 4928 | |
| 4929 | − new = (old * 147) / 128; /* ~115% */ | |
| 4930 | − new = min(new, max_cfs_quota_period); | |
| 4931 | − | |
| 4932 | − cfs_b->period = ns_to_ktime(new); | |
| 4933 | − | |
| 4934 | − /* since max is 1s, this is limited to 1e9^2, which fits in u64 */ | |
| 4935 | − cfs_b->quota *= new; | |
| 4936 | − cfs_b->quota = div64_u64(cfs_b->quota, old); | |
| 4937 | − | |
| 4938 | − pr_warn_ratelimited( | |
| 4939 | − "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n", | |
| 4940 | − smp_processor_id(), | |
| 4941 | − div_u64(new, NSEC_PER_USEC), | |
| 4942 | − div_u64(cfs_b->quota, NSEC_PER_USEC)); | |
| 4929 | + /* | |
| 4930 | + * Grow period by a factor of 2 to avoid losing precision. | |
| 4931 | + * Precision loss in the quota/period ratio can cause __cfs_schedulable | |
| 4932 | + * to fail. | |
| 4933 | + */ | |
| 4934 | + new = old * 2; | |
| 4935 | + if (new < max_cfs_quota_period) { | |
| 4936 | + cfs_b->period = ns_to_ktime(new); | |
| 4937 | + cfs_b->quota *= 2; | |
| 4938 | + | |
| 4939 | + pr_warn_ratelimited( | |
| 4940 | + "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us = %lld, cfs_quota_us = %lld)\n", | |
| 4941 | + smp_processor_id(), | |
| 4942 | + div_u64(new, NSEC_PER_USEC), | |
| 4943 | + div_u64(cfs_b->quota, NSEC_PER_USEC)); | |
| 4944 | + } else { | |
| 4945 | + pr_warn_ratelimited( | |
| 4946 | + "cfs_period_timer[cpu%d]: period too short, but cannot scale up without losing precision (cfs_period_us = %lld, cfs_quota_us = %lld)\n", | |
| 4947 | + smp_processor_id(), | |
| 4948 | + div_u64(old, NSEC_PER_USEC), | |
| 4949 | + div_u64(cfs_b->quota, NSEC_PER_USEC)); | |
| 4950 | + } | |
| 4943 | 4951 | |
| 4944 | 4952 | /* reset count so we don't come right back in here */ |
| 4945 | 4953 | count = 0; |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/clocksource.h> |
| 19 | 19 | #include <linux/sched/task.h> |
| 20 | 20 | #include <linux/kallsyms.h> |
| 21 | +#include <linux/security.h> | |
| 21 | 22 | #include <linux/seq_file.h> |
| 22 | 23 | #include <linux/tracefs.h> |
| 23 | 24 | #include <linux/hardirq.h> |
| @@ -3486,6 +3487,11 @@ static int · 3462 unmodified lines | ||
| 3486 | 3487 | ftrace_avail_open(struct inode *inode, struct file *file) |
| 3487 | 3488 | { |
| 3488 | 3489 | struct ftrace_iterator *iter; |
| 3490 | + int ret; | |
| 3491 | + | |
| 3492 | + ret = security_locked_down(LOCKDOWN_TRACEFS); | |
| 3493 | + if (ret) | |
| 3494 | + return ret; | |
| 3489 | 3495 | |
| 3490 | 3496 | if (unlikely(ftrace_disabled)) |
| 3491 | 3497 | return -ENODEV; |
| @@ -3505,6 +3511,15 @@ ftrace_enabled_open(struct inode *inode, struct file *file) · 13 unmodified lines | ||
| 3505 | 3511 | { |
| 3506 | 3512 | struct ftrace_iterator *iter; |
| 3507 | 3513 | |
| 3514 | + /* | |
| 3515 | + * This shows us what functions are currently being | |
| 3516 | + * traced and by what. Not sure if we want lockdown | |
| 3517 | + * to hide such critical information for an admin. | |
| 3518 | + * Although, perhaps it can show information we don't | |
| 3519 | + * want people to see, but if something is tracing | |
| 3520 | + * something, we probably want to know about it. | |
| 3521 | + */ | |
| 3522 | + | |
| 3508 | 3523 | iter = __seq_open_private(file, &show_ftrace_seq_ops, sizeof(*iter)); |
| 3509 | 3524 | if (!iter) |
| 3510 | 3525 | return -ENOMEM; |
| @@ -3540,21 +3555,22 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag, · 29 unmodified lines | ||
| 3540 | 3555 | struct ftrace_hash *hash; |
| 3541 | 3556 | struct list_head *mod_head; |
| 3542 | 3557 | struct trace_array *tr = ops->private; |
| 3543 | − int ret = 0; | |
| 3558 | + int ret = -ENOMEM; | |
| 3544 | 3559 | |
| 3545 | 3560 | ftrace_ops_init(ops); |
| 3546 | 3561 | |
110 more lines aren’t shown here.
This diff is large: its 289 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 152 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 163 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 231 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.